CMS 3D CMS Logo

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

Jet selector for pat::Jets and for CaloJets. More...

#include "PhysicsTools/Utilities/interface/JetIDSelectionFunctor.h"

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

Public Types

enum  Quality_t {
  MINIMAL, LOOSE_AOD, LOOSE, TIGHT,
  N_QUALITY
}
 
enum  Version_t { CRAFT08, PURE09, DQM09, 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

unsigned int count_hits (const std::vector< CaloTowerPtr > &towers)
 
bool craft08Cuts (reco::Candidate::LorentzVector const &correctedP4, double emEnergyFraction, reco::JetID const &jetID, pat::strbitset &ret)
 
bool fwd09Cuts (reco::Candidate::LorentzVector const &rawP4, double emEnergyFraction, double etaWidth, double phiWidth, unsigned int nHit, reco::JetID const &jetID, pat::strbitset &ret)
 
void initialize (Version_t version, Quality_t quality)
 
 JetIDSelectionFunctor ()
 
 JetIDSelectionFunctor (edm::ParameterSet const &parameters, edm::ConsumesCollector &iC)
 
 JetIDSelectionFunctor (edm::ParameterSet const &parameters)
 
 JetIDSelectionFunctor (Version_t version, Quality_t quality)
 
bool operator() (const pat::Jet &jet, pat::strbitset &ret) override
 
bool operator() (reco::Candidate::LorentzVector const &correctedP4, double emEnergyFraction, reco::JetID const &jetID, pat::strbitset &ret)
 
virtual bool operator() (reco::Candidate::LorentzVector const &correctedP4, double emEnergyFraction, reco::JetID const &jetID)
 accessor like previous, without the ret More...
 
bool operator() (reco::CaloJet const &jet, reco::JetID const &jetID, pat::strbitset &ret)
 
virtual bool operator() (reco::CaloJet const &jet, reco::JetID const &jetID)
 accessor like previous, without the ret More...
 
- 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 index_EF_EMF_
 
index_type index_EF_N90Hits_
 
index_type index_LOOSE_als_
 
index_type index_LOOSE_AOD_EMF_
 
index_type index_LOOSE_AOD_fHPD_
 
index_type index_LOOSE_AOD_N90Hits_
 
index_type index_LOOSE_EMF_
 
index_type index_LOOSE_fHPD_
 
index_type index_LOOSE_fls_
 
index_type index_LOOSE_foot_
 
index_type index_LOOSE_N90Hits_
 
index_type index_LOOSE_nHit_
 
index_type index_MINIMAL_EMF_
 
index_type index_TIGHT_als_
 
index_type index_TIGHT_EMF_
 
index_type index_TIGHT_fHPD_
 
index_type index_TIGHT_fls_
 
index_type index_TIGHT_foot_
 
index_type index_TIGHT_nHit_
 
index_type index_widths_
 
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

Jet selector for pat::Jets and for CaloJets.

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.

Author
Salvatore Rappoccio (Update: Amnon Harel)
Version
Id
JetIDSelectionFunctor.h,v 1.15 2010/08/31 20:31:50 srappocc Exp

Definition at line 32 of file JetIDSelectionFunctor.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

JetIDSelectionFunctor::JetIDSelectionFunctor ( )
inline

Definition at line 39 of file JetIDSelectionFunctor.h.

39 {}
JetIDSelectionFunctor::JetIDSelectionFunctor ( edm::ParameterSet const &  parameters,
edm::ConsumesCollector iC 
)
inline

Definition at line 42 of file JetIDSelectionFunctor.h.

JetIDSelectionFunctor::JetIDSelectionFunctor ( edm::ParameterSet const &  parameters)
inline

Definition at line 48 of file JetIDSelectionFunctor.h.

References CRAFT08, DQM09, Exception, edm::ParameterSet::getParameter(), initialize(), LOOSE, LOOSE_AOD, MINIMAL, N_QUALITY, PURE09, jets_cff::quality, AlCaHLTBitMon_QueryRunRegistry::string, and TIGHT.

48  {
49  std::string versionStr = parameters.getParameter<std::string>("version");
50  std::string qualityStr = parameters.getParameter<std::string>("quality");
52 
53  if ( qualityStr == "MINIMAL" ) quality = MINIMAL;
54  else if ( qualityStr == "LOOSE_AOD" ) quality = LOOSE_AOD;
55  else if ( qualityStr == "LOOSE" ) quality = LOOSE;
56  else if ( qualityStr == "TIGHT" ) quality = TIGHT;
57  else
58  throw cms::Exception("InvalidInput") << "Expect quality to be one of MINIMAL, LOOSE_AOD, LOOSE,TIGHT" << std::endl;
59 
60 
61  if ( versionStr == "CRAFT08" ) {
62  initialize( CRAFT08, quality );
63  }
64  else if ( versionStr == "PURE09" ) {
65  initialize( PURE09, quality );
66  }
67  else if ( versionStr == "DQM09" ) {
68  initialize( DQM09, quality );
69  }
70  else {
71  throw cms::Exception("InvalidInput") << "Expect version to be one of CRAFT08, PURE09, DQM09" << std::endl;
72  }
73  }
void initialize(Version_t version, Quality_t quality)
JetIDSelectionFunctor::JetIDSelectionFunctor ( Version_t  version,
Quality_t  quality 
)
inline

Definition at line 75 of file JetIDSelectionFunctor.h.

References initialize().

75  {
77  }
void initialize(Version_t version, Quality_t quality)

Member Function Documentation

unsigned int JetIDSelectionFunctor::count_hits ( const std::vector< CaloTowerPtr > &  towers)
inline

Definition at line 230 of file JetIDSelectionFunctor.h.

Referenced by operator()().

231  {
232  unsigned int nHit = 0;
233  for ( unsigned int iTower = 0; iTower < towers.size() ; ++iTower ) {
234  const std::vector<DetId>& cellIDs = towers[iTower]->constituents(); // cell == recHit
235  nHit += cellIDs.size();
236  }
237  return nHit;
238  }
bool JetIDSelectionFunctor::craft08Cuts ( reco::Candidate::LorentzVector const &  correctedP4,
double  emEnergyFraction,
reco::JetID const &  jetID,
pat::strbitset ret 
)
inline

Definition at line 324 of file JetIDSelectionFunctor.h.

References Abs(), reco::JetID::approximatefHPD, jetCorrFactors_cfi::emf, reco::JetID::fHPD, reco::JetID::hitsInN90, Selector< pat::Jet >::ignoreCut(), index_LOOSE_AOD_EMF_, index_LOOSE_AOD_fHPD_, index_LOOSE_AOD_N90Hits_, index_LOOSE_EMF_, index_LOOSE_fHPD_, index_LOOSE_N90Hits_, index_MINIMAL_EMF_, index_TIGHT_EMF_, index_TIGHT_fHPD_, LOOSE, LOOSE_AOD, reco::JetID::n90Hits, Selector< pat::Jet >::passCut(), quality_, pat::strbitset::set(), Selector< pat::Jet >::setIgnored(), and TIGHT.

Referenced by operator()().

328  {
329 
330  ret.set(false);
331 
332  // cache some variables
333  double abs_eta = TMath::Abs( correctedP4.eta() );
334  double corrPt = correctedP4.pt();
335  double emf = emEnergyFraction;
336 
337  if ( ignoreCut(index_MINIMAL_EMF_) || abs_eta > 2.6 || emf > 0.01 ) passCut( ret, index_MINIMAL_EMF_);
338 
339  if ( quality_ == LOOSE_AOD ) {
340  // loose fhpd cut from aod
341  if ( ignoreCut(index_LOOSE_AOD_fHPD_) || jetID.approximatefHPD < 0.98 ) passCut( ret, index_LOOSE_AOD_fHPD_);
342  // loose n90 hits cut
343  if ( ignoreCut(index_LOOSE_AOD_N90Hits_) || jetID.hitsInN90 > 1 ) passCut( ret, index_LOOSE_AOD_N90Hits_);
344 
345  // loose EMF Cut from aod
346  bool emf_loose = true;
347  if( abs_eta <= 2.6 ) { // HBHE
348  if( emEnergyFraction <= 0.01 ) emf_loose = false;
349  } else { // HF
350  if( emEnergyFraction <= -0.9 ) emf_loose = false;
351  if( corrPt > 80 && emEnergyFraction >= 1 ) emf_loose = false;
352  }
353  if ( ignoreCut(index_LOOSE_AOD_EMF_) || emf_loose ) passCut(ret, index_LOOSE_AOD_EMF_);
354 
355  }
356  else if ( quality_ == LOOSE || quality_ == TIGHT ) {
357  // loose fhpd cut
358  if ( ignoreCut(index_LOOSE_fHPD_) || jetID.fHPD < 0.98 ) passCut( ret, index_LOOSE_fHPD_);
359  // loose n90 hits cut
360  if ( ignoreCut(index_LOOSE_N90Hits_) || jetID.n90Hits > 1 ) passCut( ret, index_LOOSE_N90Hits_);
361 
362  // loose EMF Cut
363  bool emf_loose = true;
364  if( abs_eta <= 2.6 ) { // HBHE
365  if( emEnergyFraction <= 0.01 ) emf_loose = false;
366  } else { // HF
367  if( emEnergyFraction <= -0.9 ) emf_loose = false;
368  if( corrPt > 80 && emEnergyFraction >= 1 ) emf_loose = false;
369  }
370  if ( ignoreCut(index_LOOSE_EMF_) || emf_loose ) passCut(ret, index_LOOSE_EMF_);
371 
372  if ( quality_ == TIGHT ) {
373  // tight fhpd cut
374  bool tight_fhpd = true;
375  if ( corrPt >= 25 && jetID.fHPD >= 0.95 ) tight_fhpd = false; // this was supposed to use raw pT, see AN2009/087 :-(
376  if ( ignoreCut(index_TIGHT_fHPD_) || tight_fhpd ) passCut(ret, index_TIGHT_fHPD_);
377 
378  // tight emf cut
379  bool tight_emf = true;
380  if( abs_eta >= 1 && corrPt >= 80 && emEnergyFraction >= 1 ) tight_emf = false; // outside HB
381  if( abs_eta >= 2.6 ) { // outside HBHE
382  if( emEnergyFraction <= -0.3 ) tight_emf = false;
383  if( abs_eta < 3.25 ) { // HE-HF transition region
384  if( corrPt >= 50 && emEnergyFraction <= -0.2 ) tight_emf = false;
385  if( corrPt >= 80 && emEnergyFraction <= -0.1 ) tight_emf = false;
386  if( corrPt >= 340 && emEnergyFraction >= 0.95 ) tight_emf = false;
387  } else { // HF
388  if( emEnergyFraction >= 0.9 ) tight_emf = false;
389  if( corrPt >= 50 && emEnergyFraction <= -0.2 ) tight_emf = false;
390  if( corrPt >= 50 && emEnergyFraction >= 0.8 ) tight_emf = false;
391  if( corrPt >= 130 && emEnergyFraction <= -0.1 ) tight_emf = false;
392  if( corrPt >= 130 && emEnergyFraction >= 0.7 ) tight_emf = false;
393 
394  } // end if HF
395  }// end if outside HBHE
396  if ( ignoreCut(index_TIGHT_EMF_) || tight_emf ) passCut(ret, index_TIGHT_EMF_);
397  }// end if tight
398  }// end if loose or tight
399 
400  setIgnored( ret );
401 
402  return (bool)ret;
403  }
void setIgnored(pat::strbitset &ret)
set ignored bits
Definition: Selector.h:224
void passCut(pat::strbitset &ret, std::string const &s)
Passing cuts.
Definition: Selector.h:176
emf
the use of emf in the JEC is not yet implemented
bool ignoreCut(std::string const &s) const
ignore the cut at index "s"
Definition: Selector.h:159
T Abs(T a)
Definition: MathUtil.h:49
reco::Candidate::LorentzVector correctedP4(const T &rawMEt, const CorrMETData &correction)
strbitset & set(bool val=true)
set method of all bits
Definition: strbitset.h:144
bool JetIDSelectionFunctor::fwd09Cuts ( reco::Candidate::LorentzVector const &  rawP4,
double  emEnergyFraction,
double  etaWidth,
double  phiWidth,
unsigned int  nHit,
reco::JetID const &  jetID,
pat::strbitset ret 
)
inline

Definition at line 408 of file JetIDSelectionFunctor.h.

References Abs(), reco::JetID::approximatefHPD, jetCorrFactors_cfi::emf, reco::JetID::fHFOOT, reco::JetID::fHPD, reco::JetID::fLong, reco::JetID::fLS, reco::JetID::fShort, HB, CaloTPGTranscoder_cfi::HBHE, CaloTPGTranscoder_cfi::HF, reco::JetID::hitsInN90, Selector< pat::Jet >::ignoreCut(), index_EF_EMF_, index_EF_N90Hits_, index_LOOSE_als_, index_LOOSE_AOD_fHPD_, index_LOOSE_AOD_N90Hits_, index_LOOSE_fHPD_, index_LOOSE_fls_, index_LOOSE_foot_, index_LOOSE_N90Hits_, index_LOOSE_nHit_, index_MINIMAL_EMF_, index_TIGHT_als_, index_TIGHT_EMF_, index_TIGHT_fHPD_, index_TIGHT_fls_, index_TIGHT_foot_, index_TIGHT_nHit_, index_widths_, Max(), Min(), reco::JetID::n90Hits, Selector< pat::Jet >::passCut(), pat::strbitset::set(), and Selector< pat::Jet >::setIgnored().

Referenced by operator()().

412  {
413  ret.set(false);
414 
415  // cache some variables
416  double abs_eta = TMath::Abs( rawP4.eta() );
417  double rawPt = rawP4.pt();
418  double emf = emEnergyFraction;
419  double fhf = jetID.fLong + jetID.fShort;
420  double lnpt = ( rawPt > 0 ) ? TMath::Log( rawPt ) : -10;
421  double lnE = ( rawP4.energy() > 0 ) ? TMath::Log( rawP4.energy() ) : -10;
422 
423  bool HB = abs_eta < 1.0;
424  bool EF = 2.6 <= abs_eta && abs_eta < 3.4 && 0.1 <= fhf && fhf < 0.9;
425  bool HBHE = abs_eta < 2.6 || ( abs_eta < 3.4 && fhf < 0.1 );
426  bool HF = 3.4 <= abs_eta || ( 2.6 <= abs_eta && 0.9 <= fhf );
427  bool HFa = HF && abs_eta < 3.8;
428  bool HFb = HF && ! HFa;
429 
430  // HBHE cuts as in CRAFT08
431  // - but using raw pTs
432  // ========================
433 
434  if ( (!HBHE) || ignoreCut(index_MINIMAL_EMF_) || emf > 0.01 ) passCut( ret, index_MINIMAL_EMF_);
435 
436  // loose fhpd cut from AOD
437  if ( (!HBHE) || ignoreCut(index_LOOSE_AOD_fHPD_) || jetID.approximatefHPD < 0.98 ) passCut( ret, index_LOOSE_AOD_fHPD_);
438  // loose n90 hits cut from AOD
439  if ( (!HBHE) || ignoreCut(index_LOOSE_AOD_N90Hits_) || jetID.hitsInN90 > 1 ) passCut( ret, index_LOOSE_AOD_N90Hits_);
440 
441  // loose fhpd cut
442  if ( (!HBHE) || ignoreCut(index_LOOSE_fHPD_) || jetID.fHPD < 0.98 ) passCut( ret, index_LOOSE_fHPD_);
443  // loose n90 hits cut
444  if ( (!HBHE) || ignoreCut(index_LOOSE_N90Hits_) || jetID.n90Hits > 1 ) passCut( ret, index_LOOSE_N90Hits_);
445 
446  // tight fhpd cut
447  if ( (!HBHE) || ignoreCut(index_TIGHT_fHPD_) || rawPt < 25 || jetID.fHPD < 0.95 ) passCut(ret, index_TIGHT_fHPD_);
448 
449  // tight emf cut
450  if ( (!HBHE) || ignoreCut(index_TIGHT_EMF_) || HB || rawPt < 55 || emf < 1 ) passCut(ret, index_TIGHT_EMF_);
451 
452 
453  // EF - these cuts are only used in "tight", but there's no need for this test here.
454 
455  if( (!EF) || ignoreCut( index_EF_N90Hits_ )
456  || jetID.n90Hits > 1 + 1.5 * TMath::Max( 0., lnpt - 1.5 ) )
457  passCut( ret, index_EF_N90Hits_ );
458 
459  if( (!EF) || ignoreCut( index_EF_EMF_ )
460  || emf > TMath::Max( -0.9, -0.1 - 0.05 * TMath::Power( TMath::Max( 0., 5 - lnpt ), 2. ) ) )
461  passCut( ret, index_EF_EMF_ );
462 
463  // both EF and HF
464 
465  if( ( !( EF || HF ) ) || ignoreCut( index_TIGHT_fls_ )
466  || ( EF && jetID.fLS < TMath::Min( 0.8, 0.1 + 0.016 * TMath::Power( TMath::Max( 0., 6 - lnpt ), 2.5 ) ) )
467  || ( HFa && jetID.fLS < TMath::Min( 0.6, 0.05 + 0.045 * TMath::Power( TMath::Max( 0., 7.5 - lnE ), 2.2 ) ) )
468  || ( HFb && jetID.fLS < TMath::Min( 0.1, 0.05 + 0.07 * TMath::Power( TMath::Max( 0., 7.8 - lnE ), 2. ) ) ) )
469  passCut( ret, index_TIGHT_fls_ );
470 
471  if( ( !( EF || HF ) ) || ignoreCut( index_widths_ )
472  || ( 1E-10 < etaWidth && etaWidth < 0.12 &&
473  1E-10 < phiWidth && phiWidth < 0.12 ) )
474  passCut( ret, index_widths_ );
475 
476  // HF cuts
477 
478  if( (!HF) || ignoreCut( index_LOOSE_nHit_ )
479  || ( HFa && nHit > 1 + 2.4*( lnpt - 1. ) )
480  || ( HFb && nHit > 1 + 3.*( lnpt - 1. ) ) )
481  passCut( ret, index_LOOSE_nHit_ );
482 
483  if( (!HF) || ignoreCut( index_LOOSE_als_ )
484  || ( emf < 0.6 + 0.05 * TMath::Power( TMath::Max( 0., 9 - lnE ), 1.5 ) &&
485  emf > -0.2 - 0.041 * TMath::Power( TMath::Max( 0., 7.5 - lnE ), 2.2 ) ) )
486  passCut( ret, index_LOOSE_als_ );
487 
488  if( (!HF) || ignoreCut( index_LOOSE_fls_ )
489  || ( HFa && jetID.fLS < TMath::Min( 0.9, 0.1 + 0.05 * TMath::Power( TMath::Max( 0., 7.5 - lnE ), 2.2 ) ) )
490  || ( HFb && jetID.fLS < TMath::Min( 0.6, 0.1 + 0.065 * TMath::Power( TMath::Max( 0., 7.5 - lnE ), 2.2 ) ) ) )
491  passCut( ret, index_LOOSE_fls_ );
492 
493  if( (!HF) || ignoreCut( index_LOOSE_foot_ )
494  || jetID.fHFOOT < 0.9 )
495  passCut( ret, index_LOOSE_foot_ );
496 
497  if( (!HF) || ignoreCut( index_TIGHT_nHit_ )
498  || ( HFa && nHit > 1 + 2.7*( lnpt - 0.8 ) )
499  || ( HFb && nHit > 1 + 3.5*( lnpt - 0.8 ) ) )
500  passCut( ret, index_TIGHT_nHit_ );
501 
502  if( (!HF) || ignoreCut( index_TIGHT_als_ )
503  || ( emf < 0.5 + 0.057 * TMath::Power( TMath::Max( 0., 9 - lnE ), 1.5 ) &&
504  emf > TMath::Max( -0.6, -0.1 - 0.026 * TMath::Power( TMath::Max( 0., 8 - lnE ), 2.2 ) ) ) )
505  passCut( ret, index_TIGHT_als_ );
506 
507  if( (!HF) || ignoreCut( index_TIGHT_foot_ )
508  || jetID.fLS < 0.5 )
509  passCut( ret, index_TIGHT_foot_ );
510 
511  setIgnored( ret );
512 
513  return (bool)ret;
514  }
void setIgnored(pat::strbitset &ret)
set ignored bits
Definition: Selector.h:224
T Min(T a, T b)
Definition: MathUtil.h:39
void passCut(pat::strbitset &ret, std::string const &s)
Passing cuts.
Definition: Selector.h:176
emf
the use of emf in the JEC is not yet implemented
bool ignoreCut(std::string const &s) const
ignore the cut at index "s"
Definition: Selector.h:159
T Abs(T a)
Definition: MathUtil.h:49
T Max(T a, T b)
Definition: MathUtil.h:44
strbitset & set(bool val=true)
set method of all bits
Definition: strbitset.h:144
void JetIDSelectionFunctor::initialize ( Version_t  version,
Quality_t  quality 
)
inline

Definition at line 79 of file JetIDSelectionFunctor.h.

References Selector< pat::Jet >::bits_, CRAFT08, DQM09, funct::false, Selector< pat::Jet >::getBitTemplate(), index_EF_EMF_, index_EF_N90Hits_, index_LOOSE_als_, index_LOOSE_AOD_EMF_, index_LOOSE_AOD_fHPD_, index_LOOSE_AOD_N90Hits_, index_LOOSE_EMF_, index_LOOSE_fHPD_, index_LOOSE_fls_, index_LOOSE_foot_, index_LOOSE_N90Hits_, index_LOOSE_nHit_, index_MINIMAL_EMF_, index_TIGHT_als_, index_TIGHT_EMF_, index_TIGHT_fHPD_, index_TIGHT_fls_, index_TIGHT_foot_, index_TIGHT_nHit_, index_widths_, LOOSE, LOOSE_AOD, Selector< pat::Jet >::push_back(), jets_cff::quality, quality_, Selector< pat::Jet >::retInternal_, TIGHT, jets_cff::version, and version_.

Referenced by JetIDSelectionFunctor().

80  {
81 
82  version_ = version;
83  quality_ = quality;
84 
85  push_back("MINIMAL_EMF");
86 
87  push_back("LOOSE_AOD_fHPD");
88  push_back("LOOSE_AOD_N90Hits");
89  push_back("LOOSE_AOD_EMF");
90 
91  push_back("LOOSE_fHPD");
92  push_back("LOOSE_N90Hits");
93  push_back("LOOSE_EMF");
94 
95  push_back("TIGHT_fHPD");
96  push_back("TIGHT_EMF");
97 
98  push_back("LOOSE_nHit");
99  push_back("LOOSE_als");
100  push_back("LOOSE_fls");
101  push_back("LOOSE_foot");
102 
103  push_back("TIGHT_nHit");
104  push_back("TIGHT_als");
105  push_back("TIGHT_fls");
106  push_back("TIGHT_foot");
107  push_back("widths");
108  push_back("EF_N90Hits");
109  push_back("EF_EMF");
110 
111 
112  bool use_09_fwd_id = version_ != CRAFT08; // CRAFT08 predates the 09 forward ID cuts
113  bool use_dqm_09 = version_ == DQM09 && quality_ != LOOSE_AOD;
114 
115  // all appropriate for version and format (AOD complications) are on by default
116  set( "MINIMAL_EMF" );
117  set( "LOOSE_AOD_fHPD" );
118  set( "LOOSE_AOD_N90Hits" );
119  set( "LOOSE_AOD_EMF", ! use_09_fwd_id ); // except in CRAFT08, this devolves into MINIMAL_EMF
120  set( "LOOSE_fHPD" );
121  set( "LOOSE_N90Hits" );
122  set( "LOOSE_EMF", ! use_09_fwd_id ); // except in CRAFT08, this devolves into MINIMAL_EMF
123  set( "TIGHT_fHPD" );
124  set( "TIGHT_EMF" );
125 
126  set( "LOOSE_nHit", use_09_fwd_id );
127  set( "LOOSE_als", use_09_fwd_id );
128  set( "TIGHT_nHit", use_09_fwd_id );
129  set( "TIGHT_als", use_09_fwd_id );
130  set( "widths", use_09_fwd_id );
131  set( "EF_N90Hits", use_09_fwd_id );
132  set( "EF_EMF", use_09_fwd_id );
133 
134  set( "LOOSE_fls", use_dqm_09 );
135  set( "LOOSE_foot", use_dqm_09 );
136  set( "TIGHT_fls", use_dqm_09 );
137  set( "TIGHT_foot", use_dqm_09 );
138 
139 
140 
141 
142  index_MINIMAL_EMF_ = index_type(&bits_, "MINIMAL_EMF");
143 
144  index_LOOSE_AOD_fHPD_ = index_type(&bits_, "LOOSE_AOD_fHPD");
145  index_LOOSE_AOD_N90Hits_ = index_type(&bits_, "LOOSE_AOD_N90Hits");
146  index_LOOSE_AOD_EMF_ = index_type(&bits_, "LOOSE_AOD_EMF");
147 
148  index_LOOSE_fHPD_ = index_type(&bits_, "LOOSE_fHPD");
149  index_LOOSE_N90Hits_ = index_type(&bits_, "LOOSE_N90Hits");
150  index_LOOSE_EMF_ = index_type(&bits_, "LOOSE_EMF");
151 
152  index_TIGHT_fHPD_ = index_type(&bits_, "TIGHT_fHPD");
153  index_TIGHT_EMF_ = index_type(&bits_, "TIGHT_EMF");
154 
155  index_LOOSE_nHit_ = index_type(&bits_, "LOOSE_nHit");
156  index_LOOSE_als_ = index_type(&bits_, "LOOSE_als");
157  index_LOOSE_fls_ = index_type(&bits_, "LOOSE_fls");
158  index_LOOSE_foot_ = index_type(&bits_, "LOOSE_foot");
159 
160  index_TIGHT_nHit_ = index_type(&bits_, "TIGHT_nHit");
161  index_TIGHT_als_ = index_type(&bits_, "TIGHT_als");
162  index_TIGHT_fls_ = index_type(&bits_, "TIGHT_fls");
163  index_TIGHT_foot_ = index_type(&bits_, "TIGHT_foot");
164  index_widths_ = index_type(&bits_, "widths");
165  index_EF_N90Hits_ = index_type(&bits_, "EF_N90Hits");
166  index_EF_EMF_ = index_type(&bits_, "EF_EMF");
167 
168  // now set the return values for the ignored parts
169  bool use_loose_aod = false;
170  bool use_loose = false;
171  bool use_tight = false;
172  bool use_tight_09_fwd_id = false;
173  bool use_loose_09_fwd_id = false;
174  // if ( quality_ == MINIMAL ) nothing to do...
175  if ( quality_ == LOOSE ) {
176  use_loose = true;
177  if( use_09_fwd_id ) use_loose_09_fwd_id = true;
178  }
179  if ( quality_ == LOOSE_AOD ) {
180  use_loose_aod = true;
181  if( use_09_fwd_id ) use_loose_09_fwd_id = true;
182  }
183  if ( quality_ == TIGHT ) {
184  use_tight = true;
185  if( use_09_fwd_id ) use_tight_09_fwd_id = true;
186  }
187 
188  if( ! use_loose_aod ) {
189  set("LOOSE_AOD_fHPD", false );
190  set("LOOSE_AOD_N90Hits", false );
191  set("LOOSE_AOD_EMF", false );
192  }
193 
194  if( ! ( use_loose || use_tight ) ) { // the CRAFT08 cuts are cumulative
195  set("LOOSE_N90Hits", false );
196  set("LOOSE_fHPD", false );
197  set("LOOSE_EMF", false );
198  }
199 
200  if( ! use_tight ) {
201  set("TIGHT_fHPD", false );
202  set("TIGHT_EMF", false );
203  }
204 
205  if( ! use_loose_09_fwd_id ) { // the FWD09 cuts are not
206  set( "LOOSE_nHit", false );
207  set( "LOOSE_als", false );
208  if( use_dqm_09 ) {
209  set( "LOOSE_fls", false );
210  set( "LOOSE_foot", false );
211  }
212  } // not using loose 09 fwd ID
213 
214  if( ! use_tight_09_fwd_id ) {
215  set( "TIGHT_nHit", false );
216  set( "TIGHT_als", false );
217  set( "widths", false );
218  set( "EF_N90Hits", false );
219  set( "EF_EMF", false );
220  if( use_dqm_09 ) {
221  set( "TIGHT_fls", false );
222  set( "TIGHT_foot", false );
223  }
224  } // not using tight 09 fwd ID
225 
227  }
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
bool JetIDSelectionFunctor::operator() ( const pat::Jet jet,
pat::strbitset ret 
)
inlineoverride

Definition at line 243 of file JetIDSelectionFunctor.h.

References pat::Jet::correctedP4(), count_hits(), CRAFT08, craft08Cuts(), pat::Jet::currentJECLevel(), DQM09, pat::Jet::emEnergyFraction(), reco::Jet::etaetaMoment(), fwd09Cuts(), pat::Jet::getCaloConstituents(), pat::Jet::isCaloJet(), pat::Jet::isJPTJet(), pat::Jet::jetID(), Utilities::operator, reco::LeafCandidate::p4(), reco::Jet::phiphiMoment(), PURE09, and version_.

Referenced by operator()().

244  {
245  if ( ! jet.isCaloJet() && !jet.isJPTJet() ) {
246  edm::LogWarning( "NYI" )<<"Criteria for pat::Jet-s other than CaloJets and JPTJets are not yet implemented";
247  return false;
248  }
249  if ( version_ == CRAFT08 ) return craft08Cuts( jet.p4(), jet.emEnergyFraction(), jet.jetID(), ret );
250  if ( version_ == PURE09 || version_ == DQM09 ) {
251  unsigned int nHit = count_hits( jet.getCaloConstituents() );
252  if ( jet.currentJECLevel() == "Uncorrected" ) {
253  return fwd09Cuts( jet.p4(), jet.emEnergyFraction(), jet.etaetaMoment(), jet.phiphiMoment(), nHit,
254  jet.jetID(), ret );
255  }
256  else {
257  return fwd09Cuts( jet.correctedP4("Uncorrected"), jet.emEnergyFraction(), jet.etaetaMoment(), jet.phiphiMoment(), nHit,
258  jet.jetID(), ret );
259  }
260  }
261  edm::LogWarning( "BadInput | NYI" )<<"Requested version ("<<version_<<") is unknown";
262  return false;
263  }
const LorentzVector correctedP4(const std::string &level, const std::string &flavor="none", const std::string &set="") const
Definition: Jet.h:158
unsigned int count_hits(const std::vector< CaloTowerPtr > &towers)
float etaetaMoment() const
eta-eta second moment, ET weighted
bool craft08Cuts(reco::Candidate::LorentzVector const &correctedP4, double emEnergyFraction, reco::JetID const &jetID, pat::strbitset &ret)
bool isCaloJet() const
check to see if the jet is a reco::CaloJet
Definition: Jet.h:251
std::vector< CaloTowerPtr > const & getCaloConstituents() const
const LorentzVector & p4() const final
four-momentum Lorentz vector
Definition: LeafCandidate.h:99
bool fwd09Cuts(reco::Candidate::LorentzVector const &rawP4, double emEnergyFraction, double etaWidth, double phiWidth, unsigned int nHit, reco::JetID const &jetID, pat::strbitset &ret)
float emEnergyFraction() const
returns the jet electromagnetic energy fraction
Definition: Jet.h:300
bool isJPTJet() const
check to see if the jet is a reco::JPTJet
Definition: Jet.h:253
reco::JetID const & jetID() const
accessing Jet ID information
Definition: Jet.h:462
std::string currentJECLevel() const
return the name of the current step of jet energy corrections
Definition: Jet.h:141
float phiphiMoment() const
phi-phi second moment, ET weighted
bool JetIDSelectionFunctor::operator() ( reco::Candidate::LorentzVector const &  correctedP4,
double  emEnergyFraction,
reco::JetID const &  jetID,
pat::strbitset ret 
)
inline

Definition at line 272 of file JetIDSelectionFunctor.h.

References CRAFT08, craft08Cuts(), and version_.

276  {
277  if ( version_ == CRAFT08 ) return craft08Cuts( correctedP4, emEnergyFraction, jetID, ret );
278  edm::LogWarning( "BadInput | NYI" )<<"Requested version ("<<version_
279  <<") is unknown or doesn't match the depreceated interface used";
280  return false;
281  }
bool craft08Cuts(reco::Candidate::LorentzVector const &correctedP4, double emEnergyFraction, reco::JetID const &jetID, pat::strbitset &ret)
reco::Candidate::LorentzVector correctedP4(const T &rawMEt, const CorrMETData &correction)
virtual bool JetIDSelectionFunctor::operator() ( reco::Candidate::LorentzVector const &  correctedP4,
double  emEnergyFraction,
reco::JetID const &  jetID 
)
inlinevirtual

accessor like previous, without the ret

Definition at line 283 of file JetIDSelectionFunctor.h.

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

286  {
287  retInternal_.set(false);
288  operator()(correctedP4,emEnergyFraction, jetID, retInternal_);
290  return (bool)retInternal_;
291  }
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
reco::Candidate::LorentzVector correctedP4(const T &rawMEt, const CorrMETData &correction)
bool operator()(const pat::Jet &jet, pat::strbitset &ret) override
strbitset & set(bool val=true)
set method of all bits
Definition: strbitset.h:144
bool JetIDSelectionFunctor::operator() ( reco::CaloJet const &  jet,
reco::JetID const &  jetID,
pat::strbitset ret 
)
inline

Definition at line 297 of file JetIDSelectionFunctor.h.

References count_hits(), CRAFT08, craft08Cuts(), DQM09, reco::CaloJet::emEnergyFraction(), reco::Jet::etaetaMoment(), fwd09Cuts(), reco::CaloJet::getCaloConstituents(), reco::LeafCandidate::p4(), reco::Jet::phiphiMoment(), PURE09, and version_.

300  {
301  if ( version_ == CRAFT08 ) return craft08Cuts( jet.p4(), jet.emEnergyFraction(), jetID, ret );
302  if ( version_ == PURE09 || version_ == DQM09 ) {
303  unsigned int nHit = count_hits( jet.getCaloConstituents() );
304  return fwd09Cuts( jet.p4(), jet.emEnergyFraction(), jet.etaetaMoment(), jet.phiphiMoment(), nHit,
305  jetID, ret );
306  }
307  edm::LogWarning( "BadInput | NYI" )<<"Requested version ("<<version_<<") is unknown";
308  return false;
309  }
unsigned int count_hits(const std::vector< CaloTowerPtr > &towers)
bool craft08Cuts(reco::Candidate::LorentzVector const &correctedP4, double emEnergyFraction, reco::JetID const &jetID, pat::strbitset &ret)
bool fwd09Cuts(reco::Candidate::LorentzVector const &rawP4, double emEnergyFraction, double etaWidth, double phiWidth, unsigned int nHit, reco::JetID const &jetID, pat::strbitset &ret)
virtual bool JetIDSelectionFunctor::operator() ( reco::CaloJet const &  jet,
reco::JetID const &  jetID 
)
inlinevirtual

accessor like previous, without the ret

Definition at line 312 of file JetIDSelectionFunctor.h.

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

314  {
315  retInternal_.set(false);
316  operator()(jet, jetID, retInternal_);
318  return (bool)retInternal_;
319  }
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 JetIDSelectionFunctor::index_EF_EMF_
private

Definition at line 545 of file JetIDSelectionFunctor.h.

Referenced by fwd09Cuts(), and initialize().

index_type JetIDSelectionFunctor::index_EF_N90Hits_
private

Definition at line 544 of file JetIDSelectionFunctor.h.

Referenced by fwd09Cuts(), and initialize().

index_type JetIDSelectionFunctor::index_LOOSE_als_
private

Definition at line 535 of file JetIDSelectionFunctor.h.

Referenced by fwd09Cuts(), and initialize().

index_type JetIDSelectionFunctor::index_LOOSE_AOD_EMF_
private

Definition at line 525 of file JetIDSelectionFunctor.h.

Referenced by craft08Cuts(), and initialize().

index_type JetIDSelectionFunctor::index_LOOSE_AOD_fHPD_
private

Definition at line 523 of file JetIDSelectionFunctor.h.

Referenced by craft08Cuts(), fwd09Cuts(), and initialize().

index_type JetIDSelectionFunctor::index_LOOSE_AOD_N90Hits_
private

Definition at line 524 of file JetIDSelectionFunctor.h.

Referenced by craft08Cuts(), fwd09Cuts(), and initialize().

index_type JetIDSelectionFunctor::index_LOOSE_EMF_
private

Definition at line 529 of file JetIDSelectionFunctor.h.

Referenced by craft08Cuts(), and initialize().

index_type JetIDSelectionFunctor::index_LOOSE_fHPD_
private

Definition at line 527 of file JetIDSelectionFunctor.h.

Referenced by craft08Cuts(), fwd09Cuts(), and initialize().

index_type JetIDSelectionFunctor::index_LOOSE_fls_
private

Definition at line 536 of file JetIDSelectionFunctor.h.

Referenced by fwd09Cuts(), and initialize().

index_type JetIDSelectionFunctor::index_LOOSE_foot_
private

Definition at line 537 of file JetIDSelectionFunctor.h.

Referenced by fwd09Cuts(), and initialize().

index_type JetIDSelectionFunctor::index_LOOSE_N90Hits_
private

Definition at line 528 of file JetIDSelectionFunctor.h.

Referenced by craft08Cuts(), fwd09Cuts(), and initialize().

index_type JetIDSelectionFunctor::index_LOOSE_nHit_
private

Definition at line 534 of file JetIDSelectionFunctor.h.

Referenced by fwd09Cuts(), and initialize().

index_type JetIDSelectionFunctor::index_MINIMAL_EMF_
private

Definition at line 521 of file JetIDSelectionFunctor.h.

Referenced by craft08Cuts(), fwd09Cuts(), and initialize().

index_type JetIDSelectionFunctor::index_TIGHT_als_
private

Definition at line 540 of file JetIDSelectionFunctor.h.

Referenced by fwd09Cuts(), and initialize().

index_type JetIDSelectionFunctor::index_TIGHT_EMF_
private

Definition at line 532 of file JetIDSelectionFunctor.h.

Referenced by craft08Cuts(), fwd09Cuts(), and initialize().

index_type JetIDSelectionFunctor::index_TIGHT_fHPD_
private

Definition at line 531 of file JetIDSelectionFunctor.h.

Referenced by craft08Cuts(), fwd09Cuts(), and initialize().

index_type JetIDSelectionFunctor::index_TIGHT_fls_
private

Definition at line 541 of file JetIDSelectionFunctor.h.

Referenced by fwd09Cuts(), and initialize().

index_type JetIDSelectionFunctor::index_TIGHT_foot_
private

Definition at line 542 of file JetIDSelectionFunctor.h.

Referenced by fwd09Cuts(), and initialize().

index_type JetIDSelectionFunctor::index_TIGHT_nHit_
private

Definition at line 539 of file JetIDSelectionFunctor.h.

Referenced by fwd09Cuts(), and initialize().

index_type JetIDSelectionFunctor::index_widths_
private

Definition at line 543 of file JetIDSelectionFunctor.h.

Referenced by fwd09Cuts(), and initialize().

Quality_t JetIDSelectionFunctor::quality_
private

Definition at line 519 of file JetIDSelectionFunctor.h.

Referenced by craft08Cuts(), and initialize().

Version_t JetIDSelectionFunctor::version_
private

Definition at line 518 of file JetIDSelectionFunctor.h.

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