Belle II Software development
EclFrame Class Reference

Root TGMainFrame that contains multiple widgets that display the ECLSimHit's w.r.t. More...

#include <EclFrame.h>

Inheritance diagram for EclFrame:

Public Member Functions

 EclFrame (int painter_type, EclData *data, bool auto_display, ECL::ECLChannelMapper *mapper)
 
virtual ~EclFrame ()
 ECLFrame destructor.
 
void loadNewData ()
 Update view of the data.
 
void updateCanvas ()
 Redraw m_ecanvas.
 
void handleMenu (int id)
 Apply action from menu.
 
void updateEventRange ()
 Change event range and pass information to m_ecl_data.
 
void showPrevEvents ()
 Show previous range of events.
 
void showNextEvents ()
 Show next range of events.
 
void excludeChannel ()
 Exclude channel specified in the GUI.
 
void doDraw ()
 Get view parameters from GUI and call updateCanvas().
 
void doDrawAll ()
 Draw all events on m_ecanvas.
 
void updateInfo (int event, int px, int py, TObject *)
 Update information on the cursor position in the histogram.
 
void changeRange (TGListTreeItem *entry, int btn)
 Opens shapers of specific crate/channels of specific shaper.
 
void changeType (int type, bool redraw=true)
 Change EclPainter type when selected in drop-down menu.
 

Private Types

enum  EclFrameCommandIdentifiers {
  M_FILE_OPEN ,
  M_FILE_SAVE ,
  M_FILE_EXPORT_TREE ,
  M_FILE_EXIT ,
  M_VIEW_EVENTS ,
  M_VIEW_ENERGY ,
  M_VIEW_DET_FULL ,
  M_VIEW_DET_FORW ,
  M_VIEW_DET_BACK ,
  M_VIEW_DET_BARR
}
 Enum for menu commands. More...
 

Private Member Functions

void initGUI (int w, int h)
 Initialize GUI.
 
void initData ()
 Initialize data.
 

Private Attributes

TGVerticalFrame * m_settings
 Main frame for settings; its subframes contain settings for different categories.
 
MultilineWidgetm_frame1
 Information subframe.
 
TGGroupFrame * m_frame2
 Event range subframe.
 
TGGroupFrame * m_frame3
 Optional subframe, crate/shaper select.
 
TGListTree * m_list_tree
 Tree GUI of crates/shapers.
 
TGGroupFrame * m_frame4
 Channel exclusion subframe.
 
TGGroupFrame * m_frame5
 Energy threshold subframe.
 
TGTextButton * m_draw
 Button that initiates drawing of the data for selected events.
 
TGTextButton * m_draw_all
 Button that initiates drawing of the data for all events.
 
TRootEmbeddedCanvas * m_ecanvas
 Embedded canvas.
 
EclPainterType m_painter_type
 Current painter type.
 
EclDatam_ecl_data
 EclData, class containing data to display.
 
TGDoubleHSlider * m_ev_slider
 Slider to set the time range.
 
TGNumberEntry * m_events_min
 Min value for range of displayed events.
 
TGNumberEntry * m_events_max
 Max value for range of displayed events.
 
TGNumberEntry * m_channel_id
 Number field for channel exclusion.
 
EclData::EclSubsystem m_subsys
 Current subsystem displayed.
 
TGNumberEntry * m_min_en_threshold
 Min value for energy threshold.
 
TGNumberEntry * m_max_en_threshold
 Max value for energy threshold.
 
TGCheckButton * m_threshold_switch
 Check button to turn energy threshold on/off.
 
EclPainterm_ecl_painter
 Current EclPainter.
 
ECL::ECLChannelMapperm_mapper
 ECLChannelMapper, class for conversion from CellID to (crate, shaper, chn_id).
 
bool m_auto_display
 This flag controls whether to display newly loaded events automatically.
 
int m_last_event
 If m_auto_display is set, this is the evtn of last displayed event.
 
bool m_open
 Default is true, m_open is set to false when EclFrame closes.
 

Static Private Attributes

static const char * filetypes []
 Possible export filetypes for histograms.
 

Detailed Description

Root TGMainFrame that contains multiple widgets that display the ECLSimHit's w.r.t.

structure of ECL geometry and its data acquisition subsystem.

Definition at line 41 of file EclFrame.h.

Member Enumeration Documentation

◆ EclFrameCommandIdentifiers

Enum for menu commands.

Enumerator
M_FILE_EXPORT_TREE 

Export EclDisplay data into simple TTree.

M_VIEW_EVENTS 

Display histograms for events.

M_VIEW_ENERGY 

Display histograms for energy.

M_VIEW_DET_FULL 

Use data from all ECL subsystems.

M_VIEW_DET_FORW 

Use data from forward endcap only.

M_VIEW_DET_BACK 

Use data from backward endcap only.

M_VIEW_DET_BARR 

Use data from barrel only.

Definition at line 111 of file EclFrame.h.

111 {
112 M_FILE_OPEN,
113 M_FILE_SAVE,
115 M_FILE_EXIT,
116
123 };
@ M_VIEW_DET_BACK
Use data from backward endcap only.
Definition: EclFrame.h:121
@ M_VIEW_ENERGY
Display histograms for energy.
Definition: EclFrame.h:118
@ M_VIEW_DET_BARR
Use data from barrel only.
Definition: EclFrame.h:122
@ M_VIEW_DET_FULL
Use data from all ECL subsystems.
Definition: EclFrame.h:119
@ M_VIEW_DET_FORW
Use data from forward endcap only.
Definition: EclFrame.h:120
@ M_FILE_EXPORT_TREE
Export EclDisplay data into simple TTree.
Definition: EclFrame.h:114
@ M_VIEW_EVENTS
Display histograms for events.
Definition: EclFrame.h:117

Constructor & Destructor Documentation

◆ EclFrame()

EclFrame ( int  painter_type,
EclData data,
bool  auto_display,
ECL::ECLChannelMapper mapper 
)
Parameters
painter_typepainter type
dataECL data
auto_displayDisplay new events as soon as they are loaded.
mapperECL channel mapper

Definition at line 55 of file EclFrame.cc.

56{
57 m_open = true;
58 m_subsys = EclData::ALL;
59 m_ecl_data = data;
60 m_mapper = mapper;
61 m_painter_type = (EclPainterType)painter_type;
64 m_last_event = -1;
65
66 for (int i = 1; i <= data->getCrystalCount(); i++) {
67 int phi_id = data->getPhiId(i);//GetPhiId(i);
68 int theta_id = data->getThetaId(i);//GetThetaId(i);
69
70 if (phi_id == -1 || theta_id == -1)
71 data->excludeChannel(i);
72 }
73
74 initGUI(1000, 700);
75
76 m_auto_display = auto_display;
77
78 gStyle->SetOptStat(0);
79
80 doDraw();
81}
ECL::ECLChannelMapper * m_mapper
ECLChannelMapper, class for conversion from CellID to (crate, shaper, chn_id).
Definition: EclFrame.h:101
bool m_open
Default is true, m_open is set to false when EclFrame closes.
Definition: EclFrame.h:108
int m_last_event
If m_auto_display is set, this is the evtn of last displayed event.
Definition: EclFrame.h:106
EclPainterType m_painter_type
Current painter type.
Definition: EclFrame.h:70
EclData::EclSubsystem m_subsys
Current subsystem displayed.
Definition: EclFrame.h:88
bool m_auto_display
This flag controls whether to display newly loaded events automatically.
Definition: EclFrame.h:104
void initGUI(int w, int h)
Initialize GUI.
Definition: EclFrame.cc:89
void doDraw()
Get view parameters from GUI and call updateCanvas().
Definition: EclFrame.cc:472
EclData * m_ecl_data
EclData, class containing data to display.
Definition: EclFrame.h:73
EclPainter * m_ecl_painter
Current EclPainter.
Definition: EclFrame.h:99
static EclPainter * createPainter(EclPainterType type, EclData *data, ECL::ECLChannelMapper *mapper, EclData::EclSubsystem subsys=EclData::ALL)
Creates EclPainter of the specified type.
EclPainterType
Enum for type of EclPainter to create.

◆ ~EclFrame()

~EclFrame ( )
virtual

ECLFrame destructor.

Calls parent class Cleanup() method.

Definition at line 83 of file EclFrame.cc.

84{
85 // TODO: Fix this, right now using this for testing.
86 Cleanup();
87}

Member Function Documentation

◆ changeRange()

void changeRange ( TGListTreeItem *  entry,
int  btn 
)

Opens shapers of specific crate/channels of specific shaper.

Definition at line 516 of file EclFrame.cc.

517{
519 Layout();
520 MapSubwindows();
521
522 TGListTreeItem* parent = entry->GetParent();
523 if (!parent) {
524 // Root entry (detector) has been selected.
526 } else {
527 TGListTreeItem* grandparent = parent->GetParent();
528 if (!grandparent) {
529 // Crate entry had been selected.
531 long crate = (long)entry->GetUserData();
532 m_ecl_painter->setXRange(crate * 12, crate * 12 + 11);
533 doDraw();
534 } else {
535 // Shaper entry had been selected.
537 long shaper = (long)entry->GetUserData();
538 long crate = (long)parent->GetUserData();
539 shaper = 12 * crate + shaper;
540 ((EclPainter1D*)m_ecl_painter)->setShaper(crate + 1, shaper + 1);
541 doDraw();
542 }
543 }
544}
void changeType(int type, bool redraw=true)
Change EclPainter type when selected in drop-down menu.
Definition: EclFrame.cc:546
MultilineWidget * m_frame1
Information subframe.
Definition: EclFrame.h:48
Painter for EclData, 1D histograms.
Definition: EclPainter1D.h:24
virtual void setXRange(int x1, int x2)
Set XRange for histogram in EclPainter.
Definition: EclPainter.cc:84
void setLineCount(int count)
Add or remove lines depending on current line count.
@ PAINTER_CHANNEL
Event count/energy distribution per channel.
@ PAINTER_COLLECTOR
Event count/energy distribution per crate/ECLCollector.
@ PAINTER_SHAPER
Event count/energy distribution per shaperDSP.

◆ changeType()

void changeType ( int  type,
bool  redraw = true 
)

Change EclPainter type when selected in drop-down menu.

See EclPainterFactory.h, EclPainterType.

Definition at line 546 of file EclFrame.cc.

547{
548 EclPainter* new_painter =
551
552 if (new_painter) {
554
555 delete m_ecl_painter;
556 m_ecl_painter = new_painter;
558 m_ecanvas->GetCanvas()->Clear();
559
560 updateInfo(51, 0, 0, 0);
561
562 Layout();
563 MapSubwindows();
564 Layout();
565
566 if (redraw)
567 doDraw();
568 }
569}
void updateInfo(int event, int px, int py, TObject *)
Update information on the cursor position in the histogram.
Definition: EclFrame.cc:494
TRootEmbeddedCanvas * m_ecanvas
Embedded canvas.
Definition: EclFrame.h:67
Painter for EclData, parent class, created with EclPainterFactory.
Definition: EclPainter.h:29

◆ doDraw()

void doDraw ( )

Get view parameters from GUI and call updateCanvas().

Definition at line 472 of file EclFrame.cc.

473{
474 m_ecl_data->setEventRange(m_events_min->GetIntNumber(),
475 m_events_max->GetIntNumber());
476
477 float en_min = m_min_en_threshold->GetNumber();
478 float en_max = m_max_en_threshold->GetNumber();
479 if (m_threshold_switch->GetState() == kButtonDown)
480 m_ecl_data->setEnergyThreshold(en_min, en_max);
481 else
483
484 updateCanvas();
485}
void setEventRange(int ev_min, int ev_max, bool do_update=true)
Sets event range to (ev_min, ev_max)
Definition: EclData.cc:237
void setEnergyThreshold(int en_min, int en_max, bool do_update=true)
Sets energy range to (en_min, en_max).
Definition: EclData.cc:248
TGNumberEntry * m_events_max
Max value for range of displayed events.
Definition: EclFrame.h:82
TGNumberEntry * m_max_en_threshold
Max value for energy threshold.
Definition: EclFrame.h:94
TGNumberEntry * m_min_en_threshold
Min value for energy threshold.
Definition: EclFrame.h:92
TGNumberEntry * m_events_min
Min value for range of displayed events.
Definition: EclFrame.h:80
TGCheckButton * m_threshold_switch
Check button to turn energy threshold on/off.
Definition: EclFrame.h:96
void updateCanvas()
Redraw m_ecanvas.
Definition: EclFrame.cc:400

◆ doDrawAll()

void doDrawAll ( )

Draw all events on m_ecanvas.

Definition at line 487 of file EclFrame.cc.

488{
490
491 updateCanvas();
492}
int getLastEventId()
Definition: EclData.cc:268

◆ excludeChannel()

void excludeChannel ( )

Exclude channel specified in the GUI.

Definition at line 465 of file EclFrame.cc.

466{
467 int ch = m_channel_id->GetNumber();
468 m_ecl_data->excludeChannel(ch, true);
469 doDraw();
470}
void excludeChannel(int ch, bool do_update=false)
Excludes specific channel from the count of events and energy.
Definition: EclData.cc:298
TGNumberEntry * m_channel_id
Number field for channel exclusion.
Definition: EclFrame.h:85

◆ handleMenu()

void handleMenu ( int  id)

Apply action from menu.

Definition at line 302 of file EclFrame.cc.

303{
304 static TString dir(".");
305 TGFileInfo fi;
306 TFile* file;
307
308 switch (id) {
309 case M_FILE_OPEN:
310 fi.fFileTypes = 0;
311 fi.fIniDir = StrDup(dir);
312 new TGFileDialog(gClient->GetRoot(), this, kFDOpen, &fi);
313 if (fi.fFilename) {
314 if (gSystem->AccessPathName(fi.fFilename, kFileExists) == 0) {
315 B2DEBUG(50, "ECLFrame:: Opening file " << fi.fFilename);
316 m_ecl_data->loadRootFile(fi.fFilename);
317 loadNewData();
318 }
319 }
320 // doDraw();
321 break;
322 case M_FILE_SAVE:
323 fi.fFileTypes = filetypes;
324 fi.fIniDir = StrDup(dir);
325 new TGFileDialog(gClient->GetRoot(), this, kFDSave, &fi);
326 B2DEBUG(50, "Save file: " << fi.fFilename
327 << "(dir: " << fi.fIniDir << ")");
328 m_ecanvas->GetCanvas()->SaveAs(fi.fFilename);
329 break;
331 static const char* filetypes_root[] = {"Root", "*.root", 0, 0};
332 fi.fFileTypes = filetypes_root;
333 fi.fIniDir = StrDup(dir);
334 new TGFileDialog(gClient->GetRoot(), this, kFDSave, &fi);
335 B2DEBUG(50, "Save file: " << fi.fFilename
336 << "(dir: " << fi.fIniDir << ")");
337 file = new TFile(fi.fFilename, "RECREATE");
338 m_ecl_data->getTree()->Write("tree");
339 file->Close();
340 break;
341 case M_FILE_EXIT:
342 CloseWindow();
343 break;
344 case M_VIEW_ENERGY:
345 SetMode(1);
347 break;
348 case M_VIEW_EVENTS:
349 SetMode(0);
351 break;
352 case M_VIEW_DET_FULL:
353 m_subsys = EclData::ALL;
355 doDraw();
356 break;
357 case M_VIEW_DET_BARR:
358 m_subsys = EclData::BARR;
360 doDraw();
361 break;
362 case M_VIEW_DET_FORW:
363 m_subsys = EclData::FORW;
365 doDraw();
366 break;
367 case M_VIEW_DET_BACK:
368 m_subsys = EclData::BACKW;
370 doDraw();
371 break;
372 default:
373 break;
374 }
375}
void loadRootFile(const char *path)
Load root file containing ECLCalDigit data from the specified path.
Definition: EclData.cc:312
TTree * getTree()
Returns data contained in EclDisplay.
Definition: EclData.cc:153
static const char * filetypes[]
Possible export filetypes for histograms.
Definition: EclFrame.h:125
void loadNewData()
Update view of the data.
Definition: EclFrame.cc:377
void setDisplayedSubsystem(EclData::EclSubsystem sys)
Change between the displayed ECL subsystem (barrel, forward and backward endcaps).
Definition: EclPainter.cc:46
void SetMode(int i)
Changes between display of events (0) and energy (1).
Definition: geometry.cc:15

◆ initData()

void initData ( )
private

Initialize data.

Definition at line 287 of file EclFrame.cc.

288{
289 m_events_min->SetLimits(TGNumberFormat::kNELLimitMinMax,
291 m_events_max->SetLimits(TGNumberFormat::kNELLimitMinMax,
293
294 B2DEBUG(500, "Last event id: " << m_ecl_data->getLastEventId());
295 m_ev_slider->SetRange(0, m_ecl_data->getLastEventId());
296 m_ev_slider->SetPosition(0, 0);
297 m_ev_slider->Connect("TGDoubleHSlider", "PositionChanged()",
298 "Belle2::EclFrame", this, "updateEventRange()");
300}
TGDoubleHSlider * m_ev_slider
Slider to set the time range.
Definition: EclFrame.h:78
void updateEventRange()
Change event range and pass information to m_ecl_data.
Definition: EclFrame.cc:411

◆ initGUI()

void initGUI ( int  w,
int  h 
)
private

Initialize GUI.

Definition at line 89 of file EclFrame.cc.

90{
91 B2DEBUG(100, "EclFrame:: initializing GUI.");
92
93 SetLayoutManager(new TGVerticalLayout(this));
94 TGCompositeFrame* frame_container = new TGCompositeFrame(this, w, h, kHorizontalFrame);
95
96 /* Menu bar */
97
98 TGPopupMenu* menu_file = new TGPopupMenu(gClient->GetRoot());
99 menu_file->AddEntry("&Open...", M_FILE_OPEN);
100 menu_file->AddEntry("&Export TTree...", M_FILE_EXPORT_TREE);
101 menu_file->AddEntry("&Save As...", M_FILE_SAVE);
102 menu_file->AddSeparator();
103 menu_file->AddEntry("&Exit", M_FILE_EXIT);
104 TGPopupMenu* menu_view = new TGPopupMenu(gClient->GetRoot());
105 menu_view->AddEntry("&Show event counts in histograms", M_VIEW_EVENTS);
106 menu_view->AddEntry("&Show energy in histograms", M_VIEW_ENERGY);
107 menu_view->AddSeparator();
108 menu_view->AddEntry("&Show events from all ECL subsystems", M_VIEW_DET_FULL);
109 menu_view->AddEntry("&Show events from ECL barrel", M_VIEW_DET_BARR);
110 menu_view->AddEntry("&Show events from ECL forward endcap", M_VIEW_DET_FORW);
111 menu_view->AddEntry("&Show events from ECL backward endcap", M_VIEW_DET_BACK);
112
113 TGMenuBar* menubar = new TGMenuBar(this, w, 30);
114 menubar->AddPopup("&File", menu_file, new TGLayoutHints(kLHintsTop | kLHintsLeft));
115 menubar->AddPopup("&View", menu_view, new TGLayoutHints(kLHintsTop | kLHintsLeft));
116
117 menu_file->Connect("Activated(Int_t)", "Belle2::EclFrame",
118 this, "handleMenu(Int_t)");
119 menu_view->Connect("Activated(Int_t)", "Belle2::EclFrame",
120 this, "handleMenu(Int_t)");
121
122 AddFrame(menubar, new TGLayoutHints(kLHintsExpandX | kLHintsTop, 0, 0, 1, 1));
123
124 /* Settings */
125
126 m_settings = new TGVerticalFrame(frame_container, w / 6, h);
127
128 /* Zeroth subframe, diagram type selection */
129
130 TGComboBox* diagram_type = new TGComboBox(m_settings, -1);
131 diagram_type->SetName("DiagramType");
132 const int types_count = EclPainterFactory::getTypeTitlesCount();
133 const char** types_names = EclPainterFactory::getTypeTitles();
134 for (int i = 0; i < types_count; i++)
135 diagram_type->AddEntry(types_names[i], i);
136 diagram_type->Select(m_painter_type);
137 diagram_type->SetHeight(16);
138 m_settings->AddFrame(diagram_type, new TGLayoutHints(kLHintsExpandX));
139 diagram_type->Connect("Selected(Int_t)", "Belle2::EclFrame", this,
140 "changeType(Int_t)");
141
142 /* First settings subframe, information */
143
144 m_frame1 = new MultilineWidget(m_settings, "Info");
146
147 m_settings->AddFrame(m_frame1, new TGLayoutHints(kLHintsExpandX));
148
149 /* Second settings subframe, settings for range of events displayed */
150
151 m_frame2 = new TGGroupFrame(m_settings, "Range of displayed events");
152 m_frame2->SetLayoutManager(new TGVerticalLayout(m_frame2));
153
154 TGHorizontalFrame* frame2_1 = new TGHorizontalFrame(m_frame2);
155 TGLabel* ev_min_label = new TGLabel(frame2_1, "Min: ");
156 frame2_1->AddFrame(ev_min_label, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 2, 2, 2, 2));
157 m_events_min = new TGNumberEntry(frame2_1, 0, 6, -1, TGNumberFormat::kNESInteger);
158 frame2_1->AddFrame(m_events_min, new TGLayoutHints(kLHintsLeft, 2, 2, 2, 2));
159 TGLabel* ev_max_label = new TGLabel(frame2_1, "Max: ");
160 frame2_1->AddFrame(ev_max_label, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 2, 2, 2, 2));
161 m_events_max = new TGNumberEntry(frame2_1, 0, 6, -1, TGNumberFormat::kNESInteger);
162 frame2_1->AddFrame(m_events_max, new TGLayoutHints(kLHintsLeft, 2, 2, 2, 2));
163 m_frame2->AddFrame(frame2_1);
164
165 m_ev_slider = new TGDoubleHSlider(m_frame2, w / 6, 2);
166 m_frame2->AddFrame(m_ev_slider, new TGLayoutHints(kLHintsExpandX, 5, 5, 3, 4));
167
168 TGHorizontalFrame* frame2_2 = new TGHorizontalFrame(m_frame2);
169 TGTextButton* prev = new TGTextButton(frame2_2, "&Prev");
170 prev->Connect("Clicked()", "Belle2::EclFrame", this, "showPrevEvents()");
171 frame2_2->AddFrame(prev, new TGLayoutHints(kLHintsLeft, 5, 5, 3, 4));
172 TGTextButton* next = new TGTextButton(frame2_2, "&Next");
173 next->Connect("Clicked()", "Belle2::EclFrame", this, "showNextEvents()");
174 frame2_2->AddFrame(next, new TGLayoutHints(kLHintsRight, 5, 5, 3, 4));
175 m_frame2->AddFrame(frame2_2, new TGLayoutHints(kLHintsExpandX));
176
177 m_settings->AddFrame(m_frame2, new TGLayoutHints(kLHintsExpandX, 2, 2, 2, 2));
178
179 /* Third settings subframe */
180
181 // Contains TGTreeList object which allows user to choose which channels
182 // are going to be displayed.
183 m_frame3 = new TGGroupFrame(m_settings, "Displayed channels");
184 char temp[255];
185 TGCanvas* list_canvas = new TGCanvas(m_frame3, 1, 100);
186 m_list_tree = new TGListTree(list_canvas, kHorizontalFrame);
187 m_list_tree->Associate(m_frame3);
188 TGListTreeItem* root = m_list_tree->AddItem(0, "Detector");
189 m_list_tree->OpenItem(root);
190 for (int i = 0; i < 52; i++) {
191 sprintf(temp, "Collector %d", i);
192 TGListTreeItem* parent = m_list_tree->AddItem(root, temp);
193 parent->SetUserData((void*)((intptr_t)i));
194 for (int j = 0; j < 12; j++) {
195 sprintf(temp, "Shaper %d", i * 12 + j);
196 TGListTreeItem* item = m_list_tree->AddItem(parent, temp);
197 item->SetUserData((void*)((intptr_t)j));
198 }
199 }
200
201 m_list_tree->Connect("Clicked(TGListTreeItem*, Int_t)", "Belle2::EclFrame", this,
202 "changeRange(TGListTreeItem*, Int_t)");
203
204 m_frame3->AddFrame(list_canvas, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
205 m_settings->AddFrame(m_frame3, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 2, 2, 2, 2));
206
207 /* Fourth settings subframe, channel exclusion */
208
209 m_frame4 = new TGGroupFrame(m_settings, "Channel exclusion");
210 m_frame4->SetLayoutManager(new TGHorizontalLayout(m_frame4));
211 m_channel_id = new TGNumberEntry(m_frame4, 0, 6, -1, TGNumberFormat::kNESInteger);
212 m_frame4->AddFrame(m_channel_id, new TGLayoutHints(kLHintsLeft, 2, 2, 2, 2));
213 TGTextButton* exclude = new TGTextButton(m_frame4, "&Exclude");
214 exclude->Connect("Clicked()", "Belle2::EclFrame", this, "excludeChannel()");
215 m_frame4->AddFrame(exclude, new TGLayoutHints(kLHintsRight, 5, 5, 3, 4));
216
217 m_settings->AddFrame(m_frame4, new TGLayoutHints(kLHintsExpandX, 2, 2, 2, 2));
218
219 /* Fifth settings subframe, energy threshold */
220
221 m_frame5 = new TGGroupFrame(m_settings, "Energy threshold");
222 TGHorizontalFrame* frame5_1 = new TGHorizontalFrame(m_frame5);
223 frame5_1->SetLayoutManager(new TGHorizontalLayout(frame5_1));
224 m_min_en_threshold = new TGNumberEntry(frame5_1, 2.5, 6, -1);
225 TGLabel* min_lab = new TGLabel(frame5_1, "MeV");
226 m_max_en_threshold = new TGNumberEntry(frame5_1, 150, 6, -1);
227 TGLabel* max_lab = new TGLabel(frame5_1, "MeV");
228 frame5_1->AddFrame(m_min_en_threshold, new TGLayoutHints(kLHintsLeft, 2, 2, 2, 2));
229 frame5_1->AddFrame(min_lab, new TGLayoutHints(kLHintsLeft, 2, 2, 2, 2));
230 frame5_1->AddFrame(max_lab, new TGLayoutHints(kLHintsRight, 2, 2, 2, 2));
231 frame5_1->AddFrame(m_max_en_threshold, new TGLayoutHints(kLHintsRight, 2, 2, 2, 2));
232
233 m_frame5->AddFrame(frame5_1);
234 m_threshold_switch = new TGCheckButton(m_frame5, "Enable energy threshold");
235 m_threshold_switch->SetState(kButtonDown);
236 m_frame5->AddFrame(m_threshold_switch);
237
238 m_settings->AddFrame(m_frame5, new TGLayoutHints(kLHintsExpandX, 2, 2, 2, 2));
239
240 /* Sixth settings subframe, "Draw" button */
241
242 m_draw = new TGTextButton(m_settings, "&Draw");
243 m_draw->Connect("Clicked()", "Belle2::EclFrame", this, "doDraw()");
244 m_settings->AddFrame(m_draw, new TGLayoutHints(kLHintsCenterX, 5, 5, 3, 4));
245
246 m_draw_all = new TGTextButton(m_settings, "&Draw All");
247 m_draw_all->Connect("Clicked()", "Belle2::EclFrame", this, "doDrawAll()");
248 m_settings->AddFrame(m_draw_all, new TGLayoutHints(kLHintsCenterX, 5, 5, 3, 4));
249
250 /* Adding the entire subframe of settings */
251
252 frame_container->AddFrame(m_settings);
253
254 /* Canvas widget */
255
256 m_ecanvas = new TRootEmbeddedCanvas("Ecanvas", frame_container, w / 2, h / 2);
257 m_ecanvas->GetCanvas()->SetRightMargin(0.125);
258 m_ecanvas->GetCanvas()->SetLeftMargin(0.1);
259 frame_container->AddFrame(m_ecanvas, new TGLayoutHints(
260 kLHintsExpandX | kLHintsExpandY, 10, 10, 10, 1));
261
262 m_ecanvas->GetCanvas()->
263 Connect("TCanvas", "ProcessedEvent(Int_t, Int_t, Int_t, TObject*)",
264 "Belle2::EclFrame", this, "updateInfo(Int_t, Int_t, Int_t, TObject*)");
265
266 /* Adding frame container for settings and canvas to the main window */
267
268 AddFrame(frame_container, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY,
269 1, 1, 1, 1));
270
271 B2DEBUG(100, "EclFrame:: GUI initialized.");
272
273 frame_container->SetMinWidth(w / 2);
274 // Add this if Root still throws BadDrawable errors.
275 // frame_container->SetMinHeight(h);
276
277 SetWindowName("ECL Data");
278 MapSubwindows();
279 Resize(w, h);
280 MapWindow();
281
282 B2DEBUG(100, "EclFrame:: Initializing data.");
283 initData();
284 B2DEBUG(100, "EclFrame:: Data initialized.");
285}
TGListTree * m_list_tree
Tree GUI of crates/shapers.
Definition: EclFrame.h:55
void initData()
Initialize data.
Definition: EclFrame.cc:287
TGVerticalFrame * m_settings
Main frame for settings; its subframes contain settings for different categories.
Definition: EclFrame.h:45
TGGroupFrame * m_frame5
Energy threshold subframe.
Definition: EclFrame.h:60
TGGroupFrame * m_frame3
Optional subframe, crate/shaper select.
Definition: EclFrame.h:53
TGGroupFrame * m_frame4
Channel exclusion subframe.
Definition: EclFrame.h:58
TGTextButton * m_draw_all
Button that initiates drawing of the data for all events.
Definition: EclFrame.h:64
TGGroupFrame * m_frame2
Event range subframe.
Definition: EclFrame.h:50
TGTextButton * m_draw
Button that initiates drawing of the data for selected events.
Definition: EclFrame.h:62
static const char ** getTypeTitles()
Returns array of titles for each EclPainter type.
static int getTypeTitlesCount()
Size of array from getTypeTitles()
Widget which contains the dynamic amount of TGLabel objects.

◆ loadNewData()

void loadNewData ( )

Update view of the data.

Definition at line 377 of file EclFrame.cc.

378{
379 m_ev_slider->SetRange(0, m_ecl_data->getLastEventId());
380 m_events_min->SetLimits(TGNumberFormat::kNELLimitMinMax,
382 m_events_max->SetLimits(TGNumberFormat::kNELLimitMinMax,
384
385 if (m_last_event < m_ecl_data->getLastEventId() &&
386 (m_auto_display || m_last_event == -1)) {
387 m_last_event++;
388 if (m_last_event <= 1) {
389 // Draw the first loaded event and update GUI.
390 doDraw();
391 m_settings->MapSubwindows();
392 MapSubwindows();
393
394 m_ev_slider->SetPosition(0, 0);
395 }
397 }
398}

◆ showNextEvents()

void showNextEvents ( )

Show next range of events.

Definition at line 444 of file EclFrame.cc.

445{
446 Float_t ev_min, ev_max, diff;
447
448 ev_min = m_events_min->GetNumber();
449 ev_max = m_events_max->GetNumber();
450
451 if (ev_max >= m_ecl_data->getLastEventId())
452 return;
453
454 diff = ev_max - ev_min + 1;
455 ev_min += diff;
456 ev_max += diff;
457 if (ev_max > m_ecl_data->getLastEventId())
458 ev_max = m_ecl_data->getLastEventId();
459
460 m_ev_slider->SetPosition(ev_min, ev_max);
462 doDraw();
463}

◆ showPrevEvents()

void showPrevEvents ( )

Show previous range of events.

Definition at line 423 of file EclFrame.cc.

424{
425 Float_t ev_min, ev_max, diff;
426
427 ev_min = m_events_min->GetNumber();
428 ev_max = m_events_max->GetNumber();
429
430 if (ev_min <= 0)
431 return;
432
433 diff = ev_max - ev_min + 1;
434 ev_min -= diff;
435 ev_max -= diff;
436 if (ev_min < 0)
437 ev_max = 0;
438
439 m_ev_slider->SetPosition(ev_min, ev_max);
441 doDraw();
442}

◆ updateCanvas()

void updateCanvas ( )

Redraw m_ecanvas.

Definition at line 400 of file EclFrame.cc.

401{
402 TCanvas* fCanvas = m_ecanvas->GetCanvas();
403
404 fCanvas->SetLogz();
405 fCanvas->cd();
407 updateInfo(51, 0, 0, 0);
408 fCanvas->Update();
409}
virtual void Draw()=0
Redraw the canvas.

◆ updateEventRange()

void updateEventRange ( )

Change event range and pass information to m_ecl_data.

Definition at line 411 of file EclFrame.cc.

412{
413 Float_t ev_min, ev_max;
414 m_ev_slider->GetPosition(&ev_min, &ev_max);
415
416 m_events_min->SetNumber(ev_min);
417 m_events_max->SetNumber(ev_max);
418
419 m_ev_slider->MapWindow();
420 m_ev_slider->MapSubwindows();
421}

◆ updateInfo()

void updateInfo ( int  event,
int  px,
int  py,
TObject *   
)

Update information on the cursor position in the histogram.

Definition at line 494 of file EclFrame.cc.

495{
496 if (event == 11) {
497 EclPainter* new_painter = m_ecl_painter->handleClick(px, py);
498
499 if (new_painter != nullptr) {
500 delete m_ecl_painter;
501 m_ecl_painter = new_painter;
502 doDraw();
503
504 Layout();
505 MapSubwindows();
506 }
507 }
508 // On mouse move
509 if (event == 51) {
511
512 m_frame1->Layout();
513 }
514}
virtual void getInformation(int px, int py, MultilineWidget *panel)
Sets the information to be displayed in the provided MultilineWidget.
Definition: EclPainter.cc:72
virtual EclPainter * handleClick(int px, int py)
Some EclPainters can shift to another view upon click.
Definition: EclPainter.cc:79

Member Data Documentation

◆ filetypes

const char * filetypes
staticprivate
Initial value:
= {
"PDF", "*.pdf",
"PostScript", "*.ps",
"Encapsulated PostScript", "*.eps",
"SVG", "*.svg",
"TeX", "*.tex",
"GIF", "*.gif",
"ROOT macros", "*.C",
"ROOT files", "*.root",
"XML", "*.xml",
"PNG", "*.png",
"XPM", "*.xpm",
"JPEG", "*.jpg",
"TIFF", "*.tiff",
"XCF", "*.xcf",
0, 0
}

Possible export filetypes for histograms.

Definition at line 125 of file EclFrame.h.

◆ m_auto_display

bool m_auto_display
private

This flag controls whether to display newly loaded events automatically.

Definition at line 104 of file EclFrame.h.

◆ m_channel_id

TGNumberEntry* m_channel_id
private

Number field for channel exclusion.

Definition at line 85 of file EclFrame.h.

◆ m_draw

TGTextButton* m_draw
private

Button that initiates drawing of the data for selected events.

Definition at line 62 of file EclFrame.h.

◆ m_draw_all

TGTextButton* m_draw_all
private

Button that initiates drawing of the data for all events.

Definition at line 64 of file EclFrame.h.

◆ m_ecanvas

TRootEmbeddedCanvas* m_ecanvas
private

Embedded canvas.

Definition at line 67 of file EclFrame.h.

◆ m_ecl_data

EclData* m_ecl_data
private

EclData, class containing data to display.

Definition at line 73 of file EclFrame.h.

◆ m_ecl_painter

EclPainter* m_ecl_painter
private

Current EclPainter.

Definition at line 99 of file EclFrame.h.

◆ m_ev_slider

TGDoubleHSlider* m_ev_slider
private

Slider to set the time range.

Slider for choosing events range.

Definition at line 78 of file EclFrame.h.

◆ m_events_max

TGNumberEntry* m_events_max
private

Max value for range of displayed events.

Definition at line 82 of file EclFrame.h.

◆ m_events_min

TGNumberEntry* m_events_min
private

Min value for range of displayed events.

Definition at line 80 of file EclFrame.h.

◆ m_frame1

MultilineWidget* m_frame1
private

Information subframe.

Definition at line 48 of file EclFrame.h.

◆ m_frame2

TGGroupFrame* m_frame2
private

Event range subframe.

Definition at line 50 of file EclFrame.h.

◆ m_frame3

TGGroupFrame* m_frame3
private

Optional subframe, crate/shaper select.

Definition at line 53 of file EclFrame.h.

◆ m_frame4

TGGroupFrame* m_frame4
private

Channel exclusion subframe.

Definition at line 58 of file EclFrame.h.

◆ m_frame5

TGGroupFrame* m_frame5
private

Energy threshold subframe.

Definition at line 60 of file EclFrame.h.

◆ m_last_event

int m_last_event
private

If m_auto_display is set, this is the evtn of last displayed event.

Definition at line 106 of file EclFrame.h.

◆ m_list_tree

TGListTree* m_list_tree
private

Tree GUI of crates/shapers.

Definition at line 55 of file EclFrame.h.

◆ m_mapper

ECL::ECLChannelMapper* m_mapper
private

ECLChannelMapper, class for conversion from CellID to (crate, shaper, chn_id).

Definition at line 101 of file EclFrame.h.

◆ m_max_en_threshold

TGNumberEntry* m_max_en_threshold
private

Max value for energy threshold.

Definition at line 94 of file EclFrame.h.

◆ m_min_en_threshold

TGNumberEntry* m_min_en_threshold
private

Min value for energy threshold.

Definition at line 92 of file EclFrame.h.

◆ m_open

bool m_open
private

Default is true, m_open is set to false when EclFrame closes.

Definition at line 108 of file EclFrame.h.

◆ m_painter_type

EclPainterType m_painter_type
private

Current painter type.

See EclPainterFactory for the list of all types.

Definition at line 70 of file EclFrame.h.

◆ m_settings

TGVerticalFrame* m_settings
private

Main frame for settings; its subframes contain settings for different categories.

Definition at line 45 of file EclFrame.h.

◆ m_subsys

EclData::EclSubsystem m_subsys
private

Current subsystem displayed.

Definition at line 88 of file EclFrame.h.

◆ m_threshold_switch

TGCheckButton* m_threshold_switch
private

Check button to turn energy threshold on/off.

Definition at line 96 of file EclFrame.h.


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