BOSS 7.1.2
BESIII Offline Software System
Loading...
Searching...
No Matches
MdcTrackUtil Class Reference

#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 MdcTrackUtilinstance ()
 

Detailed Description

Definition at line 8 of file MdcTrackUtil.h.

Constructor & Destructor Documentation

◆ MdcTrackUtil()

MdcTrackUtil::MdcTrackUtil ( )

Definition at line 39 of file MdcTrackUtil.cxx.

39 {
40 //Initalze magnetic flied
41 IService* svc;
42 Gaudi::svcLocator()->getService("MagneticFieldSvc",svc);
43 m_pIMF = dynamic_cast<IMagneticFieldSvc*> (svc);
44 if(! m_pIMF){
45 std::cout<<" ERROR Unable to open Magnetic field service "<<std::endl;
46 }
47 //get Bz for Check TEMP, Bz may be changed by run
48 double gaussToTesla = 1000.;
49 Bz = m_pIMF->getReferField()*gaussToTesla;
50
51 // Initialize MdcGeomSvc
52 Gaudi::svcLocator()->getService("MdcGeomSvc",svc);
53 m_mdcGeomSvc= dynamic_cast<MdcGeomSvc*> (svc);
54 if(! m_mdcGeomSvc){
55 std::cout<<" FATAL Could not load MdcGeomSvc! "<<std::endl;
56 }
57}
virtual double getReferField()=0

Referenced by instance().

◆ ~MdcTrackUtil()

MdcTrackUtil::~MdcTrackUtil ( )
inline

Definition at line 12 of file MdcTrackUtil.h.

12{};

Member Function Documentation

◆ instance()

MdcTrackUtil * MdcTrackUtil::instance ( )
static

Definition at line 31 of file MdcTrackUtil.cxx.

31 {
32 if( 0 == _myself ) {
33 _myself = new MdcTrackUtil();
34 }
35 return _myself;
36}

◆ nLayerTrackPassed() [1/2]

int MdcTrackUtil::nLayerTrackPassed ( const double helix[5])

Definition at line 68 of file MdcTrackUtil.cxx.

68 {
69 int nLayer = 0;
70
71 for(unsigned iLayer=0; iLayer<43; iLayer++){
72 //flightLength is the path length of track in the x-y plane
73 //guess flightLength by the radius in middle of the wire.
74 double rMidLayer = m_mdcGeomSvc->Layer(iLayer)->Radius();
75 double flightLength = rMidLayer;
76
77 HepPoint3D pivot(0.,0.,0.);
78 double dz = helix[3];
79 double c = CLHEP::c_light * 100.; //unit from m/s to cm/s
80 double alpha = 1/(c * Bz);//~333.567
81 double kappa = helix[2];
82 double rc = (-1.)*alpha/kappa;
83 //std::cout<<"MdcTrackUtil alpha "<<alpha<<std::endl;
84 double tanl = helix[4];
85 double phi0 = helix[1];
86 double phi = flightLength/rc + phi0;//turning angle
87 double z = pivot.z() + dz - (alpha/kappa) * tanl * phi;
88
89 double layerHalfLength = m_mdcGeomSvc->Layer(iLayer)->Length()/2.;
90
91 //std::cout<<"MdcTrackUtil length "<<layerHalfLength<<std::endl;
92
93 if (fabs(z) < fabs(layerHalfLength)) ++nLayer;
94 }
95
96 return nLayer;
97}
const double alpha
double Radius(void) const
double Length(void) const
const MdcGeoLayer *const Layer(unsigned id)

◆ nLayerTrackPassed() [2/2]

int MdcTrackUtil::nLayerTrackPassed ( const HepVector helix)

Definition at line 60 of file MdcTrackUtil.cxx.

60 {
61 double helixParam[5];
62 for(int i=0; i<5; ++i) helixParam[i] = helix[i];
63
64 return nLayerTrackPassed(helixParam);
65}
int nLayerTrackPassed(const HepVector helix)

Referenced by nLayerTrackPassed().

◆ patRecErr2BesErr()

HepSymMatrix MdcTrackUtil::patRecErr2BesErr ( const HepSymMatrix & err)

Definition at line 117 of file MdcTrackUtil.cxx.

117 {
118 //error matrix
119 //std::cout<<" err1 "<<err<<" "<<err.num_row()<<std::endl;
120 //V(Y)=S * V(X) * ST , mS = S , mVy = V(Y) , err() = V(X)
121 //int n = err.num_row();
122 HepSymMatrix mS(err.num_row(),0);
123 mS[0][0]=-1.;//dr0=-d0
124 mS[1][1]=1.;
125 mS[2][2]=Bz/-333.567;//pxy -> cpa
126 mS[3][3]=1.;
127 mS[4][4]=1.;
128 HepSymMatrix mVy= err.similarity(mS);
129 //std::cout<<" err2 "<<n<<" "<<mVy<<std::endl;
130 return mVy;
131}

◆ patRecPar2BesPar()

HepVector MdcTrackUtil::patRecPar2BesPar ( const HepVector & helixPar)

Definition at line 100 of file MdcTrackUtil.cxx.

100 {
101 HepVector helix(5,0);
102 double d0 = -helixPar[0]; //cm
103 double phi0 = helixPar[1]+ CLHEP::halfpi;
104 double omega = Bz*helixPar[2]/-333.567;
105 double z0 = helixPar[3]; //cm
106 double tanl = helixPar[4];
107 helix[0] = d0;
108 helix[1] = phi0;
109 helix[2] = omega;
110 helix[3] = z0;
111 helix[4] = tanl;
112 //std::cout<<"helix "<<helix<<std::endl;
113 return helix;
114}

The documentation for this class was generated from the following files: