Index: /trunk/MagicSoft/Mars/Changelog
===================================================================
--- /trunk/MagicSoft/Mars/Changelog	(revision 9156)
+++ /trunk/MagicSoft/Mars/Changelog	(revision 9157)
@@ -33,4 +33,43 @@
      - added new member function SetMoonPeriod
      - added new member function SetMagicPeriodStart
+
+   * callisto.rc, callisto_Dec04Jan05.rc, callisto_MarApr05.rc,
+     callisto_mux.rc:
+     - adapted number of max events for extraction of
+       pedestals from data runs and set the number of events
+       used for pedestal extraction instead.
+
+   * callisto_mux.rc:
+     - adapted valued for pulse position dtermination to fit better
+       the MUX data (especially get rid of a bias towards higher
+       values from saturating pixels)
+
+   * mhcalib/MHCalibrationPulseTimeCam.[h,cc]:
+     - added member function GetNumEvents
+     - changed number of required pixels to 3
+     - made sure that the number of required pixels is correctly 
+       applied
+
+   * mjobs/MJPedestal.[h,cc]:
+     - added new data members to better describe the number of required
+       and aimed events for pulse position and pedestal extraction
+     - changed the filters for the pedestal and pulse position
+       in a way that not more than the requested events will be
+       extracted
+     - added a MContinue which will stop the lop if the pedestal and
+       pulse position extraction has been finished
+     - added more precise checks after the loop to check if enough events
+       were found
+
+   * mpedestal/MExtractPedestal.[h,cc]:
+     - set fCounter already in Process
+
+   * mpedestal/MExtractPedestal.[h,cc], mpedestal/MPedCalcPedRun.[h,cc],
+     mpedestal/MPedCalcFromLoGain.[h,cc]:
+     - changed type of Calc from Int_t to void
+
+   * mbase/MContinue.[h,cc]:
+     - allow to use MContinue also to return something else in Process()
+       than just kCONTNUE
 
 
Index: /trunk/MagicSoft/Mars/NEWS
===================================================================
--- /trunk/MagicSoft/Mars/NEWS	(revision 9156)
+++ /trunk/MagicSoft/Mars/NEWS	(revision 9157)
@@ -2,4 +2,13 @@
 
 == <cvs> ==
+
+ ;SUGGESTION
+
+   * This release doesn't contain a major changed which is expected to
+     change your result. Nevertheless there are small changes to
+     the calibration which can effect at least the first few hundred
+     events in any (mainly MUX and even more SUM) sequence a little bit.
+     So it is recommended although not necessary to reset your sequences
+     in the database before  further processing.
 
  ;general
@@ -44,4 +53,10 @@
      quite weak. Now sum events pass the calculation if and only if they
      have also a level 1 trigger.
+
+   * the extraction of pedestal events and pulse position from the
+     first data events is now more automatic and makes sure that 
+     a more precise number of events is extracted independent of
+     the ratio with which pedestal events or events with signals
+     are contained in the data.
 
  ;ganymed
Index: /trunk/MagicSoft/Mars/callisto.rc
===================================================================
--- /trunk/MagicSoft/Mars/callisto.rc	(revision 9156)
+++ /trunk/MagicSoft/Mars/callisto.rc	(revision 9157)
@@ -278,7 +278,12 @@
 #MJPedestalY2.MinEvents: 50
 #MJPedestalY3.MinEvents: 50
-MJPedestalY1.MaxEvents: 500
-MJPedestalY2.MaxEvents: 5000
-MJPedestalY3.MaxEvents: 500
+
+MJPedestalY1.MaxEvents:   1000
+MJPedestalY2.MaxEvents:  10000
+MJPedestalY3.MaxEvents:   1000
+
+MJPedestalY1.MaxPedestals: 500
+MJPedestalY2.MaxPedestals: 500
+MJPedestalY3.MaxPedestals: 500
 
 # -------------------------------------------------------------------------
@@ -304,5 +309,5 @@
 #MJPedestalY2.MHCalibrationPulseTimeCam.SaturationLimit:  245
 #MJPedestalY2.MHCalibrationPulseTimeCam.LowerSignalLimit:  85
-#MJPedestalY2.MHCalibrationPulseTimeCam.NumPixelsRequired:  2
+#MJPedestalY2.MHCalibrationPulseTimeCam.NumPixelsRequired:  3
 #MJPedestalY2.PixelCheck: no
 
Index: /trunk/MagicSoft/Mars/callisto_Dec04Jan05.rc
===================================================================
--- /trunk/MagicSoft/Mars/callisto_Dec04Jan05.rc	(revision 9156)
+++ /trunk/MagicSoft/Mars/callisto_Dec04Jan05.rc	(revision 9157)
@@ -307,7 +307,12 @@
 #MJPedestalY2.MinEvents: 50
 #MJPedestalY3.MinEvents: 50
-MJPedestalY1.MaxEvents: 500
-MJPedestalY2.MaxEvents: 5000
-MJPedestalY3.MaxEvents: 500
+
+MJPedestalY1.MaxEvents:   1000
+MJPedestalY2.MaxEvents:  10000
+MJPedestalY3.MaxEvents:   1000
+
+MJPedestalY1.MaxPedestals: 500
+MJPedestalY2.MaxPedestals: 500
+MJPedestalY3.MaxPedestals: 500
 
 # -------------------------------------------------------------------------
Index: /trunk/MagicSoft/Mars/callisto_MarApr05.rc
===================================================================
--- /trunk/MagicSoft/Mars/callisto_MarApr05.rc	(revision 9156)
+++ /trunk/MagicSoft/Mars/callisto_MarApr05.rc	(revision 9157)
@@ -315,7 +315,12 @@
 #MJPedestalY2.UseData: Yes
 #MJPedestalY3.UseData: Yes
-MJPedestalY1.MaxEvents: 500
-MJPedestalY2.MaxEvents: 5000
-MJPedestalY3.MaxEvents: 500
+
+MJPedestalY1.MaxEvents:   1000
+MJPedestalY2.MaxEvents:  10000
+MJPedestalY3.MaxEvents:   1000
+
+MJPedestalY1.MaxPedestals: 500
+MJPedestalY2.MaxPedestals: 500
+MJPedestalY3.MaxPedestals: 500
 
 # -------------------------------------------------------------------------
Index: /trunk/MagicSoft/Mars/callisto_mux.rc
===================================================================
--- /trunk/MagicSoft/Mars/callisto_mux.rc	(revision 9156)
+++ /trunk/MagicSoft/Mars/callisto_mux.rc	(revision 9157)
@@ -303,7 +303,12 @@
 #MJPedestalY2.MinEvents: 50
 #MJPedestalY3.MinEvents: 50
-MJPedestalY1.MaxEvents:  3500
-MJPedestalY2.MaxEvents: 30000
-MJPedestalY3.MaxEvents:  3500
+
+MJPedestalY1.MaxEvents:  50000
+MJPedestalY2.MaxEvents: 100000
+MJPedestalY3.MaxEvents:  50000
+
+MJPedestalY1.MaxPedestals: 500
+MJPedestalY2.MaxPedestals: 500
+MJPedestalY3.MaxPedestals: 500
 
 # -------------------------------------------------------------------------
@@ -326,7 +331,7 @@
 # Define the Pulse Position check parameters:
 # -------------------------------------------------------------------------
-#MJPedestalY2.MHCalibrationPulseTimeCam.SaturationLimit:  245
-#MJPedestalY2.MHCalibrationPulseTimeCam.LowerSignalLimit:  85
-#MJPedestalY2.MHCalibrationPulseTimeCam.NumPixelsRequired:  2
+MJPedestalY2.MHCalibrationPulseTimeCam.SaturationLimit:  200
+MJPedestalY2.MHCalibrationPulseTimeCam.LowerSignalLimit:  35
+#MJPedestalY2.MHCalibrationPulseTimeCam.NumPixelsRequired:  3
 #MJPedestalY2.PixelCheck: no
 
Index: /trunk/MagicSoft/Mars/mbase/MContinue.cc
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MContinue.cc	(revision 9156)
+++ /trunk/MagicSoft/Mars/mbase/MContinue.cc	(revision 9157)
@@ -73,5 +73,5 @@
 //
 MContinue::MContinue(const TString rule, const char *name, const char *title)
-    : fTaskList(0)
+    : fTaskList(0), fRc(kCONTINUE)
 {
     fName  = name  ? name  : "MContinue";
@@ -96,5 +96,5 @@
 //
 MContinue::MContinue(MFilter *f, const char *name, const char *title)
-    : fTaskList(0)
+    : fTaskList(0), fRc(kCONTINUE)
 {
     fName  = name  ? name  : "MContinue";
Index: /trunk/MagicSoft/Mars/mbase/MContinue.h
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MContinue.h	(revision 9156)
+++ /trunk/MagicSoft/Mars/mbase/MContinue.h	(revision 9157)
@@ -25,7 +25,9 @@
     MTaskList *fTaskList;  //! pointer to the present tasklist
 
+    Int_t fRc;
+
     // MTask
     Int_t  PreProcess(MParList *list);
-    Int_t  Process() { return kCONTINUE; }
+    Int_t  Process() { return fRc; }
     Int_t  PostProcess();
 
@@ -45,4 +47,6 @@
     Bool_t IsInverted() const;
 
+    void SetRc(Int_t rc) { fRc = rc; }
+
     // MParContainer
     void SetDisplay(MStatusDisplay *d);
Index: /trunk/MagicSoft/Mars/mfbase/MFilterList.h
===================================================================
--- /trunk/MagicSoft/Mars/mfbase/MFilterList.h	(revision 9156)
+++ /trunk/MagicSoft/Mars/mfbase/MFilterList.h	(revision 9157)
@@ -55,4 +55,6 @@
     TString GetDataMember() const;
 
+    Int_t GetNumEntries() const { return fFilters.GetEntries(); }
+
     Bool_t ReInit(MParList *plist);
     Int_t  PreProcess(MParList *pList);
Index: /trunk/MagicSoft/Mars/mhcalib/MHCalibrationPulseTimeCam.cc
===================================================================
--- /trunk/MagicSoft/Mars/mhcalib/MHCalibrationPulseTimeCam.cc	(revision 9156)
+++ /trunk/MagicSoft/Mars/mhcalib/MHCalibrationPulseTimeCam.cc	(revision 9157)
@@ -1,4 +1,4 @@
 /* ======================================================================== *\
-! $Name: not supported by cvs2svn $:$Id: MHCalibrationPulseTimeCam.cc,v 1.42 2008-05-15 18:37:26 tbretz Exp $
+! $Name: not supported by cvs2svn $:$Id: MHCalibrationPulseTimeCam.cc,v 1.43 2008-11-12 15:55:32 tbretz Exp $
 ! --------------------------------------------------------------------------
 !
@@ -143,5 +143,5 @@
 const UInt_t  MHCalibrationPulseTimeCam::fgSaturationLimit   = 245;
 const UInt_t  MHCalibrationPulseTimeCam::fgLowerSignalLimit  =  85;
-const Int_t   MHCalibrationPulseTimeCam::fgNumPixelsRequired = 2;
+const Int_t   MHCalibrationPulseTimeCam::fgNumPixelsRequired =   3;
 const Int_t   MHCalibrationPulseTimeCam::fgHiGainNbins =  20;
 const Axis_t  MHCalibrationPulseTimeCam::fgHiGainFirst =  -0.5;
@@ -201,4 +201,5 @@
   fOuterRefTime = 5.;
 }
+
 // --------------------------------------------------------------------------
 //
@@ -400,5 +401,4 @@
                                       fSignalCam->GetLastUsedSliceHiGain(), max);
 
-        // check if maximum is high enough
         if (max<fLowerSignalLimit)
             continue;
@@ -420,27 +420,26 @@
     for (UInt_t j=0; j<nareas; j++)
     {
-        if (fAverageAreaNum[j] > fNumPixelsRequired)
-        {
-            sumarea[j] /= fAverageAreaNum[j];
-
-            if (IsOscillations())
-                GetAverageHiGainArea(j).FillHistAndArray(sumarea[j]);
-            else
-                GetAverageHiGainArea(j).FillHist(sumarea[j]);
-
-        }
+        if (fAverageAreaNum[j]<fNumPixelsRequired)
+            continue;
+
+        sumarea[j] /= fAverageAreaNum[j];
+
+        if (IsOscillations())
+            GetAverageHiGainArea(j).FillHistAndArray(sumarea[j]);
+        else
+            GetAverageHiGainArea(j).FillHist(sumarea[j]);
     }
 
     for (UInt_t j=0; j<nsectors; j++)
     {
-        if (fAverageSectorNum[j] > 0)
-        {
-            sumsector[j] /= fAverageSectorNum[j];
-
-            if (IsOscillations())
-                GetAverageHiGainSector(j).FillHistAndArray(sumsector[j]);
-            else
-                GetAverageHiGainSector(j).FillHist(sumsector[j]);
-        }
+        if (fAverageSectorNum[j]<fNumPixelsRequired)
+            continue;
+
+        sumsector[j] /= fAverageSectorNum[j];
+
+        if (IsOscillations())
+            GetAverageHiGainSector(j).FillHistAndArray(sumsector[j]);
+        else
+            GetAverageHiGainSector(j).FillHist(sumsector[j]);
     }
 
@@ -535,4 +534,8 @@
 }
 
+Double_t MHCalibrationPulseTimeCam::GetNumEvents() const
+{
+    return GetAverageAreas()>0 ? GetAverageHiGainArea(0).GetEntries() : 0;
+}
 
 // --------------------------------------------------------------------------
Index: /trunk/MagicSoft/Mars/mhcalib/MHCalibrationPulseTimeCam.h
===================================================================
--- /trunk/MagicSoft/Mars/mhcalib/MHCalibrationPulseTimeCam.h	(revision 9156)
+++ /trunk/MagicSoft/Mars/mhcalib/MHCalibrationPulseTimeCam.h	(revision 9157)
@@ -73,4 +73,7 @@
   void SetNumPixelsRequired( const Byte_t  lim=fgNumPixelsRequired ) { fNumPixelsRequired = lim; }
 
+  Double_t GetNumEvents() const;
+
+
   Bool_t GetPixelContent ( Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0) const { return kTRUE; }
   void   DrawPixelContent( Int_t num )  const;    
Index: /trunk/MagicSoft/Mars/mhcalib/MHGausEvents.h
===================================================================
--- /trunk/MagicSoft/Mars/mhcalib/MHGausEvents.h	(revision 9156)
+++ /trunk/MagicSoft/Mars/mhcalib/MHGausEvents.h	(revision 9157)
@@ -104,4 +104,5 @@
   
   // Getters
+  const Double_t GetEntries()            const { return fHGausHist.GetEntries(); }
   const Double_t GetChiSquare()          const { return ( fFGausFit ? fFGausFit->GetChisquare() : 0.); }
   const Double_t GetExpChiSquare()       const { return ( fFExpFit  ? fFExpFit->GetChisquare()  : 0.); }
Index: /trunk/MagicSoft/Mars/mjobs/MJPedestal.cc
===================================================================
--- /trunk/MagicSoft/Mars/mjobs/MJPedestal.cc	(revision 9156)
+++ /trunk/MagicSoft/Mars/mjobs/MJPedestal.cc	(revision 9157)
@@ -77,6 +77,6 @@
 #include "MReadMarsFile.h"
 #include "MRawFileRead.h"
-#include "MRawEvtData.h"
 #include "MGeomApply.h"
+#include "MContinue.h"
 #include "MPedestalSubtract.h"
 #include "MTriggerPatternDecode.h"
@@ -85,7 +85,11 @@
 #include "MPedCalcPedRun.h"
 #include "MPedCalcFromLoGain.h"
-#include "MFTriggerPattern.h"
 #include "MBadPixelsCalc.h"
 #include "MPedestalSubtract.h"
+
+// filter
+#include "MFilterList.h"
+#include "MFTriggerPattern.h"
+#include "MFDataMember.h"
 
 // Display helpers
@@ -114,5 +118,6 @@
     : fExtractor(NULL), fDisplayType(kDisplayDataCheck),
     fExtractType(kUsePedRun), fExtractionType(kFundamental),
-    /*fIsUseHists(kFALSE),*/ fDeadPixelCheck(kFALSE), fMinEvents(50)
+    /*fIsUseHists(kFALSE),*/ fDeadPixelCheck(kFALSE), fMinEvents(50),
+    fMinPedestals(100), fMaxPedestals(0), fMinCosmics(25), fMaxCosmics(100)
 {
     fName  = name  ? name  : "MJPedestal";
@@ -682,4 +687,10 @@
     fMinEvents = (UInt_t)GetEnv("MinEvents", (Int_t)fMinEvents);
 
+    fMinPedestals = (UInt_t)GetEnv("MinPedestals", (Int_t)fMinPedestals);
+    fMaxPedestals = (UInt_t)GetEnv("MaxPedestals", (Int_t)fMaxPedestals);
+
+    fMinCosmics   = (UInt_t)GetEnv("MinCosmics", (Int_t)fMinCosmics);
+    fMaxCosmics   = (UInt_t)GetEnv("MaxCosmics", (Int_t)fMaxCosmics);
+
     if (!MJCalib::CheckEnvLocal())
         return kFALSE;
@@ -1022,18 +1033,5 @@
     }
 
-    // This will make that for data with version less than 5, where
-    // trigger patterns were not yet correct, all the events in the real
-    // data file will be processed. In any case there are no interleaved
-    // calibration events in such data, so this is fine.
-    // The selection is done with the trigger bits before prescaling
-    // Extract pulse position from Lvl1 events.
     MTriggerPatternDecode decode;
-    MFTriggerPattern fcalib("SelectCosmics");
-    fcalib.SetDefault(kTRUE);
-    fcalib.DenyAll();
-    fcalib.RequireTriggerLvl1();
-    fcalib.AllowTriggerLvl2();
-    fcalib.AllowSumTrigger();
-
     tlist.AddToList(&decode);
 
@@ -1046,9 +1044,37 @@
     tlist.AddToList(&pedsub);
 
+    // ----------------------------------------------------------------
+    //  Setup filter for pulse position extraction and its extraction
+
+    // This will make that for data with version less than 5, where
+    // trigger patterns were not yet correct, all the events in the real
+    // data file will be processed. In any case there are no interleaved
+    // calibration events in such data, so this is fine.
+    // The selection is done with the trigger bits before prescaling
+    // Extract pulse position from Lvl1 events.
+    MFTriggerPattern fcos("SelectCosmics");
+    fcos.SetDefault(kTRUE);
+    fcos.DenyAll();
+    fcos.RequireTriggerLvl1();
+    fcos.AllowTriggerLvl2();
+    fcos.AllowSumTrigger();
+
+    // Number of events filled into the histogram presenting the
+    // trigger area
+    MFDataMember filterc("MHCalibrationPulseTimeCam.GetNumEvents", '<', fMaxCosmics, "LimitNumCosmics");
+
+    // Combine both filters
+    MFilterList flistc("&&", "FilterCosmics");
+    flistc.AddToList(&fcos);
+
+    // For the case the pulse positon check is switched on
+    // compile the tasklist accordingly
     // FIXME: MUX Monte Carlos?!??
     if (fIsPulsePosCheck)
     {
-        fillpul.SetFilter(&fcalib);
-	tlist.AddToList(&fcalib);
+        flistc.AddToList(&filterc);
+        fillpul.SetFilter(&flistc);
+
+	tlist.AddToList(&flistc);
         tlist.AddToList(&fillpul);
     }
@@ -1059,11 +1085,6 @@
     //    tlist.AddToList(&fillC);
 
-    // ----------------------------------------------------------------------
-    //   Now we make sure, that in all cases the ranges are setup correctly
-    // ----------------------------------------------------------------------
-    MTaskEnv taskenv("ExtractPedestal");
-
-    //------------------------------
-    // Require that before the Prescaling we had only a pedestal trigger
+    // ------------------------------------------------------------
+    //  Setup filter for pedestal extraction
     MFTriggerPattern ftp2("SelectPedestals");
     ftp2.SetDefault(kTRUE);
@@ -1071,28 +1092,41 @@
     ftp2.RequirePedestal();
 
-    // FIXME: WHAT D WE DO IN CASE OF MUX MCs????
-    if (!fSequence.IsMonteCarlo() && (!fExtractor || !fExtractor->HasLoGain()))
-    {
-        taskenv.SetFilter(&ftp2);
-        tlist.AddToList(&ftp2);
-    }
-    //------------------------------
-
-    switch (fExtractType)
-    {
-    case kUsePedRun:
-        // In case  other than 'fundamental' second argument is obsolete
-        // pedcalc.SetExtractWindow(0,14);  // kUsePedRun (take default from class)
-        taskenv.SetDefault(&pedcalc);
-        tlist.AddToList(&taskenv);
-        break;
-
-    case kUseData:
-        // In case  other than 'fundamental' second argument is obsolete
-        // pedlogain.SetExtractWindow(15,14); // kUseData (take default from class)
-        taskenv.SetDefault(&pedlogain);
-        tlist.AddToList(&taskenv);
-        break;
-    }
+    // Limit number of events from which a pedestal is extracted
+    MFDataMember filterp(Form("%s.fNumEvents", fPedestalCamOut.GetName()), '<', fMaxPedestals, "LimitNumPedestal");
+
+    // Combine both filters together
+    MFilterList flistp("&&", "FilterPedestal");
+    // If data is not MC and has no lo-gains select pedestals from trigger pattern
+    if (!fSequence.IsMonteCarlo() && !(fExtractor && fExtractor->HasLoGain()))
+        flistp.AddToList(&ftp2);
+    if (fMaxPedestals>0)
+        flistp.AddToList(&filterp);
+
+    // ------------------------------------------------------------
+    //  Setup pedestal extraction
+    MTaskEnv taskenv("ExtractPedestal");
+
+    taskenv.SetDefault(fExtractType==kUsePedRun ?
+                       static_cast<MTask*>(&pedcalc) :
+                       static_cast<MTask*>(&pedlogain));
+
+    taskenv.SetFilter(&flistp);
+    tlist.AddToList(&flistp);
+    tlist.AddToList(&taskenv);
+
+    // ------------------------------------------------------------
+    //  Setup a filter which defines when the loop is stopped
+    MFilterList flist("||");
+    flist.SetInverted();
+    if (fMaxPedestals>0)
+        flist.AddToList(&filterp);
+    if (fIsPulsePosCheck && fMaxCosmics>0)
+        flist.AddToList(&filterc);
+
+    MContinue stop(&flist, "Stop");
+    stop.SetRc(kFALSE);
+    if (flist.GetNumEntries()>0)
+        tlist.AddToList(&stop);
+
 /*
     if (fIsUseHists && fExtractor)
@@ -1186,4 +1220,16 @@
     }
 
+    if (fIsPulsePosCheck && pulcam.GetNumEvents()<fMinCosmics)
+    {
+        *fLog << err << GetDescriptor() << ": Failed. Less than the required " << fMinCosmics << " cosmics evts processed." << endl;
+        return kFALSE;
+    }
+
+    if (fPedestalCamOut.GetNumEvents()<fMinPedestals)
+    {
+        *fLog << err << GetDescriptor() << ": Failed. Less than the required " << fMinPedestals << " pedetsl evts processed." << endl;
+        return kFALSE;
+    }
+
     if (fDeadPixelCheck)
     {
Index: /trunk/MagicSoft/Mars/mjobs/MJPedestal.h
===================================================================
--- /trunk/MagicSoft/Mars/mjobs/MJPedestal.h	(revision 9156)
+++ /trunk/MagicSoft/Mars/mjobs/MJPedestal.h	(revision 9157)
@@ -75,4 +75,8 @@
 
     UInt_t  fMinEvents;                      // Minimum number of events
+    UInt_t  fMinPedestals;                   // Minimum number of events
+    UInt_t  fMaxPedestals;                   // Maximum number of events for pedestal extraction
+    UInt_t  fMinCosmics;                     // Minimum number of events
+    UInt_t  fMaxCosmics;                     // Maximum number of events for pulse    extraction
 
     MExtractor *ReadCalibration();
Index: /trunk/MagicSoft/Mars/mjobs/MJStar.cc
===================================================================
--- /trunk/MagicSoft/Mars/mjobs/MJStar.cc	(revision 9156)
+++ /trunk/MagicSoft/Mars/mjobs/MJStar.cc	(revision 9157)
@@ -411,5 +411,6 @@
     MFillH fillsp("MHSrcPosCam", "MSrcPosCam", "FillSrcPosCam");
     fillsp.SetNameTab("Src");
-    tlist2.AddToList(&fillsp);
+    if (fSequence.IsMonteCarlo())
+        tlist2.AddToList(&fillsp);
 
 
Index: /trunk/MagicSoft/Mars/mpedestal/MExtractPedestal.cc
===================================================================
--- /trunk/MagicSoft/Mars/mpedestal/MExtractPedestal.cc	(revision 9156)
+++ /trunk/MagicSoft/Mars/mpedestal/MExtractPedestal.cc	(revision 9157)
@@ -1,4 +1,4 @@
 /* ======================================================================== *\
-! $Name: not supported by cvs2svn $:$Id: MExtractPedestal.cc,v 1.38 2007-12-19 18:53:02 tbretz Exp $
+! $Name: not supported by cvs2svn $:$Id: MExtractPedestal.cc,v 1.39 2008-11-12 16:04:18 tbretz Exp $
 ! --------------------------------------------------------------------------
 !
@@ -491,10 +491,12 @@
         fExtractor->SetNoiseCalculation(fRandomCalculation);
 
-    const Int_t rc = Calc();
+    Calc();
 
     if (fExtractor)
         fExtractor->SetNoiseCalculation(kFALSE);
 
-    return rc;
+    fPedestalsOut->SetNumEvents(fCounter);
+
+    return kTRUE;
 }
 
@@ -624,6 +626,4 @@
 Int_t MExtractPedestal::PostProcess()
 {
-    fPedestalsOut->SetNumEvents(fCounter);
-
     return fExtractor ? fExtractor->CallPostProcess() : kTRUE;
 }
Index: /trunk/MagicSoft/Mars/mpedestal/MExtractPedestal.h
===================================================================
--- /trunk/MagicSoft/Mars/mpedestal/MExtractPedestal.h	(revision 9156)
+++ /trunk/MagicSoft/Mars/mpedestal/MExtractPedestal.h	(revision 9157)
@@ -100,6 +100,6 @@
 
   // Interface to be overwritten by a new class
-  virtual void  ResetArrays();
-  virtual Int_t Calc() = 0;
+  virtual void ResetArrays();
+  virtual void Calc() = 0;
 
   // Helper functions
Index: /trunk/MagicSoft/Mars/mpedestal/MPedCalcFromLoGain.cc
===================================================================
--- /trunk/MagicSoft/Mars/mpedestal/MPedCalcFromLoGain.cc	(revision 9156)
+++ /trunk/MagicSoft/Mars/mpedestal/MPedCalcFromLoGain.cc	(revision 9157)
@@ -1,4 +1,4 @@
 /* ======================================================================== *\
-! $Name: not supported by cvs2svn $:$Id: MPedCalcFromLoGain.cc,v 1.39 2007-12-14 09:56:03 tbretz Exp $
+! $Name: not supported by cvs2svn $:$Id: MPedCalcFromLoGain.cc,v 1.40 2008-11-12 16:04:18 tbretz Exp $
 ! --------------------------------------------------------------------------
 !
@@ -199,5 +199,5 @@
 // calculate the overall mean and rms in the PostProcess()
 //
-Int_t MPedCalcFromLoGain::Calc()
+void MPedCalcFromLoGain::Calc()
 {
     const Int_t nhi = fRunHeader->GetNumSamplesHiGain();
@@ -242,6 +242,4 @@
     if (fPedestalUpdate)
         fPedestalsOut->SetReadyToSave();
-
-  return kTRUE;
 }
 
Index: /trunk/MagicSoft/Mars/mpedestal/MPedCalcFromLoGain.h
===================================================================
--- /trunk/MagicSoft/Mars/mpedestal/MPedCalcFromLoGain.h	(revision 9156)
+++ /trunk/MagicSoft/Mars/mpedestal/MPedCalcFromLoGain.h	(revision 9157)
@@ -34,5 +34,5 @@
 
     // MExtractPedestal
-    Int_t  Calc();
+    void   Calc();
 
 public:
Index: /trunk/MagicSoft/Mars/mpedestal/MPedCalcPedRun.cc
===================================================================
--- /trunk/MagicSoft/Mars/mpedestal/MPedCalcPedRun.cc	(revision 9156)
+++ /trunk/MagicSoft/Mars/mpedestal/MPedCalcPedRun.cc	(revision 9157)
@@ -1,4 +1,4 @@
 /* ======================================================================== *\
-! $Name: not supported by cvs2svn $:$Id: MPedCalcPedRun.cc,v 1.53 2008-07-14 19:59:12 tbretz Exp $
+! $Name: not supported by cvs2svn $:$Id: MPedCalcPedRun.cc,v 1.54 2008-11-12 16:04:18 tbretz Exp $
 ! --------------------------------------------------------------------------
 !
@@ -256,8 +256,8 @@
 // calculate the overall mean and rms in the PostProcess()
 //
-Int_t MPedCalcPedRun::Calc()
+void MPedCalcPedRun::Calc()
 {
     if (fIsNotPedRun && !IsPedBitSet())
-        return kTRUE;
+        return;
 
     MRawEvtPixelIter pixel(fRawEvt);
@@ -268,6 +268,4 @@
 
     fPedestalsOut->SetReadyToSave();
-
-    return kTRUE;
 }
 
Index: /trunk/MagicSoft/Mars/mpedestal/MPedCalcPedRun.h
===================================================================
--- /trunk/MagicSoft/Mars/mpedestal/MPedCalcPedRun.h	(revision 9156)
+++ /trunk/MagicSoft/Mars/mpedestal/MPedCalcPedRun.h	(revision 9157)
@@ -25,5 +25,5 @@
     Bool_t ReInit(MParList *pList);
     Int_t  PreProcess(MParList *pList);
-    Int_t  Calc();
+    void   Calc();
     Int_t  PostProcess();
 
Index: /trunk/MagicSoft/Mars/mraw/MRawRunHeader.cc
===================================================================
--- /trunk/MagicSoft/Mars/mraw/MRawRunHeader.cc	(revision 9156)
+++ /trunk/MagicSoft/Mars/mraw/MRawRunHeader.cc	(revision 9157)
@@ -823,5 +823,8 @@
         *fLog << ")" << endl;
     }
-    *fLog << "RunNumber:    " << fRunNumber << " (Type=" << GetRunTypeStr() << ")" << endl;
+    *fLog << "RunNumber:    " << fRunNumber;
+    if (fFormatVersion>10)
+        *fLog << "/" << fFileNumber << " (id=" << GetFileID() << ")";
+    *fLog << " (Type=" << GetRunTypeStr() << ")" << endl;
     *fLog << "ProjectName: '" << fProjectName << "'" << endl;
     if (fFormatVersion>5)
Index: /trunk/MagicSoft/Mars/mtrigger/MTriggerPattern.cc
===================================================================
--- /trunk/MagicSoft/Mars/mtrigger/MTriggerPattern.cc	(revision 9156)
+++ /trunk/MagicSoft/Mars/mtrigger/MTriggerPattern.cc	(revision 9157)
@@ -133,4 +133,7 @@
 #include "MTriggerPattern.h"
 
+#include "MLog.h"
+#include "MLogManip.h"
+
 ClassImp(MTriggerPattern);
 
@@ -147,2 +150,35 @@
     fTitle = title ? title : "Container for decoded trigger pattern";
 }
+
+void MTriggerPattern::Print(Option_t *) const
+{
+    *fLog << all;
+    *fLog << "Trigger Pattern (un/prescaled): ";
+
+    if (fUnprescaled&kPedestal)
+        *fLog << "P";
+    if (fUnprescaled&kCalibration)
+        *fLog << "C";
+    if (fUnprescaled&kTriggerLvl1)
+        *fLog << "1";
+    if (fUnprescaled&kTriggerLvl2)
+        *fLog << "2";
+    if (fUnprescaled&kSumTrigger)
+        *fLog << "S";
+    if (fUnprescaled&kPinDiode)
+        *fLog << "-";
+    *fLog << "/";
+    if (fPrescaled&kPedestal)
+        *fLog << "P";
+    if (fPrescaled&kCalibration)
+        *fLog << "C";
+    if (fPrescaled&kTriggerLvl1)
+        *fLog << "1";
+    if (fPrescaled&kTriggerLvl2)
+        *fLog << "2";
+    if (fPrescaled&kSumTrigger)
+        *fLog << "S";
+    if (fPrescaled&kPinDiode)
+        *fLog << "-";
+    *fLog << endl;
+}
