Warning, file /geant4/examples/extended/medical/dna/neuron/src/RunAction.cc was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043 #include "RunAction.hh"
0044
0045 #include "CommandLineParser.hh"
0046 #include "DetectorConstruction.hh"
0047 #include "PrimaryGeneratorAction.hh"
0048 #include "Run.hh"
0049 #include "TrackingAction.hh"
0050
0051 #include "G4AnalysisManager.hh"
0052 #include "G4ParticleDefinition.hh"
0053 #include "G4Run.hh"
0054 #include "G4RunManager.hh"
0055 #include "G4SystemOfUnits.hh"
0056 #include "G4Threading.hh"
0057 #include "G4UImanager.hh"
0058 #include "G4UnitsTable.hh"
0059 #include "Randomize.hh"
0060
0061 #include <iomanip>
0062
0063 using namespace G4DNAPARSER;
0064
0065
0066
0067 RunAction::RunAction(DetectorConstruction* det, PrimaryGeneratorAction* prim)
0068 : G4UserRunAction(), fDetector(det), fPrimary(prim)
0069 {}
0070
0071
0072
0073 G4Run* RunAction::GenerateRun()
0074 {
0075 if (nullptr == fRun) {
0076 fRun = new Run(fDetector);
0077 }
0078 return fRun;
0079 }
0080
0081
0082
0083 void RunAction::BeginOfRunAction(const G4Run* )
0084 {
0085 RunInitManager::Instance()->Initialize();
0086
0087 if (nullptr != fPrimary) {
0088 G4ParticleDefinition* particle = fPrimary->GetParticleGun()->GetParticleDefinition();
0089 G4double energy = fPrimary->GetParticleGun()->GetParticleEnergy();
0090 fRun->SetPrimary(particle, energy);
0091 }
0092 }
0093
0094
0095
0096 void RunAction::EndOfRunAction(const G4Run* )
0097 {
0098 if (isMaster) fRun->EndOfRun();
0099 }
0100
0101
0102
0103 void RunAction::CreateHistogram()
0104 {
0105
0106
0107
0108 CommandLineParser* parser = CommandLineParser::GetParser();
0109 Command* command(0);
0110 if ((command = parser->GetCommandIfActive("-out")) == 0) return;
0111 }
0112
0113
0114
0115 void RunAction::WriteHistogram()
0116 {
0117 CommandLineParser* parser = CommandLineParser::GetParser();
0118 Command* commandLine(0);
0119 if ((commandLine = parser->GetCommandIfActive("-out")) == 0) return;
0120
0121
0122
0123 G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
0124
0125
0126
0127 analysisManager->Write();
0128 analysisManager->CloseFile();
0129
0130 if (fDebug) {
0131 G4cout << "================ ROOT FILES HAVE BEEN WRITTEN" << G4endl;
0132 }
0133 }
0134
0135
0136
0137 void RunAction::PrintRunInfo(const G4Run* run)
0138 {
0139 G4cout << "================ Run is = " << run->GetRunID() << G4endl;
0140 G4cout << "================ Run type is = " << G4RunManager::GetRunManager()->GetRunManagerType()
0141 << G4endl;
0142 G4cout << "================ Event processed = " << run->GetNumberOfEventToBeProcessed() << G4endl;
0143 G4cout << "================ Nevent = " << run->GetNumberOfEvent() << G4endl;
0144 }
0145
0146