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 override final
 
void getEventContent (const edm::EventBase &) override final
 
result_type operator() (const reco::PhotonPtr &) const override final
 
 PhoAnyPFIsoWithEAAndExpoScalingEBCut (const edm::ParameterSet &c)
 
void setConsumes (edm::ConsumesCollector &) override final
 
double value (const reco::CandidatePtr &cand) const override final
 
- Public Member Functions inherited from CutApplicatorWithEventContentBase
 CutApplicatorWithEventContentBase ()
 
 CutApplicatorWithEventContentBase (const edm::ParameterSet &c)
 
 CutApplicatorWithEventContentBase (const CutApplicatorWithEventContentBase &)=delete
 
CutApplicatorWithEventContentBaseoperator= (const CutApplicatorWithEventContentBase &)=delete
 
virtual ~CutApplicatorWithEventContentBase ()
 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
 
virtual const std::string & name () const
 
virtual result_type operator() (const argument_type &) const final
 
virtual result_type operator() (const reco::GsfElectronPtr &) const
 
virtual result_type operator() (const pat::ElectronPtr &) 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
 
virtual ~CutApplicatorBase ()
 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

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

Additional Inherited Members

- Public Types inherited from CutApplicatorBase
enum  CandidateType {
  NONE, ELECTRON, MUON, PHOTON,
  TAU, PATELECTRON, PATMUON, PATPHOTON,
  PATTAU
}
 
- 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 PhoAnyPFIsoWithEAAndExpoScalingEBCut.cc.

Constructor & Destructor Documentation

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

Definition at line 49 of file PhoAnyPFIsoWithEAAndExpoScalingEBCut.cc.

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

49  :
51  _C1_EB(c.getParameter<double>("C1_EB")),
52  _C2_EB(c.getParameter<double>("C2_EB")),
53  _C3_EB(c.getParameter<double>("C3_EB")),
54  _C1_EE(c.getParameter<double>("C1_EE")),
55  _C2_EE(c.getParameter<double>("C2_EE")),
56  _barrelCutOff(c.getParameter<double>("barrelCutOff")),
57  _useRelativeIso(c.getParameter<bool>("useRelativeIso")),
58  _effectiveAreas( (c.getParameter<edm::FileInPath>("effAreasConfigFile")).fullPath())
59 {
60 
61  edm::InputTag maptag = c.getParameter<edm::InputTag>("anyPFIsoMap");
62  contentTags_.emplace(anyPFIsoWithEA_,maptag);
63 
65  contentTags_.emplace(rhoString_,rhoTag);
66 
67 }
T getParameter(std::string const &) const
std::unordered_map< std::string, edm::InputTag > contentTags_

Member Function Documentation

CandidateType PhoAnyPFIsoWithEAAndExpoScalingEBCut::candidateType ( ) const
inlinefinaloverridevirtual

Reimplemented from CutApplicatorBase.

Definition at line 17 of file PhoAnyPFIsoWithEAAndExpoScalingEBCut.cc.

References CutApplicatorBase::PHOTON.

17  {
18  return PHOTON;
19  }
void PhoAnyPFIsoWithEAAndExpoScalingEBCut::getEventContent ( const edm::EventBase ev)
finaloverridevirtual
CutApplicatorBase::result_type PhoAnyPFIsoWithEAAndExpoScalingEBCut::operator() ( const reco::PhotonPtr cand) const
finaloverridevirtual

Reimplemented from CutApplicatorBase.

Definition at line 85 of file PhoAnyPFIsoWithEAAndExpoScalingEBCut.cc.

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::Ptr< T >::id(), edm::ValueMap< T >::idSize(), edm::HandleBase::isValid(), edm::Ptr< T >::key(), hpstanc_transforms::max, EnergyCorrector::pt, reco::LeafCandidate::pt(), rho, AlCaHLTBitMon_QueryRunRegistry::string, reco::Photon::superCluster(), pat::PATObject< ObjectType >::userFloat(), and value().

Referenced by getEventContent().

85  {
86 
87  // in case we are by-value
88  const std::string& inst_name = contentTags_.find(anyPFIsoWithEA_)->second.instance();
90  float anyisoval = -1.0;
91  if( _anyPFIsoMap.isValid() && _anyPFIsoMap->contains( cand.id() ) ) {
92  anyisoval = (*_anyPFIsoMap)[cand];
93  } else if ( _anyPFIsoMap.isValid() && _anyPFIsoMap->idSize() == 1 &&
94  cand.id() == edm::ProductID() ) {
95  // in case we have spoofed a ptr
96  //note this must be a 1:1 valuemap (only one product input)
97  anyisoval = _anyPFIsoMap->begin()[cand.key()];
98  } else if ( _anyPFIsoMap.isValid() ){ // throw an exception
99  anyisoval = (*_anyPFIsoMap)[cand];
100  }
101 
102  // Figure out the cut value
103  // The value is generally pt-dependent: C1 + pt * C2
104  const float pt = cand->pt();
105 
106  // In this version of the isolation cut we apply
107  // exponential pt scaling to the barrel isolation cut,
108  // and linear pt scaling to the endcap isolation cut.
109  double absEta = std::abs(cand->superCluster()->eta());
110  const float isolationCutValue =
111  ( absEta < _barrelCutOff ?
112  _C1_EB + exp( pt*_C2_EB + _C3_EB)
113  : _C1_EE + pt * _C2_EE);
114 
115  // Retrieve the variable value for this particle
116  float anyPFIso = _anyPFIsoMap.isValid() ? anyisoval : pat->userFloat(inst_name);
117 
118  // Apply pile-up correction
119  double eA = _effectiveAreas.getEffectiveArea( absEta );
120  double rho = *_rhoHandle;
121  float anyPFIsoWithEA = std::max(0.0, anyPFIso - rho * eA);
122 
123  // Divide by pT if the relative isolation is requested
124  if( _useRelativeIso )
125  anyPFIsoWithEA /= pt;
126 
127  // Apply the cut and return the result
128  return anyPFIsoWithEA < isolationCutValue;
129 }
virtual double pt() const final
transverse momentum
reco::SuperClusterRef superCluster() const
Ref to SuperCluster.
key_type key() const
Definition: Ptr.h:186
const float getEffectiveArea(float eta) const
std::unordered_map< std::string, edm::InputTag > contentTags_
Definition: HeavyIon.h:7
bool contains(ProductID id) const
Definition: ValueMap.h:154
edm::Handle< edm::ValueMap< float > > _anyPFIsoMap
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bool isValid() const
Definition: HandleBase.h:74
size_t idSize() const
Definition: ValueMap.h:158
const_iterator begin() const
Definition: ValueMap.h:207
ProductID id() const
Accessor for product ID.
Definition: Ptr.h:181
void PhoAnyPFIsoWithEAAndExpoScalingEBCut::setConsumes ( edm::ConsumesCollector cc)
finaloverridevirtual
double PhoAnyPFIsoWithEAAndExpoScalingEBCut::value ( const reco::CandidatePtr cand) const
finaloverridevirtual

Implements candidate_functions::CandidateCut.

Definition at line 132 of file PhoAnyPFIsoWithEAAndExpoScalingEBCut.cc.

References _anyPFIsoMap, _effectiveAreas, _rhoHandle, _useRelativeIso, funct::abs(), anyPFIsoWithEA_, edm::ValueMap< T >::begin(), edm::ValueMap< T >::contains(), CutApplicatorWithEventContentBase::contentTags_, EffectiveAreas::getEffectiveArea(), edm::Ptr< T >::id(), edm::ValueMap< T >::idSize(), edm::HandleBase::isValid(), edm::Ptr< T >::key(), hpstanc_transforms::max, EnergyCorrector::pt, reco::LeafCandidate::pt(), rho, AlCaHLTBitMon_QueryRunRegistry::string, reco::Photon::superCluster(), and pat::PATObject< ObjectType >::userFloat().

Referenced by operator()().

132  {
133  reco::PhotonPtr pho(cand);
134 
135  // in case we are by-value
136  const std::string& inst_name = contentTags_.find(anyPFIsoWithEA_)->second.instance();
138  float anyisoval = -1.0;
139  if( _anyPFIsoMap.isValid() && _anyPFIsoMap->contains( cand.id() ) ) {
140  anyisoval = (*_anyPFIsoMap)[cand];
141  } else if ( _anyPFIsoMap.isValid() && _anyPFIsoMap->idSize() == 1 &&
142  cand.id() == edm::ProductID() ) {
143  // in case we have spoofed a ptr
144  //note this must be a 1:1 valuemap (only one product input)
145  anyisoval = _anyPFIsoMap->begin()[cand.key()];
146  } else if ( _anyPFIsoMap.isValid() ){ // throw an exception
147  anyisoval = (*_anyPFIsoMap)[cand];
148  }
149 
150  // Figure out the cut value
151  // The value is generally pt-dependent: C1 + pt * C2
152  const float pt = pho->pt();
153 
154  // In this version of the isolation cut we apply
155  // exponential pt scaling to the barrel isolation cut,
156  // and linear pt scaling to the endcap isolation cut.
157  double absEta = std::abs(pho->superCluster()->eta());
158 
159  // Retrieve the variable value for this particle
160  float anyPFIso = _anyPFIsoMap.isValid() ? anyisoval : pat->userFloat(inst_name);
161 
162  // Apply pile-up correction
163  double eA = _effectiveAreas.getEffectiveArea( absEta );
164  double rho = *_rhoHandle;
165  float anyPFIsoWithEA = std::max(0.0, anyPFIso - rho * eA);
166 
167  // Divide by pT if the relative isolation is requested
168  if( _useRelativeIso )
169  anyPFIsoWithEA /= pt;
170 
171  // Apply the cut and return the result
172  return anyPFIsoWithEA;
173 }
key_type key() const
Definition: Ptr.h:186
const float getEffectiveArea(float eta) const
std::unordered_map< std::string, edm::InputTag > contentTags_
Definition: HeavyIon.h:7
bool contains(ProductID id) const
Definition: ValueMap.h:154
edm::Handle< edm::ValueMap< float > > _anyPFIsoMap
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bool isValid() const
Definition: HandleBase.h:74
size_t idSize() const
Definition: ValueMap.h:158
const_iterator begin() const
Definition: ValueMap.h:207
ProductID id() const
Accessor for product ID.
Definition: Ptr.h:181

Member Data Documentation

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

Definition at line 34 of file PhoAnyPFIsoWithEAAndExpoScalingEBCut.cc.

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

float PhoAnyPFIsoWithEAAndExpoScalingEBCut::_barrelCutOff
private

Definition at line 29 of file PhoAnyPFIsoWithEAAndExpoScalingEBCut.cc.

Referenced by operator()().

float PhoAnyPFIsoWithEAAndExpoScalingEBCut::_C1_EB
private

Definition at line 23 of file PhoAnyPFIsoWithEAAndExpoScalingEBCut.cc.

Referenced by operator()().

float PhoAnyPFIsoWithEAAndExpoScalingEBCut::_C1_EE
private

Definition at line 26 of file PhoAnyPFIsoWithEAAndExpoScalingEBCut.cc.

Referenced by operator()().

float PhoAnyPFIsoWithEAAndExpoScalingEBCut::_C2_EB
private

Definition at line 24 of file PhoAnyPFIsoWithEAAndExpoScalingEBCut.cc.

Referenced by operator()().

float PhoAnyPFIsoWithEAAndExpoScalingEBCut::_C2_EE
private

Definition at line 27 of file PhoAnyPFIsoWithEAAndExpoScalingEBCut.cc.

Referenced by operator()().

float PhoAnyPFIsoWithEAAndExpoScalingEBCut::_C3_EB
private

Definition at line 25 of file PhoAnyPFIsoWithEAAndExpoScalingEBCut.cc.

Referenced by operator()().

EffectiveAreas PhoAnyPFIsoWithEAAndExpoScalingEBCut::_effectiveAreas
private

Definition at line 32 of file PhoAnyPFIsoWithEAAndExpoScalingEBCut.cc.

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

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

Definition at line 36 of file PhoAnyPFIsoWithEAAndExpoScalingEBCut.cc.

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

bool PhoAnyPFIsoWithEAAndExpoScalingEBCut::_useRelativeIso
private

Definition at line 30 of file PhoAnyPFIsoWithEAAndExpoScalingEBCut.cc.

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

char PhoAnyPFIsoWithEAAndExpoScalingEBCut::anyPFIsoWithEA_ = "anyPFIsoWithEA"
staticprivate
char PhoAnyPFIsoWithEAAndExpoScalingEBCut::rhoString_ = "rho"
staticprivate