103 {
104 MsgStream log(
msgSvc(), name());
105 log << MSG::INFO << "in execute()" << endreq;
106
107 StatusCode sc;
108
109
110
111
112 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
113 int event= eventHeader->eventNumber();
114
115
116
119 log << MSG::DEBUG << "run and event = " << eventHeader->runNumber()
120 << " " << eventHeader->eventNumber() << endreq;
121 log << MSG::DEBUG <<"ncharg, nneu, tottks = "
122 << recEvent->totalCharged() << " , "
123 << recEvent->totalNeutral() << " , "
124 << recEvent->totalTracks() <<endreq;
125
128
131
132
133 SmartDataPtr<EvtRecPi0Col> recPi0Col(eventSvc(), "/Event/EvtRec/EvtRecPi0Col");
134 if ( ! recPi0Col ) {
135 log << MSG::FATAL << "Could not find EvtRecPi0Col" << endreq;
136 return StatusCode::FAILURE;
137 }
138
139
140 SmartDataPtr<EvtRecEtaToGGCol> recEtaToGGCol(eventSvc(), "/Event/EvtRec/EvtRecEtaToGGCol");
141 if ( ! recEtaToGGCol ) {
142 log << MSG::FATAL << "Could not find EvtRecEtaToGGCol" << endreq;
143 return StatusCode::FAILURE;
144 }
145
146
147 SmartDataPtr<EvtRecVeeVertexCol> recVeeVertexCol(eventSvc(), "/Event/EvtRec/EvtRecVeeVertexCol");
148 if ( ! recVeeVertexCol ) {
149 log << MSG::FATAL << "Could not find EvtRecVeeVertexCol" << endreq;
150 return StatusCode::FAILURE;
151 }
152
153
155 if (!recDTagCol) {
156 log << MSG::FATAL << "EvtRecDTagCol is not registered yet" << endreq;
157 return StatusCode::FAILURE;
158 }
159
160
161
162
163 Hep3Vector xorigin(0,0,0);
164
166 Gaudi::svcLocator()->service("VertexDbSvc", vtxsvc);
168
169
171 xorigin.setX(vertex[0]);
172 xorigin.setY(vertex[1]);
173 xorigin.setZ(vertex[2]);
174 }
175
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
197
199 dc_fill(ksList, recVeeVertexCol->begin(), recVeeVertexCol->end());
200
201
202 map<EvtRecVeeVertex*, vector< double > > fitinfo;
203 for(
CDKsList::iterator ksit = ksList.particle_begin(); ksit != ksList.particle_end(); ++ksit ){
205
206 if(m_useVFrefine){
208 }else{
210 }
211
212 }
213
215 dc_fill(pi0List, recPi0Col->begin(), recPi0Col->end());
216
218 dc_fill(etaList, recEtaToGGCol->begin(), recEtaToGGCol->end());
219
220
225
226
227
228 int run = eventHeader->runNumber();
229 m_ievt = eventHeader->eventNumber();
230 m_nChrg = recEvent->totalCharged();
231 m_nNeu = recEvent->totalNeutral();
232 m_nPion = pionList.size();
233 m_nKaon = kaonList.size();
234 m_nPi0 = pi0List.size();
235 m_nKs = ksList.size();
236
237
238
239
240
241
242
243 if(m_ReadBeamEFromDB && m_irun!=run){
244 m_irun=run;
245 if(m_usecalibBeamE)
247 m_beamE=m_readDb.
getbeamE(m_irun,m_beamE);
248 if(run>0)
250
251 }
252 double ebeam=m_beamE;
253
254
255
256
257
258
259
260 for(int list=0;list<chanlist.size();list++){
261
262 string channel=chanlist[list];
263 vector<int> numchan;
267
268
269
270
271
272 if(channel=="DptoKPiPi") {
274 numchan.push_back(1);
275 numchan.push_back(2);
276 numchan.push_back(2);
277 decaylist=kaonList.minus()* pionList.plus()* pionList.plus();
278 }
279 else if(channel=="DptoKPiPiPi0") {
281 numchan.push_back(1);
282 numchan.push_back(2);
283 numchan.push_back(2);
284 numchan.push_back(3);
285 decaylist=kaonList.minus()* pionList.plus()* pionList.plus()* pi0List;
286 }
287 else if(channel=="DptoKsPi") {
289 numchan.push_back(5);
290 numchan.push_back(2);
291 decaylist=ksList* pionList.plus();
292 }
293 else if(channel=="DptoKsPiPi0") {
295 numchan.push_back(5);
296 numchan.push_back(2);
297 numchan.push_back(3);
298 decaylist=ksList* pionList.plus()* pi0List;
299 }
300 else if(channel=="DptoKsPiPiPi") {
302 numchan.push_back(5);
303 numchan.push_back(2);
304 numchan.push_back(2);
305 numchan.push_back(2);
306 decaylist=ksList* pionList.plus()* pionList.plus()* pionList.minus();
307 }
308 else if(channel=="DptoKKPi") {
310 numchan.push_back(1);
311 numchan.push_back(1);
312 numchan.push_back(2);
313 decaylist=kaonList.minus()* kaonList.plus()* pionList.plus();
314 }
315 else if(channel=="DptoPiPi0") {
317 numchan.push_back(2);
318 numchan.push_back(3);
319 decaylist=pionList.plus()* pi0List;
320 }
321 else if(channel=="DptoKPi0") {
323 numchan.push_back(1);
324 numchan.push_back(3);
325 decaylist=kaonList.plus()* pi0List;
326 }
327 else if(channel=="DptoKsK") {
329 numchan.push_back(5);
330 numchan.push_back(1);
331 decaylist=ksList* kaonList.plus();
332 }
333 else if(channel=="DptoPiPiPi") {
335 numchan.push_back(2);
336 numchan.push_back(2);
337 numchan.push_back(2);
338 decaylist=pionList.plus()* pionList.plus()* pionList.minus() ;
339 }
340 else if(channel=="DptoPiPi0Pi0") {
342 numchan.push_back(2);
343 numchan.push_back(3);
344 numchan.push_back(3);
345 decaylist=pionList.plus()* pi0List* pi0List;
346 }
347 else if(channel=="DptoKsKsPi") {
349 numchan.push_back(5);
350 numchan.push_back(5);
351 numchan.push_back(2);
352 decaylist=ksList* ksList* pionList.plus();
353 }
354 else if(channel=="DptoKsKPi0") {
356 numchan.push_back(5);
357 numchan.push_back(1);
358 numchan.push_back(3);
359 decaylist=ksList* kaonList.plus()* pi0List;
360 }
361 else if(channel=="DptoKsKsK") {
363 numchan.push_back(5);
364 numchan.push_back(5);
365 numchan.push_back(1);
366 decaylist=ksList* ksList* kaonList.plus();
367 }
368 else if(channel=="DptoPiPiPiPi0") {
370 numchan.push_back(2);
371 numchan.push_back(2);
372 numchan.push_back(2);
373 numchan.push_back(3);
374 decaylist=pionList.plus()* pionList.plus()* pionList.minus()* pi0List;
375 }
376 else if(channel=="DptoKsPiPi0Pi0") {
378 numchan.push_back(5);
379 numchan.push_back(2);
380 numchan.push_back(3);
381 numchan.push_back(3);
382 decaylist=ksList* pionList.plus()* pi0List* pi0List;
383 }
384 else if(channel=="DptoKsKplusPiPi") {
386 numchan.push_back(5);
387 numchan.push_back(1);
388 numchan.push_back(2);
389 numchan.push_back(2);
390 decaylist=ksList* kaonList.plus()* pionList.plus()* pionList.minus();
391 }
392 else if(channel=="DptoKsKminusPiPi") {
394 numchan.push_back(5);
395 numchan.push_back(1);
396 numchan.push_back(2);
397 numchan.push_back(2);
398 decaylist=ksList* kaonList.minus()* pionList.plus()* pionList.plus();
399 }
400 else if(channel=="DptoKKPiPi0") {
402 numchan.push_back(1);
403 numchan.push_back(1);
404 numchan.push_back(2);
405 numchan.push_back(3);
406 decaylist=kaonList.minus()* kaonList.plus()* pionList.plus()* pi0List;
407 }
408 else if(channel=="DptoPiPiPiPiPi") {
410 numchan.push_back(2);
411 numchan.push_back(2);
412 numchan.push_back(2);
413 numchan.push_back(2);
414 numchan.push_back(2);
415 decaylist=pionList.plus()* pionList.plus()* pionList.plus()* pionList.minus()* pionList.minus();
416 }
417 else if(channel=="DptoKPiPiPiPi") {
419 numchan.push_back(1);
420 numchan.push_back(2);
421 numchan.push_back(2);
422 numchan.push_back(2);
423 numchan.push_back(2);
424 decaylist=kaonList.minus()* pionList.plus()* pionList.plus()* pionList.plus()* pionList.minus();
425 }
426 else if(channel=="DptoPiEta") {
428 numchan.push_back(2);
429 numchan.push_back(4);
430 decaylist=pionList.plus()* etaList;
431 }
432 else if(channel=="DptoKsPiEta") {
434 numchan.push_back(5);
435 numchan.push_back(2);
436 numchan.push_back(4);
437 decaylist=ksList* pionList.plus()* etaList;
438 }
439
442
444
447
448 vector<int> trackid, showerid;
449 vector<int> kaonid, pionid;
450 int numofchildren=numchan.size()-1;
451
452 for(int i=0; i< numofchildren;i++){
453
454 const CDCandidate& daughter=(*it).particle().child(i);
455
456 if(numchan[i+1]==1){
458 trackid.push_back(track->
trackId());
459 kaonid.push_back(track->
trackId());
460 }
461 else if(numchan[i+1]==2){
463 trackid.push_back(track->
trackId());
464 pionid.push_back(track->
trackId());
465 }
466 else if ( numchan[i+1]==3){
469 showerid.push_back(hiEnGamma->
trackId());
470 showerid.push_back(loEnGamma->
trackId());
471 }
472 else if ( numchan[i+1]==4){
475 showerid.push_back(hiEnGamma->
trackId());
476 showerid.push_back(loEnGamma->
trackId());
477 }
478 else if ( numchan[i+1]==5){
480
481 recDTag->
addToFitInfo(aKsCand->
mass(),fitinfo[aKsCand][0],fitinfo[aKsCand][1],fitinfo[aKsCand][2]);
482
485 trackid.push_back(pion1Trk->
trackId());
486 trackid.push_back(pion2Trk->
trackId());
487 }
488
489 }
490
491
493 savetrack(trackid,showerid,charged_begin,charged_end,neutral_begin,neutral_end,recDTag);
494 pidtag(kaonid,pionid,kaonList_tight, pionList_tight,recDTag);
495
496 if(m_usevertexfit){
497 if(m_debug) cout<<"beforevfit:"<<endl;
498
499 HepLorentzVector p4change_vfit;
500
501 if(m_useVFrefine){
502 p4change_vfit=util.
vfitref(channel, kaonid, pionid, xorigin, charged_begin);
503 }else{
504 p4change_vfit=util.
vfit(channel, kaonid, pionid, xorigin, charged_begin);
505 }
506
507 recDTag->
setp4(recDTag->
p4()+p4change_vfit);
508
509 }
510
511
512 trackid.clear();
513 showerid.clear();
514 kaonid.clear();
515 pionid.clear();
516
517
518 recDTagCol->push_back(recDTag);
519
520 }
521
522 numchan.clear();
523
524 }
525
526 return StatusCode::SUCCESS;
527}
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)
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 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 > 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