/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Reconstruction/TrackUtil/TrackUtil-00-00-08/TrackUtil/Helix.h

Go to the documentation of this file.
00001 //
00002 // $Id: Helix.h,v 1.4 2011/05/12 10:25:28 wangll Exp $
00003 //
00004 //   Class Helix 
00005 //
00006 //   Author      Date         comments
00007 //   Y.Ohnishi   03/01/1997   original version
00008 //   Y.Ohnishi   06/03/1997   updated
00009 //   Y.Iwasaki   17/02/1998   BFILED removed, func. name changed, func. added
00010 //   J.Tanaka    06/12/1998   add some utilities.
00011 //   Y.Iwasaki   07/07/1998   cache added to speed up
00012 //   Y.Iwasaki   25/04/2001   cache m_ac[5] added to speed up
00013 //
00014 #ifndef Helix_FLAG_
00015 #define Helix_FLAG_
00016 #include "GaudiKernel/IInterface.h"
00017 #include "GaudiKernel/Kernel.h"
00018 #include "GaudiKernel/Service.h"
00019 #include "MagneticField/IMagneticFieldSvc.h"
00020 #include "MagneticField/MagneticFieldSvc.h"
00021 
00022 #include "CLHEP/Matrix/Vector.h"
00023 #include "CLHEP/Matrix/SymMatrix.h"
00024 //#ifndef CLHEP_THREEVECTOR_H
00025 #include "CLHEP/Vector/ThreeVector.h"
00026 //#endif
00027 #include "CLHEP/Vector/LorentzVector.h"
00028 //#ifndef CLHEP_POINT3D_H
00029 #include "CLHEP/Geometry/Point3D.h"
00030 //#endif
00031 
00032 #ifndef ENABLE_BACKWARDS_COMPATIBILITY
00033 typedef HepGeom::Point3D<double> HepPoint3D;
00034 #endif
00035 using namespace CLHEP;
00036 
00037 using HepGeom::Point3D;
00038 
00039 typedef CLHEP::HepVector Vector;
00040 typedef CLHEP::HepSymMatrix SymMatrix;
00041 typedef CLHEP::Hep3Vector Vector3;
00042 typedef CLHEP::HepLorentzVector VectorL;
00043 typedef CLHEP::HepLorentzVector Vector4;
00044 typedef CLHEP::HepMatrix Matrix;
00045 
00046 using CLHEP::HepVector;
00047 using CLHEP::HepSymMatrix;
00048 using CLHEP::Hep3Vector;
00049 using CLHEP::HepLorentzVector;
00050 
00051 
00053 class Helix {
00054 
00055   public:
00057     Helix(const HepPoint3D & pivot,
00058           const HepVector & a,
00059           const HepSymMatrix & Ea);
00060 
00062     Helix(const HepPoint3D & pivot,
00063           const HepVector & a);
00064 
00066     Helix(const HepPoint3D & position,
00067           const Hep3Vector & momentum,
00068           double charge);
00069 
00071     virtual ~Helix();
00072 
00073   public:// Selectors
00075     const HepPoint3D & center(void) const;
00076 
00078     const HepPoint3D & pivot(void) const;
00079 
00081     double radius(void) const;
00082 
00084     HepPoint3D x(double dPhi = 0.) const;
00085     double * x(double dPhi, double p[3]) const;
00086 
00088     HepPoint3D x(double dPhi, HepSymMatrix & Ex) const;
00089 
00091     Hep3Vector direction(double dPhi = 0.) const;
00092 
00094     Hep3Vector momentum(double dPhi = 0.) const;
00095 
00097     Hep3Vector momentum(double dPhi, HepSymMatrix & Em) const;
00098 
00100     HepLorentzVector momentum(double dPhi, double mass) const;
00101 
00103     HepLorentzVector momentum(double dPhi, double mass, HepSymMatrix & Em) const;
00104 
00106     HepLorentzVector momentum(double dPhi, double mass, HepPoint3D & x, HepSymMatrix & Emx) const;  
00107 
00108   public:// Parametrization dependent functions. Prepared for tracking codes. Users should not use them.
00110     double dr(void) const;
00111     double phi0(void) const;
00112     double kappa(void) const;
00113     double dz(void) const;
00114     double tanl(void) const;
00115     double curv(void) const;
00116     double sinPhi0(void) const;
00117     double cosPhi0(void) const;
00118 
00120     const HepVector & a(void) const;
00121 
00123     const HepSymMatrix & Ea(void) const;
00124 
00125     double pt(void) const{ return m_pt; }
00126     double cosTheta(void) const{ return m_a[4]/sqrt(1.+ m_a[4]*m_a[4]); }
00127   public:// Modifiers
00129     const HepVector & a(const HepVector & newA); 
00130 
00132     const HepSymMatrix & Ea(const HepSymMatrix & newdA);
00133 
00135     const HepPoint3D & pivot(const HepPoint3D & newPivot);
00136 
00138     void set(const HepPoint3D & pivot,
00139              const HepVector & a,
00140              const HepSymMatrix & Ea);
00141 
00143     void ignoreErrorMatrix(void);
00144 
00146     double bFieldZ(double);
00147     double bFieldZ(void) const;
00148 
00149   public:// Operators
00151     Helix & operator = (const Helix &);
00152 
00153   public:// Mathmatical functions
00154     HepMatrix delApDelA(const HepVector & ap) const;
00155     HepMatrix delXDelA(double phi) const;
00156     HepMatrix delMDelA(double phi) const;
00157     HepMatrix del4MDelA(double phi, double mass) const;
00158     HepMatrix del4MXDelA(double phi, double mass) const;
00159 
00160   //private:
00161   protected:
00162     IMagneticFieldSvc* m_pmgnIMF;
00163     double m_bField;
00164     double m_alpha;
00165 
00166   private:
00167     void updateCache(void);
00168 
00169   public:
00171     static const double ConstantAlpha;
00172 
00173   private:
00174     //double m_bField;
00175     //double m_alpha;
00176     HepPoint3D m_pivot;
00177     HepVector m_a;
00178     HepSymMatrix m_Ea;
00179     bool m_matrixValid;
00180 
00181   private: // caches
00182     HepPoint3D m_center;
00183     double m_cp;
00184     double m_sp;
00185     double m_pt;
00186     double m_r;
00187     double m_ac[5];
00188 };
00189 
00190 //-----------------------------------------------------------------------------
00191 
00192 #ifdef Helix_NO_INLINE
00193 #define inline
00194 #else
00195 #undef inline
00196 #define Helix_INLINE_DEFINE_HERE
00197 #endif
00198 
00199 #ifdef Helix_INLINE_DEFINE_HERE
00200 
00201 inline
00202 const HepPoint3D &
00203 Helix::center(void) const {
00204     return m_center;
00205 }
00206 
00207 inline
00208 const HepPoint3D &
00209 Helix::pivot(void) const {
00210     return m_pivot;
00211 }
00212 
00213 inline
00214 double
00215 Helix::radius(void) const {
00216     return m_r;
00217 }
00218 
00219 inline
00220 Hep3Vector
00221 Helix::direction(double phi) const {
00222     return momentum(phi).unit();
00223 }
00224 
00225 inline
00226 double
00227 Helix::dr(void) const {
00228     return m_ac[0];
00229 }
00230 
00231 inline
00232 double
00233 Helix::phi0(void) const {
00234     return m_ac[1];
00235 }
00236 
00237 inline
00238 double
00239 Helix::kappa(void) const {
00240     return m_ac[2];
00241 }
00242 
00243 inline
00244 double
00245 Helix::dz(void) const {
00246     return m_ac[3];
00247 }
00248 
00249 inline
00250 double
00251 Helix::tanl(void) const {
00252     return m_ac[4];
00253 }
00254 
00255 inline
00256 double
00257 Helix::curv(void) const {
00258     return m_r;
00259 }
00260 
00261 inline
00262 const HepVector &
00263 Helix::a(void) const {
00264     return m_a;
00265 }
00266 
00267 inline
00268 const HepSymMatrix &
00269 Helix::Ea(void) const {
00270     return m_Ea;
00271 }
00272 
00273 inline
00274 const HepVector &
00275 Helix::a(const HepVector & i) {
00276     m_a = i;
00277     updateCache();
00278     return m_a;
00279 }
00280 
00281 inline
00282 const HepSymMatrix &
00283 Helix::Ea(const HepSymMatrix & i) {
00284     return m_Ea = i;
00285 }
00286 
00287 inline
00288 double
00289 Helix::bFieldZ(double a) {
00290     m_bField = a;
00291     m_alpha = 10000. / 2.99792458 / m_bField;
00292     updateCache();
00293     return m_bField;
00294 }
00295 
00296 inline
00297 double
00298 Helix::bFieldZ(void) const {
00299     return m_bField;
00300 }
00301 
00302 inline
00303 double
00304 Helix::sinPhi0(void) const {
00305     return m_sp;
00306 }
00307 
00308 inline
00309 double
00310 Helix::cosPhi0(void) const {
00311     return m_cp;
00312 }
00313 
00314 #endif
00315 
00316 #undef inline
00317 
00318 #endif /* Helix_FLAG_ */

Generated on Tue Nov 29 22:57:40 2016 for BOSS_7.0.2 by  doxygen 1.4.7