Index: trunk/MagicSoft/Mars/mbadpixels/MBadPixelsPix.cc
===================================================================
--- trunk/MagicSoft/Mars/mbadpixels/MBadPixelsPix.cc	(revision 3433)
+++ trunk/MagicSoft/Mars/mbadpixels/MBadPixelsPix.cc	(revision 3434)
@@ -38,5 +38,4 @@
 
 const Char_t MBadPixelsPix::fgRunMask=MBadPixelsPix::kUnsuitableRun;
-
 // ------------------------------------------------------------------------
 //
@@ -48,4 +47,6 @@
     fName  = name  ? name  : "MBadPixelsPix";
     fTitle = title ? title : "Container storeing bad pixel information for a single pixel";
+
+    fInfo[1] = 0;
 }
 
@@ -59,4 +60,5 @@
 {
     fInfo[0] &= fgRunMask;
+
 }
 
Index: trunk/MagicSoft/Mars/mbadpixels/MBadPixelsPix.h
===================================================================
--- trunk/MagicSoft/Mars/mbadpixels/MBadPixelsPix.h	(revision 3433)
+++ trunk/MagicSoft/Mars/mbadpixels/MBadPixelsPix.h	(revision 3434)
@@ -23,22 +23,23 @@
     };
 
+    // All types are initialized to normal behaviour
     enum CalibrationType_t {
-      kHiGainSaturation      = BIT(1),
-      kLoGainSaturation      = BIT(2),
-      kHiGainFitted          = BIT(3),
-      kLoGainFitted          = BIT(4), 
-      kCalcChargePedestal    = BIT(5),
-      kCalcChargeErrValid    = BIT(6),
-      kCalcChargeRelErrValid = BIT(7),
-      kCalcChargeSigmaValid  = BIT(8),
-      kConversionHiLoValid   = BIT(9),      
-      kHiGainOscillating     = BIT(10),
-      kLoGainOscillating     = BIT(11),
-      kMeanTimeInFirstBin    = BIT(12),
-      kMeanTimeInLastBin     = BIT(13), 
-      kBlindPixelMethodValid = BIT(14),
-      kFFactorMethodValid    = BIT(15), 
-      kPINDiodeMethodValid   = BIT(16),
-      kCombinedMethodValid   = BIT(17)
+      kHiGainSaturation         = BIT(1),
+      kLoGainSaturation         = BIT(2),
+      kHiGainNotFitted          = BIT(3),
+      kLoGainNotFitted          = BIT(4), 
+      kChargeIsPedestal         = BIT(5),
+      kChargeErrNotValid        = BIT(6),
+      kChargeRelErrNotValid     = BIT(7),
+      kChargeSigmaNotValid      = BIT(8),
+      kConvHiLoNotValid         = BIT(9),      
+      kHiGainOscillating        = BIT(10),
+      kLoGainOscillating        = BIT(11),
+      kMeanTimeInFirstBin       = BIT(12),
+      kMeanTimeInLastBin        = BIT(13), 
+      kBlindPixelMethodNotValid = BIT(14),
+      kFFactorMethodNotValid    = BIT(15), 
+      kPINDiodeMethodNotValid   = BIT(16),
+      kCombinedMethodNotValid   = BIT(17)
     };
     
@@ -61,54 +62,38 @@
 
     // Calibration
-    void   SetHiGainSaturation  ( CalibrationType_t typ=kHiGainSaturation )   { fInfo[1] |=  typ; }
-    void   SetNoHiGainSaturation( CalibrationType_t typ=kHiGainSaturation )   { fInfo[1] &= ~typ; }
-
-    void   SetLoGainSaturation  ( CalibrationType_t typ=kLoGainSaturation )   { fInfo[1] |=  typ; }
-    void   SetNoLoGainSaturation( CalibrationType_t typ=kLoGainSaturation )   { fInfo[1] &= ~typ; }
-
-    void   SetCombinedMethodValid  ( CalibrationType_t typ=kCombinedMethodValid )   { fInfo[1] |=  typ; }
-    void   SetNoCombinedMethodValid( CalibrationType_t typ=kCombinedMethodValid )   { fInfo[1] &= ~typ; }
-
-    void   SetPINDiodeMethodValid  ( CalibrationType_t typ=kPINDiodeMethodValid )   { fInfo[1] |=  typ; }
-    void   SetNoPINDiodeMethodValid( CalibrationType_t typ=kPINDiodeMethodValid )   { fInfo[1] &= ~typ; }
-
-    void   SetFFactorMethodValid  ( CalibrationType_t typ=kFFactorMethodValid )   { fInfo[1] |=  typ; }
-    void   SetNoFFactorMethodValid( CalibrationType_t typ=kFFactorMethodValid )   { fInfo[1] &= ~typ; }
-
-    void   SetBlindPixelMethodValid  ( CalibrationType_t typ=kBlindPixelMethodValid )   { fInfo[1] |=  typ; }
-    void   SetNoBlindPixelMethodValid( CalibrationType_t typ=kBlindPixelMethodValid )   { fInfo[1] &= ~typ; }
-
-    void   SetMeanTimeInLastBin  ( CalibrationType_t typ=kMeanTimeInLastBin )   { fInfo[1] |=  typ; }
-    void   SetNoMeanTimeInLastBin( CalibrationType_t typ=kMeanTimeInLastBin )   { fInfo[1] &= ~typ; }
-
-    void   SetMeanTimeInFirstBin  ( CalibrationType_t typ=kMeanTimeInFirstBin )   { fInfo[1] |=  typ; }
-    void   SetNoMeanTimeInFirstBin( CalibrationType_t typ=kMeanTimeInFirstBin )   { fInfo[1] &= ~typ; }
-
-    void   SetLoGainOscillating  ( CalibrationType_t typ=kLoGainOscillating )   { fInfo[1] |=  typ; }
-    void   SetNoLoGainOscillating( CalibrationType_t typ=kLoGainOscillating )   { fInfo[1] &= ~typ; }
-
-    void   SetHiGainOscillating  ( CalibrationType_t typ=kHiGainOscillating )   { fInfo[1] |=  typ; }
-    void   SetNoHiGainOscillating( CalibrationType_t typ=kHiGainOscillating )   { fInfo[1] &= ~typ; }
-
-    void   SetConversionHiLoValid  ( CalibrationType_t typ=kConversionHiLoValid )   { fInfo[1] |=  typ; }
-    void   SetNoConversionHiLoValid( CalibrationType_t typ=kConversionHiLoValid )   { fInfo[1] &= ~typ; }
-
-    void   SetCalcChargeSigmaValid  ( CalibrationType_t typ=kCalcChargeSigmaValid )   { fInfo[1] |=  typ; }
-    void   SetNoCalcChargeSigmaValid( CalibrationType_t typ=kCalcChargeSigmaValid )   { fInfo[1] &= ~typ; }
-
-    void   SetCalcChargeRelErrValid  ( CalibrationType_t typ=kCalcChargeRelErrValid )   { fInfo[1] |=  typ; }
-    void   SetNoCalcChargeRelErrValid( CalibrationType_t typ=kCalcChargeRelErrValid )   { fInfo[1] &= ~typ; }
-
-    void   SetCalcChargeErrValid  ( CalibrationType_t typ=kCalcChargeErrValid )   { fInfo[1] |=  typ; }
-    void   SetNoCalcChargeErrValid( CalibrationType_t typ=kCalcChargeErrValid )   { fInfo[1] &= ~typ; }
-
-    void   SetCalcChargePedestal  ( CalibrationType_t typ=kCalcChargePedestal )   { fInfo[1] |=  typ; }
-    void   SetNoCalcChargePedestal( CalibrationType_t typ=kCalcChargePedestal )   { fInfo[1] &= ~typ; }
-
-    void   SetLoGainFitted  ( CalibrationType_t typ=kLoGainFitted )   { fInfo[1] |=  typ; }
-    void   SetNoLoGainFitted( CalibrationType_t typ=kLoGainFitted )   { fInfo[1] &= ~typ; }
-
-    void   SetHiGainFitted  ( CalibrationType_t typ=kHiGainFitted )   { fInfo[1] |=  typ; }
-    void   SetNoHiGainFitted( CalibrationType_t typ=kHiGainFitted )   { fInfo[1] &= ~typ; }
+    void SetHiGainSaturation         ( CalibrationType_t typ=kHiGainSaturation         )
+      { fInfo[1] |= typ; }
+    void SetLoGainSaturation         ( CalibrationType_t typ=kLoGainSaturation         )
+      { fInfo[1] |= typ; }
+    void SetCombinedMethodNotValid   ( CalibrationType_t typ=kCombinedMethodNotValid   )
+      { fInfo[1] |= typ; }
+    void SetPINDiodeMethodNotValid   ( CalibrationType_t typ=kPINDiodeMethodNotValid   )
+      { fInfo[1] |= typ; }
+    void SetFFactorMethodNotValid    ( CalibrationType_t typ=kFFactorMethodNotValid    )
+      { fInfo[1] |= typ; }
+    void SetBlindPixelMethodNotValid ( CalibrationType_t typ=kBlindPixelMethodNotValid )
+      { fInfo[1] |= typ; }
+    void SetMeanTimeInLastBin        ( CalibrationType_t typ=kMeanTimeInLastBin        )
+      { fInfo[1] |= typ; }
+    void SetMeanTimeInFirstBin       ( CalibrationType_t typ=kMeanTimeInFirstBin       )
+      { fInfo[1] |= typ; }
+    void SetLoGainOscillating        ( CalibrationType_t typ=kLoGainOscillating        )
+      { fInfo[1] |= typ; }
+    void SetHiGainOscillating        ( CalibrationType_t typ=kHiGainOscillating        )
+      { fInfo[1] |= typ; }
+    void SetConvHiLoNotValid         ( CalibrationType_t typ=kConvHiLoNotValid         )
+      { fInfo[1] |= typ; }
+    void SetChargeSigmaNotValid      ( CalibrationType_t typ=kChargeSigmaNotValid      )
+      { fInfo[1] |= typ; }
+    void SetChargeRelErrNotValid     ( CalibrationType_t typ=kChargeRelErrNotValid     )
+      { fInfo[1] |= typ; }
+    void SetChargeErrNotValid        ( CalibrationType_t typ=kChargeErrNotValid        )
+      { fInfo[1] |= typ; }
+    void SetChargeIsPedestal         ( CalibrationType_t typ=kChargeIsPedestal         )
+      { fInfo[1] |= typ; }
+    void SetLoGainNotFitted          ( CalibrationType_t typ=kLoGainNotFitted          )
+      { fInfo[1] |= typ; }
+    void SetHiGainNotFitted          ( CalibrationType_t typ=kHiGainNotFitted          )
+      { fInfo[1] |= typ; }
 
     // Getter
@@ -122,33 +107,67 @@
     Bool_t IsBad() const { return fInfo[0]!=0; }
 
-    Bool_t IsLoGainBad() const { return (fInfo[1]&kLoGainSaturation
-                                         || !(fInfo[1]&kConversionHiLoValid)
-                                         || fInfo[1]&kLoGainOscillating ); }    
-    Bool_t IsHiGainBad() const { return ( fInfo[1]&kHiGainSaturation
-                                           && !(fInfo[1]&kConversionHiLoValid) )
-                                   || fInfo[1]&kHiGainOscillating ;    }
-    Bool_t IsCalibrationSignalOK() const  { return !( fInfo[1]&kCalcChargePedestal
-                                                     || !(fInfo[1]&kCalcChargeErrValid)
-                                                     || !(fInfo[1]&kCalcChargeRelErrValid)
-                                                     || !(fInfo[1]&kCalcChargeSigmaValid)
-                                                     || fInfo[1]&kMeanTimeInFirstBin
-                                                     || fInfo[1]&kMeanTimeInLastBin ) ;  }
-    Bool_t IsCalibrationFitOK() const    { return ( fInfo[1]&kHiGainSaturation && kHiGainFitted )
-                                             || ( fInfo[1]&kLoGainSaturation && kLoGainFitted ) ; }
-    Bool_t IsCalibrationOscillating() const  { return ( fInfo[1]&kHiGainSaturation && kHiGainOscillating )
-                                                 || ( fInfo[1]&kLoGainSaturation && kLoGainOscillating ) ; }
-    Bool_t IsCalibrationResultOK() const  {  return ( IsCalibrationSignalOK()
-                                                      && !(IsCalibrationOscillating())
-                                                      && IsCalibrationFitOK()
-                                                      && (!fInfo[1]&kHiGainSaturation && !(IsHiGainBad())
-                                                          || fInfo[1]&kHiGainSaturation && !(IsLoGainBad())) );}
-    Bool_t IsCalibrationFFactorMethodOK() const  { return ( IsCalibrationResultOK()
-                                                            && (fInfo[1]&kFFactorMethodValid)) ; }
-    Bool_t IsCalibrationBlindPixelMethodOK() const  { return ( IsCalibrationResultOK()
-                                                            && (fInfo[1]&kBlindPixelMethodValid)) ; }
-    Bool_t IsCalibrationPINDiodeMethodOK() const  { return ( IsCalibrationResultOK()
-                                                            && (fInfo[1]&kPINDiodeMethodValid)) ; }
-    Bool_t IsCalibrationCombinedMethodOK() const  { return ( IsCalibrationResultOK()
-                                                            && (fInfo[1]&kCombinedMethodValid)) ; }
+    Bool_t IsHiGainSaturation         () const
+      { return !(fInfo[1] | ~kHiGainSaturation         == ~kHiGainSaturation );         }
+    Bool_t IsLoGainSaturation         () const
+      { return !(fInfo[1] | ~kLoGainSaturation         == ~kLoGainSaturation );         }
+    Bool_t IsCombinedMethodNotValid   () const
+      { return !(fInfo[1] | ~kCombinedMethodNotValid   == ~kCombinedMethodNotValid );   }
+    Bool_t IsPINDiodeMethodNotValid   () const
+      { return !(fInfo[1] | ~kPINDiodeMethodNotValid   == ~kPINDiodeMethodNotValid );   }
+    Bool_t IsFFactorMethodNotValid    () const
+      { return !(fInfo[1] | ~kFFactorMethodNotValid    == ~kFFactorMethodNotValid );    }
+    Bool_t IsBlindPixelMethodNotValid () const
+      { return !(fInfo[1] | ~kBlindPixelMethodNotValid == ~kBlindPixelMethodNotValid ); }
+    Bool_t IsMeanTimeInLastBin        () const
+      { return !(fInfo[1] | ~kMeanTimeInLastBin        == ~kMeanTimeInLastBin );        }
+    Bool_t IsMeanTimeInFirstBin       () const
+      { return !(fInfo[1] | ~kMeanTimeInFirstBin       == ~kMeanTimeInFirstBin );       }
+    Bool_t IsLoGainOscillating        () const
+      { return !(fInfo[1] | ~kLoGainOscillating        == ~kLoGainOscillating );        }
+    Bool_t IsHiGainOscillating        () const
+      { return !(fInfo[1] | ~kHiGainOscillating        == ~kHiGainOscillating );        }
+    Bool_t IsConvHiLoNotValid         () const
+      { return !(fInfo[1] | ~kConvHiLoNotValid         == ~kConvHiLoNotValid );         }
+    Bool_t IsChargeSigmaNotValid      () const
+      { return !(fInfo[1] | ~kChargeSigmaNotValid      == ~kChargeSigmaNotValid );      }
+    Bool_t IsChargeRelErrNotValid     () const
+      { return !(fInfo[1] | ~kChargeRelErrNotValid     == ~kChargeRelErrNotValid );     }
+    Bool_t IsChargeErrNotValid        () const
+      { return !(fInfo[1] | ~kChargeErrNotValid        == ~kChargeErrNotValid );        }
+    Bool_t IsChargeIsPedestal         () const
+      { return !(fInfo[1] | ~kChargeIsPedestal         == ~kChargeIsPedestal );         }
+    Bool_t IsLoGainNotFitted          () const
+      { return !(fInfo[1] | ~kLoGainNotFitted          == ~kLoGainNotFitted );          }
+    Bool_t IsHiGainNotFitted          () const
+      { return !(fInfo[1] | ~kHiGainNotFitted          == ~kHiGainNotFitted );          }
+
+    Bool_t IsLoGainBad() const { return IsLoGainSaturation()
+                                   || IsConvHiLoNotValid()
+                                   || IsLoGainOscillating() ;}    
+    Bool_t IsHiGainBad() const { return ( IsHiGainSaturation() && IsConvHiLoNotValid() 
+                                          || IsHiGainOscillating() ); }
+    Bool_t IsCalibrationSignalOK() const  { return !( IsChargeIsPedestal()
+                                                      || IsChargeErrNotValid()
+                                                      || IsChargeRelErrNotValid()
+                                                      || IsChargeSigmaNotValid()
+                                                      || IsMeanTimeInFirstBin()
+                                                      || IsMeanTimeInLastBin() );  }
+    Bool_t IsCalibrationFitOK() const    { return !( (IsHiGainSaturation() && IsHiGainNotFitted())
+                                                     || ( IsLoGainSaturation() && IsLoGainNotFitted()) ); }
+    Bool_t IsCalibrationOscillating() const  { return ( IsHiGainSaturation() && IsHiGainOscillating()) 
+                                                 || ( IsLoGainSaturation() && IsLoGainOscillating()) ; }
+    Bool_t IsCalibrationResultOK() const  {  return IsCalibrationSignalOK()
+                                               && !(IsCalibrationOscillating())
+                                               && IsCalibrationFitOK()
+                                               && ( (!IsHiGainSaturation() && !IsHiGainBad())
+                                                    || (IsHiGainSaturation() && !IsLoGainBad()) ) ;}
+    Bool_t IsCalibrationFFactorMethodOK() const  { return IsCalibrationResultOK()
+                                                     && !IsFFactorMethodNotValid() ; }
+    Bool_t IsCalibrationBlindPixelMethodOK() const  { return IsCalibrationResultOK()
+                                                        && !IsBlindPixelMethodNotValid(); }
+    Bool_t IsCalibrationPINDiodeMethodOK() const  { return IsCalibrationResultOK()
+                                                      && !IsPINDiodeMethodNotValid() ; }
+    Bool_t IsCalibrationCombinedMethodOK() const  { return IsCalibrationResultOK()
+                                                      && !IsCombinedMethodNotValid(); }
 
     void Merge(const MBadPixelsPix &pix);
