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 31 of file ExtEnergyLoss.h.

Constructor & Destructor Documentation

◆ ExtEnergyLoss()

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

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) {
25 m_energyLossForExtrapolator = new EnergyLossForExtrapolator;
26 }
27 m_StepLimit = 1.0; // fraction of kinetic energy that could be lost in one step
28}
EnergyLossForExtrapolator * m_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)

◆ ~ExtEnergyLoss()

~ExtEnergyLoss ( )
virtual

destructor

Definition at line 30 of file ExtEnergyLoss.cc.

31{
32 if (m_energyLossForExtrapolator != NULL) {
34 }
35}

Member Function Documentation

◆ AlongStepDoIt()

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

Apply energy loss process along the step.

Definition at line 37 of file ExtEnergyLoss.cc.

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

◆ GetContinuousStepLimit()

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

Gets step limit for the particle being swum.

Definition at line 97 of file ExtEnergyLoss.cc.

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

◆ GetStepLimit()

G4double GetStepLimit ( )
inline

Gets the step limit for this process.

Definition at line 73 of file ExtEnergyLoss.h.

74 {
75 return m_StepLimit;
76 }

◆ IsApplicable()

G4bool IsApplicable ( const G4ParticleDefinition & aParticle)
inline

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

Definition at line 66 of file ExtEnergyLoss.h.

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

◆ SetStepLimit()

void SetStepLimit ( G4double val)
inline

Sets the step limit for this process.

Definition at line 78 of file ExtEnergyLoss.h.

79 {
80 m_StepLimit = val;
81 }

Member Data Documentation

◆ m_energyLossForExtrapolator

EnergyLossForExtrapolator* m_energyLossForExtrapolator
private

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

Definition at line 59 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 62 of file ExtEnergyLoss.h.


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