Skip to content

Commit

Permalink
Merge pull request #33826 from alefisico/UL16jetID
Browse files Browse the repository at this point in the history
Including jetId criteria for UL16
  • Loading branch information
cmsbuild authored May 28, 2021
2 parents de34271 + bfb2750 commit 0216383
Show file tree
Hide file tree
Showing 2 changed files with 234 additions and 10 deletions.
4 changes: 4 additions & 0 deletions PhysicsTools/NanoAOD/python/jets_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@
),
src = cms.InputTag("updatedJets")
)
run2_jme_2016.toModify( tightJetId.filterParams, version = "RUN2UL16CHS" )
run2_jme_2016.toModify( tightJetIdLepVeto.filterParams, version = "RUN2UL16CHS" )
for modifier in run2_miniAOD_80XLegacy, run2_nanoAOD_94X2016:
modifier.toModify( tightJetId.filterParams, version = "WINTER16" )
modifier.toModify( tightJetIdLepVeto.filterParams, version = "WINTER16" )
Expand Down Expand Up @@ -101,6 +103,8 @@
),
src = cms.InputTag("updatedJetsAK8")
)
run2_jme_2016.toModify( tightJetIdAK8.filterParams, version = "RUN2UL16PUPPI" )
run2_jme_2016.toModify( tightJetIdLepVetoAK8.filterParams, version = "RUN2UL16PUPPI" )
for modifier in run2_miniAOD_80XLegacy, run2_nanoAOD_94X2016:
modifier.toModify( tightJetIdAK8.filterParams, version = "WINTER16" )
modifier.toModify( tightJetIdLepVetoAK8.filterParams, version = "WINTER16" )
Expand Down
240 changes: 230 additions & 10 deletions PhysicsTools/SelectorUtils/interface/PFJetIDSelectionFunctor.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ class PFJetIDSelectionFunctor : public Selector<pat::Jet> {
WINTER17PUPPI,
SUMMER18,
SUMMER18PUPPI,
RUN2UL16CHS,
RUN2UL16PUPPI,
RUN2ULCHS,
RUN2ULPUPPI,
N_VERSIONS
Expand Down Expand Up @@ -63,6 +65,10 @@ class PFJetIDSelectionFunctor : public Selector<pat::Jet> {
version_ = SUMMER18;
else if (versionStr == "SUMMER18PUPPI")
version_ = SUMMER18PUPPI;
else if (versionStr == "RUN2UL16CHS")
version_ = RUN2UL16CHS;
else if (versionStr == "RUN2UL16PUPPI")
version_ = RUN2UL16PUPPI;
else if (versionStr == "RUN2ULCHS")
version_ = RUN2ULCHS;
else if (versionStr == "RUN2ULPUPPI")
Expand All @@ -87,7 +93,7 @@ class PFJetIDSelectionFunctor : public Selector<pat::Jet> {
if (params.exists("NHF"))
set("NHF", params.getParameter<double>("NHF"));
if ((version_ != WINTER17 && version_ != WINTER17PUPPI && version_ != SUMMER18 && version_ != SUMMER18PUPPI &&
version_ != RUN2ULCHS && version_ != RUN2ULPUPPI) ||
version_ != RUN2UL16CHS && version_ != RUN2UL16PUPPI && version_ != RUN2ULCHS && version_ != RUN2ULPUPPI) ||
quality_ != TIGHT) {
if (params.exists("CEF"))
set("CEF", params.getParameter<double>("CEF"));
Expand Down Expand Up @@ -154,6 +160,48 @@ class PFJetIDSelectionFunctor : public Selector<pat::Jet> {
set("MUF", params.getParameter<double>("MUF"));
}
}
if (version_ == RUN2UL16CHS) {
if (params.exists("NHF_TR"))
set("NHF_TR", params.getParameter<double>("NHF_TR"));
if (params.exists("NEF_TR"))
set("NEF_TR", params.getParameter<double>("NEF_TR"));
if (params.exists("NHF_EC"))
set("NHF_EC", params.getParameter<double>("NHF_EC"));
if (params.exists("NEF_EC_L"))
set("NEF_EC_L", params.getParameter<double>("NEF_EC_L"));
if (params.exists("NEF_EC_U"))
set("NEF_EC_U", params.getParameter<double>("NEF_EC_U"));
if (params.exists("nNeutrals_EC"))
set("nNeutrals_EC", params.getParameter<int>("nNeutrals_EC"));
if (params.exists("NHF_FW"))
set("NHF_FW", params.getParameter<double>("NHF_FW"));
if (params.exists("NEF_FW"))
set("NEF_FW", params.getParameter<double>("NEF_FW"));
if (params.exists("nNeutrals_FW"))
set("nNeutrals_FW", params.getParameter<int>("nNeutrals_FW"));
if (quality_ == TIGHTLEPVETO) {
if (params.exists("MUF"))
set("MUF", params.getParameter<double>("MUF"));
}
}
if (version_ == RUN2UL16PUPPI) {
if (params.exists("NHF_TR"))
set("NHF_TR", params.getParameter<double>("NHF_TR"));
if (params.exists("NEF_TR"))
set("NEF_TR", params.getParameter<double>("NEF_TR"));
if (params.exists("nNeutrals_EC"))
set("nNeutrals_EC", params.getParameter<int>("nNeutrals_EC"));
if (params.exists("NEF_FW"))
set("NEF_FW", params.getParameter<double>("NEF_FW"));
if (params.exists("nNeutrals_FW_L"))
set("nNeutrals_FW_L", params.getParameter<int>("nNeutrals_FW_L"));
if (params.exists("nNeutrals_FW_U"))
set("nNeutrals_FW_U", params.getParameter<int>("nNeutrals_FW_U"));
if (quality_ == TIGHTLEPVETO) {
if (params.exists("MUF"))
set("MUF", params.getParameter<double>("MUF"));
}
}
if ((version_ == SUMMER18) || (version_ == RUN2ULCHS)) {
if (params.exists("NHF_TR"))
set("NHF_TR", params.getParameter<double>("NHF_TR"));
Expand Down Expand Up @@ -223,8 +271,8 @@ class PFJetIDSelectionFunctor : public Selector<pat::Jet> {
//
bool operator()(const pat::Jet &jet, pat::strbitset &ret) override {
if (version_ == FIRSTDATA || version_ == RUNIISTARTUP || version_ == WINTER16 || version_ == WINTER17 ||
version_ == WINTER17PUPPI || version_ == SUMMER18 || version_ == SUMMER18PUPPI || version_ == RUN2ULCHS ||
version_ == RUN2ULPUPPI) {
version_ == WINTER17PUPPI || version_ == SUMMER18 || version_ == SUMMER18PUPPI || version_ == RUN2UL16CHS ||
version_ == RUN2UL16PUPPI || version_ == RUN2ULCHS || version_ == RUN2ULPUPPI) {
if (jet.currentJECLevel() == "Uncorrected" || !jet.jecSetsAvailable())
return firstDataCuts(jet, ret, version_);
else
Expand All @@ -241,8 +289,8 @@ class PFJetIDSelectionFunctor : public Selector<pat::Jet> {
//
bool operator()(const reco::PFJet &jet, pat::strbitset &ret) {
if (version_ == FIRSTDATA || version_ == RUNIISTARTUP || version_ == WINTER16 || version_ == WINTER17 ||
version_ == WINTER17PUPPI || version_ == SUMMER18 || version_ == SUMMER18PUPPI || version_ == RUN2ULCHS ||
version_ == RUN2ULPUPPI) {
version_ == WINTER17PUPPI || version_ == SUMMER18 || version_ == SUMMER18PUPPI || version_ == RUN2UL16CHS ||
version_ == RUN2UL16PUPPI || version_ == RUN2ULCHS || version_ == RUN2ULPUPPI) {
return firstDataCuts(jet, ret, version_);
} else {
return false;
Expand Down Expand Up @@ -391,7 +439,7 @@ class PFJetIDSelectionFunctor : public Selector<pat::Jet> {
if (version_ == SUMMER18 || version_ == SUMMER18PUPPI || version_ == RUN2ULCHS || version_ == RUN2ULPUPPI)
etaB = 2.6;
if ((version_ != WINTER17 && version_ != WINTER17PUPPI && version_ != SUMMER18 && version_ != SUMMER18PUPPI &&
version_ != RUN2ULCHS && version_ != RUN2ULPUPPI) ||
version_ != RUN2UL16CHS && version_ != RUN2UL16PUPPI && version_ != RUN2ULCHS && version_ != RUN2ULPUPPI) ||
quality_ != TIGHT) {
if (ignoreCut(indexCEF_) || (cef < cut(indexCEF_, double()) || std::abs(jet.eta()) > etaB))
passCut(ret, indexCEF_);
Expand Down Expand Up @@ -516,6 +564,88 @@ class PFJetIDSelectionFunctor : public Selector<pat::Jet> {
if (ignoreCut(indexNNeutrals_FW_U_) ||
(nneutrals < cut(indexNNeutrals_FW_U_, int()) || std::abs(jet.eta()) <= 3.0))
passCut(ret, indexNNeutrals_FW_U_);

} else if (version_ == RUN2UL16CHS) {
// Cuts for |eta| <= 2.4 for RUN2UL16CHS scenario
if (ignoreCut(indexNConstituents_) ||
(nconstituents > cut(indexNConstituents_, int()) || std::abs(jet.eta()) > 2.4))
passCut(ret, indexNConstituents_);
if (ignoreCut(indexNEF_) || (nef < cut(indexNEF_, double()) || std::abs(jet.eta()) > 2.4))
passCut(ret, indexNEF_);
if (ignoreCut(indexNHF_) || (nhf < cut(indexNHF_, double()) || std::abs(jet.eta()) > 2.4))
passCut(ret, indexNHF_);
if (quality_ == TIGHTLEPVETO) {
if (ignoreCut(indexMUF_) || (muf < cut(indexMUF_, double()) || std::abs(jet.eta()) > 2.4))
passCut(ret, indexMUF_);
}

// Cuts for 2.4 <= |eta| <= 2.7 for RUN2UL16CHS scenario
if (ignoreCut(indexNHF_TR_) ||
(nhf < cut(indexNHF_TR_, double()) || std::abs(jet.eta()) <= 2.4 || std::abs(jet.eta()) > 2.7))
passCut(ret, indexNHF_TR_);
if (ignoreCut(indexNEF_TR_) ||
(nef < cut(indexNEF_TR_, double()) || std::abs(jet.eta()) <= 2.4 || std::abs(jet.eta()) > 2.7))
passCut(ret, indexNEF_TR_);

// Cuts for 2.7 < |eta| <= 3.0 for RUN2UL16CHS scenario
if (ignoreCut(indexNHF_EC_) ||
(nhf < cut(indexNHF_EC_, double()) || std::abs(jet.eta()) <= 2.7 || std::abs(jet.eta()) > 3.0))
passCut(ret, indexNHF_EC_);
if (ignoreCut(indexNEF_EC_L_) ||
(nef > cut(indexNEF_EC_L_, double()) || std::abs(jet.eta()) <= 2.7 || std::abs(jet.eta()) > 3.0))
passCut(ret, indexNEF_EC_L_);
if (ignoreCut(indexNEF_EC_U_) ||
(nef < cut(indexNEF_EC_U_, double()) || std::abs(jet.eta()) <= 2.7 || std::abs(jet.eta()) > 3.0))
passCut(ret, indexNEF_EC_U_);
if (ignoreCut(indexNNeutrals_EC_) ||
(nneutrals > cut(indexNNeutrals_EC_, int()) || std::abs(jet.eta()) <= 2.7 || std::abs(jet.eta()) > 3.0))
passCut(ret, indexNNeutrals_EC_);

// Cuts for |eta| > 3.0 for RUN2UL16CHS scenario
if (ignoreCut(indexNHF_FW_) || (nhf > cut(indexNHF_FW_, double()) || std::abs(jet.eta()) <= 3.0))
passCut(ret, indexNHF_FW_);
if (ignoreCut(indexNEF_FW_) || (nef < cut(indexNEF_FW_, double()) || std::abs(jet.eta()) <= 3.0))
passCut(ret, indexNEF_FW_);
if (ignoreCut(indexNNeutrals_FW_) || (nneutrals > cut(indexNNeutrals_FW_, int()) || std::abs(jet.eta()) <= 3.0))
passCut(ret, indexNNeutrals_FW_);

} else if (version_ == RUN2UL16PUPPI) {
// Cuts for |eta| <= 2.4 for RUN2UL16PUPPI scenario
if (ignoreCut(indexNConstituents_) ||
(nconstituents > cut(indexNConstituents_, int()) || std::abs(jet.eta()) > 2.4))
passCut(ret, indexNConstituents_);
if (ignoreCut(indexNEF_) || (nef < cut(indexNEF_, double()) || std::abs(jet.eta()) > 2.4))
passCut(ret, indexNEF_);
if (ignoreCut(indexNHF_) || (nhf < cut(indexNHF_, double()) || std::abs(jet.eta()) > 2.4))
passCut(ret, indexNHF_);
if (quality_ == TIGHTLEPVETO) {
if (ignoreCut(indexMUF_) || (muf < cut(indexMUF_, double()) || std::abs(jet.eta()) > 2.4))
passCut(ret, indexMUF_);
}

// Cuts for 2.4 <= |eta| <= 2.7 for RUN2UL16PUPPI scenario
if (ignoreCut(indexNHF_TR_) ||
(nhf < cut(indexNHF_TR_, double()) || std::abs(jet.eta()) <= 2.4 || std::abs(jet.eta()) > 2.7))
passCut(ret, indexNHF_TR_);
if (ignoreCut(indexNEF_TR_) ||
(nef < cut(indexNEF_TR_, double()) || std::abs(jet.eta()) <= 2.4 || std::abs(jet.eta()) > 2.7))
passCut(ret, indexNEF_TR_);

// Cuts for 2.7 < |eta| <= 3.0 for RUN2UL16PUPPI scenario
if (ignoreCut(indexNNeutrals_EC_) ||
(nneutrals > cut(indexNNeutrals_EC_, int()) || std::abs(jet.eta()) <= 2.7 || std::abs(jet.eta()) > 3.0))
passCut(ret, indexNNeutrals_EC_);

// Cuts for |eta| > 3.0 for RUN2UL16PUPPI scenario
if (ignoreCut(indexNEF_FW_) || (nef < cut(indexNEF_FW_, double()) || std::abs(jet.eta()) <= 3.0))
passCut(ret, indexNEF_FW_);
if (ignoreCut(indexNNeutrals_FW_L_) ||
(nneutrals > cut(indexNNeutrals_FW_L_, int()) || std::abs(jet.eta()) <= 3.0))
passCut(ret, indexNNeutrals_FW_L_);
if (ignoreCut(indexNNeutrals_FW_U_) ||
(nneutrals < cut(indexNNeutrals_FW_U_, int()) || std::abs(jet.eta()) <= 3.0))
passCut(ret, indexNNeutrals_FW_U_);

} else if ((version_ == SUMMER18) || (version_ == RUN2ULCHS)) {
// Cuts for |eta| <= 2.6 for SUMMER18 scenario
if (ignoreCut(indexNConstituents_) ||
Expand Down Expand Up @@ -629,7 +759,7 @@ class PFJetIDSelectionFunctor : public Selector<pat::Jet> {
push_back("CHF");
push_back("NHF");
if ((version_ != WINTER17 && version_ != WINTER17PUPPI && version_ != SUMMER18 && version_ != SUMMER18PUPPI &&
version_ != RUN2ULCHS && version_ != RUN2ULPUPPI) ||
version_ != RUN2UL16CHS && version_ != RUN2UL16PUPPI && version_ != RUN2ULCHS && version_ != RUN2ULPUPPI) ||
quality_ != TIGHT)
push_back("CEF");
push_back("NEF");
Expand Down Expand Up @@ -667,6 +797,33 @@ class PFJetIDSelectionFunctor : public Selector<pat::Jet> {
if (quality_ == TIGHTLEPVETO)
push_back("MUF");
}
if (version_ == RUN2UL16CHS) {
push_back("NHF_TR");
push_back("NEF_TR");
push_back("NHF_EC");
push_back("NEF_EC_L");
push_back("NEF_EC_U");
push_back("nNeutrals_EC");
push_back("NEF_FW");
push_back("NHF_FW");
push_back("nNeutrals_FW");

if (quality_ == TIGHTLEPVETO) {
push_back("MUF");
}
}
if (version_ == RUN2UL16PUPPI) {
push_back("NHF_TR");
push_back("NEF_TR");
push_back("nNeutrals_EC");
push_back("NEF_FW");
push_back("nNeutrals_FW_L");
push_back("nNeutrals_FW_U");

if (quality_ == TIGHTLEPVETO) {
push_back("MUF");
}
}
if ((version_ == SUMMER18) || (version_ == RUN2ULCHS)) {
push_back("NHF_TR");
push_back("NEF_TR");
Expand Down Expand Up @@ -701,7 +858,7 @@ class PFJetIDSelectionFunctor : public Selector<pat::Jet> {
}

if ((version_ == WINTER17 || version_ == WINTER17PUPPI || version_ == SUMMER18 || version_ == SUMMER18PUPPI ||
version_ == RUN2ULCHS || version_ == RUN2ULPUPPI) &&
version_ == RUN2UL16CHS || version_ == RUN2UL16PUPPI || version_ == RUN2ULCHS || version_ == RUN2ULPUPPI) &&
quality_ == LOOSE) {
edm::LogWarning("BadJetIDVersion")
<< "The LOOSE operating point is only supported for the WINTER16 JetID version -- defaulting to TIGHT";
Expand Down Expand Up @@ -730,7 +887,7 @@ class PFJetIDSelectionFunctor : public Selector<pat::Jet> {
set("CHF", 0.0);
set("NHF", 0.9);
if (version_ != WINTER17 && version_ != WINTER17PUPPI && version_ != SUMMER18 && version_ != SUMMER18PUPPI &&
version_ != RUN2ULCHS && version_ != RUN2ULPUPPI)
version_ != RUN2UL16CHS && version_ != RUN2UL16PUPPI && version_ != RUN2ULCHS && version_ != RUN2ULPUPPI)
set("CEF", 0.99);
set("NEF", 0.9);
set("NCH", 0);
Expand Down Expand Up @@ -775,6 +932,23 @@ class PFJetIDSelectionFunctor : public Selector<pat::Jet> {
set("NEF_FW", 0.90);
set("nNeutrals_FW_L", 2);
set("nNeutrals_FW_U", 15);
} else if (version_ == RUN2UL16CHS) {
set("NHF_TR", 0.9);
set("NEF_TR", 0.99);
set("NHF_EC", 0.9);
set("NEF_EC_L", 0.);
set("NEF_EC_U", 0.99);
set("nNeutrals_EC", 1);
set("NHF_FW", 0.2);
set("NEF_FW", 0.90);
set("nNeutrals_FW", 10);
} else if (version_ == RUN2UL16PUPPI) {
set("NHF_TR", 0.98);
set("NEF_TR", 0.99);
set("nNeutrals_EC", 1);
set("NEF_FW", 0.90);
set("nNeutrals_FW_L", 2);
set("nNeutrals_FW_U", 999999);
} else if (version_ == RUN2ULCHS) {
set("NHF_TR", 0.9);
set("NEF_TR", 0.99);
Expand Down Expand Up @@ -867,6 +1041,27 @@ class PFJetIDSelectionFunctor : public Selector<pat::Jet> {
set("NEF_FW", 0.90);
set("nNeutrals_FW_L", 2);
set("nNeutrals_FW_U", 15);
} else if (version_ == RUN2UL16CHS) {
set("MUF", 0.8);
set("CEF", 0.8);
set("NHF_TR", 0.9);
set("NEF_TR", 0.99);
set("NHF_EC", 0.9);
set("NEF_EC_L", 0.);
set("NEF_EC_U", 0.99);
set("nNeutrals_EC", 1);
set("NHF_FW", 0.2);
set("NEF_FW", 0.90);
set("nNeutrals_FW", 10);
} else if (version_ == RUN2UL16PUPPI) {
set("MUF", 0.8);
set("CEF", 0.8);
set("NHF_TR", 0.98);
set("NEF_TR", 0.99);
set("nNeutrals_EC", 1);
set("NEF_FW", 0.90);
set("nNeutrals_FW_L", 2);
set("nNeutrals_FW_U", 999999);
} else if (version_ == RUN2ULCHS) {
set("CEF", 0.8);
set("MUF", 0.8);
Expand Down Expand Up @@ -902,7 +1097,7 @@ class PFJetIDSelectionFunctor : public Selector<pat::Jet> {
indexNEF_ = index_type(&bits_, "NEF");
indexNHF_ = index_type(&bits_, "NHF");
if ((version_ != WINTER17 && version_ != WINTER17PUPPI && version_ != SUMMER18 && version_ != SUMMER18PUPPI &&
version_ != RUN2ULCHS && version_ != RUN2ULPUPPI) ||
version_ != RUN2UL16CHS && version_ != RUN2UL16PUPPI && version_ != RUN2ULCHS && version_ != RUN2ULPUPPI) ||
quality_ != TIGHT)
indexCEF_ = index_type(&bits_, "CEF");

Expand Down Expand Up @@ -973,6 +1168,31 @@ class PFJetIDSelectionFunctor : public Selector<pat::Jet> {
indexCEF_TR_ = index_type(&bits_, "CEF_TR");
}
}
if (version_ == RUN2UL16CHS) {
indexNHF_TR_ = index_type(&bits_, "NHF_TR");
indexNEF_TR_ = index_type(&bits_, "NEF_TR");
indexNHF_EC_ = index_type(&bits_, "NHF_EC");
indexNEF_EC_L_ = index_type(&bits_, "NEF_EC_L");
indexNEF_EC_U_ = index_type(&bits_, "NEF_EC_U");
indexNNeutrals_EC_ = index_type(&bits_, "nNeutrals_EC");
indexNHF_FW_ = index_type(&bits_, "NHF_FW");
indexNEF_FW_ = index_type(&bits_, "NEF_FW");
indexNNeutrals_FW_ = index_type(&bits_, "nNeutrals_FW");
if (quality_ == TIGHTLEPVETO) {
indexMUF_ = index_type(&bits_, "MUF");
}
}
if (version_ == RUN2UL16PUPPI) {
indexNHF_TR_ = index_type(&bits_, "NHF_TR");
indexNEF_TR_ = index_type(&bits_, "NEF_TR");
indexNNeutrals_EC_ = index_type(&bits_, "nNeutrals_EC");
indexNEF_FW_ = index_type(&bits_, "NEF_FW");
indexNNeutrals_FW_L_ = index_type(&bits_, "nNeutrals_FW_L");
indexNNeutrals_FW_U_ = index_type(&bits_, "nNeutrals_FW_U");
if (quality_ == TIGHTLEPVETO) {
indexMUF_ = index_type(&bits_, "MUF");
}
}
retInternal_ = getBitTemplate();
}

Expand Down

0 comments on commit 0216383

Please sign in to comment.