Index: /trunk/MagicSoft/Mars/Changelog
===================================================================
--- /trunk/MagicSoft/Mars/Changelog	(revision 4163)
+++ /trunk/MagicSoft/Mars/Changelog	(revision 4164)
@@ -18,4 +18,10 @@
 
                                                  -*-*- END OF LINE -*-*-
+
+ 2004/05/25: Markus Gaug
+
+   * mjobs/MJCalibration.[h,cc]
+     - add possibility to switch on and off the blind pixel or pin diode
+       calibration
 
  2004/05/24: Javier Rico
Index: /trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc
===================================================================
--- /trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc	(revision 4163)
+++ /trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc	(revision 4164)
@@ -223,5 +223,5 @@
 using namespace std;
 
-const Float_t MCalibrationChargeCalc::fgChargeLimit            = 3.;
+const Float_t MCalibrationChargeCalc::fgChargeLimit            = 2.5
 const Float_t MCalibrationChargeCalc::fgChargeErrLimit         = 0.;
 const Float_t MCalibrationChargeCalc::fgChargeRelErrLimit      = 1.;
@@ -421,11 +421,17 @@
   fBlindPixel = (MCalibrationChargeBlindPix*)pList->FindObject("MCalibrationChargeBlindPix");
   if (!fBlindPixel)
-    *fLog << warn << GetDescriptor() 
-          << ": MCalibrationChargeBlindPix not found... no blind pixel method! " << endl;
+    {
+      *fLog << endl;
+      *fLog << warn << GetDescriptor() 
+            << ": MCalibrationChargeBlindPix not found... no Blind Pixel method! " << endl;
+    }
   
   fPINDiode = (MCalibrationChargePINDiode*)pList->FindObject("MCalibrationChargePINDiode");
   if (!fPINDiode)
-    *fLog << warn << GetDescriptor() 
-          << "MCalibrationChargePINDiode not found... no PIN Diode method! " << endl;
+    {
+      *fLog << endl;
+      *fLog << warn << GetDescriptor() 
+            << ": MCalibrationChargePINDiode not found... no PIN Diode method! " << endl;
+    }
   
 
Index: /trunk/MagicSoft/Mars/mjobs/MJCalibration.cc
===================================================================
--- /trunk/MagicSoft/Mars/mjobs/MJCalibration.cc	(revision 4163)
+++ /trunk/MagicSoft/Mars/mjobs/MJCalibration.cc	(revision 4164)
@@ -52,6 +52,12 @@
 //
 // If the flag SetDataCheck() is set, the calibration is used as in the data check at 
-// La Palma, which mean especially running it on raw data files.
+// La Palma, which mean especially running on raw data files.
 // 
+// The absolute light calibration devices Blind Pixel and PIN Diode can be switched on
+// and off with the commands:
+//
+// - SetUseBlindPixel(Bool_t )
+// - SetUsePINDiode(Bool_t )
+//
 // See also: MHCalibrationChargePix, MHCalibrationChargeCam, MHGausEvents
 //           MHCalibrationChargeBlindPix, MHCalibrationChargePINDiode
@@ -72,8 +78,5 @@
 //End_Html
 //
-// Different arrival time extractors can be chosen via the command SetArrivalTimeLevel(UInt_t i)
-// Up to now, the following extractors are available:
-// i=1: Use MArrivalTimeCalc  (using MCubicSpline, arrival time == position at half maximum)
-// i=2: Use MArrivalTimeCalc2 (mean time of fWindowSize time slices with the highest integral content: default)
+// Different arrival time extractors can be set directly with the command SetTimeExtractor(MExtractor *)
 //
 // See also: MHCalibrationRelTimePix, MHCalibrationRelTimeCam, MHGausEvents
@@ -144,6 +147,8 @@
 // Default constructor. 
 //
-// Sets fRuns to 0, fExtractor to NULL, fTimeExtractor to NULL, fColor to kNONE, 
-// fDisplay to kNormalDisplay, fRelTime to kFALSE, fDataCheck to kFALSE
+// - Sets fRuns to 0, fExtractor to NULL, fTimeExtractor to NULL, fColor to kNONE, 
+//   fDisplay to kNormalDisplay, fRelTime to kFALSE, fDataCheck to kFALSE, 
+// - SetUseBlindPixel()
+// - SetUsePINDiode()
 //
 MJCalibration::MJCalibration(const char *name, const char *title) 
@@ -152,6 +157,10 @@
       fRelTimes(kFALSE), fDataCheck(kFALSE)
 {
+
   fName  = name  ? name  : "MJCalibration";
   fTitle = title ? title : "Tool to create the calibration constants for one calibration run";
+
+  SetUseBlindPixel();
+  SetUsePINDiode();
 
 }
@@ -728,4 +737,15 @@
           }
 
+      if (filenames.Contains("_26568_"))
+        if (fColor == MCalibrationCam::kNONE)
+          {
+            *fLog << "Found colour: kGREEN  in " << filenames << endl;
+            fColor = MCalibrationCam::kGREEN;
+          }
+        else if (fColor != MCalibrationCam::kGREEN)
+          {
+            *fLog << err << "Different colour found in " << filenames << "... abort" << endl;
+            return kFALSE;
+          }
       //
       // Here start the runs where the shifter put 
@@ -807,4 +827,19 @@
   return Form("%s/%s-F1.root", (const char*)fOutputPath, (const char*)fRuns->GetRunsAsFileName());
 }
+
+
+Bool_t MJCalibration::IsUseBlindPixel() const 
+{
+  return TESTBIT(fDevices,kUseBlindPixel);
+}
+
+
+Bool_t MJCalibration::IsUsePINDiode() const 
+{
+  return TESTBIT(fDevices,kUsePINDiode);
+}
+
+  
+
 
 
@@ -909,6 +944,8 @@
   plist.AddToList(&fCalibrationCam);
   plist.AddToList(&fRelTimeCam);
-  plist.AddToList(&pindiode);
-  plist.AddToList(&blindpix);
+  if (IsUsePINDiode())
+    plist.AddToList(&pindiode);
+  if (IsUseBlindPixel())
+    plist.AddToList(&blindpix);
 
   MGeomApply               apply;
@@ -981,6 +1018,10 @@
 
   tlist.AddToList(&fillcam);
-  tlist.AddToList(&fillpin);
-  tlist.AddToList(&fillbnd);
+
+  if (IsUsePINDiode())
+    tlist.AddToList(&fillpin);
+  if (IsUseBlindPixel())
+    tlist.AddToList(&fillbnd);
+
   tlist.AddToList(&calcalc);
 
@@ -1026,48 +1067,49 @@
 Bool_t MJCalibration::ReadCalibrationCam()
 {
-    const TString fname = GetOutputFile();
-
-    if (gSystem->AccessPathName(fname, kFileExists))
-    {
-        *fLog << err << "Input file " << fname << " doesn't exist." << endl;
-        return kFALSE;
-    }
-
-    *fLog << inf << "Reading from file: " << fname << endl;
-
-    TFile file(fname, "READ");
-    if (fCalibrationCam.Read()<=0)
-    {
-        *fLog << err << "Unable to read MCalibrationChargeCam from " << fname << endl;
-        return kFALSE;
-    }
-
-    if (fQECam.Read()<=0)
-    {
-        *fLog << err << "Unable to read MCalibrationQECam from " << fname << endl;
-        return kFALSE;
-    }
-
-    if (fRelTimeCam.Read()<=0)
-    {
-        *fLog << err << "Unable to read MCalibrationRelTimeCam from " << fname << endl;
-        return kFALSE;
-    }
-
-    if (file.FindKey("MBadPixelsCam"))
-    {
-        MBadPixelsCam bad;
-        if (bad.Read()<=0)
+
+  const TString fname = GetOutputFile();
+  
+  if (gSystem->AccessPathName(fname, kFileExists))
+    {
+      *fLog << err << "Input file " << fname << " doesn't exist." << endl;
+      return kFALSE;
+    }
+  
+  *fLog << inf << "Reading from file: " << fname << endl;
+
+  TFile file(fname, "READ");
+  if (fCalibrationCam.Read()<=0)
+    {
+      *fLog << err << "Unable to read MCalibrationChargeCam from " << fname << endl;
+      return kFALSE;
+    }
+  
+  if (fQECam.Read()<=0)
+    {
+      *fLog << err << "Unable to read MCalibrationQECam from " << fname << endl;
+      return kFALSE;
+    }
+  
+  if (fRelTimeCam.Read()<=0)
+    {
+      *fLog << err << "Unable to read MCalibrationRelTimeCam from " << fname << endl;
+      return kFALSE;
+    }
+  
+  if (file.FindKey("MBadPixelsCam"))
+    {
+      MBadPixelsCam bad;
+      if (bad.Read()<=0)
         {
-            *fLog << err << "Unable to read MBadPixelsCam from " << fname << endl;
-            return kFALSE;
+          *fLog << err << "Unable to read MBadPixelsCam from " << fname << endl;
+          return kFALSE;
         }
-        fBadPixels.Merge(bad);
-    }
-
-    if (fDisplay /*&& !fDisplay->GetCanvas("Pedestals")*/) // FIXME!
-        fDisplay->Read();
-
-    return kTRUE;
+      fBadPixels.Merge(bad);
+    }
+  
+  if (fDisplay /*&& !fDisplay->GetCanvas("Pedestals")*/) // FIXME!
+    fDisplay->Read();
+  
+  return kTRUE;
 }
 
@@ -1084,4 +1126,21 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Set the useage of the Blind Pixel device 
+// 
+void MJCalibration::SetUseBlindPixel(const Bool_t b)
+{
+  b ? SETBIT(fDevices,kUseBlindPixel) : CLRBIT(fDevices,kUseBlindPixel);
+}
+
+// --------------------------------------------------------------------------
+//
+// Set the useage of the PIN Diode device 
+// 
+void MJCalibration::SetUsePINDiode(const Bool_t b)
+{
+  b ? SETBIT(fDevices,kUsePINDiode) : CLRBIT(fDevices,kUsePINDiode);
+}
 
 // --------------------------------------------------------------------------
@@ -1141,8 +1200,2 @@
 }
 
-
-
-
-
-
-
Index: /trunk/MagicSoft/Mars/mjobs/MJCalibration.h
===================================================================
--- /trunk/MagicSoft/Mars/mjobs/MJCalibration.h	(revision 4163)
+++ /trunk/MagicSoft/Mars/mjobs/MJCalibration.h	(revision 4164)
@@ -46,4 +46,8 @@
   Display_t fDisplayType;                                  // Chosen Display type
 
+  enum  Device_t    { kUseBlindPixel, kUsePINDiode  };     // Possible devices for calibration
+
+  Byte_t fDevices;                                         // Bit-field for used devices for calibration
+  
   Bool_t fRelTimes;                                        // Flag if relative times have to be calibrated
   Bool_t fDataCheck;                                       // Flag if the data check is run on raw data
@@ -58,7 +62,4 @@
   ~MJCalibration() {}
   
-  void SetInput(MRunIter *iter) { fRuns=iter; }
-  void SetOutputPath(const char *path=".");
-  
   const char* GetOutputFile() const;
 
@@ -67,4 +68,7 @@
   MCalibrationQECam      &GetQECam()              { return fQECam;          }    
   MBadPixelsCam          &GetBadPixels()          { return fBadPixels;      }
+
+  Bool_t IsUseBlindPixel() const;
+  Bool_t IsUsePINDiode()   const;
   
   void SetBadPixels(const MBadPixelsCam &bad)     { bad.Copy(fBadPixels);   }
@@ -74,4 +78,7 @@
   void SetColor    (const MCalibrationCam::PulserColor_t color) { fColor = color; }
 
+  void SetInput(MRunIter *iter) { fRuns=iter; }
+  void SetOutputPath(const char *path=".");
+  
   // Displays
   void SetFullDisplay()      { fDisplayType = kFullDisplay;      }
@@ -85,4 +92,8 @@
   void SetDataCheck         (const Bool_t b=kTRUE) { fDataCheck        = b; SetDataCheckDisplay(); }
 
+  // Devices
+  void SetUseBlindPixel( const Bool_t b=kTRUE );
+  void SetUsePINDiode  ( const Bool_t b=kTRUE );  
+  
   Bool_t ReadCalibrationCam();
   Bool_t ProcessFile( MPedestalCam &pedcam );
Index: /trunk/MagicSoft/Mars/mjobs/MJPedestal.cc
===================================================================
--- /trunk/MagicSoft/Mars/mjobs/MJPedestal.cc	(revision 4163)
+++ /trunk/MagicSoft/Mars/mjobs/MJPedestal.cc	(revision 4164)
@@ -79,12 +79,15 @@
 const char* MJPedestal::GetOutputFile() const
 {
+
   if (!fRuns)
     return "";
 
   return Form("%s/%s-F0.root", (const char*)fOutputPath, (const char*)fRuns->GetRunsAsFileName());
+
 }
 
 Bool_t MJPedestal::ReadPedestalCam()
 {
+
     const TString fname = GetOutputFile();
 
