CMS 3D CMS Logo

PFJetIDSelectionFunctor.h
Go to the documentation of this file.
1 #ifndef PhysicsTools_SelectorUtils_interface_PFJetIDSelectionFunctor_h
2 #define PhysicsTools_SelectorUtils_interface_PFJetIDSelectionFunctor_h
3 
15 #ifndef __GCCXML__
17 #endif
20 
22 
23 #include <TMath.h>
24 
25 class PFJetIDSelectionFunctor : public Selector<pat::Jet> {
26 public: // interface
27  enum Version_t {
40  };
42 
44 
45 #ifndef __GCCXML__
47  : PFJetIDSelectionFunctor(params) {}
48 #endif
49 
51  std::string versionStr = params.getParameter<std::string>("version");
52  std::string qualityStr = params.getParameter<std::string>("quality");
53 
54  if (versionStr == "FIRSTDATA")
56  else if (versionStr == "RUNIISTARTUP")
58  else if (versionStr == "WINTER16")
60  else if (versionStr == "WINTER17")
62  else if (versionStr == "WINTER17PUPPI")
64  else if (versionStr == "SUMMER18")
66  else if (versionStr == "SUMMER18PUPPI")
68  else if (versionStr == "RUN2UL16CHS")
70  else if (versionStr == "RUN2UL16PUPPI")
72  else if (versionStr == "RUN2ULCHS")
74  else if (versionStr == "RUN2ULPUPPI")
76  else
77  version_ = WINTER17; //set WINTER17 as default
78 
79  if (qualityStr == "LOOSE")
80  quality_ = LOOSE;
81  else if (qualityStr == "TIGHT")
82  quality_ = TIGHT;
83  else if (qualityStr == "TIGHTLEPVETO")
85  else
86  quality_ = TIGHT;
87 
88  initCuts();
89 
90  // Now check the configuration to see if the user changed anything
91  if (params.exists("CHF"))
92  set("CHF", params.getParameter<double>("CHF"));
93  if (params.exists("NHF"))
94  set("NHF", params.getParameter<double>("NHF"));
97  quality_ != TIGHT) {
98  if (params.exists("CEF"))
99  set("CEF", params.getParameter<double>("CEF"));
100  }
101  if (params.exists("NEF"))
102  set("NEF", params.getParameter<double>("NEF"));
103  if (params.exists("NCH"))
104  set("NCH", params.getParameter<int>("NCH"));
105  if (params.exists("nConstituents"))
106  set("nConstituents", params.getParameter<int>("nConstituents"));
107  if (version_ == RUNIISTARTUP) {
108  if (params.exists("NEF_FW"))
109  set("NEF_FW", params.getParameter<double>("NEF_FW"));
110  if (params.exists("nNeutrals_FW"))
111  set("nNeutrals_FW", params.getParameter<int>("nNeutrals_FW"));
112  }
113  if (version_ == WINTER16) {
114  if (params.exists("NHF_EC"))
115  set("NHF_EC", params.getParameter<double>("NHF_EC"));
116  if (params.exists("NEF_EC"))
117  set("NEF_EC", params.getParameter<double>("NEF_EC"));
118  if (params.exists("nNeutrals_EC"))
119  set("nNeutrals_EC", params.getParameter<int>("nNeutrals_EC"));
120  if (params.exists("NEF_FW"))
121  set("NEF_FW", params.getParameter<double>("NEF_FW"));
122  if (params.exists("nNeutrals_FW"))
123  set("nNeutrals_FW", params.getParameter<int>("nNeutrals_FW"));
124  if (quality_ == TIGHTLEPVETO) {
125  if (params.exists("MUF"))
126  set("MUF", params.getParameter<double>("MUF"));
127  }
128  }
129  if (version_ == WINTER17) {
130  if (params.exists("NEF_EC_L"))
131  set("NEF_EC_L", params.getParameter<double>("NEF_EC_L"));
132  if (params.exists("NEF_EC_U"))
133  set("NEF_EC_U", params.getParameter<double>("NEF_EC_U"));
134  if (params.exists("nNeutrals_EC"))
135  set("nNeutrals_EC", params.getParameter<int>("nNeutrals_EC"));
136  if (params.exists("NHF_FW"))
137  set("NHF_FW", params.getParameter<double>("NHF_FW"));
138  if (params.exists("NEF_FW"))
139  set("NEF_FW", params.getParameter<double>("NEF_FW"));
140  if (params.exists("nNeutrals_FW"))
141  set("nNeutrals_FW", params.getParameter<int>("nNeutrals_FW"));
142  if (quality_ == TIGHTLEPVETO) {
143  if (params.exists("MUF"))
144  set("MUF", params.getParameter<double>("MUF"));
145  }
146  }
147  if (version_ == WINTER17PUPPI) {
148  if (params.exists("NHF_EC"))
149  set("NHF_EC", params.getParameter<double>("NHF_EC"));
150  if (params.exists("NHF_FW"))
151  set("NHF_FW", params.getParameter<double>("NHF_FW"));
152  if (params.exists("NEF_FW"))
153  set("NEF_FW", params.getParameter<double>("NEF_FW"));
154  if (params.exists("nNeutrals_FW_L"))
155  set("nNeutrals_FW_L", params.getParameter<int>("nNeutrals_FW_L"));
156  if (params.exists("nNeutrals_FW_U"))
157  set("nNeutrals_FW_U", params.getParameter<int>("nNeutrals_FW_U"));
158  if (quality_ == TIGHTLEPVETO) {
159  if (params.exists("MUF"))
160  set("MUF", params.getParameter<double>("MUF"));
161  }
162  }
163  if (version_ == RUN2UL16CHS) {
164  if (params.exists("NHF_TR"))
165  set("NHF_TR", params.getParameter<double>("NHF_TR"));
166  if (params.exists("NEF_TR"))
167  set("NEF_TR", params.getParameter<double>("NEF_TR"));
168  if (params.exists("NHF_EC"))
169  set("NHF_EC", params.getParameter<double>("NHF_EC"));
170  if (params.exists("NEF_EC_L"))
171  set("NEF_EC_L", params.getParameter<double>("NEF_EC_L"));
172  if (params.exists("NEF_EC_U"))
173  set("NEF_EC_U", params.getParameter<double>("NEF_EC_U"));
174  if (params.exists("nNeutrals_EC"))
175  set("nNeutrals_EC", params.getParameter<int>("nNeutrals_EC"));
176  if (params.exists("NHF_FW"))
177  set("NHF_FW", params.getParameter<double>("NHF_FW"));
178  if (params.exists("NEF_FW"))
179  set("NEF_FW", params.getParameter<double>("NEF_FW"));
180  if (params.exists("nNeutrals_FW"))
181  set("nNeutrals_FW", params.getParameter<int>("nNeutrals_FW"));
182  if (quality_ == TIGHTLEPVETO) {
183  if (params.exists("MUF"))
184  set("MUF", params.getParameter<double>("MUF"));
185  }
186  }
187  if (version_ == RUN2UL16PUPPI) {
188  if (params.exists("NHF_TR"))
189  set("NHF_TR", params.getParameter<double>("NHF_TR"));
190  if (params.exists("NEF_TR"))
191  set("NEF_TR", params.getParameter<double>("NEF_TR"));
192  if (params.exists("nNeutrals_EC"))
193  set("nNeutrals_EC", params.getParameter<int>("nNeutrals_EC"));
194  if (params.exists("NEF_FW"))
195  set("NEF_FW", params.getParameter<double>("NEF_FW"));
196  if (params.exists("nNeutrals_FW_L"))
197  set("nNeutrals_FW_L", params.getParameter<int>("nNeutrals_FW_L"));
198  if (params.exists("nNeutrals_FW_U"))
199  set("nNeutrals_FW_U", params.getParameter<int>("nNeutrals_FW_U"));
200  if (quality_ == TIGHTLEPVETO) {
201  if (params.exists("MUF"))
202  set("MUF", params.getParameter<double>("MUF"));
203  }
204  }
205  if ((version_ == SUMMER18) || (version_ == RUN2ULCHS)) {
206  if (params.exists("NHF_TR"))
207  set("NHF_TR", params.getParameter<double>("NHF_TR"));
208  if (params.exists("NEF_TR"))
209  set("NEF_TR", params.getParameter<double>("NEF_TR"));
210  if (params.exists("NCH_TR"))
211  set("NCH_TR", params.getParameter<int>("NCH_TR"));
212  if (params.exists("NEF_EC_L"))
213  set("NEF_EC_L", params.getParameter<double>("NEF_EC_L"));
214  if (params.exists("NEF_EC_U"))
215  set("NEF_EC_U", params.getParameter<double>("NEF_EC_U"));
216  if (params.exists("nNeutrals_EC"))
217  set("nNeutrals_EC", params.getParameter<int>("nNeutrals_EC"));
218  if (params.exists("NHF_FW"))
219  set("NHF_FW", params.getParameter<double>("NHF_FW"));
220  if (params.exists("NEF_FW"))
221  set("NEF_FW", params.getParameter<double>("NEF_FW"));
222  if (params.exists("nNeutrals_FW"))
223  set("nNeutrals_FW", params.getParameter<int>("nNeutrals_FW"));
224  if (quality_ == TIGHTLEPVETO) {
225  if (params.exists("MUF"))
226  set("MUF", params.getParameter<double>("MUF"));
227  if (params.exists("MUF_TR"))
228  set("MUF_TR", params.getParameter<double>("MUF_TR"));
229  if (params.exists("CEF_TR"))
230  set("CEF_TR", params.getParameter<double>("CEF_TR"));
231  }
232  }
233  if ((version_ == SUMMER18PUPPI) || (version_ == RUN2ULPUPPI)) {
234  if (params.exists("NHF_TR"))
235  set("NHF_TR", params.getParameter<double>("NHF_TR"));
236  if (params.exists("NEF_TR"))
237  set("NEF_TR", params.getParameter<double>("NEF_TR"));
238  if (params.exists("NHF_EC"))
239  set("NHF_EC", params.getParameter<double>("NHF_EC"));
240  if (params.exists("NHF_FW"))
241  set("NHF_FW", params.getParameter<double>("NHF_FW"));
242  if (params.exists("NEF_FW"))
243  set("NEF_FW", params.getParameter<double>("NEF_FW"));
244  if (params.exists("nNeutrals_FW_L"))
245  set("nNeutrals_FW_L", params.getParameter<int>("nNeutrals_FW_L"));
246  if (params.exists("nNeutrals_FW_U"))
247  set("nNeutrals_FW_U", params.getParameter<int>("nNeutrals_FW_U"));
248  if (quality_ == TIGHTLEPVETO) {
249  if (params.exists("MUF"))
250  set("MUF", params.getParameter<double>("MUF"));
251  if (params.exists("MUF_TR"))
252  set("MUF_TR", params.getParameter<double>("MUF_TR"));
253  if (params.exists("CEF_TR"))
254  set("CEF_TR", params.getParameter<double>("CEF_TR"));
255  }
256  }
257 
258  if (params.exists("cutsToIgnore"))
259  setIgnoredCuts(params.getParameter<std::vector<std::string> >("cutsToIgnore"));
260 
261  initIndex();
262  }
263 
265  initCuts();
266  initIndex();
267  }
268 
269  //
270  // Accessor from PAT jets
271  //
272  bool operator()(const pat::Jet &jet, pat::strbitset &ret) override {
276  if (jet.currentJECLevel() == "Uncorrected" || !jet.jecSetsAvailable())
277  return firstDataCuts(jet, ret, version_);
278  else
279  return firstDataCuts(jet.correctedJet("Uncorrected"), ret, version_);
280  } else {
281  return false;
282  }
283  }
285 
286  //
287  // Accessor from *CORRECTED* 4-vector, EMF, and Jet ID.
288  // This can be used with reco quantities.
289  //
294  return firstDataCuts(jet, ret, version_);
295  } else {
296  return false;
297  }
298  }
299 
300  bool operator()(const reco::PFJet &jet) {
301  retInternal_.set(false);
302  operator()(jet, retInternal_);
304  return (bool)retInternal_;
305  }
306 
307  //
308  // cuts based on craft 08 analysis.
309  //
311  ret.set(false);
312 
313  // cache some variables
314  double chf = 0.0;
315  double nhf = 0.0;
316  double cef = 0.0;
317  double nef = 0.0;
318  double muf = 0.0;
319 
320  int nch = 0;
321  int nconstituents = 0;
322  int nneutrals = 0;
323 
324  // Have to do this because pat::Jet inherits from reco::Jet but not reco::PFJet
325  reco::PFJet const *pfJet = dynamic_cast<reco::PFJet const *>(&jet);
326  pat::Jet const *patJet = dynamic_cast<pat::Jet const *>(&jet);
327  reco::BasicJet const *basicJet = dynamic_cast<reco::BasicJet const *>(&jet);
328 
329  if (patJet != nullptr) {
330  if (patJet->isPFJet()) {
331  chf = patJet->chargedHadronEnergyFraction();
332  nhf = patJet->neutralHadronEnergyFraction();
333  cef = patJet->chargedEmEnergyFraction();
334  nef = patJet->neutralEmEnergyFraction();
335  nch = patJet->chargedMultiplicity();
336  muf = patJet->muonEnergyFraction();
337  nconstituents = patJet->numberOfDaughters();
338  nneutrals = patJet->neutralMultiplicity();
339  // Handle the special case of PUPPI jets with weighted multiplicities
340  if (patJet->hasUserFloat("patPuppiJetSpecificProducer:puppiMultiplicity"))
341  nconstituents = patJet->userFloat("patPuppiJetSpecificProducer:puppiMultiplicity");
342  if (patJet->hasUserFloat("patPuppiJetSpecificProducer:neutralPuppiMultiplicity"))
343  nneutrals = patJet->userFloat("patPuppiJetSpecificProducer:neutralPuppiMultiplicity");
344  }
345  // Handle the special case where this is a composed jet for
346  // subjet analyses
347  else if (patJet->isBasicJet()) {
348  double e_chf = 0.0;
349  double e_nhf = 0.0;
350  double e_cef = 0.0;
351  double e_nef = 0.0;
352  double e_muf = 0.0;
353  nch = 0;
354  nconstituents = 0;
355  nneutrals = 0;
356 
357  for (reco::Jet::const_iterator ibegin = patJet->begin(), iend = patJet->end(), isub = ibegin; isub != iend;
358  ++isub) {
359  reco::PFJet const *pfsub = dynamic_cast<reco::PFJet const *>(&*isub);
360  pat::Jet const *patsub = dynamic_cast<pat::Jet const *>(&*isub);
361  if (patsub) {
362  e_chf += patsub->chargedHadronEnergy();
363  e_nhf += patsub->neutralHadronEnergy();
364  e_cef += patsub->chargedEmEnergy();
365  e_nef += patsub->neutralEmEnergy();
366  e_muf += patsub->muonEnergy();
367  nch += patsub->chargedMultiplicity();
368  nconstituents += patsub->numberOfDaughters();
369  nneutrals += patsub->neutralMultiplicity();
370  } else if (pfsub) {
371  e_chf += pfsub->chargedHadronEnergy();
372  e_nhf += pfsub->neutralHadronEnergy();
373  e_cef += pfsub->chargedEmEnergy();
374  e_nef += pfsub->neutralEmEnergy();
375  e_muf += pfsub->muonEnergy();
376  nch += pfsub->chargedMultiplicity();
377  nconstituents += pfsub->numberOfDaughters();
378  nneutrals += pfsub->neutralMultiplicity();
379  } else
380  assert(0);
381  }
382  double e = patJet->energy();
383  if (e > 0.000001) {
384  chf = e_chf / e;
385  nhf = e_nhf / e;
386  cef = e_cef / e;
387  nef = e_nef / e;
388  muf = e_muf / e;
389  } else {
390  chf = nhf = cef = nef = muf = 0.0;
391  }
392  }
393  } // end if pat jet
394  else if (pfJet != nullptr) {
395  // CV: need to compute energy fractions in a way that works for corrected as well as for uncorrected PFJets
396  double jetEnergyUncorrected = pfJet->chargedHadronEnergy() + pfJet->neutralHadronEnergy() +
397  pfJet->photonEnergy() + pfJet->electronEnergy() + pfJet->muonEnergy() +
398  pfJet->HFEMEnergy();
399  if (jetEnergyUncorrected > 0.) {
400  chf = pfJet->chargedHadronEnergy() / jetEnergyUncorrected;
401  nhf = pfJet->neutralHadronEnergy() / jetEnergyUncorrected;
402  cef = pfJet->chargedEmEnergy() / jetEnergyUncorrected;
403  nef = pfJet->neutralEmEnergy() / jetEnergyUncorrected;
404  muf = pfJet->muonEnergy() / jetEnergyUncorrected;
405  }
406  nch = pfJet->chargedMultiplicity();
407  nconstituents = pfJet->numberOfDaughters();
408  nneutrals = pfJet->neutralMultiplicity();
409  } // end if PF jet
410  // Handle the special case where this is a composed jet for
411  // subjet analyses
412  else if (basicJet != nullptr) {
413  double e_chf = 0.0;
414  double e_nhf = 0.0;
415  double e_cef = 0.0;
416  double e_nef = 0.0;
417  double e_muf = 0.0;
418  nch = 0;
419  nconstituents = 0;
420  for (reco::Jet::const_iterator ibegin = basicJet->begin(), iend = patJet->end(), isub = ibegin; isub != iend;
421  ++isub) {
422  reco::PFJet const *pfsub = dynamic_cast<reco::PFJet const *>(&*isub);
423  e_chf += pfsub->chargedHadronEnergy();
424  e_nhf += pfsub->neutralHadronEnergy();
425  e_cef += pfsub->chargedEmEnergy();
426  e_nef += pfsub->neutralEmEnergy();
427  e_muf += pfsub->muonEnergy();
428  nch += pfsub->chargedMultiplicity();
429  nconstituents += pfsub->numberOfDaughters();
430  nneutrals += pfsub->neutralMultiplicity();
431  }
432  double e = basicJet->energy();
433  if (e > 0.000001) {
434  chf = e_chf / e;
435  nhf = e_nhf / e;
436  cef = e_cef / e;
437  nef = e_nef / e;
438  muf = e_muf / e;
439  }
440  } // end if basic jet
441 
442  float etaB = 2.4;
443  // Cuts for |eta| < 2.6 for Summer18
444  if (version_ == SUMMER18 || version_ == SUMMER18PUPPI || version_ == RUN2ULCHS || version_ == RUN2ULPUPPI)
445  etaB = 2.6;
446  if ((version_ != WINTER17 && version_ != WINTER17PUPPI && version_ != SUMMER18 && version_ != SUMMER18PUPPI &&
447  version_ != RUN2UL16CHS && version_ != RUN2UL16PUPPI && version_ != RUN2ULCHS && version_ != RUN2ULPUPPI) ||
448  quality_ != TIGHT) {
449  if (ignoreCut(indexCEF_) || (cef < cut(indexCEF_, double()) || std::abs(jet.eta()) > etaB))
450  passCut(ret, indexCEF_);
451  }
452  if (ignoreCut(indexCHF_) || (chf > cut(indexCHF_, double()) || std::abs(jet.eta()) > etaB))
453  passCut(ret, indexCHF_);
454  if (ignoreCut(indexNCH_) || (nch > cut(indexNCH_, int()) || std::abs(jet.eta()) > etaB))
455  passCut(ret, indexNCH_);
456  if (version_ == FIRSTDATA) { // Cuts for all eta for FIRSTDATA
457  if (ignoreCut(indexNConstituents_) || (nconstituents > cut(indexNConstituents_, int())))
459  if (ignoreCut(indexNEF_) || (nef < cut(indexNEF_, double())))
460  passCut(ret, indexNEF_);
461  if (ignoreCut(indexNHF_) || (nhf < cut(indexNHF_, double())))
462  passCut(ret, indexNHF_);
463  } else if (version_ == RUNIISTARTUP) {
464  // Cuts for |eta| <= 3.0 for RUNIISTARTUP scenario
466  (nconstituents > cut(indexNConstituents_, int()) || std::abs(jet.eta()) > 3.0))
468  if (ignoreCut(indexNEF_) || (nef < cut(indexNEF_, double()) || std::abs(jet.eta()) > 3.0))
469  passCut(ret, indexNEF_);
470  if (ignoreCut(indexNHF_) || (nhf < cut(indexNHF_, double()) || std::abs(jet.eta()) > 3.0))
471  passCut(ret, indexNHF_);
472  // Cuts for |eta| > 3.0 for RUNIISTARTUP scenario
473  if (ignoreCut(indexNEF_FW_) || (nef < cut(indexNEF_FW_, double()) || std::abs(jet.eta()) <= 3.0))
474  passCut(ret, indexNEF_FW_);
475  if (ignoreCut(indexNNeutrals_FW_) || (nneutrals > cut(indexNNeutrals_FW_, int()) || std::abs(jet.eta()) <= 3.0))
477  } else if (version_ == WINTER16) {
478  // Cuts for |eta| <= 2.7 for WINTER16 scenario
480  (nconstituents > cut(indexNConstituents_, int()) || std::abs(jet.eta()) > 2.7))
482  if (ignoreCut(indexNEF_) || (nef < cut(indexNEF_, double()) || std::abs(jet.eta()) > 2.7))
483  passCut(ret, indexNEF_);
484  if (ignoreCut(indexNHF_) || (nhf < cut(indexNHF_, double()) || std::abs(jet.eta()) > 2.7))
485  passCut(ret, indexNHF_);
486  if (quality_ == TIGHTLEPVETO) {
487  if (ignoreCut(indexMUF_) || (muf < cut(indexMUF_, double()) || std::abs(jet.eta()) > 2.7))
488  passCut(ret, indexMUF_);
489  }
490 
491  // Cuts for 2.7 < |eta| <= 3.0 for WINTER16 scenario
492  if (ignoreCut(indexNHF_EC_) ||
493  (nhf < cut(indexNHF_EC_, double()) || std::abs(jet.eta()) <= 2.7 || std::abs(jet.eta()) > 3.0))
494  passCut(ret, indexNHF_EC_);
495  if (ignoreCut(indexNEF_EC_) ||
496  (nef > cut(indexNEF_EC_, double()) || std::abs(jet.eta()) <= 2.7 || std::abs(jet.eta()) > 3.0))
497  passCut(ret, indexNEF_EC_);
499  (nneutrals > cut(indexNNeutrals_EC_, int()) || std::abs(jet.eta()) <= 2.7 || std::abs(jet.eta()) > 3.0))
501 
502  // Cuts for |eta| > 3.0 for WINTER16 scenario
503  if (ignoreCut(indexNEF_FW_) || (nef < cut(indexNEF_FW_, double()) || std::abs(jet.eta()) <= 3.0))
504  passCut(ret, indexNEF_FW_);
505  if (ignoreCut(indexNNeutrals_FW_) || (nneutrals > cut(indexNNeutrals_FW_, int()) || std::abs(jet.eta()) <= 3.0))
507  } else if (version_ == WINTER17) {
508  // Cuts for |eta| <= 2.7 for WINTER17 scenario
510  (nconstituents > cut(indexNConstituents_, int()) || std::abs(jet.eta()) > 2.7))
512  if (ignoreCut(indexNEF_) || (nef < cut(indexNEF_, double()) || std::abs(jet.eta()) > 2.7))
513  passCut(ret, indexNEF_);
514  if (ignoreCut(indexNHF_) || (nhf < cut(indexNHF_, double()) || std::abs(jet.eta()) > 2.7))
515  passCut(ret, indexNHF_);
516  if (quality_ == TIGHTLEPVETO) {
517  if (ignoreCut(indexMUF_) || (muf < cut(indexMUF_, double()) || std::abs(jet.eta()) > 2.7))
518  passCut(ret, indexMUF_);
519  }
520 
521  // Cuts for 2.7 < |eta| <= 3.0 for WINTER17 scenario
522 
523  if (ignoreCut(indexNEF_EC_L_) ||
524  (nef > cut(indexNEF_EC_L_, double()) || std::abs(jet.eta()) <= 2.7 || std::abs(jet.eta()) > 3.0))
525  passCut(ret, indexNEF_EC_L_);
526  if (ignoreCut(indexNEF_EC_U_) ||
527  (nef < cut(indexNEF_EC_U_, double()) || std::abs(jet.eta()) <= 2.7 || std::abs(jet.eta()) > 3.0))
528  passCut(ret, indexNEF_EC_U_);
530  (nneutrals > cut(indexNNeutrals_EC_, int()) || std::abs(jet.eta()) <= 2.7 || std::abs(jet.eta()) > 3.0))
532 
533  // Cuts for |eta| > 3.0 for WINTER17 scenario
534  if (ignoreCut(indexNHF_FW_) || (nhf > cut(indexNHF_FW_, double()) || std::abs(jet.eta()) <= 3.0))
535  passCut(ret, indexNHF_FW_);
536  if (ignoreCut(indexNEF_FW_) || (nef < cut(indexNEF_FW_, double()) || std::abs(jet.eta()) <= 3.0))
537  passCut(ret, indexNEF_FW_);
538  if (ignoreCut(indexNNeutrals_FW_) || (nneutrals > cut(indexNNeutrals_FW_, int()) || std::abs(jet.eta()) <= 3.0))
540 
541  } else if (version_ == WINTER17PUPPI) {
542  // Cuts for |eta| <= 2.7 for WINTER17 scenario
544  (nconstituents > cut(indexNConstituents_, int()) || std::abs(jet.eta()) > 2.7))
546  if (ignoreCut(indexNEF_) || (nef < cut(indexNEF_, double()) || std::abs(jet.eta()) > 2.7))
547  passCut(ret, indexNEF_);
548  if (ignoreCut(indexNHF_) || (nhf < cut(indexNHF_, double()) || std::abs(jet.eta()) > 2.7))
549  passCut(ret, indexNHF_);
550  if (quality_ == TIGHTLEPVETO) {
551  if (ignoreCut(indexMUF_) || (muf < cut(indexMUF_, double()) || std::abs(jet.eta()) > 2.7))
552  passCut(ret, indexMUF_);
553  }
554 
555  // Cuts for 2.7 < |eta| <= 3.0 for WINTER17 scenario
556 
557  if (ignoreCut(indexNHF_EC_) ||
558  (nhf < cut(indexNHF_EC_, double()) || std::abs(jet.eta()) <= 2.7 || std::abs(jet.eta()) > 3.0))
559  passCut(ret, indexNHF_EC_);
560 
561  // Cuts for |eta| > 3.0 for WINTER17 scenario
562  if (ignoreCut(indexNHF_FW_) || (nhf > cut(indexNHF_FW_, double()) || std::abs(jet.eta()) <= 3.0))
563  passCut(ret, indexNHF_FW_);
564  if (ignoreCut(indexNEF_FW_) || (nef < cut(indexNEF_FW_, double()) || std::abs(jet.eta()) <= 3.0))
565  passCut(ret, indexNEF_FW_);
567  (nneutrals > cut(indexNNeutrals_FW_L_, int()) || std::abs(jet.eta()) <= 3.0))
570  (nneutrals < cut(indexNNeutrals_FW_U_, int()) || std::abs(jet.eta()) <= 3.0))
572 
573  } else if (version_ == RUN2UL16CHS) {
574  // Cuts for |eta| <= 2.4 for RUN2UL16CHS scenario
576  (nconstituents > cut(indexNConstituents_, int()) || std::abs(jet.eta()) > 2.4))
578  if (ignoreCut(indexNEF_) || (nef < cut(indexNEF_, double()) || std::abs(jet.eta()) > 2.4))
579  passCut(ret, indexNEF_);
580  if (ignoreCut(indexNHF_) || (nhf < cut(indexNHF_, double()) || std::abs(jet.eta()) > 2.4))
581  passCut(ret, indexNHF_);
582  if (quality_ == TIGHTLEPVETO) {
583  if (ignoreCut(indexMUF_) || (muf < cut(indexMUF_, double()) || std::abs(jet.eta()) > 2.4))
584  passCut(ret, indexMUF_);
585  }
586 
587  // Cuts for 2.4 <= |eta| <= 2.7 for RUN2UL16CHS scenario
588  if (ignoreCut(indexNHF_TR_) ||
589  (nhf < cut(indexNHF_TR_, double()) || std::abs(jet.eta()) <= 2.4 || std::abs(jet.eta()) > 2.7))
590  passCut(ret, indexNHF_TR_);
591  if (ignoreCut(indexNEF_TR_) ||
592  (nef < cut(indexNEF_TR_, double()) || std::abs(jet.eta()) <= 2.4 || std::abs(jet.eta()) > 2.7))
593  passCut(ret, indexNEF_TR_);
594 
595  // Cuts for 2.7 < |eta| <= 3.0 for RUN2UL16CHS scenario
596  if (ignoreCut(indexNHF_EC_) ||
597  (nhf < cut(indexNHF_EC_, double()) || std::abs(jet.eta()) <= 2.7 || std::abs(jet.eta()) > 3.0))
598  passCut(ret, indexNHF_EC_);
599  if (ignoreCut(indexNEF_EC_L_) ||
600  (nef > cut(indexNEF_EC_L_, double()) || std::abs(jet.eta()) <= 2.7 || std::abs(jet.eta()) > 3.0))
601  passCut(ret, indexNEF_EC_L_);
602  if (ignoreCut(indexNEF_EC_U_) ||
603  (nef < cut(indexNEF_EC_U_, double()) || std::abs(jet.eta()) <= 2.7 || std::abs(jet.eta()) > 3.0))
604  passCut(ret, indexNEF_EC_U_);
606  (nneutrals > cut(indexNNeutrals_EC_, int()) || std::abs(jet.eta()) <= 2.7 || std::abs(jet.eta()) > 3.0))
608 
609  // Cuts for |eta| > 3.0 for RUN2UL16CHS scenario
610  if (ignoreCut(indexNHF_FW_) || (nhf > cut(indexNHF_FW_, double()) || std::abs(jet.eta()) <= 3.0))
611  passCut(ret, indexNHF_FW_);
612  if (ignoreCut(indexNEF_FW_) || (nef < cut(indexNEF_FW_, double()) || std::abs(jet.eta()) <= 3.0))
613  passCut(ret, indexNEF_FW_);
614  if (ignoreCut(indexNNeutrals_FW_) || (nneutrals > cut(indexNNeutrals_FW_, int()) || std::abs(jet.eta()) <= 3.0))
616 
617  } else if (version_ == RUN2UL16PUPPI) {
618  // Cuts for |eta| <= 2.6 for RUN2UL16PUPPI scenario
620  (nconstituents > cut(indexNConstituents_, int()) || std::abs(jet.eta()) > 2.4))
622  if (ignoreCut(indexNEF_) || (nef < cut(indexNEF_, double()) || std::abs(jet.eta()) > 2.4))
623  passCut(ret, indexNEF_);
624  if (ignoreCut(indexNHF_) || (nhf < cut(indexNHF_, double()) || std::abs(jet.eta()) > 2.4))
625  passCut(ret, indexNHF_);
626  if (quality_ == TIGHTLEPVETO) {
627  if (ignoreCut(indexMUF_) || (muf < cut(indexMUF_, double()) || std::abs(jet.eta()) > 2.4))
628  passCut(ret, indexMUF_);
629  }
630 
631  // Cuts for 2.4 <= |eta| <= 2.7 for RUN2UL16PUPPI scenario
632  if (ignoreCut(indexNHF_TR_) ||
633  (nhf < cut(indexNHF_TR_, double()) || std::abs(jet.eta()) <= 2.4 || std::abs(jet.eta()) > 2.7))
634  passCut(ret, indexNHF_TR_);
635  if (ignoreCut(indexNEF_TR_) ||
636  (nef < cut(indexNEF_TR_, double()) || std::abs(jet.eta()) <= 2.4 || std::abs(jet.eta()) > 2.7))
637  passCut(ret, indexNEF_TR_);
638 
639  // Cuts for 2.7 < |eta| <= 3.0 for RUN2UL16PUPPI scenario
641  (nneutrals > cut(indexNNeutrals_EC_, int()) || std::abs(jet.eta()) <= 2.7 || std::abs(jet.eta()) > 3.0))
643 
644  // Cuts for |eta| > 3.0 for RUN2UL16PUPPI scenario
645  if (ignoreCut(indexNEF_FW_) || (nef < cut(indexNEF_FW_, double()) || std::abs(jet.eta()) <= 3.0))
646  passCut(ret, indexNEF_FW_);
648  (nneutrals > cut(indexNNeutrals_FW_L_, int()) || std::abs(jet.eta()) <= 3.0))
651  (nneutrals < cut(indexNNeutrals_FW_U_, int()) || std::abs(jet.eta()) <= 3.0))
653 
654  } else if ((version_ == SUMMER18) || (version_ == RUN2ULCHS)) {
655  // Cuts for |eta| <= 2.6 for SUMMER18 scenario
657  (nconstituents > cut(indexNConstituents_, int()) || std::abs(jet.eta()) > 2.6))
659  if (ignoreCut(indexNEF_) || (nef < cut(indexNEF_, double()) || std::abs(jet.eta()) > 2.6))
660  passCut(ret, indexNEF_);
661  if (ignoreCut(indexNHF_) || (nhf < cut(indexNHF_, double()) || std::abs(jet.eta()) > 2.6))
662  passCut(ret, indexNHF_);
663  if (quality_ == TIGHTLEPVETO) {
664  if (ignoreCut(indexMUF_) || (muf < cut(indexMUF_, double()) || std::abs(jet.eta()) > 2.6))
665  passCut(ret, indexMUF_);
666  }
667 
668  // Cuts for 2.6 <= |eta| <= 2.7 for SUMMER18 scenario
669  if (ignoreCut(indexNHF_TR_) ||
670  (nhf < cut(indexNHF_TR_, double()) || std::abs(jet.eta()) <= 2.6 || std::abs(jet.eta()) > 2.7))
671  passCut(ret, indexNHF_TR_);
672  if (ignoreCut(indexNEF_TR_) ||
673  (nef < cut(indexNEF_TR_, double()) || std::abs(jet.eta()) <= 2.6 || std::abs(jet.eta()) > 2.7))
674  passCut(ret, indexNEF_TR_);
675  if (ignoreCut(indexNCH_TR_) ||
676  (nch > cut(indexNCH_TR_, double()) || std::abs(jet.eta()) <= 2.6 || std::abs(jet.eta()) > 2.7))
677  passCut(ret, indexNCH_TR_);
678  if (quality_ == TIGHTLEPVETO) {
679  if (ignoreCut(indexMUF_TR_) ||
680  (muf < cut(indexMUF_TR_, double()) || std::abs(jet.eta()) <= 2.6 || std::abs(jet.eta()) > 2.7))
681  passCut(ret, indexMUF_TR_);
682  if (ignoreCut(indexCEF_TR_) ||
683  (cef < cut(indexCEF_TR_, double()) || std::abs(jet.eta()) <= 2.6 || std::abs(jet.eta()) > 2.7))
684  passCut(ret, indexCEF_TR_);
685  }
686 
687  // Cuts for 2.7 < |eta| <= 3.0 for SUMMER18 scenario
688  if (ignoreCut(indexNEF_EC_L_) ||
689  (nef > cut(indexNEF_EC_L_, double()) || std::abs(jet.eta()) <= 2.7 || std::abs(jet.eta()) > 3.0))
690  passCut(ret, indexNEF_EC_L_);
691  if (ignoreCut(indexNEF_EC_U_) ||
692  (nef < cut(indexNEF_EC_U_, double()) || std::abs(jet.eta()) <= 2.7 || std::abs(jet.eta()) > 3.0))
693  passCut(ret, indexNEF_EC_U_);
695  (nneutrals > cut(indexNNeutrals_EC_, int()) || std::abs(jet.eta()) <= 2.7 || std::abs(jet.eta()) > 3.0))
697 
698  // Cuts for |eta| > 3.0 for SUMMER18 scenario
699  if (ignoreCut(indexNHF_FW_) || (nhf > cut(indexNHF_FW_, double()) || std::abs(jet.eta()) <= 3.0))
700  passCut(ret, indexNHF_FW_);
701  if (ignoreCut(indexNEF_FW_) || (nef < cut(indexNEF_FW_, double()) || std::abs(jet.eta()) <= 3.0))
702  passCut(ret, indexNEF_FW_);
703  if (ignoreCut(indexNNeutrals_FW_) || (nneutrals > cut(indexNNeutrals_FW_, int()) || std::abs(jet.eta()) <= 3.0))
705  }
706 
707  else if ((version_ == SUMMER18PUPPI) || (version_ == RUN2ULPUPPI)) {
708  // Cuts for |eta| <= 2.6 for SUMMER18PUPPI scenario
710  (nconstituents > cut(indexNConstituents_, int()) || std::abs(jet.eta()) > 2.6))
712  if (ignoreCut(indexNEF_) || (nef < cut(indexNEF_, double()) || std::abs(jet.eta()) > 2.6))
713  passCut(ret, indexNEF_);
714  if (ignoreCut(indexNHF_) || (nhf < cut(indexNHF_, double()) || std::abs(jet.eta()) > 2.6))
715  passCut(ret, indexNHF_);
716  if (quality_ == TIGHTLEPVETO) {
717  if (ignoreCut(indexMUF_) || (muf < cut(indexMUF_, double()) || std::abs(jet.eta()) > 2.6))
718  passCut(ret, indexMUF_);
719  }
720 
721  // Cuts for 2.6 <= |eta| <= 2.7 for SUMMER18PUPPI scenario
722  if (ignoreCut(indexNHF_TR_) ||
723  (nhf < cut(indexNHF_TR_, double()) || std::abs(jet.eta()) <= 2.6 || std::abs(jet.eta()) > 2.7))
724  passCut(ret, indexNHF_TR_);
725  if (ignoreCut(indexNEF_TR_) ||
726  (nef < cut(indexNEF_TR_, double()) || std::abs(jet.eta()) <= 2.6 || std::abs(jet.eta()) > 2.7))
727  passCut(ret, indexNEF_TR_);
728  if (quality_ == TIGHTLEPVETO) {
729  if (ignoreCut(indexMUF_TR_) ||
730  (muf < cut(indexMUF_TR_, double()) || std::abs(jet.eta()) <= 2.6 || std::abs(jet.eta()) > 2.7))
731  passCut(ret, indexMUF_TR_);
732  if (ignoreCut(indexCEF_TR_) ||
733  (cef < cut(indexCEF_TR_, double()) || std::abs(jet.eta()) <= 2.6 || std::abs(jet.eta()) > 2.7))
734  passCut(ret, indexCEF_TR_);
735  }
736 
737  // Cuts for 2.7 < |eta| <= 3.0 for SUMMER18PUPPI scenario
738  if (ignoreCut(indexNHF_EC_) ||
739  (nhf < cut(indexNHF_EC_, double()) || std::abs(jet.eta()) <= 2.7 || std::abs(jet.eta()) > 3.0))
740  passCut(ret, indexNHF_EC_);
741 
742  // Cuts for |eta| > 3.0 for SUMMER18PUPPI scenario
743  if (ignoreCut(indexNHF_FW_) || (nhf > cut(indexNHF_FW_, double()) || std::abs(jet.eta()) <= 3.0))
744  passCut(ret, indexNHF_FW_);
745  if (ignoreCut(indexNEF_FW_) || (nef < cut(indexNEF_FW_, double()) || std::abs(jet.eta()) <= 3.0))
746  passCut(ret, indexNEF_FW_);
748  (nneutrals > cut(indexNNeutrals_FW_L_, int()) || std::abs(jet.eta()) <= 3.0))
751  (nneutrals < cut(indexNNeutrals_FW_U_, int()) || std::abs(jet.eta()) <= 3.0))
753  }
754 
755  //std::cout << "<PFJetIDSelectionFunctor::firstDataCuts>:" << std::endl;
756  //std::cout << " jet: Pt = " << jet.pt() << ", eta = " << jet.eta() << ", phi = " << jet.phi() << std::endl;
757  //ret.print(std::cout);
758  setIgnored(ret);
759  return (bool)ret;
760  }
761 
762 private: // member variables
763  void initCuts() {
764  push_back("CHF");
765  push_back("NHF");
768  quality_ != TIGHT)
769  push_back("CEF");
770  push_back("NEF");
771  push_back("NCH");
772  push_back("nConstituents");
773  if (version_ == RUNIISTARTUP) {
774  push_back("NEF_FW");
775  push_back("nNeutrals_FW");
776  }
777  if (version_ == WINTER16) {
778  push_back("NHF_EC");
779  push_back("NEF_EC");
780  push_back("nNeutrals_EC");
781  push_back("NEF_FW");
782  push_back("nNeutrals_FW");
783  if (quality_ == TIGHTLEPVETO)
784  push_back("MUF");
785  }
786  if (version_ == WINTER17) {
787  push_back("NEF_EC_L");
788  push_back("NEF_EC_U");
789  push_back("nNeutrals_EC");
790  push_back("NEF_FW");
791  push_back("NHF_FW");
792  push_back("nNeutrals_FW");
793  if (quality_ == TIGHTLEPVETO)
794  push_back("MUF");
795  }
796  if (version_ == WINTER17PUPPI) {
797  push_back("NHF_EC");
798  push_back("NEF_FW");
799  push_back("NHF_FW");
800  push_back("nNeutrals_FW_L");
801  push_back("nNeutrals_FW_U");
802  if (quality_ == TIGHTLEPVETO)
803  push_back("MUF");
804  }
805  if (version_ == RUN2UL16CHS) {
806  push_back("NHF_TR");
807  push_back("NEF_TR");
808  push_back("NHF_EC");
809  push_back("NEF_EC_L");
810  push_back("NEF_EC_U");
811  push_back("nNeutrals_EC");
812  push_back("NEF_FW");
813  push_back("NHF_FW");
814  push_back("nNeutrals_FW");
815 
816  if (quality_ == TIGHTLEPVETO) {
817  push_back("MUF");
818  }
819  }
820  if (version_ == RUN2UL16PUPPI) {
821  push_back("NHF_TR");
822  push_back("NEF_TR");
823  push_back("nNeutrals_EC");
824  push_back("NEF_FW");
825  push_back("nNeutrals_FW_L");
826  push_back("nNeutrals_FW_U");
827 
828  if (quality_ == TIGHTLEPVETO) {
829  push_back("MUF");
830  }
831  }
832  if ((version_ == SUMMER18) || (version_ == RUN2ULCHS)) {
833  push_back("NHF_TR");
834  push_back("NEF_TR");
835  push_back("NCH_TR");
836  push_back("NEF_EC_L");
837  push_back("NEF_EC_U");
838  push_back("nNeutrals_EC");
839  push_back("NEF_FW");
840  push_back("NHF_FW");
841  push_back("nNeutrals_FW");
842 
843  if (quality_ == TIGHTLEPVETO) {
844  push_back("MUF");
845  push_back("MUF_TR");
846  push_back("CEF_TR");
847  }
848  }
849  if ((version_ == SUMMER18PUPPI) || (version_ == RUN2ULPUPPI)) {
850  push_back("NHF_TR");
851  push_back("NEF_TR");
852  push_back("NHF_EC");
853  push_back("NEF_FW");
854  push_back("NHF_FW");
855  push_back("nNeutrals_FW_L");
856  push_back("nNeutrals_FW_U");
857 
858  if (quality_ == TIGHTLEPVETO) {
859  push_back("MUF");
860  push_back("MUF_TR");
861  push_back("CEF_TR");
862  }
863  }
864 
867  quality_ == LOOSE) {
868  edm::LogWarning("BadJetIDVersion")
869  << "The LOOSE operating point is only supported for the WINTER16 JetID version -- defaulting to TIGHT";
870  quality_ = TIGHT;
871  }
872 
873  // Set some default cuts for LOOSE, TIGHT
874  if (quality_ == LOOSE) {
875  set("CHF", 0.0);
876  set("NHF", 0.99);
877  set("CEF", 0.99);
878  set("NEF", 0.99);
879  set("NCH", 0);
880  set("nConstituents", 1);
881  if (version_ == RUNIISTARTUP) {
882  set("NEF_FW", 0.90);
883  set("nNeutrals_FW", 10);
884  } else if (version_ == WINTER16) {
885  set("NHF_EC", 0.98);
886  set("NEF_EC", 0.01);
887  set("nNeutrals_EC", 2);
888  set("NEF_FW", 0.90);
889  set("nNeutrals_FW", 10);
890  }
891  } else if (quality_ == TIGHT) {
892  set("CHF", 0.0);
893  set("NHF", 0.9);
896  set("CEF", 0.99);
897  set("NEF", 0.9);
898  set("NCH", 0);
899  set("nConstituents", 1);
900  if (version_ == RUNIISTARTUP) {
901  set("NEF_FW", 0.90);
902  set("nNeutrals_FW", 10);
903  } else if (version_ == WINTER16) {
904  set("NHF_EC", 0.98);
905  set("NEF_EC", 0.01);
906  set("nNeutrals_EC", 2);
907  set("NEF_FW", 0.90);
908  set("nNeutrals_FW", 10);
909  } else if (version_ == WINTER17) {
910  set("NEF_EC_L", 0.02);
911  set("NEF_EC_U", 0.99);
912  set("nNeutrals_EC", 2);
913  set("NHF_FW", 0.02);
914  set("NEF_FW", 0.90);
915  set("nNeutrals_FW", 10);
916  } else if (version_ == WINTER17PUPPI) {
917  set("NHF_EC", 0.99);
918  set("NHF_FW", 0.02);
919  set("NEF_FW", 0.90);
920  set("nNeutrals_FW_L", 2);
921  set("nNeutrals_FW_U", 15);
922  } else if (version_ == SUMMER18) {
923  set("NHF_TR", 0.9);
924  set("NEF_TR", 0.99);
925  set("NCH_TR", 0);
926  set("NEF_EC_L", 0.02);
927  set("NEF_EC_U", 0.99);
928  set("nNeutrals_EC", 2);
929  set("NHF_FW", 0.2);
930  set("NEF_FW", 0.90);
931  set("nNeutrals_FW", 10);
932  } else if (version_ == SUMMER18PUPPI) {
933  set("NHF_TR", 0.9);
934  set("NEF_TR", 0.99);
935  set("NHF_EC", 0.99);
936  set("NHF_FW", 0.02);
937  set("NEF_FW", 0.90);
938  set("nNeutrals_FW_L", 2);
939  set("nNeutrals_FW_U", 15);
940  } else if (version_ == RUN2UL16CHS) {
941  set("NHF_TR", 0.9);
942  set("NEF_TR", 0.99);
943  set("NHF_EC", 0.9);
944  set("NEF_EC_L", 0.);
945  set("NEF_EC_U", 0.99);
946  set("nNeutrals_EC", 1);
947  set("NHF_FW", 0.2);
948  set("NEF_FW", 0.90);
949  set("nNeutrals_FW", 10);
950  } else if (version_ == RUN2UL16PUPPI) {
951  set("NHF_TR", 0.98);
952  set("NEF_TR", 0.99);
953  set("nNeutrals_EC", 1);
954  set("NEF_FW", 0.90);
955  set("nNeutrals_FW_L", 2);
956  set("nNeutrals_FW_U", 999999);
957  } else if (version_ == RUN2ULCHS) {
958  set("NHF_TR", 0.9);
959  set("NEF_TR", 0.99);
960  set("NCH_TR", 0);
961  set("NEF_EC_L", 0.01);
962  set("NEF_EC_U", 0.99);
963  set("nNeutrals_EC", 2);
964  set("NHF_FW", 0.2);
965  set("NEF_FW", 0.90);
966  set("nNeutrals_FW", 10);
967  } else if (version_ == RUN2ULPUPPI) {
968  set("NHF_TR", 0.9);
969  set("NEF_TR", 0.99);
970  set("NHF_EC", 0.9999);
971  set("NHF_FW", -1.0);
972  set("NEF_FW", 0.90);
973  set("nNeutrals_FW_L", 2);
974  set("nNeutrals_FW_U", 999999);
975  }
976  } else if (quality_ == TIGHTLEPVETO) {
977  set("CHF", 0.0);
978  set("NHF", 0.9);
979  set("NEF", 0.9);
980  set("NCH", 0);
981  set("nConstituents", 1);
982  if (version_ == WINTER17) {
983  set("CEF", 0.8);
984  set("NEF_EC_L", 0.02);
985  set("NEF_EC_U", 0.99);
986  set("nNeutrals_EC", 2);
987  set("NHF_FW", 0.02);
988  set("NEF_FW", 0.90);
989  set("nNeutrals_FW", 10);
990  set("MUF", 0.8);
991  } else if (version_ == WINTER17PUPPI) {
992  set("CEF", 0.8);
993  set("NHF_EC", 0.99);
994  set("NHF_FW", 0.02);
995  set("NEF_FW", 0.90);
996  set("nNeutrals_FW_L", 2);
997  set("nNeutrals_FW_U", 15);
998  set("MUF", 0.8);
999  } else if (version_ == WINTER16) {
1000  set("CEF", 0.9);
1001  set("NEF_EC", 0.01);
1002  set("NHF_EC", 0.98);
1003  set("nNeutrals_EC", 2);
1004  set("nNeutrals_FW", 10);
1005  set("NEF_FW", 0.90);
1006  set("MUF", 0.8);
1007  } else if (version_ == WINTER17PUPPI) {
1008  set("CEF", 0.8);
1009  set("NHF_EC", 0.99);
1010  set("NHF_FW", 0.02);
1011  set("NEF_FW", 0.90);
1012  set("nNeutrals_FW_L", 2);
1013  set("nNeutrals_FW_U", 15);
1014  set("MUF", 0.8);
1015  } else if (version_ == WINTER16) {
1016  set("CEF", 0.9);
1017  set("NEF_EC", 0.01);
1018  set("NHF_EC", 0.98);
1019  set("nNeutrals_EC", 2);
1020  set("nNeutrals_FW", 10);
1021  set("NEF_FW", 0.90);
1022  set("MUF", 0.8);
1023  } else if (version_ == SUMMER18) {
1024  set("CEF", 0.8);
1025  set("MUF", 0.8);
1026  set("NHF_TR", 0.9);
1027  set("NEF_TR", 0.99);
1028  set("MUF_TR", 0.8);
1029  set("NCH_TR", 0);
1030  set("CEF_TR", 0.8);
1031  set("NEF_EC_L", 0.02);
1032  set("NEF_EC_U", 0.99);
1033  set("nNeutrals_EC", 2);
1034  set("NHF_FW", 0.2);
1035  set("NEF_FW", 0.90);
1036  set("nNeutrals_FW", 10);
1037  } else if (version_ == SUMMER18PUPPI) {
1038  set("CEF", 0.8);
1039  set("MUF", 0.8);
1040  set("NHF_TR", 0.9);
1041  set("NEF_TR", 0.99);
1042  set("MUF_TR", 0.8);
1043  set("CEF_TR", 0.8);
1044  set("NHF_EC", 0.99);
1045  set("NHF_FW", 0.02);
1046  set("NEF_FW", 0.90);
1047  set("nNeutrals_FW_L", 2);
1048  set("nNeutrals_FW_U", 15);
1049  } else if (version_ == RUN2UL16CHS) {
1050  set("MUF", 0.8);
1051  set("CEF", 0.8);
1052  set("NHF_TR", 0.9);
1053  set("NEF_TR", 0.99);
1054  set("NHF_EC", 0.9);
1055  set("NEF_EC_L", 0.);
1056  set("NEF_EC_U", 0.99);
1057  set("nNeutrals_EC", 1);
1058  set("NHF_FW", 0.2);
1059  set("NEF_FW", 0.90);
1060  set("nNeutrals_FW", 10);
1061  } else if (version_ == RUN2UL16PUPPI) {
1062  set("MUF", 0.8);
1063  set("CEF", 0.8);
1064  set("NHF_TR", 0.98);
1065  set("NEF_TR", 0.99);
1066  set("nNeutrals_EC", 1);
1067  set("NEF_FW", 0.90);
1068  set("nNeutrals_FW_L", 2);
1069  set("nNeutrals_FW_U", 999999);
1070  } else if (version_ == RUN2ULCHS) {
1071  set("CEF", 0.8);
1072  set("MUF", 0.8);
1073  set("NHF_TR", 0.9);
1074  set("NEF_TR", 0.99);
1075  set("MUF_TR", 0.8);
1076  set("NCH_TR", 0);
1077  set("CEF_TR", 0.8);
1078  set("NEF_EC_L", 0.01);
1079  set("NEF_EC_U", 0.99);
1080  set("nNeutrals_EC", 2);
1081  set("NHF_FW", 0.2);
1082  set("NEF_FW", 0.90);
1083  set("nNeutrals_FW", 10);
1084  } else if (version_ == RUN2ULPUPPI) {
1085  set("CEF", 0.8);
1086  set("MUF", 0.8);
1087  set("NHF_TR", 0.9);
1088  set("NEF_TR", 0.99);
1089  set("MUF_TR", 0.8);
1090  set("CEF_TR", 0.8);
1091  set("NHF_EC", 0.9999);
1092  set("NHF_FW", -1.0);
1093  set("NEF_FW", 0.90);
1094  set("nNeutrals_FW_L", 2);
1095  set("nNeutrals_FW_U", 999999);
1096  }
1097  }
1098  }
1099 
1100  void initIndex() {
1101  indexNConstituents_ = index_type(&bits_, "nConstituents");
1102  indexNEF_ = index_type(&bits_, "NEF");
1103  indexNHF_ = index_type(&bits_, "NHF");
1106  quality_ != TIGHT)
1107  indexCEF_ = index_type(&bits_, "CEF");
1108 
1109  indexCHF_ = index_type(&bits_, "CHF");
1110  indexNCH_ = index_type(&bits_, "NCH");
1111  if (version_ == RUNIISTARTUP) {
1112  indexNEF_FW_ = index_type(&bits_, "NEF_FW");
1113  indexNNeutrals_FW_ = index_type(&bits_, "nNeutrals_FW");
1114  }
1115  if (version_ == WINTER16) {
1116  indexNHF_EC_ = index_type(&bits_, "NHF_EC");
1117  indexNEF_EC_ = index_type(&bits_, "NEF_EC");
1118  indexNNeutrals_EC_ = index_type(&bits_, "nNeutrals_EC");
1119  indexNEF_FW_ = index_type(&bits_, "NEF_FW");
1120  indexNNeutrals_FW_ = index_type(&bits_, "nNeutrals_FW");
1121  if (quality_ == TIGHTLEPVETO) {
1122  indexMUF_ = index_type(&bits_, "MUF");
1123  }
1124  }
1125  if (version_ == WINTER17) {
1126  indexNEF_EC_L_ = index_type(&bits_, "NEF_EC_L");
1127  indexNEF_EC_U_ = index_type(&bits_, "NEF_EC_U");
1128  indexNNeutrals_EC_ = index_type(&bits_, "nNeutrals_EC");
1129  indexNHF_FW_ = index_type(&bits_, "NHF_FW");
1130  indexNEF_FW_ = index_type(&bits_, "NEF_FW");
1131  indexNNeutrals_FW_ = index_type(&bits_, "nNeutrals_FW");
1132  if (quality_ == TIGHTLEPVETO) {
1133  indexMUF_ = index_type(&bits_, "MUF");
1134  }
1135  }
1136  if (version_ == WINTER17PUPPI) {
1137  indexNHF_EC_ = index_type(&bits_, "NHF_EC");
1138  indexNHF_FW_ = index_type(&bits_, "NHF_FW");
1139  indexNEF_FW_ = index_type(&bits_, "NEF_FW");
1140  indexNNeutrals_FW_L_ = index_type(&bits_, "nNeutrals_FW_L");
1141  indexNNeutrals_FW_U_ = index_type(&bits_, "nNeutrals_FW_U");
1142  if (quality_ == TIGHTLEPVETO) {
1143  indexMUF_ = index_type(&bits_, "MUF");
1144  }
1145  }
1146  if ((version_ == SUMMER18) || (version_ == RUN2ULCHS)) {
1147  indexNHF_TR_ = index_type(&bits_, "NHF_TR");
1148  indexNEF_TR_ = index_type(&bits_, "NEF_TR");
1149  indexNCH_TR_ = index_type(&bits_, "NCH_TR");
1150  indexNEF_EC_L_ = index_type(&bits_, "NEF_EC_L");
1151  indexNEF_EC_U_ = index_type(&bits_, "NEF_EC_U");
1152  indexNNeutrals_EC_ = index_type(&bits_, "nNeutrals_EC");
1153  indexNHF_FW_ = index_type(&bits_, "NHF_FW");
1154  indexNEF_FW_ = index_type(&bits_, "NEF_FW");
1155  indexNNeutrals_FW_ = index_type(&bits_, "nNeutrals_FW");
1156  if (quality_ == TIGHTLEPVETO) {
1157  indexMUF_ = index_type(&bits_, "MUF");
1158  indexMUF_TR_ = index_type(&bits_, "MUF_TR");
1159  indexCEF_TR_ = index_type(&bits_, "CEF_TR");
1160  }
1161  }
1162  if ((version_ == SUMMER18PUPPI) || (version_ == RUN2ULPUPPI)) {
1163  indexNHF_TR_ = index_type(&bits_, "NHF_TR");
1164  indexNEF_TR_ = index_type(&bits_, "NEF_TR");
1165  indexNHF_EC_ = index_type(&bits_, "NHF_EC");
1166  indexNHF_FW_ = index_type(&bits_, "NHF_FW");
1167  indexNEF_FW_ = index_type(&bits_, "NEF_FW");
1168  indexNNeutrals_FW_L_ = index_type(&bits_, "nNeutrals_FW_L");
1169  indexNNeutrals_FW_U_ = index_type(&bits_, "nNeutrals_FW_U");
1170  if (quality_ == TIGHTLEPVETO) {
1171  indexMUF_ = index_type(&bits_, "MUF");
1172  indexMUF_TR_ = index_type(&bits_, "MUF_TR");
1173  indexCEF_TR_ = index_type(&bits_, "CEF_TR");
1174  }
1175  }
1176  if (version_ == RUN2UL16CHS) {
1177  indexNHF_TR_ = index_type(&bits_, "NHF_TR");
1178  indexNEF_TR_ = index_type(&bits_, "NEF_TR");
1179  indexNHF_EC_ = index_type(&bits_, "NHF_EC");
1180  indexNEF_EC_L_ = index_type(&bits_, "NEF_EC_L");
1181  indexNEF_EC_U_ = index_type(&bits_, "NEF_EC_U");
1182  indexNNeutrals_EC_ = index_type(&bits_, "nNeutrals_EC");
1183  indexNHF_FW_ = index_type(&bits_, "NHF_FW");
1184  indexNEF_FW_ = index_type(&bits_, "NEF_FW");
1185  indexNNeutrals_FW_ = index_type(&bits_, "nNeutrals_FW");
1186  if (quality_ == TIGHTLEPVETO) {
1187  indexMUF_ = index_type(&bits_, "MUF");
1188  }
1189  }
1190  if (version_ == RUN2UL16PUPPI) {
1191  indexNHF_TR_ = index_type(&bits_, "NHF_TR");
1192  indexNEF_TR_ = index_type(&bits_, "NEF_TR");
1193  indexNNeutrals_EC_ = index_type(&bits_, "nNeutrals_EC");
1194  indexNEF_FW_ = index_type(&bits_, "NEF_FW");
1195  indexNNeutrals_FW_L_ = index_type(&bits_, "nNeutrals_FW_L");
1196  indexNNeutrals_FW_U_ = index_type(&bits_, "nNeutrals_FW_U");
1197  if (quality_ == TIGHTLEPVETO) {
1198  indexMUF_ = index_type(&bits_, "MUF");
1199  }
1200  }
1202  }
1203 
1206 
1214 
1220 
1226 
1232 };
1233 
1234 #endif
T getParameter(std::string const &) const
float photonEnergy() const
photonEnergy
Definition: PFJet.h:106
float neutralHadronEnergyFraction() const
neutralHadronEnergyFraction (relative to uncorrected jet energy)
Definition: Jet.h:377
float muonEnergy() const
muonEnergy
Definition: Jet.h:393
double eta() const final
momentum pseudorapidity
bool jecSetsAvailable() const
Definition: Jet.h:131
float muonEnergy() const
muonEnergy
Definition: PFJet.h:114
float chargedHadronEnergy() const
chargedHadronEnergy
Definition: Jet.h:658
float chargedEmEnergy() const
chargedEmEnergy
Definition: PFJet.h:142
float neutralEmEnergy() const
neutralEmEnergy
Definition: Jet.h:679
float chargedHadronEnergyFraction() const
chargedHadronEnergyFraction (relative to uncorrected jet energy)
Definition: Jet.h:375
PFJetIDSelectionFunctor(edm::ParameterSet const &params, edm::ConsumesCollector &iC)
Base class for all types of Jets.
Definition: Jet.h:20
float neutralHadronEnergy() const
neutralHadronEnergy
Definition: Jet.h:665
float chargedEmEnergyFraction() const
chargedEmEnergyFraction (relative to uncorrected jet energy)
Definition: Jet.h:379
bool exists(std::string const &parameterName) const
checks if a parameter exists
bool hasUserFloat(const std::string &key) const
Return true if there is a user-defined float with a given name.
Definition: PATObject.h:334
pat::strbitset::index_type index_type
Definition: Selector.h:27
void setIgnored(pat::strbitset &ret)
set ignored bits
Definition: Selector.h:222
int neutralMultiplicity() const
neutralMultiplicity
Definition: Jet.h:425
pat::strbitset retInternal_
internal ret if users don&#39;t care about return bits
Definition: Selector.h:285
Jets made from CaloTowers.
Definition: BasicJet.h:20
int chargedMultiplicity() const
chargedMultiplicity
Definition: PFJet.h:155
Jets made from PFObjects.
Definition: PFJet.h:21
PFJetIDSelectionFunctor(Version_t version, Quality_t quality)
float neutralEmEnergy() const
neutralEmEnergy
Definition: PFJet.h:150
bool operator()(const reco::PFJet &jet, pat::strbitset &ret)
float userFloat(const std::string &key) const
Definition: PATObject.h:791
float chargedEmEnergy() const
chargedEmEnergy
Definition: Jet.h:672
float electronEnergy() const
electronEnergy
Definition: PFJet.h:110
size_t numberOfDaughters() const override
number of daughters
PFJetIDSelectionFunctor(edm::ParameterSet const &params)
pat::strbitset bits_
the bitset indexed by strings
Definition: Selector.h:284
void passCut(pat::strbitset &ret, std::string const &s)
Passing cuts.
Definition: Selector.h:174
float HFEMEnergy() const
HFEMEnergy.
Definition: PFJet.h:122
bool ignoreCut(std::string const &s) const
ignore the cut at index "s"
Definition: Selector.h:157
const_iterator end() const
last daughter const_iterator
Definition: Candidate.h:146
double energy() const final
energy
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
virtual void push_back(std::string const &s)
This is the registration of an individual cut string.
Definition: Selector.h:44
bool operator()(const reco::PFJet &jet)
Functor that operates on <T>
Definition: Selector.h:23
PF Jet selector for pat::Jets.
bool isPFJet() const
check to see if the jet is a reco::PFJet
Definition: Jet.h:258
int neutralMultiplicity() const
neutralMultiplicity
Definition: PFJet.h:157
bool operator()(const pat::Jet &jet, pat::strbitset &ret) override
strbitset & set(bool val=true)
set method of all bits
Definition: strbitset.h:144
std::string currentJECLevel() const
return the name of the current step of jet energy corrections
Definition: Jet.h:141
Analysis-level calorimeter jet class.
Definition: Jet.h:80
size_t numberOfDaughters() const override
pat::strbitset getBitTemplate() const
Get an empty bitset with the proper names.
Definition: Selector.h:210
bool isBasicJet() const
check to see if the jet is no more than a reco::BasicJet
Definition: Jet.h:260
const_iterator begin() const
first daughter const_iterator
Definition: Candidate.h:144
float neutralHadronEnergy() const
neutralHadronEnergy
Definition: PFJet.h:102
float muonEnergyFraction() const
muonEnergyFraction (relative to corrected jet energy)
Definition: Jet.h:395
void setIgnoredCuts(std::vector< std::string > const &bitsToIgnore)
set the bits to ignore from a vector
Definition: Selector.h:165
float neutralEmEnergyFraction() const
neutralEmEnergyFraction (relative to uncorrected jet energy)
Definition: Jet.h:381
Jet correctedJet(const std::string &level, const std::string &flavor="none", const std::string &set="") const
int chargedMultiplicity() const
chargedMultiplicity
Definition: Jet.h:693
bool firstDataCuts(reco::Jet const &jet, pat::strbitset &ret, Version_t version_)
float chargedHadronEnergy() const
chargedHadronEnergy
Definition: PFJet.h:98
int cut(index_type const &i, int val) const
Access the int cut values at index "s".
Definition: Selector.h:192