Index: trunk/MagicSoft/Mars/mcalib/MCalibrationChargeBlindPix.cc
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MCalibrationChargeBlindPix.cc	(revision 4224)
+++ trunk/MagicSoft/Mars/mcalib/MCalibrationChargeBlindPix.cc	(revision 4227)
@@ -68,12 +68,20 @@
 const Float_t MCalibrationChargeBlindPix::gkBlindPixelAttUV      = 1.95;
 const Float_t MCalibrationChargeBlindPix::gkBlindPixelAttCT1     = 1.95;
-const Float_t MCalibrationChargeBlindPix::gkBlindPixelQEGreen    = 0.154;
-const Float_t MCalibrationChargeBlindPix::gkBlindPixelQEBlue     = 0.226;
-const Float_t MCalibrationChargeBlindPix::gkBlindPixelQEUV       = 0.247;
-const Float_t MCalibrationChargeBlindPix::gkBlindPixelQECT1      = 0.247;
-const Float_t MCalibrationChargeBlindPix::gkBlindPixelQEGreenErr = 0.015;
-const Float_t MCalibrationChargeBlindPix::gkBlindPixelQEBlueErr  = 0.02;
-const Float_t MCalibrationChargeBlindPix::gkBlindPixelQEUVErr    = 0.02;
-const Float_t MCalibrationChargeBlindPix::gkBlindPixelQECT1Err   = 0.02;
+const Float_t MCalibrationChargeBlindPix::gkBlindPixelQEUnCoatedGreen    = 0.154;
+const Float_t MCalibrationChargeBlindPix::gkBlindPixelQEUnCoatedBlue     = 0.226;
+const Float_t MCalibrationChargeBlindPix::gkBlindPixelQEUnCoatedUV       = 0.247;
+const Float_t MCalibrationChargeBlindPix::gkBlindPixelQEUnCoatedCT1      = 0.247;
+const Float_t MCalibrationChargeBlindPix::gkBlindPixelQEUnCoatedGreenErr = 0.015;
+const Float_t MCalibrationChargeBlindPix::gkBlindPixelQEUnCoatedBlueErr  = 0.02;
+const Float_t MCalibrationChargeBlindPix::gkBlindPixelQEUnCoatedUVErr    = 0.02;
+const Float_t MCalibrationChargeBlindPix::gkBlindPixelQEUnCoatedCT1Err   = 0.02;
+const Float_t MCalibrationChargeBlindPix::gkBlindPixelQECoatedGreen      = 0.192;
+const Float_t MCalibrationChargeBlindPix::gkBlindPixelQECoatedBlue       = 0.27;
+const Float_t MCalibrationChargeBlindPix::gkBlindPixelQECoatedUV         = 0.285;
+const Float_t MCalibrationChargeBlindPix::gkBlindPixelQECoatedCT1        = 0.285;
+const Float_t MCalibrationChargeBlindPix::gkBlindPixelQECoatedGreenErr   = 0.05;
+const Float_t MCalibrationChargeBlindPix::gkBlindPixelQECoatedBlueErr    = 0.07;
+const Float_t MCalibrationChargeBlindPix::gkBlindPixelQECoatedUVErr      = 0.07;
+const Float_t MCalibrationChargeBlindPix::gkBlindPixelQECoatedCT1Err     = 0.07;
 // --------------------------------------------------------------------------
 //
@@ -82,4 +90,5 @@
 // Calls:
 // - Clear()
+// - SetCoated()
 //
 MCalibrationChargeBlindPix::MCalibrationChargeBlindPix(const char *name, const char *title)
@@ -89,4 +98,5 @@
   fTitle = title ? title : "Container of the fit results of the blind pixel";
 
+  SetCoated();
   Clear();
 }
@@ -139,4 +149,13 @@
 // --------------------------------------------------------------------------
 //
+// Set the Coated Bit from outside 
+//
+void  MCalibrationChargeBlindPix::SetCoated( const Bool_t b)
+{
+    b ? SETBIT(fFlags,kCoated) : CLRBIT(fFlags,kCoated);
+}
+
+// --------------------------------------------------------------------------
+//
 // Set the Oscillating Bit from outside 
 //
@@ -239,13 +258,22 @@
 // Return gkBlindPixelQEGreenErr^2 / (gkBlindPixelQEGreen^2 )
 // 
-const Float_t MCalibrationChargeBlindPix::GetBlindPixelQEGreenRelVar() const
-{
-  if (gkBlindPixelQEGreenErr < 0.)
-    return -1.;
-  
-  if (gkBlindPixelQEGreen  == 0.)
-    return -1.;
-  
-  return gkBlindPixelQEGreenErr * gkBlindPixelQEGreenErr / gkBlindPixelQEGreen / gkBlindPixelQEGreen ;
+const Float_t MCalibrationChargeBlindPix::GetBlindPixelQEGreen() const
+{
+
+  if (IsCoated())
+    {
+      if (gkBlindPixelQECoatedGreen < 0.)
+        return -1.;
+      
+      return gkBlindPixelQECoatedGreen;
+    }
+  else
+    {
+      if (gkBlindPixelQEUnCoatedGreen < 0.)
+        return -1.;
+      
+      return gkBlindPixelQEUnCoatedGreen;
+    }
+  
 }
 
@@ -256,13 +284,20 @@
 // Return gkBlindPixelQEBlueErr^2 / gkBlindPixelQEBlue^2
 // 
-const Float_t MCalibrationChargeBlindPix::GetBlindPixelQEBlueRelVar() const
-{
-  if (gkBlindPixelQEBlueErr < 0.)
-    return -1.;
-  
-  if (gkBlindPixelQEBlue  == 0.)
-    return -1.;
-  
-  return gkBlindPixelQEBlueErr * gkBlindPixelQEBlueErr / gkBlindPixelQEBlue / gkBlindPixelQEBlue ;
+const Float_t MCalibrationChargeBlindPix::GetBlindPixelQEBlue() const
+{
+  if (IsCoated())
+    {
+      if (gkBlindPixelQECoatedBlue < 0.)
+        return -1.;
+      
+      return gkBlindPixelQECoatedBlue;
+    }
+  else
+    {
+      if (gkBlindPixelQEUnCoatedBlue < 0.)
+        return -1.;
+      
+      return gkBlindPixelQEUnCoatedBlue;
+    }
 }
 
@@ -273,13 +308,22 @@
 // Return gkBlindPixelQEUVErr ^2 / gkBlindPixelQEUV^2 
 // 
-const Float_t MCalibrationChargeBlindPix::GetBlindPixelQEUVRelVar() const
-{
-  if (gkBlindPixelQEUVErr < 0.)
-    return -1.;
-  
-  if (gkBlindPixelQEUV  == 0.)
-    return -1.;
-  
-  return gkBlindPixelQEUVErr * gkBlindPixelQEUVErr / gkBlindPixelQEUV / gkBlindPixelQEUV ;
+const Float_t MCalibrationChargeBlindPix::GetBlindPixelQEUV() const
+{
+
+  if (IsCoated())
+    {
+      if (gkBlindPixelQECoatedUV < 0.)
+        return -1.;
+      
+      return gkBlindPixelQECoatedUV;
+    }
+  else
+    {
+      if (gkBlindPixelQEUnCoatedUV < 0.)
+        return -1.;
+      
+      
+      return gkBlindPixelQEUnCoatedUV;
+    }
 }
 
@@ -290,13 +334,153 @@
 // Return gkBlindPixelQECT1Err ^2 / gkBlindPixelQECT1^2
 // 
+const Float_t MCalibrationChargeBlindPix::GetBlindPixelQECT1() const
+{
+
+  if (IsCoated())
+    {
+      if (gkBlindPixelQECoatedCT1 < 0.)
+        return -1.;
+      
+      return gkBlindPixelQECoatedCT1;
+    }
+  else
+    {
+      if (gkBlindPixelQEUnCoatedCT1 < 0.)
+        return -1.;
+      
+      return gkBlindPixelQEUnCoatedCT1;
+    }
+}
+
+// --------------------------------------------------------------------------
+//
+// Return -1 if gkBlindPixelQEGreenErr is smaller than 0.
+// Return -1 if gkBlindPixelQEGreen    is 0.
+// Return gkBlindPixelQEGreenErr^2 / (gkBlindPixelQEGreen^2 )
+// 
+const Float_t MCalibrationChargeBlindPix::GetBlindPixelQEGreenRelVar() const
+{
+
+  if (IsCoated())
+    {
+      if (gkBlindPixelQECoatedGreenErr < 0.)
+        return -1.;
+      
+      if (gkBlindPixelQECoatedGreen  == 0.)
+        return -1.;
+      
+      return gkBlindPixelQECoatedGreenErr * gkBlindPixelQECoatedGreenErr 
+         / gkBlindPixelQECoatedGreen / gkBlindPixelQECoatedGreen ;
+    }
+  else
+    {
+      if (gkBlindPixelQEUnCoatedGreenErr < 0.)
+        return -1.;
+      
+      if (gkBlindPixelQEUnCoatedGreen  == 0.)
+        return -1.;
+      
+      return gkBlindPixelQEUnCoatedGreenErr * gkBlindPixelQEUnCoatedGreenErr 
+         / gkBlindPixelQEUnCoatedGreen / gkBlindPixelQEUnCoatedGreen ;
+    }
+  
+}
+
+// --------------------------------------------------------------------------
+//
+// Return -1 if gkBlindPixelQEBlueErr is smaller than 0.
+// Return -1 if gkBlindPixelQEBlue    is 0.
+// Return gkBlindPixelQEBlueErr^2 / gkBlindPixelQEBlue^2
+// 
+const Float_t MCalibrationChargeBlindPix::GetBlindPixelQEBlueRelVar() const
+{
+  if (IsCoated())
+    {
+      if (gkBlindPixelQECoatedBlueErr < 0.)
+        return -1.;
+      
+      if (gkBlindPixelQECoatedBlue  == 0.)
+        return -1.;
+      
+      return gkBlindPixelQECoatedBlueErr * gkBlindPixelQECoatedBlueErr 
+         / gkBlindPixelQECoatedBlue / gkBlindPixelQECoatedBlue ;
+    }
+  else
+    {
+      if (gkBlindPixelQEUnCoatedBlueErr < 0.)
+        return -1.;
+      
+      if (gkBlindPixelQEUnCoatedBlue  == 0.)
+        return -1.;
+      
+      return gkBlindPixelQEUnCoatedBlueErr * gkBlindPixelQEUnCoatedBlueErr 
+         / gkBlindPixelQEUnCoatedBlue / gkBlindPixelQEUnCoatedBlue ;
+    }
+}
+
+// --------------------------------------------------------------------------
+//
+// Return -1 if gkBlindPixelQEUVErr is smaller than 0.
+// Return -1 if gkBlindPixelQEUV    is 0.
+// Return gkBlindPixelQEUVErr ^2 / gkBlindPixelQEUV^2 
+// 
+const Float_t MCalibrationChargeBlindPix::GetBlindPixelQEUVRelVar() const
+{
+
+  if (IsCoated())
+    {
+      if (gkBlindPixelQECoatedUVErr < 0.)
+        return -1.;
+      
+      if (gkBlindPixelQECoatedUV  == 0.)
+        return -1.;
+      
+      return gkBlindPixelQECoatedUVErr * gkBlindPixelQECoatedUVErr 
+         / gkBlindPixelQECoatedUV / gkBlindPixelQECoatedUV ;
+    }
+  else
+    {
+      if (gkBlindPixelQEUnCoatedUVErr < 0.)
+        return -1.;
+      
+      if (gkBlindPixelQEUnCoatedUV  == 0.)
+        return -1.;
+      
+      return gkBlindPixelQEUnCoatedUVErr * gkBlindPixelQEUnCoatedUVErr 
+         / gkBlindPixelQEUnCoatedUV / gkBlindPixelQEUnCoatedUV ;
+    }
+}
+
+// --------------------------------------------------------------------------
+//
+// Return -1 if gkBlindPixelQECT1Err is smaller than 0.
+// Return -1 if gkBlindPixelQECT1    is 0.
+// Return gkBlindPixelQECT1Err ^2 / gkBlindPixelQECT1^2
+// 
 const Float_t MCalibrationChargeBlindPix::GetBlindPixelQECT1RelVar() const
 {
-  if (gkBlindPixelQECT1Err < 0.)
-    return -1.;
-  
-  if (gkBlindPixelQECT1  == 0.)
-    return -1.;
-  
-  return gkBlindPixelQECT1Err * gkBlindPixelQECT1Err / gkBlindPixelQECT1 / gkBlindPixelQECT1 ;
+
+  if (IsCoated())
+    {
+      if (gkBlindPixelQECoatedCT1Err < 0.)
+        return -1.;
+      
+      if (gkBlindPixelQECoatedCT1  == 0.)
+        return -1.;
+      
+      return gkBlindPixelQECoatedCT1Err * gkBlindPixelQECoatedCT1Err 
+         / gkBlindPixelQECoatedCT1 / gkBlindPixelQECoatedCT1 ;
+    }
+  else
+    {
+      if (gkBlindPixelQEUnCoatedCT1Err < 0.)
+        return -1.;
+      
+      if (gkBlindPixelQEUnCoatedCT1  == 0.)
+        return -1.;
+      
+      return gkBlindPixelQEUnCoatedCT1Err * gkBlindPixelQEUnCoatedCT1Err 
+         / gkBlindPixelQEUnCoatedCT1 / gkBlindPixelQEUnCoatedCT1 ;
+    }
 }
 
@@ -312,4 +496,13 @@
 // --------------------------------------------------------------------------
 //
+// Test bit kCoated
+//
+Bool_t MCalibrationChargeBlindPix::IsCoated()  const 
+{
+    return TESTBIT(fFlags,kCoated);
+}
+
+// --------------------------------------------------------------------------
+//
 // Test bit kOscillating
 //
@@ -352,5 +545,5 @@
 //
 // Calculate fFluxInsidePlexiglass with the formula:
-// - fFluxInsidePlexiglass    = fLambda * gkBlindPixelArea / gkBlindPixelQE * 10**gkBlindPixelAtt
+// - fFluxInsidePlexiglass    = fLambda * gkBlindPixelArea / GetBlindPixelQE() * 10**gkBlindPixelAtt
 // - fFluxInsidePlexiglassVar = sqrt( fLambdaVar / ( fLambda * fLambda ) 
 //                             + ( gkBlindPixelQEErr * gkBlindPixelQEErr / gkBlindPixelQE / gkBlindPixelQE )
@@ -376,15 +569,15 @@
     {
     case MCalibrationCam::kGREEN:
-      fFluxInsidePlexiglass    = fLambda / gkBlindPixelQEGreen * TMath::Power(10,gkBlindPixelAttGreen);   
+      fFluxInsidePlexiglass    = fLambda / GetBlindPixelQEGreen() * TMath::Power(10,gkBlindPixelAttGreen);   
       // attenuation has negligible error
       fFluxInsidePlexiglassVar = GetLambdaRelVar() + GetBlindPixelQEGreenRelVar();
       break;
     case MCalibrationCam::kBLUE:
-      fFluxInsidePlexiglass    = fLambda / gkBlindPixelQEBlue * TMath::Power(10,gkBlindPixelAttBlue);   
+      fFluxInsidePlexiglass    = fLambda / GetBlindPixelQEBlue() * TMath::Power(10,gkBlindPixelAttBlue);   
       // attenuation has negligible error
       fFluxInsidePlexiglassVar = GetLambdaRelVar() + GetBlindPixelQEBlueRelVar();
       break;
     case MCalibrationCam::kUV:
-      fFluxInsidePlexiglass    = fLambda / gkBlindPixelQEUV * TMath::Power(10,gkBlindPixelAttUV);   
+      fFluxInsidePlexiglass    = fLambda / GetBlindPixelQEUV() * TMath::Power(10,gkBlindPixelAttUV);   
       // attenuation has negligible error
       fFluxInsidePlexiglassVar = GetLambdaRelVar() + GetBlindPixelQEUVRelVar();
@@ -392,5 +585,5 @@
     case MCalibrationCam::kCT1:
     default:
-      fFluxInsidePlexiglass    = fLambda / gkBlindPixelQECT1 * TMath::Power(10,gkBlindPixelAttCT1);   
+      fFluxInsidePlexiglass    = fLambda / GetBlindPixelQECT1() * TMath::Power(10,gkBlindPixelAttCT1);   
       // attenuation has negligible error
       fFluxInsidePlexiglassVar = GetLambdaRelVar() + GetBlindPixelQECT1RelVar();
Index: trunk/MagicSoft/Mars/mcalib/MCalibrationChargeBlindPix.h
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MCalibrationChargeBlindPix.h	(revision 4224)
+++ trunk/MagicSoft/Mars/mcalib/MCalibrationChargeBlindPix.h	(revision 4227)
@@ -14,17 +14,25 @@
 private:
 
-  static const Float_t gkBlindPixelArea;        //! The Blind Pixel area in mm^2
-  static const Float_t gkBlindPixelAttGreen;    //! Attenuation Filter at 520 nm 
-  static const Float_t gkBlindPixelAttBlue ;    //! Attenuation Filter at 460 nm 
-  static const Float_t gkBlindPixelAttUV   ;    //! Attenuation Filter at 370 nm 
-  static const Float_t gkBlindPixelAttCT1  ;    //! Attenuation Filter at 370 nm
-  static const Float_t gkBlindPixelQEGreen;     //! Quantum Efficiency at 520 nm
-  static const Float_t gkBlindPixelQEBlue ;     //! Quantum Efficiency at 460 nm
-  static const Float_t gkBlindPixelQEUV   ;     //! Quantum Efficiency at 370 nm
-  static const Float_t gkBlindPixelQECT1  ;     //! Quantum Efficiency at 370 nm
-  static const Float_t gkBlindPixelQEGreenErr;  //! Uncertainty QE at 520 nm 
-  static const Float_t gkBlindPixelQEBlueErr ;  //! Uncertainty QE at 460 nm 
-  static const Float_t gkBlindPixelQEUVErr   ;  //! Uncertainty QE at 370 nm 
-  static const Float_t gkBlindPixelQECT1Err  ;  //! Uncertainty QE at 370 nmu
+  static const Float_t gkBlindPixelArea;               //! The Blind Pixel area in mm^2
+  static const Float_t gkBlindPixelAttGreen;           //! Attenuation Filter at 520 nm 
+  static const Float_t gkBlindPixelAttBlue ;           //! Attenuation Filter at 460 nm 
+  static const Float_t gkBlindPixelAttUV   ;           //! Attenuation Filter at 370 nm 
+  static const Float_t gkBlindPixelAttCT1  ;           //! Attenuation Filter at 370 nm
+  static const Float_t gkBlindPixelQEUnCoatedGreen;    //! Quantum Efficiency at 520 nm
+  static const Float_t gkBlindPixelQEUnCoatedBlue ;    //! Quantum Efficiency at 460 nm
+  static const Float_t gkBlindPixelQEUnCoatedUV   ;    //! Quantum Efficiency at 370 nm
+  static const Float_t gkBlindPixelQEUnCoatedCT1  ;    //! Quantum Efficiency at 370 nm
+  static const Float_t gkBlindPixelQEUnCoatedGreenErr; //! Uncertainty QEUnCoated at 520 nm 
+  static const Float_t gkBlindPixelQEUnCoatedBlueErr ; //! Uncertainty QEUnCoated at 460 nm 
+  static const Float_t gkBlindPixelQEUnCoatedUVErr   ; //! Uncertainty QEUnCoated at 370 nm 
+  static const Float_t gkBlindPixelQEUnCoatedCT1Err  ; //! Uncertainty QEUnCoated at 370 nmu
+  static const Float_t gkBlindPixelQECoatedGreen;      //! Quantum Efficiency at 520 nm
+  static const Float_t gkBlindPixelQECoatedBlue ;      //! Quantum Efficiency at 460 nm
+  static const Float_t gkBlindPixelQECoatedUV   ;      //! Quantum Efficiency at 370 nm
+  static const Float_t gkBlindPixelQECoatedCT1  ;      //! Quantum Efficiency at 370 nm
+  static const Float_t gkBlindPixelQECoatedGreenErr;   //! Uncertainty QECoated at 520 nm 
+  static const Float_t gkBlindPixelQECoatedBlueErr ;   //! Uncertainty QECoated at 460 nm 
+  static const Float_t gkBlindPixelQECoatedUVErr   ;   //! Uncertainty QECoated at 370 nm 
+  static const Float_t gkBlindPixelQECoatedCT1Err  ;   //! Uncertainty QECoated at 370 nmu
 
   Float_t fLambda;                  // Mean Poisson fit
@@ -44,7 +52,12 @@
 
   enum { kOscillating, kPedestalFitOK, kSinglePheFitOK, kChargeFitValid, 
-         kFluxInsidePlexiglassAvailable };
+         kFluxInsidePlexiglassAvailable, kCoated };
 
-  MCalibrationCam::PulserColor_t fColor;  
+  MCalibrationCam::PulserColor_t fColor;
+
+  const Float_t GetBlindPixelQEGreen() const; 
+  const Float_t GetBlindPixelQEBlue () const; 
+  const Float_t GetBlindPixelQEUV   () const; 
+  const Float_t GetBlindPixelQECT1  () const; 
 
   const Float_t GetBlindPixelQEGreenRelVar() const; 
@@ -80,4 +93,5 @@
   Float_t GetSigma1Err                    () const { return fSigma1Err;            }
 
+  Bool_t  IsCoated                        () const;  
   Bool_t  IsOscillating                   () const;
   Bool_t  IsChargeFitValid                () const;
@@ -101,4 +115,5 @@
   void SetSigma1Err      ( const Float_t f )                            { fSigma1Err      = f; }
 
+  void SetCoated         ( const Bool_t  b=kTRUE );  
   void SetOscillating    ( const Bool_t  b=kTRUE );
   void SetChargeFitValid ( const Bool_t  b=kTRUE );
@@ -107,5 +122,5 @@
   void SetFluxInsidePlexiglassAvailable( const Bool_t b=kTRUE);
 
-  ClassDef(MCalibrationChargeBlindPix, 1)	// Container Charge Calibration Results Blind Pixel
+  ClassDef(MCalibrationChargeBlindPix, 2)	// Container Charge Calibration Results Blind Pixel
 };
 
