488 MsgStream log(
msgSvc(), name() );
489 log << MSG::INFO <<
"in execute()" << endmsg;
491 if ( m_writeDst ) m_subalg1->execute();
492 if ( m_writeRec ) m_subalg2->execute();
494 m_isRadBhabha =
false;
497 m_isRadBhabhaT =
false;
500 m_isRecoJpsi =
false;
505 m_isGenProton =
false;
506 m_isPsipRhoPi =
false;
507 m_isPsipKstarK =
false;
508 m_isPsipPPPiPi =
false;
509 m_isPsippCand =
false;
511 SmartDataPtr<Event::EventHeader> eventHeader( eventSvc(),
"/Event/EventHeader" );
514 cout <<
" eventHeader " << endl;
515 return StatusCode::FAILURE;
518 int run = eventHeader->runNumber();
519 int event = eventHeader->eventNumber();
527 cout <<
"new run is:" << m_run << endl;
528 cout <<
"beamE is:" << beamE << endl;
529 if ( beamE > 0 && beamE < 3 ) m_ecm = 2 * beamE;
532 if ( m_display && m_events % 1000 == 0 )
534 cout << m_events <<
" -------- run,event: " << run <<
"," <<
event << endl;
535 cout <<
"m_ecm=" << m_ecm << endl;
542 cout <<
" evtRecEvent " << endl;
543 return StatusCode::FAILURE;
546 log << MSG::DEBUG <<
"ncharg, nneu, tottks = " << evtRecEvent->totalCharged() <<
" , "
547 << evtRecEvent->totalNeutral() <<
" , " << evtRecEvent->totalTracks() << endmsg;
551 cout <<
" evtRecTrkCol " << endl;
552 return StatusCode::FAILURE;
555 if ( evtRecEvent->totalTracks() != evtRecTrkCol->size() )
return StatusCode::SUCCESS;
558 SmartDataPtr<EvtRecPi0Col> recPi0Col( eventSvc(),
"/Event/EvtRec/EvtRecPi0Col" );
561 log << MSG::FATAL <<
"Could not find EvtRecPi0Col" << endmsg;
562 return StatusCode::FAILURE;
565 int nPi0 = recPi0Col->size();
566 EvtRecPi0Col::iterator itpi0 = recPi0Col->begin();
569 double mpi0 = ( *itpi0 )->unconMass();
570 if ( fabs(
mpi0 - 0.135 ) > 0.015 ) nPi0 = 0;
585 vector<int> iCP, iCN;
593 int nCosmicCharge = 0;
595 for (
int i = 0; i < evtRecEvent->totalCharged(); i++ )
602 if ( !( *itTrk )->isMdcKalTrackValid() )
continue;
606 double vx0 = mdcTrk->
x();
607 double vy0 = mdcTrk->
y();
608 double vz0 = mdcTrk->
z();
609 double vr0 = mdcTrk->
r();
610 double theta0 = mdcTrk->
theta();
611 double p0 =
P( mdcTrk );
612 double pt0 = sqrt( pow(
Px( mdcTrk ), 2 ) + pow(
Py( mdcTrk ), 2 ) );
628 Hep3Vector xorigin( 0, 0, 0 );
630 Gaudi::svcLocator()->service(
"VertexDbSvc", vtxsvc );
635 xorigin.setX( dbv[0] );
636 xorigin.setY( dbv[1] );
637 xorigin.setZ( dbv[2] );
642 HepPoint3D IP( xorigin[0], xorigin[1], xorigin[2] );
643 VFHelix helixip( point0, a, Ea );
645 HepVector vecipa = helixip.
a();
646 double db = fabs( vecipa[0] );
647 double dz = vecipa[3];
649 if ( fabs( dz ) >= m_vz0cut )
continue;
650 if ( db >= m_vr0cut )
continue;
653 if ( p0 > m_cosmic_lowp && p0 < 20 )
655 iCosmicGood.push_back( ( *itTrk )->trackId() );
656 nCosmicCharge += mdcTrk->
charge();
659 if ( pt0 >= m_pt0HighCut )
continue;
660 if ( pt0 <= m_pt0LowCut )
continue;
662 iGood.push_back( ( *itTrk )->trackId() );
663 nCharge += mdcTrk->
charge();
664 if ( mdcTrk->
charge() > 0 ) iCP.push_back( ( *itTrk )->trackId() );
665 else if ( mdcTrk->
charge() < 0 ) iCN.push_back( ( *itTrk )->trackId() );
667 int nGood = iGood.size();
668 int nCosmicGood = iCosmicGood.size();
673 for (
int i = evtRecEvent->totalCharged(); i < evtRecEvent->totalTracks(); i++ )
677 if ( !( *itTrk )->isEmcShowerValid() )
continue;
679 double eraw = emcTrk->
energy();
681 double costh =
cos( emcTrk->
theta() );
682 if ( fabs( costh ) < 0.83 && eraw < 0.025 )
continue;
683 if ( fabs( costh ) >= 0.83 && eraw < 0.05 )
continue;
686 iGam.push_back( ( *itTrk )->trackId() );
688 int nGam = iGam.size();
713 Hep3Vector Pt_charge( 0, 0, 0 );
715 for (
int i = 0; i < nGood; i++ )
723 if ( ( *itTrk )->isMdcKalTrackValid() )
731 double phi =
Phi( mdcTrk );
733 HepLorentzVector ptrk;
734 ptrk.setPx(
Px( mdcTrk ) );
735 ptrk.setPy(
Py( mdcTrk ) );
736 ptrk.setPz(
Pz( mdcTrk ) );
737 p3 = fabs( ptrk.mag() );
743 Hep3Vector ptemp(
Px( mdcTrk ),
Py( mdcTrk ), 0 );
747 if ( ( *itTrk )->isEmcShowerValid() )
762 else if ( p3 < pmax && p3 > psec )
773 ptrk.setE( sqrt( p3 * p3 +
mpi *
mpi ) );
774 ptrk = ptrk.boost( -0.011, 0, 0 );
779 if ( mdcTrk->
charge() > 0 )
781 ppip.push_back( ptrk );
786 ppim.push_back( ptrk );
791 if ( ( *itTrk )->isEmcShowerValid() )
795 double eraw = emcTrk->
energy();
796 double phiemc = emcTrk->
phi();
797 double the = emcTrk->
theta();
799 HepLorentzVector pemc;
800 pemc.setPx( eraw *
sin( the ) *
cos( phiemc ) );
801 pemc.setPy( eraw *
sin( the ) *
sin( phiemc ) );
802 pemc.setPz( eraw *
cos( the ) );
804 pemc = pemc.boost( -0.011, 0, 0 );
812 if ( pmax != 0 ) eopmax = eccmax / pmax;
813 if ( psec != 0 ) eopsec = eccsec / psec;
815 eemc = eccmax + eccsec;
832 Hep3Vector Pt_neu( 0, 0, 0 );
834 for (
int i = 0; i < nGam; i++ )
838 double eraw = emcTrk->
energy();
839 double phi = emcTrk->
phi();
840 double the = emcTrk->
theta();
841 HepLorentzVector ptrk;
842 ptrk.setPx( eraw *
sin( the ) *
cos( phi ) );
843 ptrk.setPy( eraw *
sin( the ) *
sin( phi ) );
844 ptrk.setPz( eraw *
cos( the ) );
846 ptrk = ptrk.boost( -0.011, 0, 0 );
847 pGam.push_back( ptrk );
852 Hep3Vector ptemp( eraw *
sin( the ) *
cos( phi ), eraw *
sin( the ) *
sin( phi ), 0 );
855 if ( ptrk.e() > egmax ) egmax = ptrk.e();
858 double esum = echarge + eneu;
859 Hep3Vector Pt = Pt_charge + Pt_neu;
861 double phid = phimax - phisec;
862 phid = fmod( phid + CLHEP::twopi + CLHEP::twopi +
pi, CLHEP::twopi ) - CLHEP::pi;
868 if ( nGood == 2 && nCharge == 0 && ( m_selectBhabha || m_selectDimu ) )
872 if ( m_events % m_bhabha_scale == 0 && m_selectBhabha && echarge / m_ecm > 0.8 &&
873 eopmax > 0.8 && eopsec > 0.8 )
880 if ( iCP.size() == 1 && iCN.size() == 1 && m_events % m_dimu_scale == 0 && m_selectDimu &&
943 double time1 = -99, depth1 = -99;
944 double time2 = -99, depth2 = -99;
945 double p1 = -99,
p2 = -99;
946 double emc1 = 0, emc2 = 0;
947 if ( ( *itp )->isTofTrackValid() )
949 SmartRefVector<RecTofTrack> tofTrkCol = ( *itp )->tofTrack();
950 SmartRefVector<RecTofTrack>::iterator iter_tof = tofTrkCol.begin();
952 for ( ; iter_tof != tofTrkCol.end(); iter_tof++ )
955 status->
setStatus( ( *iter_tof )->status() );
956 if ( status->
is_cluster() ) { time1 = ( *iter_tof )->tof(); }
961 if ( ( *itp )->isMucTrackValid() )
964 depth1 = mucTrk->
depth();
967 if ( ( *itp )->isMdcKalTrackValid() )
974 if ( ( *itp )->isEmcShowerValid() )
980 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++ )
988 status->
setStatus( ( *iter_tof )->status() );
989 if ( status->
is_cluster() ) { time2 = ( *iter_tof )->tof(); }
994 if ( ( *itn )->isMucTrackValid() )
997 depth2 = mucTrk->
depth();
1000 if ( ( *itn )->isMdcKalTrackValid() )
1007 if ( ( *itn )->isEmcShowerValid() )
1013 double ebeam = m_ecm / 2.0;
1014 if ( fabs( time1 - time2 ) < 5 &&
1017 ( emc1 /
p1 < 0.4 || emc2 /
p2 < 0.4 ) && ( depth1 > 3 || depth2 > 3 ) &&
1018 emc1 > 0.15 && emc1 < 0.3 && emc2 > 0.15 && emc2 < 0.3 && emc1 /
p1 < 0.8 &&
1020 ( ( depth1 > 80 *
p1 - 60 || depth1 > 40 ) ||
1021 ( depth2 > 80 *
p2 - 60 || depth2 > 40 ) ) )
1031 if ( m_selectCosmic && nCosmicGood == 2 && eemc / m_ecm < 0.3 )
1037 double time1 = -99, depth1 = -99;
1038 double time2 = -99, depth2 = -99;
1039 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++ )
1047 status->
setStatus( ( *iter_tof )->status() );
1048 if ( status->
is_cluster() ) { time1 = ( *iter_tof )->tof(); }
1053 if ( ( *itp )->isMucTrackValid() )
1056 depth1 = mucTrk->
depth();
1059 if ( ( *itn )->isTofTrackValid() )
1061 SmartRefVector<RecTofTrack> tofTrkCol = ( *itn )->tofTrack();
1062 SmartRefVector<RecTofTrack>::iterator iter_tof = tofTrkCol.begin();
1064 for ( ; iter_tof != tofTrkCol.end(); iter_tof++ )
1067 status->
setStatus( ( *iter_tof )->status() );
1068 if ( status->
is_cluster() ) { time2 = ( *iter_tof )->tof(); }
1073 if ( ( *itn )->isMucTrackValid() )
1076 depth2 = mucTrk->
depth();
1082 if ( m_selectCosmic && time1 != -99 && time2 != -99 && fabs( time1 - time2 ) > 5 )
1092 if ( m_events % m_proton_scale == 0 )
1095 bool protoncand =
false;
1098 for (
int i = 0; i < nGood; i++ )
1105 double pp =
P( mdcTrk );
1109 if ( ( *iter )->isMdcDedxValid() )
1112 dedx = dedxTrk->
normPH();
1113 chiP = dedxTrk->
chiP();
1116 if ( fabs( pp ) < 0.6 && dedx > 1.2 && fabs( chiP ) < 6 )
1118 ncharge += mdcTrk->
charge();
1124 if ( ( nproton == 1 && ncharge == -1 ) || ( nproton >= 2 && ncharge <= nproton - 2 ) )
1128 m_isGenProton =
true;
1129 m_genProtonNumber++;
1136 if ( m_printmonitor )
1138 h_nGood->fill( nGood );
1139 h_nCharge->fill( nCharge );
1140 h_pmaxobeam->fill( pmax / ( m_ecm / 2.0 ) );
1141 h_eopmax->fill( eopmax );
1142 h_eopsec->fill( eopsec );
1143 h_deltap->fill( pmax - psec );
1144 h_esumoecm->fill( esum / m_ecm );
1145 h_egmax->fill( egmax );
1146 h_deltaphi->fill( phid );
1147 h_Pt->fill( Pt.mag() );
1151 if ( nGood > 1 && pmax / ( m_ecm / 2.0 ) > 0.4 && eopmax > 0.5 && esum / m_ecm > 0.75 &&
1152 egmax > 0.08 && fabs( fabs( phid ) - CLHEP::pi ) * 180.0 / CLHEP::pi > 2.86 )
1154 m_isRadBhabha =
true;
1155 m_radBhabhaNumber++;
1158 if ( m_isRadBhabha )
1161 if ( nGood == 2 && nCharge == 0 && eemc / m_ecm >= 0.7 && eopmax >= 0.85 &&
1162 eopmax <= 1.15 && eopsec >= 0.85 && eopsec <= 1.15 )
1165 if ( fabs( fabs( pmax ) - m_ecm / 2.0 ) < 0.1 &&
1166 fabs( fabs( psec ) - m_ecm / 2.0 ) < 0.1 )
1168 if ( m_events % 1000 == 0 )
1170 m_isRadBhabhaT =
true;
1171 m_radBhabhaTNumber++;
1176 m_isRadBhabhaT =
true;
1177 m_radBhabhaTNumber++;
1185 if ( !m_isRadBhabhaT && nGood == 2 && nCharge == 0 && eopmax >= 0.85 && eopmax <= 1.15 &&
1186 eopsec >= 0.85 && eopsec <= 1.15 && eemc / m_ecm <= 0.8 && Pt.mag() <= 0.2 )
1193 if ( m_selectGG4Pi && nGood == 4 && nCharge == 0 && pmax / ( m_ecm / 2.0 ) > 0.04 &&
1194 pmax / ( m_ecm / 2.0 ) < 0.9 && esum / m_ecm > 0.04 && esum / m_ecm < 0.75 &&
1202 if ( ( m_selectRhoPi || m_selectKstarK ) && nGood == 2 && nCharge == 0 && nPi0 == 1 )
1208 if ( ( *itone )->isMdcKalTrackValid() && ( *ittwo )->isMdcKalTrackValid() )
1214 HepLorentzVector p4trk1;
1216 p4trk1.setPy(
Py( trk1 ) );
1217 p4trk1.setPz(
Pz( trk1 ) );
1218 p4trk1.setE( sqrt( pow(
P( trk1 ), 2 ) +
mkaon *
mkaon ) );
1220 HepLorentzVector p4trk2;
1221 p4trk2.setPx(
Px( trk2 ) );
1222 p4trk2.setPy(
Py( trk2 ) );
1223 p4trk2.setPz(
Pz( trk2 ) );
1224 p4trk2.setE( sqrt( pow(
P( trk2 ), 2 ) +
mkaon *
mkaon ) );
1226 HepLorentzVector p4trk3;
1227 p4trk3.setPx(
Px( trk1 ) );
1228 p4trk3.setPy(
Py( trk1 ) );
1229 p4trk3.setPz(
Pz( trk1 ) );
1230 p4trk3.setE( sqrt( pow(
P( trk1 ), 2 ) +
mpi *
mpi ) );
1232 HepLorentzVector p4trk4;
1233 p4trk4.setPx(
Px( trk2 ) );
1234 p4trk4.setPy(
Py( trk2 ) );
1235 p4trk4.setPz(
Pz( trk2 ) );
1236 p4trk4.setE( sqrt( pow(
P( trk2 ), 2 ) +
mpi *
mpi ) );
1239 itpi0 = recPi0Col->begin();
1240 HepLorentzVector p4gam1 = ( *itpi0 )->hiPfit();
1241 HepLorentzVector p4gam2 = ( *itpi0 )->loPfit();
1242 HepLorentzVector p4pi0 = p4gam1 + p4gam2;
1244 HepLorentzVector p4total = p4trk1 + p4trk2 + p4pi0;
1245 HepLorentzVector p4total2 = p4trk3 + p4trk4 + p4pi0;
1247 double rhopimass = p4total2.m();
1248 double kstarkmass = p4total.m();
1249 if ( ( kstarkmass > 3.0 && kstarkmass < 3.15 ) ||
1250 ( rhopimass > 3.0 && rhopimass < 3.15 ) )
1256 double eop1 = 0.0, eop2 = 0.0;
1257 if ( ( *itone )->isEmcShowerValid() )
1260 double etrk = emcTrk->
energy();
1262 if (
P( trk1 ) != 0 )
1264 eop1 = etrk /
P( trk1 );
1269 if ( ( *ittwo )->isEmcShowerValid() )
1272 double etrk = emcTrk->
energy();
1274 if (
P( trk2 ) != 0 )
1276 eop2 = etrk /
P( trk2 );
1281 if ( eop1 < 0.8 && eop2 < 0.8 )
1284 if ( rhopimass > 3.0 && rhopimass < 3.15 )
1288 HepLorentzVector
ecms( 0.034, 0, 0, m_ecm );
1294 const EvtRecTrack* gTrk1 = ( *itpi0 )->hiEnGamma();
1295 const EvtRecTrack* gTrk2 = ( *itpi0 )->loEnGamma();
1307 bool oksq1 = kmfit->
Fit();
1308 double chi1 = kmfit->
chisq();
1311 if ( oksq1 && chi1 <= 60 )
1318 if ( kstarkmass > 3.0 && kstarkmass < 3.15 )
1322 double mkstarp = 0, mkstarm = 0;
1323 if ( trk1->
charge() > 0 )
1325 HepLorentzVector p4kstarp = p4trk1 + p4pi0;
1326 HepLorentzVector p4kstarm = p4trk2 + p4pi0;
1327 mkstarp = p4kstarp.m();
1328 mkstarm = p4kstarm.m();
1332 HepLorentzVector p4kstarm = p4trk1 + p4pi0;
1333 HepLorentzVector p4kstarp = p4trk2 + p4pi0;
1334 mkstarp = p4kstarp.m();
1335 mkstarm = p4kstarm.m();
1338 if ( ( fabs( mkstarp - 0.89166 ) < 0.1 && fabs( mkstarm - 0.89166 ) > 0.1 ) ||
1339 ( fabs( mkstarm - 0.89166 ) < 0.1 && fabs( mkstarp - 0.89166 ) > 0.1 ) )
1343 HepLorentzVector
ecms( 0.034, 0, 0, m_ecm );
1349 const EvtRecTrack* gTrk1 = ( *itpi0 )->hiEnGamma();
1350 const EvtRecTrack* gTrk2 = ( *itpi0 )->loEnGamma();
1362 bool oksq1 = kmfit->
Fit();
1363 double chi1 = kmfit->
chisq();
1366 if ( oksq1 && chi1 <= 60 )
1384 if ( m_selectPPPiPi && nGood == 4 && nCharge == 0 && nPi0 == 0 )
1396 HepLorentzVector p4trkpp;
1397 HepLorentzVector p4trkpm;
1398 HepLorentzVector p4trkpip;
1399 HepLorentzVector p4trkpim;
1404 p4trkpp.setPx(
Px( trk1 ) );
1405 p4trkpp.setPy(
Py( trk1 ) );
1406 p4trkpp.setPz(
Pz( trk1 ) );
1410 p4trkpm.setPx(
Px( trk3 ) );
1411 p4trkpm.setPy(
Py( trk3 ) );
1412 p4trkpm.setPz(
Pz( trk3 ) );
1416 p4trkpip.setPx(
Px( trk2 ) );
1417 p4trkpip.setPy(
Py( trk2 ) );
1418 p4trkpip.setPz(
Pz( trk2 ) );
1419 p4trkpip.setE( sqrt( pow(
P( trk2 ), 2 ) +
mpi *
mpi ) );
1422 p4trkpim.setPx(
Px( trk4 ) );
1423 p4trkpim.setPy(
Py( trk4 ) );
1424 p4trkpim.setPz(
Pz( trk4 ) );
1425 p4trkpim.setE( sqrt( pow(
P( trk4 ), 2 ) +
mpi *
mpi ) );
1427 double jpsimass1 = ( p4trkpp + p4trkpm + p4trkpip + p4trkpim ).m();
1432 p4trkpp.setPx(
Px( trk1 ) );
1433 p4trkpp.setPy(
Py( trk1 ) );
1434 p4trkpp.setPz(
Pz( trk1 ) );
1438 p4trkpm.setPx(
Px( trk4 ) );
1439 p4trkpm.setPy(
Py( trk4 ) );
1440 p4trkpm.setPz(
Pz( trk4 ) );
1444 p4trkpip.setPx(
Px( trk2 ) );
1445 p4trkpip.setPy(
Py( trk2 ) );
1446 p4trkpip.setPz(
Pz( trk2 ) );
1447 p4trkpip.setE( sqrt( pow(
P( trk2 ), 2 ) +
mpi *
mpi ) );
1450 p4trkpim.setPx(
Px( trk3 ) );
1451 p4trkpim.setPy(
Py( trk3 ) );
1452 p4trkpim.setPz(
Pz( trk3 ) );
1453 p4trkpim.setE( sqrt( pow(
P( trk3 ), 2 ) +
mpi *
mpi ) );
1455 double jpsimass2 = ( p4trkpp + p4trkpm + p4trkpip + p4trkpim ).m();
1460 p4trkpp.setPx(
Px( trk2 ) );
1461 p4trkpp.setPy(
Py( trk2 ) );
1462 p4trkpp.setPz(
Pz( trk2 ) );
1466 p4trkpm.setPx(
Px( trk3 ) );
1467 p4trkpm.setPy(
Py( trk3 ) );
1468 p4trkpm.setPz(
Pz( trk3 ) );
1472 p4trkpip.setPx(
Px( trk1 ) );
1473 p4trkpip.setPy(
Py( trk1 ) );
1474 p4trkpip.setPz(
Pz( trk1 ) );
1475 p4trkpip.setE( sqrt( pow(
P( trk1 ), 2 ) +
mpi *
mpi ) );
1478 p4trkpim.setPx(
Px( trk4 ) );
1479 p4trkpim.setPy(
Py( trk4 ) );
1480 p4trkpim.setPz(
Pz( trk4 ) );
1481 p4trkpim.setE( sqrt( pow(
P( trk4 ), 2 ) +
mpi *
mpi ) );
1483 double jpsimass3 = ( p4trkpp + p4trkpm + p4trkpip + p4trkpim ).m();
1488 p4trkpp.setPx(
Px( trk2 ) );
1489 p4trkpp.setPy(
Py( trk2 ) );
1490 p4trkpp.setPz(
Pz( trk2 ) );
1494 p4trkpm.setPx(
Px( trk4 ) );
1495 p4trkpm.setPy(
Py( trk4 ) );
1496 p4trkpm.setPz(
Pz( trk4 ) );
1500 p4trkpip.setPx(
Px( trk1 ) );
1501 p4trkpip.setPy(
Py( trk1 ) );
1502 p4trkpip.setPz(
Pz( trk1 ) );
1503 p4trkpip.setE( sqrt( pow(
P( trk1 ), 2 ) +
mpi *
mpi ) );
1506 p4trkpim.setPx(
Px( trk3 ) );
1507 p4trkpim.setPy(
Py( trk3 ) );
1508 p4trkpim.setPz(
Pz( trk3 ) );
1509 p4trkpim.setE( sqrt( pow(
P( trk3 ), 2 ) +
mpi *
mpi ) );
1511 double jpsimass4 = ( p4trkpp + p4trkpm + p4trkpip + p4trkpim ).m();
1513 if ( fabs( jpsimass1 - 3.075 ) <= 0.075 || fabs( jpsimass2 - 3.075 ) <= 0.075 ||
1514 fabs( jpsimass3 - 3.075 ) <= 0.075 || fabs( jpsimass4 - 3.075 ) <= 0.075 )
1520 double chi1, chi2, chi3, chi4;
1522 double chimin = -999;
1523 HepLorentzVector
ecms( 0.034, 0, 0, m_ecm );
1541 bool oksq1 = kmfit->
Fit();
1542 chi1 = kmfit->
chisq();
1565 bool oksq1 = kmfit->
Fit();
1566 chi2 = kmfit->
chisq();
1574 else if ( chi2 < chimin )
1598 bool oksq1 = kmfit->
Fit();
1599 chi3 = kmfit->
chisq();
1607 else if ( chi3 < chimin )
1632 bool oksq1 = kmfit->
Fit();
1633 chi4 = kmfit->
chisq();
1642 else if ( chi4 < chimin )
1652 if (
type != 0 && chimin < 100 )
1666 if ( ( m_selectPsipRhoPi || m_selectPsipKstarK || m_selectPsipPPPiPi ) &&
1667 ( nGood == 4 || nGood == 6 ) && nCharge == 0 )
1673 double bestmass = 1.0;
1675 vector<int> iJPsiP, iJPsiN;
1676 for (
int ip = 0; ip < iCP.size(); ip++ )
1678 for (
int in = 0; in < iCN.size(); in++ )
1680 pione = evtRecTrkCol->begin() + iCP[ip];
1681 pitwo = evtRecTrkCol->begin() + iCN[in];
1682 pitrk1 = ( *pione )->mdcKalTrack();
1683 pitrk2 = ( *pitwo )->mdcKalTrack();
1684 Hep3Vector
p1(
Px( pitrk1 ),
Py( pitrk1 ),
Pz( pitrk1 ) );
1685 Hep3Vector
p2(
Px( pitrk2 ),
Py( pitrk2 ),
Pz( pitrk2 ) );
1686 double E1 = sqrt( pow(
P( pitrk1 ), 2 ) +
mpi *
mpi );
1687 double E2 = sqrt( pow(
P( pitrk2 ), 2 ) +
mpi *
mpi );
1688 double recomass = sqrt( pow( 3.686 - E1 - E2, 2 ) - ( -(
p1 +
p2 ) ).mag2() );
1690 if ( fabs( recomass - 3.096 ) < fabs( bestmass - 3.096 ) )
1692 bestmass = recomass;
1700 pione = evtRecTrkCol->begin() + iCP[pindex];
1701 pitwo = evtRecTrkCol->begin() + iCN[nindex];
1702 pitrk1 = ( *pione )->mdcKalTrack();
1703 pitrk2 = ( *pitwo )->mdcKalTrack();
1706 double jpsicharge = 0;
1707 for (
int ip = 0; ip < iCP.size(); ip++ )
1711 iJPsiP.push_back( iCP[ip] );
1714 jpsicharge += trktmp->
charge();
1718 for (
int in = 0; in < iCN.size(); in++ )
1722 iJPsiN.push_back( iCN[in] );
1725 jpsicharge += trktmp->
charge();
1729 HepLorentzVector
ecms( 0.034, 0, 0, m_ecm );
1732 if ( ( m_selectPsipRhoPi || m_selectPsipKstarK ) &&
1733 ( bestmass > 3.075 && bestmass < 3.120 ) && nGood == 4 && jpsicharge == 0 &&
1740 if ( ( *itone )->isMdcKalTrackValid() && ( *ittwo )->isMdcKalTrackValid() )
1746 HepLorentzVector p4trk1;
1748 p4trk1.setPy(
Py( trk1 ) );
1749 p4trk1.setPz(
Pz( trk1 ) );
1750 p4trk1.setE( sqrt( pow(
P( trk1 ), 2 ) +
mkaon *
mkaon ) );
1752 HepLorentzVector p4trk2;
1753 p4trk2.setPx(
Px( trk2 ) );
1754 p4trk2.setPy(
Py( trk2 ) );
1755 p4trk2.setPz(
Pz( trk2 ) );
1756 p4trk2.setE( sqrt( pow(
P( trk2 ), 2 ) +
mkaon *
mkaon ) );
1758 HepLorentzVector p4trk3;
1759 p4trk3.setPx(
Px( trk1 ) );
1760 p4trk3.setPy(
Py( trk1 ) );
1761 p4trk3.setPz(
Pz( trk1 ) );
1762 p4trk3.setE( sqrt( pow(
P( trk1 ), 2 ) +
mpi *
mpi ) );
1764 HepLorentzVector p4trk4;
1765 p4trk4.setPx(
Px( trk2 ) );
1766 p4trk4.setPy(
Py( trk2 ) );
1767 p4trk4.setPz(
Pz( trk2 ) );
1768 p4trk4.setE( sqrt( pow(
P( trk2 ), 2 ) +
mpi *
mpi ) );
1770 EvtRecPi0Col::iterator itpi0 = recPi0Col->begin();
1771 const EvtRecTrack* gTrk1 = ( *itpi0 )->hiEnGamma();
1772 const EvtRecTrack* gTrk2 = ( *itpi0 )->loEnGamma();
1778 HepLorentzVector p4gam1 = ( *itpi0 )->hiPfit();
1779 HepLorentzVector p4gam2 = ( *itpi0 )->loPfit();
1780 HepLorentzVector p4pi0 = p4gam1 + p4gam2;
1781 HepLorentzVector p4total = p4trk1 + p4trk2 + p4pi0;
1782 HepLorentzVector p4total2 = p4trk3 + p4trk4 + p4pi0;
1784 HepLorentzVector p4kstarp = p4trk1 + p4pi0;
1785 HepLorentzVector p4kstarm = p4trk2 + p4pi0;
1786 double mkstarp = p4kstarp.m();
1787 double mkstarm = p4kstarm.m();
1789 if ( ( p4total.m() > 3.0 && p4total.m() < 3.15 ) ||
1790 ( p4total2.m() > 3.0 && p4total2.m() < 3.15 ) )
1810 if ( m_selectPsipRhoPi )
1822 bool oksq1 = kmfit->
Fit();
1823 double chi1 = kmfit->
chisq();
1826 if ( oksq1 && chi1 > 0 && chi1 < 100 )
1828 m_isPsipRhoPi =
true;
1829 m_psipRhoPiNumber++;
1832 if ( m_selectPsipKstarK )
1844 bool oksq2 = kmfit2->
Fit();
1845 double chi2 = kmfit2->
chisq();
1847 if ( oksq2 && chi2 > 0 && chi2 < 200 &&
1848 ( ( fabs( mkstarp - 0.89166 ) < 0.1 && fabs( mkstarm - 0.89166 ) > 0.1 ) ||
1849 ( fabs( mkstarm - 0.89166 ) < 0.1 && fabs( mkstarp - 0.89166 ) > 0.1 ) ) )
1851 m_isPsipKstarK =
true;
1852 m_psipKstarKNumber++;
1862 if ( m_selectPsipPPPiPi && ( bestmass > 3.075 && bestmass < 3.120 ) && nGood == 6 &&
1863 jpsicharge == 0 && nPi0 == 0 )
1875 HepLorentzVector p4trkpp;
1876 HepLorentzVector p4trkpm;
1877 HepLorentzVector p4trkpip;
1878 HepLorentzVector p4trkpim;
1883 p4trkpp.setPx(
Px( trk1 ) );
1884 p4trkpp.setPy(
Py( trk1 ) );
1885 p4trkpp.setPz(
Pz( trk1 ) );
1889 p4trkpm.setPx(
Px( trk3 ) );
1890 p4trkpm.setPy(
Py( trk3 ) );
1891 p4trkpm.setPz(
Pz( trk3 ) );
1895 p4trkpip.setPx(
Px( trk2 ) );
1896 p4trkpip.setPy(
Py( trk2 ) );
1897 p4trkpip.setPz(
Pz( trk2 ) );
1898 p4trkpip.setE( sqrt( pow(
P( trk2 ), 2 ) +
mpi *
mpi ) );
1901 p4trkpim.setPx(
Px( trk4 ) );
1902 p4trkpim.setPy(
Py( trk4 ) );
1903 p4trkpim.setPz(
Pz( trk4 ) );
1904 p4trkpim.setE( sqrt( pow(
P( trk4 ), 2 ) +
mpi *
mpi ) );
1906 double jpsimass1 = ( p4trkpp + p4trkpm + p4trkpip + p4trkpim ).m();
1911 p4trkpp.setPx(
Px( trk1 ) );
1912 p4trkpp.setPy(
Py( trk1 ) );
1913 p4trkpp.setPz(
Pz( trk1 ) );
1917 p4trkpm.setPx(
Px( trk4 ) );
1918 p4trkpm.setPy(
Py( trk4 ) );
1919 p4trkpm.setPz(
Pz( trk4 ) );
1923 p4trkpip.setPx(
Px( trk2 ) );
1924 p4trkpip.setPy(
Py( trk2 ) );
1925 p4trkpip.setPz(
Pz( trk2 ) );
1926 p4trkpip.setE( sqrt( pow(
P( trk2 ), 2 ) +
mpi *
mpi ) );
1929 p4trkpim.setPx(
Px( trk3 ) );
1930 p4trkpim.setPy(
Py( trk3 ) );
1931 p4trkpim.setPz(
Pz( trk3 ) );
1932 p4trkpim.setE( sqrt( pow(
P( trk3 ), 2 ) +
mpi *
mpi ) );
1934 double jpsimass2 = ( p4trkpp + p4trkpm + p4trkpip + p4trkpim ).m();
1939 p4trkpp.setPx(
Px( trk2 ) );
1940 p4trkpp.setPy(
Py( trk2 ) );
1941 p4trkpp.setPz(
Pz( trk2 ) );
1945 p4trkpm.setPx(
Px( trk3 ) );
1946 p4trkpm.setPy(
Py( trk3 ) );
1947 p4trkpm.setPz(
Pz( trk3 ) );
1951 p4trkpip.setPx(
Px( trk1 ) );
1952 p4trkpip.setPy(
Py( trk1 ) );
1953 p4trkpip.setPz(
Pz( trk1 ) );
1954 p4trkpip.setE( sqrt( pow(
P( trk1 ), 2 ) +
mpi *
mpi ) );
1957 p4trkpim.setPx(
Px( trk4 ) );
1958 p4trkpim.setPy(
Py( trk4 ) );
1959 p4trkpim.setPz(
Pz( trk4 ) );
1960 p4trkpim.setE( sqrt( pow(
P( trk4 ), 2 ) +
mpi *
mpi ) );
1962 double jpsimass3 = ( p4trkpp + p4trkpm + p4trkpip + p4trkpim ).m();
1967 p4trkpp.setPx(
Px( trk2 ) );
1968 p4trkpp.setPy(
Py( trk2 ) );
1969 p4trkpp.setPz(
Pz( trk2 ) );
1973 p4trkpm.setPx(
Px( trk4 ) );
1974 p4trkpm.setPy(
Py( trk4 ) );
1975 p4trkpm.setPz(
Pz( trk4 ) );
1979 p4trkpip.setPx(
Px( trk1 ) );
1980 p4trkpip.setPy(
Py( trk1 ) );
1981 p4trkpip.setPz(
Pz( trk1 ) );
1982 p4trkpip.setE( sqrt( pow(
P( trk1 ), 2 ) +
mpi *
mpi ) );
1985 p4trkpim.setPx(
Px( trk3 ) );
1986 p4trkpim.setPy(
Py( trk3 ) );
1987 p4trkpim.setPz(
Pz( trk3 ) );
1988 p4trkpim.setE( sqrt( pow(
P( trk3 ), 2 ) +
mpi *
mpi ) );
1990 double jpsimass4 = ( p4trkpp + p4trkpm + p4trkpip + p4trkpim ).m();
1992 if ( fabs( jpsimass1 - 3.075 ) <= 0.075 || fabs( jpsimass2 - 3.075 ) <= 0.075 ||
1993 fabs( jpsimass3 - 3.075 ) <= 0.075 || fabs( jpsimass4 - 3.075 ) <= 0.075 )
1997 double chi1, chi2, chi3, chi4;
1999 double chimin = -999;
2001 WTrackParameter wvpiTrk1, wvpiTrk2, wvpiTrk3, wvpiTrk4, wvpiTrk5, wvpiTrk6;
2021 bool oksq1 = kmfit->
Fit();
2022 chi1 = kmfit->
chisq();
2048 bool oksq1 = kmfit->
Fit();
2049 chi2 = kmfit->
chisq();
2057 else if ( chi2 < chimin )
2084 bool oksq1 = kmfit->
Fit();
2085 chi3 = kmfit->
chisq();
2093 else if ( chi3 < chimin )
2120 bool oksq1 = kmfit->
Fit();
2121 chi4 = kmfit->
chisq();
2129 else if ( chi4 < chimin )
2137 if ( chimin > 0 && chimin < 200 )
2139 m_isPsipPPPiPi =
true;
2140 m_psipPPPiPiNumber++;
2151 if ( m_selectPsippCand )
2155 if ( !evtRecDTagCol )
2157 log << MSG::FATAL <<
"Could not find EvtRecDTagCol" << endmsg;
2158 return StatusCode::FAILURE;
2160 if ( evtRecDTagCol->size() > 0 )
2163 EvtRecDTagCol::iterator m_iterbegin = evtRecDTagCol->begin();
2164 EvtRecDTagCol::iterator m_iterend = evtRecDTagCol->end();
2165 for ( EvtRecDTagCol::iterator
iter = m_iterbegin;
iter != m_iterend;
iter++ )
2169 fabs( ( *iter )->mBC() - 1.865 ) < 0.006 && ( *iter )->deltaE() > -0.05 &&
2170 ( *iter )->deltaE() < 0.03 ) ||
2172 fabs( ( *iter )->mBC() - 1.865 ) < 0.006 && ( *iter )->deltaE() > -0.05 &&
2173 ( *iter )->deltaE() < 0.03 ) ||
2175 fabs( ( *iter )->mBC() - 1.865 ) < 0.006 && ( *iter )->deltaE() > -0.03 &&
2176 ( *iter )->deltaE() < 0.03 ) ||
2178 fabs( ( *iter )->mBC() - 1.865 ) < 0.006 && ( *iter )->deltaE() > -0.05 &&
2179 ( *iter )->deltaE() < 0.03 ) ||
2181 fabs( ( *iter )->mBC() - 1.865 ) < 0.006 && ( *iter )->deltaE() > -0.03 &&
2182 ( *iter )->deltaE() < 0.03 ) ||
2184 fabs( ( *iter )->mBC() - 1.865 ) < 0.006 && ( *iter )->deltaE() > -0.05 &&
2185 ( *iter )->deltaE() < 0.03 ) ||
2187 fabs( ( *iter )->mBC() - 1.87 ) < 0.006 && ( *iter )->deltaE() > -0.03 &&
2188 ( *iter )->deltaE() < 0.03 ) ||
2190 fabs( ( *iter )->mBC() - 1.87 ) < 0.006 && ( *iter )->deltaE() > -0.05 &&
2191 ( *iter )->deltaE() < 0.03 ) ||
2193 fabs( ( *iter )->mBC() - 1.87 ) < 0.006 && ( *iter )->deltaE() > -0.05 &&
2194 ( *iter )->deltaE() < 0.03 ) ||
2196 fabs( ( *iter )->mBC() - 1.87 ) < 0.006 && ( *iter )->deltaE() > -0.03 &&
2197 ( *iter )->deltaE() < 0.03 ) )
2199 m_isPsippCand =
true;
2200 m_psippCandNumber++;
2212 if ( m_selectRadBhabha && m_isRadBhabha ) m_subalg3->execute();
2213 if ( m_selectGGEE && m_isGGEE ) m_subalg4->execute();
2214 if ( m_selectGG4Pi && m_isGG4Pi ) m_subalg5->execute();
2215 if ( m_selectRadBhabhaT && m_isRadBhabhaT ) m_subalg6->execute();
2216 if ( m_selectRhoPi && m_isRhoPi ) m_subalg7->execute();
2217 if ( m_selectKstarK && m_isKstarK ) m_subalg8->execute();
2218 if ( m_selectPPPiPi && m_isPPPiPi ) m_subalg9->execute();
2219 if ( m_selectRecoJpsi && m_isRecoJpsi ) m_subalg10->execute();
2220 if ( m_selectBhabha && m_isBhabha ) m_subalg11->execute();
2221 if ( m_selectDimu && m_isDimu ) m_subalg12->execute();
2222 if ( m_selectCosmic && m_isCosmic ) m_subalg13->execute();
2223 if ( m_selectGenProton && m_isGenProton ) m_subalg14->execute();
2224 if ( m_selectPsipRhoPi && m_isPsipRhoPi ) m_subalg15->execute();
2225 if ( m_selectPsipKstarK && m_isPsipKstarK ) m_subalg16->execute();
2226 if ( m_selectPsipPPPiPi && m_isPsipPPPiPi ) m_subalg17->execute();
2227 if ( m_selectPsippCand && m_isPsippCand ) m_subalg18->execute();
2250 return StatusCode::SUCCESS;