#include "RunAction.hh" #include "PrimaryGeneratorAction.hh" #include "DetectorConstruction.hh" // #include "B1Run.hh" #include "G4RunManager.hh" #include "G4Run.hh" #include "G4AccumulableManager.hh" #include "G4LogicalVolumeStore.hh" #include "G4LogicalVolume.hh" #include "G4UnitsTable.hh" #include "G4SystemOfUnits.hh" //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... RunAction::RunAction() : G4UserRunAction() { // add new units for dose // } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... RunAction::~RunAction() {} //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... void RunAction::BeginOfRunAction(const G4Run*) { // inform the runManager to save random number seed G4RunManager::GetRunManager()->SetRandomNumberStore(false); // reset accumulables to their initial values G4AccumulableManager* accumulableManager = G4AccumulableManager::Instance(); accumulableManager->Reset(); } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... void RunAction::EndOfRunAction(const G4Run* run) { G4int nofEvents = run->GetNumberOfEvent(); if (nofEvents == 0) return; // Merge accumulables G4AccumulableManager* accumulableManager = G4AccumulableManager::Instance(); accumulableManager->Merge(); // Run conditions // note: There is no primary generator action object for "master" // run manager for multi-threaded mode. const PrimaryGeneratorAction* generatorAction = static_cast (G4RunManager::GetRunManager()->GetUserPrimaryGeneratorAction()); G4String runCondition; if (generatorAction) { const G4ParticleGun* particleGun = generatorAction->GetParticleGun(); runCondition += particleGun->GetParticleDefinition()->GetParticleName(); runCondition += " of "; G4double particleEnergy = particleGun->GetParticleEnergy(); runCondition += G4BestUnit(particleEnergy,"Energy"); } // Print // if (IsMaster()) { G4cout << G4endl << "--------------------End of Global Run-----------------------"; } else { G4cout << G4endl << "--------------------End of Local Run------------------------"; } G4cout << G4endl << " The run consists of " << nofEvents << " "<< runCondition << G4endl; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......