Index: trunk/MagicSoft/Mars/mhflux/MHThetaSq.cc
===================================================================
--- trunk/MagicSoft/Mars/mhflux/MHThetaSq.cc	(revision 7122)
+++ trunk/MagicSoft/Mars/mhflux/MHThetaSq.cc	(revision 7125)
@@ -158,2 +158,45 @@
     return static_cast<const MParameterD*>(fParameter)->GetVal();
 }
+
+// --------------------------------------------------------------------------
+//
+// You can use this function if you want to use a MHMatrix instead of
+// MMcEvt. This function adds all necessary columns to the
+// given matrix. Afterward you should fill the matrix with the corresponding
+// data (eg from a file by using MHMatrix::Fill). If you now loop
+// through the matrix (eg using MMatrixLoop) MHHadronness::Fill
+// will take the values from the matrix instead of the containers.
+//
+// It takes fSkipHist* into account!
+//
+void MHThetaSq::InitMapping(MHMatrix *mat, Int_t type)
+{
+    if (fMatrix)
+        return;
+
+    fMatrix = mat;
+
+    fMap[0] = -1;
+    fMap[1] = -1;
+    fMap[2] = -1;
+    fMap[3] = -1;
+    fMap[4] = -1;
+
+    if (!fSkipHistEnergy)
+        if (type==0)
+        {
+            fMap[1] = fMatrix->AddColumn("MEnergyEst.fVal");
+            fMap[2] = -1;
+        }
+        else
+        {
+            fMap[1] = -1;
+            fMap[2] = fMatrix->AddColumn("MHillas.fSize");
+        }
+
+    if (!fSkipHistTheta)
+        fMap[3] = fMatrix->AddColumn("MPointingPos.fZd");
+
+   // if (!fSkipHistTime)
+   //     fMap[4] = fMatrix->AddColumn("MTime.GetAxisTime");
+}
Index: trunk/MagicSoft/Mars/mhflux/MHThetaSq.h
===================================================================
--- trunk/MagicSoft/Mars/mhflux/MHThetaSq.h	(revision 7122)
+++ trunk/MagicSoft/Mars/mhflux/MHThetaSq.h	(revision 7125)
@@ -21,4 +21,5 @@
 
     Bool_t SetupFill(const MParList *pl);
+    void InitMapping(MHMatrix *mat, Int_t type=0);
 
 public:
