Index: /trunk/MagicSoft/Mars/mbase/MReadMarsFile.cc
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MReadMarsFile.cc	(revision 1035)
+++ /trunk/MagicSoft/Mars/mbase/MReadMarsFile.cc	(revision 1036)
@@ -27,25 +27,8 @@
 // MReadMarsFile                                                           //
 //                                                                         //
-// This tasks opens all branches in a specified tree and creates the       //
-// corresponding parameter containers if not already existing in the       //
-// parameter list.                                                         //
+// This task works more or less like MReadTree, but in addition PreProcess //
+// reads all the information from the 'RunHeader' tree.                    //
 //                                                                         //
-// The Process function reads one events from the tree. To go through the  //
-// events of one tree make sure that the event number is increased from    //
-// outside. It makes also possible to go back by decreasing the number.    //
-//                                                                         //
-// If you don't want to start reading the first event you have to call     //
-// MReadMarsFile::SetEventNum after instantiating your                     //
-// MReadMarsFile-object.                                                   //
-//                                                                         //
-// To make reading much faster (up to a factor of 10 to 20) you can        //
-// ensure that only the data you are really processing is enabled by       //
-// calling MReadMarsFile::UseLeaf.                                         //
-//                                                                         //
-// FIXME: An automatic enabeling scheme would be nice.                     //
-//        Can we use TBranch::SetAutoDelete?                               //
-//                                                                         //
-// Later we'll use TChain::SetNotify to notify MReadMarsFile if the TChain //
-// starts to read a new file.                                              //
+// Warning: Until now this works only for 'one run header per file'        //
 //                                                                         //
 /////////////////////////////////////////////////////////////////////////////
@@ -59,9 +42,6 @@
 // --------------------------------------------------------------------------
 //
-//  Default constructor. It creates an TChain instance which represents the
-//  the Tree you want to read and adds the given file (if you gave one).
-//  More files can be added using MReadMarsFile::AddFile.
-//  Also an empty veto list is created. This list is used if you want to
-//  veto (disable or "don't enable") a branch in the tree.
+//  Default constructor. It creates a MReadTree object to read the
+//  RunHeaders and disables Auto Scheme for this tree.
 //
 MReadMarsFile::MReadMarsFile(const char *tname, const char *fname,
@@ -81,5 +61,5 @@
 // --------------------------------------------------------------------------
 //
-// Destructor. It deletes the TChain and veto list object
+// Destructor. Deleted the MReadTree object for the RunHeaders
 //
 MReadMarsFile::~MReadMarsFile()
@@ -90,12 +70,7 @@
 // --------------------------------------------------------------------------
 //
-//  If you want to read the given tree over several files you must add
-//  the files here before PreProcess is called. Be careful: If the tree
-//  doesn't have the same contents (branches) it may confuse your
-//  program (trees which are are not existing in later files are not read
-//  anymore, tree wich are not existing in the first file are never read)
-//
-//  Name may use the wildcarding notation, eg "xxx*.root" means all files
-//  starting with xxx in the current file system directory.
+//  see MReadTree::AddFile, too. The file is also added to the chain for
+//  the run headers. If adding file gives a different result for both
+//  chains -1 is returned, otherwise the number of files which were added.
 //
 Int_t MReadMarsFile::AddFile(const char *fname)
@@ -113,4 +88,12 @@
 }
 
+// --------------------------------------------------------------------------
+//
+//  This overload MReadTree::Notify. Before the MReadTree Notify
+//  TObjects are called the RunHeaders of the next files are read.
+//  
+//  WARNING: This doesn't work correctly yet, if the files are not read in
+//           increasing order.
+//
 Bool_t MReadMarsFile::Notify()
 {
@@ -129,13 +112,6 @@
 // --------------------------------------------------------------------------
 //
-//  The PreProcess loops (till now) over the branches in the given tree.
-//  It checks if the corresponding containers (containers with the same
-//  name than the branch name) are existing in the Parameter Container List.
-//  If not, a container of objec type 'branch-name' is created (everything
-//  after the last semicolon in the branch name is stripped). Only
-//  branches which don't have a veto (see VetoBranch) are enabled If the
-//  object isn't found in the root dictionary (a list of classes known by the
-//  root environment) the branch is skipped and an error message is printed
-//  out.
+//  PreProcessed the MReadTree to read the run headers and its base class.
+//  see MReadTree::PreProcess for more information
 //
 Bool_t MReadMarsFile::PreProcess(MParList *pList)
Index: /trunk/MagicSoft/Mars/mbase/MReadTree.cc
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MReadTree.cc	(revision 1035)
+++ /trunk/MagicSoft/Mars/mbase/MReadTree.cc	(revision 1036)
@@ -42,12 +42,11 @@
 // calling MReadTree::UseLeaf.                                             //
 //                                                                         //
-// FIXME: An automatic enabeling scheme would be nice.                     //
-//        Can we use TBranch::SetAutoDelete?                               //
-//                                                                         //
-// Later we'll use TChain::SetNotify to notify MReadTree if the TChain     //
-// starts to read a new file.                                              //
+// If the chain switches from one file to another file all                 //
+// TObject::Notify() functions are called of TObject objects which were    //
+// added to the Notifier list view MReadTree::AddNotify. If MReadTree      //
+// is the owner (viw MReadTree::SetOwner) all this objects are deleted     //
+// by the destructor of MReadTree                                          //
 //                                                                         //
 /////////////////////////////////////////////////////////////////////////////
-
 #include "MReadTree.h"
 
@@ -75,5 +74,8 @@
 //  More files can be added using MReadTree::AddFile.
 //  Also an empty veto list is created. This list is used if you want to
-//  veto (disable or "don't enable") a branch in the tree.
+//  veto (disable or "don't enable") a branch in the tree, it vetos also
+//  the creation of the corresponding object.
+//  An empty list of TObjects are also created. This objects are called
+//  at any time the TChain starts to read from another file.
 //
 MReadTree::MReadTree(const char *tname, const char *fname,
@@ -123,4 +125,9 @@
 }
 
+// --------------------------------------------------------------------------
+//
+//  If the owner flag is set all TObjects which are scheduled via
+//  AddNotify are deleted by the destructor of MReadTree
+//
 void MReadTree::SetOwner(Bool_t flag)
 {
@@ -128,4 +135,10 @@
 }
 
+// --------------------------------------------------------------------------
+//
+//  This function is called each time MReadTree changes the file to read
+//  from. It calls all TObject::Notify() functions which are scheduled
+//  via AddNotify.
+//
 Bool_t MReadTree::Notify()
 {
@@ -145,4 +158,6 @@
 //  starting with xxx in the current file system directory.
 //
+//  AddFile returns the number of files added to the chain.
+//
 Int_t MReadTree::AddFile(const char *fname)
 {
@@ -156,4 +171,11 @@
 }
 
+// --------------------------------------------------------------------------
+//
+//  This function is called if Branch choosing method should get enabled.
+//  Branch choosing means, that only the enabled branches are read into
+//  memory. To use an enableing scheme we have to disable all branches first.
+//  This is done, if this function is called the first time.
+//
 void MReadTree::EnableBranchChoosing()
 {
@@ -481,4 +503,8 @@
 }
 
+// --------------------------------------------------------------------------
+//
+//  Return the name of the file we are actually reading from.
+//
 const char *MReadTree::GetFileName() const
 {
@@ -486,4 +512,10 @@
 }
 
+// --------------------------------------------------------------------------
+//
+//  This schedules a TObject which Notify(9 function is called in case
+//  of MReadTree (TChain) switches from one file in the chain to another
+//  one.
+//
 void MReadTree::AddNotify(TObject *obj)
 {
