BOSS 7.0.4
BESIII Offline Software System
Loading...
Searching...
No Matches
Reconstruction/TrkExtAlg/TrkExtAlg-00-00-65/TrkExtAlg/Helix.h
Go to the documentation of this file.
1//
2// $Id: Helix.h,v 1.6 2009/08/12 11:16:28 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 Ext_Helix_FLAG_
15#define Ext_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
37/// Helix parameter class
38class Ext_Helix {
39
40 public:
41 /// Constructor with pivot, helix parameter a, and its error matrix.
43 const HepVector & a,
44 const HepSymMatrix & Ea);
45
46 /// Constructor without error matrix.
48 const HepVector & a);
49
50 /// Constructor with position, momentum, and charge.
51 Ext_Helix(const HepPoint3D & position,
52 const Hep3Vector & momentum,
53 double charge);
54
55 /// Destructor
56 virtual ~Ext_Helix();
57
58 public:// Selectors
59 /// returns position of helix center(z = 0.);
60 const HepPoint3D & center(void) const;
61
62 /// returns pivot position.
63 const HepPoint3D & pivot(void) const;
64
65 /// returns radious of helix.
66 double radius(void) const;
67
68 /// returns position after rotating angle dPhi in phi direction.
69 HepPoint3D x(double dPhi = 0.) const;
70 double * x(double dPhi, double p[3]) const;
71
72 /// returns position and convariance matrix(Ex) after rotation.
73 HepPoint3D x(double dPhi, HepSymMatrix & Ex) const;
74
75 /// returns direction vector after rotating angle dPhi in phi direction.
76 Hep3Vector direction(double dPhi = 0.) const;
77
78 /// returns momentum vector after rotating angle dPhi in phi direction.
79 Hep3Vector momentum(double dPhi = 0.) const;
80
81 /// returns momentum vector after rotating angle dPhi in phi direction.
82 Hep3Vector momentum(double dPhi, HepSymMatrix & Em) const;
83
84 /// returns 4momentum vector after rotating angle dPhi in phi direction.
85 HepLorentzVector momentum(double dPhi, double mass) const;
86
87 /// returns 4momentum vector after rotating angle dPhi in phi direction.
88 HepLorentzVector momentum(double dPhi, double mass, HepSymMatrix & Em) const;
89
90 /// returns 4momentum vector after rotating angle dPhi in phi direction.
91 HepLorentzVector momentum(double dPhi, double mass, HepPoint3D & x, HepSymMatrix & Emx) const;
92
93 public:// Parametrization dependent functions. Prepared for tracking codes. Users should not use them.
94 /// returns an element of parameters.
95 double dr(void) const;
96 double phi0(void) const;
97 double kappa(void) const;
98 double dz(void) const;
99 double tanl(void) const;
100 double curv(void) const;
101 double sinPhi0(void) const;
102 double cosPhi0(void) const;
103
104 /// returns helix parameters.
105 const HepVector & a(void) const;
106
107 /// returns error matrix.
108 const HepSymMatrix & Ea(void) const;
109
110 public:// Modifiers
111 /// sets helix parameters.
112 const HepVector & a(const HepVector & newA);
113
114 /// sets helix paramters and error matrix.
115 const HepSymMatrix & Ea(const HepSymMatrix & newdA);
116
117 /// sets pivot position.
118 const HepPoint3D & pivot(const HepPoint3D & newPivot);
119
120 /// sets helix pivot position, parameters, and error matrix.
121 void set(const HepPoint3D & pivot,
122 const HepVector & a,
123 const HepSymMatrix & Ea);
124
125 /// 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.
127
128 /// sets/returns z componet of the magnetic field.
129 double bFieldZ(double);
130 double bFieldZ(void) const;
131
132 public:// Operators
133 /// Copy operator
135
136 public:// Mathmatical functions
137 HepMatrix delApDelA(const HepVector & ap) const;
138 HepMatrix delXDelA(double phi) const;
139 HepMatrix delMDelA(double phi) const;
140 HepMatrix del4MDelA(double phi, double mass) const;
141 HepMatrix del4MXDelA(double phi, double mass) const;
142
143 private:
144 IMagneticFieldSvc* m_pmgnIMF;
145
146 private:
147 void updateCache(void);
148
149 public:
150 /// Constant alpha for uniform field.
151 static const double ConstantAlpha;
152
153 private:
154 double m_bField;
155 double m_alpha;
156 HepPoint3D m_pivot;
157 HepVector m_a;
158 HepSymMatrix m_Ea;
159 bool m_matrixValid;
160
161 private: // caches
162 HepPoint3D m_center;
163 double m_cp;
164 double m_sp;
165 double m_pt;
166 double m_r;
167 double m_ac[5];
168};
169
170//-----------------------------------------------------------------------------
171
172#ifdef Ext_Helix_NO_INLINE
173#define inline
174#else
175#undef inline
176#define Ext_Helix_INLINE_DEFINE_HERE
177#endif
178
179#ifdef Ext_Helix_INLINE_DEFINE_HERE
180
181inline
182const HepPoint3D &
183Ext_Helix::center(void) const {
184 return m_center;
185}
186
187inline
188const HepPoint3D &
189Ext_Helix::pivot(void) const {
190 return m_pivot;
191}
192
193inline
194double
195Ext_Helix::radius(void) const {
196 return m_r;
197}
198
199inline
200Hep3Vector
201Ext_Helix::direction(double phi) const {
202 return momentum(phi).unit();
203}
204
205inline
206double
207Ext_Helix::dr(void) const {
208 return m_ac[0];
209}
210
211inline
212double
213Ext_Helix::phi0(void) const {
214 return m_ac[1];
215}
216
217inline
218double
219Ext_Helix::kappa(void) const {
220 return m_ac[2];
221}
222
223inline
224double
225Ext_Helix::dz(void) const {
226 return m_ac[3];
227}
228
229inline
230double
231Ext_Helix::tanl(void) const {
232 return m_ac[4];
233}
234
235inline
236double
237Ext_Helix::curv(void) const {
238 return m_r;
239}
240
241inline
242const HepVector &
243Ext_Helix::a(void) const {
244 return m_a;
245}
246
247inline
248const HepSymMatrix &
249Ext_Helix::Ea(void) const {
250 return m_Ea;
251}
252
253inline
254const HepVector &
255Ext_Helix::a(const HepVector & i) {
256 m_a = i;
257 updateCache();
258 return m_a;
259}
260
261inline
262const HepSymMatrix &
263Ext_Helix::Ea(const HepSymMatrix & i) {
264 return m_Ea = i;
265}
266
267inline
268double
269Ext_Helix::bFieldZ(double a) {
270 m_bField = a;
271 m_alpha = 10000. / 2.99792458 / m_bField;
272 updateCache();
273 return m_bField;
274}
275
276inline
277double
278Ext_Helix::bFieldZ(void) const {
279 return m_bField;
280}
281
282inline
283double
284Ext_Helix::sinPhi0(void) const {
285 return m_sp;
286}
287
288inline
289double
290Ext_Helix::cosPhi0(void) const {
291 return m_cp;
292}
293
294#endif
295
296#undef inline
297
298#endif /* Ext_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 bFieldZ(double)
sets/returns z componet of the magnetic field.
void ignoreErrorMatrix(void)
unsets error matrix. Error calculations will be ignored after this function call until an error matri...
Ext_Helix(const HepPoint3D &pivot, const HepVector &a)
Constructor without error matrix.
double * x(double dPhi, double p[3]) const
double cosPhi0(void) const
const HepPoint3D & center(void) const
returns position of helix center(z = 0.);
double curv(void) const
HepLorentzVector momentum(double dPhi, double mass) const
returns 4momentum vector after rotating angle dPhi in phi direction.
HepMatrix del4MDelA(double phi, double mass) const
Hep3Vector momentum(double dPhi, HepSymMatrix &Em) const
returns momentum vector after rotating angle dPhi in phi direction.
double dz(void) const
double phi0(void) const
HepMatrix delMDelA(double phi) const
void set(const HepPoint3D &pivot, const HepVector &a, const HepSymMatrix &Ea)
sets helix pivot position, parameters, and error matrix.
double tanl(void) const
HepMatrix del4MXDelA(double phi, double mass) const
double radius(void) const
returns radious of helix.
const HepSymMatrix & Ea(void) const
returns error matrix.
HepPoint3D x(double dPhi=0.) const
returns position after rotating angle dPhi in phi direction.
HepLorentzVector momentum(double dPhi, double mass, HepPoint3D &x, HepSymMatrix &Emx) const
returns 4momentum vector after rotating angle dPhi in phi direction.
static const double ConstantAlpha
Constant alpha for uniform field.
double sinPhi0(void) const
HepPoint3D x(double dPhi, HepSymMatrix &Ex) const
returns position and convariance matrix(Ex) after rotation.
virtual ~Ext_Helix()
Destructor.
const HepSymMatrix & Ea(const HepSymMatrix &newdA)
sets helix paramters and error matrix.
Hep3Vector direction(double dPhi=0.) const
returns direction vector after rotating angle dPhi in phi direction.
double dr(void) const
returns an element of parameters.
HepLorentzVector momentum(double dPhi, double mass, HepSymMatrix &Em) const
returns 4momentum vector after rotating angle dPhi in phi direction.
const HepPoint3D & pivot(void) const
returns pivot position.
double kappa(void) const
HepMatrix delXDelA(double phi) const
const HepVector & a(const HepVector &newA)
sets helix parameters.
double bFieldZ(void) const
Hep3Vector momentum(double dPhi=0.) const
returns momentum vector after rotating angle dPhi in phi direction.
Ext_Helix & operator=(const Ext_Helix &)
Copy operator.
const HepVector & a(void) const
returns helix parameters.
Ext_Helix(const HepPoint3D &position, const Hep3Vector &momentum, double charge)
Constructor with position, momentum, and charge.
const HepPoint3D & pivot(const HepPoint3D &newPivot)
sets pivot position.
HepMatrix delApDelA(const HepVector &ap) const
Ext_Helix(const HepPoint3D &pivot, const HepVector &a, const HepSymMatrix &Ea)
Constructor with pivot, helix parameter a, and its error matrix.