CMS 3D CMS Logo

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