CMS 3D CMS Logo

ECALMultifitAnalyzer_HI.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: DQMOffline/ECALMultifitAnalyzer_HI
4 // Class: ECALMultifitAnalyzer_HI
5 //
12 //
13 // Original Author: R. Alex Barbieri
14 // Created: Tue, 17 Nov 2015 17:18:50 GMT
15 // Modified for DQM: Raghav Kunnawalkam Elayavalli
16 // Wednesday 18 Nov 2015 9:45:AM GVA time
17 //
18 //
19 
20 // system include files
21 #include <memory>
22 #include <vector>
23 
24 // user include files
28 
31 
33 
37 
43 
48 
50 
51 #include "TH2F.h"
52 
53 //
54 // class declaration
55 //
56 
58 public:
61 
62 private:
63  void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override;
64  void analyze(const edm::Event &, const edm::EventSetup &) override;
65 
71 
77 
90 
103 };
104 
105 //
106 // constructors and destructor
107 //
109  : recoPhotonsCollection_(consumes<std::vector<reco::Photon>>(iConfig.getParameter<edm::InputTag>("recoPhotonSrc"))),
110  caloJetToken_(consumes<reco::CaloJetCollection>(iConfig.getParameter<edm::InputTag>("recoJetSrc"))),
111  RecHitCollection_EB_(consumes<EcalRecHitCollection>(iConfig.getParameter<edm::InputTag>("RecHitCollection_EB"))),
112  RecHitCollection_EE_(consumes<EcalRecHitCollection>(iConfig.getParameter<edm::InputTag>("RecHitCollection_EE"))),
113  geomH(esConsumes()),
114  mRechitEnergyThreshold(iConfig.getParameter<double>("rechitEnergyThreshold")),
115  mRecoPhotonPtThreshold(iConfig.getParameter<double>("recoPhotonPtThreshold")),
116  mRecoJetPtThreshold(iConfig.getParameter<double>("recoJetPtThreshold")),
117  mDeltaRPhotonThreshold(iConfig.getParameter<double>("deltaRPhotonThreshold")),
118  mDeltaRJetThreshold(iConfig.getParameter<double>("deltaRJetThreshold")) {}
119 
120 //
121 // member functions
122 //
123 
124 // ------------ method called for each event ------------
126  using namespace edm;
127 
128  const CaloGeometry *geom = &iSetup.getData(geomH);
129 
130  Handle<std::vector<reco::Photon>> recoPhotonsHandle;
131  iEvent.getByToken(recoPhotonsCollection_, recoPhotonsHandle);
132 
133  Handle<reco::CaloJetCollection> recoJetHandle;
134  iEvent.getByToken(caloJetToken_, recoJetHandle);
135 
137  iEvent.getByToken(RecHitCollection_EB_, ebHandle);
138 
140  iEvent.getByToken(RecHitCollection_EE_, eeHandle);
141 
142  for (EcalRecHitCollection::const_iterator hit = ebHandle->begin(); hit != ebHandle->end(); ++hit) {
143  eb_chi2->Fill(hit->chi2());
144  eb_errors->Fill(hit->energyError());
145  double eta = geom->getGeometry(hit->detid())->getPosition().eta();
146  double phi = geom->getGeometry(hit->detid())->getPosition().phi();
147  eb_chi2_eta->Fill(eta, hit->chi2());
148  eb_errors_eta->Fill(eta, hit->energyError());
149  if (hit->energy() > mRechitEnergyThreshold) {
150  eb_chi2_e5->Fill(hit->chi2());
151  eb_errors_e5->Fill(hit->energyError());
152  eb_chi2_e5_eta->Fill(eta, hit->chi2());
153  eb_errors_e5_eta->Fill(eta, hit->energyError());
154  }
155 
156  for (std::vector<reco::Photon>::const_iterator pho = recoPhotonsHandle->begin(); pho != recoPhotonsHandle->end();
157  ++pho) {
158  if (pho->et() < mRecoPhotonPtThreshold)
159  continue;
160  double dr = reco::deltaR(eta, phi, pho->eta(), pho->phi());
161  if (dr < mDeltaRPhotonThreshold) {
162  eb_chi2_photon15->Fill(hit->chi2());
163  eb_errors_photon15->Fill(hit->energyError());
164  }
165  }
166  for (std::vector<reco::CaloJet>::const_iterator jet = recoJetHandle->begin(); jet != recoJetHandle->end(); ++jet) {
167  if (jet->pt() < mRecoJetPtThreshold)
168  continue;
169  double dr = reco::deltaR(eta, phi, jet->eta(), jet->phi());
170  if (dr < mDeltaRJetThreshold) {
171  eb_chi2_jet30->Fill(hit->chi2());
172  eb_errors_jet30->Fill(hit->energyError());
173  }
174  }
175  }
176 
177  for (EcalRecHitCollection::const_iterator hit = eeHandle->begin(); hit != eeHandle->end(); ++hit) {
178  ee_chi2->Fill(hit->chi2());
179  ee_errors->Fill(hit->energyError());
180  double eta = geom->getGeometry(hit->detid())->getPosition().eta();
181  double phi = geom->getGeometry(hit->detid())->getPosition().phi();
182  ee_chi2_eta->Fill(eta, hit->chi2());
183  ee_errors_eta->Fill(eta, hit->energyError());
184  if (hit->energy() > mRechitEnergyThreshold) {
185  ee_chi2_e5->Fill(hit->chi2());
186  ee_errors_e5->Fill(hit->energyError());
187  ee_chi2_e5_eta->Fill(eta, hit->chi2());
188  ee_errors_e5_eta->Fill(eta, hit->energyError());
189  }
190 
191  for (std::vector<reco::Photon>::const_iterator pho = recoPhotonsHandle->begin(); pho != recoPhotonsHandle->end();
192  ++pho) {
193  if (pho->et() < mRecoPhotonPtThreshold)
194  continue;
195  double dr = reco::deltaR(eta, phi, pho->eta(), pho->phi());
196  if (dr < mDeltaRPhotonThreshold) {
197  ee_chi2_photon15->Fill(hit->chi2());
198  ee_errors_photon15->Fill(hit->energyError());
199  }
200  }
201  for (std::vector<reco::CaloJet>::const_iterator jet = recoJetHandle->begin(); jet != recoJetHandle->end(); ++jet) {
202  if (jet->pt() < mRecoJetPtThreshold)
203  continue;
204  double dr = reco::deltaR(eta, phi, jet->eta(), jet->phi());
205  if (dr < mDeltaRJetThreshold) {
206  ee_chi2_jet30->Fill(hit->chi2());
207  ee_errors_jet30->Fill(hit->energyError());
208  }
209  }
210  }
211 }
212 
213 // ------------ method called once each job just before starting event loop
214 // ------------
216  iBooker.setCurrentFolder("EcalCalibration/HIN_MultiFitAnalyzer");
217 
218  eb_chi2 = nullptr;
219  eb_chi2_eta = nullptr;
220  eb_chi2_e5 = nullptr;
221  eb_chi2_e5_eta = nullptr;
222  eb_errors = nullptr;
223  eb_errors_eta = nullptr;
224  eb_errors_e5 = nullptr;
225  eb_errors_e5_eta = nullptr;
226  eb_chi2_photon15 = nullptr;
227  eb_errors_photon15 = nullptr;
228  eb_chi2_jet30 = nullptr;
229  eb_errors_jet30 = nullptr;
230 
231  ee_chi2 = nullptr;
232  ee_chi2_eta = nullptr;
233  ee_chi2_e5 = nullptr;
234  ee_chi2_e5_eta = nullptr;
235  ee_errors = nullptr;
236  ee_errors_eta = nullptr;
237  ee_errors_e5 = nullptr;
238  ee_errors_e5_eta = nullptr;
239  ee_chi2_photon15 = nullptr;
240  ee_errors_photon15 = nullptr;
241  ee_chi2_jet30 = nullptr;
242  ee_errors_jet30 = nullptr;
243 
244  const int nBins = 500;
245  const float maxChi2 = 70;
246  const float maxError = 0.5;
247 
248  TH2F *hProfile_Chi2 = new TH2F("hProfile_Chi2", "", nBins, -5, 5, nBins, 0, maxChi2);
249  TH2F *hProfile_Err = new TH2F("hProfile_Err", "", nBins, -5, 5, nBins, 0, maxError);
250 
251  eb_chi2 = iBooker.book1D("rechit_eb_chi2", "Rechit eb_chi2;chi2 fit value;", nBins, 0, maxChi2);
252  eb_chi2_eta = iBooker.book2D("rechit_eb_eta_Vs_mean_Chi2", hProfile_Chi2);
253  eb_chi2_e5 = iBooker.book1D(Form("rechit_eb_chi2_e%2.0f", mRechitEnergyThreshold),
254  Form("Rechit eb_chi2, e>%2.0fGeV;chi2 fit value;", mRechitEnergyThreshold),
255  nBins,
256  0,
257  maxChi2);
258  eb_chi2_e5_eta = iBooker.book2D(Form("rechit_eb_chi2_e%2.0f_eta", mRechitEnergyThreshold), hProfile_Chi2);
259  eb_errors = iBooker.book1D("rechit_eb_errors", "Rechit eb_errors;error on the energy;", nBins, 0, maxError);
260  eb_errors_eta = iBooker.book2D("rechit_eb_errors_eta", hProfile_Err);
261  eb_errors_e5 = iBooker.book1D(Form("rechit_eb_errors_e%2.0f", mRechitEnergyThreshold),
262  "Rechit eb_errors, e>5GeV;error on the energy;",
263  nBins,
264  0,
265  maxError);
266  eb_errors_e5_eta = iBooker.book2D(Form("rechit_eb_errors_e%2.0f_eta", mRechitEnergyThreshold), hProfile_Err);
267  eb_chi2_photon15 = iBooker.book1D(Form("rechit_eb_chi2_photon%2.0f", mRecoPhotonPtThreshold),
268  "Rechit eb_chi2 near photons;chi2 fit value;",
269  nBins,
270  0,
271  maxChi2);
272  eb_errors_photon15 = iBooker.book1D(Form("rechit_eb_errors_photon%2.0f", mRecoPhotonPtThreshold),
273  "Rechit eb_errors near photons;error on the energy;",
274  nBins,
275  0,
276  maxError);
277  eb_chi2_jet30 = iBooker.book1D(Form("rechit_eb_chi2_jet%2.0f", mRecoJetPtThreshold),
278  "Rechit eb_chi2 near jets;chi2 fit value;",
279  nBins,
280  0,
281  maxChi2);
282  eb_errors_jet30 = iBooker.book1D(Form("rechit_eb_errors_jet%2.0f", mRecoJetPtThreshold),
283  "Rechit eb_errors near jets;error on the energy;",
284  nBins,
285  0,
286  maxError);
287 
288  ee_chi2 = iBooker.book1D("rechit_ee_chi2", "Rechit ee_chi2;chi2 fit value;", nBins, 0, maxChi2);
289  ee_chi2_eta = iBooker.book2D("rechit_ee_chi2_eta", hProfile_Chi2);
290  ee_chi2_e5 = iBooker.book1D(Form("rechit_ee_chi2_e%2.0f", mRechitEnergyThreshold),
291  "Rechit ee_chi2, e>5GeV;chi2 fit value;",
292  nBins,
293  0,
294  maxChi2);
295  ee_chi2_e5_eta = iBooker.book2D(Form("rechit_ee_chi2_e%2.0f_eta", mRechitEnergyThreshold), hProfile_Chi2);
296  ee_errors = iBooker.book1D("rechit_ee_errors", "Rechit ee_errors;error on the energy;", nBins, 0, maxError);
297  ee_errors_eta = iBooker.book2D("rechit_ee_errors_eta", hProfile_Err);
298  ee_errors_e5 = iBooker.book1D(Form("rechit_ee_errors_e%2.0f", mRechitEnergyThreshold),
299  "Rechit ee_errors, e>5GeV;error on the energy;",
300  nBins,
301  0,
302  maxError);
303  ee_errors_e5_eta = iBooker.book2D(Form("rechit_ee_errors_e%2.0f_eta", mRechitEnergyThreshold), hProfile_Err);
304  ee_chi2_photon15 = iBooker.book1D(Form("rechit_ee_chi2_photon%2.0f", mRecoPhotonPtThreshold),
305  "Rechit ee_chi2 near photons;chi2 fit value;",
306  nBins,
307  0,
308  maxChi2);
309  ee_errors_photon15 = iBooker.book1D(Form("rechit_ee_errors_photon%2.0f", mRecoPhotonPtThreshold),
310  "Rechit ee_errors near photons;error on the energy;",
311  nBins,
312  0,
313  maxError);
314  ee_chi2_jet30 = iBooker.book1D(Form("rechit_ee_chi2_jet%2.0f", mRecoJetPtThreshold),
315  "Rechit ee_chi2 near jets;chi2 fit value;",
316  nBins,
317  0,
318  maxChi2);
319  ee_errors_jet30 = iBooker.book1D(Form("rechit_ee_errors_jet%2.0f", mRecoJetPtThreshold),
320  "Rechit ee_errors near jets;error on the energy;",
321  nBins,
322  0,
323  maxError);
324 
325  delete hProfile_Chi2;
326  delete hProfile_Err;
327 }
328 
329 // define this as a plug-in
ECALMultifitAnalyzer_HI::eb_errors_photon15
MonitorElement * eb_errors_photon15
Definition: ECALMultifitAnalyzer_HI.cc:87
ECALMultifitAnalyzer_HI::ECALMultifitAnalyzer_HI
ECALMultifitAnalyzer_HI(const edm::ParameterSet &)
Definition: ECALMultifitAnalyzer_HI.cc:108
CaloJetCollection.h
ECALMultifitAnalyzer_HI::ee_chi2_jet30
MonitorElement * ee_chi2_jet30
Definition: ECALMultifitAnalyzer_HI.cc:101
ECALMultifitAnalyzer_HI::RecHitCollection_EE_
edm::EDGetTokenT< EcalRecHitCollection > RecHitCollection_EE_
Definition: ECALMultifitAnalyzer_HI.cc:69
EDAnalyzer.h
edm::SortedCollection< EcalRecHit >::const_iterator
std::vector< EcalRecHit >::const_iterator const_iterator
Definition: SortedCollection.h:80
ECALMultifitAnalyzer_HI::ee_chi2_e5_eta
MonitorElement * ee_chi2_e5_eta
Definition: ECALMultifitAnalyzer_HI.cc:94
ESHandle.h
ECALMultifitAnalyzer_HI::~ECALMultifitAnalyzer_HI
~ECALMultifitAnalyzer_HI() override
Definition: ECALMultifitAnalyzer_HI.cc:60
edm::Run
Definition: Run.h:45
edm::EDGetTokenT
Definition: EDGetToken.h:33
ECALMultifitAnalyzer_HI::eb_errors_eta
MonitorElement * eb_errors_eta
Definition: ECALMultifitAnalyzer_HI.cc:83
ECALMultifitAnalyzer_HI::recoPhotonsCollection_
edm::EDGetTokenT< std::vector< reco::Photon > > recoPhotonsCollection_
Definition: ECALMultifitAnalyzer_HI.cc:66
edm
HLT enums.
Definition: AlignableModifier.h:19
ECALMultifitAnalyzer_HI
Definition: ECALMultifitAnalyzer_HI.cc:57
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89301
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
ECALMultifitAnalyzer_HI::eb_chi2_jet30
MonitorElement * eb_chi2_jet30
Definition: ECALMultifitAnalyzer_HI.cc:88
edm::SortedCollection< EcalRecHit >
DQMStore.h
dqm::legacy::MonitorElement
Definition: MonitorElement.h:462
beam_dqm_sourceclient-live_cfg.maxChi2
maxChi2
Definition: beam_dqm_sourceclient-live_cfg.py:147
ECALMultifitAnalyzer_HI::ee_errors_jet30
MonitorElement * ee_errors_jet30
Definition: ECALMultifitAnalyzer_HI.cc:102
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:46
ECALMultifitAnalyzer_HI::ee_chi2_e5
MonitorElement * ee_chi2_e5
Definition: ECALMultifitAnalyzer_HI.cc:93
edm::Handle
Definition: AssociativeIterator.h:50
ECALMultifitAnalyzer_HI::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: ECALMultifitAnalyzer_HI.cc:125
EcalRecHitCollections.h
ECALMultifitAnalyzer_HI::eb_chi2
MonitorElement * eb_chi2
Definition: ECALMultifitAnalyzer_HI.cc:78
ECALMultifitAnalyzer_HI::ee_errors_photon15
MonitorElement * ee_errors_photon15
Definition: ECALMultifitAnalyzer_HI.cc:100
ECALMultifitAnalyzer_HI::caloJetToken_
edm::EDGetTokenT< reco::CaloJetCollection > caloJetToken_
Definition: ECALMultifitAnalyzer_HI.cc:67
MakerMacros.h
Photon.h
CaloGeometry
Definition: CaloGeometry.h:21
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
ECALMultifitAnalyzer_HI::eb_chi2_e5_eta
MonitorElement * eb_chi2_e5_eta
Definition: ECALMultifitAnalyzer_HI.cc:81
ECALMultifitAnalyzer_HI::mDeltaRJetThreshold
double mDeltaRJetThreshold
Definition: ECALMultifitAnalyzer_HI.cc:76
ECALMultifitAnalyzer_HI::ee_errors_e5_eta
MonitorElement * ee_errors_e5_eta
Definition: ECALMultifitAnalyzer_HI.cc:98
edm::SortedCollection::begin
const_iterator begin() const
Definition: SortedCollection.h:262
Service.h
PVValHelper::eta
Definition: PVValidationHelpers.h:70
dqm::impl::MonitorElement::Fill
void Fill(long long x)
Definition: MonitorElement.h:290
ECALMultifitAnalyzer_HI::eb_chi2_photon15
MonitorElement * eb_chi2_photon15
Definition: ECALMultifitAnalyzer_HI.cc:86
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
ECALMultifitAnalyzer_HI::ee_errors
MonitorElement * ee_errors
Definition: ECALMultifitAnalyzer_HI.cc:95
seedmultiplicitymonitor_newtracking_cfi.nBins
nBins
Definition: seedmultiplicitymonitor_newtracking_cfi.py:8
ECALMultifitAnalyzer_HI::ee_chi2
MonitorElement * ee_chi2
Definition: ECALMultifitAnalyzer_HI.cc:91
DQMEDAnalyzer.h
CaloGeometryRecord.h
TFileService.h
DQMEDAnalyzer
Definition: DQMEDAnalyzer.py:1
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
deltaR.h
ECALMultifitAnalyzer_HI::bookHistograms
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: ECALMultifitAnalyzer_HI.cc:215
edm::SortedCollection::end
const_iterator end() const
Definition: SortedCollection.h:267
ECALMultifitAnalyzer_HI::eb_chi2_e5
MonitorElement * eb_chi2_e5
Definition: ECALMultifitAnalyzer_HI.cc:80
Photon
Definition: Photon.py:1
ECALMultifitAnalyzer_HI::eb_chi2_eta
MonitorElement * eb_chi2_eta
Definition: ECALMultifitAnalyzer_HI.cc:79
iEvent
int iEvent
Definition: GenABIO.cc:224
reco::CaloJetCollection
std::vector< CaloJet > CaloJetCollection
collection of CaloJet objects
Definition: CaloJetCollection.h:15
ECALMultifitAnalyzer_HI::eb_errors_jet30
MonitorElement * eb_errors_jet30
Definition: ECALMultifitAnalyzer_HI.cc:89
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
ECALMultifitAnalyzer_HI::mRecoJetPtThreshold
double mRecoJetPtThreshold
Definition: ECALMultifitAnalyzer_HI.cc:74
edm::EventSetup
Definition: EventSetup.h:58
ECALMultifitAnalyzer_HI::mDeltaRPhotonThreshold
double mDeltaRPhotonThreshold
Definition: ECALMultifitAnalyzer_HI.cc:75
ECALMultifitAnalyzer_HI::eb_errors_e5
MonitorElement * eb_errors_e5
Definition: ECALMultifitAnalyzer_HI.cc:84
ECALMultifitAnalyzer_HI::ee_chi2_eta
MonitorElement * ee_chi2_eta
Definition: ECALMultifitAnalyzer_HI.cc:92
edm::ESGetToken< CaloGeometry, CaloGeometryRecord >
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:127
CaloTopology.h
DDAxes::phi
ECALMultifitAnalyzer_HI::ee_errors_e5
MonitorElement * ee_errors_e5
Definition: ECALMultifitAnalyzer_HI.cc:97
ECALMultifitAnalyzer_HI::RecHitCollection_EB_
edm::EDGetTokenT< EcalRecHitCollection > RecHitCollection_EB_
Definition: ECALMultifitAnalyzer_HI.cc:68
CaloTopologyRecord.h
CaloCellGeometry.h
std
Definition: JetResolutionObject.h:76
Frameworkfwd.h
metsig::jet
Definition: SignAlgoResolutions.h:47
dqm::implementation::IBooker::book2D
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:177
flavorHistoryFilter_cfi.dr
dr
Definition: flavorHistoryFilter_cfi.py:37
CaloGeometry.h
ECALMultifitAnalyzer_HI::geomH
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > geomH
Definition: ECALMultifitAnalyzer_HI.cc:70
ECALMultifitAnalyzer_HI::eb_errors
MonitorElement * eb_errors
Definition: ECALMultifitAnalyzer_HI.cc:82
ECALMultifitAnalyzer_HI::mRecoPhotonPtThreshold
double mRecoPhotonPtThreshold
Definition: ECALMultifitAnalyzer_HI.cc:73
reco::deltaR
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:30
ECALMultifitAnalyzer_HI::ee_errors_eta
MonitorElement * ee_errors_eta
Definition: ECALMultifitAnalyzer_HI.cc:96
dqm::implementation::IBooker
Definition: DQMStore.h:43
ECALMultifitAnalyzer_HI::ee_chi2_photon15
MonitorElement * ee_chi2_photon15
Definition: ECALMultifitAnalyzer_HI.cc:99
ParameterSet.h
DeDxTools::esConsumes
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
edm::Event
Definition: Event.h:73
ECALMultifitAnalyzer_HI::mRechitEnergyThreshold
double mRechitEnergyThreshold
Definition: ECALMultifitAnalyzer_HI.cc:72
hit
Definition: SiStripHitEffFromCalibTree.cc:88
dqm::implementation::IBooker::book1D
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
ECALMultifitAnalyzer_HI::eb_errors_e5_eta
MonitorElement * eb_errors_e5_eta
Definition: ECALMultifitAnalyzer_HI.cc:85