CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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_ = RUN2ULCHS; //set RUN2ULCHS 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->neutralMultiplicity() + patJet->chargedMultiplicity();
338  nneutrals = patJet->neutralMultiplicity();
339  }
340  // Handle the special case where this is a composed jet for
341  // subjet analyses
342  else if (patJet->isBasicJet()) {
343  double e_chf = 0.0;
344  double e_nhf = 0.0;
345  double e_cef = 0.0;
346  double e_nef = 0.0;
347  double e_muf = 0.0;
348  nch = 0;
349  nconstituents = 0;
350  nneutrals = 0;
351 
352  for (reco::Jet::const_iterator ibegin = patJet->begin(), iend = patJet->end(), isub = ibegin; isub != iend;
353  ++isub) {
354  reco::PFJet const *pfsub = dynamic_cast<reco::PFJet const *>(&*isub);
355  pat::Jet const *patsub = dynamic_cast<pat::Jet const *>(&*isub);
356  if (patsub) {
357  e_chf += patsub->chargedHadronEnergy();
358  e_nhf += patsub->neutralHadronEnergy();
359  e_cef += patsub->chargedEmEnergy();
360  e_nef += patsub->neutralEmEnergy();
361  e_muf += patsub->muonEnergy();
362  nch += patsub->chargedMultiplicity();
363  nconstituents += patsub->neutralMultiplicity() + patsub->chargedMultiplicity();
364  nneutrals += patsub->neutralMultiplicity();
365  } else if (pfsub) {
366  e_chf += pfsub->chargedHadronEnergy();
367  e_nhf += pfsub->neutralHadronEnergy();
368  e_cef += pfsub->chargedEmEnergy();
369  e_nef += pfsub->neutralEmEnergy();
370  e_muf += pfsub->muonEnergy();
371  nch += pfsub->chargedMultiplicity();
372  nconstituents += pfsub->neutralMultiplicity() + pfsub->chargedMultiplicity();
373  nneutrals += pfsub->neutralMultiplicity();
374  } else
375  assert(0);
376  }
377  double e = patJet->energy();
378  if (e > 0.000001) {
379  chf = e_chf / e;
380  nhf = e_nhf / e;
381  cef = e_cef / e;
382  nef = e_nef / e;
383  muf = e_muf / e;
384  } else {
385  chf = nhf = cef = nef = muf = 0.0;
386  }
387  }
388  } // end if pat jet
389  else if (pfJet != nullptr) {
390  // CV: need to compute energy fractions in a way that works for corrected as well as for uncorrected PFJets
391  double jetEnergyUncorrected = pfJet->chargedHadronEnergy() + pfJet->neutralHadronEnergy() +
392  pfJet->photonEnergy() + pfJet->electronEnergy() + pfJet->muonEnergy() +
393  pfJet->HFEMEnergy();
394  if (jetEnergyUncorrected > 0.) {
395  chf = pfJet->chargedHadronEnergy() / jetEnergyUncorrected;
396  nhf = pfJet->neutralHadronEnergy() / jetEnergyUncorrected;
397  cef = pfJet->chargedEmEnergy() / jetEnergyUncorrected;
398  nef = pfJet->neutralEmEnergy() / jetEnergyUncorrected;
399  muf = pfJet->muonEnergy() / jetEnergyUncorrected;
400  }
401  nch = pfJet->chargedMultiplicity();
402  nconstituents = pfJet->neutralMultiplicity() + pfJet->chargedMultiplicity();
403  nneutrals = pfJet->neutralMultiplicity();
404  } // end if PF jet
405  // Handle the special case where this is a composed jet for
406  // subjet analyses
407  else if (basicJet != nullptr) {
408  double e_chf = 0.0;
409  double e_nhf = 0.0;
410  double e_cef = 0.0;
411  double e_nef = 0.0;
412  double e_muf = 0.0;
413  nch = 0;
414  nconstituents = 0;
415  for (reco::Jet::const_iterator ibegin = basicJet->begin(), iend = basicJet->end(), isub = ibegin; isub != iend;
416  ++isub) {
417  reco::PFJet const *pfsub = dynamic_cast<reco::PFJet const *>(&*isub);
418  e_chf += pfsub->chargedHadronEnergy();
419  e_nhf += pfsub->neutralHadronEnergy();
420  e_cef += pfsub->chargedEmEnergy();
421  e_nef += pfsub->neutralEmEnergy();
422  e_muf += pfsub->muonEnergy();
423  nch += pfsub->chargedMultiplicity();
424  nconstituents += pfsub->neutralMultiplicity() + pfsub->chargedMultiplicity();
425  nneutrals += pfsub->neutralMultiplicity();
426  }
427  double e = basicJet->energy();
428  if (e > 0.000001) {
429  chf = e_chf / e;
430  nhf = e_nhf / e;
431  cef = e_cef / e;
432  nef = e_nef / e;
433  muf = e_muf / e;
434  }
435  } // end if basic jet
436 
437  float etaB = 2.4;
438  // Cuts for |eta| < 2.6 for Summer18
439  if (version_ == SUMMER18 || version_ == SUMMER18PUPPI || version_ == RUN2ULCHS || version_ == RUN2ULPUPPI)
440  etaB = 2.6;
441  if ((version_ != WINTER17 && version_ != WINTER17PUPPI && version_ != SUMMER18 && version_ != SUMMER18PUPPI &&
442  version_ != RUN2UL16CHS && version_ != RUN2UL16PUPPI && version_ != RUN2ULCHS && version_ != RUN2ULPUPPI) ||
443  quality_ != TIGHT) {
444  if (ignoreCut(indexCEF_) || (cef < cut(indexCEF_, double()) || std::abs(jet.eta()) > etaB))
445  passCut(ret, indexCEF_);
446  }
447  if (ignoreCut(indexCHF_) || (chf > cut(indexCHF_, double()) || std::abs(jet.eta()) > etaB))
448  passCut(ret, indexCHF_);
449  if (ignoreCut(indexNCH_) || (nch > cut(indexNCH_, int()) || std::abs(jet.eta()) > etaB))
450  passCut(ret, indexNCH_);
451  if (version_ == FIRSTDATA) { // Cuts for all eta for FIRSTDATA
452  if (ignoreCut(indexNConstituents_) || (nconstituents > cut(indexNConstituents_, int())))
454  if (ignoreCut(indexNEF_) || (nef < cut(indexNEF_, double())))
455  passCut(ret, indexNEF_);
456  if (ignoreCut(indexNHF_) || (nhf < cut(indexNHF_, double())))
457  passCut(ret, indexNHF_);
458  } else if (version_ == RUNIISTARTUP) {
459  // Cuts for |eta| <= 3.0 for RUNIISTARTUP scenario
461  (nconstituents > cut(indexNConstituents_, int()) || std::abs(jet.eta()) > 3.0))
463  if (ignoreCut(indexNEF_) || (nef < cut(indexNEF_, double()) || std::abs(jet.eta()) > 3.0))
464  passCut(ret, indexNEF_);
465  if (ignoreCut(indexNHF_) || (nhf < cut(indexNHF_, double()) || std::abs(jet.eta()) > 3.0))
466  passCut(ret, indexNHF_);
467  // Cuts for |eta| > 3.0 for RUNIISTARTUP scenario
468  if (ignoreCut(indexNEF_FW_) || (nef < cut(indexNEF_FW_, double()) || std::abs(jet.eta()) <= 3.0))
469  passCut(ret, indexNEF_FW_);
470  if (ignoreCut(indexNNeutrals_FW_) || (nneutrals > cut(indexNNeutrals_FW_, int()) || std::abs(jet.eta()) <= 3.0))
472  } else if (version_ == WINTER16) {
473  // Cuts for |eta| <= 2.7 for WINTER16 scenario
475  (nconstituents > cut(indexNConstituents_, int()) || std::abs(jet.eta()) > 2.7))
477  if (ignoreCut(indexNEF_) || (nef < cut(indexNEF_, double()) || std::abs(jet.eta()) > 2.7))
478  passCut(ret, indexNEF_);
479  if (ignoreCut(indexNHF_) || (nhf < cut(indexNHF_, double()) || std::abs(jet.eta()) > 2.7))
480  passCut(ret, indexNHF_);
481  if (quality_ == TIGHTLEPVETO) {
482  if (ignoreCut(indexMUF_) || (muf < cut(indexMUF_, double()) || std::abs(jet.eta()) > 2.7))
483  passCut(ret, indexMUF_);
484  }
485 
486  // Cuts for 2.7 < |eta| <= 3.0 for WINTER16 scenario
487  if (ignoreCut(indexNHF_EC_) ||
488  (nhf < cut(indexNHF_EC_, double()) || std::abs(jet.eta()) <= 2.7 || std::abs(jet.eta()) > 3.0))
489  passCut(ret, indexNHF_EC_);
490  if (ignoreCut(indexNEF_EC_) ||
491  (nef > cut(indexNEF_EC_, double()) || std::abs(jet.eta()) <= 2.7 || std::abs(jet.eta()) > 3.0))
492  passCut(ret, indexNEF_EC_);
494  (nneutrals > cut(indexNNeutrals_EC_, int()) || std::abs(jet.eta()) <= 2.7 || std::abs(jet.eta()) > 3.0))
496 
497  // Cuts for |eta| > 3.0 for WINTER16 scenario
498  if (ignoreCut(indexNEF_FW_) || (nef < cut(indexNEF_FW_, double()) || std::abs(jet.eta()) <= 3.0))
499  passCut(ret, indexNEF_FW_);
500  if (ignoreCut(indexNNeutrals_FW_) || (nneutrals > cut(indexNNeutrals_FW_, int()) || std::abs(jet.eta()) <= 3.0))
502  } else if (version_ == WINTER17) {
503  // Cuts for |eta| <= 2.7 for WINTER17 scenario
505  (nconstituents > cut(indexNConstituents_, int()) || std::abs(jet.eta()) > 2.7))
507  if (ignoreCut(indexNEF_) || (nef < cut(indexNEF_, double()) || std::abs(jet.eta()) > 2.7))
508  passCut(ret, indexNEF_);
509  if (ignoreCut(indexNHF_) || (nhf < cut(indexNHF_, double()) || std::abs(jet.eta()) > 2.7))
510  passCut(ret, indexNHF_);
511  if (quality_ == TIGHTLEPVETO) {
512  if (ignoreCut(indexMUF_) || (muf < cut(indexMUF_, double()) || std::abs(jet.eta()) > 2.7))
513  passCut(ret, indexMUF_);
514  }
515 
516  // Cuts for 2.7 < |eta| <= 3.0 for WINTER17 scenario
517 
518  if (ignoreCut(indexNEF_EC_L_) ||
519  (nef > cut(indexNEF_EC_L_, double()) || std::abs(jet.eta()) <= 2.7 || std::abs(jet.eta()) > 3.0))
520  passCut(ret, indexNEF_EC_L_);
521  if (ignoreCut(indexNEF_EC_U_) ||
522  (nef < cut(indexNEF_EC_U_, double()) || std::abs(jet.eta()) <= 2.7 || std::abs(jet.eta()) > 3.0))
523  passCut(ret, indexNEF_EC_U_);
525  (nneutrals > cut(indexNNeutrals_EC_, int()) || std::abs(jet.eta()) <= 2.7 || std::abs(jet.eta()) > 3.0))
527 
528  // Cuts for |eta| > 3.0 for WINTER17 scenario
529  if (ignoreCut(indexNHF_FW_) || (nhf > cut(indexNHF_FW_, double()) || std::abs(jet.eta()) <= 3.0))
530  passCut(ret, indexNHF_FW_);
531  if (ignoreCut(indexNEF_FW_) || (nef < cut(indexNEF_FW_, double()) || std::abs(jet.eta()) <= 3.0))
532  passCut(ret, indexNEF_FW_);
533  if (ignoreCut(indexNNeutrals_FW_) || (nneutrals > cut(indexNNeutrals_FW_, int()) || std::abs(jet.eta()) <= 3.0))
535 
536  } else if (version_ == WINTER17PUPPI) {
537  // Cuts for |eta| <= 2.7 for WINTER17 scenario
539  (nconstituents > cut(indexNConstituents_, int()) || std::abs(jet.eta()) > 2.7))
541  if (ignoreCut(indexNEF_) || (nef < cut(indexNEF_, double()) || std::abs(jet.eta()) > 2.7))
542  passCut(ret, indexNEF_);
543  if (ignoreCut(indexNHF_) || (nhf < cut(indexNHF_, double()) || std::abs(jet.eta()) > 2.7))
544  passCut(ret, indexNHF_);
545  if (quality_ == TIGHTLEPVETO) {
546  if (ignoreCut(indexMUF_) || (muf < cut(indexMUF_, double()) || std::abs(jet.eta()) > 2.7))
547  passCut(ret, indexMUF_);
548  }
549 
550  // Cuts for 2.7 < |eta| <= 3.0 for WINTER17 scenario
551 
552  if (ignoreCut(indexNHF_EC_) ||
553  (nhf < cut(indexNHF_EC_, double()) || std::abs(jet.eta()) <= 2.7 || std::abs(jet.eta()) > 3.0))
554  passCut(ret, indexNHF_EC_);
555 
556  // Cuts for |eta| > 3.0 for WINTER17 scenario
557  if (ignoreCut(indexNHF_FW_) || (nhf > cut(indexNHF_FW_, double()) || std::abs(jet.eta()) <= 3.0))
558  passCut(ret, indexNHF_FW_);
559  if (ignoreCut(indexNEF_FW_) || (nef < cut(indexNEF_FW_, double()) || std::abs(jet.eta()) <= 3.0))
560  passCut(ret, indexNEF_FW_);
562  (nneutrals > cut(indexNNeutrals_FW_L_, int()) || std::abs(jet.eta()) <= 3.0))
565  (nneutrals < cut(indexNNeutrals_FW_U_, int()) || std::abs(jet.eta()) <= 3.0))
567 
568  } else if (version_ == RUN2UL16CHS) {
569  // Cuts for |eta| <= 2.4 for RUN2UL16CHS scenario
571  (nconstituents > cut(indexNConstituents_, int()) || std::abs(jet.eta()) > 2.4))
573  if (ignoreCut(indexNEF_) || (nef < cut(indexNEF_, double()) || std::abs(jet.eta()) > 2.4))
574  passCut(ret, indexNEF_);
575  if (ignoreCut(indexNHF_) || (nhf < cut(indexNHF_, double()) || std::abs(jet.eta()) > 2.4))
576  passCut(ret, indexNHF_);
577  if (quality_ == TIGHTLEPVETO) {
578  if (ignoreCut(indexMUF_) || (muf < cut(indexMUF_, double()) || std::abs(jet.eta()) > 2.4))
579  passCut(ret, indexMUF_);
580  }
581 
582  // Cuts for 2.4 <= |eta| <= 2.7 for RUN2UL16CHS scenario
583  if (ignoreCut(indexNHF_TR_) ||
584  (nhf < cut(indexNHF_TR_, double()) || std::abs(jet.eta()) <= 2.4 || std::abs(jet.eta()) > 2.7))
585  passCut(ret, indexNHF_TR_);
586  if (ignoreCut(indexNEF_TR_) ||
587  (nef < cut(indexNEF_TR_, double()) || std::abs(jet.eta()) <= 2.4 || std::abs(jet.eta()) > 2.7))
588  passCut(ret, indexNEF_TR_);
589 
590  // Cuts for 2.7 < |eta| <= 3.0 for RUN2UL16CHS scenario
591  if (ignoreCut(indexNHF_EC_) ||
592  (nhf < cut(indexNHF_EC_, double()) || std::abs(jet.eta()) <= 2.7 || std::abs(jet.eta()) > 3.0))
593  passCut(ret, indexNHF_EC_);
594  if (ignoreCut(indexNEF_EC_L_) ||
595  (nef > cut(indexNEF_EC_L_, double()) || std::abs(jet.eta()) <= 2.7 || std::abs(jet.eta()) > 3.0))
596  passCut(ret, indexNEF_EC_L_);
597  if (ignoreCut(indexNEF_EC_U_) ||
598  (nef < cut(indexNEF_EC_U_, double()) || std::abs(jet.eta()) <= 2.7 || std::abs(jet.eta()) > 3.0))
599  passCut(ret, indexNEF_EC_U_);
601  (nneutrals > cut(indexNNeutrals_EC_, int()) || std::abs(jet.eta()) <= 2.7 || std::abs(jet.eta()) > 3.0))
603 
604  // Cuts for |eta| > 3.0 for RUN2UL16CHS scenario
605  if (ignoreCut(indexNHF_FW_) || (nhf > cut(indexNHF_FW_, double()) || std::abs(jet.eta()) <= 3.0))
606  passCut(ret, indexNHF_FW_);
607  if (ignoreCut(indexNEF_FW_) || (nef < cut(indexNEF_FW_, double()) || std::abs(jet.eta()) <= 3.0))
608  passCut(ret, indexNEF_FW_);
609  if (ignoreCut(indexNNeutrals_FW_) || (nneutrals > cut(indexNNeutrals_FW_, int()) || std::abs(jet.eta()) <= 3.0))
611 
612  } else if (version_ == RUN2UL16PUPPI) {
613  // Cuts for |eta| <= 2.4 for RUN2UL16PUPPI scenario
615  (nconstituents > cut(indexNConstituents_, int()) || std::abs(jet.eta()) > 2.4))
617  if (ignoreCut(indexNEF_) || (nef < cut(indexNEF_, double()) || std::abs(jet.eta()) > 2.4))
618  passCut(ret, indexNEF_);
619  if (ignoreCut(indexNHF_) || (nhf < cut(indexNHF_, double()) || std::abs(jet.eta()) > 2.4))
620  passCut(ret, indexNHF_);
621  if (quality_ == TIGHTLEPVETO) {
622  if (ignoreCut(indexMUF_) || (muf < cut(indexMUF_, double()) || std::abs(jet.eta()) > 2.4))
623  passCut(ret, indexMUF_);
624  }
625 
626  // Cuts for 2.4 <= |eta| <= 2.7 for RUN2UL16PUPPI scenario
627  if (ignoreCut(indexNHF_TR_) ||
628  (nhf < cut(indexNHF_TR_, double()) || std::abs(jet.eta()) <= 2.4 || std::abs(jet.eta()) > 2.7))
629  passCut(ret, indexNHF_TR_);
630  if (ignoreCut(indexNEF_TR_) ||
631  (nef < cut(indexNEF_TR_, double()) || std::abs(jet.eta()) <= 2.4 || std::abs(jet.eta()) > 2.7))
632  passCut(ret, indexNEF_TR_);
633 
634  // Cuts for 2.7 < |eta| <= 3.0 for RUN2UL16PUPPI scenario
636  (nneutrals > cut(indexNNeutrals_EC_, int()) || std::abs(jet.eta()) <= 2.7 || std::abs(jet.eta()) > 3.0))
638 
639  // Cuts for |eta| > 3.0 for RUN2UL16PUPPI scenario
640  if (ignoreCut(indexNEF_FW_) || (nef < cut(indexNEF_FW_, double()) || std::abs(jet.eta()) <= 3.0))
641  passCut(ret, indexNEF_FW_);
643  (nneutrals > cut(indexNNeutrals_FW_L_, int()) || std::abs(jet.eta()) <= 3.0))
646  (nneutrals < cut(indexNNeutrals_FW_U_, int()) || std::abs(jet.eta()) <= 3.0))
648 
649  } else if ((version_ == SUMMER18) || (version_ == RUN2ULCHS)) {
650  // Cuts for |eta| <= 2.6 for SUMMER18 scenario
652  (nconstituents > cut(indexNConstituents_, int()) || std::abs(jet.eta()) > 2.6))
654  if (ignoreCut(indexNEF_) || (nef < cut(indexNEF_, double()) || std::abs(jet.eta()) > 2.6))
655  passCut(ret, indexNEF_);
656  if (ignoreCut(indexNHF_) || (nhf < cut(indexNHF_, double()) || std::abs(jet.eta()) > 2.6))
657  passCut(ret, indexNHF_);
658  if (quality_ == TIGHTLEPVETO) {
659  if (ignoreCut(indexMUF_) || (muf < cut(indexMUF_, double()) || std::abs(jet.eta()) > 2.6))
660  passCut(ret, indexMUF_);
661  }
662 
663  // Cuts for 2.6 <= |eta| <= 2.7 for SUMMER18 scenario
664  if (ignoreCut(indexNHF_TR_) ||
665  (nhf < cut(indexNHF_TR_, double()) || std::abs(jet.eta()) <= 2.6 || std::abs(jet.eta()) > 2.7))
666  passCut(ret, indexNHF_TR_);
667  if (ignoreCut(indexNEF_TR_) ||
668  (nef < cut(indexNEF_TR_, double()) || std::abs(jet.eta()) <= 2.6 || std::abs(jet.eta()) > 2.7))
669  passCut(ret, indexNEF_TR_);
670  if (ignoreCut(indexNCH_TR_) ||
671  (nch > cut(indexNCH_TR_, double()) || std::abs(jet.eta()) <= 2.6 || std::abs(jet.eta()) > 2.7))
672  passCut(ret, indexNCH_TR_);
673  if (quality_ == TIGHTLEPVETO) {
674  if (ignoreCut(indexMUF_TR_) ||
675  (muf < cut(indexMUF_TR_, double()) || std::abs(jet.eta()) <= 2.6 || std::abs(jet.eta()) > 2.7))
676  passCut(ret, indexMUF_TR_);
677  if (ignoreCut(indexCEF_TR_) ||
678  (cef < cut(indexCEF_TR_, double()) || std::abs(jet.eta()) <= 2.6 || std::abs(jet.eta()) > 2.7))
679  passCut(ret, indexCEF_TR_);
680  }
681 
682  // Cuts for 2.7 < |eta| <= 3.0 for SUMMER18 scenario
683  if (ignoreCut(indexNEF_EC_L_) ||
684  (nef > cut(indexNEF_EC_L_, double()) || std::abs(jet.eta()) <= 2.7 || std::abs(jet.eta()) > 3.0))
685  passCut(ret, indexNEF_EC_L_);
686  if (ignoreCut(indexNEF_EC_U_) ||
687  (nef < cut(indexNEF_EC_U_, double()) || std::abs(jet.eta()) <= 2.7 || std::abs(jet.eta()) > 3.0))
688  passCut(ret, indexNEF_EC_U_);
690  (nneutrals > cut(indexNNeutrals_EC_, int()) || std::abs(jet.eta()) <= 2.7 || std::abs(jet.eta()) > 3.0))
692 
693  // Cuts for |eta| > 3.0 for SUMMER18 scenario
694  if (ignoreCut(indexNHF_FW_) || (nhf > cut(indexNHF_FW_, double()) || std::abs(jet.eta()) <= 3.0))
695  passCut(ret, indexNHF_FW_);
696  if (ignoreCut(indexNEF_FW_) || (nef < cut(indexNEF_FW_, double()) || std::abs(jet.eta()) <= 3.0))
697  passCut(ret, indexNEF_FW_);
698  if (ignoreCut(indexNNeutrals_FW_) || (nneutrals > cut(indexNNeutrals_FW_, int()) || std::abs(jet.eta()) <= 3.0))
700  }
701 
702  else if ((version_ == SUMMER18PUPPI) || (version_ == RUN2ULPUPPI)) {
703  // Cuts for |eta| <= 2.6 for SUMMER18PUPPI scenario
705  (nconstituents > cut(indexNConstituents_, int()) || std::abs(jet.eta()) > 2.6))
707  if (ignoreCut(indexNEF_) || (nef < cut(indexNEF_, double()) || std::abs(jet.eta()) > 2.6))
708  passCut(ret, indexNEF_);
709  if (ignoreCut(indexNHF_) || (nhf < cut(indexNHF_, double()) || std::abs(jet.eta()) > 2.6))
710  passCut(ret, indexNHF_);
711  if (quality_ == TIGHTLEPVETO) {
712  if (ignoreCut(indexMUF_) || (muf < cut(indexMUF_, double()) || std::abs(jet.eta()) > 2.6))
713  passCut(ret, indexMUF_);
714  }
715 
716  // Cuts for 2.6 <= |eta| <= 2.7 for SUMMER18PUPPI scenario
717  if (ignoreCut(indexNHF_TR_) ||
718  (nhf < cut(indexNHF_TR_, double()) || std::abs(jet.eta()) <= 2.6 || std::abs(jet.eta()) > 2.7))
719  passCut(ret, indexNHF_TR_);
720  if (ignoreCut(indexNEF_TR_) ||
721  (nef < cut(indexNEF_TR_, double()) || std::abs(jet.eta()) <= 2.6 || std::abs(jet.eta()) > 2.7))
722  passCut(ret, indexNEF_TR_);
723  if (quality_ == TIGHTLEPVETO) {
724  if (ignoreCut(indexMUF_TR_) ||
725  (muf < cut(indexMUF_TR_, double()) || std::abs(jet.eta()) <= 2.6 || std::abs(jet.eta()) > 2.7))
726  passCut(ret, indexMUF_TR_);
727  if (ignoreCut(indexCEF_TR_) ||
728  (cef < cut(indexCEF_TR_, double()) || std::abs(jet.eta()) <= 2.6 || std::abs(jet.eta()) > 2.7))
729  passCut(ret, indexCEF_TR_);
730  }
731 
732  // Cuts for 2.7 < |eta| <= 3.0 for SUMMER18PUPPI scenario
733  if (ignoreCut(indexNHF_EC_) ||
734  (nhf < cut(indexNHF_EC_, double()) || std::abs(jet.eta()) <= 2.7 || std::abs(jet.eta()) > 3.0))
735  passCut(ret, indexNHF_EC_);
736 
737  // Cuts for |eta| > 3.0 for SUMMER18PUPPI scenario
738  if (ignoreCut(indexNHF_FW_) || (nhf > cut(indexNHF_FW_, double()) || std::abs(jet.eta()) <= 3.0))
739  passCut(ret, indexNHF_FW_);
740  if (ignoreCut(indexNEF_FW_) || (nef < cut(indexNEF_FW_, double()) || std::abs(jet.eta()) <= 3.0))
741  passCut(ret, indexNEF_FW_);
743  (nneutrals > cut(indexNNeutrals_FW_L_, int()) || std::abs(jet.eta()) <= 3.0))
746  (nneutrals < cut(indexNNeutrals_FW_U_, int()) || std::abs(jet.eta()) <= 3.0))
748  }
749 
750  //std::cout << "<PFJetIDSelectionFunctor::firstDataCuts>:" << std::endl;
751  //std::cout << " jet: Pt = " << jet.pt() << ", eta = " << jet.eta() << ", phi = " << jet.phi() << std::endl;
752  //ret.print(std::cout);
753  setIgnored(ret);
754  return (bool)ret;
755  }
756 
757 private: // member variables
758  void initCuts() {
759  push_back("CHF");
760  push_back("NHF");
763  quality_ != TIGHT)
764  push_back("CEF");
765  push_back("NEF");
766  push_back("NCH");
767  push_back("nConstituents");
768  if (version_ == RUNIISTARTUP) {
769  push_back("NEF_FW");
770  push_back("nNeutrals_FW");
771  }
772  if (version_ == WINTER16) {
773  push_back("NHF_EC");
774  push_back("NEF_EC");
775  push_back("nNeutrals_EC");
776  push_back("NEF_FW");
777  push_back("nNeutrals_FW");
778  if (quality_ == TIGHTLEPVETO)
779  push_back("MUF");
780  }
781  if (version_ == WINTER17) {
782  push_back("NEF_EC_L");
783  push_back("NEF_EC_U");
784  push_back("nNeutrals_EC");
785  push_back("NEF_FW");
786  push_back("NHF_FW");
787  push_back("nNeutrals_FW");
788  if (quality_ == TIGHTLEPVETO)
789  push_back("MUF");
790  }
791  if (version_ == WINTER17PUPPI) {
792  push_back("NHF_EC");
793  push_back("NEF_FW");
794  push_back("NHF_FW");
795  push_back("nNeutrals_FW_L");
796  push_back("nNeutrals_FW_U");
797  if (quality_ == TIGHTLEPVETO)
798  push_back("MUF");
799  }
800  if (version_ == RUN2UL16CHS) {
801  push_back("NHF_TR");
802  push_back("NEF_TR");
803  push_back("NHF_EC");
804  push_back("NEF_EC_L");
805  push_back("NEF_EC_U");
806  push_back("nNeutrals_EC");
807  push_back("NEF_FW");
808  push_back("NHF_FW");
809  push_back("nNeutrals_FW");
810 
811  if (quality_ == TIGHTLEPVETO) {
812  push_back("MUF");
813  }
814  }
815  if (version_ == RUN2UL16PUPPI) {
816  push_back("NHF_TR");
817  push_back("NEF_TR");
818  push_back("nNeutrals_EC");
819  push_back("NEF_FW");
820  push_back("nNeutrals_FW_L");
821  push_back("nNeutrals_FW_U");
822 
823  if (quality_ == TIGHTLEPVETO) {
824  push_back("MUF");
825  }
826  }
827  if ((version_ == SUMMER18) || (version_ == RUN2ULCHS)) {
828  push_back("NHF_TR");
829  push_back("NEF_TR");
830  push_back("NCH_TR");
831  push_back("NEF_EC_L");
832  push_back("NEF_EC_U");
833  push_back("nNeutrals_EC");
834  push_back("NEF_FW");
835  push_back("NHF_FW");
836  push_back("nNeutrals_FW");
837 
838  if (quality_ == TIGHTLEPVETO) {
839  push_back("MUF");
840  push_back("MUF_TR");
841  push_back("CEF_TR");
842  }
843  }
844  if ((version_ == SUMMER18PUPPI) || (version_ == RUN2ULPUPPI)) {
845  push_back("NHF_TR");
846  push_back("NEF_TR");
847  push_back("NHF_EC");
848  push_back("NEF_FW");
849  push_back("NHF_FW");
850  push_back("nNeutrals_FW_L");
851  push_back("nNeutrals_FW_U");
852 
853  if (quality_ == TIGHTLEPVETO) {
854  push_back("MUF");
855  push_back("MUF_TR");
856  push_back("CEF_TR");
857  }
858  }
859 
862  quality_ == LOOSE) {
863  edm::LogWarning("BadJetIDVersion")
864  << "The LOOSE operating point is only supported for the WINTER16 JetID version -- defaulting to TIGHT";
865  quality_ = TIGHT;
866  }
867 
868  // Set some default cuts for LOOSE, TIGHT
869  if (quality_ == LOOSE) {
870  set("CHF", 0.0);
871  set("NHF", 0.99);
872  set("CEF", 0.99);
873  set("NEF", 0.99);
874  set("NCH", 0);
875  set("nConstituents", 1);
876  if (version_ == RUNIISTARTUP) {
877  set("NEF_FW", 0.90);
878  set("nNeutrals_FW", 10);
879  } else if (version_ == WINTER16) {
880  set("NHF_EC", 0.98);
881  set("NEF_EC", 0.01);
882  set("nNeutrals_EC", 2);
883  set("NEF_FW", 0.90);
884  set("nNeutrals_FW", 10);
885  }
886  } else if (quality_ == TIGHT) {
887  set("CHF", 0.0);
888  set("NHF", 0.9);
891  set("CEF", 0.99);
892  set("NEF", 0.9);
893  set("NCH", 0);
894  set("nConstituents", 1);
895  if (version_ == RUNIISTARTUP) {
896  set("NEF_FW", 0.90);
897  set("nNeutrals_FW", 10);
898  } else if (version_ == WINTER16) {
899  set("NHF_EC", 0.98);
900  set("NEF_EC", 0.01);
901  set("nNeutrals_EC", 2);
902  set("NEF_FW", 0.90);
903  set("nNeutrals_FW", 10);
904  } else if (version_ == WINTER17) {
905  set("NEF_EC_L", 0.02);
906  set("NEF_EC_U", 0.99);
907  set("nNeutrals_EC", 2);
908  set("NHF_FW", 0.02);
909  set("NEF_FW", 0.90);
910  set("nNeutrals_FW", 10);
911  } else if (version_ == WINTER17PUPPI) {
912  set("NHF_EC", 0.99);
913  set("NHF_FW", 0.02);
914  set("NEF_FW", 0.90);
915  set("nNeutrals_FW_L", 2);
916  set("nNeutrals_FW_U", 15);
917  } else if (version_ == SUMMER18) {
918  set("NHF_TR", 0.9);
919  set("NEF_TR", 0.99);
920  set("NCH_TR", 0);
921  set("NEF_EC_L", 0.02);
922  set("NEF_EC_U", 0.99);
923  set("nNeutrals_EC", 2);
924  set("NHF_FW", 0.2);
925  set("NEF_FW", 0.90);
926  set("nNeutrals_FW", 10);
927  } else if (version_ == SUMMER18PUPPI) {
928  set("NHF_TR", 0.9);
929  set("NEF_TR", 0.99);
930  set("NHF_EC", 0.99);
931  set("NHF_FW", 0.02);
932  set("NEF_FW", 0.90);
933  set("nNeutrals_FW_L", 2);
934  set("nNeutrals_FW_U", 15);
935  } else if (version_ == RUN2UL16CHS) {
936  set("NHF_TR", 0.9);
937  set("NEF_TR", 0.99);
938  set("NHF_EC", 0.9);
939  set("NEF_EC_L", 0.);
940  set("NEF_EC_U", 0.99);
941  set("nNeutrals_EC", 1);
942  set("NHF_FW", 0.2);
943  set("NEF_FW", 0.90);
944  set("nNeutrals_FW", 10);
945  } else if (version_ == RUN2UL16PUPPI) {
946  set("NHF_TR", 0.98);
947  set("NEF_TR", 0.99);
948  set("nNeutrals_EC", 1);
949  set("NEF_FW", 0.90);
950  set("nNeutrals_FW_L", 2);
951  set("nNeutrals_FW_U", 999999);
952  } else if (version_ == RUN2ULCHS) {
953  set("NHF_TR", 0.9);
954  set("NEF_TR", 0.99);
955  set("NCH_TR", 0);
956  set("NEF_EC_L", 0.01);
957  set("NEF_EC_U", 0.99);
958  set("nNeutrals_EC", 2);
959  set("NHF_FW", 0.2);
960  set("NEF_FW", 0.90);
961  set("nNeutrals_FW", 10);
962  } else if (version_ == RUN2ULPUPPI) {
963  set("NHF_TR", 0.9);
964  set("NEF_TR", 0.99);
965  set("NHF_EC", 0.9999);
966  set("NHF_FW", -1.0);
967  set("NEF_FW", 0.90);
968  set("nNeutrals_FW_L", 2);
969  set("nNeutrals_FW_U", 999999);
970  }
971  } else if (quality_ == TIGHTLEPVETO) {
972  set("CHF", 0.0);
973  set("NHF", 0.9);
974  set("NEF", 0.9);
975  set("NCH", 0);
976  set("nConstituents", 1);
977  if (version_ == WINTER17) {
978  set("CEF", 0.8);
979  set("NEF_EC_L", 0.02);
980  set("NEF_EC_U", 0.99);
981  set("nNeutrals_EC", 2);
982  set("NHF_FW", 0.02);
983  set("NEF_FW", 0.90);
984  set("nNeutrals_FW", 10);
985  set("MUF", 0.8);
986  } else if (version_ == WINTER17PUPPI) {
987  set("CEF", 0.8);
988  set("NHF_EC", 0.99);
989  set("NHF_FW", 0.02);
990  set("NEF_FW", 0.90);
991  set("nNeutrals_FW_L", 2);
992  set("nNeutrals_FW_U", 15);
993  set("MUF", 0.8);
994  } else if (version_ == WINTER16) {
995  set("CEF", 0.9);
996  set("NEF_EC", 0.01);
997  set("NHF_EC", 0.98);
998  set("nNeutrals_EC", 2);
999  set("nNeutrals_FW", 10);
1000  set("NEF_FW", 0.90);
1001  set("MUF", 0.8);
1002  } else if (version_ == WINTER17PUPPI) {
1003  set("CEF", 0.8);
1004  set("NHF_EC", 0.99);
1005  set("NHF_FW", 0.02);
1006  set("NEF_FW", 0.90);
1007  set("nNeutrals_FW_L", 2);
1008  set("nNeutrals_FW_U", 15);
1009  set("MUF", 0.8);
1010  } else if (version_ == WINTER16) {
1011  set("CEF", 0.9);
1012  set("NEF_EC", 0.01);
1013  set("NHF_EC", 0.98);
1014  set("nNeutrals_EC", 2);
1015  set("nNeutrals_FW", 10);
1016  set("NEF_FW", 0.90);
1017  set("MUF", 0.8);
1018  } else if (version_ == SUMMER18) {
1019  set("CEF", 0.8);
1020  set("MUF", 0.8);
1021  set("NHF_TR", 0.9);
1022  set("NEF_TR", 0.99);
1023  set("MUF_TR", 0.8);
1024  set("NCH_TR", 0);
1025  set("CEF_TR", 0.8);
1026  set("NEF_EC_L", 0.02);
1027  set("NEF_EC_U", 0.99);
1028  set("nNeutrals_EC", 2);
1029  set("NHF_FW", 0.2);
1030  set("NEF_FW", 0.90);
1031  set("nNeutrals_FW", 10);
1032  } else if (version_ == SUMMER18PUPPI) {
1033  set("CEF", 0.8);
1034  set("MUF", 0.8);
1035  set("NHF_TR", 0.9);
1036  set("NEF_TR", 0.99);
1037  set("MUF_TR", 0.8);
1038  set("CEF_TR", 0.8);
1039  set("NHF_EC", 0.99);
1040  set("NHF_FW", 0.02);
1041  set("NEF_FW", 0.90);
1042  set("nNeutrals_FW_L", 2);
1043  set("nNeutrals_FW_U", 15);
1044  } else if (version_ == RUN2UL16CHS) {
1045  set("MUF", 0.8);
1046  set("CEF", 0.8);
1047  set("NHF_TR", 0.9);
1048  set("NEF_TR", 0.99);
1049  set("NHF_EC", 0.9);
1050  set("NEF_EC_L", 0.);
1051  set("NEF_EC_U", 0.99);
1052  set("nNeutrals_EC", 1);
1053  set("NHF_FW", 0.2);
1054  set("NEF_FW", 0.90);
1055  set("nNeutrals_FW", 10);
1056  } else if (version_ == RUN2UL16PUPPI) {
1057  set("MUF", 0.8);
1058  set("CEF", 0.8);
1059  set("NHF_TR", 0.98);
1060  set("NEF_TR", 0.99);
1061  set("nNeutrals_EC", 1);
1062  set("NEF_FW", 0.90);
1063  set("nNeutrals_FW_L", 2);
1064  set("nNeutrals_FW_U", 999999);
1065  } else if (version_ == RUN2ULCHS) {
1066  set("CEF", 0.8);
1067  set("MUF", 0.8);
1068  set("NHF_TR", 0.9);
1069  set("NEF_TR", 0.99);
1070  set("MUF_TR", 0.8);
1071  set("NCH_TR", 0);
1072  set("CEF_TR", 0.8);
1073  set("NEF_EC_L", 0.01);
1074  set("NEF_EC_U", 0.99);
1075  set("nNeutrals_EC", 2);
1076  set("NHF_FW", 0.2);
1077  set("NEF_FW", 0.90);
1078  set("nNeutrals_FW", 10);
1079  } else if (version_ == RUN2ULPUPPI) {
1080  set("CEF", 0.8);
1081  set("MUF", 0.8);
1082  set("NHF_TR", 0.9);
1083  set("NEF_TR", 0.99);
1084  set("MUF_TR", 0.8);
1085  set("CEF_TR", 0.8);
1086  set("NHF_EC", 0.9999);
1087  set("NHF_FW", -1.0);
1088  set("NEF_FW", 0.90);
1089  set("nNeutrals_FW_L", 2);
1090  set("nNeutrals_FW_U", 999999);
1091  }
1092  }
1093  }
1094 
1095  void initIndex() {
1096  indexNConstituents_ = index_type(&bits_, "nConstituents");
1097  indexNEF_ = index_type(&bits_, "NEF");
1098  indexNHF_ = index_type(&bits_, "NHF");
1101  quality_ != TIGHT)
1102  indexCEF_ = index_type(&bits_, "CEF");
1103 
1104  indexCHF_ = index_type(&bits_, "CHF");
1105  indexNCH_ = index_type(&bits_, "NCH");
1106  if (version_ == RUNIISTARTUP) {
1107  indexNEF_FW_ = index_type(&bits_, "NEF_FW");
1108  indexNNeutrals_FW_ = index_type(&bits_, "nNeutrals_FW");
1109  }
1110  if (version_ == WINTER16) {
1111  indexNHF_EC_ = index_type(&bits_, "NHF_EC");
1112  indexNEF_EC_ = index_type(&bits_, "NEF_EC");
1113  indexNNeutrals_EC_ = index_type(&bits_, "nNeutrals_EC");
1114  indexNEF_FW_ = index_type(&bits_, "NEF_FW");
1115  indexNNeutrals_FW_ = index_type(&bits_, "nNeutrals_FW");
1116  if (quality_ == TIGHTLEPVETO) {
1117  indexMUF_ = index_type(&bits_, "MUF");
1118  }
1119  }
1120  if (version_ == WINTER17) {
1121  indexNEF_EC_L_ = index_type(&bits_, "NEF_EC_L");
1122  indexNEF_EC_U_ = index_type(&bits_, "NEF_EC_U");
1123  indexNNeutrals_EC_ = index_type(&bits_, "nNeutrals_EC");
1124  indexNHF_FW_ = index_type(&bits_, "NHF_FW");
1125  indexNEF_FW_ = index_type(&bits_, "NEF_FW");
1126  indexNNeutrals_FW_ = index_type(&bits_, "nNeutrals_FW");
1127  if (quality_ == TIGHTLEPVETO) {
1128  indexMUF_ = index_type(&bits_, "MUF");
1129  }
1130  }
1131  if (version_ == WINTER17PUPPI) {
1132  indexNHF_EC_ = index_type(&bits_, "NHF_EC");
1133  indexNHF_FW_ = index_type(&bits_, "NHF_FW");
1134  indexNEF_FW_ = index_type(&bits_, "NEF_FW");
1135  indexNNeutrals_FW_L_ = index_type(&bits_, "nNeutrals_FW_L");
1136  indexNNeutrals_FW_U_ = index_type(&bits_, "nNeutrals_FW_U");
1137  if (quality_ == TIGHTLEPVETO) {
1138  indexMUF_ = index_type(&bits_, "MUF");
1139  }
1140  }
1141  if ((version_ == SUMMER18) || (version_ == RUN2ULCHS)) {
1142  indexNHF_TR_ = index_type(&bits_, "NHF_TR");
1143  indexNEF_TR_ = index_type(&bits_, "NEF_TR");
1144  indexNCH_TR_ = index_type(&bits_, "NCH_TR");
1145  indexNEF_EC_L_ = index_type(&bits_, "NEF_EC_L");
1146  indexNEF_EC_U_ = index_type(&bits_, "NEF_EC_U");
1147  indexNNeutrals_EC_ = index_type(&bits_, "nNeutrals_EC");
1148  indexNHF_FW_ = index_type(&bits_, "NHF_FW");
1149  indexNEF_FW_ = index_type(&bits_, "NEF_FW");
1150  indexNNeutrals_FW_ = index_type(&bits_, "nNeutrals_FW");
1151  if (quality_ == TIGHTLEPVETO) {
1152  indexMUF_ = index_type(&bits_, "MUF");
1153  indexMUF_TR_ = index_type(&bits_, "MUF_TR");
1154  indexCEF_TR_ = index_type(&bits_, "CEF_TR");
1155  }
1156  }
1157  if ((version_ == SUMMER18PUPPI) || (version_ == RUN2ULPUPPI)) {
1158  indexNHF_TR_ = index_type(&bits_, "NHF_TR");
1159  indexNEF_TR_ = index_type(&bits_, "NEF_TR");
1160  indexNHF_EC_ = index_type(&bits_, "NHF_EC");
1161  indexNHF_FW_ = index_type(&bits_, "NHF_FW");
1162  indexNEF_FW_ = index_type(&bits_, "NEF_FW");
1163  indexNNeutrals_FW_L_ = index_type(&bits_, "nNeutrals_FW_L");
1164  indexNNeutrals_FW_U_ = index_type(&bits_, "nNeutrals_FW_U");
1165  if (quality_ == TIGHTLEPVETO) {
1166  indexMUF_ = index_type(&bits_, "MUF");
1167  indexMUF_TR_ = index_type(&bits_, "MUF_TR");
1168  indexCEF_TR_ = index_type(&bits_, "CEF_TR");
1169  }
1170  }
1171  if (version_ == RUN2UL16CHS) {
1172  indexNHF_TR_ = index_type(&bits_, "NHF_TR");
1173  indexNEF_TR_ = index_type(&bits_, "NEF_TR");
1174  indexNHF_EC_ = index_type(&bits_, "NHF_EC");
1175  indexNEF_EC_L_ = index_type(&bits_, "NEF_EC_L");
1176  indexNEF_EC_U_ = index_type(&bits_, "NEF_EC_U");
1177  indexNNeutrals_EC_ = index_type(&bits_, "nNeutrals_EC");
1178  indexNHF_FW_ = index_type(&bits_, "NHF_FW");
1179  indexNEF_FW_ = index_type(&bits_, "NEF_FW");
1180  indexNNeutrals_FW_ = index_type(&bits_, "nNeutrals_FW");
1181  if (quality_ == TIGHTLEPVETO) {
1182  indexMUF_ = index_type(&bits_, "MUF");
1183  }
1184  }
1185  if (version_ == RUN2UL16PUPPI) {
1186  indexNHF_TR_ = index_type(&bits_, "NHF_TR");
1187  indexNEF_TR_ = index_type(&bits_, "NEF_TR");
1188  indexNNeutrals_EC_ = index_type(&bits_, "nNeutrals_EC");
1189  indexNEF_FW_ = index_type(&bits_, "NEF_FW");
1190  indexNNeutrals_FW_L_ = index_type(&bits_, "nNeutrals_FW_L");
1191  indexNNeutrals_FW_U_ = index_type(&bits_, "nNeutrals_FW_U");
1192  if (quality_ == TIGHTLEPVETO) {
1193  indexMUF_ = index_type(&bits_, "MUF");
1194  }
1195  }
1197  }
1198 
1201 
1209 
1215 
1221 
1227 };
1228 
1229 #endif
void set(std::string const &s, bool val=true)
Set a given selection cut, on or off.
Definition: Selector.h:93
float photonEnergy() const
photonEnergy
Definition: PFJet.h:103
tuple ret
prodAgent to be discontinued
float neutralHadronEnergyFraction() const
neutralHadronEnergyFraction (relative to uncorrected jet energy)
Definition: Jet.h:404
float muonEnergy() const
muonEnergy
Definition: Jet.h:430
bool jecSetsAvailable() const
Definition: Jet.h:129
float muonEnergy() const
muonEnergy
Definition: PFJet.h:111
float chargedHadronEnergy() const
chargedHadronEnergy
Definition: Jet.h:696
float chargedEmEnergy() const
chargedEmEnergy
Definition: PFJet.h:139
float neutralEmEnergy() const
neutralEmEnergy
Definition: Jet.h:726
float chargedHadronEnergyFraction() const
chargedHadronEnergyFraction (relative to uncorrected jet energy)
Definition: Jet.h:400
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:706
float chargedEmEnergyFraction() const
chargedEmEnergyFraction (relative to uncorrected jet energy)
Definition: Jet.h:408
bool exists(std::string const &parameterName) const
checks if a parameter exists
pat::strbitset::index_type index_type
Definition: Selector.h:25
void setIgnored(pat::strbitset &ret)
set ignored bits
Definition: Selector.h:181
int neutralMultiplicity() const
neutralMultiplicity
Definition: Jet.h:466
string quality
pat::strbitset retInternal_
internal ret if users don&#39;t care about return bits
Definition: Selector.h:242
Jets made from CaloTowers.
Definition: BasicJet.h:19
assert(be >=bs)
int chargedMultiplicity() const
chargedMultiplicity
Definition: PFJet.h:152
Jets made from PFObjects.
Definition: PFJet.h:20
PFJetIDSelectionFunctor(Version_t version, Quality_t quality)
float neutralEmEnergy() const
neutralEmEnergy
Definition: PFJet.h:147
bool operator()(const reco::PFJet &jet, pat::strbitset &ret)
float chargedEmEnergy() const
chargedEmEnergy
Definition: Jet.h:716
float electronEnergy() const
electronEnergy
Definition: PFJet.h:107
PFJetIDSelectionFunctor(edm::ParameterSet const &params)
pat::strbitset bits_
the bitset indexed by strings
Definition: Selector.h:241
void passCut(pat::strbitset &ret, std::string const &s)
Passing cuts.
Definition: Selector.h:142
float HFEMEnergy() const
HFEMEnergy.
Definition: PFJet.h:119
bool ignoreCut(std::string const &s) const
ignore the cut at index &quot;s&quot;
Definition: Selector.h:127
const_iterator end() const
last daughter const_iterator
Definition: Candidate.h:145
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:42
bool operator()(const reco::PFJet &jet)
Functor that operates on &lt;T&gt;
Definition: Selector.h:22
PF Jet selector for pat::Jets.
bool isPFJet() const
check to see if the jet is a reco::PFJet
Definition: Jet.h:275
int neutralMultiplicity() const
neutralMultiplicity
Definition: PFJet.h:154
bool operator()(const pat::Jet &jet, pat::strbitset &ret) override
This provides the interface for base classes to select objects.
strbitset & set(bool val=true)
set method of all bits
Definition: strbitset.h:126
std::string currentJECLevel() const
return the name of the current step of jet energy corrections
Definition: Jet.h:141
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
Analysis-level calorimeter jet class.
Definition: Jet.h:77
pat::strbitset getBitTemplate() const
Get an empty bitset with the proper names.
Definition: Selector.h:168
bool isBasicJet() const
check to see if the jet is no more than a reco::BasicJet
Definition: Jet.h:277
const_iterator begin() const
first daughter const_iterator
Definition: Candidate.h:143
float neutralHadronEnergy() const
neutralHadronEnergy
Definition: PFJet.h:99
float muonEnergyFraction() const
muonEnergyFraction (relative to corrected jet energy)
Definition: Jet.h:432
void setIgnoredCuts(std::vector< std::string > const &bitsToIgnore)
set the bits to ignore from a vector
Definition: Selector.h:131
float neutralEmEnergyFraction() const
neutralEmEnergyFraction (relative to uncorrected jet energy)
Definition: Jet.h:412
Log< level::Warning, false > LogWarning
Jet correctedJet(const std::string &level, const std::string &flavor="none", const std::string &set="") const
int chargedMultiplicity() const
chargedMultiplicity
Definition: Jet.h:746
bool firstDataCuts(reco::Jet const &jet, pat::strbitset &ret, Version_t version_)
float chargedHadronEnergy() const
chargedHadronEnergy
Definition: PFJet.h:95
int cut(index_type const &i, int val) const
Access the int cut values at index &quot;s&quot;.
Definition: Selector.h:158
double energy() const final
energy
double eta() const final
momentum pseudorapidity