CMS 3D CMS Logo

EcalTPGFineGrainTowerEE_PayloadInspector.cc
Go to the documentation of this file.
8 
9 // the data format of the condition to be inspected
11 
12 #include "TH2F.h"
13 #include "TCanvas.h"
14 #include "TStyle.h"
15 #include "TLine.h"
16 #include "TLatex.h"
17 
18 #include <string>
19 
20 namespace {
21 
22  /***********************************************
23  2d plot of EcalTPGFineGrainTowerEE of 1 IOV
24 ************************************************/
25  class EcalTPGFineGrainTowerEEPlot : public cond::payloadInspector::PlotImage<EcalTPGFineGrainTowerEE> {
26  public:
27  EcalTPGFineGrainTowerEEPlot()
28  : cond::payloadInspector::PlotImage<EcalTPGFineGrainTowerEE>("EcalTPGFineGrainTowerEE - map ") {
29  setSingleIov(true);
30  }
31 
32  bool fill(const std::vector<std::tuple<cond::Time_t, cond::Hash> >& iovs) override {
33  TH2F* endc_p = new TH2F("EE+", "EE+ Tower TPG FineGrain", 22, 0, 22, 22, 0, 22);
34  TH2F* endc_m = new TH2F("EE-", "EE- Tower TPG FineGrain", 22, 0, 22, 22, 0, 22);
35 
36  auto iov = iovs.front();
37  std::shared_ptr<EcalTPGFineGrainTowerEE> payload = fetchPayload(std::get<1>(iov));
38  unsigned int run = std::get<0>(iov);
39  double minEE = 0, maxEE = 1;
40 
41  if (payload.get()) {
42  const EcalTPGFineGrainTowerEEMap& towerMap = (*payload).getMap();
43 
45  for (it = towerMap.begin(); it != towerMap.end(); ++it) {
46  if (EcalScDetId::validHashIndex((*it).first)) {
48 
49  int ix = ttId.ix();
50  int iy = ttId.iy();
51  int zside = ttId.zside();
52 
53  uint32_t weight = (uint32_t)((*it).second);
54 
55  if (zside == -1)
56  endc_m->Fill(ix, iy, weight);
57  else
58  endc_p->Fill(ix, iy, weight);
59 
60  if (maxEE < weight)
61  maxEE = weight;
62 
63  if (minEE > weight)
64  minEE = weight;
65  }
66  } //tower map
67  } //payload
68 
69  TCanvas canvas("CC map", "CC map", 800, 800);
70  TLatex t1;
71  t1.SetNDC();
72  t1.SetTextAlign(26);
73  t1.SetTextSize(0.05);
74  t1.DrawLatex(0.5, 0.96, Form("Ecal TPGFineGrain Tower EE, IOV %i", run));
75 
76  TPad* padem = new TPad("padem", "padem", 0., 0.3, 0.45, 0.75);
77  padem->Draw();
78  TPad* padep = new TPad("padep", "padep", 0.55, 0.3, 1., 0.75);
79  padep->Draw();
80 
81  TLine* l = new TLine(0., 0., 72., 0.);
82  l->Draw();
83 
84  padem->cd();
85  DrawEE_Tower(endc_m, l, minEE, maxEE);
86 
87  padep->cd();
88  DrawEE_Tower(endc_p, l, minEE, maxEE);
89 
90  std::string ImageName(m_imageFileName);
91  canvas.SaveAs(ImageName.c_str());
92 
93  return true;
94  } // fill method
95  };
96 
97 } // namespace
98 
99 // Register the classes as boost python plugin
std::map< uint32_t, uint32_t >::const_iterator EcalTPGFineGrainTowerEEMapIterator
static EcalScDetId unhashIndex(int hi)
Definition: EcalScDetId.h:117
Definition: weight.py:1
int zside(DetId const &)
unsigned ttId(DetId const &, EcalElectronicsMapping const *)
#define PAYLOAD_INSPECTOR_CLASS(CLASS_NAME)
void DrawEE_Tower(TH2F *endc, TLine *l, double minScale, double maxScale)
Definition: EcalDrawUtils.h:65
#define PAYLOAD_INSPECTOR_MODULE(PAYLOAD_TYPENAME)
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t ix(uint32_t id)
std::map< uint32_t, uint32_t > EcalTPGFineGrainTowerEEMap
static bool validHashIndex(int hi)
Definition: EcalScDetId.h:139
def canvas(sub, attr)
Definition: svgfig.py:482
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t iy(uint32_t id)
std::shared_ptr< PayloadType > fetchPayload(const cond::Hash &payloadHash)