CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 constexpr 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 29 of file FastHelix.h.

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

34  : bField(ibField), theCircle(oHit, mHit, aVertex) {
35  tesla0 = 0.1 * nomField;
36  maxRho = maxPt / (0.01 * 0.3 * tesla0);
37  useBasisVertex = false;
38  compute();
39  }
float tesla0
Definition: FastHelix.h:79
MagneticField const * bField
Definition: FastHelix.h:75
static constexpr float maxPt
Definition: FastHelix.h:73
FastCircle theCircle
Definition: FastHelix.h:78
void compute()
Definition: FastHelix.cc:4
float maxRho
Definition: FastHelix.h:80
bool useBasisVertex
Definition: FastHelix.h:81
FastHelix::FastHelix ( const GlobalPoint oHit,
const GlobalPoint mHit,
const GlobalPoint aVertex,
double  nomField,
MagneticField const *  ibField,
const GlobalPoint bVertex 
)
inline

Definition at line 42 of file FastHelix.h.

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

48  : bField(ibField), basisVertex(bVertex), theCircle(oHit, mHit, aVertex) {
49  tesla0 = 0.1 * nomField;
50  maxRho = maxPt / (0.01 * 0.3 * tesla0);
51  useBasisVertex = true;
52  compute();
53  }
float tesla0
Definition: FastHelix.h:79
MagneticField const * bField
Definition: FastHelix.h:75
GlobalPoint basisVertex
Definition: FastHelix.h:77
static constexpr float maxPt
Definition: FastHelix.h:73
FastCircle theCircle
Definition: FastHelix.h:78
void compute()
Definition: FastHelix.cc:4
float maxRho
Definition: FastHelix.h:80
bool useBasisVertex
Definition: FastHelix.h:81
FastHelix::~FastHelix ( )
inline

Definition at line 55 of file FastHelix.h.

55 {}

Member Function Documentation

const FastCircle& FastHelix::circle ( ) const
inline

Definition at line 61 of file FastHelix.h.

References theCircle.

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

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

Definition at line 4 of file FastHelix.cc.

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

Referenced by FastHelix().

4  {
5  if (isValid() && (std::abs(tesla0) > 1e-3) && theCircle.rho() < maxRho)
7  else
9 }
bool isValid() const
Definition: FastHelix.h:57
float tesla0
Definition: FastHelix.h:79
void straightLineStateAtVertex()
Definition: FastHelix.cc:85
double rho() const
Definition: FastCircle.h:47
FastCircle theCircle
Definition: FastHelix.h:78
void helixStateAtVertex()
Definition: FastHelix.cc:11
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
float maxRho
Definition: FastHelix.h:80
void FastHelix::helixStateAtVertex ( )
private

Definition at line 11 of file FastHelix.cc.

References funct::abs(), atVertex, basisVertex, bField, middleHit(), outerHit(), perp2(), DiDispStaMuonMonitor_cfi::pt, submitPVResolutionJobs::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().

11  {
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 
81  atVertex = GlobalTrajectoryParameters(GlobalPoint(v.x(), v.y(), z_0), GlobalVector(px, py, pz), q, bField);
82  }
83 }
float tesla0
Definition: FastHelix.h:79
double x0() const
Definition: FastCircle.h:43
MagneticField const * bField
Definition: FastHelix.h:75
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
GlobalPoint basisVertex
Definition: FastHelix.h:77
T y() const
Definition: PV3DBase.h:60
void straightLineStateAtVertex()
Definition: FastHelix.cc:85
GlobalPoint const & vertex() const
Definition: FastHelix.h:66
double rho() const
Definition: FastCircle.h:47
FastCircle theCircle
Definition: FastHelix.h:78
int TrackCharge
Definition: TrackCharge.h:4
T sqrt(T t)
Definition: SSEVec.h:19
GlobalPoint const & middleHit() const
Definition: FastHelix.h:65
T z() const
Definition: PV3DBase.h:61
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
GlobalTrajectoryParameters atVertex
Definition: FastHelix.h:76
T perp2() const
Squared magnitude of transverse component.
double y0() const
Definition: FastCircle.h:45
GlobalPoint const & outerHit() const
Definition: FastHelix.h:64
T x() const
Definition: PV3DBase.h:59
bool useBasisVertex
Definition: FastHelix.h:81
Global3DVector GlobalVector
Definition: GlobalVector.h:10
bool FastHelix::isValid ( void  ) const
inline
GlobalPoint const& FastHelix::middleHit ( ) const
inlineprivate

Definition at line 65 of file FastHelix.h.

References FastCircle::innerPoint(), and theCircle.

Referenced by helixStateAtVertex(), and straightLineStateAtVertex().

65 { return theCircle.innerPoint(); }
FastCircle theCircle
Definition: FastHelix.h:78
GlobalPoint const & innerPoint() const
Definition: FastCircle.h:62
GlobalPoint const& FastHelix::outerHit ( ) const
inlineprivate

Definition at line 64 of file FastHelix.h.

References FastCircle::outerPoint(), and theCircle.

Referenced by helixStateAtVertex(), and straightLineStateAtVertex().

64 { return theCircle.outerPoint(); }
FastCircle theCircle
Definition: FastHelix.h:78
GlobalPoint const & outerPoint() const
Definition: FastCircle.h:61
GlobalTrajectoryParameters FastHelix::stateAtVertex ( ) const
inline

Definition at line 59 of file FastHelix.h.

References atVertex.

Referenced by ConvBremSeedProducer::produce().

59 { return atVertex; }
GlobalTrajectoryParameters atVertex
Definition: FastHelix.h:76
void FastHelix::straightLineStateAtVertex ( )
private

Definition at line 85 of file FastHelix.cc.

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

Referenced by compute(), and helixStateAtVertex().

85  {
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();
125  atVertex = GlobalTrajectoryParameters(GlobalPoint(v.x(), v.y(), z_0), GlobalVector(px, py, pz), q, bField);
126  }
127 }
MagneticField const * bField
Definition: FastHelix.h:75
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
GlobalPoint basisVertex
Definition: FastHelix.h:77
GlobalPoint const & vertex() const
Definition: FastHelix.h:66
static constexpr float maxPt
Definition: FastHelix.h:73
double n2() const
Definition: FastCircle.h:57
FastCircle theCircle
Definition: FastHelix.h:78
int TrackCharge
Definition: TrackCharge.h:4
double n1() const
Definition: FastCircle.h:55
T sqrt(T t)
Definition: SSEVec.h:19
GlobalPoint const & middleHit() const
Definition: FastHelix.h:65
GlobalTrajectoryParameters atVertex
Definition: FastHelix.h:76
GlobalPoint const & outerHit() const
Definition: FastHelix.h:64
bool useBasisVertex
Definition: FastHelix.h:81
Global3DVector GlobalVector
Definition: GlobalVector.h:10
GlobalPoint const& FastHelix::vertex ( ) const
inlineprivate

Definition at line 66 of file FastHelix.h.

References theCircle, and FastCircle::vertexPoint().

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

66 { return theCircle.vertexPoint(); }
FastCircle theCircle
Definition: FastHelix.h:78
GlobalPoint const & vertexPoint() const
Definition: FastCircle.h:63

Member Data Documentation

GlobalTrajectoryParameters FastHelix::atVertex
private

Definition at line 76 of file FastHelix.h.

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

GlobalPoint FastHelix::basisVertex
private

Definition at line 77 of file FastHelix.h.

Referenced by helixStateAtVertex(), and straightLineStateAtVertex().

MagneticField const* FastHelix::bField
private

Definition at line 75 of file FastHelix.h.

Referenced by helixStateAtVertex(), and straightLineStateAtVertex().

constexpr float FastHelix::maxPt = 10000
staticprivate

Definition at line 73 of file FastHelix.h.

Referenced by FastHelix(), and straightLineStateAtVertex().

float FastHelix::maxRho
private

Definition at line 80 of file FastHelix.h.

Referenced by compute(), and FastHelix().

float FastHelix::tesla0
private

Definition at line 79 of file FastHelix.h.

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

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

Definition at line 81 of file FastHelix.h.

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