CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 // $Id: MonoPhotonSkimmer.cc,v 1.1 2010/12/13 20:32:22 jiechen Exp $
17 //
18 //
19 
20 
21 // system include files
22 #include <memory>
23 
24 // user include files
27 
30 
37 #include <string>
38 
39 //
40 // class declaration
41 //
42 
44  public:
45  explicit MonoPhotonSkimmer(const edm::ParameterSet&);
47 
48  private:
49  virtual void beginJob() ;
50  virtual bool filter(edm::Event&, const edm::EventSetup&);
51  virtual void endJob() ;
52 
53  // ----------member data ---------------------------
55  bool _selectEE; //Do you want to select EE photons?
56  //True enables this.
57 
58  double _ecalisoOffsetEB; //Photon Preselection has linearized cuts.
59  double _ecalisoSlopeEB; //slope * photonpt + offset is the isolation
60  //threshold. This is ECAL EB.
61 
62  double _hcalisoOffsetEB; //Linearized cut on HCAL towers, EB.
64 
65  double _hadoveremEB; //Flat selection cut on HadOverEM.
66 
67  double _minPhoEtEB; //Minimum Photon ET threshold, EB.
68 
69  double _trackisoOffsetEB;//Linearized cut on track isolation EB
71 
72  double _etawidthEB; //eta width for EB
73 
74  double _ecalisoOffsetEE; //As above, but separately set for EE.
78  double _hadoveremEE;
79  double _minPhoEtEE;
82  double _etawidthEE;
83 };
84 
85 //
86 // constants, enums and typedefs
87 //
88 
89 //
90 // static data member definitions
91 //
92 
93 //
94 // constructors and destructor
95 //
97 {
98  //now do what ever initialization is needed
99  _phoTag = iConfig.getParameter<edm::InputTag>("phoTag");
100  _selectEE = iConfig.getParameter<bool>("selectEE");
101 
102  _ecalisoOffsetEB = iConfig.getParameter<double>("ecalisoOffsetEB");
103  _ecalisoSlopeEB = iConfig.getParameter<double>("ecalisoSlopeEB");
104 
105  _hcalisoOffsetEB = iConfig.getParameter<double>("hcalisoOffsetEB");
106  _hcalisoSlopeEB = iConfig.getParameter<double>("hcalisoSlopeEB");
107 
108  _hadoveremEB = iConfig.getParameter<double>("hadoveremEB");
109  _minPhoEtEB = iConfig.getParameter<double>("minPhoEtEB");
110 
111 
112  _trackisoOffsetEB= iConfig.getParameter<double>("trackIsoOffsetEB");
113  _trackisoSlopeEB= iConfig.getParameter<double>("trackIsoSlopeEB");
114  _etawidthEB=iConfig.getParameter<double>("etaWidthEB");
115 
116  _ecalisoOffsetEE = iConfig.getParameter<double>("ecalisoOffsetEE");
117  _ecalisoSlopeEE = iConfig.getParameter<double>("ecalisoSlopeEE");
118 
119  _hcalisoOffsetEE = iConfig.getParameter<double>("hcalisoOffsetEE");
120  _hcalisoSlopeEE = iConfig.getParameter<double>("hcalisoSlopeEE");
121 
122  _hadoveremEE = iConfig.getParameter<double>("hadoveremEE");
123  _minPhoEtEE = iConfig.getParameter<double>("minPhoEtEE");
124 
125 
126  _trackisoOffsetEE= iConfig.getParameter<double>("trackIsoOffsetEE");
127  _trackisoSlopeEE= iConfig.getParameter<double>("trackIsoSlopeEE");
128 
129  _etawidthEE= iConfig.getParameter<double>("etaWidthEE");
130 
131 }
132 
133 
135 {
136 
137  // do anything here that needs to be done at desctruction time
138  // (e.g. close files, deallocate resources etc.)
139 
140 }
141 
142 
143 //
144 // member functions
145 //
146 
147 // ------------ method called on each new Event ------------
148 bool
150 {
151  using namespace edm;
153  iEvent.getByLabel(_phoTag, photonColl);
154  const reco::PhotonCollection *photons = photonColl.product();
155  //Iterate over photon collection.
156 // std::vector<reco::Photon> PreselPhotons;
157  int PreselPhotons=0;
158  reco::PhotonCollection::const_iterator pho;
159  for (pho = (*photons).begin(); pho!= (*photons).end(); pho++){
160  if (!pho->isEB() && !_selectEE) continue;
161 
162  double ecalisocut = 0;
163  double hcalisocut = 0;
164  double hadoverem = 0;
165  double minphoet = 0;
166  double trackiso = 0;
167  double etawidth = 0;
168  if (pho->isEB()){
169  ecalisocut = _ecalisoOffsetEB + _ecalisoSlopeEB * pho->pt();
170  hcalisocut = _hcalisoOffsetEB + _hcalisoSlopeEB * pho->pt();
171  hadoverem = _hadoveremEB;
172  minphoet = _minPhoEtEB;
173  trackiso = _trackisoOffsetEB + _trackisoSlopeEB * pho->pt();
174  etawidth = _etawidthEB;
175  }
176  else{
177  ecalisocut = _ecalisoOffsetEE + _ecalisoSlopeEE * pho->pt();
178  hcalisocut = _hcalisoOffsetEE + _hcalisoSlopeEE * pho->pt();
179  hadoverem = _hadoveremEE;
180  minphoet = _minPhoEtEE;
181  trackiso = _trackisoOffsetEE + _trackisoSlopeEE * pho->pt();
182  etawidth = _etawidthEE;
183  }
184 
185  if (pho->ecalRecHitSumEtConeDR04() < ecalisocut
186  && pho->hcalTowerSumEtConeDR04() < hcalisocut
187  && pho->hadronicOverEm() < hadoverem
188  && pho->pt() > minphoet
189  && pho->trkSumPtHollowConeDR04()<trackiso
190  && pho->sigmaIetaIeta() <etawidth
191  ) PreselPhotons++;
192 
193  }//Loop over Photons
194  if (PreselPhotons > 0 ) return true;
195  return false;
196 }
197 
198 // ------------ method called once each job just before starting event loop ------------
199 void
201 {
202 }
203 
204 // ------------ method called once each job just after ending the event loop ------------
205 void
207 }
208 
209 //define this as a plug-in
T getParameter(std::string const &) const
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
virtual void beginJob()
virtual bool filter(edm::Event &, const edm::EventSetup &)
MonoPhotonSkimmer(const edm::ParameterSet &)
int iEvent
Definition: GenABIO.cc:243
edm::InputTag _phoTag
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
virtual void endJob()
std::vector< Photon > PhotonCollection
collectin of Photon objects
Definition: PhotonFwd.h:9