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 constexpr float maxPt = 10000
 

Detailed Description

Definition at line 26 of file FastHelix.h.

Constructor & Destructor Documentation

◆ FastHelix() [1/2]

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() [2/2]

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::~FastHelix ( )
inline

Definition at line 55 of file FastHelix.h.

55 {}

Member Function Documentation

◆ circle()

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

◆ compute()

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().

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

◆ helixStateAtVertex()

void FastHelix::helixStateAtVertex ( )
private

Definition at line 11 of file FastHelix.cc.

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

◆ isValid()

bool FastHelix::isValid ( void  ) const
inline

◆ middleHit()

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(); }
GlobalPoint const & innerPoint() const
Definition: FastCircle.h:62
FastCircle theCircle
Definition: FastHelix.h:78

◆ outerHit()

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

◆ stateAtVertex()

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

◆ straightLineStateAtVertex()

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

◆ vertex()

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(); }
GlobalPoint const & vertexPoint() const
Definition: FastCircle.h:63
FastCircle theCircle
Definition: FastHelix.h:78

Member Data Documentation

◆ atVertex

GlobalTrajectoryParameters FastHelix::atVertex
private

Definition at line 76 of file FastHelix.h.

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

◆ basisVertex

GlobalPoint FastHelix::basisVertex
private

Definition at line 77 of file FastHelix.h.

Referenced by helixStateAtVertex(), and straightLineStateAtVertex().

◆ bField

MagneticField const* FastHelix::bField
private

Definition at line 75 of file FastHelix.h.

Referenced by helixStateAtVertex(), and straightLineStateAtVertex().

◆ maxPt

constexpr float FastHelix::maxPt = 10000
staticprivate

Definition at line 73 of file FastHelix.h.

Referenced by FastHelix(), and straightLineStateAtVertex().

◆ maxRho

float FastHelix::maxRho
private

Definition at line 80 of file FastHelix.h.

Referenced by compute(), and FastHelix().

◆ tesla0

float FastHelix::tesla0
private

Definition at line 79 of file FastHelix.h.

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

◆ theCircle

FastCircle FastHelix::theCircle
private

◆ useBasisVertex

bool FastHelix::useBasisVertex
private

Definition at line 81 of file FastHelix.h.

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