CMS 3D CMS Logo

HcalRecoParams_PayloadInspector.cc
Go to the documentation of this file.
6 
7 // the data format of the condition to be inspected
9 
10 #include "TH2F.h"
11 #include "TCanvas.h"
12 #include "TLine.h"
13 #include "TStyle.h"
14 #include "TLatex.h"
15 #include "TPave.h"
16 #include "TPaveStats.h"
17 #include <string>
18 #include <fstream>
19 
20 namespace {
21 
22  /********************************************
23  printing float values of reco paramters
24  *********************************************/
25  class HcalRecoParamsSummary : public cond::payloadInspector::PlotImage<HcalRecoParams> {
26  public:
27  HcalRecoParamsSummary() : cond::payloadInspector::PlotImage<HcalRecoParams>("HCAL RecoParam Ratios - map ") {
28  setSingleIov( true );
29  }
30 
31  bool fill( const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs ) override{
32 
33 
34  auto iov = iovs.front();
35  std::shared_ptr<HcalRecoParams> payload = fetchPayload( std::get<1>(iov) );
36  if(payload.get()) {
37 
38  std::string subDetName;
39  std::vector<HcalRecoParam> itemsVec;
40  std::pair<std::string,int> valMap;
41 
42 
43  //TODO: Abstract into a function that takes valMap as the argument
44 
45  TLatex label,val;
46  TLine* ll;
47  TLine* lr;
48  TLine* lt;
49  TLine* lb;
50  TCanvas* can = new TCanvas("RecoParamsSummary","RecoParamsSummary",1680, 1680);
51  //can->cd();
52  //HcalObjRepresent::drawTable(2,2);
53  can->Divide(2,2,0,0);
54  int i = 1;
55  int psID;
56  label.SetNDC();
57  label.SetTextAlign(26);
58  label.SetTextSize(0.05);
59  label.SetTextColor(2);
60  label.DrawLatex(0.5, 0.96,Form("Hcal Pulse Shape IDs"));
61 
62  for(std::pair< std::string, std::vector<HcalRecoParam> > cont : (*payload).getAllContainers()){
63  psID = 0;
64  subDetName = std::get<0>(cont);
65  if(subDetName[0] != 'H' || subDetName == "HT") continue;
66  itemsVec = std::get<1>(cont);
67  //valMap.insert(std::make_pair(subDetName,itemsVec.front().pulseShapeID()));
68  can->cd(i);
69  ll = new TLine(0,0,0,1);
70  ll->SetLineWidth(4);
71  ll->Draw();
72  lt = new TLine(0,1,1,1);
73  lt->SetLineWidth(4);
74  lt->Draw();
75  lb = new TLine(0,0,1,0);
76  lb->SetLineWidth(4);
77  lb->Draw();
78  lr = new TLine(1,0,1,1);
79  lr->SetLineWidth(4);
80  lr->Draw();
81  label.SetNDC();
82  label.SetTextAlign(26);
83  label.SetTextSize(0.15);
84  //label.SetTextColor(2);
85  label.DrawLatex(0.5, 0.75, subDetName.c_str());
86  val.SetNDC();
87  val.SetTextAlign(26);
88  val.SetTextSize(0.1);
89 // val.SetTextColor(1);
90  std::vector<HcalRecoParam>::iterator it;
91  for(it = itemsVec.begin(); it != itemsVec.end(); it++) {
92  psID = (*it).pulseShapeID();
93  if(psID != 0) {
94  psID = (*it).pulseShapeID();
95  break;
96  }
97  }
98  val.DrawLatex(0.5, 0.25, std::to_string(psID).c_str());
99  i++;
100  }
101 
102 
103 
104 
105  std::string ImageName(m_imageFileName);
106  can->SaveAs(ImageName.c_str());
107  return false;
108  } else return false;
109  }// fill method
110  };
111 //TODO: Add a Change Summary?
112 
113 } // close namespace
114 
115  // Register the classes as boost python plugin
117  PAYLOAD_INSPECTOR_CLASS(HcalRecoParamsSummary);
118 }
std::shared_ptr< PayloadType > fetchPayload(const cond::Hash &payloadHash)
char const * label
#define PAYLOAD_INSPECTOR_CLASS(CLASS_NAME)
virtual bool fill(const std::vector< std::tuple< cond::Time_t, cond::Hash > > &iovs)=0
#define PAYLOAD_INSPECTOR_MODULE(PAYLOAD_TYPENAME)
Definition: plugin.cc:24