CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PhoAnyPFIsoWithEAAndExpoScalingEBCut.cc
Go to the documentation of this file.
4 
5 
7 public:
9 
10  result_type operator()(const reco::PhotonPtr&) const override final;
11 
12  void setConsumes(edm::ConsumesCollector&) override final;
13  void getEventContent(const edm::EventBase&) override final;
14 
15  CandidateType candidateType() const override final {
16  return PHOTON;
17  }
18 
19 private:
20  // Cut values
21  float _C1_EB;
22  float _C2_EB;
23  float _C3_EB;
24  float _C1_EE;
25  float _C2_EE;
26  // Configuration
29  // Effective area constants
31  // The isolations computed upstream
33  // The rho
35 
36  constexpr static char anyPFIsoWithEA_[] = "anyPFIsoWithEA";
37  constexpr static char rhoString_ [] = "rho";
38 };
39 
42 
45  "PhoAnyPFIsoWithEAAndExpoScalingEBCut");
46 
49  _C1_EB(c.getParameter<double>("C1_EB")),
50  _C2_EB(c.getParameter<double>("C2_EB")),
51  _C3_EB(c.getParameter<double>("C3_EB")),
52  _C1_EE(c.getParameter<double>("C1_EE")),
53  _C2_EE(c.getParameter<double>("C2_EE")),
54  _barrelCutOff(c.getParameter<double>("barrelCutOff")),
55  _useRelativeIso(c.getParameter<bool>("useRelativeIso")),
56  _effectiveAreas( (c.getParameter<edm::FileInPath>("effAreasConfigFile")).fullPath())
57 {
58 
59  edm::InputTag maptag = c.getParameter<edm::InputTag>("anyPFIsoMap");
60  contentTags_.emplace(anyPFIsoWithEA_,maptag);
61 
62  edm::InputTag rhoTag = c.getParameter<edm::InputTag>("rho");
63  contentTags_.emplace(rhoString_,rhoTag);
64 
65 }
66 
68  auto anyPFIsoWithEA =
70  contentTokens_.emplace(anyPFIsoWithEA_,anyPFIsoWithEA);
71 
72  auto rho = cc.consumes<double>(contentTags_[rhoString_]);
73  contentTokens_.emplace(rhoString_, rho);
74 }
75 
79 }
80 
81 CutApplicatorBase::result_type
83 operator()(const reco::PhotonPtr& cand) const{
84 
85  // Figure out the cut value
86  // The value is generally pt-dependent: C1 + pt * C2
87  const float pt = cand->pt();
88 
89  // In this version of the isolation cut we apply
90  // exponential pt scaling to the barrel isolation cut,
91  // and linear pt scaling to the endcap isolation cut.
92  double absEta = std::abs(cand->superCluster()->eta());
93  const float isolationCutValue =
94  ( absEta < _barrelCutOff ?
95  _C1_EB + exp( pt*_C2_EB + _C3_EB)
96  : _C1_EE + pt * _C2_EE);
97 
98  // Retrieve the variable value for this particle
99  float anyPFIso = (*_anyPFIsoMap)[cand];
100 
101  // Apply pile-up correction
102  double eA = _effectiveAreas.getEffectiveArea( absEta );
103  double rho = *_rhoHandle;
104  float anyPFIsoWithEA = std::max(0.0, anyPFIso - rho * eA);
105 
106  // Divide by pT if the relative isolation is requested
107  if( _useRelativeIso )
108  anyPFIsoWithEA /= pt;
109 
110  // Apply the cut and return the result
111  return anyPFIsoWithEA < isolationCutValue;
112 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
void setConsumes(edm::ConsumesCollector &) overridefinal
std::unordered_map< std::string, edm::EDGetToken > contentTokens_
Definition: DDAxes.h:10
bool ev
const float getEffectiveArea(float eta) const
#define constexpr
std::unordered_map< std::string, edm::InputTag > contentTags_
result_type operator()(const reco::PhotonPtr &) const overridefinal
edm::Handle< edm::ValueMap< float > > _anyPFIsoMap
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
string const
Definition: compareJSON.py:14
bool getByLabel(InputTag const &, Handle< T > &) const
Definition: EventBase.h:92
#define DEFINE_EDM_PLUGIN(factory, type, name)
void getEventContent(const edm::EventBase &) overridefinal