Changeset 12173 for trunk/FACT++


Ignore:
Timestamp:
10/12/11 12:04:33 (13 years ago)
Author:
tbretz
Message:
Fixed a weird asymmetric color scale; fixed the wrong DRS calibration by using the proper class; hacked the rest to get this working.
Location:
trunk/FACT++/gui/RawEventsViewer
Files:
2 edited

Legend:

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

    r12157 r12173  
     1/*
    12/*
    23 * QtGl.cpp
     
    270271    float divideMe = (float)(VALUES_SPAN-1);
    271272    float plusMe = VALUES_SPAN/2;
     273
     274    cout << "---> value span..." << endl;
     275
     276    /*
    272277    if (drawCalibrationLoaded)
    273278        plusMe += 0;//VALUES_SPAN/2;
     
    276281        divideMe /=2;
    277282        plusMe = 0 ;///=2;
    278     }
     283        }*/
     284
    279285    for (int i=0;i<nRoi-1;i++)
    280286    {
     
    460466        updateNeighbors(i);
    461467
    462     calibrationLoaded = false;
    463     drawCalibrationLoaded = false;
     468    //calibrationLoaded = false;
     469    //drawCalibrationLoaded = false;
    464470
    465471}
     
    10391045void RawDataViewer::openCalibFile(string& file)
    10401046{
    1041     calibrationLoaded = false;
     1047    //calibrationLoaded = false;
     1048
     1049    MessageImp msg;
     1050    if (!DataCalib::ReadFits(file, msg))
     1051    {
     1052        DataCalib::Restart();
     1053        return;
     1054    }
     1055    /*
     1056
    10421057    calibInputFile = new fits(file);
    10431058    if (!*calibInputFile)
     
    10731088
    10741089    delete calibInputFile;
    1075 
    1076     calibrationLoaded = true;
     1090*/
     1091    //calibrationLoaded = true;
    10771092
    10781093    emit newFileLoaded();
    1079     if (drawCalibrationLoaded)
     1094
     1095    //if (calibratedCheckBox->isChecked())
    10801096        updateGL();
    10811097}
     
    11251141#endif
    11261142
    1127     if (drawCalibrationLoaded && calibrationLoaded)
    1128     {
     1143//    if (drawCalibrationLoaded && calibrationLoaded)
     1144//    {
     1145
     1146//    if (calibratedCheckBox->isChecked())
     1147        DataCalib::Apply(eventData, rawEventData, startPix, nRoi);
     1148/*
    11291149        for (int i=0;i<1440;i++)
    11301150            for (int j=0;j<nRoi;j++)
    11311151            {
    1132                 int realj = (j+startPix[j])%1024;
     1152                int realj = (j+startPix[i])%1024;
    11331153                eventData[i*1024+j] *= 2000.f/4096.f;
    11341154                eventData[i*1024+j] -= (baseLineMean[i*1024+realj]+triggerOffsetMean[i*1024+j]);
     
    11371157            }
    11381158    }
    1139     updateGL();
     1159    */
     1160        updateGL();
    11401161    emit signalCurrentEvent(eventNum);
    11411162    emit signalCurrentPixel(selectedPixel);
     
    12771298void UIConnector::drawCalibratedDataChanged(int state)
    12781299{
    1279      if (state)
    1280     {
    1281         if (viewer->calibrationLoaded)
    1282         {
    1283             viewer->drawCalibrationLoaded = true;
    1284             for (int i=0;i<1440;i++)
    1285                 for (int j=0;j<viewer->nRoi;j++)
    1286                 {
    1287                     int realj = (j+viewer->startPix[j])%1024;
    1288                     viewer->eventData[i*1024+j] *= 2000.f/4096.f;
    1289                     viewer->eventData[i*1024+j] -= (viewer->baseLineMean[i*1024+realj]+viewer->triggerOffsetMean[i*1024+j]);
    1290                     viewer->eventData[i*1024+j] /= viewer->gainMean[i*1024+realj];
    1291                     viewer->eventData[i*1024+j] *= (50000.f/65536.f) * 2500.f;
    1292                 }
    1293             viewer->updateGL();
    1294         }
    1295         else
    1296         {
    1297             drawCalibrationCheckBox->setChecked(false);
    1298         }
    1299     }
    1300     else
    1301     {
    1302         viewer->drawCalibrationLoaded = false;
    1303         if (viewer->calibrationLoaded)
    1304         {
    1305             for (int i=0;i<1440;i++)
    1306                 for (int j=0;j<viewer->nRoi;j++)
    1307                 {
    1308                     int realj = (j+viewer->startPix[j])%1024;
    1309                     viewer->eventData[i*1024+j] /= (50000.f/65536.f) * 2500.f;
    1310                     viewer->eventData[i*1024+j] *= viewer->gainMean[i*1024+realj];
    1311                     viewer->eventData[i*1024+j] += (viewer->baseLineMean[i*1024+realj]+viewer->triggerOffsetMean[i*1024+j]);
    1312                     viewer->eventData[i*1024+j] /= 2000.f/4096.f;
    1313                }
    1314             viewer->updateGL();
    1315         }
    1316 
    1317     }
    1318      autoScalePressed();
    1319      pixelChanged(viewer->selectedPixel);
     1300    cout << "=== drawCalibratedDataChanged " << state << endl;
     1301
     1302    for (int i=0;i<(1440+160)*viewer->nRoi;i++)
     1303        viewer->eventData[i] = (float)viewer->rawEventData[i];
     1304
     1305//    if (viewer->calibratedCheckBox->isChecked())
     1306    if (state)
     1307        DataCalib::Apply(viewer->eventData, viewer->rawEventData, viewer->startPix, viewer->nRoi);
     1308
     1309    viewer->updateGL();
     1310
     1311    //drawCalibrationCheckBox->setChecked(false);
     1312
     1313    autoScalePressed();
     1314    pixelChanged(viewer->selectedPixel);
    13201315
    13211316}
     
    13251320void UIConnector::drawPatchesCheckChange(int state)
    13261321{
    1327     if (state)
    1328         viewer->drawPatch = true;
    1329     else
    1330         viewer->drawPatch = false;
     1322    viewer->drawPatch = state;
    13311323    viewer->updateGL();
    13321324}
     
    13361328void UIConnector::drawImpulseCheckChange(int state)
    13371329{
    1338     if (state)
    1339         viewer->drawImpulse = true;
    1340     else
    1341         viewer->drawImpulse = false;
     1330    viewer->drawImpulse = state;
    13421331    viewer->updateGL();
    13431332}
     
    13471336void UIConnector::drawBlurCheckChange(int state)
    13481337{
    1349     if (state)
    1350         viewer->drawBlur = true;
    1351     else
    1352         viewer->drawBlur = false;
     1338    viewer->drawBlur = state;
    13531339    viewer->updateGL();
    13541340}
    13551341void UIConnector::loopEventCheckChange(int state)
    13561342{
    1357     if (state)
    1358         viewer->loopCurrentEvent = true;
    1359     else
    1360         viewer->loopCurrentEvent = false;
     1343    viewer->loopCurrentEvent = state;
    13611344}
    13621345/************************************************************
     
    16281611    extraInfoLabel->setText(QString(str.str().c_str()));
    16291612
     1613    /*
    16301614    if (viewer->calibrationLoaded)
    16311615    {
    16321616        drawCalibrationCheckBox->setEnabled(true);
    1633     }
     1617    }*/
    16341618
    16351619
     
    24092393    viewer->ss[4] = maxRange;
    24102394    range4->setValue(viewer->ss[4]);
    2411     viewer->ss[2] = midRange;
     2395//    viewer->ss[2] = midRange;
     2396//    range2->setValue(viewer->ss[2]);
     2397//    viewer->ss[1] = (minRange+midRange)/2;
     2398//    range1->setValue(viewer->ss[1]);
     2399//    viewer->ss[3] = (maxRange+midRange)/2;
     2400//    range3->setValue(viewer->ss[3]);
     2401
     2402    viewer->ss[2] = (maxRange+minRange)/2;
    24122403    range2->setValue(viewer->ss[2]);
    2413     viewer->ss[1] = (minRange+midRange)/2;
     2404
     2405    viewer->ss[1] = minRange+(maxRange-minRange)/4;
    24142406    range1->setValue(viewer->ss[1]);
    2415     viewer->ss[3] = (maxRange+midRange)/2;
     2407
     2408    viewer->ss[3] = minRange+3*(maxRange-minRange)/4;
    24162409    range3->setValue(viewer->ss[3]);
    24172410
     
    24612454    configs.add_options()
    24622455        ("color.range", vars<double>(), "Range of the display colours")
    2463         ("color.red", vars<double>(), "Range of red values")
     2456        ("color.red",   vars<double>(), "Range of red values")
    24642457        ("color.green", vars<double>(), "Range of green values")
    2465         ("color.blue", vars<double>(), "Range of blue values")
    2466         ("file,f", var<string>(), "File to be loaded at startup")
     2458        ("color.blue",  vars<double>(), "Range of blue values")
     2459        ("file,f",      var<string>(),  "File to be loaded")
     2460        ("drs,d",       var<string>(),  "DRS calibration file to be loaded")
    24672461        ;
    24682462    conf.AddOptions(configs);
     
    24702464    po::positional_options_description p;
    24712465    p.add("file", 1); // The first positional options
     2466    p.add("drs",  2); // The first positional options
    24722467    conf.SetArgumentPositions(p);
    24732468
     
    26192614    connector.range4 = myUi.colorRange4;
    26202615    connector.drawCalibrationCheckBox = myUi.calibratedCheckBox;
    2621     connector.drawCalibrationCheckBox->setEnabled(false);
     2616//    connector.drawCalibrationCheckBox->setEnabled(false);
    26222617
    26232618    connector.initHistograms();
     
    27712766    if (conf.Has("file"))
    27722767    {
    2773         string str = conf.Get<string>("file");
    2774         QString qstr(str.c_str());
     2768        const QString qstr(conf.Get<string>("file").c_str());
    27752769        connector.fileSelected(qstr);
    27762770    }
    27772771
     2772    if (conf.Has("drs"))
     2773    {
     2774        const QString qstr(conf.Get<string>("drs").c_str());
     2775        connector.calibFileSelected(qstr);
     2776    }
     2777
    27782778    mainWindow.show();
    27792779
  • trunk/FACT++/gui/RawEventsViewer/RawEventsViewer.h

    r12158 r12173  
    4444
    4545#include <string>
     46
     47#include "../../src/DataCalib.h"
     48
    4649
    4750namespace std
     
    153156//    vector<edge> patchesIndices[160];
    154157    std::fits* inputFile;
    155     std::fits* calibInputFile;
    156     float baseLineMean[1440*1024];
    157     float gainMean[1440*1024];
    158     float triggerOffsetMean[1440*1024];
    159     bool calibrationLoaded;
     158//    std::fits* calibInputFile;
     159//    float baseLineMean[1440*1024];
     160//    float gainMean[1440*1024];
     161//    float triggerOffsetMean[1440*1024];
     162//    bool calibrationLoaded;
    160163    bool drawCalibrationLoaded;
    161164
Note: See TracChangeset for help on using the changeset viewer.