File indexing completed on 2025-02-23 09:20:56
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 RunAction_h
0034 #define RunAction_h 1
0035
0036 #include "G4UserRunAction.hh"
0037 #include "G4VProcess.hh"
0038 #include "globals.hh"
0039
0040 #include <map>
0041
0042
0043
0044 class G4Run;
0045 class G4ParticleDefinition;
0046 class G4Material;
0047
0048 class DetectorConstruction;
0049 class PrimaryGeneratorAction;
0050 class HistoManager;
0051
0052
0053
0054 class RunAction : public G4UserRunAction
0055 {
0056 public:
0057 RunAction(DetectorConstruction*, PrimaryGeneratorAction*);
0058 ~RunAction() override;
0059
0060 public:
0061 void BeginOfRunAction(const G4Run*) override;
0062 void EndOfRunAction(const G4Run*) override;
0063
0064 void CountProcesses(G4String procName);
0065
0066 void TrackLength(G4double step);
0067
0068 void EnergyDeposited(G4double edepPrim, G4double edepSecond);
0069
0070 void EnergyTransferedByProcess(G4String procName, G4double energy);
0071
0072 void EnergyTransfered(G4double energy);
0073
0074 void TotalEnergyLost(G4double energy);
0075
0076 void EnergyBalance(G4double energy);
0077
0078 void TotalEnergyDeposit(G4double energy);
0079
0080 void EnergySpectrumOfSecondaries(G4String particleName, G4double ekin);
0081
0082 public:
0083 G4double GetEnergyFromRestrictedRange(G4double, G4ParticleDefinition*, G4Material*, G4double);
0084
0085 G4double GetEnergyFromCSDARange(G4double, G4ParticleDefinition*, G4Material*, G4double);
0086
0087 private:
0088 struct MinMaxData
0089 {
0090 MinMaxData() : fCount(0), fVsum(0.), fVmin(0.), fVmax(0.) {}
0091 MinMaxData(G4int count, G4double vsum, G4double vmin, G4double vmax)
0092 : fCount(count), fVsum(vsum), fVmin(vmin), fVmax(vmax)
0093 {}
0094 G4int fCount;
0095 G4double fVsum;
0096 G4double fVmin;
0097 G4double fVmax;
0098 };
0099
0100 private:
0101 DetectorConstruction* fDetector = nullptr;
0102 PrimaryGeneratorAction* fPrimary = nullptr;
0103 HistoManager* fHistoManager = nullptr;
0104
0105 std::map<G4String, G4int> fProcCounter;
0106
0107 G4long fNbSteps = 0;
0108 G4double fTrackLength = 0., fStepMin = DBL_MAX, fStepMax = 0.;
0109
0110 G4double fEdepPrimary = 0., fEdepPrimMin = DBL_MAX, fEdepPrimMax = 0.;
0111 std::map<G4String, MinMaxData> fEtransfByProcess;
0112 G4double fEnergyTransfered = 0., fEtransfMin = DBL_MAX, fEtransfMax = 0.;
0113 G4double fEnergyLost = 0., fElostMin = DBL_MAX, fElostMax = 0.;
0114 G4double fEnergyBalance = 0., fEbalMin = DBL_MAX, fEbalMax = 0.;
0115
0116 G4double fEdepSecondary = 0., fEdepSecMin = DBL_MAX, fEdepSecMax = 0.;
0117 G4double fEdepTotal = 0., fEdepTotMin = DBL_MAX, fEdepTotMax = 0.;
0118
0119 std::map<G4String, MinMaxData> fEkinOfSecondaries;
0120 };
0121
0122
0123
0124 #endif