Index: trunk/MagicSoft/Mars/mdata/MData.cc
===================================================================
--- trunk/MagicSoft/Mars/mdata/MData.cc	(revision 1524)
+++ trunk/MagicSoft/Mars/mdata/MData.cc	(revision 1574)
@@ -16,5 +16,5 @@
 !
 !
-!   Author(s): Thomas Bretz  04/2002 <mailto:tbretz@uni-sw.gwdg.de>
+!   Author(s): Thomas Bretz  04/2002 <mailto:tbretz@astro.uni-wuerzburg.de>
 !
 !   Copyright: MAGIC Software Development, 2000-2002
@@ -44,4 +44,19 @@
 //      from the parlist.
 //
+//    - TString GetRule()
+//      returns the rule as a text which would recreate the same structure
+//      when used in a MDataChain
+//
+//    - TString GetDataMember()
+//      returns the names (seperated by a comma) used by this class. This
+//      is mainly used for the AutoScheme when reading data from a file.
+//      (s.MReadTree)
+//
+//   The 'must' ist represented by the =0 in the class header. In the C++
+//   language this is called an abstract member function. Because the
+//   class contains abstract member function which makes it impossible
+//   to create an instance of this class one calls it also:
+//   abstract base class
+//
 /////////////////////////////////////////////////////////////////////////////
 
Index: trunk/MagicSoft/Mars/mdata/MData.h
===================================================================
--- trunk/MagicSoft/Mars/mdata/MData.h	(revision 1524)
+++ trunk/MagicSoft/Mars/mdata/MData.h	(revision 1574)
@@ -21,4 +21,5 @@
     virtual Bool_t   PreProcess(const MParList *plist) = 0;
     virtual TString  GetRule() const = 0;
+    virtual TString  GetDataMember() const { return ""; }
 
     Double_t operator()() { return GetValue(); }
Index: trunk/MagicSoft/Mars/mdata/MDataArray.cc
===================================================================
--- trunk/MagicSoft/Mars/mdata/MDataArray.cc	(revision 1524)
+++ trunk/MagicSoft/Mars/mdata/MDataArray.cc	(revision 1574)
@@ -16,5 +16,5 @@
 !
 !
-!   Author(s): Thomas Bretz  08/2002 <mailto:tbretz@uni-sw.gwdg.de>
+!   Author(s): Thomas Bretz  08/2002 <mailto:tbretz@astro.uni-wuerzburg.de>
 !
 !   Copyright: MAGIC Software Development, 2000-2002
@@ -26,4 +26,7 @@
 //
 //   MDataArray
+//
+//   An Array of MData derived classes.
+//   It can be used, eg, in MHMatrix for description of the columns.
 //
 /////////////////////////////////////////////////////////////////////////////
@@ -42,4 +45,8 @@
 static const TString gsDefTitle = "Array to store MData cntainers";
 
+// --------------------------------------------------------------------------
+//
+// Constructor
+//
 MDataArray::MDataArray(const char *name, const char *title)
 {
@@ -48,4 +55,8 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Add a new data rule as a new entry (MDataChain)
+//
 void MDataArray::AddEntry(const TString rule)
 {
@@ -55,4 +66,18 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Add a new data as a new entry (MData). If the destructor of MDataArray
+// should delete the object set its bit kCanDelete
+//
+void MDataArray::AddEntry(MData *data)
+{
+    fList.Add(data);
+}
+
+// --------------------------------------------------------------------------
+//
+// Return the i-th entry
+//
 MData &MDataArray::operator[](Int_t i) const
 {
@@ -60,4 +85,8 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Return the data value of the i-th entry
+//
 Double_t MDataArray::operator()(Int_t i)
 {
@@ -65,4 +94,8 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// PreProcesses all members in the list
+//
 Bool_t MDataArray::PreProcess(const MParList *plist)
 {
@@ -82,4 +115,8 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Print the rules for all entries of the array
+//
 void MDataArray::Print(Option_t *opt) const
 {
@@ -102,4 +139,10 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Implementation of SavePrimitive. Used to write the call to a constructor
+// to a macro. In the original root implementation it is used to write
+// gui elements to a macro-file.
+//
 void MDataArray::StreamPrimitive(ofstream &out) const
 {
@@ -119,2 +162,24 @@
         out << "   " << GetUniqueName() << ".AddEntry(\"" << data->GetRule() << "\");" << endl;
 }
+
+// --------------------------------------------------------------------------
+//
+// Return the data members existing in this array in a comma-seperated list
+// (This is mainly used for MTask::AddToBranchList)
+//
+TString MDataArray::GetDataMember() const
+{
+    TString str;
+
+    TIter Next(&fList);
+    MData *data = NULL;
+    while ((data=(MData*)Next()))
+    {
+        if (data->GetDataMember().IsNull())
+            continue;
+
+        str += ",";
+        str += data->GetDataMember();
+    }
+    return str;
+}
Index: trunk/MagicSoft/Mars/mdata/MDataArray.h
===================================================================
--- trunk/MagicSoft/Mars/mdata/MDataArray.h	(revision 1524)
+++ trunk/MagicSoft/Mars/mdata/MDataArray.h	(revision 1574)
@@ -28,4 +28,5 @@
 
     void AddEntry(const TString rule);
+    void AddEntry(MData *data);
 
     MData &operator[](Int_t i) const;
@@ -33,4 +34,6 @@
 
     Bool_t PreProcess(const MParList *plist);
+
+    TString GetDataMember() const;
 
     void Print(Option_t *opt = "") const;
Index: trunk/MagicSoft/Mars/mdata/MDataChain.cc
===================================================================
--- trunk/MagicSoft/Mars/mdata/MDataChain.cc	(revision 1524)
+++ trunk/MagicSoft/Mars/mdata/MDataChain.cc	(revision 1574)
@@ -16,5 +16,5 @@
 !
 !
-!   Author(s): Thomas Bretz  04/2002 <mailto:tbretz@uni-sw.gwdg.de>
+!   Author(s): Thomas Bretz  04/2002 <mailto:tbretz@astro.uni-wuerzburg.de>
 !
 !   Copyright: MAGIC Software Development, 2000-2002
@@ -95,4 +95,8 @@
 ClassImp(MDataChain);
 
+// --------------------------------------------------------------------------
+//
+//  Constructor which takes a rule and a surrounding operator as argument
+//
 MDataChain::MDataChain(const char *rule, OperatorType_t op)
     : fOperatorType(op)
@@ -104,4 +108,8 @@
 }
 
+// --------------------------------------------------------------------------
+//
+//  Default constructor
+//
 MDataChain::MDataChain()
     : fMember(NULL), fOperatorType(kENoop)
@@ -109,4 +117,9 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Constructor taking a rule as an argument. For more details see
+// class description
+//
 MDataChain::MDataChain(const char *rule, const char *name, const char *title)
     : fOperatorType(kENoop)
@@ -220,4 +233,8 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Core of the data chain. Here the chain is constructed out of the rule.
+//
 MData *MDataChain::ParseString(TString txt, Int_t level)
 {
@@ -420,4 +437,8 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Returns the value described by the rule
+//
 Double_t MDataChain::GetValue() const
 {
@@ -498,4 +519,9 @@
         */
 
+// --------------------------------------------------------------------------
+//
+// Builds a rule from all the chain members. This is a rule which could
+// be used to rebuild the chain.
+//
 TString MDataChain::GetRule() const
 {
@@ -541,2 +567,12 @@
     return str;
 }
+
+// --------------------------------------------------------------------------
+//
+// Return a comma seperated list of all data members used in the chain.
+// This is mainly used in MTask::AddToBranchList
+//
+TString MDataChain::GetDataMember() const
+{
+    return fMember->GetDataMember();
+}
Index: trunk/MagicSoft/Mars/mdata/MDataChain.h
===================================================================
--- trunk/MagicSoft/Mars/mdata/MDataChain.h	(revision 1524)
+++ trunk/MagicSoft/Mars/mdata/MDataChain.h	(revision 1574)
@@ -66,4 +66,5 @@
 
     TString GetRule() const;
+    TString GetDataMember() const;
 
     ClassDef(MDataChain, 1) // A chain/concatenation of MData objects
Index: trunk/MagicSoft/Mars/mdata/MDataElement.cc
===================================================================
--- trunk/MagicSoft/Mars/mdata/MDataElement.cc	(revision 1524)
+++ trunk/MagicSoft/Mars/mdata/MDataElement.cc	(revision 1574)
@@ -16,5 +16,5 @@
 !
 !
-!   Author(s): Thomas Bretz  04/2002 <mailto:tbretz@uni-sw.gwdg.de>
+!   Author(s): Thomas Bretz  04/2002 <mailto:tbretz@astro.uni-wuerzburg.de>
 !
 !   Copyright: MAGIC Software Development, 2000-2002
Index: trunk/MagicSoft/Mars/mdata/MDataList.cc
===================================================================
--- trunk/MagicSoft/Mars/mdata/MDataList.cc	(revision 1524)
+++ trunk/MagicSoft/Mars/mdata/MDataList.cc	(revision 1574)
@@ -16,5 +16,5 @@
 !
 !
-!   Author(s): Thomas Bretz  04/2002 <mailto:tbretz@uni-sw.gwdg.de>
+!   Author(s): Thomas Bretz  04/2002 <mailto:tbretz@astro.uni-wuerzburg.de>
 !
 !   Copyright: MAGIC Software Development, 2000-2002
@@ -182,4 +182,8 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// PreProcesses all members in the list
+//
 Bool_t MDataList::PreProcess(const MParList *plist)
 {
@@ -259,4 +263,9 @@
     */
 
+// --------------------------------------------------------------------------
+//
+// Builds a rule from all the list members. This is a rule which could
+// be used to rebuild the list using the constructor of a MDataChain
+//
 TString MDataList::GetRule() const
 {
@@ -306,2 +315,30 @@
     return str;
 }
+
+// --------------------------------------------------------------------------
+//
+// Return a comma seperated list of all data members used in the chain.
+// This is mainly used in MTask::AddToBranchList
+//
+TString MDataList::GetDataMember() const
+{
+    TString str;
+
+    TIter Next(&fMembers);
+
+    MData *member=(MData*)Next();
+
+    if (!member->GetDataMember().IsNull())
+        str += member->GetDataMember();
+
+    while ((member=(MData*)Next()))
+    {
+        if (!member->GetDataMember().IsNull())
+        {
+            str += ",";
+            str += member->GetDataMember();
+        }
+    }
+
+    return str;
+}
Index: trunk/MagicSoft/Mars/mdata/MDataList.h
===================================================================
--- trunk/MagicSoft/Mars/mdata/MDataList.h	(revision 1524)
+++ trunk/MagicSoft/Mars/mdata/MDataList.h	(revision 1574)
@@ -49,4 +49,5 @@
 //    void Print(Option_t *opt = "") const;
     TString GetRule() const;
+    TString GetDataMember() const;
 
     ClassDef(MDataList, 1) // A concatenation of MData objects by one operator
Index: trunk/MagicSoft/Mars/mdata/MDataMember.cc
===================================================================
--- trunk/MagicSoft/Mars/mdata/MDataMember.cc	(revision 1524)
+++ trunk/MagicSoft/Mars/mdata/MDataMember.cc	(revision 1574)
@@ -16,5 +16,5 @@
 !
 !
-!   Author(s): Thomas Bretz  04/2002 <mailto:tbretz@uni-sw.gwdg.de>
+!   Author(s): Thomas Bretz  04/2002 <mailto:tbretz@astro.uni-wuerzburg.de>
 !
 !   Copyright: MAGIC Software Development, 2000-2002
@@ -170,6 +170,20 @@
 */
 
+// --------------------------------------------------------------------------
+//
+// Builds a rule which cn be used in a MDataChain to describe this object
+//
 TString MDataMember::GetRule() const
 {
     return fDataMember;
 }
+
+// --------------------------------------------------------------------------
+//
+// Returns the data member.
+// This is mainly used in MTask::AddToBranchList
+//
+TString MDataMember::GetDataMember() const
+{
+    return fDataMember;
+}
Index: trunk/MagicSoft/Mars/mdata/MDataMember.h
===================================================================
--- trunk/MagicSoft/Mars/mdata/MDataMember.h	(revision 1524)
+++ trunk/MagicSoft/Mars/mdata/MDataMember.h	(revision 1574)
@@ -37,4 +37,5 @@
     //void Print(Option_t *opt = "") const;
     TString GetRule() const;
+    TString GetDataMember() const;
 
     ClassDef(MDataMember, 1) // MData object corresponding to a single data member of a Mars container
