CMS 3D CMS Logo

ElectronVPlusJetsIDSelectionFunctor.h
Go to the documentation of this file.
1 #ifndef PhysicsTools_PatUtils_interface_ElectronVPlusJetsIDSelectionFunctor_h
2 #define PhysicsTools_PatUtils_interface_ElectronVPlusJetsIDSelectionFunctor_h
3 
4 #ifndef __GCCXML__
6 #endif
9 
12 
13 class ElectronVPlusJetsIDSelectionFunctor : public Selector<pat::Electron> {
14 public: // interface
16 
18 
19 #ifndef __GCCXML__
22 #endif
23 
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  }
44 
46  Version_t version, double d0 = 0.2, double ed0 = 999.0, double sd0 = 999.0, double reliso = 0.1) {
47  initialize(version, d0, ed0, sd0, reliso);
48  }
49 
50  void initialize(Version_t version, double d0, double ed0, double sd0, double reliso) {
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  }
69 
70  // Allow for multiple definitions of the cuts.
72  if (version_ == FIRSTDATA)
73  return firstDataCuts(electron, ret);
74  else {
75  return false;
76  }
77  }
78 
80 
81  // cuts based on craft 08 analysis.
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  }
107 
108 private: // member variables
110 
115 };
116 
117 #endif
runTheMatrix.ret
ret
prodAgent to be discontinued
Definition: runTheMatrix.py:373
BeamSpotPI::parameters
parameters
Definition: BeamSpotPayloadInspectorHelper.h:29
Selector< pat::Electron >::setIgnored
void setIgnored(pat::strbitset &ret)
set ignored bits
Definition: Selector.h:181
Selector
Functor that operates on <T>
Definition: Selector.h:22
Selector< pat::Electron >::bits_
pat::strbitset bits_
the bitset indexed by strings
Definition: Selector.h:241
MessageLogger.h
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
ElectronVPlusJetsIDSelectionFunctor::Version_t
Version_t
Definition: ElectronVPlusJetsIDSelectionFunctor.h:15
ZMuMuCategoriesSequences_cff.trkIso
trkIso
Definition: ZMuMuCategoriesSequences_cff.py:140
ElectronVPlusJetsIDSelectionFunctor::ElectronVPlusJetsIDSelectionFunctor
ElectronVPlusJetsIDSelectionFunctor(Version_t version, double d0=0.2, double ed0=999.0, double sd0=999.0, double reliso=0.1)
Definition: ElectronVPlusJetsIDSelectionFunctor.h:45
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
pat::strbitset::index_type
Definition: strbitset.h:25
ElectronVPlusJetsIDSelectionFunctor
Definition: ElectronVPlusJetsIDSelectionFunctor.h:13
Utilities.operator
operator
Definition: Utilities.py:24
ElectronVPlusJetsIDSelectionFunctor::ElectronVPlusJetsIDSelectionFunctor
ElectronVPlusJetsIDSelectionFunctor()
Definition: ElectronVPlusJetsIDSelectionFunctor.h:17
ElectronVPlusJetsIDSelectionFunctor::operator()
bool operator()(const pat::Electron &electron, pat::strbitset &ret) override
This provides the interface for base classes to select objects.
Definition: ElectronVPlusJetsIDSelectionFunctor.h:71
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::ElectronVPlusJetsIDSelectionFunctor
ElectronVPlusJetsIDSelectionFunctor(edm::ParameterSet const &parameters)
Definition: ElectronVPlusJetsIDSelectionFunctor.h:24
ElectronVPlusJetsIDSelectionFunctor::indexSD0_
index_type indexSD0_
Definition: ElectronVPlusJetsIDSelectionFunctor.h:113
metsig::electron
Definition: SignAlgoResolutions.h:48
ElectronVPlusJetsIDSelectionFunctor::N_VERSIONS
Definition: ElectronVPlusJetsIDSelectionFunctor.h:15
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
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
edm::ParameterSet
Definition: ParameterSet.h:47
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
ElectronVPlusJetsIDSelectionFunctor::ElectronVPlusJetsIDSelectionFunctor
ElectronVPlusJetsIDSelectionFunctor(edm::ParameterSet const &parameters, edm::ConsumesCollector &iC)
Definition: ElectronVPlusJetsIDSelectionFunctor.h:20
pat::strbitset
Definition: strbitset.h:23
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:246
Electron.h
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
ConsumesCollector.h
pat::Electron
Analysis-level electron class.
Definition: Electron.h:51
Selector.h
ParameterSet.h
ElectronVPlusJetsIDSelectionFunctor::indexED0_
index_type indexED0_
Definition: ElectronVPlusJetsIDSelectionFunctor.h:112
d0
static constexpr float d0
Definition: L1EGammaCrystalsEmulatorProducer.cc:84
BeamSplash_cfg.version
version
Definition: BeamSplash_cfg.py:45
ElectronVPlusJetsIDSelectionFunctor::firstDataCuts
bool firstDataCuts(const pat::Electron &electron, pat::strbitset &ret)
Definition: ElectronVPlusJetsIDSelectionFunctor.h:82
edm::ConsumesCollector
Definition: ConsumesCollector.h:45
ElectronVPlusJetsIDSelectionFunctor::initialize
void initialize(Version_t version, double d0, double ed0, double sd0, double reliso)
Definition: ElectronVPlusJetsIDSelectionFunctor.h:50