test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DaqScopeModeSummaryFactory.cc
Go to the documentation of this file.
5 #include <iostream>
6 #include <sstream>
7 
8 using namespace sistrip;
9 
10 // -----------------------------------------------------------------------------
11 //
13  mon_(sistrip::UNKNOWN_MONITORABLE),
14  pres_(sistrip::UNKNOWN_PRESENTATION),
15  view_(sistrip::UNKNOWN_VIEW),
16  level_(sistrip::root_),
17  gran_(sistrip::UNKNOWN_GRAN),
18  generator_(0)
19 {;}
20 
21 
22 // -----------------------------------------------------------------------------
23 //
25  if ( generator_ ) { delete generator_; }
26 }
27 
28 // -----------------------------------------------------------------------------
29 //
31  const sistrip::Presentation& pres,
32  const sistrip::View& view,
33  const std::string& top_level_dir,
34  const sistrip::Granularity& gran ) {
35  mon_ = mon;
36  pres_ = pres;
37  view_ = view;
38  level_ = top_level_dir;
39  gran_ = gran;
40 
41  // Retrieve utility class used to generate summary histograms
42  if ( generator_ ) { delete generator_; generator_ = 0; }
44 
45 }
46 
47 //------------------------------------------------------------------------------
48 //
49 uint32_t SummaryHistogramFactory<DaqScopeModeAnalysis>::extract( const std::map<uint32_t,DaqScopeModeAnalysis>& data ) {
50 
51  // Check if data are present
52  if ( data.empty() ) {
54  << "[SummaryHistogramFactory::" << __func__ << "]"
55  << " No data in monitorables std::map!";
56  return 0;
57  }
58 
59  // Check if instance of generator class exists
60  if ( !generator_ ) {
62  << "[SummaryHistogramFactory::" << __func__ << "]"
63  << " NULL pointer to SummaryGenerator object!";
64  return 0;
65  }
66 
67  // Transfer appropriate monitorables info to generator object
69  std::map<uint32_t,DaqScopeModeAnalysis>::const_iterator iter = data.begin();
70  for ( ; iter != data.end(); iter++ ) {
72  generator_->fillMap( level_, gran_, iter->first, iter->second.mean() );
73  } else { continue; }
74  }
75  return generator_->size();
76 }
77 
78 //------------------------------------------------------------------------------
79 //
81 
82  // Check if instance of generator class exists
83  if ( !generator_ ) {
85  << "[SummaryHistogramFactory::" << __func__ << "]"
86  << " NULL pointer to SummaryGenerator object!";
87  return;
88  }
89 
90  // Check if instance of generator class exists
91  if ( !(&summary_histo) ) {
93  << "[SummaryHistogramFactory::" << __func__ << "]"
94  << " NULL pointer to SummaryGenerator object!";
95  return;
96  }
97 
98  // Check if std::map is filled
99  if ( !generator_->size() ) {
101  << "[SummaryHistogramFactory::" << __func__ << "]"
102  << " No data in the monitorables std::map!";
103  return;
104  }
105 
106  // Generate appropriate summary histogram
107  if ( pres_ == sistrip::HISTO_1D ) {
108  generator_->histo1D( summary_histo );
109  } else if ( pres_ == sistrip::HISTO_2D_SUM ) {
110  generator_->histo2DSum( summary_histo );
111  } else if ( pres_ == sistrip::HISTO_2D_SCATTER ) {
112  generator_->histo2DScatter( summary_histo );
113  } else if ( pres_ == sistrip::PROFILE_1D ) {
114  generator_->profile1D( summary_histo );
115  } else {
117  << "[SummaryHistogramFactory::" << __func__ << "]"
118  << " Unexpected SummaryType value:"
120  return;
121  }
122 
123  // Histogram formatting
125  generator_->axisLabel( "Mean signal [adc]" );
126  } else {
128  << "[SummaryHistogramFactory::" << __func__ << "]"
129  << " Unexpected SummaryHisto value:"
131  }
133 
134 }
135 
136 // -----------------------------------------------------------------------------
137 //
139 
static std::string monitorable(const sistrip::Monitorable &)
uint32_t extract(const std::map< uint32_t, T > &data)
void histo2DSum(TH1 &)
void init(const sistrip::Monitorable &, const sistrip::Presentation &, const sistrip::View &, const std::string &top_level_dir, const sistrip::Granularity &)
static SummaryGenerator * instance(const sistrip::View &)
void histo2DScatter(TH1 &)
void fillMap(const std::string &top_level_dir, const sistrip::Granularity &, const uint32_t &key, const float &value, const float &error=0.)
void fill(TH1 &summary_histo)
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_[]
static std::string presentation(const sistrip::Presentation &)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
static const char root_[]
void axisLabel(const std::string &)
sistrip::Presentation pres_