CMS 3D CMS Logo

ElectronIdentifier.cc
Go to the documentation of this file.
8 
13 
14 #include <TLorentzVector.h>
15 #include <TMath.h>
16 #include <algorithm>
17 
19  : _effectiveAreas((c.getParameter<edm::FileInPath>("effAreasConfigFile")).fullPath())
20 
21 {
22  rho_ = -1;
23  ID_ = -1;
28 
33 
38 
43 
48 
53 
58 
63 
68 
73 
78 
83 
88 
93 
98 
103 }
104 
106  if (rho >= 0) {
107  rho_ = rho;
108  } else {
109  throw cms::Exception("ValueError") << "Encountered invalid value for energy density rho.\n"
110  << "Value: " << rho << "\n"
111  << "Rho should be a real, positive number.\n";
112  }
113 }
115  if (ID == "TIGHT")
117  else if (ID == "MEDIUM")
119  else if (ID == "LOOSE")
121  else if (ID == "VETO")
123  else
124  throw;
125 }
127  return ele->superCluster().isNonnull() && ele->superCluster()->seed().isNonnull()
128  ? ele->deltaEtaSuperClusterTrackAtVtx() - ele->superCluster()->eta() + ele->superCluster()->seed()->eta()
130 }
132  if (rho_ < 0) {
133  throw;
134  }
136  const float chad = pfIso.sumChargedHadronPt;
137  const float nhad = pfIso.sumNeutralHadronEt;
138  const float pho = pfIso.sumPhotonEt;
139  const float eA = _effectiveAreas.getEffectiveArea(fabs(ele->superCluster()->eta()));
140  const float iso = chad + std::max(0.0, nhad + pho - rho_ * eA);
141 
142  // Apply the cut and return the result
143  // Scale by pT if the relative isolation is requested but avoid division by 0
144  return iso;
145 }
146 
150  if (ID_ == -1)
151  throw;
152  unsigned int region = fabs(ele->superCluster()->eta()) < 1.479 ? EleIDEtaBins::BARREL : EleIDEtaBins::BARREL;
153 
155  return false;
157  return false;
159  return false;
161  return false;
162  if (isolation(ele) / ele->pt() > cuts_[EleIDCutNames::ISO][ID_][region])
163  return false;
165  return false;
166  if ((ele->gsfTrack()->hitPattern().numberOfAllHits(reco::HitPattern::MISSING_INNER_HITS)) >
168  return false;
170  return false;
171 
172  return true;
173 }
float dEtaInSeed(const reco::GsfElectronPtr &ele)
double pt() const final
transverse momentum
uint32_t ID
Definition: Definitions.h:24
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:232
float eSuperClusterOverP() const
Definition: GsfElectron.h:221
EffectiveAreas _effectiveAreas
GsfTrackRef gsfTrack() const override
reference to a GsfTrack
Definition: GsfElectron.h:156
const PflowIsolationVariables & pfIsolationVariables() const
Definition: GsfElectron.h:729
static bool hasMatchedConversion(const reco::GsfElectron &ele, const reco::ConversionCollection &convCol, const math::XYZPoint &beamspot, bool allowCkfMatch=true, float lxyMin=2.0, float probMin=1e-6, unsigned int nHitsBeforeVtxMax=0)
float sumPhotonEt
sum pt of PF photons // old float photonIso ;
Definition: GsfElectron.h:665
bool passID(const reco::GsfElectronPtr &ele, edm::Handle< reco::BeamSpot > beamspot, edm::Handle< reco::ConversionCollection > conversions)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
float sumNeutralHadronEt
sum pt of neutral hadrons // old float neutralHadronIso ;
Definition: GsfElectron.h:664
ElectronIdentifier(const edm::ParameterSet &c)
const float getEffectiveArea(float eta) const
float deltaPhiSuperClusterTrackAtVtx() const
Definition: GsfElectron.h:228
float deltaEtaSuperClusterTrackAtVtx() const
Definition: GsfElectron.h:225
void setRho(double rho)
float ecalEnergy() const
Definition: GsfElectron.h:896
HLT enums.
void setID(std::string ID)
float isolation(const reco::GsfElectronPtr &ele)
float full5x5_sigmaIetaIeta() const
Definition: GsfElectron.h:471
float sumChargedHadronPt
sum-pt of charged Hadron // old float chargedHadronIso ;
Definition: GsfElectron.h:663
float hadronicOverEm() const
Definition: GsfElectron.h:500
SuperClusterRef superCluster() const override
reference to a SuperCluster
Definition: GsfElectron.h:155
std::array< std::array< std::array< double, 2 >, 4 >, 8 > cuts_