DDASToys for NSCLDAQ  6.2-000
QTraceView.h
Go to the documentation of this file.
1 /*
2  This software is Copyright by the Board of Trustees of Michigan
3  State University (c) Copyright 2017.
4 
5  You may use this software under the terms of the GNU public license
6  (GPL). The terms of this license are described at:
7 
8  http://www.gnu.org/licenses/gpl.txt
9 
10  Authors:
11  Aaron Chester
12  FRIB
13  Michigan State University
14  East Lansing, MI 48824-1321
15 */
16 
22 #ifndef QTRACEVIEW_H
23 #define QTRACEVIEW_H
24 
25 #include <QWidget>
26 
27 #include <string>
28 #include <vector>
29 
30 class QMenuBar;
31 class QMenu;
32 class QAction;
33 class QGroupBox;
34 class QStatusBar;
35 class QPushButton;
36 class QComboBox;
37 class QLineEdit;
38 class QListView;
39 class QStandardItemModel;
40 class QTimer;
41 class QCommandLineParser;
42 class QString;
43 
44 namespace ddastoys {
45  class DDASFitHit;
46 }
47 
48 class DDASDecoder;
49 class FitManager;
50 class QHitData;
51 class QRootCanvas;
52 
80 class QTraceView : public QWidget
81 {
82  Q_OBJECT
83 
84 public:
91  QTraceView(QCommandLineParser& parser, QWidget* parent=Q_NULLPTR);
93  virtual ~QTraceView();
94 
95  // QEvent handlers overridden from the base class.
96 protected:
101  virtual void changeEvent(QEvent* e);
102 
103 private slots:
105  void openFile();
107  void getNextEvent();
112  void getNextEventWithTraces();
114  void getNextEventFromList();
116  void skipEvents();
118  void selectEvent();
120  void updateSelectableHits();
122  void processHit();
124  void filterHits();
126  void handleRootEvents();
128  void test();
129 
130 private:
132  void createMenu();
134  void createTopBoxWidget();
136  void createHitSelectWidget();
138  void createPlotWidget();
139 
144  void configureSource(QString filename);
150  void createConnections(bool useEvtList=false);
151 
156  void skipAndSelect(int count);
161  void selectEventByIndex(int idx);
167  bool isValidHit(const ddastoys::DDASFitHit& hit);
168 
173  void setStatusBar(std::string msg);
178  void reset();
183  void enableGUI(bool status);
188  void enableMainGUI(bool status);
193  void enableSelectGUI(bool status);
194 
199  void issueWarning(std::string msg);
201  void issueEOFWarning();
202 
208  void parseArgs(QCommandLineParser& parser);
214  void parseEventList(QString fname);
215 
216 private:
217  // Our member data
218  DDASDecoder* m_pDecoder;
219  FitManager* m_pFitManager;
220 
221  std::vector<ddastoys::DDASFitHit> m_hits;
222  std::vector<ddastoys::DDASFitHit> m_filteredHits;
227  struct EventList {
228  std::vector<int> s_events;
229  unsigned long s_idx;
230  EventList() {};
231  EventList(std::vector<int> evts, unsigned long idx=0)
232  : s_events(evts), s_idx(idx) {}
233  };
234  EventList m_eventList;
235 
236  // Added to this widget, Qt _should_ handle cleanup on destruction
237 
238  QMenuBar* m_pMenuBar;
239  QMenu* m_pFileMenu;
240  QAction* m_pOpenAction;
241  QAction* m_pExitAction;
242 
243  QPushButton* m_pMainButtons[3];
244  QPushButton* m_pSelectButtons[2];
245  QLineEdit* m_pSelectLineEdit;
246  QLineEdit* m_pHitFilter[3];
247  QWidget* m_pTopBoxes;
248  QHitData* m_pHitData;
249 
250  QListView* m_pHitSelectList;
251  QWidget* m_pPlotWidget;
252  QRootCanvas* m_pRootCanvas;
253  QTimer* m_pTimer;
254 
255  QStatusBar* m_pStatusBar;
256 };
257 
258 #endif
An interactive event processor integrated in the traceview GUI.
Definition: DDASDecoder.h:53
Provides an interface for calculating trace fits using HitExtension fit parameters.
Definition: FitManager.h:65
Widget for managing hit information when interating with the GUI.
Definition: QHitData.h:54
A ROOT canvas embedded in a Qt application.
Definition: QRootCanvas.h:45
Main traceview GUI window.
Definition: QTraceView.h:81
QTraceView(QCommandLineParser &parser, QWidget *parent=Q_NULLPTR)
Constructor.
Definition: QTraceView.cpp:69
virtual void changeEvent(QEvent *e)
Event handler for state changes.
Definition: QTraceView.cpp:128
virtual ~QTraceView()
Destructor.
Definition: QTraceView.cpp:112
Encapsulates data for DDAS hits that may have fitted traces.
Definition: DDASFitHit.h:46