Geant4 11.2.2
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 ()
 
void Initialisation ()
 
G4double ComputeDEDX (G4double kinEnergy, const G4ParticleDefinition *, const G4Material *)
 
G4double ComputeRange (G4double kinEnergy, const G4ParticleDefinition *, const G4Material *)
 
G4double ComputeEnergy (G4double range, const G4ParticleDefinition *, const G4Material *)
 
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)
 
G4EnergyLossForExtrapolatoroperator= (const G4EnergyLossForExtrapolator &right)=delete
 
 G4EnergyLossForExtrapolator (const G4EnergyLossForExtrapolator &)=delete
 

Detailed Description

Definition at line 67 of file G4EnergyLossForExtrapolator.hh.

Constructor & Destructor Documentation

◆ G4EnergyLossForExtrapolator() [1/2]

G4EnergyLossForExtrapolator::G4EnergyLossForExtrapolator ( G4int verb = 1)
explicit

Definition at line 70 of file G4EnergyLossForExtrapolator.cc.

71 : maxEnergyTransfer(DBL_MAX), verbose(verb)
72{
73 emin = 1.*CLHEP::MeV;
74 emax = 100.*CLHEP::TeV;
75}
#define DBL_MAX
Definition templates.hh:62

◆ ~G4EnergyLossForExtrapolator()

G4EnergyLossForExtrapolator::~G4EnergyLossForExtrapolator ( )

Definition at line 79 of file G4EnergyLossForExtrapolator.cc.

80{
81 if(isMaster) {
82 delete tables;
83 tables = nullptr;
84 }
85}

◆ G4EnergyLossForExtrapolator() [2/2]

G4EnergyLossForExtrapolator::G4EnergyLossForExtrapolator ( const G4EnergyLossForExtrapolator & )
delete

Member Function Documentation

◆ AverageScatteringAngle() [1/2]

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

Definition at line 312 of file G4EnergyLossForExtrapolator.cc.

317{
318 G4double theta = 0.0;
319 if(SetupKinematics(part, mat, kinEnergy)) {
320 G4double t = stepLength/radLength;
321 G4double y = std::max(0.001, t);
322 theta = 19.23*CLHEP::MeV*std::sqrt(charge2*t)*(1.0 + 0.038*G4Log(y))
323 /(beta2*gam*part->GetPDGMass());
324 }
325 return theta;
326}
G4double G4Log(G4double x)
Definition G4Log.hh:227
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 216 of file G4EnergyLossForExtrapolator.hh.

220{
221 return AverageScatteringAngle(kinEnergy,step,mat,FindParticle(name));
222}
G4double AverageScatteringAngle(G4double kinEnergy, G4double step, const G4Material *, const G4ParticleDefinition *part)

◆ ComputeDEDX()

G4double G4EnergyLossForExtrapolator::ComputeDEDX ( G4double kinEnergy,
const G4ParticleDefinition * part,
const G4Material * mat )

Definition at line 224 of file G4EnergyLossForExtrapolator.cc.

227{
228 if(mat->GetNumberOfMaterials() != nmat) { Initialisation(); }
229 G4double x = 0.0;
230 if(part == electron) {
231 x = ComputeValue(ekin, GetPhysicsTable(fDedxElectron), mat->GetIndex());
232 } else if(part == positron) {
233 x = ComputeValue(ekin, GetPhysicsTable(fDedxPositron), mat->GetIndex());
234 } else if(part == muonPlus || part == muonMinus) {
235 x = ComputeValue(ekin, GetPhysicsTable(fDedxMuon), mat->GetIndex());
236 } else {
237 G4double e = ekin*CLHEP::proton_mass_c2/part->GetPDGMass();
238 G4double q = part->GetPDGCharge()/CLHEP::eplus;
239 x = ComputeValue(e, GetPhysicsTable(fDedxProton), mat->GetIndex())*q*q;
240 }
241 return x;
242}
static std::size_t GetNumberOfMaterials()
std::size_t GetIndex() const

Referenced by EnergyAfterStep(), and EnergyBeforeStep().

◆ ComputeEnergy()

G4double G4EnergyLossForExtrapolator::ComputeEnergy ( G4double range,
const G4ParticleDefinition * part,
const G4Material * mat )

Definition at line 272 of file G4EnergyLossForExtrapolator.cc.

275{
276 if(mat->GetNumberOfMaterials() != nmat) { Initialisation(); }
277 G4double x = 0.0;
278 if(part == electron) {
279 x = ComputeValue(range,GetPhysicsTable(fInvRangeElectron),mat->GetIndex());
280 } else if(part == positron) {
281 x = ComputeValue(range,GetPhysicsTable(fInvRangePositron),mat->GetIndex());
282 } else if(part == muonPlus || part == muonMinus) {
283 x = ComputeValue(range, GetPhysicsTable(fInvRangeMuon), mat->GetIndex());
284 } else {
285 G4double massratio = CLHEP::proton_mass_c2/part->GetPDGMass();
286 G4double q = part->GetPDGCharge()/CLHEP::eplus;
287 G4double r = range*massratio*q*q;
288 x = ComputeValue(r, GetPhysicsTable(fInvRangeProton), mat->GetIndex())/massratio;
289 }
290 return x;
291}

Referenced by EnergyAfterStep(), and EnergyBeforeStep().

◆ ComputeRange()

G4double G4EnergyLossForExtrapolator::ComputeRange ( G4double kinEnergy,
const G4ParticleDefinition * part,
const G4Material * mat )

Definition at line 247 of file G4EnergyLossForExtrapolator.cc.

250{
251 if(mat->GetNumberOfMaterials() != nmat) { Initialisation(); }
252 G4double x = 0.0;
253 if(part == electron) {
254 x = ComputeValue(ekin, GetPhysicsTable(fRangeElectron), mat->GetIndex());
255 } else if(part == positron) {
256 x = ComputeValue(ekin, GetPhysicsTable(fRangePositron), mat->GetIndex());
257 } else if(part == muonPlus || part == muonMinus) {
258 x = ComputeValue(ekin, GetPhysicsTable(fRangeMuon), mat->GetIndex());
259 } else {
260 G4double massratio = CLHEP::proton_mass_c2/part->GetPDGMass();
261 G4double e = ekin*massratio;
262 G4double q = part->GetPDGCharge()/CLHEP::eplus;
263 x = ComputeValue(e, GetPhysicsTable(fRangeProton), mat->GetIndex())
264 /(q*q*massratio);
265 }
266 return x;
267}

Referenced by EnergyAfterStep(), EnergyBeforeStep(), G4ErrorEnergyLoss::GetContinuousStepLimit(), and TrueStepLength().

◆ ComputeTrueStep()

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

Definition at line 238 of file G4EnergyLossForExtrapolator.hh.

242{
243 G4double theta = AverageScatteringAngle(kinEnergy,stepLength,mat,part);
244 return stepLength*std::sqrt(1.0 + 0.625*theta*theta);
245}

Referenced by EnergyDispersion(), and TrueStepLength().

◆ EnergyAfterStep() [1/2]

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

Definition at line 90 of file G4EnergyLossForExtrapolator.cc.

94{
95 G4double kinEnergyFinal = kinEnergy;
96 if(SetupKinematics(part, mat, kinEnergy)) {
97 G4double step = TrueStepLength(kinEnergy,stepLength,mat,part);
98 G4double r = ComputeRange(kinEnergy,part,mat);
99 if(r <= step) {
100 kinEnergyFinal = 0.0;
101 } else if(step < linLossLimit*r) {
102 kinEnergyFinal -= step*ComputeDEDX(kinEnergy,part,mat);
103 } else {
104 G4double r1 = r - step;
105 kinEnergyFinal = ComputeEnergy(r1,part,mat);
106 }
107 }
108 return kinEnergyFinal;
109}
G4double TrueStepLength(G4double kinEnergy, G4double step, const G4Material *, const G4ParticleDefinition *part)
G4double ComputeRange(G4double kinEnergy, const G4ParticleDefinition *, const G4Material *)
G4double ComputeDEDX(G4double kinEnergy, const G4ParticleDefinition *, const G4Material *)
G4double ComputeEnergy(G4double range, const G4ParticleDefinition *, const G4Material *)

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

◆ EnergyAfterStep() [2/2]

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

Definition at line 194 of file G4EnergyLossForExtrapolator.hh.

198{
199 return EnergyAfterStep(kinEnergy,step,mat,FindParticle(name));
200}
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 114 of file G4EnergyLossForExtrapolator.cc.

118{
119 //G4cout << "G4EnergyLossForExtrapolator::EnergyBeforeStep" << G4endl;
120 G4double kinEnergyFinal = kinEnergy;
121
122 if(SetupKinematics(part, mat, kinEnergy)) {
123 G4double step = TrueStepLength(kinEnergy,stepLength,mat,part);
124 G4double r = ComputeRange(kinEnergy,part,mat);
125
126 if(step < linLossLimit*r) {
127 kinEnergyFinal += step*ComputeDEDX(kinEnergy,part,mat);
128 } else {
129 G4double r1 = r + step;
130 kinEnergyFinal = ComputeEnergy(r1,part,mat);
131 }
132 }
133 return kinEnergyFinal;
134}

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

◆ EnergyBeforeStep() [2/2]

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

Definition at line 205 of file G4EnergyLossForExtrapolator.hh.

209{
210 return EnergyBeforeStep(kinEnergy,step,mat,FindParticle(name));
211}
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 )

Definition at line 296 of file G4EnergyLossForExtrapolator.cc.

300{
301 G4double sig2 = 0.0;
302 if(SetupKinematics(part, mat, kinEnergy)) {
303 G4double step = ComputeTrueStep(mat,part,kinEnergy,stepLength);
304 sig2 = (1.0/beta2 - 0.5)
305 *CLHEP::twopi_mc2_rcl2*tmax*step*electronDensity*charge2;
306 }
307 return sig2;
308}
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 227 of file G4EnergyLossForExtrapolator.hh.

231{
232 return EnergyDispersion(kinEnergy,step,mat,FindParticle(name));
233}
G4double EnergyDispersion(G4double kinEnergy, G4double step, const G4Material *, const G4ParticleDefinition *)

◆ Initialisation()

void G4EnergyLossForExtrapolator::Initialisation ( )

Definition at line 330 of file G4EnergyLossForExtrapolator.cc.

331{
332 if(verbose>0) {
333 G4cout << "### G4EnergyLossForExtrapolator::Initialisation tables= "
334 << tables << G4endl;
335 }
336 electron = G4Electron::Electron();
337 positron = G4Positron::Positron();
338 proton = G4Proton::Proton();
339 muonPlus = G4MuonPlus::MuonPlus();
340 muonMinus= G4MuonMinus::MuonMinus();
341
342 // initialisation for the 1st run
343 if(nullptr == tables) {
344#ifdef G4MULTITHREADED
345 G4MUTEXLOCK(&extrMutex);
346 if(nullptr == tables) {
347#endif
348 isMaster = true;
349 tables = new G4TablesForExtrapolator(verbose, nbins, emin, emax);
350 tables->Initialisation();
352 if(verbose > 0) {
353 G4cout << "### G4EnergyLossForExtrapolator::BuildTables for "
354 << nmat << " materials Nbins= "
355 << nbins << " Emin(MeV)= " << emin << " Emax(MeV)= " << emax
356 << G4endl;
357 }
358#ifdef G4MULTITHREADED
359 }
360 G4MUTEXUNLOCK(&extrMutex);
361#endif
362 }
363
364 // initialisation for the next run
365 if(isMaster && G4Material::GetNumberOfMaterials() != nmat) {
366#ifdef G4MULTITHREADED
367 G4MUTEXLOCK(&extrMutex);
368#endif
369 tables->Initialisation();
370#ifdef G4MULTITHREADED
371 G4MUTEXUNLOCK(&extrMutex);
372#endif
373 }
375}
#define G4MUTEXLOCK(mutex)
#define G4MUTEXUNLOCK(mutex)
#define G4endl
Definition G4ios.hh:67
G4GLOB_DLL std::ostream G4cout
static G4Electron * Electron()
Definition G4Electron.cc:91
static G4MuonMinus * MuonMinus()
static G4MuonPlus * MuonPlus()
Definition G4MuonPlus.cc:98
static G4Positron * Positron()
Definition G4Positron.cc:90
static G4Proton * Proton()
Definition G4Proton.cc:90

Referenced by ComputeDEDX(), ComputeEnergy(), and ComputeRange().

◆ operator=()

G4EnergyLossForExtrapolator & G4EnergyLossForExtrapolator::operator= ( const G4EnergyLossForExtrapolator & right)
delete

◆ SetMaxEnergyTransfer()

void G4EnergyLossForExtrapolator::SetMaxEnergyTransfer ( G4double val)
inline

Definition at line 280 of file G4EnergyLossForExtrapolator.hh.

281{
282 maxEnergyTransfer = val;
283}

◆ SetMaxKinEnergy()

void G4EnergyLossForExtrapolator::SetMaxKinEnergy ( G4double val)
inline

Definition at line 273 of file G4EnergyLossForExtrapolator.hh.

274{
275 emax = val;
276}

◆ SetMinKinEnergy()

void G4EnergyLossForExtrapolator::SetMinKinEnergy ( G4double val)
inline

Definition at line 266 of file G4EnergyLossForExtrapolator.hh.

267{
268 emin = val;
269}

◆ SetVerbose()

void G4EnergyLossForExtrapolator::SetVerbose ( G4int val)
inline

Definition at line 259 of file G4EnergyLossForExtrapolator.hh.

260{
261 verbose = val;
262}

◆ TrueStepLength()

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

Definition at line 139 of file G4EnergyLossForExtrapolator.cc.

143{
144 G4double res = stepLength;
145 //G4cout << "## G4EnergyLossForExtrapolator::TrueStepLength L= " << res
146 // << " " << part->GetParticleName() << G4endl;
147 if(SetupKinematics(part, mat, kinEnergy)) {
148 if(part == electron || part == positron) {
149 const G4double x = stepLength*
150 ComputeValue(kinEnergy, GetPhysicsTable(fMscElectron), mat->GetIndex());
151 //G4cout << " x= " << x << G4endl;
152 if(x < 0.2) { res *= (1.0 + 0.5*x + x*x/3.0); }
153 else if(x < 0.9999) { res = -G4Log(1.0 - x)*stepLength/x; }
154 else { res = ComputeRange(kinEnergy, part, mat); }
155 } else {
156 res = ComputeTrueStep(mat,part,kinEnergy,stepLength);
157 }
158 }
159 return res;
160}

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


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