24 #include <onlmon/OnlMonClient.h>
36 #include <TSeqCollection.h>
38 #include <WidgetMessageTypes.h>
50 "PHENIX raw data files",
"*.prdf",
70 : TGMainFrame(p, w, h)
77 std::cout <<
POMS_VER <<
"PomsMainFrame constructor called..." << std::endl;
80 if (getenv(
"ONLMON_MACROS"))
86 std::cout <<
"Environment variable ONLMON_MACROS not set, using current dir" << std::endl;
90 TGFrame* rootWin = (TGFrame*) gClient->GetRoot();
101 TGLayoutHints* menuLayout =
new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0);
107 _menuFile =
new TGPopupMenu(gClient->GetRoot());
110 _menuBar =
new TGMenuBar(
this, 1, 1, kHorizontalFrame | kRaisedFrame);
119 AddFrame(
_menuBar,
new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX,
123 SetWindowName(
"POMS: PHENIX Online Monitoring System");
136 std::cout <<
POMS_VER <<
"Attempting Build of PomsMainFrame..." << std::endl;
144 AddFrame(
_shutter,
new TGLayoutHints(kLHintsTop | kLHintsExpandX | kLHintsExpandY));
155 xsize -= (
_shutter->GetDefaultWidth()) + 30;
179 TGMainFrame::CloseWindow();
182 gROOT->ProcessLine(
".q");
194 std::cout <<
"Msg = " << msg << std::endl
195 <<
"GET_MSG = " << GET_MSG(msg) << std::endl
196 <<
"SUB_MSG = " << GET_SUBMSG(msg) << std::endl
197 <<
"parm1 = " << parm1 << std::endl
198 <<
"parm2 = " << parm2 << std::endl;
202 switch (GET_MSG(msg))
206 switch (GET_SUBMSG(msg))
241 new TGMsgBox(gClient->GetRoot(),
this,
242 POMS_VER,
"General error in executing widget handler!",
243 kMBIconStop, kMBOk, &retval);
266 int addDefaultActions,
int loadLibrary)
272 sub =
new SubSystem(name, prefix, loadLibrary);
274 if (addDefaultActions != 0)
278 std::cout <<
POMS_VER <<
"SubSystem " << name <<
" added..." << std::endl;
282 std::cout <<
POMS_VER <<
"Unable to add subsystem " << name <<
"!" << std::endl;
283 std::cout <<
"\t" << str << std::endl;
293 std::cout <<
POMS_VER <<
"SubSystem " << subSystem->
GetName() <<
" added..." << std::endl;
299 TGShutter* shutter =
new TGShutter(
this);
300 TGShutterItem* shutterItem;
302 TGTextButton* button;
303 TGLayoutHints* layout;
305 SubSystemList::iterator subSystem;
307 SubSystemActionList::iterator
action;
308 int shutterItemId = 101;
310 std::cout <<
POMS_VER <<
"Building SubSystem Shutter..." << std::endl;
313 layout =
new TGLayoutHints(kLHintsExpandX | kLHintsTop, 5, 5, 0, 0);
317 actionList = (*subSystem)->GetActions();
318 action = actionList->begin();
321 if (action != actionList->end())
323 std::cout <<
POMS_VER <<
"\tAdding " << (*subSystem)->GetName() <<
" to shutter" << std::endl;
325 shutterItem =
new TGShutterItem(shutter,
326 new TGHotString((*subSystem)->GetName().c_str()),
328 container = (TGCompositeFrame*) shutterItem->GetContainer();
330 for (; action != actionList->end(); ++
action)
332 std::cout <<
POMS_VER <<
"\t\tAdding \"" << (*action)->GetDescription() <<
"\" button..." << std::endl;
333 button =
new TGTextButton(container,
334 (*action)->GetDescription().c_str(),
336 button->SetTextColor(0xCC00FF);
337 container->AddFrame(button, layout);
338 button->Associate(
this);
340 shutter->AddItem(shutterItem);
351 UInt_t
width = GetDefaultWidth();
362 std::cout <<
POMS_VER <<
"cannot tile canvases, canvas list empty!" << std::endl;
367 TCanvas* canvas = (TCanvas*) canvasList->First();
368 int windowCount = canvasList->LastIndex() + 1;
370 int windowCountHoriz = (int) ceil(sqrt((
double) windowCount));
371 int windowCountVert = (int) floor(sqrt((
double) windowCount));
379 (windowCountHoriz *
_windowPad) - GetDefaultWidth()) /
383 for (i = 0; i < windowCountHoriz; i++)
389 for (j = 0; j < windowCountVert; j++)
395 canvas->SetWindowSize(width, height);
396 canvas->SetWindowPosition(currX, currY);
398 canvas = (TCanvas*) canvasList->After(canvas);
411 SubSystemList::iterator subSystem;
412 TList* canvasList =
new TList();
416 canvasList->AddAll((*subSystem)->GetCanvases());
417 (*subSystem)->ShowCanvases();
431 , _canvasList(nullptr)
436 if ((strlen(name) < 1) || (strlen(prefix) < 1))
438 const char*
error =
"ERROR: name and prefix must not be null!";
445 if (macroPath.size() == 0)
447 gROOT->LoadMacro((macroPath +
"/run_" +
_prefix +
"_client.C").c_str());
464 TSeqCollection* allCanvases = gROOT->GetListOfCanvases();
465 TCanvas* canvas = (TCanvas*) allCanvases->First();
472 TString* canvasName =
new TString(canvas->GetName());
473 canvasName->ToLower();
475 if (canvasName->Contains(*prefix))
487 canvas = (TCanvas*) allCanvases->After(canvas);
493 std::cout <<
POMS_VER <<
"Canvas list empty for subsystem " <<
_name <<
"!" << std::endl;
506 std::cout <<
POMS_VER <<
"Querying subsystem " <<
_name <<
" for canvases:" << std::endl;
507 canvas = (TCanvas*) canvasList->First();
510 std::cout <<
"\t" << canvas->GetName() << std::endl;
511 canvas = (TCanvas*) canvasList->After(canvas);
513 std::cout <<
"End of Canvas List" << std::endl;
525 canvas = (TCanvas*) canvasList->First();
529 canvas = (TCanvas*) canvasList->After(canvas);
543 std::cout <<
POMS_VER <<
"Action " << cmd <<
" added to " <<
_name <<
"..." << std::endl;
547 std::cout <<
POMS_VER <<
"Unable to add action " << cmd <<
"!" << std::endl;
548 std::cout <<
"\t" << str << std::endl;
557 return AddAction(cmd.c_str(), description.c_str());
570 std::cout <<
POMS_VER <<
"Add default actions to subsystem " <<
_name <<
"..." << std::endl;
611 const char*
error =
"ERROR: Action must have parent!";
622 , _description(description)
626 const char*
error =
"ERROR: Action must have parent!";
638 , _description(description)
640 if (!parent || (strlen(cmd) < 1))
642 const char*
error =
"ERROR: Action must have parent and command string!";
667 TSeqCollection* allCanvases = gROOT->GetListOfCanvases();
668 TCanvas* canvas =
nullptr;
669 while ((canvas = (TCanvas*) allCanvases->First()))
671 std::cout <<
"Deleting Canvas " << canvas->GetName() << std::endl;
674 gROOT->ProcessLine(
_cmd.c_str());
701 TSeqCollection* allCanvases = gROOT->GetListOfCanvases();
702 TCanvas* canvas =
nullptr;
703 while ((canvas = (TCanvas*) allCanvases->First()))
705 std::cout <<
"Deleting Canvas " << canvas->GetName() << std::endl;
819 : TGShutterItem(p, s, id, options)
821 fButton->ChangeBackground(bgColor);