107 MsgStream log(
msgSvc(), name());
108 log << MSG::INFO <<
"in execute()" << endreq;
115 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),
"/Event/EventHeader");
116 int event= eventHeader->eventNumber();
122 log << MSG::DEBUG <<
"run and event = " << eventHeader->runNumber()
123 <<
" " << eventHeader->eventNumber() << endreq;
124 log << MSG::DEBUG <<
"ncharg, nneu, tottks = "
125 << recEvent->totalCharged() <<
" , "
126 << recEvent->totalNeutral() <<
" , "
127 << recEvent->totalTracks() <<endreq;
136 SmartDataPtr<EvtRecPi0Col> recPi0Col(eventSvc(),
"/Event/EvtRec/EvtRecPi0Col");
138 log << MSG::FATAL <<
"Could not find EvtRecPi0Col" << endreq;
139 return StatusCode::FAILURE;
144 SmartDataPtr<EvtRecEtaToGGCol> recEtaToGGCol(eventSvc(),
"/Event/EvtRec/EvtRecEtaToGGCol");
145 if ( ! recEtaToGGCol ) {
146 log << MSG::FATAL <<
"Could not find EvtRecEtaToGGCol" << endreq;
147 return StatusCode::FAILURE;
151 SmartDataPtr<EvtRecVeeVertexCol> recVeeVertexCol(eventSvc(),
"/Event/EvtRec/EvtRecVeeVertexCol");
152 if ( ! recVeeVertexCol ) {
153 log << MSG::FATAL <<
"Could not find EvtRecVeeVertexCol" << endreq;
154 return StatusCode::FAILURE;
160 log << MSG::FATAL <<
"EvtRecDTagCol is not registered in TDS" << endreq;
161 return StatusCode::FAILURE;
165 Hep3Vector xorigin(0,0,0);
167 Gaudi::svcLocator()->service(
"VertexDbSvc", vtxsvc);
172 xorigin.setX(vertex[0]);
173 xorigin.setY(vertex[1]);
174 xorigin.setZ(vertex[2]);
202 dc_fill(ksList, recVeeVertexCol->begin(), recVeeVertexCol->end());
205 map<EvtRecVeeVertex*, vector< double > > fitinfo;
206 for(
CDKsList::iterator ksit = ksList.particle_begin(); ksit != ksList.particle_end(); ++ksit ){
218 dc_fill(pi0List, recPi0Col->begin(), recPi0Col->end());
221 dc_fill(etaList, recEtaToGGCol->begin(), recEtaToGGCol->end());
230 int run = eventHeader->runNumber();
231 m_ievt = eventHeader->eventNumber();
232 m_nChrg = recEvent->totalCharged();
233 m_nNeu = recEvent->totalNeutral();
234 m_nPion = pionList.
size();
235 m_nKaon = kaonList.
size();
236 m_nPi0 = pi0List.size();
237 m_nKs = ksList.size();
243 if(m_ReadBeamEFromDB && m_irun!=run){
247 m_beamE=m_readDb.
getbeamE(m_irun, m_beamE);
253 double ebeam=m_beamE;
261 for(
int list=0;list<chanlist.size();list++){
263 string channel=chanlist[list];
269 bool isFlavorMode=
false;
276 if(channel==
"D0toKPi") {
278 numchan.push_back(1);
279 numchan.push_back(2);
280 decaylist=kaonList.
minus() * pionList.
plus();
283 else if(channel==
"D0toKPiPi0"){
285 numchan.push_back(1);
286 numchan.push_back(2);
287 numchan.push_back(3);
288 decaylist=kaonList.
minus() * pionList.
plus() * pi0List;
291 else if(channel==
"D0toKPiPi0Pi0"){
293 numchan.push_back(1);
294 numchan.push_back(2);
295 numchan.push_back(3);
296 numchan.push_back(3);
297 decaylist=kaonList.
minus() * pionList.
plus() * pi0List * pi0List;
300 else if(channel==
"D0toKPiPiPi"){
302 numchan.push_back(1);
303 numchan.push_back(2);
304 numchan.push_back(2);
305 numchan.push_back(2);
309 else if(channel==
"D0toKPiPiPiPi0"){
311 numchan.push_back(1);
312 numchan.push_back(2);
313 numchan.push_back(2);
314 numchan.push_back(2);
315 numchan.push_back(3);
316 decaylist=kaonList.
minus()* pionList.
plus()* pionList.
plus()* pionList.
minus()* pi0List;
319 else if(channel==
"D0toKPiEta"){
321 numchan.push_back(1);
322 numchan.push_back(2);
323 numchan.push_back(4);
324 decaylist=kaonList.
minus() * pionList.
plus() * etaList;
327 else if(channel==
"D0toKPiPi0Pi0Pi0"){
329 numchan.push_back(1);
330 numchan.push_back(2);
331 numchan.push_back(3);
332 numchan.push_back(3);
333 numchan.push_back(3);
334 decaylist=kaonList.
minus() * pionList.
plus() * pi0List * pi0List * pi0List;
337 else if(channel==
"D0toKPiPi0Eta"){
339 numchan.push_back(1);
340 numchan.push_back(2);
341 numchan.push_back(3);
342 numchan.push_back(4);
343 decaylist=kaonList.
minus() * pionList.
plus() * pi0List * etaList;
346 else if(channel==
"D0toKPiEPPiPiEta"){
348 numchan.push_back(1);
349 numchan.push_back(2);
350 numchan.push_back(6);
352 epList=pionList.
plus()* pionList.
minus()* etaList;
353 decaylist=kaonList.
minus() * pionList.
plus() * epList;
356 else if(channel==
"D0toKPiEPRhoGam"){
358 numchan.push_back(1);
359 numchan.push_back(2);
360 numchan.push_back(7);
362 rhoList=pionList.
plus()* pionList.
minus();
364 epList=rhoList* photonList;
365 decaylist=kaonList.
minus() * pionList.
plus() * epList;
368 else if(channel==
"D0toKKKPi"){
370 numchan.push_back(1);
371 numchan.push_back(1);
372 numchan.push_back(1);
373 numchan.push_back(2);
377 else if(channel==
"D0toKsKPi"){
379 numchan.push_back(5);
380 numchan.push_back(1);
381 numchan.push_back(2);
382 decaylist=ksList* kaonList.
minus()* pionList.
plus();
384 else if(channel==
"D0toKsKPiPi0"){
386 numchan.push_back(5);
387 numchan.push_back(1);
388 numchan.push_back(2);
389 numchan.push_back(3);
390 decaylist=ksList* kaonList.
minus() * pionList.
plus()* pi0List;
392 else if(channel==
"D0toKsPiPi"){
394 numchan.push_back(5);
395 numchan.push_back(2);
396 numchan.push_back(2);
397 decaylist=ksList* pionList.
plus()* pionList.
minus();
399 else if(channel==
"D0toKsPiPiPi0"){
401 numchan.push_back(5);
402 numchan.push_back(2);
403 numchan.push_back(2);
404 numchan.push_back(3);
405 decaylist=ksList* pionList.
plus()* pionList.
minus()* pi0List;
407 else if(channel==
"D0toKsPi0"){
409 numchan.push_back(5);
410 numchan.push_back(3);
411 decaylist=ksList* pi0List;
413 else if(channel==
"D0toPiPiPi0"){
415 numchan.push_back(2);
416 numchan.push_back(2);
417 numchan.push_back(3);
418 decaylist=pionList.
plus()* pionList.
minus()* pi0List;
420 else if(channel==
"D0toPiPi"){
422 numchan.push_back(2);
423 numchan.push_back(2);
424 decaylist=pionList.
plus()* pionList.
minus();
426 else if(channel==
"D0toKK"){
428 numchan.push_back(1);
429 numchan.push_back(1);
430 decaylist=kaonList.
minus()* kaonList.
plus();
432 else if(channel==
"D0toKKPi0"){
434 numchan.push_back(1);
435 numchan.push_back(1);
436 numchan.push_back(3);
437 decaylist=kaonList.
minus()* kaonList.
plus()* pi0List;
439 else if(channel==
"D0toPi0Pi0"){
441 numchan.push_back(3);
442 numchan.push_back(3);
443 decaylist=pi0List* pi0List;
445 else if(channel==
"D0toKsKs"){
447 numchan.push_back(5);
448 numchan.push_back(5);
449 decaylist=ksList* ksList;
451 else if(channel==
"D0toKsKsPi0"){
453 numchan.push_back(5);
454 numchan.push_back(5);
455 numchan.push_back(3);
456 decaylist=ksList* ksList* pi0List;
458 else if(channel==
"D0toKsPi0Pi0"){
460 numchan.push_back(5);
461 numchan.push_back(3);
462 numchan.push_back(3);
463 decaylist=ksList* pi0List* pi0List;
465 else if(channel==
"D0toKsKK"){
467 numchan.push_back(5);
468 numchan.push_back(1);
469 numchan.push_back(1);
470 decaylist=ksList* kaonList.
minus()* kaonList.
plus();
472 else if(channel==
"D0toKsEta"){
474 numchan.push_back(5);
475 numchan.push_back(4);
476 decaylist=ksList* etaList;
478 else if(channel==
"D0toPi0Pi0Pi0"){
480 numchan.push_back(3);
481 numchan.push_back(3);
482 numchan.push_back(3);
483 decaylist=pi0List* pi0List* pi0List;
485 else if(channel==
"D0toKsKsKs"){
487 numchan.push_back(5);
488 numchan.push_back(5);
489 numchan.push_back(5);
490 decaylist=ksList* ksList* ksList;
492 else if(channel==
"D0toPiPiPiPi"){
494 numchan.push_back(2);
495 numchan.push_back(2);
496 numchan.push_back(2);
497 numchan.push_back(2);
500 else if(channel==
"D0toPiPiPi0Pi0"){
502 numchan.push_back(2);
503 numchan.push_back(2);
504 numchan.push_back(3);
505 numchan.push_back(3);
506 decaylist=pionList.
plus()* pionList.
minus()* pi0List* pi0List;
508 else if(channel==
"D0toKKPiPi"){
510 numchan.push_back(1);
511 numchan.push_back(1);
512 numchan.push_back(2);
513 numchan.push_back(2);
516 else if(channel==
"D0toKKPi0Pi0"){
518 numchan.push_back(1);
519 numchan.push_back(1);
520 numchan.push_back(3);
521 numchan.push_back(3);
522 decaylist=kaonList.
minus()* kaonList.
plus()* pi0List* pi0List;
524 else if(channel==
"D0toKsKsPiPi"){
526 numchan.push_back(5);
527 numchan.push_back(5);
528 numchan.push_back(2);
529 numchan.push_back(2);
530 decaylist=ksList* ksList* pionList.
plus()* pionList.
minus();
532 else if(channel==
"D0toPiPiPiPiPi0"){
534 numchan.push_back(2);
535 numchan.push_back(2);
536 numchan.push_back(2);
537 numchan.push_back(2);
538 numchan.push_back(3);
539 decaylist=pionList.
plus()* pionList.
plus()* pionList.
minus()* pionList.
minus()* pi0List;
541 else if(channel==
"D0toKsPiPiPiPi"){
543 numchan.push_back(5);
544 numchan.push_back(2);
545 numchan.push_back(2);
546 numchan.push_back(2);
547 numchan.push_back(2);
548 decaylist=ksList* pionList.
plus()* pionList.
plus()* pionList.
minus()* pionList.
minus();
550 else if(channel==
"D0toKKPiPiPi0"){
552 numchan.push_back(1);
553 numchan.push_back(1);
554 numchan.push_back(2);
555 numchan.push_back(2);
556 numchan.push_back(3);
557 decaylist=kaonList.
minus()* kaonList.
plus()* pionList.
plus()* pionList.
minus()* pi0List;
559 else if(channel==
"D0toKsPi0Eta"){
561 numchan.push_back(5);
562 numchan.push_back(3);
563 numchan.push_back(4);
564 decaylist=ksList* pi0List* etaList;
566 else if(channel==
"D0toKsEPPiPiEta"){
568 numchan.push_back(5);
569 numchan.push_back(6);
571 epList=pionList.
plus()* pionList.
minus()* etaList;
572 decaylist= ksList* epList;
574 else if(channel==
"D0toKsEPRhoGam"){
576 numchan.push_back(5);
577 numchan.push_back(7);
579 rhoList=pionList.
plus()* pionList.
minus();
581 epList=rhoList* photonList;
582 decaylist= ksList* epList;
584 else if(channel==
"D0toKsPi0Pi0Pi0"){
586 numchan.push_back(5);
587 numchan.push_back(3);
588 numchan.push_back(3);
589 numchan.push_back(3);
590 decaylist=ksList* pi0List* pi0List* pi0List;
592 else if(channel==
"D0toKsPiPiPi0Pi0"){
594 numchan.push_back(5);
595 numchan.push_back(2);
596 numchan.push_back(2);
597 numchan.push_back(3);
598 numchan.push_back(3);
599 decaylist=ksList* pionList.
plus()* pionList.
minus()* pi0List* pi0List;
601 else if(channel==
"D0toKsPiPiEta"){
603 numchan.push_back(5);
604 numchan.push_back(2);
605 numchan.push_back(2);
606 numchan.push_back(4);
607 decaylist=ksList* pionList.
plus()* pionList.
minus()* etaList;
609 else if(channel==
"D0toKsPi0EPPiPiEta"){
611 numchan.push_back(5);
612 numchan.push_back(3);
613 numchan.push_back(6);
615 epList=pionList.
plus()* pionList.
minus()* etaList;
616 decaylist= ksList* pi0List* epList;
618 else if(channel==
"D0toKsPi0EPRhoGam"){
620 numchan.push_back(5);
621 numchan.push_back(3);
622 numchan.push_back(7);
624 rhoList=pionList.
plus()* pionList.
minus();
626 epList=rhoList* photonList;
627 decaylist= ksList* pi0List* epList;
629 else if(channel==
"D0toPiPiEta"){
631 numchan.push_back(2);
632 numchan.push_back(2);
633 numchan.push_back(4);
634 decaylist=pionList.
plus()* pionList.
minus()* etaList;
636 else if(channel==
"D0toPiPiPi0Eta"){
638 numchan.push_back(2);
639 numchan.push_back(2);
640 numchan.push_back(3);
641 numchan.push_back(4);
642 decaylist=pionList.
plus()* pionList.
minus()* pi0List* etaList;
644 else if(channel==
"D0toPiPiEPPiPiEta"){
646 numchan.push_back(2);
647 numchan.push_back(2);
648 numchan.push_back(6);
650 epList=pionList.
plus()* pionList.
minus()* etaList;
651 decaylist=pionList.
plus()* pionList.
minus()* epList;
653 else if(channel==
"D0toPiPiEPRhoGam"){
655 numchan.push_back(2);
656 numchan.push_back(2);
657 numchan.push_back(7);
659 rhoList=pionList.
plus()* pionList.
minus();
661 epList=rhoList* photonList;
662 decaylist=pionList.
plus()* pionList.
minus()* epList;
664 else if(channel==
"D0toKKEta"){
666 numchan.push_back(1);
667 numchan.push_back(1);
668 numchan.push_back(4);
669 decaylist=kaonList.
minus()* kaonList.
plus()* etaList;
682 vector<int> trackid, showerid;
683 vector<int> kaonid, pionid;
685 int numofchildren=numchan.size()-1;
687 for(
int i=0; i< numofchildren;i++){
689 const CDCandidate& daughter=(*it).particle().child(i);
690 if(isFlavorMode && i==0)
695 trackid.push_back(track->
trackId());
696 kaonid.push_back(track->
trackId());
698 else if(numchan[i+1]==2){
700 trackid.push_back(track->
trackId());
701 pionid.push_back(track->
trackId());
703 else if ( numchan[i+1]==3){
706 showerid.push_back(hiEnGamma->
trackId());
707 showerid.push_back(loEnGamma->
trackId());
709 else if ( numchan[i+1]==4){
712 showerid.push_back(hiEnGamma->
trackId());
713 showerid.push_back(loEnGamma->
trackId());
715 else if ( numchan[i+1]==5){
718 recDTag->
addToFitInfo(aKsCand->
mass(),fitinfo[aKsCand][0],fitinfo[aKsCand][1],fitinfo[aKsCand][2]);
722 trackid.push_back(pion1Trk->
trackId());
723 trackid.push_back(pion2Trk->
trackId());
725 else if (numchan[i+1]==6){
734 trackid.push_back(apiontrk->
trackId());
735 trackid.push_back(spiontrk->
trackId());
736 showerid.push_back(hiEnGamma->
trackId());
737 showerid.push_back(loEnGamma->
trackId());
740 else if (numchan[i+1]==7){
752 trackid.push_back(apiontrk->
trackId());
753 trackid.push_back(spiontrk->
trackId());
754 showerid.push_back(gammatrk->
trackId());
765 updateKsInfo(it,
ebeam, charm, numofchildren, recDTag, numchan, vtxsvc, m_useVFrefine);
767 savetrack(trackid,showerid,charged_begin,charged_end,neutral_begin,neutral_end,recDTag);
768 pidtag(kaonid,pionid,kaonList_tight, pionList_tight,recDTag);
771 if(m_debug) cout<<
"beforevfit:"<<endl;
773 HepLorentzVector p4change_vfit;
776 p4change_vfit=util.
vfitref(channel, kaonid, pionid, xorigin, charged_begin);
778 p4change_vfit=util.
vfit(channel, kaonid, pionid, xorigin, charged_begin);
781 recDTag->
setp4(recDTag->
p4()+p4change_vfit);
792 recDTagCol->push_back(recDTag);
801 return StatusCode::SUCCESS;
972 HepLorentzVector p4D0((*it).particle().momentum(), (*it).particle().energy());
973 HepLorentzVector p4D0_New;
975 for(
int i = 0; i < numofchildren; i++){
976 const CDCandidate& daughter=(*it).particle().child(i);
980 HepVector veewks = aKsCand->
w();
981 HepLorentzVector p4KsCand;
982 p4KsCand.setX(veewks[0]);
983 p4KsCand.setY(veewks[1]);
984 p4KsCand.setZ(veewks[2]);
985 p4KsCand.setE(veewks[3]);
986 HepLorentzVector p4wks = p4KsCand;
991 vector<double> vp4ks_new = util.
UpdatedKsIfo(aKsCand,vtxsvc,m_useVFrefine);
992 HepLorentzVector p4wks_new;
993 p4wks_new.setX(vp4ks_new[0]);
994 p4wks_new.setY(vp4ks_new[1]);
995 p4wks_new.setZ(vp4ks_new[2]);
996 p4wks_new.setE(vp4ks_new[3]);
998 p4D0 = p4D0 - p4wks + p4wks_new;
1006 double mass = p4D0_New.m();
1007 recDTag->
setp4(p4D0_New);
1008 p4D0_New.boost(-m_beta);
1009 double mbc2_CMS =
ebeam*
ebeam - p4D0_New.v().mag2();
1010 double mbc_CMS = mbc2_CMS > 0 ? sqrt( mbc2_CMS ) : -10;
1011 double deltaE_CMS = p4D0_New.t() -
ebeam;
1013 int tag=(*it).particle().userTag();
1022 recDTag->
setmBC(mbc_CMS);