CMS 3D CMS Logo

EcalDCUTemperatures_PayloadInspector.cc
Go to the documentation of this file.
7 
8 // the data format of the condition to be inspected
10 
11 #include "TH2F.h" // a 2-D histogram with four bytes per cell (float)
12 #include "TCanvas.h"
13 #include "TLine.h"
14 #include "TStyle.h"
15 #include "TLatex.h" //write mathematical equations.
16 #include "TPave.h"
17 #include "TPaveStats.h"
18 #include <string>
19 #include <fstream>
20 
21 namespace {
22 
23  /*******************************************************
24  2d plot of Ecal DCU Temperatures of 1 IOV
25  *******************************************************/
26  class EcalDCUTemperaturesPlot : public cond::payloadInspector::PlotImage<EcalDCUTemperatures> {
27  public:
28  EcalDCUTemperaturesPlot() : cond::payloadInspector::PlotImage<EcalDCUTemperatures>("Ecal DCU Temperatures - map ") {
29  setSingleIov(true);
30  }
31 
32  bool fill(const std::vector<std::tuple<cond::Time_t, cond::Hash> >& iovs) override {
33  auto iov = iovs.front();
34  std::shared_ptr<EcalDCUTemperatures> payload = fetchPayload(std::get<1>(iov));
35  unsigned int run = std::get<0>(iov);
36  TH2F* align;
37  int NbRows;
38 
39  if (payload.get()) {
40  EcalDCUTemperatures::EcalDCUTemperatureMap map = (*payload).getMap();
41  NbRows = map.size();
42  align = new TH2F("Ecal DCU Temperatures", "Key DCUTemperature", 2, 0, 2, NbRows, 0, NbRows);
43 
44  double row = NbRows - 0.5;
45 
46  for (EcalDCUTemperatures::EcalDCUTemperatureMap::const_iterator it = map.begin(); it != map.end(); it++) {
47  uint32_t mapKey = it->first;
48  float val = it->second;
49 
50  align->Fill(0.5, row, mapKey);
51  align->Fill(1.5, row, val);
52 
53  row--;
54  }
55 
56  } else
57  return false;
58 
59  gStyle->SetPalette(1);
60  gStyle->SetOptStat(0);
61  TCanvas canvas("CC map", "CC map", 1000, 1000);
62  TLatex t1;
63  t1.SetNDC();
64  t1.SetTextAlign(26);
65  t1.SetTextSize(0.05);
66  t1.SetTextColor(2);
67  t1.DrawLatex(0.5, 0.96, Form("Ecal DCU Temperatures, IOV %i", run));
68 
69  TPad* pad = new TPad("pad", "pad", 0.0, 0.0, 1.0, 0.94);
70  pad->Draw();
71  pad->cd();
72  align->Draw("TEXT");
73 
74  drawTable(NbRows, 2);
75 
76  align->GetXaxis()->SetTickLength(0.);
77  align->GetXaxis()->SetLabelSize(0.);
78  align->GetYaxis()->SetTickLength(0.);
79  align->GetYaxis()->SetLabelSize(0.);
80 
81  std::string ImageName(m_imageFileName);
82  canvas.SaveAs(ImageName.c_str());
83 
84  return true;
85  }
86  };
87 
88 } // namespace
89 
90 // Register the classes as boost python plugin
svgfig.canvas
def canvas(*sub, **attr)
Definition: svgfig.py:482
EcalDCUTemperatures
Definition: EcalDCUTemperatures.h:14
EcalDCUTemperatures.h
align
Definition: AlignableIndexer.h:30
PayloadInspector.h
EBDetId.h
EEDetId.h
PAYLOAD_INSPECTOR_CLASS
#define PAYLOAD_INSPECTOR_CLASS(CLASS_NAME)
Definition: PayloadInspectorModule.h:10
PayloadInspectorModule.h
RandomServiceHelper.t1
t1
Definition: RandomServiceHelper.py:256
EcalDCUTemperatures::EcalDCUTemperatureMap
std::map< uint32_t, float > EcalDCUTemperatureMap
Definition: EcalDCUTemperatures.h:16
jets_cff.payload
payload
Definition: jets_cff.py:34
PAYLOAD_INSPECTOR_MODULE
#define PAYLOAD_INSPECTOR_MODULE(PAYLOAD_TYPENAME)
Definition: PayloadInspectorModule.h:8
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
cond
Definition: plugin.cc:23
Time.h
cond::payloadInspector::PlotImage::fetchPayload
std::shared_ptr< PayloadType > fetchPayload(const cond::Hash &payloadHash)
Definition: PayloadInspector.h:840
EcalDrawUtils.h
heppy_batch.val
val
Definition: heppy_batch.py:351
writedatasetfile.run
run
Definition: writedatasetfile.py:27
cond::payloadInspector::PlotImpl::fill
virtual bool fill()=0
drawTable
void drawTable(int nbRows, int nbColumns)
Definition: EcalDrawUtils.h:91
cond::payloadInspector::PlotImage
Definition: PayloadInspector.h:829
genParticles_cff.map
map
Definition: genParticles_cff.py:11