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
svgfig.canvas
def canvas(*sub, **attr)
Definition: svgfig.py:482
ecaldqm::zside
int zside(DetId const &)
Definition: EcalDQMCommonUtils.cc:189
mps_merge.weight
weight
Definition: mps_merge.py:88
PayloadInspector.h
EBDetId.h
EEDetId.h
EcalScDetId::unhashIndex
static EcalScDetId unhashIndex(int hi)
Definition: EcalScDetId.h:117
ecaldqm::ttId
unsigned ttId(DetId const &)
Definition: EcalDQMCommonUtils.cc:101
PAYLOAD_INSPECTOR_CLASS
#define PAYLOAD_INSPECTOR_CLASS(CLASS_NAME)
Definition: PayloadInspectorModule.h:10
PayloadInspectorModule.h
EcalTPGFineGrainTowerEE.h
EcalTPGFineGrainTowerEE
Definition: EcalTPGFineGrainTowerEE.h:9
RandomServiceHelper.t1
t1
Definition: RandomServiceHelper.py:256
EcalTPGFineGrainTowerEEMapIterator
std::map< uint32_t, uint32_t >::const_iterator EcalTPGFineGrainTowerEEMapIterator
Definition: EcalTPGFineGrainTowerEE.h:25
EcalTPGFineGrainTowerEEMap
std::map< uint32_t, uint32_t > EcalTPGFineGrainTowerEEMap
Definition: EcalTPGFineGrainTowerEE.h:24
EcalScDetId
Definition: EcalScDetId.h:24
jets_cff.payload
payload
Definition: jets_cff.py:34
PAYLOAD_INSPECTOR_MODULE
#define PAYLOAD_INSPECTOR_MODULE(PAYLOAD_TYPENAME)
Definition: PayloadInspectorModule.h:8
EcalTrigTowerDetId.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
EcalSubdetector.h
cond
Definition: plugin.cc:23
DrawEE_Tower
void DrawEE_Tower(TH2F *endc, TLine *l, double minScale, double maxScale)
Definition: EcalDrawUtils.h:65
cond::payloadInspector::PlotImage::fetchPayload
std::shared_ptr< PayloadType > fetchPayload(const cond::Hash &payloadHash)
Definition: PayloadInspector.h:840
EcalScDetId::validHashIndex
static bool validHashIndex(int hi)
Definition: EcalScDetId.h:139
EcalDrawUtils.h
cmsLHEtoEOSManager.l
l
Definition: cmsLHEtoEOSManager.py:193
writedatasetfile.run
run
Definition: writedatasetfile.py:27
cond::payloadInspector::PlotImpl::fill
virtual bool fill()=0
cond::payloadInspector::PlotImage
Definition: PayloadInspector.h:829
weight
Definition: weight.py:1