249{
250 MsgStream log(
msgSvc(), name());
251
252
253
254 SmartDataPtr<EmcMcHitCol> emcMcHits(eventSvc(),"/Event/MC/EmcMcHitCol");
255 if( emcMcHits )
256 {
257 log << MSG::DEBUG << "EmcMcHitsCol retrieved of size "<< emcMcHits->size() << endreq;
258
259 if (emcMcHits->size() != 0)
261
262 for(EmcMcHitCol::const_iterator it = emcMcHits->begin(); it != emcMcHits->end(); it++)
263 {
264
265 int crystalId = (*it)->identify().get_value();
266 int McParticleID = 0;
267 if(crystalId != 0)
268 {
269 McParticleID = (*it)->getTrackIndex();
270 m_navigator->
getMcEmcMcHitsIdx().insert( pair<int,int>(crystalId, McParticleID));
271
272 }
273
274
275 const map<Identifier,double>& hitmap = (*it)->getHitMap();
276 map<Identifier,double>::const_iterator jt;
277 for (jt=hitmap.begin(); jt!=hitmap.end(); jt++)
278 {
279 int crystalId = (*jt).first.get_value();
280
281 if(McParticleID !=0 )
282 {
283 m_navigator->
getMcEmcMcHitsIdx().insert( pair<int,int>(crystalId, McParticleID));
284 }
285
286 }
287 }
288 }
289 else
290 {
291 log << MSG::DEBUG << "Unable to retrieve EmcMcHitCol" << endreq;
292 }
293
294
295
296 SmartDataPtr<RecEmcShowerCol> emcRecShowers(eventSvc(),"/Event/Recon/RecEmcShowerCol");
297 if( emcRecShowers )
298 {
299 log << MSG::DEBUG << "RecEmcShowerCol retrieved of size "<< emcRecShowers->size() << endreq;
300
302
303 for(RecEmcShowerCol::const_iterator it = emcRecShowers->begin();
304 it != emcRecShowers->end();
305 it++)
306 {
307 int showerId = (*it)->getShowerId().get_value();
309
310
311
312 if(! mchits.empty())
313 {
315 for(RecEmcFractionMap::const_iterator jt = fractionMap.begin();
316 jt != fractionMap.end();
317 jt++)
318 {
319 int crystalId = (*jt).first.get_value();
320 const pair<IndexMap::const_iterator, IndexMap::const_iterator> range = mchits.equal_range(crystalId);
321
322 for(IndexMap::const_iterator kt = range.first; kt != range.second; kt++)
323 {
325 }
326 }
327 }
328 }
329 }
330 else
331 {
332 log << MSG::DEBUG << "Unable to retrieve RecEmcShowerCol" << endreq;
333 }
334
335
336
337 IndexMap::const_iterator i;
339 for(i = index.begin(); i != index.end(); i++)
340 {
341
343
344 if (mcParticle == 0)
345 continue;
346
348
349 if( ! emcShowers.empty() )
350 {
351 RecEmcShowerVector::const_iterator j;
352 for(j=emcShowers.begin(); j!=emcShowers.end(); j++)
353 {
354 m_navigator->
addLink(mcParticle, *j);
355 m_navigator->
addLink(*j, mcParticle);
356 }
357 }
358 }
359}
map< RecEmcID, RecEmcFraction, less< RecEmcID > > RecEmcFractionMap
std::multimap< int, int > IndexMap
std::vector< const RecEmcShower * > RecEmcShowerVector
IndexMap & getMcEmcMcHitsIdx()
void addLink(const Event::McParticle *key, const RecMdcTrack *value)
const Event::McParticle * getMcParticle(int id)
IndexMap & getMcEmcRecShowersIdx()
RecEmcShowerVector getEmcRecShowers(int id)