Index: trunk/Mars/mbase/MArrayF.h
===================================================================
--- trunk/Mars/mbase/MArrayF.h	(revision 17764)
+++ trunk/Mars/mbase/MArrayF.h	(revision 17765)
@@ -170,59 +170,37 @@
 
     template<class T>
-    void Add(T *src, Int_t n, Int_t p=0, Float_t m=1.)
-    {
-        // under these 3 conditions, we return immediately, because they either make no sense,
-        // or result in an invariant array.
-        if (p >= fN)
-        {
-            // maybe throw a warning, because p >= fN makes no sense at all
-            return;
-        }
-        if ( n <= 0)
-        {
-            return;
-        }
-        if (m == 0.)
-        {
-            return;
-        }
-        if (src == NULL)
-        {
-            return;
-        }
-
-        Float_t *dest = fArray + p;
-        Float_t *end  = dest;
-        if (n < fN-p)
-        {
-            end += n;
-        }
-        else
-        {
-            end += fN-p;
-        }
+        void Add(const T *src, UInt_t n, UInt_t beg=0, Float_t scale=1)
+    {
+        if (!src || beg >= fN)
+            return;
+
+        Float_t *ptr = fArray+beg;
+        const Float_t *end  = beg+n>fN ? fArray+fN : ptr+n;
 
         // we treat the case m==1. special, in order to speed up the code a bit
         // since when m==1. the multiplication can be omitted and this should be a bit faster then.
-        if (m == 1.)
-        {
-            while (dest<end)
-                *dest++ += *src++;
+        if (scale==1)
+        {
+            while (ptr<end)
+                *ptr++ += *src++;
         }
         else
         {
-            while (dest<end)
-                *dest++ += (*src++) * m;
+            while (ptr<end)
+                *ptr++ += (*src++) * m;
         }
     }
 
     template<class T>
-        void AddClipped(Double_t th, T src, Int_t n, Int_t p=0)
-    {
-        Float_t *dest = fArray + p;
-        Float_t *end  = dest   + n;
-
-        while (dest<end)
-            *dest++ += TMath::Min(*src++, th);
+        void AddClipped(Double_t th, const T *src, UInt_t n, UInt_t beg=0)
+    {
+        if (!src || beg>=fN)
+            return;
+
+        Float_t *ptr = fArray + beg;
+        const Float_t *end  = beg+n>fN ? fArray+fN : ptr+n;
+
+        while (ptr<end)
+            *ptr++ += TMath::Min(*src++, th);
     }
 
