Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 4398)
+++ trunk/MagicSoft/Mars/Changelog	(revision 4399)
@@ -25,4 +25,14 @@
   * msignal/MExtractFixedWindowSpline.cc
     - replace the delete's by delete [].
+
+  * mcalib/MHCalibrationChargeCam.cc
+    - remove some obsolete commented code
+
+  * mcalib/MHCalibrationChargeBlindPix.[h,cc]
+    - derive only from MHGausEvents and not additionally from 
+      MHCalibrationChargePix
+    - Additional setter for MCalibrationChargeBlindPix, used by 
+      MHCalibrationChargeBlindCam
+    - Getter for fSinglePheCut
 
 
Index: trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeBlindPix.cc
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeBlindPix.cc	(revision 4398)
+++ trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeBlindPix.cc	(revision 4399)
@@ -102,5 +102,5 @@
 const Axis_t   MHCalibrationChargeBlindPix::fgChargeFirst        = -0.5;
 const Axis_t   MHCalibrationChargeBlindPix::fgChargeLast         = 255.5;
-const Float_t  MHCalibrationChargeBlindPix::fgSinglePheCut       =  60.;
+const Float_t  MHCalibrationChargeBlindPix::fgSinglePheCut       =  30.;
 const Float_t  MHCalibrationChargeBlindPix::fgNumSinglePheLimit  =  50.;
 // --------------------------------------------------------------------------
@@ -236,6 +236,6 @@
   if (fFitLegend)
   {
-      delete fFitLegend;
-      fFitLegend = NULL;
+    delete fFitLegend;
+    fFitLegend = NULL;
   }
 
@@ -259,6 +259,14 @@
 
 
-  MHCalibrationChargePix::Clear();
+  MHGausEvents::Clear();
   return;
+}
+
+// --------------------------------------------------------------------------
+//
+// Empty function to overload MHGausEvents::Reset()
+//
+void MHCalibrationChargeBlindPix::Reset()
+{
 }
 
@@ -329,31 +337,31 @@
 // - MExtractedSignalBlindPixel
 // 
+Bool_t MHCalibrationChargeBlindPix::SetupFill(const MParList *pList) 
+{
+
+  fRawEvt = (MRawEvtData*)pList->FindObject("MRawEvtData");
+  if (!fRawEvt)
+    {
+      *fLog << err << "MRawEvtData not found... aborting." << endl;
+      return kFALSE;
+    }
+  
+  fSignal  = (MExtractedSignalBlindPixel*)pList->FindObject("MExtractedSignalBlindPixel");
+  if (!fSignal)
+    {
+      *fLog << err << "MExtractedSignalBlindPixel not found... aborting " << endl;
+      return kFALSE;
+    }
+  
+  return kTRUE;
+}
+
+// --------------------------------------------------------------------------
+//
+// Gets or creates the pointers to:
+// - MCalibrationChargeBlindPix
+//
 // Calls:
 // - MHGausHist::InitBins()
-//
-Bool_t MHCalibrationChargeBlindPix::SetupFill(const MParList *pList) 
-{
-
-  fRawEvt = (MRawEvtData*)pList->FindObject("MRawEvtData");
-  if (!fRawEvt)
-    {
-      *fLog << err << "MRawEvtData not found... aborting." << endl;
-      return kFALSE;
-    }
-  
-  fSignal  = (MExtractedSignalBlindPixel*)pList->FindObject("MExtractedSignalBlindPixel");
-  if (!fSignal)
-    {
-      *fLog << err << "MExtractedSignalBlindPixel not found... aborting " << endl;
-      return kFALSE;
-    }
-  
-  return kTRUE;
-}
-
-// --------------------------------------------------------------------------
-//
-// Gets or creates the pointers to:
-// - MCalibrationChargeBlindPix
 //
 Bool_t MHCalibrationChargeBlindPix::ReInit(MParList *pList)
@@ -364,14 +372,6 @@
       return kFALSE;
 
-  /*
-  fExtractor  = (MExtractBlindPixel*)pList->FindObject("MExtractBlindPixel");
-  if (!fExtractor)
-    {
-      *fLog << err << "MExtractBlindPixel not found... aborting " << endl;
-      return kFALSE;
-    }
-  
   const Int_t samples = fSignal->GetNumFADCSamples();
-  const Int_t integ   = fExtractor->IsExtractionType( MExtractBlindPixel::kIntegral );
+  const Int_t integ   = fSignal->IsExtractionType( MExtractBlindPixel::kIntegral );
 
   //
@@ -380,9 +380,8 @@
   if ( fLast < samples*integ*fgChargeLast )
     {
-      SetLast        ( samples * 256. - 0.5     );
+      SetLast        ( samples * (fgChargeLast+0.5) - 0.5 );
       SetSinglePheCut( samples * fgSinglePheCut );
     }
-  */
-  SetLast        ( 20.     * 256. - 0.5     );
+
   MHGausEvents::InitBins();
   
@@ -411,5 +410,6 @@
 {
 
-  const Int_t samples = (Int_t)fRawEvt->GetNumHiGainSamples()+(Int_t)fRawEvt->GetNumLoGainSamples();
+  const Int_t samples = (Int_t)fRawEvt->GetNumHiGainSamples()
+                      +(Int_t)fRawEvt->GetNumLoGainSamples();
 
   if (!fASinglePheFADCSlices.IsValid())
@@ -429,5 +429,7 @@
   if (slices == 0.)
     {
-      *fLog << err << "Number of used signal slices in MExtractedSignalBlindPix is zero  ... abort." 
+      *fLog << err 
+	    << "Number of used signal slices in MExtractedSignalBlindPix "
+	    << "is zero  ... abort." 
             << endl;
       return kFALSE;
@@ -438,6 +440,7 @@
   //
   const Float_t signal = fSignal->GetExtractedSignal(fPixId);
+
   if (signal > -0.5)
-    FillHistAndArray(signal);
+    FillHist(signal);
   else
     return kTRUE;
@@ -475,10 +478,8 @@
   if (IsEmpty())
   {
-      *fLog << err << GetDescriptor() << ": My histogram has not been filled !! " << endl;
+    *fLog << err << GetDescriptor() << " ID: " << fPixId 
+	  << " My histogram has not been filled !! " << endl;
       return kFALSE;
   }
-
-  CreateFourierSpectrum();
-  fBlindPix->SetOscillating  ( !IsFourierSpectrumOK() );
 
   fBlindPix->SetValid(kTRUE);
@@ -1024,6 +1025,7 @@
 // The following options can be chosen:
 //
-// "": displays the fHGausHist, the legend and fASinglePheFADCSlices and fAPedestalFADCSlices
+// "": displays the fHGausHist, the fits, the legend and fASinglePheFADCSlices and fAPedestalFADCSlices
 // "all": executes additionally MHGausEvents::Draw(), with option "fourierevents"
+// "datacheck" display the fHGausHist, the fits and the legend
 //
 void MHCalibrationChargeBlindPix::Draw(Option_t *opt) 
@@ -1038,6 +1040,4 @@
   TVirtualPad *pad    = NULL;
 
-  oldpad->SetBorderMode(0);
-    
   if (option.Contains("all"))
   {
@@ -1051,4 +1051,10 @@
       pad->cd(1);
   }
+  else if (option.Contains("datacheck"))
+    {
+      pad = oldpad;
+      pad->Divide(2,1);
+      pad->cd(1);
+    }
   else
   {
@@ -1080,7 +1086,9 @@
   }
 
-
   pad->cd(2);
   DrawLegend();
+
+  if (option.Contains("datacheck"))
+    return;
 
   pad->cd(3);
Index: trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeBlindPix.h
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeBlindPix.h	(revision 4398)
+++ trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeBlindPix.h	(revision 4399)
@@ -24,5 +24,5 @@
 class MExtractBlindPixel;
 class MExtractedSignalBlindPixel;
-class MHCalibrationChargeBlindPix : public MHCalibrationChargePix
+class MHCalibrationChargeBlindPix : public MHGausEvents
 {
 private:
@@ -43,5 +43,4 @@
   MCalibrationChargeBlindPix *fBlindPix;     //! Storage container results  
   MExtractedSignalBlindPixel *fSignal;       //! Storage container extracted signal
-  MExtractBlindPixel         *fExtractor;    //! Extractor blind pixel
   MRawEvtData                *fRawEvt;       //! Storage container raw data
  
@@ -75,5 +74,5 @@
 				     
   Byte_t    fFlags;                          // Bit-field for the flags
-  enum { kSinglePheFitOK, kPedestalFitOK };    // Possible bits to be set
+  enum { kSinglePheFitOK, kPedestalFitOK };  // Possible bits to be set
 
   TPaveText *fFitLegend;                     //! Some legend to display the fit results
@@ -95,4 +94,5 @@
 
   void Clear(Option_t *o="");  
+  void Reset();
   
 //  TObject *Clone(const char *) const;
@@ -110,5 +110,4 @@
   const Double_t GetSigma0        ()  const { return fSigma0;         }
   const Double_t GetSigma1        ()  const { return fSigma1;         }
-							 
   const Double_t GetLambdaErr     ()  const { return fLambdaErr;      }
   const Double_t GetLambdaCheckErr()  const { return fLambdaCheckErr; }
@@ -117,5 +116,6 @@
   const Double_t GetSigma0Err     ()  const { return fSigma0Err;      }
   const Double_t GetSigma1Err     ()  const { return fSigma1Err;      }
-
+  const Float_t  GetSinglePheCut  ()  const { return fSinglePheCut;   }
+ 
   TVector &GetASinglePheFADCSlices()             { return fASinglePheFADCSlices;  }
   const TVector &GetASinglePheFADCSlices() const { return fASinglePheFADCSlices;  }
@@ -128,6 +128,7 @@
   
   // Setters
-  void SetSinglePheCut      ( const Float_t cut =fgSinglePheCut      )    { fSinglePheCut      = cut;      }
-  void SetNumSinglePheLimit ( const Float_t lim =fgNumSinglePheLimit )    { fNumSinglePheLimit = lim;      }
+  void SetCalibrationChargeBlindPix ( MCalibrationChargeBlindPix *pix)    { fBlindPix          = pix;  }
+  void SetSinglePheCut      ( const Float_t cut =fgSinglePheCut      )    { fSinglePheCut      = cut;  }
+  void SetNumSinglePheLimit ( const Float_t lim =fgNumSinglePheLimit )    { fNumSinglePheLimit = lim;  }
 
   void SetMeanPedestal      ( const Float_t f )   { fMeanPedestal     = f;  }
Index: trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeCam.cc
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeCam.cc	(revision 4398)
+++ trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeCam.cc	(revision 4399)
@@ -865,4 +865,7 @@
     }
 
+  // 
+  // From here on , the datacheck - Draw
+  //
   TVirtualPad *pad = gPad ? gPad : MH::MakeDefCanvas(this);  
   pad->SetBorderMode(0);
@@ -924,23 +927,11 @@
 
   for (int i=0; i<navhi; i++)
-    {
-      //      delete (*cam->fAverageHiGainAreas)[i];
-      (*cam->fAverageHiGainAreas)[i] = (*fAverageHiGainAreas)[i]->Clone();
-    }
+    (*cam->fAverageHiGainAreas)[i] = (*fAverageHiGainAreas)[i]->Clone();
   for (int i=0; i<navlo; i++)
-    {
-      //      delete (*cam->fAverageLoGainAreas)[i];
-      (*cam->fAverageLoGainAreas)[i] = (*fAverageLoGainAreas)[i]->Clone();
-    }
+    (*cam->fAverageLoGainAreas)[i] = (*fAverageLoGainAreas)[i]->Clone();
   for (int i=0; i<nsehi; i++)
-    {
-      //      delete (*cam->fAverageHiGainSectors)[i];
-      (*cam->fAverageHiGainSectors)[i] = (*fAverageHiGainSectors)[i]->Clone();
-    }
+    (*cam->fAverageHiGainSectors)[i] = (*fAverageHiGainSectors)[i]->Clone();
   for (int i=0; i<nselo; i++)
-    {
-      //      delete (*cam->fAverageLoGainSectors)[i];
-      (*cam->fAverageLoGainSectors)[i] = (*fAverageLoGainSectors)[i]->Clone();
-    }
+    (*cam->fAverageLoGainSectors)[i] = (*fAverageLoGainSectors)[i]->Clone();
 
   cam->fAverageAreaNum         = fAverageAreaNum;
Index: trunk/MagicSoft/Mars/mcalib/MHGausEvents.cc
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MHGausEvents.cc	(revision 4398)
+++ trunk/MagicSoft/Mars/mcalib/MHGausEvents.cc	(revision 4399)
@@ -529,5 +529,4 @@
     }
   
-  pad->SetTicks();
   pad->SetBorderMode(0);
   pad->Divide(1,win);
@@ -536,4 +535,6 @@
   if (!IsEmpty())
     gPad->SetLogy();
+
+  gPad->SetTicks();
 
   fHGausHist.Draw(opt);
Index: trunk/MagicSoft/Mars/msignal/MExtractBlindPixel.cc
===================================================================
--- trunk/MagicSoft/Mars/msignal/MExtractBlindPixel.cc	(revision 4398)
+++ trunk/MagicSoft/Mars/msignal/MExtractBlindPixel.cc	(revision 4399)
@@ -79,5 +79,5 @@
 const Byte_t  MExtractBlindPixel::fgLast             =   7;
 const Byte_t  MExtractBlindPixel::fgHiGainFirst      =  10;
-const Byte_t  MExtractBlindPixel::fgHiGainLast       =  29;
+const Byte_t  MExtractBlindPixel::fgHiGainLast       =  19;
 const Byte_t  MExtractBlindPixel::fgLoGainFirst      =   0;
 const Byte_t  MExtractBlindPixel::fgLoGainLast       =   7;
@@ -649,4 +649,5 @@
         }
     }
+
 }
 
