1 #include "GaudiKernel/MsgStream.h"
2 #include "GaudiKernel/AlgFactory.h"
3 #include "GaudiKernel/SmartDataPtr.h"
4 #include "GaudiKernel/IDataProviderSvc.h"
5 #include "GaudiKernel/PropertyMgr.h"
17 #include "GaudiKernel/INTupleSvc.h"
18 #include "GaudiKernel/NTuple.h"
19 #include "GaudiKernel/Bootstrap.h"
20 #include "GaudiKernel/IHistogramSvc.h"
21 #include "CLHEP/Vector/ThreeVector.h"
22 #include "CLHEP/Vector/LorentzVector.h"
23 #include "CLHEP/Vector/TwoVector.h"
36 #include "GaudiKernel/Bootstrap.h"
37 #include "GaudiKernel/ISvcLocator.h"
38 using CLHEP::Hep3Vector;
39 using CLHEP::Hep2Vector;
40 using CLHEP::HepLorentzVector;
41 #include "CLHEP/Geometry/Point3D.h"
42 #ifndef ENABLE_BACKWARDS_COMPATIBILITY
50 typedef std::vector<int>
Vint;
51 typedef std::vector<HepLorentzVector>
Vp4;
53 const double mpi = 0.13957;
59 double phi= trk->
fi0();
60 double kappa= trk->
kappa();
61 double tanl = trk->
tanl();
63 double px=-
sin(phi)/fabs(kappa);
68 double phi= trk->
fi0();
69 double kappa= trk->
kappa();
70 double tanl = trk->
tanl();
72 double py=
cos(phi)/fabs(kappa);
79 double phi= trk->
fi0();
80 double kappa= trk->
kappa();
81 double tanl = trk->
tanl();
83 double pz=tanl/fabs(kappa);
88 double phi= trk->
fi0();
89 double kappa= trk->
kappa();
90 double tanl = trk->
tanl();
92 double px=-
sin(phi)/fabs(kappa);
93 double py=
cos(phi)/fabs(kappa);
94 double pz=tanl/fabs(kappa);
96 return sqrt(px*px+py*py+pz*pz);
100 double phi0=trk->
fi0();
101 double kappa = trk->
kappa();
103 if(kappa!=0) pxy = 1.0/fabs(kappa);
106 double px = pxy * (-
sin(phi0));
107 double py = pxy *
cos(phi0);
114 int CalibEventSelect::idmax[43]={40,44,48,56,64,72,80,80,76,76,
115 88,88,100,100,112,112,128,128,140,140,
116 160,160,160,160,176,176,176,176,208,208,
117 208,208,240,240,240,240,256,256,256,256,
122 Algorithm(name, pSvcLocator) {
125 declareProperty(
"Output", m_output =
false);
126 declareProperty(
"Display", m_display =
false);
127 declareProperty(
"PrintMonitor", m_printmonitor=
false);
128 declareProperty(
"SelectRadBhabha", m_selectRadBhabha=
false);
129 declareProperty(
"SelectGGEE", m_selectGGEE=
false);
130 declareProperty(
"SelectGG4Pi", m_selectGG4Pi=
false);
131 declareProperty(
"SelectRadBhabhaT", m_selectRadBhabhaT=
false);
132 declareProperty(
"SelectRhoPi", m_selectRhoPi=
false);
133 declareProperty(
"SelectKstarK", m_selectKstarK=
false);
134 declareProperty(
"SelectPPPiPi", m_selectPPPiPi=
false);
135 declareProperty(
"SelectRecoJpsi", m_selectRecoJpsi=
false);
136 declareProperty(
"SelectBhabha", m_selectBhabha=
false);
137 declareProperty(
"SelectDimu", m_selectDimu=
false);
138 declareProperty(
"SelectCosmic", m_selectCosmic=
false);
139 declareProperty(
"SelectGenProton", m_selectGenProton=
false);
140 declareProperty(
"SelectPsipRhoPi", m_selectPsipRhoPi=
false);
141 declareProperty(
"SelectPsipKstarK", m_selectPsipKstarK=
false);
142 declareProperty(
"SelectPsipPPPiPi", m_selectPsipPPPiPi=
false);
143 declareProperty(
"SelectPsippCand", m_selectPsippCand=
false);
145 declareProperty(
"BhabhaScale", m_radbhabha_scale=1000);
146 declareProperty(
"RadBhabhaScale", m_bhabha_scale=1000);
147 declareProperty(
"DimuScale", m_dimu_scale=10);
148 declareProperty(
"CosmicScale", m_cosmic_scale=3);
149 declareProperty(
"ProtonScale", m_proton_scale=100);
151 declareProperty(
"CosmicLowp", m_cosmic_lowp=1.0);
153 declareProperty(
"WriteDst", m_writeDst=
false);
154 declareProperty(
"WriteRec", m_writeRec=
false);
155 declareProperty(
"Ecm", m_ecm=3.1);
156 declareProperty(
"Vr0cut", m_vr0cut=1.0);
157 declareProperty(
"Vz0cut", m_vz0cut=10.0);
158 declareProperty(
"Pt0HighCut", m_pt0HighCut=5.0);
159 declareProperty(
"Pt0LowCut", m_pt0LowCut=0.05);
160 declareProperty(
"EnergyThreshold", m_energyThreshold=0.05);
161 declareProperty(
"GammaPhiCut", m_gammaPhiCut=20.0);
162 declareProperty(
"GammaThetaCut", m_gammaThetaCut=20.0);
169 MsgStream log(
msgSvc(), name());
171 log << MSG::INFO <<
"in initialize()" << endmsg;
177 h_nGood=
histoSvc()->book(
"1D/nGoodtracks", 1,
"num of good chaged tracks", 20, 0, 20);
178 h_nCharge=
histoSvc()->book(
"1D/nCharge", 1,
"net charge", 20, -10, 10);
179 h_pmaxobeam=
histoSvc()->book(
"1D/pmax", 1,
"pmax over beam ratio", 100, 0, 3);
180 h_eopmax=
histoSvc()->book(
"1D/eopmax", 1,
"e over pmax ratio", 100, 0, 3);
181 h_eopsec=
histoSvc()->book(
"1D/eopsec", 1,
"e over psec ratio", 100, 0, 3);
182 h_deltap=
histoSvc()->book(
"1D/deltap", 1,
"pmax minus psec", 100, -3, 3);
183 h_esumoecm=
histoSvc()->book(
"1D/esumoverecm", 1,
"total energy over ecm ratio", 100, 0, 3);
184 h_egmax=
histoSvc()->book(
"1D/egmax", 1,
"most energetic photon energy", 100, 0, 3);
185 h_deltaphi=
histoSvc()->book(
"1D/deltaphi", 1,
"phi_pmax minus phi_sec", 150, -4, 4);
186 h_Pt=
histoSvc()->book(
"1D/Pt", 1,
"total Transverse Momentum", 200,-1, 4);
190 log << MSG::INFO <<
"creating sub-algorithms...." << endreq;
197 sc = createSubAlgorithm(
"EventWriter",
"WriteDst", m_subalg1);
198 if( sc.isFailure() ) {
199 log << MSG::ERROR <<
"Error creating Sub-Algorithm WriteDst" <<endreq;
202 log << MSG::INFO <<
"Success creating Sub-Algorithm WriteDst" <<endreq;
207 sc = createSubAlgorithm(
"EventWriter",
"WriteRec", m_subalg2);
208 if( sc.isFailure() ) {
209 log << MSG::ERROR <<
"Error creating Sub-Algorithm WriteRec" <<endreq;
212 log << MSG::INFO <<
"Success creating Sub-Algorithm WriteRec" <<endreq;
217 if(m_selectRadBhabha) {
218 sc = createSubAlgorithm(
"EventWriter",
"SelectRadBhabha", m_subalg3);
219 if( sc.isFailure() ) {
220 log << MSG::ERROR <<
"Error creating Sub-Algorithm SelectRadBhabha" <<endreq;
223 log << MSG::INFO <<
"Success creating Sub-Algorithm SelectRadBhabha" <<endreq;
228 sc = createSubAlgorithm(
"EventWriter",
"SelectGGEE", m_subalg4);
229 if( sc.isFailure() ) {
230 log << MSG::ERROR <<
"Error creating Sub-Algorithm SelectGGEE" <<endreq;
233 log << MSG::INFO <<
"Success creating Sub-Algorithm SelectGGEE" <<endreq;
238 sc = createSubAlgorithm(
"EventWriter",
"SelectGG4Pi", m_subalg5);
239 if( sc.isFailure() ) {
240 log << MSG::ERROR <<
"Error creating Sub-Algorithm SelectGG4Pi" <<endreq;
243 log << MSG::INFO <<
"Success creating Sub-Algorithm SelectGG4Pi" <<endreq;
248 if(m_selectRadBhabhaT) {
249 sc = createSubAlgorithm(
"EventWriter",
"SelectRadBhabhaT", m_subalg6);
250 if( sc.isFailure() ) {
251 log << MSG::ERROR <<
"Error creating Sub-Algorithm SelectRadBhabhaT" <<endreq;
254 log << MSG::INFO <<
"Success creating Sub-Algorithm SelectRadBhabhaT" <<endreq;
260 sc = createSubAlgorithm(
"EventWriter",
"SelectRhoPi", m_subalg7);
261 if( sc.isFailure() ) {
262 log << MSG::ERROR <<
"Error creating Sub-Algorithm SelectRhoPi" <<endreq;
265 log << MSG::INFO <<
"Success creating Sub-Algorithm SelectRhoPi" <<endreq;
271 sc = createSubAlgorithm(
"EventWriter",
"SelectKstarK", m_subalg8);
272 if( sc.isFailure() ) {
273 log << MSG::ERROR <<
"Error creating Sub-Algorithm SelectKstarK" <<endreq;
276 log << MSG::INFO <<
"Success creating Sub-Algorithm SelectKstarK" <<endreq;
283 sc = createSubAlgorithm(
"EventWriter",
"SelectPPPiPi", m_subalg9);
284 if( sc.isFailure() ) {
285 log << MSG::ERROR <<
"Error creating Sub-Algorithm SelectPPPiPi" <<endreq;
288 log << MSG::INFO <<
"Success creating Sub-Algorithm SelectPPPiPi" <<endreq;
293 if(m_selectRecoJpsi) {
294 sc = createSubAlgorithm(
"EventWriter",
"SelectRecoJpsi", m_subalg10);
295 if( sc.isFailure() ) {
296 log << MSG::ERROR <<
"Error creating Sub-Algorithm SelectRecoJpsi" <<endreq;
299 log << MSG::INFO <<
"Success creating Sub-Algorithm SelectRecoJpsi" <<endreq;
305 sc = createSubAlgorithm(
"EventWriter",
"SelectBhabha", m_subalg11);
306 if( sc.isFailure() ) {
307 log << MSG::ERROR <<
"Error creating Sub-Algorithm SelectBhabha" <<endreq;
310 log << MSG::INFO <<
"Success creating Sub-Algorithm SelectBhabha" <<endreq;
315 sc = createSubAlgorithm(
"EventWriter",
"SelectDimu", m_subalg12);
316 if( sc.isFailure() ) {
317 log << MSG::ERROR <<
"Error creating Sub-Algorithm SelectDimu" <<endreq;
320 log << MSG::INFO <<
"Success creating Sub-Algorithm SelectDimu" <<endreq;
325 sc = createSubAlgorithm(
"EventWriter",
"SelectCosmic", m_subalg13);
326 if( sc.isFailure() ) {
327 log << MSG::ERROR <<
"Error creating Sub-Algorithm SelectCosmic" <<endreq;
330 log << MSG::INFO <<
"Success creating Sub-Algorithm SelectCosmic" <<endreq;
334 if(m_selectGenProton) {
335 sc = createSubAlgorithm(
"EventWriter",
"SelectGenProton", m_subalg14);
336 if( sc.isFailure() ) {
337 log << MSG::ERROR <<
"Error creating Sub-Algorithm SelectGenProton" <<endreq;
340 log << MSG::INFO <<
"Success creating Sub-Algorithm SelectGenProton" <<endreq;
345 if(m_selectPsipRhoPi) {
346 sc = createSubAlgorithm(
"EventWriter",
"SelectPsipRhoPi", m_subalg15);
347 if( sc.isFailure() ) {
348 log << MSG::ERROR <<
"Error creating Sub-Algorithm SelectPsipRhoPi" <<endreq;
351 log << MSG::INFO <<
"Success creating Sub-Algorithm SelectPsipRhoPi" <<endreq;
356 if(m_selectPsipKstarK) {
357 sc = createSubAlgorithm(
"EventWriter",
"SelectPsipKstarK", m_subalg16);
358 if( sc.isFailure() ) {
359 log << MSG::ERROR <<
"Error creating Sub-Algorithm SelectPsipKstarK" <<endreq;
362 log << MSG::INFO <<
"Success creating Sub-Algorithm SelectPsipKstarK" <<endreq;
367 if(m_selectPsipPPPiPi) {
368 sc = createSubAlgorithm(
"EventWriter",
"SelectPsipPPPiPi", m_subalg17);
369 if( sc.isFailure() ) {
370 log << MSG::ERROR <<
"Error creating Sub-Algorithm SelectPsipPPPiPi" <<endreq;
373 log << MSG::INFO <<
"Success creating Sub-Algorithm SelectPsipPPPiPi" <<endreq;
378 if(m_selectPsippCand) {
379 sc = createSubAlgorithm(
"EventWriter",
"SelectPsippCand", m_subalg18);
380 if( sc.isFailure() ) {
381 log << MSG::ERROR <<
"Error creating Sub-Algorithm SelectPsippCand" <<endreq;
384 log << MSG::INFO <<
"Success creating Sub-Algorithm SelectPsippCand" <<endreq;
393 NTuplePtr nt0(
ntupleSvc(),
"FILE1/hadron");
394 if ( nt0 ) m_tuple0 = nt0;
396 m_tuple0 =
ntupleSvc()->book (
"FILE1/hadron", CLID_ColumnWiseTuple,
"N-Tuple example");
398 status = m_tuple0->addItem (
"esum", m_esum);
399 status = m_tuple0->addItem (
"eemc", m_eemc);
400 status = m_tuple0->addItem (
"etot", m_etot);
401 status = m_tuple0->addItem (
"nGood", m_nGood);
402 status = m_tuple0->addItem (
"nCharge", m_nCharge);
403 status = m_tuple0->addItem (
"nGam", m_nGam);
404 status = m_tuple0->addItem (
"ptot", m_ptot);
405 status = m_tuple0->addItem (
"pp", m_pp);
406 status = m_tuple0->addItem (
"pm", m_pm);
407 status = m_tuple0->addItem (
"run", m_runnb);
408 status = m_tuple0->addItem (
"event", m_evtnb);
409 status = m_tuple0->addItem (
"maxE", m_maxE);
410 status = m_tuple0->addItem (
"secE", m_secE);
411 status = m_tuple0->addItem (
"dthe", m_dthe);
412 status = m_tuple0->addItem (
"dphi", m_dphi);
413 status = m_tuple0->addItem (
"mdcHit1", m_mdcHit1);
414 status = m_tuple0->addItem (
"mdcHit2", m_mdcHit2);
417 log << MSG::ERROR <<
" Cannot book N-tuple:" << long(m_tuple0) << endmsg;
418 return StatusCode::FAILURE;
422 NTuplePtr nt1(
ntupleSvc(),
"FILE1/vxyz");
423 if ( nt1 ) m_tuple1 = nt1;
425 m_tuple1 =
ntupleSvc()->book (
"FILE1/vxyz", CLID_ColumnWiseTuple,
"ks N-Tuple example");
427 status = m_tuple1->addItem (
"vx0", m_vx0);
428 status = m_tuple1->addItem (
"vy0", m_vy0);
429 status = m_tuple1->addItem (
"vz0", m_vz0);
430 status = m_tuple1->addItem (
"vr0", m_vr0);
431 status = m_tuple1->addItem (
"theta0", m_theta0);
432 status = m_tuple1->addItem (
"p0", m_p0);
433 status = m_tuple1->addItem (
"pt0", m_pt0);
436 log << MSG::ERROR <<
" Cannot book N-tuple:" << long(m_tuple1) << endmsg;
437 return StatusCode::FAILURE;
441 NTuplePtr nt2(
ntupleSvc(),
"FILE1/photon");
442 if ( nt2 ) m_tuple2 = nt2;
444 m_tuple2 =
ntupleSvc()->book (
"FILE1/photon", CLID_ColumnWiseTuple,
"ks N-Tuple example");
446 status = m_tuple2->addItem (
"dthe", m_dthe);
447 status = m_tuple2->addItem (
"dphi", m_dphi);
448 status = m_tuple2->addItem (
"dang", m_dang);
449 status = m_tuple2->addItem (
"eraw", m_eraw);
452 log << MSG::ERROR <<
" Cannot book N-tuple:" << long(m_tuple2) << endmsg;
453 return StatusCode::FAILURE;
465 m_radBhabhaTNumber=0;
475 m_psipKstarKNumber=0;
476 m_psipPPPiPiNumber=0;
478 log << MSG::INFO <<
"successfully return from initialize()" <<endmsg;
479 return StatusCode::SUCCESS;
488 MsgStream log(
msgSvc(), name());
489 log << MSG::INFO <<
"in execute()" << endreq;
491 if( m_writeDst) m_subalg1->execute();
492 if( m_writeRec) m_subalg2->execute();
495 m_isRadBhabha =
false;
498 m_isRadBhabhaT =
false;
501 m_isRecoJpsi =
false;
506 m_isGenProton =
false;
507 m_isPsipRhoPi =
false;
508 m_isPsipKstarK =
false;
509 m_isPsipPPPiPi =
false;
510 m_isPsippCand =
false;
512 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),
"/Event/EventHeader");
515 cout<<
" eventHeader "<<endl;
516 return StatusCode::FAILURE;
519 int run=eventHeader->runNumber();
520 int event=eventHeader->eventNumber();
527 cout<<
"new run is:"<<m_run<<endl;
528 cout<<
"beamE is:"<<beamE<<endl;
529 if(beamE>0 && beamE<3)
535 if(m_display && m_events%1000==0){
536 cout<< m_events <<
" -------- run,event: "<<run<<
","<<
event<<endl;
537 cout<<
"m_ecm="<<m_ecm<<endl;
543 cout<<
" evtRecEvent "<<endl;
544 return StatusCode::FAILURE;
547 log << MSG::DEBUG <<
"ncharg, nneu, tottks = "
548 << evtRecEvent->totalCharged() <<
" , "
549 << evtRecEvent->totalNeutral() <<
" , "
550 << evtRecEvent->totalTracks() <<endreq;
553 cout<<
" evtRecTrkCol "<<endl;
554 return StatusCode::FAILURE;
557 if(evtRecEvent->totalTracks()!=evtRecTrkCol->size())
return StatusCode::SUCCESS;
561 SmartDataPtr<EvtRecPi0Col> recPi0Col(eventSvc(),
"/Event/EvtRec/EvtRecPi0Col");
563 log << MSG::FATAL <<
"Could not find EvtRecPi0Col" << endreq;
564 return StatusCode::FAILURE;
568 int nPi0 = recPi0Col->size();
569 EvtRecPi0Col::iterator itpi0 = recPi0Col->begin();
571 double mpi0 = (*itpi0)->unconMass();
572 if ( fabs(
mpi0 - 0.135 )> 0.015 )
589 vector<int> iCP, iCN;
597 int nCosmicCharge =0;
599 for(
int i = 0;i < evtRecEvent->totalCharged(); i++)
606 if(!(*itTrk)->isMdcKalTrackValid())
continue;
611 double vx0 = mdcTrk->
x();
612 double vy0 = mdcTrk->
y();
613 double vz0 = mdcTrk->
z();
614 double vr0 = mdcTrk->
r();
615 double theta0 = mdcTrk->
theta();
616 double p0 =
P(mdcTrk);
617 double pt0 = sqrt( pow(
Px(mdcTrk),2)+pow(
Py(mdcTrk),2));
633 Hep3Vector xorigin(0,0,0);
635 Gaudi::svcLocator()->service(
"VertexDbSvc", vtxsvc);
639 xorigin.setX(dbv[0]);
640 xorigin.setY(dbv[1]);
641 xorigin.setZ(dbv[2]);
646 HepPoint3D IP(xorigin[0],xorigin[1],xorigin[2]);
649 HepVector vecipa = helixip.
a();
650 double db=fabs(vecipa[0]);
656 if(fabs(dz) >= m_vz0cut)
continue;
657 if(db >= m_vr0cut)
continue;
660 if(p0>m_cosmic_lowp && p0<20){
661 iCosmicGood.push_back((*itTrk)->trackId());
662 nCosmicCharge += mdcTrk->
charge();
667 if(pt0 >= m_pt0HighCut)
continue;
668 if(pt0 <= m_pt0LowCut)
continue;
670 iGood.push_back((*itTrk)->trackId());
671 nCharge += mdcTrk->
charge();
673 iCP.push_back((*itTrk)->trackId());
674 else if(mdcTrk->
charge()<0)
675 iCN.push_back((*itTrk)->trackId());
679 int nGood = iGood.size();
680 int nCosmicGood = iCosmicGood.size();
685 for(
int i = evtRecEvent->totalCharged(); i< evtRecEvent->totalTracks(); i++) {
688 if(!(*itTrk)->isEmcShowerValid())
continue;
690 double eraw = emcTrk->
energy();
691 double time = emcTrk->
time();
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;
697 iGam.push_back((*itTrk)->trackId());
699 int nGam = iGam.size();
724 Hep3Vector Pt_charge(0,0,0);
726 for(
int i = 0; i < nGood; i++) {
733 if((*itTrk)->isMdcKalTrackValid()) {
740 double phi=
Phi(mdcTrk);
743 HepLorentzVector
ptrk;
747 p3 = fabs(
ptrk.mag());
755 Hep3Vector ptemp(
Px(mdcTrk),
Py(mdcTrk),0);
759 if((*itTrk)->isEmcShowerValid()) {
772 else if( p3 < pmax && p3> psec){
790 ppip.push_back(
ptrk);
793 ppim.push_back(
ptrk);
799 if((*itTrk)->isEmcShowerValid()) {
802 double eraw = emcTrk->
energy();
803 double phiemc = emcTrk->
phi();
804 double the = emcTrk->
theta();
806 HepLorentzVector pemc;
807 pemc.setPx(eraw*
sin(the)*
cos(phiemc));
808 pemc.setPy(eraw*
sin(the)*
sin(phiemc));
809 pemc.setPz(eraw*
cos(the));
811 pemc = pemc.boost(-0.011,0,0);
823 if(pmax!=0) eopmax=eccmax/pmax;
824 if(psec!=0) eopsec=eccsec/psec;
843 Hep3Vector Pt_neu(0,0,0);
845 for(
int i = 0; i < nGam; i++) {
848 double eraw = emcTrk->
energy();
849 double phi = emcTrk->
phi();
850 double the = emcTrk->
theta();
851 HepLorentzVector
ptrk;
857 pGam.push_back(
ptrk);
862 Hep3Vector ptemp(eraw*
sin(the)*
cos(phi), eraw*
sin(the)*
sin(phi),0);
870 double esum = echarge + eneu;
871 Hep3Vector Pt=Pt_charge+Pt_neu;
874 double phid=phimax-phisec;
875 phid = fmod(phid+CLHEP::twopi+CLHEP::twopi+
pi, CLHEP::twopi) - CLHEP::pi;
882 if( nGood == 2 && nCharge==0 && (m_selectBhabha || m_selectDimu) ){
885 if( m_events%m_bhabha_scale == 0 && m_selectBhabha && echarge/m_ecm>0.8 && eopmax>0.8 && eopsec>0.8){
892 if( m_events%m_dimu_scale == 0 && m_selectDimu && eemc/m_ecm<0.3){
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();
903 for(;iter_tof!=tofTrkCol.end();iter_tof++){
905 status->
setStatus( (*iter_tof)->status() );
907 time1=(*iter_tof)->tof();
913 if( (*itp)->isMucTrackValid() ){
915 depth1=mucTrk->
depth();
918 if( (*itn)->isTofTrackValid() ){
919 SmartRefVector<RecTofTrack> tofTrkCol= (*itn)->tofTrack();
920 SmartRefVector<RecTofTrack>::iterator iter_tof=tofTrkCol.begin();
922 for(;iter_tof!=tofTrkCol.end();iter_tof++){
924 status->
setStatus( (*iter_tof)->status() );
926 time2=(*iter_tof)->tof();
932 if( (*itn)->isMucTrackValid() ){
934 depth2=mucTrk->
depth();
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)){
955 if(m_selectCosmic && nCosmicGood == 2 && eemc/m_ecm<0.3){
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();
966 for(;iter_tof!=tofTrkCol.end();iter_tof++){
968 status->
setStatus( (*iter_tof)->status() );
970 time1=(*iter_tof)->tof();
976 if( (*itp)->isMucTrackValid() ){
978 depth1=mucTrk->
depth();
981 if( (*itn)->isTofTrackValid() ){
982 SmartRefVector<RecTofTrack> tofTrkCol= (*itn)->tofTrack();
983 SmartRefVector<RecTofTrack>::iterator iter_tof=tofTrkCol.begin();
985 for(;iter_tof!=tofTrkCol.end();iter_tof++){
987 status->
setStatus( (*iter_tof)->status() );
989 time2=(*iter_tof)->tof();
995 if( (*itn)->isMucTrackValid() ){
997 depth2=mucTrk->
depth();
1002 if( m_selectCosmic && time1!=-99 && time2!=-99 && fabs(time1-time2)>5 ){
1013 if(m_events%m_proton_scale ==0 ){
1015 bool protoncand=
false;
1016 for(
int i=0; i<nGood; i++){
1022 double pp =
P(mdcTrk);
1024 if((*iter)->isMdcDedxValid()){
1026 chiP=dedxTrk->
chiP();
1029 if( fabs(pp)<0.6 && fabs(chiP)<5){
1037 m_genProtonNumber++;
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());
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 )
1066 m_radBhabhaNumber++;
1072 if(nGood==2 && nCharge==0 && eemc/m_ecm>=0.7 && eopmax>=0.85 && eopmax<=1.15 && eopsec>=0.85 && eopsec<=1.15 ){
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++;
1081 m_isRadBhabhaT=
true;
1082 m_radBhabhaTNumber++;
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)
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)
1107 if( (m_selectRhoPi || m_selectKstarK) && nGood == 2 && nCharge==0 && nPi0 == 1){
1113 if( (*itone)->isMdcKalTrackValid() && (*ittwo)->isMdcKalTrackValid() ) {
1118 HepLorentzVector p4trk1;
1120 p4trk1.setPy(
Py(trk1));
1121 p4trk1.setPz(
Pz(trk1));
1124 HepLorentzVector p4trk2;
1125 p4trk2.setPx(
Px(trk2));
1126 p4trk2.setPy(
Py(trk2));
1127 p4trk2.setPz(
Pz(trk2));
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) );
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) );
1145 itpi0 = recPi0Col->begin();
1146 HepLorentzVector p4gam1 = (*itpi0)->hiPfit();
1147 HepLorentzVector p4gam2 = (*itpi0)->loPfit();
1148 HepLorentzVector p4pi0 = p4gam1+p4gam2;
1150 HepLorentzVector p4total = p4trk1 + p4trk2 + p4pi0;
1151 HepLorentzVector p4total2 = p4trk3 + p4trk4 + p4pi0;
1153 double rhopimass=p4total2.m();
1154 double kstarkmass=p4total.m();
1155 if( (kstarkmass > 3.0 && kstarkmass < 3.15) || (rhopimass > 3.0 && rhopimass < 3.15) ){
1160 double eop1=0.0,eop2=0.0;
1161 if( (*itone)->isEmcShowerValid() ){
1163 double etrk=emcTrk->
energy();
1166 eop1 = etrk/
P(trk1);
1171 if( (*ittwo)->isEmcShowerValid() ){
1173 double etrk=emcTrk->
energy();
1176 eop2 = etrk/
P(trk2);
1181 if(eop1<0.8 && eop2<0.8){
1183 if(rhopimass>3.0 && rhopimass<3.15){
1186 HepLorentzVector
ecms(0.034,0,0,m_ecm);
1206 bool oksq1 = kmfit->
Fit();
1207 double chi1 = kmfit->
chisq();
1210 if(oksq1 && chi1<=60){
1217 if(kstarkmass>3.0 && kstarkmass<3.15){
1220 double mkstarp=0, mkstarm=0;
1222 HepLorentzVector p4kstarp = p4trk1 + p4pi0;
1223 HepLorentzVector p4kstarm = p4trk2 + p4pi0;
1224 mkstarp = p4kstarp.m();
1225 mkstarm = p4kstarm.m();
1228 HepLorentzVector p4kstarm = p4trk1 + p4pi0;
1229 HepLorentzVector p4kstarp = p4trk2 + p4pi0;
1230 mkstarp = p4kstarp.m();
1231 mkstarm = p4kstarm.m();
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 ) ){
1237 HepLorentzVector
ecms(0.034,0,0,m_ecm);
1256 bool oksq1 = kmfit->
Fit();
1257 double chi1 = kmfit->
chisq();
1260 if(oksq1 && chi1<=60){
1281 if(m_selectPPPiPi && nGood ==4 && nCharge == 0 && nPi0==0){
1292 HepLorentzVector p4trkpp;
1293 HepLorentzVector p4trkpm;
1294 HepLorentzVector p4trkpip;
1295 HepLorentzVector p4trkpim;
1305 p4trkpp.setPx(
Px(trk1));
1306 p4trkpp.setPy(
Py(trk1));
1307 p4trkpp.setPz(
Pz(trk1));
1310 p4trkpm.setPx(
Px(trk3));
1311 p4trkpm.setPy(
Py(trk3));
1312 p4trkpm.setPz(
Pz(trk3));
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) );
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) );
1326 double jpsimass1= (p4trkpp+p4trkpm+p4trkpip+p4trkpim).m();
1337 p4trkpp.setPx(
Px(trk1));
1338 p4trkpp.setPy(
Py(trk1));
1339 p4trkpp.setPz(
Pz(trk1));
1342 p4trkpm.setPx(
Px(trk4));
1343 p4trkpm.setPy(
Py(trk4));
1344 p4trkpm.setPz(
Pz(trk4));
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) );
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) );
1358 double jpsimass2= (p4trkpp+p4trkpm+p4trkpip+p4trkpim).m();
1369 p4trkpp.setPx(
Px(trk2));
1370 p4trkpp.setPy(
Py(trk2));
1371 p4trkpp.setPz(
Pz(trk2));
1374 p4trkpm.setPx(
Px(trk3));
1375 p4trkpm.setPy(
Py(trk3));
1376 p4trkpm.setPz(
Pz(trk3));
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) );
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) );
1390 double jpsimass3= (p4trkpp+p4trkpm+p4trkpip+p4trkpim).m();
1401 p4trkpp.setPx(
Px(trk2));
1402 p4trkpp.setPy(
Py(trk2));
1403 p4trkpp.setPz(
Pz(trk2));
1406 p4trkpm.setPx(
Px(trk4));
1407 p4trkpm.setPy(
Py(trk4));
1408 p4trkpm.setPz(
Pz(trk4));
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) );
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) );
1422 double jpsimass4= (p4trkpp+p4trkpm+p4trkpip+p4trkpim).m();
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){
1433 double chi1, chi2, chi3, chi4;
1436 HepLorentzVector
ecms(0.034,0,0,m_ecm);
1455 bool oksq1 = kmfit->
Fit();
1456 chi1 = kmfit->
chisq();
1480 bool oksq1 = kmfit->
Fit();
1481 chi2 = kmfit->
chisq();
1487 else if(chi2<chimin){
1510 bool oksq1 = kmfit->
Fit();
1511 chi3 = kmfit->
chisq();
1517 else if(chi3<chimin){
1542 bool oksq1 = kmfit->
Fit();
1543 chi4 = kmfit->
chisq();
1550 else if(chi4<chimin){
1559 if(type!=0 && chimin<100){
1573 if( (m_selectPsipRhoPi || m_selectPsipKstarK || m_selectPsipPPPiPi) && (nGood==4 || nGood==6) && nCharge==0 ){
1578 double bestmass=1.0;
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() );
1593 if(fabs(recomass-3.096)< fabs(bestmass-3.096)){
1603 pione = evtRecTrkCol->begin() + iCP[pindex];
1604 pitwo = evtRecTrkCol->begin() + iCN[nindex];
1605 pitrk1 = (*pione)->mdcKalTrack();
1606 pitrk2 = (*pitwo)->mdcKalTrack();
1610 double jpsicharge=0;
1611 for(
int ip=0; ip<iCP.size(); ip++){
1613 iJPsiP.push_back(iCP[ip]);
1616 jpsicharge+=trktmp->
charge();
1620 for(
int in=0; in<iCN.size(); in++){
1622 iJPsiN.push_back(iCN[in]);
1625 jpsicharge+=trktmp->
charge();
1630 HepLorentzVector
ecms(0.034,0,0,m_ecm);
1633 if( (m_selectPsipRhoPi || m_selectPsipKstarK) && (bestmass>3.075 && bestmass<3.120) && nGood==4 && jpsicharge==0 && nPi0==1){
1639 if( (*itone)->isMdcKalTrackValid() && (*ittwo)->isMdcKalTrackValid() ) {
1644 HepLorentzVector p4trk1;
1646 p4trk1.setPy(
Py(trk1));
1647 p4trk1.setPz(
Pz(trk1));
1650 HepLorentzVector p4trk2;
1651 p4trk2.setPx(
Px(trk2));
1652 p4trk2.setPy(
Py(trk2));
1653 p4trk2.setPz(
Pz(trk2));
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) );
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) );
1670 EvtRecPi0Col::iterator itpi0 = recPi0Col->begin();
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;
1686 HepLorentzVector p4kstarp = p4trk1 + p4pi0;
1687 HepLorentzVector p4kstarm = p4trk2 + p4pi0;
1688 double mkstarp = p4kstarp.m();
1689 double mkstarm = p4kstarm.m();
1691 if( (p4total.m() > 3.0 && p4total.m() < 3.15) || (p4total2.m() > 3.0 && p4total2.m() < 3.15) ){
1712 if(m_selectPsipRhoPi){
1723 bool oksq1 = kmfit->
Fit();
1724 double chi1 = kmfit->
chisq();
1727 if(oksq1 && chi1>0 && chi1<100){
1728 m_isPsipRhoPi =
true;
1729 m_psipRhoPiNumber++;
1732 if(m_selectPsipKstarK){
1744 bool oksq2 = kmfit2->
Fit();
1745 double chi2 = kmfit2->
chisq();
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++;
1766 if(m_selectPsipPPPiPi && (bestmass>3.075 && bestmass<3.120) && nGood==6 && jpsicharge==0 && nPi0==0){
1778 HepLorentzVector p4trkpp;
1779 HepLorentzVector p4trkpm;
1780 HepLorentzVector p4trkpip;
1781 HepLorentzVector p4trkpim;
1791 p4trkpp.setPx(
Px(trk1));
1792 p4trkpp.setPy(
Py(trk1));
1793 p4trkpp.setPz(
Pz(trk1));
1796 p4trkpm.setPx(
Px(trk3));
1797 p4trkpm.setPy(
Py(trk3));
1798 p4trkpm.setPz(
Pz(trk3));
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) );
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) );
1812 double jpsimass1= (p4trkpp+p4trkpm+p4trkpip+p4trkpim).m();
1823 p4trkpp.setPx(
Px(trk1));
1824 p4trkpp.setPy(
Py(trk1));
1825 p4trkpp.setPz(
Pz(trk1));
1828 p4trkpm.setPx(
Px(trk4));
1829 p4trkpm.setPy(
Py(trk4));
1830 p4trkpm.setPz(
Pz(trk4));
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) );
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) );
1844 double jpsimass2= (p4trkpp+p4trkpm+p4trkpip+p4trkpim).m();
1855 p4trkpp.setPx(
Px(trk2));
1856 p4trkpp.setPy(
Py(trk2));
1857 p4trkpp.setPz(
Pz(trk2));
1860 p4trkpm.setPx(
Px(trk3));
1861 p4trkpm.setPy(
Py(trk3));
1862 p4trkpm.setPz(
Pz(trk3));
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) );
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) );
1876 double jpsimass3= (p4trkpp+p4trkpm+p4trkpip+p4trkpim).m();
1887 p4trkpp.setPx(
Px(trk2));
1888 p4trkpp.setPy(
Py(trk2));
1889 p4trkpp.setPz(
Pz(trk2));
1892 p4trkpm.setPx(
Px(trk4));
1893 p4trkpm.setPy(
Py(trk4));
1894 p4trkpm.setPz(
Pz(trk4));
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) );
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) );
1908 double jpsimass4= (p4trkpp+p4trkpm+p4trkpip+p4trkpim).m();
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){
1915 double chi1, chi2, chi3, chi4;
1920 WTrackParameter wvpiTrk1, wvpiTrk2, wvpiTrk3, wvpiTrk4 , wvpiTrk5, wvpiTrk6 ;
1942 bool oksq1 = kmfit->
Fit();
1943 chi1 = kmfit->
chisq();
1972 bool oksq1 = kmfit->
Fit();
1973 chi2 = kmfit->
chisq();
1979 else if(chi2<chimin){
2008 bool oksq1 = kmfit->
Fit();
2009 chi3 = kmfit->
chisq();
2015 else if(chi3<chimin){
2042 bool oksq1 = kmfit->
Fit();
2043 chi4 = kmfit->
chisq();
2049 else if(chi4<chimin){
2058 if(chimin>0 && chimin<200){
2059 m_isPsipPPPiPi =
true;
2060 m_psipPPPiPiNumber++;
2076 if(m_selectPsippCand){
2079 if ( ! evtRecDTagCol ) {
2080 log << MSG::FATAL <<
"Could not find EvtRecDTagCol" << endreq;
2081 return StatusCode::FAILURE;
2083 if(evtRecDTagCol->size()>0){
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++){
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++;
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();
2152 return StatusCode::SUCCESS;
2159 MsgStream log(
msgSvc(), name());
2160 log << MSG::INFO <<
"in finalize()" << endmsg;
2162 cout<<
"Total events: "<<m_events<<endl;
2165 if(m_selectRadBhabha) {
2166 cout <<
"Selected rad bhabha: " << m_radBhabhaNumber << endl;
2171 cout <<
"Selected ggee events: " << m_GGEENumber << endl;
2175 cout <<
"Selected gg4pi events: " << m_GG4PiNumber << endl;
2178 if(m_selectRadBhabhaT) {
2179 cout <<
"Selected rad bhabha tight: " << m_radBhabhaTNumber << endl;
2183 cout <<
"Selected rhopi events: " << m_rhoPiNumber << endl;
2186 if(m_selectKstarK) {
2187 cout <<
"Selected kstark events: " << m_kstarKNumber << endl;
2190 if(m_selectPPPiPi) {
2191 cout <<
"Selected pppipi events: " << m_ppPiPiNumber << endl;
2194 if(m_selectRecoJpsi) {
2195 cout <<
"Selected recoil jsi events: " << m_recoJpsiNumber << endl;
2199 if(m_selectBhabha) {
2200 cout <<
"Selected bhabha events: " << m_bhabhaNumber << endl;
2205 cout <<
"Selected dimu events: " << m_dimuNumber << endl;
2209 if(m_selectCosmic) {
2210 cout <<
"Selected cosmic events: " << m_cosmicNumber << endl;
2213 if(m_selectGenProton) {
2214 cout <<
"Selected generic proton events: " << m_genProtonNumber << endl;
2217 if(m_selectPsipRhoPi) {
2218 cout <<
"Selected recoil rhopi events: " << m_psipRhoPiNumber << endl;
2221 if(m_selectPsipKstarK) {
2222 cout <<
"Selected recoil kstark events: " << m_psipKstarKNumber << endl;
2225 if(m_selectPsipPPPiPi) {
2226 cout <<
"Selected recoil pppipi events: " << m_psipPPPiPiNumber << endl;
2229 if(m_selectPsippCand) {
2230 cout <<
"Selected psi'' candi events: " << m_psippCandNumber << endl;
2233 return StatusCode::SUCCESS;
2237 double phi1=
min(ph1,ph2);
2238 double phi2=
max(ph1,ph2);
2239 double delta=0.0610865;
2240 if((phi2-phi1)<CLHEP::pi){
2243 if(phi1<0.) phi1 += CLHEP::twopi;
2244 if(phi2>CLHEP::twopi) phi2 -= CLHEP::twopi;
2245 double tmp1=
min(phi1,phi2);
2246 double tmp2=
max(phi1,phi2);
2254 if((phi2-phi1)<CLHEP::pi){
2255 if(ph<=phi2&&ph>=phi1)
return true;
2259 if(ph>=phi2||ph<=phi1)
return true;
2268 const char host[] =
"202.122.37.69";
2269 const char user[] =
"guest";
2270 const char passwd[] =
"guestpass";
2271 const char db[] =
"run";
2272 unsigned int port_num = 3306;
2275 MYSQL* mysql = mysql_init(NULL);
2276 mysql = mysql_real_connect(mysql, host, user, passwd, db, port_num,
2280 if (mysql == NULL) {
2281 fprintf(stderr,
"can not open database: RunInfo for run %d lum\n",
runNo);
2286 snprintf(stmt, 1024,
2287 "select BER_PRB, BPR_PRB "
2288 "from RunParams where run_number = %d",
runNo);
2289 if (mysql_real_query(mysql, stmt, strlen(stmt))) {
2290 fprintf(stderr,
"query error\n");
2293 MYSQL_RES* result_set = mysql_store_result(mysql);
2294 MYSQL_ROW row = mysql_fetch_row(result_set);
2296 fprintf(stderr,
"cannot find data for RunNo %d\n",
runNo);
2300 double E_E=0, E_P=0;
2301 sscanf(row[0],
"%lf", &E_E);
2302 sscanf(row[1],
"%lf", &E_P);
2304 beamE=(E_E+E_P)/2.0;
double sin(const BesAngle a)
double cos(const BesAngle a)
double Px(RecMdcKalTrack *trk)
HepGeom::Point3D< double > HepPoint3D
double Pz(RecMdcKalTrack *trk)
std::vector< HepLorentzVector > Vp4
double Phi(RecMdcKalTrack *trk)
double P(RecMdcKalTrack *trk)
double Py(RecMdcKalTrack *trk)
EvtRecTrackCol::iterator EvtRecTrackIterator
std::vector< HepLorentzVector > Vp4
struct st_mysql_res MYSQL_RES
IHistogramSvc * histoSvc()
bool WhetherSector(double ph, double ph1, double ph2)
void readbeamEfromDb(int runNo, double &beamE)
CalibEventSelect(const std::string &name, ISvcLocator *pSvcLocator)
const double theta() const
void setPx(const double px, const int pid)
const double tanl(void) const
static void setPidType(PidType pidType)
const double kappa(void) const
const double fi0(void) const
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)
const HepPoint3D & pivot(void) const
returns pivot position.
const HepVector & a(void) const
returns helix parameters.
_EXTERN_ std::string EvtRecEvent
_EXTERN_ std::string EvtRecDTagCol
_EXTERN_ std::string EvtRecTrackCol