106 {
107 MsgStream log(
msgSvc(), name());
108 log << MSG::INFO << "in execute()" << endreq;
109
110 StatusCode sc;
111
112
113
114
115 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
116 int event= eventHeader->eventNumber();
117
118
119
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;
128
131
134
135
136 SmartDataPtr<EvtRecPi0Col> recPi0Col(eventSvc(), "/Event/EvtRec/EvtRecPi0Col");
137 if ( ! recPi0Col ) {
138 log << MSG::FATAL << "Could not find EvtRecPi0Col" << endreq;
139 return StatusCode::FAILURE;
140 }
141
142
143
144 SmartDataPtr<EvtRecEtaToGGCol> recEtaToGGCol(eventSvc(), "/Event/EvtRec/EvtRecEtaToGGCol");
145 if ( ! recEtaToGGCol ) {
146 log << MSG::FATAL << "Could not find EvtRecEtaToGGCol" << endreq;
147 return StatusCode::FAILURE;
148 }
149
150
151 SmartDataPtr<EvtRecVeeVertexCol> recVeeVertexCol(eventSvc(), "/Event/EvtRec/EvtRecVeeVertexCol");
152 if ( ! recVeeVertexCol ) {
153 log << MSG::FATAL << "Could not find EvtRecVeeVertexCol" << endreq;
154 return StatusCode::FAILURE;
155 }
156
157
159 if (!recDTagCol) {
160 log << MSG::FATAL << "EvtRecDTagCol is not registered in TDS" << endreq;
161 return StatusCode::FAILURE;
162 }
163
164
165 Hep3Vector xorigin(0,0,0);
167 Gaudi::svcLocator()->service("VertexDbSvc", vtxsvc);
169
170
172 xorigin.setX(vertex[0]);
173 xorigin.setY(vertex[1]);
174 xorigin.setZ(vertex[2]);
175 }
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
200
202 dc_fill(ksList, recVeeVertexCol->begin(), recVeeVertexCol->end());
203
204
205 map<EvtRecVeeVertex*, vector< double > > fitinfo;
206 for(
CDKsList::iterator ksit = ksList.particle_begin(); ksit != ksList.particle_end(); ++ksit ){
208
209 if(m_useVFrefine){
211 }else{
213 }
214
215 }
216
218 dc_fill(pi0List, recPi0Col->begin(), recPi0Col->end());
219
221 dc_fill(etaList, recEtaToGGCol->begin(), recEtaToGGCol->end());
222
223
224
229
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();
238
239
240
241
242
243 if(m_ReadBeamEFromDB && m_irun!=run){
244 m_irun=run;
245 if(m_usecalibBeamE)
247 m_beamE=m_readDb.
getbeamE(m_irun, m_beamE);
248 if(run>0)
250
251
252 }
253 double ebeam=m_beamE;
254
255
256
257
258
259
260
261 for(int list=0;list<chanlist.size();list++){
262
263 string channel=chanlist[list];
264 vector<int> numchan;
268
269 bool isFlavorMode=false;
270
271
272
273
274
275
276 if(channel=="D0toKPi") {
278 numchan.push_back(1);
279 numchan.push_back(2);
280 decaylist=kaonList.minus() * pionList.plus();
281 isFlavorMode=true;
282 }
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;
289 isFlavorMode=true;
290 }
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;
298 isFlavorMode=true;
299 }
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);
306 decaylist=kaonList.minus()* pionList.plus()* pionList.plus() * pionList.minus();
307 isFlavorMode=true;
308 }
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;
317 isFlavorMode=true;
318 }
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;
325 isFlavorMode=true;
326 }
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;
335 isFlavorMode=true;
336 }
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;
344 isFlavorMode=true;
345 }
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;
354 isFlavorMode=true;
355 }
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;
366 isFlavorMode=true;
367 }
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);
374 decaylist=kaonList.minus()* kaonList.plus()* kaonList.minus() * pionList.plus();
375 isFlavorMode=true;
376 }
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();
383 }
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;
391 }
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();
398 }
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;
406 }
407 else if(channel=="D0toKsPi0"){
409 numchan.push_back(5);
410 numchan.push_back(3);
411 decaylist=ksList* pi0List;
412 }
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;
419 }
420 else if(channel=="D0toPiPi"){
422 numchan.push_back(2);
423 numchan.push_back(2);
424 decaylist=pionList.plus()* pionList.minus();
425 }
426 else if(channel=="D0toKK"){
428 numchan.push_back(1);
429 numchan.push_back(1);
430 decaylist=kaonList.minus()* kaonList.plus();
431 }
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;
438 }
439 else if(channel=="D0toPi0Pi0"){
441 numchan.push_back(3);
442 numchan.push_back(3);
443 decaylist=pi0List* pi0List;
444 }
445 else if(channel=="D0toKsKs"){
447 numchan.push_back(5);
448 numchan.push_back(5);
449 decaylist=ksList* ksList;
450 }
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;
457 }
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;
464 }
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();
471 }
472 else if(channel=="D0toKsEta"){
474 numchan.push_back(5);
475 numchan.push_back(4);
476 decaylist=ksList* etaList;
477 }
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;
484 }
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;
491 }
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);
498 decaylist=pionList.plus()* pionList.plus()* pionList.minus()* pionList.minus();
499 }
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;
507 }
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);
514 decaylist=kaonList.minus()* kaonList.plus()* pionList.plus()* pionList.minus();
515 }
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;
523 }
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();
531 }
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;
540 }
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();
549 }
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;
558 }
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;
565 }
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;
573 }
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;
583 }
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;
591 }
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;
600 }
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;
608 }
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;
617 }
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;
628 }
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;
635 }
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;
643 }
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;
652 }
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;
663 }
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;
670 }
671
672
675
677
680
681
682 vector<int> trackid, showerid;
683 vector<int> kaonid, pionid;
684 int charm=0;
685 int numofchildren=numchan.size()-1;
686
687 for(int i=0; i< numofchildren;i++){
688
689 const CDCandidate& daughter=(*it).particle().child(i);
690 if(isFlavorMode && i==0)
692
693 if(numchan[i+1]==1){
695 trackid.push_back(track->
trackId());
696 kaonid.push_back(track->
trackId());
697 }
698 else if(numchan[i+1]==2){
700 trackid.push_back(track->
trackId());
701 pionid.push_back(track->
trackId());
702 }
703 else if ( numchan[i+1]==3){
706 showerid.push_back(hiEnGamma->
trackId());
707 showerid.push_back(loEnGamma->
trackId());
708 }
709 else if ( numchan[i+1]==4){
712 showerid.push_back(hiEnGamma->
trackId());
713 showerid.push_back(loEnGamma->
trackId());
714 }
715 else if ( numchan[i+1]==5){
717
718 recDTag->
addToFitInfo(aKsCand->
mass(),fitinfo[aKsCand][0],fitinfo[aKsCand][1],fitinfo[aKsCand][2]);
719
722 trackid.push_back(pion1Trk->
trackId());
723 trackid.push_back(pion2Trk->
trackId());
724 }
725 else if (numchan[i+1]==6){
733
734 trackid.push_back(apiontrk->
trackId());
735 trackid.push_back(spiontrk->
trackId());
736 showerid.push_back(hiEnGamma->
trackId());
737 showerid.push_back(loEnGamma->
trackId());
738
739 }
740 else if (numchan[i+1]==7){
745
746
750
751
752 trackid.push_back(apiontrk->
trackId());
753 trackid.push_back(spiontrk->
trackId());
754 showerid.push_back(gammatrk->
trackId());
755
756 }
757
758
759 }
760
761
763 if(m_useBFC){
764
765 updateKsInfo(it,
ebeam, charm, numofchildren, recDTag, numchan, vtxsvc, m_useVFrefine);
766 }
767 savetrack(trackid,showerid,charged_begin,charged_end,neutral_begin,neutral_end,recDTag);
768 pidtag(kaonid,pionid,kaonList_tight, pionList_tight,recDTag);
769
770 if(m_usevertexfit){
771 if(m_debug) cout<<"beforevfit:"<<endl;
772
773 HepLorentzVector p4change_vfit;
774
775 if(m_useVFrefine){
776 p4change_vfit=util.
vfitref(channel, kaonid, pionid, xorigin, charged_begin);
777 }else{
778 p4change_vfit=util.
vfit(channel, kaonid, pionid, xorigin, charged_begin);
779 }
780
781 recDTag->
setp4(recDTag->
p4()+p4change_vfit);
782 }
783
784
785 trackid.clear();
786 showerid.clear();
787 kaonid.clear();
788 pionid.clear();
789
790
791
792 recDTagCol->push_back(recDTag);
793
794 }
795
796 numchan.clear();
797
798 }
799
800
801 return StatusCode::SUCCESS;
802}
void dc_fill(DCFillableChargedList< Charged > &aFillableList, WitnessIterator first, WitnessIterator last)
EvtRecTrackCol::iterator EvtRecTrackIterator
LocalEptoPiPiEtaSelector eptoPiPiEtaSelector
LocalEptoRhoGamSelector eptoRhoGamSelector
LocalEtatoGGSelector etatoGGSelector
LocalKaonSelector kaonSelector
LocalKsSelector ksSelector
LocalPhotonSelector photonSelector
LocalPi0Selector pi0Selector
LocalPionSelector pionSelector
LocalRhotoPiPiSelector rhotoPiPiSelector
NeutralDSelector neutralDSelector
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 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
virtual bool isVertexValid()=0
virtual double * PrimaryVertex()=0
void setpidtype(int type)
void setpidtype(int type)
void updateKsInfo(CDDecayList::iterator, double, int, int, EvtRecDTag *, vector< int >, IVertexDbSvc *, bool)
void savetrack(vector< int >, vector< int >, EvtRecTrackIterator, EvtRecTrackIterator, EvtRecTrackIterator, EvtRecTrackIterator, EvtRecDTag *)
void pidtag(vector< int >, vector< int >, CDChargedKaonList &, CDChargedPionList &, EvtRecDTag *)
void saveD0Info(CDDecayList::iterator, double, int, int, EvtRecDTag *)
void setbeta(Hep3Vector beta)
void setebeam(double ebeam)
bool setcalib(bool calib)
CLHEP::Hep3Vector getbeta()
HepLorentzVector vfitref(string channel, vector< int > kaonid, vector< int > pionid, HepPoint3D vx, EvtRecTrackIterator charged_begin)
vector< double > SecondaryVFitref(EvtRecVeeVertex *ks, IVertexDbSvc *vtxsvc)
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