QwAnalysis
QwEventDisplay.h
Go to the documentation of this file.
1 #ifndef QWEVENTDISPLAY_H
2 #define QWEVENTDISPLAY_H
3 
4 
5 /************************************\
6 ** Qweak 2D Event Display Header **
7 ** Jefferson Lab -- Hall C **
8 ** Author: Derek Jones **
9 ** The George Washington University **
10 ** Contact: dwjones8@gwu.edu **
11 ** Last updated: 7-25-2010 **
12 \************************************/
13 
14 
15 ////ROOT CORE HEADERS--------------------------------------------------////
16 #ifndef ROOT_TCanvas
17 #include "TCanvas.h"
18 #endif
19 #ifndef ROOT_RQ_OBJECT
20 #include "RQ_OBJECT.h"
21 #endif
22 #ifndef ROOT_TGClient
23 #include "TGClient.h"
24 #endif
25 #ifndef ROOT_TF1
26 #include <TF1.h>
27 #endif
28 #ifndef ROOT_TRandom
29 #include <TRandom.h>
30 #endif
31 #ifndef ROOT_TFile
32 #include <TFile.h>
33 #endif
34 #ifndef ROOT_TTree
35 #include <TTree.h>
36 #endif
37 #ifndef ROOT_TLine
38 #include <TLine.h>
39 #endif
40 #ifndef ROOT_TPaveLabel
41 #include <TPaveLabel.h>
42 #endif
43 #ifndef ROOT_TPaveText
44 #include <TPaveText.h>
45 #endif
46 #ifndef ROOT_TPolyMarker
47 #include <TPolyMarker.h>
48 #endif
49 #ifndef ROOT_TGuiBldHintsButton
50 #include "TGuiBldHintsButton.h"
51 #endif
52 #ifndef ROOT_TRootBrowserLite
53 #include "TRootBrowserLite.h"
54 #endif
55 #ifndef ROOT_TImage
56 #include "TImage.h"
57 #endif
58 
59 
60 ////ROOT GUI HEADERS--------------------------------------------------////
61 #ifndef ROOT_TGDockableFrame
62 #include "TGDockableFrame.h"
63 #endif
64 #ifndef ROOT_TGMenu
65 #include "TGMenu.h"
66 #endif
67 #ifndef ROOT_TGMdiDecorFrame
68 #include "TGMdiDecorFrame.h"
69 #endif
70 #ifndef ROOT_TG3DLine
71 #include "TG3DLine.h"
72 #endif
73 #ifndef ROOT_TGMdiFrame
74 #include "TGMdiFrame.h"
75 #endif
76 #ifndef ROOT_TGMdiMainFrame
77 #include "TGMdiMainFrame.h"
78 #endif
79 #ifndef ROOT_TGMdiMenu
80 #include "TGMdiMenu.h"
81 #endif
82 #ifndef ROOT_TGColorDialog
83 #include "TGColorDialog.h"
84 #endif
85 #ifndef ROOT_TGColorSelect
86 #include "TGColorSelect.h"
87 #endif
88 #ifndef ROOT_TGListBox
89 #include "TGListBox.h"
90 #endif
91 #ifndef ROOT_TGNumberEntry
92 #include "TGNumberEntry.h"
93 #endif
94 #ifndef ROOT_TGScrollBar
95 #include "TGScrollBar.h"
96 #endif
97 #ifndef ROOT_TGuiBldHintsEditor
98 #include "TGuiBldHintsEditor.h"
99 #endif
100 #ifndef ROOT_TGuiBldNameFrame
101 #include "TGuiBldNameFrame.h"
102 #endif
103 #ifndef ROOT_TGFrame
104 #include "TGFrame.h"
105 #endif
106 #ifndef ROOT_TGFileDialog
107 #include "TGFileDialog.h"
108 #endif
109 #ifndef ROOT_TGShutter
110 #include "TGShutter.h"
111 #endif
112 #ifndef ROOT_TGButtonGroup
113 #include "TGButtonGroup.h"
114 #endif
115 #ifndef ROOT_TGCanvas
116 #include "TGCanvas.h"
117 #endif
118 #ifndef ROOT_TGFSContainer
119 #include "TGFSContainer.h"
120 #endif
121 #ifndef ROOT_TGFontDialog
122 #include "TGFontDialog.h"
123 #endif
124 #ifndef ROOT_TGuiBldEditor
125 #include "TGuiBldEditor.h"
126 #endif
127 #ifndef ROOT_TGTextEdit
128 #include "TGTextEdit.h"
129 #endif
130 #ifndef ROOT_TGButton
131 #include "TGButton.h"
132 #endif
133 #ifndef ROOT_TGFSComboBox
134 #include "TGFSComboBox.h"
135 #endif
136 #ifndef ROOT_TGLabel
137 #include "TGLabel.h"
138 #endif
139 #ifndef ROOT_TGMsgBox
140 #include "TGMsgBox.h"
141 #endif
142 #ifndef ROOT_TRootGuiBuilder
143 #include "TRootGuiBuilder.h"
144 #endif
145 #ifndef ROOT_TGTab
146 #include "TGTab.h"
147 #endif
148 #ifndef ROOT_TGListView
149 #include "TGListView.h"
150 #endif
151 #ifndef ROOT_TGSplitter
152 #include "TGSplitter.h"
153 #endif
154 #ifndef ROOT_TGStatusBar
155 #include "TGStatusBar.h"
156 #endif
157 #ifndef ROOT_TGListTree
158 #include "TGListTree.h"
159 #endif
160 #ifndef ROOT_TGToolTip
161 #include "TGToolTip.h"
162 #endif
163 #ifndef ROOT_TGToolBar
164 #include "TGToolBar.h"
165 #endif
166 #ifndef ROOT_TRootEmbeddedCanvas
167 #include "TRootEmbeddedCanvas.h"
168 #endif
169 #ifndef ROOT_TGuiBldDragManager
170 #include "TGuiBldDragManager.h"
171 #endif
172 #ifndef ROOT_TGNumberEntry
173 #include "TGNumberEntry.h"
174 #endif
175 #ifndef ROOT_TGComboBox
176 #include "TGComboBox.h"
177 #endif
178 
179 
180 ////C++ STANDARD HEADERS--------------------------------------------------////
181 #include "Riostream.h"
182 #include "TMath.h"
183 
184 
185 ////FORWARD DECLARATIONS--------------------------------------------------////
186 class QwEventBuffer;
187 class QwHitContainer;
189 class QwTreeEventBuffer;
190 
191 
192 ////DECLARE CLASS ELEMENTS--------------------------------------------------////
193 class QwEventDisplay: public TGMainFrame{ // Event display is a ROOT main frame class
194 
195  // REGION GEOMETRIES
196  // All length measurements in cm; measured on inside of a single chamber frame
197  // All angle measurements in degrees (converted to radians later)
198  // Scalings make longest side of length .8 in canvas (generally the width)
199  // Geometry data taken from QweakSim files unless noted in parentheses with a derivation;
200  // Length is x, width is y, depth is z in qweak coordinates (x and y flip for GUI use, be careful of distinction)
201 #define R1_WIDTH 30.00 // Region 1
202 #define R1_LENGTH 30.00
203 #define R1_DEPTH 3.00
204 #define R1_DIST 0.10 // Distance between traces ###CHECK THIS!!!
205 #define R1_CM .8/R1_WIDTH // Drawing scale factor, 1 cm in ROOT coordinates for this region
206 
207 #define R2_WIDTH 45.09 // Region 2
208 #define R2_LENGTH 30.00
209 #define R2_DEPTH 3.35
210 #define R2_DIST 1.27 // Distance between drift cell planes
211 #define R2_XDIST 0.909 // Distance between x wires
212 #define R2_UVDIST 2.25 // Distance between u (or v) wires on bottom of frame
213 #define R2_FULLWIRE1 9 // 9.29 // (30*.675/2.18) ###CHECK THIS!!!
214 #define R2_FULLWIRE2 20 // 20.68 // (45.09/2.18)
215 #define R2_ANGLE 56.00 // Wire angle from bottom of frame
216 #define R2_CM .8/R2_WIDTH // Drawing scale factor, 1 cm in ROOT coordinates for this region
217 
218 #define R3_WIDTH 204.47 // Region 3
219 #define R3_LENGTH 53.34
220 #define R3_DEPTH 2.54
221 #define R3_DIST 40.00 // Distance between drift cell chambers
222 #define R3_UVDIST 1.11 // Distance between u (or v) wires on bottom of frame
223 #define R3_FULLWIRE1 96 // Given in geometry data
224 #define R3_FULLWIRE2 184 // Given in geometry data
225 #define R3_ANGLE 26.57 // Wire angle from normal to bottom of frame (90 - 63.43)
226 #define R3_CM .8/R3_WIDTH // Drawing scale factor, 1 cm in ROOT coordinates for this region
227 
228  public:
229  RQ_OBJECT("QwEventDisplay") // Create an object for ROOT to process
230 
231  UInt_t fEventNumber; // Keeps track of the current event number on display
232  UInt_t fTreeEntries; // Counts the number of events in the file hits tree
233 
234  private:
235  TGMainFrame *fMain; // Mainframe window
236 
237  TGHorizontalFrame *fEventBoxes; // Event box frame
238  TGTab *fRegions; // Tab frame for region boxes
239  TGTextButton *ExitButton;
240 
241  // Menu Bar
242  TGMenuBar *fMenuBar; // Menu bar
243  TGPopupMenu *fMenuFile, *fMenuHelp; // Popup menus
244  TGLayoutHints *fMenuBarLayout, *fMenuBarItemLayout, *fMenuBarHelpLayout; // Menu bar layouts
246  M_FILE_OPEN, // Opens a ROOT file
247  M_FILE_CLOSE, // Closes a ROOT file
248 
249  M_HELP_TUTORIAL, // Provides link to the event display tutorial documentation
250  M_HELP_ABOUT // Print information about the event display
251  };
252 
253  // Event Box 1 (Current Event Number) Declarations
254  TGVerticalFrame *fEventBox1, *fEventCounter; // Event box 1 frame and internal frame
255  TGLabel *fCurrentEventLabel; // Label that displays the current event number
256  TGNumberEntry *fCurrentEventEntry; // Number entry for GotoEvent() function
257  TGGroupFrame *fCurrentEvent; // Group frame to make label more prominent
258 
259  // Event Box 2 (Wire Hit Information) Declarations
260  TGVerticalFrame *fEventBox2; // Event box 2 frame
261  TGListBox *fWireInfoListBox; // List box to display wire hit information
262 
263  // Event Box 3 (Octant Identification) declarations
264  TGVerticalFrame *fEventBox3; // Event box 3 frame
265  TRootEmbeddedCanvas *fOctantID; // Embedded canvas for octant ID
266  TCanvas *cOctantID; // Canvas for octant ID
267  TPaveLabel *Octant_1, *Octant_2, *Octant_3, *Octant_4, *Octant_5, *Octant_6, *Octant_7, *Octant_8; // Labels for each of the octants
268 
269  // Region 1 (GEM) Declarations
270  TGCompositeFrame *fRegion1; // Tab frame
271  TRootEmbeddedCanvas *fRegion1XY, *fRegion1XZ, *fRegion1YZ; // Embedded canvases for each projection
272  TCanvas *cR1XY, *cR1XZ, *cR1YZ; // Canvases for each projection
273  TPaveLabel *Label_R1XY, *Label_R1XZ, *Label_R1YZ; // Labels for projection descriptions
274  TBox *Box_R1XY, *Box_R1XZ, *Box_R1YZ; // Boxes for each chamber
275  std::vector<TLine> Line_R1r; // Vectors to store hit list from hit containers
276  std::vector<TLine> Line_R1y; // for each direction and draw wire hit lines
277 
278  // Region 2 (HDC) Declarations
279  TGCompositeFrame *fRegion2; // Tab frame
280  TRootEmbeddedCanvas *fRegion2XY, *fRegion2XZ, *fRegion2YZ; // Embedded canvases for each projection
281  TCanvas *cR2XY, *cR2XZ, *cR2YZ; // Canvases for each projection
282  TPaveLabel *Label_R2XY, *Label_R2XZ, *Label_R2YZ; // Labels for projection descriptions
283  TBox *Box_R2XY, *Box_R2XZ1, *Box_R2XZ2,*Box_R2XZ3,*Box_R2XZ4, *Box_R2YZ1, *Box_R2YZ2, *Box_R2YZ3, *Box_R2YZ4; // Boxes for each chamber
284  TText *tR2XY1, *tR2XY2, *tR2XY3, *tR2XY4, *tR2XZ1, *tR2XZ2, *tR2XZ3, *tR2XZ4,*tR2YZ1, *tR2YZ2, *tR2YZ3, *tR2YZ4; // Text for HDC chamber labels
285  std::vector<TLine> Line_R2x; // Vectors to store hit list from hit containers
286  std::vector<TLine> Line_R2u; // for each direction and draw wire hit lines
287  std::vector<TLine> Line_R2v;
288 
289  // Region 2b (HDC second arm) Declarations
290  TGCompositeFrame *fRegion2b; // Tab frame
291  TRootEmbeddedCanvas *fRegion2bXY, *fRegion2bXZ, *fRegion2bYZ; // Embedded canvases for each projection
292  TCanvas *cR2bXY, *cR2bXZ, *cR2bYZ; // Canvases for each projection
293  TPaveLabel *Label_R2bXY, *Label_R2bXZ, *Label_R2bYZ; // Labels for projection descriptions
295  TText *tR2bXY1, *tR2bXY2, *tR2bXY3, *tR2bXY4, *tR2bXZ1, *tR2bXZ2, *tR2bXZ3, *tR2bXZ4,*tR2bYZ1, *tR2bYZ2, *tR2bYZ3, *tR2bYZ4; // Text for HDC chamber labels
296 
297  // Region 3 (VDC) Declarations
298  TGCompositeFrame *fRegion3; // Tab frame
299  TRootEmbeddedCanvas *fRegion3XY, *fRegion3XZ, *fRegion3YZ; // Embedded canvases for each projection
300  TCanvas *cR3XY, *cR3XZ, *cR3YZ; // Canvases for each projection
301  TPaveLabel *Label_R3XY, *Label_R3XZ, *Label_R3YZ; // Labels for projection descriptions
303  TText *tR3XY1, *tR3XY2, *tR3XY3, *tR3XY4, *tR3XZ1, *tR3XZ2, *tR3XZ3, *tR3XZ4,*tR3YZ1, *tR3YZ2, *tR3YZ3, *tR3YZ4; // Text for VDC chamber labels
304  TLine *Div_R3XY, *Div_R3XZ, *Div_R3YZ; // Dividers for arm views in projections
305  std::vector<TLine> Line_R3u; // Vectors to store hit list from hit containers
306  std::vector<TLine> Line_R3v; // for each direction and draw wire hit lines
307 
308  // Region 3 (TS) Declarations // NOT USED CURRENTLY
309  TGCompositeFrame *fRegion3TS; // Tab frame
310 
311  // Create Event Buffer
312  QwTreeEventBuffer* fEventBuffer; //! // Excluded from dictionary
314 
315  // Create Hit List
317 
318  // Trees
319  TTree* fTree; // Used to store hits_tree from ROOT file
320 
321  // Function List
322  public:
323  QwEventDisplay(const TGWindow *p, UInt_t w, UInt_t h);
324  virtual ~QwEventDisplay();
325 
326  void SetEventBuffer(QwTreeEventBuffer *eventbuffer) { fEventBuffer = eventbuffer; };
327  void SetSubsystemArray(QwSubsystemArrayTracking *subsystemarray) { fSubsystemArray = subsystemarray; };
328 
329  void HandleMenu(Int_t id);
330  void GoPrevious();
331  void GoNext();
332  void GoClear();
333  void GotoEvent();
334  void DrawEvent();
335 
336  ClassDef(QwEventDisplay,1); // Define class object
337 };
338 
339 #endif //QWEVENTDISPLAY
TPaveLabel * Label_R3XY
TPaveLabel * Label_R2bYZ
TRootEmbeddedCanvas * fRegion3XZ
TRootEmbeddedCanvas * fRegion3XY
TRootEmbeddedCanvas * fRegion3YZ
Read simulated QweakSimG4 events and generate hit lists.
TGGroupFrame * fCurrentEvent
TGHorizontalFrame * fEventBoxes
QwSubsystemArrayTracking * fSubsystemArray
// Excluded from dictionary
TGCompositeFrame * fRegion3TS
TGCompositeFrame * fRegion2b
TRootEmbeddedCanvas * fRegion1XZ
TPaveLabel * Octant_3
TGMainFrame * fMain
TPaveLabel * Octant_4
std::vector< TLine > Line_R2x
QwHitContainer * fHitList
TGNumberEntry * fCurrentEventEntry
QwTreeEventBuffer * fEventBuffer
TGLayoutHints * fMenuBarHelpLayout
std::vector< TLine > Line_R3v
TCanvas * cR2bXZ
TGVerticalFrame * fEventBox3
TCanvas * cOctantID
TPaveLabel * Label_R2bXY
TRootEmbeddedCanvas * fRegion1XY
ClassDef(QwEventDisplay, 1)
TGCompositeFrame * fRegion2
TGVerticalFrame * fEventBox2
TRootEmbeddedCanvas * fRegion2XY
void SetSubsystemArray(QwSubsystemArrayTracking *subsystemarray)
TPaveLabel * Label_R2XZ
TCanvas * cR2bXY
TGCompositeFrame * fRegion1
std::vector< TLine > Line_R1y
TGTextButton * ExitButton
TGPopupMenu * fMenuHelp
void SetEventBuffer(QwTreeEventBuffer *eventbuffer)
QwEventDisplay(const TGWindow *p, UInt_t w, UInt_t h)
TPaveLabel * Label_R1XZ
TGMenuBar * fMenuBar
TGLabel * fCurrentEventLabel
TPaveLabel * Label_R2bXZ
TPaveLabel * Octant_5
TPaveLabel * Octant_7
TGLayoutHints * fMenuBarLayout
TRootEmbeddedCanvas * fRegion2bXZ
TPaveLabel * Octant_1
std::vector< TLine > Line_R1r
TRootEmbeddedCanvas * fRegion2YZ
TPaveLabel * Label_R2YZ
TGListBox * fWireInfoListBox
TPaveLabel * Octant_8
RQ_OBJECT("QwEventDisplay") UInt_t fEventNumber
TGCompositeFrame * fRegion3
TRootEmbeddedCanvas * fRegion2bYZ
void HandleMenu(Int_t id)
TPaveLabel * Label_R1YZ
virtual ~QwEventDisplay()
TRootEmbeddedCanvas * fRegion2bXY
std::vector< TLine > Line_R3u
TRootEmbeddedCanvas * fOctantID
TGVerticalFrame * fEventCounter
TPaveLabel * Label_R3XZ
TPaveLabel * Octant_6
std::vector< TLine > Line_R2v
TGPopupMenu * fMenuFile
TPaveLabel * Label_R3YZ
TRootEmbeddedCanvas * fRegion1YZ
TRootEmbeddedCanvas * fRegion2XZ
TPaveLabel * Label_R1XY
std::vector< TLine > Line_R2u
TPaveLabel * Octant_2
TCanvas * cR2bYZ
TGVerticalFrame * fEventBox1
TPaveLabel * Label_R2XY
TGLayoutHints * fMenuBarItemLayout