CMS 3D CMS Logo

ElectronIdentifier.cc
Go to the documentation of this file.
11 
16 
19 
20 #include <TLorentzVector.h>
21 #include <TMath.h>
22 #include <algorithm>
23 
25  : _effectiveAreas((c.getParameter<edm::FileInPath>("effAreasConfigFile")).fullPath())
26 
27 {
28  rho_ = -1;
29  ID_ = -1;
34 
39 
44 
49 
54 
59 
64 
69 
74 
79 
84 
89 
94 
99 
104 
109 }
110 
112  if (rho >= 0) {
113  rho_ = rho;
114  } else {
115  throw cms::Exception("ValueError") << "Encountered invalid value for energy density rho.\n"
116  << "Value: " << rho << "\n"
117  << "Rho should be a real, positive number.\n";
118  }
119 }
121  if (ID == "TIGHT")
123  else if (ID == "MEDIUM")
125  else if (ID == "LOOSE")
127  else if (ID == "VETO")
129  else
130  throw;
131 }
133  return ele->superCluster().isNonnull() && ele->superCluster()->seed().isNonnull()
134  ? ele->deltaEtaSuperClusterTrackAtVtx() - ele->superCluster()->eta() + ele->superCluster()->seed()->eta()
136 }
138  if (rho_ < 0) {
139  throw;
140  }
142  const float chad = pfIso.sumChargedHadronPt;
143  const float nhad = pfIso.sumNeutralHadronEt;
144  const float pho = pfIso.sumPhotonEt;
145  const float eA = _effectiveAreas.getEffectiveArea(fabs(ele->superCluster()->eta()));
146  const float iso = chad + std::max(0.0, nhad + pho - rho_ * eA);
147 
148  // Apply the cut and return the result
149  // Scale by pT if the relative isolation is requested but avoid division by 0
150  return iso;
151 }
152 
156  if (ID_ == -1)
157  throw;
158  unsigned int region = fabs(ele->superCluster()->eta()) < 1.479 ? EleIDEtaBins::BARREL : EleIDEtaBins::BARREL;
159 
161  return false;
163  return false;
165  return false;
167  return false;
168  if (isolation(ele) / ele->pt() > cuts_[EleIDCutNames::ISO][ID_][region])
169  return false;
171  return false;
172  if ((ele->gsfTrack()->hitPattern().numberOfAllHits(reco::HitPattern::MISSING_INNER_HITS)) >
174  return false;
176  return false;
177 
178  return true;
179 }
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:238
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_