302 MsgStream log(
msgSvc(), name());
303 log << MSG::INFO <<
"in execute()" << endreq;
305 setFilterPassed(
false);
307 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),
"/Event/EventHeader");
308 int runNo=eventHeader->runNumber();
309 int event=eventHeader->eventNumber();
310 log << MSG::DEBUG <<
"runNo, evtnum = "
318 log << MSG::INFO <<
"get event tag OK" << endreq;
319 log << MSG::DEBUG <<
"ncharg, nneu, tottks = "
320 << evtRecEvent->totalCharged() <<
" , "
321 << evtRecEvent->totalNeutral() <<
" , "
322 << evtRecEvent->totalTracks() <<endreq;
331 if(evtRecEvent->totalNeutral()>100) {
332 return StatusCode::SUCCESS;
335 Vint iGood, ipip, ipim;
343 Hep3Vector xorigin(0,0,0);
347 Gaudi::svcLocator()->service(
"VertexDbSvc", vtxsvc);
353 xorigin.setX(dbv[0]);
354 xorigin.setY(dbv[1]);
355 xorigin.setZ(dbv[2]);
359 for(
int i = 0; i < evtRecEvent->totalCharged(); i++){
361 if(!(*itTrk)->isMdcTrackValid())
continue;
362 if (!(*itTrk)->isMdcKalTrackValid())
continue;
365 double pch =mdcTrk->
p();
366 double x0 =mdcTrk->
x();
367 double y0 =mdcTrk->
y();
368 double z0 =mdcTrk->
z();
369 double phi0=mdcTrk->
helix(1);
370 double xv=xorigin.x();
371 double yv=xorigin.y();
372 double Rxy=fabs((x0-xv)*
cos(phi0)+(y0-yv)*
sin(phi0));
376 double m_vz0 = z0-xorigin.z();
378 double m_Vctc=z0/sqrt(Rxy*Rxy+z0*z0);
383 if(fabs(m_vz0) >= m_vz0cut)
continue;
384 if(m_vr0 >= m_vr0cut)
continue;
386 iGood.push_back((*itTrk)->trackId());
387 nCharge += mdcTrk->
charge();
393 int nGood = iGood.size();
395 log << MSG::DEBUG <<
"ngood, totcharge = " << nGood <<
" , " << nCharge << endreq;
396 if((nGood != 4)||(nCharge!=0)){
397 return StatusCode::SUCCESS;
404 for(
int i = evtRecEvent->totalCharged(); i< evtRecEvent->totalTracks(); i++) {
406 if(!(*itTrk)->isEmcShowerValid())
continue;
408 Hep3Vector emcpos(emcTrk->
x(), emcTrk->
y(), emcTrk->
z());
413 log << MSG::DEBUG <<
"liuf neu= " <<i <<endreq;
414 for(
int j = 0; j < evtRecEvent->totalCharged(); j++) {
416 if(!(*jtTrk)->isExtTrackValid())
continue;
420 log << MSG::DEBUG <<
"liuf charge= " <<j <<endreq;
422 double angd = extpos.angle(emcpos);
423 double thed = extpos.theta() - emcpos.theta();
424 double phid = extpos.deltaPhi(emcpos);
425 thed = fmod(thed+CLHEP::twopi+CLHEP::twopi+
pi, CLHEP::twopi) - CLHEP::pi;
426 phid = fmod(phid+CLHEP::twopi+CLHEP::twopi+
pi, CLHEP::twopi) - CLHEP::pi;
436 if(dang>=200)
continue;
437 double eraw = emcTrk->
energy();
438 dthe = dthe * 180 / (CLHEP::pi);
439 dphi = dphi * 180 / (CLHEP::pi);
440 dang = dang * 180 / (CLHEP::pi);
442 double m_dthe = dthe;
443 double m_dphi = dphi;
444 double m_dang = dang;
445 double m_eraw = eraw;
448 log << MSG::DEBUG <<
"eraw dang= " << eraw <<
" , " <<dang <<
"," <<i <<endreq;
449 if(eraw < m_energyThreshold)
continue;
450 if(dang < m_gammaAngCut)
continue;
455 iGam.push_back((*itTrk)->trackId());
461 int nGam = iGam.size();
463 log << MSG::DEBUG <<
"num Good Photon " << nGam <<
" , " <<evtRecEvent->totalNeutral()<<endreq;
465 return StatusCode::SUCCESS;
479 for(
int i = 0; i < nGam; i++) {
482 double eraw = emcTrk->
energy();
483 double phi = emcTrk->
phi();
484 double the = emcTrk->
theta();
485 HepLorentzVector ptrk;
486 ptrk.setPx(eraw*
sin(the)*
cos(phi));
487 ptrk.setPy(eraw*
sin(the)*
sin(phi));
488 ptrk.setPz(eraw*
cos(the));
493 pGam.push_back(ptrk);
497 for(
int i = 0; i < nGood; i++) {
499 if (!(*itTrk)->isMdcTrackValid())
continue;
501 if (!(*itTrk)->isMdcKalTrackValid())
continue;
504 if(mdcKalTrk->
charge() >0 ) {
505 ipip.push_back(iGood[i]);
506 HepLorentzVector ptrk;
507 ptrk.setPx(mdcKalTrk->
px());
508 ptrk.setPy(mdcKalTrk->
py());
509 ptrk.setPz(mdcKalTrk->
pz());
510 double p3 = ptrk.mag();
511 ptrk.setE(sqrt(p3*p3+
mpi*
mpi));
512 ppip.push_back(ptrk);
514 ipim.push_back(iGood[i]);
515 HepLorentzVector ptrk;
516 ptrk.setPx(mdcKalTrk->
px());
517 ptrk.setPy(mdcKalTrk->
py());
518 ptrk.setPz(mdcKalTrk->
pz());
519 double p3 = ptrk.mag();
520 ptrk.setE(sqrt(p3*p3+
mpi*
mpi));
521 ppim.push_back(ptrk);
526 int npip = ipip.size();
527 int npim = ipim.size();
528 if(npip!=2||npim != 2)
return SUCCESS;
542 HepLorentzVector pTot0(0.011*3.6862,0,0,3.6862);
543 HepLorentzVector pTrec1,pTrec2,pTrec3,pTrec4;
544 HepLorentzVector pTrecf;
545 double m_recjpsi1,m_recjpsi2,m_recjpsi3,m_recjpsi4,m_recppf;
546 double deljp1,deljp2,deljp3,deljp4;
547 pTrec1 = pTot0 - ppip[0] - ppim[0];
548 pTrec2 = pTot0 - ppip[0] - ppim[1];
549 pTrec3 = pTot0 - ppip[1] - ppim[0];
550 pTrec4 = pTot0 - ppip[1] - ppim[1];
551 m_recjpsi1 = pTrec1.m();
552 m_recjpsi2 = pTrec2.m();
553 m_recjpsi3 = pTrec3.m();
554 m_recjpsi4 = pTrec4.m();
555 deljp1=fabs(m_recjpsi1-3.097);
556 deljp2=fabs(m_recjpsi2-3.097);
557 deljp3=fabs(m_recjpsi3-3.097);
558 deljp4=fabs(m_recjpsi4-3.097);
560 int itmp,itmp1,itmp2;
561 HepLorentzVector ptmp,ptmp1,ptmp2;
566 if(deljp2<deljp1&&deljp2<deljp3&&deljp2<deljp4)
579 if(deljp3<deljp1&&deljp3<deljp2&&deljp3<deljp4)
592 if(deljp4<deljp1&&deljp4<deljp2&&deljp4<deljp3)
611 if(fabs(m_recppf-3.097)>0.2)
return SUCCESS;
613 log << MSG::DEBUG <<
"ngood track ID after jpsi = " << ipip[0] <<
" , "
614 << ipim[0]<<
" , " << ipip[1] <<
" , " << ipim[1] << endreq;
617 HepLorentzVector ppi2_no1 = ppip[0] + ppim[0];
618 HepLorentzVector ppi2_no2 = ppip[1] + ppim[1];
619 HepLorentzVector ppi2_no3 = ppip[0] + ppim[1];
620 HepLorentzVector ppi2_no4 = ppip[1] + ppim[0];
621 HepLorentzVector p4pi_no = ppi2_no1+ ppi2_no2;
638 double phi01=mdcTrkp1->
helix(1);
639 double m_p1vx = mdcTrkp1->
x();
640 double m_p1vy = mdcTrkp1->
y();
641 double m_p1vz = mdcTrkp1->
z()-xorigin.z();
642 double m_p1vr = fabs((mdcTrkp1->
x()-xorigin.x())*
cos(phi01)+(mdcTrkp1->
y()-xorigin.y())*
sin(phi01));
643 double m_p1vct=
cos(mdcTrkp1->
theta());
644 double m_p1ptot=mdcKalTrkp1->
p();
645 double m_p1pxy=sqrt(mdcKalTrkp1->
px()*mdcKalTrkp1->
px()+mdcKalTrkp1->
py()*mdcKalTrkp1->
py());
647 if((*itTrkp1)->isEmcShowerValid()){
648 emcTg1=emcTrkp1->
energy();
650 if((*itTrkp1)->isMucTrackValid()){
653 double m_laypip1=laypi1;
661 double phi02=mdcTrkm1->
helix(1);
662 double m_m1vx = mdcTrkm1->
x();
663 double m_m1vy = mdcTrkm1->
y();
664 double m_m1vz = mdcTrkm1->
z()-xorigin.z();
665 double m_m1vr = fabs((mdcTrkm1->
x()-xorigin.x())*
cos(phi02)+(mdcTrkm1->
y()-xorigin.y())*
sin(phi02));
666 double m_m1vct=
cos(mdcTrkm1->
theta());
667 double m_m1ptot=mdcKalTrkm1->
p();
668 double m_m1pxy=sqrt(mdcKalTrkm1->
px()*mdcKalTrkm1->
px()+mdcKalTrkm1->
py()*mdcKalTrkm1->
py());
670 if((*itTrkm1)->isEmcShowerValid()){
671 emcTg2= emcTrkm1->
energy();
673 if((*itTrkm1)->isMucTrackValid()){
676 double m_laypim1=laypi2;
684 double phi03=mdcTrkp2->
helix(1);
685 double m_p2vx = mdcTrkp2->
x();
686 double m_p2vy = mdcTrkp2->
y();
687 double m_p2vz = mdcTrkp2->
z()-xorigin.z();
688 double m_p2vr = fabs((mdcTrkp2->
x()-xorigin.x())*
cos(phi03)+(mdcTrkp2->
y()-xorigin.y())*
sin(phi03));
689 double m_p2vct=
cos(mdcTrkp2->
theta());
690 double m_p2ptot=mdcKalTrkp2->
p();
691 double m_p2pxy=sqrt(mdcKalTrkp2->
px()*mdcKalTrkp2->
px()+mdcKalTrkp2->
py()*mdcKalTrkp2->
py());
693 if((*itTrkp2)->isEmcShowerValid()){
694 emcTg3= emcTrkp2->
energy();
696 if((*itTrkp2)->isMucTrackValid()){
699 double m_laypip2=laypi3;
707 double phi04=mdcTrkm2->
helix(1);
708 double m_m2vx = mdcTrkm2->
x();
709 double m_m2vy = mdcTrkm2->
y();
710 double m_m2vz = mdcTrkm2->
z()-xorigin.z();
711 double m_m2vr = fabs((mdcTrkm2->
x()-xorigin.x())*
cos(phi04)+(mdcTrkm2->
y()-xorigin.y())*
sin(phi04));
712 double m_m2vct=
cos(mdcTrkm2->
theta());
713 double m_m2ptot=mdcKalTrkm2->
p();
714 double m_m2pxy=sqrt(mdcKalTrkm2->
px()*mdcKalTrkm2->
px()+mdcKalTrkm2->
py()*mdcKalTrkm2->
py());
716 if((*itTrkm2)->isEmcShowerValid()){
717 emcTg4= emcTrkm2->
energy();
719 if((*itTrkm2)->isMucTrackValid()){
722 double m_laypim2=laypi4;
724 double m_emcTp1 =emcTg1;
725 double m_emcTm1 =emcTg2;
726 double m_emcTp2 =emcTg3;
727 double m_emcTm2 =emcTg4;
729 if(fabs(m_p1vz) >= m_vz1cut)
return SUCCESS;
730 if(m_p1vr >= m_vr1cut)
return SUCCESS;
731 if(fabs(m_p1vct)>=m_cthcut)
return SUCCESS;
733 if(fabs(m_m1vz) >= m_vz1cut)
return SUCCESS;
734 if(m_m1vr >= m_vr1cut)
return SUCCESS;
735 if(fabs(m_m1vct)>=m_cthcut)
return SUCCESS;
738 HepLorentzVector p4muonp = ppip[1];
739 HepLorentzVector p4muonm = ppim[1];
740 HepLorentzVector p4uu = pTrecf;
743 Hep3Vector p3jpsiUnit = (p4uu.vect()).unit();
744 double jBeta = p4uu.beta();
753 HepLorentzVector pTot;
755 for(
int i = 0; i < nGam - 1; i++){
756 for(
int j = i+1; j < nGam; j++) {
757 HepLorentzVector p2g = pGam[i] + pGam[j];
758 pTot = ppip[0] + ppim[0] + ppip[1] + ppim[1];
760 if(fabs(p2g.m()-0.135)<minpi0){
761 minpi0 = fabs(p2g.m()-0.135);
763 double m_m2gg = p2g.m();
765 HepLorentzVector prho0_no = ppi2_no2;
766 HepLorentzVector prhop_no = ppip[1] + p2g;
767 HepLorentzVector prhom_no = ppim[1] + p2g;
768 HepLorentzVector prho0pi0 = ppi2_no2 + p2g;
769 HepLorentzVector frho1pi0 = ppi2_no1 + p2g;
770 HepLorentzVector frho2pi0 = ppi2_no3 + p2g;
771 HepLorentzVector frho3pi0 = ppi2_no4 + p2g;
772 HepLorentzVector prho0g1 = ppi2_no2 + pGam[i];
773 HepLorentzVector prho0g2 = ppi2_no2 + pGam[j];
774 HepLorentzVector frho1g1 = ppi2_no1 + pGam[i];
775 HepLorentzVector frho1g2 = ppi2_no1 + pGam[j];
776 HepLorentzVector frho2g1 = ppi2_no3 + pGam[i];
777 HepLorentzVector frho2g2 = ppi2_no3 + pGam[j];
778 HepLorentzVector frho3g1 = ppi2_no4 + pGam[i];
779 HepLorentzVector frho3g2 = ppi2_no4 + pGam[j];
780 HepLorentzVector p5pi_no = p4pi_no + p2g;
783 double m_prho0_no = prho0_no.m();
784 double m_prhop_no = prhop_no.m();
785 double m_prhom_no = prhom_no.m();
786 double m_prho0pi0 = prho0pi0.m();
787 double m_frho1pi0 = frho1pi0.m();
788 double m_frho2pi0 = frho2pi0.m();
789 double m_frho3pi0 = frho3pi0.m();
790 double m_prho0g1 = prho0g1.m();
791 double m_prho0g2 = prho0g2.m();
792 double m_frho1g1 = frho1g1.m();
793 double m_frho1g2 = frho1g2.m();
794 double m_frho2g1 = frho2g1.m();
795 double m_frho2g2 = frho2g2.m();
796 double m_frho3g1 = frho3g1.m();
797 double m_frho3g2 = frho3g2.m();
798 double m_p4pi_no = p4pi_no.m();
799 double m_p5pi_no = p5pi_no.m();
800 double m_mdcpx1=ppip[0].px();
801 double m_mdcpy1=ppip[0].py();
802 double m_mdcpz1=ppip[0].pz();
803 double m_mdcpe1=ppip[0].e();
804 double m_mdcpx2=ppim[0].px();
805 double m_mdcpy2=ppim[0].py();
806 double m_mdcpz2=ppim[0].pz();
807 double m_mdcpe2=ppim[0].e();
808 double m_mdcpx3=ppip[1].px();
809 double m_mdcpy3=ppip[1].py();
810 double m_mdcpz3=ppip[1].pz();
811 double m_mdcpe3=ppip[1].e();
812 double m_mdcpx4=ppim[1].px();
813 double m_mdcpy4=ppim[1].py();
814 double m_mdcpz4=ppim[1].pz();
815 double m_mdcpe4=ppim[1].e();
816 double m_mdcpxg1=pGam[i].px();
817 double m_mdcpyg1=pGam[i].py();
818 double m_mdcpzg1=pGam[i].pz();
819 double m_mdcpeg1=pGam[i].e();
820 double m_mdcpxg2=pGam[j].px();
821 double m_mdcpyg2=pGam[j].py();
822 double m_mdcpzg2=pGam[j].pz();
823 double m_mdcpeg2=pGam[j].e();
824 double m_etot = pTot.e();
825 double m_mrecjp1=m_recjpsi1;
826 double m_mrecjp2=m_recjpsi2;
827 double m_mrecjp3=m_recjpsi3;
828 double m_mrecjp4=m_recjpsi4;
842 HepSymMatrix Evx(3, 0);
860 RecMdcKalTrack *pipTrk1 = (*(evtRecTrkCol->begin()+ipip[0]))->mdcKalTrack();
861 RecMdcKalTrack *pimTrk1 = (*(evtRecTrkCol->begin()+ipim[0]))->mdcKalTrack();
862 RecMdcKalTrack *pipTrk2 = (*(evtRecTrkCol->begin()+ipip[1]))->mdcKalTrack();
863 RecMdcKalTrack *pimTrk2 = (*(evtRecTrkCol->begin()+ipim[1]))->mdcKalTrack();
874 if(!vtxfit->
Fit(0))
return SUCCESS;
889 HepLorentzVector pTgam1(0,0,0,0);
890 HepLorentzVector pTgam2(0,0,0,0);
894 HepLorentzVector
ecms(0.011*3.6862,0,0,3.6862);
902 double chisq = 9999.;
906 for(
int i = 0; i < nGam-1; i++) {
907 RecEmcShower *g1Trk = (*(evtRecTrkCol->begin()+iGam[i]))->emcShower();
908 for(
int j = i+1; j < nGam; j++) {
909 RecEmcShower *g2Trk = (*(evtRecTrkCol->begin()+iGam[j]))->emcShower();
919 bool oksq = kmfit->
Fit();
920 if(oksq&&kmfit->
chisq()<chikk) {
921 chikk = kmfit->
chisq();
934 for(
int i = 0; i < nGam-1; i++) {
935 RecEmcShower *g1Trk = (*(evtRecTrkCol->begin()+iGam[i]))->emcShower();
936 for(
int j = i+1; j < nGam; j++) {
937 RecEmcShower *g2Trk = (*(evtRecTrkCol->begin()+iGam[j]))->emcShower();
947 bool oksq = kmfit->
Fit();
949 double chi2 = kmfit->
chisq();
964 if(chisq > 200)
return SUCCESS;
970 jGood.push_back(ipip[0]);
971 jGood.push_back(ipim[0]);
972 jGood.push_back(ipip[1]);
973 jGood.push_back(ipim[1]);
979 jGgam.push_back(igbf1);
980 jGgam.push_back(igbf2);
982 double chi1_pp=9999.0;
984 RecEmcShower *g1Trk = (*(evtRecTrkCol->begin()+ig1))->emcShower();
985 RecEmcShower *g2Trk = (*(evtRecTrkCol->begin()+ig2))->emcShower();
994 bool oksq = kmfit->
Fit();
996 chi1_pp = kmfit->
chisq();
997 HepLorentzVector ppi0 = kmfit->
pfit(4) + kmfit->
pfit(5);
998 HepLorentzVector prho0= kmfit->
pfit(2) + kmfit->
pfit(3);
999 HepLorentzVector prhop= kmfit->
pfit(2) + ppi0;
1000 HepLorentzVector prhom= kmfit->
pfit(3) + ppi0;
1001 HepLorentzVector pjjj = prho0 + ppi0;
1003 HepLorentzVector p2pi1=kmfit->
pfit(0) + kmfit->
pfit(1);
1004 HepLorentzVector f2pi1g1= p2pi1 + kmfit->
pfit(4);
1005 HepLorentzVector f2pi1g2= p2pi1 + kmfit->
pfit(5);
1006 HepLorentzVector f2pi1pi0=p2pi1 + ppi0;
1008 HepLorentzVector t2pi2g1= prho0 + kmfit->
pfit(4);
1009 HepLorentzVector t2pi2g2= prho0 + kmfit->
pfit(5);
1011 HepLorentzVector p2pi3=kmfit->
pfit(0) + kmfit->
pfit(3);
1012 HepLorentzVector f2pi3g1= p2pi3 + kmfit->
pfit(4);
1013 HepLorentzVector f2pi3g2= p2pi3 + kmfit->
pfit(5);
1014 HepLorentzVector f2pi3pi0=p2pi3 + ppi0;
1016 HepLorentzVector p2pi4=kmfit->
pfit(1) + kmfit->
pfit(2);
1017 HepLorentzVector f2pi4g1= p2pi4 + kmfit->
pfit(4);
1018 HepLorentzVector f2pi4g2= p2pi4 + kmfit->
pfit(5);
1019 HepLorentzVector f2pi4pi0=p2pi4 + ppi0;
1021 HepLorentzVector p4pi= p2pi1 + prho0;
1022 HepLorentzVector p4pig1= p4pi + kmfit->
pfit(4);
1023 HepLorentzVector p4pig2= p4pi + kmfit->
pfit(5);
1024 HepLorentzVector ppptot= p4pi + ppi0;
1027 HepLorentzVector be4cpi0= pTgam1 + pTgam2;
1028 HepLorentzVector be4c_ppi1 = ppip[0] + ppim[0];
1029 HepLorentzVector be4c_ppi2 = ppip[1] + ppim[1];
1030 HepLorentzVector be4cjp= be4cpi0 + be4c_ppi2;
1436 setFilterPassed(
true);
1438 (*(evtRecTrkCol->begin()+ipip[0]))->setPartId(2);
1439 (*(evtRecTrkCol->begin()+ipim[0]))->setPartId(2);
1440 (*(evtRecTrkCol->begin()+ipip[1]))->setPartId(2);
1441 (*(evtRecTrkCol->begin()+ipim[1]))->setPartId(2);
1444 return StatusCode::SUCCESS;