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