Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
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 68 of file G4EnergyLossForExtrapolator.hh.

Constructor & Destructor Documentation

G4EnergyLossForExtrapolator::G4EnergyLossForExtrapolator ( G4int  verb = 1)

Definition at line 75 of file G4EnergyLossForExtrapolator.cc.

References python.hepunit::MeV, and python.hepunit::TeV.

76  :maxEnergyTransfer(DBL_MAX),verbose(verb),isInitialised(false)
77 {
78  currentParticle = 0;
79  currentMaterial = 0;
80 
81  linLossLimit = 0.01;
82  emin = 1.*MeV;
83  emax = 10.*TeV;
84  nbins = 70;
85 
86  nmat = index = 0;
87  pcuts = 0;
88 
89  mass = charge2 = electronDensity = radLength = bg2 = beta2
90  = kineticEnergy = tmax = 0;
91  gam = 1.0;
92 
93  dedxElectron = dedxPositron = dedxProton = rangeElectron
94  = rangePositron = rangeProton = invRangeElectron = invRangePositron
95  = invRangeProton = mscElectron = dedxMuon = rangeMuon = invRangeMuon = 0;
96 
97  electron = positron = proton = muonPlus = muonMinus = 0;
98 }
#define DBL_MAX
Definition: templates.hh:83
G4EnergyLossForExtrapolator::~G4EnergyLossForExtrapolator ( )

Definition at line 102 of file G4EnergyLossForExtrapolator.cc.

103 {
104  for(G4int i=0; i<nmat; i++) {delete couples[i];}
105  delete dedxElectron;
106  delete dedxPositron;
107  delete dedxProton;
108  delete dedxMuon;
109  delete rangeElectron;
110  delete rangePositron;
111  delete rangeProton;
112  delete rangeMuon;
113  delete invRangeElectron;
114  delete invRangePositron;
115  delete invRangeProton;
116  delete invRangeMuon;
117  delete mscElectron;
118  delete pcuts;
119 }
int G4int
Definition: G4Types.hh:78

Member Function Documentation

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

Definition at line 250 of file G4EnergyLossForExtrapolator.hh.

References G4Log(), and G4INCL::Math::max().

Referenced by AverageScatteringAngle(), and ComputeTrueStep().

254 {
255  G4double theta = 0.0;
256  if(SetupKinematics(part, mat, kinEnergy)) {
257  G4double t = stepLength/radLength;
258  G4double y = std::max(0.001, t);
259  theta = 19.23*CLHEP::MeV*std::sqrt(charge2*t)*(1.0 + 0.038*G4Log(y))
260  /(beta2*gam*mass);
261  }
262  return theta;
263 }
G4double G4Log(G4double x)
Definition: G4Log.hh:227
T max(const T t1, const T t2)
brief Return the largest of the two arguments
double G4double
Definition: G4Types.hh:76
G4double G4EnergyLossForExtrapolator::AverageScatteringAngle ( G4double  kinEnergy,
G4double  step,
const G4Material mat,
const G4String particleName 
)
inline

Definition at line 228 of file G4EnergyLossForExtrapolator.hh.

References AverageScatteringAngle().

232 {
233  return AverageScatteringAngle(kinEnergy,step,mat,FindParticle(name));
234 }
G4double AverageScatteringAngle(G4double kinEnergy, G4double step, const G4Material *, const G4ParticleDefinition *part)
const XML_Char * name
G4double G4EnergyLossForExtrapolator::ComputeDEDX ( G4double  kinEnergy,
const G4ParticleDefinition part 
)

Definition at line 360 of file G4EnergyLossForExtrapolator.cc.

References python.hepunit::proton_mass_c2, and test::x.

Referenced by EnergyAfterStep(), and EnergyBeforeStep().

362 {
363  G4double x = 0.0;
364  if(part == electron) x = ComputeValue(kinEnergy, dedxElectron);
365  else if(part == positron) x = ComputeValue(kinEnergy, dedxPositron);
366  else if(part == muonPlus || part == muonMinus) {
367  x = ComputeValue(kinEnergy, dedxMuon);
368  } else {
369  G4double e = kinEnergy*proton_mass_c2/mass;
370  x = ComputeValue(e, dedxProton)*charge2;
371  }
372  return x;
373 }
float proton_mass_c2
Definition: hepunit.py:275
double G4double
Definition: G4Types.hh:76
G4double G4EnergyLossForExtrapolator::ComputeEnergy ( G4double  range,
const G4ParticleDefinition part 
)

Definition at line 397 of file G4EnergyLossForExtrapolator.cc.

References python.hepunit::proton_mass_c2, and test::x.

Referenced by EnergyAfterStep(), and EnergyBeforeStep().

399 {
400  G4double x = 0.0;
401  if(part == electron) x = ComputeValue(range, invRangeElectron);
402  else if(part == positron) x = ComputeValue(range, invRangePositron);
403  else if(part == muonPlus || part == muonMinus)
404  x = ComputeValue(range, invRangeMuon);
405  else {
406  G4double massratio = proton_mass_c2/mass;
407  G4double r = range*massratio*charge2;
408  x = ComputeValue(r, invRangeProton)/massratio;
409  }
410  return x;
411 }
float proton_mass_c2
Definition: hepunit.py:275
double G4double
Definition: G4Types.hh:76
G4double G4EnergyLossForExtrapolator::ComputeRange ( G4double  kinEnergy,
const G4ParticleDefinition part 
)

Definition at line 378 of file G4EnergyLossForExtrapolator.cc.

References python.hepunit::proton_mass_c2, and test::x.

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

380 {
381  G4double x = 0.0;
382  if(part == electron) x = ComputeValue(kinEnergy, rangeElectron);
383  else if(part == positron) x = ComputeValue(kinEnergy, rangePositron);
384  else if(part == muonPlus || part == muonMinus)
385  x = ComputeValue(kinEnergy, rangeMuon);
386  else {
387  G4double massratio = proton_mass_c2/mass;
388  G4double e = kinEnergy*massratio;
389  x = ComputeValue(e, rangeProton)/(charge2*massratio);
390  }
391  return x;
392 }
float proton_mass_c2
Definition: hepunit.py:275
double G4double
Definition: G4Types.hh:76
G4double G4EnergyLossForExtrapolator::ComputeTrueStep ( const G4Material mat,
const G4ParticleDefinition part,
G4double  kinEnergy,
G4double  stepLength 
)
inline

Definition at line 268 of file G4EnergyLossForExtrapolator.hh.

References AverageScatteringAngle().

Referenced by EnergyDispersion(), and TrueStepLength().

272 {
273  G4double theta = AverageScatteringAngle(kinEnergy,stepLength,mat,part);
274  return stepLength*std::sqrt(1.0 + 0.625*theta*theta);
275 }
G4double AverageScatteringAngle(G4double kinEnergy, G4double step, const G4Material *, const G4ParticleDefinition *part)
double G4double
Definition: G4Types.hh:76
G4double G4EnergyLossForExtrapolator::EnergyAfterStep ( G4double  kinEnergy,
G4double  step,
const G4Material mat,
const G4ParticleDefinition part 
)

Definition at line 124 of file G4EnergyLossForExtrapolator.cc.

References ComputeDEDX(), ComputeEnergy(), ComputeRange(), and TrueStepLength().

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

128 {
129  if(!isInitialised) Initialisation();
130  G4double kinEnergyFinal = kinEnergy;
131  if(SetupKinematics(part, mat, kinEnergy)) {
132  G4double step = TrueStepLength(kinEnergy,stepLength,mat,part);
133  G4double r = ComputeRange(kinEnergy,part);
134  if(r <= step) {
135  kinEnergyFinal = 0.0;
136  } else if(step < linLossLimit*r) {
137  kinEnergyFinal -= step*ComputeDEDX(kinEnergy,part);
138  } else {
139  G4double r1 = r - step;
140  kinEnergyFinal = ComputeEnergy(r1,part);
141  }
142  }
143  return kinEnergyFinal;
144 }
G4double TrueStepLength(G4double kinEnergy, G4double step, const G4Material *, const G4ParticleDefinition *part)
G4double ComputeDEDX(G4double kinEnergy, const G4ParticleDefinition *)
G4double ComputeRange(G4double kinEnergy, const G4ParticleDefinition *)
G4double ComputeEnergy(G4double range, const G4ParticleDefinition *)
double G4double
Definition: G4Types.hh:76
G4double G4EnergyLossForExtrapolator::EnergyAfterStep ( G4double  kinEnergy,
G4double  step,
const G4Material mat,
const G4String particleName 
)
inline

Definition at line 206 of file G4EnergyLossForExtrapolator.hh.

References EnergyAfterStep().

210 {
211  return EnergyAfterStep(kinEnergy,step,mat,FindParticle(name));
212 }
const XML_Char * name
G4double EnergyAfterStep(G4double kinEnergy, G4double step, const G4Material *, const G4ParticleDefinition *)
G4double G4EnergyLossForExtrapolator::EnergyBeforeStep ( G4double  kinEnergy,
G4double  step,
const G4Material mat,
const G4ParticleDefinition part 
)

Definition at line 149 of file G4EnergyLossForExtrapolator.cc.

References ComputeDEDX(), ComputeEnergy(), ComputeRange(), and TrueStepLength().

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

153 {
154  if(!isInitialised) { Initialisation(); }
155  G4double kinEnergyFinal = kinEnergy;
156 
157  if(SetupKinematics(part, mat, kinEnergy)) {
158  G4double step = TrueStepLength(kinEnergy,stepLength,mat,part);
159  G4double r = ComputeRange(kinEnergy,part);
160 
161  if(step < linLossLimit*r) {
162  kinEnergyFinal += step*ComputeDEDX(kinEnergy,part);
163  } else {
164  G4double r1 = r + step;
165  kinEnergyFinal = ComputeEnergy(r1,part);
166  }
167  }
168  return kinEnergyFinal;
169 }
G4double TrueStepLength(G4double kinEnergy, G4double step, const G4Material *, const G4ParticleDefinition *part)
G4double ComputeDEDX(G4double kinEnergy, const G4ParticleDefinition *)
G4double ComputeRange(G4double kinEnergy, const G4ParticleDefinition *)
G4double ComputeEnergy(G4double range, const G4ParticleDefinition *)
double G4double
Definition: G4Types.hh:76
G4double G4EnergyLossForExtrapolator::EnergyBeforeStep ( G4double  kinEnergy,
G4double  step,
const G4Material mat,
const G4String particleName 
)
inline

Definition at line 217 of file G4EnergyLossForExtrapolator.hh.

References EnergyBeforeStep().

221 {
222  return EnergyBeforeStep(kinEnergy,step,mat,FindParticle(name));
223 }
const XML_Char * name
G4double EnergyBeforeStep(G4double kinEnergy, G4double step, const G4Material *, const G4ParticleDefinition *)
G4double G4EnergyLossForExtrapolator::EnergyDispersion ( G4double  kinEnergy,
G4double  step,
const G4Material mat,
const G4ParticleDefinition part 
)
inline

Definition at line 280 of file G4EnergyLossForExtrapolator.hh.

References ComputeTrueStep().

Referenced by EnergyDispersion().

284 {
285  G4double sig2 = 0.0;
286  if(SetupKinematics(part, mat, kinEnergy)) {
287  G4double step = ComputeTrueStep(mat,part,kinEnergy,stepLength);
288  sig2 = (1.0/beta2 - 0.5)*CLHEP::twopi_mc2_rcl2*tmax*step*electronDensity*charge2;
289  }
290  return sig2;
291 }
G4double ComputeTrueStep(const G4Material *, const G4ParticleDefinition *part, G4double kinEnergy, G4double stepLength)
double G4double
Definition: G4Types.hh:76
G4double G4EnergyLossForExtrapolator::EnergyDispersion ( G4double  kinEnergy,
G4double  step,
const G4Material mat,
const G4String particleName 
)
inline

Definition at line 239 of file G4EnergyLossForExtrapolator.hh.

References EnergyDispersion().

243 {
244  return EnergyDispersion(kinEnergy,step,mat,FindParticle(name));
245 }
G4double EnergyDispersion(G4double kinEnergy, G4double step, const G4Material *, const G4ParticleDefinition *)
const XML_Char * name
void G4EnergyLossForExtrapolator::SetMaxEnergyTransfer ( G4double  val)
inline

Definition at line 328 of file G4EnergyLossForExtrapolator.hh.

329 {
330  maxEnergyTransfer = val;
331 }
void G4EnergyLossForExtrapolator::SetMaxKinEnergy ( G4double  val)
inline

Definition at line 321 of file G4EnergyLossForExtrapolator.hh.

322 {
323  emax = val;
324 }
void G4EnergyLossForExtrapolator::SetMinKinEnergy ( G4double  val)
inline

Definition at line 314 of file G4EnergyLossForExtrapolator.hh.

315 {
316  emin = val;
317 }
void G4EnergyLossForExtrapolator::SetVerbose ( G4int  val)
inline

Definition at line 307 of file G4EnergyLossForExtrapolator.hh.

308 {
309  verbose = val;
310 }
G4double G4EnergyLossForExtrapolator::TrueStepLength ( G4double  kinEnergy,
G4double  step,
const G4Material mat,
const G4ParticleDefinition part 
)

Definition at line 174 of file G4EnergyLossForExtrapolator.cc.

References ComputeRange(), ComputeTrueStep(), G4Log(), and test::x.

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

178 {
179  G4double res = stepLength;
180  if(!isInitialised) Initialisation();
181  if(SetupKinematics(part, mat, kinEnergy)) {
182  if(part == electron || part == positron) {
183  G4double x = stepLength*ComputeValue(kinEnergy, mscElectron);
184  if(x < 0.2) { res *= (1.0 + 0.5*x + x*x/3.0); }
185  else if(x < 0.9999) { res = -G4Log(1.0 - x)*stepLength/x; }
186  else { res = ComputeRange(kinEnergy,part); }
187 
188  } else {
189  res = ComputeTrueStep(mat,part,kinEnergy,stepLength);
190  }
191  }
192  return res;
193 }
G4double ComputeTrueStep(const G4Material *, const G4ParticleDefinition *part, G4double kinEnergy, G4double stepLength)
G4double ComputeRange(G4double kinEnergy, const G4ParticleDefinition *)
G4double G4Log(G4double x)
Definition: G4Log.hh:227
double G4double
Definition: G4Types.hh:76

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