CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions
EnergyLossUpdator Class Referencefinal

#include <EnergyLossUpdator.h>

Inheritance diagram for EnergyLossUpdator:
MaterialEffectsUpdator

Public Member Functions

EnergyLossUpdatorclone () const override
 
void compute (const TrajectoryStateOnSurface &, const PropagationDirection, Effect &effect) const override
 
 EnergyLossUpdator (float mass)
 
- Public Member Functions inherited from MaterialEffectsUpdator
float mass () const
 
 MaterialEffectsUpdator (float mass)
 
virtual TrajectoryStateOnSurface updateState (const TrajectoryStateOnSurface &TSoS, const PropagationDirection propDir) const
 
virtual bool updateStateInPlace (TrajectoryStateOnSurface &TSoS, const PropagationDirection propDir) const
 
virtual ~MaterialEffectsUpdator ()
 

Private Member Functions

void computeBetheBloch (const LocalVector &, const MediumProperties &, Effect &effect) const
 
void computeElectrons (const LocalVector &, const MediumProperties &, const PropagationDirection, Effect &effect) const
 

Additional Inherited Members

- Public Types inherited from MaterialEffectsUpdator
typedef materialEffect::Covariance Covariance
 
typedef materialEffect::CovIndex CovIndex
 
typedef materialEffect::Effect Effect
 

Detailed Description

Energy loss according to Bethe-Bloch + special treatment for electrons. Adds effects from energy loss according to Bethe-Bloch formula without density effect. Assumes silicon as material. For electrons energy loss due to radiation added according to formulae by Bethe & Heitler. Ported from ORCA.

Definition at line 20 of file EnergyLossUpdator.h.

Constructor & Destructor Documentation

◆ EnergyLossUpdator()

EnergyLossUpdator::EnergyLossUpdator ( float  mass)
inline

Definition at line 25 of file EnergyLossUpdator.h.

Referenced by clone().

Member Function Documentation

◆ clone()

EnergyLossUpdator* EnergyLossUpdator::clone ( void  ) const
inlineoverridevirtual

Implements MaterialEffectsUpdator.

Definition at line 22 of file EnergyLossUpdator.h.

References EnergyLossUpdator().

22 { return new EnergyLossUpdator(*this); }
EnergyLossUpdator(float mass)

◆ compute()

void EnergyLossUpdator::compute ( const TrajectoryStateOnSurface TSoS,
const PropagationDirection  propDir,
Effect effect 
) const
overridevirtual

Implements MaterialEffectsUpdator.

Definition at line 17 of file EnergyLossUpdator.cc.

References alongMomentum, computeBetheBloch(), computeElectrons(), materialEffect::Effect::deltaP, MediumProperties::isValid(), TrajectoryStateOnSurface::localMomentum(), MaterialEffectsUpdator::mass(), Surface::mediumProperties(), and TrajectoryStateOnSurface::surface().

Referenced by CombinedMaterialEffectsUpdator::compute().

19  {
20  //
21  // Get surface
22  //
23  const Surface& surface = TSoS.surface();
24  //
25  //
26  // Now get information on medium
27  //
28  if (surface.mediumProperties().isValid()) {
29  //
30  // Bethe-Bloch
31  //
32  if (mass() > 0.001)
33  computeBetheBloch(TSoS.localMomentum(), surface.mediumProperties(), effect);
34  //
35  // Special treatment for electrons (currently rather crude
36  // distinction using mass)
37  //
38  else
39  computeElectrons(TSoS.localMomentum(), surface.mediumProperties(), propDir, effect);
40  if (propDir != alongMomentum)
41  effect.deltaP *= -1.;
42  }
43 }
void computeElectrons(const LocalVector &, const MediumProperties &, const PropagationDirection, Effect &effect) const
const SurfaceType & surface() const
void computeBetheBloch(const LocalVector &, const MediumProperties &, Effect &effect) const
const MediumProperties & mediumProperties() const
Definition: Surface.h:83
bool isValid() const

◆ computeBetheBloch()

void EnergyLossUpdator::computeBetheBloch ( const LocalVector localP,
const MediumProperties materialConstants,
Effect effect 
) const
private

Definition at line 47 of file EnergyLossUpdator.cc.

References funct::abs(), ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr(), plot_hgcal_utils::dEdx, materialEffect::Effect::deltaCov, materialEffect::Effect::deltaP, MillePedeFileConverter_cfg::e, materialEffect::elos, HLT_2023v12_cff::eta2, dqm-mbProfile::log, callgraph::m2, PV3DBase< T, PVType, FrameType >::mag2(), MaterialEffectsUpdator::mass(), SiStripOfflineCRack_cfg::p2, mathSSE::sqrt(), protons_cff::xi, MediumProperties::xi(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by compute().

49  {
50  //
51  // calculate absolute momentum and correction to path length from angle
52  // of incidence
53  //
54 
55  typedef float Float;
56 
57  Float p2 = localP.mag2();
58  Float xf = std::abs(std::sqrt(p2) / localP.z());
59 
60  // constants
61  const Float m2 = mass() * mass(); // use mass hypothesis from constructor
62 
63  constexpr Float emass = 0.511e-3;
64  constexpr Float poti = 16.e-9 * 10.75; // = 16 eV * Z**0.9, for Si Z=14
65  const Float eplasma = 28.816e-9 * sqrt(2.33 * 0.498); // 28.816 eV * sqrt(rho*(Z/A)) for Si
66  const Float delta0 = 2 * log(eplasma / poti) - 1.;
67 
68  // calculate general physics things
69  Float im2 = Float(1.) / m2;
70  Float e2 = p2 + m2;
71  Float e = std::sqrt(e2);
72  Float beta2 = p2 / e2;
73  Float eta2 = p2 * im2;
74  Float ratio2 = (emass * emass) * im2;
75  Float emax = Float(2.) * emass * eta2 / (Float(1.) + Float(2.) * emass * e * im2 + ratio2);
76 
77  Float xi = materialConstants.xi() * xf;
78  xi /= beta2;
79 
80  Float dEdx = xi * (unsafe_logf<2>(Float(2.) * emass * emax / (poti * poti)) - Float(2.) * (beta2)-delta0);
81 
82  Float dEdx2 = xi * emax * (Float(1.) - Float(0.5) * beta2);
83  Float dP = dEdx / std::sqrt(beta2);
84  Float sigp2 = dEdx2 / (beta2 * p2 * p2);
85  effect.deltaP += -dP;
86  using namespace materialEffect;
87  effect.deltaCov[elos] += sigp2;
88 
89  // std::cout << "pion new " << theDeltaP << " " << theDeltaCov(0,0) << std::endl;
90  // oldComputeBetheBloch (localP, materialConstants, mass());
91 }
T z() const
Definition: PV3DBase.h:61
T mag2() const
Definition: PV3DBase.h:63
T sqrt(T t)
Definition: SSEVec.h:19
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
float xi() const

◆ computeElectrons()

void EnergyLossUpdator::computeElectrons ( const LocalVector localP,
const MediumProperties materialConstants,
const PropagationDirection  propDir,
Effect effect 
) const
private

Definition at line 95 of file EnergyLossUpdator.cc.

References funct::abs(), materialEffect::Effect::deltaCov, materialEffect::Effect::deltaP, materialEffect::elos, DeadROC_duringRun::f2, dqm-mbProfile::log, PV3DBase< T, PVType, FrameType >::mag2(), oppositeToMomentum, AlCaHLTBitMon_ParallelJobs::p, SiStripOfflineCRack_cfg::p2, MediumProperties::radLen(), mathSSE::sqrt(), z, and PV3DBase< T, PVType, FrameType >::z().

Referenced by compute().

98  {
99  //
100  // calculate absolute momentum and correction to path length from angle
101  // of incidence
102  //
103  float p2 = localP.mag2();
104  float p = std::sqrt(p2);
105  float normalisedPath = std::abs(p / localP.z()) * materialConstants.radLen();
106  //
107  // Energy loss and variance according to Bethe and Heitler, see also
108  // Comp. Phys. Comm. 79 (1994) 157.
109  //
110  const float l3ol2 = std::log(3.) / std::log(2.);
111  float z = unsafe_expf<3>(-normalisedPath);
112  float varz = unsafe_expf<3>(-normalisedPath * l3ol2) - z * z;
113  // exp(-2*normalisedPath);
114 
115  if (propDir == oppositeToMomentum) {
116  //
117  // for backward propagation: delta(1/p) is linear in z=p_outside/p_inside
118  // convert to obtain equivalent delta(p). Sign of deltaP is corrected
119  // in method compute -> deltaP<0 at this place!!!
120  //
121  effect.deltaP += -p * (1.f / z - 1.f);
122  using namespace materialEffect;
123  effect.deltaCov[elos] += varz / p2;
124  } else {
125  //
126  // for forward propagation: calculate in p (linear in 1/z=p_inside/p_outside),
127  // then convert sig(p) to sig(1/p).
128  //
129  effect.deltaP += p * (z - 1.f);
130  // float f = 1/p/z/z;
131  // patch to ensure consistency between for- and backward propagation
132  float f2 = 1.f / (p2 * z * z);
133  using namespace materialEffect;
134  effect.deltaCov[elos] += f2 * varz;
135  }
136 
137  // std::cout << "electron new " << theDeltaP << " " << theDeltaCov(0,0) << std::endl;
138  // oldComputeElectrons (localP, materialConstants, propDir);
139 }
T z() const
Definition: PV3DBase.h:61
T mag2() const
Definition: PV3DBase.h:63
T sqrt(T t)
Definition: SSEVec.h:19
float radLen() const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22