Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 3854)
+++ trunk/MagicSoft/Mars/Changelog	(revision 3855)
@@ -63,4 +63,6 @@
        was not correct
 
+   * macros/calibration.C
+     - added the test class MJExtractCalibTest
 
  2004/04/27: Abelardo Moralejo
Index: trunk/MagicSoft/Mars/macros/calibration.C
===================================================================
--- trunk/MagicSoft/Mars/macros/calibration.C	(revision 3854)
+++ trunk/MagicSoft/Mars/macros/calibration.C	(revision 3855)
@@ -51,12 +51,16 @@
 //  uncommented as well. 
 // 
+//  Last, a third loop is performed over the calibration file again in order to 
+//  "calibrate" it and test the resulting outcome.
+//
 /////////////////////////////////////////////////////////////////////////////
-const TString inpath = "/home/rootdata/Calib/2004_04_16/";
-const Int_t pedrun  = 22265;
-const Int_t calrun1 = 22299;
-const Int_t calrun2 = 22300;
+static const TString inpath = "/home/rootdata/Calib/2004_04_16/";
+static const Int_t pedrun  = 22265;
+static const Int_t calrun1 = 22300;
+static const Int_t calrun2 = 0;
 
 void calibration(const Int_t prun=pedrun, const Int_t crun1=calrun1, const Int_t crun2=calrun2)
 {
+
   
   MRunIter pruns;
@@ -72,5 +76,6 @@
   MCalibrationQECam qecam;
   MBadPixelsCam     badcam;
-
+  MGeomCamMagic     geomcam;
+  MGeomApply        geomapl;
   //
   // If you want to exclude pixels from the beginning, read 
@@ -95,14 +100,16 @@
     return;
 
-  //
-  // Now setup the tasks and for the calibration:
-  // ---------------------------------------------------
-  //
+  /****************************************/
+  /* SECOND LOOP: CALIBRATION COMPUTATION */
+  /****************************************/
+
   MJCalibration calloop;
-  //  calloop.SetColor(color);
 
   //
   // If you want to run the data-check on RAW DATA!!!, choose:
   // calloop.SetDataCheck();
+  // 
+  // If you want to see the data-check plots only, choose:
+  // calloop.SetDataCheckDisplay();
   // 
   // For everything, you ever dreamed of, choose:
@@ -119,5 +126,19 @@
   if (!calloop.Process(pedloop.GetPedestalCam()))
     return;
-  
+
+
+  /********************************************************************/
+  /* THIRD LOOP: APPLY CALIBRATION TO THE CALIBRATION FILES FOR TESTS */
+  /********************************************************************/
+
+  MJExtractCalibTest testloop;
+
+  testloop.SetInput(&cruns);
+  testloop.SetDisplay(display);
+  testloop.SetBadPixels(calloop.GetBadPixels());
+  if (!testloop.ProcessD(pedloop.GetPedestalCam(),calloop.GetCalibrationCam(),calloop.GetQECam()))
+    return;
+
+
 }
 
Index: trunk/MagicSoft/Mars/mcalib/MHCalibrationTestCam.cc
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MHCalibrationTestCam.cc	(revision 3854)
+++ trunk/MagicSoft/Mars/mcalib/MHCalibrationTestCam.cc	(revision 3855)
@@ -453,4 +453,12 @@
 // 6: Fourier spectrum not OK                       (calls: MHGausEvents::IsFourierSpectrumOK())
 //
+// Converted values:
+// =================
+//
+// 7: Fitted Mean Test Calibration (MHGausEvents::GetMean()) by MGeomPix::GetA()
+// 8: Fitted Mean Error Calibration (MHGausEvents::GetSigma()) by MGeomPix::GetA()
+// 9: Fitted Sigma Test Calibration (MHGausEvents::GetMean()) by MGeomPix::GetA()
+// 8: Fitted Sigma Error Calibration (MHGausEvents::GetSigma()) by MGeomPix::GetA()
+//
 Bool_t MHCalibrationTestCam::GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type) const
 {
@@ -488,4 +496,16 @@
       if (!pix.IsFourierSpectrumOK())
         val = 1.;
+      break;
+    case 7:
+      val = pix.GetMean()/cam[idx].GetA();
+      break;
+    case 8:
+      val = pix.GetMeanErr()/cam[idx].GetA();
+      break;
+    case 9:
+      val = pix.GetSigma()/cam[idx].GetA();
+      break;
+    case 10:
+      val = pix.GetSigmaErr()/cam[idx].GetA();
       break;
     default:
Index: trunk/MagicSoft/Mars/mjobs/JobsLinkDef.h
===================================================================
--- trunk/MagicSoft/Mars/mjobs/JobsLinkDef.h	(revision 3854)
+++ trunk/MagicSoft/Mars/mjobs/JobsLinkDef.h	(revision 3855)
@@ -8,4 +8,5 @@
 #pragma link C++ class MJCalibration+;
 #pragma link C++ class MJExtractSignal+;
+#pragma link C++ class MJExtractCalibTest+;
 
 #pragma link C++ class MGCamDisplays+;
