Index: /trunk/MagicSoft/Mars/Changelog
===================================================================
--- /trunk/MagicSoft/Mars/Changelog	(revision 4647)
+++ /trunk/MagicSoft/Mars/Changelog	(revision 4648)
@@ -59,8 +59,26 @@
        leak which resulted in huge memory usage when reading
        MRawEvtData
+     - changed version number from 4 to 5
+     - changed size of fABFlag array to a more reasonable size
+       (maxid/8+1)
+
+   * mraw/MRawEvtHeader.[h,cc]:
+     - implemeted Getter for calibration pattern
 
    * mhbase/MHMatrix.[h,cc], mranforest/MRanTree.cc,
      mtools/MHSimmulatedAnnealing.h, mtools/MSimmulatedAnnealing.h:
      - changed to compile with root-4.00/08
+
+   * mpedestal/MPedCalcFromLoGain.[h,cc]:
+     - changed SetDumpEvents to SetNumEventsDump to fit roots naming
+       convention
+     - fixed crashes in case nothing has beendone
+     - do not process abflag if it is not existing
+     - for the moment do no call to ReCalc in Process
+     - added some const-qualifiers
+
+   * mhist/MHCamera.h:
+     - changed the definition of FetMinimum/GetMaximum such that
+       it compiles with root 4.00/08
 
 
Index: /trunk/MagicSoft/Mars/mhist/MHCamera.h
===================================================================
--- /trunk/MagicSoft/Mars/mhist/MHCamera.h	(revision 4647)
+++ /trunk/MagicSoft/Mars/mhist/MHCamera.h	(revision 4648)
@@ -167,6 +167,6 @@
     Double_t GetMaximum(Bool_t all) const { return GetMaximumSectors(TArrayI(), TArrayI(), all); }
 
-    Double_t GetMinimum() const { return GetMinimumSectors(TArrayI(), TArrayI(), kFALSE); }
-    Double_t GetMaximum() const { return GetMaximumSectors(TArrayI(), TArrayI(), kFALSE); }
+    Double_t GetMinimum(Double_t gt=0) const { return GetMinimumSectors(TArrayI(), TArrayI(), kFALSE); } // FIXME: To be done: Minimum greater than
+    Double_t GetMaximum(Double_t lt=0) const { return GetMaximumSectors(TArrayI(), TArrayI(), kFALSE); } // FIXME: To be done: Maximum lower than
 
     Double_t GetMinimumSector(Int_t sector, Int_t aidx, Bool_t all=kFALSE) const
Index: /trunk/MagicSoft/Mars/mpedestal/MPedCalcFromLoGain.cc
===================================================================
--- /trunk/MagicSoft/Mars/mpedestal/MPedCalcFromLoGain.cc	(revision 4647)
+++ /trunk/MagicSoft/Mars/mpedestal/MPedCalcFromLoGain.cc	(revision 4648)
@@ -357,4 +357,10 @@
         return kFALSE;
 
+    if (fNumEventsDump<=0 && fPedestalUpdate)
+    {
+        *fLog << warn << "Pedestal Update switched on and Number of Events to dump <= 0... fNumEventsDump=1000" << endl;
+        fNumEventsDump=1000;
+    }
+
     return kTRUE;
 }
@@ -518,13 +524,15 @@
         // Calculate the amplitude of the 150MHz "AB" noise
 
-        Int_t abFlag = (fRunHeader->GetNumSamplesHiGain()
-                        + fLoGainFirst
-                        + pixel.HasABFlag()) & 0x1;
-        for (Int_t islice=0; islice<fWindowSizeLoGain; islice+=2)
+        if (pixel.IsABFlagValid())
         {
-            Int_t sliceAB0 = islice + abFlag;
-            Int_t sliceAB1 = islice - abFlag + 1;
-            fSumAB0[idx] += firstSlice[sliceAB0];
-            fSumAB1[idx] += firstSlice[sliceAB1];
+            const Int_t abFlag = (fRunHeader->GetNumSamplesHiGain()
+                                  + fLoGainFirst + pixel.HasABFlag()) & 0x1;
+            for (Int_t islice=0; islice<fWindowSizeLoGain; islice+=2)
+            {
+                const Int_t sliceAB0 = islice + abFlag;
+                const Int_t sliceAB1 = islice - abFlag + 1;
+                fSumAB0[idx] += firstSlice[sliceAB0];
+                fSumAB1[idx] += firstSlice[sliceAB1];
+            }
         }
 
@@ -543,5 +551,5 @@
     if (fPedestalUpdate)
     {
-        fPedestals->ReCalc(*fGeom);
+        //fPedestals->ReCalc(*fGeom);
         fPedestals->SetReadyToSave();
     }
@@ -606,5 +614,5 @@
     if (IsEnvDefined(env, prefix, "NumEventsDump", print))
     {
-        SetDumpEvents(GetEnvValue(env, prefix, "NumEventsDump", fNumEventsDump));
+        SetNumEventsDump(GetEnvValue(env, prefix, "NumEventsDump", fNumEventsDump));
         rc = kTRUE;
     }
Index: /trunk/MagicSoft/Mars/mpedestal/MPedCalcFromLoGain.h
===================================================================
--- /trunk/MagicSoft/Mars/mpedestal/MPedCalcFromLoGain.h	(revision 4647)
+++ /trunk/MagicSoft/Mars/mpedestal/MPedCalcFromLoGain.h	(revision 4648)
@@ -65,5 +65,5 @@
     void SetWindowSize(Byte_t windowh=fgHiGainWindowSize, Byte_t windowl=fgLoGainWindowSize);
     void SetMaxHiGainVar(Byte_t maxvar=fgMaxHiGainVar);
-    void SetDumpEvents(UInt_t dumpevents = 0) {fNumEventsDump = dumpevents;}
+    void SetNumEventsDump(UInt_t dumpevents = 0) { fNumEventsDump = dumpevents; }
     void SetPedestalUpdate(Bool_t pedupdate)  {fPedestalUpdate = pedupdate;}
 
Index: /trunk/MagicSoft/Mars/mraw/MRawEvtData.cc
===================================================================
--- /trunk/MagicSoft/Mars/mraw/MRawEvtData.cc	(revision 4647)
+++ /trunk/MagicSoft/Mars/mraw/MRawEvtData.cc	(revision 4648)
@@ -47,6 +47,14 @@
 //
 //
-//   Version 3:
-//   ----------
+//   Version 5 (0.8.5):
+//   ------------------
+//    - Changed type of ABFlags from TArrayC to MArrayB
+//
+//   Version 4 (0.8.4):
+//   ------------------
+//    - Changed derivement from MCamEvent to MParContainer and MCamEvent
+//
+//   Version 3 (0.8.4):
+//   ------------------
 //    - Added fABFlags
 //
@@ -397,5 +405,4 @@
     if (flag && fRunHeader)
     {
-        //const int npix = fRunHeader->GetNumCrates()*fRunHeader->GetNumPixInCrate();
         const int npix = fRunHeader->GetNumConnectedPixels();
 
@@ -404,5 +411,5 @@
         fHiGainFadcSamples = new MArrayB(npix*fRunHeader->GetNumSamplesHiGain());
         fLoGainFadcSamples = new MArrayB(npix*fRunHeader->GetNumSamplesLoGain());
-        fABFlags           = new TArrayC(fRunHeader->GetMaxPixId());
+        fABFlags           = new MArrayB(fRunHeader->GetMaxPixId()/8+1);
 
         fArraySize  = npix;
@@ -414,5 +421,5 @@
         fHiGainFadcSamples = new MArrayB(0);
         fLoGainFadcSamples = new MArrayB(0);
-        fABFlags           = new TArrayC(0);
+        fABFlags           = new MArrayB(0);
 
         fArraySize = 0;
@@ -495,10 +502,13 @@
         const UShort_t ipos = npos+i;
 
+        // Get Hardware Id
+        const Short_t hwid = fRunHeader->GetPixAssignment(ipos);
+
+        // Check whether the pixel is connected or not
+        if (hwid<=0)
+            continue;
+
         // -1 converts the hardware pixel Id into the software pixel index
-        const Int_t npix = (Int_t)fRunHeader->GetPixAssignment(ipos)-1;
-
-        // Check whether the pixel is connected or not
-        if (npix<0)
-            continue;
+        const Int_t npix = /*hwid>0 ?*/ (Int_t)hwid-1 /*: hwid*/;
 
         //
Index: /trunk/MagicSoft/Mars/mraw/MRawEvtData.h
===================================================================
--- /trunk/MagicSoft/Mars/mraw/MRawEvtData.h	(revision 4647)
+++ /trunk/MagicSoft/Mars/mraw/MRawEvtData.h	(revision 4648)
@@ -35,5 +35,5 @@
     MArrayB *fLoGainFadcSamples;  //-> list of lo gain samples of all pixels (ordering: see fLoGainPixId)
 
-    TArrayC *fABFlags;            //-> A information about the exact trigger position
+    MArrayB *fABFlags;            //-> A information about the exact trigger position
 
     Int_t fPosInArray;        //!
@@ -89,5 +89,5 @@
         ;
 
-    ClassDef(MRawEvtData, 4) //Container to store the raw Event Data
+    ClassDef(MRawEvtData, 5) //Container to store the raw Event Data
 };
 
Index: /trunk/MagicSoft/Mars/mraw/MRawEvtHeader.cc
===================================================================
--- /trunk/MagicSoft/Mars/mraw/MRawEvtHeader.cc	(revision 4647)
+++ /trunk/MagicSoft/Mars/mraw/MRawEvtHeader.cc	(revision 4648)
@@ -399,4 +399,9 @@
 }
 
+UInt_t MRawEvtHeader::GetCalibrationPattern() const
+{
+    return fTrigPattern[1];
+}
+/*
 // --------------------------------------------------------------------------
 //
@@ -425,2 +430,3 @@
     return (CalibCol_t)((fTrigPattern[1]<<24)&0xf);
 }
+*/
Index: /trunk/MagicSoft/Mars/mraw/MRawEvtHeader.h
===================================================================
--- /trunk/MagicSoft/Mars/mraw/MRawEvtHeader.h	(revision 4647)
+++ /trunk/MagicSoft/Mars/mraw/MRawEvtHeader.h	(revision 4648)
@@ -25,5 +25,5 @@
         kTTCalibration = 2
     };
-
+/*
     enum CalibCol_t {
         kColRed   = BIT(0),
@@ -33,5 +33,5 @@
         kColUV    = BIT(4)
     };
-
+ */
 private:
     MTime   *fTime;            //! object to store the time in (ReadEvt)
@@ -74,9 +74,10 @@
     
     UInt_t     GetTriggerID() const;
-
+    UInt_t     GetCalibrationPattern() const;
+/*
     UShort_t   GetPulserSlotPattern() const;
     Byte_t     GetPowerOfContLight() const;
     CalibCol_t GetContLedColor() const;
-
+ */
     Int_t ReadEvt(istream& fin, UShort_t ver);
     void  SkipEvt(istream& fin, UShort_t ver);
