File indexing completed on 2024-04-06 12:10:12
0001 #include "DQMServices/Examples/interface/DQMExample_Step2.h"
0002 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0003
0004 #include <cmath>
0005 #include <cstdio>
0006 #include <iomanip>
0007 #include <iostream>
0008 #include <sstream>
0009 #include <string>
0010
0011
0012
0013
0014
0015 DQMExample_Step2::DQMExample_Step2(const edm::ParameterSet &ps) {
0016 edm::LogInfo("DQMExample_Step2") << "Constructor DQMExample_Step2::DQMExample_Step2 " << std::endl;
0017
0018
0019 numMonitorName_ = ps.getParameter<std::string>("numMonitorName");
0020 denMonitorName_ = ps.getParameter<std::string>("denMonitorName");
0021 }
0022
0023
0024
0025
0026 DQMExample_Step2::~DQMExample_Step2() {
0027 edm::LogInfo("DQMExample_Step2") << "Destructor DQMExample_Step2::~DQMExample_Step2 " << std::endl;
0028 }
0029
0030
0031
0032
0033
0034 void DQMExample_Step2::beginJob() { edm::LogInfo("DQMExample_Step2") << "DQMExample_Step2::beginJob " << std::endl; }
0035
0036
0037
0038
0039 void DQMExample_Step2::dqmEndJob(DQMStore::IBooker &ibooker_, DQMStore::IGetter &igetter_) {
0040
0041 ibooker_.setCurrentFolder("What_I_do_in_the_client/Ratio");
0042
0043
0044 MonitorElement *numerator = igetter_.get(numMonitorName_);
0045 MonitorElement *denominator = igetter_.get(denMonitorName_);
0046
0047 if (!numerator || !denominator) {
0048 edm::LogError("DQMExample_Step2") << "MEs not found!" << std::endl;
0049 return;
0050 }
0051
0052
0053 h_ptRatio = ibooker_.book1D("ptRatio", "pt ratio pf matched objects", 50, 0., 100.);
0054 h_ptRatio->setAxisTitle("pt [GeV]");
0055
0056 for (int iBin = 1; iBin < numerator->getNbinsX(); ++iBin) {
0057 if (denominator->getBinContent(iBin) == 0)
0058 h_ptRatio->setBinContent(iBin, 0.);
0059 else
0060 h_ptRatio->setBinContent(iBin, numerator->getBinContent(iBin) / denominator->getBinContent(iBin));
0061 }
0062 }
0063
0064
0065
0066
0067
0068 void DQMExample_Step2::dqmEndLuminosityBlock(DQMStore::IBooker &ibooker_,
0069 DQMStore::IGetter &igetter_,
0070 edm::LuminosityBlock const &iLumi,
0071 edm::EventSetup const &iSetup) {
0072 edm::LogInfo("DQMExample_Step2") << "DQMExample_Step2::endLumi " << std::endl;
0073 }