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;
755 Hep3Vector ptemp(
Px(mdcTrk),
Py(mdcTrk),0);
759 if((*itTrk)->isEmcShowerValid()) {
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;
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( iCP.size()==1 && iCN.size()==1 && m_events%m_dimu_scale == 0 && m_selectDimu && eemc/m_ecm<0.3){
950 double time1=-99,depth1=-99;
951 double time2=-99,depth2=-99;
952 double p1=-99,
p2=-99;
953 double emc1=0, emc2=0;
954 if( (*itp)->isTofTrackValid() ){
955 SmartRefVector<RecTofTrack> tofTrkCol= (*itp)->tofTrack();
956 SmartRefVector<RecTofTrack>::iterator iter_tof=tofTrkCol.begin();
958 for(;iter_tof!=tofTrkCol.end();iter_tof++){
960 status->
setStatus( (*iter_tof)->status() );
962 time1=(*iter_tof)->tof();
968 if( (*itp)->isMucTrackValid() ){
970 depth1=mucTrk->
depth();
974 if((*itp)->isMdcKalTrackValid()) {
980 if((*itp)->isEmcShowerValid()) {
985 if( (*itn)->isTofTrackValid() ){
986 SmartRefVector<RecTofTrack> tofTrkCol= (*itn)->tofTrack();
987 SmartRefVector<RecTofTrack>::iterator iter_tof=tofTrkCol.begin();
989 for(;iter_tof!=tofTrkCol.end();iter_tof++){
991 status->
setStatus( (*iter_tof)->status() );
993 time2=(*iter_tof)->tof();
999 if( (*itn)->isMucTrackValid() ){
1001 depth2=mucTrk->
depth();
1004 if((*itn)->isMdcKalTrackValid()) {
1011 if((*itn)->isEmcShowerValid()) {
1016 double ebeam=m_ecm/2.0;
1018 && (emc1/
p1<0.4 || emc2/
p2<0.4) && (depth1>3 || depth2>3) &&
1019 emc1>0.15 && emc1<0.3 && emc2>0.15 && emc2<0.3 && emc1/
p1<0.8 && emc2/
p2<0.8 &&
1020 ((depth1>80*
p1-60 || depth1>40) || (depth2>80*
p2-60 || depth2>40)) ){
1033 if(m_selectCosmic && nCosmicGood == 2 && eemc/m_ecm<0.3){
1038 double time1=-99,depth1=-99;
1039 double time2=-99,depth2=-99;
1040 if( (*itp)->isTofTrackValid() ){
1041 SmartRefVector<RecTofTrack> tofTrkCol= (*itp)->tofTrack();
1042 SmartRefVector<RecTofTrack>::iterator iter_tof=tofTrkCol.begin();
1044 for(;iter_tof!=tofTrkCol.end();iter_tof++){
1046 status->
setStatus( (*iter_tof)->status() );
1048 time1=(*iter_tof)->tof();
1054 if( (*itp)->isMucTrackValid() ){
1056 depth1=mucTrk->
depth();
1059 if( (*itn)->isTofTrackValid() ){
1060 SmartRefVector<RecTofTrack> tofTrkCol= (*itn)->tofTrack();
1061 SmartRefVector<RecTofTrack>::iterator iter_tof=tofTrkCol.begin();
1063 for(;iter_tof!=tofTrkCol.end();iter_tof++){
1065 status->
setStatus( (*iter_tof)->status() );
1067 time2=(*iter_tof)->tof();
1073 if( (*itn)->isMucTrackValid() ){
1075 depth2=mucTrk->
depth();
1080 if( m_selectCosmic && time1!=-99 && time2!=-99 && fabs(time1-time2)>5 ){
1091 if(m_events%m_proton_scale ==0 ){
1093 bool protoncand=
false;
1096 for(
int i=0; i<nGood; i++){
1102 double pp =
P(mdcTrk);
1106 if((*iter)->isMdcDedxValid()){
1109 chiP=dedxTrk->
chiP();
1112 if( fabs(pp)<0.6 && dedx>1.2 && fabs(chiP)<6){
1113 ncharge+=mdcTrk->
charge();
1119 if( (nproton==1 && ncharge==-1) || (nproton>=2 && ncharge<=nproton-2))
1123 m_genProtonNumber++;
1133 h_nGood->fill(nGood);
1134 h_nCharge->fill(nCharge);
1135 h_pmaxobeam->fill(pmax/(m_ecm/2.0));
1136 h_eopmax->fill(eopmax);
1137 h_eopsec->fill(eopsec);
1138 h_deltap->fill(pmax-psec);
1139 h_esumoecm->fill(esum/m_ecm);
1140 h_egmax->fill(egmax);
1141 h_deltaphi->fill(phid);
1142 h_Pt->fill(Pt.mag());
1148 if(nGood>1 && pmax/(m_ecm/2.0)>0.4 && eopmax>0.5 && esum/m_ecm>0.75 &&
1149 egmax>0.08 && fabs( fabs(phid)-CLHEP::pi)*180.0/CLHEP::pi>2.86 )
1152 m_radBhabhaNumber++;
1158 if(nGood==2 && nCharge==0 && eemc/m_ecm>=0.7 && eopmax>=0.85 && eopmax<=1.15 && eopsec>=0.85 && eopsec<=1.15 ){
1160 if( fabs(fabs(pmax)-m_ecm/2.0)<0.1 && fabs(fabs(psec)-m_ecm/2.0)<0.1 ){
1161 if(m_events%1000==0){
1162 m_isRadBhabhaT=
true;
1163 m_radBhabhaTNumber++;
1167 m_isRadBhabhaT=
true;
1168 m_radBhabhaTNumber++;
1179 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)
1186 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)
1193 if( (m_selectRhoPi || m_selectKstarK) && nGood == 2 && nCharge==0 && nPi0 == 1){
1199 if( (*itone)->isMdcKalTrackValid() && (*ittwo)->isMdcKalTrackValid() ) {
1204 HepLorentzVector p4trk1;
1205 p4trk1.setPx(
Px(trk1));
1206 p4trk1.setPy(
Py(trk1));
1207 p4trk1.setPz(
Pz(trk1));
1210 HepLorentzVector p4trk2;
1211 p4trk2.setPx(
Px(trk2));
1212 p4trk2.setPy(
Py(trk2));
1213 p4trk2.setPz(
Pz(trk2));
1217 HepLorentzVector p4trk3;
1218 p4trk3.setPx(
Px(trk1));
1219 p4trk3.setPy(
Py(trk1));
1220 p4trk3.setPz(
Pz(trk1));
1221 p4trk3.setE(sqrt( pow(
P(trk1),2)+
mpi*
mpi) );
1223 HepLorentzVector p4trk4;
1224 p4trk4.setPx(
Px(trk2));
1225 p4trk4.setPy(
Py(trk2));
1226 p4trk4.setPz(
Pz(trk2));
1227 p4trk4.setE(sqrt( pow(
P(trk2),2)+
mpi*
mpi) );
1231 itpi0 = recPi0Col->begin();
1232 HepLorentzVector p4gam1 = (*itpi0)->hiPfit();
1233 HepLorentzVector p4gam2 = (*itpi0)->loPfit();
1234 HepLorentzVector p4pi0 = p4gam1+p4gam2;
1236 HepLorentzVector p4total = p4trk1 + p4trk2 + p4pi0;
1237 HepLorentzVector p4total2 = p4trk3 + p4trk4 + p4pi0;
1239 double rhopimass=p4total2.m();
1240 double kstarkmass=p4total.m();
1241 if( (kstarkmass > 3.0 && kstarkmass < 3.15) || (rhopimass > 3.0 && rhopimass < 3.15) ){
1246 double eop1=0.0,eop2=0.0;
1247 if( (*itone)->isEmcShowerValid() ){
1249 double etrk=emcTrk->
energy();
1252 eop1 = etrk/
P(trk1);
1257 if( (*ittwo)->isEmcShowerValid() ){
1259 double etrk=emcTrk->
energy();
1262 eop2 = etrk/
P(trk2);
1267 if(eop1<0.8 && eop2<0.8){
1269 if(rhopimass>3.0 && rhopimass<3.15){
1272 HepLorentzVector
ecms(0.034,0,0,m_ecm);
1292 bool oksq1 = kmfit->
Fit();
1293 double chi1 = kmfit->
chisq();
1296 if(oksq1 && chi1<=60){
1303 if(kstarkmass>3.0 && kstarkmass<3.15){
1306 double mkstarp=0, mkstarm=0;
1308 HepLorentzVector p4kstarp = p4trk1 + p4pi0;
1309 HepLorentzVector p4kstarm = p4trk2 + p4pi0;
1310 mkstarp = p4kstarp.m();
1311 mkstarm = p4kstarm.m();
1314 HepLorentzVector p4kstarm = p4trk1 + p4pi0;
1315 HepLorentzVector p4kstarp = p4trk2 + p4pi0;
1316 mkstarp = p4kstarp.m();
1317 mkstarm = p4kstarm.m();
1320 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 ) ){
1323 HepLorentzVector
ecms(0.034,0,0,m_ecm);
1342 bool oksq1 = kmfit->
Fit();
1343 double chi1 = kmfit->
chisq();
1346 if(oksq1 && chi1<=60){
1367 if(m_selectPPPiPi && nGood ==4 && nCharge == 0 && nPi0==0){
1378 HepLorentzVector p4trkpp;
1379 HepLorentzVector p4trkpm;
1380 HepLorentzVector p4trkpip;
1381 HepLorentzVector p4trkpim;
1386 p4trkpp.setPx(
Px(trk1));
1387 p4trkpp.setPy(
Py(trk1));
1388 p4trkpp.setPz(
Pz(trk1));
1392 p4trkpm.setPx(
Px(trk3));
1393 p4trkpm.setPy(
Py(trk3));
1394 p4trkpm.setPz(
Pz(trk3));
1398 p4trkpip.setPx(
Px(trk2));
1399 p4trkpip.setPy(
Py(trk2));
1400 p4trkpip.setPz(
Pz(trk2));
1401 p4trkpip.setE(sqrt( pow(
P(trk2),2)+
mpi*
mpi) );
1404 p4trkpim.setPx(
Px(trk4));
1405 p4trkpim.setPy(
Py(trk4));
1406 p4trkpim.setPz(
Pz(trk4));
1407 p4trkpim.setE(sqrt( pow(
P(trk4),2)+
mpi*
mpi) );
1409 double jpsimass1= (p4trkpp+p4trkpm+p4trkpip+p4trkpim).m();
1415 p4trkpp.setPx(
Px(trk1));
1416 p4trkpp.setPy(
Py(trk1));
1417 p4trkpp.setPz(
Pz(trk1));
1421 p4trkpm.setPx(
Px(trk4));
1422 p4trkpm.setPy(
Py(trk4));
1423 p4trkpm.setPz(
Pz(trk4));
1427 p4trkpip.setPx(
Px(trk2));
1428 p4trkpip.setPy(
Py(trk2));
1429 p4trkpip.setPz(
Pz(trk2));
1430 p4trkpip.setE(sqrt( pow(
P(trk2),2)+
mpi*
mpi) );
1433 p4trkpim.setPx(
Px(trk3));
1434 p4trkpim.setPy(
Py(trk3));
1435 p4trkpim.setPz(
Pz(trk3));
1436 p4trkpim.setE(sqrt( pow(
P(trk3),2)+
mpi*
mpi) );
1438 double jpsimass2= (p4trkpp+p4trkpm+p4trkpip+p4trkpim).m();
1445 p4trkpp.setPx(
Px(trk2));
1446 p4trkpp.setPy(
Py(trk2));
1447 p4trkpp.setPz(
Pz(trk2));
1451 p4trkpm.setPx(
Px(trk3));
1452 p4trkpm.setPy(
Py(trk3));
1453 p4trkpm.setPz(
Pz(trk3));
1457 p4trkpip.setPx(
Px(trk1));
1458 p4trkpip.setPy(
Py(trk1));
1459 p4trkpip.setPz(
Pz(trk1));
1460 p4trkpip.setE(sqrt( pow(
P(trk1),2)+
mpi*
mpi) );
1463 p4trkpim.setPx(
Px(trk4));
1464 p4trkpim.setPy(
Py(trk4));
1465 p4trkpim.setPz(
Pz(trk4));
1466 p4trkpim.setE(sqrt( pow(
P(trk4),2)+
mpi*
mpi) );
1468 double jpsimass3= (p4trkpp+p4trkpm+p4trkpip+p4trkpim).m();
1475 p4trkpp.setPx(
Px(trk2));
1476 p4trkpp.setPy(
Py(trk2));
1477 p4trkpp.setPz(
Pz(trk2));
1481 p4trkpm.setPx(
Px(trk4));
1482 p4trkpm.setPy(
Py(trk4));
1483 p4trkpm.setPz(
Pz(trk4));
1487 p4trkpip.setPx(
Px(trk1));
1488 p4trkpip.setPy(
Py(trk1));
1489 p4trkpip.setPz(
Pz(trk1));
1490 p4trkpip.setE(sqrt( pow(
P(trk1),2)+
mpi*
mpi) );
1493 p4trkpim.setPx(
Px(trk3));
1494 p4trkpim.setPy(
Py(trk3));
1495 p4trkpim.setPz(
Pz(trk3));
1496 p4trkpim.setE(sqrt( pow(
P(trk3),2)+
mpi*
mpi) );
1498 double jpsimass4= (p4trkpp+p4trkpm+p4trkpip+p4trkpim).m();
1503 if( fabs(jpsimass1-3.075)<=0.075 || fabs(jpsimass2-3.075)<=0.075 ||
1504 fabs(jpsimass3-3.075)<=0.075 || fabs(jpsimass4-3.075)<=0.075){
1509 double chi1, chi2, chi3, chi4;
1512 HepLorentzVector
ecms(0.034,0,0,m_ecm);
1531 bool oksq1 = kmfit->
Fit();
1532 chi1 = kmfit->
chisq();
1556 bool oksq1 = kmfit->
Fit();
1557 chi2 = kmfit->
chisq();
1563 else if(chi2<chimin){
1586 bool oksq1 = kmfit->
Fit();
1587 chi3 = kmfit->
chisq();
1593 else if(chi3<chimin){
1618 bool oksq1 = kmfit->
Fit();
1619 chi4 = kmfit->
chisq();
1626 else if(chi4<chimin){
1635 if(type!=0 && chimin<100){
1649 if( (m_selectPsipRhoPi || m_selectPsipKstarK || m_selectPsipPPPiPi) && (nGood==4 || nGood==6) && nCharge==0 ){
1654 double bestmass=1.0;
1656 vector<int> iJPsiP,iJPsiN;
1657 for(
int ip=0; ip<iCP.size(); ip++){
1658 for(
int in=0; in<iCN.size();in++){
1659 pione = evtRecTrkCol->begin() + iCP[ip];
1660 pitwo = evtRecTrkCol->begin() + iCN[in];
1661 pitrk1 = (*pione)->mdcKalTrack();
1662 pitrk2 = (*pitwo)->mdcKalTrack();
1663 Hep3Vector
p1(
Px(pitrk1),
Py(pitrk1),
Pz(pitrk1));
1664 Hep3Vector
p2(
Px(pitrk2),
Py(pitrk2),
Pz(pitrk2));
1665 double E1=sqrt( pow(
P(pitrk1),2)+
mpi*
mpi);
1666 double E2=sqrt( pow(
P(pitrk2),2)+
mpi*
mpi);
1667 double recomass = sqrt(pow(3.686-E1-E2,2)- (-(
p1+
p2)).mag2() );
1669 if(fabs(recomass-3.096)< fabs(bestmass-3.096)){
1679 pione = evtRecTrkCol->begin() + iCP[pindex];
1680 pitwo = evtRecTrkCol->begin() + iCN[nindex];
1681 pitrk1 = (*pione)->mdcKalTrack();
1682 pitrk2 = (*pitwo)->mdcKalTrack();
1686 double jpsicharge=0;
1687 for(
int ip=0; ip<iCP.size(); ip++){
1689 iJPsiP.push_back(iCP[ip]);
1692 jpsicharge+=trktmp->
charge();
1696 for(
int in=0; in<iCN.size(); in++){
1698 iJPsiN.push_back(iCN[in]);
1701 jpsicharge+=trktmp->
charge();
1706 HepLorentzVector
ecms(0.034,0,0,m_ecm);
1709 if( (m_selectPsipRhoPi || m_selectPsipKstarK) && (bestmass>3.075 && bestmass<3.120) && nGood==4 && jpsicharge==0 && nPi0==1){
1715 if( (*itone)->isMdcKalTrackValid() && (*ittwo)->isMdcKalTrackValid() ) {
1720 HepLorentzVector p4trk1;
1721 p4trk1.setPx(
Px(trk1));
1722 p4trk1.setPy(
Py(trk1));
1723 p4trk1.setPz(
Pz(trk1));
1726 HepLorentzVector p4trk2;
1727 p4trk2.setPx(
Px(trk2));
1728 p4trk2.setPy(
Py(trk2));
1729 p4trk2.setPz(
Pz(trk2));
1733 HepLorentzVector p4trk3;
1734 p4trk3.setPx(
Px(trk1));
1735 p4trk3.setPy(
Py(trk1));
1736 p4trk3.setPz(
Pz(trk1));
1737 p4trk3.setE(sqrt( pow(
P(trk1),2)+
mpi*
mpi) );
1739 HepLorentzVector p4trk4;
1740 p4trk4.setPx(
Px(trk2));
1741 p4trk4.setPy(
Py(trk2));
1742 p4trk4.setPz(
Pz(trk2));
1743 p4trk4.setE(sqrt( pow(
P(trk2),2)+
mpi*
mpi) );
1746 EvtRecPi0Col::iterator itpi0 = recPi0Col->begin();
1755 HepLorentzVector p4gam1 = (*itpi0)->hiPfit();
1756 HepLorentzVector p4gam2 = (*itpi0)->loPfit();
1757 HepLorentzVector p4pi0 = p4gam1 + p4gam2;
1758 HepLorentzVector p4total = p4trk1 + p4trk2 + p4pi0;
1759 HepLorentzVector p4total2 = p4trk3 + p4trk4 + p4pi0;
1762 HepLorentzVector p4kstarp = p4trk1 + p4pi0;
1763 HepLorentzVector p4kstarm = p4trk2 + p4pi0;
1764 double mkstarp = p4kstarp.m();
1765 double mkstarm = p4kstarm.m();
1767 if( (p4total.m() > 3.0 && p4total.m() < 3.15) || (p4total2.m() > 3.0 && p4total2.m() < 3.15) ){
1788 if(m_selectPsipRhoPi){
1799 bool oksq1 = kmfit->
Fit();
1800 double chi1 = kmfit->
chisq();
1803 if(oksq1 && chi1>0 && chi1<100){
1804 m_isPsipRhoPi =
true;
1805 m_psipRhoPiNumber++;
1808 if(m_selectPsipKstarK){
1820 bool oksq2 = kmfit2->
Fit();
1821 double chi2 = kmfit2->
chisq();
1823 if(oksq2 && chi2>0 && chi2<200 &&
1824 ( (fabs(mkstarp-0.89166)<0.1 && fabs(mkstarm-0.89166)>0.1)
1825 || (fabs(mkstarm-0.89166)<0.1 && fabs(mkstarp-0.89166)>0.1 ) )){
1826 m_isPsipKstarK =
true;
1827 m_psipKstarKNumber++;
1842 if(m_selectPsipPPPiPi && (bestmass>3.075 && bestmass<3.120) && nGood==6 && jpsicharge==0 && nPi0==0){
1854 HepLorentzVector p4trkpp;
1855 HepLorentzVector p4trkpm;
1856 HepLorentzVector p4trkpip;
1857 HepLorentzVector p4trkpim;
1862 p4trkpp.setPx(
Px(trk1));
1863 p4trkpp.setPy(
Py(trk1));
1864 p4trkpp.setPz(
Pz(trk1));
1868 p4trkpm.setPx(
Px(trk3));
1869 p4trkpm.setPy(
Py(trk3));
1870 p4trkpm.setPz(
Pz(trk3));
1875 p4trkpip.setPx(
Px(trk2));
1876 p4trkpip.setPy(
Py(trk2));
1877 p4trkpip.setPz(
Pz(trk2));
1878 p4trkpip.setE(sqrt( pow(
P(trk2),2)+
mpi*
mpi) );
1881 p4trkpim.setPx(
Px(trk4));
1882 p4trkpim.setPy(
Py(trk4));
1883 p4trkpim.setPz(
Pz(trk4));
1884 p4trkpim.setE(sqrt( pow(
P(trk4),2)+
mpi*
mpi) );
1886 double jpsimass1= (p4trkpp+p4trkpm+p4trkpip+p4trkpim).m();
1892 p4trkpp.setPx(
Px(trk1));
1893 p4trkpp.setPy(
Py(trk1));
1894 p4trkpp.setPz(
Pz(trk1));
1898 p4trkpm.setPx(
Px(trk4));
1899 p4trkpm.setPy(
Py(trk4));
1900 p4trkpm.setPz(
Pz(trk4));
1904 p4trkpip.setPx(
Px(trk2));
1905 p4trkpip.setPy(
Py(trk2));
1906 p4trkpip.setPz(
Pz(trk2));
1907 p4trkpip.setE(sqrt( pow(
P(trk2),2)+
mpi*
mpi) );
1910 p4trkpim.setPx(
Px(trk3));
1911 p4trkpim.setPy(
Py(trk3));
1912 p4trkpim.setPz(
Pz(trk3));
1913 p4trkpim.setE(sqrt( pow(
P(trk3),2)+
mpi*
mpi) );
1915 double jpsimass2= (p4trkpp+p4trkpm+p4trkpip+p4trkpim).m();
1922 p4trkpp.setPx(
Px(trk2));
1923 p4trkpp.setPy(
Py(trk2));
1924 p4trkpp.setPz(
Pz(trk2));
1928 p4trkpm.setPx(
Px(trk3));
1929 p4trkpm.setPy(
Py(trk3));
1930 p4trkpm.setPz(
Pz(trk3));
1934 p4trkpip.setPx(
Px(trk1));
1935 p4trkpip.setPy(
Py(trk1));
1936 p4trkpip.setPz(
Pz(trk1));
1937 p4trkpip.setE(sqrt( pow(
P(trk1),2)+
mpi*
mpi) );
1940 p4trkpim.setPx(
Px(trk4));
1941 p4trkpim.setPy(
Py(trk4));
1942 p4trkpim.setPz(
Pz(trk4));
1943 p4trkpim.setE(sqrt( pow(
P(trk4),2)+
mpi*
mpi) );
1945 double jpsimass3= (p4trkpp+p4trkpm+p4trkpip+p4trkpim).m();
1952 p4trkpp.setPx(
Px(trk2));
1953 p4trkpp.setPy(
Py(trk2));
1954 p4trkpp.setPz(
Pz(trk2));
1958 p4trkpm.setPx(
Px(trk4));
1959 p4trkpm.setPy(
Py(trk4));
1960 p4trkpm.setPz(
Pz(trk4));
1964 p4trkpip.setPx(
Px(trk1));
1965 p4trkpip.setPy(
Py(trk1));
1966 p4trkpip.setPz(
Pz(trk1));
1967 p4trkpip.setE(sqrt( pow(
P(trk1),2)+
mpi*
mpi) );
1970 p4trkpim.setPx(
Px(trk3));
1971 p4trkpim.setPy(
Py(trk3));
1972 p4trkpim.setPz(
Pz(trk3));
1973 p4trkpim.setE(sqrt( pow(
P(trk3),2)+
mpi*
mpi) );
1975 double jpsimass4= (p4trkpp+p4trkpm+p4trkpip+p4trkpim).m();
1977 if( fabs(jpsimass1-3.075)<=0.075 || fabs(jpsimass2-3.075)<=0.075 ||
1978 fabs(jpsimass3-3.075)<=0.075 || fabs(jpsimass4-3.075)<=0.075){
1982 double chi1, chi2, chi3, chi4;
1987 WTrackParameter wvpiTrk1, wvpiTrk2, wvpiTrk3, wvpiTrk4 , wvpiTrk5, wvpiTrk6 ;
2009 bool oksq1 = kmfit->
Fit();
2010 chi1 = kmfit->
chisq();
2039 bool oksq1 = kmfit->
Fit();
2040 chi2 = kmfit->
chisq();
2046 else if(chi2<chimin){
2075 bool oksq1 = kmfit->
Fit();
2076 chi3 = kmfit->
chisq();
2082 else if(chi3<chimin){
2109 bool oksq1 = kmfit->
Fit();
2110 chi4 = kmfit->
chisq();
2116 else if(chi4<chimin){
2125 if(chimin>0 && chimin<200){
2126 m_isPsipPPPiPi =
true;
2127 m_psipPPPiPiNumber++;
2143 if(m_selectPsippCand){
2146 if ( ! evtRecDTagCol ) {
2147 log << MSG::FATAL <<
"Could not find EvtRecDTagCol" << endreq;
2148 return StatusCode::FAILURE;
2150 if(evtRecDTagCol->size()>0){
2152 EvtRecDTagCol::iterator m_iterbegin=evtRecDTagCol->begin();
2153 EvtRecDTagCol::iterator m_iterend=evtRecDTagCol->end();
2154 for(EvtRecDTagCol::iterator
iter=m_iterbegin;
iter != m_iterend;
iter++){
2156 if( ((*iter)->decayMode()==
EvtRecDTag::kD0toKPiPi0 && fabs((*iter)->mBC()-1.865)<0.006 && (*iter)->deltaE()>-0.05 && (*iter)->deltaE()<0.03) ||
2157 ((*iter)->decayMode()==
EvtRecDTag::kD0toKPiPi0Pi0 && fabs((*iter)->mBC()-1.865)<0.006 && (*iter)->deltaE()>-0.05 && (*iter)->deltaE()<0.03) ||
2158 ((*iter)->decayMode()==
EvtRecDTag::kD0toKPiPiPi && fabs((*iter)->mBC()-1.865)<0.006 && (*iter)->deltaE()>-0.03 && (*iter)->deltaE()<0.03) ||
2159 ((*iter)->decayMode()==
EvtRecDTag::kD0toKPiPiPiPi0 && fabs((*iter)->mBC()-1.865)<0.006 && (*iter)->deltaE()>-0.05 && (*iter)->deltaE()<0.03) ||
2160 ((*iter)->decayMode()==
EvtRecDTag::kD0toKsPiPi && fabs((*iter)->mBC()-1.865)<0.006 && (*iter)->deltaE()>-0.03 && (*iter)->deltaE()<0.03) ||
2161 ((*iter)->decayMode()==
EvtRecDTag::kD0toKsPiPiPi0 && fabs((*iter)->mBC()-1.865)<0.006 && (*iter)->deltaE()>-0.05 && (*iter)->deltaE()<0.03)||
2162 ((*iter)->decayMode()==
EvtRecDTag::kDptoKPiPi && fabs((*iter)->mBC()-1.87)<0.006 && (*iter)->deltaE()>-0.03 && (*iter)->deltaE()<0.03) ||
2163 ((*iter)->decayMode()==
EvtRecDTag::kDptoKPiPiPi0 && fabs((*iter)->mBC()-1.87)<0.006 && (*iter)->deltaE()>-0.05 && (*iter)->deltaE()<0.03)||
2164 ((*iter)->decayMode()==
EvtRecDTag::kDptoKsPiPi0 && fabs((*iter)->mBC()-1.87)<0.006 && (*iter)->deltaE()>-0.05 && (*iter)->deltaE()<0.03) ||
2165 ((*iter)->decayMode()==
EvtRecDTag::kDptoKsPiPiPi&& fabs((*iter)->mBC()-1.87)<0.006 && (*iter)->deltaE()>-0.03 && (*iter)->deltaE()<0.03) ) {
2166 m_isPsippCand =
true;
2167 m_psippCandNumber++;
2181 if( m_selectRadBhabha && m_isRadBhabha ) m_subalg3->execute();
2182 if( m_selectGGEE && m_isGGEE ) m_subalg4->execute();
2183 if( m_selectGG4Pi && m_isGG4Pi ) m_subalg5->execute();
2184 if( m_selectRadBhabhaT && m_isRadBhabhaT ) m_subalg6->execute();
2185 if( m_selectRhoPi && m_isRhoPi ) m_subalg7->execute();
2186 if( m_selectKstarK && m_isKstarK ) m_subalg8->execute();
2187 if( m_selectPPPiPi && m_isPPPiPi ) m_subalg9->execute();
2188 if( m_selectRecoJpsi && m_isRecoJpsi ) m_subalg10->execute();
2189 if( m_selectBhabha && m_isBhabha ) m_subalg11->execute();
2190 if( m_selectDimu && m_isDimu ) m_subalg12->execute();
2191 if( m_selectCosmic && m_isCosmic ) m_subalg13->execute();
2192 if( m_selectGenProton && m_isGenProton ) m_subalg14->execute();
2193 if( m_selectPsipRhoPi && m_isPsipRhoPi ) m_subalg15->execute();
2194 if( m_selectPsipKstarK && m_isPsipKstarK ) m_subalg16->execute();
2195 if( m_selectPsipPPPiPi && m_isPsipPPPiPi ) m_subalg17->execute();
2196 if( m_selectPsippCand && m_isPsippCand ) m_subalg18->execute();
2220 return StatusCode::SUCCESS;