Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 8886)
+++ trunk/MagicSoft/Mars/Changelog	(revision 8888)
@@ -18,4 +18,28 @@
 
                                                  -*-*- END OF LINE -*-*-
+
+ 2008/05/14 Thomas Bretz
+
+   * mhbase/MH3.[h,cc], mhbase/MHn.[h,cc]:
+     - enhanced to allow direct filling of Profile histograms
+
+   * mjobs/MDataSet.h:
+     - fixed a bug in Print() causing an infinite loop
+
+   * mjtrain/MJTrainDisp.cc, mjtrain/MJTrainSeparation.cc:
+     - write the dataset(s) to the output file
+
+   * mjtrain/MJTrainEnergy.cc
+     - write the dataset to the output file
+     - added new plots to show the resolution versus several different parameters
+
+   * mpedestal/MPedestalSubtract.[h,cc]:
+     - added an additional check to compate the number of hi-/lo-gain slices
+       in the run- and event-header
+
+   * mpointing/MPointingDevCalc.cc:
+     - added the 14th Jan 08 to the list of new pointing models
+
+
 
  2008/05/07 Stefan Ruegamer
@@ -50,4 +74,12 @@
    * mreport/MReportDrive.cc:
      - implemented changes of Version 20080220
+
+
+
+ 2008/03/19 Thomas Bretz
+
+   * mjobs/MJSpectrum.cc:
+     - fixed a bug introduced yesterday. The overflow bin was not
+       correctly referenced
 
 
Index: trunk/MagicSoft/Mars/mhbase/MH3.cc
===================================================================
--- trunk/MagicSoft/Mars/mhbase/MH3.cc	(revision 8886)
+++ trunk/MagicSoft/Mars/mhbase/MH3.cc	(revision 8888)
@@ -124,7 +124,20 @@
 // Default constructor.
 //
-MH3::MH3(const unsigned int dim)
-    : fDimension(dim>3?3:dim), fHist(NULL), fStyleBits(0)
-{  
+MH3::MH3(const Int_t dim, Type_t type)
+    : fDimension(dim), fHist(NULL), fStyleBits(0)
+{
+    switch (type)
+    {
+    case kHistogram:
+        if (fDimension>3)
+            fDimension=3;
+        break;
+    case kProfile:
+        fDimension = -TMath::Abs(fDimension);
+        if (fDimension<-2)
+            fDimension = -2;
+        break;
+    }
+
     switch (fDimension)
     {
@@ -132,4 +145,8 @@
         fHist = new TH1D;
         fHist->SetYTitle("Counts");
+        break;
+    case -1:
+        fHist = new TProfile;
+        fHist->SetYTitle("Average");
         break;
     case 2:
@@ -137,4 +154,8 @@
         fHist->SetZTitle("Counts");
         break;
+    case -2:
+        fHist = new TProfile2D;
+        fHist->SetZTitle("Average");
+        break;
     case 3:
         fHist = new TH3D;
@@ -194,4 +215,8 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Adapt a given histogram
+//
 MH3::MH3(const TH1 &h1)
     : fDimension(1), fStyleBits(0)
@@ -237,8 +262,8 @@
 // description above.
 //
-MH3::MH3(const char *memberx, const char *membery)
-    : fDimension(2), fStyleBits(0)
-{
-    fHist = new TH2D;
+MH3::MH3(const char *memberx, const char *membery, Type_t type)
+    : fDimension(type==kHistogram?2:-1), fStyleBits(0)
+{
+    fHist = type==kHistogram ? static_cast<TH1*>(new TH2D) : static_cast<TH1*>(new TProfile); //new TH2D;
 
     fData[0] = new MDataPhrase(memberx);
@@ -255,5 +280,5 @@
     fHist->UseCurrentStyle();
     fHist->SetDirectory(NULL);
-    fHist->SetZTitle("Counts");
+    fHist->SetZTitle(fDimension>0?"Counts":"Average");
 
     fScale[0] = 1;
@@ -268,8 +293,8 @@
 // description see the class description above.
 //
-MH3::MH3(const char *memberx, const char *membery, const char *memberz)
-    : fDimension(3), fStyleBits(0)
-{
-    fHist = new TH3D;
+MH3::MH3(const char *memberx, const char *membery, const char *memberz, Type_t type)
+    : fDimension(type==kHistogram?3:-2), fStyleBits(0)
+{
+    fHist = type==kHistogram ? static_cast<TH1*>(new TH3D) : static_cast<TH1*>(new TProfile2D); //new TH2D;
 
     fData[0] = new MDataPhrase(memberx);
@@ -357,5 +382,5 @@
     MBinning *binsz = NULL;
 
-    switch (fDimension)
+    switch (TMath::Abs(fDimension))
     {
     case 3:
@@ -366,6 +391,4 @@
             return kFALSE;
         }
-        if (fData[2] && !fData[2]->PreProcess(plist))
-            return kFALSE;
         if (fData[2])
             fHist->SetZTitle(fData[2]->GetTitle());
@@ -381,6 +404,4 @@
             return kFALSE;
         }
-        if (fData[1] && !fData[1]->PreProcess(plist))
-            return kFALSE;
         if (fData[1])
             fHist->SetYTitle(fData[1]->GetTitle());
@@ -402,6 +423,4 @@
             }
         }
-        if (fData[0] && !fData[0]->PreProcess(plist))
-            return kFALSE;
         if (fData[0]!=NULL)
             fHist->SetXTitle(fData[0]->GetTitle());
@@ -412,7 +431,13 @@
     }
 
-    TString title("Histogram for ");
+    // PreProcess existing fData members
+    for (int i=0; i<3; i++)
+        if (fData[i] && !fData[i]->PreProcess(plist))
+            return kFALSE;
+
+    TString title(fDimension>0?"Histogram":"Profile");
+    title += " for ";
     title += name;
-    title += Form(" (%dD)", fDimension);
+    title += Form(" (%dD)", TMath::Abs(fDimension));
 
     fHist->SetName(name);
@@ -420,5 +445,5 @@
     fHist->SetDirectory(0);
 
-    switch (fDimension)
+    switch (TMath::Abs(fDimension))
     {
     case 1:
@@ -433,5 +458,5 @@
     }
 
-    *fLog << err << "ERROR - MH3 has " << fDimension << " dimensions!" << endl;
+    *fLog << err << "ERROR - MH3 has " << TMath::Abs(fDimension) << " dimensions!" << endl;
     return kFALSE;
 }
@@ -487,9 +512,11 @@
     switch (fDimension)
     {
-    case 3:
+    case -2:
+    case  3:
         z = fData[2]->GetValue()*fScale[2];
-    case 2:
+    case -1:
+    case  2:
         y = fData[1]->GetValue()*fScale[1];
-    case 1:
+    case  1:
         x = fData[0]->GetValue()*fScale[0];
     }
@@ -497,13 +524,19 @@
     switch (fDimension)
     {
-    case 3:
-        ((TH3*)fHist)->Fill(x, y, z, w);
+    case  3:
+        static_cast<TH3*>(fHist)->Fill(x, y, z, w);
         return kTRUE;
-    case 2:
-        ((TH2*)fHist)->Fill(x, y, w);
+    case  2:
+        static_cast<TH2*>(fHist)->Fill(x, y, w);
         return kTRUE;
     case 1:
         fHist->Fill(x, w);
         return kTRUE;
+    case -1:
+        static_cast<TProfile*>(fHist)->Fill(x, y, w);
+        return kTRUE;
+    case -2:
+        static_cast<TProfile2D*>(fHist)->Fill(x, y, z, w);
+        return kTRUE;
     }
 
@@ -549,5 +582,5 @@
     TProfile *p=0;
 
-    if (fDimension==2)
+    if (TMath::Abs(fDimension)==2)
         MH::SetPalette("pretty");
 
@@ -629,9 +662,9 @@
     str.ToLower();
 
-    const Bool_t only  = str.Contains("only")  && fDimension==2;
-    const Bool_t same  = str.Contains("same")  && fDimension<3;
-    const Bool_t blue  = str.Contains("blue")  && fDimension==2;
-    const Bool_t profx = str.Contains("profx") && fDimension==2;
-    const Bool_t profy = str.Contains("profy") && fDimension==2;
+    const Bool_t only  = str.Contains("only")  && TMath::Abs(fDimension)==2;
+    const Bool_t same  = str.Contains("same")  && TMath::Abs(fDimension)<3;
+    const Bool_t blue  = str.Contains("blue")  && TMath::Abs(fDimension)==2;
+    const Bool_t profx = str.Contains("profx") && TMath::Abs(fDimension)==2;
+    const Bool_t profy = str.Contains("profy") && TMath::Abs(fDimension)==2;
 
     str.ReplaceAll("only",  "");
@@ -641,5 +674,5 @@
     str.ReplaceAll(" ", "");
 
-    if (same && fDimension==1)
+    if (same && TMath::Abs(fDimension)==1)
     {
         fHist->SetLineColor(kBlue);
@@ -702,7 +735,7 @@
     out << "   MH3 " << name << "(\"";
     out << fData[0]->GetRule() << "\"";
-    if (fDimension>1)
+    if (fDimension>1 || fDimension<0)
         out << ", \"" << fData[1]->GetRule() << "\"";
-    if (fDimension>2)
+    if (fDimension>2 || fDimension<-1)
         out << ", \"" << fData[2]->GetRule() << "\"";
 
@@ -717,7 +750,9 @@
     switch (fDimension)
     {
+    case -2:
     case 3:
         if (fScale[2]!=1)
             out << "   " << name << ".SetScaleZ(" << fScale[2] << ");" << endl;
+    case -1:
     case 2:
         if (fScale[1]!=1)
@@ -749,13 +784,21 @@
             h=new MH3(fData[0]->GetRule(), fData[1]->GetRule());
             break;
+        case -1:
+            h=new MH3(fData[0]->GetRule(), fData[1]->GetRule(), MH3::kProfile);
+            break;
         case 3:
             h=new MH3(fData[0]->GetRule(), fData[1]->GetRule(), fData[2]->GetRule());
             break;
+        case -2:
+            h=new MH3(fData[0]->GetRule(), fData[1]->GetRule(), fData[2]->GetRule(), MH3::kProfile);
+            break;
         }
     switch (fDimension)
     {
+    case -2:
     case 3:
         h->SetScaleZ(fScale[2]);
     case 2:
+    case -1:
         h->SetScaleY(fScale[1]);
     case 1:
@@ -789,5 +832,5 @@
     Int_t num = 1;
 
-    switch (fDimension)
+    switch (TMath::Abs(fDimension))
     {
     case 3:
@@ -820,8 +863,10 @@
     {
     case 3:
+    case -2:
         binz = axez.FindFixBin(z);
         if (binz>axez.GetLast() || binz<axez.GetFirst())
             return -1;
     case 2:
+    case -1:
         biny = axey.FindFixBin(y);
         if (biny>axey.GetLast() || biny<axey.GetFirst())
Index: trunk/MagicSoft/Mars/mhbase/MH3.h
===================================================================
--- trunk/MagicSoft/Mars/mhbase/MH3.h	(revision 8886)
+++ trunk/MagicSoft/Mars/mhbase/MH3.h	(revision 8888)
@@ -28,4 +28,6 @@
     Byte_t      fStyleBits;      // Set the range of a histogram automatically in Finalize
 
+//    TH1        *fHistDraw;       //!
+
     void HandleLogAxis(TAxis &axe) const;
 
@@ -39,9 +41,14 @@
 
 public:
-    MH3(const unsigned int dim=0);
+    enum Type_t {
+        kHistogram,
+        kProfile
+    };
+
+    MH3(const Int_t dim=0, Type_t type=MH3::kHistogram);
     MH3(const TH1 &h1);
     MH3(const char *memberx);
-    MH3(const char *memberx, const char *membery);
-    MH3(const char *memberx, const char *membery, const char *memberz);
+    MH3(const char *memberx, const char *membery, Type_t type=MH3::kHistogram);
+    MH3(const char *memberx, const char *membery, const char *memberz, Type_t type=MH3::kHistogram);
     ~MH3();
 
@@ -70,5 +77,5 @@
 
     // Getter
-    Int_t GetDimension() const { return fDimension; }
+    Int_t GetDimension() const { return TMath::Abs(fDimension); }
     Int_t GetNbins() const;
     Int_t FindFixBin(Double_t x, Double_t y=0, Double_t z=0) const;
Index: trunk/MagicSoft/Mars/mhbase/MHn.cc
===================================================================
--- trunk/MagicSoft/Mars/mhbase/MHn.cc	(revision 8886)
+++ trunk/MagicSoft/Mars/mhbase/MHn.cc	(revision 8888)
@@ -213,5 +213,5 @@
 //  e.g. AddHist("MHillas.fLength", "MHillas.fSize")
 //
-Bool_t MHn::AddHist(const char *memberx, const char *membery)
+Bool_t MHn::AddHist(const char *memberx, const char *membery, MH3::Type_t type)
 {
     if (fNum==8)
@@ -221,5 +221,5 @@
     }
 
-    fHist[fNum] = new MH3(memberx, membery);
+    fHist[fNum] = new MH3(memberx, membery, type);
 
     InitHist();
@@ -236,5 +236,5 @@
 //  e.g. AddHist("MHillas.fWidth", "MHillas.fLength", "MHillas.fSize")
 //
-Bool_t MHn::AddHist(const char *memberx, const char *membery, const char *memberz)
+Bool_t MHn::AddHist(const char *memberx, const char *membery, const char *memberz, MH3::Type_t type)
 {
     if (fNum==8)
@@ -244,5 +244,5 @@
     }
 
-    fHist[fNum] = new MH3(memberx, membery, memberz);
+    fHist[fNum] = new MH3(memberx, membery, memberz, type);
 
     InitHist();
Index: trunk/MagicSoft/Mars/mhbase/MHn.h
===================================================================
--- trunk/MagicSoft/Mars/mhbase/MHn.h	(revision 8886)
+++ trunk/MagicSoft/Mars/mhbase/MHn.h	(revision 8888)
@@ -2,12 +2,7 @@
 #define MARS_MHn
 
-#ifndef ROOT_TH1
-#include <TH1.h>
+#ifndef MARS_MH3
+#include "MH3.h"
 #endif
-#ifndef MARS_MH
-#include "MH.h"
-#endif
-
-class MH3;
 
 class MHn : public MH
@@ -39,6 +34,6 @@
 
     Bool_t AddHist(const char *memberx);
-    Bool_t AddHist(const char *memberx, const char *membery);
-    Bool_t AddHist(const char *memberx, const char *membery, const char *memberz);
+    Bool_t AddHist(const char *memberx, const char *membery, MH3::Type_t type=MH3::kHistogram);
+    Bool_t AddHist(const char *memberx, const char *membery, const char *memberz, MH3::Type_t type=MH3::kHistogram);
 
     void InitName(const char *n)
Index: trunk/MagicSoft/Mars/mjobs/MDataSet.h
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MDataSet.h	(revision 8886)
+++ trunk/MagicSoft/Mars/mjobs/MDataSet.h	(revision 8888)
@@ -168,5 +168,5 @@
     // TObject
     void Print(Option_t *o) const;
-    void Print() const { Print(); } //*MENU*
+    void Print() const { Print(""); } //*MENU*
 
     ClassDef(MDataSet, 2)
Index: trunk/MagicSoft/Mars/mjtrain/MJTrainDisp.cc
===================================================================
--- trunk/MagicSoft/Mars/mjtrain/MJTrainDisp.cc	(revision 8886)
+++ trunk/MagicSoft/Mars/mjtrain/MJTrainDisp.cc	(revision 8888)
@@ -493,6 +493,11 @@
     DisplayResult(hdisp1, hdisp2);
 
+    TObjArray arr;
+    arr.Add(const_cast<MDataSet*>(&set));
+    if (fDisplay)
+        arr.Add(fDisplay);
+
     SetPathOut(out);
-    return WriteDisplay(0, "UPDATE");
+    return WriteContainer(arr, 0, "UPDATE");
 }
 
Index: trunk/MagicSoft/Mars/mjtrain/MJTrainEnergy.cc
===================================================================
--- trunk/MagicSoft/Mars/mjtrain/MJTrainEnergy.cc	(revision 8886)
+++ trunk/MagicSoft/Mars/mjtrain/MJTrainEnergy.cc	(revision 8888)
@@ -191,12 +191,14 @@
 
     // -------------------------------------------------------------
-    MBinning binsS(50, 10,     100000, "BinningSize",           "log");
-    MBinning binsE(70, 10,     31623,  "BinningEnergy",         "log");
-    MBinning binsG(50,-10,     10,     "BinningSlope",          "lin");
-    MBinning binsR(50, -1,     1,      "BinningEnergyResidual", "lin");
-    MBinning binsL(50,  0,     0.3,    "BinningLeakage",        "lin");
-    MBinning binsT(51, -0.005, 0.505,  "BinningTheta",          "asin");
-    MBinning binsD(50,  0,     1.6,    "BinningDist",           "lin");
-    MBinning binsC(50,  1e-2,  1,      "BinningConc",           "log");
+    MBinning binsS(50,  10,     100000, "BinningSize",             "log");
+    MBinning binsE(70,  10,     31623,  "BinningEnergy",           "log");
+    MBinning binsF(35,  10,     31623,  "BinningEnergyEst",        "log");
+    MBinning binsG(50, -10,     10,     "BinningSlope",            "lin");
+    MBinning binsR(50,  -1,     1,      "BinningEnergyResidual",   "lin");
+    MBinning binsL(50,   0,     0.3,    "BinningLeakage",          "lin");
+    MBinning binsT(51,  -0.005, 0.505,  "BinningTheta",            "asin");
+    MBinning binsD(50,   0,     1.6,    "BinningDist",             "lin");
+    MBinning binsC(50,   1e-2,  1,      "BinningConc",             "log");
+    MBinning binsI(16,   0,     800,    "BinningImpact",           "lin");
 
     plist.AddToList(&binsG);
@@ -204,8 +206,10 @@
     plist.AddToList(&binsR);
     plist.AddToList(&binsE);
+    plist.AddToList(&binsF);
     plist.AddToList(&binsL);
     plist.AddToList(&binsT);
     plist.AddToList(&binsD);
     plist.AddToList(&binsC);
+    plist.AddToList(&binsI);
 
     MHEnergyEst hist;
@@ -252,13 +256,35 @@
     hres2.SetDrawOption("colz profx");
 
-    MFillH fillh(&hist);
+    MHn hres3("Resolution", "Energy Resolution");
+    hres3.AddHist("MEnergyEst.fVal", "(MMcEvt.fEnergy/MEnergyEst.fVal-1)^2", MH3::kProfile);
+    hres3.InitName("ResEest;EnergyEst;");
+    hres3.InitTitle(";E_{est} [GeV];Resolution (E_{mc}/E_{est}-1)^{2};");
+
+    hres3.AddHist("MHillas.fSize", "(MMcEvt.fEnergy/MEnergyEst.fVal-1)^2", MH3::kProfile);
+    hres3.InitName("ResSize;Size;");
+    hres3.InitTitle(";S [phe];Resolution (E_{mc}/E_{est}-1)^{2};");
+/*
+    hres3.AddHist("MMcEvt.fEnergy", "(MEnergyEst.fVal/MMcEvt.fEnergy-1)^2", MH3::kProfile);
+    hres3.InitName("ResEmc;EnergyEst;");
+    hres3.InitTitle(";E_{mc} [GeV];Resolution (E_{est}/E_{mc}-1)^{2};");
+  */
+    hres3.AddHist("MPointingPos.fZd", "(MMcEvt.fEnergy/MEnergyEst.fVal-1)^2", MH3::kProfile);
+    hres3.InitName("ResTheta;Theta;");
+    hres3.InitTitle(";\\Theta [\\circ];Resolution (E_{mc}/E_{est}-1)^{2};");
+    hres3.AddHist("MMcEvt.fImpact/100", "(MMcEvt.fEnergy/MEnergyEst.fVal-1)^2", MH3::kProfile);
+    hres3.InitName("ResImpact;Impact;");
+    hres3.InitTitle(";I [m];Resolution (E_{mc}/E_{est}-1)^{2};");
+
+    MFillH fillh0(&hist);
     MFillH fillh1(&hres1, "", "FillResiduals1");
     MFillH fillh2(&hres2, "", "FillResiduals2");
+    MFillH fillh3(&hres3, "", "FillResolution");
 
     if (fEnableWeights)
     {
-        fillh.SetWeight();
+        fillh0.SetWeight();
         fillh1.SetWeight();
         fillh2.SetWeight();
+        fillh3.SetWeight();
     }
 
@@ -268,7 +294,8 @@
     tlist.AddToList(&rf);
     tlist.AddToList(fPostTasks);
-    tlist.AddToList(&fillh);
+    tlist.AddToList(&fillh0);
     tlist.AddToList(&fillh1);
     tlist.AddToList(&fillh2);
+    tlist.AddToList(&fillh3);
     tlist.AddToList(fTestTasks);
 
@@ -283,8 +310,10 @@
         return kFALSE;
 
+    TObjArray arr;
+    arr.Add(const_cast<MDataSet*>(&set));
+    if (fDisplay)
+        arr.Add(fDisplay);
+
     SetPathOut(out);
-    if (!WriteDisplay(0, "UPDATE"))
-        return kFALSE;
-
-    return kTRUE;
+    return WriteContainer(arr, 0, "UPDATE");
 }
Index: trunk/MagicSoft/Mars/mjtrain/MJTrainSeparation.cc
===================================================================
--- trunk/MagicSoft/Mars/mjtrain/MJTrainSeparation.cc	(revision 8886)
+++ trunk/MagicSoft/Mars/mjtrain/MJTrainSeparation.cc	(revision 8888)
@@ -1047,9 +1047,12 @@
 
     // Write the display
+    TObjArray arr;
+    arr.Add(const_cast<MDataSet*>(&fDataSetTrain));
+    arr.Add(const_cast<MDataSet*>(&fDataSetTest));
+    if (fDisplay)
+        arr.Add(fDisplay);
+
     SetPathOut(out);
-    if (!WriteDisplay(0, "UPDATE"))
-        return kFALSE;
-
-    return kTRUE;
+    return WriteContainer(arr, 0, "UPDATE");
 }
 
Index: trunk/MagicSoft/Mars/mpedestal/MPedestalSubtract.cc
===================================================================
--- trunk/MagicSoft/Mars/mpedestal/MPedestalSubtract.cc	(revision 8886)
+++ trunk/MagicSoft/Mars/mpedestal/MPedestalSubtract.cc	(revision 8888)
@@ -1,4 +1,4 @@
 /* ======================================================================== *\
-! $Name: not supported by cvs2svn $:$Id: MPedestalSubtract.cc,v 1.9 2007-12-19 18:53:03 tbretz Exp $
+! $Name: not supported by cvs2svn $:$Id: MPedestalSubtract.cc,v 1.10 2008-05-14 11:03:24 tbretz Exp $
 ! --------------------------------------------------------------------------
 !
@@ -20,5 +20,5 @@
 !   Author(s): Thomas Bretz, 10/2006 <mailto:tbretz@astro.uni-wuerzburg.de>
 !
-!   Copyright: MAGIC Software Development, 2000-2006
+!   Copyright: MAGIC Software Development, 2000-2008
 !
 !
@@ -51,4 +51,5 @@
 #include "MArrayB.h"
 
+#include "MRawRunHeader.h"
 #include "MRawEvtData.h"
 #include "MRawEvtPixelIter.h"
@@ -141,4 +142,15 @@
 }
 
+Bool_t MPedestalSubtract::ReInit(MParList *pList)
+{
+    fRunHeader = (MRawRunHeader*)pList->FindObject(AddSerialNumber("MRawRunHeader"));
+    if (!fRunHeader)
+    {
+        *fLog << err << AddSerialNumber("MRawRunHeader") << " not found... aborting." << endl;
+        return kFALSE;
+    }
+    return kTRUE;
+}
+
 // --------------------------------------------------------------------------
 //
@@ -150,4 +162,21 @@
     const Int_t numl = fRawEvt->GetNumLoGainSamples();
 
+    // Check if event is empty (presumably MC event -- sanity check)
+    if (numh+numl==0)
+        return kCONTINUE;
+
+    // Check for consistency (our simulation can do weird things!)
+    if (numh!=fRunHeader->GetNumSamplesHiGain())
+    {
+        *fLog << warn << "WARNING - Number of hi-gain samples (" << numh << ") ";
+        *fLog << " doesn't match run-header (" << fRunHeader->GetNumSamplesHiGain() << ")." << endl;
+    }
+    if (numl!=fRunHeader->GetNumSamplesLoGain())
+    {
+        *fLog << warn << "WARNING - Number of lo-gain samples (" << numl << ") ";
+        *fLog << " doesn't match run-header (" << fRunHeader->GetNumSamplesLoGain() << ")." << endl;
+    }
+
+    // Get scale between FADC units and 256 ;-)
     const UInt_t scale = fRawEvt->GetScale();
 
Index: trunk/MagicSoft/Mars/mpedestal/MPedestalSubtract.h
===================================================================
--- trunk/MagicSoft/Mars/mpedestal/MPedestalSubtract.h	(revision 8886)
+++ trunk/MagicSoft/Mars/mpedestal/MPedestalSubtract.h	(revision 8888)
@@ -6,4 +6,5 @@
 #endif
 
+class MRawRunHeader;
 class MRawEvtData;
 class MPedestalCam;
@@ -16,4 +17,5 @@
     static const TString fgNamePedestalSubtractedEvt;  //! "MPedestalSubtractedEvt"
 
+    MRawRunHeader          *fRunHeader;      //! Run Header
     MRawEvtData            *fRawEvt;         //! Input Raw data
     MPedestalCam           *fPedestals;      //! Pedestals of all pixels in the camera
@@ -24,4 +26,5 @@
 
     Int_t  PreProcess(MParList *pList);
+    Bool_t ReInit(MParList *pList);
     Int_t  Process();
 
Index: trunk/MagicSoft/Mars/mpointing/MPointingDevCalc.cc
===================================================================
--- trunk/MagicSoft/Mars/mpointing/MPointingDevCalc.cc	(revision 8886)
+++ trunk/MagicSoft/Mars/mpointing/MPointingDevCalc.cc	(revision 8888)
@@ -158,4 +158,5 @@
 //   17. Jun. 2007   ~248193
 //   18. Oct. 2007   ~291039(?)
+//   14. Jan. 2008
 //
 // From 2.2.2006 beginnig of the night (21:05h, run >=81855) to 24.2.2006
