File indexing completed on 2025-01-18 09:59:26
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
0034
0035
0036 #ifndef G4VRangeToEnergyConverter_hh
0037 #define G4VRangeToEnergyConverter_hh 1
0038
0039 #include <vector>
0040
0041 #include "globals.hh"
0042 #include "G4ParticleDefinition.hh"
0043 #include "G4Material.hh"
0044
0045 class G4VRangeToEnergyConverter
0046 {
0047 public:
0048
0049 explicit G4VRangeToEnergyConverter();
0050
0051 virtual ~G4VRangeToEnergyConverter();
0052
0053
0054 G4VRangeToEnergyConverter(const G4VRangeToEnergyConverter& r) = delete;
0055 G4VRangeToEnergyConverter& operator=
0056 (const G4VRangeToEnergyConverter &r) = delete;
0057 G4bool operator==(const G4VRangeToEnergyConverter& r) const = delete;
0058 G4bool operator!=(const G4VRangeToEnergyConverter& r) const = delete;
0059
0060
0061 virtual G4double Convert(const G4double rangeCut, const G4Material* material);
0062
0063
0064
0065 static void SetEnergyRange(const G4double lowedge, const G4double highedge);
0066
0067
0068 static G4double GetLowEdgeEnergy();
0069 static G4double GetHighEdgeEnergy();
0070
0071
0072
0073 static G4double GetMaxEnergyCut();
0074 static void SetMaxEnergyCut(const G4double value);
0075
0076
0077 inline const G4ParticleDefinition* GetParticleType() const;
0078
0079 inline void SetVerboseLevel(G4int value);
0080 inline G4int GetVerboseLevel() const;
0081
0082
0083
0084
0085
0086 protected:
0087
0088 virtual G4double ComputeValue(const G4int Z, const G4double kinEnergy) = 0;
0089
0090 private:
0091
0092 static void FillEnergyVector(const G4double emin, const G4double emax);
0093
0094 G4double ConvertForGamma(const G4double rangeCut, const G4Material* material);
0095
0096 G4double ConvertForElectron(const G4double rangeCut,
0097 const G4Material* material);
0098
0099 inline G4double LiniearInterpolation(const G4double e1, const G4double e2,
0100 const G4double r1, const G4double r2,
0101 const G4double r);
0102
0103 protected:
0104
0105 const G4ParticleDefinition* theParticle = nullptr;
0106 G4int fPDG = 0;
0107
0108 private:
0109
0110 static G4double sEmin;
0111 static G4double sEmax;
0112 static std::vector<G4double>* sEnergy;
0113 static G4int sNbinPerDecade;
0114 static G4int sNbin;
0115
0116 G4int verboseLevel = 1;
0117 G4bool isFirstInstance = false;
0118 };
0119
0120
0121
0122
0123
0124 inline
0125 void G4VRangeToEnergyConverter::SetVerboseLevel(G4int value)
0126 {
0127 verboseLevel = value;
0128 }
0129
0130 inline
0131 G4int G4VRangeToEnergyConverter::GetVerboseLevel() const
0132 {
0133 return verboseLevel;
0134 }
0135
0136 inline
0137 const G4ParticleDefinition* G4VRangeToEnergyConverter::GetParticleType() const
0138 {
0139 return theParticle;
0140 }
0141
0142 inline G4double G4VRangeToEnergyConverter::LiniearInterpolation(
0143 const G4double e1, const G4double e2,
0144 const G4double r1, const G4double r2, const G4double r)
0145 {
0146 return (r1 == r2) ? e1 : e1 + (e2 - e1)*(r - r1)/(r2 - r1);
0147 }
0148
0149 #endif