30 #include "RunAction.hh"
32 #include "TrackingAction.hh"
35 #include "Analysis.hh"
38 void PrintNParticles(std::map<const G4ParticleDefinition*, int>& container);
83 void RunAction::BeginMaster(
const G4Run* run)
89 G4cout <<
"°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°" <<
G4endl;
91 G4cout <<
"°°°°°°°°°°°°°°°° RunAction::BeginMaster" <<
G4endl;
93 G4cout <<
"°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°" <<
G4endl;
99 InitializeWorker(run);
108 void RunAction::BeginWorker(
const G4Run* run)
112 G4cout <<
"°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°" <<
G4endl;
113 G4cout <<
"°°°°°°°°°°°°°°°° RunAction::BeginWorker" <<
G4endl;
115 G4cout <<
"°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°" <<
G4endl;
118 InitializeWorker(run);
125 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 =
"microelectronics";
226 analysisManager->OpenFile(fileName);
230 analysisManager->CreateNtuple(
"microelectronics",
"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)
267 void PrintNParticles(std::map<const G4ParticleDefinition*, int>& container)
269 std::map<const G4ParticleDefinition*, int>::iterator it;
270 for(it = container.begin() ;
271 it != container.end(); it ++)
273 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