CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SummaryPlot.cc
Go to the documentation of this file.
4 
5 using namespace sistrip;
6 
7 // -----------------------------------------------------------------------------
8 //
9 SummaryPlot::SummaryPlot( const std::string& monitorable,
10  const std::string& presentation,
11  const std::string& granularity,
12  const std::string& level ) :
13  mon_( sistrip::UNKNOWN_MONITORABLE ),
14  pres_( sistrip::UNKNOWN_PRESENTATION ),
15  view_( sistrip::UNKNOWN_VIEW ),
16  gran_( sistrip::UNKNOWN_GRAN ),
17  level_(""),
19 {
20 
21  // Extract enums from strings
25  level_ = level;
26 
27  // Extract view and perform checks
28  check();
29  isValid_ = true;
30 
31  // Checks on member data
35  << "[SummaryPlot::" << __func__ << "]"
36  << " Unexpected monitorable \""
38  << "\" based on input string \""
39  << monitorable << "\"";
40  isValid_ = false;
41  }
42 
46  << "[SummaryPlot::" << __func__ << "]"
47  << " Unexpected presentation \""
49  << "\" based on input string \""
50  << presentation << "\"";
51  isValid_ = false;
52  }
53 
54  if ( view_ == sistrip::UNKNOWN_VIEW ||
57  << "[SummaryPlot::" << __func__ << "]"
58  << " Unexpected view \""
60  << "\" based on input string \""
61  << level << "\"";
62  isValid_ = false;
63  }
64 
65  if ( level_.empty() ||
66  level_.find(sistrip::unknownView_) != std::string::npos ||
67  level_.find(sistrip::undefinedView_) != std::string::npos ) {
69  << "[SummaryPlot::" << __func__ << "]"
70  << " Unexpected top-level directory: \""
71  << level_ << "\"";
72  isValid_ = false;
73  }
74 
75  if ( gran_ == sistrip::UNKNOWN_GRAN ||
77  pres_ != sistrip::HISTO_1D ) ) {
79  << "[SummaryPlot::" << __func__ << "]"
80  << " Unexpected granularity: \""
82  << "\" based on input string \""
83  << granularity << "\"";
84  isValid_ = false;
85  }
86 
87 }
88 
89 // -----------------------------------------------------------------------------
90 //
92  mon_( input.monitorable() ),
93  pres_( input.presentation() ),
94  view_( input.view() ),
95  gran_( input.granularity() ),
96  level_( input.level() ),
97  isValid_( input.isValid() )
98 {;}
99 
100 // -----------------------------------------------------------------------------
101 //
103  mon_( sistrip::UNKNOWN_MONITORABLE ),
104  pres_( sistrip::UNKNOWN_PRESENTATION ),
105  view_( sistrip::UNKNOWN_VIEW ),
106  gran_( sistrip::UNKNOWN_GRAN ),
107  level_(""),
108  isValid_(false)
109 {;}
110 
111 // -----------------------------------------------------------------------------
112 //
118  level_ = "";
119  isValid_ = false;
120 }
121 
122 // -----------------------------------------------------------------------------
123 //
125 
126  // Remove end "/" from level_ if it exists
127  if ( !level_.empty() ) {
128  std::string slash = level_.substr( level_.size()-1, 1 );
129  if ( slash == sistrip::dir_ ) { level_ = level_.substr( 0, level_.size()-1 ); }
130  }
131 
132  // Extract and check view
134  view_ = check;
135  if ( check == sistrip::UNKNOWN_VIEW ||
136  check == sistrip::UNDEFINED_VIEW ) {
138  << "[SummaryPlot::" << __func__ << "]"
139  << " Unexpected view \""
140  << SiStripEnumsAndStrings::view( check )
141  << "\"";
142  }
143 
144  // Prepend sistrip::root_ to level_ if not found
145  if ( level_.find( sistrip::root_ ) == std::string::npos ) {
146  if ( check == sistrip::UNKNOWN_VIEW ) {
147  level_ =
150  level_;
151  } else if ( check == sistrip::UNDEFINED_VIEW ) {
152  level_ =
155  level_;
156  } else {
157  level_ =
159  level_;
160  }
161  }
162 
163 }
164 
165 // -----------------------------------------------------------------------------
166 //
167 void SummaryPlot::print( std::stringstream& ss ) const {
168  ss << "[SummaryPlot::" << __func__ << "]" << std::endl
169  << " Monitorable: " << SiStripEnumsAndStrings::monitorable(mon_) << std::endl
170  << " Presentation: " << SiStripEnumsAndStrings::presentation(pres_) << std::endl
171  << " View: " << SiStripEnumsAndStrings::view(view_) << std::endl
172  << " TopLevelDir: " << level_ << std::endl
173  << " Granularity: " << SiStripEnumsAndStrings::granularity(gran_) << std::endl;
174 }
175 
176 // -----------------------------------------------------------------------------
177 //
178 std::ostream& operator<< ( std::ostream& os, const SummaryPlot& summary ) {
179  std::stringstream ss;
180  summary.print(ss);
181  os << ss.str();
182  return os;
183 }
184 
185 
186 
static const char unknownView_[]
static std::string monitorable(const sistrip::Monitorable &)
const std::string & level() const
Definition: SummaryPlot.h:97
sistrip::Presentation pres_
Definition: SummaryPlot.h:79
sistrip::Monitorable mon_
Definition: SummaryPlot.h:77
static const char dir_[]
void check()
Definition: SummaryPlot.cc:124
static std::string granularity(const sistrip::Granularity &)
std::string level_
Definition: SummaryPlot.h:85
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:187
bool isValid_(value_type const &hash)
Definition: Hash.cc:72
sistrip::View view_
Definition: SummaryPlot.h:81
static std::string const input
Definition: EdmProvDump.cc:44
static const char undefinedView_[]
static std::string view(const sistrip::View &)
void print(std::stringstream &) const
Definition: SummaryPlot.cc:167
Class holding info that defines a summary plot.
Definition: SummaryPlot.h:19
sistrip::Granularity gran_
Definition: SummaryPlot.h:83
static const char mlSummaryPlots_[]
static std::string presentation(const sistrip::Presentation &)
void reset()
Definition: SummaryPlot.cc:113
static const char root_[]
bool isValid_
Definition: SummaryPlot.h:87
tuple level
Definition: testEve_cfg.py:34
volatile std::atomic< bool > shutdown_flag false