BOSS 7.0.8
BESIII Offline Software System
Loading...
Searching...
No Matches
VertexFitRefine Class Reference

#include <VertexFitRefine.h>

Public Member Functions

 ~VertexFitRefine ()
 
void init ()
 
void AddTrack (const int index, RecMdcKalTrack *p, const RecMdcKalTrack::PidType pid)
 
void AddVertex (int number, VertexParameter vpar, std::vector< int > lis)
 
void AddVertex (int number, VertexParameter vpar, int n1, int n2)
 
void AddVertex (int number, VertexParameter vpar, int n1, int n2, int n3)
 
void AddVertex (int number, VertexParameter vpar, int n1, int n2, int n3, int n4)
 
void AddVertex (int number, VertexParameter vpar, int n1, int n2, int n3, int n4, int n5)
 
void AddVertex (int number, VertexParameter vpar, int n1, int n2, int n3, int n4, int n5, int n6)
 
void AddVertex (int number, VertexParameter vpar, int n1, int n2, int n3, int n4, int n5, int n6, int n7)
 
void AddVertex (int number, VertexParameter vpar, int n1, int n2, int n3, int n4, int n5, int n6, int n7, int n8)
 
void AddVertex (int number, VertexParameter vpar, int n1, int n2, int n3, int n4, int n5, int n6, int n7, int n8, int n9)
 
void AddVertex (int number, VertexParameter vpar, int n1, int n2, int n3, int n4, int n5, int n6, int n7, int n8, int n9, int n10)
 
void AddVertex (int number, VertexParameter vpar, int n1, int n2, int n3, int n4, int n5, int n6, int n7, int n8, int n9, int n10, int n11)
 
void AddVertex (int number, VertexParameter vpar, int n1, int n2, int n3, int n4, int n5, int n6, int n7, int n8, int n9, int n10, int n11, int n12)
 
void AddBeamFit (int number, VertexParameter vpar, int n)
 
void setIterNumber (const int niter=10)
 
void setChisqCut (const double chicut=1000, const double chiter=1.0e-3)
 
void setMagCorrFactor (const double factor=1.000)
 
bool Fit ()
 
bool Fit (int n)
 
double chisq () const
 
double chisq (int n) const
 
HepLorentzVector pfit (int n) const
 
HepPoint3D xfit (int n) const
 
HepVector w (int n) const
 
HepSymMatrix Ew (int n) const
 
WTrackParameter wtrk (int n) const
 
HepPoint3D vx (int n) const
 
HepVector Vx (int n) const
 
HepSymMatrix Evx (int n) const
 
double errorVx (int n, int i) const
 
VertexParameter vpar (int n) const
 
WTrackParameter wVirtualTrack (int n) const
 
int getPath () const
 

Static Public Member Functions

static VertexFitRefineinstance ()
 

Friends

class VertexFit
 

Detailed Description

Definition at line 27 of file VertexFitRefine.h.

Constructor & Destructor Documentation

◆ ~VertexFitRefine()

VertexFitRefine::~VertexFitRefine ( )

Definition at line 55 of file VertexFitRefine.cxx.

56{
57 vtxfit->init();
58}
void init()
Definition: VertexFit.cxx:29

Member Function Documentation

◆ AddBeamFit()

void VertexFitRefine::AddBeamFit ( int  number,
VertexParameter  vpar,
int  n 
)
inline

Definition at line 86 of file VertexFitRefine.cc.

87{
88 vtxfit->AddBeamFit(number, vpar, n);
89}
const Int_t n
VertexParameter vpar(int n) const
void AddBeamFit(int number, VertexParameter vpar, int n)
Definition: VertexFit.cxx:74

◆ AddTrack()

void VertexFitRefine::AddTrack ( const int  index,
RecMdcKalTrack p,
const RecMdcKalTrack::PidType  pid 
)

Definition at line 60 of file VertexFitRefine.cxx.

62{
63 m_trkIdxOrigin.push_back(index);
64 m_tracksOrigin.push_back(p);
65 m_trkPidOrigin.push_back(pid);
66 if (index != m_trkIdxOrigin.size() - 1) {
67 std::cerr << "TrackPool: wrong track index " << index << ", "
68 << m_trkIdxOrigin.size() << std::endl;
69 }
70
71 int idx = m_trkIdxOrigin.size() - 1;
72 m_tracksOrigin[idx]->setPidType(m_trkPidOrigin[idx]);
73 m_wtrkInfit.push_back(WTrackParameter(VTXPDGM::empikp[m_trkPidOrigin[idx]],
74 m_tracksOrigin[idx]->helix(),
75 m_tracksOrigin[idx]->err()));
76 vtxfit->AddTrack(m_trkIdxOrigin[idx], m_wtrkInfit[idx]);
77}
void AddTrack(const int number, const double mass, const RecMdcTrack *trk)
Definition: TrackPool.cxx:22
const double empikp[5]

◆ AddVertex() [1/12]

void VertexFitRefine::AddVertex ( int  number,
VertexParameter  vpar,
int  n1,
int  n2 
)
inline

Definition at line 22 of file VertexFitRefine.cc.

24{
25 vtxfit->AddVertex(number, vpar, n1, n2);
26}
int n2
Definition: SD0Tag.cxx:55
int n1
Definition: SD0Tag.cxx:54
void AddVertex(int number, VertexParameter vpar, std::vector< int > lis)
Definition: VertexFit.cxx:89

◆ AddVertex() [2/12]

void VertexFitRefine::AddVertex ( int  number,
VertexParameter  vpar,
int  n1,
int  n2,
int  n3 
)
inline

Definition at line 27 of file VertexFitRefine.cc.

29{
30 vtxfit->AddVertex(number, vpar, n1, n2, n3);
31}

◆ AddVertex() [3/12]

void VertexFitRefine::AddVertex ( int  number,
VertexParameter  vpar,
int  n1,
int  n2,
int  n3,
int  n4 
)
inline

Definition at line 32 of file VertexFitRefine.cc.

34{
35 vtxfit->AddVertex(number, vpar, n1, n2, n3, n4);
36}

◆ AddVertex() [4/12]

void VertexFitRefine::AddVertex ( int  number,
VertexParameter  vpar,
int  n1,
int  n2,
int  n3,
int  n4,
int  n5 
)
inline

Definition at line 37 of file VertexFitRefine.cc.

39{
40 vtxfit->AddVertex(number, vpar, n1, n2, n3, n4, n5);
41}

◆ AddVertex() [5/12]

void VertexFitRefine::AddVertex ( int  number,
VertexParameter  vpar,
int  n1,
int  n2,
int  n3,
int  n4,
int  n5,
int  n6 
)
inline

Definition at line 42 of file VertexFitRefine.cc.

44{
45 vtxfit->AddVertex(number, vpar, n1, n2, n3, n4, n5, n6);
46}

◆ AddVertex() [6/12]

void VertexFitRefine::AddVertex ( int  number,
VertexParameter  vpar,
int  n1,
int  n2,
int  n3,
int  n4,
int  n5,
int  n6,
int  n7 
)
inline

Definition at line 47 of file VertexFitRefine.cc.

50{
51 vtxfit->AddVertex(number, vpar, n1, n2, n3, n4, n5, n6, n7);
52}

◆ AddVertex() [7/12]

void VertexFitRefine::AddVertex ( int  number,
VertexParameter  vpar,
int  n1,
int  n2,
int  n3,
int  n4,
int  n5,
int  n6,
int  n7,
int  n8 
)
inline

Definition at line 53 of file VertexFitRefine.cc.

56{
57 vtxfit->AddVertex(number, vpar, n1, n2, n3, n4, n5, n6, n7, n8);
58}

◆ AddVertex() [8/12]

void VertexFitRefine::AddVertex ( int  number,
VertexParameter  vpar,
int  n1,
int  n2,
int  n3,
int  n4,
int  n5,
int  n6,
int  n7,
int  n8,
int  n9 
)
inline

Definition at line 59 of file VertexFitRefine.cc.

62{
63 vtxfit->AddVertex(number, vpar, n1, n2, n3, n4, n5, n6, n7, n8, n9);
64}

◆ AddVertex() [9/12]

void VertexFitRefine::AddVertex ( int  number,
VertexParameter  vpar,
int  n1,
int  n2,
int  n3,
int  n4,
int  n5,
int  n6,
int  n7,
int  n8,
int  n9,
int  n10 
)
inline

Definition at line 65 of file VertexFitRefine.cc.

68{
69 vtxfit->AddVertex(number, vpar, n1, n2, n3, n4, n5, n6, n7, n8, n9, n10);
70}

◆ AddVertex() [10/12]

void VertexFitRefine::AddVertex ( int  number,
VertexParameter  vpar,
int  n1,
int  n2,
int  n3,
int  n4,
int  n5,
int  n6,
int  n7,
int  n8,
int  n9,
int  n10,
int  n11 
)
inline

Definition at line 71 of file VertexFitRefine.cc.

74{
75 vtxfit->AddVertex(number, vpar, n1, n2, n3, n4, n5, n6, n7, n8, n9, n10,
76 n11);
77}

◆ AddVertex() [11/12]

void VertexFitRefine::AddVertex ( int  number,
VertexParameter  vpar,
int  n1,
int  n2,
int  n3,
int  n4,
int  n5,
int  n6,
int  n7,
int  n8,
int  n9,
int  n10,
int  n11,
int  n12 
)
inline

Definition at line 78 of file VertexFitRefine.cc.

82{
83 vtxfit->AddVertex(number, vpar, n1, n2, n3, n4, n5, n6, n7, n8, n9, n10,
84 n11, n12);
85}

◆ AddVertex() [12/12]

void VertexFitRefine::AddVertex ( int  number,
VertexParameter  vpar,
std::vector< int >  lis 
)
inline

Definition at line 17 of file VertexFitRefine.cc.

19{
20 vtxfit->AddVertex(number, vpar, lis);
21}

◆ chisq() [1/2]

double VertexFitRefine::chisq ( ) const
inline

Definition at line 117 of file VertexFitRefine.cc.

118{
119 return vtxfit->chisq(0);
120}
double chisq() const
Definition: VertexFit.h:66

◆ chisq() [2/2]

double VertexFitRefine::chisq ( int  n) const
inline

Definition at line 122 of file VertexFitRefine.cc.

123{
124 return vtxfit->chisq(0);
125}

◆ errorVx()

double VertexFitRefine::errorVx ( int  n,
int  i 
) const
inline

Definition at line 167 of file VertexFitRefine.cc.

168{
169 return vtxfit->errorVx(n, i);
170}
double errorVx(int n, int i) const
Definition: VertexFit.h:88

◆ Evx()

HepSymMatrix VertexFitRefine::Evx ( int  n) const
inline

Definition at line 162 of file VertexFitRefine.cc.

163{
164 return vtxfit->Evx(n);
165}
HepSymMatrix Evx(int n) const
Definition: VertexFit.h:87

◆ Ew()

HepSymMatrix VertexFitRefine::Ew ( int  n) const
inline

Definition at line 142 of file VertexFitRefine.cc.

143{
144 return vtxfit->Ew(n);
145}
HepSymMatrix Ew(int n) const
Definition: VertexFit.h:78

◆ Fit() [1/2]

bool VertexFitRefine::Fit ( )

Definition at line 79 of file VertexFitRefine.cxx.

80{
81 HepPoint3D vx(0.0, 0.0, 0.0);
82
83 for (int i = 0; i != m_trkIdxOrigin.size(); ++i) {
84 m_p4Infit.push_back(m_wtrkInfit[i].p());
85 m_x3Infit.push_back(m_wtrkInfit[i].x());
86 }
87
88 //// setup the initial vertex
89 HepPoint3D vWideVertex(0., 0., 0.);
90
91 HepSymMatrix evWideVertex(3, 0);
92 evWideVertex[0][0] = 1.0E12;
93 evWideVertex[1][1] = 1.0E12;
94 evWideVertex[2][2] = 1.0E12;
95
96 VertexParameter wideVertex;
97 wideVertex.setVx(vWideVertex);
98 wideVertex.setEvx(evWideVertex);
99
100 if (vtxfit->m_vpar_infit.size() == 0) {
101 std::cerr << "Not set Vertex?" << std::endl;
102 return false;
103 }
104 double ZChi2 = 9999.9;
105 HepPoint3D ZDP = vtxfit->vx(0);
106 HepPoint3D ZDPE = HepPoint3D(9999.9, 9999.9, 9999.9);
107 bool ZFit = false;
108 HepVector ZVx = vtxfit->Vx(0);
109 HepSymMatrix ZEVx = evWideVertex;
110
111 //// do the fit
112 if (vtxfit->Fit(0)) {
113 vtxfit->Swim(0);
114 vtxfit->BuildVirtualParticle(0);
115
116 ZChi2 = vtxfit->chisq(0);
117
118 for (int i = 0; i != m_trkIdxOrigin.size(); ++i) {
119 m_p4Infit[i] = vtxfit->pfit(i);
120 m_x3Infit[i] = vtxfit->xfit(i);
121 }
122
123 ZDP = vtxfit->vx(0);
124 ZVx = vtxfit->Vx(0);
125 ZEVx = vtxfit->Evx(0);
126 ZDPE.set(vtxfit->errorVx(0, 0), vtxfit->errorVx(0, 1),
127 vtxfit->errorVx(0, 2));
128 ZFit = true;
129 }
130
131 if (ZFit) {
132 if (ZDP.perp() > obeampipe) {
133 //// initialize the fitter
134 vtxfit->init();
135
136 for (int i = 0; i != m_trkIdxOrigin.size(); ++i) {
137 m_tracksOrigin[i]->setPidType(m_trkPidOrigin[i]);
138 m_wtrkInfit[i] = WTrackParameter(
139 VTXPDGM::empikp[m_trkPidOrigin[i]],
140 m_tracksOrigin[i]->fhelix(), m_tracksOrigin[i]->ferr());
141 vtxfit->AddTrack(i, m_wtrkInfit[i]);
142 }
143
144 wideVertex.setVx(ZVx);
145 // wideVertex.setEvx(ZEVx * 25.0); // 5 * sigma square, not good
146 wideVertex.setEvx(evWideVertex);
147
148 //// add the daughters
149 vtxfit->AddVertex(0, wideVertex, 0, 1);
150 //// do the fit
151 if (vtxfit->Fit(0)) {
152 vtxfit->Swim(0);
153 vtxfit->BuildVirtualParticle(0);
154 vx = vtxfit->vx(0);
155 ZVx = vtxfit->Vx(0);
156 ZEVx = vtxfit->Evx(0);
157 thePath = 3;
158 } else {
159 vx = ZDP;
160 thePath = 2;
161 }
162 } else {
163 vx = ZDP;
164 thePath = 1;
165 }
166 } else { // initial ZFit failed.
167 //// initialize the fitter
168 vtxfit->init();
169
170 for (int i = 0; i != m_trkIdxOrigin.size(); ++i) {
171 m_tracksOrigin[i]->setPidType(m_trkPidOrigin[i]);
172 m_wtrkInfit[i] = WTrackParameter(VTXPDGM::empikp[m_trkPidOrigin[i]],
173 m_tracksOrigin[i]->fhelix(),
174 m_tracksOrigin[i]->ferr());
175 vtxfit->AddTrack(i, m_wtrkInfit[i]);
176 }
177
178 if (vtxfit->Fit(0)) {
179 vtxfit->Swim(0);
180 vtxfit->BuildVirtualParticle(0);
181 vx = vtxfit->vx(0);
182 ZVx = vtxfit->Vx(0);
183 ZEVx = vtxfit->Evx(0);
184 thePath = 4;
185 } else {
186 thePath = 5;
187 return false;
188 }
189 }
190 //// initialize the fitter
191 vtxfit->init();
192
193 for (int i = 0; i != m_trkIdxOrigin.size(); ++i) {
194 m_tracksOrigin[i]->setPidType(m_trkPidOrigin[i]);
195 vtxext->KalFitExt(vx, m_tracksOrigin[i], m_trkPidOrigin[i]);
196 m_wtrkInfit[i] =
197 WTrackParameter(VTXPDGM::empikp[m_trkPidOrigin[i]],
198 vtxext->getHelixVector(), vtxext->getErrorMatrix());
199 m_p4Infit[i] = m_wtrkInfit[i].p();
200 m_x3Infit[i] = m_wtrkInfit[i].x();
201
202 vtxfit->AddTrack(i, m_wtrkInfit[i]);
203 }
204
205 wideVertex.setVx(vx);
206 // wideVertex.setEvx(ZEVx * 25.0); // 5 * sigma square, not good, why?
207 wideVertex.setEvx(evWideVertex);
208 //// add the daughters
209 vtxfit->AddVertex(0, wideVertex, 0, 1);
210
211 //// do the fit
212 if (vtxfit->Fit(0)) {
213 vtxfit->Swim(0);
214 vtxfit->BuildVirtualParticle(0);
215 } else {
216 thePath = 6;
217 }
218
219 return true;
220}
Double_t x[10]
HepGeom::Point3D< double > HepPoint3D
Definition: Gam4pikp.cxx:37
void KalFitExt(const HepPoint3D &point, DstMdcKalTrack *kalTrack, const int pid)
const HepVector getHelixVector() const
const HepSymMatrix getErrorMatrix() const
HepPoint3D vx(int n) const
HepVector Vx(int n) const
Definition: VertexFit.h:86
HepPoint3D vx(int n) const
Definition: VertexFit.h:85
HepLorentzVector pfit(int n) const
Definition: VertexFit.h:75
HepPoint3D xfit(int n) const
Definition: VertexFit.h:76
void BuildVirtualParticle(int number)
Definition: VertexFit.cxx:619
void Swim(int n)
Definition: VertexFit.h:59
bool Fit()
Definition: VertexFit.cxx:301
void setEvx(const HepSymMatrix &eVx)
void setVx(const HepPoint3D &vx)

Referenced by Fit().

◆ Fit() [2/2]

bool VertexFitRefine::Fit ( int  n)
inline

Definition at line 112 of file VertexFitRefine.cc.

113{
114 return Fit();
115}

◆ getPath()

int VertexFitRefine::getPath ( ) const
inline

Definition at line 182 of file VertexFitRefine.cc.

183{
184 return thePath;
185}

◆ init()

void VertexFitRefine::init ( )

Definition at line 40 of file VertexFitRefine.cxx.

41{
42 m_trkIdxOrigin.clear();
43 m_tracksOrigin.clear();
44 m_trkPidOrigin.clear();
45 m_wtrkInfit.clear();
46 m_p4Infit.clear();
47 m_x3Infit.clear();
48 vtxfit = VertexFit::instance();
49 vtxfit->init();
51 m_vtxsOrigin.clear();
52 thePath = 0;
53}
static VertexExtrapolate * instance()
static VertexFit * instance()
Definition: VertexFit.cxx:15

◆ instance()

VertexFitRefine * VertexFitRefine::instance ( )
static

Definition at line 34 of file VertexFitRefine.cxx.

35{
36 if (m_instance == nullptr) m_instance = new VertexFitRefine();
37 return m_instance;
38}

◆ pfit()

HepLorentzVector VertexFitRefine::pfit ( int  n) const
inline

Definition at line 127 of file VertexFitRefine.cc.

128{
129 return vtxfit->pfit(n);
130}

◆ setChisqCut()

void VertexFitRefine::setChisqCut ( const double  chicut = 1000,
const double  chiter = 1.0e-3 
)
inline

Definition at line 96 of file VertexFitRefine.cc.

98{
99 vtxfit->setChisqCut(chicut, chiter);
100}
void setChisqCut(const double chicut=1000, const double chiter=1.0e-3)
Definition: VertexFit.h:49

◆ setIterNumber()

void VertexFitRefine::setIterNumber ( const int  niter = 10)
inline

Definition at line 92 of file VertexFitRefine.cc.

93{
94 vtxfit->setIterNumber(niter);
95}
void setIterNumber(const int niter=10)
Definition: VertexFit.h:48

◆ setMagCorrFactor()

void VertexFitRefine::setMagCorrFactor ( const double  factor = 1.000)
inline

Definition at line 101 of file VertexFitRefine.cc.

102{
103 vtxfit->setMagCorrFactor(factor);
104}
void setMagCorrFactor(const double factor=1.000)
Definition: VertexFit.h:50

◆ vpar()

VertexParameter VertexFitRefine::vpar ( int  n) const
inline

Definition at line 172 of file VertexFitRefine.cc.

173{
174 return vtxfit->vpar(n);
175}
VertexParameter vpar(int n) const
Definition: VertexFit.h:89

Referenced by AddBeamFit(), and AddVertex().

◆ vx()

HepPoint3D VertexFitRefine::vx ( int  n) const
inline

Definition at line 152 of file VertexFitRefine.cc.

153{
154 return vtxfit->vx(n);
155}

Referenced by Fit().

◆ Vx()

HepVector VertexFitRefine::Vx ( int  n) const
inline

Definition at line 157 of file VertexFitRefine.cc.

158{
159 return vtxfit->Vx(n);
160}

◆ w()

HepVector VertexFitRefine::w ( int  n) const
inline

Definition at line 137 of file VertexFitRefine.cc.

138{
139 return vtxfit->w(n);
140}
HepVector w(int n) const
Definition: VertexFit.h:77

◆ wtrk()

WTrackParameter VertexFitRefine::wtrk ( int  n) const
inline

Definition at line 147 of file VertexFitRefine.cc.

148{
149 return vtxfit->wtrk(n);
150}
WTrackParameter wtrk(int n) const
Definition: VertexFit.h:79

◆ wVirtualTrack()

WTrackParameter VertexFitRefine::wVirtualTrack ( int  n) const
inline

Definition at line 177 of file VertexFitRefine.cc.

178{
179 return vtxfit->wVirtualTrack(n);
180}
WTrackParameter wVirtualTrack(int n) const
Definition: VertexFit.h:92

◆ xfit()

HepPoint3D VertexFitRefine::xfit ( int  n) const
inline

Definition at line 132 of file VertexFitRefine.cc.

133{
134 return vtxfit->xfit(n);
135}

Friends And Related Function Documentation

◆ VertexFit

friend class VertexFit
friend

Definition at line 29 of file VertexFitRefine.h.


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