CMS 3D CMS Logo

Functions
EnergyLossUpdator.cc File Reference
#include "TrackingTools/MaterialEffects/interface/EnergyLossUpdator.h"
#include "DataFormats/GeometrySurface/interface/MediumProperties.h"
#include "DataFormats/Math/interface/approx_exp.h"
#include "DataFormats/Math/interface/approx_log.h"

Go to the source code of this file.

Functions

void oldComputeBetheBloch (const LocalVector &localP, const MediumProperties &materialConstants, double mass)
 
void oldComputeElectrons (const LocalVector &localP, const MediumProperties &materialConstants, const PropagationDirection propDir)
 

Function Documentation

◆ oldComputeBetheBloch()

void oldComputeBetheBloch ( const LocalVector localP,
const MediumProperties materialConstants,
double  mass 
)

Definition at line 143 of file EnergyLossUpdator.cc.

References HLT_2024v14_cff::beta, gather_cfg::cout, plot_hgcal_utils::dEdx, MillePedeFileConverter_cfg::e, HLT_2024v14_cff::eta2, CustomPhysics_cfi::gamma, CrabHelper::log, visualization-live-secondInstance_cfg::m, PV3DBase< T, PVType, FrameType >::mag(), MaterialEffectsUpdator::mass(), AlCaHLTBitMon_ParallelJobs::p, mathSSE::sqrt(), protons_cff::xi, MediumProperties::xi(), and PV3DBase< T, PVType, FrameType >::z().

143  {
144  double theDeltaP = 0., theDeltaCov = 0;
145 
146  //
147  // calculate absolute momentum and correction to path length from angle
148  // of incidence
149  //
150  double p = localP.mag();
151  double xf = fabs(p / localP.z());
152  // constants
153  const double m = mass; // use mass hypothesis from constructor
154 
155  const double emass = 0.511e-3;
156  const double poti = 16.e-9 * 10.75; // = 16 eV * Z**0.9, for Si Z=14
157  const double eplasma = 28.816e-9 * sqrt(2.33 * 0.498); // 28.816 eV * sqrt(rho*(Z/A)) for Si
158  const double delta0 = 2 * log(eplasma / poti) - 1.;
159 
160  // calculate general physics things
161  double e = sqrt(p * p + m * m);
162  double beta = p / e;
163  double gamma = e / m;
164  double eta2 = beta * gamma;
165  eta2 *= eta2;
166  // double lnEta2 = log(eta2);
167  double ratio = emass / m;
168  double emax = 2. * emass * eta2 / (1. + 2. * ratio * gamma + ratio * ratio);
169  // double delta = delta0 + lnEta2;
170 
171  // calculate the mean and sigma of energy loss
172  // xi = d[g/cm2] * 0.307075MeV/(g/cm2) * Z/A * 1/2
173  double xi = materialConstants.xi() * xf;
174  xi /= (beta * beta);
175 
176  // double dEdx = xi*(log(2.*emass*eta2*emax/(poti*poti)) - 2.*(beta*beta));
177  //double dEdx = xi*(log(2.*emass*emax/(poti*poti))+lnEta2 - 2.*(beta*beta) - delta);
178 
179  double dEdx = xi * (log(2. * emass * emax / (poti * poti)) - 2. * (beta * beta) - delta0);
180  double dEdx2 = xi * emax * (1. - 0.5 * (beta * beta));
181  double dP = dEdx / beta;
182  double sigp2 = dEdx2 * e * e / (p * p * p * p * p * p);
183  theDeltaP += -dP;
184  theDeltaCov += sigp2;
185 
186  std::cout << "pion old " << theDeltaP << " " << theDeltaCov << std::endl;
187 }
T z() const
Definition: PV3DBase.h:61
T sqrt(T t)
Definition: SSEVec.h:23
T mag() const
Definition: PV3DBase.h:64
float xi() const

◆ oldComputeElectrons()

void oldComputeElectrons ( const LocalVector localP,
const MediumProperties materialConstants,
const PropagationDirection  propDir 
)

Definition at line 189 of file EnergyLossUpdator.cc.

References gather_cfg::cout, JetChargeProducer_cfi::exp, f, CrabHelper::log, PV3DBase< T, PVType, FrameType >::mag(), oppositeToMomentum, AlCaHLTBitMon_ParallelJobs::p, MediumProperties::radLen(), z, and PV3DBase< T, PVType, FrameType >::z().

191  {
192  double theDeltaP = 0., theDeltaCov = 0;
193 
194  //
195  // calculate absolute momentum and correction to path length from angle
196  // of incidence
197  //
198  double p = localP.mag();
199  double normalisedPath = fabs(p / localP.z()) * materialConstants.radLen();
200  //
201  // Energy loss and variance according to Bethe and Heitler, see also
202  // Comp. Phys. Comm. 79 (1994) 157.
203  //
204  double z = exp(-normalisedPath);
205  double varz = exp(-normalisedPath * log(3.) / log(2.)) - z * z;
206  // exp(-2*normalisedPath);
207 
208  if (propDir == oppositeToMomentum) {
209  //
210  // for backward propagation: delta(1/p) is linear in z=p_outside/p_inside
211  // convert to obtain equivalent delta(p). Sign of deltaP is corrected
212  // in method compute -> deltaP<0 at this place!!!
213  //
214  theDeltaP += -p * (1 / z - 1);
215  theDeltaCov += varz / (p * p);
216  } else {
217  //
218  // for forward propagation: calculate in p (linear in 1/z=p_inside/p_outside),
219  // then convert sig(p) to sig(1/p).
220  //
221  theDeltaP += p * (z - 1);
222  // double f = 1/p/z/z;
223  // patch to ensure consistency between for- and backward propagation
224  double f = 1. / (p * z);
225  theDeltaCov += f * f * varz;
226  }
227 
228  std::cout << "electron old " << theDeltaP << " " << theDeltaCov << std::endl;
229 }
T z() const
Definition: PV3DBase.h:61
float radLen() const
T mag() const
Definition: PV3DBase.h:64
double f[11][100]