CMS 3D CMS Logo

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