Changeset 19368


Ignore:
Timestamp:
11/10/18 18:09:41 (6 years ago)
Author:
tbretz
Message:
Allow to switch to fake calibration...
Location:
trunk/FACT++/gui/RawEventsViewer
Files:
2 edited

Legend:

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

    r19364 r19368  
    563563 * OPEN FILE. opens a new fits file
    564564 ************************************************************/
    565 void RawDataViewer::openFile(string& file)
     565void RawDataViewer::openFile(string file, bool reopen)
    566566{
    567567    if (inputFile)
     
    571571    }
    572572    try {
    573     inputFile = new factfits(file, "Events");
     573        inputFile = reopen && fIsDrsCalibration ? new zfits(file, "Events") : new factfits(file, "Events");
    574574    }
    575575    catch (std::runtime_error e)
     
    761761
    762762
    763     int backupStep = eventStep;
    764     rowNum = -1;
    765     eventStep = 1;
    766 
    767     plusEvent();
    768     eventStep = backupStep;
     763    if (!reopen)
     764    {
     765        int backupStep = eventStep;
     766        rowNum = -1;
     767        eventStep = 1;
     768        plusEvent();
     769        eventStep = backupStep;
     770    }
     771    else
     772        readEvent();
     773
    769774    emit newFileLoaded();
    770775    emit signalCurrentPixel(selectedPixel);
     
    933938        rowNum += nRows;
    934939
     940    readEvent();
     941}
     942
     943void RawDataViewer::readEvent()
     944{
    935945    if (inputFile == NULL)
    936946        return;
     
    10841094    initHistograms();
    10851095
    1086     currentFile = "none";
    1087     currentCalibFile = "none";
    1088 
    10891096    updateSpinnerDisplay = true;
    10901097    updating = false;
     
    11651172{
    11661173    GLWindow->fIsDrsCalibration = state;
     1174
     1175    if (currentCalibFile.empty())
     1176        GLWindow->openFile(currentFile, true);
     1177
    11671178    GLWindow->ApplyCalibration();
     1179
    11681180    threeD_Window->setData(GLWindow->eventData);
    11691181
     
    12921304void UIConnector::fileSelected(QString file)
    12931305{
     1306    const bool reopen = !currentFile.empty();
     1307
    12941308    currentFile = file.toStdString();
    1295     if (currentFile != "")
    1296         GLWindow->openFile(currentFile);
     1309    if (!currentFile.empty())
     1310        GLWindow->openFile(currentFile, reopen && currentCalibFile.empty());
    12971311}
    12981312void UIConnector::calibFileSelected(QString file)
    12991313{
     1314    const bool reopen = currentCalibFile.empty();
     1315
    13001316    currentCalibFile = file.toStdString();
     1317    if (reopen && !currentFile.empty())
     1318        GLWindow->openFile(currentFile, true);
    13011319    if (currentCalibFile != "")
    13021320        GLWindow->openCalibFile(currentCalibFile);
     1321
     1322
    13031323    if (GLWindow->fDrsCalib.fRoi != 0)
    13041324    {//spread the calibration data to the displayers
  • trunk/FACT++/gui/RawEventsViewer/RawEventsViewer.h

    r19314 r19368  
    5252    RawDataViewer(QWidget *parent = 0);
    5353    ~RawDataViewer();
    54     void openFile(std::string& file);
     54    void openFile(std::string file, bool reopen);
    5555    void openCalibFile(std::string& file);
    5656
     
    6565    void plusEvent();
    6666    void minusEvent();
     67    void readEvent();
    6768    void setEventStep(int step);
    6869    void nextSlice();
Note: See TracChangeset for help on using the changeset viewer.