1 | /*
|
---|
2 | * QtGl.cpp
|
---|
3 | *
|
---|
4 | * Created on: Jul 19, 2011
|
---|
5 | * Author: lyard
|
---|
6 | */
|
---|
7 | //FIXME replace with FACT++ Time class
|
---|
8 | #include <boost/date_time/local_time/local_time.hpp>
|
---|
9 |
|
---|
10 |
|
---|
11 | #include "RawEventsViewer.h"
|
---|
12 | #include "viewer.h"
|
---|
13 | #include <math.h>
|
---|
14 | #include <fstream>
|
---|
15 |
|
---|
16 | #ifdef LOAD_RAW
|
---|
17 | int16_t eventsData[NUM_STORED_EVENTS][ACTUAL_NUM_PIXELS][1024];
|
---|
18 | #include </home/lyard/Code/display.C>
|
---|
19 | #endif
|
---|
20 |
|
---|
21 | #define VALUES_SPAN 4096
|
---|
22 |
|
---|
23 | #include <QFileDialog>
|
---|
24 |
|
---|
25 | #include <qwt_plot_grid.h>
|
---|
26 | #include <qwt_symbol.h>
|
---|
27 |
|
---|
28 | #include "src/Configuration.h"
|
---|
29 | #include "externals/fits.h"
|
---|
30 |
|
---|
31 |
|
---|
32 | using namespace std;
|
---|
33 |
|
---|
34 | #undef ACTUAL_NUM_PIXELS
|
---|
35 | #define ACTUAL_NUM_PIXELS 1440
|
---|
36 |
|
---|
37 | //bounding box for diplaying the impulse curve
|
---|
38 | float bboxMin[2] = {-0.8,-0.9};
|
---|
39 | float bboxMax[2] = {0.8,-0.3};
|
---|
40 | /************************************************************
|
---|
41 | * CALC BLUR COLOR if in blur display mode, calculate the interpolated
|
---|
42 | * colour for a given vertex
|
---|
43 | ************************************************************/
|
---|
44 | void RawDataViewer::calcBlurColor(int pixel, int vertex)
|
---|
45 | {
|
---|
46 | GLfloat color[3];
|
---|
47 | int first, second;
|
---|
48 | first = vertex-1;
|
---|
49 | second = vertex;
|
---|
50 | if (first < 0)
|
---|
51 | first = 5;
|
---|
52 | first = neighbors[pixel][first];
|
---|
53 | second = neighbors[pixel][second];
|
---|
54 | for (int i=0;i<3;i++)
|
---|
55 | color[i] = pixelsColor[pixel][i];
|
---|
56 | float divide = 1;
|
---|
57 | if (first != -1)
|
---|
58 | {
|
---|
59 | divide++;
|
---|
60 | for (int i=0;i<3;i++)
|
---|
61 | color[i] += pixelsColor[first][i];
|
---|
62 | }
|
---|
63 | if (second != -1)
|
---|
64 | {
|
---|
65 | divide++;
|
---|
66 | for (int i=0;i<3;i++)
|
---|
67 | color[i] += pixelsColor[second][i];
|
---|
68 | }
|
---|
69 | for (int i=0;i<3;i++)
|
---|
70 | color[i] /= divide;
|
---|
71 | glColor3fv(color);
|
---|
72 | }
|
---|
73 | /************************************************************
|
---|
74 | * DRAW BLURRY HEXAGON. draws a solid hexagon, with interpolated colours
|
---|
75 | ************************************************************/
|
---|
76 | void RawDataViewer::drawBlurryHexagon(int index)
|
---|
77 | {
|
---|
78 | GLfloat color[3];
|
---|
79 | for (int i=0;i<3;i++)
|
---|
80 | color[i] = pixelsColor[index][i];
|
---|
81 | glBegin(GL_TRIANGLES);
|
---|
82 | calcBlurColor(index, 0);
|
---|
83 | glVertex2fv(verticesList[verticesIndices[index][0]]);
|
---|
84 | glColor3fv(color);
|
---|
85 | glVertex2fv(pixelsCoords[index]);
|
---|
86 | calcBlurColor(index, 1);
|
---|
87 | glVertex2fv(verticesList[verticesIndices[index][1]]);
|
---|
88 |
|
---|
89 | glVertex2fv(verticesList[verticesIndices[index][1]]);
|
---|
90 | glColor3fv(color);
|
---|
91 | glVertex2fv(pixelsCoords[index]);
|
---|
92 | calcBlurColor(index, 2);
|
---|
93 | glVertex2fv(verticesList[verticesIndices[index][2]]);
|
---|
94 |
|
---|
95 | glVertex2fv(verticesList[verticesIndices[index][2]]);
|
---|
96 | glColor3fv(color);
|
---|
97 | glVertex2fv(pixelsCoords[index]);
|
---|
98 | calcBlurColor(index, 3);
|
---|
99 | glVertex2fv(verticesList[verticesIndices[index][3]]);
|
---|
100 |
|
---|
101 | glVertex2fv(verticesList[verticesIndices[index][3]]);
|
---|
102 | glColor3fv(color);
|
---|
103 | glVertex2fv(pixelsCoords[index]);
|
---|
104 | calcBlurColor(index, 4);
|
---|
105 | glVertex2fv(verticesList[verticesIndices[index][4]]);
|
---|
106 |
|
---|
107 | glVertex2fv(verticesList[verticesIndices[index][4]]);
|
---|
108 | glColor3fv(color);
|
---|
109 | glVertex2fv(pixelsCoords[index]);
|
---|
110 | calcBlurColor(index, 5);
|
---|
111 | glVertex2fv(verticesList[verticesIndices[index][5]]);
|
---|
112 |
|
---|
113 | glVertex2fv(verticesList[verticesIndices[index][5]]);
|
---|
114 | glColor3fv(color);
|
---|
115 | glVertex2fv(pixelsCoords[index]);
|
---|
116 | calcBlurColor(index, 0);
|
---|
117 | glVertex2fv(verticesList[verticesIndices[index][0]]);
|
---|
118 | glEnd();
|
---|
119 |
|
---|
120 | return;
|
---|
121 | }
|
---|
122 |
|
---|
123 | /************************************************************
|
---|
124 | * DRAW CAMERA draws all the camera pixels
|
---|
125 | ************************************************************/
|
---|
126 | void RawDataViewer::drawCamera(bool alsoWire)
|
---|
127 | {
|
---|
128 | glLoadIdentity();
|
---|
129 | if (!drawImpulse)
|
---|
130 | {
|
---|
131 | glTranslatef(0,-0.44,0);
|
---|
132 | glRotatef(cameraRotation, 0,0,-1);
|
---|
133 | if (cameraRotation == 90)
|
---|
134 | {
|
---|
135 | glTranslatef(-0.45,-0.45,0);
|
---|
136 | // cout << "correction" << endl;
|
---|
137 | }
|
---|
138 | if (cameraRotation == -90)
|
---|
139 | {
|
---|
140 | glTranslatef(0.45,-0.45,0);
|
---|
141 | }
|
---|
142 | glScalef(1.5,1.5,1);
|
---|
143 | }
|
---|
144 | else
|
---|
145 | {
|
---|
146 | glRotatef(cameraRotation, 0,0,-1);
|
---|
147 | if (cameraRotation == 90)
|
---|
148 | {
|
---|
149 | glTranslatef(-0.45/1.5,-0.45/1.5,0);
|
---|
150 | // cout << "correction" << endl;
|
---|
151 | }
|
---|
152 | if (cameraRotation == -90)
|
---|
153 | {
|
---|
154 | glTranslatef(0.45/1.5,-0.45/1.5,0);
|
---|
155 | }
|
---|
156 | }
|
---|
157 | glColor3f(0.5,0.5,0.5);
|
---|
158 | glLineWidth(1.0);
|
---|
159 | float color;
|
---|
160 | //cout << "Actual num pixels: " << ACTUAL_NUM_PIXELS << endl;
|
---|
161 | for (int i=0;i<ACTUAL_NUM_PIXELS;i++)
|
---|
162 | {
|
---|
163 | if (!nRoi)
|
---|
164 | color = (float)(i)/(float)(ACTUAL_NUM_PIXELS);
|
---|
165 | else
|
---|
166 | #ifdef LOAD_RAW
|
---|
167 | color = float(eventsData[eventNum][i][whichSlice]+(VALUES_SPAN/2))/(float)(VALUES_SPAN-1);
|
---|
168 | #else
|
---|
169 | color = float(eventData[nRoi*i + whichSlice]+(VALUES_SPAN/2))/(float)(VALUES_SPAN-1);
|
---|
170 | if (logScale)
|
---|
171 | {
|
---|
172 | color *= 9;
|
---|
173 | color += 1;
|
---|
174 | color = log10(color);
|
---|
175 | }
|
---|
176 | #endif
|
---|
177 | if (color < 0)
|
---|
178 | {
|
---|
179 | pixelsColor[i][0] = tooLowValueCoulour[0];
|
---|
180 | pixelsColor[i][1] = tooLowValueCoulour[1];
|
---|
181 | pixelsColor[i][2] = tooLowValueCoulour[2];
|
---|
182 | continue;
|
---|
183 | }
|
---|
184 | if (color > 1)
|
---|
185 | {
|
---|
186 | pixelsColor[i][0] = tooHighValueCoulour[0];
|
---|
187 | pixelsColor[i][1] = tooHighValueCoulour[1];
|
---|
188 | pixelsColor[i][2] = tooHighValueCoulour[2];
|
---|
189 | continue;
|
---|
190 | }
|
---|
191 | int index = 0;
|
---|
192 | while (ss[index] < color && index < 4)
|
---|
193 | index++;
|
---|
194 | index--;
|
---|
195 | if (index < 0) index = 0;
|
---|
196 | float weight0 = (color-ss[index]) / (ss[index+1]-ss[index]);
|
---|
197 | if (weight0 > 1.0f) weight0 = 1.0f;
|
---|
198 | if (weight0 < 0.0f) weight0 = 0.0f;
|
---|
199 | float weight1 = 1.0f-weight0;
|
---|
200 | pixelsColor[i][0] = weight1*rr[index] + weight0*rr[index+1];
|
---|
201 | pixelsColor[i][1] = weight1*gg[index] + weight0*gg[index+1];
|
---|
202 | pixelsColor[i][2] = weight1*bb[index] + weight0*bb[index+1];
|
---|
203 | }
|
---|
204 |
|
---|
205 | for (int i=0;i<ACTUAL_NUM_PIXELS;i++)
|
---|
206 | {
|
---|
207 | // if (i == 690 ||
|
---|
208 | // i == 70)
|
---|
209 | // continue;
|
---|
210 | glColor3fv(pixelsColor[i]);
|
---|
211 | glLoadName(i);
|
---|
212 | if (drawBlur)
|
---|
213 | drawBlurryHexagon(i);
|
---|
214 | else
|
---|
215 | drawHexagon(i,true);
|
---|
216 |
|
---|
217 | }
|
---|
218 | if (!alsoWire)
|
---|
219 | return;
|
---|
220 | glTranslatef(0,0,0.1f);
|
---|
221 | glColor3f(0.0f,0.0f,0.0f);
|
---|
222 | for (int i=0;i<ACTUAL_NUM_PIXELS;i++)
|
---|
223 | {
|
---|
224 | // if (i == 690 ||
|
---|
225 | // i == 70)
|
---|
226 | // continue;
|
---|
227 | drawHexagon(i, false);
|
---|
228 | }
|
---|
229 |
|
---|
230 | }
|
---|
231 |
|
---|
232 | /************************************************************
|
---|
233 | * TRIM. FIXME this should not be here but taken from an existing class (somewhere)
|
---|
234 | ***********************************************************
|
---|
235 | string Trim(const string &str)
|
---|
236 | {
|
---|
237 | // Trim Both leading and trailing spaces
|
---|
238 | const size_t start = str.find_first_not_of(' '); // Find the first character position after excluding leading blank spaces
|
---|
239 | const size_t end = str.find_last_not_of(' '); // Find the first character position from reverse af
|
---|
240 |
|
---|
241 | // if all spaces or empty return an empty string
|
---|
242 | if (string::npos==start || string::npos==end)
|
---|
243 | return string();
|
---|
244 |
|
---|
245 | return str.substr(start, end-start+1);
|
---|
246 | }*/
|
---|
247 | /************************************************************
|
---|
248 | * DRAW PIXEL CURVE. draws the raw impulse curve of the currently selected pixel
|
---|
249 | ************************************************************/
|
---|
250 | void RawDataViewer::drawPixelCurve()
|
---|
251 | {
|
---|
252 | if (!nRoi)
|
---|
253 | return;
|
---|
254 |
|
---|
255 | float xZoom, yZoom;
|
---|
256 | xZoom = yZoom = 1.0f;
|
---|
257 |
|
---|
258 | glBegin(GL_LINES);
|
---|
259 | glLineWidth(1.0f);
|
---|
260 | glColor3f(0.5,0.5,0.5);
|
---|
261 | glVertex2f(bboxMin[0], bboxMin[1]);
|
---|
262 | glVertex2f(bboxMax[0], bboxMin[1]);
|
---|
263 | glVertex2f(bboxMin[0], bboxMin[1]);
|
---|
264 | glVertex2f(bboxMin[0], bboxMax[1]);
|
---|
265 | glVertex2f(bboxMin[0], (bboxMin[1]+bboxMax[1])/2.0f);
|
---|
266 | glVertex2f(bboxMax[0], (bboxMin[1]+bboxMax[1])/2.0f);
|
---|
267 | float xRange = bboxMax[0] - bboxMin[0];
|
---|
268 | float yRange = bboxMax[1] - bboxMin[1];
|
---|
269 | glColor3f(1.0,1.0,1.0);
|
---|
270 | float divideMe = (float)(VALUES_SPAN-1);
|
---|
271 | float plusMe = VALUES_SPAN/2;
|
---|
272 |
|
---|
273 | cout << "---> value span..." << endl;
|
---|
274 |
|
---|
275 | /*
|
---|
276 | if (drawCalibrationLoaded)
|
---|
277 | plusMe += 0;//VALUES_SPAN/2;
|
---|
278 | if (drawCalibrationLoaded && calibrationLoaded)
|
---|
279 | {
|
---|
280 | divideMe /=2;
|
---|
281 | plusMe = 0 ;///=2;
|
---|
282 | }*/
|
---|
283 |
|
---|
284 | for (int i=0;i<nRoi-1;i++)
|
---|
285 | {
|
---|
286 | #ifdef LOAD_RAW
|
---|
287 | glVertex2f(bboxMin[0] + xRange*i/(float)nRoi,
|
---|
288 | bboxMin[1] + yRange*(eventsData[eventNum][selectedPixel][i]+plusMe) /divideMe);
|
---|
289 | glVertex2f(bboxMin[0] + xRange*(i+1)/(float)nRoi,
|
---|
290 | bboxMin[1] + yRange*(eventsData[eventNum][selectedPixel][i+1]+plusMe) /divideMe);
|
---|
291 | #else
|
---|
292 |
|
---|
293 | float d1 = eventData[nRoi*selectedPixel + i]+plusMe;
|
---|
294 | float d2 = eventData[nRoi*selectedPixel + i+1]+plusMe;
|
---|
295 | if (!finite(d1)) d1 = 20000;
|
---|
296 | if (!finite(d2)) d2 = 20000;
|
---|
297 | glVertex2f(bboxMin[0] + xRange*i/(float)nRoi,
|
---|
298 | bboxMin[1] + yRange*(d1) /divideMe);
|
---|
299 | glVertex2f(bboxMin[0] + xRange*(i+1)/(float)nRoi,
|
---|
300 | bboxMin[1] + yRange*(d2) /divideMe);
|
---|
301 | #endif
|
---|
302 | }
|
---|
303 | glEnd();
|
---|
304 | glTranslatef(0,0,0.1f);
|
---|
305 | glBegin(GL_LINES);
|
---|
306 | glColor3f(1.0,0.0,0.0);
|
---|
307 | glVertex2f(bboxMin[0] + xRange*whichSlice/(float)nRoi,
|
---|
308 | bboxMin[1]);
|
---|
309 | glVertex2f(bboxMin[0] + xRange*whichSlice/(float)nRoi,
|
---|
310 | bboxMax[1]);
|
---|
311 |
|
---|
312 | /* glColor3f(0.f,0.5f,0.f);
|
---|
313 | for (int i=0;i<nRoi-1;i++)
|
---|
314 | {
|
---|
315 | glVertex2f(bboxMin[0] + xRange*i/(float)nRoi,
|
---|
316 | bboxMin[1] + yRange*(n1mean[ i]+plusMe) /divideMe);
|
---|
317 | glVertex2f(bboxMin[0] + xRange*(i+1)/(float)nRoi,
|
---|
318 | bboxMin[1] + yRange*(n1mean[i+1]+plusMe) /divideMe);
|
---|
319 | }
|
---|
320 | */
|
---|
321 | glEnd();
|
---|
322 | // glEnable(GL_MULTISAMPLE);
|
---|
323 | /* setFont(QFont("Times", 12));
|
---|
324 | qglColor(QColor(255,223,127));
|
---|
325 | float xShift = 0.10f;
|
---|
326 | float yShift = 0.01f;
|
---|
327 | renderText(bboxMin[0]-xShift/2.0f, bboxMax[1]+3*yShift, 0, QString("Volts"));
|
---|
328 | if (drawCalibrationLoaded)
|
---|
329 | {
|
---|
330 | renderText(bboxMin[0]-xShift, bboxMax[1]-yShift,0,QString("+2.10"));
|
---|
331 | renderText(bboxMin[0]-xShift, ((bboxMin[1]+bboxMax[1])/2.0f) - yShift, 0, QString("+1.05"));//((bboxMin[1]+bboxMax[1])/2.0f)
|
---|
332 | renderText(bboxMin[0]-xShift, bboxMin[1]-yShift, 0, QString("0.00"));
|
---|
333 | }
|
---|
334 | else
|
---|
335 | {
|
---|
336 | renderText(bboxMin[0]-xShift, bboxMax[1]-yShift,0,QString("+1.05"));
|
---|
337 | renderText(bboxMin[0]-xShift, ((bboxMin[1]+bboxMax[1])/2.0f) - yShift, 0, QString("+0.00"));//((bboxMin[1]+bboxMax[1])/2.0f)
|
---|
338 | renderText(bboxMin[0]-xShift, bboxMin[1]-yShift, 0, QString("-1.05"));
|
---|
339 | }
|
---|
340 | renderText(bboxMax[0]+xShift/2.0f, bboxMin[1]-4*yShift, 0, QString("Slices"));
|
---|
341 | renderText(bboxMin[0]-yShift/2.0f, bboxMin[1]-4*yShift, 0, QString("0"));
|
---|
342 | ostringstream str;
|
---|
343 | str << nRoi/2;
|
---|
344 | renderText(((bboxMin[0]+bboxMax[0])/2.0f)-xShift/2.0f, bboxMin[1]-4*yShift, 0, QString(str.str().c_str()));
|
---|
345 | str.str("");
|
---|
346 | str << nRoi;
|
---|
347 | renderText(bboxMax[0]-xShift/2.0f, bboxMin[1]-4*yShift, 0, QString(str.str().c_str()));
|
---|
348 | */
|
---|
349 | }
|
---|
350 | /************************************************************
|
---|
351 | * CONSTRUCTOR.
|
---|
352 | ************************************************************/
|
---|
353 | RawDataViewer::RawDataViewer(QWidget *cParent) : BasicGlCamera(cParent)
|
---|
354 | {
|
---|
355 | // setFormat(QGLFormat(QGL::DoubleBuffer));// | QGL::DepthBuffer));
|
---|
356 | whichSlice = 0;
|
---|
357 | #ifdef LOAD_RAW
|
---|
358 | nRoi = 1024;
|
---|
359 | #else
|
---|
360 | nRoi = 0;
|
---|
361 | #endif
|
---|
362 | eventNum = 0;
|
---|
363 | rowNum = -1;
|
---|
364 | eventStep = 1;
|
---|
365 | selectedPixel = 393;
|
---|
366 | inputFile = NULL;
|
---|
367 | eventData = NULL;
|
---|
368 | drawPatch = true;
|
---|
369 | drawImpulse = false;
|
---|
370 | drawBlur = false;
|
---|
371 | loopCurrentEvent = false;
|
---|
372 | SetAutoRefresh(true);
|
---|
373 | #ifdef LOAD_RAW
|
---|
374 | loadEvents("/scratch/00000043.001_T.bin");
|
---|
375 | #endif
|
---|
376 | PixelMap mypMap;
|
---|
377 | if (!mypMap.Read("FACTmapV5a.txt"))
|
---|
378 | {
|
---|
379 | cerr << "ERROR - Problems reading FACTmapV5a.txt" << endl;
|
---|
380 | exit(-1);
|
---|
381 | }
|
---|
382 |
|
---|
383 | assignPixelMap(mypMap);
|
---|
384 | buildVerticesList();
|
---|
385 |
|
---|
386 | for (int i=0;i<160;i++)
|
---|
387 | {
|
---|
388 | const float color[3] = { 0.5, 0.5, 0.3 };
|
---|
389 |
|
---|
390 | for (int j=0;j<3;j++)
|
---|
391 | patchesColor[i][j] = color[j];
|
---|
392 | }
|
---|
393 |
|
---|
394 | //calibrationLoaded = false;
|
---|
395 | //drawCalibrationLoaded = false;
|
---|
396 |
|
---|
397 | }
|
---|
398 | /************************************************************
|
---|
399 | * DESTRUCTOR
|
---|
400 | ************************************************************/
|
---|
401 | RawDataViewer::~RawDataViewer()
|
---|
402 | {
|
---|
403 | if (inputFile != NULL)
|
---|
404 | {
|
---|
405 | inputFile->close();
|
---|
406 | delete inputFile;
|
---|
407 | }
|
---|
408 | if (eventData != NULL) {
|
---|
409 | delete[] eventData;
|
---|
410 | delete[] rawEventData;
|
---|
411 | delete[] waveLetArray;
|
---|
412 | }
|
---|
413 | }
|
---|
414 |
|
---|
415 | /************************************************************
|
---|
416 | * PAINT GL. main drawing function.
|
---|
417 | ************************************************************/
|
---|
418 | void RawDataViewer::paintGL()
|
---|
419 | {
|
---|
420 | glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
---|
421 | glLoadIdentity();
|
---|
422 |
|
---|
423 | glTranslatef(0,0,-0.5);
|
---|
424 |
|
---|
425 | if (drawBlur)
|
---|
426 | {
|
---|
427 | glShadeModel(GL_SMOOTH);
|
---|
428 | drawCamera(false);
|
---|
429 | }
|
---|
430 | else
|
---|
431 | {
|
---|
432 | glShadeModel(GL_FLAT);
|
---|
433 | drawCamera(true);
|
---|
434 | }
|
---|
435 | glTranslatef(0,0,0.1f);
|
---|
436 | if (drawPatch)
|
---|
437 | drawPatches();
|
---|
438 | glTranslatef(0,0,0.1f);
|
---|
439 | if (!drawBlur)
|
---|
440 | {
|
---|
441 | glLineWidth(1.0f);
|
---|
442 | glColor3f(1.0,1.0,1.0);
|
---|
443 | drawHexagon(selectedPixel, false);
|
---|
444 | }
|
---|
445 | glTranslatef(0,0,0.1f);
|
---|
446 | if (drawImpulse)
|
---|
447 | {
|
---|
448 | // glRotatef(cameraRotation, 0,0,1);
|
---|
449 | glLoadIdentity();
|
---|
450 | glLineWidth(2.0);
|
---|
451 | drawPixelCurve();
|
---|
452 | }
|
---|
453 | glTranslatef(0,0,0.1f);
|
---|
454 | DrawScale();
|
---|
455 | }
|
---|
456 |
|
---|
457 | /************************************************************
|
---|
458 | * MOUSE PRESS EVENT. mouse click handler.
|
---|
459 | ************************************************************/
|
---|
460 | void RawDataViewer::mousePressEvent(QMouseEvent *cEvent)
|
---|
461 | {
|
---|
462 | if (cEvent->pos().x() > width()-(width()/50.f))
|
---|
463 | {
|
---|
464 | toggleInterfaceDisplay();
|
---|
465 | return;
|
---|
466 | }
|
---|
467 | lastPos = cEvent->pos();
|
---|
468 | setCorrectSlice(cEvent);
|
---|
469 | updateGL();
|
---|
470 | }
|
---|
471 |
|
---|
472 | /************************************************************
|
---|
473 | * SET CORRECT SLICE. if displayed, figures out if the graph was
|
---|
474 | * clicked, and if so, which slice should be displayed
|
---|
475 | ************************************************************/
|
---|
476 | void RawDataViewer::setCorrectSlice(QMouseEvent* cEvent)
|
---|
477 | {
|
---|
478 | if (!drawImpulse)
|
---|
479 | return;
|
---|
480 | float cx = (float)cEvent->x() * pixelSize - shownSizex/2;
|
---|
481 | float cy = ((float)height()-(float)cEvent->y())*pixelSize - shownSizey/2;
|
---|
482 | if (cx < bboxMin[0] ||
|
---|
483 | cx > bboxMax[0] ||
|
---|
484 | cy < bboxMin[1] ||
|
---|
485 | cy > bboxMax[1])
|
---|
486 | return;
|
---|
487 | whichSlice = (cx - bboxMin[0])*1024/(bboxMax[0] - bboxMin[0]);
|
---|
488 | emit signalCurrentSlice(whichSlice);
|
---|
489 | }
|
---|
490 |
|
---|
491 | /************************************************************
|
---|
492 | * MOUSE MOVE EVENT. used to track the dragging of slices display
|
---|
493 | ************************************************************/
|
---|
494 | void RawDataViewer::mouseMoveEvent(QMouseEvent *cEvent)
|
---|
495 | {
|
---|
496 | if (cEvent->buttons() & Qt::LeftButton) {
|
---|
497 | setCorrectSlice(cEvent);
|
---|
498 | updateGL();
|
---|
499 | } else if (cEvent->buttons() & Qt::RightButton) {
|
---|
500 | updateGL();
|
---|
501 | }
|
---|
502 | lastPos = cEvent->pos();
|
---|
503 | }
|
---|
504 |
|
---|
505 | /************************************************************
|
---|
506 | * MOUSE DOUBLE CLICK EVENT. used to select pixels
|
---|
507 | ************************************************************/
|
---|
508 | void RawDataViewer::mouseDoubleClickEvent(QMouseEvent *cEvent)
|
---|
509 | {
|
---|
510 | int face = PixelAtPosition(cEvent->pos());
|
---|
511 | if (face != -1) {
|
---|
512 | selectedPixel = face;
|
---|
513 | emit signalCurrentPixel(face);
|
---|
514 | updateGL();
|
---|
515 | }
|
---|
516 | }
|
---|
517 |
|
---|
518 | /************************************************************
|
---|
519 | * OPEN FILE. opens a new fits file
|
---|
520 | ************************************************************/
|
---|
521 | void RawDataViewer::openFile(string& file)
|
---|
522 | {
|
---|
523 | if (inputFile)
|
---|
524 | {
|
---|
525 | inputFile->close();
|
---|
526 | delete inputFile;
|
---|
527 | }
|
---|
528 | try {
|
---|
529 | inputFile = new fits(file);
|
---|
530 | }
|
---|
531 | catch (std::runtime_error e)
|
---|
532 | {
|
---|
533 | cout << "Something went wrong while loading fits. aborting: " << e.what() << endl;
|
---|
534 | return;
|
---|
535 | }
|
---|
536 | if (!*inputFile)
|
---|
537 | {
|
---|
538 | delete inputFile;
|
---|
539 | inputFile = NULL;
|
---|
540 | return;
|
---|
541 | }
|
---|
542 | vector<string> entriesToCheck;
|
---|
543 | entriesToCheck.push_back("NAXIS2");
|
---|
544 | entriesToCheck.push_back("NROI");
|
---|
545 | entriesToCheck.push_back("REVISION");
|
---|
546 | entriesToCheck.push_back("RUNID");
|
---|
547 | entriesToCheck.push_back("NBOARD");
|
---|
548 | entriesToCheck.push_back("NPIX");
|
---|
549 | entriesToCheck.push_back("NROITM");
|
---|
550 | entriesToCheck.push_back("TIMESYS");
|
---|
551 | entriesToCheck.push_back("DATE");
|
---|
552 | entriesToCheck.push_back("NIGHT");
|
---|
553 | entriesToCheck.push_back("CAMERA");
|
---|
554 | entriesToCheck.push_back("DAQ");
|
---|
555 | entriesToCheck.push_back("TSTART");
|
---|
556 | entriesToCheck.push_back("TSTOP");
|
---|
557 | //entriesToCheck.push_back("ADCRANGE");
|
---|
558 | //entriesToCheck.push_back("NBEVTOK");
|
---|
559 | //entriesToCheck.push_back("NBEVTREJ");
|
---|
560 | //entriesToCheck.push_back("NBEVTBAD");
|
---|
561 |
|
---|
562 | for (vector<string>::const_iterator it=entriesToCheck.begin(); it != entriesToCheck.end(); it++)
|
---|
563 | {
|
---|
564 | try {
|
---|
565 | if (!inputFile->HasKey(*it)){
|
---|
566 | cout << *it << " missing. Aborting load..." << endl;
|
---|
567 | return;}
|
---|
568 | }
|
---|
569 | catch (std::runtime_error e)
|
---|
570 | {
|
---|
571 | cout << e.what() << endl;
|
---|
572 | return;
|
---|
573 | }
|
---|
574 | }
|
---|
575 | nRows = inputFile->GetInt("NAXIS2");
|
---|
576 | nRoi = inputFile->GetInt("NROI");
|
---|
577 | runNumber = inputFile->GetInt("RUNID");
|
---|
578 | nTM = inputFile->HasKey("NTMARK") ? inputFile->GetInt("NTMARK") : 0;
|
---|
579 | runType = inputFile->HasKey("RUNTYPE") ? inputFile->GetInt("RUNTYPE") : -1;
|
---|
580 | firstDataTime = inputFile->GetInt("TSTART");
|
---|
581 | lastDataTime = inputFile->GetInt("TSTOP");
|
---|
582 | nRoiTM = inputFile->GetInt("NROITM");
|
---|
583 | revision = inputFile->GetInt("REVISION");
|
---|
584 | builderVersion = inputFile->HasKey("BLDVER") ? inputFile->GetInt("BLDVER") : -1;
|
---|
585 | nBoards = inputFile->GetInt("NBOARD");
|
---|
586 | nPixels = inputFile->GetInt("NPIX");
|
---|
587 | timeSystem = inputFile->GetStr("TIMESYS");
|
---|
588 | creationDate = inputFile->GetStr("DATE");
|
---|
589 | nightInt = inputFile->GetInt("NIGHT");
|
---|
590 | camera = inputFile->GetStr("CAMERA");
|
---|
591 | daq = inputFile->GetStr("DAQ");
|
---|
592 | adcCount = inputFile->HasKey("ADCRANGE") ? inputFile->GetFloat("ADCRANGE") : 2000;
|
---|
593 | nbOk = 0;//inputFile->GetInt("NBEVTOK");
|
---|
594 | nbRej = 0;//inputFile->GetInt("NBEVTREJ");
|
---|
595 | nbBad = 0;//inputFile->GetInt("NBEVTBAD");
|
---|
596 |
|
---|
597 | eventNum = 0;
|
---|
598 |
|
---|
599 | #ifdef LOAD_RAW
|
---|
600 | nRows = NUM_STORED_EVENTS;
|
---|
601 | #endif
|
---|
602 |
|
---|
603 | if (eventData != NULL) {
|
---|
604 | delete[] eventData;
|
---|
605 | delete[] rawEventData;
|
---|
606 | delete[] waveLetArray;
|
---|
607 | }
|
---|
608 | eventData = new float[(1440+160)*nRoi];
|
---|
609 | rawEventData = new int16_t[(1440+160)*nRoi];
|
---|
610 | waveLetArray = new int16_t[1024*1440];
|
---|
611 | if (!inputFile->SetPtrAddress("Data", rawEventData)){
|
---|
612 | cout << "Missing column " << "Data" << " Aborting load..." << endl;
|
---|
613 | nRoi = nRows = 0;return;}
|
---|
614 | if (!inputFile->SetPtrAddress("EventNum", &eventNum)){
|
---|
615 | cout << "Missing column " << "EventNum" << " Aborting load..." << endl;
|
---|
616 | nRoi = nRows = 0;return;}
|
---|
617 | if (!inputFile->SetPtrAddress("TriggerType", &triggerType)){
|
---|
618 | cout << "Missing column " << "TriggerType" << " Aborting load..." << endl;
|
---|
619 | nRoi = nRows = 0;return;}
|
---|
620 | if (!inputFile->SetPtrAddress("SoftTrig", &softTrig)){
|
---|
621 | cout << "Missing column " << "SoftTrig" << " Aborting load..." << endl;
|
---|
622 | nRoi = nRows = 0;return;}
|
---|
623 | if (!inputFile->SetPtrAddress("PCTime", pcTime)){
|
---|
624 | cout << "Missing column " << "PCTime" << " Aborting load..." << endl;
|
---|
625 | nRoi = nRows = 0;return;}
|
---|
626 | if (!inputFile->SetPtrAddress("BoardTime", boardTime)){
|
---|
627 | cout << "Missing column " << "BoardTime" << " Aborting load..." << endl;
|
---|
628 | nRoi = nRows = 0;return;}
|
---|
629 | if (!inputFile->SetPtrAddress("StartCellData", startPix)){
|
---|
630 | cout << "Missing column " << "StartCellData" << " Aborting load..." << endl;
|
---|
631 | nRoi = nRows = 0;return;}
|
---|
632 | if (!inputFile->SetPtrAddress("StartCellTimeMarker", startTM)){
|
---|
633 | cout << "Missing column " << "StartCellTimeMarker" << " Aborting load..." << endl;
|
---|
634 | nRoi = nRows = 0;return;}
|
---|
635 | int backupStep = eventStep;
|
---|
636 | rowNum = -1;
|
---|
637 | eventStep = 1;
|
---|
638 |
|
---|
639 | doMyWaveletTestPlease();
|
---|
640 |
|
---|
641 |
|
---|
642 | plusEvent();
|
---|
643 | eventStep = backupStep;
|
---|
644 | emit newFileLoaded();
|
---|
645 | emit signalCurrentPixel(selectedPixel);
|
---|
646 | }
|
---|
647 | /*
|
---|
648 | bool RawDataViewer::doWaveLetsPlease(int givenSpan, int16_t* orig_in, int16_t* wavelets_in, bool verifyResult)
|
---|
649 | {
|
---|
650 | float* interArray = new float[givenSpan];
|
---|
651 | float* resultArray = new float[givenSpan];
|
---|
652 | float* orig = new float[givenSpan];
|
---|
653 | float* wavelets = new float[givenSpan];
|
---|
654 | for (int i=0;i<givenSpan;i++)
|
---|
655 | {
|
---|
656 | if (fabs((float)(orig_in[i])) > 32767.f)
|
---|
657 | cout << "Input overflow: " << orig_in[i] << endl;
|
---|
658 | orig[i] = (float)orig_in[i];
|
---|
659 | }
|
---|
660 | for (int k=0;k<givenSpan;k++)
|
---|
661 | interArray[k] = orig[k];
|
---|
662 | int span = givenSpan/2;
|
---|
663 | while (span > 0)
|
---|
664 | {
|
---|
665 | for (int k=0;k<span;k++)
|
---|
666 | {
|
---|
667 | wavelets[k] = (interArray[2*k] + interArray[2*k + 1])/2.f;
|
---|
668 | wavelets[k + span] = (interArray[2*k + 1] - interArray[2*k])/2.f;
|
---|
669 | }
|
---|
670 | for (int k=0;k<givenSpan;k++)
|
---|
671 | interArray[k] = wavelets[k];
|
---|
672 | span /= 2;
|
---|
673 | }
|
---|
674 | //move float results to int16_t array
|
---|
675 | float intScaling = 15.9f;
|
---|
676 | int max = 0;
|
---|
677 | for (int i=0;i<givenSpan;i++)
|
---|
678 | {
|
---|
679 | float cValue = intScaling*wavelets[i];//
|
---|
680 | if (cValue > 0)
|
---|
681 | cValue += 0.5f;
|
---|
682 | else
|
---|
683 | cValue -= 0.5f;
|
---|
684 | wavelets_in[i] = (int16_t)(cValue);
|
---|
685 | if (fabs(cValue) > 32767.f)
|
---|
686 | {
|
---|
687 | cout << "Overflow ! " << cValue << endl;
|
---|
688 | }
|
---|
689 | if (fabs(cValue) > fabs(max))
|
---|
690 | max = cValue;
|
---|
691 | }
|
---|
692 | // cout << "Max wave value: " << max << endl;
|
---|
693 | //result reconstruction and checking
|
---|
694 | if (!verifyResult)
|
---|
695 | return true;
|
---|
696 |
|
---|
697 | for (int k=0;k<givenSpan;k++)
|
---|
698 | {
|
---|
699 | resultArray[k] = wavelets_in[k]/intScaling;
|
---|
700 | }
|
---|
701 |
|
---|
702 | span = 1;
|
---|
703 | while (span < givenSpan)
|
---|
704 | {
|
---|
705 | for (int k=0;k<givenSpan;k++)
|
---|
706 | interArray[k] = resultArray[k];
|
---|
707 | for (int k=0;k<span;k++)
|
---|
708 | {
|
---|
709 | resultArray[2*k] = (float)(((interArray[k] - interArray[k + span])*(1.f/1.f)) + 0.0f);
|
---|
710 | resultArray[2*k + 1] = (float)(((interArray[k] + interArray[k + span])*(1.f/1.f)) + 0.0f);
|
---|
711 | }
|
---|
712 | span *= 2;
|
---|
713 | }
|
---|
714 |
|
---|
715 | for (int k=0;k<givenSpan;k++)
|
---|
716 | {
|
---|
717 | float plus = 0.5f;
|
---|
718 | if (resultArray[k] < 0)
|
---|
719 | plus *= -1.f;
|
---|
720 | if ((int)(resultArray[k]+plus) != (int)(orig_in[k]))
|
---|
721 | {
|
---|
722 | cout << "Nop, sorry: k: " << k << " " << resultArray[k] << " " << (int)(resultArray[k]+plus) << " " << plus << " " << orig[k] << endl;
|
---|
723 | return false;
|
---|
724 | }
|
---|
725 | }
|
---|
726 | return true;
|
---|
727 | }
|
---|
728 | */
|
---|
729 | bool RawDataViewer::doWaveLetsPlease(int givenSpan, int16_t* orig_in, int16_t* wavelets_in, bool verifyResult)
|
---|
730 | {
|
---|
731 | float* interArray = new float[givenSpan];
|
---|
732 | float* resultArray = new float[givenSpan];
|
---|
733 | float* orig = new float[givenSpan];
|
---|
734 | float* wavelets = new float[givenSpan];
|
---|
735 | for (int i=0;i<givenSpan;i++)
|
---|
736 | {
|
---|
737 | if (fabs((float)(orig_in[i])) > 32767.f)
|
---|
738 | cout << "Input overflow: " << orig_in[i] << endl;
|
---|
739 | orig[i] = (float)orig_in[i];
|
---|
740 | }
|
---|
741 | for (int k=0;k<givenSpan;k++)
|
---|
742 | interArray[k] = orig[k];
|
---|
743 | int span = givenSpan/2;
|
---|
744 | while (span > 0)
|
---|
745 | {
|
---|
746 | for (int k=0;k<span;k++)
|
---|
747 | {
|
---|
748 | wavelets[k] = interArray[2*k];// + interArray[2*k + 1])/2.f;
|
---|
749 | wavelets[k + span] = interArray[2*k + 1] - interArray[2*k];//)/2.f;
|
---|
750 | }
|
---|
751 | for (int k=0;k<givenSpan;k++)
|
---|
752 | interArray[k] = wavelets[k];
|
---|
753 | span /= 2;
|
---|
754 | }
|
---|
755 | //move float results to int16_t array
|
---|
756 | float intScaling = 1.f;
|
---|
757 | int max = 0;
|
---|
758 | for (int i=0;i<givenSpan;i++)
|
---|
759 | {
|
---|
760 | float cValue = intScaling*wavelets[i];//
|
---|
761 | if (cValue > 0)
|
---|
762 | cValue += 0.5f;
|
---|
763 | else
|
---|
764 | cValue -= 0.5f;
|
---|
765 | wavelets_in[i] = (int16_t)(cValue);
|
---|
766 | if (fabs(cValue) > 32767.f)
|
---|
767 | {
|
---|
768 | cout << "Overflow ! " << cValue << endl;
|
---|
769 | }
|
---|
770 | if (fabs(cValue) > fabs(max))
|
---|
771 | max = cValue;
|
---|
772 | }
|
---|
773 | // cout << "Max wave value: " << max << endl;
|
---|
774 | //result reconstruction and checking
|
---|
775 | if (!verifyResult)
|
---|
776 | return true;
|
---|
777 |
|
---|
778 | for (int k=0;k<givenSpan;k++)
|
---|
779 | {
|
---|
780 | resultArray[k] = wavelets_in[k]/intScaling;
|
---|
781 | }
|
---|
782 |
|
---|
783 | span = 1;
|
---|
784 | while (span < givenSpan)
|
---|
785 | {
|
---|
786 | for (int k=0;k<givenSpan;k++)
|
---|
787 | interArray[k] = resultArray[k];
|
---|
788 | for (int k=0;k<span;k++)
|
---|
789 | {
|
---|
790 | resultArray[2*k] = (float)(((interArray[k])*(1.f/1.f)) + 0.0f);
|
---|
791 | resultArray[2*k + 1] = (float)(((interArray[k] + interArray[k + span])*(1.f/1.f)) + 0.0f);
|
---|
792 | }
|
---|
793 | span *= 2;
|
---|
794 | }
|
---|
795 |
|
---|
796 | for (int k=0;k<givenSpan;k++)
|
---|
797 | {
|
---|
798 | float plus = 0.5f;
|
---|
799 | if (resultArray[k] < 0)
|
---|
800 | plus *= -1.f;
|
---|
801 | if ((int)(resultArray[k]+plus) != (int)(orig_in[k]))
|
---|
802 | {
|
---|
803 | cout << "Nop, sorry: k: " << k << " " << resultArray[k] << " " << (int)(resultArray[k]+plus) << " " << plus << " " << orig[k] << endl;
|
---|
804 | return false;
|
---|
805 | }
|
---|
806 | }
|
---|
807 | delete[] interArray;
|
---|
808 | delete[] resultArray;
|
---|
809 | delete[] orig;
|
---|
810 | delete[] wavelets;
|
---|
811 | return true;
|
---|
812 | }
|
---|
813 |
|
---|
814 | void RawDataViewer::doWaveLetOnCurrentEventPlease()
|
---|
815 | {
|
---|
816 | int16_t* origTheWayIWant = new int16_t[1024*1440];
|
---|
817 |
|
---|
818 | // int numPixels = 1024;
|
---|
819 | // int leftOver = 1440-numPixels;
|
---|
820 | for (int k=0;k<1024;k++)
|
---|
821 | for (int j=0;j<1440;j++)
|
---|
822 | {
|
---|
823 | origTheWayIWant[k*1440 + j] = rawEventData[j + k*1440];
|
---|
824 | }
|
---|
825 |
|
---|
826 | int waveSpan = 1024;
|
---|
827 | int waveToPixelsRatio = 32;
|
---|
828 | waveSpan = waveSpan*waveToPixelsRatio;
|
---|
829 | int totalNumSamples = 1024*1440;
|
---|
830 | int j=0;
|
---|
831 | for (;j<totalNumSamples;j+= waveSpan)
|
---|
832 | {
|
---|
833 | if (j + waveSpan < totalNumSamples)
|
---|
834 | if (!doWaveLetsPlease(waveSpan, &origTheWayIWant[j], &waveLetArray[j], true))
|
---|
835 | return;
|
---|
836 | }
|
---|
837 |
|
---|
838 | while (j%1440 != 0)
|
---|
839 | {
|
---|
840 | int lastRun = 1;
|
---|
841 | while (lastRun < 1440 - j%1440)
|
---|
842 | lastRun *= 2;
|
---|
843 | lastRun /= 2;
|
---|
844 | if (lastRun > 2)
|
---|
845 | {
|
---|
846 | doWaveLetsPlease(lastRun, &origTheWayIWant[j], &waveLetArray[j], true);
|
---|
847 | }
|
---|
848 | else
|
---|
849 | {
|
---|
850 | for (int l=0;l<lastRun;l++)
|
---|
851 | waveLetArray[j+l] = origTheWayIWant[j+l];
|
---|
852 | }
|
---|
853 | if (!lastRun)
|
---|
854 | break;
|
---|
855 | j += lastRun;
|
---|
856 | }
|
---|
857 |
|
---|
858 | delete[] origTheWayIWant;
|
---|
859 |
|
---|
860 | }
|
---|
861 | void RawDataViewer::doMyWaveletTestPlease()
|
---|
862 | {
|
---|
863 | // cout << "Size of float: " << sizeof(float) << endl;
|
---|
864 | return;
|
---|
865 | ofstream outBin("/scratch/bin/outputBin.bin", ios_base::out | ios_base::binary);
|
---|
866 | ofstream outWave("/scratch/bin/outputWave.bin", ios_base::out | ios_base::binary);
|
---|
867 | int16_t* waveLetArray_ = new int16_t[1024*1440];
|
---|
868 | int16_t* origTheWayIWant = new int16_t[1024*1440];
|
---|
869 |
|
---|
870 | for (int i=0;i<nRows;i++)
|
---|
871 | {
|
---|
872 | cout << '\r' << "Doing row " << i << " of " << nRows;
|
---|
873 | cout.flush();
|
---|
874 | inputFile->GetRow(i);
|
---|
875 | outBin.write((const char*)(rawEventData), 1440*1024*2);
|
---|
876 |
|
---|
877 | // int numPixels = 1024;
|
---|
878 | // int leftOver = 1440-numPixels;
|
---|
879 | for (int k=0;k<1024;k++)
|
---|
880 | for (int j=0;j<1440;j++)
|
---|
881 | {
|
---|
882 | origTheWayIWant[k*1440 + j] = rawEventData[j + k*1440];
|
---|
883 | }
|
---|
884 |
|
---|
885 | int waveSpan = 1024;
|
---|
886 | int waveToPixelsRatio = 32;
|
---|
887 | waveSpan = waveSpan*waveToPixelsRatio;
|
---|
888 | int totalNumSamples = 1024*1440;
|
---|
889 | int j=0;
|
---|
890 | for (;j<totalNumSamples;j+= waveSpan)//1440/waveToPixelsRatio;j++)
|
---|
891 | {
|
---|
892 | if (j + waveSpan < totalNumSamples)
|
---|
893 | if (!doWaveLetsPlease(waveSpan, &origTheWayIWant[j], &waveLetArray_[j], true))
|
---|
894 | return;
|
---|
895 | }
|
---|
896 |
|
---|
897 | while (j%1440 != 0)// < totalNumSamples)
|
---|
898 | {
|
---|
899 | cout << "Copying the remaining of the data" << endl;
|
---|
900 | int lastRun = 1;
|
---|
901 | while (lastRun < 1440 - j%1440)//totalNumSamples-j)
|
---|
902 | lastRun *= 2;
|
---|
903 | lastRun /= 2;
|
---|
904 | if (lastRun > 2)
|
---|
905 | {
|
---|
906 | // cout << " Doint one last run of " << lastRun << " samples" << endl;
|
---|
907 | doWaveLetsPlease(lastRun, &origTheWayIWant[j], &waveLetArray_[j], true);
|
---|
908 | }
|
---|
909 | else
|
---|
910 | {
|
---|
911 | // cout << " Filling in " << lastRun << " samples" << endl;
|
---|
912 | for (int l=0;l<lastRun;l++)
|
---|
913 | waveLetArray_[j+l] = origTheWayIWant[j+l];
|
---|
914 | }
|
---|
915 | if (!lastRun)
|
---|
916 | break;
|
---|
917 | j += lastRun;
|
---|
918 | }
|
---|
919 | outWave.write((const char*)(waveLetArray_), 1440*1024*2);
|
---|
920 | }
|
---|
921 | outWave.close();
|
---|
922 | outBin.close();
|
---|
923 | inputFile->GetRow(0);
|
---|
924 |
|
---|
925 | delete[] waveLetArray_;
|
---|
926 | delete[] origTheWayIWant;
|
---|
927 | }
|
---|
928 | void RawDataViewer::openCalibFile(string& file)
|
---|
929 | {
|
---|
930 | //calibrationLoaded = false;
|
---|
931 |
|
---|
932 | MessageImp msg;
|
---|
933 | if (!DataCalib::ReadFits(file, msg))
|
---|
934 | {
|
---|
935 | DataCalib::Restart();
|
---|
936 | return;
|
---|
937 | }
|
---|
938 | /*
|
---|
939 |
|
---|
940 | calibInputFile = new fits(file);
|
---|
941 | if (!*calibInputFile)
|
---|
942 | {
|
---|
943 | delete calibInputFile;
|
---|
944 | calibInputFile = NULL;
|
---|
945 | return;
|
---|
946 | }
|
---|
947 |
|
---|
948 | // if (calibInputFile->HasKey("NROI"))
|
---|
949 | // {
|
---|
950 | // cout << "Looks like you're trying to load a regular raw data file as DRS calib. aborting." << endl;
|
---|
951 | // delete calibInputFile;
|
---|
952 | // calibInputFile = NULL;
|
---|
953 | // return;
|
---|
954 | // }
|
---|
955 |
|
---|
956 | if (!calibInputFile->SetPtrAddress("BaselineMean", baseLineMean)){
|
---|
957 | cout << "Missing column " << "BaseLineMean" << " Aborting load..." << endl;
|
---|
958 | return;}
|
---|
959 | if (!calibInputFile->SetPtrAddress("GainMean", gainMean)){
|
---|
960 | cout << "Missing column " << "GainMean" << " Aborting load..." << endl;
|
---|
961 | return;}
|
---|
962 | if (!calibInputFile->SetPtrAddress("TriggerOffsetMean", triggerOffsetMean)){
|
---|
963 | cout << "Missing column " << "TriggerOffsetMean" << " Aborting load..." << endl;
|
---|
964 | return;}
|
---|
965 |
|
---|
966 | calibInputFile->GetNextRow();
|
---|
967 |
|
---|
968 | // for (int i=0;i<1024;i++)
|
---|
969 | // cout << gainMean[i] << " ";
|
---|
970 | // cout << endl << endl;
|
---|
971 |
|
---|
972 | delete calibInputFile;
|
---|
973 | */
|
---|
974 | //calibrationLoaded = true;
|
---|
975 |
|
---|
976 | emit newFileLoaded();
|
---|
977 |
|
---|
978 | //if (calibratedCheckBox->isChecked())
|
---|
979 | updateGL();
|
---|
980 | }
|
---|
981 | /************************************************************
|
---|
982 | * PLUS EVENT
|
---|
983 | ************************************************************/
|
---|
984 | void RawDataViewer::plusEvent()
|
---|
985 | {
|
---|
986 | eventStepping(true);
|
---|
987 | }
|
---|
988 | /************************************************************
|
---|
989 | * MINUS EVENT
|
---|
990 | ************************************************************/
|
---|
991 | void RawDataViewer::minusEvent()
|
---|
992 | {
|
---|
993 | eventStepping(false);
|
---|
994 | }
|
---|
995 | /************************************************************
|
---|
996 | * SET EVENT STEP
|
---|
997 | ************************************************************/
|
---|
998 | void RawDataViewer::setEventStep(int step)
|
---|
999 | {
|
---|
1000 | eventStep = step;
|
---|
1001 | }
|
---|
1002 | /************************************************************
|
---|
1003 | * EVENT STEPPING
|
---|
1004 | ************************************************************/
|
---|
1005 | void RawDataViewer::eventStepping(bool plus)
|
---|
1006 | {
|
---|
1007 | if (plus)
|
---|
1008 | rowNum += eventStep;
|
---|
1009 | else
|
---|
1010 | rowNum -= eventStep;
|
---|
1011 | if (rowNum >= nRows)
|
---|
1012 | rowNum -= nRows;
|
---|
1013 | if (rowNum < 0)
|
---|
1014 | rowNum += nRows;
|
---|
1015 | #ifdef LOAD_RAW
|
---|
1016 | eventNum+=eventStep;
|
---|
1017 | #else
|
---|
1018 | if (inputFile == NULL)
|
---|
1019 | return;
|
---|
1020 | inputFile->GetRow(rowNum);
|
---|
1021 | // cout << "Getting row " << rowNum << endl;
|
---|
1022 | for (int i=0;i<(1440+160)*nRoi;i++)
|
---|
1023 | eventData[i] = (float)rawEventData[i];
|
---|
1024 | #endif
|
---|
1025 |
|
---|
1026 | // if (drawCalibrationLoaded && calibrationLoaded)
|
---|
1027 | // {
|
---|
1028 |
|
---|
1029 | // if (calibratedCheckBox->isChecked())
|
---|
1030 | DataCalib::Apply(eventData, rawEventData, startPix, nRoi);
|
---|
1031 | /*
|
---|
1032 | for (int i=0;i<1440;i++)
|
---|
1033 | for (int j=0;j<nRoi;j++)
|
---|
1034 | {
|
---|
1035 | int realj = (j+startPix[i])%1024;
|
---|
1036 | eventData[i*1024+j] *= 2000.f/4096.f;
|
---|
1037 | eventData[i*1024+j] -= (baseLineMean[i*1024+realj]+triggerOffsetMean[i*1024+j]);
|
---|
1038 | eventData[i*1024+j] /= gainMean[i*1024+realj];
|
---|
1039 | eventData[i*1024+j] *= (50000.f/65536.f) * 2500.f;
|
---|
1040 | }
|
---|
1041 | }
|
---|
1042 | */
|
---|
1043 | updateGL();
|
---|
1044 | emit signalCurrentEvent(eventNum);
|
---|
1045 | emit signalCurrentPixel(selectedPixel);
|
---|
1046 | }
|
---|
1047 | /************************************************************
|
---|
1048 | * NEXT SLICE. deprec ?
|
---|
1049 | ************************************************************/
|
---|
1050 | void RawDataViewer::nextSlice()
|
---|
1051 | {
|
---|
1052 | whichSlice++;
|
---|
1053 | if (whichSlice >= nRoi)
|
---|
1054 | {
|
---|
1055 | whichSlice = 0;
|
---|
1056 | if (!loopCurrentEvent)
|
---|
1057 | {
|
---|
1058 | int backupStep = eventStep;
|
---|
1059 | eventStep = 1;
|
---|
1060 | eventStepping(true);
|
---|
1061 | eventStep = backupStep;
|
---|
1062 | }
|
---|
1063 | }
|
---|
1064 | emit signalCurrentSlice(whichSlice);
|
---|
1065 | updateGL();
|
---|
1066 | }
|
---|
1067 | void RawDataViewer::previousSlice()
|
---|
1068 | {
|
---|
1069 | whichSlice--;
|
---|
1070 | if (whichSlice < 0)
|
---|
1071 | {
|
---|
1072 | whichSlice = nRoi-1;
|
---|
1073 | if (!loopCurrentEvent)
|
---|
1074 | {
|
---|
1075 | int backupStep = eventStep;
|
---|
1076 | eventStep = 1;
|
---|
1077 | eventStepping(false);
|
---|
1078 | eventStep = backupStep;
|
---|
1079 | }
|
---|
1080 | }
|
---|
1081 | emit signalCurrentSlice(whichSlice);
|
---|
1082 | updateGL();
|
---|
1083 | }
|
---|
1084 |
|
---|
1085 | void RawDataViewer::computePulsesStatistics()
|
---|
1086 | {
|
---|
1087 | if (!inputFile)
|
---|
1088 | {
|
---|
1089 | cout << "A FITS file must be open in order to complete this operation" << endl;
|
---|
1090 | return;
|
---|
1091 | }
|
---|
1092 |
|
---|
1093 |
|
---|
1094 | // for (int i=0;i<nRows;i++)//for all events
|
---|
1095 | // {
|
---|
1096 | // inputFile->GetRow(rowNum);
|
---|
1097 | // for (int i=0;i<(1440+160)*nRoi;i++)
|
---|
1098 | // eventData[i] = (float)rawEventData[i];
|
---|
1099 |
|
---|
1100 | // for (int j=0;j<ACTUAL_NUM_PIXELS;j++)
|
---|
1101 | /// {
|
---|
1102 | int j = selectedPixel;
|
---|
1103 | for (int i=0;i<nRoi;i++)
|
---|
1104 | {
|
---|
1105 | aMeas[i] = eventData[j*1024+i];// * adcCount;
|
---|
1106 |
|
---|
1107 | }
|
---|
1108 | for (int i=0;i<nRoi;i++)
|
---|
1109 | {
|
---|
1110 | if (i==0)
|
---|
1111 | n1mean[i] = aMeas[i+1];
|
---|
1112 | else
|
---|
1113 | {
|
---|
1114 | if (i==1023)
|
---|
1115 | n1mean[i] = aMeas[i-1];
|
---|
1116 | else
|
---|
1117 | n1mean[i] = (aMeas[i-1]+aMeas[i+1])/2.f;
|
---|
1118 | }
|
---|
1119 | }
|
---|
1120 | //find spike
|
---|
1121 | for (int i=0;i<nRoi-3;i++)
|
---|
1122 | {
|
---|
1123 | const float fract = 0.8f;
|
---|
1124 | float xx, xp, xpp;
|
---|
1125 | vCorr[i] = 0;//aMeas[i];
|
---|
1126 | xx = aMeas[i] - n1mean[i];
|
---|
1127 | if (xx < -8.f)
|
---|
1128 | {
|
---|
1129 | xp = aMeas[i+1] - n1mean[i+1];
|
---|
1130 | xpp = aMeas[i+2] - n1mean[i+2];
|
---|
1131 | if ((aMeas[i+2] - (aMeas[i] + aMeas[i+3])/2.f) > 10.f)
|
---|
1132 | {
|
---|
1133 | vCorr[i+1] = (aMeas[i] + aMeas[i+3])/2.f;
|
---|
1134 | vCorr[i+2] = (aMeas[i] + aMeas[i+3])/2.f;
|
---|
1135 | i = i+2;
|
---|
1136 | }
|
---|
1137 | else
|
---|
1138 | {
|
---|
1139 | if ((xp > -2.*xx*fract) && (xpp < -10.f))
|
---|
1140 | {
|
---|
1141 | vCorr[i+1] = n1mean[i+1];
|
---|
1142 | n1mean[i+2] = aMeas[i+1] - aMeas[i+3]/2.f;
|
---|
1143 | i++;
|
---|
1144 | }
|
---|
1145 | }
|
---|
1146 | }
|
---|
1147 | }
|
---|
1148 | for (int i=0;i<nRoi;i++)
|
---|
1149 | n1mean[i] = aMeas[i]-n1mean[i];
|
---|
1150 | // }
|
---|
1151 | // }
|
---|
1152 | }
|
---|
1153 | /************************************************************
|
---|
1154 | * UICONNECTOR CONSTRUCTOR
|
---|
1155 | ************************************************************/
|
---|
1156 | UIConnector::UIConnector(QWidget*)
|
---|
1157 | {
|
---|
1158 | setupUi(this);
|
---|
1159 | initHistograms();
|
---|
1160 |
|
---|
1161 | currentFile = "none";
|
---|
1162 | currentCalibFile = "none";
|
---|
1163 |
|
---|
1164 | updateSpinnerDisplay = true;
|
---|
1165 | updating = false;
|
---|
1166 |
|
---|
1167 | timer.setInterval(10.0);
|
---|
1168 | QObject::connect(&timer, SIGNAL(timeout()),
|
---|
1169 | this, SLOT(nextSlicePlease()));
|
---|
1170 |
|
---|
1171 | QButtonGroup &scaleGroup = *new QButtonGroup(GLWindow);// = new QButtonGroup(canvas);
|
---|
1172 | QButtonGroup &animateGroup = *new QButtonGroup(GLWindow);// = new QButtonGroup(canvas);
|
---|
1173 |
|
---|
1174 | scaleGroup.addButton(Ui::MainWindow::currentPixelScale);
|
---|
1175 | scaleGroup.addButton(Ui::MainWindow::entireCameraScale);
|
---|
1176 |
|
---|
1177 | animateGroup.addButton(Ui::MainWindow::playEventsRadio);
|
---|
1178 | animateGroup.addButton(Ui::MainWindow::playSlicesRadio);
|
---|
1179 |
|
---|
1180 | QObject::connect(GLWindow, SIGNAL(colorPaletteHasChanged()),
|
---|
1181 | this, SLOT(on_autoScaleColor_clicked()));
|
---|
1182 | QObject::connect(GLWindow, SIGNAL(signalCurrentSlice(int)),
|
---|
1183 | this, SLOT(currentSliceHasChanged(int)));
|
---|
1184 | QObject::connect(GLWindow, SIGNAL(signalCurrentEvent(int)),
|
---|
1185 | this, SLOT(currentEventHasChanged(int)));
|
---|
1186 | QObject::connect(GLWindow, SIGNAL(signalCurrentPixel(int)),
|
---|
1187 | this, SLOT(pixelChanged(int)));
|
---|
1188 | QObject::connect(GLWindow, SIGNAL(newFileLoaded()),
|
---|
1189 | this, SLOT(newFileLoaded()));
|
---|
1190 |
|
---|
1191 | show();
|
---|
1192 | }
|
---|
1193 |
|
---|
1194 | void UIConnector::slicesPlusPlus()
|
---|
1195 | {
|
---|
1196 | GLWindow->nextSlice();
|
---|
1197 | }
|
---|
1198 | void UIConnector::slicesMinusMinus()
|
---|
1199 | {
|
---|
1200 | GLWindow->previousSlice();
|
---|
1201 | }
|
---|
1202 | void UIConnector::on_calibratedCheckBox_stateChanged(int state)
|
---|
1203 | {
|
---|
1204 | for (int i=0;i<(1440+160)*GLWindow->nRoi;i++)
|
---|
1205 | GLWindow->eventData[i] = (float)GLWindow->rawEventData[i];
|
---|
1206 |
|
---|
1207 | // if (GLWindow->calibratedCheckBox->isChecked())
|
---|
1208 | if (state)
|
---|
1209 | DataCalib::Apply(GLWindow->eventData, GLWindow->rawEventData, GLWindow->startPix, GLWindow->nRoi);
|
---|
1210 |
|
---|
1211 | GLWindow->updateGL();
|
---|
1212 |
|
---|
1213 | //drawCalibrationCheckBox->setChecked(false);
|
---|
1214 |
|
---|
1215 | on_autoScaleColor_clicked();
|
---|
1216 | pixelChanged(GLWindow->selectedPixel);
|
---|
1217 |
|
---|
1218 | }
|
---|
1219 | /************************************************************
|
---|
1220 | * DRAW PATCHES CHECK CHANGE. checkbox handler
|
---|
1221 | ************************************************************/
|
---|
1222 | void UIConnector::on_drawPatchCheckBox_stateChanged(int state)
|
---|
1223 | {
|
---|
1224 | GLWindow->drawPatch = state;
|
---|
1225 | GLWindow->updateGL();
|
---|
1226 | }
|
---|
1227 | /************************************************************
|
---|
1228 | * DRAW IMPULSE CHECK CHANGE. checkbox handler
|
---|
1229 | ************************************************************/
|
---|
1230 | void UIConnector::on_drawImpulseCheckBox_stateChanged(int state)
|
---|
1231 | {
|
---|
1232 | GLWindow->drawImpulse = state;
|
---|
1233 | GLWindow->updateGL();
|
---|
1234 | }
|
---|
1235 | /************************************************************
|
---|
1236 | * DRAW BLUR CHECK CHANGE. checkbox handler
|
---|
1237 | ************************************************************/
|
---|
1238 | void UIConnector::on_drawBlurCheckBox_stateChanged(int state)
|
---|
1239 | {
|
---|
1240 | GLWindow->drawBlur = state;
|
---|
1241 | GLWindow->updateGL();
|
---|
1242 | }
|
---|
1243 | void UIConnector::on_loopOverCurrentEventBox_stateChanged(int state)
|
---|
1244 | {
|
---|
1245 | GLWindow->loopCurrentEvent = state;
|
---|
1246 | }
|
---|
1247 |
|
---|
1248 | /************************************************************
|
---|
1249 | * NEXT SLICE PLEASE
|
---|
1250 | ************************************************************/
|
---|
1251 | void UIConnector::nextSlicePlease()
|
---|
1252 | {
|
---|
1253 | if (playEventsRadio->isChecked ())
|
---|
1254 | GLWindow->eventStepping(true);
|
---|
1255 | else
|
---|
1256 | GLWindow->nextSlice();
|
---|
1257 | }
|
---|
1258 |
|
---|
1259 | /************************************************************
|
---|
1260 | * SET VIEWER.
|
---|
1261 | ************************************************************/
|
---|
1262 | //void UIConnector::setViewer(RawDataViewer* v)
|
---|
1263 | //{
|
---|
1264 | // viewer = v;
|
---|
1265 | //}
|
---|
1266 | /************************************************************
|
---|
1267 | * SLICES PER SECOND CHANGED. timing ui handler
|
---|
1268 | ************************************************************/
|
---|
1269 | void UIConnector::slicesPerSecondChanged(double value)
|
---|
1270 | {
|
---|
1271 | timer.setInterval(1000.0/value);
|
---|
1272 | }
|
---|
1273 |
|
---|
1274 | void UIConnector::on_colorRange0_valueChanged(double value) { GLWindow->ss[0] = (float)value; GLWindow->updateGL(); }
|
---|
1275 | void UIConnector::on_colorRange1_valueChanged(double value) { GLWindow->ss[1] = (float)value; GLWindow->updateGL(); }
|
---|
1276 | void UIConnector::on_colorRange2_valueChanged(double value) { GLWindow->ss[2] = (float)value; GLWindow->updateGL(); }
|
---|
1277 | void UIConnector::on_colorRange3_valueChanged(double value) { GLWindow->ss[3] = (float)value; GLWindow->updateGL(); }
|
---|
1278 | void UIConnector::on_colorRange4_valueChanged(double value) { GLWindow->ss[4] = (float)value; GLWindow->updateGL(); }
|
---|
1279 |
|
---|
1280 | void UIConnector::on_redValue0_valueChanged(double value) { GLWindow->rr[0] = (float)value; GLWindow->updateGL(); }
|
---|
1281 | void UIConnector::on_redValue1_valueChanged(double value) { GLWindow->rr[1] = (float)value; GLWindow->updateGL(); }
|
---|
1282 | void UIConnector::on_redValue2_valueChanged(double value) { GLWindow->rr[2] = (float)value; GLWindow->updateGL(); }
|
---|
1283 | void UIConnector::on_redValue3_valueChanged(double value) { GLWindow->rr[3] = (float)value; GLWindow->updateGL(); }
|
---|
1284 | void UIConnector::on_redValue4_valueChanged(double value) { GLWindow->rr[4] = (float)value; GLWindow->updateGL(); }
|
---|
1285 |
|
---|
1286 | void UIConnector::on_greenValue0_valueChanged(double value) { GLWindow->gg[0] = (float)value; GLWindow->updateGL(); }
|
---|
1287 | void UIConnector::on_greenValue1_valueChanged(double value) { GLWindow->gg[1] = (float)value; GLWindow->updateGL(); }
|
---|
1288 | void UIConnector::on_greenValue2_valueChanged(double value) { GLWindow->gg[2] = (float)value; GLWindow->updateGL(); }
|
---|
1289 | void UIConnector::on_greenValue3_valueChanged(double value) { GLWindow->gg[3] = (float)value; GLWindow->updateGL(); }
|
---|
1290 | void UIConnector::on_greenValue4_valueChanged(double value) { GLWindow->gg[4] = (float)value; GLWindow->updateGL(); }
|
---|
1291 |
|
---|
1292 | void UIConnector::on_blueValue0_valueChanged(double value) { GLWindow->bb[0] = (float)value; GLWindow->updateGL(); }
|
---|
1293 | void UIConnector::on_blueValue1_valueChanged(double value) { GLWindow->bb[1] = (float)value; GLWindow->updateGL(); }
|
---|
1294 | void UIConnector::on_blueValue2_valueChanged(double value) { GLWindow->bb[2] = (float)value; GLWindow->updateGL(); }
|
---|
1295 | void UIConnector::on_blueValue3_valueChanged(double value) { GLWindow->bb[3] = (float)value; GLWindow->updateGL(); }
|
---|
1296 | void UIConnector::on_blueValue4_valueChanged(double value) { GLWindow->bb[4] = (float)value; GLWindow->updateGL(); }
|
---|
1297 |
|
---|
1298 | /************************************************************
|
---|
1299 | * LOAD NEW FILE CLICKED. button handler
|
---|
1300 | ************************************************************/
|
---|
1301 | void UIConnector::on_loadNewFileButton_clicked()
|
---|
1302 | {
|
---|
1303 | QFileDialog dialog;
|
---|
1304 | dialog.setFileMode(QFileDialog::ExistingFile);
|
---|
1305 | dialog.open(this, SLOT(fileSelected(QString)));
|
---|
1306 | dialog.setVisible(true);
|
---|
1307 | dialog.exec();
|
---|
1308 | }
|
---|
1309 | void UIConnector::on_loadDRSCalibButton_clicked()
|
---|
1310 | {
|
---|
1311 | QFileDialog dialog;
|
---|
1312 | dialog.setFileMode(QFileDialog::ExistingFile);
|
---|
1313 | dialog.open(this, SLOT(calibFileSelected(QString)));
|
---|
1314 | dialog.setVisible(true);
|
---|
1315 | dialog.exec();
|
---|
1316 | }
|
---|
1317 | /************************************************************
|
---|
1318 | * FILE SELECTED. return of the file open dialog handler
|
---|
1319 | ************************************************************/
|
---|
1320 | void UIConnector::fileSelected(QString file)
|
---|
1321 | {
|
---|
1322 | currentFile = file.toStdString();
|
---|
1323 | if (currentFile != "")
|
---|
1324 | GLWindow->openFile(currentFile);
|
---|
1325 | }
|
---|
1326 | void UIConnector::calibFileSelected(QString file)
|
---|
1327 | {
|
---|
1328 | currentCalibFile = file.toStdString();
|
---|
1329 | if (currentCalibFile != "")
|
---|
1330 | GLWindow->openCalibFile(currentCalibFile);
|
---|
1331 | }
|
---|
1332 | /************************************************************
|
---|
1333 | * NEW FILE LOADED. update of the UI after a new file has been loaded
|
---|
1334 | ************************************************************/
|
---|
1335 | void UIConnector::newFileLoaded()
|
---|
1336 | {
|
---|
1337 | ostringstream str;
|
---|
1338 |
|
---|
1339 | //extract the file name only (no path) from the full name
|
---|
1340 | str << "File: " << currentFile.substr(currentFile.find_last_of("//")+1, currentFile.size()) << "\n";
|
---|
1341 | str << "Calibration: " << currentCalibFile.substr(currentCalibFile.find_last_of("//")+1, currentCalibFile.size()) << "\n";
|
---|
1342 | // fileLoadedLabel->setText(QString(str.str().c_str()));
|
---|
1343 | // str.str("");
|
---|
1344 | str << "Run number: " << GLWindow->runNumber << "\n";
|
---|
1345 | // runNumberLabel->setText(QString(str.str().c_str()));
|
---|
1346 | // str.str("");
|
---|
1347 | str << "Number of Events: " << GLWindow->nRows << "\n";
|
---|
1348 |
|
---|
1349 | displayingEventBox->setMaximum(GLWindow->nRows-1);
|
---|
1350 |
|
---|
1351 | str << "Number of Slices: " << GLWindow->nRoi << "\n";// << "/1024";
|
---|
1352 | // numberOfSlicesLabel->setText(QString(str.str().c_str()));
|
---|
1353 | // str.str("");
|
---|
1354 | str << "Number of Time Marks: " << GLWindow->nTM << "\n";
|
---|
1355 | // numberOfTimeMarksLabel->setText(QString(str.str().c_str()));
|
---|
1356 |
|
---|
1357 | // str.str("");
|
---|
1358 | str << "Run Type: " << GLWindow->runType << "\n";
|
---|
1359 | // runTypeLabel->setText(QString(str.str().c_str()));
|
---|
1360 | // str.str("");
|
---|
1361 | str << "Time of 1st data: " << GLWindow->firstDataTime << "\n";
|
---|
1362 | // firstTimeLabel->setText(QString(str.str().c_str()));
|
---|
1363 | // str.str("");
|
---|
1364 | str << "Time of last data: " << GLWindow->lastDataTime << "\n";
|
---|
1365 | // lastTimeLabel->setText(QString(str.str().c_str()));
|
---|
1366 | // str.str("");
|
---|
1367 | str << "SVN revision: " << GLWindow->revision << '\n';
|
---|
1368 | str << "Number of boards: " << GLWindow->nBoards << '\n';
|
---|
1369 | str << "Number of pixels: " << GLWindow->nPixels << '\n';
|
---|
1370 | str << "Number of Slices TM: " << GLWindow->nRoiTM << '\n';
|
---|
1371 | str << "Time system: " << GLWindow->timeSystem << '\n';
|
---|
1372 | str << "Date: " << GLWindow->creationDate << '\n';
|
---|
1373 | str << "Night: " << GLWindow->nightInt << '\n';
|
---|
1374 | str << "Camera: " << GLWindow->camera << '\n';
|
---|
1375 | str << "DAQ: " << GLWindow->daq << '\n';
|
---|
1376 | str << "ADC Count: " << GLWindow->adcCount << '\n';
|
---|
1377 | str << "NB Evts OK:" << GLWindow->nbOk << '\n';
|
---|
1378 | str << "NB Evts Rejected: " << GLWindow->nbRej << '\n';
|
---|
1379 | str << "NB Evts Bad: " << GLWindow->nbBad << '\n';
|
---|
1380 | extraInfoLabel->setText(QString(str.str().c_str()));
|
---|
1381 |
|
---|
1382 | /*
|
---|
1383 | if (GLWindow->calibrationLoaded)
|
---|
1384 | {
|
---|
1385 | drawCalibrationCheckBox->setEnabled(true);
|
---|
1386 | }*/
|
---|
1387 |
|
---|
1388 |
|
---|
1389 | }
|
---|
1390 | /************************************************************
|
---|
1391 | * PLAY PAUSE CLICKED. ui handler
|
---|
1392 | ************************************************************/
|
---|
1393 | void UIConnector::playPauseClicked()
|
---|
1394 | {
|
---|
1395 | if (timer.isActive())
|
---|
1396 | timer.stop();
|
---|
1397 | else
|
---|
1398 | timer.start();
|
---|
1399 | }
|
---|
1400 | /************************************************************
|
---|
1401 | * CURRENT SLICE HAS CHANGE. ui handler
|
---|
1402 | ************************************************************/
|
---|
1403 | void UIConnector::currentSliceHasChanged(int slice)
|
---|
1404 | {
|
---|
1405 | if (!GLWindow->nRoi)
|
---|
1406 | return;
|
---|
1407 | // str << "Displaying Slice " << slice;
|
---|
1408 | // QString qstr(str.str().c_str());
|
---|
1409 | if (updateSpinnerDisplay)
|
---|
1410 | displayingSliceBox->setValue(slice);
|
---|
1411 |
|
---|
1412 | ostringstream str;
|
---|
1413 | str << "Current Pixel val.: " << GLWindow->eventData[GLWindow->nRoi*GLWindow->selectedPixel + GLWindow->whichSlice];
|
---|
1414 | currentPixelValue->setText(QString(str.str().c_str()));
|
---|
1415 |
|
---|
1416 | }
|
---|
1417 | /************************************************************
|
---|
1418 | * CURRENT EVENT HAS CHANGED. ui handler
|
---|
1419 | ************************************************************/
|
---|
1420 | double xval[50000];
|
---|
1421 | double yval[50000];
|
---|
1422 | void UIConnector::on_displayingEventBox_valueChanged(int cEvent)
|
---|
1423 | {
|
---|
1424 | // cout << "Here " << updateSpinnerDisplay << endl;
|
---|
1425 | if (!updateSpinnerDisplay)
|
---|
1426 | return;
|
---|
1427 | updateSpinnerDisplay = false;
|
---|
1428 | // currentEventHasChanged(cEvent);
|
---|
1429 | GLWindow->rowNum = cEvent - GLWindow->eventStep;
|
---|
1430 | GLWindow->eventStepping(true);
|
---|
1431 | updateSpinnerDisplay = true;
|
---|
1432 |
|
---|
1433 | // GLWindow->updateGL();
|
---|
1434 | }
|
---|
1435 | void UIConnector::on_displayingSliceBox_valueChanged(int cSlice)
|
---|
1436 | {
|
---|
1437 | updateSpinnerDisplay = false;
|
---|
1438 | currentSliceHasChanged(cSlice);
|
---|
1439 | updateSpinnerDisplay = true;
|
---|
1440 | GLWindow->whichSlice = cSlice;
|
---|
1441 | GLWindow->updateGL();
|
---|
1442 | }
|
---|
1443 | void UIConnector::currentEventHasChanged(int )
|
---|
1444 | {
|
---|
1445 | ostringstream str;
|
---|
1446 | // str << "Displaying Event " << cEvent;
|
---|
1447 | // QString qstr(str.str().c_str());
|
---|
1448 | // emit updateCurrentEventDisplay(qstr);
|
---|
1449 | if (updateSpinnerDisplay)
|
---|
1450 | {
|
---|
1451 | updateSpinnerDisplay = false;
|
---|
1452 | displayingEventBox->setValue(GLWindow->rowNum);
|
---|
1453 | updateSpinnerDisplay = true;
|
---|
1454 | }
|
---|
1455 |
|
---|
1456 | // GLWindow->doWaveLetOnCurrentEventPlease();
|
---|
1457 |
|
---|
1458 | //retrieve the data that we want to display
|
---|
1459 | boost::posix_time::ptime hrTime( boost::gregorian::date(1970, boost::gregorian::Jan, 1),
|
---|
1460 | boost::posix_time::seconds(GLWindow->pcTime[0]) + boost::posix_time::microsec(GLWindow->pcTime[1]));
|
---|
1461 |
|
---|
1462 | str.str("");
|
---|
1463 | str << "PC Time: " << boost::posix_time::to_iso_extended_string(hrTime);
|
---|
1464 | PCTimeLabel->setText(QString(str.str().c_str()));
|
---|
1465 |
|
---|
1466 | str.str("");
|
---|
1467 | str << "Software Trigger: " << GLWindow->softTrig;
|
---|
1468 | softwareTriggerLabel->setText(QString(str.str().c_str()));
|
---|
1469 |
|
---|
1470 | str.str("");
|
---|
1471 | str << "Trigger Type: " << GLWindow->triggerType;
|
---|
1472 | triggerTypeLabel->setText(QString(str.str().c_str()));
|
---|
1473 |
|
---|
1474 | str.str("");
|
---|
1475 | str << "Current Pixel val.: " << GLWindow->eventData[GLWindow->nRoi*GLWindow->selectedPixel + GLWindow->whichSlice];
|
---|
1476 | currentPixelValue->setText(QString(str.str().c_str()));
|
---|
1477 |
|
---|
1478 | if (autoScaleColor->isChecked())
|
---|
1479 | emit GLWindow->colorPaletteHasChanged();//autoScalePressed();
|
---|
1480 |
|
---|
1481 | boardsTimeList->clear();
|
---|
1482 | startPixelsList->clear();
|
---|
1483 | startTimeMarksList->clear();
|
---|
1484 | triggerDelayList->clear();
|
---|
1485 | std::map<int, int> boardsHistoMap;
|
---|
1486 | for (int i=0;i <NBOARDS; i++)
|
---|
1487 | {
|
---|
1488 | str.str("");
|
---|
1489 | str << i;
|
---|
1490 | if (i<10) str << " ";
|
---|
1491 | if (i<100) str << " ";
|
---|
1492 | if (i<1000) str << " ";
|
---|
1493 | str << ": " << GLWindow->boardTime[i];
|
---|
1494 | boardsTimeList->addItem(QString(str.str().c_str()));
|
---|
1495 | if (boardsHistoMap.find(GLWindow->boardTime[i]) != boardsHistoMap.end())
|
---|
1496 | boardsHistoMap[GLWindow->boardTime[i]]++;
|
---|
1497 | else
|
---|
1498 | boardsHistoMap[GLWindow->boardTime[i]] = 1;
|
---|
1499 | }
|
---|
1500 | std::map<int, int> pixelHistoMap;
|
---|
1501 | for (int i=0;i <NPIX; i++)
|
---|
1502 | {
|
---|
1503 | str.str("");
|
---|
1504 | str << i;
|
---|
1505 | if (i<10) str << " ";
|
---|
1506 | if (i<100) str << " ";
|
---|
1507 | if (i<1000) str << " ";
|
---|
1508 | str << ": " << GLWindow->startPix[i];
|
---|
1509 | startPixelsList->addItem(QString(str.str().c_str()));
|
---|
1510 | if (pixelHistoMap.find(GLWindow->startPix[i]) != pixelHistoMap.end())
|
---|
1511 | pixelHistoMap[GLWindow->startPix[i]]++;
|
---|
1512 | else
|
---|
1513 | pixelHistoMap[GLWindow->startPix[i]] = 1;
|
---|
1514 | }
|
---|
1515 |
|
---|
1516 | std::map<int, int> timeMarksMap;
|
---|
1517 | for (int i=0;i <NTMARK; i++)
|
---|
1518 | {
|
---|
1519 | str.str("");
|
---|
1520 | str << i;
|
---|
1521 | if (i<10) str << " ";
|
---|
1522 | if (i<100) str << " ";
|
---|
1523 | if (i<1000) str << " ";
|
---|
1524 | str << ": " << GLWindow->startTM[i];
|
---|
1525 | startTimeMarksList->addItem(QString(str.str().c_str()));
|
---|
1526 | if (timeMarksMap.find(GLWindow->startTM[i]) != timeMarksMap.end())
|
---|
1527 | timeMarksMap[GLWindow->startTM[i]]++;
|
---|
1528 | else
|
---|
1529 | timeMarksMap[GLWindow->startTM[i]] = 1;
|
---|
1530 | }
|
---|
1531 | std::map<int,int> delayMap;
|
---|
1532 | triggerDelayList->addItem(QString("Patch | Slice:Delay Slice:Delay..."));
|
---|
1533 | for (int i=0;i<NTMARK; i++)
|
---|
1534 | {
|
---|
1535 | str.str("");
|
---|
1536 | str << i << " | ";
|
---|
1537 | for (int j=0;j<GLWindow->nRoi;j++)
|
---|
1538 | {
|
---|
1539 | int value = GLWindow->eventData[1440*GLWindow->nRoi + i*GLWindow->nRoi + j];
|
---|
1540 | if (delayMap.find(value) != delayMap.end())
|
---|
1541 | delayMap[value]++;
|
---|
1542 | else
|
---|
1543 | delayMap[value] = 1;
|
---|
1544 | str << j << ":" << value << " ";
|
---|
1545 | }
|
---|
1546 | triggerDelayList->addItem(QString(str.str().c_str()));
|
---|
1547 | }
|
---|
1548 |
|
---|
1549 | std::map<int,int>::iterator it = boardsHistoMap.begin();
|
---|
1550 | int nsamples = 0;
|
---|
1551 | int previousValue = it->first-10;
|
---|
1552 | for (unsigned int i=0;i<boardsHistoMap.size();i++)
|
---|
1553 | {
|
---|
1554 | if (previousValue != it->first-1)
|
---|
1555 | {
|
---|
1556 | xval[nsamples] = previousValue+1;
|
---|
1557 | yval[nsamples] = 0;
|
---|
1558 | nsamples++;
|
---|
1559 | xval[nsamples] = it->first-1;
|
---|
1560 | yval[nsamples] = 0;
|
---|
1561 | nsamples++;
|
---|
1562 | }
|
---|
1563 | xval[nsamples] = it->first;
|
---|
1564 | yval[nsamples] = it->second;
|
---|
1565 | previousValue = it->first;
|
---|
1566 | it++;
|
---|
1567 | nsamples++;
|
---|
1568 | xval[nsamples] = previousValue;
|
---|
1569 | yval[nsamples] = 0;
|
---|
1570 | nsamples++;
|
---|
1571 | if (nsamples > 4090)
|
---|
1572 | {
|
---|
1573 | cout << "Error: Maximum number of samples reached for histograms. skipping what's remaining" << endl;
|
---|
1574 | break;
|
---|
1575 | }
|
---|
1576 | }
|
---|
1577 | xval[nsamples] = it==boardsHistoMap.begin() ? 0 : (--it)->first+1;
|
---|
1578 | yval[nsamples] = 0;
|
---|
1579 | nsamples++;
|
---|
1580 | // if (nsamples > 5)
|
---|
1581 | #if QWT_VERSION < 0x060000
|
---|
1582 | boardsTimeHistoItem.setData(xval, yval, nsamples);
|
---|
1583 | #else
|
---|
1584 | boardsTimeHistoItem.setSamples(xval, yval, nsamples);
|
---|
1585 | #endif
|
---|
1586 |
|
---|
1587 | it = pixelHistoMap.begin();
|
---|
1588 | nsamples = 0;
|
---|
1589 | previousValue = it->first-10;
|
---|
1590 | for (unsigned int i=0;i<pixelHistoMap.size();i++)
|
---|
1591 | {
|
---|
1592 | if (previousValue != it->first-1)
|
---|
1593 | {
|
---|
1594 | xval[nsamples] = previousValue+1;
|
---|
1595 | yval[nsamples] = 0;
|
---|
1596 | nsamples++;
|
---|
1597 | xval[nsamples] = it->first-1;
|
---|
1598 | yval[nsamples] = 0;
|
---|
1599 | nsamples++;
|
---|
1600 | }
|
---|
1601 | xval[nsamples] = it->first;
|
---|
1602 | yval[nsamples] = it->second;
|
---|
1603 | previousValue = it->first;
|
---|
1604 | it++;
|
---|
1605 | nsamples++;
|
---|
1606 | xval[nsamples] = previousValue;
|
---|
1607 | yval[nsamples] = 0;
|
---|
1608 | nsamples++;
|
---|
1609 | if (nsamples > 4090)
|
---|
1610 | {
|
---|
1611 | cout << "Error: Maximum number of samples reached for histograms. skipping what's remaining" << endl;
|
---|
1612 | break;
|
---|
1613 | }
|
---|
1614 | }
|
---|
1615 | xval[nsamples] = it==pixelHistoMap.begin() ? 0 : (--it)->first+1;
|
---|
1616 | yval[nsamples] = 0;
|
---|
1617 | nsamples++;
|
---|
1618 | // if (nsamples > 5)
|
---|
1619 | #if QWT_VERSION < 0x060000
|
---|
1620 | startCellHistoItem.setData(xval, yval, nsamples);
|
---|
1621 | #else
|
---|
1622 | startCellHistoItem.setSamples(xval, yval, nsamples);
|
---|
1623 | #endif
|
---|
1624 |
|
---|
1625 | it = timeMarksMap.begin();
|
---|
1626 | nsamples = 0;
|
---|
1627 | previousValue = it->first-10;
|
---|
1628 | for (unsigned int i=0;i<timeMarksMap.size();i++)
|
---|
1629 | {
|
---|
1630 | if (previousValue != it->first-1)
|
---|
1631 | {
|
---|
1632 | xval[nsamples] = previousValue+1;
|
---|
1633 | yval[nsamples] = 0;
|
---|
1634 | nsamples++;
|
---|
1635 | xval[nsamples] = it->first-1;
|
---|
1636 | yval[nsamples] = 0;
|
---|
1637 | nsamples++;
|
---|
1638 | }
|
---|
1639 | xval[nsamples] = it->first;
|
---|
1640 | yval[nsamples] = it->second;
|
---|
1641 | previousValue = it->first;
|
---|
1642 | it++;
|
---|
1643 | nsamples++;
|
---|
1644 | xval[nsamples] = previousValue;
|
---|
1645 | yval[nsamples] = 0;
|
---|
1646 | nsamples++;
|
---|
1647 | if (nsamples > 4090)
|
---|
1648 | {
|
---|
1649 | cout << "Error: Maximum number of samples reached for histograms. skipping what's remaining" << endl;
|
---|
1650 | break;
|
---|
1651 | }
|
---|
1652 | }
|
---|
1653 | xval[nsamples] = it==timeMarksMap.begin() ? 0 : (--it)->first+1;
|
---|
1654 | yval[nsamples] = 0;
|
---|
1655 | nsamples++;
|
---|
1656 | // if (nsamples > 5)
|
---|
1657 | #if QWT_VERSION < 0x060000
|
---|
1658 | startTimeMarkHistoItem.setData(xval, yval, nsamples);
|
---|
1659 | #else
|
---|
1660 | startTimeMarkHistoItem.setSamples(xval, yval, nsamples);
|
---|
1661 | #endif
|
---|
1662 |
|
---|
1663 | it = delayMap.begin();
|
---|
1664 | nsamples = 0;
|
---|
1665 | previousValue = it->first-10;
|
---|
1666 | for (unsigned int i=0;i<delayMap.size();i++)
|
---|
1667 | {
|
---|
1668 | if (previousValue != it->first-1)
|
---|
1669 | {
|
---|
1670 | xval[nsamples] = previousValue+1;
|
---|
1671 | yval[nsamples] = 0;
|
---|
1672 | nsamples++;
|
---|
1673 | xval[nsamples] = it->first-1;
|
---|
1674 | yval[nsamples] = 0;
|
---|
1675 | nsamples++;
|
---|
1676 | }
|
---|
1677 | xval[nsamples] = it->first;
|
---|
1678 | yval[nsamples] = it->second;
|
---|
1679 | previousValue = it->first;
|
---|
1680 | it++;
|
---|
1681 | nsamples++;
|
---|
1682 | xval[nsamples] = previousValue;
|
---|
1683 | yval[nsamples] = 0;
|
---|
1684 | nsamples++;
|
---|
1685 | if (nsamples > 4090)
|
---|
1686 | {
|
---|
1687 | cout << "Error: Maximum number of samples reached for histograms. skipping what's remaining" << endl;
|
---|
1688 | break;
|
---|
1689 | }
|
---|
1690 | }
|
---|
1691 | xval[nsamples] = it==delayMap.begin() ? 0 : (--it)->first+1;
|
---|
1692 | yval[nsamples] = 0;
|
---|
1693 | nsamples++;
|
---|
1694 | // if (nsamples > 5)
|
---|
1695 | #if QWT_VERSION < 0x060000
|
---|
1696 | triggerDelayHistoItem.setData(xval, yval, nsamples);
|
---|
1697 | #else
|
---|
1698 | triggerDelayHistoItem.setSamples(xval, yval, nsamples);
|
---|
1699 | #endif
|
---|
1700 | //WAVELETS HACK
|
---|
1701 | /* std::map<int, int> valuesHistoMap;
|
---|
1702 | std::map<int, int> waveletHistoMap;
|
---|
1703 | for (int i=0;i<1024*1440;i++)
|
---|
1704 | {
|
---|
1705 | if (valuesHistoMap.find(GLWindow->rawEventData[i]) != valuesHistoMap.end())
|
---|
1706 | valuesHistoMap[GLWindow->rawEventData[i]]++;
|
---|
1707 | else
|
---|
1708 | valuesHistoMap[GLWindow->rawEventData[i]] = 1;
|
---|
1709 | if (waveletHistoMap.find(GLWindow->waveLetArray[i]) != waveletHistoMap.end())
|
---|
1710 | waveletHistoMap[GLWindow->waveLetArray[i]]++;
|
---|
1711 | else
|
---|
1712 | waveletHistoMap[GLWindow->waveLetArray[i]] = 1;
|
---|
1713 | }
|
---|
1714 |
|
---|
1715 | it = valuesHistoMap.begin();
|
---|
1716 | nsamples = 0;
|
---|
1717 | previousValue = it->first-10;
|
---|
1718 | cout << "Num values Original: " << valuesHistoMap.size() << endl;
|
---|
1719 | for (unsigned int i=0;i<valuesHistoMap.size();i++)
|
---|
1720 | {
|
---|
1721 | if (previousValue != it->first-1)
|
---|
1722 | {
|
---|
1723 | xval[nsamples] = previousValue+1;
|
---|
1724 | yval[nsamples] = 0;
|
---|
1725 | nsamples++;
|
---|
1726 | xval[nsamples] = it->first-1;
|
---|
1727 | yval[nsamples] = 0;
|
---|
1728 | nsamples++;
|
---|
1729 | }
|
---|
1730 | xval[nsamples] = it->first;
|
---|
1731 | yval[nsamples] = it->second;
|
---|
1732 | previousValue = it->first;
|
---|
1733 | it++;
|
---|
1734 | nsamples++;
|
---|
1735 | xval[nsamples] = previousValue;
|
---|
1736 | yval[nsamples] = 0;
|
---|
1737 | nsamples++;
|
---|
1738 | if (nsamples > 50000)
|
---|
1739 | {
|
---|
1740 | cout << "Error: Maximum number of samples reached for histograms. skipping what's remaining" << endl;
|
---|
1741 | break;
|
---|
1742 | }
|
---|
1743 | }
|
---|
1744 | xval[nsamples] = it==valuesHistoMap.begin() ? 0 : (--it)->first+1;
|
---|
1745 | yval[nsamples] = 0;
|
---|
1746 | nsamples++;
|
---|
1747 | // if (nsamples > 5)
|
---|
1748 | #if QWT_VERSION < 0x060000
|
---|
1749 | triggerDelayHistoItem.setData(xval, yval, nsamples);
|
---|
1750 | #else
|
---|
1751 | triggerDelayHistoItem.setSamples(xval, yval, nsamples);
|
---|
1752 | #endif
|
---|
1753 |
|
---|
1754 | it = waveletHistoMap.begin();
|
---|
1755 | nsamples = 0;
|
---|
1756 | previousValue = it->first-10;
|
---|
1757 | cout << "Num values WaveLets: " << waveletHistoMap.size() << endl;
|
---|
1758 | for (unsigned int i=0;i<waveletHistoMap.size();i++)
|
---|
1759 | {
|
---|
1760 | if (previousValue != it->first-1)
|
---|
1761 | {
|
---|
1762 | xval[nsamples] = previousValue+1;
|
---|
1763 | yval[nsamples] = 0;
|
---|
1764 | nsamples++;
|
---|
1765 | xval[nsamples] = it->first-1;
|
---|
1766 | yval[nsamples] = 0;
|
---|
1767 | nsamples++;
|
---|
1768 | }
|
---|
1769 | xval[nsamples] = it->first;
|
---|
1770 | yval[nsamples] = it->second;
|
---|
1771 | previousValue = it->first;
|
---|
1772 | it++;
|
---|
1773 | nsamples++;
|
---|
1774 | xval[nsamples] = previousValue;
|
---|
1775 | yval[nsamples] = 0;
|
---|
1776 | nsamples++;
|
---|
1777 | if (nsamples > 50000)
|
---|
1778 | {
|
---|
1779 | cout << "Error: Maximum number of samples reached for histograms. skipping what's remaining" << endl;
|
---|
1780 | break;
|
---|
1781 | }
|
---|
1782 | }
|
---|
1783 | xval[nsamples] = it==waveletHistoMap.begin() ? 0 : (--it)->first+1;
|
---|
1784 | yval[nsamples] = 0;
|
---|
1785 | nsamples++;
|
---|
1786 | // if (nsamples > 5)
|
---|
1787 | #if QWT_VERSION < 0x060000
|
---|
1788 | startTimeMarkHistoItem.setData(xval, yval, nsamples);
|
---|
1789 | #else
|
---|
1790 | startTimeMarkHistoItem.setSamples(xval, yval, nsamples);
|
---|
1791 | #endif
|
---|
1792 | */
|
---|
1793 | //END OF WAVELETS HACK
|
---|
1794 | // startCellHistoZoom->setZoomBase(startCellHistoItem.boundingRect());
|
---|
1795 | QStack< QRectF > stack;
|
---|
1796 | // QRectF cRectangle = boardsTimeHistoItem.boundingRect();
|
---|
1797 | stack.push(scaleBoundingRectangle(boardsTimeHistoItem.boundingRect(), 1.05f));//cRectangle);//boardsTimeHistoItem.boundingRect());
|
---|
1798 | boardsTimeHistoZoom->setZoomStack(stack);
|
---|
1799 | stack.pop();
|
---|
1800 | stack.push(scaleBoundingRectangle(startCellHistoItem.boundingRect(), 1.05f));
|
---|
1801 | startCellHistoZoom->setZoomStack(stack);
|
---|
1802 | stack.pop();
|
---|
1803 | stack.push(scaleBoundingRectangle(startTimeMarkHistoItem.boundingRect(), 1.05f));
|
---|
1804 | startTimeMarkHistoZoom->setZoomStack(stack);
|
---|
1805 | stack.pop();
|
---|
1806 | stack.push(scaleBoundingRectangle(triggerDelayHistoItem.boundingRect(), 1.05f));
|
---|
1807 | triggerDelayHistoZoom->setZoomStack(stack);
|
---|
1808 | stack.pop();
|
---|
1809 | pixelChanged(GLWindow->selectedPixel);
|
---|
1810 | }
|
---|
1811 | //can't use a ref to rectangle, as the type must be converted first
|
---|
1812 | QRectF UIConnector::scaleBoundingRectangle(QRectF rectangle, float scale)
|
---|
1813 | {
|
---|
1814 | QPointF bottomRight = rectangle.bottomRight();
|
---|
1815 | QPointF topLeft = rectangle.topLeft();
|
---|
1816 | QPointF center = rectangle.center();
|
---|
1817 | return QRectF(topLeft + (topLeft-center)*(scale-1.0f), //top left
|
---|
1818 | bottomRight + (bottomRight-center)*(scale-1.0f)); //bottom right
|
---|
1819 | }
|
---|
1820 | void UIConnector::initHistograms()
|
---|
1821 | {
|
---|
1822 | // QwtPlot* boardsTimeHisto;
|
---|
1823 | // QwtPlotHistogram boardsTimeHistoItem;
|
---|
1824 | QwtPlotGrid* grid = new QwtPlotGrid;
|
---|
1825 | grid->enableX(false);
|
---|
1826 | grid->enableY(true);
|
---|
1827 | grid->enableXMin(false);
|
---|
1828 | grid->enableYMin(false);
|
---|
1829 | grid->setMajPen(QPen(Qt::black, 0, Qt::DotLine));
|
---|
1830 | grid->attach(boardsTimeHisto);
|
---|
1831 |
|
---|
1832 | grid = new QwtPlotGrid;
|
---|
1833 | grid->enableX(false);
|
---|
1834 | grid->enableY(true);
|
---|
1835 | grid->enableXMin(false);
|
---|
1836 | grid->enableYMin(false);
|
---|
1837 | grid->setMajPen(QPen(Qt::black, 0, Qt::DotLine));
|
---|
1838 | grid->attach(startCellsHisto);
|
---|
1839 |
|
---|
1840 | grid = new QwtPlotGrid;
|
---|
1841 | grid->enableX(false);
|
---|
1842 | grid->enableY(true);
|
---|
1843 | grid->enableXMin(false);
|
---|
1844 | grid->enableYMin(false);
|
---|
1845 | grid->setMajPen(QPen(Qt::black, 0, Qt::DotLine));
|
---|
1846 | grid->attach(startTimeMarkHisto);
|
---|
1847 |
|
---|
1848 | grid = new QwtPlotGrid;
|
---|
1849 | grid->enableX(false);
|
---|
1850 | grid->enableY(true);
|
---|
1851 | grid->enableXMin(false);
|
---|
1852 | grid->enableYMin(false);
|
---|
1853 | grid->setMajPen(QPen(Qt::black, 0, Qt::DotLine));
|
---|
1854 | grid->attach(pixelValueCurve);
|
---|
1855 |
|
---|
1856 | grid = new QwtPlotGrid;
|
---|
1857 | grid->enableX(false);
|
---|
1858 | grid->enableY(true);
|
---|
1859 | grid->enableXMin(false);
|
---|
1860 | grid->enableYMin(false);
|
---|
1861 | grid->setMajPen(QPen(Qt::black, 0, Qt::DotLine));
|
---|
1862 | grid->attach(triggerDelayHisto);
|
---|
1863 |
|
---|
1864 | boardsTimeHisto->setAutoReplot(true);
|
---|
1865 | startCellsHisto->setAutoReplot(true);
|
---|
1866 | startTimeMarkHisto->setAutoReplot(true);
|
---|
1867 | pixelValueCurve->setAutoReplot(true);
|
---|
1868 | triggerDelayHisto->setAutoReplot(true);
|
---|
1869 | boardsTimeHisto->setTitle("Boards time values");
|
---|
1870 | startCellsHisto->setTitle("Start Cell values");
|
---|
1871 | startTimeMarkHisto->setTitle("Start Time Marks values");
|
---|
1872 | pixelValueCurve->setTitle("Current pixel values");
|
---|
1873 | triggerDelayHisto->setTitle("Trigger Delays");
|
---|
1874 |
|
---|
1875 | // boardsTimeHistoItem.setBrush(QBrush(Qt::red));
|
---|
1876 | // startCellHistoItem.setBrush(QBrush(Qt::red));
|
---|
1877 | // startTimeMarkHistoItem.setBrush(QBrush(Qt::red));
|
---|
1878 | // triggerDelayHistoItem.setBrush(QBrush(Qt::red));
|
---|
1879 | // pixelValueCurveItem.setBrush(QBrush(Qt::red));
|
---|
1880 |
|
---|
1881 | boardsTimeHistoItem.setPen(QColor(Qt::darkGreen));
|
---|
1882 | boardsTimeHistoItem.setStyle(QwtPlotCurve::Steps);
|
---|
1883 | startCellHistoItem.setPen(QColor(Qt::darkGreen));
|
---|
1884 | startCellHistoItem.setStyle(QwtPlotCurve::Steps);
|
---|
1885 | startTimeMarkHistoItem.setPen(QColor(Qt::darkGreen));
|
---|
1886 | startTimeMarkHistoItem.setStyle(QwtPlotCurve::Steps);
|
---|
1887 | triggerDelayHistoItem.setPen(QColor(Qt::darkGreen));
|
---|
1888 | triggerDelayHistoItem.setStyle(QwtPlotCurve::Steps);
|
---|
1889 |
|
---|
1890 | boardsTimeHistoItem.attach(boardsTimeHisto);
|
---|
1891 | startCellHistoItem.attach(startCellsHisto);
|
---|
1892 | startTimeMarkHistoItem.attach(startTimeMarkHisto);
|
---|
1893 | triggerDelayHistoItem.attach(triggerDelayHisto);
|
---|
1894 |
|
---|
1895 | //curve
|
---|
1896 | // pixelValueCurveItem.setSymbol(new QwtSymbol(QwtSymbol::Cross, Qt::NoBrush, QPen(Qt::black), QSize(5,5)));
|
---|
1897 | pixelValueCurveItem.setPen(QColor(Qt::black));
|
---|
1898 | aMeanCurveItem.setPen(QColor(Qt::darkGreen));
|
---|
1899 | vCorrCurveItem.setPen(QColor(Qt::red));
|
---|
1900 | meanCurveItem.setPen(QColor(Qt::blue));
|
---|
1901 | pixelValueCurveItem.setStyle(QwtPlotCurve::Lines);
|
---|
1902 | aMeanCurveItem.setStyle(QwtPlotCurve::Lines);
|
---|
1903 | vCorrCurveItem.setStyle(QwtPlotCurve::Lines);
|
---|
1904 | meanCurveItem.setStyle(QwtPlotCurve::Lines);
|
---|
1905 |
|
---|
1906 | // pixelValueCurveItem.setCurveAttribute(QwtPlotCurve::Fitted);
|
---|
1907 | pixelValueCurveItem.attach(pixelValueCurve);
|
---|
1908 | // aMeanCurveItem.attach(pixelValueCurve);
|
---|
1909 | // vCorrCurveItem.attach(pixelValueCurve);
|
---|
1910 | // meanCurveItem.attach(pixelValueCurve);
|
---|
1911 |
|
---|
1912 | //FIXME delete these pointers with the destructor
|
---|
1913 | curveZoom = new QwtPlotZoomer(pixelValueCurve->canvas());
|
---|
1914 | curveZoom->setRubberBandPen(QPen(Qt::gray, 2, Qt::DotLine));
|
---|
1915 | curveZoom->setTrackerPen(QPen(Qt::gray));
|
---|
1916 |
|
---|
1917 | boardsTimeHistoZoom = new QwtPlotZoomer(boardsTimeHisto->canvas());
|
---|
1918 | boardsTimeHistoZoom->setRubberBandPen(QPen(Qt::gray, 2, Qt::DotLine));
|
---|
1919 | boardsTimeHistoZoom->setTrackerPen(QPen(Qt::gray));
|
---|
1920 |
|
---|
1921 | startCellHistoZoom = new QwtPlotZoomer(startCellsHisto->canvas());
|
---|
1922 | startCellHistoZoom->setRubberBandPen(QPen(Qt::gray, 2, Qt::DotLine));
|
---|
1923 | startCellHistoZoom->setTrackerPen(QPen(Qt::gray));
|
---|
1924 |
|
---|
1925 | startTimeMarkHistoZoom = new QwtPlotZoomer(startTimeMarkHisto->canvas());
|
---|
1926 | startTimeMarkHistoZoom->setRubberBandPen(QPen(Qt::gray, 2, Qt::DotLine));
|
---|
1927 | startTimeMarkHistoZoom->setTrackerPen(QPen(Qt::gray));
|
---|
1928 |
|
---|
1929 | triggerDelayHistoZoom = new QwtPlotZoomer(triggerDelayHisto->canvas());
|
---|
1930 | triggerDelayHistoZoom->setRubberBandPen(QPen(Qt::gray, 2, Qt::DotLine));
|
---|
1931 | triggerDelayHistoZoom->setTrackerPen(QPen(Qt::gray));
|
---|
1932 |
|
---|
1933 |
|
---|
1934 | }
|
---|
1935 | void UIConnector::pixelChanged(int pixel)
|
---|
1936 | {
|
---|
1937 | pixel = GLWindow->hardwareMapping[pixel];
|
---|
1938 | HwIDBox->setValue(pixel);
|
---|
1939 |
|
---|
1940 | if (!GLWindow->nRoi)
|
---|
1941 | return;
|
---|
1942 |
|
---|
1943 | for (int i=0;i<GLWindow->nRoi;i++)
|
---|
1944 | {
|
---|
1945 | xval[i] = i;
|
---|
1946 | #ifdef LOAD_RAW
|
---|
1947 | yval[i] = eventsData[0][pixel][i];
|
---|
1948 | #else
|
---|
1949 | yval[i] = GLWindow->eventData[GLWindow->nRoi*pixel + i];
|
---|
1950 | #endif
|
---|
1951 | }
|
---|
1952 |
|
---|
1953 | // GLWindow->computePulsesStatistics();
|
---|
1954 | #if QWT_VERSION < 0x060000
|
---|
1955 | pixelValueCurveItem.setData(xval, yval, GLWindow->nRoi);
|
---|
1956 | //// aMeanCurveItem.setData(xval, GLWindow->aMeas, GLWindow->nRoi);
|
---|
1957 | // meanCurveItem.setData(xval, GLWindow->n1mean, GLWindow->nRoi);
|
---|
1958 | // vCorrCurveItem.setData(xval, GLWindow->vCorr, GLWindow->nRoi-3);
|
---|
1959 | #else
|
---|
1960 | pixelValueCurveItem.setSamples(xval, yval, GLWindow->nRoi);
|
---|
1961 | // aMeanCurveItem.setSamples(xval, GLWindow->aMeas, GLWindow->nRoi);
|
---|
1962 | // meanCurveItem.setSamples(xval, GLWindow->n1mean, GLWindow->nRoi);
|
---|
1963 | // vCorrCurveItem.setSamples(xval, GLWindow->vCorr, GLWindow->nRoi-3);
|
---|
1964 | #endif
|
---|
1965 |
|
---|
1966 |
|
---|
1967 | QStack< QRectF > stack;
|
---|
1968 | stack.push(scaleBoundingRectangle(pixelValueCurveItem.boundingRect(), 1.5f));
|
---|
1969 | curveZoom->setZoomStack(stack);
|
---|
1970 | stack.pop();
|
---|
1971 |
|
---|
1972 | ostringstream str;
|
---|
1973 | QString qstr;
|
---|
1974 | str << "Current Pixel val.: " << GLWindow->eventData[GLWindow->nRoi*GLWindow->selectedPixel + GLWindow->whichSlice];
|
---|
1975 | currentPixelValue->setText(qstr.fromStdString(str.str()));
|
---|
1976 | on_autoScaleColor_clicked();
|
---|
1977 | }
|
---|
1978 |
|
---|
1979 | void UIConnector::on_HwIDBox_valueChanged(int)
|
---|
1980 | {
|
---|
1981 | updating = true;
|
---|
1982 |
|
---|
1983 | const int hwID = HwIDBox->value();
|
---|
1984 |
|
---|
1985 | const int crateID = hwID/360;
|
---|
1986 | const int boardID = (hwID%360)/36;
|
---|
1987 | const int patchID = (hwID%36 )/9;
|
---|
1988 | const int pixelID = hwID%9;
|
---|
1989 |
|
---|
1990 | SwIDBox->setValue(GLWindow->softwareMapping[hwID]);
|
---|
1991 |
|
---|
1992 | crateIDBox->setValue(crateID);
|
---|
1993 | boardIDBox->setValue(boardID);
|
---|
1994 | patchIDBox->setValue(patchID);
|
---|
1995 | pixelIDBox->setValue(pixelID);
|
---|
1996 |
|
---|
1997 | updating = false;
|
---|
1998 |
|
---|
1999 | pixelChanged(GLWindow->softwareMapping[hwID]);
|
---|
2000 |
|
---|
2001 | GLWindow->selectedPixel = GLWindow->softwareMapping[hwID];
|
---|
2002 | GLWindow->updateGL();
|
---|
2003 | }
|
---|
2004 |
|
---|
2005 | void UIConnector::cbpxChanged()
|
---|
2006 | {
|
---|
2007 | if (updating)
|
---|
2008 | return;
|
---|
2009 |
|
---|
2010 | const int hwid = crateIDBox->value()*360 + boardIDBox->value()*36 + patchIDBox->value()*9 + pixelIDBox->value();
|
---|
2011 | HwIDBox->setValue(hwid);
|
---|
2012 | }
|
---|
2013 |
|
---|
2014 | void UIConnector::on_SwIDBox_valueChanged(int swid)
|
---|
2015 | {
|
---|
2016 | if (updating)
|
---|
2017 | return;
|
---|
2018 |
|
---|
2019 | HwIDBox->setValue(GLWindow->hardwareMapping[swid]);
|
---|
2020 | }
|
---|
2021 |
|
---|
2022 | void UIConnector::on_autoScaleColor_clicked()
|
---|
2023 | {
|
---|
2024 | if (!autoScaleColor->isChecked())
|
---|
2025 | {
|
---|
2026 | /*
|
---|
2027 | GLWindow->ss[0] = 0;
|
---|
2028 | GLWindow->ss[1] = 0.25;
|
---|
2029 | GLWindow->ss[2] = 0.5;
|
---|
2030 | GLWindow->ss[3] = 0.75;
|
---|
2031 | GLWindow->ss[4] = 1;
|
---|
2032 | range0->setValue(GLWindow->ss[0]);
|
---|
2033 | range1->setValue(GLWindow->ss[1]);
|
---|
2034 | range2->setValue(GLWindow->ss[2]);
|
---|
2035 | range3->setValue(GLWindow->ss[3]);
|
---|
2036 | range4->setValue(GLWindow->ss[4]);
|
---|
2037 | */
|
---|
2038 | return;
|
---|
2039 | }
|
---|
2040 | if (!GLWindow->nRoi)
|
---|
2041 | return;
|
---|
2042 | int start, end;
|
---|
2043 | if (entireCameraScale->isChecked())
|
---|
2044 | {
|
---|
2045 | start = 0;
|
---|
2046 | end = 1440;
|
---|
2047 | }
|
---|
2048 | else
|
---|
2049 | {
|
---|
2050 | start = GLWindow->selectedPixel;
|
---|
2051 | end = GLWindow->selectedPixel+1;
|
---|
2052 | }
|
---|
2053 |
|
---|
2054 | int min = 100000; //real min = -2048, int_16 = -32768 to 32767
|
---|
2055 | int max = -100000; //real max = 2047
|
---|
2056 | long average = 0;
|
---|
2057 | long numSamples = 0;
|
---|
2058 | int errorDetected = -1;
|
---|
2059 | for (int i=start;i<end;i++)
|
---|
2060 | {
|
---|
2061 | for (int j=0;j<GLWindow->nRoi;j++)
|
---|
2062 | {
|
---|
2063 | int cValue = GLWindow->eventData[i*GLWindow->nRoi+j];
|
---|
2064 | if (cValue > max && cValue < 32767)
|
---|
2065 | max = cValue;
|
---|
2066 | if (cValue < min && cValue > -32768)
|
---|
2067 | min = cValue;
|
---|
2068 | if (cValue < 32767 && cValue > -32768)
|
---|
2069 | {
|
---|
2070 | average+=cValue;
|
---|
2071 | numSamples++;
|
---|
2072 | }
|
---|
2073 | else
|
---|
2074 | {
|
---|
2075 | errorDetected = i;
|
---|
2076 | }
|
---|
2077 | // numSamples++;
|
---|
2078 | }
|
---|
2079 | }
|
---|
2080 | average /= numSamples;
|
---|
2081 | if (errorDetected != -1)
|
---|
2082 | {
|
---|
2083 | cout << "Overflow detected at pixel " << errorDetected << " (at least)" << endl;
|
---|
2084 | }
|
---|
2085 | // cout << "min: " << min << " max: " << max << " average: " << average << endl;
|
---|
2086 | double minRange = (double)(min+(VALUES_SPAN/2))/(double)VALUES_SPAN;
|
---|
2087 | double maxRange = (double)(max+(VALUES_SPAN/2))/(double)VALUES_SPAN;
|
---|
2088 | double midRange = (double)(average+(VALUES_SPAN/2))/(double)VALUES_SPAN;
|
---|
2089 | if (GLWindow->logScale)
|
---|
2090 | {
|
---|
2091 | minRange *= 9;
|
---|
2092 | maxRange *= 9;
|
---|
2093 | // midRange *= 9;
|
---|
2094 | minRange += 1;
|
---|
2095 | maxRange += 1;
|
---|
2096 | // midRange += 1;
|
---|
2097 | minRange = log10(minRange);
|
---|
2098 | maxRange = log10(maxRange);
|
---|
2099 | // midRange = (minRange + maxRange)/2.f;
|
---|
2100 | midRange = log10(midRange);
|
---|
2101 | }
|
---|
2102 |
|
---|
2103 | GLWindow->ss[0] = minRange;
|
---|
2104 | colorRange0->setValue(GLWindow->ss[0]);
|
---|
2105 | GLWindow->ss[4] = maxRange;
|
---|
2106 | colorRange4->setValue(GLWindow->ss[4]);
|
---|
2107 | // GLWindow->ss[2] = midRange;
|
---|
2108 | // range2->setValue(GLWindow->ss[2]);
|
---|
2109 | // GLWindow->ss[1] = (minRange+midRange)/2;
|
---|
2110 | // range1->setValue(GLWindow->ss[1]);
|
---|
2111 | // GLWindow->ss[3] = (maxRange+midRange)/2;
|
---|
2112 | // range3->setValue(GLWindow->ss[3]);
|
---|
2113 |
|
---|
2114 | GLWindow->ss[2] = (maxRange+minRange)/2;
|
---|
2115 | colorRange2->setValue(GLWindow->ss[2]);
|
---|
2116 |
|
---|
2117 | GLWindow->ss[1] = minRange+(maxRange-minRange)/4;
|
---|
2118 | colorRange1->setValue(GLWindow->ss[1]);
|
---|
2119 |
|
---|
2120 | GLWindow->ss[3] = minRange+3*(maxRange-minRange)/4;
|
---|
2121 | colorRange3->setValue(GLWindow->ss[3]);
|
---|
2122 | }
|
---|
2123 |
|
---|
2124 | void PrintUsage()
|
---|
2125 | {
|
---|
2126 | cout << "\n"
|
---|
2127 | "The FACT++ raw data viewer.\n"
|
---|
2128 | "\n"
|
---|
2129 | "Usage: viewer [OPTIONS] [datafile.fits[.gz] [calibration.drs.fits[.gz]]]\n"
|
---|
2130 | " or: viewer [OPTIONS]\n";
|
---|
2131 | cout << endl;
|
---|
2132 |
|
---|
2133 | }
|
---|
2134 |
|
---|
2135 | void PrintHelp()
|
---|
2136 | {
|
---|
2137 | cout <<
|
---|
2138 | "\n"
|
---|
2139 | << endl;
|
---|
2140 | }
|
---|
2141 |
|
---|
2142 | int UIConnector::SetupConfiguration(Configuration &conf)
|
---|
2143 | {
|
---|
2144 | RawDataViewer *canvas = GLWindow;
|
---|
2145 |
|
---|
2146 | if (conf.Has("color.range"))
|
---|
2147 | {
|
---|
2148 | vector<double> value = conf.Vec<double>("color.range");
|
---|
2149 | if (value.size() != 5)
|
---|
2150 | {
|
---|
2151 | cout << "Error, colorRange option should have exactly 5 double values" << endl;
|
---|
2152 | return -1;
|
---|
2153 | }
|
---|
2154 | for (int i=0;i<5;i++)
|
---|
2155 | canvas->ss[i] = value[i];
|
---|
2156 | }
|
---|
2157 |
|
---|
2158 | if (conf.Has("color.red"))
|
---|
2159 | {
|
---|
2160 | vector<double> value = conf.Vec<double>("color.red");
|
---|
2161 | if (value.size() != 5)
|
---|
2162 | {
|
---|
2163 | cout << "Error, colorRed option should have exactly 5 double values" << endl;
|
---|
2164 | return -1;
|
---|
2165 | }
|
---|
2166 | for (int i=0;i<5;i++)
|
---|
2167 | canvas->rr[i] = value[i];
|
---|
2168 | }
|
---|
2169 |
|
---|
2170 | if (conf.Has("color.green"))
|
---|
2171 | {
|
---|
2172 | vector<double> value = conf.Vec<double>("color.green");
|
---|
2173 | if (value.size() != 5)
|
---|
2174 | {
|
---|
2175 | cout << "Error, colorGreen option should have exactly 5 double values" << endl;
|
---|
2176 | return -1;
|
---|
2177 | }
|
---|
2178 | for (int i=0;i<5;i++)
|
---|
2179 | canvas->gg[i] = value[i];
|
---|
2180 | }
|
---|
2181 |
|
---|
2182 | if (conf.Has("color.blue"))
|
---|
2183 | {
|
---|
2184 | vector<double> value = conf.Vec<double>("color.blue");
|
---|
2185 | if (value.size() != 5)
|
---|
2186 | {
|
---|
2187 | cout << "Error, colorBlue option should have exactly 5 double values" << endl;
|
---|
2188 | return -1;
|
---|
2189 | }
|
---|
2190 | for (int i=0;i<5;i++)
|
---|
2191 | canvas->bb[i] = value[i];
|
---|
2192 | }
|
---|
2193 |
|
---|
2194 | colorRange0->setValue(canvas->ss[0]);
|
---|
2195 | colorRange1->setValue(canvas->ss[1]);
|
---|
2196 | colorRange2->setValue(canvas->ss[2]);
|
---|
2197 | colorRange3->setValue(canvas->ss[3]);
|
---|
2198 | colorRange4->setValue(canvas->ss[4]);
|
---|
2199 | redValue0->setValue(canvas->rr[0]);
|
---|
2200 | redValue1->setValue(canvas->rr[1]);
|
---|
2201 | redValue2->setValue(canvas->rr[2]);
|
---|
2202 | redValue3->setValue(canvas->rr[3]);
|
---|
2203 | redValue4->setValue(canvas->rr[4]);
|
---|
2204 | greenValue0->setValue(canvas->gg[0]);
|
---|
2205 | greenValue1->setValue(canvas->gg[1]);
|
---|
2206 | greenValue2->setValue(canvas->gg[2]);
|
---|
2207 | greenValue3->setValue(canvas->gg[3]);
|
---|
2208 | greenValue4->setValue(canvas->gg[4]);
|
---|
2209 | blueValue0->setValue(canvas->bb[0]);
|
---|
2210 | blueValue1->setValue(canvas->bb[1]);
|
---|
2211 | blueValue2->setValue(canvas->bb[2]);
|
---|
2212 | blueValue3->setValue(canvas->bb[3]);
|
---|
2213 | blueValue4->setValue(canvas->bb[4]);
|
---|
2214 |
|
---|
2215 | if (conf.Has("file"))
|
---|
2216 | {
|
---|
2217 | const QString qstr(conf.Get<string>("file").c_str());
|
---|
2218 | fileSelected(qstr);
|
---|
2219 | }
|
---|
2220 |
|
---|
2221 | if (conf.Has("drs"))
|
---|
2222 | {
|
---|
2223 | const QString qstr(conf.Get<string>("drs").c_str());
|
---|
2224 | calibFileSelected(qstr);
|
---|
2225 | }
|
---|
2226 |
|
---|
2227 | return 0;
|
---|
2228 | }
|
---|
2229 |
|
---|
2230 | void SetupConfiguration(Configuration& conf)
|
---|
2231 | {
|
---|
2232 | po::options_description configs("Raw Events Viewer Options");
|
---|
2233 | configs.add_options()
|
---|
2234 | ("color.range", vars<double>(), "Range of the display colours")
|
---|
2235 | ("color.red", vars<double>(), "Range of red values")
|
---|
2236 | ("color.green", vars<double>(), "Range of green values")
|
---|
2237 | ("color.blue", vars<double>(), "Range of blue values")
|
---|
2238 | ("file,f", var<string>(), "File to be loaded")
|
---|
2239 | ("drs,d", var<string>(), "DRS calibration file to be loaded")
|
---|
2240 | ;
|
---|
2241 | conf.AddOptions(configs);
|
---|
2242 |
|
---|
2243 | po::positional_options_description p;
|
---|
2244 | p.add("file", 1); // The first positional options
|
---|
2245 | p.add("drs", 2); // The first positional options
|
---|
2246 | conf.SetArgumentPositions(p);
|
---|
2247 |
|
---|
2248 | }
|
---|
2249 |
|
---|
2250 | /************************************************************
|
---|
2251 | * MAIN PROGRAM FUNCTION.
|
---|
2252 | ************************************************************/
|
---|
2253 | int main(int argc, const char *argv[])
|
---|
2254 | {
|
---|
2255 | QApplication app(argc, const_cast<char**>(argv));
|
---|
2256 |
|
---|
2257 | if (!QGLFormat::hasOpenGL()) {
|
---|
2258 | std::cerr << "This system has no OpenGL support" << std::endl;
|
---|
2259 | return 1;
|
---|
2260 | }
|
---|
2261 |
|
---|
2262 | Configuration conf(argv[0]);
|
---|
2263 | conf.SetPrintUsage(PrintUsage);
|
---|
2264 | SetupConfiguration(conf);
|
---|
2265 | if (!conf.DoParse(argc, argv, PrintHelp))
|
---|
2266 | return 2;
|
---|
2267 |
|
---|
2268 | UIConnector myUi;
|
---|
2269 | if (myUi.SetupConfiguration(conf)<0)
|
---|
2270 | return 3;
|
---|
2271 |
|
---|
2272 | return app.exec();
|
---|
2273 | }
|
---|
2274 |
|
---|