Index: trunk/MagicSoft/Mars/mdata/DataLinkDef.h
===================================================================
--- trunk/MagicSoft/Mars/mdata/DataLinkDef.h	(revision 1499)
+++ trunk/MagicSoft/Mars/mdata/DataLinkDef.h	(revision 1524)
@@ -7,4 +7,5 @@
 #pragma link C++ class MData+;
 #pragma link C++ class MDataArray+;
+#pragma link C++ class MDataElement+;
 #pragma link C++ class MDataList+;
 #pragma link C++ class MDataValue+;
Index: trunk/MagicSoft/Mars/mdata/MDataChain.cc
===================================================================
--- trunk/MagicSoft/Mars/mdata/MDataChain.cc	(revision 1499)
+++ trunk/MagicSoft/Mars/mdata/MDataChain.cc	(revision 1524)
@@ -91,5 +91,6 @@
 #include "MDataValue.h"
 #include "MDataMember.h"
-#
+#include "MDataElement.h"
+
 ClassImp(MDataChain);
 
@@ -164,5 +165,5 @@
     for (int i=0; i<l; i++)
     {
-        if (!isalnum(txt[i]) && txt[i]!='.' &&
+        if (!isalnum(txt[i]) && txt[i]!='.' && /*txt[i]!='['&&txt[i]!=']'&&*/
             ((txt[i]!='-' && txt[i]!='+') || i!=0))
             return i;
@@ -172,12 +173,12 @@
 }
 
-Int_t MDataChain::GetBracket(TString txt)
+Int_t MDataChain::GetBracket(TString txt, char open, char close)
 {
     Int_t first=1;
     for (int cnt=0; first<txt.Length(); first++)
     {
-        if (txt[first]=='(')
+        if (txt[first]==open)
             cnt++;
-        if (txt[first]==')')
+        if (txt[first]==close)
             cnt--;
         if (cnt==-1)
@@ -197,4 +198,5 @@
 
     if (txt=="abs")   return kEAbs;
+    if (txt=="fabs")  return kEAbs;
     if (txt=="log")   return kELog;
     if (txt=="log10") return kELog10;
@@ -238,5 +240,5 @@
                 // Search for the corresponding bracket
                 //
-                Int_t first=GetBracket(txt);
+                Int_t first=GetBracket(txt, '(', ')');
 
                 if (first==txt.Length())
@@ -364,4 +366,13 @@
             txt = txt.Strip(TString::kBoth);
 
+            if (!txt.IsNull() && txt[0]=='[')
+            {
+                Int_t first = GetBracket(txt, '[', ']');
+                TString op  = txt(1, first-1);
+                txt.Remove(0, first+1);
+
+                newmember = new MDataElement(text, atoi(op));
+                break;
+            }
             if ((txt.IsNull() || txt[0]!='(') && text[0]!='-' && text[0]!='+')
             {
@@ -379,10 +390,9 @@
             }
 
-            Int_t first = GetBracket(txt);
+            Int_t first = GetBracket(txt, '(', ')');
             TString sub = op==kENegative || op==kEPositive ? text.Remove(0,1) + txt : txt(1, first-1);
             txt.Remove(0, first+1);
 
             newmember = new MDataChain(sub, op);
-
             if (!newmember->IsValid())
             {
Index: trunk/MagicSoft/Mars/mdata/MDataChain.h
===================================================================
--- trunk/MagicSoft/Mars/mdata/MDataChain.h	(revision 1499)
+++ trunk/MagicSoft/Mars/mdata/MDataChain.h	(revision 1524)
@@ -46,5 +46,5 @@
 
     Int_t IsAlNum(TString txt);
-    Int_t GetBracket(TString txt);
+    Int_t GetBracket(TString txt, char open, char close);
 
     MData *ParseString(TString txt, Int_t level);
Index: trunk/MagicSoft/Mars/mdata/MDataElement.cc
===================================================================
--- trunk/MagicSoft/Mars/mdata/MDataElement.cc	(revision 1524)
+++ trunk/MagicSoft/Mars/mdata/MDataElement.cc	(revision 1524)
@@ -0,0 +1,118 @@
+/* ======================================================================== *\
+!
+! *
+! * This file is part of MARS, the MAGIC Analysis and Reconstruction
+! * Software. It is distributed to you in the hope that it can be a useful
+! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
+! * It is distributed WITHOUT ANY WARRANTY.
+! *
+! * Permission to use, copy, modify and distribute this software and its
+! * documentation for any purpose is hereby granted without fee,
+! * provided that the above copyright notice appear in all copies and
+! * that both that copyright notice and this permission notice appear
+! * in supporting documentation. It is provided "as is" without express
+! * or implied warranty.
+! *
+!
+!
+!   Author(s): Thomas Bretz  04/2002 <mailto:tbretz@uni-sw.gwdg.de>
+!
+!   Copyright: MAGIC Software Development, 2000-2002
+!
+!
+\* ======================================================================== */
+
+/////////////////////////////////////////////////////////////////////////////
+//
+//   MDataElement
+//
+//  This MData class is used for accessing a column of an MHMatrix object.
+//    eg. MDataElement("Matrix", 5)
+//  will return the 5th column of the MHMatrix object called Matrix.
+//
+//  The row which is accessed must be set before by using
+//  MHMatrix::SetNumRow. If you want to loop through a matrix use
+//  MMatrixLoop.
+//
+/////////////////////////////////////////////////////////////////////////////
+#include "MDataElement.h"
+
+#include <fstream.h>
+
+#include "MHMatrix.h"
+
+#include "MLog.h"
+#include "MLogManip.h"
+
+#include "MParList.h"
+
+ClassImp(MDataElement);
+
+// --------------------------------------------------------------------------
+//
+// Specify the name of the MHMatrix-object and the column you want to
+// access.
+//
+MDataElement::MDataElement(const char *member, Int_t col)
+    : fMatrixName(member), fNumCol(col), fMatrix(NULL)
+{
+}
+
+// --------------------------------------------------------------------------
+//
+// Specify the pointer of the MHMatrix-object and the column you want to
+// access.
+//
+MDataElement::MDataElement(MHMatrix *mat, Int_t col)
+    : fMatrixName(mat->GetName()), fNumCol(col), fMatrix(mat)
+{
+}
+
+// --------------------------------------------------------------------------
+//
+// returns the value you requested
+//
+Double_t MDataElement::GetValue() const
+{
+    return fMatrix ? (*fMatrix)[fNumCol] : 0;
+}
+
+// --------------------------------------------------------------------------
+//
+//  If the pointer to the MHMatrix isn't yet set search for it in the
+// parameter list.
+//
+Bool_t MDataElement::PreProcess(const MParList *plist)
+{
+    if (fMatrix)
+        return kTRUE;
+
+    fMatrix = (MHMatrix*)plist->FindObject(fMatrixName, "MHMatrix");
+    if (!fMatrix)
+    {
+        *fLog << err << "MHMatrix '" << fMatrixName << "' not in parameter list... aborting." << endl;
+        return kFALSE;
+    }
+
+    return kTRUE;
+}
+
+// --------------------------------------------------------------------------
+//
+// Returns the ready-to-save flag of the data member container
+//
+Bool_t MDataElement::IsReadyToSave() const
+{
+    return IsValid() ? fMatrix->IsReadyToSave() : kFALSE;
+}
+
+// --------------------------------------------------------------------------
+//
+// Return the rule used to identify this object in a datachain
+//
+TString MDataElement::GetRule() const
+{
+    TString rule = fMatrixName + "[";
+    rule += fNumCol;
+    return rule+"]";
+}
Index: trunk/MagicSoft/Mars/mdata/MDataElement.h
===================================================================
--- trunk/MagicSoft/Mars/mdata/MDataElement.h	(revision 1524)
+++ trunk/MagicSoft/Mars/mdata/MDataElement.h	(revision 1524)
@@ -0,0 +1,41 @@
+#ifndef MARS_MDataElement
+#define MARS_MDataElement
+
+/////////////////////////////////////////////////////////////////////////////
+//                                                                         //
+//  MDataElement                                                           //
+//                                                                         //
+/////////////////////////////////////////////////////////////////////////////
+#ifndef MARS_MData
+#include "MData.h"
+#endif
+
+class MHMatrix;
+
+class MDataElement : public MData
+{
+private:
+    TString   fMatrixName;
+    Int_t     fNumCol;
+
+    MHMatrix *fMatrix;
+
+public:
+    MDataElement(const char *member=NULL, Int_t col=-1);
+    MDataElement(MHMatrix *mat, Int_t col=-1);
+
+    Double_t GetValue() const;
+    Bool_t PreProcess(const MParList *plist);
+
+    Bool_t IsValid() const { return kTRUE; }
+    Bool_t IsReadyToSave() const;
+
+    //void Print(Option_t *opt = "") const;
+    TString GetRule() const;
+
+    Double_t operator()() { return GetValue(); }
+
+    ClassDef(MDataElement, 1) // MData object corresponding to a element of an MHMatrix
+};
+
+#endif
Index: trunk/MagicSoft/Mars/mdata/Makefile
===================================================================
--- trunk/MagicSoft/Mars/mdata/Makefile	(revision 1499)
+++ trunk/MagicSoft/Mars/mdata/Makefile	(revision 1524)
@@ -20,5 +20,5 @@
 # @endcode 
 
-INCLUDES = -I. -I../mbase
+INCLUDES = -I. -I../mbase -I../mhist
 
 # @code 
@@ -33,4 +33,5 @@
 SRCFILES = MData.cc \
 	   MDataArray.cc \
+           MDataElement.cc \
 	   MDataMember.cc \
 	   MDataValue.cc \
