BOSS 7.1.0
BESIII Offline Software System
Loading...
Searching...
No Matches
TWindow.h
Go to the documentation of this file.
1//-----------------------------------------------------------------------------
2// $Id: TWindow.h,v 1.7 2010/03/31 09:58:59 liucy Exp $
3//-----------------------------------------------------------------------------
4// Filename : TWindow.h
5// Section : Tracking MDC
6// Owner : Yoshi Iwasaki
7// Email : [email protected]
8//-----------------------------------------------------------------------------
9// Description : A class to display tracking object.
10// See http://bsunsrv1.kek.jp/~yiwasaki/tracking/
11//-----------------------------------------------------------------------------
12
13#ifdef TRKRECO_WINDOW
14
15#ifndef TWINDOW_FLAG_
16#define TWINDOW_FLAG_
17
18#include <string>
19
20//#include "belle.h"
21#ifdef HAVE_LEDA
22//#include <LEDA/window.h>
23//#include <LEDA/stack.h>
24//#include <LEDA/color.h>
25#endif
26#define HEP_SHORT_NAMES
27#include "CLHEP/Alist/ConstAList.h"
28#include "CLHEP/Alist/CList.h"
29#include "CLHEP/Geometry/Vector3D.h"
30#ifndef ENABLE_BACKWARDS_COMPATIBILITY
32#endif
33
34class TTrackBase;
35class TTrack;
36class TMLine;
37class TWindow;
38class TSegment;
39class TMLink;
40class TPoint2D;
41
42/// A class to display tracking object.
43class TWindow {
44
45 public:
46 /// Default constructor
47 TWindow(const TWindow &);
48
49 /// Constructor
50 TWindow(const std::string & name);
51
52 /// Destructor
53 virtual ~TWindow();
54
55 public:
56 /// opens window.
57 void open(void);
58
59 /// clear window contents.
60 void clear(void);
61
62 /// appends/remove objects.
63 void append(const TTrackBase &,
64 leda_color = leda_black,
65 bool toBeSelfObject = false);
66 void append(const AList<TSegment> &,
67 leda_color = leda_black,
68 bool toBeSelfObject = false);
69 void append(const AList<TTrack> &,
70 leda_color = leda_black,
71 bool toBeSelfObject = false);
72 void remove(const TTrackBase &);
73 void remove(const AList<TSegment> &);
74 void remove(const AList<TTrack> &);
75 void appendSz(const TTrack &, const AList<TMLink> &, leda_color=leda_black);
76 void appendSz(const TTrack &,
77 const AList<TSegment> &,
78 leda_color=leda_black);
79
80 /// appends TMLink's. You can't remove TMLink's but you can clear.
81 void append(const AList<TMLink> &, leda_color = leda_black);
82
83 /// displays objects w/o appending.
84 void oneShot(const TTrackBase &, leda_color = leda_black);
85 void oneShot(const AList<TSegment> &, leda_color = leda_black);
86
87 /// waits for user actions.
88 void wait(void);
89
90 /// draws objects in stack.
91 void draw(void);
92
93 /// draws a point.
94 void draw(const TPoint2D &, leda_color = leda_black);
95
96 /// returns/draws text.
97 std::string text(void) const;
98 void text(const std::string & text);
99
100 /// sets run, farm, and event number of target event to display.
101 void target(unsigned run, unsigned farm, unsigned event);
102
103 /// sets drawing mode. (0:rphi, 1:conformal, 2:s-z);
104 unsigned mode(unsigned);
105
106 /// sets skip mode.
107 bool skip(bool);
108 bool skipAllWindow(bool);
109
110 private:
111 void drawHeader(void);
112 void drawBase(const TTrackBase &, leda_color = leda_black);
113 void drawSegment(const TSegment &, leda_color = leda_black);
114 void drawTrack(const TTrack &, leda_color = leda_black);
115 void drawLine(const TMLine &, leda_color = leda_black);
116 void drawAxes(void);
117 void drawCdc(void);
118 bool target(void) const;
119 std::string wireName(const TMLink &) const;
120
121 private:
122 std::string _name;
123 leda_window _window;
124 double _xmin, _xmax, _ymin;
125 leda_stack<HepVector3D> _zoomHistory[4];
126 int _closeButton;
127 int _wireNameButton;
128 int _axialButton;
129 int _stereoButton;
130 int _coordinateButton;
131 int _zoomInButton;
132 int _zoomOutButton;
133 int _skipButton;
134 int _skipAllButton;
135 int _szButton;
136 int _confButton;
137 int _segmentLinkButton;
138 int _segmentPropertyButton;
139 int _copyButton;
140
141 bool _wireName;
142 bool _axial;
143 bool _stereo;
144 bool _coordinate;
145 bool _display;
146 bool _skip;
147 bool _segmentLink;
148 bool _segmentProperty;
149 static bool _skipAllWindow;
150 unsigned _nYLine;
151
152 bool _canDelete;
153 CAList<TTrackBase> _objects;
154 AList<TTrackBase> _selfObjects;
155 AList<TMLink> _selfTLinks;
156 AList<leda_color> _colors;
157 std::string _text;
158 double _xPositionText;
159 double _yPositionText;
160 double _yPositionStep;
161
162 unsigned _mode;
163 unsigned _targetRun;
164 unsigned _targetEvent;
165 unsigned _nEvents;
166};
167
168//-----------------------------------------------------------------------------
169
170#ifdef TRKRECO_NO_INLINE
171#define inline
172#else
173#undef inline
174#define TWINDOW_INLINE_DEFINE_HERE
175#endif
176
177#ifdef TWINDOW_INLINE_DEFINE_HERE
178
179inline
180void
181TWindow::append(const TTrackBase & a, leda_color b, bool self) {
182 _objects.append(a);
183 _colors.append(new leda_color(b));
184 if (self)
185 _selfObjects.append((TTrackBase &) a);
186}
187
188inline
189void
190TWindow::append(const AList<TSegment> & a, leda_color b, bool self) {
191 for (unsigned i = 0; i < a.length(); i++) {
192 append(* (TTrackBase *) a[i], b);
193 if (self)
194 _selfObjects.append(* (TTrackBase *) a[i]);
195 }
196}
197
198inline
199void
200TWindow::append(const AList<TTrack> & a, leda_color b, bool self) {
201 for (unsigned i = 0; i < a.length(); i++) {
202 append(* (TTrackBase *) a[i], b);
203 if (self)
204 _selfObjects.append(* (TTrackBase *) a[i]);
205 }
206}
207
208inline
209void
210TWindow::remove(const TTrackBase & a) {
211 int i;
212 while ((i = _objects.fIndex(a)) != -1) {
213 _objects.remove(i);
214 leda_color * b = _colors[i];
215 _colors.remove(i);
216 delete b;
217 }
218}
219
220inline
221void
222TWindow::remove(const AList<TSegment> & a) {
223 for (unsigned i = 0; i < a.length(); i++) {
224 remove(* (TTrackBase *) a[i]);
225 }
226}
227
228inline
229void
230TWindow::remove(const AList<TTrack> & a) {
231 for (unsigned i = 0; i < a.length(); i++) {
232 remove(* (TTrackBase *) a[i]);
233 }
234}
235
236inline
237void
238TWindow::open(void) {
239 if (! target()) return;
240 if (! _display) {
241 if (_mode == 1) {
242 _xmin = -1;
243 _xmax = 7;
244 _ymin = -1;
245 _window.init(_xmin, _xmax, _ymin);
246 }
247 _window.display();
248 }
249 _display = true;
250}
251
252inline
253unsigned
254TWindow::mode(unsigned a) {
255 if (a == 2) {
256 _stereo = true;
257 _axial = false;
258 }
259 return _mode = a;
260}
261
262inline
263bool
264TWindow::skip(bool a) {
265 return _skip = a;
266}
267
268inline
269bool
270TWindow::skipAllWindow(bool a) {
271 return _skipAllWindow = a;
272}
273
274inline
275void
276TWindow::text(const std::string & text) {
277 _text = text;
278}
279
280inline
281std::string
282TWindow::text(void) const {
283 return _text;
284}
285
286#endif
287
288#undef inline
289
290#endif TWINDOW_FLAG_
291
292#endif /* TRKRECO_WINDOW */
HepGeom::Vector3D< double > HepVector3D
m_outputFile open("YYYY/m_txt_dir/LumTau_XXXX.txt", ios_base::app)
Definition: TLine2D.h:22
A class to represent a track in tracking.
Definition: TMLine.h:40
A class to represent a point in 2D.
Definition: TPoint2D.h:37
A class to relate TMDCWireHit and TTrack objects.
Definition: TSegment.h:43
A virtual class for a track class in tracking.
Definition: TTrackBase.h:46
A class to represent a track in tracking.
Definition: TTrack.h:129
char * append(const char *str, EvtCyclic3::Index i)
Definition: EvtCyclic3.cc:284
const double b
Definition: slope.cxx:9