Index: /trunk/MagicSoft/Mars/Changelog
===================================================================
--- /trunk/MagicSoft/Mars/Changelog	(revision 2717)
+++ /trunk/MagicSoft/Mars/Changelog	(revision 2718)
@@ -4,5 +4,5 @@
 
                                                  -*-*- END OF LINE -*-*-
- 2003/12/18: Markus Gaug
+ 2003/12/18: Markus Gaug, Michele Doro
 
    * manalysis/MExtractSignal.[h,cc]
@@ -19,4 +19,8 @@
    * macros/calibration.C
      - display now the errors in the F-Factor method correctly	
+
+   * mhist/MHCalibrationPixel.[h,cc]
+     - before declaring a calibration factor as valid, check if the 
+       mean fitted arrival time is not in the first or last time bin
 
  2003/12/18: Abelardo Moralejo
Index: /trunk/MagicSoft/Mars/mhist/MHCalibrationPixel.cc
===================================================================
--- /trunk/MagicSoft/Mars/mhist/MHCalibrationPixel.cc	(revision 2717)
+++ /trunk/MagicSoft/Mars/mhist/MHCalibrationPixel.cc	(revision 2718)
@@ -86,4 +86,8 @@
         fTimeProb(-1.),
         fTimeNdf(-1),
+        fTimeMean(-1.),
+        fTimeSigma(-1.),
+        fTimeLowerFitRange(3.),
+        fTimeUpperFitRange(9.),
 	fUseLoGain(kFALSE),
 	fOffset(0.),
@@ -586,6 +590,6 @@
     return kFALSE;
 
-  rmin = (rmin != 0.) ? rmin : 3.;
-  rmax = (rmax != 0.) ? rmax : 9.;
+  rmin = (rmin != 0.) ? rmin : fTimeLowerFitRange;
+  rmax = (rmax != 0.) ? rmax : fTimeUpperFitRange;
 
   const Stat_t entries       = fHTimeHiGain->Integral();
@@ -642,6 +646,6 @@
     return kFALSE;
 
-  rmin = (rmin != 0.) ? rmin : 3.;
-  rmax = (rmax != 0.) ? rmax : 9.;
+  rmin = (rmin != 0.) ? rmin : fTimeLowerFitRange;
+  rmax = (rmax != 0.) ? rmax : fTimeUpperFitRange;
 
   const Stat_t   entries     = fHTimeLoGain->Integral();
@@ -751,9 +755,10 @@
   //
   // The fit result is accepted under condition
-  // The Probability is greater than gkProbLimit (default 0.01 == 99%)
+  // The Probability is greater than gkProbLimit (default 0.001 == 99.9%)
   //
   if (fChargeProb < gkProbLimit) 
     {
-      *fLog << warn << "Prob: " << fChargeProb << " is smaller than the allowed value: " << gkProbLimit << endl;
+      *fLog << warn << "Prob: " << fChargeProb 
+            << " is smaller than the allowed value: " << gkProbLimit << endl;
       fFitOK = kFALSE;
       return kFALSE;
@@ -761,5 +766,4 @@
   
   fFitOK = kTRUE;
-    
   return kTRUE;
 }
Index: /trunk/MagicSoft/Mars/mhist/MHCalibrationPixel.h
===================================================================
--- /trunk/MagicSoft/Mars/mhist/MHCalibrationPixel.h	(revision 2717)
+++ /trunk/MagicSoft/Mars/mhist/MHCalibrationPixel.h	(revision 2718)
@@ -85,4 +85,7 @@
   Double_t fTimeSigma;
 
+  Stat_t   fTimeLowerFitRange;
+  Stat_t   fTimeUpperFitRange;
+  
   Bool_t fUseLoGain;
 
@@ -133,4 +136,7 @@
   const Double_t GetTimeSigma()       const { return fTimeSigma; }
 
+  const Stat_t   GetTimeLowerFitRange()  const { return fTimeLowerFitRange;  }
+  const Stat_t   GetTimeUpperFitRange()  const { return fTimeUpperFitRange;  }
+  
   const Double_t GetTimeChiSquare()   const { return fTimeChisquare; }
   const Double_t GetTimeProb()        const { return fTimeProb;      }
