CMS 3D CMS Logo

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