484 {
485
486
487
488 MsgStream log(
msgSvc(), name() );
489 log << MSG::INFO << "in execute()" << endmsg;
490
491 if ( m_writeDst ) m_subalg1->execute();
492 if ( m_writeRec ) m_subalg2->execute();
493
494 m_isRadBhabha = false;
495 m_isGGEE = false;
496 m_isGG4Pi = false;
497 m_isRadBhabhaT = false;
498 m_isRhoPi = false;
499 m_isKstarK = false;
500 m_isRecoJpsi = false;
501 m_isPPPiPi = false;
502 m_isBhabha = false;
503 m_isDimu = false;
504 m_isCosmic = false;
505 m_isGenProton = false;
506 m_isPsipRhoPi = false;
507 m_isPsipKstarK = false;
508 m_isPsipPPPiPi = false;
509 m_isPsippCand = false;
510
511 SmartDataPtr<Event::EventHeader> eventHeader( eventSvc(), "/Event/EventHeader" );
512 if ( !eventHeader )
513 {
514 cout << " eventHeader " << endl;
515 return StatusCode::FAILURE;
516 }
517
518 int run = eventHeader->runNumber();
519 int event = eventHeader->eventNumber();
520
521
522 if ( m_run != run )
523 {
524 m_run = run;
525 double beamE = 0;
527 cout << "new run is:" << m_run << endl;
528 cout << "beamE is:" << beamE << endl;
529 if ( beamE > 0 && beamE < 3 ) m_ecm = 2 * beamE;
530 }
531
532 if ( m_display && m_events % 1000 == 0 )
533 {
534 cout << m_events << " -------- run,event: " << run << "," << event << endl;
535 cout << "m_ecm=" << m_ecm << endl;
536 }
537 m_events++;
538
540 if ( !evtRecEvent )
541 {
542 cout << " evtRecEvent " << endl;
543 return StatusCode::FAILURE;
544 }
545
546 log << MSG::DEBUG << "ncharg, nneu, tottks = " << evtRecEvent->totalCharged() << " , "
547 << evtRecEvent->totalNeutral() << " , " << evtRecEvent->totalTracks() << endmsg;
549 if ( !evtRecTrkCol )
550 {
551 cout << " evtRecTrkCol " << endl;
552 return StatusCode::FAILURE;
553 }
554
555 if ( evtRecEvent->totalTracks() != evtRecTrkCol->size() ) return StatusCode::SUCCESS;
556
557
558 SmartDataPtr<EvtRecPi0Col> recPi0Col( eventSvc(), "/Event/EvtRec/EvtRecPi0Col" );
559 if ( !recPi0Col )
560 {
561 log << MSG::FATAL << "Could not find EvtRecPi0Col" << endmsg;
562 return StatusCode::FAILURE;
563 }
564
565 int nPi0 = recPi0Col->size();
566 EvtRecPi0Col::iterator itpi0 = recPi0Col->begin();
567 if ( nPi0 == 1 )
568 {
569 double mpi0 = ( *itpi0 )->unconMass();
570 if ( fabs(
mpi0 - 0.135 ) > 0.015 ) nPi0 = 0;
571 }
572
573
574
575
576
577
578
579
580
581
582
584 iGood.clear();
585 vector<int> iCP, iCN;
586 iCP.clear();
587 iCN.clear();
588
590 iCosmicGood.clear();
591
592 int nCharge = 0;
593 int nCosmicCharge = 0;
594
595 for ( int i = 0; i < evtRecEvent->totalCharged(); i++ )
596 {
597
599
600
601
602 if ( !( *itTrk )->isMdcKalTrackValid() ) continue;
603 RecMdcKalTrack* mdcTrk = ( *itTrk )->mdcKalTrack();
604
605
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 ) );
613
614 if ( m_output )
615 {
616 m_vx0 = vx0;
617 m_vy0 = vy0;
618 m_vz0 = vz0;
619 m_vr0 = vr0;
620 m_theta0 = theta0;
621 m_p0 = p0;
622 m_pt0 = pt0;
623 m_tuple1->write();
624 }
625
626
627
628 Hep3Vector xorigin( 0, 0, 0 );
629 IVertexDbSvc* vtxsvc;
630 Gaudi::svcLocator()->service( "VertexDbSvc", vtxsvc );
632 {
635 xorigin.setX( dbv[0] );
636 xorigin.setY( dbv[1] );
637 xorigin.setZ( dbv[2] );
638 }
642 HepPoint3D IP( xorigin[0], xorigin[1], xorigin[2] );
643 VFHelix helixip( point0, a, Ea );
644 helixip.pivot( IP );
645 HepVector vecipa = helixip.a();
646 double db = fabs( vecipa[0] );
647 double dz = vecipa[3];
648
649 if ( fabs( dz ) >= m_vz0cut ) continue;
650 if ( db >= m_vr0cut ) continue;
651
652
653 if ( p0 > m_cosmic_lowp && p0 < 20 )
654 {
655 iCosmicGood.push_back( ( *itTrk )->trackId() );
656 nCosmicCharge += mdcTrk->
charge();
657 }
658
659 if ( pt0 >= m_pt0HighCut ) continue;
660 if ( pt0 <= m_pt0LowCut ) continue;
661
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() );
666 }
667 int nGood = iGood.size();
668 int nCosmicGood = iCosmicGood.size();
669
670
672 iGam.clear();
673 for ( int i = evtRecEvent->totalCharged(); i < evtRecEvent->totalTracks(); i++ )
674 {
675
677 if ( !( *itTrk )->isEmcShowerValid() ) continue;
678 RecEmcShower* emcTrk = ( *itTrk )->emcShower();
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;
685
686 iGam.push_back( ( *itTrk )->trackId() );
687 }
688 int nGam = iGam.size();
689
690
692 ipip.clear();
693 ipim.clear();
695 ppip.clear();
696 ppim.clear();
697
698
699 double echarge = 0.;
700 double ptot = 0.;
702 double eemc = 0.;
703 double pp = 0.;
704 double pm = 0.;
705 double pmax = 0.0;
706 double psec = 0.0;
707 double eccmax = 0.0;
708 double eccsec = 0.0;
709 double phimax = 0.0;
710 double phisec = 0.0;
711 double eopmax = 0.0;
712 double eopsec = 0.0;
713 Hep3Vector Pt_charge( 0, 0, 0 );
714
715 for ( int i = 0; i < nGood; i++ )
716 {
718
719 double p3 = 0;
720
721
722
723 if ( ( *itTrk )->isMdcKalTrackValid() )
724 {
725 RecMdcKalTrack* mdcTrk = ( *itTrk )->mdcKalTrack();
727
729
730
731 double phi =
Phi( mdcTrk );
732
733 HepLorentzVector ptrk;
734 ptrk.setPx(
Px( mdcTrk ) );
735 ptrk.setPy(
Py( mdcTrk ) );
736 ptrk.setPz(
Pz( mdcTrk ) );
737 p3 = fabs( ptrk.mag() );
738
739
740
741
742
743 Hep3Vector ptemp(
Px( mdcTrk ),
Py( mdcTrk ), 0 );
744 Pt_charge += ptemp;
745
746 double ecc = 0.0;
747 if ( ( *itTrk )->isEmcShowerValid() )
748 {
749 RecEmcShower* emcTrk = ( *itTrk )->emcShower();
751 }
752
753 if ( p3 > pmax )
754 {
755 psec = pmax;
756 eccsec = eccmax;
757 phisec = phimax;
758 pmax = p3;
759 eccmax = ecc;
760 phimax = phi;
761 }
762 else if ( p3 < pmax && p3 > psec )
763 {
764 psec = p3;
765 eccsec = ecc;
766 phisec = phi;
767 }
768
769
770
771
772
773 ptrk.setE( sqrt( p3 * p3 +
mpi *
mpi ) );
774 ptrk = ptrk.boost( -0.011, 0, 0 );
775
776 echarge += ptrk.e();
778
779 if ( mdcTrk->
charge() > 0 )
780 {
781 ppip.push_back( ptrk );
782 pp = ptrk.rho();
783 }
784 else
785 {
786 ppim.push_back( ptrk );
787 pm = ptrk.rho();
788 }
789 }
790
791 if ( ( *itTrk )->isEmcShowerValid() )
792 {
793
794 RecEmcShower* emcTrk = ( *itTrk )->emcShower();
795 double eraw = emcTrk->
energy();
796 double phiemc = emcTrk->
phi();
797 double the = emcTrk->
theta();
798
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 ) );
803 pemc.setE( eraw );
804 pemc = pemc.boost( -0.011, 0, 0 );
805
806
808 }
809
810 }
811
812 if ( pmax != 0 ) eopmax = eccmax / pmax;
813 if ( psec != 0 ) eopsec = eccsec / psec;
814
815 eemc = eccmax + eccsec;
816
817
818
819
820
821
822
823
824
825
826
827
829 pGam.clear();
830 double eneu = 0;
831 double egmax = 0;
832 Hep3Vector Pt_neu( 0, 0, 0 );
833
834 for ( int i = 0; i < nGam; i++ )
835 {
837 RecEmcShower* emcTrk = ( *itTrk )->emcShower();
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 ) );
845 ptrk.setE( eraw );
846 ptrk = ptrk.boost( -0.011, 0, 0 );
847 pGam.push_back( ptrk );
848 eneu += ptrk.e();
850 eemc += eraw;
851
852 Hep3Vector ptemp( eraw *
sin( the ) *
cos( phi ), eraw *
sin( the ) *
sin( phi ), 0 );
853 Pt_neu += ptemp;
854
855 if ( ptrk.e() > egmax ) egmax = ptrk.e();
856 }
857
858 double esum = echarge + eneu;
859 Hep3Vector Pt = Pt_charge + Pt_neu;
860
861 double phid = phimax - phisec;
862 phid = fmod( phid + CLHEP::twopi + CLHEP::twopi +
pi, CLHEP::twopi ) - CLHEP::pi;
863
864
865
866
867
868 if ( nGood == 2 && nCharge == 0 && ( m_selectBhabha || m_selectDimu ) )
869 {
870
871
872 if ( m_events % m_bhabha_scale == 0 && m_selectBhabha && echarge / m_ecm > 0.8 &&
873 eopmax > 0.8 && eopsec > 0.8 )
874 {
875 m_isBhabha = true;
876 m_bhabhaNumber++;
877 }
878
879
880 if ( iCP.size() == 1 && iCN.size() == 1 && m_events % m_dimu_scale == 0 && m_selectDimu &&
881 eemc / m_ecm < 0.3 )
882 {
883
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
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() )
948 {
949 SmartRefVector<RecTofTrack> tofTrkCol = ( *itp )->tofTrack();
950 SmartRefVector<RecTofTrack>::iterator iter_tof = tofTrkCol.begin();
951
952 for ( ; iter_tof != tofTrkCol.end(); iter_tof++ )
953 {
954 TofHitStatus* status = new TofHitStatus;
955 status->
setStatus( ( *iter_tof )->status() );
956 if ( status->
is_cluster() ) { time1 = ( *iter_tof )->tof(); }
957 delete status;
958 }
959 }
960
961 if ( ( *itp )->isMucTrackValid() )
962 {
963 RecMucTrack* mucTrk = ( *itp )->mucTrack();
964 depth1 = mucTrk->
depth();
965 }
966
967 if ( ( *itp )->isMdcKalTrackValid() )
968 {
969 RecMdcKalTrack* mdcTrk = ( *itp )->mdcKalTrack();
972 }
973
974 if ( ( *itp )->isEmcShowerValid() )
975 {
976 RecEmcShower* emcTrk = ( *itp )->emcShower();
978 }
979
980 if ( ( *itn )->isTofTrackValid() )
981 {
982 SmartRefVector<RecTofTrack> tofTrkCol = ( *itn )->tofTrack();
983 SmartRefVector<RecTofTrack>::iterator iter_tof = tofTrkCol.begin();
984
985 for ( ; iter_tof != tofTrkCol.end(); iter_tof++ )
986 {
987 TofHitStatus* status = new TofHitStatus;
988 status->
setStatus( ( *iter_tof )->status() );
989 if ( status->
is_cluster() ) { time2 = ( *iter_tof )->tof(); }
990 delete status;
991 }
992 }
993
994 if ( ( *itn )->isMucTrackValid() )
995 {
996 RecMucTrack* mucTrk = ( *itn )->mucTrack();
997 depth2 = mucTrk->
depth();
998 }
999
1000 if ( ( *itn )->isMdcKalTrackValid() )
1001 {
1002 RecMdcKalTrack* mdcTrk = ( *itn )->mdcKalTrack();
1005 }
1006
1007 if ( ( *itn )->isEmcShowerValid() )
1008 {
1009 RecEmcShower* emcTrk = ( *itn )->emcShower();
1011 }
1012
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 ) ) )
1022 {
1023 m_isDimu = true;
1024 m_dimuNumber++;
1025 }
1026
1027 }
1028
1029 }
1030
1031 if ( m_selectCosmic && nCosmicGood == 2 && eemc / m_ecm < 0.3 )
1032 {
1033
1036
1037 double time1 = -99, depth1 = -99;
1038 double time2 = -99, depth2 = -99;
1039 if ( ( *itp )->isTofTrackValid() )
1040 {
1041 SmartRefVector<RecTofTrack> tofTrkCol = ( *itp )->tofTrack();
1042 SmartRefVector<RecTofTrack>::iterator iter_tof = tofTrkCol.begin();
1043
1044 for ( ; iter_tof != tofTrkCol.end(); iter_tof++ )
1045 {
1046 TofHitStatus* status = new TofHitStatus;
1047 status->
setStatus( ( *iter_tof )->status() );
1048 if ( status->
is_cluster() ) { time1 = ( *iter_tof )->tof(); }
1049 delete status;
1050 }
1051 }
1052
1053 if ( ( *itp )->isMucTrackValid() )
1054 {
1055 RecMucTrack* mucTrk = ( *itp )->mucTrack();
1056 depth1 = mucTrk->
depth();
1057 }
1058
1059 if ( ( *itn )->isTofTrackValid() )
1060 {
1061 SmartRefVector<RecTofTrack> tofTrkCol = ( *itn )->tofTrack();
1062 SmartRefVector<RecTofTrack>::iterator iter_tof = tofTrkCol.begin();
1063
1064 for ( ; iter_tof != tofTrkCol.end(); iter_tof++ )
1065 {
1066 TofHitStatus* status = new TofHitStatus;
1067 status->
setStatus( ( *iter_tof )->status() );
1068 if ( status->
is_cluster() ) { time2 = ( *iter_tof )->tof(); }
1069 delete status;
1070 }
1071 }
1072
1073 if ( ( *itn )->isMucTrackValid() )
1074 {
1075 RecMucTrack* mucTrk = ( *itn )->mucTrack();
1076 depth2 = mucTrk->
depth();
1077 }
1078
1079
1080
1081
1082 if ( m_selectCosmic && time1 != -99 && time2 != -99 && fabs( time1 - time2 ) > 5 )
1083 {
1084 m_isCosmic = true;
1085 m_cosmicNumber++;
1086 }
1087
1088 }
1089
1090
1091
1092 if ( m_events % m_proton_scale == 0 )
1093 {
1094
1095 bool protoncand = false;
1096 int ncharge = 0;
1097 int nproton = 0;
1098 for ( int i = 0; i < nGood; i++ )
1099 {
1100
1102 RecMdcKalTrack* mdcTrk = ( *iter )->mdcKalTrack();
1104
1105 double pp =
P( mdcTrk );
1106 double dedx = -99;
1107 double chiP = -99;
1108
1109 if ( ( *iter )->isMdcDedxValid() )
1110 {
1111 RecMdcDedx* dedxTrk = ( *iter )->mdcDedx();
1112 dedx = dedxTrk->
normPH();
1113 chiP = dedxTrk->
chiP();
1114 }
1115
1116 if ( fabs( pp ) < 0.6 && dedx > 1.2 && fabs( chiP ) < 6 )
1117 {
1118 ncharge += mdcTrk->
charge();
1119 nproton++;
1120
1121
1122 }
1123 }
1124 if ( ( nproton == 1 && ncharge == -1 ) || ( nproton >= 2 && ncharge <= nproton - 2 ) )
1125 protoncand = true;
1126 if ( protoncand )
1127 {
1128 m_isGenProton = true;
1129 m_genProtonNumber++;
1130 }
1131
1132 }
1133
1134
1135
1136 if ( m_printmonitor )
1137 {
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() );
1148 }
1149
1150
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 )
1153 {
1154 m_isRadBhabha = true;
1155 m_radBhabhaNumber++;
1156 }
1157
1158 if ( m_isRadBhabha )
1159 {
1160
1161 if ( nGood == 2 && nCharge == 0 && eemc / m_ecm >= 0.7 && eopmax >= 0.85 &&
1162 eopmax <= 1.15 && eopsec >= 0.85 && eopsec <= 1.15 )
1163 {
1164
1165 if ( fabs( fabs( pmax ) - m_ecm / 2.0 ) < 0.1 &&
1166 fabs( fabs( psec ) - m_ecm / 2.0 ) < 0.1 )
1167 {
1168 if ( m_events % 1000 == 0 )
1169 {
1170 m_isRadBhabhaT = true;
1171 m_radBhabhaTNumber++;
1172 }
1173 }
1174 else
1175 {
1176 m_isRadBhabhaT = true;
1177 m_radBhabhaTNumber++;
1178 }
1179 }
1180 }
1181
1182
1183
1184
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 )
1187 {
1188 m_isGGEE = true;
1189 m_GGEENumber++;
1190 }
1191
1192
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 &&
1195 Pt.mag() <= 0.2 )
1196 {
1197 m_isGG4Pi = true;
1198 m_GG4PiNumber++;
1199 }
1200
1201
1202 if ( ( m_selectRhoPi || m_selectKstarK ) && nGood == 2 && nCharge == 0 && nPi0 == 1 )
1203 {
1204
1207
1208 if ( ( *itone )->isMdcKalTrackValid() && ( *ittwo )->isMdcKalTrackValid() )
1209 {
1210
1211 RecMdcKalTrack* trk1 = ( *itone )->mdcKalTrack();
1212 RecMdcKalTrack* trk2 = ( *ittwo )->mdcKalTrack();
1213
1214 HepLorentzVector p4trk1;
1215 p4trk1.setPx(
Px( trk1 ) );
1216 p4trk1.setPy(
Py( trk1 ) );
1217 p4trk1.setPz(
Pz( trk1 ) );
1218 p4trk1.setE( sqrt( pow(
P( trk1 ), 2 ) +
mkaon *
mkaon ) );
1219
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 ) );
1225
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 ) );
1231
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 ) );
1237
1238
1239 itpi0 = recPi0Col->begin();
1240 HepLorentzVector p4gam1 = ( *itpi0 )->hiPfit();
1241 HepLorentzVector p4gam2 = ( *itpi0 )->loPfit();
1242 HepLorentzVector p4pi0 = p4gam1 + p4gam2;
1243
1244 HepLorentzVector p4total = p4trk1 + p4trk2 + p4pi0;
1245 HepLorentzVector p4total2 = p4trk3 + p4trk4 + p4pi0;
1246
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 ) )
1251 {
1252
1253
1254
1255
1256 double eop1 = 0.0, eop2 = 0.0;
1257 if ( ( *itone )->isEmcShowerValid() )
1258 {
1259 RecEmcShower* emcTrk = ( *itone )->emcShower();
1260 double etrk = emcTrk->
energy();
1261
1262 if (
P( trk1 ) != 0 )
1263 {
1264 eop1 = etrk /
P( trk1 );
1265
1266 }
1267 }
1268
1269 if ( ( *ittwo )->isEmcShowerValid() )
1270 {
1271 RecEmcShower* emcTrk = ( *ittwo )->emcShower();
1272 double etrk = emcTrk->
energy();
1273
1274 if (
P( trk2 ) != 0 )
1275 {
1276 eop2 = etrk /
P( trk2 );
1277
1278 }
1279 }
1280
1281 if ( eop1 < 0.8 && eop2 < 0.8 )
1282 {
1283
1284 if ( rhopimass > 3.0 && rhopimass < 3.15 )
1285 {
1286
1287
1288 HepLorentzVector
ecms( 0.034, 0, 0, m_ecm );
1289
1290 WTrackParameter wvpiTrk1, wvpiTrk2;
1293
1294 const EvtRecTrack* gTrk1 = ( *itpi0 )->hiEnGamma();
1295 const EvtRecTrack* gTrk2 = ( *itpi0 )->loEnGamma();
1296 RecEmcShower* gShr1 = const_cast<EvtRecTrack*>( gTrk1 )->emcShower();
1297 RecEmcShower* gShr2 = const_cast<EvtRecTrack*>( gTrk2 )->emcShower();
1298
1306
1307 bool oksq1 = kmfit->
Fit();
1308 double chi1 = kmfit->
chisq();
1309
1310
1311 if ( oksq1 && chi1 <= 60 )
1312 {
1313 m_isRhoPi = true;
1314 m_rhoPiNumber++;
1315 }
1316 }
1317
1318 if ( kstarkmass > 3.0 && kstarkmass < 3.15 )
1319 {
1320
1321
1322 double mkstarp = 0, mkstarm = 0;
1323 if ( trk1->
charge() > 0 )
1324 {
1325 HepLorentzVector p4kstarp = p4trk1 + p4pi0;
1326 HepLorentzVector p4kstarm = p4trk2 + p4pi0;
1327 mkstarp = p4kstarp.m();
1328 mkstarm = p4kstarm.m();
1329 }
1330 else
1331 {
1332 HepLorentzVector p4kstarm = p4trk1 + p4pi0;
1333 HepLorentzVector p4kstarp = p4trk2 + p4pi0;
1334 mkstarp = p4kstarp.m();
1335 mkstarm = p4kstarm.m();
1336 }
1337
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 ) )
1340 {
1341
1342
1343 HepLorentzVector
ecms( 0.034, 0, 0, m_ecm );
1344
1345 WTrackParameter wvpiTrk1, wvpiTrk2;
1348
1349 const EvtRecTrack* gTrk1 = ( *itpi0 )->hiEnGamma();
1350 const EvtRecTrack* gTrk2 = ( *itpi0 )->loEnGamma();
1351 RecEmcShower* gShr1 = const_cast<EvtRecTrack*>( gTrk1 )->emcShower();
1352 RecEmcShower* gShr2 = const_cast<EvtRecTrack*>( gTrk2 )->emcShower();
1353
1361
1362 bool oksq1 = kmfit->
Fit();
1363 double chi1 = kmfit->
chisq();
1364
1365
1366 if ( oksq1 && chi1 <= 60 )
1367 {
1368 m_isKstarK = true;
1369 m_kstarKNumber++;
1370 }
1371 }
1372
1373 }
1374
1375 }
1376
1377
1378 }
1379 }
1380
1381 }
1382
1383
1384 if ( m_selectPPPiPi && nGood == 4 && nCharge == 0 && nPi0 == 0 )
1385 {
1386
1391 RecMdcKalTrack* trk1 = ( *itone )->mdcKalTrack();
1392 RecMdcKalTrack* trk2 = ( *ittwo )->mdcKalTrack();
1393 RecMdcKalTrack* trk3 = ( *itthr )->mdcKalTrack();
1394 RecMdcKalTrack* trk4 = ( *itfor )->mdcKalTrack();
1395
1396 HepLorentzVector p4trkpp;
1397 HepLorentzVector p4trkpm;
1398 HepLorentzVector p4trkpip;
1399 HepLorentzVector p4trkpim;
1400
1401
1402
1404 p4trkpp.setPx(
Px( trk1 ) );
1405 p4trkpp.setPy(
Py( trk1 ) );
1406 p4trkpp.setPz(
Pz( trk1 ) );
1408
1410 p4trkpm.setPx(
Px( trk3 ) );
1411 p4trkpm.setPy(
Py( trk3 ) );
1412 p4trkpm.setPz(
Pz( trk3 ) );
1414
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 ) );
1420
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 ) );
1426
1427 double jpsimass1 = ( p4trkpp + p4trkpm + p4trkpip + p4trkpim ).m();
1428
1429
1430
1432 p4trkpp.setPx(
Px( trk1 ) );
1433 p4trkpp.setPy(
Py( trk1 ) );
1434 p4trkpp.setPz(
Pz( trk1 ) );
1436
1438 p4trkpm.setPx(
Px( trk4 ) );
1439 p4trkpm.setPy(
Py( trk4 ) );
1440 p4trkpm.setPz(
Pz( trk4 ) );
1442
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 ) );
1448
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 ) );
1454
1455 double jpsimass2 = ( p4trkpp + p4trkpm + p4trkpip + p4trkpim ).m();
1456
1457
1458
1460 p4trkpp.setPx(
Px( trk2 ) );
1461 p4trkpp.setPy(
Py( trk2 ) );
1462 p4trkpp.setPz(
Pz( trk2 ) );
1464
1466 p4trkpm.setPx(
Px( trk3 ) );
1467 p4trkpm.setPy(
Py( trk3 ) );
1468 p4trkpm.setPz(
Pz( trk3 ) );
1470
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 ) );
1476
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 ) );
1482
1483 double jpsimass3 = ( p4trkpp + p4trkpm + p4trkpip + p4trkpim ).m();
1484
1485
1486
1488 p4trkpp.setPx(
Px( trk2 ) );
1489 p4trkpp.setPy(
Py( trk2 ) );
1490 p4trkpp.setPz(
Pz( trk2 ) );
1492
1494 p4trkpm.setPx(
Px( trk4 ) );
1495 p4trkpm.setPy(
Py( trk4 ) );
1496 p4trkpm.setPz(
Pz( trk4 ) );
1498
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 ) );
1504
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 ) );
1510
1511 double jpsimass4 = ( p4trkpp + p4trkpm + p4trkpip + p4trkpim ).m();
1512
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 )
1515 {
1516
1517
1518
1519
1520 double chi1, chi2, chi3, chi4;
1521 int type = 0;
1522 double chimin = -999;
1523 HepLorentzVector
ecms( 0.034, 0, 0, m_ecm );
1524
1525 WTrackParameter wvpiTrk1, wvpiTrk2, wvpiTrk3, wvpiTrk4;
1526
1527 {
1532
1540
1541 bool oksq1 = kmfit->
Fit();
1542 chi1 = kmfit->
chisq();
1543 if ( oksq1 )
1544 {
1545 chimin = chi1;
1546 type = 1;
1547 }
1548
1549 }
1550
1551 {
1556
1564
1565 bool oksq1 = kmfit->
Fit();
1566 chi2 = kmfit->
chisq();
1567 if ( oksq1 )
1568 {
1569 if ( type == 0 )
1570 {
1571 chimin = chi2;
1572 type = 2;
1573 }
1574 else if ( chi2 < chimin )
1575 {
1576 chimin = chi2;
1577 type = 2;
1578 }
1579 }
1580
1581 }
1582
1583 {
1588
1595
1597
1598 bool oksq1 = kmfit->
Fit();
1599 chi3 = kmfit->
chisq();
1600 if ( oksq1 )
1601 {
1602 if ( type == 0 )
1603 {
1604 chimin = chi3;
1605 type = 3;
1606 }
1607 else if ( chi3 < chimin )
1608 {
1609 chimin = chi3;
1610 type = 3;
1611 }
1612 }
1613
1614
1615 }
1616
1617 {
1622
1629
1631
1632 bool oksq1 = kmfit->
Fit();
1633 chi4 = kmfit->
chisq();
1634
1635 if ( oksq1 )
1636 {
1637 if ( type == 0 )
1638 {
1639 chimin = chi4;
1640 type = 4;
1641 }
1642 else if ( chi4 < chimin )
1643 {
1644 chimin = chi4;
1645 type = 4;
1646 }
1647 }
1648
1649
1650 }
1651
1652 if ( type != 0 && chimin < 100 )
1653 {
1654 m_isPPPiPi = true;
1655 m_ppPiPiNumber++;
1656 }
1657
1658
1659
1660 }
1661
1662 }
1663
1664
1665
1666 if ( ( m_selectPsipRhoPi || m_selectPsipKstarK || m_selectPsipPPPiPi ) &&
1667 ( nGood == 4 || nGood == 6 ) && nCharge == 0 )
1668 {
1670 RecMdcKalTrack* pitrk1;
1671 RecMdcKalTrack* pitrk2;
1672
1673 double bestmass = 1.0;
1674 int pindex, nindex;
1675 vector<int> iJPsiP, iJPsiN;
1676 for ( int ip = 0; ip < iCP.size(); ip++ )
1677 {
1678 for ( int in = 0; in < iCN.size(); in++ )
1679 {
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() );
1689
1690 if ( fabs( recomass - 3.096 ) < fabs( bestmass - 3.096 ) )
1691 {
1692 bestmass = recomass;
1693 pindex = ip;
1694 nindex = in;
1695 }
1696 }
1697 }
1698
1699
1700 pione = evtRecTrkCol->begin() + iCP[pindex];
1701 pitwo = evtRecTrkCol->begin() + iCN[nindex];
1702 pitrk1 = ( *pione )->mdcKalTrack();
1703 pitrk2 = ( *pitwo )->mdcKalTrack();
1704
1705
1706 double jpsicharge = 0;
1707 for ( int ip = 0; ip < iCP.size(); ip++ )
1708 {
1709 if ( ip != pindex )
1710 {
1711 iJPsiP.push_back( iCP[ip] );
1713 RecMdcKalTrack* trktmp = ( *itertmp )->mdcKalTrack();
1714 jpsicharge += trktmp->
charge();
1715 }
1716 }
1717
1718 for ( int in = 0; in < iCN.size(); in++ )
1719 {
1720 if ( in != nindex )
1721 {
1722 iJPsiN.push_back( iCN[in] );
1724 RecMdcKalTrack* trktmp = ( *itertmp )->mdcKalTrack();
1725 jpsicharge += trktmp->
charge();
1726 }
1727 }
1728
1729 HepLorentzVector
ecms( 0.034, 0, 0, m_ecm );
1730
1731
1732 if ( ( m_selectPsipRhoPi || m_selectPsipKstarK ) &&
1733 ( bestmass > 3.075 && bestmass < 3.120 ) && nGood == 4 && jpsicharge == 0 &&
1734 nPi0 == 1 )
1735 {
1736
1739
1740 if ( ( *itone )->isMdcKalTrackValid() && ( *ittwo )->isMdcKalTrackValid() )
1741 {
1742
1743 RecMdcKalTrack* trk1 = ( *itone )->mdcKalTrack();
1744 RecMdcKalTrack* trk2 = ( *ittwo )->mdcKalTrack();
1745
1746 HepLorentzVector p4trk1;
1748 p4trk1.setPy(
Py( trk1 ) );
1749 p4trk1.setPz(
Pz( trk1 ) );
1750 p4trk1.setE( sqrt( pow(
P( trk1 ), 2 ) +
mkaon *
mkaon ) );
1751
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 ) );
1757
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 ) );
1763
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 ) );
1769
1770 EvtRecPi0Col::iterator itpi0 = recPi0Col->begin();
1771 const EvtRecTrack* gTrk1 = ( *itpi0 )->hiEnGamma();
1772 const EvtRecTrack* gTrk2 = ( *itpi0 )->loEnGamma();
1773 RecEmcShower* gShr1 = const_cast<EvtRecTrack*>( gTrk1 )->emcShower();
1774 RecEmcShower* gShr2 = const_cast<EvtRecTrack*>( gTrk2 )->emcShower();
1775 RecEmcShower* gShr3 = const_cast<EvtRecTrack*>( gTrk1 )->emcShower();
1776 RecEmcShower* gShr4 = const_cast<EvtRecTrack*>( gTrk2 )->emcShower();
1777
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;
1783
1784 HepLorentzVector p4kstarp = p4trk1 + p4pi0;
1785 HepLorentzVector p4kstarm = p4trk2 + p4pi0;
1786 double mkstarp = p4kstarp.m();
1787 double mkstarm = p4kstarm.m();
1788
1789 if ( ( p4total.m() > 3.0 && p4total.m() < 3.15 ) ||
1790 ( p4total2.m() > 3.0 && p4total2.m() < 3.15 ) )
1791 {
1792
1793
1794
1795
1796
1797 WTrackParameter wvpiTrk1, wvpiTrk2;
1800
1801 WTrackParameter wvkTrk1, wvkTrk2;
1804
1805
1806 WTrackParameter wvpiTrk3, wvpiTrk4;
1809
1810 if ( m_selectPsipRhoPi )
1811 {
1821
1822 bool oksq1 = kmfit->
Fit();
1823 double chi1 = kmfit->
chisq();
1824
1825
1826 if ( oksq1 && chi1 > 0 && chi1 < 100 )
1827 {
1828 m_isPsipRhoPi = true;
1829 m_psipRhoPiNumber++;
1830 }
1831 }
1832 if ( m_selectPsipKstarK )
1833 {
1843
1844 bool oksq2 = kmfit2->
Fit();
1845 double chi2 = kmfit2->
chisq();
1846
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 ) ) )
1850 {
1851 m_isPsipKstarK = true;
1852 m_psipKstarKNumber++;
1853 }
1854 }
1855
1856 }
1857 }
1858
1859 }
1860
1861
1862 if ( m_selectPsipPPPiPi && ( bestmass > 3.075 && bestmass < 3.120 ) && nGood == 6 &&
1863 jpsicharge == 0 && nPi0 == 0 )
1864 {
1865
1870 RecMdcKalTrack* trk1 = ( *itone )->mdcKalTrack();
1871 RecMdcKalTrack* trk2 = ( *ittwo )->mdcKalTrack();
1872 RecMdcKalTrack* trk3 = ( *itthr )->mdcKalTrack();
1873 RecMdcKalTrack* trk4 = ( *itfor )->mdcKalTrack();
1874
1875 HepLorentzVector p4trkpp;
1876 HepLorentzVector p4trkpm;
1877 HepLorentzVector p4trkpip;
1878 HepLorentzVector p4trkpim;
1879
1880
1881
1883 p4trkpp.setPx(
Px( trk1 ) );
1884 p4trkpp.setPy(
Py( trk1 ) );
1885 p4trkpp.setPz(
Pz( trk1 ) );
1887
1889 p4trkpm.setPx(
Px( trk3 ) );
1890 p4trkpm.setPy(
Py( trk3 ) );
1891 p4trkpm.setPz(
Pz( trk3 ) );
1893
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 ) );
1899
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 ) );
1905
1906 double jpsimass1 = ( p4trkpp + p4trkpm + p4trkpip + p4trkpim ).m();
1907
1908
1909
1911 p4trkpp.setPx(
Px( trk1 ) );
1912 p4trkpp.setPy(
Py( trk1 ) );
1913 p4trkpp.setPz(
Pz( trk1 ) );
1915
1917 p4trkpm.setPx(
Px( trk4 ) );
1918 p4trkpm.setPy(
Py( trk4 ) );
1919 p4trkpm.setPz(
Pz( trk4 ) );
1921
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 ) );
1927
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 ) );
1933
1934 double jpsimass2 = ( p4trkpp + p4trkpm + p4trkpip + p4trkpim ).m();
1935
1936
1937
1939 p4trkpp.setPx(
Px( trk2 ) );
1940 p4trkpp.setPy(
Py( trk2 ) );
1941 p4trkpp.setPz(
Pz( trk2 ) );
1943
1945 p4trkpm.setPx(
Px( trk3 ) );
1946 p4trkpm.setPy(
Py( trk3 ) );
1947 p4trkpm.setPz(
Pz( trk3 ) );
1949
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 ) );
1955
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 ) );
1961
1962 double jpsimass3 = ( p4trkpp + p4trkpm + p4trkpip + p4trkpim ).m();
1963
1964
1965
1967 p4trkpp.setPx(
Px( trk2 ) );
1968 p4trkpp.setPy(
Py( trk2 ) );
1969 p4trkpp.setPz(
Pz( trk2 ) );
1971
1973 p4trkpm.setPx(
Px( trk4 ) );
1974 p4trkpm.setPy(
Py( trk4 ) );
1975 p4trkpm.setPz(
Pz( trk4 ) );
1977
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 ) );
1983
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 ) );
1989
1990 double jpsimass4 = ( p4trkpp + p4trkpm + p4trkpip + p4trkpim ).m();
1991
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 )
1994 {
1995
1996
1997 double chi1, chi2, chi3, chi4;
1998 int type = 0;
1999 double chimin = -999;
2000
2001 WTrackParameter wvpiTrk1, wvpiTrk2, wvpiTrk3, wvpiTrk4, wvpiTrk5, wvpiTrk6;
2002
2003 {
2010
2020
2021 bool oksq1 = kmfit->
Fit();
2022 chi1 = kmfit->
chisq();
2023 if ( oksq1 )
2024 {
2025 chimin = chi1;
2026 type = 1;
2027 }
2028 }
2029
2030 {
2037
2047
2048 bool oksq1 = kmfit->
Fit();
2049 chi2 = kmfit->
chisq();
2050 if ( oksq1 )
2051 {
2052 if ( type == 0 )
2053 {
2054 chimin = chi2;
2055 type = 2;
2056 }
2057 else if ( chi2 < chimin )
2058 {
2059 chimin = chi2;
2060 type = 2;
2061 }
2062 }
2063
2064 }
2065
2066 {
2073
2083
2084 bool oksq1 = kmfit->
Fit();
2085 chi3 = kmfit->
chisq();
2086 if ( oksq1 )
2087 {
2088 if ( type == 0 )
2089 {
2090 chimin = chi3;
2091 type = 3;
2092 }
2093 else if ( chi3 < chimin )
2094 {
2095 chimin = chi3;
2096 type = 3;
2097 }
2098 }
2099
2100 }
2101
2102 {
2109
2119
2120 bool oksq1 = kmfit->
Fit();
2121 chi4 = kmfit->
chisq();
2122 if ( oksq1 )
2123 {
2124 if ( type == 0 )
2125 {
2126 chimin = chi4;
2127 type = 4;
2128 }
2129 else if ( chi4 < chimin )
2130 {
2131 chimin = chi4;
2132 type = 4;
2133 }
2134 }
2135 }
2136
2137 if ( chimin > 0 && chimin < 200 )
2138 {
2139 m_isPsipPPPiPi = true;
2140 m_psipPPPiPiNumber++;
2141 }
2142
2143 }
2144
2145 }
2146
2147 }
2148
2149
2150
2151 if ( m_selectPsippCand )
2152 {
2153
2155 if ( !evtRecDTagCol )
2156 {
2157 log << MSG::FATAL << "Could not find EvtRecDTagCol" << endmsg;
2158 return StatusCode::FAILURE;
2159 }
2160 if ( evtRecDTagCol->size() > 0 )
2161 {
2162
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++ )
2166 {
2167
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 ) )
2198 {
2199 m_isPsippCand = true;
2200 m_psippCandNumber++;
2201 break;
2202 }
2203
2204 }
2205
2206 }
2207
2208 }
2209
2210
2211
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();
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250 return StatusCode::SUCCESS;
2251}
double Px(RecMdcKalTrack *trk)
double Pz(RecMdcKalTrack *trk)
double Phi(RecMdcKalTrack *trk)
double P(RecMdcKalTrack *trk)
double Py(RecMdcKalTrack *trk)
HepGeom::Point3D< double > HepPoint3D
EvtRecTrackCol::iterator EvtRecTrackIterator
std::vector< HepLorentzVector > Vp4
double sin(const BesAngle a)
double cos(const BesAngle a)
void readbeamEfromDb(int runNo, double &beamE)
const double theta() const
void setPx(const double px, const int pid)
static void setPidType(PidType pidType)
virtual bool isVertexValid()=0
virtual double * SigmaPrimaryVertex()=0
virtual double * PrimaryVertex()=0
static KinematicFit * instance()
void AddFourMomentum(int number, HepLorentzVector p4)
const HepVector & getZHelix() const
const HepSymMatrix & getZError() const
HepSymMatrix & getZErrorK()
void setStatus(unsigned int status)
void AddTrack(const int number, const double mass, const RecMdcTrack *trk)
_EXTERN_ std::string EvtRecEvent
_EXTERN_ std::string EvtRecDTagCol
_EXTERN_ std::string EvtRecTrackCol