CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Types | Private Attributes | Static Private Attributes
FastHelix Class Reference

#include <FastHelix.h>

Public Member Functions

const FastCirclecircle () const
 
 FastHelix (const GlobalPoint &outerHit, const GlobalPoint &middleHit, const GlobalPoint &aVertex, const edm::EventSetup &iSetup)
 
 FastHelix (const GlobalPoint &outerHit, const GlobalPoint &middleHit, const GlobalPoint &aVertex, const edm::EventSetup &iSetup, const GlobalPoint &bVertex)
 
FTS helixStateAtVertex () const
 
bool isValid () const
 
FTS stateAtVertex () const
 
FTS straightLineStateAtVertex () const
 
 ~FastHelix ()
 

Private Types

typedef FreeTrajectoryState FTS
 

Private Attributes

GlobalPoint basisVertex
 
double maxRho
 
edm::ESHandle< MagneticFieldpSetup
 
double tesla0
 
FastCircle theCircle
 
GlobalPoint theMiddleHit
 
GlobalPoint theOuterHit
 
GlobalPoint theVertex
 
bool useBasisVertex
 

Static Private Attributes

static constexpr double maxPt = 10000
 

Detailed Description

Generation of track parameters at a vertex using two hits and a vertex. It is used e.g. by a seed generator.

24.01.2012: introduced Maxpt cut. changed algo of "FastLine" to use vertex 21.02.2001: Old FastHelix is now called FastHelixFit. Replace FastLineFit by FastLine (z0, dz/drphi calculated without vertex and errors) 14.02.2001: Replace general Circle by FastCircle. 13.02.2001: LinearFitErrorsInTwoCoordinates replaced by FastLineFit 29.11.2000: (Pascal Vanlaer) Modification of calculation of sign of px,py and change in calculation of pz, z0. 29.11.2000: (Matthias Winkler) Split stateAtVertex() in two parts (Circle is valid or not): helixStateAtVertex() and straightLineStateAtVertex()

Definition at line 28 of file FastHelix.h.

Member Typedef Documentation

Definition at line 32 of file FastHelix.h.

Constructor & Destructor Documentation

FastHelix::FastHelix ( const GlobalPoint outerHit,
const GlobalPoint middleHit,
const GlobalPoint aVertex,
const edm::EventSetup iSetup 
)
inline

Definition at line 38 of file FastHelix.h.

References edm::EventSetup::get(), maxPt, maxRho, pSetup, tesla0, and useBasisVertex.

41  : theOuterHit(outerHit),
42  theMiddleHit(middleHit),
43  theVertex(aVertex),
44  theCircle(outerHit,
45  middleHit,
46  aVertex) {
47  iSetup.get<IdealMagneticFieldRecord>().get(pSetup);
48  tesla0=0.1*double(pSetup->nominalValue());
49  maxRho = maxPt/(0.01 * 0.3*tesla0);
50  useBasisVertex = false;
51  }
GlobalPoint theMiddleHit
Definition: FastHelix.h:88
GlobalPoint theVertex
Definition: FastHelix.h:89
GlobalPoint theOuterHit
Definition: FastHelix.h:87
FastCircle theCircle
Definition: FastHelix.h:91
const T & get() const
Definition: EventSetup.h:55
double maxRho
Definition: FastHelix.h:94
static constexpr double maxPt
Definition: FastHelix.h:85
edm::ESHandle< MagneticField > pSetup
Definition: FastHelix.h:92
bool useBasisVertex
Definition: FastHelix.h:95
double tesla0
Definition: FastHelix.h:93
FastHelix::FastHelix ( const GlobalPoint outerHit,
const GlobalPoint middleHit,
const GlobalPoint aVertex,
const edm::EventSetup iSetup,
const GlobalPoint bVertex 
)
inline

Definition at line 54 of file FastHelix.h.

References edm::EventSetup::get(), maxPt, maxRho, pSetup, tesla0, and useBasisVertex.

58  : theOuterHit(outerHit),
59  theMiddleHit(middleHit),
60  theVertex(aVertex),
61  basisVertex(bVertex),
62  theCircle(outerHit,
63  middleHit,
64  aVertex) {
65  iSetup.get<IdealMagneticFieldRecord>().get(pSetup);
66  tesla0=0.1*double(pSetup->nominalValue());
67  maxRho = maxPt/(0.01 * 0.3*tesla0);
68  useBasisVertex = true;
69  }
GlobalPoint theMiddleHit
Definition: FastHelix.h:88
GlobalPoint theVertex
Definition: FastHelix.h:89
GlobalPoint basisVertex
Definition: FastHelix.h:90
GlobalPoint theOuterHit
Definition: FastHelix.h:87
FastCircle theCircle
Definition: FastHelix.h:91
const T & get() const
Definition: EventSetup.h:55
double maxRho
Definition: FastHelix.h:94
static constexpr double maxPt
Definition: FastHelix.h:85
edm::ESHandle< MagneticField > pSetup
Definition: FastHelix.h:92
bool useBasisVertex
Definition: FastHelix.h:95
double tesla0
Definition: FastHelix.h:93
FastHelix::~FastHelix ( )
inline

Definition at line 71 of file FastHelix.h.

71 {}

Member Function Documentation

const FastCircle& FastHelix::circle ( ) const
inline

Definition at line 81 of file FastHelix.h.

References theCircle.

Referenced by PixelClusterShapeSeedComparitor::compatible().

81 { return theCircle; }
FastCircle theCircle
Definition: FastHelix.h:91
FreeTrajectoryState FastHelix::helixStateAtVertex ( ) const

Definition at line 16 of file FastHelix.cc.

References basisVertex, FastCircle::n1(), FastCircle::n2(), perp2(), pSetup, lumiQueryAPI::q, rho, FastCircle::rho(), mathSSE::sqrt(), straightLineStateAtVertex(), tesla0, theCircle, theMiddleHit, theOuterHit, theVertex, useBasisVertex, v, PV3DBase< T, PVType, FrameType >::x(), FastCircle::x0(), PV3DBase< T, PVType, FrameType >::y(), FastCircle::y0(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by stateAtVertex().

16  {
17 
18  // given the above rho>0.
19  double rho = theCircle.rho();
20  //remember (radius rho in cm):
21  //rho =
22  //100. * pt *
23  //(10./(3.*MagneticField::inTesla(GlobalPoint(0., 0., 0.)).z()));
24 
25  // pt = 0.01 * rho * (0.3*MagneticField::inTesla(GlobalPoint(0.,0.,0.)).z());
26  double pt = 0.01 * rho * 0.3*tesla0;
27 
28  // verify that rho is not toooo large
29  double dcphi = ((theOuterHit.x()-theCircle.x0())*(theMiddleHit.x()-theCircle.x0()) +
31  )/(rho*rho);
32  if (fabs(dcphi)>=1.) return straightLineStateAtVertex();
33 
36 
37  double dydx = 0., dxdy = 0.;
38  double px = 0., py = 0.;
39 
40 
41  // (py/px)|x=v.x() = (dy/dx)|x=v.x()
42  //remember:
43  //y(x) = +-sqrt(rho^2 - (x-x0)^2) + y0
44  //y(x) = sqrt(rho^2 - (x-x0)^2) + y0 if y(x) >= y0
45  //y(x) = -sqrt(rho^2 - (x-x0)^2) + y0 if y(x) < y0
46  //=> (dy/dx) = -(x-x0)/sqrt(Q) if y(x) >= y0
47  // (dy/dx) = (x-x0)/sqrt(Q) if y(x) < y0
48  //with Q = rho^2 - (x-x0)^2
49  // Check approximate slope to determine whether to use dydx or dxdy
50  // Choose the one that goes to 0 rather than infinity.
51  double arg1 = rho*rho - (v.x()-theCircle.x0())*(v.x()-theCircle.x0());
52  double arg2 = rho*rho - (v.y()-theCircle.y0())*(v.y()-theCircle.y0());
53  if (arg1<0.0 && arg2<0.0) {
54  if(fabs(theCircle.n2()) > 0.) {
55  dydx = -theCircle.n1()/theCircle.n2(); //else px = 0
56  px = pt/sqrt(1. + dydx*dydx);
57  py = px*dydx;
58  } else {
59  px = 0.;
60  py = pt;
61  }
62  } else if ( arg1>arg2 ) {
63  if( v.y() > theCircle.y0() )
64  dydx = -(v.x() - theCircle.x0()) / sqrt(arg1);
65  else
66  dydx = (v.x() - theCircle.x0()) / sqrt(arg1);
67  px = pt/sqrt(1. + dydx*dydx);
68  py = px*dydx;
69  } else {
70  if( v.x() > theCircle.x0() )
71  dxdy = -(v.y() - theCircle.y0()) / sqrt(arg2);
72  else
73  dxdy = (v.y() - theCircle.y0()) / sqrt(arg2);
74  py = pt/sqrt(1. + dxdy*dxdy);
75  px = py*dxdy;
76  }
77  // check sign with scalar product
78  if(px*(pMid.x() - v.x()) + py*(pMid.y() - v.y()) < 0.) {
79  px *= -1.;
80  py *= -1.;
81  }
82 
83  //calculate z0, pz
84  //(z, R*phi) linear relation in a helix
85  //with R, phi defined as radius and angle w.r.t. centre of circle
86  //in transverse plane
87  //pz = pT*(dz/d(R*phi)))
88 
89 
90  // VI 23/01/2012
91  double dzdrphi = theOuterHit.z() - theMiddleHit.z();
92  dzdrphi /= rho*acos(dcphi);
93  double pz = pt*dzdrphi;
94 
95  /*
96  // old crap
97  FastLine flfit(theOuterHit, theMiddleHit, theCircle.rho());
98  double dzdrphi2 = -flfit.n1()/flfit.n2();
99 
100  // if (fabs(dzdrphi2-dzdrphi)>1.e-5)
101  std::cout << "FastHelix: old,new " << dzdrphi2 <<", " << dzdrphi << std::endl;
102  */
103 
104  //get sign of particle
105 
106  /*
107  TrackCharge q =
108  ((theCircle.x0()*py - theCircle.y0()*px) /
109  (magvtx.z()) < 0.) ?
110  -1 : 1;
111  */
112  TrackCharge q = 1;
113  if (theCircle.x0()*py - theCircle.y0()*px < 0) q =-q;
114  if (tesla0 < 0.) q =-q;
115 
116  //VI
117  if ( useBasisVertex ) {
118  return FTS(basisVertex,
119  GlobalVector(px, py, pz),
120  q,
121  &(*pSetup)
122  );
123  } else {
124  double z_0 = theMiddleHit.z();
125  // assume v is before middleHit (opposite to outer)
126  double ds = ( (v.x()-theCircle.x0())*(theMiddleHit.x()-theCircle.x0()) +
127  (v.y()-theCircle.y0())*(theMiddleHit.y()-theCircle.y0())
128  )/(rho*rho);
129  if (fabs(ds)<1.) {
130  ds = rho*acos(ds);
131  z_0 -= ds*dzdrphi;
132  } else { // line????
134  }
135 
136  //double z_old = -flfit.c()/flfit.n2();
137  // std::cout << "v:xyz, z,old,new " << v << " " << z_old << " " << z_0 << std::endl;
138 
139  return FTS(GlobalPoint(v.x(),v.y(),z_0),
140  GlobalVector(px, py, pz),
141  q,
142  &(*pSetup)
143  );
144  }
145 
146 }
GlobalPoint theMiddleHit
Definition: FastHelix.h:88
GlobalPoint theVertex
Definition: FastHelix.h:89
double x0() const
Definition: FastCircle.h:50
Definition: DDAxes.h:10
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
GlobalPoint basisVertex
Definition: FastHelix.h:90
T y() const
Definition: PV3DBase.h:62
GlobalPoint theOuterHit
Definition: FastHelix.h:87
double n2() const
Definition: FastCircle.h:62
double rho() const
Definition: FastCircle.h:54
FastCircle theCircle
Definition: FastHelix.h:91
int TrackCharge
Definition: TrackCharge.h:4
double n1() const
Definition: FastCircle.h:60
T sqrt(T t)
Definition: SSEVec.h:46
T z() const
Definition: PV3DBase.h:63
T perp2() const
Squared magnitude of transverse component.
FreeTrajectoryState FTS
Definition: FastHelix.h:32
double y0() const
Definition: FastCircle.h:52
T x() const
Definition: PV3DBase.h:61
edm::ESHandle< MagneticField > pSetup
Definition: FastHelix.h:92
mathSSE::Vec4< T > v
bool useBasisVertex
Definition: FastHelix.h:95
Global3DVector GlobalVector
Definition: GlobalVector.h:10
double tesla0
Definition: FastHelix.h:93
FTS straightLineStateAtVertex() const
Definition: FastHelix.cc:148
bool FastHelix::isValid ( void  ) const
inline
FreeTrajectoryState FastHelix::stateAtVertex ( ) const
FreeTrajectoryState FastHelix::straightLineStateAtVertex ( ) const

Definition at line 148 of file FastHelix.cc.

References basisVertex, FastLine::c(), maxPt, FastLine::n1(), FastCircle::n1(), FastLine::n2(), FastCircle::n2(), pSetup, lumiQueryAPI::q, mathSSE::sqrt(), theCircle, theMiddleHit, theOuterHit, theVertex, useBasisVertex, v, PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().

Referenced by helixStateAtVertex(), and stateAtVertex().

148  {
149 
150  //calculate FTS assuming straight line...
151 
154 
155  double dydx = 0.;
156  double pt = 0., px = 0., py = 0.;
157 
158  if(fabs(theCircle.n1()) > 0. || fabs(theCircle.n2()) > 0.)
159  pt = maxPt ;// 10 TeV //else no pt
160  if(fabs(theCircle.n2()) > 0.) {
161  dydx = -theCircle.n1()/theCircle.n2(); //else px = 0
162  }
163  px = pt/sqrt(1. + dydx*dydx);
164  py = px*dydx;
165  // check sign with scalar product
166  if (px*(pMid.x() - v.x()) + py*(pMid.y() - v.y()) < 0.) {
167  px *= -1.;
168  py *= -1.;
169  }
170 
171  //calculate z_0 and pz at vertex using weighted mean
172  //z = z(r) = z0 + (dz/dr)*r
173  //tan(theta) = dr/dz = (dz/dr)^-1
174  //theta = atan(1./dzdr)
175  //p = pt/sin(theta)
176  //pz = p*cos(theta) = pt/tan(theta)
177 
179  double dzdr = -flfit.n1()/flfit.n2();
180  double pz = pt*dzdr;
181 
182  TrackCharge q = 1;
183  //VI
184 
185  if ( useBasisVertex ) {
186  return FTS(basisVertex,
187  GlobalVector(px, py, pz),
188  q,
189  &(*pSetup)
190  );
191  } else {
192  double z_0 = -flfit.c()/flfit.n2();
193  return FTS(GlobalPoint(v.x(), v.y(), z_0),
194  GlobalVector(px, py, pz),
195  q,
196  &(*pSetup)
197  );
198  }
199 }
GlobalPoint theMiddleHit
Definition: FastHelix.h:88
GlobalPoint theVertex
Definition: FastHelix.h:89
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
GlobalPoint basisVertex
Definition: FastHelix.h:90
GlobalPoint theOuterHit
Definition: FastHelix.h:87
double n2() const
Definition: FastCircle.h:62
FastCircle theCircle
Definition: FastHelix.h:91
int TrackCharge
Definition: TrackCharge.h:4
double n1() const
Definition: FastCircle.h:60
T sqrt(T t)
Definition: SSEVec.h:46
FreeTrajectoryState FTS
Definition: FastHelix.h:32
static constexpr double maxPt
Definition: FastHelix.h:85
edm::ESHandle< MagneticField > pSetup
Definition: FastHelix.h:92
mathSSE::Vec4< T > v
bool useBasisVertex
Definition: FastHelix.h:95
Global3DVector GlobalVector
Definition: GlobalVector.h:10

Member Data Documentation

GlobalPoint FastHelix::basisVertex
private

Definition at line 90 of file FastHelix.h.

Referenced by helixStateAtVertex(), and straightLineStateAtVertex().

constexpr double FastHelix::maxPt = 10000
staticprivate

Definition at line 85 of file FastHelix.h.

Referenced by FastHelix(), and straightLineStateAtVertex().

double FastHelix::maxRho
private

Definition at line 94 of file FastHelix.h.

Referenced by FastHelix(), and stateAtVertex().

edm::ESHandle<MagneticField> FastHelix::pSetup
private

Definition at line 92 of file FastHelix.h.

Referenced by FastHelix(), helixStateAtVertex(), and straightLineStateAtVertex().

double FastHelix::tesla0
private

Definition at line 93 of file FastHelix.h.

Referenced by FastHelix(), helixStateAtVertex(), and stateAtVertex().

FastCircle FastHelix::theCircle
private
GlobalPoint FastHelix::theMiddleHit
private

Definition at line 88 of file FastHelix.h.

Referenced by helixStateAtVertex(), and straightLineStateAtVertex().

GlobalPoint FastHelix::theOuterHit
private

Definition at line 87 of file FastHelix.h.

Referenced by helixStateAtVertex(), and straightLineStateAtVertex().

GlobalPoint FastHelix::theVertex
private

Definition at line 89 of file FastHelix.h.

Referenced by helixStateAtVertex(), and straightLineStateAtVertex().

bool FastHelix::useBasisVertex
private

Definition at line 95 of file FastHelix.h.

Referenced by FastHelix(), helixStateAtVertex(), and straightLineStateAtVertex().