File indexing completed on 2026-11-30 09:35:16
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 #ifndef Run_h
0030 #define Run_h 1
0031
0032 #include "G4Run.hh"
0033 #include "G4VProcess.hh"
0034 #include "globals.hh"
0035
0036 #include <map>
0037
0038 class DetectorConstruction;
0039 class G4ParticleDefinition;
0040 class G4HadronicProcessStore;
0041 class G4Material;
0042 class G4Element;
0043
0044
0045
0046 class Run : public G4Run
0047 {
0048 public:
0049 Run(DetectorConstruction*);
0050 ~Run() override = default;
0051
0052 public:
0053 void SetPrimary(G4ParticleDefinition* particle, G4double energy);
0054 void SetTargetXXX(G4bool);
0055 void CountProcesses(G4VProcess* process);
0056 void SumTrack(G4double);
0057 void CountNuclearChannel(G4String, G4double);
0058 void ParticleCount(G4String, G4double);
0059 void Balance(G4double);
0060 void CountGamma(G4int);
0061
0062 void Merge(const G4Run*) override;
0063 void EndOfRun(G4bool);
0064
0065 private:
0066 void PrintXS(const G4VProcess*, const G4Material*, const G4Element*, G4HadronicProcessStore*,
0067 G4double dens, G4double& sum1, G4double& sum2);
0068
0069 struct ParticleData
0070 {
0071 ParticleData() : fCount(0), fEmean(0.), fEmin(0.), fEmax(0.) {}
0072 ParticleData(G4int count, G4double ekin, G4double emin, G4double emax)
0073 : fCount(count), fEmean(ekin), fEmin(emin), fEmax(emax)
0074 {}
0075 G4int fCount;
0076 G4double fEmean;
0077 G4double fEmin;
0078 G4double fEmax;
0079 };
0080
0081 struct NuclChannel
0082 {
0083 NuclChannel() : fCount(0), fQ(0.) {}
0084 NuclChannel(G4int count, G4double Q) : fCount(count), fQ(Q) {}
0085 G4int fCount;
0086 G4double fQ;
0087 };
0088
0089 private:
0090 DetectorConstruction* fDetector = nullptr;
0091 G4ParticleDefinition* fParticle = nullptr;
0092 G4double fEkin = 0.;
0093
0094 std::map<G4String, G4int> fProcCounter;
0095
0096 G4int fTotalCount = 0;
0097 G4int fGammaCount = 0;
0098 G4double fSumTrack = 0.;
0099 G4double fSumTrack2 = 0.;
0100
0101 std::map<G4String, NuclChannel> fNuclChannelMap;
0102 std::map<G4String, ParticleData> fParticleDataMap;
0103
0104 G4bool fTargetXXX = false;
0105 G4double fPbalance[3];
0106 G4int fNbGamma[3];
0107 };
0108
0109
0110
0111 #endif