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 class PFJetIDSelectionFunctor : public Selector<pat::Jet> {
25 
26  public: // interface
27 
30 
32 
33 #ifndef __GCCXML__
36  {}
37 #endif
38 
40  {
41  std::string versionStr = params.getParameter<std::string>("version");
42  std::string qualityStr = params.getParameter<std::string>("quality");
43 
44  if ( versionStr == "FIRSTDATA" )
46  else if( versionStr == "RUNIISTARTUP")
48  // WINTER16 implements most recent (as of Feb 2017) JetID criteria
49  // See: https://twiki.cern.ch/twiki/bin/view/CMS/JetID13TeVRun2016
50  else if( versionStr == "WINTER16")
51  version_ = WINTER16;
52  else if( versionStr == "WINTER17")
53  version_ = WINTER17;
54  else if( versionStr == "WINTER17PUPPI")
56  else version_ = WINTER17;//set WINTER17 as default
57 
58 
59  if ( qualityStr == "LOOSE") quality_ = LOOSE;
60  else if ( qualityStr == "TIGHT") quality_ = TIGHT;
61  else if ( qualityStr == "TIGHTLEPVETO") quality_ = TIGHTLEPVETO;
62  else quality_ = TIGHT;
63 
64  initCuts();
65 
66  // Now check the configuration to see if the user changed anything
67  if ( params.exists("CHF") ) set("CHF", params.getParameter<double>("CHF") );
68  if ( params.exists("NHF") ) set("NHF", params.getParameter<double>("NHF") );
69  if ((version_ != WINTER17 && version_ != WINTER17PUPPI) || quality_ != TIGHT ) {if ( params.exists("CEF") ) set("CEF", params.getParameter<double>("CEF") );}
70  if ( params.exists("NEF") ) set("NEF", params.getParameter<double>("NEF") );
71  if ( params.exists("NCH") ) set("NCH", params.getParameter<int> ("NCH") );
72  if ( params.exists("nConstituents") ) set("nConstituents", params.getParameter<int> ("nConstituents") );
73  if(version_ == RUNIISTARTUP){
74  if ( params.exists("NEF_FW") ) set("NEF_FW", params.getParameter<double> ("NEF_FW") );
75  if ( params.exists("nNeutrals_FW") ) set("nNeutrals_FW", params.getParameter<int> ("nNeutrals_FW") );
76  }
77  if(version_ == WINTER16){
78  if ( params.exists("NHF_EC") ) set("NHF_EC", params.getParameter<double> ("NHF_EC") );
79  if ( params.exists("NEF_EC") ) set("NEF_EC", params.getParameter<double> ("NEF_EC") );
80  if ( params.exists("nNeutrals_EC") ) set("nNeutrals_EC", params.getParameter<int> ("nNeutrals_EC") );
81  if ( params.exists("NEF_FW") ) set("NEF_FW", params.getParameter<double> ("NEF_FW") );
82  if ( params.exists("nNeutrals_FW") ) set("nNeutrals_FW", params.getParameter<int> ("nNeutrals_FW") );
83  if ( quality_ == TIGHTLEPVETO ) {if ( params.exists("MUF") ) set("MUF", params.getParameter<double> ("MUF") );}
84  }
85  if(version_ == WINTER17){
86  if ( params.exists("NEF_EC_L") ) set("NEF_EC_L", params.getParameter<double> ("NEF_EC_L") );
87  if ( params.exists("NEF_EC_U") ) set("NEF_EC_U", params.getParameter<double> ("NEF_EC_U") );
88  if ( params.exists("nNeutrals_EC") ) set("nNeutrals_EC", params.getParameter<int> ("nNeutrals_EC") );
89  if ( params.exists("NHF_FW") ) set("NHF_FW", params.getParameter<double> ("NHF_FW") );
90  if ( params.exists("NEF_FW") ) set("NEF_FW", params.getParameter<double> ("NEF_FW") );
91  if ( params.exists("nNeutrals_FW") ) set("nNeutrals_FW", params.getParameter<int> ("nNeutrals_FW") );
92  if ( quality_ == TIGHTLEPVETO ) {if ( params.exists("MUF") ) set("MUF", params.getParameter<double> ("MUF") );}
93  }
94  if(version_ == WINTER17PUPPI){
95  if ( params.exists("NHF_EC") ) set("NHF_EC", params.getParameter<double> ("NHF_EC") );
96  if ( params.exists("NHF_FW") ) set("NHF_FW", params.getParameter<double> ("NHF_FW") );
97  if ( params.exists("NEF_FW") ) set("NEF_FW", params.getParameter<double> ("NEF_FW") );
98  if ( params.exists("nNeutrals_FW_L") ) set("nNeutrals_FW_L", params.getParameter<int> ("nNeutrals_FW_L") );
99  if ( params.exists("nNeutrals_FW_U") ) set("nNeutrals_FW_U", params.getParameter<int> ("nNeutrals_FW_U") );
100  if ( quality_ == TIGHTLEPVETO ) {if ( params.exists("MUF") ) set("MUF", params.getParameter<double> ("MUF") );}
101  }
102 
103 
104  if ( params.exists("cutsToIgnore") )
105  setIgnoredCuts( params.getParameter<std::vector<std::string> >("cutsToIgnore") );
106 
107  initIndex();
108 
109  }
110 
111 
113  Quality_t quality ) :
114  version_(version), quality_(quality)
115  {
116  initCuts();
117  initIndex();
118  }
119 
120 
121  //
122  // Accessor from PAT jets
123  //
124  bool operator()( const pat::Jet & jet, pat::strbitset & ret ) override
125  {
127  if ( jet.currentJECLevel() == "Uncorrected" || !jet.jecSetsAvailable() )
128  return firstDataCuts( jet, ret, version_);
129  else
130  return firstDataCuts( jet.correctedJet("Uncorrected"), ret, version_ );
131  }
132  else {
133  return false;
134  }
135  }
137 
138  //
139  // Accessor from *CORRECTED* 4-vector, EMF, and Jet ID.
140  // This can be used with reco quantities.
141  //
142  bool operator()( const reco::PFJet & jet, pat::strbitset & ret )
143  {
145  }
146  else {
147  return false;
148  }
149  }
150 
151  bool operator()( const reco::PFJet & jet )
152  {
153  retInternal_.set(false);
154  operator()(jet, retInternal_);
156  return (bool)retInternal_;
157  }
158 
159  //
160  // cuts based on craft 08 analysis.
161  //
162  bool firstDataCuts( reco::Jet const & jet,
164  {
165  ret.set(false);
166 
167  // cache some variables
168  double chf = 0.0;
169  double nhf = 0.0;
170  double cef = 0.0;
171  double nef = 0.0;
172  double muf = 0.0;
173  int nch = 0;
174  int nconstituents = 0;
175  int nneutrals = 0;
176 
177  // Have to do this because pat::Jet inherits from reco::Jet but not reco::PFJet
178  reco::PFJet const * pfJet = dynamic_cast<reco::PFJet const *>(&jet);
179  pat::Jet const * patJet = dynamic_cast<pat::Jet const *>(&jet);
180  reco::BasicJet const * basicJet = dynamic_cast<reco::BasicJet const *>(&jet);
181 
182  if ( patJet != nullptr ) {
183  if ( patJet->isPFJet() ) {
184  chf = patJet->chargedHadronEnergyFraction();
185  nhf = patJet->neutralHadronEnergyFraction();
186  cef = patJet->chargedEmEnergyFraction();
187  nef = patJet->neutralEmEnergyFraction();
188  nch = patJet->chargedMultiplicity();
189  nconstituents = patJet->numberOfDaughters();
190  nneutrals = patJet->neutralMultiplicity();
191  // Handle the special case of PUPPI jets with weighted multiplicities
192  if (patJet->hasUserFloat("patPuppiJetSpecificProducer:puppiMultiplicity"))
193  nconstituents = patJet->userFloat("patPuppiJetSpecificProducer:puppiMultiplicity");
194  if (patJet->hasUserFloat("patPuppiJetSpecificProducer:neutralPuppiMultiplicity"))
195  nneutrals = patJet->userFloat("patPuppiJetSpecificProducer:neutralPuppiMultiplicity");
196  }
197  // Handle the special case where this is a composed jet for
198  // subjet analyses
199  else if ( patJet->isBasicJet() ) {
200  double e_chf = 0.0;
201  double e_nhf = 0.0;
202  double e_cef = 0.0;
203  double e_nef = 0.0;
204  nch = 0;
205  nconstituents = 0;
206  nneutrals = 0;
207 
208  for ( reco::Jet::const_iterator ibegin = patJet->begin(),
209  iend = patJet->end(), isub = ibegin;
210  isub != iend; ++isub ) {
211  reco::PFJet const * pfsub = dynamic_cast<reco::PFJet const *>( &*isub );
212  pat::Jet const * patsub = dynamic_cast<pat::Jet const *>( &*isub );
213  if ( patsub ) {
214  e_chf += patsub->chargedHadronEnergy();
215  e_nhf += patsub->neutralHadronEnergy();
216  e_cef += patsub->chargedEmEnergy();
217  e_nef += patsub->neutralEmEnergy();
218  nch += patsub->chargedMultiplicity();
219  nconstituents += patsub->numberOfDaughters();
220  nneutrals += patsub->neutralMultiplicity();
221  } else if ( pfsub ) {
222  e_chf += pfsub->chargedHadronEnergy();
223  e_nhf += pfsub->neutralHadronEnergy();
224  e_cef += pfsub->chargedEmEnergy();
225  e_nef += pfsub->neutralEmEnergy();
226  nch += pfsub->chargedMultiplicity();
227  nconstituents += pfsub->numberOfDaughters();
228  nneutrals += pfsub->neutralMultiplicity();
229  } else assert(0);
230  }
231  double e = patJet->energy();
232  if ( e > 0.000001 ) {
233  chf = e_chf / e;
234  nhf = e_nhf / e;
235  cef = e_cef / e;
236  nef = e_nef / e;
237  } else {
238  chf = nhf = cef = nef = 0.0;
239  }
240  }
241  } // end if pat jet
242  else if ( pfJet != nullptr ) {
243  // CV: need to compute energy fractions in a way that works for corrected as well as for uncorrected PFJets
244  double jetEnergyUncorrected =
245  pfJet->chargedHadronEnergy()
246  + pfJet->neutralHadronEnergy()
247  + pfJet->photonEnergy()
248  + pfJet->electronEnergy()
249  + pfJet->muonEnergy()
250  + pfJet->HFEMEnergy();
251  if ( jetEnergyUncorrected > 0. ) {
252  chf = pfJet->chargedHadronEnergy() / jetEnergyUncorrected;
253  nhf = pfJet->neutralHadronEnergy() / jetEnergyUncorrected;
254  cef = pfJet->chargedEmEnergy() / jetEnergyUncorrected;
255  nef = pfJet->neutralEmEnergy() / jetEnergyUncorrected;
256  muf = pfJet->muonEnergy() / jetEnergyUncorrected;
257  }
258  nch = pfJet->chargedMultiplicity();
259  nconstituents = pfJet->numberOfDaughters();
260  nneutrals = pfJet->neutralMultiplicity();
261  } // end if PF jet
262  // Handle the special case where this is a composed jet for
263  // subjet analyses
264  else if ( basicJet != nullptr ) {
265  double e_chf = 0.0;
266  double e_nhf = 0.0;
267  double e_cef = 0.0;
268  double e_nef = 0.0;
269  nch = 0;
270  nconstituents = 0;
271  for ( reco::Jet::const_iterator ibegin = basicJet->begin(),
272  iend = patJet->end(), isub = ibegin;
273  isub != iend; ++isub ) {
274  reco::PFJet const * pfsub = dynamic_cast<reco::PFJet const *>( &*isub );
275  e_chf += pfsub->chargedHadronEnergy();
276  e_nhf += pfsub->neutralHadronEnergy();
277  e_cef += pfsub->chargedEmEnergy();
278  e_nef += pfsub->neutralEmEnergy();
279  nch += pfsub->chargedMultiplicity();
280  nconstituents += pfsub->numberOfDaughters();
281  nneutrals += pfsub->neutralMultiplicity();
282  }
283  double e = basicJet->energy();
284  if ( e > 0.000001 ) {
285  chf = e_chf / e;
286  nhf = e_nhf / e;
287  cef = e_cef / e;
288  nef = e_nef / e;
289  }
290  } // end if basic jet
291 
292 
293 
294  // Cuts for |eta| < 2.4 for FIRSTDATA, RUNIISTARTUP, WINTER16 and WINTER17
295  if((version_ != WINTER17 && version_ != WINTER17PUPPI) || quality_ != TIGHT ) {if ( ignoreCut(indexCEF_) || ( cef < cut(indexCEF_, double()) || std::abs(jet.eta()) > 2.4 ) ) passCut( ret, indexCEF_);}
296 
297  if ( ignoreCut(indexCHF_) || ( chf > cut(indexCHF_, double()) || std::abs(jet.eta()) > 2.4 ) ) passCut( ret, indexCHF_);
298  if ( ignoreCut(indexNCH_) || ( nch > cut(indexNCH_, int()) || std::abs(jet.eta()) > 2.4 ) ) passCut( ret, indexNCH_);
299 
300  if(version_ == FIRSTDATA){// Cuts for all eta for FIRSTDATA
301  if ( ignoreCut(indexNConstituents_) || ( nconstituents > cut(indexNConstituents_, int()) ) ) passCut( ret, indexNConstituents_);
302  if ( ignoreCut(indexNEF_) || ( nef < cut(indexNEF_, double()) ) ) passCut( ret, indexNEF_);
303  if ( ignoreCut(indexNHF_) || ( nhf < cut(indexNHF_, double()) ) ) passCut( ret, indexNHF_);
304  }else if(version_ == RUNIISTARTUP){
305  // Cuts for |eta| <= 3.0 for RUNIISTARTUP scenario
306  if ( ignoreCut(indexNConstituents_) || ( nconstituents > cut(indexNConstituents_, int()) || std::abs(jet.eta()) > 3.0 ) ) passCut( ret, indexNConstituents_);
307  if ( ignoreCut(indexNEF_) || ( nef < cut(indexNEF_, double()) || std::abs(jet.eta()) > 3.0 ) ) passCut( ret, indexNEF_);
308  if ( ignoreCut(indexNHF_) || ( nhf < cut(indexNHF_, double()) || std::abs(jet.eta()) > 3.0 ) ) passCut( ret, indexNHF_);
309  // Cuts for |eta| > 3.0 for RUNIISTARTUP scenario
310  if ( ignoreCut(indexNEF_FW_) || ( nef < cut(indexNEF_FW_, double()) || std::abs(jet.eta()) <= 3.0 ) ) passCut( ret, indexNEF_FW_);
311  if ( ignoreCut(indexNNeutrals_FW_) || ( nneutrals > cut(indexNNeutrals_FW_, int()) || std::abs(jet.eta()) <= 3.0 ) ) passCut( ret, indexNNeutrals_FW_);
312  }
313  else if(version_ == WINTER16){
314  // Cuts for |eta| <= 2.7 for WINTER16 scenario
315  if ( ignoreCut(indexNConstituents_) || ( nconstituents > cut(indexNConstituents_, int()) || std::abs(jet.eta()) > 2.7 ) ) passCut( ret, indexNConstituents_);
316  if ( ignoreCut(indexNEF_) || ( nef < cut(indexNEF_, double()) || std::abs(jet.eta()) > 2.7 ) ) passCut( ret, indexNEF_);
317  if ( ignoreCut(indexNHF_) || ( nhf < cut(indexNHF_, double()) || std::abs(jet.eta()) > 2.7 ) ) passCut( ret, indexNHF_);
318  if ( quality_ == TIGHTLEPVETO ) {if ( ignoreCut(indexMUF_) || ( muf < cut(indexMUF_, double()) || std::abs(jet.eta()) > 2.7 ) ) passCut( ret, indexMUF_);}
319 
320  // Cuts for 2.7 < |eta| <= 3.0 for WINTER16 scenario
321  if ( ignoreCut(indexNHF_EC_) || ( nhf < cut(indexNHF_EC_, double()) || std::abs(jet.eta()) <= 2.7 || std::abs(jet.eta()) > 3.0) ) passCut( ret, indexNHF_EC_);
322  if ( ignoreCut(indexNEF_EC_) || ( nef > cut(indexNEF_EC_, double()) || std::abs(jet.eta()) <= 2.7 || std::abs(jet.eta()) > 3.0) ) passCut( ret, indexNEF_EC_);
323  if ( ignoreCut(indexNNeutrals_EC_) || ( nneutrals > cut(indexNNeutrals_EC_, int()) || std::abs(jet.eta()) <= 2.7 || std::abs(jet.eta()) > 3.0) ) passCut( ret, indexNNeutrals_EC_);
324 
325  // Cuts for |eta| > 3.0 for WINTER16 scenario
326  if ( ignoreCut(indexNEF_FW_) || ( nef < cut(indexNEF_FW_, double()) || std::abs(jet.eta()) <= 3.0 ) ) passCut( ret, indexNEF_FW_);
327  if ( ignoreCut(indexNNeutrals_FW_) || ( nneutrals > cut(indexNNeutrals_FW_, int()) || std::abs(jet.eta()) <= 3.0 ) ) passCut( ret, indexNNeutrals_FW_);
328  }
329  else if(version_ == WINTER17){
330  // Cuts for |eta| <= 2.7 for WINTER17 scenario
331  if ( ignoreCut(indexNConstituents_) || ( nconstituents > cut(indexNConstituents_, int()) || std::abs(jet.eta()) > 2.7 ) ) passCut( ret, indexNConstituents_);
332  if ( ignoreCut(indexNEF_) || ( nef < cut(indexNEF_, double()) || std::abs(jet.eta()) > 2.7 ) ) passCut( ret, indexNEF_);
333  if ( ignoreCut(indexNHF_) || ( nhf < cut(indexNHF_, double()) || std::abs(jet.eta()) > 2.7 ) ) passCut( ret, indexNHF_);
334  if ( quality_ == TIGHTLEPVETO ) {if ( ignoreCut(indexMUF_) || ( muf < cut(indexMUF_, double()) || std::abs(jet.eta()) > 2.7 ) ) passCut( ret, indexMUF_);}
335 
336  // Cuts for 2.7 < |eta| <= 3.0 for WINTER17 scenario
337 
338  if ( ignoreCut(indexNEF_EC_L_) || ( nef > cut(indexNEF_EC_L_, double()) || std::abs(jet.eta()) <= 2.7 || std::abs(jet.eta()) > 3.0) ) passCut( ret, indexNEF_EC_L_);
339  if ( ignoreCut(indexNEF_EC_U_) || ( nef < cut(indexNEF_EC_U_, double()) || std::abs(jet.eta()) <= 2.7 || std::abs(jet.eta()) > 3.0) ) passCut( ret, indexNEF_EC_U_);
340  if ( ignoreCut(indexNNeutrals_EC_) || ( nneutrals > cut(indexNNeutrals_EC_, int()) || std::abs(jet.eta()) <= 2.7 || std::abs(jet.eta()) > 3.0) ) passCut( ret, indexNNeutrals_EC_);
341 
342  // Cuts for |eta| > 3.0 for WINTER17 scenario
343  if ( ignoreCut(indexNHF_FW_) || ( nhf > cut(indexNHF_FW_, double()) || std::abs(jet.eta()) <= 3.0 ) ) passCut( ret, indexNHF_FW_);
344  if ( ignoreCut(indexNEF_FW_) || ( nef < cut(indexNEF_FW_, double()) || std::abs(jet.eta()) <= 3.0 ) ) passCut( ret, indexNEF_FW_);
345  if ( ignoreCut(indexNNeutrals_FW_) || ( nneutrals > cut(indexNNeutrals_FW_, int()) || std::abs(jet.eta()) <= 3.0 ) ) passCut( ret, indexNNeutrals_FW_);
346 
347  }
348  else if(version_ == WINTER17PUPPI){
349  // Cuts for |eta| <= 2.7 for WINTER17 scenario
350  if ( ignoreCut(indexNConstituents_) || ( nconstituents > cut(indexNConstituents_, int()) || std::abs(jet.eta()) > 2.7 ) ) passCut( ret, indexNConstituents_);
351  if ( ignoreCut(indexNEF_) || ( nef < cut(indexNEF_, double()) || std::abs(jet.eta()) > 2.7 ) ) passCut( ret, indexNEF_);
352  if ( ignoreCut(indexNHF_) || ( nhf < cut(indexNHF_, double()) || std::abs(jet.eta()) > 2.7 ) ) passCut( ret, indexNHF_);
353  if ( quality_ == TIGHTLEPVETO ) {if ( ignoreCut(indexMUF_) || ( muf < cut(indexMUF_, double()) || std::abs(jet.eta()) > 2.7 ) ) passCut( ret, indexMUF_);}
354 
355  // Cuts for 2.7 < |eta| <= 3.0 for WINTER17 scenario
356 
357  if ( ignoreCut(indexNHF_EC_) || ( nhf < cut(indexNHF_EC_, double()) || std::abs(jet.eta()) <= 2.7 || std::abs(jet.eta()) > 3.0) ) passCut( ret, indexNHF_EC_);
358 
359  // Cuts for |eta| > 3.0 for WINTER17 scenario
360  if ( ignoreCut(indexNHF_FW_) || ( nhf > cut(indexNHF_FW_, double()) || std::abs(jet.eta()) <= 3.0 ) ) passCut( ret, indexNHF_FW_);
361  if ( ignoreCut(indexNEF_FW_) || ( nef < cut(indexNEF_FW_, double()) || std::abs(jet.eta()) <= 3.0 ) ) passCut( ret, indexNEF_FW_);
362  if ( ignoreCut(indexNNeutrals_FW_L_) || ( nneutrals > cut(indexNNeutrals_FW_L_, int()) || std::abs(jet.eta()) <= 3.0 ) ) passCut( ret, indexNNeutrals_FW_L_);
363  if ( ignoreCut(indexNNeutrals_FW_U_) || ( nneutrals < cut(indexNNeutrals_FW_U_, int()) || std::abs(jet.eta()) <= 3.0 ) ) passCut( ret, indexNNeutrals_FW_U_);
364 
365  }
366 
367 
368  //std::cout << "<PFJetIDSelectionFunctor::firstDataCuts>:" << std::endl;
369  //std::cout << " jet: Pt = " << jet.pt() << ", eta = " << jet.eta() << ", phi = " << jet.phi() << std::endl;
370  //ret.print(std::cout);
371 
372  setIgnored( ret );
373  return (bool)ret;
374  }
375 
376  private: // member variables
377 
378  void initCuts()
379  {
380  push_back("CHF" );
381  push_back("NHF" );
382  if( (version_ != WINTER17 && version_!=WINTER17PUPPI) || quality_ != TIGHT ) push_back("CEF" );
383  push_back("NEF" );
384  push_back("NCH" );
385  push_back("nConstituents");
386  if(version_ == RUNIISTARTUP ){
387  push_back("NEF_FW");
388  push_back("nNeutrals_FW");
389  }
390  if(version_ == WINTER16 ){
391  push_back("NHF_EC");
392  push_back("NEF_EC");
393  push_back("nNeutrals_EC");
394  push_back("NEF_FW");
395  push_back("nNeutrals_FW");
396  if (quality_ == TIGHTLEPVETO) push_back("MUF");
397  }
398  if(version_ == WINTER17 ){
399  push_back("NEF_EC_L");
400  push_back("NEF_EC_U");
401  push_back("nNeutrals_EC");
402  push_back("NEF_FW");
403  push_back("NHF_FW");
404  push_back("nNeutrals_FW");
405  if (quality_ == TIGHTLEPVETO) push_back("MUF");
406  }
407  if(version_ == WINTER17PUPPI ){
408  push_back("NHF_EC");
409  push_back("NEF_FW");
410  push_back("NHF_FW");
411  push_back("nNeutrals_FW_L");
412  push_back("nNeutrals_FW_U");
413  if (quality_ == TIGHTLEPVETO) push_back("MUF");
414  }
415 
416 
417  if( (version_ == WINTER17 || version_ == WINTER17PUPPI) && quality_ == LOOSE ){
418  edm::LogWarning("BadJetIDVersion") << "Winter17 JetID version does not support the LOOSE operating point -- defaulting to TIGHT";
419  quality_ = TIGHT;
420  }
421 
422  // Set some default cuts for LOOSE, TIGHT
423  if ( quality_ == LOOSE ) {
424  set("CHF", 0.0);
425  set("NHF", 0.99);
426  set("CEF", 0.99);
427  set("NEF", 0.99);
428  set("NCH", 0);
429  set("nConstituents", 1);
430  if(version_ == RUNIISTARTUP){
431  set("NEF_FW",0.90);
432  set("nNeutrals_FW",10);
433  }
434  else if(version_ == WINTER16){
435  set("NHF_EC",0.98);
436  set("NEF_EC",0.01);
437  set("nNeutrals_EC",2);
438  set("NEF_FW",0.90);
439  set("nNeutrals_FW",10);
440  }
441 
442 
443  } else if ( quality_ == TIGHT ) {
444  set("CHF", 0.0);
445  set("NHF", 0.9);
446  if(version_ != WINTER17 && version_ != WINTER17PUPPI ) set("CEF", 0.99);
447  set("NEF", 0.9);
448  set("NCH", 0);
449  set("nConstituents", 1);
450  if(version_ == RUNIISTARTUP){
451  set("NEF_FW",0.90);
452  set("nNeutrals_FW",10);
453  }
454  else if(version_ == WINTER16){
455  set("NHF_EC",0.98);
456  set("NEF_EC",0.01);
457  set("nNeutrals_EC",2);
458  set("NEF_FW",0.90);
459  set("nNeutrals_FW",10);
460  }
461  else if(version_ == WINTER17){
462  set("NEF_EC_L",0.02);
463  set("NEF_EC_U",0.99);
464  set("nNeutrals_EC",2);
465  set("NHF_FW",0.02);
466  set("NEF_FW",0.90);
467  set("nNeutrals_FW",10);
468  }
469  else if(version_ == WINTER17PUPPI){
470  set("NHF_EC",0.99);
471  set("NHF_FW",0.02);
472  set("NEF_FW",0.90);
473  set("nNeutrals_FW_L",2);
474  set("nNeutrals_FW_U",15);
475  }
476 
477  }else if ( quality_ == TIGHTLEPVETO ) {
478  set("CHF", 0.0);
479  set("NHF", 0.9);
480  set("NEF", 0.9);
481  set("NCH", 0);
482  set("nConstituents", 1);
483  if(version_ == WINTER17){
484  set("CEF", 0.8);
485  set("NEF_EC_L",0.02);
486  set("NEF_EC_U",0.99);
487  set("nNeutrals_EC",2);
488  set("NHF_FW",0.02);
489  set("NEF_FW",0.90);
490  set("nNeutrals_FW",10);
491  set("MUF", 0.8);
492  }
493  else if(version_ == WINTER17PUPPI){
494  set("CEF", 0.8);
495  set("NHF_EC",0.99);
496  set("NHF_FW",0.02);
497  set("NEF_FW",0.90);
498  set("nNeutrals_FW_L",2);
499  set("nNeutrals_FW_U",15);
500  set("MUF", 0.8);
501  }
502  else if(version_ == WINTER16){
503  set("CEF", 0.9);
504  set("NEF_EC",0.01);
505  set("NHF_EC",0.98);
506  set("nNeutrals_EC",2);
507  set("nNeutrals_FW",10);
508  set("NEF_FW",0.90);
509  set("MUF", 0.8);
510  }
511 
512  }
513  }
514 
515  void initIndex()
516  {
517  indexNConstituents_ = index_type (&bits_, "nConstituents");
518  indexNEF_ = index_type (&bits_, "NEF");
519  indexNHF_ = index_type (&bits_, "NHF");
520  if((version_ != WINTER17 && version_ != WINTER17PUPPI) || quality_ != TIGHT ) indexCEF_ = index_type (&bits_, "CEF");
521 
522  indexCHF_ = index_type (&bits_, "CHF");
523  indexNCH_ = index_type (&bits_, "NCH");
524  if(version_ == RUNIISTARTUP){
525  indexNEF_FW_ = index_type (&bits_, "NEF_FW");
526  indexNNeutrals_FW_ = index_type (&bits_, "nNeutrals_FW");
527  }
528  if(version_ == WINTER16){
529  indexNHF_EC_ = index_type (&bits_, "NHF_EC");
530  indexNEF_EC_ = index_type (&bits_, "NEF_EC");
531  indexNNeutrals_EC_ = index_type (&bits_, "nNeutrals_EC");
532  indexNEF_FW_ = index_type (&bits_, "NEF_FW");
533  indexNNeutrals_FW_ = index_type (&bits_, "nNeutrals_FW");
534  if ( quality_ == TIGHTLEPVETO ) {indexMUF_ = index_type (&bits_, "MUF");}
535  }
536  if(version_ == WINTER17){
537  indexNEF_EC_L_ = index_type (&bits_, "NEF_EC_L");
538  indexNEF_EC_U_ = index_type (&bits_, "NEF_EC_U");
539  indexNNeutrals_EC_ = index_type (&bits_, "nNeutrals_EC");
540  indexNHF_FW_ = index_type (&bits_, "NHF_FW");
541  indexNEF_FW_ = index_type (&bits_, "NEF_FW");
542  indexNNeutrals_FW_ = index_type (&bits_, "nNeutrals_FW");
543  if ( quality_ == TIGHTLEPVETO ) {indexMUF_ = index_type (&bits_, "MUF");}
544  }
545  if(version_ == WINTER17PUPPI){
546  indexNHF_EC_ = index_type (&bits_, "NHF_EC");
547  indexNHF_FW_ = index_type (&bits_, "NHF_FW");
548  indexNEF_FW_ = index_type (&bits_, "NEF_FW");
549  indexNNeutrals_FW_L_ = index_type (&bits_, "nNeutrals_FW_L");
550  indexNNeutrals_FW_U_ = index_type (&bits_, "nNeutrals_FW_U");
551  if ( quality_ == TIGHTLEPVETO ) {indexMUF_ = index_type (&bits_, "MUF");}
552  }
553 
555  }
556 
559 
567 
573 
579 
580 
581 };
582 
583 #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
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
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