BOSS 6.6.4.p01
BESIII Offline Software System
Loading...
Searching...
No Matches
HTrackParameter.h
Go to the documentation of this file.
1#ifndef HTrack_Parameter_H
2#define HTrack_Parameter_H
3//
4//
5// Track Parameters in Helix format (drho, phi0, kappa, dz, lambda)
6// The helix parameters are used in track fit
7// Author: K.L He date: 04/12/2007, created for Kalman vertex fit
8//
9//
10
11#include "CLHEP/Matrix/Vector.h"
12#include "CLHEP/Vector/LorentzVector.h"
13#include "CLHEP/Vector/ThreeVector.h"
14#include "CLHEP/Matrix/SymMatrix.h"
15#include "CLHEP/Matrix/Matrix.h"
16using CLHEP::HepVector;
17using CLHEP::HepLorentzVector;
18using CLHEP::Hep3Vector;
19using CLHEP::HepMatrix;
20using CLHEP::HepSymMatrix;
21#include "CLHEP/Geometry/Point3D.h"
22#ifndef ENABLE_BACKWARDS_COMPATIBILITY
24#endif
25
26class WTrackParameter;
27
29
30 public:
35 HTrackParameter(const HepVector helix, const HepSymMatrix eMatrix, const int trackid, const int partid);
36 HTrackParameter(const HepVector helix, const double error[], const int trackid, const int partid);
37
38 //
39 // HTrackParameter from WTrackParameter
40 //
42 //
43 // measurement equation and derivative matrices
44 //
45 HTrackParameter(const int charge, const HepVector p, const HepVector x);
46 HepMatrix dHdx(const HepVector p, const HepVector x);
47 HepMatrix dHdp(const HepVector p, const HepVector x);
48
49 HepVector hel() const {return m_hel;}
50 HepVector helix() const {return m_hel;}
51 HepSymMatrix eHel() const {return m_eHel;}
52 int trackID() const {return m_trackID;}
53 int partID() const {return m_partID;}
54
55 // charge
56 inline int charge() const;
57 // 3-momentum and 3-position
58 inline double pxy() const;
59 inline HepVector p() const;
60 inline HepVector x() const;
61 inline Hep3Vector p3() const;
62 inline HepPoint3D x3() const;
63 inline HepLorentzVector p(const double mass) const;
64 HepPoint3D center() const;
65 double radius() const;
66 // helix parameter
67 double drho() const {return m_hel[0];}
68 double phi0() const {return m_hel[1];}
69 double kappa() const {return m_hel[2];}
70 double dz() const {return m_hel[3];}
71 double lambda() const {return m_hel[4];}
72
73
74 // WTrackParameter
75 WTrackParameter wTrack() const;
76 WTrackParameter wTrack(const double mass) const;
77
78 // set partID, trackID
79 void setTrackID(const int trackID) {m_trackID = trackID;}
80 void setPartID(const int partID) { m_partID = partID;}
81 // set helix parameter and covariance matrix
82 void setHel(const HepVector he) {m_hel = he;}
83 void setEHel(const HepSymMatrix eH) {m_eHel = eH;}
84 //
85 // some utility function
86 //
87 // mass
88 double xmass(const int i) const;
89 //
90 // int section position with helix, plane, cylinder, cone, etc
91 //
92 HepPoint3D positionTwoHelix(const HTrackParameter) const; // intersection position in x-y plane
93 HepPoint3D positionPlane(const double) const;
94 HepPoint3D positionCylinder(const double) const;
96 //
97 // Mininum distance between helix and helix, helix and line
98 //
100 private:
101 int m_trackID; // for vertex reconstruction
102 int m_partID; // for Kalman track, 0:e, 1:mu, 2:pi, 3:K, 4:p
103 HepVector m_hel; // 5 helix parameter
104 HepSymMatrix m_eHel; // 5x5 error matrix
105};
106
107inline int HTrackParameter::charge() const {
108 return (m_hel[2]>0 ? +1 :-1);
109}
110
111inline double HTrackParameter::pxy() const {
112 return fabs(1/m_hel[2]);
113}
114
115inline HepVector HTrackParameter::p() const {
116 HepVector p0(3, 0);
117 double pxy = 1./fabs(m_hel[2]);
118 p0[0] = 0 - pxy*sin(m_hel[1]);
119 p0[1] = pxy*cos(m_hel[1]);
120 p0[2] = pxy * m_hel[4];
121 return p0;
122}
123
124
125inline HepVector HTrackParameter::x() const {
126 HepVector v0(3, 0);
127 v0[0] = m_hel[0]*cos(m_hel[1]);
128 v0[1] = m_hel[0]*sin(m_hel[1]);
129 v0[2] = m_hel[3];
130 return v0;
131}
132
134 return HepPoint3D(m_hel[0]*cos(m_hel[1]), m_hel[0]*sin(m_hel[1]), m_hel[3]);
135}
136
137inline Hep3Vector HTrackParameter::p3() const {
138 double pxy = 1./fabs(m_hel[2]);
139 return Hep3Vector(0-pxy*sin(m_hel[1]), pxy*cos(m_hel[1]), pxy*m_hel[4]);
140}
141
142inline HepLorentzVector HTrackParameter::p(const double mass) const{
143// // xum 2007-12-28
144// //Hep3Vector ptrk = (p3()).rho();
145// Hep3Vector ptrk = (p3()).r();
146// double e = sqrt(ptrk*ptrk+mass*mass);
147// return HepLorentzVector(p3(), e);
148
149 // nefedov 2011-11-17
150 Hep3Vector p3tmp = p3();
151 double ptrk = p3tmp.r();
152 double e = sqrt(ptrk*ptrk+mass*mass);
153 return HepLorentzVector(p3tmp, e);
154}
155
156#endif
double sin(const BesAngle a)
Definition: BesAngle.h:210
double cos(const BesAngle a)
Definition: BesAngle.h:213
double mass
const double xmass[5]
Definition: Gam4pikp.cxx:50
HepGeom::Point3D< double > HepPoint3D
double lambda() const
void setTrackID(const int trackID)
HepPoint3D positionCylinder(const double) const
HepPoint3D positionTwoHelix(const HTrackParameter) const
HepMatrix dHdp(const HepVector p, const HepVector x)
double minDistanceTwoHelix(const HTrackParameter G, HepPoint3D &pos)
void setHel(const HepVector he)
HepVector helix() const
HepMatrix dHdx(const HepVector p, const HepVector x)
WTrackParameter wTrack() const
int trackID() const
double kappa() const
HepVector p() const
HepPoint3D positionPlane(const double) const
HepVector hel() const
HepPoint3D x3() const
double phi0() const
HepPoint3D center() const
double drho() const
int charge() const
double dz() const
double pxy() const
HepSymMatrix eHel() const
int partID() const
HTrackParameter & operator=(const HTrackParameter &htrk)
void setEHel(const HepSymMatrix eH)
double radius() const
void setPartID(const int partID)
Hep3Vector p3() const
HepVector x() const
HepPoint3D positionCone() const