113 {
114 MsgStream log(
msgSvc(), name());
115 log << MSG::INFO << "in execute()" << endreq;
116
117 StatusCode sc;
118
119
120
121
122 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
123 int event= eventHeader->eventNumber();
124
125
126
129 log << MSG::DEBUG << "run and event = " << eventHeader->runNumber()
130 << " " << eventHeader->eventNumber() << endreq;
131 log << MSG::DEBUG <<"ncharg, nneu, tottks = "
132 << recEvent->totalCharged() << " , "
133 << recEvent->totalNeutral() << " , "
134 << recEvent->totalTracks() <<endreq;
135
138
141
142
143 SmartDataPtr<EvtRecPi0Col> recPi0Col(eventSvc(), "/Event/EvtRec/EvtRecPi0Col");
144 if ( ! recPi0Col ) {
145 log << MSG::FATAL << "Could not find EvtRecPi0Col" << endreq;
146 return StatusCode::FAILURE;
147 }
148
149 SmartDataPtr<EvtRecEtaToGGCol> recEtaToGGCol(eventSvc(), "/Event/EvtRec/EvtRecEtaToGGCol");
150 if ( ! recEtaToGGCol ) {
151 log << MSG::FATAL << "Could not find EvtRecEtaToGGCol" << endreq;
152 return StatusCode::FAILURE;
153 }
154
155
156 SmartDataPtr<EvtRecVeeVertexCol> recVeeVertexCol(eventSvc(), "/Event/EvtRec/EvtRecVeeVertexCol");
157 if ( ! recVeeVertexCol ) {
158 log << MSG::FATAL << "Could not find EvtRecVeeVertexCol" << endreq;
159 return StatusCode::FAILURE;
160 }
161
162
164 if (!recDTagCol) {
165 log << MSG::FATAL << "EvtRecDTagCol is not registered yet" << endreq;
166 return StatusCode::FAILURE;
167 }
168
169
170
171 Hep3Vector xorigin(0,0,0);
173 Gaudi::svcLocator()->service("VertexDbSvc", vtxsvc);
175
176
178 xorigin.setX(vertex[0]);
179 xorigin.setY(vertex[1]);
180 xorigin.setZ(vertex[2]);
181 }
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
206
208 dc_fill(ksList, recVeeVertexCol->begin(), recVeeVertexCol->end());
209
210
211
212 map<EvtRecVeeVertex*, vector< double > > fitinfo;
213 for(
CDKsList::iterator ksit = ksList.particle_begin(); ksit != ksList.particle_end(); ++ksit ){
216 }
217
219 dc_fill(pi0List, recPi0Col->begin(), recPi0Col->end());
220
222 dc_fill(etaList, recEtaToGGCol->begin(), recEtaToGGCol->end());
223
224
229
230
231 int run = eventHeader->runNumber();
232 m_ievt = eventHeader->eventNumber();
233 m_nChrg = recEvent->totalCharged();
234 m_nNeu = recEvent->totalNeutral();
235 m_nPion = pionList.size();
236 m_nKaon = kaonList.size();
237 m_nPi0 = pi0List.size();
238 m_nKs = ksList.size();
239
240
241
242
243
244
245 if(m_RdMeasuredEcms&&m_irun!=run){
248 m_beta.setX(ecmsSvc->
getPx(run));
249 m_beta.setY(ecmsSvc->
getPy(run));
250 m_beta.setZ(ecmsSvc->
getPz(run));
251 }
252 }
253 log << MSG::INFO << "MeasuredEcmsSvc: " <<m_beamE<< endreq;
254
255
256 if(m_ReadBeamEFromDB && m_irun!=run){
257 m_irun=run;
258 if(m_usecalibBeamE)
260 m_beamE=m_readDb.
getbeamE(m_irun,m_beamE);
261 if(run>0)
263
264 }
265 double ebeam=m_beamE;
266
267
268
269
270
271
272 for(int list=0;list<chanlist.size();list++){
273
274 string channel=chanlist[list];
275 vector<int> numchan;
279
280
281
282
283
284
285
286
287
288
289 if(channel=="DstoKsK") {
291 numchan.push_back(5);
292 numchan.push_back(1);
293 decaylist=ksList* kaonList.plus();
294 }
295 else if(channel=="DstoKKPi") {
297 numchan.push_back(1);
298 numchan.push_back(1);
299 numchan.push_back(2);
300 decaylist=kaonList.minus()* kaonList.plus()* pionList.plus();
301 }
302 else if(channel=="DstoKsKPi0") {
304 numchan.push_back(5);
305 numchan.push_back(1);
306 numchan.push_back(3);
307 decaylist=ksList* kaonList.plus()* pi0List;
308 }
309 else if(channel=="DstoKsKsPi") {
311 numchan.push_back(5);
312 numchan.push_back(5);
313 numchan.push_back(2);
314 decaylist=ksList* ksList* pionList.plus();
315 }
316 else if(channel=="DstoKKPiPi0") {
318 numchan.push_back(1);
319 numchan.push_back(1);
320 numchan.push_back(2);
321 numchan.push_back(3);
322 decaylist=kaonList.minus()* kaonList.plus()* pionList.plus()* pi0List;
323 }
324 else if(channel=="DstoKsKplusPiPi") {
326 numchan.push_back(5);
327 numchan.push_back(1);
328 numchan.push_back(2);
329 numchan.push_back(2);
330 decaylist=ksList* kaonList.plus()* pionList.plus()* pionList.minus();
331 }
332 else if(channel=="DstoKsKminusPiPi") {
334 numchan.push_back(5);
335 numchan.push_back(1);
336 numchan.push_back(2);
337 numchan.push_back(2);
338 decaylist=ksList* kaonList.minus()* pionList.plus()* pionList.plus();
339 }
340 else if(channel=="DstoKKPiPiPi") {
342 numchan.push_back(1);
343 numchan.push_back(1);
344 numchan.push_back(2);
345 numchan.push_back(2);
346 numchan.push_back(2);
347 decaylist=kaonList.minus()* kaonList.plus()* pionList.plus()* pionList.plus()* pionList.minus();
348 }
349 else if(channel=="DstoPiPi0") {
351 numchan.push_back(2);
352 numchan.push_back(3);
353 decaylist=pionList.plus()* pi0List;
354 }
355 else if(channel=="DstoPiPiPi") {
357 numchan.push_back(2);
358 numchan.push_back(2);
359 numchan.push_back(2);
360 decaylist=pionList.plus()* pionList.plus()* pionList.minus();
361 }
362 else if(channel=="DstoPiPiPiPi0") {
364 numchan.push_back(2);
365 numchan.push_back(2);
366 numchan.push_back(2);
367 numchan.push_back(3);
368 decaylist=pionList.plus()* pionList.plus()* pionList.minus()* pi0List;
369 }
370 else if(channel=="DstoPiPiPiPiPi") {
372 numchan.push_back(2);
373 numchan.push_back(2);
374 numchan.push_back(2);
375 numchan.push_back(2);
376 numchan.push_back(2);
377 decaylist=pionList.plus()* pionList.plus()* pionList.plus()* pionList.minus()* pionList.minus();
378 }
379 else if(channel=="DstoPiPiPiPiPiPi0") {
381 numchan.push_back(2);
382 numchan.push_back(2);
383 numchan.push_back(2);
384 numchan.push_back(2);
385 numchan.push_back(2);
386 numchan.push_back(3);
387 decaylist=pionList.plus()* pionList.plus()* pionList.plus()* pionList.minus()* pionList.minus()* pi0List;
388 }
389 else if(channel=="DstoPiPiPiPi0Pi0") {
391 numchan.push_back(2);
392 numchan.push_back(2);
393 numchan.push_back(2);
394 numchan.push_back(3);
395 numchan.push_back(3);
396 decaylist=pionList.plus()* pionList.plus()* pionList.minus()* pi0List* pi0List;
397 }
398 else if(channel=="DstoPiEta") {
400 numchan.push_back(2);
401 numchan.push_back(4);
402 decaylist=pionList.plus()* etaList;
403 }
404 else if(channel=="DstoPiEtaPiPiPi0") {
406 numchan.push_back(2);
407 numchan.push_back(9);
409 EtaList=pionList.plus()* pionList.minus()* pi0List;
410 decaylist=pionList.plus()* EtaList;
411 }
412 else if(channel=="DstoPiPi0Eta") {
414 numchan.push_back(2);
415 numchan.push_back(3);
416 numchan.push_back(4);
417 decaylist=pionList.plus()* pi0List* etaList;
418 }
419 else if(channel=="DstoPiPi0EtaPiPiPi0") {
421 numchan.push_back(2);
422 numchan.push_back(3);
423 numchan.push_back(9);
425 EtaList=pionList.plus()* pionList.minus()* pi0List;
426 decaylist=pionList.plus()* pi0List* EtaList;
427 }
428 else if(channel=="DstoPiPiPiEta") {
430 numchan.push_back(2);
431 numchan.push_back(2);
432 numchan.push_back(2);
433 numchan.push_back(4);
434 decaylist=pionList.plus()* pionList.plus()* pionList.minus()* etaList;
435 }
436 else if(channel=="DstoPiPiPiEtaPiPiPi0") {
438 numchan.push_back(2);
439 numchan.push_back(2);
440 numchan.push_back(2);
441 numchan.push_back(9);
443 EtaList=pionList.plus()* pionList.minus()* pi0List;
444 decaylist=pionList.plus()* pionList.plus()* pionList.minus()* EtaList;
445 }
446 else if(channel=="DstoPiEPPiPiEta") {
448 numchan.push_back(2);
449 numchan.push_back(6);
451 epList=pionList.plus()* pionList.minus()* etaList;
452 decaylist=pionList.plus()* epList;
453 }
454 else if(channel=="DstoPiPi0EPPiPiEta") {
456 numchan.push_back(2);
457 numchan.push_back(3);
458 numchan.push_back(6);
460 epList=pionList.plus()* pionList.minus()* etaList;
461 decaylist=pionList.plus()* pi0List* epList;
462 }
463 else if(channel=="DstoPiEPPiPiEtaPiPiPi0") {
465 numchan.push_back(2);
466 numchan.push_back(8);
468 EtaList=pionList.plus()* pionList.minus()* pi0List;
470 EtapList=pionList.plus()* pionList.minus()* EtaList;
471 decaylist=pionList.plus()* EtapList;
472 }
473 else if(channel=="DstoPiPi0EPPiPiEtaPiPiPi0") {
475 numchan.push_back(2);
476 numchan.push_back(3);
477 numchan.push_back(8);
479 EtaList=pionList.plus()* pionList.minus()* pi0List;
481 EtapList=pionList.plus()* pionList.minus()* EtaList;
482 decaylist=pionList.plus()* pi0List* EtapList;
483 }
484
485 else if(channel=="DstoPiEPRhoGam") {
487 numchan.push_back(2);
488 numchan.push_back(7);
490 rhoList=pionList.plus()* pionList.minus();
492 epList=rhoList* photonList;
493 decaylist=pionList.plus()* epList;
494 }
495 else if(channel=="DstoPiPi0EPRhoGam") {
497 numchan.push_back(2);
498 numchan.push_back(3);
499 numchan.push_back(7);
501 rhoList=pionList.plus()* pionList.minus();
503 epList=rhoList* photonList;
504 decaylist=pionList.plus()* pi0List* epList;
505 }
506 else if(channel=="DstoKsPi") {
508 numchan.push_back(5);
509 numchan.push_back(2);
510 decaylist=ksList* pionList.plus();
511 }
512 else if(channel=="DstoKsPiPi0") {
514 numchan.push_back(5);
515 numchan.push_back(2);
516 numchan.push_back(3);
517 decaylist=ksList* pionList.plus()* pi0List;
518 }
519 else if(channel=="DstoKPiPi") {
521 numchan.push_back(1);
522 numchan.push_back(2);
523 numchan.push_back(2);
524 decaylist=kaonList.plus()* pionList.plus()* pionList.minus();
525 }
526 else if(channel=="DstoKPiPiPi0") {
528 numchan.push_back(1);
529 numchan.push_back(2);
530 numchan.push_back(2);
531 numchan.push_back(3);
532 decaylist=kaonList.plus()* pionList.plus()* pionList.minus()* pi0List;
533 }
534 else if(channel=="DstoKKK") {
536 numchan.push_back(1);
537 numchan.push_back(1);
538 numchan.push_back(1);
539 decaylist=kaonList.minus()* kaonList.plus()* kaonList.plus();
540 }
541
544
546
549
550 vector<int> trackid, showerid;
551 vector<int> kaonid, pionid;
552 int numofchildren=numchan.size()-1;
553
554 for(int i=0; i< numofchildren;i++){
555
556 const CDCandidate& daughter=(*it).particle().child(i);
557
558 if(numchan[i+1]==1){
560 trackid.push_back(track->
trackId());
561 kaonid.push_back(track->
trackId());
562 }
563 else if(numchan[i+1]==2){
565 trackid.push_back(track->
trackId());
566 pionid.push_back(track->
trackId());
567 }
568 else if ( numchan[i+1]==3){
571 showerid.push_back(hiEnGamma->
trackId());
572 showerid.push_back(loEnGamma->
trackId());
573 }
574 else if ( numchan[i+1]==4){
577 showerid.push_back(hiEnGamma->
trackId());
578 showerid.push_back(loEnGamma->
trackId());
579 }
580 else if ( numchan[i+1]==5){
582
583
584 recDTag->
addToFitInfo(aKsCand->
mass(),fitinfo[aKsCand][0],fitinfo[aKsCand][1],fitinfo[aKsCand][2]);
585
588 trackid.push_back(pion1Trk->
trackId());
589 trackid.push_back(pion2Trk->
trackId());
590 }
591 else if (numchan[i+1]==6){
599
600 trackid.push_back(apiontrk->
trackId());
601 trackid.push_back(spiontrk->
trackId());
602 showerid.push_back(hiEnGamma->
trackId());
603 showerid.push_back(loEnGamma->
trackId());
604
605 }
606 else if (numchan[i+1]==7){
611
615
616
617 trackid.push_back(apiontrk->
trackId());
618 trackid.push_back(spiontrk->
trackId());
619 showerid.push_back(gammatrk->
trackId());
620
621 }
622 else if (numchan[i+1]==8){
629
634
637
638 trackid.push_back(apiontrk->
trackId());
639 trackid.push_back(spiontrk->
trackId());
640 trackid.push_back(e0piontrk->
trackId());
641 trackid.push_back(e1piontrk->
trackId());
642 showerid.push_back(hiEnGamma->
trackId());
643 showerid.push_back(loEnGamma->
trackId());
644
645 }
646 else if (numchan[i+1]==9){
654
655 trackid.push_back(apiontrk->
trackId());
656 trackid.push_back(spiontrk->
trackId());
657 showerid.push_back(hiEnGamma->
trackId());
658 showerid.push_back(loEnGamma->
trackId());
659
660 }
661
662
663 }
664
665
667 savetrack(trackid,showerid,charged_begin,charged_end,neutral_begin,neutral_end,recDTag);
668 pidtag(kaonid,pionid,kaonList_tight, pionList_tight,recDTag);
669
670
671 if(m_usevertexfit){
672 HepLorentzVector p4change_vfit=util.
vfit(channel, kaonid, pionid, xorigin, charged_begin);
673 recDTag->
setp4(recDTag->
p4()+p4change_vfit);
674 }
675
676
677 trackid.clear();
678 showerid.clear();
679 kaonid.clear();
680 pionid.clear();
681
682
683
684
685 recDTagCol->push_back(recDTag);
686
687 }
688
689 numchan.clear();
690
691 }
692
693
694
695 return StatusCode::SUCCESS;
696}
void dc_fill(DCFillableChargedList< Charged > &aFillableList, WitnessIterator first, WitnessIterator last)
EvtRecTrackCol::iterator EvtRecTrackIterator
LocalEptoPiPiEta3PiSelector eptoPiPiEta3PiSelector
LocalEptoPiPiEtaSelector eptoPiPiEtaSelector
LocalEptoRhoGamSelector eptoRhoGamSelector
LocalEtatoGGSelector etatoGGSelector
LocalEtatoPiPiPi0Selector etatoPiPiPi0Selector
LocalKaonSelector kaonSelector
LocalKsSelector ksSelector
LocalPhotonSelector photonSelector
LocalPi0Selector pi0Selector
LocalPionSelector pionSelector
LocalRhotoPiPiSelector rhotoPiPiSelector
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 savetrack(vector< int >, vector< int >, EvtRecTrackIterator, EvtRecTrackIterator, EvtRecTrackIterator, EvtRecTrackIterator, EvtRecDTag *)
void pidtag(vector< int >, vector< int >, CDChargedKaonList &, CDChargedPionList &, EvtRecDTag *)
void saveDsInfo(CDDecayList::iterator, double, int, EvtRecDTag *)
void setbeta(Hep3Vector beta)
void setebeam(double ebeam)
@ kDstoPiPi0EPPiPiEtaPiPiPi0
@ kDstoPiEPPiPiEtaPiPiPi0
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)
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