CMS 3D CMS Logo

EnergyLossUpdator.cc
Go to the documentation of this file.
3 
6 
7 
8 
9 void
10 oldComputeBetheBloch (const LocalVector& localP,
11  const MediumProperties& materialConstants, double mass);
12 void
13 oldComputeElectrons (const LocalVector& localP,
14  const MediumProperties& materialConstants,
15  const PropagationDirection propDir);
16 
17 //
18 // Computation of contribution of energy loss to momentum and covariance
19 // matrix of local parameters based on Bethe-Bloch. For electrons
20 // contribution of radiation acc. to Bethe & Heitler.
21 //
23  const PropagationDirection propDir, Effect & effect) const
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 }
49 //
50 // Computation of energy loss according to Bethe-Bloch
51 //
52 void
54  const MediumProperties& materialConstants, Effect & effect) const {
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 }
98 //
99 // Computation of energy loss for electrons
100 //
101 void
103  const MediumProperties& materialConstants,
104  const PropagationDirection propDir, Effect & effect) const {
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 }
150 
151 
152 
153 
154 
155 
156 
158 
159 
160 void
162  const MediumProperties& materialConstants, double mass) {
163 
164  double theDeltaP=0., theDeltaCov=0;
165 
166  //
167  // calculate absolute momentum and correction to path length from angle
168  // of incidence
169  //
170  double p = localP.mag();
171  double xf = fabs(p/localP.z());
172  // constants
173  const double m = mass; // use mass hypothesis from constructor
174 
175  const double emass = 0.511e-3;
176  const double poti = 16.e-9 * 10.75; // = 16 eV * Z**0.9, for Si Z=14
177  const double eplasma = 28.816e-9 * sqrt(2.33*0.498); // 28.816 eV * sqrt(rho*(Z/A)) for Si
178  const double delta0 = 2*log(eplasma/poti) - 1.;
179 
180  // calculate general physics things
181  double e = sqrt(p*p + m*m);
182  double beta = p/e;
183  double gamma = e/m;
184  double eta2 = beta*gamma; eta2 *= eta2;
185  // double lnEta2 = log(eta2);
186  double ratio = emass/m;
187  double emax = 2.*emass*eta2/(1. + 2.*ratio*gamma + ratio*ratio);
188  // double delta = delta0 + lnEta2;
189 
190  // calculate the mean and sigma of energy loss
191  // xi = d[g/cm2] * 0.307075MeV/(g/cm2) * Z/A * 1/2
192  double xi = materialConstants.xi()*xf; xi /= (beta*beta);
193 
194 // double dEdx = xi*(log(2.*emass*eta2*emax/(poti*poti)) - 2.*(beta*beta));
195  //double dEdx = xi*(log(2.*emass*emax/(poti*poti))+lnEta2 - 2.*(beta*beta) - delta);
196 
197  double dEdx = xi*(log(2.*emass*emax/(poti*poti)) - 2.*(beta*beta) - delta0);
198  double dEdx2 = xi*emax*(1.-0.5*(beta*beta));
199  double dP = dEdx/beta;
200  double sigp2 = dEdx2*e*e/(p*p*p*p*p*p);
201  theDeltaP += -dP;
202  theDeltaCov += sigp2;
203 
204  std::cout << "pion old " << theDeltaP << " " << theDeltaCov << std::endl;
205 
206 }
207 
208 
209 void
211  const MediumProperties& materialConstants,
212  const PropagationDirection propDir) {
213 
214  double theDeltaP=0., theDeltaCov=0;
215 
216  //
217  // calculate absolute momentum and correction to path length from angle
218  // of incidence
219  //
220  double p = localP.mag();
221  double normalisedPath = fabs(p/localP.z())*materialConstants.radLen();
222  //
223  // Energy loss and variance according to Bethe and Heitler, see also
224  // Comp. Phys. Comm. 79 (1994) 157.
225  //
226  double z = exp(-normalisedPath);
227  double varz = exp(-normalisedPath*log(3.)/log(2.))-
228  z*z;
229  // exp(-2*normalisedPath);
230 
231  if ( propDir==oppositeToMomentum ) {
232  //
233  // for backward propagation: delta(1/p) is linear in z=p_outside/p_inside
234  // convert to obtain equivalent delta(p). Sign of deltaP is corrected
235  // in method compute -> deltaP<0 at this place!!!
236  //
237  theDeltaP += -p*(1/z-1);
238  theDeltaCov += varz/(p*p);
239  }
240  else {
241  //
242  // for forward propagation: calculate in p (linear in 1/z=p_inside/p_outside),
243  // then convert sig(p) to sig(1/p).
244  //
245  theDeltaP += p*(z-1);
246  // double f = 1/p/z/z;
247  // patch to ensure consistency between for- and backward propagation
248  double f = 1./(p*z);
249  theDeltaCov += f*f*varz;
250  }
251 
252  std::cout << "electron old " << theDeltaP << " " << theDeltaCov << std::endl;
253 
254 
255 }
void computeBetheBloch(const LocalVector &, const MediumProperties &, Effect &effect) const
T mag2() const
Definition: PV3DBase.h:66
float radLen() const
void oldComputeBetheBloch(const LocalVector &localP, const MediumProperties &materialConstants, double mass)
PropagationDirection
#define constexpr
LocalVector localMomentum() const
const SurfaceType & surface() const
T mag() const
Definition: PV3DBase.h:67
T sqrt(T t)
Definition: SSEVec.h:18
T z() const
Definition: PV3DBase.h:64
void computeElectrons(const LocalVector &, const MediumProperties &, const PropagationDirection, Effect &effect) const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double f[11][100]
double p2[4]
Definition: TauolaWrapper.h:90
void compute(const TrajectoryStateOnSurface &, const PropagationDirection, Effect &effect) const override
float xi() const
void oldComputeElectrons(const LocalVector &localP, const MediumProperties &materialConstants, const PropagationDirection propDir)
bool isValid() const
const MediumProperties & mediumProperties() const
Definition: Surface.h:112