CMS 3D CMS Logo

Skim_MonoPhotonSkimmer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: MonoPhotonSkimmer
4 // Class: MonoPhotonSkimmer
5 //
13 //
14 // Original Author: Jie Chen
15 // Created: Wed Nov 17 14:33:08 CST 2010
16 //
17 //
18 
19 // system include files
20 #include <memory>
21 
22 // user include files
25 
28 
35 #include <string>
36 
37 //
38 // class declaration
39 //
40 
42 public:
43  explicit MonoPhotonSkimmer(const edm::ParameterSet&);
44  ~MonoPhotonSkimmer() override;
45 
46 private:
47  void beginJob() override;
48  bool filter(edm::Event&, const edm::EventSetup&) override;
49  void endJob() override;
50 
51  // ----------member data ---------------------------
53  bool _selectEE; //Do you want to select EE photons?
54  //True enables this.
55 
56  double _ecalisoOffsetEB; //Photon Preselection has linearized cuts.
57  double _ecalisoSlopeEB; //slope * photonpt + offset is the isolation
58  //threshold. This is ECAL EB.
59 
60  double _hcalisoOffsetEB; //Linearized cut on HCAL towers, EB.
62 
63  double _hadoveremEB; //Flat selection cut on HadOverEM.
64 
65  double _minPhoEtEB; //Minimum Photon ET threshold, EB.
66 
67  double _trackisoOffsetEB; //Linearized cut on track isolation EB
69 
70  double _etawidthEB; //eta width for EB
71 
72  double _ecalisoOffsetEE; //As above, but separately set for EE.
76  double _hadoveremEE;
77  double _minPhoEtEE;
80  double _etawidthEE;
81 };
82 
83 //
84 // constants, enums and typedefs
85 //
86 
87 //
88 // static data member definitions
89 //
90 
91 //
92 // constructors and destructor
93 //
95  //now do what ever initialization is needed
96  _phoToken = consumes<reco::PhotonCollection>(iConfig.getParameter<edm::InputTag>("phoTag"));
97  _selectEE = iConfig.getParameter<bool>("selectEE");
98 
99  _ecalisoOffsetEB = iConfig.getParameter<double>("ecalisoOffsetEB");
100  _ecalisoSlopeEB = iConfig.getParameter<double>("ecalisoSlopeEB");
101 
102  _hcalisoOffsetEB = iConfig.getParameter<double>("hcalisoOffsetEB");
103  _hcalisoSlopeEB = iConfig.getParameter<double>("hcalisoSlopeEB");
104 
105  _hadoveremEB = iConfig.getParameter<double>("hadoveremEB");
106  _minPhoEtEB = iConfig.getParameter<double>("minPhoEtEB");
107 
108  _trackisoOffsetEB = iConfig.getParameter<double>("trackIsoOffsetEB");
109  _trackisoSlopeEB = iConfig.getParameter<double>("trackIsoSlopeEB");
110  _etawidthEB = iConfig.getParameter<double>("etaWidthEB");
111 
112  _ecalisoOffsetEE = iConfig.getParameter<double>("ecalisoOffsetEE");
113  _ecalisoSlopeEE = iConfig.getParameter<double>("ecalisoSlopeEE");
114 
115  _hcalisoOffsetEE = iConfig.getParameter<double>("hcalisoOffsetEE");
116  _hcalisoSlopeEE = iConfig.getParameter<double>("hcalisoSlopeEE");
117 
118  _hadoveremEE = iConfig.getParameter<double>("hadoveremEE");
119  _minPhoEtEE = iConfig.getParameter<double>("minPhoEtEE");
120 
121  _trackisoOffsetEE = iConfig.getParameter<double>("trackIsoOffsetEE");
122  _trackisoSlopeEE = iConfig.getParameter<double>("trackIsoSlopeEE");
123 
124  _etawidthEE = iConfig.getParameter<double>("etaWidthEE");
125 }
126 
128  // do anything here that needs to be done at desctruction time
129  // (e.g. close files, deallocate resources etc.)
130 }
131 
132 //
133 // member functions
134 //
135 
136 // ------------ method called on each new Event ------------
138  using namespace edm;
140  iEvent.getByToken(_phoToken, photonColl);
141  const reco::PhotonCollection* photons = photonColl.product();
142  //Iterate over photon collection.
143  // std::vector<reco::Photon> PreselPhotons;
144  int PreselPhotons = 0;
145  reco::PhotonCollection::const_iterator pho;
146  for (pho = (*photons).begin(); pho != (*photons).end(); pho++) {
147  if (!pho->isEB() && !_selectEE)
148  continue;
149 
150  double ecalisocut = 0;
151  double hcalisocut = 0;
152  double hadoverem = 0;
153  double minphoet = 0;
154  double trackiso = 0;
155  double etawidth = 0;
156  if (pho->isEB()) {
157  ecalisocut = _ecalisoOffsetEB + _ecalisoSlopeEB * pho->pt();
158  hcalisocut = _hcalisoOffsetEB + _hcalisoSlopeEB * pho->pt();
159  hadoverem = _hadoveremEB;
160  minphoet = _minPhoEtEB;
161  trackiso = _trackisoOffsetEB + _trackisoSlopeEB * pho->pt();
162  etawidth = _etawidthEB;
163  } else {
164  ecalisocut = _ecalisoOffsetEE + _ecalisoSlopeEE * pho->pt();
165  hcalisocut = _hcalisoOffsetEE + _hcalisoSlopeEE * pho->pt();
166  hadoverem = _hadoveremEE;
167  minphoet = _minPhoEtEE;
168  trackiso = _trackisoOffsetEE + _trackisoSlopeEE * pho->pt();
169  etawidth = _etawidthEE;
170  }
171 
172  if (pho->ecalRecHitSumEtConeDR04() < ecalisocut && pho->hcalTowerSumEtConeDR04() < hcalisocut &&
173  pho->hadronicOverEm() < hadoverem && pho->pt() > minphoet && pho->trkSumPtHollowConeDR04() < trackiso &&
174  pho->sigmaIetaIeta() < etawidth)
175  PreselPhotons++;
176 
177  } //Loop over Photons
178  if (PreselPhotons > 0)
179  return true;
180  return false;
181 }
182 
183 // ------------ method called once each job just before starting event loop ------------
185 
186 // ------------ method called once each job just after ending the event loop ------------
188 
189 //define this as a plug-in
MonoPhotonSkimmer::filter
bool filter(edm::Event &, const edm::EventSetup &) override
Definition: Skim_MonoPhotonSkimmer.cc:137
edm::Handle::product
T const * product() const
Definition: Handle.h:70
MonoPhotonSkimmer::_ecalisoOffsetEB
double _ecalisoOffsetEB
Definition: Skim_MonoPhotonSkimmer.cc:56
edm::EDGetTokenT< reco::PhotonCollection >
edm
HLT enums.
Definition: AlignableModifier.h:19
MonoPhotonSkimmer::_hcalisoOffsetEB
double _hcalisoOffsetEB
Definition: Skim_MonoPhotonSkimmer.cc:60
EDFilter.h
MonoPhotonSkimmer::_hcalisoOffsetEE
double _hcalisoOffsetEE
Definition: Skim_MonoPhotonSkimmer.cc:74
MonoPhotonSkimmer::_trackisoSlopeEB
double _trackisoSlopeEB
Definition: Skim_MonoPhotonSkimmer.cc:68
PhotonFwd.h
MonoPhotonSkimmer::_phoToken
edm::EDGetTokenT< reco::PhotonCollection > _phoToken
Definition: Skim_MonoPhotonSkimmer.cc:52
MonoPhotonSkimmer::_hadoveremEB
double _hadoveremEB
Definition: Skim_MonoPhotonSkimmer.cc:63
edm::Handle< reco::PhotonCollection >
MonoPhotonSkimmer::_minPhoEtEB
double _minPhoEtEB
Definition: Skim_MonoPhotonSkimmer.cc:65
MakerMacros.h
Photon.h
Track.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
MonoPhotonSkimmer::_ecalisoOffsetEE
double _ecalisoOffsetEE
Definition: Skim_MonoPhotonSkimmer.cc:72
MonoPhotonSkimmer::_minPhoEtEE
double _minPhoEtEE
Definition: Skim_MonoPhotonSkimmer.cc:77
MonoPhotonSkimmer::endJob
void endJob() override
Definition: Skim_MonoPhotonSkimmer.cc:187
MonoPhotonSkimmer::~MonoPhotonSkimmer
~MonoPhotonSkimmer() override
Definition: Skim_MonoPhotonSkimmer.cc:127
MonoPhotonSkimmer::_trackisoSlopeEE
double _trackisoSlopeEE
Definition: Skim_MonoPhotonSkimmer.cc:79
MonoPhotonSkimmer::MonoPhotonSkimmer
MonoPhotonSkimmer(const edm::ParameterSet &)
Definition: Skim_MonoPhotonSkimmer.cc:94
edm::ParameterSet
Definition: ParameterSet.h:36
Event.h
MonoPhotonSkimmer::_hcalisoSlopeEB
double _hcalisoSlopeEB
Definition: Skim_MonoPhotonSkimmer.cc:61
iEvent
int iEvent
Definition: GenABIO.cc:224
MonoPhotonSkimmer::_etawidthEB
double _etawidthEB
Definition: Skim_MonoPhotonSkimmer.cc:70
edm::EDFilter
Definition: EDFilter.h:39
BPHMonitor_cfi.photons
photons
Definition: BPHMonitor_cfi.py:91
edm::EventSetup
Definition: EventSetup.h:57
MonoPhotonSkimmer::_trackisoOffsetEB
double _trackisoOffsetEB
Definition: Skim_MonoPhotonSkimmer.cc:67
MonoPhotonSkimmer::_hcalisoSlopeEE
double _hcalisoSlopeEE
Definition: Skim_MonoPhotonSkimmer.cc:75
InputTag.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Frameworkfwd.h
MonoPhotonSkimmer::_trackisoOffsetEE
double _trackisoOffsetEE
Definition: Skim_MonoPhotonSkimmer.cc:78
MonoPhotonSkimmer
Definition: Skim_MonoPhotonSkimmer.cc:41
reco::PhotonCollection
std::vector< Photon > PhotonCollection
collectin of Photon objects
Definition: PhotonFwd.h:9
View.h
ParameterSet.h
MonoPhotonSkimmer::_hadoveremEE
double _hadoveremEE
Definition: Skim_MonoPhotonSkimmer.cc:76
MonoPhotonSkimmer::_ecalisoSlopeEE
double _ecalisoSlopeEE
Definition: Skim_MonoPhotonSkimmer.cc:73
edm::Event
Definition: Event.h:73
MonoPhotonSkimmer::_selectEE
bool _selectEE
Definition: Skim_MonoPhotonSkimmer.cc:53
MonoPhotonSkimmer::_ecalisoSlopeEB
double _ecalisoSlopeEB
Definition: Skim_MonoPhotonSkimmer.cc:57
edm::InputTag
Definition: InputTag.h:15
MonoPhotonSkimmer::beginJob
void beginJob() override
Definition: Skim_MonoPhotonSkimmer.cc:184
MonoPhotonSkimmer::_etawidthEE
double _etawidthEE
Definition: Skim_MonoPhotonSkimmer.cc:80