00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifdef TRKRECO_WINDOW
00014
00015 #ifndef TWINDOW_FLAG_
00016 #define TWINDOW_FLAG_
00017
00018 #include <string>
00019
00020
00021 #ifdef HAVE_LEDA
00022
00023
00024
00025 #endif
00026 #define HEP_SHORT_NAMES
00027 #include "CLHEP/Alist/ConstAList.h"
00028 #include "CLHEP/Alist/CList.h"
00029 #include "CLHEP/Geometry/Vector3D.h"
00030 #ifndef ENABLE_BACKWARDS_COMPATIBILITY
00031 typedef HepGeom::Vector3D<double> HepVector3D;
00032 #endif
00033
00034 class TTrackBase;
00035 class TTrack;
00036 class TMLine;
00037 class TWindow;
00038 class TSegment;
00039 class TMLink;
00040 class TPoint2D;
00041
00043 class TWindow {
00044
00045 public:
00047 TWindow(const TWindow &);
00048
00050 TWindow(const std::string & name);
00051
00053 virtual ~TWindow();
00054
00055 public:
00057 void open(void);
00058
00060 void clear(void);
00061
00063 void append(const TTrackBase &,
00064 leda_color = leda_black,
00065 bool toBeSelfObject = false);
00066 void append(const AList<TSegment> &,
00067 leda_color = leda_black,
00068 bool toBeSelfObject = false);
00069 void append(const AList<TTrack> &,
00070 leda_color = leda_black,
00071 bool toBeSelfObject = false);
00072 void remove(const TTrackBase &);
00073 void remove(const AList<TSegment> &);
00074 void remove(const AList<TTrack> &);
00075 void appendSz(const TTrack &, const AList<TMLink> &, leda_color=leda_black);
00076 void appendSz(const TTrack &,
00077 const AList<TSegment> &,
00078 leda_color=leda_black);
00079
00081 void append(const AList<TMLink> &, leda_color = leda_black);
00082
00084 void oneShot(const TTrackBase &, leda_color = leda_black);
00085 void oneShot(const AList<TSegment> &, leda_color = leda_black);
00086
00088 void wait(void);
00089
00091 void draw(void);
00092
00094 void draw(const TPoint2D &, leda_color = leda_black);
00095
00097 std::string text(void) const;
00098 void text(const std::string & text);
00099
00101 void target(unsigned run, unsigned farm, unsigned event);
00102
00104 unsigned mode(unsigned);
00105
00107 bool skip(bool);
00108 bool skipAllWindow(bool);
00109
00110 private:
00111 void drawHeader(void);
00112 void drawBase(const TTrackBase &, leda_color = leda_black);
00113 void drawSegment(const TSegment &, leda_color = leda_black);
00114 void drawTrack(const TTrack &, leda_color = leda_black);
00115 void drawLine(const TMLine &, leda_color = leda_black);
00116 void drawAxes(void);
00117 void drawCdc(void);
00118 bool target(void) const;
00119 std::string wireName(const TMLink &) const;
00120
00121 private:
00122 std::string _name;
00123 leda_window _window;
00124 double _xmin, _xmax, _ymin;
00125 leda_stack<HepVector3D> _zoomHistory[4];
00126 int _closeButton;
00127 int _wireNameButton;
00128 int _axialButton;
00129 int _stereoButton;
00130 int _coordinateButton;
00131 int _zoomInButton;
00132 int _zoomOutButton;
00133 int _skipButton;
00134 int _skipAllButton;
00135 int _szButton;
00136 int _confButton;
00137 int _segmentLinkButton;
00138 int _segmentPropertyButton;
00139 int _copyButton;
00140
00141 bool _wireName;
00142 bool _axial;
00143 bool _stereo;
00144 bool _coordinate;
00145 bool _display;
00146 bool _skip;
00147 bool _segmentLink;
00148 bool _segmentProperty;
00149 static bool _skipAllWindow;
00150 unsigned _nYLine;
00151
00152 bool _canDelete;
00153 CAList<TTrackBase> _objects;
00154 AList<TTrackBase> _selfObjects;
00155 AList<TMLink> _selfTLinks;
00156 AList<leda_color> _colors;
00157 std::string _text;
00158 double _xPositionText;
00159 double _yPositionText;
00160 double _yPositionStep;
00161
00162 unsigned _mode;
00163 unsigned _targetRun;
00164 unsigned _targetEvent;
00165 unsigned _nEvents;
00166 };
00167
00168
00169
00170 #ifdef TRKRECO_NO_INLINE
00171 #define inline
00172 #else
00173 #undef inline
00174 #define TWINDOW_INLINE_DEFINE_HERE
00175 #endif
00176
00177 #ifdef TWINDOW_INLINE_DEFINE_HERE
00178
00179 inline
00180 void
00181 TWindow::append(const TTrackBase & a, leda_color b, bool self) {
00182 _objects.append(a);
00183 _colors.append(new leda_color(b));
00184 if (self)
00185 _selfObjects.append((TTrackBase &) a);
00186 }
00187
00188 inline
00189 void
00190 TWindow::append(const AList<TSegment> & a, leda_color b, bool self) {
00191 for (unsigned i = 0; i < a.length(); i++) {
00192 append(* (TTrackBase *) a[i], b);
00193 if (self)
00194 _selfObjects.append(* (TTrackBase *) a[i]);
00195 }
00196 }
00197
00198 inline
00199 void
00200 TWindow::append(const AList<TTrack> & a, leda_color b, bool self) {
00201 for (unsigned i = 0; i < a.length(); i++) {
00202 append(* (TTrackBase *) a[i], b);
00203 if (self)
00204 _selfObjects.append(* (TTrackBase *) a[i]);
00205 }
00206 }
00207
00208 inline
00209 void
00210 TWindow::remove(const TTrackBase & a) {
00211 int i;
00212 while ((i = _objects.fIndex(a)) != -1) {
00213 _objects.remove(i);
00214 leda_color * b = _colors[i];
00215 _colors.remove(i);
00216 delete b;
00217 }
00218 }
00219
00220 inline
00221 void
00222 TWindow::remove(const AList<TSegment> & a) {
00223 for (unsigned i = 0; i < a.length(); i++) {
00224 remove(* (TTrackBase *) a[i]);
00225 }
00226 }
00227
00228 inline
00229 void
00230 TWindow::remove(const AList<TTrack> & a) {
00231 for (unsigned i = 0; i < a.length(); i++) {
00232 remove(* (TTrackBase *) a[i]);
00233 }
00234 }
00235
00236 inline
00237 void
00238 TWindow::open(void) {
00239 if (! target()) return;
00240 if (! _display) {
00241 if (_mode == 1) {
00242 _xmin = -1;
00243 _xmax = 7;
00244 _ymin = -1;
00245 _window.init(_xmin, _xmax, _ymin);
00246 }
00247 _window.display();
00248 }
00249 _display = true;
00250 }
00251
00252 inline
00253 unsigned
00254 TWindow::mode(unsigned a) {
00255 if (a == 2) {
00256 _stereo = true;
00257 _axial = false;
00258 }
00259 return _mode = a;
00260 }
00261
00262 inline
00263 bool
00264 TWindow::skip(bool a) {
00265 return _skip = a;
00266 }
00267
00268 inline
00269 bool
00270 TWindow::skipAllWindow(bool a) {
00271 return _skipAllWindow = a;
00272 }
00273
00274 inline
00275 void
00276 TWindow::text(const std::string & text) {
00277 _text = text;
00278 }
00279
00280 inline
00281 std::string
00282 TWindow::text(void) const {
00283 return _text;
00284 }
00285
00286 #endif
00287
00288 #undef inline
00289
00290 #endif TWINDOW_FLAG_
00291
00292 #endif