Skip to content

Commit

Permalink
Merge pull request #28221 from peruzzim/fixEleCandFSR
Browse files Browse the repository at this point in the history
Fix electron PFCandidates RefVector usage in MuonFSRProducer
  • Loading branch information
cmsbuild committed Oct 22, 2019
2 parents 9186cb0 + 36e9c0c commit 5aafe91
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions MuonAnalysis/MuonAssociators/plugins/MuonFSRProducer.cc
Expand Up @@ -142,17 +142,15 @@ void MuonFSRProducer::produce(edm::StreamID streamID, edm::Event& iEvent, const
pat::PackedCandidateRef pfcandRef = pat::PackedCandidateRef(pfcands, iter_pf - pfcands->begin());

for (auto electrons_iter = electrons->begin(); electrons_iter != electrons->end(); ++electrons_iter) {
for (auto itr = electrons_iter->associatedPackedPFCandidates().begin();
itr != electrons_iter->associatedPackedPFCandidates().end();
++itr) {
if (!itr->isAvailable())
for (auto const& cand : electrons_iter->associatedPackedPFCandidates()) {
if (!cand.isAvailable())
continue;
if (itr->id() != pfcandRef.id())
if (cand.id() != pfcandRef.id())
throw cms::Exception("Configuration")
<< "The electron associatedPackedPFCandidates item does not have "
<< "the same ID of packed candidate collection used for cleaning the electron footprint: " << itr->id()
<< "the same ID of packed candidate collection used for cleaning the electron footprint: " << cand.id()
<< " (" << pfcandRef.id() << ")\n";
if (itr->key() == pfcandRef.key()) {
if (cand.key() == pfcandRef.key()) {
skipPhoton = true;
break;
}
Expand Down

0 comments on commit 5aafe91

Please sign in to comment.