Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 2602)
+++ trunk/MagicSoft/Mars/Changelog	(revision 2603)
@@ -9,7 +9,6 @@
      - implemented some of Thomas Bretz suggestions to make the code nicer
      - implemented the possibility to have cosmics in the calibration data 
-       and still fit it
-     - conversion HiGain/LoGain now left out (it seems to be already done in 
-	the data)
+       and remove it
+     - implemented the conversion factors for the blind pixel method
 
   * mhist/MHCalibration*
Index: trunk/MagicSoft/Mars/macros/calibration.C
===================================================================
--- trunk/MagicSoft/Mars/macros/calibration.C	(revision 2602)
+++ trunk/MagicSoft/Mars/macros/calibration.C	(revision 2603)
@@ -184,7 +184,9 @@
     MHCamera disp10  (geomcam, "MCalibrationCam;pedrms", "Pedestal RMS");
     MHCamera disp11  (geomcam, "MCalibrationCam;rq", "Reduced Charges");
-    MHCamera disp12  (geomcam, "MCalibrationCam;errrq", "Error of Reduced Charges");
+    MHCamera disp12  (geomcam, "MCalibrationCam;rsigma", "Reduced Sigmas");
     MHCamera disp13  (geomcam, "MCalibrationCam;phe", "Nr. of Phe's (F-Factor Method)");
     MHCamera disp14  (geomcam, "MCalibrationCam;convphe", "Conversion Factor (F-Factor Method)");
+    MHCamera disp15  (geomcam, "MCalibrationCam;photons", "Nr. of Photons (Blind Pixel Method)");
+    MHCamera disp16  (geomcam, "MCalibrationCam;convphot", "Conversion Factor (Blind Pixel Method)");
 
     disp1.SetCamContent(*cam, 0);
@@ -200,21 +202,26 @@
     disp11.SetCamContent(*cam, 10);
     disp12.SetCamContent(*cam, 11);
-    disp12.SetCamContent(*cam, 12);
-    disp13.SetCamContent(*cam, 13);
+    disp13.SetCamContent(*cam, 12);
+    disp14.SetCamContent(*cam, 13);
+    disp15.SetCamContent(*cam, 14);
+    disp16.SetCamContent(*cam, 15);
+
 
     disp1.SetYTitle("Q [FADC counts]");
-    disp2.SetYTitle("\\Delta_{Q} [FADC counts]");
+    disp2.SetYTitle("\\Delta Q [FADC counts]");
     disp3.SetYTitle("\\sigma_{Q} [FADC counts]");
-    disp4.SetYTitle("\\Delta_{\\sigma_{Q}} [FADC counts]");
+    disp4.SetYTitle("\\Delta {\\sigma_{Q}} [FADC counts]");
     disp5.SetYTitle("P [au]");
     disp6.SetYTitle("T [FADC slices]");
-    disp7.SetYTitle("\\Delta_{T} [FADC slices]");
+    disp7.SetYTitle("\\Delta T [FADC slices]");
     disp8.SetYTitle("P [au]");
     disp9.SetYTitle("P [FADC counts/ slice ]");
     disp10.SetYTitle("RMS_{P} [FADC counts / slice ]");
     disp11.SetYTitle("Q [FADC counts]");
-    disp12.SetYTitle("\\Delta_{Q} [FADC counts]");
+    disp12.SetYTitle("\\sigma^2_{Q} - RMS^2_{P} [FADC counts^2]");
     disp13.SetYTitle("Nr Phe's");
     disp14.SetYTitle("Conversion Factor [Phe/FADC count]");
+    disp15.SetYTitle("Nr Photons");
+    disp16.SetYTitle("Conversion Factor [Ph/FADC count]");
 
     MStatusDisplay *d2 = new MStatusDisplay;
@@ -350,4 +357,21 @@
     obj->Draw();
 
+    TCanvas *c6 = &d2->AddTab("Blind Pixel Method");
+    c6->Divide(2, 2);
+
+    c6->cd(1);
+    gStyle->SetOptStat(1111);
+    obj=disp15.DrawCopy("hist");
+
+    c6->cd(3);
+    obj->Draw();
+
+    c6->cd(2);
+    gStyle->SetOptStat(1101);
+    obj=disp16.DrawCopy("hist");
+
+    c6->cd(4);
+    obj->Draw();
+
 
 #endif
Index: trunk/MagicSoft/Mars/manalysis/MCalibrationBlindPix.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MCalibrationBlindPix.cc	(revision 2602)
+++ trunk/MagicSoft/Mars/manalysis/MCalibrationBlindPix.cc	(revision 2603)
@@ -59,5 +59,5 @@
   fErrLambda = fErrMu0 = fErrMu1 = fErrSigma0 = fErrSigma1 = 0;
   
-  fT = fErrT = 0;
+  fTime = fErrTime = 0;
 }
 
@@ -76,5 +76,5 @@
 }
 
-Bool_t MCalibrationBlindPix::FitQ() 
+Bool_t MCalibrationBlindPix::FitCharge() 
 {
   if (!fHist->FitSinglePhe())
@@ -98,12 +98,12 @@
 
 
-Bool_t MCalibrationBlindPix::FitT() 
+Bool_t MCalibrationBlindPix::FitTime() 
 {
 
-  if(!fHist->FitT())
+  if(!fHist->FitTime())
     return kFALSE;
 
-  fT    = fHist->GetMeanT();
-  fErrT = fHist->GetMeanTErr();
+  fTime    = fHist->GetMeanTime();
+  fErrTime = fHist->GetMeanTimeErr();
   
   return kTRUE;
Index: trunk/MagicSoft/Mars/manalysis/MCalibrationBlindPix.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MCalibrationBlindPix.h	(revision 2602)
+++ trunk/MagicSoft/Mars/manalysis/MCalibrationBlindPix.h	(revision 2603)
@@ -24,6 +24,6 @@
   Float_t fErrSigma1;        // The error of the width of the first phe-peak  
   
-  Float_t fT;                // The mean arrival time after the fit  
-  Float_t fErrT;             // The error of the mean arrival time after the fit
+  Float_t fTime;                // The mean arrival time after the fit  
+  Float_t fErrTime;             // The error of the mean arrival time after the fit
   
   MHCalibrationBlindPixel *fHist; // Pointer to the histograms performing the fits, etc.  
@@ -48,15 +48,15 @@
   Float_t GetErrSigma1() const    { return fErrSigma1;  }
 
-  Float_t GetT()         const    { return fT;         }
-  Float_t GetErrT()      const    { return fErrT;      }
+  Float_t GetTime()         const    { return fTime;         }
+  Float_t GetErrTime()      const    { return fErrTime;      }
   
-  Bool_t FillQ(Int_t q)            { return fHist->FillBlindPixelQ(q); }
-  Bool_t FillT(Int_t t)            { return fHist->FillBlindPixelT(t); }  
-  Bool_t FillRQvsT(Float_t rq, Int_t t) { return fHist->FillBlindPixelQvsN(rq,t); }    
+  Bool_t FillCharge(Int_t q)            { return fHist->FillBlindPixelCharge(q); }
+  Bool_t FillTime(Int_t t)            { return fHist->FillBlindPixelTime(t); }  
+  Bool_t FillRChargevsTime(Float_t rq, Int_t t) { return fHist->FillBlindPixelChargevsN(rq,t); }    
   
   Bool_t IsValid()                 { return fLambda > 0. || fErrLambda > 0.; }
   
-  Bool_t FitQ();
-  Bool_t FitT();
+  Bool_t FitCharge();
+  Bool_t FitTime();
   
   virtual void Draw(Option_t *opt="")         { fHist->Draw(opt); }
Index: trunk/MagicSoft/Mars/manalysis/MCalibrationCalc.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MCalibrationCalc.cc	(revision 2602)
+++ trunk/MagicSoft/Mars/manalysis/MCalibrationCalc.cc	(revision 2603)
@@ -53,19 +53,19 @@
 //               Every MCalibrationPix holds a histogram class,             //
 //               MHCalibrationPixel which itself hold histograms of type:   //
-//               HQ(npix) (distribution of summed FADC time slice entries)  //
-//               HT(npix) (distribution of position of maximum)             //
-//               HQvsN(npix) (distribution of charges vs. event number.     //
-//                                                                          //
-// PostProcess:  All histograms HQ(npix) are fitted to a Gaussian           //
-//               All histograms HT(npix) are fitted to a Gaussian           //
-//               The histogram HBPQ (blind pixel) is fitted to a single     //
+//               HCharge(npix) (distribution of summed FADC time slice entries)  //
+//               HTime(npix) (distribution of position of maximum)             //
+//               HChargevsN(npix) (distribution of charges vs. event number.     //
+//                                                                          //
+// PostProcess:  All histograms HCharge(npix) are fitted to a Gaussian           //
+//               All histograms HTime(npix) are fitted to a Gaussian           //
+//               The histogram HBlindPixelCharge (blind pixel) is fitted to a single     //
 //                   PhE fit                                                //
-//               The histogram HBPT (blind pixel) is fitted to a Gaussian   //
+//               The histogram HBlindPixelTime (blind pixel) is fitted to a Gaussian   //
 //               The histograms of the PIN Diode are fitted to Gaussians    //
 //                                                                          //
 //               Fits can be excluded via the commands:                     //
-//               MalibrationCam::SetSkipTFits()   (skip all time fits)      //
-//               MalibrationCam::SetSkipBPFits()  (skip all blind pixel fits) //
-//               MalibrationCam::SetSkipPDFits()  (skip all PIN Diode fits) //
+//               MalibrationCam::SetSkipTimeFits()   (skip all time fits)      //
+//               MalibrationCam::SetSkipBlindPixelFits()  (skip all blind pixel fits) //
+//               MalibrationCam::SetSkipPinDiodeFits()  (skip all PIN Diode fits) //
 //                                                                          //
 //////////////////////////////////////////////////////////////////////////////
@@ -94,4 +94,5 @@
 
 #include "MTime.h"
+#include "TMath.h"
 
 ClassImp(MCalibrationCalc);
@@ -115,7 +116,7 @@
     AddToBranchList("MRawEvtData.fLoGainFadcSamples");
 
-    SETBIT(fFlags, kUseTFits);
-    SETBIT(fFlags, kUseBPFit);
-    SETBIT(fFlags, kUsePDFit);
+    SETBIT(fFlags, kUseTimeFits);
+    SETBIT(fFlags, kUseBlindPixelFit);
+    SETBIT(fFlags, kUsePinDiodeFit);
 }
 
@@ -219,5 +220,5 @@
       {
         MCalibrationPix &pix = (*fCalibrations)[i];
-        pix.ChangePixId(i);
+        pix.DefinePixId(i);
       }
     
@@ -244,8 +245,44 @@
     MRawEvtPixelIter pixel(fRawEvt);
 
+    // Create a first loop to sort out the cosmics ...
+    // 
+    // This is a very primitive check for the number of cosmicpixs
+    // The cut will be applied in the fit, but for the blind pixel,
+    // we need to remove this event
+    //
+    // FIXME: In the future need a much more sophisticated one!!!
+    //
+    
     while (pixel.Next())
       {
 
+        const Int_t pixid = pixel.GetPixelId();
+
+        Int_t sum = pixel.GetSumHiGainSamples();
+
+        MPedestalPix    &ped = (*fPedestals)[pixid];
+ 
+        Float_t pedes  = ped.GetPedestal();
+        Float_t pedrms = ped.GetPedestalRms();
+        
+	if ((float)sum < (pedes*fNumHiGainSamples)+(1.5*pedrms) )
+           cosmicpix++;
+     }
+
+
+    if (cosmicpix > 50.)
+      {
+	fCosmics++;
+	return kTRUE;
+      }
+
+    pixel.Reset();
+
+    while (pixel.Next())
+      {
+
         UShort_t sat = 0;
+        UShort_t lowgainoverflow = 0;
+
         const Int_t pixid = pixel.GetPixelId();
 
@@ -269,13 +306,15 @@
             //         performed in the data?!?
             //
-            sum = (max > gkSaturationLimit              // overflow of LoGain ??? -> GimmeABreak!!!
-                   ? fHistOverFlow++, gkLoGainOverFlow  // OUCH (Florian was maybe right)
-                   : sum  );                            // OUFF (Florian was wrong) !! 
-            //                   : sum*gkConversionHiLo    );          // OUFF (Florian was wrong) !! 
-
-            if (fHistOverFlow) 
-              *fLog << err << dbginf << "Warning: Saturation of LoGain reached! " 
-                    << err << dbginf << "sum = " << sum << endl;
-
+            sum = (max > gkSaturationLimit                // overflow of LoGain ??? -> GimmeABreak!!!
+                   ? lowgainoverflow++, gkLoGainOverFlow  // OUCH (Florian was maybe right)
+                   : sum*gkConversionHiLo    );          // OUFF (Florian was wrong) !! 
+                   //                   : sum  );
+
+            if (lowgainoverflow)
+		{ 
+            	  *fLog << err << dbginf << "Warning: Saturation of LoGain reached in pixel: " << pixid << " " 
+                	<< "   sum = " << sum << endl;
+	            fHistOverFlow++;
+		}
           }
 
@@ -293,15 +332,4 @@
         pedrms *= (sat ? fNumLoGainSamples : fNumHiGainSamples );
 
-	// 
-	// This is a very primitive check for the number of cosmicpixs
-	// The cut will be applied in the fit, but for the blind pixel,
-	// we need to remove this event
-	//
-	// FIXME: In the future need a much more sophisticated one!!!
-	//
-
-	if ((float)sum < pedes+4.*pedrms)
-           cosmicpix++;
-
         Float_t rsum      = (float)sum - pedes;
         
@@ -315,34 +343,31 @@
 	    //        the rest of the pixels (which is the case right now)
 	    //
-            if (cosmicpix < 100.)
-              {
-                if (!blindpixel.FillQ(sum)) 
-                  *fLog << warn << 
-                    "Overflow or Underflow occurred filling Blind Pixel sum = " << sum << endl;
-
-                if (!blindpixel.FillT((int)mid)) 
-                  *fLog << warn << 
-                    "Overflow or Underflow occurred filling Blind Pixel time = " << (int)mid << endl;
-
-                if (!blindpixel.FillRQvsT(rsum,fEvents))
-                  *fLog << warn << 
-                    "Overflow or Underflow occurred filling Blind Pixel eventnr = " << fEvents << endl;
-              }
+	    if (!blindpixel.FillCharge(sum)) 
+	      *fLog << warn << 
+		"Overflow or Underflow occurred filling Blind Pixel sum = " << sum << endl;
+
+	    if (!blindpixel.FillTime((int)mid)) 
+	      *fLog << warn << 
+		"Overflow or Underflow occurred filling Blind Pixel time = " << (int)mid << endl;
+	    
+	    if (!blindpixel.FillRChargevsTime(rsum,fEvents))
+	      *fLog << warn << 
+		"Overflow or Underflow occurred filling Blind Pixel eventnr = " << fEvents << endl;
             
           case gkCalibrationPINDiodeId:
-            if (!pindiode.FillQ(sum)) 
+            if (!pindiode.FillCharge(sum)) 
               *fLog << warn << 
-                "Overflow or Underflow occurred filling HQ: means = " << sum << endl;
-            if (!pindiode.FillT((int)mid)) 
+                "Overflow or Underflow occurred filling HCharge: means = " << sum << endl;
+            if (!pindiode.FillTime((int)mid)) 
               *fLog << warn << 
-                "Overflow or Underflow occurred filling HT: time = " << (int)mid << endl;
-            if (!pindiode.FillRQvsT(rsum,fEvents))
+                "Overflow or Underflow occurred filling HTime: time = " << (int)mid << endl;
+            if (!pindiode.FillRChargevsTime(rsum,fEvents))
               *fLog << warn << 
-                "Overflow or Underflow occurred filling HQvsN: eventnr = " << fEvents << endl;
+                "Overflow or Underflow occurred filling HChargevsN: eventnr = " << fEvents << endl;
 
           default:
 
-            if (!pix.FillQ(sum))
-              *fLog << warn << "Could not fill Q of pixel: " << pixid 
+            if (!pix.FillCharge(sum))
+              *fLog << warn << "Could not fill Charge of pixel: " << pixid 
                     << " signal = " << sum << endl;
 
@@ -350,11 +375,11 @@
             // Fill the reduced charge into the control histo for better visibility
             //
-            if (!pix.FillRQvsT(rsum,fEvents))
-              *fLog << warn << "Could not fill red. Q vs. EvtNr of pixel: " << pixid 
+            if (!pix.FillRChargevsTime(rsum,fEvents))
+              *fLog << warn << "Could not fill red. Charge vs. EvtNr of pixel: " << pixid 
                     << " signal = " << rsum  << " event Nr: " << fEvents << endl;
 
 
-            if (!pix.FillT((int)mid)) 
-            *fLog << warn << "Could not fill T of pixel: " << pixid << " time = " << (int)mid << endl;
+            if (!pix.FillTime((int)mid)) 
+            *fLog << warn << "Could not fill Time of pixel: " << pixid << " time = " << (int)mid << endl;
 
 
@@ -362,7 +387,4 @@
 
       } /* while (pixel.Next()) */
-
-    if (cosmicpix > 300.)
-	fCosmics++;
 
     return kTRUE;
@@ -389,10 +411,13 @@
   // Fit the blind pixel
   //
-  if (TESTBIT(fFlags,kUseBPFit))
+  if (TESTBIT(fFlags,kUseBlindPixelFit))
     {
-      if (!blindpixel.FitQ()) 
+      if (blindpixel.FitCharge())
+        if (!fCalibrations->CalcNrPhotInnerPixel())
+          *fLog << err << dbginf << "Could not calculate Number of photons from the blind pixel " << endl;
+      else
         *fLog << err << dbginf << "Could not fit the blind pixel " << endl;
       
-      if (!blindpixel.FitT())
+      if (!blindpixel.FitTime())
         *fLog << warn << "Could not the Times of the blind pixel " << endl;
 
@@ -412,12 +437,12 @@
 
       const Float_t ped    = (*fPedestals)[pixid].GetPedestal() * fNumHiGainSamples;
-      const Float_t prms   = (*fPedestals)[pixid].GetPedestalRms() * fNumHiGainSamples;
+      const Float_t prms   = (*fPedestals)[pixid].GetPedestalRms() * TMath::Sqrt((float)fNumHiGainSamples);
 
       pix.SetPedestal(ped,prms);
 
-      if (TESTBIT(fFlags,kUseTFits))
-        pix.FitT();
+      if (TESTBIT(fFlags,kUseTimeFits))
+        pix.FitTime();
       
-      pix.FitQ();
+      pix.FitCharge();
     }
 
Index: trunk/MagicSoft/Mars/manalysis/MCalibrationCalc.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MCalibrationCalc.h	(revision 2602)
+++ trunk/MagicSoft/Mars/manalysis/MCalibrationCalc.h	(revision 2603)
@@ -47,7 +47,7 @@
   enum
     {
-      kUseTFits = 1,
-      kUseBPFit = 2,
-      kUsePDFit = 3
+      kUseTimeFits = 1,
+      kUseBlindPixelFit = 2,
+      kUsePinDiodeFit = 3
     };
 
@@ -69,10 +69,10 @@
   MCalibrationCalc(const char *name=NULL, const char *title=NULL);
 
-  void SetSkipTFits(Bool_t b=kTRUE)
-      {b ? CLRBIT(fFlags, kUseTFits) : SETBIT(fFlags, kUseTFits);}
-  void SetSkipBPFit(Bool_t b=kTRUE)
-      {b ? CLRBIT(fFlags, kUseBPFit) : SETBIT(fFlags, kUseBPFit);}
-  void SetSkipPDFit(Bool_t b=kTRUE)
-      {b ? CLRBIT(fFlags, kUsePDFit) : SETBIT(fFlags, kUsePDFit);}
+  void SetSkipTimeFits(Bool_t b=kTRUE)
+      {b ? CLRBIT(fFlags, kUseTimeFits) : SETBIT(fFlags, kUseTimeFits);}
+  void SetSkipBlindPixelFit(Bool_t b=kTRUE)
+      {b ? CLRBIT(fFlags, kUseBlindPixelFit) : SETBIT(fFlags, kUseBlindPixelFit);}
+  void SetSkipPinDiodeFit(Bool_t b=kTRUE)
+      {b ? CLRBIT(fFlags, kUsePinDiodeFit) : SETBIT(fFlags, kUsePinDiodeFit);}
 
   void SetPulserColor(PulserColor_t color)    { fColor = color; }
Index: trunk/MagicSoft/Mars/manalysis/MCalibrationCam.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MCalibrationCam.cc	(revision 2602)
+++ trunk/MagicSoft/Mars/manalysis/MCalibrationCam.cc	(revision 2603)
@@ -56,5 +56,6 @@
 //
 MCalibrationCam::MCalibrationCam(const char *name, const char *title)
-    : fMeanNrPhotAvailable(kFALSE)
+    : fMeanNrPhotAvailable(kFALSE),
+      fMeanNrPhotInnerPix(-1.)
 {
     fName  = name  ? name  : "MCalibrationCam";
@@ -128,5 +129,4 @@
     return NULL;
   
-//    return (*this)[idx];
   return (MCalibrationPix*)fPixels->At(idx);
 }
@@ -148,10 +148,10 @@
     return kFALSE;
 
-  return (&(*this)[idx]);
+  return kTRUE;
 }
 
 Bool_t MCalibrationCam::IsPixelFitted(Int_t idx) const 
 {
-  return ((*this)[idx].GetRQ() > 0. && (*this)[idx].GetErrRQ() > 0.);
+  return ((*this)[idx].GetRCharge() > 0. && (*this)[idx].GetErrRCharge() > 0.);
 }
 
@@ -170,5 +170,5 @@
 // The number of succesful fits is returned
 //
-UShort_t MCalibrationCam::FitQ(Int_t i)
+UShort_t MCalibrationCam::FitCharge(Int_t i)
 {
 
@@ -189,5 +189,5 @@
       while ((pix=(MCalibrationPix*)Next()))
         {
-          if (pix->FitQ())
+          if (pix->FitCharge())
             nsuccess++;
         }
@@ -195,5 +195,5 @@
   else                  // fit only the pixel with index i
     {
-      if((*this)[i].FitQ())
+      if((*this)[i].FitCharge())
         nsuccess++;
     }
@@ -209,5 +209,5 @@
 // The number of succesful fits is returned
 //
-UShort_t MCalibrationCam::FitAllQ()
+UShort_t MCalibrationCam::FitAllCharge()
 {
 
@@ -222,12 +222,12 @@
   while ((pix=(MCalibrationPix*)Next()))
     {
-      if (pix->FitQ())
-        nsuccess++;
-    }
-  
-  if (fBlindPixel->FitQ())
-        nsuccess++;
-
-  if (fPINDiode->FitQ())
+      if (pix->FitCharge())
+        nsuccess++;
+    }
+  
+  if (fBlindPixel->FitCharge())
+        nsuccess++;
+
+  if (fPINDiode->FitCharge())
         nsuccess++;
 
@@ -245,5 +245,5 @@
 // The number of succesful fits is returned
 //
-UShort_t MCalibrationCam::FitT(Int_t i)
+UShort_t MCalibrationCam::FitTime(Int_t i)
 {
 
@@ -264,5 +264,5 @@
       while ((pix=(MCalibrationPix*)Next()))
         {
-         if (pix->FitT())
+         if (pix->FitTime())
             nsuccess++;
         }
@@ -270,5 +270,5 @@
   else                     // fit only the pixel with index i
     {
-      if((*this)[i].FitT())
+      if((*this)[i].FitTime())
         nsuccess++;
     }
@@ -285,5 +285,5 @@
 // The number of succesful fits is returned
 //
-UShort_t MCalibrationCam::FitAllT()
+UShort_t MCalibrationCam::FitAllTime()
 {
 
@@ -298,12 +298,12 @@
   while ((pix=(MCalibrationPix*)Next()))
     {
-      if (pix->FitT())
-        nsuccess++;
-    }
-  
-  if (fBlindPixel->FitT())
-        nsuccess++;
-
-  if (fPINDiode->FitT())
+      if (pix->FitTime())
+        nsuccess++;
+    }
+  
+  if (fBlindPixel->FitTime())
+        nsuccess++;
+
+  if (fPINDiode->FitTime())
        nsuccess++;
 
@@ -364,6 +364,7 @@
     {
 
-        *fLog << id << ": " << pix->GetPed() << " " << pix->GetPedRms() << " Charges: " ;
-        *fLog << pix->GetQ() << " " << pix->GetRQ() << endl;
+        *fLog << id << " Pedestals: " << pix->GetPed() << " +- " << pix->GetPedRms() << " Charge: " 
+              << pix->GetCharge() << " Reduced Charge: " << pix->GetRCharge() << " +- " 
+              << pix->GetSigmaCharge() << " Reduced Sigma: " << pix->GetRSigma() << endl;
 
         id++;
@@ -378,26 +379,26 @@
     {
     case 0:
-       val = (*this)[idx].GetQ();
+       val = (*this)[idx].GetCharge();
 	break;
     case 1:
-       val = (*this)[idx].GetErrQ();
+       val = (*this)[idx].GetErrCharge();
 	break;
     case 2:
-       val = (*this)[idx].GetSigmaQ();
+       val = (*this)[idx].GetSigmaCharge();
         break;
     case 3:
-       val = (*this)[idx].GetErrSigmaQ();
+       val = (*this)[idx].GetErrSigmaCharge();
 	break;
     case 4:
-       val = (*this)[idx].GetQProb();
+       val = (*this)[idx].GetChargeProb();
 	break;
     case 5:
-       val = (*this)[idx].GetT();
+       val = (*this)[idx].GetTime();
 	break;
     case 6:
-       val = (*this)[idx].GetSigmaT();
+       val = (*this)[idx].GetSigmaTime();
 	break;
     case 7:
-       val = (*this)[idx].GetTProb();
+       val = (*this)[idx].GetTimeProb();
 	break;
     case 8:
@@ -408,8 +409,8 @@
 	break;
     case 10:
-      val = (*this)[idx].GetRQ();
-        break;
+      val = (*this)[idx].GetRCharge();
+      break;
     case 11:
-      val = (*this)[idx].GetErrRQ();
+      val = (*this)[idx].GetRSigma();
       break;
     case 12:
@@ -419,4 +420,13 @@
       val = (*this)[idx].GetConversionFFactorMethod();
       break;
+    case 14:
+      val = (double)fMeanNrPhotInnerPix;
+      break;
+    case 15:
+      if ((fMeanNrPhotInnerPix > 0. ) && ((*this)[idx].GetRCharge() > 100.))
+        val = fMeanNrPhotInnerPix / (*this)[idx].GetRCharge();
+      else 
+        val = -1.;
+      break;
     default:
       return kFALSE;
@@ -443,20 +453,17 @@
     {
     case kECGreen:
-      fMeanNrPhotInnerPix = mean / 
-                           (gkCalibrationBlindPixelQEGreen
-                            *TMath::Power(10,gkCalibrationBlindPixelAttGreen)
-                            *gkCalibrationBlindPixelArea);
+      fMeanNrPhotInnerPix = (mean / gkCalibrationBlindPixelQEGreen) // real photons
+                            *TMath::Power(10,gkCalibrationBlindPixelAttGreen) // correct for absorption 
+                            / gkCalibrationBlindPixelArea;          // correct for area
       break;
     case kECBlue:
-      fMeanNrPhotInnerPix = mean / 
-                           (gkCalibrationBlindPixelQEBlue
+      fMeanNrPhotInnerPix = (mean / gkCalibrationBlindPixelQEBlue )
                             *TMath::Power(10,gkCalibrationBlindPixelAttBlue)
-                            *gkCalibrationBlindPixelArea);
+                            / gkCalibrationBlindPixelArea;
       break;
     case kECUV:
-      fMeanNrPhotInnerPix = mean / 
-                           (gkCalibrationBlindPixelQEUV
+      fMeanNrPhotInnerPix = (mean / gkCalibrationBlindPixelQEUV )
                             *TMath::Power(10,gkCalibrationBlindPixelAttUV)
-                            *gkCalibrationBlindPixelArea);
+                            / gkCalibrationBlindPixelArea;
       break;
     }
@@ -478,5 +485,5 @@
       return kFALSE;
 
-  mean = fMeanNrPhotInnerPix / (*this)[ipx].GetRQ();
+  mean = fMeanNrPhotInnerPix / (*this)[ipx].GetRCharge();
 
   //
Index: trunk/MagicSoft/Mars/manalysis/MCalibrationCam.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MCalibrationCam.h	(revision 2602)
+++ trunk/MagicSoft/Mars/manalysis/MCalibrationCam.h	(revision 2603)
@@ -33,8 +33,8 @@
   
   Int_t fNumPixels;
-  TClonesArray *fPixels;             // FIXME: Change TClonesArray away from a pointer?
+  TClonesArray *fPixels;             //! FIXME: Change TClonesArray away from a pointer?
   
-  MCalibrationBlindPix *fBlindPixel; // containing blind pixel data with fitresults
-  MCalibrationPINDiode *fPINDiode;   // containing PIN Diode data with fit results    
+  MCalibrationBlindPix *fBlindPixel; //! containing blind pixel data with fitresults
+  MCalibrationPINDiode *fPINDiode;   //! containing PIN Diode data with fit results    
 
   Float_t fMeanNrPhotInnerPix;       // The mean number of photons in an inner pixel  
@@ -42,6 +42,4 @@
   Bool_t  fMeanNrPhotAvailable;
 
-  Bool_t CalcNrPhotInnerPixel();
-  
 public:
   
@@ -70,8 +68,8 @@
   MCalibrationPix &operator[](Int_t i) const;
   
-  UShort_t FitQ(Int_t i=-1);
-  UShort_t FitAllQ();
-  UShort_t FitT(Int_t i=-1);
-  UShort_t FitAllT();
+  UShort_t FitCharge(Int_t i=-1);
+  UShort_t FitAllCharge();
+  UShort_t FitTime(Int_t i=-1);
+  UShort_t FitAllTime();
   
   Bool_t CheckBounds(Int_t i) const;
@@ -81,4 +79,5 @@
   void CutEdges();
   
+  Bool_t CalcNrPhotInnerPixel();
   Bool_t GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0) const;
   void DrawPixelContent(Int_t num) const;    
Index: trunk/MagicSoft/Mars/manalysis/MCalibrationConfig.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MCalibrationConfig.h	(revision 2602)
+++ trunk/MagicSoft/Mars/manalysis/MCalibrationConfig.h	(revision 2603)
@@ -15,5 +15,5 @@
 
 // The conversion factor between High Gain and Low Gain
-const UShort_t gkConversionHiLo = 10;
+const UShort_t gkConversionHiLo = 10.;
 
 // The penalty constant to produce overflow in the histogram 
@@ -26,7 +26,7 @@
 
 // Average QE of Blind Pixel (three colours)
-const Float_t gkCalibrationBlindPixelQEGreen = 15.4;
-const Float_t gkCalibrationBlindPixelQEBlue  = 22.6;
-const Float_t gkCalibrationBlindPixelQEUV    = 24.7;
+const Float_t gkCalibrationBlindPixelQEGreen = 0.154;
+const Float_t gkCalibrationBlindPixelQEBlue  = 0.226;
+const Float_t gkCalibrationBlindPixelQEUV    = 0.247;
 
 // Attenuation factor Blind Pixel (three colours)
Index: trunk/MagicSoft/Mars/manalysis/MCalibrationPINDiode.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MCalibrationPINDiode.cc	(revision 2602)
+++ trunk/MagicSoft/Mars/manalysis/MCalibrationPINDiode.cc	(revision 2603)
@@ -43,5 +43,15 @@
 //
 MCalibrationPINDiode::MCalibrationPINDiode(const char *name, const char *title)
-    : fHist(NULL)
+  : fHist(NULL),
+    fCharge(-1.),
+    fErrCharge(-1.),
+    fPed(-1.),
+    fPedRms(-1.),
+    fSigmaCharge(-1.),
+    fErrSigmaCharge(-1.),
+    fTime(-1.),
+    fErrTime(-1.),
+    fRCharge(-1.),
+    fErrRCharge(-1.)
 {
 
@@ -50,10 +60,4 @@
 
   fHist = new MHCalibrationPINDiode();
-
-  fQ   = fErrQ     = 0.;
-  fPed = fPedRms   = 0.;
-  fT   = fErrT  = 0.;
-  fRQ  = fErrRQ = 0.;
-  fSigmaQ = fErrSigmaQ = 0.;
 
 }
@@ -73,13 +77,13 @@
 }
 
-Bool_t MCalibrationPINDiode::FitQ() 
+Bool_t MCalibrationPINDiode::FitCharge() 
 {
-  if(!fHist->FitQ())
+  if(!fHist->FitCharge())
     return kFALSE;
 
-  fQ         = fHist->GetQMean();
-  fErrQ      = fHist->GetQMeanErr(); 
-  fSigmaQ    = fHist->GetQSigma();
-  fErrSigmaQ = fHist->GetQSigmaErr();
+  fCharge         = fHist->GetChargeMean();
+  fErrCharge      = fHist->GetChargeMeanErr(); 
+  fSigmaCharge    = fHist->GetChargeSigma();
+  fErrSigmaCharge = fHist->GetChargeSigmaErr();
 
   return kTRUE;
@@ -87,12 +91,12 @@
 }
 
-Bool_t MCalibrationPINDiode::FitT() 
+Bool_t MCalibrationPINDiode::FitTime() 
 {
 
-  if(!fHist->FitT())
+  if(!fHist->FitTime())
     return kFALSE;
 
-  fT = fHist->GetT();
-  fErrT = fHist->GetErrT();
+  fTime    = fHist->GetTime();
+  fErrTime = fHist->GetErrTime();
   
   return kTRUE;
Index: trunk/MagicSoft/Mars/manalysis/MCalibrationPINDiode.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MCalibrationPINDiode.h	(revision 2602)
+++ trunk/MagicSoft/Mars/manalysis/MCalibrationPINDiode.h	(revision 2603)
@@ -12,17 +12,17 @@
 private:
 
-  Float_t fQ;                // The mean charge after the fit
-  Float_t fErrQ;             // The error of mean charge after the fit
+  MHCalibrationPINDiode *fHist; // Pointer to the histograms performing the fits, etc.  
+  
+  Float_t fCharge;                // The mean charge after the fit
+  Float_t fErrCharge;             // The error of mean charge after the fit
   Float_t fPed;              // The mean pedestal (from MPedestalPix)
   Float_t fPedRms;           // The pedestal  RMS (from MPedestalPix)
-  Float_t fSigmaQ;           // The sigma of the mean charge after the fit
-  Float_t fErrSigmaQ;        // The error of the sigma of the mean charge after the fit
-  Float_t fT;                // The mean arrival time after the fit  
-  Float_t fErrT;             // The error of the mean arrival time after the fit
+  Float_t fSigmaCharge;           // The sigma of the mean charge after the fit
+  Float_t fErrSigmaCharge;        // The error of the sigma of the mean charge after the fit
+  Float_t fTime;                // The mean arrival time after the fit  
+  Float_t fErrTime;             // The error of the mean arrival time after the fit
   
-  Float_t fRQ;               // The reduced mean charge after the fit
-  Float_t fErrRQ;            // The error of the reduced mean charge after the fit  
-  
-  MHCalibrationPINDiode *fHist; // Pointer to the histograms performing the fits, etc.  
+  Float_t fRCharge;               // The reduced mean charge after the fit
+  Float_t fErrRCharge;            // The error of the reduced mean charge after the fit  
   
 public:
@@ -36,12 +36,12 @@
   void SetPedRms(Float_t pedrms)    { fPedRms   = pedrms; }
 
-  Bool_t IsValid() const { return fRQ >=0 || fErrRQ >= 0; }
+  Bool_t IsValid() const { return fRCharge >=0 || fErrRCharge >= 0; }
 
-  Bool_t FillQ(Int_t q)            { return fHist->FillQ(q); }
-  Bool_t FillT(Int_t t)            { return fHist->FillT(t); }  
-  Bool_t FillRQvsT(Float_t rq, Int_t t) { return fHist->FillQvsN(rq,t); }    
+  Bool_t FillCharge(Int_t q)            { return fHist->FillCharge(q); }
+  Bool_t FillTime(Int_t t)            { return fHist->FillTime(t); }  
+  Bool_t FillRChargevsTime(Float_t rq, Int_t t) { return fHist->FillChargevsN(rq,t); }    
   
-  Bool_t FitQ();
-  Bool_t FitT();
+  Bool_t FitCharge();
+  Bool_t FitTime();
   
   MHCalibrationPINDiode *GetHist()  const  { return fHist;  }
Index: trunk/MagicSoft/Mars/manalysis/MCalibrationPix.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MCalibrationPix.cc	(revision 2602)
+++ trunk/MagicSoft/Mars/manalysis/MCalibrationPix.cc	(revision 2603)
@@ -25,5 +25,5 @@
 /////////////////////////////////////////////////////////////////////////////
 //                                                                         //
-// MCalibrationPix                                                            //
+// MCalibrationPix                                                         //
 //                                                                         //
 // This is the storage container to hold informations about the pedestal   //
@@ -46,16 +46,17 @@
 MCalibrationPix::MCalibrationPix(const char *name, const char *title)
     : fPixId(-1),
-      fQ(-1.),
-      fErrQ(-1.),
-      fSigmaQ(-1.),
-      fErrSigmaQ(-1.),
-      fQProb(-1.),
+      fCharge(-1.),
+      fErrCharge(-1.),
+      fSigmaCharge(-1.),
+      fErrSigmaCharge(-1.),
+      fChargeProb(-1.),
       fPed(-1.),
       fPedRms(-1.),
-      fT(-1.),
-      fSigmaT(-1.),
-      fTProb(-1.),
-      fRQ(-1.),
-      fErrRQ(-1.),
+      fTime(-1.),
+      fSigmaTime(-1.),
+      fTimeProb(-1.),
+      fRCharge(-1.),
+      fErrRCharge(-1.),
+      fRSigma(-1.),
       fFactor(1.3),
       fPheFFactorMethod(-1.),
@@ -66,5 +67,6 @@
   fTitle = title ? title : "Container of the MHCalibrationPixels and the fit results";
 
-  fHist = new MHCalibrationPixel("MHCalibrationPixel","Calibration Histograms Pixel");
+  fHist = new MHCalibrationPixel("MHCalibrationPixel","Calibration Histograms Pixel ");
+
 }
 
@@ -75,5 +77,5 @@
 
 
-void MCalibrationPix::ChangePixId(Int_t i)
+void MCalibrationPix::DefinePixId(Int_t i)
 {
   
@@ -93,41 +95,47 @@
 }
 
-Bool_t MCalibrationPix::FitQ() 
+Bool_t MCalibrationPix::FitCharge() 
 {
 
-  if (fHist->IsFitted())
+  if (fHist->IsFitOK())
     return kTRUE;
 
   if (fPed && fPedRms)
-    fHist->SetLowerFitRange(fPed + 2.0*fPedRms);
+    fHist->SetLowerFitRange(fPed + 1.5*fPedRms);
   else
     *fLog << warn << "Cannot set lower fit range to suppress cosmics: Pedestals not available" << endl;
 
-  if(!fHist->FitQ())
+  if(!fHist->FitCharge())
     {
       *fLog << warn << "Could not fit charges of pixel " << fPixId << endl;
-      fHist->PrintQFitResult();
+      fHist->PrintChargeFitResult();
       return kFALSE;
     }
   
-  fQ         = fHist->GetQMean();
-  fErrQ      = fHist->GetQMeanErr(); 
-  fSigmaQ    = fHist->GetQSigma();
-  fErrSigmaQ = fHist->GetQSigmaErr();
-  fQProb     = fHist->GetQProb();
+  fCharge         = fHist->GetChargeMean();
+  fErrCharge      = fHist->GetChargeMeanErr(); 
+  fSigmaCharge    = fHist->GetChargeSigma();
+  fErrSigmaCharge = fHist->GetChargeSigmaErr();
+  fChargeProb     = fHist->GetChargeProb();
 
   if ((fPed > 0.)  && (fPedRms > 0.))
     {
       
-    fRQ      = fQ - fPed;
-    fErrRQ   = TMath::Sqrt(fErrQ*fErrQ + fPedRms*fPedRms);
+    fRCharge      = fCharge - fPed;
+    fErrRCharge   = TMath::Sqrt(fErrCharge*fErrCharge + fPedRms*fPedRms);
 
-    fPheFFactorMethod = 
-      fFactor 
-      * fRQ * fRQ 
-      / (fSigmaQ * fSigmaQ - fPedRms*fPedRms) ;
+    fRSigma       = (fSigmaCharge*fSigmaCharge) - (fPedRms*fPedRms);
 
-    fConversionFFactorMethod = fPheFFactorMethod / fRQ ;
-    
+    if (fRSigma > 0. )
+      {
+       fPheFFactorMethod =  fFactor * fRCharge*fRCharge / fRSigma;
+       fConversionFFactorMethod = fPheFFactorMethod / fRCharge ;
+      }
+    else
+      {
+	*fLog << warn << "Cannot apply F-Factor method: Reduced Sigmas are smaller than 0 in pixel: " 
+	      << fPixId << endl;
+      }
+
     }
 
@@ -142,27 +150,26 @@
   fPedRms = pedrms;
   
-  if ((!fRQ) && fQ) 
-    fRQ = fQ - fPed;
-  if ((!fErrRQ) && fErrQ)
-    fErrRQ   = TMath::Sqrt(fErrQ*fErrQ + fPedRms*fPedRms);
+  if ((fRCharge == -1.) && (fCharge > 0.)) 
+    fRCharge = fCharge - fPed;
+  if ((fErrRCharge == -1.) && (fErrCharge > 0.))
+    fErrRCharge   = TMath::Sqrt(fErrCharge*fErrCharge + fPedRms*fPedRms);
 
 }
 
-Bool_t MCalibrationPix::FitT() 
+Bool_t MCalibrationPix::FitTime() 
 {
 
-  if(!fHist->FitT())
+  if(!fHist->FitTime())
     {
       *fLog << warn << "Could not fit times of pixel " << fPixId << endl;
-      fHist->PrintTFitResult();
+      fHist->PrintTimeFitResult();
       return kFALSE;
     }
 
-  fT       = fHist->GetTMean();
-  fSigmaT  = fHist->GetTSigma();
-  fTProb   = fHist->GetTProb();
+  fTime       = fHist->GetTimeMean();
+  fSigmaTime  = fHist->GetTimeSigma();
+  fTimeProb   = fHist->GetTimeProb();
 
   return kTRUE;
-  
 }
 
Index: trunk/MagicSoft/Mars/manalysis/MCalibrationPix.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MCalibrationPix.h	(revision 2602)
+++ trunk/MagicSoft/Mars/manalysis/MCalibrationPix.h	(revision 2603)
@@ -14,25 +14,26 @@
   Int_t   fPixId;           // the pixel Id
   
-  Float_t fQ;                // The mean charge after the fit
-  Float_t fErrQ;             // The error of mean charge after the fit
-  Float_t fSigmaQ;           // The sigma of the mean charge after the fit
-  Float_t fErrSigmaQ;        // The error of the sigma of the mean charge after the fit
-  Float_t fQProb;            // The probability of the fit function 
+  Float_t fCharge;              // The mean charge after the fit
+  Float_t fErrCharge;           // The error of mean charge after the fit
+  Float_t fSigmaCharge;         // The sigma of the mean charge after the fit
+  Float_t fErrSigmaCharge;      // The error of the sigma of the mean charge after the fit
+  Float_t fChargeProb;          // The probability of the fit function 
 
-  Float_t fPed;              // The mean pedestal (from MPedestalPix)
-  Float_t fPedRms;           // The pedestal  RMS (from MPedestalPix)
+  Float_t fPed;                 // The mean pedestal (from MPedestalPix)
+  Float_t fPedRms;              // The pedestal  RMS (from MPedestalPix)
 
-  Float_t fT;                // The mean arrival time after the fit  
-  Float_t fSigmaT;           // The error of the mean arrival time after the fit
-  Float_t fTProb;            // The probability of the fit function 
+  Float_t fTime;                // The mean arrival time after the fit  
+  Float_t fSigmaTime;           // The error of the mean arrival time after the fit
+  Float_t fTimeProb;            // The probability of the fit function 
   
-  Float_t fRQ;               // The reduced mean charge after the fit
-  Float_t fErrRQ;            // The error of the reduced mean charge after the fit  
+  Float_t fRCharge;             // The reduced mean charge after the fit
+  Float_t fErrRCharge;          // The error of the reduced mean charge after the fit  
+  Float_t fRSigma;              // The reduced squares of sigmas after the fit
+  
+  Float_t fFactor;                  // The laboratory F-factor
+  Float_t fPheFFactorMethod;        // The number of Phe's calculated after the F-factor method
+  Float_t fConversionFFactorMethod; // The conversion factor to Phe's calculated after the F-factor method
 
-  Float_t fFactor;            // The F-factor
-  Float_t fPheFFactorMethod;  // The number of Phe's calculated after the F-factor method
-  Float_t fConversionFFactorMethod; // The conversion factor to Phe's calculated after the F-factor method
-    
-  MHCalibrationPixel *fHist; // Pointer to the histograms performing the fits, etc.  
+  MHCalibrationPixel *fHist;    //! Pointer to the histograms performing the fits, etc.  
   
 public:
@@ -43,38 +44,39 @@
   void Clear(Option_t *o="");
 
-  Float_t GetQ()     const    { return fQ;     }
-  Float_t GetRQ()    const    { return fRQ;    }
+  Float_t GetCharge()         const    { return fCharge;         }
+  Float_t GetRCharge()        const    { return fRCharge;        }
+  Float_t GetRSigma()         const    { return fRSigma;         }
     
-  Float_t GetErrQ()  const    { return fErrQ;  }
-  Float_t GetErrRQ() const    { return fErrRQ; }    
-  Float_t GetQProb() const    { return fQProb;    }    
+  Float_t GetErrCharge()      const    { return fErrCharge;      }
+  Float_t GetErrRCharge()     const    { return fErrRCharge;     }    
+  Float_t GetChargeProb()     const    { return fChargeProb;     }    
   
-  Float_t GetSigmaQ()    const   { return fSigmaQ;    }
-  Float_t GetErrSigmaQ() const   { return fErrSigmaQ; }
-  Float_t GetT()         const   { return fT;         }
-  Float_t GetSigmaT()    const   { return fSigmaT;    }
-  Float_t GetTProb()     const   { return fTProb;    }    
+  Float_t GetSigmaCharge()    const    { return fSigmaCharge;    }
+  Float_t GetErrSigmaCharge() const    { return fErrSigmaCharge; }
+  Float_t GetTime()         const    { return fTime;         }
+  Float_t GetSigmaTime()    const    { return fSigmaTime;    }
+  Float_t GetTimeProb()     const    { return fTimeProb;     }    
   
-  Float_t GetPed()       const    { return fPed;     }
-  Float_t GetPedRms()    const    { return fPedRms;    }    
+  Float_t GetPed()          const    { return fPed;       }
+  Float_t GetPedRms()       const    { return fPedRms;    }    
 
-  void SetPedestal(Float_t ped, Float_t pedrms);       
+  void SetPedestal(Float_t ped, Float_t pedrms);
 
-  Bool_t FillQ(Int_t q)                 { return fHist->FillQ(q); }
-  Bool_t FillT(Int_t t)                 { return fHist->FillT(t); }  
-  Bool_t FillRQvsT(Float_t rq, Int_t t) { return fHist->FillQvsN(rq,t); }    
+  Bool_t FillCharge(Int_t q)           { return fHist->FillCharge(q); }
+  Bool_t FillTime(Int_t t)             { return fHist->FillTime(t); }  
+  Bool_t FillRChargevsTime(Float_t rq, Int_t t) { return fHist->FillChargevsN(rq,t); }    
   
-  Bool_t IsValid()      const           { return fRQ >=0 || fErrRQ >= 0; }
-  Int_t  GetPixId()     const           { return fPixId;   }
-  void ChangePixId(Int_t i);
+  Bool_t IsValid()          const    { return fRCharge >=0 || fErrRCharge >= 0; }
+  Int_t  GetPixId()         const    { return fPixId;   }
+  void   DefinePixId(Int_t i);
   
-  Bool_t FitQ();
-  Bool_t FitT();
+  Bool_t FitCharge();
+  Bool_t FitTime();
   
-  MHCalibrationPixel *GetHist()     const  { return fHist;  }
-  virtual void Draw(Option_t *opt="")     { fHist->Draw(opt); }
+  MHCalibrationPixel *GetHist() const  { return fHist;  }
+  virtual void Draw(Option_t *opt="")   { fHist->Draw(opt); }
   
-  Float_t GetPheFFactorMethod() const        { return fPheFFactorMethod;  }  
-  Float_t GetConversionFFactorMethod() const { return fConversionFFactorMethod;  }
+  Float_t GetPheFFactorMethod()           const { return fPheFFactorMethod;           }  
+  Float_t GetConversionFFactorMethod()    const { return fConversionFFactorMethod;    }
   
   ClassDef(MCalibrationPix, 1)	// Storage Container for Calibration information of one pixel
Index: trunk/MagicSoft/Mars/mhist/MHCalibrationBlindPixel.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHCalibrationBlindPixel.cc	(revision 2602)
+++ trunk/MagicSoft/Mars/mhist/MHCalibrationBlindPixel.cc	(revision 2603)
@@ -69,22 +69,22 @@
 
     // Create a large number of bins, later we will rebin
-    fBlindPixelQfirst = 0;
-    fBlindPixelQlast  = gkStartBlindPixelBinNr;
-    fBlindPixelQnbins = gkStartBlindPixelBinNr;
-
-    fHBlindPixelQ = new TH1I("HBlindPixelQ","Distribution of Summed FADC Slices",fBlindPixelQnbins,fBlindPixelQfirst,fBlindPixelQlast);
-    fHBlindPixelQ->SetXTitle("Sum FADC Slices");
-    fHBlindPixelQ->SetYTitle("Nr. of events");
-    fHBlindPixelQ->Sumw2();
-
-    fErrBlindPixelQfirst = 0.;
-    fErrBlindPixelQlast  = gkStartBlindPixelBinNr;
-    fErrBlindPixelQnbins = gkStartBlindPixelBinNr;
-
-    fHBlindPixelErrQ = new TH1F("HBlindPixelErrQ","Distribution of Variances of Summed FADC Slices",
-                        fErrBlindPixelQnbins,fErrBlindPixelQfirst,fErrBlindPixelQlast);
-    fHBlindPixelErrQ->SetXTitle("Variance Summed FADC Slices");
-    fHBlindPixelErrQ->SetYTitle("Nr. of events");
-    fHBlindPixelErrQ->Sumw2();
+    fBlindPixelChargefirst = 0;
+    fBlindPixelChargelast  = gkStartBlindPixelBinNr;
+    fBlindPixelChargenbins = gkStartBlindPixelBinNr;
+
+    fHBlindPixelCharge = new TH1I("HBlindPixelCharge","Distribution of Summed FADC Slices",fBlindPixelChargenbins,fBlindPixelChargefirst,fBlindPixelChargelast);
+    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();
 
     Axis_t tfirst = -0.5;
@@ -92,8 +92,8 @@
     Int_t nbins   = 16;
 
-    fHBlindPixelT = new TH1I("HBlindPixelT","Distribution of Mean Arrival Times",nbins,tfirst,tlast);
-    fHBlindPixelT->SetXTitle("Mean Arrival Times [FADC slice nr]");
-    fHBlindPixelT->SetYTitle("Nr. of events");
-    fHBlindPixelT->Sumw2();
+    fHBlindPixelTime = new TH1I("HBlindPixelTime","Distribution of Mean Arrival Times",nbins,tfirst,tlast);
+    fHBlindPixelTime->SetXTitle("Mean Arrival Times [FADC slice nr]");
+    fHBlindPixelTime->SetYTitle("Nr. of events");
+    fHBlindPixelTime->Sumw2();
 
     // We define a reasonable number and later enlarge it if necessary
@@ -102,7 +102,7 @@
     Axis_t nlast  = (Axis_t)nbins - 0.5;
 
-    fHBlindPixelQvsN = new TH1I("HBlindPixelQvsN","Sum of Charges vs. Event Number",nbins,nfirst,nlast);
-    fHBlindPixelQvsN->SetXTitle("Event Nr.");
-    fHBlindPixelQvsN->SetYTitle("Sum of FADC slices");
+    fHBlindPixelChargevsN = new TH1I("HBlindPixelChargevsN","Sum of Charges vs. Event Number",nbins,nfirst,nlast);
+    fHBlindPixelChargevsN->SetXTitle("Event Nr.");
+    fHBlindPixelChargevsN->SetYTitle("Sum of FADC slices");
 
     fgSinglePheFitFunc = &gfKto8;
@@ -113,7 +113,7 @@
 {
 
-  delete fHBlindPixelQ;
-  delete fHBlindPixelT;
-  delete fHBlindPixelErrQ;
+  delete fHBlindPixelCharge;
+  delete fHBlindPixelTime;
+  delete fHBlindPixelErrCharge;
   
   if (fSinglePheFit)
@@ -127,7 +127,7 @@
 void MHCalibrationBlindPixel::ResetBin(Int_t i)
 {
-    fHBlindPixelQ->SetBinContent (i, 1.e-20);
-    fHBlindPixelErrQ->SetBinContent  (i, 1.e-20);
-    fHBlindPixelT->SetBinContent(i, 1.e-20);
+    fHBlindPixelCharge->SetBinContent (i, 1.e-20);
+    fHBlindPixelErrCharge->SetBinContent  (i, 1.e-20);
+    fHBlindPixelTime->SetBinContent(i, 1.e-20);
 }
 
@@ -150,30 +150,30 @@
   fFitLegend->SetTextSize(0.05);
 
-  char line1[32];
-  sprintf(line1,"Mean: #lambda = %2.2f #pm %2.2f",GetLambda(),GetLambdaErr());
+  const TString line1 = 
+  Form("Mean: #lambda = %2.2f #pm %2.2f",GetLambda(),GetLambdaErr());
   fFitLegend->AddText(line1);
 
-  char line2[32];
-  sprintf(line2,"Pedestal: #mu_{0} = %2.2f #pm %2.2f",GetMu0(),GetMu0Err());
+  const TString line2 = 
+  Form("Pedestal: #mu_{0} = %2.2f #pm %2.2f",GetMu0(),GetMu0Err());
   fFitLegend->AddText(line2);
 
-  char line3[32];
-  sprintf(line3,"Width Pedestal: #sigma_{0} = %2.2f #pm %2.2f",GetSigma0(),GetSigma0Err());
+  const TString line3 =
+  Form("Width Pedestal: #sigma_{0} = %2.2f #pm %2.2f",GetSigma0(),GetSigma0Err());
   fFitLegend->AddText(line3);
 
-  char line4[32];
-  sprintf(line4,"1^{st} Phe-peak: #mu_{1} = %2.2f #pm %2.2f",GetMu1(),GetMu1Err());
+  const TString line4 =
+  Form("1^{st} Phe-peak: #mu_{1} = %2.2f #pm %2.2f",GetMu1(),GetMu1Err());
   fFitLegend->AddText(line4);
 
-  char line5[32];
-  sprintf(line5,"Width 1^{st} Phe-peak: #sigma_{1} = %2.2f #pm %2.2f",GetSigma1(),GetSigma1Err());
+  const TString line5 =
+  Form("Width 1^{st} Phe-peak: #sigma_{1} = %2.2f #pm %2.2f",GetSigma1(),GetSigma1Err());
   fFitLegend->AddText(line5);
 
-  char line7[32];
-  sprintf(line7,"#chi^{2} / N_{dof}: %4.2f / %3i",GetChiSquare(),GetNdf());
+  const TString line7 =
+  Form("#chi^{2} / N_{dof}: %4.2f / %3i",GetChiSquare(),GetNdf());
   fFitLegend->AddText(line7);
 
-  char line8[32];
-  sprintf(line8,"Probability: %4.2f ",GetProb());
+  const TString line8 =
+  Form("Probability: %4.2f ",GetProb());
   fFitLegend->AddText(line8);
 
@@ -209,5 +209,5 @@
     gPad->SetTicks();
 
-    fHBlindPixelQ->DrawCopy(opt);
+    fHBlindPixelCharge->DrawCopy(opt);
     
     if (fSinglePheFit)
@@ -231,9 +231,9 @@
     gPad->SetLogy(1);
     gPad->SetBorderMode(0);
-    fHBlindPixelT->DrawCopy(opt);
-
-    if (fHBlindPixelT->GetFunction("GausTime"))
+    fHBlindPixelTime->DrawCopy(opt);
+
+    if (fHBlindPixelTime->GetFunction("GausTime"))
       {
-        TF1 *tfit = fHBlindPixelT->GetFunction("GausTime");
+        TF1 *tfit = fHBlindPixelTime->GetFunction("GausTime");
         if (tfit->GetProb() < 0.01)
           tfit->SetLineColor(kRed);
@@ -248,5 +248,5 @@
     c->cd(4);
 
-    fHBlindPixelQvsN->DrawCopy(opt);
+    fHBlindPixelChargevsN->DrawCopy(opt);
 
     c->Modified();
@@ -260,7 +260,7 @@
   gRandom->SetSeed();
 
-  if (fHBlindPixelQ->GetEntries() != 0)
+  if (fHBlindPixelCharge->GetEntries() != 0)
     {
-      *fLog << err << "Histogram " << fHBlindPixelQ->GetTitle() << " is already filled. " << endl;
+      *fLog << err << "Histogram " << fHBlindPixelCharge->GetTitle() << " is already filled. " << endl;
       *fLog << err << "Create new class MHCalibrationBlindPixel for simulation! " << endl;
       return kFALSE;
@@ -268,13 +268,13 @@
   
   TF1 *simulateSinglePhe = new TF1("simulateSinglePhe",fgSinglePheFitFunc,
-                                   fBlindPixelQfirst,fBlindPixelQlast,fgSinglePheFitNPar);
+                                   fBlindPixelChargefirst,fBlindPixelChargelast,fgSinglePheFitNPar);
   
   simulateSinglePhe->SetParameters(lambda,mu0,mu1,sigma0,sigma1);
   simulateSinglePhe->SetParNames("#lambda","#mu_0","#mu_1","#sigma_0","#sigma_1");
-  simulateSinglePhe->SetNpx(fBlindPixelQnbins);  
+  simulateSinglePhe->SetNpx(fBlindPixelChargenbins);  
 
   for (Int_t i=0;i<10000; i++) 
     {
-      fHBlindPixelQ->Fill(simulateSinglePhe->GetRandom());
+      fHBlindPixelCharge->Fill(simulateSinglePhe->GetRandom());
     }
   
@@ -303,6 +303,6 @@
   // Get the fitting ranges
   //
-  rmin = (rmin != 0.) ? rmin : fBlindPixelQfirst;
-  rmax = (rmax != 0.) ? rmax : fBlindPixelQlast;
+  rmin = (rmin != 0.) ? rmin : fBlindPixelChargefirst;
+  rmax = (rmax != 0.) ? rmax : fBlindPixelChargelast;
 
   //
@@ -310,7 +310,7 @@
   // otherwise the fit goes gaga because of high number of dimensions ...
   //
-  const Stat_t   entries      = fHBlindPixelQ->GetSumOfWeights();
+  const Stat_t   entries      = fHBlindPixelCharge->GetSumOfWeights();
   const Double_t lambda_guess = 0.2;
-  const Double_t mu_0_guess = fHBlindPixelQ->GetBinCenter(fHBlindPixelQ->GetMaximumBin());
+  const Double_t mu_0_guess = fHBlindPixelCharge->GetBinCenter(fHBlindPixelCharge->GetMaximumBin());
   const Double_t si_0_guess = mu_0_guess/10.;
   const Double_t mu_1_guess = mu_0_guess + 50.;
@@ -333,5 +333,5 @@
   // ROOT gives us another nice example of user-unfriendly behavior:
   // Although the normalization of the function fSinglePhe and the 
-  // Histogram fHBlindPixelQ agree (!!), the fit does not normalize correctly INTERNALLY
+  // Histogram fHBlindPixelCharge agree (!!), the fit does not normalize correctly INTERNALLY
   // in the fitting procedure !!!
   // 
@@ -343,6 +343,6 @@
   //
   //  const Int_t  npx     = fSinglePheFit->GetNpx();
-  //  const Int_t  bins    = fHBlindPixelQ->GetXaxis()->GetLast()-fHBlindPixelQ->GetXaxis()->GetFirst();
-  //  fHBlindPixelQ->Scale(gkSq2Pi*(float)bins/npx/entries);
+  //  const Int_t  bins    = fHBlindPixelCharge->GetXaxis()->GetLast()-fHBlindPixelCharge->GetXaxis()->GetFirst();
+  //  fHBlindPixelCharge->Scale(gkSq2Pi*(float)bins/npx/entries);
 
   // 
@@ -351,7 +351,7 @@
   // mysteries of ROOT which takes you a whole day to find out :-)
   //
-  //  fSinglePheFit->SetNpx(fQnbins);  
-
-  fHBlindPixelQ->Fit(fSinglePheFit,opt);
+  //  fSinglePheFit->SetNpx(fChargenbins);  
+
+  fHBlindPixelCharge->Fit(fSinglePheFit,opt);
 
   fLambda = fSinglePheFit->GetParameter(0);
@@ -405,20 +405,20 @@
   Int_t nbins = 50;
 
-  *fLog << "New number of bins in HSinQ: " << CutEdges(fHBlindPixelQ,nbins) << endl;
-
-  fBlindPixelQfirst = fHBlindPixelQ->GetBinLowEdge(fHBlindPixelQ->GetXaxis()->GetFirst());
-  fBlindPixelQlast  = fHBlindPixelQ->GetBinLowEdge(fHBlindPixelQ->GetXaxis()->GetLast())+fHBlindPixelQ->GetBinWidth(0);
-  fBlindPixelQnbins = nbins;
-
-  *fLog << "New number of bins in HErrQ: " << CutEdges(fHBlindPixelErrQ,30) << endl;
-  fErrBlindPixelQfirst = fHBlindPixelErrQ->GetBinLowEdge(fHBlindPixelErrQ->GetXaxis()->GetFirst());
-  fErrBlindPixelQlast  = fHBlindPixelErrQ->GetBinLowEdge(fHBlindPixelErrQ->GetXaxis()->GetLast())+fHBlindPixelErrQ->GetBinWidth(0);
-  fErrBlindPixelQnbins = nbins;
-
-  CutEdges(fHBlindPixelQvsN,0);
-
-}
-
-Bool_t MHCalibrationBlindPixel::FitT(Axis_t rmin, Axis_t rmax, Option_t *opt) 
+  *fLog << "New number of bins in HSinCharge: " << CutEdges(fHBlindPixelCharge,nbins) << endl;
+
+  fBlindPixelChargefirst = fHBlindPixelCharge->GetBinLowEdge(fHBlindPixelCharge->GetXaxis()->GetFirst());
+  fBlindPixelChargelast  = fHBlindPixelCharge->GetBinLowEdge(fHBlindPixelCharge->GetXaxis()->GetLast())+fHBlindPixelCharge->GetBinWidth(0);
+  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);
+
+}
+
+Bool_t MHCalibrationBlindPixel::FitTime(Axis_t rmin, Axis_t rmax, Option_t *opt) 
 {
   
@@ -429,6 +429,6 @@
   rmax = (rmax != 0.) ? rmax : 9.;
 
-  const Stat_t   entries     = fHBlindPixelT->GetEntries();
-  const Double_t mu_guess    = fHBlindPixelT->GetBinCenter(fHBlindPixelT->GetMaximumBin());
+  const Stat_t   entries     = fHBlindPixelTime->GetEntries();
+  const Double_t mu_guess    = fHBlindPixelTime->GetBinCenter(fHBlindPixelTime->GetMaximumBin());
   const Double_t sigma_guess = (rmax - rmin)/2.;
   const Double_t area_guess  = entries/gkSq2Pi;
@@ -441,5 +441,5 @@
   fTimeGausFit->SetParLimits(2,0.,rmax-rmin);
 
-  fHBlindPixelT->Fit(fTimeGausFit,opt);
+  fHBlindPixelTime->Fit(fTimeGausFit,opt);
 
   rmin = fTimeGausFit->GetParameter(1) - 2.*fTimeGausFit->GetParameter(2);
@@ -447,11 +447,11 @@
   fTimeGausFit->SetRange(rmin,rmax);  
 
-  fHBlindPixelT->Fit(fTimeGausFit,opt);
-
-
-  fMeanT     = fTimeGausFit->GetParameter(2);
-  fSigmaT    = fTimeGausFit->GetParameter(3);
-  fMeanTErr  = fTimeGausFit->GetParError(2);
-  fSigmaTErr = fTimeGausFit->GetParError(3);
+  fHBlindPixelTime->Fit(fTimeGausFit,opt);
+
+
+  fMeanTime     = fTimeGausFit->GetParameter(2);
+  fSigmaTime    = fTimeGausFit->GetParameter(3);
+  fMeanTimeErr  = fTimeGausFit->GetParError(2);
+  fSigmaTimeErr = fTimeGausFit->GetParError(3);
 
   Float_t prob = fTimeGausFit->GetProb();
Index: trunk/MagicSoft/Mars/mhist/MHCalibrationBlindPixel.h
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHCalibrationBlindPixel.h	(revision 2602)
+++ trunk/MagicSoft/Mars/mhist/MHCalibrationBlindPixel.h	(revision 2603)
@@ -32,19 +32,19 @@
 private:
 
-  TH1I* fHBlindPixelQ;        //-> Histogram with the single Phe spectrum
-  TH1F* fHBlindPixelErrQ;     //-> Variance of summed FADC slices
-  TH1I* fHBlindPixelT;        //-> Variance of summed FADC slices
-  TH1I* fHBlindPixelQvsN;     //-> Summed Charge vs. Event Nr. 
+  TH1I* fHBlindPixelCharge;        //-> Histogram with the single Phe spectrum
+  TH1F* fHBlindPixelErrCharge;     //-> Variance of summed FADC slices
+  TH1I* fHBlindPixelTime;        //-> Variance of summed FADC slices
+  TH1I* fHBlindPixelChargevsN;     //-> Summed Charge vs. Event Nr. 
   
   TF1 *fSinglePheFit;
   TF1 *fTimeGausFit;  
 
-  Axis_t  fBlindPixelQfirst;
-  Axis_t  fBlindPixelQlast;
-  Int_t   fBlindPixelQnbins;
+  Axis_t  fBlindPixelChargefirst;
+  Axis_t  fBlindPixelChargelast;
+  Int_t   fBlindPixelChargenbins;
   
-  Axis_t fErrBlindPixelQfirst;
-  Axis_t fErrBlindPixelQlast;
-  Int_t  fErrBlindPixelQnbins;
+  Axis_t fErrBlindPixelChargefirst;
+  Axis_t fErrBlindPixelChargelast;
+  Int_t  fErrBlindPixelChargenbins;
 
   void ResetBin(Int_t i);
@@ -73,8 +73,8 @@
   Int_t     fNdf;       
 
-  Double_t  fMeanT; 
-  Double_t  fMeanTErr; 
-  Double_t  fSigmaT; 
-  Double_t  fSigmaTErr; 
+  Double_t  fMeanTime; 
+  Double_t  fMeanTimeErr; 
+  Double_t  fSigmaTime; 
+  Double_t  fSigmaTimeErr; 
   
 public:
@@ -83,8 +83,8 @@
   ~MHCalibrationBlindPixel();
 
-  Bool_t FillBlindPixelQ(Int_t q)         { return fHBlindPixelQ->Fill(q) > -1;  }  
-  Bool_t FillErrBlindPixelQ(Float_t errq) { return fHBlindPixelErrQ->Fill(errq) > -1; }
-  Bool_t FillBlindPixelT(Int_t t)         { return fHBlindPixelT->Fill(t) > -1;  }
-  Bool_t FillBlindPixelQvsN(Stat_t rq, Int_t t) { return fHBlindPixelQvsN->Fill(t,rq) > -1;  }  
+  Bool_t FillBlindPixelCharge(Int_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;  }  
   
   const Double_t GetLambda()   const { return fLambda; }
@@ -104,11 +104,11 @@
   const Int_t    GetNdf()     const { return fNdf;       }   
 
-  const Double_t GetMeanT()      const { return fMeanT; }
-  const Double_t GetMeanTErr()    const { return fMeanTErr; }
-  const Double_t GetSigmaT()      const { return fSigmaT; }
-  const Double_t GetSigmaTErr()    const { return fSigmaTErr; }
+  const Double_t GetMeanTime()      const { return fMeanTime; }
+  const Double_t GetMeanTimeErr()    const { return fMeanTimeErr; }
+  const Double_t GetSigmaTime()      const { return fSigmaTime; }
+  const Double_t GetSigmaTimeErr()    const { return fSigmaTimeErr; }
 
-  const TH1F *GetHErrQ() { return fHBlindPixelErrQ; }
-  const TH1F *GetHErrQ() const { return fHBlindPixelErrQ; }
+  const TH1F *GetHErrCharge() { return fHBlindPixelErrCharge; }
+  const TH1F *GetHErrCharge() const { return fHBlindPixelErrCharge; }
   
   Bool_t SimulateSinglePhe(Double_t lambda,
@@ -119,5 +119,5 @@
   
   Bool_t FitSinglePhe(Axis_t rmin=0, Axis_t rmax=0, Option_t *opt="R0+");
-  Bool_t FitT(Axis_t rmin=0., Axis_t rmax=0.,Option_t *opt="R0+");
+  Bool_t FitTime(Axis_t rmin=0., Axis_t rmax=0.,Option_t *opt="R0+");
 
   void ChangeFitFunc(BlindPixelFitFunc fitfunc, Int_t par=5);
Index: trunk/MagicSoft/Mars/mhist/MHCalibrationConfig.h
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHCalibrationConfig.h	(revision 2602)
+++ trunk/MagicSoft/Mars/mhist/MHCalibrationConfig.h	(revision 2603)
@@ -20,10 +20,4 @@
 const Int_t gkStartPINDiodeBinNr = 4000;
 
-// Starting number of bins for the histo: (maximum possible by hardware = 40800)
-const Int_t gkStartPixelBinNr = 20000;
-
-// Starting number for the highest value of the Q-histo:
-const Axis_t gkStartQlast      = 10000.;
-
 // Square root of 2 pi:
 const Float_t gkSq2Pi = 2.506628274631;
Index: trunk/MagicSoft/Mars/mhist/MHCalibrationPINDiode.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHCalibrationPINDiode.cc	(revision 2602)
+++ trunk/MagicSoft/Mars/mhist/MHCalibrationPINDiode.cc	(revision 2603)
@@ -67,21 +67,21 @@
 
     // Create a large number of bins, later we will rebin
-    fQfirst = 0;
-    fQlast  = gkStartPINDiodeBinNr;
-    fQnbins = gkStartPINDiodeBinNr;
+    fChargeFirst = 0;
+    fChargeLast  = gkStartPINDiodeBinNr;
+    fChargeNbins = gkStartPINDiodeBinNr;
 
-    fHPQ = new TH1I("HPQ","Distribution of Summed FADC Slices",fQnbins,fQfirst,fQlast);
-    fHPQ->SetXTitle("Sum FADC Slices");
-    fHPQ->SetYTitle("Nr. of events");
-    fHPQ->Sumw2();
+    fHPCharge = new TH1I("HPCharge","Distribution of Summed FADC Slices",fChargeNbins,fChargeFirst,fChargeLast);
+    fHPCharge->SetXTitle("Sum FADC Slices");
+    fHPCharge->SetYTitle("Nr. of events");
+    fHPCharge->Sumw2();
 
-    fErrQfirst = 0.;
-    fErrQlast  = gkStartPINDiodeBinNr;
-    fErrQnbins = gkStartPINDiodeBinNr;
+    fErrChargeFirst = 0.;
+    fErrChargeLast  = gkStartPINDiodeBinNr;
+    fErrChargeNbins = gkStartPINDiodeBinNr;
 
-    fHErrQ = new TH1F("HErrQ","Distribution of Variances of Summed FADC Slices",fErrQnbins,fErrQfirst,fErrQlast);
-    fHErrQ->SetXTitle("Variance Summed FADC Slices");
-    fHErrQ->SetYTitle("Nr. of events");
-    fHErrQ->Sumw2();
+    fHErrCharge = new TH1F("HErrCharge","Distribution of Variances of Summed FADC Slices",fErrChargeNbins,fErrChargeFirst,fErrChargeLast);
+    fHErrCharge->SetXTitle("Variance Summed FADC Slices");
+    fHErrCharge->SetYTitle("Nr. of events");
+    fHErrCharge->Sumw2();
 
     Int_t tfirst = 0;
@@ -89,8 +89,8 @@
     Int_t nbins   = 32;
 
-    fHPT = new TH1I("HPT","Distribution of Mean Arrival Times",nbins,tfirst,tlast);
-    fHPT->SetXTitle("Mean Arrival Times [FADC slice nr]");
-    fHPT->SetYTitle("Nr. of events");
-    fHPT->Sumw2();
+    fHPTime = new TH1I("HPTime","Distribution of Mean Arrival Times",nbins,tfirst,tlast);
+    fHPTime->SetXTitle("Mean Arrival Times [FADC slice nr]");
+    fHPTime->SetYTitle("Nr. of events");
+    fHPTime->Sumw2();
 
 }
@@ -99,11 +99,11 @@
 {
 
-  delete fHPQ;
-  delete fHErrQ;
+  delete fHPCharge;
+  delete fHErrCharge;
   
   if (fVarGausFit)
     delete fVarGausFit;
   
-  delete fHPT;
+  delete fHPTime;
 
 }
Index: trunk/MagicSoft/Mars/mhist/MHCalibrationPINDiode.h
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHCalibrationPINDiode.h	(revision 2602)
+++ trunk/MagicSoft/Mars/mhist/MHCalibrationPINDiode.h	(revision 2603)
@@ -26,14 +26,14 @@
 private:
 
-  TH1I* fHPQ;             //-> Histogram containing the summed 32 PINDiode slices
-  TH1F* fHErrQ;           //-> Variance of summed FADC slices
-  TH1I* fHPT;             //-> Histogram with time evolution of summed charges
+  TH1I* fHPCharge;             //-> Histogram containing the summed 32 PINDiode slices
+  TH1F* fHErrCharge;           //-> Variance of summed FADC slices
+  TH1I* fHPTime;             //-> Histogram with time evolution of summed charges
   
   
   TF1 *fVarGausFit;
   
-  Float_t  fErrQfirst;
-  Float_t  fErrQlast;
-  UShort_t fErrQnbins;
+  Float_t  fErrChargeFirst;
+  Float_t  fErrChargeLast;
+  UShort_t fErrChargeNbins;
 
 public:
@@ -42,6 +42,6 @@
   ~MHCalibrationPINDiode();
 
-  const Double_t GetT()      const { return fVarGausFit->GetParameter(2); }
-  const Double_t GetErrT()    const { return fVarGausFit->GetParameter(3); }
+  const Double_t GetTime()      const { return fVarGausFit->GetParameter(2); }
+  const Double_t GetErrTime()    const { return fVarGausFit->GetParameter(3); }
 
   ClassDef(MHCalibrationPINDiode, 0) 
Index: trunk/MagicSoft/Mars/mhist/MHCalibrationPixel.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHCalibrationPixel.cc	(revision 2602)
+++ trunk/MagicSoft/Mars/mhist/MHCalibrationPixel.cc	(revision 2603)
@@ -62,15 +62,15 @@
 MHCalibrationPixel::MHCalibrationPixel(const char *name, const char *title)
       : fPixId(-1),
-        fQGausFit(NULL), 
-	fTGausFit(NULL), 
+        fChargeGausFit(NULL), 
+	fTimeGausFit(NULL), 
 	fFitLegend(NULL),
 	fLowerFitRange(0.),
         fFitOK(kFALSE),
-        fQChisquare(-1.),
-        fQProb(-1.),
-        fQNdf(-1),
-        fTChisquare(-1.),
-        fTProb(-1.),
-        fTNdf(-1)
+        fChargeChisquare(-1.),
+        fChargeProb(-1.),
+        fChargeNdf(-1),
+        fTimeChisquare(-1.),
+        fTimeProb(-1.),
+        fTimeNdf(-1)
 { 
 
@@ -78,46 +78,42 @@
     fTitle = title ? title : "Fill the accumulated charges and times of all events and perform fits";
 
-    TString qtitle = "Distribution of Summed FADC Slices Pixel ";
-
     // Create a large number of bins, later we will rebin
-    fQfirst = -0.5;
-    fQlast  = gkStartQlast - 0.5;
-    fQnbins = gkStartPixelBinNr;
-
-    fHQ = new TH1I("HQ",qtitle.Data(),
-                   fQnbins,fQfirst,fQlast);
-    fHQ->SetXTitle("Sum FADC Slices");
-    fHQ->SetYTitle("Nr. of events");
-    fHQ->Sumw2();
-
-    fHQ->SetDirectory(NULL);
-
-    TString ttitle = "Distribution of Mean Arrival Times Pixel ";
+    fChargeFirst = -0.5;
+    fChargeLast  = 10000. - 0.5;
+    fChargeNbins = 20000;
+
+    fHCharge = new TH1I("HCharge","Distribution of Summed FADC Slices Pixel ",
+                   fChargeNbins,fChargeFirst,fChargeLast);
+    fHCharge->SetXTitle("Sum FADC Slices");
+    fHCharge->SetYTitle("Nr. of events");
+    fHCharge->Sumw2();
+
+    fHCharge->SetDirectory(NULL);
 
     Axis_t tfirst = -0.5;
     Axis_t tlast  = 15.5;
-    Int_t nbins   = 16;
-
-    fHT = new TH1I("HT",ttitle.Data(),
-                  nbins,tfirst,tlast);
-    fHT->SetXTitle("Mean Arrival Times [FADC slice nr]");
-    fHT->SetYTitle("Nr. of events");
-    fHT->Sumw2();
-
-    fHT->SetDirectory(NULL);
+    Int_t  ntbins = 16;
+
+    fHTime = new TH1I("HTime","Distribution of Mean Arrival Times Pixel ",
+                  ntbins,tfirst,tlast);
+    fHTime->SetXTitle("Mean Arrival Times [FADC slice nr]");
+    fHTime->SetYTitle("Nr. of events");
+    fHTime->Sumw2();
+
+    fHTime->SetDirectory(NULL);
 
     TString qvsntitle = "Sum of Charges vs. Event Number Pixel ";
 
     // We define a reasonable number and later enlarge it if necessary
-    nbins = 20000;
+    Int_t  nqbins = 20000;
     Axis_t nfirst = -0.5;
-    Axis_t nlast  = (Axis_t)nbins - 0.5;
-
-    fHQvsN = new TH1I("HQvsN",qvsntitle.Data(),
-                     nbins,nfirst,nlast);
-    fHQvsN->SetXTitle("Event Nr.");
-    fHQvsN->SetYTitle("Sum of FADC slices");
-
-    fHQvsN->SetDirectory(NULL);
+    Axis_t nlast  = (Axis_t)nqbins - 0.5;
+
+    fHChargevsN = new TH1I("HChargevsN",qvsntitle.Data(),
+                     nqbins,nfirst,nlast);
+    fHChargevsN->SetXTitle("Event Nr.");
+    fHChargevsN->SetYTitle("Sum of FADC slices");
+
+    fHChargevsN->SetDirectory(NULL);
 
 }
@@ -126,12 +122,12 @@
 {
 
-  delete fHQ;
-  delete fHT;
-  delete fHQvsN;
-
-  if (fQGausFit)
-    delete fQGausFit;
-  if (fTGausFit)
-    delete fTGausFit;
+  delete fHCharge;
+  delete fHTime;
+  delete fHChargevsN;
+
+  if (fChargeGausFit)
+    delete fChargeGausFit;
+  if (fTimeGausFit)
+    delete fTimeGausFit;
   if (fFitLegend)
     delete fFitLegend;
@@ -145,15 +141,27 @@
   fPixId = id;
   
-  TString nameQ = TString(fHQ->GetName());
+  TString nameQ = TString(fHCharge->GetName());
   nameQ += id;
-  fHQ->SetName(nameQ.Data());
-
-  TString nameT = TString(fHT->GetName());
+  fHCharge->SetName(nameQ.Data());
+
+  TString nameT = TString(fHTime->GetName());
   nameT += id;
-  fHT->SetName(nameT.Data());
-
-  TString nameQvsN  = TString(fHQvsN->GetName());
+  fHTime->SetName(nameT.Data());
+
+  TString nameQvsN  = TString(fHChargevsN->GetName());
   nameQvsN += id;
-  fHQvsN->SetName(nameQvsN.Data());
+  fHChargevsN->SetName(nameQvsN.Data());
+
+  TString titleQ = TString(fHCharge->GetTitle());
+  titleQ += id;
+  fHCharge->SetTitle(titleQ.Data());
+
+  TString titleT = TString(fHTime->GetTitle());
+  titleT += id;
+  fHTime->SetTitle(titleT.Data());
+
+  TString titleQvsN  = TString(fHChargevsN->GetTitle());
+  titleQvsN += id;
+  fHChargevsN->SetTitle(titleQvsN.Data());
 }
 
@@ -162,13 +170,14 @@
 {
   
-  for (Int_t i = fHQ->FindBin(fQfirst); i <= fHQ->FindBin(fQlast); i++)
-      fHQ->SetBinContent(i, 1.e-20);
+  for (Int_t i = fHCharge->FindBin(fChargeFirst); 
+       i <= fHCharge->FindBin(fChargeLast); i++)
+    fHCharge->SetBinContent(i, 1.e-20);
 
   for (Int_t i = 0; i < 16; i++)
-      fHT->SetBinContent(i, 1.e-20);
-  
-  fQlast     = gkStartQlast;
-
-  fHQ->GetXaxis()->SetRangeUser(0.,fQlast);
+      fHTime->SetBinContent(i, 1.e-20);
+  
+  fChargeLast     = 9999.5;
+
+  fHCharge->GetXaxis()->SetRangeUser(0.,fChargeLast);
 
   return;
@@ -183,6 +192,6 @@
 {
 
-  fHQ->Reset();
-  fHT->Reset();
+  fHCharge->Reset();
+  fHTime->Reset();
 
   return kTRUE;
@@ -208,19 +217,27 @@
   fFitLegend->SetTextSize(0.05);
 
-  char line1[32];
-  sprintf(line1,"Mean: Q_{#mu} = %2.2f #pm %2.2f",fQMean,fQMeanErr);
+  const TString line1 = 
+    Form("Mean: Q_{#mu} = %2.2f #pm %2.2f",fChargeMean,fChargeMeanErr);
+
   fFitLegend->AddText(line1);
 
-  char line4[32];
-  sprintf(line4,"Sigma: #sigma_{Q} = %2.2f #pm %2.2f",fQSigma,fQSigmaErr);
+
+  const TString line4 =
+    Form("Sigma: #sigma_{Q} = %2.2f #pm %2.2f",fChargeSigma,fChargeSigmaErr);
+
   fFitLegend->AddText(line4);
 
-  char line7[32];
-  sprintf(line7,"#chi^{2} / N_{dof}: %4.2f / %3i",fQChisquare,fQNdf);
+
+  const TString line7 =
+    Form("#chi^{2} / N_{dof}: %4.2f / %3i",fChargeChisquare,fChargeNdf);
+
   fFitLegend->AddText(line7);
 
-  char line8[32];
-  sprintf(line8,"Probability: %4.3f ",fQProb);
+
+  const TString line8 =
+    Form("Probability: %4.3f ",fChargeProb);
+
   fFitLegend->AddText(line8);
+
 
   if (fFitOK)
@@ -256,14 +273,14 @@
     gPad->SetTicks();
 
-    fHQ->DrawCopy(opt);
+    fHCharge->Draw(opt);
     
-    if (fQGausFit)
+    if (fChargeGausFit)
       {
         if (fFitOK)
-          fQGausFit->SetLineColor(kGreen);          
+          fChargeGausFit->SetLineColor(kGreen);          
         else
-          fQGausFit->SetLineColor(kRed);
-
-        fQGausFit->DrawCopy("same");
+          fChargeGausFit->SetLineColor(kRed);
+
+        fChargeGausFit->Draw("same");
         c->Modified();
         c->Update();
@@ -279,14 +296,14 @@
 
     gPad->SetLogy(1);
-    fHT->DrawCopy(opt);
-
-    if (fTGausFit)
+    fHTime->Draw(opt);
+
+    if (fTimeGausFit)
       {
-        if (fTChisquare > 1.)
-          fTGausFit->SetLineColor(kRed);
+        if (fTimeChisquare > 1.)
+          fTimeGausFit->SetLineColor(kRed);
         else
-          fTGausFit->SetLineColor(kGreen);
-
-        fTGausFit->DrawCopy("same");
+          fTimeGausFit->SetLineColor(kGreen);
+
+        fTimeGausFit->Draw("same");
         c->Modified();
         c->Update();
@@ -297,13 +314,13 @@
 
     c->cd(4);
-    fHQvsN->DrawCopy(opt);
-}
-
-
-
-Bool_t MHCalibrationPixel::FitT(Axis_t rmin, Axis_t rmax, Option_t *option)
-{
-
-  if (fTGausFit)
+    fHChargevsN->Draw(opt);
+}
+
+
+
+Bool_t MHCalibrationPixel::FitTime(Axis_t rmin, Axis_t rmax, Option_t *option)
+{
+
+  if (fTimeGausFit)
     return kFALSE;
 
@@ -311,6 +328,6 @@
   rmax = (rmax != 0.) ? rmax : 9.;
 
-  const Stat_t   entries     = fHT->GetEntries();
-  const Double_t mu_guess    = fHT->GetBinCenter(fHT->GetMaximumBin());
+  const Stat_t   entries     = fHTime->GetEntries();
+  const Double_t mu_guess    = fHTime->GetBinCenter(fHTime->GetMaximumBin());
   const Double_t sigma_guess = (rmax - rmin)/2.;
   const Double_t area_guess  = entries/gkSq2Pi;
@@ -318,7 +335,7 @@
   TString name = TString("GausTime");
   name += fPixId;
-  fTGausFit = new TF1(name.Data(),"gaus",rmin,rmax);  
-
-  if (!fTGausFit) 
+  fTimeGausFit = new TF1(name.Data(),"gaus",rmin,rmax);  
+
+  if (!fTimeGausFit) 
     {
     *fLog << err << dbginf << "Could not create fit function for Gauss fit" << endl;
@@ -326,26 +343,27 @@
     }
 
-  fTGausFit->SetParameters(area_guess,mu_guess,sigma_guess);
-  fTGausFit->SetParNames("Area","#mu","#sigma");
-  fTGausFit->SetParLimits(0,0.,entries);
-  fTGausFit->SetParLimits(1,rmin,rmax);
-  fTGausFit->SetParLimits(2,0.,(rmax-rmin)/2.);
-  fTGausFit->SetRange(rmin,rmax);
-
-  fHT->Fit(fTGausFit,option);
-
-  rmin = fTGausFit->GetParameter(1) - 3.*fTGausFit->GetParameter(2);
-  rmax = fTGausFit->GetParameter(1) + 3.*fTGausFit->GetParameter(2);
-  fTGausFit->SetRange(rmin,rmax);  
-
-  fHT->Fit(fTGausFit,option);
-
-  fTChisquare = fTGausFit->GetChisquare();
-  fTNdf       = fTGausFit->GetNDF();
-  fTProb      = fTGausFit->GetProb();
-  fTMean      = fTGausFit->GetParameter(1);
-  fTSigma     = fTGausFit->GetParameter(2);
-
-  if (fTChisquare > 1.) 
+  fTimeGausFit->SetParameters(area_guess,mu_guess,sigma_guess);
+  fTimeGausFit->SetParNames("Area","#mu","#sigma");
+  fTimeGausFit->SetParLimits(0,0.,entries);
+  fTimeGausFit->SetParLimits(1,rmin,rmax);
+  fTimeGausFit->SetParLimits(2,0.,(rmax-rmin));
+  fTimeGausFit->SetRange(rmin,rmax);
+
+  fHTime->Fit(fTimeGausFit,option);
+
+  rmin = fTimeGausFit->GetParameter(1) - 3.*fTimeGausFit->GetParameter(2);
+  rmax = fTimeGausFit->GetParameter(1) + 3.*fTimeGausFit->GetParameter(2);
+  fTimeGausFit->SetRange(rmin,rmax);  
+
+  fHTime->Fit(fTimeGausFit,option);
+
+  fTimeChisquare = fTimeGausFit->GetChisquare();
+  fTimeNdf       = fTimeGausFit->GetNDF();
+  fTimeProb      = fTimeGausFit->GetProb();
+
+  fTimeMean      = fTimeGausFit->GetParameter(1);
+  fTimeSigma     = fTimeGausFit->GetParameter(2);
+
+  if (fTimeChisquare > 1.) 
     {
       *fLog << warn << "Fit of the Arrival times failed ! " << endl;
@@ -357,8 +375,8 @@
 }
 
-Bool_t MHCalibrationPixel::FitQ(Option_t *option)
-{
-
-  if (fQGausFit)
+Bool_t MHCalibrationPixel::FitCharge(Option_t *option)
+{
+
+  if (fChargeGausFit)
     return kFALSE;
 
@@ -366,5 +384,5 @@
   // Get the fitting ranges
   //
-  Axis_t rmin = (fLowerFitRange != 0.) ? fLowerFitRange : fQfirst;
+  Axis_t rmin = (fLowerFitRange != 0.) ? fLowerFitRange : fChargeFirst;
   Axis_t rmax = 0.;
 
@@ -373,15 +391,15 @@
   // otherwise the fit goes gaga because of high number of dimensions ...
   //
-  const Stat_t   entries  = fHQ->GetEntries();
-  const Double_t ar_guess = entries/gkSq2Pi;
-  const Double_t mu_guess = fHQ->GetBinCenter(fHQ->GetMaximumBin());
-  const Double_t si_guess = mu_guess/50.;
-
-  TString name = TString("QGausFit");
+  const Stat_t   entries    = fHCharge->GetEntries();
+  const Double_t area_guess = entries/gkSq2Pi;
+  const Double_t mu_guess   = fHCharge->GetBinCenter(fHCharge->GetMaximumBin());
+  const Double_t sigma_guess = mu_guess/15.;
+
+  TString name = TString("ChargeGausFit");
   name += fPixId;
 
-  fQGausFit = new TF1(name.Data(),"gaus",rmin,fQlast);
-
-  if (!fQGausFit) 
+  fChargeGausFit = new TF1(name.Data(),"gaus",rmin,fChargeLast);
+
+  if (!fChargeGausFit) 
     {
     *fLog << err << dbginf << "Could not create fit function for Gauss fit" << endl;
@@ -389,33 +407,34 @@
     }
   
-  fQGausFit->SetParameters(ar_guess,mu_guess,si_guess);
-  fQGausFit->SetParNames("Area","#mu","#sigma");
-  fQGausFit->SetParLimits(0,0.,entries);
-  fQGausFit->SetParLimits(1,rmin,fQlast);
-  fQGausFit->SetParLimits(2,0.,fQlast-rmin);
-  fQGausFit->SetRange(rmin,fQlast);
-  fQGausFit->Update();
-
-  fHQ->Fit(fQGausFit,option);
-  
-  rmin = fQGausFit->GetParameter(1) - 3.*fQGausFit->GetParameter(2);
-  rmax = fQGausFit->GetParameter(1) + 3.*fQGausFit->GetParameter(2);
-
-  fQGausFit->SetRange(rmin,rmax);  
-  fHQ->Fit(fQGausFit,option);
-
-  rmin = fQGausFit->GetParameter(1) - 3.5*fQGausFit->GetParameter(2);
-  rmax = fQGausFit->GetParameter(1) + 3.5*fQGausFit->GetParameter(2);
-
-  fQGausFit->SetRange(rmin,rmax);  
-  fHQ->Fit(fQGausFit,option);
-
-  fQChisquare = fQGausFit->GetChisquare();
-  fQNdf       = fQGausFit->GetNDF();
-  fQProb      = fQGausFit->GetProb();
-  fQMean      = fQGausFit->GetParameter(1);
-  fQMeanErr   = fQGausFit->GetParError(1);
-  fQSigma     = fQGausFit->GetParameter(2);
-  fQSigmaErr  = fQGausFit->GetParError(2);
+  fChargeGausFit->SetParameters(area_guess,mu_guess,sigma_guess);
+  fChargeGausFit->SetParNames("Area","#mu","#sigma");
+  fChargeGausFit->SetParLimits(0,0.,entries);
+  fChargeGausFit->SetParLimits(1,rmin,fChargeLast);
+  fChargeGausFit->SetParLimits(2,0.,fChargeLast-rmin);
+  fChargeGausFit->SetRange(rmin,fChargeLast);
+
+  fHCharge->Fit(fChargeGausFit,option);
+  
+  Axis_t rtry = fChargeGausFit->GetParameter(1) - 2.5*fChargeGausFit->GetParameter(2);
+  
+  rmin = (rtry < rmin ? rmin : rtry);
+  rmax = fChargeGausFit->GetParameter(1) + 2.5*fChargeGausFit->GetParameter(2);
+  fChargeGausFit->SetRange(rmin,rmax);  
+
+  fHCharge->Fit(fChargeGausFit,option);
+
+  //  rmin = fChargeGausFit->GetParameter(1) - 2.5*fChargeGausFit->GetParameter(2);
+  //  rmax = fChargeGausFit->GetParameter(1) + 2.5*fChargeGausFit->GetParameter(2);
+  //  fChargeGausFit->SetRange(rmin,rmax);  
+
+  // fHCharge->Fit(fChargeGausFit,option);
+
+  fChargeChisquare = fChargeGausFit->GetChisquare();
+  fChargeNdf       = fChargeGausFit->GetNDF();
+  fChargeProb      = fChargeGausFit->GetProb();
+  fChargeMean      = fChargeGausFit->GetParameter(1);
+  fChargeMeanErr   = fChargeGausFit->GetParError(1);
+  fChargeSigma     = fChargeGausFit->GetParameter(2);
+  fChargeSigmaErr  = fChargeGausFit->GetParError(2);
 
   //
@@ -423,7 +442,7 @@
   // The Probability is greater than gkProbLimit (default 0.01 == 99%)
   //
-  if (fQProb < gkProbLimit) 
+  if (fChargeProb < gkProbLimit) 
     {
-      *fLog << warn << "Prob: " << fQProb << " is smaller than the allowed value: " << gkProbLimit << endl;
+      *fLog << warn << "Prob: " << fChargeProb << " is smaller than the allowed value: " << gkProbLimit << endl;
       fFitOK = kFALSE;
       return kFALSE;
@@ -442,33 +461,33 @@
   Int_t nbins = 50;
 
-  CutEdges(fHQ,nbins);
-
-  fQfirst = fHQ->GetBinLowEdge(fHQ->GetXaxis()->GetFirst());
-  fQlast  = fHQ->GetBinLowEdge(fHQ->GetXaxis()->GetLast())+fHQ->GetBinWidth(0);
-  fQnbins = nbins;
-
-  CutEdges(fHQvsN,0);
-
-}
-
-void MHCalibrationPixel::PrintQFitResult()
-{
-  
-  *fLog << "Results of the Summed Charges Fit: "                 << endl;
-  *fLog << "Chisquare: "        << fQChisquare                   << endl;
-  *fLog << "DoF: "              << fQNdf                         << endl;
-  *fLog << "Probability: "      << fQProb                        << endl;
-  *fLog                                                          << endl;
-  
-}
-
-void MHCalibrationPixel::PrintTFitResult()
-{
-
-  *fLog << "Results of the Arrival Time Slices Fit: "             << endl;
-  *fLog << "Chisquare: "   << fTChisquare                         << endl;
-  *fLog << "Ndf: "         << fTNdf                               << endl;
-  *fLog << "Probability: " << fTProb                              << endl;
-  *fLog                                                           << endl;
-
-}
+  CutEdges(fHCharge,nbins);
+
+  fChargeFirst = fHCharge->GetBinLowEdge(fHCharge->GetXaxis()->GetFirst());
+  fChargeLast  = fHCharge->GetBinLowEdge(fHCharge->GetXaxis()->GetLast())+fHCharge->GetBinWidth(0);
+  fChargeNbins = nbins;
+
+  CutEdges(fHChargevsN,0);
+
+}
+
+void MHCalibrationPixel::PrintChargeFitResult()
+{
+  
+  *fLog << "Results of the Summed Charges Fit: "                      << endl;
+  *fLog << "Chisquare: "        << fChargeChisquare                   << endl;
+  *fLog << "DoF: "              << fChargeNdf                         << endl;
+  *fLog << "Probability: "      << fChargeProb                        << endl;
+  *fLog                                                               << endl;
+  
+}
+
+void MHCalibrationPixel::PrintTimeFitResult()
+{
+
+  *fLog << "Results of the Time Slices Fit: "                        << endl;
+  *fLog << "Chisquare: "   << fTimeChisquare                         << endl;
+  *fLog << "Ndf: "         << fTimeNdf                               << endl;
+  *fLog << "Probability: " << fTimeProb                              << endl;
+  *fLog                                                              << endl;
+
+}
Index: trunk/MagicSoft/Mars/mhist/MHCalibrationPixel.h
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHCalibrationPixel.h	(revision 2602)
+++ trunk/MagicSoft/Mars/mhist/MHCalibrationPixel.h	(revision 2603)
@@ -31,36 +31,35 @@
 protected:
 
-  TH1I* fHQ;              //-> Summed FADC slices
-  TH1I* fHT;              //-> Mean arrival time in number of FADC sice
-
-  TH1I* fHQvsN;           //-> Summed Charge vs. Event Nr. 
+  TH1I* fHCharge;              //-> Summed FADC slices
+  TH1I* fHTime;                //-> Mean arrival time in number of FADC sice
+  TH1I* fHChargevsN;           //-> Summed Charge vs. Event Nr. 
   
-  TF1* fQGausFit;
-  TF1* fTGausFit;
+  TF1* fChargeGausFit;
+  TF1* fTimeGausFit;
   
   TPaveText *fFitLegend;  
   
   Axis_t  fLowerFitRange;
-  Axis_t  fQfirst;
-  Axis_t  fQlast;
-  Int_t   fQnbins;
+  Axis_t  fChargeFirst;
+  Axis_t  fChargeLast;
+  Int_t   fChargeNbins;
 
   Bool_t fFitOK;
 
-  Double_t fQChisquare;
-  Double_t fQProb;
-  Int_t    fQNdf;
+  Double_t fChargeChisquare;
+  Double_t fChargeProb;
+  Int_t    fChargeNdf;
 
-  Double_t fQMean;
-  Double_t fQMeanErr;
-  Double_t fQSigma;
-  Double_t fQSigmaErr;
+  Double_t fChargeMean;
+  Double_t fChargeMeanErr;
+  Double_t fChargeSigma;
+  Double_t fChargeSigmaErr;
   
-  Double_t fTChisquare;
-  Double_t fTProb;
-  Int_t    fTNdf;
+  Double_t fTimeChisquare;
+  Double_t fTimeProb;
+  Int_t    fTimeNdf;
 
-  Double_t fTMean;
-  Double_t fTSigma;
+  Double_t fTimeMean;
+  Double_t fTimeSigma;
   
   virtual void DrawLegend();
@@ -76,37 +75,37 @@
   Bool_t Fill(const MParContainer *, const Stat_t w=1) { return kTRUE; }
 
-  Bool_t FillQ(Int_t q) {  return fHQ->Fill(q) > -1;  }
-  Bool_t FillT(Int_t t) {  return fHT->Fill(t) > -1;  }
-  Bool_t FillQvsN(Float_t q, Int_t n) { return fHQvsN->Fill(n,q) > -1; }
+  Bool_t FillCharge(Int_t q)               { return fHCharge->Fill(q)      > -1; }
+  Bool_t FillTime(Int_t t)                 { return fHTime->Fill(t)        > -1; }
+  Bool_t FillChargevsN(Float_t q, Int_t n) { return fHChargevsN->Fill(n,q) > -1; }
 
-  const TH1I *GetHQ()       { return fHQ; }
-  const TH1I *GetHQ() const { return fHQ; }
+  const TH1I *GetHCharge()                 { return fHCharge;    }
+  const TH1I *GetHCharge() const           { return fHCharge;    }
 
-  const Double_t GetQMean()    const { return fQMean; }
-  const Double_t GetQMeanErr()  const { return fQMeanErr; }
-  const Double_t GetQSigma()   const { return fQSigma; }
-  const Double_t GetQSigmaErr() const { return fQSigmaErr; }
-  const Double_t GetArea()    const { return fQGausFit->GetParameter(0); }
-  const Double_t GetAreaErr()  const { return fQGausFit->GetParError(0); }
+  const Double_t GetChargeMean()     const { return fChargeMean;    }
+  const Double_t GetChargeMeanErr()  const { return fChargeMeanErr; }
+  const Double_t GetChargeSigma()    const { return fChargeSigma;   }
+  const Double_t GetChargeSigmaErr() const { return fChargeSigmaErr; }
+  const Double_t GetArea()           const { return fChargeGausFit->GetParameter(0); }
+  const Double_t GetAreaErr()        const { return fChargeGausFit->GetParError(0);  }
 
-  const Double_t GetQChiSquare() const { return fQChisquare; }
-  const Double_t GetQProb()    const { return fQProb;      }  
-  const Int_t    GetQNdf()     const { return fQNdf;       }   
+  const Double_t GetChargeChiSquare() const { return fChargeChisquare; }
+  const Double_t GetChargeProb()      const { return fChargeProb;      }  
+  const Int_t    GetChargeNdf()       const { return fChargeNdf;       }   
 
-  const Double_t GetTMean()   const  { return fTMean; }
-  const Double_t GetTSigma()  const  { return fTSigma; }
+  const Double_t GetTimeMean()        const { return fTimeMean;  }
+  const Double_t GetTimeSigma()       const { return fTimeSigma; }
 
-  const Double_t GetTChiSquare() const { return fTChisquare; }
-  const Double_t GetTProb()      const { return fTProb; }
-  const Int_t    GetTNdf()       const { return fTNdf;       }   
+  const Double_t GetTimeChiSquare()   const { return fTimeChisquare; }
+  const Double_t GetTimeProb()        const { return fTimeProb;      }
+  const Int_t    GetTimeNdf()         const { return fTimeNdf;       }   
   
-  const TH1I *GetHT()       { return fHT; }
-  const TH1I *GetHT() const { return fHT; }
+  const TH1I *GetHTime()                    { return fHTime; }
+  const TH1I *GetHTime()              const { return fHTime; }
   
-  const TH1I *GetHQvsN()       { return fHQvsN; }
-  const TH1I *GetHQvsN() const { return fHQvsN; }
+  const TH1I *GetHChargevsN()               { return fHChargevsN; }
+  const TH1I *GetHChargevsN()         const { return fHChargevsN; }
   
-  Bool_t FitQ(Option_t *option="RQ0");  
-  Bool_t FitT(Axis_t rmin=0, Axis_t rmax=0, Option_t *option="RQ0");    
+  Bool_t FitCharge(Option_t *option="RQ0");  
+  Bool_t FitTime(Axis_t rmin=0, Axis_t rmax=0, Option_t *option="RQ0");    
 
   virtual void Draw(Option_t *option="");
@@ -116,8 +115,8 @@
   void SetLowerFitRange(Axis_t min)  { fLowerFitRange = min; }
 
-  void PrintQFitResult();
-  void PrintTFitResult();  
+  void PrintChargeFitResult();
+  void PrintTimeFitResult();  
 
-  Bool_t IsFitted()    { return fFitOK; }
+  Bool_t IsFitOK()    { return fFitOK; }
   
   ClassDef(MHCalibrationPixel, 1) 
