112 {
113 MsgStream log(
msgSvc(), name());
114 log << MSG::INFO << "in execute()" << endreq;
115
116 StatusCode sc;
117
118
119
120
121 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
122 int event= eventHeader->eventNumber();
123
124
125
128 log << MSG::DEBUG << "run and event = " << eventHeader->runNumber()
129 << " " << eventHeader->eventNumber() << endreq;
130 log << MSG::DEBUG <<"ncharg, nneu, tottks = "
131 << recEvent->totalCharged() << " , "
132 << recEvent->totalNeutral() << " , "
133 << recEvent->totalTracks() <<endreq;
134
137
140
141
142 SmartDataPtr<EvtRecPi0Col> recPi0Col(eventSvc(), "/Event/EvtRec/EvtRecPi0Col");
143 if ( ! recPi0Col ) {
144 log << MSG::FATAL << "Could not find EvtRecPi0Col" << endreq;
145 return StatusCode::FAILURE;
146 }
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
172 Hep3Vector xorigin(0,0,0);
173
175 Gaudi::svcLocator()->service("VertexDbSvc", vtxsvc);
177
178
180 xorigin.setX(vertex[0]);
181 xorigin.setY(vertex[1]);
182 xorigin.setZ(vertex[2]);
183 }
184
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
206
208 dc_fill(ksList, recVeeVertexCol->begin(), recVeeVertexCol->end());
209
210
211 map<EvtRecVeeVertex*, vector< double > > fitinfo;
212 for(
CDKsList::iterator ksit = ksList.particle_begin(); ksit != ksList.particle_end(); ++ksit ){
215 }
216
218 dc_fill(pi0List, recPi0Col->begin(), recPi0Col->end());
219
221 dc_fill(etaList, recEtaToGGCol->begin(), recEtaToGGCol->end());
222
223
228
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
246
247 if(m_RdMeasuredEcms&&m_irun!=run){
250 m_beta.setX(ecmsSvc->
getPx(run));
251 m_beta.setY(ecmsSvc->
getPy(run));
252 m_beta.setZ(ecmsSvc->
getPz(run));
253 }
254 }
255 log << MSG::INFO << "MeasuredEcmsSvc: " <<m_beamE<< endreq;
256
257
258 if(m_ReadBeamEFromDB && m_irun!=run){
259 m_irun=run;
260 if(m_usecalibBeamE)
262 m_beamE=m_readDb.
getbeamE(m_irun,m_beamE);
263 if(run>0)
265
266 }
267 double ebeam=m_beamE;
268
269
270
271
272
273
274
275 for(int list=0;list<chanlist.size();list++){
276
277 string channel=chanlist[list];
278 vector<int> numchan;
282
283
284
285
286
287 if(channel=="DptoKPiPi") {
289 numchan.push_back(1);
290 numchan.push_back(2);
291 numchan.push_back(2);
292 decaylist=kaonList.minus()* pionList.plus()* pionList.plus();
293 }
294 else if(channel=="DptoKPiPiPi0") {
296 numchan.push_back(1);
297 numchan.push_back(2);
298 numchan.push_back(2);
299 numchan.push_back(3);
300 decaylist=kaonList.minus()* pionList.plus()* pionList.plus()* pi0List;
301 }
302 else if(channel=="DptoKsPi") {
304 numchan.push_back(5);
305 numchan.push_back(2);
306 decaylist=ksList* pionList.plus();
307 }
308 else if(channel=="DptoKsPiPi0") {
310 numchan.push_back(5);
311 numchan.push_back(2);
312 numchan.push_back(3);
313 decaylist=ksList* pionList.plus()* pi0List;
314 }
315 else if(channel=="DptoKsPiPiPi") {
317 numchan.push_back(5);
318 numchan.push_back(2);
319 numchan.push_back(2);
320 numchan.push_back(2);
321 decaylist=ksList* pionList.plus()* pionList.plus()* pionList.minus();
322 }
323 else if(channel=="DptoKKPi") {
325 numchan.push_back(1);
326 numchan.push_back(1);
327 numchan.push_back(2);
328 decaylist=kaonList.minus()* kaonList.plus()* pionList.plus();
329 }
330 else if(channel=="DptoPiPi0") {
332 numchan.push_back(2);
333 numchan.push_back(3);
334 decaylist=pionList.plus()* pi0List;
335 }
336 else if(channel=="DptoKPi0") {
338 numchan.push_back(1);
339 numchan.push_back(3);
340 decaylist=kaonList.plus()* pi0List;
341 }
342 else if(channel=="DptoKsK") {
344 numchan.push_back(5);
345 numchan.push_back(1);
346 decaylist=ksList* kaonList.plus();
347 }
348 else if(channel=="DptoPiPiPi") {
350 numchan.push_back(2);
351 numchan.push_back(2);
352 numchan.push_back(2);
353 decaylist=pionList.plus()* pionList.plus()* pionList.minus() ;
354 }
355 else if(channel=="DptoPiPi0Pi0") {
357 numchan.push_back(2);
358 numchan.push_back(3);
359 numchan.push_back(3);
360 decaylist=pionList.plus()* pi0List* pi0List;
361 }
362 else if(channel=="DptoKsKsPi") {
364 numchan.push_back(5);
365 numchan.push_back(5);
366 numchan.push_back(2);
367 decaylist=ksList* ksList* pionList.plus();
368 }
369 else if(channel=="DptoKsKPi0") {
371 numchan.push_back(5);
372 numchan.push_back(1);
373 numchan.push_back(3);
374 decaylist=ksList* kaonList.plus()* pi0List;
375 }
376 else if(channel=="DptoKsKsK") {
378 numchan.push_back(5);
379 numchan.push_back(5);
380 numchan.push_back(1);
381 decaylist=ksList* ksList* kaonList.plus();
382 }
383 else if(channel=="DptoPiPiPiPi0") {
385 numchan.push_back(2);
386 numchan.push_back(2);
387 numchan.push_back(2);
388 numchan.push_back(3);
389 decaylist=pionList.plus()* pionList.plus()* pionList.minus()* pi0List;
390 }
391 else if(channel=="DptoKsPiPi0Pi0") {
393 numchan.push_back(5);
394 numchan.push_back(2);
395 numchan.push_back(3);
396 numchan.push_back(3);
397 decaylist=ksList* pionList.plus()* pi0List* pi0List;
398 }
399 else if(channel=="DptoKsKplusPiPi") {
401 numchan.push_back(5);
402 numchan.push_back(1);
403 numchan.push_back(2);
404 numchan.push_back(2);
405 decaylist=ksList* kaonList.plus()* pionList.plus()* pionList.minus();
406 }
407 else if(channel=="DptoKsKminusPiPi") {
409 numchan.push_back(5);
410 numchan.push_back(1);
411 numchan.push_back(2);
412 numchan.push_back(2);
413 decaylist=ksList* kaonList.minus()* pionList.plus()* pionList.plus();
414 }
415 else if(channel=="DptoKKPiPi0") {
417 numchan.push_back(1);
418 numchan.push_back(1);
419 numchan.push_back(2);
420 numchan.push_back(3);
421 decaylist=kaonList.minus()* kaonList.plus()* pionList.plus()* pi0List;
422 }
423 else if(channel=="DptoPiPiPiPiPi") {
425 numchan.push_back(2);
426 numchan.push_back(2);
427 numchan.push_back(2);
428 numchan.push_back(2);
429 numchan.push_back(2);
430 decaylist=pionList.plus()* pionList.plus()* pionList.plus()* pionList.minus()* pionList.minus();
431 }
432 else if(channel=="DptoKPiPiPiPi") {
434 numchan.push_back(1);
435 numchan.push_back(2);
436 numchan.push_back(2);
437 numchan.push_back(2);
438 numchan.push_back(2);
439 decaylist=kaonList.minus()* pionList.plus()* pionList.plus()* pionList.plus()* pionList.minus();
440 }
441 else if(channel=="DptoPiEta") {
443 numchan.push_back(2);
444 numchan.push_back(4);
445 decaylist=pionList.plus()* etaList;
446 }
447 else if(channel=="DptoKsPiEta") {
449 numchan.push_back(5);
450 numchan.push_back(2);
451 numchan.push_back(4);
452 decaylist=ksList* pionList.plus()* etaList;
453 }
454
457
459
462
463 vector<int> trackid, showerid;
464 vector<int> kaonid, pionid;
465 int numofchildren=numchan.size()-1;
466
467 for(int i=0; i< numofchildren;i++){
468
469 const CDCandidate& daughter=(*it).particle().child(i);
470
471 if(numchan[i+1]==1){
473 trackid.push_back(track->
trackId());
474 kaonid.push_back(track->
trackId());
475 }
476 else if(numchan[i+1]==2){
478 trackid.push_back(track->
trackId());
479 pionid.push_back(track->
trackId());
480 }
481 else if ( numchan[i+1]==3){
484 showerid.push_back(hiEnGamma->
trackId());
485 showerid.push_back(loEnGamma->
trackId());
486 }
487 else if ( numchan[i+1]==4){
490 showerid.push_back(hiEnGamma->
trackId());
491 showerid.push_back(loEnGamma->
trackId());
492 }
493 else if ( numchan[i+1]==5){
495
496 recDTag->
addToFitInfo(aKsCand->
mass(),fitinfo[aKsCand][0],fitinfo[aKsCand][1],fitinfo[aKsCand][2]);
497
500 trackid.push_back(pion1Trk->
trackId());
501 trackid.push_back(pion2Trk->
trackId());
502 }
503
504 }
505
506
508 savetrack(trackid,showerid,charged_begin,charged_end,neutral_begin,neutral_end,recDTag);
509 pidtag(kaonid,pionid,kaonList_tight, pionList_tight,recDTag);
510
511 if(m_usevertexfit){
512 HepLorentzVector p4change_vfit=util.
vfit(channel, kaonid, pionid, xorigin, charged_begin);
513 recDTag->
setp4(recDTag->
p4()+p4change_vfit);
514 }
515
516
517 trackid.clear();
518 showerid.clear();
519 kaonid.clear();
520 pionid.clear();
521
522
523 recDTagCol->push_back(recDTag);
524
525 }
526
527 numchan.clear();
528
529 }
530
531 return StatusCode::SUCCESS;
532}
void dc_fill(DCFillableChargedList< Charged > &aFillableList, WitnessIterator first, WitnessIterator last)
EvtRecTrackCol::iterator EvtRecTrackIterator
ChargedDSelector chargedDSelector
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)
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