![]() |
|
|||
File indexing completed on 2025-04-10 08:06:17
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 Run.hh 0027 /// \brief Definition of the Run class 0028 // 0029 // 0030 0031 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0032 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0033 0034 #ifndef Run_h 0035 #define Run_h 1 0036 0037 #include "SteppingAction.hh" 0038 #include "TrackingAction.hh" 0039 0040 #include "G4Run.hh" 0041 #include "G4ThreeVector.hh" 0042 0043 #include <array> 0044 0045 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0046 0047 class Run : public G4Run 0048 { 0049 // This class accumulates relevant quantities related to particle fluence collected during 0050 // the run. 0051 // ( Note: these information are provided via calls of accessor methods of this Run class 0052 // made by SteppingAction::UserSteppingAction 0053 // and TrackingAction::PreUserTrackingAction . ) 0054 // At the end of a run, the PrintInfo method is called by the run-action to print out 0055 // some summary information about these quantities. 0056 // In multithreaded (MT) mode, an object of this class is filled up for each working thread, 0057 // and then merged (automatically by the Geant4 kernel) into another object (of this class) 0058 // owned by the master class; the PrintInfo method is then called only for the latter run 0059 // object. 0060 // Note that, for simplicity and brevity, we avoid histograms and print-out instead some 0061 // statistics (compute by ourself) at the end of the run. 0062 public: 0063 Run(); 0064 ~Run() override = default; 0065 0066 void RecordEvent(const G4Event* anEvent) override; 0067 // This method is called automatically by the Geant4 kernel (not by the user!) at the end 0068 // of each event. In the case of multithreaded mode, it is called only for the working thread 0069 // that handled that event. 0070 0071 void Merge(const G4Run* aRun) override; 0072 // This method is called automatically by the Geant4 kernel (not by the user!) only in the 0073 // case of multithreaded mode and only for working threads. 0074 0075 void PrintInfo() const; 0076 // This method is called by RunAction::EndOfRunAction : in the case of multithreaded mode, 0077 // only the master thread calls it. 0078 0079 void SetPrimaryParticleId(const G4int inputValue) { fPrimaryParticleId = inputValue; } 0080 void SetPrimaryParticleEnergy(const G4double inputValue) 0081 { 0082 fPrimaryParticleEnergy = inputValue; 0083 } 0084 void SetPrimaryParticleDirection(const G4ThreeVector& inputValue) 0085 { 0086 fPrimaryParticleDirection = inputValue; 0087 } 0088 void SetTargetMaterialName(const G4String& inputValue) { fTargetMaterialName = inputValue; } 0089 void SetCubicVolumeScoringUpDown(const G4double inputValue) 0090 { 0091 fCubicVolumeScoringUpDown = inputValue; 0092 } 0093 void SetCubicVolumeScoringSide(const G4double inputValue) 0094 { 0095 fCubicVolumeScoringSide = inputValue; 0096 } 0097 G4int GetPrimaryParticleId() const { return fPrimaryParticleId; } 0098 G4double GetPrimaryParticleEnergy() const { return fPrimaryParticleEnergy; } 0099 G4ThreeVector GetPrimaryParticleDirection() const { return fPrimaryParticleDirection; } 0100 G4String GetTargetMaterialName() const { return fTargetMaterialName; } 0101 G4double GetCubicVolumeScoringUpDown() const { return fCubicVolumeScoringUpDown; } 0102 G4double GetCubicVolumeScoringSide() const { return fCubicVolumeScoringSide; } 0103 0104 void 0105 SetSteppingArray(const std::array<G4double, SteppingAction::fkNumberCombinations>& inputArray); 0106 std::array<G4double, SteppingAction::fkNumberCombinations> GetSteppingArray() const 0107 { 0108 return fSteppingArray; 0109 } 0110 // Accessor methods useful to transfer information collected by the stepping-action 0111 // into this Run class 0112 0113 void 0114 SetTrackingArray1(const std::array<G4long, TrackingAction::fkNumberCombinations>& inputArray); 0115 std::array<G4long, TrackingAction::fkNumberCombinations> GetTrackingArray1() const 0116 { 0117 return fTrackingArray1; 0118 } 0119 void 0120 SetTrackingArray2(const std::array<G4double, TrackingAction::fkNumberCombinations>& inputArray); 0121 std::array<G4double, TrackingAction::fkNumberCombinations> GetTrackingArray2() const 0122 { 0123 return fTrackingArray2; 0124 } 0125 // Accessor methods useful to transfer information collected by the tracking-action 0126 // into this Run class 0127 0128 private: 0129 G4int fNumEvents; 0130 G4int fPrimaryParticleId; 0131 G4double fPrimaryParticleEnergy; 0132 G4ThreeVector fPrimaryParticleDirection; 0133 G4String fTargetMaterialName; 0134 G4double fCubicVolumeScoringUpDown; 0135 G4double fCubicVolumeScoringSide; 0136 std::array<G4double, SteppingAction::fkNumberCombinations> fSteppingArray; 0137 std::array<G4long, TrackingAction::fkNumberCombinations> fTrackingArray1; 0138 std::array<G4double, TrackingAction::fkNumberCombinations> fTrackingArray2; 0139 }; 0140 0141 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0142 0143 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |