12 using namespace sistrip;
17 : map_(), entries_(-1.), max_(-1. * sistrip::
invalid_), min_(1. * sistrip::
invalid_), label_(
""), myName_(name) {
35 <<
" Built \"" << generator->
myName() <<
"\" object!";
39 <<
"\" Unable to build Generator!"
40 <<
" Returning NULL pointer!";
81 summary =
new TH1F(
"",
"", 1024, 0., static_cast<float>(1024));
83 summary =
new TH1F(
"",
"", xbins, 0., static_cast<float>(xbins));
85 summary =
new TH2F(
"",
"", 100 * xbins, 0., static_cast<float>(100 * xbins), 1025, 0., 1025.);
87 summary =
new TProfile(
"",
"", xbins, 0., static_cast<float>(xbins), 0., 1025.);
94 <<
" Histogram name: \"" << summary->GetName() <<
"\"";
98 <<
"\" Unable to build summary plot!"
99 <<
" Returning NULL pointer!";
113 TH1& summary_histo) {
124 summary_histo.GetXaxis()->SetLabelSize(0.03);
125 summary_histo.GetXaxis()->SetTitleSize(0.03);
126 summary_histo.GetXaxis()->SetTitleOffset(3.5);
130 summary_histo.GetYaxis()->SetLabelSize(0.03);
131 summary_histo.GetYaxis()->SetTitleSize(0.03);
132 summary_histo.GetYaxis()->SetTitleOffset(1.5);
138 summary_histo.GetXaxis()->SetTitle(xtitle.c_str());
139 summary_histo.GetYaxis()->SetTitle(
"Frequency");
140 summary_histo.GetXaxis()->SetTitleOffset(1.5);
143 summary_histo.GetXaxis()->SetTitle(xtitle.c_str());
144 summary_histo.GetYaxis()->SetTitle(
label_.c_str());
151 summary_histo.SetMarkerStyle(2);
152 summary_histo.SetMarkerSize(0.6);
185 HistoData::iterator iter =
map_.begin();
186 for (; iter !=
map_.end(); iter++) {
187 iter->second.
clear();
198 std::stringstream
ss;
199 ss <<
"[SummaryGenerator::" << __func__ <<
"]"
200 <<
" Printing contents of map: " << std::endl;
202 HistoData::iterator iter =
map_.begin();
203 for (; iter !=
map_.end(); iter++) {
204 ss <<
" bin/entries: " << iter->first <<
"/" << iter->second.size() <<
" ";
205 if (!iter->second.empty()) {
206 ss <<
" value/error: ";
207 std::vector<Data>::const_iterator jter = iter->second.begin();
208 for (; jter != iter->second.end(); jter++) {
209 ss << jter->first <<
"/" << jter->second <<
" ";
215 ss <<
" Max value: " <<
max_ << std::endl <<
" Min value: " <<
min_ << std::endl;
224 const uint32_t& device_key,
226 const float&
error) {
242 fill(top_level_dir, gran, device_key, value, error);
244 fill(top_level_dir, gran, device_key, value, 0.);
252 const uint32_t& device_key,
254 const float&
error) {
256 <<
" Derived implementation does not exist!...";
265 <<
" No contents in std::map to histogram!";
270 TH1F*
histo =
dynamic_cast<TH1F*
>(&his);
273 <<
" NULL pointer to TH1F histogram!";
278 int32_t high =
static_cast<int32_t
>(fabs(
max_) > 20. ?
max_ + 0.05 * fabs(
max_) :
max_ + 1.);
279 int32_t low =
static_cast<int32_t
>(fabs(
min_) > 20. ?
min_ - 0.05 * fabs(
min_) :
min_ - 1.);
280 int32_t
range = high - low;
289 histo->SetBins(range, static_cast<float>(low), static_cast<float>(high));
293 HistoData::const_iterator ibin =
map_.begin();
294 for (; ibin !=
map_.end(); ibin++) {
295 if (ibin->second.empty()) {
298 BinData::const_iterator
ii = ibin->second.begin();
299 for (; ii != ibin->second.end(); ii++) {
301 histo->Fill(ii->first);
313 <<
" No contents in std::map to histogram!";
318 TH1F*
histo =
dynamic_cast<TH1F*
>(&his);
321 <<
" NULL pointer to TH1F histogram!";
328 HistoData::const_iterator ibin =
map_.begin();
329 for (; ibin !=
map_.end(); ibin++) {
331 histo->GetXaxis()->SetBinLabel(static_cast<Int_t>(bin), ibin->first.c_str());
332 if (ibin->second.empty()) {
335 BinData::const_iterator
ii = ibin->second.begin();
336 for (; ii != ibin->second.end(); ii++) {
338 histo->Fill(static_cast<Double_t>(bin - 0.5),
339 static_cast<Double_t>(ii->first));
351 <<
" No contents in std::map to histogram!";
356 TH2F*
histo =
dynamic_cast<TH2F*
>(&his);
359 <<
" NULL pointer to TH2F histogram!";
366 HistoData::const_iterator ibin =
map_.begin();
367 for (; ibin !=
map_.end(); ibin++) {
369 histo->GetXaxis()->SetBinLabel(static_cast<Int_t>(bin), ibin->first.c_str());
370 if (ibin->second.empty()) {
373 BinData::const_iterator
ii = ibin->second.begin();
374 for (; ii != ibin->second.end(); ii++) {
376 histo->Fill(static_cast<Double_t>(bin - 0.5),
377 static_cast<Double_t>(ii->first));
389 <<
" No contents in std::map to histogram!";
394 TProfile*
histo =
dynamic_cast<TProfile*
>(&his);
397 <<
" NULL pointer to TProfile histogram!";
404 HistoData::const_iterator ibin =
map_.begin();
405 for (; ibin !=
map_.end(); ibin++) {
407 histo->GetXaxis()->SetBinLabel(static_cast<Int_t>(bin), ibin->first.c_str());
408 if (ibin->second.empty()) {
411 BinData::const_iterator
ii = ibin->second.begin();
412 for (; ii != ibin->second.end(); ii++) {
414 histo->Fill(static_cast<Double_t>(bin - .5),
415 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)
Log< level::Info, true > LogVerbatim
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_
const uint16_t range(const Frame &aFrame)
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.
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)
Log< level::Warning, false > LogWarning