File indexing completed on 2024-04-06 12:01:32
0001 #include "CondCore/Utilities/interface/PayloadInspectorModule.h"
0002 #include "CondCore/Utilities/interface/PayloadInspector.h"
0003 #include "CondCore/CondDB/interface/Time.h"
0004 #include "DataFormats/EcalDetId/interface/EBDetId.h"
0005 #include "DataFormats/EcalDetId/interface/EEDetId.h"
0006 #include "CondCore/EcalPlugins/plugins/EcalDrawUtils.h"
0007 #include "CondCore/EcalPlugins/plugins/EcalFunctionParametersUtils.h"
0008
0009 #include "CondFormats/EcalObjects/interface/EcalClusterEnergyUncertaintyParameters.h"
0010
0011 #include "TH2F.h" // a 2-D histogram with four bytes per cell (float)
0012 #include "TCanvas.h"
0013 #include "TLine.h"
0014 #include "TStyle.h"
0015 #include "TLatex.h" //write mathematical equations.
0016 #include "TPave.h"
0017 #include "TPaveStats.h"
0018 #include <string>
0019 #include <fstream>
0020 #include <cmath>
0021 #include <cmath>
0022
0023 namespace {
0024
0025
0026
0027 class EcalClusterEnergyUncertaintyParametersPlot
0028 : public cond::payloadInspector::PlotImage<EcalClusterEnergyUncertaintyParameters> {
0029 public:
0030 EcalClusterEnergyUncertaintyParametersPlot()
0031 : cond::payloadInspector::PlotImage<EcalClusterEnergyUncertaintyParameters>(
0032 "Ecal Cluster Energy Uncertainty Parameters - map ") {
0033 setSingleIov(true);
0034 }
0035
0036 bool fill(const std::vector<std::tuple<cond::Time_t, cond::Hash> >& iovs) override {
0037 auto iov = iovs.front();
0038 std::shared_ptr<EcalClusterEnergyUncertaintyParameters> payload =
0039 fetchPayload(std::get<1>(iov));
0040 unsigned int run = std::get<0>(iov);
0041 TH2F* align;
0042
0043 int gridRows;
0044 int NbColumns;
0045
0046 if (payload.get()) {
0047 align = new TH2F("", "", 0, 0, 0, 0, 0, 0);
0048 fillFunctionParamsValues(
0049 align, (*payload).params(), "Ecal Cluster Energy Uncertainty Parameters", gridRows, NbColumns);
0050
0051 }
0052 else
0053 return false;
0054
0055 gStyle->SetPalette(1);
0056 gStyle->SetOptStat(0);
0057 TCanvas canvas("CC map", "CC map", 1000, 1000);
0058 TLatex t1;
0059 t1.SetNDC();
0060 t1.SetTextAlign(26);
0061 t1.SetTextSize(0.04);
0062 t1.SetTextColor(2);
0063 t1.DrawLatex(0.5, 0.96, Form("Ecal Cluster Energy Uncertainty Parameters, IOV %i", run));
0064
0065 TPad* pad = new TPad("pad", "pad", 0.0, 0.0, 1.0, 0.94);
0066 pad->Draw();
0067 pad->cd();
0068 align->Draw("TEXT");
0069
0070 drawTable(gridRows, NbColumns);
0071
0072 align->GetXaxis()->SetTickLength(0.);
0073 align->GetXaxis()->SetLabelSize(0.);
0074 align->GetYaxis()->SetTickLength(0.);
0075 align->GetYaxis()->SetLabelSize(0.);
0076
0077 std::string ImageName(m_imageFileName);
0078 canvas.SaveAs(ImageName.c_str());
0079 return true;
0080 }
0081 };
0082
0083 }
0084
0085
0086 PAYLOAD_INSPECTOR_MODULE(EcalClusterEnergyUncertaintyParameters) {
0087 PAYLOAD_INSPECTOR_CLASS(EcalClusterEnergyUncertaintyParametersPlot);
0088 }