/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Reconstruction/KalFitAlg/KalFitAlg-00-07-55-p03/KalFitAlg/helix/Helix.h

Go to the documentation of this file.
00001 
00002 
00003 
00004 //   Author      Date         comments
00005 //   Y.Ohnishi   03/01/1997   original version
00006 //   Y.Ohnishi   06/03/1997   updated
00007 //   Y.Iwasaki   17/02/1998   BFILED removed, func. name changed, func. added
00008 //   J.Tanaka    06/12/1998   add some utilities.
00009 //   Y.Iwasaki   07/07/1998   cache added to speed up
00010 //   Y.Iwasaki   25/04/2001   cache m_ac[5] added to speed up
00011 //
00012 #ifndef Helix_FLAG_
00013 #define Helix_FLAG_
00014 
00015 #include "KalFitAlg/KalFitHitMdc.h"
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 
00036 using namespace CLHEP;
00037 
00038 namespace KalmanFit{
00039 
00041 class Helix {
00042 
00043   public:
00045     Helix(const HepPoint3D & pivot,
00046           const HepVector & a,
00047           const HepSymMatrix & Ea);
00048 
00050     Helix(const HepPoint3D & pivot,
00051           const HepVector & a);
00052 
00054     Helix(const HepPoint3D & position,
00055           const Hep3Vector & momentum,
00056           double charge);
00057 
00059     virtual ~Helix();
00060 
00061   public:// Selectors
00063     const HepPoint3D & center(void) const;
00064 
00066     const HepPoint3D & pivot(void) const;
00067 
00069     double radius(void) const;
00070 
00072     HepPoint3D x(double dPhi = 0.) const;
00073     double * x(double dPhi, double p[3]) const;
00074 
00076     HepPoint3D x(double dPhi, HepSymMatrix & Ex) const;
00077 
00079     Hep3Vector direction(double dPhi = 0.) const;
00080 
00082     Hep3Vector momentum(double dPhi = 0.) const;
00083 
00085     Hep3Vector momentum(double dPhi, HepSymMatrix & Em) const;
00086 
00088     HepLorentzVector momentum(double dPhi, double mass) const;
00089 
00091     HepLorentzVector momentum(double dPhi, double mass, HepSymMatrix & Em) const;
00092 
00094     HepLorentzVector momentum(double dPhi, double mass, HepPoint3D & x, HepSymMatrix & Emx) const;  
00095 
00096   public:// Parametrization dependent functions. Prepared for tracking codes. Users should not use them.
00098     double dr(void) const;
00099     double phi0(void) const;
00100     double kappa(void) const;
00101     double dz(void) const;
00102     double tanl(void) const;
00103     double curv(void) const;
00104     double sinPhi0(void) const;
00105     double cosPhi0(void) const;
00106 
00108     const HepVector & a(void) const;
00109 
00111     const HepSymMatrix & Ea(void) const;
00112 
00113     double approach(KalFitHitMdc& hit, bool doSagCorrection) const;
00114  
00115     double approach(HepPoint3D pfwd, HepPoint3D pbwd,  bool doSagCorrection) const;
00116         
00117     
00118   public:// Modifiers
00120     const HepVector & a(const HepVector & newA); 
00121 
00123     const HepSymMatrix & Ea(const HepSymMatrix & newdA);
00124 
00126     const HepPoint3D & pivot(const HepPoint3D & newPivot);
00127 
00129     void set(const HepPoint3D & pivot,
00130              const HepVector & a,
00131              const HepSymMatrix & Ea);
00132 
00134     void ignoreErrorMatrix(void);
00135 
00137     double bFieldZ(double);
00138     double bFieldZ(void) const;
00139 
00141     double alpha(void) const;
00142     
00143   public:// Operators
00145     Helix & operator = (const Helix &);
00146 
00147   public:// Mathmatical functions
00148     HepMatrix delApDelA(const HepVector & ap) const;
00149     HepMatrix delXDelA(double phi) const;
00150     HepMatrix delMDelA(double phi) const;
00151     HepMatrix del4MDelA(double phi, double mass) const;
00152     HepMatrix del4MXDelA(double phi, double mass) const;
00153 
00154   private:
00155     IMagneticFieldSvc* m_pmgnIMF;
00156 
00157   private:
00158     void updateCache(void);
00159 
00160   public:
00162     static const double ConstantAlpha;
00163 
00164   private:
00165     double m_bField;
00166     double m_alpha;
00167     HepPoint3D m_pivot;
00168     HepVector m_a;
00169     HepSymMatrix m_Ea;
00170     bool m_matrixValid;
00171 
00172   private: // caches
00173     HepPoint3D m_center;
00174     double m_cp;
00175     double m_sp;
00176     double m_pt;
00177     double m_r;
00178     double m_ac[5];
00179 };
00180 
00181 //-----------------------------------------------------------------------------
00182 
00183 #ifdef Helix_NO_INLINE
00184 #define inline
00185 #else
00186 #undef inline
00187 #define Helix_INLINE_DEFINE_HERE
00188 #endif
00189 
00190 #ifdef Helix_INLINE_DEFINE_HERE
00191 
00192 inline
00193 const HepPoint3D &
00194 Helix::center(void) const {
00195     return m_center;
00196 }
00197 
00198 inline
00199 const HepPoint3D &
00200 Helix::pivot(void) const {
00201     return m_pivot;
00202 }
00203 
00204 inline
00205 double
00206 Helix::radius(void) const {
00207     return m_r;
00208 }
00209 
00210 inline
00211 Hep3Vector
00212 Helix::direction(double phi) const {
00213     return momentum(phi).unit();
00214 }
00215 
00216 inline
00217 double
00218 Helix::dr(void) const {
00219     return m_ac[0];
00220 }
00221 
00222 inline
00223 double
00224 Helix::phi0(void) const {
00225     return m_ac[1];
00226 }
00227 
00228 inline
00229 double
00230 Helix::kappa(void) const {
00231     return m_ac[2];
00232 }
00233 
00234 inline
00235 double
00236 Helix::dz(void) const {
00237     return m_ac[3];
00238 }
00239 
00240 inline
00241 double
00242 Helix::tanl(void) const {
00243     return m_ac[4];
00244 }
00245 
00246 inline
00247 double
00248 Helix::curv(void) const {
00249     return m_r;
00250 }
00251 
00252 inline
00253 const HepVector &
00254 Helix::a(void) const {
00255     return m_a;
00256 }
00257 
00258 inline
00259 const HepSymMatrix &
00260 Helix::Ea(void) const {
00261     return m_Ea;
00262 }
00263 
00264 inline
00265 const HepVector &
00266 Helix::a(const HepVector & i) {
00267     m_a = i;
00268     updateCache();
00269     return m_a;
00270 }
00271 
00272 inline
00273 const HepSymMatrix &
00274 Helix::Ea(const HepSymMatrix & i) {
00275     return m_Ea = i;
00276 }
00277 
00278 inline
00279 double
00280 Helix::bFieldZ(double a) {
00281     m_bField = a;
00282     m_alpha = 10000. / 2.99792458 / m_bField;
00283 
00284     //std::cout<<"m_alpha: "<<m_alpha<<std::endl;
00285     updateCache();
00286     return m_bField;
00287 }
00288 
00289 
00290 inline
00291 double
00292 Helix::alpha(void) const {
00293 
00294   return m_alpha;
00295 }
00296 
00297 
00298 inline
00299 double
00300 Helix::bFieldZ(void) const {
00301     return m_bField;
00302 }
00303 
00304 inline
00305 double
00306 Helix::sinPhi0(void) const {
00307     return m_sp;
00308 }
00309 
00310 inline
00311 double
00312 Helix::cosPhi0(void) const {
00313     return m_cp;
00314 }
00315 
00316 #endif
00317 
00318 #undef inline
00319 
00320 }
00321 
00322 
00323 #endif /* Helix_FLAG_ */

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