CMS 3D CMS Logo

List of all members | Public Types | Public 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,
  N_VERSIONS
}
 
- Public Types inherited from Selector< pat::Jet >
typedef std::binary_function< pat::Jet, pat::strbitset, bool > base_type
 
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 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_
 
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 Selector< pat::Jet >::bits_, edm::ParameterSet::exists(), FIRSTDATA, Selector< pat::Jet >::getBitTemplate(), edm::ParameterSet::getParameter(), 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_, LOOSE, Selector< pat::Jet >::push_back(), quality_, Selector< pat::Jet >::retInternal_, RUNIISTARTUP, Selector< pat::Jet >::setIgnoredCuts(), AlCaHLTBitMon_QueryRunRegistry::string, TIGHT, TIGHTLEPVETO, version_, WINTER16, and WINTER17.

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 version_ = WINTER17;//set WINTER17 as default
55 
56 
57  if ( qualityStr == "LOOSE") quality_ = LOOSE;
58  else if ( qualityStr == "TIGHT") quality_ = TIGHT;
59  else if ( qualityStr == "TIGHTLEPVETO") quality_ = TIGHTLEPVETO;
60  else quality_ = TIGHT;
61 
62  push_back("CHF" );
63  push_back("NHF" );
64  if( version_ != WINTER17 || quality_ != TIGHT ) push_back("CEF" );
65  push_back("NEF" );
66  push_back("NCH" );
67  push_back("nConstituents");
68  if(version_ == RUNIISTARTUP ){
69  push_back("NEF_FW");
70  push_back("nNeutrals_FW");
71  }
72  if(version_ == WINTER16 ){
73  push_back("NHF_EC");
74  push_back("NEF_EC");
75  push_back("nNeutrals_EC");
76  push_back("NEF_FW");
77  push_back("nNeutrals_FW");
78  }
79  if(version_ == WINTER17 ){
80  push_back("NEF_EC_L");
81  push_back("NEF_EC_U");
82  push_back("nNeutrals_EC");
83  push_back("NEF_FW");
84  push_back("NHF_FW");
85  push_back("nNeutrals_FW");
86  if (quality_ == TIGHTLEPVETO) push_back("MUF");;
87  }
88 
89 
90  if(version_ == WINTER17 && quality_ == LOOSE ){
91  edm::LogWarning("BadJetIDVersion") << "Winter17 JetID version does not support the LOOSE operating point -- defaulting to TIGHT";
92  quality_ = TIGHT;
93  }
94 
96  edm::LogWarning("BadJetIDVersion") << "JetID version does not support the TIGHTLEPVETO operating point -- defaulting to TIGHT";
97  quality_ = TIGHT;
98  }
99 
100 
101  // Set some default cuts for LOOSE, TIGHT
102  if ( quality_ == LOOSE ) {
103  set("CHF", 0.0);
104  set("NHF", 0.99);
105  set("CEF", 0.99);
106  set("NEF", 0.99);
107  set("NCH", 0);
108  set("nConstituents", 1);
109  if(version_ == RUNIISTARTUP){
110  set("NEF_FW",0.90);
111  set("nNeutrals_FW",10);
112  }
113  if(version_ == WINTER16){
114  set("NHF_EC",0.98);
115  set("NEF_EC",0.01);
116  set("nNeutrals_EC",2);
117  set("NEF_FW",0.90);
118  set("nNeutrals_FW",10);
119  }
120 
121 
122  } else if ( quality_ == TIGHT ) {
123  set("CHF", 0.0);
124  set("NHF", 0.9);
125  if(version_ != WINTER17 ) set("CEF", 0.99);
126  set("NEF", 0.9);
127  set("NCH", 0);
128  set("nConstituents", 1);
129  if(version_ == RUNIISTARTUP){
130  set("NEF_FW",0.90);
131  set("nNeutrals_FW",10);
132  }
133  if(version_ == WINTER16){
134  set("NHF_EC",0.98);
135  set("NEF_EC",0.01);
136  set("nNeutrals_EC",2);
137  set("NEF_FW",0.90);
138  set("nNeutrals_FW",10);
139  }
140  if(version_ == WINTER17){
141  set("NEF_EC_L",0.02);
142  set("NEF_EC_U",0.99);
143  set("nNeutrals_EC",2);
144  set("NHF_FW",0.02);
145  set("NEF_FW",0.90);
146  set("nNeutrals_FW",10);
147  }
148 
149  }else if ( quality_ == TIGHTLEPVETO ) {
150  set("CHF", 0.0);
151  set("NHF", 0.9);
152  set("CEF", 0.8);
153  set("NEF", 0.9);
154  set("NCH", 0);
155  set("nConstituents", 1);
156  if(version_ == WINTER17){
157  set("NEF_EC_L",0.02);
158  set("NEF_EC_U",0.99);
159  set("nNeutrals_EC",2);
160  set("NHF_FW",0.02);
161  set("NEF_FW",0.90);
162  set("nNeutrals_FW",10);
163  set("MUF", 0.8);
164  }
165 
166  }
167 
168 
169  // Now check the configuration to see if the user changed anything
170  if ( params.exists("CHF") ) set("CHF", params.getParameter<double>("CHF") );
171  if ( params.exists("NHF") ) set("NHF", params.getParameter<double>("NHF") );
172  if(version_ != WINTER17 || quality_ != TIGHT ) {if ( params.exists("CEF") ) set("CEF", params.getParameter<double>("CEF") );}
173  if ( params.exists("NEF") ) set("NEF", params.getParameter<double>("NEF") );
174  if ( params.exists("NCH") ) set("NCH", params.getParameter<int> ("NCH") );
175  if ( params.exists("nConstituents") ) set("nConstituents", params.getParameter<int> ("nConstituents") );
176  if(version_ == RUNIISTARTUP){
177  if ( params.exists("NEF_FW") ) set("NEF_FW", params.getParameter<double> ("NEF_FW") );
178  if ( params.exists("nNeutrals_FW") ) set("nNeutrals_FW", params.getParameter<int> ("nNeutrals_FW") );
179  }
180  if(version_ == WINTER16){
181  if ( params.exists("NHF_EC") ) set("NHF_EC", params.getParameter<int> ("NHF_EC") );
182  if ( params.exists("NEF_EC") ) set("NEF_EC", params.getParameter<int> ("NEF_EC") );
183  if ( params.exists("nNeutrals_EC") ) set("nNeutrals_EC", params.getParameter<int> ("nNeutrals_EC") );
184  if ( params.exists("NEF_FW") ) set("NEF_FW", params.getParameter<double> ("NEF_FW") );
185  if ( params.exists("nNeutrals_FW") ) set("nNeutrals_FW", params.getParameter<int> ("nNeutrals_FW") );
186  }
187  if(version_ == WINTER17){
188  if ( params.exists("NEF_EC_L") ) set("NEF_EC_L", params.getParameter<int> ("NEF_EC_L") );
189  if ( params.exists("NEF_EC_U") ) set("NEF_EC_U", params.getParameter<int> ("NEF_EC_U") );
190  if ( params.exists("nNeutrals_EC") ) set("nNeutrals_EC", params.getParameter<int> ("nNeutrals_EC") );
191  if ( params.exists("NHF_FW") ) set("NHF_FW", params.getParameter<double> ("NHF_FW") );
192  if ( params.exists("NEF_FW") ) set("NEF_FW", params.getParameter<double> ("NEF_FW") );
193  if ( params.exists("nNeutrals_FW") ) set("nNeutrals_FW", params.getParameter<int> ("nNeutrals_FW") );
194  if ( quality_ == TIGHTLEPVETO ) {if ( params.exists("MUF") ) set("MUF", params.getParameter<int> ("MUF") );}
195  }
196 
197 
198  if ( params.exists("cutsToIgnore") )
199  setIgnoredCuts( params.getParameter<std::vector<std::string> >("cutsToIgnore") );
200 
201 
202  indexNConstituents_ = index_type (&bits_, "nConstituents");
203  indexNEF_ = index_type (&bits_, "NEF");
204  indexNHF_ = index_type (&bits_, "NHF");
205  if(version_ != WINTER17 || quality_ != TIGHT ) indexCEF_ = index_type (&bits_, "CEF");
206 
207  indexCHF_ = index_type (&bits_, "CHF");
208  indexNCH_ = index_type (&bits_, "NCH");
209  if(version_ == RUNIISTARTUP){
210  indexNEF_FW_ = index_type (&bits_, "NEF_FW");
211  indexNNeutrals_FW_ = index_type (&bits_, "nNeutrals_FW");
212  }
213  if(version_ == WINTER16){
214  indexNHF_EC_ = index_type (&bits_, "NHF_EC");
215  indexNEF_EC_ = index_type (&bits_, "NEF_EC");
216  indexNNeutrals_EC_ = index_type (&bits_, "nNeutrals_EC");
217  indexNEF_FW_ = index_type (&bits_, "NEF_FW");
218  indexNNeutrals_FW_ = index_type (&bits_, "nNeutrals_FW");
219  }
220  if(version_ == WINTER17){
221  indexNEF_EC_L_ = index_type (&bits_, "NEF_EC_L");
222  indexNEF_EC_U_ = index_type (&bits_, "NEF_EC_U");
223  indexNNeutrals_EC_ = index_type (&bits_, "nNeutrals_EC");
224  indexNHF_FW_ = index_type (&bits_, "NHF_FW");
225  indexNEF_FW_ = index_type (&bits_, "NEF_FW");
226  indexNNeutrals_FW_ = index_type (&bits_, "nNeutrals_FW");
227  if ( quality_ == TIGHTLEPVETO ) {indexMUF_ = index_type (&bits_, "MUF");}
228 
229 
230  }
231 
232 
233 
235 
236  }
pat::strbitset::index_type index_type
Definition: Selector.h:29
pat::strbitset retInternal_
internal ret if users don&#39;t care about return bits
Definition: Selector.h:287
pat::strbitset bits_
the bitset indexed by strings
Definition: Selector.h:286
virtual void push_back(std::string const &s)
This is the registration of an individual cut string.
Definition: Selector.h:46
pat::strbitset getBitTemplate() const
Get an empty bitset with the proper names.
Definition: Selector.h:212
void setIgnoredCuts(std::vector< std::string > const &bitsToIgnore)
set the bits to ignore from a vector
Definition: Selector.h:167
PFJetIDSelectionFunctor::PFJetIDSelectionFunctor ( Version_t  version,
Quality_t  quality 
)
inline

Definition at line 239 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_, LOOSE, Selector< pat::Jet >::push_back(), quality_, Selector< pat::Jet >::retInternal_, RUNIISTARTUP, TIGHT, TIGHTLEPVETO, version_, WINTER16, and WINTER17.

240  :
242  {
243 
244  push_back("CHF" );
245  push_back("NHF" );
246  if(version_ != WINTER17 || quality_ != TIGHT ) push_back("CEF" );
247  push_back("NEF" );
248  push_back("NCH" );
249  push_back("nConstituents");
250  if(version_ == RUNIISTARTUP){
251  push_back("NEF_FW");
252  push_back("nNeutrals_FW");
253  }
254  if(version_ == WINTER16){
255  push_back("NHF_EC");
256  push_back("NEF_EC");
257  push_back("nNeutrals_EC");
258  push_back("NEF_FW");
259  push_back("nNeutrals_FW");
260  }
261  if(version_ == WINTER17){
262  push_back("NEF_EC_L");
263  push_back("NEF_EC_U");
264  push_back("nNeutrals_EC");
265  push_back("NHF_FW");
266  push_back("NEF_FW");
267  push_back("nNeutrals_FW");
268  if ( quality_ == TIGHTLEPVETO ) { push_back("MUF");}
269  }
270 
271 
272  if(version_ == WINTER17 && quality_ == LOOSE ){
273  edm::LogWarning("BadJetIDVersion") << "Winter17 JetID version does not support the LOOSE operating point -- defaulting to TIGHT";
274  quality_ = TIGHT;
275  }
276  if(version_ != WINTER17 && quality_ == TIGHTLEPVETO){
277  edm::LogWarning("BadJetIDVersion") << "JetID version does not support the TIGHTLEPVETO operating point -- defaulting to TIGHT";
278  quality_ = TIGHT;
279  }
280  // Set some default cuts for LOOSE, TIGHT
281  if ( quality_ == LOOSE ) {
282  set("CHF", 0.0);
283  set("NHF", 0.99);
284  set("CEF", 0.99);
285  set("NEF", 0.99);
286  set("NCH", 0);
287  set("nConstituents", 1);
288  if(version_ == RUNIISTARTUP){
289  set("NEF_FW",0.90);
290  set("nNeutrals_FW",10);
291  }
292  if(version_ == WINTER16){
293  set("NHF_EC",0.98);
294  set("NEF_EC",0.01);
295  set("nNeutrals_EC",2);
296  set("NEF_FW",0.90);
297  set("nNeutrals_FW",10);
298  }
299 
300 
301 
302 
303 
304  } else if ( quality_ == TIGHT ) {
305  set("CHF", 0.0);
306  set("NHF", 0.9);
307  if(version_ != WINTER17) set("CEF", 0.99);
308  set("NEF", 0.9);
309  set("NCH", 0);
310  set("nConstituents", 1);
311  if(version_ == RUNIISTARTUP){
312  set("NEF_FW",0.90);
313  set("nNeutrals_FW",10);
314  }
315  if(version_ == WINTER16){
316  set("NHF_EC",0.98);
317  set("NEF_EC",0.01);
318  set("nNeutrals_EC",2);
319  set("NEF_FW",0.90);
320  set("nNeutrals_FW",10);
321  }
322  if(version_ == WINTER17){
323  set("NEF_EC_L",0.02);
324  set("NEF_EC_U",0.99);
325  set("nNeutrals_EC",2);
326  set("NHF_FW",0.02);
327  set("NEF_FW",0.90);
328  set("nNeutrals_FW",10);
329  }
330 
331  } else if ( quality_ == TIGHTLEPVETO ) {
332  set("CHF", 0.0);
333  set("NHF", 0.9);
334  set("CEF", 0.8);
335  set("NEF", 0.9);
336  set("NCH", 0);
337  set("nConstituents", 1);
338  if(version_ == WINTER17){
339  set("NEF_EC_L",0.02);
340  set("NEF_EC_U",0.99);
341  set("nNeutrals_EC",2);
342  set("NHF_FW",0.02);
343  set("NEF_FW",0.90);
344  set("nNeutrals_FW",10);
345  set("MUF", 0.8);
346  }
347 
348  }
349 
350 
351 
352 
353  indexNConstituents_ = index_type (&bits_, "nConstituents");
354  indexNEF_ = index_type (&bits_, "NEF");
355  indexNHF_ = index_type (&bits_, "NHF");
356  if(version_ != WINTER17 || quality_ != TIGHT ) indexCEF_ = index_type (&bits_, "CEF");
357  indexCHF_ = index_type (&bits_, "CHF");
358  indexNCH_ = index_type (&bits_, "NCH");
359  if(version_ == RUNIISTARTUP){
360  indexNEF_FW_ = index_type (&bits_, "NEF_FW");
361  indexNNeutrals_FW_ = index_type (&bits_, "nNeutrals_FW");
362  }
363  if(version_ == WINTER16){
364  indexNHF_EC_ = index_type (&bits_, "NHF_EC");
365  indexNEF_EC_ = index_type (&bits_, "NEF_EC");
366  indexNNeutrals_EC_ = index_type (&bits_, "nNeutrals_EC");
367  indexNEF_FW_ = index_type (&bits_, "NEF_FW");
368  indexNNeutrals_FW_ = index_type (&bits_, "nNeutrals_FW");
369  }
370  if(version_ == WINTER17){
371 
372  indexNEF_EC_L_ = index_type (&bits_, "NEF_EC_L");
373  indexNEF_EC_U_ = index_type (&bits_, "NEF_EC_U");
374  indexNNeutrals_EC_ = index_type (&bits_, "nNeutrals_EC");
375  indexNHF_FW_ = index_type (&bits_, "NHF_FW");
376  indexNEF_FW_ = index_type (&bits_, "NEF_FW");
377  indexNNeutrals_FW_ = index_type (&bits_, "nNeutrals_FW");
378  if ( quality_ == TIGHTLEPVETO ) { indexMUF_ = index_type (&bits_, "MUF"); }
379  }
380 
381 
383  }
pat::strbitset::index_type index_type
Definition: Selector.h:29
pat::strbitset retInternal_
internal ret if users don&#39;t care about return bits
Definition: Selector.h:287
pat::strbitset bits_
the bitset indexed by strings
Definition: Selector.h:286
virtual void push_back(std::string const &s)
This is the registration of an individual cut string.
Definition: Selector.h:46
pat::strbitset getBitTemplate() const
Get an empty bitset with the proper names.
Definition: Selector.h:212

Member Function Documentation

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

Definition at line 427 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, 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_, 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, WINTER16, and WINTER17.

Referenced by operator()().

429  {
430  ret.set(false);
431 
432  // cache some variables
433  double chf = 0.0;
434  double nhf = 0.0;
435  double cef = 0.0;
436  double nef = 0.0;
437  double muf = 0.0;
438  int nch = 0;
439  int nconstituents = 0;
440  int nneutrals = 0;
441 
442  // Have to do this because pat::Jet inherits from reco::Jet but not reco::PFJet
443  reco::PFJet const * pfJet = dynamic_cast<reco::PFJet const *>(&jet);
444  pat::Jet const * patJet = dynamic_cast<pat::Jet const *>(&jet);
445  reco::BasicJet const * basicJet = dynamic_cast<reco::BasicJet const *>(&jet);
446 
447  if ( patJet != nullptr ) {
448  if ( patJet->isPFJet() ) {
449  chf = patJet->chargedHadronEnergyFraction();
450  nhf = patJet->neutralHadronEnergyFraction();
451  cef = patJet->chargedEmEnergyFraction();
452  nef = patJet->neutralEmEnergyFraction();
453  nch = patJet->chargedMultiplicity();
454  nconstituents = patJet->numberOfDaughters();
455  nneutrals = patJet->neutralMultiplicity();
456  }
457  // Handle the special case where this is a composed jet for
458  // subjet analyses
459  else if ( patJet->isBasicJet() ) {
460  double e_chf = 0.0;
461  double e_nhf = 0.0;
462  double e_cef = 0.0;
463  double e_nef = 0.0;
464  nch = 0;
465  nconstituents = 0;
466  nneutrals = 0;
467 
468  for ( reco::Jet::const_iterator ibegin = patJet->begin(),
469  iend = patJet->end(), isub = ibegin;
470  isub != iend; ++isub ) {
471  reco::PFJet const * pfsub = dynamic_cast<reco::PFJet const *>( &*isub );
472  pat::Jet const * patsub = dynamic_cast<pat::Jet const *>( &*isub );
473  if ( patsub ) {
474  e_chf += patsub->chargedHadronEnergy();
475  e_nhf += patsub->neutralHadronEnergy();
476  e_cef += patsub->chargedEmEnergy();
477  e_nef += patsub->neutralEmEnergy();
478  nch += patsub->chargedMultiplicity();
479  nconstituents += patsub->numberOfDaughters();
480  nneutrals += patsub->neutralMultiplicity();
481  } else if ( pfsub ) {
482  e_chf += pfsub->chargedHadronEnergy();
483  e_nhf += pfsub->neutralHadronEnergy();
484  e_cef += pfsub->chargedEmEnergy();
485  e_nef += pfsub->neutralEmEnergy();
486  nch += pfsub->chargedMultiplicity();
487  nconstituents += pfsub->numberOfDaughters();
488  nneutrals += pfsub->neutralMultiplicity();
489  } else assert(0);
490  }
491  double e = patJet->energy();
492  if ( e > 0.000001 ) {
493  chf = e_chf / e;
494  nhf = e_nhf / e;
495  cef = e_cef / e;
496  nef = e_nef / e;
497  } else {
498  chf = nhf = cef = nef = 0.0;
499  }
500  }
501  } // end if pat jet
502  else if ( pfJet != nullptr ) {
503  // CV: need to compute energy fractions in a way that works for corrected as well as for uncorrected PFJets
504  double jetEnergyUncorrected =
505  pfJet->chargedHadronEnergy()
506  + pfJet->neutralHadronEnergy()
507  + pfJet->photonEnergy()
508  + pfJet->electronEnergy()
509  + pfJet->muonEnergy()
510  + pfJet->HFEMEnergy();
511  if ( jetEnergyUncorrected > 0. ) {
512  chf = pfJet->chargedHadronEnergy() / jetEnergyUncorrected;
513  nhf = pfJet->neutralHadronEnergy() / jetEnergyUncorrected;
514  cef = pfJet->chargedEmEnergy() / jetEnergyUncorrected;
515  nef = pfJet->neutralEmEnergy() / jetEnergyUncorrected;
516  muf = pfJet->muonEnergy() / jetEnergyUncorrected;
517  }
518  nch = pfJet->chargedMultiplicity();
519  nconstituents = pfJet->numberOfDaughters();
520  nneutrals = pfJet->neutralMultiplicity();
521  } // end if PF jet
522  // Handle the special case where this is a composed jet for
523  // subjet analyses
524  else if ( basicJet != nullptr ) {
525  double e_chf = 0.0;
526  double e_nhf = 0.0;
527  double e_cef = 0.0;
528  double e_nef = 0.0;
529  nch = 0;
530  nconstituents = 0;
531  for ( reco::Jet::const_iterator ibegin = basicJet->begin(),
532  iend = patJet->end(), isub = ibegin;
533  isub != iend; ++isub ) {
534  reco::PFJet const * pfsub = dynamic_cast<reco::PFJet const *>( &*isub );
535  e_chf += pfsub->chargedHadronEnergy();
536  e_nhf += pfsub->neutralHadronEnergy();
537  e_cef += pfsub->chargedEmEnergy();
538  e_nef += pfsub->neutralEmEnergy();
539  nch += pfsub->chargedMultiplicity();
540  nconstituents += pfsub->numberOfDaughters();
541  nneutrals += pfsub->neutralMultiplicity();
542  }
543  double e = basicJet->energy();
544  if ( e > 0.000001 ) {
545  chf = e_chf / e;
546  nhf = e_nhf / e;
547  cef = e_cef / e;
548  nef = e_nef / e;
549  }
550  } // end if basic jet
551 
552 
553 
554  // Cuts for |eta| < 2.4 for FIRSTDATA, RUNIISTARTUP, WINTER16 and WINTER17
555  if(version_ != WINTER17 || quality_ != TIGHT ) {if ( ignoreCut(indexCEF_) || ( cef < cut(indexCEF_, double()) || std::abs(jet.eta()) > 2.4 ) ) passCut( ret, indexCEF_);}
556  if ( ignoreCut(indexCHF_) || ( chf > cut(indexCHF_, double()) || std::abs(jet.eta()) > 2.4 ) ) passCut( ret, indexCHF_);
557  if ( ignoreCut(indexNCH_) || ( nch > cut(indexNCH_, int()) || std::abs(jet.eta()) > 2.4 ) ) passCut( ret, indexNCH_);
558 
559  if(version_ == FIRSTDATA){// Cuts for all eta for FIRSTDATA
560  if ( ignoreCut(indexNConstituents_) || ( nconstituents > cut(indexNConstituents_, int()) ) ) passCut( ret, indexNConstituents_);
561  if ( ignoreCut(indexNEF_) || ( nef < cut(indexNEF_, double()) ) ) passCut( ret, indexNEF_);
562  if ( ignoreCut(indexNHF_) || ( nhf < cut(indexNHF_, double()) ) ) passCut( ret, indexNHF_);
563  }else if(version_ == RUNIISTARTUP){
564  // Cuts for |eta| <= 3.0 for RUNIISTARTUP scenario
565  if ( ignoreCut(indexNConstituents_) || ( nconstituents > cut(indexNConstituents_, int()) || std::abs(jet.eta()) > 3.0 ) ) passCut( ret, indexNConstituents_);
566  if ( ignoreCut(indexNEF_) || ( nef < cut(indexNEF_, double()) || std::abs(jet.eta()) > 3.0 ) ) passCut( ret, indexNEF_);
567  if ( ignoreCut(indexNHF_) || ( nhf < cut(indexNHF_, double()) || std::abs(jet.eta()) > 3.0 ) ) passCut( ret, indexNHF_);
568  // Cuts for |eta| > 3.0 for RUNIISTARTUP scenario
569  if ( ignoreCut(indexNEF_FW_) || ( nef < cut(indexNEF_FW_, double()) || std::abs(jet.eta()) <= 3.0 ) ) passCut( ret, indexNEF_FW_);
570  if ( ignoreCut(indexNNeutrals_FW_) || ( nneutrals > cut(indexNNeutrals_FW_, int()) || std::abs(jet.eta()) <= 3.0 ) ) passCut( ret, indexNNeutrals_FW_);
571  }
572  else if(version_ == WINTER16){
573  // Cuts for |eta| <= 2.7 for WINTER16 scenario
574  if ( ignoreCut(indexNConstituents_) || ( nconstituents > cut(indexNConstituents_, int()) || std::abs(jet.eta()) > 2.7 ) ) passCut( ret, indexNConstituents_);
575  if ( ignoreCut(indexNEF_) || ( nef < cut(indexNEF_, double()) || std::abs(jet.eta()) > 2.7 ) ) passCut( ret, indexNEF_);
576  if ( ignoreCut(indexNHF_) || ( nhf < cut(indexNHF_, double()) || std::abs(jet.eta()) > 2.7 ) ) passCut( ret, indexNHF_);
577 
578  // Cuts for 2.7 < |eta| <= 3.0 for WINTER16 scenario
579  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_);
580  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_);
581  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_);
582 
583  // Cuts for |eta| > 3.0 for WINTER16 scenario
584  if ( ignoreCut(indexNEF_FW_) || ( nef < cut(indexNEF_FW_, double()) || std::abs(jet.eta()) <= 3.0 ) ) passCut( ret, indexNEF_FW_);
585  if ( ignoreCut(indexNNeutrals_FW_) || ( nneutrals > cut(indexNNeutrals_FW_, int()) || std::abs(jet.eta()) <= 3.0 ) ) passCut( ret, indexNNeutrals_FW_);
586  }
587  else if(version_ == WINTER17){
588  // Cuts for |eta| <= 2.7 for WINTER17 scenario
589  if ( ignoreCut(indexNConstituents_) || ( nconstituents > cut(indexNConstituents_, int()) || std::abs(jet.eta()) > 2.7 ) ) passCut( ret, indexNConstituents_);
590  if ( ignoreCut(indexNEF_) || ( nef < cut(indexNEF_, double()) || std::abs(jet.eta()) > 2.7 ) ) passCut( ret, indexNEF_);
591  if ( ignoreCut(indexNHF_) || ( nhf < cut(indexNHF_, double()) || std::abs(jet.eta()) > 2.7 ) ) passCut( ret, indexNHF_);
592  if ( quality_ == TIGHTLEPVETO ) {if ( ignoreCut(indexMUF_) || ( muf < cut(indexMUF_, double()) || std::abs(jet.eta()) > 2.7 ) ) passCut( ret, indexMUF_);}
593 
594  // Cuts for 2.7 < |eta| <= 3.0 for WINTER17 scenario
595 
596  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_);
597  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_);
598  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_);
599 
600  // Cuts for |eta| > 3.0 for WINTER17 scenario
601  if ( ignoreCut(indexNHF_FW_) || ( nhf > cut(indexNHF_FW_, double()) || std::abs(jet.eta()) <= 3.0 ) ) passCut( ret, indexNHF_FW_);
602  if ( ignoreCut(indexNEF_FW_) || ( nef < cut(indexNEF_FW_, double()) || std::abs(jet.eta()) <= 3.0 ) ) passCut( ret, indexNEF_FW_);
603  if ( ignoreCut(indexNNeutrals_FW_) || ( nneutrals > cut(indexNNeutrals_FW_, int()) || std::abs(jet.eta()) <= 3.0 ) ) passCut( ret, indexNNeutrals_FW_);
604 
605  }
606 
607  //std::cout << "<PFJetIDSelectionFunctor::firstDataCuts>:" << std::endl;
608  //std::cout << " jet: Pt = " << jet.pt() << ", eta = " << jet.eta() << ", phi = " << jet.phi() << std::endl;
609  //ret.print(std::cout);
610 
611  setIgnored( ret );
612  return (bool)ret;
613  }
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: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
float neutralHadronEnergy() const
neutralHadronEnergy
Definition: Jet.h:656
float chargedEmEnergyFraction() const
chargedEmEnergyFraction (relative to uncorrected jet energy)
Definition: Jet.h:376
void setIgnored(pat::strbitset &ret)
set ignored bits
Definition: Selector.h:224
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 chargedEmEnergy() const
chargedEmEnergy
Definition: Jet.h:663
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: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
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:684
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
bool PFJetIDSelectionFunctor::operator() ( const pat::Jet jet,
pat::strbitset ret 
)
inlineoverride

Definition at line 389 of file PFJetIDSelectionFunctor.h.

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

Referenced by operator()().

390  {
392  if ( jet.currentJECLevel() == "Uncorrected" || !jet.jecSetsAvailable() )
393  return firstDataCuts( jet, ret, version_);
394  else
395  return firstDataCuts( jet.correctedJet("Uncorrected"), ret, version_ );
396  }
397  else {
398  return false;
399  }
400  }
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 416 of file PFJetIDSelectionFunctor.h.

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

417  {
418  retInternal_.set(false);
419  operator()(jet, retInternal_);
421  return (bool)retInternal_;
422  }
void setIgnored(pat::strbitset &ret)
set ignored bits
Definition: Selector.h:224
pat::strbitset retInternal_
internal ret if users don&#39;t care about return bits
Definition: Selector.h:287
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 624 of file PFJetIDSelectionFunctor.h.

Referenced by firstDataCuts(), and PFJetIDSelectionFunctor().

index_type PFJetIDSelectionFunctor::indexCHF_
private

Definition at line 625 of file PFJetIDSelectionFunctor.h.

Referenced by firstDataCuts(), and PFJetIDSelectionFunctor().

index_type PFJetIDSelectionFunctor::indexMUF_
private

Definition at line 622 of file PFJetIDSelectionFunctor.h.

Referenced by firstDataCuts(), and PFJetIDSelectionFunctor().

index_type PFJetIDSelectionFunctor::indexNCH_
private

Definition at line 626 of file PFJetIDSelectionFunctor.h.

Referenced by firstDataCuts(), and PFJetIDSelectionFunctor().

index_type PFJetIDSelectionFunctor::indexNConstituents_
private

Definition at line 620 of file PFJetIDSelectionFunctor.h.

Referenced by firstDataCuts(), and PFJetIDSelectionFunctor().

index_type PFJetIDSelectionFunctor::indexNEF_
private

Definition at line 621 of file PFJetIDSelectionFunctor.h.

Referenced by firstDataCuts(), and PFJetIDSelectionFunctor().

index_type PFJetIDSelectionFunctor::indexNEF_EC_
private

Definition at line 633 of file PFJetIDSelectionFunctor.h.

Referenced by firstDataCuts(), and PFJetIDSelectionFunctor().

index_type PFJetIDSelectionFunctor::indexNEF_EC_L_
private

Definition at line 634 of file PFJetIDSelectionFunctor.h.

Referenced by firstDataCuts(), and PFJetIDSelectionFunctor().

index_type PFJetIDSelectionFunctor::indexNEF_EC_U_
private

Definition at line 635 of file PFJetIDSelectionFunctor.h.

Referenced by firstDataCuts(), and PFJetIDSelectionFunctor().

index_type PFJetIDSelectionFunctor::indexNEF_FW_
private

Definition at line 629 of file PFJetIDSelectionFunctor.h.

Referenced by firstDataCuts(), and PFJetIDSelectionFunctor().

index_type PFJetIDSelectionFunctor::indexNHF_
private

Definition at line 623 of file PFJetIDSelectionFunctor.h.

Referenced by firstDataCuts(), and PFJetIDSelectionFunctor().

index_type PFJetIDSelectionFunctor::indexNHF_EC_
private

Definition at line 632 of file PFJetIDSelectionFunctor.h.

Referenced by firstDataCuts(), and PFJetIDSelectionFunctor().

index_type PFJetIDSelectionFunctor::indexNHF_FW_
private

Definition at line 628 of file PFJetIDSelectionFunctor.h.

Referenced by firstDataCuts(), and PFJetIDSelectionFunctor().

index_type PFJetIDSelectionFunctor::indexNNeutrals_EC_
private

Definition at line 636 of file PFJetIDSelectionFunctor.h.

Referenced by firstDataCuts(), and PFJetIDSelectionFunctor().

index_type PFJetIDSelectionFunctor::indexNNeutrals_FW_
private

Definition at line 630 of file PFJetIDSelectionFunctor.h.

Referenced by firstDataCuts(), and PFJetIDSelectionFunctor().

Quality_t PFJetIDSelectionFunctor::quality_
private

Definition at line 618 of file PFJetIDSelectionFunctor.h.

Referenced by firstDataCuts(), and PFJetIDSelectionFunctor().

Version_t PFJetIDSelectionFunctor::version_
private

Definition at line 617 of file PFJetIDSelectionFunctor.h.

Referenced by operator()(), and PFJetIDSelectionFunctor().