BOSS 7.0.4
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
 
 ~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 ()
 
static FastVertexFitinstance ()
 

Detailed Description

Constructor & Destructor Documentation

◆ ~FastVertexFit() [1/2]

FastVertexFit::~FastVertexFit ( )

Definition at line 15 of file FastVertexFit.cxx.

15{;}

◆ ~FastVertexFit() [2/2]

FastVertexFit::~FastVertexFit ( )

Member Function Documentation

◆ addTrack() [1/2]

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}
const double alpha
double sin(const BesAngle a)
double cos(const BesAngle a)

Referenced by DQASelHadron::execute().

◆ addTrack() [2/2]

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

◆ chisq() [1/2]

double FastVertexFit::chisq ( ) const
inline

Definition at line 38 of file Analysis/VertexFit/VertexFit-00-02-82/VertexFit/FastVertexFit.h.

38{return m_chisq;}

Referenced by Fit().

◆ chisq() [2/2]

double FastVertexFit::chisq ( ) const
inline

Definition at line 38 of file InstallArea/include/VertexFit/VertexFit/FastVertexFit.h.

38{return m_chisq;}

◆ Evx() [1/2]

HepSymMatrix FastVertexFit::Evx ( ) const
inline

Definition at line 41 of file Analysis/VertexFit/VertexFit-00-02-82/VertexFit/FastVertexFit.h.

41{return m_Evx;}

◆ Evx() [2/2]

HepSymMatrix FastVertexFit::Evx ( ) const
inline

Definition at line 41 of file InstallArea/include/VertexFit/VertexFit/FastVertexFit.h.

41{return m_Evx;}

◆ Fit() [1/2]

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}

Referenced by DQASelHadron::execute().

◆ Fit() [2/2]

bool FastVertexFit::Fit ( )

◆ init() [1/2]

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().

◆ init() [2/2]

void FastVertexFit::init ( )

◆ instance() [1/2]

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().

◆ instance() [2/2]

static FastVertexFit * FastVertexFit::instance ( )
static

◆ Pull() [1/2]

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}

◆ Pull() [2/2]

HepVector FastVertexFit::Pull ( ) const

◆ vtx() [1/2]

VertexParameter FastVertexFit::vtx ( ) const
inline

Definition at line 39 of file Analysis/VertexFit/VertexFit-00-02-82/VertexFit/FastVertexFit.h.

39{return m_vtx_infit;}

◆ vtx() [2/2]

VertexParameter FastVertexFit::vtx ( ) const
inline

Definition at line 39 of file InstallArea/include/VertexFit/VertexFit/FastVertexFit.h.

39{return m_vtx_infit;}

◆ Vx() [1/2]

HepVector FastVertexFit::Vx ( ) const
inline

Definition at line 40 of file Analysis/VertexFit/VertexFit-00-02-82/VertexFit/FastVertexFit.h.

40{return m_Vx;}

Referenced by DQASelHadron::execute().

◆ Vx() [2/2]

HepVector FastVertexFit::Vx ( ) const
inline

Definition at line 40 of file InstallArea/include/VertexFit/VertexFit/FastVertexFit.h.

40{return m_Vx;}

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