CMS 3D CMS Logo

SiStripLatency_PayloadInspector.cc
Go to the documentation of this file.
1 
12 
13 // the data format of the condition to be inspected
18 
19 // needed for the tracker map
21 
22 // auxilliary functions
25 
26 #include <memory>
27 #include <sstream>
28 #include <iostream>
29 
30 // include ROOT
31 #include "TProfile.h"
32 #include "TH2F.h"
33 #include "TLegend.h"
34 #include "TCanvas.h"
35 #include "TLine.h"
36 #include "TStyle.h"
37 #include "TLatex.h"
38 #include "TPave.h"
39 #include "TPaveStats.h"
40 
41 namespace {
42 
43  /************************************************
44  *************** test class ******************
45  *************************************************/
46 
47  class SiStripLatencyTest : public cond::payloadInspector::Histogram1D<SiStripLatency> {
48 
49  public:
50  SiStripLatencyTest() : cond::payloadInspector::Histogram1D<SiStripLatency>("SiStripLatency values","SiStripLatency values", 5,0.0,5.0){
51  Base::setSingleIov( true );
52  }
53 
54  bool fill( const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs ) override{
55  for ( auto const & iov: iovs) {
56  std::shared_ptr<SiStripLatency> payload = Base::fetchPayload( std::get<1>(iov) );
57  if( payload.get() ){
58  std::vector<SiStripLatency::Latency> lat = payload->allLatencyAndModes();
59  fillWithValue(lat.size());
60  }
61  }
62  return true;
63  }// fill
64  };
65 
66  /***********************************************
67  // 1d histogram of mode of 1 IOV
68  ************************************************/
69  class SiStripLatencyMode : public cond::payloadInspector::Histogram1D<SiStripLatency> {
70 
71  public:
72  SiStripLatencyMode(): cond::payloadInspector::Histogram1D<SiStripLatency>("SiStripLatency mode", "SiStripLatency mode", 70, -10, 60){
73  Base::setSingleIov( true );
74  }
75 
76  bool fill( const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs ) override{
77  for ( auto const & iov: iovs) {
78  std::shared_ptr<SiStripLatency> payload = Base::fetchPayload( std::get<1>(iov) );
79  if( payload.get() ){
80 
81  std::vector<uint16_t> modes;
82  payload->allModes(modes);
83 
84  for (const auto & mode : modes){
85  if (mode!=0) fillWithValue(mode);
86  else fillWithValue(-1);
87  }
88  }
89  }
90  return true;
91  }
92  };
93 
94 
95  /****************************************************************************
96  *******************1D histo of mode as a function of the run****************
97  *****************************************************************************/
98 
99  class SiStripLatencyModeHistory : public cond::payloadInspector::HistoryPlot<SiStripLatency,uint16_t > {
100 
101  public:
102  SiStripLatencyModeHistory(): cond::payloadInspector::HistoryPlot<SiStripLatency,uint16_t>("Mode vs run number", "Mode vs run number"){
103  }
104 
105  uint16_t getFromPayload( SiStripLatency& payload ) override{
106 
107  uint16_t singlemode = payload.singleMode();
108  return singlemode;
109  }
110  };
111 
112 
113  /****************************************************************************
114  *****************number of modes per run *************************************
115  **************************************************************************/
116  class SiStripLatencyNumbOfModeHistory : public cond::payloadInspector::HistoryPlot<SiStripLatency,int> {
117 
118  public:
119  SiStripLatencyNumbOfModeHistory(): cond::payloadInspector::HistoryPlot<SiStripLatency,int>("Number of modes vs run ", "Number of modes vs run"){
120  }
121 
122  int getFromPayload( SiStripLatency& payload ) override{
123 
124  std::vector<uint16_t> modes;
125  payload.allModes(modes);
126 
127  return modes.size();
128  }
129  };
130 
131 } // close namespace
132 
133 // Register the classes as boost python plugin
135  PAYLOAD_INSPECTOR_CLASS(SiStripLatencyTest);
136  PAYLOAD_INSPECTOR_CLASS(SiStripLatencyMode);
137  PAYLOAD_INSPECTOR_CLASS(SiStripLatencyModeHistory);
138  PAYLOAD_INSPECTOR_CLASS(SiStripLatencyNumbOfModeHistory);
139 
140 }
Definition: DQMStore.h:29
#define PAYLOAD_INSPECTOR_CLASS(CLASS_NAME)
void fillWithValue(float value, float weight=1)
#define PAYLOAD_INSPECTOR_MODULE(PAYLOAD_TYPENAME)
void allModes(std::vector< uint16_t > &allModesVector) const
Fills the passed vector with all the possible modes in the Tracker.
uint16_t singleMode() const
std::shared_ptr< PayloadType > fetchPayload(const cond::Hash &payloadHash)
Definition: plugin.cc:24
bool fill(const std::vector< std::tuple< cond::Time_t, cond::Hash > > &iovs) override