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 Run.hh 26 /// \file Run.hh 27 /// \brief Definition of the Run class 27 /// \brief Definition of the Run class 28 // 28 // 29 // << 29 // 30 30 31 //....oooOO0OOooo........oooOO0OOooo........oo 31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 32 //....oooOO0OOooo........oooOO0OOooo........oo 32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 33 33 34 #ifndef Run_h 34 #ifndef Run_h 35 #define Run_h 1 35 #define Run_h 1 36 36 37 #include "SteppingAction.hh" << 38 #include "TrackingAction.hh" << 39 << 40 #include "G4Run.hh" 37 #include "G4Run.hh" 41 #include "G4ThreeVector.hh" 38 #include "G4ThreeVector.hh" 42 << 39 #include "SteppingAction.hh" >> 40 #include "TrackingAction.hh" 43 #include <array> 41 #include <array> 44 42 45 //....oooOO0OOooo........oooOO0OOooo........oo 43 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 46 44 47 class Run : public G4Run << 45 class Run : public G4Run { 48 { << 46 // This class accumulates relevant quantities related to particle fluence collected during 49 // This class accumulates relevant quantit << 47 // the run. 50 // the run. << 48 // ( Note: these information are provided via calls of accessor methods of this Run class 51 // ( Note: these information are provided << 49 // made by SteppingAction::UserSteppingAction 52 // made by SteppingAction::UserSte << 50 // and TrackingAction::PreUserTrackingAction. ) 53 // and TrackingAction::PreUser << 51 // At the end of a run, the PrintInfo method is called by the run-action to print out 54 // At the end of a run, the PrintInfo me << 52 // some summary information about these quantities. 55 // some summary information about these qu << 53 // In multithreaded (MT) mode, an object of this class is filled up for each working thread, 56 // In multithreaded (MT) mode, an object o << 54 // and then merged (automatically by the Geant4 kernel) into another object (of this class) 57 // and then merged (automatically by the G << 55 // owned by the master class; the PrintInfo method is then called only for the latter run 58 // owned by the master class; the PrintIn << 56 // object. 59 // object. << 57 // Note that, for simplicity and brevity, we avoid histograms and print-out instead some 60 // Note that, for simplicity and brevity, << 58 // statistics (compute by ourself) at the end of the run. 61 // statistics (compute by ourself) at the << 62 public: 59 public: 63 Run(); 60 Run(); 64 ~Run() override = default; 61 ~Run() override = default; 65 << 62 66 void RecordEvent(const G4Event* anEvent) o << 63 void RecordEvent( const G4Event* anEvent ) override; 67 // This method is called automatically by 64 // This method is called automatically by the Geant4 kernel (not by the user!) at the end 68 // of each event. In the case of multithre 65 // of each event. In the case of multithreaded mode, it is called only for the working thread 69 // that handled that event. 66 // that handled that event. 70 67 71 void Merge(const G4Run* aRun) override; << 68 void Merge( const G4Run* aRun ) override; 72 // This method is called automatically by 69 // This method is called automatically by the Geant4 kernel (not by the user!) only in the 73 // case of multithreaded mode and only for 70 // case of multithreaded mode and only for working threads. 74 << 71 75 void PrintInfo() const; 72 void PrintInfo() const; 76 // This method is called by RunAction::End 73 // This method is called by RunAction::EndOfRunAction : in the case of multithreaded mode, 77 // only the master thread calls it. 74 // only the master thread calls it. 78 75 79 void SetPrimaryParticleId(const G4int inpu << 76 void SetPrimaryParticleId( const G4int inputValue ) { fPrimaryParticleId = inputValue; } 80 void SetPrimaryParticleEnergy(const G4doub << 77 void SetPrimaryParticleEnergy( const G4double inputValue ) 81 { << 78 { fPrimaryParticleEnergy = inputValue; } 82 fPrimaryParticleEnergy = inputValue; << 79 void SetPrimaryParticleDirection( const G4ThreeVector &inputValue ) 83 } << 80 { fPrimaryParticleDirection = inputValue; } 84 void SetPrimaryParticleDirection(const G4T << 81 void SetAbsorberMaterialName( const G4String &inputValue ) 85 { << 82 { fAbsorberMaterialName = inputValue; } 86 fPrimaryParticleDirection = inputValue; << 83 void SetActiveMaterialName( const G4String &inputValue ) { fActiveMaterialName = inputValue; } 87 } << 84 void SetCubicVolumeScoringUpDown( const G4double inputValue ) 88 void SetAbsorberMaterialName(const G4Strin << 85 { fCubicVolumeScoringUpDown = inputValue; } 89 void SetActiveMaterialName(const G4String& << 86 void SetCubicVolumeScoringSide( const G4double inputValue ) 90 void SetCubicVolumeScoringUpDown(const G4d << 87 { fCubicVolumeScoringSide = inputValue; } 91 { << 92 fCubicVolumeScoringUpDown = inputValue; << 93 } << 94 void SetCubicVolumeScoringSide(const G4dou << 95 { << 96 fCubicVolumeScoringSide = inputValue; << 97 } << 98 G4int GetPrimaryParticleId() const { retur 88 G4int GetPrimaryParticleId() const { return fPrimaryParticleId; } 99 G4double GetPrimaryParticleEnergy() const 89 G4double GetPrimaryParticleEnergy() const { return fPrimaryParticleEnergy; } 100 G4ThreeVector GetPrimaryParticleDirection( 90 G4ThreeVector GetPrimaryParticleDirection() const { return fPrimaryParticleDirection; } 101 G4String GetAbsorberMaterialName() const { 91 G4String GetAbsorberMaterialName() const { return fAbsorberMaterialName; } 102 G4String GetActiveMaterialName() const { r 92 G4String GetActiveMaterialName() const { return fActiveMaterialName; } 103 G4double GetCubicVolumeScoringUpDown() con 93 G4double GetCubicVolumeScoringUpDown() const { return fCubicVolumeScoringUpDown; } 104 G4double GetCubicVolumeScoringSide() const 94 G4double GetCubicVolumeScoringSide() const { return fCubicVolumeScoringSide; } 105 95 106 void << 96 void SetSteppingArray( const std::array< G4double, 107 SetSteppingArray(const std::array<G4double << 97 SteppingAction::fkNumberCombinations >& inputArray ); 108 std::array<G4double, SteppingAction::fkNum << 98 std::array< G4double, SteppingAction::fkNumberCombinations > GetSteppingArray() const 109 { << 99 { return fSteppingArray; } 110 return fSteppingArray; << 111 } << 112 // Accessor methods useful to transfer inf 100 // Accessor methods useful to transfer information collected by the stepping-action 113 // into this Run class 101 // into this Run class 114 102 115 void << 103 void SetTrackingArray1( const std::array< G4long, 116 SetTrackingArray1(const std::array<G4long, << 104 TrackingAction::fkNumberCombinations >& inputArray ); 117 std::array<G4long, TrackingAction::fkNumbe << 105 std::array< G4long, TrackingAction::fkNumberCombinations > GetTrackingArray1() const 118 { << 106 { return fTrackingArray1; } 119 return fTrackingArray1; << 107 void SetTrackingArray2( const std::array< G4double, 120 } << 108 TrackingAction::fkNumberCombinations >& inputArray ); 121 void << 109 std::array< G4double, TrackingAction::fkNumberCombinations > GetTrackingArray2() const 122 SetTrackingArray2(const std::array<G4doubl << 110 { return fTrackingArray2; } 123 std::array<G4double, TrackingAction::fkNum << 124 { << 125 return fTrackingArray2; << 126 } << 127 // Accessor methods useful to transfer inf 111 // Accessor methods useful to transfer information collected by the tracking-action 128 // into this Run class 112 // into this Run class 129 113 130 private: << 114 private: 131 G4int fNumEvents; 115 G4int fNumEvents; 132 G4int fPrimaryParticleId; 116 G4int fPrimaryParticleId; 133 G4double fPrimaryParticleEnergy; 117 G4double fPrimaryParticleEnergy; 134 G4ThreeVector fPrimaryParticleDirection; 118 G4ThreeVector fPrimaryParticleDirection; 135 G4String fAbsorberMaterialName; 119 G4String fAbsorberMaterialName; 136 G4String fActiveMaterialName; 120 G4String fActiveMaterialName; 137 G4double fCubicVolumeScoringUpDown; 121 G4double fCubicVolumeScoringUpDown; 138 G4double fCubicVolumeScoringSide; 122 G4double fCubicVolumeScoringSide; 139 std::array<G4double, SteppingAction::fkNum << 123 std::array< G4double, SteppingAction::fkNumberCombinations > fSteppingArray; 140 std::array<G4long, TrackingAction::fkNumbe << 124 std::array< G4long, TrackingAction::fkNumberCombinations > fTrackingArray1; 141 std::array<G4double, TrackingAction::fkNum << 125 std::array< G4double, TrackingAction::fkNumberCombinations > fTrackingArray2; 142 }; 126 }; 143 127 144 //....oooOO0OOooo........oooOO0OOooo........oo 128 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 145 129 146 #endif 130 #endif 147 131