BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
Reconstruction/TrkReco/include/TrkReco/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 : yoshihito.iwasaki@kek.jp
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/CList.h"
28# include "CLHEP/Alist/ConstAList.h"
29# include "CLHEP/Geometry/Vector3D.h"
30# ifndef ENABLE_BACKWARDS_COMPATIBILITY
31typedef HepGeom::Vector3D<double> HepVector3D;
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
45public:
46 /// Default constructor
47 TWindow( const TWindow& );
48
49 /// Constructor
50 TWindow( const std::string& name );
51
52 /// Destructor
53 virtual ~TWindow();
54
55public:
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&, leda_color = leda_black, bool toBeSelfObject = false );
64 void append( const AList<TSegment>&, leda_color = leda_black, bool toBeSelfObject = false );
65 void append( const AList<TTrack>&, leda_color = leda_black, bool toBeSelfObject = false );
66 void remove( const TTrackBase& );
67 void remove( const AList<TSegment>& );
68 void remove( const AList<TTrack>& );
69 void appendSz( const TTrack&, const AList<TMLink>&, leda_color = leda_black );
70 void appendSz( const TTrack&, const AList<TSegment>&, leda_color = leda_black );
71
72 /// appends TMLink's. You can't remove TMLink's but you can clear.
73 void append( const AList<TMLink>&, leda_color = leda_black );
74
75 /// displays objects w/o appending.
76 void oneShot( const TTrackBase&, leda_color = leda_black );
77 void oneShot( const AList<TSegment>&, leda_color = leda_black );
78
79 /// waits for user actions.
80 void wait( void );
81
82 /// draws objects in stack.
83 void draw( void );
84
85 /// draws a point.
86 void draw( const TPoint2D&, leda_color = leda_black );
87
88 /// returns/draws text.
89 std::string text( void ) const;
90 void text( const std::string& text );
91
92 /// sets run, farm, and event number of target event to display.
93 void target( unsigned run, unsigned farm, unsigned event );
94
95 /// sets drawing mode. (0:rphi, 1:conformal, 2:s-z);
96 unsigned mode( unsigned );
97
98 /// sets skip mode.
99 bool skip( bool );
100 bool skipAllWindow( bool );
101
102private:
103 void drawHeader( void );
104 void drawBase( const TTrackBase&, leda_color = leda_black );
105 void drawSegment( const TSegment&, leda_color = leda_black );
106 void drawTrack( const TTrack&, leda_color = leda_black );
107 void drawLine( const TMLine&, leda_color = leda_black );
108 void drawAxes( void );
109 void drawCdc( void );
110 bool target( void ) const;
111 std::string wireName( const TMLink& ) const;
112
113private:
114 std::string _name;
115 leda_window _window;
116 double _xmin, _xmax, _ymin;
117 leda_stack<HepVector3D> _zoomHistory[4];
118 int _closeButton;
119 int _wireNameButton;
120 int _axialButton;
121 int _stereoButton;
122 int _coordinateButton;
123 int _zoomInButton;
124 int _zoomOutButton;
125 int _skipButton;
126 int _skipAllButton;
127 int _szButton;
128 int _confButton;
129 int _segmentLinkButton;
130 int _segmentPropertyButton;
131 int _copyButton;
132
133 bool _wireName;
134 bool _axial;
135 bool _stereo;
136 bool _coordinate;
137 bool _display;
138 bool _skip;
139 bool _segmentLink;
140 bool _segmentProperty;
141 static bool _skipAllWindow;
142 unsigned _nYLine;
143
144 bool _canDelete;
145 CAList<TTrackBase> _objects;
146 AList<TTrackBase> _selfObjects;
147 AList<TMLink> _selfTLinks;
148 AList<leda_color> _colors;
149 std::string _text;
150 double _xPositionText;
151 double _yPositionText;
152 double _yPositionStep;
153
154 unsigned _mode;
155 unsigned _targetRun;
156 unsigned _targetEvent;
157 unsigned _nEvents;
158};
159
160//-----------------------------------------------------------------------------
161
162# ifdef TRKRECO_NO_INLINE
163# define inline
164# else
165# undef inline
166# define TWINDOW_INLINE_DEFINE_HERE
167# endif
168
169# ifdef TWINDOW_INLINE_DEFINE_HERE
170
171inline void TWindow::append( const TTrackBase& a, leda_color b, bool self ) {
172 _objects.append( a );
173 _colors.append( new leda_color( b ) );
174 if ( self ) _selfObjects.append( (TTrackBase&)a );
175}
176
177inline void TWindow::append( const AList<TSegment>& a, leda_color b, bool self ) {
178 for ( unsigned i = 0; i < a.length(); i++ )
179 {
180 append( *(TTrackBase*)a[i], b );
181 if ( self ) _selfObjects.append( *(TTrackBase*)a[i] );
182 }
183}
184
185inline void TWindow::append( const AList<TTrack>& a, leda_color b, bool self ) {
186 for ( unsigned i = 0; i < a.length(); i++ )
187 {
188 append( *(TTrackBase*)a[i], b );
189 if ( self ) _selfObjects.append( *(TTrackBase*)a[i] );
190 }
191}
192
193inline void TWindow::remove( const TTrackBase& a ) {
194 int i;
195 while ( ( i = _objects.fIndex( a ) ) != -1 )
196 {
197 _objects.remove( i );
198 leda_color* b = _colors[i];
199 _colors.remove( i );
200 delete b;
201 }
202}
203
204inline void TWindow::remove( const AList<TSegment>& a ) {
205 for ( unsigned i = 0; i < a.length(); i++ ) { remove( *(TTrackBase*)a[i] ); }
206}
207
208inline void TWindow::remove( const AList<TTrack>& a ) {
209 for ( unsigned i = 0; i < a.length(); i++ ) { remove( *(TTrackBase*)a[i] ); }
210}
211
212inline void TWindow::open( void ) {
213 if ( !target() ) return;
214 if ( !_display )
215 {
216 if ( _mode == 1 )
217 {
218 _xmin = -1;
219 _xmax = 7;
220 _ymin = -1;
221 _window.init( _xmin, _xmax, _ymin );
222 }
223 _window.display();
224 }
225 _display = true;
226}
227
228inline unsigned TWindow::mode( unsigned a ) {
229 if ( a == 2 )
230 {
231 _stereo = true;
232 _axial = false;
233 }
234 return _mode = a;
235}
236
237inline bool TWindow::skip( bool a ) { return _skip = a; }
238
239inline bool TWindow::skipAllWindow( bool a ) { return _skipAllWindow = a; }
240
241inline void TWindow::text( const std::string& text ) { _text = text; }
242
243inline std::string TWindow::text( void ) const { return _text; }
244
245# endif
246
247# undef inline
248
249# endif TWINDOW_FLAG_
250
251#endif /* TRKRECO_WINDOW */
HepGeom::Vector3D< double > HepVector3D
m_outputFile open("YYYY/m_txt_dir/LumTau_XXXX.txt", ios_base::app)
A class to represent a track in tracking.
A class to relate TMDCWireHit and TTrack objects.
A virtual class for a track class in tracking.
A class to represent a track in tracking.
char * append(const char *str, EvtCyclic3::Index i)