CMS 3D CMS Logo

RPCBookDetUnitME.cc
Go to the documentation of this file.
6 
8  const RPCDetId& detId,
9  const RPCGeometry* rpcGeo,
10  const std::string& recHitType,
11  std::map<std::string, MonitorElement*>& meMap) {
12  ibooker.setCurrentFolder(
14 
15  //get number of strips in current roll
16  int nstrips = this->stripsInRoll(detId, rpcGeo);
17  if (nstrips == 0) {
18  nstrips = 1;
19  }
20 
22  const std::string nameRoll = RPCNameHelper::name(detId, useRollInfo_);
23 
25  if (detId.region() != 0 || //Endcaps
26  (abs(detId.ring()) == 2 && detId.station() == 2 && detId.layer() != 1) || //Wheel -/+2 RB2out
27  (abs(detId.ring()) != 2 && detId.station() == 2 && detId.layer() == 1)) {
28  nstrips *= 3;
29  } //Wheel -1,0,+1 RB2in
30  else {
31  nstrips *= 2;
32  }
33  }
34 
35  std::string tmpStr;
36 
37  tmpStr = "Occupancy_" + nameRoll;
38  meMap[tmpStr] = ibooker.book1D(tmpStr, tmpStr, nstrips, 0.5, nstrips + 0.5);
39 
40  tmpStr = "BXDistribution_" + nameRoll;
41  meMap[tmpStr] = ibooker.book1D(tmpStr, tmpStr, 7, -3.5, 3.5);
42 
43  if (detId.region() == 0) {
44  tmpStr = "Multiplicity_" + nameRoll;
45  meMap[tmpStr] = ibooker.book1D(tmpStr, tmpStr, 30, 0.5, 30.5);
46 
47  } else {
48  tmpStr = "Multiplicity_" + nameRoll;
49  meMap[tmpStr] = ibooker.book1D(tmpStr, tmpStr, 15, 0.5, 15.5);
50  }
51 
52  tmpStr = "NumberOfClusters_" + nameRoll;
53  meMap[tmpStr] = ibooker.book1D(tmpStr, tmpStr, 10, 0.5, 10.5);
54 }
55 
57  const std::string& recHitType,
58  std::map<std::string, MonitorElement*>& meMap) {
59  for (int wheel = -2; wheel <= 2; wheel++) {
60  ibooker.setCurrentFolder(
61  fmt::format("{}/{}/Barrel/Wheel_{}/SummaryBySectors", subsystemFolder_, recHitType, wheel));
62 
63  for (int sector = 1; sector <= 12; sector++) {
64  const std::string meName = fmt::format("Occupancy_Wheel_{}_Sector_{}", wheel, sector);
65  const std::string meClus = fmt::format("ClusterSize_Wheel_{}_Sector_{}", wheel, sector);
66 
67  if (sector == 9 || sector == 11) {
68  meMap[meName] = ibooker.book2D(meName, meName, 91, 0.5, 91.5, 15, 0.5, 15.5);
69  meMap[meClus] = ibooker.book2D(meClus, meClus, 16, 1, 17, 15, 0.5, 15.5);
70  } else if (sector == 4) {
71  meMap[meName] = ibooker.book2D(meName, meName, 91, 0.5, 91.5, 21, 0.5, 21.5);
72  meMap[meClus] = ibooker.book2D(meClus, meClus, 16, 1, 17, 21, 0.5, 21.5);
73  } else {
74  meMap[meName] = ibooker.book2D(meName, meName, 91, 0.5, 91.5, 17, 0.5, 17.5);
75  meMap[meClus] = ibooker.book2D(meClus, meClus, 16, 1, 17, 17, 0.5, 17.5);
76  }
77 
78  meMap[meName]->setAxisTitle("strip", 1);
79  RPCRollMapHisto::setBarrelRollAxis(meMap[meName], wheel, 2, true);
80 
81  meMap[meClus]->setAxisTitle("Cluster size", 1);
82  meMap[meClus]->setBinLabel(1, "1", 1);
83  meMap[meClus]->setBinLabel(5, "5", 1);
84  meMap[meClus]->setBinLabel(10, "10", 1);
85  meMap[meClus]->setBinLabel(15, "15", 1);
86  meMap[meClus]->setBinLabel(meMap[meClus]->getNbinsX(), "Overflow", 1);
87  RPCRollMapHisto::setBarrelRollAxis(meMap[meClus], wheel, 2, true);
88  }
89  }
90 
91  for (int region = -1; region <= 1; region++) {
92  if (region == 0)
93  continue;
94 
95  std::string regionName = "Endcap-";
96  if (region == 1)
97  regionName = "Endcap+";
98 
99  for (int disk = 1; disk <= RPCMonitorDigi::numberOfDisks_; disk++) {
100  ibooker.setCurrentFolder(
101  fmt::format("{}/{}/{}/Disk_{}/SummaryByRings/", subsystemFolder_, recHitType, regionName, region * disk));
102 
103  for (int ring = RPCMonitorDigi::numberOfInnerRings_; ring <= 3; ring++) {
104  //Occupancy
105  const std::string meName1 = fmt::format("Occupancy_Disk_{}_Ring_{}_CH01-CH18", (region * disk), ring);
106 
107  auto me1 = ibooker.book2D(meName1, meName1, 96, 0.5, 96.5, 18, 0.5, 18.5);
108  me1->setAxisTitle("strip", 1);
109 
110  for (int i = 1; i <= 18; i++) {
111  const std::string ylabel = fmt::format("R{}_CH{:02d}", ring, i);
112  me1->setBinLabel(i, ylabel, 2);
113  }
114 
115  me1->setBinLabel(1, "1", 1);
116  me1->setBinLabel(16, "RollA", 1);
117  me1->setBinLabel(32, "32", 1);
118  me1->setBinLabel(33, "1", 1);
119  me1->setBinLabel(48, "RollB", 1);
120  me1->setBinLabel(64, "32", 1);
121  me1->setBinLabel(65, "1", 1);
122  me1->setBinLabel(80, "RollC", 1);
123  me1->setBinLabel(96, "32", 1);
124 
125  const std::string meName2 = fmt::format("Occupancy_Disk_{}_Ring_{}_CH19-CH36", (region * disk), ring);
126 
127  auto me2 = ibooker.book2D(meName2, meName2, 96, 0.5, 96.5, 18, 18.5, 36.5);
128  me2->setAxisTitle("strip", 1);
129 
130  for (int i = 1; i <= 18; i++) {
131  const std::string ylabel = fmt::format("R{}_CH{:02d}", ring, i + 18);
132  me2->setBinLabel(i, ylabel, 2);
133  }
134 
135  me2->setBinLabel(1, "1", 1);
136  me2->setBinLabel(16, "RollA", 1);
137  me2->setBinLabel(32, "32", 1);
138  me2->setBinLabel(33, "1", 1);
139  me2->setBinLabel(48, "RollB", 1);
140  me2->setBinLabel(64, "32", 1);
141  me2->setBinLabel(65, "1", 1);
142  me2->setBinLabel(80, "RollC", 1);
143  me2->setBinLabel(96, "32", 1);
144 
145  meMap[meName1] = me1;
146  meMap[meName2] = me2;
147 
148  //Cluster size
149  const std::string meClus1 = fmt::format("ClusterSize_Disk_{}_Ring_{}_CH01-CH09", (region * disk), ring);
150  const std::string meClus2 = fmt::format("ClusterSize_Disk_{}_Ring_{}_CH10-CH18", (region * disk), ring);
151  const std::string meClus3 = fmt::format("ClusterSize_Disk_{}_Ring_{}_CH19-CH27", (region * disk), ring);
152  const std::string meClus4 = fmt::format("ClusterSize_Disk_{}_Ring_{}_CH28-CH36", (region * disk), ring);
153 
154  auto mecl1 = ibooker.book2D(meClus1, meClus1, 11, 1, 12, 27, 0.5, 27.5);
155  auto mecl2 = ibooker.book2D(meClus2, meClus2, 11, 1, 12, 27, 27.5, 54.5);
156  auto mecl3 = ibooker.book2D(meClus3, meClus3, 11, 1, 12, 27, 54.5, 81.5);
157  auto mecl4 = ibooker.book2D(meClus4, meClus4, 11, 1, 12, 27, 81.5, 108.5);
158 
159  std::array<MonitorElement*, 4> meCls = {{mecl1, mecl2, mecl3, mecl4}};
160 
161  for (unsigned int icl = 0; icl < meCls.size(); icl++) {
162  meCls[icl]->setAxisTitle("Cluster size", 1);
163 
164  for (int i = 1; i <= 9; i++) {
165  const std::string ylabel1 = fmt::format("R{}_CH{:02d}_C", ring, (icl * 9) + i);
166  const std::string ylabel2 = fmt::format("R{}_CH{:02d}_B", ring, (icl * 9) + i);
167  const std::string ylabel3 = fmt::format("R{}_CH{:02d}_A", ring, (icl * 9) + i);
168  meCls[icl]->setBinLabel(1 + (i - 1) * 3, ylabel1, 2);
169  meCls[icl]->setBinLabel(2 + (i - 1) * 3, ylabel2, 2);
170  meCls[icl]->setBinLabel(3 + (i - 1) * 3, ylabel3, 2);
171  }
172  meCls[icl]->setBinLabel(1, "1", 1);
173  meCls[icl]->setBinLabel(5, "5", 1);
174  meCls[icl]->setBinLabel(10, "10", 1);
175  meCls[icl]->setBinLabel(mecl1->getNbinsX(), "Overflow", 1);
176  }
177 
178  meMap[meClus1] = mecl1;
179  meMap[meClus2] = mecl2;
180  meMap[meClus3] = mecl3;
181  meMap[meClus4] = mecl4;
182  } //loop ring
183  } //loop disk
184  } //loop region
185 }
186 
188  const std::string& recHitType,
189  std::map<std::string, MonitorElement*>& meMap) {
190  ibooker.setCurrentFolder(subsystemFolder_ + "/" + recHitType + "/" + globalFolder_);
191 
192  std::string tmpStr;
193 
194  for (int wheel = -2; wheel <= 2; wheel++) { //Loop on wheel
195  tmpStr = fmt::format("1DOccupancy_Wheel_{}", wheel);
196  meMap[tmpStr] = ibooker.book1D(tmpStr, tmpStr, 12, 0.5, 12.5);
197  for (int i = 1; i <= 12; ++i) {
198  meMap[tmpStr]->setBinLabel(i, fmt::format("Sec{}", i), 1);
199  }
200 
201  tmpStr = fmt::format("Occupancy_Roll_vs_Sector_Wheel_{}", wheel);
202  meMap[tmpStr] = RPCRollMapHisto::bookBarrel(ibooker, wheel, tmpStr, tmpStr, true);
203 
204  tmpStr = fmt::format("BxDistribution_Wheel_{}", wheel);
205  meMap[tmpStr] = ibooker.book1D(tmpStr, tmpStr, 9, -4.5, 4.5);
206 
207  } //end loop on wheel
208 
209  for (int disk = -RPCMonitorDigi::numberOfDisks_; disk <= RPCMonitorDigi::numberOfDisks_; disk++) {
210  if (disk == 0)
211  continue;
212 
213  tmpStr = fmt::format("Occupancy_Ring_vs_Segment_Disk_{}", disk);
214  meMap[tmpStr] = RPCRollMapHisto::bookEndcap(ibooker, disk, tmpStr, tmpStr, true);
215 
216  tmpStr = fmt::format("BxDistribution_Disk_{}", disk);
217  meMap[tmpStr] = ibooker.book1D(tmpStr, tmpStr, 9, -4.5, 4.5);
218  }
219 
220  for (int ring = RPCMonitorDigi::numberOfInnerRings_; ring <= 3; ring++) {
221  const std::string meName = fmt::format("1DOccupancy_Ring_{}", ring);
222  meMap[meName] = ibooker.book1D(
223  meName, meName, RPCMonitorDigi::numberOfDisks_ * 2, 0.5, (RPCMonitorDigi::numberOfDisks_ * 2.0) + 0.5);
224  for (int xbin = 1; xbin <= RPCMonitorDigi::numberOfDisks_ * 2; xbin++) {
226  if (xbin < RPCMonitorDigi::numberOfDisks_ + 1)
227  label = fmt::format("Disk {}", (xbin - (RPCMonitorDigi::numberOfDisks_ + 1)));
228  else
229  label = fmt::format("Disk {}", (xbin - RPCMonitorDigi::numberOfDisks_));
230  meMap[meName]->setBinLabel(xbin, label, 1);
231  }
232  }
233 }
234 
235 //returns the number of strips in each roll
236 int RPCMonitorDigi::stripsInRoll(const RPCDetId& id, const RPCGeometry* rpcGeo) const {
237  const RPCRoll* rpcRoll = rpcGeo->roll(id);
238  if (!rpcRoll)
239  return 1;
240 
241  return rpcRoll->nstrips();
242 }
243 
245  const std::string& recHitType,
246  std::map<std::string, MonitorElement*>& meMap) {
247  std::string currentFolder = subsystemFolder_ + "/" + recHitType + "/" + globalFolder_;
248  ibooker.setCurrentFolder(currentFolder);
249 
250  std::stringstream name;
251  std::stringstream title;
252 
253  //Number of Digis
254  name.str("");
255  title.str("");
256  name << "Multiplicity_Barrel";
257  title << "Multiplicity per Event per Roll - Barrel";
258  meMap[name.str()] = ibooker.book1D(name.str(), title.str(), 50, 0.5, 50.5);
259 
260  name.str("");
261  title.str("");
262  name << "Multiplicity_Endcap+";
263  title << "Multiplicity per Event per Roll - Endcap+";
264  meMap[name.str()] = ibooker.book1D(name.str(), title.str(), 32, 0.5, 32.5);
265 
266  name.str("");
267  title.str("");
268  name << "Multiplicity_Endcap-";
269  title << "Multiplicity per Event per Roll - Endcap-";
270  meMap[name.str()] = ibooker.book1D(name.str(), title.str(), 32, 0.5, 32.5);
271 
272  meMap["Occupancy_for_Endcap"] = ibooker.book2D("Occupancy_for_Endcap",
273  "Occupancy Endcap",
275  0.5,
276  ((float)RPCMonitorDigi::numberOfDisks_ * 2.0) + 0.5,
277  2,
278  1.5,
279  3.5);
280  meMap["Occupancy_for_Endcap"]->setAxisTitle("Disk", 1);
281  meMap["Occupancy_for_Endcap"]->setAxisTitle("Ring", 2);
282 
283  std::stringstream binlabel;
284  for (int bin = 1; bin <= RPCMonitorDigi::numberOfDisks_ * 2; bin++) {
285  binlabel.str("");
286  if (bin < (RPCMonitorDigi::numberOfDisks_ + 1)) { //negative endcap
287  binlabel << (bin - (RPCMonitorDigi::numberOfDisks_ + 1));
288  } else { //positive endcaps
289  binlabel << (bin - RPCMonitorDigi::numberOfDisks_);
290  }
291  meMap["Occupancy_for_Endcap"]->setBinLabel(bin, binlabel.str(), 1);
292  }
293 
294  meMap["Occupancy_for_Endcap"]->setBinLabel(1, "2", 2);
295  meMap["Occupancy_for_Endcap"]->setBinLabel(2, "3", 2);
296 
297  meMap["Occupancy_for_Barrel"] =
298  ibooker.book2D("Occupancy_for_Barrel", "Occupancy Barrel", 12, 0.5, 12.5, 5, -2.5, 2.5);
299  meMap["Occupancy_for_Barrel"]->setAxisTitle("Sec", 1);
300  meMap["Occupancy_for_Barrel"]->setAxisTitle("Wheel", 2);
301 
302  for (int bin = 1; bin <= 12; bin++) {
303  binlabel.str("");
304  binlabel << bin;
305  meMap["Occupancy_for_Barrel"]->setBinLabel(bin, binlabel.str(), 1);
306  if (bin <= 5) {
307  binlabel.str("");
308  binlabel << (bin - 3);
309  meMap["Occupancy_for_Barrel"]->setBinLabel(bin, binlabel.str(), 2);
310  }
311  }
312 }
std::string globalFolder_
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
int ring() const
Definition: RPCDetId.h:59
const RPCRoll * roll(RPCDetId id) const
Return a roll given its id.
Definition: RPCGeometry.cc:50
int nstrips() const
Definition: RPCRoll.cc:24
void bookSectorRingME(DQMStore::IBooker &, const std::string &, std::map< std::string, MonitorElement *> &)
Booking of MonitoringElement at Sector/Ring level.
static void setBarrelRollAxis(MonitorElement *me, const int wheel, const int axis, const bool useRollInfo)
char const * label
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
virtual void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
static std::string name(const RPCDetId &detId, const bool useRoll)
Definition: RPCNameHelper.cc:6
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:212
void bookWheelDiskME(DQMStore::IBooker &, const std::string &, std::map< std::string, MonitorElement *> &)
Booking of MonitoringElemnt at Wheel/Disk level.
static MonitorElement * bookBarrel(IBooker &booker, const int wheel, const std::string &prefix, const std::string &title, const bool useRollInfo)
static std::string folderStructure(const RPCDetId &detId)
int station() const
Definition: RPCDetId.h:78
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
Definition: RPCDetId.h:53
void bookRegionME(DQMStore::IBooker &, const std::string &, std::map< std::string, MonitorElement *> &)
Booking of MonitoringElemnt at region (Barrel/Endcap) level.
int layer() const
Definition: RPCDetId.h:85
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
int stripsInRoll(const RPCDetId &id, const RPCGeometry *rpcGeo) const
static MonitorElement * bookEndcap(IBooker &booker, const int disk, const std::string &prefix, const std::string &title, const bool useRollInfo)
std::string subsystemFolder_
void bookRollME(DQMStore::IBooker &, const RPCDetId &, const RPCGeometry *rpcGeo, const std::string &, std::map< std::string, MonitorElement *> &)
Booking of MonitoringElement for one RPCDetId (= roll)
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)