CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FreeTrajectoryState.cc
Go to the documentation of this file.
4 
5 #include <cmath>
6 
7 
10  "FreeTrajectoryState: attempt to access errors when none available");
11 }
12 
13 // implementation of non-trivial methods of FreeTrajectoryState
14 
15 // Warning: these methods violate constness
16 
17 // convert curvilinear errors to cartesian
19 
21  const AlgebraicMatrix65& jac = curv2Cart.jacobian();
22 
23  ((FreeTrajectoryState*)this)->theCartesianError =
24  ROOT::Math::Similarity(jac, theCurvilinearError.matrix());
25 
26  ((FreeTrajectoryState*)this)->theCartesianErrorValid = true;
27 }
28 
29 // convert cartesian errors to curvilinear
31 
33  const AlgebraicMatrix56& jac = cart2Curv.jacobian();
34 
35  ((FreeTrajectoryState*)this)->theCurvilinearError =
36  ROOT::Math::Similarity(jac, theCartesianError.matrix());
37  ((FreeTrajectoryState*)this)->theCurvilinearErrorValid = true;
38 }
39 
40 
41 void FreeTrajectoryState::rescaleError(double factor) {
42  bool zeroField = parameters().magneticFieldInInverseGeV(GlobalPoint(0,0,0)).mag2()==0;
43  if (zeroField) {
48  }else
50  } else{
52  theCartesianError *= (factor*factor);
53  }
55  theCurvilinearError *= (factor*factor);
56  }
57  }
58 }
59 
60 
61 // check if trajectory can reach given radius
62 
66  double rho = transverseCurvature()*p.perp();
67  double rx = rho*x.x();
68  double ry = rho*x.y();
69  double rr = rho*radius;
70  double ax = p.x()*rx + p.y()*ry;
71  double ay = p.x()*ry - p.y()*rx + p.perp2();
72  double cospsi = (.5*(rx*rx + ry*ry - rr*rr) + ay)/sqrt(ax*ax + ay*ay);
73  return fabs(cospsi) <= 1.;
74 }
75 
76 
77 
78 
79 
80 
81 
T mag2() const
Definition: PV3DBase.h:60
T perp() const
Definition: PV3DBase.h:66
ROOT::Math::SMatrix< double, 5, 6, ROOT::Math::MatRepStd< double, 5, 6 > > AlgebraicMatrix56
const GlobalTrajectoryParameters & parameters() const
Definition: DDAxes.h:10
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
T y() const
Definition: PV3DBase.h:57
CurvilinearTrajectoryError theCurvilinearError
CartesianTrajectoryError theCartesianError
T perp2() const
Definition: PV3DBase.h:65
GlobalVector magneticFieldInInverseGeV(const GlobalPoint &x) const
GlobalTrajectoryParameters theGlobalParameters
static void missingError()
void createCurvilinearError() const
void createCartesianError() const
T sqrt(T t)
Definition: SSEVec.h:28
GlobalVector momentum() const
const AlgebraicSymMatrix66 & matrix() const
Vector3DBase unit() const
Definition: Vector3DBase.h:57
GlobalPoint position() const
void rescaleError(double factor)
bool canReach(double radius) const
double transverseCurvature() const
ROOT::Math::SMatrix< double, 6, 5, ROOT::Math::MatRepStd< double, 6, 5 > > AlgebraicMatrix65
const AlgebraicSymMatrix55 & matrix() const
const AlgebraicMatrix56 & jacobian() const
T x() const
Definition: PV3DBase.h:56
const AlgebraicMatrix65 & jacobian() const