Ignore:
Timestamp:
10/17/11 16:36:58 (13 years ago)
Author:
tbretz
Message:
Removed a lot of obsolete code; many simplifications; started to clean up all the mess.
Location:
trunk/FACT++/gui/RawEventsViewer
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/gui/RawEventsViewer/RawEventsViewer.cc

    r12184 r12185  
    11561156UIConnector::UIConnector(QWidget*)
    11571157{
     1158    setupUi(this);
     1159    initHistograms();
     1160
     1161    currentFile = "none";
     1162    currentCalibFile = "none";
     1163
    11581164    updateSpinnerDisplay = true;
     1165    updating = false;
    11591166
    11601167    timer.setInterval(10.0);
    11611168    QObject::connect(&timer, SIGNAL(timeout()),
    1162                       this, SLOT(nextSlicePlease()));
    1163     hwID = 393;
    1164     swID = 0;
    1165     crateID = 9;
    1166     boardID = 8;
    1167     patchID = 1;
    1168     rescaleWholeCamera = true;
    1169     currentFile = "none";
    1170     currentCalibFile = "none";
    1171 
    1172 }
     1169                     this, SLOT(nextSlicePlease()));
     1170
     1171    QButtonGroup &scaleGroup = *new QButtonGroup(GLWindow);// = new QButtonGroup(canvas);
     1172    QButtonGroup &animateGroup = *new QButtonGroup(GLWindow);// = new QButtonGroup(canvas);
     1173
     1174    scaleGroup.addButton(Ui::MainWindow::currentPixelScale);
     1175    scaleGroup.addButton(Ui::MainWindow::entireCameraScale);
     1176
     1177    animateGroup.addButton(Ui::MainWindow::playEventsRadio);
     1178    animateGroup.addButton(Ui::MainWindow::playSlicesRadio);
     1179
     1180    QObject::connect(GLWindow, SIGNAL(colorPaletteHasChanged()),
     1181                     this, SLOT(on_autoScaleColor_clicked()));
     1182    QObject::connect(GLWindow, SIGNAL(signalCurrentSlice(int)),
     1183                     this, SLOT(currentSliceHasChanged(int)));
     1184    QObject::connect(GLWindow, SIGNAL(signalCurrentEvent(int)),
     1185                     this, SLOT(currentEventHasChanged(int)));
     1186    QObject::connect(GLWindow, SIGNAL(signalCurrentPixel(int)),
     1187                     this, SLOT(pixelChanged(int)));
     1188    QObject::connect(GLWindow, SIGNAL(newFileLoaded()),
     1189                     this, SLOT(newFileLoaded()));
     1190
     1191    show();
     1192}
     1193
    11731194void UIConnector::slicesPlusPlus()
    11741195{
    1175     viewer->nextSlice();
     1196    GLWindow->nextSlice();
    11761197}
    11771198void UIConnector::slicesMinusMinus()
    11781199{
    1179     viewer->previousSlice();
    1180 }
    1181 void UIConnector::drawCalibratedDataChanged(int state)
    1182 {
    1183     cout << "=== drawCalibratedDataChanged " << state << endl;
    1184 
    1185     for (int i=0;i<(1440+160)*viewer->nRoi;i++)
    1186         viewer->eventData[i] = (float)viewer->rawEventData[i];
    1187 
    1188 //    if (viewer->calibratedCheckBox->isChecked())
     1200    GLWindow->previousSlice();
     1201}
     1202void UIConnector::on_calibratedCheckBox_stateChanged(int state)
     1203{
     1204    for (int i=0;i<(1440+160)*GLWindow->nRoi;i++)
     1205        GLWindow->eventData[i] = (float)GLWindow->rawEventData[i];
     1206
     1207//    if (GLWindow->calibratedCheckBox->isChecked())
    11891208    if (state)
    1190         DataCalib::Apply(viewer->eventData, viewer->rawEventData, viewer->startPix, viewer->nRoi);
    1191 
    1192     viewer->updateGL();
     1209        DataCalib::Apply(GLWindow->eventData, GLWindow->rawEventData, GLWindow->startPix, GLWindow->nRoi);
     1210
     1211    GLWindow->updateGL();
    11931212
    11941213    //drawCalibrationCheckBox->setChecked(false);
    11951214
    1196     autoScalePressed();
    1197     pixelChanged(viewer->selectedPixel);
     1215    on_autoScaleColor_clicked();
     1216    pixelChanged(GLWindow->selectedPixel);
    11981217
    11991218}
     
    12011220 * DRAW PATCHES CHECK CHANGE. checkbox handler
    12021221 ************************************************************/
    1203 void UIConnector::drawPatchesCheckChange(int state)
    1204 {
    1205     viewer->drawPatch = state;
    1206     viewer->updateGL();
     1222void UIConnector::on_drawPatchCheckBox_stateChanged(int state)
     1223{
     1224    GLWindow->drawPatch = state;
     1225    GLWindow->updateGL();
    12071226}
    12081227/************************************************************
    12091228 * DRAW IMPULSE CHECK CHANGE. checkbox handler
    12101229 ************************************************************/
    1211 void UIConnector::drawImpulseCheckChange(int state)
    1212 {
    1213     viewer->drawImpulse = state;
    1214     viewer->updateGL();
     1230void UIConnector::on_drawImpulseCheckBox_stateChanged(int state)
     1231{
     1232    GLWindow->drawImpulse = state;
     1233    GLWindow->updateGL();
    12151234}
    12161235/************************************************************
    12171236 * DRAW BLUR CHECK CHANGE. checkbox handler
    12181237 ************************************************************/
    1219 void UIConnector::drawBlurCheckChange(int state)
    1220 {
    1221     viewer->drawBlur = state;
    1222     viewer->updateGL();
    1223 }
    1224 void UIConnector::loopEventCheckChange(int state)
    1225 {
    1226     viewer->loopCurrentEvent = state;
    1227 }
     1238void UIConnector::on_drawBlurCheckBox_stateChanged(int state)
     1239{
     1240    GLWindow->drawBlur = state;
     1241    GLWindow->updateGL();
     1242}
     1243void UIConnector::on_loopOverCurrentEventBox_stateChanged(int state)
     1244{
     1245    GLWindow->loopCurrentEvent = state;
     1246}
     1247
    12281248/************************************************************
    12291249 * NEXT SLICE PLEASE
     
    12321252{
    12331253    if (playEventsRadio->isChecked ())
    1234         viewer->eventStepping(true);
     1254        GLWindow->eventStepping(true);
    12351255    else
    1236         viewer->nextSlice();
    1237 }
     1256        GLWindow->nextSlice();
     1257}
     1258
    12381259/************************************************************
    12391260 * SET VIEWER.
    12401261 ************************************************************/
    1241 void UIConnector::setViewer(RawDataViewer* v)
    1242 {
    1243     viewer = v;
    1244 }
     1262//void UIConnector::setViewer(RawDataViewer* v)
     1263//{
     1264//    viewer = v;
     1265//}
    12451266/************************************************************
    12461267 * SLICES PER SECOND CHANGED. timing ui handler
     
    12501271    timer.setInterval(1000.0/value);
    12511272}
    1252 /************************************************************
    1253  * RANGE CHANGED . colors tweaking handler
    1254  ************************************************************/
    1255 void UIConnector::rangeChanged0(double value)
    1256 {
    1257     viewer->ss[0] = (float)value;
    1258     viewer->updateGL();
    1259 }
    1260 /************************************************************
    1261  * RANGE CHANGED . colors tweaking handler
    1262  ************************************************************/
    1263 void UIConnector::rangeChanged1(double value)
    1264 {
    1265     viewer->ss[1] = (float)value;
    1266     viewer->updateGL();
    1267 }
    1268 /************************************************************
    1269  * RANGE CHANGED . colors tweaking handler
    1270  ************************************************************/
    1271 void UIConnector::rangeChanged2(double value)
    1272 {
    1273     viewer->ss[2] = (float)value;
    1274     viewer->updateGL();
    1275 }
    1276 /************************************************************
    1277  * RANGE CHANGED . colors tweaking handler
    1278  ************************************************************/
    1279 void UIConnector::rangeChanged3(double value)
    1280 {
    1281     viewer->ss[3] = (float)value;
    1282     viewer->updateGL();
    1283 }
    1284 /************************************************************
    1285  * RANGE CHANGED . colors tweaking handler
    1286  ************************************************************/
    1287 void UIConnector::rangeChanged4(double value)
    1288 {
    1289     viewer->ss[4] = (float)value;
    1290     viewer->updateGL();
    1291 }
    1292 /************************************************************
    1293  * RANGE CHANGED . colors tweaking handler
    1294  ************************************************************/
    1295 void UIConnector::redChanged0(double value)
    1296 {
    1297     viewer->rr[0] = (float)value;
    1298     viewer->updateGL();
    1299 }
    1300 /************************************************************
    1301  * RED CHANGED . colors tweaking handler
    1302  ************************************************************/
    1303 void UIConnector::redChanged1(double value)
    1304 {
    1305     viewer->rr[1] = (float)value;
    1306     viewer->updateGL();
    1307 }
    1308 /************************************************************
    1309  * RED CHANGED . colors tweaking handler
    1310  ************************************************************/
    1311 void UIConnector::redChanged2(double value)
    1312 {
    1313     viewer->rr[2] = (float)value;
    1314     viewer->updateGL();
    1315 }
    1316 /************************************************************
    1317  * RED CHANGED . colors tweaking handler
    1318  ************************************************************/
    1319 void UIConnector::redChanged3(double value)
    1320 {
    1321     viewer->rr[3] = (float)value;
    1322     viewer->updateGL();
    1323 }
    1324 /************************************************************
    1325  * RED CHANGED . colors tweaking handler
    1326  ************************************************************/
    1327 void UIConnector::redChanged4(double value)
    1328 {
    1329     viewer->rr[4] = (float)value;
    1330     viewer->updateGL();
    1331 }
    1332 /************************************************************
    1333  * GREEN CHANGED . colors tweaking handler
    1334  ************************************************************/
    1335 void UIConnector::greenChanged0(double value)
    1336 {
    1337     viewer->gg[0] = (float)value;
    1338     viewer->updateGL();
    1339 }
    1340 /************************************************************
    1341  * GREEN CHANGED . colors tweaking handler
    1342  ************************************************************/
    1343 void UIConnector::greenChanged1(double value)
    1344 {
    1345     viewer->gg[1] = (float)value;
    1346     viewer->updateGL();
    1347 }
    1348 /************************************************************
    1349  * GREEN CHANGED . colors tweaking handler
    1350  ************************************************************/
    1351 void UIConnector::greenChanged2(double value)
    1352 {
    1353     viewer->gg[2] = (float)value;
    1354     viewer->updateGL();
    1355 }
    1356 /************************************************************
    1357  * GREEN CHANGED . colors tweaking handler
    1358  ************************************************************/
    1359 void UIConnector::greenChanged3(double value)
    1360 {
    1361     viewer->gg[3] = (float)value;
    1362     viewer->updateGL();
    1363 }
    1364 /************************************************************
    1365  * GREEN CHANGED . colors tweaking handler
    1366  ************************************************************/
    1367 void UIConnector::greenChanged4(double value)
    1368 {
    1369     viewer->gg[4] = (float)value;
    1370     viewer->updateGL();
    1371 }
    1372 /************************************************************
    1373  * BLUE CHANGED . colors tweaking handler
    1374  ************************************************************/
    1375 void UIConnector::blueChanged0(double value)
    1376 {
    1377     viewer->bb[0] = (float)value;
    1378     viewer->updateGL();
    1379 }
    1380 /************************************************************
    1381  * BLUE CHANGED . colors tweaking handler
    1382  ************************************************************/
    1383 void UIConnector::blueChanged1(double value)
    1384 {
    1385     viewer->bb[1] = (float)value;
    1386     viewer->updateGL();
    1387 }
    1388 /************************************************************
    1389  * BLUE CHANGED . colors tweaking handler
    1390  ************************************************************/
    1391 void UIConnector::blueChanged2(double value)
    1392 {
    1393     viewer->bb[2] = (float)value;
    1394     viewer->updateGL();
    1395 }
    1396 /************************************************************
    1397  * BLUE CHANGED . colors tweaking handler
    1398  ************************************************************/
    1399 void UIConnector::blueChanged3(double value)
    1400 {
    1401     viewer->bb[3] = (float)value;
    1402     viewer->updateGL();
    1403 }
    1404 /************************************************************
    1405  * BLUE CHANGED . colors tweaking handler
    1406  ************************************************************/
    1407 void UIConnector::blueChanged4(double value)
    1408 {
    1409     viewer->bb[4] = (float)value;
    1410     viewer->updateGL();
    1411 }
     1273
     1274void UIConnector::on_colorRange0_valueChanged(double value) { GLWindow->ss[0] = (float)value; GLWindow->updateGL(); }
     1275void UIConnector::on_colorRange1_valueChanged(double value) { GLWindow->ss[1] = (float)value; GLWindow->updateGL(); }
     1276void UIConnector::on_colorRange2_valueChanged(double value) { GLWindow->ss[2] = (float)value; GLWindow->updateGL(); }
     1277void UIConnector::on_colorRange3_valueChanged(double value) { GLWindow->ss[3] = (float)value; GLWindow->updateGL(); }
     1278void UIConnector::on_colorRange4_valueChanged(double value) { GLWindow->ss[4] = (float)value; GLWindow->updateGL(); }
     1279
     1280void UIConnector::on_redValue0_valueChanged(double value) { GLWindow->rr[0] = (float)value; GLWindow->updateGL(); }
     1281void UIConnector::on_redValue1_valueChanged(double value) { GLWindow->rr[1] = (float)value; GLWindow->updateGL(); }
     1282void UIConnector::on_redValue2_valueChanged(double value) { GLWindow->rr[2] = (float)value; GLWindow->updateGL(); }
     1283void UIConnector::on_redValue3_valueChanged(double value) { GLWindow->rr[3] = (float)value; GLWindow->updateGL(); }
     1284void UIConnector::on_redValue4_valueChanged(double value) { GLWindow->rr[4] = (float)value; GLWindow->updateGL(); }
     1285
     1286void UIConnector::on_greenValue0_valueChanged(double value) { GLWindow->gg[0] = (float)value; GLWindow->updateGL(); }
     1287void UIConnector::on_greenValue1_valueChanged(double value) { GLWindow->gg[1] = (float)value; GLWindow->updateGL(); }
     1288void UIConnector::on_greenValue2_valueChanged(double value) { GLWindow->gg[2] = (float)value; GLWindow->updateGL(); }
     1289void UIConnector::on_greenValue3_valueChanged(double value) { GLWindow->gg[3] = (float)value; GLWindow->updateGL(); }
     1290void UIConnector::on_greenValue4_valueChanged(double value) { GLWindow->gg[4] = (float)value; GLWindow->updateGL(); }
     1291
     1292void UIConnector::on_blueValue0_valueChanged(double value) { GLWindow->bb[0] = (float)value; GLWindow->updateGL(); }
     1293void UIConnector::on_blueValue1_valueChanged(double value) { GLWindow->bb[1] = (float)value; GLWindow->updateGL(); }
     1294void UIConnector::on_blueValue2_valueChanged(double value) { GLWindow->bb[2] = (float)value; GLWindow->updateGL(); }
     1295void UIConnector::on_blueValue3_valueChanged(double value) { GLWindow->bb[3] = (float)value; GLWindow->updateGL(); }
     1296void UIConnector::on_blueValue4_valueChanged(double value) { GLWindow->bb[4] = (float)value; GLWindow->updateGL(); }
     1297
    14121298/************************************************************
    14131299 * LOAD NEW FILE CLICKED. button handler
    14141300 ************************************************************/
    1415 void UIConnector::loadNewFileClicked()
     1301void UIConnector::on_loadNewFileButton_clicked()
    14161302{
    14171303    QFileDialog dialog;
     
    14211307    dialog.exec();
    14221308}
    1423 void UIConnector::loadNewCalibFileClicked()
     1309void UIConnector::on_loadDRSCalibButton_clicked()
    14241310{
    14251311    QFileDialog dialog;
     
    14361322    currentFile = file.toStdString();
    14371323    if (currentFile != "")
    1438         viewer->openFile(currentFile);
     1324        GLWindow->openFile(currentFile);
    14391325}
    14401326void UIConnector::calibFileSelected(QString file)
     
    14421328    currentCalibFile = file.toStdString();
    14431329    if (currentCalibFile != "")
    1444         viewer->openCalibFile(currentCalibFile);
     1330        GLWindow->openCalibFile(currentCalibFile);
    14451331}
    14461332/************************************************************
     
    14561342//    fileLoadedLabel->setText(QString(str.str().c_str()));
    14571343//    str.str("");
    1458     str << "Run number: " << viewer->runNumber << "\n";
     1344    str << "Run number: " << GLWindow->runNumber << "\n";
    14591345//    runNumberLabel->setText(QString(str.str().c_str()));
    14601346//    str.str("");
    1461     str << "Number of Events: " << viewer->nRows << "\n";
    1462 
    1463     eventNumberBox->setMaximum(viewer->nRows-1);
    1464 
    1465     str << "Number of Slices: " << viewer->nRoi << "\n";// << "/1024";
     1347    str << "Number of Events: " << GLWindow->nRows << "\n";
     1348
     1349    displayingEventBox->setMaximum(GLWindow->nRows-1);
     1350
     1351    str << "Number of Slices: " << GLWindow->nRoi << "\n";// << "/1024";
    14661352//    numberOfSlicesLabel->setText(QString(str.str().c_str()));
    14671353//    str.str("");
    1468     str << "Number of Time Marks: " << viewer->nTM << "\n";
     1354    str << "Number of Time Marks: " << GLWindow->nTM << "\n";
    14691355//    numberOfTimeMarksLabel->setText(QString(str.str().c_str()));
    14701356
    14711357//    str.str("");
    1472     str << "Run Type: " << viewer->runType << "\n";
     1358    str << "Run Type: " << GLWindow->runType << "\n";
    14731359//    runTypeLabel->setText(QString(str.str().c_str()));
    14741360//    str.str("");
    1475     str << "Time of 1st data: " << viewer->firstDataTime << "\n";
     1361    str << "Time of 1st data: " << GLWindow->firstDataTime << "\n";
    14761362//    firstTimeLabel->setText(QString(str.str().c_str()));
    14771363//    str.str("");
    1478     str << "Time of last data: " << viewer->lastDataTime << "\n";
     1364    str << "Time of last data: " << GLWindow->lastDataTime << "\n";
    14791365//    lastTimeLabel->setText(QString(str.str().c_str()));
    14801366//    str.str("");
    1481     str << "SVN revision: " << viewer->revision << '\n';
    1482     str << "Number of boards: " << viewer->nBoards << '\n';
    1483     str << "Number of pixels: " << viewer->nPixels << '\n';
    1484     str << "Number of Slices TM: " << viewer->nRoiTM << '\n';
    1485     str << "Time system: " << viewer->timeSystem << '\n';
    1486     str << "Date: " << viewer->creationDate << '\n';
    1487     str << "Night: " << viewer->nightInt << '\n';
    1488     str << "Camera: " << viewer->camera << '\n';
    1489     str << "DAQ: " << viewer->daq << '\n';
    1490     str << "ADC Count: " << viewer->adcCount << '\n';
    1491     str << "NB Evts OK:" << viewer->nbOk << '\n';
    1492     str << "NB Evts Rejected: " << viewer->nbRej << '\n';
    1493     str << "NB Evts Bad: " << viewer->nbBad << '\n';
     1367    str << "SVN revision: " << GLWindow->revision << '\n';
     1368    str << "Number of boards: " << GLWindow->nBoards << '\n';
     1369    str << "Number of pixels: " << GLWindow->nPixels << '\n';
     1370    str << "Number of Slices TM: " << GLWindow->nRoiTM << '\n';
     1371    str << "Time system: " << GLWindow->timeSystem << '\n';
     1372    str << "Date: " << GLWindow->creationDate << '\n';
     1373    str << "Night: " << GLWindow->nightInt << '\n';
     1374    str << "Camera: " << GLWindow->camera << '\n';
     1375    str << "DAQ: " << GLWindow->daq << '\n';
     1376    str << "ADC Count: " << GLWindow->adcCount << '\n';
     1377    str << "NB Evts OK:" << GLWindow->nbOk << '\n';
     1378    str << "NB Evts Rejected: " << GLWindow->nbRej << '\n';
     1379    str << "NB Evts Bad: " << GLWindow->nbBad << '\n';
    14941380    extraInfoLabel->setText(QString(str.str().c_str()));
    14951381
    14961382    /*
    1497     if (viewer->calibrationLoaded)
     1383    if (GLWindow->calibrationLoaded)
    14981384    {
    14991385        drawCalibrationCheckBox->setEnabled(true);
     
    15171403void UIConnector::currentSliceHasChanged(int slice)
    15181404{
    1519     if (!viewer->nRoi)
     1405    if (!GLWindow->nRoi)
    15201406        return;
    1521     ostringstream str;
    15221407//    str << "Displaying Slice " << slice;
    15231408//    QString qstr(str.str().c_str());
    15241409    if (updateSpinnerDisplay)
    1525         emit updateCurrentSliceDisplay(slice);
    1526 
    1527     str.str("");
    1528     str << "Current Pixel val.: " << viewer->eventData[viewer->nRoi*viewer->selectedPixel + viewer->whichSlice];
    1529     QString qstr = qstr.fromStdString(str.str());
    1530     emit updateCurrentPixelSliceValue(qstr);
     1410        displayingSliceBox->setValue(slice);
     1411
     1412    ostringstream str;
     1413    str << "Current Pixel val.: " << GLWindow->eventData[GLWindow->nRoi*GLWindow->selectedPixel + GLWindow->whichSlice];
     1414    currentPixelValue->setText(QString(str.str().c_str()));
    15311415
    15321416}
     
    15361420double xval[50000];
    15371421double yval[50000];
    1538 void UIConnector::eventChangedFromSpinner(int cEvent)
     1422void UIConnector::on_displayingEventBox_valueChanged(int cEvent)
    15391423{
    15401424//    cout << "Here " << updateSpinnerDisplay << endl;
     
    15431427    updateSpinnerDisplay = false;
    15441428//    currentEventHasChanged(cEvent);
    1545     viewer->rowNum = cEvent - viewer->eventStep;
    1546     viewer->eventStepping(true);
     1429    GLWindow->rowNum = cEvent - GLWindow->eventStep;
     1430    GLWindow->eventStepping(true);
    15471431    updateSpinnerDisplay = true;
    15481432
    1549 //    viewer->updateGL();
    1550 }
    1551 void UIConnector::sliceChangedFromSpinner(int cSlice)
     1433//    GLWindow->updateGL();
     1434}
     1435void UIConnector::on_displayingSliceBox_valueChanged(int cSlice)
    15521436{
    15531437    updateSpinnerDisplay = false;
    15541438    currentSliceHasChanged(cSlice);
    15551439    updateSpinnerDisplay = true;
    1556     viewer->whichSlice = cSlice;
    1557     viewer->updateGL();
     1440    GLWindow->whichSlice = cSlice;
     1441    GLWindow->updateGL();
    15581442}
    15591443void UIConnector::currentEventHasChanged(int )
     
    15661450    {
    15671451        updateSpinnerDisplay = false;
    1568         emit updateCurrentEventDisplay(viewer->rowNum);
     1452        displayingEventBox->setValue(GLWindow->rowNum);
    15691453        updateSpinnerDisplay = true;
    15701454    }
    15711455
    1572  //   viewer->doWaveLetOnCurrentEventPlease();
     1456 //   GLWindow->doWaveLetOnCurrentEventPlease();
    15731457
    15741458        //retrieve the data that we want to display
     1459    boost::posix_time::ptime hrTime( boost::gregorian::date(1970, boost::gregorian::Jan, 1),
     1460            boost::posix_time::seconds(GLWindow->pcTime[0]) +  boost::posix_time::microsec(GLWindow->pcTime[1]));
     1461
    15751462    str.str("");
    1576     boost::posix_time::ptime hrTime( boost::gregorian::date(1970, boost::gregorian::Jan, 1),
    1577             boost::posix_time::seconds(viewer->pcTime[0]) +  boost::posix_time::microsec(viewer->pcTime[1]));
    1578 //    cout <<  boost::posix_time::to_iso_extended_string(hrTime) << endl;
    15791463    str << "PC Time: " << boost::posix_time::to_iso_extended_string(hrTime);
    1580  //   str << "PC Time: " << viewer->pcTime[0];
    1581  //   str << " " << viewer->pcTime[1];
    1582     QString qstr = qstr.fromStdString(str.str());
    1583     emit updateCurrentPCTime(qstr);
     1464    PCTimeLabel->setText(QString(str.str().c_str()));
    15841465
    15851466    str.str("");
    1586     str << "Software Trigger: " << viewer->softTrig;
    1587     qstr = qstr.fromStdString(str.str());
    1588     emit updateCurrentSoftTrigger(qstr);
     1467    str << "Software Trigger: " << GLWindow->softTrig;
     1468    softwareTriggerLabel->setText(QString(str.str().c_str()));
    15891469
    15901470    str.str("");
    1591     str << "Trigger Type: " << viewer->triggerType;
    1592     qstr = qstr.fromStdString(str.str());
    1593     emit updateCurrentTriggerType(qstr);
     1471    str << "Trigger Type: " << GLWindow->triggerType;
     1472    triggerTypeLabel->setText(QString(str.str().c_str()));
    15941473
    15951474    str.str("");
    1596     str << "Current Pixel val.: " << viewer->eventData[viewer->nRoi*viewer->selectedPixel + viewer->whichSlice];
    1597     qstr = qstr.fromStdString(str.str());
    1598     emit updateCurrentPixelSliceValue(qstr);
     1475    str << "Current Pixel val.: " << GLWindow->eventData[GLWindow->nRoi*GLWindow->selectedPixel + GLWindow->whichSlice];
     1476    currentPixelValue->setText(QString(str.str().c_str()));
    15991477
    16001478    if (autoScaleColor->isChecked())
    1601         emit viewer->colorPaletteHasChanged();//autoScalePressed();
     1479        emit GLWindow->colorPaletteHasChanged();//autoScalePressed();
    16021480
    16031481    boardsTimeList->clear();
     
    16131491        if (i<100) str << " ";
    16141492        if (i<1000) str << " ";
    1615         str << ": " << viewer->boardTime[i];
     1493        str << ": " << GLWindow->boardTime[i];
    16161494        boardsTimeList->addItem(QString(str.str().c_str()));
    1617         if (boardsHistoMap.find(viewer->boardTime[i]) != boardsHistoMap.end())
    1618             boardsHistoMap[viewer->boardTime[i]]++;
     1495        if (boardsHistoMap.find(GLWindow->boardTime[i]) != boardsHistoMap.end())
     1496            boardsHistoMap[GLWindow->boardTime[i]]++;
    16191497        else
    1620             boardsHistoMap[viewer->boardTime[i]] = 1;
     1498            boardsHistoMap[GLWindow->boardTime[i]] = 1;
    16211499    }
    16221500    std::map<int, int> pixelHistoMap;
     
    16281506        if (i<100) str << " ";
    16291507        if (i<1000) str << " ";
    1630         str << ": " << viewer->startPix[i];
     1508        str << ": " << GLWindow->startPix[i];
    16311509        startPixelsList->addItem(QString(str.str().c_str()));
    1632         if (pixelHistoMap.find(viewer->startPix[i]) != pixelHistoMap.end())
    1633             pixelHistoMap[viewer->startPix[i]]++;
     1510        if (pixelHistoMap.find(GLWindow->startPix[i]) != pixelHistoMap.end())
     1511            pixelHistoMap[GLWindow->startPix[i]]++;
    16341512        else
    1635             pixelHistoMap[viewer->startPix[i]] = 1;
     1513            pixelHistoMap[GLWindow->startPix[i]] = 1;
    16361514    }
    16371515
     
    16441522        if (i<100) str << " ";
    16451523        if (i<1000) str << " ";
    1646         str << ": " << viewer->startTM[i];
     1524        str << ": " << GLWindow->startTM[i];
    16471525        startTimeMarksList->addItem(QString(str.str().c_str()));
    1648         if (timeMarksMap.find(viewer->startTM[i]) != timeMarksMap.end())
    1649             timeMarksMap[viewer->startTM[i]]++;
     1526        if (timeMarksMap.find(GLWindow->startTM[i]) != timeMarksMap.end())
     1527            timeMarksMap[GLWindow->startTM[i]]++;
    16501528        else
    1651             timeMarksMap[viewer->startTM[i]] = 1;
     1529            timeMarksMap[GLWindow->startTM[i]] = 1;
    16521530    }
    16531531    std::map<int,int> delayMap;
     
    16571535        str.str("");
    16581536        str << i << " | ";
    1659         for (int j=0;j<viewer->nRoi;j++)
    1660         {
    1661             int value = viewer->eventData[1440*viewer->nRoi + i*viewer->nRoi + j];
     1537        for (int j=0;j<GLWindow->nRoi;j++)
     1538        {
     1539            int value = GLWindow->eventData[1440*GLWindow->nRoi + i*GLWindow->nRoi + j];
    16621540            if (delayMap.find(value) != delayMap.end())
    16631541                 delayMap[value]++;
     
    18251703       for (int i=0;i<1024*1440;i++)
    18261704       {
    1827            if (valuesHistoMap.find(viewer->rawEventData[i]) != valuesHistoMap.end())
    1828                valuesHistoMap[viewer->rawEventData[i]]++;
     1705           if (valuesHistoMap.find(GLWindow->rawEventData[i]) != valuesHistoMap.end())
     1706               valuesHistoMap[GLWindow->rawEventData[i]]++;
    18291707           else
    1830                valuesHistoMap[viewer->rawEventData[i]] = 1;
    1831            if (waveletHistoMap.find(viewer->waveLetArray[i]) != waveletHistoMap.end())
    1832                waveletHistoMap[viewer->waveLetArray[i]]++;
     1708               valuesHistoMap[GLWindow->rawEventData[i]] = 1;
     1709           if (waveletHistoMap.find(GLWindow->waveLetArray[i]) != waveletHistoMap.end())
     1710               waveletHistoMap[GLWindow->waveLetArray[i]]++;
    18331711           else
    1834                waveletHistoMap[viewer->waveLetArray[i]] = 1;
     1712               waveletHistoMap[GLWindow->waveLetArray[i]] = 1;
    18351713       }
    18361714
     
    19291807    triggerDelayHistoZoom->setZoomStack(stack);
    19301808    stack.pop();
    1931     pixelChanged(viewer->selectedPixel);
     1809    pixelChanged(GLWindow->selectedPixel);
    19321810}
    19331811//can't use a ref to rectangle, as the type must be converted first
     
    19581836    grid->enableYMin(false);
    19591837    grid->setMajPen(QPen(Qt::black, 0, Qt::DotLine));
    1960     grid->attach(startCellHisto);
     1838    grid->attach(startCellsHisto);
    19611839
    19621840    grid = new QwtPlotGrid;
     
    19841862    grid->attach(triggerDelayHisto);
    19851863
    1986 
    19871864    boardsTimeHisto->setAutoReplot(true);
    1988     startCellHisto->setAutoReplot(true);
     1865    startCellsHisto->setAutoReplot(true);
    19891866    startTimeMarkHisto->setAutoReplot(true);
    19901867    pixelValueCurve->setAutoReplot(true);
    19911868    triggerDelayHisto->setAutoReplot(true);
    19921869    boardsTimeHisto->setTitle("Boards time values");
    1993     startCellHisto->setTitle("Start Cell values");
     1870    startCellsHisto->setTitle("Start Cell values");
    19941871    startTimeMarkHisto->setTitle("Start Time Marks values");
    19951872    pixelValueCurve->setTitle("Current pixel values");
     
    20121889
    20131890    boardsTimeHistoItem.attach(boardsTimeHisto);
    2014     startCellHistoItem.attach(startCellHisto);
     1891    startCellHistoItem.attach(startCellsHisto);
    20151892    startTimeMarkHistoItem.attach(startTimeMarkHisto);
    20161893    triggerDelayHistoItem.attach(triggerDelayHisto);
     
    20371914    curveZoom->setRubberBandPen(QPen(Qt::gray, 2, Qt::DotLine));
    20381915    curveZoom->setTrackerPen(QPen(Qt::gray));
     1916
    20391917    boardsTimeHistoZoom = new QwtPlotZoomer(boardsTimeHisto->canvas());
    20401918    boardsTimeHistoZoom->setRubberBandPen(QPen(Qt::gray, 2, Qt::DotLine));
    20411919    boardsTimeHistoZoom->setTrackerPen(QPen(Qt::gray));
    2042     startCellHistoZoom = new QwtPlotZoomer(startCellHisto->canvas());
     1920
     1921    startCellHistoZoom = new QwtPlotZoomer(startCellsHisto->canvas());
    20431922    startCellHistoZoom->setRubberBandPen(QPen(Qt::gray, 2, Qt::DotLine));
    20441923    startCellHistoZoom->setTrackerPen(QPen(Qt::gray));
     1924
    20451925    startTimeMarkHistoZoom = new QwtPlotZoomer(startTimeMarkHisto->canvas());
    20461926    startTimeMarkHistoZoom->setRubberBandPen(QPen(Qt::gray, 2, Qt::DotLine));
    20471927    startTimeMarkHistoZoom->setTrackerPen(QPen(Qt::gray));
     1928
    20481929    triggerDelayHistoZoom = new QwtPlotZoomer(triggerDelayHisto->canvas());
    20491930    triggerDelayHistoZoom->setRubberBandPen(QPen(Qt::gray, 2, Qt::DotLine));
     
    20541935void UIConnector::pixelChanged(int pixel)
    20551936{
    2056     if (!viewer->nRoi)
     1937    pixel = GLWindow->hardwareMapping[pixel];
     1938    HwIDBox->setValue(pixel);
     1939
     1940    if (!GLWindow->nRoi)
    20571941        return;
    20581942
    2059  //   if (hwID == pixel)
    2060  //       return;
    2061     for (int i=0;i<viewer->nRoi;i++)
     1943    for (int i=0;i<GLWindow->nRoi;i++)
    20621944    {
    20631945        xval[i] = i;
     
    20651947        yval[i] = eventsData[0][pixel][i];
    20661948#else
    2067         yval[i] = viewer->eventData[viewer->nRoi*pixel + i];
     1949        yval[i] = GLWindow->eventData[GLWindow->nRoi*pixel + i];
    20681950#endif
    20691951    }
    20701952
    2071   //  viewer->computePulsesStatistics();
     1953  //  GLWindow->computePulsesStatistics();
    20721954#if QWT_VERSION < 0x060000
    2073     pixelValueCurveItem.setData(xval, yval, viewer->nRoi);
    2074 ////    aMeanCurveItem.setData(xval, viewer->aMeas, viewer->nRoi);
    2075  //   meanCurveItem.setData(xval, viewer->n1mean, viewer->nRoi);
    2076  //   vCorrCurveItem.setData(xval, viewer->vCorr, viewer->nRoi-3);
     1955    pixelValueCurveItem.setData(xval, yval, GLWindow->nRoi);
     1956////    aMeanCurveItem.setData(xval, GLWindow->aMeas, GLWindow->nRoi);
     1957 //   meanCurveItem.setData(xval, GLWindow->n1mean, GLWindow->nRoi);
     1958 //   vCorrCurveItem.setData(xval, GLWindow->vCorr, GLWindow->nRoi-3);
    20771959#else
    2078        pixelValueCurveItem.setSamples(xval, yval, viewer->nRoi);
    2079 //       aMeanCurveItem.setSamples(xval, viewer->aMeas, viewer->nRoi);
    2080  //      meanCurveItem.setSamples(xval, viewer->n1mean, viewer->nRoi);
    2081  //      vCorrCurveItem.setSamples(xval, viewer->vCorr, viewer->nRoi-3);
     1960       pixelValueCurveItem.setSamples(xval, yval, GLWindow->nRoi);
     1961//       aMeanCurveItem.setSamples(xval, GLWindow->aMeas, GLWindow->nRoi);
     1962 //      meanCurveItem.setSamples(xval, GLWindow->n1mean, GLWindow->nRoi);
     1963 //      vCorrCurveItem.setSamples(xval, GLWindow->vCorr, GLWindow->nRoi-3);
    20821964#endif
    20831965
     
    20881970    stack.pop();
    20891971
    2090     hwID = pixel;
    2091     swID = viewer->softwareMapping[pixel];
    2092     crateID = pixel/360;
    2093     boardID = (pixel - crateID*360)/36;
    2094     patchID = (pixel - crateID*360 - boardID*36)/9;
    2095 
    2096     if (HwIDBox->value() != hwID)
    2097         HwIDBox->setValue(hwID);
    2098     if (SwIDBox->value() != swID)
    2099         SwIDBox->setValue(swID);
    2100     if (crateIDBox->value() != crateID)
    2101         crateIDBox->setValue(crateID);
    2102     if (boardIDBox->value() != boardID)
    2103         boardIDBox->setValue(boardID);
    2104     if (patchIDBox->value() != patchID)
    2105         patchIDBox->setValue(patchID);
    2106 
    21071972    ostringstream str;
    21081973    QString qstr;
    2109     str.str("");
    2110     str << "Current Pixel val.: " << viewer->eventData[viewer->nRoi*viewer->selectedPixel + viewer->whichSlice];
    2111     qstr = qstr.fromStdString(str.str());
    2112     emit updateCurrentPixelSliceValue(qstr);
    2113     autoScalePressed();
    2114 
    2115 }
    2116 
    2117 void UIConnector::hwIDChanged(int hwid)
    2118 {
    2119     hwID = hwid;
    2120     swID = viewer->softwareMapping[hwid];
    2121     crateID = hwID/360;
    2122     boardID = (hwID - crateID*360)/36;
    2123     patchID = (hwID - crateID*360 - boardID*36)/9;
    2124 
    2125 //    crateID = (hwid/4)/10;
    2126 //    boardID = (hwid/4)%10;
    2127 //    patchID = hwid%4;
    2128     HwIDBox->setValue(hwID);
    2129     SwIDBox->setValue(swID);
     1974    str << "Current Pixel val.: " << GLWindow->eventData[GLWindow->nRoi*GLWindow->selectedPixel + GLWindow->whichSlice];
     1975    currentPixelValue->setText(qstr.fromStdString(str.str()));
     1976    on_autoScaleColor_clicked();
     1977}
     1978
     1979void UIConnector::on_HwIDBox_valueChanged(int)
     1980{
     1981    updating = true;
     1982
     1983    const int hwID = HwIDBox->value();
     1984
     1985    const int crateID =  hwID/360;
     1986    const int boardID = (hwID%360)/36;
     1987    const int patchID = (hwID%36 )/9;
     1988    const int pixelID =  hwID%9;
     1989
     1990    SwIDBox->setValue(GLWindow->softwareMapping[hwID]);
     1991
    21301992    crateIDBox->setValue(crateID);
    21311993    boardIDBox->setValue(boardID);
    21321994    patchIDBox->setValue(patchID);
    2133 
    2134     viewer->selectedPixel = hwid;
    2135     pixelChanged(hwid);
    2136     viewer->updateGL();
    2137 
    2138 }
    2139 void UIConnector::swIDChanged(int swid)
    2140 {
    2141     swID = swid;
    2142     hwID = viewer->hardwareMapping[swid];
    2143     crateID = hwID/360;
    2144     boardID = (hwID - crateID*360)/36;
    2145     patchID = (hwID - crateID*360 - boardID*36)/9;
    2146 
    2147 //    crateID = (hwID/4)/10;
    2148 //    boardID = (hwID/4)%10;
    2149 //    patchID = hwID%4;
    2150     HwIDBox->setValue(hwID);
    2151     SwIDBox->setValue(swID);
    2152     crateIDBox->setValue(crateID);
    2153     boardIDBox->setValue(boardID);
    2154     patchIDBox->setValue(patchID);
    2155 
    2156     viewer->selectedPixel = hwID;
    2157     pixelChanged(hwID);
    2158     viewer->updateGL();
    2159 }
    2160 void UIConnector::crateIDChanged(int cid)
    2161 {
    2162     hwID -= 360*crateID;
    2163     crateID = cid;
    2164     hwID += 360*crateID;
    2165     swID = viewer->softwareMapping[hwID];
    2166     HwIDBox->setValue(hwID);
    2167     SwIDBox->setValue(swID);
    2168     viewer->selectedPixel = hwID;
    2169     pixelChanged(hwID);
    2170     viewer->updateGL();
    2171 }
    2172 void UIConnector::boardIDChanged(int bid)
    2173 {
    2174     hwID -= 36*boardID;
    2175     boardID = bid;
    2176     hwID += 36*boardID;
    2177     swID = viewer->softwareMapping[hwID];
    2178     HwIDBox->setValue(hwID);
    2179     SwIDBox->setValue(swID);
    2180     viewer->selectedPixel = hwID;
    2181     pixelChanged(hwID);
    2182    viewer->updateGL();
    2183 }
    2184 void UIConnector::patchIDChanged(int pid)
    2185 {
    2186     hwID -= 9*patchID;
    2187     patchID = pid;
    2188     hwID += 9*patchID;
    2189     swID = viewer->softwareMapping[hwID];
    2190     HwIDBox->setValue(hwID);
    2191     SwIDBox->setValue(swID);
    2192     viewer->selectedPixel = hwID;
    2193     pixelChanged(hwID);
    2194     viewer->updateGL();
    2195 }
    2196 void UIConnector::autoScalePressed()
     1995    pixelIDBox->setValue(pixelID);
     1996
     1997    updating = false;
     1998
     1999    pixelChanged(GLWindow->softwareMapping[hwID]);
     2000
     2001    GLWindow->selectedPixel = GLWindow->softwareMapping[hwID];
     2002    GLWindow->updateGL();
     2003}
     2004
     2005void UIConnector::cbpxChanged()
     2006{
     2007    if (updating)
     2008        return;
     2009
     2010    const int hwid = crateIDBox->value()*360 + boardIDBox->value()*36 + patchIDBox->value()*9 + pixelIDBox->value();
     2011    HwIDBox->setValue(hwid);
     2012}
     2013
     2014void UIConnector::on_SwIDBox_valueChanged(int swid)
     2015{
     2016    if (updating)
     2017        return;
     2018
     2019    HwIDBox->setValue(GLWindow->hardwareMapping[swid]);
     2020}
     2021
     2022void UIConnector::on_autoScaleColor_clicked()
    21972023{
    21982024    if (!autoScaleColor->isChecked())
    21992025    {
    22002026        /*
    2201         viewer->ss[0] = 0;
    2202         viewer->ss[1] = 0.25;
    2203         viewer->ss[2] = 0.5;
    2204         viewer->ss[3] = 0.75;
    2205         viewer->ss[4] = 1;
    2206         range0->setValue(viewer->ss[0]);
    2207         range1->setValue(viewer->ss[1]);
    2208         range2->setValue(viewer->ss[2]);
    2209         range3->setValue(viewer->ss[3]);
    2210         range4->setValue(viewer->ss[4]);
     2027        GLWindow->ss[0] = 0;
     2028        GLWindow->ss[1] = 0.25;
     2029        GLWindow->ss[2] = 0.5;
     2030        GLWindow->ss[3] = 0.75;
     2031        GLWindow->ss[4] = 1;
     2032        range0->setValue(GLWindow->ss[0]);
     2033        range1->setValue(GLWindow->ss[1]);
     2034        range2->setValue(GLWindow->ss[2]);
     2035        range3->setValue(GLWindow->ss[3]);
     2036        range4->setValue(GLWindow->ss[4]);
    22112037        */
    22122038        return;
    22132039    }
    2214     if (!viewer->nRoi)
     2040    if (!GLWindow->nRoi)
    22152041        return;
    22162042    int start, end;
    2217     if (rescaleWholeCamera)
     2043    if (entireCameraScale->isChecked())
    22182044    {
    22192045        start = 0;
     
    22222048    else
    22232049    {
    2224         start = viewer->selectedPixel;
    2225         end = viewer->selectedPixel+1;
     2050        start = GLWindow->selectedPixel;
     2051        end = GLWindow->selectedPixel+1;
    22262052    }
    22272053
     
    22332059    for (int i=start;i<end;i++)
    22342060    {
    2235         for (int j=0;j<viewer->nRoi;j++)
    2236         {
    2237             int cValue = viewer->eventData[i*viewer->nRoi+j];
     2061        for (int j=0;j<GLWindow->nRoi;j++)
     2062        {
     2063            int cValue = GLWindow->eventData[i*GLWindow->nRoi+j];
    22382064            if (cValue > max && cValue < 32767)
    22392065                max = cValue;
     
    22612087    double maxRange = (double)(max+(VALUES_SPAN/2))/(double)VALUES_SPAN;
    22622088    double midRange = (double)(average+(VALUES_SPAN/2))/(double)VALUES_SPAN;
    2263     if (viewer->logScale)
     2089    if (GLWindow->logScale)
    22642090    {
    22652091        minRange *= 9;
     
    22742100        midRange = log10(midRange);
    22752101    }
    2276     viewer->ss[0] = minRange;
    2277     range0->setValue(viewer->ss[0]);
    2278     viewer->ss[4] = maxRange;
    2279     range4->setValue(viewer->ss[4]);
    2280 //    viewer->ss[2] = midRange;
    2281 //    range2->setValue(viewer->ss[2]);
    2282 //    viewer->ss[1] = (minRange+midRange)/2;
    2283 //    range1->setValue(viewer->ss[1]);
    2284 //    viewer->ss[3] = (maxRange+midRange)/2;
    2285 //    range3->setValue(viewer->ss[3]);
    2286 
    2287     viewer->ss[2] = (maxRange+minRange)/2;
    2288     range2->setValue(viewer->ss[2]);
    2289 
    2290     viewer->ss[1] = minRange+(maxRange-minRange)/4;
    2291     range1->setValue(viewer->ss[1]);
    2292 
    2293     viewer->ss[3] = minRange+3*(maxRange-minRange)/4;
    2294     range3->setValue(viewer->ss[3]);
    2295 
    2296 
    2297 }
    2298 void UIConnector::entireCameraChanged(bool state)
    2299 {
    2300     if (state)
    2301     {
    2302         rescaleWholeCamera = true;
    2303         currentPixelScale->setChecked(false);
    2304     }
    2305     else
    2306     {
    2307         rescaleWholeCamera = false;
    2308         currentPixelScale->setChecked(true);
    2309     }
    2310     autoScalePressed();
    2311 }
    2312 void UIConnector::currentPixelChanged(bool state)
    2313 {
    2314 
    2315     if (state)
    2316     {
    2317         rescaleWholeCamera = false;
    2318         entireCameraScale->setChecked(false);
    2319     }
    2320     else
    2321     {
    2322         rescaleWholeCamera = true;
    2323         entireCameraScale->setChecked(true);
    2324     }
    2325     autoScalePressed();
    2326 }
    2327 
    2328 
     2102
     2103    GLWindow->ss[0] = minRange;
     2104    colorRange0->setValue(GLWindow->ss[0]);
     2105    GLWindow->ss[4] = maxRange;
     2106    colorRange4->setValue(GLWindow->ss[4]);
     2107//    GLWindow->ss[2] = midRange;
     2108//    range2->setValue(GLWindow->ss[2]);
     2109//    GLWindow->ss[1] = (minRange+midRange)/2;
     2110//    range1->setValue(GLWindow->ss[1]);
     2111//    GLWindow->ss[3] = (maxRange+midRange)/2;
     2112//    range3->setValue(GLWindow->ss[3]);
     2113
     2114    GLWindow->ss[2] = (maxRange+minRange)/2;
     2115    colorRange2->setValue(GLWindow->ss[2]);
     2116
     2117    GLWindow->ss[1] = minRange+(maxRange-minRange)/4;
     2118    colorRange1->setValue(GLWindow->ss[1]);
     2119
     2120    GLWindow->ss[3] = minRange+3*(maxRange-minRange)/4;
     2121    colorRange3->setValue(GLWindow->ss[3]);
     2122}
    23292123
    23302124void PrintUsage()
     
    23452139         << endl;
    23462140}
     2141
     2142int UIConnector::SetupConfiguration(Configuration &conf)
     2143{
     2144    RawDataViewer *canvas = GLWindow;
     2145
     2146    if (conf.Has("color.range"))
     2147    {
     2148        vector<double> value = conf.Vec<double>("color.range");
     2149        if (value.size() != 5)
     2150        {
     2151            cout << "Error, colorRange option should have exactly 5 double values" << endl;
     2152            return -1;
     2153        }
     2154        for (int i=0;i<5;i++)
     2155            canvas->ss[i] = value[i];
     2156    }
     2157
     2158    if (conf.Has("color.red"))
     2159    {
     2160        vector<double> value = conf.Vec<double>("color.red");
     2161        if (value.size() != 5)
     2162        {
     2163            cout << "Error, colorRed option should have exactly 5 double values" << endl;
     2164            return -1;
     2165        }
     2166        for (int i=0;i<5;i++)
     2167            canvas->rr[i] = value[i];
     2168    }
     2169
     2170    if (conf.Has("color.green"))
     2171    {
     2172        vector<double> value = conf.Vec<double>("color.green");
     2173        if (value.size() != 5)
     2174        {
     2175            cout << "Error, colorGreen option should have exactly 5 double values" << endl;
     2176            return -1;
     2177        }
     2178        for (int i=0;i<5;i++)
     2179            canvas->gg[i] = value[i];
     2180    }
     2181
     2182    if (conf.Has("color.blue"))
     2183    {
     2184        vector<double> value = conf.Vec<double>("color.blue");
     2185        if (value.size() != 5)
     2186        {
     2187            cout << "Error, colorBlue option should have exactly 5 double values" << endl;
     2188            return -1;
     2189        }
     2190        for (int i=0;i<5;i++)
     2191            canvas->bb[i] = value[i];
     2192    }
     2193
     2194    colorRange0->setValue(canvas->ss[0]);
     2195    colorRange1->setValue(canvas->ss[1]);
     2196    colorRange2->setValue(canvas->ss[2]);
     2197    colorRange3->setValue(canvas->ss[3]);
     2198    colorRange4->setValue(canvas->ss[4]);
     2199    redValue0->setValue(canvas->rr[0]);
     2200    redValue1->setValue(canvas->rr[1]);
     2201    redValue2->setValue(canvas->rr[2]);
     2202    redValue3->setValue(canvas->rr[3]);
     2203    redValue4->setValue(canvas->rr[4]);
     2204    greenValue0->setValue(canvas->gg[0]);
     2205    greenValue1->setValue(canvas->gg[1]);
     2206    greenValue2->setValue(canvas->gg[2]);
     2207    greenValue3->setValue(canvas->gg[3]);
     2208    greenValue4->setValue(canvas->gg[4]);
     2209    blueValue0->setValue(canvas->bb[0]);
     2210    blueValue1->setValue(canvas->bb[1]);
     2211    blueValue2->setValue(canvas->bb[2]);
     2212    blueValue3->setValue(canvas->bb[3]);
     2213    blueValue4->setValue(canvas->bb[4]);
     2214
     2215    if (conf.Has("file"))
     2216    {
     2217        const QString qstr(conf.Get<string>("file").c_str());
     2218        fileSelected(qstr);
     2219    }
     2220
     2221    if (conf.Has("drs"))
     2222    {
     2223        const QString qstr(conf.Get<string>("drs").c_str());
     2224        calibFileSelected(qstr);
     2225    }
     2226
     2227    return 0;
     2228}
     2229
    23472230void SetupConfiguration(Configuration& conf)
    23482231{
     
    23652248}
    23662249
    2367 /*
    2368 class MainWindow : public QMainWindow, protected Ui::MainWindow
    2369 {
    2370     Q_OBJECT;
    2371 
    2372 public:
    2373     MainWindow(QWidget *p=0) : QMainWindow(p)
    2374     {
    2375         setupUi(this);
    2376     }
    2377 
    2378     int SetupConfiguration(Configuration &conf)
    2379     {
    2380         RawDataViewer *canvas = GLWindow;
    2381 
    2382         if (conf.Has("color.range"))
    2383         {
    2384             vector<double> value = conf.Vec<double>("color.range");
    2385             if (value.size() != 5)
    2386             {
    2387                 cout << "Error, colorRange option should have exactly 5 double values" << endl;
    2388                 return -1;
    2389             }
    2390             for (int i=0;i<5;i++)
    2391                 canvas->ss[i] = value[i];
    2392         }
    2393 
    2394         if (conf.Has("color.red"))
    2395         {
    2396             vector<double> value = conf.Vec<double>("color.red");
    2397             if (value.size() != 5)
    2398             {
    2399                 cout << "Error, colorRed option should have exactly 5 double values" << endl;
    2400                 return -1;
    2401             }
    2402             for (int i=0;i<5;i++)
    2403                 canvas->rr[i] = value[i];
    2404         }
    2405 
    2406         if (conf.Has("color.green"))
    2407         {
    2408             vector<double> value = conf.Vec<double>("color.green");
    2409             if (value.size() != 5)
    2410             {
    2411                 cout << "Error, colorGreen option should have exactly 5 double values" << endl;
    2412                 return -1;
    2413             }
    2414             for (int i=0;i<5;i++)
    2415                 canvas->gg[i] = value[i];
    2416         }
    2417 
    2418         if (conf.Has("color.blue"))
    2419         {
    2420             vector<double> value = conf.Vec<double>("color.blue");
    2421             if (value.size() != 5)
    2422             {
    2423                 cout << "Error, colorBlue option should have exactly 5 double values" << endl;
    2424                 return -1;
    2425             }
    2426             for (int i=0;i<5;i++)
    2427                 canvas->bb[i] = value[i];
    2428         }
    2429 
    2430         colorRange0->setValue(canvas->ss[0]);
    2431         colorRange1->setValue(canvas->ss[1]);
    2432         colorRange2->setValue(canvas->ss[2]);
    2433         colorRange3->setValue(canvas->ss[3]);
    2434         colorRange4->setValue(canvas->ss[4]);
    2435         redValue0->setValue(canvas->rr[0]);
    2436         redValue1->setValue(canvas->rr[1]);
    2437         redValue2->setValue(canvas->rr[2]);
    2438         redValue3->setValue(canvas->rr[3]);
    2439         redValue4->setValue(canvas->rr[4]);
    2440         greenValue0->setValue(canvas->gg[0]);
    2441         greenValue1->setValue(canvas->gg[1]);
    2442         greenValue2->setValue(canvas->gg[2]);
    2443         greenValue3->setValue(canvas->gg[3]);
    2444         greenValue4->setValue(canvas->gg[4]);
    2445         blueValue0->setValue(canvas->bb[0]);
    2446         blueValue1->setValue(canvas->bb[1]);
    2447         blueValue2->setValue(canvas->bb[2]);
    2448         blueValue3->setValue(canvas->bb[3]);
    2449         blueValue4->setValue(canvas->bb[4]);
    2450 
    2451         return 0;
    2452     }
    2453 
    2454 };
    2455 */
    2456 
    24572250/************************************************************
    24582251 * MAIN PROGRAM FUNCTION.
     
    24602253int main(int argc, const char *argv[])
    24612254{
     2255    QApplication app(argc, const_cast<char**>(argv));
     2256
     2257    if (!QGLFormat::hasOpenGL()) {
     2258        std::cerr << "This system has no OpenGL support" << std::endl;
     2259        return 1;
     2260    }
     2261
    24622262    Configuration conf(argv[0]);
    24632263    conf.SetPrintUsage(PrintUsage);
    24642264    SetupConfiguration(conf);
    24652265    if (!conf.DoParse(argc, argv, PrintHelp))
    2466         return -1;
    2467 
    2468     QApplication app(argc, const_cast<char**>(argv));
    2469 
    2470     if (!QGLFormat::hasOpenGL()) {
    2471         std::cerr << "This system has no OpenGL support" << std::endl;
    2472         return 1;
    2473     }
    2474 
    2475     /*
    2476     MainWindow myUi;
     2266        return 2;
     2267
     2268    UIConnector myUi;
    24772269    if (myUi.SetupConfiguration(conf)<0)
    2478         return -1;
    2479      */
    2480 
    2481    QMainWindow mainWindow;
    2482 
    2483     Ui_MainWindow myUi;
    2484     myUi.setupUi(&mainWindow);
    2485 
    2486     UIConnector connector;
    2487 
    2488     RawDataViewer *canvas = myUi.GLWindow;
    2489 
    2490     if (conf.Has("color.range"))
    2491     {
    2492         vector<double> value = conf.Vec<double>("color.range");
    2493         if (value.size() != 5)
    2494         {
    2495             cout << "Error, colorRange option should have exactly 5 double values" << endl;
    2496             return -1;
    2497         }
    2498         for (int i=0;i<5;i++)
    2499             canvas->ss[i] = value[i];
    2500     }
    2501 
    2502     if (conf.Has("color.red"))
    2503     {
    2504         vector<double> value = conf.Vec<double>("color.red");
    2505         if (value.size() != 5)
    2506         {
    2507             cout << "Error, colorRed option should have exactly 5 double values" << endl;
    2508             return -1;
    2509         }
    2510         for (int i=0;i<5;i++)
    2511             canvas->rr[i] = value[i];
    2512     }
    2513 
    2514     if (conf.Has("color.green"))
    2515     {
    2516         vector<double> value = conf.Vec<double>("color.green");
    2517         if (value.size() != 5)
    2518         {
    2519             cout << "Error, colorGreen option should have exactly 5 double values" << endl;
    2520             return -1;
    2521         }
    2522         for (int i=0;i<5;i++)
    2523             canvas->gg[i] = value[i];
    2524     }
    2525 
    2526     if (conf.Has("color.blue"))
    2527     {
    2528         vector<double> value = conf.Vec<double>("color.blue");
    2529         if (value.size() != 5)
    2530         {
    2531             cout << "Error, colorBlue option should have exactly 5 double values" << endl;
    2532             return -1;
    2533         }
    2534         for (int i=0;i<5;i++)
    2535             canvas->bb[i] = value[i];
    2536     }
    2537 
    2538 
    2539 //    QObject::connect(myUi.eventsMinusButton, SIGNAL(clicked()),
    2540 //                     canvas, SLOT(minusEvent()));
    2541 //    QObject::connect(myUi.eventsPlusButton, SIGNAL(clicked()),
    2542 //                     canvas, SLOT(plusEvent()));
    2543 //    QObject::connect(myUi.eventsStepBox, SIGNAL(valueChanged(int)),
    2544 //                     canvas, SLOT(setEventStep(int)));
    2545     myUi.colorRange0->setValue(canvas->ss[0]);
    2546     myUi.colorRange1->setValue(canvas->ss[1]);
    2547     myUi.colorRange2->setValue(canvas->ss[2]);
    2548     myUi.colorRange3->setValue(canvas->ss[3]);
    2549     myUi.colorRange4->setValue(canvas->ss[4]);
    2550     myUi.redValue0->setValue(canvas->rr[0]);
    2551     myUi.redValue1->setValue(canvas->rr[1]);
    2552     myUi.redValue2->setValue(canvas->rr[2]);
    2553     myUi.redValue3->setValue(canvas->rr[3]);
    2554     myUi.redValue4->setValue(canvas->rr[4]);
    2555     myUi.greenValue0->setValue(canvas->gg[0]);
    2556     myUi.greenValue1->setValue(canvas->gg[1]);
    2557     myUi.greenValue2->setValue(canvas->gg[2]);
    2558     myUi.greenValue3->setValue(canvas->gg[3]);
    2559     myUi.greenValue4->setValue(canvas->gg[4]);
    2560     myUi.blueValue0->setValue(canvas->bb[0]);
    2561     myUi.blueValue1->setValue(canvas->bb[1]);
    2562     myUi.blueValue2->setValue(canvas->bb[2]);
    2563     myUi.blueValue3->setValue(canvas->bb[3]);
    2564     myUi.blueValue4->setValue(canvas->bb[4]);
    2565 
    2566     connector.setViewer(canvas);
    2567     connector.boardsTimeList = myUi.boardsTimeList;
    2568     connector.boardsTimeHisto = myUi.boardsTimeHisto;
    2569     connector.startPixelsList = myUi.startPixelsList;
    2570     connector.startCellHisto = myUi.startCellsHisto;
    2571     connector.startTimeMarkHisto = myUi.startTimeMarkHisto;
    2572     connector.pixelValueCurve = myUi.pixelValueCurve;
    2573     connector.triggerDelayHisto = myUi.triggerDelayHisto;
    2574     connector.triggerDelayList = myUi.triggerDelayList;
    2575     connector.autoScaleColor = myUi.autoScaleColor;
    2576 
    2577     connector.startTimeMarksList = myUi.startTimeMarksList;
    2578 //    connector.fileLoadedLabel = myUi.fileLoadedLabel;
    2579 //    connector.runNumberLabel = myUi.runNumberLabel;
    2580 //    connector.numberOfSlicesLabel = myUi.numberOfSlicesLabel;
    2581 //    connector.numberOfTimeMarksLabel = myUi.numberOfTimeMarksLabel;
    2582 //    connector.runTypeLabel = myUi.runTypeLabel;
    2583 //    connector.firstTimeLabel = myUi.timeOfFirstDataLabel;
    2584 //    connector.lastTimeLabel = myUi.timeOfLastDataLabel;
    2585     connector.currentPixelValue = myUi.currentPixelValue;
    2586 
    2587     connector.currentPixelScale = myUi.currentPixelScale;
    2588     connector.entireCameraScale = myUi.entireCameraScale;
    2589     connector.playEventsRadio = myUi.playEventsRadio;
    2590 
    2591     connector.extraInfoLabel = myUi.extraInfoLabel;
    2592 
    2593     connector.HwIDBox = myUi.HwIDBox;
    2594     connector.SwIDBox = myUi.SwIDBox;
    2595     connector.crateIDBox = myUi.crateIDBox;
    2596     connector.boardIDBox = myUi.boardIDBox;
    2597     connector.patchIDBox = myUi.patchIDBox;
    2598 
    2599     connector.eventNumberBox = myUi.displayingEventBox;
    2600 
    2601     connector.range0 = myUi.colorRange0;
    2602     connector.range1 = myUi.colorRange1;
    2603     connector.range2 = myUi.colorRange2;
    2604     connector.range3 = myUi.colorRange3;
    2605     connector.range4 = myUi.colorRange4;
    2606     connector.drawCalibrationCheckBox = myUi.calibratedCheckBox;
    2607 //    connector.drawCalibrationCheckBox->setEnabled(false);
    2608 
    2609     connector.initHistograms();
    2610 
    2611     QButtonGroup scaleGroup(canvas);// = new QButtonGroup(canvas);
    2612     QButtonGroup animateGroup(canvas);// = new QButtonGroup(canvas);
    2613     scaleGroup.addButton(myUi.currentPixelScale);
    2614     scaleGroup.addButton(myUi.entireCameraScale);
    2615     animateGroup.addButton(myUi.playEventsRadio);
    2616     animateGroup.addButton(myUi.playSlicesRadio);
    2617     myUi.entireCameraScale->setChecked(true);
    2618 //    QObject::connect(myUi.slicesPlusPlusButton, SIGNAL(clicked()),
    2619 //                    &connector, SLOT(slicesPlusPlus()));
    2620 //    QObject::connect(myUi.slicesMinusMinusButton, SIGNAL(clicked()),
    2621 //                     &connector, SLOT(slicesMinusMinus()));
    2622 
    2623     QObject::connect(myUi.autoScaleColor, SIGNAL(clicked()),
    2624                      &connector, SLOT(autoScalePressed()));
    2625     QObject::connect(canvas, SIGNAL(colorPaletteHasChanged()),
    2626                      &connector, SLOT(autoScalePressed()));
    2627 
    2628     QObject::connect(myUi.currentPixelScale, SIGNAL(toggled(bool)),
    2629                      &connector, SLOT(currentPixelChanged(bool)));
    2630     QObject::connect(myUi.entireCameraScale, SIGNAL(toggled(bool)),
    2631                      &connector, SLOT(entireCameraChanged(bool)));
    2632 
    2633     QObject::connect(myUi.HwIDBox, SIGNAL(valueChanged(int)),
    2634                          &connector, SLOT(hwIDChanged(int)));
    2635     QObject::connect(myUi.SwIDBox, SIGNAL(valueChanged(int)),
    2636                          &connector, SLOT(swIDChanged(int)));
    2637     QObject::connect(myUi.crateIDBox, SIGNAL(valueChanged(int)),
    2638                          &connector, SLOT(crateIDChanged(int)));
    2639     QObject::connect(myUi.boardIDBox, SIGNAL(valueChanged(int)),
    2640                          &connector, SLOT(boardIDChanged(int)));
    2641     QObject::connect(myUi.patchIDBox, SIGNAL(valueChanged(int)),
    2642                          &connector, SLOT(patchIDChanged(int)));
    2643 
    2644  //   connector.pixelChanged(0);
    2645     QObject::connect(canvas, SIGNAL(signalCurrentPixel(int)),
    2646                      &connector, SLOT(pixelChanged(int)));
    2647     QObject::connect(myUi.drawPatchCheckBox, SIGNAL(stateChanged(int)),
    2648                      &connector, SLOT(drawPatchesCheckChange(int)));
    2649     QObject::connect(myUi.drawImpulseCheckBox, SIGNAL(stateChanged(int)),
    2650                      &connector, SLOT(drawImpulseCheckChange(int)));
    2651     QObject::connect(myUi.drawBlurCheckBox, SIGNAL(stateChanged(int)),
    2652                      &connector, SLOT(drawBlurCheckChange(int)));
    2653     QObject::connect(myUi.loopOverCurrentEventBox, SIGNAL(stateChanged(int)),
    2654                      &connector, SLOT(loopEventCheckChange(int)));
    2655     QObject::connect(canvas, SIGNAL(newFileLoaded()),
    2656                      &connector, SLOT(newFileLoaded()));
    2657 
    2658     QObject::connect(myUi.calibratedCheckBox, SIGNAL(stateChanged(int)),
    2659                      &connector, SLOT(drawCalibratedDataChanged(int)));
    2660     QObject::connect(myUi.loadNewFileButton, SIGNAL(clicked()),
    2661                      &connector, SLOT(loadNewFileClicked()));
    2662     QObject::connect(myUi.loadDRSCalibButton, SIGNAL(clicked()),
    2663                      &connector, SLOT(loadNewCalibFileClicked()));
    2664 
    2665     QObject::connect(myUi.colorRange0, SIGNAL(valueChanged(double)),
    2666                       &connector, SLOT(rangeChanged0(double)));
    2667 
    2668     QObject::connect(myUi.colorRange1, SIGNAL(valueChanged(double)),
    2669                       &connector, SLOT(rangeChanged1(double)));
    2670 
    2671     QObject::connect(myUi.colorRange2, SIGNAL(valueChanged(double)),
    2672                       &connector, SLOT(rangeChanged2(double)));
    2673 
    2674     QObject::connect(myUi.colorRange3, SIGNAL(valueChanged(double)),
    2675                       &connector, SLOT(rangeChanged3(double)));
    2676 
    2677     QObject::connect(myUi.colorRange4, SIGNAL(valueChanged(double)),
    2678                       &connector, SLOT(rangeChanged4(double)));
    2679 
    2680     QObject::connect(myUi.redValue0, SIGNAL(valueChanged(double)),
    2681                       &connector, SLOT(redChanged0(double)));
    2682 
    2683     QObject::connect(myUi.redValue1, SIGNAL(valueChanged(double)),
    2684                       &connector, SLOT(redChanged1(double)));
    2685 
    2686     QObject::connect(myUi.redValue2, SIGNAL(valueChanged(double)),
    2687                       &connector, SLOT(redChanged2(double)));
    2688 
    2689     QObject::connect(myUi.redValue3, SIGNAL(valueChanged(double)),
    2690                       &connector, SLOT(redChanged3(double)));
    2691 
    2692     QObject::connect(myUi.redValue4, SIGNAL(valueChanged(double)),
    2693                       &connector, SLOT(redChanged4(double)));
    2694 
    2695     QObject::connect(myUi.greenValue0, SIGNAL(valueChanged(double)),
    2696                       &connector, SLOT(greenChanged0(double)));
    2697 
    2698     QObject::connect(myUi.greenValue1, SIGNAL(valueChanged(double)),
    2699                       &connector, SLOT(greenChanged1(double)));
    2700 
    2701     QObject::connect(myUi.greenValue2, SIGNAL(valueChanged(double)),
    2702                       &connector, SLOT(greenChanged2(double)));
    2703 
    2704     QObject::connect(myUi.greenValue3, SIGNAL(valueChanged(double)),
    2705                       &connector, SLOT(greenChanged3(double)));
    2706 
    2707     QObject::connect(myUi.greenValue4, SIGNAL(valueChanged(double)),
    2708                       &connector, SLOT(greenChanged4(double)));
    2709 
    2710     QObject::connect(myUi.blueValue0, SIGNAL(valueChanged(double)),
    2711                       &connector, SLOT(blueChanged0(double)));
    2712 
    2713     QObject::connect(myUi.blueValue1, SIGNAL(valueChanged(double)),
    2714                       &connector, SLOT(blueChanged1(double)));
    2715 
    2716     QObject::connect(myUi.blueValue2, SIGNAL(valueChanged(double)),
    2717                       &connector, SLOT(blueChanged2(double)));
    2718 
    2719     QObject::connect(myUi.blueValue3, SIGNAL(valueChanged(double)),
    2720                       &connector, SLOT(blueChanged3(double)));
    2721 
    2722     QObject::connect(myUi.blueValue4, SIGNAL(valueChanged(double)),
    2723                       &connector, SLOT(blueChanged4(double)));
    2724 
    2725     QObject::connect(myUi.slicesPerSecValue, SIGNAL(valueChanged(double)),
    2726                       &connector, SLOT(slicesPerSecondChanged(double)));
    2727     QObject::connect(myUi.playPauseButton, SIGNAL(clicked()),
    2728                      &connector, SLOT(playPauseClicked()));
    2729 
    2730     QObject::connect(canvas, SIGNAL(signalCurrentSlice(int)),
    2731                      &connector, SLOT(currentSliceHasChanged(int)));
    2732     QObject::connect(canvas, SIGNAL(signalCurrentEvent(int)),
    2733                      &connector, SLOT(currentEventHasChanged(int)));
    2734 
    2735     QObject::connect(&connector, SIGNAL(updateCurrentSliceDisplay(int)),
    2736                      myUi.displayingSliceBox, SLOT(setValue(int)));
    2737 
    2738     QObject::connect(myUi.displayingSliceBox, SIGNAL(valueChanged(int)),
    2739                     &connector, SLOT(sliceChangedFromSpinner(int)));
    2740     QObject::connect(myUi.displayingEventBox, SIGNAL(valueChanged(int)),
    2741                     &connector, SLOT(eventChangedFromSpinner(int)));
    2742 
    2743 //    QObject::connect(&connector, SIGNAL(updateCurrentEventDisplay(QString)),
    2744 //                     myUi.displayingEventLabel, SLOT(setText(const QString)));
    2745     QObject::connect(&connector, SIGNAL(updateCurrentEventDisplay(int)),
    2746                      myUi.displayingEventBox, SLOT(setValue(int)));
    2747 
    2748     QObject::connect(&connector, SIGNAL(updateCurrentPCTime(QString)),
    2749                      myUi.PCTimeLabel, SLOT(setText(const QString)));
    2750     QObject::connect(&connector, SIGNAL(updateCurrentSoftTrigger(QString)),
    2751                      myUi.softwareTriggerLabel, SLOT(setText(const QString)));
    2752     QObject::connect(&connector, SIGNAL(updateCurrentTriggerType(QString)),
    2753                      myUi.triggerTypeLabel, SLOT(setText(const QString)));
    2754     QObject::connect(&connector, SIGNAL(updateCurrentPixelSliceValue(const QString)),
    2755                      myUi.currentPixelValue, SLOT(setText(const QString)));
    2756 
    2757     if (conf.Has("file"))
    2758     {
    2759         const QString qstr(conf.Get<string>("file").c_str());
    2760         connector.fileSelected(qstr);
    2761     }
    2762 
    2763     if (conf.Has("drs"))
    2764     {
    2765         const QString qstr(conf.Get<string>("drs").c_str());
    2766         connector.calibFileSelected(qstr);
    2767     }
    2768 
    2769     mainWindow.show();
     2270        return 3;
    27702271
    27712272    return app.exec();
  • trunk/FACT++/gui/RawEventsViewer/RawEventsViewer.h

    r12173 r12185  
    107107    void eventStepping(bool plus);
    108108//    void buildVerticesList();
    109     void buildPatchesIndices();
     109//    void buildPatchesIndices();
    110110    void calcBlurColor(int pixel, int vertex);
    111111    void drawBlurryHexagon(int index);
     
    186186 * Class UIConnector. used to connect the interface to the raw data displayer
    187187 *************************************************/
    188 class UIConnector : public QObject
     188#include "viewer.h"
     189
     190class Configuration;
     191
     192class UIConnector : public QMainWindow, protected Ui::MainWindow
    189193{
    190194    Q_OBJECT
     195private:
     196    QTimer timer;
     197    std::string currentFile;
     198    std::string currentCalibFile;
     199
     200    QRectF scaleBoundingRectangle(QRectF rectangle, float scale);
     201
     202    bool updateSpinnerDisplay;
     203    bool updating;
     204
     205    void initHistograms();
     206
    191207public:
    192208    UIConnector(QWidget *parent = 0);
    193     void setViewer(RawDataViewer* v);
    194209
    195210public Q_SLOTS:
    196     void loadNewFileClicked();
    197     void loadNewCalibFileClicked();
    198211    void fileSelected(QString file);
    199212    void calibFileSelected(QString file);
    200     void drawPatchesCheckChange(int state);
    201     void drawImpulseCheckChange(int state);
    202     void drawBlurCheckChange(int state);
    203     void loopEventCheckChange(int state);
     213
    204214    void newFileLoaded();
    205215    void playPauseClicked();
     
    208218    void currentSliceHasChanged(int slice);
    209219    void currentEventHasChanged(int event);
    210     void rangeChanged0(double value);
    211     void rangeChanged1(double value);
    212     void rangeChanged2(double value);
    213     void rangeChanged3(double value);
    214     void rangeChanged4(double value);
    215     void redChanged0(double value);
    216     void redChanged1(double value);
    217     void redChanged2(double value);
    218     void redChanged3(double value);
    219     void redChanged4(double value);
    220     void greenChanged0(double value);
    221     void greenChanged1(double value);
    222     void greenChanged2(double value);
    223     void greenChanged3(double value);
    224     void greenChanged4(double value);
    225     void blueChanged0(double value);
    226     void blueChanged1(double value);
    227     void blueChanged2(double value);
    228     void blueChanged3(double value);
    229     void blueChanged4(double value);
     220
     221    void on_loadNewFileButton_clicked();
     222    void on_loadDRSCalibButton_clicked();
     223
     224    void on_drawPatchCheckBox_stateChanged(int);
     225    void on_drawImpulseCheckBox_stateChanged(int);
     226    void on_drawBlurCheckBox_stateChanged(int);
     227    void on_loopOverCurrentEventBox_stateChanged(int);
     228
     229    void on_colorRange0_valueChanged(double);
     230    void on_colorRange1_valueChanged(double);
     231    void on_colorRange2_valueChanged(double);
     232    void on_colorRange3_valueChanged(double);
     233    void on_colorRange4_valueChanged(double);
     234    void on_redValue0_valueChanged(double);
     235    void on_redValue1_valueChanged(double);
     236    void on_redValue2_valueChanged(double);
     237    void on_redValue3_valueChanged(double);
     238    void on_redValue4_valueChanged(double);
     239    void on_greenValue0_valueChanged(double);
     240    void on_greenValue1_valueChanged(double);
     241    void on_greenValue2_valueChanged(double);
     242    void on_greenValue3_valueChanged(double);
     243    void on_greenValue4_valueChanged(double);
     244    void on_blueValue0_valueChanged(double);
     245    void on_blueValue1_valueChanged(double);
     246    void on_blueValue2_valueChanged(double);
     247    void on_blueValue3_valueChanged(double);
     248    void on_blueValue4_valueChanged(double);
     249
    230250    void pixelChanged(int pixel);
    231     void hwIDChanged(int hwid);
    232     void swIDChanged(int swid);
    233     void crateIDChanged(int cid);
    234     void boardIDChanged(int bid);
    235     void patchIDChanged(int pid);
    236     void autoScalePressed();
    237     void entireCameraChanged(bool state);
    238     void currentPixelChanged(bool state);
     251
     252    void cbpxChanged();
     253
     254    void on_HwIDBox_valueChanged(int = 0);
     255    void on_SwIDBox_valueChanged(int);
     256    void on_crateIDBox_valueChanged(int) { cbpxChanged(); }
     257    void on_boardIDBox_valueChanged(int) { cbpxChanged(); }
     258    void on_patchIDBox_valueChanged(int) { cbpxChanged(); }
     259    void on_pixelIDBox_valueChanged(int) { cbpxChanged(); }
     260
     261    void on_autoScaleColor_clicked();
     262    void on_entireCameraScale_toggled(bool) { on_autoScaleColor_clicked(); }
     263    void on_currentPixelScale_toggled(bool) { on_autoScaleColor_clicked(); }
     264
    239265    void slicesPlusPlus();
    240266    void slicesMinusMinus();
    241     void drawCalibratedDataChanged(int state);
    242     void eventChangedFromSpinner(int cEvent);
    243     void sliceChangedFromSpinner(int cSlice);
    244 
    245 Q_SIGNALS:
    246     void updateCurrentSliceDisplay(int);
    247     void updateCurrentEventDisplay(int);
    248     void updateCurrentPCTime(QString);
    249     void updateCurrentSoftTrigger(QString);
    250     void updateCurrentTriggerType(QString);
    251     void updateCurrentPixelSliceValue(QString);
    252 
     267
     268    void on_calibratedCheckBox_stateChanged(int state);
     269    void on_displayingSliceBox_valueChanged(int);
     270    void on_displayingEventBox_valueChanged(int);
     271
     272    int SetupConfiguration(Configuration &conf);
    253273
    254274private:
    255     RawDataViewer* viewer;
    256     QTimer timer;
    257     std::string currentFile;
    258     std::string currentCalibFile;
    259     int crateID;
    260     int boardID;
    261     int patchID;
    262     int hwID;
    263     int swID;
    264     bool rescaleWholeCamera;
    265     QRectF scaleBoundingRectangle(QRectF rectangle, float scale);
    266     bool updateSpinnerDisplay;
    267 
    268 public:
    269     QListWidget *boardsTimeList;
    270     QListWidget* startPixelsList;
    271     QListWidget* startTimeMarksList;
    272 //   QLabel*      fileLoadedLabel;
    273 //    QLabel*      runNumberLabel;
    274 //    QLabel*      numberOfSlicesLabel;
    275 //    QLabel*      numberOfTimeMarksLabel;
    276 //    QLabel*      runTypeLabel;
    277 //    QLabel*      firstTimeLabel;
    278 //    QLabel*      lastTimeLabel;
    279     QLabel*      currentPixelValue;
    280     QLabel*      extraInfoLabel;
    281 
    282     QwtPlot*     boardsTimeHisto;
    283     QwtPlot*     startCellHisto;
    284     QwtPlot*     startTimeMarkHisto;
    285     QwtPlot*     pixelValueCurve;
    286275    QwtPlotCurve boardsTimeHistoItem;
    287276    QwtPlotCurve startCellHistoItem;
    288277    QwtPlotCurve startTimeMarkHistoItem;
    289     QwtPlotCurve     pixelValueCurveItem;
    290     QwtPlotCurve     aMeanCurveItem;
    291     QwtPlotCurve     vCorrCurveItem;
    292     QwtPlotCurve     meanCurveItem;
     278    QwtPlotCurve pixelValueCurveItem;
     279    QwtPlotCurve aMeanCurveItem;
     280    QwtPlotCurve vCorrCurveItem;
     281    QwtPlotCurve meanCurveItem;
     282    QwtPlotCurve triggerDelayHistoItem;
     283
    293284    QwtPlotZoomer* curveZoom;
    294285    QwtPlotZoomer* boardsTimeHistoZoom;
    295286    QwtPlotZoomer* startCellHistoZoom;
    296287    QwtPlotZoomer* startTimeMarkHistoZoom;
    297 
    298     QwtPlot*        triggerDelayHisto;
    299     QwtPlotCurve triggerDelayHistoItem;
    300288    QwtPlotZoomer* triggerDelayHistoZoom;
    301 
    302     QPushButton* autoScaleColor;
    303 
    304     QListWidget* triggerDelayList;
    305 
    306     QSpinBox*   HwIDBox;
    307     QSpinBox*   SwIDBox;
    308     QSpinBox*   crateIDBox;
    309     QSpinBox*   boardIDBox;
    310     QSpinBox*   patchIDBox;
    311 
    312     QSpinBox*   eventNumberBox;
    313 
    314     QRadioButton* currentPixelScale;
    315     QRadioButton* entireCameraScale;
    316     QRadioButton* playEventsRadio;
    317 
    318     QDoubleSpinBox* range0;
    319     QDoubleSpinBox* range1;
    320     QDoubleSpinBox* range2;
    321     QDoubleSpinBox* range3;
    322     QDoubleSpinBox* range4;
    323 
    324     QCheckBox*  drawCalibrationCheckBox;
    325 
    326     void initHistograms();
    327 
    328289};
    329290
Note: See TracChangeset for help on using the changeset viewer.