/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Reconstruction/SD0TagAlg/SD0TagAlg-00-00-03/src/Kpi.cxx

Go to the documentation of this file.
00001 //
00002 //  Kpi.cxx is the single D0 tag code to reconstruct D0 or anti-D0 through the final states of
00003 //  Kpi from D0 decays. Kpi.cxx was transfered from the Fortran routine "Kpi.f" which was 
00004 //  orignally used for study of the D0D0-bar production and D0 decays at the BES-II
00005 //  experiment during the time period from 2002 to 2008.
00006 //
00007 //  The orignal Fortran routine "Kpi.f" used at the BES-II experiment was coded by G. Rong in 2001.
00008 //
00009 //  Kpi.cxx was transfered by G. Rong and J. Liu in December, 2005.
00010 //
00011 //  Since 2008, G. Rong and L.L. Jiang have been working on developing this code to analyze of
00012 //  the data taken at 3.773 GeV with the BES-III detector at the BEPC-II collider.
00013 //
00014 //  During developing this code, many People made significant contributions to this code. These are
00015 //          G. Rong, L.L. Jiang, J. Liu, H.L. Ma, J.C. Chen, D.H. Zhang,
00016 //          M.G. Zhao, B. Zheng, L. Li, Y. Fang, Z.Y. Yi, H.H. Liu, Z.Q. Liu et al.
00017 //
00018 //                                       By G. Rong and L.L. Jiang
00019 //                                       March, 2009
00020 //
00021 //  ==========================================================================================
00022 //
00023 #include "SD0TagAlg/Kpi.h"
00024 #include "SD0TagAlg/SingleBase.h"
00025 
00026 
00027 Kpi::Kpi()
00028 {}
00029 
00030 Kpi::~Kpi()
00031 {}
00032 
00033 void Kpi::MTotal(double event,SmartDataPtr<EvtRecTrackCol> evtRecTrkCol, Vint iGood,Vint
00034     iGam, double Ebeam, int PID_flag, int Charge_candidate_D)
00035 {
00036 
00037   int nGood=iGood.size();
00038   int nGam=iGam.size();
00039 
00040   iGoodtag.clear();
00041   iGamtag.clear();
00042   
00043   double mass_bcgg, delE_tag_temp;
00044   int m_chargetag, m_chargek,m_chargepi;
00045   int ika_temp,ipi_temp,ipi2_temp,ipi3_temp;
00046   HepLorentzVector kmfit1,kmfit2,kmfit3,kmfit4,pddd;
00047 
00048   int cqtm_temp;
00049   HepLorentzVector pddd_temp;
00050   IDataProviderSvc* eventSvc = NULL;
00051   Gaudi::svcLocator()->service("EventDataSvc", eventSvc);
00052   SmartDataPtr<EvtRecEvent> evtRecEvent(eventSvc,EventModel::EvtRec::EvtRecEvent);
00053   SmartDataPtr<Event::EventHeader> eventHeader(eventSvc,"/Event/EventHeader");
00054 
00055   int runNo=eventHeader->runNumber();
00056   int rec=eventHeader->eventNumber();
00057 
00058   double xecm=2*Ebeam;
00059 
00060   kpimd = false;
00061   double  tagmode=0;
00062 
00063   if((evtRecEvent->totalCharged() < 2)){     return;   }
00064 
00065   double ecms = xecm; ;
00066 
00067   ISimplePIDSvc* simple_pid;
00068   Gaudi::svcLocator()->service("SimplePIDSvc", simple_pid);
00069 
00070   double deltaE_tem = 0.20;
00071   int ncount1 = 0; 
00072 
00073   Hep3Vector xorigin(0,0,0);
00074   IVertexDbSvc*  vtxsvc;
00075   Gaudi::svcLocator()->service("VertexDbSvc", vtxsvc);
00076   if(vtxsvc->isVertexValid())
00077   {
00078     double* dbv = vtxsvc->PrimaryVertex();
00079     double*  vv = vtxsvc->SigmaPrimaryVertex();
00080     xorigin.setX(dbv[0]);
00081     xorigin.setY(dbv[1]);
00082     xorigin.setZ(dbv[2]);
00083   }
00084 
00085   double xv=xorigin.x();
00086   double yv=xorigin.y();
00087   double zv=xorigin.z();
00088 
00089   HepPoint3D point0(0.,0.,0.);
00090   HepPoint3D IP(xorigin[0],xorigin[1],xorigin[2]);
00091 
00092   HepLorentzVector ptrk1_temp, ptrk2_temp;
00094   for(int i = 0; i < evtRecEvent->totalCharged(); i++) {
00095     EvtRecTrackIterator itTrk = evtRecTrkCol->begin() + i;
00096 
00097     int ika= (*itTrk)->trackId();
00098 
00099     if(!(*itTrk)->isMdcKalTrackValid()) continue;
00100     RecMdcKalTrack*  mdcKalTrk1 = (*itTrk)->mdcKalTrack();
00101     RecMdcKalTrack::setPidType(RecMdcKalTrack::kaon);
00103     m_chargek=mdcKalTrk1->charge();
00104     if(Charge_candidate_D != 0) {
00105       if(m_chargek != -Charge_candidate_D) continue;
00106     }
00107     if(Charge_candidate_D == 0) {
00108       if(abs(m_chargek) != 1) continue;
00109     } 
00111     HepVector a1 = mdcKalTrk1->getZHelixK();
00112     HepSymMatrix Ea1 = mdcKalTrk1->getZErrorK();
00113     VFHelix helixip3_1(point0,a1,Ea1);
00114     helixip3_1.pivot(IP);
00115     HepVector  vecipa1 = helixip3_1.a();
00116 
00117     double dr1 = fabs(vecipa1[0]);
00118     double dz1 = fabs(vecipa1[3]);
00119     double costheta1 = cos(mdcKalTrk1->theta());
00120     if (  dr1 >= 1.0) continue;
00121     if (  dz1 >= 10.0) continue; 
00122     if ( fabs(costheta1) >= 0.93) continue; 
00124     if(PID_flag == 5) {
00125       simple_pid->preparePID(*itTrk);
00126       if(simple_pid->probKaon() < 0.0 || simple_pid->probKaon() < simple_pid->probPion()) continue;  
00127     } 
00129 
00130     WTrackParameter kam(xmass[3],mdcKalTrk1->getZHelixK(),mdcKalTrk1->getZErrorK() );
00131 
00132     //  
00133     // select pi
00134     //  
00135     for(int j = 0; j< evtRecEvent->totalCharged();j++) {
00136       EvtRecTrackIterator itTrk = evtRecTrkCol->begin() + j;
00137 
00138       int ipi= (*itTrk)->trackId();
00139       if(ipi==ika)  continue;
00140 
00141       if(!(*itTrk)->isMdcKalTrackValid()) continue;
00142       RecMdcKalTrack*  mdcKalTrk2 = (*itTrk)->mdcKalTrack();
00143       RecMdcKalTrack::setPidType(RecMdcKalTrack::pion);
00144 
00146       m_chargepi=mdcKalTrk2->charge();
00147       if((m_chargek + m_chargepi) != 0) continue;
00149       HepVector a2 = mdcKalTrk2->getZHelix();
00150       HepSymMatrix Ea2 = mdcKalTrk2->getZError();
00151       VFHelix helixip3_2(point0,a2,Ea2);
00152       helixip3_2.pivot(IP);
00153       HepVector  vecipa2 = helixip3_2.a();
00154 
00155       double dr2 = fabs(vecipa2[0]);
00156       double dz2 = fabs(vecipa2[3]);
00157       double costheta2 = cos(mdcKalTrk2->theta());
00158       if (  dr2 >= 1.0) continue;
00159       if (  dz2 >= 10.0) continue; 
00160       if ( fabs(costheta2) >= 0.93) continue; 
00162       if(PID_flag == 5) {
00163         simple_pid->preparePID(*itTrk);
00164         if(simple_pid->probPion() < 0.0 || simple_pid->probPion() < simple_pid->probKaon()) continue;  
00165       } 
00167 
00168       WTrackParameter pip(xmass[2], mdcKalTrk2->getZHelix(),mdcKalTrk2->getZError() );
00169 
00171       HepPoint3D vx(xorigin.x(), xorigin.y(), xorigin.z());
00172       HepSymMatrix Evx(3, 0);
00173       double bx = 1E+6; Evx[0][0] = bx*bx;
00174       double by = 1E+6; Evx[1][1] = by*by;
00175       double bz = 1E+6; Evx[2][2] = bz*bz;
00176       VertexParameter vxpar; vxpar.setVx(vx); vxpar.setEvx(Evx);
00178 
00179       VertexFit* vtxfit = VertexFit::instance();
00180       vtxfit->init();
00181       vtxfit->AddTrack(0,  kam);
00182       vtxfit->AddTrack(1,  pip);
00183       vtxfit->AddVertex(0, vxpar, 0, 1);
00184       if(!vtxfit->Fit(0))  continue;
00185       vtxfit->Swim(0);
00186 
00187       WTrackParameter wkam = vtxfit->wtrk(0);
00188       WTrackParameter wpip = vtxfit->wtrk(1);
00189 
00190       HepVector kam_val = HepVector(7,0);
00191       kam_val = wkam.w();       
00192       HepVector pip_val = HepVector(7,0);
00193       pip_val = wpip.w();
00194 
00195       HepLorentzVector P_KAM(kam_val[0],kam_val[1],kam_val[2],kam_val[3]);
00196       HepLorentzVector P_PIP(pip_val[0],pip_val[1],pip_val[2],pip_val[3]);
00197 
00198       P_KAM.boost(-0.011,0,0);
00199       P_PIP.boost(-0.011,0,0);
00200       pddd = P_KAM + P_PIP;   
00201 
00202       double   pkpi=pddd.rho();
00203 
00204       double temp1 = (ecms/2)*(ecms/2)-pkpi*pkpi;
00205       if(temp1<0) temp1 =0;
00206       double mass_bc_tem  = sqrt(temp1);
00207 
00208       if(mass_bc_tem < 1.82 || mass_bc_tem > 1.89) continue;
00209 
00210       double  delE_tag_tag = ecms/2-pddd.e();
00211 
00212 
00213       if(fabs(delE_tag_tag)<deltaE_tem)  {
00214         deltaE_tem = fabs(delE_tag_tag);
00215         delE_tag_temp = delE_tag_tag;
00216         mass_bcgg = mass_bc_tem;
00217 
00218         pddd_temp = pddd;
00219         cqtm_temp = m_chargek;
00220         ika_temp=ika;
00221         ipi_temp=ipi;
00222         ncount1 = 1;
00223       }   
00224     }
00225   }
00226 
00227   if(ncount1 == 1){
00228     tagmode = 11;
00229     if(cqtm_temp<0)  tagmode=-11;
00230     tagmd = tagmode;
00231     mass_bc  = mass_bcgg;
00232     delE_tag = delE_tag_temp;
00233     cqtm     = -1.0*cqtm_temp; 
00234 
00235     // cqtm = +1 for D0-->K-Pi+; cqtm = -1 for D0-bar-->K+Pi-;
00236     // cqtm = 0 for D0-->K+K- ect. ...; cqtm = 0 means that we do not
00237     // know whether it s D0 or D0-bar decays;
00238 
00239     iGoodtag.push_back(ika_temp);
00240     iGoodtag.push_back(ipi_temp);
00241 
00242     iGamtag.push_back(9999); 
00243     iGamtag.push_back(9999); 
00244     iGamtag.push_back(9999); 
00245     iGamtag.push_back(9999); 
00246 
00247     ptag = pddd_temp; 
00248 
00249     kpimd = true;
00250 
00251   }
00252 }

Generated on Tue Nov 29 23:14:01 2016 for BOSS_7.0.2 by  doxygen 1.4.7