test
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 11 of file ConversionFastHelix.cc.

References makeHelix(), and validStateAtVertex.

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

Definition at line 30 of file ConversionFastHelix.h.

30 {}

Member Function Documentation

FreeTrajectoryState ConversionFastHelix::helixStateAtVertex ( )

Definition at line 52 of file ConversionFastHelix.cc.

References FastLine::c(), funct::C, MagneticField::inTesla(), edm::isNotFinite(), mField, EnergyCorrector::pt, lumiQueryAPI::q, rho, FastCircle::rho(), dbtoconf::root, 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().

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

Referenced by core.AutoHandle.AutoHandle::ReallyLoad().

void ConversionFastHelix::makeHelix ( )

Definition at line 32 of file ConversionFastHelix.cc.

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

Referenced by ConversionFastHelix().

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

Definition at line 45 of file ConversionFastHelix.cc.

References theHelix_.

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

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

Definition at line 169 of file ConversionFastHelix.cc.

References FastLine::c(), edm::isNotFinite(), mField, FastLine::n1(), FastCircle::n1(), FastLine::n2(), FastCircle::n2(), EnergyCorrector::pt, lumiQueryAPI::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().

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