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 medical/fanoCavity2/src/RunAction.cc 26 /// \file medical/fanoCavity2/src/RunAction.cc 27 /// \brief Implementation of the RunAction cla 27 /// \brief Implementation of the RunAction class 28 // 28 // 29 // << 29 // 30 //....oooOO0OOooo........oooOO0OOooo........oo 30 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 31 //....oooOO0OOooo........oooOO0OOooo........oo 31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 32 32 33 #include "RunAction.hh" 33 #include "RunAction.hh" 34 << 35 #include "DetectorConstruction.hh" 34 #include "DetectorConstruction.hh" 36 #include "HistoManager.hh" << 37 #include "PrimaryGeneratorAction.hh" 35 #include "PrimaryGeneratorAction.hh" 38 #include "Run.hh" << 36 #include "HistoManager.hh" 39 37 40 #include "G4Electron.hh" << 38 #include "Run.hh" 41 #include "G4EmCalculator.hh" << 42 #include "G4Run.hh" 39 #include "G4Run.hh" 43 #include "G4RunManager.hh" 40 #include "G4RunManager.hh" 44 #include "G4SystemOfUnits.hh" << 45 #include "G4UnitsTable.hh" 41 #include "G4UnitsTable.hh" 46 #include "Randomize.hh" << 42 #include "G4EmCalculator.hh" >> 43 #include "G4Electron.hh" 47 44 >> 45 #include "G4SystemOfUnits.hh" >> 46 #include "Randomize.hh" 48 #include <iomanip> 47 #include <iomanip> 49 48 50 //....oooOO0OOooo........oooOO0OOooo........oo 49 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 51 50 52 RunAction::RunAction(DetectorConstruction* det 51 RunAction::RunAction(DetectorConstruction* det, PrimaryGeneratorAction* kin) 53 : fDetector(det), fKinematic(kin), fRun(0), << 52 :fDetector(det),fKinematic(kin),fRun(0),fHistoManager(0) 54 { 53 { 55 fHistoManager = new HistoManager(); << 54 fHistoManager = new HistoManager(); 56 } 55 } 57 56 58 //....oooOO0OOooo........oooOO0OOooo........oo 57 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 59 58 60 RunAction::~RunAction() 59 RunAction::~RunAction() 61 { 60 { 62 delete fHistoManager; << 61 delete fHistoManager; 63 } 62 } 64 63 65 //....oooOO0OOooo........oooOO0OOooo........oo 64 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 66 G4Run* RunAction::GenerateRun() 65 G4Run* RunAction::GenerateRun() 67 { 66 { 68 fRun = new Run(fDetector, fKinematic, isMast << 67 fRun = new Run(fDetector,fKinematic,isMaster); 69 return fRun; 68 return fRun; 70 } 69 } 71 70 72 //....oooOO0OOooo........oooOO0OOooo........oo 71 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 73 72 74 void RunAction::BeginOfRunAction(const G4Run* 73 void RunAction::BeginOfRunAction(const G4Run* aRun) 75 { << 74 { 76 // do not save Rndm status 75 // do not save Rndm status 77 G4RunManager::GetRunManager()->SetRandomNumb 76 G4RunManager::GetRunManager()->SetRandomNumberStore(false); 78 if (isMaster) { << 77 if (isMaster) >> 78 { 79 CLHEP::HepRandom::showEngineStatus(); 79 CLHEP::HepRandom::showEngineStatus(); 80 G4cout << "### Run " << aRun->GetRunID() < << 80 G4cout << "### Run " << aRun->GetRunID() << " start." << G4endl; 81 } 81 } 82 << 82 83 // G4int NbofEvents = aRun->GetNumberOfEvent << 83 //G4int NbofEvents = aRun->GetNumberOfEventToBeProcessed(); 84 // if (NbofEvents == 0) return; << 84 //if (NbofEvents == 0) return; 85 << 85 86 // run conditions << 86 87 // << 87 //run conditions 88 G4ParticleDefinition* particleGun = fKinemat << 88 // >> 89 G4ParticleDefinition* particleGun >> 90 = fKinematic->GetParticleGun()->GetParticleDefinition(); 89 G4String partName = particleGun->GetParticle 91 G4String partName = particleGun->GetParticleName(); 90 // G4double energyGun = fKinematic->GetParti << 92 //G4double energyGun = fKinematic->GetParticleGun()->GetParticleEnergy(); >> 93 91 94 92 // histograms << 95 //histograms 93 // 96 // 94 /* << 97 /* 95 98 96 G4AnalysisManager* analysisManager = G4Ana << 99 G4AnalysisManager* analysisManager = G4AnalysisManager::Instance(); 97 if ( analysisManager->IsActive() ) { << 100 if ( analysisManager->IsActive() ) { 98 analysisManager->OpenFile(); << 101 analysisManager->OpenFile(); 99 } << 102 } 100 */ << 103 */ 101 } 104 } 102 105 103 //....oooOO0OOooo........oooOO0OOooo........oo 106 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 104 107 105 void RunAction::EndOfRunAction(const G4Run*) << 108 void RunAction::EndOfRunAction(const G4Run* ) 106 { 109 { 107 // compute and print statistic 110 // compute and print statistic 108 if (isMaster) fRun->EndOfRun(); 111 if (isMaster) fRun->EndOfRun(); 109 << 112 110 // save histograms 113 // save histograms 111 G4AnalysisManager* analysisManager = G4Analy 114 G4AnalysisManager* analysisManager = G4AnalysisManager::Instance(); 112 if (analysisManager->IsActive()) { << 115 if ( analysisManager->IsActive() ) { 113 analysisManager->Write(); 116 analysisManager->Write(); 114 analysisManager->CloseFile(); 117 analysisManager->CloseFile(); 115 } << 118 } 116 << 119 117 // show Rndm status 120 // show Rndm status 118 if (isMaster) CLHEP::HepRandom::showEngineSt << 121 if ( isMaster )CLHEP::HepRandom::showEngineStatus(); 119 } 122 } >> 123 >> 124 120 125 121 //....oooOO0OOooo........oooOO0OOooo........oo 126 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 122 127