source: tools/ddd/GUI.h@ 9384

Last change on this file since 9384 was 198, checked in by ogrimm, 15 years ago
Added chip selection spin box
File size: 3.2 KB
Line 
1#include <string>
2
3#include <QtGui>
4#include <QtNetwork/QTcpSocket>
5#include <QtNetwork/QAbstractSocket>
6
7#include <qwt_plot.h>
8#include <qwt_plot_curve.h>
9#include <qwt_plot_grid.h>
10#include <qwt_plot_zoomer.h>
11#include <qwt_plot_panner.h>
12#include <qwt_plot_spectrogram.h>
13#include <qwt_raster_data.h>
14#include <qwt_scale_widget.h>
15#include <qwt_plot_layout.h>
16#include <qwt_color_map.h>
17
18#include "../../drsdaq/RawDataCTX.h"
19#include "../../pixelmap/PixelMap.h"
20
21#define SOCKET_TIMEOUT 10000 // Milliseconds to wait for socket connection
22#define MAX_OUTPUT_LINES 200 // Maximum number of lines in socket output window
23#define MAX_COM_SIZE 10000
24#define INITIAL_DIRECTORY ""
25
26// Main window class
27class ddd : public QMainWindow {
28 Q_OBJECT
29
30 QPushButton *GetButton, *SocketButton, *Connect, *M0Display;
31 QCheckBox *ContinuousBox;
32 QToolButton *LoadButton;
33 QLineEdit *FilenameBox, *IPAddress, *Command, *PixelID;
34 QSpinBox *EventNo, *ChannelNo, *ChipNo, *BoardNo, *Port, *M0Start, *M0Stop;
35 QPlainTextEdit *RunHeaderDisplay, *EventHeaderDisplay, *SocketOutput;
36 QTabWidget *TabWidget;
37 QTcpSocket *Socket;
38 QWidget *SocketWindow, *Central, *M0Window;
39 QAction *OpenAction, *ConnectAction, *PhysPipeAction;
40 QGridLayout *SocketLayout, *MainLayout, *M0Layout;
41 QFormLayout *CommandLayout, *PortLayout, *AddressLayout, *FormLayout, *SpinLayout, *M0StartLayout, *M0StopLayout;
42
43 QwtPlot *Graph, *Graph2D;
44 QwtPlotZoomer *Zoomer;
45 QwtPlotCurve *Signal;
46 QwtPlotPanner *Panner;
47 QwtPlotGrid *Grid;
48 QwtPlotSpectrogram *Signal2D;
49 QwtLinearColorMap colorMap;
50
51 void closeEvent(QCloseEvent *);
52
53 bool ManualDisconnect, WaitForData;
54 RawDataCTX *RD;
55 PixelMap *PixMap;
56 FILE *Tmpfile;
57
58 public:
59 ddd();
60 ~ddd();
61 void CloseDatafile();
62
63 private slots:
64 void OpenDatafile();
65 void DisplayEvent(int=0);
66 void FileDialog();
67 void OpenSocketWindow();
68 void OpenM0Window();
69 void GetSignalFromSocket();
70 void MakeConnection();
71 void SendToSocket();
72 void ReadFromSocket();
73 void GotDisconnected();
74 void HandleZoom(const QwtDoubleRect &);
75 void TranslatePixelID();
76
77 void MenuSave();
78 void MenuPrint();
79 void MenuSaveASCII();
80 void MenuHelp();
81 void MenuAbout();
82};
83
84//Data class for 2D spectrogram (MO display specific)
85class SpectrogramDataM0: public QwtRasterData {
86
87private:
88
89 double _z[6][6];
90 double _zmin;
91 double _zmax;
92
93public:
94
95 SpectrogramDataM0(const double z[6][6]): QwtRasterData(QwtDoubleRect(0, 0, 6, 6)) {
96 for (int i = 0; i<6; i++){
97 for (int j = 0; j<6; j++){
98 _z[i][j] = z[i][j];
99 if (z[i][j] > _zmax) _zmax = z[i][j];
100 if (z[i][j] < _zmin) _zmin = z[i][j];
101 }
102 }
103 }
104
105 virtual QwtRasterData *copy() const {
106 return new SpectrogramDataM0(_z);
107 }
108
109 virtual QwtDoubleInterval range() const {
110 return QwtDoubleInterval(_zmin, _zmax);
111 }
112
113 virtual void initRaster(const QwtDoubleRect = QwtDoubleRect(0, 0, 6, 6),
114 const QSize =QSize(1,1)) {};
115
116 virtual double value(double x, double y) const {
117
118 unsigned int first = (unsigned int)x;
119 unsigned int second = (unsigned int)y;
120
121 const double v = _z[first][second];
122 return v;
123
124 }
125
126};
Note: See TracBrowser for help on using the repository browser.