Index: trunk/MagicSoft/Mars/manalysis/MCalibrationBlindPix.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MCalibrationBlindPix.cc	(revision 2599)
+++ 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 2599)
+++ 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 2599)
+++ 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 2599)
+++ 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 2599)
+++ 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 2599)
+++ 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 2599)
+++ 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 2599)
+++ 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 2599)
+++ 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 2599)
+++ 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 2599)
+++ 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
