Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-08-21 04:46:12

0001 /*!
0002   \file L1TMuonGlobalParams_PayloadInspector
0003   \Payload Inspector Plugin for L1TMuonGlobalParams payloads
0004   \author Y. Chao
0005   \version $Revision: 1.0 $
0006   \date $Date: 2024/05/15 12:00:00 $
0007 */
0008 
0009 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0010 
0011 #include "CondCore/Utilities/interface/PayloadInspectorModule.h"
0012 #include "CondCore/Utilities/interface/PayloadInspector.h"
0013 #include "CondCore/CondDB/interface/Time.h"
0014 
0015 // the data format of the condition to be inspected
0016 #include "CondFormats/L1TObjects/interface/L1TMuonGlobalParams.h"
0017 
0018 #include "L1Trigger/L1TMuon/interface/L1TMuonGlobalParamsHelper.h"
0019 #include "L1Trigger/L1TMuon/interface/L1TMuonGlobalParams_PUBLIC.h"
0020 
0021 #include <fmt/format.h>
0022 
0023 // include ROOT
0024 #include "TH1F.h"
0025 #include "TLine.h"
0026 #include "TLegend.h"
0027 #include "TCanvas.h"
0028 #include "TLatex.h"
0029 
0030 namespace {
0031 
0032   using namespace cond::payloadInspector;
0033 
0034   class L1TMuonGlobalParamsInputBits : public PlotImage<L1TMuonGlobalParams, SINGLE_IOV> {
0035   public:
0036     L1TMuonGlobalParamsInputBits() : PlotImage<L1TMuonGlobalParams, SINGLE_IOV>("L1TMuonGlobalParams plot") {}
0037 
0038     bool fill() override {
0039       auto tag = PlotBase::getTag<0>();
0040       auto iov = tag.iovs.front();
0041 
0042       std::string IOVsince = std::to_string(std::get<0>(iov));
0043       std::shared_ptr<L1TMuonGlobalParams> payload = fetchPayload(std::get<1>(iov));
0044       if (payload.get()) {
0045         /// Create a canvas
0046         edm::LogInfo("L1TMG") << "absIsoCheckMemLUTPath: " << payload->absIsoCheckMemLUTPath();
0047         TCanvas canvas("L1TMuonGlobal", "L1TMuonGlobal", 800, 600);
0048 
0049         L1TMuonGlobalParams l1tmg = (L1TMuonGlobalParams)*payload;
0050         L1TMuonGlobalParamsHelper l1tmgph(l1tmg);
0051 
0052         canvas.cd();
0053         canvas.Update();
0054 
0055         TLatex tl;
0056         // Draw the columns titles
0057         tl.SetTextAlign(12);
0058         tl.SetTextSize(0.03);
0059 
0060         TH1F input1("InputsToDisable", "", 72, 0, 72);
0061         TH1F input2("MaskedInputs", "", 72, 0, 72);
0062 
0063         TLegend leg(0.60, 0.65, 0.85, 0.85);
0064 
0065         TLine lzero(0.0, 2.0, 72., 2.0);
0066         lzero.SetLineWidth(1);
0067         lzero.SetLineColor(1);
0068         lzero.SetLineStyle(2);
0069 
0070         leg.AddEntry(&input2, "MaskedInputs", "l");
0071         leg.AddEntry(&input1, "InputsToDisable", "l");
0072         leg.SetLineColor(0);
0073         leg.SetFillColor(0);
0074 
0075         input1.SetStats(0);
0076         input1.SetMaximum(5);
0077         input1.SetXTitle("InputBits");
0078         input1.SetYTitle("Bit value");
0079         input1.SetLabelOffset(0.9, "Y");
0080         input1.SetLineWidth(3);
0081         input1.SetLineColor(9);
0082         input2.SetLineWidth(3);
0083         input1.SetLineColor(8);
0084 
0085         for (size_t idx = 1; idx <= 72; idx++) {
0086           input1.SetBinContent(idx, l1tmgph.inputsToDisable()[idx] + 0.01);
0087           input2.SetBinContent(idx, l1tmgph.maskedInputs()[idx] + 2.01);
0088         }
0089 
0090         canvas.cd();
0091         input1.Draw("");
0092         input2.Draw("same");
0093         leg.Draw();
0094         lzero.Draw();
0095 
0096         auto const label_fw =
0097             fmt::format("fwVersion: {}, bx Min, Max: {}, {}", l1tmgph.fwVersion(), payload->bxMin(), payload->bxMax());
0098         auto const label_tag = fmt::format("{}, iov: {}", tag.name, IOVsince);
0099         tl.DrawLatexNDC(0.12, 0.85, label_fw.c_str());
0100         tl.DrawLatexNDC(0.10, 0.92, label_tag.c_str());
0101         tl.DrawLatexNDC(0.07, 0.59, "1");
0102         tl.DrawLatexNDC(0.07, 0.27, "1");
0103 
0104         std::string fileName(m_imageFileName);
0105         canvas.SaveAs(fileName.c_str());
0106       }  // payload
0107       return true;
0108     }  // fill
0109   };
0110 
0111 }  // namespace
0112 
0113 PAYLOAD_INSPECTOR_MODULE(L1TMuonGlobalParams) { PAYLOAD_INSPECTOR_CLASS(L1TMuonGlobalParamsInputBits); }