Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 /// \file electromagnetic/TestEm13/src/RunActi << 26 /// \file electromagnetic/TestEm1/src/RunAction.cc 27 /// \brief Implementation of the RunAction cla 27 /// \brief Implementation of the RunAction class 28 // 28 // 29 // << 29 // $Id: RunAction.cc 84207 2014-10-10 14:44:12Z gcosmo $ >> 30 // 30 //....oooOO0OOooo........oooOO0OOooo........oo 31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 31 //....oooOO0OOooo........oooOO0OOooo........oo 32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 32 33 33 #include "RunAction.hh" 34 #include "RunAction.hh" 34 << 35 #include "DetectorConstruction.hh" 35 #include "DetectorConstruction.hh" 36 #include "PrimaryGeneratorAction.hh" 36 #include "PrimaryGeneratorAction.hh" 37 #include "Run.hh" 37 #include "Run.hh" 38 38 39 #include "G4Run.hh" 39 #include "G4Run.hh" >> 40 #include "G4RunManager.hh" 40 #include "G4UnitsTable.hh" 41 #include "G4UnitsTable.hh" 41 #include "Randomize.hh" << 42 42 >> 43 #include "Randomize.hh" 43 #include <iomanip> 44 #include <iomanip> 44 45 45 //....oooOO0OOooo........oooOO0OOooo........oo 46 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 46 47 47 RunAction::RunAction(DetectorConstruction* det 48 RunAction::RunAction(DetectorConstruction* det, PrimaryGeneratorAction* kin) 48 : fDetector(det), fPrimary(kin) << 49 :G4UserRunAction(),fDetector(det),fPrimary(kin),fRun(0) 49 {} << 50 { } >> 51 >> 52 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 53 >> 54 RunAction::~RunAction() >> 55 { } 50 56 51 //....oooOO0OOooo........oooOO0OOooo........oo 57 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 52 58 53 G4Run* RunAction::GenerateRun() 59 G4Run* RunAction::GenerateRun() 54 { << 60 { 55 fRun = new Run(fDetector); << 61 fRun = new Run(fDetector); 56 return fRun; 62 return fRun; 57 } 63 } 58 //....oooOO0OOooo........oooOO0OOooo........oo 64 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 59 65 60 void RunAction::BeginOfRunAction(const G4Run*) 66 void RunAction::BeginOfRunAction(const G4Run*) 61 { << 67 { 62 // show Rndm status << 68 // save Rndm status 63 if (isMaster) G4Random::showEngineStatus(); << 69 ////G4RunManager::GetRunManager()->SetRandomNumberStore(true); 64 << 70 if (isMaster) G4Random::showEngineStatus(); >> 71 65 // keep run condition 72 // keep run condition 66 if (fPrimary) { << 73 if ( fPrimary ) { 67 G4ParticleDefinition* particle = fPrimary- << 74 G4ParticleDefinition* particle >> 75 = fPrimary->GetParticleGun()->GetParticleDefinition(); 68 G4double energy = fPrimary->GetParticleGun 76 G4double energy = fPrimary->GetParticleGun()->GetParticleEnergy(); 69 fRun->SetPrimary(particle, energy); 77 fRun->SetPrimary(particle, energy); 70 } 78 } 71 } 79 } 72 80 73 //....oooOO0OOooo........oooOO0OOooo........oo 81 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 74 82 75 void RunAction::EndOfRunAction(const G4Run*) 83 void RunAction::EndOfRunAction(const G4Run*) 76 { 84 { 77 // compute and print statistic << 85 // compute and print statistic 78 if (isMaster) fRun->EndOfRun(); 86 if (isMaster) fRun->EndOfRun(); 79 87 80 // show Rndm status 88 // show Rndm status 81 if (isMaster) G4Random::showEngineStatus(); << 89 if (isMaster) G4Random::showEngineStatus(); 82 } 90 } 83 91 84 //....oooOO0OOooo........oooOO0OOooo........oo 92 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 85 93