6 #include <TGTextView.h>
9 #include <TGNumberEntry.h>
10 #include <TGDoubleSlider.h>
34 m_fr_main =
new TGMainFrame(gClient->GetRoot(), 200, 900);
35 m_fr_main->SetWMPosition(0, 0);
37 string fn_img = gSystem->Getenv(
"E1039_RESOURCE");
38 fn_img +=
"/image/onlmon_banner.png";
40 if (stat(fn_img.c_str(), &st) == 0) {
41 TGPictureButton* head2 =
new TGPictureButton(m_fr_main, fn_img.c_str());
42 head2->SetCommand(
"cout << \">> E1039 Online Monitor <<\" << endl;");
43 m_fr_main->AddFrame(head2);
45 TGTextView* head =
new TGTextView(m_fr_main, 200, 40,
"E1039 Online Monitor");
46 m_fr_main->AddFrame(head);
49 TGTextButton* button[99];
50 for (
unsigned int ii = 0; ii < m_list_omc->size(); ii++) {
51 button[ii] =
new TGTextButton(m_fr_main, m_list_omc->at(ii)->Title().c_str());
52 button[ii]->Connect(
"Clicked()",
"OnlMonClient", m_list_omc->at(ii),
"StartMonitor()");
53 m_fr_main->AddFrame(button[ii],
new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 2,2,2,2));
56 TGLabel* lbl_sp_sel =
new TGLabel(m_fr_main,
"- - - Spill Selection - - -");
57 m_fr_main->AddFrame(lbl_sp_sel,
new TGLayoutHints(kLHintsCenterY | kLHintsExpandX, 2,2,5,2));
60 TGHorizontalFrame* fr_sp_all =
new TGHorizontalFrame(m_fr_main);
62 m_rad_sp_all =
new TGRadioButton(fr_sp_all,
"All ");
63 m_rad_sp_all->Connect(
"Pressed()",
"OnlMonUI",
this,
"HandleSpRadAll()");
64 fr_sp_all->AddFrame(m_rad_sp_all,
new TGLayoutHints(kLHintsCenterY, 2,2,2,2));
66 m_lbl_sp =
new TGLabel(fr_sp_all,
"? ? ? ? ? ?-? ? ? ? ? ?");
67 fr_sp_all->AddFrame(m_lbl_sp,
new TGLayoutHints(kLHintsCenterY | kLHintsExpandX | kLHintsRight, 2,2,2,2));
69 m_fr_main->AddFrame(fr_sp_all);
73 TGHorizontalFrame* fr_sp_last =
new TGHorizontalFrame(m_fr_main);
75 m_rad_sp_last =
new TGRadioButton(fr_sp_last,
"Last ");
76 m_rad_sp_last->Connect(
"Pressed()",
"OnlMonUI",
this,
"HandleSpRadLast()");
77 fr_sp_last->AddFrame(m_rad_sp_last,
new TGLayoutHints(kLHintsCenterY | kLHintsExpandX, 2,2,2,2));
80 m_num_sp->Connect(
"ValueSet(Long_t)",
"OnlMonUI",
this,
"HandleSpLastNum()");
81 fr_sp_last->AddFrame(m_num_sp,
new TGLayoutHints(kLHintsCenterY | kLHintsCenterX, 2,2,2,2));
83 TGLabel* lbl_sp_last =
new TGLabel(fr_sp_last,
"spills");
84 fr_sp_last->AddFrame(lbl_sp_last,
new TGLayoutHints(kLHintsCenterY | kLHintsRight, 2,2,2,2));
86 m_fr_main->AddFrame(fr_sp_last);
90 m_rad_sp_range =
new TGRadioButton(m_fr_main,
"Range");
91 m_rad_sp_range->Connect(
"Pressed()",
"OnlMonUI",
this,
"HandleSpRadRange()");
92 m_fr_main->AddFrame(m_rad_sp_range,
new TGLayoutHints(kLHintsCenterY | kLHintsExpandX, 2,2,2,2));
94 m_fr_sp_range =
new TGVerticalFrame(m_fr_main);
96 TGHorizontalFrame* fr_sp =
new TGHorizontalFrame(m_fr_sp_range);
98 m_num_sp0 =
new TGNumberEntry(fr_sp, 0, 5);
99 m_num_sp0->Connect(
"ValueSet(Long_t)",
"OnlMonUI",
this,
"HandleSpEntLo()");
100 fr_sp->AddFrame(m_num_sp0,
new TGLayoutHints(kLHintsCenterY | kLHintsCenterX));
102 TGLabel* lbl_sp2 =
new TGLabel(fr_sp,
"-");
103 fr_sp->AddFrame(lbl_sp2,
new TGLayoutHints(kLHintsCenterY | kLHintsCenterX));
105 m_num_sp1 =
new TGNumberEntry(fr_sp, 0, 5);
106 m_num_sp1->Connect(
"ValueSet(Long_t)",
"OnlMonUI",
this,
"HandleSpEntHi()");
107 fr_sp->AddFrame(m_num_sp1,
new TGLayoutHints(kLHintsCenterY | kLHintsRight));
109 m_fr_sp_range->AddFrame(fr_sp,
new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 2,2,2,2));
111 m_slider =
new TGDoubleHSlider(m_fr_sp_range, 180, 0);
112 m_slider->Connect(
"PositionChanged()",
"OnlMonUI",
this,
"HandleSpSlider()");
113 m_slider->SetRange(1, 10);
114 m_fr_sp_range->AddFrame(m_slider,
new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 2,2,2,2));
116 m_fr_main->AddFrame(m_fr_sp_range);
120 TGCheckButton* check =
new TGCheckButton(m_fr_main,
new TGHotString(
"Auto-close all canvases"), 99);
121 check->SetToolTipText(
"When checked, all existing canvases are closed by clicking any button above.");
123 check->Connect(
"Toggled(Bool_t)",
"OnlMonClient", m_list_omc->at(0),
"SetClearUsFlag(Bool_t)");
124 m_fr_main->AddFrame(check,
new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 2,2,2,2));
132 TGTextButton* fExit =
new TGTextButton(m_fr_main,
"Exit",
"gApplication->Terminate(0)");
133 m_fr_main->AddFrame(fExit,
new TGLayoutHints(kLHintsTop | kLHintsExpandX, 2,2,5,5));
135 m_fr_main->SetWindowName(
"E1039 Online Monitor");
136 m_fr_main->MapSubwindows();
163 unsigned int idx = 0;
167 m_list_omc->at(idx)->StartMonitor();
169 if (++idx >= m_list_omc->size()) idx = 0;
193 m_num_sp0->SetLimits(TGNumberFormat::kNELLimitMinMax, sp_min, sp_max);
194 m_num_sp1->SetLimits(TGNumberFormat::kNELLimitMinMax, sp_min, sp_max);
195 m_slider->SetRange(sp_min, sp_max);
198 oss << sp_min <<
"-" << sp_max;
199 m_lbl_sp->SetText(oss.str().c_str());
201 m_lbl_sp->SetText(
"(not selectable)");
202 m_rad_sp_all ->SetOn(
true );
203 m_rad_sp_last ->SetOn(
false);
204 m_rad_sp_range->SetOn(
false);
205 m_rad_sp_last ->SetEnabled(
false);
206 m_rad_sp_range->SetEnabled(
false);
213 m_rad_sp_all ->SetOn(
true );
214 m_rad_sp_last ->SetOn(
false);
215 m_rad_sp_range->SetOn(
false);
216 m_fr_main->HideFrame(m_fr_sp_range);
217 m_fr_main->Resize(m_fr_main->GetDefaultSize());
218 m_fr_main->MapWindow();
224 m_rad_sp_all ->SetOn(
false);
225 m_rad_sp_last ->SetOn(
true );
226 m_rad_sp_range->SetOn(
false);
227 m_fr_main->HideFrame(m_fr_sp_range);
228 m_fr_main->Resize(m_fr_main->GetDefaultSize());
229 m_fr_main->MapWindow();
242 m_rad_sp_all ->SetOn(
false);
243 m_rad_sp_last ->SetOn(
false);
244 m_rad_sp_range->SetOn(
true );
245 m_fr_main->ShowFrame(m_fr_sp_range);
246 m_fr_main->Resize(m_fr_main->GetDefaultSize());
247 m_fr_main->MapWindow();
252 int num = (int)m_num_sp->GetNumber();
253 m_num_sp->SetNumber(num);
272 m_slider->GetPosition(sp_lo, sp_hi);
281 m_slider->SetPosition(sp_lo, sp_hi);
282 m_num_sp0->SetNumber (sp_lo);
283 m_num_sp1->SetNumber (sp_hi);
bool GetSpillSelectability()
void UpdateFullSpillRange()
void ExecAutoCycle()
This function does NOT work at present.
void SetSpillRangeHigh(const int sp)
void SetSpillMode(const SpillMode_t mode)
void GetSpillRange(int &sp_lo, int &sp_hi)
void SetSpillNum(const int num)
void SetSpillRange(const int sp_lo, const int sp_hi)
void SetSpillRangeLow(const int sp)
static void * FuncAutoCycle(void *arg)
std::vector< OnlMonClient * > OnlMonClientList_t
int ReceiveFullSpillRange()
static OnlMonComm * instance()
void GetFullSpillRange(int &id_min, int &id_max)
static bool GetClearUsFlag()
static void * ExecSpillRangeCheck(void *arg)
OnlMonUI(OnlMonClientList_t *list)