Index: trunk/MagicSoft/Mars/mhist/MHCalibrationBlindPixel.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHCalibrationBlindPixel.cc	(revision 2698)
+++ trunk/MagicSoft/Mars/mhist/MHCalibrationBlindPixel.cc	(revision 2699)
@@ -82,15 +82,5 @@
     fHBlindPixelCharge->SetXTitle("Sum FADC Slices");
     fHBlindPixelCharge->SetYTitle("Nr. of events");
-    //    fHBlindPixelCharge->Sumw2();
-
-    fErrBlindPixelChargefirst = 0.;
-    fErrBlindPixelChargelast  = gkStartBlindPixelBinNr;
-    fErrBlindPixelChargenbins = gkStartBlindPixelBinNr;
-
-    fHBlindPixelErrCharge = new TH1F("HBlindPixelErrCharge","Distribution of Variances of Summed FADC Slices",
-                        fErrBlindPixelChargenbins,fErrBlindPixelChargefirst,fErrBlindPixelChargelast);
-    fHBlindPixelErrCharge->SetXTitle("Variance Summed FADC Slices");
-    fHBlindPixelErrCharge->SetYTitle("Nr. of events");
-    fHBlindPixelErrCharge->Sumw2();
+    fHBlindPixelCharge->Sumw2();
 
     Axis_t tfirst = -0.5;
@@ -121,6 +111,5 @@
   delete fHBlindPixelCharge;
   delete fHBlindPixelTime;
-  delete fHBlindPixelErrCharge;
-  
+
   if (fSinglePheFit)
     delete fSinglePheFit;
@@ -136,5 +125,4 @@
 {
     fHBlindPixelCharge->SetBinContent (i, 1.e-20);
-    fHBlindPixelErrCharge->SetBinContent  (i, 1.e-20);
     fHBlindPixelTime->SetBinContent(i, 1.e-20);
 }
@@ -279,5 +267,5 @@
   gRandom->SetSeed();
 
-  if (fHBlindPixelCharge->GetEntries() != 0)
+  if (fHBlindPixelCharge->GetIntegral() != 0)
     {
       *fLog << err << "Histogram " << fHBlindPixelCharge->GetTitle() << " is already filled. " << endl;
@@ -329,5 +317,5 @@
   // otherwise the fit goes gaga because of high number of dimensions ...
   //
-  const Stat_t   entries      = fHBlindPixelCharge->GetEntries();
+  const Stat_t   entries      = fHBlindPixelCharge->Integral();
   const Double_t lambda_guess = 0.5;
   const Double_t mu_0_guess = fHBlindPixelCharge->GetBinCenter(fHBlindPixelCharge->GetMaximumBin());
@@ -439,5 +427,5 @@
   Int_t nbins = 50;
 
-  *fLog << "New number of bins in HSinCharge: " << CutEdges(fHBlindPixelCharge,nbins) << endl;
+  CutEdges(fHBlindPixelCharge,nbins);
 
   fBlindPixelChargefirst = fHBlindPixelCharge->GetBinLowEdge(fHBlindPixelCharge->GetXaxis()->GetFirst());
@@ -445,9 +433,4 @@
   fBlindPixelChargenbins = nbins;
 
-  *fLog << "New number of bins in HErrCharge: " << CutEdges(fHBlindPixelErrCharge,30) << endl;
-  fErrBlindPixelChargefirst = fHBlindPixelErrCharge->GetBinLowEdge(fHBlindPixelErrCharge->GetXaxis()->GetFirst());
-  fErrBlindPixelChargelast  = fHBlindPixelErrCharge->GetBinLowEdge(fHBlindPixelErrCharge->GetXaxis()->GetLast())+fHBlindPixelErrCharge->GetBinWidth(0);
-  fErrBlindPixelChargenbins = nbins;
-
   CutEdges(fHBlindPixelChargevsN,0);
 
@@ -463,5 +446,5 @@
   rmax = (rmax != 0.) ? rmax : 9.;
 
-  const Stat_t   entries     = fHBlindPixelTime->GetEntries();
+  const Stat_t   entries     = fHBlindPixelTime->Integral();
   const Double_t mu_guess    = fHBlindPixelTime->GetBinCenter(fHBlindPixelTime->GetMaximumBin());
   const Double_t sigma_guess = (rmax - rmin)/2.;
Index: trunk/MagicSoft/Mars/mhist/MHCalibrationBlindPixel.h
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHCalibrationBlindPixel.h	(revision 2698)
+++ trunk/MagicSoft/Mars/mhist/MHCalibrationBlindPixel.h	(revision 2699)
@@ -33,6 +33,5 @@
 
   TH1F* fHBlindPixelCharge;        //-> Histogram with the single Phe spectrum
-  TH1F* fHBlindPixelErrCharge;     //-> Variance of summed FADC slices
-  TH1I* fHBlindPixelTime;        //-> Variance of summed FADC slices
+  TH1I* fHBlindPixelTime;          //-> Variance of summed FADC slices
   TH1I* fHBlindPixelChargevsN;     //-> Summed Charge vs. Event Nr. 
   
@@ -45,8 +44,4 @@
   Int_t   fBlindPixelChargenbins;
   
-  Axis_t fErrBlindPixelChargefirst;
-  Axis_t fErrBlindPixelChargelast;
-  Int_t  fErrBlindPixelChargenbins;
-
   void ResetBin(Int_t i);
   void DrawLegend();
@@ -88,5 +83,4 @@
 
   Bool_t FillBlindPixelCharge(Float_t q)             { return fHBlindPixelCharge->Fill(q) > -1;  }  
-  Bool_t FillErrBlindPixelCharge(Float_t errq)       { return fHBlindPixelErrCharge->Fill(errq) > -1; }
   Bool_t FillBlindPixelTime(Int_t t)                 { return fHBlindPixelTime->Fill(t) > -1;  }
   Bool_t FillBlindPixelChargevsN(Stat_t rq, Int_t t) { return fHBlindPixelChargevsN->Fill(t,rq) > -1;  }  
@@ -115,7 +109,4 @@
   const Double_t GetSigmaTimeErr()    const { return fSigmaTimeErr; }
 
-  const TH1F *GetHErrCharge() { return fHBlindPixelErrCharge; }
-  const TH1F *GetHErrCharge() const { return fHBlindPixelErrCharge; }
-  
   Bool_t SimulateSinglePhe(Double_t lambda,
                            Double_t mu0,
Index: trunk/MagicSoft/Mars/mhist/MHCalibrationPixel.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHCalibrationPixel.cc	(revision 2698)
+++ trunk/MagicSoft/Mars/mhist/MHCalibrationPixel.cc	(revision 2699)
@@ -297,5 +297,5 @@
 {
 
-  if (fHChargeHiGain->GetEntries() > fHChargeLoGain->GetEntries())
+  if (fHChargeHiGain->Integral() > fHChargeLoGain->Integral())
     {
       fUseLoGain = kFALSE;
@@ -382,5 +382,4 @@
     FitHiGainvsLoGain();
       
-  
   gStyle->SetOptFit(0);
   gStyle->SetOptStat(1111111);
@@ -390,97 +389,111 @@
   gROOT->SetSelectedPad(NULL);
   
-    c->Divide(2,4);
-
-    c->cd(1);
-    gPad->SetBorderMode(0);
+  c->Divide(2,4);
+  
+  c->cd(1);
+  gPad->SetBorderMode(0);
+  gPad->SetTicks();
+
+  if (fHChargeHiGain->Integral() > 0)
     gPad->SetLogy(1);
-    gPad->SetTicks();
-
-    fHChargeHiGain->DrawCopy(opt);
-
-    c->Modified();
-    c->Update();
-
-    if (fUseLoGain)
+  else
+    gPad->SetLogy(0);
+
+  fHChargeHiGain->DrawCopy(opt);
+  
+  c->Modified();
+  c->Update();
+  
+  if (fUseLoGain)
+    {
+
+      c->cd(2);
+      gPad->SetTicks();
+
+      if (fHChargeLoGain->Integral() > 0)
+        gPad->SetLogy(1);
+      else
+        gPad->SetLogy(0);
+
+      fHChargeLoGain->DrawCopy(opt);
+      
+      if (fChargeGausFit)
+        {
+          if (fFitOK)
+            fChargeGausFit->SetLineColor(kGreen);          
+          else
+            fChargeGausFit->SetLineColor(kRed);
+          
+          fChargeGausFit->DrawCopy("same");
+        }
+      c->Modified();
+      c->Update();
+      
+      c->cd(3);
+      gROOT->SetSelectedPad(NULL);
+      gStyle->SetOptFit();
+      fHivsLoGain->Draw("prof");
+
+      gPad->Modified();
+      gPad->Update();
+      
+      c->cd(4);
+      DrawLegend();
+      
+    }
+  else
+    {
+      if (fChargeGausFit)
+        {
+          if (fFitOK)
+            fChargeGausFit->SetLineColor(kGreen);          
+          else
+            fChargeGausFit->SetLineColor(kRed);
+          
+          fChargeGausFit->DrawCopy("same");
+        }
+
+      c->cd(2);
+      gPad->SetTicks();
+
+      if (fHChargeLoGain->Integral() > 0)
+        gPad->SetLogy(1);
+      else
+        gPad->SetLogy(0);
+      
+      fHChargeLoGain->DrawCopy(opt);
+      c->Modified();
+      c->Update();
+      
+      c->cd(3);
+      DrawLegend();
+      
+      c->cd(4);
+      
+      gROOT->SetSelectedPad(NULL);
+      gStyle->SetOptFit();
+      fHivsLoGain->Draw("prof");
+      gPad->Modified();
+      gPad->Update();
+    }	
+  
+  c->Modified();
+  c->Update();
+  
+  c->cd(5);
+  gStyle->SetOptStat(1111111);
+
+  gPad->SetTicks();  
+  gPad->SetLogy(0);
+  fHTimeHiGain->DrawCopy(opt);
+  c->Modified();
+  c->Update();
+  
+  if (fUseLoGain)
       {
-	c->cd(2);
-	gPad->SetLogy(1);
-	gPad->SetTicks();
-	fHChargeLoGain->DrawCopy(opt);
-    
- 	if (fChargeGausFit)
-	  {
-	    if (fFitOK)
-	      fChargeGausFit->SetLineColor(kGreen);          
-	    else
-	      fChargeGausFit->SetLineColor(kRed);
-	    
-	    fChargeGausFit->DrawCopy("same");
-	  }
-	c->Modified();
-	c->Update();
-
-	c->cd(3);
-	gROOT->SetSelectedPad(NULL);
-	gStyle->SetOptFit();
-	fHivsLoGain->Draw("prof");
-
-
-	gPad->Modified();
-	gPad->Update();
-
-	c->cd(4);
-	DrawLegend();
-
-      }
-    else
-      {
- 	if (fChargeGausFit)
-	  {
-	    if (fFitOK)
-	      fChargeGausFit->SetLineColor(kGreen);          
-	    else
-	      fChargeGausFit->SetLineColor(kRed);
-	    
-	    fChargeGausFit->DrawCopy("same");
-	  }
-	c->cd(2);
-	gPad->SetLogy(1);
-	gPad->SetTicks();
-
-	fHChargeLoGain->DrawCopy(opt);
-	c->Modified();
-	c->Update();
-    
-	c->cd(3);
-	DrawLegend();
-
-	c->cd(4);
-	
-	gROOT->SetSelectedPad(NULL);
-	gStyle->SetOptFit();
-	fHivsLoGain->Draw("prof");
-	gPad->Modified();
-	gPad->Update();
-
-
-      }	
-
-    c->Modified();
-    c->Update();
-    
-    c->cd(5);
-    gStyle->SetOptStat(1111111);
-
-    gPad->SetLogy(1);
-    fHTimeHiGain->DrawCopy(opt);
-    c->Modified();
-    c->Update();
-
-    if (fUseLoGain)
-      {
-
+        
 	c->cd(6);
-	gPad->SetLogy(1);
+        gPad->SetTicks();
+	gPad->SetLogy(0);
 	fHTimeLoGain->DrawCopy(opt);
 	c->Modified();
@@ -514,5 +527,6 @@
 
 	c->cd(6);
-	gPad->SetLogy(1);
+        gPad->SetTicks();
+	gPad->SetLogy(0);
 	fHTimeLoGain->DrawCopy(opt);	
 	c->Modified();
@@ -524,4 +538,5 @@
     
     c->cd(7);
+    gPad->SetTicks();
     fHChargevsNHiGain->DrawCopy(opt);
     c->Modified();
@@ -529,4 +544,5 @@
 
     c->cd(8);
+    gPad->SetTicks();
     fHChargevsNLoGain->DrawCopy(opt);
     c->Modified();
@@ -573,5 +589,5 @@
   rmax = (rmax != 0.) ? rmax : 9.;
 
-  const Stat_t   entries     = fHTimeHiGain->GetEntries();
+  const Stat_t entries       = fHTimeHiGain->Integral();
   const Double_t mu_guess    = fHTimeHiGain->GetBinCenter(fHTimeHiGain->GetMaximumBin());
   const Double_t sigma_guess = (rmax - rmin)/2.;
@@ -629,5 +645,5 @@
   rmax = (rmax != 0.) ? rmax : 9.;
 
-  const Stat_t   entries     = fHTimeLoGain->GetEntries();
+  const Stat_t   entries     = fHTimeLoGain->Integral();
   const Double_t mu_guess    = fHTimeLoGain->GetBinCenter(fHTimeLoGain->GetMaximumBin());
   const Double_t sigma_guess = (rmax - rmin)/2.;
@@ -692,5 +708,5 @@
   // otherwise the fit goes gaga because of high number of dimensions ...
   //
-  const Stat_t   entries    = fHChargeHiGain->GetEntries();
+  const Stat_t   entries    = fHChargeHiGain->Integral();
   const Double_t area_guess = entries/gkSq2Pi;
   const Double_t mu_guess   = fHChargeHiGain->GetBinCenter(fHChargeHiGain->GetMaximumBin());
@@ -766,5 +782,5 @@
   // otherwise the fit goes gaga because of high number of dimensions ...
   //
-  const Stat_t   entries    = fHChargeLoGain->GetEntries();
+  const Stat_t   entries    = fHChargeLoGain->Integral();
   const Double_t area_guess = entries/gkSq2Pi;
   const Double_t mu_guess   = fHChargeLoGain->GetBinCenter(fHChargeLoGain->GetMaximumBin());
Index: trunk/MagicSoft/Mars/mhist/MHCalibrationPixel.h
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHCalibrationPixel.h	(revision 2698)
+++ trunk/MagicSoft/Mars/mhist/MHCalibrationPixel.h	(revision 2699)
@@ -156,10 +156,10 @@
   virtual void Reset();
 
-  void SetLowerFitRange(Axis_t min)  { fLowerFitRange = min; }
+  void SetLowerFitRange(Axis_t min)                {  fLowerFitRange = min; }
 
   void PrintChargeFitResult();
   void PrintTimeFitResult();  
 
-  Bool_t IsFitOK()    { return fFitOK; }
+  Bool_t IsFitOK()                           {  return fFitOK;          }
   
   ClassDef(MHCalibrationPixel, 1) 
