Skip to content

Commit

Permalink
make runnable on MiniAOD
Browse files Browse the repository at this point in the history
  • Loading branch information
ahinzmann authored and jbrands committed Feb 25, 2016
1 parent 3aace64 commit 7c23237
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions RecoJets/JetProducers/plugins/PileupJetIdProducer.cc
Expand Up @@ -114,14 +114,18 @@ PileupJetIdProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup)
}

// Loop over input jets
bool ispat = true;
for ( unsigned int i=0; i<jets.size(); ++i ) {
// Pick the first algo to compute the input variables
vector<pair<string,PileupJetIdAlgo *> >::iterator algoi = algos_.begin();
PileupJetIdAlgo * ialgo = algoi->second;

const Jet & jet = jets.at(i);
//const pat::Jet * patjet = dynamic_cast<const pat::Jet *>(&jet);
//bool ispat = patjet != 0;
const pat::Jet * patjet = 0;
if(ispat) {
patjet=dynamic_cast<const pat::Jet *>(&jet);
ispat = patjet != 0;
}

// Get jet energy correction
float jec = 0.;
Expand All @@ -135,27 +139,27 @@ PileupJetIdProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup)
if( jecCor_ == 0 ) {
initJetEnergyCorrector( iSetup, iEvent.isRealData() );
}
//if( ispat ) {
// jecCor_->setJetPt(patjet->correctedJet(0).pt());
//} else {
jecCor_->setJetPt(jet.pt());
//}
if( ispat ) {
jecCor_->setJetPt(patjet->correctedJet(0).pt());
} else {
jecCor_->setJetPt(jet.pt());
}
jecCor_->setJetEta(jet.eta());
jecCor_->setJetA(jet.jetArea());
jecCor_->setRho(rho);
jec = jecCor_->getCorrection();
}
// If it was requested AND the input is an uncorrected jet apply the JEC
bool applyJec = applyJec_ && !inputIsCorrected_; //( ! ispat && ! inputIsCorrected_ );
bool applyJec = applyJec_ && ( ispat || !inputIsCorrected_ );
reco::Jet * corrJet = 0;

if( applyJec ) {
float scale = jec;
//if( ispat ) {
// corrJet = new pat::Jet(patjet->correctedJet(0)) ;
//} else {
corrJet = dynamic_cast<reco::Jet *>( jet.clone() );
//}
if( ispat ) {
corrJet = new pat::Jet(patjet->correctedJet(0)) ;
} else {
corrJet = dynamic_cast<reco::Jet *>( jet.clone() );
}
corrJet->scaleEnergy(scale);
}
const reco::Jet * theJet = ( applyJec ? corrJet : &jet );
Expand Down

0 comments on commit 7c23237

Please sign in to comment.