104 {
105 MsgStream log(
msgSvc(), name());
106 log << MSG::INFO << "in execute()" << endreq;
107
108 StatusCode sc;
109
110
111
112
113 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
114 int event= eventHeader->eventNumber();
115
116
117
120 log << MSG::DEBUG << "run and event = " << eventHeader->runNumber()
121 << " " << eventHeader->eventNumber() << endreq;
122 log << MSG::DEBUG <<"ncharg, nneu, tottks = "
123 << recEvent->totalCharged() << " , "
124 << recEvent->totalNeutral() << " , "
125 << recEvent->totalTracks() <<endreq;
126
129
132
133
134 SmartDataPtr<EvtRecPi0Col> recPi0Col(eventSvc(), "/Event/EvtRec/EvtRecPi0Col");
135 if ( ! recPi0Col ) {
136 log << MSG::FATAL << "Could not find EvtRecPi0Col" << endreq;
137 return StatusCode::FAILURE;
138 }
139
140 SmartDataPtr<EvtRecEtaToGGCol> recEtaToGGCol(eventSvc(), "/Event/EvtRec/EvtRecEtaToGGCol");
141 if ( ! recEtaToGGCol ) {
142 log << MSG::FATAL << "Could not find EvtRecEtaToGGCol" << endreq;
143 return StatusCode::FAILURE;
144 }
145
146
147 SmartDataPtr<EvtRecVeeVertexCol> recVeeVertexCol(eventSvc(), "/Event/EvtRec/EvtRecVeeVertexCol");
148 if ( ! recVeeVertexCol ) {
149 log << MSG::FATAL << "Could not find EvtRecVeeVertexCol" << endreq;
150 return StatusCode::FAILURE;
151 }
152
153
155 if (!recDTagCol) {
156 log << MSG::FATAL << "EvtRecDTagCol is not registered yet" << endreq;
157 return StatusCode::FAILURE;
158 }
159
160
161
162 Hep3Vector xorigin(0,0,0);
164 Gaudi::svcLocator()->service("VertexDbSvc", vtxsvc);
166
167
169 xorigin.setX(vertex[0]);
170 xorigin.setY(vertex[1]);
171 xorigin.setZ(vertex[2]);
172 }
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
197
199 dc_fill(ksList, recVeeVertexCol->begin(), recVeeVertexCol->end());
200
201
202
203 map<EvtRecVeeVertex*, vector< double > > fitinfo;
204 for(
CDKsList::iterator ksit = ksList.particle_begin(); ksit != ksList.particle_end(); ++ksit ){
206
207 if(m_useVFrefine){
209 }else{
211 }
212
213 }
214
216 dc_fill(pi0List, recPi0Col->begin(), recPi0Col->end());
217
219 dc_fill(etaList, recEtaToGGCol->begin(), recEtaToGGCol->end());
220
221
226
227
228 int run = eventHeader->runNumber();
229 m_ievt = eventHeader->eventNumber();
230 m_nChrg = recEvent->totalCharged();
231 m_nNeu = recEvent->totalNeutral();
232 m_nPion = pionList.size();
233 m_nKaon = kaonList.size();
234 m_nPi0 = pi0List.size();
235 m_nKs = ksList.size();
236
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 double ebeam=m_beamE;
252
253
254
255
256
257
258 for(int list=0;list<chanlist.size();list++){
259
260 string channel=chanlist[list];
261 vector<int> numchan;
265
266
267
268
269
270
271
272
273
274
275 if(channel=="DstoKsK") {
277 numchan.push_back(5);
278 numchan.push_back(1);
279 decaylist=ksList* kaonList.plus();
280 }
281 else if(channel=="DstoKKPi") {
283 numchan.push_back(1);
284 numchan.push_back(1);
285 numchan.push_back(2);
286 decaylist=kaonList.minus()* kaonList.plus()* pionList.plus();
287 }
288 else if(channel=="DstoKsKPi0") {
290 numchan.push_back(5);
291 numchan.push_back(1);
292 numchan.push_back(3);
293 decaylist=ksList* kaonList.plus()* pi0List;
294 }
295 else if(channel=="DstoKsKsPi") {
297 numchan.push_back(5);
298 numchan.push_back(5);
299 numchan.push_back(2);
300 decaylist=ksList* ksList* pionList.plus();
301 }
302 else if(channel=="DstoKKPiPi0") {
304 numchan.push_back(1);
305 numchan.push_back(1);
306 numchan.push_back(2);
307 numchan.push_back(3);
308 decaylist=kaonList.minus()* kaonList.plus()* pionList.plus()* pi0List;
309 }
310 else if(channel=="DstoKsKplusPiPi") {
312 numchan.push_back(5);
313 numchan.push_back(1);
314 numchan.push_back(2);
315 numchan.push_back(2);
316 decaylist=ksList* kaonList.plus()* pionList.plus()* pionList.minus();
317 }
318 else if(channel=="DstoKsKminusPiPi") {
320 numchan.push_back(5);
321 numchan.push_back(1);
322 numchan.push_back(2);
323 numchan.push_back(2);
324 decaylist=ksList* kaonList.minus()* pionList.plus()* pionList.plus();
325 }
326 else if(channel=="DstoKKPiPiPi") {
328 numchan.push_back(1);
329 numchan.push_back(1);
330 numchan.push_back(2);
331 numchan.push_back(2);
332 numchan.push_back(2);
333 decaylist=kaonList.minus()* kaonList.plus()* pionList.plus()* pionList.plus()* pionList.minus();
334 }
335 else if(channel=="DstoPiPi0") {
337 numchan.push_back(2);
338 numchan.push_back(3);
339 decaylist=pionList.plus()* pi0List;
340 }
341 else if(channel=="DstoPiPiPi") {
343 numchan.push_back(2);
344 numchan.push_back(2);
345 numchan.push_back(2);
346 decaylist=pionList.plus()* pionList.plus()* pionList.minus();
347 }
348 else if(channel=="DstoPiPiPiPi0") {
350 numchan.push_back(2);
351 numchan.push_back(2);
352 numchan.push_back(2);
353 numchan.push_back(3);
354 decaylist=pionList.plus()* pionList.plus()* pionList.minus()* pi0List;
355 }
356 else if(channel=="DstoPiPiPiPiPi") {
358 numchan.push_back(2);
359 numchan.push_back(2);
360 numchan.push_back(2);
361 numchan.push_back(2);
362 numchan.push_back(2);
363 decaylist=pionList.plus()* pionList.plus()* pionList.plus()* pionList.minus()* pionList.minus();
364 }
365 else if(channel=="DstoPiPiPiPiPiPi0") {
367 numchan.push_back(2);
368 numchan.push_back(2);
369 numchan.push_back(2);
370 numchan.push_back(2);
371 numchan.push_back(2);
372 numchan.push_back(3);
373 decaylist=pionList.plus()* pionList.plus()* pionList.plus()* pionList.minus()* pionList.minus()* pi0List;
374 }
375 else if(channel=="DstoPiPiPiPi0Pi0") {
377 numchan.push_back(2);
378 numchan.push_back(2);
379 numchan.push_back(2);
380 numchan.push_back(3);
381 numchan.push_back(3);
382 decaylist=pionList.plus()* pionList.plus()* pionList.minus()* pi0List* pi0List;
383 }
384 else if(channel=="DstoPiEta") {
386 numchan.push_back(2);
387 numchan.push_back(4);
388 decaylist=pionList.plus()* etaList;
389 }
390 else if(channel=="DstoPiEtaPiPiPi0") {
392 numchan.push_back(2);
393 numchan.push_back(9);
395 EtaList=pionList.plus()* pionList.minus()* pi0List;
396 decaylist=pionList.plus()* EtaList;
397 }
398 else if(channel=="DstoPiPi0Eta") {
400 numchan.push_back(2);
401 numchan.push_back(3);
402 numchan.push_back(4);
403 decaylist=pionList.plus()* pi0List* etaList;
404 }
405 else if(channel=="DstoPiPi0EtaPiPiPi0") {
407 numchan.push_back(2);
408 numchan.push_back(3);
409 numchan.push_back(9);
411 EtaList=pionList.plus()* pionList.minus()* pi0List;
412 decaylist=pionList.plus()* pi0List* EtaList;
413 }
414 else if(channel=="DstoPiPiPiEta") {
416 numchan.push_back(2);
417 numchan.push_back(2);
418 numchan.push_back(2);
419 numchan.push_back(4);
420 decaylist=pionList.plus()* pionList.plus()* pionList.minus()* etaList;
421 }
422 else if(channel=="DstoPiPiPiEtaPiPiPi0") {
424 numchan.push_back(2);
425 numchan.push_back(2);
426 numchan.push_back(2);
427 numchan.push_back(9);
429 EtaList=pionList.plus()* pionList.minus()* pi0List;
430 decaylist=pionList.plus()* pionList.plus()* pionList.minus()* EtaList;
431 }
432 else if(channel=="DstoPiEPPiPiEta") {
434 numchan.push_back(2);
435 numchan.push_back(6);
437 epList=pionList.plus()* pionList.minus()* etaList;
438 decaylist=pionList.plus()* epList;
439 }
440 else if(channel=="DstoPiPi0EPPiPiEta") {
442 numchan.push_back(2);
443 numchan.push_back(3);
444 numchan.push_back(6);
446 epList=pionList.plus()* pionList.minus()* etaList;
447 decaylist=pionList.plus()* pi0List* epList;
448 }
449 else if(channel=="DstoPiEPPiPiEtaPiPiPi0") {
451 numchan.push_back(2);
452 numchan.push_back(8);
454 EtaList=pionList.plus()* pionList.minus()* pi0List;
456 EtapList=pionList.plus()* pionList.minus()* EtaList;
457 decaylist=pionList.plus()* EtapList;
458 }
459 else if(channel=="DstoPiPi0EPPiPiEtaPiPiPi0") {
461 numchan.push_back(2);
462 numchan.push_back(3);
463 numchan.push_back(8);
465 EtaList=pionList.plus()* pionList.minus()* pi0List;
467 EtapList=pionList.plus()* pionList.minus()* EtaList;
468 decaylist=pionList.plus()* pi0List* EtapList;
469 }
470
471 else if(channel=="DstoPiEPRhoGam") {
473 numchan.push_back(2);
474 numchan.push_back(7);
476 rhoList=pionList.plus()* pionList.minus();
478 epList=rhoList* photonList;
479 decaylist=pionList.plus()* epList;
480 }
481 else if(channel=="DstoPiPi0EPRhoGam") {
483 numchan.push_back(2);
484 numchan.push_back(3);
485 numchan.push_back(7);
487 rhoList=pionList.plus()* pionList.minus();
489 epList=rhoList* photonList;
490 decaylist=pionList.plus()* pi0List* epList;
491 }
492 else if(channel=="DstoKsPi") {
494 numchan.push_back(5);
495 numchan.push_back(2);
496 decaylist=ksList* pionList.plus();
497 }
498 else if(channel=="DstoKsPiPi0") {
500 numchan.push_back(5);
501 numchan.push_back(2);
502 numchan.push_back(3);
503 decaylist=ksList* pionList.plus()* pi0List;
504 }
505 else if(channel=="DstoKPiPi") {
507 numchan.push_back(1);
508 numchan.push_back(2);
509 numchan.push_back(2);
510 decaylist=kaonList.plus()* pionList.plus()* pionList.minus();
511 }
512 else if(channel=="DstoKPiPiPi0") {
514 numchan.push_back(1);
515 numchan.push_back(2);
516 numchan.push_back(2);
517 numchan.push_back(3);
518 decaylist=kaonList.plus()* pionList.plus()* pionList.minus()* pi0List;
519 }
520 else if(channel=="DstoKKK") {
522 numchan.push_back(1);
523 numchan.push_back(1);
524 numchan.push_back(1);
525 decaylist=kaonList.minus()* kaonList.plus()* kaonList.plus();
526 }
527
530
532
535
536 vector<int> trackid, showerid;
537 vector<int> kaonid, pionid;
538 int numofchildren=numchan.size()-1;
539
540 for(int i=0; i< numofchildren;i++){
541
542 const CDCandidate& daughter=(*it).particle().child(i);
543
544 if(numchan[i+1]==1){
546 trackid.push_back(track->
trackId());
547 kaonid.push_back(track->
trackId());
548 }
549 else if(numchan[i+1]==2){
551 trackid.push_back(track->
trackId());
552 pionid.push_back(track->
trackId());
553 }
554 else if ( numchan[i+1]==3){
557 showerid.push_back(hiEnGamma->
trackId());
558 showerid.push_back(loEnGamma->
trackId());
559 }
560 else if ( numchan[i+1]==4){
563 showerid.push_back(hiEnGamma->
trackId());
564 showerid.push_back(loEnGamma->
trackId());
565 }
566 else if ( numchan[i+1]==5){
568
569
570 recDTag->
addToFitInfo(aKsCand->
mass(),fitinfo[aKsCand][0],fitinfo[aKsCand][1],fitinfo[aKsCand][2]);
571
574 trackid.push_back(pion1Trk->
trackId());
575 trackid.push_back(pion2Trk->
trackId());
576 }
577 else if (numchan[i+1]==6){
585
586 trackid.push_back(apiontrk->
trackId());
587 trackid.push_back(spiontrk->
trackId());
588 showerid.push_back(hiEnGamma->
trackId());
589 showerid.push_back(loEnGamma->
trackId());
590
591 }
592 else if (numchan[i+1]==7){
597
601
602
603 trackid.push_back(apiontrk->
trackId());
604 trackid.push_back(spiontrk->
trackId());
605 showerid.push_back(gammatrk->
trackId());
606
607 }
608 else if (numchan[i+1]==8){
615
620
623
624 trackid.push_back(apiontrk->
trackId());
625 trackid.push_back(spiontrk->
trackId());
626 trackid.push_back(e0piontrk->
trackId());
627 trackid.push_back(e1piontrk->
trackId());
628 showerid.push_back(hiEnGamma->
trackId());
629 showerid.push_back(loEnGamma->
trackId());
630
631 }
632 else if (numchan[i+1]==9){
640
641 trackid.push_back(apiontrk->
trackId());
642 trackid.push_back(spiontrk->
trackId());
643 showerid.push_back(hiEnGamma->
trackId());
644 showerid.push_back(loEnGamma->
trackId());
645
646 }
647
648
649 }
650
651
653 if(m_useBFC){
654
656 }
657 savetrack(trackid,showerid,charged_begin,charged_end,neutral_begin,neutral_end,recDTag);
658 pidtag(kaonid,pionid,kaonList_tight, pionList_tight,recDTag);
659
660
661 if(m_usevertexfit){
662 if(m_debug) cout<<"beforevfit:"<<endl;
663
664 HepLorentzVector p4change_vfit;
665
666 if(m_useVFrefine){
667 p4change_vfit=util.
vfitref(channel, kaonid, pionid, xorigin, charged_begin);
668 }else{
669 p4change_vfit=util.
vfit(channel, kaonid, pionid, xorigin, charged_begin);
670 }
671
672 recDTag->
setp4(recDTag->
p4()+p4change_vfit);
673 }
674
675
676 trackid.clear();
677 showerid.clear();
678 kaonid.clear();
679 pionid.clear();
680
681
682
683
684 recDTagCol->push_back(recDTag);
685
686 }
687
688 numchan.clear();
689
690 }
691
692
693
694 return StatusCode::SUCCESS;
695}
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 updateKsInfo(CDDecayList::iterator, double, int, EvtRecDTag *, vector< int >, IVertexDbSvc *, bool)
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)
@ kDstoPiEPPiPiEtaPiPiPi0
@ kDstoPiPi0EPPiPiEtaPiPiPi0
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)
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