Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 2589)
+++ trunk/MagicSoft/Mars/Changelog	(revision 2590)
@@ -13,4 +13,8 @@
      - renamed nonsens fErrors to fCounter
      - fixed usage of fDisplay
+
+   * manalysis/MEventRate.[h,cc], manalysis/MEventRateCalc.[h,cc], 
+     mfileio/MReadReports.[h,cc]:
+     - fixed and added comments.
 
    * mbase/MTask.h:
Index: trunk/MagicSoft/Mars/manalysis/MEventRate.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MEventRate.cc	(revision 2589)
+++ trunk/MagicSoft/Mars/manalysis/MEventRate.cc	(revision 2590)
@@ -24,9 +24,9 @@
 
 /////////////////////////////////////////////////////////////////////////////
-//                                                                         //
-// MEventRate                                                              //
-//                                                                         //
-// Storage Container for the estimated energy                              //
-//                                                                         //
+//
+// MEventRate
+//
+// Storage Container for the event rate
+//
 /////////////////////////////////////////////////////////////////////////////
 #include "MEventRate.h"
Index: trunk/MagicSoft/Mars/manalysis/MEventRateCalc.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MEventRateCalc.cc	(revision 2589)
+++ trunk/MagicSoft/Mars/manalysis/MEventRateCalc.cc	(revision 2590)
@@ -27,4 +27,8 @@
 //  MEventRateCalc
 //
+//  This task calculates the event rates from the event times and numbers.
+//
+//  It is under construction: More information comming soon....
+//
 //
 //  Input Containers:
@@ -33,4 +37,5 @@
 //  Output Containers:
 //    MEventRate
+//    MTimeRate [MTime] (missing)
 //
 //////////////////////////////////////////////////////////////////////////////
@@ -58,11 +63,4 @@
     fName  = name  ? name  : "MEventRateCalc";
     fTitle = title ? title : "Calculate trigger rate";
-
-    //AddToBranchList("MRawEvtData.fHiGainPixId");
-    //AddToBranchList("MRawEvtData.fLoGainPixId");
-    //AddToBranchList("MRawEvtData.fHiGainFadcSamples");
-    //AddToBranchList("MRawEvtData.fLoGainFadcSamples");
-
-    //SetDefaultWeights();
 }
 
@@ -70,11 +68,5 @@
 //
 // The PreProcess searches for the following input containers:
-//  - MRawRunHeader
-//  - MRawEvtData
-//  - MPedestalCam
-//
-// The following output containers are also searched and created if
-// they were not found:
-//  - MCerPhotEvt
+//  ...
 //
 Int_t MEventRateCalc::PreProcess(MParList *pList)
@@ -98,6 +90,4 @@
 // --------------------------------------------------------------------------
 //
-// Calculate the integral of the FADC time slices and store them as a new
-// pixel in the MCerPhotEvt container.
 //
 #include <TSystem.h>
Index: trunk/MagicSoft/Mars/mfileio/MReadReports.cc
===================================================================
--- trunk/MagicSoft/Mars/mfileio/MReadReports.cc	(revision 2589)
+++ trunk/MagicSoft/Mars/mfileio/MReadReports.cc	(revision 2590)
@@ -25,5 +25,37 @@
 /////////////////////////////////////////////////////////////////////////////
 //
-// MReadReports                                                                   //
+// MReadReports
+//
+// Read from a file events from different trees ordered in time, eg:
+//
+// Having a file with:
+//
+//      Tree1         Tree2         Tree3
+//      ------------  ------------  -----------
+//      (0) MTime[0]
+//                    (0) MTime[1]
+//      (1) MTime[2]
+//      (2) MTime[3]
+//                                  (0) MTime[1]
+//      (3) MTime[4]
+//
+// MReadReports will read the events in the tree in the following order:
+//   <0> (0) from Tree1
+//   <1> (0) from Tree2
+//   <2> (1) from Tree1
+//   <3> (2) from Tree1
+//   <4> (0) from Tree3
+//   <5> (3) from Tree1
+//   ...
+//
+// To tell MReadReports which Trees to read use: MReadReports::AddTree()
+// To schedule a file for reading use MReadReports::AddFile()
+//
+// All calls to AddTree _must_ be before the calls to AddFile!
+//
+// After reading from a tree with the name 'TreeName' the stream id of
+// the main tasklist ('MTaskList' found in MParList in PreProcess) is
+// set to this name. This means that only tasks having this stream id
+// are executed.
 //
 /////////////////////////////////////////////////////////////////////////////
@@ -45,8 +77,13 @@
 using namespace std;
 
+// --------------------------------------------------------------------------
+//
+// Default constructor. Set fName and fTitle. Instatiate fTrees and fChains.
+// Call SetOwner for fTrees and fChains
+//
 MReadReports::MReadReports()
 {
-    fName = "MRead";
-    fTitle = "MReadReports";
+    fName  = "MRead";
+    fTitle = "Reads events and reports from a root file ordered in time";
 
     fTrees  = new MTaskList("MReadReports");
@@ -57,4 +94,8 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Destructor, delete everything which was allocated by this task...
+//
 MReadReports::~MReadReports()
 {
@@ -76,4 +117,13 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Schedule the contents of this tree for reading. As a default the time
+// branch which is used for the ordering is assumed to by "MTime"+tree.
+// If this is not the case you can overwrite the default specifying the
+// name in time.
+//
+// All calls to AddTree _must_ be before the calls to AddFile!
+//
 void MReadReports::AddTree(const char *tree, const char *time)
 {
@@ -97,4 +147,10 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Schedule a file or several files (using widcards) for reading.
+//
+// All calls to AddTree _must_ be before the calls to AddFile!
+//
 Int_t MReadReports::AddFile(const char *fname, Int_t entries)
 {
@@ -109,4 +165,12 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Find MTaskList and store a pointer to it in fList.
+// Delete all entries in fChains.
+// Create all chains to read the time in the trees in advance.
+// Enable only the time-branch in this chains.
+// PreProcess fTrees (a MTaskList storing MReadTree tasks for reading)
+//
 Int_t MReadReports::PreProcess(MParList *plist)
 {
@@ -162,4 +226,8 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Return the MTime corresponding to this TChain...
+//
 MTime** MReadReports::GetTime(TChain *c) const
 {
@@ -168,4 +236,9 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Check which is the next tree to read from. Read an event from this tree.
+// Sets the StreamId accordingly.
+//
 Int_t MReadReports::Process()
 {
@@ -226,4 +299,8 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// PostProcess all MReadTree tasks in fTrees.
+//
 Int_t MReadReports::PostProcess()
 {
@@ -231,4 +308,8 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// PrintStatistics of this task and of the MReadTree tasks in fTress
+//
 void MReadReports::PrintStatistics(const Int_t lvl, Bool_t title) const
 {
Index: trunk/MagicSoft/Mars/mfileio/MReadReports.h
===================================================================
--- trunk/MagicSoft/Mars/mfileio/MReadReports.h	(revision 2589)
+++ trunk/MagicSoft/Mars/mfileio/MReadReports.h	(revision 2590)
@@ -17,14 +17,18 @@
 {
 private:
-    MTaskList *fTrees;
-    TList *fChains;
+    MTaskList *fTrees;  // Hold the trees which are scheduled for reading
+    TList     *fChains; // Hold TChains to read the times in advance
 
-    TArrayL fPos;
+    TArrayL    fPos;    // Store the position in each tree/chain
 
-    MTask *fList;
+    MTask     *fList;   // pointer to the task list to set the stream id
 
     MTime** GetTime(TChain *c) const;
 
-    UInt_t GetEntries() { return 0; }
+    UInt_t  GetEntries() { return 0; }
+
+    Int_t   PreProcess(MParList *plist);
+    Int_t   Process();
+    Int_t   PostProcess();
 
 public:
@@ -36,11 +40,7 @@
     void  AddToBranchList(const char *name);
 
-    void PrintStatistics(const Int_t lvl=0, Bool_t title=kFALSE) const;
+    void  PrintStatistics(const Int_t lvl=0, Bool_t title=kFALSE) const;
 
-    Int_t PreProcess(MParList *plist);
-    Int_t Process();
-    Int_t PostProcess();
-
-    ClassDef(MReadReports, 0)	// Base class for a reading task
+    ClassDef(MReadReports, 0) // Reads events and reports from a root file ordered in time
 };
 
