BOSS 7.1.1
BESIII Offline Software System
Loading...
Searching...
No Matches
Reconstruction/TrackUtil/TrackUtil-00-00-08/TrackUtil/Helix.h
Go to the documentation of this file.
1//
2// $Id: Helix.h,v 1.4 2011/05/12 10:25: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 Helix_FLAG_
15#define Helix_FLAG_
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
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
119 /// returns helix parameters.
120 const HepVector & a(void) const;
121
122 /// returns error matrix.
123 const HepSymMatrix & Ea(void) const;
124
125 double pt(void) const{ return m_pt; }
126 double cosTheta(void) const{ return m_a[4]/sqrt(1.+ m_a[4]*m_a[4]); }
127 public:// Modifiers
128 /// sets helix parameters.
129 const HepVector & a(const HepVector & newA);
130
131 /// sets helix paramters and error matrix.
132 const HepSymMatrix & Ea(const HepSymMatrix & newdA);
133
134 /// sets pivot position.
135 const HepPoint3D & pivot(const HepPoint3D & newPivot);
136
137 /// sets helix pivot position, parameters, and error matrix.
138 void set(const HepPoint3D & pivot,
139 const HepVector & a,
140 const HepSymMatrix & Ea);
141
142 /// 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.
143 void ignoreErrorMatrix(void);
144
145 /// sets/returns z componet of the magnetic field.
146 double bFieldZ(double);
147 double bFieldZ(void) const;
148
149 public:// Operators
150 /// Copy operator
151 Helix & operator = (const Helix &);
152
153 public:// Mathmatical functions
154 HepMatrix delApDelA(const HepVector & ap) const;
155 HepMatrix delXDelA(double phi) const;
156 HepMatrix delMDelA(double phi) const;
157 HepMatrix del4MDelA(double phi, double mass) const;
158 HepMatrix del4MXDelA(double phi, double mass) const;
159
160 //private:
161 protected:
163 double m_bField;
164 double m_alpha;
165
166 private:
167 void updateCache(void);
168
169 public:
170 /// Constant alpha for uniform field.
171 static const double ConstantAlpha;
172
173 private:
174 //double m_bField;
175 //double m_alpha;
176 HepPoint3D m_pivot;
177 HepVector m_a;
178 HepSymMatrix m_Ea;
179 bool m_matrixValid;
180
181 private: // caches
182 HepPoint3D m_center;
183 double m_cp;
184 double m_sp;
185 double m_pt;
186 double m_r;
187 double m_ac[5];
188};
189
190//-----------------------------------------------------------------------------
191
192#ifdef Helix_NO_INLINE
193#define inline
194#else
195#undef inline
196#define Helix_INLINE_DEFINE_HERE
197#endif
198
199#ifdef Helix_INLINE_DEFINE_HERE
200
201inline
202const HepPoint3D &
203Helix::center(void) const {
204 return m_center;
205}
206
207inline
208const HepPoint3D &
209Helix::pivot(void) const {
210 return m_pivot;
211}
212
213inline
214double
215Helix::radius(void) const {
216 return m_r;
217}
218
219inline
220Hep3Vector
221Helix::direction(double phi) const {
222 return momentum(phi).unit();
223}
224
225inline
226double
227Helix::dr(void) const {
228 return m_ac[0];
229}
230
231inline
232double
233Helix::phi0(void) const {
234 return m_ac[1];
235}
236
237inline
238double
239Helix::kappa(void) const {
240 return m_ac[2];
241}
242
243inline
244double
245Helix::dz(void) const {
246 return m_ac[3];
247}
248
249inline
250double
251Helix::tanl(void) const {
252 return m_ac[4];
253}
254
255inline
256double
257Helix::curv(void) const {
258 return m_r;
259}
260
261inline
262const HepVector &
263Helix::a(void) const {
264 return m_a;
265}
266
267inline
268const HepSymMatrix &
269Helix::Ea(void) const {
270 return m_Ea;
271}
272
273inline
274const HepVector &
275Helix::a(const HepVector & i) {
276 m_a = i;
277 updateCache();
278 return m_a;
279}
280
281inline
282const HepSymMatrix &
283Helix::Ea(const HepSymMatrix & i) {
284 return m_Ea = i;
285}
286
287inline
288double
289Helix::bFieldZ(double a) {
290 m_bField = a;
291 m_alpha = 10000. / 2.99792458 / m_bField;
292 updateCache();
293 return m_bField;
294}
295
296inline
297double
298Helix::bFieldZ(void) const {
299 return m_bField;
300}
301
302inline
303double
304Helix::sinPhi0(void) const {
305 return m_sp;
306}
307
308inline
309double
310Helix::cosPhi0(void) const {
311 return m_cp;
312}
313
314#endif
315
316#undef inline
317
318#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]
NTuple::Item< double > m_pt
Definition MdcHistItem.h:76
double bFieldZ(double)
sets/returns z componet of the magnetic field.
const HepPoint3D & center(void) const
returns position of helix center(z = 0.);
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 radius(void) const
returns radious of helix.
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