BOSS 7.0.9
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 AddTrack (const int number, const WTrackParameter wtrk)
 
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() [1/2]

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

Definition at line 76 of file VertexFitRefine.cxx.

78{
79 m_trkIdxOrigin.push_back(index);
80 m_tracksOrigin.push_back(p);
81 m_trkPidOrigin.push_back(pid);
82 int idx = m_trkIdxOrigin.size() - 1;
83 if (index != idx) {
84 std::cerr << "TrackPool: wrong track index " << index << ", "
85 << m_trkIdxOrigin.size() << std::endl;
86 }
87
88 m_tracksOrigin[idx]->setPidType(m_trkPidOrigin[idx]);
89 m_wtrkInfit.push_back(WTrackParameter(VTXPDGM::empikp[m_trkPidOrigin[idx]],
90 m_tracksOrigin[idx]->helix(),
91 m_tracksOrigin[idx]->err()));
92 vtxfit->AddTrack(m_trkIdxOrigin[idx], m_wtrkInfit[idx]);
93}
void AddTrack(const int number, const double mass, const RecMdcTrack *trk)
Definition: TrackPool.cxx:22
const double empikp[5]

◆ AddTrack() [2/2]

void VertexFitRefine::AddTrack ( const int  number,
const WTrackParameter  wtrk 
)

Definition at line 60 of file VertexFitRefine.cxx.

61{
62 m_trkIdxOrigin.push_back(index);
63 m_tracksOrigin.push_back(nullptr);
64 m_trkPidOrigin.push_back(RecMdcKalTrack::null);
65 int idx = m_trkIdxOrigin.size() - 1;
66 if (index != idx) {
67 std::cerr << "TrackPool: wrong track index " << index << ", "
68 << m_trkIdxOrigin.size() << std::endl;
69 }
70
71 m_tracksOrigin[idx]->setPidType(m_trkPidOrigin[idx]);
72 m_wtrkInfit.push_back(wtrk);
73 vtxfit->AddTrack(m_trkIdxOrigin[idx], m_wtrkInfit[idx]);
74}
WTrackParameter wtrk(int n) const

◆ 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 95 of file VertexFitRefine.cxx.

96{
97 HepPoint3D vx(0.0, 0.0, 0.0);
98
99 for (uint i = 0; i != m_trkIdxOrigin.size(); ++i) {
100 m_p4Infit.push_back(m_wtrkInfit[i].p());
101 m_x3Infit.push_back(m_wtrkInfit[i].x());
102 }
103
104 //// setup the initial vertex
105 HepPoint3D vWideVertex(0., 0., 0.);
106
107 HepSymMatrix evWideVertex(3, 0);
108 evWideVertex[0][0] = 1.0E12;
109 evWideVertex[1][1] = 1.0E12;
110 evWideVertex[2][2] = 1.0E12;
111
112 VertexParameter wideVertex;
113 wideVertex.setVx(vWideVertex);
114 wideVertex.setEvx(evWideVertex);
115
116 if (vtxfit->m_vpar_infit.size() == 0) {
117 std::cerr << "Not set Vertex?" << std::endl;
118 return false;
119 }
120
121 HepPoint3D ZDP = vtxfit->vx(0);
122 HepPoint3D ZDPE = HepPoint3D(9999.9, 9999.9, 9999.9);
123 bool ZFit = false;
124 HepVector ZVx = vtxfit->Vx(0);
125 HepSymMatrix ZEVx = evWideVertex;
126
127 //// do the fit
128 if (vtxfit->Fit(0)) {
129 vtxfit->Swim(0);
130 vtxfit->BuildVirtualParticle(0);
131
132 for (uint i = 0; i != m_trkIdxOrigin.size(); ++i) {
133 m_p4Infit[i] = vtxfit->pfit(i);
134 m_x3Infit[i] = vtxfit->xfit(i);
135 }
136
137 ZDP = vtxfit->vx(0);
138 ZVx = vtxfit->Vx(0);
139 ZEVx = vtxfit->Evx(0);
140 ZDPE.set(vtxfit->errorVx(0, 0), vtxfit->errorVx(0, 1),
141 vtxfit->errorVx(0, 2));
142 ZFit = true;
143 }
144
145 if (ZFit) {
146 if (ZDP.perp() > obeampipe) {
147 //// initialize the fitter
148 vtxfit->init();
149
150 for (uint i = 0; i != m_trkIdxOrigin.size(); ++i) {
151 m_tracksOrigin[i]->setPidType(m_trkPidOrigin[i]);
152 if (m_trkPidOrigin[i] != RecMdcKalTrack::null) {
153 m_wtrkInfit[i] = WTrackParameter(
154 VTXPDGM::empikp[m_trkPidOrigin[i]],
155 m_tracksOrigin[i]->fhelix(), m_tracksOrigin[i]->ferr());
156 }
157 vtxfit->AddTrack(i, m_wtrkInfit[i]);
158 }
159
160 wideVertex.setVx(ZVx);
161 // wideVertex.setEvx(ZEVx * 25.0); // 5 * sigma square, not good
162 wideVertex.setEvx(evWideVertex);
163
164 //// add the daughters
165 vtxfit->AddVertex(0, wideVertex, m_trkIdxOrigin);
166 //// do the fit
167 if (vtxfit->Fit(0)) {
168 vtxfit->Swim(0);
169 vtxfit->BuildVirtualParticle(0);
170 vx = vtxfit->vx(0);
171 ZVx = vtxfit->Vx(0);
172 ZEVx = vtxfit->Evx(0);
173 thePath = 3;
174 } else {
175 vx = ZDP;
176 thePath = 2;
177 }
178 } else {
179 vx = ZDP;
180 thePath = 1;
181 }
182 } else { // initial ZFit failed.
183 //// initialize the fitter
184 vtxfit->init();
185
186 for (uint i = 0; i != m_trkIdxOrigin.size(); ++i) {
187 m_tracksOrigin[i]->setPidType(m_trkPidOrigin[i]);
188 if (m_trkPidOrigin[i] != RecMdcKalTrack::null) {
189 m_wtrkInfit[i] = WTrackParameter(
190 VTXPDGM::empikp[m_trkPidOrigin[i]],
191 m_tracksOrigin[i]->fhelix(), m_tracksOrigin[i]->ferr());
192 }
193 vtxfit->AddTrack(i, m_wtrkInfit[i]);
194 }
195
196 if (vtxfit->Fit(0)) {
197 vtxfit->Swim(0);
198 vtxfit->BuildVirtualParticle(0);
199 vx = vtxfit->vx(0);
200 ZVx = vtxfit->Vx(0);
201 ZEVx = vtxfit->Evx(0);
202 thePath = 4;
203 } else {
204 thePath = 5;
205 return false;
206 }
207 }
208 //// initialize the fitter
209 vtxfit->init();
210
211 for (uint i = 0; i != m_trkIdxOrigin.size(); ++i) {
212 m_tracksOrigin[i]->setPidType(m_trkPidOrigin[i]);
213 if (m_trkPidOrigin[i] != RecMdcKalTrack::null) {
214 vtxext->KalFitExt(vx, m_tracksOrigin[i], m_trkPidOrigin[i]);
215 m_wtrkInfit[i] = WTrackParameter(VTXPDGM::empikp[m_trkPidOrigin[i]],
216 vtxext->getHelixVector(),
217 vtxext->getErrorMatrix());
218 }
219 m_p4Infit[i] = m_wtrkInfit[i].p();
220 m_x3Infit[i] = m_wtrkInfit[i].x();
221
222 vtxfit->AddTrack(i, m_wtrkInfit[i]);
223 }
224
225 wideVertex.setVx(vx);
226 // wideVertex.setEvx(ZEVx * 25.0); // 5 * sigma square, not good, why?
227 wideVertex.setEvx(evWideVertex);
228 //// add the daughters
229 vtxfit->AddVertex(0, wideVertex, m_trkIdxOrigin);
230
231 //// do the fit
232 if (vtxfit->Fit(0)) {
233 vtxfit->Swim(0);
234 vtxfit->BuildVirtualParticle(0);
235 } else {
236 thePath = 6;
237 }
238
239 return true;
240}
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

Referenced by AddTrack().

◆ 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: