109 {
110 MsgStream log(
msgSvc(), name());
111 log << MSG::INFO << "in execute()" << endreq;
112
113 StatusCode sc;
114
115
116
117
118 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
119 int event= eventHeader->eventNumber();
120
121
122
125 log << MSG::DEBUG << "run and event = " << eventHeader->runNumber()
126 << " " << eventHeader->eventNumber() << endreq;
127 log << MSG::DEBUG <<"ncharg, nneu, tottks = "
128 << recEvent->totalCharged() << " , "
129 << recEvent->totalNeutral() << " , "
130 << recEvent->totalTracks() <<endreq;
131
134
137
138
139 SmartDataPtr<EvtRecPi0Col> recPi0Col(eventSvc(), "/Event/EvtRec/EvtRecPi0Col");
140 if ( ! recPi0Col ) {
141 log << MSG::FATAL << "Could not find EvtRecPi0Col" << endreq;
142 return StatusCode::FAILURE;
143 }
144
145
146 SmartDataPtr<EvtRecEtaToGGCol> recEtaToGGCol(eventSvc(), "/Event/EvtRec/EvtRecEtaToGGCol");
147 if ( ! recEtaToGGCol ) {
148 log << MSG::FATAL << "Could not find EvtRecEtaToGGCol" << endreq;
149 return StatusCode::FAILURE;
150 }
151
152
153 SmartDataPtr<EvtRecVeeVertexCol> recVeeVertexCol(eventSvc(), "/Event/EvtRec/EvtRecVeeVertexCol");
154 if ( ! recVeeVertexCol ) {
155 log << MSG::FATAL << "Could not find EvtRecVeeVertexCol" << endreq;
156 return StatusCode::FAILURE;
157 }
158
159
161 if (!recDTagCol) {
162 log << MSG::FATAL << "EvtRecDTagCol is not registered yet" << endreq;
163 return StatusCode::FAILURE;
164 }
165
166
167
168
169 Hep3Vector xorigin(0,0,0);
170
172 Gaudi::svcLocator()->service("VertexDbSvc", vtxsvc);
174
175
177 xorigin.setX(vertex[0]);
178 xorigin.setY(vertex[1]);
179 xorigin.setZ(vertex[2]);
180 }
181
183
184
185
186
190
194
196
198 dc_fill(ksList, recVeeVertexCol->begin(), recVeeVertexCol->end());
199
200
201 map<EvtRecVeeVertex*, vector< double > > fitinfo_Ks;
202 for(
CDKsList::iterator ksit = ksList.particle_begin(); ksit != ksList.particle_end(); ++ksit ){
204 if(m_useVFrefine){
206 }else{
208 }
209
210 }
211
212
213
215 map<EvtRecVeeVertex*, vector< double > > fitinfo_Lambda;
216 for(
CDLambdaList::iterator lambdait = lambdaList.particle_begin(); lambdait != lambdaList.particle_end(); ++lambdait ){
218 if(m_useVFrefine){
220 }else{
222 }
223
224 }
225
227 dc_fill(pi0List, recPi0Col->begin(), recPi0Col->end());
228
230 dc_fill(etaList, recEtaToGGCol->begin(), recEtaToGGCol->end());
231
232
239 int run = eventHeader->runNumber();
240 m_ievt = eventHeader->eventNumber();
241 m_nChrg = recEvent->totalCharged();
242 m_nNeu = recEvent->totalNeutral();
243 m_nPion = pionList.size();
244 m_nKaon = kaonList.size();
245 m_nProton = protonList.size();
246 m_nPi0 = pi0List.size();
247 m_nKs = ksList.size();
248 m_nLambda = lambdaList.size();
249
250
251
252
253
254
255
256 if(m_ReadBeamEFromDB && m_irun!=run){
257 m_irun=run;
258 if(m_usecalibBeamE)
260 m_beamE=m_readDb.
getbeamE(m_irun,m_beamE);
261 if(run>0)
263
264 }
265 double ebeam=m_beamE;
266
267
268
269
270
271
272
273 for(int list=0;list<chanlist.size();list++){
274
275 string channel=chanlist[list];
276 vector<int> numchan;
280
281
282
283
284
285 if(channel=="LambdacPtoKsP") {
287 numchan.push_back(8);
288 numchan.push_back(5);
289 decaylist=protonList.plus()* ksList;
290 }
291 else if(channel=="LambdacPtoKPiP") {
293 numchan.push_back(8);
294 numchan.push_back(1);
295 numchan.push_back(2);
296 decaylist=protonList.plus()* kaonList.minus()* pionList.plus();
297 }
298 else if(channel=="LambdacPtoKsPi0P") {
300 numchan.push_back(8);
301 numchan.push_back(5);
302 numchan.push_back(3);
303 decaylist=protonList.plus()* ksList* pi0List;
304 }
305 else if(channel=="LambdacPtoKsPiPiP") {
307 numchan.push_back(8);
308 numchan.push_back(5);
309 numchan.push_back(2);
310 numchan.push_back(2);
311 decaylist=protonList.plus()* ksList* pionList.plus()* pionList.minus();
312 }
313 else if(channel=="LambdacPtoKPiPi0P") {
315 numchan.push_back(8);
316 numchan.push_back(1);
317 numchan.push_back(2);
318 numchan.push_back(3);
319 decaylist=protonList.plus()* kaonList.minus()* pionList.plus()* pi0List;
320 }
321 else if(channel=="LambdacPtoPiPiP") {
323 numchan.push_back(8);
324 numchan.push_back(2);
325 numchan.push_back(2);
326 decaylist=protonList.plus()* pionList.plus()* pionList.minus();
327 }
328 else if(channel=="LambdacPtoLambdaPi") {
330 numchan.push_back(9);
331 numchan.push_back(2);
332 decaylist=lambdaList()* pionList.plus();
333 }
334 else if(channel=="LambdacPtoLambdaPiPi0") {
336 numchan.push_back(9);
337 numchan.push_back(2);
338 numchan.push_back(3);
339 decaylist=lambdaList()* pionList.plus()* pi0List;
340 }
341 else if(channel=="LambdacPtoLambdaPiEta") {
343 numchan.push_back(9);
344 numchan.push_back(2);
345 numchan.push_back(4);
346 decaylist=lambdaList()* pionList.plus()* etaList;;
347 }
348 else if(channel=="LambdacPtoLambdaPiPiPi") {
350 numchan.push_back(9);
351 numchan.push_back(2);
352 numchan.push_back(2);
353 numchan.push_back(2);
354 decaylist=lambdaList()* pionList.plus()* pionList.minus() *pionList.plus();
355 }
356 else if(channel=="LambdacPtoLambdaPiOmega") {
358 numchan.push_back(9);
359 numchan.push_back(2);
360 numchan.push_back(12);
362 omgList=pionList.plus()* pionList.minus() *pi0List;
363 decaylist=lambdaList()* pionList.plus()* omgList;
364 }
365 else if(channel=="LambdacPtoPiSIGMA0LambdaGam") {
367 numchan.push_back(2);
368 numchan.push_back(10);
370 sgmList=lambdaList()* photonList;
371 decaylist=pionList.plus()* sgmList;
372 }
373 else if(channel=="LambdacPtoPiPi0SIGMA0LambdaGam") {
375 numchan.push_back(2);
376 numchan.push_back(3);
377 numchan.push_back(10);
379 sgmList=lambdaList()* photonList;
380 decaylist=pionList.plus()* pi0List* sgmList;
381 }
382 else if(channel=="LambdacPtoPi0SIGMAPi0P") {
384 numchan.push_back(3);
385 numchan.push_back(11);
387 sgmList=pi0List* protonList.plus();
388 decaylist=pi0List* sgmList;
389 }
390 else if(channel=="LambdacPtoPiPiSIGMAPi0P") {
392 numchan.push_back(2);
393 numchan.push_back(2);
394 numchan.push_back(11);
396 sgmList=pi0List* protonList.plus();
397 decaylist=pionList.plus()* pionList.minus()* sgmList;
398 }
399 else if(channel=="LambdacPtoOmegaSIGMAPi0P") {
401 numchan.push_back(12);
402 numchan.push_back(11);
404 omgList=pionList.plus()* pionList.minus()* pi0List;
406 sgmList=pi0List* protonList.plus();
407 decaylist=omgList* sgmList;
408 }
409 else if(channel=="LambdacPtoPiPiPi0SIGMAPi0P") {
411 numchan.push_back(2);
412 numchan.push_back(2);
413 numchan.push_back(3);
414 numchan.push_back(11);
416 sgmList=pi0List* protonList.plus();
417 decaylist=pionList.plus()* pionList.minus()*pi0List* sgmList;
418 }
419
420
423
425
428
429 vector<int> trackid, showerid;
430 vector<int> kaonid, pionid, protonid;
431 int numofchildren=numchan.size()-1;
432
433 for(int i=0; i< numofchildren;i++){
434
435 const CDCandidate& daughter=(*it).particle().child(i);
436
437 if(numchan[i+1]==1){
439 trackid.push_back(track->
trackId());
440 kaonid.push_back(track->
trackId());
441 }
442 else if(numchan[i+1]==2){
444 trackid.push_back(track->
trackId());
445 pionid.push_back(track->
trackId());
446 }
447 else if(numchan[i+1]==8){
449 trackid.push_back(track->
trackId());
450 protonid.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){
466 recDTag->
addToFitInfo(aKsCand->
mass(),fitinfo_Ks[aKsCand][0],fitinfo_Ks[aKsCand][1],fitinfo_Ks[aKsCand][2]);
469 trackid.push_back(pion1Trk->
trackId());
470 trackid.push_back(pion2Trk->
trackId());
471 }
472 else if ( numchan[i+1]==9){
474 recDTag->
addToFitInfo(aLambdaCand->
mass(),fitinfo_Lambda[aLambdaCand][0],fitinfo_Lambda[aLambdaCand][1],fitinfo_Lambda[aLambdaCand][2]);
475
476 int index[2] = {0, 1};
478 index[0] = 1;
479 index[1] = 0;
480 }
481
484 trackid.push_back(protonTrk->
trackId());
485 trackid.push_back(pionTrk->
trackId());
486 }
487 else if (numchan[i+1]==6){
495
496 trackid.push_back(apiontrk->
trackId());
497 trackid.push_back(spiontrk->
trackId());
498 showerid.push_back(hiEnGamma->
trackId());
499 showerid.push_back(loEnGamma->
trackId());
500
501 }
502 else if (numchan[i+1]==7){
507
511
512
513 trackid.push_back(apiontrk->
trackId());
514 trackid.push_back(spiontrk->
trackId());
515 showerid.push_back(gammatrk->
trackId());
516
517 }
518 else if (numchan[i+1]==10){
521 showerid.push_back(gammatrk->
trackId());
522
524 recDTag->
addToFitInfo(aLambdaCand->
mass(),fitinfo_Lambda[aLambdaCand][0],fitinfo_Lambda[aLambdaCand][1],fitinfo_Lambda[aLambdaCand][2]);
525
526 int index[2] = {0, 1};
528 index[0] = 1;
529 index[1] = 0;
530 }
531
534 trackid.push_back(protonTrk->
trackId());
535 trackid.push_back(pionTrk->
trackId());
536
537 }
538 else if (numchan[i+1]==11){
543
547
548
549 showerid.push_back(agamtrk->
trackId());
550 showerid.push_back(sgamtrk->
trackId());
551 trackid.push_back(Ptrk->
trackId());
552 }
553 else if (numchan[i+1]==12){
561
562 trackid.push_back(apiontrk->
trackId());
563 trackid.push_back(spiontrk->
trackId());
564 showerid.push_back(hiEnGamma->
trackId());
565 showerid.push_back(loEnGamma->
trackId());
566
567 }
568
569 }
570
571
573 savetrack(trackid,showerid,charged_begin,charged_end,neutral_begin,neutral_end,recDTag);
574 pidtag(kaonid,pionid,protonid, kaonList_tight, pionList_tight, protonList_tight, recDTag);
575
576 if(m_usevertexfit){
577 if(m_debug) cout<<"beforevfit:"<<endl;
578
579 HepLorentzVector p4change_vfit;
580
581 if(m_useVFrefine){
582 p4change_vfit=util.
vfitref(channel, kaonid, pionid, xorigin, charged_begin);
583 }else{
584 p4change_vfit=util.
vfit(channel, kaonid, pionid, xorigin, charged_begin);
585 }
586
587 recDTag->
setp4(recDTag->
p4()+p4change_vfit);
588 }
589
590
591 trackid.clear();
592 showerid.clear();
593 kaonid.clear();
594 pionid.clear();
595 protonid.clear();
596
597
598 recDTagCol->push_back(recDTag);
599
600 }
601
602 numchan.clear();
603
604 }
605
606 return StatusCode::SUCCESS;
607}
double P(RecMdcKalTrack *trk)
void dc_fill(DCFillableChargedList< Charged > &aFillableList, WitnessIterator first, WitnessIterator last)
EvtRecTrackCol::iterator EvtRecTrackIterator
LambdaCSelector lambdaCSelector
LocalChargedSigmaSelector chargedsigmaSelector
LocalEtatoGGSelector etatoGGSelector
LocalKaonSelector kaonSelector
LocalKsSelector ksSelector
LocalLambdaSelector lambdaSelector
LocalPhotonSelector photonSelector
LocalPi0Selector pi0Selector
LocalPionSelector pionSelector
LocalProtonSelector protonSelector
LocalSigma0Selector sigma0Selector
LocalomegatoPiPiPi0Selector omegatoPiPiPi0Selector
virtual const DecayEvidence & decay() const
virtual const EvtRecTrack * photon() const
virtual const EvtRecVeeVertex * navLambda() 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
@ kLambdacPtoLambdaPiOmega
@ kLambdacPtoPiSIGMA0LambdaGam
@ kLambdacPtoOmegaSIGMAPi0P
@ kLambdacPtoPi0SIGMAPi0P
@ kLambdacPtoPiPiSIGMAPi0P
@ kLambdacPtoPiPiPi0SIGMAPi0P
@ kLambdacPtoPiPi0SIGMA0LambdaGam
@ kLambdacPtoLambdaPiPiPi
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 bool isVertexValid()=0
virtual double * PrimaryVertex()=0
void savetrack(vector< int >, vector< int >, EvtRecTrackIterator, EvtRecTrackIterator, EvtRecTrackIterator, EvtRecTrackIterator, EvtRecDTag *)
void pidtag(vector< int >, vector< int >, vector< int >, CDChargedKaonList &, CDChargedPionList &, CDProtonList &, EvtRecDTag *)
void saveLcInfo(CDDecayList::iterator, double, int, EvtRecDTag *)
void setebeam(double ebeam)
void setbeta(Hep3Vector beta)
void setpidtype(int type)
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 > SecondaryVFit_Lambdaref(EvtRecVeeVertex *lambda, IVertexDbSvc *vtxsvc)
vector< double > SecondaryVFit_Lambda(EvtRecVeeVertex *lambda, IVertexDbSvc *vtxsvc)
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