37 iGam,
double Ebeam,
int PID_flag,
int Charge_candidate_D)
40 int nGood=iGood.size();
46 double mass_bcgg,delE_tag_temp;
47 int m_chargetag, m_chargek,m_chargepi;
48 int ika_temp,ipi_temp, iGam1_temp, iGam2_temp, iGam3_temp, iGam4_temp;
49 HepLorentzVector pddd;
50 HepLorentzVector pddd_temp;
53 IDataProviderSvc* eventSvc = NULL;
54 Gaudi::svcLocator()->service(
"EventDataSvc", eventSvc);
56 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc,
"/Event/EventHeader");
58 int runNo=eventHeader->runNumber();
59 int rec=eventHeader->eventNumber();
66 if((evtRecEvent->totalCharged() < 2||nGam<4)){
return; }
72 Gaudi::svcLocator()->service(
"SimplePIDSvc", simple_pid);
74 double deltaE_tem = 0.20;
77 Hep3Vector xorigin(0,0,0);
79 Gaudi::svcLocator()->service(
"VertexDbSvc", vtxsvc);
89 double xv=xorigin.x();
90 double yv=xorigin.y();
91 double zv=xorigin.z();
94 HepPoint3D IP(xorigin[0],xorigin[1],xorigin[2]);
96 HepLorentzVector p2gfit1, p2gfit2;
97 HepLorentzVector p2gg;
99 HepLorentzVector ptrk1_temp, ptrk2_temp, ptrk3_temp, ptrk4_temp, ptrk5_temp, ptrk6_temp, ptrk7_temp, ptrk8_temp;
100 for(
int i = 0; i < evtRecEvent->totalCharged(); i++) {
103 int ika= (*itTrk)->trackId();
105 if(!(*itTrk)->isMdcKalTrackValid())
continue;
109 m_chargek=mdcKalTrk1->
charge();
110 if(Charge_candidate_D != 0) {
111 if(m_chargek != -Charge_candidate_D)
continue;
113 if(Charge_candidate_D == 0) {
114 if(
abs(m_chargek) != 1)
continue;
119 VFHelix helixip3_1(point0,a1,Ea1);
120 helixip3_1.
pivot(IP);
121 HepVector vecipa1 = helixip3_1.
a();
123 double dr1 = fabs(vecipa1[0]);
124 double dz1 = fabs(vecipa1[3]);
125 double costheta1 =
cos(mdcKalTrk1->
theta());
126 if ( dr1 >= 1.0)
continue;
127 if ( dz1 >= 10.0)
continue;
128 if ( fabs(costheta1) >= 0.93)
continue;
142 for(
int j = 0; j< evtRecEvent->totalCharged(); j++) {
145 int ipi= (*itTrk)->trackId();
146 if(ipi==ika)
continue;
148 if(!(*itTrk)->isMdcKalTrackValid())
continue;
152 m_chargepi=mdcKalTrk2->
charge();
153 if((m_chargek + m_chargepi) != 0)
continue;
156 HepSymMatrix Ea2 = mdcKalTrk2->
getZError();
157 VFHelix helixip3_2(point0,a2,Ea2);
158 helixip3_2.
pivot(IP);
159 HepVector vecipa2 = helixip3_2.
a();
161 double dr2 = fabs(vecipa2[0]);
162 double dz2 = fabs(vecipa2[3]);
163 double costheta2 =
cos(mdcKalTrk2->
theta());
164 if ( dr2 >= 1.0)
continue;
165 if ( dz2 >= 10.0)
continue;
166 if ( fabs(costheta2) >= 0.93)
continue;
176 for(
int m = 0; m < nGam-1; m++) {
177 if(iGam[m]==-1)
continue;
178 RecEmcShower *g1Trk = (*(evtRecTrkCol->begin()+iGam[m]))->emcShower();
179 double eraw1 = g1Trk->
energy();
181 double the1 = g1Trk->
theta();
182 HepLorentzVector ptrkg1,ptrkg10,ptrkg12;
185 ptrkg1.setPz(eraw1*
cos(the1));
188 ptrkg12 = ptrkg1.boost(-0.011,0,0);
190 for(
int n = m+1;
n < nGam;
n++) {
191 if(iGam[
n]==-1)
continue;
192 RecEmcShower *g2Trk = (*(evtRecTrkCol->begin()+iGam[
n]))->emcShower();
193 double eraw2 = g2Trk->
energy();
195 double the2 = g2Trk->
theta();
196 HepLorentzVector ptrkg2,ptrkg20,ptrkg22;
199 ptrkg2.setPz(eraw2*
cos(the2));
202 ptrkg22 = ptrkg2.boost(-0.011,0,0);
205 HepLorentzVector ptrkpi0;
206 ptrkpi0 = ptrkg12+ptrkg22;
207 double m_xmpi0_tem = ptrkpi0.mag();
208 if(m_xmpi0_tem>0.150||m_xmpi0_tem<0.115)
continue;
210 bool IsEndcap1 =
false;
bool IsEndcap2 =
false;
211 if(fabs(
cos(the1)) > 0.86 && fabs(
cos(the1)) < 0.92) IsEndcap1 =
true;
212 if(fabs(
cos(the2)) > 0.86 && fabs(
cos(the2)) < 0.92) IsEndcap2 =
true;
213 if(IsEndcap1 && IsEndcap2)
continue;
225 double pi0_chisq = kmfit->
chisq(0);
226 if ( pi0_chisq >= 2500)
continue;
227 HepLorentzVector p2gfit1 = kmfit->
pfit(0) + kmfit->
pfit(1);
228 p2gfit1.boost(-0.011,0,0);
230 for(
int s = 0;
s < nGam-1;
s++) {
231 if(iGam[
s]==-1)
continue;
232 RecEmcShower *g3Trk = (*(evtRecTrkCol->begin()+iGam[
s]))->emcShower();
233 if(iGam[
s] == iGam[m] || iGam[
s] == iGam[
n] )
continue;
234 double eraw3 = g3Trk->
energy();
235 double phi3 = g3Trk->
phi();
236 double the3 = g3Trk->
theta();
237 HepLorentzVector ptrkg3,ptrkg30,ptrkg32;
238 ptrkg3.setPx(eraw3*
sin(the3)*
cos(phi3));
239 ptrkg3.setPy(eraw3*
sin(the3)*
sin(phi3));
240 ptrkg3.setPz(eraw3*
cos(the3));
243 ptrkg32 = ptrkg3.boost(-0.011,0,0);
245 for(
int r =
s+1; r < nGam; r++) {
246 if(iGam[r]==-1)
continue;
247 RecEmcShower *g4Trk = (*(evtRecTrkCol->begin()+iGam[r]))->emcShower();
248 if(iGam[r] == iGam[m] || iGam[r] == iGam[
n] )
continue;
249 double eraw4 = g4Trk->
energy();
250 double phi4 = g4Trk->
phi();
251 double the4 = g4Trk->
theta();
252 HepLorentzVector ptrkg4,ptrkg40,ptrkg42;
253 ptrkg4.setPx(eraw4*
sin(the4)*
cos(phi4));
254 ptrkg4.setPy(eraw4*
sin(the4)*
sin(phi4));
255 ptrkg4.setPz(eraw4*
cos(the4));
258 ptrkg42 = ptrkg4.boost(-0.011,0,0);
261 HepLorentzVector ptrkpi0_2;
262 ptrkpi0_2 = ptrkg32+ptrkg42;
263 double m_xmpi0_2_tem = ptrkpi0_2.mag();
264 if(m_xmpi0_2_tem>0.150||m_xmpi0_2_tem<0.115)
continue;
266 bool IsEndcap3 =
false;
bool IsEndcap4 =
false;
267 if(fabs(
cos(the3)) > 0.86 && fabs(
cos(the3)) < 0.92) IsEndcap3 =
true;
268 if(fabs(
cos(the4)) > 0.86 && fabs(
cos(the4)) < 0.92) IsEndcap4 =
true;
269 if(IsEndcap3 && IsEndcap4)
continue;
282 double pi0_2_chisq = kmfit2->
chisq(0);
283 if ( pi0_2_chisq >= 2500)
continue;
284 HepLorentzVector p2gfit2 = kmfit2->
pfit(0) + kmfit2->
pfit(1);
285 p2gfit2.boost(-0.011,0,0);
289 HepPoint3D vx(xorigin.x(), xorigin.y(), xorigin.z());
290 HepSymMatrix Evx(3, 0);
291 double bx = 1E+6; Evx[0][0] = bx*bx;
292 double by = 1E+6; Evx[1][1] = by*by;
293 double bz = 1E+6; Evx[2][2] = bz*bz;
302 if(!vtxfit->
Fit(0))
continue;
308 HepVector kam_val = HepVector(7,0);
310 HepVector pip_val = HepVector(7,0);
313 HepLorentzVector P_KAM(kam_val[0],kam_val[1],kam_val[2],kam_val[3]);
314 HepLorentzVector P_PIP(pip_val[0],pip_val[1],pip_val[2],pip_val[3]);
316 P_KAM.boost(-0.011,0,0);
317 P_PIP.boost(-0.011,0,0);
318 pddd = P_KAM + P_PIP + p2gfit1 + p2gfit2;
320 double pkpipi0pi0=pddd.rho();
322 double temp1 = (
ecms/2)*(
ecms/2)-pkpipi0pi0*pkpipi0pi0 ;
323 if(temp1<0) temp1 =0;
324 double mass_bc_tem = sqrt(temp1);
325 if(mass_bc_tem < 1.82 || mass_bc_tem > 1.89)
continue;
327 double delE_tag_tag =
ecms/2-pddd.e();
329 if(fabs(delE_tag_tag)<deltaE_tem) {
330 deltaE_tem = fabs(delE_tag_tag);
331 delE_tag_temp = delE_tag_tag;
332 mass_bcgg = mass_bc_tem;
335 cqtm_temp = m_chargek;
340 iGam1_temp = iGam[m];
341 iGam2_temp = iGam[
n];
342 iGam3_temp = iGam[
s];
343 iGam4_temp = iGam[r];
356 if(cqtm_temp<0) tagmode=-25;
359 delE_tag = delE_tag_temp;
361 cqtm = -1.0*cqtm_temp;
363 iGoodtag.push_back(ipi_temp);
364 iGoodtag.push_back(ika_temp);
366 iGamtag.push_back(iGam1_temp);
367 iGamtag.push_back(iGam2_temp);
368 iGamtag.push_back(iGam3_temp);
369 iGamtag.push_back(iGam4_temp);