Index: trunk/MagicSoft/Mars/mcalib/MCalibrationCam.cc
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MCalibrationCam.cc	(revision 3065)
+++ trunk/MagicSoft/Mars/mcalib/MCalibrationCam.cc	(revision 3075)
@@ -184,8 +184,8 @@
   fPINDiode->Clear();
 
-  fMeanPhotInsidePlexiglass          = -1.;
-  fMeanPhotErrInsidePlexiglass       = -1.;
-  fMeanPhotOutsidePlexiglass         = -1.;
-  fMeanPhotErrOutsidePlexiglass      = -1.;
+  fMeanFluxInsidePlexiglass          = -1.;
+  fMeanFluxErrInsidePlexiglass       = -1.;
+  fMeanFluxOutsidePlexiglass         = -1.;
+  fMeanFluxErrOutsidePlexiglass      = -1.;
 
   fNumExcludedPixels                 = 0;
@@ -193,6 +193,6 @@
   CLRBIT(fFlags,kBlindPixelMethodValid);
   CLRBIT(fFlags,kPINDiodeMethodValid);
-  CLRBIT(fFlags,kNumPhotInsidePlexiglassAvailable);
-  CLRBIT(fFlags,kNumPhotOutsidePlexiglassAvailable);  
+  CLRBIT(fFlags,kFluxInsidePlexiglassAvailable);
+  CLRBIT(fFlags,kFluxOutsidePlexiglassAvailable);  
 
   return;
@@ -231,12 +231,12 @@
 
 
-Bool_t  MCalibrationCam::IsNumPhotInsidePlexiglassAvailable()   const
-{
-  return TESTBIT(fFlags,kNumPhotInsidePlexiglassAvailable);
-}
-
-Bool_t  MCalibrationCam::IsNumPhotOutsidePlexiglassAvailable()   const
-{
-  return TESTBIT(fFlags,kNumPhotOutsidePlexiglassAvailable);
+Bool_t  MCalibrationCam::IsFluxInsidePlexiglassAvailable()   const
+{
+  return TESTBIT(fFlags,kFluxInsidePlexiglassAvailable);
+}
+
+Bool_t  MCalibrationCam::IsFluxOutsidePlexiglassAvailable()   const
+{
+  return TESTBIT(fFlags,kFluxOutsidePlexiglassAvailable);
 }
 
@@ -262,5 +262,5 @@
     {
       
-      if (pix->IsChargeValid() && !pix->IsExcluded()) 
+      if (pix->IsChargeValid() && !pix->IsExcluded() && !pix->IsOscillating() && pix->IsFitted()) 
 	{
 
@@ -284,5 +284,5 @@
       {
         
-        if (!pix->IsChargeValid() && !pix->IsExcluded())
+        if (!pix->IsChargeValid() && !pix->IsExcluded() && !pix->IsFitted())
           {
 
@@ -294,4 +294,29 @@
       }
     *fLog << all << id << " pixels with errors :-((" << endl;
+
+  *fLog << all << endl;
+  *fLog << all << "Pixels with oscillations:" << endl;
+  *fLog << all << endl;
+  
+  id = 0;
+
+  TIter Next3(fPixels);
+  while ((pix=(MCalibrationPix*)Next3()))
+    {
+      
+      if (pix->IsOscillating() && !pix->IsExcluded())
+        {
+          
+          *fLog << all << pix->GetPixId() << " Pedestals: " << pix->GetPed() << " +- " 
+                << pix->GetPedRms() << " Reduced Charge: " << pix->GetCharge() << " +- " 
+                << pix->GetSigmaCharge() << " Reduced Sigma: " << pix->GetRSigmaCharge() << endl;
+          Float_t area = (*fGeomCam)[pix->GetPixId()].GetA();
+          *fLog << "Area: " << area << endl;
+          pix->DrawClone();
+          id++;
+        }
+    }
+  *fLog << all << id << " Oscillating pixels :-((" << endl;
+  
     
   *fLog << all << endl;
@@ -299,7 +324,7 @@
   *fLog << all << endl;
   
-  TIter Next3(fPixels);
-    while ((pix=(MCalibrationPix*)Next3()))
-      if (pix->IsExcluded())
+  TIter Next4(fPixels);
+  while ((pix=(MCalibrationPix*)Next4()))
+    if (pix->IsExcluded())
         *fLog << all << pix->GetPixId() << endl;
 
@@ -381,7 +406,7 @@
     return kFALSE;
 
-  Float_t arearatio = cam.GetPixRatio(idx);
-
- if (arearatio == 0)
+  Float_t area = cam[idx].GetA()/100.;
+
+ if (area == 0)
     return kFALSE;
 
@@ -475,38 +500,20 @@
       if ((*this)[idx].IsExcluded())
         return kFALSE;
-      if (arearatio == 1.)
-	val = GetMeanPhotInsidePlexiglass();
-      else
-	val = GetMeanPhotInsidePlexiglass()*gkCalibrationOutervsInnerPixelArea;
+      val = GetMeanFluxInsidePlexiglass()*area;
       break;
     case 16:
       if ((*this)[idx].IsExcluded())
         return kFALSE;
-      if (arearatio == 1.)
-	val = (double)fMeanPhotInsidePlexiglass;
-      else
-	val = (double)fMeanPhotInsidePlexiglass*gkCalibrationOutervsInnerPixelArea;
+      val = GetMeanFluxInsidePlexiglass()*area;
       break;
     case 17:
       if ((*this)[idx].IsExcluded())
         return kFALSE;
-      if (arearatio == 1.)
-        val = (*this)[idx].GetMeanConversionBlindPixelMethod();
-      else 
-        val = (*this)[idx].GetMeanConversionBlindPixelMethod()*gkCalibrationOutervsInnerPixelArea;
+      val = (*this)[idx].GetMeanConversionBlindPixelMethod();
       break;
     case 18:
       if ((*this)[idx].IsExcluded())
         return kFALSE;
-      if (arearatio == 1.)
-        val = (*this)[idx].GetErrorConversionBlindPixelMethod();
-      else 
-        {
-        val =  (*this)[idx].GetErrorConversionBlindPixelMethod()*(*this)[idx].GetErrorConversionBlindPixelMethod()
-                          * gkCalibrationOutervsInnerPixelArea * gkCalibrationOutervsInnerPixelArea;
-        val +=  gkCalibrationOutervsInnerPixelAreaError * gkCalibrationOutervsInnerPixelAreaError
-         * (*this)[idx].GetMeanConversionBlindPixelMethod() *(*this)[idx].GetMeanConversionBlindPixelMethod();
-        val = TMath::Sqrt(val);
-        }
+      val = (*this)[idx].GetErrorConversionBlindPixelMethod();
       break;
     case 19:
@@ -523,38 +530,20 @@
       if ((*this)[idx].IsExcluded())
         return kFALSE;
-      if (arearatio == 1.)
-	val = GetMeanPhotOutsidePlexiglass();
-      else
-	val = GetMeanPhotOutsidePlexiglass()*gkCalibrationOutervsInnerPixelArea;
+      val = GetMeanFluxOutsidePlexiglass()*area;
       break;
     case 22:
       if ((*this)[idx].IsExcluded())
         return kFALSE;
-      if (arearatio == 1.)
-	val = (double)fMeanPhotOutsidePlexiglass;
-      else
-	val = (double)fMeanPhotOutsidePlexiglass*gkCalibrationOutervsInnerPixelArea;
+      val = GetMeanFluxOutsidePlexiglass()*area;
       break;
     case 23:
       if ((*this)[idx].IsExcluded())
         return kFALSE;
-      if (arearatio == 1.)
-        val = (*this)[idx].GetMeanConversionPINDiodeMethod();
-      else 
-        val = (*this)[idx].GetMeanConversionPINDiodeMethod()*gkCalibrationOutervsInnerPixelArea;
+      val = (*this)[idx].GetMeanConversionPINDiodeMethod();
       break;
     case 24:
       if ((*this)[idx].IsExcluded())
         return kFALSE;
-      if (arearatio == 1.)
-        val = (*this)[idx].GetErrorConversionPINDiodeMethod();
-      else 
-        {
-          val =  (*this)[idx].GetErrorConversionPINDiodeMethod()*(*this)[idx].GetErrorConversionPINDiodeMethod()
-                          * gkCalibrationOutervsInnerPixelArea * gkCalibrationOutervsInnerPixelArea;
-          val +=  gkCalibrationOutervsInnerPixelAreaError * gkCalibrationOutervsInnerPixelAreaError
-               * (*this)[idx].GetMeanConversionPINDiodeMethod() *(*this)[idx].GetMeanConversionPINDiodeMethod();
-          val = TMath::Sqrt(val);
-        }
+      val = (*this)[idx].GetErrorConversionPINDiodeMethod();
       break;
     case 25:
@@ -694,5 +683,5 @@
 //
 //
-Bool_t MCalibrationCam::CalcNumPhotInsidePlexiglass()
+Bool_t MCalibrationCam::CalcFluxInsidePlexiglass()
 {
 
@@ -707,46 +696,44 @@
   //
   // The blind pixel has exactly one cm^2 area (with negligible error), 
-  // thus we omi division by 1.
+  // thus we omit division by 1.
   //
-  fMeanPhotInsidePlexiglass    = mean * gkCalibrationInnerPixelArea;
+  fMeanFluxInsidePlexiglass    = mean;
 
   // Start calculation of number of photons relative Variance (!!)
-  fMeanPhotErrInsidePlexiglass  = merr*merr/mean/mean;
-  fMeanPhotErrInsidePlexiglass += gkCalibrationInnerPixelAreaError*gkCalibrationInnerPixelAreaError
-                                / gkCalibrationInnerPixelArea/gkCalibrationInnerPixelArea;
+  fMeanFluxErrInsidePlexiglass  = merr*merr/mean/mean;
   
   switch (fColor)
     {
     case kECGreen:
-      fMeanPhotInsidePlexiglass    /= gkCalibrationBlindPixelQEGreen;   
-      fMeanPhotErrInsidePlexiglass += gkCalibrationBlindPixelQEGreenError*gkCalibrationBlindPixelQEGreenError
+      fMeanFluxInsidePlexiglass    /= gkCalibrationBlindPixelQEGreen;   
+      fMeanFluxErrInsidePlexiglass += gkCalibrationBlindPixelQEGreenError*gkCalibrationBlindPixelQEGreenError
                                     / gkCalibrationBlindPixelQEGreen  /   gkCalibrationBlindPixelQEGreen;   
 
-      fMeanPhotInsidePlexiglass *= TMath::Power(10,gkCalibrationBlindPixelAttGreen); // correct for absorption 
+      fMeanFluxInsidePlexiglass  *= TMath::Power(10,gkCalibrationBlindPixelAttGreen); // correct for absorption 
       // attenuation has negligible error
       break;
     case kECBlue:
-      fMeanPhotInsidePlexiglass    /= gkCalibrationBlindPixelQEBlue;   
-      fMeanPhotErrInsidePlexiglass += gkCalibrationBlindPixelQEBlueError*gkCalibrationBlindPixelQEBlueError
+      fMeanFluxInsidePlexiglass    /= gkCalibrationBlindPixelQEBlue;   
+      fMeanFluxErrInsidePlexiglass += gkCalibrationBlindPixelQEBlueError*gkCalibrationBlindPixelQEBlueError
                                     / gkCalibrationBlindPixelQEBlue  /   gkCalibrationBlindPixelQEBlue;   
 
-      fMeanPhotInsidePlexiglass *= TMath::Power(10,gkCalibrationBlindPixelAttBlue); // correct for absorption 
+      fMeanFluxInsidePlexiglass *= TMath::Power(10,gkCalibrationBlindPixelAttBlue); // correct for absorption 
       // attenuation has negligible error
       break;
     case kECUV:
-      fMeanPhotInsidePlexiglass    /= gkCalibrationBlindPixelQEUV;   
-      fMeanPhotErrInsidePlexiglass += gkCalibrationBlindPixelQEUVError*gkCalibrationBlindPixelQEUVError
+      fMeanFluxInsidePlexiglass    /= gkCalibrationBlindPixelQEUV;   
+      fMeanFluxErrInsidePlexiglass += gkCalibrationBlindPixelQEUVError*gkCalibrationBlindPixelQEUVError
                                     / gkCalibrationBlindPixelQEUV  /   gkCalibrationBlindPixelQEUV;   
 
-      fMeanPhotInsidePlexiglass *= TMath::Power(10,gkCalibrationBlindPixelAttUV); // correct for absorption 
+      fMeanFluxInsidePlexiglass *= TMath::Power(10,gkCalibrationBlindPixelAttUV); // correct for absorption 
       // attenuation has negligible error
       break;
     case kECCT1:
     default:
-      fMeanPhotInsidePlexiglass    /= gkCalibrationBlindPixelQECT1;   
-      fMeanPhotErrInsidePlexiglass += gkCalibrationBlindPixelQECT1Error*gkCalibrationBlindPixelQECT1Error
+      fMeanFluxInsidePlexiglass    /= gkCalibrationBlindPixelQECT1;   
+      fMeanFluxErrInsidePlexiglass += gkCalibrationBlindPixelQECT1Error*gkCalibrationBlindPixelQECT1Error
                                     / gkCalibrationBlindPixelQECT1  /   gkCalibrationBlindPixelQECT1;   
 
-      fMeanPhotInsidePlexiglass *= TMath::Power(10,gkCalibrationBlindPixelAttCT1); // correct for absorption 
+      fMeanFluxInsidePlexiglass *= TMath::Power(10,gkCalibrationBlindPixelAttCT1); // correct for absorption 
       // attenuation has negligible error
       break;
@@ -754,32 +741,30 @@
 
   *fLog << inf << endl;
-  *fLog << inf << " Mean number of Photons for an Inner Pixel (inside Plexiglass): " 
-        << fMeanPhotInsidePlexiglass << endl;
-
-  if (fMeanPhotInsidePlexiglass > 0.)
-    SETBIT(fFlags,kNumPhotInsidePlexiglassAvailable);  
+  *fLog << inf << " Photon flux [ph/cm^2] inside Plexiglass: " 
+        << fMeanFluxInsidePlexiglass << endl;
+
+  if (fMeanFluxInsidePlexiglass > 0.)
+    SETBIT(fFlags,kFluxInsidePlexiglassAvailable);  
   else
     {
-      CLRBIT(fFlags,kNumPhotInsidePlexiglassAvailable);        
+      CLRBIT(fFlags,kFluxInsidePlexiglassAvailable);        
       return kFALSE;
     }
 
-  if (fMeanPhotErrInsidePlexiglass < 0.)
-    {
-      *fLog << warn << " Relative Variance on number of Photons for an Inner Pixel (inside Plexiglass): " 
-            << fMeanPhotErrInsidePlexiglass << endl;
-      CLRBIT(fFlags,kNumPhotInsidePlexiglassAvailable);        
+  if (fMeanFluxErrInsidePlexiglass < 0.)
+    {
+      *fLog << warn << " Relative Variance on Photon flux inside Plexiglass: " 
+            << fMeanFluxErrInsidePlexiglass << endl;
+      CLRBIT(fFlags,kFluxInsidePlexiglassAvailable);        
       return kFALSE;
     }
 
   // Finish calculation of errors -> convert from relative variance to absolute error
-  fMeanPhotErrInsidePlexiglass = TMath::Sqrt(fMeanPhotErrInsidePlexiglass);
-  fMeanPhotErrInsidePlexiglass *= fMeanPhotInsidePlexiglass;
-
-  *fLog << inf << " Error on number of Photons for an Inner Pixel (inside Plexiglass): " 
-        << fMeanPhotErrInsidePlexiglass << endl;
+  fMeanFluxErrInsidePlexiglass = TMath::Sqrt(fMeanFluxErrInsidePlexiglass);
+  fMeanFluxErrInsidePlexiglass *= fMeanFluxInsidePlexiglass;
+
+  *fLog << inf << " Error on photon flux [ph/cm^2] inside Plexiglass: " 
+        << fMeanFluxErrInsidePlexiglass << endl;
   *fLog << inf << endl;
-
-
 
   TIter Next(fPixels);
@@ -790,30 +775,14 @@
       if(pix->IsChargeValid())
         {
+          
+          const Int_t idx = pix->GetPixId();
 
           const Float_t charge    = pix->GetCharge();
-          const Float_t ratio     = fGeomCam->GetPixRatio(pix->GetPixId());
+          const Float_t area      = (*fGeomCam)[idx].GetA()/100.;
           const Float_t chargeerr = pix->GetErrCharge();          
 
-          Float_t nphot;
-          Float_t nphoterr;
-          
-          if (ratio == 1.)
-            {
-              nphot    = fMeanPhotInsidePlexiglass;
-              nphoterr = fMeanPhotErrInsidePlexiglass;
-            }
-          else
-            {
-              nphot = fMeanPhotInsidePlexiglass*gkCalibrationOutervsInnerPixelArea;
-              nphoterr = fMeanPhotErrInsidePlexiglass*gkCalibrationOutervsInnerPixelArea
-                        *fMeanPhotErrInsidePlexiglass*gkCalibrationOutervsInnerPixelArea;
-              nphoterr += fMeanPhotInsidePlexiglass*gkCalibrationOutervsInnerPixelAreaError
-                         *fMeanPhotInsidePlexiglass*gkCalibrationOutervsInnerPixelAreaError;
-              nphoterr = TMath::Sqrt(nphoterr);
-            }
-
-          
-
-          const Float_t conversion      = nphot/charge;
+          const Float_t nphot      = fMeanFluxInsidePlexiglass*area;
+          const Float_t nphoterr   = fMeanFluxErrInsidePlexiglass*area;
+          const Float_t conversion = nphot/charge;
           Float_t conversionerr;
           
@@ -837,5 +806,5 @@
 
 
-Bool_t MCalibrationCam::CalcNumPhotOutsidePlexiglass()
+Bool_t MCalibrationCam::CalcFluxOutsidePlexiglass()
 {
 
@@ -847,32 +816,32 @@
 
   // Start calculation of number of photons
-  fMeanPhotOutsidePlexiglass = mean * gkCalibrationInnerPixelvsPINDiodeArea;
+  fMeanFluxOutsidePlexiglass = mean * gkCalibrationFluxCameravsPINDiode;
 
   // Start calculation of number of photons relative Variance (!!)
-  fMeanPhotErrOutsidePlexiglass  = merr*merr/mean/mean;
-  fMeanPhotErrOutsidePlexiglass += gkCalibrationInnerPixelvsPINDiodeAreaError*gkCalibrationInnerPixelvsPINDiodeAreaError
-                                 / gkCalibrationInnerPixelvsPINDiodeArea/gkCalibrationInnerPixelvsPINDiodeArea;
+  fMeanFluxErrOutsidePlexiglass  = merr*merr/mean/mean;
+  fMeanFluxErrOutsidePlexiglass += gkCalibrationFluxCameravsPINDiodeError*gkCalibrationFluxCameravsPINDiodeError
+                                 / gkCalibrationFluxCameravsPINDiode/gkCalibrationFluxCameravsPINDiode;
   
   switch (fColor)
     {
     case kECGreen:
-      fMeanPhotOutsidePlexiglass    /= gkCalibrationPINDiodeQEGreen;
-      fMeanPhotErrOutsidePlexiglass += gkCalibrationPINDiodeQEGreenError*gkCalibrationPINDiodeQEGreenError
+      fMeanFluxOutsidePlexiglass    /= gkCalibrationPINDiodeQEGreen;
+      fMeanFluxErrOutsidePlexiglass += gkCalibrationPINDiodeQEGreenError*gkCalibrationPINDiodeQEGreenError
                                      / gkCalibrationPINDiodeQEGreen/gkCalibrationPINDiodeQEGreen;
       break;
     case kECBlue:
-      fMeanPhotOutsidePlexiglass    /= gkCalibrationPINDiodeQEBlue;
-      fMeanPhotErrOutsidePlexiglass += gkCalibrationPINDiodeQEBlueError*gkCalibrationPINDiodeQEBlueError
+      fMeanFluxOutsidePlexiglass    /= gkCalibrationPINDiodeQEBlue;
+      fMeanFluxErrOutsidePlexiglass += gkCalibrationPINDiodeQEBlueError*gkCalibrationPINDiodeQEBlueError
                                      / gkCalibrationPINDiodeQEBlue/gkCalibrationPINDiodeQEBlue;
       break; 
     case kECUV:
-      fMeanPhotOutsidePlexiglass    /= gkCalibrationPINDiodeQEUV;
-      fMeanPhotErrOutsidePlexiglass += gkCalibrationPINDiodeQEUVError*gkCalibrationPINDiodeQEUVError
+      fMeanFluxOutsidePlexiglass    /= gkCalibrationPINDiodeQEUV;
+      fMeanFluxErrOutsidePlexiglass += gkCalibrationPINDiodeQEUVError*gkCalibrationPINDiodeQEUVError
                                      / gkCalibrationPINDiodeQEUV/gkCalibrationPINDiodeQEUV;
       break;
     case kECCT1:
     default:
-      fMeanPhotOutsidePlexiglass    /= gkCalibrationPINDiodeQECT1;
-      fMeanPhotErrOutsidePlexiglass += gkCalibrationPINDiodeQECT1Error*gkCalibrationPINDiodeQECT1Error
+      fMeanFluxOutsidePlexiglass    /= gkCalibrationPINDiodeQECT1;
+      fMeanFluxErrOutsidePlexiglass += gkCalibrationPINDiodeQECT1Error*gkCalibrationPINDiodeQECT1Error
                                      / gkCalibrationPINDiodeQECT1/gkCalibrationPINDiodeQECT1;
       break;
@@ -881,29 +850,29 @@
 
   *fLog << inf << endl;
-  *fLog << inf << " Mean number of Photons for an Inner Pixel (outside Plexiglass): " 
-        << fMeanPhotOutsidePlexiglass << endl;
-
-  if (fMeanPhotOutsidePlexiglass > 0.)
-    SETBIT(fFlags,kNumPhotOutsidePlexiglassAvailable);  
+  *fLog << inf << " Mean Photon flux [ph/cm^2] outside Plexiglass: " 
+        << fMeanFluxOutsidePlexiglass << endl;
+
+  if (fMeanFluxOutsidePlexiglass > 0.)
+    SETBIT(fFlags,kFluxOutsidePlexiglassAvailable);  
   else
     {
-      CLRBIT(fFlags,kNumPhotOutsidePlexiglassAvailable);        
+      CLRBIT(fFlags,kFluxOutsidePlexiglassAvailable);        
       return kFALSE;
     }
 
-  if (fMeanPhotErrOutsidePlexiglass < 0.)
-    {
-      *fLog << warn << "Relative Variance on number of Photons for an Inner Pixel (outside Plexiglass): " 
-            << fMeanPhotErrOutsidePlexiglass << endl;
-      CLRBIT(fFlags,kNumPhotOutsidePlexiglassAvailable);        
+  if (fMeanFluxErrOutsidePlexiglass < 0.)
+    {
+      *fLog << warn << "Relative Variance on Photon flux outside Plexiglass: " 
+            << fMeanFluxErrOutsidePlexiglass << endl;
+      CLRBIT(fFlags,kFluxOutsidePlexiglassAvailable);        
       return kFALSE;
     }
 
   // Finish calculation of errors -> convert from relative variance to absolute error
-  fMeanPhotErrOutsidePlexiglass = TMath::Sqrt(fMeanPhotErrOutsidePlexiglass);
-  fMeanPhotErrOutsidePlexiglass *= fMeanPhotOutsidePlexiglass;
-
-  *fLog << inf << " Error on number of Photons for an Inner Pixel (outside Plexiglass): " 
-        << fMeanPhotErrOutsidePlexiglass << endl;
+  fMeanFluxErrOutsidePlexiglass = TMath::Sqrt(fMeanFluxErrOutsidePlexiglass);
+  fMeanFluxErrOutsidePlexiglass *= fMeanFluxOutsidePlexiglass;
+
+  *fLog << inf << " Error on Photon flux [ph/cm^2] outside Plexiglass: " 
+        << fMeanFluxErrOutsidePlexiglass << endl;
   *fLog << inf << endl;
 
@@ -916,27 +885,14 @@
         {
 
+          const Int_t idx = pix->GetPixId();
+
           const Float_t charge    = pix->GetCharge();
-          const Float_t ratio = fGeomCam->GetPixRatio(pix->GetPixId());
+          const Float_t area      = (*fGeomCam)[idx].GetA()/100.;
           const Float_t chargeerr = pix->GetErrCharge();          
 
-          Float_t nphot;
-          Float_t nphoterr;
-          
-          if (ratio == 1.)
-            {
-              nphot    = fMeanPhotInsidePlexiglass;
-              nphoterr = fMeanPhotErrInsidePlexiglass;
-            }
-          else
-            {
-              nphot = fMeanPhotInsidePlexiglass*gkCalibrationOutervsInnerPixelArea;
-              nphoterr = fMeanPhotErrInsidePlexiglass*gkCalibrationOutervsInnerPixelArea
-                        *fMeanPhotErrInsidePlexiglass*gkCalibrationOutervsInnerPixelArea;
-              nphoterr += fMeanPhotInsidePlexiglass*gkCalibrationOutervsInnerPixelAreaError
-                         *fMeanPhotInsidePlexiglass*gkCalibrationOutervsInnerPixelAreaError;
-              nphoterr = TMath::Sqrt(nphoterr);
-            }
-
-          const Float_t conversion      = nphot/charge;
+          const Float_t nphot      = fMeanFluxOutsidePlexiglass*area;
+          const Float_t nphoterr   = fMeanFluxErrOutsidePlexiglass*area;
+          const Float_t conversion = nphot/charge;
+
           Float_t conversionerr;
           
@@ -951,8 +907,8 @@
           const Float_t conversionsigma = 0.;
 
-          pix->SetConversionBlindPixelMethod(conversion, conversionerr, conversionsigma);
+          pix->SetConversionPINDiodeMethod(conversion, conversionerr, conversionsigma);
 
           if (conversionerr/conversion < 0.1) 
-            pix->SetBlindPixelMethodValid();
+            pix->SetPINDiodeMethodValid();
           
         }
@@ -969,6 +925,6 @@
     return kFALSE;
 
-  if (!IsNumPhotInsidePlexiglassAvailable())
-    if (!CalcNumPhotInsidePlexiglass())
+  if (!IsFluxInsidePlexiglassAvailable())
+    if (!CalcFluxInsidePlexiglass())
       return kFALSE;
 
@@ -1014,6 +970,6 @@
     return kFALSE;
 
-  if (!IsNumPhotOutsidePlexiglassAvailable())
-    if (!CalcNumPhotOutsidePlexiglass())
+  if (!IsFluxOutsidePlexiglassAvailable())
+    if (!CalcFluxOutsidePlexiglass())
       return kFALSE;
 
