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