33 #include "RunAction.hh"
35 #include "TrackingAction.hh"
38 #include "Analysis.hh"
41 void PrintNParticles(std::map<const G4ParticleDefinition*, int>& container);
73 else BeginWorker(run);
90 void RunAction::BeginMaster(
const G4Run* run)
96 G4cout <<
"°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°" <<
G4endl;
98 G4cout <<
"°°°°°°°°°°°°°°°° RunAction::BeginMaster" <<
G4endl;
100 G4cout <<
"°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°" <<
G4endl;
105 if(fInitialized ==
false) InitializeWorker(run);
112 void RunAction::BeginWorker(
const G4Run* run)
116 G4cout <<
"°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°" <<
G4endl;
117 G4cout <<
"°°°°°°°°°°°°°°°° RunAction::BeginWorker" <<
G4endl;
119 G4cout <<
"°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°" <<
G4endl;
121 if(fInitialized ==
false) InitializeWorker(run);
126 void RunAction::EndMaster(
const G4Run* run)
135 void RunAction::EndWorker(
const G4Run* run)
143 if ( nofEvents == 0 )
147 G4cout <<
"°°°°°°°°°°°°°°°° NO EVENTS TREATED IN THIS RUN ==> LEAVING RunAction::EndOfRunAction "<<
G4endl;
160 delete G4AnalysisManager::Instance();
165 std::map<const G4ParticleDefinition*, int>&
168 G4cout <<
"Number and type of particles created outside region \"Target\" :" <<
G4endl;
174 std::map<const G4ParticleDefinition*, int>&
177 G4cout <<
"Number and type of particles created in region \"Target\" :" <<
G4endl;
185 void RunAction::InitializeWorker(
const G4Run*)
187 if (fpTrackingAction == 0)
191 if(fpTrackingAction == 0 &&
isMaster ==
false)
194 exDescrption <<
"fpTrackingAction is a null pointer. Has it been correctly initialized ?";
204 void RunAction::CreateHistogram()
212 G4cout <<
"##### Create analysis manager " <<
" " <<
this <<
G4endl;
215 G4cout <<
"Using " << analysisManager->GetType() <<
" analysis manager" <<
G4endl;
221 analysisManager->SetVerboseLevel(1);
225 G4String fileName =
"microdosimetry";
226 analysisManager->OpenFile(fileName);
230 analysisManager->CreateNtuple(
"microdosimetry",
"physics");
231 analysisManager->CreateNtupleDColumn(
"flagParticle");
232 analysisManager->CreateNtupleDColumn(
"flagProcess");
233 analysisManager->CreateNtupleDColumn(
"x");
234 analysisManager->CreateNtupleDColumn(
"y");
235 analysisManager->CreateNtupleDColumn(
"z");
236 analysisManager->CreateNtupleDColumn(
"totalEnergyDeposit");
237 analysisManager->CreateNtupleDColumn(
"stepLength");
238 analysisManager->CreateNtupleDColumn(
"kineticEnergyDifference");
239 analysisManager->FinishNtuple();
244 void RunAction::WriteHistogram()
252 analysisManager->Write();
253 analysisManager->CloseFile();
258 void RunAction::PrintRunInfo(
const G4Run* run)
270 std::map<const G4ParticleDefinition*, int>::iterator it;
271 for(it = container.begin() ;
272 it != container.end(); it ++)
274 G4cout <<
"N " << it->first->GetParticleName() <<
" : " << it->second <<
G4endl;
void BeginOfRunAction(const G4Run *)
std::ostringstream G4ExceptionDescription
std::map< const G4ParticleDefinition *, int > & GetNParticlesCreatedInTarget()
std::map< const G4ParticleDefinition *, int > & GetNParticlesCreatedInWorld()
G4GLOB_DLL std::ostream G4cout
G4int GetNumberOfEvent() const
RMType GetRunManagerType() const
void EndOfRunAction(const G4Run *)
const G4UserTrackingAction * GetUserTrackingAction() const
ExG4HbookAnalysisManager G4AnalysisManager
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
static G4RunManager * GetRunManager()
void PrintNParticles(std::map< const G4ParticleDefinition *, int > &container)
G4int GetNumberOfEventToBeProcessed() const