CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
SummaryHistogramFactory< T > Class Template Reference

#include <SummaryHistogramFactory.h>

Public Member Functions

uint32_t extract (const std::map< uint32_t, T > &data)
 
void fill (TH1 &summary_histo)
 
void init (const sistrip::Monitorable &, const sistrip::Presentation &, const sistrip::View &, const std::string &top_level_dir, const sistrip::Granularity &)
 
 SummaryHistogramFactory ()
 
 ~SummaryHistogramFactory ()
 

Private Attributes

SummaryGeneratorgenerator_
 
sistrip::Granularity gran_
 
std::string level_
 
sistrip::Monitorable mon_
 
sistrip::Presentation pres_
 
sistrip::View view_
 

Detailed Description

template<class T>
class SummaryHistogramFactory< T >

Definition at line 13 of file SummaryHistogramFactory.h.

Constructor & Destructor Documentation

◆ SummaryHistogramFactory()

◆ ~SummaryHistogramFactory()

template<class T >
SummaryHistogramFactory< T >::~SummaryHistogramFactory ( )

Definition at line 25 of file SummaryHistogramFactory.cc.

References LogTrace, and sistrip::mlSummaryPlots_.

25  {
26  LogTrace(mlSummaryPlots_) << "[SummaryHistogramFactory::" << __func__ << "]";
27  if (generator_) {
28  delete generator_;
29  }
30 }
#define LogTrace(id)
static const char mlSummaryPlots_[]

Member Function Documentation

◆ extract()

template<class T >
uint32_t SummaryHistogramFactory< T >::extract ( const std::map< uint32_t, T > &  data)

Definition at line 58 of file SummaryHistogramFactory.cc.

References data, LogTrace, and sistrip::mlSummaryPlots_.

58  {
59  LogTrace(mlSummaryPlots_) << "[SummaryHistogramFactory::" << __func__ << "]";
60 
61  // Check if data are present
62  if (data.empty()) {
63  edm::LogWarning(mlSummaryPlots_) << "[SummaryHistogramFactory::" << __func__ << "]"
64  << " No data in monitorables std::map!";
65  return 0;
66  }
67 
68  // Check if instance of generator class exists
69  if (!generator_) {
70  edm::LogWarning(mlSummaryPlots_) << "[SummaryHistogramFactory::" << __func__ << "]"
71  << " NULL pointer to SummaryGenerator object!";
72  return 0;
73  }
74 
75  // Transfer appropriate monitorables info to generator object
77  typename std::map<uint32_t, T>::const_iterator iter = data.begin();
78  for (; iter != data.end(); iter++) {
79  generator_->fillMap(level_, // top-level directory
80  gran_, // granularity
81  iter->first, // device key
82  static_cast<float>(iter->second)); // value
83  }
84 
85  return generator_->size();
86 }
#define LogTrace(id)
void fillMap(const std::string &top_level_dir, const sistrip::Granularity &, const uint32_t &key, const float &value, const float &error=0.)
uint32_t size() const
static const char mlSummaryPlots_[]
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:80
Log< level::Warning, false > LogWarning

◆ fill()

template<class T >
void SummaryHistogramFactory< T >::fill ( TH1 &  summary_histo)

Definition at line 91 of file SummaryHistogramFactory.cc.

References sistrip::HISTO_1D, sistrip::HISTO_2D_SCATTER, sistrip::HISTO_2D_SUM, LogTrace, sistrip::mlSummaryPlots_, sistrip::PROFILE_1D, and sistrip::UNKNOWN_RUN_TYPE.

91  {
92  LogTrace(mlSummaryPlots_) << "[SummaryHistogramFactory::" << __func__ << "]";
93 
94  // Check if instance of generator class exists
95  if (!generator_) {
96  edm::LogWarning(mlSummaryPlots_) << "[SummaryHistogramFactory::" << __func__ << "]"
97  << " NULL pointer to SummaryGenerator object!";
98  return;
99  }
100 
101  // Check if std::map is filled
102  if (!generator_->size()) {
103  edm::LogWarning(mlSummaryPlots_) << "[SummaryHistogramFactory::" << __func__ << "]"
104  << " No data in the monitorables std::map!";
105  return;
106  }
107 
108  // Generate appropriate summary histogram
109  if (pres_ == sistrip::HISTO_1D) {
110  generator_->histo1D(summary_histo);
111  } else if (pres_ == sistrip::HISTO_2D_SUM) {
112  generator_->histo2DSum(summary_histo);
113  } else if (pres_ == sistrip::HISTO_2D_SCATTER) {
114  generator_->histo2DScatter(summary_histo);
115  } else if (pres_ == sistrip::PROFILE_1D) {
116  generator_->profile1D(summary_histo);
117  } else {
118  return;
119  }
120 
121  // Histogram formatting
123 }
void histo2DSum(TH1 &)
void histo2DScatter(TH1 &)
#define LogTrace(id)
uint32_t size() const
void format(const sistrip::RunType &, const sistrip::Monitorable &, const sistrip::Presentation &, const sistrip::View &, const std::string &directory, const sistrip::Granularity &, TH1 &)
static const char mlSummaryPlots_[]
Log< level::Warning, false > LogWarning
sistrip::Presentation pres_

◆ init()

template<class T >
void SummaryHistogramFactory< T >::init ( const sistrip::Monitorable mon,
const sistrip::Presentation pres,
const sistrip::View view,
const std::string &  top_level_dir,
const sistrip::Granularity gran 
)

Definition at line 35 of file SummaryHistogramFactory.cc.

References SummaryGenerator::instance(), LogTrace, sistrip::mlSummaryPlots_, and LaserDQM_cfi::mon.

39  {
40  LogTrace(mlSummaryPlots_) << "[SummaryHistogramFactory::" << __func__ << "]";
41  mon_ = mon;
42  pres_ = pres;
43  view_ = view;
44  level_ = top_level_dir;
45  gran_ = gran;
46 
47  // Retrieve utility class used to generate summary histograms
48  if (generator_) {
49  delete generator_;
50  generator_ = nullptr;
52  }
53 }
static SummaryGenerator * instance(const sistrip::View &)
#define LogTrace(id)
static const char mlSummaryPlots_[]
sistrip::Presentation pres_

Member Data Documentation

◆ generator_

template<class T >
SummaryGenerator* SummaryHistogramFactory< T >::generator_
private

◆ gran_

template<class T >
sistrip::Granularity SummaryHistogramFactory< T >::gran_
private

◆ level_

template<class T >
std::string SummaryHistogramFactory< T >::level_
private

◆ mon_

template<class T >
sistrip::Monitorable SummaryHistogramFactory< T >::mon_
private

◆ pres_

template<class T >
sistrip::Presentation SummaryHistogramFactory< T >::pres_
private

◆ view_

template<class T >
sistrip::View SummaryHistogramFactory< T >::view_
private