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