CMS 3D CMS Logo

FedTimingSummaryFactory.cc
Go to the documentation of this file.
5 #include <iostream>
6 #include <sstream>
7 
8 using namespace sistrip;
9 
10 // -----------------------------------------------------------------------------
11 //
15  view_(sistrip::UNKNOWN_VIEW),
16  level_(sistrip::root_),
17  gran_(sistrip::UNKNOWN_GRAN),
18  generator_(nullptr) {
19  ;
20 }
21 
22 // -----------------------------------------------------------------------------
23 //
25  if (generator_) {
26  delete generator_;
27  }
28 }
29 
30 // -----------------------------------------------------------------------------
31 //
33  const sistrip::Presentation& pres,
34  const sistrip::View& view,
35  const std::string& top_level_dir,
36  const sistrip::Granularity& gran) {
37  LogTrace(mlSummaryPlots_) << "[SummaryHistogramFactory::" << __func__ << "]";
38  mon_ = mon;
39  pres_ = pres;
40  view_ = view;
41  level_ = top_level_dir;
42  gran_ = gran;
43 
44  // Retrieve utility class used to generate summary histograms
45  if (generator_) {
46  delete generator_;
47  generator_ = nullptr;
48  }
50 }
51 
52 //------------------------------------------------------------------------------
53 //
54 uint32_t SummaryHistogramFactory<FedTimingAnalysis>::extract(const std::map<uint32_t, FedTimingAnalysis>& data) {
55  // Check if data are present
56  if (data.empty()) {
57  edm::LogWarning(mlSummaryPlots_) << "[SummaryHistogramFactory::" << __func__ << "]"
58  << " No data in monitorables std::map!";
59  return 0;
60  }
61 
62  // Check if instance of generator class exists
63  if (!generator_) {
64  edm::LogWarning(mlSummaryPlots_) << "[SummaryHistogramFactory::" << __func__ << "]"
65  << " NULL pointer to SummaryGenerator object!";
66  return 0;
67  }
68 
69  // Transfer appropriate monitorables info to generator object
71  std::map<uint32_t, FedTimingAnalysis>::const_iterator iter = data.begin();
72  for (; iter != data.end(); iter++) {
74  generator_->fillMap(level_, gran_, iter->first, iter->second.time());
75  } else if (mon_ == sistrip::FED_TIMING_MAX_TIME) {
76  generator_->fillMap(level_, gran_, iter->first, iter->second.max());
77  } else if (mon_ == sistrip::FED_TIMING_DELAY) {
78  generator_->fillMap(level_, gran_, iter->first, iter->second.delay());
79  } else if (mon_ == sistrip::FED_TIMING_ERROR) {
80  generator_->fillMap(level_, gran_, iter->first, iter->second.error());
81  } else if (mon_ == sistrip::FED_TIMING_BASE) {
82  generator_->fillMap(level_, gran_, iter->first, iter->second.base());
83  } else if (mon_ == sistrip::FED_TIMING_PEAK) {
84  generator_->fillMap(level_, gran_, iter->first, iter->second.peak());
85  } else if (mon_ == sistrip::FED_TIMING_HEIGHT) {
86  generator_->fillMap(level_, gran_, iter->first, iter->second.height());
87  } else {
88  edm::LogWarning(mlSummaryPlots_) << "[SummaryHistogramFactory::" << __func__ << "]"
89  << " Unexpected SummaryHisto value:"
91  continue;
92  }
93  }
94  return generator_->size();
95 }
96 
97 //------------------------------------------------------------------------------
98 //
100  // Check if instance of generator class exists
101  if (!generator_) {
102  edm::LogWarning(mlSummaryPlots_) << "[SummaryHistogramFactory::" << __func__ << "]"
103  << " NULL pointer to SummaryGenerator object!";
104  return;
105  }
106 
107  // Check if std::map is filled
108  if (!generator_->size()) {
109  edm::LogWarning(mlSummaryPlots_) << "[SummaryHistogramFactory::" << __func__ << "]"
110  << " No data in the monitorables std::map!";
111  return;
112  }
113 
114  // Generate appropriate summary histogram
115  if (pres_ == sistrip::HISTO_1D) {
116  generator_->histo1D(summary_histo);
117  } else if (pres_ == sistrip::HISTO_2D_SUM) {
118  generator_->histo2DSum(summary_histo);
119  } else if (pres_ == sistrip::HISTO_2D_SCATTER) {
120  generator_->histo2DScatter(summary_histo);
121  } else if (pres_ == sistrip::PROFILE_1D) {
122  generator_->profile1D(summary_histo);
123  } else {
124  edm::LogWarning(mlSummaryPlots_) << "[SummaryHistogramFactory::" << __func__ << "]"
125  << " Unexpected SummaryType value:" << SiStripEnumsAndStrings::presentation(pres_);
126  return;
127  }
128 
129  // Histogram formatting
131  } else if (mon_ == sistrip::FED_TIMING_MAX_TIME) {
132  } else if (mon_ == sistrip::FED_TIMING_DELAY) {
133  } else if (mon_ == sistrip::FED_TIMING_ERROR) {
134  } else if (mon_ == sistrip::FED_TIMING_BASE) {
135  } else if (mon_ == sistrip::FED_TIMING_PEAK) {
136  } else if (mon_ == sistrip::FED_TIMING_HEIGHT) {
137  } else {
138  edm::LogWarning(mlSummaryPlots_) << "[SummaryHistogramFactory::" << __func__ << "]"
139  << " Unexpected SummaryHisto value:" << SiStripEnumsAndStrings::monitorable(mon_);
140  }
142 }
sistrip::Granularity
Granularity
Definition: ConstantsForGranularity.h:60
sistrip::UNKNOWN_MONITORABLE
Definition: ConstantsForMonitorable.h:201
SummaryGenerator::fillMap
void fillMap(const std::string &top_level_dir, const sistrip::Granularity &, const uint32_t &key, const float &value, const float &error=0.)
Definition: SummaryGenerator.cc:222
SummaryHistogramFactory::pres_
sistrip::Presentation pres_
Definition: SummaryHistogramFactory.h:30
MessageLogger.h
SummaryHistogramFactory::init
void init(const sistrip::Monitorable &, const sistrip::Presentation &, const sistrip::View &, const std::string &top_level_dir, const sistrip::Granularity &)
Definition: SummaryHistogramFactory.cc:35
sistrip::View
View
Definition: ConstantsForView.h:26
sistrip::FED_TIMING_HEIGHT
Definition: ConstantsForMonitorable.h:232
SummaryHistogramFactory::gran_
sistrip::Granularity gran_
Definition: SummaryHistogramFactory.h:33
sistrip::HISTO_2D_SUM
Definition: ConstantsForPresentation.h:32
sistrip::UNKNOWN_GRAN
Definition: ConstantsForGranularity.h:62
SummaryHistogramFactory::~SummaryHistogramFactory
~SummaryHistogramFactory()
Definition: SummaryHistogramFactory.cc:25
SummaryHistogramFactory::mon_
sistrip::Monitorable mon_
Definition: SummaryHistogramFactory.h:29
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
SummaryGenerator::profile1D
void profile1D(TH1 &)
Definition: SummaryGenerator.cc:385
SummaryGenerator::clearMap
void clearMap()
Definition: SummaryGenerator.cc:184
SummaryHistogramFactory::view_
sistrip::View view_
Definition: SummaryHistogramFactory.h:31
sistrip::Monitorable
Monitorable
Definition: ConstantsForMonitorable.h:200
sistrip::FED_TIMING_PEAK
Definition: ConstantsForMonitorable.h:231
sistrip::Presentation
Presentation
Definition: ConstantsForPresentation.h:28
SiStripEnumsAndStrings::presentation
static std::string presentation(const sistrip::Presentation &)
Definition: SiStripEnumsAndStrings.cc:1237
LaserDQM_cfi.mon
mon
Definition: LaserDQM_cfi.py:3
sistrip::FED_TIMING_BASE
Definition: ConstantsForMonitorable.h:230
SummaryHistogramFactory::fill
void fill(TH1 &summary_histo)
Definition: SummaryHistogramFactory.cc:91
sistrip::HISTO_1D
Definition: ConstantsForPresentation.h:31
sistrip::FED_TIMING_MAX_TIME
Definition: ConstantsForMonitorable.h:227
sistrip::HISTO_2D_SCATTER
Definition: ConstantsForPresentation.h:33
sistrip::PROFILE_1D
Definition: ConstantsForPresentation.h:34
sistrip::FED_TIMING
Definition: ConstantsForRunType.h:80
SummaryGenerator::histo2DSum
void histo2DSum(TH1 &)
Definition: SummaryGenerator.cc:309
sistrip::root_
static const char root_[]
Definition: ConstantsForDqm.h:30
SummaryGenerator::instance
static SummaryGenerator * instance(const sistrip::View &)
Definition: SummaryGenerator.cc:23
SiStripEnumsAndStrings::monitorable
static std::string monitorable(const sistrip::Monitorable &)
Definition: SiStripEnumsAndStrings.cc:547
sistrip::UNKNOWN_VIEW
Definition: ConstantsForView.h:27
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
SummaryGenerator::size
uint32_t size() const
Definition: SummaryGenerator.h:95
SummaryHistogramFactory::level_
std::string level_
Definition: SummaryHistogramFactory.h:32
sistrip::FED_TIMING_DELAY
Definition: ConstantsForMonitorable.h:228
sistrip::FED_TIMING_TIME
Definition: ConstantsForMonitorable.h:226
sistrip::mlSummaryPlots_
static const char mlSummaryPlots_[]
Definition: ConstantsForLogger.h:26
SiStripEnumsAndStrings.h
SummaryGenerator::histo1D
void histo1D(TH1 &)
Definition: SummaryGenerator.cc:261
FedTimingSummaryFactory.h
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
SummaryGenerator.h
SummaryHistogramFactory::SummaryHistogramFactory
SummaryHistogramFactory()
Definition: SummaryHistogramFactory.cc:12
SummaryHistogramFactory::generator_
SummaryGenerator * generator_
Definition: SummaryHistogramFactory.h:34
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:234
sistrip
sistrip classes
Definition: EnsembleCalibrationLA.cc:10
SummaryHistogramFactory::extract
uint32_t extract(const std::map< uint32_t, T > &data)
Definition: SummaryHistogramFactory.cc:58
sistrip::UNKNOWN_PRESENTATION
Definition: ConstantsForPresentation.h:29
SummaryGenerator::histo2DScatter
void histo2DScatter(TH1 &)
Definition: SummaryGenerator.cc:347
SummaryGenerator::format
void format(const sistrip::RunType &, const sistrip::Monitorable &, const sistrip::Presentation &, const sistrip::View &, const std::string &directory, const sistrip::Granularity &, TH1 &)
Definition: SummaryGenerator.cc:107
sistrip::FED_TIMING_ERROR
Definition: ConstantsForMonitorable.h:229