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