CMS 3D CMS Logo

EcalTPGWeightIdMap_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  2d plot of Ecal TPG Weight Id Map of 1 IOV
24  ******************************************/
25  class EcalTPGWeightIdMapPlot : public cond::payloadInspector::PlotImage<EcalTPGWeightIdMap> {
26  public:
27  EcalTPGWeightIdMapPlot() : cond::payloadInspector::PlotImage<EcalTPGWeightIdMap>("Ecal TPG Weight Id Map - map ") {
28  setSingleIov(true);
29  }
30 
31  bool fill(const std::vector<std::tuple<cond::Time_t, cond::Hash> >& iovs) override {
32  auto iov = iovs.front();
33  std::shared_ptr<EcalTPGWeightIdMap> payload = fetchPayload(std::get<1>(iov));
34  unsigned int run = std::get<0>(iov);
35  TH2F* align;
36  int NbRows;
37 
38  if (payload.get()) {
39  EcalTPGWeightIdMap::EcalTPGWeightMap map = (*payload).getMap();
40  NbRows = map.size();
41 
42  align = new TH2F("Ecal TPG Weight Id Map",
43  "MapKey w0 w1 w2 w3 "
44  " w4",
45  6,
46  0,
47  6,
48  NbRows,
49  0,
50  NbRows);
51 
52  double row = NbRows - 0.5;
53  for (EcalTPGWeightIdMap::EcalTPGWeightMapItr it = map.begin(); it != map.end(); it++) {
54  uint32_t mapKey = it->first;
55  EcalTPGWeights item = it->second;
56  uint32_t w0, w1, w2, w3, w4;
57  item.getValues(w0, w1, w2, w3, w4);
58 
59  align->Fill(0.5, row, mapKey + 1);
60  align->Fill(1.5, row, w0);
61  align->Fill(2.5, row, w1);
62  align->Fill(3.5, row, w2);
63  align->Fill(4.5, row, w3);
64  align->Fill(5.5, row, w4);
65 
66  row = row - 1.;
67  } //loop over EcalTPGWeightIdMap rows
68 
69  } else
70  return false;
71 
72  gStyle->SetPalette(1);
73  gStyle->SetOptStat(0);
74  TCanvas canvas("CC map", "CC map", 1000, 1000);
75  TLatex t1;
76  t1.SetNDC();
77  t1.SetTextAlign(26);
78  t1.SetTextSize(0.05);
79  t1.SetTextColor(2);
80  t1.DrawLatex(0.5, 0.96, Form("Ecal TPG Weight Id Map, IOV %i", run));
81 
82  TPad* pad = new TPad("pad", "pad", 0.0, 0.0, 1.0, 0.94);
83  pad->Draw();
84  pad->cd();
85  align->Draw("TEXT");
86 
87  drawTable(NbRows, 6);
88 
89  align->GetXaxis()->SetTickLength(0.);
90  align->GetXaxis()->SetLabelSize(0.);
91  align->GetYaxis()->SetTickLength(0.);
92  align->GetYaxis()->SetLabelSize(0.);
93 
94  std::string ImageName(m_imageFileName);
95  canvas.SaveAs(ImageName.c_str());
96 
97  return true;
98  }
99  };
100 
101 } // namespace
102 // Register the classes as boost python plugin
svgfig.canvas
def canvas(*sub, **attr)
Definition: svgfig.py:482
w2
common ppss p3p6s2 common epss epspn46 common const1 w2
Definition: inclppp.h:1
EcalTPGWeightIdMap
Definition: EcalTPGWeightIdMap.h:10
align
Definition: AlignableIndexer.h:30
PayloadInspector.h
EBDetId.h
EEDetId.h
EcalTPGWeightIdMap::EcalTPGWeightMapItr
std::map< uint32_t, EcalTPGWeights >::const_iterator EcalTPGWeightMapItr
Definition: EcalTPGWeightIdMap.h:13
PAYLOAD_INSPECTOR_CLASS
#define PAYLOAD_INSPECTOR_CLASS(CLASS_NAME)
Definition: PayloadInspectorModule.h:10
EcalTPGWeightIdMap::EcalTPGWeightMap
std::map< uint32_t, EcalTPGWeights > EcalTPGWeightMap
Definition: EcalTPGWeightIdMap.h:12
PayloadInspectorModule.h
RandomServiceHelper.t1
t1
Definition: RandomServiceHelper.py:256
jets_cff.payload
payload
Definition: jets_cff.py:32
w4
common ppss p3p6s2 common epss epspn46 common const1 w4
Definition: inclppp.h:1
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:905
w3
common ppss p3p6s2 common epss epspn46 common const1 w3
Definition: inclppp.h:1
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
EcalDrawUtils.h
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
EcalTPGWeights
Definition: EcalTPGWeights.h:9
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:894
genParticles_cff.map
map
Definition: genParticles_cff.py:11
EcalTPGWeightIdMap.h