488 MsgStream log(
msgSvc(), name());
489 log << MSG::INFO <<
"in execute()" << endreq;
491 if( m_writeDst) m_subalg1->execute();
492 if( m_writeRec) m_subalg2->execute();
495 m_isRadBhabha =
false;
498 m_isRadBhabhaT =
false;
501 m_isRecoJpsi =
false;
506 m_isGenProton =
false;
507 m_isPsipRhoPi =
false;
508 m_isPsipKstarK =
false;
509 m_isPsipPPPiPi =
false;
510 m_isPsippCand =
false;
512 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),
"/Event/EventHeader");
515 cout<<
" eventHeader "<<endl;
516 return StatusCode::FAILURE;
519 int run=eventHeader->runNumber();
520 int event=eventHeader->eventNumber();
527 cout<<
"new run is:"<<m_run<<endl;
528 cout<<
"beamE is:"<<beamE<<endl;
529 if(beamE>0 && beamE<3)
535 if(m_display && m_events%1000==0){
536 cout<< m_events <<
" -------- run,event: "<<run<<
","<<
event<<endl;
537 cout<<
"m_ecm="<<m_ecm<<endl;
543 cout<<
" evtRecEvent "<<endl;
544 return StatusCode::FAILURE;
547 log << MSG::DEBUG <<
"ncharg, nneu, tottks = "
548 << evtRecEvent->totalCharged() <<
" , "
549 << evtRecEvent->totalNeutral() <<
" , "
550 << evtRecEvent->totalTracks() <<endreq;
553 cout<<
" evtRecTrkCol "<<endl;
554 return StatusCode::FAILURE;
557 if(evtRecEvent->totalTracks()!=evtRecTrkCol->size())
return StatusCode::SUCCESS;
561 SmartDataPtr<EvtRecPi0Col> recPi0Col(eventSvc(),
"/Event/EvtRec/EvtRecPi0Col");
563 log << MSG::FATAL <<
"Could not find EvtRecPi0Col" << endreq;
564 return StatusCode::FAILURE;
568 int nPi0 = recPi0Col->size();
569 EvtRecPi0Col::iterator itpi0 = recPi0Col->begin();
571 double mpi0 = (*itpi0)->unconMass();
572 if ( fabs(
mpi0 - 0.135 )> 0.015 )
589 vector<int> iCP, iCN;
597 int nCosmicCharge =0;
599 for(
int i = 0;i < evtRecEvent->totalCharged(); i++)
606 if(!(*itTrk)->isMdcKalTrackValid())
continue;
611 double vx0 = mdcTrk->
x();
612 double vy0 = mdcTrk->
y();
613 double vz0 = mdcTrk->
z();
614 double vr0 = mdcTrk->
r();
615 double theta0 = mdcTrk->
theta();
616 double p0 =
P(mdcTrk);
617 double pt0 = sqrt( pow(
Px(mdcTrk),2)+pow(
Py(mdcTrk),2));
633 Hep3Vector xorigin(0,0,0);
635 Gaudi::svcLocator()->service(
"VertexDbSvc", vtxsvc);
639 xorigin.setX(dbv[0]);
640 xorigin.setY(dbv[1]);
641 xorigin.setZ(dbv[2]);
646 HepPoint3D IP(xorigin[0],xorigin[1],xorigin[2]);
649 HepVector vecipa = helixip.
a();
650 double db=fabs(vecipa[0]);
656 if(fabs(dz) >= m_vz0cut)
continue;
657 if(db >= m_vr0cut)
continue;
660 if(p0>m_cosmic_lowp && p0<20){
661 iCosmicGood.push_back((*itTrk)->trackId());
662 nCosmicCharge += mdcTrk->
charge();
667 if(pt0 >= m_pt0HighCut)
continue;
668 if(pt0 <= m_pt0LowCut)
continue;
670 iGood.push_back((*itTrk)->trackId());
671 nCharge += mdcTrk->
charge();
673 iCP.push_back((*itTrk)->trackId());
674 else if(mdcTrk->
charge()<0)
675 iCN.push_back((*itTrk)->trackId());
679 int nGood = iGood.size();
680 int nCosmicGood = iCosmicGood.size();
685 for(
int i = evtRecEvent->totalCharged(); i< evtRecEvent->totalTracks(); i++) {
688 if(!(*itTrk)->isEmcShowerValid())
continue;
690 double eraw = emcTrk->
energy();
692 double costh =
cos(emcTrk->
theta());
693 if(fabs(costh)<0.83 && eraw<0.025)
continue;
694 if(fabs(costh)>=0.83 && eraw<0.05)
continue;
697 iGam.push_back((*itTrk)->trackId());
699 int nGam = iGam.size();
724 Hep3Vector Pt_charge(0,0,0);
726 for(
int i = 0; i < nGood; i++) {
733 if((*itTrk)->isMdcKalTrackValid()) {
740 double phi=
Phi(mdcTrk);
743 HepLorentzVector ptrk;
744 ptrk.setPx(
Px(mdcTrk));
745 ptrk.setPy(
Py(mdcTrk));
746 ptrk.setPz(
Pz(mdcTrk));
747 p3 = fabs(ptrk.mag());
755 Hep3Vector ptemp(
Px(mdcTrk),
Py(mdcTrk),0);
759 if((*itTrk)->isEmcShowerValid()) {
772 else if( p3 < pmax && p3> psec){
782 ptrk.setE(sqrt(p3*p3+
mpi*
mpi));
783 ptrk = ptrk.boost(-0.011,0,0);
790 ppip.push_back(ptrk);
793 ppim.push_back(ptrk);
799 if((*itTrk)->isEmcShowerValid()) {
802 double eraw = emcTrk->
energy();
803 double phiemc = emcTrk->
phi();
804 double the = emcTrk->
theta();
806 HepLorentzVector pemc;
807 pemc.setPx(eraw*
sin(the)*
cos(phiemc));
808 pemc.setPy(eraw*
sin(the)*
sin(phiemc));
809 pemc.setPz(eraw*
cos(the));
811 pemc = pemc.boost(-0.011,0,0);
823 if(pmax!=0) eopmax=eccmax/pmax;
824 if(psec!=0) eopsec=eccsec/psec;
843 Hep3Vector Pt_neu(0,0,0);
845 for(
int i = 0; i < nGam; i++) {
848 double eraw = emcTrk->
energy();
849 double phi = emcTrk->
phi();
850 double the = emcTrk->
theta();
851 HepLorentzVector ptrk;
852 ptrk.setPx(eraw*
sin(the)*
cos(phi));
853 ptrk.setPy(eraw*
sin(the)*
sin(phi));
854 ptrk.setPz(eraw*
cos(the));
856 ptrk = ptrk.boost(-0.011,0,0);
857 pGam.push_back(ptrk);
862 Hep3Vector ptemp(eraw*
sin(the)*
cos(phi), eraw*
sin(the)*
sin(phi),0);
870 double esum = echarge + eneu;
871 Hep3Vector Pt=Pt_charge+Pt_neu;
874 double phid=phimax-phisec;
875 phid = fmod(phid+CLHEP::twopi+CLHEP::twopi+
pi, CLHEP::twopi) - CLHEP::pi;
882 if( nGood == 2 && nCharge==0 && (m_selectBhabha || m_selectDimu) ){
885 if( m_events%m_bhabha_scale == 0 && m_selectBhabha && echarge/m_ecm>0.8 && eopmax>0.8 && eopsec>0.8){
892 if( m_events%m_dimu_scale == 0 && m_selectDimu && eemc/m_ecm<0.3){
897 double time1=-99,depth1=-99;
898 double time2=-99,depth2=-99;
899 if( (*itp)->isTofTrackValid() ){
900 SmartRefVector<RecTofTrack> tofTrkCol= (*itp)->tofTrack();
901 SmartRefVector<RecTofTrack>::iterator iter_tof=tofTrkCol.begin();
903 for(;iter_tof!=tofTrkCol.end();iter_tof++){
905 status->
setStatus( (*iter_tof)->status() );
907 time1=(*iter_tof)->tof();
913 if( (*itp)->isMucTrackValid() ){
915 depth1=mucTrk->
depth();
918 if( (*itn)->isTofTrackValid() ){
919 SmartRefVector<RecTofTrack> tofTrkCol= (*itn)->tofTrack();
920 SmartRefVector<RecTofTrack>::iterator iter_tof=tofTrkCol.begin();
922 for(;iter_tof!=tofTrkCol.end();iter_tof++){
924 status->
setStatus( (*iter_tof)->status() );
926 time2=(*iter_tof)->tof();
932 if( (*itn)->isMucTrackValid() ){
934 depth2=mucTrk->
depth();
942 if( ((fabs(pmax)/0.5/m_ecm>0.15 && fabs(pmax)/0.5/m_ecm<.75) || (fabs(psec)/0.5/m_ecm>0.15 && fabs(psec)/0.5/m_ecm<.75)) && (eopmax<0.4 || eopsec<0.4)
943 && (depth1>=3 || depth2>=3)){
955 if(m_selectCosmic && nCosmicGood == 2 && eemc/m_ecm<0.3){
960 double time1=-99,depth1=-99;
961 double time2=-99,depth2=-99;
962 if( (*itp)->isTofTrackValid() ){
963 SmartRefVector<RecTofTrack> tofTrkCol= (*itp)->tofTrack();
964 SmartRefVector<RecTofTrack>::iterator iter_tof=tofTrkCol.begin();
966 for(;iter_tof!=tofTrkCol.end();iter_tof++){
968 status->
setStatus( (*iter_tof)->status() );
970 time1=(*iter_tof)->tof();
976 if( (*itp)->isMucTrackValid() ){
978 depth1=mucTrk->
depth();
981 if( (*itn)->isTofTrackValid() ){
982 SmartRefVector<RecTofTrack> tofTrkCol= (*itn)->tofTrack();
983 SmartRefVector<RecTofTrack>::iterator iter_tof=tofTrkCol.begin();
985 for(;iter_tof!=tofTrkCol.end();iter_tof++){
987 status->
setStatus( (*iter_tof)->status() );
989 time2=(*iter_tof)->tof();
995 if( (*itn)->isMucTrackValid() ){
997 depth2=mucTrk->
depth();
1002 if( m_selectCosmic && time1!=-99 && time2!=-99 && fabs(time1-time2)>5 ){
1013 if(m_events%m_proton_scale ==0 ){
1015 bool protoncand=
false;
1016 for(
int i=0; i<nGood; i++){
1022 double pp =
P(mdcTrk);
1024 if((*iter)->isMdcDedxValid()){
1026 chiP=dedxTrk->
chiP();
1029 if( fabs(pp)<0.6 && fabs(chiP)<5){
1037 m_genProtonNumber++;
1047 h_nGood->fill(nGood);
1048 h_nCharge->fill(nCharge);
1049 h_pmaxobeam->fill(pmax/(m_ecm/2.0));
1050 h_eopmax->fill(eopmax);
1051 h_eopsec->fill(eopsec);
1052 h_deltap->fill(pmax-psec);
1053 h_esumoecm->fill(esum/m_ecm);
1054 h_egmax->fill(egmax);
1055 h_deltaphi->fill(phid);
1056 h_Pt->fill(Pt.mag());
1062 if(nGood>1 && pmax/(m_ecm/2.0)>0.4 && eopmax>0.5 && esum/m_ecm>0.75 &&
1063 egmax>0.08 && fabs( fabs(phid)-CLHEP::pi)*180.0/CLHEP::pi>2.86 )
1066 m_radBhabhaNumber++;
1072 if(nGood==2 && nCharge==0 && eemc/m_ecm>=0.7 && eopmax>=0.85 && eopmax<=1.15 && eopsec>=0.85 && eopsec<=1.15 ){
1074 if( fabs(fabs(pmax)-m_ecm/2.0)<0.1 && fabs(fabs(psec)-m_ecm/2.0)<0.1 ){
1075 if(m_events%1000==0){
1076 m_isRadBhabhaT=
true;
1077 m_radBhabhaTNumber++;
1081 m_isRadBhabhaT=
true;
1082 m_radBhabhaTNumber++;
1093 if(!m_isRadBhabhaT && nGood==2 && nCharge==0 && eopmax>=0.85 && eopmax<=1.15 && eopsec>=0.85 && eopsec<=1.15 && eemc/m_ecm<=0.8 && Pt.mag()<=0.2)
1100 if(m_selectGG4Pi && nGood==4 && nCharge==0 && pmax/(m_ecm/2.0)>0.04 && pmax/(m_ecm/2.0)<0.9 && esum/m_ecm>0.04 && esum/m_ecm<0.75 && Pt.mag()<=0.2)
1107 if( (m_selectRhoPi || m_selectKstarK) && nGood == 2 && nCharge==0 && nPi0 == 1){
1113 if( (*itone)->isMdcKalTrackValid() && (*ittwo)->isMdcKalTrackValid() ) {
1118 HepLorentzVector p4trk1;
1119 p4trk1.setPx(
Px(trk1));
1120 p4trk1.setPy(
Py(trk1));
1121 p4trk1.setPz(
Pz(trk1));
1124 HepLorentzVector p4trk2;
1125 p4trk2.setPx(
Px(trk2));
1126 p4trk2.setPy(
Py(trk2));
1127 p4trk2.setPz(
Pz(trk2));
1131 HepLorentzVector p4trk3;
1132 p4trk3.setPx(
Px(trk1));
1133 p4trk3.setPy(
Py(trk1));
1134 p4trk3.setPz(
Pz(trk1));
1135 p4trk3.setE(sqrt( pow(
P(trk1),2)+
mpi*
mpi) );
1137 HepLorentzVector p4trk4;
1138 p4trk4.setPx(
Px(trk2));
1139 p4trk4.setPy(
Py(trk2));
1140 p4trk4.setPz(
Pz(trk2));
1141 p4trk4.setE(sqrt( pow(
P(trk2),2)+
mpi*
mpi) );
1145 itpi0 = recPi0Col->begin();
1146 HepLorentzVector p4gam1 = (*itpi0)->hiPfit();
1147 HepLorentzVector p4gam2 = (*itpi0)->loPfit();
1148 HepLorentzVector p4pi0 = p4gam1+p4gam2;
1150 HepLorentzVector p4total = p4trk1 + p4trk2 + p4pi0;
1151 HepLorentzVector p4total2 = p4trk3 + p4trk4 + p4pi0;
1153 double rhopimass=p4total2.m();
1154 double kstarkmass=p4total.m();
1155 if( (kstarkmass > 3.0 && kstarkmass < 3.15) || (rhopimass > 3.0 && rhopimass < 3.15) ){
1160 double eop1=0.0,eop2=0.0;
1161 if( (*itone)->isEmcShowerValid() ){
1163 double etrk=emcTrk->
energy();
1166 eop1 = etrk/
P(trk1);
1171 if( (*ittwo)->isEmcShowerValid() ){
1173 double etrk=emcTrk->
energy();
1176 eop2 = etrk/
P(trk2);
1181 if(eop1<0.8 && eop2<0.8){
1183 if(rhopimass>3.0 && rhopimass<3.15){
1186 HepLorentzVector
ecms(0.034,0,0,m_ecm);
1206 bool oksq1 = kmfit->
Fit();
1207 double chi1 = kmfit->
chisq();
1210 if(oksq1 && chi1<=60){
1217 if(kstarkmass>3.0 && kstarkmass<3.15){
1220 double mkstarp=0, mkstarm=0;
1222 HepLorentzVector p4kstarp = p4trk1 + p4pi0;
1223 HepLorentzVector p4kstarm = p4trk2 + p4pi0;
1224 mkstarp = p4kstarp.m();
1225 mkstarm = p4kstarm.m();
1228 HepLorentzVector p4kstarm = p4trk1 + p4pi0;
1229 HepLorentzVector p4kstarp = p4trk2 + p4pi0;
1230 mkstarp = p4kstarp.m();
1231 mkstarm = p4kstarm.m();
1234 if ( (fabs(mkstarp-0.89166)<0.1 && fabs(mkstarm-0.89166)>0.1) || (fabs(mkstarm-0.89166)<0.1 && fabs(mkstarp-0.89166)>0.1 ) ){
1237 HepLorentzVector
ecms(0.034,0,0,m_ecm);
1256 bool oksq1 = kmfit->
Fit();
1257 double chi1 = kmfit->
chisq();
1260 if(oksq1 && chi1<=60){
1281 if(m_selectPPPiPi && nGood ==4 && nCharge == 0 && nPi0==0){
1292 HepLorentzVector p4trkpp;
1293 HepLorentzVector p4trkpm;
1294 HepLorentzVector p4trkpip;
1295 HepLorentzVector p4trkpim;
1305 p4trkpp.setPx(
Px(trk1));
1306 p4trkpp.setPy(
Py(trk1));
1307 p4trkpp.setPz(
Pz(trk1));
1310 p4trkpm.setPx(
Px(trk3));
1311 p4trkpm.setPy(
Py(trk3));
1312 p4trkpm.setPz(
Pz(trk3));
1316 p4trkpip.setPx(
Px(trk2));
1317 p4trkpip.setPy(
Py(trk2));
1318 p4trkpip.setPz(
Pz(trk2));
1319 p4trkpip.setE(sqrt( pow(
P(trk2),2)+
mpi*
mpi) );
1321 p4trkpim.setPx(
Px(trk4));
1322 p4trkpim.setPy(
Py(trk4));
1323 p4trkpim.setPz(
Pz(trk4));
1324 p4trkpim.setE(sqrt( pow(
P(trk4),2)+
mpi*
mpi) );
1326 double jpsimass1= (p4trkpp+p4trkpm+p4trkpip+p4trkpim).m();
1337 p4trkpp.setPx(
Px(trk1));
1338 p4trkpp.setPy(
Py(trk1));
1339 p4trkpp.setPz(
Pz(trk1));
1342 p4trkpm.setPx(
Px(trk4));
1343 p4trkpm.setPy(
Py(trk4));
1344 p4trkpm.setPz(
Pz(trk4));
1348 p4trkpip.setPx(
Px(trk2));
1349 p4trkpip.setPy(
Py(trk2));
1350 p4trkpip.setPz(
Pz(trk2));
1351 p4trkpip.setE(sqrt( pow(
P(trk2),2)+
mpi*
mpi) );
1353 p4trkpim.setPx(
Px(trk3));
1354 p4trkpim.setPy(
Py(trk3));
1355 p4trkpim.setPz(
Pz(trk3));
1356 p4trkpim.setE(sqrt( pow(
P(trk3),2)+
mpi*
mpi) );
1358 double jpsimass2= (p4trkpp+p4trkpm+p4trkpip+p4trkpim).m();
1369 p4trkpp.setPx(
Px(trk2));
1370 p4trkpp.setPy(
Py(trk2));
1371 p4trkpp.setPz(
Pz(trk2));
1374 p4trkpm.setPx(
Px(trk3));
1375 p4trkpm.setPy(
Py(trk3));
1376 p4trkpm.setPz(
Pz(trk3));
1380 p4trkpip.setPx(
Px(trk1));
1381 p4trkpip.setPy(
Py(trk1));
1382 p4trkpip.setPz(
Pz(trk1));
1383 p4trkpip.setE(sqrt( pow(
P(trk1),2)+
mpi*
mpi) );
1385 p4trkpim.setPx(
Px(trk4));
1386 p4trkpim.setPy(
Py(trk4));
1387 p4trkpim.setPz(
Pz(trk4));
1388 p4trkpim.setE(sqrt( pow(
P(trk4),2)+
mpi*
mpi) );
1390 double jpsimass3= (p4trkpp+p4trkpm+p4trkpip+p4trkpim).m();
1401 p4trkpp.setPx(
Px(trk2));
1402 p4trkpp.setPy(
Py(trk2));
1403 p4trkpp.setPz(
Pz(trk2));
1406 p4trkpm.setPx(
Px(trk4));
1407 p4trkpm.setPy(
Py(trk4));
1408 p4trkpm.setPz(
Pz(trk4));
1412 p4trkpip.setPx(
Px(trk1));
1413 p4trkpip.setPy(
Py(trk1));
1414 p4trkpip.setPz(
Pz(trk1));
1415 p4trkpip.setE(sqrt( pow(
P(trk1),2)+
mpi*
mpi) );
1417 p4trkpim.setPx(
Px(trk3));
1418 p4trkpim.setPy(
Py(trk3));
1419 p4trkpim.setPz(
Pz(trk3));
1420 p4trkpim.setE(sqrt( pow(
P(trk3),2)+
mpi*
mpi) );
1422 double jpsimass4= (p4trkpp+p4trkpm+p4trkpip+p4trkpim).m();
1427 if( fabs(jpsimass1-3.075)<=0.075 || fabs(jpsimass2-3.075)<=0.075 ||
1428 fabs(jpsimass3-3.075)<=0.075 || fabs(jpsimass4-3.075)<=0.075){
1433 double chi1, chi2, chi3, chi4;
1436 HepLorentzVector
ecms(0.034,0,0,m_ecm);
1455 bool oksq1 = kmfit->
Fit();
1456 chi1 = kmfit->
chisq();
1480 bool oksq1 = kmfit->
Fit();
1481 chi2 = kmfit->
chisq();
1487 else if(chi2<chimin){
1510 bool oksq1 = kmfit->
Fit();
1511 chi3 = kmfit->
chisq();
1517 else if(chi3<chimin){
1542 bool oksq1 = kmfit->
Fit();
1543 chi4 = kmfit->
chisq();
1550 else if(chi4<chimin){
1559 if(type!=0 && chimin<100){
1573 if( (m_selectPsipRhoPi || m_selectPsipKstarK || m_selectPsipPPPiPi) && (nGood==4 || nGood==6) && nCharge==0 ){
1578 double bestmass=1.0;
1580 vector<int> iJPsiP,iJPsiN;
1581 for(
int ip=0; ip<iCP.size(); ip++){
1582 for(
int in=0; in<iCN.size();in++){
1583 pione = evtRecTrkCol->begin() + iCP[ip];
1584 pitwo = evtRecTrkCol->begin() + iCN[in];
1585 pitrk1 = (*pione)->mdcKalTrack();
1586 pitrk2 = (*pitwo)->mdcKalTrack();
1587 Hep3Vector p1(
Px(pitrk1),
Py(pitrk1),
Pz(pitrk1));
1588 Hep3Vector p2(
Px(pitrk2),
Py(pitrk2),
Pz(pitrk2));
1589 double E1=sqrt( pow(
P(pitrk1),2)+
mpi*
mpi);
1590 double E2=sqrt( pow(
P(pitrk2),2)+
mpi*
mpi);
1591 double recomass = sqrt(pow(3.686-E1-E2,2)- (-(p1+p2)).mag2() );
1593 if(fabs(recomass-3.096)< fabs(bestmass-3.096)){
1603 pione = evtRecTrkCol->begin() + iCP[pindex];
1604 pitwo = evtRecTrkCol->begin() + iCN[nindex];
1605 pitrk1 = (*pione)->mdcKalTrack();
1606 pitrk2 = (*pitwo)->mdcKalTrack();
1610 double jpsicharge=0;
1611 for(
int ip=0; ip<iCP.size(); ip++){
1613 iJPsiP.push_back(iCP[ip]);
1616 jpsicharge+=trktmp->
charge();
1620 for(
int in=0; in<iCN.size(); in++){
1622 iJPsiN.push_back(iCN[in]);
1625 jpsicharge+=trktmp->
charge();
1630 HepLorentzVector
ecms(0.034,0,0,m_ecm);
1633 if( (m_selectPsipRhoPi || m_selectPsipKstarK) && (bestmass>3.075 && bestmass<3.120) && nGood==4 && jpsicharge==0 && nPi0==1){
1639 if( (*itone)->isMdcKalTrackValid() && (*ittwo)->isMdcKalTrackValid() ) {
1644 HepLorentzVector p4trk1;
1645 p4trk1.setPx(
Px(trk1));
1646 p4trk1.setPy(
Py(trk1));
1647 p4trk1.setPz(
Pz(trk1));
1650 HepLorentzVector p4trk2;
1651 p4trk2.setPx(
Px(trk2));
1652 p4trk2.setPy(
Py(trk2));
1653 p4trk2.setPz(
Pz(trk2));
1657 HepLorentzVector p4trk3;
1658 p4trk3.setPx(
Px(trk1));
1659 p4trk3.setPy(
Py(trk1));
1660 p4trk3.setPz(
Pz(trk1));
1661 p4trk3.setE(sqrt( pow(
P(trk1),2)+
mpi*
mpi) );
1663 HepLorentzVector p4trk4;
1664 p4trk4.setPx(
Px(trk2));
1665 p4trk4.setPy(
Py(trk2));
1666 p4trk4.setPz(
Pz(trk2));
1667 p4trk4.setE(sqrt( pow(
P(trk2),2)+
mpi*
mpi) );
1670 EvtRecPi0Col::iterator itpi0 = recPi0Col->begin();
1679 HepLorentzVector p4gam1 = (*itpi0)->hiPfit();
1680 HepLorentzVector p4gam2 = (*itpi0)->loPfit();
1681 HepLorentzVector p4pi0 = p4gam1 + p4gam2;
1682 HepLorentzVector p4total = p4trk1 + p4trk2 + p4pi0;
1683 HepLorentzVector p4total2 = p4trk3 + p4trk4 + p4pi0;
1686 HepLorentzVector p4kstarp = p4trk1 + p4pi0;
1687 HepLorentzVector p4kstarm = p4trk2 + p4pi0;
1688 double mkstarp = p4kstarp.m();
1689 double mkstarm = p4kstarm.m();
1691 if( (p4total.m() > 3.0 && p4total.m() < 3.15) || (p4total2.m() > 3.0 && p4total2.m() < 3.15) ){
1712 if(m_selectPsipRhoPi){
1723 bool oksq1 = kmfit->
Fit();
1724 double chi1 = kmfit->
chisq();
1727 if(oksq1 && chi1>0 && chi1<100){
1728 m_isPsipRhoPi =
true;
1729 m_psipRhoPiNumber++;
1732 if(m_selectPsipKstarK){
1744 bool oksq2 = kmfit2->
Fit();
1745 double chi2 = kmfit2->
chisq();
1747 if(oksq2 && chi2>0 && chi2<200 &&
1748 ( (fabs(mkstarp-0.89166)<0.1 && fabs(mkstarm-0.89166)>0.1)
1749 || (fabs(mkstarm-0.89166)<0.1 && fabs(mkstarp-0.89166)>0.1 ) )){
1750 m_isPsipKstarK =
true;
1751 m_psipKstarKNumber++;
1766 if(m_selectPsipPPPiPi && (bestmass>3.075 && bestmass<3.120) && nGood==6 && jpsicharge==0 && nPi0==0){
1778 HepLorentzVector p4trkpp;
1779 HepLorentzVector p4trkpm;
1780 HepLorentzVector p4trkpip;
1781 HepLorentzVector p4trkpim;
1791 p4trkpp.setPx(
Px(trk1));
1792 p4trkpp.setPy(
Py(trk1));
1793 p4trkpp.setPz(
Pz(trk1));
1796 p4trkpm.setPx(
Px(trk3));
1797 p4trkpm.setPy(
Py(trk3));
1798 p4trkpm.setPz(
Pz(trk3));
1802 p4trkpip.setPx(
Px(trk2));
1803 p4trkpip.setPy(
Py(trk2));
1804 p4trkpip.setPz(
Pz(trk2));
1805 p4trkpip.setE(sqrt( pow(
P(trk2),2)+
mpi*
mpi) );
1807 p4trkpim.setPx(
Px(trk4));
1808 p4trkpim.setPy(
Py(trk4));
1809 p4trkpim.setPz(
Pz(trk4));
1810 p4trkpim.setE(sqrt( pow(
P(trk4),2)+
mpi*
mpi) );
1812 double jpsimass1= (p4trkpp+p4trkpm+p4trkpip+p4trkpim).m();
1823 p4trkpp.setPx(
Px(trk1));
1824 p4trkpp.setPy(
Py(trk1));
1825 p4trkpp.setPz(
Pz(trk1));
1828 p4trkpm.setPx(
Px(trk4));
1829 p4trkpm.setPy(
Py(trk4));
1830 p4trkpm.setPz(
Pz(trk4));
1834 p4trkpip.setPx(
Px(trk2));
1835 p4trkpip.setPy(
Py(trk2));
1836 p4trkpip.setPz(
Pz(trk2));
1837 p4trkpip.setE(sqrt( pow(
P(trk2),2)+
mpi*
mpi) );
1839 p4trkpim.setPx(
Px(trk3));
1840 p4trkpim.setPy(
Py(trk3));
1841 p4trkpim.setPz(
Pz(trk3));
1842 p4trkpim.setE(sqrt( pow(
P(trk3),2)+
mpi*
mpi) );
1844 double jpsimass2= (p4trkpp+p4trkpm+p4trkpip+p4trkpim).m();
1855 p4trkpp.setPx(
Px(trk2));
1856 p4trkpp.setPy(
Py(trk2));
1857 p4trkpp.setPz(
Pz(trk2));
1860 p4trkpm.setPx(
Px(trk3));
1861 p4trkpm.setPy(
Py(trk3));
1862 p4trkpm.setPz(
Pz(trk3));
1866 p4trkpip.setPx(
Px(trk1));
1867 p4trkpip.setPy(
Py(trk1));
1868 p4trkpip.setPz(
Pz(trk1));
1869 p4trkpip.setE(sqrt( pow(
P(trk1),2)+
mpi*
mpi) );
1871 p4trkpim.setPx(
Px(trk4));
1872 p4trkpim.setPy(
Py(trk4));
1873 p4trkpim.setPz(
Pz(trk4));
1874 p4trkpim.setE(sqrt( pow(
P(trk4),2)+
mpi*
mpi) );
1876 double jpsimass3= (p4trkpp+p4trkpm+p4trkpip+p4trkpim).m();
1887 p4trkpp.setPx(
Px(trk2));
1888 p4trkpp.setPy(
Py(trk2));
1889 p4trkpp.setPz(
Pz(trk2));
1892 p4trkpm.setPx(
Px(trk4));
1893 p4trkpm.setPy(
Py(trk4));
1894 p4trkpm.setPz(
Pz(trk4));
1898 p4trkpip.setPx(
Px(trk1));
1899 p4trkpip.setPy(
Py(trk1));
1900 p4trkpip.setPz(
Pz(trk1));
1901 p4trkpip.setE(sqrt( pow(
P(trk1),2)+
mpi*
mpi) );
1903 p4trkpim.setPx(
Px(trk3));
1904 p4trkpim.setPy(
Py(trk3));
1905 p4trkpim.setPz(
Pz(trk3));
1906 p4trkpim.setE(sqrt( pow(
P(trk3),2)+
mpi*
mpi) );
1908 double jpsimass4= (p4trkpp+p4trkpm+p4trkpip+p4trkpim).m();
1910 if( fabs(jpsimass1-3.075)<=0.075 || fabs(jpsimass2-3.075)<=0.075 ||
1911 fabs(jpsimass3-3.075)<=0.075 || fabs(jpsimass4-3.075)<=0.075){
1915 double chi1, chi2, chi3, chi4;
1920 WTrackParameter wvpiTrk1, wvpiTrk2, wvpiTrk3, wvpiTrk4 , wvpiTrk5, wvpiTrk6 ;
1942 bool oksq1 = kmfit->
Fit();
1943 chi1 = kmfit->
chisq();
1972 bool oksq1 = kmfit->
Fit();
1973 chi2 = kmfit->
chisq();
1979 else if(chi2<chimin){
2008 bool oksq1 = kmfit->
Fit();
2009 chi3 = kmfit->
chisq();
2015 else if(chi3<chimin){
2042 bool oksq1 = kmfit->
Fit();
2043 chi4 = kmfit->
chisq();
2049 else if(chi4<chimin){
2058 if(chimin>0 && chimin<200){
2059 m_isPsipPPPiPi =
true;
2060 m_psipPPPiPiNumber++;
2076 if(m_selectPsippCand){
2079 if ( ! evtRecDTagCol ) {
2080 log << MSG::FATAL <<
"Could not find EvtRecDTagCol" << endreq;
2081 return StatusCode::FAILURE;
2083 if(evtRecDTagCol->size()>0){
2085 EvtRecDTagCol::iterator m_iterbegin=evtRecDTagCol->begin();
2086 EvtRecDTagCol::iterator m_iterend=evtRecDTagCol->end();
2087 for(EvtRecDTagCol::iterator
iter=m_iterbegin;
iter != m_iterend;
iter++){
2089 if( ((*iter)->decayMode()==
EvtRecDTag::kD0toKPiPi0 && fabs((*iter)->mBC()-1.865)<0.006 && (*iter)->deltaE()>-0.05 && (*iter)->deltaE()<0.03) ||
2090 ((*iter)->decayMode()==
EvtRecDTag::kD0toKPiPi0Pi0 && fabs((*iter)->mBC()-1.865)<0.006 && (*iter)->deltaE()>-0.05 && (*iter)->deltaE()<0.03) ||
2091 ((*iter)->decayMode()==
EvtRecDTag::kD0toKPiPiPi && fabs((*iter)->mBC()-1.865)<0.006 && (*iter)->deltaE()>-0.03 && (*iter)->deltaE()<0.03) ||
2092 ((*iter)->decayMode()==
EvtRecDTag::kD0toKPiPiPiPi0 && fabs((*iter)->mBC()-1.865)<0.006 && (*iter)->deltaE()>-0.05 && (*iter)->deltaE()<0.03) ||
2093 ((*iter)->decayMode()==
EvtRecDTag::kD0toKsPiPi && fabs((*iter)->mBC()-1.865)<0.006 && (*iter)->deltaE()>-0.03 && (*iter)->deltaE()<0.03) ||
2094 ((*iter)->decayMode()==
EvtRecDTag::kD0toKsPiPiPi0 && fabs((*iter)->mBC()-1.865)<0.006 && (*iter)->deltaE()>-0.05 && (*iter)->deltaE()<0.03)||
2095 ((*iter)->decayMode()==
EvtRecDTag::kDptoKPiPi && fabs((*iter)->mBC()-1.87)<0.006 && (*iter)->deltaE()>-0.03 && (*iter)->deltaE()<0.03) ||
2096 ((*iter)->decayMode()==
EvtRecDTag::kDptoKPiPiPi0 && fabs((*iter)->mBC()-1.87)<0.006 && (*iter)->deltaE()>-0.05 && (*iter)->deltaE()<0.03)||
2097 ((*iter)->decayMode()==
EvtRecDTag::kDptoKsPiPi0 && fabs((*iter)->mBC()-1.87)<0.006 && (*iter)->deltaE()>-0.05 && (*iter)->deltaE()<0.03) ||
2098 ((*iter)->decayMode()==
EvtRecDTag::kDptoKsPiPiPi&& fabs((*iter)->mBC()-1.87)<0.006 && (*iter)->deltaE()>-0.03 && (*iter)->deltaE()<0.03) ) {
2099 m_isPsippCand =
true;
2100 m_psippCandNumber++;
2113 if( m_selectRadBhabha && m_isRadBhabha ) m_subalg3->execute();
2114 if( m_selectGGEE && m_isGGEE ) m_subalg4->execute();
2115 if( m_selectGG4Pi && m_isGG4Pi ) m_subalg5->execute();
2116 if( m_selectRadBhabhaT && m_isRadBhabhaT ) m_subalg6->execute();
2117 if( m_selectRhoPi && m_isRhoPi ) m_subalg7->execute();
2118 if( m_selectKstarK && m_isKstarK ) m_subalg8->execute();
2119 if( m_selectPPPiPi && m_isPPPiPi ) m_subalg9->execute();
2120 if( m_selectRecoJpsi && m_isRecoJpsi ) m_subalg10->execute();
2121 if( m_selectBhabha && m_isBhabha ) m_subalg11->execute();
2122 if( m_selectDimu && m_isDimu ) m_subalg12->execute();
2123 if( m_selectCosmic && m_isCosmic ) m_subalg13->execute();
2124 if( m_selectGenProton && m_isGenProton ) m_subalg14->execute();
2125 if( m_selectPsipRhoPi && m_isPsipRhoPi ) m_subalg15->execute();
2126 if( m_selectPsipKstarK && m_isPsipKstarK ) m_subalg16->execute();
2127 if( m_selectPsipPPPiPi && m_isPsipPPPiPi ) m_subalg17->execute();
2128 if( m_selectPsippCand && m_isPsippCand ) m_subalg18->execute();
2152 return StatusCode::SUCCESS;