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