101 {
102 MsgStream log(
msgSvc(), name());
103 log << MSG::INFO << "in execute()" << endreq;
104
105 StatusCode sc;
106
107
108
109
110 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
111 int event= eventHeader->eventNumber();
112
113
114
117 log << MSG::DEBUG << "run and event = " << eventHeader->runNumber()
118 << " " << eventHeader->eventNumber() << endreq;
119 log << MSG::DEBUG <<"ncharg, nneu, tottks = "
120 << recEvent->totalCharged() << " , "
121 << recEvent->totalNeutral() << " , "
122 << recEvent->totalTracks() <<endreq;
123
126
129
130
131 SmartDataPtr<EvtRecPi0Col> recPi0Col(eventSvc(), "/Event/EvtRec/EvtRecPi0Col");
132 if ( ! recPi0Col ) {
133 log << MSG::FATAL << "Could not find EvtRecPi0Col" << endreq;
134 return StatusCode::FAILURE;
135 }
136
137
138 SmartDataPtr<EvtRecEtaToGGCol> recEtaToGGCol(eventSvc(), "/Event/EvtRec/EvtRecEtaToGGCol");
139 if ( ! recEtaToGGCol ) {
140 log << MSG::FATAL << "Could not find EvtRecEtaToGGCol" << endreq;
141 return StatusCode::FAILURE;
142 }
143
144
145 SmartDataPtr<EvtRecVeeVertexCol> recVeeVertexCol(eventSvc(), "/Event/EvtRec/EvtRecVeeVertexCol");
146 if ( ! recVeeVertexCol ) {
147 log << MSG::FATAL << "Could not find EvtRecVeeVertexCol" << endreq;
148 return StatusCode::FAILURE;
149 }
150
151
153 if (!recDTagCol) {
154 log << MSG::FATAL << "EvtRecDTagCol is not registered yet" << endreq;
155 return StatusCode::FAILURE;
156 }
157
158
159
160
161 Hep3Vector xorigin(0,0,0);
162
164 Gaudi::svcLocator()->service("VertexDbSvc", vtxsvc);
166
167
169 xorigin.setX(vertex[0]);
170 xorigin.setY(vertex[1]);
171 xorigin.setZ(vertex[2]);
172 }
173
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
195
196
198 dc_fill(ksList, recVeeVertexCol->begin(), recVeeVertexCol->end());
199
201 dc_fill(pi0List, recPi0Col->begin(), recPi0Col->end());
202
204 dc_fill(etaList, recEtaToGGCol->begin(), recEtaToGGCol->end());
205
206
211
212
213
214 int run = eventHeader->runNumber();
215 m_ievt = eventHeader->eventNumber();
216 m_nChrg = recEvent->totalCharged();
217 m_nNeu = recEvent->totalNeutral();
218 m_nPion = pionList.size();
219 m_nKaon = kaonList.size();
220 m_nPi0 = pi0List.size();
221 m_nKs = ksList.size();
222
223
224
225
226
227
228
229 if(m_ReadBeamEFromDB && m_irun!=run){
230 m_irun=run;
231 if(m_usecalibBeamE)
233 m_beamE=m_readDb.
getbeamE(m_irun,m_beamE);
234 if(run>0)
236
237 }
238 double ebeam=m_beamE;
239
240
241
242
243
244
245
246 for(int list=0;list<chanlist.size();list++){
247
248 string channel=chanlist[list];
249 vector<int> numchan;
253
254
255
256
257
258 if(channel=="DptoKPiPi") {
260 numchan.push_back(1);
261 numchan.push_back(2);
262 numchan.push_back(2);
263 decaylist=kaonList.minus()* pionList.plus()* pionList.plus();
264 }
265 else if(channel=="DptoKPiPiPi0") {
267 numchan.push_back(1);
268 numchan.push_back(2);
269 numchan.push_back(2);
270 numchan.push_back(3);
271 decaylist=kaonList.minus()* pionList.plus()* pionList.plus()* pi0List;
272 }
273 else if(channel=="DptoKsPi") {
275 numchan.push_back(5);
276 numchan.push_back(2);
277 decaylist=ksList* pionList.plus();
278 }
279 else if(channel=="DptoKsPiPi0") {
281 numchan.push_back(5);
282 numchan.push_back(2);
283 numchan.push_back(3);
284 decaylist=ksList* pionList.plus()* pi0List;
285 }
286 else if(channel=="DptoKsPiPiPi") {
288 numchan.push_back(5);
289 numchan.push_back(2);
290 numchan.push_back(2);
291 numchan.push_back(2);
292 decaylist=ksList* pionList.plus()* pionList.plus()* pionList.minus();
293 }
294 else if(channel=="DptoKKPi") {
296 numchan.push_back(1);
297 numchan.push_back(1);
298 numchan.push_back(2);
299 decaylist=kaonList.minus()* kaonList.plus()* pionList.plus();
300 }
301 else if(channel=="DptoPiPi0") {
303 numchan.push_back(2);
304 numchan.push_back(3);
305 decaylist=pionList.plus()* pi0List;
306 }
307 else if(channel=="DptoKPi0") {
309 numchan.push_back(1);
310 numchan.push_back(3);
311 decaylist=kaonList.plus()* pi0List;
312 }
313 else if(channel=="DptoKsK") {
315 numchan.push_back(5);
316 numchan.push_back(1);
317 decaylist=ksList* kaonList.plus();
318 }
319 else if(channel=="DptoPiPiPi") {
321 numchan.push_back(2);
322 numchan.push_back(2);
323 numchan.push_back(2);
324 decaylist=pionList.plus()* pionList.plus()* pionList.minus() ;
325 }
326 else if(channel=="DptoPiPi0Pi0") {
328 numchan.push_back(2);
329 numchan.push_back(3);
330 numchan.push_back(3);
331 decaylist=pionList.plus()* pi0List* pi0List;
332 }
333 else if(channel=="DptoKsKsPi") {
335 numchan.push_back(5);
336 numchan.push_back(5);
337 numchan.push_back(2);
338 decaylist=ksList* ksList* pionList.plus();
339 }
340 else if(channel=="DptoKsKPi0") {
342 numchan.push_back(5);
343 numchan.push_back(1);
344 numchan.push_back(3);
345 decaylist=ksList* kaonList.plus()* pi0List;
346 }
347 else if(channel=="DptoKsKsK") {
349 numchan.push_back(5);
350 numchan.push_back(5);
351 numchan.push_back(1);
352 decaylist=ksList* ksList* kaonList.plus();
353 }
354 else if(channel=="DptoPiPiPiPi0") {
356 numchan.push_back(2);
357 numchan.push_back(2);
358 numchan.push_back(2);
359 numchan.push_back(3);
360 decaylist=pionList.plus()* pionList.plus()* pionList.minus()* pi0List;
361 }
362 else if(channel=="DptoKsPiPi0Pi0") {
364 numchan.push_back(5);
365 numchan.push_back(2);
366 numchan.push_back(3);
367 numchan.push_back(3);
368 decaylist=ksList* pionList.plus()* pi0List* pi0List;
369 }
370 else if(channel=="DptoKsKplusPiPi") {
372 numchan.push_back(5);
373 numchan.push_back(1);
374 numchan.push_back(2);
375 numchan.push_back(2);
376 decaylist=ksList* kaonList.plus()* pionList.plus()* pionList.minus();
377 }
378 else if(channel=="DptoKsKminusPiPi") {
380 numchan.push_back(5);
381 numchan.push_back(1);
382 numchan.push_back(2);
383 numchan.push_back(2);
384 decaylist=ksList* kaonList.minus()* pionList.plus()* pionList.plus();
385 }
386 else if(channel=="DptoKKPiPi0") {
388 numchan.push_back(1);
389 numchan.push_back(1);
390 numchan.push_back(2);
391 numchan.push_back(3);
392 decaylist=kaonList.minus()* kaonList.plus()* pionList.plus()* pi0List;
393 }
394 else if(channel=="DptoPiPiPiPiPi") {
396 numchan.push_back(2);
397 numchan.push_back(2);
398 numchan.push_back(2);
399 numchan.push_back(2);
400 numchan.push_back(2);
401 decaylist=pionList.plus()* pionList.plus()* pionList.plus()* pionList.minus()* pionList.minus();
402 }
403 else if(channel=="DptoKPiPiPiPi") {
405 numchan.push_back(1);
406 numchan.push_back(2);
407 numchan.push_back(2);
408 numchan.push_back(2);
409 numchan.push_back(2);
410 decaylist=kaonList.minus()* pionList.plus()* pionList.plus()* pionList.plus()* pionList.minus();
411 }
412 else if(channel=="DptoPiEta") {
414 numchan.push_back(2);
415 numchan.push_back(4);
416 decaylist=pionList.plus()* etaList;
417 }
418 else if(channel=="DptoKsPiEta") {
420 numchan.push_back(5);
421 numchan.push_back(2);
422 numchan.push_back(4);
423 decaylist=ksList* pionList.plus()* etaList;
424 }
425
428
430
433
434 vector<int> trackid, showerid;
435 vector<int> kaonid, pionid;
436 int numofchildren=numchan.size()-1;
437
438 for(int i=0; i< numofchildren;i++){
439
440 const CDCandidate& daughter=(*it).particle().child(i);
441
442 if(numchan[i+1]==1){
444 trackid.push_back(track->
trackId());
445 kaonid.push_back(track->
trackId());
446 }
447 else if(numchan[i+1]==2){
449 trackid.push_back(track->
trackId());
450 pionid.push_back(track->
trackId());
451 }
452 else if ( numchan[i+1]==3){
455 showerid.push_back(hiEnGamma->
trackId());
456 showerid.push_back(loEnGamma->
trackId());
457 }
458 else if ( numchan[i+1]==4){
461 showerid.push_back(hiEnGamma->
trackId());
462 showerid.push_back(loEnGamma->
trackId());
463 }
464 else if ( numchan[i+1]==5){
468 trackid.push_back(pion1Trk->
trackId());
469 trackid.push_back(pion2Trk->
trackId());
470 }
471
472 }
473
474
475 saveDpInfo(it, ebeam, numofchildren, recDTag);
476 savetrack(trackid,showerid,charged_begin,charged_end,neutral_begin,neutral_end,recDTag);
477 pidtag(kaonid,pionid,kaonList_tight, pionList_tight,recDTag);
478
479 if(m_usevertexfit){
480 HepLorentzVector p4change_vfit=util.
vfit(channel, kaonid, pionid, xorigin, charged_begin);
481 recDTag->
setp4(recDTag->
p4()+p4change_vfit);
482 }
483
484
485 trackid.clear();
486 showerid.clear();
487 kaonid.clear();
488 pionid.clear();
489
490
491
492 recDTagCol->push_back(recDTag);
493
494 }
495
496 numchan.clear();
497
498 }
499
500
501
502 return StatusCode::SUCCESS;
503}
ChargedDSelector chargedDSelector
void dc_fill(DCFillableChargedList< Charged > &aFillableList, WitnessIterator first, WitnessIterator last)
EvtRecTrackCol::iterator EvtRecTrackIterator
LocalEtatoGGSelector etatoGGSelector
LocalKaonSelector kaonSelector
LocalKsSelector ksSelector
LocalPi0Selector pi0Selector
LocalPionSelector pionSelector
virtual const EvtRecTrack * track() const
virtual const EvtRecVeeVertex * navKshort() const
virtual const EvtRecPi0 * navPi0() const
virtual const EvtRecEtaToGG * navEta() const
void saveDpInfo(CDDecayList::iterator, double, int, EvtRecDTag *)
void pidtag(vector< int >, vector< int >, CDChargedKaonList &, CDChargedPionList &, EvtRecDTag *)
void savetrack(vector< int >, vector< int >, EvtRecTrackIterator, EvtRecTrackIterator, EvtRecTrackIterator, EvtRecTrackIterator, 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