Index: trunk/MagicSoft/Mars/mbadpixels/MBadPixelsTreat.cc
===================================================================
--- trunk/MagicSoft/Mars/mbadpixels/MBadPixelsTreat.cc	(revision 7409)
+++ trunk/MagicSoft/Mars/mbadpixels/MBadPixelsTreat.cc	(revision 7733)
@@ -18,6 +18,7 @@
 !   Author(s): Oscar Blanch 12/2001 <mailto:blanch@ifae.es>
 !   Author(s): Thomas Bretz 08/2002 <mailto:tbretz@astro.uni-wuerzburg.de>
+!   Author(s): Stefan Ruegamer <mailto:snruegam@astro.uni-wuerzburg.de>
 !
-!   Copyright: MAGIC Software Development, 2000-2004
+!   Copyright: MAGIC Software Development, 2000-2006
 !
 !
@@ -107,5 +108,5 @@
 MBadPixelsTreat::MBadPixelsTreat(const char *name, const char *title)
     : fGeomCam(0), fEvt(0), fBadPixels(0), fPedPhot1(0), fPedPhot2(0),
-    fFlags(0), fNumMinNeighbors(3)
+    fFlags(0), fNumMinNeighbors(3), fMaxArrivalTimeDiff(1.0)
 {
     fName  = name  ? name  : gsDefName.Data();
@@ -425,6 +426,4 @@
 void MBadPixelsTreat::InterpolateTimes() const
 {
-    const Double_t tdiffshoweredge = 0.5;
-
     const Int_t n = fEvt->GetNumPixels();
     for (int i=0; i<n; i++)
@@ -471,5 +470,5 @@
 
             // Calculate mean arrival time of pixel probably inside the shower
-            if (TMath::Abs(tm1 - tm2)<tdiffshoweredge)
+            if (TMath::Abs(tm1 - tm2)<fMaxArrivalTimeDiff)
             {
                 sum2 += tm1+tm2;
@@ -601,4 +600,5 @@
 //   MBadPixelsTreat.ProcessPedestalEvt:  no
 //   MBadPixelsTreat.NumMinNeighbors:     3
+//   MBadPixelsTreat.MaxArrivalTimeDiff:  1.0
 //
 Int_t MBadPixelsTreat::ReadEnv(const TEnv &env, TString prefix, Bool_t print)
@@ -640,4 +640,9 @@
         SetNumMinNeighbors(GetEnvValue(env, prefix, "NumMinNeighbors", fNumMinNeighbors));
     }
+    if (IsEnvDefined(env, prefix, "MaxArrivalTimeDiff", print))
+    {
+        rc = kTRUE;
+        SetMaxArrivalTimeDiff(GetEnvValue(env, prefix, "MaxArrivalTimeDiff", fMaxArrivalTimeDiff));
+    }
     return rc;
 }
Index: trunk/MagicSoft/Mars/mbadpixels/MBadPixelsTreat.h
===================================================================
--- trunk/MagicSoft/Mars/mbadpixels/MBadPixelsTreat.h	(revision 7409)
+++ trunk/MagicSoft/Mars/mbadpixels/MBadPixelsTreat.h	(revision 7733)
@@ -24,6 +24,7 @@
     TList fPedPhotCams;
 
-    Byte_t fFlags;       // flag for the method which is used
-    Byte_t fNumMinNeighbors;
+    Byte_t  fFlags;                // flag for the method which is used
+    Byte_t  fNumMinNeighbors;      // Number of neighbors required
+    Float_t fMaxArrivalTimeDiff;   // Maximum allowed arrival time difference of neighboring pixels
 
     TList fNamePedPhotCams;
@@ -95,5 +96,6 @@
     Bool_t IsUseInterpolation() const   { return TESTBIT(fFlags, kUseInterpolation); }
 
-    void SetNumMinNeighbors(Byte_t num) { fNumMinNeighbors=num; }
+    void SetNumMinNeighbors(Byte_t num)   { fNumMinNeighbors=num; }
+    void SetMaxArrivalTimeDiff(Float_t d) { fMaxArrivalTimeDiff=d; }
     void AddNamePedPhotCam(const char *name="MPedPhotCam");
     void SetNamePedPhotCam(const char *name)
