CMS 3D CMS Logo

FastHelix.cc
Go to the documentation of this file.
3 
5  if (isValid() && (std::abs(tesla0) > 1e-3) && theCircle.rho() < maxRho)
7  else
9 }
10 
12  // given the above rho>0.
13  double rho = theCircle.rho();
14  //remember (radius rho in cm):
15  //rho =
16  //100. * pt *
17  //(10./(3.*MagneticField::inTesla(GlobalPoint(0., 0., 0.)).z()));
18 
19  // pt = 0.01 * rho * (0.3*MagneticField::inTesla(GlobalPoint(0.,0.,0.)).z());
20  double cm2GeV = 0.01 * 0.3 * tesla0;
21  double pt = cm2GeV * rho;
22 
23  // verify that rho is not toooo large
24  double dcphi = ((outerHit().x() - theCircle.x0()) * (middleHit().x() - theCircle.x0()) +
25  (outerHit().y() - theCircle.y0()) * (middleHit().y() - theCircle.y0())) /
26  (rho * rho);
27  if (std::abs(dcphi) >= 1.f) {
29  return;
30  }
31 
32  GlobalPoint pMid(middleHit());
33  GlobalPoint v(vertex());
34 
35  // tangent in v (or the opposite...)
36  double px = -cm2GeV * (v.y() - theCircle.y0());
37  double py = cm2GeV * (v.x() - theCircle.x0());
38  // check sign with scalar product
39  if (px * (pMid.x() - v.x()) + py * (pMid.y() - v.y()) < 0.) {
40  px = -px;
41  py = -py;
42  }
43 
44  //calculate z0, pz
45  //(z, R*phi) linear relation in a helix
46  //with R, phi defined as radius and angle w.r.t. centre of circle
47  //in transverse plane
48  //pz = pT*(dz/d(R*phi)))
49 
50  // VI 23/01/2012
51  double dzdrphi = outerHit().z() - middleHit().z();
52  dzdrphi /= rho * acos(dcphi);
53  double pz = pt * dzdrphi;
54 
55  TrackCharge q = 1;
56  if (theCircle.x0() * py - theCircle.y0() * px < 0)
57  q = -q;
58  if (tesla0 < 0.)
59  q = -q;
60 
61  //VI
62  if (useBasisVertex) {
64  } else {
65  double z_0 = middleHit().z();
66  // assume v is before middleHit (opposite to outer)
67  double ds = ((v.x() - theCircle.x0()) * (middleHit().x() - theCircle.x0()) +
68  (v.y() - theCircle.y0()) * (middleHit().y() - theCircle.y0())) /
69  (rho * rho);
70  if (std::abs(ds) < 1.f) {
71  ds = rho * acos(ds);
72  z_0 -= ds * dzdrphi;
73  } else { // line????
74  z_0 -= std::sqrt((middleHit() - v).perp2() / (outerHit() - middleHit()).perp2()) *
75  (outerHit().z() - middleHit().z());
76  }
77 
78  //double z_old = -flfit.c()/flfit.n2();
79  // std::cout << "v:xyz, z,old,new " << v << " " << z_old << " " << z_0 << std::endl;
80 
82  }
83 }
84 
86  //calculate GlobalTrajectoryParameters assuming straight line...
87 
88  GlobalPoint pMid(middleHit());
89  GlobalPoint v(vertex());
90 
91  double dydx = 0.;
92  double pt = 0., px = 0., py = 0.;
93 
94  if (fabs(theCircle.n1()) > 0. || fabs(theCircle.n2()) > 0.)
95  pt = maxPt; // 10 TeV //else no pt
96  if (fabs(theCircle.n2()) > 0.) {
97  dydx = -theCircle.n1() / theCircle.n2(); //else px = 0
98  }
99  px = pt / sqrt(1. + dydx * dydx);
100  py = px * dydx;
101  // check sign with scalar product
102  if (px * (pMid.x() - v.x()) + py * (pMid.y() - v.y()) < 0.) {
103  px *= -1.;
104  py *= -1.;
105  }
106 
107  //calculate z_0 and pz at vertex using weighted mean
108  //z = z(r) = z0 + (dz/dr)*r
109  //tan(theta) = dr/dz = (dz/dr)^-1
110  //theta = atan(1./dzdr)
111  //p = pt/sin(theta)
112  //pz = p*cos(theta) = pt/tan(theta)
113 
114  FastLine flfit(outerHit(), middleHit());
115  double dzdr = -flfit.n1() / flfit.n2();
116  double pz = pt * dzdr;
117 
118  TrackCharge q = 1;
119  //VI
120 
121  if (useBasisVertex) {
123  } else {
124  double z_0 = -flfit.c() / flfit.n2();
126  }
127 }
float tesla0
Definition: FastHelix.h:79
T z() const
Definition: PV3DBase.h:61
MagneticField const * bField
Definition: FastHelix.h:75
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
GlobalPoint basisVertex
Definition: FastHelix.h:77
bool isValid() const
Definition: FastHelix.h:57
void straightLineStateAtVertex()
Definition: FastHelix.cc:85
static constexpr float maxPt
Definition: FastHelix.h:73
FastCircle theCircle
Definition: FastHelix.h:78
GlobalPoint const & outerHit() const
Definition: FastHelix.h:64
T perp2() const
Squared magnitude of transverse component.
int TrackCharge
Definition: TrackCharge.h:4
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
T sqrt(T t)
Definition: SSEVec.h:23
double n2() const
Definition: FastCircle.h:57
void helixStateAtVertex()
Definition: FastHelix.cc:11
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double c() const
Definition: FastLine.h:27
GlobalPoint const & vertex() const
Definition: FastHelix.h:66
GlobalTrajectoryParameters atVertex
Definition: FastHelix.h:76
double y0() const
Definition: FastCircle.h:45
double n2() const
Definition: FastLine.h:25
GlobalPoint const & middleHit() const
Definition: FastHelix.h:65
double n1() const
Definition: FastCircle.h:55
double rho() const
Definition: FastCircle.h:47
void compute()
Definition: FastHelix.cc:4
float maxRho
Definition: FastHelix.h:80
bool useBasisVertex
Definition: FastHelix.h:81
double x0() const
Definition: FastCircle.h:43
Global3DVector GlobalVector
Definition: GlobalVector.h:10
double n1() const
Definition: FastLine.h:23