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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
|
/*
* \author Anna Cimmino
*/
#include <DQM/RPCMonitorClient/interface/RPCMultiplicityTest.h>
#include <DQM/RPCMonitorClient/interface/RPCRollMapHisto.h>
#include "DQM/RPCMonitorClient/interface/utils.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "Geometry/RPCGeometry/interface/RPCGeomServ.h"
RPCMultiplicityTest::RPCMultiplicityTest(const edm::ParameterSet& ps) {
edm::LogVerbatim("multiplicity") << "[RPCMultiplicityTest]: Constructor";
useRollInfo_ = ps.getUntrackedParameter<bool>("UseRollInfo", false);
prescaleFactor_ = ps.getUntrackedParameter<int>("DiagnosticPrescale", 1);
numberOfDisks_ = ps.getUntrackedParameter<int>("NumberOfEndcapDisks", 4);
numberOfRings_ = ps.getUntrackedParameter<int>("NumberOfEndcapRings", 2);
testMode_ = ps.getUntrackedParameter<bool>("testMode", false);
}
void RPCMultiplicityTest::beginJob(std::string& workingFolder) {
edm::LogVerbatim("multiplicity") << "[RPCMultiplicityTest]: Begin job";
globalFolder_ = workingFolder;
}
void RPCMultiplicityTest::myBooker(DQMStore::IBooker& ibooker) {
ibooker.setCurrentFolder(globalFolder_);
std::stringstream histoName;
for (int i = -2; i <= 2; i++) { //loop on wheels and disks
histoName.str("");
histoName << "NumberOfDigi_Mean_Roll_vs_Sector_Wheel" << i;
auto me = RPCRollMapHisto::bookBarrel(ibooker, i, histoName.str(), histoName.str(), useRollInfo_);
MULTWheel[i + 2] = dynamic_cast<MonitorElement*>(me);
if (testMode_) {
histoName.str("");
histoName << "NumberOfDigi_Mean_Distribution_Wheel" << i;
MULTDWheel[i + 2] = ibooker.book1D(histoName.str().c_str(), histoName.str().c_str(), 100, 0.5, 50.5);
}
} //end wheels
for (int d = -numberOfDisks_; d <= numberOfDisks_; d++) {
if (d == 0)
continue;
int offset = numberOfDisks_;
if (d > 0)
offset--; //used to skip case equale to zero
histoName.str("");
histoName << "NumberOfDigi_Mean_Ring_vs_Segment_Disk" << d;
auto me = RPCRollMapHisto::bookEndcap(ibooker, d, histoName.str(), histoName.str(), useRollInfo_);
MULTDisk[d + offset] = dynamic_cast<MonitorElement*>(me);
if (testMode_) {
histoName.str("");
histoName << "NumberOfDigi_Mean_Distribution_Disk" << d;
MULTDDisk[d + offset] = ibooker.book1D(histoName.str().c_str(), histoName.str().c_str(), 100, 0.5, 50.5);
}
} //end loop on wheels and disks
}
void RPCMultiplicityTest::getMonitorElements(std::vector<MonitorElement*>& meVector,
std::vector<RPCDetId>& detIdVector,
std::string& clientHistoName) {
//Get NumberOfDigi ME for each roll
for (unsigned int i = 0; i < meVector.size(); i++) {
std::string meName = meVector[i]->getName();
if (meName.find(clientHistoName) != std::string::npos) {
myNumDigiMe_.push_back(meVector[i]);
myDetIds_.push_back(detIdVector[i]);
}
}
}
void RPCMultiplicityTest::clientOperation() {
edm::LogVerbatim("multiplicity") << "[RPCMultiplicityTest]: Client Operation";
//Loop on MEs
for (unsigned int i = 0; i < myNumDigiMe_.size(); i++) {
this->fillGlobalME(myDetIds_[i], myNumDigiMe_[i]);
} //End loop on MEs
}
void RPCMultiplicityTest::fillGlobalME(RPCDetId& detId, MonitorElement* myMe) {
MonitorElement* MULT = nullptr;
MonitorElement* MULTD = nullptr;
if (detId.region() == 0) {
MULT = MULTWheel[detId.ring() + 2];
if (testMode_) {
MULTD = MULTDWheel[detId.ring() + 2];
}
} else {
if (-detId.station() + numberOfDisks_ >= 0) {
if (detId.region() < 0) {
MULT = MULTDisk[-detId.station() + numberOfDisks_];
if (testMode_) {
MULTD = MULTDDisk[-detId.station() + numberOfDisks_];
}
} else {
MULT = MULTDisk[detId.station() + numberOfDisks_ - 1];
if (testMode_) {
MULTD = MULTDDisk[detId.station() + numberOfDisks_ - 1];
}
}
}
}
int xBin, yBin;
if (detId.region() == 0) { //Barrel
xBin = detId.sector();
rpcdqm::utils rollNumber;
yBin = rollNumber.detId2RollNr(detId);
} else { //Endcap
//get segment number
RPCGeomServ RPCServ(detId);
xBin = RPCServ.segment();
(numberOfRings_ == 3 ? yBin = detId.ring() * 3 - detId.roll() + 1
: yBin = (detId.ring() - 1) * 3 - detId.roll() + 1);
}
float mean = myMe->getMean();
if (MULT) {
MULT->setBinContent(xBin, yBin, mean);
}
if (testMode_ && MULTD) {
MULTD->Fill(mean);
}
}
|