484 {
485
486
487
488 MsgStream log(
msgSvc(), name());
489 log << MSG::INFO << "in execute()" << endreq;
490
491 if( m_writeDst) m_subalg1->execute();
492 if( m_writeRec) m_subalg2->execute();
493
494
495 m_isRadBhabha = false;
496 m_isGGEE = false;
497 m_isGG4Pi = false;
498 m_isRadBhabhaT = false;
499 m_isRhoPi = false;
500 m_isKstarK = false;
501 m_isRecoJpsi = false;
502 m_isPPPiPi = false;
503 m_isBhabha = false;
504 m_isDimu = false;
505 m_isCosmic = false;
506 m_isGenProton = false;
507 m_isPsipRhoPi = false;
508 m_isPsipKstarK = false;
509 m_isPsipPPPiPi = false;
510 m_isPsippCand = false;
511
512 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
513 if(!eventHeader)
514 {
515 cout<<" eventHeader "<<endl;
516 return StatusCode::FAILURE;
517 }
518
519 int run=eventHeader->runNumber();
520 int event=eventHeader->eventNumber();
521
522
523 if(m_run !=run){
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)
530 m_ecm=2*beamE;
531 }
532
533
534
535 if(m_display && m_events%1000==0){
536 cout<< m_events << " -------- run,event: "<<run<<","<<event<<endl;
537 cout<<"m_ecm="<<m_ecm<<endl;
538 }
539 m_events++;
540
542 if(!evtRecEvent ) {
543 cout<<" evtRecEvent "<<endl;
544 return StatusCode::FAILURE;
545 }
546
547 log << MSG::DEBUG <<"ncharg, nneu, tottks = "
548 << evtRecEvent->totalCharged() << " , "
549 << evtRecEvent->totalNeutral() << " , "
550 << evtRecEvent->totalTracks() <<endreq;
552 if(!evtRecTrkCol){
553 cout<<" evtRecTrkCol "<<endl;
554 return StatusCode::FAILURE;
555 }
556
557 if(evtRecEvent->totalTracks()!=evtRecTrkCol->size()) return StatusCode::SUCCESS;
558
559
560
561 SmartDataPtr<EvtRecPi0Col> recPi0Col(eventSvc(), "/Event/EvtRec/EvtRecPi0Col");
562 if ( ! recPi0Col ) {
563 log << MSG::FATAL << "Could not find EvtRecPi0Col" << endreq;
564 return StatusCode::FAILURE;
565 }
566
567
568 int nPi0 = recPi0Col->size();
569 EvtRecPi0Col::iterator itpi0 = recPi0Col->begin();
570 if(nPi0==1){
571 double mpi0 = (*itpi0)->unconMass();
572 if ( fabs(
mpi0 - 0.135 )> 0.015 )
573 nPi0=0;
574 }
575
576
577
578
579
580
581
582
583
584
585
586
588 iGood.clear();
589 vector<int> iCP, iCN;
590 iCP.clear();
591 iCN.clear();
592
594 iCosmicGood.clear();
595
596 int nCharge = 0;
597 int nCosmicCharge =0;
598
599 for(int i = 0;i < evtRecEvent->totalCharged(); i++)
600 {
601
603
604
605
606 if(!(*itTrk)->isMdcKalTrackValid()) continue;
608
609
610
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));
618
619
620 if(m_output) {
621 m_vx0 = vx0;
622 m_vy0 = vy0;
623 m_vz0 = vz0;
624 m_vr0 = vr0;
625 m_theta0 = theta0;
626 m_p0 = p0;
627 m_pt0 = pt0;
628 m_tuple1->write();
629 }
630
631
632
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]);
642 }
646 HepPoint3D IP(xorigin[0],xorigin[1],xorigin[2]);
648 helixip.pivot(IP);
649 HepVector vecipa = helixip.a();
650 double db=fabs(vecipa[0]);
651 double dz=vecipa[3];
652
653
654
655
656 if(fabs(dz) >= m_vz0cut) continue;
657 if(db >= m_vr0cut) continue;
658
659
660 if(p0>m_cosmic_lowp && p0<20){
661 iCosmicGood.push_back((*itTrk)->trackId());
662 nCosmicCharge += mdcTrk->
charge();
663 }
664
665
666
667 if(pt0 >= m_pt0HighCut) continue;
668 if(pt0 <= m_pt0LowCut) continue;
669
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());
676
677
678 }
679 int nGood = iGood.size();
680 int nCosmicGood = iCosmicGood.size();
681
682
684 iGam.clear();
685 for(int i = evtRecEvent->totalCharged(); i< evtRecEvent->totalTracks(); i++) {
686
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;
695 if(time<0 || time>14) continue;
696
697 iGam.push_back((*itTrk)->trackId());
698 }
699 int nGam = iGam.size();
700
701
703 ipip.clear();
704 ipim.clear();
706 ppip.clear();
707 ppim.clear();
708
709
710 double echarge = 0.;
711 double ptot = 0.;
713 double eemc = 0.;
714 double pp = 0.;
715 double pm = 0.;
716 double pmax=0.0;
717 double psec=0.0;
718 double eccmax=0.0;
719 double eccsec=0.0;
720 double phimax=0.0;
721 double phisec=0.0;
722 double eopmax=0.0;
723 double eopsec=0.0;
724 Hep3Vector Pt_charge(0,0,0);
725
726 for(int i = 0; i < nGood; i++) {
728
729 double p3=0;
730
731
732
733 if((*itTrk)->isMdcKalTrackValid()) {
736
738
739
740 double phi=
Phi(mdcTrk);
741
742
743 HepLorentzVector
ptrk;
747 p3 = fabs(
ptrk.mag());
748
749
750
751
752
753
754
755 Hep3Vector ptemp(
Px(mdcTrk),
Py(mdcTrk),0);
756 Pt_charge+=ptemp;
757
758 double ecc=0.0;
759 if((*itTrk)->isEmcShowerValid()) {
762 }
763
764 if( p3 > pmax){
765 psec=pmax;
766 eccsec=eccmax;
767 phisec=phimax;
768 pmax=p3;
769 eccmax=ecc;
770 phimax=phi;
771 }
772 else if( p3 < pmax && p3> psec){
773 psec=p3;
774 eccsec=ecc;
775 phisec=phi;
776 }
777
778
779
780
781
784
785
788
790 ppip.push_back(
ptrk);
792 } else {
793 ppim.push_back(
ptrk);
795 }
796
797 }
798
799 if((*itTrk)->isEmcShowerValid()) {
800
802 double eraw = emcTrk->
energy();
803 double phiemc = emcTrk->
phi();
804 double the = emcTrk->
theta();
805
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));
810 pemc.setE(eraw);
811 pemc = pemc.boost(-0.011,0,0);
812
813
815
816 }
817
818
819
820
821 }
822
823 if(pmax!=0) eopmax=eccmax/pmax;
824 if(psec!=0) eopsec=eccsec/psec;
825
826 eemc=eccmax+eccsec;
827
828
829
830
831
832
833
834
835
836
837
838
840 pGam.clear();
841 double eneu=0;
842 double egmax=0;
843 Hep3Vector Pt_neu(0,0,0);
844
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);
860 eemc += eraw;
861
862 Hep3Vector ptemp(eraw*
sin(the)*
cos(phi), eraw*
sin(the)*
sin(phi),0);
863 Pt_neu+=ptemp;
864
867
868 }
869
870 double esum = echarge + eneu;
871 Hep3Vector Pt=Pt_charge+Pt_neu;
872
873
874 double phid=phimax-phisec;
875 phid = fmod(phid+CLHEP::twopi+CLHEP::twopi+
pi, CLHEP::twopi) - CLHEP::pi;
876
877
878
879
880
881
882 if( nGood == 2 && nCharge==0 && (m_selectBhabha || m_selectDimu) ){
883
884
885 if( m_events%m_bhabha_scale == 0 && m_selectBhabha && echarge/m_ecm>0.8 && eopmax>0.8 && eopsec>0.8){
886 m_isBhabha=true;
887 m_bhabhaNumber++;
888 }
889
890
891
892 if( m_events%m_dimu_scale == 0 && m_selectDimu && eemc/m_ecm<0.3){
893
896
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();
902
903 for(;iter_tof!=tofTrkCol.end();iter_tof++){
905 status->
setStatus( (*iter_tof)->status() );
907 time1=(*iter_tof)->tof();
908 }
909 delete status;
910 }
911 }
912
913 if( (*itp)->isMucTrackValid() ){
915 depth1=mucTrk->
depth();
916 }
917
918 if( (*itn)->isTofTrackValid() ){
919 SmartRefVector<RecTofTrack> tofTrkCol= (*itn)->tofTrack();
920 SmartRefVector<RecTofTrack>::iterator iter_tof=tofTrkCol.begin();
921
922 for(;iter_tof!=tofTrkCol.end();iter_tof++){
924 status->
setStatus( (*iter_tof)->status() );
926 time2=(*iter_tof)->tof();
927 }
928 delete status;
929 }
930 }
931
932 if( (*itn)->isMucTrackValid() ){
934 depth2=mucTrk->
depth();
935 }
936
937
938
939
940
941
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)){
944 m_isDimu=true;
945 m_dimuNumber++;
946 }
947 }
948
949
950
951 }
952
953
954
955 if(m_selectCosmic && nCosmicGood == 2 && eemc/m_ecm<0.3){
956
959
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();
965
966 for(;iter_tof!=tofTrkCol.end();iter_tof++){
968 status->
setStatus( (*iter_tof)->status() );
970 time1=(*iter_tof)->tof();
971 }
972 delete status;
973 }
974 }
975
976 if( (*itp)->isMucTrackValid() ){
978 depth1=mucTrk->
depth();
979 }
980
981 if( (*itn)->isTofTrackValid() ){
982 SmartRefVector<RecTofTrack> tofTrkCol= (*itn)->tofTrack();
983 SmartRefVector<RecTofTrack>::iterator iter_tof=tofTrkCol.begin();
984
985 for(;iter_tof!=tofTrkCol.end();iter_tof++){
987 status->
setStatus( (*iter_tof)->status() );
989 time2=(*iter_tof)->tof();
990 }
991 delete status;
992 }
993 }
994
995 if( (*itn)->isMucTrackValid() ){
997 depth2=mucTrk->
depth();
998 }
999
1000
1001
1002 if( m_selectCosmic && time1!=-99 && time2!=-99 && fabs(time1-time2)>5 ){
1003 m_isCosmic=true;
1004 m_cosmicNumber++;
1005 }
1006
1007
1008 }
1009
1010
1011
1012
1013 if(m_events%m_proton_scale ==0 ){
1014
1015 bool protoncand=false;
1016 for(int i=0; i<nGood; i++){
1017
1021
1022 double pp =
P(mdcTrk);
1023 double chiP=-99;
1024 if((*iter)->isMdcDedxValid()){
1026 chiP=dedxTrk->
chiP();
1027 }
1028
1029 if( fabs(pp)<0.6 && fabs(chiP)<5){
1030 protoncand=true;
1031 break;
1032 }
1033 }
1034
1035 if( protoncand ){
1036 m_isGenProton=true;
1037 m_genProtonNumber++;
1038 }
1039
1040 }
1041
1042
1043
1044
1045
1046 if(m_printmonitor){
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());
1057 }
1058
1059
1060
1061
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 )
1064 {
1065 m_isRadBhabha=true;
1066 m_radBhabhaNumber++;
1067 }
1068
1069 if( m_isRadBhabha )
1070 {
1071
1072 if(nGood==2 && nCharge==0 && eemc/m_ecm>=0.7 && eopmax>=0.85 && eopmax<=1.15 && eopsec>=0.85 && eopsec<=1.15 ){
1073
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++;
1078 }
1079 }
1080 else{
1081 m_isRadBhabhaT=true;
1082 m_radBhabhaTNumber++;
1083 }
1084
1085 }
1086
1087
1088
1089 }
1090
1091
1092
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)
1094 {
1095 m_isGGEE=true;
1096 m_GGEENumber++;
1097 }
1098
1099
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)
1101 {
1102 m_isGG4Pi=true;
1103 m_GG4PiNumber++;
1104 }
1105
1106
1107 if( (m_selectRhoPi || m_selectKstarK) && nGood == 2 && nCharge==0 && nPi0 == 1){
1108
1111
1112
1113 if( (*itone)->isMdcKalTrackValid() && (*ittwo)->isMdcKalTrackValid() ) {
1114
1117
1118 HepLorentzVector p4trk1;
1120 p4trk1.setPy(
Py(trk1));
1121 p4trk1.setPz(
Pz(trk1));
1123
1124 HepLorentzVector p4trk2;
1125 p4trk2.setPx(
Px(trk2));
1126 p4trk2.setPy(
Py(trk2));
1127 p4trk2.setPz(
Pz(trk2));
1129
1130
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) );
1136
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) );
1142
1143
1144
1145 itpi0 = recPi0Col->begin();
1146 HepLorentzVector p4gam1 = (*itpi0)->hiPfit();
1147 HepLorentzVector p4gam2 = (*itpi0)->loPfit();
1148 HepLorentzVector p4pi0 = p4gam1+p4gam2;
1149
1150 HepLorentzVector p4total = p4trk1 + p4trk2 + p4pi0;
1151 HepLorentzVector p4total2 = p4trk3 + p4trk4 + p4pi0;
1152
1153 double rhopimass=p4total2.m();
1154 double kstarkmass=p4total.m();
1155 if( (kstarkmass > 3.0 && kstarkmass < 3.15) || (rhopimass > 3.0 && rhopimass < 3.15) ){
1156
1157
1158
1159
1160 double eop1=0.0,eop2=0.0;
1161 if( (*itone)->isEmcShowerValid() ){
1163 double etrk=emcTrk->
energy();
1164
1166 eop1 = etrk/
P(trk1);
1167
1168 }
1169 }
1170
1171 if( (*ittwo)->isEmcShowerValid() ){
1173 double etrk=emcTrk->
energy();
1174
1176 eop2 = etrk/
P(trk2);
1177
1178 }
1179 }
1180
1181 if(eop1<0.8 && eop2<0.8){
1182
1183 if(rhopimass>3.0 && rhopimass<3.15){
1184
1185
1186 HepLorentzVector
ecms(0.034,0,0,m_ecm);
1187
1188
1192
1197
1205
1206 bool oksq1 = kmfit->
Fit();
1207 double chi1 = kmfit->
chisq();
1208
1209
1210 if(oksq1 && chi1<=60){
1211 m_isRhoPi = true;
1212 m_rhoPiNumber++;
1213 }
1214 }
1215
1216
1217 if(kstarkmass>3.0 && kstarkmass<3.15){
1218
1219
1220 double mkstarp=0, mkstarm=0;
1222 HepLorentzVector p4kstarp = p4trk1 + p4pi0;
1223 HepLorentzVector p4kstarm = p4trk2 + p4pi0;
1224 mkstarp = p4kstarp.m();
1225 mkstarm = p4kstarm.m();
1226 }
1227 else{
1228 HepLorentzVector p4kstarm = p4trk1 + p4pi0;
1229 HepLorentzVector p4kstarp = p4trk2 + p4pi0;
1230 mkstarp = p4kstarp.m();
1231 mkstarm = p4kstarm.m();
1232 }
1233
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 ) ){
1235
1236
1237 HepLorentzVector
ecms(0.034,0,0,m_ecm);
1238
1242
1247
1255
1256 bool oksq1 = kmfit->
Fit();
1257 double chi1 = kmfit->
chisq();
1258
1259
1260 if(oksq1 && chi1<=60){
1261 m_isKstarK = true;
1262 m_kstarKNumber++;
1263 }
1264
1265 }
1266
1267 }
1268
1269 }
1270
1271
1272
1273 }
1274 }
1275
1276
1277
1278 }
1279
1280
1281 if(m_selectPPPiPi && nGood ==4 && nCharge == 0 && nPi0==0){
1282
1291
1292 HepLorentzVector p4trkpp;
1293 HepLorentzVector p4trkpm;
1294 HepLorentzVector p4trkpip;
1295 HepLorentzVector p4trkpim;
1296
1297
1298
1303
1304
1305 p4trkpp.setPx(
Px(trk1));
1306 p4trkpp.setPy(
Py(trk1));
1307 p4trkpp.setPz(
Pz(trk1));
1309
1310 p4trkpm.setPx(
Px(trk3));
1311 p4trkpm.setPy(
Py(trk3));
1312 p4trkpm.setPz(
Pz(trk3));
1314
1315
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) );
1320
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) );
1325
1326 double jpsimass1= (p4trkpp+p4trkpm+p4trkpip+p4trkpim).m();
1327
1328
1329
1330
1335
1336
1337 p4trkpp.setPx(
Px(trk1));
1338 p4trkpp.setPy(
Py(trk1));
1339 p4trkpp.setPz(
Pz(trk1));
1341
1342 p4trkpm.setPx(
Px(trk4));
1343 p4trkpm.setPy(
Py(trk4));
1344 p4trkpm.setPz(
Pz(trk4));
1346
1347
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) );
1352
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) );
1357
1358 double jpsimass2= (p4trkpp+p4trkpm+p4trkpip+p4trkpim).m();
1359
1360
1361
1362
1367
1368
1369 p4trkpp.setPx(
Px(trk2));
1370 p4trkpp.setPy(
Py(trk2));
1371 p4trkpp.setPz(
Pz(trk2));
1373
1374 p4trkpm.setPx(
Px(trk3));
1375 p4trkpm.setPy(
Py(trk3));
1376 p4trkpm.setPz(
Pz(trk3));
1378
1379
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) );
1384
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) );
1389
1390 double jpsimass3= (p4trkpp+p4trkpm+p4trkpip+p4trkpim).m();
1391
1392
1393
1394
1399
1400
1401 p4trkpp.setPx(
Px(trk2));
1402 p4trkpp.setPy(
Py(trk2));
1403 p4trkpp.setPz(
Pz(trk2));
1405
1406 p4trkpm.setPx(
Px(trk4));
1407 p4trkpm.setPy(
Py(trk4));
1408 p4trkpm.setPz(
Pz(trk4));
1410
1411
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) );
1416
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) );
1421
1422 double jpsimass4= (p4trkpp+p4trkpm+p4trkpip+p4trkpim).m();
1423
1424
1425
1426
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){
1429
1430
1431
1432
1433 double chi1, chi2, chi3, chi4;
1434 int type=0;
1435 double chimin=-999;
1436 HepLorentzVector
ecms(0.034,0,0,m_ecm);
1437
1439
1440 {
1445
1446
1454
1455 bool oksq1 = kmfit->
Fit();
1456 chi1 = kmfit->
chisq();
1457 if(oksq1) {
1458 chimin=chi1;
1459 type=1;
1460 }
1461
1462 }
1463
1464
1465 {
1470
1471
1479
1480 bool oksq1 = kmfit->
Fit();
1481 chi2 = kmfit->
chisq();
1482 if(oksq1){
1483 if(type==0){
1484 chimin=chi2;
1485 type=2;
1486 }
1487 else if(chi2<chimin){
1488 chimin=chi2;
1489 type=2;
1490 }
1491 }
1492
1493 }
1494
1495 {
1500
1507
1509
1510 bool oksq1 = kmfit->
Fit();
1511 chi3 = kmfit->
chisq();
1512 if(oksq1){
1513 if(type==0){
1514 chimin=chi3;
1515 type=3;
1516 }
1517 else if(chi3<chimin){
1518 chimin=chi3;
1519 type=3;
1520 }
1521 }
1522
1523
1524 }
1525
1526
1527 {
1532
1539
1541
1542 bool oksq1 = kmfit->
Fit();
1543 chi4 = kmfit->
chisq();
1544
1545 if(oksq1){
1546 if(type==0){
1547 chimin=chi4;
1548 type=4;
1549 }
1550 else if(chi4<chimin){
1551 chimin=chi4;
1552 type=4;
1553 }
1554 }
1555
1556
1557 }
1558
1559 if(type!=0 && chimin<100){
1560 m_isPPPiPi = true;
1561 m_ppPiPiNumber++;
1562 }
1563
1564
1565
1566
1567 }
1568
1569 }
1570
1571
1572
1573 if( (m_selectPsipRhoPi || m_selectPsipKstarK || m_selectPsipPPPiPi) && (nGood==4 || nGood==6) && nCharge==0 ){
1577
1578 double bestmass=1.0;
1579 int pindex,nindex;
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() );
1592
1593 if(fabs(recomass-3.096)< fabs(bestmass-3.096)){
1594 bestmass=recomass;
1595 pindex=ip;
1596 nindex=in;
1597 }
1598 }
1599 }
1600
1601
1602
1603 pione = evtRecTrkCol->begin() + iCP[pindex];
1604 pitwo = evtRecTrkCol->begin() + iCN[nindex];
1605 pitrk1 = (*pione)->mdcKalTrack();
1606 pitrk2 = (*pitwo)->mdcKalTrack();
1607
1608
1609
1610 double jpsicharge=0;
1611 for(int ip=0; ip<iCP.size(); ip++){
1612 if(ip!=pindex){
1613 iJPsiP.push_back(iCP[ip]);
1616 jpsicharge+=trktmp->
charge();
1617 }
1618 }
1619
1620 for(int in=0; in<iCN.size(); in++){
1621 if(in!=nindex){
1622 iJPsiN.push_back(iCN[in]);
1625 jpsicharge+=trktmp->
charge();
1626 }
1627 }
1628
1629
1630 HepLorentzVector
ecms(0.034,0,0,m_ecm);
1631
1632
1633 if( (m_selectPsipRhoPi || m_selectPsipKstarK) && (bestmass>3.075 && bestmass<3.120) && nGood==4 && jpsicharge==0 && nPi0==1){
1634
1637
1638
1639 if( (*itone)->isMdcKalTrackValid() && (*ittwo)->isMdcKalTrackValid() ) {
1640
1643
1644 HepLorentzVector p4trk1;
1646 p4trk1.setPy(
Py(trk1));
1647 p4trk1.setPz(
Pz(trk1));
1649
1650 HepLorentzVector p4trk2;
1651 p4trk2.setPx(
Px(trk2));
1652 p4trk2.setPy(
Py(trk2));
1653 p4trk2.setPz(
Pz(trk2));
1655
1656
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) );
1662
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) );
1668
1669
1670 EvtRecPi0Col::iterator itpi0 = recPi0Col->begin();
1677
1678
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;
1684
1685
1686 HepLorentzVector p4kstarp = p4trk1 + p4pi0;
1687 HepLorentzVector p4kstarm = p4trk2 + p4pi0;
1688 double mkstarp = p4kstarp.m();
1689 double mkstarm = p4kstarm.m();
1690
1691 if( (p4total.m() > 3.0 && p4total.m() < 3.15) || (p4total2.m() > 3.0 && p4total2.m() < 3.15) ){
1692
1693
1694
1695
1696
1697
1698
1702
1706
1707
1711
1712 if(m_selectPsipRhoPi){
1722
1723 bool oksq1 = kmfit->
Fit();
1724 double chi1 = kmfit->
chisq();
1725
1726
1727 if(oksq1 && chi1>0 && chi1<100){
1728 m_isPsipRhoPi = true;
1729 m_psipRhoPiNumber++;
1730 }
1731 }
1732 if(m_selectPsipKstarK){
1742
1743
1744 bool oksq2 = kmfit2->
Fit();
1745 double chi2 = kmfit2->
chisq();
1746
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++;
1752 }
1753
1754 }
1755
1756
1757 }
1758
1759 }
1760
1761 }
1762
1763
1764
1765
1766 if(m_selectPsipPPPiPi && (bestmass>3.075 && bestmass<3.120) && nGood==6 && jpsicharge==0 && nPi0==0){
1767
1768
1777
1778 HepLorentzVector p4trkpp;
1779 HepLorentzVector p4trkpm;
1780 HepLorentzVector p4trkpip;
1781 HepLorentzVector p4trkpim;
1782
1783
1784
1789
1790
1791 p4trkpp.setPx(
Px(trk1));
1792 p4trkpp.setPy(
Py(trk1));
1793 p4trkpp.setPz(
Pz(trk1));
1795
1796 p4trkpm.setPx(
Px(trk3));
1797 p4trkpm.setPy(
Py(trk3));
1798 p4trkpm.setPz(
Pz(trk3));
1800
1801
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) );
1806
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) );
1811
1812 double jpsimass1= (p4trkpp+p4trkpm+p4trkpip+p4trkpim).m();
1813
1814
1815
1816
1821
1822
1823 p4trkpp.setPx(
Px(trk1));
1824 p4trkpp.setPy(
Py(trk1));
1825 p4trkpp.setPz(
Pz(trk1));
1827
1828 p4trkpm.setPx(
Px(trk4));
1829 p4trkpm.setPy(
Py(trk4));
1830 p4trkpm.setPz(
Pz(trk4));
1832
1833
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) );
1838
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) );
1843
1844 double jpsimass2= (p4trkpp+p4trkpm+p4trkpip+p4trkpim).m();
1845
1846
1847
1848
1853
1854
1855 p4trkpp.setPx(
Px(trk2));
1856 p4trkpp.setPy(
Py(trk2));
1857 p4trkpp.setPz(
Pz(trk2));
1859
1860 p4trkpm.setPx(
Px(trk3));
1861 p4trkpm.setPy(
Py(trk3));
1862 p4trkpm.setPz(
Pz(trk3));
1864
1865
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) );
1870
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) );
1875
1876 double jpsimass3= (p4trkpp+p4trkpm+p4trkpip+p4trkpim).m();
1877
1878
1879
1880
1885
1886
1887 p4trkpp.setPx(
Px(trk2));
1888 p4trkpp.setPy(
Py(trk2));
1889 p4trkpp.setPz(
Pz(trk2));
1891
1892 p4trkpm.setPx(
Px(trk4));
1893 p4trkpm.setPy(
Py(trk4));
1894 p4trkpm.setPz(
Pz(trk4));
1896
1897
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) );
1902
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) );
1907
1908 double jpsimass4= (p4trkpp+p4trkpm+p4trkpip+p4trkpim).m();
1909
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){
1912
1913
1914
1915 double chi1, chi2, chi3, chi4;
1916 int type=0;
1917 double chimin=-999;
1918
1919
1920 WTrackParameter wvpiTrk1, wvpiTrk2, wvpiTrk3, wvpiTrk4 , wvpiTrk5, wvpiTrk6 ;
1921
1922 {
1929
1930
1931
1941
1942 bool oksq1 = kmfit->
Fit();
1943 chi1 = kmfit->
chisq();
1944 if(oksq1){
1945 chimin=chi1;
1946 type=1;
1947 }
1948
1949 }
1950
1951
1952 {
1959
1960
1961
1971
1972 bool oksq1 = kmfit->
Fit();
1973 chi2 = kmfit->
chisq();
1974 if(oksq1){
1975 if(type==0){
1976 chimin=chi2;
1977 type=2;
1978 }
1979 else if(chi2<chimin){
1980 chimin=chi2;
1981 type=2;
1982 }
1983
1984 }
1985
1986 }
1987
1988 {
1995
1996
1997
2007
2008 bool oksq1 = kmfit->
Fit();
2009 chi3 = kmfit->
chisq();
2010 if(oksq1){
2011 if(type==0){
2012 chimin=chi3;
2013 type=3;
2014 }
2015 else if(chi3<chimin){
2016 chimin=chi3;
2017 type=3;
2018 }
2019 }
2020
2021 }
2022
2023 {
2030
2031
2041
2042 bool oksq1 = kmfit->
Fit();
2043 chi4 = kmfit->
chisq();
2044 if(oksq1){
2045 if(type==0){
2046 chimin=chi4;
2047 type=4;
2048 }
2049 else if(chi4<chimin){
2050 chimin=chi4;
2051 type=4;
2052 }
2053 }
2054
2055 }
2056
2057
2058 if(chimin>0 && chimin<200){
2059 m_isPsipPPPiPi = true;
2060 m_psipPPPiPiNumber++;
2061 }
2062
2063 }
2064
2065 }
2066
2067
2068
2069
2070 }
2071
2072
2073
2074
2075
2076 if(m_selectPsippCand){
2077
2079 if ( ! evtRecDTagCol ) {
2080 log << MSG::FATAL << "Could not find EvtRecDTagCol" << endreq;
2081 return StatusCode::FAILURE;
2082 }
2083 if(evtRecDTagCol->size()>0){
2084
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++){
2088
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++;
2101 }
2102
2103
2104 }
2105
2106
2107 }
2108
2109 }
2110
2111
2112
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();
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152 return StatusCode::SUCCESS;
2153
2154}
double sin(const BesAngle a)
double cos(const BesAngle a)
double Px(RecMdcKalTrack *trk)
double Pz(RecMdcKalTrack *trk)
double Phi(RecMdcKalTrack *trk)
double P(RecMdcKalTrack *trk)
double Py(RecMdcKalTrack *trk)
EvtRecTrackCol::iterator EvtRecTrackIterator
std::vector< HepLorentzVector > Vp4
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