Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 3677)
+++ trunk/MagicSoft/Mars/Changelog	(revision 3678)
@@ -18,4 +18,23 @@
 
                                                  -*-*- END OF LINE -*-*-
+
+ 2004/04/08: Markus Gaug
+
+   * mcalib/MCalibrationChargeCalc.[h,cc]
+   * mcalib/MCalibrationChargeCam.[h,cc]
+   * mcalib/MCalibrationChargePix.[h,cc]
+   * mcalib/MCalibrationChargeBlindPix.[h,cc]
+   * mcalib/MCalibrationChargePINDiode.[h,cc]
+     - put calculation of photon fluxes with the three methods into 
+       MCalibrationChargeCalc
+     - reorganized calculations in a better readable way (hopefully!)
+
+   * mbase/MAGIC.h
+   * mcalib/MCalibrationCam.[h,cc]
+   * mcalib/MCalibrationQECam.[h,cc]
+   * mcalib/MCalibrationQEPix.[h,cc]
+     - put PulserColor_t away from MAGIC.h into MCalibrationCam
+     - full implementation of the QE-calibration from MCalibrationQEPix
+
 
  2004/04/07: Markus Gaug
Index: trunk/MagicSoft/Mars/mbase/MAGIC.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MAGIC.h	(revision 3677)
+++ trunk/MagicSoft/Mars/mbase/MAGIC.h	(revision 3678)
@@ -28,15 +28,4 @@
 const Int_t kERROR    = 3;
 
-//
-//     ColorId for calibration
-//
-enum PulserColor_t
-{
-   kBLUE, 
-   kGREEN, 
-   kUV, 
-   kCT1 
-};
-
 const Double_t kRad2Deg = 180.0/3.1415926535897932384626433832795028841971693993751;
 
Index: trunk/MagicSoft/Mars/mcalib/MCalibrationCam.cc
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MCalibrationCam.cc	(revision 3677)
+++ trunk/MagicSoft/Mars/mcalib/MCalibrationCam.cc	(revision 3678)
@@ -64,4 +64,5 @@
 using namespace std;
 
+const Int_t MCalibrationCam::gkNumPulserColors = 4;
 // --------------------------------------------------------------------------
 //
@@ -73,4 +74,7 @@
 // - fAverageSectors
 //
+// Initializes:
+// - fPulserColor to kCT1 
+//
 // Creates a TClonesArray of MBadPixelsPix containers for the TClonesArray's: 
 // - fAverageBadAreas
@@ -82,5 +86,5 @@
 //
 MCalibrationCam::MCalibrationCam(const char *name, const char *title)
-    : fPixels(NULL), fAverageAreas(NULL), fAverageSectors(NULL)
+    : fPulserColor(kCT1), fPixels(NULL), fAverageAreas(NULL), fAverageSectors(NULL)
 {
     fName  = name  ? name  : "MCalibrationCam";
Index: trunk/MagicSoft/Mars/mcalib/MCalibrationCam.h
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MCalibrationCam.h	(revision 3677)
+++ trunk/MagicSoft/Mars/mcalib/MCalibrationCam.h	(revision 3678)
@@ -19,11 +19,18 @@
 {
 
+public:
+
+  enum PulserColor_t { kCT1=0, kGREEN=1, kBLUE=2, kUV=3 }; // Possible Pulser colours
+  static const Int_t gkNumPulserColors;                     // Number of Pulser colours (now set to: 4)
+  
 protected:
   
+  PulserColor_t fPulserColor;        // Colour of the pulsed LEDs
+
   TClonesArray *fPixels;             //-> Array of MCalibrationPix, one per pixel
   TClonesArray *fAverageAreas;       //-> Array of MCalibrationPix, one per pixel area
   TClonesArray *fAverageSectors;     //-> Array of MCalibrationPix, one per camera sector
-  TClonesArray *fAverageBadAreas;    //-> Array of MBadPixelsPix, one per pixel area
-  TClonesArray *fAverageBadSectors;  //-> Array of MBadPixelsPix, one per camera sector
+  TClonesArray *fAverageBadAreas;    //-> Array of MBadPixelsPix,   one per pixel area
+  TClonesArray *fAverageBadSectors;  //-> Array of MBadPixelsPix,   one per camera sector
   
 public:
@@ -32,10 +39,13 @@
   ~MCalibrationCam();
   
-  virtual void Clear(    Option_t *o="" );
-  void Init(const MGeomCam &geom);
-  void InitSize( const UInt_t i );
-  void InitAverageAreas(  const UInt_t i );
-  void InitAverageSectors( const UInt_t i );
+  virtual void Clear      ( Option_t *o=""               );
 
+  void Init               ( const MGeomCam &geom         );
+  void InitSize           ( const UInt_t i               );
+  void InitAverageAreas   ( const UInt_t i               );
+  void InitAverageSectors ( const UInt_t i               );
+
+  void SetPulserColor     ( const PulserColor_t col=kCT1)  { fPulserColor = col; }
+  
   // Getters
   Int_t   GetSize()               const;
@@ -43,25 +53,19 @@
   Int_t   GetAverageSectors()     const;  
 
-  // Others
-  MCalibrationPix &operator[](UInt_t i);
-  const MCalibrationPix &operator[](UInt_t i) const;
+        MCalibrationPix &GetAverageArea      ( UInt_t i );
+  const MCalibrationPix &GetAverageArea      ( UInt_t i ) const;
+        MBadPixelsPix   &GetAverageBadArea   ( UInt_t i );
+  const MBadPixelsPix   &GetAverageBadArea   ( UInt_t i ) const;
+        MBadPixelsPix   &GetAverageBadSector ( UInt_t i );
+  const MBadPixelsPix   &GetAverageBadSector ( UInt_t i ) const;
+        MCalibrationPix &GetAverageSector    ( UInt_t i );
+  const MCalibrationPix &GetAverageSector    ( UInt_t i ) const;
+        MCalibrationPix &operator[]          ( UInt_t i );
+  const MCalibrationPix &operator[]          ( UInt_t i ) const;
 
-  MCalibrationPix &GetAverageArea(UInt_t i);
-  const MCalibrationPix &GetAverageArea(UInt_t i) const;
+  const PulserColor_t    GetPulserColor()                 const { return fPulserColor; }
 
-  MBadPixelsPix &GetAverageBadArea(UInt_t i);
-  const MBadPixelsPix &GetAverageBadArea(UInt_t i) const;
-
-  MCalibrationPix &GetAverageSector(UInt_t i);
-  const MCalibrationPix &GetAverageSector(UInt_t i) const;
-
-  MBadPixelsPix &GetAverageBadSector(UInt_t i);
-  const MBadPixelsPix &GetAverageBadSector(UInt_t i) const;
-
-  // Draws
+  virtual Bool_t GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0) const;
   virtual void DrawPixelContent(Int_t num) const;    
-  
-  // Others
-  virtual Bool_t GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0) const;
 
   ClassDef(MCalibrationCam, 1)	// Base class Container for Calibration Results Camera
Index: trunk/MagicSoft/Mars/mcalib/MCalibrationChargeBlindPix.cc
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MCalibrationChargeBlindPix.cc	(revision 3677)
+++ trunk/MagicSoft/Mars/mcalib/MCalibrationChargeBlindPix.cc	(revision 3678)
@@ -53,4 +53,5 @@
 /////////////////////////////////////////////////////////////////////////////
 #include "MCalibrationChargeBlindPix.h"
+#include "MCalibrationCam.h"
 
 #include <TH1.h>
@@ -184,4 +185,21 @@
 // --------------------------------------------------------------------------
 //
+// Return -1 if fFluxInsidePlexiglassVar is smaller than 0.
+// Return -1 if fFluxInsidePlexiglass    is 0.
+// Return fFluxInsidePlexiglassVar / fFluxInsidePlexiglass^2
+// 
+Float_t MCalibrationChargeBlindPix::GetFluxInsidePlexiglassRelVar() const
+{
+  if (fFluxInsidePlexiglassVar < 0.)
+    return -1.;
+
+  if (fFluxInsidePlexiglass == 0.)
+    return -1.;
+  
+  return fFluxInsidePlexiglassVar / (fFluxInsidePlexiglass * fFluxInsidePlexiglass) ;
+}
+
+// --------------------------------------------------------------------------
+//
 // Return -1 if fLambdaVar is smaller than 0.
 // Return square root of fLambdaVar
@@ -279,5 +297,4 @@
   return gkBlindPixelQECT1Err * gkBlindPixelQECT1Err / gkBlindPixelQECT1 / gkBlindPixelQECT1 ;
 }
-
 
 // --------------------------------------------------------------------------
@@ -355,20 +372,20 @@
   switch (fColor)
     {
-    case kGREEN:
+    case MCalibrationCam::kGREEN:
       fFluxInsidePlexiglass    = fLambda * gkBlindPixelQEGreen * TMath::Power(10,gkBlindPixelAttGreen);   
       // attenuation has negligible error
       fFluxInsidePlexiglassVar = GetLambdaRelVar() + GetBlindPixelQEGreenRelVar();
       break;
-    case kBLUE:
+    case MCalibrationCam::kBLUE:
       fFluxInsidePlexiglass    = fLambda * gkBlindPixelQEBlue * TMath::Power(10,gkBlindPixelAttBlue);   
       // attenuation has negligible error
       fFluxInsidePlexiglassVar = GetLambdaRelVar() + GetBlindPixelQEBlueRelVar();
       break;
-    case kUV:
+    case MCalibrationCam::kUV:
       fFluxInsidePlexiglass    = fLambda * gkBlindPixelQEUV * TMath::Power(10,gkBlindPixelAttUV);   
       // attenuation has negligible error
       fFluxInsidePlexiglassVar = GetLambdaRelVar() + GetBlindPixelQEUVRelVar();
       break;
-    case kCT1:
+    case MCalibrationCam::kCT1:
     default:
       fFluxInsidePlexiglass    = fLambda * gkBlindPixelQECT1 * TMath::Power(10,gkBlindPixelAttCT1);   
Index: trunk/MagicSoft/Mars/mcalib/MCalibrationChargeBlindPix.h
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MCalibrationChargeBlindPix.h	(revision 3677)
+++ trunk/MagicSoft/Mars/mcalib/MCalibrationChargeBlindPix.h	(revision 3678)
@@ -1,4 +1,8 @@
 #ifndef MARS_MCalibrationChargeBlindPix
 #define MARS_MCalibrationChargeBlindPix
+
+#ifndef MARS_MCalibrationChargeCam
+#include "MCalibrationChargeCam.h"
+#endif
 
 #ifndef MARS_MCalibrationChargePix
@@ -42,5 +46,5 @@
          kFluxInsidePlexiglassAvailable };
 
-  PulserColor_t fColor;  
+  MCalibrationCam::PulserColor_t fColor;  
 
   const Float_t GetBlindPixelQEGreenRelVar() const; 
@@ -57,5 +61,5 @@
 
   // Setters
-  void SetColor            ( const PulserColor_t color )          { fColor          = color; }
+  void SetColor            ( const MCalibrationCam::PulserColor_t color ) { fColor  = color; }
   void SetLambda           ( const Float_t f )                    { fLambda         = f;   }
   void SetLambdaVar        ( const Float_t f )                    { fLambdaVar      = f;   }
@@ -78,19 +82,20 @@
   
   // Getters
-  Float_t GetLambda()                  const { return fLambda;               }
-  Float_t GetLambdaErr()               const;
-  Float_t GetLambdaRelVar()            const;  
-  Float_t GetLambdaCheck()             const { return fLambdaCheck;          }
-  Float_t GetLambdaCheckErr()          const { return fLambdaCheckErr;       }
-  Float_t GetFluxInsidePlexiglass()    const { return fFluxInsidePlexiglass; }
-  Float_t GetFluxInsidePlexiglassErr() const;
-  Float_t GetMu0()                     const { return fMu0;                  }
-  Float_t GetMu0Err()                  const { return fMu0Err;               }
-  Float_t GetMu1()                     const { return fMu1;                  }
-  Float_t GetMu1Err()                  const { return fMu1Err;               }
-  Float_t GetSigma0()                  const { return fSigma0;               }
-  Float_t GetSigma0Err()               const { return fSigma0Err;            } 
-  Float_t GetSigma1()                  const { return fSigma1;               }
-  Float_t GetSigma1Err()               const { return fSigma1Err;            }
+  Float_t GetLambda()                     const { return fLambda;               }
+  Float_t GetLambdaErr()                  const;
+  Float_t GetLambdaRelVar()               const;  
+  Float_t GetLambdaCheck()                const { return fLambdaCheck;          }
+  Float_t GetLambdaCheckErr()             const { return fLambdaCheckErr;       }
+  Float_t GetFluxInsidePlexiglass()       const { return fFluxInsidePlexiglass; }
+  Float_t GetFluxInsidePlexiglassErr()    const;
+  Float_t GetFluxInsidePlexiglassRelVar() const;  
+  Float_t GetMu0()                        const { return fMu0;                  }
+  Float_t GetMu0Err()                     const { return fMu0Err;               }
+  Float_t GetMu1()                        const { return fMu1;                  }
+  Float_t GetMu1Err()                     const { return fMu1Err;               }
+  Float_t GetSigma0()                     const { return fSigma0;               }
+  Float_t GetSigma0Err()                  const { return fSigma0Err;            } 
+  Float_t GetSigma1()                     const { return fSigma1;               }
+  Float_t GetSigma1Err()                  const { return fSigma1Err;            }
 
   Bool_t  IsOscillating()                    const;
Index: trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc	(revision 3677)
+++ trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc	(revision 3678)
@@ -185,7 +185,9 @@
 #include "MParList.h"
 
-#include "MGeomCam.h"
 #include "MRawRunHeader.h"
 #include "MRawEvtPixelIter.h"
+
+#include "MGeomCam.h"
+#include "MGeomPix.h"
 
 #include "MPedestalCam.h"
@@ -208,4 +210,5 @@
 #include "MCalibrationQEPix.h"
 
+#include "MCalibrationCam.h"
 
 ClassImp(MCalibrationChargeCalc);
@@ -213,11 +216,12 @@
 using namespace std;
 
-const Float_t MCalibrationChargeCalc::fgChargeLimit        = 3.;
-const Float_t MCalibrationChargeCalc::fgChargeErrLimit     = 0.;
-const Float_t MCalibrationChargeCalc::fgChargeRelErrLimit  = 1.;
-const Float_t MCalibrationChargeCalc::fgLambdaCheckLimit   = 0.2;
-const Float_t MCalibrationChargeCalc::fgLambdaErrLimit     = 0.2;
-const Float_t MCalibrationChargeCalc::fgTimeLowerLimit     = 1.;
-const Float_t MCalibrationChargeCalc::fgTimeUpperLimit     = 2.;
+const Float_t MCalibrationChargeCalc::fgChargeLimit            = 3.;
+const Float_t MCalibrationChargeCalc::fgChargeErrLimit         = 0.;
+const Float_t MCalibrationChargeCalc::fgChargeRelErrLimit      = 1.;
+const Float_t MCalibrationChargeCalc::fgLambdaErrLimit         = 0.2;
+const Float_t MCalibrationChargeCalc::fgLambdaCheckLimit       = 0.2;
+const Float_t MCalibrationChargeCalc::fgPheErrLimit            = 5.;
+const Float_t MCalibrationChargeCalc::fgTimeLowerLimit         = 1.;
+const Float_t MCalibrationChargeCalc::fgTimeUpperLimit         = 2.;
 // --------------------------------------------------------------------------
 //
@@ -240,4 +244,6 @@
 // - fTimeLowerLimit    to fgTimeLowerLimit 
 // - fTimeUpperLimit    to fgTimeUpperLimit 
+// - fPheErrLimit       to fgPheErrLimit  
+// - fPulserColor       to MCalibrationCam::kCT1
 // 
 // Calls:
@@ -265,4 +271,6 @@
   SetLambdaCheckLimit();
   SetLambdaErrLimit();
+  SetPheErrLimit();
+  SetPulserColor(MCalibrationCam::kCT1);
   SetTimeLowerLimit();
   SetTimeUpperLimit();
@@ -300,5 +308,5 @@
 // they were not found:
 //
-//  - MCalibrationCam
+//  - MCalibrationChargeCam
 //  - MCalibrationQECam
 //
@@ -306,4 +314,6 @@
 //
 //  - MTime
+//
+// Sets the pulser colour in MCalibrationChargeCam
 //
 Int_t MCalibrationChargeCalc::PreProcess(MParList *pList)
@@ -342,4 +352,5 @@
           return kFALSE;
         }
+      fBlindPixel->SetColor( fPulserColor );
     }
   
@@ -355,4 +366,5 @@
           return kFALSE;
         }
+      fPINDiode->SetColor( fPulserColor );
     }
   
@@ -363,5 +375,7 @@
       return kFALSE;
     }
-  
+
+  fCam->SetPulserColor( fPulserColor );
+
   fQECam = (MCalibrationQECam*)pList->FindCreateObj("MCalibrationQECam");
   if (!fQECam)
@@ -451,4 +465,8 @@
 
 
+// ----------------------------------------------------------------------------------
+//  
+// Nothing to be done in Process, but have a look at MHCalibrationChargeCam, instead
+// 
 Int_t MCalibrationChargeCalc::Process()
 {
@@ -456,5 +474,5 @@
 }
 
-// --------------------------------------------------------------------------
+// ----------------------------------------------------------------------------------
 //  
 // Finalize pedestals: 
@@ -535,5 +553,5 @@
 Bool_t MCalibrationChargeCalc::FinalizeCharges(MCalibrationChargePix &cal, MBadPixelsPix &bad)
 {
-  
+
   //
   // The check return kTRUE if:
@@ -546,32 +564,29 @@
   if (cal.GetMean() < fChargeLimit*cal.GetPedRms())
     {
-      *fLog << warn << "WARNING: Fitted Charge: " << cal.GetMean() << " is smaller than "
+      *fLog << warn << GetDescriptor() << ": Fitted Charge: " << cal.GetMean() << " is smaller than "
             << fChargeLimit << " Pedestal RMS: " <<  cal.GetPedRms() << " in Pixel  " << cal.GetPixId() << endl;
       bad.SetUncalibrated( MBadPixelsPix::kChargeIsPedestal);
-      bad.SetUnsuitable(   MBadPixelsPix::kUnsuitableRun   );
     }
   
   if (cal.GetMeanErr() < fChargeErrLimit) 
     {
-      *fLog << warn << "WARNING: Sigma of Fitted Charge: " << cal.GetMeanErr() << " is smaller than "
+      *fLog << warn << GetDesriptor() << ": Sigma of Fitted Charge: " << cal.GetMeanErr() << " is smaller than "
             << fChargeErrLimit << " in Pixel  " << cal.GetPixId() << endl;
       bad.SetUncalibrated( MBadPixelsPix::kChargeErrNotValid );
-      bad.SetUnsuitable(   MBadPixelsPix::kUnsuitableRun     );
     }
       
    if (cal.GetMean() < fChargeRelErrLimit*cal.GetMeanErr()) 
     {
-      *fLog << warn << "WARNING: Fitted Charge: " << cal.GetMean() << " is smaller than "
-            << fChargeRelErrLimit << "* its error: " << cal.GetMeanErr() << " in Pixel  " << cal.GetPixId() << endl;
+      *fLog << warn << GetDesriptor() << ": Fitted Charge: " << cal.GetMean() << " is smaller than "
+            << fChargeRelErrLimit << "* its error: " << cal.GetMeanErr() 
+            << " in Pixel  " << cal.GetPixId() << endl;
       bad.SetUncalibrated( MBadPixelsPix::kChargeRelErrNotValid );
-      bad.SetUnsuitable(   MBadPixelsPix::kUnsuitableRun        );
     }
 
   if (cal.GetSigma() < cal.GetPedRms())
     {
-      *fLog << warn << "WARNING: Sigma of Fitted Charge: " << cal.GetSigma() 
+      *fLog << warn << GetDesriptor() << ": Sigma of Fitted Charge: " << cal.GetSigma() 
 	    << " smaller than Pedestal RMS: " << cal.GetPedRms() << " in Pixel  " << cal.GetPixId() << endl;
       bad.SetUncalibrated( MBadPixelsPix::kChargeSigmaNotValid );
-      bad.SetUnsuitable(   MBadPixelsPix::kUnsuitableRun       );
     }
 
@@ -592,18 +607,16 @@
   if ( cal.GetAbsTimeMean() < lowerlimit)
     {
-      *fLog << warn << "WARNING: Mean ArrivalTime in first " << fTimeLowerLimit 
+      *fLog << warn << GetDesriptor() << ": Mean ArrivalTime in first " << fTimeLowerLimit 
             << " extraction bin of the Pixel " << cal.GetPixId() << endl;
       *fLog << cal.GetAbsTimeMean() << "   " << lowerlimit << endl;
       bad.SetUncalibrated( MBadPixelsPix::kMeanTimeInFirstBin );
-      bad.SetUnsuitable(   MBadPixelsPix::kUnsuitableRun      );
     }
   
   if ( cal.GetAbsTimeMean() > upperlimit )
     {
-      *fLog << warn << "WARNING: Mean ArrivalTime in last " << fTimeUpperLimit 
+      *fLog << warn << GetDesriptor() << ": Mean ArrivalTime in last " << fTimeUpperLimit 
             << " two extraction bins of the Pixel " << cal.GetPixId() << endl;
       *fLog << cal.GetAbsTimeMean() << "   " << upperlimit << endl;
       bad.SetUncalibrated( MBadPixelsPix::kMeanTimeInLast2Bins );
-      bad.SetUnsuitable(   MBadPixelsPix::kUnsuitableRun       );
     }
       
@@ -615,5 +628,5 @@
       *fLog << warn << GetDescriptor() 
             << ": Could not calculate reduced sigmas of pixel: " << cal.GetPixId() << endl;
-      bad.SetUnsuitable(MBadPixelsPix::kUnsuitableRun);
+      bad.SetUncalibrated(MBadPixelsPix::kChargeIsPedestal);
       return kFALSE;
     }
@@ -623,5 +636,5 @@
       *fLog << warn << GetDescriptor() 
             << ": Could not calculate F-Factor of pixel: " << cal.GetPixId() << endl;
-      bad.SetUnsuitable(MBadPixelsPix::kUnsuitableRun);
+      bad.SetUncalibrated(MBadPixelsPix::kDeviatingNumPhes);
       return kFALSE;
     }
@@ -657,5 +670,5 @@
   if (fPINDiode->GetMean() < fChargeLimit*fPINDiode->GetPedRms())
     {
-      *fLog << warn << "WARNING: Fitted Charge is smaller than "
+      *fLog << warn << GetDesriptor() << ": Fitted Charge is smaller than "
             << fChargeLimit << " Pedestal RMS in PINDiode " << endl;
       return kFALSE;
@@ -664,5 +677,5 @@
   if (fPINDiode->GetMeanErr() < fChargeErrLimit) 
     {
-      *fLog << warn << "WARNING: Error of Fitted Charge is smaller than "
+      *fLog << warn << GetDesriptor() << ": Error of Fitted Charge is smaller than "
             << fChargeErrLimit << " in PINDiode " << endl;
       return kFALSE;
@@ -671,5 +684,5 @@
   if (fPINDiode->GetMean() < fChargeRelErrLimit*fPINDiode->GetMeanErr()) 
     {
-      *fLog << warn << "WARNING: Fitted Charge is smaller than "
+      *fLog << warn << GetDesriptor() << ": Fitted Charge is smaller than "
             << fChargeRelErrLimit << "* its error in PINDiode " << endl;
       return kFALSE;
@@ -678,5 +691,5 @@
   if (fPINDiode->GetSigma() < fPINDiode->GetPedRms())
     {
-      *fLog << warn << "WARNING: Sigma of Fitted Charge smaller than Pedestal RMS in PINDiode " << endl;
+      *fLog << warn << GetDesriptor() << ": Sigma of Fitted Charge smaller than Pedestal RMS in PINDiode " << endl;
       return kFALSE;
     }
@@ -689,5 +702,5 @@
   if (fPINDiode->GetAbsTimeMean() < lowerlimit)
     {
-      *fLog << warn << "WARNING: Mean ArrivalTime in first " << fTimeLowerLimit 
+      *fLog << warn << GetDesriptor() << ": Mean ArrivalTime in first " << fTimeLowerLimit 
             << " extraction bin in PIN Diode " << endl;
       *fLog << fPINDiode->GetAbsTimeMean() << "   " << lowerlimit << endl;
@@ -697,5 +710,5 @@
   if ( fPINDiode->GetAbsTimeMean() > upperlimit )
     {
-      *fLog << warn << "WARNING: Mean ArrivalTime in last " << fTimeUpperLimit 
+      *fLog << warn << GetDesriptor() << ": Mean ArrivalTime in last " << fTimeUpperLimit 
             << " two extraction bins in PIN Diode " << endl;
       *fLog << fPINDiode->GetAbsTimeMean() << "   " << upperlimit << endl;
@@ -741,5 +754,5 @@
   if (2.*(lambdacheck-lambda)/(lambdacheck+lambda) < fLambdaCheckLimit)
     {
-      *fLog << warn << "WARNING: Lambda and Lambda-Check differ by more than "
+      *fLog << warn << GetDesriptor() << ": Lambda and Lambda-Check differ by more than "
             << fLambdaCheckLimit << " in the Blind Pixel " << endl;
       return kFALSE;
@@ -748,5 +761,5 @@
   if (lambdaerr < fLambdaErrLimit) 
     {
-      *fLog << warn << "WARNING: Error of Fitted Lambda is greater than "
+      *fLog << warn << GetDesriptor() << ": Error of Fitted Lambda is greater than "
             << fLambdaErrLimit << " in Blind Pixel " << endl;
       return kFALSE;
@@ -763,4 +776,372 @@
 }
 
+// ------------------------------------------------------------------------
+//
+//
+Bool_t MCalibrationChargeCalc::FinalizeFFactorMethod()
+{
+
+  const UInt_t npixels  = fGeom->GetNumPixels();
+  const UInt_t nareas   = fGeom->GetNumAreas();
+  const UInt_t nsectors = fGeom->GetNumSectors();
+
+  Float_t lowlim      [nareas];
+  Float_t upplim      [nareas];
+  Float_t areavars    [nareas];
+  Float_t areaweights [nareas], sectorweights [nsectors];
+  Float_t areaphes    [nareas], sectorphes    [nsectors];
+  Int_t   numareavalid[nareas], numsectorvalid[nsectors];
+
+  memset(lowlim        ,0, nareas   * sizeof(Float_t));
+  memset(upplim        ,0, nareas   * sizeof(Float_t));
+  memset(areaphes      ,0, nareas   * sizeof(Float_t));
+  memset(areavars      ,0, nareas   * sizeof(Float_t));
+  memset(areaweights   ,0, nareas   * sizeof(Float_t));
+  memset(numareavalid  ,0, nareas   * sizeof(Int_t  ));
+  memset(sectorweights ,0, nsectors * sizeof(Float_t));
+  memset(sectorphes    ,0, nsectors * sizeof(Float_t));
+  memset(numsectorvalid,0, nsectors * sizeof(Int_t  ));
+  
+  //
+  // First loop: Get mean number of photo-electrons and the RMS
+  //             The loop is only to recognize later pixels with very deviating numbers
+  //
+  for (UInt_t i=0; i<npixels; i++)
+    {
+      
+      MCalibrationChargePix &pix = (MCalibrationChargePix&)(*fCam)  [i];
+      MBadPixelsPix         &bad = (*fBadPixels)[i];
+      
+      if (!pix.IsFFactorMethodValid())
+        continue;
+
+      if (!bad.IsCalibrationResultOK())
+        {
+          pix.SetFFactorMethodValid(kFALSE);
+          continue;
+        }
+      
+      const Float_t nphe  = pix.GetPheFFactorMethod();
+      const Float_t nvar  = pix.GetPheFFactorMethodVar();
+      const Int_t   aidx  = (*fGeom)[i].GetAidx();
+
+      if (nvar > 0.)
+        {
+          areaphes    [aidx] += nphe;
+          areavars    [aidx] += nvar;
+          numareavalid[aidx] ++;
+        } 
+    } 
+
+  for (UInt_t i=0; i<nareas; i++)
+    {
+      if (numareavalid[i] == 0)
+        {
+          *fLog << warn << GetDescriptor() << ": No pixels with valid number of photo-electrons found "
+                << "in area index: " << i << endl;
+          continue;
+        }
+
+      areaphes[i] = areaphes[i] / numareavalid[i];
+      areavars[i] = areavars[i] / numareavalid[i];
+      lowlim  [i] = areaphes[i] - fPheErrLimit*TMath::Sqrt(areavars[i]);
+      upplim  [i] = areaphes[i] + fPheErrLimit*TMath::Sqrt(areavars[i]);
+    }
+
+  memset(numareavalid,0,nareas*sizeof(Int_t));
+  memset(areaphes    ,0,nareas*sizeof(Int_t));
+  memset(areavars    ,0,nareas*sizeof(Int_t));
+
+  //
+  // Second loop: Get weighted mean number of photo-electrons and its RMS excluding 
+  //              pixels deviating by more than fPheErrLimit sigma. 
+  //              Set the conversion factor FADC counts to photo-electrons
+  // 
+  for (UInt_t i=0; i<npixels; i++)
+    {
+      
+      MCalibrationChargePix &pix = (MCalibrationChargePix&)(*fCam)[i];
+
+      if (!pix.IsFFactorMethodValid())
+        continue;
+
+      const Float_t nvar  = pix.GetPheFFactorMethodVar();
+
+      if (nvar <= 0.)
+        {
+          pix.SetFFactorMethodValid(kFALSE);
+          continue;
+        }
+      
+      MBadPixelsPix         &bad = (*fBadPixels)[i];
+
+      const Int_t   aidx   = (*fGeom)[i].GetAidx();
+      const Int_t   sector = (*fGeom)[i].GetSector();
+      const Float_t nphe   = pix.GetPheFFactorMethod();
+
+      if ( nphe < lowlim[aidx] || nphe > upplim[aidx] )
+        {
+          *fLog << warn << GetDescriptor() << ": Deviating number of photo-electrons: " 
+                << Form("%4.2f",nphe) << " out of accepted limits: [" 
+                << Form("%4.2f%s%4.2f",lowlim[aidx],",",upplim[aidx]) << "] in pixel " << i << endl;
+          bad.SetUncalibrated( MBadPixelsPix::kDeviatingNumPhes );
+          bad.SetUnsuitable  ( MBadPixelsPix::kUnreliableRun    );
+          continue;
+        }
+      
+      const Float_t weight = 1./nvar;
+      
+      areaweights   [aidx]   += weight;
+      areaphes      [aidx]   += weight*nphe;
+      numareavalid  [aidx]   ++;
+      sectorweights [sector] += weight;
+      sectorphes    [sector] += weight*nphe;
+      numsectorvalid[sector] ++;
+    } 
+
+  for (UInt_t aidx=0; aidx<nareas; aidx++)
+    {
+
+      MCalibrationChargePix &apix = (MCalibrationChargePix&)fCam->GetAverageArea(aidx);
+
+      if (areaweights[aidx] <= 0. || areaphes[aidx] <= 0.)
+        {
+          *fLog << warn << " Mean number of phe's from area index " << aidx << " cannot be calculated: "
+                << " Sum of weights: "       << areaweights[aidx] 
+                << " Sum of weighted phes: " << areaphes[aidx]    << endl;
+          apix.SetFFactorMethodValid(kFALSE);
+          continue;
+        }
+
+      *fLog << inf << "Replacing number photo-electrons of average area idx " << aidx << ": " 
+            << Form("%5.3f%s%5.3f",apix.GetPheFFactorMethod()," +- ",apix.GetPheFFactorMethodErr()) << endl;
+      *fLog << inf << "  by average number of photo-electrons from area idx " << aidx <<  ": " 
+            << Form("%5.3f%s%5.3f",areaphes[aidx] / areaweights[aidx]," +- ",
+                    TMath::Sqrt(1./areaweights[aidx])) << endl;
+
+      apix.SetPheFFactorMethod   ( areaphes[aidx]/ areaweights[aidx] );
+      apix.SetPheFFactorMethodVar(    1.         / areaweights[aidx] );      
+      apix.SetFFactorMethodValid ( kTRUE );
+
+    }
+
+  for (UInt_t sector=0; sector<nsectors; sector++)
+    {
+
+      MCalibrationChargePix &spix = (MCalibrationChargePix&)fCam->GetAverageSector(sector);
+
+      if (sectorweights[sector] <= 0. || sectorphes[sector] <= 0.)
+        {
+          *fLog << warn << " Mean number of phe's from sector " << sector << " cannot be calculated: "
+                << " Sum of weights: "       << sectorweights[sector] 
+                << " Sum of weighted phes: " << sectorphes[sector]    << endl;
+          spix.SetFFactorMethodValid(kFALSE);
+          continue;
+        }
+
+      *fLog << inf << "Replacing number photo-electrons of average sector " << sector << ": " 
+            << Form("%5.3f%s%5.3f",spix.GetPheFFactorMethod()," +- ",spix.GetPheFFactorMethodErr()) << endl;
+      *fLog << inf << "   by average number photo-electrons from sector " << sector <<  ": " 
+            << Form("%5.3f%s%5.3f",sectorphes[sector]/ sectorweights[sector]," +- ",
+                    TMath::Sqrt(1./sectorweights[sector])) << endl;
+
+      spix.SetPheFFactorMethod   ( sectorphes[sector]/ sectorweights[sector] );
+      spix.SetPheFFactorMethodVar(    1.        / sectorweights[sector] );      
+      spix.SetFFactorMethodValid ( kTRUE );
+
+    }
+
+  MCalibrationChargePix &avpix = (MCalibrationChargePix&)fCam->GetAverageArea(0);
+  MCalibrationQEPix     &qepix = (MCalibrationQEPix&)  fQECam->GetAverageArea(0);  
+
+  const Float_t avphotonflux = avpix.GetPheFFactorMethod()       
+                             / qepix.GetQEFFactor(fPulserColor)
+                             / fQECam->GetPlexiglassQE();
+
+  const Float_t avfluxrelvar = avpix.GetPheFFactorMethodRelVar() 
+                             + qepix.GetQEFFactorRelVar(fPulserColor)
+                             + fQECam->GetPlexiglassQERelVar();
+  //
+  // Third loop: With the knowledge of the overall photon flux, calculate the total 
+  //             F-Factor of the whole readout per pixel and set the quantum efficiencies 
+  //             after the F-Factor method.
+  //
+  for (UInt_t i=0; i<npixels; i++)
+    {
+      
+      MCalibrationChargePix &pix = (MCalibrationChargePix&)(*fCam)[i];
+      MCalibrationQEPix   &qepix = (MCalibrationQEPix&)  (*fQECam)[i];
+
+      if (!pix.IsFFactorMethodValid())
+        {
+          qepix.SetFFactorMethodValid(kFALSE,fPulserColor);
+          continue;
+        }
+      
+      const Float_t photons    = avphotonflux / fGeom->GetPixRatio(i);
+      const Float_t conv       = photons      / pix.GetPheFFactorMethod();
+
+      if (!pix.CalcMeanFFactor( photons , avfluxrelvar ))
+        {
+          pix.SetFFactorMethodValid(kFALSE);
+          qepix.SetFFactorMethodValid(kFALSE, fPulserColor);
+          (*fBadPixels)[i].SetUncalibrated( MBadPixelsPix::kDeviatingNumPhes );
+        }
+
+      const Float_t convrelvar = avfluxrelvar +  pix.GetPheFFactorMethodRelVar();
+
+      qepix.SetQEFFactor    ( conv                    , fPulserColor );
+      qepix.SetQEFFactorVar ( convrelvar * conv * conv, fPulserColor );      
+    }
+  
+
+  return kTRUE;
+}
+
+// ----------------------------------------------------------------------
+//
+// Sets all pixels to MBadPixelsPix::kUnsuitableRun, if following flags are set:
+// - MBadPixelsPix::kChargeIsPedestal
+// - MBadPixelsPix::kChargeErrNotValid 
+// - MBadPixelsPix::kChargeRelErrNotValid 
+// - MBadPixelsPix::kChargeSigmaNotValid 
+// - MBadPixelsPix::kMeanTimeInFirstBin 
+// - MBadPixelsPix::kMeanTimeInLast2Bins 
+//
+// Sets all pixels to MBadPixelsPix::kUnreliableRun, if following flags are set:
+// - MBadPixelsPix::kDeviatingNumPhes
+//
+void MCalibrationChargeCalc::FinalizeBadPixels()
+{
+  
+  for (Int_t i=0; i<fBadPixels->GetSize(); i++)
+    {
+      
+      MBadPixelsPix    &bad    = (*fBadPixels)[i];
+
+      if (bad.IsUncalibrated( MBadPixelsPix::kChargeIsPedestal))
+        bad.SetUnsuitable(   MBadPixelsPix::kUnsuitableRun   );
+ 
+      if (bad.IsUncalibrated( MBadPixelsPix::kChargeErrNotValid ))
+        bad.SetUnsuitable(   MBadPixelsPix::kUnsuitableRun    );
+
+      if (bad.IsUncalibrated( MBadPixelsPix::kChargeRelErrNotValid ))
+        bad.SetUnsuitable(   MBadPixelsPix::kUnsuitableRun    );
+ 
+      if (bad.IsUncalibrated( MBadPixelsPix::kChargeSigmaNotValid ))
+        bad.SetUnsuitable(   MBadPixelsPix::kUnsuitableRun    );
+
+      if (bad.IsUncalibrated( MBadPixelsPix::kMeanTimeInFirstBin ))
+        bad.SetUnsuitable(   MBadPixelsPix::kUnsuitableRun    );
+
+      if (bad.IsUncalibrated( MBadPixelsPix::kMeanTimeInLast2Bins ))
+        bad.SetUnsuitable(   MBadPixelsPix::kUnsuitableRun    );
+
+      if (bad.IsUncalibrated( MBadPixelsPix::kDeviatingNumPhes ))
+        bad.SetUnsuitable(   MBadPixelsPix::kUnreliableRun    );
+    }
+}
+
+// ------------------------------------------------------------------------
+//
+//
+void MCalibrationChargeCalc::FinalizeBlindPixelQECam()
+{
+
+  const UInt_t npixels  = fGeom->GetNumPixels();
+  
+  //
+  //  With the knowledge of the overall photon flux, calculate the 
+  //  quantum efficiencies after the Blind Pixel and PIN Diode method
+  //
+  for (UInt_t i=0; i<npixels; i++)
+    {
+      
+      MCalibrationQEPix   &qepix = (MCalibrationQEPix&)  (*fQECam)[i];
+
+      if (!fBlindPixel)
+        {
+          qepix.SetBlindPixelMethodValid(kFALSE, fPulserColor);
+          continue;
+        }
+      
+      if (!fBlindPixel->IsFluxInsidePlexiglassAvailable())
+        {
+          qepix.SetBlindPixelMethodValid(kFALSE, fPulserColor);
+          continue;
+        }
+      
+      MBadPixelsPix       &bad   =                   (*fBadPixels)[i];
+
+      if (!bad.IsUnsuitable (MBadPixelsPix::kUnsuitableRun))
+        {
+          qepix.SetBlindPixelMethodValid(kFALSE, fPulserColor);
+          continue;
+        }
+      
+      MCalibrationChargePix &pix = (MCalibrationChargePix&)(*fCam)[i];
+      MGeomPix              &geo =                        (*fGeom)[i];
+      
+      const Float_t conv       = fBlindPixel->GetFluxInsidePlexiglass() 
+                              * geo.GetA() 
+                              / fQECam->GetPlexiglassQE()
+                              / pix.GetPheFFactorMethod();
+
+      const Float_t convrelvar = fBlindPixel->GetFluxInsidePlexiglassRelVar() 
+                               + fQECam->GetPlexiglassQERelVar()
+                               + pix.GetPheFFactorMethodRelVar();
+
+      qepix.SetQEBlindPixel    ( conv                    , fPulserColor );
+      qepix.SetQEBlindPixelVar ( convrelvar * conv * conv, fPulserColor );      
+    }
+}
+
+// ------------------------------------------------------------------------
+//
+//
+void MCalibrationChargeCalc::FinalizePINDiodeQECam()
+{
+  
+  const UInt_t npixels  = fGeom->GetNumPixels();
+
+  //
+  //  With the knowledge of the overall photon flux, calculate the 
+  //  quantum efficiencies after the PIN Diode method
+  //
+  for (UInt_t i=0; i<npixels; i++)
+    {
+      
+      MCalibrationQEPix   &qepix = (MCalibrationQEPix&)  (*fQECam)[i];
+
+      if (!fPINDiode)
+        {
+          qepix.SetPINDiodeMethodValid(kFALSE, fPulserColor);
+          continue;
+        }
+      
+      if (!fPINDiode->IsFluxOutsidePlexiglassAvailable())
+        {
+          qepix.SetPINDiodeMethodValid(kFALSE, fPulserColor);
+          continue;
+        }
+
+      MBadPixelsPix &bad  =  (*fBadPixels)[i];
+
+      if (!bad.IsUnsuitable (MBadPixelsPix::kUnsuitableRun))
+        {
+          qepix.SetPINDiodeMethodValid(kFALSE, fPulserColor);
+          continue;
+        }
+      
+      MCalibrationChargePix &pix = (MCalibrationChargePix&)(*fCam)[i];
+      MGeomPix              &geo =                        (*fGeom)[i];
+      
+      const Float_t conv       = fPINDiode->GetFluxOutsidePlexiglass() * geo.GetA() / pix.GetPheFFactorMethod();
+      const Float_t convrelvar = fPINDiode->GetFluxOutsidePlexiglassRelVar() + pix.GetPheFFactorMethodRelVar();
+
+      qepix.SetQEPINDiode    ( conv                    , fPulserColor );
+      qepix.SetQEPINDiodeVar ( convrelvar * conv * conv, fPulserColor );      
+    }
+}
 
 
@@ -848,41 +1229,46 @@
     }
   
+  //
+  // Finalize Bad Pixels
   // 
-  // F-Factor calibration
-  //
-  if (fCam->CalcFluxPhotonsFFactorMethod(*fGeom, *fBadPixels))
-  {
-    fCam->ApplyFFactorCalibration(*fGeom,*fBadPixels);
+  FinalizeBadPixels();
+
+  // 
+  // Finalize F-Factor method
+  //
+  if (!FinalizeFFactorMethod())
+    {
+      *fLog << warn << "Could not calculate the photons flux from the F-Factor method " << endl;
+      fCam->SetFFactorMethodValid(kFALSE); 
+      return kFALSE;
+    }
+  else
     fCam->SetFFactorMethodValid(kTRUE);
-  }
+  
+  // 
+  // Finalize Blind Pixel
+  //
+  if (FinalizeBlindPixel())
+    fQECam->SetBlindPixelMethodValid(kTRUE);
   else
-    {
-      *fLog << warn << "Could not calculate the flux of photo-electrons from the F-Factor method, " << endl;
-      fCam->SetFFactorMethodValid(kFALSE);
-    }
-  
+    fQECam->SetBlindPixelMethodValid(kFALSE); 
+
   // 
-  // Blind Pixel calibration
-  //
-  if (!FinalizeBlindPixel())
-    fCam->SetBlindPixelMethodValid(kFALSE); 
+  // Finalize PIN Diode
+  //
+  if (FinalizePINDiode())
+    fQECam->SetPINDiodeMethodValid(kTRUE);
   else
-    {
-      fCam->SetBlindPixelMethodValid(kTRUE);
-      fCam->ApplyBlindPixelCalibration(*fGeom,*fBadPixels, *fBlindPixel);
-    }
-
-  // 
-  // PIN Diode calibration
-  //
-  if (!FinalizePINDiode())
-    fCam->SetPINDiodeMethodValid(kFALSE); 
-  else
-    {
-      fCam->SetPINDiodeMethodValid(kTRUE);
-      fCam->ApplyPINDiodeCalibration(*fGeom,*fBadPixels, *fPINDiode);
-    }
-
-  fCam->SetReadyToSave();
+    fQECam->SetPINDiodeMethodValid(kFALSE); 
+
+  //
+  // Finalize QE Cam
+  //
+  FinalizeBlindPixelQECam();
+  FinalizePINDiodeQECam();
+
+  fCam      ->SetReadyToSave();
+  fQECam    ->SetReadyToSave();
+  fBadPixels->SetReadyToSave();
   
   *fLog << inf << endl;
Index: trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.h
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.h	(revision 3677)
+++ trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.h	(revision 3678)
@@ -17,4 +17,8 @@
 #ifndef MARS_MBadPixelsPix
 #include "MBadPixelsPix.h"
+#endif
+
+#ifndef MARS_MCalibrationCam
+#include "MCalibrationCam.h"
 #endif
 
@@ -39,19 +43,21 @@
 private:
 
-  static const Float_t fgChargeLimit;       //! Default for fChargeLimit       (now set to: 3.)
-  static const Float_t fgChargeErrLimit;    //! Default for fChargeErrLimit    (now set to: 0.)
-  static const Float_t fgChargeRelErrLimit; //! Default for fChargeRelErrLimit (now set to: 1.)
-  static const Float_t fgLambdaCheckLimit;  //! Default for fLambdaCheckLimit  (now set to: 0.2)
-  static const Float_t fgLambdaErrLimit;    //! Default for fLabmdaErrLimit    (now set to: 0.2)
-  static const Float_t fgTimeLowerLimit;    //! Default for fTimeLowerLimit    (now set to: 1.) 
-  static const Float_t fgTimeUpperLimit;    //! Default for fTimeUpperLimit    (now set to: 2.)
+  static const Float_t fgChargeLimit;            //! Default for fChargeLimit            (now set to: 3.)
+  static const Float_t fgChargeErrLimit;         //! Default for fChargeErrLimit         (now set to: 0.)
+  static const Float_t fgChargeRelErrLimit;      //! Default for fChargeRelErrLimit      (now set to: 1.)
+  static const Float_t fgLambdaCheckLimit;       //! Default for fLambdaCheckLimit       (now set to: 0.2)
+  static const Float_t fgLambdaErrLimit;         //! Default for fLabmdaErrLimit         (now set to: 0.2)
+  static const Float_t fgPheErrLimit;            //! Default for fPheErrLimit            (now set to: 5.)
+  static const Float_t fgTimeLowerLimit;         //! Default for fTimeLowerLimit         (now set to: 1.) 
+  static const Float_t fgTimeUpperLimit;         //! Default for fTimeUpperLimit         (now set to: 2.)
   
-  Float_t fChargeLimit;          // Limit (in units of PedRMS) for acceptance of mean charge
-  Float_t fChargeErrLimit;       // Limit (in units of PedRMS) for acceptance of charge sigma square
-  Float_t fChargeRelErrLimit;    // Limit (in units of Sigma of fitted charge) for acceptance of mean  
-  Float_t fLambdaCheckLimit;     // Limit for rel. diff. lambda and lambdacheck blind pixel
-  Float_t fLambdaErrLimit;       // Limit for acceptance of lambda error blind pixel
-  Float_t fTimeLowerLimit;       // Limit (in units of FADC slices) for dist. to first signal slice
-  Float_t fTimeUpperLimit;       // Limit (in units of FADC slices) for dist. to last signal slice
+  Float_t fChargeLimit;            // Limit (in units of PedRMS) for acceptance of mean charge
+  Float_t fChargeErrLimit;         // Limit (in units of PedRMS) for acceptance of charge sigma square
+  Float_t fChargeRelErrLimit;      // Limit (in units of Sigma of fitted charge) for acceptance of mean  
+  Float_t fLambdaCheckLimit;       // Limit for rel. diff. lambda and lambdacheck blind pixel
+  Float_t fLambdaErrLimit;         // Limit for acceptance of lambda error blind pixel
+  Float_t fPheErrLimit;            // Limit for acceptance number phe's w.r.t area index mean (in sigmas)
+  Float_t fTimeLowerLimit;         // Limit (in units of FADC slices) for dist. to first signal slice
+  Float_t fTimeUpperLimit;         // Limit (in units of FADC slices) for dist. to last signal slice
 
   MPedestalCam               *fPedestals;     //! Pedestals of all pixels in the camera
@@ -80,6 +86,7 @@
   Int_t   fFlags;                              // Flag for the fits used
 
-  enum  { kUseQualityChecks,
-          kHiLoGainCalibration };
+  enum  { kUseQualityChecks, kHiLoGainCalibration };
+
+  MCalibrationCam::PulserColor_t fPulserColor;
   
   Int_t  PreProcess(MParList *pList);
@@ -88,10 +95,14 @@
   Int_t  PostProcess();
 
-  void FinalizePedestals(const MPedestalPix &ped, MCalibrationChargePix &cal,
-                         Float_t &avped, Float_t &avrms);
-  void FinalizeAvPedestals(MCalibrationChargePix &cal, Float_t avped, Float_t avrms, Int_t avnum);
-  Bool_t FinalizeCharges(MCalibrationChargePix &cal, MBadPixelsPix &bad);
+  void   FinalizePedestals   ( const MPedestalPix &ped, MCalibrationChargePix &cal,
+                               Float_t &avped, Float_t &avrms);
+  void   FinalizeAvPedestals ( MCalibrationChargePix &cal, Float_t avped, Float_t avrms, Int_t avnum);
+  Bool_t FinalizeCharges     ( MCalibrationChargePix &cal, MBadPixelsPix &bad );
   Bool_t FinalizePINDiode();
   Bool_t FinalizeBlindPixel();
+  Bool_t FinalizeFFactorMethod();
+  void   FinalizeBadPixels();  
+  void   FinalizeBlindPixelQECam();
+  void   FinalizePINDiodeQECam();
   
   void PrintUnsuitable(MBadPixelsPix::UnsuitableType_t typ, const char *text) const;   
@@ -104,12 +115,13 @@
   void Clear(const Option_t *o="");
   
-  void SetChargeLimit    (   const Float_t f=fgChargeLimit       ) { fChargeLimit       = f; }
-  void SetChargeErrLimit (   const Float_t f=fgChargeErrLimit    ) { fChargeErrLimit    = f; }
-  void SetChargeRelErrLimit( const Float_t f=fgChargeRelErrLimit ) { fChargeRelErrLimit = f; }
-  void SetLambdaErrLimit   ( const Float_t f=fgLambdaErrLimit   ) { fLambdaErrLimit   = f; }
-  void SetLambdaCheckLimit ( const Float_t f=fgLambdaCheckLimit ) { fLambdaCheckLimit = f; }
-
-  void SetTimeLowerLimit (   const Float_t f=fgTimeLowerLimit    ) { fTimeLowerLimit  = f;   }
-  void SetTimeUpperLimit (   const Float_t f=fgTimeUpperLimit    ) { fTimeUpperLimit  = f;   }
+  void SetChargeLimit      ( const Float_t f=fgChargeLimit       ) { fChargeLimit       = f;   }
+  void SetChargeErrLimit   ( const Float_t f=fgChargeErrLimit    ) { fChargeErrLimit    = f;   }
+  void SetChargeRelErrLimit( const Float_t f=fgChargeRelErrLimit ) { fChargeRelErrLimit = f;   }
+  void SetPheErrLimit      ( const Float_t f=fgPheErrLimit       ) { fPheErrLimit       = f;   }  
+  void SetLambdaErrLimit   ( const Float_t f=fgLambdaErrLimit    ) { fLambdaErrLimit    = f;   }
+  void SetLambdaCheckLimit ( const Float_t f=fgLambdaCheckLimit  ) { fLambdaCheckLimit  = f;   }
+  void SetPulserColor      ( MCalibrationCam::PulserColor_t col  ) { fPulserColor       = col; }
+  void SetTimeLowerLimit   ( const Float_t f=fgTimeLowerLimit    ) { fTimeLowerLimit    = f;   }
+  void SetTimeUpperLimit   ( const Float_t f=fgTimeUpperLimit    ) { fTimeUpperLimit    = f;   }
 
   void SkipQualityChecks(Bool_t b=kTRUE)
Index: trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCam.cc
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCam.cc	(revision 3677)
+++ trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCam.cc	(revision 3678)
@@ -22,38 +22,62 @@
 !
 \* ======================================================================== */
-
 /////////////////////////////////////////////////////////////////////////////
 //                                                               
 // MCalibrationChargeCam                                               
 //                                                               
-// Hold the whole Calibration results of the camera:
-//                                                               
-// 1) MCalibrationChargeCam initializes a TClonesArray whose elements are 
-//    pointers to MCalibrationChargePix Containers
-// 2) It initializes a pointer to an MCalibrationBlindPix container
-// 3) It initializes a pointer to an MCalibrationPINDiode container
-//
-//
-// The calculated values (types of GetPixelContent) are:
+// Storage container for charge calibration results of the whole camera.
+//
+// Individual pixels have to be cast when retrieved e.g.:
+// MCalibrationChargePix &avpix = (MCalibrationChargePix&)(*fChargeCam)[i]
 // 
-// --------------------------------------------------------------------------
-//
-// The types are as follows:
+// The following calibration constants can be retrieved from each pixel:
+//
+// - GetConversionFactorFFactor    ( Int_t idx, Float_t &mean, Float_t &err, Float_t &sigma );
+// - GetConversionFactorBlindPixel ( Int_t idx, Float_t &mean, Float_t &err, Float_t &sigma );
+// - GetConversionFactorPINDiode   ( Int_t idx, Float_t &mean, Float_t &err, Float_t &sigma );
+// - GetConversionFactorCombined   ( Int_t idx, Float_t &mean, Float_t &err, Float_t &sigma );
+//
+// where: 
+// - idx is the pixel software ID
+// - "mean" is the mean conversion constant, to be multiplied with the retrieved signal 
+//   in order to get a calibrated number of PHOTONS. 
+// - "err" is the pure statistical uncertainty about the MEAN
+// - "sigma", if mulitplied with the square root of signal, gives the approximate sigma of the 
+//   retrieved mean number of incident Cherenkov photons.
+//
+// Note, Conversion is ALWAYS (included the F-Factor method!) from summed FADC slices to PHOTONS.
+//
+// Averaged values over one whole area index (e.g. inner or outer pixels for 
+// the MAGIC camera), can be retrieved via: 
+// MCalibrationChargePix &avpix = (MCalibrationChargePix&)fChargeCam->GetAverageArea(i)
+//
+// Averaged values over one whole camera sector can be retrieved via: 
+// MCalibrationChargePix &avpix = (MCalibrationChargePix&)fChargeCam->GetAverageSector(i)
+//
+// Note the averageing has been done on an event-by-event basis. Resulting 
+// Sigma's of the Gauss fit have been multiplied with the square root of the number 
+// of involved pixels in order to make a direct comparison possible with the mean of 
+// sigmas. 
+//
+// See also: MCalibrationChargePix, MCalibrationChargeCalc
+//           MHCalibrationChargePix, MHCalibrationChargeCam              
+//
+// The types of GetPixelContent() are as follows:
 // 
 // Fitted values:
 // ============== 
 //
-// 0: Fitted Charge
-// 1: Error of fitted Charge
-// 2: Sigma of fitted Charge
-// 3: Error of Sigma of fitted Charge
+// 0: Fitted Charge                              (see MCalibrationPix::GetMean())
+// 1: Error of fitted Charge                     (see MCalibrationPix::GetMeanErr())
+// 2: Sigma of fitted Charge                     (see MCalibrationPix::GetSigma())
+// 3: Error of Sigma of fitted Charge            (see MCalibrationPix::GetSigmaErr())
 //
 // Useful variables derived from the fit results:
 // =============================================
 //
-// 4: Returned probability of Gauss fit to Charge distribution
-// 5: Reduced Sigma of fitted Charge --> sqrt(sigma_Q^2 - PedRMS^2)
-// 6: Error Reduced Sigma of fitted Charge 
-// 7: Reduced Sigma per Charge 
+// 4: Probability Gauss fit Charge distribution  (see MCalibrationPix::GetProb())
+// 5: Reduced Sigma of fitted Charge             (see MCalibrationChargePix::GetRSigma())
+// 6: Error Reduced Sigma of fitted Charge       (see MCalibrationChargePix::GetRSigmaErr())
+// 7: Reduced Sigma per Charge                 
 // 8: Error of Reduced Sigma per Charge 
 //
@@ -61,47 +85,47 @@
 // =============================================
 //
-//  9: Number of Photo-electrons obtained with the F-Factor method
-// 10: Error on Number of Photo-electrons obtained with the F-Factor method
-// 11: Mean conversion factor obtained with the F-Factor method
-// 12: Error on the mean conversion factor obtained with the F-Factor method
-// 13: Overall F-Factor of the readout obtained with the F-Factor method
-// 14: Error on Overall F-Factor of the readout obtained with the F-Factor method
-// 15: Pixels with valid calibration by the F-Factor-Method
-// 16: Mean conversion factor obtained with the Blind Pixel method
-// 17: Error on the mean conversion factor obtained with the Blind Pixel method
-// 18: Overall F-Factor of the readout obtained with the Blind Pixel method
-// 19: Error on Overall F-Factor of the readout obtained with the Blind Pixel method
-// 20: Pixels with valid calibration by the Blind Pixel-Method
-// 21: Mean conversion factor obtained with the PIN Diode method
-// 22: Error on the mean conversion factor obtained with the PIN Diode method
-// 23: Overall F-Factor of the readout obtained with the PIN Diode method
-// 24: Error on Overall F-Factor of the readout obtained with the PIN Diode method
-// 25: Pixels with valid calibration by the PIN Diode-Method
-//
-// Localized defects:
+//  9: Nr. Photo-electrons from F-Factor Method   (see MCalibrationChargePix::GetPheFFactorMethod())
+// 10: Error Nr. Photo-el. from F-Factor Method   (see MCalibrationChargePix::GetPheFFactorMethodErr())
+// 11: Conversion factor   from F-Factor Method   (see MCalibrationChargePix::GetMeanConversionFFactorMethod())
+// 12: Error conv. factor  from F-Factor Method   (see MCalibrationChargePix::GetConversionFFactorMethodErr())
+// 13: Overall F-Factor    from F-Factor Method   (see MCalibrationChargePix::GetTotalFFactorFFactorMethod())
+// 14: Error F-Factor      from F-Factor Method   (see MCalibrationChargePix::GetTotalFFactorFFactorMethodErr())
+// 15: Pixels valid calibration F-Factor-Method   (see MCalibrationChargePix::IsFFactorMethodValid())           
+// 16: Conversion factor   from BlindPixel Method (see MCalibrationChargePix::GetMeanConversionBlindPixelMethod()) 
+// 17: Error conv. factor  from BlindPixel Method (see MCalibrationChargePix::GetConversionBlindPixelMethodErr())  
+// 18: Overall F-Factor    from BlindPixel Method (see MCalibrationChargePix::GetTotalFFactorBlindPixelMethod())   
+// 19: Error F-Factor      from BlindPixel Method (see MCalibrationChargePix::GetTotalFFactorBlindPixelMethodErr())
+// 20: Pixels valid calibration BlindPixel-Method (see MCalibrationChargePix::IsBlindPixelMethodValid())           
+// 21: Conversion factor   from PINDiode Method   (see MCalibrationChargePix::GetMeanConversionPINDiodeMethod()) 
+// 22: Error conv. factor  from PINDiode Method   (see MCalibrationChargePix::GetConversionPINDiodeMethodErr())  
+// 23: Overall F-Factor    from PINDiode Method   (see MCalibrationChargePix::GetTotalFFactorPINDiodeMethod())   
+// 24: Error F-Factor      from PINDiode Method   (see MCalibrationChargePix::GetTotalFFactorPINDiodeMethodErr())
+// 25: Pixels valid calibration PINDiode-Method   (see MCalibrationChargePix::IsPINDiodeMethodValid())           
+//                                                
+// Localized defects:                             
 // ==================
 //
 // 26: Excluded Pixels
-// 27: Number of probable pickup events in the Hi Gain 
-// 28: Number of probable pickup events in the Lo Gain
+// 27: Number of pickup events in the Hi Gain     (see MCalibrationPix::GetHiGainNumPickup())
+// 28: Number of pickup events in the Lo Gain     (see MCalibrationPix::GetLoGainNumPickup())
 //
 // Other classifications of pixels:
 // ================================
 //
-// 29: Pixels with saturated Hi-Gain
+// 29: Pixels with saturated Hi-Gain              (see MCalibrationPix::IsHighGainSaturation())
 //
 // Used Pedestals:
 // ===============
 //
-// 30: Mean Pedestal over the entire range of signal extraction
-// 31: Error on the Mean Pedestal over the entire range of signal extraction
-// 32: Pedestal RMS over the entire range of signal extraction
-// 33: Error on the Pedestal RMS over the entire range of signal extraction
+// 30: Pedestal for entire signal extr. range     (see MCalibrationChargePix::Ped())
+// 31: Error Pedestal entire signal extr. range   (see MCalibrationChargePix::PedErr())
+// 32: Ped. RMS entire signal extraction range    (see MCalibrationChargePix::PedRms())
+// 33: Error Ped. RMS entire signal extr. range   (see MCalibrationChargePix::PedRmsErr())
 //
 // Calculated absolute arrival times (very low precision!):
 // ========================================================
 //
-// 34: Absolute Arrival time of the signal
-// 35: RMS of the Absolute Arrival time of the signal
+// 34: Absolute Arrival time of the signal        (see MCalibrationChargePix::GetAbsTimeMean())
+// 35: RMS Ab.  Arrival time of the signal        (see MCalibrationChargePix::GetAbsTimeRms())
 //
 /////////////////////////////////////////////////////////////////////////////
@@ -129,17 +153,24 @@
 
 using namespace std;
-
-const Float_t MCalibrationChargeCam::fgAverageQE                = 0.18;     
-const Float_t MCalibrationChargeCam::fgAverageQEErr             = 0.02;  
-const Float_t MCalibrationChargeCam::fgConvFFactorRelErrLimit   = 0.35;
-const Float_t MCalibrationChargeCam::fgPheFFactorRelErrLimit    = 5.;
 // --------------------------------------------------------------------------
 //
 // Default constructor. 
 //
-// Creates a TClonesArray of MCalibrationPix containers, initialized to 1 entry
-// Later, a call to MCalibrationChargeCam::InitSize(Int_t size) has to be performed
-//
-// Creates an MCalibrationBlindPix container 
+// Sets all pointers to 0
+// 
+// Creates a TClonesArray of MCalibrationChargePix containers, initialized to 1 entry, destinated 
+// to hold one container per pixel. Later, a call to MCalibrationChargeCam::InitSize() 
+// has to be performed (in MGeomApply). 
+//
+// Creates a TClonesArray of MCalibrationChargePix containers, initialized to 1 entry, destinated 
+// to hold one container per pixel AREA. Later, a call to MCalibrationChargeCam::InitAreas() 
+// has to be performed (in MGeomApply). 
+//
+// Creates a TClonesArray of MCalibrationChargePix containers, initialized to 1 entry, destinated
+// to hold one container per camera SECTOR. Later, a call to MCalibrationChargeCam::InitSectors() 
+// has to be performed (in MGeomApply). 
+//
+// Calls:
+// - Clear()
 //
 MCalibrationChargeCam::MCalibrationChargeCam(const char *name, const char *title)
@@ -148,36 +179,21 @@
       fOffvsSlope(NULL)
 {
-    fName  = name  ? name  : "MCalibrationChargeCam";
-    fTitle = title ? title : "Storage container for the Calibration Information in the camera";
-
-    fPixels           = new TClonesArray("MCalibrationChargePix",1);
-    fAverageAreas     = new TClonesArray("MCalibrationChargePix",1);
-    fAverageSectors   = new TClonesArray("MCalibrationChargePix",1);
-
-    fFluxPhesInnerPixel       = 0.;
-    fFluxPhesInnerPixelVar    = 0.;
-    fFluxPhesOuterPixel       = 0.;
-    fFluxPhesOuterPixelVar    = 0.;
-    
-    CLRBIT(fFlags,kBlindPixelMethodValid);
-    CLRBIT(fFlags,kFFactorMethodValid);
-    CLRBIT(fFlags,kPINDiodeMethodValid);
+  fName  = name  ? name  : "MCalibrationChargeCam";
+  fTitle = title ? title : "Storage container for the Calibration Information in the camera";
   
-    SetAverageQE();
-    SetConvFFactorRelErrLimit();
-    SetPheFFactorRelErrLimit();
+  fPixels           = new TClonesArray("MCalibrationChargePix",1);
+  fAverageAreas     = new TClonesArray("MCalibrationChargePix",1);
+  fAverageSectors   = new TClonesArray("MCalibrationChargePix",1);
+  
+  Clear();
 }
 
 // --------------------------------------------------------------------------
 //
-// Delete the TClonesArray of MCalibrationPix containers
-// Delete the MCalibrationPINDiode and the MCalibrationBlindPix
-//
-// Delete the histograms if they exist
+// Deletes the histograms if they exist
 //
 MCalibrationChargeCam::~MCalibrationChargeCam()
 {
 
-  
   if (fOffsets)
     delete fOffsets;
@@ -186,5 +202,4 @@
   if (fOffvsSlope)
     delete fOffvsSlope;
-
 }
 
@@ -192,15 +207,12 @@
 // --------------------------------------
 //
+// Sets all variable to 0.
+// Sets all flags to kFALSE
+// Calls MCalibrationCam::Clear()
+//
 void MCalibrationChargeCam::Clear(Option_t *o)
 {
 
-  fFluxPhesInnerPixel       = 0.;
-  fFluxPhesInnerPixelVar    = 0.;
-  fFluxPhesOuterPixel       = 0.;
-  fFluxPhesOuterPixelVar    = 0.;
-
-  CLRBIT(fFlags,kBlindPixelMethodValid);
-  CLRBIT(fFlags,kFFactorMethodValid);
-  CLRBIT(fFlags,kPINDiodeMethodValid);
+  SetFFactorMethodValid    ( kFALSE );
 
   MCalibrationCam::Clear();
@@ -209,4 +221,9 @@
 }
 
+
+// -----------------------------------------------
+//
+// Sets the kFFactorMethodValid bit from outside
+//
 void MCalibrationChargeCam::SetFFactorMethodValid(const Bool_t b)
 {
@@ -214,52 +231,13 @@
 }
 
-void MCalibrationChargeCam::SetBlindPixelMethodValid(const Bool_t b)
-{
-    b ? SETBIT(fFlags, kBlindPixelMethodValid) : CLRBIT(fFlags, kBlindPixelMethodValid); 
-}
-
-void MCalibrationChargeCam::SetPINDiodeMethodValid(const Bool_t b)
-{
-    b ? SETBIT(fFlags, kPINDiodeMethodValid) : CLRBIT(fFlags, kPINDiodeMethodValid); 
-}
-
-Float_t MCalibrationChargeCam::GetFluxPhesInnerPixelErr()   const
-{
-  if (fFluxPhesInnerPixelVar <= 0.)
-    return -1.;
-  return TMath::Sqrt(fFluxPhesInnerPixelVar);
-}
-
-Float_t MCalibrationChargeCam::GetFluxPhesOuterPixelErr()   const
-{
-  if (fFluxPhesOuterPixelVar <= 0.)
-    return -1.;
-  return TMath::Sqrt(fFluxPhesOuterPixelVar);
-}
-
-Float_t MCalibrationChargeCam::GetFluxPhotonsInnerPixelErr()   const
-{
-  if (fFluxPhotonsInnerPixelVar <= 0.)
-    return -1.;
-  return TMath::Sqrt(fFluxPhotonsInnerPixelVar);
-}
-
-Float_t MCalibrationChargeCam::GetFluxPhotonsOuterPixelErr()   const
-{
-  if (fFluxPhotonsOuterPixelVar <= 0.)
-    return -1.;
-  return TMath::Sqrt(fFluxPhotonsOuterPixelVar);
-}
-
-Bool_t  MCalibrationChargeCam::IsBlindPixelMethodValid()   const
-{
-  return TESTBIT(fFlags,kBlindPixelMethodValid);
-}
-
-Bool_t  MCalibrationChargeCam::IsPINDiodeMethodValid() const
-{
-  return TESTBIT(fFlags,kPINDiodeMethodValid);  
-}
-
+
+// --------------------------------------------------------------------------
+//
+// Test bit kFFactorMethodValid
+//
+Bool_t  MCalibrationChargeCam::IsFFactorMethodValid()   const
+{
+  return TESTBIT(fFlags,kFFactorMethodValid);
+}
 
 // --------------------------------------------------------------------------
@@ -352,25 +330,16 @@
 // ============== 
 //
-// 0: Fitted Charge
-// 1: Error of fitted Charge
-// 2: Sigma of fitted Charge
-// 3: Error of Sigma of fitted Charge
+// 0: Fitted Charge                              (see MCalibrationPix::GetMean())
+// 1: Error of fitted Charge                     (see MCalibrationPix::GetMeanErr())
+// 2: Sigma of fitted Charge                     (see MCalibrationPix::GetSigma())
+// 3: Error of Sigma of fitted Charge            (see MCalibrationPix::GetSigmaErr())
 //
 // Useful variables derived from the fit results:
 // =============================================
 //
-// 4: Returned probability of Gauss fit to Charge distribution
-// 5: Reduced Sigma of fitted Charge --> sqrt(sigma_Q^2 - PedRMS^2)
-// 6: Error Reduced Sigma of fitted Charge 
-// 7: Reduced Sigma per Charge 
-// 8: Error of Reduced Sigma per Charge 
-//
-// Useful variables derived from the fit results:
-// =============================================
-//
-// 4: Returned probability of Gauss fit to Charge distribution
-// 5: Reduced Sigma of fitted Charge --> sqrt(sigma_Q^2 - PedRMS^2)
-// 6: Error Reduced Sigma of fitted Charge 
-// 7: Reduced Sigma per Charge 
+// 4: Probability Gauss fit Charge distribution  (see MCalibrationPix::GetProb())
+// 5: Reduced Sigma of fitted Charge             (see MCalibrationChargePix::GetRSigma())
+// 6: Error Reduced Sigma of fitted Charge       (see MCalibrationChargePix::GetRSigmaErr())
+// 7: Reduced Sigma per Charge                 
 // 8: Error of Reduced Sigma per Charge 
 //
@@ -378,47 +347,47 @@
 // =============================================
 //
-//  9: Number of Photo-electrons obtained with the F-Factor method
-// 10: Error on Number of Photo-electrons obtained with the F-Factor method
-// 11: Mean conversion factor obtained with the F-Factor method
-// 12: Error on the mean conversion factor obtained with the F-Factor method
-// 13: Overall F-Factor of the readout obtained with the F-Factor method
-// 14: Error on Overall F-Factor of the readout obtained with the F-Factor method
-// 15: Pixels with valid calibration by the F-Factor-Method
-// 16: Mean conversion factor obtained with the Blind Pixel method
-// 17: Error on the mean conversion factor obtained with the Blind Pixel method
-// 18: Overall F-Factor of the readout obtained with the Blind Pixel method
-// 19: Error on Overall F-Factor of the readout obtained with the Blind Pixel method
-// 20: Pixels with valid calibration by the Blind Pixel-Method
-// 21: Mean conversion factor obtained with the PIN Diode method
-// 22: Error on the mean conversion factor obtained with the PIN Diode method
-// 23: Overall F-Factor of the readout obtained with the PIN Diode method
-// 24: Error on Overall F-Factor of the readout obtained with the PIN Diode method
-// 25: Pixels with valid calibration by the PIN Diode-Method
-//
-// Localized defects:
+//  9: Nr. Photo-electrons from F-Factor Method   (see MCalibrationChargePix::GetPheFFactorMethod())
+// 10: Error Nr. Photo-el. from F-Factor Method   (see MCalibrationChargePix::GetPheFFactorMethodErr())
+// 11: Conversion factor   from F-Factor Method   (see MCalibrationChargePix::GetMeanConversionFFactorMethod())
+// 12: Error conv. factor  from F-Factor Method   (see MCalibrationChargePix::GetConversionFFactorMethodErr())
+// 13: Overall F-Factor    from F-Factor Method   (see MCalibrationChargePix::GetTotalFFactorFFactorMethod())
+// 14: Error F-Factor      from F-Factor Method   (see MCalibrationChargePix::GetTotalFFactorFFactorMethodErr())
+// 15: Pixels valid calibration F-Factor-Method   (see MCalibrationChargePix::IsFFactorMethodValid())           
+// 16: Conversion factor   from BlindPixel Method (see MCalibrationChargePix::GetMeanConversionBlindPixelMethod()) 
+// 17: Error conv. factor  from BlindPixel Method (see MCalibrationChargePix::GetConversionBlindPixelMethodErr())  
+// 18: Overall F-Factor    from BlindPixel Method (see MCalibrationChargePix::GetTotalFFactorBlindPixelMethod())   
+// 19: Error F-Factor      from BlindPixel Method (see MCalibrationChargePix::GetTotalFFactorBlindPixelMethodErr())
+// 20: Pixels valid calibration BlindPixel-Method (see MCalibrationChargePix::IsBlindPixelMethodValid())           
+// 21: Conversion factor   from PINDiode Method   (see MCalibrationChargePix::GetMeanConversionPINDiodeMethod()) 
+// 22: Error conv. factor  from PINDiode Method   (see MCalibrationChargePix::GetConversionPINDiodeMethodErr())  
+// 23: Overall F-Factor    from PINDiode Method   (see MCalibrationChargePix::GetTotalFFactorPINDiodeMethod())   
+// 24: Error F-Factor      from PINDiode Method   (see MCalibrationChargePix::GetTotalFFactorPINDiodeMethodErr())
+// 25: Pixels valid calibration PINDiode-Method   (see MCalibrationChargePix::IsPINDiodeMethodValid())           
+//                                                
+// Localized defects:                             
 // ==================
 //
 // 26: Excluded Pixels
-// 27: Number of probable pickup events in the Hi Gain 
-// 28: Number of probable pickup events in the Lo Gain
+// 27: Number of pickup events in the Hi Gain     (see MCalibrationPix::GetHiGainNumPickup())
+// 28: Number of pickup events in the Lo Gain     (see MCalibrationPix::GetLoGainNumPickup())
 //
 // Other classifications of pixels:
 // ================================
 //
-// 29: Pixels with saturated Hi-Gain
+// 29: Pixels with saturated Hi-Gain              (see MCalibrationPix::IsHighGainSaturation())
 //
 // Used Pedestals:
 // ===============
 //
-// 30: Mean Pedestal over the entire range of signal extraction
-// 31: Error on the Mean Pedestal over the entire range of signal extraction
-// 32: Pedestal RMS over the entire range of signal extraction
-// 33: Error on the Pedestal RMS over the entire range of signal extraction
+// 30: Pedestal for entire signal extr. range     (see MCalibrationChargePix::Ped())
+// 31: Error Pedestal entire signal extr. range   (see MCalibrationChargePix::PedErr())
+// 32: Ped. RMS entire signal extraction range    (see MCalibrationChargePix::PedRms())
+// 33: Error Ped. RMS entire signal extr. range   (see MCalibrationChargePix::PedRmsErr())
 //
 // Calculated absolute arrival times (very low precision!):
 // ========================================================
 //
-// 34: Absolute Arrival time of the signal
-// 35: RMS of the Absolute Arrival time of the signal
+// 34: Absolute Arrival time of the signal        (see MCalibrationChargePix::GetAbsTimeMean())
+// 35: RMS Ab.  Arrival time of the signal        (see MCalibrationChargePix::GetAbsTimeRms())
 //
 Bool_t MCalibrationChargeCam::GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type) const
@@ -488,22 +457,15 @@
       if (pix.IsExcluded())
         return kFALSE;
-      if (pix.GetRSigma() <= 0.)
-	  return kFALSE;
-      if (pix.GetMean() <= 0.)
-        return kFALSE;
-      if (pix.GetRSigmaErr() <= 0.)
-	  return kFALSE;
-      if (pix.GetMeanErr() <= 0.)
+      if (pix.GetRSigmaRelVar() <= 0.)
+        return kFALSE;
+      if (pix.GetMeanRelVar() <= 0.)
         return kFALSE;
       // relative error Rsigma square
-      val =    pix.GetRSigmaErr()* pix.GetRSigmaErr() 
-            / (pix.GetRSigma()   * pix.GetRSigma()   );
-      // relative error  square
-      val +=   pix.GetMeanErr() * pix.GetMeanErr()
-            / (pix.GetMean()    * pix.GetMean()   );
-      // calculate relative error out of squares
-      val  =   TMath::Sqrt(val) ;
-      // multiply with value to get absolute error
-      val  *=  pix.GetRSigma() / pix.GetMean();
+      val =  pix.GetRSigmaRelVar() + pix.GetMeanRelVar();
+      //a calculate relative error out of squares
+      if (val < 0)
+        val = -1.;
+      else
+        val  =   TMath::Sqrt(val) * pix.GetRSigma() / pix.GetMean();
       break;
     case 9:
@@ -520,20 +482,20 @@
       if (pix.IsExcluded() || !pix.IsFFactorMethodValid())
         return kFALSE;
-      val = pix.GetMeanConversionFFactorMethod();
+      val = pix.GetMeanConvFADC2Phe();
       break;
     case 12:
       if (pix.IsExcluded() || !pix.IsFFactorMethodValid())
         return kFALSE;
-      val = pix.GetConversionFFactorMethodErr();
+      val = pix.GetMeanConvFADC2PheErr();
       break;
     case 13:
       if (pix.IsExcluded() || !pix.IsFFactorMethodValid())
         return kFALSE;
-      val = pix.GetTotalFFactorFFactorMethod();
+      val = pix.GetMeanFFactorFADC2Phot();
       break;
     case 14:
       if (pix.IsExcluded() || !pix.IsFFactorMethodValid())
         return kFALSE;
-      val = pix.GetTotalFFactorFFactorMethodErr();
+      val = pix.GetMeanFFactorFADC2Phot();
       break;
     case 15:
@@ -546,58 +508,32 @@
       break;
     case 16:
-      if (pix.IsExcluded() || !pix.IsBlindPixelMethodValid())
-        return kFALSE;
-      val = pix.GetMeanConversionBlindPixelMethod();
+      return kFALSE;
       break;
     case 17:
-      if (pix.IsExcluded() || !pix.IsBlindPixelMethodValid())
-        return kFALSE;
-      val = pix.GetConversionBlindPixelMethodErr();
+      return kFALSE;
       break;
     case 18:
-      if (pix.IsExcluded() || !pix.IsBlindPixelMethodValid())
-        return kFALSE;
-      val = pix.GetTotalFFactorBlindPixelMethod();
+      return kFALSE;
       break;
     case 19:
-      if (pix.IsExcluded() || !pix.IsBlindPixelMethodValid())
-        return kFALSE;
-      val = pix.GetTotalFFactorBlindPixelMethodErr();
+      return kFALSE;
       break;
     case 20:
-      if (pix.IsExcluded())
-        return kFALSE;
-      if (pix.IsBlindPixelMethodValid())
-        val = 1;
-      else
-        return kFALSE;
+      return kFALSE;
       break;
     case 21:
-      if (pix.IsExcluded() || !pix.IsPINDiodeMethodValid())
-        return kFALSE;
-      val = pix.GetMeanConversionPINDiodeMethod();
+      return kFALSE;
       break;
     case 22:
-      if (pix.IsExcluded() || !pix.IsPINDiodeMethodValid())
-        return kFALSE;
-      val = pix.GetConversionPINDiodeMethodErr();
+      return kFALSE;
       break;
     case 23:
-      if (pix.IsExcluded() || !pix.IsPINDiodeMethodValid())
-        return kFALSE;
-      val = pix.GetTotalFFactorPINDiodeMethod();
+      return kFALSE;
       break;
     case 24:
-      if (pix.IsExcluded() || !pix.IsPINDiodeMethodValid())
-        return kFALSE;
-      val = pix.GetTotalFFactorPINDiodeMethodErr();
+      return kFALSE;
       break;
     case 25:
-      if (pix.IsExcluded())
-        return kFALSE;
-      if (pix.IsPINDiodeMethodValid())
-        val = 1;
-      else
-        return kFALSE;
+      return kFALSE;
       break;
     case 26:
@@ -662,5 +598,5 @@
 // --------------------------------------------------------------------------
 //
-// What MHCamera needs in order to draw an individual pixel in the camera
+// Calls MCalibrationChargePix::DrawClone()
 //
 void MCalibrationChargeCam::DrawPixelContent(Int_t idx) const
@@ -670,480 +606,23 @@
 }
 
-//
-// Calculate the weighted mean of the phe's of all inner and outer pixels, respectively.
-// Bad pixels are excluded from the calculation. Two loops are performed to exclude pixels 
-// which are fPheFFactorRelLimit sigmas from the mean.
-//
-Bool_t MCalibrationChargeCam::CalcFluxPhotonsFFactorMethod(const MGeomCam &geom, MBadPixelsCam &bad)
-{
-
-  const Float_t avQERelVar = fAverageQEVar / (fAverageQE * fAverageQE ); 
-
-  Float_t sumweightsinner = 0.;
-  Float_t sumphesinner    = 0.;
-  Float_t sumweightsouter = 0.;
-  Float_t sumphesouter    = 0.;
-  Int_t   validinner      = 0;
-  Int_t   validouter      = 0;
-
-  TIter Next(fPixels);
-  MCalibrationChargePix *pix;
-  while ((pix=(MCalibrationChargePix*)Next()))
-    {
-
-      if (!pix->IsFFactorMethodValid())
-        continue;
-
-      const Int_t idx = pix->GetPixId();
-
-      if(!bad[idx].IsCalibrationResultOK())
-        continue;
-      
-      const Float_t nphe    = pix->GetPheFFactorMethod();
-      const Float_t npheerr = pix->GetPheFFactorMethodErr();
-      const Float_t ratio   = geom.GetPixRatio(idx);
-
-      if (npheerr > 0.)
-        {
-          const Float_t weight = nphe*nphe/npheerr/npheerr;
-          // 
-          // first the inner pixels:
-          //
-          if (ratio == 1.)
-            {
-              sumweightsinner += weight;
-              sumphesinner    += weight*nphe;
-              validinner++;
-            }
-          else
-            {
-              // 
-              // now the outers
-              //
-              sumweightsouter += weight;
-              sumphesouter    += weight*nphe;
-              validouter++;
-            }
-        } /* if npheerr != 0 */
-    } /* while ((pix=(MCalibrationChargePix*)Next())) */
-
-  if (sumweightsinner <= 0. || sumphesinner <= 0.)
-    {
-      *fLog << warn << " Mean number of phe's from inner pixels cannot be calculated: "
-            << " Sum of weights: " << sumweightsinner 
-            << " Sum of weighted phes: " << sumphesinner << endl;
-      return kFALSE;
-    }
-  else
-    {
-      fFluxPhesInnerPixel    = sumphesinner/sumweightsinner;
-      fFluxPhesInnerPixelVar = (1./sumweightsinner)*fFluxPhesInnerPixel*fFluxPhesInnerPixel;
-    }
-
-  if (sumweightsouter <= 0. || sumphesouter <= 0.)
-    {
-      *fLog << warn << " Mean number of phe's from outer pixels cannot be calculated: "
-            << " Sum of weights or sum of weighted phes is 0. " << endl;
-    }
-  else
-    {
-      fFluxPhesOuterPixel    = sumphesouter/sumweightsouter;
-      fFluxPhesOuterPixelVar = (1./sumweightsouter)*fFluxPhesOuterPixel*fFluxPhesOuterPixel;
-    }
-
-  Float_t meanFluxPhotonsRelVar  = fFluxPhesInnerPixelVar
-                                / (fFluxPhesInnerPixel * fFluxPhesInnerPixel);
-
-  fFluxPhotonsInnerPixel    =  fFluxPhesInnerPixel/fAverageQE;
-  fFluxPhotonsInnerPixelVar =  (meanFluxPhotonsRelVar + avQERelVar)
-                                 * fFluxPhotonsInnerPixel * fFluxPhotonsInnerPixel;
-
-  fFluxPhotonsOuterPixel    = 4. *fFluxPhotonsInnerPixel;
-  fFluxPhotonsOuterPixelVar = 16.*fFluxPhotonsInnerPixelVar;  
-  
-  *fLog << inf << " Mean number of photo-electrons from inner pixels (F-Factor Method): "
-        << fFluxPhesInnerPixel << " +- " << GetFluxPhesInnerPixelErr() << endl;
-
-  *fLog << inf << " Mean number of photons from inner pixels (F-Factor Method): "
-        << fFluxPhotonsInnerPixel << " +- " << GetFluxPhotonsInnerPixelErr() << endl;
-
-  //
-  // Here starts the second loop discarting pixels out of the range:
-  //
-  const Float_t innervar = (Float_t)validinner*fPheFFactorRelVarLimit*fFluxPhesInnerPixelVar;
-  const Float_t outervar = (Float_t)validouter*fPheFFactorRelVarLimit*fFluxPhesOuterPixelVar;
-  
-  Float_t innererr;
-  Float_t outererr;
-
-  if (innervar > 0.)
-    innererr = TMath::Sqrt(innervar);
-  else
-    {
-      *fLog << warn << GetDescriptor() << ": Variance of mean number of photo-electrons for inner pixels "
-            << " is smaller than 0. " << endl;
-      SetFFactorMethodValid(kFALSE);
-      return kFALSE;
-    }
-  
-  if (outervar > 0.)
-    outererr = TMath::Sqrt(outervar);
-  else
-    {
-      *fLog << warn << GetDescriptor() << ": Variance of mean number of photo-electrons for outer pixels "
-            << " is smaller than 0. " << endl;
-      SetFFactorMethodValid(kFALSE);
-      return kFALSE;
-    }
-
-  const Float_t lowerpheinnerlimit = fFluxPhesInnerPixel - innererr;
-  const Float_t upperpheinnerlimit = fFluxPhesInnerPixel + innererr;
-
-  const Float_t lowerpheouterlimit = fFluxPhesOuterPixel - outererr;
-  const Float_t upperpheouterlimit = fFluxPhesOuterPixel + outererr;
-
-  sumweightsinner = 0.;
-  sumphesinner    = 0.;
-  sumweightsouter = 0.;
-  sumphesouter    = 0.;
-   
-  TIter Next2(fPixels);
-  MCalibrationChargePix *pix2;
-  while ((pix2=(MCalibrationChargePix*)Next2()))
-    {
-
-      if (!pix2->IsFFactorMethodValid())
-        continue;
-
-      const Int_t idx = pix2->GetPixId();
-
-      if(!bad[idx].IsCalibrationResultOK())
-        continue;
-
-      const Float_t nphe    = pix2->GetPheFFactorMethod();
-      const Float_t npheerr = pix2->GetPheFFactorMethodErr();
-      const Float_t ratio   = geom.GetPixRatio(idx);
-
-      if (npheerr > 0.)
-        {
-          const Float_t weight = nphe*nphe/npheerr/npheerr;
-          // 
-          // first the inner pixels:
-          //
-          if (ratio == 1.)
-            {
-              
-              if (nphe < lowerpheinnerlimit || nphe > upperpheinnerlimit)
-                {
-                  bad[idx].SetUncalibrated(MBadPixelsPix::kDeviatingNumPhes);
-                  bad[idx].SetUnsuitable(  MBadPixelsPix::kUnreliableRun);
-                  continue;
-                }
-
-              sumweightsinner += weight;
-              sumphesinner    += weight*nphe;
-            }
-          else
-            {
-              // 
-              // now the outers
-              //
-              if (nphe < lowerpheouterlimit || nphe > upperpheouterlimit)
-                {
-                  bad[idx].SetUncalibrated(MBadPixelsPix::kDeviatingNumPhes);
-                  bad[idx].SetUnsuitable(  MBadPixelsPix::kUnreliableRun);
-                  continue;
-                }
-
-              sumweightsouter += weight;
-              sumphesouter    += weight*nphe;
-            }
-        } /* if npheerr != 0 */
-    } /* while ((pix2=(MCalibrationChargePix*)Next2())) */
-
-  if (sumweightsinner <= 0. || sumphesinner <= 0.)
-    {
-      *fLog << warn << " Mean number of phe's from inner pixels cannot be calculated: "
-            << " Sum of weights: " << sumweightsinner 
-            << " Sum of weighted phes: " << sumphesinner << endl;
-      return kFALSE;
-    }
-  else
-    {
-      fFluxPhesInnerPixel    = sumphesinner/sumweightsinner;
-      fFluxPhesInnerPixelVar = (1./sumweightsinner)*fFluxPhesInnerPixel*fFluxPhesInnerPixel;
-
-    }
-
-  if (sumweightsouter <= 0. || sumphesouter <= 0.)
-    {
-      *fLog << warn << " Mean number of phe's from outer pixels cannot be calculated: "
-            << " Sum of weights or sum of weighted phes is 0. " << endl;
-    }
-  else
-    {
-      fFluxPhesOuterPixel    = sumphesouter/sumweightsouter;
-      fFluxPhesOuterPixelVar = (1./sumweightsouter)*fFluxPhesOuterPixel*fFluxPhesOuterPixel;
-    }
-
-  meanFluxPhotonsRelVar = fFluxPhesInnerPixelVar
-                       / (fFluxPhesInnerPixel    * fFluxPhesInnerPixel);
-
-  fFluxPhotonsInnerPixel    =  fFluxPhesInnerPixel/fAverageQE;
-  fFluxPhotonsInnerPixelVar =  (meanFluxPhotonsRelVar + avQERelVar)
-                                 * fFluxPhotonsInnerPixel * fFluxPhotonsInnerPixel;
-
-  fFluxPhotonsOuterPixel    = 4. *fFluxPhotonsInnerPixel;
-  fFluxPhotonsOuterPixelVar = 16.*fFluxPhotonsInnerPixelVar;  
-
-  *fLog << inf << " Mean number of photo-electrons from inner pixels (F-Factor Method): "
-        << fFluxPhesInnerPixel << " +- " << GetFluxPhesInnerPixelErr() << endl;
-
-  *fLog << inf << " Mean number of photons from inner pixels (F-Factor Method): "
-        << fFluxPhotonsInnerPixel << " +- " << GetFluxPhotonsInnerPixelErr() << endl;
-
-  return kTRUE;
-}
-
-void MCalibrationChargeCam::ApplyFFactorCalibration(const MGeomCam &geom, const MBadPixelsCam &bad)
-{
-
-  const Float_t meanphotRelVar  = fFluxPhotonsInnerPixelVar
-                               /( fFluxPhotonsInnerPixel    * fFluxPhotonsInnerPixel );
-
-  TIter Next(fPixels);
-  MCalibrationChargePix *pix;
-  while ((pix=(MCalibrationChargePix*)Next()))
-    {
-
-      const Int_t idx = pix->GetPixId();
-
-      if (!(bad[idx].IsCalibrationResultOK()))
-        {
-          pix->SetFFactorMethodValid(kFALSE);
-          continue;
-        }
-
-      if (!(pix->IsFFactorMethodValid()))
-        continue;
-
-      const Float_t ratio   = geom.GetPixRatio(idx);
-      //
-      // Calculate the conversion factor between PHOTONS and FADC counts
-      //
-      // Nphot = Nphe / avQE
-      // conv  = Nphot / FADC counts
-      //
-      Float_t conv;
-      
-      if (ratio == 1.)
-        conv               = fFluxPhotonsInnerPixel / pix->GetMean(); 
-      else
-        conv               = fFluxPhotonsOuterPixel / pix->GetMean(); 
-
-      if (conv <= 0.)
-        {
-          pix->SetFFactorMethodValid(kFALSE);
-          continue;
-        }
-      
-      const Float_t chargeRelVar       =   pix->GetMeanErr() * pix->GetMeanErr()
-                                       / ( pix->GetMean()    * pix->GetMean());
-      const Float_t rsigmaRelVar =   pix->GetRSigmaErr() *  pix->GetRSigmaErr()
-                                        / (pix->GetRSigma()    * pix->GetRSigma()) ;
-
-      const Float_t convrelvar = meanphotRelVar + chargeRelVar;
-
-      if (convrelvar > fConvFFactorRelVarLimit)
-        {
-          *fLog << warn << GetDescriptor() << ": Conversion Factor F-Factor Method Rel. Variance: " 
-                << convrelvar << " above limit of: " << fConvFFactorRelVarLimit 
-                << " in pixel: " << idx << endl;
-          pix->SetFFactorMethodValid(kFALSE);
-          continue;
-        }
-      
-      //
-      // Calculate the Total F-Factor of the camera (in photons)
-      //
-      const Float_t totalFFactor  =  (pix->GetRSigma()/pix->GetMean())
-                                    *TMath::Sqrt(fFluxPhotonsInnerPixel);
-      
-      //
-      // Calculate the error of the Total F-Factor of the camera ( in photons )
-      //
-      const Float_t totalFFactorVar = rsigmaRelVar + chargeRelVar + meanphotRelVar;
-
-      if (convrelvar > 0. && conv > 0.)
-        pix->SetConversionFFactorMethod(conv,
-                                        TMath::Sqrt(convrelvar)*conv,
-                                        totalFFactor*TMath::Sqrt(conv));
-
-      pix->SetTotalFFactorFFactorMethod(   totalFFactor   );
-
-      if (totalFFactorVar > 0.)
-        pix->SetTotalFFactorFFactorMethodErr(TMath::Sqrt(totalFFactorVar));      
-
-      pix->SetFFactorMethodValid();
-    }
-}
-
-
-
-void MCalibrationChargeCam::ApplyBlindPixelCalibration(const MGeomCam &geom, const MBadPixelsCam &bad, const MCalibrationChargeBlindPix &blindpix)
-{
-
-  Float_t flux    = blindpix.GetFluxInsidePlexiglass();
-  Float_t fluxerr = blindpix.GetFluxInsidePlexiglassErr();
-
-  TIter Next(fPixels);
-  MCalibrationChargePix *pix;
-  while ((pix=(MCalibrationChargePix*)Next()))
-    {
-
-      const Int_t idx = pix->GetPixId();
-
-      if (!(bad[idx].IsCalibrationResultOK()))
-        {
-          pix->SetBlindPixelMethodValid(kFALSE);
-          continue;
-        }
-      
-      const Float_t charge    = pix->GetMean();
-      const Float_t area      = geom[idx].GetA();
-      const Float_t chargeerr = pix->GetMeanErr();          
-      
-      const Float_t nphot      = flux    * area;
-      const Float_t nphoterr   = fluxerr * area;
-      const Float_t conversion = nphot/charge;
-      Float_t conversionerr;
-      
-      conversionerr  = nphoterr/charge 
-                     * nphoterr/charge ;
-      conversionerr += chargeerr/charge
-                     * chargeerr/charge
-                     * conversion*conversion;
-      conversionerr = TMath::Sqrt(conversionerr);
-
-      const Float_t conversionsigma = 0.;
-      
-      pix->SetConversionBlindPixelMethod(conversion, conversionerr, conversionsigma);
-      
-      if (conversionerr/conversion < 0.1) 
-        pix->SetBlindPixelMethodValid();
-    }
-}
-
-void MCalibrationChargeCam::ApplyPINDiodeCalibration(const MGeomCam &geom, const MBadPixelsCam &bad, const MCalibrationChargePINDiode &pindiode)
-{
-
-  Float_t flux    = pindiode.GetFluxOutsidePlexiglass();
-  Float_t fluxerr = pindiode.GetFluxOutsidePlexiglassErr();
-
-  TIter Next(fPixels);
-  MCalibrationChargePix *pix;
-  while ((pix=(MCalibrationChargePix*)Next()))
-    {
-
-      const Int_t idx = pix->GetPixId();
-      
-      if (!(bad[idx].IsCalibrationResultOK()))
-        {
-          pix->SetPINDiodeMethodValid(kFALSE);
-          continue;
-        }
-      
-      const Float_t charge    = pix->GetMean();
-      const Float_t area      = geom[idx].GetA();
-      const Float_t chargeerr = pix->GetMeanErr();          
-      
-      const Float_t nphot      = flux    * area;
-      const Float_t nphoterr   = fluxerr * area;
-      const Float_t conversion = nphot/charge;
-      
-      Float_t conversionerr;
-      
-      conversionerr  = nphoterr/charge 
-                     * nphoterr/charge ;
-      conversionerr += chargeerr/charge
-                     * chargeerr/charge
-                     * conversion*conversion;
-      if (conversionerr > 0.)
-        conversionerr = TMath::Sqrt(conversionerr);
-      
-      const Float_t conversionsigma = 0.;
-      
-      pix->SetConversionPINDiodeMethod(conversion, conversionerr, conversionsigma);
-      
-      if (conversionerr/conversion < 0.1) 
-        pix->SetPINDiodeMethodValid();
-      
-    }
-}
-
-
-Bool_t MCalibrationChargeCam::GetConversionFactorBlindPixel(Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma)
+
+
+Bool_t MCalibrationChargeCam::GetConversionFactorFFactor(Int_t ipx, Float_t &mean, Float_t &err, Float_t &ffactor)
 {
 
   MCalibrationChargePix &pix = (MCalibrationChargePix&)(*this)[ipx];
 
-  mean  = pix.GetMeanConversionBlindPixelMethod();
-  err   = pix.GetConversionBlindPixelMethodErr();
-  sigma = pix.GetSigmaConversionBlindPixelMethod();
-
-  return kTRUE;
-}
-
-
-Bool_t MCalibrationChargeCam::GetConversionFactorFFactor(Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma)
-{
-
-  MCalibrationChargePix &pix = (MCalibrationChargePix&)(*this)[ipx];
-
-  Float_t conv = pix.GetMeanConversionFFactorMethod();
+  Float_t conv = pix.GetMeanConvFADC2Phe();
 
   if (conv < 0.)
     return kFALSE;
 
-  mean  = conv;
-  err   = pix.GetConversionFFactorMethodErr();
-  sigma = pix.GetSigmaConversionFFactorMethod();
+  mean    = conv;
+  err     = pix.GetMeanConvFADC2PheErr();
+  ffactor = pix.GetMeanFFactorFADC2Phot();
 
   return kTRUE;
 }
 
-
-//-----------------------------------------------------------------------------------
-//
-// Calculates the conversion factor between the integral of FADCs slices 
-// (as defined in the signal extractor MExtractSignal.cc)
-// and the number of photons reaching the plexiglass for one Inner Pixel 
-//
-Bool_t MCalibrationChargeCam::GetConversionFactorPINDiode(Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma)
-{
-
-  MCalibrationChargePix &pix = (MCalibrationChargePix&)(*this)[ipx];
-
-  mean  = pix.GetMeanConversionPINDiodeMethod();
-  err   = pix.GetConversionPINDiodeMethodErr();
-  sigma = pix.GetSigmaConversionPINDiodeMethod();
-
-  return kFALSE;
-
-}
-
-//-----------------------------------------------------------------------------------
-//
-// Calculates the best combination of the three used methods possible 
-// between the integral of FADCs slices 
-// (as defined in the signal extractor MExtractSignal.cc)
-// and the number of photons reaching one Inner Pixel. 
-// The procedure is not yet defined.
-//
-Bool_t MCalibrationChargeCam::GetConversionFactorCombined(Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma)
-{
-  return kFALSE;
-
-}
 
 /*
Index: trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCam.h
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCam.h	(revision 3677)
+++ trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCam.h	(revision 3678)
@@ -9,20 +9,7 @@
 class TH2D;
 
-class MCalibrationChargeBlindPix;
-class MCalibrationChargePINDiode;
-class MCalibrationChargePix;
 class MCalibrationChargeCam : public MCalibrationCam
 {
 private:
-  
-  static const Float_t fgAverageQE;              //! Default for fAverageQE              (now set to: 0.18)
-  static const Float_t fgAverageQEErr;           //! Default for fAverageQEErr           (now set to: 0.02)
-  static const Float_t fgConvFFactorRelErrLimit; //! Default for fConvFFactorRelErrLimit (now set to: 0.35)
-  static const Float_t fgPheFFactorRelErrLimit;  //! Default for fPheFFactorRelErrLimit  (now set to: 5.)
-  
-  Float_t fAverageQE;                // Average quantum efficieny (see Class description)
-  Float_t fAverageQEVar;             // Error av. quantum eff.    (see Class description)
-  Float_t fConvFFactorRelVarLimit;   // Acceptance limit rel. error conv. factor (F-Factor method)
-  Float_t fPheFFactorRelVarLimit;    // Acceptance limit number phe's w.r.t its mean (in variances)
   
   TH1D* fOffsets;                    //! Histogram with Higain-vs-LoGain fit result Offsets
@@ -30,15 +17,7 @@
   TH2D* fOffvsSlope;                 //! Histogram with Higain-vs-LoGain fit result Offsets vs. Slopes
 
-  enum  { kFFactorMethodValid, kBlindPixelMethodValid, kPINDiodeMethodValid, kCombinedMethodValid };
+  enum  { kFFactorMethodValid };
 
-  Float_t fFluxPhesInnerPixel;       // Mean nr.  photo-electrons in INNER PIXEL
-  Float_t fFluxPhesInnerPixelVar;    // Variance nr. photo-electrons INNER PIXEL  
-  Float_t fFluxPhesOuterPixel;       // Mean nr. photo-electrons in an OUTER PIXEL
-  Float_t fFluxPhesOuterPixelVar;    // Variance nr, photo-electrons OUTER PIXEL  
-  Float_t fFluxPhotonsInnerPixel;    // Mean nr. photo-electrons in INNER PIXEL
-  Float_t fFluxPhotonsInnerPixelVar; // Variance nr. photo-electrons INNER PIXEL  
-  Float_t fFluxPhotonsOuterPixel;    // Mean nr. photo-electrons in OUTER PIXEL
-  Float_t fFluxPhotonsOuterPixelVar; // Variance nr. photo-electrons OUTER PIXEL  
-  Byte_t fFlags;                     // Bit-fieldto hold the flags
+  Byte_t  fFlags;                    // Bit-field to hold the flags
   
 public:
@@ -47,55 +26,25 @@
   ~MCalibrationChargeCam();
   
-  void Clear(    Option_t *o="" );
+  void   Clear ( Option_t *o="" );
 
   // Setters   
-  void SetAverageQE             ( const Float_t q=fgAverageQE, 
-			          const Float_t e=fgAverageQEErr)      { fAverageQE = q; fAverageQEVar = e*e; }
-  void SetBlindPixelMethodValid ( const Bool_t  b=kTRUE                    );
-  void SetConvFFactorRelErrLimit( const Float_t f=fgConvFFactorRelErrLimit ) { fConvFFactorRelVarLimit = f*f; }
-  void SetFFactorMethodValid    ( const Bool_t  b=kTRUE                    );
-  void SetPheFFactorRelErrLimit ( const Float_t f=fgPheFFactorRelErrLimit  ) { fPheFFactorRelVarLimit  = f*f; }  
-  void SetPINDiodeMethodValid   ( const Bool_t  b=kTRUE                    );  
+  void   SetFFactorMethodValid     ( const Bool_t  b=kTRUE );
 
   // Getters
-  Bool_t  GetConversionFactorFFactor    ( Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma );
-  Bool_t  GetConversionFactorBlindPixel ( Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma );
-  Bool_t  GetConversionFactorPINDiode   ( Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma );
-  Bool_t  GetConversionFactorCombined   ( Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma );
+  Bool_t GetConversionFactorFFactor( Int_t ipx, Float_t &mean, Float_t &err, Float_t &ffactor );
 
-  Float_t GetFluxPhesInnerPixel()        const { return fFluxPhesInnerPixel;    }
-  Float_t GetFluxPhesInnerPixelErr()     const;
-  Float_t GetFluxPhesOuterPixel()        const { return fFluxPhesOuterPixel;    }
-  Float_t GetFluxPhesOuterPixelErr()     const;
-  Float_t GetFluxPhotonsInnerPixel()     const { return fFluxPhotonsInnerPixel; }
-  Float_t GetFluxPhotonsInnerPixelErr()  const;
-  Float_t GetFluxPhotonsOuterPixel()     const { return fFluxPhotonsOuterPixel; }
-  Float_t GetFluxPhotonsOuterPixelErr()  const;
-
-  Bool_t IsBlindPixelMethodValid()       const;
-  Bool_t IsPINDiodeMethodValid()         const;  
+  Bool_t IsFFactorMethodValid()      const;
 
   // Prints
-  void Print(Option_t *o="")             const;
+  void Print(Option_t *o="")         const;
   
   // Draws
-  void DrawPixelContent(Int_t num)       const;    
 //  void DrawHiLoFits();
   
   // Others
   Bool_t GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0) const;
+  void DrawPixelContent(Int_t num)   const;    
 
-  Bool_t CalcFluxPhotonsFFactorMethod(const MGeomCam &geom, MBadPixelsCam &bad);  
-
-  void   ApplyPINDiodeCalibration   ( const MGeomCam &geom,
-                                      const MBadPixelsCam &bad,
-                                      const MCalibrationChargePINDiode &pindiode );
-  void   ApplyBlindPixelCalibration ( const MGeomCam &geom,
-                                      const MBadPixelsCam &bad,
-                                      const MCalibrationChargeBlindPix &blindpix );
-  void   ApplyFFactorCalibration    ( const MGeomCam &geom, 
-	                              const MBadPixelsCam &bad                   );
-
-  ClassDef(MCalibrationChargeCam, 1)	// Container Charge Calibration Results Camera
+  ClassDef(MCalibrationChargeCam, 1) // Container Charge Calibration Results Camera
 };
 
Index: trunk/MagicSoft/Mars/mcalib/MCalibrationChargePINDiode.cc
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MCalibrationChargePINDiode.cc	(revision 3677)
+++ trunk/MagicSoft/Mars/mcalib/MCalibrationChargePINDiode.cc	(revision 3678)
@@ -51,4 +51,6 @@
 #include "MCalibrationChargePINDiode.h"
 #include "MCalibrationChargePix.h"
+
+#include "MCalibrationCam.h"
 
 #include "MLog.h"
@@ -195,4 +197,21 @@
 // --------------------------------------------------------------------------
 //
+// Return -1 if fFluxOutsidePlexiglassVar is smaller than 0.
+// Return -1 if fFluxOutsidePlexiglass is 0.
+// Return  fFluxOutsidePlexiglassVar / fFluxOutsidePlexiglass^2
+// 
+Float_t MCalibrationChargePINDiode::GetFluxOutsidePlexiglassRelVar() const
+{
+  if (fFluxOutsidePlexiglassVar < 0.)
+    return -1.;
+  
+  if (fFluxOutsidePlexiglass == 0.)
+    return -1.;
+  
+  return fFluxOutsidePlexiglassVar / (fFluxOutsidePlexiglass * fFluxOutsidePlexiglass );
+}
+
+// --------------------------------------------------------------------------
+//
 // Return -1 if fNumPhotonsVar is smaller than 0.
 // Return square root of fNumPhotonsVar
@@ -375,17 +394,17 @@
   switch (fColor)
     {
-    case kGREEN:
+    case MCalibrationCam::kGREEN:
       fFluxOutsidePlexiglass    = fNumPhotons           * gkSolidAngleRatio           * gkPINDiodeQEGreen;
       fFluxOutsidePlexiglassVar = GetNumPhotonsRelVar() + GetSolidAngleRatioRelVar()  + GetPINDiodeQEGreenRelVar();
       break;
-    case kBLUE:
+    case MCalibrationCam::kBLUE:
       fFluxOutsidePlexiglass    = fNumPhotons           * gkSolidAngleRatio           * gkPINDiodeQEBlue;
       fFluxOutsidePlexiglassVar = GetNumPhotonsRelVar() + GetSolidAngleRatioRelVar()  + GetPINDiodeQEBlueRelVar();
       break; 
-    case kUV:
+    case MCalibrationCam::kUV:
       fFluxOutsidePlexiglass    = fNumPhotons           * gkSolidAngleRatio          * gkPINDiodeQEUV;
       fFluxOutsidePlexiglassVar = GetNumPhotonsRelVar() + GetSolidAngleRatioRelVar() + GetPINDiodeQEUVRelVar();
       break;
-    case kCT1:
+    case MCalibrationCam::kCT1:
     default:
       fFluxOutsidePlexiglass    = fNumPhotons           * gkSolidAngleRatio          * gkPINDiodeQECT1;
Index: trunk/MagicSoft/Mars/mcalib/MCalibrationChargePINDiode.h
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MCalibrationChargePINDiode.h	(revision 3677)
+++ trunk/MagicSoft/Mars/mcalib/MCalibrationChargePINDiode.h	(revision 3678)
@@ -1,4 +1,8 @@
 #ifndef MARS_MCalibrationChargePINDiode
 #define MARS_MCalibrationChargePINDiode
+
+#ifndef MARS_MCalibrationCam
+#include "MCalibrationCam.h"
+#endif
 
 #ifndef MARS_MCalibrationPix
@@ -41,5 +45,5 @@
   Float_t fRmsChargeSigma;            // Sigma of RMS of summed FADC slices distribution    
   Float_t fRmsChargeSigmaErr;         // Error on Sigma RMS summed FADC slices distribution 
-  PulserColor_t fColor;               // Colour of the pulsed LEDs
+  MCalibrationCam::PulserColor_t fColor; // Colour of the pulsed LEDs
 
   enum  { kOscillating,
@@ -65,5 +69,5 @@
   void SetChargeToPhotons    ( const Float_t f=fgChargeToPhotons    ) { fChargeToPhotons    = f;   }  
   void SetChargeToPhotonsErr ( const Float_t f=fgChargeToPhotonsErr ) { fChargeToPhotonsVar = f*f; }  
-  void SetColor              ( const PulserColor_t color            ) { fColor = color;            }
+  void SetColor              ( const MCalibrationCam::PulserColor_t color) { fColor = color;   }
   void SetPedestal           (       Float_t ped, Float_t pedrms    );
   void SetRmsChargeMean      ( const Float_t f )                      { fRmsChargeMean      = f;   }
@@ -77,6 +81,7 @@
 
   // Getters
-  Float_t GetFluxOutsidePlexiglass()    const { return fFluxOutsidePlexiglass; }
-  Float_t GetFluxOutsidePlexiglassErr() const;
+  Float_t GetFluxOutsidePlexiglass      () const { return fFluxOutsidePlexiglass; }
+  Float_t GetFluxOutsidePlexiglassErr   () const;
+  Float_t GetFluxOutsidePlexiglassRelVar() const;  
 
   // Pedestals
Index: trunk/MagicSoft/Mars/mcalib/MCalibrationChargePix.cc
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MCalibrationChargePix.cc	(revision 3677)
+++ trunk/MagicSoft/Mars/mcalib/MCalibrationChargePix.cc	(revision 3678)
@@ -48,14 +48,9 @@
 // The following variables are set by MCalibrationChargeCalc:
 // - fPed, fPedVar and fPedRms                         
-// - fMeanConversionFFactorMethod, fMeanConversionBlindPixelMethod, 
-//   fMeanConversionPINDiodeMethod and fMeanConversionCombinedMethod   
-// - fConversionFFactorMethodVar, fConversionBlindPixelMethodVar 
-//   fConversionPINDiodeMethodVar and fConversionCombinedMethodVar
-// - fSigmaConversionFFactorMethod, fSigmaConversionBlindPixelMethod
-//   fSigmaConversionPINDiodeMethod and fSigmaConversionCombinedMethod  
-// - fTotalFFactorFFactorMethod, fTotalFFactorBlindPixelMethod   
-//   fTotalFFactorPINDiodeMethod and fTotalFFactorCombinedMethod     
-// - fTotalFFactorFFactorMethodVar, fTotalFFactorBlindPixelMethodVar, 
-//   fTotalFFactorPINDiodeMethodVar and fTotalFFactorCombinedMethodVar  
+// - fMeanConvFADC2Phe
+// - fConvFADC2PheVar 
+// - fSigmaConvFADC2Phe
+// - fTotalFFactorFFactorMethod 
+// - fTotalFFactorFFactorMethodVar 
 //
 // The following variables are not yet implemented:
@@ -92,4 +87,5 @@
 const Float_t MCalibrationChargePix::fgConversionHiLoErr        = 2.5;
 const Float_t MCalibrationChargePix::fgPheFFactorMethodLimit    = 5.;
+const Float_t MCalibrationChargePix::fgConvFFactorRelErrLimit   = 0.35;
 // --------------------------------------------------------------------------
 //
@@ -100,5 +96,6 @@
 // - fConversionHiLo to fgConversionHiLo
 // - fConversionHiLoVar to square of fgConversionHiLoErr
-// - fPheFFactorMethodLimit to fgPheFFactorMethodLimit
+// - fConvFFactorRelErrLimit to fgConvFFactorRelErrLimit*fgConvFFactorRelErrLimit
+// - fPheFFactorLimit to fgPheFFactorLimit
 // 
 // Calls:
@@ -120,4 +117,5 @@
 
   SetPheFFactorMethodLimit();
+  SetConvFFactorRelErrLimit();
   
   Clear();
@@ -136,8 +134,5 @@
 {
 
-  SetBlindPixelMethodValid  ( kFALSE );
   SetFFactorMethodValid     ( kFALSE );
-  SetPINDiodeMethodValid    ( kFALSE );
-  SetCombinedMethodValid    ( kFALSE );
 
   fRSigmaSquare                     =  -1.;
@@ -157,91 +152,12 @@
   fPheFFactorMethodVar              =  -1.;
 
-  fMeanConversionFFactorMethod      =  -1.;
-  fMeanConversionBlindPixelMethod   =  -1.;
-  fMeanConversionPINDiodeMethod     =  -1.;
-  fMeanConversionCombinedMethod     =  -1.;
-
-  fConversionFFactorMethodVar       =  -1.;
-  fConversionBlindPixelMethodVar    =  -1.;
-  fConversionPINDiodeMethodVar      =  -1.;
-  fConversionCombinedMethodVar      =  -1.;
-
-  fSigmaConversionFFactorMethod     =  -1.;
-  fSigmaConversionBlindPixelMethod  =  -1.;
-  fSigmaConversionPINDiodeMethod    =  -1.;
-  fSigmaConversionCombinedMethod    =  -1.;
-
-  fTotalFFactorFFactorMethod        =  -1.;
-  fTotalFFactorBlindPixelMethod     =  -1.;
-  fTotalFFactorPINDiodeMethod       =  -1.;
-  fTotalFFactorCombinedMethod       =  -1.;
+  fMeanConvFADC2Phe                 =  -1.;
+  fMeanConvFADC2PheVar              =  -1.;
+  fMeanFFactorFADC2Phot             =  -1.;
+  fMeanFFactorFADC2PhotVar          =  -1.;  
 
   MCalibrationPix::Clear();
 }
 
-
-// --------------------------------------------------------------------------
-//
-// Set conversion factors Blind Pixel Method from outside (only for MC)
-//
-void MCalibrationChargePix::SetConversionBlindPixelMethod(Float_t c, Float_t err, Float_t sig)
-{
-  fMeanConversionBlindPixelMethod  = c;
-  fConversionBlindPixelMethodVar   = err*err;
-  fSigmaConversionBlindPixelMethod = sig;
-}
-
-
-// --------------------------------------------------------------------------
-//
-// Set conversion factors Combined Method from outside (only for MC)
-//
-void MCalibrationChargePix::SetConversionCombinedMethod(Float_t c, Float_t err, Float_t sig)
-{
-  fMeanConversionCombinedMethod  = c;
-  fConversionCombinedMethodVar   = err*err;
-  fSigmaConversionCombinedMethod = sig;
-}
-
-
-// --------------------------------------------------------------------------
-//
-// Set conversion factors F-Factor Method from outside (only for MC)
-//
-void MCalibrationChargePix::SetConversionFFactorMethod(Float_t c, Float_t err, Float_t sig)
-{
-  fMeanConversionFFactorMethod  = c;
-  fConversionFFactorMethodVar   = err*err;
-  fSigmaConversionFFactorMethod = sig;
-}
-
-// --------------------------------------------------------------------------
-//
-// Set conversion factors PIN Diode Method from outside (only for MC)
-//
-void MCalibrationChargePix::SetConversionPINDiodeMethod(Float_t c, Float_t err, Float_t sig)
-{
-  fMeanConversionPINDiodeMethod  = c ;
-  fConversionPINDiodeMethodVar   = err*err;
-  fSigmaConversionPINDiodeMethod = sig;
-}
-
-// --------------------------------------------------------------------------
-//
-// Set Blind Pixel Method Validity Bit from outside 
-//
-void MCalibrationChargePix::SetBlindPixelMethodValid(const Bool_t b )
-{ 
-  b ?  SETBIT(fCalibFlags, kBlindPixelMethodValid) : CLRBIT(fCalibFlags, kBlindPixelMethodValid); 
-}    
-
-// --------------------------------------------------------------------------
-//
-// Set Combined Method Validity Bit from outside 
-//
-void MCalibrationChargePix::SetCombinedMethodValid(const Bool_t b )  
-{ 
-  b ?  SETBIT(fCalibFlags, kCombinedMethodValid) : CLRBIT(fCalibFlags, kCombinedMethodValid); 
-}
 
 // --------------------------------------------------------------------------
@@ -253,13 +169,4 @@
   b ?  SETBIT(fCalibFlags, kFFactorMethodValid) : CLRBIT(fCalibFlags, kFFactorMethodValid); 
 }    
-
-// --------------------------------------------------------------------------
-//
-// Set PIN Diode Method Validity Bit from outside 
-//
-void MCalibrationChargePix::SetPINDiodeMethodValid(const Bool_t b )  
-{ 
-  b ?  SETBIT(fCalibFlags, kPINDiodeMethodValid) : CLRBIT(fCalibFlags, kPINDiodeMethodValid); 
-}
 
 // --------------------------------------------------------------------------
@@ -485,8 +392,24 @@
   if (IsHiGainSaturation())
     return TMath::Sqrt(rsigmaVar/fRSigmaSquare + GetConversionHiLoRelVar()) * GetRSigma();
- else
-   return TMath::Sqrt(rsigmaVar);
-
-}
+  else
+    return TMath::Sqrt(rsigmaVar);
+
+}
+
+// --------------------------------------------------------------------------
+//
+// Get the reduced Sigma Square: 
+// - If fRSigmaSquare is smaller than 0 (i.e. has not yet been set), return -1.
+// - Test bit kHiGainSaturation: 
+//   If yes, return fRSigmaSquare, multiplied with fConversionHiLo^2, 
+//   If no , return fRSigmaSquare
+//
+Float_t MCalibrationChargePix::GetRSigmaSquare()  const
+{
+  if (fRSigmaSquare < 0)
+    return -1;
+
+  return IsHiGainSaturation() ? fRSigmaSquare*fConversionHiLo*fConversionHiLo : fRSigmaSquare ;
+} 
 
 // --------------------------------------------------------------------------
@@ -533,113 +456,44 @@
 // --------------------------------------------------------------------------
 //
-// Get the error on the mean conversion factor (Combined Method):
-// - If fConversionCombinedMethodVar is smaller than 0 (i.e. has not yet been set), return -1.
-// - Else returns the square root of fConversionCombinedMethodVar
-//
-Float_t MCalibrationChargePix::GetConversionCombinedMethodErr()  const
-{
-  if (fConversionCombinedMethodVar < 0.)
-    return -1.;
-  return TMath::Sqrt(fConversionCombinedMethodVar);
-}
-
-// --------------------------------------------------------------------------
-//
-// Get the error on the mean conversion factor (PINDiode Method):
-// - If fConversionPINDiodeMethodVar is smaller than 0 (i.e. has not yet been set), return -1.
-// - Else returns the square root of fConversionPINDiodeMethodVar
-//
-Float_t MCalibrationChargePix::GetConversionPINDiodeMethodErr()  const
-{
-  if (fConversionPINDiodeMethodVar < 0.)
-    return -1.;
-  return TMath::Sqrt(fConversionPINDiodeMethodVar);
-}
-
-// --------------------------------------------------------------------------
-//
-// Get the error on the mean conversion factor (BlindPixel  Method):
-// - If fConversionBlindPixelMethodVar is smaller than 0 (i.e. has not yet been set), return -1.
-// - Else returns the square root of fConversionBlindPixelMethodVar
-//
-Float_t MCalibrationChargePix::GetConversionBlindPixelMethodErr()  const
-{
-  if (fConversionBlindPixelMethodVar < 0.)
-    return -1.;
-  return TMath::Sqrt(fConversionBlindPixelMethodVar);
-}
+// Get the error on the mean total F-Factor of the signal readout (F-Factor Method):
+// - If fMeanFFactorFADC2PhotVar is smaller than 0 (i.e. has not yet been set), return -1.
+// - Else returns the square root of fMeanFFactorFADC2PhotVar
+//
+Float_t MCalibrationChargePix::GetMeanFFactorFADC2PhotErr()  const
+{
+  if (fMeanFFactorFADC2PhotVar < 0.)
+    return -1.;
+  return TMath::Sqrt(fMeanFFactorFADC2PhotVar);
+}
+
+// --------------------------------------------------------------------------
+//
+// Get the relative variance on the number of photo-electrons (F-Factor Method):
+// - If fPheFFactorMethodVar is smaller than 0 (i.e. has not yet been set), return -1.
+// - If fPheFFactorMethod    is 0, return -1.
+// - Else returns fPheFFactorMethodVar / fPheFFactorMethod^2
+//
+Float_t MCalibrationChargePix::GetPheFFactorMethodRelVar()  const
+{
+  if (fPheFFactorMethodVar < 0.)
+    return -1.;
+  if (fPheFFactorMethod  == 0.)
+    return -1.;
+
+  return fPheFFactorMethodVar / (fPheFFactorMethod * fPheFFactorMethod);
+}
+
 
 // --------------------------------------------------------------------------
 //
 // Get the error on the mean conversion factor (FFactor  Method):
-// - If fConversionFFactorMethodVar is smaller than 0 (i.e. has not yet been set), return -1.
-// - Else returns the square root of fConversionFFactorMethodVar
-//
-Float_t MCalibrationChargePix::GetConversionFFactorMethodErr()  const
-{
-  if (fConversionFFactorMethodVar < 0.)
-    return -1.;
-  return TMath::Sqrt(fConversionFFactorMethodVar);
-}
-
-// --------------------------------------------------------------------------
-//
-// Get the error on the total F-Factor (Combined  Method):
-// - If fTotalFFactorCombinedMethodVar is smaller than 0 (i.e. has not yet been set), return -1.
-// - Else returns the square root of fTotalFFactorCombinedMethodVar
-//
-Float_t MCalibrationChargePix::GetTotalFFactorCombinedMethodErr()  const
-{
-  if (fTotalFFactorCombinedMethodVar < 0.)
-    return -1.;
-  return TMath::Sqrt(fTotalFFactorCombinedMethodVar);
-}
-
-// --------------------------------------------------------------------------
-//
-// Get the error on the total F-Factor (PIN Diode  Method):
-// - If fTotalPINDiodeCombinedMethodVar is smaller than 0 (i.e. has not yet been set), return -1.
-// - Else returns the square root of fTotalPINDiodeCombinedMethodVar
-//
-Float_t MCalibrationChargePix::GetTotalFFactorPINDiodeMethodErr()  const
-{
-  if (fTotalFFactorPINDiodeMethodVar < 0.)
-    return -1.;
-  return TMath::Sqrt(fTotalFFactorPINDiodeMethodVar);
-}
-
-// --------------------------------------------------------------------------
-//
-// Get the error on the total F-Factor (Blind Pixel  Method):
-// - If fTotalBlindPixelCombinedMethodVar is smaller than 0 (i.e. has not yet been set), return -1.
-// - Else returns the square root of fTotalBlindPixelCombinedMethodVar
-//
-Float_t MCalibrationChargePix::GetTotalFFactorBlindPixelMethodErr()  const
-{
-  if (fTotalFFactorBlindPixelMethodVar < 0.)
-    return -1.;
-  return TMath::Sqrt(fTotalFFactorBlindPixelMethodVar);
-}
-
-// --------------------------------------------------------------------------
-//
-// Get the error on the total F-Factor (F-Factor  Method):
-// - If fTotalFFactorCombinedMethodVar is smaller than 0 (i.e. has not yet been set), return -1.
-// - Else returns the square root of fTotalFFactorCombinedMethodVar
-//
-Float_t MCalibrationChargePix::GetTotalFFactorFFactorMethodErr()  const
-{
-  if (fTotalFFactorFFactorMethodVar < 0.)
-    return -1.;
-  return TMath::Sqrt(fTotalFFactorFFactorMethodVar);
-}
-
-// --------------------------------------------------------------------------
-//
-// Test bit kBlindPixelMethodValid
-//
-Bool_t MCalibrationChargePix::IsBlindPixelMethodValid() const 
-{ 
-  return TESTBIT(fCalibFlags, kBlindPixelMethodValid); 
+// - If fMeanConvFADC2PheVar is smaller than 0 (i.e. has not yet been set), return -1.
+// - Else returns the square root of fMeanConvFADC2PheVar
+//
+Float_t MCalibrationChargePix::GetMeanConvFADC2PheErr()  const
+{
+  if (fMeanConvFADC2PheVar < 0.)
+    return -1.;
+  return TMath::Sqrt(fMeanConvFADC2PheVar);
 }
 
@@ -653,21 +507,4 @@
 }
 
-// --------------------------------------------------------------------------
-//
-// Test bit kPINDiodeMethodValid
-//
-Bool_t MCalibrationChargePix::IsPINDiodeMethodValid()  const 
-{ 
-  return TESTBIT(fCalibFlags, kPINDiodeMethodValid);    
-}
-
-// --------------------------------------------------------------------------
-//
-// Test bit kCombinedMethodValid
-//
-Bool_t MCalibrationChargePix::IsCombinedMethodValid()  const
-{ 
-  return TESTBIT(fCalibFlags, kCombinedMethodValid);    
-}
 
 // ----------------------------------------------------------------------------
@@ -710,6 +547,6 @@
   const Float_t pedRmsSquareVar = IsHiGainSaturation() ? fLoGainPedRmsSquareVar : 0.25*fPedVar*pedRmsSquare;
 
-  const Float_t sigmaSquare    = sigma     * sigma;
-  const Float_t sigmaSquareVar = sigmavar  * sigmaSquare;
+  const Float_t sigmaSquare    =      sigma     * sigma;
+  const Float_t sigmaSquareVar = 4. * sigmavar  * sigmaSquare;
 
   //
@@ -761,39 +598,98 @@
 
   if (fRSigmaSquare < 0.)
+    return kFALSE;
+  
+  //
+  // Square all variables in order to avoid applications of square root
+  //
+  const Float_t meanSquare          =     GetMean()    * GetMean();
+  const Float_t meanSquareRelVar    = 4.* GetMeanRelVar();
+
+  const Float_t ffactorsquare       =     gkFFactor    * gkFFactor;
+  const Float_t ffactorsquareRelVar = 4.* GetFFactorRelVar();
+
+  const Float_t rsigmaSquareRelVar  =     fRSigmaSquareVar / fRSigmaSquare / fRSigmaSquare;
+  //
+  // Calculate the number of phe's from the F-Factor method
+  // (independent on Hi Gain or Lo Gain)
+  //
+  fPheFFactorMethod = ffactorsquare * meanSquare / fRSigmaSquare;
+
+  if (fPheFFactorMethod < fPheFFactorMethodLimit)
+    return kFALSE;
+  
+  //
+  // Calculate the Error of Nphe
+  //
+  const Float_t pheRelVar = ffactorsquareRelVar + meanSquareRelVar + rsigmaSquareRelVar;
+  fPheFFactorMethodVar =  pheRelVar * fPheFFactorMethod * fPheFFactorMethod;
+
+  if (fPheFFactorMethodVar < 0. )
+    return kFALSE;
+
+  fMeanConvFADC2Phe    =  fPheFFactorMethod / GetMean();
+  
+  if (fMeanConvFADC2Phe < 0. )
+    return kFALSE;
+  
+  //
+  // In the calculation of the number of phe's one mean square has already been used. 
+  // Now, we divide by another mean, so one mean calcels out, we cannot directly propagate
+  // the errors, but have to take account of this cancellation:
+  // 
+  const Float_t convrelvar = ffactorsquareRelVar + GetMeanRelVar() + rsigmaSquareRelVar;
+
+  if (convrelvar > fConvFFactorRelVarLimit || convrelvar < 0.)
     {
-      SetFFactorMethodValid(kFALSE);
+      *fLog << warn << GetDescriptor() << ": Conversion F-Factor Method Rel. Variance: " 
+            << convrelvar << " above limits of: [0," << Form("%3.2f",fConvFFactorRelVarLimit)
+            << "] in pixel: " << fPixId << endl;
       return kFALSE;
     }
   
-  //
-  // Square all variables in order to avoid applications of square root
-  //
-  const Float_t meanSquare          =     GetMean()    * GetMean();
-  const Float_t meanSquareRelVar    = 4.* GetMeanRelVar();
-
-  const Float_t ffactorsquare       =     gkFFactor    * gkFFactor;
-  const Float_t ffactorsquareRelVar = 4.* GetFFactorRelVar();
-
-  const Float_t rsigmaSquareRelVar  =     fRSigmaSquareVar / fRSigmaSquare;
-
-  //
-  // Calculate the number of phe's from the F-Factor method
-  // (independent on Hi Gain or Lo Gain)
-  //
-  fPheFFactorMethod = ffactorsquare * meanSquare / fRSigmaSquare;
-
-  if (fPheFFactorMethod < fPheFFactorMethodLimit)
+  fMeanConvFADC2PheVar =  convrelvar * fMeanConvFADC2Phe * fMeanConvFADC2Phe;
+  
+  SetFFactorMethodValid(kTRUE);
+  return kTRUE;
+}
+
+// ----------------------------------------------------------------------------------
+//
+// If photflux is smaller or equal 0, return kFALSE
+//
+// Calculate the total F-Factor with the formula:
+//   fMeanFFactorFADC2Phot = fRSigmaSquare / GetMeanSquare() * sqrt(photflux)
+//
+// Calculate the error of the total F-Factor
+//
+Bool_t MCalibrationChargePix::CalcMeanFFactor( const Float_t photflux, const Float_t photfluxrelvar )
+{
+
+  if (photflux <= 0.)
     {
-      SetFFactorMethodValid(kFALSE);
+      *fLog << warn << GetDescriptor() << ": Assumed photon flux is smaller or equal 0." << endl;
       return kFALSE;
     }
-  
-  //
-  // Calculate the Error of Nphe
-  //
-  fPheFFactorMethodVar =  (ffactorsquareRelVar + meanSquareRelVar + rsigmaSquareRelVar) 
-                         * fPheFFactorMethod * fPheFFactorMethod;
-
-  SetFFactorMethodValid(kTRUE);
+
+  if (photfluxrelvar < 0.)
+    {
+      *fLog << warn << GetDescriptor() << ": Assumed photon flux variance is smaller than 0." << endl;
+      return kFALSE;
+    }
+
+  fMeanFFactorFADC2Phot =  fRSigmaSquare / GetMeanSquare() * TMath::Sqrt(photflux);
+  
+  if (fMeanFFactorFADC2Phot < 0.)
+    {
+      *fLog << warn << GetDescriptor() << ": F-Factor photons to FADC counts smaller than 0." << endl;
+      return kFALSE;
+    }
+  
+  const Float_t ffactorrelvar = fRSigmaSquareVar / ( fRSigmaSquare * fRSigmaSquare) 
+                              + 4.   * GetMeanRelVar() 
+                              + 0.25 * photfluxrelvar;
+  
+  fMeanFFactorFADC2PhotVar    = ffactorrelvar * fMeanFFactorFADC2Phot * fMeanFFactorFADC2Phot;
+
   return kTRUE;
 }
Index: trunk/MagicSoft/Mars/mcalib/MCalibrationChargePix.h
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MCalibrationChargePix.h	(revision 3677)
+++ trunk/MagicSoft/Mars/mcalib/MCalibrationChargePix.h	(revision 3678)
@@ -12,26 +12,24 @@
   static const Float_t gkElectronicPedRms;       //! Electronic component of ped. RMS (now set to: 1.5)
   static const Float_t gkElectronicPedRmsErr;    //! Error Electr. component ped. RMS (now set to: 0.3)
-  static const Float_t gkFFactor;                //! Laboratory F-factor PMTs       (now set to: 1.15)
-  static const Float_t gkFFactorErr;             //! Laboratory F-factor Error PMTs (now set to: 0.02)
+  static const Float_t gkFFactor;                //! Laboratory F-factor PMTs         (now set to: 1.15)
+  static const Float_t gkFFactorErr;             //! Laboratory F-factor Error PMTs   (now set to: 0.02)
 
-  static const Float_t fgConversionHiLo;         //! Default fConversionHiLo        (now set to: 10.)
-  static const Float_t fgConversionHiLoErr;      //! Default fConversionHiLoVar     (now set to: 2.5)
-  static const Float_t fgPheFFactorMethodLimit;  //! Default fPheFFactorMethodLimit (now set to: 5.)
+  static const Float_t fgConversionHiLo;         //! Default fConversionHiLo          (now set to: 10.)
+  static const Float_t fgConversionHiLoErr;      //! Default fConversionHiLoVar       (now set to: 2.5)
+  static const Float_t fgPheFFactorMethodLimit;  //! Default fPheFFactorMethodLimit   (now set to: 5.)
+  static const Float_t fgConvFFactorRelErrLimit; //! Default fConvFFactorRelErrLimit  (now set to: 0.35)  
   
   Float_t fAbsTimeMean;                     // Mean Absolute Arrival Time
   Float_t fAbsTimeRms;                      // RMS Mean Absolute Arrival Time
   Byte_t  fCalibFlags;                      // Bit-field for the class-own bits
-  Float_t fConversionFFactorMethodVar;      // Variance conversion factor (F-factor method)
-  Float_t fConversionBlindPixelMethodVar;   // Variance conversion factor (Blind Pixel method)
-  Float_t fConversionPINDiodeMethodVar;     // Variance conversion factor (PIN Diode method)
-  Float_t fConversionCombinedMethodVar;     // Variance conversion factor (all methods combined)
   Float_t fConversionHiLo;                  // Conversion factor betw. Hi Gain and Lo Gain  
   Float_t fConversionHiLoVar;               // Variance Conversion factor betw. Hi and Lo Gain
+  Float_t fConvFFactorRelVarLimit;          // Limit for acceptance rel. variance Conversion FADC2Phe
   Float_t fLoGainPedRmsSquare;              // Pedestal RMS square of Low Gain
   Float_t fLoGainPedRmsSquareVar;           // Pedestal RMS square Variance of Low Gain
-  Float_t fMeanConversionFFactorMethod;     // Conversion factor (F-factor method)
-  Float_t fMeanConversionBlindPixelMethod;  // Conversion factor (Blind Pixel method)
-  Float_t fMeanConversionPINDiodeMethod;    // Conversion factor (PIN Diode method)
-  Float_t fMeanConversionCombinedMethod;    // Conversion factor (all methods combined)
+  Float_t fMeanConvFADC2Phe;                // Conversion factor (F-factor method)
+  Float_t fMeanConvFADC2PheVar;             // Variance conversion factor (F-factor method)
+  Float_t fMeanFFactorFADC2Phot;            // Total mean F-Factor to photons (F-factor method)
+  Float_t fMeanFFactorFADC2PhotVar;         // Variance mean F-Factor photons (F-factor method)  
   Float_t fPed;                             // Pedestal (from MPedestalPix) times number FADC slices
   Float_t fPedVar;                          // Variance of pedestal 
@@ -42,19 +40,6 @@
   Float_t fRSigmaSquare;                    // Square of Reduced sigma
   Float_t fRSigmaSquareVar;                 // Variance Reduced sigma
-  Float_t fSigmaConversionFFactorMethod;    // Sigma Conversion factor (F-factor method)
-  Float_t fSigmaConversionBlindPixelMethod; // Sigma Conversion factor (Blind Pixel method)
-  Float_t fSigmaConversionPINDiodeMethod;   // Sigma Conversion factor (PIN Diode method)
-  Float_t fSigmaConversionCombinedMethod;   // Sigma Conversion factor (all methods combined)
-  Float_t fTotalFFactorFFactorMethod;       // Total F-Factor to Ph's (F-factor method)
-  Float_t fTotalFFactorBlindPixelMethod;    // Total F-Factor to Ph's (Blind Pixel method)
-  Float_t fTotalFFactorPINDiodeMethod;      // Total F-Factor to Ph's (PIN Diode method)
-  Float_t fTotalFFactorCombinedMethod;      // Total F-Factor to Ph's (all methods combined)
-  Float_t fTotalFFactorFFactorMethodVar;    // Variance total F-Factor (F-factor method)
-  Float_t fTotalFFactorBlindPixelMethodVar; // Variance total F-Factor (Blind Pixel method)
-  Float_t fTotalFFactorPINDiodeMethodVar;   // Variance total F-Factor (PIN Diode method)
-  Float_t fTotalFFactorCombinedMethodVar;   // Variance total F-Factor (all methods combined)
   
-  enum  { kBlindPixelMethodValid, kFFactorMethodValid,
-          kPINDiodeMethodValid, kCombinedMethodValid }; // Possible bits to be set
+  enum  { kFFactorMethodValid   };          // Possible bits to be set
 
   const Float_t GetConversionHiLoRelVar()  const;
@@ -71,77 +56,52 @@
   void SetAbsTimeMean ( const Float_t f ) { fAbsTimeMean = f; }
   void SetAbsTimeRms  ( const Float_t f ) { fAbsTimeRms  = f; }
-  void SetConversionHiLo    ( const Float_t c=fgConversionHiLo    ) { fConversionHiLo    = c;   }
-  void SetConversionHiLoErr ( const Float_t e=fgConversionHiLoErr ) { fConversionHiLoVar = e*e; }
-  void SetConversionFFactorMethod   ( Float_t c, Float_t err, Float_t sig );
-  void SetConversionBlindPixelMethod( Float_t c, Float_t err, Float_t sig );
-  void SetConversionPINDiodeMethod  ( Float_t c, Float_t err, Float_t sig );
-  void SetConversionCombinedMethod  ( Float_t c, Float_t err, Float_t sig );
-
-  void SetBlindPixelMethodValid( const Bool_t b = kTRUE );
+  void SetConversionHiLo    ( const Float_t c=fgConversionHiLo    )        { fConversionHiLo    = c;       }
+  void SetConversionHiLoErr ( const Float_t e=fgConversionHiLoErr )        { fConversionHiLoVar = e*e;     }
+  void SetConvFFactorRelErrLimit   ( const Float_t f=fgConvFFactorRelErrLimit) { fConvFFactorRelVarLimit = f*f;}
   void SetFFactorMethodValid   ( const Bool_t b = kTRUE );
-  void SetPINDiodeMethodValid  ( const Bool_t b = kTRUE );
-  void SetCombinedMethodValid  ( const Bool_t b = kTRUE );
-
+  void SetMeanConvFADC2Phe      ( const Float_t f)                          { fMeanConvFADC2Phe       = f; }
+  void SetMeanConvFADC2PheVar   ( const Float_t f)                          { fMeanConvFADC2PheVar    = f; }
+  void SetMeanFFactorFADC2Phot  ( const Float_t f)                          { fMeanFFactorFADC2Phot   = f; }
   void SetPedestal              ( const Float_t ped, const Float_t pedrms, const Float_t pederr);
   void SetPheFFactorMethod      ( const Float_t f)                          { fPheFFactorMethod       = f; }
   void SetPheFFactorMethodVar   ( const Float_t f)                          { fPheFFactorMethodVar    = f; }  
   void SetPheFFactorMethodLimit ( const Float_t f=fgPheFFactorMethodLimit ) { fPheFFactorMethodLimit  = f; }
-  void SetTotalFFactorFFactorMethod       ( const Float_t f)  { fTotalFFactorFFactorMethod       = f; }
-  void SetTotalFFactorBlindPixelMethod    ( const Float_t f)  { fTotalFFactorBlindPixelMethod    = f; }
-  void SetTotalFFactorPINDiodeMethod      ( const Float_t f)  { fTotalFFactorPINDiodeMethod      = f; }
-  void SetTotalFFactorFFactorMethodErr    ( const Float_t f)  { fTotalFFactorFFactorMethodVar    = f*f; }
-  void SetTotalFFactorBlindPixelMethodErr ( const Float_t f)  { fTotalFFactorBlindPixelMethodVar = f*f; }
-  void SetTotalFFactorPINDiodeMethodErr   ( const Float_t f)  { fTotalFFactorPINDiodeMethodVar   = f*f; }
   
   // Getters
-  Float_t GetAbsTimeMean                ()     const { return fAbsTimeMean;     }
-  Float_t GetAbsTimeRms                 ()     const { return fAbsTimeRms;      }
-  Float_t GetConversionHiLo             ()     const { return fConversionHiLo;  }
-  Float_t GetConversionHiLoErr          ()     const;
-  Float_t GetConversionBlindPixelMethodErr()   const;
-  Float_t GetConversionFFactorMethodErr ()     const;
-  Float_t GetConversionPINDiodeMethodErr()     const;
-  Float_t GetConversionCombinedMethodErr()     const;
-  Float_t GetConvertedLoGainMean        ()     const;
-  Float_t GetConvertedLoGainMeanErr     ()     const;
-  Float_t GetConvertedLoGainSigma       ()     const;
-  Float_t GetConvertedLoGainSigmaErr    ()     const;
-  Float_t GetMeanConversionBlindPixelMethod()  const { return fMeanConversionBlindPixelMethod  ; }
-  Float_t GetMeanConversionCombinedMethod()    const { return fMeanConversionCombinedMethod ;    }
-  Float_t GetMeanConversionFFactorMethod()     const { return fMeanConversionFFactorMethod;      }
-  Float_t GetMeanConversionPINDiodeMethod()    const { return fMeanConversionPINDiodeMethod ;    }
-  Float_t GetSigmaConversionBlindPixelMethod() const { return fSigmaConversionBlindPixelMethod ; }
-  Float_t GetSigmaConversionCombinedMethod()   const { return fSigmaConversionCombinedMethod ;   }
-  Float_t GetSigmaConversionFFactorMethod()    const { return fSigmaConversionFFactorMethod;     }
-  Float_t GetSigmaConversionPINDiodeMethod()   const { return fSigmaConversionPINDiodeMethod ;   }
-  Float_t GetPed                ()             const { return fPed;                              }
-  Float_t GetPedErr             ()             const;
-  Float_t GetPedRms             ()             const;
-  Float_t GetPedRmsErr          ()             const;
-  Float_t GetPheFFactorMethod   ()             const { return fPheFFactorMethod;                 }    
-  Float_t GetPheFFactorMethodErr()             const;
-  Float_t GetPheFFactorMethodVar()             const { return fPheFFactorMethodVar;              }
-  Float_t GetRSigma             ()             const;
-  Float_t GetRSigmaErr          ()             const;
-  Float_t GetRSigmaRelVar       ()             const;
-  Float_t GetTotalFFactorBlindPixelMethod()    const { return fTotalFFactorBlindPixelMethod;     }
-  Float_t GetTotalFFactorBlindPixelMethodErr() const;
-  Float_t GetTotalFFactorCombinedMethod()      const { return fTotalFFactorCombinedMethod;       }
-  Float_t GetTotalFFactorCombinedMethodErr()   const;
-  Float_t GetTotalFFactorFFactorMethod()       const { return fTotalFFactorFFactorMethod;        }
-  Float_t GetTotalFFactorFFactorMethodErr()    const;
-  Float_t GetTotalFFactorPINDiodeMethod()      const { return fTotalFFactorPINDiodeMethod;       }
-  Float_t GetTotalFFactorPINDiodeMethodErr()   const;
+  Float_t GetAbsTimeMean             () const { return fAbsTimeMean;             }
+  Float_t GetAbsTimeRms              () const { return fAbsTimeRms;              }
+  Float_t GetConversionHiLo          () const { return fConversionHiLo;          }
+  Float_t GetConversionHiLoErr       () const;
+  Float_t GetConvertedLoGainMean     () const;
+  Float_t GetConvertedLoGainMeanErr  () const;
+  Float_t GetConvertedLoGainSigma    () const;
+  Float_t GetConvertedLoGainSigmaErr () const;
+  Float_t GetMeanConvFADC2Phe        () const { return fMeanConvFADC2Phe;        } 
+  Float_t GetMeanConvFADC2PheErr     () const;
+  Float_t GetMeanConvFADC2PheVar     () const { return fMeanConvFADC2PheVar;     }
+  Float_t GetMeanFFactorFADC2Phot    () const { return fMeanFFactorFADC2Phot;    }
+  Float_t GetMeanFFactorFADC2PhotErr () const;
+  Float_t GetMeanFFactorFADC2PhotVar () const { return fMeanFFactorFADC2PhotVar; }    
+  Float_t GetPed                     () const { return fPed;                     }
+  Float_t GetPedErr                  () const;
+  Float_t GetPedRms                  () const;
+  Float_t GetPedRmsErr               () const;
+  Float_t GetPheFFactorMethod        () const { return fPheFFactorMethod;        }    
+  Float_t GetPheFFactorMethodErr     () const;
+  Float_t GetPheFFactorMethodVar     () const { return fPheFFactorMethodVar;     }
+  Float_t GetPheFFactorMethodRelVar  () const;
+  Float_t GetRSigma                  () const;
+  Float_t GetRSigmaErr               () const;
+  Float_t GetRSigmaSquare            () const;  
+  Float_t GetRSigmaRelVar            () const;
 
-  Bool_t IsBlindPixelMethodValid()             const;
-  Bool_t IsPINDiodeMethodValid()               const;
-  Bool_t IsFFactorMethodValid()                const;
-  Bool_t IsCombinedMethodValid()               const;
+  Bool_t IsFFactorMethodValid        () const;
 
-  // Miscellaneous
-  void   CalcLoGainPedestal(const Float_t logainsamples);
-  Bool_t CalcReducedSigma();
-  Bool_t CalcFFactorMethod();
-
+  // Calculations
+  void   CalcLoGainPedestal       ( const Float_t logainsamples  );
+  Bool_t CalcReducedSigma  ();
+  Bool_t CalcFFactorMethod ();
+  Bool_t CalcMeanFFactor   ( const Float_t photflux, const Float_t phtfluxrelvar );
+  
   ClassDef(MCalibrationChargePix, 1)	// Container Charge Calibration Results Pixel
 };
Index: trunk/MagicSoft/Mars/mcalib/MCalibrationQECam.cc
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MCalibrationQECam.cc	(revision 3677)
+++ trunk/MagicSoft/Mars/mcalib/MCalibrationQECam.cc	(revision 3678)
@@ -64,4 +64,5 @@
 /////////////////////////////////////////////////////////////////////////////
 #include "MCalibrationQECam.h"
+#include "MCalibrationCam.h"
 
 #include <TClonesArray.h>
@@ -76,4 +77,6 @@
 using namespace std;
 
+const Float_t MCalibrationQECam::gkPlexiglassQE         = 0.96;
+const Float_t MCalibrationQECam::gkPlexiglassQEErr      = 0.01;
 // --------------------------------------------------------------------------
 //
@@ -85,4 +88,5 @@
 //
 MCalibrationQECam::MCalibrationQECam(const char *name, const char *title)
+    : fFlags(MCalibrationCam::gkNumPulserColors)
 {
     fName  = name  ? name  : "MCalibrationQECam";
@@ -93,6 +97,195 @@
     fAverageSectors   = new TClonesArray("MCalibrationQEPix",1);
 
-}
-
+    Clear();
+}
+
+// ------------------------------------------------------------------------
+//
+// Sets all bits to kFALSE
+// 
+// Calls:
+// - MCalibrationCam::Clear()
+//
+void MCalibrationQECam::Clear(Option_t *o)
+{
+
+  SetBlindPixelMethodValid ( kFALSE, MCalibrationCam::kGREEN);
+  SetFFactorMethodValid    ( kFALSE, MCalibrationCam::kGREEN);
+  SetCombinedMethodValid   ( kFALSE, MCalibrationCam::kGREEN);
+  SetPINDiodeMethodValid   ( kFALSE, MCalibrationCam::kGREEN);
+  SetBlindPixelMethodValid ( kFALSE, MCalibrationCam::kBLUE);
+  SetFFactorMethodValid    ( kFALSE, MCalibrationCam::kBLUE);
+  SetCombinedMethodValid   ( kFALSE, MCalibrationCam::kBLUE);
+  SetPINDiodeMethodValid   ( kFALSE, MCalibrationCam::kBLUE);
+  SetBlindPixelMethodValid ( kFALSE, MCalibrationCam::kUV);
+  SetFFactorMethodValid    ( kFALSE, MCalibrationCam::kUV);
+  SetCombinedMethodValid   ( kFALSE, MCalibrationCam::kUV);
+  SetPINDiodeMethodValid   ( kFALSE, MCalibrationCam::kUV);
+  SetBlindPixelMethodValid ( kFALSE, MCalibrationCam::kCT1);
+  SetFFactorMethodValid    ( kFALSE, MCalibrationCam::kCT1);
+  SetCombinedMethodValid   ( kFALSE, MCalibrationCam::kCT1);
+  SetPINDiodeMethodValid   ( kFALSE, MCalibrationCam::kCT1);
+
+  MCalibrationCam::Clear();
+}
+
+// --------------------------------------------------------------------------
+//
+// Return -1 if gkPlexiglassQEErr is smaller than 0.
+// Return -1 if gkPlexiglassQE    is 0.
+// Return gkPlexiglassQEErr^2 / (gkPlexiglassQE^2 )
+// 
+Float_t MCalibrationQECam::GetPlexiglassQERelVar() const
+{
+  if (gkPlexiglassQEErr < 0.)
+    return -1.;
+  
+  if (gkPlexiglassQE  == 0.)
+    return -1.;
+  
+  return gkPlexiglassQEErr * gkPlexiglassQEErr / gkPlexiglassQE / gkPlexiglassQE ;
+}
+
+
+void MCalibrationQECam::SetBlindPixelMethodValid ( Bool_t b ) 
+{
+  SetBlindPixelMethodValid ( b, MCalibrationCam::kGREEN);
+  SetBlindPixelMethodValid ( b, MCalibrationCam::kBLUE );
+  SetBlindPixelMethodValid ( b, MCalibrationCam::kUV   );
+  SetBlindPixelMethodValid ( b, MCalibrationCam::kCT1  );
+}
+
+void MCalibrationQECam::SetCombinedMethodValid ( Bool_t b ) 
+{
+  SetCombinedMethodValid ( b, MCalibrationCam::kGREEN);
+  SetCombinedMethodValid ( b, MCalibrationCam::kBLUE );
+  SetCombinedMethodValid ( b, MCalibrationCam::kUV   );
+  SetCombinedMethodValid ( b, MCalibrationCam::kCT1  );
+}
+
+void MCalibrationQECam::SetFFactorMethodValid ( Bool_t b ) 
+{
+  SetFFactorMethodValid ( b, MCalibrationCam::kGREEN);
+  SetFFactorMethodValid ( b, MCalibrationCam::kBLUE );
+  SetFFactorMethodValid ( b, MCalibrationCam::kUV   );
+  SetFFactorMethodValid ( b, MCalibrationCam::kCT1  );
+}
+
+void MCalibrationQECam::SetPINDiodeMethodValid ( Bool_t b ) 
+{
+  SetPINDiodeMethodValid ( b, MCalibrationCam::kGREEN);
+  SetPINDiodeMethodValid ( b, MCalibrationCam::kBLUE );
+  SetPINDiodeMethodValid ( b, MCalibrationCam::kUV   );
+  SetPINDiodeMethodValid ( b, MCalibrationCam::kCT1  );
+}
+
+void MCalibrationQECam::SetBlindPixelMethodValid ( Bool_t b,  MCalibrationCam::PulserColor_t col ) 
+{
+  if (b) 
+    SETBIT(fFlags[ MCalibrationCam::kGREEN ],kBlindPixelMethodValid);
+  else
+    CLRBIT(fFlags[ MCalibrationCam::kGREEN ],kBlindPixelMethodValid);    
+}
+
+void MCalibrationQECam::SetPINDiodeMethodValid ( Bool_t b,  MCalibrationCam::PulserColor_t col ) 
+{
+  if (b) 
+    SETBIT(fFlags[ MCalibrationCam::kGREEN ],kPINDiodeMethodValid);
+  else
+    CLRBIT(fFlags[ MCalibrationCam::kGREEN ],kPINDiodeMethodValid);    
+}
+
+void MCalibrationQECam::SetFFactorMethodValid ( Bool_t b,  MCalibrationCam::PulserColor_t col ) 
+{
+  if (b) 
+    SETBIT(fFlags[ MCalibrationCam::kGREEN ],kFFactorMethodValid);
+  else
+    CLRBIT(fFlags[ MCalibrationCam::kGREEN ],kFFactorMethodValid);    
+}
+
+void MCalibrationQECam::SetCombinedMethodValid ( Bool_t b,  MCalibrationCam::PulserColor_t col ) 
+{
+  if (b) 
+    SETBIT(fFlags[ MCalibrationCam::kGREEN ],kCombinedMethodValid);
+  else
+    CLRBIT(fFlags[ MCalibrationCam::kGREEN ],kCombinedMethodValid);    
+}
+
+Bool_t MCalibrationQECam::IsBlindPixelMethodValid () const  
+{
+  if (IsBlindPixelMethodValid (MCalibrationCam::kGREEN))
+    return kTRUE;
+  if (IsBlindPixelMethodValid (MCalibrationCam::kBLUE ))
+    return kTRUE;
+  if (IsBlindPixelMethodValid (MCalibrationCam::kUV   ))
+    return kTRUE;
+  if (IsBlindPixelMethodValid (MCalibrationCam::kCT1  ))
+    return kTRUE;
+
+  return kFALSE;
+}
+
+Bool_t MCalibrationQECam::IsCombinedMethodValid () const
+{
+  if (IsCombinedMethodValid (MCalibrationCam::kGREEN))
+    return kTRUE;
+  if (IsCombinedMethodValid (MCalibrationCam::kBLUE ))
+    return kTRUE;
+  if (IsCombinedMethodValid (MCalibrationCam::kUV   ))
+    return kTRUE;
+  if (IsCombinedMethodValid (MCalibrationCam::kCT1  ))
+    return kTRUE;
+
+  return kFALSE;
+}
+
+Bool_t MCalibrationQECam::IsFFactorMethodValid () const
+{
+  if (IsFFactorMethodValid (MCalibrationCam::kGREEN))
+    return kTRUE;
+  if (IsFFactorMethodValid (MCalibrationCam::kBLUE ))
+    return kTRUE;
+  if (IsFFactorMethodValid (MCalibrationCam::kUV   ))
+    return kTRUE;
+  if (IsFFactorMethodValid (MCalibrationCam::kCT1  ))
+    return kTRUE;
+
+  return kFALSE;
+}
+
+
+Bool_t MCalibrationQECam::IsPINDiodeMethodValid () const
+{
+  if (IsPINDiodeMethodValid (MCalibrationCam::kGREEN))
+    return kTRUE;
+  if (IsPINDiodeMethodValid (MCalibrationCam::kBLUE ))
+    return kTRUE;
+  if (IsPINDiodeMethodValid (MCalibrationCam::kUV   ))
+    return kTRUE;
+  if (IsPINDiodeMethodValid (MCalibrationCam::kCT1  ))
+    return kTRUE;
+
+  return kFALSE;
+}
+
+Bool_t MCalibrationQECam::IsBlindPixelMethodValid (MCalibrationCam::PulserColor_t col)  const
+{
+  return TESTBIT(fFlags[ MCalibrationCam::kGREEN ],kBlindPixelMethodValid);
+}
+
+Bool_t MCalibrationQECam::IsCombinedMethodValid (MCalibrationCam::PulserColor_t col)  const
+{
+  return TESTBIT(fFlags[ MCalibrationCam::kGREEN ],kCombinedMethodValid);
+}
+
+Bool_t MCalibrationQECam::IsFFactorMethodValid (MCalibrationCam::PulserColor_t col)  const
+{
+  return TESTBIT(fFlags[ MCalibrationCam::kGREEN ],kFFactorMethodValid);
+}
+
+Bool_t MCalibrationQECam::IsPINDiodeMethodValid (MCalibrationCam::PulserColor_t col)  const
+{
+  return TESTBIT(fFlags[ MCalibrationCam::kGREEN ],kPINDiodeMethodValid);
+}
 
 // --------------------------------------------------------------------------
@@ -114,7 +307,4 @@
       if (!pix->IsExcluded() && pix->IsValid()) 
 	{
-	    *fLog << all << "Pix " << pix->GetPixId() 
-		<< ":  QE: "                   << pix->GetQE(kCT1)        << " +- " << pix->GetQEErr(kCT1) 
-		<< endl;
           id++;
 	}
@@ -134,7 +324,4 @@
         if (!pix->IsExcluded() && !pix->IsValid())
           {
-	    *fLog << all << "Pix " << pix->GetPixId() 
-		<< ":  QE: "                   << pix->GetQE(kCT1)        << " +- " << pix->GetQEErr(kCT1) 
-		<< endl;
             id++;
           }
@@ -188,26 +375,26 @@
     {
     case 0:
-      val = pix.GetQE(kCT1);
+      val = pix.GetQEBlindPixel(kCT1);
       break;
     case 1:
-      val = pix.GetQEErr(kCT1);
+      val = pix.GetQEBlindPixelErr(kCT1);
       break;
     case 2:
-      val = pix.GetQE(kGREEN);
+      val = pix.GetQEBlindPixel(kGREEN);
       break;
     case 3:
-      val = pix.GetQEErr(kGREEN);
+      val = pix.GetQEBlindPixelErr(kGREEN);
       break;
     case 4:
-      val = pix.GetQE(kBLUE);
+      val = pix.GetQEBlindPixel(kBLUE);
       break;
     case 5:
-      val = pix.GetQEErr(kBLUE);
+      val = pix.GetQEBlindPixelErr(kBLUE);
       break;
     case 6:
-      val = pix.GetQE(kUV);
+      val = pix.GetQEBlindPixel(kUV);
       break;
     case 7:
-      val = pix.GetQEErr(kUV);
+      val = pix.GetQEBlindPixelErr(kUV);
       break;
     default:
Index: trunk/MagicSoft/Mars/mcalib/MCalibrationQECam.h
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MCalibrationQECam.h	(revision 3677)
+++ trunk/MagicSoft/Mars/mcalib/MCalibrationQECam.h	(revision 3678)
@@ -6,13 +6,51 @@
 #endif
 
+#ifndef ROOT_TArrayC
+#include "TArrayC.h"
+#endif
+
 class MCalibrationQECam : public MCalibrationCam
 {
 private:
-  
+
+  static const Float_t gkPlexiglassQE   ;  //! Quantum Efficiency Plexiglass
+  static const Float_t gkPlexiglassQEErr;  //! Uncertainty QE Plexiglass
+
+  TArrayC fFlags;
+
+  enum { kBlindPixelMethodValid, kFFactorMethodValid,
+         kPINDiodeMethodValid, kCombinedMethodValid };
+
 public:
 
   MCalibrationQECam(const char *name=NULL, const char *title=NULL);
   ~MCalibrationQECam() {}
+
+  void Clear( Option_t *o="");
   
+  Float_t GetPlexiglassQE       () const { return gkPlexiglassQE; }
+  Float_t GetPlexiglassQERelVar () const; 
+
+  // Only for MC (Ciao Abelardo!!)
+  void SetBlindPixelMethodValid ( Bool_t  b=kTRUE );
+  void SetFFactorMethodValid    ( Bool_t  b=kTRUE );  
+  void SetCombinedMethodValid   ( Bool_t  b=kTRUE );
+  void SetPINDiodeMethodValid   ( Bool_t  b=kTRUE );  
+
+  void SetBlindPixelMethodValid ( Bool_t  b, MCalibrationCam::PulserColor_t col);
+  void SetFFactorMethodValid    ( Bool_t  b, MCalibrationCam::PulserColor_t col);  
+  void SetCombinedMethodValid   ( Bool_t  b, MCalibrationCam::PulserColor_t col);
+  void SetPINDiodeMethodValid   ( Bool_t  b, MCalibrationCam::PulserColor_t col);  
+
+  Bool_t IsBlindPixelMethodValid() const;
+  Bool_t IsFFactorMethodValid   () const;  
+  Bool_t IsCombinedMethodValid  () const;  
+  Bool_t IsPINDiodeMethodValid  () const;  
+
+  Bool_t IsBlindPixelMethodValid(MCalibrationCam::PulserColor_t col) const;
+  Bool_t IsFFactorMethodValid   (MCalibrationCam::PulserColor_t col) const;  
+  Bool_t IsCombinedMethodValid  (MCalibrationCam::PulserColor_t col) const;  
+  Bool_t IsPINDiodeMethodValid  (MCalibrationCam::PulserColor_t col) const;  
+
   // Prints
   void Print(Option_t *o="") const;
Index: trunk/MagicSoft/Mars/mcalib/MCalibrationQEPix.cc
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MCalibrationQEPix.cc	(revision 3677)
+++ trunk/MagicSoft/Mars/mcalib/MCalibrationQEPix.cc	(revision 3678)
@@ -24,19 +24,80 @@
 
 /////////////////////////////////////////////////////////////////////////////
-//                                                                         //
-// MCalibrationQEPix                                                       //
-//                                                                         //
-// Storage container of the calibrated Quantrum Efficiency of one pixel 
-// For the moment, only a fixed average QE is stored:
-//
-// - Average QE: (email David Paneque, 14.2.04):
-//
-//  The conversion factor that comes purely from QE folded to a Cherenkov
-//  spectrum has to be multiplied by:
-//  * Plexiglass window -->> 0.96 X 0.96
-//  * PMT photoelectron collection efficiency -->> 0.9
-//  * Light guides efficiency -->> 0.94
-//
-//  Concerning the light guides effiency estimation... Daniel Ferenc 
+//                                                                      
+// MCalibrationQEPix                                                    
+//                                                                      
+// Storage container of the calibrated Quantrum Efficiency of one pixel. 
+// This container (like MCalibrationQECam) is designed to persist during 
+// several eventloops over different calibration files, especially those 
+// with different colour LEDs. It is the class calibration the Quantum 
+// efficiency for each individual pixel.
+// 
+// At the moment, this calibration works in the following steps:
+//
+// 1)  MHCalibrationChargeCam extracts mean and sigma (and its errors) of 
+//     the summed FADC slices distribution and stores them in MCalibrationCam 
+//     
+// 2)  MHCalibrationChargeBlindPix extracts the mean of a Poisson fit to the 
+//     single photo-electron spectrum and stores it in MCalibrationChargeBlindPix
+//     
+// 3)  MHCalibrationChargePINDiode extracts the mean of a charge distribution 
+//     of the signals collected by the PIN Diode and stores it in MCalibrationChargePINDiode
+//     
+// 4)  MCalibrationCalc calculates for every pixel the number of photo-electrons
+//     with the F-Factor method (see MCalibrationCalc)
+//
+// 5)  MCalibrationCalc calculates the (weighted) average number of photo-electrons 
+//     from the pixels with the area index 0 (Inner pixels for the MAGIC camera) 
+//     and divides this number by gkDefaultQEGreen, gkDefaultQEBlue, gkDefaultQEUV 
+//     or gkDefaultQECT1, depending on the implied pulser LED colour, and further 
+//     by MCalibratinoQECam::gkPlexiglassQE. The obtained number gives the NUMBER 
+//     OF PHOTONS incident on a pixel with area index 0 (INNER pixel) OUTSIDE THE 
+//     PLEXIGLASS of the camera, obtained with the F-Factor method.
+//
+// 6)  MCalibrationCalc calculates the mean photon flux per mm^2 in the camera 
+//     from the MCalibrationChargeBlindPix, multiplies it with the area of 
+//     one pixel with area index 0 (Inner pixel) and divides it by the quantum 
+//     efficiency of the plexi-glass (MCalibratinoQECam::gkPlexiglassQE). The obtained 
+//     number gives the NUMBER OF PHOTONS incident on a pixel with area index 0 
+//     (INNER pixel) OUTSIDE THE PLEXIGLASS of the camera, obtained with the 
+//     Blind Pixel method. 
+//
+// 7)  MCalibrationCalc calculates the mean photon flux per mm^2 in the camera 
+//     from the MCalibrationChargePINDiode and multiplies it with the area of 
+//     one pixel with area index 0 (Inner pixel). The obtained number gives the 
+//     NUMBER OF PHOTONS incident on a pixel with area index 0 (INNER pixel) 
+//     OUTSIDE THE PLEXIGLASS of the camera, obtained with the PIN Diode method. 
+//
+// 8)  Each of the three photons numbers is divided by the mean sum of FADC counts 
+//     and defined as MEASURED QUANTUM EFFICIENCY AT A GIVEN COLOUR. They are stored 
+//     in the variables SetQE*Method ( qe, colour ). 
+//
+// 9)  Errors are propagated and corresponding variances get stored in: SetQE*Var( qe, colour).
+//
+// 10) After every eventloop, MCalibrationChargeCalc calls the function: Update*Method().
+//     which calculates the ratio measured QE / gkDefaultQE* of every colour implied so far 
+//     and calculates an weighted average of these quantum-efficiency normalizations obtained
+//     by one of the three methods.
+//
+// 11) A call to GetQECascades* returns then the normalization multiplied with an average QE 
+//     folded into a cascades spectrum. This number should be dependent on zenith angle, but 
+//     this feature is not yet implemented, instead a fixed number gkDefaultAverageQE is used. 
+// 
+// The number gkDefaultAverageQE = 0.20 +- 0.02 can be obtained in the following way: 
+//                             
+// * Averaged QE coated PMTs: zenith     value
+//                              0.       0.237
+//                             20.       0.237
+//                             40.       0.236
+//                             60.       0.234
+// (from D.Paneque et al., NIM A 504, 2003, 109-115
+// 
+// * PMT photoelectron collection efficiency: 0.9
+// (from D.Paneque, email 14.2.2004)
+//
+// * Light guides efficiency: 0.94
+// (from D.Paneque, email 14.2.2004)
+// 
+// "Concerning the light guides effiency estimation... Daniel Ferenc 
 //  is preparing some work (simulations) to estimate it. Yet so far, he has 
 //  been busy with other stuff, and this work is still UNfinished.
@@ -58,35 +119,49 @@
 //  which is the variation of teh entrance window cross section. So, in 
 //  first approximation, no loses when increasing light incidence angle; 
-//  and therefore, the factor 0.94.
-//
-//  So, summarizing... I would propose the following conversion factors 
-//  (while working with CT1 cal box) in order to get the final number of photons 
-//  from the detected measured size in ADC counts.
-// 
-//  Nph = ADC * FmethodConversionFactor / ConvPhe-PhFactor
-// 
-//  FmethodConversionFactor ; measured for individual pmts
-// 
-//  ConvPhe-PhFactor = 0.98 * 0.23 * 0.90 * 0.94 * 0.96 * 0.96 = 0.18
-// 
-//  I would not apply any smearing of this factor (which we have in nature), 
-//  since we might be applying it to PMTs in the totally wrong direction.
-// 
-// 
+//  and therefore, the factor 0.94."
+//
 /////////////////////////////////////////////////////////////////////////////
 #include "MCalibrationQEPix.h"
+#include "MCalibrationCam.h"
 
 #include "MLog.h"
 #include "MLogManip.h"
 
+#include "TArrayF.h"
+#include "TArrayC.h"
+
 ClassImp(MCalibrationQEPix);
 
 using namespace std;
 
+const Float_t MCalibrationQEPix::gkDefaultQEGreen      = 0.192;
+const Float_t MCalibrationQEPix::gkDefaultQEBlue       = 0.27;
+const Float_t MCalibrationQEPix::gkDefaultQEUV         = 0.285;
+const Float_t MCalibrationQEPix::gkDefaultQECT1        = 0.285;
+const Float_t MCalibrationQEPix::gkDefaultQEGreenErr   = 0.05 ;
+const Float_t MCalibrationQEPix::gkDefaultQEBlueErr    = 0.07 ;
+const Float_t MCalibrationQEPix::gkDefaultQEUVErr      = 0.07 ;
+const Float_t MCalibrationQEPix::gkDefaultQECT1Err     = 0.07 ;
+const Float_t MCalibrationQEPix::gkDefaultAverageQE    = 0.20;     
+const Float_t MCalibrationQEPix::gkDefaultAverageQEErr = 0.02;  
 // --------------------------------------------------------------------------
 //
 // Default Constructor: 
 //
+// Initializes all TArrays to MCalibrationCam::gkNumPulserColors
+//
+// Calls:
+// - Clear()
+//
 MCalibrationQEPix::MCalibrationQEPix(const char *name, const char *title)
+    :  fQEBlindPixel    ( MCalibrationCam::gkNumPulserColors), 
+       fQEBlindPixelVar ( MCalibrationCam::gkNumPulserColors ),
+       fQECombined      ( MCalibrationCam::gkNumPulserColors ),    
+       fQECombinedVar   ( MCalibrationCam::gkNumPulserColors ), 
+       fQEFFactor       ( MCalibrationCam::gkNumPulserColors ),     
+       fQEFFactorVar    ( MCalibrationCam::gkNumPulserColors ),  
+       fQEPINDiode      ( MCalibrationCam::gkNumPulserColors ),    
+       fQEPINDiodeVar   ( MCalibrationCam::gkNumPulserColors ), 
+       fValidFlags      ( MCalibrationCam::gkNumPulserColors )
 {
 
@@ -98,129 +173,905 @@
 }
 
+// ----------------------------------------------------------------------------------------------
+// 
+// Search all available QE's of a certain colour after the blind pixel method, 
+// compare them to the default QE of that colour and 
+// add up a weighted average (wav) and a sum of weights (sumw)
+//
+// FIXME: This has to be replaced by a decent fit the QE-spectrum!
+//
+void MCalibrationQEPix::AddAverageBlindPixelQEs(const MCalibrationCam::PulserColor_t col, Float_t &wav, Float_t &sumw )
+{
+
+  if (IsBlindPixelMethodValid (col))
+  {
+    const Float_t newavqe    =   GetQEBlindPixel(col)       / GetDefaultQE (col) ; 
+    const Float_t newavqevar = ( GetQEBlindPixelRelVar(col) + GetDefaultQERelVar(col) ) * newavqe * newavqe;
+    wav  += newavqe / newavqevar;
+    sumw += 1. / newavqevar ;
+  }
+}
+
+// ----------------------------------------------------------------------------------------------
+// 
+// Search all available QE's of a certain colour after the combination of the three methods
+// compare them to the default QE of that colour and 
+// add up a weighted average (wav) and a sum of weights (sumw)
+//
+// FIXME: This has to be replaced by a decent fit the QE-spectrum!
+//
+void MCalibrationQEPix::AddAverageCombinedQEs(const MCalibrationCam::PulserColor_t col, Float_t &wav, Float_t &sumw )
+{
+
+  if (IsCombinedMethodValid (col))
+  {
+    const Float_t newavqe    =   GetQECombined(col)       / GetDefaultQE (col) ; 
+    const Float_t newavqevar = ( GetQECombinedRelVar(col) + GetDefaultQERelVar(col) ) * newavqe * newavqe;
+    wav  += newavqe / newavqevar;
+    sumw += 1./ newavqevar;
+  }
+}
+
+// ----------------------------------------------------------------------------------------------
+// 
+// Search all available QE's of a certain colour after the F-Factor method, 
+// compare them to the default QE of that colour and 
+// add up a weighted average (wav) and a sum of weights (sumw)
+//
+// FIXME: This has to be replaced by a decent fit the QE-spectrum!
+//
+void MCalibrationQEPix::AddAverageFFactorQEs(const MCalibrationCam::PulserColor_t col, Float_t &wav, Float_t &sumw )
+{
+
+  if (IsFFactorMethodValid (col))
+  {
+    const Float_t newavqe    =   GetQEFFactor(col)       / GetDefaultQE (col) ; 
+    const Float_t newavqevar = ( GetQEFFactorRelVar(col) + GetDefaultQERelVar(col) ) * newavqe * newavqe;
+    wav  += newavqe / newavqevar;
+    sumw += 1./ newavqevar;
+  }
+}
+
+// ----------------------------------------------------------------------------------------------
+// 
+// Search all available QE's of a certain colour after the PIN Diode method, 
+// compare them to the default QE of that colour and 
+// add up a weighted average (wav) and a sum of weights (sumw)
+//
+// FIXME: This has to be replaced by a decent fit the QE-spectrum!
+//
+void MCalibrationQEPix::AddAveragePINDiodeQEs(const MCalibrationCam::PulserColor_t col, Float_t &wav, Float_t &sumw )
+{
+
+  if (IsPINDiodeMethodValid (col))
+  {
+    const Float_t newavqe    =   GetQEPINDiode(col)       / GetDefaultQE (col) ; 
+    const Float_t newavqevar = ( GetQEPINDiodeRelVar(col) + GetDefaultQERelVar(col) ) * newavqe * newavqe;
+    wav  += newavqe / newavqevar;
+    sumw += 1./ newavqevar;
+  }
+}
+
+
+
 // ------------------------------------------------------------------------
 //
-// Invalidate values
+// Sets all quantum efficiencies to the gkDefaultQE*
+// Sets all Variances to the square root of gkDefaultQE*Err
+// Sets all flags to kFALSE
+// 
+// Calls:
+// - MCalibrationPix::Clear()
 //
 void MCalibrationQEPix::Clear(Option_t *o)
 {
 
-  fQEGreen      =  -1.;
-  fQEBlue       =  -1.;
-  fQEUV         =  -1.;
-  fQECT1        =  -1.;
+  SetAverageQEBlindPixelAvailable ( kFALSE );
+  SetAverageQEFFactorAvailable    ( kFALSE );
+  SetAverageQECombinedAvailable   ( kFALSE );
+  SetAverageQEPINDiodeAvailable   ( kFALSE );
+
+  fQEBlindPixel    [ MCalibrationCam::kGREEN ] = gkDefaultQEGreen;  
+  fQEBlindPixelVar [ MCalibrationCam::kGREEN ] = gkDefaultQEGreenErr*gkDefaultQEGreenErr;
+  fQEFFactor       [ MCalibrationCam::kGREEN ] = gkDefaultQEGreen;     
+  fQEFFactorVar    [ MCalibrationCam::kGREEN ] = gkDefaultQEGreenErr*gkDefaultQEGreenErr;
+  fQECombined      [ MCalibrationCam::kGREEN ] = gkDefaultQEGreen;    
+  fQECombinedVar   [ MCalibrationCam::kGREEN ] = gkDefaultQEGreenErr*gkDefaultQEGreenErr; 
+  fQEPINDiode      [ MCalibrationCam::kGREEN ] = gkDefaultQEGreen;    
+  fQEPINDiodeVar   [ MCalibrationCam::kGREEN ] = gkDefaultQEGreenErr*gkDefaultQEGreenErr; 
+
+  SetBlindPixelMethodValid ( kFALSE, MCalibrationCam::kGREEN);
+  SetFFactorMethodValid    ( kFALSE, MCalibrationCam::kGREEN);
+  SetCombinedMethodValid   ( kFALSE, MCalibrationCam::kGREEN);
+  SetPINDiodeMethodValid   ( kFALSE, MCalibrationCam::kGREEN);
+
+  fQEBlindPixel    [ MCalibrationCam::kBLUE ] = gkDefaultQEBlue;  
+  fQEBlindPixelVar [ MCalibrationCam::kBLUE ] = gkDefaultQEBlueErr*gkDefaultQEBlueErr;
+  fQEFFactor       [ MCalibrationCam::kBLUE ] = gkDefaultQEBlue;     
+  fQEFFactorVar    [ MCalibrationCam::kBLUE ] = gkDefaultQEBlueErr*gkDefaultQEBlueErr;
+  fQECombined      [ MCalibrationCam::kBLUE ] = gkDefaultQEBlue;    
+  fQECombinedVar   [ MCalibrationCam::kBLUE ] = gkDefaultQEBlueErr*gkDefaultQEBlueErr; 
+  fQEPINDiode      [ MCalibrationCam::kBLUE ] = gkDefaultQEBlue;    
+  fQEPINDiodeVar   [ MCalibrationCam::kBLUE ] = gkDefaultQEBlueErr*gkDefaultQEBlueErr; 
+
+  SetBlindPixelMethodValid ( kFALSE, MCalibrationCam::kBLUE);
+  SetFFactorMethodValid    ( kFALSE, MCalibrationCam::kBLUE);
+  SetCombinedMethodValid   ( kFALSE, MCalibrationCam::kBLUE);
+  SetPINDiodeMethodValid   ( kFALSE, MCalibrationCam::kBLUE);
+
+  fQEBlindPixel    [ MCalibrationCam::kUV ] = gkDefaultQEUV;  
+  fQEBlindPixelVar [ MCalibrationCam::kUV ] = gkDefaultQEUVErr*gkDefaultQEUVErr;
+  fQEFFactor       [ MCalibrationCam::kUV ] = gkDefaultQEUV;     
+  fQEFFactorVar    [ MCalibrationCam::kUV ] = gkDefaultQEUVErr*gkDefaultQEUVErr;
+  fQECombined      [ MCalibrationCam::kUV ] = gkDefaultQEUV;    
+  fQECombinedVar   [ MCalibrationCam::kUV ] = gkDefaultQEUVErr*gkDefaultQEUVErr; 
+  fQEPINDiode      [ MCalibrationCam::kUV ] = gkDefaultQEUV;    
+  fQEPINDiodeVar   [ MCalibrationCam::kUV ] = gkDefaultQEUVErr*gkDefaultQEUVErr; 
+
+  SetBlindPixelMethodValid ( kFALSE, MCalibrationCam::kUV);
+  SetFFactorMethodValid    ( kFALSE, MCalibrationCam::kUV);
+  SetCombinedMethodValid   ( kFALSE, MCalibrationCam::kUV);
+  SetPINDiodeMethodValid   ( kFALSE, MCalibrationCam::kUV);
+
+  fQEBlindPixel    [ MCalibrationCam::kCT1 ] = gkDefaultQECT1;  
+  fQEBlindPixelVar [ MCalibrationCam::kCT1 ] = gkDefaultQECT1Err*gkDefaultQECT1Err;
+  fQEFFactor       [ MCalibrationCam::kCT1 ] = gkDefaultQECT1;     
+  fQEFFactorVar    [ MCalibrationCam::kCT1 ] = gkDefaultQECT1Err*gkDefaultQECT1Err;
+  fQECombined      [ MCalibrationCam::kCT1 ] = gkDefaultQECT1;    
+  fQECombinedVar   [ MCalibrationCam::kCT1 ] = gkDefaultQECT1Err*gkDefaultQECT1Err; 
+  fQEPINDiode      [ MCalibrationCam::kCT1 ] = gkDefaultQECT1;    
+  fQEPINDiodeVar   [ MCalibrationCam::kCT1 ] = gkDefaultQECT1Err*gkDefaultQECT1Err; 
+
+  SetBlindPixelMethodValid ( kFALSE, MCalibrationCam::kCT1);
+  SetFFactorMethodValid    ( kFALSE, MCalibrationCam::kCT1);
+  SetCombinedMethodValid   ( kFALSE, MCalibrationCam::kCT1);
+  SetPINDiodeMethodValid   ( kFALSE, MCalibrationCam::kCT1);
+
+  MCalibrationPix::Clear();
+}
+
+
+// -----------------------------------------------------------------
+//
+// Return the average Default QE (depending on zenith angle)
+//
+const Float_t MCalibrationQEPix::GetAverageQE( const Float_t zenith ) const 
+{
+  return gkDefaultAverageQE ; 
+}
+
+// -----------------------------------------------------------------
+//
+// Return the relative variance of the average Default QE (depending on zenith angle)
+//
+const Float_t MCalibrationQEPix::GetAverageQERelVar( const Float_t zenith ) const 
+{
+  return gkDefaultAverageQEErr * gkDefaultAverageQEErr / (gkDefaultAverageQE * gkDefaultAverageQE ); 
+}
+
+// -----------------------------------------------------------------
+//
+// Return the relative variance of the average normalization (Blind Pixel Method)
+//
+const Float_t MCalibrationQEPix::GetAvNormBlindPixelRelVar( ) const 
+{
+  return fAvNormBlindPixelVar / (fAvNormBlindPixel * fAvNormBlindPixel ); 
+}
+
+// -----------------------------------------------------------------
+//
+// Return the relative variance of the average normalization (Combined Method)
+//
+const Float_t MCalibrationQEPix::GetAvNormCombinedRelVar( ) const 
+{
+  return fAvNormCombinedVar / (fAvNormCombined * fAvNormCombined ); 
+}
+
+// -----------------------------------------------------------------
+//
+// Return the relative variance of the average normalization (F-Factor Method)
+//
+const Float_t MCalibrationQEPix::GetAvNormFFactorRelVar( ) const 
+{
+  return fAvNormFFactorVar / (fAvNormFFactor * fAvNormFFactor ); 
+}
+
+// -----------------------------------------------------------------
+//
+// Return the relative variance of the average normalization (PIN Diode Method)
+//
+const Float_t MCalibrationQEPix::GetAvNormPINDiodeRelVar( ) const 
+{
+  return fAvNormPINDiodeVar / (fAvNormPINDiode * fAvNormPINDiode ); 
+}
+
+// ------------------------------------------------------------------------------
+//
+// Get the default Quantum efficiency for pulser colour "col"
+//
+Float_t MCalibrationQEPix::GetDefaultQE( const MCalibrationCam::PulserColor_t col )  const
+{
+  switch (col)
+    {
+    case MCalibrationCam::kGREEN:
+      return gkDefaultQEGreen;
+      break;
+    case MCalibrationCam::kBLUE:
+      return gkDefaultQEBlue;
+      break;
+    case MCalibrationCam::kUV:
+      return gkDefaultQEUV;
+      break;
+    case MCalibrationCam::kCT1:
+      return gkDefaultQECT1;
+      break;
+    default:
+      return gkDefaultQECT1;
+      break;
+    }
+  return -1.;
+}
+
+// ------------------------------------------------------------------------------
+//
+// Get the relative variance of the default Quantum efficiency for pulser colour "col"
+//
+Float_t MCalibrationQEPix::GetDefaultQERelVar( const MCalibrationCam::PulserColor_t col )  const
+{
+  switch (col)
+    {
+    case MCalibrationCam::kGREEN:
+      return gkDefaultQEGreenErr * gkDefaultQEGreenErr / (gkDefaultQEGreen * gkDefaultQEGreen );
+      break;
+    case MCalibrationCam::kBLUE:
+      return gkDefaultQEBlueErr  * gkDefaultQEBlueErr  / (gkDefaultQEBlue  * gkDefaultQEBlue  );
+      break;
+    case MCalibrationCam::kUV:
+      return gkDefaultQEUVErr    * gkDefaultQEUVErr    / (gkDefaultQEUV    * gkDefaultQEUV    );
+      break;
+    case MCalibrationCam::kCT1:
+      return gkDefaultQECT1Err   * gkDefaultQECT1Err   / (gkDefaultQECT1   * gkDefaultQECT1   );
+      break;
+    default: 
+      return gkDefaultQECT1Err   * gkDefaultQECT1Err   / (gkDefaultQECT1   * gkDefaultQECT1   );
+      break;
+    }
+  return -1.;
+}
+
+// ------------------------------------------------------------------------------
+//
+// Get the calculated Quantum efficiency with the blind pixel method, 
+// obtained with pulser colour "col"
+//
+Float_t MCalibrationQEPix::GetQEBlindPixel( const MCalibrationCam::PulserColor_t col )  const
+{
+  return fQEBlindPixel[col];
+}
+
+// ------------------------------------------------------------------------------
+//
+// Get the error on the calculated Quantum efficiency with the blind pixel method, 
+// obtained with pulser colour "col"
+// Tests for variances smaller than 0. (e.g. if it has not yet been set) 
+// and returns -1. in that case
+//
+Float_t MCalibrationQEPix::GetQEBlindPixelErr( const MCalibrationCam::PulserColor_t col )  const
+{
+
+  if (fQEBlindPixelVar[col] < 0.)
+    return -1.;
+
+  return TMath::Sqrt(fQEBlindPixelVar[col]);
+
+}
+
+// ------------------------------------------------------------------------------
+//
+// Get the relative variance of the calculated Quantum efficiency with the blind pixel method, 
+// obtained with pulser colour "col"
+// Tests for variances smaller than 0. (e.g. if it has not yet been set) 
+// and returns -1. in that case
+// Tests for quantum efficiency equal to  0. and returns -1. in that case
+//
+Float_t MCalibrationQEPix::GetQEBlindPixelRelVar( const MCalibrationCam::PulserColor_t col )  const
+{
+
+  if (fQEBlindPixelVar[col] < 0.)
+    return -1.;
+  if (fQEBlindPixel[col] < 0.)
+      return -1.;
+  return fQEBlindPixelVar[col] / ( fQEBlindPixel[col] * fQEBlindPixel[col] );
+
+}
+
+// ------------------------------------------------------------------------------
+//
+// Get the calculated Quantum efficiency with the combination of the three methods
+// obtained with pulser colour "col"
+//
+Float_t MCalibrationQEPix::GetQECombined( const MCalibrationCam::PulserColor_t col )  const
+{
+  return fQECombined[col];
+}
+
+
+// ------------------------------------------------------------------------------
+//
+// Get the error on the calculated Quantum efficiency with the combination of the three methods
+// obtained with pulser colour "col"
+// Tests for variances smaller than 0. (e.g. if it has not yet been set) 
+// and returns -1. in that case
+//
+Float_t MCalibrationQEPix::GetQECombinedErr( const MCalibrationCam::PulserColor_t col )  const
+{
+
+  if (fQECombinedVar[col] < 0.)
+    return -1.;
+
+  return TMath::Sqrt(fQECombinedVar[col]);
+
+}
+
+
+// ----------------------------------------------------------------------------------------
+//
+// Get the relative variance of the calculated Quantum efficiency with the combination of 
+// the three methods, 
+// obtained with pulser colour "col"
+// Tests for variances smaller than 0. (e.g. if it has not yet been set) 
+// and returns -1. in that case
+// Tests for quantum efficiency equal to  0. and returns -1. in that case
+//
+Float_t MCalibrationQEPix::GetQECombinedRelVar( const MCalibrationCam::PulserColor_t col )  const
+{
+
+  if (fQECombinedVar[col] < 0.)
+    return -1.;
+  if (fQECombined[col] < 0.)
+      return -1.;
+  return fQECombinedVar[col] / ( fQECombined[col] * fQECombined[col] );
+
+}
+
+// ------------------------------------------------------------------------------
+//
+// Get the calculated Quantum efficiency with the F-Factor method
+// obtained with pulser colour "col"
+//
+Float_t MCalibrationQEPix::GetQEFFactor( const MCalibrationCam::PulserColor_t col )  const
+{
+  return fQEFFactor[col];
+}
+
+
+// ------------------------------------------------------------------------------
+//
+// Get the error on the calculated Quantum efficiency with the F-Factor method, 
+// obtained with pulser colour "col"
+// Tests for variances smaller than 0. (e.g. if it has not yet been set) 
+// and returns -1. in that case
+//
+Float_t MCalibrationQEPix::GetQEFFactorErr( const MCalibrationCam::PulserColor_t col )  const
+{
+
+  if (fQEFFactorVar[col] < 0.)
+    return -1.;
+
+  return TMath::Sqrt(fQEFFactorVar[col]);
+
+}
+
+
+// ----------------------------------------------------------------------------------------
+//
+// Get the relative variance of the calculated Quantum efficiency with the F-Factor method, 
+// obtained with pulser colour "col"
+// Tests for variances smaller than 0. (e.g. if it has not yet been set) 
+// and returns -1. in that case
+// Tests for quantum efficiency equal to  0. and returns -1. in that case
+//
+Float_t MCalibrationQEPix::GetQEFFactorRelVar( const MCalibrationCam::PulserColor_t col )  const
+{
+
+  if (fQEFFactorVar[col] < 0.)
+    return -1.;
+  if (fQEFFactor[col] < 0.)
+      return -1.;
+  return fQEFFactorVar[col] / ( fQEFFactor[col] * fQEFFactor[col] );
+
+}
+
+// ------------------------------------------------------------------------------
+//
+// Get the calculated Quantum efficiency with the PIN-Diode method
+// obtained with pulser colour "col"
+//
+Float_t MCalibrationQEPix::GetQEPINDiode( const MCalibrationCam::PulserColor_t col )  const
+{
+  return fQEPINDiode[col];
+}
+
+
+// ------------------------------------------------------------------------------
+//
+// Get the error on the calculated Quantum efficiency with the PIN Diode method, 
+// obtained with pulser colour "col"
+// Tests for variances smaller than 0. (e.g. if it has not yet been set) 
+// and returns -1. in that case
+//
+Float_t MCalibrationQEPix::GetQEPINDiodeErr( const MCalibrationCam::PulserColor_t col )  const
+{
+
+  if (fQEPINDiodeVar[col] < 0.)
+    return -1.;
+
+  return TMath::Sqrt(fQEPINDiodeVar[col]);
+
+}
+
+// ----------------------------------------------------------------------------------------
+//
+// Get the relative variance of the calculated Quantum efficiency with the PIN Diode method, 
+// obtained with pulser colour "col"
+// Tests for variances smaller than 0. (e.g. if it has not yet been set) 
+// and returns -1. in that case
+// Tests for quantum efficiency equal to  0. and returns -1. in that case
+//
+Float_t MCalibrationQEPix::GetQEPINDiodeRelVar( const MCalibrationCam::PulserColor_t col )  const
+{
+
+  if (fQEPINDiodeVar[col] < 0.)
+    return -1.;
+  if (fQEPINDiode[col] < 0.)
+      return -1.;
+  return fQEPINDiodeVar[col] / ( fQEPINDiode[col] * fQEPINDiode[col] );
+
+}
+
+// ------------------------------------------------------------------------------
+//
+// Get the averaged Quantum efficiency folded over the cascade spectrum, obtained 
+// with the blind pixel method and averaged over the results from the different colours.
+//
+Float_t MCalibrationQEPix::GetQECascadesBlindPixel( const Float_t zenith  )  const
+{
+  return fAvNormBlindPixel * GetAverageQE ( zenith );
+}
+
+// ------------------------------------------------------------------------------
+//
+// Get the variance of the averaged Quantum efficiency folded over the cascade spectrum, 
+// obtained with the blind pixel method and averaged over the results from the 
+// different colours.
+//
+Float_t MCalibrationQEPix::GetQECascadesBlindPixelVar( const Float_t zenith  )  const
+{
+  return ( GetAvNormBlindPixelRelVar()  + GetAverageQERelVar(zenith)) 
+    * GetQECascadesBlindPixel(zenith) * GetQECascadesBlindPixel(zenith);
+}
+
+// ------------------------------------------------------------------------------
+//
+// Get the averaged Quantum efficiency folded over the cascade spectrum, obtained 
+// with the combination of the three methods and averaged over the results 
+// from the different colours.
+//
+Float_t MCalibrationQEPix::GetQECascadesCombined( const Float_t zenith  )  const
+{
+  return fAvNormCombined * GetAverageQE ( zenith );
+}
+
+// ------------------------------------------------------------------------------
+//
+// Get the variance of the averaged Quantum efficiency folded over the cascade spectrum, 
+// obtained with the combination of the three methods and averaged over the results from the 
+// different colours.
+//
+Float_t MCalibrationQEPix::GetQECascadesCombinedVar( const Float_t zenith  )  const
+{
+  return ( GetAvNormCombinedRelVar()  + GetAverageQERelVar(zenith)) 
+    * GetQECascadesCombined(zenith) * GetQECascadesCombined(zenith);
+}
+
+// ------------------------------------------------------------------------------
+//
+// Get the averaged Quantum efficiency folded over the cascade spectrum, obtained 
+// with the F-Factor method and averaged over the results from the different colours.
+//
+Float_t MCalibrationQEPix::GetQECascadesFFactor( const Float_t zenith  )  const
+{
+  return fAvNormFFactor * GetAverageQE ( zenith );
+}
+
+// ------------------------------------------------------------------------------
+//
+// Get the variance of the averaged Quantum efficiency folded over the cascade spectrum, 
+// obtained with the F-Factor method and averaged over the results from the 
+// different colours.
+//
+Float_t MCalibrationQEPix::GetQECascadesFFactorVar( const Float_t zenith  )  const
+{
+  return ( GetAvNormFFactorRelVar()  + GetAverageQERelVar(zenith)) 
+    * GetQECascadesFFactor(zenith) * GetQECascadesFFactor(zenith);
+}
+
+// ------------------------------------------------------------------------------
+//
+// Get the averaged Quantum efficiency folded over the cascade spectrum, obtained 
+// with the PIN Diode method and averaged over the results from the different colours.
+//
+Float_t MCalibrationQEPix::GetQECascadesPINDiode( const Float_t zenith  )  const
+{
+  return fAvNormPINDiode * GetAverageQE ( zenith );
+}
+
+// ------------------------------------------------------------------------------
+//
+// Get the variance of the averaged Quantum efficiency folded over the cascade spectrum, 
+// obtained with the PIN Diode method and averaged over the results from the 
+// different colours.
+//
+Float_t MCalibrationQEPix::GetQECascadesPINDiodeVar( const Float_t zenith  )  const
+{
+  return ( GetAvNormPINDiodeRelVar()  + GetAverageQERelVar(zenith)) 
+    * GetQECascadesPINDiode(zenith) * GetQECascadesPINDiode(zenith);
+}
+
+// ------------------------------------------------------------------------------
+//
+// Test if the average QE can be obtained from the blind pixel method
+//
+Bool_t MCalibrationQEPix::IsAverageQEBlindPixelAvailable() const
+{
+  return TESTBIT(fAvailableFlags,kAverageQEBlindPixelAvailable);
+}
+
+// ------------------------------------------------------------------------------
+//
+// Test if the average QE can be obtained from the combination of the three methods
+//
+Bool_t MCalibrationQEPix::IsAverageQECombinedAvailable() const
+{
+  return TESTBIT(fAvailableFlags,kAverageQECombinedAvailable);
+}
+
+// ------------------------------------------------------------------------------
+//
+// Test if the average QE can be obtained from the F-Factor method
+//
+Bool_t MCalibrationQEPix::IsAverageQEFFactorAvailable() const
+{
+  return TESTBIT(fAvailableFlags,kAverageQEFFactorAvailable);
+}
+
+// ------------------------------------------------------------------------------
+//
+// Test if the average QE can be obtained from the PIN Diode method
+//
+Bool_t MCalibrationQEPix::IsAverageQEPINDiodeAvailable() const
+{
+  return TESTBIT(fAvailableFlags,kAverageQEPINDiodeAvailable);
+}
+
+// ------------------------------------------------------------------------------
+//
+// Test if any of the three colours has already been calibrated with the blind pixel method
+//
+Bool_t MCalibrationQEPix::IsBlindPixelMethodValid () const
+{
+
+  if (IsBlindPixelMethodValid (MCalibrationCam::kGREEN))
+    return kTRUE;
+  if (IsBlindPixelMethodValid (MCalibrationCam::kBLUE ))
+    return kTRUE;
+  if (IsBlindPixelMethodValid (MCalibrationCam::kUV   ))
+    return kTRUE;
+  if (IsBlindPixelMethodValid (MCalibrationCam::kCT1  ))
+    return kTRUE;
+
+  return kFALSE;
+}
+
+// ------------------------------------------------------------------------------
+//
+// Test if any of the three colours has already been calibrated with the combination 
+// of the three methods
+//
+Bool_t MCalibrationQEPix::IsCombinedMethodValid () const
+{
+  if (IsCombinedMethodValid (MCalibrationCam::kGREEN))
+    return kTRUE;
+  if (IsCombinedMethodValid (MCalibrationCam::kBLUE ))
+    return kTRUE;
+  if (IsCombinedMethodValid (MCalibrationCam::kUV   ))
+    return kTRUE;
+  if (IsCombinedMethodValid (MCalibrationCam::kCT1  ))
+    return kTRUE;
+
+  return kFALSE;
+}
+
+// ------------------------------------------------------------------------------
+//
+// Test if any of the three colours has already been calibrated with the F-Factor method
+//
+Bool_t MCalibrationQEPix::IsFFactorMethodValid () const
+{
+  if (IsFFactorMethodValid (MCalibrationCam::kGREEN))
+    return kTRUE;
+  if (IsFFactorMethodValid (MCalibrationCam::kBLUE ))
+    return kTRUE;
+  if (IsFFactorMethodValid (MCalibrationCam::kUV   ))
+    return kTRUE;
+  if (IsFFactorMethodValid (MCalibrationCam::kCT1  ))
+    return kTRUE;
+
+  return kFALSE;
+}
+
+
+// ------------------------------------------------------------------------------
+//
+// Test if any of the three colours has already been calibrated with the PIN Diode method
+//
+Bool_t MCalibrationQEPix::IsPINDiodeMethodValid () const
+{
+  if (IsPINDiodeMethodValid (MCalibrationCam::kGREEN))
+    return kTRUE;
+  if (IsPINDiodeMethodValid (MCalibrationCam::kBLUE ))
+    return kTRUE;
+  if (IsPINDiodeMethodValid (MCalibrationCam::kUV   ))
+    return kTRUE;
+  if (IsPINDiodeMethodValid (MCalibrationCam::kCT1  ))
+    return kTRUE;
+
+  return kFALSE;
+}
+
+// ------------------------------------------------------------------------------
+//
+// Test if the colour "col" has already been calibrated with the Blind Pixel method
+//
+Bool_t MCalibrationQEPix::IsBlindPixelMethodValid (MCalibrationCam::PulserColor_t col)  const
+{
+  return TESTBIT(fValidFlags[ MCalibrationCam::kGREEN ],kBlindPixelMethodValid);
+}
+
+// ------------------------------------------------------------------------------
+//
+// Test if the colour "col" has already been calibrated with the combination of 
+// the three methods
+//
+Bool_t MCalibrationQEPix::IsCombinedMethodValid (MCalibrationCam::PulserColor_t col)  const
+{
+  return TESTBIT(fValidFlags[ MCalibrationCam::kGREEN ],kCombinedMethodValid);
+}
+
+// ------------------------------------------------------------------------------
+//
+// Test if the colour "col" has already been calibrated with the F-Factor method
+//
+Bool_t MCalibrationQEPix::IsFFactorMethodValid (MCalibrationCam::PulserColor_t col)  const
+{
+  return TESTBIT(fValidFlags[ MCalibrationCam::kGREEN ],kFFactorMethodValid);
+}
+
+// ------------------------------------------------------------------------------
+//
+// Test if the colour "col" has already been calibrated with the PIN Diode method
+//
+Bool_t MCalibrationQEPix::IsPINDiodeMethodValid (MCalibrationCam::PulserColor_t col)  const
+{
+  return TESTBIT(fValidFlags[ MCalibrationCam::kGREEN ],kPINDiodeMethodValid);
+}
+
+// ------------------------------------------------------------------------------
+//
+// Set the bit Average QE Blind Pixel method available from outside (only for MC!)
+//
+void MCalibrationQEPix::SetAverageQEBlindPixelAvailable ( Bool_t b ) 
+{
+  if (b) 
+    SETBIT(fAvailableFlags,kAverageQEBlindPixelAvailable);
+  else
+    CLRBIT(fAvailableFlags,kAverageQEBlindPixelAvailable);    
+}
+
+// ------------------------------------------------------------------------------
+//
+// Set the bit Average QE combination of three methods available from outside (only for MC!)
+//
+void MCalibrationQEPix::SetAverageQECombinedAvailable ( Bool_t b ) 
+{
+  if (b) 
+    SETBIT(fAvailableFlags,kAverageQECombinedAvailable);
+  else
+    CLRBIT(fAvailableFlags,kAverageQECombinedAvailable);    
+}
+
+// ------------------------------------------------------------------------------
+//
+// Set the bit Average QE F-Factor method available from outside (only for MC!)
+//
+void MCalibrationQEPix::SetAverageQEFFactorAvailable ( Bool_t b ) 
+{
+  if (b) 
+    SETBIT(fAvailableFlags,kAverageQEFFactorAvailable);
+  else
+    CLRBIT(fAvailableFlags,kAverageQEFFactorAvailable);    
+}
+
+// ------------------------------------------------------------------------------
+//
+// Set the bit Average QE PIN Diode method available from outside (only for MC!)
+//
+void MCalibrationQEPix::SetAverageQEPINDiodeAvailable ( Bool_t b ) 
+{
+  if (b) 
+    SETBIT(fAvailableFlags,kAverageQEPINDiodeAvailable);
+  else
+    CLRBIT(fAvailableFlags,kAverageQEPINDiodeAvailable);    
+}
+
+// ------------------------------------------------------------------------------
+//
+// Set the bit QE Blind Pixel method available from colour "col"
+//
+void MCalibrationQEPix::SetBlindPixelMethodValid ( Bool_t b,  MCalibrationCam::PulserColor_t col ) 
+{
+  if (b) 
+    SETBIT(fValidFlags[ MCalibrationCam::kGREEN ],kBlindPixelMethodValid);
+  else
+    CLRBIT(fValidFlags[ MCalibrationCam::kGREEN ],kBlindPixelMethodValid);    
+}
+
+// ------------------------------------------------------------------------------
+//
+// Set the bit QE Combination of three methods available from colour "col"
+//
+void MCalibrationQEPix::SetCombinedMethodValid ( Bool_t b,  MCalibrationCam::PulserColor_t col ) 
+{
+  if (b) 
+    SETBIT(fValidFlags[ MCalibrationCam::kGREEN ],kCombinedMethodValid);
+  else
+    CLRBIT(fValidFlags[ MCalibrationCam::kGREEN ],kCombinedMethodValid);    
+}
+
+// ------------------------------------------------------------------------------
+//
+// Set the bit QE F-Factor method available from colour "col"
+//
+void MCalibrationQEPix::SetFFactorMethodValid ( Bool_t b,  MCalibrationCam::PulserColor_t col ) 
+{
+  if (b) 
+    SETBIT(fValidFlags[ MCalibrationCam::kGREEN ],kFFactorMethodValid);
+  else
+    CLRBIT(fValidFlags[ MCalibrationCam::kGREEN ],kFFactorMethodValid);    
+}
+
+// ------------------------------------------------------------------------------
+//
+// Set the bit QE PIN Diode method available from colour "col"
+//
+void MCalibrationQEPix::SetPINDiodeMethodValid ( Bool_t b,  MCalibrationCam::PulserColor_t col ) 
+{
+  if (b) 
+    SETBIT(fValidFlags[ MCalibrationCam::kGREEN ],kPINDiodeMethodValid);
+  else
+    CLRBIT(fValidFlags[ MCalibrationCam::kGREEN ],kPINDiodeMethodValid);    
+}
+
+// ------------------------------------------------------------------------------
+//
+// Update the Blind Pixel Method: Calculate new average QE's
+//
+Bool_t  MCalibrationQEPix::UpdateBlindPixelMethod()
+{
+
+  Float_t weightedav = 0.;
+  Float_t sumweights = 0.;
+
+  AddAverageBlindPixelQEs(MCalibrationCam::kGREEN, weightedav, sumweights);
+  AddAverageBlindPixelQEs(MCalibrationCam::kBLUE , weightedav, sumweights);
+  AddAverageBlindPixelQEs(MCalibrationCam::kUV   , weightedav, sumweights);
+  AddAverageBlindPixelQEs(MCalibrationCam::kCT1  , weightedav, sumweights);
+
+  if (weightedav == 0. || sumweights == 0.)
+    return kFALSE;
+
+  weightedav /= sumweights;
+
+  fAvNormBlindPixel     = gkDefaultAverageQE   *  weightedav;
+  fAvNormBlindPixelVar  = GetAverageQERelVar() + (sumweights / weightedav / weightedav );  
+  fAvNormBlindPixelVar *= fAvNormBlindPixel * fAvNormBlindPixel;
+
+  return kTRUE;
+}
+
+// ------------------------------------------------------------------------------
+//
+// Update the Combination of the three Methods: Calculate new average QE's
+//
+Bool_t  MCalibrationQEPix::UpdateCombinedMethod()
+{
   
-  fQEGreenErr   =  -1.;
-  fQEBlueErr    =  -1.;
-  fQEUVErr      =  -1.;
-  fQECT1Err     =  -1.;
- 
-  MCalibrationPix::Clear();
-
-}
-
-
-void MCalibrationQEPix::SetQE( const Float_t qe, const PulserColor_t col )
-{
-
-  switch (col)
-  {
-      case kGREEN:
-	  fQEGreen = qe;
-	  break;
-      case kBLUE:
-	  fQEBlue = qe;
-	  break;
-      case kUV:
-	  fQEUV = qe;
-	  break;
-      case kCT1:
-	  fQECT1 = qe;
-	  break;
-      default:
-	  fQECT1 = qe;
-	  break;
-  }
-}
-
-void MCalibrationQEPix::SetQEErr( const Float_t qeerr, const PulserColor_t col )
-{
-
-  switch (col)
-  {
-      case kGREEN:
-	  fQEGreenErr = qeerr;
-	  break;
-      case kBLUE:
-	  fQEBlueErr  = qeerr;
-	  break;
-      case kUV:
-	  fQEUVErr    = qeerr;
-	  break;
-      case kCT1:
-	  fQECT1Err   = qeerr;
-	  break;
-      default:
-	  fQECT1Err  = qeerr;
-	  break;
-  }
-}
-
-
-Float_t MCalibrationQEPix::GetQE(const PulserColor_t col )  const
-{
-
-  switch (col)
-  {
-      case kGREEN:
-	  return fQEGreen;
-	  break;
-      case kBLUE:
-	  return fQEBlue;
-	  break;
-      case kUV:
-	  return fQEUV;
-	  break;
-      case kCT1:
-	  return fQECT1;
-	  break;
-      default:
-	  return fQECT1;
-	  break;
-  }
-}
-
-Float_t MCalibrationQEPix::GetQEErr(const PulserColor_t col )  const
-{
-
-  switch (col)
-  {
-      case kGREEN:
-	  return fQEGreenErr;
-	  break;
-      case kBLUE:
-	  return fQEBlueErr;
-	  break;
-      case kUV:
-	  return fQEUVErr;
-	  break;
-      case kCT1:
-	  return fQECT1Err;
-	  break;
-      default:
-	  return fQECT1Err;
-	  break;
-  }
-}
-
-// --------------------------------------------------------------
-//
-// The check return kTRUE if:
-//
-// Not yet implemented! 
-//
-Bool_t MCalibrationQEPix::CheckQEValidity()
-{
- 
-  SetValid();
+  Float_t weightedav = 0.;
+  Float_t sumweights = 0.;
+
+  AddAverageCombinedQEs(MCalibrationCam::kGREEN, weightedav, sumweights);
+  AddAverageCombinedQEs(MCalibrationCam::kBLUE , weightedav, sumweights);
+  AddAverageCombinedQEs(MCalibrationCam::kUV   , weightedav, sumweights);
+  AddAverageCombinedQEs(MCalibrationCam::kCT1  , weightedav, sumweights);
+
+  if (weightedav == 0. || sumweights == 0.)
+    return kFALSE;
+
+  weightedav /= sumweights;
+
+  fAvNormCombined     = gkDefaultAverageQE   *  weightedav;
+  fAvNormCombinedVar  = GetAverageQERelVar() + (sumweights / weightedav / weightedav );  
+  fAvNormCombinedVar *= fAvNormCombined * fAvNormCombined;
+
   return kTRUE;
-}
+  
+}
+
+// ------------------------------------------------------------------------------
+//
+// Update the F-Factor Method: Calculate new average QE's
+//
+Bool_t  MCalibrationQEPix::UpdateFFactorMethod()
+{
+
+  Float_t weightedav = 0.;
+  Float_t sumweights = 0.;
+
+  AddAverageFFactorQEs(MCalibrationCam::kGREEN, weightedav, sumweights);
+  AddAverageFFactorQEs(MCalibrationCam::kBLUE , weightedav, sumweights);
+  AddAverageFFactorQEs(MCalibrationCam::kUV   , weightedav, sumweights);
+  AddAverageFFactorQEs(MCalibrationCam::kCT1  , weightedav, sumweights);
+
+  if (weightedav == 0. || sumweights == 0.)
+    return kFALSE;
+
+  weightedav /= sumweights;
+
+  fAvNormFFactor     = gkDefaultAverageQE   *  weightedav;
+  fAvNormFFactorVar  = GetAverageQERelVar() + (sumweights / weightedav / weightedav );  
+  fAvNormFFactorVar *= fAvNormFFactor * fAvNormFFactor;
+
+  return kTRUE;
+  
+  
+}
+
+// ------------------------------------------------------------------------------
+//
+// Update the PIN Diode Method: Calculate new average QE's
+//
+Bool_t  MCalibrationQEPix::UpdatePINDiodeMethod()
+{
+  
+  Float_t weightedav = 0.;
+  Float_t sumweights = 0.;
+
+  AddAveragePINDiodeQEs(MCalibrationCam::kGREEN, weightedav, sumweights);
+  AddAveragePINDiodeQEs(MCalibrationCam::kBLUE , weightedav, sumweights);
+  AddAveragePINDiodeQEs(MCalibrationCam::kUV   , weightedav, sumweights);
+  AddAveragePINDiodeQEs(MCalibrationCam::kCT1  , weightedav, sumweights);
+
+  if (weightedav == 0. || sumweights == 0.)
+    return kFALSE;
+
+  weightedav /= sumweights;
+
+  fAvNormPINDiode     = gkDefaultAverageQE   *  weightedav;
+  fAvNormPINDiodeVar  = GetAverageQERelVar() + (sumweights / weightedav / weightedav );  
+  fAvNormPINDiodeVar *= fAvNormPINDiode * fAvNormPINDiode;
+
+  return kTRUE;
+
+  
+}
+
Index: trunk/MagicSoft/Mars/mcalib/MCalibrationQEPix.h
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MCalibrationQEPix.h	(revision 3677)
+++ trunk/MagicSoft/Mars/mcalib/MCalibrationQEPix.h	(revision 3678)
@@ -6,16 +6,69 @@
 #endif
 
+#ifndef ROOT_TArrayF
+#include "TArrayF.h"
+#endif
+
+#ifndef ROOT_TArrayC
+#include "TArrayC.h"
+#endif
+
+#ifndef MARS_MCalibrationCam
+#include "MCalibrationCam.h"
+#endif
+
 class MCalibrationQEPix : public MCalibrationPix
 {
 private:
 
-  Float_t fQEGreen;          // Calibrated quantum efficiency at 520 nm
-  Float_t fQEBlue;           // Calibrated quantum efficiency at 460 nm
-  Float_t fQEUV;             // Calibrated quantum efficiency at 370 nm
-  Float_t fQECT1;            // Calibrated quantum efficiency at 370 nm
-  Float_t fQEGreenErr;       // Uncertainty calibrated QE at 520 nm
-  Float_t fQEBlueErr;        // Uncertainty calibrated QE at 460 nm
-  Float_t fQEUVErr;          // Uncertainty calibrated QE at 370 nm
-  Float_t fQECT1Err;         // Uncertainty calibrated QE at 370 nm
+  static const Float_t gkDefaultQEGreen;      //! Default QE at 520 nm (now set to: 0.192)
+  static const Float_t gkDefaultQEBlue;       //! Default QE at 460 nm (now set to: 0.27 )
+  static const Float_t gkDefaultQEUV;         //! Default QE at 370 nm (now set to: 0.285)
+  static const Float_t gkDefaultQECT1;        //! Default QE at 370 nm (now set to: 0.285)
+  static const Float_t gkDefaultQEGreenErr;   //! Uncertainty Def. QE  at 520 nm (now set to: 0.05)
+  static const Float_t gkDefaultQEBlueErr;    //! Uncertainty Def. QE  at 460 nm (now set to: 0.07)
+  static const Float_t gkDefaultQEUVErr;      //! Uncertainty Def. QE  at 370 nm (now set to: 0.07)
+  static const Float_t gkDefaultQECT1Err;     //! Uncertainty Def. QE  at 370 nm (now set to: 0.07)
+  static const Float_t gkDefaultAverageQE;    //! Default QE folded into Cascade spectrum (now set to: 0.18)
+  static const Float_t gkDefaultAverageQEErr; //! Uncertainty Def. QE Cascade spectrum    (now set to: 0.02)
+  
+  TArrayF fQEBlindPixel;                     // Calibrated QEs    (Blind Pixel Method)
+  TArrayF fQEBlindPixelVar;                  // Variance cal. QEs (Blind Pixel Method)
+  TArrayF fQECombined;                       // Calibrated QEs    (Combined Method)
+  TArrayF fQECombinedVar;                    // Variance cal. QEs (Combined Method)
+  TArrayF fQEFFactor;                        // Calibrated QEs    (F-Factor Method)
+  TArrayF fQEFFactorVar;                     // Variance cal. QEs (F-Factor Method)
+  TArrayF fQEPINDiode;                       // Calibrated QEs    (PIN Diode Method)
+  TArrayF fQEPINDiodeVar;                    // Variance cal. QEs (PIN Diode Method)
+                                             
+  Float_t fAvNormBlindPixel;                 // Normalization w.r.t. default QE (Blind Pixel Method)
+  Float_t fAvNormBlindPixelVar;              // Variance norm. w.r.t. def. QE (Blind Pixel Method)
+  Float_t fAvNormCombined;                   // Normalization w.r.t. default QE (Combined Method)
+  Float_t fAvNormCombinedVar;                // Variance norm. w.r.t. def. QE (Combined Method)
+  Float_t fAvNormFFactor;                    // Normalization w.r.t. default QE (F-Factor Method)
+  Float_t fAvNormFFactorVar;                 // Variance norm. w.r.t. def. QE (F-Factor Method)
+  Float_t fAvNormPINDiode;                   // Normalization w.r.t. default QE (PIN Diode Method)
+  Float_t fAvNormPINDiodeVar;                // Variance norm. w.r.t. def. QE (PIN Diode Method)
+                                             
+  TArrayC fValidFlags;                       // Bit-field for valid flags, one array entry for each color
+  Byte_t  fAvailableFlags;                   // Bit-field for available flags
+  
+  enum { kBlindPixelMethodValid, kFFactorMethodValid, 
+	 kPINDiodeMethodValid, kCombinedMethodValid,
+         kAverageQEBlindPixelAvailable, kAverageQEFFactorAvailable,
+         kAverageQEPINDiodeAvailable, kAverageQECombinedAvailable  };
+
+  void  AddAverageBlindPixelQEs( const MCalibrationCam::PulserColor_t col, Float_t &wav, Float_t &sumw );
+  void  AddAverageCombinedQEs  ( const MCalibrationCam::PulserColor_t col, Float_t &wav, Float_t &sumw );
+  void  AddAverageFFactorQEs  ( const MCalibrationCam::PulserColor_t col, Float_t &wav, Float_t &sumw );
+  void  AddAveragePINDiodeQEs  ( const MCalibrationCam::PulserColor_t col, Float_t &wav, Float_t &sumw );
+
+  const Float_t GetAverageQE     ( const Float_t zenith=0. ) const;  
+  const Float_t GetAverageQERelVar( const Float_t zenith=0. ) const;
+  
+  const Float_t GetAvNormBlindPixelRelVar()  const;
+  const Float_t GetAvNormCombinedRelVar()  const;
+  const Float_t GetAvNormFFactorRelVar()  const;
+  const Float_t GetAvNormPINDiodeRelVar()  const;  
   
 public:
@@ -24,18 +77,68 @@
   ~MCalibrationQEPix() {}
   
-  void Clear(Option_t *o="");
+  void    Clear(Option_t *o="");
+  
+  // Getters
+  Float_t GetDefaultQE                   ( const MCalibrationCam::PulserColor_t col ) const;
+  Float_t GetDefaultQERelVar             ( const MCalibrationCam::PulserColor_t col ) const;  
+  Float_t GetQEBlindPixel                ( const MCalibrationCam::PulserColor_t col ) const;  
+  Float_t GetQEBlindPixelErr             ( const MCalibrationCam::PulserColor_t col ) const;
+  Float_t GetQEBlindPixelRelVar          ( const MCalibrationCam::PulserColor_t col ) const;  
+  Float_t GetQECascadesBlindPixel        ( const Float_t zenith=0.)                   const;
+  Float_t GetQECascadesBlindPixelVar     ( const Float_t zenith=0.)                   const;
+  Float_t GetQECascadesCombined          ( const Float_t zenith=0.)                   const;  
+  Float_t GetQECascadesCombinedVar       ( const Float_t zenith=0.)                   const;  
+  Float_t GetQECascadesFFactor           ( const Float_t zenith=0.)                   const;  
+  Float_t GetQECascadesFFactorVar        ( const Float_t zenith=0 )                   const;  
+  Float_t GetQECascadesPINDiode          ( const Float_t zenith=0.)                   const;
+  Float_t GetQECascadesPINDiodeVar       ( const Float_t zenith=0.)                   const;
+  Float_t GetQECombined                  ( const MCalibrationCam::PulserColor_t col ) const;        
+  Float_t GetQECombinedErr               ( const MCalibrationCam::PulserColor_t col ) const;
+  Float_t GetQECombinedRelVar            ( const MCalibrationCam::PulserColor_t col ) const;  
+  Float_t GetQEFFactor                   ( const MCalibrationCam::PulserColor_t col ) const;  
+  Float_t GetQEFFactorErr                ( const MCalibrationCam::PulserColor_t col ) const;
+  Float_t GetQEFFactorRelVar             ( const MCalibrationCam::PulserColor_t col ) const;  
+  Float_t GetQEPINDiode                  ( const MCalibrationCam::PulserColor_t col ) const;        
+  Float_t GetQEPINDiodeErr               ( const MCalibrationCam::PulserColor_t col ) const;
+  Float_t GetQEPINDiodeRelVar            ( const MCalibrationCam::PulserColor_t col ) const;  
 
-  // Setters
-  void SetQE   ( const Float_t qe   , const PulserColor_t col );
-  void SetQEErr( const Float_t qeerr, const PulserColor_t col );
+  Bool_t  IsAverageQEBlindPixelAvailable ()                                           const;
+  Bool_t  IsAverageQECombinedAvailable   ()                                           const;  
+  Bool_t  IsAverageQEFFactorAvailable    ()                                           const;  
+  Bool_t  IsAverageQEPINDiodeAvailable   ()                                           const;  
+  Bool_t  IsBlindPixelMethodValid        ()                                           const;
+  Bool_t  IsBlindPixelMethodValid        ( const MCalibrationCam::PulserColor_t col ) const;
+  Bool_t  IsCombinedMethodValid          ()                                           const;  
+  Bool_t  IsCombinedMethodValid          ( const MCalibrationCam::PulserColor_t col ) const;  
+  Bool_t  IsFFactorMethodValid           ()                                           const;  
+  Bool_t  IsFFactorMethodValid           ( const MCalibrationCam::PulserColor_t col ) const;  
+  Bool_t  IsPINDiodeMethodValid          ()                                           const;  
+  Bool_t  IsPINDiodeMethodValid          ( const MCalibrationCam::PulserColor_t col ) const;  
 
-  // Getters
-  Float_t GetQE   ( const PulserColor_t col )  const;
-  Float_t GetQEErr( const PulserColor_t col )  const;
+  // Setters 
+  void SetAverageQEBlindPixelAvailable   ( const Bool_t b );
+  void SetAverageQECombinedAvailable     ( const Bool_t b );
+  void SetAverageQEFFactorAvailable      ( const Bool_t b );
+  void SetAverageQEPINDiodeAvailable     ( const Bool_t b );
+  void SetBlindPixelMethodValid          ( const Bool_t b, const MCalibrationCam::PulserColor_t col);
+  void SetCombinedMethodValid            ( const Bool_t b, const MCalibrationCam::PulserColor_t col);
+  void SetFFactorMethodValid             ( const Bool_t b, const MCalibrationCam::PulserColor_t col);  
+  void SetPINDiodeMethodValid            ( const Bool_t b, const MCalibrationCam::PulserColor_t col);  
+  void SetQEBlindPixel    ( Float_t f, MCalibrationCam::PulserColor_t col) { fQEBlindPixel   [col] = f; }
+  void SetQEBlindPixelVar ( Float_t f, MCalibrationCam::PulserColor_t col) { fQEBlindPixelVar[col] = f; }
+  void SetQECombined      ( Float_t f, MCalibrationCam::PulserColor_t col) { fQECombined     [col] = f; }
+  void SetQECombinedVar   ( Float_t f, MCalibrationCam::PulserColor_t col) { fQECombinedVar  [col] = f; }
+  void SetQEFFactor       ( Float_t f, MCalibrationCam::PulserColor_t col) { fQEFFactor      [col] = f; }
+  void SetQEFFactorVar    ( Float_t f, MCalibrationCam::PulserColor_t col) { fQEFFactorVar   [col] = f; }
+  void SetQEPINDiode      ( Float_t f, MCalibrationCam::PulserColor_t col) { fQEPINDiode     [col] = f; }
+  void SetQEPINDiodeVar   ( Float_t f, MCalibrationCam::PulserColor_t col) { fQEPINDiodeVar  [col] = f; }
 
-  // Miscellaneous
-  Bool_t CheckQEValidity();
+  // Updates
+  Bool_t  UpdateBlindPixelMethod();
+  Bool_t  UpdateCombinedMethod  ();
+  Bool_t  UpdateFFactorMethod   ();
+  Bool_t  UpdatePINDiodeMethod  ();
 
-  ClassDef(MCalibrationQEPix, 1)	// Container Quantum Efficieny Calibration Results Pixel
+  ClassDef(MCalibrationQEPix, 1)     // Container Quantum Efficieny Calibration Results Pixel
 };
 
