Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 2955)
+++ trunk/MagicSoft/Mars/Changelog	(revision 2956)
@@ -4,9 +4,18 @@
 
                                                  -*-*- END OF LINE -*-*-
+ 2004/01/29: Markus Gaug
+
+   * mcalib/MCalibrationCalc.[h,cc], mcalib/MCalibrationCam.[h,cc], 
+     mcalib/MCalibrationConfig.h
+     - put gkCalibrationBlindPixelId and gkCalibrationPINDiodeId 
+       directly into the corresponding classes.
+
+
  2004/01/29: Nicola Galante
 
    * mhistmc/MHMcTriggerLvl2.[h,cc]:
-     - In method MHMcTriggerLvl2::GetHistByName(const TString name) added
-       string checking to return also fHistCellPseudoSize, fHistCellPseudoSizeNorm
+     - In method MHMcTriggerLvl2::GetHistByName(const TString name) 
+       added string checking to return also 
+       fHistCellPseudoSize, fHistCellPseudoSizeNorm
        and fHistCellPseudoSizeEnergy.
      - Added inline functions GetHistCellPseudoSize() and 
Index: trunk/MagicSoft/Mars/mcalib/MCalibrationCalc.cc
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MCalibrationCalc.cc	(revision 2955)
+++ trunk/MagicSoft/Mars/mcalib/MCalibrationCalc.cc	(revision 2956)
@@ -121,4 +121,5 @@
     : fPedestals(NULL), fCalibrations(NULL), fSignals(NULL),
       fRawEvt(NULL), fRunHeader(NULL), fArrivalTime(NULL), fEvtTime(NULL)
+  //      fBlindPixelId(559), fPINDiodeId(9999)
 {
 
@@ -460,5 +461,5 @@
         {
           
-        case gkCalibrationBlindPixelId:
+        case kBlindPixelId:
           
           if (!blindpixel.FillCharge(sumhi)) 
@@ -478,5 +479,5 @@
           break;
           
-        case gkCalibrationPINDiodeId:
+        case kPINDiodeId:
 
           if (!pindiode.FillCharge(sumhi)) 
Index: trunk/MagicSoft/Mars/mcalib/MCalibrationCalc.h
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MCalibrationCalc.h	(revision 2955)
+++ trunk/MagicSoft/Mars/mcalib/MCalibrationCalc.h	(revision 2956)
@@ -50,4 +50,7 @@
   MTime                    *fEvtTime;      // Time of the event
 
+  enum { kBlindPixelId = 559,               // ID of the blind pixel
+         kPINDiodeId = 9999};              // ID of the PIN Diode
+  
   Int_t fEvents;                           // Number of events  
   Int_t fCosmics;                          // Number of events due to supposed cosmics
Index: trunk/MagicSoft/Mars/mcalib/MCalibrationCam.cc
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MCalibrationCam.cc	(revision 2955)
+++ trunk/MagicSoft/Mars/mcalib/MCalibrationCam.cc	(revision 2956)
@@ -72,5 +72,7 @@
     : fOffsets(NULL),
       fSlopes(NULL),
-      fOffvsSlope(NULL)
+      fOffvsSlope(NULL),
+      fBlindPixelId(559),
+      fPINDiodeId(9999)
 {
     fName  = name  ? name  : "MCalibrationCam";
@@ -181,12 +183,15 @@
   fPINDiode->Clear();
 
-  fNumPhotInsidePlexiglassAvailable  = kFALSE;
   fMeanPhotInsidePlexiglass          = -1.;
   fMeanPhotErrInsidePlexiglass       = -1.;
-  fNumPhotOutsidePlexiglassAvailable = kFALSE;
   fMeanPhotOutsidePlexiglass         = -1.;
   fMeanPhotErrOutsidePlexiglass      = -1.;
 
   fNumExcludedPixels                 = 0;
+
+  CLRBIT(fFlags,kBlindPixelMethodValid);
+  CLRBIT(fFlags,kPINDiodeMethodValid);
+  CLRBIT(fFlags,kNumPhotInsidePlexiglassAvailable);
+  CLRBIT(fFlags,kNumPhotOutsidePlexiglassAvailable);  
 
   return;
@@ -223,4 +228,16 @@
   return TESTBIT(fFlags,kPINDiodeMethodValid);  
 }
+
+
+Bool_t  MCalibrationCam::IsNumPhotInsidePlexiglassAvailable()   const
+{
+  return TESTBIT(fFlags,kNumPhotInsidePlexiglassAvailable);
+}
+
+Bool_t  MCalibrationCam::IsNumPhotOutsidePlexiglassAvailable()   const
+{
+  return TESTBIT(fFlags,kNumPhotOutsidePlexiglassAvailable);
+}
+
 
 
@@ -374,5 +391,8 @@
     return kFALSE;
   
-  if (idx == gkCalibrationBlindPixelId)
+  if (idx == fBlindPixelId)
+    return kFALSE;
+
+  if (idx == fPINDiodeId)
     return kFALSE;
 
@@ -501,5 +521,5 @@
     }
 
-  fNumPhotInsidePlexiglassAvailable = kTRUE;
+  SETBIT(fFlags,kNumPhotInsidePlexiglassAvailable);
 
   *fLog << inf << endl;
@@ -557,5 +577,5 @@
     }
 
-  fNumPhotOutsidePlexiglassAvailable = kTRUE;
+  SETBIT(fFlags,kNumPhotOutsidePlexiglassAvailable);  
 
   *fLog << inf << endl;
@@ -583,5 +603,5 @@
     return kFALSE;
 
-  if (!fNumPhotInsidePlexiglassAvailable)
+  if (!IsNumPhotInsidePlexiglassAvailable())
     if (!CalcNumPhotInsidePlexiglass())
       return kFALSE;
@@ -627,4 +647,12 @@
   if (ipx < 0 || !IsPixelFitted(ipx))
     return kFALSE;
+
+  if (!IsNumPhotOutsidePlexiglassAvailable())
+    if (!CalcNumPhotOutsidePlexiglass())
+      return kFALSE;
+
+  mean  = (*this)[ipx].GetMeanConversionPINDiodeMethod();
+  err   = (*this)[ipx].GetErrorConversionPINDiodeMethod();
+  sigma = (*this)[ipx].GetSigmaConversionPINDiodeMethod();
 
   return kFALSE;
Index: trunk/MagicSoft/Mars/mcalib/MCalibrationCam.h
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MCalibrationCam.h	(revision 2955)
+++ trunk/MagicSoft/Mars/mcalib/MCalibrationCam.h	(revision 2956)
@@ -24,11 +24,4 @@
   MCalibrationPINDiode *fPINDiode;            //-> Pointer to the PIN Diode with fit results
 
-  Bool_t  fNumPhotInsidePlexiglassAvailable;  // TRUE: Blind Pixel could have been fitted well 
-  Float_t fMeanPhotInsidePlexiglass;          //  The mean number of photons in an INNER PIXEL inside the plexiglass
-  Float_t fMeanPhotErrInsidePlexiglass;       //  The uncertainty about the number of photons in an INNER PIXEL  
-
-  Bool_t  fNumPhotOutsidePlexiglassAvailable; // TRUE: PIN Diode could have been fitted well 
-  Float_t fMeanPhotOutsidePlexiglass;         //  The mean number of photons in an INNER PIXEL outside the plexiglass
-  Float_t fMeanPhotErrOutsidePlexiglass;      //  The uncertainty about the number of photons in an INNER PIXEL  
 
   TH1D* fOffsets;                             //! 
@@ -37,9 +30,18 @@
   TH2D* fOffvsSlope;                          //! 
 
+  const Int_t fBlindPixelId;
+  const Int_t fPINDiodeId;  
+
+  Float_t fMeanPhotInsidePlexiglass;     //  The mean number of photons in an INNER PIXEL inside the plexiglass
+  Float_t fMeanPhotErrInsidePlexiglass;  //  The uncertainty about the number of photons in an INNER PIXEL  
+  Float_t fMeanPhotOutsidePlexiglass;    //  The mean number of photons in an INNER PIXEL outside the plexiglass
+  Float_t fMeanPhotErrOutsidePlexiglass; //  The uncertainty about the number of photons in an INNER PIXEL  
+
   UInt_t fNumExcludedPixels;
 
   Byte_t fFlags;
 
-  enum  { kBlindPixelMethodValid, kPINDiodeMethodValid  };
+  enum  { kBlindPixelMethodValid, kPINDiodeMethodValid,
+          kNumPhotInsidePlexiglassAvailable, kNumPhotOutsidePlexiglassAvailable  };
   
 public:
@@ -62,4 +64,5 @@
   void SetColor(const CalibrationColor_t color)       {  fColor = color; }
   void SetNumPixelsExcluded(const UInt_t n)               {  fNumExcludedPixels = n;    }
+
   void SetBlindPixelMethodValid(const Bool_t b = kTRUE);
   void SetPINDiodeMethodValid(const Bool_t b = kTRUE);  
@@ -84,4 +87,8 @@
   Bool_t IsBlindPixelMethodValid()   const;
   Bool_t IsPINDiodeMethodValid()     const;  
+
+  Bool_t IsNumPhotInsidePlexiglassAvailable() const;
+  Bool_t IsNumPhotOutsidePlexiglassAvailable() const;
+
 
   // Others
Index: trunk/MagicSoft/Mars/mcalib/MCalibrationConfig.h
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MCalibrationConfig.h	(revision 2955)
+++ trunk/MagicSoft/Mars/mcalib/MCalibrationConfig.h	(revision 2956)
@@ -12,19 +12,9 @@
 /////////////////////////////////////////////////////////////////////////////
 
-
-// The highest value of the High Gain in the linear regime
-const Byte_t gkSaturationLimit = 250;
-
 // The conversion factor between High Gain and Low Gain
 const Float_t gkConversionHiLo      = 10.;
 const Float_t gkConversionHiLoError = 2.5;
 
-// The penalty constant to produce overflow in the histogram 
-const ULong_t gkLoGainOverFlow = 99999999;
-
 // ----- BLIND PIXEL ----------------------//
-
-// Pixel ID of the Calibration Blind Pixel
-const UShort_t gkCalibrationBlindPixelId = 559;
 
 // Average QE of Blind Pixel (three colours)
