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 ( float  mass)
inline

Definition at line 28 of file EnergyLossUpdator.h.

References compute(), computeBetheBloch(), computeElectrons(), and dso_internal.

Referenced by clone().

Member Function Documentation

EnergyLossUpdator* EnergyLossUpdator::clone ( void  ) const
inlineoverridevirtual

Implements MaterialEffectsUpdator.

Definition at line 23 of file EnergyLossUpdator.h.

References EnergyLossUpdator().

23  {
24  return new EnergyLossUpdator(*this);
25  }
EnergyLossUpdator(float mass)
void EnergyLossUpdator::compute ( const TrajectoryStateOnSurface TSoS,
const PropagationDirection  propDir,
Effect effect 
) const
overridevirtual

Implements MaterialEffectsUpdator.

Definition at line 22 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(), and EnergyLossUpdator().

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

Definition at line 53 of file EnergyLossUpdator.cc.

References funct::abs(), constexpr, plot_hgcal_utils::dEdx, materialEffect::Effect::deltaCov, materialEffect::Effect::deltaP, MillePedeFileConverter_cfg::e, materialEffect::elos, cmsBatch::log, PV3DBase< T, PVType, FrameType >::mag2(), MaterialEffectsUpdator::mass(), p2, mathSSE::sqrt(), MediumProperties::xi(), protons_cff::xi, and PV3DBase< T, PVType, FrameType >::z().

Referenced by compute(), and EnergyLossUpdator().

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

Definition at line 102 of file EnergyLossUpdator.cc.

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

Referenced by compute(), and EnergyLossUpdator().

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