CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Attributes
ConversionFastHelix Class Reference

#include <ConversionFastHelix.h>

Public Member Functions

 ConversionFastHelix (const GlobalPoint &outerHit, const GlobalPoint &middleHit, const GlobalPoint &aVertex, const MagneticField *field)
 
FTS helixStateAtVertex ()
 
bool isValid ()
 
void makeHelix ()
 
FTS stateAtVertex ()
 
FTS straightLineStateAtVertex ()
 
 ~ConversionFastHelix ()
 

Private Types

typedef FreeTrajectoryState FTS
 

Private Attributes

const MagneticFieldmField
 
FastCircle theCircle
 
FTS theHelix_
 
GlobalPoint theMiddleHit
 
GlobalPoint theOuterHit
 
GlobalPoint theVertex
 
bool validStateAtVertex
 

Detailed Description

Generation of track parameters at a vertex using two hits and a vertex.

Definition at line 15 of file ConversionFastHelix.h.

Member Typedef Documentation

◆ FTS

Definition at line 17 of file ConversionFastHelix.h.

Constructor & Destructor Documentation

◆ ConversionFastHelix()

ConversionFastHelix::ConversionFastHelix ( const GlobalPoint outerHit,
const GlobalPoint middleHit,
const GlobalPoint aVertex,
const MagneticField field 
)

Definition at line 10 of file ConversionFastHelix.cc.

References makeHelix(), and validStateAtVertex.

14  : theOuterHit(outerHit),
15  theMiddleHit(middleHit),
16  theVertex(aVertex),
17  theCircle(outerHit, middleHit, aVertex),
18  mField(field) {
19  validStateAtVertex = false;
20 
21  makeHelix();
22 }
const MagneticField * mField

◆ ~ConversionFastHelix()

ConversionFastHelix::~ConversionFastHelix ( )
inline

Definition at line 25 of file ConversionFastHelix.h.

25 {}

Member Function Documentation

◆ helixStateAtVertex()

FreeTrajectoryState ConversionFastHelix::helixStateAtVertex ( )

Definition at line 34 of file ConversionFastHelix.cc.

References FastLine::c(), correctionTermsCaloMet_cff::C, MagneticField::inTesla(), edm::isNotFinite(), mField, DiDispStaMuonMonitor_cfi::pt, multPhiCorr_741_25nsDY_cfi::px, multPhiCorr_741_25nsDY_cfi::py, submitPVResolutionJobs::q, rho, FastCircle::rho(), mathSSE::sqrt(), theCircle, theMiddleHit, theOuterHit, theVertex, FreeTrajectoryState::transverseCurvature(), findQualityFiles::v, validStateAtVertex, PV3DBase< T, PVType, FrameType >::x(), FastCircle::x0(), PV3DBase< T, PVType, FrameType >::y(), FastCircle::y0(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by makeHelix().

34  {
37  FTS atVertex;
38 
39  double dydx = 0.;
40  double pt = 0., px = 0., py = 0.;
41 
42  //remember (radius rho in cm):
43  //rho =
44  //100. * pt *
45  //(10./(3.*MagneticField::inTesla(GlobalPoint(0., 0., 0.)).z()));
46 
47  double rho = theCircle.rho();
48  pt = 0.01 * rho * (0.3 * mField->inTesla(GlobalPoint(0, 0, 0)).z());
49 
50  // (py/px)|x=v.x() = (dy/dx)|x=v.x()
51  //remember:
52  //y(x) = +-sqrt(rho^2 - (x-x0)^2) + y0
53  //y(x) = sqrt(rho^2 - (x-x0)^2) + y0 if y(x) >= y0
54  //y(x) = -sqrt(rho^2 - (x-x0)^2) + y0 if y(x) < y0
55  //=> (dy/dx) = -(x-x0)/sqrt(Q) if y(x) >= y0
56  // (dy/dx) = (x-x0)/sqrt(Q) if y(x) < y0
57  //with Q = rho^2 - (x-x0)^2
58 
59  double arg = rho * rho - ((v.x() - theCircle.x0()) * (v.x() - theCircle.x0()));
60 
61  if (arg > 0) {
62  // double root = sqrt( rho*rho - ( (v.x()-theCircle.x0())*(v.x()-theCircle.x0()) ) );
63  double root = sqrt(arg);
64 
65  if ((v.y() - theCircle.y0()) > 0.)
66  dydx = -(v.x() - theCircle.x0()) / root;
67  else
68  dydx = (v.x() - theCircle.x0()) / root;
69 
70  px = pt / sqrt(1. + dydx * dydx);
71  py = px * dydx;
72  // check sign with scalar product
73  if (px * (pMid.x() - v.x()) + py * (pMid.y() - v.y()) < 0.) {
74  px *= -1.;
75  py *= -1.;
76  }
77 
78  //std::cout << " ConversionFastHelix:helixStateAtVertex rho " << rho << " pt " << pt << " v " << v << " theCircle.x0() " <<theCircle.x0() << " theCircle.y0() " << theCircle.y0() << " v.x()-theCircle.x0() " << v.x()-theCircle.x0() << " rho^2 " << rho*rho << " v.x()-theCircle.x0()^2 " << (v.x()-theCircle.x0())*(v.x()-theCircle.x0()) << " root " << root << " arg " << arg << " dydx " << dydx << std::endl;
79  //calculate z0, pz
80  //(z, R*phi) linear relation in a helix
81  //with R, phi defined as radius and angle w.r.t. centre of circle
82  //in transverse plane
83  //pz = pT*(dz/d(R*phi)))
84 
86 
87  double z_0 = 0;
88 
89  //std::cout << " ConversionFastHelix:helixStateAtVertex flfit.n2() " << flfit.n2() << " flfit.c() " << flfit.c() << " flfit.n2() " << flfit.n2() << std::endl;
90  if (flfit.n2() != 0 && !edm::isNotFinite(flfit.c()) && !edm::isNotFinite(flfit.n2())) {
91  // std::cout << " Accepted " << std::endl;
92  z_0 = -flfit.c() / flfit.n2();
93  double dzdrphi = -flfit.n1() / flfit.n2();
94  double pz = pt * dzdrphi;
95 
96  //get sign of particle
97 
98  GlobalVector magvtx = mField->inTesla(v);
99  TrackCharge q = ((theCircle.x0() * py - theCircle.y0() * px) / (magvtx.z()) < 0.) ? -1 : 1;
100 
102  //MP
103 
104  atVertex = FTS(GlobalTrajectoryParameters(GlobalPoint(v.x(), v.y(), z_0), GlobalVector(px, py, pz), q, mField),
106 
107  //std::cout << " ConversionFastHelix:helixStateAtVertex globalPoint " << GlobalPoint(v.x(), v.y(), z_0) << " GlobalVector " << GlobalVector(px, py, pz) << " q " << q << " MField " << mField->inTesla(v) << std::endl;
108  //std::cout << " ConversionFastHelix:helixStateAtVertex atVertex.transverseCurvature() " << atVertex.transverseCurvature() << std::endl;
109  if (atVertex.transverseCurvature() != 0) {
110  validStateAtVertex = true;
111 
112  //std::cout << " ConversionFastHelix:helixStateAtVertex validHelixStateAtVertex status " << validStateAtVertex << std::endl;
113  return atVertex;
114  } else
115  return atVertex;
116  } else {
117  //std::cout << " ConversionFastHelix:helixStateAtVertex not accepted validHelixStateAtVertex status " << validStateAtVertex << std::endl;
118  return atVertex;
119  }
120 
121  } else {
122  //std::cout << " ConversionFastHelix:helixStateAtVertex not accepted because arg <0 validHelixStateAtVertex status " << validStateAtVertex << std::endl;
123  return atVertex;
124  }
125 }
T z() const
Definition: PV3DBase.h:61
constexpr bool isNotFinite(T x)
Definition: isFinite.h:9
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
ROOT::Math::SMatrixIdentity AlgebraicMatrixID
FreeTrajectoryState FTS
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
const MagneticField * mField
A arg
Definition: Factorize.h:31
int TrackCharge
Definition: TrackCharge.h:4
T sqrt(T t)
Definition: SSEVec.h:23
double c() const
Definition: FastLine.h:27
double transverseCurvature() const
double y0() const
Definition: FastCircle.h:45
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
double rho() const
Definition: FastCircle.h:47
double x0() const
Definition: FastCircle.h:43
Global3DVector GlobalVector
Definition: GlobalVector.h:10

◆ isValid()

bool ConversionFastHelix::isValid ( void  )
inline

◆ makeHelix()

void ConversionFastHelix::makeHelix ( )

◆ stateAtVertex()

FreeTrajectoryState ConversionFastHelix::stateAtVertex ( )

◆ straightLineStateAtVertex()

FreeTrajectoryState ConversionFastHelix::straightLineStateAtVertex ( )

Definition at line 127 of file ConversionFastHelix.cc.

References FastLine::c(), edm::isNotFinite(), mField, FastLine::n1(), FastCircle::n1(), FastLine::n2(), FastCircle::n2(), DiDispStaMuonMonitor_cfi::pt, multPhiCorr_741_25nsDY_cfi::px, multPhiCorr_741_25nsDY_cfi::py, submitPVResolutionJobs::q, mathSSE::sqrt(), theCircle, theMiddleHit, theOuterHit, theVertex, FreeTrajectoryState::transverseCurvature(), findQualityFiles::v, validStateAtVertex, PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().

Referenced by makeHelix().

127  {
128  FTS atVertex;
129 
130  //calculate FTS assuming straight line...
131 
134 
135  double dydx = 0.;
136  double pt = 0., px = 0., py = 0.;
137 
138  if (fabs(theCircle.n1()) > 0. || fabs(theCircle.n2()) > 0.)
139  pt = 1.e+4; // 10 TeV //else no pt
140  if (fabs(theCircle.n2()) > 0.) {
141  dydx = -theCircle.n1() / theCircle.n2(); //else px = 0
142  }
143 
144  if (pt == 0 && dydx == 0.) {
145  validStateAtVertex = false;
146  return atVertex;
147  }
148  px = pt / sqrt(1. + dydx * dydx);
149  py = px * dydx;
150 
151  // check sign with scalar product
152  if (px * (pMid.x() - v.x()) + py * (pMid.y() - v.y()) < 0.) {
153  px *= -1.;
154  py *= -1.;
155  }
156 
157  //calculate z_0 and pz at vertex using weighted mean
158  //z = z(r) = z0 + (dz/dr)*r
159  //tan(theta) = dr/dz = (dz/dr)^-1
160  //theta = atan(1./dzdr)
161  //p = pt/sin(theta)
162  //pz = p*cos(theta) = pt/tan(theta)
163 
165 
166  double z_0 = 0;
167  if (flfit.n2() != 0 && !edm::isNotFinite(flfit.c()) && !edm::isNotFinite(flfit.n2())) {
168  z_0 = -flfit.c() / flfit.n2();
169 
170  double dzdr = -flfit.n1() / flfit.n2();
171  double pz = pt * dzdr;
172 
173  TrackCharge q = 1;
174 
175  atVertex = FTS(GlobalPoint(v.x(), v.y(), z_0), GlobalVector(px, py, pz), q, mField);
176 
177  // std::cout << " ConversionFastHelix::straightLineStateAtVertex curvature " << atVertex.transverseCurvature() << " signedInverseMomentum " << atVertex.signedInverseMomentum() << std::endl;
178  if (atVertex.transverseCurvature() == -0) {
179  return atVertex;
180  } else {
181  validStateAtVertex = true;
182  return atVertex;
183  }
184 
185  } else {
186  return atVertex;
187  }
188 }
constexpr bool isNotFinite(T x)
Definition: isFinite.h:9
FreeTrajectoryState FTS
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
const MagneticField * mField
int TrackCharge
Definition: TrackCharge.h:4
T sqrt(T t)
Definition: SSEVec.h:23
double n2() const
Definition: FastCircle.h:57
double transverseCurvature() const
double n1() const
Definition: FastCircle.h:55
Global3DVector GlobalVector
Definition: GlobalVector.h:10

Member Data Documentation

◆ mField

const MagneticField* ConversionFastHelix::mField
private

Definition at line 44 of file ConversionFastHelix.h.

Referenced by helixStateAtVertex(), and straightLineStateAtVertex().

◆ theCircle

FastCircle ConversionFastHelix::theCircle
private

Definition at line 43 of file ConversionFastHelix.h.

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

◆ theHelix_

FTS ConversionFastHelix::theHelix_
private

Definition at line 38 of file ConversionFastHelix.h.

Referenced by makeHelix(), and stateAtVertex().

◆ theMiddleHit

GlobalPoint ConversionFastHelix::theMiddleHit
private

Definition at line 41 of file ConversionFastHelix.h.

Referenced by helixStateAtVertex(), and straightLineStateAtVertex().

◆ theOuterHit

GlobalPoint ConversionFastHelix::theOuterHit
private

Definition at line 40 of file ConversionFastHelix.h.

Referenced by helixStateAtVertex(), and straightLineStateAtVertex().

◆ theVertex

GlobalPoint ConversionFastHelix::theVertex
private

Definition at line 42 of file ConversionFastHelix.h.

Referenced by helixStateAtVertex(), and straightLineStateAtVertex().

◆ validStateAtVertex

bool ConversionFastHelix::validStateAtVertex
private