36 iGam,
double Ebeam,
int PID_flag,
int Charge_candidate_D)
39 int nGood=iGood.size();
45 double mass_bcgg,delE_tag_temp;
46 int m_chargetag,m_chargepi1,m_chargepi2;
47 int ipi1_temp, ipi2_temp, iGam1_temp, iGam2_temp;
48 HepLorentzVector pddd, 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);
75 Gaudi::svcLocator()->service(
"VertexDbSvc", vtxsvc);
85 double xv=xorigin.x();
86 double yv=xorigin.y();
87 double zv=xorigin.z();
90 HepPoint3D IP(xorigin[0],xorigin[1],xorigin[2]);
93 HepLorentzVector p2gfit;
94 HepLorentzVector p2gg;
96 for(
int i = 0; i < evtRecEvent->totalCharged(); i++) {
99 int ipi1= (*itTrk)->trackId();
101 if(!(*itTrk)->isMdcKalTrackValid())
continue;
105 m_chargepi1=mdcKalTrk1->
charge();
106 if(
abs(m_chargepi1) != 1)
continue;
109 HepSymMatrix Ea1 = mdcKalTrk1->
getZError();
110 VFHelix helixip3_1(point0,a1,Ea1);
111 helixip3_1.
pivot(IP);
112 HepVector vecipa1 = helixip3_1.
a();
114 double dr1 = fabs(vecipa1[0]);
115 double dz1 = fabs(vecipa1[3]);
116 double costheta1 =
cos(mdcKalTrk1->
theta());
118 if ( dr1 >= 1.0)
continue;
119 if ( dz1 >= 10.0)
continue;
120 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_chargepi1 + m_chargepi2) != 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 >= 1.0)
continue;
156 if ( dz2 >= 10.0)
continue;
157 if ( fabs(costheta2) >= 0.93)
continue;
167 for(
int m = 0; m < nGam-1; m++) {
168 if(iGam[m]==-1)
continue;
170 RecEmcShower *g1Trk = (*(evtRecTrkCol->begin()+iGam[m]))->emcShower();
171 double eraw1 = g1Trk->
energy();
173 double the1 = g1Trk->
theta();
174 HepLorentzVector ptrkg1,ptrkg10,ptrkg12;
177 ptrkg1.setPz(eraw1*
cos(the1));
180 ptrkg12 = ptrkg1.boost(-0.011,0,0);
182 for(
int n = m+1;
n < nGam;
n++) {
183 if(iGam[
n]==-1)
continue;
184 RecEmcShower *g2Trk = (*(evtRecTrkCol->begin()+iGam[
n]))->emcShower();
186 double eraw2 = g2Trk->
energy();
188 double the2 = g2Trk->
theta();
189 HepLorentzVector ptrkg2,ptrkg20,ptrkg22;
192 ptrkg2.setPz(eraw2*
cos(the2));
195 ptrkg22 = ptrkg2.boost(-0.011,0,0);
198 HepLorentzVector ptrkpi0;
199 ptrkpi0 = ptrkg12+ptrkg22;
200 double m_xmpi0_tem = ptrkpi0.m();
201 if(m_xmpi0_tem>0.150||m_xmpi0_tem<0.115)
continue;
203 bool IsEndcap1 =
false;
bool IsEndcap2 =
false;
204 if(fabs(
cos(the1)) > 0.86 && fabs(
cos(the1)) < 0.92) IsEndcap1 =
true;
205 if(fabs(
cos(the2)) > 0.86 && fabs(
cos(the2)) < 0.92) IsEndcap2 =
true;
206 if(IsEndcap1 && IsEndcap2)
continue;
218 double pi0_chisq = kmfit->
chisq(0);
219 if ( pi0_chisq >= 2500)
continue;
220 HepLorentzVector p2gfit = kmfit->
pfit(0) + kmfit->
pfit(1);
221 p2gfit.boost(-0.011,0,0);
224 HepPoint3D vx(xorigin.x(), xorigin.y(), xorigin.z());
225 HepSymMatrix Evx(3, 0);
226 double bx = 1E+6; Evx[0][0] = bx*bx;
227 double by = 1E+6; Evx[1][1] = by*by;
228 double bz = 1E+6; Evx[2][2] = bz*bz;
237 if(!vtxfit->
Fit(0))
continue;
243 HepVector pip_val = HepVector(7,0);
244 HepVector pim_val = HepVector(7,0);
248 HepLorentzVector P_PIP(pip_val[0],pip_val[1],pip_val[2],pip_val[3]);
249 HepLorentzVector P_PIM(pim_val[0],pim_val[1],pim_val[2],pim_val[3]);
251 P_PIM.boost(-0.011,0,0);
252 P_PIP.boost(-0.011,0,0);
253 HepLorentzVector ppipi = P_PIM + P_PIP;
254 pddd = P_PIM + P_PIP + p2gfit;
256 double mpipi = ppipi.m();
259 double ppipipi0=pddd.rho();
261 double temp1 = (
ecms/2)*(
ecms/2)-ppipipi0*ppipipi0 ;
262 if(temp1<0) temp1 =0;
263 double mass_bc_tem = sqrt(temp1);
264 if(mass_bc_tem < 1.82 || mass_bc_tem > 1.89)
continue;
266 double delE_tag_tag =
ecms/2-pddd.e();
268 if(fabs(delE_tag_tag)<deltaE_tem) {
269 deltaE_tem = fabs(delE_tag_tag);
270 delE_tag_temp = delE_tag_tag;
271 mass_bcgg = mass_bc_tem;
289 if(m_chargetag<0) tagmode=-16;
292 delE_tag = delE_tag_temp;
295 iGoodtag.push_back(ipi1_temp);
296 iGoodtag.push_back(ipi2_temp);
297 iGamtag.push_back(iGam1_temp);
298 iGamtag.push_back(iGam2_temp);
299 iGamtag.push_back(9999);
300 iGamtag.push_back(9999);