111 MsgStream log(
msgSvc(), name());
112 log << MSG::INFO <<
"in execute()" << endreq;
119 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),
"/Event/EventHeader");
120 int event= eventHeader->eventNumber();
126 log << MSG::DEBUG <<
"run and event = " << eventHeader->runNumber()
127 <<
" " << eventHeader->eventNumber() << endreq;
128 log << MSG::DEBUG <<
"ncharg, nneu, tottks = "
129 << recEvent->totalCharged() <<
" , "
130 << recEvent->totalNeutral() <<
" , "
131 << recEvent->totalTracks() <<endreq;
140 SmartDataPtr<EvtRecPi0Col> recPi0Col(eventSvc(),
"/Event/EvtRec/EvtRecPi0Col");
142 log << MSG::FATAL <<
"Could not find EvtRecPi0Col" << endreq;
143 return StatusCode::FAILURE;
147 SmartDataPtr<EvtRecEtaToGGCol> recEtaToGGCol(eventSvc(),
"/Event/EvtRec/EvtRecEtaToGGCol");
148 if ( ! recEtaToGGCol ) {
149 log << MSG::FATAL <<
"Could not find EvtRecEtaToGGCol" << endreq;
150 return StatusCode::FAILURE;
154 SmartDataPtr<EvtRecVeeVertexCol> recVeeVertexCol(eventSvc(),
"/Event/EvtRec/EvtRecVeeVertexCol");
155 if ( ! recVeeVertexCol ) {
156 log << MSG::FATAL <<
"Could not find EvtRecVeeVertexCol" << endreq;
157 return StatusCode::FAILURE;
163 log << MSG::FATAL <<
"EvtRecDTagCol is not registered yet" << endreq;
164 return StatusCode::FAILURE;
170 Hep3Vector xorigin(0,0,0);
173 Gaudi::svcLocator()->service(
"VertexDbSvc", vtxsvc);
178 xorigin.setX(vertex[0]);
179 xorigin.setY(vertex[1]);
180 xorigin.setZ(vertex[2]);
199 dc_fill(ksList, recVeeVertexCol->begin(), recVeeVertexCol->end());
202 map<EvtRecVeeVertex*, vector< double > > fitinfo_Ks;
203 for(
CDKsList::iterator ksit = ksList.particle_begin(); ksit != ksList.particle_end(); ++ksit ){
216 map<EvtRecVeeVertex*, vector< double > > fitinfo_Lambda;
228 dc_fill(pi0List, recPi0Col->begin(), recPi0Col->end());
231 dc_fill(etaList, recEtaToGGCol->begin(), recEtaToGGCol->end());
240 int run = eventHeader->runNumber();
241 m_ievt = eventHeader->eventNumber();
242 m_nChrg = recEvent->totalCharged();
243 m_nNeu = recEvent->totalNeutral();
244 m_nPion = pionList.
size();
245 m_nKaon = kaonList.
size();
246 m_nProton = protonList.
size();
247 m_nPi0 = pi0List.size();
248 m_nKs = ksList.size();
249 m_nLambda = lambdaList.
size();
257 if(m_ReadBeamEFromDB && m_irun!=run){
261 m_beamE=m_readDb.
getbeamE(m_irun,m_beamE);
266 double ebeam=m_beamE;
274 for(
int list=0;list<chanlist.size();list++){
276 string channel=chanlist[list];
286 if(channel==
"LambdacPtoKsP") {
288 numchan.push_back(8);
289 numchan.push_back(5);
290 decaylist=protonList.
plus()* ksList;
292 else if(channel==
"LambdacPtoKPiP") {
294 numchan.push_back(8);
295 numchan.push_back(1);
296 numchan.push_back(2);
297 decaylist=protonList.
plus()* kaonList.
minus()* pionList.
plus();
299 else if(channel==
"LambdacPtoKsPi0P") {
301 numchan.push_back(8);
302 numchan.push_back(5);
303 numchan.push_back(3);
304 decaylist=protonList.
plus()* ksList* pi0List;
306 else if(channel==
"LambdacPtoKsPiPiP") {
308 numchan.push_back(8);
309 numchan.push_back(5);
310 numchan.push_back(2);
311 numchan.push_back(2);
312 decaylist=protonList.
plus()* ksList* pionList.
plus()* pionList.
minus();
314 else if(channel==
"LambdacPtoKPiPi0P") {
316 numchan.push_back(8);
317 numchan.push_back(1);
318 numchan.push_back(2);
319 numchan.push_back(3);
320 decaylist=protonList.
plus()* kaonList.
minus()* pionList.
plus()* pi0List;
322 else if(channel==
"LambdacPtoPiPiP") {
324 numchan.push_back(8);
325 numchan.push_back(2);
326 numchan.push_back(2);
327 decaylist=protonList.
plus()* pionList.
plus()* pionList.
minus();
329 else if(channel==
"LambdacPtoLambdaPi") {
331 numchan.push_back(9);
332 numchan.push_back(2);
333 decaylist=lambdaList()* pionList.
plus();
335 else if(channel==
"LambdacPtoLambdaPiPi0") {
337 numchan.push_back(9);
338 numchan.push_back(2);
339 numchan.push_back(3);
340 decaylist=lambdaList()* pionList.
plus()* pi0List;
342 else if(channel==
"LambdacPtoLambdaPiEta") {
344 numchan.push_back(9);
345 numchan.push_back(2);
346 numchan.push_back(4);
347 decaylist=lambdaList()* pionList.
plus()* etaList;;
349 else if(channel==
"LambdacPtoLambdaPiPiPi") {
351 numchan.push_back(9);
352 numchan.push_back(2);
353 numchan.push_back(2);
354 numchan.push_back(2);
355 decaylist=lambdaList()* pionList.
plus()* pionList.
minus() *pionList.
plus();
357 else if(channel==
"LambdacPtoLambdaPiOmega") {
359 numchan.push_back(9);
360 numchan.push_back(2);
361 numchan.push_back(12);
363 omgList=pionList.
plus()* pionList.
minus() *pi0List;
364 decaylist=lambdaList()* pionList.
plus()* omgList;
366 else if(channel==
"LambdacPtoPiSIGMA0LambdaGam") {
368 numchan.push_back(2);
369 numchan.push_back(10);
371 sgmList=lambdaList()* photonList;
372 decaylist=pionList.
plus()* sgmList;
374 else if(channel==
"LambdacPtoPiPi0SIGMA0LambdaGam") {
376 numchan.push_back(2);
377 numchan.push_back(3);
378 numchan.push_back(10);
380 sgmList=lambdaList()* photonList;
381 decaylist=pionList.
plus()* pi0List* sgmList;
383 else if(channel==
"LambdacPtoPi0SIGMAPi0P") {
385 numchan.push_back(3);
386 numchan.push_back(11);
388 sgmList=pi0List* protonList.
plus();
389 decaylist=pi0List* sgmList;
391 else if(channel==
"LambdacPtoPiPiSIGMAPi0P") {
393 numchan.push_back(2);
394 numchan.push_back(2);
395 numchan.push_back(11);
397 sgmList=pi0List* protonList.
plus();
398 decaylist=pionList.
plus()* pionList.
minus()* sgmList;
400 else if(channel==
"LambdacPtoOmegaSIGMAPi0P") {
402 numchan.push_back(12);
403 numchan.push_back(11);
405 omgList=pionList.
plus()* pionList.
minus()* pi0List;
407 sgmList=pi0List* protonList.
plus();
408 decaylist=omgList* sgmList;
410 else if(channel==
"LambdacPtoPiPiPi0SIGMAPi0P") {
412 numchan.push_back(2);
413 numchan.push_back(2);
414 numchan.push_back(3);
415 numchan.push_back(11);
417 sgmList=pi0List* protonList.
plus();
418 decaylist=pionList.
plus()* pionList.
minus()*pi0List* sgmList;
430 vector<int> trackid, showerid;
431 vector<int> kaonid, pionid, protonid;
432 int numofchildren=numchan.size()-1;
434 for(
int i=0; i< numofchildren;i++){
436 const CDCandidate& daughter=(*it).particle().child(i);
440 trackid.push_back(track->
trackId());
441 kaonid.push_back(track->
trackId());
443 else if(numchan[i+1]==2){
445 trackid.push_back(track->
trackId());
446 pionid.push_back(track->
trackId());
448 else if(numchan[i+1]==8){
450 trackid.push_back(track->
trackId());
451 protonid.push_back(track->
trackId());
453 else if ( numchan[i+1]==3){
456 showerid.push_back(hiEnGamma->
trackId());
457 showerid.push_back(loEnGamma->
trackId());
459 else if ( numchan[i+1]==4){
462 showerid.push_back(hiEnGamma->
trackId());
463 showerid.push_back(loEnGamma->
trackId());
465 else if ( numchan[i+1]==5){
467 recDTag->
addToFitInfo(aKsCand->
mass(),fitinfo_Ks[aKsCand][0],fitinfo_Ks[aKsCand][1],fitinfo_Ks[aKsCand][2]);
470 trackid.push_back(pion1Trk->
trackId());
471 trackid.push_back(pion2Trk->
trackId());
473 else if ( numchan[i+1]==9){
475 recDTag->
addToFitInfo(aLambdaCand->
mass(),fitinfo_Lambda[aLambdaCand][0],fitinfo_Lambda[aLambdaCand][1],fitinfo_Lambda[aLambdaCand][2]);
477 int index[2] = {0, 1};
485 trackid.push_back(protonTrk->
trackId());
486 trackid.push_back(pionTrk->
trackId());
488 else if (numchan[i+1]==6){
497 trackid.push_back(apiontrk->
trackId());
498 trackid.push_back(spiontrk->
trackId());
499 showerid.push_back(hiEnGamma->
trackId());
500 showerid.push_back(loEnGamma->
trackId());
503 else if (numchan[i+1]==7){
514 trackid.push_back(apiontrk->
trackId());
515 trackid.push_back(spiontrk->
trackId());
516 showerid.push_back(gammatrk->
trackId());
519 else if (numchan[i+1]==10){
522 showerid.push_back(gammatrk->
trackId());
525 recDTag->
addToFitInfo(aLambdaCand->
mass(),fitinfo_Lambda[aLambdaCand][0],fitinfo_Lambda[aLambdaCand][1],fitinfo_Lambda[aLambdaCand][2]);
527 int index[2] = {0, 1};
535 trackid.push_back(protonTrk->
trackId());
536 trackid.push_back(pionTrk->
trackId());
539 else if (numchan[i+1]==11){
550 showerid.push_back(agamtrk->
trackId());
551 showerid.push_back(sgamtrk->
trackId());
552 trackid.push_back(Ptrk->
trackId());
554 else if (numchan[i+1]==12){
563 trackid.push_back(apiontrk->
trackId());
564 trackid.push_back(spiontrk->
trackId());
565 showerid.push_back(hiEnGamma->
trackId());
566 showerid.push_back(loEnGamma->
trackId());
578 savetrack(trackid,showerid,charged_begin,charged_end,neutral_begin,neutral_end,recDTag);
579 pidtag(kaonid,pionid,protonid, kaonList_tight, pionList_tight, protonList_tight, recDTag);
582 if(m_debug) cout<<
"beforevfit:"<<endl;
584 HepLorentzVector p4change_vfit;
587 p4change_vfit=util.
vfitref(channel, kaonid, pionid, xorigin, charged_begin);
589 p4change_vfit=util.
vfit(channel, kaonid, pionid, xorigin, charged_begin);
592 recDTag->
setp4(recDTag->
p4()+p4change_vfit);
603 recDTagCol->push_back(recDTag);
611 return StatusCode::SUCCESS;
784 HepLorentzVector p4Lc((*it).particle().momentum(), (*it).particle().energy());
785 HepLorentzVector p4Lc_New;
787 for(
int i = 0; i < numofchildren; i++){
788 const CDCandidate& daughter=(*it).particle().child(i);
792 HepVector veewks = aKsCand->
w();
793 HepLorentzVector p4KsCand;
794 p4KsCand.setX(veewks[0]);
795 p4KsCand.setY(veewks[1]);
796 p4KsCand.setZ(veewks[2]);
797 p4KsCand.setE(veewks[3]);
798 HepLorentzVector p4wks = p4KsCand;
803 vector<double> vp4ks_new = util.
UpdatedKsIfo(aKsCand,vtxsvc,m_useVFrefine);
804 HepLorentzVector p4wks_new;
805 p4wks_new.setX(vp4ks_new[0]);
806 p4wks_new.setY(vp4ks_new[1]);
807 p4wks_new.setZ(vp4ks_new[2]);
808 p4wks_new.setE(vp4ks_new[3]);
810 p4Lc = p4Lc - p4wks + p4wks_new;
816 HepVector veewlambda = aLambdaCand->
w();
817 HepLorentzVector p4LambdaCand;
818 p4LambdaCand.setX(veewlambda[0]);
819 p4LambdaCand.setY(veewlambda[1]);
820 p4LambdaCand.setZ(veewlambda[2]);
821 p4LambdaCand.setE(veewlambda[3]);
822 HepLorentzVector p4wlambda = p4LambdaCand;
827 vector<double> vp4lambda_new = util.
UpdatedLambdaIfo(aLambdaCand,vtxsvc,m_useVFrefine);
828 HepLorentzVector p4wlambda_new;
829 p4wlambda_new.setX(vp4lambda_new[0]);
830 p4wlambda_new.setY(vp4lambda_new[1]);
831 p4wlambda_new.setZ(vp4lambda_new[2]);
832 p4wlambda_new.setE(vp4lambda_new[3]);
834 p4Lc = p4Lc - p4wlambda + p4wlambda_new;
838 if(numchan[i+1]==10){
840 HepVector veewlambda = aLambdaCand->
w();
841 HepLorentzVector p4LambdaCand;
842 p4LambdaCand.setX(veewlambda[0]);
843 p4LambdaCand.setY(veewlambda[1]);
844 p4LambdaCand.setZ(veewlambda[2]);
845 p4LambdaCand.setE(veewlambda[3]);
846 HepLorentzVector p4wlambda = p4LambdaCand;
851 vector<double> vp4lambda_new = util.
UpdatedLambdaIfo(aLambdaCand,vtxsvc,m_useVFrefine);
852 HepLorentzVector p4wlambda_new;
853 p4wlambda_new.setX(vp4lambda_new[0]);
854 p4wlambda_new.setY(vp4lambda_new[1]);
855 p4wlambda_new.setZ(vp4lambda_new[2]);
856 p4wlambda_new.setE(vp4lambda_new[3]);
858 p4Lc = p4Lc - p4wlambda + p4wlambda_new;
866 double mass = p4Lc_New.m();
867 int charge = (*it).particle().charge();
868 recDTag->
setp4(p4Lc_New);
869 p4Lc_New.boost(-m_beta);
870 double mbc2_CMS =
ebeam*
ebeam - p4Lc_New.v().mag2();
871 double mbc_CMS = mbc2_CMS > 0 ? sqrt( mbc2_CMS ) : -10;
872 double deltaE_CMS = p4Lc_New.t() -
ebeam;
874 int tag=(*it).particle().userTag();