Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #include "DQM/RPCMonitorClient/interface/RPCDcsInfoClient.h"
0002 
0003 RPCDcsInfoClient::RPCDcsInfoClient(const edm::ParameterSet& ps)
0004     : dcsinfofolder_(ps.getUntrackedParameter<std::string>("dcsInfoFolder", "RPC/DCSInfo")),
0005       eventinfofolder_(ps.getUntrackedParameter<std::string>("eventInfoFolder", "RPC/EventInfo")),
0006       dqmprovinfofolder_(ps.getUntrackedParameter<std::string>("dqmProvInfoFolder", "Info/EventInfo")) {}
0007 
0008 void RPCDcsInfoClient::dqmEndJob(DQMStore::IBooker& ibooker, DQMStore::IGetter& igetter) {
0009   // book
0010   ibooker.cd();
0011   ibooker.setCurrentFolder(dcsinfofolder_);
0012 
0013   MonitorElement* reportSummaryMap = igetter.get(dqmprovinfofolder_ + "/reportSummaryMap");
0014   MonitorElement* eventInfoLumi = igetter.get(eventinfofolder_ + "/iLumiSection");
0015 
0016   if (!reportSummaryMap)
0017     return;
0018 
0019   TH2F* h2 = reportSummaryMap->getTH2F();
0020   if (!h2)
0021     return;
0022   const int maxLS = reportSummaryMap->getNbinsX();
0023 
0024   int nLS = eventInfoLumi->getIntValue();
0025   if (nLS <= 0 or nLS > maxLS) {
0026     // If the nLS from the event info is not valid, we take the value from the
0027     // reportSummaryMap. The histogram is initialized with -1 value then filled
0028     // with non-negative value for valid LSs.
0029     // Note that we start from the first bin, since many runs have small nLS.
0030     for (nLS = 1; nLS <= maxLS; ++nLS) {
0031       const double dcsBit = h2->GetBinContent(nLS, 1);
0032       if (dcsBit == -1)
0033         break;
0034     }
0035   }
0036 
0037   MonitorElement* rpcHVStatus = ibooker.book2D("rpcHVStatus", "RPC HV Status", nLS, 1., nLS + 1, 1, 0.5, 1.5);
0038   rpcHVStatus->setAxisTitle("Luminosity Section", 1);
0039   rpcHVStatus->setBinLabel(1, "", 2);
0040 
0041   // Find bin number of RPC from the EventInfo's reportSummaryMap
0042   int binRPC = 0;
0043   for (int i = 1, nbinsY = reportSummaryMap->getNbinsY(); i <= nbinsY; ++i) {
0044     const std::string binLabel = h2->GetYaxis()->GetBinLabel(i);
0045     if (binLabel == "RPC") {
0046       binRPC = i;
0047       break;
0048     }
0049   }
0050   if (binRPC == 0)
0051     return;
0052 
0053   // Take bin contents from the reportSummaryMap and fill into the RPC DCSInfo
0054   int nLSRPC = 0;
0055   for (int i = 1; i <= nLS; ++i) {
0056     const double dcsBit = h2->GetBinContent(i, binRPC);
0057     const int hvStatus = (dcsBit != -1) ? 1 : 0;
0058     if (hvStatus != 0) {
0059       ++nLSRPC;
0060       rpcHVStatus->setBinContent(i, 1, hvStatus);
0061     }
0062   }
0063 
0064   MonitorElement* rpcHV = ibooker.bookInt("rpcHV");
0065   rpcHV->Fill(nLSRPC);
0066 }