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")
116  << "Encountered invalid value for energy density rho.\n"
117  << "Value: " << rho << "\n"
118  << "Rho should be a real, positive number.\n";
119  }
120 }
122  if(ID=="TIGHT") ID_ = EleIDWorkingPoints::TIGHT;
123  else if(ID=="MEDIUM") ID_ = EleIDWorkingPoints::MEDIUM;
124  else if(ID=="LOOSE") ID_ = EleIDWorkingPoints::LOOSE;
125  else if(ID=="VETO") ID_ = EleIDWorkingPoints::VETO;
126  else throw;
127 }
129  return ele->superCluster().isNonnull() && ele->superCluster()->seed().isNonnull() ?
130  ele->deltaEtaSuperClusterTrackAtVtx() - ele->superCluster()->eta() + ele->superCluster()->seed()->eta() : std::numeric_limits<float>::max();
131  }
133  if(rho_ < 0 ) {
134  throw;
135  }
137  const float chad = pfIso.sumChargedHadronPt;
138  const float nhad = pfIso.sumNeutralHadronEt;
139  const float pho = pfIso.sumPhotonEt;
140  const float eA = _effectiveAreas.getEffectiveArea( fabs(ele->superCluster()->eta()) );
141  const float iso = chad + std::max(0.0, nhad + pho - rho_*eA);
142 
143  // Apply the cut and return the result
144  // Scale by pT if the relative isolation is requested but avoid division by 0
145  return iso;
146 }
147 
148 
150  if(ID_ == -1) throw;
151  unsigned int region = fabs(ele->superCluster()->eta()) < 1.479 ? EleIDEtaBins::BARREL : EleIDEtaBins::BARREL;
152 
153  if( ele->full5x5_sigmaIetaIeta() > cuts_[EleIDCutNames::SIGMAIETA][ID_][region]) return false;
154  if( dEtaInSeed(ele) > cuts_[EleIDCutNames::DETAINSEED][ID_][region]) return false;
155  if( std::abs(ele->deltaPhiSuperClusterTrackAtVtx()) > cuts_[EleIDCutNames::DPHIIN][ID_][region]) return false;
156  if( ele->hadronicOverEm() > cuts_[EleIDCutNames::HOVERE][ID_][region]) return false;
157  if( isolation(ele)/ele->pt() > cuts_[EleIDCutNames::ISO][ID_][region]) return false;
158  if( std::abs(1.0 - ele->eSuperClusterOverP())/ele->ecalEnergy() > cuts_[EleIDCutNames::ONEOVERE][ID_][region]) return false;
159  if( (ele->gsfTrack()->hitPattern().numberOfAllHits(reco::HitPattern::MISSING_INNER_HITS)) > cuts_[EleIDCutNames::MISSINGHITS][ID_][region]) return false;
160  if( ConversionTools::hasMatchedConversion(*ele,*conversions,beamspot->position())) return false;
161 
162  return true;
163 }
164 
165 
166 
167 
const PflowIsolationVariables & pfIsolationVariables() const
Definition: GsfElectron.h:687
GsfTrackRef gsfTrack() const override
reference to a GsfTrack
Definition: GsfElectron.h:186
float dEtaInSeed(const reco::GsfElectronPtr &ele)
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:251
float eSuperClusterOverP() const
Definition: GsfElectron.h:249
uint32_t ID
Definition: Definitions.h:26
std::array< std::array< std::array< double, 2 >, 4 >, 8 > cuts_
double pt() const final
transverse momentum
const float getEffectiveArea(float eta) const
float full5x5_sigmaIetaIeta() const
Definition: GsfElectron.h:462
EffectiveAreas _effectiveAreas
float deltaEtaSuperClusterTrackAtVtx() const
Definition: GsfElectron.h:253
float hadronicOverEm() const
Definition: GsfElectron.h:495
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:641
float deltaPhiSuperClusterTrackAtVtx() const
Definition: GsfElectron.h:256
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:640
ElectronIdentifier(const edm::ParameterSet &c)
void setRho(double rho)
float ecalEnergy() const
Definition: GsfElectron.h:860
HLT enums.
void setID(std::string ID)
SuperClusterRef superCluster() const override
reference to a SuperCluster
Definition: GsfElectron.h:185
const Point & position() const
position
Definition: BeamSpot.h:62
float isolation(const reco::GsfElectronPtr &ele)
float sumChargedHadronPt
sum-pt of charged Hadron // old float chargedHadronIso ;
Definition: GsfElectron.h:639