Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GenJetFlavourInfos: fix compiler warning, use prunedGenParticles in associations to correctly match pat jet flavour info #20281

Merged
merged 5 commits into from Sep 1, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 7 additions & 1 deletion PhysicsTools/JetMCAlgos/python/AK4GenJetFlavourInfos_cfi.py
@@ -1,5 +1,11 @@
import FWCore.ParameterSet.Config as cms
from PhysicsTools.JetMCAlgos.AK4PFJetsMCFlavourInfos_cfi import ak4JetFlavourInfos

ak4GenJetFlavourInfos = ak4JetFlavourInfos.clone(jets = "ak4GenJetsNoNu")
ak4GenJetFlavourInfos = ak4JetFlavourInfos.clone(
jets = "ak4GenJetsNoNu",
bHadrons = cms.InputTag("selectedHadronsAndPartonsForGenJetsFlavourInfos","bHadrons"),
cHadrons = cms.InputTag("selectedHadronsAndPartonsForGenJetsFlavourInfos","cHadrons"),
partons = cms.InputTag("selectedHadronsAndPartonsForGenJetsFlavourInfos","physicsPartons"),
leptons = cms.InputTag("selectedHadronsAndPartonsForGenJetsFlavourInfos","leptons"),
)

3 changes: 3 additions & 0 deletions PhysicsTools/JetMCAlgos/python/HadronAndPartonSelector_cfi.py
Expand Up @@ -7,3 +7,6 @@
partonMode = cms.string("Auto"),
fullChainPhysPartons = cms.bool(True)
)
# select hadrons and partons for the slimmedGenJetsFlavourInfos, required for origin identification

selectedHadronsAndPartonsForGenJetsFlavourInfos = selectedHadronsAndPartons.clone(particles = "prunedGenParticles")
11 changes: 6 additions & 5 deletions PhysicsTools/PatAlgos/plugins/GenJetFlavourInfoPreserver.cc
Expand Up @@ -27,9 +27,9 @@ namespace pat {
class GenJetFlavourInfoPreserver : public edm::stream::EDProducer<> {
public:
explicit GenJetFlavourInfoPreserver(const edm::ParameterSet & iConfig);
virtual ~GenJetFlavourInfoPreserver() { }
~GenJetFlavourInfoPreserver() override { }

virtual void produce(edm::Event & iEvent, const edm::EventSetup & iSetup) override;
void produce(edm::Event & iEvent, const edm::EventSetup & iSetup) override;

private:
const edm::EDGetTokenT<edm::View<reco::GenJet> > genJetsToken_;
Expand Down Expand Up @@ -72,12 +72,13 @@ pat::GenJetFlavourInfoPreserver::produce(edm::Event & iEvent, const edm::EventSe

edm::Ref<std::vector<reco::GenJet> > slimmedGenJetRef;

int i = -1;
for (auto const& genJet : *genJets){
i++;

for (unsigned int i=0; i<genJets->size();++i){

slimmedGenJetRef = (*slimmedGenJetAssociation)[genJets->refAt(i)];
if(!slimmedGenJetRef) continue;
(*jetFlavourInfos)[reco::JetBaseRef(slimmedGenJetRef)] = (*genJetFlavourInfos)[i].second;

}

iEvent.put(std::move(jetFlavourInfos));
Expand Down
1 change: 1 addition & 0 deletions PhysicsTools/PatAlgos/python/slimming/miniAOD_tools.py
Expand Up @@ -326,6 +326,7 @@ def miniAOD_customizeMC(process):
#GenJetFlavourInfos
process.load("PhysicsTools.JetMCAlgos.HadronAndPartonSelector_cfi")
task.add(process.selectedHadronsAndPartons)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies for not noticing this earlier but with the updates introduced in this PR, is anything consuming selectedHadronsAndPartons now? If not, this line can be removed.

task.add(process.selectedHadronsAndPartonsForGenJetsFlavourInfos)

process.load("PhysicsTools.JetMCAlgos.AK4GenJetFlavourInfos_cfi")
task.add(process.ak4GenJetFlavourInfos)
Expand Down