CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
PFJetIDSelectionFunctor Class Reference

PF Jet selector for pat::Jets. More...

#include "PhysicsTools/SelectorUtils/interface/PFJetIDSelectionFunctor.h"

Inheritance diagram for PFJetIDSelectionFunctor:
Selector< pat::Jet >

Public Types

enum  Quality_t { LOOSE, TIGHT, TIGHTLEPVETO, N_QUALITY }
 
enum  Version_t {
  FIRSTDATA, RUNIISTARTUP, WINTER16, WINTER17,
  WINTER17PUPPI, N_VERSIONS
}
 
- Public Types inherited from Selector< pat::Jet >
typedef std::pair< index_type, size_t > cut_flow_item
 
typedef std::vector< cut_flow_itemcut_flow_map
 
typedef pat::Jet data_type
 
typedef std::map< index_type, double > double_map
 
typedef pat::strbitset::index_type index_type
 
typedef std::map< index_type, int > int_map
 

Public Member Functions

bool firstDataCuts (reco::Jet const &jet, pat::strbitset &ret, Version_t version_)
 
bool operator() (const pat::Jet &jet, pat::strbitset &ret) override
 
bool operator() (const reco::PFJet &jet, pat::strbitset &ret)
 
bool operator() (const reco::PFJet &jet)
 
 PFJetIDSelectionFunctor ()
 
 PFJetIDSelectionFunctor (edm::ParameterSet const &params, edm::ConsumesCollector &iC)
 
 PFJetIDSelectionFunctor (edm::ParameterSet const &params)
 
 PFJetIDSelectionFunctor (Version_t version, Quality_t quality)
 
- Public Member Functions inherited from Selector< pat::Jet >
void clear (std::string const &s)
 Turn off a given selection cut. More...
 
void clear (index_type const &i)
 
bool considerCut (std::string const &s) const
 consider the cut at index "s" More...
 
bool considerCut (index_type const &i) const
 
int cut (index_type const &i, int val) const
 Access the int cut values at index "s". More...
 
double cut (index_type const &i, double val) const
 Access the double cut values at index "s". More...
 
int cut (std::string s, int val) const
 Access the int cut values at index "s". More...
 
double cut (std::string s, double val) const
 Access the double cut values at index "s". More...
 
pat::strbitset getBitTemplate () const
 Get an empty bitset with the proper names. More...
 
double getPasses (std::string const &s) const
 Return the number of passing cases. More...
 
double getPasses (index_type const &i) const
 
bool ignoreCut (std::string const &s) const
 ignore the cut at index "s" More...
 
bool ignoreCut (index_type const &i) const
 
virtual bool operator() (pat::Jet const &t, pat::strbitset &ret)=0
 This provides the interface for base classes to select objects. More...
 
virtual bool operator() (pat::Jet const &t)
 This provides an alternative signature without the second ret. More...
 
virtual bool operator() (pat::Jet const &t, edm::EventBase const &e, pat::strbitset &ret)
 This provides an alternative signature that includes extra information. More...
 
virtual bool operator() (pat::Jet const &t, edm::EventBase const &e)
 This provides an alternative signature that includes extra information. More...
 
bool operator[] (std::string const &s) const
 
bool operator[] (index_type const &i) const
 
void passCut (pat::strbitset &ret, std::string const &s)
 Passing cuts. More...
 
void passCut (pat::strbitset &ret, index_type const &i)
 
void print (std::ostream &out) const
 Print the cut flow. More...
 
void printActiveCuts (std::ostream &out) const
 Print the cuts being considered. More...
 
virtual void push_back (std::string const &s)
 This is the registration of an individual cut string. More...
 
virtual void push_back (std::string const &s, int cut)
 This is the registration of an individual cut string, with an int cut value. More...
 
virtual void push_back (std::string const &s, double cut)
 This is the registration of an individual cut string, with a double cut value. More...
 
 Selector ()
 Constructor clears the bits. More...
 
void set (std::string const &s, bool val=true)
 Set a given selection cut, on or off. More...
 
void set (index_type const &i, bool val=true)
 
void set (std::string const &s, int cut, bool val=true)
 Set a given selection cut, on or off, and reset int cut value. More...
 
void set (index_type const &i, int cut, bool val=true)
 
void set (std::string const &s, double cut, bool val=true)
 Set a given selection cut, on or off, and reset int cut value. More...
 
void set (index_type const &i, double cut, bool val=true)
 
void setIgnored (pat::strbitset &ret)
 set ignored bits More...
 
void setIgnoredCuts (std::vector< std::string > const &bitsToIgnore)
 set the bits to ignore from a vector More...
 
virtual ~Selector ()
 

Private Member Functions

void initCuts ()
 
void initIndex ()
 

Private Attributes

index_type indexCEF_
 
index_type indexCHF_
 
index_type indexMUF_
 
index_type indexNCH_
 
index_type indexNConstituents_
 
index_type indexNEF_
 
index_type indexNEF_EC_
 
index_type indexNEF_EC_L_
 
index_type indexNEF_EC_U_
 
index_type indexNEF_FW_
 
index_type indexNHF_
 
index_type indexNHF_EC_
 
index_type indexNHF_FW_
 
index_type indexNNeutrals_EC_
 
index_type indexNNeutrals_FW_
 
index_type indexNNeutrals_FW_L_
 
index_type indexNNeutrals_FW_U_
 
Quality_t quality_
 
Version_t version_
 

Additional Inherited Members

- Protected Attributes inherited from Selector< pat::Jet >
pat::strbitset bits_
 the bitset indexed by strings More...
 
cut_flow_map cutFlow_
 map of cut flows in "human" order More...
 
double_map doubleCuts_
 the double-value cut map More...
 
int_map intCuts_
 the int-value cut map More...
 
pat::strbitset retInternal_
 internal ret if users don't care about return bits More...
 

Detailed Description

PF Jet selector for pat::Jets.

Selector functor for pat::Jets that implements quality cuts based on studies of noise patterns.

Please see https://twiki.cern.ch/twiki/bin/view/CMS/SWGuidePATSelectors for a general overview of the selectors.

Definition at line 24 of file PFJetIDSelectionFunctor.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

PFJetIDSelectionFunctor::PFJetIDSelectionFunctor ( )
inline

Definition at line 31 of file PFJetIDSelectionFunctor.h.

31 {}
PFJetIDSelectionFunctor::PFJetIDSelectionFunctor ( edm::ParameterSet const &  params,
edm::ConsumesCollector iC 
)
inline

Definition at line 34 of file PFJetIDSelectionFunctor.h.

34  :
36  {}
PFJetIDSelectionFunctor::PFJetIDSelectionFunctor ( edm::ParameterSet const &  params)
inline

Definition at line 39 of file PFJetIDSelectionFunctor.h.

References edm::ParameterSet::exists(), FIRSTDATA, edm::ParameterSet::getParameter(), initCuts(), initIndex(), LOOSE, quality_, RUNIISTARTUP, Selector< pat::Jet >::setIgnoredCuts(), AlCaHLTBitMon_QueryRunRegistry::string, TIGHT, TIGHTLEPVETO, version_, WINTER16, WINTER17, and WINTER17PUPPI.

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  }
void setIgnoredCuts(std::vector< std::string > const &bitsToIgnore)
set the bits to ignore from a vector
Definition: Selector.h:165
PFJetIDSelectionFunctor::PFJetIDSelectionFunctor ( Version_t  version,
Quality_t  quality 
)
inline

Member Function Documentation

bool PFJetIDSelectionFunctor::firstDataCuts ( reco::Jet const &  jet,
pat::strbitset ret,
Version_t  version_ 
)
inline

Definition at line 162 of file PFJetIDSelectionFunctor.h.

References funct::abs(), reco::Candidate::begin(), reco::PFJet::chargedEmEnergy(), pat::Jet::chargedEmEnergy(), pat::Jet::chargedEmEnergyFraction(), reco::PFJet::chargedHadronEnergy(), pat::Jet::chargedHadronEnergy(), pat::Jet::chargedHadronEnergyFraction(), reco::PFJet::chargedMultiplicity(), pat::Jet::chargedMultiplicity(), Selector< pat::Jet >::cut(), MillePedeFileConverter_cfg::e, reco::PFJet::electronEnergy(), reco::Candidate::end(), reco::LeafCandidate::energy(), reco::LeafCandidate::eta(), FIRSTDATA, pat::PATObject< ObjectType >::hasUserFloat(), reco::PFJet::HFEMEnergy(), Selector< pat::Jet >::ignoreCut(), indexCEF_, indexCHF_, indexMUF_, indexNCH_, indexNConstituents_, indexNEF_, indexNEF_EC_, indexNEF_EC_L_, indexNEF_EC_U_, indexNEF_FW_, indexNHF_, indexNHF_EC_, indexNHF_FW_, indexNNeutrals_EC_, indexNNeutrals_FW_, indexNNeutrals_FW_L_, indexNNeutrals_FW_U_, pat::Jet::isBasicJet(), pat::Jet::isPFJet(), metsig::jet, reco::PFJet::muonEnergy(), reco::PFJet::neutralEmEnergy(), pat::Jet::neutralEmEnergy(), pat::Jet::neutralEmEnergyFraction(), reco::PFJet::neutralHadronEnergy(), pat::Jet::neutralHadronEnergy(), pat::Jet::neutralHadronEnergyFraction(), reco::PFJet::neutralMultiplicity(), pat::Jet::neutralMultiplicity(), reco::CompositePtrCandidate::numberOfDaughters(), pat::Jet::numberOfDaughters(), Selector< pat::Jet >::passCut(), reco::PFJet::photonEnergy(), quality_, RUNIISTARTUP, pat::strbitset::set(), Selector< pat::Jet >::setIgnored(), TIGHT, TIGHTLEPVETO, pat::PATObject< ObjectType >::userFloat(), WINTER16, WINTER17, and WINTER17PUPPI.

Referenced by operator()().

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  }
float photonEnergy() const
photonEnergy
Definition: PFJet.h:106
float neutralHadronEnergyFraction() const
neutralHadronEnergyFraction (relative to uncorrected jet energy)
Definition: Jet.h:374
float muonEnergy() const
muonEnergy
Definition: PFJet.h:114
float chargedHadronEnergy() const
chargedHadronEnergy
Definition: Jet.h:655
float chargedEmEnergy() const
chargedEmEnergy
Definition: PFJet.h:142
float neutralEmEnergy() const
neutralEmEnergy
Definition: Jet.h:676
float chargedHadronEnergyFraction() const
chargedHadronEnergyFraction (relative to uncorrected jet energy)
Definition: Jet.h:372
float neutralHadronEnergy() const
neutralHadronEnergy
Definition: Jet.h:662
float chargedEmEnergyFraction() const
chargedEmEnergyFraction (relative to uncorrected jet energy)
Definition: Jet.h:376
bool hasUserFloat(const std::string &key) const
Return true if there is a user-defined float with a given name.
Definition: PATObject.h:334
void setIgnored(pat::strbitset &ret)
set ignored bits
Definition: Selector.h:222
int neutralMultiplicity() const
neutralMultiplicity
Definition: Jet.h:422
Jets made from CaloTowers.
Definition: BasicJet.h:20
int chargedMultiplicity() const
chargedMultiplicity
Definition: PFJet.h:155
Jets made from PFObjects.
Definition: PFJet.h:21
float neutralEmEnergy() const
neutralEmEnergy
Definition: PFJet.h:150
float userFloat(const std::string &key) const
Definition: PATObject.h:791
float chargedEmEnergy() const
chargedEmEnergy
Definition: Jet.h:669
float electronEnergy() const
electronEnergy
Definition: PFJet.h:110
size_t numberOfDaughters() const override
number of daughters
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
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
strbitset & set(bool val=true)
set method of all bits
Definition: strbitset.h:144
Analysis-level calorimeter jet class.
Definition: Jet.h:80
size_t numberOfDaughters() const override
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
float neutralEmEnergyFraction() const
neutralEmEnergyFraction (relative to uncorrected jet energy)
Definition: Jet.h:378
int chargedMultiplicity() const
chargedMultiplicity
Definition: Jet.h:690
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
void PFJetIDSelectionFunctor::initCuts ( )
inlineprivate

Definition at line 378 of file PFJetIDSelectionFunctor.h.

References LOOSE, Selector< pat::Jet >::push_back(), quality_, RUNIISTARTUP, TIGHT, TIGHTLEPVETO, version_, WINTER16, WINTER17, and WINTER17PUPPI.

Referenced by PFJetIDSelectionFunctor().

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  }
virtual void push_back(std::string const &s)
This is the registration of an individual cut string.
Definition: Selector.h:44
void PFJetIDSelectionFunctor::initIndex ( )
inlineprivate

Definition at line 515 of file PFJetIDSelectionFunctor.h.

References Selector< pat::Jet >::bits_, Selector< pat::Jet >::getBitTemplate(), indexCEF_, indexCHF_, indexMUF_, indexNCH_, indexNConstituents_, indexNEF_, indexNEF_EC_, indexNEF_EC_L_, indexNEF_EC_U_, indexNEF_FW_, indexNHF_, indexNHF_EC_, indexNHF_FW_, indexNNeutrals_EC_, indexNNeutrals_FW_, indexNNeutrals_FW_L_, indexNNeutrals_FW_U_, quality_, Selector< pat::Jet >::retInternal_, RUNIISTARTUP, TIGHT, TIGHTLEPVETO, version_, WINTER16, WINTER17, and WINTER17PUPPI.

Referenced by PFJetIDSelectionFunctor().

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  }
pat::strbitset::index_type index_type
Definition: Selector.h:27
pat::strbitset retInternal_
internal ret if users don&#39;t care about return bits
Definition: Selector.h:285
pat::strbitset bits_
the bitset indexed by strings
Definition: Selector.h:284
pat::strbitset getBitTemplate() const
Get an empty bitset with the proper names.
Definition: Selector.h:210
bool PFJetIDSelectionFunctor::operator() ( const pat::Jet jet,
pat::strbitset ret 
)
inlineoverride

Definition at line 124 of file PFJetIDSelectionFunctor.h.

References pat::Jet::correctedJet(), pat::Jet::currentJECLevel(), FIRSTDATA, firstDataCuts(), pat::Jet::jecSetsAvailable(), Utilities::operator, RUNIISTARTUP, version_, WINTER16, WINTER17, and WINTER17PUPPI.

Referenced by operator()().

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  }
bool jecSetsAvailable() const
Definition: Jet.h:131
std::string currentJECLevel() const
return the name of the current step of jet energy corrections
Definition: Jet.h:141
Jet correctedJet(const std::string &level, const std::string &flavor="none", const std::string &set="") const
bool firstDataCuts(reco::Jet const &jet, pat::strbitset &ret, Version_t version_)
bool PFJetIDSelectionFunctor::operator() ( const reco::PFJet jet,
pat::strbitset ret 
)
inline
bool PFJetIDSelectionFunctor::operator() ( const reco::PFJet jet)
inline

Definition at line 151 of file PFJetIDSelectionFunctor.h.

References operator()(), Selector< pat::Jet >::retInternal_, pat::strbitset::set(), and Selector< pat::Jet >::setIgnored().

152  {
153  retInternal_.set(false);
154  operator()(jet, retInternal_);
156  return (bool)retInternal_;
157  }
void setIgnored(pat::strbitset &ret)
set ignored bits
Definition: Selector.h:222
pat::strbitset retInternal_
internal ret if users don&#39;t care about return bits
Definition: Selector.h:285
bool operator()(const pat::Jet &jet, pat::strbitset &ret) override
strbitset & set(bool val=true)
set method of all bits
Definition: strbitset.h:144

Member Data Documentation

index_type PFJetIDSelectionFunctor::indexCEF_
private

Definition at line 564 of file PFJetIDSelectionFunctor.h.

Referenced by firstDataCuts(), and initIndex().

index_type PFJetIDSelectionFunctor::indexCHF_
private

Definition at line 565 of file PFJetIDSelectionFunctor.h.

Referenced by firstDataCuts(), and initIndex().

index_type PFJetIDSelectionFunctor::indexMUF_
private

Definition at line 562 of file PFJetIDSelectionFunctor.h.

Referenced by firstDataCuts(), and initIndex().

index_type PFJetIDSelectionFunctor::indexNCH_
private

Definition at line 566 of file PFJetIDSelectionFunctor.h.

Referenced by firstDataCuts(), and initIndex().

index_type PFJetIDSelectionFunctor::indexNConstituents_
private

Definition at line 560 of file PFJetIDSelectionFunctor.h.

Referenced by firstDataCuts(), and initIndex().

index_type PFJetIDSelectionFunctor::indexNEF_
private

Definition at line 561 of file PFJetIDSelectionFunctor.h.

Referenced by firstDataCuts(), and initIndex().

index_type PFJetIDSelectionFunctor::indexNEF_EC_
private

Definition at line 575 of file PFJetIDSelectionFunctor.h.

Referenced by firstDataCuts(), and initIndex().

index_type PFJetIDSelectionFunctor::indexNEF_EC_L_
private

Definition at line 576 of file PFJetIDSelectionFunctor.h.

Referenced by firstDataCuts(), and initIndex().

index_type PFJetIDSelectionFunctor::indexNEF_EC_U_
private

Definition at line 577 of file PFJetIDSelectionFunctor.h.

Referenced by firstDataCuts(), and initIndex().

index_type PFJetIDSelectionFunctor::indexNEF_FW_
private

Definition at line 569 of file PFJetIDSelectionFunctor.h.

Referenced by firstDataCuts(), and initIndex().

index_type PFJetIDSelectionFunctor::indexNHF_
private

Definition at line 563 of file PFJetIDSelectionFunctor.h.

Referenced by firstDataCuts(), and initIndex().

index_type PFJetIDSelectionFunctor::indexNHF_EC_
private

Definition at line 574 of file PFJetIDSelectionFunctor.h.

Referenced by firstDataCuts(), and initIndex().

index_type PFJetIDSelectionFunctor::indexNHF_FW_
private

Definition at line 568 of file PFJetIDSelectionFunctor.h.

Referenced by firstDataCuts(), and initIndex().

index_type PFJetIDSelectionFunctor::indexNNeutrals_EC_
private

Definition at line 578 of file PFJetIDSelectionFunctor.h.

Referenced by firstDataCuts(), and initIndex().

index_type PFJetIDSelectionFunctor::indexNNeutrals_FW_
private

Definition at line 570 of file PFJetIDSelectionFunctor.h.

Referenced by firstDataCuts(), and initIndex().

index_type PFJetIDSelectionFunctor::indexNNeutrals_FW_L_
private

Definition at line 571 of file PFJetIDSelectionFunctor.h.

Referenced by firstDataCuts(), and initIndex().

index_type PFJetIDSelectionFunctor::indexNNeutrals_FW_U_
private

Definition at line 572 of file PFJetIDSelectionFunctor.h.

Referenced by firstDataCuts(), and initIndex().

Quality_t PFJetIDSelectionFunctor::quality_
private
Version_t PFJetIDSelectionFunctor::version_
private