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;
46 int ika_temp,ipi1_temp,ipi2_temp,ipi3_temp, iGam1_temp, iGam2_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();
63 if((evtRecEvent->totalCharged() < 2||nGam<2)){
return; }
68 Gaudi::svcLocator()->service(
"SimplePIDSvc", simple_pid);
70 double deltaE_tem = 0.20;
73 Hep3Vector xorigin(0,0,0);
74 HepSymMatrix xoriginEx(3,0);
76 Gaudi::svcLocator()->service(
"VertexDbSvc", vtxsvc);
85 xoriginEx[0][0] = vv[0] * vv[0];
86 xoriginEx[1][1] = vv[1] * vv[1];
87 xoriginEx[2][2] = vv[2] * vv[2];
91 double xv=xorigin.x();
92 double yv=xorigin.y();
93 double zv=xorigin.z();
96 HepPoint3D IP(xorigin[0],xorigin[1],xorigin[2]);
98 HepLorentzVector p2gfit;
99 HepLorentzVector p2gg;
101 for(
int i = 0; i < evtRecEvent->totalCharged(); i++) {
104 int ipi1= (*itTrk)->trackId();
106 if(!(*itTrk)->isMdcKalTrackValid())
continue;
110 m_chargepi1=mdcKalTrk1->
charge();
111 if(m_chargepi1 != 1)
continue;
115 HepSymMatrix Ea1 = mdcKalTrk1->
getZError();
117 VFHelix helixip3_1(point0,a1,Ea1);
118 helixip3_1.
pivot(IP);
119 HepVector vecipa1 = helixip3_1.
a();
121 double dr1 = fabs(vecipa1[0]);
122 double dz1 = fabs(vecipa1[3]);
123 double costheta1 =
cos(mdcKalTrk1->
theta());
125 if ( dr1 >= 15.0)
continue;
126 if ( dz1 >= 25.0)
continue;
127 if ( fabs(costheta1) >= 0.93)
continue;
134 for(
int j = 0; j < evtRecEvent->totalCharged();j++) {
137 int ipi2= (*itTrk)->trackId();
138 if(ipi1==ipi2)
continue;
140 if(!(*itTrk)->isMdcKalTrackValid())
continue;
144 m_chargepi2=mdcKalTrk2->
charge();
145 if((m_chargepi1 + m_chargepi2) != 0)
continue;
149 HepSymMatrix Ea2 = mdcKalTrk2->
getZError();
150 VFHelix helixip3_2(point0,a2,Ea2);
151 helixip3_2.
pivot(IP);
152 HepVector vecipa2 = helixip3_2.
a();
154 double dr2 = fabs(vecipa2[0]);
155 double dz2 = fabs(vecipa2[3]);
156 double costheta2 =
cos(mdcKalTrk2->
theta());
157 if ( dr2 >= 15.0)
continue;
158 if ( dz2 >= 25.0)
continue;
159 if ( fabs(costheta2) >= 0.93)
continue;
163 HepVector pip_val = HepVector(7,0);
164 HepVector pim_val = HepVector(7,0);
167 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]);
168 double m_xmtagk0_tem = ptrktagk0.mag();
169 if(fabs(ptrktagk0.m()-0.498)>0.1)
continue;
171 HepPoint3D vx(xorigin.x(), xorigin.y(), xorigin.z());
172 HepSymMatrix Evx(3, 0);
173 double bx = 1E+6; Evx[0][0] = bx*bx;
174 double by = 1E+6; Evx[1][1] = by*by;
175 double bz = 1E+6; Evx[2][2] = bz*bz;
183 if(!(vtxfit0->
Fit(0)))
continue;
197 if(!vtxfit->
Fit())
continue;
199 if(vtxfit->
chisq() > 999.)
continue;
202 double m_massks1_tem = vtxfit->
p4par().m();
203 if(m_massks1_tem < 0.485 || m_massks1_tem > 0.515)
continue;
204 HepLorentzVector p4kstag = vtxfit->
p4par();
205 p4kstag.boost(-0.011,0,0);
208 for(
int m = 0; m < nGam-1; m++) {
209 if(iGam[m]==-1)
continue;
210 RecEmcShower *g1Trk = (*(evtRecTrkCol->begin()+iGam[m]))->emcShower();
211 double eraw1 = g1Trk->
energy();
213 double the1 = g1Trk->
theta();
214 HepLorentzVector ptrkg1,ptrkg10,ptrkg12;
217 ptrkg1.setPz(eraw1*
cos(the1));
220 ptrkg12 = ptrkg1.boost(-0.011,0,0);
222 for(
int n = m+1;
n < nGam;
n++) {
223 if(iGam[
n]==-1)
continue;
224 RecEmcShower *g2Trk = (*(evtRecTrkCol->begin()+iGam[
n]))->emcShower();
225 double eraw2 = g2Trk->
energy();
227 double the2 = g2Trk->
theta();
228 HepLorentzVector ptrkg2,ptrkg20,ptrkg22;
231 ptrkg2.setPz(eraw2*
cos(the2));
234 ptrkg22 = ptrkg2.boost(-0.011,0,0);
237 HepLorentzVector ptrkpi0;
238 ptrkpi0 = ptrkg12+ptrkg22;
239 double m_xmpi0_tem = ptrkpi0.m();
240 if(m_xmpi0_tem>0.150||m_xmpi0_tem<0.115)
continue;
242 bool IsEndcap1 =
false;
bool IsEndcap2 =
false;
243 if(fabs(
cos(the1)) > 0.86 && fabs(
cos(the1)) < 0.92) IsEndcap1 =
true;
244 if(fabs(
cos(the2)) > 0.86 && fabs(
cos(the2)) < 0.92) IsEndcap2 =
true;
245 if(IsEndcap1 && IsEndcap2)
continue;
257 double pi0_chisq = kmfit->
chisq(0);
258 if ( pi0_chisq >= 2500)
continue;
259 HepLorentzVector p2gfit = kmfit->
pfit(0) + kmfit->
pfit(1);
260 p2gfit.boost(-0.011,0,0);
263 HepVector ksp_val = HepVector(7,0);
264 HepVector ksm_val = HepVector(7,0);
268 HepLorentzVector P_KSP(ksp_val[0],ksp_val[1],ksp_val[2],ksp_val[3]);
269 HepLorentzVector P_KSM(ksm_val[0],ksm_val[1],ksm_val[2],ksm_val[3]);
271 P_KSP.boost(-0.011,0,0);
272 P_KSM.boost(-0.011,0,0);
273 pddd = p4kstag + p2gfit;
275 double pk0pi0=pddd.rho();
277 double temp1 = (
ecms/2)*(
ecms/2)-pk0pi0*pk0pi0 ;
278 if(temp1<0) temp1 =0;
279 double mass_bc_tem = sqrt(temp1);
280 if(mass_bc_tem < 1.82 || mass_bc_tem > 1.89)
continue;
282 double delE_tag_tag =
ecms/2-pddd.e();
284 if(fabs(delE_tag_tag)<deltaE_tem){
285 deltaE_tem = fabs(delE_tag_tag);
286 delE_tag_temp = delE_tag_tag;
287 mass_bcgg = mass_bc_tem;
294 iGam1_temp = iGam[m];
295 iGam2_temp = iGam[
n];
306 if(m_chargetag<0) tagmode=-18;
309 delE_tag = delE_tag_temp;
312 iGoodtag.push_back(ipi1_temp);
313 iGoodtag.push_back(ipi2_temp);
314 iGamtag.push_back(iGam1_temp);
315 iGamtag.push_back(iGam2_temp);
316 iGamtag.push_back(9999);
317 iGamtag.push_back(9999);