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