BOSS 7.0.6
BESIII Offline Software System
Loading...
Searching...
No Matches
FastVertexFit Class Reference

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

Detailed Description

Definition at line 18 of file FastVertexFit.h.

Constructor & Destructor Documentation

◆ ~FastVertexFit()

FastVertexFit::~FastVertexFit ( )

Definition at line 15 of file FastVertexFit.cxx.

15{;}

Member Function Documentation

◆ addTrack()

void FastVertexFit::addTrack ( const int  number,
const HepVector  helix,
const HepSymMatrix  err 
)

Definition at line 29 of file FastVertexFit.cxx.

29 {
30 int ifail;
31 int ierr;
32 //HepSymMatrix err0(5, 0); //inverse of err;
33 //err0 = err.inverse(ifail);
34 HepSymMatrix Wc(2, 0);
35 Wc[0][0] = err[0][0];
36 Wc[0][1] = Wc[1][0] = err[0][3];
37 Wc[1][1] = err[3][3];
38 Wc = Wc.inverse(ifail);
39
40 HepVector p0(3, 0), v0(3, 0);
41 double pxy = 1./fabs(helix[2]);
42 p0[0] = 0 - pxy*sin(helix[1]); //px
43 p0[1] = pxy*cos(helix[1]); //py
44 p0[2] = pxy * helix[4]; //pz
45 v0[0] = helix[0]*cos(helix[1]);//x
46 v0[1] = helix[0]*sin(helix[1]);//y
47 v0[2] = helix[3]; //z
48
49 HepPoint3D vv0(v0[0], v0[1], v0[2]);
50 double bField = VertexFitBField::instance()->getBFieldZRef();
51
52 int charge = (helix[2]>0 ? +1 :-1);
53 double a = alpha * bField * charge;
54 double T0 = sqrt((p0[0]+a*p0[1])*(p0[0]+a*p0[1])+(p0[1]-a*p0[0])*(p0[1]-a*p0[0]));
55
56 HepMatrix Dc(2, 3, 0);
57 Dc[0][0] = (p0[1] - a*v0[0])/T0;
58 Dc[0][1] = 0 - (p0[0] + a*v0[1])/T0;
59 Dc[1][0] = 0 - (p0[2]/T0) * (p0[0] + a*v0[1])/T0;
60 Dc[1][1] = 0 - (p0[2]/T0) * (p0[1] - a*v0[0])/T0;
61 Dc[1][2] = 1;
62
63 m_D.push_back(Dc);
64 m_W.push_back(Wc);
65
66 HepSymMatrix DTWD(3, 0);
67 DTWD = Wc.similarity(Dc.T());
68 HepVector qTrk(2, 0);
69 qTrk[0] = helix[0];
70 qTrk[1] = helix[3];
71 //HepVector xp(3, 0);
72 //xp = Dc.inverse(ierr) * qTrk;
73 m_DTWD.push_back(DTWD);
74 m_xp.push_back(v0);
75}
double sin(const BesAngle a)
Definition: BesAngle.h:210
double cos(const BesAngle a)
Definition: BesAngle.h:213
const double alpha
float charge

Referenced by DQASelHadron::execute().

◆ chisq()

double FastVertexFit::chisq ( ) const
inline

Definition at line 38 of file FastVertexFit.h.

38{return m_chisq;}

Referenced by Fit().

◆ Evx()

HepSymMatrix FastVertexFit::Evx ( ) const
inline

Definition at line 41 of file FastVertexFit.h.

41{return m_Evx;}

◆ Fit()

bool FastVertexFit::Fit ( )

Definition at line 77 of file FastVertexFit.cxx.

77 {
78 bool fitResult = false;
79
80 int ifail;
81 HepSymMatrix total_DTWD(3, 0);
82 HepVector total_xp(3, 0);
83
84 for(int i = 0; i < m_DTWD.size(); i++) {
85 total_DTWD += m_DTWD[i];
86 total_xp += m_DTWD[i]*m_xp[i];
87 }
88 m_Vx = total_DTWD.inverse(ifail) * total_xp;
89 m_Evx = total_DTWD.inverse(ifail);
90
91 double chisq = 0;
92 for(int i = 0; i < m_xp.size(); i++) {
93 double chi2 = (m_DTWD[i].similarity((m_xp[i] - m_Vx).T()))[0][0];
94 chisq += chi2;
95 }
96 m_chisq = chisq;
97
98 fitResult = true;
99 return fitResult;
100}
double chisq() const
Definition: FastVertexFit.h:38

Referenced by DQASelHadron::execute().

◆ init()

void FastVertexFit::init ( )

Definition at line 19 of file FastVertexFit.cxx.

19 {
20 m_D.clear();
21 m_W.clear();
22 m_DTWD.clear();
23 m_xp.clear();
24 m_chisq = 999;
25 m_Vx = HepVector(3, 0);
26 m_Evx = HepSymMatrix(3,0);
27}

Referenced by DQASelHadron::execute().

◆ instance()

FastVertexFit * FastVertexFit::instance ( )
static

Definition at line 9 of file FastVertexFit.cxx.

9 {
10 if(m_pointer) return m_pointer;
11 m_pointer = new FastVertexFit();
12 return m_pointer;
13}

Referenced by DQASelHadron::execute().

◆ Pull()

HepVector FastVertexFit::Pull ( ) const

Definition at line 102 of file FastVertexFit.cxx.

102 {
103 HepVector pull(3, 0);
104 pull[0] = m_Vx[0]/sqrt(m_Evx[0][0]);
105 pull[1] = m_Vx[1]/sqrt(m_Evx[1][1]);
106 pull[2] = m_Vx[2]/sqrt(m_Evx[2][2]);
107 return pull;
108}

◆ vtx()

VertexParameter FastVertexFit::vtx ( ) const
inline

Definition at line 39 of file FastVertexFit.h.

39{return m_vtx_infit;}

◆ Vx()

HepVector FastVertexFit::Vx ( ) const
inline

Definition at line 40 of file FastVertexFit.h.

40{return m_Vx;}

Referenced by DQASelHadron::execute().


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