Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 6454)
+++ trunk/MagicSoft/Mars/Changelog	(revision 6455)
@@ -38,4 +38,9 @@
    * mjobs/MDataSet.[h,cc]: 
      - added
+
+   * manalysis/MEventRateCalc.[h,cc]:
+     - added a fix which make sure, that the rate is not influenced
+       too much by the start of data taking
+     - fixed setting of mean time corresponding to rate-interval
 
 
Index: trunk/MagicSoft/Mars/manalysis/MEventRateCalc.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MEventRateCalc.cc	(revision 6454)
+++ trunk/MagicSoft/Mars/manalysis/MEventRateCalc.cc	(revision 6455)
@@ -141,4 +141,10 @@
 }
 
+Bool_t MEventRateCalc::ReInit(MParList *pList)
+{
+    fNumFirstEvent = GetNumExecutions();
+    return kTRUE;
+}
+
 // --------------------------------------------------------------------------
 //
@@ -151,4 +157,6 @@
     const ULong_t exec = GetNumExecutions()-1;
 
+    //*fLog << all << fNumFirstEvent << " " << exec << endl;
+
     // Calculate the rate
     const UInt_t n = fTimes.GetSize();
@@ -171,4 +179,12 @@
     fTimeDiff->SetReadyToSave();
 
+    // Make sure, that the beginning of data-takeing (open
+    // a new file) doesn't effect the rate too much
+    if (exec<fNumFirstEvent+n)
+    {
+        fRate->SetRate(-1, 0);
+        return kTRUE;
+    }
+
     // Store the rate
     fRate->SetRate(exec>1?rate:0, cnt);
@@ -176,5 +192,8 @@
 
     // Store the corresponding time
-    fTimeRate->SetMean(fTimes[n1%n], fTimes[n2%n]);
+    if (exec==fNumFirstEvent+n)
+        fTimeRate->SetMean(fTimes[n2%n], fTimes[n2%n]);
+    else
+        fTimeRate->SetMean(fTimes[n1%n], fTimes[n2%n]);
 
     return kTRUE;
Index: trunk/MagicSoft/Mars/manalysis/MEventRateCalc.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MEventRateCalc.h	(revision 6454)
+++ trunk/MagicSoft/Mars/manalysis/MEventRateCalc.h	(revision 6455)
@@ -39,6 +39,9 @@
     TArrayD  fTimes;         //! internal array to store the last n event times
 
-    Int_t PreProcess(MParList *pList);
-    Int_t Process();
+    Int_t fNumFirstEvent;    //! Number of first event in file
+
+    Bool_t ReInit(MParList *pList);
+    Int_t  PreProcess(MParList *pList);
+    Int_t  Process();
 
     void  StreamPrimitive(ofstream &out) const;
