#include <FastVertexFit.h>
Public Member Functions | |
~FastVertexFit () | |
void | init () |
void | addTrack (const int number, const HepVector helix, const HepSymMatrix err) |
bool | Fit () |
double | chisq () const |
VertexParameter | vtx () const |
HepVector | Vx () const |
HepSymMatrix | Evx () const |
HepVector | Pull () const |
Static Public Member Functions | |
static FastVertexFit * | instance () |
Private Member Functions | |
void | updateMatrices (const HepVector helix, const HepSymMatrix err) |
FastVertexFit () | |
Private Attributes | |
std::vector< HepMatrix > | m_D |
std::vector< HepSymMatrix > | m_W |
std::vector< HepSymMatrix > | m_DTWD |
std::vector< HepVector > | m_xp |
double | m_chisq |
VertexParameter | m_vtx_infit |
HepVector | m_Vx |
HepSymMatrix | m_Evx |
Static Private Attributes | |
static FastVertexFit * | m_pointer = 0 |
Definition at line 18 of file FastVertexFit.h.
FastVertexFit::~FastVertexFit | ( | ) |
FastVertexFit::FastVertexFit | ( | ) | [private] |
void FastVertexFit::addTrack | ( | const int | number, | |
const HepVector | helix, | |||
const HepSymMatrix | err | |||
) |
Definition at line 29 of file FastVertexFit.cxx.
References alpha, cos(), VertexFitBField::getBFieldZRef(), VertexFitBField::instance(), m_D, m_DTWD, m_W, m_xp, and sin().
Referenced by DQASelHadron::execute().
00029 { 00030 int ifail; 00031 int ierr; 00032 //HepSymMatrix err0(5, 0); //inverse of err; 00033 //err0 = err.inverse(ifail); 00034 HepSymMatrix Wc(2, 0); 00035 Wc[0][0] = err[0][0]; 00036 Wc[0][1] = Wc[1][0] = err[0][3]; 00037 Wc[1][1] = err[3][3]; 00038 Wc = Wc.inverse(ifail); 00039 00040 HepVector p0(3, 0), v0(3, 0); 00041 double pxy = 1./fabs(helix[2]); 00042 p0[0] = 0 - pxy*sin(helix[1]); //px 00043 p0[1] = pxy*cos(helix[1]); //py 00044 p0[2] = pxy * helix[4]; //pz 00045 v0[0] = helix[0]*cos(helix[1]);//x 00046 v0[1] = helix[0]*sin(helix[1]);//y 00047 v0[2] = helix[3]; //z 00048 00049 HepPoint3D vv0(v0[0], v0[1], v0[2]); 00050 double bField = VertexFitBField::instance()->getBFieldZRef(); 00051 00052 int charge = (helix[2]>0 ? +1 :-1); 00053 double a = alpha * bField * charge; 00054 double T0 = sqrt((p0[0]+a*p0[1])*(p0[0]+a*p0[1])+(p0[1]-a*p0[0])*(p0[1]-a*p0[0])); 00055 00056 HepMatrix Dc(2, 3, 0); 00057 Dc[0][0] = (p0[1] - a*v0[0])/T0; 00058 Dc[0][1] = 0 - (p0[0] + a*v0[1])/T0; 00059 Dc[1][0] = 0 - (p0[2]/T0) * (p0[0] + a*v0[1])/T0; 00060 Dc[1][1] = 0 - (p0[2]/T0) * (p0[1] - a*v0[0])/T0; 00061 Dc[1][2] = 1; 00062 00063 m_D.push_back(Dc); 00064 m_W.push_back(Wc); 00065 00066 HepSymMatrix DTWD(3, 0); 00067 DTWD = Wc.similarity(Dc.T()); 00068 HepVector qTrk(2, 0); 00069 qTrk[0] = helix[0]; 00070 qTrk[1] = helix[3]; 00071 //HepVector xp(3, 0); 00072 //xp = Dc.inverse(ierr) * qTrk; 00073 m_DTWD.push_back(DTWD); 00074 m_xp.push_back(v0); 00075 }
double FastVertexFit::chisq | ( | ) | const [inline] |
Definition at line 38 of file FastVertexFit.h.
References m_chisq.
Referenced by Fit().
00038 {return m_chisq;}
HepSymMatrix FastVertexFit::Evx | ( | ) | const [inline] |
bool FastVertexFit::Fit | ( | ) |
Definition at line 77 of file FastVertexFit.cxx.
References chisq(), genRecEmupikp::i, m_chisq, m_DTWD, m_Evx, m_Vx, m_xp, and T.
Referenced by DQASelHadron::execute().
00077 { 00078 bool fitResult = false; 00079 00080 int ifail; 00081 HepSymMatrix total_DTWD(3, 0); 00082 HepVector total_xp(3, 0); 00083 00084 for(int i = 0; i < m_DTWD.size(); i++) { 00085 total_DTWD += m_DTWD[i]; 00086 total_xp += m_DTWD[i]*m_xp[i]; 00087 } 00088 m_Vx = total_DTWD.inverse(ifail) * total_xp; 00089 m_Evx = total_DTWD.inverse(ifail); 00090 00091 double chisq = 0; 00092 for(int i = 0; i < m_xp.size(); i++) { 00093 double chi2 = (m_DTWD[i].similarity((m_xp[i] - m_Vx).T()))[0][0]; 00094 chisq += chi2; 00095 } 00096 m_chisq = chisq; 00097 00098 fitResult = true; 00099 return fitResult; 00100 }
void FastVertexFit::init | ( | ) |
Definition at line 19 of file FastVertexFit.cxx.
References m_chisq, m_D, m_DTWD, m_Evx, m_Vx, m_W, and m_xp.
Referenced by DQASelHadron::execute().
00019 { 00020 m_D.clear(); 00021 m_W.clear(); 00022 m_DTWD.clear(); 00023 m_xp.clear(); 00024 m_chisq = 999; 00025 m_Vx = HepVector(3, 0); 00026 m_Evx = HepSymMatrix(3,0); 00027 }
FastVertexFit * FastVertexFit::instance | ( | ) | [static] |
Definition at line 9 of file FastVertexFit.cxx.
References FastVertexFit(), and m_pointer.
Referenced by DQASelHadron::execute().
00009 { 00010 if(m_pointer) return m_pointer; 00011 m_pointer = new FastVertexFit(); 00012 return m_pointer; 00013 }
HepVector FastVertexFit::Pull | ( | ) | const |
void FastVertexFit::updateMatrices | ( | const HepVector | helix, | |
const HepSymMatrix | err | |||
) | [private] |
VertexParameter FastVertexFit::vtx | ( | ) | const [inline] |
HepVector FastVertexFit::Vx | ( | ) | const [inline] |
Definition at line 40 of file FastVertexFit.h.
References m_Vx.
Referenced by DQASelHadron::execute().
00040 {return m_Vx;}
double FastVertexFit::m_chisq [private] |
std::vector<HepMatrix> FastVertexFit::m_D [private] |
std::vector<HepSymMatrix> FastVertexFit::m_DTWD [private] |
HepSymMatrix FastVertexFit::m_Evx [private] |
FastVertexFit * FastVertexFit::m_pointer = 0 [static, private] |
VertexParameter FastVertexFit::m_vtx_infit [private] |
HepVector FastVertexFit::m_Vx [private] |
std::vector<HepSymMatrix> FastVertexFit::m_W [private] |
std::vector<HepVector> FastVertexFit::m_xp [private] |