Index: trunk/FACT++/gui/RawEventsViewer/RawEventsViewer.cc
===================================================================
--- trunk/FACT++/gui/RawEventsViewer/RawEventsViewer.cc	(revision 19373)
+++ trunk/FACT++/gui/RawEventsViewer/RawEventsViewer.cc	(revision 19374)
@@ -845,36 +845,10 @@
     {
         fDrsCalib.Apply(eventData.data(), rawEventData.data(), startPix, nRoi);
-        DrsCalibrate::RemoveSpikes(eventData.data(), nRoi);
+        DrsCalibrate::RemoveSpikes3(eventData.data(), nRoi*1440);
         //TODO apply calibration to the Time markers
     }
 
-    //hide the time markers
-    int nSlicesToRemove = 60;
-    float* backupData = 0;
-    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)
-            {
-                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.data(), nRoi);
+    DrsCalibrate::GetPixelStats(pixelStatsData.data(), eventData.data(), nRoi, 15, nRoiTM>0?5:60);
 
     for (vector<PixelMapEntry>::const_iterator it=fPixelMap.begin(); it!=fPixelMap.end(); it++)
@@ -885,27 +859,5 @@
         PosOfMaxvalues[it->index] = pixelStatsData[3*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();
