#include <MdcTrackUtil.h>
Public Member Functions | |
MdcTrackUtil () | |
~MdcTrackUtil () | |
int | nLayerTrackPassed (const HepVector helix) |
int | nLayerTrackPassed (const double helix[5]) |
HepVector | patRecPar2BesPar (const HepVector &helixPar) |
HepSymMatrix | patRecErr2BesErr (const HepSymMatrix &err) |
Static Public Member Functions | |
static MdcTrackUtil * | instance () |
Private Attributes | |
MdcGeomSvc * | m_mdcGeomSvc |
IMagneticFieldSvc * | m_pIMF |
double | Bz |
Static Private Attributes | |
static MdcTrackUtil * | _myself = 0 |
Definition at line 8 of file MdcTrackUtil.h.
MdcTrackUtil::MdcTrackUtil | ( | ) |
Definition at line 39 of file MdcTrackUtil.cxx.
References Bz, IMagneticFieldSvc::getReferField(), m_mdcGeomSvc, and m_pIMF.
Referenced by instance().
00039 { 00040 //Initalze magnetic flied 00041 IService* svc; 00042 Gaudi::svcLocator()->getService("MagneticFieldSvc",svc); 00043 m_pIMF = dynamic_cast<IMagneticFieldSvc*> (svc); 00044 if(! m_pIMF){ 00045 std::cout<<" ERROR Unable to open Magnetic field service "<<std::endl; 00046 } 00047 //get Bz for Check TEMP, Bz may be changed by run 00048 double gaussToTesla = 1000.; 00049 Bz = m_pIMF->getReferField()*gaussToTesla; 00050 00051 // Initialize MdcGeomSvc 00052 Gaudi::svcLocator()->getService("MdcGeomSvc",svc); 00053 m_mdcGeomSvc= dynamic_cast<MdcGeomSvc*> (svc); 00054 if(! m_mdcGeomSvc){ 00055 std::cout<<" FATAL Could not load MdcGeomSvc! "<<std::endl; 00056 } 00057 }
MdcTrackUtil::~MdcTrackUtil | ( | ) | [inline] |
MdcTrackUtil * MdcTrackUtil::instance | ( | ) | [static] |
Definition at line 31 of file MdcTrackUtil.cxx.
References _myself, and MdcTrackUtil().
00031 { 00032 if( 0 == _myself ) { 00033 _myself = new MdcTrackUtil(); 00034 } 00035 return _myself; 00036 }
int MdcTrackUtil::nLayerTrackPassed | ( | const double | helix[5] | ) |
Definition at line 68 of file MdcTrackUtil.cxx.
References alpha, Bz, MdcGeomSvc::Layer(), MdcGeoLayer::Length(), m_mdcGeomSvc, phi0, and MdcGeoLayer::Radius().
00068 { 00069 int nLayer = 0; 00070 00071 for(unsigned iLayer=0; iLayer<43; iLayer++){ 00072 //flightLength is the path length of track in the x-y plane 00073 //guess flightLength by the radius in middle of the wire. 00074 double rMidLayer = m_mdcGeomSvc->Layer(iLayer)->Radius(); 00075 double flightLength = rMidLayer; 00076 00077 HepPoint3D pivot(0.,0.,0.); 00078 double dz = helix[3]; 00079 double c = CLHEP::c_light * 100.; //unit from m/s to cm/s 00080 double alpha = 1/(c * Bz);//~333.567 00081 double kappa = helix[2]; 00082 double rc = (-1.)*alpha/kappa; 00083 //std::cout<<"MdcTrackUtil alpha "<<alpha<<std::endl; 00084 double tanl = helix[4]; 00085 double phi0 = helix[1]; 00086 double phi = flightLength/rc + phi0;//turning angle 00087 double z = pivot.z() + dz - (alpha/kappa) * tanl * phi; 00088 00089 double layerHalfLength = m_mdcGeomSvc->Layer(iLayer)->Length()/2.; 00090 00091 //std::cout<<"MdcTrackUtil length "<<layerHalfLength<<std::endl; 00092 00093 if (fabs(z) < fabs(layerHalfLength)) ++nLayer; 00094 } 00095 00096 return nLayer; 00097 }
int MdcTrackUtil::nLayerTrackPassed | ( | const HepVector | helix | ) |
Definition at line 60 of file MdcTrackUtil.cxx.
References genRecEmupikp::i.
00060 { 00061 double helixParam[5]; 00062 for(int i=0; i<5; ++i) helixParam[i] = helix[i]; 00063 00064 return nLayerTrackPassed(helixParam); 00065 }
HepSymMatrix MdcTrackUtil::patRecErr2BesErr | ( | const HepSymMatrix & | err | ) |
Definition at line 117 of file MdcTrackUtil.cxx.
References Bz.
00117 { 00118 //error matrix 00119 //std::cout<<" err1 "<<err<<" "<<err.num_row()<<std::endl; 00120 //V(Y)=S * V(X) * ST , mS = S , mVy = V(Y) , err() = V(X) 00121 //int n = err.num_row(); 00122 HepSymMatrix mS(err.num_row(),0); 00123 mS[0][0]=-1.;//dr0=-d0 00124 mS[1][1]=1.; 00125 mS[2][2]=Bz/-333.567;//pxy -> cpa 00126 mS[3][3]=1.; 00127 mS[4][4]=1.; 00128 HepSymMatrix mVy= err.similarity(mS); 00129 //std::cout<<" err2 "<<n<<" "<<mVy<<std::endl; 00130 return mVy; 00131 }
HepVector MdcTrackUtil::patRecPar2BesPar | ( | const HepVector & | helixPar | ) |
Definition at line 100 of file MdcTrackUtil.cxx.
00100 { 00101 HepVector helix(5,0); 00102 double d0 = -helixPar[0]; //cm 00103 double phi0 = helixPar[1]+ CLHEP::halfpi; 00104 double omega = Bz*helixPar[2]/-333.567; 00105 double z0 = helixPar[3]; //cm 00106 double tanl = helixPar[4]; 00107 helix[0] = d0; 00108 helix[1] = phi0; 00109 helix[2] = omega; 00110 helix[3] = z0; 00111 helix[4] = tanl; 00112 //std::cout<<"helix "<<helix<<std::endl; 00113 return helix; 00114 }
MdcTrackUtil * MdcTrackUtil::_myself = 0 [static, private] |
double MdcTrackUtil::Bz [private] |
Definition at line 24 of file MdcTrackUtil.h.
Referenced by MdcTrackUtil(), nLayerTrackPassed(), patRecErr2BesErr(), and patRecPar2BesPar().
MdcGeomSvc* MdcTrackUtil::m_mdcGeomSvc [private] |
Definition at line 22 of file MdcTrackUtil.h.
Referenced by MdcTrackUtil(), and nLayerTrackPassed().
IMagneticFieldSvc* MdcTrackUtil::m_pIMF [private] |