80{
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
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
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;
107 bool ZFit = false;
108 HepVector ZVx = vtxfit->
Vx(0);
109 HepSymMatrix ZEVx = evWideVertex;
110
111
112 if (vtxfit->
Fit(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
125 ZEVx = vtxfit->
Evx(0);
128 ZFit = true;
129 }
130
131 if (ZFit) {
132 if (ZDP.perp() > obeampipe) {
133
135
136 for (int i = 0; i != m_trkIdxOrigin.size(); ++i) {
137 m_tracksOrigin[i]->setPidType(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
146 wideVertex.
setEvx(evWideVertex);
147
148
150
151 if (vtxfit->
Fit(0)) {
156 ZEVx = vtxfit->
Evx(0);
157 thePath = 3;
158 } else {
160 thePath = 2;
161 }
162 } else {
164 thePath = 1;
165 }
166 } else {
167
169
170 for (int i = 0; i != m_trkIdxOrigin.size(); ++i) {
171 m_tracksOrigin[i]->setPidType(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)) {
183 ZEVx = vtxfit->
Evx(0);
184 thePath = 4;
185 } else {
186 thePath = 5;
187 return false;
188 }
189 }
190
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] =
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
206
207 wideVertex.
setEvx(evWideVertex);
208
210
211
212 if (vtxfit->
Fit(0)) {
215 } else {
216 thePath = 6;
217 }
218
219 return true;
220}
HepGeom::Point3D< double > HepPoint3D
HepPoint3D vx(int n) const
HepVector Vx(int n) const
HepPoint3D vx(int n) const
HepLorentzVector pfit(int n) const
HepPoint3D xfit(int n) const
void BuildVirtualParticle(int number)
void setEvx(const HepSymMatrix &eVx)
void setVx(const HepPoint3D &vx)