CMS 3D CMS Logo

IsoPhotonEBSelector.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 // Class: ZElectronsSelector
3 //
4 // Original Author: Silvia Taroni
5 // Created: Wed, 29 Nov 2017 18:23:54 GMT
6 //
7 //
8 
10 
11 // system include files
12 
13 #include <algorithm>
14 #include <iostream>
15 #include <memory>
16 #include <string>
17 #include <vector>
18 
19 // user include files
22 
25 
27 
30 //
35 
36 using namespace std;
37 using namespace reco;
38 namespace edm {
39  class EventSetup;
40 }
41 
43 public:
45  bool operator()(const reco::Photon&) const;
46  void newEvent(const edm::Event&, const edm::EventSetup&);
47  const float getEffectiveArea(float eta) const;
48  void printEffectiveAreas() const;
49 
52 
53  const std::vector<double> absEtaMin_; // low limit of the eta range
54  const std::vector<double> absEtaMax_; // upper limit of the eta range
55  const std::vector<double> effectiveAreaValues_; // effective area for this eta range
56 
58 
59  const vector<double> sigmaIEtaIEtaCut_;
60  const vector<double> hOverECut_;
61  const vector<double> relCombIso_;
62 };
63 
65  printf(" eta_min eta_max effective area\n");
66  uint nEtaBins = absEtaMin_.size();
67  for (uint iEta = 0; iEta < nEtaBins; iEta++) {
68  printf(" %8.4f %8.4f %8.5f\n", absEtaMin_[iEta], absEtaMax_[iEta], effectiveAreaValues_[iEta]);
69  }
70 }
71 const float IsoPhotonEBSelector::getEffectiveArea(float eta) const {
72  float effArea = 0;
73  uint nEtaBins = absEtaMin_.size();
74  for (uint iEta = 0; iEta < nEtaBins; iEta++) {
75  if (std::abs(eta) >= absEtaMin_[iEta] && std::abs(eta) < absEtaMax_[iEta]) {
76  effArea = effectiveAreaValues_[iEta];
77  break;
78  }
79  }
80 
81  return effArea;
82 }
83 
85  : theRhoToken_(iC.consumes<double>(cfg.getParameter<edm::InputTag>("rho"))),
86  absEtaMin_(cfg.getParameter<std::vector<double> >("absEtaMin")),
87  absEtaMax_(cfg.getParameter<std::vector<double> >("absEtaMax")),
88  effectiveAreaValues_(cfg.getParameter<std::vector<double> >("effectiveAreaValues")),
89  phIDWP_(cfg.getParameter<edm::ParameterSet>("phID")),
90  sigmaIEtaIEtaCut_(phIDWP_.getParameter<std::vector<double> >("full5x5_sigmaIEtaIEtaCut")),
91  hOverECut_(phIDWP_.getParameter<std::vector<double> >("hOverECut")),
92  relCombIso_(phIDWP_.getParameter<std::vector<double> >("relCombIsolationWithEACut")) {
93  //printEffectiveAreas();
94 }
95 
97  ev.getByToken(theRhoToken_, rhoHandle_);
98 }
99 
101  float pt_e = ph.pt();
102  unsigned int ind = 0;
103  float abseta = fabs((ph.superCluster().get())->position().eta());
104 
105  if (ph.isEB()) {
106  if (abseta > 1.479)
107  return false; // check if it is really needed
108  }
109  if (ph.isEE()) {
110  ind = 1;
111  if (abseta <= 1.479 || abseta >= 2.5)
112  return false; // check if it is really needed
113  }
114 
115  if (ph.full5x5_sigmaIetaIeta() > sigmaIEtaIEtaCut_[ind])
116  return false;
117  if (ph.hadronicOverEm() > hOverECut_[ind])
118  return false;
119  const float eA = getEffectiveArea(abseta);
120  const float rho = rhoHandle_.isValid() ? (float)(*rhoHandle_.product()) : 0;
121  if ((ph.getPflowIsolationVariables().chargedHadronIso +
122  std::max(float(0.0),
123  ph.getPflowIsolationVariables().neutralHadronIso + ph.getPflowIsolationVariables().photonIso -
124  eA * rho)) > relCombIso_[ind] * pt_e)
125  return false;
126 
127  return true;
128 }
129 
131 
133 
#define EVENTSETUP_STD_INIT(SELECTOR)
T const * product() const
Definition: Handle.h:70
edm::Handle< double > rhoHandle_
const vector< double > hOverECut_
const edm::ParameterSet phIDWP_
const vector< double > relCombIso_
void printEffectiveAreas() const
IsoPhotonEBSelector(const edm::ParameterSet &, edm::ConsumesCollector &iC)
const std::vector< double > absEtaMin_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
bool operator()(const reco::Photon &) const
void newEvent(const edm::Event &, const edm::EventSetup &)
SingleObjectSelector< edm::View< reco::Photon >, IsoPhotonEBSelector > IsoPhotonEBSelectorAndSkim
const std::vector< double > effectiveAreaValues_
bool isValid() const
Definition: HandleBase.h:70
const float getEffectiveArea(float eta) const
fixed size matrix
HLT enums.
static int position[264][3]
Definition: ReadPGInfo.cc:289
const std::vector< double > absEtaMax_
const edm::EDGetTokenT< double > theRhoToken_
const vector< double > sigmaIEtaIEtaCut_