105 MsgStream log(
msgSvc(), name());
106 log << MSG::INFO <<
"in execute()" << endreq;
113 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),
"/Event/EventHeader");
114 int event= eventHeader->eventNumber();
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;
134 SmartDataPtr<EvtRecPi0Col> recPi0Col(eventSvc(),
"/Event/EvtRec/EvtRecPi0Col");
136 log << MSG::FATAL <<
"Could not find EvtRecPi0Col" << endreq;
137 return StatusCode::FAILURE;
140 SmartDataPtr<EvtRecEtaToGGCol> recEtaToGGCol(eventSvc(),
"/Event/EvtRec/EvtRecEtaToGGCol");
141 if ( ! recEtaToGGCol ) {
142 log << MSG::FATAL <<
"Could not find EvtRecEtaToGGCol" << endreq;
143 return StatusCode::FAILURE;
147 SmartDataPtr<EvtRecVeeVertexCol> recVeeVertexCol(eventSvc(),
"/Event/EvtRec/EvtRecVeeVertexCol");
148 if ( ! recVeeVertexCol ) {
149 log << MSG::FATAL <<
"Could not find EvtRecVeeVertexCol" << endreq;
150 return StatusCode::FAILURE;
156 log << MSG::FATAL <<
"EvtRecDTagCol is not registered yet" << endreq;
157 return StatusCode::FAILURE;
162 Hep3Vector xorigin(0,0,0);
164 Gaudi::svcLocator()->service(
"VertexDbSvc", vtxsvc);
169 xorigin.setX(vertex[0]);
170 xorigin.setY(vertex[1]);
171 xorigin.setZ(vertex[2]);
199 dc_fill(ksList, recVeeVertexCol->begin(), recVeeVertexCol->end());
203 map<EvtRecVeeVertex*, vector< double > > fitinfo;
204 for(
CDKsList::iterator ksit = ksList.particle_begin(); ksit != ksList.particle_end(); ++ksit ){
216 dc_fill(pi0List, recPi0Col->begin(), recPi0Col->end());
219 dc_fill(etaList, recEtaToGGCol->begin(), recEtaToGGCol->end());
228 int run = eventHeader->runNumber();
229 m_ievt = eventHeader->eventNumber();
230 m_nChrg = recEvent->totalCharged();
231 m_nNeu = recEvent->totalNeutral();
232 m_nPion = pionList.
size();
233 m_nKaon = kaonList.
size();
234 m_nPi0 = pi0List.size();
235 m_nKs = ksList.size();
242 if(m_ReadBeamEFromDB && m_irun!=run){
246 m_beamE=m_readDb.
getbeamE(m_irun,m_beamE);
251 double ebeam=m_beamE;
258 for(
int list=0;list<chanlist.size();list++){
260 string channel=chanlist[list];
275 if(channel==
"DstoKsK") {
277 numchan.push_back(5);
278 numchan.push_back(1);
279 decaylist=ksList* kaonList.
plus();
281 else if(channel==
"DstoKKPi") {
283 numchan.push_back(1);
284 numchan.push_back(1);
285 numchan.push_back(2);
286 decaylist=kaonList.
minus()* kaonList.
plus()* pionList.
plus();
288 else if(channel==
"DstoKsKPi0") {
290 numchan.push_back(5);
291 numchan.push_back(1);
292 numchan.push_back(3);
293 decaylist=ksList* kaonList.
plus()* pi0List;
295 else if(channel==
"DstoKsKsPi") {
297 numchan.push_back(5);
298 numchan.push_back(5);
299 numchan.push_back(2);
300 decaylist=ksList* ksList* pionList.
plus();
302 else if(channel==
"DstoKKPiPi0") {
304 numchan.push_back(1);
305 numchan.push_back(1);
306 numchan.push_back(2);
307 numchan.push_back(3);
308 decaylist=kaonList.
minus()* kaonList.
plus()* pionList.
plus()* pi0List;
310 else if(channel==
"DstoKsKplusPiPi") {
312 numchan.push_back(5);
313 numchan.push_back(1);
314 numchan.push_back(2);
315 numchan.push_back(2);
316 decaylist=ksList* kaonList.
plus()* pionList.
plus()* pionList.
minus();
318 else if(channel==
"DstoKsKminusPiPi") {
320 numchan.push_back(5);
321 numchan.push_back(1);
322 numchan.push_back(2);
323 numchan.push_back(2);
324 decaylist=ksList* kaonList.
minus()* pionList.
plus()* pionList.
plus();
326 else if(channel==
"DstoKKPiPiPi") {
328 numchan.push_back(1);
329 numchan.push_back(1);
330 numchan.push_back(2);
331 numchan.push_back(2);
332 numchan.push_back(2);
335 else if(channel==
"DstoPiPi0") {
337 numchan.push_back(2);
338 numchan.push_back(3);
339 decaylist=pionList.
plus()* pi0List;
341 else if(channel==
"DstoPiPiPi") {
343 numchan.push_back(2);
344 numchan.push_back(2);
345 numchan.push_back(2);
346 decaylist=pionList.
plus()* pionList.
plus()* pionList.
minus();
348 else if(channel==
"DstoPiPiPiPi0") {
350 numchan.push_back(2);
351 numchan.push_back(2);
352 numchan.push_back(2);
353 numchan.push_back(3);
354 decaylist=pionList.
plus()* pionList.
plus()* pionList.
minus()* pi0List;
356 else if(channel==
"DstoPiPiPiPiPi") {
358 numchan.push_back(2);
359 numchan.push_back(2);
360 numchan.push_back(2);
361 numchan.push_back(2);
362 numchan.push_back(2);
365 else if(channel==
"DstoPiPiPiPiPiPi0") {
367 numchan.push_back(2);
368 numchan.push_back(2);
369 numchan.push_back(2);
370 numchan.push_back(2);
371 numchan.push_back(2);
372 numchan.push_back(3);
375 else if(channel==
"DstoPiPiPiPi0Pi0") {
377 numchan.push_back(2);
378 numchan.push_back(2);
379 numchan.push_back(2);
380 numchan.push_back(3);
381 numchan.push_back(3);
382 decaylist=pionList.
plus()* pionList.
plus()* pionList.
minus()* pi0List* pi0List;
384 else if(channel==
"DstoPiEta") {
386 numchan.push_back(2);
387 numchan.push_back(4);
388 decaylist=pionList.
plus()* etaList;
390 else if(channel==
"DstoPiEtaPiPiPi0") {
392 numchan.push_back(2);
393 numchan.push_back(9);
395 EtaList=pionList.
plus()* pionList.
minus()* pi0List;
396 decaylist=pionList.
plus()* EtaList;
398 else if(channel==
"DstoPiPi0Eta") {
400 numchan.push_back(2);
401 numchan.push_back(3);
402 numchan.push_back(4);
403 decaylist=pionList.
plus()* pi0List* etaList;
405 else if(channel==
"DstoPiPi0EtaPiPiPi0") {
407 numchan.push_back(2);
408 numchan.push_back(3);
409 numchan.push_back(9);
411 EtaList=pionList.
plus()* pionList.
minus()* pi0List;
412 decaylist=pionList.
plus()* pi0List* EtaList;
414 else if(channel==
"DstoPiPiPiEta") {
416 numchan.push_back(2);
417 numchan.push_back(2);
418 numchan.push_back(2);
419 numchan.push_back(4);
420 decaylist=pionList.
plus()* pionList.
plus()* pionList.
minus()* etaList;
422 else if(channel==
"DstoPiPiPiEtaPiPiPi0") {
424 numchan.push_back(2);
425 numchan.push_back(2);
426 numchan.push_back(2);
427 numchan.push_back(9);
429 EtaList=pionList.
plus()* pionList.
minus()* pi0List;
430 decaylist=pionList.
plus()* pionList.
plus()* pionList.
minus()* EtaList;
432 else if(channel==
"DstoPiEPPiPiEta") {
434 numchan.push_back(2);
435 numchan.push_back(6);
437 epList=pionList.
plus()* pionList.
minus()* etaList;
438 decaylist=pionList.
plus()* epList;
440 else if(channel==
"DstoPiPi0EPPiPiEta") {
442 numchan.push_back(2);
443 numchan.push_back(3);
444 numchan.push_back(6);
446 epList=pionList.
plus()* pionList.
minus()* etaList;
447 decaylist=pionList.
plus()* pi0List* epList;
449 else if(channel==
"DstoPiEPPiPiEtaPiPiPi0") {
451 numchan.push_back(2);
452 numchan.push_back(8);
454 EtaList=pionList.
plus()* pionList.
minus()* pi0List;
456 EtapList=pionList.
plus()* pionList.
minus()* EtaList;
457 decaylist=pionList.
plus()* EtapList;
459 else if(channel==
"DstoPiPi0EPPiPiEtaPiPiPi0") {
461 numchan.push_back(2);
462 numchan.push_back(3);
463 numchan.push_back(8);
465 EtaList=pionList.
plus()* pionList.
minus()* pi0List;
467 EtapList=pionList.
plus()* pionList.
minus()* EtaList;
468 decaylist=pionList.
plus()* pi0List* EtapList;
471 else if(channel==
"DstoPiEPRhoGam") {
473 numchan.push_back(2);
474 numchan.push_back(7);
476 rhoList=pionList.
plus()* pionList.
minus();
478 epList=rhoList* photonList;
479 decaylist=pionList.
plus()* epList;
481 else if(channel==
"DstoPiPi0EPRhoGam") {
483 numchan.push_back(2);
484 numchan.push_back(3);
485 numchan.push_back(7);
487 rhoList=pionList.
plus()* pionList.
minus();
489 epList=rhoList* photonList;
490 decaylist=pionList.
plus()* pi0List* epList;
492 else if(channel==
"DstoKsPi") {
494 numchan.push_back(5);
495 numchan.push_back(2);
496 decaylist=ksList* pionList.
plus();
498 else if(channel==
"DstoKsPiPi0") {
500 numchan.push_back(5);
501 numchan.push_back(2);
502 numchan.push_back(3);
503 decaylist=ksList* pionList.
plus()* pi0List;
505 else if(channel==
"DstoKPiPi") {
507 numchan.push_back(1);
508 numchan.push_back(2);
509 numchan.push_back(2);
510 decaylist=kaonList.
plus()* pionList.
plus()* pionList.
minus();
512 else if(channel==
"DstoKPiPiPi0") {
514 numchan.push_back(1);
515 numchan.push_back(2);
516 numchan.push_back(2);
517 numchan.push_back(3);
518 decaylist=kaonList.
plus()* pionList.
plus()* pionList.
minus()* pi0List;
520 else if(channel==
"DstoKKK") {
522 numchan.push_back(1);
523 numchan.push_back(1);
524 numchan.push_back(1);
525 decaylist=kaonList.
minus()* kaonList.
plus()* kaonList.
plus();
536 vector<int> trackid, showerid;
537 vector<int> kaonid, pionid;
538 int numofchildren=numchan.size()-1;
540 for(
int i=0; i< numofchildren;i++){
542 const CDCandidate& daughter=(*it).particle().child(i);
546 trackid.push_back(track->
trackId());
547 kaonid.push_back(track->
trackId());
549 else if(numchan[i+1]==2){
551 trackid.push_back(track->
trackId());
552 pionid.push_back(track->
trackId());
554 else if ( numchan[i+1]==3){
557 showerid.push_back(hiEnGamma->
trackId());
558 showerid.push_back(loEnGamma->
trackId());
560 else if ( numchan[i+1]==4){
563 showerid.push_back(hiEnGamma->
trackId());
564 showerid.push_back(loEnGamma->
trackId());
566 else if ( numchan[i+1]==5){
570 recDTag->
addToFitInfo(aKsCand->
mass(),fitinfo[aKsCand][0],fitinfo[aKsCand][1],fitinfo[aKsCand][2]);
574 trackid.push_back(pion1Trk->
trackId());
575 trackid.push_back(pion2Trk->
trackId());
577 else if (numchan[i+1]==6){
586 trackid.push_back(apiontrk->
trackId());
587 trackid.push_back(spiontrk->
trackId());
588 showerid.push_back(hiEnGamma->
trackId());
589 showerid.push_back(loEnGamma->
trackId());
592 else if (numchan[i+1]==7){
603 trackid.push_back(apiontrk->
trackId());
604 trackid.push_back(spiontrk->
trackId());
605 showerid.push_back(gammatrk->
trackId());
608 else if (numchan[i+1]==8){
624 trackid.push_back(apiontrk->
trackId());
625 trackid.push_back(spiontrk->
trackId());
626 trackid.push_back(e0piontrk->
trackId());
627 trackid.push_back(e1piontrk->
trackId());
628 showerid.push_back(hiEnGamma->
trackId());
629 showerid.push_back(loEnGamma->
trackId());
632 else if (numchan[i+1]==9){
641 trackid.push_back(apiontrk->
trackId());
642 trackid.push_back(spiontrk->
trackId());
643 showerid.push_back(hiEnGamma->
trackId());
644 showerid.push_back(loEnGamma->
trackId());
657 savetrack(trackid,showerid,charged_begin,charged_end,neutral_begin,neutral_end,recDTag);
658 pidtag(kaonid,pionid,kaonList_tight, pionList_tight,recDTag);
662 if(m_debug) cout<<
"beforevfit:"<<endl;
664 HepLorentzVector p4change_vfit;
667 p4change_vfit=util.
vfitref(channel, kaonid, pionid, xorigin, charged_begin);
669 p4change_vfit=util.
vfit(channel, kaonid, pionid, xorigin, charged_begin);
672 recDTag->
setp4(recDTag->
p4()+p4change_vfit);
684 recDTagCol->push_back(recDTag);
694 return StatusCode::SUCCESS;
863 HepLorentzVector p4Ds((*it).particle().momentum(), (*it).particle().energy());
864 HepLorentzVector p4Ds_New;
866 for(
int i = 0; i < numofchildren; i++){
867 const CDCandidate& daughter=(*it).particle().child(i);
871 HepVector veewks = aKsCand->
w();
872 HepLorentzVector p4KsCand;
873 p4KsCand.setX(veewks[0]);
874 p4KsCand.setY(veewks[1]);
875 p4KsCand.setZ(veewks[2]);
876 p4KsCand.setE(veewks[3]);
877 HepLorentzVector p4wks = p4KsCand;
882 vector<double> vp4ks_new = util.
UpdatedKsIfo(aKsCand,vtxsvc,m_useVFrefine);
883 HepLorentzVector p4wks_new;
884 p4wks_new.setX(vp4ks_new[0]);
885 p4wks_new.setY(vp4ks_new[1]);
886 p4wks_new.setZ(vp4ks_new[2]);
887 p4wks_new.setE(vp4ks_new[3]);
889 p4Ds = p4Ds - p4wks + p4wks_new;
897 double mass = p4Ds_New.m();
898 int charge = (*it).particle().charge();
899 recDTag->
setp4(p4Ds_New);
900 p4Ds_New.boost(-m_beta);
901 double mbc2_CMS =
ebeam*
ebeam - p4Ds_New.v().mag2();
902 double mbc_CMS = mbc2_CMS > 0 ? sqrt( mbc2_CMS ) : -10;
903 double deltaE_CMS = p4Ds_New.t() -
ebeam;
905 int tag=(*it).particle().userTag();