Index: /trunk/FACT++/gui/RawEventsViewer/RawEventsViewer.cc
===================================================================
--- /trunk/FACT++/gui/RawEventsViewer/RawEventsViewer.cc	(revision 12423)
+++ /trunk/FACT++/gui/RawEventsViewer/RawEventsViewer.cc	(revision 12424)
@@ -498,4 +498,6 @@
     nRoi = 0;
 #endif
+    nRoiTM = 0;
+    offSetRoi = 0;
     eventNum = 0;
     rowNum = -1;
@@ -743,4 +745,8 @@
     daq = inputFile->GetStr("DAQ");
     adcCount = inputFile->HasKey("ADCRANGE") ? inputFile->GetFloat("ADCRANGE") : 2000;
+
+    if (inputFile->HasKey("OFFSET"))
+        offSetRoi = inputFile->GetInt("OFFSET");
+
     nbOk = 0;//inputFile->GetInt("NBEVTOK");
     nbRej = 0;//inputFile->GetInt("NBEVTREJ");
@@ -1558,6 +1564,14 @@
 
     //extract the file name only (no path) from the full name
-    str << "File: " << currentFile.substr(currentFile.find_last_of("//")+1, currentFile.size()) << "\n";
-    str << "Calibration: " << currentCalibFile.substr(currentCalibFile.find_last_of("//")+1, currentCalibFile.size()) << "\n";
+    str << "File: ";
+    if (currentFile.size() > 2)
+        str << currentFile.substr(currentFile.find_last_of("//")+1, currentFile.size()) << "\n";
+    else
+        str << "--\n";
+    str << "Calibration: ";
+    if (currentCalibFile.size() > 2)
+        str << currentCalibFile.substr(currentCalibFile.find_last_of("//")+1, currentCalibFile.size()) << "\n";
+    else
+        str << "--\n";
 //    fileLoadedLabel->setText(QString(str.str().c_str()));
 //    str.str("");
@@ -2190,5 +2204,5 @@
     if (pixel == -1)
         return;
-
+    int softwarePix = pixel;
     pixel = GLWindow->hardwareMapping[pixel];
 
@@ -2207,13 +2221,39 @@
 #endif
     }
-
+int realNumSamples = GLWindow->nRoi;
+    if (GLWindow->nRoiTM != 0)
+    {
+        const PixelMapEntry& mapEntry = GLWindow->fPixelMap.index(softwarePix);
+        const int pixelIdInPatch = mapEntry.pixel();
+        const int patchId = mapEntry.patch();
+        const int boardId = mapEntry.board();
+        const int crateId = mapEntry.crate();
+        if (pixelIdInPatch == 8)
+        {
+            int TMIndex = 0;
+            int xIndex = GLWindow->nRoi;
+            int arrayIndex = GLWindow->nRoi;
+            if (GLWindow->offSetRoi < 0)
+                TMIndex -= GLWindow->offSetRoi;
+            if (GLWindow->offSetRoi > 0)
+                xIndex += GLWindow->offSetRoi;
+            for (int i=TMIndex;i<GLWindow->nRoiTM;i++, xIndex++, arrayIndex++)
+            {
+                xval[arrayIndex] = xIndex;
+                yval[arrayIndex] = GLWindow->eventData[GLWindow->nRoi*1440 + GLWindow->nRoiTM*(40*crateId + 4*boardId + patchId) + i];
+            }
+            realNumSamples += GLWindow->nRoiTM - TMIndex;
+        }
+        cout << pixelIdInPatch << " " ;
+    }
+cout << realNumSamples << endl;
   //  GLWindow->computePulsesStatistics();
 #if QWT_VERSION < 0x060000
-    pixelValueCurveItem.setData(xval, yval, GLWindow->nRoi);
+    pixelValueCurveItem.setData(xval, yval, realNumSamples);
 ////    aMeanCurveItem.setData(xval, GLWindow->aMeas, GLWindow->nRoi);
  //   meanCurveItem.setData(xval, GLWindow->n1mean, GLWindow->nRoi);
  //   vCorrCurveItem.setData(xval, GLWindow->vCorr, GLWindow->nRoi-3);
 #else
-       pixelValueCurveItem.setSamples(xval, yval, GLWindow->nRoi);
+       pixelValueCurveItem.setSamples(xval, yval, realNumSamples);
 //       aMeanCurveItem.setSamples(xval, GLWindow->aMeas, GLWindow->nRoi);
  //      meanCurveItem.setSamples(xval, GLWindow->n1mean, GLWindow->nRoi);
