Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 1826)
+++ trunk/MagicSoft/Mars/Changelog	(revision 1827)
@@ -16,10 +16,11 @@
     * mhist/MHMcCT1CollectionArea.[h,cc]
       - Added arguments in constructor: number of bins and ranges of the 
-	x-axis (energy) of the 2-d histograms.
+	x-axis (energy) of the 2-d histograms. Changed type of binning:
+	now the x-axis is log10(energy) and bins have equal width.
 
     * macros/CT1collarea.C
       - The MHMcCT1CollectionArea object is now created and added to the 
-       	parlist so that  we can choose the binning.
-
+       	parlist so that  we can choose the binning. Changed the way 
+       	histograms are written to the output file.
 
 
Index: trunk/MagicSoft/Mars/mhist/MHMcCT1CollectionArea.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHMcCT1CollectionArea.cc	(revision 1826)
+++ trunk/MagicSoft/Mars/mhist/MHMcCT1CollectionArea.cc	(revision 1827)
@@ -58,5 +58,5 @@
 
   fName  = name  ? name  : "MHMcCT1CollectionArea";
-  fTitle = title ? title : "Collection Area vs. Energy";
+  fTitle = title ? title : "Collection Area vs. log10 Energy";
 
   fHistAll = new TH2D;
@@ -71,6 +71,6 @@
 
   fHistCol->SetTitle(fTitle);
-  fHistAll->SetTitle("All showers - Theta vs Energy distribution");
-  fHistSel->SetTitle("Selected showers - Theta vs Energy distribution");
+  fHistAll->SetTitle("All showers - Theta vs log10 Energy distribution");
+  fHistSel->SetTitle("Selected showers - Theta vs log10 Energy distribution");
 
   fHistAll->SetDirectory(NULL);
@@ -78,13 +78,13 @@
   fHistCol->SetDirectory(NULL);
 
-  fHistAll->SetXTitle("E [GeV]");
+  fHistAll->SetXTitle("log10 E [GeV]");
   fHistAll->SetYTitle("theta [deg]");
   fHistAll->SetZTitle("N");
 
-  fHistSel->SetXTitle("E [GeV]");
+  fHistSel->SetXTitle("log10 E [GeV]");
   fHistSel->SetYTitle("theta [deg]");
-  fHistSel->SetYTitle("N");
-
-  fHistCol->SetXTitle("E [GeV]");
+  fHistSel->SetZTitle("N");
+
+  fHistCol->SetXTitle("log10 E [GeV]");
   fHistCol->SetYTitle("theta [deg]");
   fHistCol->SetZTitle("A [m^{2}]");
@@ -99,5 +99,5 @@
 {
   MBinning binsx;
-  binsx.SetEdgesLog(nbins, minEnergy, maxEnergy);
+  binsx.SetEdges(nbins, minEnergy, maxEnergy);
 
   MBinning binsy;
@@ -129,5 +129,5 @@
 void MHMcCT1CollectionArea::FillSel(Double_t energy, Double_t theta)
 {
-  fHistSel->Fill(energy, theta);
+  fHistSel->Fill(log10(energy), theta);
 }
 
@@ -143,6 +143,4 @@
   fHistAll->Draw(option);
 
-  gPad->SetLogx();
-
   gPad->Modified();
   gPad->Update();
@@ -159,6 +157,4 @@
 
   fHistSel->Draw(option);
-
-  gPad->SetLogx();
 
   gPad->Modified();
@@ -183,6 +179,4 @@
   fHistCol->DrawCopy(option);
 
-  gPad->SetLogx();
-
   c->Modified();
   c->Update();
@@ -197,6 +191,4 @@
 
   fHistCol->Draw(option);
-
-  gPad->SetLogx();
 
   gPad->Modified();
@@ -306,6 +298,6 @@
       for (Int_t i=1; i <= fHistAll->GetNbinsX(); i++)
 	{
-	  const Float_t e1 = fHistAll->GetXaxis()->GetBinLowEdge(i);
-	  const Float_t e2 = fHistAll->GetXaxis()->GetBinLowEdge(i+1);
+	  const Float_t e1 = pow(10.,fHistAll->GetXaxis()->GetBinLowEdge(i));
+	  const Float_t e2 = pow(10.,fHistAll->GetXaxis()->GetBinLowEdge(i+1));
 
 	  if (e1 < emin1 || e2 > emax2)
@@ -336,5 +328,19 @@
 
 	  if (Na <= 0)
-	    continue;
+	    {
+	      //
+	      // If energy is large, this case means that no or very few events
+	      // were generated at this energy bin. In this case we assign it 
+	      // the effective area of the bin below it in energy. If energy is
+	      // below 1E4, it means that no events triggered -> eff area = 0
+	      //
+
+	      if (fHistSel->GetXaxis()->GetBinLowEdge(ix) > 4.)
+		{
+		  fHistCol->SetBinContent(ix, thetabin, fHistCol->GetBinContent(ix-1, thetabin));
+		  fHistCol->SetBinError(ix, thetabin, fHistCol->GetBinError(ix-1, thetabin));
+		}
+	      continue;
+	    }
 
 	  const Float_t Ns = fHistSel->GetBinContent(ix,thetabin);
@@ -350,8 +356,10 @@
 	  const Double_t err = sqrt((1.-eff)*Ns)/Na;
 
+
 	  const Float_t area = dr * cos(theta*TMath::Pi()/180.);
 
 	  fHistCol->SetBinContent(ix, thetabin, eff*area);
 	  fHistCol->SetBinError(ix, thetabin, err*area);
+
 	}
     }
Index: trunk/MagicSoft/Mars/mhist/MHMcCT1CollectionArea.h
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHMcCT1CollectionArea.h	(revision 1826)
+++ trunk/MagicSoft/Mars/mhist/MHMcCT1CollectionArea.h	(revision 1827)
@@ -18,5 +18,5 @@
 
 public:
-    MHMcCT1CollectionArea(const char *name=NULL, const char *title=NULL, Int_t nbins=45, Axis_t minEnergy=100., Axis_t maxEnergy=30000.);
+    MHMcCT1CollectionArea(const char *name=NULL, const char *title=NULL, Int_t nbins=30, Axis_t minEnergy=2., Axis_t maxEnergy=5.);
     ~MHMcCT1CollectionArea();
 
@@ -27,4 +27,6 @@
 
     const TH2D *GetHist() const { return fHistCol; }
+    const TH2D *GetHAll() const { return fHistAll; }
+    const TH2D *GetHSel() const { return fHistSel; }
 
     void Draw(Option_t *option="");
