110 {
111 MsgStream log(
msgSvc(), name());
112 log << MSG::INFO << "in execute()" << endreq;
113
114 StatusCode sc;
115
116
117
118
119 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
120 int event= eventHeader->eventNumber();
121
122
123
126 log << MSG::DEBUG << "run and event = " << eventHeader->runNumber()
127 << " " << eventHeader->eventNumber() << endreq;
128 log << MSG::DEBUG <<"ncharg, nneu, tottks = "
129 << recEvent->totalCharged() << " , "
130 << recEvent->totalNeutral() << " , "
131 << recEvent->totalTracks() <<endreq;
132
135
138
139
140 SmartDataPtr<EvtRecPi0Col> recPi0Col(eventSvc(), "/Event/EvtRec/EvtRecPi0Col");
141 if ( ! recPi0Col ) {
142 log << MSG::FATAL << "Could not find EvtRecPi0Col" << endreq;
143 return StatusCode::FAILURE;
144 }
145
146
147 SmartDataPtr<EvtRecEtaToGGCol> recEtaToGGCol(eventSvc(), "/Event/EvtRec/EvtRecEtaToGGCol");
148 if ( ! recEtaToGGCol ) {
149 log << MSG::FATAL << "Could not find EvtRecEtaToGGCol" << endreq;
150 return StatusCode::FAILURE;
151 }
152
153
154 SmartDataPtr<EvtRecVeeVertexCol> recVeeVertexCol(eventSvc(), "/Event/EvtRec/EvtRecVeeVertexCol");
155 if ( ! recVeeVertexCol ) {
156 log << MSG::FATAL << "Could not find EvtRecVeeVertexCol" << endreq;
157 return StatusCode::FAILURE;
158 }
159
160
162 if (!recDTagCol) {
163 log << MSG::FATAL << "EvtRecDTagCol is not registered yet" << endreq;
164 return StatusCode::FAILURE;
165 }
166
167
168
169
170 Hep3Vector xorigin(0,0,0);
171
173 Gaudi::svcLocator()->service("VertexDbSvc", vtxsvc);
175
176
178 xorigin.setX(vertex[0]);
179 xorigin.setY(vertex[1]);
180 xorigin.setZ(vertex[2]);
181 }
182
184
185
186
187
191
195
197
199 dc_fill(ksList, recVeeVertexCol->begin(), recVeeVertexCol->end());
200
201
202 map<EvtRecVeeVertex*, vector< double > > fitinfo_Ks;
203 for(
CDKsList::iterator ksit = ksList.particle_begin(); ksit != ksList.particle_end(); ++ksit ){
205 if(m_useVFrefine){
207 }else{
209 }
210
211 }
212
213
214
216 map<EvtRecVeeVertex*, vector< double > > fitinfo_Lambda;
217 for(
CDLambdaList::iterator lambdait = lambdaList.particle_begin(); lambdait != lambdaList.particle_end(); ++lambdait ){
219 if(m_useVFrefine){
221 }else{
223 }
224
225 }
226
228 dc_fill(pi0List, recPi0Col->begin(), recPi0Col->end());
229
231 dc_fill(etaList, recEtaToGGCol->begin(), recEtaToGGCol->end());
232
233
240 int run = eventHeader->runNumber();
241 m_ievt = eventHeader->eventNumber();
242 m_nChrg = recEvent->totalCharged();
243 m_nNeu = recEvent->totalNeutral();
244 m_nPion = pionList.size();
245 m_nKaon = kaonList.size();
246 m_nProton = protonList.size();
247 m_nPi0 = pi0List.size();
248 m_nKs = ksList.size();
249 m_nLambda = lambdaList.size();
250
251
252
253
254
255
256
257 if(m_ReadBeamEFromDB && m_irun!=run){
258 m_irun=run;
259 if(m_usecalibBeamE)
261 m_beamE=m_readDb.
getbeamE(m_irun,m_beamE);
262 if(run>0)
264
265 }
266 double ebeam=m_beamE;
267
268
269
270
271
272
273
274 for(int list=0;list<chanlist.size();list++){
275
276 string channel=chanlist[list];
277 vector<int> numchan;
281
282
283
284
285
286 if(channel=="LambdacPtoKsP") {
288 numchan.push_back(8);
289 numchan.push_back(5);
290 decaylist=protonList.plus()* ksList;
291 }
292 else if(channel=="LambdacPtoKPiP") {
294 numchan.push_back(8);
295 numchan.push_back(1);
296 numchan.push_back(2);
297 decaylist=protonList.plus()* kaonList.minus()* pionList.plus();
298 }
299 else if(channel=="LambdacPtoKsPi0P") {
301 numchan.push_back(8);
302 numchan.push_back(5);
303 numchan.push_back(3);
304 decaylist=protonList.plus()* ksList* pi0List;
305 }
306 else if(channel=="LambdacPtoKsPiPiP") {
308 numchan.push_back(8);
309 numchan.push_back(5);
310 numchan.push_back(2);
311 numchan.push_back(2);
312 decaylist=protonList.plus()* ksList* pionList.plus()* pionList.minus();
313 }
314 else if(channel=="LambdacPtoKPiPi0P") {
316 numchan.push_back(8);
317 numchan.push_back(1);
318 numchan.push_back(2);
319 numchan.push_back(3);
320 decaylist=protonList.plus()* kaonList.minus()* pionList.plus()* pi0List;
321 }
322 else if(channel=="LambdacPtoPiPiP") {
324 numchan.push_back(8);
325 numchan.push_back(2);
326 numchan.push_back(2);
327 decaylist=protonList.plus()* pionList.plus()* pionList.minus();
328 }
329 else if(channel=="LambdacPtoLambdaPi") {
331 numchan.push_back(9);
332 numchan.push_back(2);
333 decaylist=lambdaList()* pionList.plus();
334 }
335 else if(channel=="LambdacPtoLambdaPiPi0") {
337 numchan.push_back(9);
338 numchan.push_back(2);
339 numchan.push_back(3);
340 decaylist=lambdaList()* pionList.plus()* pi0List;
341 }
342 else if(channel=="LambdacPtoLambdaPiEta") {
344 numchan.push_back(9);
345 numchan.push_back(2);
346 numchan.push_back(4);
347 decaylist=lambdaList()* pionList.plus()* etaList;;
348 }
349 else if(channel=="LambdacPtoLambdaPiPiPi") {
351 numchan.push_back(9);
352 numchan.push_back(2);
353 numchan.push_back(2);
354 numchan.push_back(2);
355 decaylist=lambdaList()* pionList.plus()* pionList.minus() *pionList.plus();
356 }
357 else if(channel=="LambdacPtoLambdaPiOmega") {
359 numchan.push_back(9);
360 numchan.push_back(2);
361 numchan.push_back(12);
363 omgList=pionList.plus()* pionList.minus() *pi0List;
364 decaylist=lambdaList()* pionList.plus()* omgList;
365 }
366 else if(channel=="LambdacPtoPiSIGMA0LambdaGam") {
368 numchan.push_back(2);
369 numchan.push_back(10);
371 sgmList=lambdaList()* photonList;
372 decaylist=pionList.plus()* sgmList;
373 }
374 else if(channel=="LambdacPtoPiPi0SIGMA0LambdaGam") {
376 numchan.push_back(2);
377 numchan.push_back(3);
378 numchan.push_back(10);
380 sgmList=lambdaList()* photonList;
381 decaylist=pionList.plus()* pi0List* sgmList;
382 }
383 else if(channel=="LambdacPtoPi0SIGMAPi0P") {
385 numchan.push_back(3);
386 numchan.push_back(11);
388 sgmList=pi0List* protonList.plus();
389 decaylist=pi0List* sgmList;
390 }
391 else if(channel=="LambdacPtoPiPiSIGMAPi0P") {
393 numchan.push_back(2);
394 numchan.push_back(2);
395 numchan.push_back(11);
397 sgmList=pi0List* protonList.plus();
398 decaylist=pionList.plus()* pionList.minus()* sgmList;
399 }
400 else if(channel=="LambdacPtoOmegaSIGMAPi0P") {
402 numchan.push_back(12);
403 numchan.push_back(11);
405 omgList=pionList.plus()* pionList.minus()* pi0List;
407 sgmList=pi0List* protonList.plus();
408 decaylist=omgList* sgmList;
409 }
410 else if(channel=="LambdacPtoPiPiPi0SIGMAPi0P") {
412 numchan.push_back(2);
413 numchan.push_back(2);
414 numchan.push_back(3);
415 numchan.push_back(11);
417 sgmList=pi0List* protonList.plus();
418 decaylist=pionList.plus()* pionList.minus()*pi0List* sgmList;
419 }
420
421
424
426
429
430 vector<int> trackid, showerid;
431 vector<int> kaonid, pionid, protonid;
432 int numofchildren=numchan.size()-1;
433
434 for(int i=0; i< numofchildren;i++){
435
436 const CDCandidate& daughter=(*it).particle().child(i);
437
438 if(numchan[i+1]==1){
440 trackid.push_back(track->
trackId());
441 kaonid.push_back(track->
trackId());
442 }
443 else if(numchan[i+1]==2){
445 trackid.push_back(track->
trackId());
446 pionid.push_back(track->
trackId());
447 }
448 else if(numchan[i+1]==8){
450 trackid.push_back(track->
trackId());
451 protonid.push_back(track->
trackId());
452 }
453 else if ( numchan[i+1]==3){
456 showerid.push_back(hiEnGamma->
trackId());
457 showerid.push_back(loEnGamma->
trackId());
458 }
459 else if ( numchan[i+1]==4){
462 showerid.push_back(hiEnGamma->
trackId());
463 showerid.push_back(loEnGamma->
trackId());
464 }
465 else if ( numchan[i+1]==5){
467 recDTag->
addToFitInfo(aKsCand->
mass(),fitinfo_Ks[aKsCand][0],fitinfo_Ks[aKsCand][1],fitinfo_Ks[aKsCand][2]);
470 trackid.push_back(pion1Trk->
trackId());
471 trackid.push_back(pion2Trk->
trackId());
472 }
473 else if ( numchan[i+1]==9){
475 recDTag->
addToFitInfo(aLambdaCand->
mass(),fitinfo_Lambda[aLambdaCand][0],fitinfo_Lambda[aLambdaCand][1],fitinfo_Lambda[aLambdaCand][2]);
476
477 int index[2] = {0, 1};
478 if (aLambdaCand->vertexId() < 0){
479 index[0] = 1;
480 index[1] = 0;
481 }
482
483 EvtRecTrack* protonTrk = aLambdaCand->daughter(index[0]);
484 EvtRecTrack* pionTrk = aLambdaCand->daughter(index[1]);
485 trackid.push_back(protonTrk->
trackId());
486 trackid.push_back(pionTrk->
trackId());
487 }
488 else if (numchan[i+1]==6){
496
497 trackid.push_back(apiontrk->
trackId());
498 trackid.push_back(spiontrk->
trackId());
499 showerid.push_back(hiEnGamma->
trackId());
500 showerid.push_back(loEnGamma->
trackId());
501
502 }
503 else if (numchan[i+1]==7){
508
512
513
514 trackid.push_back(apiontrk->
trackId());
515 trackid.push_back(spiontrk->
trackId());
516 showerid.push_back(gammatrk->
trackId());
517
518 }
519 else if (numchan[i+1]==10){
522 showerid.push_back(gammatrk->
trackId());
523
525 recDTag->
addToFitInfo(aLambdaCand->
mass(),fitinfo_Lambda[aLambdaCand][0],fitinfo_Lambda[aLambdaCand][1],fitinfo_Lambda[aLambdaCand][2]);
526
527 int index[2] = {0, 1};
528 if (aLambdaCand->vertexId() < 0){
529 index[0] = 1;
530 index[1] = 0;
531 }
532
533 EvtRecTrack* protonTrk = aLambdaCand->daughter(index[0]);
534 EvtRecTrack* pionTrk = aLambdaCand->daughter(index[1]);
535 trackid.push_back(protonTrk->
trackId());
536 trackid.push_back(pionTrk->
trackId());
537
538 }
539 else if (numchan[i+1]==11){
544
548
549
550 showerid.push_back(agamtrk->
trackId());
551 showerid.push_back(sgamtrk->
trackId());
552 trackid.push_back(Ptrk->
trackId());
553 }
554 else if (numchan[i+1]==12){
562
563 trackid.push_back(apiontrk->
trackId());
564 trackid.push_back(spiontrk->
trackId());
565 showerid.push_back(hiEnGamma->
trackId());
566 showerid.push_back(loEnGamma->
trackId());
567
568 }
569
570 }
571
572
574 if(m_useBFC){
575
577 }
578 savetrack(trackid,showerid,charged_begin,charged_end,neutral_begin,neutral_end,recDTag);
579 pidtag(kaonid,pionid,protonid, kaonList_tight, pionList_tight, protonList_tight, recDTag);
580
581 if(m_usevertexfit){
582 if(m_debug) cout<<"beforevfit:"<<endl;
583
584 HepLorentzVector p4change_vfit;
585
586 if(m_useVFrefine){
587 p4change_vfit=util.
vfitref(channel, kaonid, pionid, xorigin, charged_begin);
588 }else{
589 p4change_vfit=util.
vfit(channel, kaonid, pionid, xorigin, charged_begin);
590 }
591
592 recDTag->
setp4(recDTag->
p4()+p4change_vfit);
593 }
594
595
596 trackid.clear();
597 showerid.clear();
598 kaonid.clear();
599 pionid.clear();
600 protonid.clear();
601
602
603 recDTagCol->push_back(recDTag);
604
605 }
606
607 numchan.clear();
608
609 }
610
611 return StatusCode::SUCCESS;
612}
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
virtual bool isVertexValid()=0
virtual double * PrimaryVertex()=0
void savetrack(vector< int >, vector< int >, EvtRecTrackIterator, EvtRecTrackIterator, EvtRecTrackIterator, EvtRecTrackIterator, EvtRecDTag *)
void updateKsLambdaInfo(CDDecayList::iterator, double, int, EvtRecDTag *, vector< int >, IVertexDbSvc *, bool)
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