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