00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include "SD0TagAlg/Kkpipi.h"
00024 #include "SD0TagAlg/SingleBase.h"
00025
00026 Kkpipi::Kkpipi()
00027 {}
00028
00029 Kkpipi::~Kkpipi()
00030 {}
00031
00032
00033 void Kkpipi::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_chargek1,m_chargek2,m_chargepi1,m_chargepi2;
00045 int ik1_temp, ik2_temp, ipi1_temp, ipi2_temp;
00046 HepLorentzVector pddd;
00047 HepLorentzVector pddd_temp;
00048
00049 IDataProviderSvc* eventSvc = NULL;
00050 Gaudi::svcLocator()->service("EventDataSvc", eventSvc);
00051 SmartDataPtr<EvtRecEvent> evtRecEvent(eventSvc, EventModel::EvtRec::EvtRecEvent);
00052 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc,"/Event/EventHeader");
00053
00054 int runNo=eventHeader->runNumber();
00055 int rec=eventHeader->eventNumber();
00056
00057 double xecm=2*Ebeam;
00058
00059 kkpipimd=false;
00060 double tagmode=0;
00061
00062 if((evtRecEvent->totalCharged() < 4)){ return; }
00063
00064 double ecms = xecm;
00065
00066 ISimplePIDSvc* simple_pid;
00067 Gaudi::svcLocator()->service("SimplePIDSvc", simple_pid);
00068
00069 double deltaE_tem = 0.20;
00070 int ncount1 = 0;
00071
00072 Hep3Vector xorigin(0,0,0);
00073 IVertexDbSvc* vtxsvc;
00074 Gaudi::svcLocator()->service("VertexDbSvc", vtxsvc);
00075 if(vtxsvc->isVertexValid())
00076 {
00077 double* dbv = vtxsvc->PrimaryVertex();
00078 double* vv = vtxsvc->SigmaPrimaryVertex();
00079 xorigin.setX(dbv[0]);
00080 xorigin.setY(dbv[1]);
00081 xorigin.setZ(dbv[2]);
00082 }
00083
00084 double xv=xorigin.x();
00085 double yv=xorigin.y();
00086 double zv=xorigin.z();
00087
00088 HepPoint3D point0(0.,0.,0.);
00089 HepPoint3D IP(xorigin[0],xorigin[1],xorigin[2]);
00091 for(int i = 0; i < evtRecEvent->totalCharged(); i++) {
00092 EvtRecTrackIterator itTrk = evtRecTrkCol->begin() + i;
00093
00094 int ik1 = (*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 || simple_pid->probKaon() < simple_pid->probPion()) continue;
00122 }
00124
00125 WTrackParameter kap(xmass[3],mdcKalTrk1->getZHelixK(),mdcKalTrk1->getZErrorK() );
00126
00127
00128
00129
00130 for(int j = 0; j< evtRecEvent->totalCharged();j++) {
00131 EvtRecTrackIterator itTrk = evtRecTrkCol->begin() + j;
00132
00133 int ik2 = (*itTrk)->trackId();
00134 if(ik1==ik2) continue;
00135
00136 if(!(*itTrk)->isMdcKalTrackValid()) continue;
00137 RecMdcKalTrack* mdcKalTrk2 = (*itTrk)->mdcKalTrack();
00138 RecMdcKalTrack::setPidType(RecMdcKalTrack::kaon);
00139
00140 m_chargek2=mdcKalTrk2->charge();
00141 if((m_chargek1 + m_chargek2) != 0) continue;
00142
00144 HepVector a2 = mdcKalTrk2->getZHelixK();
00145 HepSymMatrix Ea2 = mdcKalTrk2->getZErrorK();
00146 VFHelix helixip3_2(point0,a2,Ea2);
00147 helixip3_2.pivot(IP);
00148 HepVector vecipa2 = helixip3_2.a();
00149
00150 double dr2 = fabs(vecipa2[0]);
00151 double dz2 = fabs(vecipa2[3]);
00152 double costheta2 = cos(mdcKalTrk2->theta());
00153 if ( dr2 >= 1.0) continue;
00154 if ( dz2 >= 10.0) continue;
00155 if ( fabs(costheta2) >= 0.93) continue;
00157 if(PID_flag == 5) {
00158 simple_pid->preparePID(*itTrk);
00159 if(simple_pid->probKaon() < 0 || simple_pid->probKaon() < simple_pid->probPion()) continue;
00160 }
00162
00163 WTrackParameter kam(xmass[3],mdcKalTrk2->getZHelixK(),mdcKalTrk2->getZErrorK() );
00164
00165
00166
00167
00168 for(int k = 0; k< evtRecEvent->totalCharged(); k++) {
00169 EvtRecTrackIterator itTrk = evtRecTrkCol->begin() + k;
00170
00171 int ipi1= (*itTrk)->trackId();
00172 if(ipi1==ik1 || ipi1==ik2) continue;
00173
00174 if(!(*itTrk)->isMdcKalTrackValid()) continue;
00175 RecMdcKalTrack* mdcKalTrk3 = (*itTrk)->mdcKalTrack();
00176 RecMdcKalTrack::setPidType(RecMdcKalTrack::pion);
00177
00178 m_chargepi1=mdcKalTrk3->charge();
00179 if(m_chargepi1 != 1) continue;
00180
00182 HepVector a3 = mdcKalTrk3->getZHelix();
00183 HepSymMatrix Ea3 = mdcKalTrk3->getZError();
00184 VFHelix helixip3_3(point0,a3,Ea3);
00185 helixip3_3.pivot(IP);
00186 HepVector vecipa3 = helixip3_3.a();
00187
00188 double dr3 = fabs(vecipa3[0]);
00189 double dz3 = fabs(vecipa3[3]);
00190 double costheta3 = cos(mdcKalTrk3->theta());
00191 if ( dr3 >= 1.0) continue;
00192 if ( dz3 >= 10.0) continue;
00193 if ( fabs(costheta3) >= 0.93) continue;
00195 if(PID_flag == 5) {
00196 simple_pid->preparePID(*itTrk);
00197 if(simple_pid->probPion() < 0.0 || simple_pid->probPion() < simple_pid->probKaon()) continue;
00198 }
00200 WTrackParameter pip(xmass[2],mdcKalTrk3->getZHelix(),mdcKalTrk3->getZError() );
00201
00202
00203
00204
00205 for(int l = 0; l< evtRecEvent->totalCharged();l++) {
00206 EvtRecTrackIterator itTrk = evtRecTrkCol->begin() + l;
00207
00208 int ipi2= (*itTrk)->trackId();
00209 if(ipi2==ik1 || ipi2==ik2 || ipi2==ipi1 ) continue;
00210
00211 if(!(*itTrk)->isMdcKalTrackValid()) continue;
00212 RecMdcKalTrack* mdcKalTrk4 = (*itTrk)->mdcKalTrack();
00213 RecMdcKalTrack::setPidType(RecMdcKalTrack::pion);
00214
00215 m_chargepi2 = mdcKalTrk4->charge();
00216 if((m_chargepi1 + m_chargepi2) != 0) continue;
00217
00219 HepVector a4 = mdcKalTrk4->getZHelix();
00220 HepSymMatrix Ea4 = mdcKalTrk4->getZError();
00221 VFHelix helixip3_4(point0,a4,Ea4);
00222 helixip3_4.pivot(IP);
00223 HepVector vecipa4 = helixip3_4.a();
00224
00225 double dr4 = fabs(vecipa4[0]);
00226 double dz4 = fabs(vecipa4[3]);
00227 double costheta4 = cos(mdcKalTrk4->theta());
00228 if ( dr4 >= 1.0) continue;
00229 if ( dz4 >= 10.0) continue;
00230 if ( fabs(costheta4) >= 0.93) continue;
00232 if(PID_flag == 5) {
00233 simple_pid->preparePID(*itTrk);
00234 if(simple_pid->probPion() < 0.0 || simple_pid->probPion() < simple_pid->probKaon()) continue;
00235 }
00237
00238 WTrackParameter pim(xmass[2],mdcKalTrk4->getZHelix(),mdcKalTrk4->getZError() );
00239
00241 HepPoint3D vx(xorigin.x(), xorigin.y(), xorigin.z());
00242 HepSymMatrix Evx(3, 0);
00243 double bx = 1E+6; Evx[0][0] = bx*bx;
00244 double by = 1E+6; Evx[1][1] = by*by;
00245 double bz = 1E+6; Evx[2][2] = bz*bz;
00246 VertexParameter vxpar; vxpar.setVx(vx); vxpar.setEvx(Evx);
00248
00249 VertexFit* vtxfit = VertexFit::instance();
00250 vtxfit->init();
00251 vtxfit->AddTrack(0, kap);
00252 vtxfit->AddTrack(1, kam);
00253 vtxfit->AddTrack(2, pip);
00254 vtxfit->AddTrack(3, pim);
00255 vtxfit->AddVertex(0, vxpar, 0, 1, 2, 3);
00256 if(!vtxfit->Fit(0)) continue;
00257 vtxfit->Swim(0);
00258
00259 WTrackParameter wkap = vtxfit->wtrk(0);
00260 WTrackParameter wkam = vtxfit->wtrk(1);
00261 WTrackParameter wpip = vtxfit->wtrk(2);
00262 WTrackParameter wpim = vtxfit->wtrk(3);
00263
00264 HepVector kap_val = HepVector(7,0);
00265 HepVector kam_val = HepVector(7,0);
00266 HepVector pip_val = HepVector(7,0);
00267 HepVector pim_val = HepVector(7,0);
00268 kap_val = wkap.w();
00269 kam_val = wkam.w();
00270 pip_val = wpip.w();
00271 pim_val = wpim.w();
00272
00273 HepLorentzVector P_KAP(kap_val[0],kap_val[1],kap_val[2],kap_val[3]);
00274 HepLorentzVector P_KAM(kam_val[0],kam_val[1],kam_val[2],kam_val[3]);
00275 HepLorentzVector P_PIP(pip_val[0],pip_val[1],pip_val[2],pip_val[3]);
00276 HepLorentzVector P_PIM(pim_val[0],pim_val[1],pim_val[2],pim_val[3]);
00277
00278 P_KAP.boost(-0.011,0,0);
00279 P_KAM.boost(-0.011,0,0);
00280 P_PIP.boost(-0.011,0,0);
00281 P_PIM.boost(-0.011,0,0);
00282 pddd = P_KAP + P_KAM + P_PIP + P_PIM;
00283
00284 double pkkpipi=pddd.rho();
00285
00286 double temp1 = (ecms/2)*(ecms/2)-pkkpipi*pkkpipi ;
00287 if(temp1<0) temp1 =0;
00288 double mass_bc_tem = sqrt(temp1);
00289 if(mass_bc_tem < 1.82 || mass_bc_tem > 1.89) continue;
00290
00291 double delE_tag_tag = ecms/2-pddd.e();
00292
00293 if(fabs(delE_tag_tag)<deltaE_tem) {
00294 deltaE_tem = fabs(delE_tag_tag);
00295 delE_tag_temp = delE_tag_tag;
00296 mass_bcgg = mass_bc_tem;
00297
00298 pddd_temp = pddd;
00299
00300 ik1_temp=ik1;
00301 ik2_temp=ik2;
00302 ipi1_temp=ipi1;
00303 ipi2_temp=ipi2;
00304 ncount1 = 1;
00305
00306 }
00307 }
00308 }
00309 }
00310 }
00311
00312 if(ncount1 == 1){
00313 tagmode=20;
00314 if(m_chargetag<0) tagmode=-20;
00315 tagmd=tagmode;
00316 mass_bc = mass_bcgg;
00317 delE_tag = delE_tag_temp;
00318 cqtm = 0.0;
00319
00320 iGoodtag.push_back(ik1_temp);
00321 iGoodtag.push_back(ik2_temp);
00322 iGoodtag.push_back(ipi1_temp);
00323 iGoodtag.push_back(ipi2_temp);
00324
00325 iGamtag.push_back(9999);
00326 iGamtag.push_back(9999);
00327 iGamtag.push_back(9999);
00328 iGamtag.push_back(9999);
00329
00330 ptag = pddd_temp;
00331
00332 kkpipimd=true;
00333
00334 }
00335 }
00336
00337
00338