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
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 16 of file ConversionFastHelix.h.

Member Typedef Documentation

Definition at line 20 of file ConversionFastHelix.h.

Constructor & Destructor Documentation

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.

13  :
14  theOuterHit(outerHit),
15  theMiddleHit(middleHit),
16  theVertex(aVertex),
17  theCircle(outerHit,
18  middleHit,
19  aVertex),
20  mField(field) {
21 
22  validStateAtVertex=false;
23 
24 
25  makeHelix();
26 
27 
28 }
const MagneticField * mField
ConversionFastHelix::~ConversionFastHelix ( )
inline

Definition at line 30 of file ConversionFastHelix.h.

30 {}

Member Function Documentation

FreeTrajectoryState ConversionFastHelix::helixStateAtVertex ( )

Definition at line 51 of file ConversionFastHelix.cc.

References FastLine::c(), funct::C, MagneticField::inTesla(), edm::detail::isnan(), mField, lumiQueryAPI::q, rho, FastCircle::rho(), dbtoconf::root, mathSSE::sqrt(), theCircle, theMiddleHit, theOuterHit, theVertex, FreeTrajectoryState::transverseCurvature(), 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().

51  {
52 
53 
54 
57  FTS atVertex;
58 
59  double dydx = 0.;
60  double pt = 0., px = 0., py = 0.;
61 
62  //remember (radius rho in cm):
63  //rho =
64  //100. * pt *
65  //(10./(3.*MagneticField::inTesla(GlobalPoint(0., 0., 0.)).z()));
66 
67  double rho = theCircle.rho();
68  pt = 0.01 * rho * (0.3*mField->inTesla(GlobalPoint(0,0,0)).z());
69 
70  // (py/px)|x=v.x() = (dy/dx)|x=v.x()
71  //remember:
72  //y(x) = +-sqrt(rho^2 - (x-x0)^2) + y0
73  //y(x) = sqrt(rho^2 - (x-x0)^2) + y0 if y(x) >= y0
74  //y(x) = -sqrt(rho^2 - (x-x0)^2) + y0 if y(x) < y0
75  //=> (dy/dx) = -(x-x0)/sqrt(Q) if y(x) >= y0
76  // (dy/dx) = (x-x0)/sqrt(Q) if y(x) < y0
77  //with Q = rho^2 - (x-x0)^2
78 
79 
80  double arg=rho*rho - ( (v.x()-theCircle.x0())*(v.x()-theCircle.x0()) );
81 
82  if ( arg >= 0 ) {
83 
84 
85  // double root = sqrt( rho*rho - ( (v.x()-theCircle.x0())*(v.x()-theCircle.x0()) ) );
86  double root = sqrt( arg );
87 
88  if((v.y() - theCircle.y0()) > 0.)
89  dydx = -(v.x() - theCircle.x0()) / root;
90  else
91  dydx = (v.x() - theCircle.x0()) / root;
92 
93  px = pt/sqrt(1. + dydx*dydx);
94  py = px*dydx;
95  // check sign with scalar product
96  if(px*(pMid.x() - v.x()) + py*(pMid.y() - v.y()) < 0.) {
97  px *= -1.;
98  py *= -1.;
99  }
100 
101  //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;
102  //calculate z0, pz
103  //(z, R*phi) linear relation in a helix
104  //with R, phi defined as radius and angle w.r.t. centre of circle
105  //in transverse plane
106  //pz = pT*(dz/d(R*phi)))
107 
109 
110 
111 
112  double z_0 = 0;
113 
114  //std::cout << " ConversionFastHelix:helixStateAtVertex flfit.n2() " << flfit.n2() << " flfit.c() " << flfit.c() << " flfit.n2() " << flfit.n2() << std::endl;
115  if ( flfit.n2() !=0 && !std::isnan( flfit.c()) && !std::isnan(flfit.n2()) ) {
116  // std::cout << " Accepted " << std::endl;
117  z_0 = -flfit.c()/flfit.n2();
118  double dzdrphi = -flfit.n1()/flfit.n2();
119  double pz = pt*dzdrphi;
120 
121  //get sign of particle
122 
123  GlobalVector magvtx=mField->inTesla(v);
124  TrackCharge q =
125  ((theCircle.x0()*py - theCircle.y0()*px) /
126  (magvtx.z()) < 0.) ?
127  -1 : 1;
128 
129 
131  //MP
132 
133  atVertex = FTS(GlobalTrajectoryParameters(GlobalPoint(v.x(), v.y(), z_0),
134  GlobalVector(px, py, pz),
135  q,
136  mField),
138 
139  //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;
140  //std::cout << " ConversionFastHelix:helixStateAtVertex atVertex.transverseCurvature() " << atVertex.transverseCurvature() << std::endl;
141  if( atVertex.transverseCurvature() !=0 ) {
142 
143  validStateAtVertex=true;
144 
145  //std::cout << " ConversionFastHelix:helixStateAtVertex validHelixStateAtVertex status " << validStateAtVertex << std::endl;
146  return atVertex;
147  }else
148  return atVertex;
149  } else {
150  //std::cout << " ConversionFastHelix:helixStateAtVertex not accepted validHelixStateAtVertex status " << validStateAtVertex << std::endl;
151  return atVertex;
152  }
153 
154 
155 
156  } else {
157 
158  //std::cout << " ConversionFastHelix:helixStateAtVertex not accepted because arg <0 validHelixStateAtVertex status " << validStateAtVertex << std::endl;
159  return atVertex;
160  }
161 
162 
163 
164 
165 
166 }
double x0() const
Definition: FastCircle.h:50
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
ROOT::Math::SMatrixIdentity AlgebraicMatrixID
FreeTrajectoryState FTS
Definition: DDAxes.h:10
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
const MagneticField * mField
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
A arg
Definition: Factorize.h:36
double rho() const
Definition: FastCircle.h:54
int TrackCharge
Definition: TrackCharge.h:4
bool isnan(float x)
Definition: math.h:13
T sqrt(T t)
Definition: SSEVec.h:46
T z() const
Definition: PV3DBase.h:63
double c() const
Definition: FastLine.h:32
double transverseCurvature() const
double y0() const
Definition: FastCircle.h:52
mathSSE::Vec4< T > v
Global3DVector GlobalVector
Definition: GlobalVector.h:10
string root
initialization
Definition: dbtoconf.py:70
bool ConversionFastHelix::isValid ( void  )
inline

Definition at line 35 of file ConversionFastHelix.h.

References validStateAtVertex.

void ConversionFastHelix::makeHelix ( )

Definition at line 31 of file ConversionFastHelix.cc.

References helixStateAtVertex(), FastCircle::isValid(), straightLineStateAtVertex(), theCircle, and theHelix_.

Referenced by ConversionFastHelix().

31  {
32 
33 
34  if( theCircle.isValid()) {
36  } else {
38  }
39 
40 
41 }
bool isValid() const
Definition: FastCircle.h:56
FreeTrajectoryState ConversionFastHelix::stateAtVertex ( )

Definition at line 44 of file ConversionFastHelix.cc.

References theHelix_.

Referenced by InOutConversionSeedFinder::findSeeds(), and InOutConversionSeedFinder::startSeed().

44  {
45 
46  return theHelix_;
47 
48 }
FreeTrajectoryState ConversionFastHelix::straightLineStateAtVertex ( )

Definition at line 168 of file ConversionFastHelix.cc.

References FastLine::c(), edm::detail::isnan(), mField, FastLine::n1(), FastCircle::n1(), FastLine::n2(), FastCircle::n2(), lumiQueryAPI::q, mathSSE::sqrt(), theCircle, theMiddleHit, theOuterHit, theVertex, FreeTrajectoryState::transverseCurvature(), v, validStateAtVertex, PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().

Referenced by makeHelix().

168  {
169 
170  FTS atVertex;
171 
172  //calculate FTS assuming straight line...
173 
176 
177  double dydx = 0.;
178  double pt = 0., px = 0., py = 0.;
179 
180  if(fabs(theCircle.n1()) > 0. || fabs(theCircle.n2()) > 0.)
181  pt = 1.e+4;// 10 TeV //else no pt
182  if(fabs(theCircle.n2()) > 0.) {
183  dydx = -theCircle.n1()/theCircle.n2(); //else px = 0
184  }
185 
186  if ( pt==0 && dydx==0. ) {
187  validStateAtVertex=false;
188  return atVertex;
189  }
190  px = pt/sqrt(1. + dydx*dydx);
191  py = px*dydx;
192 
193  // check sign with scalar product
194  if (px*(pMid.x() - v.x()) + py*(pMid.y() - v.y()) < 0.) {
195  px *= -1.;
196  py *= -1.;
197  }
198 
199  //calculate z_0 and pz at vertex using weighted mean
200  //z = z(r) = z0 + (dz/dr)*r
201  //tan(theta) = dr/dz = (dz/dr)^-1
202  //theta = atan(1./dzdr)
203  //p = pt/sin(theta)
204  //pz = p*cos(theta) = pt/tan(theta)
205 
206 
208 
209  double z_0 = 0;
210  if (flfit.n2() !=0 && !std::isnan( flfit.c()) && !std::isnan(flfit.n2()) ) {
211  z_0 = -flfit.c()/flfit.n2();
212 
213  double dzdr = -flfit.n1()/flfit.n2();
214  double pz = pt*dzdr;
215 
216  TrackCharge q = 1;
217 
218  atVertex = FTS(GlobalPoint(v.x(), v.y(), z_0),
219  GlobalVector(px, py, pz),
220  q,
221  mField
222  );
223 
224  // std::cout << " ConversionFastHelix::straightLineStateAtVertex curvature " << atVertex.transverseCurvature() << " signedInverseMomentum " << atVertex.signedInverseMomentum() << std::endl;
225  if ( atVertex.transverseCurvature() == -0 ) {
226  return atVertex;
227  } else {
228  validStateAtVertex=true;
229  return atVertex;
230  }
231 
232  } else {
233 
234 
235  return atVertex;
236 
237  }
238 
239 }
FreeTrajectoryState FTS
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
const MagneticField * mField
double n2() const
Definition: FastCircle.h:62
int TrackCharge
Definition: TrackCharge.h:4
double n1() const
Definition: FastCircle.h:60
bool isnan(float x)
Definition: math.h:13
T sqrt(T t)
Definition: SSEVec.h:46
double transverseCurvature() const
mathSSE::Vec4< T > v
Global3DVector GlobalVector
Definition: GlobalVector.h:10

Member Data Documentation

const MagneticField* ConversionFastHelix::mField
private

Definition at line 51 of file ConversionFastHelix.h.

Referenced by helixStateAtVertex(), and straightLineStateAtVertex().

FastCircle ConversionFastHelix::theCircle
private

Definition at line 50 of file ConversionFastHelix.h.

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

FTS ConversionFastHelix::theHelix_
private

Definition at line 45 of file ConversionFastHelix.h.

Referenced by makeHelix(), and stateAtVertex().

GlobalPoint ConversionFastHelix::theMiddleHit
private

Definition at line 48 of file ConversionFastHelix.h.

Referenced by helixStateAtVertex(), and straightLineStateAtVertex().

GlobalPoint ConversionFastHelix::theOuterHit
private

Definition at line 47 of file ConversionFastHelix.h.

Referenced by helixStateAtVertex(), and straightLineStateAtVertex().

GlobalPoint ConversionFastHelix::theVertex
private

Definition at line 49 of file ConversionFastHelix.h.

Referenced by helixStateAtVertex(), and straightLineStateAtVertex().

bool ConversionFastHelix::validStateAtVertex
private