CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
GsfEleEffAreaPFIsoCut.cc
Go to the documentation of this file.
4 
5 
7 public:
9 
10  result_type operator()(const reco::GsfElectronPtr&) const override final;
11 
12  void setConsumes(edm::ConsumesCollector&) override final;
13  void getEventContent(const edm::EventBase&) override final;
14 
15  double value(const reco::CandidatePtr& cand) const override final;
16 
17  CandidateType candidateType() const override final {
18  return ELECTRON;
19  }
20 
21 private:
22  // Cut values
24  // Configuration
25  const float _ptCutOff;
26  const float _barrelCutOff;
28  // Effective area constants
30  // The rho
32 
33  constexpr static char rhoString_ [] = "rho";
34 };
35 
37 
40  "GsfEleEffAreaPFIsoCut");
41 
44  _isoCutEBLowPt(c.getParameter<double>("isoCutEBLowPt")),
45  _isoCutEBHighPt(c.getParameter<double>("isoCutEBHighPt")),
46  _isoCutEELowPt(c.getParameter<double>("isoCutEELowPt")),
47  _isoCutEEHighPt(c.getParameter<double>("isoCutEEHighPt")),
48  _ptCutOff(c.getParameter<double>("ptCutOff")),
49  _barrelCutOff(c.getParameter<double>("barrelCutOff")),
50  _isRelativeIso(c.getParameter<bool>("isRelativeIso")),
51  _effectiveAreas( (c.getParameter<edm::FileInPath>("effAreasConfigFile")).fullPath())
52 {
53 
54  edm::InputTag rhoTag = c.getParameter<edm::InputTag>("rho");
55  contentTags_.emplace(rhoString_,rhoTag);
56 
57 }
58 
60 
61  auto rho = cc.consumes<double>(contentTags_[rhoString_]);
62  contentTokens_.emplace(rhoString_, rho);
63 }
64 
66 
68 }
69 
70 CutApplicatorBase::result_type
72 operator()(const reco::GsfElectronPtr& cand) const{
73 
74  // Establish the cut value
75  double absEta = std::abs(cand->superCluster()->eta());
76  const float isoCut =
77  ( cand->pt() < _ptCutOff ?
79  :
81 
82  // Compute the combined isolation with effective area correction
84  cand->pfIsolationVariables();
85  const float chad = pfIso.sumChargedHadronPt;
86  const float nhad = pfIso.sumNeutralHadronEt;
87  const float pho = pfIso.sumPhotonEt;
88  const float eA = _effectiveAreas.getEffectiveArea( absEta );
89  const float rho = _rhoHandle.isValid() ? (float)(*_rhoHandle) : 0; // std::max likes float arguments
90  const float iso = chad + std::max(0.0f, nhad + pho - rho*eA);
91 
92  // Apply the cut and return the result
93  // Scale by pT if the relative isolation is requested but avoid division by 0
94  return iso < isoCut*(_isRelativeIso ? cand->pt() : 1.);
95 }
96 
98  reco::GsfElectronPtr ele(cand);
99  // Establish the cut value
100  double absEta = std::abs(ele->superCluster()->eta());
101 
102  // Compute the combined isolation with effective area correction
104  ele->pfIsolationVariables();
105  const float chad = pfIso.sumChargedHadronPt;
106  const float nhad = pfIso.sumNeutralHadronEt;
107  const float pho = pfIso.sumPhotonEt;
108  float eA = _effectiveAreas.getEffectiveArea( absEta );
109  float rho = (float)(*_rhoHandle); // std::max likes float arguments
110  float iso = chad + std::max(0.0f, nhad + pho - rho*eA);
111 
112  // Divide by pT if the relative isolation is requested
113  if( _isRelativeIso )
114  iso /= ele->pt();
115 
116  // Apply the cut and return the result
117  return iso;
118 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
std::unordered_map< std::string, edm::EDGetToken > contentTokens_
bool ev
const float getEffectiveArea(float eta) const
#define constexpr
std::unordered_map< std::string, edm::InputTag > contentTags_
void getEventContent(const edm::EventBase &) overridefinal
float sumPhotonEt
sum pt of PF photons // old float photonIso ;
Definition: GsfElectron.h:575
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
result_type operator()(const reco::GsfElectronPtr &) const overridefinal
double f[11][100]
float sumNeutralHadronEt
sum pt of neutral hadrons // old float neutralHadronIso ;
Definition: GsfElectron.h:574
CandidateType candidateType() const overridefinal
bool isValid() const
Definition: HandleBase.h:75
void setConsumes(edm::ConsumesCollector &) overridefinal
string const
Definition: compareJSON.py:14
double value(const reco::CandidatePtr &cand) const overridefinal
bool getByLabel(InputTag const &, Handle< T > &) const
Definition: EventBase.h:90
#define DEFINE_EDM_PLUGIN(factory, type, name)
GsfEleEffAreaPFIsoCut(const edm::ParameterSet &c)
edm::Handle< double > _rhoHandle
float sumChargedHadronPt
sum-pt of charged Hadron // old float chargedHadronIso ;
Definition: GsfElectron.h:573