Belle II Software development
DisplayDrawingAreaRphi.h
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 objects.
11//-----------------------------------------------------------------------------
12
13#ifdef TRGCDC_DISPLAY
14
15#ifndef TRGCDCDisplayDrawingAreaRphi_FLAG_
16#define TRGCDCDisplayDrawingAreaRphi_FLAG_
17
18#include "trg/cdc/DisplayDrawingArea.h"
19
20#ifdef TRGCDC_SHORT_NAMES
21#define TCDDAreaRphi TRGCDCDisplayDrawingAreaRphi
22#endif
23
24namespace Belle2 {
30 class TRGCDCWire;
31 class TRGCDCWireHit;
32 class TRGCDCSegment;
33 class TRGCDCSegmentHit;
34 class TRGCDCCircle;
35 class TRGCDCTrack;
36 class TRGCDCFrontEnd;
37 class TRGCDCMerger;
38 class TRGCDCDisplay;
39
41 class TRGCDCDisplayDrawingAreaRphi : public TRGCDCDisplayDrawingArea {
42
43 public:
44
46 TRGCDCDisplayDrawingAreaRphi(TRGCDCDisplay&,
47 int size,
48 double innerR,
49 double outerR);
50
52 virtual ~TRGCDCDisplayDrawingAreaRphi();
53
54 double scale(double);
55 double scale(void) const;
56 void resetPosition(void) override;
57 bool axial(void) const;
58 bool axial(bool);
59 bool stereo(void) const;
60 bool stereo(bool);
61 bool wireName(void) const;
62 bool wireName(bool);
63 bool oldCDC(void) const;
64 bool oldCDC(bool);
65
66 void clear(void) override;
67
69 void append(const std::vector<const TRGCDCWire*>&,
70 Gdk::Color color = Gdk::Color("grey"));
71 void append(const std::vector<const TRGCDCWireHit*>&,
72 Gdk::Color color = Gdk::Color("grey"));
73 void append(const TRGCDCSegment&,
74 Gdk::Color color = Gdk::Color("#6600FF009900"));
75 void append(const std::vector<const TRGCDCSegment*>&,
76 Gdk::Color color = Gdk::Color("#6600FF009900"));
77 void append(const std::vector<const TRGCDCSegmentHit*>&,
78 Gdk::Color color = Gdk::Color("#6600FF009900"));
79 void append(const TRGCDCCircle&,
80 Gdk::Color color = Gdk::Color("#FF0066009900"));
81 void append(const std::vector<const TRGCDCCircle*>&,
82 Gdk::Color color = Gdk::Color("#FF0066009900"));
83 void append(const TRGCDCTrack&,
84 Gdk::Color color = Gdk::Color("#99006600FF00"));
85 void append(const std::vector<const TRGCDCTrack*>&,
86 Gdk::Color color = Gdk::Color("#99006600FF00"));
87 void append(const TRGCDCFrontEnd&,
88 Gdk::Color color = Gdk::Color("grey"));
89 void append(const TRGCDCMerger&,
90 Gdk::Color color = Gdk::Color("grey"));
91
93 void oneShot(const std::vector<const TRGCDCSegment*>&,
94 Gdk::Color color = Gdk::Color("#6600FF009900"));
95
96 virtual bool on_expose_event(GdkEventExpose*) override;
97 virtual bool on_button_press_event(GdkEventButton*) override;
98
99 private:
100 virtual void on_realize() override;
101 void drawCDC(void);
102 void draw(void);
103 void drawWires(void);
104 void drawHits(void);
105 void drawSegmentHits(void);
106
107 void drawWire(const TRGCDCWire& w,
108 int lineWidth,
109 Gdk::Color& c,
110 Gdk::LineStyle s);
111 void drawSegment(const TRGCDCSegment& w,
112 int lineWidth,
113 Gdk::Color& c,
114 Gdk::LineStyle s);
115 void drawCircle(const TRGCDCCircle& w,
116 int lineWidth,
117 Gdk::Color& c,
118 Gdk::LineStyle s);
119 void drawTrack(const TRGCDCTrack& w,
120 int lineWidth,
121 Gdk::Color& c,
122 Gdk::LineStyle s);
123 void drawFrontEnd(const TRGCDCFrontEnd& w,
124 int lineWidth,
125 Gdk::Color& c,
126 Gdk::LineStyle s);
127 void drawMerger(const TRGCDCMerger& w,
128 int lineWidth,
129 Gdk::Color& c,
130 Gdk::LineStyle s);
131
133 int x(double x) const;
134 int y(double y) const;
135 int xR(double x) const;
136 int yR(double y) const;
137
138 private:
139 double _scale;
140 bool _axial;
141 bool _stereo;
142 bool _wireName;
143 bool _oldCDC;
144 double _x, _y;
145 double _innerR;
146 double _outerR;
147
148 std::vector<const TRGCDCWire*> _wires;
149 std::vector<Gdk::Color> _wiresColor;
150
151 std::vector<const TRGCDCWireHit*> _hits;
152 std::vector<Gdk::Color> _hitsColor;
153
154 std::vector<const TRGCDCSegment*> _segments;
155 std::vector<Gdk::Color> _segmentsColor;
156
157 std::vector<const TRGCDCSegmentHit*> _segmentHits;
158 std::vector<Gdk::Color> _segmentHitsColor;
159
160 std::vector<const TRGCDCCircle*> _circles;
161 std::vector<Gdk::Color> _circlesColor;
162
163 std::vector<const TRGCDCTrack*> _tracks;
164 std::vector<Gdk::Color> _tracksColor;
165
166 std::vector<const TRGCDCFrontEnd*> _fronts;
167 std::vector<Gdk::Color> _frontColors;
168
169 std::vector<const TRGCDCMerger*> _mergers;
170 std::vector<Gdk::Color> _mergerColors;
171
172 Glib::RefPtr<Gdk::Window> _window;
173 int _winx, _winy, _winw, _winh, _wind;
174
175 Glib::RefPtr<Gdk::GC> _gc;
176 Gdk::Color _blue, _red, _green, _black, _white, _grey, _yellow, _grey0;
177
178 Glib::RefPtr<Pango::Layout> _pl;
179 };
180
181//-----------------------------------------------------------------------------
182
183 inline
184 double
185 TRGCDCDisplayDrawingAreaRphi::scale(double a)
186 {
187 return _scale = a;
188 }
189
190 inline
191 double
192 TRGCDCDisplayDrawingAreaRphi::scale(void) const
193 {
194 return _scale;
195 }
196
197 inline
198 bool
199 TRGCDCDisplayDrawingAreaRphi::axial(void) const
200 {
201 return _axial;
202 }
203
204 inline
205 bool
206 TRGCDCDisplayDrawingAreaRphi::axial(bool a)
207 {
208 return _axial = a;
209 }
210
211 inline
212 bool
213 TRGCDCDisplayDrawingAreaRphi::stereo(void) const
214 {
215 return _stereo;
216 }
217
218 inline
219 bool
220 TRGCDCDisplayDrawingAreaRphi::stereo(bool a)
221 {
222 return _stereo = a;
223 }
224
225 inline
226 bool
227 TRGCDCDisplayDrawingAreaRphi::wireName(void) const
228 {
229 return _wireName;
230 }
231
232 inline
233 bool
234 TRGCDCDisplayDrawingAreaRphi::wireName(bool a)
235 {
236 return _wireName = a;
237 }
238
239 inline
240 bool
241 TRGCDCDisplayDrawingAreaRphi::oldCDC(void) const
242 {
243 return _oldCDC;
244 }
245
246 inline
247 bool
248 TRGCDCDisplayDrawingAreaRphi::oldCDC(bool a)
249 {
250 return _oldCDC = a;
251 }
252
253 inline
254 int
255 TRGCDCDisplayDrawingAreaRphi::x(double a) const
256 {
257 /* std::cout << "_x,_scale,_winw/2,a=" << _x << "," << _scale << "," */
258 /* << _winw/2 << "," << a << std::endl; */
259 return int((a - _x) * _scale + _winw / 2);
260 }
261
262 inline
263 int
264 TRGCDCDisplayDrawingAreaRphi::y(double a) const
265 {
266 return int((- a - _y) * _scale + _winh / 2);
267 }
268
269 inline
270 int
271 TRGCDCDisplayDrawingAreaRphi::xR(double a) const
272 {
273 return int((a - _winw / 2) / _scale + _x);
274 }
275
276 inline
277 int
278 TRGCDCDisplayDrawingAreaRphi::yR(double a) const
279 {
280 return int((- a - _winh / 2) / _scale + _y);
281 }
282
284} // namespace Belle2
285
286#endif // TRGCDCDisplayDrawingAreaRphi_FLAG_
287#endif
Abstract base class for different kinds of events.