35{
36
37 int nGood=iGood.size();
38 int nGam=iGam.size();
39 iGoodtag.clear();
40 iGamtag.clear();
41
42 double mass_bcgg, delE_tag_temp;
43 int m_chargetag,m_chargek,m_chargepi1,m_chargepi2,m_chargepi3;
44 int ika_temp,ipi1_temp,ipi2_temp,ipi3_temp,ipi4_temp, iGam1_temp, iGam2_temp;
45 HepLorentzVector kmfit1,kmfit2,kmfit3,kmfit4,pddd;
46
47 int cqtm_temp;
48 HepLorentzVector pddd_temp;
49 IDataProviderSvc* eventSvc = NULL;
50 Gaudi::svcLocator()->service("EventDataSvc", eventSvc);
52 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc,"/Event/EventHeader");
53
54 int runNo=eventHeader->runNumber();
55 int rec=eventHeader->eventNumber();
56
57 double xecm=2*Ebeam;
58
59 k3pipi0md = false;
60 double tagmode=0;
61
62 if((evtRecEvent->totalCharged() < 4 || nGam <2)){ return; }
63
65
67 Gaudi::svcLocator()->service("SimplePIDSvc", simple_pid);
68
69 double deltaE_tem = 0.20;
70 int ncount1 = 0;
71
72 HepLorentzVector p2gfit;
73 HepLorentzVector p2gg;
74
75 Hep3Vector xorigin(0,0,0);
77 Gaudi::svcLocator()->service("VertexDbSvc", vtxsvc);
79 {
82 xorigin.setX(dbv[0]);
83 xorigin.setY(dbv[1]);
84 xorigin.setZ(dbv[2]);
85 }
86
87 double xv=xorigin.x();
88 double yv=xorigin.y();
89 double zv=xorigin.z();
90
92 HepPoint3D IP(xorigin[0],xorigin[1],xorigin[2]);
93
94 HepLorentzVector ptrk1_temp, ptrk2_temp, ptrk3_temp, ptrk4_temp, ptrk5_temp, ptrk6_temp, ptrk7_temp;
95
96 for(int i = 0; i < evtRecEvent->totalCharged(); i++) {
98
99 int ika= (*itTrk1)->trackId();
100
101 if(!(*itTrk1)->isMdcKalTrackValid()) continue;
104
105 m_chargek=mdcKalTrk1->
charge();
106 if(Charge_candidate_D != 0) {
107 if(m_chargek != -Charge_candidate_D) continue;
108 }
109 if(Charge_candidate_D == 0) {
110 if(
abs(m_chargek) != 1)
continue;
111 }
112
115 VFHelix helixip3_1(point0,a1,Ea1);
116 helixip3_1.pivot(IP);
117 HepVector vecipa1 = helixip3_1.a();
118
119 double dr1 = fabs(vecipa1[0]);
120 double dz1 = fabs(vecipa1[3]);
121 double costheta1 =
cos(mdcKalTrk1->
theta());
122 if ( dr1 >= 1.0) continue;
123 if ( dz1 >= 10.0) continue;
124 if ( fabs(costheta1) >= 0.93) continue;
125
126 if(PID_flag == 5) {
129 }
130
131
132
134
135
136
137
138 for(int j = 0; j< evtRecEvent->totalCharged();j++) {
140
141 int ipi1= (*itTrk2)->trackId();
142 if(ipi1==ika) continue;
143
144 if(!(*itTrk2)->isMdcKalTrackValid()) continue;
147
148 m_chargepi1=mdcKalTrk2->
charge();
149 if((m_chargek + m_chargepi1) != 0) continue;
150
152 HepSymMatrix Ea2 = mdcKalTrk2->
getZError();
153 VFHelix helixip3_2(point0,a2,Ea2);
154 helixip3_2.pivot(IP);
155 HepVector vecipa2 = helixip3_2.a();
156
157 double dr2 = fabs(vecipa2[0]);
158 double dz2 = fabs(vecipa2[3]);
159 double costheta2 =
cos(mdcKalTrk2->
theta());
160 if ( dr2 >= 1.0) continue;
161 if ( dz2 >= 10.0) continue;
162 if ( fabs(costheta2) >= 0.93) continue;
163
164 if(PID_flag == 5) {
167 }
168
170
171
172
173
174 for(int k = 0; k< evtRecEvent->totalCharged(); k++) {
176
177 int ipi2= (*itTrk3)->trackId();
178 if(ipi2==ika || ipi2==ipi1) continue;
179
180 if(!(*itTrk3)->isMdcKalTrackValid()) continue;
183
184 m_chargepi2=mdcKalTrk3->
charge();
185 if((m_chargek + m_chargepi2) != 0) continue;
186
188 HepSymMatrix Ea3 = mdcKalTrk3->
getZError();
189 VFHelix helixip3_3(point0,a3,Ea3);
190 helixip3_3.pivot(IP);
191 HepVector vecipa3 = helixip3_3.a();
192
193 double dr3 = fabs(vecipa3[0]);
194 double dz3 = fabs(vecipa3[3]);
195 double costheta3 =
cos(mdcKalTrk3->
theta());
196 if ( dr3 >= 1.0) continue;
197 if ( dz3 >= 10.0) continue;
198 if ( fabs(costheta3) >= 0.93) continue;
199
200 if(PID_flag == 5) {
203 }
204
206
207
208
209
210 for(int l = 0; l< evtRecEvent->totalCharged();l++) {
212
213 int ipi3= (*itTrk4)->trackId();
214 if(ipi3==ika || ipi3==ipi1 || ipi3==ipi2 ) continue;
215
216 if(!(*itTrk4)->isMdcKalTrackValid()) continue;
219
220 m_chargepi3=mdcKalTrk4->
charge();
221 if((m_chargepi2 + m_chargepi3) != 0) continue;
222
224 HepSymMatrix Ea4 = mdcKalTrk4->
getZError();
225 VFHelix helixip3_4(point0,a4,Ea4);
226 helixip3_4.pivot(IP);
227 HepVector vecipa4 = helixip3_4.a();
228
229 double dr4 = fabs(vecipa4[0]);
230 double dz4 = fabs(vecipa4[3]);
231 double costheta4 =
cos(mdcKalTrk4->
theta());
232 if ( dr4 >= 1.0) continue;
233 if ( dz4 >= 10.0) continue;
234 if ( fabs(costheta4) >= 0.93) continue;
235
236 if(PID_flag == 5) {
239 }
240
242
243
244 for(int m = 0; m < nGam-1; m++) {
245 if(iGam[m]==-1) continue;
246 RecEmcShower *g1Trk =(*(evtRecTrkCol->begin()+iGam[m]))->emcShower();
247 double eraw1 = g1Trk->
energy();
249 double the1 = g1Trk->
theta();
250 HepLorentzVector ptrkg1,ptrkg10,ptrkg12;
253 ptrkg1.setPz(eraw1*
cos(the1));
254 ptrkg1.setE(eraw1);
255 ptrkg10 = ptrkg1;
256 ptrkg12 = ptrkg1.boost(-0.011,0,0);
257
258 for(
int n = m+1;
n < nGam;
n++) {
259 if(iGam[
n]==-1)
continue;
260 RecEmcShower *g2Trk =(*(evtRecTrkCol->begin()+iGam[
n]))->emcShower();
261 double eraw2 = g2Trk->
energy();
263 double the2 = g2Trk->
theta();
264 HepLorentzVector ptrkg2,ptrkg20,ptrkg22;
267 ptrkg2.setPz(eraw2*
cos(the2));
268 ptrkg2.setE(eraw2);
269 ptrkg20 = ptrkg2;
270 ptrkg22 = ptrkg2.boost(-0.011,0,0);
271
272
273 HepLorentzVector ptrkpi0;
274 ptrkpi0 = ptrkg12+ptrkg22;
275 double m_xmpi0_tem = ptrkpi0.mag();
276 if(m_xmpi0_tem>0.150||m_xmpi0_tem<0.115) continue;
277
278 bool IsEndcap1 = false; bool IsEndcap2 = false;
279 if(fabs(
cos(the1)) > 0.86 && fabs(
cos(the1)) < 0.92) IsEndcap1 =
true;
280 if(fabs(
cos(the2)) > 0.86 && fabs(
cos(the2)) < 0.92) IsEndcap2 =
true;
281 if(IsEndcap1 && IsEndcap2) continue;
282
283
290
293
294 double pi0_chisq = kmfit->
chisq(0);
295 if ( pi0_chisq >= 2500) continue;
296 HepLorentzVector p2gfit = kmfit->
pfit(0) + kmfit->
pfit(1);
297 p2gfit.boost(-0.011,0,0);
298
299
300 HepPoint3D vx(xorigin.x(), xorigin.y(), xorigin.z());
301 HepSymMatrix Evx(3, 0);
302 double bx = 1E+6; Evx[0][0] = bx*bx;
303 double by = 1E+6; Evx[1][1] = by*by;
304 double bz = 1E+6; Evx[2][2] = bz*bz;
306
307
315 if(!vtxfit->
Fit(0))
continue;
317
322
323 HepVector kam_val = HepVector(7,0);
324 HepVector pip1_val = HepVector(7,0);
325 HepVector pip2_val = HepVector(7,0);
326 HepVector pip3_val = HepVector(7,0);
328 pip1_val = wpip1.
w();
329 pip2_val = wpip2.
w();
330 pip3_val = wpip3.
w();
331
332 HepLorentzVector P_KAM(kam_val[0],kam_val[1],kam_val[2],kam_val[3]);
333 HepLorentzVector P_PIP1(pip1_val[0],pip1_val[1],pip1_val[2],pip1_val[3]);
334 HepLorentzVector P_PIP2(pip2_val[0],pip2_val[1],pip2_val[2],pip2_val[3]);
335 HepLorentzVector P_PIP3(pip3_val[0],pip3_val[1],pip3_val[2],pip3_val[3]);
336
337 P_KAM.boost(-0.011,0,0);
338 P_PIP1.boost(-0.011,0,0);
339 P_PIP2.boost(-0.011,0,0);
340 P_PIP3.boost(-0.011,0,0);
341 pddd = P_KAM + P_PIP1 + P_PIP2 + P_PIP3 + p2gfit;
342
343 double pk3pipi0=pddd.rho();
344
345 double temp1 = (
ecms/2)*(
ecms/2)-pk3pipi0*pk3pipi0 ;
346 if(temp1<0) temp1 =0;
347 double mass_bc_tem = sqrt(temp1);
348 if(mass_bc_tem < 1.82 || mass_bc_tem > 1.89) continue;
349
350 double delE_tag_tag =
ecms/2-pddd.e();
351
352 if(fabs(delE_tag_tag)<deltaE_tem) {
353 deltaE_tem = fabs(delE_tag_tag);
354 delE_tag_temp = delE_tag_tag;
355 mass_bcgg = mass_bc_tem;
356
357 pddd_temp = pddd;
358 cqtm_temp = m_chargek;
359
360 ika_temp=ika;
361 ipi1_temp=ipi1;
362 ipi2_temp=ipi2;
363 ipi3_temp=ipi3;
364 iGam1_temp = iGam[m];
365 iGam2_temp = iGam[
n];
366
367 ncount1 = 1;
368
369
370 }
371 }
372 }
373 }
374 }
375 }
376 }
377 if(ncount1 == 1){
378 tagmode=24;
379 if(cqtm_temp<0) tagmode=-24;
380 tagmd=tagmode;
381 mass_bc = mass_bcgg;
382 delE_tag = delE_tag_temp;
383 cqtm = -1.0*cqtm_temp;
384
385 iGoodtag.push_back(ika_temp);
386 iGoodtag.push_back(ipi1_temp);
387 iGoodtag.push_back(ipi2_temp);
388 iGoodtag.push_back(ipi3_temp);
389
390 iGamtag.push_back(iGam1_temp);
391 iGamtag.push_back(iGam2_temp);
392 iGamtag.push_back(9999);
393 iGamtag.push_back(9999);
394
395 ptag = pddd_temp;
396
397 k3pipi0md = true;
398
399 }
400}
EvtRecTrackCol::iterator EvtRecTrackIterator
double abs(const EvtComplex &c)
double sin(const BesAngle a)
double cos(const BesAngle a)
const double theta() const
static void setPidType(PidType pidType)
virtual double probKaon()=0
virtual void preparePID(EvtRecTrack *track)=0
virtual double probPion()=0
virtual bool isVertexValid()=0
virtual double * SigmaPrimaryVertex()=0
virtual double * PrimaryVertex()=0
void setChisqCut(const double chicut=200, const double chiter=0.05)
HepLorentzVector pfit(int n) const
void BuildVirtualParticle(int number)
void AddResonance(int number, double mres, std::vector< int > tlis)
static KalmanKinematicFit * instance()
const HepVector & getZHelix() const
const HepSymMatrix & getZError() const
HepSymMatrix & getZErrorK()
void AddTrack(const int number, const double mass, const RecMdcTrack *trk)
WTrackParameter wtrk(int n) const
void AddVertex(int number, VertexParameter vpar, std::vector< int > lis)
static VertexFit * instance()
void setEvx(const HepSymMatrix &eVx)
void setVx(const HepPoint3D &vx)
_EXTERN_ std::string EvtRecEvent