Index: trunk/FACT++/gui/RawEventsViewer/RawEventsViewer.cc
===================================================================
--- trunk/FACT++/gui/RawEventsViewer/RawEventsViewer.cc	(revision 12394)
+++ trunk/FACT++/gui/RawEventsViewer/RawEventsViewer.cc	(revision 12395)
@@ -356,12 +356,12 @@
 void RawDataViewer::drawPixelCurve()
 {
-    if (!nRoi)
-        return;
     float xZoom, yZoom;
     xZoom = yZoom = 1.0f;
+    float xRange = bboxMax[0] - bboxMin[0];
+    float yRange = bboxMax[1] - bboxMin[1];
 
     glBegin(GL_LINES);
     glLineWidth(1.0f);
-    glColor3f(0.5,0.5,0.5);
+    glColor3f(0.0,0.0,0.0);
     glVertex2f(bboxMin[0], bboxMin[1]);
     glVertex2f(bboxMax[0], bboxMin[1]);
@@ -370,7 +370,14 @@
     glVertex2f(bboxMin[0], (bboxMin[1]+bboxMax[1])/2.0f);
     glVertex2f(bboxMax[0], (bboxMin[1]+bboxMax[1])/2.0f);
-    float xRange = bboxMax[0] - bboxMin[0];
-    float yRange = bboxMax[1] - bboxMin[1];
-    glColor3f(1.0,1.0,1.0);
+    glVertex2f(bboxMin[0] + xRange*nRoi/(float)(nRoi+nRoiTM),
+               bboxMin[1]);
+    glVertex2f(bboxMin[0] + xRange*nRoi/(float)(nRoi+nRoiTM),
+               bboxMax[1]);
+   glEnd();
+    glTranslatef(0,0,0.1f);
+    if (!nRoi)
+          return;
+     glBegin(GL_LINES);
+    glColor3f(1.0f,1.0f,0.0f);
     float divideMe = (float)(VALUES_SPAN-1);
     float plusMe = VALUES_SPAN/2;
@@ -389,4 +396,6 @@
     const int pixelIdInPatch = mapEntry.pixel();
     const int patchId = mapEntry.patch();
+    const int boardId = mapEntry.board();
+    const int crateId = mapEntry.crate();
 
     if (selectedPixel != -1)
@@ -403,11 +412,21 @@
                    bboxMin[1] + yRange*(d2) /divideMe);
     }
-
+    glEnd();
+
+    glColor3f(0.0f, 1.0f, 1.0f);
+    glBegin(GL_LINES);
     if (pixelIdInPatch == 8)//this channel has a time marker
     {
+//link between pixel slices and TM slices. should I draw it ?
+//        float d1 = eventData[nRoi*hw + nRoi-1]+plusMe;
+//        float d2 = eventData[nRoi*1440 + nRoiTM*(40*crateId + 4*boardId + patchId)] + plusMe;
+//        glVertex2f(bboxMin[0] + xRange*(nRoi-1)/(float)(nRoi+nRoiTM),
+//                   bboxMin[1] + yRange*(d1) /divideMe);
+//        glVertex2f(bboxMin[0] + xRange*(nRoi)/(float)(nRoi+nRoiTM),
+//                   bboxMin[1] + yRange*(d2)/divideMe);
         for (int i=0;i<nRoiTM-1;i++)
         {
-            float d1 = eventData[nRoi*1440 + nRoiTM*patchId + i] + plusMe;
-            float d2 = eventData[nRoi*1440 + nRoiTM*patchId + i+1] + plusMe;
+            float d1 = eventData[nRoi*1440 + nRoiTM*(40*crateId + 4*boardId + patchId) + i] + plusMe;
+            float d2 = eventData[nRoi*1440 + nRoiTM*(40*crateId + 4*boardId + patchId) + i+1] + plusMe;
             if (!finite(d1)) d1 = 20000;
             if (!finite(d2)) d2 = 20000;
@@ -418,4 +437,5 @@
         }
     }
+
     }
     glEnd();
@@ -423,7 +443,7 @@
     glBegin(GL_LINES);
     glColor3f(1.0,0.0,0.0);
-    glVertex2f(bboxMin[0] + xRange*whichSlice/(float)nRoi,
+    glVertex2f(bboxMin[0] + xRange*whichSlice/(float)(nRoi+nRoiTM),
                bboxMin[1]);
-    glVertex2f(bboxMin[0] + xRange*whichSlice/(float)nRoi,
+    glVertex2f(bboxMin[0] + xRange*whichSlice/(float)(nRoi+nRoiTM),
                bboxMax[1]);
 
@@ -496,5 +516,5 @@
     if (!mypMap.Read("FACTmap111030.txt"))
     {
-        cerr << "ERROR - Problems reading FACTmapV5a.txt" << endl;
+        cerr << "ERROR - Problems reading FACTmap111030.txt" << endl;
         exit(-1);
     }
@@ -751,4 +771,5 @@
         inputFile->SetPtrAddress("StartCellData", startPix);
         inputFile->SetPtrAddress("StartCellTimeMarker", startTM);
+        inputFile->SetPtrAddress("TimeMarker", &rawEventData[1440*nRoi]);
     }
     catch (const runtime_error &e)
@@ -1134,4 +1155,31 @@
     }
 
+    //hide the time markers
+    int nSlicesToRemove = 60;
+    float* backupData;
+    if (nRoiTM == 0) //they are written into the regular channel
+    {
+        backupData = new float[nSlicesToRemove*160];
+        for (int i=0;i<1440;i++)
+        {
+            const PixelMapEntry& mapEntry = fPixelMap.index(i);
+            const int pixelIdInPatch = mapEntry.pixel();
+            const int patchId = mapEntry.patch();
+            const int boardId = mapEntry.board();
+            const int crateId = mapEntry.crate();
+
+            const int hw = mapEntry.hw();
+            if (pixelIdInPatch == 8)
+            {
+ //               cout << patchId << " ";
+                for (int j=0;j<nSlicesToRemove;j++)
+                {
+                    backupData[(40*crateId + 4*boardId + patchId)*nSlicesToRemove+j] = eventData[(hw*nRoi) + (nRoi-nSlicesToRemove) + j];
+                    eventData[(hw*nRoi) + (nRoi-nSlicesToRemove) + j] = eventData[hw*nRoi + (nRoi-nSlicesToRemove) - 1];
+                }
+            }
+        }
+    }
+
     vector<float> pixelStatsData(1440*4);
     DrsCalibrate::GetPixelStats(pixelStatsData.data(), eventData, nRoi);
@@ -1140,4 +1188,27 @@
         RMSvalues[it->index] = pixelStatsData[1*1440+it->hw()];
 
+    if (nRoiTM == 0)//move back the data back in place
+    {
+        for (int i=0;i<1440;i++)
+        {
+            const PixelMapEntry& mapEntry = fPixelMap.index(i);
+            const int pixelIdInPatch = mapEntry.pixel();
+            const int patchId = mapEntry.patch();
+            const int boardId = mapEntry.board();
+            const int crateId = mapEntry.crate();
+            if (patchId > 160)
+                cout << "Voila mon probleme: " << patchId << endl;
+            const int hw = mapEntry.hw();
+            if (pixelIdInPatch == 8)
+            {
+ //               cout << "|" << crateId << " " << boardId << " " << patchId << " " << hw << "| ";
+                for (int j=0;j<nSlicesToRemove;j++)
+                {
+                    eventData[(hw*nRoi) + (nRoi - nSlicesToRemove) + j] = backupData[(40*crateId + 4*boardId + patchId)*nSlicesToRemove+j];
+                }
+            }
+        }
+        delete[] backupData;
+    }
     if (isVisible())
         updateGL();
Index: trunk/FACT++/gui/RawEventsViewer/viewer.ui
===================================================================
--- trunk/FACT++/gui/RawEventsViewer/viewer.ui	(revision 12394)
+++ trunk/FACT++/gui/RawEventsViewer/viewer.ui	(revision 12395)
@@ -239,5 +239,5 @@
          <widget class="QLabel" name="label">
           <property name="text">
-           <string>FACT - Raw events viewer - v0.4</string>
+           <string>FACT - Raw events viewer - v0.5</string>
           </property>
          </widget>
