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
FastHelix Class Reference

#include <FastHelix.h>

Public Member Functions

 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
 
edm::ESHandle< MagneticFieldpSetup
 
GlobalVector tesla0
 
FastCircle theCircle
 
GlobalPoint theMiddleHit
 
GlobalPoint theOuterHit
 
GlobalPoint theVertex
 
bool useBasisVertex
 

Detailed Description

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

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 27 of file FastHelix.h.

Member Typedef Documentation

Definition at line 31 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 37 of file FastHelix.h.

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

40  : theOuterHit(outerHit),
41  theMiddleHit(middleHit),
42  theVertex(aVertex),
43  theCircle(outerHit,
44  middleHit,
45  aVertex) {
46  iSetup.get<IdealMagneticFieldRecord>().get(pSetup);
47  tesla0=pSetup->inTesla(GlobalPoint(0,0,0));
48  useBasisVertex = false;
49  }
GlobalPoint theMiddleHit
Definition: FastHelix.h:81
GlobalPoint theVertex
Definition: FastHelix.h:82
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
GlobalPoint theOuterHit
Definition: FastHelix.h:80
FastCircle theCircle
Definition: FastHelix.h:84
const T & get() const
Definition: EventSetup.h:55
edm::ESHandle< MagneticField > pSetup
Definition: FastHelix.h:85
bool useBasisVertex
Definition: FastHelix.h:87
GlobalVector tesla0
Definition: FastHelix.h:86
FastHelix::FastHelix ( const GlobalPoint outerHit,
const GlobalPoint middleHit,
const GlobalPoint aVertex,
const edm::EventSetup iSetup,
const GlobalPoint bVertex 
)
inline

Definition at line 52 of file FastHelix.h.

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

56  : theOuterHit(outerHit),
57  theMiddleHit(middleHit),
58  theVertex(aVertex),
59  basisVertex(bVertex),
60  theCircle(outerHit,
61  middleHit,
62  aVertex) {
63  iSetup.get<IdealMagneticFieldRecord>().get(pSetup);
64  tesla0=pSetup->inTesla(GlobalPoint(0,0,0));
65  useBasisVertex = true;
66  }
GlobalPoint theMiddleHit
Definition: FastHelix.h:81
GlobalPoint theVertex
Definition: FastHelix.h:82
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
GlobalPoint basisVertex
Definition: FastHelix.h:83
GlobalPoint theOuterHit
Definition: FastHelix.h:80
FastCircle theCircle
Definition: FastHelix.h:84
const T & get() const
Definition: EventSetup.h:55
edm::ESHandle< MagneticField > pSetup
Definition: FastHelix.h:85
bool useBasisVertex
Definition: FastHelix.h:87
GlobalVector tesla0
Definition: FastHelix.h:86
FastHelix::~FastHelix ( )
inline

Definition at line 68 of file FastHelix.h.

68 {}

Member Function Documentation

FreeTrajectoryState FastHelix::helixStateAtVertex ( ) const

Definition at line 16 of file FastHelix.cc.

References basisVertex, funct::C, FastLine::n1(), FastCircle::n1(), FastCircle::n2(), pSetup, lumiQueryAPI::q, rho, FastCircle::rho(), mathSSE::sqrt(), 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 
20 
21  double dydx = 0., dxdy = 0.;
22  double pt = 0., px = 0., py = 0.;
23 
24  //remember (radius rho in cm):
25  //rho =
26  //100. * pt *
27  //(10./(3.*MagneticField::inTesla(GlobalPoint(0., 0., 0.)).z()));
28 
29  double rho = theCircle.rho();
30  // pt = 0.01 * rho * (0.3*MagneticField::inTesla(GlobalPoint(0.,0.,0.)).z());
31  pt = 0.01 * rho * (0.3*tesla0.z());
32  // pt = 0.01 * rho * (0.3*GlobalPoint(0.,0.,0.).MagneticField().z());
33 
34  // (py/px)|x=v.x() = (dy/dx)|x=v.x()
35  //remember:
36  //y(x) = +-sqrt(rho^2 - (x-x0)^2) + y0
37  //y(x) = sqrt(rho^2 - (x-x0)^2) + y0 if y(x) >= y0
38  //y(x) = -sqrt(rho^2 - (x-x0)^2) + y0 if y(x) < y0
39  //=> (dy/dx) = -(x-x0)/sqrt(Q) if y(x) >= y0
40  // (dy/dx) = (x-x0)/sqrt(Q) if y(x) < y0
41  //with Q = rho^2 - (x-x0)^2
42  // Check approximate slope to determine whether to use dydx or dxdy
43  // Choose the one that goes to 0 rather than infinity.
44  double arg1 = rho*rho - (v.x()-theCircle.x0())*(v.x()-theCircle.x0());
45  double arg2 = rho*rho - (v.y()-theCircle.y0())*(v.y()-theCircle.y0());
46  if (arg1<0.0 && arg2<0.0) {
47  if(fabs(theCircle.n2()) > 0.) {
48  dydx = -theCircle.n1()/theCircle.n2(); //else px = 0
49  px = pt/sqrt(1. + dydx*dydx);
50  py = px*dydx;
51  } else {
52  px = 0.;
53  py = pt;
54  }
55  } else if ( arg1>arg2 ) {
56  if( v.y() > theCircle.y0() )
57  dydx = -(v.x() - theCircle.x0()) / sqrt(arg1);
58  else
59  dydx = (v.x() - theCircle.x0()) / sqrt(arg1);
60  px = pt/sqrt(1. + dydx*dydx);
61  py = px*dydx;
62  } else {
63  if( v.x() > theCircle.x0() )
64  dxdy = -(v.y() - theCircle.y0()) / sqrt(arg2);
65  else
66  dxdy = (v.y() - theCircle.y0()) / sqrt(arg2);
67  py = pt/sqrt(1. + dxdy*dxdy);
68  px = py*dxdy;
69  }
70  // check sign with scalar product
71  if(px*(pMid.x() - v.x()) + py*(pMid.y() - v.y()) < 0.) {
72  px *= -1.;
73  py *= -1.;
74  }
75 
76  //calculate z0, pz
77  //(z, R*phi) linear relation in a helix
78  //with R, phi defined as radius and angle w.r.t. centre of circle
79  //in transverse plane
80  //pz = pT*(dz/d(R*phi)))
81 
83  double dzdrphi = -flfit.n1()/flfit.n2();
84  double pz = pt*dzdrphi;
85  //get sign of particle
86 
87  GlobalVector magvtx=pSetup->inTesla(v);
88  TrackCharge q =
89  ((theCircle.x0()*py - theCircle.y0()*px) /
90  (magvtx.z()) < 0.) ?
91  -1 : 1;
92 
93  AlgebraicSymMatrix C(5,1);
94  //MP
95 
96  if ( useBasisVertex ) {
98  GlobalVector(px, py, pz),
99  q,
100  &(*pSetup)),
102  } else {
103  double z_0 = -flfit.c()/flfit.n2();
104  return FTS(GlobalTrajectoryParameters(GlobalPoint(v.x(),v.y(),z_0),
105  GlobalVector(px, py, pz),
106  q,
107  &(*pSetup)),
109  }
110 
111 }
GlobalPoint theMiddleHit
Definition: FastHelix.h:81
GlobalPoint theVertex
Definition: FastHelix.h:82
double x0() const
Definition: FastCircle.h:50
Definition: DDAxes.h:10
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
GlobalPoint basisVertex
Definition: FastHelix.h:83
GlobalPoint theOuterHit
Definition: FastHelix.h:80
double n2() const
Definition: FastCircle.h:62
double rho() const
Definition: FastCircle.h:54
FastCircle theCircle
Definition: FastHelix.h:84
int TrackCharge
Definition: TrackCharge.h:4
double n1() const
Definition: FastCircle.h:60
T sqrt(T t)
Definition: SSEVec.h:28
T z() const
Definition: PV3DBase.h:58
double n1() const
Definition: FastLine.h:28
FreeTrajectoryState FTS
Definition: FastHelix.h:31
double y0() const
Definition: FastCircle.h:52
CLHEP::HepSymMatrix AlgebraicSymMatrix
edm::ESHandle< MagneticField > pSetup
Definition: FastHelix.h:85
mathSSE::Vec4< T > v
bool useBasisVertex
Definition: FastHelix.h:87
GlobalVector tesla0
Definition: FastHelix.h:86
Global3DVector GlobalVector
Definition: GlobalVector.h:10
bool FastHelix::isValid ( void  ) const
inline
FreeTrajectoryState FastHelix::stateAtVertex ( ) const
FreeTrajectoryState FastHelix::straightLineStateAtVertex ( ) const

Definition at line 113 of file FastHelix.cc.

References basisVertex, FastLine::c(), funct::C, 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 stateAtVertex().

113  {
114 
115  //calculate FTS assuming straight line...
116 
119 
120  double dydx = 0.;
121  double pt = 0., px = 0., py = 0.;
122 
123  if(fabs(theCircle.n1()) > 0. || fabs(theCircle.n2()) > 0.)
124  pt = 1.e+4;// 10 TeV //else no pt
125  if(fabs(theCircle.n2()) > 0.) {
126  dydx = -theCircle.n1()/theCircle.n2(); //else px = 0
127  }
128  px = pt/sqrt(1. + dydx*dydx);
129  py = px*dydx;
130  // check sign with scalar product
131  if (px*(pMid.x() - v.x()) + py*(pMid.y() - v.y()) < 0.) {
132  px *= -1.;
133  py *= -1.;
134  }
135 
136  //calculate z_0 and pz at vertex using weighted mean
137  //z = z(r) = z0 + (dz/dr)*r
138  //tan(theta) = dr/dz = (dz/dr)^-1
139  //theta = atan(1./dzdr)
140  //p = pt/sin(theta)
141  //pz = p*cos(theta) = pt/tan(theta)
142 
144  double dzdr = -flfit.n1()/flfit.n2();
145  double pz = pt*dzdr;
146 
147  TrackCharge q = 1;
149  //MP
150 
151  if ( useBasisVertex ) {
153  GlobalVector(px, py, pz),
154  q,
155  &(*pSetup)),
157  } else {
158  double z_0 = -flfit.c()/flfit.n2();
159  return FTS(GlobalTrajectoryParameters(GlobalPoint(v.x(), v.y(), z_0),
160  GlobalVector(px, py, pz),
161  q,
162  &(*pSetup)),
164  }
165 }
GlobalPoint theMiddleHit
Definition: FastHelix.h:81
GlobalPoint theVertex
Definition: FastHelix.h:82
ROOT::Math::SMatrixIdentity AlgebraicMatrixID
ROOT::Math::SMatrix< double, 6, 6, ROOT::Math::MatRepSym< double, 6 > > AlgebraicSymMatrix66
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
GlobalPoint basisVertex
Definition: FastHelix.h:83
GlobalPoint theOuterHit
Definition: FastHelix.h:80
double n2() const
Definition: FastCircle.h:62
FastCircle theCircle
Definition: FastHelix.h:84
int TrackCharge
Definition: TrackCharge.h:4
double n1() const
Definition: FastCircle.h:60
T sqrt(T t)
Definition: SSEVec.h:28
FreeTrajectoryState FTS
Definition: FastHelix.h:31
edm::ESHandle< MagneticField > pSetup
Definition: FastHelix.h:85
mathSSE::Vec4< T > v
bool useBasisVertex
Definition: FastHelix.h:87
Global3DVector GlobalVector
Definition: GlobalVector.h:10

Member Data Documentation

GlobalPoint FastHelix::basisVertex
private

Definition at line 83 of file FastHelix.h.

Referenced by helixStateAtVertex(), and straightLineStateAtVertex().

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

Definition at line 85 of file FastHelix.h.

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

GlobalVector FastHelix::tesla0
private

Definition at line 86 of file FastHelix.h.

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

FastCircle FastHelix::theCircle
private

Definition at line 84 of file FastHelix.h.

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

GlobalPoint FastHelix::theMiddleHit
private

Definition at line 81 of file FastHelix.h.

Referenced by helixStateAtVertex(), and straightLineStateAtVertex().

GlobalPoint FastHelix::theOuterHit
private

Definition at line 80 of file FastHelix.h.

Referenced by helixStateAtVertex(), and straightLineStateAtVertex().

GlobalPoint FastHelix::theVertex
private

Definition at line 82 of file FastHelix.h.

Referenced by helixStateAtVertex(), and straightLineStateAtVertex().

bool FastHelix::useBasisVertex
private

Definition at line 87 of file FastHelix.h.

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