diff --git a/HGCalAnalysis/plugins/HGCalAnalysis.cc b/HGCalAnalysis/plugins/HGCalAnalysis.cc index f500d8d..d4991f7 100644 --- a/HGCalAnalysis/plugins/HGCalAnalysis.cc +++ b/HGCalAnalysis/plugins/HGCalAnalysis.cc @@ -349,7 +349,7 @@ class HGCalAnalysis : public edm::one::EDAnalyzer simcluster_energy_; std::vector simcluster_simEnergy_; std::vector> simcluster_hits_; - std::vector> simcluster_hits_indices_; + std::vector> simcluster_hits_indices_; std::vector> simcluster_fractions_; std::vector> simcluster_layers_; std::vector> simcluster_wafers_; @@ -1417,7 +1417,7 @@ void HGCalAnalysis::analyze(const edm::Event &iEvent, const edm::EventSetup &iSe const std::vector> hits_and_fractions = it_simClus->hits_and_fractions(); std::vector hits; - std::vector hits_indices; + std::vector hits_indices; std::vector fractions; std::vector layers; std::vector wafers; @@ -1426,9 +1426,10 @@ void HGCalAnalysis::analyze(const edm::Event &iEvent, const edm::EventSetup &iSe hits_and_fractions.begin(); it_haf != hits_and_fractions.end(); ++it_haf) { auto index_iterator = detIdToRecHitIndexMap_.find( it_haf->first); - if(index_iterator == detIdToRecHitIndexMap_.end()) - continue; - hits_indices.push_back(index_iterator->second); + int index_simcluster = -1; + if(index_iterator != detIdToRecHitIndexMap_.end()) + index_simcluster = index_iterator->second; + hits_indices.push_back(index_simcluster); hits.push_back(it_haf->first); fractions.push_back(it_haf->second); layers.push_back(recHitTools_.getLayerWithOffset(it_haf->first));