Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:08:13

0001 #include "DQM/RPCMonitorClient/interface/RPCSummaryMapHisto.h"
0002 #include <fmt/format.h>
0003 
0004 typedef dqm::implementation::MonitorElement MonitorElement;
0005 typedef dqm::implementation::IBooker IBooker;
0006 
0007 MonitorElement* RPCSummaryMapHisto::book(IBooker& booker, const std::string& name, const std::string& title) {
0008   MonitorElement* me = booker.book2D(name, title, 15, -7.5, 7.5, 12, 0.5, 12.5);
0009   me->getTH1()->SetMinimum(-1e-5);
0010 
0011   // Customize the 2d histogram
0012   for (int sec = 1; sec <= 12; ++sec) {
0013     me->setBinLabel(sec, fmt::format("Sec{}", sec), 2);
0014   }
0015 
0016   for (int disk = 1; disk <= 4; ++disk) {
0017     me->setBinLabel(11 + disk, fmt::format("Disk{}", disk), 1);
0018     me->setBinLabel(5 - disk, fmt::format("Disk{}", -disk), 1);
0019   }
0020 
0021   for (int wheel = -2; wheel <= 2; ++wheel) {
0022     me->setBinLabel(8 + wheel, fmt::format("Wheel{}", wheel), 1);
0023   }
0024 
0025   // Fill with -1 as the default value
0026   for (int sec = 1; sec <= 12; ++sec) {
0027     for (int xbin = 1; xbin <= 15; ++xbin) {
0028       me->setBinContent(xbin, sec, -1);
0029     }
0030   }
0031 
0032   return me;
0033 }
0034 
0035 void RPCSummaryMapHisto::setBinsBarrel(MonitorElement* me, const double value) {
0036   for (int wheel = -2; wheel <= 2; ++wheel) {
0037     for (int sector = 1; sector <= 12; ++sector) {
0038       setBinBarrel(me, wheel, sector, value);
0039     }
0040   }
0041 }
0042 
0043 void RPCSummaryMapHisto::setBinsEndcap(MonitorElement* me, const double value) {
0044   for (int disk = -4; disk <= 4; ++disk) {
0045     for (int sector = 1; sector <= 6; ++sector) {
0046       setBinEndcap(me, disk, sector, value);
0047     }
0048   }
0049 }
0050 
0051 void RPCSummaryMapHisto::setBinBarrel(MonitorElement* me, const int wheel, const int sector, const double value) {
0052   if (std::abs(wheel) > 2 or sector < 1 or sector > 12)
0053     return;
0054   me->setBinContent(8 + wheel, sector, value);
0055 }
0056 
0057 void RPCSummaryMapHisto::setBinEndcap(MonitorElement* me, const int disk, const int sector, const double value) {
0058   if (std::abs(disk) < 1 or std::abs(disk) > 4)
0059     return;
0060   if (sector < 1 or sector > 6)
0061     return;
0062 
0063   if (disk > 0) {
0064     me->setBinContent(11 + disk, sector, value);
0065   } else {
0066     me->setBinContent(5 + disk, sector, value);
0067   }
0068 }