CaptionBox.cxx
Go to the documentation of this file.
2 #include <iostream>
3 #include <sstream>
4 #include "TGText.h"
5 #include "TGTextView.h"
11 using namespace om;
12 
14  TGTextView(w,
15  Layout::fCaptionBoxSizeX,
16  Layout::fCaptionBoxSizeY),
18 {
19  fText = new TGText("Histogram caption");
20  TGFont* f =
21  gClient->GetFont("-adobe-helvetica-medium-r-*-*-12-*-*-*-*-*-iso8859-1");
22  this->SetFont(f->GetFontStruct());
23 }
24 
25 //......................................................................
26 
28 {
29  delete fText;
30 }
31 
32 //......................................................................
33 
35  unsigned int which)
36 {
37  if (this->GetLock()==false) return;
38 
39  if ( (which&kCurrentHistogramID)==0 ) {
40  this->ReleaseLock();
41  return;
42  }
43 
44  std::ostringstream oss;
45 
46  const char* hname = d.fCurrentHistogram.Current();
47  oss << "Histogram " << hname << ":\n\n";
48 
49  const HistoData* hd = HistoTable::Instance().LookUp(hname);
50 
51  if (hd!=0) {
52  static const unsigned int kNcharPerLine = 40;
53  const char* c = hd->fCaption.c_str();
54  unsigned int i=0;
55  for (;*c!='\0';++c) {
56  ++i;
57  if (i>kNcharPerLine && *c==' ') { oss << '\n'; i=0; }
58  else { oss << *c; }
59  }
60 
61  switch (hd->fReset) {
62  case TickerSubscriber::k24hr: oss << "\nReset at 0h GMT, "; break;
63  case TickerSubscriber::kRun: oss << "\nReset every run, "; break;
64  case TickerSubscriber::kSubrun: oss << "\nReset every subrun, "; break;
65  case TickerSubscriber::k30sec: oss << "\nReset on the half minutes, "; break;
66  case TickerSubscriber::k1min: oss << "\nReset on the minute, "; break;
67  case TickerSubscriber::k5min: oss << "\nReset on the 5's, "; break;
68  case TickerSubscriber::k10min: oss << "\nReset on the 10's, "; break;
69  case TickerSubscriber::k30min: oss << "\nReset on the hour and half-past the hour, ";break;
70  case TickerSubscriber::kHour: oss << "\nReset on the hour, "; break;
71  case TickerSubscriber::kUTC: oss << "\nShows the last 23 hours, "; break;
72  }
73  oss << "\n" << hd->fLookBack << " copies saved in history.\n\n";
74 
75  if (hd->fType==kTH1F) {
76  oss << "1D Histogram\n"
77  << hd->fNx << " bins between "
78  << "x=" << hd->fX1 << " and "
79  << "x=" << hd->fX2 << "\n";
80  }
81  if (hd->fType==kTH2F) {
82  oss << "2D Histogram\n"
83  << hd->fNx << " bins between "
84  << "x=" << hd->fX1 << " and "
85  << "x=" << hd->fX2 << "\n"
86  << hd->fNy << " bins between "
87  << "y=" << hd->fY1 << " and "
88  << "y=" << hd->fY2 << "\n";
89  }
90  oss << std::endl;
91  }
92  this->LoadBuffer(oss.str().c_str());
93  this->Layout();
94 
95  this->ReleaseLock();
96 }
97 
98 ////////////////////////////////////////////////////////////////////////
double fX1
Low edge of x range.
Definition: HistoData.h:50
unsigned int fLookBack
How many copies to save in history.
Definition: HistoData.h:43
const HistoData * LookUp(const char *nm) const
Definition: HistoTable.cxx:293
CaptionBox(TGWindow *w)
Definition: CaptionBox.cxx:13
void GUIModelDataIssue(const GUIModelData &d, unsigned int which)
Definition: CaptionBox.cxx:34
static const unsigned int kCurrentHistogramID
Definition: GUIModelData.h:15
std::string fCaption
What does this histogram show?
Definition: HistoData.h:56
int fNx
Number of bins in x.
Definition: HistoData.h:49
Base class for subscribers to ticker updates.
Class to read, hold, and deliver histogram data.
double fY2
High edge of y range.
Definition: HistoData.h:54
TGText * fText
The text inside the box.
Definition: CaptionBox.h:20
Float_t d
Definition: plot.C:236
double fX2
High edge of x range.
Definition: HistoData.h:51
const char * Current() const
CurrentHistogram fCurrentHistogram
Definition: GUIModelData.h:37
Histo_t fType
What kind of histogram is this?
Definition: HistoData.h:46
double fNy
Number of bins in y.
Definition: HistoData.h:52
static HistoTable & Instance(const char *f=0, Detector_t d=kALLDET)
Definition: HistoTable.cxx:21
unsigned int fReset
Reset schedule (see TickerSubscriber.h)
Definition: HistoData.h:42
double fY1
Low edge of y range.
Definition: HistoData.h:53
TH1F * hd
Definition: Xdiff_gwt.C:57
Float_t w
Definition: plot.C:20
Online Monitoring package header.