Belle II Software development
DisplayRphi.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9//-----------------------------------------------------------------------------
10// Description : A class to display CDC trigger information.
11//-----------------------------------------------------------------------------
12
13#ifdef TRGCDC_DISPLAY
14
15#include <iostream>
16#include "trg/cdc/DisplayRphi.h"
17
18using namespace std;
19
20namespace Belle2 {
26// Gtk::Main * GtkMain = 0;
27// bool TRGCDCDisplayRphi::_skipEvent = false;
28// bool TRGCDCDisplayRphi::_endOfEvent = false;
29// bool TRGCDCDisplayRphi::_endOfEventFlag = false;
30
31 TRGCDCDisplayRphi::TRGCDCDisplayRphi(const string& name,
32 double innerR,
33 double outerR,
34 int size)
35 : TRGCDCDisplay(name, size, int(outerR)),
36 _axial(true),
37 _stereo(false),
38 _w(* this, size, innerR, outerR),
39 _adjustment(double(size) / outerR / 2,
40 double(size) / outerR / 2,
41 10.0,
42 0.1),
43 _scaler(_adjustment),
44 _buttonAxial("Axial"),
45 _buttonStereo("Stereo"),
46 _buttonBelleCDC("Belle CDC")
47 {
48
49 _w.set_size_request(size, size);
50
51 _buttonAxial.set_active();
52 _axial = _buttonAxial.get_active();
53 _buttonStereo.set_active(false);
54 _stereo = _buttonStereo.get_active();
55 _buttonBelleCDC.set_active(false);
56
57 _buttonAxial
58 .signal_clicked()
59 .connect(sigc::mem_fun(* this, & TRGCDCDisplayRphi::on_axial));
60 _buttonStereo
61 .signal_clicked()
62 .connect(sigc::mem_fun(* this, & TRGCDCDisplayRphi::on_stereo));
63 _buttonBelleCDC
64 .signal_clicked()
65 .connect(sigc::mem_fun(* this, & TRGCDCDisplayRphi::on_BelleCDC));
66
67 _scaler.set_update_policy(Gtk::UPDATE_CONTINUOUS);
68 _scaler.set_digits(3);
69 _scaler.set_value_pos(Gtk::POS_LEFT);
70 _scaler.set_draw_value();
71 _scaler.set_size_request(200, 30);
72 _scaler
73 .signal_value_changed()
74 .connect(sigc::mem_fun(* this,
75 & TRGCDCDisplayRphi::on_scale_value_changed));
76
77 _bottom.pack_start(_scaler, Gtk::PACK_SHRINK, 5);
78 _bottom.pack_start(_buttonPositionReset, Gtk::PACK_EXPAND_WIDGET, 2);
79 _bottom.pack_start(_buttonAxial, Gtk::PACK_SHRINK, 2);
80 _bottom.pack_start(_buttonStereo, Gtk::PACK_SHRINK, 2);
81 _bottom.pack_start(_buttonWireName, Gtk::PACK_SHRINK, 2);
82 _bottom.pack_start(_buttonBelleCDC, Gtk::PACK_SHRINK, 2);
83
84 _box0.pack_start(_menuButtons, Gtk::PACK_SHRINK, 5);
85 _box0.pack_start(_label, Gtk::PACK_EXPAND_WIDGET, 5);
86 _box0.pack_start(_w, Gtk::PACK_EXPAND_WIDGET, 5);
87 _box0.pack_start(_bottom, Gtk::PACK_SHRINK, 5);
88
89 set_border_width(5);
90 add(_box0);
91 show_all();
92 }
93
94 TRGCDCDisplayRphi::~TRGCDCDisplayRphi()
95 {
96 }
97
98 void
99 TRGCDCDisplayRphi::on_scale_value_changed(void)
100 {
101 const double val = scale();
102 _w.scale(val);
103// cout << "TRGCDCDisplayRphi ... scale value=" << val << endl;
104 _w.on_expose_event((GdkEventExpose*) NULL);
105 }
106
107 void
108 TRGCDCDisplayRphi::on_axial(void)
109 {
110 _axial = _buttonAxial.get_active();
111 _w.axial(_axial);
112 _w.on_expose_event((GdkEventExpose*) NULL);
113 }
114
115 void
116 TRGCDCDisplayRphi::on_stereo(void)
117 {
118 _stereo = _buttonStereo.get_active();
119 _w.stereo(_stereo);
120 _w.on_expose_event((GdkEventExpose*) NULL);
121 }
122
123 void
124 TRGCDCDisplayRphi::on_wireName(void)
125 {
126 _wireName = _buttonWireName.get_active();
127 _w.wireName(_wireName);
128 _w.on_expose_event((GdkEventExpose*) NULL);
129 }
130
131 void
132 TRGCDCDisplayRphi::on_BelleCDC(void)
133 {
134 _oldCDC = _buttonBelleCDC.get_active();
135 _w.oldCDC(_oldCDC);
136 _w.on_expose_event((GdkEventExpose*) NULL);
137 }
138
139 void
140 TRGCDCDisplayRphi::on_positionReset(void)
141 {
142 _w.resetPosition();
143 const double val = _w.scale();
144 scale(val);
145 _w.on_expose_event((GdkEventExpose*) NULL);
146 }
147
149} // namespace Belle2
150
151#endif
Abstract base class for different kinds of events.
STL namespace.