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
93
94
95
96
97
98
99
100
101
|
#include "DQM/RPCMonitorClient/interface/RPCDCSSummary.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "DQM/RPCMonitorClient/interface/RPCSummaryMapHisto.h"
#include <fmt/format.h>
RPCDCSSummary::RPCDCSSummary(const edm::ParameterSet& ps) {
numberOfDisks_ = ps.getUntrackedParameter<int>("NumberOfEndcapDisks", 4);
FEDRange_.first = ps.getUntrackedParameter<unsigned int>("MinimumRPCFEDId", 790);
FEDRange_.second = ps.getUntrackedParameter<unsigned int>("MaximumRPCFEDId", 792);
offlineDQM_ = ps.getUntrackedParameter<bool>("OfflineDQM", true);
NumberOfFeds_ = FEDRange_.second - FEDRange_.first + 1;
init_ = false;
defaultValue_ = 1.;
runInfoToken_ = esConsumes<edm::Transition::EndLuminosityBlock>();
}
void RPCDCSSummary::beginJob() {}
void RPCDCSSummary::dqmEndLuminosityBlock(DQMStore::IBooker& ibooker,
DQMStore::IGetter& igetter,
edm::LuminosityBlock const& lumiB,
edm::EventSetup const& setup) {
if (!init_) {
this->checkDCSbit(setup);
if (!offlineDQM_) {
this->myBooker(ibooker);
}
}
}
void RPCDCSSummary::dqmEndJob(DQMStore::IBooker& ibooker, DQMStore::IGetter& igetter) {
if (offlineDQM_) {
this->myBooker(ibooker);
}
}
void RPCDCSSummary::checkDCSbit(edm::EventSetup const& setup) {
defaultValue_ = 1.;
if (auto runInfoRec = setup.tryToGet<RunInfoRcd>()) {
defaultValue_ = -1.;
//get fed summary information
auto sumFED = runInfoRec->get(runInfoToken_);
const std::vector<int> FedsInIds = sumFED.m_fed_in;
unsigned int f = 0;
bool flag = false;
while (!flag && f < FedsInIds.size()) {
int fedID = FedsInIds[f];
//make sure fed id is in allowed range
if (fedID >= FEDRange_.first && fedID <= FEDRange_.second) {
defaultValue_ = 1.;
flag = true;
}
f++;
}
}
init_ = true;
}
void RPCDCSSummary::myBooker(DQMStore::IBooker& ibooker) {
ibooker.setCurrentFolder("RPC/EventInfo");
// global fraction
totalDCSFraction = ibooker.bookFloat("DCSSummary");
totalDCSFraction->Fill(defaultValue_);
DCSMap_ = RPCSummaryMapHisto::book(ibooker, "DCSSummaryMap", "RPC DCS Summary Map");
//fill the histo with "1" --- just for the moment
RPCSummaryMapHisto::setBinsBarrel(DCSMap_, 1);
RPCSummaryMapHisto::setBinsEndcap(DCSMap_, 1);
// book the ME
ibooker.setCurrentFolder("RPC/EventInfo/DCSContents");
const int limit = std::max(2, numberOfDisks_);
for (int i = -1 * limit; i <= limit; i++) { //loop on wheels and disks
if (i > -3 && i < nWheels_ - 2) { //wheels
const std::string s = fmt::format("RPC_Wheel{}", i);
dcsWheelFractions[i + 2] = ibooker.bookFloat(s);
dcsWheelFractions[i + 2]->Fill(defaultValue_);
}
if (i == 0 || i > numberOfDisks_ || i < -numberOfDisks_)
continue;
if (i > -3 && i < nDisks_ - 2) {
const std::string s = fmt::format("RPC_Disk{}", i);
dcsDiskFractions[i + 2] = ibooker.bookFloat(s);
dcsDiskFractions[i + 2]->Fill(defaultValue_);
}
}
}
|