CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Attributes | Static Private Attributes
GsfEleCalPFClusterIsoCut Class Reference
Inheritance diagram for GsfEleCalPFClusterIsoCut:
CutApplicatorWithEventContentBase CutApplicatorBase candidate_functions::CandidateCut

Public Types

enum  IsoType { UNDEF = -1, ISO_ECAL = 0, ISO_HCAL = 1 }
 
- Public Types inherited from CutApplicatorBase
enum  CandidateType {
  NONE, ELECTRON, MUON, PHOTON,
  TAU, PATELECTRON, PATMUON, PATPHOTON,
  PATTAU
}
 
- Public Types inherited from candidate_functions::CandidateCut
using argument_type = reco::CandidatePtr
 
using result_type = bool
 

Public Member Functions

CandidateType candidateType () const final
 
void getEventContent (const edm::EventBase &) final
 
 GsfEleCalPFClusterIsoCut (const edm::ParameterSet &c)
 
result_type operator() (const reco::GsfElectronPtr &) const final
 
void setConsumes (edm::ConsumesCollector &) final
 
double value (const reco::CandidatePtr &cand) const final
 
- Public Member Functions inherited from CutApplicatorWithEventContentBase
 CutApplicatorWithEventContentBase ()
 
 CutApplicatorWithEventContentBase (const edm::ParameterSet &c)
 
 CutApplicatorWithEventContentBase (const CutApplicatorWithEventContentBase &)=delete
 
CutApplicatorWithEventContentBaseoperator= (const CutApplicatorWithEventContentBase &)=delete
 
 ~CutApplicatorWithEventContentBase () override
 Destructor. More...
 
- Public Member Functions inherited from CutApplicatorBase
virtual result_type asCandidate (const argument_type &) const
 
 CutApplicatorBase ()
 
 CutApplicatorBase (const edm::ParameterSet &c)
 
 CutApplicatorBase (const CutApplicatorBase &)=delete
 
const std::string & name () const override
 
result_type operator() (const argument_type &) const final
 
virtual result_type operator() (const pat::ElectronPtr &) const
 
virtual result_type operator() (const reco::PhotonPtr &) const
 
virtual result_type operator() (const pat::PhotonPtr &) const
 
virtual result_type operator() (const reco::MuonPtr &) const
 
virtual result_type operator() (const pat::MuonPtr &) const
 
virtual result_type operator() (const reco::PFTauPtr &) const
 
virtual result_type operator() (const pat::TauPtr &) const
 
CutApplicatorBaseoperator= (const CutApplicatorBase &)=delete
 
 ~CutApplicatorBase () override
 Destructor. More...
 
- Public Member Functions inherited from candidate_functions::CandidateCut
 CandidateCut ()
 
virtual ~CandidateCut ()
 

Private Attributes

const float barrelCutOff_
 
EffectiveAreas effectiveAreas_
 
const float isoCutEBHighPt_
 
const float isoCutEBLowPt_
 
const float isoCutEEHighPt_
 
const float isoCutEELowPt_
 
const int isoType_
 
bool isRelativeIso_
 
const float ptCutOff_
 
edm::Handle< double > rhoHandle_
 

Static Private Attributes

static constexpr char rhoString_ [] = "rho"
 

Additional Inherited Members

- Protected Attributes inherited from CutApplicatorWithEventContentBase
std::unordered_map< std::string, edm::InputTagcontentTags_
 
std::unordered_map< std::string, edm::EDGetTokencontentTokens_
 

Detailed Description

Definition at line 5 of file GsfEleCalPFClusterIsoCut.cc.

Member Enumeration Documentation

◆ IsoType

Constructor & Destructor Documentation

◆ GsfEleCalPFClusterIsoCut()

GsfEleCalPFClusterIsoCut::GsfEleCalPFClusterIsoCut ( const edm::ParameterSet c)

Definition at line 40 of file GsfEleCalPFClusterIsoCut.cc.

References HltBtagPostValidation_cff::c, CutApplicatorWithEventContentBase::contentTags_, rhoString_, and HLT_2023v12_cff::rhoTag.

42  isoCutEBLowPt_(c.getParameter<double>("isoCutEBLowPt")),
43  isoCutEBHighPt_(c.getParameter<double>("isoCutEBHighPt")),
44  isoCutEELowPt_(c.getParameter<double>("isoCutEELowPt")),
45  isoCutEEHighPt_(c.getParameter<double>("isoCutEEHighPt")),
46  isoType_(c.getParameter<int>("isoType")),
47  ptCutOff_(c.getParameter<double>("ptCutOff")),
48  barrelCutOff_(c.getParameter<double>("barrelCutOff")),
49  isRelativeIso_(c.getParameter<bool>("isRelativeIso")),
50  effectiveAreas_((c.getParameter<edm::FileInPath>("effAreasConfigFile")).fullPath()) {
51  edm::InputTag rhoTag = c.getParameter<edm::InputTag>("rho");
52  contentTags_.emplace(rhoString_, rhoTag);
53 }
std::unordered_map< std::string, edm::InputTag > contentTags_
static constexpr char rhoString_[]

Member Function Documentation

◆ candidateType()

CandidateType GsfEleCalPFClusterIsoCut::candidateType ( ) const
inlinefinalvirtual

Reimplemented from CutApplicatorBase.

Definition at line 18 of file GsfEleCalPFClusterIsoCut.cc.

References CutApplicatorBase::ELECTRON.

◆ getEventContent()

void GsfEleCalPFClusterIsoCut::getEventContent ( const edm::EventBase ev)
finalvirtual

◆ operator()()

CutApplicatorBase::result_type GsfEleCalPFClusterIsoCut::operator() ( const reco::GsfElectronPtr cand) const
finalvirtual

Reimplemented from CutApplicatorBase.

Definition at line 64 of file GsfEleCalPFClusterIsoCut.cc.

References funct::abs(), barrelCutOff_, effectiveAreas_, Exception, f, dqmMemoryStats::float, EffectiveAreas::getEffectiveArea(), ISO_ECAL, ISO_HCAL, isoCutEBHighPt_, isoCutEBLowPt_, isoCutEEHighPt_, isoCutEELowPt_, isoType_, isRelativeIso_, edm::HandleBase::isValid(), SiStripPI::max, ptCutOff_, rho, and rhoHandle_.

64  {
65  // Establish the cut value
66  double absEta = std::abs(cand->superCluster()->eta());
67 
68  const pat::Electron* elPat = dynamic_cast<const pat::Electron*>(cand.get());
69  if (!elPat) {
70  throw cms::Exception("ERROR: this VID selection is meant to be run on miniAOD/PAT only")
71  << std::endl
72  << "Change input format to PAT/miniAOD or contact Egamma experts" << std::endl
73  << std::endl;
74  }
75 
76  const float isoCut = (cand->pt() < ptCutOff_ ? (absEta < barrelCutOff_ ? isoCutEBLowPt_ : isoCutEELowPt_)
78 
79  const float eA = effectiveAreas_.getEffectiveArea(absEta);
80  const float rho = rhoHandle_.isValid() ? (float)(*rhoHandle_) : 0; // std::max likes float arguments
81 
82  float isoValue = -999;
83  if (isoType_ == ISO_ECAL) {
84  isoValue = elPat->ecalPFClusterIso();
85  } else if (isoType_ == ISO_HCAL) {
86  isoValue = elPat->hcalPFClusterIso();
87  } else {
88  throw cms::Exception("ERROR: unknown type requested for PF cluster isolation.")
89  << std::endl
90  << "Check VID configuration." << std::endl;
91  }
92  float isoValueCorr = std::max(0.0f, isoValue - rho * eA);
93 
94  // Apply the cut and return the result
95  // Scale by pT if the relative isolation is requested but avoid division by 0
96  return isoValueCorr < isoCut * (isRelativeIso_ ? cand->pt() : 1.);
97 }
edm::Handle< double > rhoHandle_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double f[11][100]
const float getEffectiveArea(float eta) const
Analysis-level electron class.
Definition: Electron.h:51
bool isValid() const
Definition: HandleBase.h:70

◆ setConsumes()

void GsfEleCalPFClusterIsoCut::setConsumes ( edm::ConsumesCollector cc)
finalvirtual

Implements CutApplicatorWithEventContentBase.

Definition at line 55 of file GsfEleCalPFClusterIsoCut.cc.

References gpuPixelDoublets::cc, CutApplicatorWithEventContentBase::contentTags_, CutApplicatorWithEventContentBase::contentTokens_, rho, and rhoString_.

55  {
56  auto rho = cc.consumes<double>(contentTags_[rhoString_]);
57  contentTokens_.emplace(rhoString_, rho);
58 }
std::unordered_map< std::string, edm::InputTag > contentTags_
static constexpr char rhoString_[]
uint32_t cc[maxCellsPerHit]
Definition: gpuFishbone.h:49
std::unordered_map< std::string, edm::EDGetToken > contentTokens_

◆ value()

double GsfEleCalPFClusterIsoCut::value ( const reco::CandidatePtr cand) const
finalvirtual

Implements candidate_functions::CandidateCut.

Definition at line 99 of file GsfEleCalPFClusterIsoCut.cc.

References funct::abs(), effectiveAreas_, Exception, f, dqmMemoryStats::float, edm::Ptr< T >::get(), EffectiveAreas::getEffectiveArea(), ISO_ECAL, ISO_HCAL, isoType_, isRelativeIso_, edm::HandleBase::isValid(), SiStripPI::max, reco::LeafCandidate::pt(), rho, rhoHandle_, and reco::GsfElectron::superCluster().

99  {
101  // Establish the cut value
102  double absEta = std::abs(ele->superCluster()->eta());
103 
104  const pat::Electron* elPat = dynamic_cast<const pat::Electron*>(ele.get());
105  if (!elPat) {
106  throw cms::Exception("ERROR: this VID selection is meant to be run on miniAOD/PAT only")
107  << std::endl
108  << "Change input format to PAT/miniAOD or contact Egamma experts" << std::endl
109  << std::endl;
110  }
111 
112  const float eA = effectiveAreas_.getEffectiveArea(absEta);
113  const float rho = rhoHandle_.isValid() ? (float)(*rhoHandle_) : 0; // std::max likes float arguments
114 
115  float isoValue = -999;
116  if (isoType_ == ISO_ECAL) {
117  isoValue = elPat->ecalPFClusterIso();
118  } else if (isoType_ == ISO_HCAL) {
119  isoValue = elPat->hcalPFClusterIso();
120  } else {
121  throw cms::Exception("ERROR: unknown type requested for PF cluster isolation.")
122  << std::endl
123  << "Check VID configuration." << std::endl;
124  }
125  float isoValueCorr = std::max(0.0f, isoValue - rho * eA);
126 
127  // Divide by pT if the relative isolation is requested
128  if (isRelativeIso_)
129  isoValueCorr /= ele->pt();
130 
131  // Apply the cut and return the result
132  return isoValueCorr;
133 }
edm::Handle< double > rhoHandle_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double f[11][100]
const float getEffectiveArea(float eta) const
Analysis-level electron class.
Definition: Electron.h:51
bool isValid() const
Definition: HandleBase.h:70

Member Data Documentation

◆ barrelCutOff_

const float GsfEleCalPFClusterIsoCut::barrelCutOff_
private

Definition at line 26 of file GsfEleCalPFClusterIsoCut.cc.

Referenced by operator()().

◆ effectiveAreas_

EffectiveAreas GsfEleCalPFClusterIsoCut::effectiveAreas_
private

Definition at line 29 of file GsfEleCalPFClusterIsoCut.cc.

Referenced by operator()(), and value().

◆ isoCutEBHighPt_

const float GsfEleCalPFClusterIsoCut::isoCutEBHighPt_
private

Definition at line 22 of file GsfEleCalPFClusterIsoCut.cc.

Referenced by operator()().

◆ isoCutEBLowPt_

const float GsfEleCalPFClusterIsoCut::isoCutEBLowPt_
private

Definition at line 22 of file GsfEleCalPFClusterIsoCut.cc.

Referenced by operator()().

◆ isoCutEEHighPt_

const float GsfEleCalPFClusterIsoCut::isoCutEEHighPt_
private

Definition at line 22 of file GsfEleCalPFClusterIsoCut.cc.

Referenced by operator()().

◆ isoCutEELowPt_

const float GsfEleCalPFClusterIsoCut::isoCutEELowPt_
private

Definition at line 22 of file GsfEleCalPFClusterIsoCut.cc.

Referenced by operator()().

◆ isoType_

const int GsfEleCalPFClusterIsoCut::isoType_
private

Definition at line 24 of file GsfEleCalPFClusterIsoCut.cc.

Referenced by operator()(), and value().

◆ isRelativeIso_

bool GsfEleCalPFClusterIsoCut::isRelativeIso_
private

Definition at line 27 of file GsfEleCalPFClusterIsoCut.cc.

Referenced by operator()(), and value().

◆ ptCutOff_

const float GsfEleCalPFClusterIsoCut::ptCutOff_
private

Definition at line 25 of file GsfEleCalPFClusterIsoCut.cc.

Referenced by operator()().

◆ rhoHandle_

edm::Handle<double> GsfEleCalPFClusterIsoCut::rhoHandle_
private

Definition at line 31 of file GsfEleCalPFClusterIsoCut.cc.

Referenced by getEventContent(), operator()(), and value().

◆ rhoString_

constexpr char GsfEleCalPFClusterIsoCut::rhoString_ = "rho"
staticprivate