CMS 3D CMS Logo

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

#include <ElectronVPlusJetsIDSelectionFunctor.h>

Inheritance diagram for ElectronVPlusJetsIDSelectionFunctor:
Selector< pat::Electron >

Public Types

enum  Version_t { SUMMER08, FIRSTDATA, N_VERSIONS }
 
- Public Types inherited from Selector< pat::Electron >
typedef std::pair< index_type, size_t > cut_flow_item
 
typedef std::vector< cut_flow_itemcut_flow_map
 
typedef pat::Electron 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

 ElectronVPlusJetsIDSelectionFunctor ()
 
 ElectronVPlusJetsIDSelectionFunctor (edm::ParameterSet const &parameters)
 
 ElectronVPlusJetsIDSelectionFunctor (edm::ParameterSet const &parameters, edm::ConsumesCollector &iC)
 
 ElectronVPlusJetsIDSelectionFunctor (Version_t version, double d0=0.2, double ed0=999.0, double sd0=999.0, double reliso=0.1)
 
bool firstDataCuts (const pat::Electron &electron, pat::strbitset &ret)
 
void initialize (Version_t version, double d0, double ed0, double sd0, double reliso)
 
bool operator() (const pat::Electron &electron, pat::strbitset &ret) override
 This provides the interface for base classes to select objects. More...
 
- Public Member Functions inherited from Selector< pat::Electron >
void clear (index_type const &i)
 
void clear (std::string const &s)
 Turn off a given selection cut. More...
 
bool considerCut (index_type const &i) const
 
bool considerCut (std::string const &s) const
 consider the cut at index "s" More...
 
double cut (index_type const &i, double val) const
 Access the double cut values at index "s". More...
 
int cut (index_type const &i, 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...
 
int cut (std::string s, int val) const
 Access the int cut values at index "s". More...
 
pat::strbitset getBitTemplate () const
 Get an empty bitset with the proper names. More...
 
double getPasses (index_type const &i) const
 
double getPasses (std::string const &s) const
 Return the number of passing cases. More...
 
bool ignoreCut (index_type const &i) const
 
bool ignoreCut (std::string const &s) const
 ignore the cut at index "s" More...
 
virtual bool operator() (pat::Electron const &t)
 This provides an alternative signature without the second ret. More...
 
virtual bool operator() (pat::Electron const &t, edm::EventBase const &e)
 This provides an alternative signature that includes extra information. More...
 
virtual bool operator() (pat::Electron const &t, edm::EventBase const &e, pat::strbitset &ret)
 This provides an alternative signature that includes extra information. More...
 
bool operator[] (index_type const &i) const
 
bool operator[] (std::string const &s) const
 
void passCut (pat::strbitset &ret, index_type const &i)
 
void passCut (pat::strbitset &ret, std::string const &s)
 Passing cuts. More...
 
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, double cut)
 This is the registration of an individual cut string, with a double cut value. 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...
 
 Selector ()
 Constructor clears the bits. More...
 
void set (index_type const &i, bool val=true)
 
void set (index_type const &i, double cut, bool val=true)
 
void set (index_type const &i, int cut, bool val=true)
 
void set (std::string const &s, bool val=true)
 Set a given selection cut, on or off. More...
 
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 (std::string const &s, int cut, bool val=true)
 Set a given selection cut, on or off, and reset int cut value. More...
 
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 indexD0_
 
index_type indexED0_
 
index_type indexRelIso_
 
index_type indexSD0_
 
Version_t version_
 

Additional Inherited Members

- Protected Attributes inherited from Selector< pat::Electron >
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

Definition at line 13 of file ElectronVPlusJetsIDSelectionFunctor.h.

Member Enumeration Documentation

◆ Version_t

Enumerator
SUMMER08 
FIRSTDATA 
N_VERSIONS 

Definition at line 15 of file ElectronVPlusJetsIDSelectionFunctor.h.

Constructor & Destructor Documentation

◆ ElectronVPlusJetsIDSelectionFunctor() [1/4]

ElectronVPlusJetsIDSelectionFunctor::ElectronVPlusJetsIDSelectionFunctor ( )
inline

Definition at line 17 of file ElectronVPlusJetsIDSelectionFunctor.h.

17 {}

◆ ElectronVPlusJetsIDSelectionFunctor() [2/4]

ElectronVPlusJetsIDSelectionFunctor::ElectronVPlusJetsIDSelectionFunctor ( edm::ParameterSet const &  parameters,
edm::ConsumesCollector iC 
)
inline

◆ ElectronVPlusJetsIDSelectionFunctor() [3/4]

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

Definition at line 24 of file ElectronVPlusJetsIDSelectionFunctor.h.

24  {
25  std::string versionStr = parameters.getParameter<std::string>("version");
26  if (versionStr != "FIRSTDATA") {
27  std::cout << "The version " << versionStr << " is deprecated. Setting to FIRSTDATA" << std::endl;
28  }
29 
30  if (versionStr == "FIRSTDATA") {
32  parameters.getParameter<double>("D0"),
33  parameters.getParameter<double>("ED0"),
34  parameters.getParameter<double>("SD0"),
35  parameters.getParameter<double>("RelIso"));
36  if (parameters.exists("cutsToIgnore"))
37  setIgnoredCuts(parameters.getParameter<std::vector<std::string> >("cutsToIgnore"));
38  } else {
39  throw cms::Exception("InvalidInput") << "Expect version to be one of SUMMER08, FIRSTDATA," << std::endl;
40  }
41 
43  }

References gather_cfg::cout, Exception, FIRSTDATA, Selector< pat::Electron >::getBitTemplate(), initialize(), Selector< pat::Electron >::retInternal_, Selector< pat::Electron >::setIgnoredCuts(), and AlCaHLTBitMon_QueryRunRegistry::string.

◆ ElectronVPlusJetsIDSelectionFunctor() [4/4]

ElectronVPlusJetsIDSelectionFunctor::ElectronVPlusJetsIDSelectionFunctor ( Version_t  version,
double  d0 = 0.2,
double  ed0 = 999.0,
double  sd0 = 999.0,
double  reliso = 0.1 
)
inline

Definition at line 45 of file ElectronVPlusJetsIDSelectionFunctor.h.

46  {
47  initialize(version, d0, ed0, sd0, reliso);
48  }

References d0, initialize(), and BeamSplash_cfg::version.

Member Function Documentation

◆ firstDataCuts()

bool ElectronVPlusJetsIDSelectionFunctor::firstDataCuts ( const pat::Electron electron,
pat::strbitset ret 
)
inline

Definition at line 82 of file ElectronVPlusJetsIDSelectionFunctor.h.

82  {
83  ret.set(false);
84  double corr_d0 = electron.dB();
85  double corr_ed0 = electron.edB();
86  double corr_sd0 = (corr_ed0 > 0.000000001) ? corr_d0 / corr_ed0 : 999.0;
87 
88  double hcalIso = electron.dr03HcalTowerSumEt();
89  double ecalIso = electron.dr03EcalRecHitSumEt();
90  double trkIso = electron.dr03TkSumPt();
91  double et = electron.et();
92 
93  double relIso = (ecalIso + hcalIso + trkIso) / et;
94 
95  if (fabs(corr_d0) < cut(indexD0_, double()) || ignoreCut(indexD0_))
97  if (fabs(corr_ed0) < cut(indexED0_, double()) || ignoreCut(indexED0_))
99  if (fabs(corr_sd0) < cut(indexSD0_, double()) || ignoreCut(indexSD0_))
101  if (relIso < cut(indexRelIso_, double()) || ignoreCut(indexRelIso_))
103 
104  setIgnored(ret);
105  return (bool)ret;
106  }

References Selector< pat::Electron >::cut(), HPSPFTauProducerPuppi_cfi::electron, EgHLTOffHistBins_cfi::et, Selector< pat::Electron >::ignoreCut(), indexD0_, indexED0_, indexRelIso_, indexSD0_, Selector< pat::Electron >::passCut(), objects.autophobj::relIso, runTheMatrix::ret, and Selector< pat::Electron >::setIgnored().

Referenced by operator()().

◆ initialize()

void ElectronVPlusJetsIDSelectionFunctor::initialize ( Version_t  version,
double  d0,
double  ed0,
double  sd0,
double  reliso 
)
inline

Definition at line 50 of file ElectronVPlusJetsIDSelectionFunctor.h.

50  {
51  version_ = version;
52 
53  push_back("D0", d0);
54  push_back("ED0", ed0);
55  push_back("SD0", sd0);
56  push_back("RelIso", reliso);
57 
58  // all on by default
59  set("D0");
60  set("ED0");
61  set("SD0");
62  set("RelIso");
63 
64  indexD0_ = index_type(&bits_, "D0");
65  indexED0_ = index_type(&bits_, "ED0");
66  indexSD0_ = index_type(&bits_, "SD0");
67  indexRelIso_ = index_type(&bits_, "RelIso");
68  }

References Selector< pat::Electron >::bits_, d0, indexD0_, indexED0_, indexRelIso_, indexSD0_, Selector< pat::Electron >::push_back(), Selector< pat::Electron >::set(), BeamSplash_cfg::version, and version_.

Referenced by ElectronVPlusJetsIDSelectionFunctor().

◆ operator()()

bool ElectronVPlusJetsIDSelectionFunctor::operator() ( const pat::Electron t,
pat::strbitset ret 
)
inlineoverridevirtual

This provides the interface for base classes to select objects.

Implements Selector< pat::Electron >.

Definition at line 71 of file ElectronVPlusJetsIDSelectionFunctor.h.

71  {
72  if (version_ == FIRSTDATA)
73  return firstDataCuts(electron, ret);
74  else {
75  return false;
76  }
77  }

References HPSPFTauProducerPuppi_cfi::electron, FIRSTDATA, firstDataCuts(), runTheMatrix::ret, and version_.

Member Data Documentation

◆ indexD0_

index_type ElectronVPlusJetsIDSelectionFunctor::indexD0_
private

Definition at line 111 of file ElectronVPlusJetsIDSelectionFunctor.h.

Referenced by firstDataCuts(), and initialize().

◆ indexED0_

index_type ElectronVPlusJetsIDSelectionFunctor::indexED0_
private

Definition at line 112 of file ElectronVPlusJetsIDSelectionFunctor.h.

Referenced by firstDataCuts(), and initialize().

◆ indexRelIso_

index_type ElectronVPlusJetsIDSelectionFunctor::indexRelIso_
private

Definition at line 114 of file ElectronVPlusJetsIDSelectionFunctor.h.

Referenced by firstDataCuts(), and initialize().

◆ indexSD0_

index_type ElectronVPlusJetsIDSelectionFunctor::indexSD0_
private

Definition at line 113 of file ElectronVPlusJetsIDSelectionFunctor.h.

Referenced by firstDataCuts(), and initialize().

◆ version_

Version_t ElectronVPlusJetsIDSelectionFunctor::version_
private

Definition at line 109 of file ElectronVPlusJetsIDSelectionFunctor.h.

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

runTheMatrix.ret
ret
prodAgent to be discontinued
Definition: runTheMatrix.py:543
BeamSpotPI::parameters
parameters
Definition: BeamSpotPayloadInspectorHelper.h:30
Selector< pat::Electron >::setIgnored
void setIgnored(pat::strbitset &ret)
set ignored bits
Definition: Selector.h:181
Selector< pat::Electron >::bits_
pat::strbitset bits_
the bitset indexed by strings
Definition: Selector.h:241
ElectronVPlusJetsIDSelectionFunctor::indexD0_
index_type indexD0_
Definition: ElectronVPlusJetsIDSelectionFunctor.h:111
Selector< pat::Electron >::index_type
pat::strbitset::index_type index_type
Definition: Selector.h:25
ElectronVPlusJetsIDSelectionFunctor::FIRSTDATA
Definition: ElectronVPlusJetsIDSelectionFunctor.h:15
Selector< pat::Electron >::retInternal_
pat::strbitset retInternal_
internal ret if users don't care about return bits
Definition: Selector.h:242
Selector< pat::Electron >::ignoreCut
bool ignoreCut(std::string const &s) const
ignore the cut at index "s"
Definition: Selector.h:127
gather_cfg.cout
cout
Definition: gather_cfg.py:144
ElectronVPlusJetsIDSelectionFunctor::indexRelIso_
index_type indexRelIso_
Definition: ElectronVPlusJetsIDSelectionFunctor.h:114
ElectronVPlusJetsIDSelectionFunctor::ElectronVPlusJetsIDSelectionFunctor
ElectronVPlusJetsIDSelectionFunctor()
Definition: ElectronVPlusJetsIDSelectionFunctor.h:17
Selector< pat::Electron >::push_back
virtual void push_back(std::string const &s)
This is the registration of an individual cut string.
Definition: Selector.h:42
objects.autophobj.relIso
relIso
Definition: autophobj.py:169
ElectronVPlusJetsIDSelectionFunctor::indexSD0_
index_type indexSD0_
Definition: ElectronVPlusJetsIDSelectionFunctor.h:113
ElectronVPlusJetsIDSelectionFunctor::N_VERSIONS
Definition: ElectronVPlusJetsIDSelectionFunctor.h:15
Selector< pat::Electron >::getBitTemplate
pat::strbitset getBitTemplate() const
Get an empty bitset with the proper names.
Definition: Selector.h:168
ElectronVPlusJetsIDSelectionFunctor::SUMMER08
Definition: ElectronVPlusJetsIDSelectionFunctor.h:15
Selector< pat::Electron >::passCut
void passCut(pat::strbitset &ret, std::string const &s)
Passing cuts.
Definition: Selector.h:142
ElectronVPlusJetsIDSelectionFunctor::version_
Version_t version_
Definition: ElectronVPlusJetsIDSelectionFunctor.h:109
EgHLTOffHistBins_cfi.et
et
Definition: EgHLTOffHistBins_cfi.py:8
Selector< pat::Electron >::setIgnoredCuts
void setIgnoredCuts(std::vector< std::string > const &bitsToIgnore)
set the bits to ignore from a vector
Definition: Selector.h:131
HPSPFTauProducerPuppi_cfi.electron
electron
Definition: HPSPFTauProducerPuppi_cfi.py:13
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
Selector< pat::Electron >::cut
int cut(index_type const &i, int val) const
Access the int cut values at index "s".
Definition: Selector.h:158
Exception
Definition: hltDiff.cc:245
Selector< pat::Electron >::set
void set(std::string const &s, bool val=true)
Set a given selection cut, on or off.
Definition: Selector.h:93
ElectronVPlusJetsIDSelectionFunctor::indexED0_
index_type indexED0_
Definition: ElectronVPlusJetsIDSelectionFunctor.h:112
d0
static constexpr float d0
Definition: L1EGammaCrystalsEmulatorProducer.cc:85
BeamSplash_cfg.version
version
Definition: BeamSplash_cfg.py:45
ElectronVPlusJetsIDSelectionFunctor::firstDataCuts
bool firstDataCuts(const pat::Electron &electron, pat::strbitset &ret)
Definition: ElectronVPlusJetsIDSelectionFunctor.h:82
ElectronVPlusJetsIDSelectionFunctor::initialize
void initialize(Version_t version, double d0, double ed0, double sd0, double reliso)
Definition: ElectronVPlusJetsIDSelectionFunctor.h:50