BOSS 6.6.4.p03
BESIII Offline Software System
Loading...
Searching...
No Matches
Analysis/VertexFit/VertexFit-00-02-71/VertexFit/Helix.h
Go to the documentation of this file.
1//
2// $Id: Helix.h,v 1.5 2011/04/11 13:31:08 azhemchugov Exp $
3//
4// Class VFHelix
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 VertexFit_VFHelix_FLAG_
15#define VertexFit_VFHelix_FLAG_
16
17#include "CLHEP/Matrix/Matrix.h"
18#include "CLHEP/Matrix/Vector.h"
19#include "CLHEP/Matrix/SymMatrix.h"
20using CLHEP::HepMatrix;
21using CLHEP::HepVector;
22using CLHEP::HepSymMatrix;
23#ifndef CLHEP_THREEVECTOR_H
24#include "CLHEP/Vector/ThreeVector.h"
25using CLHEP::Hep3Vector;
26#endif
27#include "CLHEP/Vector/LorentzVector.h"
28using CLHEP::HepLorentzVector;
29#ifndef CLHEP_POINT3D_H
30#include "CLHEP/Geometry/Point3D.h"
31#ifndef ENABLE_BACKWARDS_COMPATIBILITY
33#endif
34
35#endif
36
37/// VFHelix parameter class
38class VFHelix {
39
40 public:
41 /// Constructor with pivot, helix parameter a, and its error matrix.
42 VFHelix(const HepPoint3D & pivot,
43 const HepVector & a,
44 const HepSymMatrix & Ea);
45
46 /// Constructor without error matrix.
47 VFHelix(const HepPoint3D & pivot,
48 const HepVector & a);
49
50 /// Constructor with position, momentum, and charge.
51 VFHelix(const HepPoint3D & position,
52 const Hep3Vector & momentum,
53 double charge);
54
55 /// Destructor
56 virtual ~VFHelix();
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.
126 void ignoreErrorMatrix(void);
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
134 VFHelix & operator = (const VFHelix &);
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 void updateCache(void);
145
146 public:
147 /// Constant alpha for uniform field.
148 static const double ConstantAlpha;
149
150 private:
151 double m_bField;
152 double m_alpha;
153 HepPoint3D m_pivot;
154 HepVector m_a;
155 HepSymMatrix m_Ea;
156 bool m_matrixValid;
157
158 private: // caches
159 HepPoint3D m_center;
160 double m_cp;
161 double m_sp;
162 double m_pt;
163 double m_r;
164 double m_ac[5];
165};
166
167//-----------------------------------------------------------------------------
168
169#ifdef VFHelix_NO_INLINE
170#define inline
171#else
172#undef inline
173#define VFHelix_INLINE_DEFINE_HERE
174#endif
175
176#ifdef VFHelix_INLINE_DEFINE_HERE
177
178inline
179const HepPoint3D &
180VFHelix::center(void) const {
181 return m_center;
182}
183
184inline
185const HepPoint3D &
186VFHelix::pivot(void) const {
187 return m_pivot;
188}
189
190inline
191double
192VFHelix::radius(void) const {
193 return m_r;
194}
195
196inline
197Hep3Vector
198VFHelix::direction(double phi) const {
199 return momentum(phi).unit();
200}
201
202inline
203double
204VFHelix::dr(void) const {
205 return m_ac[0];
206}
207
208inline
209double
210VFHelix::phi0(void) const {
211 return m_ac[1];
212}
213
214inline
215double
216VFHelix::kappa(void) const {
217 return m_ac[2];
218}
219
220inline
221double
222VFHelix::dz(void) const {
223 return m_ac[3];
224}
225
226inline
227double
228VFHelix::tanl(void) const {
229 return m_ac[4];
230}
231
232inline
233double
234VFHelix::curv(void) const {
235 return m_r;
236}
237
238inline
239const HepVector &
240VFHelix::a(void) const {
241 return m_a;
242}
243
244inline
245const HepSymMatrix &
246VFHelix::Ea(void) const {
247 return m_Ea;
248}
249
250inline
251const HepVector &
252VFHelix::a(const HepVector & i) {
253 m_a = i;
254 updateCache();
255 return m_a;
256}
257
258inline
259const HepSymMatrix &
260VFHelix::Ea(const HepSymMatrix & i) {
261 return m_Ea = i;
262}
263
264inline
265double
267 m_bField = a;
268 m_alpha = 10000. / 2.99792458 / m_bField;
269 updateCache();
270 return m_bField;
271}
272
273inline
274double
275VFHelix::bFieldZ(void) const {
276 return m_bField;
277}
278
279inline
280double
281VFHelix::sinPhi0(void) const {
282 return m_sp;
283}
284
285inline
286double
287VFHelix::cosPhi0(void) const {
288 return m_cp;
289}
290
291#endif
292
293#undef inline
294
295#endif /* VertexFit_Helix_FLAG_ */
HepGeom::Point3D< double > HepPoint3D
**********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]
static const double ConstantAlpha
Constant alpha for uniform field.
HepMatrix del4MDelA(double phi, double mass) const
const HepPoint3D & pivot(void) const
returns pivot position.
double radius(void) const
returns radious of helix.
HepPoint3D x(double dPhi=0.) const
returns position after rotating angle dPhi in phi direction.
HepMatrix delApDelA(const HepVector &ap) const
double dr(void) const
returns an element of parameters.
HepMatrix delMDelA(double phi) const
HepMatrix del4MXDelA(double phi, double mass) const
HepMatrix delXDelA(double phi) const
Hep3Vector direction(double dPhi=0.) const
returns direction vector after rotating angle dPhi in phi direction.
void ignoreErrorMatrix(void)
unsets error matrix. Error calculations will be ignored after this function call until an error matri...
void set(const HepPoint3D &pivot, const HepVector &a, const HepSymMatrix &Ea)
sets helix pivot position, parameters, and error matrix.
VFHelix & operator=(const VFHelix &)
Copy operator.
const HepSymMatrix & Ea(void) const
returns error matrix.
const HepVector & a(void) const
returns helix parameters.
const HepPoint3D & center(void) const
returns position of helix center(z = 0.);