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