Index: trunk/MagicSoft/Mars/mcalib/MHCalibrationCam.cc
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MHCalibrationCam.cc	(revision 3728)
+++ trunk/MagicSoft/Mars/mcalib/MHCalibrationCam.cc	(revision 3731)
@@ -172,4 +172,14 @@
 // --------------------------------------------------------------------------
 //
+// Returns the current size of the TObjArray fAverageHiGainAreas
+// independently if the MHGausEvents is filled with values or not.
+//
+const Int_t MHCalibrationCam::GetAverageAreas() const
+{
+  return fAverageHiGainAreas->GetEntries();
+}
+
+// --------------------------------------------------------------------------
+//
 // Get i-th High Gain pixel Area (area number)
 //
@@ -204,4 +214,14 @@
 {
   return *static_cast<MHGausEvents*>(fAverageLoGainAreas->UncheckedAt(i));
+}
+
+// --------------------------------------------------------------------------
+//
+// Returns the current size of the TObjArray fAverageHiGainSectors
+// independently if the MHGausEvents is filled with values or not.
+//
+const Int_t MHCalibrationCam::GetAverageSectors() const
+{
+  return fAverageHiGainSectors->GetEntries();
 }
 
Index: trunk/MagicSoft/Mars/mcalib/MHCalibrationCam.h
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MHCalibrationCam.h	(revision 3728)
+++ trunk/MagicSoft/Mars/mcalib/MHCalibrationCam.h	(revision 3731)
@@ -44,25 +44,25 @@
 protected:
 
-  Int_t   fAverageNbins;                // Number of bins for the average histograms
-  Int_t   fPulserFrequency;             // Light pulser frequency
+  TArrayI    fAverageAreaNum;           // Number of pixels in average pixels per area
+  TArrayF    fAverageAreaRelSigma;      // Re-normalized relative sigmas in average pixels per area
+  TArrayF    fAverageAreaRelSigmaVar;   // Variance Re-normalized relative sigmas in average pixels per area
+  TArrayI    fAverageAreaSat;           // Number of saturated slices in average pixels per area
+  TArrayF    fAverageAreaSigma;         // Re-normalized sigmas in average pixels per area
+  TArrayF    fAverageAreaSigmaVar;      // Variance Re-normalized sigmas in average pixels per area
+  Int_t      fAverageNbins;             // Number of bins for the average histograms
+  TObjArray *fAverageHiGainAreas;       //-> Array of calibration pixels, one per pixel area
+  TObjArray *fAverageHiGainSectors;     //-> Array of calibration pixels, one per camera sector
+  TObjArray *fAverageLoGainAreas;       //-> Array of calibration pixels, one per pixel area
+  TObjArray *fAverageLoGainSectors;     //-> Array of calibration pixels, one per camera sector
+  TArrayI    fAverageSectorNum;         // Number of pixels in average pixels per sector 
   
+  MBadPixelsCam    *fBadPixels;         //!  Bad Pixels storage container
+  MCalibrationCam  *fCam;               //!  Calibration Cam with the results
+  MGeomCam         *fGeom;              //!  Camera geometry
+
   TObjArray *fHiGainArray;              //-> Array of calibration pixels, one per pixel
   TObjArray *fLoGainArray;              //-> Array of calibration pixels, one per pixel
-  TObjArray *fAverageHiGainAreas;       //-> Array of calibration pixels, one per pixel area
-  TObjArray *fAverageLoGainAreas;       //-> Array of calibration pixels, one per pixel area
-  TObjArray *fAverageHiGainSectors;     //-> Array of calibration pixels, one per camera sector
-  TObjArray *fAverageLoGainSectors;     //-> Array of calibration pixels, one per camera sector
 
-  MGeomCam         *fGeom;              //!  Camera geometry
-  MBadPixelsCam    *fBadPixels;         //!  Bad Pixels storage container
-  MCalibrationCam  *fCam;               //!  Calibration Cam with the results
-
-  TArrayI fAverageAreaNum;              // Number of pixels in average pixels per area
-  TArrayI fAverageAreaSat;              // Number of saturated slices in average pixels per area
-  TArrayF fAverageAreaSigma;            // Re-normalized sigmas in average pixels per area
-  TArrayF fAverageAreaSigmaVar;         // Variance Re-normalized sigmas in average pixels per area
-  TArrayF fAverageAreaRelSigma;         // Re-normalized relative sigmas in average pixels per area
-  TArrayF fAverageAreaRelSigmaVar;      // Variance Re-normalized relative sigmas in average pixels per area
-  TArrayI fAverageSectorNum;            // Number of pixels in average pixels per sector 
+  Int_t      fPulserFrequency;          // Light pulser frequency
 
   virtual Bool_t SetupHists(const MParList *pList);
@@ -72,11 +72,11 @@
   virtual void   FinalizeBadPixels();
   
-  void InitHists(MHGausEvents &hist, MBadPixelsPix &bad, const Int_t i);
-
+  void CalcAverageSigma();
+  
+  void DrawAverageSigma(Bool_t sat, Bool_t inner,
+                        Float_t sigma, Float_t sigmaerr,
+                        Float_t relsigma, Float_t relsigmaerr) const; 
+  
   void FitHiGainArrays(MCalibrationCam &calcam, MBadPixelsCam &badcam,
-                       MBadPixelsPix::UncalibratedType_t fittyp,
-                       MBadPixelsPix::UncalibratedType_t osctyp);
-  
-  void FitLoGainArrays(MCalibrationCam &calcam, MBadPixelsCam &badcam,
                        MBadPixelsPix::UncalibratedType_t fittyp,
                        MBadPixelsPix::UncalibratedType_t osctyp);
@@ -88,4 +88,8 @@
                       MBadPixelsPix::UncalibratedType_t osctyp);
   
+  void FitLoGainArrays(MCalibrationCam &calcam, MBadPixelsCam &badcam,
+                       MBadPixelsPix::UncalibratedType_t fittyp,
+                       MBadPixelsPix::UncalibratedType_t osctyp);
+  
   void FitLoGainHists(MHGausEvents &hist, 
                       MCalibrationPix &pix, 
@@ -94,35 +98,10 @@
                       MBadPixelsPix::UncalibratedType_t osctyp);
 
-  void CalcAverageSigma();
-  
-  void DrawAverageSigma(Bool_t sat, Bool_t inner,
-                        Float_t sigma, Float_t sigmaerr,
-                        Float_t relsigma, Float_t relsigmaerr) const; 
-  
+  void InitHists(MHGausEvents &hist, MBadPixelsPix &bad, const Int_t i);
+
 public:
 
   MHCalibrationCam(const char *name=NULL, const char *title=NULL);
   ~MHCalibrationCam();
-
-  void SetAverageNbins(   const Int_t bins=fgAverageNbins ) { fAverageNbins = bins; }
-  void SetPulserFrequency(const Int_t f=fgPulserFrequency) { fPulserFrequency = f; }
-  
-  MHGausEvents  &operator[](UInt_t i);
-  const MHGausEvents  &operator[](UInt_t i) const;
- 
-  MHGausEvents  &operator()(UInt_t i);
-  const MHGausEvents  &operator()(UInt_t i)  const;
- 
-  MHGausEvents  &GetAverageHiGainArea(UInt_t i);
-  const MHGausEvents   &GetAverageHiGainArea(UInt_t i)  const;
-
-  MHGausEvents  &GetAverageLoGainArea(UInt_t i);
-  const MHGausEvents   &GetAverageLoGainArea(UInt_t i)  const;
-
-  MHGausEvents  &GetAverageHiGainSector(UInt_t i);
-  const MHGausEvents   &GetAverageHiGainSector(UInt_t i)  const;
-
-  MHGausEvents  &GetAverageLoGainSector(UInt_t i);
-  const MHGausEvents   &GetAverageLoGainSector(UInt_t i)  const;
 
   virtual Bool_t SetupFill(const MParList *pList);
@@ -133,11 +112,30 @@
   // Clone
   TObject *Clone(const char *) const;
-  
+
   // Draw
-  virtual void Draw(const Option_t *opt);
+  virtual void   Draw(const Option_t *opt);
 
   virtual Bool_t GetPixelContent ( Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0) const;
   virtual void   DrawPixelContent( Int_t num )  const;    
 
+  const Int_t          GetAverageAreas       ()          const;	 
+        MHGausEvents  &GetAverageHiGainArea  (UInt_t i);
+  const MHGausEvents  &GetAverageHiGainArea  (UInt_t i)  const;
+        MHGausEvents  &GetAverageLoGainArea  (UInt_t i);
+  const MHGausEvents  &GetAverageLoGainArea  (UInt_t i)  const;
+        MHGausEvents  &GetAverageHiGainSector(UInt_t i);
+  const MHGausEvents  &GetAverageHiGainSector(UInt_t i)  const;
+        MHGausEvents  &GetAverageLoGainSector(UInt_t i);
+  const MHGausEvents  &GetAverageLoGainSector(UInt_t i)  const;
+  const Int_t          GetAverageSectors     ()          const;
+
+        MHGausEvents  &operator[]            (UInt_t i);
+  const MHGausEvents  &operator[]            (UInt_t i)  const;
+        MHGausEvents  &operator()            (UInt_t i);
+  const MHGausEvents  &operator()            (UInt_t i)  const;
+ 
+  void SetAverageNbins(   const Int_t bins=fgAverageNbins ) { fAverageNbins = bins; }
+  void SetPulserFrequency(const Int_t f=fgPulserFrequency)  { fPulserFrequency = f; }
+  
   ClassDef(MHCalibrationCam, 1)	// Base Histogram class for Calibration Camera
 };
