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