From 5579f5a0a939e7c7b7392f9a846f013379b5af29 Mon Sep 17 00:00:00 2001 From: Lindsey Gray Date: Mon, 2 Mar 2015 21:12:19 +0100 Subject: [PATCH 1/2] fix index maps --- .../PandoraTranslator/plugins/PandoraCMSPFCandProducer.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/RecoParticleFlow/PandoraTranslator/plugins/PandoraCMSPFCandProducer.cc b/RecoParticleFlow/PandoraTranslator/plugins/PandoraCMSPFCandProducer.cc index 9b552efa2fb3f..0fb35a2af6400 100644 --- a/RecoParticleFlow/PandoraTranslator/plugins/PandoraCMSPFCandProducer.cc +++ b/RecoParticleFlow/PandoraTranslator/plugins/PandoraCMSPFCandProducer.cc @@ -160,6 +160,8 @@ PandoraCMSPFCandProducer::~PandoraCMSPFCandProducer() // ------------ method called for each event ------------ void PandoraCMSPFCandProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { + recHitMap.clear(); + recTrackMap.clear(); if(debugHisto) resetVariables(); @@ -1541,7 +1543,7 @@ void PandoraCMSPFCandProducer::convertPandoraToCMSSW(const edm::Handlebegin()); auto iter = recHitMap.find(firsthit->GetParentCaloHitAddress()); if( iter != recHitMap.end() ) { - temp.setLayer(pfrechits[iter->second].layer()); + temp.setLayer(pfrechits.at(iter->second).layer()); } else { throw cms::Exception("TrackUsedButNotFound") << "Hit used in PandoraPFA was not found in the original input hit list!"; From 37a54e13c341e5d3de783636e7417059468e3532 Mon Sep 17 00:00:00 2001 From: Lindsey Gray Date: Mon, 2 Mar 2015 23:30:30 +0100 Subject: [PATCH 2/2] move .clear() to more sensible locations --- .../PandoraTranslator/plugins/PandoraCMSPFCandProducer.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/RecoParticleFlow/PandoraTranslator/plugins/PandoraCMSPFCandProducer.cc b/RecoParticleFlow/PandoraTranslator/plugins/PandoraCMSPFCandProducer.cc index 0fb35a2af6400..0142c77a4edf3 100644 --- a/RecoParticleFlow/PandoraTranslator/plugins/PandoraCMSPFCandProducer.cc +++ b/RecoParticleFlow/PandoraTranslator/plugins/PandoraCMSPFCandProducer.cc @@ -160,8 +160,6 @@ PandoraCMSPFCandProducer::~PandoraCMSPFCandProducer() // ------------ method called for each event ------------ void PandoraCMSPFCandProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { - recHitMap.clear(); - recTrackMap.clear(); if(debugHisto) resetVariables(); @@ -185,6 +183,9 @@ void PandoraCMSPFCandProducer::produce(edm::Event& iEvent, const edm::EventSetup convertPandoraToCMSSW(tkRefCollection,HGCRecHitHandle,iEvent); PANDORA_THROW_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=,PandoraApi::Reset(*m_pPandora)); + + recHitMap.clear(); + recTrackMap.clear(); } void PandoraCMSPFCandProducer::initPandoraCalibrParameters() @@ -1674,6 +1675,9 @@ void PandoraCMSPFCandProducer::convertPandoraToCMSSW(const edm::Handle