114 {
115 MsgStream log(
msgSvc(), name());
116 log << MSG::INFO << "in execute()" << endreq;
117
118 StatusCode sc;
119
120
121
122
123 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
124 int event= eventHeader->eventNumber();
125
126
127
130 log << MSG::DEBUG << "run and event = " << eventHeader->runNumber()
131 << " " << eventHeader->eventNumber() << endreq;
132 log << MSG::DEBUG <<"ncharg, nneu, tottks = "
133 << recEvent->totalCharged() << " , "
134 << recEvent->totalNeutral() << " , "
135 << recEvent->totalTracks() <<endreq;
136
139
142
143
144 SmartDataPtr<EvtRecPi0Col> recPi0Col(eventSvc(), "/Event/EvtRec/EvtRecPi0Col");
145 if ( ! recPi0Col ) {
146 log << MSG::FATAL << "Could not find EvtRecPi0Col" << endreq;
147 return StatusCode::FAILURE;
148 }
149
150
151
152 SmartDataPtr<EvtRecEtaToGGCol> recEtaToGGCol(eventSvc(), "/Event/EvtRec/EvtRecEtaToGGCol");
153 if ( ! recEtaToGGCol ) {
154 log << MSG::FATAL << "Could not find EvtRecEtaToGGCol" << endreq;
155 return StatusCode::FAILURE;
156 }
157
158
159 SmartDataPtr<EvtRecVeeVertexCol> recVeeVertexCol(eventSvc(), "/Event/EvtRec/EvtRecVeeVertexCol");
160 if ( ! recVeeVertexCol ) {
161 log << MSG::FATAL << "Could not find EvtRecVeeVertexCol" << endreq;
162 return StatusCode::FAILURE;
163 }
164
165
167 if (!recDTagCol) {
168 log << MSG::FATAL << "EvtRecDTagCol is not registered in TDS" << endreq;
169 return StatusCode::FAILURE;
170 }
171
172
173 Hep3Vector xorigin(0,0,0);
175 Gaudi::svcLocator()->service("VertexDbSvc", vtxsvc);
177
178
180 xorigin.setX(vertex[0]);
181 xorigin.setY(vertex[1]);
182 xorigin.setZ(vertex[2]);
183 }
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
208
210 dc_fill(ksList, recVeeVertexCol->begin(), recVeeVertexCol->end());
211
212
213 map<EvtRecVeeVertex*, vector< double > > fitinfo;
214 for(
CDKsList::iterator ksit = ksList.particle_begin(); ksit != ksList.particle_end(); ++ksit ){
217 }
218
220 dc_fill(pi0List, recPi0Col->begin(), recPi0Col->end());
221
223 dc_fill(etaList, recEtaToGGCol->begin(), recEtaToGGCol->end());
224
225
226
231
232 int run = eventHeader->runNumber();
233 m_ievt = eventHeader->eventNumber();
234 m_nChrg = recEvent->totalCharged();
235 m_nNeu = recEvent->totalNeutral();
236 m_nPion = pionList.size();
237 m_nKaon = kaonList.size();
238 m_nPi0 = pi0List.size();
239 m_nKs = ksList.size();
240
241
242
243
244
245
246 if(m_RdMeasuredEcms&&m_irun!=run){
249 m_beta.setX(ecmsSvc->
getPx(run));
250 m_beta.setY(ecmsSvc->
getPy(run));
251 m_beta.setZ(ecmsSvc->
getPz(run));
252 }
253 }
254 log << MSG::INFO << "MeasuredEcmsSvc: " <<m_beamE<< endreq;
255
256
257 if(m_ReadBeamEFromDB && m_irun!=run){
258 m_irun=run;
259 if(m_usecalibBeamE)
261 m_beamE=m_readDb.
getbeamE(m_irun, m_beamE);
262 if(run>0)
264
265
266 }
267 double ebeam=m_beamE;
268
269
270
271
272
273
274
275 for(int list=0;list<chanlist.size();list++){
276
277 string channel=chanlist[list];
278 vector<int> numchan;
282
283 bool isFlavorMode=false;
284
285
286
287
288
289
290 if(channel=="D0toKPi") {
292 numchan.push_back(1);
293 numchan.push_back(2);
294 decaylist=kaonList.minus() * pionList.plus();
295 isFlavorMode=true;
296 }
297 else if(channel=="D0toKPiPi0"){
299 numchan.push_back(1);
300 numchan.push_back(2);
301 numchan.push_back(3);
302 decaylist=kaonList.minus() * pionList.plus() * pi0List;
303 isFlavorMode=true;
304 }
305 else if(channel=="D0toKPiPi0Pi0"){
307 numchan.push_back(1);
308 numchan.push_back(2);
309 numchan.push_back(3);
310 numchan.push_back(3);
311 decaylist=kaonList.minus() * pionList.plus() * pi0List * pi0List;
312 isFlavorMode=true;
313 }
314 else if(channel=="D0toKPiPiPi"){
316 numchan.push_back(1);
317 numchan.push_back(2);
318 numchan.push_back(2);
319 numchan.push_back(2);
320 decaylist=kaonList.minus()* pionList.plus()* pionList.plus() * pionList.minus();
321 isFlavorMode=true;
322 }
323 else if(channel=="D0toKPiPiPiPi0"){
325 numchan.push_back(1);
326 numchan.push_back(2);
327 numchan.push_back(2);
328 numchan.push_back(2);
329 numchan.push_back(3);
330 decaylist=kaonList.minus()* pionList.plus()* pionList.plus()* pionList.minus()* pi0List;
331 isFlavorMode=true;
332 }
333 else if(channel=="D0toKPiEta"){
335 numchan.push_back(1);
336 numchan.push_back(2);
337 numchan.push_back(4);
338 decaylist=kaonList.minus() * pionList.plus() * etaList;
339 isFlavorMode=true;
340 }
341 else if(channel=="D0toKsKPi"){
343 numchan.push_back(5);
344 numchan.push_back(1);
345 numchan.push_back(2);
346 decaylist=ksList* kaonList.minus()* pionList.plus();
347 }
348 else if(channel=="D0toKsKPiPi0"){
350 numchan.push_back(5);
351 numchan.push_back(1);
352 numchan.push_back(2);
353 numchan.push_back(3);
354 decaylist=ksList* kaonList.minus() * pionList.plus()* pi0List;
355 }
356 else if(channel=="D0toKsPiPi"){
358 numchan.push_back(5);
359 numchan.push_back(2);
360 numchan.push_back(2);
361 decaylist=ksList* pionList.plus()* pionList.minus();
362 }
363 else if(channel=="D0toKsPiPiPi0"){
365 numchan.push_back(5);
366 numchan.push_back(2);
367 numchan.push_back(2);
368 numchan.push_back(3);
369 decaylist=ksList* pionList.plus()* pionList.minus()* pi0List;
370 }
371 else if(channel=="D0toKsPi0"){
373 numchan.push_back(5);
374 numchan.push_back(3);
375 decaylist=ksList* pi0List;
376 }
377 else if(channel=="D0toPiPiPi0"){
379 numchan.push_back(2);
380 numchan.push_back(2);
381 numchan.push_back(3);
382 decaylist=pionList.plus()* pionList.minus()* pi0List;
383 }
384 else if(channel=="D0toPiPi"){
386 numchan.push_back(2);
387 numchan.push_back(2);
388 decaylist=pionList.plus()* pionList.minus();
389 }
390 else if(channel=="D0toKK"){
392 numchan.push_back(1);
393 numchan.push_back(1);
394 decaylist=kaonList.minus()* kaonList.plus();
395 }
396 else if(channel=="D0toKKPi0"){
398 numchan.push_back(1);
399 numchan.push_back(1);
400 numchan.push_back(3);
401 decaylist=kaonList.minus()* kaonList.plus()* pi0List;
402 }
403 else if(channel=="D0toPi0Pi0"){
405 numchan.push_back(3);
406 numchan.push_back(3);
407 decaylist=pi0List* pi0List;
408 }
409 else if(channel=="D0toKsKs"){
411 numchan.push_back(5);
412 numchan.push_back(5);
413 decaylist=ksList* ksList;
414 }
415 else if(channel=="D0toKsKsPi0"){
417 numchan.push_back(5);
418 numchan.push_back(5);
419 numchan.push_back(3);
420 decaylist=ksList* ksList* pi0List;
421 }
422 else if(channel=="D0toKsPi0Pi0"){
424 numchan.push_back(5);
425 numchan.push_back(3);
426 numchan.push_back(3);
427 decaylist=ksList* pi0List* pi0List;
428 }
429 else if(channel=="D0toKsKK"){
431 numchan.push_back(5);
432 numchan.push_back(1);
433 numchan.push_back(1);
434 decaylist=ksList* kaonList.minus()* kaonList.plus();
435 }
436 else if(channel=="D0toKsEta"){
438 numchan.push_back(5);
439 numchan.push_back(4);
440 decaylist=ksList* etaList;
441 }
442 else if(channel=="D0toPi0Pi0Pi0"){
444 numchan.push_back(3);
445 numchan.push_back(3);
446 numchan.push_back(3);
447 decaylist=pi0List* pi0List* pi0List;
448 }
449 else if(channel=="D0toKsKsKs"){
451 numchan.push_back(5);
452 numchan.push_back(5);
453 numchan.push_back(5);
454 decaylist=ksList* ksList* ksList;
455 }
456 else if(channel=="D0toPiPiPiPi"){
458 numchan.push_back(2);
459 numchan.push_back(2);
460 numchan.push_back(2);
461 numchan.push_back(2);
462 decaylist=pionList.plus()* pionList.plus()* pionList.minus()* pionList.minus();
463 }
464 else if(channel=="D0toPiPiPi0Pi0"){
466 numchan.push_back(2);
467 numchan.push_back(2);
468 numchan.push_back(3);
469 numchan.push_back(3);
470 decaylist=pionList.plus()* pionList.minus()* pi0List* pi0List;
471 }
472 else if(channel=="D0toKKPiPi"){
474 numchan.push_back(1);
475 numchan.push_back(1);
476 numchan.push_back(2);
477 numchan.push_back(2);
478 decaylist=kaonList.minus()* kaonList.plus()* pionList.plus()* pionList.minus();
479 }
480 else if(channel=="D0toKKPi0Pi0"){
482 numchan.push_back(1);
483 numchan.push_back(1);
484 numchan.push_back(3);
485 numchan.push_back(3);
486 decaylist=kaonList.minus()* kaonList.plus()* pi0List* pi0List;
487 }
488 else if(channel=="D0toKsKsPiPi"){
490 numchan.push_back(5);
491 numchan.push_back(5);
492 numchan.push_back(2);
493 numchan.push_back(2);
494 decaylist=ksList* ksList* pionList.plus()* pionList.minus();
495 }
496 else if(channel=="D0toPiPiPiPiPi0"){
498 numchan.push_back(2);
499 numchan.push_back(2);
500 numchan.push_back(2);
501 numchan.push_back(2);
502 numchan.push_back(3);
503 decaylist=pionList.plus()* pionList.plus()* pionList.minus()* pionList.minus()* pi0List;
504 }
505 else if(channel=="D0toKsPiPiPiPi"){
507 numchan.push_back(5);
508 numchan.push_back(2);
509 numchan.push_back(2);
510 numchan.push_back(2);
511 numchan.push_back(2);
512 decaylist=ksList* pionList.plus()* pionList.plus()* pionList.minus()* pionList.minus();
513 }
514 else if(channel=="D0toKKPiPiPi0"){
516 numchan.push_back(1);
517 numchan.push_back(1);
518 numchan.push_back(2);
519 numchan.push_back(2);
520 numchan.push_back(3);
521 decaylist=kaonList.minus()* kaonList.plus()* pionList.plus()* pionList.minus()* pi0List;
522 }
523 else if(channel=="D0toKsPi0Eta"){
525 numchan.push_back(5);
526 numchan.push_back(3);
527 numchan.push_back(4);
528 decaylist=ksList* pi0List* etaList;
529 }
530 else if(channel=="D0toKsEPPiPiEta"){
532 numchan.push_back(5);
533 numchan.push_back(6);
535 epList=pionList.plus()* pionList.minus()* etaList;
536 decaylist= ksList* epList;
537 }
538 else if(channel=="D0toKsEPRhoGam"){
540 numchan.push_back(5);
541 numchan.push_back(7);
543 rhoList=pionList.plus()* pionList.minus();
545 epList=rhoList* photonList;
546 decaylist= ksList* epList;
547 }
548 else if(channel=="D0toKsPi0Pi0Pi0"){
550 numchan.push_back(5);
551 numchan.push_back(3);
552 numchan.push_back(3);
553 numchan.push_back(3);
554 decaylist=ksList* pi0List* pi0List* pi0List;
555 }
556
557
560
562
565
566
567 vector<int> trackid, showerid;
568 vector<int> kaonid, pionid;
569 int charm=0;
570 int numofchildren=numchan.size()-1;
571
572 for(int i=0; i< numofchildren;i++){
573
574 const CDCandidate& daughter=(*it).particle().child(i);
575 if(isFlavorMode && i==0)
577
578 if(numchan[i+1]==1){
580 trackid.push_back(track->
trackId());
581 kaonid.push_back(track->
trackId());
582 }
583 else if(numchan[i+1]==2){
585 trackid.push_back(track->
trackId());
586 pionid.push_back(track->
trackId());
587 }
588 else if ( numchan[i+1]==3){
591 showerid.push_back(hiEnGamma->
trackId());
592 showerid.push_back(loEnGamma->
trackId());
593 }
594 else if ( numchan[i+1]==4){
597 showerid.push_back(hiEnGamma->
trackId());
598 showerid.push_back(loEnGamma->
trackId());
599 }
600 else if ( numchan[i+1]==5){
602
603 recDTag->
addToFitInfo(aKsCand->
mass(),fitinfo[aKsCand][0],fitinfo[aKsCand][1],fitinfo[aKsCand][2]);
604
607 trackid.push_back(pion1Trk->
trackId());
608 trackid.push_back(pion2Trk->
trackId());
609 }
610 else if (numchan[i+1]==6){
618
619 trackid.push_back(apiontrk->
trackId());
620 trackid.push_back(spiontrk->
trackId());
621 showerid.push_back(hiEnGamma->
trackId());
622 showerid.push_back(loEnGamma->
trackId());
623
624 }
625 else if (numchan[i+1]==7){
630
631
635
636
637 trackid.push_back(apiontrk->
trackId());
638 trackid.push_back(spiontrk->
trackId());
639 showerid.push_back(gammatrk->
trackId());
640
641 }
642
643
644 }
645
646
648 savetrack(trackid,showerid,charged_begin,charged_end,neutral_begin,neutral_end,recDTag);
649 pidtag(kaonid,pionid,kaonList_tight, pionList_tight,recDTag);
650
651 if(m_usevertexfit){
652 HepLorentzVector p4change_vfit=util.
vfit(channel, kaonid, pionid, xorigin, charged_begin);
653 recDTag->
setp4(recDTag->
p4()+p4change_vfit);
654 }
655
656
657 trackid.clear();
658 showerid.clear();
659 kaonid.clear();
660 pionid.clear();
661
662
663
664 recDTagCol->push_back(recDTag);
665
666 }
667
668 numchan.clear();
669
670 }
671
672
673 return StatusCode::SUCCESS;
674}
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
SmartRef< EvtRecTrack > & daughter(int i)
virtual double getPz(int runNo)=0
virtual bool isReadDBValid(int runNo, char *tab, char *col)=0
virtual double getPx(int runNo)=0
virtual double getInfo(int runNo, char *tab, char *col)=0
virtual bool isRunNoValid(int runNo)=0
virtual double getPy(int runNo)=0
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 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