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

Go to the documentation of this file.
00001 //
00002 //  Kk.cxx is the single D0 tag code to reconstruct D0 or anti-D0 through the final states of
00003 //  KK from D0 decays. Kk.cxx was transfered from the Fortran routine "Kk.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 "Kk.f" used at the BES-II experiment was coded by G. Rong in 2002.
00008 //
00009 //  Kk.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/Kk.h"
00024 #include "SD0TagAlg/SingleBase.h"
00025 
00026 Kk::Kk()
00027 {}
00028 
00029 Kk::~Kk()
00030 {}
00031 
00032 void Kk::MTotal(double event,SmartDataPtr<EvtRecTrackCol> evtRecTrkCol, Vint iGood,Vint
00033     iGam, double Ebeam, int PID_flag, int Charge_candidate_D)
00034 {
00035 
00036   int nGood=iGood.size();
00037   int nGam=iGam.size();
00038 
00039   iGoodtag.clear();
00040   iGamtag.clear();
00041   
00042   double mass_bcgg, delE_tag_temp;
00043   int m_chargetag, m_chargek1,m_chargek2;
00044   int ika1_temp,ika2_temp,ipi2_temp,ipi3_temp;
00045   HepLorentzVector kmfit1,kmfit2,kmfit3,kmfit4,pddd;
00046 
00047   HepLorentzVector pddd_temp;
00048   IDataProviderSvc* eventSvc = NULL;
00049   Gaudi::svcLocator()->service("EventDataSvc", eventSvc);
00050   SmartDataPtr<EvtRecEvent> evtRecEvent(eventSvc,EventModel::EvtRec::EvtRecEvent);
00051   SmartDataPtr<Event::EventHeader> eventHeader(eventSvc,"/Event/EventHeader");
00052 
00053   int runNo=eventHeader->runNumber();
00054   int rec=eventHeader->eventNumber();
00055 
00056   double xecm=2*Ebeam;
00057 
00058   kkmd=false;
00059   double  tagmode=0;
00060 
00061   if((evtRecEvent->totalCharged() < 2)){    return;  }
00062 
00063   double ecms = xecm;
00064 
00065   ISimplePIDSvc* simple_pid;
00066   Gaudi::svcLocator()->service("SimplePIDSvc", simple_pid);
00067 
00068   double deltaE_tem = 0.20;
00069   int ncount1 = 0; 
00070 
00071   Hep3Vector xorigin(0,0,0);
00072   IVertexDbSvc*  vtxsvc;
00073   Gaudi::svcLocator()->service("VertexDbSvc", vtxsvc);
00074   if(vtxsvc->isVertexValid())
00075   {
00076     double* dbv = vtxsvc->PrimaryVertex();
00077     double*  vv = vtxsvc->SigmaPrimaryVertex();
00078     xorigin.setX(dbv[0]);
00079     xorigin.setY(dbv[1]);
00080     xorigin.setZ(dbv[2]);
00081   }
00082 
00083   double xv=xorigin.x();
00084   double yv=xorigin.y();
00085   double zv=xorigin.z();
00086 
00087   HepPoint3D point0(0.,0.,0.);
00088   HepPoint3D IP(xorigin[0],xorigin[1],xorigin[2]);
00090 
00091   for(int i = 0; i < evtRecEvent->totalCharged(); i++) {
00092     EvtRecTrackIterator itTrk = evtRecTrkCol->begin() + i;
00093 
00094     int ika1= (*itTrk)->trackId();
00095 
00096     if(!(*itTrk)->isMdcKalTrackValid()) continue;
00097     RecMdcKalTrack*  mdcKalTrk1 = (*itTrk)->mdcKalTrack();
00098     RecMdcKalTrack::setPidType(RecMdcKalTrack::kaon);
00099 
00100     m_chargek1=mdcKalTrk1->charge();
00101     if(m_chargek1 != 1) continue;
00102 
00104     HepVector a1 = mdcKalTrk1->getZHelixK();
00105     HepSymMatrix Ea1 = mdcKalTrk1->getZErrorK();
00106 
00107     VFHelix helixip3_1(point0,a1,Ea1);
00108     helixip3_1.pivot(IP);
00109     HepVector  vecipa1 = helixip3_1.a();
00110 
00111     double dr1 = fabs(vecipa1[0]);
00112     double dz1 = fabs(vecipa1[3]);
00113     double costheta1 = cos(mdcKalTrk1->theta());
00114 
00115     if (  dr1 >= 1.0) continue;
00116     if (  dz1 >= 10.0) continue; 
00117     if ( fabs(costheta1) >= 0.93) continue; 
00119     if(PID_flag == 5) {
00120       simple_pid->preparePID(*itTrk);
00121       if(simple_pid->probKaon() < 0.0 || simple_pid->probKaon() < simple_pid->probPion()) continue;  
00122     } 
00124     WTrackParameter kap(xmass[3],mdcKalTrk1->getZHelixK(),mdcKalTrk1->getZErrorK() );
00125 
00126     //  
00127     // select K2
00128     //  
00129     for(int j = 0; j< evtRecEvent->totalCharged();j++) {
00130       EvtRecTrackIterator itTrk = evtRecTrkCol->begin() + j;
00131 
00132       int ika2= (*itTrk)->trackId();
00133       if(ika1==ika2)  continue;
00134 
00135       if(!(*itTrk)->isMdcKalTrackValid()) continue;
00136       RecMdcKalTrack*  mdcKalTrk2 = (*itTrk)->mdcKalTrack();
00137       RecMdcKalTrack::setPidType(RecMdcKalTrack::kaon);
00138 
00139       m_chargek2=mdcKalTrk2->charge();
00140       if((m_chargek1 + m_chargek2) != 0) continue;
00141 
00143       HepVector a2 = mdcKalTrk2->getZHelixK();
00144       HepSymMatrix Ea2 = mdcKalTrk2->getZErrorK();
00145       VFHelix helixip3_2(point0,a2,Ea2);
00146       helixip3_2.pivot(IP);
00147       HepVector  vecipa2 = helixip3_2.a();
00148 
00149       double dr2 = fabs(vecipa2[0]);
00150       double dz2 = fabs(vecipa2[3]);
00151       double costheta2 = cos(mdcKalTrk2->theta());
00152       if (  dr2 >= 1.0) continue;
00153       if (  dz2 >= 10.0) continue; 
00154       if ( fabs(costheta2) >= 0.93) continue; 
00156       if(PID_flag == 5) {
00157         simple_pid->preparePID(*itTrk);
00158         if(simple_pid->probKaon() < 0.0 || simple_pid->probKaon() < simple_pid->probPion()) continue;  
00159       } 
00161       WTrackParameter kam(xmass[3],mdcKalTrk2->getZHelixK(),mdcKalTrk2->getZErrorK() );
00162 
00163       //  all loop for the charged tracks overed here !!!!!!!
00164 
00166       HepPoint3D vx(xorigin.x(), xorigin.y(), xorigin.z());
00167       HepSymMatrix Evx(3, 0);
00168       double bx = 1E+6; Evx[0][0] = bx*bx;
00169       double by = 1E+6; Evx[1][1] = by*by;
00170       double bz = 1E+6; Evx[2][2] = bz*bz;
00171       VertexParameter vxpar; vxpar.setVx(vx); vxpar.setEvx(Evx);
00173 
00174       VertexFit* vtxfit = VertexFit::instance();
00175       vtxfit->init();
00176       vtxfit->AddTrack(0,  kap);
00177       vtxfit->AddTrack(1,  kam);
00178       vtxfit->AddVertex(0, vxpar, 0, 1);
00179       if(!vtxfit->Fit(0))  continue;
00180       vtxfit->Swim(0);
00181 
00182       WTrackParameter wkap = vtxfit->wtrk(0);
00183       WTrackParameter wkam = vtxfit->wtrk(1);
00184 
00185       HepVector kap_val = HepVector(7,0);
00186       kap_val = wkap.w();
00187       HepVector kam_val = HepVector(7,0);
00188       kam_val = wkam.w();
00189 
00190       HepLorentzVector P_KAP(kap_val[0],kap_val[1],kap_val[2],kap_val[3]);
00191       HepLorentzVector P_KAM(kam_val[0],kam_val[1],kam_val[2],kam_val[3]);
00192 
00193       P_KAP.boost(-0.011,0,0);
00194       P_KAM.boost(-0.011,0,0);
00195       pddd = P_KAP + P_KAM;
00196 
00197       double pkk=pddd.rho();
00198 
00199       double temp1 = (ecms/2)*(ecms/2)-pkk*pkk;
00200       if(temp1<0) temp1 =0;
00201       double mass_bc_tem  = sqrt(temp1);
00202       if(mass_bc_tem < 1.82 || mass_bc_tem > 1.89) continue;
00203       
00204       double  delE_tag_tag = ecms/2-pddd.e();
00205 
00206       if(fabs(delE_tag_tag)<deltaE_tem){
00207         deltaE_tem = fabs(delE_tag_tag);
00208         delE_tag_temp = delE_tag_tag;
00209         mass_bcgg = mass_bc_tem;
00210 
00211         pddd_temp = pddd;
00212         ika1_temp=ika1;
00213         ika2_temp=ika2;
00214         ncount1 = 1;
00215       }   
00216     }
00217   } 
00218 
00219   if(ncount1 == 1){  
00220     tagmode=15;
00221     if(m_chargetag<0)  tagmode=-15;
00222     tagmd=tagmode;
00223     mass_bc  = mass_bcgg;
00224     delE_tag = delE_tag_temp;
00225     cqtm     = -0.0; 
00226 
00227     iGoodtag.push_back(ika1_temp);
00228     iGoodtag.push_back(ika2_temp);
00229     iGamtag.push_back(9999);
00230     iGamtag.push_back(9999);
00231     iGamtag.push_back(9999);
00232     iGamtag.push_back(9999);
00233     
00234     ptag = pddd_temp;
00235 
00236     kkmd = true;
00237   }
00238 }
00239 
00240 
00241 

Generated on Tue Nov 29 23:13:58 2016 for BOSS_7.0.2 by  doxygen 1.4.7