35 iGam,
double Ebeam,
int PID_flag,
int Charge_candidate_D)
38 int nGood=iGood.size();
44 double mass_bcgg,delE_tag_temp;
45 int m_chargetag,m_chargepi1,m_chargepi2,m_chargek,m_chargepi3;
46 int ik1_temp,ipi1_temp,ipi2_temp,ipi3_temp;
47 HepLorentzVector pddd;
48 HepLorentzVector pddd_temp;
50 IDataProviderSvc* eventSvc =
NULL;
51 Gaudi::svcLocator()->service(
"EventDataSvc", eventSvc);
53 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc,
"/Event/EventHeader");
55 int runNo=eventHeader->runNumber();
56 int rec=eventHeader->eventNumber();
64 if((evtRecEvent->totalCharged() < 4)){
return; }
69 Gaudi::svcLocator()->service(
"SimplePIDSvc", simple_pid);
71 double deltaE_tem = 0.20;
74 Hep3Vector xorigin(0,0,0);
75 HepSymMatrix xoriginEx(3,0);
77 Gaudi::svcLocator()->service(
"VertexDbSvc", vtxsvc);
86 xoriginEx[0][0] = vv[0] * vv[0];
87 xoriginEx[1][1] = vv[1] * vv[1];
88 xoriginEx[2][2] = vv[2] * vv[2];
92 double xv=xorigin.x();
93 double yv=xorigin.y();
94 double zv=xorigin.z();
97 HepPoint3D IP(xorigin[0],xorigin[1],xorigin[2]);
99 for(
int i = 0; i < evtRecEvent->totalCharged(); i++) {
102 int ipi1= (*itTrk)->trackId();
104 if(!(*itTrk)->isMdcKalTrackValid())
continue;
108 m_chargepi1=mdcKalTrk1->
charge();
109 if(m_chargepi1 != 1)
continue;
113 HepSymMatrix Ea1 = mdcKalTrk1->
getZError();
115 VFHelix helixip3_1(point0,a1,Ea1);
116 helixip3_1.
pivot(IP);
117 HepVector vecipa1 = helixip3_1.
a();
119 double dr1 = fabs(vecipa1[0]);
120 double dz1 = fabs(vecipa1[3]);
121 double costheta1 =
cos(mdcKalTrk1->
theta());
123 if ( dr1 >= 15.0)
continue;
124 if ( dz1 >= 25.0)
continue;
125 if ( fabs(costheta1) >= 0.93)
continue;
132 for(
int j = 0; j < evtRecEvent->totalCharged(); j++) {
135 int ipi2= (*itTrk)->trackId();
136 if(ipi1==ipi2)
continue;
138 if(!(*itTrk)->isMdcKalTrackValid())
continue;
142 m_chargepi2=mdcKalTrk2->
charge();
143 if((m_chargepi2 + m_chargepi1) != 0)
continue;
147 HepSymMatrix Ea2 = mdcKalTrk2->
getZError();
148 VFHelix helixip3_2(point0,a2,Ea2);
149 helixip3_2.
pivot(IP);
150 HepVector vecipa2 = helixip3_2.
a();
152 double dr2 = fabs(vecipa2[0]);
153 double dz2 = fabs(vecipa2[3]);
154 double costheta2 =
cos(mdcKalTrk2->
theta());
155 if ( dr2 >= 15.0)
continue;
156 if ( dz2 >= 25.0)
continue;
157 if ( fabs(costheta2) >= 0.93)
continue;
161 HepVector pip_val = HepVector(7,0);
162 HepVector pim_val = HepVector(7,0);
165 HepLorentzVector ptrktagk0(pip_val[0]+pim_val[0],pip_val[1]+pim_val[1],pip_val[2]+pim_val[2],pip_val[3]+pim_val[3]);
166 double m_xmtagk0_tem = ptrktagk0.mag();
167 if(fabs(ptrktagk0.m()-0.498)>0.1)
continue;
169 HepPoint3D vx(xorigin.x(), xorigin.y(), xorigin.z());
170 HepSymMatrix Evx(3, 0);
171 double bx = 1E+6; Evx[0][0] = bx*bx;
172 double by = 1E+6; Evx[1][1] = by*by;
173 double bz = 1E+6; Evx[2][2] = bz*bz;
181 if(!(vtxfit0->
Fit(0)))
continue;
191 for(
int k = 0; k < evtRecEvent->totalCharged(); k++) {
194 int ik1 = (*itTrk)->trackId();
195 if(ipi2==ik1 || ipi1==ik1)
continue;
197 if(!(*itTrk)->isMdcKalTrackValid())
continue;
201 m_chargek = mdcKalTrk3->
charge();
202 if(
abs(m_chargek) != 1)
continue;
207 VFHelix helixip3_3(point0,a3,Ea3);
208 helixip3_3.
pivot(IP);
209 HepVector vecipa3 = helixip3_3.
a();
211 double dr3 = fabs(vecipa3[0]);
212 double dz3 = fabs(vecipa3[3]);
213 double costheta3 =
cos(mdcKalTrk3->
theta());
214 if ( dr3 >= 1.0)
continue;
215 if ( dz3 >= 10.0)
continue;
216 if ( fabs(costheta3) >= 0.93)
continue;
228 for(
int l = 0; l < evtRecEvent->totalCharged(); l++) {
231 int ipi3= (*itTrk)->trackId();
232 if(ipi3==ik1 || ipi3==ipi2 || ipi3 ==ipi1)
continue;
234 if(!(*itTrk)->isMdcKalTrackValid())
continue;
238 m_chargepi3 = mdcKalTrk4->
charge();
239 if((m_chargepi3 + m_chargek) != 0)
continue;
243 HepSymMatrix Ea4 = mdcKalTrk4->
getZError();
244 VFHelix helixip3_4(point0,a4,Ea4);
245 helixip3_4.
pivot(IP);
246 HepVector vecipa4 = helixip3_4.
a();
248 double dr4 = fabs(vecipa4[0]);
249 double dz4 = fabs(vecipa4[3]);
250 double costheta4 =
cos(mdcKalTrk4->
theta());
251 if ( dr4 >= 1.0)
continue;
252 if ( dz4 >= 10.0)
continue;
253 if ( fabs(costheta4) >= 0.93)
continue;
267 if(!vtxfit_2->
Fit(0))
continue;
279 if(!vtxfit->
Fit())
continue;
281 if(vtxfit->
chisq() > 999.)
continue;
284 double m_massks1_tem = vtxfit->
p4par().m();
285 if(m_massks1_tem < 0.485 || m_massks1_tem > 0.515)
continue;
286 HepLorentzVector p4kstag = vtxfit->
p4par();
289 HepVector ka_val = HepVector(7,0);
290 HepVector pi_val = HepVector(7,0);
291 HepVector ksp_val = HepVector(7,0);
292 HepVector ksm_val = HepVector(7,0);
299 HepLorentzVector P_KA(ka_val[0],ka_val[1],ka_val[2],ka_val[3]);
300 HepLorentzVector P_PI(pi_val[0],pi_val[1],pi_val[2],pi_val[3]);
301 HepLorentzVector P_KSP(ksp_val[0],ksp_val[1],ksp_val[2],ksp_val[3]);
302 HepLorentzVector P_KSM(ksm_val[0],ksm_val[1],ksm_val[2],ksm_val[3]);
304 P_KA.boost(-0.011,0,0);
305 P_PI.boost(-0.011,0,0);
306 P_KSP.boost(-0.011,0,0);
307 P_KSM.boost(-0.011,0,0);
309 p4kstag.boost(-0.011,0,0);
311 pddd = P_KA + P_PI + p4kstag;
313 double pk0kpi=pddd.rho();
315 double temp1 = (
ecms/2)*(
ecms/2)-pk0kpi*pk0kpi ;
316 if(temp1<0) temp1 =0;
317 double mass_bc_tem = sqrt(temp1);
318 if(mass_bc_tem < 1.82 || mass_bc_tem > 1.89)
continue;
320 double delE_tag_tag =
ecms/2-pddd.e();
322 if(fabs(delE_tag_tag)<deltaE_tem) {
323 deltaE_tem = fabs(delE_tag_tag);
324 delE_tag_temp = delE_tag_tag;
325 mass_bcgg = mass_bc_tem;
344 if(m_chargetag<0) tagmode=-21;
347 delE_tag = delE_tag_temp;
350 iGoodtag.push_back(ipi1_temp);
351 iGoodtag.push_back(ipi2_temp);
352 iGoodtag.push_back(ik1_temp);
353 iGoodtag.push_back(ipi3_temp);
355 iGamtag.push_back(9999);
356 iGamtag.push_back(9999);
357 iGamtag.push_back(9999);
358 iGamtag.push_back(9999);