CMS 3D CMS Logo

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

#include <ElectronIdentifier.h>

Public Member Functions

float dEtaInSeed (const reco::GsfElectronPtr &ele)
 
 ElectronIdentifier (const edm::ParameterSet &c)
 
float isolation (const reco::GsfElectronPtr &ele)
 
bool passID (const reco::GsfElectronPtr &ele, edm::Handle< reco::BeamSpot > beamspot, edm::Handle< reco::ConversionCollection > conversions)
 
void setID (std::string ID)
 
void setRho (double rho)
 

Private Attributes

EffectiveAreas _effectiveAreas
 
std::array< std::array< std::array< double, 2 >, 4 >, 8 > cuts_
 
int ID_
 
double rho_
 

Detailed Description

Definition at line 39 of file ElectronIdentifier.h.

Constructor & Destructor Documentation

◆ ElectronIdentifier()

ElectronIdentifier::ElectronIdentifier ( const edm::ParameterSet c)

Definition at line 18 of file ElectronIdentifier.cc.

References BARREL, CONVERSION, cuts_, DETAINSEED, DPHIIN, ENDCAP, HOVERE, ID_, ISO, LOOSE, MEDIUM, MISSINGHITS, ONEOVERE, rho_, SIGMAIETA, TIGHT, and VETO.

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 }
EffectiveAreas _effectiveAreas
std::array< std::array< std::array< double, 2 >, 4 >, 8 > cuts_

Member Function Documentation

◆ dEtaInSeed()

float ElectronIdentifier::dEtaInSeed ( const reco::GsfElectronPtr ele)

Definition at line 126 of file ElectronIdentifier.cc.

References reco::GsfElectron::deltaEtaSuperClusterTrackAtVtx(), edm::Ref< C, T, F >::isNonnull(), SiStripPI::max, and reco::GsfElectron::superCluster().

Referenced by passID().

126  {
127  return ele->superCluster().isNonnull() && ele->superCluster()->seed().isNonnull()
128  ? ele->deltaEtaSuperClusterTrackAtVtx() - ele->superCluster()->eta() + ele->superCluster()->seed()->eta()
130 }
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
float deltaEtaSuperClusterTrackAtVtx() const
Definition: GsfElectron.h:225
SuperClusterRef superCluster() const override
reference to a SuperCluster
Definition: GsfElectron.h:155

◆ isolation()

float ElectronIdentifier::isolation ( const reco::GsfElectronPtr ele)

Definition at line 131 of file ElectronIdentifier.cc.

References _effectiveAreas, EffectiveAreas::getEffectiveArea(), SiStripPI::max, reco::GsfElectron::pfIsolationVariables(), rho_, reco::GsfElectron::PflowIsolationVariables::sumChargedHadronPt, reco::GsfElectron::PflowIsolationVariables::sumNeutralHadronEt, reco::GsfElectron::PflowIsolationVariables::sumPhotonEt, and reco::GsfElectron::superCluster().

Referenced by passID().

131  {
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 }
EffectiveAreas _effectiveAreas
const PflowIsolationVariables & pfIsolationVariables() const
Definition: GsfElectron.h:729
float sumPhotonEt
sum pt of PF photons // old float photonIso ;
Definition: GsfElectron.h:665
float sumNeutralHadronEt
sum pt of neutral hadrons // old float neutralHadronIso ;
Definition: GsfElectron.h:664
const float getEffectiveArea(float eta) const
float sumChargedHadronPt
sum-pt of charged Hadron // old float chargedHadronIso ;
Definition: GsfElectron.h:663
SuperClusterRef superCluster() const override
reference to a SuperCluster
Definition: GsfElectron.h:155

◆ passID()

bool ElectronIdentifier::passID ( const reco::GsfElectronPtr ele,
edm::Handle< reco::BeamSpot beamspot,
edm::Handle< reco::ConversionCollection conversions 
)

Definition at line 147 of file ElectronIdentifier.cc.

References funct::abs(), BARREL, pwdgSkimBPark_cfi::conversions, cuts_, reco::GsfElectron::deltaPhiSuperClusterTrackAtVtx(), DETAINSEED, dEtaInSeed(), DPHIIN, reco::GsfElectron::ecalEnergy(), reco::GsfElectron::eSuperClusterOverP(), reco::GsfElectron::full5x5_sigmaIetaIeta(), reco::GsfElectron::gsfTrack(), reco::GsfElectron::hadronicOverEm(), ConversionTools::hasMatchedConversion(), HOVERE, ID_, ISO, isolation(), reco::HitPattern::MISSING_INNER_HITS, MISSINGHITS, ONEOVERE, reco::LeafCandidate::pt(), HLT_2022v15_cff::region, SIGMAIETA, and reco::GsfElectron::superCluster().

Referenced by ZCountingElectrons::analyze().

149  {
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
float eSuperClusterOverP() const
Definition: GsfElectron.h:221
GsfTrackRef gsfTrack() const override
reference to a GsfTrack
Definition: GsfElectron.h:156
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)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
float deltaPhiSuperClusterTrackAtVtx() const
Definition: GsfElectron.h:228
float ecalEnergy() const
Definition: GsfElectron.h:896
float isolation(const reco::GsfElectronPtr &ele)
float full5x5_sigmaIetaIeta() const
Definition: GsfElectron.h:471
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_

◆ setID()

void ElectronIdentifier::setID ( std::string  ID)

Definition at line 114 of file ElectronIdentifier.cc.

References ID_, LOOSE, MEDIUM, TIGHT, and VETO.

Referenced by ZCountingElectrons::ZCountingElectrons().

114  {
115  if (ID == "TIGHT")
117  else if (ID == "MEDIUM")
119  else if (ID == "LOOSE")
121  else if (ID == "VETO")
123  else
124  throw;
125 }
uint32_t ID
Definition: Definitions.h:24

◆ setRho()

void ElectronIdentifier::setRho ( double  rho)

Definition at line 105 of file ElectronIdentifier.cc.

References Exception, rho, and rho_.

Referenced by ZCountingElectrons::analyze().

105  {
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 }

Member Data Documentation

◆ _effectiveAreas

EffectiveAreas ElectronIdentifier::_effectiveAreas
private

Definition at line 56 of file ElectronIdentifier.h.

Referenced by isolation().

◆ cuts_

std::array<std::array<std::array<double, 2>, 4>, 8> ElectronIdentifier::cuts_
private

Definition at line 54 of file ElectronIdentifier.h.

Referenced by ElectronIdentifier(), and passID().

◆ ID_

int ElectronIdentifier::ID_
private

Definition at line 53 of file ElectronIdentifier.h.

Referenced by ElectronIdentifier(), passID(), and setID().

◆ rho_

double ElectronIdentifier::rho_
private

Definition at line 52 of file ElectronIdentifier.h.

Referenced by ElectronIdentifier(), isolation(), and setRho().