Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 3724)
+++ trunk/MagicSoft/Mars/Changelog	(revision 3725)
@@ -51,6 +51,10 @@
        Don't know why. Removed and stored some variables instead
 
-   * mjobs/MJCalibration.cc
+   * mjobs/MJCalibration.[h,cc]
      - updated documentation, updated QE Cam
+     - set the pulser colour (now obligatory)
+
+   * mcalib/MCalibrationChargeCalc.cc
+     - set the pulser colour (now obligatory)
 
 
Index: trunk/MagicSoft/Mars/macros/calibration.C
===================================================================
--- trunk/MagicSoft/Mars/macros/calibration.C	(revision 3724)
+++ trunk/MagicSoft/Mars/macros/calibration.C	(revision 3725)
@@ -22,8 +22,9 @@
 !
 \* ======================================================================== */
-#include "MAGIC.h"
 
 void calibration()
 {
+  
+  const MCalibrationCam::PulserColor_t color = MCalibrationCam::kGREEN;
 
   //  const TString inpath = "/mnt/Data/rootdata/CrabNebula/2004_01_27/";
@@ -41,15 +42,20 @@
   gStyle->SetOptFit();
   
+  MCalibrationQECam qecam;
+  MBadPixelsCam     badcam;
+  badcam.AsciiRead("badpixels.dat");
+
+  for (Int_t i=0;i<badcam.GetSize();i++)
+    if (badcam[i].IsBad())
+      cout << "Bad Pixel: " << i << endl;
+
   MStatusDisplay *display = new MStatusDisplay;
   display->SetUpdateTime(3000);
   display->Resize(850,700);
   
-  MBadPixelsCam badcam;
-  badcam.AsciiRead("badpixels.dat");
-
   /************************************/
   /* FIRST LOOP: PEDESTAL COMPUTATION */
   /************************************/
-  
+
   MJPedestal pedloop;
   pedloop.SetInput(&pruns);
@@ -76,66 +82,17 @@
   static_cast<MRead&>(read).AddFiles(pruns);
 
-  MGeomApply      geomapl;
-  MExtractSignal  sigcalc;
-  
-  //
-  // Additionally to calculating the pedestals, 
-  // you can fill histograms and look at them
-  //
-  MFillH fill("MHPedestalCam", "MExtractedSignalCam");
-  
-  tlist0.AddToList(&read);
-  tlist0.AddToList(&geomapl);
-  tlist0.AddToList(&sigcalc);
-  tlist0.AddToList(&fill);
-  
-  MGeomCamMagic  geomcam;
-  MHPedestalCam  hpedcam;
-  plist0.AddToList(&geomcam);
-  plist0.AddToList(&pedloop.GetPedestalCam());
-  plist0.AddToList(&badcam);
-  plist0.AddToList(&hpedcam);
-  
-  //
-  // Create and setup the eventloop
-  //
-  MEvtLoop evtloop0;
-  
-  evtloop0.SetParList(&plist0);
-  evtloop0.SetDisplay(display);
-  
-  //
-  // Execute first analysis
-  //
-  if (!evtloop0.Eventloop())
-    return;
-
-  tlist0.PrintStatistics();
-
-  for (Int_t aidx=0;aidx<2;aidx++)
-    {
-      hpedcam.GetAverageHiGainArea(aidx).DrawClone("fourierevents");
-      hpedcam.GetAverageLoGainArea(aidx).DrawClone("fourierevents");
-    }
-  
-  for (Int_t sector=1;sector<7;sector++)
-    {
-      hpedcam.GetAverageHiGainSector(sector).DrawClone("fourierevents");
-      hpedcam.GetAverageLoGainSector(sector).DrawClone("fourierevents");
-    }
-  
-
   // 
   // Now the short version: 
   //
-  /*
   MJCalibration calloop;
+  calloop.SetColor(color);
   calloop.SetInput(&cruns);
   calloop.SetDisplay(display);
-  calloop.SetBadPixels(pedloop.GetBadPixelsCam());
+  calloop.SetQECam(qecam);
+  calloop.SetBadPixels(pedloop.GetBadPixels());
   if (!calloop.Process(pedloop.GetPedestalCam()))
     return;
-    #if 0
-  */
+
+#if 0
   // 
   // The longer version:
@@ -163,4 +120,5 @@
   MArrivalTimeCam            timecam;
   MCalibrationRelTimeCam     relcam;
+  MCalibrationQECam          qecam;
   MCalibrationChargeCam      calcam;
   MCalibrationChargePINDiode pindiode;   
@@ -174,10 +132,4 @@
   histblind.SetSinglePheCut(600);
   //
-  // As long, as we don't have digital modules,
-  // we have to set the color of the pulser LED by hand
-  //
-  blindpix.SetColor(kCT1);
-  //    pindiode.SetColor(kCT1);
-  //
   // Get the previously created MPedestalCam into the new Parameter List 
   //
@@ -186,4 +138,5 @@
   plist.AddToList(&timecam);
   plist.AddToList(&relcam);
+  plist.AddToList(&qecam);
   plist.AddToList(&calcam);
   plist.AddToList(&histtime);
@@ -210,4 +163,10 @@
   MFillH fillblind("MHCalibrationChargeBlindPix", "MExtractedSignalBlindPixel");
   MFillH fillcam  ("MHCalibrationChargeCam"     , "MExtractedSignalCam");
+  
+  //
+  // As long, as we don't have digital modules,
+  // we have to set the color of the pulser LED by hand
+  //
+  calcalc.SetPulserColor(MCalibrationCam::kCT1);
   
   //
@@ -300,6 +259,6 @@
   MHCamera disp7  (geomcam, "Cal;FFactorConv",          "Conversion Factor to photons (F-Factor Method)");
   MHCamera disp8  (geomcam, "Cal;FFactorFFactor",       "Total F-Factor (F-Factor Method)");
-  MHCamera disp9  (geomcam, "Cal;BlindPixConv",         "Conversion Factor to photons (Blind Pixel Method)");
-  MHCamera disp10 (geomcam, "Cal;BlindPixFFactor",      "Total F-Factor (Blind Pixel Method)");
+  MHCamera disp9  (geomcam, "Cal;CascadesQEFFactor",    "Av. Quantum Efficiency (F-Factor Method)");
+  MHCamera disp10 (geomcam, "Cal;QEFFactor",            "Measured QE (F-Factor Method)");
   MHCamera disp11 (geomcam, "Cal;PINDiodeConv",         "Conversion Factor tp photons (PIN Diode Method)");
   MHCamera disp12 (geomcam, "Cal;PINDiodeFFactor",      "Total F-Factor (PIN Diode Method)");
@@ -351,9 +310,9 @@
   disp8.SetCamError(  calcam, 14);
   
-  // Blind Pixel Method
-  disp9.SetCamContent(calcam, 16);
-  disp9.SetCamError(  calcam, 17);
-  disp10.SetCamContent(calcam,18);
-  disp10.SetCamError(  calcam,19);
+  // Quantum efficiency
+  disp9.SetCamContent( qecam, 0 );
+  disp9.SetCamError(   qecam, 1 );
+  disp10.SetCamContent(qecam, 8);
+  disp10.SetCamError(  qecam, 9);
   
   // PIN Diode Method
@@ -411,6 +370,6 @@
   disp8.SetYTitle("\\sqrt{N_{Ph}}*\\sigma_{Charge}/\\mu_{Charge} [1] ");
   
-  disp9.SetYTitle("Conversion Factor [Phot/FADC Count]");
-  disp10.SetYTitle("\\sqrt{N_{Ph}}*\\sigma_{Charge}/\\mu_{Charge} [1]");
+  disp9.SetYTitle("Average QE Cascades [1]");
+  disp10.SetYTitle("Measured QE (F-Factor Method) [1]");
   
   disp11.SetYTitle("Conversion Factor [Phot/FADC Count]");
@@ -475,6 +434,6 @@
   
 
-  // Blind Pixel Method
-  TCanvas &c5 = display->AddTab("BlindPix");
+  // Quantum Efficiencies
+  TCanvas &c5 = display->AddTab("QE");
   c5.Divide(2, 4);
   
Index: trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc	(revision 3724)
+++ trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc	(revision 3725)
@@ -272,5 +272,5 @@
   SetLambdaErrLimit();
   SetPheErrLimit();
-  SetPulserColor(MCalibrationCam::kCT1);
+  SetPulserColor(MCalibrationCam::kNONE);
 
   Clear();
@@ -342,4 +342,17 @@
   
   fEvtTime = (MTime*)pList->FindObject("MTime");
+
+  //
+  // Check the pulser colour --> FIXME: this solution is only valid until the arrival of the DM's
+  //
+  if (fPulserColor == MCalibrationCam::kNONE)
+    {
+      *fLog << endl;
+      *fLog << err << GetDescriptor()
+            << ": No Pulser colour has been chosen. Since the installation of the IFAE pulser box,"
+            << " you HAVE to provide the LEDs colour, otherwise there is no calibration. " << endl;
+      *fLog << "See e.g. the macro calibration.C " << endl;
+      return kFALSE;
+    }
   
   return kTRUE;
Index: trunk/MagicSoft/Mars/mjobs/MJCalibration.cc
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJCalibration.cc	(revision 3724)
+++ trunk/MagicSoft/Mars/mjobs/MJCalibration.cc	(revision 3725)
@@ -66,4 +66,5 @@
 
 #include "MPedestalCam.h"
+#include "MCalibrationCam.h"
 #include "MCalibrationQECam.h"
 #include "MCalibrationChargeCam.h"
@@ -95,10 +96,12 @@
 // Default constructor. 
 //
-// Sets fRuns to 0
-//
-MJCalibration::MJCalibration(const char *name, const char *title) : fRuns(0)
-{
-    fName  = name  ? name  : "MJCalibration";
-    fTitle = title ? title : "Tool to create a pedestal file (MPedestalCam)";
+// Sets fRuns to 0, fColor to kNONE
+//
+MJCalibration::MJCalibration(const char *name, const char *title) 
+    : fRuns(0), fColor(MCalibrationCam::kNONE)
+{
+  fName  = name  ? name  : "MJCalibration";
+  fTitle = title ? title : "Tool to create a pedestal file (MPedestalCam)";
+
 }
 
@@ -719,5 +722,9 @@
     MExtractSignal2          extract;
     MCalibrationChargeCalc   calcalc;
-    calcalc.SetPulserColor(MCalibrationCam::kCT1);
+
+    // 
+    // As long as there are no DM's, have to colour by hand 
+    //
+    calcalc.SetPulserColor(fColor);
 
     MFillH fillpin("MHCalibrationChargePINDiode", "MExtractedSignalPINDiode");
Index: trunk/MagicSoft/Mars/mjobs/MJCalibration.h
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJCalibration.h	(revision 3724)
+++ trunk/MagicSoft/Mars/mjobs/MJCalibration.h	(revision 3725)
@@ -29,4 +29,6 @@
   MCalibrationQECam     fQECam;                            // Quantum efficiency, can be set from previous runs
   MBadPixelsCam         fBadPixels;                        // Bad Pixels cam, can be set from previous runs
+
+  MCalibrationCam::PulserColor_t fColor;                   // Colour of the pulsed LEDs
   
   void DrawProjection   ( MHCamera *obj, Int_t fit) const; // Draw projection of pixels values
@@ -53,4 +55,5 @@
   void SetBadPixels(const MBadPixelsCam &bad)    { bad.Copy(fBadPixels);   }
   void SetQECam    (const MCalibrationQECam &qe) { qe.Copy(fQECam);        }    
+  void SetColor    (const MCalibrationCam::PulserColor_t color) { fColor = color;   }
   
   Bool_t ReadCalibrationCam();
