CMS 3D CMS Logo

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