105 {
106 MsgStream log(
msgSvc(), name());
107 log << MSG::INFO << "in execute()" << endreq;
108
109 StatusCode sc;
110
111
112
113
114 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
115 int event= eventHeader->eventNumber();
116
117
118
121 log << MSG::DEBUG << "run and event = " << eventHeader->runNumber()
122 << " " << eventHeader->eventNumber() << endreq;
123 log << MSG::DEBUG <<"ncharg, nneu, tottks = "
124 << recEvent->totalCharged() << " , "
125 << recEvent->totalNeutral() << " , "
126 << recEvent->totalTracks() <<endreq;
127
130
133
134
135 SmartDataPtr<EvtRecPi0Col> recPi0Col(eventSvc(), "/Event/EvtRec/EvtRecPi0Col");
136 if ( ! recPi0Col ) {
137 log << MSG::FATAL << "Could not find EvtRecPi0Col" << endreq;
138 return StatusCode::FAILURE;
139 }
140
141
142
143 SmartDataPtr<EvtRecEtaToGGCol> recEtaToGGCol(eventSvc(), "/Event/EvtRec/EvtRecEtaToGGCol");
144 if ( ! recEtaToGGCol ) {
145 log << MSG::FATAL << "Could not find EvtRecEtaToGGCol" << endreq;
146 return StatusCode::FAILURE;
147 }
148
149
150 SmartDataPtr<EvtRecVeeVertexCol> recVeeVertexCol(eventSvc(), "/Event/EvtRec/EvtRecVeeVertexCol");
151 if ( ! recVeeVertexCol ) {
152 log << MSG::FATAL << "Could not find EvtRecVeeVertexCol" << endreq;
153 return StatusCode::FAILURE;
154 }
155
156
158 if (!recDTagCol) {
159 log << MSG::FATAL << "EvtRecDTagCol is not registered in TDS" << endreq;
160 return StatusCode::FAILURE;
161 }
162
163
164 Hep3Vector xorigin(0,0,0);
166 Gaudi::svcLocator()->service("VertexDbSvc", vtxsvc);
168
169
171 xorigin.setX(vertex[0]);
172 xorigin.setY(vertex[1]);
173 xorigin.setZ(vertex[2]);
174 }
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
199
201 dc_fill(ksList, recVeeVertexCol->begin(), recVeeVertexCol->end());
202
203
204 map<EvtRecVeeVertex*, vector< double > > fitinfo;
205 for(
CDKsList::iterator ksit = ksList.particle_begin(); ksit != ksList.particle_end(); ++ksit ){
207
208 if(m_useVFrefine){
210 }else{
212 }
213
214 }
215
217 dc_fill(pi0List, recPi0Col->begin(), recPi0Col->end());
218
220 dc_fill(etaList, recEtaToGGCol->begin(), recEtaToGGCol->end());
221
222
223
228
229 int run = eventHeader->runNumber();
230 m_ievt = eventHeader->eventNumber();
231 m_nChrg = recEvent->totalCharged();
232 m_nNeu = recEvent->totalNeutral();
233 m_nPion = pionList.size();
234 m_nKaon = kaonList.size();
235 m_nPi0 = pi0List.size();
236 m_nKs = ksList.size();
237
238
239
240
241
242 if(m_ReadBeamEFromDB && m_irun!=run){
243 m_irun=run;
244 if(m_usecalibBeamE)
246 m_beamE=m_readDb.
getbeamE(m_irun, m_beamE);
247 if(run>0)
249
250
251 }
252 double ebeam=m_beamE;
253
254
255
256
257
258
259
260 for(int list=0;list<chanlist.size();list++){
261
262 string channel=chanlist[list];
263 vector<int> numchan;
267
268 bool isFlavorMode=false;
269
270
271
272
273
274
275 if(channel=="D0toKPi") {
277 numchan.push_back(1);
278 numchan.push_back(2);
279 decaylist=kaonList.minus() * pionList.plus();
280 isFlavorMode=true;
281 }
282 else if(channel=="D0toKPiPi0"){
284 numchan.push_back(1);
285 numchan.push_back(2);
286 numchan.push_back(3);
287 decaylist=kaonList.minus() * pionList.plus() * pi0List;
288 isFlavorMode=true;
289 }
290 else if(channel=="D0toKPiPi0Pi0"){
292 numchan.push_back(1);
293 numchan.push_back(2);
294 numchan.push_back(3);
295 numchan.push_back(3);
296 decaylist=kaonList.minus() * pionList.plus() * pi0List * pi0List;
297 isFlavorMode=true;
298 }
299 else if(channel=="D0toKPiPiPi"){
301 numchan.push_back(1);
302 numchan.push_back(2);
303 numchan.push_back(2);
304 numchan.push_back(2);
305 decaylist=kaonList.minus()* pionList.plus()* pionList.plus() * pionList.minus();
306 isFlavorMode=true;
307 }
308 else if(channel=="D0toKPiPiPiPi0"){
310 numchan.push_back(1);
311 numchan.push_back(2);
312 numchan.push_back(2);
313 numchan.push_back(2);
314 numchan.push_back(3);
315 decaylist=kaonList.minus()* pionList.plus()* pionList.plus()* pionList.minus()* pi0List;
316 isFlavorMode=true;
317 }
318 else if(channel=="D0toKPiEta"){
320 numchan.push_back(1);
321 numchan.push_back(2);
322 numchan.push_back(4);
323 decaylist=kaonList.minus() * pionList.plus() * etaList;
324 isFlavorMode=true;
325 }
326 else if(channel=="D0toKsKPi"){
328 numchan.push_back(5);
329 numchan.push_back(1);
330 numchan.push_back(2);
331 decaylist=ksList* kaonList.minus()* pionList.plus();
332 }
333 else if(channel=="D0toKsKPiPi0"){
335 numchan.push_back(5);
336 numchan.push_back(1);
337 numchan.push_back(2);
338 numchan.push_back(3);
339 decaylist=ksList* kaonList.minus() * pionList.plus()* pi0List;
340 }
341 else if(channel=="D0toKsPiPi"){
343 numchan.push_back(5);
344 numchan.push_back(2);
345 numchan.push_back(2);
346 decaylist=ksList* pionList.plus()* pionList.minus();
347 }
348 else if(channel=="D0toKsPiPiPi0"){
350 numchan.push_back(5);
351 numchan.push_back(2);
352 numchan.push_back(2);
353 numchan.push_back(3);
354 decaylist=ksList* pionList.plus()* pionList.minus()* pi0List;
355 }
356 else if(channel=="D0toKsPi0"){
358 numchan.push_back(5);
359 numchan.push_back(3);
360 decaylist=ksList* pi0List;
361 }
362 else if(channel=="D0toPiPiPi0"){
364 numchan.push_back(2);
365 numchan.push_back(2);
366 numchan.push_back(3);
367 decaylist=pionList.plus()* pionList.minus()* pi0List;
368 }
369 else if(channel=="D0toPiPi"){
371 numchan.push_back(2);
372 numchan.push_back(2);
373 decaylist=pionList.plus()* pionList.minus();
374 }
375 else if(channel=="D0toKK"){
377 numchan.push_back(1);
378 numchan.push_back(1);
379 decaylist=kaonList.minus()* kaonList.plus();
380 }
381 else if(channel=="D0toKKPi0"){
383 numchan.push_back(1);
384 numchan.push_back(1);
385 numchan.push_back(3);
386 decaylist=kaonList.minus()* kaonList.plus()* pi0List;
387 }
388 else if(channel=="D0toPi0Pi0"){
390 numchan.push_back(3);
391 numchan.push_back(3);
392 decaylist=pi0List* pi0List;
393 }
394 else if(channel=="D0toKsKs"){
396 numchan.push_back(5);
397 numchan.push_back(5);
398 decaylist=ksList* ksList;
399 }
400 else if(channel=="D0toKsKsPi0"){
402 numchan.push_back(5);
403 numchan.push_back(5);
404 numchan.push_back(3);
405 decaylist=ksList* ksList* pi0List;
406 }
407 else if(channel=="D0toKsPi0Pi0"){
409 numchan.push_back(5);
410 numchan.push_back(3);
411 numchan.push_back(3);
412 decaylist=ksList* pi0List* pi0List;
413 }
414 else if(channel=="D0toKsKK"){
416 numchan.push_back(5);
417 numchan.push_back(1);
418 numchan.push_back(1);
419 decaylist=ksList* kaonList.minus()* kaonList.plus();
420 }
421 else if(channel=="D0toKsEta"){
423 numchan.push_back(5);
424 numchan.push_back(4);
425 decaylist=ksList* etaList;
426 }
427 else if(channel=="D0toPi0Pi0Pi0"){
429 numchan.push_back(3);
430 numchan.push_back(3);
431 numchan.push_back(3);
432 decaylist=pi0List* pi0List* pi0List;
433 }
434 else if(channel=="D0toKsKsKs"){
436 numchan.push_back(5);
437 numchan.push_back(5);
438 numchan.push_back(5);
439 decaylist=ksList* ksList* ksList;
440 }
441 else if(channel=="D0toPiPiPiPi"){
443 numchan.push_back(2);
444 numchan.push_back(2);
445 numchan.push_back(2);
446 numchan.push_back(2);
447 decaylist=pionList.plus()* pionList.plus()* pionList.minus()* pionList.minus();
448 }
449 else if(channel=="D0toPiPiPi0Pi0"){
451 numchan.push_back(2);
452 numchan.push_back(2);
453 numchan.push_back(3);
454 numchan.push_back(3);
455 decaylist=pionList.plus()* pionList.minus()* pi0List* pi0List;
456 }
457 else if(channel=="D0toKKPiPi"){
459 numchan.push_back(1);
460 numchan.push_back(1);
461 numchan.push_back(2);
462 numchan.push_back(2);
463 decaylist=kaonList.minus()* kaonList.plus()* pionList.plus()* pionList.minus();
464 }
465 else if(channel=="D0toKKPi0Pi0"){
467 numchan.push_back(1);
468 numchan.push_back(1);
469 numchan.push_back(3);
470 numchan.push_back(3);
471 decaylist=kaonList.minus()* kaonList.plus()* pi0List* pi0List;
472 }
473 else if(channel=="D0toKsKsPiPi"){
475 numchan.push_back(5);
476 numchan.push_back(5);
477 numchan.push_back(2);
478 numchan.push_back(2);
479 decaylist=ksList* ksList* pionList.plus()* pionList.minus();
480 }
481 else if(channel=="D0toPiPiPiPiPi0"){
483 numchan.push_back(2);
484 numchan.push_back(2);
485 numchan.push_back(2);
486 numchan.push_back(2);
487 numchan.push_back(3);
488 decaylist=pionList.plus()* pionList.plus()* pionList.minus()* pionList.minus()* pi0List;
489 }
490 else if(channel=="D0toKsPiPiPiPi"){
492 numchan.push_back(5);
493 numchan.push_back(2);
494 numchan.push_back(2);
495 numchan.push_back(2);
496 numchan.push_back(2);
497 decaylist=ksList* pionList.plus()* pionList.plus()* pionList.minus()* pionList.minus();
498 }
499 else if(channel=="D0toKKPiPiPi0"){
501 numchan.push_back(1);
502 numchan.push_back(1);
503 numchan.push_back(2);
504 numchan.push_back(2);
505 numchan.push_back(3);
506 decaylist=kaonList.minus()* kaonList.plus()* pionList.plus()* pionList.minus()* pi0List;
507 }
508 else if(channel=="D0toKsPi0Eta"){
510 numchan.push_back(5);
511 numchan.push_back(3);
512 numchan.push_back(4);
513 decaylist=ksList* pi0List* etaList;
514 }
515 else if(channel=="D0toKsEPPiPiEta"){
517 numchan.push_back(5);
518 numchan.push_back(6);
520 epList=pionList.plus()* pionList.minus()* etaList;
521 decaylist= ksList* epList;
522 }
523 else if(channel=="D0toKsEPRhoGam"){
525 numchan.push_back(5);
526 numchan.push_back(7);
528 rhoList=pionList.plus()* pionList.minus();
530 epList=rhoList* photonList;
531 decaylist= ksList* epList;
532 }
533 else if(channel=="D0toKsPi0Pi0Pi0"){
535 numchan.push_back(5);
536 numchan.push_back(3);
537 numchan.push_back(3);
538 numchan.push_back(3);
539 decaylist=ksList* pi0List* pi0List* pi0List;
540 }
541
542
545
547
550
551
552 vector<int> trackid, showerid;
553 vector<int> kaonid, pionid;
554 int charm=0;
555 int numofchildren=numchan.size()-1;
556
557 for(int i=0; i< numofchildren;i++){
558
559 const CDCandidate& daughter=(*it).particle().child(i);
560 if(isFlavorMode && i==0)
562
563 if(numchan[i+1]==1){
565 trackid.push_back(track->
trackId());
566 kaonid.push_back(track->
trackId());
567 }
568 else if(numchan[i+1]==2){
570 trackid.push_back(track->
trackId());
571 pionid.push_back(track->
trackId());
572 }
573 else if ( numchan[i+1]==3){
576 showerid.push_back(hiEnGamma->
trackId());
577 showerid.push_back(loEnGamma->
trackId());
578 }
579 else if ( numchan[i+1]==4){
582 showerid.push_back(hiEnGamma->
trackId());
583 showerid.push_back(loEnGamma->
trackId());
584 }
585 else if ( numchan[i+1]==5){
587
588 recDTag->
addToFitInfo(aKsCand->
mass(),fitinfo[aKsCand][0],fitinfo[aKsCand][1],fitinfo[aKsCand][2]);
589
592 trackid.push_back(pion1Trk->
trackId());
593 trackid.push_back(pion2Trk->
trackId());
594 }
595 else if (numchan[i+1]==6){
603
604 trackid.push_back(apiontrk->
trackId());
605 trackid.push_back(spiontrk->
trackId());
606 showerid.push_back(hiEnGamma->
trackId());
607 showerid.push_back(loEnGamma->
trackId());
608
609 }
610 else if (numchan[i+1]==7){
615
616
620
621
622 trackid.push_back(apiontrk->
trackId());
623 trackid.push_back(spiontrk->
trackId());
624 showerid.push_back(gammatrk->
trackId());
625
626 }
627
628
629 }
630
631
633 savetrack(trackid,showerid,charged_begin,charged_end,neutral_begin,neutral_end,recDTag);
634 pidtag(kaonid,pionid,kaonList_tight, pionList_tight,recDTag);
635
636 if(m_usevertexfit){
637 if(m_debug) cout<<"beforevfit:"<<endl;
638
639 HepLorentzVector p4change_vfit;
640
641 if(m_useVFrefine){
642 p4change_vfit=util.
vfitref(channel, kaonid, pionid, xorigin, charged_begin);
643 }else{
644 p4change_vfit=util.
vfit(channel, kaonid, pionid, xorigin, charged_begin);
645 }
646
647 recDTag->
setp4(recDTag->
p4()+p4change_vfit);
648 }
649
650
651 trackid.clear();
652 showerid.clear();
653 kaonid.clear();
654 pionid.clear();
655
656
657
658 recDTagCol->push_back(recDTag);
659
660 }
661
662 numchan.clear();
663
664 }
665
666
667 return StatusCode::SUCCESS;
668}
void dc_fill(DCFillableChargedList< Charged > &aFillableList, WitnessIterator first, WitnessIterator last)
EvtRecTrackCol::iterator EvtRecTrackIterator
LocalEptoPiPiEtaSelector eptoPiPiEtaSelector
LocalEptoRhoGamSelector eptoRhoGamSelector
LocalEtatoGGSelector etatoGGSelector
LocalKaonSelector kaonSelector
LocalKsSelector ksSelector
LocalPhotonSelector photonSelector
LocalPi0Selector pi0Selector
LocalPionSelector pionSelector
LocalRhotoPiPiSelector rhotoPiPiSelector
NeutralDSelector neutralDSelector
virtual const DecayEvidence & decay() const
virtual const EvtRecTrack * photon() const
virtual const EvtRecTrack * track() const
virtual const EvtRecVeeVertex * navKshort() const
virtual const EvtRecPi0 * navPi0() const
virtual const EvtRecEtaToGG * navEta() const
const CDCandidate & child(unsigned int aPosition) const
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
virtual bool isVertexValid()=0
virtual double * PrimaryVertex()=0
void setpidtype(int type)
void setpidtype(int type)
void savetrack(vector< int >, vector< int >, EvtRecTrackIterator, EvtRecTrackIterator, EvtRecTrackIterator, EvtRecTrackIterator, EvtRecDTag *)
void pidtag(vector< int >, vector< int >, CDChargedKaonList &, CDChargedPionList &, EvtRecDTag *)
void saveD0Info(CDDecayList::iterator, double, int, int, EvtRecDTag *)
void setbeta(Hep3Vector beta)
void setebeam(double ebeam)
bool setcalib(bool calib)
CLHEP::Hep3Vector getbeta()
HepLorentzVector vfitref(string channel, vector< int > kaonid, vector< int > pionid, HepPoint3D vx, EvtRecTrackIterator charged_begin)
vector< double > SecondaryVFitref(EvtRecVeeVertex *ks, IVertexDbSvc *vtxsvc)
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