CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
LocalTrajectoryParameters.h
Go to the documentation of this file.
1 #ifndef _TRACKER_LOCALTRAJECTORYPARAMETERS_H_
2 #define _TRACKER_LOCALTRAJECTORYPARAMETERS_H_
3 
8 
9 #include <cmath>
10 
26 public:
27 // construct
28 
30 
38  LocalTrajectoryParameters(const AlgebraicVector5& v, double aPzSign, bool charged = true) {
39  theQbp = v[0];
40  theDxdz = v[1];
41  theDydz = v[2];
42  theX = v[3];
43  theY = v[4];
44  thePzSign = aPzSign;
45  if ( charged )
46  theCharge = theQbp>0 ? 1 : -1;
47  else
48  theCharge = 0;
49  }
50 
51 
59  LocalTrajectoryParameters(double aQbp, double aDxdz, double aDydz,
60  double aX, double aY, double aPzSign, bool charged = true) :
61  theDxdz(aDxdz), theDydz(aDydz),
62  theX(aX), theY(aY), thePzSign(aPzSign) {
63  if ( charged ) {
64  theQbp = aQbp;
65  theCharge = theQbp>0 ? 1 : -1;
66  }
67  else {
68  theQbp = aQbp;
69  theCharge = 0;
70  }
71  }
72 
76  theQbp( charge/p.mag()), theDxdz( p.x()/p.z()), theDydz( p.y()/p.z()),
77  theX( pos.x()), theY(pos.y()), thePzSign( p.z()>0. ? 1.:-1.), theCharge(charge) {
78  if ( charge==0 ) theQbp = 1./p.mag();
79  }
80 
81 // access
82 
84  LocalPoint position() const {
85  return LocalPoint(theX, theY);
86  }
87 
90  double op = fabs(theQbp);
91  if ( op<1.e-9 ) op = 1.e-9;
92  double pz = thePzSign/(op*sqrt(1. + theDxdz*theDxdz + theDydz*theDydz));
93  double px = pz*theDxdz;
94  double py = pz*theDydz;
95  return LocalVector(px, py, pz);
96  }
97 
100  double dz = thePzSign/sqrt(1. + theDxdz*theDxdz + theDydz*theDydz);
101  double dx = dz*theDxdz;
102  double dy = dz*theDydz;
103  return LocalVector(dx, dy, dz);
104  }
105 
106 
108  TrackCharge charge() const {return theCharge;}
109 
111  double signedInverseMomentum() const {
112  return charge()==0 ? 0. : theQbp;
113  }
114 
122  v[0] = signedInverseMomentum();
123  v[1] = theDxdz;
124  v[2] = theDydz;
125  v[3] = theX;
126  v[4] = theY;
127  return v;
128  }
129 
137  v[0] = theQbp; // signed in case of charged particles, 1/p for neutrals
138  v[1] = theDxdz;
139  v[2] = theDydz;
140  v[3] = theX;
141  v[4] = theY;
142  return v;
143  }
144 
146  double pzSign() const {
147  return thePzSign;
148  }
149 
151  bool updateP(double dP) {
152  double p = 1./fabs(theQbp);
153  if ((p += dP) <= 0.) return false;
154  double newQbp = theQbp > 0. ? 1./p : -1./p;
155  theQbp = newQbp;
156  return true;
157  }
158 
159 
160  double qbp() const { return theQbp;}
161  double dxdz() const { return theDxdz;}
162  double dydz() const { return theDydz;}
163 
164 
165 private:
166  double theQbp;
167  double theDxdz;
168  double theDydz;
169  double theX;
170  double theY;
171 
172  float thePzSign;
173 
175 
176 };
177 
178 #endif
LocalVector direction() const
Momentum vector unit in the local frame.
Local3DVector LocalVector
Definition: LocalVector.h:12
double pzSign() const
Sign of the z-component of the momentum in the local frame.
LocalPoint position() const
Local x and y position coordinates.
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
bool updateP(double dP)
Update of momentum by a scalar dP.
double double double z
AlgebraicVector5 vector() const
int TrackCharge
Definition: TrackCharge.h:4
T mag() const
Definition: PV3DBase.h:66
double theDxdz
tangent of direction in local x vs. z
LocalTrajectoryParameters(const AlgebraicVector5 &v, double aPzSign, bool charged=true)
T sqrt(T t)
Definition: SSEVec.h:46
LocalVector momentum() const
Momentum vector in the local frame.
LocalTrajectoryParameters(const LocalPoint &pos, const LocalVector &p, TrackCharge charge)
Constructor from local position, momentum and charge.
ROOT::Math::SVector< double, 5 > AlgebraicVector5
AlgebraicVector5 mixedFormatVector() const
TrackCharge charge() const
Charge (-1, 0 or 1)
LocalTrajectoryParameters(double aQbp, double aDxdz, double aDydz, double aX, double aY, double aPzSign, bool charged=true)
double theDydz
tangent of direction in local y vs. z
Local3DPoint LocalPoint
Definition: LocalPoint.h:11
double theQbp
q/p (charged) or 1/p (neutral)
x
Definition: VDTMath.h:216
double signedInverseMomentum() const
Signed inverse momentum q/p (zero for neutrals).
mathSSE::Vec4< T > v