CMS 3D CMS Logo

SiStripThreshold_PayloadInspector.cc
Go to the documentation of this file.
1 
12 
13 // the data format of the condition to be inspected
19 
20 // needed for the tracker map
22 
23 // auxilliary functions
26 
28 
29 #include <memory>
30 #include <sstream>
31 #include <iostream>
32 
33 // include ROOT
34 #include "TH2F.h"
35 #include "TLegend.h"
36 #include "TCanvas.h"
37 #include "TLine.h"
38 #include "TStyle.h"
39 #include "TLatex.h"
40 #include "TPave.h"
41 #include "TPaveStats.h"
42 
43 using namespace std;
44 
45 namespace {
46 
47  using namespace cond::payloadInspector;
48 
49  /************************************************
50  test class
51  *************************************************/
52 
53  class SiStripThresholdTest : public Histogram1D<SiStripThreshold, SINGLE_IOV> {
54  public:
55  SiStripThresholdTest()
56  : Histogram1D<SiStripThreshold, SINGLE_IOV>("SiStrip Threshold test", "SiStrip Threshold test", 10, 0.0, 10.0),
58  edm::FileInPath("Geometry/TrackerCommonData/data/trackerParameters.xml").fullPath())} {}
59 
60  bool fill() override {
61  auto tag = PlotBase::getTag<0>();
62  for (auto const& iov : tag.iovs) {
63  std::shared_ptr<SiStripThreshold> payload = Base::fetchPayload(std::get<1>(iov));
64  if (payload.get()) {
65  fillWithValue(1.);
66 
67  std::stringstream ss;
68  ss << "Summary of strips threshold:" << std::endl;
69 
70  payload->printSummary(ss, &m_trackerTopo);
71 
72  std::vector<uint32_t> detid;
73  payload->getDetIds(detid);
74 
75  std::cout << ss.str() << std::endl;
76  }
77  }
78  return true;
79  } // fill
80  private:
81  TrackerTopology m_trackerTopo;
82  };
83 
84  /************************************************************
85  1d histogram of SiStripThresholds of 1 IOV - High Threshold
86  *************************************************************/
87 
88  class SiStripThresholdValueHigh : public Histogram1D<SiStripThreshold, SINGLE_IOV> {
89  public:
90  SiStripThresholdValueHigh()
91  : Histogram1D<SiStripThreshold, SINGLE_IOV>("SiStrip High threshold values (checked per APV)",
92  "SiStrip High threshold values (cheched per APV)",
93  10,
94  0.0,
95  10) {}
96  bool fill() override {
97  auto tag = PlotBase::getTag<0>();
98  const auto detInfo =
100  for (auto const& iov : tag.iovs) {
101  std::shared_ptr<SiStripThreshold> payload = Base::fetchPayload(std::get<1>(iov));
102  if (payload.get()) {
103  std::vector<uint32_t> detid;
104  payload->getDetIds(detid);
105 
106  for (const auto& d : detid) {
107  //std::cout<<d<<std::endl;
108  SiStripThreshold::Range range = payload->getRange(d);
109 
110  int nAPVs = detInfo.getNumberOfApvsAndStripLength(d).first;
111 
112  for (int it = 0; it < nAPVs; ++it) {
113  auto hth = payload->getData(it * 128, range).getHth();
114  //std::cout<<hth<<std::endl;
115  fillWithValue(hth);
116  }
117  }
118  }
119  }
120 
121  return true;
122  }
123  };
124 
125  /************************************************************
126  1d histogram of SiStripThresholds of 1 IOV - Low Threshold
127  *************************************************************/
128 
129  class SiStripThresholdValueLow : public Histogram1D<SiStripThreshold, SINGLE_IOV> {
130  public:
131  SiStripThresholdValueLow()
132  : Histogram1D<SiStripThreshold, SINGLE_IOV>("SiStrip Low threshold values (checked per APV)",
133  "SiStrip Low threshold values (cheched per APV)",
134  10,
135  0.0,
136  10) {}
137  bool fill() override {
138  auto tag = PlotBase::getTag<0>();
139  const auto detInfo =
141  for (auto const& iov : tag.iovs) {
142  std::shared_ptr<SiStripThreshold> payload = Base::fetchPayload(std::get<1>(iov));
143  if (payload.get()) {
144  std::vector<uint32_t> detid;
145  payload->getDetIds(detid);
146 
147  for (const auto& d : detid) {
148  //std::cout<<d<<std::endl;
149  SiStripThreshold::Range range = payload->getRange(d);
150 
151  int nAPVs = detInfo.getNumberOfApvsAndStripLength(d).first;
152 
153  for (int it = 0; it < nAPVs; ++it) {
154  auto lth = payload->getData(it * 128, range).getLth();
155  //std::cout<<hth<<std::endl;
156  fillWithValue(lth);
157  }
158  }
159  }
160  }
161 
162  return true;
163  }
164  };
165 
166 } // namespace
167 
169  PAYLOAD_INSPECTOR_CLASS(SiStripThresholdTest);
170  PAYLOAD_INSPECTOR_CLASS(SiStripThresholdValueHigh);
171  PAYLOAD_INSPECTOR_CLASS(SiStripThresholdValueLow);
172 }
#define PAYLOAD_INSPECTOR_CLASS(CLASS_NAME)
SiStripDetInfo read(std::string filePath)
#define PAYLOAD_INSPECTOR_MODULE(PAYLOAD_TYPENAME)
d
Definition: ztail.py:151
std::pair< ContainerIterator, ContainerIterator > Range
TrackerTopology fromTrackerParametersXMLFile(const std::string &xmlFileName)
static constexpr char const *const kDefaultFile