Belle II Software development
ExtEnergyLoss Class Reference

Define physics process to calculate energy loss without fluctuations. More...

#include <ExtEnergyLoss.h>

Inheritance diagram for ExtEnergyLoss:

Public Member Functions

 ExtEnergyLoss (const G4String &processName="ExtEnergyLoss", G4ProcessType aType=fElectromagnetic)
 constructor
 
virtual ~ExtEnergyLoss ()
 destructor
 
G4bool IsApplicable (const G4ParticleDefinition &)
 Reports if this process is applicable to the particle being swum.
 
G4double GetContinuousStepLimit (const G4Track &, G4double, G4double, G4double &)
 Gets step limit for the particle being swum.
 
G4VParticleChange * AlongStepDoIt (const G4Track &, const G4Step &)
 Apply energy loss process along the step.
 
G4double GetStepLimit ()
 Gets the step limit for this process.
 
void SetStepLimit (G4double)
 Sets the step limit for this process.
 

Private Attributes

EnergyLossForExtrapolatorm_energyLossForExtrapolator
 Pointer to the geant4e-specific energy-loss and mult-scat class.
 
G4double m_StepLimit
 Step limit for this process (fraction of KE that could be lost in one step)
 

Detailed Description

Define physics process to calculate energy loss without fluctuations.

Definition at line 32 of file ExtEnergyLoss.h.

Constructor & Destructor Documentation

◆ ExtEnergyLoss()

ExtEnergyLoss ( const G4String &  processName = "ExtEnergyLoss",
G4ProcessType  aType = fElectromagnetic 
)

constructor

Definition at line 20 of file ExtEnergyLoss.cc.

21 : G4VContinuousProcess(processName, type), m_energyLossForExtrapolator(NULL)
22{
23 B2DEBUG(200, "ExtEnergyLoss is created");
24 if (m_energyLossForExtrapolator == NULL) {
26 }
27 m_StepLimit = 1.0; // fraction of kinetic energy that could be lost in one step
28 if (false) {
29 G4Track aTrack;
30 G4Step aStep;
31 double dummy;
32 AlongStepDoIt(aTrack, aStep);
33 GetContinuousStepLimit(aTrack, 0.0, 0.0, dummy);
34 }
35}
Calculate energy loss, fluctuation, and multiple-scattering angle for extrapolator.
G4double GetContinuousStepLimit(const G4Track &, G4double, G4double, G4double &)
Gets step limit for the particle being swum.
EnergyLossForExtrapolator * m_energyLossForExtrapolator
Pointer to the geant4e-specific energy-loss and mult-scat class.
Definition: ExtEnergyLoss.h:60
G4double m_StepLimit
Step limit for this process (fraction of KE that could be lost in one step)
Definition: ExtEnergyLoss.h:63
G4VParticleChange * AlongStepDoIt(const G4Track &, const G4Step &)
Apply energy loss process along the step.

◆ ~ExtEnergyLoss()

~ExtEnergyLoss ( )
virtual

destructor

Definition at line 37 of file ExtEnergyLoss.cc.

38{
39 if (m_energyLossForExtrapolator != NULL) {
41 }
42}

Member Function Documentation

◆ AlongStepDoIt()

G4VParticleChange * AlongStepDoIt ( const G4Track &  aTrack,
const G4Step &  aStep 
)

Apply energy loss process along the step.

Definition at line 44 of file ExtEnergyLoss.cc.

45{
46 aParticleChange.Initialize(aTrack);
47
48 G4ErrorPropagatorData* g4edata = G4ErrorPropagatorData::GetErrorPropagatorData();
49
50 G4double kinEnergyStart = aTrack.GetKineticEnergy();
51 G4double step_length = aStep.GetStepLength();
52
53 const G4Material* aMaterial = aTrack.GetMaterial();
54 const G4ParticleDefinition* aParticleDef = aTrack.GetDynamicParticle()->GetDefinition();
55 G4double kinEnergyEnd = kinEnergyStart;
56
57 if (g4edata->GetMode() == G4ErrorMode(G4ErrorMode_PropBackwards)) {
58 kinEnergyEnd = m_energyLossForExtrapolator->EnergyBeforeStep(kinEnergyStart,
59 step_length,
60 aMaterial,
61 aParticleDef);
62 G4double kinEnergyHalfStep = (kinEnergyStart + kinEnergyEnd) * 0.5;
63
64 B2DEBUG(200, "ExtEnergyLoss::AlongStepDoIt() BWD end " << kinEnergyEnd << " halfstep " << kinEnergyHalfStep);
65
66 // rescale to energy lost at midpoint of step
67 kinEnergyEnd = m_energyLossForExtrapolator->EnergyBeforeStep(kinEnergyHalfStep,
68 step_length,
69 aMaterial,
70 aParticleDef);
71 kinEnergyEnd = kinEnergyStart - (kinEnergyHalfStep - kinEnergyEnd);
72 } else if (g4edata->GetMode() == G4ErrorMode(G4ErrorMode_PropForwards)) {
73
74 kinEnergyEnd = m_energyLossForExtrapolator->EnergyAfterStep(kinEnergyStart,
75 step_length,
76 aMaterial,
77 aParticleDef);
78 G4double kinEnergyHalfStep = (kinEnergyStart + kinEnergyEnd) * 0.5;
79 B2DEBUG(200, "ExtEnergyLoss::AlongStepDoIt() FWD end " << kinEnergyEnd << " halfstep " << kinEnergyHalfStep);
80
81 // rescale to energy lost at midpoint of step
82 kinEnergyEnd = m_energyLossForExtrapolator->EnergyAfterStep(kinEnergyHalfStep,
83 step_length,
84 aMaterial,
85 aParticleDef);
86 kinEnergyEnd = kinEnergyStart - (kinEnergyHalfStep - kinEnergyEnd);
87 }
88
89 G4double edepo = kinEnergyEnd - kinEnergyStart;
90
91 B2DEBUG(300, "ExtEnergyLoss::AlongStepDoIt() Estart= " << kinEnergyStart << " Eend " << kinEnergyEnd
92 << " Ediff " << -edepo << " step= " << step_length << " mate= " << aMaterial->GetName()
93 << " particle= " << aParticleDef->GetParticleName());
94
95 aParticleChange.ClearDebugFlag();
96 aParticleChange.ProposeLocalEnergyDeposit(edepo);
97 aParticleChange.SetNumberOfSecondaries(0);
98
99 aParticleChange.ProposeEnergy(kinEnergyEnd);
100
101 return &aParticleChange;
102}
G4double EnergyAfterStep(G4double kinEnergy, G4double step, const G4Material *, const G4ParticleDefinition *)
Get kinetic energy after a step in given material by given particle.
G4double EnergyBeforeStep(G4double kinEnergy, G4double step, const G4Material *, const G4ParticleDefinition *)
Get kinetic energy before a step in given material by given particle.

◆ GetContinuousStepLimit()

G4double GetContinuousStepLimit ( const G4Track &  aTrack,
G4double  ,
G4double  currentMinimumStep,
G4double &   
)

Gets step limit for the particle being swum.

Definition at line 104 of file ExtEnergyLoss.cc.

108{
109 G4double step = DBL_MAX;
110 if (m_StepLimit < 1.0) {
111 G4double kinEnergyStart = aTrack.GetKineticEnergy();
112 G4double kinEnergyLoss = kinEnergyStart;
113 const G4Material* aMaterial = aTrack.GetMaterial();
114 const G4ParticleDefinition* aParticleDef = aTrack.GetDynamicParticle()->GetDefinition();
115 G4ErrorPropagatorData* g4edata = G4ErrorPropagatorData::GetErrorPropagatorData();
116 if (g4edata->GetMode() == G4ErrorMode(G4ErrorMode_PropBackwards)) {
117 kinEnergyLoss = - kinEnergyStart +
118 m_energyLossForExtrapolator->EnergyBeforeStep(kinEnergyStart, currentMinimumStep, aMaterial, aParticleDef);
119 } else if (g4edata->GetMode() == G4ErrorMode(G4ErrorMode_PropForwards)) {
120 kinEnergyLoss = kinEnergyStart -
121 m_energyLossForExtrapolator->EnergyAfterStep(kinEnergyStart, currentMinimumStep, aMaterial, aParticleDef);
122 }
123 B2DEBUG(300, "ExtEnergyLoss::GetContinuousStepLimit() currentMinimumStep " << currentMinimumStep
124 << " kinEnergyLoss " << kinEnergyLoss << " kinEnergyStart " << kinEnergyStart);
125 if (kinEnergyLoss / kinEnergyStart > m_StepLimit) {
126 step = m_StepLimit / (kinEnergyLoss / kinEnergyStart) * currentMinimumStep;
127 B2DEBUG(300, "ExtEnergyLoss::GetContinuousStepLimit() limiting Step " << step
128 << " energy loss fraction " << kinEnergyLoss / kinEnergyStart << " > " << m_StepLimit);
129 }
130 }
131
132 return step;
133
134}

◆ GetStepLimit()

G4double GetStepLimit ( )
inline

Gets the step limit for this process.

Definition at line 74 of file ExtEnergyLoss.h.

75 {
76 return m_StepLimit;
77 }

◆ IsApplicable()

G4bool IsApplicable ( const G4ParticleDefinition &  aParticle)
inline

Reports if this process is applicable to the particle being swum.

Definition at line 67 of file ExtEnergyLoss.h.

68 {
69 // This process applies to all geant4e-specific charged particles.
70 // (Verified that it is only called for these - but let's check anyway.)
71 return ((aParticle.GetPDGCharge() != 0) && (aParticle.GetParticleName().compare(0, 4, "g4e_") == 0));
72 }

◆ SetStepLimit()

void SetStepLimit ( G4double  val)
inline

Sets the step limit for this process.

Definition at line 79 of file ExtEnergyLoss.h.

80 {
81 m_StepLimit = val;
82 }

Member Data Documentation

◆ m_energyLossForExtrapolator

EnergyLossForExtrapolator* m_energyLossForExtrapolator
private

Pointer to the geant4e-specific energy-loss and mult-scat class.

Definition at line 60 of file ExtEnergyLoss.h.

◆ m_StepLimit

G4double m_StepLimit
private

Step limit for this process (fraction of KE that could be lost in one step)

Definition at line 63 of file ExtEnergyLoss.h.


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