Index: trunk/Mars/mreport/MReportRates.cc
===================================================================
--- trunk/Mars/mreport/MReportRates.cc	(revision 12860)
+++ trunk/Mars/mreport/MReportRates.cc	(revision 12860)
@@ -0,0 +1,82 @@
+/* ======================================================================== *\
+!
+! *
+! * This file is part of MARS, the MAGIC Analysis and Reconstruction
+! * Software. It is distributed to you in the hope that it can be a useful
+! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
+! * It is distributed WITHOUT ANY WARRANTY.
+! *
+! * Permission to use, copy, modify and distribute this software and its
+! * documentation for any purpose is hereby granted without fee,
+! * provided that the above copyright notice appear in all copies and
+! * that both that copyright notice and this permission notice appear
+! * in supporting documentation. It is provided "as is" without express
+! * or implied warranty.
+! *
+!
+!
+!   Author(s): Thomas Bretz, 02/2012 <mailto:thomas.bretz@epfl.ch>
+!
+!   Copyright: MAGIC Software Development, 2000-2012
+!
+!
+\* ======================================================================== */
+
+//////////////////////////////////////////////////////////////////////////////
+//
+//  MReportRates
+//
+//////////////////////////////////////////////////////////////////////////////
+#include "MReportRates.h"
+
+#include "fits.h"
+
+#include "MLogManip.h"
+
+ClassImp(MReportRates);
+
+using namespace std;
+
+// --------------------------------------------------------------------------
+//
+// Default construtor. Initialize identifier to "DRIVE-REPORT"
+//
+MReportRates::MReportRates() : MReport("RATES-REPORT"),
+    fTimeStamp(0), fOnTimeCounter(0), fTriggerCounter(0), fTriggerRate(0),
+    fElapsedTime(0), fElapsedOnTime(0)
+{
+    fName  = "MReportRates";
+    fTitle = "Class for DRIVE-REPORT information (raw telescope position)";
+
+    memset(fBoardRate, 0, sizeof(Float_t)*40);
+    memset(fPatchRate, 0, sizeof(Float_t)*160);
+}
+
+Bool_t MReportRates::SetupReadingFits(std::fits &file)
+{
+    return
+        file.SetRefAddress("FTMtimeStamp",   fTimeStamp)       &&
+        file.SetRefAddress("OnTimeCounter",  fOnTimeCounter)   &&
+        file.SetRefAddress("TriggerCounter", fTriggerCounter)  &&
+        file.SetRefAddress("TriggerRate",    fTriggerRate)     &&
+        file.SetPtrAddress("BoardRate",      fBoardRate)       &&
+        file.SetPtrAddress("PatchRate",      fPatchRate)       &&
+        file.SetRefAddress("ElapsedTime",    fElapsedTime)     &&
+        file.SetRefAddress("OnTime",         fElapsedOnTime);
+}
+
+Int_t MReportRates::InterpreteFits(const std::fits &fits)
+{
+    if (fElapsedTime>0 || fElapsedOnTime>0)
+        return kTRUE;
+
+    fElapsedTime   = fTimeStamp*1e-6;
+    fElapsedOnTime = fOnTimeCounter*1e-6;
+
+    return kTRUE;
+}
+
+void MReportRates::Print(Option_t *o) const
+{
+    *fLog << GetDescriptor() << ": Time=" << fTimeStamp << "/" << fElapsedTime << " OnTime=" << fOnTimeCounter << "/" << fElapsedOnTime << endl;
+}
Index: trunk/Mars/mreport/MReportRates.h
===================================================================
--- trunk/Mars/mreport/MReportRates.h	(revision 12860)
+++ trunk/Mars/mreport/MReportRates.h	(revision 12860)
@@ -0,0 +1,38 @@
+#ifndef MARS_MReportRates
+#define MARS_MReportRates
+
+#ifndef MARS_MReport
+#include "MReport.h"
+#endif
+
+class MReportRates : public MReport
+{
+private:
+    ULong64_t fTimeStamp;       // [us] Time in microseconds, since trigger enabled or disabled
+    ULong64_t fOnTimeCounter;   // [us] Effective on-time, i.e. FTM processes triggers (e.g. No FAD busy)
+    UInt_t    fTriggerCounter;  //      Counter of camera trigers (events) since trigger enabled or disabled"
+    Float_t   fTriggerRate;     // [Hz] Trigger rate"
+    Float_t   fBoardRate[40];   // [Hz] Board rates
+    Float_t   fPatchRate[160];  // [Hz] Patch rates
+    Float_t   fElapsedTime;     // [s]  Time elapsed since previous report
+    Float_t   fElapsedOnTime;   // [s]  On-time elapsed since previous report
+
+    Bool_t SetupReadingFits(std::fits &fits);
+    Int_t  InterpreteFits(const std::fits &fits);
+
+public:
+    MReportRates();
+
+    ULong64_t GetTimeStamp() const      { return fTimeStamp;      }
+    ULong64_t GetOnTimeCounter() const  { return fOnTimeCounter;  }
+    UInt_t    GetTriggerCounter() const { return fTriggerCounter; }
+    Float_t   GetTriggerRate() const    { return fTriggerRate;    }
+    Float_t   GetElapsedTime() const    { return fElapsedTime;    }
+    Float_t   GetElapsedOnTime() const  { return fElapsedOnTime;  }
+
+    void Print(Option_t *o="") const;
+
+    ClassDef(MReportRates, 1) // Class for FTM_CONTROL/TRIGGER_RATES
+};
+
+#endif
Index: trunk/Mars/mreport/Makefile
===================================================================
--- trunk/Mars/mreport/Makefile	(revision 12776)
+++ trunk/Mars/mreport/Makefile	(revision 12860)
@@ -30,4 +30,5 @@
            MReportHelp.cc \
            MReportDrive.cc \
+           MReportRates.cc \
            MReportCamera.cc \
            MReportTrigger.cc \
Index: trunk/Mars/mreport/ReportLinkDef.h
===================================================================
--- trunk/Mars/mreport/ReportLinkDef.h	(revision 12776)
+++ trunk/Mars/mreport/ReportLinkDef.h	(revision 12860)
@@ -16,4 +16,5 @@
 #pragma link C++ class MReportCamera+;
 #pragma link C++ class MReportTrigger+;
+#pragma link C++ class MReportRates+;
 #pragma link C++ class MReportCurrents+;
 #pragma link C++ class MReportPyrometer+;
