Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 8019)
+++ trunk/MagicSoft/Mars/Changelog	(revision 8020)
@@ -31,4 +31,11 @@
    * mcalib/MCalibrationHiLoCam.[h,cc]:
      - broke down a long Form() chain into single Form()'s
+
+   * mhcalib/MHPedestalPix.cc, mhcalib/MHGausEvents.[h,cc], 
+     mhcalib/MHCalibrationChargeBlindPix.cc, 
+     mhcalib/MHCalibrationPix.cc:
+     - replaced IsNaN by !IsFinite (which includes IsNaN)
+     - changed some protected data members of the base class
+       into private data members
 
 
Index: trunk/MagicSoft/Mars/manalysis/MEnergyEstParam.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MEnergyEstParam.cc	(revision 8019)
+++ trunk/MagicSoft/Mars/manalysis/MEnergyEstParam.cc	(revision 8020)
@@ -359,7 +359,8 @@
             return kCONTINUE;
 
-        if (TMath::IsNaN(ir))
+        // !Finitite includes IsNaN
+        if (!TMath::Finite(ir))
             *fLog << all << theta << " " << width << " " << length << " " << size << " " << dist << endl;
-        if (TMath::IsNaN(er))
+        if (!TMath::Finite(er))
         {
             *fLog << all << theta << " " << width << " " << length << " " << size << " " << dist << endl;
Index: trunk/MagicSoft/Mars/manalysis/MEnergyEstParamDanielMkn421.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MEnergyEstParamDanielMkn421.cc	(revision 8019)
+++ trunk/MagicSoft/Mars/manalysis/MEnergyEstParamDanielMkn421.cc	(revision 8020)
@@ -358,7 +358,8 @@
             return kCONTINUE;
 
-        if (TMath::IsNaN(ir))
+        // !Finitite includes IsNaN
+        if (!TMath::Finite(ir))
             *fLog << all << theta << " " << width << " " << length << " " << size << " " << dist << endl;
-        if (TMath::IsNaN(er))
+        if (!TMath::Finite(er))
         {
             *fLog << all << theta << " " << width << " " << length << " " << size << " " << dist << endl;
Index: trunk/MagicSoft/Mars/mhcalib/MHCalibrationPix.cc
===================================================================
--- trunk/MagicSoft/Mars/mhcalib/MHCalibrationPix.cc	(revision 8019)
+++ trunk/MagicSoft/Mars/mhcalib/MHCalibrationPix.cc	(revision 8020)
@@ -223,9 +223,9 @@
   // 3) The Probability is greater than fProbLimit (default: fgProbLimit)
   //
-  if (   TMath::IsNaN ( fMean     ) 
-      || TMath::IsNaN ( fMeanErr  )
-      || TMath::IsNaN ( fProb     )    
-      || TMath::IsNaN ( fSigma    )
-      || TMath::IsNaN ( fSigmaErr ) 
+  if (   !TMath::Finite( fMean     )
+      || !TMath::Finite( fMeanErr  )
+      || !TMath::Finite( fProb     )
+      || !TMath::Finite( fSigma    )
+      || !TMath::Finite( fSigmaErr )
       || fFGausFit->GetNDF() < GetNDFLimit()
       || fProb < GetProbLimit() )
Index: trunk/MagicSoft/Mars/mhcalib/MHGausEvents.cc
===================================================================
--- trunk/MagicSoft/Mars/mhcalib/MHGausEvents.cc	(revision 8019)
+++ trunk/MagicSoft/Mars/mhcalib/MHGausEvents.cc	(revision 8020)
@@ -129,8 +129,8 @@
       fHPowerProbability(NULL), 
       fPowerSpectrum(NULL),
-      fFGausFit(NULL), fFExpFit(NULL),
+      fFExpFit(NULL),
       fFirst(0.), 
       fGraphEvents(NULL), fGraphPowerSpectrum(NULL),
-      fLast(100.), fNbins(100)
+      fLast(100.), fNbins(100), fFGausFit(NULL)
 { 
 
@@ -762,9 +762,10 @@
   // 4) The Probability is greater than fProbLimit (default: fgProbLimit)
   //
-  if (   TMath::IsNaN(fMean)        || !TMath::Finite(fMean)
-      || TMath::IsNaN(fMeanErr)     || !TMath::Finite(fMeanErr)
-      || TMath::IsNaN(fProb)        || !TMath::Finite(fProb)
-      || TMath::IsNaN(fSigma)       || !TMath::Finite(fSigma)
-      || TMath::IsNaN(fSigmaErr)    || !TMath::Finite(fSigmaErr)
+  // !Finitite means either infinite or not-a-number
+  if (   !TMath::Finite(fMean)
+      || !TMath::Finite(fMeanErr)
+      || !TMath::Finite(fProb)
+      || !TMath::Finite(fSigma)
+      || !TMath::Finite(fSigmaErr)
       || fFGausFit->GetNDF() < fNDFLimit 
       || fProb < fProbLimit )
Index: trunk/MagicSoft/Mars/mhcalib/MHGausEvents.h
===================================================================
--- trunk/MagicSoft/Mars/mhcalib/MHGausEvents.h	(revision 8019)
+++ trunk/MagicSoft/Mars/mhcalib/MHGausEvents.h	(revision 8020)
@@ -35,5 +35,5 @@
   Float_t *CreatePSDXaxis  (Int_t n);           // Create an x-axis for the PSD TGraphs
   
-protected:
+private:
 
   Int_t    fBinsAfterStripping;        // Bins for the Gauss Histogram after stripping off the zeros at both ends
@@ -52,19 +52,22 @@
   
   MArrayF  fEvents;                    // Array which holds the entries of GausHist
-  TF1     *fFGausFit;                  // Gauss fit for fHGausHist
   TF1     *fFExpFit;                   // Exponential fit for FHPowerProbability
   Axis_t   fFirst;                     // Lower histogram edge  for fHGausHist (used by InitBins()) 
   TGraph  *fGraphEvents;               //! TGraph to display the event array 
   TGraph  *fGraphPowerSpectrum;        //! TGraph to display the power spectrum array 
+  Axis_t   fLast;                      // Upper histogram edge  for fHGausHist (used by InitBins()) 
+  Int_t    fNbins;                     // Number histogram bins for fHGausHist (used by InitBins())
+  Int_t    fNDFLimit;                  // NDF limit for judgement if fit is OK
+  Float_t  fProbLimit;                 // Probability limit for judgement if fit is OK 
+
+protected:
+  TF1     *fFGausFit;                  // Gauss fit for fHGausHist
   TH1F     fHGausHist;                 // Histogram to hold the Gaussian distribution
-  Axis_t   fLast;                      // Upper histogram edge  for fHGausHist (used by InitBins()) 
+
   Double_t fMean;                      // Mean of the Gauss fit
   Double_t fMeanErr;                   // Error of the mean of the Gauss fit
-  Int_t    fNbins;                     // Number histogram bins for fHGausHist (used by InitBins())
-  Int_t    fNDFLimit;                  // NDF limit for judgement if fit is OK
   Double_t fSigma;                     // Sigma of the Gauss fit
   Double_t fSigmaErr;                  // Error of the sigma of the Gauss fit
   Double_t fProb;                      // Probability of the Gauss fit 
-  Float_t  fProbLimit;                 // Probability limit for judgement if fit is OK 
 
   // Setters
@@ -137,5 +140,8 @@
   const Double_t GetSigmaErr()           const { return fSigmaErr;           }
   const Double_t GetSlope()              const { return ( fFExpFit  ? fFExpFit->GetParameter(1) : 0.); }
+  const Int_t    GetNDFLimit()           const { return fNDFLimit; }
+  const Float_t  GetProbLimit()          const { return fProbLimit; }
 
+  const Bool_t   IsValid()               const { return fMean!=0 || fSigma!=0; }
   const Bool_t   IsExcluded()            const { return TESTBIT(fFlags,kExcluded);          }
   const Bool_t   IsExpFitOK()            const { return TESTBIT(fFlags,kExpFitOK);          }
Index: trunk/MagicSoft/Mars/mhcalib/MHPedestalPix.cc
===================================================================
--- trunk/MagicSoft/Mars/mhcalib/MHPedestalPix.cc	(revision 8019)
+++ trunk/MagicSoft/Mars/mhcalib/MHPedestalPix.cc	(revision 8020)
@@ -136,10 +136,11 @@
   // 3) The Probability is greater than fProbLimit (default: fgProbLimit)
   //
-  if (   TMath::IsNaN(GetMean()) 
-      || TMath::IsNaN(GetMeanErr())
-      || TMath::IsNaN(GetProb())    
-      || TMath::IsNaN(GetSigma())
-      || TMath::IsNaN(GetSigmaErr()) 
-      || fProb < fProbLimit )
+  // !Finitite means either infinite or not-a-number
+  if (   !TMath::Finite(GetMean())
+      || !TMath::Finite(GetMeanErr())
+      || !TMath::Finite(GetProb())
+      || !TMath::Finite(GetSigma())
+      || !TMath::Finite(GetSigmaErr())
+      || fProb < GetProbLimit())
     return kFALSE;
   
@@ -222,10 +223,11 @@
   // 3) The Probability is greater than fProbLimit (default: fgProbLimit)
   //
-  if (   TMath::IsNaN(GetMean()) 
-      || TMath::IsNaN(GetMeanErr())
-      || TMath::IsNaN(GetProb())    
-      || TMath::IsNaN(GetSigma())
-      || TMath::IsNaN(GetSigmaErr()) 
-      || fProb < fProbLimit )
+  // !Finitite means either infinite or not-a-number
+  if (   !TMath::Finite(GetMean())
+      || !TMath::Finite(GetMeanErr())
+      || !TMath::Finite(GetProb())
+      || !TMath::Finite(GetSigma())
+      || !TMath::Finite(GetSigmaErr())
+      || fProb < GetProbLimit() )
     return kFALSE;
   
