Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 2593)
+++ trunk/MagicSoft/Mars/Changelog	(revision 2594)
@@ -15,5 +15,6 @@
 
    * manalysis/MEventRate.[h,cc], manalysis/MEventRateCalc.[h,cc], 
-     mfileio/MReadReports.[h,cc]:
+     mfileio/MReadReports.[h,cc], mreport/MReport*.[h,cc],
+     mcamera/MCamera*.[h,cc]:
      - fixed and added comments.
 
@@ -21,4 +22,7 @@
      - added static member functions AddDerialNumber to simplify 
        using different Serial numbers.
+
+   * macros/readrep.C:
+     - updated to be an example for more functionality
 
 
Index: trunk/MagicSoft/Mars/NEWS
===================================================================
--- trunk/MagicSoft/Mars/NEWS	(revision 2593)
+++ trunk/MagicSoft/Mars/NEWS	(revision 2594)
@@ -17,4 +17,8 @@
    - Added a preliminary 'synchronizer' (MReadReports) which will 
      replace MReadMarsFile as soon as it is finished.
+
+   - Added a tutorial macro demonstrating how report files are merpped
+     and how they can be read from the root file in the correct order
+     of time (readrep.C)
 
    - Added a generalized histogram (similar to MH3) called MVsTime
Index: trunk/MagicSoft/Mars/macros/readrep.C
===================================================================
--- trunk/MagicSoft/Mars/macros/readrep.C	(revision 2593)
+++ trunk/MagicSoft/Mars/macros/readrep.C	(revision 2594)
@@ -23,6 +23,18 @@
 \* ======================================================================== */
 
+//////////////////////////////////////////////////////////////////////////////
+//
+// This macro demonstrates how to read a central control report file.
+// (rootification, see merpp, too)
+//
+// In a second eventloop it gives an example on how to read such a root file.
+//
+//////////////////////////////////////////////////////////////////////////////
+
 void readrep(const char *fname="CC_2003_11_04_23_53_18.rep")
 {
+    //
+    // Read a report file and write containers into a root file
+    //
     MParList  plist;
     MTaskList tlist;
@@ -32,22 +44,22 @@
     tlist.AddToList(&read);
 
-    MReportDAQ daq;
-    MReportDrive drive;
-    MReportCamera camera;
-    MReportTrigger trigger;
-    read.AddToList(&daq);
-    read.AddToList(&drive);
-    read.AddToList(&camera);
-    read.AddToList(&trigger);
+    read.AddToList("DAQ");
+    read.AddToList("Drive");
+    read.AddToList("Camera");
+    read.AddToList("Trigger");
 
     MWriteRootFile write("test.root");
-    write.AddContainer("MReportDAQ",     "DAQ");
-    write.AddContainer("MTimeDAQ",       "DAQ");
-    write.AddContainer("MReportDrive",   "Drive");
-    write.AddContainer("MTimeDrive",     "Drive");
-    write.AddContainer("MReportTrigger", "Trigger");
-    write.AddContainer("MTimeTrigger",   "Trigger");
-    write.AddContainer("MReportCamera",  "Camera");
-    write.AddContainer("MTimeCamera",    "Camera");
+    write.AddContainer("MReportCamera",      "Camera");
+    write.AddContainer("MTimeCamera",        "Camera");
+    write.AddContainer("MCameraAUX",         "Camera");
+    write.AddContainer("MCameraCalibration", "Camera");
+    write.AddContainer("MCameraCooling",     "Camera");
+    write.AddContainer("MCameraHV",          "Camera");
+    write.AddContainer("MCameraLV",          "Camera");
+    write.AddContainer("MCameraLids",        "Camera");
+    write.AddContainer("MReportTrigger",     "Trigger");
+    write.AddContainer("MTimeTrigger",       "Trigger");
+    write.AddContainer("MReportDrive",       "Drive");
+    write.AddContainer("MTimeDrive",         "Drive");
     tlist.AddToList(&write);
 
@@ -60,41 +72,54 @@
     tlist.PrintStatistics();
 
-    return;
-    // ------------------------------------------
+    // ----------------------------------------------------------------
+    //
+    // Read a report file and write containers into a root file
+    //
+    MTaskList tlist2;
+    plist.Replace(&tlist2);
 
-    MParList  plist;
-
-    MTaskList tlist;
-    plist.AddToList(&tlist);
-
+    // Create a tasklist to process the read events from the Camera tree
     MTaskList list1("ProcessCamera");
     MPrint print1("MTimeCamera");
     list1.AddToList(&print1);
 
-    MTaskList list2("ProcessDAQ");
-    MPrint print2("MTimeDAQ");
+    // Create a tasklist to process the read events from the Drive tree
+    MTaskList list2("ProcessDrive");
+    MPrint print2("MTimeDrive");
     list2.AddToList(&print2);
 
+    // Tell the reader to read the trees Drive, Trigger and Camera
     MReadReports read;
-    read.AddTree("DAQ");
     read.AddTree("Drive");
     read.AddTree("Trigger");
     read.AddTree("Camera");
-    //read.AddTree("Events", "MTime");
+    //read.AddTree("Events", "MTime"); // for later use!
 
+    // Now (not earlier!) set the file to read!
     read.AddFile("test.root");
 
+    // First read the events
     tlist.AddToList(&read);
+    // Process the events from the Camera tree with the task list list1
     tlist.AddToList(&list1, "Camera");
-    tlist.AddToList(&list2, "DAQ");
+    // Process the events from the Camera tree with the task list list2
+    tlist.AddToList(&list2, "Drive");
 
+    // The task lists list1 and list2 are only executed (according to
+    // their stream id - the second argument of AddToList) if a
+    // corresponding event was read and MReadReports has set the stream
+    // id accoringly. MReadReports always sets the stream id to the name
+    // of the tree from which the event was read
 
     MEvtLoop evtloop;
     evtloop.SetParList(&plist);
 
+    //
+    // Execute the eventloop which should print the time-stamps of the subsystem
+    // events from Drive and Camera in the correct order...
+    //
     if (!evtloop.Eventloop())
         return;
 
-    plist.Print();
     tlist.PrintStatistics();
 }
