CMS 3D CMS Logo

RPCBookDetUnitME.cc
Go to the documentation of this file.
7 #include <iomanip>
8 
9 void RPCMonitorDigi::bookRollME(DQMStore::IBooker & ibooker, RPCDetId & detId, const edm::EventSetup & iSetup, const std::string & recHitType, std::map<std::string, MonitorElement*> & meMap) {
10 
12  std::string folder = subsystemFolder_+ "/"+ recHitType +"/"+folderStr->folderStructure(detId);
13 
14  ibooker.setCurrentFolder(folder);
15 
16  //get number of strips in current roll
17  int nstrips = this->stripsInRoll(detId, iSetup);
18  if (nstrips == 0 ){ nstrips = 1;}
19 
21  RPCGeomServ RPCname(detId);
22  std::string nameRoll = "";
23 
25  nameRoll = RPCname.name();
26  }else{
27  nameRoll = RPCname.chambername();
28 
29  if(detId.region() != 0 || //Endcaps
30  (abs(detId.ring()) == 2 && detId.station()== 2 && detId.layer() != 1) || //Wheel -/+2 RB2out
31  (abs(detId.ring()) != 2 && detId.station()== 2 && detId.layer() == 1)){nstrips *= 3;} //Wheel -1,0,+1 RB2in
32  else {
33  nstrips *= 2;
34  }
35 
36  }
37 
38 
39  std::stringstream os;
40  os.str("");
41  os<<"Occupancy_"<<nameRoll;
42  meMap[os.str()] = ibooker.book1D(os.str(), os.str(), nstrips, 0.5, nstrips+0.5);
43  ibooker.tag( meMap[os.str()], rpcdqm::OCCUPANCY);
44 
45  os.str("");
46  os<<"BXDistribution_"<<nameRoll;
47  meMap[os.str()] = ibooker.book1D(os.str(), os.str(), 7, -3.5, 3.5);
48  ibooker.tag( meMap[os.str()], rpcdqm::BX);
49 
50  if(detId.region() == 0){
51  os.str("");
52  os<<"ClusterSize_"<<nameRoll;
53  meMap[os.str()] = ibooker.book1D(os.str(), os.str(), 15, 0.5, 15.5);
54  ibooker.tag( meMap[os.str()], rpcdqm::CLUSTERSIZE);
55 
56  os.str("");
57  os<<"Multiplicity_"<<nameRoll;
58  meMap[os.str()] = ibooker.book1D(os.str(), os.str(), 30, 0.5, 30.5);
59  ibooker.tag( meMap[os.str()], rpcdqm::MULTIPLICITY);
60 
61  }else{
62  os.str("");
63  os<<"ClusterSize_"<<nameRoll;
64  meMap[os.str()] = ibooker.book1D(os.str(), os.str(), 10, 0.5, 10.5);
65  ibooker.tag( meMap[os.str()], rpcdqm::CLUSTERSIZE);
66 
67  os.str("");
68  os<<"Multiplicity_"<<nameRoll;
69  meMap[os.str()] = ibooker.book1D(os.str(), os.str(), 15, 0.5, 15.5);
70  ibooker.tag( meMap[os.str()], rpcdqm::MULTIPLICITY);
71  }
72 
73 
74  os.str("");
75  os<<"NumberOfClusters_"<<nameRoll;
76  meMap[os.str()] = ibooker.book1D(os.str(), os.str(),10,0.5,10.5);
77 
78 
79  delete folderStr;
80  // return meMap;
81 }
82 
83 
84 void RPCMonitorDigi::bookSectorRingME(DQMStore::IBooker & ibooker, const std::string &recHitType, std::map<std::string, MonitorElement*> & meMap) {
85  //std::map<std::string, MonitorElement*> RPCMonitorDigi::bookSectorRingME(std::string recHitType) {
86 
87  // std::map<std::string, MonitorElement*> meMap;
88  std::stringstream os;
89 
90  for(int wheel = -2 ; wheel <= 2; wheel++){
91  os.str("");
92  os<< subsystemFolder_<< "/"<<recHitType<<"/Barrel/Wheel_"<<wheel<<"/SummaryBySectors";
93  ibooker.setCurrentFolder(os.str());
94 
95  for (int sector = 1 ; sector <= 12 ; sector++){
96 
97  os.str("");
98  os<<"Occupancy_Wheel_"<<wheel<<"_Sector_"<<sector;
99 
100  if (sector==9 || sector==11)
101  meMap[os.str()] = ibooker.book2D(os.str(), os.str(), 91, 0.5, 91.5, 15, 0.5, 15.5);
102  else if (sector==4)
103  meMap[os.str()] = ibooker.book2D(os.str(), os.str(), 91, 0.5, 91.5, 21, 0.5, 21.5);
104  else
105  meMap[os.str()] = ibooker.book2D(os.str(), os.str(), 91, 0.5, 91.5, 17, 0.5, 17.5);
106 
107  meMap[os.str()]->setAxisTitle("strip", 1);
108  rpcdqm::utils rpcUtils;
109  rpcUtils.labelYAxisRoll( meMap[os.str()], 0, wheel, true);
110 
111 // os.str("");
112 // os<<"BxDistribution_Wheel_"<<wheel<<"_Sector_"<<sector;
113 // meMap[os.str()] = ibooker.book1D(os.str(), os.str(), 11, -5.5, 5.5);
114 
115  }
116  }
117 
118 
119  for (int region = -1 ; region <= 1; region++){
120  if( region == 0 ) continue;
121 
122  std::string regionName = "Endcap-";
123  if(region == 1) regionName = "Endcap+";
124 
125  for (int disk = 1; disk <= RPCMonitorDigi::numberOfDisks_; disk++) {
126  os.str("");
127  os<< subsystemFolder_<< "/"<<recHitType<<"/"<<regionName<<"/Disk_"<<(region * disk)<<"/SummaryByRings/";
128 
129  ibooker.setCurrentFolder(os.str());
130 
131  for (int ring = RPCMonitorDigi::numberOfInnerRings_ ; ring <= 3; ring ++) {
132 
133  os.str("");
134  os<<"Occupancy_Disk_"<<(region * disk)<<"_Ring_"<<ring<<"_CH01-CH18";
135 
136  meMap[os.str()] = ibooker.book2D(os.str(), os.str(), 96, 0.5, 96.5, 18 , 0.5, 18.5);
137  meMap[os.str()]->setAxisTitle("strip", 1);
138 
139  std::stringstream yLabel;
140  for (int i = 1 ; i<=18; i++) {
141  yLabel.str("");
142  yLabel<<"R"<<ring<<"_CH"<<std::setw(2)<<std::setfill('0')<<i;
143  meMap[os.str()]->setBinLabel(i, yLabel.str(), 2);
144  }
145 
146 
147  for(int i = 1; i <= 96 ; i++) {
148  if (i ==1) meMap[os.str()]->setBinLabel(i, "1", 1);
149  else if (i==16) meMap[os.str()]->setBinLabel(i, "RollA", 1);
150  else if (i==32) meMap[os.str()]->setBinLabel(i, "32", 1);
151  else if (i==33) meMap[os.str()]->setBinLabel(i, "1", 1);
152  else if (i==48) meMap[os.str()]->setBinLabel(i, "RollB", 1);
153  else if (i==64) meMap[os.str()]->setBinLabel(i, "32", 1);
154  else if (i==65) meMap[os.str()]->setBinLabel(i, "1", 1);
155  else if (i==80) meMap[os.str()]->setBinLabel(i, "RollC", 1);
156  else if (i==96) meMap[os.str()]->setBinLabel(i, "32", 1);
157  else meMap[os.str()]->setBinLabel(i, "", 1);
158  }
159 
160 
161  os.str("");
162  os<<"Occupancy_Disk_"<<(region * disk)<<"_Ring_"<<ring<<"_CH19-CH36";
163 
164  meMap[os.str()] = ibooker.book2D(os.str(), os.str(), 96, 0.5, 96.5, 18 , 18.5, 36.5);
165  meMap[os.str()]->setAxisTitle("strip", 1);
166 
167  for (int i = 1 ; i<= 18; i++) {
168  yLabel.str("");
169  yLabel<<"R"<<ring<<"_CH"<<i+18;
170  meMap[os.str()]->setBinLabel(i, yLabel.str(), 2);
171  }
172 
173 
174  for(int i = 1; i <= 96 ; i++) {
175  if (i ==1) meMap[os.str()]->setBinLabel(i, "1", 1);
176  else if (i==16) meMap[os.str()]->setBinLabel(i, "RollA", 1);
177  else if (i==32) meMap[os.str()]->setBinLabel(i, "32", 1);
178  else if (i==33) meMap[os.str()]->setBinLabel(i, "1", 1);
179  else if (i==48) meMap[os.str()]->setBinLabel(i, "RollB", 1);
180  else if (i==64) meMap[os.str()]->setBinLabel(i, "32", 1);
181  else if (i==65) meMap[os.str()]->setBinLabel(i, "1", 1);
182  else if (i==80) meMap[os.str()]->setBinLabel(i, "RollC", 1);
183  else if (i==96) meMap[os.str()]->setBinLabel(i, "32", 1);
184  else meMap[os.str()]->setBinLabel(i, "", 1);
185  }
186 
187 
188 // os.str("");
189 // os<<"BxDistribution_Disk_"<<(region * disk)<<"_Ring_"<<ring;
190 // meMap[os.str()] = ibooker.book1D(os.str(), os.str(), 11, -5.5, 5.5);
191 
192  } //loop ring
193  } //loop disk
194  } //loop region
195 
196  // return meMap;
197 }
198 
199 
200 void RPCMonitorDigi::bookWheelDiskME(DQMStore::IBooker & ibooker,const std::string &recHitType, std::map<std::string, MonitorElement*> &meMap) {
201  //std::map<std::string, MonitorElement*> RPCMonitorDigi::bookWheelDiskME(std::string recHitType) {
202 
203  // std::map<std::string, MonitorElement*> meMap;
204  ibooker.setCurrentFolder(subsystemFolder_ +"/"+recHitType+"/"+ globalFolder_);
205 
206  std::stringstream os, label, name, title ;
207  rpcdqm::utils rpcUtils;
208 
209  for (int wheel = -2 ; wheel<= 2; wheel++ ) {//Loop on wheel
210 
211  // os<<"OccupancyXY_"<<ringType<<"_"<<ring;
212  // meMap[os.str()] = ibooker.book2D(os.str(), os.str(),63, -800, 800, 63, -800, 800);
213  // meMap[os.str()] = ibooker.book2D(os.str(), os.str(),1000, -800, 800, 1000, -800, 800);
214 
215 
216  os.str("");
217  os<<"1DOccupancy_Wheel_"<<wheel;
218  meMap[os.str()] = ibooker.book1D(os.str(), os.str(), 12, 0.5, 12.5);
219  for(int i=1; i<12; i++) {
220  label.str("");
221  label<<"Sec"<<i;
222  meMap[os.str()] ->setBinLabel(i, label.str(), 1);
223  }
224 
225  os.str("");
226  os<<"Occupancy_Roll_vs_Sector_Wheel_"<<wheel;
227  meMap[os.str()] = ibooker.book2D(os.str(), os.str(), 12, 0.5,12.5, 21, 0.5, 21.5);
228  rpcUtils.labelXAxisSector(meMap[os.str()]);
229  rpcUtils.labelYAxisRoll( meMap[os.str()], 0, wheel, true);
230 
231  os.str("");
232  os<<"BxDistribution_Wheel_"<<wheel;
233  meMap[os.str()] = ibooker.book1D(os.str(), os.str(), 9, -4.5, 4.5);
234 
235 
236  for(int layer = 1 ; layer <= 6 ; layer ++){
237  name.str("");
238  title.str("");
239  name<<"ClusterSize_Wheel_"<<wheel<<"_Layer"<< layer;
240  title<< "ClusterSize - Wheel "<<wheel<<" Layer"<<layer;
241  meMap[name.str()] = ibooker.book1D(name.str(), title.str(), 16, 0.5, 16.5);
242  }
243 
244 
245 
246  }//end loop on wheel
247 
248 
249  for (int disk = - RPCMonitorDigi::numberOfDisks_; disk <= RPCMonitorDigi::numberOfDisks_; disk++){
250 
251  if(disk == 0) continue;
252 
253 
254  os.str("");
255  os<<"Occupancy_Ring_vs_Segment_Disk_"<<disk;
256  meMap[os.str()] = ibooker.book2D(os.str(), os.str(), 36, 0.5,36.5, 6, 0.5, 6.5);
257 
258  rpcUtils.labelXAxisSegment(meMap[os.str()]);
259  rpcUtils.labelYAxisRing(meMap[os.str()], 2, true);
260 
261  os.str("");
262  os<<"BxDistribution_Disk_"<<disk;
263  meMap[os.str()] = ibooker.book1D(os.str(), os.str(), 9, -4.5, 4.5);
264 
265 
266  for(int ring = RPCMonitorDigi::numberOfInnerRings_ ; ring <= 3 ; ring ++){
267 
268  name.str("");
269  title.str("");
270  name<<"ClusterSize_Disk_"<<disk<<"_Ring"<< ring;
271  title<< "ClusterSize - Disk"<<disk<<" Ring"<<ring;
272  meMap[name.str()] = ibooker.book1D(name.str(), title.str(), 16, 0.5, 16.5);
273 
274  }
275 
276  }
277 
278  for(int ring = RPCMonitorDigi::numberOfInnerRings_ ; ring <= 3 ; ring ++){
279  os.str("");
280  os<<"1DOccupancy_Ring_"<<ring;
281  meMap[os.str()] = ibooker.book1D(os.str(), os.str(), RPCMonitorDigi::numberOfDisks_*2 , 0.5, ((double)RPCMonitorDigi::numberOfDisks_*2.0)+0.5);
282  for(int xbin= 1 ; xbin<= RPCMonitorDigi::numberOfDisks_*2 ; xbin++) {
283  label.str("");
284  if (xbin < RPCMonitorDigi::numberOfDisks_+1) label<<"Disk "<< (xbin -(RPCMonitorDigi::numberOfDisks_+1));
285  else label<<"Disk "<< (xbin - RPCMonitorDigi::numberOfDisks_);
286  meMap[os.str()] ->setBinLabel(xbin, label.str(), 1);
287  }
288  }
289 
290 
291 
292 
293  // return meMap;
294 }
295 
296 
297 
298 //returns the number of strips in each roll
301  iSetup.get<MuonGeometryRecord>().get(rpcgeo);
302 
303  const RPCRoll * rpcRoll = rpcgeo->roll(id);
304 
305  if (!rpcRoll) return 1;
306 
307  return rpcRoll->nstrips();
308 
309 
310 
311 }
312 
313 
314 void RPCMonitorDigi::bookRegionME(DQMStore::IBooker &ibooker,const std::string & recHitType, std::map<std::string, MonitorElement*> & meMap) {
315  //std::map<std::string, MonitorElement*> RPCMonitorDigi::bookRegionME(std::string recHitType) {
316 
317  // std::map<std::string, MonitorElement*> meMap;
318 
319  std::string currentFolder = subsystemFolder_ +"/"+recHitType+"/"+ globalFolder_;
320  ibooker.setCurrentFolder(currentFolder);
321 
322  std::stringstream name;
323  std::stringstream title;
324  for(int r = 0; r < 3; r++){ //RPC regions are E-, B, and E+
325 
327  //Cluster size
328  name.str("");
329  title.str("");
330  name<<"ClusterSize_"<< regionName;
331  title<< "ClusterSize - "<<regionName;
332  meMap[name.str()] = ibooker.book1D(name.str(), title.str(), 16, 0.5, 16.5);
333 
334 
335  }
336 
337 
338  //Number of Cluster
339  name.str("");
340  title.str("");
341  name<<"NumberOfClusters_Barrel";
342  title<< "Number of Clusters per Event - Barrel";
343  meMap[name.str()] = ibooker.book1D(name.str(), title.str(), 30, 0.5, 30.5);
344 
345  name.str("");
346  title.str("");
347  name<<"NumberOfClusters_Endcap+";
348  title<< "Number of Clusters per Event - Endcap+";
349  meMap[name.str()] = ibooker.book1D(name.str(), title.str(), 15, 0.5, 15.5);
350 
351  name.str("");
352  title.str("");
353  name<<"NumberOfClusters_Endcap-";
354  title<< "Number of Clusters per Event - Endcap-";
355  meMap[name.str()] = ibooker.book1D(name.str(), title.str(), 15, 0.5, 15.5);
356 
357  //Number of Digis
358  name.str("");
359  title.str("");
360  name<<"Multiplicity_Barrel";
361  title<< "Multiplicity per Event per Roll - Barrel";
362  meMap[name.str()] = ibooker.book1D(name.str(), title.str(), 50, 0.5, 50.5);
363 
364 
365  name.str("");
366  title.str("");
367  name<<"Multiplicity_Endcap+";
368  title<< "Multiplicity per Event per Roll - Endcap+";
369  meMap[name.str()] = ibooker.book1D(name.str(), title.str(), 32, 0.5, 32.5);
370 
371  name.str("");
372  title.str("");
373  name<<"Multiplicity_Endcap-";
374  title<< "Multiplicity per Event per Roll - Endcap-";
375  meMap[name.str()] = ibooker.book1D(name.str(), title.str(), 32, 0.5, 32.5);
376 
377 
378  for(int layer = 1 ; layer <= 6 ; layer ++){
379 
380  name.str("");
381  title.str("");
382  name<<"ClusterSize_Layer"<< layer;
383  title<< "ClusterSize - Layer"<<layer;
384  meMap[name.str()] = ibooker.book1D(name.str(), title.str(), 16, 0.5, 16.5);
385  }
386 
387  for(int ring = RPCMonitorDigi::numberOfInnerRings_ ; ring <= 3 ; ring ++){
388 
389  name.str("");
390  title.str("");
391  name<<"ClusterSize_Ring"<< ring;
392  title<< "ClusterSize - Ring"<<ring;
393  meMap[name.str()] = ibooker.book1D(name.str(), title.str(), 16, 0.5, 16.5);
394 
395  }
396 
397 
398  meMap["Occupancy_for_Endcap"] = ibooker.book2D("Occupancy_for_Endcap", "Occupancy Endcap", (int)RPCMonitorDigi::numberOfDisks_*2.0 , 0.5, ((float)RPCMonitorDigi::numberOfDisks_*2.0)+0.5, 2, 1.5, 3.5);
399  meMap["Occupancy_for_Endcap"] ->setAxisTitle("Disk", 1);
400  meMap["Occupancy_for_Endcap"] ->setAxisTitle("Ring", 2);
401 
402  std::stringstream binlabel;
403  for (int bin = 1 ; bin <= RPCMonitorDigi::numberOfDisks_*2 ; bin++){
404  binlabel.str("");
405  if(bin< (RPCMonitorDigi::numberOfDisks_+1)) {//negative endcap
406  binlabel<<(bin-( RPCMonitorDigi::numberOfDisks_+1));
407  }else{//positive endcaps
408  binlabel<<(bin- RPCMonitorDigi::numberOfDisks_);
409  }
410  meMap["Occupancy_for_Endcap"]->setBinLabel( bin , binlabel.str(), 1);
411  }
412 
413  meMap["Occupancy_for_Endcap"]->setBinLabel( 1 , "2", 2);
414  meMap["Occupancy_for_Endcap"]->setBinLabel( 2 , "3", 2);
415 
416  meMap["Occupancy_for_Barrel"] = ibooker.book2D("Occupancy_for_Barrel", "Occupancy Barrel", 12, 0.5 , 12.5, 5, -2.5, 2.5 );
417  meMap["Occupancy_for_Barrel"] ->setAxisTitle("Sec", 1);
418  meMap["Occupancy_for_Barrel"] ->setAxisTitle("Wheel", 2);
419 
420  for (int bin = 1 ; bin <= 12 ; bin++){
421  binlabel.str("");
422  binlabel<<bin;
423  meMap["Occupancy_for_Barrel"]->setBinLabel( bin , binlabel.str(), 1);
424  if(bin <= 5 ){
425  binlabel.str("");
426  binlabel<< (bin - 3);
427  meMap["Occupancy_for_Barrel"]->setBinLabel( bin , binlabel.str(), 2);
428  }
429  }
430  // return meMap;
431 
432 }
virtual std::string chambername()
Definition: RPCGeomServ.cc:122
std::string globalFolder_
int nstrips() const
Definition: RPCRoll.cc:46
void labelXAxisSegment(MonitorElement *myMe)
Definition: utils.h:250
void labelYAxisRoll(MonitorElement *myMe, int region, int ring, bool useRollInfo)
Definition: utils.h:268
void bookSectorRingME(DQMStore::IBooker &, const std::string &, std::map< std::string, MonitorElement * > &)
Booking of MonitoringElement at Sector/Ring level.
static const std::string regionNames_[3]
Geometry.
virtual std::string name()
Definition: RPCGeomServ.cc:20
void labelYAxisRing(MonitorElement *myMe, int numberOfRings, bool useRollInfo)
Definition: utils.h:295
int ring() const
Definition: RPCDetId.h:72
void bookRollME(DQMStore::IBooker &, RPCDetId &, const edm::EventSetup &, const std::string &, std::map< std::string, MonitorElement * > &)
Booking of MonitoringElement for one RPCDetId (= roll)
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
void tag(MonitorElement *, unsigned int)
Definition: DQMStore.cc:289
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
void labelXAxisSector(MonitorElement *myMe)
Definition: utils.h:236
bin
set the eta bin as selection string.
int layer() const
Definition: RPCDetId.h:108
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:277
std::string folderStructure(RPCDetId detId)
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
const T & get() const
Definition: EventSetup.h:56
int stripsInRoll(RPCDetId &, const edm::EventSetup &)
void bookWheelDiskME(DQMStore::IBooker &, const std::string &, std::map< std::string, MonitorElement * > &)
Booking of MonitoringElemnt at Wheel/Disk level.
void bookRegionME(DQMStore::IBooker &, const std::string &, std::map< std::string, MonitorElement * > &)
Booking of MonitoringElemnt at region (Barrel/Endcap) level.
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
std::string subsystemFolder_
const RPCRoll * roll(RPCDetId id) const
Return a roll given its id.
Definition: RPCGeometry.cc:75
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
Definition: RPCDetId.h:63
int station() const
Definition: RPCDetId.h:96