102 {
103 MsgStream log(
msgSvc(), name());
104 log << MSG::INFO << "in execute()" << endreq;
105
106 StatusCode sc;
107
108
109
110
111 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
112 int event= eventHeader->eventNumber();
113
114
115
118 log << MSG::DEBUG << "run and event = " << eventHeader->runNumber()
119 << " " << eventHeader->eventNumber() << endreq;
120 log << MSG::DEBUG <<"ncharg, nneu, tottks = "
121 << recEvent->totalCharged() << " , "
122 << recEvent->totalNeutral() << " , "
123 << recEvent->totalTracks() <<endreq;
124
127
130
131
132 SmartDataPtr<EvtRecPi0Col> recPi0Col(eventSvc(), "/Event/EvtRec/EvtRecPi0Col");
133 if ( ! recPi0Col ) {
134 log << MSG::FATAL << "Could not find EvtRecPi0Col" << endreq;
135 return StatusCode::FAILURE;
136 }
137
138 SmartDataPtr<EvtRecEtaToGGCol> recEtaToGGCol(eventSvc(), "/Event/EvtRec/EvtRecEtaToGGCol");
139 if ( ! recEtaToGGCol ) {
140 log << MSG::FATAL << "Could not find EvtRecEtaToGGCol" << endreq;
141 return StatusCode::FAILURE;
142 }
143
144
145 SmartDataPtr<EvtRecVeeVertexCol> recVeeVertexCol(eventSvc(), "/Event/EvtRec/EvtRecVeeVertexCol");
146 if ( ! recVeeVertexCol ) {
147 log << MSG::FATAL << "Could not find EvtRecVeeVertexCol" << endreq;
148 return StatusCode::FAILURE;
149 }
150
151
153 if (!recDTagCol) {
154 log << MSG::FATAL << "EvtRecDTagCol is not registered yet" << endreq;
155 return StatusCode::FAILURE;
156 }
157
158
159
160 Hep3Vector xorigin(0,0,0);
162 Gaudi::svcLocator()->service("VertexDbSvc", vtxsvc);
164
165
167 xorigin.setX(vertex[0]);
168 xorigin.setY(vertex[1]);
169 xorigin.setZ(vertex[2]);
170 }
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
195
197 dc_fill(ksList, recVeeVertexCol->begin(), recVeeVertexCol->end());
198
199
200
201 map<EvtRecVeeVertex*, vector< double > > fitinfo;
202 for(
CDKsList::iterator ksit = ksList.particle_begin(); ksit != ksList.particle_end(); ++ksit ){
205 }
206
208 dc_fill(pi0List, recPi0Col->begin(), recPi0Col->end());
209
211 dc_fill(etaList, recEtaToGGCol->begin(), recEtaToGGCol->end());
212
213
218
219
220 int run = eventHeader->runNumber();
221 m_ievt = eventHeader->eventNumber();
222 m_nChrg = recEvent->totalCharged();
223 m_nNeu = recEvent->totalNeutral();
224 m_nPion = pionList.size();
225 m_nKaon = kaonList.size();
226 m_nPi0 = pi0List.size();
227 m_nKs = ksList.size();
228
229
230
231
232
233
234 if(m_ReadBeamEFromDB && m_irun!=run){
235 m_irun=run;
236 if(m_usecalibBeamE)
238 m_beamE=m_readDb.
getbeamE(m_irun,m_beamE);
239 if(run>0)
241
242 }
243 double ebeam=m_beamE;
244
245
246
247
248
249
250 for(int list=0;list<chanlist.size();list++){
251
252 string channel=chanlist[list];
253 vector<int> numchan;
257
258
259
260
261
262
263
264
265
266
267 if(channel=="DstoKsK") {
269 numchan.push_back(5);
270 numchan.push_back(1);
271 decaylist=ksList* kaonList.plus();
272 }
273 else if(channel=="DstoKKPi") {
275 numchan.push_back(1);
276 numchan.push_back(1);
277 numchan.push_back(2);
278 decaylist=kaonList.minus()* kaonList.plus()* pionList.plus();
279 }
280 else if(channel=="DstoKsKPi0") {
282 numchan.push_back(5);
283 numchan.push_back(1);
284 numchan.push_back(3);
285 decaylist=ksList* kaonList.plus()* pi0List;
286 }
287 else if(channel=="DstoKsKsPi") {
289 numchan.push_back(5);
290 numchan.push_back(5);
291 numchan.push_back(2);
292 decaylist=ksList* ksList* pionList.plus();
293 }
294 else if(channel=="DstoKKPiPi0") {
296 numchan.push_back(1);
297 numchan.push_back(1);
298 numchan.push_back(2);
299 numchan.push_back(3);
300 decaylist=kaonList.minus()* kaonList.plus()* pionList.plus()* pi0List;
301 }
302 else if(channel=="DstoKsKplusPiPi") {
304 numchan.push_back(5);
305 numchan.push_back(1);
306 numchan.push_back(2);
307 numchan.push_back(2);
308 decaylist=ksList* kaonList.plus()* pionList.plus()* pionList.minus();
309 }
310 else if(channel=="DstoKsKminusPiPi") {
312 numchan.push_back(5);
313 numchan.push_back(1);
314 numchan.push_back(2);
315 numchan.push_back(2);
316 decaylist=ksList* kaonList.minus()* pionList.plus()* pionList.plus();
317 }
318 else if(channel=="DstoKKPiPiPi") {
320 numchan.push_back(1);
321 numchan.push_back(1);
322 numchan.push_back(2);
323 numchan.push_back(2);
324 numchan.push_back(2);
325 decaylist=kaonList.minus()* kaonList.plus()* pionList.plus()* pionList.plus()* pionList.minus();
326 }
327 else if(channel=="DstoPiPi0") {
329 numchan.push_back(2);
330 numchan.push_back(3);
331 decaylist=pionList.plus()* pi0List;
332 }
333 else if(channel=="DstoPiPiPi") {
335 numchan.push_back(2);
336 numchan.push_back(2);
337 numchan.push_back(2);
338 decaylist=pionList.plus()* pionList.plus()* pionList.minus();
339 }
340 else if(channel=="DstoPiPiPiPi0") {
342 numchan.push_back(2);
343 numchan.push_back(2);
344 numchan.push_back(2);
345 numchan.push_back(3);
346 decaylist=pionList.plus()* pionList.plus()* pionList.minus()* pi0List;
347 }
348 else if(channel=="DstoPiPiPiPiPi") {
350 numchan.push_back(2);
351 numchan.push_back(2);
352 numchan.push_back(2);
353 numchan.push_back(2);
354 numchan.push_back(2);
355 decaylist=pionList.plus()* pionList.plus()* pionList.plus()* pionList.minus()* pionList.minus();
356 }
357 else if(channel=="DstoPiPiPiPiPiPi0") {
359 numchan.push_back(2);
360 numchan.push_back(2);
361 numchan.push_back(2);
362 numchan.push_back(2);
363 numchan.push_back(2);
364 numchan.push_back(3);
365 decaylist=pionList.plus()* pionList.plus()* pionList.plus()* pionList.minus()* pionList.minus()* pi0List;
366 }
367 else if(channel=="DstoPiPiPiPi0Pi0") {
369 numchan.push_back(2);
370 numchan.push_back(2);
371 numchan.push_back(2);
372 numchan.push_back(3);
373 numchan.push_back(3);
374 decaylist=pionList.plus()* pionList.plus()* pionList.minus()* pi0List* pi0List;
375 }
376 else if(channel=="DstoPiEta") {
378 numchan.push_back(2);
379 numchan.push_back(4);
380 decaylist=pionList.plus()* etaList;
381 }
382 else if(channel=="DstoPiEtaPiPiPi0") {
384 numchan.push_back(2);
385 numchan.push_back(9);
387 EtaList=pionList.plus()* pionList.minus()* pi0List;
388 decaylist=pionList.plus()* EtaList;
389 }
390 else if(channel=="DstoPiPi0Eta") {
392 numchan.push_back(2);
393 numchan.push_back(3);
394 numchan.push_back(4);
395 decaylist=pionList.plus()* pi0List* etaList;
396 }
397 else if(channel=="DstoPiPi0EtaPiPiPi0") {
399 numchan.push_back(2);
400 numchan.push_back(3);
401 numchan.push_back(9);
403 EtaList=pionList.plus()* pionList.minus()* pi0List;
404 decaylist=pionList.plus()* pi0List* EtaList;
405 }
406 else if(channel=="DstoPiPiPiEta") {
408 numchan.push_back(2);
409 numchan.push_back(2);
410 numchan.push_back(2);
411 numchan.push_back(4);
412 decaylist=pionList.plus()* pionList.plus()* pionList.minus()* etaList;
413 }
414 else if(channel=="DstoPiPiPiEtaPiPiPi0") {
416 numchan.push_back(2);
417 numchan.push_back(2);
418 numchan.push_back(2);
419 numchan.push_back(9);
421 EtaList=pionList.plus()* pionList.minus()* pi0List;
422 decaylist=pionList.plus()* pionList.plus()* pionList.minus()* EtaList;
423 }
424 else if(channel=="DstoPiEPPiPiEta") {
426 numchan.push_back(2);
427 numchan.push_back(6);
429 epList=pionList.plus()* pionList.minus()* etaList;
430 decaylist=pionList.plus()* epList;
431 }
432 else if(channel=="DstoPiPi0EPPiPiEta") {
434 numchan.push_back(2);
435 numchan.push_back(3);
436 numchan.push_back(6);
438 epList=pionList.plus()* pionList.minus()* etaList;
439 decaylist=pionList.plus()* pi0List* epList;
440 }
441 else if(channel=="DstoPiEPPiPiEtaPiPiPi0") {
443 numchan.push_back(2);
444 numchan.push_back(8);
446 EtaList=pionList.plus()* pionList.minus()* pi0List;
448 EtapList=pionList.plus()* pionList.minus()* EtaList;
449 decaylist=pionList.plus()* EtapList;
450 }
451 else if(channel=="DstoPiPi0EPPiPiEtaPiPiPi0") {
453 numchan.push_back(2);
454 numchan.push_back(3);
455 numchan.push_back(8);
457 EtaList=pionList.plus()* pionList.minus()* pi0List;
459 EtapList=pionList.plus()* pionList.minus()* EtaList;
460 decaylist=pionList.plus()* pi0List* EtapList;
461 }
462
463 else if(channel=="DstoPiEPRhoGam") {
465 numchan.push_back(2);
466 numchan.push_back(7);
468 rhoList=pionList.plus()* pionList.minus();
470 epList=rhoList* photonList;
471 decaylist=pionList.plus()* epList;
472 }
473 else if(channel=="DstoPiPi0EPRhoGam") {
475 numchan.push_back(2);
476 numchan.push_back(3);
477 numchan.push_back(7);
479 rhoList=pionList.plus()* pionList.minus();
481 epList=rhoList* photonList;
482 decaylist=pionList.plus()* pi0List* epList;
483 }
484 else if(channel=="DstoKsPi") {
486 numchan.push_back(5);
487 numchan.push_back(2);
488 decaylist=ksList* pionList.plus();
489 }
490 else if(channel=="DstoKsPiPi0") {
492 numchan.push_back(5);
493 numchan.push_back(2);
494 numchan.push_back(3);
495 decaylist=ksList* pionList.plus()* pi0List;
496 }
497 else if(channel=="DstoKPiPi") {
499 numchan.push_back(1);
500 numchan.push_back(2);
501 numchan.push_back(2);
502 decaylist=kaonList.plus()* pionList.plus()* pionList.minus();
503 }
504 else if(channel=="DstoKPiPiPi0") {
506 numchan.push_back(1);
507 numchan.push_back(2);
508 numchan.push_back(2);
509 numchan.push_back(3);
510 decaylist=kaonList.plus()* pionList.plus()* pionList.minus()* pi0List;
511 }
512 else if(channel=="DstoKKK") {
514 numchan.push_back(1);
515 numchan.push_back(1);
516 numchan.push_back(1);
517 decaylist=kaonList.minus()* kaonList.plus()* kaonList.plus();
518 }
519
522
524
527
528 vector<int> trackid, showerid;
529 vector<int> kaonid, pionid;
530 int numofchildren=numchan.size()-1;
531
532 for(int i=0; i< numofchildren;i++){
533
534 const CDCandidate& daughter=(*it).particle().child(i);
535
536 if(numchan[i+1]==1){
538 trackid.push_back(track->
trackId());
539 kaonid.push_back(track->
trackId());
540 }
541 else if(numchan[i+1]==2){
543 trackid.push_back(track->
trackId());
544 pionid.push_back(track->
trackId());
545 }
546 else if ( numchan[i+1]==3){
549 showerid.push_back(hiEnGamma->
trackId());
550 showerid.push_back(loEnGamma->
trackId());
551 }
552 else if ( numchan[i+1]==4){
555 showerid.push_back(hiEnGamma->
trackId());
556 showerid.push_back(loEnGamma->
trackId());
557 }
558 else if ( numchan[i+1]==5){
560
561
562 recDTag->
addToFitInfo(aKsCand->
mass(),fitinfo[aKsCand][0],fitinfo[aKsCand][1],fitinfo[aKsCand][2]);
563
566 trackid.push_back(pion1Trk->
trackId());
567 trackid.push_back(pion2Trk->
trackId());
568 }
569 else if (numchan[i+1]==6){
577
578 trackid.push_back(apiontrk->
trackId());
579 trackid.push_back(spiontrk->
trackId());
580 showerid.push_back(hiEnGamma->
trackId());
581 showerid.push_back(loEnGamma->
trackId());
582
583 }
584 else if (numchan[i+1]==7){
589
593
594
595 trackid.push_back(apiontrk->
trackId());
596 trackid.push_back(spiontrk->
trackId());
597 showerid.push_back(gammatrk->
trackId());
598
599 }
600 else if (numchan[i+1]==8){
607
612
615
616 trackid.push_back(apiontrk->
trackId());
617 trackid.push_back(spiontrk->
trackId());
618 trackid.push_back(e0piontrk->
trackId());
619 trackid.push_back(e1piontrk->
trackId());
620 showerid.push_back(hiEnGamma->
trackId());
621 showerid.push_back(loEnGamma->
trackId());
622
623 }
624 else if (numchan[i+1]==9){
632
633 trackid.push_back(apiontrk->
trackId());
634 trackid.push_back(spiontrk->
trackId());
635 showerid.push_back(hiEnGamma->
trackId());
636 showerid.push_back(loEnGamma->
trackId());
637
638 }
639
640
641 }
642
643
644 saveDsInfo(it, ebeam, numofchildren, recDTag);
645 savetrack(trackid,showerid,charged_begin,charged_end,neutral_begin,neutral_end,recDTag);
646 pidtag(kaonid,pionid,kaonList_tight, pionList_tight,recDTag);
647
648
649 if(m_usevertexfit){
650 HepLorentzVector p4change_vfit=util.
vfit(channel, kaonid, pionid, xorigin, charged_begin);
651 recDTag->
setp4(recDTag->
p4()+p4change_vfit);
652 }
653
654
655 trackid.clear();
656 showerid.clear();
657 kaonid.clear();
658 pionid.clear();
659
660
661
662
663 recDTagCol->push_back(recDTag);
664
665 }
666
667 numchan.clear();
668
669 }
670
671
672
673 return StatusCode::SUCCESS;
674}
void dc_fill(DCFillableChargedList< Charged > &aFillableList, WitnessIterator first, WitnessIterator last)
EvtRecTrackCol::iterator EvtRecTrackIterator
LocalEptoPiPiEta3PiSelector eptoPiPiEta3PiSelector
LocalEptoPiPiEtaSelector eptoPiPiEtaSelector
LocalEptoRhoGamSelector eptoRhoGamSelector
LocalEtatoGGSelector etatoGGSelector
LocalEtatoPiPiPi0Selector etatoPiPiPi0Selector
LocalKaonSelector kaonSelector
LocalKsSelector ksSelector
LocalPhotonSelector photonSelector
LocalPi0Selector pi0Selector
LocalPionSelector pionSelector
LocalRhotoPiPiSelector rhotoPiPiSelector
virtual const DecayEvidence & decay() const
virtual const EvtRecTrack * photon() const
virtual const EvtRecTrack * track() const
virtual const EvtRecVeeVertex * navKshort() const
virtual const EvtRecPi0 * navPi0() const
virtual const EvtRecEtaToGG * navEta() const
const CDCandidate & child(unsigned int aPosition) const
void savetrack(vector< int >, vector< int >, EvtRecTrackIterator, EvtRecTrackIterator, EvtRecTrackIterator, EvtRecTrackIterator, EvtRecDTag *)
void pidtag(vector< int >, vector< int >, CDChargedKaonList &, CDChargedPionList &, EvtRecDTag *)
void saveDsInfo(CDDecayList::iterator, double, int, EvtRecDTag *)
void setbeta(Hep3Vector beta)
void setebeam(double ebeam)
@ kDstoPiPi0EPPiPiEtaPiPiPi0
@ kDstoPiEPPiPiEtaPiPiPi0
void setdecayMode(DecayMode decayMode)
HepLorentzVector p4() const
void setp4(HepLorentzVector p4)
void addToFitInfo(double ksmass, double chi2, double length, double error)
const EvtRecTrack * hiEnGamma() const
const EvtRecTrack * loEnGamma() const
const EvtRecTrack * loEnGamma() const
const EvtRecTrack * hiEnGamma() const
SmartRef< EvtRecTrack > & daughter(int i)
virtual bool isVertexValid()=0
virtual double * PrimaryVertex()=0
void setpidtype(int type)
void setpidtype(int type)
bool setcalib(bool calib)
CLHEP::Hep3Vector getbeta()
HepLorentzVector vfit(string channel, vector< int > kaonid, vector< int > pionid, HepPoint3D vx, EvtRecTrackIterator charged_begin)
vector< double > SecondaryVFit(EvtRecVeeVertex *ks, IVertexDbSvc *vtxsvc)
_EXTERN_ std::string EvtRecEvent
_EXTERN_ std::string EvtRecDTagCol
_EXTERN_ std::string EvtRecTrackCol