100 {
101 MsgStream log(
msgSvc(), name());
102 log << MSG::INFO << "in execute()" << endreq;
103
104 StatusCode sc;
105
106
107
108
109 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
110 int event= eventHeader->eventNumber();
111
112
113
116 log << MSG::DEBUG << "run and event = " << eventHeader->runNumber()
117 << " " << eventHeader->eventNumber() << endreq;
118 log << MSG::DEBUG <<"ncharg, nneu, tottks = "
119 << recEvent->totalCharged() << " , "
120 << recEvent->totalNeutral() << " , "
121 << recEvent->totalTracks() <<endreq;
122
125
128
129
130 SmartDataPtr<EvtRecPi0Col> recPi0Col(eventSvc(), "/Event/EvtRec/EvtRecPi0Col");
131 if ( ! recPi0Col ) {
132 log << MSG::FATAL << "Could not find EvtRecPi0Col" << endreq;
133 return StatusCode::FAILURE;
134 }
135
136 SmartDataPtr<EvtRecEtaToGGCol> recEtaToGGCol(eventSvc(), "/Event/EvtRec/EvtRecEtaToGGCol");
137 if ( ! recEtaToGGCol ) {
138 log << MSG::FATAL << "Could not find EvtRecEtaToGGCol" << endreq;
139 return StatusCode::FAILURE;
140 }
141
142
143 SmartDataPtr<EvtRecVeeVertexCol> recVeeVertexCol(eventSvc(), "/Event/EvtRec/EvtRecVeeVertexCol");
144 if ( ! recVeeVertexCol ) {
145 log << MSG::FATAL << "Could not find EvtRecVeeVertexCol" << endreq;
146 return StatusCode::FAILURE;
147 }
148
149
151 if (!recDTagCol) {
152 log << MSG::FATAL << "EvtRecDTagCol is not registered yet" << endreq;
153 return StatusCode::FAILURE;
154 }
155
156
157
158 Hep3Vector xorigin(0,0,0);
160 Gaudi::svcLocator()->service("VertexDbSvc", vtxsvc);
162
163
165 xorigin.setX(vertex[0]);
166 xorigin.setY(vertex[1]);
167 xorigin.setZ(vertex[2]);
168 }
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
194 dc_fill(ksList, recVeeVertexCol->begin(), recVeeVertexCol->end());
195
197 dc_fill(pi0List, recPi0Col->begin(), recPi0Col->end());
198
200 dc_fill(etaList, recEtaToGGCol->begin(), recEtaToGGCol->end());
201
202
207
208
209 int run = eventHeader->runNumber();
210 m_ievt = eventHeader->eventNumber();
211 m_nChrg = recEvent->totalCharged();
212 m_nNeu = recEvent->totalNeutral();
213 m_nPion = pionList.size();
214 m_nKaon = kaonList.size();
215 m_nPi0 = pi0List.size();
216 m_nKs = ksList.size();
217
218
219
220
221
222
223 if(m_ReadBeamEFromDB && m_irun!=run){
224 m_irun=run;
225 if(m_usecalibBeamE)
227 m_beamE=m_readDb.
getbeamE(m_irun,m_beamE);
228 if(run>0)
230
231 }
232 double ebeam=m_beamE;
233
234
235
236
237
238
239 for(int list=0;list<chanlist.size();list++){
240
241 string channel=chanlist[list];
242 vector<int> numchan;
246
247
248
249
250
251 if(channel=="DstoKsK") {
253 numchan.push_back(5);
254 numchan.push_back(1);
255 decaylist=ksList* kaonList.plus();
256 }
257 else if(channel=="DstoKKPi") {
259 numchan.push_back(1);
260 numchan.push_back(1);
261 numchan.push_back(2);
262 decaylist=kaonList.minus()* kaonList.plus()* pionList.plus();
263 }
264 else if(channel=="DstoKsKPi0") {
266 numchan.push_back(5);
267 numchan.push_back(1);
268 numchan.push_back(3);
269 decaylist=ksList* kaonList.plus()* pi0List;
270 }
271 else if(channel=="DstoKsKsPi") {
273 numchan.push_back(5);
274 numchan.push_back(5);
275 numchan.push_back(2);
276 decaylist=ksList* ksList* pionList.plus();
277 }
278 else if(channel=="DstoKKPiPi0") {
280 numchan.push_back(1);
281 numchan.push_back(1);
282 numchan.push_back(2);
283 numchan.push_back(3);
284 decaylist=kaonList.minus()* kaonList.plus()* pionList.plus()* pi0List;
285 }
286 else if(channel=="DstoKsKplusPiPi") {
288 numchan.push_back(5);
289 numchan.push_back(1);
290 numchan.push_back(2);
291 numchan.push_back(2);
292 decaylist=ksList* kaonList.plus()* pionList.plus()* pionList.minus();
293 }
294 else if(channel=="DstoKsKminusPiPi") {
296 numchan.push_back(5);
297 numchan.push_back(1);
298 numchan.push_back(2);
299 numchan.push_back(2);
300 decaylist=ksList* kaonList.minus()* pionList.plus()* pionList.plus();
301 }
302 else if(channel=="DstoKKPiPiPi") {
304 numchan.push_back(1);
305 numchan.push_back(1);
306 numchan.push_back(2);
307 numchan.push_back(2);
308 numchan.push_back(2);
309 decaylist=kaonList.minus()* kaonList.plus()* pionList.plus()* pionList.plus()* pionList.minus();
310 }
311 else if(channel=="DstoPiPi0") {
313 numchan.push_back(2);
314 numchan.push_back(3);
315 decaylist=pionList.plus()* pi0List;
316 }
317 else if(channel=="DstoPiPiPi") {
319 numchan.push_back(2);
320 numchan.push_back(2);
321 numchan.push_back(2);
322 decaylist=pionList.plus()* pionList.plus()* pionList.minus();
323 }
324 else if(channel=="DstoPiPiPiPi0") {
326 numchan.push_back(2);
327 numchan.push_back(2);
328 numchan.push_back(2);
329 numchan.push_back(3);
330 decaylist=pionList.plus()* pionList.plus()* pionList.minus()* pi0List;
331 }
332 else if(channel=="DstoPiPiPiPiPi") {
334 numchan.push_back(2);
335 numchan.push_back(2);
336 numchan.push_back(2);
337 numchan.push_back(2);
338 numchan.push_back(2);
339 decaylist=pionList.plus()* pionList.plus()* pionList.plus()* pionList.minus()* pionList.minus();
340 }
341 else if(channel=="DstoPiPiPiPiPiPi0") {
343 numchan.push_back(2);
344 numchan.push_back(2);
345 numchan.push_back(2);
346 numchan.push_back(2);
347 numchan.push_back(2);
348 numchan.push_back(3);
349 decaylist=pionList.plus()* pionList.plus()* pionList.plus()* pionList.minus()* pionList.minus()* pi0List;
350 }
351 else if(channel=="DstoPiEta") {
353 numchan.push_back(2);
354 numchan.push_back(4);
355 decaylist=pionList.plus()* etaList;
356 }
357 else if(channel=="DstoPiPi0Eta") {
359 numchan.push_back(2);
360 numchan.push_back(3);
361 numchan.push_back(4);
362 decaylist=pionList.plus()* pi0List* etaList;
363 }
364 else if(channel=="DstoPiPiPiEta") {
366 numchan.push_back(2);
367 numchan.push_back(2);
368 numchan.push_back(2);
369 numchan.push_back(4);
370 decaylist=pionList.plus()* pionList.plus()* pionList.minus()* etaList;
371 }
372 else if(channel=="DstoPiEPPiPiEta") {
374 numchan.push_back(2);
375 numchan.push_back(6);
377 epList=pionList.plus()* pionList.minus()* etaList;
378 decaylist=pionList.plus()* epList;
379 }
380 else if(channel=="DstoPiPi0EPPiPiEta") {
382 numchan.push_back(2);
383 numchan.push_back(3);
384 numchan.push_back(6);
386 epList=pionList.plus()* pionList.minus()* etaList;
387 decaylist=pionList.plus()* pi0List* epList;
388 }
389 else if(channel=="DstoPiEPRhoGam") {
391 numchan.push_back(2);
392 numchan.push_back(7);
394 rhoList=pionList.plus()* pionList.minus();
396 epList=rhoList* photonList;
397 decaylist=pionList.plus()* epList;
398 }
399 else if(channel=="DstoPiPi0EPRhoGam") {
401 numchan.push_back(2);
402 numchan.push_back(3);
403 numchan.push_back(7);
405 rhoList=pionList.plus()* pionList.minus();
407 epList=rhoList* photonList;
408 decaylist=pionList.plus()* pi0List* epList;
409 }
410 else if(channel=="DstoKsPi") {
412 numchan.push_back(5);
413 numchan.push_back(2);
414 decaylist=ksList* pionList.plus();
415 }
416 else if(channel=="DstoKsPiPi0") {
418 numchan.push_back(5);
419 numchan.push_back(2);
420 numchan.push_back(3);
421 decaylist=ksList* pionList.plus()* pi0List;
422 }
423 else if(channel=="DstoKPiPi") {
425 numchan.push_back(1);
426 numchan.push_back(2);
427 numchan.push_back(2);
428 decaylist=kaonList.plus()* pionList.plus()* pionList.minus();
429 }
430 else if(channel=="DstoKPiPiPi0") {
432 numchan.push_back(1);
433 numchan.push_back(2);
434 numchan.push_back(2);
435 numchan.push_back(3);
436 decaylist=kaonList.plus()* pionList.plus()* pionList.minus()* pi0List;
437 }
438 else if(channel=="DstoKKK") {
440 numchan.push_back(1);
441 numchan.push_back(1);
442 numchan.push_back(1);
443 decaylist=kaonList.minus()* kaonList.plus()* kaonList.plus();
444 }
445
448
450
453
454 vector<int> trackid, showerid;
455 vector<int> kaonid, pionid;
456 int numofchildren=numchan.size()-1;
457
458 for(int i=0; i< numofchildren;i++){
459
460 const CDCandidate& daughter=(*it).particle().child(i);
461
462 if(numchan[i+1]==1){
464 trackid.push_back(track->
trackId());
465 kaonid.push_back(track->
trackId());
466 }
467 else if(numchan[i+1]==2){
469 trackid.push_back(track->
trackId());
470 pionid.push_back(track->
trackId());
471 }
472 else if ( numchan[i+1]==3){
475 showerid.push_back(hiEnGamma->
trackId());
476 showerid.push_back(loEnGamma->
trackId());
477 }
478 else if ( numchan[i+1]==4){
481 showerid.push_back(hiEnGamma->
trackId());
482 showerid.push_back(loEnGamma->
trackId());
483 }
484 else if ( numchan[i+1]==5){
488 trackid.push_back(pion1Trk->
trackId());
489 trackid.push_back(pion2Trk->
trackId());
490 }
491 else if (numchan[i+1]==6){
499
500 trackid.push_back(apiontrk->
trackId());
501 trackid.push_back(spiontrk->
trackId());
502 showerid.push_back(hiEnGamma->
trackId());
503 showerid.push_back(loEnGamma->
trackId());
504
505 }
506 else if (numchan[i+1]==7){
511
515
516
517 trackid.push_back(apiontrk->
trackId());
518 trackid.push_back(spiontrk->
trackId());
519 showerid.push_back(gammatrk->
trackId());
520
521 }
522
523
524 }
525
526
527 saveDsInfo(it, ebeam, numofchildren, recDTag);
528 savetrack(trackid,showerid,charged_begin,charged_end,neutral_begin,neutral_end,recDTag);
529 pidtag(kaonid,pionid,kaonList_tight, pionList_tight,recDTag);
530
531
532 if(m_usevertexfit){
533 HepLorentzVector p4change_vfit=util.
vfit(channel, kaonid, pionid, xorigin, charged_begin);
534 recDTag->
setp4(recDTag->
p4()+p4change_vfit);
535 }
536
537
538 trackid.clear();
539 showerid.clear();
540 kaonid.clear();
541 pionid.clear();
542
543
544
545
546 recDTagCol->push_back(recDTag);
547
548 }
549
550 numchan.clear();
551
552 }
553
554
555
556 return StatusCode::SUCCESS;
557}
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
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)
void setdecayMode(DecayMode decayMode)
HepLorentzVector p4() const
void setp4(HepLorentzVector p4)
const EvtRecTrack * hiEnGamma() const
const EvtRecTrack * loEnGamma() const
const EvtRecTrack * loEnGamma() const
const EvtRecTrack * hiEnGamma() const
SmartRef< EvtRecTrack > & daughter(int i)
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)
_EXTERN_ std::string EvtRecEvent
_EXTERN_ std::string EvtRecDTagCol
_EXTERN_ std::string EvtRecTrackCol