CGEM BOSS 6.6.5.h
BESIII Offline Software System
Loading...
Searching...
No Matches
Reconstruction/KalFitAlg/KalFitAlg-00-15-18/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 KalmanFit_Helix_FLAG_
13#define KalmanFit_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 Helix();
45 /// Constructor with pivot, helix parameter a, and its error matrix.
46 Helix(const HepPoint3D & pivot,
47 const HepVector & a,
48 const HepSymMatrix & Ea);
49
50 /// Constructor without error matrix.
51 Helix(const HepPoint3D & pivot,
52 const HepVector & a);
53
54 /// Constructor with position, momentum, and charge.
55 Helix(const HepPoint3D & position,
56 const Hep3Vector & momentum,
57 double charge);
58
59 Helix(const Helix& i);
60 /// Destructor
61 virtual ~Helix();
62
63 public:// Selectors
64 /// returns position of helix center(z = 0.);
65 const HepPoint3D & center(void) const;
66
67 /// returns pivot position.
68 const HepPoint3D & pivot(void) const;
69
70 /// returns radious of helix.
71 double radius(void) const;
72
73 /// returns position after rotating angle dPhi in phi direction.
74 HepPoint3D x(double dPhi = 0.) const;
75 double * x(double dPhi, double p[3]) const;
76
77 /// returns position and convariance matrix(Ex) after rotation.
78 HepPoint3D x(double dPhi, HepSymMatrix & Ex) const;
79
80 /// returns direction vector after rotating angle dPhi in phi direction.
81 Hep3Vector direction(double dPhi = 0.) const;
82
83 /// returns momentum vector after rotating angle dPhi in phi direction.
84 Hep3Vector momentum(double dPhi = 0.) const;
85
86 /// returns momentum vector after rotating angle dPhi in phi direction.
87 Hep3Vector momentum(double dPhi, HepSymMatrix & Em) const;
88
89 /// returns 4momentum vector after rotating angle dPhi in phi direction.
90 HepLorentzVector momentum(double dPhi, double mass) const;
91
92 /// returns 4momentum vector after rotating angle dPhi in phi direction.
93 HepLorentzVector momentum(double dPhi, double mass, HepSymMatrix & Em) const;
94
95 /// returns 4momentum vector after rotating angle dPhi in phi direction.
96 HepLorentzVector momentum(double dPhi, double mass, HepPoint3D & x, HepSymMatrix & Emx) const;
97
98 public:// Parametrization dependent functions. Prepared for tracking codes. Users should not use them.
99 /// returns an element of parameters.
100 double dr(void) const;
101 double phi0(void) const;
102 double kappa(void) const;
103 double dz(void) const;
104 double tanl(void) const;
105 double curv(void) const;
106 double sinPhi0(void) const;
107 double cosPhi0(void) const;
108
109 /// returns helix parameters.
110 const HepVector & a(void) const;
111
112 /// returns error matrix.
113 const HepSymMatrix & Ea(void) const;
114
115 double pt(void) const{ return m_pt; }
116 double cosTheta(void) const{ return m_a[4]/sqrt(1.+ m_a[4]*m_a[4]); }
117
118 double approach(KalFitHitMdc& hit, bool doSagCorrection) const;
119
120 double approach(HepPoint3D pfwd, HepPoint3D pbwd, bool doSagCorrection) const;
121
122
123 public:// Modifiers
124 /// sets helix parameters.
125 const HepVector & a(const HepVector & newA);
126
127 /// sets helix paramters and error matrix.
128 const HepSymMatrix & Ea(const HepSymMatrix & newdA);
129
130 /// sets pivot position.
131 const HepPoint3D & pivot(const HepPoint3D & newPivot);
132
133 /// sets helix pivot position, parameters, and error matrix.
134 void set(const HepPoint3D & pivot,
135 const HepVector & a,
136 const HepSymMatrix & Ea);
137
138 /// 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.
139 void ignoreErrorMatrix(void);
140
141 /// sets/returns z componet of the magnetic field.
142 double bFieldZ(double);
143 double bFieldZ(void) const;
144
145 ///
146 double alpha(void) const;
147
148 public:// Operators
149 /// Copy operator
150 Helix & operator = (const Helix &);
151
152 public:// Mathmatical functions
153 HepMatrix delApDelA(const HepVector & ap) const;
154 HepMatrix delXDelA(double phi) const;
155 HepMatrix delMDelA(double phi) const;
156 HepMatrix del4MDelA(double phi, double mass) const;
157 HepMatrix del4MXDelA(double phi, double mass) const;
158 double IntersectCylinder(double r) const;
159 double flightArc(HepPoint3D& hit)const;
160 double flightLength(HepPoint3D& hit)const;
161 double flightArc(double r)const;
162 double flightLength(double r)const;
163 double dPhi(HepPoint3D& hit) const;
164
165 private:
166 IMagneticFieldSvc* m_pmgnIMF;
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
295 //std::cout<<"m_alpha: "<<m_alpha<<std::endl;
296 updateCache();
297 return m_bField;
298}
299
300
301inline
302double
303Helix::alpha(void) const {
304
305 return m_alpha;
306}
307
308
309inline
310double
311Helix::bFieldZ(void) const {
312 return m_bField;
313}
314
315inline
316double
317Helix::sinPhi0(void) const {
318 return m_sp;
319}
320
321inline
322double
323Helix::cosPhi0(void) const {
324 return m_cp;
325}
326
327#endif
328
329#undef inline
330
331}
332
333
334#endif /* KalmanFit_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.