Index: /trunk/FACT++/gui/RawEventsViewer/RawEventsViewer.cc
===================================================================
--- /trunk/FACT++/gui/RawEventsViewer/RawEventsViewer.cc	(revision 12481)
+++ /trunk/FACT++/gui/RawEventsViewer/RawEventsViewer.cc	(revision 12482)
@@ -561,4 +561,5 @@
 void RawDataViewer::paintGL()
 {
+    //Should not be required, but apparently it helps when piping it through X forwarding
     glFinish();
     makeCurrent();
@@ -2212,13 +2213,19 @@
         return;
 
+//int currentPixel = pixel;
+int currentPixel = 0;
     for (int i=0;i<GLWindow->nRoi;i++)
+        yval[i] = 0;
+    for (int j=0;j<1440;j++) {
+        currentPixel = j;
+    for (int i=0;i<GLWindow->nRoi;i++)
     {
         xval[i] = i;
-#ifdef LOAD_RAW
-        yval[i] = eventsData[0][pixel][i];
-#else
-        yval[i] = GLWindow->eventData[GLWindow->nRoi*pixel + i];
-#endif
-    }
+        yval[i] += GLWindow->eventData[GLWindow->nRoi*currentPixel + i];
+    }
+    }
+    for (int i=0;i<GLWindow->nRoi;i++)
+        yval[i] /= 1440;
+
 int realNumSamples = GLWindow->nRoi;
     if (GLWindow->nRoiTM != 0)
@@ -2243,7 +2250,7 @@
                 yval[arrayIndex] = GLWindow->eventData[GLWindow->nRoi*1440 + GLWindow->nRoiTM*(40*crateId + 4*boardId + patchId) + i];
             }
- //           realNumSamples += GLWindow->nRoiTM - TMIndex;
-        }
-        cout << pixelIdInPatch << " " ;
+            realNumSamples += GLWindow->nRoiTM - TMIndex;
+        }
+      //  cout << pixelIdInPatch << " " ;
     }
 //cout << realNumSamples << endl;
