CGEM BOSS 6.6.5.f
BESIII Offline Software System
Loading...
Searching...
No Matches
Reconstruction/TrackUtil/bak_TrackUtil-00-00-11/TrackUtil/Helix.h
Go to the documentation of this file.
1//
2// $Id: Helix.h,v 1.6 2017/12/27 06:18:55 wangll Exp $
3//
4// Class Helix
5//
6// Author Date comments
7// Y.Ohnishi 03/01/1997 original version
8// Y.Ohnishi 06/03/1997 updated
9// Y.Iwasaki 17/02/1998 BFILED removed, func. name changed, func. added
10// J.Tanaka 06/12/1998 add some utilities.
11// Y.Iwasaki 07/07/1998 cache added to speed up
12// Y.Iwasaki 25/04/2001 cache m_ac[5] added to speed up
13//
14#ifndef Helix_FLAG_
15#define Helix_FLAG_
16#include "GaudiKernel/IInterface.h"
17#include "GaudiKernel/Kernel.h"
18#include "GaudiKernel/Service.h"
19#include "MagneticField/IMagneticFieldSvc.h"
20#include "MagneticField/MagneticFieldSvc.h"
21
22#include "CLHEP/Matrix/Vector.h"
23#include "CLHEP/Matrix/SymMatrix.h"
24//#ifndef CLHEP_THREEVECTOR_H
25#include "CLHEP/Vector/ThreeVector.h"
26//#endif
27#include "CLHEP/Vector/LorentzVector.h"
28//#ifndef CLHEP_POINT3D_H
29#include "CLHEP/Geometry/Point3D.h"
30//#endif
31
32#ifndef ENABLE_BACKWARDS_COMPATIBILITY
34#endif
35using namespace CLHEP;
36
38
39typedef CLHEP::HepVector Vector;
40typedef CLHEP::HepSymMatrix SymMatrix;
41typedef CLHEP::Hep3Vector Vector3;
42typedef CLHEP::HepLorentzVector VectorL;
43typedef CLHEP::HepLorentzVector Vector4;
44typedef CLHEP::HepMatrix Matrix;
45
46using CLHEP::HepVector;
47using CLHEP::HepSymMatrix;
48using CLHEP::Hep3Vector;
49using CLHEP::HepLorentzVector;
50
51
52/// Helix parameter class
53class Helix {
54
55 public:
56 /// Constructor with pivot, helix parameter a, and its error matrix.
57 Helix(const HepPoint3D & pivot,
58 const HepVector & a,
59 const HepSymMatrix & Ea);
60
61 /// Constructor without error matrix.
62 Helix(const HepPoint3D & pivot,
63 const HepVector & a);
64
65 /// Constructor with position, momentum, and charge.
66 Helix(const HepPoint3D & position,
67 const Hep3Vector & momentum,
68 double charge);
69
70 /// Destructor
71 virtual ~Helix();
72
73 public:// Selectors
74 /// returns position of helix center(z = 0.);
75 const HepPoint3D & center(void) const;
76
77 /// returns pivot position.
78 const HepPoint3D & pivot(void) const;
79
80 /// returns radious of helix.
81 double radius(void) const;
82
83 /// returns position after rotating angle dPhi in phi direction.
84 HepPoint3D x(double dPhi = 0.) const;
85 double * x(double dPhi, double p[3]) const;
86
87 /// returns position and convariance matrix(Ex) after rotation.
88 HepPoint3D x(double dPhi, HepSymMatrix & Ex) const;
89
90 /// returns direction vector after rotating angle dPhi in phi direction.
91 Hep3Vector direction(double dPhi = 0.) const;
92
93 /// returns momentum vector after rotating angle dPhi in phi direction.
94 Hep3Vector momentum(double dPhi = 0.) const;
95
96 /// returns momentum vector after rotating angle dPhi in phi direction.
97 Hep3Vector momentum(double dPhi, HepSymMatrix & Em) const;
98
99 /// returns 4momentum vector after rotating angle dPhi in phi direction.
100 HepLorentzVector momentum(double dPhi, double mass) const;
101
102 /// returns 4momentum vector after rotating angle dPhi in phi direction.
103 HepLorentzVector momentum(double dPhi, double mass, HepSymMatrix & Em) const;
104
105 /// returns 4momentum vector after rotating angle dPhi in phi direction.
106 HepLorentzVector momentum(double dPhi, double mass, HepPoint3D & x, HepSymMatrix & Emx) const;
107
108 public:// Parametrization dependent functions. Prepared for tracking codes. Users should not use them.
109 /// returns an element of parameters.
110 double dr(void) const;
111 double phi0(void) const;
112 double kappa(void) const;
113 double dz(void) const;
114 double tanl(void) const;
115 double curv(void) const;
116 double sinPhi0(void) const;
117 double cosPhi0(void) const;
118 double alpha(void) const;
119
120 /// returns helix parameters.
121 const HepVector & a(void) const;
122
123 /// returns error matrix.
124 const HepSymMatrix & Ea(void) const;
125
126 double pt(void) const{ return m_pt; }
127 double cosTheta(void) const{ return m_a[4]/sqrt(1.+ m_a[4]*m_a[4]); }
128 public:// Modifiers
129 /// sets helix parameters.
130 const HepVector & a(const HepVector & newA);
131
132 /// sets helix paramters and error matrix.
133 const HepSymMatrix & Ea(const HepSymMatrix & newdA);
134
135 /// sets pivot position.
136 const HepPoint3D & pivot(const HepPoint3D & newPivot);
137
138 /// sets helix pivot position, parameters, and error matrix.
139 void set(const HepPoint3D & pivot,
140 const HepVector & a,
141 const HepSymMatrix & Ea);
142
143 /// unsets error matrix. Error calculations will be ignored after this function call until an error matrix be set again. 0 matrix will be return as a return value for error matrix when you call functions which returns an error matrix.
145
146 /// sets/returns z componet of the magnetic field.
147 double bFieldZ(double);
148 double bFieldZ(void) const;
149
150 public:// Operators
151 /// Copy operator
152 Helix & operator = (const Helix &);
153
154 public:// Mathmatical functions
155 HepMatrix delApDelA(const HepVector & ap) const;
156 HepMatrix delXDelA(double phi) const;
157 HepMatrix delMDelA(double phi) const;
158 HepMatrix del4MDelA(double phi, double mass) const;
159 HepMatrix del4MXDelA(double phi, double mass) const;
160 double IntersectCylinder(double r) const;
161
162 //private:
163 protected:
165 double m_bField;
166 double m_alpha;
167
168 private:
169 void updateCache(void);
170
171 public:
172 /// Constant alpha for uniform field.
173 static const double ConstantAlpha;
174
175 private:
176 //double m_bField;
177 //double m_alpha;
178 HepPoint3D m_pivot;
179 HepVector m_a;
180 HepSymMatrix m_Ea;
181 bool m_matrixValid;
182
183 private: // caches
184 HepPoint3D m_center;
185 double m_cp;
186 double m_sp;
187 double m_pt;
188 double m_r;
189 double m_ac[5];
190};
191
192//-----------------------------------------------------------------------------
193
194#ifdef Helix_NO_INLINE
195#define inline
196#else
197#undef inline
198#define Helix_INLINE_DEFINE_HERE
199#endif
200
201#ifdef Helix_INLINE_DEFINE_HERE
202
203inline
204const HepPoint3D &
205Helix::center(void) const {
206 return m_center;
207}
208
209inline
210const HepPoint3D &
211Helix::pivot(void) const {
212 return m_pivot;
213}
214
215inline
216double
217Helix::radius(void) const {
218 return m_r;
219}
220
221inline
222Hep3Vector
223Helix::direction(double phi) const {
224 return momentum(phi).unit();
225}
226
227inline
228double
229Helix::dr(void) const {
230 return m_ac[0];
231}
232
233inline
234double
235Helix::phi0(void) const {
236 return m_ac[1];
237}
238
239inline
240double
241Helix::kappa(void) const {
242 return m_ac[2];
243}
244
245inline
246double
247Helix::dz(void) const {
248 return m_ac[3];
249}
250
251inline
252double
253Helix::tanl(void) const {
254 return m_ac[4];
255}
256
257inline
258double
259Helix::curv(void) const {
260 return m_r;
261}
262
263inline
264const HepVector &
265Helix::a(void) const {
266 return m_a;
267}
268
269inline
270const HepSymMatrix &
271Helix::Ea(void) const {
272 return m_Ea;
273}
274
275inline
276const HepVector &
277Helix::a(const HepVector & i) {
278 m_a = i;
279 updateCache();
280 return m_a;
281}
282
283inline
284const HepSymMatrix &
285Helix::Ea(const HepSymMatrix & i) {
286 return m_Ea = i;
287}
288
289inline
290double
291Helix::bFieldZ(double a) {
292 m_bField = a;
293 m_alpha = 10000. / 2.99792458 / m_bField;
294 updateCache();
295 return m_bField;
296}
297
298inline
299double
300Helix::alpha(void) const {
301
302 return m_alpha;
303}
304
305
306inline
307double
308Helix::bFieldZ(void) const {
309 return m_bField;
310}
311
312inline
313double
314Helix::sinPhi0(void) const {
315 return m_sp;
316}
317
318inline
319double
320Helix::cosPhi0(void) const {
321 return m_cp;
322}
323
324#endif
325
326#undef inline
327
328#endif /* Helix_FLAG_ */
**********INTEGER nmxhep !maximum number of particles DOUBLE PRECISION vhep INTEGER jdahep COMMON hepevt $ !serial number $ !number of particles $ !status code $ !particle ident KF $ !parent particles $ !childreen particles $ !four momentum
double mass
HepLorentzVector momentum(double dPhi, double mass, HepPoint3D &x, HepSymMatrix &Emx) const
returns 4momentum vector after rotating angle dPhi in phi direction.
Helix(const HepPoint3D &pivot, const HepVector &a)
Constructor without error matrix.
HepMatrix delApDelA(const HepVector &ap) const
static const double ConstantAlpha
Constant alpha for uniform field.
double cosPhi0(void) const
HepMatrix delMDelA(double phi) const
HepPoint3D x(double dPhi, HepSymMatrix &Ex) const
returns position and convariance matrix(Ex) after rotation.
double sinPhi0(void) const
const HepPoint3D & pivot(const HepPoint3D &newPivot)
sets pivot position.
double phi0(void) const
double bFieldZ(double)
sets/returns z componet of the magnetic field.
const HepPoint3D & center(void) const
returns position of helix center(z = 0.);
virtual ~Helix()
Destructor.
void set(const HepPoint3D &pivot, const HepVector &a, const HepSymMatrix &Ea)
sets helix pivot position, parameters, and error matrix.
Helix(const HepPoint3D &position, const Hep3Vector &momentum, double charge)
Constructor with position, momentum, and charge.
void ignoreErrorMatrix(void)
unsets error matrix. Error calculations will be ignored after this function call until an error matri...
double tanl(void) const
HepMatrix del4MXDelA(double phi, double mass) const
Hep3Vector momentum(double dPhi=0.) const
returns momentum vector after rotating angle dPhi in phi direction.
const HepVector & a(const HepVector &newA)
sets helix parameters.
double IntersectCylinder(double r) const
HepLorentzVector momentum(double dPhi, double mass) const
returns 4momentum vector after rotating angle dPhi in phi direction.
const HepSymMatrix & Ea(const HepSymMatrix &newdA)
sets helix paramters and error matrix.
const HepSymMatrix & Ea(void) const
returns error matrix.
HepPoint3D x(double dPhi=0.) const
returns position after rotating angle dPhi in phi direction.
double bFieldZ(void) const
double curv(void) const
double * x(double dPhi, double p[3]) const
HepMatrix del4MDelA(double phi, double mass) const
double dz(void) const
HepMatrix delXDelA(double phi) const
double alpha(void) const
double radius(void) const
returns radious of helix.
double dr(void) const
returns an element of parameters.
const HepVector & a(void) const
returns helix parameters.
Hep3Vector momentum(double dPhi, HepSymMatrix &Em) const
returns momentum vector after rotating angle dPhi in phi direction.
Helix(const HepPoint3D &pivot, const HepVector &a, const HepSymMatrix &Ea)
Constructor with pivot, helix parameter a, and its error matrix.
const HepPoint3D & pivot(void) const
returns pivot position.
Hep3Vector direction(double dPhi=0.) const
returns direction vector after rotating angle dPhi in phi direction.
HepLorentzVector momentum(double dPhi, double mass, HepSymMatrix &Em) const
returns 4momentum vector after rotating angle dPhi in phi direction.
double kappa(void) const