CMS 3D CMS Logo

HcalChannelQuality_PayloadInspector.cc
Go to the documentation of this file.
4 //#include "DataFormats/EcalDetId/interface/EBDetId.h"
5 //#include "DataFormats/EcalDetId/interface/EEDetId.h"
7 //#include "Geometry/HcalCommonData/interface/HcalTopologyMode.h"
10 
11 // the data format of the condition to be inspected
12 #include "CondFormats/HcalObjects/interface/HcalChannelQuality.h" //or ChannelStatus.h???
13 
14 #include "TH2F.h"
15 #include "TCanvas.h"
16 #include "TLine.h"
17 #include "TStyle.h"
18 #include "TLatex.h"
19 #include "TPave.h"
20 #include "TPaveStats.h"
21 #include <string>
22 #include <fstream>
23 
24 namespace {
25 
26  class HcalChannelStatusContainer : public HcalObjRepresent::HcalDataContainer<HcalChannelQuality,HcalChannelStatus> {
27  public:
28  HcalChannelStatusContainer(std::shared_ptr<HcalChannelQuality> payload, unsigned int run) : HcalObjRepresent::HcalDataContainer<HcalChannelQuality,HcalChannelStatus>(payload, run) {}
29  float getValue(HcalChannelStatus* chan) override {
30  return chan->getValue()/32770;
31  }
32  };
33 
34  /******************************************
35  2d plot of ECAL ChannelStatusRatios of 1 IOV
36  ******************************************/
37  class HcalChannelQualityPlot : public cond::payloadInspector::PlotImage<HcalChannelQuality> {
38  public:
39  HcalChannelQualityPlot() : cond::payloadInspector::PlotImage<HcalChannelQuality>("HCAL ChannelStatus Ratios - map ") {
40  setSingleIov( true );
41  }
42 
43  bool fill( const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs ) override{
44 
45 
46  auto iov = iovs.front();
47  std::shared_ptr<HcalChannelQuality> payload = fetchPayload( std::get<1>(iov) );
48  if(payload.get()) {
49  HcalChannelStatusContainer* objContainer = new HcalChannelStatusContainer(payload, std::get<0>(iov));
50  std::string ImageName(m_imageFileName);
51  objContainer->getCanvasAll()->SaveAs(ImageName.c_str());
52  return true;} else return false;
53  }// fill method
54  };
55 
56  class HcalChannelQualityChange : public cond::payloadInspector::PlotImage<HcalChannelQuality> {
57  public:
58  HcalChannelQualityChange() : cond::payloadInspector::PlotImage<HcalChannelQuality>("HCAL ChannelStatus Ratios - map ") {
59  setSingleIov( false );
60  }
61 
62  bool fill( const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs ) override{
63 
64 
65  auto iov1 = iovs.front();
66  auto iov2 = iovs.back();
67  std::shared_ptr<HcalChannelQuality> payload1 = fetchPayload( std::get<1>(iov1) );
68  std::shared_ptr<HcalChannelQuality> payload2 = fetchPayload( std::get<1>(iov2) );
69  if(payload1.get() && payload2.get()) {
70  HcalChannelStatusContainer* objContainer1 = new HcalChannelStatusContainer(payload1, std::get<0>(iov1));
71  HcalChannelStatusContainer* objContainer2 = new HcalChannelStatusContainer(payload2, std::get<0>(iov2));
72 
73  objContainer2->Subtract(objContainer1);
74 //
75 // std::map< std::pair< std::string, int >, TH2F* > depths = objContainer1->GetDepths();
76 //
77 //
78 // TODO: How do I display this?
79 //
80 //
81  std::string ImageName(m_imageFileName);
82  objContainer2->getCanvasAll()->SaveAs(ImageName.c_str());
83  return true;} else return false;
84  }// fill method
85  };
86 } // close namespace
87 
88  // Register the classes as boost python plugin
90  PAYLOAD_INSPECTOR_CLASS(HcalChannelQualityPlot);
91  PAYLOAD_INSPECTOR_CLASS(HcalChannelQualityChange);
92 }
virtual float getValue(Item *item)
#define PAYLOAD_INSPECTOR_CLASS(CLASS_NAME)
#define PAYLOAD_INSPECTOR_MODULE(PAYLOAD_TYPENAME)
chan
lumi = TPaveText(lowX+0.38, lowY+0.061, lowX+0.45, lowY+0.161, "NDC") lumi.SetBorderSize( 0 ) lumi...
Definition: plugin.cc:24
uint32_t getValue() const