CMS 3D CMS Logo

SummaryPlotFactoryBase.cc
Go to the documentation of this file.
5 #include <iostream>
6 
7 using namespace sistrip;
8 
9 // -----------------------------------------------------------------------------
10 //
14  view_(sistrip::UNKNOWN_VIEW),
15  level_(sistrip::root_),
16  gran_(sistrip::UNKNOWN_GRAN),
17  generator_(nullptr) {
18  ;
19 }
20 
21 // -----------------------------------------------------------------------------
22 //
24  if (generator_) {
25  delete generator_;
26  }
27 }
28 
29 // -----------------------------------------------------------------------------
30 //
32  const sistrip::Presentation& pres,
33  const sistrip::View& view,
34  const std::string& level,
35  const sistrip::Granularity& gran) {
36  // Create generator object
37  if (generator_) {
38  delete generator_;
39  generator_ = nullptr;
40  }
42 
43  // Check if generator object exists
44  if (!generator_) {
45  edm::LogWarning(mlSummaryPlots_) << "[SummaryPlotFactoryBase::" << __func__ << "]"
46  << " NULL pointer to generator object!";
47  return;
48  }
49 
50  // Clear map used to build histogram
52 
53  // Set parameters
54  mon_ = mon;
55  pres_ = pres;
56  view_ = view;
57  level_ = level;
58  gran_ = gran;
59 
60  // Some checks
62  edm::LogWarning(mlSummaryPlots_) << "[SummaryPlotFactoryBase::" << __func__ << "]"
63  << " Unexpected monitorable: " << SiStripEnumsAndStrings::monitorable(mon_);
64  }
65 
67  edm::LogWarning(mlSummaryPlots_) << "[SummaryPlotFactoryBase::" << __func__ << "]"
68  << " Unexpected presentation: " << SiStripEnumsAndStrings::presentation(pres_);
69  }
70 
72  edm::LogWarning(mlSummaryPlots_) << "[SummaryPlotFactoryBase::" << __func__ << "]"
73  << " Unexpected view: " << SiStripEnumsAndStrings::view(view_);
74  }
75 
76  if (level_.empty() || level_.find(sistrip::unknownView_) != std::string::npos ||
77  level_.find(sistrip::undefinedView_) != std::string::npos) {
78  edm::LogWarning(mlSummaryPlots_) << "[SummaryPlotFactoryBase::" << __func__ << "]"
79  << " Unexpected top-level directory: \"" << level_ << "\"";
80  }
81 
83  edm::LogWarning(mlSummaryPlots_) << "[SummaryPlotFactoryBase::" << __func__ << "]"
84  << " Unexpected granularity: " << SiStripEnumsAndStrings::granularity(gran_);
85  }
86 
87  // ss << "[SummaryPlotFactoryBase::" << __func__ << "]"
88  // << " Dump of parameters defining summary plot:" << std::endl
89  // << " Monitorable : " << SiStripEnumsAndStrings::monitorable( mon_ ) << std::endl
90  // << " Presentation : " << SiStripEnumsAndStrings::presentation( pres_ ) << std::endl
91  // << " Logical view : " << SiStripEnumsAndStrings::view( view_ ) << std::endl
92  // << " Top level dir : " << level_ << std::endl
93  // << " Granularity : " << SiStripEnumsAndStrings::granularity( gran_ );
94  // LogTrace(mlSummaryPlots_) << ss.str();
95 }
96 
97 // -----------------------------------------------------------------------------
98 //
99 void SummaryPlotFactoryBase::fill(TH1& summary_histo) {
100  // Check if instance of generator class exists
101  if (!generator_) {
102  edm::LogWarning(mlSummaryPlots_) << "[SummaryPlotFactoryBase::" << __func__ << "]"
103  << " NULL pointer to SummaryGenerator object!";
104  return;
105  }
106 
107  // Check if map is filled
108  if (!generator_->nBins()) {
109  edm::LogWarning(mlSummaryPlots_) << "[SummaryPlotFactoryBase::" << __func__ << "]"
110  << " Zero bins returned by SummaryGenerator!";
111  return;
112  }
113 
114  // Print contents of map for histogram
115  //generator_->printMap();
116 
117  // Generate appropriate summary histogram
118  if (pres_ == sistrip::HISTO_1D) {
119  generator_->histo1D(summary_histo);
120  } else if (pres_ == sistrip::HISTO_2D_SUM) {
121  generator_->histo2DSum(summary_histo);
122  } else if (pres_ == sistrip::HISTO_2D_SCATTER) {
123  generator_->histo2DScatter(summary_histo);
124  } else if (pres_ == sistrip::PROFILE_1D) {
125  generator_->profile1D(summary_histo);
126  } else {
127  edm::LogWarning(mlSummaryPlots_) << "[SummaryPlotFactoryBase::" << __func__ << "]"
128  << " Unexpected presentation type: "
130  return;
131  }
132 
133  // Histogram formatting
135  mon_,
136  pres_,
137  view_,
138  level_,
139  gran_,
140  summary_histo);
141 }
personalPlayback.level
level
Definition: personalPlayback.py:22
sistrip::Granularity
Granularity
Definition: ConstantsForGranularity.h:60
sistrip::UNKNOWN_MONITORABLE
Definition: ConstantsForMonitorable.h:201
MessageLogger.h
sistrip::View
View
Definition: ConstantsForView.h:26
sistrip::UNDEFINED_VIEW
Definition: ConstantsForView.h:28
SummaryPlotFactoryBase::mon_
sistrip::Monitorable mon_
Definition: SummaryPlotFactoryBase.h:25
SummaryPlotFactoryBase::fill
void fill(TH1 &summary_histo)
Definition: SummaryPlotFactoryBase.cc:99
sistrip::unknownView_
static const char unknownView_[]
Definition: ConstantsForView.h:17
sistrip::HISTO_2D_SUM
Definition: ConstantsForPresentation.h:32
sistrip::UNDEFINED_PRESENTATION
Definition: ConstantsForPresentation.h:30
sistrip::undefinedView_
static const char undefinedView_[]
Definition: ConstantsForView.h:18
sistrip::UNKNOWN_GRAN
Definition: ConstantsForGranularity.h:62
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
SummaryPlotFactoryBase::level_
std::string level_
Definition: SummaryPlotFactoryBase.h:28
SummaryGenerator::profile1D
void profile1D(TH1 &)
Definition: SummaryGenerator.cc:385
SummaryGenerator::clearMap
void clearMap()
Definition: SummaryGenerator.cc:184
sistrip::Monitorable
Monitorable
Definition: ConstantsForMonitorable.h:200
SummaryPlotFactoryBase.h
SummaryPlotFactoryBase::init
void init(const sistrip::Monitorable &, const sistrip::Presentation &, const sistrip::View &, const std::string &top_level_dir, const sistrip::Granularity &)
Definition: SummaryPlotFactoryBase.cc:31
sistrip::Presentation
Presentation
Definition: ConstantsForPresentation.h:28
SiStripEnumsAndStrings::presentation
static std::string presentation(const sistrip::Presentation &)
Definition: SiStripEnumsAndStrings.cc:1237
SiStripEnumsAndStrings::granularity
static std::string granularity(const sistrip::Granularity &)
Definition: SiStripEnumsAndStrings.cc:265
LaserDQM_cfi.mon
mon
Definition: LaserDQM_cfi.py:3
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
sistrip::HISTO_1D
Definition: ConstantsForPresentation.h:31
SummaryPlotFactoryBase::pres_
sistrip::Presentation pres_
Definition: SummaryPlotFactoryBase.h:26
SummaryPlotFactoryBase::generator_
SummaryGenerator * generator_
Definition: SummaryPlotFactoryBase.h:32
sistrip::HISTO_2D_SCATTER
Definition: ConstantsForPresentation.h:33
sistrip::UNKNOWN_RUN_TYPE
Definition: ConstantsForRunType.h:94
sistrip::PROFILE_1D
Definition: ConstantsForPresentation.h:34
SummaryPlotFactoryBase::view_
sistrip::View view_
Definition: SummaryPlotFactoryBase.h:27
SiStripEnumsAndStrings::view
static std::string view(const sistrip::View &)
Definition: SiStripEnumsAndStrings.cc:5
SummaryGenerator::histo2DSum
void histo2DSum(TH1 &)
Definition: SummaryGenerator.cc:309
sistrip::root_
static const char root_[]
Definition: ConstantsForDqm.h:30
SummaryPlotFactoryBase::~SummaryPlotFactoryBase
~SummaryPlotFactoryBase()
Definition: SummaryPlotFactoryBase.cc:23
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
SummaryPlotFactoryBase::SummaryPlotFactoryBase
SummaryPlotFactoryBase()
Definition: SummaryPlotFactoryBase.cc:11
sistrip::UNKNOWN_VIEW
Definition: ConstantsForView.h:27
SummaryPlotFactoryBase::gran_
sistrip::Granularity gran_
Definition: SummaryPlotFactoryBase.h:29
sistrip::UNDEFINED_MONITORABLE
Definition: ConstantsForMonitorable.h:202
sistrip::mlSummaryPlots_
static const char mlSummaryPlots_[]
Definition: ConstantsForLogger.h:26
SiStripEnumsAndStrings.h
SummaryGenerator::histo1D
void histo1D(TH1 &)
Definition: SummaryGenerator.cc:261
SummaryGenerator::nBins
uint32_t nBins() const
Definition: SummaryGenerator.h:134
SummaryGenerator.h
sistrip
sistrip classes
Definition: SiStripQualityHelpers.h:14
sistrip::UNKNOWN_PRESENTATION
Definition: ConstantsForPresentation.h:29
SummaryGenerator::histo2DScatter
void histo2DScatter(TH1 &)
Definition: SummaryGenerator.cc:347
sistrip::UNDEFINED_GRAN
Definition: ConstantsForGranularity.h:61
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