127 {
128 StatusCode sc = StatusCode::SUCCESS;
129
130 MsgStream log(
msgSvc(), name());
131 log << MSG::INFO << "in execute()" << endreq;
132
133
134
135
136 setFilterPassed(false);
137
138 m_pass[0] += 1;
139
140 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
143
144 Vint iks, ipip, ipim, iGood;
145 iGood.clear();
146 iks.clear();
147 ipip.clear();
148 ipim.clear();
149
151 ppip.clear();
152 ppim.clear();
153
154 int TotCharge = 0;
155 for(int i = 0; i < evtRecEvent->totalCharged(); i++){
157 if(!(*itTrk)->isMdcTrackValid()) continue;
159 if(fabs(mdcTrk->
z()) >= m_vz0cut)
continue;
160 if(mdcTrk->
r() >= m_vr0cut)
continue;
161 iGood.push_back(i);
162 TotCharge += mdcTrk->
charge();
163 }
164
165
166
167 int nGood = iGood.size();
168
169
170
171
172
173 if((nGood < 2) || (TotCharge!=0)) return sc;
174
175 m_pass[1] += 1;
176
177
178
180 for(int i = 0; i < nGood; i++) {
182
189
190
193 if(!(*itTrk)->isMdcKalTrackValid()) continue ;
195
196
198
200 HepLorentzVector
ptrk;
201 ptrk.setPx(mdcKalTrk->
px());
202 ptrk.setPy(mdcKalTrk->
py());
203 ptrk.setPz(mdcKalTrk->
pz());
204 double p3 =
ptrk.mag();
206
207 if(mdcKalTrk->
charge() >0) {
208 ipip.push_back(iGood[i]);
209 ppip.push_back(
ptrk);
210 } else {
211 ipim.push_back(iGood[i]);
212 ppim.push_back(
ptrk);
213 }
214 }
215
216 m_pass[2] += 1;
217 int npip = ipip.size();
218 int npim = ipim.size();
219 m_npip=npip;
220 m_npim=npim;
221
222 if(npip < 1 || npim <1) return sc;
223
224 m_pass[3] += 1;
225
226
227
228
229 double chi, delm;
230 double chisq=999.;
231
232
234 HepSymMatrix Evx(3, 0);
235 double bx = 1E+6;
236 double by = 1E+6;
237 double bz = 1E+6;
238 Evx[0][0] = bx*bx;
239 Evx[1][1] = by*by;
240 Evx[2][2] = bz*bz;
244
245
246
247
248
249
250
251
252
253
254 int ip1=-1, ip2=-1;
255
258
259 for(int i1 = 0; i1 < ipip.size(); i1++) {
260 RecMdcKalTrack *pipTrk = (*(evtRecTrkCol->begin()+ipip[i1]))->mdcKalTrack();
263
264 for(int i2 = 0; i2 < ipim.size(); i2++) {
265 RecMdcKalTrack *pimTrk = (*(evtRecTrkCol->begin()+ipim[i2]))->mdcKalTrack();
268
273 if(!(vtxfit0->
Fit(0)))
continue;
275
279 if(!vtxfit->
Fit())
continue;
280 chi = vtxfit->
chisq();
281
282
283 if(chi > chisq) continue;
284 delm = fabs((vtxfit->
p4par().m())-
mk0);
285 chisq = chi;
286 ip1=ipip[i1];
287 ip2=ipim[i2];
288 }
289 }
290
291
292
293 if(ip1==-1 || ip2==-1) return sc;
294 m_pass[4] += 1;
295
296 RecMdcKalTrack *pi1Trk = (*(evtRecTrkCol->begin()+ip1))->mdcKalTrack();
299
300 RecMdcKalTrack *pi2Trk = (*(evtRecTrkCol->begin()+ip2))->mdcKalTrack();
307 if(!(vtxfit0->
Fit(0)))
return sc;
309
313 if(!vtxfit->
Fit())
return sc;
314
315 m_ksRawMass = vtxfit->
p4par().m();
316 m_ctau = vtxfit->
ctau();
319 m_chis = vtxfit->
chisq();
320 m_pk0 = vtxfit->
p4par().rho();
321
322
323 if(m_lxyz>0.4 && m_chis<20.){
324
325 TH1 *h(0);
326 if (m_thsvc->getHist("/DQAHist/InclKs/InclKs_mass", h).isSuccess()) {
327 h->Fill(m_ksRawMass);
328 } else {
329 log << MSG::ERROR << "Couldn't retrieve inclks_mass" << endreq;
330 }
331 }
332
333 m_tuple1->write();
334
335
336
337
338
339
340 (*(evtRecTrkCol->begin()+ip1))->tagPion();
341 (*(evtRecTrkCol->begin()+ip2))->tagPion();
342
343
344
345
346
347 (*(evtRecTrkCol->begin()+ip1))->setQuality(2);
348 (*(evtRecTrkCol->begin()+ip2))->setQuality(2);
349
350
351
352 setFilterPassed(true);
353
354 return StatusCode::SUCCESS;
355}
EvtRecTrackCol::iterator EvtRecTrackIterator
std::vector< HepLorentzVector > Vp4
const HepVector & helix() const
static void setPidType(PidType pidType)
const HepSymMatrix & err() const
int methodProbability() const
void setChiMinCut(const double chi=4)
void setRecTrack(EvtRecTrack *trk)
void setMethod(const int method)
void identify(const int pidcase)
void usePidSys(const int pidsys)
static ParticleID * instance()
bool IsPidInfoValid() const
HepLorentzVector p4par() const
double decayLength() const
double decayLengthError() const
static SecondVertexFit * instance()
void setVpar(const VertexParameter vpar)
void AddTrack(const int number, const double mass, const RecMdcTrack *trk)
WTrackParameter wVirtualTrack(int n) const
void AddVertex(int number, VertexParameter vpar, std::vector< int > lis)
static VertexFit * instance()
VertexParameter vpar(int n) const
void BuildVirtualParticle(int number)
void setEvx(const HepSymMatrix &eVx)
void setVx(const HepPoint3D &vx)
_EXTERN_ std::string EvtRecEvent
_EXTERN_ std::string EvtRecTrackCol