Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 2888)
+++ trunk/MagicSoft/Mars/Changelog	(revision 2889)
@@ -4,4 +4,14 @@
 
                                                  -*-*- END OF LINE -*-*-
+
+ 2004/01/23: Abelardo Moralejo
+
+   * manalysis/MMcCalibrationUpdate.[h,cc] 
+     - Added check to guarantee that the FADC simulation parameters of
+       all read files (those used for calibration and those analyzed) 
+       are the same.
+
+   * mcalib/MMcCalibrationCalc.cc
+     - Removed obsolete FIXME comment.
 
  2004/01/23: Raquel de los Reyes
Index: trunk/MagicSoft/Mars/manalysis/MMcCalibrationUpdate.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MMcCalibrationUpdate.cc	(revision 2888)
+++ trunk/MagicSoft/Mars/manalysis/MMcCalibrationUpdate.cc	(revision 2889)
@@ -74,4 +74,8 @@
     fADC2PhOuter = 1.;
 
+    fAmplitude = -1.;
+    fAmplitudeOuter = -1.;
+    fConversionHiLo = -1.;
+
     fFillCalibrationCam = kTRUE;
 
@@ -178,4 +182,24 @@
 
     //
+    // Initialize Fadc simulation parameters:
+    //
+    if ( fAmplitude < 0. )
+      {
+	fAmplitude = fHeaderFadc->GetAmplitud();
+	fAmplitudeOuter = fHeaderFadc->GetAmplitudOuter();
+	fConversionHiLo = fHeaderFadc->GetLow2HighGain();
+      }
+    else   // Check that following files have all the same FADC parameters
+      {
+	if ( fabs(fHeaderFadc->GetAmplitud()-fAmplitude) > 1.e-6  ||
+	     fabs(fHeaderFadc->GetAmplitudOuter()-fAmplitudeOuter) > 1.e-6  ||
+	     fabs(fConversionHiLo-fHeaderFadc->GetLow2HighGain()) > 1.e-6 )
+	  {
+	    *fLog << err << endl << endl << dbginf << "Parameters of MMcFadcHeader are not the same for all the read files. Aborting..." << endl << endl;
+	    return kFALSE;
+	  }
+      }
+
+    //
     // If MCalibrationCam already existed in the parameter list before
     // MMcCalibrationUpdate::PreProcess was executed (from a 
@@ -189,11 +213,5 @@
     // Set the ADC to photons conversion factor for outer pixels:
     //
-    fADC2PhOuter = fADC2PhInner *
-      (fHeaderFadc->GetAmplitud() / fHeaderFadc->GetAmplitudOuter());
-
-    //
-    // Set the conversion factor between high and low gain:
-    //
-    fConversionHiLo = fHeaderFadc->GetLow2HighGain();
+    fADC2PhOuter = fADC2PhInner * (fAmplitude / fAmplitudeOuter);
 
     const int num = fCalCam->GetSize();
Index: trunk/MagicSoft/Mars/manalysis/MMcCalibrationUpdate.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MMcCalibrationUpdate.h	(revision 2888)
+++ trunk/MagicSoft/Mars/manalysis/MMcCalibrationUpdate.h	(revision 2889)
@@ -28,7 +28,11 @@
     Float_t fADC2PhInner; // Conversion factor from ADC counts to photons
     Float_t fADC2PhOuter; // for inner and outer pixels.
-    Float_t fConversionHiLo;
 
     Bool_t  fFillCalibrationCam;
+
+    Float_t fAmplitude;      // FADC parameters from camera simulation (see camera manual)
+    Float_t fAmplitudeOuter; // to be read from the MMcFadcHeader.
+    Float_t fConversionHiLo; // Ratio of high to low gain.
+
 
 public:
Index: trunk/MagicSoft/Mars/mcalib/MMcCalibrationCalc.cc
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MMcCalibrationCalc.cc	(revision 2888)
+++ trunk/MagicSoft/Mars/mcalib/MMcCalibrationCalc.cc	(revision 2889)
@@ -176,9 +176,4 @@
     }
 
-  //
-  // FIXME: Check that the relevant parameters in the FADC header are the
-  // same for all the analyzed data, both Calibration and Analyzed data!
-  //
-
   return kTRUE;
 }
