104 {
105 MsgStream log(
msgSvc(), name());
106 log << MSG::INFO << "in execute()" << endreq;
107
108 StatusCode sc;
109
110
111
112
113 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
114 int event= eventHeader->eventNumber();
115
116
117
120 log << MSG::DEBUG << "run and event = " << eventHeader->runNumber()
121 << " " << eventHeader->eventNumber() << endreq;
122 log << MSG::DEBUG <<"ncharg, nneu, tottks = "
123 << recEvent->totalCharged() << " , "
124 << recEvent->totalNeutral() << " , "
125 << recEvent->totalTracks() <<endreq;
126
129
132
133
134 SmartDataPtr<EvtRecPi0Col> recPi0Col(eventSvc(), "/Event/EvtRec/EvtRecPi0Col");
135 if ( ! recPi0Col ) {
136 log << MSG::FATAL << "Could not find EvtRecPi0Col" << endreq;
137 return StatusCode::FAILURE;
138 }
139
140
141 SmartDataPtr<EvtRecEtaToGGCol> recEtaToGGCol(eventSvc(), "/Event/EvtRec/EvtRecEtaToGGCol");
142 if ( ! recEtaToGGCol ) {
143 log << MSG::FATAL << "Could not find EvtRecEtaToGGCol" << endreq;
144 return StatusCode::FAILURE;
145 }
146
147
148 SmartDataPtr<EvtRecVeeVertexCol> recVeeVertexCol(eventSvc(), "/Event/EvtRec/EvtRecVeeVertexCol");
149 if ( ! recVeeVertexCol ) {
150 log << MSG::FATAL << "Could not find EvtRecVeeVertexCol" << endreq;
151 return StatusCode::FAILURE;
152 }
153
154
156 if (!recDTagCol) {
157 log << MSG::FATAL << "EvtRecDTagCol is not registered yet" << endreq;
158 return StatusCode::FAILURE;
159 }
160
161
162
163
164 Hep3Vector xorigin(0,0,0);
165
167 Gaudi::svcLocator()->service("VertexDbSvc", vtxsvc);
169
170
172 xorigin.setX(vertex[0]);
173 xorigin.setY(vertex[1]);
174 xorigin.setZ(vertex[2]);
175 }
176
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
199
201 dc_fill(ksList, recVeeVertexCol->begin(), recVeeVertexCol->end());
202
203
204 map<EvtRecVeeVertex*, vector< double > > fitinfo;
205 for(
CDKsList::iterator ksit = ksList.particle_begin(); ksit != ksList.particle_end(); ++ksit ){
207
208 if(m_useVFrefine){
210 }else{
212 }
213
214 }
215
217 dc_fill(pi0List, recPi0Col->begin(), recPi0Col->end());
218
220 dc_fill(etaList, recEtaToGGCol->begin(), recEtaToGGCol->end());
221
222
227
228
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
244
245 if(m_ReadBeamEFromDB && m_irun!=run){
246 m_irun=run;
247 if(m_usecalibBeamE)
249 m_beamE=m_readDb.
getbeamE(m_irun,m_beamE);
250 if(run>0)
252
253 }
254 double ebeam=m_beamE;
255
256
257
258
259
260
261
262 for(int list=0;list<chanlist.size();list++){
263
264 string channel=chanlist[list];
265 vector<int> numchan;
269
270
271
272
273
274 if(channel=="DptoKPiPi") {
276 numchan.push_back(1);
277 numchan.push_back(2);
278 numchan.push_back(2);
279 decaylist=kaonList.minus()* pionList.plus()* pionList.plus();
280 }
281 else if(channel=="DptoKPiPiPi0") {
283 numchan.push_back(1);
284 numchan.push_back(2);
285 numchan.push_back(2);
286 numchan.push_back(3);
287 decaylist=kaonList.minus()* pionList.plus()* pionList.plus()* pi0List;
288 }
289 else if(channel=="DptoKsPi") {
291 numchan.push_back(5);
292 numchan.push_back(2);
293 decaylist=ksList* pionList.plus();
294 }
295 else if(channel=="DptoKsPiPi0") {
297 numchan.push_back(5);
298 numchan.push_back(2);
299 numchan.push_back(3);
300 decaylist=ksList* pionList.plus()* pi0List;
301 }
302 else if(channel=="DptoKsPiPiPi") {
304 numchan.push_back(5);
305 numchan.push_back(2);
306 numchan.push_back(2);
307 numchan.push_back(2);
308 decaylist=ksList* pionList.plus()* pionList.plus()* pionList.minus();
309 }
310 else if(channel=="DptoKKPi") {
312 numchan.push_back(1);
313 numchan.push_back(1);
314 numchan.push_back(2);
315 decaylist=kaonList.minus()* kaonList.plus()* pionList.plus();
316 }
317 else if(channel=="DptoPiPi0") {
319 numchan.push_back(2);
320 numchan.push_back(3);
321 decaylist=pionList.plus()* pi0List;
322 }
323 else if(channel=="DptoKPi0") {
325 numchan.push_back(1);
326 numchan.push_back(3);
327 decaylist=kaonList.plus()* pi0List;
328 }
329 else if(channel=="DptoKsK") {
331 numchan.push_back(5);
332 numchan.push_back(1);
333 decaylist=ksList* kaonList.plus();
334 }
335 else if(channel=="DptoPiPiPi") {
337 numchan.push_back(2);
338 numchan.push_back(2);
339 numchan.push_back(2);
340 decaylist=pionList.plus()* pionList.plus()* pionList.minus() ;
341 }
342 else if(channel=="DptoPiPi0Pi0") {
344 numchan.push_back(2);
345 numchan.push_back(3);
346 numchan.push_back(3);
347 decaylist=pionList.plus()* pi0List* pi0List;
348 }
349 else if(channel=="DptoKsKsPi") {
351 numchan.push_back(5);
352 numchan.push_back(5);
353 numchan.push_back(2);
354 decaylist=ksList* ksList* pionList.plus();
355 }
356 else if(channel=="DptoKsKPi0") {
358 numchan.push_back(5);
359 numchan.push_back(1);
360 numchan.push_back(3);
361 decaylist=ksList* kaonList.plus()* pi0List;
362 }
363 else if(channel=="DptoKsKsK") {
365 numchan.push_back(5);
366 numchan.push_back(5);
367 numchan.push_back(1);
368 decaylist=ksList* ksList* kaonList.plus();
369 }
370 else if(channel=="DptoPiPiPiPi0") {
372 numchan.push_back(2);
373 numchan.push_back(2);
374 numchan.push_back(2);
375 numchan.push_back(3);
376 decaylist=pionList.plus()* pionList.plus()* pionList.minus()* pi0List;
377 }
378 else if(channel=="DptoKsPiPi0Pi0") {
380 numchan.push_back(5);
381 numchan.push_back(2);
382 numchan.push_back(3);
383 numchan.push_back(3);
384 decaylist=ksList* pionList.plus()* pi0List* pi0List;
385 }
386 else if(channel=="DptoKsKplusPiPi") {
388 numchan.push_back(5);
389 numchan.push_back(1);
390 numchan.push_back(2);
391 numchan.push_back(2);
392 decaylist=ksList* kaonList.plus()* pionList.plus()* pionList.minus();
393 }
394 else if(channel=="DptoKsKminusPiPi") {
396 numchan.push_back(5);
397 numchan.push_back(1);
398 numchan.push_back(2);
399 numchan.push_back(2);
400 decaylist=ksList* kaonList.minus()* pionList.plus()* pionList.plus();
401 }
402 else if(channel=="DptoKKPiPi0") {
404 numchan.push_back(1);
405 numchan.push_back(1);
406 numchan.push_back(2);
407 numchan.push_back(3);
408 decaylist=kaonList.minus()* kaonList.plus()* pionList.plus()* pi0List;
409 }
410 else if(channel=="DptoPiPiPiPiPi") {
412 numchan.push_back(2);
413 numchan.push_back(2);
414 numchan.push_back(2);
415 numchan.push_back(2);
416 numchan.push_back(2);
417 decaylist=pionList.plus()* pionList.plus()* pionList.plus()* pionList.minus()* pionList.minus();
418 }
419 else if(channel=="DptoKPiPiPiPi") {
421 numchan.push_back(1);
422 numchan.push_back(2);
423 numchan.push_back(2);
424 numchan.push_back(2);
425 numchan.push_back(2);
426 decaylist=kaonList.minus()* pionList.plus()* pionList.plus()* pionList.plus()* pionList.minus();
427 }
428 else if(channel=="DptoPiEta") {
430 numchan.push_back(2);
431 numchan.push_back(4);
432 decaylist=pionList.plus()* etaList;
433 }
434 else if(channel=="DptoKsPiEta") {
436 numchan.push_back(5);
437 numchan.push_back(2);
438 numchan.push_back(4);
439 decaylist=ksList* pionList.plus()* etaList;
440 }
441 else if(channel=="DptoKPiPiPi0Pi0") {
443 numchan.push_back(1);
444 numchan.push_back(2);
445 numchan.push_back(2);
446 numchan.push_back(3);
447 numchan.push_back(3);
448 decaylist=kaonList.minus()* pionList.plus()* pionList.plus()* pi0List* pi0List;
449 }
450 else if(channel=="DptoKsPiPiPiPi0") {
452 numchan.push_back(5);
453 numchan.push_back(2);
454 numchan.push_back(2);
455 numchan.push_back(2);
456 numchan.push_back(3);
457 decaylist=ksList* pionList.plus()* pionList.plus()* pionList.minus()* pi0List;
458 }
459 else if(channel=="DptoKsPiPi0Pi0Pi0") {
461 numchan.push_back(5);
462 numchan.push_back(2);
463 numchan.push_back(3);
464 numchan.push_back(3);
465 numchan.push_back(3);
466 decaylist=ksList* pionList.plus()* pi0List* pi0List* pi0List;
467 }
468 else if(channel=="DptoKsPiEPPiPiEta"){
470 numchan.push_back(5);
471 numchan.push_back(2);
472 numchan.push_back(6);
474 epList=pionList.plus()* pionList.minus()* etaList;
475 decaylist= ksList* pionList.plus()* epList;
476 }
477 else if(channel=="DptoKsPiEPRhoGam"){
479 numchan.push_back(5);
480 numchan.push_back(2);
481 numchan.push_back(7);
483 rhoList=pionList.plus()* pionList.minus();
485 epList=rhoList* photonList;
486 decaylist= ksList* pionList.plus()* epList;
487 }
488 else if(channel=="DptoKPiPiEta") {
490 numchan.push_back(1);
491 numchan.push_back(2);
492 numchan.push_back(2);
493 numchan.push_back(4);
494 decaylist=kaonList.minus()* pionList.plus()* pionList.plus()* etaList;
495 }
496 else if(channel=="DptoKsPiPi0Eta") {
498 numchan.push_back(5);
499 numchan.push_back(2);
500 numchan.push_back(3);
501 numchan.push_back(4);
502 decaylist=ksList* pionList.plus()* pi0List* etaList;
503 }
504 else if(channel=="DptoKsKKPi") {
506 numchan.push_back(5);
507 numchan.push_back(1);
508 numchan.push_back(1);
509 numchan.push_back(2);
510 decaylist=ksList* kaonList.minus()* kaonList.plus()* pionList.plus();
511 }
512 else if(channel=="DptoPiPiPiPi0Pi0") {
514 numchan.push_back(2);
515 numchan.push_back(2);
516 numchan.push_back(2);
517 numchan.push_back(3);
518 numchan.push_back(3);
519 decaylist=pionList.plus()* pionList.plus()* pionList.minus()* pi0List* pi0List;
520 }
521 else if(channel=="DptoPiPi0Eta") {
523 numchan.push_back(2);
524 numchan.push_back(3);
525 numchan.push_back(4);
526 decaylist=pionList.plus()* pi0List* etaList;
527 }
528 else if(channel=="DptoPiPiPiEta") {
530 numchan.push_back(2);
531 numchan.push_back(2);
532 numchan.push_back(2);
533 numchan.push_back(4);
534 decaylist=pionList.plus()* pionList.plus()* pionList.minus()* etaList ;
535 }
536 else if(channel=="DptoPiEtaEta") {
538 numchan.push_back(2);
539 numchan.push_back(4);
540 numchan.push_back(4);
541 decaylist=pionList.plus()* etaList* etaList;
542 }
543 else if(channel=="DptoPiEPPiPiEta"){
545 numchan.push_back(2);
546 numchan.push_back(6);
548 epList=pionList.plus()* pionList.minus()* etaList;
549 decaylist= pionList.plus()* epList;
550 }
551 else if(channel=="DptoPiEPRhoGam"){
553 numchan.push_back(2);
554 numchan.push_back(7);
556 rhoList=pionList.plus()* pionList.minus();
558 epList=rhoList* photonList;
559 decaylist= pionList.plus()* epList;
560 }
561 else if(channel=="DptoPiPi0EPPiPiEta"){
563 numchan.push_back(2);
564 numchan.push_back(3);
565 numchan.push_back(6);
567 epList=pionList.plus()* pionList.minus()* etaList;
568 decaylist= pionList.plus()* pi0List* epList;
569 }
570 else if(channel=="DptoPiPi0EPRhoGam"){
572 numchan.push_back(2);
573 numchan.push_back(3);
574 numchan.push_back(7);
576 rhoList=pionList.plus()* pionList.minus();
578 epList=rhoList* photonList;
579 decaylist= pionList.plus()* pi0List* epList;
580 }
581 else if(channel=="DptoKsKsPiPi0") {
583 numchan.push_back(5);
584 numchan.push_back(5);
585 numchan.push_back(2);
586 numchan.push_back(3);
587 decaylist=ksList* ksList* pionList.plus()* pi0List;
588 }
589 else if(channel=="DptoKsKPi0Pi0") {
591 numchan.push_back(5);
592 numchan.push_back(1);
593 numchan.push_back(3);
594 numchan.push_back(3);
595 decaylist=ksList* kaonList.plus()* pi0List* pi0List;
596 }
597 else if(channel=="DptoKsKEta") {
599 numchan.push_back(5);
600 numchan.push_back(1);
601 numchan.push_back(4);
602 decaylist=ksList* kaonList.plus()* etaList;
603 }
604 else if(channel=="DptoKKPiPiPi") {
606 numchan.push_back(1);
607 numchan.push_back(1);
608 numchan.push_back(2);
609 numchan.push_back(2);
610 numchan.push_back(2);
611 decaylist=kaonList.minus()* kaonList.plus()* pionList.plus()* pionList.minus()* pionList.plus();
612 }
613 else if(channel=="DptoKpPiPi") {
615 numchan.push_back(1);
616 numchan.push_back(2);
617 numchan.push_back(2);
618 decaylist=kaonList.plus()* pionList.plus()* pionList.minus();
619 }
620 else if(channel=="DptoKpPi0Pi0") {
622 numchan.push_back(1);
623 numchan.push_back(3);
624 numchan.push_back(3);
625 decaylist=kaonList.plus()* pi0List* pi0List;
626 }
627 else if(channel=="DptoKpPi0Eta") {
629 numchan.push_back(1);
630 numchan.push_back(3);
631 numchan.push_back(4);
632 decaylist=kaonList.plus()* pi0List* etaList;
633 }
634 else if(channel=="DptoKpPiPiPi0") {
636 numchan.push_back(1);
637 numchan.push_back(2);
638 numchan.push_back(2);
639 numchan.push_back(3);
640 decaylist=kaonList.plus()* pionList.plus()* pionList.minus()* pi0List;
641 }
642 else if(channel=="DptoKpPiPiEta") {
644 numchan.push_back(1);
645 numchan.push_back(2);
646 numchan.push_back(2);
647 numchan.push_back(4);
648 decaylist=kaonList.plus()* pionList.plus()* pionList.minus()* etaList;
649 }
650
651
654
656
659
660 vector<int> trackid, showerid;
661 vector<int> kaonid, pionid;
662 int numofchildren=numchan.size()-1;
663
664 for(int i=0; i< numofchildren;i++){
665
666 const CDCandidate& daughter=(*it).particle().child(i);
667
668 if(numchan[i+1]==1){
670 trackid.push_back(track->
trackId());
671 kaonid.push_back(track->
trackId());
672 }
673 else if(numchan[i+1]==2){
675 trackid.push_back(track->
trackId());
676 pionid.push_back(track->
trackId());
677 }
678 else if ( numchan[i+1]==3){
681 showerid.push_back(hiEnGamma->
trackId());
682 showerid.push_back(loEnGamma->
trackId());
683 }
684 else if ( numchan[i+1]==4){
687 showerid.push_back(hiEnGamma->
trackId());
688 showerid.push_back(loEnGamma->
trackId());
689 }
690 else if ( numchan[i+1]==5){
692
693 recDTag->
addToFitInfo(aKsCand->
mass(),fitinfo[aKsCand][0],fitinfo[aKsCand][1],fitinfo[aKsCand][2]);
694
697 trackid.push_back(pion1Trk->
trackId());
698 trackid.push_back(pion2Trk->
trackId());
699 }
700 else if (numchan[i+1]==6){
708
709 trackid.push_back(apiontrk->
trackId());
710 trackid.push_back(spiontrk->
trackId());
711 showerid.push_back(hiEnGamma->
trackId());
712 showerid.push_back(loEnGamma->
trackId());
713
714 }
715 else if (numchan[i+1]==7){
720
721
725
726
727 trackid.push_back(apiontrk->
trackId());
728 trackid.push_back(spiontrk->
trackId());
729 showerid.push_back(gammatrk->
trackId());
730
731 }
732
733 }
734
735
737 if(m_useBFC){
738
740 }
741 savetrack(trackid,showerid,charged_begin,charged_end,neutral_begin,neutral_end,recDTag);
742 pidtag(kaonid,pionid,kaonList_tight, pionList_tight,recDTag);
743
744 if(m_usevertexfit){
745 if(m_debug) cout<<"beforevfit:"<<endl;
746
747 HepLorentzVector p4change_vfit;
748
749 if(m_useVFrefine){
750 p4change_vfit=util.
vfitref(channel, kaonid, pionid, xorigin, charged_begin);
751 }else{
752 p4change_vfit=util.
vfit(channel, kaonid, pionid, xorigin, charged_begin);
753 }
754
755 recDTag->
setp4(recDTag->
p4()+p4change_vfit);
756
757 }
758
759
760 trackid.clear();
761 showerid.clear();
762 kaonid.clear();
763 pionid.clear();
764
765
766 recDTagCol->push_back(recDTag);
767
768 }
769
770 numchan.clear();
771
772 }
773
774 return StatusCode::SUCCESS;
775}
ChargedDSelector chargedDSelector
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
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 updateKsInfo(CDDecayList::iterator, double, int, EvtRecDTag *, vector< int >, IVertexDbSvc *, bool)
void saveDpInfo(CDDecayList::iterator, double, int, EvtRecDTag *)
void pidtag(vector< int >, vector< int >, CDChargedKaonList &, CDChargedPionList &, EvtRecDTag *)
void savetrack(vector< int >, vector< int >, EvtRecTrackIterator, EvtRecTrackIterator, EvtRecTrackIterator, EvtRecTrackIterator, EvtRecDTag *)
void setbeta(Hep3Vector beta)
void setebeam(double ebeam)
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)
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