Skip to content

Commit

Permalink
make a clone of the original jet to preserve reference to the origina…
Browse files Browse the repository at this point in the history
…l object it was derived from
  • Loading branch information
ferencek committed Jul 31, 2016
1 parent 6f0c884 commit 874a937
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions PhysicsTools/PatAlgos/plugins/PATJetUpdater.cc
Expand Up @@ -123,11 +123,11 @@ void PATJetUpdater::produce(edm::Event & iEvent, const edm::EventSetup & iSetup)

for (edm::View<reco::Jet>::const_iterator itJet = jets->begin(); itJet != jets->end(); itJet++) {

// construct the Jet from the ref -> save ref to original object
// clone the input Jet to save ref to the original jet it was derived from
unsigned int idx = itJet - jets->begin();
edm::RefToBase<reco::Jet> jetRef = jets->refAt(idx);
edm::Ptr<reco::Jet> jetPtr = jets->ptrAt(idx);
Jet ajet( edm::RefToBase<Jet>(jetRef.castTo<JetRef>()) );
const Jet * origJet = dynamic_cast<const Jet *>( jetRef.get() );
Jet ajet( *origJet );

if (addJetCorrFactors_) {
// undo previous jet energy corrections
Expand Down

0 comments on commit 874a937

Please sign in to comment.