Ignore:
Timestamp:
08/12/11 16:23:54 (13 years ago)
Author:
lyard
Message:
many changes...
Location:
trunk/FACT++/gui/RawEventsViewer
Files:
3 edited

Legend:

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

    r11900 r11901  
    2525#include "src/Configuration.h"
    2626
    27 //Coordinates of an hexagon of radius 1 and center 0
    28 GLfloat hexcoords[6][2] = {{-0.577367206,  1},
    29                            { 0.577367206,  1},
    30                            { 1.154734411,  0},
    31                            { 0.577367206, -1},
    32                            {-0.577367206, -1},
    33                            {-1.154734411,  0}};
     27//#include "../BasicGlCamera.cc"
     28
     29#undef ACTUAL_NUM_PIXELS
     30#define ACTUAL_NUM_PIXELS 1440
    3431
    3532//bounding box for diplaying the impulse curve
     
    3734float bboxMax[2] = {0.8,-0.3};
    3835/************************************************************
    39  * UPDATE NEIGHBORS recalculate the neighbors of the current pixels.
    40  * Only takes the previous pixels into account (and updates them, too)
    41  ************************************************************/
    42 void RawDataViewer::updateNeighbors(int currentPixel)
    43 {
    44     float squaredDistance = 0;
    45     for (int i=0;i<currentPixel;i++)
    46     {
    47         squaredDistance = (pixelsCoords[i][0] - pixelsCoords[currentPixel][0])*
    48                           (pixelsCoords[i][0] - pixelsCoords[currentPixel][0]) +
    49                           (pixelsCoords[i][1] - pixelsCoords[currentPixel][1])*
    50                           (pixelsCoords[i][1] - pixelsCoords[currentPixel][1]);
    51         if (squaredDistance < 4*hexRadius*hexRadius*(1.0f+hexTolerance))//neighbor !
    52         {//ok, but which one ?
    53             if (fabs(pixelsCoords[i][0] - pixelsCoords[currentPixel][0]) < hexTolerance &&
    54                 pixelsCoords[i][1] < pixelsCoords[currentPixel][1]){//top
    55                 neighbors[i][0] = currentPixel;
    56                 neighbors[currentPixel][3] = i;
    57                 continue;}
    58             if (fabs(pixelsCoords[i][0] - pixelsCoords[currentPixel][0]) < hexTolerance &&
    59                 pixelsCoords[i][1] > pixelsCoords[currentPixel][1]){//bottom
    60                 neighbors[i][3] = currentPixel;
    61                 neighbors[currentPixel][0] = i;
    62                 continue;}
    63             if (pixelsCoords[i][0] > pixelsCoords[currentPixel][0] &&
    64                 pixelsCoords[i][1] > pixelsCoords[currentPixel][1]){//top right
    65                 neighbors[i][4] = currentPixel;
    66                 neighbors[currentPixel][1] = i;
    67                 continue;}
    68             if (pixelsCoords[i][0] > pixelsCoords[currentPixel][0] &&
    69                 pixelsCoords[i][1] < pixelsCoords[currentPixel][1]){//bottom right
    70                 neighbors[i][5] = currentPixel;
    71                 neighbors[currentPixel][2] = i;
    72                 continue;}
    73             if (pixelsCoords[i][0] < pixelsCoords[currentPixel][0] &&
    74                 pixelsCoords[i][1] > pixelsCoords[currentPixel][1]){//top left
    75                 neighbors[i][2] = currentPixel;
    76                 neighbors[currentPixel][5] = i;
    77                 continue;}
    78             if (pixelsCoords[i][0] < pixelsCoords[currentPixel][0] &&
    79                 pixelsCoords[i][1] < pixelsCoords[currentPixel][1]){//bottom left
    80                 neighbors[i][1] = currentPixel;
    81                 neighbors[currentPixel][4] = i;
    82                 continue;}
    83         }
    84     }
    85 }
    86 /************************************************************
    87  * SKIP PIXELS skips a given number of pixels.
    88  * Only update the pixel coordinates. i.e. update neighbors must
    89  * called again afterwards.
    90  ************************************************************/
    91 void RawDataViewer::skipPixels(int start, int howMany)
    92 {
    93     for (int i=start;i<MAX_NUM_PIXELS-howMany;i++)
    94     {
    95         pixelsCoords[i][0] = pixelsCoords[i+howMany][0];
    96         pixelsCoords[i][1] = pixelsCoords[i+howMany][1];
    97     }
    98 }
    99 /************************************************************
    100  * CALCULATE PIXELS COORDS as the name suggests
    101  ************************************************************/
    102 void RawDataViewer::calculatePixelsCoords()
    103 {
    104     pixelsCoords[0][0] = 0;
    105     pixelsCoords[0][1] = 0.3;
    106     pixelsCoords[0][2] = 0;
    107     pixelsCoords[1][0] = 0;
    108     pixelsCoords[1][1] = 0.3+2*hexRadius;
    109     pixelsCoords[1][2] = 0;
    110     neighbors[0][0] = 1;
    111     neighbors[1][3] = 0;
    112     //from which side of the previous hexagon are we coming from ?
    113     int fromSide = 3;
    114     //to which side are we heading to ?
    115     int toSide = 0;
    116     for (int i=2;i<MAX_NUM_PIXELS;i++)
    117     {
    118         toSide = fromSide-1;
    119         if (toSide < 0)
    120             toSide =5;
    121         while (neighbors[i-1][toSide] >= 0)
    122         {
    123             toSide--;
    124             if (toSide < 0)
    125                 toSide = 5;
    126         }
    127         fromSide = toSide + 3;
    128         if (fromSide > 5)
    129             fromSide -= 6;
    130         //ok. now we now in which direction we're heading
    131         pixelsCoords[i][0] = pixelsCoords[i-1][0];
    132         pixelsCoords[i][1] = pixelsCoords[i-1][1];
    133         pixelsCoords[i][2] = pixelsCoords[i-1][2];
    134         switch (toSide)
    135         {
    136         case 0:
    137             pixelsCoords[i][1] += 2*hexRadius;
    138         break;
    139         case 1:
    140             pixelsCoords[i][0] += (2*hexRadius)*sin(M_PI/3.0);
    141             pixelsCoords[i][1] += (2*hexRadius)*cos(M_PI/3.0);
    142         break;
    143         case 2:
    144             pixelsCoords[i][0] += (2*hexRadius)*sin(M_PI/3.0);
    145             pixelsCoords[i][1] -= (2*hexRadius)*cos(M_PI/3.0);
    146         break;
    147         case 3:
    148             pixelsCoords[i][1] -= 2*hexRadius;
    149         break;
    150         case 4:
    151             pixelsCoords[i][0] -= (2*hexRadius)*sin(M_PI/3.0);
    152             pixelsCoords[i][1] -= (2*hexRadius)*cos(M_PI/3.0);
    153         break;
    154         case 5:
    155             pixelsCoords[i][0] -= (2*hexRadius)*sin(M_PI/3.0);
    156             pixelsCoords[i][1] += (2*hexRadius)*cos(M_PI/3.0);
    157         break;
    158         };
    159 
     36 * CALC BLUR COLOR if in blur display mode, calculate the interpolated
     37 * colour for a given vertex
     38 ************************************************************/
     39void RawDataViewer::calcBlurColor(int pixel,  int vertex)
     40{
     41    GLfloat color[3];
     42    int first, second;
     43    first = vertex-1;
     44    second = vertex;
     45    if (first < 0)
     46        first = 5;
     47    first = neighbors[pixel][first];
     48    second = neighbors[pixel][second];
     49    for (int i=0;i<3;i++)
     50        color[i] = pixelsColor[pixel][i];
     51    float divide = 1;
     52    if (first != -1)
     53    {
     54        divide++;
     55        for (int i=0;i<3;i++)
     56            color[i] += pixelsColor[first][i];
     57    }
     58    if (second != -1)
     59    {
     60        divide++;
     61        for (int i=0;i<3;i++)
     62            color[i] += pixelsColor[second][i];
     63    }
     64    for (int i=0;i<3;i++)
     65        color[i] /= divide;
     66    glColor3fv(color);
     67}
     68/************************************************************
     69 * DRAW BLURRY HEXAGON. draws a solid hexagon, with interpolated colours
     70 ************************************************************/
     71void RawDataViewer::drawBlurryHexagon(int index)
     72{
     73    GLfloat color[3];
     74    for (int i=0;i<3;i++)
     75        color[i] = pixelsColor[index][i];
     76    glBegin(GL_TRIANGLES);
     77    calcBlurColor(index, 0);
     78    glVertex2fv(verticesList[verticesIndices[index][0]]);
     79    glColor3fv(color);
     80    glVertex2fv(pixelsCoords[index]);
     81    calcBlurColor(index, 1);
     82    glVertex2fv(verticesList[verticesIndices[index][1]]);
     83
     84    glVertex2fv(verticesList[verticesIndices[index][1]]);
     85    glColor3fv(color);
     86    glVertex2fv(pixelsCoords[index]);
     87    calcBlurColor(index, 2);
     88    glVertex2fv(verticesList[verticesIndices[index][2]]);
     89
     90    glVertex2fv(verticesList[verticesIndices[index][2]]);
     91    glColor3fv(color);
     92    glVertex2fv(pixelsCoords[index]);
     93    calcBlurColor(index, 3);
     94    glVertex2fv(verticesList[verticesIndices[index][3]]);
     95
     96    glVertex2fv(verticesList[verticesIndices[index][3]]);
     97    glColor3fv(color);
     98    glVertex2fv(pixelsCoords[index]);
     99    calcBlurColor(index, 4);
     100    glVertex2fv(verticesList[verticesIndices[index][4]]);
     101
     102    glVertex2fv(verticesList[verticesIndices[index][4]]);
     103    glColor3fv(color);
     104    glVertex2fv(pixelsCoords[index]);
     105    calcBlurColor(index, 5);
     106    glVertex2fv(verticesList[verticesIndices[index][5]]);
     107
     108    glVertex2fv(verticesList[verticesIndices[index][5]]);
     109    glColor3fv(color);
     110    glVertex2fv(pixelsCoords[index]);
     111    calcBlurColor(index, 0);
     112    glVertex2fv(verticesList[verticesIndices[index][0]]);
     113    glEnd();
     114
     115    return;
     116}
     117
     118/************************************************************
     119 * DRAW CAMERA draws all the camera pixels
     120 ************************************************************/
     121void RawDataViewer::drawCamera(bool alsoWire)
     122{
     123    glLoadIdentity();
     124    if (!drawImpulse)
     125    {
     126        glTranslatef(0,-0.44,0);
     127        glRotatef(cameraRotation, 0,0,-1);
     128        if (cameraRotation == 90)
     129        {
     130            glTranslatef(-0.45,-0.45,0);
     131 //           cout << "correction" << endl;
     132        }
     133        if (cameraRotation == -90)
     134        {
     135            glTranslatef(0.45,-0.45,0);
     136        }
     137        glScalef(1.5,1.5,1);
     138    }
     139    else
     140    {
     141        glRotatef(cameraRotation, 0,0,-1);
     142          if (cameraRotation == 90)
     143        {
     144            glTranslatef(-0.45/1.5,-0.45/1.5,0);
     145 //           cout << "correction" << endl;
     146        }
     147        if (cameraRotation == -90)
     148        {
     149            glTranslatef(0.45/1.5,-0.45/1.5,0);
     150        }
     151  }
     152    glColor3f(0.5,0.5,0.5);
     153    glLineWidth(1.0);
     154    float color;
     155//cout << "Actual num pixels: " << ACTUAL_NUM_PIXELS << endl;
     156    for (int i=0;i<ACTUAL_NUM_PIXELS;i++)
     157    {
     158        if (!nRoi)
     159          color = (float)(i)/(float)(ACTUAL_NUM_PIXELS);
     160        else
     161#ifdef LOAD_RAW
     162        color = float(eventsData[eventNum][i][whichSlice]+(VALUES_SPAN/2))/(float)(VALUES_SPAN-1);
     163#else
     164        color = float(eventData[nRoi*i + whichSlice]+(VALUES_SPAN/2))/(float)(VALUES_SPAN-1);
     165        if (logScale)
     166        {
     167            color *= 9;
     168            color += 1;
     169            color = log10(color);
     170        }
     171#endif
     172        if (color < 0)
     173        {
     174            pixelsColor[i][0] = tooLowValueCoulour[0];
     175            pixelsColor[i][1] = tooLowValueCoulour[1];
     176            pixelsColor[i][2] = tooLowValueCoulour[2];
     177            continue;
     178        }
     179        if (color > 1)
     180        {
     181            pixelsColor[i][0] = tooHighValueCoulour[0];
     182            pixelsColor[i][1] = tooHighValueCoulour[1];
     183            pixelsColor[i][2] = tooHighValueCoulour[2];
     184            continue;
     185        }
     186        int index = 0;
     187        while (ss[index] < color && index < 4)
     188            index++;
     189        index--;
     190        if (index < 0) index = 0;
     191        float weight0 = (color-ss[index]) / (ss[index+1]-ss[index]);
     192        if (weight0 > 1.0f) weight0 = 1.0f;
     193        if (weight0 < 0.0f) weight0 = 0.0f;
     194        float weight1 = 1.0f-weight0;
     195        pixelsColor[i][0] = weight1*rr[index] + weight0*rr[index+1];
     196        pixelsColor[i][1] = weight1*gg[index] + weight0*gg[index+1];
     197        pixelsColor[i][2] = weight1*bb[index] + weight0*bb[index+1];
     198    }
     199
     200    for (int i=0;i<ACTUAL_NUM_PIXELS;i++)
     201    {
     202        if (i == 690 ||
     203            i == 70)
     204            continue;
     205        glColor3fv(pixelsColor[i]);
     206        glLoadName(i);
     207if (drawBlur)
     208    drawBlurryHexagon(i);
     209else
     210    drawHexagon(i,true);
     211
     212    }
     213    if (!alsoWire)
     214        return;
     215    glColor3f(0.0f,0.0f,0.0f);
     216    for (int i=0;i<ACTUAL_NUM_PIXELS;i++)
     217    {
     218        if (i == 690 ||
     219            i == 70)
     220            continue;
     221        drawHexagon(i, false);
     222    }
     223
     224}
     225
     226/************************************************************
     227 * TRIM. FIXME this should not be here but taken from an existing class (somewhere)
     228 ***********************************************************
     229string Trim(const string &str)
     230{
     231    // Trim Both leading and trailing spaces
     232    const size_t start = str.find_first_not_of(' '); // Find the first character position after excluding leading blank spaces
     233    const size_t end   = str.find_last_not_of(' ');  // Find the first character position from reverse af
     234
     235    // if all spaces or empty return an empty string
     236    if (string::npos==start || string::npos==end)
     237        return string();
     238
     239    return str.substr(start, end-start+1);
     240}*/
     241/************************************************************
     242 * DRAW PIXEL CURVE. draws the raw impulse curve of the currently selected pixel
     243 ************************************************************/
     244void RawDataViewer::drawPixelCurve()
     245{
     246    if (!nRoi)
     247        return;
     248
     249    float xZoom, yZoom;
     250    xZoom = yZoom = 1.0f;
     251
     252    glBegin(GL_LINES);
     253    glLineWidth(1.0f);
     254    glColor3f(0.5,0.5,0.5);
     255    glVertex2f(bboxMin[0], bboxMin[1]);
     256    glVertex2f(bboxMax[0], bboxMin[1]);
     257    glVertex2f(bboxMin[0], bboxMin[1]);
     258    glVertex2f(bboxMin[0], bboxMax[1]);
     259    glVertex2f(bboxMin[0], (bboxMin[1]+bboxMax[1])/2.0f);
     260    glVertex2f(bboxMax[0], (bboxMin[1]+bboxMax[1])/2.0f);
     261    float xRange = bboxMax[0] - bboxMin[0];
     262    float yRange = bboxMax[1] - bboxMin[1];
     263    glColor3f(1.0,1.0,1.0);
     264    float divideMe = (float)(VALUES_SPAN-1);
     265    float plusMe = VALUES_SPAN/2;
     266    if (drawCalibrationLoaded)
     267        plusMe += 0;//VALUES_SPAN/2;
     268    if (drawCalibrationLoaded && calibrationLoaded)
     269    {
     270        divideMe /=2;
     271        plusMe /=2;
     272    }
     273    for (int i=0;i<nRoi-1;i++)
     274    {
     275#ifdef LOAD_RAW
     276        glVertex2f(bboxMin[0] + xRange*i/(float)nRoi,
     277                   bboxMin[1] + yRange*(eventsData[eventNum][selectedPixel][i]+plusMe) /divideMe);
     278        glVertex2f(bboxMin[0] + xRange*(i+1)/(float)nRoi,
     279                   bboxMin[1] + yRange*(eventsData[eventNum][selectedPixel][i+1]+plusMe) /divideMe);
     280#else
     281
     282        glVertex2f(bboxMin[0] + xRange*i/(float)nRoi,
     283                   bboxMin[1] + yRange*(eventData[nRoi*selectedPixel + i]+plusMe) /divideMe);
     284        glVertex2f(bboxMin[0] + xRange*(i+1)/(float)nRoi,
     285                   bboxMin[1] + yRange*(eventData[nRoi*selectedPixel + i+1]+plusMe) /divideMe);
     286#endif
     287    }
     288    glColor3f(1.0,0.0,0.0);
     289    glVertex2f(bboxMin[0] + xRange*whichSlice/(float)nRoi,
     290               bboxMin[1]);
     291    glVertex2f(bboxMin[0] + xRange*whichSlice/(float)nRoi,
     292               bboxMax[1]);
     293    glEnd();
     294    glEnable(GL_MULTISAMPLE);
     295    setFont(QFont("Times", 12));
     296    qglColor(QColor(255,223,127));
     297    float xShift = 0.10f;
     298    float yShift = 0.01f;
     299    renderText(bboxMin[0]-xShift/2.0f, bboxMax[1]+3*yShift, 0, QString("Volts"));
     300    if (drawCalibrationLoaded)
     301    {
     302        renderText(bboxMin[0]-xShift, bboxMax[1]-yShift,0,QString("+2.10"));
     303        renderText(bboxMin[0]-xShift,  ((bboxMin[1]+bboxMax[1])/2.0f) - yShift, 0, QString("+1.05"));//((bboxMin[1]+bboxMax[1])/2.0f)
     304        renderText(bboxMin[0]-xShift, bboxMin[1]-yShift, 0, QString("0.00"));
     305    }
     306    else
     307    {
     308        renderText(bboxMin[0]-xShift, bboxMax[1]-yShift,0,QString("+1.05"));
     309        renderText(bboxMin[0]-xShift,  ((bboxMin[1]+bboxMax[1])/2.0f) - yShift, 0, QString("+0.00"));//((bboxMin[1]+bboxMax[1])/2.0f)
     310        renderText(bboxMin[0]-xShift, bboxMin[1]-yShift, 0, QString("-1.05"));
     311    }
     312    renderText(bboxMax[0]+xShift/2.0f, bboxMin[1]-4*yShift, 0, QString("Slices"));
     313    renderText(bboxMin[0]-yShift/2.0f, bboxMin[1]-4*yShift, 0, QString("0"));
     314    ostringstream str;
     315    str << nRoi/2;
     316    renderText(((bboxMin[0]+bboxMax[0])/2.0f)-xShift/2.0f, bboxMin[1]-4*yShift, 0, QString(str.str().c_str()));
     317    str.str("");
     318    str << nRoi;
     319    renderText(bboxMax[0]-xShift/2.0f, bboxMin[1]-4*yShift, 0, QString(str.str().c_str()));
     320
     321}
     322/************************************************************
     323 * CONSTRUCTOR.
     324 ************************************************************/
     325RawDataViewer::RawDataViewer(QWidget *cParent) : BasicGlCamera(cParent)
     326{
     327 //   setFormat(QGLFormat(QGL::DoubleBuffer));// | QGL::DepthBuffer));
     328    whichSlice = 0;
     329#ifdef LOAD_RAW
     330    nRoi = 1024;
     331#else
     332    nRoi = 0;
     333#endif
     334    eventNum = 0;
     335    rowNum = -1;
     336    eventStep = 1;
     337    selectedPixel = 393;
     338    inputFile = NULL;
     339    eventData = NULL;
     340    drawPatch = true;
     341    drawImpulse = false;
     342    drawBlur = false;
     343    loopCurrentEvent = false;
     344#ifdef LOAD_RAW
     345    loadEvents("/scratch/00000043.001_T.bin");
     346#endif
     347//    cout << "avant" << endl;
     348//    calculatePixelsCoords();
     349//    cout << "apres" << endl;
     350/*
     351    ifstream fin2("MasterList-v3.txt");
     352    if (!fin2.is_open())
     353    {
     354        cout << "Error: file \"MasterList-v3\" missing. aborting." << endl;
     355        exit(-1);
     356    }
     357    int l = 0;
     358    string buf;
     359    while (getline(fin2, buf, '\n'))
     360    {
     361        buf = Trim(buf);
     362        if (buf[0]=='#')
     363            continue;
     364
     365        unsigned int softid, hardid, dummy;
     366
     367        stringstream str(buf);
     368
     369        str >> softid;
     370        str >> dummy;
     371        str >> hardid;
     372
     373        if (softid>=1440)
     374            continue;
     375
     376        hardwareMapping[softid] = hardid;
     377        softwareMapping[hardid] = softid;
     378
     379        l++;
     380    }*/
     381    GLfloat tempPixelsCoords[MAX_NUM_PIXELS][3];
     382    for (int i=0;i<1440;i++)
     383        for (int j=0;j<3;j++)
     384            tempPixelsCoords[hardwareMapping[i]][j] = pixelsCoords[i][j];
     385    for (int i=0;i<1440;i++)
     386        for (int j=0;j<3;j++)
     387            pixelsCoords[i][j] = tempPixelsCoords[i][j];
     388
     389    for (int i=0;i<1440;i++)
     390    updateNeighbors(i);
     391    buildVerticesList();
     392
     393/*    ifstream fin1("Trigger-Patches.txt");
     394   if (!fin1.is_open())
     395   {
     396       cout << "Error: file \"Trigger-Patches.txt\" missing. Aborting." << endl;
     397       exit(-1);
     398   }
     399   l=0;
     400    while (getline(fin1, buf, '\n'))
     401    {
     402        buf = Trim(buf);
     403        if (buf[0]=='#')
     404            continue;
     405
     406        stringstream str(buf);
     407        for (int i=0; i<9; i++)
     408        {
     409            unsigned int n;
     410            str >> n;
     411
     412            if (n>=1440)
     413                continue;
     414
     415            patches[l][i] = hardwareMapping[n];
     416        }
     417        l++;
     418    }*/
     419
     420    buildPatchesIndices();
     421    float color[3];
     422    for (int i=0;i<160;i++)
     423    {
     424        color[0] = 0.5; color[1] = 0.5; color[2] = 0.3;
     425        for (int j=0;j<3;j++)
     426            patchesColor[i][j] = color[j];
     427    }
     428
     429    for (int i=0;i<1440;i++)
    160430        updateNeighbors(i);
    161     }
    162     //Ok. So now we've circled around all the way to MAX_NUM_PIXELS
    163     //do the required shifts so that it matches the fact camera up to ACTUAL_NUM_PIXELS pixels
    164     skipPixels(1200, 1);
    165     skipPixels(1218, 3);
    166     skipPixels(1236, 1);
    167     skipPixels(1256, 1);
    168     skipPixels(1274, 3);
    169     skipPixels(1292, 3);
    170     skipPixels(1309, 6);
    171     skipPixels(1323, 7);
    172     skipPixels(1337, 6);
    173     skipPixels(1354, 6);
    174     skipPixels(1368, 7);
    175     skipPixels(1382, 9);
    176     skipPixels(1394, 12);
    177     skipPixels(1402, 15);
    178     skipPixels(1410, 12);
    179     skipPixels(1422, 12);
    180     skipPixels(1430, 15);
    181 }
    182 /************************************************************
    183  * BUILD VERTICES LIST. from the coordinates of the camera pixels,
    184  * calculate the list and coordinates of the vertices required to draw the
    185  * entire camera.
    186  ************************************************************/
    187 void RawDataViewer::buildVerticesList()
    188 {
    189     numVertices = 0;
    190     GLfloat cVertex[2];
    191     for (int i=0;i<ACTUAL_NUM_PIXELS;i++)
    192     {
    193         for (int j=0;j<6;j++)
    194         {
    195             for (int k=0;k<2;k++)
    196                 cVertex[k] = hexcoords[j][k]*hexRadius + pixelsCoords[i][k];
    197             bool found = false;
    198             for (int k=0;k<numVertices;k++)
    199             {
    200                 if ((cVertex[0] - verticesList[k][0])*
    201                     (cVertex[0] - verticesList[k][0]) +
    202                     (cVertex[1] - verticesList[k][1])*
    203                     (cVertex[1] - verticesList[k][1]) < hexTolerance*hexTolerance)
    204                     {
    205                         found = true;
    206                         break;
    207                     }
    208             }
    209             if (!found)
    210             {
    211                 for (int k=0;k<2;k++)
    212                     verticesList[numVertices][k] = cVertex[k];
    213                 numVertices++;
    214             }
    215         }
    216     }
    217     for (int i=0;i<ACTUAL_NUM_PIXELS;i++)
    218     {
    219         for (int j=0;j<6;j++)
    220         {
    221             for (int k=0;k<2;k++)
    222                 cVertex[k] = hexcoords[j][k]*hexRadius + pixelsCoords[i][k];
    223             for (int k=0;k<numVertices;k++)
    224             {
    225                 if ((cVertex[0] - verticesList[k][0])*
    226                      (cVertex[0] - verticesList[k][0]) +
    227                      (cVertex[1] - verticesList[k][1])*
    228                      (cVertex[1] - verticesList[k][1]) < hexTolerance*hexTolerance)
    229                      {
    230                         verticesIndices[i][j] = k;
    231                         break;
    232                      }
    233             }
    234         }
    235     }
    236 }
    237 /************************************************************
    238  * BUILD PATCHES INDICES. from the list of patches, crawls through
    239  * the list of camera pixels and build the list of edges that should be kept
    240  * in order to display the patches' contours.
    241  ************************************************************/
     431
     432    calibrationLoaded = false;
     433    drawCalibrationLoaded = false;
     434
     435}
     436/************************************************************
     437 *  DESTRUCTOR
     438 ************************************************************/
     439RawDataViewer::~RawDataViewer()
     440{
     441    if (inputFile != NULL)
     442    {
     443        inputFile->close();
     444        delete inputFile;
     445    }
     446    if (eventData != NULL) {
     447        delete[] eventData;
     448        delete[] rawEventData;
     449    }
     450}
     451
    242452void RawDataViewer::buildPatchesIndices()
    243453{
    244454    vector<edge>::iterator it;
    245455    bool erased = false;
     456//        patchesIndices.resize(NTMARK);
    246457    for (int i=0;i<NTMARK;i++)//for all patches
    247458    {
     
    283494}
    284495/************************************************************
    285  * CALC BLUR COLOR if in blur display mode, calculate the interpolated
    286  * colour for a given vertex
    287  ************************************************************/
    288 void RawDataViewer::calcBlurColor(int pixel,  int vertex)
    289 {
    290     GLfloat color[3];
    291     int first, second;
    292     first = vertex-1;
    293     second = vertex;
    294     if (first < 0)
    295         first = 5;
    296     first = neighbors[pixel][first];
    297     second = neighbors[pixel][second];
    298     for (int i=0;i<3;i++)
    299         color[i] = pixelsColor[pixel][i];
    300     float divide = 1;
    301     if (first != -1)
    302     {
    303         divide++;
    304         for (int i=0;i<3;i++)
    305             color[i] += pixelsColor[first][i];
    306     }
    307     if (second != -1)
    308     {
    309         divide++;
    310         for (int i=0;i<3;i++)
    311             color[i] += pixelsColor[second][i];
    312     }
    313     for (int i=0;i<3;i++)
    314         color[i] /= divide;
    315     glColor3fv(color);
    316 }
    317 /************************************************************
    318  * DRAW BLURRY HEXAGON. draws a solid hexagon, with interpolated colours
    319  ************************************************************/
    320 void RawDataViewer::drawBlurryHexagon(int index)
    321 {
    322     GLfloat color[3];
    323     for (int i=0;i<3;i++)
    324         color[i] = pixelsColor[index][i];
    325     glBegin(GL_TRIANGLES);
    326     calcBlurColor(index, 0);
    327     glVertex2fv(verticesList[verticesIndices[index][0]]);
    328     glColor3fv(color);
    329     glVertex2fv(pixelsCoords[index]);
    330     calcBlurColor(index, 1);
    331     glVertex2fv(verticesList[verticesIndices[index][1]]);
    332 
    333     glVertex2fv(verticesList[verticesIndices[index][1]]);
    334     glColor3fv(color);
    335     glVertex2fv(pixelsCoords[index]);
    336     calcBlurColor(index, 2);
    337     glVertex2fv(verticesList[verticesIndices[index][2]]);
    338 
    339     glVertex2fv(verticesList[verticesIndices[index][2]]);
    340     glColor3fv(color);
    341     glVertex2fv(pixelsCoords[index]);
    342     calcBlurColor(index, 3);
    343     glVertex2fv(verticesList[verticesIndices[index][3]]);
    344 
    345     glVertex2fv(verticesList[verticesIndices[index][3]]);
    346     glColor3fv(color);
    347     glVertex2fv(pixelsCoords[index]);
    348     calcBlurColor(index, 4);
    349     glVertex2fv(verticesList[verticesIndices[index][4]]);
    350 
    351     glVertex2fv(verticesList[verticesIndices[index][4]]);
    352     glColor3fv(color);
    353     glVertex2fv(pixelsCoords[index]);
    354     calcBlurColor(index, 5);
    355     glVertex2fv(verticesList[verticesIndices[index][5]]);
    356 
    357     glVertex2fv(verticesList[verticesIndices[index][5]]);
    358     glColor3fv(color);
    359     glVertex2fv(pixelsCoords[index]);
    360     calcBlurColor(index, 0);
    361     glVertex2fv(verticesList[verticesIndices[index][0]]);
    362     glEnd();
    363 
    364     return;
    365 }
    366 /************************************************************
    367  * DRAW HEXAGON. draws a single hexagon.
    368  ************************************************************/
    369 void RawDataViewer::drawHexagon(int index, bool solid)
    370 {
    371     if (solid)
    372         glBegin(GL_POLYGON);
    373     else
    374         glBegin(GL_LINE_LOOP);
    375 
    376     glVertex2fv(verticesList[verticesIndices[index][0]]);
    377     glVertex2fv(verticesList[verticesIndices[index][1]]);
    378     glVertex2fv(verticesList[verticesIndices[index][2]]);
    379     glVertex2fv(verticesList[verticesIndices[index][3]]);
    380     glVertex2fv(verticesList[verticesIndices[index][4]]);
    381     glVertex2fv(verticesList[verticesIndices[index][5]]);
    382     if (solid)
    383         glVertex2fv(verticesList[verticesIndices[index][0]]);
    384 
    385     glEnd();
    386 
    387     return;
    388 }
    389 
    390 
    391 float ss[5] = {0.00, 0.25, 0.5, 0.75, 1.00};
    392 float rr[5] = {0.15, 0.00, 0.00, 1.00, 0.85};
    393 float gg[5] = {0.15, 0.00, 1.00, 0.00, 0.85};
    394 float bb[5] = {0.15, 1.00, 0.00, 0.00, 0.85};
    395 /*
    396 float ss[5] = {0., 0.47, 0.475, 0.48, 1.00};
    397 float rr[5] = {0., 0.35, 0.85, 1.00, 1.00};
    398 float gg[5] = {0., 0.10, 0.20, 0.73, 1.00};
    399 float bb[5] = {0., 0.03, 0.06, 0.00, 1.00};
    400 */
    401 /************************************************************
    402  * DRAW PATCHES. draws the clustering patches
    403  ************************************************************/
    404 void RawDataViewer::drawPatches()
    405 {
    406     glLineWidth(2.0f);
    407     float backupRadius = hexRadius;
    408     hexRadius *= 0.95;
    409     glBegin(GL_LINES);
    410     for (int i=0;i<NTMARK;i++)
    411     {
    412         glColor3fv(patchesColor[i]);
    413         for (unsigned int j=0;j<patchesIndices[i].size();j++)
    414         {
    415             glVertex2fv(verticesList[patchesIndices[i][j].first]);
    416             glVertex2fv(verticesList[patchesIndices[i][j].second]);
    417         }
    418     }
    419     glEnd();
    420     hexRadius = backupRadius;
    421 }
    422 /************************************************************
    423  * DRAW CAMERA draws all the camera pixels
    424  ************************************************************/
    425 void RawDataViewer::drawCamera(bool alsoWire)
    426 {
    427     glColor3f(0.5,0.5,0.5);
    428     glLineWidth(1.0);
    429     float color;
    430 
    431     for (int i=0;i<ACTUAL_NUM_PIXELS;i++)
    432     {
    433         if (!nRoi)
    434           color = (float)(i)/(float)(ACTUAL_NUM_PIXELS);
    435         else
    436 #ifdef LOAD_RAW
    437         color = float(eventsData[eventNum][i][whichSlice]+(VALUES_SPAN/2))/(float)(VALUES_SPAN-1);
    438 #else
    439         color = float(eventData[nRoi*i + whichSlice]+(VALUES_SPAN/2))/(float)(VALUES_SPAN-1);
    440 #endif
    441         int index = 0;
    442         while (ss[index] < color)
    443             index++;
    444         index--;
    445         float weight0 = (color-ss[index]) / (ss[index+1]-ss[index]);
    446         float weight1 = 1.0f-weight0;
    447         pixelsColor[i][0] = weight1*rr[index] + weight0*rr[index+1];
    448         pixelsColor[i][1] = weight1*gg[index] + weight0*gg[index+1];
    449         pixelsColor[i][2] = weight1*bb[index] + weight0*bb[index+1];
    450     }
    451 
    452     for (int i=0;i<ACTUAL_NUM_PIXELS;i++)
    453     {
    454         if (i == 690 ||
    455             i == 70)
    456             continue;
    457         glColor3fv(pixelsColor[i]);
    458         glLoadName(i);
    459 if (drawBlur)
    460     drawBlurryHexagon(i);
    461 else
    462     drawHexagon(i,true);
    463 
    464     }
    465     if (!alsoWire)
    466         return;
    467     glColor3f(0.0f,0.0f,0.0f);
    468     for (int i=0;i<ACTUAL_NUM_PIXELS;i++)
    469     {
    470         if (i == 690 ||
    471             i == 70)
    472             continue;
    473         drawHexagon(i, false);
    474     }
    475 
    476 }
    477 
    478 /************************************************************
    479  * TRIM. FIXME this should not be here but taken from an existing class (somewhere)
    480  ************************************************************/
    481 string Trim(const string &str)
    482 {
    483     // Trim Both leading and trailing spaces
    484     const size_t start = str.find_first_not_of(' '); // Find the first character position after excluding leading blank spaces
    485     const size_t end   = str.find_last_not_of(' ');  // Find the first character position from reverse af
    486 
    487     // if all spaces or empty return an empty string
    488     if (string::npos==start || string::npos==end)
    489         return string();
    490 
    491     return str.substr(start, end-start+1);
    492 }
    493 /************************************************************
    494  * DRAW PIXEL CURVE. draws the raw impulse curve of the currently selected pixel
    495  ************************************************************/
    496 void RawDataViewer::drawPixelCurve()
    497 {
    498     if (!nRoi)
    499         return;
    500 
    501     float xZoom, yZoom;
    502     xZoom = yZoom = 1.0f;
    503 
    504     glBegin(GL_LINES);
    505     glLineWidth(1.0f);
    506     glColor3f(0.5,0.5,0.5);
    507     glVertex2f(bboxMin[0], bboxMin[1]);
    508     glVertex2f(bboxMax[0], bboxMin[1]);
    509     glVertex2f(bboxMin[0], bboxMin[1]);
    510     glVertex2f(bboxMin[0], bboxMax[1]);
    511     glVertex2f(bboxMin[0], (bboxMin[1]+bboxMax[1])/2.0f);
    512     glVertex2f(bboxMax[0], (bboxMin[1]+bboxMax[1])/2.0f);
    513     float xRange = bboxMax[0] - bboxMin[0];
    514     float yRange = bboxMax[1] - bboxMin[1];
    515     glColor3f(1.0,1.0,1.0);
    516     float divideMe = (float)(VALUES_SPAN-1);
    517     float plusMe = VALUES_SPAN/2;
    518     if (drawCalibrationLoaded && calibrationLoaded)
    519     {
    520         divideMe /=2;
    521         plusMe /=2;
    522     }
    523     for (int i=0;i<nRoi-1;i++)
    524     {
    525 #ifdef LOAD_RAW
    526         glVertex2f(bboxMin[0] + xRange*i/(float)nRoi,
    527                    bboxMin[1] + yRange*(eventsData[eventNum][selectedPixel][i]+plusMe) /divideMe);
    528         glVertex2f(bboxMin[0] + xRange*(i+1)/(float)nRoi,
    529                    bboxMin[1] + yRange*(eventsData[eventNum][selectedPixel][i+1]+plusMe) /divideMe);
    530 #else
    531 
    532         glVertex2f(bboxMin[0] + xRange*i/(float)nRoi,
    533                    bboxMin[1] + yRange*(eventData[nRoi*selectedPixel + i]+plusMe) /divideMe);
    534         glVertex2f(bboxMin[0] + xRange*(i+1)/(float)nRoi,
    535                    bboxMin[1] + yRange*(eventData[nRoi*selectedPixel + i+1]+plusMe) /divideMe);
    536 #endif
    537     }
    538     glColor3f(1.0,0.0,0.0);
    539     glVertex2f(bboxMin[0] + xRange*whichSlice/(float)nRoi,
    540                bboxMin[1]);
    541     glVertex2f(bboxMin[0] + xRange*whichSlice/(float)nRoi,
    542                bboxMax[1]);
    543     glEnd();
    544     glEnable(GL_MULTISAMPLE);
    545     setFont(QFont("Times", 12));
    546     qglColor(QColor(255,223,127));
    547     float xShift = 0.10f;
    548     float yShift = 0.01f;
    549     renderText(bboxMin[0]-xShift/2.0f, bboxMax[1]+3*yShift, 0, QString("Volts"));
    550     renderText(bboxMin[0]-xShift, bboxMax[1]-yShift,0,QString("+1.05"));
    551     renderText(bboxMin[0]-xShift,  ((bboxMin[1]+bboxMax[1])/2.0f) - yShift, 0, QString("+0.00"));//((bboxMin[1]+bboxMax[1])/2.0f)
    552     renderText(bboxMin[0]-xShift, bboxMin[1]-yShift, 0, QString("-1.05"));
    553 
    554     renderText(bboxMax[0]+xShift/2.0f, bboxMin[1]-4*yShift, 0, QString("Slices"));
    555     renderText(bboxMin[0]-yShift/2.0f, bboxMin[1]-4*yShift, 0, QString("0"));
    556     ostringstream str;
    557     str << nRoi/2;
    558     renderText(((bboxMin[0]+bboxMax[0])/2.0f)-xShift/2.0f, bboxMin[1]-4*yShift, 0, QString(str.str().c_str()));
    559     str.str("");
    560     str << nRoi;
    561     renderText(bboxMax[0]-xShift/2.0f, bboxMin[1]-4*yShift, 0, QString(str.str().c_str()));
    562 
    563 }
    564 /************************************************************
    565  * CONSTRUCTOR.
    566  ************************************************************/
    567 RawDataViewer::RawDataViewer(QWidget *cParent) : QGLWidget(cParent)
    568 {
    569     setFormat(QGLFormat(QGL::DoubleBuffer));// | QGL::DepthBuffer));
    570     hexRadius = 0.015f;
    571     hexTolerance = hexRadius/100.0f;
    572     viewSize = 1.0f;
    573     whichSlice = 0;
    574 #ifdef LOAD_RAW
    575     nRoi = 1024;
    576 #else
    577     nRoi = 0;
    578 #endif
    579     eventNum = 0;
    580     rowNum = -1;
    581     eventStep = 1;
    582     selectedPixel = 393;
    583     inputFile = NULL;
    584     eventData = NULL;
    585     drawPatch = true;
    586     drawImpulse = false;
    587     drawBlur = false;
    588     loopCurrentEvent = false;
    589 #ifdef LOAD_RAW
    590     loadEvents("/scratch/00000043.001_T.bin");
    591 #endif
    592     calculatePixelsCoords();
    593 
    594     ifstream fin2("MasterList-v3.txt");
    595     if (!fin2.is_open())
    596     {
    597         cout << "Error: file \"MasterList-v3\" missing. aborting." << endl;
    598         exit(-1);
    599     }
    600     int l = 0;
    601     string buf;
    602     while (getline(fin2, buf, '\n'))
    603     {
    604         buf = Trim(buf);
    605         if (buf[0]=='#')
    606             continue;
    607 
    608         unsigned int softid, hardid, dummy;
    609 
    610         stringstream str(buf);
    611 
    612         str >> softid;
    613         str >> dummy;
    614         str >> hardid;
    615 
    616         if (softid>=1440)
    617             continue;
    618 
    619         hardwareMapping[softid] = hardid;
    620         softwareMapping[hardid] = softid;
    621 
    622         l++;
    623     }
    624     GLfloat tempPixelsCoords[MAX_NUM_PIXELS][3];
    625     for (int i=0;i<1440;i++)
    626         for (int j=0;j<3;j++)
    627             tempPixelsCoords[hardwareMapping[i]][j] = pixelsCoords[i][j];
    628     for (int i=0;i<1440;i++)
    629         for (int j=0;j<3;j++)
    630             pixelsCoords[i][j] = tempPixelsCoords[i][j];
    631     buildVerticesList();
    632    ifstream fin1("Trigger-Patches.txt");
    633    if (!fin1.is_open())
    634    {
    635        cout << "Error: file \"Trigger-Patches.txt\" missing. Aborting." << endl;
    636        exit(-1);
    637    }
    638    l=0;
    639     while (getline(fin1, buf, '\n'))
    640     {
    641         buf = Trim(buf);
    642         if (buf[0]=='#')
    643             continue;
    644 
    645         stringstream str(buf);
    646         for (int i=0; i<9; i++)
    647         {
    648             unsigned int n;
    649             str >> n;
    650 
    651             if (n>=1440)
    652                 continue;
    653 
    654             patches[l][i] = hardwareMapping[n];
    655         }
    656         l++;
    657     }
    658     buildPatchesIndices();
    659     float color[3];
    660     for (int i=0;i<160;i++)
    661     {
    662         color[0] = 0.5; color[1] = 0.5; color[2] = 0.3;
    663         for (int j=0;j<3;j++)
    664             patchesColor[i][j] = color[j];
    665     }
    666 
    667     for (int i=0;i<1440;i++)
    668         updateNeighbors(i);
    669 
    670     calibrationLoaded = false;
    671     drawCalibrationLoaded = false;
    672 
    673 }
    674 /************************************************************
    675  *  DESTRUCTOR
    676  ************************************************************/
    677 RawDataViewer::~RawDataViewer()
    678 {
    679     if (inputFile != NULL)
    680     {
    681         inputFile->close();
    682         delete inputFile;
    683     }
    684     if (eventData != NULL) {
    685         delete[] eventData;
    686         delete[] rawEventData;
    687     }
    688 }
    689 /************************************************************
    690  * INITIALIZE GL. does not do much.
    691  ************************************************************/
    692 void RawDataViewer::initializeGL()
    693 {
    694     qglClearColor(QColor(25,25,38));
    695     glShadeModel(GL_FLAT);
    696     glDisable(GL_DEPTH_TEST);
    697     glDisable(GL_CULL_FACE);
    698 //    glEnable(GL_LINE_SMOOTH);
    699 //    glHint(GL_LINE_SMOOTH_HINT,GL_NICEST);
    700 }
    701 
    702 /************************************************************
    703  * RESIZE GL. reshapes the ortho projection to match the current window size
    704  ************************************************************/
    705 void RawDataViewer::resizeGL(int cWidth, int cHeight)
    706 {
    707     glViewport(0, 0, cWidth, cHeight);
    708     glMatrixMode(GL_PROJECTION);
    709     glLoadIdentity();
    710     GLfloat windowRatio = (float)cWidth/(float)cHeight;
    711     if (windowRatio < 1)
    712     {
    713         windowRatio = 1.0f/windowRatio;
    714         gluOrtho2D(-viewSize, viewSize, -viewSize*windowRatio, viewSize*windowRatio);
    715         pixelSize = 2*viewSize/(float)cWidth;
    716         shownSizex = 2*viewSize;
    717         shownSizey = 2*viewSize*windowRatio;
    718     }
    719     else
    720     {
    721         gluOrtho2D(-viewSize*windowRatio, viewSize*windowRatio, -viewSize, viewSize);
    722         pixelSize = 2*viewSize/(float)cHeight;
    723         shownSizex = 2*viewSize*windowRatio;
    724         shownSizey = 2*viewSize;
    725     }
    726     glMatrixMode(GL_MODELVIEW);
    727 }
    728 
    729 /************************************************************
    730496 * PAINT GL. main drawing function.
    731497 ************************************************************/
     
    735501    glLoadIdentity();
    736502
    737     if (!drawImpulse)
    738     {
    739         glTranslatef(0,-0.44,0);
    740         glScalef(1.5,1.5,1);
    741     }
     503
    742504    if (drawBlur)
    743505    {
     
    749511        glShadeModel(GL_FLAT);
    750512        drawCamera(true);
    751     }
    752     if (drawImpulse)
    753     {
    754         glLineWidth(2.0);
    755         drawPixelCurve();
    756513    }
    757514    if (drawPatch)
     
    764521        drawHexagon(selectedPixel, false);
    765522   }
     523   if (drawImpulse)
     524   {
     525    //   glRotatef(cameraRotation, 0,0,1);
     526       glLoadIdentity();
     527       glLineWidth(2.0);
     528       drawPixelCurve();
     529   }
     530
     531   DrawScale();
    766532}
    767533
     
    771537void RawDataViewer::mousePressEvent(QMouseEvent *cEvent)
    772538{
     539    if (cEvent->pos().x() > width()-(width()/50.f))
     540    {
     541        toggleInterfaceDisplay();
     542        return;
     543    }
    773544    lastPos = cEvent->pos();
    774545    setCorrectSlice(cEvent);
     
    822593}
    823594
    824 /************************************************************
    825  * PIXEL AT POSITION. figures out which camera pixel was clicked.
    826  ************************************************************/
    827 int RawDataViewer::PixelAtPosition(const QPoint &cPos)
    828 {
    829     const int MaxSize = 512;
    830     GLuint buffer[MaxSize];
    831     GLint viewport[4];
    832 
    833     makeCurrent();
    834 
    835     glGetIntegerv(GL_VIEWPORT, viewport);
    836     glSelectBuffer(MaxSize, buffer);
    837     glRenderMode(GL_SELECT);
    838 
    839     glInitNames();
    840     glPushName(0);
    841 
    842     glMatrixMode(GL_PROJECTION);
    843     glPushMatrix();
    844     glLoadIdentity();
    845     GLfloat windowRatio = GLfloat(width()) / GLfloat(height());
    846     gluPickMatrix(GLdouble(cPos.x()), GLdouble(viewport[3] - cPos.y()),
    847             1.0, 1.0, viewport);
    848 
    849     if (windowRatio < 1)
    850      {
    851          windowRatio = 1.0f/windowRatio;
    852          gluOrtho2D(-viewSize, viewSize, -viewSize*windowRatio, viewSize*windowRatio);
    853      }
    854      else
    855      {
    856          gluOrtho2D(-viewSize*windowRatio, viewSize*windowRatio, -viewSize, viewSize);
    857      }
    858 
    859     glMatrixMode(GL_MODELVIEW);
    860     drawCamera(false);
    861     glMatrixMode(GL_PROJECTION);
    862     glPopMatrix();
    863 
    864     //for some reason that I cannot understand, the push/pop matrix doesn't do the trick here... bizarre
    865     //ok, so re-do the resizeGL thing.
    866     resizeGL(width(), height());
    867 
    868     if (!glRenderMode(GL_RENDER))
    869         return -1;
    870 
    871     return buffer[3];
    872 }
    873595/************************************************************
    874596 * OPEN FILE. opens a new fits file
     
    1006728    calibInputFile->GetNextRow();
    1007729
    1008     for (int i=0;i<1024;i++)
    1009         cout << gainMean[i] << " ";
    1010     cout << endl << endl;
     730 //   for (int i=0;i<1024;i++)
     731 //       cout << gainMean[i] << " ";
     732 //   cout << endl << endl;
    1011733
    1012734    delete calibInputFile;
     
    1066788            for (int j=0;j<nRoi;j++)
    1067789            {
     790                int realj = (j+startPix[j])%1024;
    1068791                eventData[i*1024+j] *= 2000.f/4096.f;
    1069                 eventData[i*1024+j] -= (baseLineMean[i*1024+j]+triggerOffsetMean[i*1024+j]);
    1070                 eventData[i*1024+j] /= gainMean[i*1024+j];
     792                eventData[i*1024+j] -= (baseLineMean[i*1024+realj]+triggerOffsetMean[i*1024+realj]);
     793                eventData[i*1024+j] /= gainMean[i*1024+realj];
    1071794                eventData[i*1024+j] *= (50000.f/65536.f) * 2500.f;
    1072795            }
     
    1150873//                    cout << "start value: " << viewer->eventData[i*1024+j] << " baseline: " << viewer->baseLineMean[i*1024+j];
    1151874//                    cout << " triggerOffset: " << viewer->triggerOffsetMean[i*1024+j] << " gain: " << viewer->gainMean[i*1024+j];
     875                    int realj = (j+viewer->startPix[j])%1024;
    1152876                    viewer->eventData[i*1024+j] *= 2000.f/4096.f;
    1153                     viewer->eventData[i*1024+j] -= (viewer->baseLineMean[i*1024+j]+viewer->triggerOffsetMean[i*1024+j]);
    1154                     viewer->eventData[i*1024+j] /= viewer->gainMean[i*1024+j];
     877                    viewer->eventData[i*1024+j] -= (viewer->baseLineMean[i*1024+realj]+viewer->triggerOffsetMean[i*1024+realj]);
     878                    viewer->eventData[i*1024+j] /= viewer->gainMean[i*1024+realj];
    1155879                    viewer->eventData[i*1024+j] *= (50000.f/65536.f) * 2500.f;
    1156880//                    cout << " end value: " << viewer->eventData[i*1024+j] << endl;
     
    1171895                for (int j=0;j<viewer->nRoi;j++)
    1172896                {
    1173 
     897                    int realj = (j+viewer->startPix[j])%1024;
    1174898                    viewer->eventData[i*1024+j] /= (50000.f/65536.f) * 2500.f;
    1175                     viewer->eventData[i*1024+j] *= viewer->gainMean[i*1024+j];
    1176                     viewer->eventData[i*1024+j] += (viewer->baseLineMean[i*1024+j]+viewer->triggerOffsetMean[i*1024+j]);
     899                    viewer->eventData[i*1024+j] *= viewer->gainMean[i*1024+realj];
     900                    viewer->eventData[i*1024+j] += (viewer->baseLineMean[i*1024+realj]+viewer->triggerOffsetMean[i*1024+realj]);
    1177901                    viewer->eventData[i*1024+j] /= 2000.f/4096.f;
    1178902               }
     
    1181905
    1182906    }
     907     autoScalePressed();
    1183908
    1184909}
     
    1249974void UIConnector::rangeChanged0(double value)
    1250975{
    1251     ss[0] = (float)value;
     976    viewer->ss[0] = (float)value;
    1252977    viewer->updateGL();
    1253978}
     
    1257982void UIConnector::rangeChanged1(double value)
    1258983{
    1259     ss[1] = (float)value;
     984    viewer->ss[1] = (float)value;
    1260985    viewer->updateGL();
    1261986}
     
    1265990void UIConnector::rangeChanged2(double value)
    1266991{
    1267     ss[2] = (float)value;
     992    viewer->ss[2] = (float)value;
    1268993    viewer->updateGL();
    1269994}
     
    1273998void UIConnector::rangeChanged3(double value)
    1274999{
    1275     ss[3] = (float)value;
     1000    viewer->ss[3] = (float)value;
    12761001    viewer->updateGL();
    12771002}
     
    12811006void UIConnector::rangeChanged4(double value)
    12821007{
    1283     ss[4] = (float)value;
     1008    viewer->ss[4] = (float)value;
    12841009    viewer->updateGL();
    12851010}
     
    12891014void UIConnector::redChanged0(double value)
    12901015{
    1291     rr[0] = (float)value;
     1016    viewer->rr[0] = (float)value;
    12921017    viewer->updateGL();
    12931018}
     
    12971022void UIConnector::redChanged1(double value)
    12981023{
    1299     rr[1] = (float)value;
     1024    viewer->rr[1] = (float)value;
    13001025    viewer->updateGL();
    13011026}
     
    13051030void UIConnector::redChanged2(double value)
    13061031{
    1307     rr[2] = (float)value;
     1032    viewer->rr[2] = (float)value;
    13081033    viewer->updateGL();
    13091034}
     
    13131038void UIConnector::redChanged3(double value)
    13141039{
    1315     rr[3] = (float)value;
     1040    viewer->rr[3] = (float)value;
    13161041    viewer->updateGL();
    13171042}
     
    13211046void UIConnector::redChanged4(double value)
    13221047{
    1323     rr[4] = (float)value;
     1048    viewer->rr[4] = (float)value;
    13241049    viewer->updateGL();
    13251050}
     
    13291054void UIConnector::greenChanged0(double value)
    13301055{
    1331     gg[0] = (float)value;
     1056    viewer->gg[0] = (float)value;
    13321057    viewer->updateGL();
    13331058}
     
    13371062void UIConnector::greenChanged1(double value)
    13381063{
    1339     gg[1] = (float)value;
     1064    viewer->gg[1] = (float)value;
    13401065    viewer->updateGL();
    13411066}
     
    13451070void UIConnector::greenChanged2(double value)
    13461071{
    1347     gg[2] = (float)value;
     1072    viewer->gg[2] = (float)value;
    13481073    viewer->updateGL();
    13491074}
     
    13531078void UIConnector::greenChanged3(double value)
    13541079{
    1355     gg[3] = (float)value;
     1080    viewer->gg[3] = (float)value;
    13561081    viewer->updateGL();
    13571082}
     
    13611086void UIConnector::greenChanged4(double value)
    13621087{
    1363     gg[4] = (float)value;
     1088    viewer->gg[4] = (float)value;
    13641089    viewer->updateGL();
    13651090}
     
    13691094void UIConnector::blueChanged0(double value)
    13701095{
    1371     bb[0] = (float)value;
     1096    viewer->bb[0] = (float)value;
    13721097    viewer->updateGL();
    13731098}
     
    13771102void UIConnector::blueChanged1(double value)
    13781103{
    1379     bb[1] = (float)value;
     1104    viewer->bb[1] = (float)value;
    13801105    viewer->updateGL();
    13811106}
     
    13851110void UIConnector::blueChanged2(double value)
    13861111{
    1387     bb[2] = (float)value;
     1112    viewer->bb[2] = (float)value;
    13881113    viewer->updateGL();
    13891114}
     
    13931118void UIConnector::blueChanged3(double value)
    13941119{
    1395     bb[3] = (float)value;
     1120    viewer->bb[3] = (float)value;
    13961121    viewer->updateGL();
    13971122}
     
    14011126void UIConnector::blueChanged4(double value)
    14021127{
    1403     bb[4] = (float)value;
     1128    viewer->bb[4] = (float)value;
    14041129    viewer->updateGL();
    14051130}
     
    15441269    emit updateCurrentPixelSliceValue(qstr);
    15451270
     1271    if (autoScaleColor->isChecked())
     1272        emit viewer->colorPaletteHasChanged();//autoScalePressed();
     1273
    15461274    boardsTimeList->clear();
    15471275    startPixelsList->clear();
     
    18961624        return;
    18971625
     1626    if (hwID == pixel)
     1627        return;
    18981628    for (int i=0;i<viewer->nRoi;i++)
    18991629    {
     
    19181648    hwID = pixel;
    19191649    swID = viewer->softwareMapping[pixel];
    1920     crateID = (pixel/4)/10;
    1921     boardID = (pixel/4)%10;
    1922     patchID = pixel%4;
    1923     HwIDBox->setValue(hwID);
    1924     SwIDBox->setValue(swID);
    1925     crateIDBox->setValue(crateID);
    1926     boardIDBox->setValue(boardID);
    1927     patchIDBox->setValue(patchID);
     1650//    cout << "here" << endl;
     1651/*    int channel = hwID%360;
     1652    channel = channel%36;
     1653    channel = channel%9;
     1654    int inter = (pixel-channel)%360;
     1655     inter = inter%36;
     1656    patchID = inter/9;
     1657    inter = pixel - channel - patchID*9;
     1658    inter = inter%360;
     1659    boardID = inter/36;
     1660    inter = pixel - channel - patchID*9 - boardID*36;
     1661    crateID = inter/360;
     1662*/
     1663    crateID = pixel/360;
     1664    boardID = (pixel - crateID*360)/36;
     1665    patchID = (pixel - crateID*360 - boardID*36)/9;
     1666//    cout << "Value: " << hwID << " " << swID;
     1667//    cout << " " << crateID  << " " << boardID;
     1668//   cout << " " << patchID  << endl;
     1669//    cout << "there " << crateID << " " << boardID << " " << patchID << endl;
     1670//    crateID = (pixel/4)/10;
     1671 //   boardID = (pixel/4)%10;
     1672//    patchID = pixel%4;
     1673//    cout << "there2 " << crateID << " " << boardID << " " << patchID << endl;
     1674
     1675    if (HwIDBox->value() != hwID)
     1676        HwIDBox->setValue(hwID);
     1677    if (SwIDBox->value() != swID)
     1678        SwIDBox->setValue(swID);
     1679    if (crateIDBox->value() != crateID)
     1680        crateIDBox->setValue(crateID);
     1681    if (boardIDBox->value() != boardID)
     1682        boardIDBox->setValue(boardID);
     1683    if (patchIDBox->value() != patchID)
     1684        patchIDBox->setValue(patchID);
    19281685
    19291686    ostringstream str;
     
    19451702    hwID = hwid;
    19461703    swID = viewer->softwareMapping[hwid];
    1947     crateID = (hwid/4)/10;
    1948     boardID = (hwid/4)%10;
    1949     patchID = hwid%4;
     1704    crateID = hwID/360;
     1705    boardID = (hwID - crateID*360)/36;
     1706    patchID = (hwID - crateID*360 - boardID*36)/9;
     1707
     1708//    crateID = (hwid/4)/10;
     1709//    boardID = (hwid/4)%10;
     1710//    patchID = hwid%4;
    19501711    HwIDBox->setValue(hwID);
    19511712    SwIDBox->setValue(swID);
     
    19631724    swID = swid;
    19641725    hwID = viewer->hardwareMapping[swid];
    1965     crateID = (hwID/4)/10;
    1966     boardID = (hwID/4)%10;
    1967     patchID = hwID%4;
     1726    crateID = hwID/360;
     1727    boardID = (hwID - crateID*360)/36;
     1728    patchID = (hwID - crateID*360 - boardID*36)/9;
     1729
     1730//    crateID = (hwID/4)/10;
     1731//    boardID = (hwID/4)%10;
     1732//    patchID = hwID%4;
    19681733    HwIDBox->setValue(hwID);
    19691734    SwIDBox->setValue(swID);
     
    19781743void UIConnector::crateIDChanged(int cid)
    19791744{
     1745    hwID -= 360*crateID;
    19801746    crateID = cid;
    1981     hwID = 40*crateID + 4*boardID + patchID;
     1747    hwID += 360*crateID;
    19821748    swID = viewer->softwareMapping[hwID];
    19831749    HwIDBox->setValue(hwID);
     
    19891755void UIConnector::boardIDChanged(int bid)
    19901756{
     1757    hwID -= 36*boardID;
    19911758    boardID = bid;
    1992     hwID = 40*crateID + 4*boardID + patchID;
     1759    hwID += 36*boardID;
    19931760    swID = viewer->softwareMapping[hwID];
    19941761    HwIDBox->setValue(hwID);
     
    20001767void UIConnector::patchIDChanged(int pid)
    20011768{
     1769    hwID -= 9*patchID;
    20021770    patchID = pid;
    2003     hwID = 40*crateID + 4*boardID + patchID;
     1771    hwID += 9*patchID;
    20041772    swID = viewer->softwareMapping[hwID];
    20051773    HwIDBox->setValue(hwID);
     
    20111779void UIConnector::autoScalePressed()
    20121780{
     1781    if (!autoScaleColor->isChecked())
     1782        return;
    20131783    if (!viewer->nRoi)
    20141784        return;
     
    20471817    double maxRange = (double)(max+(VALUES_SPAN/2))/(double)VALUES_SPAN;
    20481818    double midRange = (double)(average+(VALUES_SPAN/2))/(double)VALUES_SPAN;
    2049     ss[0] = minRange;
    2050     range0->setValue(ss[0]);
    2051     ss[4] = maxRange;
    2052     range4->setValue(ss[4]);
    2053     ss[2] = midRange;
    2054     range2->setValue(ss[2]);
    2055     ss[1] = (minRange+midRange)/2;
    2056     range1->setValue(ss[1]);
    2057     ss[3] = (maxRange+midRange)/2;
    2058     range3->setValue(ss[3]);
     1819    if (viewer->logScale)
     1820    {
     1821        minRange *= 9;
     1822        maxRange *= 9;
     1823//        midRange *= 9;
     1824        minRange += 1;
     1825        maxRange += 1;
     1826//        midRange += 1;
     1827        minRange = log10(minRange);
     1828        maxRange = log10(maxRange);
     1829//        midRange = (minRange + maxRange)/2.f;
     1830        midRange = log10(midRange);
     1831    }
     1832    viewer->ss[0] = minRange;
     1833    range0->setValue(viewer->ss[0]);
     1834    viewer->ss[4] = maxRange;
     1835    range4->setValue(viewer->ss[4]);
     1836    viewer->ss[2] = midRange;
     1837    range2->setValue(viewer->ss[2]);
     1838    viewer->ss[1] = (minRange+midRange)/2;
     1839    range1->setValue(viewer->ss[1]);
     1840    viewer->ss[3] = (maxRange+midRange)/2;
     1841    range3->setValue(viewer->ss[3]);
    20591842
    20601843
     
    21181901int main(int argc, char *argv[])
    21191902{
     1903    QApplication app(argc, argv);
     1904
     1905    if (!QGLFormat::hasOpenGL()) {
     1906        std::cerr << "This system has no OpenGL support" << std::endl;
     1907        return 1;
     1908    }
     1909
     1910   QMainWindow mainWindow;
     1911
     1912    Ui_MainWindow myUi;
     1913    myUi.setupUi(&mainWindow);
     1914
     1915    UIConnector connector;
     1916
     1917    RawDataViewer *canvas = myUi.GLWindow;
     1918
    21201919    Configuration conf(argv[0]);
    21211920    conf.SetPrintUsage(PrintHelp);
     
    21331932        }
    21341933        for (int i=0;i<5;i++)
    2135             ss[i] = value[i];
     1934            canvas->ss[i] = value[i];
    21361935    }
    21371936
     
    21451944        }
    21461945        for (int i=0;i<5;i++)
    2147             rr[i] = value[i];
     1946            canvas->rr[i] = value[i];
    21481947    }
    21491948
     
    21571956        }
    21581957        for (int i=0;i<5;i++)
    2159             gg[i] = value[i];
     1958            canvas->gg[i] = value[i];
    21601959    }
    21611960
     
    21691968        }
    21701969        for (int i=0;i<5;i++)
    2171             bb[i] = value[i];
    2172     }
    2173 
    2174     QApplication app(argc, argv);
    2175 
    2176     if (!QGLFormat::hasOpenGL()) {
    2177         std::cerr << "This system has no OpenGL support" << std::endl;
    2178         return 1;
    2179     }
    2180 
    2181     QMainWindow mainWindow;
    2182 
    2183     Ui_MainWindow myUi;
    2184     myUi.setupUi(&mainWindow);
    2185 
    2186     RawDataViewer *canvas = myUi.GLWindow;
     1970            canvas->bb[i] = value[i];
     1971    }
     1972
     1973
    21871974
    21881975    QObject::connect(myUi.eventsMinusButton, SIGNAL(clicked()),
     
    21921979    QObject::connect(myUi.eventsStepBox, SIGNAL(valueChanged(int)),
    21931980                     canvas, SLOT(setEventStep(int)));
    2194     myUi.colorRange0->setValue(ss[0]);
    2195     myUi.colorRange1->setValue(ss[1]);
    2196     myUi.colorRange2->setValue(ss[2]);
    2197     myUi.colorRange3->setValue(ss[3]);
    2198     myUi.colorRange4->setValue(ss[4]);
    2199     myUi.redValue0->setValue(rr[0]);
    2200     myUi.redValue1->setValue(rr[1]);
    2201     myUi.redValue2->setValue(rr[2]);
    2202     myUi.redValue3->setValue(rr[3]);
    2203     myUi.redValue4->setValue(rr[4]);
    2204     myUi.greenValue0->setValue(gg[0]);
    2205     myUi.greenValue1->setValue(gg[1]);
    2206     myUi.greenValue2->setValue(gg[2]);
    2207     myUi.greenValue3->setValue(gg[3]);
    2208     myUi.greenValue4->setValue(gg[4]);
    2209     myUi.blueValue0->setValue(bb[0]);
    2210     myUi.blueValue1->setValue(bb[1]);
    2211     myUi.blueValue2->setValue(bb[2]);
    2212     myUi.blueValue3->setValue(bb[3]);
    2213     myUi.blueValue4->setValue(bb[4]);
    2214 
    2215     UIConnector connector;
     1981    myUi.colorRange0->setValue(canvas->ss[0]);
     1982    myUi.colorRange1->setValue(canvas->ss[1]);
     1983    myUi.colorRange2->setValue(canvas->ss[2]);
     1984    myUi.colorRange3->setValue(canvas->ss[3]);
     1985    myUi.colorRange4->setValue(canvas->ss[4]);
     1986    myUi.redValue0->setValue(canvas->rr[0]);
     1987    myUi.redValue1->setValue(canvas->rr[1]);
     1988    myUi.redValue2->setValue(canvas->rr[2]);
     1989    myUi.redValue3->setValue(canvas->rr[3]);
     1990    myUi.redValue4->setValue(canvas->rr[4]);
     1991    myUi.greenValue0->setValue(canvas->gg[0]);
     1992    myUi.greenValue1->setValue(canvas->gg[1]);
     1993    myUi.greenValue2->setValue(canvas->gg[2]);
     1994    myUi.greenValue3->setValue(canvas->gg[3]);
     1995    myUi.greenValue4->setValue(canvas->gg[4]);
     1996    myUi.blueValue0->setValue(canvas->bb[0]);
     1997    myUi.blueValue1->setValue(canvas->bb[1]);
     1998    myUi.blueValue2->setValue(canvas->bb[2]);
     1999    myUi.blueValue3->setValue(canvas->bb[3]);
     2000    myUi.blueValue4->setValue(canvas->bb[4]);
     2001
    22162002    connector.setViewer(canvas);
    22172003    connector.boardsTimeList = myUi.boardsTimeList;
     
    22232009    connector.triggerDelayHisto = myUi.triggerDelayHisto;
    22242010    connector.triggerDelayList = myUi.triggerDelayList;
     2011    connector.autoScaleColor = myUi.autoScaleColor;
    22252012
    22262013    connector.startTimeMarksList = myUi.startTimeMarksList;
     
    22602047    QObject::connect(myUi.autoScaleColor, SIGNAL(clicked()),
    22612048                     &connector, SLOT(autoScalePressed()));
     2049    QObject::connect(canvas, SIGNAL(colorPaletteHasChanged()),
     2050                     &connector, SLOT(autoScalePressed()));
     2051
    22622052    QObject::connect(myUi.currentPixelScale, SIGNAL(toggled(bool)),
    22632053                     &connector, SLOT(currentPixelChanged(bool)));
  • trunk/FACT++/gui/RawEventsViewer/RawEventsViewer.h

    r11898 r11901  
    2020#include <QtGui/QListWidget>
    2121#include <QtGui/QMainWindow>
    22 #include <QtOpenGL/QGLWidget>
     22#include <QtGui/QPushButton>
     23
     24//#include <QtOpenGL/QGLWidget>
     25#include "../BasicGlCamera.h"
     26
    2327#include <QtGui/QMouseEvent>
    2428#include <QtGui/QColorDialog>
     
    4246#include "externals/fits.h"
    4347
    44 using namespace std;
    45 
    46 #define NUM_STORED_EVENTS 5
    47 #define MAX_NUM_PIXELS 1600
    48 #define ACTUAL_NUM_PIXELS 1440
    49 
    50 ///structure for storing edges of hexagons (for blurry display)
    51 struct edge
    52 {
    53     int first;
    54     int second;
    55 };
    56 
    57 ///structure for storing neighbors of pixels. For camera position calculation and blurry display
    58 struct PixelsNeighbors
    59 {
    60     //neighbors. clockwise, starting from top
    61     int neighbors[6];
    62     PixelsNeighbors()
    63     {
    64         for (int i=0;i<6;i++)
    65             neighbors[i] = -1;
    66     }
    67     int& operator[](int index){return neighbors[index];}
    68 };
    69 
    7048/*************************************************
    7149 * Class Raw Data Viewer. FACT raw data diplayer
    7250 *************************************************/
    73 class RawDataViewer : public QGLWidget
     51class RawDataViewer : public BasicGlCamera//QGLWidget
    7452{
    7553    Q_OBJECT
     
    8260    void openCalibFile(string& file);
    8361
     62
     63
    8464public Q_SLOTS:
    8565    void plusEvent();
     
    9474    void newFileLoaded();
    9575    void signalCurrentPixel(int pixel);
     76    void signalAutoScaleNeeded();
    9677
    9778protected:
    98     void initializeGL();
    99     void resizeGL(int width, int height);
     79//    void initializeGL();
     80//    void resizeGL(int width, int height);
    10081    void paintGL();
    10182    void mousePressEvent(QMouseEvent *event);
     
    10384    void mouseDoubleClickEvent(QMouseEvent *event);
    10485    void drawCamera(bool alsoWire);
    105     void drawPatches();
    106     int PixelAtPosition(const QPoint &pos);
    107     void drawHexagon(int index, bool solid);
     86//    void drawPatches();
     87//    int PixelAtPosition(const QPoint &pos);
     88//    void drawHexagon(int index, bool solid);
    10889    int selectedPixel;
    10990    float *eventData;
     
    11293private:
    11394    void drawPixelCurve();
    114     void updateNeighbors(int currentPixel);
    115     void skipPixels(int start, int howMany);
    116     void calculatePixelsCoords();
     95//    void updateNeighbors(int currentPixel);
     96//    void skipPixels(int start, int howMany);
     97//    void calculatePixelsCoords();
    11798    void setCorrectSlice(QMouseEvent* event);
    11899    void eventStepping(bool plus);
    119     void buildVerticesList();
     100//    void buildVerticesList();
    120101    void buildPatchesIndices();
    121102    void calcBlurColor(int pixel, int vertex);
    122103    void drawBlurryHexagon(int index);
    123     float hexRadius;
    124     float hexTolerance;
    125     float viewSize;
    126104    int whichSlice;
    127     float pixelSize;
    128     float shownSizex;
    129     float shownSizey;
     105 //   float shownSizex;
     106 //   float shownSizey;
    130107    bool drawPatch;
    131108    bool drawImpulse;
     
    165142    int eventStep;
    166143
    167     int hardwareMapping[1440];
    168     int softwareMapping[1440];
    169     int patches[160][9];
     144//    int hardwareMapping[1440];
     145//    int softwareMapping[1440];
     146////    int patches[160][9];
    170147    GLfloat patchesColor[160][3];
    171     vector<edge> patchesIndices[160];
     148//    vector<edge> patchesIndices[160];
    172149    fits* inputFile;
    173150    fits* calibInputFile;
     
    180157    QPoint lastPos;
    181158
    182     GLfloat pixelsCoords[MAX_NUM_PIXELS][3];
    183     PixelsNeighbors neighbors[MAX_NUM_PIXELS];
    184     GLfloat pixelsColor[ACTUAL_NUM_PIXELS][3];
    185     GLfloat verticesList[ACTUAL_NUM_PIXELS*6][2];
    186     int verticesIndices[ACTUAL_NUM_PIXELS][6];
    187     int numVertices;
     159//    GLfloat pixelsCoords[MAX_NUM_PIXELS][3];
     160//    PixelsNeighbors neighbors[MAX_NUM_PIXELS];
     161 //   GLfloat pixelsColor[ACTUAL_NUM_PIXELS][3];
     162//    GLfloat verticesList[ACTUAL_NUM_PIXELS*6][2];
     163//    int verticesIndices[ACTUAL_NUM_PIXELS][6];
     164//    int numVertices;
    188165};
    189166
    190 class Camera : public RawDataViewer
    191 {
    192     Q_OBJECT
    193 
    194     typedef pair<double, double> Position;
    195     typedef vector<Position> Positions;
    196 
    197     Positions fGeom;
    198 
    199     valarray<double> fData;
    200     vector<bool> fBold;
    201     vector<bool> fEnable;
    202 
    203     int fWhite;
    204 
    205     int64_t fMin;
    206     int64_t fMax;
    207 
    208 public:
    209     Camera(QWidget *pparent = 0);
    210     void Reset();
    211      void SetBold(int idx);
    212      void SetWhite(int idx);
    213      void SetEnable(int idx, bool b);
    214      void Toggle(int idx);
    215      double GetData(int idx);
    216      void SetMin(int64_t min);
    217      void SetMax(int64_t max);
    218      const char *GetName();
    219 
    220      void Paint();
    221 
    222      int GetIdx(float px, float py);
    223      char *GetObjectInfo(int px, int py);
    224 
    225      void SetData(const valarray<double> &ddata);
    226 
    227 };
    228167/*************************************************
    229168 * Class UIConnector. used to connect the interface to the raw data displayer
     
    335274    QwtPlotCurve triggerDelayHistoItem;
    336275    QwtPlotZoomer* triggerDelayHistoZoom;
     276
     277    QPushButton* autoScaleColor;
     278
    337279    QListWidget* triggerDelayList;
    338280
  • trunk/FACT++/gui/RawEventsViewer/viewer.ui

    r11753 r11901  
    339339             <widget class="QSpinBox" name="crateIDBox">
    340340              <property name="maximum">
    341                <number>39</number>
     341               <number>99</number>
    342342              </property>
    343343              <property name="value">
    344                <number>9</number>
     344               <number>0</number>
    345345              </property>
    346346             </widget>
     
    349349             <widget class="QSpinBox" name="boardIDBox">
    350350              <property name="maximum">
    351                <number>9</number>
     351               <number>99</number>
    352352              </property>
    353353              <property name="value">
    354                <number>8</number>
     354               <number>0</number>
    355355              </property>
    356356             </widget>
     
    359359             <widget class="QSpinBox" name="patchIDBox">
    360360              <property name="maximum">
    361                <number>3</number>
     361               <number>99</number>
    362362              </property>
    363363              <property name="value">
    364                <number>1</number>
     364               <number>0</number>
    365365              </property>
    366366             </widget>
     
    775775        </property>
    776776        <property name="text">
    777          <string>AutoScale !</string>
     777         <string>AutoScale</string>
     778        </property>
     779        <property name="checkable">
     780         <bool>true</bool>
    778781        </property>
    779782       </widget>
Note: See TracChangeset for help on using the changeset viewer.