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

[NanoAOD] Add number of B & C hadrons for GenJetAK8 and GenJet #44479

Merged
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions PhysicsTools/NanoAOD/plugins/GenJetFlavourTableProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ void GenJetFlavourTableProducer::produce(edm::Event& iEvent, const edm::EventSet
unsigned int ncand = 0;
std::vector<int16_t> partonFlavour;
std::vector<uint8_t> hadronFlavour;
std::vector<uint8_t> nBHadrons;
std::vector<uint8_t> nCHadrons;

for (const reco::GenJet& jet : jetsProd) {
if (!cut_(jet))
Expand All @@ -73,19 +75,25 @@ void GenJetFlavourTableProducer::produce(edm::Event& iEvent, const edm::EventSet
if (deltaR(jet.p4(), jetFlavourInfoMatching.first->p4()) < deltaR_) {
partonFlavour.push_back(jetFlavourInfoMatching.second.getPartonFlavour());
hadronFlavour.push_back(jetFlavourInfoMatching.second.getHadronFlavour());
nBHadrons.push_back(jetFlavourInfoMatching.second.getbHadrons().size());
nCHadrons.push_back(jetFlavourInfoMatching.second.getcHadrons().size());
matched = true;
break;
}
}
if (!matched) {
partonFlavour.push_back(0);
hadronFlavour.push_back(0);
nBHadrons.push_back(0);
nCHadrons.push_back(0);
}
}

auto tab = std::make_unique<nanoaod::FlatTable>(ncand, name_, false, true);
tab->addColumn<int16_t>("partonFlavour", partonFlavour, "flavour from parton matching");
tab->addColumn<uint8_t>("hadronFlavour", hadronFlavour, "flavour from hadron ghost clustering");
tab->addColumn<uint8_t>("nBHadrons", nBHadrons, "number of b-hadrons");
tab->addColumn<uint8_t>("nCHadrons", nCHadrons, "number of c-hadrons");

iEvent.put(std::move(tab));
}
Expand Down
2 changes: 0 additions & 2 deletions PhysicsTools/NanoAOD/python/jetMC_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,6 @@
name = _fatJetTable.name,
extension = cms.bool(True),
variables = cms.PSet(
nBHadrons = Var("jetFlavourInfo().getbHadrons().size()", "uint8", doc="number of b-hadrons"),
nCHadrons = Var("jetFlavourInfo().getcHadrons().size()", "uint8", doc="number of c-hadrons"),
hadronFlavour = Var("hadronFlavour()", "uint8", doc="flavour from hadron ghost clustering"),
# cut should follow genJetAK8Table.cut
genJetAK8Idx = Var("?genJetFwdRef().backRef().isNonnull() && genJetFwdRef().backRef().pt() > 100.?genJetFwdRef().backRef().key():-1", "int16", doc="index of matched gen AK8 jet"),
Expand Down
6 changes: 4 additions & 2 deletions PhysicsTools/NanoAOD/python/nanoDQM_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,6 @@
Plot1D('muEF', 'muEF', 20, 0, 1, 'muon Energy Fraction'),
Plot1D('neEmEF', 'neEmEF', 20, 0, 1, 'charged Electromagnetic EnergyFraction'),
Plot1D('neHEF', 'neHEF', 20, 0, 1, 'neutral Hadron Energy Fraction'),
Plot1D('nBHadrons', 'nBHadrons', 4, -0.5, 3.5, 'number of b-hadrons'),
Plot1D('nCHadrons', 'nCHadrons', 4, -0.5, 3.5, 'number of c-hadrons'),
Plot1D('particleNetMD_QCD', 'particleNetMD_QCD', 20, 0, 1, 'Mass-decorrelated ParticleNet tagger raw QCD score'),
Plot1D('particleNetMD_Xbb', 'particleNetMD_Xbb', 20, 0, 1, 'Mass-decorrelated ParticleNet tagger raw X->bb score. For X->bb vs QCD tagging, use Xbb/(Xbb+QCD)'),
Plot1D('particleNetMD_Xcc', 'particleNetMD_Xcc', 20, 0, 1, 'Mass-decorrelated ParticleNet tagger raw X->cc score. For X->cc vs QCD tagging, use Xcc/(Xcc+QCD)'),
Expand Down Expand Up @@ -323,6 +321,8 @@
Plot1D('eta', 'eta', 20, -7, 7, 'eta'),
Plot1D('hadronFlavour', 'hadronFlavour', 6, -0.5, 5.5, 'flavour from hadron ghost clustering'),
Plot1D('mass', 'mass', 20, 0, 200, 'mass'),
Plot1D('nBHadrons', 'nBHadrons', 4, -0.5, 3.5, 'number of b-hadrons'),
Plot1D('nCHadrons', 'nCHadrons', 4, -0.5, 3.5, 'number of c-hadrons'),
Plot1D('partonFlavour', 'partonFlavour', 40, -9.5, 30.5, 'flavour from parton matching'),
Plot1D('phi', 'phi', 20, -3.14159, 3.14159, 'phi'),
Plot1D('pt', 'pt', 20, 0, 200, 'pt'),
Expand All @@ -335,6 +335,8 @@
Plot1D('eta', 'eta', 20, -7, 7, 'eta'),
Plot1D('hadronFlavour', 'hadronFlavour', 6, -0.5, 5.5, 'flavour from hadron ghost clustering'),
Plot1D('mass', 'mass', 20, 0, 200, 'mass'),
Plot1D('nBHadrons', 'nBHadrons', 4, -0.5, 3.5, 'number of b-hadrons'),
Plot1D('nCHadrons', 'nCHadrons', 4, -0.5, 3.5, 'number of c-hadrons'),
Plot1D('partonFlavour', 'partonFlavour', 40, -9.5, 30.5, 'flavour from parton matching'),
Plot1D('phi', 'phi', 20, -3.14159, 3.14159, 'phi'),
Plot1D('pt', 'pt', 20, 0, 200, 'pt'),
Expand Down