00001 #ifndef VertexFit_BField_H 00002 #define VertexFit_BField_H 00003 00004 // 00005 // Read field from MagneticField Service in Gaudi framework 00006 // Author: Min Xu data: 4/16/2008, created 00007 00008 #include "CLHEP/Geometry/Point3D.h" 00009 #include "CLHEP/Matrix/Vector.h" 00010 #ifndef ENABLE_BACKWARDS_COMPATIBILITY 00011 typedef HepGeom::Point3D<double> HepPoint3D; 00012 #endif 00013 00014 #ifndef BEAN 00015 #include "MagneticField/IMagneticFieldSvc.h" 00016 #else 00017 #include "MagneticField/MagneticFieldSvc.h" 00018 #endif 00019 00020 using CLHEP::HepVector; 00021 00022 class VertexFitBField { 00023 public : 00024 static VertexFitBField* instance() { 00025 if (s_bfield == 0) { 00026 s_bfield = new VertexFitBField(); 00027 } 00028 return s_bfield; 00029 } 00030 // constructor & deconstructor 00031 ~VertexFitBField() {} 00032 00033 double getBFieldZ(const HepPoint3D& vtx); 00034 double getBFieldZRef(); 00035 // get B*c = B*-0.00299792458 00036 double getCBz(const HepVector& vtx, const HepVector& trackPosition); 00037 00038 private : 00039 VertexFitBField(); 00040 00041 #ifndef BEAN 00042 IMagneticFieldSvc* m_pIMF; 00043 #else 00044 MagneticFieldSvc* m_pIMF; 00045 #endif 00046 00047 static VertexFitBField* s_bfield; 00048 static const double alpha; 00049 }; 00050 #endif