Index: trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc	(revision 3620)
+++ trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc	(revision 3622)
@@ -639,10 +639,11 @@
   }
 
-  FinalizeAvPedestals(*fCam->GetAverageInnerPix(), avinnerped, avinnerprms,avinnernum);
-  FinalizeAvPedestals(*fCam->GetAverageOuterPix(), avouterped, avouterprms,avouternum);  
-
-  FinalizeCharges(*fCam->GetAverageInnerPix(),*fCam->GetAverageInnerBadPix());
-  FinalizeCharges(*fCam->GetAverageOuterPix(),*fCam->GetAverageOuterBadPix());  
-
+  for (UInt_t aidx=0; aidx<fGeom->GetNumAreas(); aidx++)
+    {
+
+      FinalizeAvPedestals(fCam->GetAveragePix(aidx), avinnerped, avinnerprms,avinnernum);
+      FinalizeCharges(fCam->GetAveragePix(aidx),fCam->GetAverageBadPix(aidx));
+    }
+  
   // 
   // F-Factor calibration
Index: trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCam.cc
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCam.cc	(revision 3620)
+++ trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCam.cc	(revision 3622)
@@ -129,6 +129,6 @@
 using namespace std;
 
-const Float_t MCalibrationChargeCam::gkAverageQE                = 0.18;     
-const Float_t MCalibrationChargeCam::gkAverageQEErr             = 0.02;  
+const Float_t MCalibrationChargeCam::fgAverageQE                = 0.18;     
+const Float_t MCalibrationChargeCam::fgAverageQEErr             = 0.02;  
 const Float_t MCalibrationChargeCam::fgConvFFactorRelErrLimit   = 0.35;
 const Float_t MCalibrationChargeCam::fgPheFFactorRelErrLimit    = 5.;
@@ -150,9 +150,7 @@
     fTitle = title ? title : "Storage container for the Calibration Information in the camera";
 
-    fPixels          = new TClonesArray("MCalibrationChargePix",1);
-    fAverageInnerPix = new MCalibrationChargePix("AverageInnerPix","Container of the fit results of the camera average inner pixels");
-    fAverageOuterPix = new MCalibrationChargePix("AverageOuterPix","Container of the fit results of the camera average outer pixels");
-    fAverageInnerBadPix = new MBadPixelsPix("AverageInnerBadPix","Bad Pixel Container of the camera average inner pixels");
-    fAverageOuterBadPix = new MBadPixelsPix("AverageOuterBadPix","Bad Pixel Container of the camera average outer pixels");
+    fPixels           = new TClonesArray("MCalibrationChargePix",1);
+    fAveragePixels    = new TClonesArray("MCalibrationChargePix",1);
+    fAverageBadPixels = new TClonesArray("MBadPixelsPix",1);
 
     Clear();
@@ -177,9 +175,6 @@
   // 
   delete fPixels;
-  delete fAverageInnerPix;
-  delete fAverageOuterPix;
-  
-  delete fAverageInnerBadPix;
-  delete fAverageOuterBadPix;
+  delete fAveragePixels;
+  delete fAverageBadPixels;
   
   if (fOffsets)
@@ -202,8 +197,14 @@
 void MCalibrationChargeCam::InitSize(const UInt_t i)
 {
-  
   fPixels->ExpandCreate(i);
-
-}
+}
+
+void MCalibrationChargeCam::InitAverageSize(const UInt_t i)
+{
+  fAveragePixels->ExpandCreate(i);
+  fAverageBadPixels->ExpandCreate(i);
+}
+
+
 
 // --------------------------------------------------------------------------
@@ -219,4 +220,9 @@
 }
 
+Int_t MCalibrationChargeCam::GetAverageSize() const
+{
+  return fAveragePixels->GetEntriesFast();
+}
+
 
 // --------------------------------------------------------------------------
@@ -238,4 +244,40 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Get i-th average pixel (area number)
+//
+MCalibrationChargePix &MCalibrationChargeCam::GetAveragePix(UInt_t i)
+{
+  return *static_cast<MCalibrationChargePix*>(fAveragePixels->UncheckedAt(i));
+}
+
+// --------------------------------------------------------------------------
+//
+// Get i-th average pixel (area number)
+//
+const MCalibrationChargePix &MCalibrationChargeCam::GetAveragePix(UInt_t i) const 
+{
+  return *static_cast<MCalibrationChargePix*>(fAveragePixels->UncheckedAt(i));
+}
+
+// --------------------------------------------------------------------------
+//
+// Get i-th average pixel (area number)
+//
+MBadPixelsPix &MCalibrationChargeCam::GetAverageBadPix(UInt_t i)
+{
+  return *static_cast<MBadPixelsPix*>(fAverageBadPixels->UncheckedAt(i));
+}
+
+// --------------------------------------------------------------------------
+//
+// Get i-th average pixel (area number)
+//
+const MBadPixelsPix &MCalibrationChargeCam::GetAverageBadPix(UInt_t i) const 
+{
+  return *static_cast<MBadPixelsPix*>(fAverageBadPixels->UncheckedAt(i));
+}
+
 
 // --------------------------------------
@@ -245,11 +287,14 @@
 
   fPixels->ForEach(TObject, Clear)();
-  fAverageInnerPix->Clear();
-  fAverageOuterPix->Clear();
-
-  fAverageInnerBadPix->Clear();
-  fAverageOuterBadPix->Clear();
-
-  fNumExcludedPixels            = 0;
+
+  //
+  // another ForEach does not compile, thus have to do the loop ourselves:
+  //
+  for (Int_t i=0;i<GetAverageSize();i++)
+    {
+      fAveragePixels[i].Clear();
+      fAverageBadPixels[i].Clear();
+    }
+  
   fMeanFluxPhesInnerPixel       = 0.;
   fMeanFluxPhesInnerPixelVar    = 0.;
@@ -373,19 +418,15 @@
   *fLog << endl;
 
-  *fLog << all << "Average Inner Pix:" 
-		<< "   Ped.  Rms: "            << fAverageInnerPix->GetPedRms()        << " +- " << fAverageInnerPix->GetPedRmsErr() 
-		<< "   Mean signal: "          << fAverageInnerPix->GetMeanCharge()    << " +- " << fAverageInnerPix->GetMeanChargeErr() 
-		<< "   Sigma signal: "         << fAverageInnerPix->GetSigmaCharge()    << " +- "<< fAverageInnerPix->GetSigmaChargeErr() 
-		<< "   Reduced Sigma: "        << fAverageInnerPix->GetRSigmaCharge() 
-		<< "   Nr Phe's: "             << fAverageInnerPix->GetPheFFactorMethod() 
-		<< endl;
-  *fLog << all << "Average Outer Pix:" 
-		<< "   Ped.  Rms: "            << fAverageOuterPix->GetPedRms()        << " +- " << fAverageOuterPix->GetPedRmsErr() 
-		<< "   Mean signal: "          << fAverageOuterPix->GetMeanCharge()    << " +- " << fAverageOuterPix->GetMeanChargeErr() 
-		<< "   Sigma signal: "         << fAverageOuterPix->GetSigmaCharge()    << " +- "<< fAverageOuterPix->GetSigmaChargeErr() 
-		<< "   Reduced Sigma: "        << fAverageOuterPix->GetRSigmaCharge() 
-		<< "   Nr Phe's: "             << fAverageOuterPix->GetPheFFactorMethod() 
-		<< endl;
-
+  TIter Next5(fAveragePixels);
+  while ((pix=(MCalibrationChargePix*)Next5()))
+  {
+    *fLog << all << "Average Pix:" 
+          << "   Ped.  Rms: "            << pix->GetPedRms()        << " +- " << pix->GetPedRmsErr() 
+          << "   Mean signal: "          << pix->GetMeanCharge()    << " +- " << pix->GetMeanChargeErr() 
+          << "   Sigma signal: "         << pix->GetSigmaCharge()    << " +- "<< pix->GetSigmaChargeErr() 
+          << "   Reduced Sigma: "        << pix->GetRSigmaCharge() 
+          << "   Nr Phe's: "             << pix->GetPheFFactorMethod() 
+          << endl;
+  }
 }
 
@@ -710,9 +751,4 @@
 void MCalibrationChargeCam::DrawPixelContent(Int_t idx) const
 {
-    if (idx == -1)
-	fAverageInnerPix->DrawClone();
-    if (idx == -2)
-	fAverageOuterPix->DrawClone();
-
     (*this)[idx].DrawClone();
 }
Index: trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCam.h
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCam.h	(revision 3620)
+++ trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCam.h	(revision 3622)
@@ -22,31 +22,22 @@
 private:
   
-  static const Float_t gkAverageQE;          // The average quantum efficieny agreed on for the first analysis
-  static const Float_t gkAverageQEErr;       // The error of average quantum efficieny 
-  
-  static const Float_t fgConvFFactorRelErrLimit; // The limit for acceptance of the rel. error of the conversion factor with the FFactor method
-  static const Float_t fgPheFFactorRelErrLimit;  // The rel. limit for acceptance of a calculated number of phe's w.r.t the mean number (in sigma of the error)
+  static const Float_t fgAverageQE;              // The default for fAverageQE    (now set to: 0.18)
+  static const Float_t fgAverageQEErr;           // The default for fAverageQEErr (now set to: 0.02)
+  static const Float_t fgConvFFactorRelErrLimit; // The default for fConvFFactorRelErrLimit (now set to: 0.35)
+  static const Float_t fgPheFFactorRelErrLimit;  // The default for fPheFFactorRelErrLimit  (now set to: 5.)
   
   Float_t fAverageQE;                // The average quantum efficieny (see Class description)
   Float_t fAverageQEVar;             // The error of the average quantum efficieny (see Class description)
+  Float_t fConvFFactorRelVarLimit;   // Acceptance limit for rel. error of conversion factor (FFactor method)
+  Float_t fPheFFactorRelVarLimit;    // Acceptance limit for number of phe's w.r.t mean number (in variances)
   
-  Float_t fConvFFactorRelVarLimit;   // The limit for acceptance of the rel. error of the conversion factor with the FFactor method
-  Float_t fPheFFactorRelVarLimit;    // The rel. limit for acceptance of a calculated number of phe's w.r.t the mean number (in variances of the error).
+  TClonesArray *fPixels;             //-> Array of MCalibrationChargePix, one per pixel
+  TClonesArray *fAveragePixels;      //-> Array of MCalibrationChargePix, one per pixel area
+  TClonesArray *fAverageBadPixels;   //-> Array of MBadPixelsPix, one per pixel area
   
-  Int_t fNumPixels;
-  TClonesArray *fPixels;                         //-> Array of MCalibrationPix with fit results
-
-  MCalibrationChargePix *fAverageInnerPix;       //-> Average Pixel of all events
-  MCalibrationChargePix *fAverageOuterPix;       //-> Average Pixel of all events
+  TH1D* fOffsets;                    //! 
+  TH1D* fSlopes;                     //! 
   
-  MBadPixelsPix         *fAverageInnerBadPix;    //-> Average Pixel of all events
-  MBadPixelsPix         *fAverageOuterBadPix;    //-> Average Pixel of all events
-  
-  TH1D* fOffsets;                                //! 
-  TH1D* fSlopes;                                 //! 
-  
-  TH2D* fOffvsSlope;                             //! 
-
-  UInt_t  fNumExcludedPixels;
+  TH2D* fOffvsSlope;                 //! 
 
   Byte_t  fFlags;
@@ -71,10 +62,10 @@
   void Clear(    Option_t *o="" );
   void InitSize( const UInt_t i );
+  void InitAverageSize( const UInt_t i );
 
   // Setters   
-  void SetAverageQE(          const Float_t qe= gkAverageQE, 
-			      const Float_t err=gkAverageQEErr)         { fAverageQE    = qe;           
+  void SetAverageQE(          const Float_t qe= fgAverageQE, 
+			      const Float_t err=fgAverageQEErr)         { fAverageQE    = qe;           
 			                                                  fAverageQEVar = err*err; }
-  void SetNumPixelsExcluded(  const UInt_t n )            {  fNumExcludedPixels = n; }
   void SetConvFFactorRelErrLimit( const Float_t f=fgConvFFactorRelErrLimit ) { fConvFFactorRelVarLimit = f*f; }
   void SetPheFFactorRelErrLimit (  const Float_t f=fgPheFFactorRelErrLimit )     { fPheFFactorRelVarLimit = f*f;    }  
@@ -86,5 +77,5 @@
   // Getters
   Int_t   GetSize()               const;
-  UInt_t  GetNumPixels()          const { return fNumPixels; }
+  Int_t   GetAverageSize()        const;  
 
   Bool_t  GetConversionFactorFFactor(    Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma );
@@ -110,15 +101,9 @@
   const MCalibrationChargePix &operator[](UInt_t i) const;
 
-  MCalibrationChargePix *GetAverageInnerPix()              { return fAverageInnerPix; }
-  const MCalibrationChargePix *GetAverageInnerPix() const  { return fAverageInnerPix; }
+  MCalibrationChargePix &GetAveragePix(UInt_t i);
+  const MCalibrationChargePix &GetAveragePix(UInt_t i) const;
 
-  MCalibrationChargePix *GetAverageOuterPix()              { return fAverageOuterPix; }
-  const MCalibrationChargePix *GetAverageOuterPix() const  { return fAverageOuterPix; }
-
-  MBadPixelsPix *GetAverageInnerBadPix()              { return fAverageInnerBadPix; }
-  const MBadPixelsPix *GetAverageInnerBadPix() const  { return fAverageInnerBadPix; }
-
-  MBadPixelsPix *GetAverageOuterBadPix()              { return fAverageOuterBadPix; }
-  const MBadPixelsPix *GetAverageOuterBadPix() const  { return fAverageOuterBadPix; }
+  MBadPixelsPix &GetAverageBadPix(UInt_t i);
+  const MBadPixelsPix &GetAverageBadPix(UInt_t i) const;
 
   // Prints
Index: trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeBlindPix.cc
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeBlindPix.cc	(revision 3620)
+++ trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeBlindPix.cc	(revision 3622)
@@ -311,16 +311,36 @@
 // - MCalibrationChargeBlindPix
 //
-// Resizes:
+Bool_t MHCalibrationChargeBlindPix::ReInit(MParList *pList)
+{
+
+  fBlindPix = (MCalibrationChargeBlindPix*)pList->FindCreateObj("MCalibrationChargeBlindPix");
+  if (!fBlindPix)
+      return kFALSE;
+
+  return kTRUE;
+}
+
+// --------------------------------------------------------------------------
+//
+// Retrieves from MExtractedSignalBlindPixel:
+// - number of FADC samples
+// - extracted signal 
+// - blind Pixel ID
+//
+// Resizes (if necessary):
 // - fASinglePheFADCSlices to sum of HiGain and LoGain samples
 // - fAPedestalFADCSlices to sum of HiGain and LoGain samples
 //
-Bool_t MHCalibrationChargeBlindPix::ReInit(MParList *pList)
-{
-
-  fBlindPix = (MCalibrationChargeBlindPix*)pList->FindCreateObj("MCalibrationChargeBlindPix");
-  if (!fBlindPix)
-      return kFALSE;
-
-  Int_t samples = (Int_t)fRawEvt->GetNumHiGainSamples()+(Int_t)fRawEvt->GetNumLoGainSamples();
+// Fills the following histograms:
+// - MHGausEvents::FillHistAndArray(signal)
+//
+// Creates MRawEvtPixelIter, jumps to blind pixel ID, 
+// fills the vectors fASinglePheFADCSlices and fAPedestalFADCSlices 
+// with the full FADC slices, depending on the size of the signal w.r.t. fSinglePheCut
+//
+Bool_t MHCalibrationChargeBlindPix::Fill(const MParContainer *par, const Stat_t w)
+{
+
+  const Int_t samples = (Int_t)fRawEvt->GetNumHiGainSamples()+(Int_t)fRawEvt->GetNumLoGainSamples();
 
   if (fASinglePheFADCSlices.GetNrows() != samples)
@@ -329,25 +349,4 @@
       fAPedestalFADCSlices.ResizeTo(samples);
     }
-  
-
-  return kTRUE;
-}
-
-// --------------------------------------------------------------------------
-//
-// Retrieves from MExtractedSignalBlindPixel:
-// - number of FADC samples
-// - extracted signal 
-// - blind Pixel ID
-//
-// Fills the following histograms:
-// - MHGausEvents::FillHistAndArray(signal)
-//
-// Creates MRawEvtPixelIter, jumps to blind pixel ID, 
-// fills the vectors fASinglePheFADCSlices and fAPedestalFADCSlices 
-// with the full FADC slices, depending on the size of the signal w.r.t. fSinglePheCut
-//
-Bool_t MHCalibrationChargeBlindPix::Fill(const MParContainer *par, const Stat_t w)
-{
 
   Float_t slices = (Float_t)fSignal->GetNumFADCSamples();
Index: trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeCam.cc
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeCam.cc	(revision 3620)
+++ trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeCam.cc	(revision 3622)
@@ -13,5 +13,4 @@
 ! * in supporting documentation. It is provided "as is" without express
 ! * or implied warranty.
-
 ! *
 !
@@ -113,55 +112,13 @@
     fLoGainArray->SetOwner();
 
-    fAverageHiGainInnerPix = new MHCalibrationChargeHiGainPix("AverageHiGainInnerPix",
-							      "Average HiGain FADC sums of inner pixels");
-    fAverageLoGainInnerPix = new MHCalibrationChargeLoGainPix("AverageLoGainInnerPix",
-							      "Average LoGain FADC sums of inner pixels");
-    fAverageHiGainOuterPix = new MHCalibrationChargeHiGainPix("AverageHiGainOuterPix",
-							      "Average HiGain FADC sums of outer pixels");
-    fAverageLoGainOuterPix = new MHCalibrationChargeLoGainPix("AverageLoGainOuterPix",
-							      "Average LoGain FADC sums of outer pixels");
-
-    fAverageHiGainInnerPix->GetHGausHist()->SetTitle("Summed FADC slices average Inner pixels HiGain");
-    fAverageLoGainInnerPix->GetHGausHist()->SetTitle("Summed FADC slices average Inner pixels LoGain");
-    fAverageHiGainOuterPix->GetHGausHist()->SetTitle("Summed FADC slices average Outer pixels HiGain");
-    fAverageLoGainOuterPix->GetHGausHist()->SetTitle("Summed FADC slices average Outer pixels LoGain");
-
-    fAverageHiGainInnerPix->GetHAbsTime()->SetTitle("Absolute Arrival Time average Inner pixels HiGain");
-    fAverageLoGainInnerPix->GetHAbsTime()->SetTitle("Absolute Arrival Time average Inner pixels LoGain");
-    fAverageHiGainOuterPix->GetHAbsTime()->SetTitle("Absolute Arrival Time average Outer pixels HiGain");
-    fAverageLoGainOuterPix->GetHAbsTime()->SetTitle("Absolute Arrival Time average Outer pixels LoGain");
-
-    fAverageHiGainInnerPix->SetChargeFirst(-1000.);
-    fAverageHiGainOuterPix->SetChargeFirst(-1000.);
-
-    fAverageHiGainInnerPix->SetChargeLast(4000.);
-    fAverageLoGainInnerPix->SetChargeLast(4000.);
-    fAverageHiGainOuterPix->SetChargeLast(4000.);
-    fAverageLoGainOuterPix->SetChargeLast(4000.);
-
-    fAverageHiGainInnerPix->SetChargeNbins(4000);
-    fAverageLoGainInnerPix->SetChargeNbins(4000);
-    fAverageHiGainOuterPix->SetChargeNbins(4000);
-    fAverageLoGainOuterPix->SetChargeNbins(4000);
+    fAverageHiGainArray = new TObjArray;
+    fAverageHiGainArray->SetOwner();
+
+    fAverageLoGainArray = new TObjArray;
+    fAverageLoGainArray->SetOwner();
 
     SetNumHiGainSaturationLimit();
     SetNumLoGainSaturationLimit();
     SetPulserFrequency();
-
-    fNumInnerPixels = 0;
-    fNumOuterPixels = 0; 
-    fNumExcluded    = 0;
-
-    fAverageInnerSat            = 0;
-    fAverageOuterSat            = 0;  
-    fAverageInnerPixSigma       = 0.;
-    fAverageOuterPixSigma       = 0.;  
-    fAverageInnerPixSigmaErr    = 0.;
-    fAverageOuterPixSigmaErr    = 0.;  
-    fAverageInnerPixRelSigma    = 0.;
-    fAverageOuterPixRelSigma    = 0.;  
-    fAverageInnerPixRelSigmaErr = 0.;
-    fAverageOuterPixRelSigmaErr = 0.;  
-
 }
 
@@ -176,9 +133,6 @@
   delete fLoGainArray;
 
-  delete fAverageHiGainInnerPix;
-  delete fAverageLoGainInnerPix;
-  delete fAverageHiGainOuterPix;
-  delete fAverageLoGainOuterPix;
-
+  delete fAverageHiGainArray;
+  delete fAverageLoGainArray;
 }
 
@@ -219,6 +173,40 @@
 }
 
-
-#if 0
+// --------------------------------------------------------------------------
+//
+// Get i-th pixel (pixel number)
+//
+MHCalibrationChargeHiGainPix &MHCalibrationChargeCam::GetAverageHiGainPix(UInt_t i)
+{
+  return *static_cast<MHCalibrationChargeHiGainPix*>(fAverageHiGainArray->UncheckedAt(i));
+}
+
+// --------------------------------------------------------------------------
+//
+// Get i-th pixel (pixel number)
+//
+const MHCalibrationChargeHiGainPix &MHCalibrationChargeCam::GetAverageHiGainPix(UInt_t i) const
+{
+  return *static_cast<MHCalibrationChargeHiGainPix*>(fAverageHiGainArray->UncheckedAt(i));
+}
+
+// --------------------------------------------------------------------------
+//
+// Get i-th pixel (pixel number)
+//
+MHCalibrationChargeLoGainPix &MHCalibrationChargeCam::GetAverageLoGainPix(UInt_t i)
+{
+  return *static_cast<MHCalibrationChargeLoGainPix*>(fAverageLoGainArray->UncheckedAt(i));
+}
+
+// --------------------------------------------------------------------------
+//
+// Get i-th pixel (pixel number)
+//
+const MHCalibrationChargeLoGainPix &MHCalibrationChargeCam::GetAverageLoGainPix(UInt_t i) const
+{
+  return *static_cast<MHCalibrationChargeLoGainPix*>(fAverageLoGainArray->UncheckedAt(i));
+}
+
 // --------------------------------------------------------------------------
 //
@@ -229,53 +217,52 @@
 {
 
-    const Int_t nhi = fHiGainArray->GetSize();
-    const Int_t nlo = fLoGainArray->GetSize();
-    //
-    // FIXME, this might be done faster and more elegant, by direct copy.
-    //
-    MHCalibrationChargeCam *cam = (MHCalibrationChargeCam*)(this)->Clone("");
-//    MHCalibrationChargeCam cam;
-//    Copy(*cam);
-
-/*
-    cam->fHiGainArray->Delete();
-    cam->fLoGainArray->Delete();
-
-    cam->fHiGainArray->Expand(nhi);
-    cam->fLoGainArray->Expand(nlo);
-
-    for (int i=0; i<nhi; i++)
-    {
-        delete (*cam->fHiGainArray)[i];
-        (*cam->fHiGainArray)[i] = (*fHiGainArray)[i]->Clone();
-    }
-    for (int i=0; i<nlo; i++)
-    {
-        delete (*cam->fLoGainArray)[i];
-        (*cam->fLoGainArray)[i] = (*fLoGainArray)[i]->Clone();
-    }
-*/
-
-/*
-    delete cam->fAverageHiGainInnerPix;
-    delete cam->fAverageLoGainInnerPix;
-    delete cam->fAverageHiGainOuterPix;
-    delete cam->fAverageLoGainOuterPix;
-
-    cam->GetAverageHiGainInnerPix() = *(MHCalibrationChargeHiGainPix*)fAverageHiGainInnerPix->Clone();
-    cam->GetAverageLoGainInnerPix() = *(MHCalibrationChargeLoGainPix*)fAverageLoGainInnerPix->Clone();
-
-    cam->GetAverageHiGainOuterPix() = *(MHCalibrationChargeHiGainPix*)fAverageHiGainOuterPix->Clone();
-    cam->GetAverageLoGainOuterPix() = *(MHCalibrationChargeLoGainPix*)fAverageLoGainOuterPix->Clone();
-
-    fAverageHiGainInnerPix->Copy(cam->GetAverageHiGainInnerPix());
-    fAverageLoGainInnerPix->Copy(cam->GetAverageLoGainInnerPix());
-    fAverageHiGainOuterPix->Copy(cam->GetAverageHiGainOuterPix());
-    fAverageLoGainOuterPix->Copy(cam->GetAverageLoGainOuterPix());
-*/
-
-    return cam;
-}
-#endif
+  const Int_t nhi   = fHiGainArray->GetEntries();
+  const Int_t nlo   = fLoGainArray->GetEntries();
+  const Int_t navhi = fAverageHiGainArray->GetEntries();
+  const Int_t navlo = fAverageLoGainArray->GetEntries();
+  
+  *fLog << err << nhi << "  " << nlo << "  " << navhi << "  " << navlo << endl;
+
+  //
+  // FIXME, this might be done faster and more elegant, by direct copy.
+  //
+  MHCalibrationChargeCam *cam = new MHCalibrationChargeCam();
+
+  cam->fHiGainArray->Expand(nhi);
+  cam->fLoGainArray->Expand(nlo);
+  cam->fAverageHiGainArray->Expand(navhi);
+  cam->fAverageLoGainArray->Expand(navlo);
+
+  for (int i=0; i<nhi; i++)
+    {
+      delete (*cam->fHiGainArray)[i];
+      (*cam->fHiGainArray)[i] = (MHCalibrationChargeHiGainPix*)(*fHiGainArray)[i]->Clone();
+    }
+  for (int i=0; i<nlo; i++)
+    {
+      delete (*cam->fLoGainArray)[i];
+      (*cam->fLoGainArray)[i] = (MHCalibrationChargeLoGainPix*)(*fLoGainArray)[i]->Clone();
+    }
+  for (int i=0; i<navhi; i++)
+    {
+      delete (*cam->fAverageHiGainArray)[i];
+      (*cam->fAverageHiGainArray)[i] = (MHCalibrationChargeHiGainPix*)(*fAverageHiGainArray)[i]->Clone();
+    }
+  for (int i=0; i<navlo; i++)
+    {
+      delete (*cam->fAverageLoGainArray)[i];
+      (*cam->fAverageLoGainArray)[i] = (MHCalibrationChargeLoGainPix*)(*fAverageLoGainArray)[i]->Clone();
+    }
+
+  cam->fAverageNum            = fAverageNum;           
+  cam->fAverageSat            = fAverageSat;            
+  cam->fAveragePixSigma       = fAveragePixSigma;      
+  cam->fAveragePixSigmaErr    = fAveragePixSigmaErr;   
+  cam->fAveragePixRelSigma    = fAveragePixRelSigma;
+  cam->fAveragePixRelSigmaErr = fAveragePixRelSigmaErr;   
+
+  return cam;
+}
+
 // --------------------------------------------------------------------------
 //
@@ -303,8 +290,6 @@
   fLoGainArray->Delete();
 
-  fAverageHiGainInnerPix->Init();
-  fAverageLoGainInnerPix->Init();  
-  fAverageHiGainOuterPix->Init();
-  fAverageLoGainOuterPix->Init();  
+  fAverageHiGainArray->Delete();
+  fAverageLoGainArray->Delete();
 
   return kTRUE;
@@ -342,14 +327,14 @@
 	  //
 	  (*fHiGainArray)[i] = new MHCalibrationChargeHiGainPix;
+          MHCalibrationChargeHiGainPix &hist = (*this)[i];
 
           if ((*fBadPixels)[i].IsBad())
 	  {
 	    *fLog << warn << "Excluded pixel: " << i << " from calibration " << endl;
-	    fNumExcluded++;
-	    (*this)[i].SetExcluded();
+	    hist.SetExcluded();
 	  }
-	  (*this)[i].Init();
-	  (*this)[i].ChangeHistId(i);
-          (*this)[i].SetEventFrequency(fPulserFrequency);
+	  hist.Init();
+	  hist.ChangeHistId(i);
+          hist.SetEventFrequency(fPulserFrequency);
       }
   }
@@ -363,24 +348,86 @@
       {
 	  (*fLoGainArray)[i] = new MHCalibrationChargeLoGainPix;
+          MHCalibrationChargeLoGainPix &hist = (*this)(i);
 	  //
 	  // Pixels with non-valid behavior
 	  //
           if ((*fBadPixels)[i].IsBad())
-            (*this)(i).SetExcluded();
-
-	  (*this)(i).Init();
-	  (*this)(i).ChangeHistId(i);
-          (*this)(i).SetEventFrequency(fPulserFrequency);
+            hist.SetExcluded();
+
+	  hist.Init();
+	  hist.ChangeHistId(i);
+          hist.SetEventFrequency(fPulserFrequency);
       }
       
   }
 
-  fAverageHiGainInnerPix->SetEventFrequency(fPulserFrequency);
-  fAverageLoGainInnerPix->SetEventFrequency(fPulserFrequency);
-  fAverageHiGainOuterPix->SetEventFrequency(fPulserFrequency);
-  fAverageLoGainOuterPix->SetEventFrequency(fPulserFrequency);
-
-
-  *fLog << inf << GetDescriptor() << ": " << fNumExcluded << " excluded Pixels " << endl;
+  const Int_t nareas = fGeom->GetNumAreas();
+
+  if (fAverageHiGainArray->GetEntries()==0)
+  {
+      fAverageHiGainArray->Expand(nareas);
+
+      for (Int_t j=0; j<nareas; j++)
+      {
+	  //
+	  // Oscillating pixels
+	  //
+	  (*fAverageHiGainArray)[j] = 
+            new MHCalibrationChargeHiGainPix("AverageHiGainPix",
+                                             "Average HiGain FADC sums of pixel area idx ");
+          MHCalibrationChargeHiGainPix &hist = GetAverageHiGainPix(j);
+
+          hist.GetHGausHist()->SetTitle("Summed FADC slices average Hi Gain pixels Area Idx ");
+          hist.GetHAbsTime()->SetTitle("Absolute Arrival Time average Hi Gain pixels Area Idx ");
+          hist.SetChargeFirst(-1000.);
+          hist.SetChargeLast(4000.);
+          hist.SetChargeNbins(4000);
+	  hist.Init();
+	  hist.ChangeHistId(j);
+          hist.SetEventFrequency(fPulserFrequency);
+      }
+  }
+
+  if (fAverageLoGainArray->GetEntries()==0)
+  {
+      fAverageLoGainArray->Expand(nareas);
+  
+      for (Int_t j=0; j<nareas; j++)
+      {
+	  //
+	  // Oscillating pixels
+	  //
+	  (*fAverageLoGainArray)[j] = 
+            new MHCalibrationChargeLoGainPix("AverageLoGainPix",
+                                             "Average LoGain FADC sums of pixel area idx ");
+          MHCalibrationChargeLoGainPix &hist = GetAverageLoGainPix(j);
+
+          hist.GetHGausHist()->SetTitle("Summed FADC slices average Lo Gain pixels Area Idx ");
+          hist.GetHAbsTime()->SetTitle("Absolute Arrival Time average Lo Gain pixels Area Idx ");
+          hist.SetChargeFirst(-1000.);
+          hist.SetChargeLast(4000.);
+          hist.SetChargeNbins(4000);
+	  hist.Init();
+	  hist.ChangeHistId(j);
+          hist.SetEventFrequency(fPulserFrequency);
+      }
+  }
+
+  fAverageNum.           Set(nareas);
+  fAverageSat.           Set(nareas);           
+  fAveragePixSigma.      Set(nareas);      
+  fAveragePixSigmaErr.   Set(nareas);   
+  fAveragePixRelSigma.   Set(nareas);   
+  fAveragePixRelSigmaErr.Set(nareas);
+    
+  for (Int_t i=0; i<n; i++)
+    {
+      if ((*this)[i].IsExcluded())
+        continue;
+
+      const Int_t aidx  = (*fGeom)[i].GetAidx();
+      fAverageNum[aidx]++;
+    }
+  
   return kTRUE;
 }
@@ -398,34 +445,52 @@
     }
   
-  Int_t n       = signal->GetSize();
-  Int_t lofirst = signal->GetFirstUsedSliceLoGain();
-
-  if (fHiGainArray->GetEntries() != n)
-    {
-      *fLog << err << "ERROR - Size mismatch... abort." << endl;
-      return kFALSE;
-    }
-
-  if (fLoGainArray->GetEntries() != n)
-    {
-      *fLog << err << "ERROR - Size mismatch... abort." << endl;
-      return kFALSE;
-    }
+  const Int_t npixels = signal->GetSize();
+  const Int_t lofirst = signal->GetFirstUsedSliceLoGain();
+  const Int_t nareas  = fGeom->GetNumAreas();
+
+  if (fHiGainArray->GetEntries() != npixels)
+    {
+      *fLog << err << "ERROR - Size mismatch in number of pixels ... abort." << endl;
+      return kFALSE;
+    }
+
+  if (fLoGainArray->GetEntries() != npixels)
+    {
+      *fLog << err << "ERROR - Size mismatch in number of pixels ... abort." << endl;
+      return kFALSE;
+    }
+
+  if (fAverageHiGainArray->GetEntries() != nareas)
+    {
+      *fLog << err << "ERROR - Size mismatch in number of areas ... abort." << endl;
+      return kFALSE;
+    }
+
+  if (fAverageLoGainArray->GetEntries() != nareas)
+    {
+      *fLog << err << "ERROR - Size mismatch in number of areas ... abort." << endl;
+      return kFALSE;
+    }
+
 
   //
   // First the extracted signal
   // 
-  Float_t sumhiinnertot = 0.;
-  Float_t sumloinnertot = 0.;
-  Float_t sumhioutertot = 0.;
-  Float_t sumlooutertot = 0.;
-  Int_t   sumhiinnersat = 0;
-  Int_t   sumloinnersat = 0;
-  Int_t   sumhioutersat = 0;
-  Int_t   sumlooutersat = 0;
-
-  fNumInnerPixels = fNumOuterPixels = 0;
-
-  for (int i=0; i<n; i++)
+  Float_t sumhitot [nareas];
+  Float_t sumlotot [nareas];
+  Int_t   sumhisat [nareas];
+  Int_t   sumlosat [nareas];
+  Float_t timehitot[nareas];
+  Float_t timelotot[nareas];
+
+  for (UInt_t j=0; j<nareas; j++)
+    {
+
+      sumhitot[j]  =  sumlotot[j]  = 0.;
+      sumhisat[j]  =  sumlosat[j]  = 0;
+      timehitot[j] =  timelotot[j] = 0.;      
+    }
+  
+  for (Int_t i=0; i<npixels; i++)
     {
 
@@ -447,38 +512,11 @@
       (*this)(i).SetSaturated(satlo); 
 
-      if (fGeom->GetPixRatio(i) == 1.)
-      {
-	  sumhiinnertot += sumhi;
-	  sumloinnertot += sumlo;
-	  sumhiinnersat += sathi;
-	  sumloinnersat += satlo;
-	  fNumInnerPixels++;
-      }
-      else
-      {
-	  sumhioutertot += sumhi;
-	  sumlooutertot += sumlo;
-	  sumhioutersat += sathi;
-	  sumlooutersat += satlo;
-	  fNumOuterPixels++;
-      }
-
-    }
-
-  fAverageHiGainInnerPix->FillHistAndArray(sumhiinnertot/fNumInnerPixels); 
-  fAverageLoGainInnerPix->FillHistAndArray(sumloinnertot/fNumInnerPixels); 
-  fAverageHiGainOuterPix->FillHistAndArray(sumhioutertot/fNumOuterPixels); 
-  fAverageLoGainOuterPix->FillHistAndArray(sumlooutertot/fNumOuterPixels); 
-
-  fAverageHiGainInnerPix->SetSaturated((Float_t)sumhiinnersat/fNumInnerPixels); 
-  fAverageLoGainInnerPix->SetSaturated((Float_t)sumloinnersat/fNumInnerPixels); 
-  fAverageHiGainOuterPix->SetSaturated((Float_t)sumhioutersat/fNumOuterPixels); 
-  fAverageLoGainOuterPix->SetSaturated((Float_t)sumlooutersat/fNumOuterPixels); 
-
-  //
-  // Now the times
-  //
-  sumhiinnertot = sumloinnertot = sumhioutertot = sumlooutertot = 0.;
-  fNumInnerPixels = fNumOuterPixels = 0;
+      const Int_t aidx  = (*fGeom)[i].GetAidx();
+
+      sumhitot[aidx]  += sumhi;
+      sumlotot[aidx]  += sumlo;
+      sumhisat[aidx]  += sathi;
+      sumlosat[aidx]  += satlo;
+    }
 
   MRawEvtPixelIter pixel(fRawEvt);
@@ -487,7 +525,6 @@
       
       const UInt_t pixid = pixel.GetPixelId();
-
-      if ((*this)[pixid].IsExcluded())
-	continue;
+       if ((*this)[pixid].IsExcluded())
+         continue;
 
       const Float_t timehi = (Float_t)pixel.GetIdxMaxHiGainSample();
@@ -497,22 +534,29 @@
       (*this)(pixid).FillAbsTime(timelo);
 
-      if (fGeom->GetPixRatio(pixel.GetPixelId()) == 1.)
-      {
-	  sumhiinnertot += timehi;
-	  sumloinnertot += timelo;
-	  fNumInnerPixels++;
-      }
-      else
-      {
-	  sumhioutertot += timehi;
-	  sumlooutertot += timelo;
-	  fNumOuterPixels++;
-      }
-    }
-
-  fAverageHiGainInnerPix->FillAbsTime(sumhiinnertot/fNumInnerPixels); 
-  fAverageLoGainInnerPix->FillAbsTime(sumloinnertot/fNumInnerPixels); 
-  fAverageHiGainOuterPix->FillAbsTime(sumhioutertot/fNumOuterPixels); 
-  fAverageLoGainOuterPix->FillAbsTime(sumlooutertot/fNumOuterPixels); 
+      const Int_t aidx  = (*fGeom)[pixid].GetAidx();
+
+      timehitot[aidx] += timehi;
+      timelotot[aidx] += timelo;
+    }
+  
+
+  for (UInt_t j=0; j<nareas; j++)
+    {
+
+      const Int_t npix = fAverageNum[j];
+
+      MHCalibrationChargeHiGainPix &hipix = GetAverageHiGainPix(j);
+      MHCalibrationChargeLoGainPix &lopix = GetAverageLoGainPix(j);
+
+      hipix.FillHistAndArray(sumhitot[j]/npix);
+      lopix.FillHistAndArray(sumlotot[j]/npix);
+
+      hipix.SetSaturated((Float_t)sumhisat[j]/npix); 
+      lopix.SetSaturated((Float_t)sumlosat[j]/npix); 
+
+      hipix.FillAbsTime(timehitot[j]/npix);
+      lopix.FillAbsTime(timelotot[j]/npix);
+
+    }
 
   return kTRUE;
@@ -531,45 +575,79 @@
 Bool_t MHCalibrationChargeCam::Finalize()
 {
-    
-    for (int i=0; i<fHiGainArray->GetSize(); i++)
-    {
-     
-	MCalibrationChargePix        &pix    = (*fCam)[i];
-	MHCalibrationChargeHiGainPix &histhi = (*this)[i];
-        MBadPixelsPix                &bad    = (*fBadPixels)[i];
-
-	FinalizeHiGainHists(histhi,pix,bad);
-
-    }
-
-    for (int i=0; i<fLoGainArray->GetSize(); i++)
-    {
-     
-        if ((*this)(i).IsExcluded())
-	   continue;
-
-	MHCalibrationChargeLoGainPix &histlo = (*this)(i);
-	MCalibrationChargePix        &pix    = (*fCam)[i];
-        MBadPixelsPix                &bad    = (*fBadPixels)[i];
-
-	FinalizeLoGainHists(histlo,pix,bad);
-
-    }
-
-    FinalizeHiGainHists(*fAverageHiGainInnerPix,*fCam->GetAverageInnerPix(),*fCam->GetAverageInnerBadPix());
-    FinalizeLoGainHists(*fAverageLoGainInnerPix,*fCam->GetAverageInnerPix(),*fCam->GetAverageInnerBadPix());
-    FinalizeHiGainHists(*fAverageHiGainOuterPix,*fCam->GetAverageOuterPix(),*fCam->GetAverageOuterBadPix());
-    FinalizeLoGainHists(*fAverageLoGainOuterPix,*fCam->GetAverageOuterPix(),*fCam->GetAverageOuterBadPix());
-
-    FinalizeAveragePix(*fCam->GetAverageInnerPix(),fNumInnerPixels, 
-                       fAverageInnerPixSigma, fAverageInnerPixSigmaErr,
-                       fAverageInnerPixRelSigma, fAverageInnerPixRelSigmaErr,
-                       fAverageInnerSat);
-    FinalizeAveragePix(*fCam->GetAverageOuterPix(),fNumOuterPixels, 
-                       fAverageOuterPixSigma, fAverageOuterPixSigmaErr,
-                       fAverageOuterPixRelSigma, fAverageOuterPixRelSigmaErr,
-                       fAverageOuterSat);
-
-    return kTRUE;
+
+  for (Int_t i=0; i<fHiGainArray->GetSize(); i++)
+    {
+      
+      if ((*this)[i].IsExcluded())
+        continue;
+      
+      MHCalibrationChargeHiGainPix &histhi = (*this)[i];
+      MCalibrationChargePix        &pix    = (*fCam)[i];
+      MBadPixelsPix                &bad    = (*fBadPixels)[i];
+      
+      FinalizeHiGainHists(histhi,pix,bad);
+      
+    }
+  
+  for (Int_t i=0; i<fLoGainArray->GetSize(); i++)
+    {
+      
+      if ((*this)(i).IsExcluded())
+        continue;
+      
+      MHCalibrationChargeLoGainPix &histlo = (*this)(i);
+      MCalibrationChargePix        &pix    = (*fCam)[i];
+      MBadPixelsPix                &bad    = (*fBadPixels)[i];
+      
+      FinalizeLoGainHists(histlo,pix,bad);
+      
+    }
+  
+  for (Int_t j=0; j<fAverageHiGainArray->GetSize(); j++)
+    {
+      
+      MHCalibrationChargeHiGainPix &histhi = GetAverageHiGainPix(j);      
+      MCalibrationChargePix        &pix    = fCam->GetAveragePix(j);
+      MBadPixelsPix                &bad    = fCam->GetAverageBadPix(j);        
+      
+      FinalizeHiGainHists(histhi,pix,bad);
+    }
+  
+  for (Int_t j=0; j<fAverageLoGainArray->GetSize(); j++)
+    {
+      
+      MHCalibrationChargeLoGainPix &histlo = GetAverageLoGainPix(j);      
+      MCalibrationChargePix        &pix    = fCam->GetAveragePix(j);
+      MBadPixelsPix                &bad    = fCam->GetAverageBadPix(j);        
+      
+      FinalizeLoGainHists(histlo,pix,bad);
+    }
+  
+  for (Int_t j=0; j<fGeom->GetNumAreas();j++)
+    {
+      
+      MCalibrationChargePix &pix = fCam->GetAveragePix(j);
+
+      if (pix.IsHiGainSaturation())
+        fAverageSat[j]++;
+
+      fAveragePixSigma[j]    = pix.GetSigmaCharge    () * TMath::Sqrt((Float_t)fAverageNum[j]);
+      fAveragePixSigmaErr[j] = pix.GetSigmaChargeErr () * TMath::Sqrt((Float_t)fAverageNum[j]);
+
+      pix.SetSigmaCharge   (fAveragePixSigma[j]);
+      pix.SetSigmaChargeErr(fAveragePixSigmaErr[j]);
+
+      fAveragePixRelSigma[j]   = fAveragePixSigma[j] / pix.GetMeanCharge();
+      
+      Float_t relsigmaerr      =  fAveragePixSigmaErr[j]*fAveragePixSigmaErr[j] 
+                               / (fAveragePixSigma[j]   *fAveragePixSigma[j]   );
+      relsigmaerr              += pix.GetMeanChargeErr()*pix.GetMeanChargeErr() 
+                               / (pix.GetMeanCharge()   *pix.GetMeanCharge()   );
+      relsigmaerr              *= fAveragePixRelSigma[j];
+      fAveragePixRelSigmaErr[j] = TMath::Sqrt(relsigmaerr);
+
+    }
+
+  return kTRUE;
 }
 
@@ -588,6 +666,7 @@
     if (hist.GetSaturated() > fNumHiGainSaturationLimit*hist.GetHGausHist()->GetEntries())
     {
-	pix.SetHiGainSaturation();
-	return;
+      *fLog << warn << "Saturated Hi Gain histogram in pixel: " << pix.GetPixId() << endl;
+      pix.SetHiGainSaturation();
+      return;
     }
     
@@ -654,8 +733,9 @@
     if (hist.GetSaturated() > fNumLoGainSaturationLimit*hist.GetHGausHist()->GetEntries())
     {
-	pix.SetLoGainSaturation();
-	bad.SetUncalibrated( MBadPixelsPix::kLoGainSaturation ); 
-        bad.SetUnsuitable(    MBadPixelsPix::kUnsuitableRun    );
-	return;
+      *fLog << warn << "Saturated Lo Gain histogram in pixel: " << pix.GetPixId() << endl;
+      pix.SetLoGainSaturation();
+      bad.SetUncalibrated( MBadPixelsPix::kLoGainSaturation ); 
+      bad.SetUnsuitable(   MBadPixelsPix::kUnsuitableRun    );
+      return;
     }
 
@@ -710,28 +790,4 @@
 }    
 
-void MHCalibrationChargeCam::FinalizeAveragePix(MCalibrationChargePix &pix, Int_t npix, 
-                                                Float_t &sigma, Float_t &sigmaerr, 
-                                                Float_t &relsigma, Float_t &relsigmaerr, 
-                                                Bool_t &b)
-{
-
-  if (pix.IsHiGainSaturation())
-    b = kTRUE;
-
-  sigma    = pix.GetSigmaCharge    () * TMath::Sqrt((Float_t)npix);
-  sigmaerr = pix.GetSigmaChargeErr () * TMath::Sqrt((Float_t)npix);
-
-  relsigma     = sigma / pix.GetMeanCharge();
-
-  relsigmaerr  = sigmaerr*sigmaerr / sigma / sigma;
-  relsigmaerr += pix.GetMeanChargeErr()*pix.GetMeanChargeErr() / pix.GetMeanCharge() / pix.GetMeanCharge();
-
-  relsigmaerr *= relsigma;
-  relsigmaerr  = TMath::Sqrt(relsigmaerr);
-
-  pix.SetSigmaCharge   (sigma);
-  pix.SetSigmaChargeErr(sigmaerr);
-
-}
 
 
@@ -747,15 +803,5 @@
 void MHCalibrationChargeCam::DrawPixelContent(Int_t idx) const
 {
-
-    if (idx == -1)
-	fAverageHiGainInnerPix->DrawClone();
-    if (idx == -2)
-	fAverageHiGainOuterPix->DrawClone();
-    if (idx == -3)
-	fAverageLoGainInnerPix->DrawClone();
-    if (idx == -4)
-	fAverageLoGainOuterPix->DrawClone();
-    (*this)[idx].DrawClone();
-
+  (*this)[idx].DrawClone();
 }
 
@@ -763,45 +809,32 @@
 void MHCalibrationChargeCam::Draw(const Option_t *opt)
 {
+
+  const Int_t nareas = fAverageHiGainArray->GetEntries();
+  if (nareas == 0)
+    return;
 
   TVirtualPad *pad = gPad ? gPad : MH::MakeDefCanvas(this);  
   pad->SetBorderMode(0);
 
-  pad->Divide(2,2);
-
-  pad->cd(1);
-
-  fAverageHiGainInnerPix->Draw(opt);
-  
-  if (!fAverageInnerSat)
-    DrawAverageSigma(fAverageInnerSat, 1,
-                     fAverageInnerPixSigma, fAverageInnerPixSigmaErr,
-                     fAverageInnerPixRelSigma, fAverageInnerPixRelSigmaErr);
-
-  pad->cd(2);
-
-  fAverageLoGainInnerPix->Draw(opt);
-
-  if (fAverageInnerSat)
-    DrawAverageSigma(fAverageInnerSat, 1,
-                     fAverageInnerPixSigma, fAverageInnerPixSigmaErr,
-                     fAverageInnerPixRelSigma, fAverageInnerPixRelSigmaErr);
-
-  pad->cd(3);
-
-  fAverageHiGainOuterPix->Draw(opt);
-
-  if (!fAverageOuterSat)
-    DrawAverageSigma(fAverageOuterSat, 0,
-                     fAverageOuterPixSigma, fAverageOuterPixSigmaErr,
-                     fAverageOuterPixRelSigma, fAverageOuterPixRelSigmaErr);
-
-  pad->cd(4);
-
-  fAverageLoGainOuterPix->Draw(opt);
-
-  if (fAverageOuterSat)
-    DrawAverageSigma(fAverageOuterSat, 0,
-                     fAverageOuterPixSigma, fAverageOuterPixSigmaErr,
-                     fAverageOuterPixRelSigma, fAverageOuterPixRelSigmaErr);
+  pad->Divide(2,nareas);
+
+  for (Int_t i=0; i<nareas;i++) 
+    {
+      pad->cd(2*(i+1)-1);
+      GetAverageHiGainPix(i).Draw(opt);
+
+      if (!fAverageSat[i])
+        DrawAverageSigma(fAverageSat[i], i,
+                         fAveragePixSigma[i],    fAveragePixSigmaErr[i],
+                         fAveragePixRelSigma[i], fAveragePixRelSigmaErr[i]);
+
+      pad->cd(2*(i+1));
+      GetAverageLoGainPix(i).Draw(opt);
+      
+      if (fAverageSat[i])
+        DrawAverageSigma(fAverageSat[i], i,
+                         fAveragePixSigma[i], fAveragePixSigmaErr[i],
+                         fAveragePixRelSigma[i], fAveragePixRelSigmaErr[i]);
+    }
 }
 
@@ -821,5 +854,5 @@
       TPaveText *text = new TPaveText(sat? 0.1 : 0.35,0.7,sat ? 0.4 : 0.7,1.0);
       text->SetTextSize(0.07);
-      const TString line1 = Form("%s%s%s",inner ? "Inner" : "Outer",
+      const TString line1 = Form("%s%s%s",inner ? "Outer" : "Inner",
                                  " Pixels ", sat ? "Low Gain" : "High Gain");
       TText *txt1 = text->AddText(line1.Data());
Index: trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeCam.h
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeCam.h	(revision 3620)
+++ trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeCam.h	(revision 3622)
@@ -4,4 +4,12 @@
 #ifndef ROOT_TObjArray
 #include <TObjArray.h>
+#endif
+
+#ifndef ROOT_TArrayI
+#include <TArrayI.h>
+#endif
+
+#ifndef ROOT_TArrayF
+#include <TArrayF.h>
 #endif
 
@@ -14,4 +22,6 @@
 
 class TText;
+class TArrayI;
+class TArrayF;
 class MRawEvtData;
 class MGeomCam;
@@ -26,49 +36,32 @@
 private:
 
-  static const Float_t fgNumHiGainSaturationLimit;   // The default number of fNumHiGainSaturationLimit
-  static const Float_t fgNumLoGainSaturationLimit;   // The default number of fNumLoGainSaturationLimit
-  static const Int_t   fgPulserFrequency;            // The default pulser frequency
+  static const Float_t fgNumHiGainSaturationLimit;   // The default for fNumHiGainSaturationLimit
+  static const Float_t fgNumLoGainSaturationLimit;   // The default for fNumLoGainSaturationLimit
+  static const Int_t   fgPulserFrequency;            // The default for fPulserFrequency
   
-  Float_t fNumHiGainSaturationLimit;  // Rel. number sat. higain FADC slices upon which the pixel is called saturated
-  Float_t fNumLoGainSaturationLimit;  // Rel. number sat. logain FADC slices upon which the pixel is called saturated
-  Int_t   fPulserFrequency;           // The pulser frequency
+  Float_t fNumHiGainSaturationLimit;  // Rel. amount sat. higain FADC slices until pixel is called saturated
+  Float_t fNumLoGainSaturationLimit;  // Rel. amount sat. logain FADC slices until pixel is called saturated
+
+  Int_t   fPulserFrequency;           // Light pulser frequency
   
-  TObjArray *fHiGainArray;                              //-> Array of MHCalibrationChargePix with hists
-  TObjArray *fLoGainArray;                              //-> Array of MHCalibrationChargePix with hists
-  MHCalibrationChargeHiGainPix *fAverageHiGainInnerPix; //-> HiGain Average of all inner pixels
-  MHCalibrationChargeLoGainPix *fAverageLoGainInnerPix; //-> LoGain Average of all inner pixels
-  MHCalibrationChargeHiGainPix *fAverageHiGainOuterPix; //-> HiGain Average of all outer pixels
-  MHCalibrationChargeLoGainPix *fAverageLoGainOuterPix; //-> LoGain Average of all outer pixels
+  TObjArray *fHiGainArray;            //-> Array of MHCalibrationChargeHiGainPix, one per pixel
+  TObjArray *fLoGainArray;            //-> Array of MHCalibrationChargeLoGainPix, one per pixel
+  TObjArray *fAverageHiGainArray;     //-> Array of MHCalibrationChargeHiGainPix, one per pixel area
+  TObjArray *fAverageLoGainArray;     //-> Array of MHCalibrationChargeLoGainPix, one per pixel area
+  
+  MCalibrationChargeCam  *fCam;       //!  Calibration Cam with the results
+  MRawEvtData            *fRawEvt;    //!  Raw event data 
+  MGeomCam               *fGeom;      //!  Camera geometry
+  MBadPixelsCam          *fBadPixels; //!  Bad Pixels storage container
 
-  MCalibrationChargeCam  *fCam;                         //!  Cam holding the results
-  MRawEvtData            *fRawEvt;                      //!  Raw event data (time slices)
-  MGeomCam               *fGeom;                        //!  MAGIC geometry
-  MBadPixelsCam          *fBadPixels;                   //!  Bad Pixels
-
-  Int_t fNumInnerPixels;
-  Int_t fNumOuterPixels;
-  Int_t fNumExcluded;
-
-  Bool_t  fAverageInnerSat;
-  Bool_t  fAverageOuterSat;  
-  
-  Float_t fAverageInnerPixSigma;
-  Float_t fAverageOuterPixSigma;  
-  
-  Float_t fAverageInnerPixSigmaErr;
-  Float_t fAverageOuterPixSigmaErr;  
-
-  Float_t fAverageInnerPixRelSigma;
-  Float_t fAverageOuterPixRelSigma;  
-  
-  Float_t fAverageInnerPixRelSigmaErr;
-  Float_t fAverageOuterPixRelSigmaErr;  
+  TArrayI fAverageNum;                // Number of pixels in average pixels
+  TArrayI fAverageSat;                // Number of saturated slices in average pixels
+  TArrayF fAveragePixSigma;           // Re-normalized sigmas in average pixels
+  TArrayF fAveragePixSigmaErr;        // Errors of Re-normalized sigmas in average pixels
+  TArrayF fAveragePixRelSigma;        // Re-normalized relative sigmas in average pixels
+  TArrayF fAveragePixRelSigmaErr;     // Errors of Re-normalized relative sigmas in average pixels
 
   void FinalizeHiGainHists(MHCalibrationChargeHiGainPix &hist, MCalibrationChargePix &pix, MBadPixelsPix &bad);
   void FinalizeLoGainHists(MHCalibrationChargeLoGainPix &hist, MCalibrationChargePix &pix, MBadPixelsPix &bad);
-  void FinalizeAveragePix (MCalibrationChargePix &pix, Int_t npix,
-                           Float_t &sigma, Float_t &sigmaerr,
-                           Float_t &relsigma, Float_t &relsigmaerr, 
-                           Bool_t &b);
   void DrawAverageSigma(Bool_t sat, Bool_t inner,
                         Float_t sigma, Float_t sigmaerr,
@@ -93,15 +86,9 @@
   const MHCalibrationChargeLoGainPix &operator()(UInt_t i)    const;
 
-        MHCalibrationChargeHiGainPix  &GetAverageHiGainInnerPix()        { return *fAverageHiGainInnerPix; }
-  const MHCalibrationChargeHiGainPix  &GetAverageHiGainInnerPix()  const { return *fAverageHiGainInnerPix; }
+        MHCalibrationChargeHiGainPix  &GetAverageHiGainPix(UInt_t i);
+  const MHCalibrationChargeHiGainPix  &GetAverageHiGainPix(UInt_t i)  const;
 
-        MHCalibrationChargeLoGainPix  &GetAverageLoGainInnerPix()        { return *fAverageLoGainInnerPix; }
-  const MHCalibrationChargeLoGainPix  &GetAverageLoGainInnerPix()  const { return *fAverageLoGainInnerPix; }
-
-        MHCalibrationChargeHiGainPix  &GetAverageHiGainOuterPix()        { return *fAverageHiGainOuterPix; }
-  const MHCalibrationChargeHiGainPix  &GetAverageHiGainOuterPix()  const { return *fAverageHiGainOuterPix; }
-
-        MHCalibrationChargeLoGainPix  &GetAverageLoGainOuterPix()        { return *fAverageLoGainOuterPix; }
-  const MHCalibrationChargeLoGainPix  &GetAverageLoGainOuterPix()  const { return *fAverageLoGainOuterPix; }
+        MHCalibrationChargeLoGainPix  &GetAverageLoGainPix(UInt_t i);
+  const MHCalibrationChargeLoGainPix  &GetAverageLoGainPix(UInt_t i)  const;
 
   Bool_t SetupFill(const MParList *pList);
@@ -109,4 +96,7 @@
   Bool_t Fill     (const MParContainer *par, const Stat_t w=1);
   Bool_t Finalize ( );
+
+  // Clone
+  TObject *Clone(const char *) const;
   
   // Draw
Index: trunk/MagicSoft/Mars/mcalib/MHCalibrationChargePix.cc
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MHCalibrationChargePix.cc	(revision 3620)
+++ trunk/MagicSoft/Mars/mcalib/MHCalibrationChargePix.cc	(revision 3622)
@@ -28,5 +28,5 @@
 //  Histogram class for charge calibration analysis. Holds the histogrammed
 //  summed FADC slices and some rough absolute timing. Calculates the mean 
-//  sum of FADC slices and its sigma
+//  sum of FADC slices and its sigma and perform a Fourier analysis.
 //
 //////////////////////////////////////////////////////////////////////////////
