Geant4 Cross Reference |
1 // 1 2 // ******************************************* 3 // * License and Disclaimer 4 // * 5 // * The Geant4 software is copyright of th 6 // * the Geant4 Collaboration. It is provided 7 // * conditions of the Geant4 Software License 8 // * LICENSE and available at http://cern.ch/ 9 // * include a list of copyright holders. 10 // * 11 // * Neither the authors of this software syst 12 // * institutes,nor the agencies providing fin 13 // * work make any representation or warran 14 // * regarding this software system or assum 15 // * use. Please see the license in the file 16 // * for the full disclaimer and the limitatio 17 // * 18 // * This code implementation is the result 19 // * technical work of the GEANT4 collaboratio 20 // * By using, copying, modifying or distri 21 // * any work based on the software) you ag 22 // * use in resulting scientific publicati 23 // * acceptance of all terms of the Geant4 Sof 24 // ******************************************* 25 // 26 // 27 /// \file medical/GammaTherapy/src/RunAction.c 28 /// \brief Implementation of the RunAction cla 29 // 30 // ------------------------------------------- 31 // 32 // GEANT4 33 // 34 // ------------------------------------------- 35 36 //....oooOO0OOooo........oooOO0OOooo........oo 37 //....oooOO0OOooo........oooOO0OOooo........oo 38 39 #include "RunAction.hh" 40 41 #include "DetectorConstruction.hh" 42 #include "HistoManager.hh" 43 #include "PrimaryGeneratorAction.hh" 44 #include "Run.hh" 45 46 #include "Randomize.hh" 47 #include "globals.hh" 48 49 //....oooOO0OOooo........oooOO0OOooo........oo 50 51 RunAction::RunAction(DetectorConstruction* det 52 : G4UserRunAction(), fDetector(det), fRun(0) 53 { 54 // Book predefined histograms 55 fHistoManager = new HistoManager(); 56 fHistoManager->Update(det); 57 } 58 59 //....oooOO0OOooo........oooOO0OOooo........oo 60 61 RunAction::~RunAction() 62 { 63 delete fHistoManager; 64 } 65 66 //....oooOO0OOooo........oooOO0OOooo........oo 67 68 G4Run* RunAction::GenerateRun() 69 { 70 fRun = new Run(fDetector, fHistoManager); 71 return fRun; 72 } 73 74 void RunAction::BeginOfRunAction(const G4Run*) 75 { 76 // save Rndm status 77 //// G4RunManager::GetRunManager()->SetRand 78 // if (isMaster) G4Random::showEngineStatus 79 80 CLHEP::HepRandom::showEngineStatus(); 81 82 // histograms 83 // 84 G4AnalysisManager* analysisManager = G4Analy 85 if (analysisManager->IsActive()) { 86 analysisManager->OpenFile(); 87 } 88 } 89 90 //....oooOO0OOooo........oooOO0OOooo........oo 91 92 void RunAction::EndOfRunAction(const G4Run*) 93 { 94 // print Run summary 95 // 96 if (isMaster) fRun->EndOfRun(); 97 98 // save histograms 99 G4AnalysisManager* analysisManager = G4Analy 100 if (analysisManager->IsActive()) { 101 analysisManager->Write(); 102 analysisManager->CloseFile(); 103 } 104 105 // show Rndm status 106 if (isMaster) G4Random::showEngineStatus(); 107 } 108 109 //....oooOO0OOooo........oooOO0OOooo........oo 110