CMS 3D CMS Logo

SummaryPlot.cc
Go to the documentation of this file.
4 
5 using namespace sistrip;
6 
7 // -----------------------------------------------------------------------------
8 //
11  const std::string& granularity,
12  const std::string& level)
15  view_(sistrip::UNKNOWN_VIEW),
16  gran_(sistrip::UNKNOWN_GRAN),
17  level_(""),
18  isValid_(false) {
19  // Extract enums from strings
23  level_ = level;
24 
25  // Extract view and perform checks
26  check();
27  isValid_ = true;
28 
29  // Checks on member data
31  edm::LogWarning(mlSummaryPlots_) << "[SummaryPlot::" << __func__ << "]"
32  << " Unexpected monitorable \"" << SiStripEnumsAndStrings::monitorable(mon_)
33  << "\" based on input string \"" << monitorable << "\"";
34  isValid_ = false;
35  }
36 
38  edm::LogWarning(mlSummaryPlots_) << "[SummaryPlot::" << __func__ << "]"
39  << " Unexpected presentation \"" << SiStripEnumsAndStrings::presentation(pres_)
40  << "\" based on input string \"" << presentation << "\"";
41  isValid_ = false;
42  }
43 
45  edm::LogWarning(mlSummaryPlots_) << "[SummaryPlot::" << __func__ << "]"
46  << " Unexpected view \"" << SiStripEnumsAndStrings::view(level_)
47  << "\" based on input string \"" << level << "\"";
48  isValid_ = false;
49  }
50 
51  if (level_.empty() || level_.find(sistrip::unknownView_) != std::string::npos ||
52  level_.find(sistrip::undefinedView_) != std::string::npos) {
53  edm::LogWarning(mlSummaryPlots_) << "[SummaryPlot::" << __func__ << "]"
54  << " Unexpected top-level directory: \"" << level_ << "\"";
55  isValid_ = false;
56  }
57 
59  edm::LogWarning(mlSummaryPlots_) << "[SummaryPlot::" << __func__ << "]"
60  << " Unexpected granularity: \"" << SiStripEnumsAndStrings::granularity(gran_)
61  << "\" based on input string \"" << granularity << "\"";
62  isValid_ = false;
63  }
64 }
65 
66 // -----------------------------------------------------------------------------
67 //
69  : mon_(input.monitorable()),
70  pres_(input.presentation()),
71  view_(input.view()),
72  gran_(input.granularity()),
73  level_(input.level()),
75  ;
76 }
77 
78 // -----------------------------------------------------------------------------
79 //
83  view_(sistrip::UNKNOWN_VIEW),
84  gran_(sistrip::UNKNOWN_GRAN),
85  level_(""),
86  isValid_(false) {
87  ;
88 }
89 
90 // -----------------------------------------------------------------------------
91 //
97  level_ = "";
98  isValid_ = false;
99 }
100 
101 // -----------------------------------------------------------------------------
102 //
104  // Remove end "/" from level_ if it exists
105  if (!level_.empty()) {
106  std::string slash = level_.substr(level_.size() - 1, 1);
107  if (slash == sistrip::dir_) {
108  level_ = level_.substr(0, level_.size() - 1);
109  }
110  }
111 
112  // Extract and check view
114  view_ = check;
116  edm::LogWarning(mlSummaryPlots_) << "[SummaryPlot::" << __func__ << "]"
117  << " Unexpected view \"" << SiStripEnumsAndStrings::view(check) << "\"";
118  }
119 
120  // Prepend sistrip::root_ to level_ if not found
121  if (level_.find(sistrip::root_) == std::string::npos) {
122  if (check == sistrip::UNKNOWN_VIEW) {
124  } else if (check == sistrip::UNDEFINED_VIEW) {
126  } else {
128  }
129  }
130 }
131 
132 // -----------------------------------------------------------------------------
133 //
134 void SummaryPlot::print(std::stringstream& ss) const {
135  ss << "[SummaryPlot::" << __func__ << "]" << std::endl
136  << " Monitorable: " << SiStripEnumsAndStrings::monitorable(mon_) << std::endl
137  << " Presentation: " << SiStripEnumsAndStrings::presentation(pres_) << std::endl
138  << " View: " << SiStripEnumsAndStrings::view(view_) << std::endl
139  << " TopLevelDir: " << level_ << std::endl
140  << " Granularity: " << SiStripEnumsAndStrings::granularity(gran_) << std::endl;
141 }
142 
143 // -----------------------------------------------------------------------------
144 //
145 std::ostream& operator<<(std::ostream& os, const SummaryPlot& summary) {
146  std::stringstream ss;
147  summary.print(ss);
148  os << ss.str();
149  return os;
150 }
static const char unknownView_[]
static std::string monitorable(const sistrip::Monitorable &)
bool isValid_(value_type const &hash)
Definition: Hash.cc:63
void print(std::stringstream &) const
Definition: SummaryPlot.cc:134
sistrip::Presentation pres_
Definition: SummaryPlot.h:76
sistrip::Monitorable mon_
Definition: SummaryPlot.h:74
const bool isValid(const Frame &aFrame, const FrameQuality &aQuality, const uint16_t aExpectedPos)
static const char dir_[]
void check()
Definition: SummaryPlot.cc:103
static std::string granularity(const sistrip::Granularity &)
std::string level_
Definition: SummaryPlot.h:82
sistrip::View view_
Definition: SummaryPlot.h:78
sistrip classes
static std::string const input
Definition: EdmProvDump.cc:47
static const char undefinedView_[]
static std::string view(const sistrip::View &)
std::ostream & operator<<(std::ostream &os, const SummaryPlot &summary)
Definition: SummaryPlot.cc:145
const sistrip::Granularity & granularity() const
Definition: SummaryPlot.h:92
Class holding info that defines a summary plot.
Definition: SummaryPlot.h:19
sistrip::Granularity gran_
Definition: SummaryPlot.h:80
const std::string & level() const
Definition: SummaryPlot.h:93
static const char mlSummaryPlots_[]
static std::string presentation(const sistrip::Presentation &)
void reset()
Definition: SummaryPlot.cc:92
static const char root_[]
bool isValid_
Definition: SummaryPlot.h:84
Log< level::Warning, false > LogWarning
const sistrip::Monitorable & monitorable() const
Definition: SummaryPlot.h:89