136 {
137 StatusCode sc = StatusCode::SUCCESS;
138
139 MsgStream log(
msgSvc(), name());
140 log << MSG::INFO << "in execute()" << endreq;
141
142
143
144
145 setFilterPassed(false);
146
147 m_pass[0] += 1;
148
149 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
150 int run=eventHeader->runNumber();
151 int event=eventHeader->eventNumber();
152
155
156 m_pass[1] += 1;
157
158 Vint ikp, ikm, iGood;
159 iGood.clear();
160 ikp.clear();
161 ikm.clear();
162
164 pkp.clear();
165 pkm.clear();
166
167 int TotCharge = 0;
168 for(int i = 0; i < evtRecEvent->totalCharged(); i++){
170 if(!(*itTrk)->isMdcTrackValid()) continue;
172 if(fabs(mdcTrk->
z()) >= m_vz0cut)
continue;
173 if(mdcTrk->
r() >= m_vr0cut)
continue;
174 iGood.push_back(i);
175 TotCharge += mdcTrk->
charge();
176 }
177
178
179
180 int nGood = iGood.size();
181
182
183
184
185
186 if((nGood < 2) || (TotCharge!=0)) return sc;
187
188 m_pass[2] += 1;
189
190
191
192
194 for(int i = 0; i < nGood; i++) {
196
205 if(!(*itTrk)->isMdcKalTrackValid()) continue ;
207
208
210
212 HepLorentzVector ptrk;
213 ptrk.setPx(mdcKalTrk->
px());
214 ptrk.setPy(mdcKalTrk->
py());
215 ptrk.setPz(mdcKalTrk->
pz());
216 double p3 = ptrk.mag();
217 ptrk.setE(sqrt(p3*p3+
mk*
mk));
218 if(mdcKalTrk->
charge() >0) {
219 ikp.push_back(iGood[i]);
220 pkp.push_back(ptrk);
221 } else {
222 ikm.push_back(iGood[i]);
223 pkm.push_back(ptrk);
224 }
225 }
226
227 m_pass[4] += 1;
228 int nkp = ikp.size();
229 int nkm = ikm.size();
230
231 m_nkp=nkp;
232 m_nkm=nkm;
233 m_ncharge=nGood;
234
235
236 if(nkp < 1 || nkm <1) return sc;
237
238 m_pass[5] += 1;
239
240
241
242
243
244
245 HepLorentzVector pphi, pTot;
247 iphi.clear();
248
249 double difchi0=99999.0;
250 int ixk1 = -1;
251 int ixk2 = -1;
252
253 for (int i = 0; i < nkm; i++) {
254 for (int j = 0; j < nkp; j++) {
255
256 pphi = pkm[i] + pkp[j];
257 m_mphiall = pphi.m();
258 m_pphiall = pphi.rho();
259 m_tuple1->write();
260
261 double difchi =fabs(pphi.m()-
mphi);
262 if(difchi < difchi0){
263 difchi0 = difchi;
264 ixk1 = i;
265 ixk2 = j;
266 }
267 }
268 }
269
270 m_difchi = difchi0;
271
272 if (ixk1 == -1) return sc;
273
274 m_pass[6] += 1;
275
276 pTot = pkm[ixk1] + pkp[ixk2];
277
278 m_pk1 = pkm[ixk1].m();
279 m_mphi = pTot.m();
280 m_pphi = pTot.rho();
281
282 TH1 *h(0);
283 if (m_thsvc->getHist("/DQAHist/InclPhi/InclPhi_mass", h).isSuccess()) {
284 h->Fill(pTot.m());
285 } else {
286 log << MSG::ERROR << "Couldn't retrieve inclphi_mass" << endreq;
287 }
288 m_tuple2->write();
289
290
291
292
293
294
295 (*(evtRecTrkCol->begin()+ikm[ixk1]))->tagKaon();
296 (*(evtRecTrkCol->begin()+ikp[ixk2]))->tagKaon();
297
298
299
300
301
302 (*(evtRecTrkCol->begin()+ikm[ixk1]))->setQuality(3);
303 (*(evtRecTrkCol->begin()+ikp[ixk2]))->setQuality(3);
304
305
306
307 setFilterPassed(true);
308
309 return StatusCode::SUCCESS;
310}
EvtRecTrackCol::iterator EvtRecTrackIterator
std::vector< HepLorentzVector > Vp4
static void setPidType(PidType pidType)
int methodProbability() const
void setChiMinCut(const double chi=4)
void setRecTrack(EvtRecTrack *trk)
void setMethod(const int method)
void identify(const int pidcase)
void usePidSys(const int pidsys)
static ParticleID * instance()
bool IsPidInfoValid() const
_EXTERN_ std::string EvtRecEvent
_EXTERN_ std::string EvtRecTrackCol