36{
37
38 int nGood=iGood.size();
39 int nGam=iGam.size();
40
41 iGoodtag.clear();
42 iGamtag.clear();
43
44 double mass_bcgg,delE_tag_temp;
45 int m_chargetag,m_chargepi1,m_chargepi2,m_chargepi3,m_chargepi4;
46 int ipi1_temp,ipi2_temp,ipi3_temp,ipi4_temp;
47 HepLorentzVector pddd;
48 HepLorentzVector pddd_temp;
49
50 IDataProviderSvc* eventSvc = NULL;
51 Gaudi::svcLocator()->service("EventDataSvc", eventSvc);
53 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc,"/Event/EventHeader");
54
55 int runNo=eventHeader->runNumber();
56 int rec=eventHeader->eventNumber();
57
58 double xecm=2*Ebeam;
59
60 k0pipimd=false;
61 double tagmode=0;
62
63 if((evtRecEvent->totalCharged() < 4)){ return; }
64
66
68 Gaudi::svcLocator()->service("SimplePIDSvc", simple_pid);
69
70 double deltaE_tem = 0.20;
71 int ncount1 = 0;
72
73 Hep3Vector xorigin(0,0,0);
74 HepSymMatrix xoriginEx(3,0);
76 Gaudi::svcLocator()->service("VertexDbSvc", vtxsvc);
78 {
81 xorigin.setX(dbv[0]);
82 xorigin.setY(dbv[1]);
83 xorigin.setZ(dbv[2]);
84
85 xoriginEx[0][0] = vv[0] * vv[0];
86 xoriginEx[1][1] = vv[1] * vv[1];
87 xoriginEx[2][2] = vv[2] * vv[2];
88
89 }
90
91 double xv=xorigin.x();
92 double yv=xorigin.y();
93 double zv=xorigin.z();
94
96 HepPoint3D IP(xorigin[0],xorigin[1],xorigin[2]);
97
98
99 for(int i = 0; i < evtRecEvent->totalCharged(); i++) {
101
102 int ipi1= (*itTrk)->trackId();
103
104 if(!(*itTrk)->isMdcKalTrackValid()) continue;
107
108 m_chargepi1=mdcKalTrk1->
charge();
109 if(m_chargepi1 != 1) continue;
110
111
113 HepSymMatrix Ea1 = mdcKalTrk1->
getZError();
114
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
123 if ( dr1 >= 15.0) continue;
124 if ( dz1 >= 25.0) continue;
125 if ( fabs(costheta1) >= 0.93) continue;
126
128
129
130
131
132 for(int j = 0; j < evtRecEvent->totalCharged(); j++) {
134
135 int ipi2= (*itTrk)->trackId();
136 if(ipi1==ipi2) continue;
137
138 if(!(*itTrk)->isMdcKalTrackValid()) continue;
141
142 m_chargepi2=mdcKalTrk2->
charge();
143 if((m_chargepi2 + m_chargepi1) != 0) continue;
144
145
147 HepSymMatrix Ea2 = mdcKalTrk2->
getZError();
148 VFHelix helixip3_2(point0,a2,Ea2);
149 helixip3_2.pivot(IP);
150 HepVector vecipa2 = helixip3_2.a();
151
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;
158
160
161
162 HepVector pip1_val = HepVector(7,0);
163 HepVector pim1_val = HepVector(7,0);
164 pip1_val = pip1.w();
165 pim1_val = pim1.w();
166 HepLorentzVector ptrktagk0(pip1_val[0]+pim1_val[0],pip1_val[1]+pim1_val[1],pip1_val[2]+pim1_val[2],pip1_val[3]+pim1_val[3]);
167 if(fabs(ptrktagk0.m()-0.498)>0.1) continue;
168
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;
175
181 if(!(vtxfit0->
Fit(0)))
continue;
188
189
190
191
192 for(int k = 0; k < evtRecEvent->totalCharged(); k++) {
194
195 int ipi3= (*itTrk)->trackId();
196 if(ipi2==ipi3 || ipi1==ipi3) continue;
197
198 if(!(*itTrk)->isMdcKalTrackValid()) continue;
201
202 m_chargepi3=mdcKalTrk3->
charge();
203 if((m_chargepi3) != 1) continue;
204
205
207 HepSymMatrix Ea3 = mdcKalTrk3->
getZError();
208 VFHelix helixip3_3(point0,a3,Ea3);
209 helixip3_3.pivot(IP);
210 HepVector vecipa3 = helixip3_3.a();
211
212 double dr3 = fabs(vecipa3[0]);
213 double dz3 = fabs(vecipa3[3]);
214 double costheta3 =
cos(mdcKalTrk3->
theta());
215 if ( dr3 >= 1.0) continue;
216 if ( dz3 >= 10.0) continue;
217 if ( fabs(costheta3) >= 0.93) continue;
218
219 if(PID_flag == 5) {
222 }
223
225
226
227
228
229 for(int l = 0; l< evtRecEvent->totalCharged(); l++) {
231
232 int ipi4= (*itTrk)->trackId();
233 if(ipi4==ipi3 || ipi4==ipi2 || ipi4 ==ipi1) continue;
234
235 if(!(*itTrk)->isMdcKalTrackValid()) continue;
238
239 m_chargepi4=mdcKalTrk4->
charge();
240 if((m_chargepi4 + m_chargepi3) != 0) continue;
241
242
244 HepSymMatrix Ea4 = mdcKalTrk4->
getZError();
245 VFHelix helixip3_4(point0,a4,Ea4);
246 helixip3_4.pivot(IP);
247 HepVector vecipa4 = helixip3_4.a();
248
249 double dr4 = fabs(vecipa4[0]);
250 double dz4 = fabs(vecipa4[3]);
251 double costheta4 =
cos(mdcKalTrk4->
theta());
252 if ( dr4 >= 1.0) continue;
253 if ( dz4 >= 10.0) continue;
254 if ( fabs(costheta4) >= 0.93) continue;
255
256 if(PID_flag == 5) {
259 }
260
262
263
264
270 if(!vtxfit_2->
Fit(0))
continue;
272
275
282 if(!vtxfit->
Fit())
continue;
283
284 if(vtxfit->
chisq() >999.)
continue;
286
287 double m_massks1_tem = vtxfit->
p4par().m();
288 if(m_massks1_tem < 0.485 || m_massks1_tem > 0.515) continue;
289 HepLorentzVector p4kstag = vtxfit->
p4par();
292
293 HepVector pip2_val = HepVector(7,0);
294 HepVector pim2_val = HepVector(7,0);
295 HepVector ksp_val = HepVector(7,0);
296 HepVector ksm_val = HepVector(7,0);
297
298 pip2_val = wpip2.
w();
299 pim2_val = wpim2.
w();
302
303 HepLorentzVector P_PIP2(pip2_val[0],pip2_val[1],pip2_val[2],pip2_val[3]);
304 HepLorentzVector P_PIM2(pim2_val[0],pim2_val[1],pim2_val[2],pim2_val[3]);
305 HepLorentzVector P_KSP(ksp_val[0],ksp_val[1],ksp_val[2],ksp_val[3]);
306 HepLorentzVector P_KSM(ksm_val[0],ksm_val[1],ksm_val[2],ksm_val[3]);
307
308 p4kstag.boost(-0.011,0,0);
309 P_PIP2.boost(-0.011,0,0);
310 P_PIM2.boost(-0.011,0,0);
311 P_KSP.boost(-0.011,0,0);
312 P_KSM.boost(-0.011,0,0);
313
314 pddd = p4kstag + P_PIP2 + P_PIM2;
315
316 double pk0pipi=pddd.rho();
317
318 double temp1 = (
ecms/2)*(
ecms/2)-pk0pipi*pk0pipi ;
319 if(temp1<0) temp1 =0;
320 double mass_bc_tem = sqrt(temp1);
321 if(mass_bc_tem < 1.82 || mass_bc_tem > 1.89) continue;
322
323 double delE_tag_tag =
ecms/2-pddd.e();
324
325 if(fabs(delE_tag_tag)<deltaE_tem){
326 deltaE_tem = fabs(delE_tag_tag);
327 delE_tag_temp = delE_tag_tag;
328 mass_bcgg = mass_bc_tem;
329
330 pddd_temp = pddd;
331
332 ipi1_temp=ipi1;
333 ipi2_temp=ipi2;
334 ipi3_temp=ipi3;
335 ipi4_temp=ipi4;
336
337 ncount1 = 1;
338
339 }
340 }
341 }
342 }
343 }
344
345
346 if(ncount1 == 1){
347 tagmode=14;
348 if(m_chargetag<0) tagmode=-14;
349 tagmd=tagmode;
350 mass_bc = mass_bcgg;
351 delE_tag = delE_tag_temp;
352 cqtm = 0.0;
353
354 iGoodtag.push_back(ipi1_temp);
355 iGoodtag.push_back(ipi2_temp);
356 iGoodtag.push_back(ipi3_temp);
357 iGoodtag.push_back(ipi4_temp);
358 iGamtag.push_back(9999);
359 iGamtag.push_back(9999);
360 iGamtag.push_back(9999);
361 iGamtag.push_back(9999);
362
363 ptag = pddd_temp;
364
365 k0pipimd=true;
366 }
367
368}
EvtRecTrackCol::iterator EvtRecTrackIterator
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
const HepVector & getZHelix() const
const HepSymMatrix & getZError() const
HepLorentzVector p4par() const
void setPrimaryVertex(const VertexParameter vpar)
double decayLength() const
static SecondVertexFit * instance()
void setVpar(const VertexParameter vpar)
WTrackParameter wpar() const
void AddTrack(const int number, const double mass, const RecMdcTrack *trk)
WTrackParameter wtrk(int n) const
WTrackParameter wVirtualTrack(int n) const
void AddVertex(int number, VertexParameter vpar, std::vector< int > lis)
static VertexFit * instance()
VertexParameter vpar(int n) const
void BuildVirtualParticle(int number)
void setEvx(const HepSymMatrix &eVx)
void setVx(const HepPoint3D &vx)
_EXTERN_ std::string EvtRecEvent