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