Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4EnergyLossForExtrapolator Class Reference

#include <G4EnergyLossForExtrapolator.hh>

Public Member Functions

 G4EnergyLossForExtrapolator (G4int verb=1)
 
 ~G4EnergyLossForExtrapolator ()
 
G4double ComputeDEDX (G4double kinEnergy, const G4ParticleDefinition *)
 
G4double ComputeRange (G4double kinEnergy, const G4ParticleDefinition *)
 
G4double ComputeEnergy (G4double range, const G4ParticleDefinition *)
 
G4double EnergyAfterStep (G4double kinEnergy, G4double step, const G4Material *, const G4ParticleDefinition *)
 
G4double EnergyBeforeStep (G4double kinEnergy, G4double step, const G4Material *, const G4ParticleDefinition *)
 
G4double TrueStepLength (G4double kinEnergy, G4double step, const G4Material *, const G4ParticleDefinition *part)
 
G4double EnergyAfterStep (G4double kinEnergy, G4double step, const G4Material *, const G4String &particleName)
 
G4double EnergyBeforeStep (G4double kinEnergy, G4double step, const G4Material *, const G4String &particleName)
 
G4double AverageScatteringAngle (G4double kinEnergy, G4double step, const G4Material *, const G4ParticleDefinition *part)
 
G4double AverageScatteringAngle (G4double kinEnergy, G4double step, const G4Material *, const G4String &particleName)
 
G4double ComputeTrueStep (const G4Material *, const G4ParticleDefinition *part, G4double kinEnergy, G4double stepLength)
 
G4double EnergyDispersion (G4double kinEnergy, G4double step, const G4Material *, const G4ParticleDefinition *)
 
G4double EnergyDispersion (G4double kinEnergy, G4double step, const G4Material *, const G4String &particleName)
 
void SetVerbose (G4int val)
 
void SetMinKinEnergy (G4double)
 
void SetMaxKinEnergy (G4double)
 
void SetMaxEnergyTransfer (G4double)
 

Detailed Description

Definition at line 67 of file G4EnergyLossForExtrapolator.hh.

Constructor & Destructor Documentation

◆ G4EnergyLossForExtrapolator()

G4EnergyLossForExtrapolator::G4EnergyLossForExtrapolator ( G4int  verb = 1)
explicit

Definition at line 70 of file G4EnergyLossForExtrapolator.cc.

71 : maxEnergyTransfer(DBL_MAX), verbose(verb)
72{
73 currentParticle = nullptr;
74 currentMaterial = nullptr;
75
76 linLossLimit = 0.01;
77 emin = 1.*MeV;
78 emax = 10.*TeV;
79 nbins = 70;
80
81 nmat = index = 0;
82
83 mass = charge2 = electronDensity = radLength = bg2 = beta2
84 = kineticEnergy = tmax = 0.0;
85 gam = 1.0;
86
87 idxDedxElectron = idxDedxPositron = idxDedxMuon = idxDedxProton
88 = idxRangeElectron = idxRangePositron = idxRangeMuon = idxRangeProton
89 = idxInvRangeElectron = idxInvRangePositron = idxInvRangeMuon
90 = idxInvRangeProton = idxMscElectron = 0;
91
92 electron = positron = proton = muonPlus = muonMinus = nullptr;
93}
#define DBL_MAX
Definition: templates.hh:62

◆ ~G4EnergyLossForExtrapolator()

G4EnergyLossForExtrapolator::~G4EnergyLossForExtrapolator ( )

Definition at line 97 of file G4EnergyLossForExtrapolator.cc.

98{
99 if(tables) {
100#ifdef G4MULTITHREADED
101 G4MUTEXLOCK(&extrapolatorMutex);
102 if (tables) {
103#endif
104 delete tables;
105 tables = nullptr;
106#ifdef G4MULTITHREADED
107 }
108 G4MUTEXUNLOCK(&extrapolatorMutex);
109#endif
110 }
111}
#define G4MUTEXLOCK(mutex)
Definition: G4Threading.hh:251
#define G4MUTEXUNLOCK(mutex)
Definition: G4Threading.hh:254

Member Function Documentation

◆ AverageScatteringAngle() [1/2]

G4double G4EnergyLossForExtrapolator::AverageScatteringAngle ( G4double  kinEnergy,
G4double  step,
const G4Material mat,
const G4ParticleDefinition part 
)
inline

Definition at line 251 of file G4EnergyLossForExtrapolator.hh.

256{
257 G4double theta = 0.0;
258 if(SetupKinematics(part, mat, kinEnergy)) {
259 G4double t = stepLength/radLength;
260 G4double y = std::max(0.001, t);
261 theta = 19.23*CLHEP::MeV*std::sqrt(charge2*t)*(1.0 + 0.038*G4Log(y))
262 /(beta2*gam*mass);
263 }
264 return theta;
265}
G4double G4Log(G4double x)
Definition: G4Log.hh:226
double G4double
Definition: G4Types.hh:83

Referenced by AverageScatteringAngle(), and ComputeTrueStep().

◆ AverageScatteringAngle() [2/2]

G4double G4EnergyLossForExtrapolator::AverageScatteringAngle ( G4double  kinEnergy,
G4double  step,
const G4Material mat,
const G4String particleName 
)
inline

Definition at line 230 of file G4EnergyLossForExtrapolator.hh.

234{
235 return AverageScatteringAngle(kinEnergy,step,mat,FindParticle(name));
236}
G4double AverageScatteringAngle(G4double kinEnergy, G4double step, const G4Material *, const G4ParticleDefinition *part)

◆ ComputeDEDX()

G4double G4EnergyLossForExtrapolator::ComputeDEDX ( G4double  kinEnergy,
const G4ParticleDefinition part 
)

Definition at line 261 of file G4EnergyLossForExtrapolator.cc.

263{
264 G4double x = 0.0;
265 if(part == electron) {
266 x = ComputeValue(ekin, GetPhysicsTable(fDedxElectron), idxDedxElectron);
267 } else if(part == positron) {
268 x = ComputeValue(ekin, GetPhysicsTable(fDedxPositron), idxDedxPositron);
269 } else if(part == muonPlus || part == muonMinus) {
270 x = ComputeValue(ekin, GetPhysicsTable(fDedxMuon), idxDedxMuon);
271 } else {
272 G4double e = ekin*proton_mass_c2/mass;
273 x = ComputeValue(e, GetPhysicsTable(fDedxProton), idxDedxProton)*charge2;
274 }
275 return x;
276}

Referenced by EnergyAfterStep(), and EnergyBeforeStep().

◆ ComputeEnergy()

G4double G4EnergyLossForExtrapolator::ComputeEnergy ( G4double  range,
const G4ParticleDefinition part 
)

Definition at line 303 of file G4EnergyLossForExtrapolator.cc.

305{
306 G4double x = 0.0;
307 if(part == electron) {
308 x = ComputeValue(range, GetPhysicsTable(fInvRangeElectron),
309 idxInvRangeElectron);
310 } else if(part == positron) {
311 x = ComputeValue(range, GetPhysicsTable(fInvRangePositron),
312 idxInvRangePositron);
313 } else if(part == muonPlus || part == muonMinus) {
314 x = ComputeValue(range, GetPhysicsTable(fInvRangeMuon), idxInvRangeMuon);
315 } else {
316 G4double massratio = proton_mass_c2/mass;
317 G4double r = range*massratio*charge2;
318 x = ComputeValue(r, GetPhysicsTable(fInvRangeProton),
319 idxInvRangeProton)/massratio;
320 }
321 return x;
322}
@ fInvRangeElectron
@ fInvRangePositron

Referenced by EnergyAfterStep(), and EnergyBeforeStep().

◆ ComputeRange()

G4double G4EnergyLossForExtrapolator::ComputeRange ( G4double  kinEnergy,
const G4ParticleDefinition part 
)

Definition at line 281 of file G4EnergyLossForExtrapolator.cc.

283{
284 G4double x = 0.0;
285 if(part == electron) {
286 x = ComputeValue(ekin, GetPhysicsTable(fRangeElectron), idxRangeElectron);
287 } else if(part == positron) {
288 x = ComputeValue(ekin, GetPhysicsTable(fRangePositron), idxRangePositron);
289 } else if(part == muonPlus || part == muonMinus) {
290 x = ComputeValue(ekin, GetPhysicsTable(fRangeMuon), idxRangeMuon);
291 } else {
292 G4double massratio = proton_mass_c2/mass;
293 G4double e = ekin*massratio;
294 x = ComputeValue(e, GetPhysicsTable(fRangeProton), idxRangeProton)
295 /(charge2*massratio);
296 }
297 return x;
298}

Referenced by EnergyAfterStep(), EnergyBeforeStep(), and TrueStepLength().

◆ ComputeTrueStep()

G4double G4EnergyLossForExtrapolator::ComputeTrueStep ( const G4Material mat,
const G4ParticleDefinition part,
G4double  kinEnergy,
G4double  stepLength 
)
inline

Definition at line 270 of file G4EnergyLossForExtrapolator.hh.

274{
275 G4double theta = AverageScatteringAngle(kinEnergy,stepLength,mat,part);
276 return stepLength*std::sqrt(1.0 + 0.625*theta*theta);
277}

Referenced by EnergyDispersion(), and TrueStepLength().

◆ EnergyAfterStep() [1/2]

G4double G4EnergyLossForExtrapolator::EnergyAfterStep ( G4double  kinEnergy,
G4double  step,
const G4Material mat,
const G4ParticleDefinition part 
)

Definition at line 116 of file G4EnergyLossForExtrapolator.cc.

120{
121 if(0 == nmat) { Initialisation(); }
122 G4double kinEnergyFinal = kinEnergy;
123 if(SetupKinematics(part, mat, kinEnergy)) {
124 G4double step = TrueStepLength(kinEnergy,stepLength,mat,part);
125 G4double r = ComputeRange(kinEnergy,part);
126 if(r <= step) {
127 kinEnergyFinal = 0.0;
128 } else if(step < linLossLimit*r) {
129 kinEnergyFinal -= step*ComputeDEDX(kinEnergy,part);
130 } else {
131 G4double r1 = r - step;
132 kinEnergyFinal = ComputeEnergy(r1,part);
133 }
134 }
135 return kinEnergyFinal;
136}
G4double TrueStepLength(G4double kinEnergy, G4double step, const G4Material *, const G4ParticleDefinition *part)
G4double ComputeRange(G4double kinEnergy, const G4ParticleDefinition *)
G4double ComputeDEDX(G4double kinEnergy, const G4ParticleDefinition *)
G4double ComputeEnergy(G4double range, const G4ParticleDefinition *)

Referenced by G4ErrorEnergyLoss::AlongStepDoIt(), EnergyAfterStep(), and G4ErrorEnergyLoss::GetContinuousStepLimit().

◆ EnergyAfterStep() [2/2]

G4double G4EnergyLossForExtrapolator::EnergyAfterStep ( G4double  kinEnergy,
G4double  step,
const G4Material mat,
const G4String particleName 
)
inline

Definition at line 208 of file G4EnergyLossForExtrapolator.hh.

212{
213 return EnergyAfterStep(kinEnergy,step,mat,FindParticle(name));
214}
G4double EnergyAfterStep(G4double kinEnergy, G4double step, const G4Material *, const G4ParticleDefinition *)

◆ EnergyBeforeStep() [1/2]

G4double G4EnergyLossForExtrapolator::EnergyBeforeStep ( G4double  kinEnergy,
G4double  step,
const G4Material mat,
const G4ParticleDefinition part 
)

Definition at line 141 of file G4EnergyLossForExtrapolator.cc.

145{
146 //G4cout << "G4EnergyLossForExtrapolator::EnergyBeforeStep" << G4endl;
147 if(0 == nmat) { Initialisation(); }
148 G4double kinEnergyFinal = kinEnergy;
149
150 if(SetupKinematics(part, mat, kinEnergy)) {
151 G4double step = TrueStepLength(kinEnergy,stepLength,mat,part);
152 G4double r = ComputeRange(kinEnergy,part);
153
154 if(step < linLossLimit*r) {
155 kinEnergyFinal += step*ComputeDEDX(kinEnergy,part);
156 } else {
157 G4double r1 = r + step;
158 kinEnergyFinal = ComputeEnergy(r1,part);
159 }
160 }
161 return kinEnergyFinal;
162}

Referenced by G4ErrorEnergyLoss::AlongStepDoIt(), EnergyBeforeStep(), and G4ErrorEnergyLoss::GetContinuousStepLimit().

◆ EnergyBeforeStep() [2/2]

G4double G4EnergyLossForExtrapolator::EnergyBeforeStep ( G4double  kinEnergy,
G4double  step,
const G4Material mat,
const G4String particleName 
)
inline

Definition at line 219 of file G4EnergyLossForExtrapolator.hh.

223{
224 return EnergyBeforeStep(kinEnergy,step,mat,FindParticle(name));
225}
G4double EnergyBeforeStep(G4double kinEnergy, G4double step, const G4Material *, const G4ParticleDefinition *)

◆ EnergyDispersion() [1/2]

G4double G4EnergyLossForExtrapolator::EnergyDispersion ( G4double  kinEnergy,
G4double  step,
const G4Material mat,
const G4ParticleDefinition part 
)
inline

Definition at line 282 of file G4EnergyLossForExtrapolator.hh.

286{
287 G4double sig2 = 0.0;
288 if(SetupKinematics(part, mat, kinEnergy)) {
289 G4double step = ComputeTrueStep(mat,part,kinEnergy,stepLength);
290 sig2 = (1.0/beta2 - 0.5)
291 *CLHEP::twopi_mc2_rcl2*tmax*step*electronDensity*charge2;
292 }
293 return sig2;
294}
G4double ComputeTrueStep(const G4Material *, const G4ParticleDefinition *part, G4double kinEnergy, G4double stepLength)

Referenced by EnergyDispersion().

◆ EnergyDispersion() [2/2]

G4double G4EnergyLossForExtrapolator::EnergyDispersion ( G4double  kinEnergy,
G4double  step,
const G4Material mat,
const G4String particleName 
)
inline

Definition at line 241 of file G4EnergyLossForExtrapolator.hh.

245{
246 return EnergyDispersion(kinEnergy,step,mat,FindParticle(name));
247}
G4double EnergyDispersion(G4double kinEnergy, G4double step, const G4Material *, const G4ParticleDefinition *)

◆ SetMaxEnergyTransfer()

void G4EnergyLossForExtrapolator::SetMaxEnergyTransfer ( G4double  val)
inline

Definition at line 331 of file G4EnergyLossForExtrapolator.hh.

332{
333 maxEnergyTransfer = val;
334}

◆ SetMaxKinEnergy()

void G4EnergyLossForExtrapolator::SetMaxKinEnergy ( G4double  val)
inline

Definition at line 324 of file G4EnergyLossForExtrapolator.hh.

325{
326 emax = val;
327}

◆ SetMinKinEnergy()

void G4EnergyLossForExtrapolator::SetMinKinEnergy ( G4double  val)
inline

Definition at line 317 of file G4EnergyLossForExtrapolator.hh.

318{
319 emin = val;
320}

◆ SetVerbose()

void G4EnergyLossForExtrapolator::SetVerbose ( G4int  val)
inline

Definition at line 310 of file G4EnergyLossForExtrapolator.hh.

311{
312 verbose = val;
313}

◆ TrueStepLength()

G4double G4EnergyLossForExtrapolator::TrueStepLength ( G4double  kinEnergy,
G4double  step,
const G4Material mat,
const G4ParticleDefinition part 
)

Definition at line 167 of file G4EnergyLossForExtrapolator.cc.

171{
172 G4double res = stepLength;
173 if(0 == nmat) { Initialisation(); }
174 //G4cout << "## G4EnergyLossForExtrapolator::TrueStepLength L= " << res
175 // << " " << part->GetParticleName() << G4endl;
176 if(SetupKinematics(part, mat, kinEnergy)) {
177 if(part == electron || part == positron) {
178 G4double x = stepLength*
179 ComputeValue(kinEnergy, GetPhysicsTable(fMscElectron), idxMscElectron);
180 //G4cout << " x= " << x << G4endl;
181 if(x < 0.2) { res *= (1.0 + 0.5*x + x*x/3.0); }
182 else if(x < 0.9999) { res = -G4Log(1.0 - x)*stepLength/x; }
183 else { res = ComputeRange(kinEnergy,part); }
184 } else {
185 res = ComputeTrueStep(mat,part,kinEnergy,stepLength);
186 }
187 }
188 return res;
189}

Referenced by EnergyAfterStep(), EnergyBeforeStep(), and G4EnergySplitter::SplitEnergyInVolumes().


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