36 }
else { generator =
nullptr; }
40 <<
"[SummaryGenerator::" << __func__ <<
"]" 41 <<
" Built \"" << generator->
myName() <<
"\" object!";
44 <<
"[SummaryGenerator::" << __func__ <<
"]" 45 <<
" Unexpected view: \"" 47 <<
"\" Unable to build Generator!" 48 <<
" Returning NULL pointer!";
84 const uint32_t&
xbins ) {
85 if ( !xbins ) {
return nullptr; }
89 summary =
new TH1F(
"",
"", 1024, 0., static_cast<float>(1024) );
91 summary =
new TH1F(
"",
"", xbins, 0., static_cast<float>(xbins) );
93 summary =
new TH2F(
"",
"", 100*xbins, 0., static_cast<float>(100*xbins), 1025, 0., 1025. );
95 summary =
new TProfile(
"",
"", xbins, 0., static_cast<float>(xbins), 0., 1025. );
96 }
else { summary =
nullptr; }
100 <<
"[SummaryGenerator::" << __func__ <<
"]" 101 <<
" Histogram name: \"" << summary->GetName() <<
"\"";
104 <<
"[SummaryGenerator::" << __func__ <<
"]" 105 <<
" Unexpected presentation: \"" 107 <<
"\" Unable to build summary plot!" 108 <<
" Returning NULL pointer!";
123 TH1& summary_histo ) {
133 summary_histo.GetXaxis()->SetLabelSize(0.03);
134 summary_histo.GetXaxis()->SetTitleSize(0.03);
135 summary_histo.GetXaxis()->SetTitleOffset(3.5);
139 summary_histo.GetYaxis()->SetLabelSize(0.03);
140 summary_histo.GetYaxis()->SetTitleSize(0.03);
141 summary_histo.GetYaxis()->SetTitleOffset(1.5);
147 summary_histo.GetXaxis()->SetTitle( xtitle.c_str() );
148 summary_histo.GetYaxis()->SetTitle(
"Frequency" );
149 summary_histo.GetXaxis()->SetTitleOffset(1.5);
152 summary_histo.GetXaxis()->SetTitle( xtitle.c_str() );
153 summary_histo.GetYaxis()->SetTitle(
label_.c_str() );
160 summary_histo.SetMarkerStyle(2);
161 summary_histo.SetMarkerSize(0.6);
196 HistoData::iterator iter =
map_.begin();
197 for ( ; iter !=
map_.end(); iter++ ) { iter->second.
clear(); }
208 std::stringstream ss;
209 ss <<
"[SummaryGenerator::" << __func__ <<
"]" 210 <<
" Printing contents of map: " << std::endl;
212 HistoData::iterator iter =
map_.begin();
213 for ( ; iter !=
map_.end(); iter++ ) {
214 ss <<
" bin/entries: " << iter->first <<
"/" << iter->second.size() <<
" ";
215 if ( !iter->second.empty() ) {
216 ss <<
" value/error: ";
217 std::vector<Data>::const_iterator jter = iter->second.begin();
218 for ( ; jter != iter->second.end(); jter++ ) {
219 ss << jter->first <<
"/" << jter->second <<
" ";
225 ss <<
" Max value: " <<
max_ << std::endl
226 <<
" Min value: " <<
min_ << std::endl;
236 const uint32_t& device_key,
238 const float&
error ) {
249 fill( top_level_dir, gran, device_key, value, error );
251 fill( top_level_dir, gran, device_key, value, 0. );
260 const uint32_t& device_key,
262 const float&
error ) {
265 <<
"[SummaryGenerator::" << __func__ <<
"]" 266 <<
" Derived implementation does not exist!...";
274 if (
map_.empty() ) {
276 <<
"[SummaryGenerator::" << __func__ <<
"]" 277 <<
" No contents in std::map to histogram!";
282 TH1F*
histo =
dynamic_cast<TH1F*
>(&his);
285 <<
"[SummaryGenerator::" << __func__ <<
"]" 286 <<
" NULL pointer to TH1F histogram!";
291 int32_t high =
static_cast<int32_t
>( fabs(
max_) > 20. ?
max_ + 0.05 * fabs(
max_) :
max_ + 1. );
292 int32_t low =
static_cast<int32_t
>( fabs(
min_) > 20. ?
min_ - 0.05 * fabs(
min_) :
min_ - 1. );
293 int32_t range = high - low;
302 histo->SetBins( range, static_cast<float>(low), static_cast<float>(high) );
306 HistoData::const_iterator ibin =
map_.begin();
307 for ( ; ibin !=
map_.end(); ibin++ ) {
308 if ( ibin->second.empty() ) {
continue; }
309 BinData::const_iterator
ii = ibin->second.begin();
310 for ( ; ii != ibin->second.end(); ii++ ) {
312 histo->Fill( ii->first );
324 if (
map_.empty() ) {
326 <<
"[SummaryGenerator::" << __func__ <<
"]" 327 <<
" No contents in std::map to histogram!";
332 TH1F*
histo =
dynamic_cast<TH1F*
>(&his);
335 <<
"[SummaryGenerator::" << __func__ <<
"]" 336 <<
" NULL pointer to TH1F histogram!";
343 HistoData::const_iterator ibin =
map_.begin();
344 for ( ; ibin !=
map_.end(); ibin++ ) {
346 histo->GetXaxis()->SetBinLabel( static_cast<Int_t>(bin), ibin->first.c_str() );
347 if ( ibin->second.empty() ) {
continue; }
348 BinData::const_iterator
ii = ibin->second.begin();
349 for ( ; ii != ibin->second.end(); ii++ ) {
351 histo->Fill( static_cast<Double_t>(bin-0.5),
352 static_cast<Double_t>(ii->first) );
364 if (
map_.empty() ) {
366 <<
"[SummaryGenerator::" << __func__ <<
"]" 367 <<
" No contents in std::map to histogram!";
372 TH2F*
histo =
dynamic_cast<TH2F*
>(&his);
375 <<
"[SummaryGenerator::" << __func__ <<
"]" 376 <<
" NULL pointer to TH2F histogram!";
383 HistoData::const_iterator ibin =
map_.begin();
384 for ( ; ibin !=
map_.end(); ibin++ ) {
386 histo->GetXaxis()->SetBinLabel( static_cast<Int_t>(bin), ibin->first.c_str() );
387 if ( ibin->second.empty() ) {
continue; }
388 BinData::const_iterator
ii = ibin->second.begin();
389 for ( ; ii != ibin->second.end(); ii++ ) {
391 histo->Fill( static_cast<Double_t>(bin-0.5),
392 static_cast<Double_t>(ii->first) );
404 if (
map_.empty() ) {
406 <<
"[SummaryGenerator::" << __func__ <<
"]" 407 <<
" No contents in std::map to histogram!";
412 TProfile*
histo =
dynamic_cast<TProfile*
>(&his);
415 <<
"[SummaryGenerator::" << __func__ <<
"]" 416 <<
" NULL pointer to TProfile histogram!";
423 HistoData::const_iterator ibin =
map_.begin();
424 for ( ; ibin !=
map_.end(); ibin++ ) {
426 histo->GetXaxis()->SetBinLabel( static_cast<Int_t>(bin), ibin->first.c_str() );
427 if ( ibin->second.empty() ) {
continue; }
428 BinData::const_iterator
ii = ibin->second.begin();
429 for ( ; ii != ibin->second.end(); ii++ ) {
431 histo->Fill( static_cast<Double_t>(bin-.5),
432 static_cast<Double_t>(ii->first) );
static std::string name(const sistrip::RunType &, const sistrip::Monitorable &, const sistrip::Presentation &, const sistrip::View &, const std::string &directory)
static std::string monitorable(const sistrip::Monitorable &)
static const char summaryHisto_[]
static std::string granularity(const sistrip::Granularity &)
static SummaryGenerator * instance(const sistrip::View &)
: Fills summary histograms.
SummaryGenerator(std::string name)
void histo2DScatter(TH1 &)
static const uint16_t valid_
static std::string view(const sistrip::View &)
static std::string runType(const sistrip::RunType &)
void fillMap(const std::string &top_level_dir, const sistrip::Granularity &, const uint32_t &key, const float &value, const float &error=0.)
virtual void fill(const std::string &top_level_dir, const sistrip::Granularity &, const uint32_t &key, const float &value, const float &error)
Fills "summary histograms" in FEC or "control" view.
bin
set the eta bin as selection string.
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_[]
const std::string & myName() const
static std::string presentation(const sistrip::Presentation &)
Fills "summary histograms" in FED or "readout" view.
static const uint16_t invalid_
static TH1 * histogram(const sistrip::Presentation &, const uint32_t &xbins)