CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes | Static Private Attributes
PhoAnyPFIsoWithEAAndQuadScalingCut Class Reference
Inheritance diagram for PhoAnyPFIsoWithEAAndQuadScalingCut:
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
 
 PhoAnyPFIsoWithEAAndQuadScalingCut (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 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
 
float _C3_EE
 
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 PhoAnyPFIsoWithEAAndQuadScalingCut.cc.

Constructor & Destructor Documentation

PhoAnyPFIsoWithEAAndQuadScalingCut::PhoAnyPFIsoWithEAAndQuadScalingCut ( const edm::ParameterSet c)

Definition at line 50 of file PhoAnyPFIsoWithEAAndQuadScalingCut.cc.

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

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

Member Function Documentation

CandidateType PhoAnyPFIsoWithEAAndQuadScalingCut::candidateType ( ) const
inlinefinalvirtual

Reimplemented from CutApplicatorBase.

Definition at line 17 of file PhoAnyPFIsoWithEAAndQuadScalingCut.cc.

References CutApplicatorBase::PHOTON.

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

Reimplemented from CutApplicatorBase.

Definition at line 87 of file PhoAnyPFIsoWithEAAndQuadScalingCut.cc.

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

Referenced by getEventContent().

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

Implements candidate_functions::CandidateCut.

Definition at line 134 of file PhoAnyPFIsoWithEAAndQuadScalingCut.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(), SiStripPI::max, EnergyCorrector::pt, reco::LeafCandidate::pt(), rho, AlCaHLTBitMon_QueryRunRegistry::string, reco::Photon::superCluster(), and pat::PATObject< ObjectType >::userFloat().

Referenced by operator()().

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

Member Data Documentation

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

Definition at line 35 of file PhoAnyPFIsoWithEAAndQuadScalingCut.cc.

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

float PhoAnyPFIsoWithEAAndQuadScalingCut::_barrelCutOff
private

Definition at line 30 of file PhoAnyPFIsoWithEAAndQuadScalingCut.cc.

Referenced by operator()().

float PhoAnyPFIsoWithEAAndQuadScalingCut::_C1_EB
private

Definition at line 23 of file PhoAnyPFIsoWithEAAndQuadScalingCut.cc.

Referenced by operator()().

float PhoAnyPFIsoWithEAAndQuadScalingCut::_C1_EE
private

Definition at line 26 of file PhoAnyPFIsoWithEAAndQuadScalingCut.cc.

Referenced by operator()().

float PhoAnyPFIsoWithEAAndQuadScalingCut::_C2_EB
private

Definition at line 24 of file PhoAnyPFIsoWithEAAndQuadScalingCut.cc.

Referenced by operator()().

float PhoAnyPFIsoWithEAAndQuadScalingCut::_C2_EE
private

Definition at line 27 of file PhoAnyPFIsoWithEAAndQuadScalingCut.cc.

Referenced by operator()().

float PhoAnyPFIsoWithEAAndQuadScalingCut::_C3_EB
private

Definition at line 25 of file PhoAnyPFIsoWithEAAndQuadScalingCut.cc.

Referenced by operator()().

float PhoAnyPFIsoWithEAAndQuadScalingCut::_C3_EE
private

Definition at line 28 of file PhoAnyPFIsoWithEAAndQuadScalingCut.cc.

Referenced by operator()().

EffectiveAreas PhoAnyPFIsoWithEAAndQuadScalingCut::_effectiveAreas
private

Definition at line 33 of file PhoAnyPFIsoWithEAAndQuadScalingCut.cc.

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

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

Definition at line 37 of file PhoAnyPFIsoWithEAAndQuadScalingCut.cc.

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

bool PhoAnyPFIsoWithEAAndQuadScalingCut::_useRelativeIso
private

Definition at line 31 of file PhoAnyPFIsoWithEAAndQuadScalingCut.cc.

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

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