CMS 3D CMS Logo

FedTimingSummaryFactory.cc
Go to the documentation of this file.
5 #include <iostream>
6 #include <sstream>
7 
8 using namespace sistrip;
9 
10 // -----------------------------------------------------------------------------
11 //
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 ) {
36  << "[SummaryHistogramFactory::" << __func__ << "]";
37  mon_ = mon;
38  pres_ = pres;
39  view_ = view;
40  level_ = top_level_dir;
41  gran_ = gran;
42 
43  // Retrieve utility class used to generate summary histograms
44  if ( generator_ ) { delete generator_; generator_ = 0; }
46 
47 }
48 
49 //------------------------------------------------------------------------------
50 //
51 uint32_t SummaryHistogramFactory<FedTimingAnalysis>::extract( const std::map<uint32_t,FedTimingAnalysis>& data ) {
52 
53  // Check if data are present
54  if ( data.empty() ) {
55  edm::LogWarning(mlSummaryPlots_) << "[SummaryHistogramFactory::" << __func__ << "]"
56  << " No data in monitorables std::map!";
57  return 0;
58  }
59 
60  // Check if instance of generator class exists
61  if ( !generator_ ) {
62  edm::LogWarning(mlSummaryPlots_) << "[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,FedTimingAnalysis>::const_iterator iter = data.begin();
70  for ( ; iter != data.end(); iter++ ) {
71  if ( mon_ == sistrip::FED_TIMING_TIME ) {
72  generator_->fillMap( level_, gran_, iter->first, iter->second.time() );
73  } else if ( mon_ == sistrip::FED_TIMING_MAX_TIME ) {
74  generator_->fillMap( level_, gran_, iter->first, iter->second.max() );
75  } else if ( mon_ == sistrip::FED_TIMING_DELAY ) {
76  generator_->fillMap( level_, gran_, iter->first, iter->second.delay() );
77  } else if ( mon_ == sistrip::FED_TIMING_ERROR ) {
78  generator_->fillMap( level_, gran_, iter->first, iter->second.error() );
79  } else if ( mon_ == sistrip::FED_TIMING_BASE ) {
80  generator_->fillMap( level_, gran_, iter->first, iter->second.base() );
81  } else if ( mon_ == sistrip::FED_TIMING_PEAK ) {
82  generator_->fillMap( level_, gran_, iter->first, iter->second.peak() );
83  } else if ( mon_ == sistrip::FED_TIMING_HEIGHT ) {
84  generator_->fillMap( level_, gran_, iter->first, iter->second.height() );
85  } else {
86  edm::LogWarning(mlSummaryPlots_) << "[SummaryHistogramFactory::" << __func__ << "]"
87  << " Unexpected SummaryHisto value:"
89  ;
90  continue;
91  }
92  }
93  return generator_->size();
94 }
95 
96 //------------------------------------------------------------------------------
97 //
99 
100  // Check if instance of generator class exists
101  if ( !generator_ ) {
102  edm::LogWarning(mlSummaryPlots_) << "[SummaryHistogramFactory::" << __func__ << "]"
103  << " NULL pointer to SummaryGenerator object!";
104  return;
105  }
106 
107  // Check if std::map is filled
108  if ( !generator_->size() ) {
109  edm::LogWarning(mlSummaryPlots_) << "[SummaryHistogramFactory::" << __func__ << "]"
110  << " No data in the monitorables std::map!";
111  return;
112  }
113 
114  // Generate appropriate summary histogram
115  if ( pres_ == sistrip::HISTO_1D ) {
116  generator_->histo1D( summary_histo );
117  } else if ( pres_ == sistrip::HISTO_2D_SUM ) {
118  generator_->histo2DSum( summary_histo );
119  } else if ( pres_ == sistrip::HISTO_2D_SCATTER ) {
120  generator_->histo2DScatter( summary_histo );
121  } else if ( pres_ == sistrip::PROFILE_1D ) {
122  generator_->profile1D( summary_histo );
123  } else {
124  edm::LogWarning(mlSummaryPlots_) << "[SummaryHistogramFactory::" << __func__ << "]"
125  << " Unexpected SummaryType value:"
127  ;
128  return;
129  }
130 
131  // Histogram formatting
132  if ( mon_ == sistrip::FED_TIMING_TIME ) {
133  } else if ( mon_ == sistrip::FED_TIMING_MAX_TIME ) {
134  } else if ( mon_ == sistrip::FED_TIMING_DELAY ) {
135  } else if ( mon_ == sistrip::FED_TIMING_ERROR ) {
136  } else if ( mon_ == sistrip::FED_TIMING_BASE ) {
137  } else if ( mon_ == sistrip::FED_TIMING_PEAK ) {
138  } else if ( mon_ == sistrip::FED_TIMING_HEIGHT ) {
139  } else {
140  edm::LogWarning(mlSummaryPlots_) << "[SummaryHistogramFactory::" << __func__ << "]"
141  << " Unexpected SummaryHisto value:"
143  ;
144  }
146 
147 }
148 
149 // -----------------------------------------------------------------------------
150 //
152 
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 &)
sistrip classes
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
#define LogTrace(id)
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_[]
sistrip::Presentation pres_