Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 3602)
+++ trunk/MagicSoft/Mars/Changelog	(revision 3603)
@@ -31,6 +31,11 @@
 
    * mcalib/MHCalibrationChargeCam.cc
+   * mcalib/MCalibrationChargeCam.cc
    * mbadpixels/MBadPixelsCam.cc
      - adopt to new style in MBadPixelsPix.h
+
+   * mcalib/MCalibrationChargeCalc.[h,cc]
+   * mcalib/MCalibrationChargePix.[h,cc]
+     - move consistency checks from Pix to Calc
 
 
Index: trunk/MagicSoft/Mars/macros/calibration.C
===================================================================
--- trunk/MagicSoft/Mars/macros/calibration.C	(revision 3602)
+++ trunk/MagicSoft/Mars/macros/calibration.C	(revision 3603)
@@ -80,5 +80,5 @@
   plist.AddToList(&tlist);
   plist.AddToList(&pedloop.GetPedestalCam());
-  plist.AddToList(&badcam);
+  plist.AddToList(&pedloop.GetBadPixels());    
 
   gLog << endl;;
@@ -119,5 +119,4 @@
   //    plist.AddToList(&histpin);
   plist.AddToList(&histblind);
-  plist.AddToList(&pedloop.GetBadPixels());    
   
   //
@@ -202,5 +201,5 @@
   //
   //    histblind.DrawClone("all");
-  //    histcharge[5].DrawClone("all");
+  //  histcharge[5].DrawClone("all");
   //    histcharge(5).DrawClone("all");
   //    histtime[5].DrawClone("fourierevents");
Index: trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCam.cc
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCam.cc	(revision 3602)
+++ trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCam.cc	(revision 3603)
@@ -884,6 +884,6 @@
               if (nphe < lowerpheinnerlimit || nphe > upperpheinnerlimit)
                 {
-                  bad[idx].SetDeviatingNumPhes();
-                  bad[idx].SetUnsuitable(MBadPixelsPix::kUnreliableRun);
+                  bad[idx].SetUncalibrated(MBadPixelsPix::kDeviatingNumPhes);
+                  bad[idx].SetUnsuitable(  MBadPixelsPix::kUnreliableRun);
                   continue;
                 }
@@ -899,6 +899,6 @@
               if (nphe < lowerpheouterlimit || nphe > upperpheouterlimit)
                 {
-                  bad[idx].SetDeviatingNumPhes();
-                  bad[idx].SetUnsuitable(MBadPixelsPix::kUnreliableRun);
+                  bad[idx].SetUncalibrated(MBadPixelsPix::kDeviatingNumPhes);
+                  bad[idx].SetUnsuitable(  MBadPixelsPix::kUnreliableRun);
                   continue;
                 }
Index: trunk/MagicSoft/Mars/mcalib/MCalibrationChargePix.cc
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MCalibrationChargePix.cc	(revision 3602)
+++ trunk/MagicSoft/Mars/mcalib/MCalibrationChargePix.cc	(revision 3603)
@@ -105,9 +105,4 @@
 const Float_t MCalibrationChargePix::gkConversionHiLoErr        = 2.5;
 
-const Float_t MCalibrationChargePix::fgChargeLimit              = 3.;
-const Float_t MCalibrationChargePix::fgChargeErrLimit           = 0.;
-const Float_t MCalibrationChargePix::fgChargeRelErrLimit        = 1.;
-const Float_t MCalibrationChargePix::fgTimeLimit                = 1.5;
-const Float_t MCalibrationChargePix::fgTimeErrLimit             = 3.;
 const Float_t MCalibrationChargePix::fgPheFFactorMethodLimit    = 5.;
 // --------------------------------------------------------------------------
@@ -132,10 +127,4 @@
   SetConversionHiLoErr();
 
-  SetChargeLimit();
-  SetChargeErrLimit();  
-  
-  SetChargeRelErrLimit();
-  SetTimeLimit();
-  SetTimeErrLimit();
   SetPheFFactorMethodLimit();
   
@@ -182,9 +171,4 @@
   fLoGainPedRmsVar                  =  -1.;
 
-  fTimeFirstHiGain                  =   0 ;
-  fTimeLastHiGain                   =   0 ;
-  fTimeFirstLoGain                  =   0 ;
-  fTimeLastLoGain                   =   0 ;
-
   fAbsTimeMean                      =  -1.;
   fAbsTimeRms                       =  -1.;
@@ -373,17 +357,4 @@
 }
 
-void MCalibrationChargePix::SetAbsTimeBordersHiGain(const Byte_t f, const Byte_t l)
-{
-
-  fTimeFirstHiGain = f;
-  fTimeLastHiGain  = l;
-  
-}
-
-void MCalibrationChargePix::SetAbsTimeBordersLoGain(const Byte_t f, const Byte_t l)
-{
-  fTimeFirstLoGain = f;
-  fTimeLastLoGain  = l;
-}
 
 Float_t  MCalibrationChargePix::GetPedRms()  const
@@ -596,81 +567,4 @@
 }
 
-
-//
-// The check return kTRUE if:
-//
-// 1) Pixel has a fitted charge greater than fChargeLimit*PedRMS
-// 2) Pixel has a fit error greater than fChargeVarLimit
-// 3) Pixel has a fitted charge greater its fChargeRelVarLimit times its charge error
-// 4) Pixel has a charge sigma bigger than its Pedestal RMS
-// 
-void MCalibrationChargePix::CheckChargeValidity(MBadPixelsPix *bad)
-{
- 
-  if (GetMeanCharge() < fChargeLimit*GetPedRms())
-    {
-      *fLog << warn << "WARNING: Fitted Charge is smaller than "
-            << fChargeLimit << " Pedestal RMS in Pixel  " << fPixId << endl;
-      bad->SetChargeIsPedestal();
-      bad->SetUnsuitable(MBadPixelsPix::kUnsuitableRun);
-    }
-  
-  const Float_t meanchargevar = IsHiGainSaturation() ? fLoGainMeanChargeVar : fHiGainMeanChargeVar;
-  
-  if (meanchargevar < fChargeVarLimit) 
-    {
-      *fLog << warn << "WARNING: Variance of Fitted Charge is smaller than "
-            << meanchargevar << " in Pixel  " << fPixId << endl;
-      bad->SetChargeErrNotValid();
-      bad->SetUnsuitable(MBadPixelsPix::kUnsuitableRun);
-    }
-      
-   if (GetMeanCharge()*GetMeanCharge() < fChargeRelVarLimit*meanchargevar) 
-    {
-      *fLog << warn << "WARNING: Fitted Charge is smaller than "
-            << TMath::Sqrt(fChargeRelVarLimit) << "* its error in Pixel  " << fPixId << endl;
-      bad->SetChargeRelErrNotValid();
-      bad->SetUnsuitable(MBadPixelsPix::kUnsuitableRun);
-    }
-
-  if (GetSigmaCharge() < GetPedRms())
-    {
-	*fLog << warn << "WARNING: Sigma of Fitted Charge smaller than Pedestal RMS in Pixel  " 
-              << fPixId << endl;
-        bad->SetChargeSigmaNotValid();
-        bad->SetUnsuitable(MBadPixelsPix::kUnsuitableRun);
-    }
-
-}
-
-//
-// The check returns kTRUE if:
-//
-// The mean arrival time is at least 1.0 slices from the used edge slices 
-//
-void MCalibrationChargePix::CheckTimeValidity(MBadPixelsPix *bad)
-{
-  
-  const Byte_t loweredge     = IsHiGainSaturation() ? fTimeFirstLoGain   : fTimeFirstHiGain;
-  const Byte_t upperedge     = IsHiGainSaturation() ? fTimeLastLoGain    : fTimeLastHiGain;
-  
-  if ( fAbsTimeMean < (Float_t)loweredge+1)
-    {
-      *fLog << warn << "WARNING: Mean ArrivalTime in first extraction bin of the Pixel " << fPixId << endl;
-      *fLog << fAbsTimeMean << "   " << (Float_t)loweredge+1. << endl;
-      bad->SetMeanTimeInFirstBin();
-      bad->SetUnsuitable(MBadPixelsPix::kUnsuitableRun);
-    }
-  
-  if ( fAbsTimeMean > (Float_t)upperedge-2)
-    {
-      *fLog << warn << "WARNING: Mean ArrivalTime in last two extraction bins of the Pixel " << fPixId << endl;
-      *fLog << fAbsTimeMean << "   " << (Float_t)upperedge-2. << endl;
-      bad->SetMeanTimeInLastBin();
-      bad->SetUnsuitable(MBadPixelsPix::kUnsuitableRun);
-    }
-}
-
-
 //
 // 
