00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include "SD0TagAlg/Pipi.h"
00025 #include "SD0TagAlg/SingleBase.h"
00026
00027
00028 Pipi::Pipi()
00029 {}
00030
00031 Pipi::~Pipi()
00032 {}
00033
00034
00035 void Pipi::MTotal(double event,SmartDataPtr<EvtRecTrackCol> evtRecTrkCol, Vint iGood,Vint
00036 iGam, double Ebeam, int PID_flag, int Charge_candidate_D)
00037 {
00038
00039 int nGood=iGood.size();
00040 int nGam=iGam.size();
00041
00042 iGoodtag.clear();
00043 iGamtag.clear();
00044
00045 double mass_bcgg, delE_tag_temp;
00046 int m_chargetag,m_chargepi1,m_chargepi2;
00047 int ipi1_temp,ipi2_temp,ipi3_temp;
00048 HepLorentzVector kmfit1,kmfit2,kmfit3,kmfit4,pddd;
00049
00050 HepLorentzVector pddd_temp;
00051 IDataProviderSvc* eventSvc = NULL;
00052 Gaudi::svcLocator()->service("EventDataSvc", eventSvc);
00053 SmartDataPtr<EvtRecEvent> evtRecEvent(eventSvc,EventModel::EvtRec::EvtRecEvent);
00054 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc,"/Event/EventHeader");
00055
00056 int runNo=eventHeader->runNumber();
00057 int rec=eventHeader->eventNumber();
00058
00059 double xecm=2*Ebeam;
00060
00061 pipimd=false;
00062 double tagmode=0;
00063
00064 if((evtRecEvent->totalCharged() < 2)){ return; }
00065
00066 double ecms = xecm;
00067
00068 ISimplePIDSvc* simple_pid;
00069 Gaudi::svcLocator()->service("SimplePIDSvc", simple_pid);
00070
00071 double deltaE_tem = 0.20;
00072 int ncount1 = 0;
00073
00074 Hep3Vector xorigin(0,0,0);
00075 IVertexDbSvc* vtxsvc;
00076 Gaudi::svcLocator()->service("VertexDbSvc", vtxsvc);
00077 if(vtxsvc->isVertexValid())
00078 {
00079 double* dbv = vtxsvc->PrimaryVertex();
00080 double* vv = vtxsvc->SigmaPrimaryVertex();
00081 xorigin.setX(dbv[0]);
00082 xorigin.setY(dbv[1]);
00083 xorigin.setZ(dbv[2]);
00084 }
00085
00086 double xv=xorigin.x();
00087 double yv=xorigin.y();
00088 double zv=xorigin.z();
00089
00090 HepPoint3D point0(0.,0.,0.);
00091 HepPoint3D IP(xorigin[0],xorigin[1],xorigin[2]);
00093 for(int i = 0; i < evtRecEvent->totalCharged(); i++) {
00094 EvtRecTrackIterator itTrk = evtRecTrkCol->begin() + i;
00095
00096 int ipi1= (*itTrk)->trackId();
00097
00098 if(!(*itTrk)->isMdcKalTrackValid()) continue;
00099 RecMdcKalTrack* mdcKalTrk1 = (*itTrk)->mdcKalTrack();
00100 RecMdcKalTrack::setPidType(RecMdcKalTrack::pion);
00101
00102 m_chargepi1=mdcKalTrk1->charge();
00103 if(abs(m_chargepi1) != 1) continue;
00104
00106 HepVector a1 = mdcKalTrk1->getZHelix();
00107 HepSymMatrix Ea1 = mdcKalTrk1->getZError();
00108
00109 VFHelix helixip3_1(point0,a1,Ea1);
00110 helixip3_1.pivot(IP);
00111 HepVector vecipa1 = helixip3_1.a();
00112
00113 double dr1 = fabs(vecipa1[0]);
00114 double dz1 = fabs(vecipa1[3]);
00115 double costheta1 = cos(mdcKalTrk1->theta());
00116
00117 if ( dr1 >= 1.0) continue;
00118 if ( dz1 >= 10.0) continue;
00119 if ( fabs(costheta1) >= 0.93) continue;
00121 if(PID_flag == 5) {
00122 simple_pid->preparePID(*itTrk);
00123 if(simple_pid->probPion() < 0.0 || simple_pid->probPion() < simple_pid->probKaon()) continue;
00124 }
00126 WTrackParameter pip(xmass[2],mdcKalTrk1->getZHelix(),mdcKalTrk1->getZError());
00127
00128
00129
00130
00131 for(int j = 0; j< evtRecEvent->totalCharged();j++) {
00132 EvtRecTrackIterator itTrk = evtRecTrkCol->begin() + j;
00133
00134 int ipi2= (*itTrk)->trackId();
00135 if(ipi1==ipi2) continue;
00136
00137 if(!(*itTrk)->isMdcKalTrackValid()) continue;
00138 RecMdcKalTrack* mdcKalTrk2 = (*itTrk)->mdcKalTrack();
00139 RecMdcKalTrack::setPidType(RecMdcKalTrack::pion);
00140
00141 m_chargepi2=mdcKalTrk2->charge();
00142 if((m_chargepi1 + m_chargepi2) != 0) continue;
00143
00145 HepVector a2 = mdcKalTrk2->getZHelix();
00146 HepSymMatrix Ea2 = mdcKalTrk2->getZError();
00147 VFHelix helixip3_2(point0,a2,Ea2);
00148 helixip3_2.pivot(IP);
00149 HepVector vecipa2 = helixip3_2.a();
00150
00151 double dr2 = fabs(vecipa2[0]);
00152 double dz2 = fabs(vecipa2[3]);
00153 double costheta2 = cos(mdcKalTrk2->theta());
00154 if ( dr2 >= 1.0) continue;
00155 if ( dz2 >= 10.0) continue;
00156 if ( fabs(costheta2) >= 0.93) continue;
00158 if(PID_flag == 5) {
00159 simple_pid->preparePID(*itTrk);
00160 if(simple_pid->probPion() < 0.0 || simple_pid->probPion() < simple_pid->probKaon()) continue;
00161 }
00163 WTrackParameter pim(xmass[2],mdcKalTrk2->getZHelix(),mdcKalTrk2->getZError());
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, pip);
00177 vtxfit->AddTrack(1, pim);
00178 vtxfit->AddVertex(0, vxpar, 0, 1);
00179 if(!vtxfit->Fit(0)) continue;
00180 vtxfit->Swim(0);
00181
00182 WTrackParameter wpip = vtxfit->wtrk(0);
00183 WTrackParameter wpim = vtxfit->wtrk(1);
00184
00185 HepVector pip_val = HepVector(7,0);
00186 pip_val = wpip.w();
00187 HepVector pim_val = HepVector(7,0);
00188 pim_val = wpim.w();
00189
00190 HepLorentzVector P_PIP(pip_val[0],pip_val[1],pip_val[2],pip_val[3]);
00191 HepLorentzVector P_PIM(pim_val[0],pim_val[1],pim_val[2],pim_val[3]);
00192
00193 P_PIP.boost(-0.011,0,0);
00194 P_PIM.boost(-0.011,0,0);
00195 pddd = P_PIP + P_PIM;
00196
00197 double ppipi = pddd.rho();
00198
00199 double temp1 = (ecms/2)*(ecms/2)-ppipi*ppipi;
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
00213 ipi1_temp=ipi1;
00214 ipi2_temp=ipi2;
00215
00216 ncount1 = 1;
00217 }
00218 }
00219 }
00220
00221 if(ncount1 == 1){
00222 tagmode=19;
00223 if(m_chargetag<0) tagmode=-19;
00224 tagmd=tagmode;
00225 mass_bc = mass_bcgg;
00226 delE_tag = delE_tag_temp;
00227 cqtm = -0.0;
00228
00229 iGoodtag.push_back(ipi1_temp);
00230 iGoodtag.push_back(ipi2_temp);
00231
00232 iGamtag.push_back(9999);
00233 iGamtag.push_back(9999);
00234 iGamtag.push_back(9999);
00235 iGamtag.push_back(9999);
00236
00237 ptag = pddd_temp;
00238
00239 pipimd=true;
00240
00241 }
00242 }