CMS 3D CMS Logo

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

Public Member Functions

CandidateType candidateType () const final
 
void getEventContent (const edm::EventBase &) final
 
result_type operator() (const reco::PhotonPtr &) const final
 
 PhoAnyPFIsoWithEAAndExpoScalingEBCut (const edm::ParameterSet &c)
 
void setConsumes (edm::ConsumesCollector &) final
 
double value (const reco::CandidatePtr &cand) const final
 
- Public Member Functions inherited from CutApplicatorWithEventContentBase
 CutApplicatorWithEventContentBase ()
 
 CutApplicatorWithEventContentBase (const CutApplicatorWithEventContentBase &)=delete
 
 CutApplicatorWithEventContentBase (const edm::ParameterSet &c)
 
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 CutApplicatorBase &)=delete
 
 CutApplicatorBase (const edm::ParameterSet &c)
 
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 pat::MuonPtr &) const
 
virtual result_type operator() (const reco::GsfElectronPtr &) const
 
virtual result_type operator() (const reco::MuonPtr &) const
 
CutApplicatorBaseoperator= (const CutApplicatorBase &)=delete
 
 ~CutApplicatorBase () override
 Destructor. More...
 
- Public Member Functions inherited from candidate_functions::CandidateCut
 CandidateCut ()
 
virtual ~CandidateCut ()
 

Private Attributes

edm::Handle< edm::ValueMap< float > > _anyPFIsoMap
 
float _barrelCutOff
 
float _C1_EB
 
float _C1_EE
 
float _C2_EB
 
float _C2_EE
 
float _C3_EB
 
EffectiveAreas _effectiveAreas
 
edm::Handle< double > _rhoHandle
 
bool _useRelativeIso
 

Static Private Attributes

constexpr static char anyPFIsoWithEA_ [] = "anyPFIsoWithEA"
 
constexpr static char rhoString_ [] = "rho"
 

Additional Inherited Members

- 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
 
- 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 PhoAnyPFIsoWithEAAndExpoScalingEBCut.cc.

Constructor & Destructor Documentation

◆ PhoAnyPFIsoWithEAAndExpoScalingEBCut()

PhoAnyPFIsoWithEAAndExpoScalingEBCut::PhoAnyPFIsoWithEAAndExpoScalingEBCut ( const edm::ParameterSet c)

Definition at line 44 of file PhoAnyPFIsoWithEAAndExpoScalingEBCut.cc.

46  _C1_EB(c.getParameter<double>("C1_EB")),
47  _C2_EB(c.getParameter<double>("C2_EB")),
48  _C3_EB(c.getParameter<double>("C3_EB")),
49  _C1_EE(c.getParameter<double>("C1_EE")),
50  _C2_EE(c.getParameter<double>("C2_EE")),
51  _barrelCutOff(c.getParameter<double>("barrelCutOff")),
52  _useRelativeIso(c.getParameter<bool>("useRelativeIso")),
53  _effectiveAreas((c.getParameter<edm::FileInPath>("effAreasConfigFile")).fullPath()) {
54  edm::InputTag maptag = c.getParameter<edm::InputTag>("anyPFIsoMap");
55  contentTags_.emplace(anyPFIsoWithEA_, maptag);
56 
57  edm::InputTag rhoTag = c.getParameter<edm::InputTag>("rho");
58  contentTags_.emplace(rhoString_, rhoTag);
59 }

References anyPFIsoWithEA_, HltBtagPostValidation_cff::c, CutApplicatorWithEventContentBase::contentTags_, rhoString_, and HLT_2018_cff::rhoTag.

Member Function Documentation

◆ candidateType()

CandidateType PhoAnyPFIsoWithEAAndExpoScalingEBCut::candidateType ( ) const
inlinefinalvirtual

Reimplemented from CutApplicatorBase.

Definition at line 16 of file PhoAnyPFIsoWithEAAndExpoScalingEBCut.cc.

16 { return PHOTON; }

References CutApplicatorBase::PHOTON.

◆ getEventContent()

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

◆ operator()()

CutApplicatorBase::result_type PhoAnyPFIsoWithEAAndExpoScalingEBCut::operator() ( const reco::PhotonPtr cand) const
finalvirtual

Reimplemented from CutApplicatorBase.

Definition at line 74 of file PhoAnyPFIsoWithEAAndExpoScalingEBCut.cc.

74  {
75  // in case we are by-value
76  const std::string& inst_name = contentTags_.find(anyPFIsoWithEA_)->second.instance();
78  float anyisoval = -1.0;
79  if (_anyPFIsoMap.isValid() && _anyPFIsoMap->contains(cand.id())) {
80  anyisoval = (*_anyPFIsoMap)[cand];
81  } else if (_anyPFIsoMap.isValid() && _anyPFIsoMap->idSize() == 1 && cand.id() == edm::ProductID()) {
82  // in case we have spoofed a ptr
83  //note this must be a 1:1 valuemap (only one product input)
84  anyisoval = _anyPFIsoMap->begin()[cand.key()];
85  } else if (_anyPFIsoMap.isValid()) { // throw an exception
86  anyisoval = (*_anyPFIsoMap)[cand];
87  }
88 
89  // Figure out the cut value
90  // The value is generally pt-dependent: C1 + pt * C2
91  const float pt = cand->pt();
92 
93  // In this version of the isolation cut we apply
94  // exponential pt scaling to the barrel isolation cut,
95  // and linear pt scaling to the endcap isolation cut.
96  double absEta = std::abs(cand->superCluster()->eta());
97  const float isolationCutValue = (absEta < _barrelCutOff ? _C1_EB + exp(pt * _C2_EB + _C3_EB) : _C1_EE + pt * _C2_EE);
98 
99  // Retrieve the variable value for this particle
100  float anyPFIso = _anyPFIsoMap.isValid() ? anyisoval : pat->userFloat(inst_name);
101 
102  // Apply pile-up correction
103  double eA = _effectiveAreas.getEffectiveArea(absEta);
104  double rho = *_rhoHandle;
105  float anyPFIsoWithEA = std::max(0.0, anyPFIso - rho * eA);
106 
107  // Divide by pT if the relative isolation is requested
108  if (_useRelativeIso)
109  anyPFIsoWithEA /= pt;
110 
111  // Apply the cut and return the result
112  return anyPFIsoWithEA < isolationCutValue;
113 }

References _anyPFIsoMap, _barrelCutOff, _C1_EB, _C1_EE, _C2_EB, _C2_EE, _C3_EB, _effectiveAreas, _rhoHandle, _useRelativeIso, funct::abs(), anyPFIsoWithEA_, edm::ValueMap< T >::begin(), edm::ValueMap< T >::contains(), CutApplicatorWithEventContentBase::contentTags_, JetChargeProducer_cfi::exp, EffectiveAreas::getEffectiveArea(), edm::ValueMap< T >::idSize(), edm::HandleBase::isValid(), SiStripPI::max, DiDispStaMuonMonitor_cfi::pt, rho, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ setConsumes()

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

Implements CutApplicatorWithEventContentBase.

Definition at line 61 of file PhoAnyPFIsoWithEAAndExpoScalingEBCut.cc.

61  {
62  auto anyPFIsoWithEA = cc.consumes<edm::ValueMap<float> >(contentTags_[anyPFIsoWithEA_]);
63  contentTokens_.emplace(anyPFIsoWithEA_, anyPFIsoWithEA);
64 
65  auto rho = cc.consumes<double>(contentTags_[rhoString_]);
66  contentTokens_.emplace(rhoString_, rho);
67 }

References anyPFIsoWithEA_, CutApplicatorWithEventContentBase::contentTags_, CutApplicatorWithEventContentBase::contentTokens_, rho, and rhoString_.

◆ value()

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

Implements candidate_functions::CandidateCut.

Definition at line 115 of file PhoAnyPFIsoWithEAAndExpoScalingEBCut.cc.

115  {
116  reco::PhotonPtr pho(cand);
117 
118  // in case we are by-value
119  const std::string& inst_name = contentTags_.find(anyPFIsoWithEA_)->second.instance();
121  float anyisoval = -1.0;
122  if (_anyPFIsoMap.isValid() && _anyPFIsoMap->contains(cand.id())) {
123  anyisoval = (*_anyPFIsoMap)[cand];
124  } else if (_anyPFIsoMap.isValid() && _anyPFIsoMap->idSize() == 1 && cand.id() == edm::ProductID()) {
125  // in case we have spoofed a ptr
126  //note this must be a 1:1 valuemap (only one product input)
127  anyisoval = _anyPFIsoMap->begin()[cand.key()];
128  } else if (_anyPFIsoMap.isValid()) { // throw an exception
129  anyisoval = (*_anyPFIsoMap)[cand];
130  }
131 
132  // Figure out the cut value
133  // The value is generally pt-dependent: C1 + pt * C2
134  const float pt = pho->pt();
135 
136  // In this version of the isolation cut we apply
137  // exponential pt scaling to the barrel isolation cut,
138  // and linear pt scaling to the endcap isolation cut.
139  double absEta = std::abs(pho->superCluster()->eta());
140 
141  // Retrieve the variable value for this particle
142  float anyPFIso = _anyPFIsoMap.isValid() ? anyisoval : pat->userFloat(inst_name);
143 
144  // Apply pile-up correction
145  double eA = _effectiveAreas.getEffectiveArea(absEta);
146  double rho = *_rhoHandle;
147  float anyPFIsoWithEA = std::max(0.0, anyPFIso - rho * eA);
148 
149  // Divide by pT if the relative isolation is requested
150  if (_useRelativeIso)
151  anyPFIsoWithEA /= pt;
152 
153  // Apply the cut and return the result
154  return anyPFIsoWithEA;
155 }

References _anyPFIsoMap, _effectiveAreas, _rhoHandle, _useRelativeIso, funct::abs(), anyPFIsoWithEA_, edm::ValueMap< T >::begin(), edm::ValueMap< T >::contains(), CutApplicatorWithEventContentBase::contentTags_, EffectiveAreas::getEffectiveArea(), edm::ValueMap< T >::idSize(), edm::HandleBase::isValid(), SiStripPI::max, DiDispStaMuonMonitor_cfi::pt, rho, and AlCaHLTBitMon_QueryRunRegistry::string.

Member Data Documentation

◆ _anyPFIsoMap

edm::Handle<edm::ValueMap<float> > PhoAnyPFIsoWithEAAndExpoScalingEBCut::_anyPFIsoMap
private

Definition at line 31 of file PhoAnyPFIsoWithEAAndExpoScalingEBCut.cc.

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

◆ _barrelCutOff

float PhoAnyPFIsoWithEAAndExpoScalingEBCut::_barrelCutOff
private

Definition at line 26 of file PhoAnyPFIsoWithEAAndExpoScalingEBCut.cc.

Referenced by operator()().

◆ _C1_EB

float PhoAnyPFIsoWithEAAndExpoScalingEBCut::_C1_EB
private

Definition at line 20 of file PhoAnyPFIsoWithEAAndExpoScalingEBCut.cc.

Referenced by operator()().

◆ _C1_EE

float PhoAnyPFIsoWithEAAndExpoScalingEBCut::_C1_EE
private

Definition at line 23 of file PhoAnyPFIsoWithEAAndExpoScalingEBCut.cc.

Referenced by operator()().

◆ _C2_EB

float PhoAnyPFIsoWithEAAndExpoScalingEBCut::_C2_EB
private

Definition at line 21 of file PhoAnyPFIsoWithEAAndExpoScalingEBCut.cc.

Referenced by operator()().

◆ _C2_EE

float PhoAnyPFIsoWithEAAndExpoScalingEBCut::_C2_EE
private

Definition at line 24 of file PhoAnyPFIsoWithEAAndExpoScalingEBCut.cc.

Referenced by operator()().

◆ _C3_EB

float PhoAnyPFIsoWithEAAndExpoScalingEBCut::_C3_EB
private

Definition at line 22 of file PhoAnyPFIsoWithEAAndExpoScalingEBCut.cc.

Referenced by operator()().

◆ _effectiveAreas

EffectiveAreas PhoAnyPFIsoWithEAAndExpoScalingEBCut::_effectiveAreas
private

Definition at line 29 of file PhoAnyPFIsoWithEAAndExpoScalingEBCut.cc.

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

◆ _rhoHandle

edm::Handle<double> PhoAnyPFIsoWithEAAndExpoScalingEBCut::_rhoHandle
private

Definition at line 33 of file PhoAnyPFIsoWithEAAndExpoScalingEBCut.cc.

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

◆ _useRelativeIso

bool PhoAnyPFIsoWithEAAndExpoScalingEBCut::_useRelativeIso
private

Definition at line 27 of file PhoAnyPFIsoWithEAAndExpoScalingEBCut.cc.

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

◆ anyPFIsoWithEA_

constexpr char PhoAnyPFIsoWithEAAndExpoScalingEBCut::anyPFIsoWithEA_ = "anyPFIsoWithEA"
staticconstexprprivate

◆ rhoString_

constexpr char PhoAnyPFIsoWithEAAndExpoScalingEBCut::rhoString_ = "rho"
staticconstexprprivate
CutApplicatorBase::PHOTON
Definition: CutApplicatorBase.h:47
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
PhoAnyPFIsoWithEAAndExpoScalingEBCut::_rhoHandle
edm::Handle< double > _rhoHandle
Definition: PhoAnyPFIsoWithEAAndExpoScalingEBCut.cc:33
PhoAnyPFIsoWithEAAndExpoScalingEBCut::rhoString_
constexpr static char rhoString_[]
Definition: PhoAnyPFIsoWithEAAndExpoScalingEBCut.cc:36
HLT_2018_cff.rhoTag
rhoTag
Definition: HLT_2018_cff.py:13606
PhoAnyPFIsoWithEAAndExpoScalingEBCut::_C2_EE
float _C2_EE
Definition: PhoAnyPFIsoWithEAAndExpoScalingEBCut.cc:24
PhoAnyPFIsoWithEAAndExpoScalingEBCut::_useRelativeIso
bool _useRelativeIso
Definition: PhoAnyPFIsoWithEAAndExpoScalingEBCut.cc:27
PhoAnyPFIsoWithEAAndExpoScalingEBCut::_C1_EB
float _C1_EB
Definition: PhoAnyPFIsoWithEAAndExpoScalingEBCut.cc:20
CutApplicatorWithEventContentBase::contentTags_
std::unordered_map< std::string, edm::InputTag > contentTags_
Definition: CutApplicatorWithEventContentBase.h:35
edm::FileInPath
Definition: FileInPath.h:64
PhoAnyPFIsoWithEAAndExpoScalingEBCut::_C3_EB
float _C3_EB
Definition: PhoAnyPFIsoWithEAAndExpoScalingEBCut.cc:22
PhoAnyPFIsoWithEAAndExpoScalingEBCut::_C2_EB
float _C2_EB
Definition: PhoAnyPFIsoWithEAAndExpoScalingEBCut.cc:21
DDAxes::rho
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
CutApplicatorWithEventContentBase::CutApplicatorWithEventContentBase
CutApplicatorWithEventContentBase()
Definition: CutApplicatorWithEventContentBase.h:21
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
PhoAnyPFIsoWithEAAndExpoScalingEBCut::_anyPFIsoMap
edm::Handle< edm::ValueMap< float > > _anyPFIsoMap
Definition: PhoAnyPFIsoWithEAAndExpoScalingEBCut.cc:31
edm::ValueMap::begin
const_iterator begin() const
Definition: ValueMap.h:229
cand
Definition: decayParser.h:34
pat
Definition: HeavyIon.h:7
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
cc
edm::Ptr
Definition: AssociationVector.h:31
edm::ValueMap::idSize
size_t idSize() const
Definition: ValueMap.h:157
edm::ValueMap< float >
ev
bool ev
Definition: Hydjet2Hadronizer.cc:95
CutApplicatorWithEventContentBase::contentTokens_
std::unordered_map< std::string, edm::EDGetToken > contentTokens_
Definition: CutApplicatorWithEventContentBase.h:40
EffectiveAreas::getEffectiveArea
const float getEffectiveArea(float eta) const
Definition: EffectiveAreas.cc:44
PhoAnyPFIsoWithEAAndExpoScalingEBCut::anyPFIsoWithEA_
constexpr static char anyPFIsoWithEA_[]
Definition: PhoAnyPFIsoWithEAAndExpoScalingEBCut.cc:35
edm::ValueMap::contains
bool contains(ProductID id) const
Definition: ValueMap.h:155
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
JetChargeProducer_cfi.exp
exp
Definition: JetChargeProducer_cfi.py:6
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
PhoAnyPFIsoWithEAAndExpoScalingEBCut::_barrelCutOff
float _barrelCutOff
Definition: PhoAnyPFIsoWithEAAndExpoScalingEBCut.cc:26
PhoAnyPFIsoWithEAAndExpoScalingEBCut::_C1_EE
float _C1_EE
Definition: PhoAnyPFIsoWithEAAndExpoScalingEBCut.cc:23
edm::InputTag
Definition: InputTag.h:15
edm::ProductID
Definition: ProductID.h:27
PhoAnyPFIsoWithEAAndExpoScalingEBCut::_effectiveAreas
EffectiveAreas _effectiveAreas
Definition: PhoAnyPFIsoWithEAAndExpoScalingEBCut.cc:29