Index: /trunk/MagicSoft/Mars/Changelog
===================================================================
--- /trunk/MagicSoft/Mars/Changelog	(revision 2971)
+++ /trunk/MagicSoft/Mars/Changelog	(revision 2972)
@@ -21,4 +21,6 @@
      - fill Blind Pixel with information about its fitted pedestal if 
        available
+     - initialize charges histogram with a bigger range
+     - use pedestal information to constrain the pedestal fit ranges
 
 
Index: /trunk/MagicSoft/Mars/mcalib/MCalibrationCalc.cc
===================================================================
--- /trunk/MagicSoft/Mars/mcalib/MCalibrationCalc.cc	(revision 2971)
+++ /trunk/MagicSoft/Mars/mcalib/MCalibrationCalc.cc	(revision 2972)
@@ -114,4 +114,7 @@
 using namespace std;
 
+const Int_t MCalibrationCalc::fBlindPixelId = 559;
+const Int_t MCalibrationCalc::fPINDiodeId   = 9999;
+
 // --------------------------------------------------------------------------
 //
@@ -121,5 +124,4 @@
     : fPedestals(NULL), fCalibrations(NULL), fSignals(NULL),
       fRawEvt(NULL), fRunHeader(NULL), fArrivalTime(NULL), fEvtTime(NULL)
-  //      fBlindPixelId(559), fPINDiodeId(9999)
 {
 
@@ -461,5 +463,5 @@
         {
           
-        case kBlindPixelId:
+        case fBlindPixelId:
           
           if (!blindpixel.FillCharge(sumhi)) 
@@ -479,5 +481,5 @@
           break;
           
-        case kPINDiodeId:
+        case fPINDiodeId:
 
           if (!pindiode.FillCharge(sumhi)) 
@@ -583,4 +585,33 @@
       *fLog << inf << GetDescriptor() << ": Fitting the Blind Pixel" << endl;
 
+      //
+      // retrieve mean and sigma of the blind pixel pedestal, 
+      // so that we can use it for the fit
+      //
+      if (fPedestals->IsUseHists())
+        {
+          //
+          // retrieve the pedestal pix of the blind pixel
+          //
+          MPedestalPix &ped = (*fPedestals)[fBlindPixelId];
+          //
+          // retrieve the blind pixel histogram container
+          //
+          MHCalibrationBlindPixel *hist = blindpixel.GetHist();
+          //
+          // Set the corresponding values
+          //
+          const Float_t peddiff     = ped.GetMean() 
+                                    - ped.GetPedestal()*fSignals->GetNumUsedFADCSlices();
+          const Float_t pederr      = ped.GetMeanErr();
+          const Float_t pedsigma    = ped.GetSigma();
+          const Float_t pedsigmaerr = ped.GetSigmaErr();
+          
+          hist->SetMeanPedestal(peddiff);
+          hist->SetMeanPedestalErr(pederr);
+          hist->SetSigmaPedestal(pedsigma);
+          hist->SetSigmaPedestalErr(pedsigmaerr);
+        }
+      
       if (!blindpixel.FitCharge())
         {
Index: /trunk/MagicSoft/Mars/mcalib/MHCalibrationBlindPixel.h
===================================================================
--- /trunk/MagicSoft/Mars/mcalib/MHCalibrationBlindPixel.h	(revision 2971)
+++ /trunk/MagicSoft/Mars/mcalib/MHCalibrationBlindPixel.h	(revision 2972)
@@ -64,4 +64,9 @@
   Double_t  fLambdaCheckErr;
 
+  Double_t  fMeanPedestal;
+  Double_t  fMeanPedestalErr;
+  Double_t  fSigmaPedestal;
+  Double_t  fSigmaPedestalErr;
+  
 public:
 
@@ -76,6 +81,11 @@
   Bool_t FillBlindPixelChargevsN(Stat_t rq, Int_t t);
   
-
-  //Getters
+  // Setters
+  void SetMeanPedestal(const Float_t f)      { fMeanPedestal = f;     }
+  void SetMeanPedestalErr(const Float_t f)   { fMeanPedestalErr = f;  }
+  void SetSigmaPedestal(const Float_t f)     { fSigmaPedestal = f;    }
+  void SetSigmaPedestalErr(const Float_t f)  { fSigmaPedestalErr = f; }
+  
+  // Getters
   const Double_t GetLambda()         const { return fLambda;         }
   const Double_t GetLambdaCheck()    const { return fLambdaCheck;    }
@@ -224,5 +234,4 @@
       Double_t arg = 0.;
       
-      //      Double_t mu0 = 0.;
       Double_t mu0 = par[1];
       Double_t mu1 = par[2];
