File indexing completed on 2025-10-19 08:04:12
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033 #ifndef Run_h
0034 #define Run_h 1
0035
0036 #include "G4Run.hh"
0037 #include "globals.hh"
0038
0039 #include <map>
0040
0041 class DetectorConstruction;
0042 class G4ParticleDefinition;
0043
0044
0045
0046 class Run : public G4Run
0047 {
0048 public:
0049 Run(const DetectorConstruction*);
0050 ~Run() override = default;
0051
0052 void SetPrimary(const G4ParticleDefinition* particle, G4double energy);
0053
0054 void CountTraks0(G4int nt) { fNbOfTraks0 += nt; }
0055 void CountTraks1(G4int nt) { fNbOfTraks1 += nt; }
0056 void CountSteps0(G4int ns) { fNbOfSteps0 += ns; }
0057 void CountSteps1(G4int ns) { fNbOfSteps1 += ns; }
0058 void CountProcesses(const G4String& procName);
0059
0060 void AddEdep(G4double val) { fEdep += val; }
0061 void AddEleak(G4double val){ fEleak += val;}
0062 void AddNIEL(G4double val) { fNIEL += val; }
0063 void AddTrueRange(G4double l)
0064 {
0065 fTrueRange += l;
0066 fTrueRange2 += l * l;
0067 }
0068 void AddProjRange(G4double x)
0069 {
0070 fProjRange += x;
0071 fProjRange2 += x * x;
0072 }
0073 void AddTransvDev(G4double y)
0074 {
0075 fTransvDev += y;
0076 fTransvDev2 += y * y;
0077 }
0078
0079 void Merge(const G4Run*) override;
0080 void EndOfRun();
0081
0082 private:
0083 const DetectorConstruction* fDetector = nullptr;
0084 const G4ParticleDefinition* fParticle = nullptr;
0085 G4double fEkin = 0.;
0086
0087 G4int fNbOfTraks0 = 0, fNbOfTraks1 = 0;
0088 G4int fNbOfSteps0 = 0, fNbOfSteps1 = 0;
0089 G4double fEdep = 0., fEleak = 0., fNIEL = 0.;
0090 G4double fTrueRange = 0., fTrueRange2 = 0.;
0091 G4double fProjRange = 0., fProjRange2 = 0.;
0092 G4double fTransvDev = 0., fTransvDev2 = 0.;
0093
0094 std::map<G4String, G4int> fProcCounter;
0095 };
0096
0097
0098
0099 #endif