Index: trunk/MagicSoft/Mars/mpedestal/MHPedestalCam.cc
===================================================================
--- trunk/MagicSoft/Mars/mpedestal/MHPedestalCam.cc	(revision 5030)
+++ trunk/MagicSoft/Mars/mpedestal/MHPedestalCam.cc	(revision 5137)
@@ -113,4 +113,6 @@
 #include "TH1.h"
 
+#include <TOrdCollection.h>
+
 ClassImp(MHPedestalCam);
 
@@ -231,13 +233,13 @@
   fExtractLoGainSlices = sliceslo;
 
-  if (fHiGainArray->GetEntries()==0)
-  {
-      fHiGainArray->Expand(npixels);
+  if (fHiGainArray->GetSize()==0)
+  {
       for (Int_t i=0; i<npixels; i++)
       {
-	  (*fHiGainArray)[i] = new MHPedestalPix;
-          InitPedHists((MHPedestalPix&)(*this)[i],i,fExtractHiGainSlices);
+        fHiGainArray->AddAt(new MHPedestalPix(Form("%s%4i","MHPedestalHiGainPix",i),
+                                              Form("%s%4i","Pedestals High Gain Pixel",i)),i);
+        InitPedHists((MHPedestalPix&)(*this)[i],i,fExtractHiGainSlices);
           
-          if ((*fBadPixels)[i].IsBad())
+      if ((*fBadPixels)[i].IsBad())
             (*this)[i].SetExcluded();
 
@@ -247,28 +249,24 @@
   }
 
-  if (fLoGainArray->GetEntries()==0)
-  {
-      fLoGainArray->Expand(npixels);
+  if (fLoGainArray->GetSize()==0)
+  {
       for (Int_t i=0; i<npixels; i++)
       {
-	  (*fLoGainArray)[i] = new MHPedestalPix;
-          InitPedHists((MHPedestalPix&)(*this)(i),i,fExtractLoGainSlices);
-
-          if ((*fBadPixels)[i].IsBad())
-            (*this)(i).SetExcluded();
+        fLoGainArray->AddAt(new MHPedestalPix(Form("%s%4i","MHPedestalLoGainPix",i),
+                                              Form("%s%4i","Pedestals Low Gain Pixel",i)),i);
+        InitPedHists((MHPedestalPix&)(*this)(i),i,fExtractLoGainSlices);
+
+        if ((*fBadPixels)[i].IsBad())
+          (*this)(i).SetExcluded();
       }
   }
 
-  if (fAverageHiGainAreas->GetEntries()==0)
-  {
-    fAverageHiGainAreas->Expand(nareas);
+  if (fAverageHiGainAreas->GetSize()==0)
+  {
     
     for (Int_t j=0; j<nareas; j++)
       {
-        (*fAverageHiGainAreas)[j] = 
-          new MHPedestalPix("AverageHiGainArea",
-                                      "Average Pedestals area idx ");
-
-        GetAverageHiGainArea(j).GetHGausHist()->SetTitle("Pedestals average Area Idx ");
+        fAverageHiGainAreas->AddAt(new MHPedestalPix(Form("%s%d","AverageHiGainArea",j),
+                                                     Form("%s%d","Average Pedestals area idx ",j)),j);
 
         InitPedHists((MHPedestalPix&)GetAverageHiGainArea(j),j,fExtractHiGainSlices);
@@ -277,15 +275,11 @@
   }
 
-  if (fAverageLoGainAreas->GetEntries()==0)
-  {
-    fAverageLoGainAreas->Expand(nareas);
+  if (fAverageLoGainAreas->GetSize()==0)
+  {
     
     for (Int_t j=0; j<nareas; j++)
       {
-        (*fAverageLoGainAreas)[j] = 
-          new MHPedestalPix("AverageLoGainArea",
-                                      "Pedestals average Area idx ");
-
-        GetAverageLoGainArea(j).GetHGausHist()->SetTitle("Pedestals average Area Idx ");
+        fAverageLoGainAreas->AddAt(new MHPedestalPix(Form("%s%d","AverageLoGainArea",j),
+                                                     Form("%s%d","Pedestals average Area idx ",j)),j);
 
         InitPedHists((MHPedestalPix&)GetAverageLoGainArea(j),j,fExtractLoGainSlices);
@@ -294,35 +288,24 @@
   }
 
-  if (fAverageHiGainSectors->GetEntries()==0)
-  {
-      fAverageHiGainSectors->Expand(nsectors);
+  if (fAverageHiGainSectors->GetSize()==0)
+  {
 
       for (Int_t j=0; j<nsectors; j++)
       {
-	  (*fAverageHiGainSectors)[j] = 
-            new MHPedestalPix("AverageHiGainSector",
-                                        "Pedestals average sector ");
-
-          GetAverageHiGainSector(j).GetHGausHist()->SetTitle("Pedestals average Sector ");
+	  fAverageHiGainSectors->AddAt(new MHPedestalPix(Form("%s%2i","AverageHiGainSector",j),
+                                                         Form("%s%2i","Pedestals average sector ",j)),j);
 
           InitPedHists((MHPedestalPix&)GetAverageHiGainSector(j),j,fExtractHiGainSlices);
-
       }
   }
 
-  if (fAverageLoGainSectors->GetEntries()==0)
-  {
-      fAverageLoGainSectors->Expand(nsectors);
-
+  if (fAverageLoGainSectors->GetSize()==0)
+  {
       for (Int_t j=0; j<nsectors; j++)
       {
-	  (*fAverageLoGainSectors)[j] = 
-            new MHPedestalPix("AverageLoGainSector",
-                                        "Pedestals average sector ");
-
-          GetAverageLoGainSector(j).GetHGausHist()->SetTitle("Pedestals average Sector ");
+	  fAverageLoGainSectors->AddAt(new MHPedestalPix(Form("%s%2i","AverageLoGainSector",j),
+                                                         Form("%s%2i","Pedestals average sector ",j)),j);
 
           InitPedHists((MHPedestalPix&)GetAverageLoGainSector(j),j,fExtractLoGainSlices);
-          
       }
   }
@@ -347,5 +330,4 @@
 
   hist.InitBins();
-  hist.ChangeHistId(i);
   hist.SetEventFrequency(fPulserFrequency);
 
@@ -355,6 +337,4 @@
   hist.SetProbLimit(0.);
 
-  TH1F *h = hist.GetHGausHist();
-  h->SetTitle( Form("%s%s", h->GetTitle()," Runs: "));
 }
 // -------------------------------------------------------------------------------
