CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
List of all members | Public Member Functions | Private Attributes | Static Private Attributes
PhoAnyPFIsoWithEAAndExpoScalingCut Class Reference
Inheritance diagram for PhoAnyPFIsoWithEAAndExpoScalingCut:
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
 
 PhoAnyPFIsoWithEAAndExpoScalingCut (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
 
float _C3_EE
 
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 PhoAnyPFIsoWithEAAndExpoScalingCut.cc.

Constructor & Destructor Documentation

◆ PhoAnyPFIsoWithEAAndExpoScalingCut()

PhoAnyPFIsoWithEAAndExpoScalingCut::PhoAnyPFIsoWithEAAndExpoScalingCut ( const edm::ParameterSet c)

Definition at line 45 of file PhoAnyPFIsoWithEAAndExpoScalingCut.cc.

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

References anyPFIsoWithEA_, c, CutApplicatorWithEventContentBase::contentTags_, rhoString_, and HLT_FULL_cff::rhoTag.

Member Function Documentation

◆ candidateType()

CandidateType PhoAnyPFIsoWithEAAndExpoScalingCut::candidateType ( ) const
inlinefinalvirtual

Reimplemented from CutApplicatorBase.

Definition at line 16 of file PhoAnyPFIsoWithEAAndExpoScalingCut.cc.

16 { return PHOTON; }

References CutApplicatorBase::PHOTON.

◆ getEventContent()

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

◆ operator()()

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

Reimplemented from CutApplicatorBase.

Definition at line 76 of file PhoAnyPFIsoWithEAAndExpoScalingCut.cc.

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

References _anyPFIsoMap, _barrelCutOff, _C1_EB, _C1_EE, _C2_EB, _C2_EE, _C3_EB, _C3_EE, _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 PhoAnyPFIsoWithEAAndExpoScalingCut::setConsumes ( edm::ConsumesCollector cc)
finalvirtual

Implements CutApplicatorWithEventContentBase.

Definition at line 63 of file PhoAnyPFIsoWithEAAndExpoScalingCut.cc.

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

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

◆ value()

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

Implements candidate_functions::CandidateCut.

Definition at line 118 of file PhoAnyPFIsoWithEAAndExpoScalingCut.cc.

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

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> > PhoAnyPFIsoWithEAAndExpoScalingCut::_anyPFIsoMap
private

Definition at line 32 of file PhoAnyPFIsoWithEAAndExpoScalingCut.cc.

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

◆ _barrelCutOff

float PhoAnyPFIsoWithEAAndExpoScalingCut::_barrelCutOff
private

Definition at line 27 of file PhoAnyPFIsoWithEAAndExpoScalingCut.cc.

Referenced by operator()().

◆ _C1_EB

float PhoAnyPFIsoWithEAAndExpoScalingCut::_C1_EB
private

Definition at line 20 of file PhoAnyPFIsoWithEAAndExpoScalingCut.cc.

Referenced by operator()().

◆ _C1_EE

float PhoAnyPFIsoWithEAAndExpoScalingCut::_C1_EE
private

Definition at line 23 of file PhoAnyPFIsoWithEAAndExpoScalingCut.cc.

Referenced by operator()().

◆ _C2_EB

float PhoAnyPFIsoWithEAAndExpoScalingCut::_C2_EB
private

Definition at line 21 of file PhoAnyPFIsoWithEAAndExpoScalingCut.cc.

Referenced by operator()().

◆ _C2_EE

float PhoAnyPFIsoWithEAAndExpoScalingCut::_C2_EE
private

Definition at line 24 of file PhoAnyPFIsoWithEAAndExpoScalingCut.cc.

Referenced by operator()().

◆ _C3_EB

float PhoAnyPFIsoWithEAAndExpoScalingCut::_C3_EB
private

Definition at line 22 of file PhoAnyPFIsoWithEAAndExpoScalingCut.cc.

Referenced by operator()().

◆ _C3_EE

float PhoAnyPFIsoWithEAAndExpoScalingCut::_C3_EE
private

Definition at line 25 of file PhoAnyPFIsoWithEAAndExpoScalingCut.cc.

Referenced by operator()().

◆ _effectiveAreas

EffectiveAreas PhoAnyPFIsoWithEAAndExpoScalingCut::_effectiveAreas
private

Definition at line 30 of file PhoAnyPFIsoWithEAAndExpoScalingCut.cc.

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

◆ _rhoHandle

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

Definition at line 34 of file PhoAnyPFIsoWithEAAndExpoScalingCut.cc.

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

◆ _useRelativeIso

bool PhoAnyPFIsoWithEAAndExpoScalingCut::_useRelativeIso
private

Definition at line 28 of file PhoAnyPFIsoWithEAAndExpoScalingCut.cc.

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

◆ anyPFIsoWithEA_

constexpr char PhoAnyPFIsoWithEAAndExpoScalingCut::anyPFIsoWithEA_ = "anyPFIsoWithEA"
staticconstexprprivate

◆ rhoString_

constexpr char PhoAnyPFIsoWithEAAndExpoScalingCut::rhoString_ = "rho"
staticconstexprprivate
PhoAnyPFIsoWithEAAndExpoScalingCut::_C3_EE
float _C3_EE
Definition: PhoAnyPFIsoWithEAAndExpoScalingCut.cc:25
CutApplicatorBase::PHOTON
Definition: CutApplicatorBase.h:47
PhoAnyPFIsoWithEAAndExpoScalingCut::_anyPFIsoMap
edm::Handle< edm::ValueMap< float > > _anyPFIsoMap
Definition: PhoAnyPFIsoWithEAAndExpoScalingCut.cc:32
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
PhoAnyPFIsoWithEAAndExpoScalingCut::anyPFIsoWithEA_
constexpr static char anyPFIsoWithEA_[]
Definition: PhoAnyPFIsoWithEAAndExpoScalingCut.cc:36
PhoAnyPFIsoWithEAAndExpoScalingCut::_useRelativeIso
bool _useRelativeIso
Definition: PhoAnyPFIsoWithEAAndExpoScalingCut.cc:28
PhoAnyPFIsoWithEAAndExpoScalingCut::_C1_EE
float _C1_EE
Definition: PhoAnyPFIsoWithEAAndExpoScalingCut.cc:23
PhoAnyPFIsoWithEAAndExpoScalingCut::_C3_EB
float _C3_EB
Definition: PhoAnyPFIsoWithEAAndExpoScalingCut.cc:22
CutApplicatorWithEventContentBase::contentTags_
std::unordered_map< std::string, edm::InputTag > contentTags_
Definition: CutApplicatorWithEventContentBase.h:35
HLT_FULL_cff.rhoTag
rhoTag
Definition: HLT_FULL_cff.py:14993
edm::FileInPath
Definition: FileInPath.h:61
PhoAnyPFIsoWithEAAndExpoScalingCut::rhoString_
constexpr static char rhoString_[]
Definition: PhoAnyPFIsoWithEAAndExpoScalingCut.cc:37
DDAxes::rho
PhoAnyPFIsoWithEAAndExpoScalingCut::_rhoHandle
edm::Handle< double > _rhoHandle
Definition: PhoAnyPFIsoWithEAAndExpoScalingCut.cc:34
CutApplicatorWithEventContentBase::CutApplicatorWithEventContentBase
CutApplicatorWithEventContentBase()
Definition: CutApplicatorWithEventContentBase.h:21
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
PhoAnyPFIsoWithEAAndExpoScalingCut::_C1_EB
float _C1_EB
Definition: PhoAnyPFIsoWithEAAndExpoScalingCut.cc:20
edm::ValueMap::begin
const_iterator begin() const
Definition: ValueMap.h:229
cand
Definition: decayParser.h:32
PhoAnyPFIsoWithEAAndExpoScalingCut::_C2_EE
float _C2_EE
Definition: PhoAnyPFIsoWithEAAndExpoScalingCut.cc:24
PhoAnyPFIsoWithEAAndExpoScalingCut::_effectiveAreas
EffectiveAreas _effectiveAreas
Definition: PhoAnyPFIsoWithEAAndExpoScalingCut.cc:30
PhoAnyPFIsoWithEAAndExpoScalingCut::_barrelCutOff
float _barrelCutOff
Definition: PhoAnyPFIsoWithEAAndExpoScalingCut.cc:27
pat
Definition: HeavyIon.h:7
cc
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::Ptr
Definition: AssociationVector.h:31
PhoAnyPFIsoWithEAAndExpoScalingCut::_C2_EB
float _C2_EB
Definition: PhoAnyPFIsoWithEAAndExpoScalingCut.cc:21
edm::ValueMap::idSize
size_t idSize() const
Definition: ValueMap.h:157
edm::ValueMap< float >
ev
bool ev
Definition: Hydjet2Hadronizer.cc:97
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
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
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:56
JetChargeProducer_cfi.exp
exp
Definition: JetChargeProducer_cfi.py:6
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
edm::InputTag
Definition: InputTag.h:15
edm::ProductID
Definition: ProductID.h:27