Index: /trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc
===================================================================
--- /trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc	(revision 3691)
+++ /trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc	(revision 3692)
@@ -251,10 +251,9 @@
 //
 MCalibrationChargeCalc::MCalibrationChargeCalc(const char *name, const char *title)
-    : fPedestals(NULL), fCam(NULL), fQECam(NULL),
-      fRawEvt(NULL), fRunHeader(NULL), fGeom(NULL), 
-      fBadPixels(NULL), fEvtTime(NULL),
-      fSignals(NULL), fSigBlind(NULL), fSigPIN(NULL),
-      fPINDiode(NULL), fBlindPixel(NULL)
-{
+    : fBadPixels(NULL), fCam(NULL), fBlindPixel(NULL), fPINDiode(NULL), 
+      fQECam(NULL), fSignals(NULL), fSigBlind(NULL), fSigPIN(NULL),
+      fGeom(NULL), fPedestals(NULL), fRawEvt(NULL), fRunHeader(NULL), 
+      fEvtTime(NULL)
+      {
 
   fName  = name  ? name  : "MCalibrationChargeCalc";
@@ -290,5 +289,4 @@
     fSqrtHiGainSamples       = 0.;
     fSqrtLoGainSamples       = 0.;
-    fConversionHiLo          = 0 ;
     SkipQualityChecks      ( kFALSE );
     SkipHiLoGainCalibration( kFALSE );    
@@ -571,5 +569,5 @@
   if (cal.GetMeanErr() < fChargeErrLimit) 
     {
-      *fLog << warn << GetDescriptor() << ": Sigma of Fitted Charge: " << cal.GetMeanErr() 
+      *fLog << warn << GetDescriptor() << ": Error of Fitted Charge: " << cal.GetMeanErr() 
             << " is smaller than " << fChargeErrLimit << " in Pixel  " << cal.GetPixId() << endl;
       bad.SetUncalibrated( MBadPixelsPix::kChargeErrNotValid );
Index: /trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.h
===================================================================
--- /trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.h	(revision 3691)
+++ /trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.h	(revision 3692)
@@ -43,70 +43,68 @@
 private:
 
-  static const Float_t fgChargeLimit;            //! Default for fChargeLimit            (now set to: 3.)
-  static const Float_t fgChargeErrLimit;         //! Default for fChargeErrLimit         (now set to: 0.)
-  static const Float_t fgChargeRelErrLimit;      //! Default for fChargeRelErrLimit      (now set to: 1.)
-  static const Float_t fgLambdaCheckLimit;       //! Default for fLambdaCheckLimit       (now set to: 0.2)
-  static const Float_t fgLambdaErrLimit;         //! Default for fLabmdaErrLimit         (now set to: 0.2)
-  static const Float_t fgPheErrLimit;            //! Default for fPheErrLimit            (now set to: 5.)
-  static const Float_t fgTimeLowerLimit;         //! Default for fTimeLowerLimit         (now set to: 1.) 
-  static const Float_t fgTimeUpperLimit;         //! Default for fTimeUpperLimit         (now set to: 2.)
-  
-  Float_t fChargeLimit;            // Limit (in units of PedRMS) for acceptance of mean charge
-  Float_t fChargeErrLimit;         // Limit (in units of PedRMS) for acceptance of charge sigma square
-  Float_t fChargeRelErrLimit;      // Limit (in units of Sigma of fitted charge) for acceptance of mean  
-  Float_t fLambdaCheckLimit;       // Limit for rel. diff. lambda and lambdacheck blind pixel
-  Float_t fLambdaErrLimit;         // Limit for acceptance of lambda error blind pixel
-  Float_t fPheErrLimit;            // Limit for acceptance number phe's w.r.t area index mean (in sigmas)
-  Float_t fTimeLowerLimit;         // Limit (in units of FADC slices) for dist. to first signal slice
-  Float_t fTimeUpperLimit;         // Limit (in units of FADC slices) for dist. to last signal slice
+  static const Float_t fgChargeLimit;          //! Default for fChargeLimit       (now set to: 3.)
+  static const Float_t fgChargeErrLimit;       //! Default for fChargeErrLimit    (now set to: 0.)
+  static const Float_t fgChargeRelErrLimit;    //! Default for fChargeRelErrLimit (now set to: 1.)
+  static const Float_t fgLambdaCheckLimit;     //! Default for fLambdaCheckLimit  (now set to: 0.2)
+  static const Float_t fgLambdaErrLimit;       //! Default for fLabmdaErrLimit    (now set to: 0.2)
+  static const Float_t fgPheErrLimit;          //! Default for fPheErrLimit       (now set to: 5.)
+  static const Float_t fgTimeLowerLimit;       //! Default for fTimeLowerLimit    (now set to: 1.) 
+  static const Float_t fgTimeUpperLimit;       //! Default for fTimeUpperLimit    (now set to: 2.)
 
-  MPedestalCam               *fPedestals;     //! Pedestals of all pixels in the camera
-  MCalibrationChargeCam      *fCam;           // Calibration events of all pixels in the camera
-  MCalibrationQECam          *fQECam;         // Derived Quantum efficiency of all pixels in the camera  
-  MRawEvtData                *fRawEvt;        //! raw event data (time slices)
-  MRawRunHeader              *fRunHeader;     //! RunHeader information
-  MGeomCam                   *fGeom;          //! Geometry information
-  MBadPixelsCam              *fBadPixels;     //! Bad Pixels information
-  
-  MTime                      *fEvtTime;       //! Time of the event
+  // Variables
+  Float_t fChargeLimit;                        // Limit acceptance mean charge  (in units of PedRMS)
+  Float_t fChargeErrLimit;                     // Limit acceptance charge error (in abs. numbers)
+  Float_t fChargeRelErrLimit;                  // Limit acceptance rel. error mean (in abs. numbers)
+  Int_t   fFlags;                              // Bit-field for the flags
+  Float_t fLambdaCheckLimit;                   // Limit rel. diff. lambda and lambdacheck in Blind Pixel
+  Float_t fLambdaErrLimit;                     // Limit acceptance lambda error in Blind Pixel
+  Float_t fNumHiGainSamples;                   // Number High-Gain FADC slices used by extractor
+  Float_t fNumLoGainSamples;                   // Number Low -Gain FADC slices used by extractor
+  Float_t fPheErrLimit;                        // Limit acceptance nr. phe's w.r.t. area idx mean (in sigmas)
+  Float_t fSqrtHiGainSamples;                  // Square root nr. High-Gain FADC slices used by extractor
+  Float_t fSqrtLoGainSamples;                  // Square root nr. Low -Gain FADC slices used by extractor 
+  Float_t fTimeLowerLimit;                     // Limit dist. to first signal slice (in units of FADC slices) 
+  Float_t fTimeUpperLimit;                     // Limit dist. to last signal slice  (in units of FADC slices) 
+  MCalibrationCam::PulserColor_t fPulserColor; // Calibration LEDs colour 
 
-  MExtractedSignalCam        *fSignals;       //! Extracted signal of pixels in the camera
-  MExtractedSignalBlindPixel *fSigBlind;      //! Extracted signal of Blind Pixel
-  MExtractedSignalPINDiode   *fSigPIN;        //! Extracted signal of PIN Diode 
+  // Pointers
+  MBadPixelsCam              *fBadPixels;      //  Bad Pixels 
+  MCalibrationChargeCam      *fCam;            //  Calibrated Charges of all pixels 
+  MCalibrationChargeBlindPix *fBlindPixel;     //  Calibrated Charges of the Blind Pixel 
+  MCalibrationChargePINDiode *fPINDiode;       //  Calibrated Charges of the PIN Diode
+  MCalibrationQECam          *fQECam;          //  Calibrated Quantum Efficiencies of all pixels 
+  MExtractedSignalCam        *fSignals;        //! Extracted signal of all pixels 
+  MExtractedSignalBlindPixel *fSigBlind;       //! Extracted signal of Blind Pixel
+  MExtractedSignalPINDiode   *fSigPIN;         //! Extracted signal of PIN Diode 
+  MGeomCam                   *fGeom;           //! Camera geometry
+  MPedestalCam               *fPedestals;      //! Pedestals all pixels (calculated previously from ped.file)
+  MRawEvtData                *fRawEvt;         //! Raw calibration event data 
+  MRawRunHeader              *fRunHeader;      //! RunHeader information
+  MTime                      *fEvtTime;        //! Time of the event
 
-  MCalibrationChargePINDiode *fPINDiode;      // Calibration results of the PIN Diode
-  MCalibrationChargeBlindPix *fBlindPixel;    // Calibration results of the Blind Pixel 
-
-  Float_t  fNumHiGainSamples; 
-  Float_t  fNumLoGainSamples; 
-  Float_t  fSqrtHiGainSamples;
-  Float_t  fSqrtLoGainSamples; 
-  
-  Float_t fConversionHiLo;
-  Int_t   fFlags;                              // Flag for the fits used
-
+  // enums
   enum  { kUseQualityChecks, kHiLoGainCalibration };
 
-  MCalibrationCam::PulserColor_t fPulserColor;
+  // functions
+  void   FinalizePedestals      ( const MPedestalPix &ped, MCalibrationChargePix &cal,
+                                  Float_t &avped, Float_t &avrms                      );
+  void   FinalizeAvPedestals    ( MCalibrationChargePix &cal, 
+	                          Float_t avped, Float_t avrms, Int_t avnum);
+  Bool_t FinalizeCharges        ( MCalibrationChargePix &cal, MBadPixelsPix &bad      );
+  Bool_t FinalizePINDiode       ();
+  Bool_t FinalizeBlindPixel     ();
+  Bool_t FinalizeFFactorMethod  ();
+  void   FinalizeBadPixels      ();
+  void   FinalizeFFactorQECam   ();  
+  void   FinalizeBlindPixelQECam();
+  void   FinalizePINDiodeQECam  ();
   
-  Int_t  PreProcess(MParList *pList);
-  Bool_t ReInit(MParList *pList); 
-  Int_t  Process();
+  void   PrintUnsuitable  ( MBadPixelsPix::UnsuitableType_t typ  , const char *text) const;   
+  void   PrintUncalibrated( MBadPixelsPix::UncalibratedType_t typ, const char *text) const;
+
+  Int_t  PreProcess (MParList *pList);
+  Bool_t ReInit     (MParList *pList); 
+  Int_t  Process    ();
   Int_t  PostProcess();
-
-  void   FinalizePedestals   ( const MPedestalPix &ped, MCalibrationChargePix &cal,
-                               Float_t &avped, Float_t &avrms);
-  void   FinalizeAvPedestals ( MCalibrationChargePix &cal, Float_t avped, Float_t avrms, Int_t avnum);
-  Bool_t FinalizeCharges     ( MCalibrationChargePix &cal, MBadPixelsPix &bad );
-  Bool_t FinalizePINDiode();
-  Bool_t FinalizeBlindPixel();
-  Bool_t FinalizeFFactorMethod();
-  void   FinalizeBadPixels();
-  void   FinalizeFFactorQECam();  
-  void   FinalizeBlindPixelQECam();
-  void   FinalizePINDiodeQECam();
-  
-  void PrintUnsuitable(MBadPixelsPix::UnsuitableType_t typ, const char *text) const;   
-  void PrintUncalibrated(MBadPixelsPix::UncalibratedType_t typ, const char *text) const;
 
 public:
@@ -116,20 +114,20 @@
   void Clear(const Option_t *o="");
   
-  void SetChargeLimit      ( const Float_t f=fgChargeLimit       ) { fChargeLimit       = f;   }
-  void SetChargeErrLimit   ( const Float_t f=fgChargeErrLimit    ) { fChargeErrLimit    = f;   }
-  void SetChargeRelErrLimit( const Float_t f=fgChargeRelErrLimit ) { fChargeRelErrLimit = f;   }
-  void SetPheErrLimit      ( const Float_t f=fgPheErrLimit       ) { fPheErrLimit       = f;   }  
-  void SetLambdaErrLimit   ( const Float_t f=fgLambdaErrLimit    ) { fLambdaErrLimit    = f;   }
-  void SetLambdaCheckLimit ( const Float_t f=fgLambdaCheckLimit  ) { fLambdaCheckLimit  = f;   }
-  void SetPulserColor      ( MCalibrationCam::PulserColor_t col  ) { fPulserColor       = col; }
-  void SetTimeLowerLimit   ( const Float_t f=fgTimeLowerLimit    ) { fTimeLowerLimit    = f;   }
-  void SetTimeUpperLimit   ( const Float_t f=fgTimeUpperLimit    ) { fTimeUpperLimit    = f;   }
+  void SetChargeLimit       ( const Float_t f=fgChargeLimit            ) { fChargeLimit       = f;   }
+  void SetChargeErrLimit    ( const Float_t f=fgChargeErrLimit         ) { fChargeErrLimit    = f;   }
+  void SetChargeRelErrLimit ( const Float_t f=fgChargeRelErrLimit      ) { fChargeRelErrLimit = f;   }
+  void SetLambdaErrLimit    ( const Float_t f=fgLambdaErrLimit         ) { fLambdaErrLimit    = f;   }
+  void SetLambdaCheckLimit  ( const Float_t f=fgLambdaCheckLimit       ) { fLambdaCheckLimit  = f;   }
+  void SetPheErrLimit       ( const Float_t f=fgPheErrLimit            ) { fPheErrLimit       = f;   }  
+  void SetPulserColor       ( const MCalibrationCam::PulserColor_t col ) { fPulserColor       = col; }
+  void SetTimeLowerLimit    ( const Float_t f=fgTimeLowerLimit         ) { fTimeLowerLimit    = f;   }
+  void SetTimeUpperLimit    ( const Float_t f=fgTimeUpperLimit         ) { fTimeUpperLimit    = f;   }
 
-  void SkipQualityChecks(Bool_t b=kTRUE)
-      {b ? CLRBIT(fFlags, kUseQualityChecks)    : SETBIT(fFlags, kUseQualityChecks);}
-  void SkipHiLoGainCalibration(Bool_t b=kTRUE)
-      {b ? CLRBIT(fFlags, kHiLoGainCalibration) : SETBIT(fFlags, kHiLoGainCalibration);}
+  void SkipHiLoGainCalibration ( const Bool_t b=kTRUE )
+      { b ? CLRBIT(fFlags, kHiLoGainCalibration) : SETBIT(fFlags, kHiLoGainCalibration); }
+  void SkipQualityChecks       ( const Bool_t b=kTRUE)
+      { b ? CLRBIT(fFlags, kUseQualityChecks)    : SETBIT(fFlags, kUseQualityChecks);    }
 
-  ClassDef(MCalibrationChargeCalc, 1)   // Task to fill the Calibration Containers from raw data
+  ClassDef(MCalibrationChargeCalc, 1)   // Task calculating Calibration Containers and Quantum Efficiencies
 };
 
