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;
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
730
731
732
733 if((*itTrk)->isMdcKalTrackValid()) {
736
738
739
740 double phi=
Phi(mdcTrk);
741
742
743 HepLorentzVector
ptrk;
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
765 psec=pmax;
766 eccsec=eccmax;
767 phisec=phimax;
769 eccmax=ecc;
770 phimax=phi;
771 }
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( iCP.size()==1 && iCN.size()==1 && m_events%m_dimu_scale == 0 && m_selectDimu && eemc/m_ecm<0.3){
893
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
944
945
946
947
948
949
950 double time1=-99,depth1=-99;
951 double time2=-99,depth2=-99;
952 double p1=-99,
p2=-99;
953 double emc1=0, emc2=0;
954 if( (*itp)->isTofTrackValid() ){
955 SmartRefVector<RecTofTrack> tofTrkCol= (*itp)->tofTrack();
956 SmartRefVector<RecTofTrack>::iterator iter_tof=tofTrkCol.begin();
957
958 for(;iter_tof!=tofTrkCol.end();iter_tof++){
960 status->
setStatus( (*iter_tof)->status() );
962 time1=(*iter_tof)->tof();
963 }
964 delete status;
965 }
966 }
967
968 if( (*itp)->isMucTrackValid() ){
970 depth1=mucTrk->
depth();
971 }
972
973
974 if((*itp)->isMdcKalTrackValid()) {
978 }
979
980 if((*itp)->isEmcShowerValid()) {
983 }
984
985 if( (*itn)->isTofTrackValid() ){
986 SmartRefVector<RecTofTrack> tofTrkCol= (*itn)->tofTrack();
987 SmartRefVector<RecTofTrack>::iterator iter_tof=tofTrkCol.begin();
988
989 for(;iter_tof!=tofTrkCol.end();iter_tof++){
991 status->
setStatus( (*iter_tof)->status() );
993 time2=(*iter_tof)->tof();
994 }
995 delete status;
996 }
997 }
998
999 if( (*itn)->isMucTrackValid() ){
1001 depth2=mucTrk->
depth();
1002 }
1003
1004 if((*itn)->isMdcKalTrackValid()) {
1008 }
1009
1010
1011 if((*itn)->isEmcShowerValid()) {
1014 }
1015
1016 double ebeam=m_ecm/2.0;
1018 && (emc1/
p1<0.4 || emc2/
p2<0.4) && (depth1>3 || depth2>3) &&
1019 emc1>0.15 && emc1<0.3 && emc2>0.15 && emc2<0.3 && emc1/
p1<0.8 && emc2/
p2<0.8 &&
1020 ((depth1>80*
p1-60 || depth1>40) || (depth2>80*
p2-60 || depth2>40)) ){
1021 m_isDimu=true;
1022 m_dimuNumber++;
1023 }
1024
1025 }
1026
1027
1028
1029 }
1030
1031
1032
1033 if(m_selectCosmic && nCosmicGood == 2 && eemc/m_ecm<0.3){
1034
1037
1038 double time1=-99,depth1=-99;
1039 double time2=-99,depth2=-99;
1040 if( (*itp)->isTofTrackValid() ){
1041 SmartRefVector<RecTofTrack> tofTrkCol= (*itp)->tofTrack();
1042 SmartRefVector<RecTofTrack>::iterator iter_tof=tofTrkCol.begin();
1043
1044 for(;iter_tof!=tofTrkCol.end();iter_tof++){
1046 status->
setStatus( (*iter_tof)->status() );
1048 time1=(*iter_tof)->tof();
1049 }
1050 delete status;
1051 }
1052 }
1053
1054 if( (*itp)->isMucTrackValid() ){
1056 depth1=mucTrk->
depth();
1057 }
1058
1059 if( (*itn)->isTofTrackValid() ){
1060 SmartRefVector<RecTofTrack> tofTrkCol= (*itn)->tofTrack();
1061 SmartRefVector<RecTofTrack>::iterator iter_tof=tofTrkCol.begin();
1062
1063 for(;iter_tof!=tofTrkCol.end();iter_tof++){
1065 status->
setStatus( (*iter_tof)->status() );
1067 time2=(*iter_tof)->tof();
1068 }
1069 delete status;
1070 }
1071 }
1072
1073 if( (*itn)->isMucTrackValid() ){
1075 depth2=mucTrk->
depth();
1076 }
1077
1078
1079
1080 if( m_selectCosmic && time1!=-99 && time2!=-99 && fabs(time1-time2)>5 ){
1081 m_isCosmic=true;
1082 m_cosmicNumber++;
1083 }
1084
1085
1086 }
1087
1088
1089
1090
1091 if(m_events%m_proton_scale ==0 ){
1092
1093 bool protoncand=false;
1094 int ncharge=0;
1095 int nproton=0;
1096 for(int i=0; i<nGood; i++){
1097
1101
1102 double pp =
P(mdcTrk);
1103 double dedx=-99;
1104 double chiP=-99;
1105
1106 if((*iter)->isMdcDedxValid()){
1109 chiP=dedxTrk->
chiP();
1110 }
1111
1112 if( fabs(pp)<0.6 && dedx>1.2 && fabs(chiP)<6){
1113 ncharge+=mdcTrk->
charge();
1114 nproton++;
1115
1116
1117 }
1118 }
1119 if( (nproton==1 && ncharge==-1) || (nproton>=2 && ncharge<=nproton-2))
1120 protoncand=true;
1121 if( protoncand ){
1122 m_isGenProton=true;
1123 m_genProtonNumber++;
1124 }
1125
1126 }
1127
1128
1129
1130
1131
1132 if(m_printmonitor){
1133 h_nGood->fill(nGood);
1134 h_nCharge->fill(nCharge);
1135 h_pmaxobeam->fill(pmax/(m_ecm/2.0));
1136 h_eopmax->fill(eopmax);
1137 h_eopsec->fill(eopsec);
1138 h_deltap->fill(pmax-psec);
1139 h_esumoecm->fill(esum/m_ecm);
1140 h_egmax->fill(egmax);
1141 h_deltaphi->fill(phid);
1142 h_Pt->fill(Pt.mag());
1143 }
1144
1145
1146
1147
1148 if(nGood>1 && pmax/(m_ecm/2.0)>0.4 && eopmax>0.5 && esum/m_ecm>0.75 &&
1149 egmax>0.08 && fabs( fabs(phid)-CLHEP::pi)*180.0/CLHEP::pi>2.86 )
1150 {
1151 m_isRadBhabha=true;
1152 m_radBhabhaNumber++;
1153 }
1154
1155 if( m_isRadBhabha )
1156 {
1157
1158 if(nGood==2 && nCharge==0 && eemc/m_ecm>=0.7 && eopmax>=0.85 && eopmax<=1.15 && eopsec>=0.85 && eopsec<=1.15 ){
1159
1160 if( fabs(fabs(pmax)-m_ecm/2.0)<0.1 && fabs(fabs(psec)-m_ecm/2.0)<0.1 ){
1161 if(m_events%1000==0){
1162 m_isRadBhabhaT=true;
1163 m_radBhabhaTNumber++;
1164 }
1165 }
1166 else{
1167 m_isRadBhabhaT=true;
1168 m_radBhabhaTNumber++;
1169 }
1170
1171 }
1172
1173
1174
1175 }
1176
1177
1178
1179 if(!m_isRadBhabhaT && nGood==2 && nCharge==0 && eopmax>=0.85 && eopmax<=1.15 && eopsec>=0.85 && eopsec<=1.15 && eemc/m_ecm<=0.8 && Pt.mag()<=0.2)
1180 {
1181 m_isGGEE=true;
1182 m_GGEENumber++;
1183 }
1184
1185
1186 if(m_selectGG4Pi && nGood==4 && nCharge==0 && pmax/(m_ecm/2.0)>0.04 && pmax/(m_ecm/2.0)<0.9 && esum/m_ecm>0.04 && esum/m_ecm<0.75 && Pt.mag()<=0.2)
1187 {
1188 m_isGG4Pi=true;
1189 m_GG4PiNumber++;
1190 }
1191
1192
1193 if( (m_selectRhoPi || m_selectKstarK) && nGood == 2 && nCharge==0 && nPi0 == 1){
1194
1197
1198
1199 if( (*itone)->isMdcKalTrackValid() && (*ittwo)->isMdcKalTrackValid() ) {
1200
1203
1204 HepLorentzVector p4trk1;
1205 p4trk1.setPx(
Px(trk1));
1206 p4trk1.setPy(
Py(trk1));
1207 p4trk1.setPz(
Pz(trk1));
1209
1210 HepLorentzVector p4trk2;
1211 p4trk2.setPx(
Px(trk2));
1212 p4trk2.setPy(
Py(trk2));
1213 p4trk2.setPz(
Pz(trk2));
1215
1216
1217 HepLorentzVector p4trk3;
1218 p4trk3.setPx(
Px(trk1));
1219 p4trk3.setPy(
Py(trk1));
1220 p4trk3.setPz(
Pz(trk1));
1221 p4trk3.setE(sqrt( pow(
P(trk1),2)+
mpi*
mpi) );
1222
1223 HepLorentzVector p4trk4;
1224 p4trk4.setPx(
Px(trk2));
1225 p4trk4.setPy(
Py(trk2));
1226 p4trk4.setPz(
Pz(trk2));
1227 p4trk4.setE(sqrt( pow(
P(trk2),2)+
mpi*
mpi) );
1228
1229
1230
1231 itpi0 = recPi0Col->begin();
1232 HepLorentzVector p4gam1 = (*itpi0)->hiPfit();
1233 HepLorentzVector p4gam2 = (*itpi0)->loPfit();
1234 HepLorentzVector p4pi0 = p4gam1+p4gam2;
1235
1236 HepLorentzVector p4total = p4trk1 + p4trk2 + p4pi0;
1237 HepLorentzVector p4total2 = p4trk3 + p4trk4 + p4pi0;
1238
1239 double rhopimass=p4total2.m();
1240 double kstarkmass=p4total.m();
1241 if( (kstarkmass > 3.0 && kstarkmass < 3.15) || (rhopimass > 3.0 && rhopimass < 3.15) ){
1242
1243
1244
1245
1246 double eop1=0.0,eop2=0.0;
1247 if( (*itone)->isEmcShowerValid() ){
1249 double etrk=emcTrk->
energy();
1250
1252 eop1 = etrk/
P(trk1);
1253
1254 }
1255 }
1256
1257 if( (*ittwo)->isEmcShowerValid() ){
1259 double etrk=emcTrk->
energy();
1260
1262 eop2 = etrk/
P(trk2);
1263
1264 }
1265 }
1266
1267 if(eop1<0.8 && eop2<0.8){
1268
1269 if(rhopimass>3.0 && rhopimass<3.15){
1270
1271
1272 HepLorentzVector
ecms(0.034,0,0,m_ecm);
1273
1274
1278
1283
1291
1292 bool oksq1 = kmfit->
Fit();
1293 double chi1 = kmfit->
chisq();
1294
1295
1296 if(oksq1 && chi1<=60){
1297 m_isRhoPi = true;
1298 m_rhoPiNumber++;
1299 }
1300 }
1301
1302
1303 if(kstarkmass>3.0 && kstarkmass<3.15){
1304
1305
1306 double mkstarp=0, mkstarm=0;
1308 HepLorentzVector p4kstarp = p4trk1 + p4pi0;
1309 HepLorentzVector p4kstarm = p4trk2 + p4pi0;
1310 mkstarp = p4kstarp.m();
1311 mkstarm = p4kstarm.m();
1312 }
1313 else{
1314 HepLorentzVector p4kstarm = p4trk1 + p4pi0;
1315 HepLorentzVector p4kstarp = p4trk2 + p4pi0;
1316 mkstarp = p4kstarp.m();
1317 mkstarm = p4kstarm.m();
1318 }
1319
1320 if ( (fabs(mkstarp-0.89166)<0.1 && fabs(mkstarm-0.89166)>0.1) || (fabs(mkstarm-0.89166)<0.1 && fabs(mkstarp-0.89166)>0.1 ) ){
1321
1322
1323 HepLorentzVector
ecms(0.034,0,0,m_ecm);
1324
1328
1333
1341
1342 bool oksq1 = kmfit->
Fit();
1343 double chi1 = kmfit->
chisq();
1344
1345
1346 if(oksq1 && chi1<=60){
1347 m_isKstarK = true;
1348 m_kstarKNumber++;
1349 }
1350
1351 }
1352
1353 }
1354
1355 }
1356
1357
1358
1359 }
1360 }
1361
1362
1363
1364 }
1365
1366
1367 if(m_selectPPPiPi && nGood ==4 && nCharge == 0 && nPi0==0){
1368
1377
1378 HepLorentzVector p4trkpp;
1379 HepLorentzVector p4trkpm;
1380 HepLorentzVector p4trkpip;
1381 HepLorentzVector p4trkpim;
1382
1383
1384
1386 p4trkpp.setPx(
Px(trk1));
1387 p4trkpp.setPy(
Py(trk1));
1388 p4trkpp.setPz(
Pz(trk1));
1390
1392 p4trkpm.setPx(
Px(trk3));
1393 p4trkpm.setPy(
Py(trk3));
1394 p4trkpm.setPz(
Pz(trk3));
1396
1398 p4trkpip.setPx(
Px(trk2));
1399 p4trkpip.setPy(
Py(trk2));
1400 p4trkpip.setPz(
Pz(trk2));
1401 p4trkpip.setE(sqrt( pow(
P(trk2),2)+
mpi*
mpi) );
1402
1404 p4trkpim.setPx(
Px(trk4));
1405 p4trkpim.setPy(
Py(trk4));
1406 p4trkpim.setPz(
Pz(trk4));
1407 p4trkpim.setE(sqrt( pow(
P(trk4),2)+
mpi*
mpi) );
1408
1409 double jpsimass1= (p4trkpp+p4trkpm+p4trkpip+p4trkpim).m();
1410
1411
1412
1413
1415 p4trkpp.setPx(
Px(trk1));
1416 p4trkpp.setPy(
Py(trk1));
1417 p4trkpp.setPz(
Pz(trk1));
1419
1421 p4trkpm.setPx(
Px(trk4));
1422 p4trkpm.setPy(
Py(trk4));
1423 p4trkpm.setPz(
Pz(trk4));
1425
1427 p4trkpip.setPx(
Px(trk2));
1428 p4trkpip.setPy(
Py(trk2));
1429 p4trkpip.setPz(
Pz(trk2));
1430 p4trkpip.setE(sqrt( pow(
P(trk2),2)+
mpi*
mpi) );
1431
1433 p4trkpim.setPx(
Px(trk3));
1434 p4trkpim.setPy(
Py(trk3));
1435 p4trkpim.setPz(
Pz(trk3));
1436 p4trkpim.setE(sqrt( pow(
P(trk3),2)+
mpi*
mpi) );
1437
1438 double jpsimass2= (p4trkpp+p4trkpm+p4trkpip+p4trkpim).m();
1439
1440
1441
1442
1443
1445 p4trkpp.setPx(
Px(trk2));
1446 p4trkpp.setPy(
Py(trk2));
1447 p4trkpp.setPz(
Pz(trk2));
1449
1451 p4trkpm.setPx(
Px(trk3));
1452 p4trkpm.setPy(
Py(trk3));
1453 p4trkpm.setPz(
Pz(trk3));
1455
1457 p4trkpip.setPx(
Px(trk1));
1458 p4trkpip.setPy(
Py(trk1));
1459 p4trkpip.setPz(
Pz(trk1));
1460 p4trkpip.setE(sqrt( pow(
P(trk1),2)+
mpi*
mpi) );
1461
1463 p4trkpim.setPx(
Px(trk4));
1464 p4trkpim.setPy(
Py(trk4));
1465 p4trkpim.setPz(
Pz(trk4));
1466 p4trkpim.setE(sqrt( pow(
P(trk4),2)+
mpi*
mpi) );
1467
1468 double jpsimass3= (p4trkpp+p4trkpm+p4trkpip+p4trkpim).m();
1469
1470
1471
1472
1473
1475 p4trkpp.setPx(
Px(trk2));
1476 p4trkpp.setPy(
Py(trk2));
1477 p4trkpp.setPz(
Pz(trk2));
1479
1481 p4trkpm.setPx(
Px(trk4));
1482 p4trkpm.setPy(
Py(trk4));
1483 p4trkpm.setPz(
Pz(trk4));
1485
1487 p4trkpip.setPx(
Px(trk1));
1488 p4trkpip.setPy(
Py(trk1));
1489 p4trkpip.setPz(
Pz(trk1));
1490 p4trkpip.setE(sqrt( pow(
P(trk1),2)+
mpi*
mpi) );
1491
1493 p4trkpim.setPx(
Px(trk3));
1494 p4trkpim.setPy(
Py(trk3));
1495 p4trkpim.setPz(
Pz(trk3));
1496 p4trkpim.setE(sqrt( pow(
P(trk3),2)+
mpi*
mpi) );
1497
1498 double jpsimass4= (p4trkpp+p4trkpm+p4trkpip+p4trkpim).m();
1499
1500
1501
1502
1503 if( fabs(jpsimass1-3.075)<=0.075 || fabs(jpsimass2-3.075)<=0.075 ||
1504 fabs(jpsimass3-3.075)<=0.075 || fabs(jpsimass4-3.075)<=0.075){
1505
1506
1507
1508
1509 double chi1, chi2, chi3, chi4;
1510 int type=0;
1511 double chimin=-999;
1512 HepLorentzVector
ecms(0.034,0,0,m_ecm);
1513
1515
1516 {
1521
1522
1530
1531 bool oksq1 = kmfit->
Fit();
1532 chi1 = kmfit->
chisq();
1533 if(oksq1) {
1534 chimin=chi1;
1535 type=1;
1536 }
1537
1538 }
1539
1540
1541 {
1546
1547
1555
1556 bool oksq1 = kmfit->
Fit();
1557 chi2 = kmfit->
chisq();
1558 if(oksq1){
1559 if(type==0){
1560 chimin=chi2;
1561 type=2;
1562 }
1563 else if(chi2<chimin){
1564 chimin=chi2;
1565 type=2;
1566 }
1567 }
1568
1569 }
1570
1571 {
1576
1583
1585
1586 bool oksq1 = kmfit->
Fit();
1587 chi3 = kmfit->
chisq();
1588 if(oksq1){
1589 if(type==0){
1590 chimin=chi3;
1591 type=3;
1592 }
1593 else if(chi3<chimin){
1594 chimin=chi3;
1595 type=3;
1596 }
1597 }
1598
1599
1600 }
1601
1602
1603 {
1608
1615
1617
1618 bool oksq1 = kmfit->
Fit();
1619 chi4 = kmfit->
chisq();
1620
1621 if(oksq1){
1622 if(type==0){
1623 chimin=chi4;
1624 type=4;
1625 }
1626 else if(chi4<chimin){
1627 chimin=chi4;
1628 type=4;
1629 }
1630 }
1631
1632
1633 }
1634
1635 if(type!=0 && chimin<100){
1636 m_isPPPiPi = true;
1637 m_ppPiPiNumber++;
1638 }
1639
1640
1641
1642
1643 }
1644
1645 }
1646
1647
1648
1649 if( (m_selectPsipRhoPi || m_selectPsipKstarK || m_selectPsipPPPiPi) && (nGood==4 || nGood==6) && nCharge==0 ){
1653
1654 double bestmass=1.0;
1655 int pindex,nindex;
1656 vector<int> iJPsiP,iJPsiN;
1657 for(int ip=0; ip<iCP.size(); ip++){
1658 for(int in=0; in<iCN.size();in++){
1659 pione = evtRecTrkCol->begin() + iCP[ip];
1660 pitwo = evtRecTrkCol->begin() + iCN[in];
1661 pitrk1 = (*pione)->mdcKalTrack();
1662 pitrk2 = (*pitwo)->mdcKalTrack();
1663 Hep3Vector
p1(
Px(pitrk1),
Py(pitrk1),
Pz(pitrk1));
1664 Hep3Vector
p2(
Px(pitrk2),
Py(pitrk2),
Pz(pitrk2));
1665 double E1=sqrt( pow(
P(pitrk1),2)+
mpi*
mpi);
1666 double E2=sqrt( pow(
P(pitrk2),2)+
mpi*
mpi);
1667 double recomass = sqrt(pow(3.686-E1-E2,2)- (-(
p1+
p2)).mag2() );
1668
1669 if(fabs(recomass-3.096)< fabs(bestmass-3.096)){
1670 bestmass=recomass;
1671 pindex=ip;
1672 nindex=in;
1673 }
1674 }
1675 }
1676
1677
1678
1679 pione = evtRecTrkCol->begin() + iCP[pindex];
1680 pitwo = evtRecTrkCol->begin() + iCN[nindex];
1681 pitrk1 = (*pione)->mdcKalTrack();
1682 pitrk2 = (*pitwo)->mdcKalTrack();
1683
1684
1685
1686 double jpsicharge=0;
1687 for(int ip=0; ip<iCP.size(); ip++){
1688 if(ip!=pindex){
1689 iJPsiP.push_back(iCP[ip]);
1692 jpsicharge+=trktmp->
charge();
1693 }
1694 }
1695
1696 for(int in=0; in<iCN.size(); in++){
1697 if(in!=nindex){
1698 iJPsiN.push_back(iCN[in]);
1701 jpsicharge+=trktmp->
charge();
1702 }
1703 }
1704
1705
1706 HepLorentzVector
ecms(0.034,0,0,m_ecm);
1707
1708
1709 if( (m_selectPsipRhoPi || m_selectPsipKstarK) && (bestmass>3.075 && bestmass<3.120) && nGood==4 && jpsicharge==0 && nPi0==1){
1710
1713
1714
1715 if( (*itone)->isMdcKalTrackValid() && (*ittwo)->isMdcKalTrackValid() ) {
1716
1719
1720 HepLorentzVector p4trk1;
1721 p4trk1.setPx(
Px(trk1));
1722 p4trk1.setPy(
Py(trk1));
1723 p4trk1.setPz(
Pz(trk1));
1725
1726 HepLorentzVector p4trk2;
1727 p4trk2.setPx(
Px(trk2));
1728 p4trk2.setPy(
Py(trk2));
1729 p4trk2.setPz(
Pz(trk2));
1731
1732
1733 HepLorentzVector p4trk3;
1734 p4trk3.setPx(
Px(trk1));
1735 p4trk3.setPy(
Py(trk1));
1736 p4trk3.setPz(
Pz(trk1));
1737 p4trk3.setE(sqrt( pow(
P(trk1),2)+
mpi*
mpi) );
1738
1739 HepLorentzVector p4trk4;
1740 p4trk4.setPx(
Px(trk2));
1741 p4trk4.setPy(
Py(trk2));
1742 p4trk4.setPz(
Pz(trk2));
1743 p4trk4.setE(sqrt( pow(
P(trk2),2)+
mpi*
mpi) );
1744
1745
1746 EvtRecPi0Col::iterator itpi0 = recPi0Col->begin();
1753
1754
1755 HepLorentzVector p4gam1 = (*itpi0)->hiPfit();
1756 HepLorentzVector p4gam2 = (*itpi0)->loPfit();
1757 HepLorentzVector p4pi0 = p4gam1 + p4gam2;
1758 HepLorentzVector p4total = p4trk1 + p4trk2 + p4pi0;
1759 HepLorentzVector p4total2 = p4trk3 + p4trk4 + p4pi0;
1760
1761
1762 HepLorentzVector p4kstarp = p4trk1 + p4pi0;
1763 HepLorentzVector p4kstarm = p4trk2 + p4pi0;
1764 double mkstarp = p4kstarp.m();
1765 double mkstarm = p4kstarm.m();
1766
1767 if( (p4total.m() > 3.0 && p4total.m() < 3.15) || (p4total2.m() > 3.0 && p4total2.m() < 3.15) ){
1768
1769
1770
1771
1772
1773
1774
1778
1782
1783
1787
1788 if(m_selectPsipRhoPi){
1798
1799 bool oksq1 = kmfit->
Fit();
1800 double chi1 = kmfit->
chisq();
1801
1802
1803 if(oksq1 && chi1>0 && chi1<100){
1804 m_isPsipRhoPi = true;
1805 m_psipRhoPiNumber++;
1806 }
1807 }
1808 if(m_selectPsipKstarK){
1818
1819
1820 bool oksq2 = kmfit2->
Fit();
1821 double chi2 = kmfit2->
chisq();
1822
1823 if(oksq2 && chi2>0 && chi2<200 &&
1824 ( (fabs(mkstarp-0.89166)<0.1 && fabs(mkstarm-0.89166)>0.1)
1825 || (fabs(mkstarm-0.89166)<0.1 && fabs(mkstarp-0.89166)>0.1 ) )){
1826 m_isPsipKstarK = true;
1827 m_psipKstarKNumber++;
1828 }
1829
1830 }
1831
1832
1833 }
1834
1835 }
1836
1837 }
1838
1839
1840
1841
1842 if(m_selectPsipPPPiPi && (bestmass>3.075 && bestmass<3.120) && nGood==6 && jpsicharge==0 && nPi0==0){
1843
1844
1853
1854 HepLorentzVector p4trkpp;
1855 HepLorentzVector p4trkpm;
1856 HepLorentzVector p4trkpip;
1857 HepLorentzVector p4trkpim;
1858
1859
1860
1862 p4trkpp.setPx(
Px(trk1));
1863 p4trkpp.setPy(
Py(trk1));
1864 p4trkpp.setPz(
Pz(trk1));
1866
1868 p4trkpm.setPx(
Px(trk3));
1869 p4trkpm.setPy(
Py(trk3));
1870 p4trkpm.setPz(
Pz(trk3));
1872
1873
1875 p4trkpip.setPx(
Px(trk2));
1876 p4trkpip.setPy(
Py(trk2));
1877 p4trkpip.setPz(
Pz(trk2));
1878 p4trkpip.setE(sqrt( pow(
P(trk2),2)+
mpi*
mpi) );
1879
1881 p4trkpim.setPx(
Px(trk4));
1882 p4trkpim.setPy(
Py(trk4));
1883 p4trkpim.setPz(
Pz(trk4));
1884 p4trkpim.setE(sqrt( pow(
P(trk4),2)+
mpi*
mpi) );
1885
1886 double jpsimass1= (p4trkpp+p4trkpm+p4trkpip+p4trkpim).m();
1887
1888
1889
1890
1892 p4trkpp.setPx(
Px(trk1));
1893 p4trkpp.setPy(
Py(trk1));
1894 p4trkpp.setPz(
Pz(trk1));
1896
1898 p4trkpm.setPx(
Px(trk4));
1899 p4trkpm.setPy(
Py(trk4));
1900 p4trkpm.setPz(
Pz(trk4));
1902
1904 p4trkpip.setPx(
Px(trk2));
1905 p4trkpip.setPy(
Py(trk2));
1906 p4trkpip.setPz(
Pz(trk2));
1907 p4trkpip.setE(sqrt( pow(
P(trk2),2)+
mpi*
mpi) );
1908
1910 p4trkpim.setPx(
Px(trk3));
1911 p4trkpim.setPy(
Py(trk3));
1912 p4trkpim.setPz(
Pz(trk3));
1913 p4trkpim.setE(sqrt( pow(
P(trk3),2)+
mpi*
mpi) );
1914
1915 double jpsimass2= (p4trkpp+p4trkpm+p4trkpip+p4trkpim).m();
1916
1917
1918
1919
1920
1922 p4trkpp.setPx(
Px(trk2));
1923 p4trkpp.setPy(
Py(trk2));
1924 p4trkpp.setPz(
Pz(trk2));
1926
1928 p4trkpm.setPx(
Px(trk3));
1929 p4trkpm.setPy(
Py(trk3));
1930 p4trkpm.setPz(
Pz(trk3));
1932
1934 p4trkpip.setPx(
Px(trk1));
1935 p4trkpip.setPy(
Py(trk1));
1936 p4trkpip.setPz(
Pz(trk1));
1937 p4trkpip.setE(sqrt( pow(
P(trk1),2)+
mpi*
mpi) );
1938
1940 p4trkpim.setPx(
Px(trk4));
1941 p4trkpim.setPy(
Py(trk4));
1942 p4trkpim.setPz(
Pz(trk4));
1943 p4trkpim.setE(sqrt( pow(
P(trk4),2)+
mpi*
mpi) );
1944
1945 double jpsimass3= (p4trkpp+p4trkpm+p4trkpip+p4trkpim).m();
1946
1947
1948
1949
1950
1952 p4trkpp.setPx(
Px(trk2));
1953 p4trkpp.setPy(
Py(trk2));
1954 p4trkpp.setPz(
Pz(trk2));
1956
1958 p4trkpm.setPx(
Px(trk4));
1959 p4trkpm.setPy(
Py(trk4));
1960 p4trkpm.setPz(
Pz(trk4));
1962
1964 p4trkpip.setPx(
Px(trk1));
1965 p4trkpip.setPy(
Py(trk1));
1966 p4trkpip.setPz(
Pz(trk1));
1967 p4trkpip.setE(sqrt( pow(
P(trk1),2)+
mpi*
mpi) );
1968
1970 p4trkpim.setPx(
Px(trk3));
1971 p4trkpim.setPy(
Py(trk3));
1972 p4trkpim.setPz(
Pz(trk3));
1973 p4trkpim.setE(sqrt( pow(
P(trk3),2)+
mpi*
mpi) );
1974
1975 double jpsimass4= (p4trkpp+p4trkpm+p4trkpip+p4trkpim).m();
1976
1977 if( fabs(jpsimass1-3.075)<=0.075 || fabs(jpsimass2-3.075)<=0.075 ||
1978 fabs(jpsimass3-3.075)<=0.075 || fabs(jpsimass4-3.075)<=0.075){
1979
1980
1981
1982 double chi1, chi2, chi3, chi4;
1983 int type=0;
1984 double chimin=-999;
1985
1986
1987 WTrackParameter wvpiTrk1, wvpiTrk2, wvpiTrk3, wvpiTrk4 , wvpiTrk5, wvpiTrk6 ;
1988
1989 {
1996
1997
1998
2008
2009 bool oksq1 = kmfit->
Fit();
2010 chi1 = kmfit->
chisq();
2011 if(oksq1){
2012 chimin=chi1;
2013 type=1;
2014 }
2015
2016 }
2017
2018
2019 {
2026
2027
2028
2038
2039 bool oksq1 = kmfit->
Fit();
2040 chi2 = kmfit->
chisq();
2041 if(oksq1){
2042 if(type==0){
2043 chimin=chi2;
2044 type=2;
2045 }
2046 else if(chi2<chimin){
2047 chimin=chi2;
2048 type=2;
2049 }
2050
2051 }
2052
2053 }
2054
2055 {
2062
2063
2064
2074
2075 bool oksq1 = kmfit->
Fit();
2076 chi3 = kmfit->
chisq();
2077 if(oksq1){
2078 if(type==0){
2079 chimin=chi3;
2080 type=3;
2081 }
2082 else if(chi3<chimin){
2083 chimin=chi3;
2084 type=3;
2085 }
2086 }
2087
2088 }
2089
2090 {
2097
2098
2108
2109 bool oksq1 = kmfit->
Fit();
2110 chi4 = kmfit->
chisq();
2111 if(oksq1){
2112 if(type==0){
2113 chimin=chi4;
2114 type=4;
2115 }
2116 else if(chi4<chimin){
2117 chimin=chi4;
2118 type=4;
2119 }
2120 }
2121
2122 }
2123
2124
2125 if(chimin>0 && chimin<200){
2126 m_isPsipPPPiPi = true;
2127 m_psipPPPiPiNumber++;
2128 }
2129
2130 }
2131
2132 }
2133
2134
2135
2136
2137 }
2138
2139
2140
2141
2142
2143 if(m_selectPsippCand){
2144
2146 if ( ! evtRecDTagCol ) {
2147 log << MSG::FATAL << "Could not find EvtRecDTagCol" << endreq;
2148 return StatusCode::FAILURE;
2149 }
2150 if(evtRecDTagCol->size()>0){
2151
2152 EvtRecDTagCol::iterator m_iterbegin=evtRecDTagCol->begin();
2153 EvtRecDTagCol::iterator m_iterend=evtRecDTagCol->end();
2154 for(EvtRecDTagCol::iterator
iter=m_iterbegin;
iter != m_iterend;
iter++){
2155
2156 if( ((*iter)->decayMode()==
EvtRecDTag::kD0toKPiPi0 && fabs((*iter)->mBC()-1.865)<0.006 && (*iter)->deltaE()>-0.05 && (*iter)->deltaE()<0.03) ||
2157 ((*iter)->decayMode()==
EvtRecDTag::kD0toKPiPi0Pi0 && fabs((*iter)->mBC()-1.865)<0.006 && (*iter)->deltaE()>-0.05 && (*iter)->deltaE()<0.03) ||
2158 ((*iter)->decayMode()==
EvtRecDTag::kD0toKPiPiPi && fabs((*iter)->mBC()-1.865)<0.006 && (*iter)->deltaE()>-0.03 && (*iter)->deltaE()<0.03) ||
2159 ((*iter)->decayMode()==
EvtRecDTag::kD0toKPiPiPiPi0 && fabs((*iter)->mBC()-1.865)<0.006 && (*iter)->deltaE()>-0.05 && (*iter)->deltaE()<0.03) ||
2160 ((*iter)->decayMode()==
EvtRecDTag::kD0toKsPiPi && fabs((*iter)->mBC()-1.865)<0.006 && (*iter)->deltaE()>-0.03 && (*iter)->deltaE()<0.03) ||
2161 ((*iter)->decayMode()==
EvtRecDTag::kD0toKsPiPiPi0 && fabs((*iter)->mBC()-1.865)<0.006 && (*iter)->deltaE()>-0.05 && (*iter)->deltaE()<0.03)||
2162 ((*iter)->decayMode()==
EvtRecDTag::kDptoKPiPi && fabs((*iter)->mBC()-1.87)<0.006 && (*iter)->deltaE()>-0.03 && (*iter)->deltaE()<0.03) ||
2163 ((*iter)->decayMode()==
EvtRecDTag::kDptoKPiPiPi0 && fabs((*iter)->mBC()-1.87)<0.006 && (*iter)->deltaE()>-0.05 && (*iter)->deltaE()<0.03)||
2164 ((*iter)->decayMode()==
EvtRecDTag::kDptoKsPiPi0 && fabs((*iter)->mBC()-1.87)<0.006 && (*iter)->deltaE()>-0.05 && (*iter)->deltaE()<0.03) ||
2165 ((*iter)->decayMode()==
EvtRecDTag::kDptoKsPiPiPi&& fabs((*iter)->mBC()-1.87)<0.006 && (*iter)->deltaE()>-0.03 && (*iter)->deltaE()<0.03) ) {
2166 m_isPsippCand = true;
2167 m_psippCandNumber++;
2168 break;
2169 }
2170
2171
2172 }
2173
2174
2175 }
2176
2177 }
2178
2179
2180
2181 if( m_selectRadBhabha && m_isRadBhabha ) m_subalg3->execute();
2182 if( m_selectGGEE && m_isGGEE ) m_subalg4->execute();
2183 if( m_selectGG4Pi && m_isGG4Pi ) m_subalg5->execute();
2184 if( m_selectRadBhabhaT && m_isRadBhabhaT ) m_subalg6->execute();
2185 if( m_selectRhoPi && m_isRhoPi ) m_subalg7->execute();
2186 if( m_selectKstarK && m_isKstarK ) m_subalg8->execute();
2187 if( m_selectPPPiPi && m_isPPPiPi ) m_subalg9->execute();
2188 if( m_selectRecoJpsi && m_isRecoJpsi ) m_subalg10->execute();
2189 if( m_selectBhabha && m_isBhabha ) m_subalg11->execute();
2190 if( m_selectDimu && m_isDimu ) m_subalg12->execute();
2191 if( m_selectCosmic && m_isCosmic ) m_subalg13->execute();
2192 if( m_selectGenProton && m_isGenProton ) m_subalg14->execute();
2193 if( m_selectPsipRhoPi && m_isPsipRhoPi ) m_subalg15->execute();
2194 if( m_selectPsipKstarK && m_isPsipKstarK ) m_subalg16->execute();
2195 if( m_selectPsipPPPiPi && m_isPsipPPPiPi ) m_subalg17->execute();
2196 if( m_selectPsippCand && m_isPsippCand ) m_subalg18->execute();
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220 return StatusCode::SUCCESS;
2221
2222}
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
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