Ignore:
Timestamp:
12/01/11 16:32:05 (13 years ago)
Author:
lyard
Message:
improved viewer
File:
1 edited

Legend:

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

    r12671 r12677  
    489489 * CONSTRUCTOR.
    490490 ************************************************************/
    491 RawDataViewer::RawDataViewer(QWidget *cParent) : BasicGlCamera(cParent), RMSvalues(1440)
     491RawDataViewer::RawDataViewer(QWidget *cParent) : BasicGlCamera(cParent), RMSvalues(1440), Meanvalues(1440), Maxvalues(1440), PosOfMaxvalues(1440)
    492492{
    493493 //   setFormat(QGLFormat(QGL::DoubleBuffer));// | QGL::DepthBuffer));
     
    11921192
    11931193    for (vector<PixelMapEntry>::const_iterator it=fPixelMap.begin(); it!=fPixelMap.end(); it++)
    1194         RMSvalues[it->index] = pixelStatsData[1*1440+it->hw()];
    1195 
     1194    {
     1195        Meanvalues[it->index]     = pixelStatsData[0*1440+it->hw()];
     1196        RMSvalues[it->index]      = pixelStatsData[1*1440+it->hw()];
     1197        Maxvalues[it->index]      = pixelStatsData[2*1440+it->hw()];
     1198        PosOfMaxvalues[it->index] = pixelStatsData[3*1440+it->hw()];
     1199
     1200    }
    11961201    if (nRoiTM == 0)//move back the data back in place
    11971202    {
     
    13911396    entireCameraScale->setChecked(true);
    13921397
    1393     GLWindow_2->enableText(false);
    1394  //   GLWindow_2->ShowPatchCursor(true);
     1398    RMS_window->enableText(false);
     1399    Mean_window->enableText(false);
     1400    PosOfMax_window->enableText(false);
     1401    Max_window->enableText(false);
     1402
     1403 //   RMS_window->ShowPatchCursor(true);
    13951404
    13961405    QObject::connect(GLWindow, SIGNAL(colorPaletteHasChanged()),
     
    14051414                     this, SLOT(newFileLoaded()));
    14061415
    1407     QObject::connect(GLWindow_2, SIGNAL(signalCurrentPixel(int)),
     1416    QObject::connect(RMS_window, SIGNAL(signalCurrentPixel(int)),
    14081417                     GLWindow, SLOT(setCurrentPixel(int)));
     1418    QObject::connect(Max_window, SIGNAL(signalCurrentPixel(int)),
     1419                     GLWindow, SLOT(setCurrentPixel(int)));
     1420    QObject::connect(PosOfMax_window, SIGNAL(signalCurrentPixel(int)),
     1421                     GLWindow, SLOT(setCurrentPixel(int)));
     1422    QObject::connect(Mean_window, SIGNAL(signalCurrentPixel(int)),
     1423                     GLWindow, SLOT(setCurrentPixel(int)));
     1424
    14091425
    14101426
     
    14181434    grid4->detach();
    14191435    grid5->detach();
     1436    grid6->detach();
    14201437    boardsTimeHistoItem.detach();
    14211438    startCellHistoItem.detach();
    14221439    startTimeMarkHistoItem.detach();
    14231440    pixelValueCurveItem.detach();
     1441    pixelAverageCurveItem.detach();
    14241442    aMeanCurveItem.detach();
    14251443    vCorrCurveItem.detach();
     
    17021720{
    17031721
    1704     GLWindow_2->SetData(GLWindow->RMSvalues);
    1705     if (GLWindow_2->isVisible())
    1706         GLWindow_2->updateGL();
     1722    RMS_window->SetData(GLWindow->RMSvalues);
     1723    Mean_window->SetData(GLWindow->Meanvalues);
     1724    PosOfMax_window->SetData(GLWindow->PosOfMaxvalues);
     1725    Max_window->SetData(GLWindow->Maxvalues);
     1726
     1727    if (RMS_window->isVisible())
     1728        RMS_window->updateGL();
     1729    if (Mean_window->isVisible())
     1730        Mean_window->updateGL();
     1731    if (PosOfMax_window->isVisible())
     1732        PosOfMax_window->updateGL();
     1733    if (Max_window->isVisible())
     1734        Max_window->updateGL();
    17071735    ostringstream str;
    17081736//    str << "Displaying Event " << cEvent;
     
    21152143    grid4->attach(pixelValueCurve);
    21162144
     2145    grid6 = new QwtPlotGrid;
     2146    grid6->enableX(false);
     2147    grid6->enableY(true);
     2148    grid6->enableXMin(false);
     2149    grid6->enableYMin(false);
     2150    grid6->setMajPen(QPen(Qt::black, 0, Qt::DotLine));
     2151    grid6->attach(pixelAverageCurve);
     2152
    21172153    grid5 = new QwtPlotGrid;
    21182154    grid5->enableX(false);
     
    21272163    startTimeMarkHisto->setAutoReplot(true);
    21282164    pixelValueCurve->setAutoReplot(true);
     2165    pixelAverageCurve->setAutoReplot(true);
    21292166    triggerDelayHisto->setAutoReplot(true);
    21302167    boardsTimeHisto->setTitle("Boards time values");
     
    21322169    startTimeMarkHisto->setTitle("Start Time Marks values");
    21332170    pixelValueCurve->setTitle("Current pixel values");
     2171    pixelAverageCurve->setTitle("Average pixels values");
    21342172    triggerDelayHisto->setTitle("Trigger Delays");
    21352173
     
    21572195//    pixelValueCurveItem.setSymbol(new QwtSymbol(QwtSymbol::Cross, Qt::NoBrush, QPen(Qt::black), QSize(5,5)));
    21582196    pixelValueCurveItem.setPen(QColor(Qt::black));
     2197    pixelAverageCurveItem.setPen(QColor(Qt::black));
    21592198    aMeanCurveItem.setPen(QColor(Qt::darkGreen));
    21602199    vCorrCurveItem.setPen(QColor(Qt::red));
    21612200    meanCurveItem.setPen(QColor(Qt::blue));
    21622201    pixelValueCurveItem.setStyle(QwtPlotCurve::Lines);
     2202    pixelAverageCurveItem.setStyle(QwtPlotCurve::Lines);
    21632203    aMeanCurveItem.setStyle(QwtPlotCurve::Lines);
    21642204    vCorrCurveItem.setStyle(QwtPlotCurve::Lines);
     
    21672207//    pixelValueCurveItem.setCurveAttribute(QwtPlotCurve::Fitted);
    21682208    pixelValueCurveItem.attach(pixelValueCurve);
     2209    pixelAverageCurveItem.attach(pixelAverageCurve);
    21692210//    aMeanCurveItem.attach(pixelValueCurve);
    21702211 //   vCorrCurveItem.attach(pixelValueCurve);
     
    21752216    curveZoom->setRubberBandPen(QPen(Qt::gray, 2, Qt::DotLine));
    21762217    curveZoom->setTrackerPen(QPen(Qt::gray));
     2218    averageCurveZoom = new QwtPlotZoomer(pixelAverageCurve->canvas());
     2219    averageCurveZoom->setRubberBandPen(QPen(Qt::gray, 2, Qt::DotLine));
     2220    averageCurveZoom->setTrackerPen(QPen(Qt::gray));
    21772221
    21782222    boardsTimeHistoZoom = new QwtPlotZoomer(boardsTimeHisto->canvas());
     
    21972241void UIConnector::pixelChanged(int pixel)
    21982242{
    2199     GLWindow_2->fWhite = pixel;
     2243    RMS_window->fWhite = pixel;
     2244    Mean_window->fWhite = pixel;
     2245    Max_window->fWhite = pixel;
     2246    PosOfMax_window->fWhite = pixel;
    22002247    if (pixel != -1)
    2201         GLWindow_2->fWhitePatch = GLWindow_2->pixelsPatch[pixel];
     2248    {
     2249        RMS_window->fWhitePatch = RMS_window->pixelsPatch[pixel];
     2250        Mean_window->fWhitePatch = Mean_window->pixelsPatch[pixel];
     2251        Max_window->fWhitePatch = Max_window->pixelsPatch[pixel];
     2252        PosOfMax_window->fWhitePatch = PosOfMax_window->pixelsPatch[pixel];
     2253    }
    22022254    else
    2203         GLWindow_2->fWhitePatch = -1;
     2255    {
     2256        RMS_window->fWhitePatch = -1;
     2257        Mean_window->fWhitePatch = -1;
     2258        Max_window->fWhitePatch = -1;
     2259        PosOfMax_window->fWhitePatch = -1;
     2260    }
    22042261    if (pixel == -1)
    22052262        return;
     
    22132270
    22142271int currentPixel = pixel;
    2215 //IN ORDER TO GET THE AVERAGE OF ALL PIXELS DISPLAYED IN THE CURVE OF THE VIEWER
    2216 //UNCOMMENT THE 9 LINES BELOW, i.e. UNTIL THE END OF AVERAGE DISPLAY COMMENT MARK
    2217 //int currentPixel = 0;
    2218 //    for (int i=0;i<GLWindow->nRoi;i++)
    2219 //        yval[i] = 0;
    2220 //    for (int j=0;j<1440;j++) {
    2221 //        currentPixel = j;
     2272
    22222273    for (int i=0;i<GLWindow->nRoi;i++)
    22232274    {
    22242275        xval[i] = i;
    22252276        yval[i] = GLWindow->eventData[GLWindow->nRoi*currentPixel + i];
    2226 //        yval[i] += GLWindow->eventData[GLWindow->nRoi*currentPixel + i];
    2227     }
    2228 //    }
    2229 //    for (int i=0;i<GLWindow->nRoi;i++)
    2230 //        yval[i] /= 1440;
    2231 //END OF AVERAGE DISPLAY COMMENTS
     2277    }
     2278
     2279
    22322280int realNumSamples = GLWindow->nRoi;
    22332281    if (GLWindow->nRoiTM != 0)
     
    22562304      //  cout << pixelIdInPatch << " " ;
    22572305    }
    2258 //cout << realNumSamples << endl;
    2259   //  GLWindow->computePulsesStatistics();
     2306
    22602307#if QWT_VERSION < 0x060000
    22612308    pixelValueCurveItem.setData(xval, yval, realNumSamples);
    2262 ////    aMeanCurveItem.setData(xval, GLWindow->aMeas, GLWindow->nRoi);
    2263  //   meanCurveItem.setData(xval, GLWindow->n1mean, GLWindow->nRoi);
    2264  //   vCorrCurveItem.setData(xval, GLWindow->vCorr, GLWindow->nRoi-3);
    22652309#else
    22662310       pixelValueCurveItem.setSamples(xval, yval, realNumSamples);
    2267 //       aMeanCurveItem.setSamples(xval, GLWindow->aMeas, GLWindow->nRoi);
    2268  //      meanCurveItem.setSamples(xval, GLWindow->n1mean, GLWindow->nRoi);
    2269  //      vCorrCurveItem.setSamples(xval, GLWindow->vCorr, GLWindow->nRoi-3);
    22702311#endif
    22712312
     2313//now compute the average value of all pixels
     2314       currentPixel = 0;
     2315       for (int i=0;i<GLWindow->nRoi;i++)
     2316           yval[i] = 0;
     2317       for (int j=0;j<1440;j++) {
     2318           currentPixel = j;
     2319           for (int i=0;i<GLWindow->nRoi;i++)
     2320           {
     2321               xval[i] = i;
     2322               yval[i] += GLWindow->eventData[GLWindow->nRoi*currentPixel + i];
     2323           }
     2324       }
     2325       for (int i=0;i<GLWindow->nRoi;i++)
     2326           yval[i] /= 1440;
     2327#if QWT_VERSION < 0x060000
     2328       pixelAverageCurveItem.setData(xval, yval, GLWindow->nRoi);
     2329#else
     2330    pixelAverageCurveItem.setSamples(xval, yval, realNumSamples);
     2331#endif
    22722332
    22732333    QStack< QRectF > stack;
    22742334    stack.push(scaleBoundingRectangle(pixelValueCurveItem.boundingRect(), 1.5f));
    22752335    curveZoom->setZoomStack(stack);
     2336    stack.pop();
     2337    stack.push(scaleBoundingRectangle(pixelAverageCurveItem.boundingRect(), 1.5f));
     2338    averageCurveZoom->setZoomStack(stack);
    22762339    stack.pop();
    22772340
Note: See TracChangeset for help on using the changeset viewer.