Skip to content

Commit

Permalink
Merge pull request #12041 from hardenbr/pizero-fix-rechitDigis76x
Browse files Browse the repository at this point in the history
EcalRechitsDigis fix save behavior to check for end of list 76X
  • Loading branch information
cmsbuild committed Oct 23, 2015
2 parents 9646719 + b0c2b7f commit ba3b4fc
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions HLTrigger/special/src/HLTRechitsToDigis.cc
Expand Up @@ -140,32 +140,39 @@ HLTRechitsToDigis::produce(edm::Event& iEvent, edm::EventSetup const& setup) {
// loop over the collection of rechits and match to digis
EcalRecHitCollection::const_iterator ituneEB;
for (ituneEB = recHitsHandle->begin(); ituneEB != recHitsHandle->end(); ituneEB++) {
EcalRecHit hit = (*ituneEB);
outputEBDigiCollection->push_back( (*digisEB->find(hit.id())).id(), (*digisEB->find(hit.id())).begin() );
EcalRecHit const & hit = (*ituneEB);
EcalDigiCollection::const_iterator digiLookUp = digisEB->find(hit.id());
// protect against a digi not existing
if( digiLookUp == digisEB->end()) continue;
outputEBDigiCollection->push_back( digiLookUp->id(), digiLookUp->begin() );
}


// add the built collection to the event
iEvent.put( outputEBDigiCollection, digisOut_);
break;
}

}
case endcap: {
iEvent.getByToken(digisEEInToken_, digisEEHandle);
const EEDigiCollection* digisEE = digisEEHandle.product();

// loop over the collection of rechits and match to digis
EcalRecHitCollection::const_iterator ituneEE;
for (ituneEE = recHitsHandle->begin(); ituneEE != recHitsHandle->end(); ituneEE++) {
EcalRecHit hit = (*ituneEE);
outputEEDigiCollection->push_back( (*digisEE->find(hit.id())).id(), (*digisEE->find(hit.id())).begin() );
}

EcalRecHit const & hit = (*ituneEE);
EcalDigiCollection::const_iterator digiLookUp = digisEE->find(hit.id());
// protect against a digi not existing for the saved rechit
if(digiLookUp == digisEE->end()) continue;
outputEEDigiCollection->push_back( digiLookUp->id(), digiLookUp->begin() );
} // end loop over endcap rechits

// add the built collection to the event
iEvent.put(outputEEDigiCollection, digisOut_);
break;
}
case invalidRegion: {
break;
}
}
} // end switch statement for the region (barrel, endcap, invalid)
}

// ------------ method called when starting to processes a run ------------
Expand Down

0 comments on commit ba3b4fc

Please sign in to comment.