CMS 3D CMS Logo

MultipleScatteringUpdator.cc
Go to the documentation of this file.
3 
5 
6 void oldMUcompute(const TrajectoryStateOnSurface& TSoS, const PropagationDirection propDir, double mass, double ptmin);
7 
8 //#define DBG_MSU
9 
10 //
11 // Computation of contribution of multiple scatterning to covariance matrix
12 // of local parameters based on Highland formula for sigma(alpha) in plane.
13 //
15  const PropagationDirection propDir,
16  Effect& effect) const {
17  //
18  // Get surface
19  //
20  const Surface& surface = TSoS.surface();
21  //
22  //
23  // Now get information on medium
24  //
25  const MediumProperties& mp = surface.mediumProperties();
26  if UNLIKELY (mp.radLen() == 0)
27  return;
28 
29  // Momentum vector
30  LocalVector d = TSoS.localMomentum();
31  float p2 = d.mag2();
32  d *= 1.f / sqrt(p2);
33  float xf = 1.f / std::abs(d.z()); // increase of path due to angle of incidence
34  // calculate general physics things
35  constexpr float amscon = 1.8496e-4; // (13.6MeV)**2
36  const float m2 = mass() * mass(); // use mass hypothesis from constructor
37  float e2 = p2 + m2;
38  float beta2 = p2 / e2;
39  // calculate the multiple scattering angle
40  float radLen = mp.radLen() * xf; // effective rad. length
41  float sigt2 = 0.; // sigma(alpha)**2
42 
43  // Calculated rms scattering angle squared.
44  float fact = 1.f + 0.038f * unsafe_logf<2>(radLen);
45  fact *= fact;
46  float a = fact / (beta2 * p2);
47  sigt2 = amscon * radLen * a;
48 
49  if (thePtMin > 0) {
50 #ifdef DBG_MSU
51  std::cout << "Original rms scattering = " << sqrt(sigt2);
52 #endif
53  // Inflate estimated rms scattering angle, to take into account
54  // that 1/p is not known precisely.
55  AlgebraicSymMatrix55 const& covMatrix = TSoS.localError().matrix();
56  float error2_QoverP = covMatrix(0, 0);
57  // Formula valid for ultra-relativistic particles.
58  // sigt2 *= (1. + p2 * error2_QoverP);
59  // Exact formula
60  sigt2 *= 1.f + error2_QoverP * (p2 + m2 * beta2 * (5.f + 3.f * p2 * error2_QoverP));
61 #ifdef DBG_MSU
62  std::cout << " new = " << sqrt(sigt2);
63 #endif
64  // Convert Pt constraint to P constraint, neglecting uncertainty in
65  // track angle.
66  float pMin2 = thePtMin * thePtMin * (p2 / TSoS.globalMomentum().perp2());
67  // Use P constraint to calculate rms maximum scattering angle.
68  float betaMin2 = pMin2 / (pMin2 + m2);
69  float a_max = fact / (betaMin2 * pMin2);
70  float sigt2_max = amscon * radLen * a_max;
71  if (sigt2 > sigt2_max)
72  sigt2 = sigt2_max;
73 #ifdef DBG_MSU
74  std::cout << " after P constraint (" << pMin << ") = " << sqrt(sigt2);
75  std::cout << " for track with 1/p=" << 1 / p << "+-" << sqrt(error2_QoverP) << std::endl;
76 #endif
77  }
78 
79  float isl2 = 1.f / d.perp2();
80  float cl2 = (d.z() * d.z());
81  float cf2 = (d.x() * d.x()) * isl2;
82  float sf2 = (d.y() * d.y()) * isl2;
83  // Create update (transformation of independant variations
84  // on angle in orthogonal planes to local parameters.
85  float den = 1.f / (cl2 * cl2);
86  using namespace materialEffect;
87  effect.deltaCov[msxx] += (den * sigt2) * (sf2 * cl2 + cf2);
88  effect.deltaCov[msxy] += (den * sigt2) * (d.x() * d.y());
89  effect.deltaCov[msyy] += (den * sigt2) * (cf2 * cl2 + sf2);
90 
91  /*
92  std::cout << "new " << theDeltaCov(1,1) << " " << theDeltaCov(1,2) << " " << theDeltaCov(2,2) << std::endl;
93  oldMUcompute(TSoS,propDir, mass(), thePtMin);
94  */
95 }
96 
97 //
98 // Computation of contribution of multiple scatterning to covariance matrix
99 // of local parameters based on Highland formula for sigma(alpha) in plane.
100 //
101 void oldMUcompute(const TrajectoryStateOnSurface& TSoS, const PropagationDirection propDir, float mass, float thePtMin) {
102  //
103  // Get surface
104  //
105  const Surface& surface = TSoS.surface();
106  //
107  //
108  // Now get information on medium
109  //
110  if (surface.mediumProperties().isValid()) {
111  // Momentum vector
112  LocalVector d = TSoS.localMomentum();
113  float p = d.mag();
114  d *= 1. / p;
115  // MediumProperties mp(0.02, .5e-4);
116  const MediumProperties& mp = surface.mediumProperties();
117  float xf = 1. / fabs(d.z()); // increase of path due to angle of incidence
118  // calculate general physics things
119  const float amscon = 1.8496e-4; // (13.6MeV)**2
120  const float m = mass; // use mass hypothesis from constructor
121  float e = sqrt(p * p + m * m);
122  float beta = p / e;
123  // calculate the multiple scattering angle
124  float radLen = mp.radLen() * xf; // effective rad. length
125  float sigt2 = 0.; // sigma(alpha)**2
126  if (radLen > 0) {
127  // Calculated rms scattering angle squared.
128  float a = (1. + 0.038 * log(radLen)) / (beta * p);
129  a *= a;
130  sigt2 = amscon * radLen * a;
131  if (thePtMin > 0) {
132 #ifdef DBG_MSU
133  std::cout << "Original rms scattering = " << sqrt(sigt2);
134 #endif
135  // Inflate estimated rms scattering angle, to take into account
136  // that 1/p is not known precisely.
137  AlgebraicSymMatrix55 covMatrix = TSoS.localError().matrix();
138  float error2_QoverP = covMatrix(0, 0);
139  // Formula valid for ultra-relativistic particles.
140  // sigt2 *= (1. + (p*p) * error2_QoverP);
141  // Exact formula
142  sigt2 *= (1. + (p * p) * error2_QoverP * (1. + 5 * m * m / (e * e) + 3 * m * m * beta * beta * error2_QoverP));
143 #ifdef DBG_MSU
144  std::cout << " new = " << sqrt(sigt2);
145 #endif
146  // Convert Pt constraint to P constraint, neglecting uncertainty in
147  // track angle.
148  float pMin = thePtMin * (TSoS.globalMomentum().mag() / TSoS.globalMomentum().perp());
149  // Use P constraint to calculate rms maximum scattering angle.
150  float betaMin = pMin / sqrt(pMin * pMin + m * m);
151  float a_max = (1. + 0.038 * log(radLen)) / (betaMin * pMin);
152  a_max *= a_max;
153  float sigt2_max = amscon * radLen * a_max;
154  if (sigt2 > sigt2_max)
155  sigt2 = sigt2_max;
156 #ifdef DBG_MSU
157  std::cout << " after P constraint (" << pMin << ") = " << sqrt(sigt2);
158  std::cout << " for track with 1/p=" << 1 / p << "+-" << sqrt(error2_QoverP) << std::endl;
159 #endif
160  }
161  }
162  float sl = d.perp();
163  float cl = d.z();
164  float cf = d.x() / sl;
165  float sf = d.y() / sl;
166  // Create update (transformation of independant variations
167  // on angle in orthogonal planes to local parameters.
168  std::cout << "old " << sigt2 * (sf * sf * cl * cl + cf * cf) / (cl * cl * cl * cl) << " "
169  << sigt2 * (cf * sf * sl * sl) / (cl * cl * cl * cl) << " "
170  << sigt2 * (cf * cf * cl * cl + sf * sf) / (cl * cl * cl * cl) << std::endl;
171  }
172 }
T perp() const
Definition: PV3DBase.h:69
const LocalTrajectoryError & localError() const
PropagationDirection
const SurfaceType & surface() const
T sqrt(T t)
Definition: SSEVec.h:19
float radLen() const
T mag() const
Definition: PV3DBase.h:64
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
d
Definition: ztail.py:151
void compute(const TrajectoryStateOnSurface &, const PropagationDirection, Effect &effect) const override
const double fact
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
GlobalVector globalMomentum() const
T perp2() const
Definition: PV3DBase.h:68
double ptmin
Definition: HydjetWrapper.h:86
void oldMUcompute(const TrajectoryStateOnSurface &TSoS, const PropagationDirection propDir, double mass, double ptmin)
double a
Definition: hdecay.h:121
const AlgebraicSymMatrix55 & matrix() const
const MediumProperties & mediumProperties() const
Definition: Surface.h:83
#define UNLIKELY(x)
Definition: Likely.h:21
bool isValid() const