103 {
104 MsgStream log(
msgSvc(), name());
105 log << MSG::INFO << "in execute()" << endreq;
106
107 StatusCode sc;
108
109
110
111
112 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
113 int event= eventHeader->eventNumber();
114
115
116
119 log << MSG::DEBUG << "run and event = " << eventHeader->runNumber()
120 << " " << eventHeader->eventNumber() << endreq;
121 log << MSG::DEBUG <<"ncharg, nneu, tottks = "
122 << recEvent->totalCharged() << " , "
123 << recEvent->totalNeutral() << " , "
124 << recEvent->totalTracks() <<endreq;
125
128
131
132
133 SmartDataPtr<EvtRecPi0Col> recPi0Col(eventSvc(), "/Event/EvtRec/EvtRecPi0Col");
134 if ( ! recPi0Col ) {
135 log << MSG::FATAL << "Could not find EvtRecPi0Col" << endreq;
136 return StatusCode::FAILURE;
137 }
138
139 SmartDataPtr<EvtRecEtaToGGCol> recEtaToGGCol(eventSvc(), "/Event/EvtRec/EvtRecEtaToGGCol");
140 if ( ! recEtaToGGCol ) {
141 log << MSG::FATAL << "Could not find EvtRecEtaToGGCol" << endreq;
142 return StatusCode::FAILURE;
143 }
144
145
146 SmartDataPtr<EvtRecVeeVertexCol> recVeeVertexCol(eventSvc(), "/Event/EvtRec/EvtRecVeeVertexCol");
147 if ( ! recVeeVertexCol ) {
148 log << MSG::FATAL << "Could not find EvtRecVeeVertexCol" << endreq;
149 return StatusCode::FAILURE;
150 }
151
152
154 if (!recDTagCol) {
155 log << MSG::FATAL << "EvtRecDTagCol is not registered yet" << endreq;
156 return StatusCode::FAILURE;
157 }
158
159
160
161 Hep3Vector xorigin(0,0,0);
163 Gaudi::svcLocator()->service("VertexDbSvc", vtxsvc);
165
166
168 xorigin.setX(vertex[0]);
169 xorigin.setY(vertex[1]);
170 xorigin.setZ(vertex[2]);
171 }
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
196
198 dc_fill(ksList, recVeeVertexCol->begin(), recVeeVertexCol->end());
199
200
201
202 map<EvtRecVeeVertex*, vector< double > > fitinfo;
203 for(
CDKsList::iterator ksit = ksList.particle_begin(); ksit != ksList.particle_end(); ++ksit ){
205
206 if(m_useVFrefine){
208 }else{
210 }
211
212 }
213
215 dc_fill(pi0List, recPi0Col->begin(), recPi0Col->end());
216
218 dc_fill(etaList, recEtaToGGCol->begin(), recEtaToGGCol->end());
219
220
225
226
227 int run = eventHeader->runNumber();
228 m_ievt = eventHeader->eventNumber();
229 m_nChrg = recEvent->totalCharged();
230 m_nNeu = recEvent->totalNeutral();
231 m_nPion = pionList.size();
232 m_nKaon = kaonList.size();
233 m_nPi0 = pi0List.size();
234 m_nKs = ksList.size();
235
236
237
238
239
240
241 if(m_ReadBeamEFromDB && m_irun!=run){
242 m_irun=run;
243 if(m_usecalibBeamE)
245 m_beamE=m_readDb.
getbeamE(m_irun,m_beamE);
246 if(run>0)
248
249 }
250 double ebeam=m_beamE;
251
252
253
254
255
256
257 for(int list=0;list<chanlist.size();list++){
258
259 string channel=chanlist[list];
260 vector<int> numchan;
264
265
266
267
268
269
270
271
272
273
274 if(channel=="DstoKsK") {
276 numchan.push_back(5);
277 numchan.push_back(1);
278 decaylist=ksList* kaonList.plus();
279 }
280 else if(channel=="DstoKKPi") {
282 numchan.push_back(1);
283 numchan.push_back(1);
284 numchan.push_back(2);
285 decaylist=kaonList.minus()* kaonList.plus()* pionList.plus();
286 }
287 else if(channel=="DstoKsKPi0") {
289 numchan.push_back(5);
290 numchan.push_back(1);
291 numchan.push_back(3);
292 decaylist=ksList* kaonList.plus()* pi0List;
293 }
294 else if(channel=="DstoKsKsPi") {
296 numchan.push_back(5);
297 numchan.push_back(5);
298 numchan.push_back(2);
299 decaylist=ksList* ksList* pionList.plus();
300 }
301 else if(channel=="DstoKKPiPi0") {
303 numchan.push_back(1);
304 numchan.push_back(1);
305 numchan.push_back(2);
306 numchan.push_back(3);
307 decaylist=kaonList.minus()* kaonList.plus()* pionList.plus()* pi0List;
308 }
309 else if(channel=="DstoKsKplusPiPi") {
311 numchan.push_back(5);
312 numchan.push_back(1);
313 numchan.push_back(2);
314 numchan.push_back(2);
315 decaylist=ksList* kaonList.plus()* pionList.plus()* pionList.minus();
316 }
317 else if(channel=="DstoKsKminusPiPi") {
319 numchan.push_back(5);
320 numchan.push_back(1);
321 numchan.push_back(2);
322 numchan.push_back(2);
323 decaylist=ksList* kaonList.minus()* pionList.plus()* pionList.plus();
324 }
325 else if(channel=="DstoKKPiPiPi") {
327 numchan.push_back(1);
328 numchan.push_back(1);
329 numchan.push_back(2);
330 numchan.push_back(2);
331 numchan.push_back(2);
332 decaylist=kaonList.minus()* kaonList.plus()* pionList.plus()* pionList.plus()* pionList.minus();
333 }
334 else if(channel=="DstoPiPi0") {
336 numchan.push_back(2);
337 numchan.push_back(3);
338 decaylist=pionList.plus()* pi0List;
339 }
340 else if(channel=="DstoPiPiPi") {
342 numchan.push_back(2);
343 numchan.push_back(2);
344 numchan.push_back(2);
345 decaylist=pionList.plus()* pionList.plus()* pionList.minus();
346 }
347 else if(channel=="DstoPiPiPiPi0") {
349 numchan.push_back(2);
350 numchan.push_back(2);
351 numchan.push_back(2);
352 numchan.push_back(3);
353 decaylist=pionList.plus()* pionList.plus()* pionList.minus()* pi0List;
354 }
355 else if(channel=="DstoPiPiPiPiPi") {
357 numchan.push_back(2);
358 numchan.push_back(2);
359 numchan.push_back(2);
360 numchan.push_back(2);
361 numchan.push_back(2);
362 decaylist=pionList.plus()* pionList.plus()* pionList.plus()* pionList.minus()* pionList.minus();
363 }
364 else if(channel=="DstoPiPiPiPiPiPi0") {
366 numchan.push_back(2);
367 numchan.push_back(2);
368 numchan.push_back(2);
369 numchan.push_back(2);
370 numchan.push_back(2);
371 numchan.push_back(3);
372 decaylist=pionList.plus()* pionList.plus()* pionList.plus()* pionList.minus()* pionList.minus()* pi0List;
373 }
374 else if(channel=="DstoPiPiPiPi0Pi0") {
376 numchan.push_back(2);
377 numchan.push_back(2);
378 numchan.push_back(2);
379 numchan.push_back(3);
380 numchan.push_back(3);
381 decaylist=pionList.plus()* pionList.plus()* pionList.minus()* pi0List* pi0List;
382 }
383 else if(channel=="DstoPiEta") {
385 numchan.push_back(2);
386 numchan.push_back(4);
387 decaylist=pionList.plus()* etaList;
388 }
389 else if(channel=="DstoPiEtaPiPiPi0") {
391 numchan.push_back(2);
392 numchan.push_back(9);
394 EtaList=pionList.plus()* pionList.minus()* pi0List;
395 decaylist=pionList.plus()* EtaList;
396 }
397 else if(channel=="DstoPiPi0Eta") {
399 numchan.push_back(2);
400 numchan.push_back(3);
401 numchan.push_back(4);
402 decaylist=pionList.plus()* pi0List* etaList;
403 }
404 else if(channel=="DstoPiPi0EtaPiPiPi0") {
406 numchan.push_back(2);
407 numchan.push_back(3);
408 numchan.push_back(9);
410 EtaList=pionList.plus()* pionList.minus()* pi0List;
411 decaylist=pionList.plus()* pi0List* EtaList;
412 }
413 else if(channel=="DstoPiPiPiEta") {
415 numchan.push_back(2);
416 numchan.push_back(2);
417 numchan.push_back(2);
418 numchan.push_back(4);
419 decaylist=pionList.plus()* pionList.plus()* pionList.minus()* etaList;
420 }
421 else if(channel=="DstoPiPiPiEtaPiPiPi0") {
423 numchan.push_back(2);
424 numchan.push_back(2);
425 numchan.push_back(2);
426 numchan.push_back(9);
428 EtaList=pionList.plus()* pionList.minus()* pi0List;
429 decaylist=pionList.plus()* pionList.plus()* pionList.minus()* EtaList;
430 }
431 else if(channel=="DstoPiEPPiPiEta") {
433 numchan.push_back(2);
434 numchan.push_back(6);
436 epList=pionList.plus()* pionList.minus()* etaList;
437 decaylist=pionList.plus()* epList;
438 }
439 else if(channel=="DstoPiPi0EPPiPiEta") {
441 numchan.push_back(2);
442 numchan.push_back(3);
443 numchan.push_back(6);
445 epList=pionList.plus()* pionList.minus()* etaList;
446 decaylist=pionList.plus()* pi0List* epList;
447 }
448 else if(channel=="DstoPiEPPiPiEtaPiPiPi0") {
450 numchan.push_back(2);
451 numchan.push_back(8);
453 EtaList=pionList.plus()* pionList.minus()* pi0List;
455 EtapList=pionList.plus()* pionList.minus()* EtaList;
456 decaylist=pionList.plus()* EtapList;
457 }
458 else if(channel=="DstoPiPi0EPPiPiEtaPiPiPi0") {
460 numchan.push_back(2);
461 numchan.push_back(3);
462 numchan.push_back(8);
464 EtaList=pionList.plus()* pionList.minus()* pi0List;
466 EtapList=pionList.plus()* pionList.minus()* EtaList;
467 decaylist=pionList.plus()* pi0List* EtapList;
468 }
469
470 else if(channel=="DstoPiEPRhoGam") {
472 numchan.push_back(2);
473 numchan.push_back(7);
475 rhoList=pionList.plus()* pionList.minus();
477 epList=rhoList* photonList;
478 decaylist=pionList.plus()* epList;
479 }
480 else if(channel=="DstoPiPi0EPRhoGam") {
482 numchan.push_back(2);
483 numchan.push_back(3);
484 numchan.push_back(7);
486 rhoList=pionList.plus()* pionList.minus();
488 epList=rhoList* photonList;
489 decaylist=pionList.plus()* pi0List* epList;
490 }
491 else if(channel=="DstoKsPi") {
493 numchan.push_back(5);
494 numchan.push_back(2);
495 decaylist=ksList* pionList.plus();
496 }
497 else if(channel=="DstoKsPiPi0") {
499 numchan.push_back(5);
500 numchan.push_back(2);
501 numchan.push_back(3);
502 decaylist=ksList* pionList.plus()* pi0List;
503 }
504 else if(channel=="DstoKPiPi") {
506 numchan.push_back(1);
507 numchan.push_back(2);
508 numchan.push_back(2);
509 decaylist=kaonList.plus()* pionList.plus()* pionList.minus();
510 }
511 else if(channel=="DstoKPiPiPi0") {
513 numchan.push_back(1);
514 numchan.push_back(2);
515 numchan.push_back(2);
516 numchan.push_back(3);
517 decaylist=kaonList.plus()* pionList.plus()* pionList.minus()* pi0List;
518 }
519 else if(channel=="DstoKKK") {
521 numchan.push_back(1);
522 numchan.push_back(1);
523 numchan.push_back(1);
524 decaylist=kaonList.minus()* kaonList.plus()* kaonList.plus();
525 }
526
529
531
534
535 vector<int> trackid, showerid;
536 vector<int> kaonid, pionid;
537 int numofchildren=numchan.size()-1;
538
539 for(int i=0; i< numofchildren;i++){
540
541 const CDCandidate& daughter=(*it).particle().child(i);
542
543 if(numchan[i+1]==1){
545 trackid.push_back(track->
trackId());
546 kaonid.push_back(track->
trackId());
547 }
548 else if(numchan[i+1]==2){
550 trackid.push_back(track->
trackId());
551 pionid.push_back(track->
trackId());
552 }
553 else if ( numchan[i+1]==3){
556 showerid.push_back(hiEnGamma->
trackId());
557 showerid.push_back(loEnGamma->
trackId());
558 }
559 else if ( numchan[i+1]==4){
562 showerid.push_back(hiEnGamma->
trackId());
563 showerid.push_back(loEnGamma->
trackId());
564 }
565 else if ( numchan[i+1]==5){
567
568
569 recDTag->
addToFitInfo(aKsCand->
mass(),fitinfo[aKsCand][0],fitinfo[aKsCand][1],fitinfo[aKsCand][2]);
570
573 trackid.push_back(pion1Trk->
trackId());
574 trackid.push_back(pion2Trk->
trackId());
575 }
576 else if (numchan[i+1]==6){
584
585 trackid.push_back(apiontrk->
trackId());
586 trackid.push_back(spiontrk->
trackId());
587 showerid.push_back(hiEnGamma->
trackId());
588 showerid.push_back(loEnGamma->
trackId());
589
590 }
591 else if (numchan[i+1]==7){
596
600
601
602 trackid.push_back(apiontrk->
trackId());
603 trackid.push_back(spiontrk->
trackId());
604 showerid.push_back(gammatrk->
trackId());
605
606 }
607 else if (numchan[i+1]==8){
614
619
622
623 trackid.push_back(apiontrk->
trackId());
624 trackid.push_back(spiontrk->
trackId());
625 trackid.push_back(e0piontrk->
trackId());
626 trackid.push_back(e1piontrk->
trackId());
627 showerid.push_back(hiEnGamma->
trackId());
628 showerid.push_back(loEnGamma->
trackId());
629
630 }
631 else if (numchan[i+1]==9){
639
640 trackid.push_back(apiontrk->
trackId());
641 trackid.push_back(spiontrk->
trackId());
642 showerid.push_back(hiEnGamma->
trackId());
643 showerid.push_back(loEnGamma->
trackId());
644
645 }
646
647
648 }
649
650
652 savetrack(trackid,showerid,charged_begin,charged_end,neutral_begin,neutral_end,recDTag);
653 pidtag(kaonid,pionid,kaonList_tight, pionList_tight,recDTag);
654
655
656 if(m_usevertexfit){
657 if(m_debug) cout<<"beforevfit:"<<endl;
658
659 HepLorentzVector p4change_vfit;
660
661 if(m_useVFrefine){
662 p4change_vfit=util.
vfitref(channel, kaonid, pionid, xorigin, charged_begin);
663 }else{
664 p4change_vfit=util.
vfit(channel, kaonid, pionid, xorigin, charged_begin);
665 }
666
667 recDTag->
setp4(recDTag->
p4()+p4change_vfit);
668 }
669
670
671 trackid.clear();
672 showerid.clear();
673 kaonid.clear();
674 pionid.clear();
675
676
677
678
679 recDTagCol->push_back(recDTag);
680
681 }
682
683 numchan.clear();
684
685 }
686
687
688
689 return StatusCode::SUCCESS;
690}
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)
@ 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