101 {
102 MsgStream log(
msgSvc(), name());
103 log << MSG::INFO << "in execute()" << endreq;
104
105 StatusCode sc;
106
107
108
109
110 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
111 int event= eventHeader->eventNumber();
112
113
114
117 log << MSG::DEBUG << "run and event = " << eventHeader->runNumber()
118 << " " << eventHeader->eventNumber() << endreq;
119 log << MSG::DEBUG <<"ncharg, nneu, tottks = "
120 << recEvent->totalCharged() << " , "
121 << recEvent->totalNeutral() << " , "
122 << recEvent->totalTracks() <<endreq;
123
126
129
130
131 SmartDataPtr<EvtRecPi0Col> recPi0Col(eventSvc(), "/Event/EvtRec/EvtRecPi0Col");
132 if ( ! recPi0Col ) {
133 log << MSG::FATAL << "Could not find EvtRecPi0Col" << endreq;
134 return StatusCode::FAILURE;
135 }
136
137
138 SmartDataPtr<EvtRecEtaToGGCol> recEtaToGGCol(eventSvc(), "/Event/EvtRec/EvtRecEtaToGGCol");
139 if ( ! recEtaToGGCol ) {
140 log << MSG::FATAL << "Could not find EvtRecEtaToGGCol" << endreq;
141 return StatusCode::FAILURE;
142 }
143
144
145 SmartDataPtr<EvtRecVeeVertexCol> recVeeVertexCol(eventSvc(), "/Event/EvtRec/EvtRecVeeVertexCol");
146 if ( ! recVeeVertexCol ) {
147 log << MSG::FATAL << "Could not find EvtRecVeeVertexCol" << endreq;
148 return StatusCode::FAILURE;
149 }
150
151
153 if (!recDTagCol) {
154 log << MSG::FATAL << "EvtRecDTagCol is not registered yet" << endreq;
155 return StatusCode::FAILURE;
156 }
157
158
159
160
161 Hep3Vector xorigin(0,0,0);
162
164 Gaudi::svcLocator()->service("VertexDbSvc", vtxsvc);
166
167
169 xorigin.setX(vertex[0]);
170 xorigin.setY(vertex[1]);
171 xorigin.setZ(vertex[2]);
172 }
173
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
195
197 dc_fill(ksList, recVeeVertexCol->begin(), recVeeVertexCol->end());
198
199
200 map<EvtRecVeeVertex*, vector< double > > fitinfo;
201 for(
CDKsList::iterator ksit = ksList.particle_begin(); ksit != ksList.particle_end(); ++ksit ){
204 }
205
207 dc_fill(pi0List, recPi0Col->begin(), recPi0Col->end());
208
210 dc_fill(etaList, recEtaToGGCol->begin(), recEtaToGGCol->end());
211
212
217
218
219
220 int run = eventHeader->runNumber();
221 m_ievt = eventHeader->eventNumber();
222 m_nChrg = recEvent->totalCharged();
223 m_nNeu = recEvent->totalNeutral();
224 m_nPion = pionList.size();
225 m_nKaon = kaonList.size();
226 m_nPi0 = pi0List.size();
227 m_nKs = ksList.size();
228
229
230
231
232
233
234
235 if(m_ReadBeamEFromDB && m_irun!=run){
236 m_irun=run;
237 if(m_usecalibBeamE)
239 m_beamE=m_readDb.
getbeamE(m_irun,m_beamE);
240 if(run>0)
242
243 }
244 double ebeam=m_beamE;
245
246
247
248
249
250
251
252 for(int list=0;list<chanlist.size();list++){
253
254 string channel=chanlist[list];
255 vector<int> numchan;
259
260
261
262
263
264 if(channel=="DptoKPiPi") {
266 numchan.push_back(1);
267 numchan.push_back(2);
268 numchan.push_back(2);
269 decaylist=kaonList.minus()* pionList.plus()* pionList.plus();
270 }
271 else if(channel=="DptoKPiPiPi0") {
273 numchan.push_back(1);
274 numchan.push_back(2);
275 numchan.push_back(2);
276 numchan.push_back(3);
277 decaylist=kaonList.minus()* pionList.plus()* pionList.plus()* pi0List;
278 }
279 else if(channel=="DptoKsPi") {
281 numchan.push_back(5);
282 numchan.push_back(2);
283 decaylist=ksList* pionList.plus();
284 }
285 else if(channel=="DptoKsPiPi0") {
287 numchan.push_back(5);
288 numchan.push_back(2);
289 numchan.push_back(3);
290 decaylist=ksList* pionList.plus()* pi0List;
291 }
292 else if(channel=="DptoKsPiPiPi") {
294 numchan.push_back(5);
295 numchan.push_back(2);
296 numchan.push_back(2);
297 numchan.push_back(2);
298 decaylist=ksList* pionList.plus()* pionList.plus()* pionList.minus();
299 }
300 else if(channel=="DptoKKPi") {
302 numchan.push_back(1);
303 numchan.push_back(1);
304 numchan.push_back(2);
305 decaylist=kaonList.minus()* kaonList.plus()* pionList.plus();
306 }
307 else if(channel=="DptoPiPi0") {
309 numchan.push_back(2);
310 numchan.push_back(3);
311 decaylist=pionList.plus()* pi0List;
312 }
313 else if(channel=="DptoKPi0") {
315 numchan.push_back(1);
316 numchan.push_back(3);
317 decaylist=kaonList.plus()* pi0List;
318 }
319 else if(channel=="DptoKsK") {
321 numchan.push_back(5);
322 numchan.push_back(1);
323 decaylist=ksList* kaonList.plus();
324 }
325 else if(channel=="DptoPiPiPi") {
327 numchan.push_back(2);
328 numchan.push_back(2);
329 numchan.push_back(2);
330 decaylist=pionList.plus()* pionList.plus()* pionList.minus() ;
331 }
332 else if(channel=="DptoPiPi0Pi0") {
334 numchan.push_back(2);
335 numchan.push_back(3);
336 numchan.push_back(3);
337 decaylist=pionList.plus()* pi0List* pi0List;
338 }
339 else if(channel=="DptoKsKsPi") {
341 numchan.push_back(5);
342 numchan.push_back(5);
343 numchan.push_back(2);
344 decaylist=ksList* ksList* pionList.plus();
345 }
346 else if(channel=="DptoKsKPi0") {
348 numchan.push_back(5);
349 numchan.push_back(1);
350 numchan.push_back(3);
351 decaylist=ksList* kaonList.plus()* pi0List;
352 }
353 else if(channel=="DptoKsKsK") {
355 numchan.push_back(5);
356 numchan.push_back(5);
357 numchan.push_back(1);
358 decaylist=ksList* ksList* kaonList.plus();
359 }
360 else if(channel=="DptoPiPiPiPi0") {
362 numchan.push_back(2);
363 numchan.push_back(2);
364 numchan.push_back(2);
365 numchan.push_back(3);
366 decaylist=pionList.plus()* pionList.plus()* pionList.minus()* pi0List;
367 }
368 else if(channel=="DptoKsPiPi0Pi0") {
370 numchan.push_back(5);
371 numchan.push_back(2);
372 numchan.push_back(3);
373 numchan.push_back(3);
374 decaylist=ksList* pionList.plus()* pi0List* pi0List;
375 }
376 else if(channel=="DptoKsKplusPiPi") {
378 numchan.push_back(5);
379 numchan.push_back(1);
380 numchan.push_back(2);
381 numchan.push_back(2);
382 decaylist=ksList* kaonList.plus()* pionList.plus()* pionList.minus();
383 }
384 else if(channel=="DptoKsKminusPiPi") {
386 numchan.push_back(5);
387 numchan.push_back(1);
388 numchan.push_back(2);
389 numchan.push_back(2);
390 decaylist=ksList* kaonList.minus()* pionList.plus()* pionList.plus();
391 }
392 else if(channel=="DptoKKPiPi0") {
394 numchan.push_back(1);
395 numchan.push_back(1);
396 numchan.push_back(2);
397 numchan.push_back(3);
398 decaylist=kaonList.minus()* kaonList.plus()* pionList.plus()* pi0List;
399 }
400 else if(channel=="DptoPiPiPiPiPi") {
402 numchan.push_back(2);
403 numchan.push_back(2);
404 numchan.push_back(2);
405 numchan.push_back(2);
406 numchan.push_back(2);
407 decaylist=pionList.plus()* pionList.plus()* pionList.plus()* pionList.minus()* pionList.minus();
408 }
409 else if(channel=="DptoKPiPiPiPi") {
411 numchan.push_back(1);
412 numchan.push_back(2);
413 numchan.push_back(2);
414 numchan.push_back(2);
415 numchan.push_back(2);
416 decaylist=kaonList.minus()* pionList.plus()* pionList.plus()* pionList.plus()* pionList.minus();
417 }
418 else if(channel=="DptoPiEta") {
420 numchan.push_back(2);
421 numchan.push_back(4);
422 decaylist=pionList.plus()* etaList;
423 }
424 else if(channel=="DptoKsPiEta") {
426 numchan.push_back(5);
427 numchan.push_back(2);
428 numchan.push_back(4);
429 decaylist=ksList* pionList.plus()* etaList;
430 }
431
434
436
439
440 vector<int> trackid, showerid;
441 vector<int> kaonid, pionid;
442 int numofchildren=numchan.size()-1;
443
444 for(int i=0; i< numofchildren;i++){
445
446 const CDCandidate& daughter=(*it).particle().child(i);
447
448 if(numchan[i+1]==1){
450 trackid.push_back(track->
trackId());
451 kaonid.push_back(track->
trackId());
452 }
453 else if(numchan[i+1]==2){
455 trackid.push_back(track->
trackId());
456 pionid.push_back(track->
trackId());
457 }
458 else if ( numchan[i+1]==3){
461 showerid.push_back(hiEnGamma->
trackId());
462 showerid.push_back(loEnGamma->
trackId());
463 }
464 else if ( numchan[i+1]==4){
467 showerid.push_back(hiEnGamma->
trackId());
468 showerid.push_back(loEnGamma->
trackId());
469 }
470 else if ( numchan[i+1]==5){
472
473 recDTag->
addToFitInfo(aKsCand->
mass(),fitinfo[aKsCand][0],fitinfo[aKsCand][1],fitinfo[aKsCand][2]);
474
477 trackid.push_back(pion1Trk->
trackId());
478 trackid.push_back(pion2Trk->
trackId());
479 }
480
481 }
482
483
485 savetrack(trackid,showerid,charged_begin,charged_end,neutral_begin,neutral_end,recDTag);
486 pidtag(kaonid,pionid,kaonList_tight, pionList_tight,recDTag);
487
488 if(m_usevertexfit){
489 HepLorentzVector p4change_vfit=util.
vfit(channel, kaonid, pionid, xorigin, charged_begin);
490 recDTag->
setp4(recDTag->
p4()+p4change_vfit);
491 }
492
493
494 trackid.clear();
495 showerid.clear();
496 kaonid.clear();
497 pionid.clear();
498
499
500 recDTagCol->push_back(recDTag);
501
502 }
503
504 numchan.clear();
505
506 }
507
508 return StatusCode::SUCCESS;
509}
ChargedDSelector chargedDSelector
void dc_fill(DCFillableChargedList< Charged > &aFillableList, WitnessIterator first, WitnessIterator last)
EvtRecTrackCol::iterator EvtRecTrackIterator
LocalEtatoGGSelector etatoGGSelector
LocalKaonSelector kaonSelector
LocalKsSelector ksSelector
LocalPi0Selector pi0Selector
LocalPionSelector pionSelector
virtual const EvtRecTrack * track() const
virtual const EvtRecVeeVertex * navKshort() const
virtual const EvtRecPi0 * navPi0() const
virtual const EvtRecEtaToGG * navEta() const
void saveDpInfo(CDDecayList::iterator, double, int, EvtRecDTag *)
void pidtag(vector< int >, vector< int >, CDChargedKaonList &, CDChargedPionList &, EvtRecDTag *)
void savetrack(vector< int >, vector< int >, EvtRecTrackIterator, EvtRecTrackIterator, EvtRecTrackIterator, EvtRecTrackIterator, EvtRecDTag *)
void setbeta(Hep3Vector beta)
void setebeam(double ebeam)
void setdecayMode(DecayMode decayMode)
HepLorentzVector p4() const
void setp4(HepLorentzVector p4)
void addToFitInfo(double ksmass, double chi2, double length, double error)
const EvtRecTrack * hiEnGamma() const
const EvtRecTrack * loEnGamma() const
const EvtRecTrack * loEnGamma() const
const EvtRecTrack * hiEnGamma() const
SmartRef< EvtRecTrack > & daughter(int i)
virtual bool isVertexValid()=0
virtual double * PrimaryVertex()=0
void setpidtype(int type)
void setpidtype(int type)
bool setcalib(bool calib)
CLHEP::Hep3Vector getbeta()
HepLorentzVector vfit(string channel, vector< int > kaonid, vector< int > pionid, HepPoint3D vx, EvtRecTrackIterator charged_begin)
vector< double > SecondaryVFit(EvtRecVeeVertex *ks, IVertexDbSvc *vtxsvc)
_EXTERN_ std::string EvtRecEvent
_EXTERN_ std::string EvtRecDTagCol
_EXTERN_ std::string EvtRecTrackCol