File indexing completed on 2024-04-06 12:24:09
0001 #ifndef PhysicsTools_SelectorUtils_interface_PFJetIDSelectionFunctor_h
0002 #define PhysicsTools_SelectorUtils_interface_PFJetIDSelectionFunctor_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #ifndef __GCCXML__
0016 #include "FWCore/Framework/interface/ConsumesCollector.h"
0017 #endif
0018 #include "DataFormats/PatCandidates/interface/Jet.h"
0019 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0020
0021 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
0022 #include "FWCore/ParameterSet/interface/allowedValues.h"
0023
0024 #include "PhysicsTools/SelectorUtils/interface/Selector.h"
0025
0026 #include <TMath.h>
0027
0028 class PFJetIDSelectionFunctor : public Selector<pat::Jet> {
0029 public:
0030 enum Version_t {
0031 FIRSTDATA,
0032 RUNIISTARTUP,
0033 WINTER16,
0034 WINTER17,
0035 WINTER17PUPPI,
0036 SUMMER18,
0037 SUMMER18PUPPI,
0038 RUN2UL16CHS,
0039 RUN2UL16PUPPI,
0040 RUN3CHSrunsBCDEprompt,
0041 RUN3PUPPIrunsBCDEprompt,
0042 RUN3CHSruns2022FGruns2023CD,
0043 RUN3PUPPIruns2022FGruns2023CD,
0044 RUN2ULCHS,
0045 RUN2ULPUPPI,
0046 N_VERSIONS
0047 };
0048 enum Quality_t { LOOSE, TIGHT, TIGHTLEPVETO, N_QUALITY };
0049
0050 PFJetIDSelectionFunctor() {}
0051
0052 #ifndef __GCCXML__
0053 PFJetIDSelectionFunctor(edm::ParameterSet const ¶ms, edm::ConsumesCollector &iC)
0054 : PFJetIDSelectionFunctor(params) {}
0055 #endif
0056
0057 PFJetIDSelectionFunctor(edm::ParameterSet const ¶ms) {
0058 std::string versionStr = params.getParameter<std::string>("version");
0059 std::string qualityStr = params.getParameter<std::string>("quality");
0060
0061 if (versionStr == "FIRSTDATA")
0062 version_ = FIRSTDATA;
0063 else if (versionStr == "RUNIISTARTUP")
0064 version_ = RUNIISTARTUP;
0065 else if (versionStr == "WINTER16")
0066 version_ = WINTER16;
0067 else if (versionStr == "WINTER17")
0068 version_ = WINTER17;
0069 else if (versionStr == "WINTER17PUPPI")
0070 version_ = WINTER17PUPPI;
0071 else if (versionStr == "SUMMER18")
0072 version_ = SUMMER18;
0073 else if (versionStr == "SUMMER18PUPPI")
0074 version_ = SUMMER18PUPPI;
0075 else if (versionStr == "RUN2UL16CHS")
0076 version_ = RUN2UL16CHS;
0077 else if (versionStr == "RUN2UL16PUPPI")
0078 version_ = RUN2UL16PUPPI;
0079 else if (versionStr == "RUN2ULCHS")
0080 version_ = RUN2ULCHS;
0081 else if (versionStr == "RUN2ULPUPPI")
0082 version_ = RUN2ULPUPPI;
0083 else if (versionStr == "RUN3CHSrunsBCDEprompt")
0084 version_ = RUN3CHSrunsBCDEprompt;
0085 else if (versionStr == "RUN3PUPPIrunsBCDEprompt")
0086 version_ = RUN3PUPPIrunsBCDEprompt;
0087 else if (versionStr == "RUN3CHSruns2022FGruns2023CD")
0088 version_ = RUN3CHSruns2022FGruns2023CD;
0089 else if (versionStr == "RUN3PUPPIruns2022FGruns2023CD")
0090 version_ = RUN3PUPPIruns2022FGruns2023CD;
0091 else
0092 version_ =
0093 RUN3PUPPIruns2022FGruns2023CD;
0094
0095 if (qualityStr == "LOOSE")
0096 quality_ = LOOSE;
0097 else if (qualityStr == "TIGHT")
0098 quality_ = TIGHT;
0099 else if (qualityStr == "TIGHTLEPVETO")
0100 quality_ = TIGHTLEPVETO;
0101 else
0102 quality_ = TIGHT;
0103
0104 initCuts();
0105
0106
0107 const auto strings_set = this->bits_.strings();
0108 for (auto i = strings_set.begin(); i != strings_set.end(); ++i) {
0109 const std::string &item = *i;
0110 if (params.exists(item)) {
0111 if (params.existsAs<int>(item))
0112 set(item, params.getParameter<int>(item));
0113 else
0114 set(item, params.getParameter<double>(item));
0115 }
0116 }
0117
0118 if (params.exists("cutsToIgnore"))
0119 setIgnoredCuts(params.getParameter<std::vector<std::string>>("cutsToIgnore"));
0120
0121 initIndex();
0122 }
0123
0124 PFJetIDSelectionFunctor(Version_t version, Quality_t quality) : version_(version), quality_(quality) {
0125 initCuts();
0126 initIndex();
0127 }
0128
0129
0130
0131
0132 static edm::ParameterSetDescription getDescription() {
0133 edm::ParameterSetDescription desc;
0134
0135 desc.ifValue(
0136 edm::ParameterDescription<std::string>("version", "RUN3PUPPIruns2022FGruns2023CD", true, edm::Comment("")),
0137 edm::allowedValues<std::string>("FIRSTDATA",
0138 "RUNIISTARTUP",
0139 "WINTER16",
0140 "WINTER17",
0141 "WINTER17PUPPI",
0142 "SUMMER18",
0143 "SUMMER18PUPPI",
0144 "RUN2UL16CHS",
0145 "RUN2UL16PUPPI",
0146 "RUN2ULCHS",
0147 "RUN2ULPUPPI",
0148 "RUN3CHSrunsBCDEprompt",
0149 "RUN3PUPPIrunsBCDEprompt",
0150 "RUN3CHSruns2022FGruns2023CD",
0151 "RUN3PUPPIruns2022FGruns2023CD"));
0152 desc.ifValue(edm::ParameterDescription<std::string>("quality", "TIGHT", true, edm::Comment("")),
0153 edm::allowedValues<std::string>("LOOSE", "TIGHT", "TIGHTLEPVETO"));
0154 desc.addOptional<std::vector<std::string>>("cutsToIgnore")->setComment("");
0155
0156 edm::ParameterDescription<double> CHF("CHF", true, edm::Comment(""));
0157 edm::ParameterDescription<double> NHF("NHF", true, edm::Comment(""));
0158 edm::ParameterDescription<double> NHF_FW("NHF_FW", true, edm::Comment(""));
0159 edm::ParameterDescription<double> NHF_EC("NHF_EC", true, edm::Comment(""));
0160 edm::ParameterDescription<double> NHF_TR("NHF_TR", true, edm::Comment(""));
0161
0162 edm::ParameterDescription<double> CEF("CEF", true, edm::Comment(""));
0163 edm::ParameterDescription<double> CEF_TR("CEF_TR", true, edm::Comment(""));
0164
0165 edm::ParameterDescription<double> NEF("NEF", true, edm::Comment(""));
0166 edm::ParameterDescription<double> NEF_FW("NEF_FW", true, edm::Comment(""));
0167 edm::ParameterDescription<double> NEF_EC_L("NEF_EC_L", true, edm::Comment(""));
0168 edm::ParameterDescription<double> NEF_EC_U("NEF_EC_U", true, edm::Comment(""));
0169 edm::ParameterDescription<double> NEF_TR("NEF_TR", true, edm::Comment(""));
0170
0171 edm::ParameterDescription<int> NCH("NCH", true, edm::Comment(""));
0172
0173 edm::ParameterDescription<double> MUF("MUF", true, edm::Comment(""));
0174 edm::ParameterDescription<double> MUF_TR("MUF_TR", true, edm::Comment(""));
0175
0176 edm::ParameterDescription<int> nConstituents("nConstituents", true, edm::Comment(""));
0177 edm::ParameterDescription<int> nNeutrals_FW("nNeutrals_FW", true, edm::Comment(""));
0178 edm::ParameterDescription<int> nNeutrals_FW_L("nNeutrals_FW_L", true, edm::Comment(""));
0179 edm::ParameterDescription<int> nNeutrals_FW_U("nNeutrals_FW_U", true, edm::Comment(""));
0180 edm::ParameterDescription<int> nnNeutrals_EC("nNeutrals_EC", true, edm::Comment(""));
0181
0182 desc.addOptionalNode(CHF, false);
0183 desc.addOptionalNode(NHF, false);
0184 desc.addOptionalNode(NHF_FW, false);
0185 desc.addOptionalNode(NHF_EC, false);
0186 desc.addOptionalNode(NHF_TR, false);
0187
0188 desc.addOptionalNode(CEF, false);
0189 desc.addOptionalNode(CEF_TR, false);
0190
0191 desc.addOptionalNode(NEF, false);
0192 desc.addOptionalNode(NEF_FW, false);
0193 desc.addOptionalNode(NEF_EC_L, false);
0194 desc.addOptionalNode(NEF_EC_U, false);
0195 desc.addOptionalNode(NEF_TR, false);
0196
0197 desc.addOptionalNode(NCH, false);
0198
0199 desc.addOptionalNode(MUF, false);
0200 desc.addOptionalNode(MUF_TR, false);
0201
0202 desc.addOptionalNode(nConstituents, false);
0203 desc.addOptionalNode(nNeutrals_FW, false);
0204 desc.addOptionalNode(nNeutrals_FW_L, false);
0205 desc.addOptionalNode(nNeutrals_FW_U, false);
0206 desc.addOptionalNode(nnNeutrals_EC, false);
0207
0208 return desc;
0209 }
0210
0211
0212
0213 bool operator()(const pat::Jet &jet, pat::strbitset &ret) override {
0214 if (version_ == FIRSTDATA || version_ == RUNIISTARTUP || version_ == WINTER16 || version_ == WINTER17 ||
0215 version_ == WINTER17PUPPI || version_ == SUMMER18 || version_ == SUMMER18PUPPI || version_ == RUN2UL16CHS ||
0216 version_ == RUN2UL16PUPPI || version_ == RUN3CHSrunsBCDEprompt || version_ == RUN3PUPPIrunsBCDEprompt ||
0217 version_ == RUN3CHSruns2022FGruns2023CD || version_ == RUN3PUPPIruns2022FGruns2023CD || version_ == RUN2ULCHS ||
0218 version_ == RUN2ULPUPPI) {
0219 if (jet.currentJECLevel() == "Uncorrected" || !jet.jecSetsAvailable())
0220 return firstDataCuts(jet, ret, version_);
0221 else
0222 return firstDataCuts(jet.correctedJet("Uncorrected"), ret, version_);
0223 } else {
0224 return false;
0225 }
0226 }
0227 using Selector<pat::Jet>::operator();
0228
0229
0230
0231
0232
0233 bool operator()(const reco::PFJet &jet, pat::strbitset &ret) {
0234 if (version_ == FIRSTDATA || version_ == RUNIISTARTUP || version_ == WINTER16 || version_ == WINTER17 ||
0235 version_ == WINTER17PUPPI || version_ == SUMMER18 || version_ == SUMMER18PUPPI || version_ == RUN2UL16CHS ||
0236 version_ == RUN2UL16PUPPI || version_ == RUN3CHSrunsBCDEprompt || version_ == RUN3PUPPIrunsBCDEprompt ||
0237 version_ == RUN3CHSruns2022FGruns2023CD || version_ == RUN3PUPPIruns2022FGruns2023CD || version_ == RUN2ULCHS ||
0238 version_ == RUN2ULPUPPI) {
0239 return firstDataCuts(jet, ret, version_);
0240 } else {
0241 return false;
0242 }
0243 }
0244
0245 bool operator()(const reco::PFJet &jet) {
0246 retInternal_.set(false);
0247 operator()(jet, retInternal_);
0248 setIgnored(retInternal_);
0249 return (bool)retInternal_;
0250 }
0251
0252
0253
0254
0255 bool firstDataCuts(reco::Jet const &jet, pat::strbitset &ret, Version_t version_) {
0256 ret.set(false);
0257
0258
0259 double chf = 0.0;
0260 double nhf = 0.0;
0261 double cef = 0.0;
0262 double nef = 0.0;
0263 double muf = 0.0;
0264
0265 int nch = 0;
0266 int nconstituents = 0;
0267 int nneutrals = 0;
0268
0269
0270 reco::PFJet const *pfJet = dynamic_cast<reco::PFJet const *>(&jet);
0271 pat::Jet const *patJet = dynamic_cast<pat::Jet const *>(&jet);
0272 reco::BasicJet const *basicJet = dynamic_cast<reco::BasicJet const *>(&jet);
0273
0274 if (patJet != nullptr) {
0275 if (patJet->isPFJet()) {
0276 chf = patJet->chargedHadronEnergyFraction();
0277 nhf = patJet->neutralHadronEnergyFraction();
0278 cef = patJet->chargedEmEnergyFraction();
0279 nef = patJet->neutralEmEnergyFraction();
0280 nch = patJet->chargedMultiplicity();
0281 muf = patJet->muonEnergyFraction();
0282 nconstituents = patJet->neutralMultiplicity() + patJet->chargedMultiplicity();
0283 nneutrals = patJet->neutralMultiplicity();
0284 }
0285
0286
0287 else if (patJet->isBasicJet()) {
0288 double e_chf = 0.0;
0289 double e_nhf = 0.0;
0290 double e_cef = 0.0;
0291 double e_nef = 0.0;
0292 double e_muf = 0.0;
0293 nch = 0;
0294 nconstituents = 0;
0295 nneutrals = 0;
0296
0297 for (reco::Jet::const_iterator ibegin = patJet->begin(), iend = patJet->end(), isub = ibegin; isub != iend;
0298 ++isub) {
0299 reco::PFJet const *pfsub = dynamic_cast<reco::PFJet const *>(&*isub);
0300 pat::Jet const *patsub = dynamic_cast<pat::Jet const *>(&*isub);
0301 if (patsub) {
0302 e_chf += patsub->chargedHadronEnergy();
0303 e_nhf += patsub->neutralHadronEnergy();
0304 e_cef += patsub->chargedEmEnergy();
0305 e_nef += patsub->neutralEmEnergy();
0306 e_muf += patsub->muonEnergy();
0307 nch += patsub->chargedMultiplicity();
0308 nconstituents += patsub->neutralMultiplicity() + patsub->chargedMultiplicity();
0309 nneutrals += patsub->neutralMultiplicity();
0310 } else if (pfsub) {
0311 e_chf += pfsub->chargedHadronEnergy();
0312 e_nhf += pfsub->neutralHadronEnergy();
0313 e_cef += pfsub->chargedEmEnergy();
0314 e_nef += pfsub->neutralEmEnergy();
0315 e_muf += pfsub->muonEnergy();
0316 nch += pfsub->chargedMultiplicity();
0317 nconstituents += pfsub->neutralMultiplicity() + pfsub->chargedMultiplicity();
0318 nneutrals += pfsub->neutralMultiplicity();
0319 } else
0320 assert(0);
0321 }
0322 double e = patJet->energy();
0323 if (e > 0.000001) {
0324 chf = e_chf / e;
0325 nhf = e_nhf / e;
0326 cef = e_cef / e;
0327 nef = e_nef / e;
0328 muf = e_muf / e;
0329 } else {
0330 chf = nhf = cef = nef = muf = 0.0;
0331 }
0332 }
0333 }
0334 else if (pfJet != nullptr) {
0335
0336 double jetEnergyUncorrected = pfJet->chargedHadronEnergy() + pfJet->neutralHadronEnergy() +
0337 pfJet->photonEnergy() + pfJet->electronEnergy() + pfJet->muonEnergy() +
0338 pfJet->HFEMEnergy();
0339 if (jetEnergyUncorrected > 0.) {
0340 chf = pfJet->chargedHadronEnergy() / jetEnergyUncorrected;
0341 nhf = pfJet->neutralHadronEnergy() / jetEnergyUncorrected;
0342 cef = pfJet->chargedEmEnergy() / jetEnergyUncorrected;
0343 nef = pfJet->neutralEmEnergy() / jetEnergyUncorrected;
0344 muf = pfJet->muonEnergy() / jetEnergyUncorrected;
0345 }
0346 nch = pfJet->chargedMultiplicity();
0347 nconstituents = pfJet->neutralMultiplicity() + pfJet->chargedMultiplicity();
0348 nneutrals = pfJet->neutralMultiplicity();
0349 }
0350
0351
0352 else if (basicJet != nullptr) {
0353 double e_chf = 0.0;
0354 double e_nhf = 0.0;
0355 double e_cef = 0.0;
0356 double e_nef = 0.0;
0357 double e_muf = 0.0;
0358 nch = 0;
0359 nconstituents = 0;
0360 for (reco::Jet::const_iterator ibegin = basicJet->begin(), iend = basicJet->end(), isub = ibegin; isub != iend;
0361 ++isub) {
0362 reco::PFJet const *pfsub = dynamic_cast<reco::PFJet const *>(&*isub);
0363 e_chf += pfsub->chargedHadronEnergy();
0364 e_nhf += pfsub->neutralHadronEnergy();
0365 e_cef += pfsub->chargedEmEnergy();
0366 e_nef += pfsub->neutralEmEnergy();
0367 e_muf += pfsub->muonEnergy();
0368 nch += pfsub->chargedMultiplicity();
0369 nconstituents += pfsub->neutralMultiplicity() + pfsub->chargedMultiplicity();
0370 nneutrals += pfsub->neutralMultiplicity();
0371 }
0372 double e = basicJet->energy();
0373 if (e > 0.000001) {
0374 chf = e_chf / e;
0375 nhf = e_nhf / e;
0376 cef = e_cef / e;
0377 nef = e_nef / e;
0378 muf = e_muf / e;
0379 }
0380 }
0381
0382 float etaB = 2.4;
0383
0384 if (version_ == SUMMER18 || version_ == SUMMER18PUPPI || version_ == RUN2ULCHS || version_ == RUN2ULPUPPI ||
0385 version_ == RUN3CHSrunsBCDEprompt || version_ == RUN3PUPPIrunsBCDEprompt ||
0386 version_ == RUN3CHSruns2022FGruns2023CD || version_ == RUN3PUPPIruns2022FGruns2023CD)
0387 etaB = 2.6;
0388 if ((version_ != WINTER17 && version_ != WINTER17PUPPI && version_ != SUMMER18 && version_ != SUMMER18PUPPI &&
0389 version_ != RUN2UL16CHS && version_ != RUN2UL16PUPPI && version_ != RUN3CHSrunsBCDEprompt &&
0390 version_ != RUN3PUPPIrunsBCDEprompt && version_ != RUN3CHSruns2022FGruns2023CD &&
0391 version_ != RUN3PUPPIruns2022FGruns2023CD && version_ != RUN2ULCHS && version_ != RUN2ULPUPPI) ||
0392 quality_ != TIGHT) {
0393 if (ignoreCut(indexCEF_) || (cef < cut(indexCEF_, double()) || std::abs(jet.eta()) > etaB))
0394 passCut(ret, indexCEF_);
0395 }
0396 if (ignoreCut(indexCHF_) || (chf > cut(indexCHF_, double()) || std::abs(jet.eta()) > etaB))
0397 passCut(ret, indexCHF_);
0398 if (ignoreCut(indexNCH_) || (nch > cut(indexNCH_, int()) || std::abs(jet.eta()) > etaB))
0399 passCut(ret, indexNCH_);
0400 if (version_ == FIRSTDATA) {
0401 if (ignoreCut(indexNConstituents_) || (nconstituents > cut(indexNConstituents_, int())))
0402 passCut(ret, indexNConstituents_);
0403 if (ignoreCut(indexNEF_) || (nef < cut(indexNEF_, double())))
0404 passCut(ret, indexNEF_);
0405 if (ignoreCut(indexNHF_) || (nhf < cut(indexNHF_, double())))
0406 passCut(ret, indexNHF_);
0407 } else if (version_ == RUNIISTARTUP) {
0408
0409 if (ignoreCut(indexNConstituents_) ||
0410 (nconstituents > cut(indexNConstituents_, int()) || std::abs(jet.eta()) > 3.0))
0411 passCut(ret, indexNConstituents_);
0412 if (ignoreCut(indexNEF_) || (nef < cut(indexNEF_, double()) || std::abs(jet.eta()) > 3.0))
0413 passCut(ret, indexNEF_);
0414 if (ignoreCut(indexNHF_) || (nhf < cut(indexNHF_, double()) || std::abs(jet.eta()) > 3.0))
0415 passCut(ret, indexNHF_);
0416
0417 if (ignoreCut(indexNEF_FW_) || (nef < cut(indexNEF_FW_, double()) || std::abs(jet.eta()) <= 3.0))
0418 passCut(ret, indexNEF_FW_);
0419 if (ignoreCut(indexNNeutrals_FW_) || (nneutrals > cut(indexNNeutrals_FW_, int()) || std::abs(jet.eta()) <= 3.0))
0420 passCut(ret, indexNNeutrals_FW_);
0421 } else if (version_ == WINTER16) {
0422
0423 if (ignoreCut(indexNConstituents_) ||
0424 (nconstituents > cut(indexNConstituents_, int()) || std::abs(jet.eta()) > 2.7))
0425 passCut(ret, indexNConstituents_);
0426 if (ignoreCut(indexNEF_) || (nef < cut(indexNEF_, double()) || std::abs(jet.eta()) > 2.7))
0427 passCut(ret, indexNEF_);
0428 if (ignoreCut(indexNHF_) || (nhf < cut(indexNHF_, double()) || std::abs(jet.eta()) > 2.7))
0429 passCut(ret, indexNHF_);
0430 if (quality_ == TIGHTLEPVETO) {
0431 if (ignoreCut(indexMUF_) || (muf < cut(indexMUF_, double()) || std::abs(jet.eta()) > 2.7))
0432 passCut(ret, indexMUF_);
0433 }
0434
0435
0436 if (ignoreCut(indexNHF_EC_) ||
0437 (nhf < cut(indexNHF_EC_, double()) || std::abs(jet.eta()) <= 2.7 || std::abs(jet.eta()) > 3.0))
0438 passCut(ret, indexNHF_EC_);
0439 if (ignoreCut(indexNEF_EC_) ||
0440 (nef > cut(indexNEF_EC_, double()) || std::abs(jet.eta()) <= 2.7 || std::abs(jet.eta()) > 3.0))
0441 passCut(ret, indexNEF_EC_);
0442 if (ignoreCut(indexNNeutrals_EC_) ||
0443 (nneutrals > cut(indexNNeutrals_EC_, int()) || std::abs(jet.eta()) <= 2.7 || std::abs(jet.eta()) > 3.0))
0444 passCut(ret, indexNNeutrals_EC_);
0445
0446
0447 if (ignoreCut(indexNEF_FW_) || (nef < cut(indexNEF_FW_, double()) || std::abs(jet.eta()) <= 3.0))
0448 passCut(ret, indexNEF_FW_);
0449 if (ignoreCut(indexNNeutrals_FW_) || (nneutrals > cut(indexNNeutrals_FW_, int()) || std::abs(jet.eta()) <= 3.0))
0450 passCut(ret, indexNNeutrals_FW_);
0451 } else if (version_ == WINTER17) {
0452
0453 if (ignoreCut(indexNConstituents_) ||
0454 (nconstituents > cut(indexNConstituents_, int()) || std::abs(jet.eta()) > 2.7))
0455 passCut(ret, indexNConstituents_);
0456 if (ignoreCut(indexNEF_) || (nef < cut(indexNEF_, double()) || std::abs(jet.eta()) > 2.7))
0457 passCut(ret, indexNEF_);
0458 if (ignoreCut(indexNHF_) || (nhf < cut(indexNHF_, double()) || std::abs(jet.eta()) > 2.7))
0459 passCut(ret, indexNHF_);
0460 if (quality_ == TIGHTLEPVETO) {
0461 if (ignoreCut(indexMUF_) || (muf < cut(indexMUF_, double()) || std::abs(jet.eta()) > 2.7))
0462 passCut(ret, indexMUF_);
0463 }
0464
0465
0466
0467 if (ignoreCut(indexNEF_EC_L_) ||
0468 (nef > cut(indexNEF_EC_L_, double()) || std::abs(jet.eta()) <= 2.7 || std::abs(jet.eta()) > 3.0))
0469 passCut(ret, indexNEF_EC_L_);
0470 if (ignoreCut(indexNEF_EC_U_) ||
0471 (nef < cut(indexNEF_EC_U_, double()) || std::abs(jet.eta()) <= 2.7 || std::abs(jet.eta()) > 3.0))
0472 passCut(ret, indexNEF_EC_U_);
0473 if (ignoreCut(indexNNeutrals_EC_) ||
0474 (nneutrals > cut(indexNNeutrals_EC_, int()) || std::abs(jet.eta()) <= 2.7 || std::abs(jet.eta()) > 3.0))
0475 passCut(ret, indexNNeutrals_EC_);
0476
0477
0478 if (ignoreCut(indexNHF_FW_) || (nhf > cut(indexNHF_FW_, double()) || std::abs(jet.eta()) <= 3.0))
0479 passCut(ret, indexNHF_FW_);
0480 if (ignoreCut(indexNEF_FW_) || (nef < cut(indexNEF_FW_, double()) || std::abs(jet.eta()) <= 3.0))
0481 passCut(ret, indexNEF_FW_);
0482 if (ignoreCut(indexNNeutrals_FW_) || (nneutrals > cut(indexNNeutrals_FW_, int()) || std::abs(jet.eta()) <= 3.0))
0483 passCut(ret, indexNNeutrals_FW_);
0484
0485 } else if (version_ == WINTER17PUPPI) {
0486
0487 if (ignoreCut(indexNConstituents_) ||
0488 (nconstituents > cut(indexNConstituents_, int()) || std::abs(jet.eta()) > 2.7))
0489 passCut(ret, indexNConstituents_);
0490 if (ignoreCut(indexNEF_) || (nef < cut(indexNEF_, double()) || std::abs(jet.eta()) > 2.7))
0491 passCut(ret, indexNEF_);
0492 if (ignoreCut(indexNHF_) || (nhf < cut(indexNHF_, double()) || std::abs(jet.eta()) > 2.7))
0493 passCut(ret, indexNHF_);
0494 if (quality_ == TIGHTLEPVETO) {
0495 if (ignoreCut(indexMUF_) || (muf < cut(indexMUF_, double()) || std::abs(jet.eta()) > 2.7))
0496 passCut(ret, indexMUF_);
0497 }
0498
0499
0500
0501 if (ignoreCut(indexNHF_EC_) ||
0502 (nhf < cut(indexNHF_EC_, double()) || std::abs(jet.eta()) <= 2.7 || std::abs(jet.eta()) > 3.0))
0503 passCut(ret, indexNHF_EC_);
0504
0505
0506 if (ignoreCut(indexNHF_FW_) || (nhf > cut(indexNHF_FW_, double()) || std::abs(jet.eta()) <= 3.0))
0507 passCut(ret, indexNHF_FW_);
0508 if (ignoreCut(indexNEF_FW_) || (nef < cut(indexNEF_FW_, double()) || std::abs(jet.eta()) <= 3.0))
0509 passCut(ret, indexNEF_FW_);
0510 if (ignoreCut(indexNNeutrals_FW_L_) ||
0511 (nneutrals > cut(indexNNeutrals_FW_L_, int()) || std::abs(jet.eta()) <= 3.0))
0512 passCut(ret, indexNNeutrals_FW_L_);
0513 if (ignoreCut(indexNNeutrals_FW_U_) ||
0514 (nneutrals < cut(indexNNeutrals_FW_U_, int()) || std::abs(jet.eta()) <= 3.0))
0515 passCut(ret, indexNNeutrals_FW_U_);
0516
0517 } else if (version_ == RUN2UL16CHS) {
0518
0519 if (ignoreCut(indexNConstituents_) ||
0520 (nconstituents > cut(indexNConstituents_, int()) || std::abs(jet.eta()) > 2.4))
0521 passCut(ret, indexNConstituents_);
0522 if (ignoreCut(indexNEF_) || (nef < cut(indexNEF_, double()) || std::abs(jet.eta()) > 2.4))
0523 passCut(ret, indexNEF_);
0524 if (ignoreCut(indexNHF_) || (nhf < cut(indexNHF_, double()) || std::abs(jet.eta()) > 2.4))
0525 passCut(ret, indexNHF_);
0526 if (quality_ == TIGHTLEPVETO) {
0527 if (ignoreCut(indexMUF_) || (muf < cut(indexMUF_, double()) || std::abs(jet.eta()) > 2.4))
0528 passCut(ret, indexMUF_);
0529 }
0530
0531
0532 if (ignoreCut(indexNHF_TR_) ||
0533 (nhf < cut(indexNHF_TR_, double()) || std::abs(jet.eta()) <= 2.4 || std::abs(jet.eta()) > 2.7))
0534 passCut(ret, indexNHF_TR_);
0535 if (ignoreCut(indexNEF_TR_) ||
0536 (nef < cut(indexNEF_TR_, double()) || std::abs(jet.eta()) <= 2.4 || std::abs(jet.eta()) > 2.7))
0537 passCut(ret, indexNEF_TR_);
0538
0539
0540 if (ignoreCut(indexNHF_EC_) ||
0541 (nhf < cut(indexNHF_EC_, double()) || std::abs(jet.eta()) <= 2.7 || std::abs(jet.eta()) > 3.0))
0542 passCut(ret, indexNHF_EC_);
0543 if (ignoreCut(indexNEF_EC_L_) ||
0544 (nef > cut(indexNEF_EC_L_, double()) || std::abs(jet.eta()) <= 2.7 || std::abs(jet.eta()) > 3.0))
0545 passCut(ret, indexNEF_EC_L_);
0546 if (ignoreCut(indexNEF_EC_U_) ||
0547 (nef < cut(indexNEF_EC_U_, double()) || std::abs(jet.eta()) <= 2.7 || std::abs(jet.eta()) > 3.0))
0548 passCut(ret, indexNEF_EC_U_);
0549 if (ignoreCut(indexNNeutrals_EC_) ||
0550 (nneutrals > cut(indexNNeutrals_EC_, int()) || std::abs(jet.eta()) <= 2.7 || std::abs(jet.eta()) > 3.0))
0551 passCut(ret, indexNNeutrals_EC_);
0552
0553
0554 if (ignoreCut(indexNHF_FW_) || (nhf > cut(indexNHF_FW_, double()) || std::abs(jet.eta()) <= 3.0))
0555 passCut(ret, indexNHF_FW_);
0556 if (ignoreCut(indexNEF_FW_) || (nef < cut(indexNEF_FW_, double()) || std::abs(jet.eta()) <= 3.0))
0557 passCut(ret, indexNEF_FW_);
0558 if (ignoreCut(indexNNeutrals_FW_) || (nneutrals > cut(indexNNeutrals_FW_, int()) || std::abs(jet.eta()) <= 3.0))
0559 passCut(ret, indexNNeutrals_FW_);
0560
0561 } else if (version_ == RUN2UL16PUPPI) {
0562
0563 if (ignoreCut(indexNConstituents_) ||
0564 (nconstituents > cut(indexNConstituents_, int()) || std::abs(jet.eta()) > 2.4))
0565 passCut(ret, indexNConstituents_);
0566 if (ignoreCut(indexNEF_) || (nef < cut(indexNEF_, double()) || std::abs(jet.eta()) > 2.4))
0567 passCut(ret, indexNEF_);
0568 if (ignoreCut(indexNHF_) || (nhf < cut(indexNHF_, double()) || std::abs(jet.eta()) > 2.4))
0569 passCut(ret, indexNHF_);
0570 if (quality_ == TIGHTLEPVETO) {
0571 if (ignoreCut(indexMUF_) || (muf < cut(indexMUF_, double()) || std::abs(jet.eta()) > 2.4))
0572 passCut(ret, indexMUF_);
0573 }
0574
0575
0576 if (ignoreCut(indexNHF_TR_) ||
0577 (nhf < cut(indexNHF_TR_, double()) || std::abs(jet.eta()) <= 2.4 || std::abs(jet.eta()) > 2.7))
0578 passCut(ret, indexNHF_TR_);
0579 if (ignoreCut(indexNEF_TR_) ||
0580 (nef < cut(indexNEF_TR_, double()) || std::abs(jet.eta()) <= 2.4 || std::abs(jet.eta()) > 2.7))
0581 passCut(ret, indexNEF_TR_);
0582
0583
0584 if (ignoreCut(indexNNeutrals_EC_) ||
0585 (nneutrals > cut(indexNNeutrals_EC_, int()) || std::abs(jet.eta()) <= 2.7 || std::abs(jet.eta()) > 3.0))
0586 passCut(ret, indexNNeutrals_EC_);
0587
0588
0589 if (ignoreCut(indexNEF_FW_) || (nef < cut(indexNEF_FW_, double()) || std::abs(jet.eta()) <= 3.0))
0590 passCut(ret, indexNEF_FW_);
0591 if (ignoreCut(indexNNeutrals_FW_L_) ||
0592 (nneutrals > cut(indexNNeutrals_FW_L_, int()) || std::abs(jet.eta()) <= 3.0))
0593 passCut(ret, indexNNeutrals_FW_L_);
0594 if (ignoreCut(indexNNeutrals_FW_U_) ||
0595 (nneutrals < cut(indexNNeutrals_FW_U_, int()) || std::abs(jet.eta()) <= 3.0))
0596 passCut(ret, indexNNeutrals_FW_U_);
0597
0598 } else if ((version_ == SUMMER18) || (version_ == RUN2ULCHS) || (version_ == RUN3CHSrunsBCDEprompt) ||
0599 (version_ == RUN3CHSruns2022FGruns2023CD)) {
0600
0601 if (ignoreCut(indexNConstituents_) ||
0602 (nconstituents > cut(indexNConstituents_, int()) || std::abs(jet.eta()) > 2.6))
0603 passCut(ret, indexNConstituents_);
0604 if (ignoreCut(indexNEF_) || (nef < cut(indexNEF_, double()) || std::abs(jet.eta()) > 2.6))
0605 passCut(ret, indexNEF_);
0606 if (ignoreCut(indexNHF_) || (nhf < cut(indexNHF_, double()) || std::abs(jet.eta()) > 2.6))
0607 passCut(ret, indexNHF_);
0608 if (quality_ == TIGHTLEPVETO) {
0609 if (ignoreCut(indexMUF_) || (muf < cut(indexMUF_, double()) || std::abs(jet.eta()) > 2.6))
0610 passCut(ret, indexMUF_);
0611 if (ignoreCut(indexCEF_) || (cef < cut(indexCEF_, double()) || std::abs(jet.eta()) > 2.6))
0612 passCut(ret, indexCEF_);
0613 }
0614
0615
0616 if (ignoreCut(indexNHF_TR_) ||
0617 (nhf < cut(indexNHF_TR_, double()) || std::abs(jet.eta()) <= 2.6 || std::abs(jet.eta()) > 2.7))
0618 passCut(ret, indexNHF_TR_);
0619 if (ignoreCut(indexNEF_TR_) ||
0620 (nef < cut(indexNEF_TR_, double()) || std::abs(jet.eta()) <= 2.6 || std::abs(jet.eta()) > 2.7))
0621 passCut(ret, indexNEF_TR_);
0622 if (ignoreCut(indexNCH_TR_) ||
0623 (nch > cut(indexNCH_TR_, double()) || std::abs(jet.eta()) <= 2.6 || std::abs(jet.eta()) > 2.7))
0624 passCut(ret, indexNCH_TR_);
0625 if (quality_ == TIGHTLEPVETO) {
0626 if (ignoreCut(indexMUF_TR_) ||
0627 (muf < cut(indexMUF_TR_, double()) || std::abs(jet.eta()) <= 2.6 || std::abs(jet.eta()) > 2.7))
0628 passCut(ret, indexMUF_TR_);
0629 if (ignoreCut(indexCEF_TR_) ||
0630 (cef < cut(indexCEF_TR_, double()) || std::abs(jet.eta()) <= 2.6 || std::abs(jet.eta()) > 2.7))
0631 passCut(ret, indexCEF_TR_);
0632 }
0633
0634
0635 if (ignoreCut(indexNEF_EC_L_) ||
0636 (nef > cut(indexNEF_EC_L_, double()) || std::abs(jet.eta()) <= 2.7 || std::abs(jet.eta()) > 3.0))
0637 passCut(ret, indexNEF_EC_L_);
0638 if (ignoreCut(indexNEF_EC_U_) ||
0639 (nef < cut(indexNEF_EC_U_, double()) || std::abs(jet.eta()) <= 2.7 || std::abs(jet.eta()) > 3.0))
0640 passCut(ret, indexNEF_EC_U_);
0641 if (ignoreCut(indexNNeutrals_EC_) ||
0642 (nneutrals > cut(indexNNeutrals_EC_, int()) || std::abs(jet.eta()) <= 2.7 || std::abs(jet.eta()) > 3.0))
0643 passCut(ret, indexNNeutrals_EC_);
0644
0645
0646 if (ignoreCut(indexNHF_FW_) || (nhf > cut(indexNHF_FW_, double()) || std::abs(jet.eta()) <= 3.0))
0647 passCut(ret, indexNHF_FW_);
0648 if (ignoreCut(indexNEF_FW_) || (nef < cut(indexNEF_FW_, double()) || std::abs(jet.eta()) <= 3.0))
0649 passCut(ret, indexNEF_FW_);
0650 if (ignoreCut(indexNNeutrals_FW_) || (nneutrals > cut(indexNNeutrals_FW_, int()) || std::abs(jet.eta()) <= 3.0))
0651 passCut(ret, indexNNeutrals_FW_);
0652 }
0653
0654 else if ((version_ == SUMMER18PUPPI) || (version_ == RUN2ULPUPPI) || (version_ == RUN3PUPPIrunsBCDEprompt) ||
0655 (version_ == RUN3PUPPIruns2022FGruns2023CD)) {
0656
0657 if (ignoreCut(indexNConstituents_) ||
0658 (nconstituents > cut(indexNConstituents_, int()) || std::abs(jet.eta()) > 2.6))
0659 passCut(ret, indexNConstituents_);
0660 if (ignoreCut(indexNEF_) || (nef < cut(indexNEF_, double()) || std::abs(jet.eta()) > 2.6))
0661 passCut(ret, indexNEF_);
0662 if (ignoreCut(indexNHF_) || (nhf < cut(indexNHF_, double()) || std::abs(jet.eta()) > 2.6))
0663 passCut(ret, indexNHF_);
0664 if (quality_ == TIGHTLEPVETO) {
0665 if (ignoreCut(indexMUF_) || (muf < cut(indexMUF_, double()) || std::abs(jet.eta()) > 2.6))
0666 passCut(ret, indexMUF_);
0667 if (ignoreCut(indexCEF_) || (cef < cut(indexCEF_, double()) || std::abs(jet.eta()) > 2.6))
0668 passCut(ret, indexCEF_);
0669 }
0670
0671
0672 if (ignoreCut(indexNHF_TR_) ||
0673 (nhf < cut(indexNHF_TR_, double()) || std::abs(jet.eta()) <= 2.6 || std::abs(jet.eta()) > 2.7))
0674 passCut(ret, indexNHF_TR_);
0675 if (ignoreCut(indexNEF_TR_) ||
0676 (nef < cut(indexNEF_TR_, double()) || std::abs(jet.eta()) <= 2.6 || std::abs(jet.eta()) > 2.7))
0677 passCut(ret, indexNEF_TR_);
0678 if (quality_ == TIGHTLEPVETO) {
0679 if (ignoreCut(indexMUF_TR_) ||
0680 (muf < cut(indexMUF_TR_, double()) || std::abs(jet.eta()) <= 2.6 || std::abs(jet.eta()) > 2.7))
0681 passCut(ret, indexMUF_TR_);
0682 if (ignoreCut(indexCEF_TR_) ||
0683 (cef < cut(indexCEF_TR_, double()) || std::abs(jet.eta()) <= 2.6 || std::abs(jet.eta()) > 2.7))
0684 passCut(ret, indexCEF_TR_);
0685 }
0686
0687
0688 if (ignoreCut(indexNHF_EC_) ||
0689 (nhf < cut(indexNHF_EC_, double()) || std::abs(jet.eta()) <= 2.7 || std::abs(jet.eta()) > 3.0))
0690 passCut(ret, indexNHF_EC_);
0691
0692
0693 if (ignoreCut(indexNHF_FW_) || (nhf > cut(indexNHF_FW_, double()) || std::abs(jet.eta()) <= 3.0))
0694 passCut(ret, indexNHF_FW_);
0695 if (ignoreCut(indexNEF_FW_) || (nef < cut(indexNEF_FW_, double()) || std::abs(jet.eta()) <= 3.0))
0696 passCut(ret, indexNEF_FW_);
0697 if (ignoreCut(indexNNeutrals_FW_L_) ||
0698 (nneutrals > cut(indexNNeutrals_FW_L_, int()) || std::abs(jet.eta()) <= 3.0))
0699 passCut(ret, indexNNeutrals_FW_L_);
0700 if (ignoreCut(indexNNeutrals_FW_U_) ||
0701 (nneutrals < cut(indexNNeutrals_FW_U_, int()) || std::abs(jet.eta()) <= 3.0))
0702 passCut(ret, indexNNeutrals_FW_U_);
0703 }
0704
0705
0706
0707
0708 setIgnored(ret);
0709 return (bool)ret;
0710 }
0711
0712 private:
0713 void initCuts() {
0714 push_back("CHF");
0715 push_back("NHF");
0716 if ((version_ != WINTER17 && version_ != WINTER17PUPPI && version_ != SUMMER18 && version_ != SUMMER18PUPPI &&
0717 version_ != RUN2UL16CHS && version_ != RUN2UL16PUPPI && version_ != RUN2ULCHS && version_ != RUN2ULPUPPI &&
0718 version_ != RUN3CHSrunsBCDEprompt && version_ != RUN3PUPPIrunsBCDEprompt &&
0719 version_ != RUN3CHSruns2022FGruns2023CD && version_ != RUN3PUPPIruns2022FGruns2023CD) ||
0720 quality_ != TIGHT)
0721 push_back("CEF");
0722 push_back("NEF");
0723 push_back("NCH");
0724 push_back("nConstituents");
0725 if (version_ == RUNIISTARTUP) {
0726 push_back("NEF_FW");
0727 push_back("nNeutrals_FW");
0728 }
0729 if (version_ == WINTER16) {
0730 push_back("NHF_EC");
0731 push_back("NEF_EC");
0732 push_back("nNeutrals_EC");
0733 push_back("NEF_FW");
0734 push_back("nNeutrals_FW");
0735 if (quality_ == TIGHTLEPVETO)
0736 push_back("MUF");
0737 }
0738 if (version_ == WINTER17) {
0739 push_back("NEF_EC_L");
0740 push_back("NEF_EC_U");
0741 push_back("nNeutrals_EC");
0742 push_back("NEF_FW");
0743 push_back("NHF_FW");
0744 push_back("nNeutrals_FW");
0745 if (quality_ == TIGHTLEPVETO)
0746 push_back("MUF");
0747 }
0748 if (version_ == WINTER17PUPPI) {
0749 push_back("NHF_EC");
0750 push_back("NEF_FW");
0751 push_back("NHF_FW");
0752 push_back("nNeutrals_FW_L");
0753 push_back("nNeutrals_FW_U");
0754 if (quality_ == TIGHTLEPVETO)
0755 push_back("MUF");
0756 }
0757 if (version_ == RUN2UL16CHS) {
0758 push_back("NHF_TR");
0759 push_back("NEF_TR");
0760 push_back("NHF_EC");
0761 push_back("NEF_EC_L");
0762 push_back("NEF_EC_U");
0763 push_back("nNeutrals_EC");
0764 push_back("NEF_FW");
0765 push_back("NHF_FW");
0766 push_back("nNeutrals_FW");
0767
0768 if (quality_ == TIGHTLEPVETO) {
0769 push_back("MUF");
0770 }
0771 }
0772 if (version_ == RUN2UL16PUPPI) {
0773 push_back("NHF_TR");
0774 push_back("NEF_TR");
0775 push_back("nNeutrals_EC");
0776 push_back("NEF_FW");
0777 push_back("nNeutrals_FW_L");
0778 push_back("nNeutrals_FW_U");
0779
0780 if (quality_ == TIGHTLEPVETO) {
0781 push_back("MUF");
0782 }
0783 }
0784 if ((version_ == SUMMER18) || (version_ == RUN2ULCHS)) {
0785 push_back("NHF_TR");
0786 push_back("NEF_TR");
0787 push_back("NCH_TR");
0788 push_back("NEF_EC_L");
0789 push_back("NEF_EC_U");
0790 push_back("nNeutrals_EC");
0791 push_back("NEF_FW");
0792 push_back("NHF_FW");
0793 push_back("nNeutrals_FW");
0794
0795 if (quality_ == TIGHTLEPVETO) {
0796 push_back("MUF");
0797 push_back("MUF_TR");
0798 push_back("CEF_TR");
0799 }
0800 }
0801 if (version_ == RUN3CHSrunsBCDEprompt) {
0802 push_back("NHF_TR");
0803 push_back("NEF_TR");
0804 push_back("NCH_TR");
0805 push_back("NEF_EC_U");
0806 push_back("nNeutrals_EC");
0807 push_back("NEF_FW");
0808 push_back("NHF_FW");
0809 push_back("nNeutrals_FW");
0810
0811 if (quality_ == TIGHTLEPVETO) {
0812 push_back("CEF");
0813 push_back("MUF");
0814 push_back("MUF_TR");
0815 push_back("CEF_TR");
0816 }
0817 }
0818 if (version_ == RUN3CHSruns2022FGruns2023CD) {
0819 push_back("NHF_TR");
0820 push_back("NEF_TR");
0821 push_back("NCH_TR");
0822 push_back("NHF_EC");
0823 push_back("NEF_EC_U");
0824 push_back("nNeutrals_EC");
0825 push_back("NEF_FW");
0826 push_back("nNeutrals_FW");
0827
0828 if (quality_ == TIGHTLEPVETO) {
0829 push_back("CEF");
0830 push_back("MUF");
0831 push_back("MUF_TR");
0832 push_back("CEF_TR");
0833 }
0834 }
0835 if ((version_ == SUMMER18PUPPI) || (version_ == RUN2ULPUPPI)) {
0836 push_back("NHF_TR");
0837 push_back("NEF_TR");
0838 push_back("NHF_EC");
0839 push_back("NEF_FW");
0840 push_back("NHF_FW");
0841 push_back("nNeutrals_FW_L");
0842 push_back("nNeutrals_FW_U");
0843
0844 if (quality_ == TIGHTLEPVETO) {
0845 push_back("MUF");
0846 push_back("MUF_TR");
0847 push_back("CEF_TR");
0848 }
0849 }
0850 if ((version_ == RUN3PUPPIrunsBCDEprompt) || (version_ == RUN3PUPPIruns2022FGruns2023CD)) {
0851 push_back("NHF_TR");
0852 push_back("NEF_TR");
0853 push_back("NHF_EC");
0854 push_back("NEF_FW");
0855 push_back("nNeutrals_FW_L");
0856
0857 if (quality_ == TIGHTLEPVETO) {
0858 push_back("CEF");
0859 push_back("MUF");
0860 push_back("MUF_TR");
0861 push_back("CEF_TR");
0862 }
0863 }
0864 if ((version_ == WINTER17 || version_ == WINTER17PUPPI || version_ == SUMMER18 || version_ == SUMMER18PUPPI ||
0865 version_ == RUN2UL16CHS || version_ == RUN2UL16PUPPI || version_ == RUN2ULCHS || version_ == RUN2ULPUPPI ||
0866 version_ == RUN3CHSrunsBCDEprompt || version_ == RUN3PUPPIrunsBCDEprompt ||
0867 version_ == RUN3CHSruns2022FGruns2023CD || version_ == RUN3PUPPIruns2022FGruns2023CD) &&
0868 quality_ == LOOSE) {
0869 edm::LogWarning("BadJetIDVersion")
0870 << "The LOOSE operating point is only supported for the WINTER16 JetID version -- defaulting to TIGHT";
0871 quality_ = TIGHT;
0872 }
0873
0874
0875 if (quality_ == LOOSE) {
0876 set("CHF", 0.0);
0877 set("NHF", 0.99);
0878 set("CEF", 0.99);
0879 set("NEF", 0.99);
0880 set("NCH", 0);
0881 set("nConstituents", 1);
0882 if (version_ == RUNIISTARTUP) {
0883 set("NEF_FW", 0.90);
0884 set("nNeutrals_FW", 10);
0885 } else if (version_ == WINTER16) {
0886 set("NHF_EC", 0.98);
0887 set("NEF_EC", 0.01);
0888 set("nNeutrals_EC", 2);
0889 set("NEF_FW", 0.90);
0890 set("nNeutrals_FW", 10);
0891 }
0892 } else if (quality_ == TIGHT) {
0893 set("CHF", 0.0);
0894 set("NHF", 0.9);
0895 if (version_ != WINTER17 && version_ != WINTER17PUPPI && version_ != SUMMER18 && version_ != SUMMER18PUPPI &&
0896 version_ != RUN2UL16CHS && version_ != RUN2UL16PUPPI && version_ != RUN2ULCHS && version_ != RUN2ULPUPPI &&
0897 version_ != RUN3CHSrunsBCDEprompt && version_ != RUN3PUPPIrunsBCDEprompt &&
0898 version_ != RUN3CHSruns2022FGruns2023CD && version_ != RUN3PUPPIruns2022FGruns2023CD)
0899 set("CEF", 0.99);
0900 if (version_ == RUN3CHSrunsBCDEprompt || version_ == RUN3PUPPIrunsBCDEprompt ||
0901 version_ == RUN3CHSruns2022FGruns2023CD || version_ == RUN3PUPPIruns2022FGruns2023CD)
0902 set("CHF", 0.01);
0903 if (version_ == RUN3CHSruns2022FGruns2023CD || version_ == RUN3PUPPIruns2022FGruns2023CD)
0904 set("NHF", 0.99);
0905 set("NEF", 0.9);
0906 set("NCH", 0);
0907 set("nConstituents", 1);
0908 if (version_ == RUNIISTARTUP) {
0909 set("NEF_FW", 0.90);
0910 set("nNeutrals_FW", 10);
0911 } else if (version_ == WINTER16) {
0912 set("NHF_EC", 0.98);
0913 set("NEF_EC", 0.01);
0914 set("nNeutrals_EC", 2);
0915 set("NEF_FW", 0.90);
0916 set("nNeutrals_FW", 10);
0917 } else if (version_ == WINTER17) {
0918 set("NEF_EC_L", 0.02);
0919 set("NEF_EC_U", 0.99);
0920 set("nNeutrals_EC", 2);
0921 set("NHF_FW", 0.02);
0922 set("NEF_FW", 0.90);
0923 set("nNeutrals_FW", 10);
0924 } else if (version_ == WINTER17PUPPI) {
0925 set("NHF_EC", 0.99);
0926 set("NHF_FW", 0.02);
0927 set("NEF_FW", 0.90);
0928 set("nNeutrals_FW_L", 2);
0929 set("nNeutrals_FW_U", 15);
0930 } else if (version_ == SUMMER18) {
0931 set("NHF_TR", 0.9);
0932 set("NEF_TR", 0.99);
0933 set("NCH_TR", 0);
0934 set("NEF_EC_L", 0.02);
0935 set("NEF_EC_U", 0.99);
0936 set("nNeutrals_EC", 2);
0937 set("NHF_FW", 0.2);
0938 set("NEF_FW", 0.90);
0939 set("nNeutrals_FW", 10);
0940 } else if (version_ == SUMMER18PUPPI) {
0941 set("NHF_TR", 0.9);
0942 set("NEF_TR", 0.99);
0943 set("NHF_EC", 0.99);
0944 set("NHF_FW", 0.02);
0945 set("NEF_FW", 0.90);
0946 set("nNeutrals_FW_L", 2);
0947 set("nNeutrals_FW_U", 15);
0948 } else if (version_ == RUN2UL16CHS) {
0949 set("NHF_TR", 0.9);
0950 set("NEF_TR", 0.99);
0951 set("NHF_EC", 0.9);
0952 set("NEF_EC_L", 0.);
0953 set("NEF_EC_U", 0.99);
0954 set("nNeutrals_EC", 1);
0955 set("NHF_FW", 0.2);
0956 set("NEF_FW", 0.90);
0957 set("nNeutrals_FW", 10);
0958 } else if (version_ == RUN2UL16PUPPI) {
0959 set("NHF_TR", 0.98);
0960 set("NEF_TR", 0.99);
0961 set("nNeutrals_EC", 1);
0962 set("NEF_FW", 0.90);
0963 set("nNeutrals_FW_L", 2);
0964 set("nNeutrals_FW_U", 999999);
0965 } else if (version_ == RUN2ULCHS) {
0966 set("NHF_TR", 0.9);
0967 set("NEF_TR", 0.99);
0968 set("NCH_TR", 0);
0969 set("NEF_EC_L", 0.01);
0970 set("NEF_EC_U", 0.99);
0971 set("nNeutrals_EC", 1);
0972 set("NHF_FW", 0.2);
0973 set("NEF_FW", 0.90);
0974 set("nNeutrals_FW", 10);
0975 } else if (version_ == RUN3CHSrunsBCDEprompt) {
0976 set("NHF_TR", 0.9);
0977 set("NEF_TR", 0.99);
0978 set("NCH_TR", 0);
0979 set("NEF_EC_U", 0.99);
0980 set("nNeutrals_EC", 1);
0981 set("NHF_FW", 0.2);
0982 set("NEF_FW", 0.90);
0983 set("nNeutrals_FW", 10);
0984 } else if (version_ == RUN3CHSruns2022FGruns2023CD) {
0985 set("NHF_TR", 0.9);
0986 set("NEF_TR", 0.99);
0987 set("NCH_TR", 0);
0988 set("NEF_EC_U", 0.99);
0989 set("NHF_EC", 0.99);
0990 set("nNeutrals_EC", 1);
0991 set("NEF_FW", 0.4);
0992 set("nNeutrals_FW", 10);
0993 } else if (version_ == RUN2ULPUPPI) {
0994 set("NHF_TR", 0.9);
0995 set("NEF_TR", 0.99);
0996 set("NHF_EC", 0.99);
0997 set("NHF_FW", -1.0);
0998 set("NEF_FW", 0.4);
0999 set("nNeutrals_FW_L", 2);
1000 set("nNeutrals_FW_U", 999999);
1001 } else if (version_ == RUN3PUPPIrunsBCDEprompt) {
1002 set("NHF_TR", 0.9);
1003 set("NEF_TR", 0.99);
1004 set("NHF_EC", 0.9999);
1005 set("NEF_FW", 0.90);
1006 set("nNeutrals_FW_L", 2);
1007 } else if (version_ == RUN3PUPPIruns2022FGruns2023CD) {
1008 set("NHF_TR", 0.9);
1009 set("NEF_TR", 0.99);
1010 set("NHF_EC", 0.99);
1011 set("NEF_FW", 0.4);
1012 set("nNeutrals_FW_L", 1);
1013 }
1014 } else if (quality_ == TIGHTLEPVETO) {
1015 set("CHF", 0.0);
1016 set("NHF", 0.9);
1017 set("CEF", 0.8);
1018 set("NEF", 0.9);
1019 set("NCH", 0);
1020 set("nConstituents", 1);
1021 set("MUF", 0.8);
1022 if (version_ == WINTER17) {
1023 set("NEF_EC_L", 0.02);
1024 set("NEF_EC_U", 0.99);
1025 set("nNeutrals_EC", 2);
1026 set("NHF_FW", 0.02);
1027 set("NEF_FW", 0.90);
1028 set("nNeutrals_FW", 10);
1029 }
1030 if (version_ == RUN3CHSrunsBCDEprompt || version_ == RUN3PUPPIrunsBCDEprompt ||
1031 version_ == RUN3CHSruns2022FGruns2023CD || version_ == RUN3PUPPIruns2022FGruns2023CD) {
1032 set("CHF", 0.01);
1033 } else if (version_ == RUN3CHSruns2022FGruns2023CD || version_ == RUN3PUPPIruns2022FGruns2023CD) {
1034 set("NHF", 0.99);
1035 } else if (version_ == WINTER17PUPPI) {
1036 set("NHF_EC", 0.99);
1037 set("NHF_FW", 0.02);
1038 set("NEF_FW", 0.90);
1039 set("nNeutrals_FW_L", 2);
1040 set("nNeutrals_FW_U", 15);
1041 } else if (version_ == WINTER16) {
1042 set("CEF", 0.9);
1043 set("NEF_EC", 0.01);
1044 set("NHF_EC", 0.98);
1045 set("nNeutrals_EC", 2);
1046 set("nNeutrals_FW", 10);
1047 set("NEF_FW", 0.90);
1048 } else if (version_ == WINTER17PUPPI) {
1049 set("NHF_EC", 0.99);
1050 set("NHF_FW", 0.02);
1051 set("NEF_FW", 0.90);
1052 set("nNeutrals_FW_L", 2);
1053 set("nNeutrals_FW_U", 15);
1054 } else if (version_ == WINTER16) {
1055 set("CEF", 0.9);
1056 set("NEF_EC", 0.01);
1057 set("NHF_EC", 0.98);
1058 set("nNeutrals_EC", 2);
1059 set("nNeutrals_FW", 10);
1060 set("NEF_FW", 0.90);
1061 } else if (version_ == SUMMER18) {
1062 set("NHF_TR", 0.9);
1063 set("NEF_TR", 0.99);
1064 set("MUF_TR", 0.8);
1065 set("NCH_TR", 0);
1066 set("CEF_TR", 0.8);
1067 set("NEF_EC_L", 0.02);
1068 set("NEF_EC_U", 0.99);
1069 set("nNeutrals_EC", 2);
1070 set("NHF_FW", 0.2);
1071 set("NEF_FW", 0.90);
1072 set("nNeutrals_FW", 10);
1073 } else if (version_ == SUMMER18PUPPI) {
1074 set("NHF_TR", 0.9);
1075 set("NEF_TR", 0.99);
1076 set("MUF_TR", 0.8);
1077 set("CEF_TR", 0.8);
1078 set("NHF_EC", 0.99);
1079 set("NHF_FW", 0.02);
1080 set("NEF_FW", 0.90);
1081 set("nNeutrals_FW_L", 2);
1082 set("nNeutrals_FW_U", 15);
1083 } else if (version_ == RUN2UL16CHS) {
1084 set("NHF_TR", 0.9);
1085 set("NEF_TR", 0.99);
1086 set("NHF_EC", 0.9);
1087 set("NEF_EC_L", 0.);
1088 set("NEF_EC_U", 0.99);
1089 set("nNeutrals_EC", 1);
1090 set("NHF_FW", 0.2);
1091 set("NEF_FW", 0.90);
1092 set("nNeutrals_FW", 10);
1093 } else if (version_ == RUN2UL16PUPPI) {
1094 set("NHF_TR", 0.98);
1095 set("NEF_TR", 0.99);
1096 set("nNeutrals_EC", 1);
1097 set("NEF_FW", 0.90);
1098 set("nNeutrals_FW_L", 2);
1099 set("nNeutrals_FW_U", 999999);
1100 } else if (version_ == RUN2ULCHS) {
1101 set("NHF_TR", 0.9);
1102 set("NEF_TR", 0.99);
1103 set("MUF_TR", 0.8);
1104 set("NCH_TR", 0);
1105 set("CEF_TR", 0.8);
1106 set("NEF_EC_L", 0.01);
1107 set("NEF_EC_U", 0.99);
1108 set("nNeutrals_EC", 1);
1109 set("NHF_FW", 0.2);
1110 set("NEF_FW", 0.90);
1111 set("nNeutrals_FW", 10);
1112 } else if (version_ == RUN3CHSrunsBCDEprompt) {
1113 set("MUF_TR", 0.8);
1114 set("CEF_TR", 0.8);
1115 set("NHF_TR", 0.9);
1116 set("NEF_TR", 0.99);
1117 set("NCH_TR", 0);
1118 set("NEF_EC_U", 0.99);
1119 set("nNeutrals_EC", 1);
1120 set("NHF_FW", 0.2);
1121 set("NEF_FW", 0.90);
1122 set("nNeutrals_FW", 10);
1123 } else if (version_ == RUN3CHSruns2022FGruns2023CD) {
1124 set("MUF_TR", 0.8);
1125 set("CEF_TR", 0.8);
1126 set("NHF_TR", 0.9);
1127 set("NEF_TR", 0.99);
1128 set("NCH_TR", 0);
1129 set("NEF_EC_U", 0.99);
1130 set("NHF_EC", 0.99);
1131 set("nNeutrals_EC", 1);
1132 set("NEF_FW", 0.4);
1133 set("nNeutrals_FW", 10);
1134 } else if (version_ == RUN2ULPUPPI) {
1135 set("NHF_TR", 0.9);
1136 set("NEF_TR", 0.99);
1137 set("MUF_TR", 0.8);
1138 set("CEF_TR", 0.8);
1139 set("NHF_EC", 0.9999);
1140 set("NHF_FW", -1.0);
1141 set("NEF_FW", 0.90);
1142 set("nNeutrals_FW_L", 2);
1143 set("nNeutrals_FW_U", 999999);
1144 } else if (version_ == RUN3PUPPIrunsBCDEprompt) {
1145 set("MUF_TR", 0.8);
1146 set("CEF_TR", 0.8);
1147 set("NHF_TR", 0.9);
1148 set("NEF_TR", 0.99);
1149 set("NHF_EC", 0.9999);
1150 set("NEF_FW", 0.90);
1151 set("nNeutrals_FW_L", 2);
1152 } else if (version_ == RUN3PUPPIruns2022FGruns2023CD) {
1153 set("MUF_TR", 0.8);
1154 set("CEF_TR", 0.8);
1155 set("NHF_TR", 0.9);
1156 set("NEF_TR", 0.99);
1157 set("NHF_EC", 0.99);
1158 set("NEF_FW", 0.4);
1159 set("nNeutrals_FW_L", 1);
1160 }
1161 }
1162 }
1163
1164 void initIndex() {
1165 indexNConstituents_ = index_type(&bits_, "nConstituents");
1166 indexNEF_ = index_type(&bits_, "NEF");
1167 indexNHF_ = index_type(&bits_, "NHF");
1168 if ((version_ != WINTER17 && version_ != WINTER17PUPPI && version_ != SUMMER18 && version_ != SUMMER18PUPPI &&
1169 version_ != RUN2UL16CHS && version_ != RUN2UL16PUPPI && version_ != RUN2ULCHS && version_ != RUN2ULPUPPI &&
1170 version_ != RUN3CHSrunsBCDEprompt && version_ != RUN3PUPPIrunsBCDEprompt &&
1171 version_ != RUN3CHSruns2022FGruns2023CD && version_ != RUN3PUPPIruns2022FGruns2023CD) ||
1172 quality_ != TIGHT)
1173 indexCEF_ = index_type(&bits_, "CEF");
1174
1175 indexCHF_ = index_type(&bits_, "CHF");
1176 indexNCH_ = index_type(&bits_, "NCH");
1177 if (version_ == RUNIISTARTUP) {
1178 indexNEF_FW_ = index_type(&bits_, "NEF_FW");
1179 indexNNeutrals_FW_ = index_type(&bits_, "nNeutrals_FW");
1180 }
1181 if (version_ == WINTER16) {
1182 indexNHF_EC_ = index_type(&bits_, "NHF_EC");
1183 indexNEF_EC_ = index_type(&bits_, "NEF_EC");
1184 indexNNeutrals_EC_ = index_type(&bits_, "nNeutrals_EC");
1185 indexNEF_FW_ = index_type(&bits_, "NEF_FW");
1186 indexNNeutrals_FW_ = index_type(&bits_, "nNeutrals_FW");
1187 if (quality_ == TIGHTLEPVETO) {
1188 indexMUF_ = index_type(&bits_, "MUF");
1189 }
1190 }
1191 if (version_ == WINTER17) {
1192 indexNEF_EC_L_ = index_type(&bits_, "NEF_EC_L");
1193 indexNEF_EC_U_ = index_type(&bits_, "NEF_EC_U");
1194 indexNNeutrals_EC_ = index_type(&bits_, "nNeutrals_EC");
1195 indexNHF_FW_ = index_type(&bits_, "NHF_FW");
1196 indexNEF_FW_ = index_type(&bits_, "NEF_FW");
1197 indexNNeutrals_FW_ = index_type(&bits_, "nNeutrals_FW");
1198 if (quality_ == TIGHTLEPVETO) {
1199 indexMUF_ = index_type(&bits_, "MUF");
1200 }
1201 }
1202 if (version_ == WINTER17PUPPI) {
1203 indexNHF_EC_ = index_type(&bits_, "NHF_EC");
1204 indexNHF_FW_ = index_type(&bits_, "NHF_FW");
1205 indexNEF_FW_ = index_type(&bits_, "NEF_FW");
1206 indexNNeutrals_FW_L_ = index_type(&bits_, "nNeutrals_FW_L");
1207 indexNNeutrals_FW_U_ = index_type(&bits_, "nNeutrals_FW_U");
1208 if (quality_ == TIGHTLEPVETO) {
1209 indexMUF_ = index_type(&bits_, "MUF");
1210 }
1211 }
1212 if ((version_ == SUMMER18) || (version_ == RUN2ULCHS) || (version_ == RUN3CHSrunsBCDEprompt) ||
1213 (version_ == RUN3CHSruns2022FGruns2023CD)) {
1214 indexNHF_TR_ = index_type(&bits_, "NHF_TR");
1215 indexNEF_TR_ = index_type(&bits_, "NEF_TR");
1216 indexNCH_TR_ = index_type(&bits_, "NCH_TR");
1217 indexNEF_EC_L_ = index_type(&bits_, "NEF_EC_L");
1218 indexNEF_EC_U_ = index_type(&bits_, "NEF_EC_U");
1219 indexNNeutrals_EC_ = index_type(&bits_, "nNeutrals_EC");
1220 indexNHF_FW_ = index_type(&bits_, "NHF_FW");
1221 indexNEF_FW_ = index_type(&bits_, "NEF_FW");
1222 indexNNeutrals_FW_ = index_type(&bits_, "nNeutrals_FW");
1223 if (quality_ == TIGHTLEPVETO) {
1224 indexMUF_ = index_type(&bits_, "MUF");
1225 indexMUF_TR_ = index_type(&bits_, "MUF_TR");
1226 indexCEF_TR_ = index_type(&bits_, "CEF_TR");
1227 }
1228 }
1229 if ((version_ == SUMMER18PUPPI) || (version_ == RUN2ULPUPPI) || (version_ == RUN3PUPPIrunsBCDEprompt) ||
1230 (version_ == RUN3PUPPIruns2022FGruns2023CD)) {
1231 indexNHF_TR_ = index_type(&bits_, "NHF_TR");
1232 indexNEF_TR_ = index_type(&bits_, "NEF_TR");
1233 indexNHF_EC_ = index_type(&bits_, "NHF_EC");
1234 indexNHF_FW_ = index_type(&bits_, "NHF_FW");
1235 indexNEF_FW_ = index_type(&bits_, "NEF_FW");
1236 indexNNeutrals_FW_L_ = index_type(&bits_, "nNeutrals_FW_L");
1237 indexNNeutrals_FW_U_ = index_type(&bits_, "nNeutrals_FW_U");
1238 if (quality_ == TIGHTLEPVETO) {
1239 indexMUF_ = index_type(&bits_, "MUF");
1240 indexMUF_TR_ = index_type(&bits_, "MUF_TR");
1241 indexCEF_TR_ = index_type(&bits_, "CEF_TR");
1242 }
1243 }
1244 if (version_ == RUN2UL16CHS) {
1245 indexNHF_TR_ = index_type(&bits_, "NHF_TR");
1246 indexNEF_TR_ = index_type(&bits_, "NEF_TR");
1247 indexNHF_EC_ = index_type(&bits_, "NHF_EC");
1248 indexNEF_EC_L_ = index_type(&bits_, "NEF_EC_L");
1249 indexNEF_EC_U_ = index_type(&bits_, "NEF_EC_U");
1250 indexNNeutrals_EC_ = index_type(&bits_, "nNeutrals_EC");
1251 indexNHF_FW_ = index_type(&bits_, "NHF_FW");
1252 indexNEF_FW_ = index_type(&bits_, "NEF_FW");
1253 indexNNeutrals_FW_ = index_type(&bits_, "nNeutrals_FW");
1254 if (quality_ == TIGHTLEPVETO) {
1255 indexMUF_ = index_type(&bits_, "MUF");
1256 }
1257 }
1258 if (version_ == RUN2UL16PUPPI) {
1259 indexNHF_TR_ = index_type(&bits_, "NHF_TR");
1260 indexNEF_TR_ = index_type(&bits_, "NEF_TR");
1261 indexNNeutrals_EC_ = index_type(&bits_, "nNeutrals_EC");
1262 indexNEF_FW_ = index_type(&bits_, "NEF_FW");
1263 indexNNeutrals_FW_L_ = index_type(&bits_, "nNeutrals_FW_L");
1264 indexNNeutrals_FW_U_ = index_type(&bits_, "nNeutrals_FW_U");
1265 if (quality_ == TIGHTLEPVETO) {
1266 indexMUF_ = index_type(&bits_, "MUF");
1267 }
1268 }
1269 retInternal_ = getBitTemplate();
1270 }
1271
1272 Version_t version_;
1273 Quality_t quality_;
1274
1275 index_type indexNConstituents_;
1276 index_type indexNEF_;
1277 index_type indexMUF_;
1278 index_type indexNHF_;
1279 index_type indexCEF_;
1280 index_type indexCHF_;
1281 index_type indexNCH_;
1282
1283 index_type indexNHF_TR_;
1284 index_type indexNEF_TR_;
1285 index_type indexNCH_TR_;
1286 index_type indexMUF_TR_;
1287 index_type indexCEF_TR_;
1288
1289 index_type indexNHF_FW_;
1290 index_type indexNEF_FW_;
1291 index_type indexNNeutrals_FW_;
1292 index_type indexNNeutrals_FW_L_;
1293 index_type indexNNeutrals_FW_U_;
1294
1295 index_type indexNHF_EC_;
1296 index_type indexNEF_EC_;
1297 index_type indexNEF_EC_L_;
1298 index_type indexNEF_EC_U_;
1299 index_type indexNNeutrals_EC_;
1300 };
1301
1302 #endif