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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "DQMServices/Core/interface/DQMEDHarvester.h"
#include "FWCore/Framework/interface/MakerMacros.h"
class TestHarvester : public DQMEDHarvester {
private:
std::string folder_;
std::string whathappened;
public:
explicit TestHarvester(const edm::ParameterSet &iConfig)
: DQMEDHarvester(iConfig), folder_(iConfig.getParameter<std::string>("folder")) {}
~TestHarvester() override {}
void beginRun(const edm::Run &run, const edm::EventSetup &iSetup) override {
whathappened += "beginRun(" + std::to_string(run.run()) + ") ";
}
void dqmEndRun(DQMStore::IBooker &ib,
DQMStore::IGetter &ig,
const edm::Run &run,
const edm::EventSetup &iSetup) override {
whathappened += "endRun(" + std::to_string(run.run()) + ") ";
ig.setCurrentFolder(folder_);
MonitorElement *out = ib.bookString("runsummary", "missing");
out->Fill(whathappened);
}
void dqmEndJob(DQMStore::IBooker &ib, DQMStore::IGetter &ig) override {
whathappened += "endJob() ";
ig.setCurrentFolder(folder_);
MonitorElement *out = ib.bookString("harvestingsummary", "missing");
out->Fill(whathappened);
}
void dqmEndLuminosityBlock(DQMStore::IBooker &ib,
DQMStore::IGetter &ig,
edm::LuminosityBlock const &lumi,
edm::EventSetup const &) override {
whathappened += "endLumi(" + std::to_string(lumi.run()) + "," + std::to_string(lumi.luminosityBlock()) + ") ";
}
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions) {
edm::ParameterSetDescription desc;
desc.add<std::string>("folder", "Harvesting/")->setComment("Where to put all the histograms");
descriptions.add("testharvester", desc);
}
};
DEFINE_FWK_MODULE(TestHarvester);
#include "FWCore/Framework/interface/one/EDAnalyzer.h"
class TestLegacyHarvester
: public edm::one::EDAnalyzer<edm::one::SharedResources, edm::one::WatchRuns, edm::one::WatchLuminosityBlocks> {
private:
std::string folder_;
std::string whathappened;
public:
typedef dqm::legacy::DQMStore DQMStore;
typedef dqm::legacy::MonitorElement MonitorElement;
explicit TestLegacyHarvester(const edm::ParameterSet &iConfig)
: folder_(iConfig.getParameter<std::string>("folder")) {
usesResource("DQMStore");
}
~TestLegacyHarvester() override {}
void beginRun(const edm::Run &run, const edm::EventSetup &iSetup) override {
whathappened += "beginRun(" + std::to_string(run.run()) + ") ";
}
void endRun(const edm::Run &run, const edm::EventSetup &iSetup) override {
edm::Service<DQMStore> store;
whathappened += "endRun(" + std::to_string(run.run()) + ") ";
store->setCurrentFolder(folder_);
MonitorElement *out = store->bookString("runsummary", "missing");
out->Fill(whathappened);
}
void beginLuminosityBlock(edm::LuminosityBlock const &lumi, edm::EventSetup const &) override {}
void endLuminosityBlock(edm::LuminosityBlock const &lumi, edm::EventSetup const &) override {
whathappened += "endLumi(" + std::to_string(lumi.run()) + "," + std::to_string(lumi.luminosityBlock()) + ") ";
}
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions) {
edm::ParameterSetDescription desc;
desc.add<std::string>("folder", "LegacyHarvester/")->setComment("Where to put all the histograms");
descriptions.add("testlegacyharvester", desc);
}
void analyze(edm::Event const &, edm::EventSetup const &) override {}
};
DEFINE_FWK_MODULE(TestLegacyHarvester);
|