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