BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
Analysis/VertexFit/include/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/SymMatrix.h"
19#include "CLHEP/Matrix/Vector.h"
20using CLHEP::HepMatrix;
21using CLHEP::HepSymMatrix;
22using CLHEP::HepVector;
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
32typedef HepGeom::Point3D<double> HepPoint3D;
33# endif
34
35#endif
36
37/// VFHelix parameter class
38class VFHelix {
39
40public:
41 /// Constructor with pivot, helix parameter a, and its error matrix.
42 VFHelix( const HepPoint3D& pivot, const HepVector& a, const HepSymMatrix& Ea );
43
44 /// Constructor without error matrix.
45 VFHelix( const HepPoint3D& pivot, const HepVector& a );
46
47 /// Constructor with position, momentum, and charge.
48 VFHelix( const HepPoint3D& position, const Hep3Vector& momentum, double charge );
49
50 /// Destructor
51 virtual ~VFHelix();
52
53public: // Selectors
54 /// returns position of helix center(z = 0.);
55 const HepPoint3D& center( void ) const;
56
57 /// returns pivot position.
58 const HepPoint3D& pivot( void ) const;
59
60 /// returns radious of helix.
61 double radius( void ) const;
62
63 /// returns position after rotating angle dPhi in phi direction.
64 HepPoint3D x( double dPhi = 0. ) const;
65 double* x( double dPhi, double p[3] ) const;
66
67 /// returns position and convariance matrix(Ex) after rotation.
68 HepPoint3D x( double dPhi, HepSymMatrix& Ex ) const;
69
70 /// returns direction vector after rotating angle dPhi in phi direction.
71 Hep3Vector direction( double dPhi = 0. ) const;
72
73 /// returns momentum vector after rotating angle dPhi in phi direction.
74 Hep3Vector momentum( double dPhi = 0. ) const;
75
76 /// returns momentum vector after rotating angle dPhi in phi direction.
77 Hep3Vector momentum( double dPhi, HepSymMatrix& Em ) const;
78
79 /// returns 4momentum vector after rotating angle dPhi in phi direction.
80 HepLorentzVector momentum( double dPhi, double mass ) const;
81
82 /// returns 4momentum vector after rotating angle dPhi in phi direction.
83 HepLorentzVector momentum( double dPhi, double mass, HepSymMatrix& Em ) const;
84
85 /// returns 4momentum vector after rotating angle dPhi in phi direction.
86 HepLorentzVector momentum( double dPhi, double mass, HepPoint3D& x,
87 HepSymMatrix& Emx ) const;
88
89public: // Parametrization dependent functions. Prepared for tracking codes. Users should not
90 // use them.
91 /// returns an element of parameters.
92 double dr( void ) const;
93 double phi0( void ) const;
94 double kappa( void ) const;
95 double dz( void ) const;
96 double tanl( void ) const;
97 double curv( void ) const;
98 double sinPhi0( void ) const;
99 double cosPhi0( void ) const;
100
101 /// returns helix parameters.
102 const HepVector& a( void ) const;
103
104 /// returns error matrix.
105 const HepSymMatrix& Ea( void ) const;
106
107public: // Modifiers
108 /// sets helix parameters.
109 const HepVector& a( const HepVector& newA );
110
111 /// sets helix paramters and error matrix.
112 const HepSymMatrix& Ea( const HepSymMatrix& newdA );
113
114 /// sets pivot position.
115 const HepPoint3D& pivot( const HepPoint3D& newPivot );
116
117 /// sets helix pivot position, parameters, and error matrix.
118 void set( const HepPoint3D& pivot, const HepVector& a, const HepSymMatrix& Ea );
119
120 /// unsets error matrix. Error calculations will be ignored after this function call until an
121 /// error matrix be set again. 0 matrix will be return as a return value for error matrix
122 /// when you call functions which returns an error matrix.
123 void ignoreErrorMatrix( void );
124
125 /// sets/returns z componet of the magnetic field.
126 double bFieldZ( double );
127 double bFieldZ( void ) const;
128
129public: // Operators
130 /// Copy operator
131 VFHelix& operator=( const VFHelix& );
132
133public: // Mathmatical functions
134 HepMatrix delApDelA( const HepVector& ap ) const;
135 HepMatrix delXDelA( double phi ) const;
136 HepMatrix delMDelA( double phi ) const;
137 HepMatrix del4MDelA( double phi, double mass ) const;
138 HepMatrix del4MXDelA( double phi, double mass ) const;
139
140private:
141 void updateCache( void );
142
143public:
144 /// Constant alpha for uniform field.
145 static const double ConstantAlpha;
146
147private:
148 double m_bField;
149 double m_alpha;
150 HepPoint3D m_pivot;
151 HepVector m_a;
152 HepSymMatrix m_Ea;
153 bool m_matrixValid;
154
155private: // caches
156 HepPoint3D m_center;
157 double m_cp;
158 double m_sp;
159 double m_pt;
160 double m_r;
161 double m_ac[5];
162};
163
164//-----------------------------------------------------------------------------
165
166#ifdef VFHelix_NO_INLINE
167# define inline
168#else
169# undef inline
170# define VFHelix_INLINE_DEFINE_HERE
171#endif
172
173#ifdef VFHelix_INLINE_DEFINE_HERE
174
175inline const HepPoint3D& VFHelix::center( void ) const { return m_center; }
176
177inline const HepPoint3D& VFHelix::pivot( void ) const { return m_pivot; }
178
179inline double VFHelix::radius( void ) const { return m_r; }
180
181inline Hep3Vector VFHelix::direction( double phi ) const { return momentum( phi ).unit(); }
182
183inline double VFHelix::dr( void ) const { return m_ac[0]; }
184
185inline double VFHelix::phi0( void ) const { return m_ac[1]; }
186
187inline double VFHelix::kappa( void ) const { return m_ac[2]; }
188
189inline double VFHelix::dz( void ) const { return m_ac[3]; }
190
191inline double VFHelix::tanl( void ) const { return m_ac[4]; }
192
193inline double VFHelix::curv( void ) const { return m_r; }
194
195inline const HepVector& VFHelix::a( void ) const { return m_a; }
196
197inline const HepSymMatrix& VFHelix::Ea( void ) const { return m_Ea; }
198
199inline const HepVector& VFHelix::a( const HepVector& i ) {
200 m_a = i;
201 updateCache();
202 return m_a;
203}
204
205inline const HepSymMatrix& VFHelix::Ea( const HepSymMatrix& i ) { return m_Ea = i; }
206
207inline double VFHelix::bFieldZ( double a ) {
208 m_bField = a;
209 m_alpha = 10000. / 2.99792458 / m_bField;
210 updateCache();
211 return m_bField;
212}
213
214inline double VFHelix::bFieldZ( void ) const { return m_bField; }
215
216inline double VFHelix::sinPhi0( void ) const { return m_sp; }
217
218inline double VFHelix::cosPhi0( void ) const { return m_cp; }
219
220#endif
221
222#undef inline
223
224#endif /* VertexFit_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
HepGeom::Point3D< double > HepPoint3D
Double_t x[10]
HepGeom::Point3D< double > HepPoint3D
virtual ~VFHelix()
Destructor.
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
Hep3Vector momentum(double dPhi=0.) const
returns momentum vector after rotating angle dPhi in phi direction.
HepMatrix delXDelA(double phi) const
Hep3Vector direction(double dPhi=0.) const
returns direction vector after rotating angle dPhi in phi direction.
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.
VFHelix(const HepPoint3D &pivot, const HepVector &a, const HepSymMatrix &Ea)
Constructor with pivot, helix parameter a, and its error matrix.
static const double ConstantAlpha
Constant alpha for uniform field.
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.);