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;
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 k3pimd=false;
60 double tagmode=0;
61
62 if((evtRecEvent->totalCharged() < 4)){ return; }
63
65
67 Gaudi::svcLocator()->service("SimplePIDSvc", simple_pid);
68
69 double deltaE_tem = 0.20;
70 int ncount1 = 0;
71
72 Hep3Vector xorigin(0,0,0);
74 Gaudi::svcLocator()->service("VertexDbSvc", vtxsvc);
76 {
79 xorigin.setX(dbv[0]);
80 xorigin.setY(dbv[1]);
81 xorigin.setZ(dbv[2]);
82 }
83
84 double xv=xorigin.x();
85 double yv=xorigin.y();
86 double zv=xorigin.z();
87
89 HepPoint3D IP(xorigin[0],xorigin[1],xorigin[2]);
90
91 HepLorentzVector ptrk1_temp, ptrk2_temp, ptrk3_temp, ptrk4_temp;
92
93 for(int i = 0; i < evtRecEvent->totalCharged(); i++) {
95
96 int ika= (*itTrk1)->trackId();
97
98 if(!(*itTrk1)->isMdcKalTrackValid()) continue;
101
102 m_chargek=mdcKalTrk1->
charge();
103 if(Charge_candidate_D != 0) {
104 if(m_chargek != -Charge_candidate_D) continue;
105 }
106 if(Charge_candidate_D == 0) {
107 if(
abs(m_chargek) != 1)
continue;
108 }
109
112
113 VFHelix helixip3_1(point0,a1,Ea1);
114 helixip3_1.pivot(IP);
115 HepVector vecipa1 = helixip3_1.a();
116
117 double dr1 = fabs(vecipa1[0]);
118 double dz1 = fabs(vecipa1[3]);
119 double costheta1 =
cos(mdcKalTrk1->
theta());
120
121 if ( dr1 >= 1.0) continue;
122 if ( dz1 >= 10.0) continue;
123 if ( fabs(costheta1) >= 0.93) continue;
124
125 if(PID_flag == 5) {
128 }
129
131
132
133
134
135 for(int j = 0; j< evtRecEvent->totalCharged();j++) {
137
138 int ipi1= (*itTrk2)->trackId();
139 if(ipi1==ika) continue;
140
141 if(!(*itTrk2)->isMdcKalTrackValid()) continue;
144
145 m_chargepi1=mdcKalTrk2->
charge();
146 if((m_chargek + m_chargepi1) != 0) continue;
147
149 HepSymMatrix Ea2 = mdcKalTrk2->
getZError();
150 VFHelix helixip3_2(point0,a2,Ea2);
151 helixip3_2.pivot(IP);
152 HepVector vecipa2 = helixip3_2.a();
153
154 double dr2 = fabs(vecipa2[0]);
155 double dz2 = fabs(vecipa2[3]);
156 double costheta2 =
cos(mdcKalTrk2->
theta());
157 if ( dr2 >= 1.0) continue;
158 if ( dz2 >= 10.0) continue;
159 if ( fabs(costheta2) >= 0.93) continue;
160
161 if(PID_flag == 5) {
164 }
165
167
168
169
170
171 for(int k = 0; k< evtRecEvent->totalCharged(); k++) {
173
174 int ipi2= (*itTrk3)->trackId();
175 if(ipi2==ika || ipi2==ipi1) continue;
176
177 if(!(*itTrk3)->isMdcKalTrackValid()) continue;
180
181 m_chargepi2=mdcKalTrk3->
charge();
182 if((m_chargek + m_chargepi2) != 0) continue;
183
185 HepSymMatrix Ea3 = mdcKalTrk3->
getZError();
186 VFHelix helixip3_3(point0,a3,Ea3);
187 helixip3_3.pivot(IP);
188 HepVector vecipa3 = helixip3_3.a();
189
190 double dr3 = fabs(vecipa3[0]);
191 double dz3 = fabs(vecipa3[3]);
192 double costheta3 =
cos(mdcKalTrk3->
theta());
193 if ( dr3 >= 1.0) continue;
194 if ( dz3 >= 10.0) continue;
195 if ( fabs(costheta3) >= 0.93) continue;
196
197 if(PID_flag == 5) {
200 }
201
203
204
205
206
207 for(int l = 0; l< evtRecEvent->totalCharged(); l++) {
209
210 int ipi3= (*itTrk4)->trackId();
211 if(ipi3==ika || ipi3==ipi1 || ipi3==ipi2 ) continue;
212
213 if(!(*itTrk4)->isMdcKalTrackValid()) continue;
216
217 m_chargepi3=mdcKalTrk4->
charge();
218 if((m_chargepi2 + m_chargepi3) != 0) continue;
219
221 HepSymMatrix Ea4 = mdcKalTrk4->
getZError();
222 VFHelix helixip3_4(point0,a4,Ea4);
223 helixip3_4.pivot(IP);
224 HepVector vecipa4 = helixip3_4.a();
225
226 double dr4 = fabs(vecipa4[0]);
227 double dz4 = fabs(vecipa4[3]);
228 double costheta4 =
cos(mdcKalTrk4->
theta());
229 if ( dr4 >= 1.0) continue;
230 if ( dz4 >= 10.0) continue;
231 if ( fabs(costheta4) >= 0.93) continue;
232
233 if(PID_flag == 5) {
236 }
237
239
240
241 HepPoint3D vx(xorigin.x(), xorigin.y(), xorigin.z());
242 HepSymMatrix Evx(3, 0);
243 double bx = 1E+6; Evx[0][0] = bx*bx;
244 double by = 1E+6; Evx[1][1] = by*by;
245 double bz = 1E+6; Evx[2][2] = bz*bz;
247
248
256 if(!vtxfit->
Fit(0))
continue;
258
263
264 HepVector kam_val = HepVector(7,0);
265 HepVector pip1_val = HepVector(7,0);
266 HepVector pip2_val = HepVector(7,0);
267 HepVector pip3_val = HepVector(7,0);
269 pip1_val = wpip1.
w();
270 pip2_val = wpip2.
w();
271 pip3_val = wpip3.
w();
272
273 HepLorentzVector P_KAM(kam_val[0],kam_val[1],kam_val[2],kam_val[3]);
274 HepLorentzVector P_PIP1(pip1_val[0],pip1_val[1],pip1_val[2],pip1_val[3]);
275 HepLorentzVector P_PIP2(pip2_val[0],pip2_val[1],pip2_val[2],pip2_val[3]);
276 HepLorentzVector P_PIP3(pip3_val[0],pip3_val[1],pip3_val[2],pip3_val[3]);
277
278 P_KAM.boost(-0.011,0,0);
279 P_PIP1.boost(-0.011,0,0);
280 P_PIP2.boost(-0.011,0,0);
281 P_PIP3.boost(-0.011,0,0);
282 pddd = P_KAM + P_PIP1 + P_PIP2 + P_PIP3;
283
284 double pk3pi=pddd.rho();
285
286 double temp1 = (
ecms/2)*(
ecms/2)-pk3pi*pk3pi ;
287 if(temp1<0) temp1 =0;
288 double mass_bc_tem = sqrt(temp1);
289 if(mass_bc_tem < 1.82 || mass_bc_tem > 1.89) continue;
290
291 double delE_tag_tag =
ecms/2-pddd.e();
292
293 if(fabs(delE_tag_tag)<deltaE_tem) {
294 deltaE_tem = fabs(delE_tag_tag);
295 delE_tag_temp = delE_tag_tag;
296 mass_bcgg = mass_bc_tem;
297
298 pddd_temp = pddd;
299 cqtm_temp = m_chargek;
300
301 ika_temp=ika;
302 ipi1_temp=ipi1;
303 ipi2_temp=ipi2;
304 ipi3_temp=ipi3;
305 ncount1 = 1;
306
307 }
308 }
309 }
310 }
311 }
312
313 if(ncount1 == 1){
314 tagmode=13;
315 if(cqtm_temp<0) tagmode=-13;
316 tagmd=tagmode;
317 mass_bc = mass_bcgg;
318 delE_tag = delE_tag_temp;
319 cqtm = -1.0*cqtm_temp;
320
321 iGoodtag.push_back(ika_temp);
322 iGoodtag.push_back(ipi1_temp);
323 iGoodtag.push_back(ipi2_temp);
324 iGoodtag.push_back(ipi3_temp);
325
326 iGamtag.push_back(9999);
327 iGamtag.push_back(9999);
328 iGamtag.push_back(9999);
329 iGamtag.push_back(9999);
330
331 ptag = pddd_temp;
332
333 k3pimd=true;
334
335 }
336}
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
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