Public Member Functions | Private Attributes | List of all members
om::CaptionBox Class Reference

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N20-12-03/OnlineMonitoring/viewer/CaptionBox.h"

Inheritance diagram for om::CaptionBox:
om::GUIModelSubscriber

Public Member Functions

 CaptionBox (TGWindow *w)
 
 ~CaptionBox ()
 
void GUIModelDataIssue (const GUIModelData &d, unsigned int which)
 
bool GetLock ()
 
void ReleaseLock ()
 

Private Attributes

TGText * fText
 The text inside the box. More...
 

Detailed Description

Definition at line 9 of file CaptionBox.h.

Constructor & Destructor Documentation

CaptionBox::CaptionBox ( TGWindow *  w)

Definition at line 13 of file CaptionBox.cxx.

References MakeMiniprodValidationCuts::f, and fText.

13  :
14  TGTextView(w,
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 }
GUIModelSubscriber(unsigned int which)
static const unsigned int kCurrentHistogramID
Definition: GUIModelData.h:15
TGText * fText
The text inside the box.
Definition: CaptionBox.h:20
static const unsigned int fCaptionBoxSizeY
Definition: Layout.h:20
Float_t w
Definition: plot.C:20
static const unsigned int fCaptionBoxSizeX
Definition: Layout.h:19
CaptionBox::~CaptionBox ( )

Definition at line 27 of file CaptionBox.cxx.

References fText.

28 {
29  delete fText;
30 }
TGText * fText
The text inside the box.
Definition: CaptionBox.h:20

Member Function Documentation

bool GUIModelSubscriber::GetLock ( )
inherited

Definition at line 24 of file GUIModelSubscriber.cxx.

References gsLock, MECModelEnuComparisons::i, and kSleep.

Referenced by GUIModelDataIssue(), om::HistogramInfo::GUIModelDataIssue(), om::ButtonBank::GUIModelDataIssue(), om::HistogramBrowser::GUIModelDataIssue(), om::PlotViewer::GUIModelDataIssue(), and om::WatchListBox::GUIModelDataIssue().

25 {
26  unsigned int i;
27  const unsigned int kSleep = 1000; // 1 msec
28  const unsigned int kCount = 10000; // 10k tries at 1 msec = 10 seconds
29  for (i=0; i<kCount; ++i) {
30  if (gsLock==false) {
31  gsLock = true;
32  return true;
33  }
34  usleep(kSleep);
35  }
36  return false;
37 }
static bool gsLock
static const unsigned int kSleep
Definition: IPC.cxx:21
void CaptionBox::GUIModelDataIssue ( const GUIModelData d,
unsigned int  which 
)
virtual

Complete the GUIModelSubscriber interface

Implements om::GUIModelSubscriber.

Definition at line 34 of file CaptionBox.cxx.

References plot_validation_datamc::c, om::CurrentHistogram::Current(), allTimeWatchdog::endl, om::HistoData::fCaption, om::GUIModelData::fCurrentHistogram, om::HistoData::fLookBack, om::HistoData::fNx, om::HistoData::fNy, om::HistoData::fReset, om::HistoData::fType, om::HistoData::fX1, om::HistoData::fX2, om::HistoData::fY1, om::HistoData::fY2, om::GUIModelSubscriber::GetLock(), hd, MECModelEnuComparisons::i, om::HistoTable::Instance(), om::TickerSubscriber::k10min, om::TickerSubscriber::k1min, om::TickerSubscriber::k24hr, om::TickerSubscriber::k30min, om::TickerSubscriber::k30sec, om::TickerSubscriber::k5min, om::kCurrentHistogramID, om::TickerSubscriber::kHour, om::TickerSubscriber::kRun, om::TickerSubscriber::kSubrun, om::kTH1F, om::kTH2F, om::TickerSubscriber::kUTC, om::HistoTable::LookUp(), and om::GUIModelSubscriber::ReleaseLock().

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 }
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
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
double fY2
High edge of y range.
Definition: HistoData.h:54
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
void GUIModelSubscriber::ReleaseLock ( )
inherited

Member Data Documentation

TGText* om::CaptionBox::fText
private

The text inside the box.

Definition at line 20 of file CaptionBox.h.

Referenced by CaptionBox(), and ~CaptionBox().


The documentation for this class was generated from the following files: