5 #include "DQM/SiStripMonitorHardware/interface/HistogramBase.hh"
7 void HistogramBase::fillHistogram(HistogramConfig& histogram,
double value,
double weight) {
8 if (histogram.monitorEle)
9 histogram.monitorEle->Fill(value, weight);
12 void HistogramBase::fillHistogram(
MonitorElement* histogram,
double value,
double weight) {
14 histogram->
Fill(value, weight);
17 void HistogramBase::fillHistogram2D(HistogramConfig& histogram,
double trendVar,
double value,
double weight) {
18 if (histogram.monitorEle)
19 histogram.monitorEle->Fill(trendVar, value, weight);
22 void HistogramBase::fillTkHistoMap(
TkHistoMap* aMap, uint32_t& detid,
float value) {
24 aMap->
fill(detid, value);
27 void HistogramBase::getConfigForHistogram(HistogramConfig& aConfig,
30 std::ostringstream* pDebugStream) {
31 aConfig.monitorEle =
nullptr;
32 aConfig.enabled =
false;
34 aConfig.min = aConfig.max = 0.;
38 bool isTimeHisto = configName.find(
"vsTime") != configName.npos;
40 if (psetContainingConfigPSet.
exists(psetName)) {
42 if (configName.find(
"fedErrorsVsIdVsLumi") != std::string::npos) {
46 if (aConfig.enabled) {
52 (*pDebugStream) <<
"[HistogramBase]\tHistogram: " << configName <<
"\tEnabled"
53 <<
"\tNBins: " << aConfig.nBins <<
"\tMin: " << aConfig.min <<
"\tMax: " << aConfig.max
57 (*pDebugStream) <<
"[HistogramBase]\tHistogram: " << configName <<
"\tEnabled" << std::endl;
60 aConfig.enabled =
false;
62 aConfig.min = aConfig.max = 0.;
64 (*pDebugStream) <<
"[HistogramBase]\tHistogram: " << configName <<
"\tDisabled" << std::endl;
67 aConfig.enabled =
false;
69 aConfig.min = aConfig.max = 0.;
71 (*pDebugStream) <<
"[HistogramBase]\tHistogram: " << configName <<
"\tDisabled" << std::endl;
75 if (psetContainingConfigPSet.
exists(
"TimeHistogramConfig") && isTimeHisto) {
85 HistogramConfig& aConfig,
88 const unsigned int nBins,
92 if (aConfig.enabled) {
93 aConfig.monitorEle = ibooker.
book1D(name, title, nBins, min, max);
96 aConfig.monitorEle =
nullptr;
101 HistogramConfig& aConfig,
105 const unsigned int nBins,
109 if (aConfig.enabled) {
110 aHist = ibooker.
book1D(name, title, nBins, min, max);
118 HistogramConfig& aConfig,
122 return bookHistogram(ibooker, aConfig, name, title, aConfig.nBins, aConfig.min, aConfig.max, xAxisTitle);
126 HistogramConfig& aConfig,
129 const unsigned int nBins,
132 const unsigned int nBinsY,
137 if (aConfig.enabled) {
138 aConfig.monitorEle = ibooker.
book2D(name, title, nBins, min, max, nBinsY, minY, maxY);
140 aConfig.monitorEle->setAxisTitle(yAxisTitle, 2);
142 aConfig.monitorEle =
nullptr;
147 HistogramConfig& aConfig,
151 const unsigned int nBins,
154 const unsigned int nBinsY,
159 if (aConfig.enabled) {
160 aHist = ibooker.
book2D(name, title, nBins, min, max, nBinsY, minY, maxY);
169 HistogramConfig& aConfig,
172 const unsigned int nBins,
179 if (aConfig.enabled) {
180 aConfig.monitorEle = ibooker.
bookProfile(name, title, nBins, min, max, minY, maxY);
183 aConfig.monitorEle->setAxisTitle(yAxisTitle, 2);
185 aConfig.monitorEle =
nullptr;
190 HistogramConfig& aConfig,
198 ibooker, aConfig, name, title, aConfig.nBins, aConfig.min, aConfig.max, minY, maxY, xAxisTitle, yAxisTitle);
201 if (aConfig.monitorEle)
202 aConfig.monitorEle->getTProfile()->SetCanExtend(TH1::kAllAxes);
209 HistogramConfig& aConfig,
212 const unsigned int nBinsx,
215 const unsigned int nBinsy,
220 if (aConfig.enabled) {
221 aConfig.monitorEle = ibooker.
bookProfile2D(name, title, nBinsx, xmin, xmax, nBinsy, ymin, ymax, 0, 0);
224 aConfig.monitorEle->setAxisTitle(yAxisTitle, 2);
226 aConfig.monitorEle =
nullptr;
231 HistogramConfig& aConfig,
234 const unsigned int nBinsy,
240 ibooker, aConfig, name, title, aConfig.nBins, aConfig.min, aConfig.max, nBinsy, ymin, ymax, xAxisTitle, yAxisTitle);
244 aConfig.monitorEle->getTProfile2D()->SetCanExtend(TH1::kAllAxes);
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * bookProfile2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, double lowZ, double highZ, char const *option="s", FUNC onbooking=NOOP())
bool exists(std::string const ¶meterName) const
checks if a parameter exists
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, int, double lowY, double highY, char const *option="s", FUNC onbooking=NOOP())
Constants and enumerated types for FED/FEC systems.
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
void fill(DetId detid, float value)
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)