Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
evdb::DisplayWindow Class Reference

An event display window. More...

#include "/cvmfs/nova.opensciencegrid.org/externals/nuevdb/v1_00_02/source/nuevdb/EventDisplayBase/DisplayWindow.h"

Public Member Functions

 DisplayWindow (int window=0)
 
virtual ~DisplayWindow ()
 
virtual void Draw (const char *opt="")
 
virtual void CloseWindow ()
 
void Raise ()
 
void SetRunEvent (int run, int event)
 
void SetServices ()
 

Static Public Member Functions

static void Register (const char *name, const char *description, unsigned int h, unsigned int w, CanvasCreator_t creator)
 
static const std::vector< std::string > & Names ()
 
static int OpenWindow (int type=0)
 
static void SetRunEventAll (int run, int event)
 
static void SetServicesAll ()
 
static void DrawAll (const char *opt=0)
 

Private Attributes

TGMainFrame * fMain
 Main window. More...
 
MenuBarfMenuBar
 Top menu bar. More...
 
ButtonBarfButtonBar
 Top button bar. More...
 
StatusBarfStatusBar
 Status bar running along the bottom. More...
 
CanvasfDisplay
 Display of detector event information. More...
 

Detailed Description

An event display window.

Definition at line 33 of file DisplayWindow.h.

Constructor & Destructor Documentation

evdb::DisplayWindow::DisplayWindow ( int  window = 0)

Definition at line 142 of file DisplayWindow.cxx.

References evdb::Canvas::Connect(), fButtonBar, fDisplay, fMain, fMenuBar, fStatusBar, evdb::gsWindows(), make_syst_table_plots::h, and w.

Referenced by OpenWindow().

143  {
144  if(gROOT->IsBatch())
145  throw cet::exception("DisplayWindow") << "ROOT is in batch mode"
146  << " cannot open DisplayWindow";
147  if(!gClient)
148  throw cet::exception("DisplayWindow") << "No ROOT global TClient";
149 
150  const TGWindow* tgw = gClient->GetRoot();
151  if(!tgw)
152  throw cet::exception("DisplayWindow") << "No TGWindow pointer";
153 
154  // Create the main application window. I need a resize to get the
155  // window to draw the first time, so create the window slightly
156  // smaller than the intended size. Bogus, but so it goes...
157  unsigned int w = gsWidth[id];
158  unsigned int h = gsHeight[id];
159  fMain = new TGMainFrame(tgw, w-1, h-1);
160 
161  // Add items to the main window
162  fMenuBar = new MenuBar(fMain);
163  fButtonBar = new ButtonBar(fMain);
165  fStatusBar = new StatusBar(fMain);
166 
167  fMain->SetWindowName(gsName[id].c_str());
168 
169  // Now that all the subwindows are attached, do the final layout
170  fMain->MapSubwindows();
171  fMain->MapWindow();
172 
173  // Don't understand this, but I need a resize to get things to draw
174  // the first time...
175  fMain->Resize(w,h);
176 
177  // Plug the display into its signal/slots
178  fDisplay->Connect();
179 
180  fMain->Connect("CloseWindow()","evdb::DisplayWindow",this,"CloseWindow()");
181 
182  // Add to list of windows open
183  gsWindows[id] = this;
184  }
::xsd::cxx::tree::id< char, ncname > id
Definition: Database.h:165
MenuBar * fMenuBar
Top menu bar.
Definition: DisplayWindow.h:60
void Connect()
Make signal/slot connections.
Definition: Canvas.cxx:68
static std::vector< DisplayWindow * > gsWindows(64)
ButtonBar * fButtonBar
Top button bar.
Definition: DisplayWindow.h:61
static std::vector< unsigned int > gsWidth
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
static std::vector< CanvasCreator_t > gsCanvasCreator
StatusBar * fStatusBar
Status bar running along the bottom.
Definition: DisplayWindow.h:62
Canvas * fDisplay
Display of detector event information.
Definition: DisplayWindow.h:63
static std::vector< std::string > gsName
TGMainFrame * fMain
Main window.
Definition: DisplayWindow.h:59
Float_t w
Definition: plot.C:20
static std::vector< unsigned int > gsHeight
evdb::DisplayWindow::~DisplayWindow ( )
virtual

Definition at line 196 of file DisplayWindow.cxx.

References fButtonBar, fDisplay, fMain, fMenuBar, fStatusBar, evdb::gsWindows(), and MECModelEnuComparisons::i.

197  {
198  if (fDisplay) { delete fDisplay; fDisplay = 0; }
199  if (fStatusBar) { delete fStatusBar; fStatusBar = 0; }
200  if (fButtonBar) { delete fButtonBar; fButtonBar = 0; }
201  if (fMenuBar) { delete fMenuBar; fMenuBar = 0; }
202  if (fMain) { delete fMain; fMain = 0; }
203  for (unsigned int i=0; i<gsWindows.size(); ++i) {
204  if (gsWindows[i] == this) gsWindows[i] = 0;
205  }
206  }
MenuBar * fMenuBar
Top menu bar.
Definition: DisplayWindow.h:60
static std::vector< DisplayWindow * > gsWindows(64)
ButtonBar * fButtonBar
Top button bar.
Definition: DisplayWindow.h:61
StatusBar * fStatusBar
Status bar running along the bottom.
Definition: DisplayWindow.h:62
Canvas * fDisplay
Display of detector event information.
Definition: DisplayWindow.h:63
TGMainFrame * fMain
Main window.
Definition: DisplayWindow.h:59

Member Function Documentation

void evdb::DisplayWindow::CloseWindow ( )
virtual

Definition at line 192 of file DisplayWindow.cxx.

192 { delete this; }
void evdb::DisplayWindow::Draw ( const char *  opt = "")
virtual

Definition at line 188 of file DisplayWindow.cxx.

References evdb::Canvas::Draw(), and fDisplay.

Referenced by OpenWindow().

188 { fDisplay->Draw(opt); }
Canvas * fDisplay
Display of detector event information.
Definition: DisplayWindow.h:63
virtual void Draw(const char *opt=0)=0
void evdb::DisplayWindow::DrawAll ( const char *  opt = 0)
static

Definition at line 57 of file DisplayWindow.cxx.

References evdb::gsWindows(), and MECModelEnuComparisons::i.

Referenced by evdb::EventDisplay::postProcessEvent().

58  {
59  for (size_t i=0; i<gsWindows.size(); ++i) {
60  if (gsWindows[i]!=0) gsWindows[i]->Draw(opt);
61  }
62  }
static std::vector< DisplayWindow * > gsWindows(64)
const std::vector< std::string > & evdb::DisplayWindow::Names ( )
static

Definition at line 89 of file DisplayWindow.cxx.

References evdb::gsName.

Referenced by evdb::WindowMenu::HandleMenu(), and evdb::WindowMenu::WindowMenu().

89 { return gsName; }
static std::vector< std::string > gsName
int evdb::DisplayWindow::OpenWindow ( int  type = 0)
static

Create a window given a system-assigned ID number

Definition at line 116 of file DisplayWindow.cxx.

References DisplayWindow(), Draw(), art::EventID::event(), evt, evdb::EventHolder::GetEvent(), evdb::gsWindows(), art::Event::id(), evdb::EventHolder::Instance(), Raise(), art::EventID::run(), SetRunEvent(), and w.

Referenced by evd::EVD::beginJob(), and evdb::WindowMenu::HandleMenu().

117  {
118  unsigned id = 0;
119  if (type>0) id = type;
120  if (id>=gsName.size()) return 0;
121 
123  if (w==0) {
124  w = gsWindows[id] = new DisplayWindow(id);
125  }
126  if (w==0) return 0;
127 
128  // Update run and event number in newly opened window.
130  if(evt)
131  w->SetRunEvent(evt->id().run(), evt->id().event());
132 
133  w->Raise();
134  w->Draw();
135 
136  return 1;
137  }
::xsd::cxx::tree::id< char, ncname > id
Definition: Database.h:165
const art::Event * GetEvent() const
Definition: EventHolder.cxx:45
static std::vector< DisplayWindow * > gsWindows(64)
RunNumber_t run() const
Definition: EventID.h:98
static EventHolder * Instance()
Definition: EventHolder.cxx:15
int evt
static std::vector< std::string > gsName
EventNumber_t event() const
Definition: EventID.h:116
DisplayWindow(int window=0)
Float_t w
Definition: plot.C:20
EventID id() const
Definition: Event.h:56
void evdb::DisplayWindow::Raise ( )

Definition at line 210 of file DisplayWindow.cxx.

References fMain.

Referenced by OpenWindow().

210 { fMain->RaiseWindow(); }
TGMainFrame * fMain
Main window.
Definition: DisplayWindow.h:59
void evdb::DisplayWindow::Register ( const char *  name,
const char *  description,
unsigned int  h,
unsigned int  w,
CanvasCreator_t  creator 
)
static

Register a display canvas for use in creating windows

Definition at line 96 of file DisplayWindow.cxx.

References evdb::gsWindows(), and string.

Referenced by evd::EVD::beginJob().

101  {
102  gsName.push_back(std::string(name));
104  gsHeight.push_back(h);
105  gsWidth.push_back(w);
106  gsCanvasCreator.push_back(creator);
107 
108  if (gsName.size()>gsWindows.size()) gsWindows.resize(gsName.size());
109  }
const XML_Char * name
Definition: expat.h:151
static std::vector< DisplayWindow * > gsWindows(64)
static std::vector< unsigned int > gsWidth
static std::vector< CanvasCreator_t > gsCanvasCreator
static std::vector< std::string > gsName
static std::vector< std::string > gsDescription
Float_t w
Definition: plot.C:20
static std::vector< unsigned int > gsHeight
enum BeamMode string
void evdb::DisplayWindow::SetRunEvent ( int  run,
int  event 
)

Definition at line 66 of file DisplayWindow.cxx.

References fButtonBar, and evdb::ButtonBar::SetRunEvent().

Referenced by OpenWindow().

67  {
68  fButtonBar->SetRunEvent(run, event);
69  }
ButtonBar * fButtonBar
Top button bar.
Definition: DisplayWindow.h:61
Definition: run.py:1
void SetRunEvent(int run, int event)
Definition: ButtonBar.cxx:229
void evdb::DisplayWindow::SetRunEventAll ( int  run,
int  event 
)
static

Definition at line 48 of file DisplayWindow.cxx.

References evdb::gsWindows(), and MECModelEnuComparisons::i.

Referenced by evdb::EventDisplay::preProcessEvent().

49  {
50  for (size_t i=0; i<gsWindows.size(); ++i) {
51  if (gsWindows[i]!=0) gsWindows[i]->SetRunEvent(run, event);
52  }
53  }
static std::vector< DisplayWindow * > gsWindows(64)
Definition: run.py:1
void evdb::DisplayWindow::SetServices ( )

Definition at line 82 of file DisplayWindow.cxx.

References evdb::MenuBar::fEditMenu, fMenuBar, and evdb::EditMenu::SetServices().

83  {
85  }
MenuBar * fMenuBar
Top menu bar.
Definition: DisplayWindow.h:60
void SetServices()
Definition: EditMenu.cxx:51
EditMenu * fEditMenu
Edit menu.
Definition: MenuBar.h:36
void evdb::DisplayWindow::SetServicesAll ( )
static

Definition at line 73 of file DisplayWindow.cxx.

References evdb::gsWindows(), and MECModelEnuComparisons::i.

Referenced by evdb::EventDisplay::postBeginJob().

74  {
75  for (size_t i=0; i<gsWindows.size(); ++i) {
76  if (gsWindows[i]!=0) gsWindows[i]->SetServices();
77  }
78  }
static std::vector< DisplayWindow * > gsWindows(64)

Member Data Documentation

ButtonBar* evdb::DisplayWindow::fButtonBar
private

Top button bar.

Definition at line 61 of file DisplayWindow.h.

Referenced by DisplayWindow(), SetRunEvent(), and ~DisplayWindow().

Canvas* evdb::DisplayWindow::fDisplay
private

Display of detector event information.

Definition at line 63 of file DisplayWindow.h.

Referenced by DisplayWindow(), Draw(), and ~DisplayWindow().

TGMainFrame* evdb::DisplayWindow::fMain
private

Main window.

Definition at line 59 of file DisplayWindow.h.

Referenced by DisplayWindow(), Raise(), and ~DisplayWindow().

MenuBar* evdb::DisplayWindow::fMenuBar
private

Top menu bar.

Definition at line 60 of file DisplayWindow.h.

Referenced by DisplayWindow(), SetServices(), and ~DisplayWindow().

StatusBar* evdb::DisplayWindow::fStatusBar
private

Status bar running along the bottom.

Definition at line 62 of file DisplayWindow.h.

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


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