Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 3571)
+++ trunk/MagicSoft/Mars/Changelog	(revision 3572)
@@ -84,6 +84,31 @@
      - removed MSrcPosCam
 
+   * mmain/Makefile:
+     - added include for mpointing
+
    * manalysis/AnalysisIncl.h:
      - removed TVector2
+
+   * mbase/MParContainer.h:
+     - added new abstract virtual member function SetVariables
+       (to be used in fits)
+     - addeed some text to class description
+
+   * mdata/MData.cc:
+     - added comment
+     
+   * mdata/MDataArray.[h,cc], mdata/MDataElement.h,
+     mdata/MDataList.[h,cc], mdata/MDataMember.h:
+     - added SetVariables
+
+   * mdata/MDataChain.[h,cc]:
+     - added support for indexed variables [i]
+     - added SetVariables
+
+   * mdata/MDataValue.[h,cc]: 
+     - added support for variable values (through SetVariables)
+     - added support for an index
+     - added SetVariables
+     
 
 
Index: trunk/MagicSoft/Mars/mdata/MData.cc
===================================================================
--- trunk/MagicSoft/Mars/mdata/MData.cc	(revision 3571)
+++ trunk/MagicSoft/Mars/mdata/MData.cc	(revision 3572)
@@ -18,5 +18,5 @@
 !   Author(s): Thomas Bretz  04/2002 <mailto:tbretz@astro.uni-wuerzburg.de>
 !
-!   Copyright: MAGIC Software Development, 2000-2002
+!   Copyright: MAGIC Software Development, 2000-2004
 !
 !
@@ -53,4 +53,8 @@
 //      (s.MReadTree)
 //
+//    - void SetVariables(const TArrayD &arr)
+//      is used to distribute variable numbers through lists holding
+//      MDatas to its counterpart (mainly to MDataValue)
+//
 //   The 'must' ist represented by the =0 in the class header. In the C++
 //   language this is called an abstract member function. Because the
Index: trunk/MagicSoft/Mars/mdata/MDataArray.cc
===================================================================
--- trunk/MagicSoft/Mars/mdata/MDataArray.cc	(revision 3571)
+++ trunk/MagicSoft/Mars/mdata/MDataArray.cc	(revision 3572)
@@ -18,5 +18,5 @@
 !   Author(s): Thomas Bretz  08/2002 <mailto:tbretz@astro.uni-wuerzburg.de>
 !
-!   Copyright: MAGIC Software Development, 2000-2002
+!   Copyright: MAGIC Software Development, 2000-2004
 !
 !
@@ -208,2 +208,7 @@
         v(ncols) = (*this)(ncols);
 }
+
+void MDataArray::SetVariables(const TArrayD &arr)
+{
+    fList.ForEach(MData, SetVariables)(arr);
+}
Index: trunk/MagicSoft/Mars/mdata/MDataArray.h
===================================================================
--- trunk/MagicSoft/Mars/mdata/MDataArray.h	(revision 3571)
+++ trunk/MagicSoft/Mars/mdata/MDataArray.h	(revision 3572)
@@ -56,4 +56,6 @@
     void Delete(Option_t *option="") { fList.Delete(option); }
 
+    void SetVariables(const TArrayD &arr);
+
     ClassDef(MDataArray, 1) // An array of MData containers
 };
Index: trunk/MagicSoft/Mars/mdata/MDataChain.cc
===================================================================
--- trunk/MagicSoft/Mars/mdata/MDataChain.cc	(revision 3571)
+++ trunk/MagicSoft/Mars/mdata/MDataChain.cc	(revision 3572)
@@ -18,5 +18,5 @@
 !   Author(s): Thomas Bretz  04/2002 <mailto:tbretz@astro.uni-wuerzburg.de>
 !
-!   Copyright: MAGIC Software Development, 2000-2003
+!   Copyright: MAGIC Software Development, 2000-2004
 !
 !
@@ -108,7 +108,11 @@
 //   kRadToDeg  for   static Double_t TMath::RadToDeg();
 //   kDegToRad  for   static Double_t TMath::DegToRad();
+//
 // Remark: In older root versions only Pi() and E() are implemented in
 //         TMath.
 //
+// If you want to use variables, eg for fits you can use [0], [1], ...
+// These values are initialized with 0 and set by calling
+// SetVariables().
 //
 // REMARK:
@@ -439,6 +443,18 @@
         case '8':
         case '9':
+        case '[':
+        case ']':
             if ((txt[0]!='-' && txt[0]!='+') || isdigit(txt[1]) || txt[1]=='.')
             {
+                if (!txt.IsNull() && txt[0]=='[')
+                {
+                    Int_t first = GetBracket(txt, '[', ']');
+                    TString op  = txt(1, first-1);
+                    txt.Remove(0, first+1);
+
+                    newmember = new MDataValue(0, atoi(op));
+                    break;
+                }
+
                 char *end;
                 Double_t num = strtod(txt.Data(), &end);
@@ -706,2 +722,6 @@
 }
 
+void MDataChain::SetVariables(const TArrayD &arr)
+{
+    return fMember->SetVariables(arr);
+}
Index: trunk/MagicSoft/Mars/mdata/MDataChain.h
===================================================================
--- trunk/MagicSoft/Mars/mdata/MDataChain.h	(revision 3571)
+++ trunk/MagicSoft/Mars/mdata/MDataChain.h	(revision 3572)
@@ -64,4 +64,6 @@
     TString GetDataMember() const;
 
+    void SetVariables(const TArrayD &arr);
+
     ClassDef(MDataChain, 1) // A chain/concatenation of MData objects
 };
Index: trunk/MagicSoft/Mars/mdata/MDataElement.cc
===================================================================
--- trunk/MagicSoft/Mars/mdata/MDataElement.cc	(revision 3571)
+++ trunk/MagicSoft/Mars/mdata/MDataElement.cc	(revision 3572)
@@ -18,5 +18,5 @@
 !   Author(s): Thomas Bretz  04/2002 <mailto:tbretz@astro.uni-wuerzburg.de>
 !
-!   Copyright: MAGIC Software Development, 2000-2002
+!   Copyright: MAGIC Software Development, 2000-2004
 !
 !
Index: trunk/MagicSoft/Mars/mdata/MDataElement.h
===================================================================
--- trunk/MagicSoft/Mars/mdata/MDataElement.h	(revision 3571)
+++ trunk/MagicSoft/Mars/mdata/MDataElement.h	(revision 3572)
@@ -36,4 +36,6 @@
     Double_t operator()() { return GetValue(); }
 
+    void SetVariables(const TArrayD &arr) { }
+
     ClassDef(MDataElement, 1) // MData object corresponding to a element of an MHMatrix
 };
Index: trunk/MagicSoft/Mars/mdata/MDataList.cc
===================================================================
--- trunk/MagicSoft/Mars/mdata/MDataList.cc	(revision 3571)
+++ trunk/MagicSoft/Mars/mdata/MDataList.cc	(revision 3572)
@@ -18,5 +18,5 @@
 !   Author(s): Thomas Bretz  04/2002 <mailto:tbretz@astro.uni-wuerzburg.de>
 !
-!   Copyright: MAGIC Software Development, 2000-2002
+!   Copyright: MAGIC Software Development, 2000-2004
 !
 !
@@ -372,2 +372,7 @@
     return str;
 }
+
+void MDataList::SetVariables(const TArrayD &arr)
+{
+    fMembers.ForEach(MData, SetVariables)(arr);
+}
Index: trunk/MagicSoft/Mars/mdata/MDataList.h
===================================================================
--- trunk/MagicSoft/Mars/mdata/MDataList.h	(revision 3571)
+++ trunk/MagicSoft/Mars/mdata/MDataList.h	(revision 3572)
@@ -51,4 +51,6 @@
     TString GetDataMember() const;
 
+    void SetVariables(const TArrayD &arr);
+
     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 3571)
+++ trunk/MagicSoft/Mars/mdata/MDataMember.cc	(revision 3572)
@@ -18,5 +18,5 @@
 !   Author(s): Thomas Bretz  04/2002 <mailto:tbretz@astro.uni-wuerzburg.de>
 !
-!   Copyright: MAGIC Software Development, 2000-2002
+!   Copyright: MAGIC Software Development, 2000-2004
 !
 !
Index: trunk/MagicSoft/Mars/mdata/MDataMember.h
===================================================================
--- trunk/MagicSoft/Mars/mdata/MDataMember.h	(revision 3571)
+++ trunk/MagicSoft/Mars/mdata/MDataMember.h	(revision 3572)
@@ -43,4 +43,6 @@
     Bool_t IsInt() const { return TestBit(kIsInt); }
 
+    void SetVariables(const TArrayD &arr) { }
+
     ClassDef(MDataMember, 1) // MData object corresponding to a single data member of a Mars container
 };
Index: trunk/MagicSoft/Mars/mdata/MDataValue.cc
===================================================================
--- trunk/MagicSoft/Mars/mdata/MDataValue.cc	(revision 3571)
+++ trunk/MagicSoft/Mars/mdata/MDataValue.cc	(revision 3572)
@@ -18,5 +18,5 @@
 !   Author(s): Thomas Bretz  04/2002 <mailto:tbretz@astro.uni-wuerzburg.de>
 !
-!   Copyright: MAGIC Software Development, 2000-2002
+!   Copyright: MAGIC Software Development, 2000-2004
 !
 !
@@ -28,8 +28,11 @@
 //
 //   An MData object which corresponds to a simple value like 5.5, or 7.9
+//   it can be set as variable object by giving it an index in the
+//   constructor, only in this case SetVariables takes action
 //
 /////////////////////////////////////////////////////////////////////////////
+#include "MDataValue.h"
 
-#include "MDataValue.h"
+#include <TArrayD.h>
 
 #include "MLog.h"
@@ -46,4 +49,12 @@
 TString MDataValue::GetRule() const
 {
+    if (fIndex>=0)
+    {
+        TString str("[");
+        str += fIndex;
+        str += "]";
+        return str;
+    }
+
     TString str;
     str += fValue;
@@ -51,2 +62,7 @@
 }
 
+void MDataValue::SetVariables(const TArrayD &arr)
+{
+    if (fIndex>=0 && fIndex<arr.GetSize())
+        fValue = arr[fIndex];
+}
Index: trunk/MagicSoft/Mars/mdata/MDataValue.h
===================================================================
--- trunk/MagicSoft/Mars/mdata/MDataValue.h	(revision 3571)
+++ trunk/MagicSoft/Mars/mdata/MDataValue.h	(revision 3572)
@@ -1,10 +1,4 @@
 #ifndef MARS_MDataValue
 #define MARS_MDataValue
-
-/////////////////////////////////////////////////////////////////////////////
-//                                                                         //
-//  MDataValue                                                             //
-//                                                                         //
-/////////////////////////////////////////////////////////////////////////////
 
 #ifndef MARS_MData
@@ -12,11 +6,14 @@
 #endif
 
+class TArrayD;
+
 class MDataValue : public MData
 {
 private:
     Double_t fValue;
+    Int_t    fIndex;
 
 public:
-    MDataValue(Double_t v = 0) : fValue(v)
+    MDataValue(Double_t v = 0, Int_t idx=-1) : fValue(v), fIndex(idx)
     {
     }
@@ -28,6 +25,7 @@
     Bool_t IsReadyToSave() const { return kFALSE; }
 
-    //void Print(Option_t *opt = "") const;
     TString GetRule() const;
+
+    void SetVariables(const TArrayD &arr);
 
     ClassDef(MDataValue, 1) // MData object corresponding to a single value
