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 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 override 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 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 6 of file GsfEleCalPFClusterIsoCut.cc.

Member Enumeration Documentation

Constructor & Destructor Documentation

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

Definition at line 46 of file GsfEleCalPFClusterIsoCut.cc.

References CutApplicatorWithEventContentBase::contentTags_, edm::ParameterSet::getParameter(), rhoString_, and HiL1Corrector_cff::rhoTag.

46  :
48  isoCutEBLowPt_(c.getParameter<double>("isoCutEBLowPt")),
49  isoCutEBHighPt_(c.getParameter<double>("isoCutEBHighPt")),
50  isoCutEELowPt_(c.getParameter<double>("isoCutEELowPt")),
51  isoCutEEHighPt_(c.getParameter<double>("isoCutEEHighPt")),
52  isoType_(c.getParameter<int>("isoType")),
53  ptCutOff_(c.getParameter<double>("ptCutOff")),
54  barrelCutOff_(c.getParameter<double>("barrelCutOff")),
55  isRelativeIso_(c.getParameter<bool>("isRelativeIso")),
56  effectiveAreas_( (c.getParameter<edm::FileInPath>("effAreasConfigFile")).fullPath())
57 {
58 
60  contentTags_.emplace(rhoString_,rhoTag);
61 
62 }
T getParameter(std::string const &) const
std::unordered_map< std::string, edm::InputTag > contentTags_

Member Function Documentation

CandidateType GsfEleCalPFClusterIsoCut::candidateType ( ) const
inlinefinalvirtual

Reimplemented from CutApplicatorBase.

Definition at line 20 of file GsfEleCalPFClusterIsoCut.cc.

References CutApplicatorBase::ELECTRON.

20  {
21  return ELECTRON;
22  }
void GsfEleCalPFClusterIsoCut::getEventContent ( const edm::EventBase ev)
finalvirtual

Implements CutApplicatorWithEventContentBase.

Definition at line 70 of file GsfEleCalPFClusterIsoCut.cc.

References CutApplicatorWithEventContentBase::contentTags_, edm::EventBase::getByLabel(), operator()(), rhoHandle_, and rhoString_.

70  {
71 
73 }
std::unordered_map< std::string, edm::InputTag > contentTags_
edm::Handle< double > rhoHandle_
bool getByLabel(InputTag const &, Handle< T > &) const
Definition: EventBase.h:94
CutApplicatorBase::result_type GsfEleCalPFClusterIsoCut::operator() ( const reco::GsfElectronPtr cand) const
finalvirtual

Reimplemented from CutApplicatorBase.

Definition at line 77 of file GsfEleCalPFClusterIsoCut.cc.

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

Referenced by getEventContent().

77  {
78 
79  // Establish the cut value
80  double absEta = std::abs(cand->superCluster()->eta());
81 
82  const pat::Electron* elPat = dynamic_cast<const pat::Electron*>(cand.get());
83  if( !elPat ) {
84  throw cms::Exception("ERROR: this VID selection is meant to be run on miniAOD/PAT only")
85  << std::endl << "Change input format to PAT/miniAOD or contact Egamma experts"
86  << std::endl << std::endl;
87  }
88 
89  const float isoCut =
90  ( cand->pt() < ptCutOff_ ?
92  :
94 
95  const float eA = effectiveAreas_.getEffectiveArea( absEta );
96  const float rho = rhoHandle_.isValid() ? (float)(*rhoHandle_) : 0; // std::max likes float arguments
97 
98  float isoValue = -999;
99  if( isoType_ == ISO_ECAL ){
100  isoValue = elPat->ecalPFClusterIso();
101  }else if( isoType_ == ISO_HCAL ){
102  isoValue = elPat->hcalPFClusterIso();
103  }else{
104  throw cms::Exception("ERROR: unknown type requested for PF cluster isolation.")
105  << std::endl << "Check VID configuration." << std::endl;
106  }
107  float isoValueCorr = std::max(0.0f, isoValue - rho*eA);
108 
109  // Apply the cut and return the result
110  // Scale by pT if the relative isolation is requested but avoid division by 0
111  return isoValueCorr < isoCut*(isRelativeIso_ ? cand->pt() : 1.);
112 }
T const * get() const
Returns C++ pointer to the item.
Definition: Ptr.h:159
double pt() const final
transverse momentum
const float getEffectiveArea(float eta) const
edm::Handle< double > rhoHandle_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double f[11][100]
bool isValid() const
Definition: HandleBase.h:74
Analysis-level electron class.
Definition: Electron.h:52
SuperClusterRef superCluster() const override
reference to a SuperCluster
Definition: GsfElectron.h:184
void GsfEleCalPFClusterIsoCut::setConsumes ( edm::ConsumesCollector cc)
finalvirtual

Implements CutApplicatorWithEventContentBase.

Definition at line 64 of file GsfEleCalPFClusterIsoCut.cc.

References edm::ConsumesCollector::consumes(), CutApplicatorWithEventContentBase::contentTags_, CutApplicatorWithEventContentBase::contentTokens_, rho, and rhoString_.

64  {
65 
66  auto rho = cc.consumes<double>(contentTags_[rhoString_]);
67  contentTokens_.emplace(rhoString_, rho);
68 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
std::unordered_map< std::string, edm::EDGetToken > contentTokens_
std::unordered_map< std::string, edm::InputTag > contentTags_
double GsfEleCalPFClusterIsoCut::value ( const reco::CandidatePtr cand) const
finalvirtual

Implements candidate_functions::CandidateCut.

Definition at line 114 of file GsfEleCalPFClusterIsoCut.cc.

References funct::abs(), effectiveAreas_, Exception, f, objects.autophobj::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().

114  {
115 
116  reco::GsfElectronPtr ele(cand);
117  // Establish the cut value
118  double absEta = std::abs(ele->superCluster()->eta());
119 
120  const pat::Electron *elPat = dynamic_cast<const pat::Electron*>(ele.get());
121  if( !elPat ){
122  throw cms::Exception("ERROR: this VID selection is meant to be run on miniAOD/PAT only")
123  << std::endl << "Change input format to PAT/miniAOD or contact Egamma experts"
124  << std::endl << std::endl;
125  }
126 
127  const float eA = effectiveAreas_.getEffectiveArea( absEta );
128  const float rho = rhoHandle_.isValid() ? (float)(*rhoHandle_) : 0; // std::max likes float arguments
129 
130  float isoValue = -999;
131  if( isoType_ == ISO_ECAL ){
132  isoValue = elPat->ecalPFClusterIso();
133  }else if( isoType_ == ISO_HCAL ){
134  isoValue = elPat->hcalPFClusterIso();
135  }else{
136  throw cms::Exception("ERROR: unknown type requested for PF cluster isolation.")
137  << std::endl << "Check VID configuration." << std::endl;
138  }
139  float isoValueCorr = std::max(0.0f, isoValue - rho*eA);
140 
141  // Divide by pT if the relative isolation is requested
142  if( isRelativeIso_ )
143  isoValueCorr /= ele->pt();
144 
145  // Apply the cut and return the result
146  return isoValueCorr;
147 }
const float getEffectiveArea(float eta) const
edm::Handle< double > rhoHandle_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double f[11][100]
bool isValid() const
Definition: HandleBase.h:74
Analysis-level electron class.
Definition: Electron.h:52

Member Data Documentation

const float GsfEleCalPFClusterIsoCut::barrelCutOff_
private

Definition at line 30 of file GsfEleCalPFClusterIsoCut.cc.

Referenced by operator()().

EffectiveAreas GsfEleCalPFClusterIsoCut::effectiveAreas_
private

Definition at line 33 of file GsfEleCalPFClusterIsoCut.cc.

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

const float GsfEleCalPFClusterIsoCut::isoCutEBHighPt_
private

Definition at line 26 of file GsfEleCalPFClusterIsoCut.cc.

Referenced by operator()().

const float GsfEleCalPFClusterIsoCut::isoCutEBLowPt_
private

Definition at line 26 of file GsfEleCalPFClusterIsoCut.cc.

Referenced by operator()().

const float GsfEleCalPFClusterIsoCut::isoCutEEHighPt_
private

Definition at line 26 of file GsfEleCalPFClusterIsoCut.cc.

Referenced by operator()().

const float GsfEleCalPFClusterIsoCut::isoCutEELowPt_
private

Definition at line 26 of file GsfEleCalPFClusterIsoCut.cc.

Referenced by operator()().

const int GsfEleCalPFClusterIsoCut::isoType_
private

Definition at line 28 of file GsfEleCalPFClusterIsoCut.cc.

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

bool GsfEleCalPFClusterIsoCut::isRelativeIso_
private

Definition at line 31 of file GsfEleCalPFClusterIsoCut.cc.

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

const float GsfEleCalPFClusterIsoCut::ptCutOff_
private

Definition at line 29 of file GsfEleCalPFClusterIsoCut.cc.

Referenced by operator()().

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

Definition at line 35 of file GsfEleCalPFClusterIsoCut.cc.

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

char GsfEleCalPFClusterIsoCut::rhoString_ = "rho"
staticprivate