File indexing completed on 2025-10-17 08:05:54
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 "DetectorConstruction.hh"
0037 #include "G4Run.hh"
0038 #include "G4AnalysisManager.hh"
0039
0040 #include <vector>
0041 typedef std::vector<G4double> MyVector;
0042
0043
0044
0045 class DetectorConstruction;
0046 class PrimaryGeneratorAction;
0047
0048
0049
0050 class Run : public G4Run
0051 {
0052 public:
0053 Run(DetectorConstruction*, PrimaryGeneratorAction*);
0054 ~Run() override = default;
0055
0056 void Merge(const G4Run*) override;
0057
0058 void InitializePerEvent();
0059 void FillPerEvent();
0060
0061 inline void FillPerTrack(G4double, G4double);
0062 inline void FillPerStep(G4double, G4int, G4int);
0063
0064 inline void AddStep(G4double q);
0065
0066 void EndOfRun(G4double edep, G4double rms, G4double& limit);
0067
0068 inline void SetVerbose(G4int val) { fVerbose = val; };
0069
0070 private:
0071 void Reset();
0072
0073 DetectorConstruction* fDet = nullptr;
0074 PrimaryGeneratorAction* fKin = nullptr;
0075
0076 G4int f_nLbin = kMaxBin;
0077 MyVector f_dEdL;
0078 MyVector fSumELongit;
0079 MyVector fSumE2Longit;
0080 MyVector fSumELongitCumul;
0081 MyVector fSumE2LongitCumul;
0082
0083 G4int f_nRbin = kMaxBin;
0084 MyVector f_dEdR;
0085 MyVector fSumERadial;
0086 MyVector fSumE2Radial;
0087 MyVector fSumERadialCumul;
0088 MyVector fSumE2RadialCumul;
0089
0090 G4double fChargTrLength = 0.;
0091 G4double fSumChargTrLength = 0.;
0092 G4double fSum2ChargTrLength = 0.;
0093
0094 G4double fNeutrTrLength = 0.;
0095 G4double fSumNeutrTrLength = 0.;
0096 G4double fSum2NeutrTrLength = 0.;
0097
0098 G4double fChargedStep = 0.;
0099 G4double fNeutralStep = 0.;
0100
0101 G4int fVerbose = 0;
0102 };
0103
0104
0105
0106 inline void Run::FillPerTrack(G4double charge, G4double trkLength)
0107 {
0108 if (charge != 0.)
0109 fChargTrLength += trkLength;
0110 else
0111 fNeutrTrLength += trkLength;
0112 }
0113
0114
0115
0116 inline void Run::FillPerStep(G4double dEstep, G4int Lbin, G4int Rbin)
0117 {
0118 f_dEdL[Lbin] += dEstep;
0119 f_dEdR[Rbin] += dEstep;
0120 }
0121
0122
0123
0124 inline void Run::AddStep(G4double q)
0125 {
0126 if (q == 0.0) {
0127 fNeutralStep += 1.0;
0128 }
0129 else {
0130 fChargedStep += 1.0;
0131 }
0132 }
0133
0134
0135
0136 #endif