Geant4-11
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Member Functions | Static Private Member Functions
G4RToEConvForPositron Class Reference

#include <G4RToEConvForPositron.hh>

Inheritance diagram for G4RToEConvForPositron:
G4VRangeToEnergyConverter

Public Member Functions

virtual G4double Convert (const G4double rangeCut, const G4Material *material)
 
 G4RToEConvForPositron ()
 
const G4ParticleDefinitionGetParticleType () const
 
G4int GetVerboseLevel () const
 
G4bool operator!= (const G4VRangeToEnergyConverter &r) const =delete
 
G4bool operator== (const G4VRangeToEnergyConverter &r) const =delete
 
void SetVerboseLevel (G4int value)
 
virtual ~G4RToEConvForPositron ()
 

Static Public Member Functions

static G4double GetHighEdgeEnergy ()
 
static G4double GetLowEdgeEnergy ()
 
static G4double GetMaxEnergyCut ()
 
static void SetEnergyRange (const G4double lowedge, const G4double highedge)
 
static void SetMaxEnergyCut (const G4double value)
 

Protected Member Functions

G4double ComputeValue (const G4int Z, const G4double kinEnergy) final
 

Protected Attributes

G4int fPDG = 0
 
G4bool isFirstInstance = false
 
const G4ParticleDefinitiontheParticle = nullptr
 
G4int verboseLevel = 1
 

Static Protected Attributes

static G4double Emax = 0.0
 
static G4double Emin = 0.0
 
static std::vector< G4double > * Energy = nullptr
 
static G4int Nbin = 350
 
static G4int NbinPerDecade = 50
 

Private Member Functions

G4double ConvertForElectron (const G4double rangeCut, const G4Material *material)
 
G4double ConvertForGamma (const G4double rangeCut, const G4Material *material)
 
G4double LiniearInterpolation (const G4double e1, const G4double e2, const G4double r1, const G4double r2, const G4double r)
 

Static Private Member Functions

static void FillEnergyVector (const G4double emin, const G4double emax)
 

Detailed Description

Definition at line 40 of file G4RToEConvForPositron.hh.

Constructor & Destructor Documentation

◆ G4RToEConvForPositron()

G4RToEConvForPositron::G4RToEConvForPositron ( )
explicit

Definition at line 42 of file G4RToEConvForPositron.cc.

44{
46 if (theParticle == nullptr)
47 {
48#ifdef G4VERBOSE
49 if (GetVerboseLevel()>0)
50 {
51 G4cout << "G4RToEConvForPositron::G4RToEConvForPositron() - ";
52 G4cout << "Positron is not defined !!" << G4endl;
53 }
54#endif
55 }
56 else
57 {
59 }
60}
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
static G4ParticleTable * GetParticleTable()
const G4ParticleDefinition * theParticle

References G4ParticleTable::FindParticle(), G4VRangeToEnergyConverter::fPDG, G4cout, G4endl, G4ParticleTable::GetParticleTable(), G4ParticleDefinition::GetPDGEncoding(), G4VRangeToEnergyConverter::GetVerboseLevel(), and G4VRangeToEnergyConverter::theParticle.

◆ ~G4RToEConvForPositron()

G4RToEConvForPositron::~G4RToEConvForPositron ( )
virtual

Definition at line 63 of file G4RToEConvForPositron.cc.

64{}

Member Function Documentation

◆ ComputeValue()

G4double G4RToEConvForPositron::ComputeValue ( const G4int  Z,
const G4double  kinEnergy 
)
finalprotectedvirtual

Implements G4VRangeToEnergyConverter.

Definition at line 67 of file G4RToEConvForPositron.cc.

69{
70 const G4double cbr1=0.02, cbr2=-5.7e-5, cbr3=1., cbr4=0.072;
71 const G4double Tlow=10.*CLHEP::keV, Thigh=1.*CLHEP::GeV;
72 const G4double taul = Tlow/CLHEP::electron_mass_c2;
73 const G4double logtaul = G4Log(taul);
74 const G4double taul12 = std::sqrt(taul);
75 const G4double bremfactor = 0.1;
76
78 G4double ionpot =
80 G4double ionpotlog = G4Log(ionpot);
81
82 G4double tau = kinEnergy/CLHEP::electron_mass_c2;
83 G4double dEdx = 0.0;
84
85
86 if(tau<taul)
87 {
88 G4double t1 = taul+1.;
89 G4double t2 = taul+2.;
90 G4double tsq = taul*taul;
91 G4double beta2 = taul*t2/(t1*t1);
92 G4double f = 2.*logtaul -
93 (6.*taul+1.5*tsq-taul*(1.-tsq/3.)/t2
94 -tsq*(0.5-tsq/12.)/(t2*t2))/(t1*t1);
95 dEdx = (G4Log(2.*taul+4.)-2.*ionpotlog+f)/beta2;
96 dEdx *= Z*taul12/std::sqrt(tau);
97 }
98 else
99 {
100 G4double t1 = tau+1.;
101 G4double t2 = tau+2.;
102 G4double tsq = tau*tau;
103 G4double beta2 = tau*t2/(t1*t1);
104 G4double f = 2.*G4Log(tau) - (6.*tau+1.5*tsq-tau*(1.-tsq/3.)/t2
105 -tsq*(0.5-tsq/12.)/(t2*t2))/(t1*t1);
106 dEdx = Z*(G4Log(2.*tau+4.)-2.*ionpotlog+f)/beta2;
107
108 // loss from bremsstrahlung follows
109 G4double cbrem = (cbr1+cbr2*Z)
110 * (cbr3+cbr4*G4Log(kinEnergy/Thigh));
111 dEdx += cbrem*Z*(Z+1.)*bremfactor*tau/beta2;
112 }
113 return dEdx*CLHEP::twopi_mc2_rcl2;
114}
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
Definition: G4Exp.hh:179
G4double G4Log(G4double x)
Definition: G4Log.hh:226
double G4double
Definition: G4Types.hh:83
const G4int Z[17]
static G4Pow * GetInstance()
Definition: G4Pow.cc:41
G4double logZ(G4int Z) const
Definition: G4Pow.hh:137
static constexpr double electron_mass_c2
static constexpr double GeV
static constexpr double keV
static constexpr double MeV
static constexpr double twopi_mc2_rcl2

References CLHEP::electron_mass_c2, G4Exp(), G4Log(), G4Pow::GetInstance(), CLHEP::GeV, CLHEP::keV, G4Pow::logZ(), CLHEP::MeV, CLHEP::twopi_mc2_rcl2, and Z.

◆ Convert()

G4double G4VRangeToEnergyConverter::Convert ( const G4double  rangeCut,
const G4Material material 
)
virtualinherited

Reimplemented in G4RToEConvForProton.

Definition at line 87 of file G4VRangeToEnergyConverter.cc.

89{
90#ifdef G4VERBOSE
91 if (GetVerboseLevel()>3)
92 {
93 G4cout << "G4VRangeToEnergyConverter::Convert() - ";
94 G4cout << "Convert for " << material->GetName()
95 << " with Range Cut " << rangeCut/mm << "[mm]" << G4endl;
96 }
97#endif
98
99 G4double cut = 0.0;
100 if(fPDG == 22)
101 {
102 cut = ConvertForGamma(rangeCut, material);
103 }
104 else
105 {
106 cut = ConvertForElectron(rangeCut, material);
107
108 const G4double tune = 0.025*CLHEP::mm*CLHEP::g/CLHEP::cm3;
109 const G4double lowen = 30.*CLHEP::keV;
110 if(cut < lowen)
111 {
112 // corr. should be switched on smoothly
113 cut /= (1.+(1.-cut/lowen)*tune/(rangeCut*material->GetDensity()));
114 }
115 }
116
117 cut = std::max(Emin, std::min(cut, Emax));
118 return cut;
119}
static constexpr double mm
Definition: G4SIunits.hh:95
G4double ConvertForGamma(const G4double rangeCut, const G4Material *material)
G4double ConvertForElectron(const G4double rangeCut, const G4Material *material)
static constexpr double mm
Definition: SystemOfUnits.h:96
static constexpr double cm3
static constexpr double g
T max(const T t1, const T t2)
brief Return the largest of the two arguments
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
string material
Definition: eplot.py:19

References CLHEP::cm3, G4VRangeToEnergyConverter::ConvertForElectron(), G4VRangeToEnergyConverter::ConvertForGamma(), G4VRangeToEnergyConverter::Emax, G4VRangeToEnergyConverter::Emin, G4VRangeToEnergyConverter::fPDG, CLHEP::g, G4cout, G4endl, G4VRangeToEnergyConverter::GetVerboseLevel(), CLHEP::keV, eplot::material, G4INCL::Math::max(), G4INCL::Math::min(), CLHEP::mm, and mm.

Referenced by G4ProductionCutsTable::ConvertRangeToEnergy(), and G4ProductionCutsTable::UpdateCoupleTable().

◆ ConvertForElectron()

G4double G4VRangeToEnergyConverter::ConvertForElectron ( const G4double  rangeCut,
const G4Material material 
)
privateinherited

Definition at line 225 of file G4VRangeToEnergyConverter.cc.

227{
228 const G4ElementVector* elm = material->GetElementVector();
229 const G4double* dens = material->GetAtomicNumDensityVector();
230
231 // fill absorption length vector
232 G4int nelm = material->GetNumberOfElements();
233 G4double dedx1 = 0.0;
234 G4double dedx2 = 0.0;
235 G4double range1 = 0.0;
236 G4double range2 = 0.0;
237 G4double e1 = 0.0;
238 G4double e2 = 0.0;
239 G4double range = 0.;
240 for (G4int i=0; i<Nbin; ++i)
241 {
242 e2 = (*Energy)[i];
243 dedx2 = 0.0;
244 for (G4int j=0; j<nelm; ++j)
245 {
246 dedx2 += dens[j]*ComputeValue((*elm)[j]->GetZasInt(), e2);
247 }
248 range += (dedx1 + dedx2 > 0.0) ? 2*(e2 - e1)/(dedx1 + dedx2) : 0.0;
249 range2 = range;
250 if(range2 < rangeCut)
251 {
252 e1 = e2;
253 dedx1 = dedx2;
254 range1 = range2;
255 }
256 else
257 {
258 break;
259 }
260 }
261 return LiniearInterpolation(e1, e2, range1, range2, rangeCut);
262}
static const G4double e1[44]
static const G4double e2[44]
std::vector< const G4Element * > G4ElementVector
int G4int
Definition: G4Types.hh:85
virtual G4double ComputeValue(const G4int Z, const G4double kinEnergy)=0
G4double LiniearInterpolation(const G4double e1, const G4double e2, const G4double r1, const G4double r2, const G4double r)

References G4VRangeToEnergyConverter::ComputeValue(), e1, e2, G4VRangeToEnergyConverter::LiniearInterpolation(), eplot::material, and G4VRangeToEnergyConverter::Nbin.

Referenced by G4VRangeToEnergyConverter::Convert().

◆ ConvertForGamma()

G4double G4VRangeToEnergyConverter::ConvertForGamma ( const G4double  rangeCut,
const G4Material material 
)
privateinherited

Definition at line 188 of file G4VRangeToEnergyConverter.cc.

190{
191 const G4ElementVector* elm = material->GetElementVector();
192 const G4double* dens = material->GetAtomicNumDensityVector();
193
194 // fill absorption length vector
195 G4int nelm = material->GetNumberOfElements();
196 G4double range1 = 0.0;
197 G4double range2 = 0.0;
198 G4double e1 = 0.0;
199 G4double e2 = 0.0;
200 for (G4int i=0; i<Nbin; ++i)
201 {
202 e2 = (*Energy)[i];
203 G4double sig = 0.;
204
205 for (G4int j=0; j<nelm; ++j)
206 {
207 sig += dens[j]*ComputeValue((*elm)[j]->GetZasInt(), e2);
208 }
209 range2 = (sig > 0.0) ? 5./sig : DBL_MAX;
210 if(i == 0 || range2 < rangeCut)
211 {
212 e1 = e2;
213 range1 = range2;
214 }
215 else
216 {
217 break;
218 }
219 }
220 return LiniearInterpolation(e1, e2, range1, range2, rangeCut);
221}
#define DBL_MAX
Definition: templates.hh:62

References G4VRangeToEnergyConverter::ComputeValue(), DBL_MAX, e1, e2, G4VRangeToEnergyConverter::LiniearInterpolation(), eplot::material, and G4VRangeToEnergyConverter::Nbin.

Referenced by G4VRangeToEnergyConverter::Convert().

◆ FillEnergyVector()

void G4VRangeToEnergyConverter::FillEnergyVector ( const G4double  emin,
const G4double  emax 
)
staticprivateinherited

Definition at line 161 of file G4VRangeToEnergyConverter.cc.

163{
164 if(emin != Emin || emax != Emax)
165 {
166#ifdef G4MULTITHREADED
167 G4MUTEXLOCK(&theMutex);
168 if(emin != Emin || emax != Emax)
169 {
170#endif
171 Emin = emin;
172 Emax = emax;
173 Nbin = NbinPerDecade*static_cast<G4int>(std::log10(emax/emin));
174 Energy->resize(Nbin + 1);
175 (*Energy)[0] = emin;
176 (*Energy)[Nbin] = emax;
177 G4double fact = G4Log(emax/emin)/Nbin;
178 for(G4int i=1; i<Nbin; ++i) { (*Energy)[i] = emin*G4Exp(i * fact); }
179#ifdef G4MULTITHREADED
180 }
181 G4MUTEXUNLOCK(&theMutex);
182#endif
183 }
184}
static const G4double emax
#define G4MUTEXLOCK(mutex)
Definition: G4Threading.hh:251
#define G4MUTEXUNLOCK(mutex)
Definition: G4Threading.hh:254
static std::vector< G4double > * Energy

References G4VRangeToEnergyConverter::Emax, emax, G4VRangeToEnergyConverter::Emin, G4VRangeToEnergyConverter::Energy, G4Exp(), G4Log(), G4MUTEXLOCK, G4MUTEXUNLOCK, G4VRangeToEnergyConverter::Nbin, and G4VRangeToEnergyConverter::NbinPerDecade.

Referenced by G4VRangeToEnergyConverter::G4VRangeToEnergyConverter(), G4VRangeToEnergyConverter::SetEnergyRange(), and G4VRangeToEnergyConverter::SetMaxEnergyCut().

◆ GetHighEdgeEnergy()

G4double G4VRangeToEnergyConverter::GetHighEdgeEnergy ( )
staticinherited

Definition at line 139 of file G4VRangeToEnergyConverter.cc.

140{
141 return Emax;
142}

References G4VRangeToEnergyConverter::Emax.

Referenced by G4ProductionCutsTable::GetHighEdgeEnergy().

◆ GetLowEdgeEnergy()

G4double G4VRangeToEnergyConverter::GetLowEdgeEnergy ( )
staticinherited

Definition at line 133 of file G4VRangeToEnergyConverter.cc.

134{
135 return Emin;
136}

References G4VRangeToEnergyConverter::Emin.

Referenced by G4ProductionCutsTable::GetLowEdgeEnergy().

◆ GetMaxEnergyCut()

G4double G4VRangeToEnergyConverter::GetMaxEnergyCut ( )
staticinherited

Definition at line 146 of file G4VRangeToEnergyConverter.cc.

147{
148 return Emax;
149}

References G4VRangeToEnergyConverter::Emax.

Referenced by G4ProductionCutsTable::GetMaxEnergyCut().

◆ GetParticleType()

const G4ParticleDefinition * G4VRangeToEnergyConverter::GetParticleType ( ) const
inlineinherited

Definition at line 140 of file G4VRangeToEnergyConverter.hh.

141{
142 return theParticle;
143}

References G4VRangeToEnergyConverter::theParticle.

◆ GetVerboseLevel()

G4int G4VRangeToEnergyConverter::GetVerboseLevel ( ) const
inlineinherited

◆ LiniearInterpolation()

G4double G4VRangeToEnergyConverter::LiniearInterpolation ( const G4double  e1,
const G4double  e2,
const G4double  r1,
const G4double  r2,
const G4double  r 
)
inlineprivateinherited

Definition at line 145 of file G4VRangeToEnergyConverter.hh.

148{
149 return (r1 == r2) ? e1 : e1 + (e2 - e1)*(r - r1)/(r2 - r1);
150}

References e1, and e2.

Referenced by G4VRangeToEnergyConverter::ConvertForElectron(), and G4VRangeToEnergyConverter::ConvertForGamma().

◆ operator!=()

G4bool G4VRangeToEnergyConverter::operator!= ( const G4VRangeToEnergyConverter r) const
deleteinherited

◆ operator==()

G4bool G4VRangeToEnergyConverter::operator== ( const G4VRangeToEnergyConverter r) const
deleteinherited

◆ SetEnergyRange()

void G4VRangeToEnergyConverter::SetEnergyRange ( const G4double  lowedge,
const G4double  highedge 
)
staticinherited

Definition at line 122 of file G4VRangeToEnergyConverter.cc.

124{
125 G4double ehigh = std::min(Emax, highedge);
126 if(ehigh > lowedge)
127 {
128 FillEnergyVector(lowedge, ehigh);
129 }
130}
static void FillEnergyVector(const G4double emin, const G4double emax)

References G4VRangeToEnergyConverter::Emax, G4VRangeToEnergyConverter::FillEnergyVector(), and G4INCL::Math::min().

Referenced by G4ProductionCutsTable::SetEnergyRange().

◆ SetMaxEnergyCut()

void G4VRangeToEnergyConverter::SetMaxEnergyCut ( const G4double  value)
staticinherited

Definition at line 152 of file G4VRangeToEnergyConverter.cc.

153{
154 if(value > Emin)
155 {
156 FillEnergyVector(Emin, value);
157 }
158}

References G4VRangeToEnergyConverter::Emin, and G4VRangeToEnergyConverter::FillEnergyVector().

Referenced by G4ProductionCutsTable::SetMaxEnergyCut().

◆ SetVerboseLevel()

void G4VRangeToEnergyConverter::SetVerboseLevel ( G4int  value)
inlineinherited

Field Documentation

◆ Emax

G4double G4VRangeToEnergyConverter::Emax = 0.0
staticprotectedinherited

◆ Emin

G4double G4VRangeToEnergyConverter::Emin = 0.0
staticprotectedinherited

◆ Energy

std::vector< G4double > * G4VRangeToEnergyConverter::Energy = nullptr
staticprotectedinherited

◆ fPDG

G4int G4VRangeToEnergyConverter::fPDG = 0
protectedinherited

◆ isFirstInstance

G4bool G4VRangeToEnergyConverter::isFirstInstance = false
protectedinherited

◆ Nbin

G4int G4VRangeToEnergyConverter::Nbin = 350
staticprotectedinherited

◆ NbinPerDecade

G4int G4VRangeToEnergyConverter::NbinPerDecade = 50
staticprotectedinherited

◆ theParticle

const G4ParticleDefinition* G4VRangeToEnergyConverter::theParticle = nullptr
protectedinherited

◆ verboseLevel

G4int G4VRangeToEnergyConverter::verboseLevel = 1
protectedinherited

The documentation for this class was generated from the following files: