|
|
|||
File indexing completed on 2025-12-16 09:32:07
0001 // 0002 // ******************************************************************** 0003 // * License and Disclaimer * 0004 // * * 0005 // * The Geant4 software is copyright of the Copyright Holders of * 0006 // * the Geant4 Collaboration. It is provided under the terms and * 0007 // * conditions of the Geant4 Software License, included in the file * 0008 // * LICENSE and available at http://cern.ch/geant4/license . These * 0009 // * include a list of copyright holders. * 0010 // * * 0011 // * Neither the authors of this software system, nor their employing * 0012 // * institutes,nor the agencies providing financial support for this * 0013 // * work make any representation or warranty, express or implied, * 0014 // * regarding this software system or assume any liability for its * 0015 // * use. Please see the license in the file LICENSE and URL above * 0016 // * for the full disclaimer and the limitation of liability. * 0017 // * * 0018 // * This code implementation is the result of the scientific and * 0019 // * technical work of the GEANT4 collaboration. * 0020 // * By using, copying, modifying or distributing the software (or * 0021 // * any work based on the software) you agree to acknowledge its * 0022 // * use in resulting scientific publications, and indicate your * 0023 // * acceptance of all terms of the Geant4 Software license. * 0024 // ******************************************************************** 0025 // 0026 /// \file src/RunAction.cc 0027 /// \brief Implementation of the RunAction class 0028 // 0029 // 0030 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0031 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0032 0033 #include "RunAction.hh" 0034 0035 #include "DetectorConstruction.hh" 0036 #include "PrimaryGeneratorAction.hh" 0037 #include "Run.hh" 0038 0039 #include "G4RunManager.hh" 0040 #include "G4Timer.hh" 0041 #include "Randomize.hh" 0042 0043 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0044 0045 RunAction::RunAction(DetectorConstruction* det, PrimaryGeneratorAction* prim) 0046 : G4UserRunAction(), fDetector(det), fPrimary(prim), fRun(nullptr) 0047 {} 0048 0049 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0050 0051 G4Run* RunAction::GenerateRun() 0052 { 0053 fRun = new Run(fDetector); 0054 return fRun; 0055 } 0056 0057 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0058 0059 void RunAction::BeginOfRunAction(const G4Run*) 0060 { 0061 // keep run condition 0062 if (fPrimary) { 0063 G4ParticleDefinition* particle = fPrimary->GetParticleGun()->GetParticleDefinition(); 0064 G4double energy = fPrimary->GetParticleGun()->GetParticleEnergy(); 0065 fRun->SetPrimary(particle, energy); 0066 } 0067 0068 if (isMaster) { 0069 fTimer.Start(); 0070 } 0071 } 0072 0073 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0074 0075 void RunAction::EndOfRunAction(const G4Run*) 0076 { 0077 // compute and print statistic 0078 if (isMaster) { 0079 fTimer.Stop(); 0080 if (!((G4RunManager::GetRunManager()->GetRunManagerType() == G4RunManager::sequentialRM))) { 0081 G4cout << "\n" 0082 << "Total number of events: " << fRun->GetNumberOfEvent() << G4endl; 0083 G4cout << "Master thread time: " << fTimer << G4endl; 0084 } 0085 fRun->EndOfRun(); 0086 } 0087 } 0088 0089 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|