1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
#include "DQMServices/Examples/interface/DQMExample_Step2.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <sstream>
#include <string>
//
// -------------------------------------- Constructor
// --------------------------------------------
//
DQMExample_Step2::DQMExample_Step2(const edm::ParameterSet &ps) {
edm::LogInfo("DQMExample_Step2") << "Constructor DQMExample_Step2::DQMExample_Step2 " << std::endl;
// Get parameters from configuration file
numMonitorName_ = ps.getParameter<std::string>("numMonitorName");
denMonitorName_ = ps.getParameter<std::string>("denMonitorName");
}
//
// -- Destructor
//
DQMExample_Step2::~DQMExample_Step2() {
edm::LogInfo("DQMExample_Step2") << "Destructor DQMExample_Step2::~DQMExample_Step2 " << std::endl;
}
//
// -------------------------------------- beginJob
// --------------------------------------------
//
void DQMExample_Step2::beginJob() { edm::LogInfo("DQMExample_Step2") << "DQMExample_Step2::beginJob " << std::endl; }
//
// -------------------------------------- get and book in the endJob
// --------------------------------------------
//
void DQMExample_Step2::dqmEndJob(DQMStore::IBooker &ibooker_, DQMStore::IGetter &igetter_) {
// create and cd into new folder
ibooker_.setCurrentFolder("What_I_do_in_the_client/Ratio");
// get available histograms
MonitorElement *numerator = igetter_.get(numMonitorName_);
MonitorElement *denominator = igetter_.get(denMonitorName_);
if (!numerator || !denominator) {
edm::LogError("DQMExample_Step2") << "MEs not found!" << std::endl;
return;
}
// book new histogram
h_ptRatio = ibooker_.book1D("ptRatio", "pt ratio pf matched objects", 50, 0., 100.);
h_ptRatio->setAxisTitle("pt [GeV]");
for (int iBin = 1; iBin < numerator->getNbinsX(); ++iBin) {
if (denominator->getBinContent(iBin) == 0)
h_ptRatio->setBinContent(iBin, 0.);
else
h_ptRatio->setBinContent(iBin, numerator->getBinContent(iBin) / denominator->getBinContent(iBin));
}
}
//
// -------------------------------------- get in the endLumi if needed
// --------------------------------------------
//
void DQMExample_Step2::dqmEndLuminosityBlock(DQMStore::IBooker &ibooker_,
DQMStore::IGetter &igetter_,
edm::LuminosityBlock const &iLumi,
edm::EventSetup const &iSetup) {
edm::LogInfo("DQMExample_Step2") << "DQMExample_Step2::endLumi " << std::endl;
}
|