CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
FastHelix Class Reference

#include <FastHelix.h>

Public Member Functions

const FastCirclecircle () const
 
 FastHelix (const GlobalPoint &oHit, const GlobalPoint &mHit, const GlobalPoint &aVertex, double nomField, MagneticField const *ibField)
 
 FastHelix (const GlobalPoint &oHit, const GlobalPoint &mHit, const GlobalPoint &aVertex, double nomField, MagneticField const *ibField, const GlobalPoint &bVertex)
 
bool isValid () const
 
GlobalTrajectoryParameters stateAtVertex () const
 
 ~FastHelix ()
 

Private Member Functions

void compute ()
 
void helixStateAtVertex ()
 
GlobalPoint const & middleHit () const
 
GlobalPoint const & outerHit () const
 
void straightLineStateAtVertex ()
 
GlobalPoint const & vertex () const
 

Private Attributes

GlobalTrajectoryParameters atVertex
 
GlobalPoint basisVertex
 
MagneticField const * bField
 
float maxRho
 
float tesla0
 
FastCircle theCircle
 
bool useBasisVertex
 

Static Private Attributes

static float maxPt = 10000
 

Detailed Description

Definition at line 26 of file FastHelix.h.

Constructor & Destructor Documentation

FastHelix::FastHelix ( const GlobalPoint oHit,
const GlobalPoint mHit,
const GlobalPoint aVertex,
double  nomField,
MagneticField const *  ibField 
)
inline

Definition at line 30 of file FastHelix.h.

References compute(), maxPt, maxRho, tesla0, and useBasisVertex.

33  :
34  bField(ibField),
35  theCircle(oHit,
36  mHit,
37  aVertex) {
38  tesla0=0.1*nomField;
39  maxRho = maxPt/(0.01 * 0.3*tesla0);
40  useBasisVertex = false;
41  compute();
42  }
float tesla0
Definition: FastHelix.h:89
MagneticField const * bField
Definition: FastHelix.h:85
FastCircle theCircle
Definition: FastHelix.h:88
static float maxPt
Definition: FastHelix.h:83
void compute()
Definition: FastHelix.cc:4
float maxRho
Definition: FastHelix.h:90
bool useBasisVertex
Definition: FastHelix.h:91
FastHelix::FastHelix ( const GlobalPoint oHit,
const GlobalPoint mHit,
const GlobalPoint aVertex,
double  nomField,
MagneticField const *  ibField,
const GlobalPoint bVertex 
)
inline

Definition at line 45 of file FastHelix.h.

References compute(), maxPt, maxRho, tesla0, and useBasisVertex.

49  :
50  bField(ibField),
51  basisVertex(bVertex),
52  theCircle(oHit,
53  mHit,
54  aVertex) {
55  tesla0=0.1*nomField;
56  maxRho = maxPt/(0.01 * 0.3*tesla0);
57  useBasisVertex = true;
58  compute();
59  }
float tesla0
Definition: FastHelix.h:89
MagneticField const * bField
Definition: FastHelix.h:85
GlobalPoint basisVertex
Definition: FastHelix.h:87
FastCircle theCircle
Definition: FastHelix.h:88
static float maxPt
Definition: FastHelix.h:83
void compute()
Definition: FastHelix.cc:4
float maxRho
Definition: FastHelix.h:90
bool useBasisVertex
Definition: FastHelix.h:91
FastHelix::~FastHelix ( )
inline

Definition at line 61 of file FastHelix.h.

61 {}

Member Function Documentation

const FastCircle& FastHelix::circle ( ) const
inline

Definition at line 67 of file FastHelix.h.

References theCircle.

Referenced by PixelClusterShapeSeedComparitor::compatible(), and StripSubClusterShapeSeedFilter::compatible().

67 { return theCircle; }
FastCircle theCircle
Definition: FastHelix.h:88
void FastHelix::compute ( )
private

Definition at line 4 of file FastHelix.cc.

References funct::abs(), MillePedeFileConverter_cfg::e, helixStateAtVertex(), isValid(), maxRho, FastCircle::rho(), straightLineStateAtVertex(), tesla0, and theCircle.

Referenced by FastHelix(), and vertex().

4  {
5 
6  if(isValid() && (std::abs(tesla0) > 1e-3) && theCircle.rho()<maxRho)
8  else
10 
11 }
bool isValid() const
Definition: FastHelix.h:63
float tesla0
Definition: FastHelix.h:89
void straightLineStateAtVertex()
Definition: FastHelix.cc:95
double rho() const
Definition: FastCircle.h:54
FastCircle theCircle
Definition: FastHelix.h:88
void helixStateAtVertex()
Definition: FastHelix.cc:13
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
float maxRho
Definition: FastHelix.h:90
void FastHelix::helixStateAtVertex ( )
private

Definition at line 13 of file FastHelix.cc.

References funct::abs(), atVertex, basisVertex, bField, middleHit(), outerHit(), perp2(), EnergyCorrector::pt, lumiQueryAPI::q, rho, FastCircle::rho(), mathSSE::sqrt(), straightLineStateAtVertex(), tesla0, theCircle, useBasisVertex, findQualityFiles::v, vertex(), PV3DBase< T, PVType, FrameType >::x(), FastCircle::x0(), PV3DBase< T, PVType, FrameType >::y(), FastCircle::y0(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by compute(), and vertex().

13  {
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 }
float tesla0
Definition: FastHelix.h:89
double x0() const
Definition: FastCircle.h:50
MagneticField const * bField
Definition: FastHelix.h:85
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
GlobalPoint basisVertex
Definition: FastHelix.h:87
T y() const
Definition: PV3DBase.h:63
void straightLineStateAtVertex()
Definition: FastHelix.cc:95
GlobalPoint const & vertex() const
Definition: FastHelix.h:73
double rho() const
Definition: FastCircle.h:54
FastCircle theCircle
Definition: FastHelix.h:88
int TrackCharge
Definition: TrackCharge.h:4
T sqrt(T t)
Definition: SSEVec.h:18
GlobalPoint const & middleHit() const
Definition: FastHelix.h:72
T z() const
Definition: PV3DBase.h:64
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
GlobalTrajectoryParameters atVertex
Definition: FastHelix.h:86
T perp2() const
Squared magnitude of transverse component.
double y0() const
Definition: FastCircle.h:52
GlobalPoint const & outerHit() const
Definition: FastHelix.h:71
T x() const
Definition: PV3DBase.h:62
bool useBasisVertex
Definition: FastHelix.h:91
Global3DVector GlobalVector
Definition: GlobalVector.h:10
bool FastHelix::isValid ( void  ) const
inline
GlobalPoint const& FastHelix::middleHit ( ) const
inlineprivate

Definition at line 72 of file FastHelix.h.

References FastCircle::innerPoint(), and theCircle.

Referenced by helixStateAtVertex(), and straightLineStateAtVertex().

72 { return theCircle.innerPoint();}
FastCircle theCircle
Definition: FastHelix.h:88
GlobalPoint const & innerPoint() const
Definition: FastCircle.h:69
GlobalPoint const& FastHelix::outerHit ( ) const
inlineprivate

Definition at line 71 of file FastHelix.h.

References FastCircle::outerPoint(), and theCircle.

Referenced by helixStateAtVertex(), and straightLineStateAtVertex().

71 { return theCircle.outerPoint();}
FastCircle theCircle
Definition: FastHelix.h:88
GlobalPoint const & outerPoint() const
Definition: FastCircle.h:68
GlobalTrajectoryParameters FastHelix::stateAtVertex ( ) const
inline
void FastHelix::straightLineStateAtVertex ( )
private

Definition at line 95 of file FastHelix.cc.

References atVertex, basisVertex, bField, FastLine::c(), maxPt, middleHit(), FastLine::n1(), FastCircle::n1(), FastLine::n2(), FastCircle::n2(), outerHit(), EnergyCorrector::pt, lumiQueryAPI::q, mathSSE::sqrt(), theCircle, useBasisVertex, findQualityFiles::v, vertex(), PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().

Referenced by compute(), helixStateAtVertex(), and vertex().

95  {
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 }
MagneticField const * bField
Definition: FastHelix.h:85
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
GlobalPoint basisVertex
Definition: FastHelix.h:87
GlobalPoint const & vertex() const
Definition: FastHelix.h:73
double n2() const
Definition: FastCircle.h:64
FastCircle theCircle
Definition: FastHelix.h:88
int TrackCharge
Definition: TrackCharge.h:4
double n1() const
Definition: FastCircle.h:62
T sqrt(T t)
Definition: SSEVec.h:18
GlobalPoint const & middleHit() const
Definition: FastHelix.h:72
static float maxPt
Definition: FastHelix.h:83
GlobalTrajectoryParameters atVertex
Definition: FastHelix.h:86
GlobalPoint const & outerHit() const
Definition: FastHelix.h:71
bool useBasisVertex
Definition: FastHelix.h:91
Global3DVector GlobalVector
Definition: GlobalVector.h:10
GlobalPoint const& FastHelix::vertex ( ) const
inlineprivate

Definition at line 73 of file FastHelix.h.

References compute(), dso_hidden, helixStateAtVertex(), straightLineStateAtVertex(), theCircle, and FastCircle::vertexPoint().

Referenced by Tau.Tau::dxy(), helixStateAtVertex(), and straightLineStateAtVertex().

73 { return theCircle.vertexPoint();}
FastCircle theCircle
Definition: FastHelix.h:88
GlobalPoint const & vertexPoint() const
Definition: FastCircle.h:70

Member Data Documentation

GlobalTrajectoryParameters FastHelix::atVertex
private

Definition at line 86 of file FastHelix.h.

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

GlobalPoint FastHelix::basisVertex
private

Definition at line 87 of file FastHelix.h.

Referenced by helixStateAtVertex(), and straightLineStateAtVertex().

MagneticField const* FastHelix::bField
private

Definition at line 85 of file FastHelix.h.

Referenced by helixStateAtVertex(), and straightLineStateAtVertex().

float FastHelix::maxPt = 10000
staticprivate

Definition at line 83 of file FastHelix.h.

Referenced by FastHelix(), and straightLineStateAtVertex().

float FastHelix::maxRho
private

Definition at line 90 of file FastHelix.h.

Referenced by compute(), and FastHelix().

float FastHelix::tesla0
private

Definition at line 89 of file FastHelix.h.

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

FastCircle FastHelix::theCircle
private
bool FastHelix::useBasisVertex
private

Definition at line 91 of file FastHelix.h.

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