Rev 146 | Rev 172 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 146 | Rev 167 | ||
---|---|---|---|
1 | #include "../include/sipmscan.h" |
1 | #include "../include/sipmscan.h" |
2 | #include "../include/workstation.h" |
2 | #include "../include/workstation.h" |
3 | #include "../include/substructure.h" |
3 | #include "../include/substructure.h" |
4 | 4 | ||
5 | #include <stdio.h> |
5 | #include <stdio.h> |
6 | #include <stdlib.h> |
6 | #include <stdlib.h> |
7 | 7 | ||
8 | // Main window constructor (+layout) --------------------------------- |
8 | // Main window constructor (+layout) --------------------------------- |
9 | 9 | ||
10 | TGAppMainFrame::TGAppMainFrame(const TGWindow *p, int w, int h) |
10 | TGAppMainFrame::TGAppMainFrame(const TGWindow *p, int w, int h) |
11 | { |
11 | { |
12 | TGCompositeFrame *fT1; |
12 | TGCompositeFrame *fT1; |
13 | idtotal = 0; |
13 | idtotal = 0; |
14 | 14 | ||
15 | char *cTemp; |
15 | char *cTemp; |
- | 16 | ||
- | 17 | // Prepare the default open directory (basedir) |
|
- | 18 | currentOpenDir = new char[1024]; |
|
- | 19 | sprintf(currentOpenDir, "%s/results", rootdir); |
|
16 | 20 | ||
17 | // CAMAC and Scope objects |
21 | // CAMAC and Scope objects |
18 | gDaq = new daq(); |
22 | gDaq = new daq(); |
19 | gScopeDaq = new daqscope(); |
23 | gScopeDaq = new daqscope(); |
20 | 24 | ||
21 | // Define main window and menubar |
25 | // Define main window and menubar |
22 | fMain = new TGMainFrame(p, w, h, kVerticalFrame); |
26 | fMain = new TGMainFrame(p, w, h, kVerticalFrame); |
23 | 27 | ||
24 | // Initialize the menu |
28 | // Initialize the menu |
25 | fMenuBar = new TGMenuBar(fMain, 200, 30); |
29 | fMenuBar = new TGMenuBar(fMain, 200, 30); |
26 | InitMenu(); |
30 | InitMenu(); |
27 | fMain->AddFrame(fMenuBar, new TGLayoutHints(kLHintsExpandX | kLHintsTop)); |
31 | fMain->AddFrame(fMenuBar, new TGLayoutHints(kLHintsExpandX | kLHintsTop)); |
28 | 32 | ||
29 | // Prepare the tabbed structure |
33 | // Prepare the tabbed structure |
30 | fTab = new TGTab(fMain, 500, 500); |
34 | fTab = new TGTab(fMain, 500, 500); |
31 | 35 | ||
32 | // Read the layout we wish to use |
36 | // Read the layout we wish to use |
33 | int frmWidth[measwin+analysiswin], frmHeight[measwin+analysiswin]; |
37 | int frmWidth[measwin+analysiswin], frmHeight[measwin+analysiswin]; |
34 | LayoutRead(measwin+analysiswin, frmWidth, frmHeight); |
38 | LayoutRead(measwin+analysiswin, frmWidth, frmHeight); |
35 | 39 | ||
36 | // Structure the measurement layout window |
40 | // Structure the measurement layout window |
37 | int *vert, *hor, *wPane, *hPane; |
41 | int *vert, *hor, *wPane, *hPane; |
38 | 42 | ||
39 | vert = new int[2]; hor = new int; |
43 | vert = new int[2]; hor = new int; |
40 | *hor = 1; |
44 | *hor = 1; |
41 | vert[0] = 1; vert[1] = 0; |
45 | vert[0] = 1; vert[1] = 0; |
42 | 46 | ||
43 | const char *measFrmTit[] = {"Settings pane", "Display", "Main measurement window"}; |
47 | const char *measFrmTit[] = {"Settings pane", "Display", "Main measurement window"}; |
44 | wPane = new int[measwin]; hPane = new int[measwin]; |
48 | wPane = new int[measwin]; hPane = new int[measwin]; |
45 | for(int i = 0; i < measwin; i++) |
49 | for(int i = 0; i < measwin; i++) |
46 | { |
50 | { |
47 | wPane[i] = frmWidth[i]; |
51 | wPane[i] = frmWidth[i]; |
48 | hPane[i] = frmHeight[i]; |
52 | hPane[i] = frmHeight[i]; |
49 | } |
53 | } |
50 | 54 | ||
51 | fT1 = fTab->AddTab("Measurement"); |
55 | fT1 = fTab->AddTab("Measurement"); |
52 | TGSplitter(fT1, "horizontal", hor, vert, measFrmTit, measLayout, wPane, hPane); |
56 | TGSplitter(fT1, "horizontal", hor, vert, measFrmTit, measLayout, wPane, hPane); |
53 | fT1->AddFrame(fLayout[idtotal], new TGLayoutHints(kLHintsExpandX | kLHintsExpandY)); |
57 | fT1->AddFrame(fLayout[idtotal], new TGLayoutHints(kLHintsExpandX | kLHintsExpandY)); |
54 | idtotal++; |
58 | idtotal++; |
55 | delete[] vert; delete hor; delete[] wPane; delete[] hPane; |
59 | delete[] vert; delete hor; delete[] wPane; delete[] hPane; |
56 | 60 | ||
57 | // Structure the analysis layout window |
61 | // Structure the analysis layout window |
58 | vert = new int[2]; hor = new int; |
62 | vert = new int[2]; hor = new int; |
59 | *hor = 1; |
63 | *hor = 1; |
60 | vert[0] = 1; vert[1] = 1; |
64 | vert[0] = 1; vert[1] = 1; |
61 | 65 | ||
62 | const char *analysisFrmTit[] = {"Histogram file selection", "Analysis", "Histogram", "Histogram controls"}; |
66 | const char *analysisFrmTit[] = {"Histogram file selection", "Analysis", "Histogram", "Histogram controls"}; |
63 | wPane = new int[analysiswin]; hPane = new int[analysiswin]; |
67 | wPane = new int[analysiswin]; hPane = new int[analysiswin]; |
64 | for(int i = 0; i < analysiswin; i++) |
68 | for(int i = 0; i < analysiswin; i++) |
65 | { |
69 | { |
66 | wPane[i] = frmWidth[i+measwin]; |
70 | wPane[i] = frmWidth[i+measwin]; |
67 | hPane[i] = frmHeight[i+measwin]; |
71 | hPane[i] = frmHeight[i+measwin]; |
68 | } |
72 | } |
69 | 73 | ||
70 | fT1 = fTab->AddTab("Analysis"); |
74 | fT1 = fTab->AddTab("Analysis"); |
71 | TGSplitter(fT1, "horizontal", hor, vert, analysisFrmTit, analysisLayout, wPane, hPane); |
75 | TGSplitter(fT1, "horizontal", hor, vert, analysisFrmTit, analysisLayout, wPane, hPane); |
72 | fT1->AddFrame(fLayout[idtotal], new TGLayoutHints(kLHintsExpandX | kLHintsExpandY)); |
76 | fT1->AddFrame(fLayout[idtotal], new TGLayoutHints(kLHintsExpandX | kLHintsExpandY)); |
73 | idtotal++; |
77 | idtotal++; |
74 | delete[] vert; delete hor; delete[] wPane; delete[] hPane; |
78 | delete[] vert; delete hor; delete[] wPane; delete[] hPane; |
75 | 79 | ||
76 | // Structure the monitoring layout window (Fieldpoint) //TODO |
80 | // Structure the monitoring layout window (Fieldpoint) //TODO |
77 | fT1 = fTab->AddTab("Monitoring"); |
81 | fT1 = fTab->AddTab("Monitoring"); |
78 | fTab->SetEnabled(2,kFALSE); //TODO |
82 | fTab->SetEnabled(2,kFALSE); //TODO |
79 | 83 | ||
80 | // Structure the help layout window |
84 | // Structure the help layout window |
81 | fT1 = fTab->AddTab("Help"); |
85 | fT1 = fTab->AddTab("Help"); |
82 | TGTextView *helpdesc; |
86 | TGTextView *helpdesc; |
83 | const TGFont *tfont = gClient->GetFont(HELPFONT); |
87 | const TGFont *tfont = gClient->GetFont(HELPFONT); |
84 | FontStruct_t helpFont = tfont->GetFontStruct(); |
88 | FontStruct_t helpFont = tfont->GetFontStruct(); |
85 | helpdesc = new TGTextView(fT1,100,100); |
89 | helpdesc = new TGTextView(fT1,100,100); |
86 | helpdesc->SetFont(helpFont); |
90 | helpdesc->SetFont(helpFont); |
87 | helpdesc->SetForegroundColor(0x000000); |
91 | helpdesc->SetForegroundColor(0x000000); |
88 | fT1->AddFrame(helpdesc, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY)); |
92 | fT1->AddFrame(helpdesc, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY)); |
89 | 93 | ||
90 | cTemp = new char[1024]; |
94 | cTemp = new char[1024]; |
91 | sprintf(cTemp, "%s/doc/README", rootdir); |
95 | sprintf(cTemp, "%s/doc/README", rootdir); |
92 | if(helpdesc->LoadFile(cTemp)) |
96 | if(helpdesc->LoadFile(cTemp)) |
93 | { |
97 | { |
94 | if(DBGSIG) printf("TGAppMainFrame(): Help file correctly loaded.\n"); |
98 | if(DBGSIG) printf("TGAppMainFrame(): Help file correctly loaded.\n"); |
95 | } |
99 | } |
96 | else |
100 | else |
97 | printf("Error! Help file not loaded.\n"); |
101 | printf("Error! Help file not loaded.\n"); |
98 | delete[] cTemp; |
102 | delete[] cTemp; |
99 | helpdesc->AddLine(""); |
103 | helpdesc->AddLine(""); |
100 | 104 | ||
101 | fMain->AddFrame(fTab, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY)); |
105 | fMain->AddFrame(fTab, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY)); |
102 | 106 | ||
103 | // Set the inner layout of each frame |
107 | // Set the inner layout of each frame |
104 | AppLayout(); |
108 | AppLayout(); |
105 | 109 | ||
106 | fMain->SetWindowName(WINDOW_NAME); |
110 | fMain->SetWindowName(WINDOW_NAME); |
107 | fMain->MapSubwindows(); |
111 | fMain->MapSubwindows(); |
108 | fMain->MapWindow(); |
112 | fMain->MapWindow(); |
109 | fMain->Layout(); |
113 | fMain->Layout(); |
110 | 114 | ||
111 | // Prepare initial settings |
115 | // Prepare initial settings |
112 | EnableScan(0); //. |
116 | EnableScan(0); //. |
113 | EnableScan(1); // Grey out scan |
117 | EnableScan(1); // Grey out scan |
114 | EnableScan(2); // options by default |
118 | EnableScan(2); // options by default |
115 | EnableScan(3); //. |
119 | EnableScan(3); //. |
116 | EnableLiveUpdate(); //. Disable the live histogram update at beginning |
120 | EnableLiveUpdate(); //. Disable the live histogram update at beginning |
117 | VoltOut(1); //. Get the output voltage save in file |
121 | VoltOut(1); //. Get the output voltage save in file |
118 | HistogramOptions(1); //. Enable clean plots by default |
122 | HistogramOptions(1); //. Enable clean plots by default |
119 | plotType->widgetTB[0]->SetDown(kTRUE); //. |
123 | plotType->widgetTB[0]->SetDown(kTRUE); //. |
120 | fMenuHisttype->CheckEntry(M_ANALYSIS_HISTTYPE_1DADC); // Set the ADC histogram |
124 | fMenuHisttype->CheckEntry(M_ANALYSIS_HISTTYPE_1DADC); // Set the ADC histogram |
121 | fMenuHisttype->UnCheckEntry(M_ANALYSIS_HISTTYPE_1DTDC); // to show by default |
125 | fMenuHisttype->UnCheckEntry(M_ANALYSIS_HISTTYPE_1DTDC); // to show by default |
122 | fMenuHisttype->UnCheckEntry(M_ANALYSIS_HISTTYPE_2D); //. |
126 | fMenuHisttype->UnCheckEntry(M_ANALYSIS_HISTTYPE_2D); //. |
123 | acqStarted = false; //. At program start, the acquisition is stopped |
127 | acqStarted = false; //. At program start, the acquisition is stopped |
124 | ToolTipSet(); //. Turn on tooltips |
128 | ToolTipSet(); //. Turn on tooltips |
125 | PositionSet(1); //. Get starting table position |
129 | PositionSet(1); //. Get starting table position |
126 | RotationSet(1); //. Get starting rotation |
130 | RotationSet(1); //. Get starting rotation |
127 | 131 | ||
128 | if(DBGSIG > 1) |
132 | if(DBGSIG > 1) |
129 | { |
133 | { |
130 | printf("TGAppMainFrame(): At end of constructor\n"); |
134 | printf("TGAppMainFrame(): At end of constructor\n"); |
131 | gObjectTable->Print(); |
135 | gObjectTable->Print(); |
132 | } |
136 | } |
133 | } |
137 | } |
134 | 138 | ||
135 | TGAppMainFrame::~TGAppMainFrame() |
139 | TGAppMainFrame::~TGAppMainFrame() |
136 | { |
140 | { |
137 | fMain->Cleanup(); |
141 | fMain->Cleanup(); |
138 | delete fMain; |
142 | delete fMain; |
139 | } |
143 | } |
140 | 144 | ||
141 | // ------------------------------------------------------------------- |
145 | // ------------------------------------------------------------------- |
142 | 146 | ||
143 | // Event handler for menubar actions --------------------------------- |
147 | // Event handler for menubar actions --------------------------------- |
144 | 148 | ||
145 | void TGAppMainFrame::HandleMenu(Int_t id) |
149 | void TGAppMainFrame::HandleMenu(Int_t id) |
146 | { |
150 | { |
147 | // int ret = 0; |
151 | // int ret = 0; |
148 | char cmd[256]; |
152 | char cmd[256]; |
149 | 153 | ||
150 | switch(id) |
154 | switch(id) |
151 | { |
155 | { |
152 | case M_FILE_SET_LAYOUT: |
156 | case M_FILE_SET_LAYOUT: |
153 | LayoutSet(); |
157 | LayoutSet(); |
154 | break; |
158 | break; |
155 | 159 | ||
156 | case M_FILE_SAVE_LAYOUT: |
160 | case M_FILE_SAVE_LAYOUT: |
157 | LayoutSave(); |
161 | LayoutSave(); |
158 | break; |
162 | break; |
159 | 163 | ||
160 | case M_FILE_SAVE_MSETTINGS: |
164 | case M_FILE_SAVE_MSETTINGS: |
161 | // Here, we save the set values in the measurement layout (automatically done when we safely exit the application and after each start of measurement). |
165 | // Here, we save the set values in the measurement layout (automatically done when we safely exit the application and after each start of measurement). |
162 | break; |
166 | break; |
163 | 167 | ||
164 | case M_FILE_SAVE_ASETTINGS: |
168 | case M_FILE_SAVE_ASETTINGS: |
165 | // Here, we save the set values in the analysis layout (automatically done when we safely exit the application and after each start of analysis). |
169 | // Here, we save the set values in the analysis layout (automatically done when we safely exit the application and after each start of analysis). |
166 | break; |
170 | break; |
167 | 171 | ||
168 | case M_FILE_CHECK_WIDTH: |
172 | case M_FILE_CHECK_WIDTH: |
169 | printf("\nSettings window: %dx%d\n", measLayout[0]->GetWidth(), measLayout[0]->GetHeight()); |
173 | printf("\nSettings window: %dx%d\n", measLayout[0]->GetWidth(), measLayout[0]->GetHeight()); |
170 | printf("Histogram window: %dx%d\n", measLayout[1]->GetWidth(), measLayout[1]->GetHeight()); |
174 | printf("Histogram window: %dx%d\n", measLayout[1]->GetWidth(), measLayout[1]->GetHeight()); |
171 | printf("Main measurement window: %dx%d\n", measLayout[2]->GetWidth(), measLayout[2]->GetHeight()); |
175 | printf("Main measurement window: %dx%d\n", measLayout[2]->GetWidth(), measLayout[2]->GetHeight()); |
172 | printf("Histogram file window: %dx%d\n", analysisLayout[0]->GetWidth(), analysisLayout[0]->GetHeight()); |
176 | printf("Histogram file window: %dx%d\n", analysisLayout[0]->GetWidth(), analysisLayout[0]->GetHeight()); |
173 | printf("Analysis window: %dx%d\n", analysisLayout[1]->GetWidth(), analysisLayout[1]->GetHeight()); |
177 | printf("Analysis window: %dx%d\n", analysisLayout[1]->GetWidth(), analysisLayout[1]->GetHeight()); |
174 | printf("Histogram window: %dx%d\n", analysisLayout[2]->GetWidth(), analysisLayout[2]->GetHeight()); |
178 | printf("Histogram window: %dx%d\n", analysisLayout[2]->GetWidth(), analysisLayout[2]->GetHeight()); |
175 | printf("Histogram controls window: %dx%d\n", analysisLayout[3]->GetWidth(), analysisLayout[3]->GetHeight()); |
179 | printf("Histogram controls window: %dx%d\n", analysisLayout[3]->GetWidth(), analysisLayout[3]->GetHeight()); |
176 | 180 | ||
177 | printf("Main window: %dx%d\n", fMain->GetWidth(), fMain->GetHeight()); |
181 | printf("Main window: %dx%d\n", fMain->GetWidth(), fMain->GetHeight()); |
178 | printf("Menu bar: %dx%d\n", fMenuBar->GetWidth(), fMenuBar->GetHeight()); |
182 | printf("Menu bar: %dx%d\n", fMenuBar->GetWidth(), fMenuBar->GetHeight()); |
179 | printf("Tab window: %dx%d\n", fTab->GetWidth(), fTab->GetHeight()); |
183 | printf("Tab window: %dx%d\n", fTab->GetWidth(), fTab->GetHeight()); |
180 | break; |
184 | break; |
181 | 185 | ||
182 | case M_FILE_EXIT: |
186 | case M_FILE_EXIT: |
183 | CloseWindow(); |
187 | CloseWindow(); |
184 | break; |
188 | break; |
185 | 189 | ||
186 | case M_ANALYSIS_HISTTYPE_1DADC: |
190 | case M_ANALYSIS_HISTTYPE_1DADC: |
187 | ChangeHisttype(0); |
191 | ChangeHisttype(0); |
188 | break; |
192 | break; |
189 | 193 | ||
190 | case M_ANALYSIS_HISTTYPE_1DTDC: |
194 | case M_ANALYSIS_HISTTYPE_1DTDC: |
191 | ChangeHisttype(1); |
195 | ChangeHisttype(1); |
192 | break; |
196 | break; |
193 | 197 | ||
194 | case M_ANALYSIS_HISTTYPE_2D: |
198 | case M_ANALYSIS_HISTTYPE_2D: |
195 | ChangeHisttype(2); |
199 | ChangeHisttype(2); |
196 | break; |
200 | break; |
197 | 201 | ||
198 | case M_ANALYSIS_INTEG: |
202 | case M_ANALYSIS_INTEG: |
199 | fTab->SetTab(1); |
203 | fTab->SetTab(1); |
200 | analTab->SetTab(0); |
204 | analTab->SetTab(0); |
201 | for(int i = 0; i < 3; i++) |
205 | for(int i = 0; i < 3; i++) |
202 | { |
206 | { |
203 | if(intSpect->widgetChBox[i]->IsDown()) |
207 | if(intSpect->widgetChBox[i]->IsDown()) |
204 | intSpect->widgetChBox[i]->SetState(kButtonUp); |
208 | intSpect->widgetChBox[i]->SetState(kButtonUp); |
205 | } |
209 | } |
206 | break; |
210 | break; |
207 | 211 | ||
208 | case M_ANALYSIS_INTEGX: |
212 | case M_ANALYSIS_INTEGX: |
209 | fTab->SetTab(1); |
213 | fTab->SetTab(1); |
210 | analTab->SetTab(0); |
214 | analTab->SetTab(0); |
211 | for(int i = 0; i < 3; i++) |
215 | for(int i = 0; i < 3; i++) |
212 | { |
216 | { |
213 | if(i == 0) |
217 | if(i == 0) |
214 | intSpect->widgetChBox[i]->SetState(kButtonDown); |
218 | intSpect->widgetChBox[i]->SetState(kButtonDown); |
215 | else |
219 | else |
216 | { |
220 | { |
217 | if(intSpect->widgetChBox[i]->IsDown()) |
221 | if(intSpect->widgetChBox[i]->IsDown()) |
218 | intSpect->widgetChBox[i]->SetState(kButtonUp); |
222 | intSpect->widgetChBox[i]->SetState(kButtonUp); |
219 | } |
223 | } |
220 | } |
224 | } |
221 | break; |
225 | break; |
222 | 226 | ||
223 | case M_ANALYSIS_INTEGY: |
227 | case M_ANALYSIS_INTEGY: |
224 | fTab->SetTab(1); |
228 | fTab->SetTab(1); |
225 | analTab->SetTab(0); |
229 | analTab->SetTab(0); |
226 | for(int i = 0; i < 3; i++) |
230 | for(int i = 0; i < 3; i++) |
227 | { |
231 | { |
228 | if(i == 1) |
232 | if(i == 1) |
229 | intSpect->widgetChBox[i]->SetState(kButtonDown); |
233 | intSpect->widgetChBox[i]->SetState(kButtonDown); |
230 | else |
234 | else |
231 | { |
235 | { |
232 | if(intSpect->widgetChBox[i]->IsDown()) |
236 | if(intSpect->widgetChBox[i]->IsDown()) |
233 | intSpect->widgetChBox[i]->SetState(kButtonUp); |
237 | intSpect->widgetChBox[i]->SetState(kButtonUp); |
234 | } |
238 | } |
235 | } |
239 | } |
236 | break; |
240 | break; |
237 | 241 | ||
238 | case M_ANALYSIS_PHOTMU: |
242 | case M_ANALYSIS_PHOTMU: |
239 | fTab->SetTab(1); |
243 | fTab->SetTab(1); |
240 | analTab->SetTab(1); |
244 | analTab->SetTab(1); |
241 | for(int i = 0; i < 3; i++) |
245 | for(int i = 0; i < 3; i++) |
242 | { |
246 | { |
243 | if(i == 2) |
247 | if(i == 2) |
244 | intSpect->widgetChBox[i]->SetState(kButtonDown); |
248 | intSpect->widgetChBox[i]->SetState(kButtonDown); |
245 | else |
249 | else |
246 | { |
250 | { |
247 | if(intSpect->widgetChBox[i]->IsDown()) |
251 | if(intSpect->widgetChBox[i]->IsDown()) |
248 | intSpect->widgetChBox[i]->SetState(kButtonUp); |
252 | intSpect->widgetChBox[i]->SetState(kButtonUp); |
249 | } |
253 | } |
250 | } |
254 | } |
251 | break; |
255 | break; |
252 | 256 | ||
253 | case M_ANALYSIS_BREAKDOWN: |
257 | case M_ANALYSIS_BREAKDOWN: |
254 | fTab->SetTab(1); |
258 | fTab->SetTab(1); |
255 | analTab->SetTab(2); |
259 | analTab->SetTab(2); |
256 | break; |
260 | break; |
257 | 261 | ||
258 | case M_ANALYSIS_SURFSCAN: |
262 | case M_ANALYSIS_SURFSCAN: |
259 | fTab->SetTab(1); |
263 | fTab->SetTab(1); |
260 | analTab->SetTab(3); |
264 | analTab->SetTab(3); |
261 | break; |
265 | break; |
262 | 266 | ||
263 | case M_ANALYSIS_TIMING: |
267 | case M_ANALYSIS_TIMING: |
264 | fTab->SetTab(1); |
268 | fTab->SetTab(1); |
265 | analTab->SetTab(4); |
269 | analTab->SetTab(4); |
266 | break; |
270 | break; |
267 | 271 | ||
268 | case M_HELP_WEBHELP: |
272 | case M_HELP_WEBHELP: |
269 | printf("TGAppMainFrame::HandleMenu(): Opening %s/doc/documentation.html in a web browser.\n", rootdir); |
273 | printf("TGAppMainFrame::HandleMenu(): Opening %s/doc/documentation.html in a web browser.\n", rootdir); |
270 | sprintf(cmd, "xdg-open %s/doc/documentation.html &", rootdir); |
274 | sprintf(cmd, "xdg-open %s/doc/documentation.html &", rootdir); |
271 | system(cmd); |
275 | system(cmd); |
272 | break; |
276 | break; |
273 | 277 | ||
274 | case M_HELP_ABOUT: |
278 | case M_HELP_ABOUT: |
275 | About(); |
279 | About(); |
276 | break; |
280 | break; |
277 | 281 | ||
278 | default: |
282 | default: |
279 | // fMainFrame->SetCurrent(id); |
283 | // fMainFrame->SetCurrent(id); |
280 | break; |
284 | break; |
281 | } |
285 | } |
282 | } |
286 | } |
283 | 287 | ||
284 | // ------------------------------------------------------------------- |
288 | // ------------------------------------------------------------------- |
285 | 289 | ||
286 | // Initialize the main window menu ----------------------------------- |
290 | // Initialize the main window menu ----------------------------------- |
287 | 291 | ||
288 | void TGAppMainFrame::InitMenu() |
292 | void TGAppMainFrame::InitMenu() |
289 | { |
293 | { |
290 | fMenuBarItemLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0); |
294 | fMenuBarItemLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0); |
291 | 295 | ||
292 | // Popup menu in menubar for File controls |
296 | // Popup menu in menubar for File controls |
293 | fMenuFile = new TGPopupMenu(gClient->GetRoot()); |
297 | fMenuFile = new TGPopupMenu(gClient->GetRoot()); |
294 | fMenuFile->AddEntry(new TGHotString("Set &user layout"), M_FILE_SET_LAYOUT); |
298 | fMenuFile->AddEntry(new TGHotString("Set &user layout"), M_FILE_SET_LAYOUT); |
295 | fMenuFile->AddEntry(new TGHotString("Save ¤t layout"), M_FILE_SAVE_LAYOUT); |
299 | fMenuFile->AddEntry(new TGHotString("Save ¤t layout"), M_FILE_SAVE_LAYOUT); |
296 | fMenuFile->AddSeparator(); |
300 | fMenuFile->AddSeparator(); |
297 | fMenuFile->AddEntry(new TGHotString("Save current &measurement settings"), M_FILE_SAVE_MSETTINGS); |
301 | fMenuFile->AddEntry(new TGHotString("Save current &measurement settings"), M_FILE_SAVE_MSETTINGS); |
298 | fMenuFile->AddEntry(new TGHotString("Save current &analysis settings"), M_FILE_SAVE_ASETTINGS); |
302 | fMenuFile->AddEntry(new TGHotString("Save current &analysis settings"), M_FILE_SAVE_ASETTINGS); |
299 | fMenuFile->AddEntry(new TGHotString("&Check frame width (Testing)"), M_FILE_CHECK_WIDTH); |
303 | fMenuFile->AddEntry(new TGHotString("&Check frame width (Testing)"), M_FILE_CHECK_WIDTH); |
300 | fMenuFile->AddSeparator(); |
304 | fMenuFile->AddSeparator(); |
301 | fMenuFile->AddEntry(new TGHotString("E&xit"), M_FILE_EXIT); |
305 | fMenuFile->AddEntry(new TGHotString("E&xit"), M_FILE_EXIT); |
302 | 306 | ||
303 | // Popup menu in menubar for Analysis controls |
307 | // Popup menu in menubar for Analysis controls |
304 | fMenuHisttype = new TGPopupMenu(gClient->GetRoot()); // adds a cascade menu that will be incorporated into analysis controls |
308 | fMenuHisttype = new TGPopupMenu(gClient->GetRoot()); // adds a cascade menu that will be incorporated into analysis controls |
305 | fMenuHisttype->AddEntry(new TGHotString("1D &ADC histogram"), M_ANALYSIS_HISTTYPE_1DADC); |
309 | fMenuHisttype->AddEntry(new TGHotString("1D &ADC histogram"), M_ANALYSIS_HISTTYPE_1DADC); |
306 | fMenuHisttype->AddEntry(new TGHotString("1D &TDC histogram"), M_ANALYSIS_HISTTYPE_1DTDC); |
310 | fMenuHisttype->AddEntry(new TGHotString("1D &TDC histogram"), M_ANALYSIS_HISTTYPE_1DTDC); |
307 | fMenuHisttype->AddEntry(new TGHotString("&2D ADC vs. TDC histogram"), M_ANALYSIS_HISTTYPE_2D); |
311 | fMenuHisttype->AddEntry(new TGHotString("&2D ADC vs. TDC histogram"), M_ANALYSIS_HISTTYPE_2D); |
308 | 312 | ||
309 | fMenuAnalysis = new TGPopupMenu(gClient->GetRoot()); // adds a new popup menu to the menubar |
313 | fMenuAnalysis = new TGPopupMenu(gClient->GetRoot()); // adds a new popup menu to the menubar |
310 | fMenuAnalysis->AddPopup(new TGHotString("&Histogram type"), fMenuHisttype); |
314 | fMenuAnalysis->AddPopup(new TGHotString("&Histogram type"), fMenuHisttype); |
311 | fMenuAnalysis->AddEntry(new TGHotString("&Integrate spectrum"), M_ANALYSIS_INTEG); |
315 | fMenuAnalysis->AddEntry(new TGHotString("&Integrate spectrum"), M_ANALYSIS_INTEG); |
312 | fMenuAnalysis->AddEntry(new TGHotString("Integrate spectrum (&X direction)"), M_ANALYSIS_INTEGX); |
316 | fMenuAnalysis->AddEntry(new TGHotString("Integrate spectrum (&X direction)"), M_ANALYSIS_INTEGX); |
313 | fMenuAnalysis->AddEntry(new TGHotString("Integrate spectrum (&Y direction)"), M_ANALYSIS_INTEGY); |
317 | fMenuAnalysis->AddEntry(new TGHotString("Integrate spectrum (&Y direction)"), M_ANALYSIS_INTEGY); |
314 | fMenuAnalysis->AddEntry(new TGHotString("&Relative PDE"), M_ANALYSIS_PHOTMU); |
318 | fMenuAnalysis->AddEntry(new TGHotString("&Relative PDE"), M_ANALYSIS_PHOTMU); |
315 | fMenuAnalysis->AddEntry(new TGHotString("&Breakdown voltage"), M_ANALYSIS_BREAKDOWN); |
319 | fMenuAnalysis->AddEntry(new TGHotString("&Breakdown voltage"), M_ANALYSIS_BREAKDOWN); |
316 | fMenuAnalysis->AddEntry(new TGHotString("Surface 2&D scan"), M_ANALYSIS_SURFSCAN); |
320 | fMenuAnalysis->AddEntry(new TGHotString("Surface 2&D scan"), M_ANALYSIS_SURFSCAN); |
317 | fMenuAnalysis->AddEntry(new TGHotString("&Timing analysis"), M_ANALYSIS_TIMING); |
321 | fMenuAnalysis->AddEntry(new TGHotString("&Timing analysis"), M_ANALYSIS_TIMING); |
318 | 322 | ||
319 | // Popup menu in menubar for File controls |
323 | // Popup menu in menubar for File controls |
320 | fMenuHelp = new TGPopupMenu(gClient->GetRoot()); |
324 | fMenuHelp = new TGPopupMenu(gClient->GetRoot()); |
321 | fMenuHelp->AddEntry(new TGHotString("Open &help in web browser"), M_HELP_WEBHELP); |
325 | fMenuHelp->AddEntry(new TGHotString("Open &help in web browser"), M_HELP_WEBHELP); |
322 | fMenuHelp->AddEntry(new TGHotString("&About"), M_HELP_ABOUT); |
326 | fMenuHelp->AddEntry(new TGHotString("&About"), M_HELP_ABOUT); |
323 | 327 | ||
324 | // Connect all menu items with actions |
328 | // Connect all menu items with actions |
325 | fMenuFile->Connect("Activated(Int_t)", "TGAppMainFrame", this, "HandleMenu(Int_t)"); |
329 | fMenuFile->Connect("Activated(Int_t)", "TGAppMainFrame", this, "HandleMenu(Int_t)"); |
326 | fMenuAnalysis->Connect("Activated(Int_t)", "TGAppMainFrame", this, "HandleMenu(Int_t)"); |
330 | fMenuAnalysis->Connect("Activated(Int_t)", "TGAppMainFrame", this, "HandleMenu(Int_t)"); |
327 | fMenuHelp->Connect("Activated(Int_t)", "TGAppMainFrame", this, "HandleMenu(Int_t)"); |
331 | fMenuHelp->Connect("Activated(Int_t)", "TGAppMainFrame", this, "HandleMenu(Int_t)"); |
328 | 332 | ||
329 | // Draw the created popup menus on the menubar |
333 | // Draw the created popup menus on the menubar |
330 | fMenuBar->AddPopup(new TGHotString("&File"), fMenuFile, fMenuBarItemLayout); |
334 | fMenuBar->AddPopup(new TGHotString("&File"), fMenuFile, fMenuBarItemLayout); |
331 | fMenuBar->AddPopup(new TGHotString("&Analysis"),fMenuAnalysis,fMenuBarItemLayout); |
335 | fMenuBar->AddPopup(new TGHotString("&Analysis"),fMenuAnalysis,fMenuBarItemLayout); |
332 | fMenuBar->AddPopup(new TGHotString("&Help"), fMenuHelp, fMenuBarItemLayout); |
336 | fMenuBar->AddPopup(new TGHotString("&Help"), fMenuHelp, fMenuBarItemLayout); |
333 | } |
337 | } |
334 | 338 | ||
335 | // ------------------------------------------------------------------- |
339 | // ------------------------------------------------------------------- |
336 | 340 | ||
337 | // Setting the application subwindow layout -------------------------- |
341 | // Setting the application subwindow layout -------------------------- |
338 | 342 | ||
339 | void TGAppMainFrame::AppLayout() |
343 | void TGAppMainFrame::AppLayout() |
340 | { |
344 | { |
341 | double numform[6], numform2[6]; |
345 | double numform[6], numform2[6]; |
342 | int *checksel; |
346 | int *checksel; |
343 | char selected[256]; |
347 | char selected[256]; |
344 | int subgroup[2]; |
348 | int subgroup[2]; |
345 | TGCompositeFrame *fH1, *fV1, *fH2, *fT1; |
349 | TGCompositeFrame *fH1, *fV1, *fH2, *fT1; |
346 | TGGroupFrame *fG1; |
350 | TGGroupFrame *fG1; |
347 | 351 | ||
348 | TGLayoutHints *f0centerX = new TGLayoutHints(kLHintsCenterX,2,2,2,2); |
352 | TGLayoutHints *f0centerX = new TGLayoutHints(kLHintsCenterX,2,2,2,2); |
349 | TGLayoutHints *f0leftX = new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2); |
353 | TGLayoutHints *f0leftX = new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2); |
350 | TGLayoutHints *f0leftXnoleft = new TGLayoutHints(kLHintsLeft | kLHintsTop,0,2,2,2); |
354 | TGLayoutHints *f0leftXnoleft = new TGLayoutHints(kLHintsLeft | kLHintsTop,0,2,2,2); |
351 | TGLayoutHints *f0leftXpad = new TGLayoutHints(kLHintsLeft | kLHintsTop,12,12,2,2); |
355 | TGLayoutHints *f0leftXpad = new TGLayoutHints(kLHintsLeft | kLHintsTop,12,12,2,2); |
352 | TGLayoutHints *f0rightX = new TGLayoutHints(kLHintsRight | kLHintsTop,2,2,2,2); |
356 | TGLayoutHints *f0rightX = new TGLayoutHints(kLHintsRight | kLHintsTop,2,2,2,2); |
353 | TGLayoutHints *f0rightXpad = new TGLayoutHints(kLHintsRight | kLHintsTop,12,12,2,2); |
357 | TGLayoutHints *f0rightXpad = new TGLayoutHints(kLHintsRight | kLHintsTop,12,12,2,2); |
354 | TGLayoutHints *f0centerY = new TGLayoutHints(kLHintsCenterY,2,2,2,2); |
358 | TGLayoutHints *f0centerY = new TGLayoutHints(kLHintsCenterY,2,2,2,2); |
355 | TGLayoutHints *f0center2d = new TGLayoutHints(kLHintsCenterX | kLHintsCenterY,2,2,2,2); |
359 | TGLayoutHints *f0center2d = new TGLayoutHints(kLHintsCenterX | kLHintsCenterY,2,2,2,2); |
356 | TGLayoutHints *f1expandX = new TGLayoutHints(kLHintsExpandX,2,2,2,2); |
360 | TGLayoutHints *f1expandX = new TGLayoutHints(kLHintsExpandX,2,2,2,2); |
357 | TGLayoutHints *f1expand2d = new TGLayoutHints(kLHintsExpandX | kLHintsExpandY,2,2,2,2); |
361 | TGLayoutHints *f1expand2d = new TGLayoutHints(kLHintsExpandX | kLHintsExpandY,2,2,2,2); |
358 | TGLayoutHints *f1expandXpad = new TGLayoutHints(kLHintsExpandX,12,12,2,2); |
362 | TGLayoutHints *f1expandXpad = new TGLayoutHints(kLHintsExpandX,12,12,2,2); |
359 | 363 | ||
360 | // Settings pane --------------------------------------------------------------------------- |
364 | // Settings pane --------------------------------------------------------------------------- |
361 | subgroup[0] = (measLayout[0]->GetWidth())-4; |
365 | subgroup[0] = (measLayout[0]->GetWidth())-4; |
362 | 366 | ||
363 | // Check buttons to toggle voltage, surface and Z axis scans |
367 | // Check buttons to toggle voltage, surface and Z axis scans |
364 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *scansOn -> 4 check buttons (voltage, surface, Z axis, incidence angle scans)\n"); |
368 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *scansOn -> 4 check buttons (voltage, surface, Z axis, incidence angle scans)\n"); |
365 | scansOn = new TSubStructure(); |
369 | scansOn = new TSubStructure(); |
366 | checksel = new int[4]; |
370 | checksel = new int[4]; |
367 | checksel[0] = 0; checksel[1] = 0; checksel[2] = 0; checksel[3] = 0; |
371 | checksel[0] = 0; checksel[1] = 0; checksel[2] = 0; checksel[3] = 0; |
368 | const char *selnames[] = {"Voltage scan ON/OFF", "Surface scan ON/OFF", "Z-axis scan ON/OFF","Rotation scan ON/OFF","0","0","0","0","0","0","0","0","0","0","0","0"}; |
372 | const char *selnames[] = {"Voltage scan ON/OFF", "Surface scan ON/OFF", "Z-axis scan ON/OFF","Rotation scan ON/OFF","0","0","0","0","0","0","0","0","0","0","0","0"}; |
369 | if(scansOn->TGCheckList(measLayout[0], subgroup[0], 30, 4, selnames, checksel, "vertical", "center")) |
373 | if(scansOn->TGCheckList(measLayout[0], subgroup[0], 30, 4, selnames, checksel, "vertical", "center")) |
370 | measLayout[0]->AddFrame(scansOn->outsidebox, f1expandXpad); |
374 | measLayout[0]->AddFrame(scansOn->outsidebox, f1expandXpad); |
371 | delete[] checksel; |
375 | delete[] checksel; |
372 | 376 | ||
373 | // Hard limit for maximum voltage we can set |
377 | // Hard limit for maximum voltage we can set |
374 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *vHardlimit -> Number entry for voltage limit\n"); |
378 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *vHardlimit -> Number entry for voltage limit\n"); |
375 | vHardlimit = new TSubStructure(); |
379 | vHardlimit = new TSubStructure(); |
376 | for(int i = 0; i < 6; i++) numform[i] = 0; |
380 | for(int i = 0; i < 6; i++) numform[i] = 0; |
377 | numform[0] = 6; numform[1] = 2; |
381 | numform[0] = 6; numform[1] = 2; |
378 | if(vHardlimit->TGLabelNEntry(measLayout[0], subgroup[0], 30, "Voltage limit:", 70.00, numform, "center")) |
382 | if(vHardlimit->TGLabelNEntry(measLayout[0], subgroup[0], 30, "Voltage limit:", 70.00, numform, "center")) |
379 | measLayout[0]->AddFrame(vHardlimit->outsidebox, f1expandXpad); |
383 | measLayout[0]->AddFrame(vHardlimit->outsidebox, f1expandXpad); |
380 | 384 | ||
381 | // Number of used channels |
385 | // Number of used channels |
382 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *NCH -> Number entry for number of channels to capture\n"); |
386 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *NCH -> Number entry for number of channels to capture\n"); |
383 | NCH = new TSubStructure(); |
387 | NCH = new TSubStructure(); |
384 | for(int i = 0; i < 6; i++) numform[i] = 0; |
388 | for(int i = 0; i < 6; i++) numform[i] = 0; |
385 | numform[0] = 3; numform[2] = 2; numform[3] = 2; numform[4] = 1; numform[5] = 8; |
389 | numform[0] = 3; numform[2] = 2; numform[3] = 2; numform[4] = 1; numform[5] = 8; |
386 | if(NCH->TGLabelNEntry(measLayout[0], subgroup[0], 30, "Nr. of channels:", 1, numform, "center")) |
390 | if(NCH->TGLabelNEntry(measLayout[0], subgroup[0], 30, "Nr. of channels:", 1, numform, "center")) |
387 | measLayout[0]->AddFrame(NCH->outsidebox, f1expandXpad); |
391 | measLayout[0]->AddFrame(NCH->outsidebox, f1expandXpad); |
388 | 392 | ||
389 | // Select the units to use for table positioning (micrometer, table position units) |
393 | // Select the units to use for table positioning (micrometer, table position units) |
390 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *posUnits -> Dropdown menu for selecting the units for table positioning\n"); |
394 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *posUnits -> Dropdown menu for selecting the units for table positioning\n"); |
391 | posUnits = new TSubStructure(); |
395 | posUnits = new TSubStructure(); |
392 | selnames[0] = "table units"; selnames[1] = "micrometers"; |
396 | selnames[0] = "table units"; selnames[1] = "micrometers"; |
393 | sprintf(selected, "table units"); |
397 | sprintf(selected, "table units"); |
394 | if(posUnits->TGLabelDrop(measLayout[0], 2*subgroup[0]/3, 30, "Position units:", 2, selnames, selected)) |
398 | if(posUnits->TGLabelDrop(measLayout[0], 2*subgroup[0]/3, 30, "Position units:", 2, selnames, selected)) |
395 | measLayout[0]->AddFrame(posUnits->outsidebox, f1expandXpad); |
399 | measLayout[0]->AddFrame(posUnits->outsidebox, f1expandXpad); |
396 | 400 | ||
397 | // Select the units to use for rotation platform (degrees, table rotation units) |
401 | // Select the units to use for rotation platform (degrees, table rotation units) |
398 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *rotUnits -> Dropdown menu for selecting the units for rotation\n"); |
402 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *rotUnits -> Dropdown menu for selecting the units for rotation\n"); |
399 | rotUnits = new TSubStructure(); |
403 | rotUnits = new TSubStructure(); |
400 | selnames[0] = "table units"; selnames[1] = "degrees"; |
404 | selnames[0] = "table units"; selnames[1] = "degrees"; |
401 | sprintf(selected, "degrees"); |
405 | sprintf(selected, "degrees"); |
402 | if(rotUnits->TGLabelDrop(measLayout[0], 2*subgroup[0]/3, 30, "Rotation units:", 2, selnames, selected)) |
406 | if(rotUnits->TGLabelDrop(measLayout[0], 2*subgroup[0]/3, 30, "Rotation units:", 2, selnames, selected)) |
403 | measLayout[0]->AddFrame(rotUnits->outsidebox, f1expandXpad); |
407 | measLayout[0]->AddFrame(rotUnits->outsidebox, f1expandXpad); |
404 | 408 | ||
405 | // Button and textbox to enter the oscilloscope IP address |
409 | // Button and textbox to enter the oscilloscope IP address |
406 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *oscConnect -> Text Entry (oscilloscope IP address)\n"); |
410 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *oscConnect -> Text Entry (oscilloscope IP address)\n"); |
407 | oscConnect = new TSubStructure(); |
411 | oscConnect = new TSubStructure(); |
408 | if(oscConnect->TGLabelTEntryButton(measLayout[0], subgroup[0], 30, "Scope IP:", "178.172.43.157", "Connect", "twoline")) |
412 | if(oscConnect->TGLabelTEntryButton(measLayout[0], subgroup[0], 30, "Scope IP:", "178.172.43.157", "Connect", "twoline")) |
409 | measLayout[0]->AddFrame(oscConnect->outsidebox, f1expandXpad); |
413 | measLayout[0]->AddFrame(oscConnect->outsidebox, f1expandXpad); |
410 | 414 | ||
411 | // Laser settings (freq., tune, ND filter) |
415 | // Laser settings (freq., tune, ND filter) |
412 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *laserInfo -> Text Entry (Laser setting information)\n"); |
416 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *laserInfo -> Text Entry (Laser setting information)\n"); |
413 | laserInfo = new TSubStructure(); |
417 | laserInfo = new TSubStructure(); |
414 | if(laserInfo->TGLabelTEntry(measLayout[0], subgroup[0], 30, "Laser settings:", "kHz, tune, ND", "twoline")) |
418 | if(laserInfo->TGLabelTEntry(measLayout[0], subgroup[0], 30, "Laser settings:", "kHz, tune, ND", "twoline")) |
415 | measLayout[0]->AddFrame(laserInfo->outsidebox, f1expandXpad); |
419 | measLayout[0]->AddFrame(laserInfo->outsidebox, f1expandXpad); |
416 | 420 | ||
417 | // Chamber temperature (will only be manually set until we can get it directly from the chamber) |
421 | // Chamber temperature (will only be manually set until we can get it directly from the chamber) |
418 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *chtemp -> Number entry for chamber temperature\n"); |
422 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *chtemp -> Number entry for chamber temperature\n"); |
419 | chtemp = new TSubStructure(); |
423 | chtemp = new TSubStructure(); |
420 | for(int i = 0; i < 6; i++) numform[i] = 0; |
424 | for(int i = 0; i < 6; i++) numform[i] = 0; |
421 | numform[0] = 5; numform[1] = 1; numform[3] = 2; numform[4] = -70.; numform[5] = 140.; |
425 | numform[0] = 5; numform[1] = 1; numform[3] = 2; numform[4] = -70.; numform[5] = 140.; |
422 | if(chtemp->TGLabelNEntry(measLayout[0], subgroup[0], 30, "Chamber temp.:", 25.0, numform, "center")) |
426 | if(chtemp->TGLabelNEntry(measLayout[0], subgroup[0], 30, "Chamber temp.:", 25.0, numform, "center")) |
423 | measLayout[0]->AddFrame(chtemp->outsidebox, f1expandXpad); |
427 | measLayout[0]->AddFrame(chtemp->outsidebox, f1expandXpad); |
424 | 428 | ||
425 | // Check button to toggle live update of histogram (in display canvas) |
429 | // Check button to toggle live update of histogram (in display canvas) |
426 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *liveDisp -> 1 check button (live histogram update)\n"); |
430 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *liveDisp -> 1 check button (live histogram update)\n"); |
427 | liveDisp = new TSubStructure(); |
431 | liveDisp = new TSubStructure(); |
428 | checksel = new int; |
432 | checksel = new int; |
429 | *checksel = 0; |
433 | *checksel = 0; |
430 | selnames[0] = "Live histogram ON/OFF"; |
434 | selnames[0] = "Live histogram ON/OFF"; |
431 | if(liveDisp->TGCheckList(measLayout[0], subgroup[0], 30, 1, selnames, checksel, "vertical", "center")) |
435 | if(liveDisp->TGCheckList(measLayout[0], subgroup[0], 30, 1, selnames, checksel, "vertical", "center")) |
432 | measLayout[0]->AddFrame(liveDisp->outsidebox, f1expandXpad); |
436 | measLayout[0]->AddFrame(liveDisp->outsidebox, f1expandXpad); |
433 | delete checksel; |
437 | delete checksel; |
434 | 438 | ||
435 | // Actions for Settings pane //TODO |
439 | // Actions for Settings pane //TODO |
436 | scansOn->widgetChBox[0]->Connect("Clicked()", "TGAppMainFrame", this, "EnableScan(=0)"); |
440 | scansOn->widgetChBox[0]->Connect("Clicked()", "TGAppMainFrame", this, "EnableScan(=0)"); |
437 | scansOn->widgetChBox[1]->Connect("Clicked()", "TGAppMainFrame", this, "EnableScan(=1)"); |
441 | scansOn->widgetChBox[1]->Connect("Clicked()", "TGAppMainFrame", this, "EnableScan(=1)"); |
438 | scansOn->widgetChBox[2]->Connect("Clicked()", "TGAppMainFrame", this, "EnableScan(=2)"); |
442 | scansOn->widgetChBox[2]->Connect("Clicked()", "TGAppMainFrame", this, "EnableScan(=2)"); |
439 | scansOn->widgetChBox[3]->Connect("Clicked()", "TGAppMainFrame", this, "EnableScan(=3)"); |
443 | scansOn->widgetChBox[3]->Connect("Clicked()", "TGAppMainFrame", this, "EnableScan(=3)"); |
440 | vHardlimit->widgetNE[0]->Connect("ValueSet(Long_t)", "TGAppMainFrame", this, "VoltageLimit()"); |
444 | vHardlimit->widgetNE[0]->Connect("ValueSet(Long_t)", "TGAppMainFrame", this, "VoltageLimit()"); |
441 | (vHardlimit->widgetNE[0]->GetNumberEntry())->Connect("ReturnPressed()", "TGAppMainFrame", this, "VoltageLimit()"); |
445 | (vHardlimit->widgetNE[0]->GetNumberEntry())->Connect("ReturnPressed()", "TGAppMainFrame", this, "VoltageLimit()"); |
442 | posUnits->widgetCB->Connect("Selected(Int_t)", "TGAppMainFrame", this, "ChangeUnits(Int_t)"); |
446 | posUnits->widgetCB->Connect("Selected(Int_t)", "TGAppMainFrame", this, "ChangeUnits(Int_t)"); |
443 | rotUnits->widgetCB->Connect("Selected(Int_t)", "TGAppMainFrame", this, "ChangeUnitsRot(Int_t)"); |
447 | rotUnits->widgetCB->Connect("Selected(Int_t)", "TGAppMainFrame", this, "ChangeUnitsRot(Int_t)"); |
444 | liveDisp->widgetChBox[0]->Connect("Clicked()", "TGAppMainFrame", this, "EnableLiveUpdate()"); |
448 | liveDisp->widgetChBox[0]->Connect("Clicked()", "TGAppMainFrame", this, "EnableLiveUpdate()"); |
445 | // Settings pane --------------------------------------------------------------------------- |
449 | // Settings pane --------------------------------------------------------------------------- |
446 | 450 | ||
447 | // Main window ----------------------------------------------------------------------------- |
451 | // Main window ----------------------------------------------------------------------------- |
448 | TGTab *setTab; |
452 | TGTab *setTab; |
449 | 453 | ||
450 | // Voltage, position and incidence angle tab |
454 | // Voltage, position and incidence angle tab |
451 | subgroup[0] = 2*(measLayout[2]->GetWidth())/7-14; |
455 | subgroup[0] = 2*(measLayout[2]->GetWidth())/7-14; |
452 | subgroup[1] = (measLayout[2]->GetHeight())/2-4; |
456 | subgroup[1] = (measLayout[2]->GetHeight())/2-4; |
453 | setTab = new TGTab(measLayout[2], subgroup[0], subgroup[1]); |
457 | setTab = new TGTab(measLayout[2], subgroup[0], subgroup[1]); |
454 | 458 | ||
455 | fT1 = setTab->AddTab("Voltage, position and incidence angle"); |
459 | fT1 = setTab->AddTab("Voltage, position and incidence angle"); |
456 | fH1 = new TGCompositeFrame(fT1, measLayout[2]->GetWidth(), subgroup[1], kFixedHeight | kHorizontalFrame); |
460 | fH1 = new TGCompositeFrame(fT1, measLayout[2]->GetWidth(), subgroup[1], kFixedHeight | kHorizontalFrame); |
457 | 461 | ||
458 | // Left pane (Bias voltage controls) |
462 | // Left pane (Bias voltage controls) |
459 | fV1 = new TGCompositeFrame(fH1, subgroup[0], subgroup[1], kFixedWidth | kFixedHeight | kVerticalFrame); |
463 | fV1 = new TGCompositeFrame(fH1, subgroup[0], subgroup[1], kFixedWidth | kFixedHeight | kVerticalFrame); |
460 | fG1 = new TGGroupFrame(fV1, "Bias voltage controls"); |
464 | fG1 = new TGGroupFrame(fV1, "Bias voltage controls"); |
461 | 465 | ||
462 | // Output voltage supply channel |
466 | // Output voltage supply channel |
463 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *vOutCh -> Dropdown menu for bias voltage channel\n"); |
467 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *vOutCh -> Dropdown menu for bias voltage channel\n"); |
464 | vOutCh = new TSubStructure(); |
468 | vOutCh = new TSubStructure(); |
465 | selnames[0] = "U0"; selnames[1] = "U1"; selnames[2] = "U2"; selnames[3] = "U3"; selnames[4] = "U4"; selnames[5] = "U5"; selnames[6] = "U6"; selnames[7] = "U7"; selnames[8] = "U100"; selnames[9] = "U101"; selnames[10] = "U102"; selnames[11] = "U103"; selnames[12] = "U104"; selnames[13] = "U105"; selnames[14] = "U106"; selnames[15] = "U107"; |
469 | selnames[0] = "U0"; selnames[1] = "U1"; selnames[2] = "U2"; selnames[3] = "U3"; selnames[4] = "U4"; selnames[5] = "U5"; selnames[6] = "U6"; selnames[7] = "U7"; selnames[8] = "U100"; selnames[9] = "U101"; selnames[10] = "U102"; selnames[11] = "U103"; selnames[12] = "U104"; selnames[13] = "U105"; selnames[14] = "U106"; selnames[15] = "U107"; |
466 | sprintf(selected, "U0"); |
470 | sprintf(selected, "U0"); |
467 | if(vOutCh->TGLabelDrop(fG1, 2*subgroup[0]/3, 30, "Output channel:", 16, selnames, selected)) |
471 | if(vOutCh->TGLabelDrop(fG1, 2*subgroup[0]/3, 30, "Output channel:", 16, selnames, selected)) |
468 | fG1->AddFrame(vOutCh->outsidebox, f1expandXpad); |
472 | fG1->AddFrame(vOutCh->outsidebox, f1expandXpad); |
469 | 473 | ||
470 | // Output voltage setting |
474 | // Output voltage setting |
471 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *vOutOpt -> 2 check buttons (negative polarity, ON/OFF toggle switch)\n"); |
475 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *vOutOpt -> 2 check buttons (negative polarity, ON/OFF toggle switch)\n"); |
472 | vOutOpt = new TSubStructure(); |
476 | vOutOpt = new TSubStructure(); |
473 | checksel = new int[2]; |
477 | checksel = new int[2]; |
474 | checksel[0] = 0; checksel[1] = 0; |
478 | checksel[0] = 0; checksel[1] = 0; |
475 | selnames[1] = "Output ON/OFF"; selnames[0] = "Negative polarity"; |
479 | selnames[1] = "Output ON/OFF"; selnames[0] = "Negative polarity"; |
476 | if(vOutOpt->TGCheckList(fG1, 3*subgroup[0]/4, 30, 2, selnames, checksel, "vertical", "center")) |
480 | if(vOutOpt->TGCheckList(fG1, 3*subgroup[0]/4, 30, 2, selnames, checksel, "vertical", "center")) |
477 | fG1->AddFrame(vOutOpt->outsidebox, f1expandXpad); |
481 | fG1->AddFrame(vOutOpt->outsidebox, f1expandXpad); |
478 | delete[] checksel; |
482 | delete[] checksel; |
479 | 483 | ||
480 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *vOut -> Number entry for bias voltage\n"); |
484 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *vOut -> Number entry for bias voltage\n"); |
481 | vOut = new TSubStructure(); |
485 | vOut = new TSubStructure(); |
482 | for(int i = 0; i < 6; i++) numform[i] = 0; |
486 | for(int i = 0; i < 6; i++) numform[i] = 0; |
483 | numform[0] = 7; numform[1] = 2; numform[3] = 2; numform[4] = 0.; numform[5] = vHardlimit->widgetNE[0]->GetNumber(); |
487 | numform[0] = 7; numform[1] = 2; numform[3] = 2; numform[4] = 0.; numform[5] = vHardlimit->widgetNE[0]->GetNumber(); |
484 | if(vOut->TGLabelNEntry(fG1, 3*subgroup[0]/4, 30, "Output voltage:", 0.00, numform, "center")) |
488 | if(vOut->TGLabelNEntry(fG1, 3*subgroup[0]/4, 30, "Output voltage:", 0.00, numform, "center")) |
485 | fG1->AddFrame(vOut->outsidebox, f1expandXpad); |
489 | fG1->AddFrame(vOut->outsidebox, f1expandXpad); |
486 | 490 | ||
487 | // Set, get and reset voltage buttons |
491 | // Set, get and reset voltage buttons |
488 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *vOutButtons -> 3 buttons (set bias voltage, read current bias voltage, reset voltage output when it gets interlocked)\n"); |
492 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *vOutButtons -> 3 buttons (set bias voltage, read current bias voltage, reset voltage output when it gets interlocked)\n"); |
489 | vOutButtons = new TSubStructure(); |
493 | vOutButtons = new TSubStructure(); |
490 | selnames[0] = "Set"; selnames[1] = "Get"; selnames[2] = "Reset"; |
494 | selnames[0] = "Set"; selnames[1] = "Get"; selnames[2] = "Reset"; |
491 | if(vOutButtons->TGMultiButton(fG1, 3*subgroup[0]/4, 30, 3, selnames, "center")) |
495 | if(vOutButtons->TGMultiButton(fG1, 3*subgroup[0]/4, 30, 3, selnames, "center")) |
492 | fG1->AddFrame(vOutButtons->outsidebox, f1expandXpad); |
496 | fG1->AddFrame(vOutButtons->outsidebox, f1expandXpad); |
493 | 497 | ||
494 | // Voltage scan controls |
498 | // Voltage scan controls |
495 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *vOutStart -> Number entry for starting bias voltage\n"); |
499 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *vOutStart -> Number entry for starting bias voltage\n"); |
496 | vOutStart = new TSubStructure(); |
500 | vOutStart = new TSubStructure(); |
497 | for(int i = 0; i < 6; i++) numform[i] = 0; |
501 | for(int i = 0; i < 6; i++) numform[i] = 0; |
498 | numform[0] = 7; numform[1] = 2; |
502 | numform[0] = 7; numform[1] = 2; |
499 | if(vOutStart->TGLabelNEntry(fG1, 3*subgroup[0]/4, 30, "V (min):", 0.00, numform, "center")) |
503 | if(vOutStart->TGLabelNEntry(fG1, 3*subgroup[0]/4, 30, "V (min):", 0.00, numform, "center")) |
500 | fG1->AddFrame(vOutStart->outsidebox, f1expandXpad); |
504 | fG1->AddFrame(vOutStart->outsidebox, f1expandXpad); |
501 | 505 | ||
502 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *vOutStop -> Number entry for starting bias voltage\n"); |
506 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *vOutStop -> Number entry for starting bias voltage\n"); |
503 | vOutStop = new TSubStructure(); |
507 | vOutStop = new TSubStructure(); |
504 | for(int i = 0; i < 6; i++) numform[i] = 0; |
508 | for(int i = 0; i < 6; i++) numform[i] = 0; |
505 | numform[0] = 7; numform[1] = 2; |
509 | numform[0] = 7; numform[1] = 2; |
506 | if(vOutStop->TGLabelNEntry(fG1, 3*subgroup[0]/4, 30, "V (max):", 0.00, numform, "center")) |
510 | if(vOutStop->TGLabelNEntry(fG1, 3*subgroup[0]/4, 30, "V (max):", 0.00, numform, "center")) |
507 | fG1->AddFrame(vOutStop->outsidebox, f1expandXpad); |
511 | fG1->AddFrame(vOutStop->outsidebox, f1expandXpad); |
508 | 512 | ||
509 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *vOutStep -> Number entry for starting bias voltage\n"); |
513 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *vOutStep -> Number entry for starting bias voltage\n"); |
510 | vOutStep = new TSubStructure(); |
514 | vOutStep = new TSubStructure(); |
511 | for(int i = 0; i < 6; i++) numform[i] = 0; |
515 | for(int i = 0; i < 6; i++) numform[i] = 0; |
512 | numform[0] = 7; numform[1] = 2; |
516 | numform[0] = 7; numform[1] = 2; |
513 | if(vOutStep->TGLabelNEntry(fG1, 3*subgroup[0]/4, 30, "V (step):", 0.00, numform, "center")) |
517 | if(vOutStep->TGLabelNEntry(fG1, 3*subgroup[0]/4, 30, "V (step):", 0.00, numform, "center")) |
514 | fG1->AddFrame(vOutStep->outsidebox, f1expandXpad); |
518 | fG1->AddFrame(vOutStep->outsidebox, f1expandXpad); |
515 | 519 | ||
516 | fV1->AddFrame(fG1, f1expand2d); |
520 | fV1->AddFrame(fG1, f1expand2d); |
517 | // Left pane (Bias voltage controls) |
521 | // Left pane (Bias voltage controls) |
518 | fH1->AddFrame(fV1, f0leftX); |
522 | fH1->AddFrame(fV1, f0leftX); |
519 | 523 | ||
520 | // Center pane (Table position controls) |
524 | // Center pane (Table position controls) |
521 | subgroup[0] = 3*(measLayout[2]->GetWidth())/7-13; |
525 | subgroup[0] = 3*(measLayout[2]->GetWidth())/7-13; |
522 | fV1 = new TGCompositeFrame(fH1, subgroup[0], subgroup[1], kFixedWidth | kFixedHeight | kVerticalFrame); |
526 | fV1 = new TGCompositeFrame(fH1, subgroup[0], subgroup[1], kFixedWidth | kFixedHeight | kVerticalFrame); |
523 | fG1 = new TGGroupFrame(fV1, "Table position controls"); |
527 | fG1 = new TGGroupFrame(fV1, "Table position controls"); |
524 | 528 | ||
525 | // X, Y and Z positions |
529 | // X, Y and Z positions |
526 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *xPos, *yPos, *zPos, *zPosMin, *zPosMax, *zPosStep -> Settings for position and Z axis scan\n"); |
530 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *xPos, *yPos, *zPos, *zPosMin, *zPosMax, *zPosStep -> Settings for position and Z axis scan\n"); |
527 | fH2 = new TGCompositeFrame(fG1, 3*subgroup[0]/4, 30, kFixedWidth | kHorizontalFrame); |
531 | fH2 = new TGCompositeFrame(fG1, 3*subgroup[0]/4, 30, kFixedWidth | kHorizontalFrame); |
528 | xPos = new TSubStructure(); |
532 | xPos = new TSubStructure(); |
529 | for(int i = 0; i < 6; i++) numform[i] = 0; |
533 | for(int i = 0; i < 6; i++) numform[i] = 0; |
530 | numform[0] = 9; numform[3] = 2; numform[4] = -100; numform[5] = 215000; |
534 | numform[0] = 9; numform[3] = 2; numform[4] = -100; numform[5] = 215000; |
531 | if(xPos->TGLabelNEntry(fH2, 8*subgroup[0]/16, 30, "X:", 0, numform, "center")) |
535 | if(xPos->TGLabelNEntry(fH2, 8*subgroup[0]/16, 30, "X:", 0, numform, "center")) |
532 | fH2->AddFrame(xPos->outsidebox, f0centerX); |
536 | fH2->AddFrame(xPos->outsidebox, f0centerX); |
533 | 537 | ||
534 | zPosMin = new TSubStructure(); |
538 | zPosMin = new TSubStructure(); |
535 | numform[5] = 375000; |
539 | numform[5] = 375000; |
536 | if(zPosMin->TGLabelNEntry(fH2, 8*subgroup[0]/16, 30, "Z (min):", 0, numform, "center")) |
540 | if(zPosMin->TGLabelNEntry(fH2, 8*subgroup[0]/16, 30, "Z (min):", 0, numform, "center")) |
537 | fH2->AddFrame(zPosMin->outsidebox, f0centerX); |
541 | fH2->AddFrame(zPosMin->outsidebox, f0centerX); |
538 | fG1->AddFrame(fH2, f1expandXpad); |
542 | fG1->AddFrame(fH2, f1expandXpad); |
539 | 543 | ||
540 | fH2 = new TGCompositeFrame(fG1, 3*subgroup[0]/4, 30, kFixedWidth | kHorizontalFrame); |
544 | fH2 = new TGCompositeFrame(fG1, 3*subgroup[0]/4, 30, kFixedWidth | kHorizontalFrame); |
541 | yPos = new TSubStructure(); |
545 | yPos = new TSubStructure(); |
542 | numform[5] = 215000; |
546 | numform[5] = 215000; |
543 | if(yPos->TGLabelNEntry(fH2, 8*subgroup[0]/16, 30, "Y:", 0, numform, "center")) |
547 | if(yPos->TGLabelNEntry(fH2, 8*subgroup[0]/16, 30, "Y:", 0, numform, "center")) |
544 | fH2->AddFrame(yPos->outsidebox, f0centerX); |
548 | fH2->AddFrame(yPos->outsidebox, f0centerX); |
545 | 549 | ||
546 | zPosMax = new TSubStructure(); |
550 | zPosMax = new TSubStructure(); |
547 | numform[5] = 375000; |
551 | numform[5] = 375000; |
548 | if(zPosMax->TGLabelNEntry(fH2, 8*subgroup[0]/16, 30, "Z (max):", 0, numform, "center")) |
552 | if(zPosMax->TGLabelNEntry(fH2, 8*subgroup[0]/16, 30, "Z (max):", 0, numform, "center")) |
549 | fH2->AddFrame(zPosMax->outsidebox, f0centerX); |
553 | fH2->AddFrame(zPosMax->outsidebox, f0centerX); |
550 | fG1->AddFrame(fH2, f1expandXpad); |
554 | fG1->AddFrame(fH2, f1expandXpad); |
551 | 555 | ||
552 | fH2 = new TGCompositeFrame(fG1, 3*subgroup[0]/4, 30, kFixedWidth | kHorizontalFrame); |
556 | fH2 = new TGCompositeFrame(fG1, 3*subgroup[0]/4, 30, kFixedWidth | kHorizontalFrame); |
553 | zPos = new TSubStructure(); |
557 | zPos = new TSubStructure(); |
554 | numform[5] = 375000; |
558 | numform[5] = 375000; |
555 | if(zPos->TGLabelNEntry(fH2, 8*subgroup[0]/16, 30, "Z:", 0, numform, "center")) |
559 | if(zPos->TGLabelNEntry(fH2, 8*subgroup[0]/16, 30, "Z:", 0, numform, "center")) |
556 | fH2->AddFrame(zPos->outsidebox, f0centerX); |
560 | fH2->AddFrame(zPos->outsidebox, f0centerX); |
557 | 561 | ||
558 | zPosStep = new TSubStructure(); |
562 | zPosStep = new TSubStructure(); |
559 | for(int i = 0; i < 6; i++) numform[i] = 0; |
563 | for(int i = 0; i < 6; i++) numform[i] = 0; |
560 | numform[0] = 9; |
564 | numform[0] = 9; |
561 | if(zPosStep->TGLabelNEntry(fH2, 8*subgroup[0]/16, 30, "Z (step):", 0, numform, "center")) |
565 | if(zPosStep->TGLabelNEntry(fH2, 8*subgroup[0]/16, 30, "Z (step):", 0, numform, "center")) |
562 | fH2->AddFrame(zPosStep->outsidebox, f0centerX); |
566 | fH2->AddFrame(zPosStep->outsidebox, f0centerX); |
563 | fG1->AddFrame(fH2, f1expandXpad); |
567 | fG1->AddFrame(fH2, f1expandXpad); |
564 | 568 | ||
565 | // Set, get, home and reset position buttons |
569 | // Set, get, home and reset position buttons |
566 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *posButtons -> 4 buttons (set position, read current position, home the motor and reset all three controllers)\n"); |
570 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *posButtons -> 4 buttons (set position, read current position, home the motor and reset all three controllers)\n"); |
567 | posButtons = new TSubStructure(); |
571 | posButtons = new TSubStructure(); |
568 | selnames[0] = "Set"; selnames[1] = "Get"; selnames[2] = "Home"; selnames[3] = "Reset"; |
572 | selnames[0] = "Set"; selnames[1] = "Get"; selnames[2] = "Home"; selnames[3] = "Reset"; |
569 | if(posButtons->TGMultiButton(fG1, 3*subgroup[0]/4, 30, 4, selnames, "center")) |
573 | if(posButtons->TGMultiButton(fG1, 3*subgroup[0]/4, 30, 4, selnames, "center")) |
570 | fG1->AddFrame(posButtons->outsidebox, f1expandXpad); |
574 | fG1->AddFrame(posButtons->outsidebox, f1expandXpad); |
571 | 575 | ||
572 | // Position scan controls |
576 | // Position scan controls |
573 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *xPosMin, *xPosMax, *xPosStep, *yPosMin, *yPosMax, *yPosStep -> Settings for X and Y axis scans\n"); |
577 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *xPosMin, *xPosMax, *xPosStep, *yPosMin, *yPosMax, *yPosStep -> Settings for X and Y axis scans\n"); |
574 | fH2 = new TGCompositeFrame(fG1, 3*subgroup[0]/4, 30, kFixedWidth | kHorizontalFrame); |
578 | fH2 = new TGCompositeFrame(fG1, 3*subgroup[0]/4, 30, kFixedWidth | kHorizontalFrame); |
575 | xPosMin = new TSubStructure(); |
579 | xPosMin = new TSubStructure(); |
576 | for(int i = 0; i < 6; i++) numform[i] = 0; |
580 | for(int i = 0; i < 6; i++) numform[i] = 0; |
577 | numform[0] = 9; numform[3] = 2; numform[4] = -100; numform[5] = 215000; |
581 | numform[0] = 9; numform[3] = 2; numform[4] = -100; numform[5] = 215000; |
578 | if(xPosMin->TGLabelNEntry(fH2, 8*subgroup[0]/16, 30, "X (min):", 0, numform, "center")) |
582 | if(xPosMin->TGLabelNEntry(fH2, 8*subgroup[0]/16, 30, "X (min):", 0, numform, "center")) |
579 | fH2->AddFrame(xPosMin->outsidebox, f0centerX); |
583 | fH2->AddFrame(xPosMin->outsidebox, f0centerX); |
580 | 584 | ||
581 | yPosMin = new TSubStructure(); |
585 | yPosMin = new TSubStructure(); |
582 | if(yPosMin->TGLabelNEntry(fH2, 8*subgroup[0]/16, 30, "Y (min):", 0, numform, "center")) |
586 | if(yPosMin->TGLabelNEntry(fH2, 8*subgroup[0]/16, 30, "Y (min):", 0, numform, "center")) |
583 | fH2->AddFrame(yPosMin->outsidebox, f0centerX); |
587 | fH2->AddFrame(yPosMin->outsidebox, f0centerX); |
584 | fG1->AddFrame(fH2, f1expandXpad); |
588 | fG1->AddFrame(fH2, f1expandXpad); |
585 | 589 | ||
586 | fH2 = new TGCompositeFrame(fG1, 3*subgroup[0]/4, 30, kFixedWidth | kHorizontalFrame); |
590 | fH2 = new TGCompositeFrame(fG1, 3*subgroup[0]/4, 30, kFixedWidth | kHorizontalFrame); |
587 | xPosMax = new TSubStructure(); |
591 | xPosMax = new TSubStructure(); |
588 | if(xPosMax->TGLabelNEntry(fH2, 8*subgroup[0]/16, 30, "X (max):", 0, numform, "center")) |
592 | if(xPosMax->TGLabelNEntry(fH2, 8*subgroup[0]/16, 30, "X (max):", 0, numform, "center")) |
589 | fH2->AddFrame(xPosMax->outsidebox, f0centerX); |
593 | fH2->AddFrame(xPosMax->outsidebox, f0centerX); |
590 | 594 | ||
591 | yPosMax = new TSubStructure(); |
595 | yPosMax = new TSubStructure(); |
592 | if(yPosMax->TGLabelNEntry(fH2, 8*subgroup[0]/16, 30, "Y (max):", 0, numform, "center")) |
596 | if(yPosMax->TGLabelNEntry(fH2, 8*subgroup[0]/16, 30, "Y (max):", 0, numform, "center")) |
593 | fH2->AddFrame(yPosMax->outsidebox, f0centerX); |
597 | fH2->AddFrame(yPosMax->outsidebox, f0centerX); |
594 | fG1->AddFrame(fH2, f1expandXpad); |
598 | fG1->AddFrame(fH2, f1expandXpad); |
595 | 599 | ||
596 | fH2 = new TGCompositeFrame(fG1, 3*subgroup[0]/4, 30, kFixedWidth | kHorizontalFrame); |
600 | fH2 = new TGCompositeFrame(fG1, 3*subgroup[0]/4, 30, kFixedWidth | kHorizontalFrame); |
597 | xPosStep = new TSubStructure(); |
601 | xPosStep = new TSubStructure(); |
598 | for(int i = 0; i < 6; i++) numform[i] = 0; |
602 | for(int i = 0; i < 6; i++) numform[i] = 0; |
599 | numform[0] = 9; |
603 | numform[0] = 9; |
600 | if(xPosStep->TGLabelNEntry(fH2, 8*subgroup[0]/16, 30, "X (step):", 0, numform, "center")) |
604 | if(xPosStep->TGLabelNEntry(fH2, 8*subgroup[0]/16, 30, "X (step):", 0, numform, "center")) |
601 | fH2->AddFrame(xPosStep->outsidebox, f0centerX); |
605 | fH2->AddFrame(xPosStep->outsidebox, f0centerX); |
602 | 606 | ||
603 | yPosStep = new TSubStructure(); |
607 | yPosStep = new TSubStructure(); |
604 | if(yPosStep->TGLabelNEntry(fH2, 8*subgroup[0]/16, 30, "Y (step):", 0, numform, "center")) |
608 | if(yPosStep->TGLabelNEntry(fH2, 8*subgroup[0]/16, 30, "Y (step):", 0, numform, "center")) |
605 | fH2->AddFrame(yPosStep->outsidebox, f0centerX); |
609 | fH2->AddFrame(yPosStep->outsidebox, f0centerX); |
606 | fG1->AddFrame(fH2, f1expandXpad); |
610 | fG1->AddFrame(fH2, f1expandXpad); |
607 | 611 | ||
608 | fV1->AddFrame(fG1, f1expand2d); |
612 | fV1->AddFrame(fG1, f1expand2d); |
609 | // Center pane (Table position controls) |
613 | // Center pane (Table position controls) |
610 | fH1->AddFrame(fV1, f0leftX); |
614 | fH1->AddFrame(fV1, f0leftX); |
611 | 615 | ||
612 | // Right pane (Incidence angle controls) |
616 | // Right pane (Incidence angle controls) |
613 | subgroup[0] = 2*(measLayout[2]->GetWidth())/7-14; |
617 | subgroup[0] = 2*(measLayout[2]->GetWidth())/7-14; |
614 | fV1 = new TGCompositeFrame(fH1, subgroup[0], subgroup[1], kFixedWidth | kFixedHeight | kVerticalFrame); |
618 | fV1 = new TGCompositeFrame(fH1, subgroup[0], subgroup[1], kFixedWidth | kFixedHeight | kVerticalFrame); |
615 | fG1 = new TGGroupFrame(fV1, "Incidence angle controls"); |
619 | fG1 = new TGGroupFrame(fV1, "Incidence angle controls"); |
616 | 620 | ||
617 | // Rotation positions |
621 | // Rotation positions |
618 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *rotPos -> Setting for rotation position\n"); |
622 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *rotPos -> Setting for rotation position\n"); |
619 | rotPos = new TSubStructure(); |
623 | rotPos = new TSubStructure(); |
620 | for(int i = 0; i < 6; i++) numform[i] = 0; |
624 | for(int i = 0; i < 6; i++) numform[i] = 0; |
621 | numform[0] = 7; numform[1] = 2; numform[3] = 2; numform[4] = -180.; numform[5] = 180.; |
625 | numform[0] = 7; numform[1] = 2; numform[3] = 2; numform[4] = -180.; numform[5] = 180.; |
622 | if(rotPos->TGLabelNEntry(fG1, 3*subgroup[0]/4, 30, "Incidence angle:", 0., numform, "center")) |
626 | if(rotPos->TGLabelNEntry(fG1, 3*subgroup[0]/4, 30, "Incidence angle:", 0., numform, "center")) |
623 | fG1->AddFrame(rotPos->outsidebox, f1expandXpad); |
627 | fG1->AddFrame(rotPos->outsidebox, f1expandXpad); |
624 | 628 | ||
625 | // Set, get, home and reset rotation buttons |
629 | // Set, get, home and reset rotation buttons |
626 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *rotButtons -> 4 buttons (set rotation, read current rotation, home the motor and reset controller)\n"); |
630 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *rotButtons -> 4 buttons (set rotation, read current rotation, home the motor and reset controller)\n"); |
627 | rotButtons = new TSubStructure(); |
631 | rotButtons = new TSubStructure(); |
628 | selnames[0] = "Set"; selnames[1] = "Get"; selnames[2] = "Home"; selnames[3] = "Reset"; |
632 | selnames[0] = "Set"; selnames[1] = "Get"; selnames[2] = "Home"; selnames[3] = "Reset"; |
629 | if(rotButtons->TGMultiButton(fG1, 3*subgroup[0]/4, 30, 4, selnames, "center")) |
633 | if(rotButtons->TGMultiButton(fG1, 3*subgroup[0]/4, 30, 4, selnames, "center")) |
630 | fG1->AddFrame(rotButtons->outsidebox, f1expandXpad); |
634 | fG1->AddFrame(rotButtons->outsidebox, f1expandXpad); |
631 | 635 | ||
632 | // Rotation scan controls |
636 | // Rotation scan controls |
633 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *rotPosMin -> Number entry for starting angle\n"); |
637 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *rotPosMin -> Number entry for starting angle\n"); |
634 | rotPosMin = new TSubStructure(); |
638 | rotPosMin = new TSubStructure(); |
635 | if(rotPosMin->TGLabelNEntry(fG1, 3*subgroup[0]/4, 30, "Angle (min):", 0.0, numform, "center")) |
639 | if(rotPosMin->TGLabelNEntry(fG1, 3*subgroup[0]/4, 30, "Angle (min):", 0.0, numform, "center")) |
636 | fG1->AddFrame(rotPosMin->outsidebox, f1expandXpad); |
640 | fG1->AddFrame(rotPosMin->outsidebox, f1expandXpad); |
637 | 641 | ||
638 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *rotPosMax -> Number entry for finishing angle\n"); |
642 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *rotPosMax -> Number entry for finishing angle\n"); |
639 | rotPosMax = new TSubStructure(); |
643 | rotPosMax = new TSubStructure(); |
640 | if(rotPosMax->TGLabelNEntry(fG1, 3*subgroup[0]/4, 30, "Angle (max):", 0.0, numform, "center")) |
644 | if(rotPosMax->TGLabelNEntry(fG1, 3*subgroup[0]/4, 30, "Angle (max):", 0.0, numform, "center")) |
641 | fG1->AddFrame(rotPosMax->outsidebox, f1expandXpad); |
645 | fG1->AddFrame(rotPosMax->outsidebox, f1expandXpad); |
642 | 646 | ||
643 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *rotPosStep -> Number entry for angle step\n"); |
647 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *rotPosStep -> Number entry for angle step\n"); |
644 | rotPosStep = new TSubStructure(); |
648 | rotPosStep = new TSubStructure(); |
645 | for(int i = 0; i < 6; i++) numform[i] = 0; |
649 | for(int i = 0; i < 6; i++) numform[i] = 0; |
646 | numform[0] = 7; numform[1] = 1; |
650 | numform[0] = 7; numform[1] = 1; |
647 | if(rotPosStep->TGLabelNEntry(fG1, 3*subgroup[0]/4, 30, "Angle (step):", 0.0, numform, "center")) |
651 | if(rotPosStep->TGLabelNEntry(fG1, 3*subgroup[0]/4, 30, "Angle (step):", 0.0, numform, "center")) |
648 | fG1->AddFrame(rotPosStep->outsidebox, f1expandXpad); |
652 | fG1->AddFrame(rotPosStep->outsidebox, f1expandXpad); |
649 | 653 | ||
650 | fV1->AddFrame(fG1, f1expand2d); |
654 | fV1->AddFrame(fG1, f1expand2d); |
651 | // Right pane (Incidence angle controls) |
655 | // Right pane (Incidence angle controls) |
652 | fH1->AddFrame(fV1, f0leftX); |
656 | fH1->AddFrame(fV1, f0leftX); |
653 | 657 | ||
654 | fT1->AddFrame(fH1, f1expand2d); |
658 | fT1->AddFrame(fH1, f1expand2d); |
655 | 659 | ||
656 | // Waveform tab |
660 | // Waveform tab |
657 | //TODO |
661 | //TODO |
658 | measLayout[2]->AddFrame(setTab, f0leftX); |
662 | measLayout[2]->AddFrame(setTab, f0leftX); |
659 | 663 | ||
660 | // Bottom pane (File controls) |
664 | // Bottom pane (File controls) |
661 | subgroup[0] = measLayout[2]->GetWidth()-19; |
665 | subgroup[0] = measLayout[2]->GetWidth()-19; |
662 | subgroup[1] = (measLayout[2]->GetHeight())/4-4; |
666 | subgroup[1] = (measLayout[2]->GetHeight())/4-4; |
663 | fH1 = new TGCompositeFrame(measLayout[2], subgroup[0], subgroup[1], kFixedWidth | kFixedHeight | kHorizontalFrame); |
667 | fH1 = new TGCompositeFrame(measLayout[2], subgroup[0], subgroup[1], kFixedWidth | kFixedHeight | kHorizontalFrame); |
664 | fG1 = new TGGroupFrame(fH1, "Event/Data file controls"); |
668 | fG1 = new TGGroupFrame(fH1, "Event/Data file controls"); |
665 | 669 | ||
666 | // Number of events |
670 | // Number of events |
667 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *evtNum -> Number entry for set number of events to acquire\n"); |
671 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *evtNum -> Number entry for set number of events to acquire\n"); |
668 | evtNum = new TSubStructure(); |
672 | evtNum = new TSubStructure(); |
669 | for(int i = 0; i < 6; i++) numform[i] = 0; |
673 | for(int i = 0; i < 6; i++) numform[i] = 0; |
670 | numform[0] = 8; numform[2] = 1; |
674 | numform[0] = 8; numform[2] = 1; |
671 | if(evtNum->TGLabelNEntry(fG1, 3*subgroup[0]/4, 30, "Number of events:", 10000, numform, "left")) |
675 | if(evtNum->TGLabelNEntry(fG1, 3*subgroup[0]/4, 30, "Number of events:", 10000, numform, "left")) |
672 | fG1->AddFrame(evtNum->outsidebox, f0leftXpad); |
676 | fG1->AddFrame(evtNum->outsidebox, f0leftXpad); |
673 | 677 | ||
674 | // Time stamp display |
678 | // Time stamp display |
675 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *timeStamp -> Text entry for timestamp\n"); |
679 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *timeStamp -> Text entry for timestamp\n"); |
676 | timeStamp = new TSubStructure(); |
680 | timeStamp = new TSubStructure(); |
677 | if(timeStamp->TGLabelTEntry(fG1, 3*subgroup[0]/4, 30, "Time stamp:", "", "oneline")) |
681 | if(timeStamp->TGLabelTEntry(fG1, 3*subgroup[0]/4, 30, "Time stamp:", "", "oneline")) |
678 | { |
682 | { |
679 | timeStamp->widgetTE->SetState(kFALSE); |
683 | timeStamp->widgetTE->SetState(kFALSE); |
680 | fG1->AddFrame(timeStamp->outsidebox, f1expandXpad); |
684 | fG1->AddFrame(timeStamp->outsidebox, f1expandXpad); |
681 | } |
685 | } |
682 | 686 | ||
683 | // Save to file |
687 | // Save to file |
684 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *fileName -> Text entry for timestamp\n"); |
688 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *fileName -> Text entry for timestamp\n"); |
685 | fileName = new TSubStructure(); |
689 | fileName = new TSubStructure(); |
686 | char *cTemp; |
690 | char *cTemp; |
687 | cTemp = new char[256]; |
691 | cTemp = new char[256]; |
688 | sprintf(cTemp, "%s/results/test%s", rootdir, histext); |
692 | sprintf(cTemp, "%s/results/test%s", rootdir, histext); |
689 | if(fileName->TGLabelTEntryButton(fG1, 3*subgroup[0]/4, 30, "Save to file:", cTemp, "...", "oneline")) |
693 | if(fileName->TGLabelTEntryButton(fG1, 3*subgroup[0]/4, 30, "Save to file:", cTemp, "...", "oneline")) |
690 | { |
694 | { |
691 | fileName->widgetTE->SetState(kFALSE); |
695 | fileName->widgetTE->SetState(kFALSE); |
692 | fG1->AddFrame(fileName->outsidebox, f1expandXpad); |
696 | fG1->AddFrame(fileName->outsidebox, f1expandXpad); |
693 | } |
697 | } |
694 | 698 | ||
695 | fH1->AddFrame(fG1, new TGLayoutHints(kLHintsExpandX,8,2,2,2)); |
699 | fH1->AddFrame(fG1, new TGLayoutHints(kLHintsExpandX,8,2,2,2)); |
696 | // Bottom pane (File controls) |
700 | // Bottom pane (File controls) |
697 | measLayout[2]->AddFrame(fH1, f0leftX); |
701 | measLayout[2]->AddFrame(fH1, f0leftX); |
698 | 702 | ||
699 | // Start acquisition and progress bar |
703 | // Start acquisition and progress bar |
700 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *measProgress -> Button to start acquiring data and horizontal progress bar\n"); |
704 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *measProgress -> Button to start acquiring data and horizontal progress bar\n"); |
701 | measProgress = new TSubStructure(); |
705 | measProgress = new TSubStructure(); |
702 | if(measProgress->TGButtonProgressTEntry(measLayout[2], 3*subgroup[0]/4, 30, "Start acquisition", "Estimated end time: ")) |
706 | if(measProgress->TGButtonProgressTEntry(measLayout[2], 3*subgroup[0]/4, 30, "Start acquisition", "Estimated end time: ")) |
703 | { |
707 | { |
704 | measProgress->widgetTE->SetState(kFALSE); |
708 | measProgress->widgetTE->SetState(kFALSE); |
705 | measLayout[2]->AddFrame(measProgress->outsidebox, f1expandXpad); |
709 | measLayout[2]->AddFrame(measProgress->outsidebox, f1expandXpad); |
706 | } |
710 | } |
707 | 711 | ||
708 | // Actions for Main window //TODO |
712 | // Actions for Main window //TODO |
709 | vOutOpt->widgetChBox[0]->Connect("Clicked()", "TGAppMainFrame", this, "NegativePolarity()"); |
713 | vOutOpt->widgetChBox[0]->Connect("Clicked()", "TGAppMainFrame", this, "NegativePolarity()"); |
710 | vOutButtons->widgetTB[0]->Connect("Clicked()", "TGAppMainFrame", this, "VoltOut(=0)"); |
714 | vOutButtons->widgetTB[0]->Connect("Clicked()", "TGAppMainFrame", this, "VoltOut(=0)"); |
711 | vOutButtons->widgetTB[1]->Connect("Clicked()", "TGAppMainFrame", this, "VoltOut(=1)"); |
715 | vOutButtons->widgetTB[1]->Connect("Clicked()", "TGAppMainFrame", this, "VoltOut(=1)"); |
712 | vOutButtons->widgetTB[2]->Connect("Clicked()", "TGAppMainFrame", this, "VoltOut(=2)"); |
716 | vOutButtons->widgetTB[2]->Connect("Clicked()", "TGAppMainFrame", this, "VoltOut(=2)"); |
713 | posButtons->widgetTB[0]->Connect("Clicked()", "TGAppMainFrame", this, "PositionSet(=0)"); |
717 | posButtons->widgetTB[0]->Connect("Clicked()", "TGAppMainFrame", this, "PositionSet(=0)"); |
714 | posButtons->widgetTB[1]->Connect("Clicked()", "TGAppMainFrame", this, "PositionSet(=1)"); |
718 | posButtons->widgetTB[1]->Connect("Clicked()", "TGAppMainFrame", this, "PositionSet(=1)"); |
715 | posButtons->widgetTB[2]->Connect("Clicked()", "TGAppMainFrame", this, "PositionSet(=2)"); |
719 | posButtons->widgetTB[2]->Connect("Clicked()", "TGAppMainFrame", this, "PositionSet(=2)"); |
716 | posButtons->widgetTB[3]->Connect("Clicked()", "TGAppMainFrame", this, "PositionSet(=3)"); |
720 | posButtons->widgetTB[3]->Connect("Clicked()", "TGAppMainFrame", this, "PositionSet(=3)"); |
717 | rotButtons->widgetTB[0]->Connect("Clicked()", "TGAppMainFrame", this, "RotationSet(=0)"); |
721 | rotButtons->widgetTB[0]->Connect("Clicked()", "TGAppMainFrame", this, "RotationSet(=0)"); |
718 | rotButtons->widgetTB[1]->Connect("Clicked()", "TGAppMainFrame", this, "RotationSet(=1)"); |
722 | rotButtons->widgetTB[1]->Connect("Clicked()", "TGAppMainFrame", this, "RotationSet(=1)"); |
719 | rotButtons->widgetTB[2]->Connect("Clicked()", "TGAppMainFrame", this, "RotationSet(=2)"); |
723 | rotButtons->widgetTB[2]->Connect("Clicked()", "TGAppMainFrame", this, "RotationSet(=2)"); |
720 | rotButtons->widgetTB[3]->Connect("Clicked()", "TGAppMainFrame", this, "RotationSet(=3)"); |
724 | rotButtons->widgetTB[3]->Connect("Clicked()", "TGAppMainFrame", this, "RotationSet(=3)"); |
721 | fileName->widgetTB[0]->Connect("Clicked()", "TGAppMainFrame", this, "SaveFile()"); |
725 | fileName->widgetTB[0]->Connect("Clicked()", "TGAppMainFrame", this, "SaveFile()"); |
722 | measProgress->widgetTB[0]->Connect("Clicked()", "TGAppMainFrame", this, "StartAcq()"); |
726 | measProgress->widgetTB[0]->Connect("Clicked()", "TGAppMainFrame", this, "StartAcq()"); |
723 | // TODO - Save file |
727 | // TODO - Save file |
724 | 728 | ||
725 | // Main window ----------------------------------------------------------------------------- |
729 | // Main window ----------------------------------------------------------------------------- |
726 | 730 | ||
727 | // Display pane ---------------------------------------------------------------------------- |
731 | // Display pane ---------------------------------------------------------------------------- |
728 | measCanvas = new TRootEmbeddedCanvas("measCanvas",measLayout[1],300,300); |
732 | measCanvas = new TRootEmbeddedCanvas("measCanvas",measLayout[1],300,300); |
729 | measLayout[1]->AddFrame(measCanvas, f1expand2d); |
733 | measLayout[1]->AddFrame(measCanvas, f1expand2d); |
730 | // Display pane ---------------------------------------------------------------------------- |
734 | // Display pane ---------------------------------------------------------------------------- |
731 | 735 | ||
732 | // Histogram file selection pane ----------------------------------------------------------- |
736 | // Histogram file selection pane ----------------------------------------------------------- |
733 | subgroup[0] = (analysisLayout[0]->GetWidth())-4; |
737 | subgroup[0] = (analysisLayout[0]->GetWidth())-4; |
734 | 738 | ||
735 | // Open browser for file selection |
739 | // Open browser for file selection |
736 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *selectDir -> Button to open histogram files\n"); |
740 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *selectDir -> Button to open histogram files\n"); |
737 | selectDir = new TSubStructure(); |
741 | selectDir = new TSubStructure(); |
738 | if(selectDir->TGLabelButton(analysisLayout[0], 3*subgroup[0]/4, 30, "File selection:", "...", "left")) |
742 | if(selectDir->TGLabelButton(analysisLayout[0], 3*subgroup[0]/4, 30, "File selection:", "...", "left")) |
739 | analysisLayout[0]->AddFrame(selectDir->outsidebox, f0leftXpad); |
743 | analysisLayout[0]->AddFrame(selectDir->outsidebox, f0leftXpad); |
740 | 744 | ||
741 | // List view of the opened files |
745 | // List view of the opened files |
742 | if(DBGSIG > 1) printf("AppLayout(): Creating TGListBox *fileList -> List box for opened histograms\n"); |
746 | if(DBGSIG > 1) printf("AppLayout(): Creating TGListBox *fileList -> List box for opened histograms\n"); |
743 | fileList = new TGListBox(analysisLayout[0],1); |
747 | fileList = new TGListBox(analysisLayout[0],1); |
744 | fileList->GetVScrollbar(); |
748 | fileList->GetVScrollbar(); |
745 | fileList->Resize(300, (3*analysisLayout[0]->GetHeight()/7)-10 ); |
749 | fileList->Resize(300, (3*analysisLayout[0]->GetHeight()/7)-10 ); |
746 | analysisLayout[0]->AddFrame(fileList, f1expandXpad); |
750 | analysisLayout[0]->AddFrame(fileList, f1expandXpad); |
747 | 751 | ||
748 | fH1 = new TGCompositeFrame(analysisLayout[0], subgroup[0], 30, kHorizontalFrame); |
752 | fH1 = new TGCompositeFrame(analysisLayout[0], subgroup[0], 30, kHorizontalFrame); |
749 | // Multiple file selection toggle |
753 | // Multiple file selection toggle |
750 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *multiSelect -> 2 check buttons (enable multiple select, select everything)\n"); |
754 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *multiSelect -> 2 check buttons (enable multiple select, select everything)\n"); |
751 | multiSelect = new TSubStructure(); |
755 | multiSelect = new TSubStructure(); |
752 | checksel = new int[2]; |
756 | checksel = new int[2]; |
753 | checksel[0] = 0; checksel[1] = 0; |
757 | checksel[0] = 0; checksel[1] = 0; |
754 | selnames[0] = "Multiple file select"; selnames[1] = "Select all listed files"; |
758 | selnames[0] = "Multiple file select"; selnames[1] = "Select all listed files"; |
755 | if(multiSelect->TGCheckList(fH1, subgroup[0]/2, 30, 2, selnames, checksel, "horizontal", "left")) |
759 | if(multiSelect->TGCheckList(fH1, subgroup[0]/2, 30, 2, selnames, checksel, "horizontal", "left")) |
756 | fH1->AddFrame(multiSelect->outsidebox, f0leftX); |
760 | fH1->AddFrame(multiSelect->outsidebox, f0leftX); |
757 | delete[] checksel; |
761 | delete[] checksel; |
758 | 762 | ||
759 | // Previous/next controls, clear list and edit header |
763 | // Previous/next controls, clear list and edit header |
760 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *fileListCtrl -> Multiple buttons for controlling and displaying the histograms in list box\n"); |
764 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *fileListCtrl -> Multiple buttons for controlling and displaying the histograms in list box\n"); |
761 | fileListCtrl = new TSubStructure(); |
765 | fileListCtrl = new TSubStructure(); |
762 | selnames[0] = "<<"; selnames[1] = ">>"; selnames[2] = "Edit header"; selnames[3] = "Clear list"; |
766 | selnames[0] = "<<"; selnames[1] = ">>"; selnames[2] = "Edit header"; selnames[3] = "Clear list"; |
763 | if(fileListCtrl->TGMultiButton(fH1, subgroup[0]/3, 30, 4, selnames, "right")) |
767 | if(fileListCtrl->TGMultiButton(fH1, subgroup[0]/3, 30, 4, selnames, "right")) |
764 | fH1->AddFrame(fileListCtrl->outsidebox, f0rightX); |
768 | fH1->AddFrame(fileListCtrl->outsidebox, f0rightX); |
765 | 769 | ||
766 | analysisLayout[0]->AddFrame(fH1, f1expandXpad); |
770 | analysisLayout[0]->AddFrame(fH1, f1expandXpad); |
767 | 771 | ||
768 | // Header information of opened file |
772 | // Header information of opened file |
769 | fG1 = new TGGroupFrame(analysisLayout[0], "Opened file header information"); |
773 | fG1 = new TGGroupFrame(analysisLayout[0], "Opened file header information"); |
770 | 774 | ||
771 | fH1 = new TGHorizontalFrame(fG1, subgroup[0], 30); |
775 | fH1 = new TGHorizontalFrame(fG1, subgroup[0], 30); |
772 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *dispTime -> Display text Entry for opened histogram (time stamp)\n"); |
776 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *dispTime -> Display text Entry for opened histogram (time stamp)\n"); |
773 | dispTime = new TSubStructure(); |
777 | dispTime = new TSubStructure(); |
774 | if(dispTime->TGLabelTEntry(fH1, 3*subgroup[0]/4-24, 30, "Time:", "", "oneline")) |
778 | if(dispTime->TGLabelTEntry(fH1, 3*subgroup[0]/4-24, 30, "Time:", "", "oneline")) |
775 | fH1->AddFrame(dispTime->outsidebox, f0leftXnoleft); |
779 | fH1->AddFrame(dispTime->outsidebox, f0leftXnoleft); |
776 | dispTime->widgetTE->SetState(kFALSE); |
780 | dispTime->widgetTE->SetState(kFALSE); |
777 | 781 | ||
778 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *dispBias -> Number entry for opened histogram (bias voltage)\n"); |
782 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *dispBias -> Number entry for opened histogram (bias voltage)\n"); |
779 | dispBias = new TSubStructure(); |
783 | dispBias = new TSubStructure(); |
780 | for(int i = 0; i < 6; i++) numform[i] = 0; |
784 | for(int i = 0; i < 6; i++) numform[i] = 0; |
781 | numform[0] = 7; numform[1] = 2; |
785 | numform[0] = 7; numform[1] = 2; |
782 | if(dispBias->TGLabelNEntry(fH1, subgroup[0]/4-24, 30, "Bias voltage:", 0.00, numform, "center")) |
786 | if(dispBias->TGLabelNEntry(fH1, subgroup[0]/4-24, 30, "Bias voltage:", 0.00, numform, "center")) |
783 | fH1->AddFrame(dispBias->outsidebox, f0leftX); |
787 | fH1->AddFrame(dispBias->outsidebox, f0leftX); |
784 | dispBias->widgetNE[0]->SetState(kFALSE); |
788 | dispBias->widgetNE[0]->SetState(kFALSE); |
785 | fG1->AddFrame(fH1, f0leftXpad); |
789 | fG1->AddFrame(fH1, f0leftXpad); |
786 | 790 | ||
787 | fH1 = new TGHorizontalFrame(fG1, subgroup[0], 30); |
791 | fH1 = new TGHorizontalFrame(fG1, subgroup[0], 30); |
788 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *dispPos -> Display text Entry for opened histogram (table position)\n"); |
792 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *dispPos -> Display text Entry for opened histogram (table position)\n"); |
789 | dispPos = new TSubStructure(); |
793 | dispPos = new TSubStructure(); |
790 | if(dispPos->TGLabelTEntry(fH1, subgroup[0]/2-12, 30, "Position:", "", "oneline")) |
794 | if(dispPos->TGLabelTEntry(fH1, subgroup[0]/2-12, 30, "Position:", "", "oneline")) |
791 | fH1->AddFrame(dispPos->outsidebox, f0leftXnoleft); |
795 | fH1->AddFrame(dispPos->outsidebox, f0leftXnoleft); |
792 | dispPos->widgetTE->SetState(kFALSE); |
796 | dispPos->widgetTE->SetState(kFALSE); |
793 | 797 | ||
794 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *dispTemp -> Number entry for opened histogram (temperature)\n"); |
798 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *dispTemp -> Number entry for opened histogram (temperature)\n"); |
795 | dispTemp = new TSubStructure(); |
799 | dispTemp = new TSubStructure(); |
796 | for(int i = 0; i < 6; i++) numform[i] = 0; |
800 | for(int i = 0; i < 6; i++) numform[i] = 0; |
797 | numform[0] = 6; numform[1] = 1; |
801 | numform[0] = 6; numform[1] = 1; |
798 | if(dispTemp->TGLabelNEntry(fH1, subgroup[0]/4-18, 30, "Temperature:", 0.0, numform, "center")) |
802 | if(dispTemp->TGLabelNEntry(fH1, subgroup[0]/4-18, 30, "Temperature:", 0.0, numform, "center")) |
799 | fH1->AddFrame(dispTemp->outsidebox, f0leftX); |
803 | fH1->AddFrame(dispTemp->outsidebox, f0leftX); |
800 | dispTemp->widgetNE[0]->SetState(kFALSE); |
804 | dispTemp->widgetNE[0]->SetState(kFALSE); |
801 | 805 | ||
802 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *dispAngle -> Number entry for opened histogram (incidence angle)\n"); |
806 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *dispAngle -> Number entry for opened histogram (incidence angle)\n"); |
803 | dispAngle = new TSubStructure(); |
807 | dispAngle = new TSubStructure(); |
804 | for(int i = 0; i < 6; i++) numform[i] = 0; |
808 | for(int i = 0; i < 6; i++) numform[i] = 0; |
805 | numform[0] = 7; numform[1] = 2; |
809 | numform[0] = 7; numform[1] = 2; |
806 | if(dispAngle->TGLabelNEntry(fH1, subgroup[0]/4-18, 30, "Angle:", 0.00, numform, "center")) |
810 | if(dispAngle->TGLabelNEntry(fH1, subgroup[0]/4-18, 30, "Angle:", 0.00, numform, "center")) |
807 | fH1->AddFrame(dispAngle->outsidebox, f0leftX); |
811 | fH1->AddFrame(dispAngle->outsidebox, f0leftX); |
808 | dispAngle->widgetNE[0]->SetState(kFALSE); |
812 | dispAngle->widgetNE[0]->SetState(kFALSE); |
809 | fG1->AddFrame(fH1, f0leftXpad); |
813 | fG1->AddFrame(fH1, f0leftXpad); |
810 | 814 | ||
811 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *dispLaser -> Display text Entry for opened histogram (laser and additional info)\n"); |
815 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *dispLaser -> Display text Entry for opened histogram (laser and additional info)\n"); |
812 | dispLaser = new TSubStructure(); |
816 | dispLaser = new TSubStructure(); |
813 | if(dispLaser->TGLabelTEntry(fG1, 3*subgroup[0]/4, 30, "Laser settings:", "", "oneline")) |
817 | if(dispLaser->TGLabelTEntry(fG1, 3*subgroup[0]/4, 30, "Laser settings:", "", "oneline")) |
814 | fG1->AddFrame(dispLaser->outsidebox, f1expandXpad); |
818 | fG1->AddFrame(dispLaser->outsidebox, f1expandXpad); |
815 | dispLaser->widgetTE->SetState(kFALSE); |
819 | dispLaser->widgetTE->SetState(kFALSE); |
816 | 820 | ||
817 | analysisLayout[0]->AddFrame(fG1, f1expandX); |
821 | analysisLayout[0]->AddFrame(fG1, f1expandX); |
818 | 822 | ||
819 | // Actions for histogram file selection pane |
823 | // Actions for histogram file selection pane |
820 | selectDir->widgetTB[0]->Connect("Clicked()", "TGAppMainFrame", this, "SelectDirectory()"); |
824 | selectDir->widgetTB[0]->Connect("Clicked()", "TGAppMainFrame", this, "SelectDirectory()"); |
821 | multiSelect->widgetChBox[0]->Connect("Clicked()", "TGAppMainFrame", this, "ListMultiSelect(=0)"); |
825 | multiSelect->widgetChBox[0]->Connect("Clicked()", "TGAppMainFrame", this, "ListMultiSelect(=0)"); |
822 | multiSelect->widgetChBox[1]->Connect("Clicked()", "TGAppMainFrame", this, "ListMultiSelect(=1)"); |
826 | multiSelect->widgetChBox[1]->Connect("Clicked()", "TGAppMainFrame", this, "ListMultiSelect(=1)"); |
823 | fileList->Connect("DoubleClicked(Int_t)", "TGAppMainFrame", this, "FileListNavigation(Int_t)"); |
827 | fileList->Connect("DoubleClicked(Int_t)", "TGAppMainFrame", this, "FileListNavigation(Int_t)"); |
824 | fileListCtrl->widgetTB[0]->Connect("Clicked()", "TGAppMainFrame", this, "FileListNavigation(=-2)"); |
828 | fileListCtrl->widgetTB[0]->Connect("Clicked()", "TGAppMainFrame", this, "FileListNavigation(=-2)"); |
825 | fileListCtrl->widgetTB[1]->Connect("Clicked()", "TGAppMainFrame", this, "FileListNavigation(=-3)"); |
829 | fileListCtrl->widgetTB[1]->Connect("Clicked()", "TGAppMainFrame", this, "FileListNavigation(=-3)"); |
826 | fileListCtrl->widgetTB[2]->Connect("Clicked()", "TGAppMainFrame", this, "HeaderEdit()"); |
830 | fileListCtrl->widgetTB[2]->Connect("Clicked()", "TGAppMainFrame", this, "HeaderEdit()"); |
827 | fileListCtrl->widgetTB[3]->Connect("Clicked()", "TGAppMainFrame", this, "ClearHistogramList()"); |
831 | fileListCtrl->widgetTB[3]->Connect("Clicked()", "TGAppMainFrame", this, "ClearHistogramList()"); |
828 | 832 | ||
829 | // Histogram file selection pane ----------------------------------------------------------- |
833 | // Histogram file selection pane ----------------------------------------------------------- |
830 | 834 | ||
831 | // Analysis pane --------------------------------------------------------------------------- |
835 | // Analysis pane --------------------------------------------------------------------------- |
832 | fH1 = new TGCompositeFrame(analysisLayout[1], analysisLayout[1]->GetWidth(), 30, kHorizontalFrame); |
836 | fH1 = new TGCompositeFrame(analysisLayout[1], analysisLayout[1]->GetWidth(), 30, kHorizontalFrame); |
833 | 837 | ||
834 | subgroup[0] = (analysisLayout[1]->GetWidth())/2-4; |
838 | subgroup[0] = (analysisLayout[1]->GetWidth())/2-4; |
835 | subgroup[1] = (analysisLayout[1]->GetHeight())-4; |
839 | subgroup[1] = (analysisLayout[1]->GetHeight())-4; |
836 | 840 | ||
837 | analTab = new TGTab(fH1, subgroup[0], subgroup[1]); |
841 | analTab = new TGTab(fH1, subgroup[0], subgroup[1]); |
838 | 842 | ||
839 | // Analysis tabs |
843 | // Analysis tabs |
840 | // Integrate spectrum tab |
844 | // Integrate spectrum tab |
841 | fT1 = analTab->AddTab("Integ. spectrum"); |
845 | fT1 = analTab->AddTab("Integ. spectrum"); |
842 | fV1 = new TGCompositeFrame(fT1, subgroup[0], subgroup[1], kVerticalFrame | kFixedWidth | kFixedHeight); |
846 | fV1 = new TGCompositeFrame(fT1, subgroup[0], subgroup[1], kVerticalFrame | kFixedWidth | kFixedHeight); |
843 | 847 | ||
844 | // Check buttons to toggle direction of integration and normalization |
848 | // Check buttons to toggle direction of integration and normalization |
845 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *intSpect -> 3 check buttons (direction of integration, normalization)\n"); |
849 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *intSpect -> 3 check buttons (direction of integration, normalization)\n"); |
846 | intSpect = new TSubStructure(); |
850 | intSpect = new TSubStructure(); |
847 | checksel = new int[3]; |
851 | checksel = new int[3]; |
848 | checksel[0] = 0; checksel[1] = 0; checksel[2] = 1; |
852 | checksel[0] = 0; checksel[1] = 0; checksel[2] = 1; |
849 | selnames[0] = "X direction (for edge scans)"; |
853 | selnames[0] = "X direction (for edge scans)"; |
850 | selnames[1] = "Y direction (for edge scans)"; |
854 | selnames[1] = "Y direction (for edge scans)"; |
851 | selnames[2] = "Normalize to number of events"; |
855 | selnames[2] = "Normalize to number of events"; |
852 | if(intSpect->TGCheckList(fV1, subgroup[0], 30, 3, selnames, checksel, "vertical", "center")) |
856 | if(intSpect->TGCheckList(fV1, subgroup[0], 30, 3, selnames, checksel, "vertical", "center")) |
853 | fV1->AddFrame(intSpect->outsidebox, f1expandXpad); |
857 | fV1->AddFrame(intSpect->outsidebox, f1expandXpad); |
854 | delete[] checksel; |
858 | delete[] checksel; |
855 | 859 | ||
856 | // Values for 2D plot pixel resolution |
860 | // Values for 2D plot pixel resolution |
857 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *resol2d -> Pixel resolution for 2D plots\n"); |
861 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *resol2d -> Pixel resolution for 2D plots\n"); |
858 | resol2d = new TSubStructure(); |
862 | resol2d = new TSubStructure(); |
859 | for(int i = 0; i < 6; i++) { numform[i] = 0; numform2[i] = 0; } |
863 | for(int i = 0; i < 6; i++) { numform[i] = 0; numform2[i] = 0; } |
860 | numform[0] = 5; numform2[0] = 5; numform[2] = 2; numform2[2] = 2; |
864 | numform[0] = 5; numform2[0] = 5; numform[2] = 2; numform2[2] = 2; |
861 | if(resol2d->TGLabelDoubleNEntry(fV1, subgroup[0], 30, "2D plot pixel resolution (X, Y):", 40, numform, 40, numform2, "center")) |
865 | if(resol2d->TGLabelDoubleNEntry(fV1, subgroup[0], 30, "2D plot pixel resolution (X, Y):", 40, numform, 40, numform2, "center")) |
862 | fV1->AddFrame(resol2d->outsidebox, f1expandX); |
866 | fV1->AddFrame(resol2d->outsidebox, f1expandX); |
863 | 867 | ||
864 | // Start integrating or set its defaults |
868 | // Start integrating or set its defaults |
865 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *intSpectButtons -> 2 buttons for integrating spectra\n"); |
869 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *intSpectButtons -> 2 buttons for integrating spectra\n"); |
866 | intSpectButtons = new TSubStructure(); |
870 | intSpectButtons = new TSubStructure(); |
867 | selnames[0] = "Start"; selnames[1] = "Start and edit"; selnames[2] = "Default values"; |
871 | selnames[0] = "Start"; selnames[1] = "Start and edit"; selnames[2] = "Default values"; |
868 | if(intSpectButtons->TGMultiButton(fV1, subgroup[0], 30, 3, selnames, "center")) |
872 | if(intSpectButtons->TGMultiButton(fV1, subgroup[0], 30, 3, selnames, "center")) |
869 | fV1->AddFrame(intSpectButtons->outsidebox, f1expandX); |
873 | fV1->AddFrame(intSpectButtons->outsidebox, f1expandX); |
870 | 874 | ||
871 | fT1->AddFrame(fV1, f1expandX); |
875 | fT1->AddFrame(fV1, f1expandX); |
872 | 876 | ||
873 | // Relative photon detection efficiency tab (PDE) |
877 | // Relative photon detection efficiency tab (PDE) |
874 | fT1 = analTab->AddTab("Relative PDE"); |
878 | fT1 = analTab->AddTab("Relative PDE"); |
875 | fV1 = new TGCompositeFrame(fT1, subgroup[0], subgroup[1], kVerticalFrame | kFixedWidth | kFixedHeight); |
879 | fV1 = new TGCompositeFrame(fT1, subgroup[0], subgroup[1], kVerticalFrame | kFixedWidth | kFixedHeight); |
876 | 880 | ||
877 | // Check button to toggle normalization |
881 | // Check button to toggle normalization |
878 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *relPde -> 2 check buttons (relative pde, normalization)\n"); |
882 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *relPde -> 2 check buttons (relative pde, normalization)\n"); |
879 | relPde = new TSubStructure(); |
883 | relPde = new TSubStructure(); |
880 | checksel = new int; |
884 | checksel = new int; |
881 | *checksel = 1; |
885 | *checksel = 1; |
882 | selnames[0] = "Normalize to number of events"; |
886 | selnames[0] = "Normalize to number of events"; |
883 | if(relPde->TGCheckList(fV1, subgroup[0], 30, 1, selnames, checksel, "vertical", "center")) |
887 | if(relPde->TGCheckList(fV1, subgroup[0], 30, 1, selnames, checksel, "vertical", "center")) |
884 | fV1->AddFrame(relPde->outsidebox, f1expandXpad); |
888 | fV1->AddFrame(relPde->outsidebox, f1expandXpad); |
885 | delete[] checksel; |
889 | delete[] checksel; |
886 | 890 | ||
887 | // Calculate relative PDE using the middle of the pedestal peak |
891 | // Calculate relative PDE using the middle of the pedestal peak |
888 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *midPeak -> Calculate the relative PDE, by setting the middle of the pedestal peak.\n"); |
892 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *midPeak -> Calculate the relative PDE, by setting the middle of the pedestal peak.\n"); |
889 | midPeak = new TSubStructure(); |
893 | midPeak = new TSubStructure(); |
890 | checksel = new int; |
894 | checksel = new int; |
891 | *checksel = 0; |
895 | *checksel = 0; |
892 | selnames[0] = "Pedestal entries end at middle of ped. peak"; |
896 | selnames[0] = "Pedestal entries end at middle of ped. peak"; |
893 | if(midPeak->TGCheckList(fV1, subgroup[0], 30, 1, selnames, checksel, "vertical", "center")) |
897 | if(midPeak->TGCheckList(fV1, subgroup[0], 30, 1, selnames, checksel, "vertical", "center")) |
894 | fV1->AddFrame(midPeak->outsidebox, f1expandX); |
898 | fV1->AddFrame(midPeak->outsidebox, f1expandX); |
895 | delete checksel; |
899 | delete checksel; |
896 | 900 | ||
897 | // Select the dark run |
901 | // Select the dark run |
898 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *darkRun -> Button to open histogram files of a dark run\n"); |
902 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *darkRun -> Button to open histogram files of a dark run\n"); |
899 | darkRun = new TSubStructure(); |
903 | darkRun = new TSubStructure(); |
900 | if(darkRun->TGLabelTEntryButton(fV1, 3*subgroup[0]/4, 30, "Select dark run histogram:", "", "...", "oneline")) |
904 | if(darkRun->TGLabelTEntryButton(fV1, 3*subgroup[0]/4, 30, "Select dark run histogram:", "", "...", "oneline")) |
901 | { |
905 | { |
902 | darkRun->widgetTE->SetState(kFALSE); |
906 | darkRun->widgetTE->SetState(kFALSE); |
903 | fV1->AddFrame(darkRun->outsidebox, f1expandXpad); |
907 | fV1->AddFrame(darkRun->outsidebox, f1expandXpad); |
904 | } |
908 | } |
905 | 909 | ||
906 | // Select the offset of 0 angle |
910 | // Select the offset of 0 angle |
907 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *zeroAngle -> Set the offset for 0 angle\n"); |
911 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *zeroAngle -> Set the offset for 0 angle\n"); |
908 | zeroAngle = new TSubStructure(); |
912 | zeroAngle = new TSubStructure(); |
909 | for(int i = 0; i < 6; i++) numform[i] = 0; |
913 | for(int i = 0; i < 6; i++) numform[i] = 0; |
910 | numform[0] = 6; numform[1] = 2; |
914 | numform[0] = 6; numform[1] = 2; |
911 | if(zeroAngle->TGLabelNEntry(fV1, 3*subgroup[0]/4, 30, "Offset to zero angle:", 0., numform, "center")) |
915 | if(zeroAngle->TGLabelNEntry(fV1, 3*subgroup[0]/4, 30, "Offset to zero angle:", 0., numform, "center")) |
912 | fV1->AddFrame(zeroAngle->outsidebox, f0centerX); |
916 | fV1->AddFrame(zeroAngle->outsidebox, f0centerX); |
913 | 917 | ||
914 | // Start calculating the PDE or set its defaults |
918 | // Start calculating the PDE or set its defaults |
915 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *relPdeButtons -> 2 buttons for calculating the relative PDE\n"); |
919 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *relPdeButtons -> 2 buttons for calculating the relative PDE\n"); |
916 | relPdeButtons = new TSubStructure(); |
920 | relPdeButtons = new TSubStructure(); |
917 | selnames[0] = "Start"; selnames[1] = "Start and edit"; selnames[2] = "Default values"; |
921 | selnames[0] = "Start"; selnames[1] = "Start and edit"; selnames[2] = "Default values"; |
918 | if(relPdeButtons->TGMultiButton(fV1, subgroup[0], 30, 3, selnames, "center")) |
922 | if(relPdeButtons->TGMultiButton(fV1, subgroup[0], 30, 3, selnames, "center")) |
919 | fV1->AddFrame(relPdeButtons->outsidebox, f1expandX); |
923 | fV1->AddFrame(relPdeButtons->outsidebox, f1expandX); |
920 | 924 | ||
921 | fT1->AddFrame(fV1, f1expandX); |
925 | fT1->AddFrame(fV1, f1expandX); |
922 | 926 | ||
923 | // Breaktown voltage tab |
927 | // Breaktown voltage tab |
924 | fT1 = analTab->AddTab("Breakdown voltage"); |
928 | fT1 = analTab->AddTab("Breakdown voltage"); |
925 | fV1 = new TGCompositeFrame(fT1, subgroup[0], subgroup[1], kVerticalFrame | kFixedWidth | kFixedHeight); |
929 | fV1 = new TGCompositeFrame(fT1, subgroup[0], subgroup[1], kVerticalFrame | kFixedWidth | kFixedHeight); |
926 | 930 | ||
927 | // Select the minumum number of peaks for fitting to be initiated |
931 | // Select the minumum number of peaks for fitting to be initiated |
928 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *minPeak -> Minimum number of peaks to fit for peak fitting\n"); |
932 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *minPeak -> Minimum number of peaks to fit for peak fitting\n"); |
929 | minPeak = new TSubStructure(); |
933 | minPeak = new TSubStructure(); |
930 | for(int i = 0; i < 6; i++) numform[i] = 0; |
934 | for(int i = 0; i < 6; i++) numform[i] = 0; |
931 | numform[0] = 4; numform[2] = 1; numform[3] = 2; numform[4] = 1; numform[5] = 20; |
935 | numform[0] = 4; numform[2] = 1; numform[3] = 2; numform[4] = 1; numform[5] = 20; |
932 | if(minPeak->TGLabelNEntry(fV1, subgroup[0], 30, "Min. nr. of peaks:", 2, numform, "center")) |
936 | if(minPeak->TGLabelNEntry(fV1, subgroup[0], 30, "Min. nr. of peaks:", 2, numform, "center")) |
933 | fV1->AddFrame(minPeak->outsidebox, f0centerX); |
937 | fV1->AddFrame(minPeak->outsidebox, f0centerX); |
934 | 938 | ||
935 | // Select which separation to use |
939 | // Select which separation to use |
936 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *peakSepCalc -> Make the separation between the selected peaks\n"); |
940 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *peakSepCalc -> Make the separation between the selected peaks\n"); |
937 | peakSepCalc = new TSubStructure(); |
941 | peakSepCalc = new TSubStructure(); |
938 | for(int i = 0; i < 6; i++) numform[i] = 0; |
942 | for(int i = 0; i < 6; i++) numform[i] = 0; |
939 | numform[0] = 4; numform[2] = 1; numform[3] = 2; numform[4] = 1; numform[5] = 3; |
943 | numform[0] = 4; numform[2] = 1; numform[3] = 2; numform[4] = 1; numform[5] = 3; |
940 | if(peakSepCalc->TGLabelNEntry(fV1, subgroup[0], 30, "Calculate peak separation between N pe and N+1 pe peaks:", 1, numform, "center")) |
944 | if(peakSepCalc->TGLabelNEntry(fV1, subgroup[0], 30, "Calculate peak separation between N pe and N+1 pe peaks:", 1, numform, "center")) |
941 | fV1->AddFrame(peakSepCalc->outsidebox, f0centerX); |
945 | fV1->AddFrame(peakSepCalc->outsidebox, f0centerX); |
942 | 946 | ||
943 | // Start calculating the breakdown voltage or set its defaults |
947 | // Start calculating the breakdown voltage or set its defaults |
944 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *brDownButtons -> 2 buttons for calculating the breakdown voltage\n"); |
948 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *brDownButtons -> 2 buttons for calculating the breakdown voltage\n"); |
945 | brDownButtons = new TSubStructure(); |
949 | brDownButtons = new TSubStructure(); |
946 | selnames[0] = "Start"; selnames[1] = "Start and edit"; selnames[2] = "Default values"; |
950 | selnames[0] = "Start"; selnames[1] = "Start and edit"; selnames[2] = "Default values"; |
947 | if(brDownButtons->TGMultiButton(fV1, subgroup[0], 30, 3, selnames, "center")) |
951 | if(brDownButtons->TGMultiButton(fV1, subgroup[0], 30, 3, selnames, "center")) |
948 | fV1->AddFrame(brDownButtons->outsidebox, f1expandX); |
952 | fV1->AddFrame(brDownButtons->outsidebox, f1expandX); |
949 | 953 | ||
950 | fT1->AddFrame(fV1, f1expandX); |
954 | fT1->AddFrame(fV1, f1expandX); |
951 | 955 | ||
952 | // Surface scan tab |
956 | // Surface scan tab |
953 | fT1 = analTab->AddTab("Surface scan"); |
957 | fT1 = analTab->AddTab("Surface scan"); |
954 | fV1 = new TGCompositeFrame(fT1, subgroup[0], subgroup[1], kVerticalFrame | kFixedWidth | kFixedHeight); |
958 | fV1 = new TGCompositeFrame(fT1, subgroup[0], subgroup[1], kVerticalFrame | kFixedWidth | kFixedHeight); |
955 | 959 | ||
956 | // Check button to toggle normalization |
960 | // Check button to toggle normalization |
957 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *surfScanOpt -> 2 check buttons (normalization, zero bottom-left corner)\n"); |
961 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *surfScanOpt -> 2 check buttons (normalization, zero bottom-left corner)\n"); |
958 | surfScanOpt = new TSubStructure(); |
962 | surfScanOpt = new TSubStructure(); |
959 | checksel = new int[2]; |
963 | checksel = new int[2]; |
960 | checksel[0] = 1; checksel[1] = 0; |
964 | checksel[0] = 1; checksel[1] = 0; |
961 | selnames[0] = "Normalize to number of events"; selnames[1] = "Zero the bottom left corner"; |
965 | selnames[0] = "Normalize to number of events"; selnames[1] = "Zero the bottom left corner"; |
962 | if(surfScanOpt->TGCheckList(fV1, subgroup[0], 30, 2, selnames, checksel, "vertical", "center")) |
966 | if(surfScanOpt->TGCheckList(fV1, subgroup[0], 30, 2, selnames, checksel, "vertical", "center")) |
963 | fV1->AddFrame(surfScanOpt->outsidebox, f1expandXpad); |
967 | fV1->AddFrame(surfScanOpt->outsidebox, f1expandXpad); |
964 | delete[] checksel; |
968 | delete[] checksel; |
965 | 969 | ||
966 | // Values for 2D plot pixel resolution |
970 | // Values for 2D plot pixel resolution |
967 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *resolSurf -> Pixel resolution for surface plots\n"); |
971 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *resolSurf -> Pixel resolution for surface plots\n"); |
968 | resolSurf = new TSubStructure(); |
972 | resolSurf = new TSubStructure(); |
969 | for(int i = 0; i < 6; i++) { numform[i] = 0; numform2[i] = 0; } |
973 | for(int i = 0; i < 6; i++) { numform[i] = 0; numform2[i] = 0; } |
970 | numform[0] = 5; numform2[0] = 5; numform[2] = 2; numform2[2] = 2; |
974 | numform[0] = 5; numform2[0] = 5; numform[2] = 2; numform2[2] = 2; |
971 | if(resolSurf->TGLabelDoubleNEntry(fV1, subgroup[0], 30, "Surface plot pixel resolution (X, Y):", 40, numform, 40, numform2, "center")) |
975 | if(resolSurf->TGLabelDoubleNEntry(fV1, subgroup[0], 30, "Surface plot pixel resolution (X, Y):", 40, numform, 40, numform2, "center")) |
972 | fV1->AddFrame(resolSurf->outsidebox, f1expandX); |
976 | fV1->AddFrame(resolSurf->outsidebox, f1expandX); |
973 | 977 | ||
974 | // Start calculating the breakdown voltage or set its defaults |
978 | // Start calculating the breakdown voltage or set its defaults |
975 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *surfButtons -> 2 buttons for calculating the surface scan\n"); |
979 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *surfButtons -> 2 buttons for calculating the surface scan\n"); |
976 | surfButtons = new TSubStructure(); |
980 | surfButtons = new TSubStructure(); |
977 | selnames[0] = "Start"; selnames[1] = "Start and edit"; selnames[2] = "Default values"; |
981 | selnames[0] = "Start"; selnames[1] = "Start and edit"; selnames[2] = "Default values"; |
978 | if(surfButtons->TGMultiButton(fV1, subgroup[0], 30, 3, selnames, "center")) |
982 | if(surfButtons->TGMultiButton(fV1, subgroup[0], 30, 3, selnames, "center")) |
979 | fV1->AddFrame(surfButtons->outsidebox, f1expandX); |
983 | fV1->AddFrame(surfButtons->outsidebox, f1expandX); |
980 | 984 | ||
981 | fT1->AddFrame(fV1, f1expandX); |
985 | fT1->AddFrame(fV1, f1expandX); |
982 | 986 | ||
983 | // Timing tab |
987 | // Timing tab |
984 | fT1 = analTab->AddTab("Timing"); |
988 | fT1 = analTab->AddTab("Timing"); |
985 | fV1 = new TGCompositeFrame(fT1, subgroup[0], subgroup[1], kVerticalFrame | kFixedWidth | kFixedHeight); |
989 | fV1 = new TGCompositeFrame(fT1, subgroup[0], subgroup[1], kVerticalFrame | kFixedWidth | kFixedHeight); |
986 | 990 | ||
987 | fT1->AddFrame(fV1, f1expandX); |
991 | fT1->AddFrame(fV1, f1expandX); |
988 | 992 | ||
989 | // Analysis tabs |
993 | // Analysis tabs |
990 | fH1->AddFrame(analTab, /*f1expandX*/f0leftX); |
994 | fH1->AddFrame(analTab, /*f1expandX*/f0leftX); |
991 | 995 | ||
992 | // Peak fitting settings |
996 | // Peak fitting settings |
993 | fV1 = new TGCompositeFrame(fH1, subgroup[0], 30, kVerticalFrame); |
997 | fV1 = new TGCompositeFrame(fH1, subgroup[0], 30, kVerticalFrame); |
994 | 998 | ||
995 | fH2 = new TGCompositeFrame(fV1, subgroup[0], 30, kHorizontalFrame); |
999 | fH2 = new TGCompositeFrame(fV1, subgroup[0], 30, kHorizontalFrame); |
996 | // Select the sigma for peak fitting |
1000 | // Select the sigma for peak fitting |
997 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *fitSigma -> Sigma for peak fitting\n"); |
1001 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *fitSigma -> Sigma for peak fitting\n"); |
998 | fitSigma = new TSubStructure(); |
1002 | fitSigma = new TSubStructure(); |
999 | for(int i = 0; i < 6; i++) numform[i] = 0; |
1003 | for(int i = 0; i < 6; i++) numform[i] = 0; |
1000 | numform[0] = 6; numform[1] = 3; numform[2] = 2; |
1004 | numform[0] = 6; numform[1] = 3; numform[2] = 2; |
1001 | if(fitSigma->TGLabelNEntry(fH2, subgroup[0]/2, 30, "Peak sigma:", 1.2, numform, "center")) |
1005 | if(fitSigma->TGLabelNEntry(fH2, subgroup[0]/2, 30, "Peak sigma:", 1.2, numform, "center")) |
1002 | fH2->AddFrame(fitSigma->outsidebox, f0centerX); |
1006 | fH2->AddFrame(fitSigma->outsidebox, f0centerX); |
1003 | // Select the signal to noise treshold for peak fitting |
1007 | // Select the signal to noise treshold for peak fitting |
1004 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *fitTresh -> S/N ratio for peak fitting\n"); |
1008 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *fitTresh -> S/N ratio for peak fitting\n"); |
1005 | fitTresh = new TSubStructure(); |
1009 | fitTresh = new TSubStructure(); |
1006 | for(int i = 0; i < 6; i++) numform[i] = 0; |
1010 | for(int i = 0; i < 6; i++) numform[i] = 0; |
1007 | numform[0] = 6; numform[1] = 3; numform[2] = 2; |
1011 | numform[0] = 6; numform[1] = 3; numform[2] = 2; |
1008 | if(fitTresh->TGLabelNEntry(fH2, subgroup[0]/2, 30, "S/N ratio:", 0.005, numform, "center")) |
1012 | if(fitTresh->TGLabelNEntry(fH2, subgroup[0]/2, 30, "S/N ratio:", 0.005, numform, "center")) |
1009 | fH2->AddFrame(fitTresh->outsidebox, f0centerX); |
1013 | fH2->AddFrame(fitTresh->outsidebox, f0centerX); |
1010 | fV1->AddFrame(fH2, f1expandXpad); |
1014 | fV1->AddFrame(fH2, f1expandXpad); |
1011 | 1015 | ||
1012 | // Select the background interpolation for peak fitting |
1016 | // Select the background interpolation for peak fitting |
1013 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *fitInter -> Background interpolation for peak fitting\n"); |
1017 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *fitInter -> Background interpolation for peak fitting\n"); |
1014 | fitInter = new TSubStructure(); |
1018 | fitInter = new TSubStructure(); |
1015 | for(int i = 0; i < 6; i++) numform[i] = 0; |
1019 | for(int i = 0; i < 6; i++) numform[i] = 0; |
1016 | numform[0] = 5; numform[2] = 1; |
1020 | numform[0] = 5; numform[2] = 1; |
1017 | if(fitInter->TGLabelNEntry(fV1, subgroup[0], 30, "Back. interpolation:", 7, numform, "center")) |
1021 | if(fitInter->TGLabelNEntry(fV1, subgroup[0], 30, "Back. interpolation:", 7, numform, "center")) |
1018 | fV1->AddFrame(fitInter->outsidebox, f0centerX); |
1022 | fV1->AddFrame(fitInter->outsidebox, f0centerX); |
1019 | 1023 | ||
1020 | // Select the ADC offset |
1024 | // Select the ADC offset |
1021 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *adcOffset -> Select the offset for all ADC spectra\n"); |
1025 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *adcOffset -> Select the offset for all ADC spectra\n"); |
1022 | adcOffset = new TSubStructure(); |
1026 | adcOffset = new TSubStructure(); |
1023 | for(int i = 0; i < 6; i++) numform[i] = 0; |
1027 | for(int i = 0; i < 6; i++) numform[i] = 0; |
1024 | numform[0] = 6; numform[1] = 2; |
1028 | numform[0] = 6; numform[1] = 2; |
1025 | if(adcOffset->TGLabelNEntry(fV1, subgroup[0], 30, "ADC spectrum offset:", 0.00, numform, "center")) |
1029 | if(adcOffset->TGLabelNEntry(fV1, subgroup[0], 30, "ADC spectrum offset:", 0.00, numform, "center")) |
1026 | fV1->AddFrame(adcOffset->outsidebox, f0centerX); |
1030 | fV1->AddFrame(adcOffset->outsidebox, f0centerX); |
1027 | 1031 | ||
1028 | // Select the acceptable error for peak fitting |
1032 | // Select the acceptable error for peak fitting |
1029 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *accError -> Acceptable peak fitting error for peak fitting\n"); |
1033 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *accError -> Acceptable peak fitting error for peak fitting\n"); |
1030 | accError = new TSubStructure(); |
1034 | accError = new TSubStructure(); |
1031 | for(int i = 0; i < 6; i++) numform[i] = 0; |
1035 | for(int i = 0; i < 6; i++) numform[i] = 0; |
1032 | numform[0] = 6; numform[1] = 2; numform[2] = 1; |
1036 | numform[0] = 6; numform[1] = 2; numform[2] = 1; |
1033 | if(accError->TGLabelNEntry(fV1, subgroup[0], 30, "Max. peak fit error:", 0.15, numform, "center")) |
1037 | if(accError->TGLabelNEntry(fV1, subgroup[0], 30, "Max. peak fit error:", 0.15, numform, "center")) |
1034 | fV1->AddFrame(accError->outsidebox, f0centerX); |
1038 | fV1->AddFrame(accError->outsidebox, f0centerX); |
1035 | 1039 | ||
1036 | // Select the pedestal lower limit for peak fitting |
1040 | // Select the pedestal lower limit for peak fitting |
1037 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *pedesLow -> Lower ADC limit of pedestal peak for peak fitting\n"); |
1041 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *pedesLow -> Lower ADC limit of pedestal peak for peak fitting\n"); |
1038 | pedesLow = new TSubStructure(); |
1042 | pedesLow = new TSubStructure(); |
1039 | for(int i = 0; i < 6; i++) numform[i] = 0; |
1043 | for(int i = 0; i < 6; i++) numform[i] = 0; |
1040 | numform[0] = 6; numform[1] = 1; numform[2] = 2; |
1044 | numform[0] = 6; numform[1] = 1; numform[2] = 2; |
1041 | if(pedesLow->TGLabelNEntry(fV1, subgroup[0], 30, "Pedestal low limit:", 0.0, numform, "center")) |
1045 | if(pedesLow->TGLabelNEntry(fV1, subgroup[0], 30, "Pedestal low limit:", 0.0, numform, "center")) |
1042 | fV1->AddFrame(pedesLow->outsidebox, f0centerX); |
1046 | fV1->AddFrame(pedesLow->outsidebox, f0centerX); |
1043 | 1047 | ||
1044 | // Check buttons to toggle subtracting the background and exporting the fitted spectra |
1048 | // Check buttons to toggle subtracting the background and exporting the fitted spectra |
1045 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *fitChecks -> 2 check buttons (substracting background, exporting fitted spectra)\n"); |
1049 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *fitChecks -> 2 check buttons (substracting background, exporting fitted spectra)\n"); |
1046 | fitChecks = new TSubStructure(); |
1050 | fitChecks = new TSubStructure(); |
1047 | checksel = new int[2]; |
1051 | checksel = new int[2]; |
1048 | checksel[0] = 1; checksel[1] = 0; |
1052 | checksel[0] = 1; checksel[1] = 0; |
1049 | selnames[0] = "Backround subtraction ON/OFF"; |
1053 | selnames[0] = "Backround subtraction ON/OFF"; |
1050 | selnames[1] = "Export fitted spectra ON/OFF"; |
1054 | selnames[1] = "Export fitted spectra ON/OFF"; |
1051 | if(fitChecks->TGCheckList(fV1, subgroup[0], 30, 2, selnames, checksel, "vertical", "center")) |
1055 | if(fitChecks->TGCheckList(fV1, subgroup[0], 30, 2, selnames, checksel, "vertical", "center")) |
1052 | fV1->AddFrame(fitChecks->outsidebox, f1expandXpad); |
1056 | fV1->AddFrame(fitChecks->outsidebox, f1expandXpad); |
1053 | delete[] checksel; |
1057 | delete[] checksel; |
1054 | 1058 | ||
1055 | // Analysis progress bar |
1059 | // Analysis progress bar |
1056 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *analysisProgress -> Horizontal progress bar for analysis\n"); |
1060 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *analysisProgress -> Horizontal progress bar for analysis\n"); |
1057 | analysisProgress = new TSubStructure(); |
1061 | analysisProgress = new TSubStructure(); |
1058 | if(analysisProgress->TGLabelProgress(fV1, subgroup[0], 30, "Current analysis:")) |
1062 | if(analysisProgress->TGLabelProgress(fV1, subgroup[0], 30, "Current analysis:")) |
1059 | fV1->AddFrame(analysisProgress->outsidebox, f1expandXpad); |
1063 | fV1->AddFrame(analysisProgress->outsidebox, f1expandXpad); |
1060 | 1064 | ||
1061 | fH1->AddFrame(fV1, f1expandX); |
1065 | fH1->AddFrame(fV1, f1expandX); |
1062 | 1066 | ||
1063 | analysisLayout[1]->AddFrame(fH1, f1expandXpad); |
1067 | analysisLayout[1]->AddFrame(fH1, f1expandXpad); |
1064 | 1068 | ||
1065 | // Actions for analysis pane |
1069 | // Actions for analysis pane |
1066 | intSpectButtons->widgetTB[0]->Connect("Clicked()", "TGAppMainFrame", this, "AnalysisHandle(=0)"); |
1070 | intSpectButtons->widgetTB[0]->Connect("Clicked()", "TGAppMainFrame", this, "AnalysisHandle(=0)"); |
1067 | intSpectButtons->widgetTB[1]->Connect("Clicked()", "TGAppMainFrame", this, "AnalysisHandle(=1)"); |
1071 | intSpectButtons->widgetTB[1]->Connect("Clicked()", "TGAppMainFrame", this, "AnalysisHandle(=1)"); |
1068 | intSpectButtons->widgetTB[2]->Connect("Clicked()", "TGAppMainFrame", this, "AnalysisDefaults()"); |
1072 | intSpectButtons->widgetTB[2]->Connect("Clicked()", "TGAppMainFrame", this, "AnalysisDefaults()"); |
1069 | 1073 | ||
1070 | relPdeButtons->widgetTB[0]->Connect("Clicked()", "TGAppMainFrame", this, "AnalysisHandle(=0)"); |
1074 | relPdeButtons->widgetTB[0]->Connect("Clicked()", "TGAppMainFrame", this, "AnalysisHandle(=0)"); |
1071 | relPdeButtons->widgetTB[1]->Connect("Clicked()", "TGAppMainFrame", this, "AnalysisHandle(=1)"); |
1075 | relPdeButtons->widgetTB[1]->Connect("Clicked()", "TGAppMainFrame", this, "AnalysisHandle(=1)"); |
1072 | relPdeButtons->widgetTB[2]->Connect("Clicked()", "TGAppMainFrame", this, "AnalysisDefaults()"); |
1076 | relPdeButtons->widgetTB[2]->Connect("Clicked()", "TGAppMainFrame", this, "AnalysisDefaults()"); |
1073 | darkRun->widgetTB[0]->Connect("Clicked()", "TGAppMainFrame", this, "SelectDarkHist()"); |
1077 | darkRun->widgetTB[0]->Connect("Clicked()", "TGAppMainFrame", this, "SelectDarkHist()"); |
1074 | 1078 | ||
1075 | brDownButtons->widgetTB[0]->Connect("Clicked()", "TGAppMainFrame", this, "AnalysisHandle(=0)"); |
1079 | brDownButtons->widgetTB[0]->Connect("Clicked()", "TGAppMainFrame", this, "AnalysisHandle(=0)"); |
1076 | brDownButtons->widgetTB[1]->Connect("Clicked()", "TGAppMainFrame", this, "AnalysisHandle(=1)"); |
1080 | brDownButtons->widgetTB[1]->Connect("Clicked()", "TGAppMainFrame", this, "AnalysisHandle(=1)"); |
1077 | brDownButtons->widgetTB[2]->Connect("Clicked()", "TGAppMainFrame", this, "AnalysisDefaults()"); |
1081 | brDownButtons->widgetTB[2]->Connect("Clicked()", "TGAppMainFrame", this, "AnalysisDefaults()"); |
1078 | 1082 | ||
1079 | surfButtons->widgetTB[0]->Connect("Clicked()", "TGAppMainFrame", this, "AnalysisHandle(=0)"); |
1083 | surfButtons->widgetTB[0]->Connect("Clicked()", "TGAppMainFrame", this, "AnalysisHandle(=0)"); |
1080 | surfButtons->widgetTB[1]->Connect("Clicked()", "TGAppMainFrame", this, "AnalysisHandle(=1)"); |
1084 | surfButtons->widgetTB[1]->Connect("Clicked()", "TGAppMainFrame", this, "AnalysisHandle(=1)"); |
1081 | surfButtons->widgetTB[2]->Connect("Clicked()", "TGAppMainFrame", this, "AnalysisDefaults()"); |
1085 | surfButtons->widgetTB[2]->Connect("Clicked()", "TGAppMainFrame", this, "AnalysisDefaults()"); |
1082 | // Analysis pane --------------------------------------------------------------------------- |
1086 | // Analysis pane --------------------------------------------------------------------------- |
1083 | 1087 | ||
1084 | // Histogram pane -------------------------------------------------------------------------- |
1088 | // Histogram pane -------------------------------------------------------------------------- |
1085 | analysisCanvas = new TRootEmbeddedCanvas("analysisCanvas",analysisLayout[2],300,300); |
1089 | analysisCanvas = new TRootEmbeddedCanvas("analysisCanvas",analysisLayout[2],300,300); |
1086 | analysisLayout[2]->AddFrame(analysisCanvas, f1expand2d); |
1090 | analysisLayout[2]->AddFrame(analysisCanvas, f1expand2d); |
1087 | analysisCanvas->GetCanvas()->SetGrid(); |
1091 | analysisCanvas->GetCanvas()->SetGrid(); |
1088 | // Histogram pane -------------------------------------------------------------------------- |
1092 | // Histogram pane -------------------------------------------------------------------------- |
1089 | 1093 | ||
1090 | // Histogram controls pane ----------------------------------------------------------------- |
1094 | // Histogram controls pane ----------------------------------------------------------------- |
1091 | subgroup[0] = (analysisLayout[3]->GetWidth())-4; |
1095 | subgroup[0] = (analysisLayout[3]->GetWidth())-4; |
1092 | 1096 | ||
1093 | // Control for histogram X range |
1097 | // Control for histogram X range |
1094 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *adcRange -> Range for ADC histogram\n"); |
1098 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *adcRange -> Range for ADC histogram\n"); |
1095 | adcRange = new TSubStructure(); |
1099 | adcRange = new TSubStructure(); |
1096 | for(int i = 0; i < 6; i++) { numform[i] = 0; numform2[i] = 0; } |
1100 | for(int i = 0; i < 6; i++) { numform[i] = 0; numform2[i] = 0; } |
1097 | numform[0] = 6; numform2[0] = 6; |
1101 | numform[0] = 6; numform2[0] = 6; |
1098 | if(adcRange->TGLabelDoubleNEntry(analysisLayout[3], subgroup[0], 30, "ADC range (min, max):", 0, numform, 0, numform2, "center")) |
1102 | if(adcRange->TGLabelDoubleNEntry(analysisLayout[3], subgroup[0], 30, "ADC range (min, max):", 0, numform, 0, numform2, "center")) |
1099 | analysisLayout[3]->AddFrame(adcRange->outsidebox, f1expandXpad); |
1103 | analysisLayout[3]->AddFrame(adcRange->outsidebox, f1expandXpad); |
1100 | 1104 | ||
1101 | // TDC window for getting data |
1105 | // TDC window for getting data |
1102 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *tdcRange -> Range for TDC histogram\n"); |
1106 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *tdcRange -> Range for TDC histogram\n"); |
1103 | tdcRange = new TSubStructure(); |
1107 | tdcRange = new TSubStructure(); |
1104 | for(int i = 0; i < 6; i++) { numform[i] = 0; numform2[i] = 0; } |
1108 | for(int i = 0; i < 6; i++) { numform[i] = 0; numform2[i] = 0; } |
1105 | numform[0] = 8; numform[1] = 2; numform2[0] = 8; numform2[1] = 2; |
1109 | numform[0] = 8; numform[1] = 2; numform2[0] = 8; numform2[1] = 2; |
1106 | if(tdcRange->TGLabelDoubleNEntry(analysisLayout[3], subgroup[0], 30, "TDC range (min, max):", -0.5, numform, 221.8, numform2, "center")) |
1110 | if(tdcRange->TGLabelDoubleNEntry(analysisLayout[3], subgroup[0], 30, "TDC range (min, max):", -0.5, numform, 221.8, numform2, "center")) |
1107 | analysisLayout[3]->AddFrame(tdcRange->outsidebox, f1expandXpad); |
1111 | analysisLayout[3]->AddFrame(tdcRange->outsidebox, f1expandXpad); |
1108 | 1112 | ||
1109 | // Y axis range settings |
1113 | // Y axis range settings |
1110 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *yRange -> Y axis range\n"); |
1114 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *yRange -> Y axis range\n"); |
1111 | yRange = new TSubStructure(); |
1115 | yRange = new TSubStructure(); |
1112 | for(int i = 0; i < 6; i++) { numform[i] = 0; numform2[i] = 0; } |
1116 | for(int i = 0; i < 6; i++) { numform[i] = 0; numform2[i] = 0; } |
1113 | numform[0] = 8; numform[1] = 1; numform2[0] = 8; numform2[1] = 1; |
1117 | numform[0] = 8; numform[1] = 1; numform2[0] = 8; numform2[1] = 1; |
1114 | if(yRange->TGLabelDoubleNEntry(analysisLayout[3], subgroup[0], 30, "Y range (min, max):", 0, numform, 0, numform2, "center")) |
1118 | if(yRange->TGLabelDoubleNEntry(analysisLayout[3], subgroup[0], 30, "Y range (min, max):", 0, numform, 0, numform2, "center")) |
1115 | analysisLayout[3]->AddFrame(yRange->outsidebox, f1expandXpad); |
1119 | analysisLayout[3]->AddFrame(yRange->outsidebox, f1expandXpad); |
1116 | 1120 | ||
1117 | fH1 = new TGHorizontalFrame(analysisLayout[3], subgroup[0], 30); |
1121 | fH1 = new TGHorizontalFrame(analysisLayout[3], subgroup[0], 30); |
1118 | // Select the channel to display |
1122 | // Select the channel to display |
1119 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *selectCh -> Channel to display\n"); |
1123 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *selectCh -> Channel to display\n"); |
1120 | selectCh = new TSubStructure(); |
1124 | selectCh = new TSubStructure(); |
1121 | for(int i = 0; i < 6; i++) numform[i] = 0; |
1125 | for(int i = 0; i < 6; i++) numform[i] = 0; |
1122 | numform[0] = 3; numform[2] = 2; numform[3] = 2; numform[4] = 0; numform[5] = 7; // TODO - ko odprem file, nastavi zgornjo limito |
1126 | numform[0] = 3; numform[2] = 2; numform[3] = 2; numform[4] = 0; numform[5] = 7; // TODO - ko odprem file, nastavi zgornjo limito |
1123 | if(selectCh->TGLabelNEntry(fH1, subgroup[0]/2-24, 30, "Display channel:", 0, numform, "center")) |
1127 | if(selectCh->TGLabelNEntry(fH1, subgroup[0]/2-24, 30, "Display channel:", 0, numform, "center")) |
1124 | fH1->AddFrame(selectCh->outsidebox, f0leftX); |
1128 | fH1->AddFrame(selectCh->outsidebox, f0leftX); |
1125 | selChannel = -1; |
1129 | selChannel = -1; |
1126 | 1130 | ||
1127 | // Change plot type |
1131 | // Change plot type |
1128 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *plotType -> 3 buttons for selecting the plot type (ADC, TDC, ADC/TDC)\n"); |
1132 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *plotType -> 3 buttons for selecting the plot type (ADC, TDC, ADC/TDC)\n"); |
1129 | plotType = new TSubStructure(); |
1133 | plotType = new TSubStructure(); |
1130 | selnames[0] = "ADC"; selnames[1] = "TDC"; selnames[2] = "ADC/TDC"; |
1134 | selnames[0] = "ADC"; selnames[1] = "TDC"; selnames[2] = "ADC/TDC"; |
1131 | if(plotType->TGMultiButton(fH1, subgroup[0]/2-24, 30, 3, selnames, "center")) |
1135 | if(plotType->TGMultiButton(fH1, subgroup[0]/2-24, 30, 3, selnames, "center")) |
1132 | fH1->AddFrame(plotType->outsidebox, f1expandX); |
1136 | fH1->AddFrame(plotType->outsidebox, f1expandX); |
1133 | analysisLayout[3]->AddFrame(fH1, f1expandXpad); |
1137 | analysisLayout[3]->AddFrame(fH1, f1expandXpad); |
1134 | 1138 | ||
1135 | // Check button to toggle logarithmic scale |
1139 | // Check button to toggle logarithmic scale |
1136 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *histOpt -> 2 check buttons (histogram logarithmic scale, clean plots)\n"); |
1140 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *histOpt -> 2 check buttons (histogram logarithmic scale, clean plots)\n"); |
1137 | histOpt = new TSubStructure(); |
1141 | histOpt = new TSubStructure(); |
1138 | checksel = new int[2]; |
1142 | checksel = new int[2]; |
1139 | checksel[0] = 0; checksel[1] = 1; |
1143 | checksel[0] = 0; checksel[1] = 1; |
1140 | selnames[0] = "Logarithmic scale ON/OFF"; |
1144 | selnames[0] = "Logarithmic scale ON/OFF"; |
1141 | selnames[1] = "Clean plots ON/OFF"; |
1145 | selnames[1] = "Clean plots ON/OFF"; |
1142 | if(histOpt->TGCheckList(analysisLayout[3], subgroup[0], 30, 2, selnames, checksel, "vertical", "center")) |
1146 | if(histOpt->TGCheckList(analysisLayout[3], subgroup[0], 30, 2, selnames, checksel, "vertical", "center")) |
1143 | analysisLayout[3]->AddFrame(histOpt->outsidebox, f1expandXpad); |
1147 | analysisLayout[3]->AddFrame(histOpt->outsidebox, f1expandXpad); |
1144 | delete[] checksel; |
1148 | delete[] checksel; |
1145 | 1149 | ||
1146 | // Export the selected files |
1150 | // Export the selected files |
1147 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *exportHist -> Button to export current histogram\n"); |
1151 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *exportHist -> Button to export current histogram\n"); |
1148 | exportHist = new TSubStructure(); |
1152 | exportHist = new TSubStructure(); |
1149 | if(exportHist->TGLabelButton(analysisLayout[3], subgroup[0], 30, "Export selected histograms:", "Export", "center")) |
1153 | if(exportHist->TGLabelButton(analysisLayout[3], subgroup[0], 30, "Export selected histograms:", "Export", "center")) |
1150 | analysisLayout[3]->AddFrame(exportHist->outsidebox, f1expandXpad); |
1154 | analysisLayout[3]->AddFrame(exportHist->outsidebox, f1expandXpad); |
1151 | 1155 | ||
1152 | // Edit the selected histograms |
1156 | // Edit the selected histograms |
1153 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *editSelHist -> Button to additionally edit the selected histograms (make a canvas clone in a new tab)\n"); |
1157 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *editSelHist -> Button to additionally edit the selected histograms (make a canvas clone in a new tab)\n"); |
1154 | editSelHist = new TSubStructure(); |
1158 | editSelHist = new TSubStructure(); |
1155 | if(editSelHist->TGLabelButton(analysisLayout[3], subgroup[0], 30, "Edit selected histograms:", "Edit", "center")) |
1159 | if(editSelHist->TGLabelButton(analysisLayout[3], subgroup[0], 30, "Edit selected histograms:", "Edit", "center")) |
1156 | analysisLayout[3]->AddFrame(editSelHist->outsidebox, f1expandXpad); |
1160 | analysisLayout[3]->AddFrame(editSelHist->outsidebox, f1expandXpad); |
- | 1161 | ||
- | 1162 | // Select position units to use for ploting (micrometer, table position units) |
|
- | 1163 | if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *posUnitsPlot -> Dropdown menu for selecting the position units for ploting\n"); |
|
- | 1164 | posUnitsPlot = new TSubStructure(); |
|
- | 1165 | selnames[0] = "table units"; selnames[1] = "micrometers"; |
|
- | 1166 | sprintf(selected, "table units"); |
|
- | 1167 | if(posUnitsPlot->TGLabelDrop(analysisLayout[3], 2.*subgroup[0]/3., 30, "Position units for plots:", 2, selnames, selected)) |
|
- | 1168 | analysisLayout[3]->AddFrame(posUnitsPlot->outsidebox, f0centerX); |
|
1157 | 1169 | ||
1158 | // Actions for histogram controls pane //TODO |
1170 | // Actions for histogram controls pane //TODO |
1159 | for(int i = 0; i < 2; i++) |
1171 | for(int i = 0; i < 2; i++) |
1160 | { |
1172 | { |
1161 | adcRange->widgetNE[i]->Connect("ValueSet(Long_t)", "TGAppMainFrame", this, "UpdateHistogram(=0)"); |
1173 | adcRange->widgetNE[i]->Connect("ValueSet(Long_t)", "TGAppMainFrame", this, "UpdateHistogram(=0)"); |
1162 | // (adcRange->widgetNE[i]->GetNumberEntry())->Connect("ReturnPressed()", "TGAppMainFrame", this, "UpdateHistogram(=0)"); |
1174 | // (adcRange->widgetNE[i]->GetNumberEntry())->Connect("ReturnPressed()", "TGAppMainFrame", this, "UpdateHistogram(=0)"); |
1163 | tdcRange->widgetNE[i]->Connect("ValueSet(Long_t)", "TGAppMainFrame", this, "UpdateHistogram(=0)"); |
1175 | tdcRange->widgetNE[i]->Connect("ValueSet(Long_t)", "TGAppMainFrame", this, "UpdateHistogram(=0)"); |
1164 | // (tdcRange->widgetNE[i]->GetNumberEntry())->Connect("ReturnPressed()", "TGAppMainFrame", this, "UpdateHistogram(=0)"); |
1176 | // (tdcRange->widgetNE[i]->GetNumberEntry())->Connect("ReturnPressed()", "TGAppMainFrame", this, "UpdateHistogram(=0)"); |
1165 | yRange->widgetNE[i]->Connect("ValueSet(Long_t)", "TGAppMainFrame", this, "UpdateHistogram(=0)"); |
1177 | yRange->widgetNE[i]->Connect("ValueSet(Long_t)", "TGAppMainFrame", this, "UpdateHistogram(=0)"); |
1166 | // (yRange->widgetNE[i]->GetNumberEntry())->Connect("ReturnPressed()", "TGAppMainFrame", this, "UpdateHistogram(=0)"); |
1178 | // (yRange->widgetNE[i]->GetNumberEntry())->Connect("ReturnPressed()", "TGAppMainFrame", this, "UpdateHistogram(=0)"); |
1167 | } |
1179 | } |
1168 | plotType->widgetTB[0]->Connect("Clicked()", "TGAppMainFrame", this, "ChangeHisttype(=0)"); |
1180 | plotType->widgetTB[0]->Connect("Clicked()", "TGAppMainFrame", this, "ChangeHisttype(=0)"); |
1169 | plotType->widgetTB[1]->Connect("Clicked()", "TGAppMainFrame", this, "ChangeHisttype(=1)"); |
1181 | plotType->widgetTB[1]->Connect("Clicked()", "TGAppMainFrame", this, "ChangeHisttype(=1)"); |
1170 | plotType->widgetTB[2]->Connect("Clicked()", "TGAppMainFrame", this, "ChangeHisttype(=2)"); |
1182 | plotType->widgetTB[2]->Connect("Clicked()", "TGAppMainFrame", this, "ChangeHisttype(=2)"); |
1171 | selectCh->widgetNE[0]->Connect("ValueSet(Long_t)", "TGAppMainFrame", this, "UpdateHistogram(=2)"); |
1183 | selectCh->widgetNE[0]->Connect("ValueSet(Long_t)", "TGAppMainFrame", this, "UpdateHistogram(=2)"); |
1172 | selectCh->widgetNE[0]->Connect("ValueChanged(Long_t)", "TGAppMainFrame", this, "UpdateHistogram(=2)"); |
1184 | selectCh->widgetNE[0]->Connect("ValueChanged(Long_t)", "TGAppMainFrame", this, "UpdateHistogram(=2)"); |
1173 | (selectCh->widgetNE[0]->GetNumberEntry())->Connect("ReturnPressed()", "TGAppMainFrame", this, "UpdateHistogram(=2)" |