Index: /trunk/MagicSoft/Mars/Changelog
===================================================================
--- /trunk/MagicSoft/Mars/Changelog	(revision 4872)
+++ /trunk/MagicSoft/Mars/Changelog	(revision 4873)
@@ -24,4 +24,9 @@
    * mcalib/MHGausEvents.[h,cc]
      - added function IsOnlyUnderflow()
+
+   * mcalib/MHCalibrationCam.[h,cc]
+     - added bool kLoGain which is set if number of LoGain Slices in 
+       MRawRunHeader is not 0. This excludes the low gain calculations 
+       in case that there is no lowgain at all. 
 
 
Index: /trunk/MagicSoft/Mars/mcalib/MHCalibrationCam.cc
===================================================================
--- /trunk/MagicSoft/Mars/mcalib/MHCalibrationCam.cc	(revision 4872)
+++ /trunk/MagicSoft/Mars/mcalib/MHCalibrationCam.cc	(revision 4873)
@@ -41,4 +41,11 @@
 // dealing with calibration pixels derive from MHGausEvents.
 //
+// The following flag can be set:
+// - SetDebug() for debug output.
+// - SetLoGain() for the case that low-gain slices are available, but 
+//               MRawRunHeader::GetNumLoGainSlices() gives still 0.
+// 
+// The flag fLoGain steers if low-gain signal is treated at all or not.
+//
 /////////////////////////////////////////////////////////////////////////////
 #include "MHCalibrationCam.h"
@@ -91,5 +98,6 @@
 MHCalibrationCam::MHCalibrationCam(const char *name, const char *title)
     :  fColor(MCalibrationCam::kNONE), 
-       fBadPixels(NULL), fCam(NULL), fGeom(NULL), fRunHeader(NULL), fDebug(kFALSE)
+       fBadPixels(NULL), fCam(NULL), fGeom(NULL), fRunHeader(NULL), 
+       fDebug(kFALSE), fLoGain(kFALSE)
 {
 
@@ -483,5 +491,8 @@
 
   if (fRunHeader)
-    fRunNumbers[fRunNumbers.GetSize()-1] = fRunHeader->GetRunNumber();
+    {
+      fRunNumbers[fRunNumbers.GetSize()-1] = fRunHeader->GetRunNumber();
+      fLoGain = fRunHeader->GetNumSamplesLoGain();
+    }
 
   if (!ReInitHists(pList))
@@ -497,9 +508,10 @@
     }
 
-  for (Int_t i=0; i<fLoGainArray->GetEntries(); i++)
-    {
-      TH1F *h = (*this)(i).GetHGausHist();
-      h->SetTitle( Form("%s%i%s", h->GetTitle(),fRunNumbers[fRunNumbers.GetSize()-1]," "));
-    }
+  if (fLoGain)
+    for (Int_t i=0; i<fLoGainArray->GetEntries(); i++)
+      {
+        TH1F *h = (*this)(i).GetHGausHist();
+        h->SetTitle( Form("%s%i%s", h->GetTitle(),fRunNumbers[fRunNumbers.GetSize()-1]," "));
+      }
   
   for (Int_t j=0; j<nareas; j++)
@@ -509,9 +521,10 @@
     }
   
-  for (Int_t j=0; j<nareas; j++)
-    {
-      TH1F *h = GetAverageLoGainArea(j).GetHGausHist();
-      h->SetTitle( Form("%s%i%s", h->GetTitle(),fRunNumbers[fRunNumbers.GetSize()-1]," "));
-    }
+  if (fLoGain)
+    for (Int_t j=0; j<nareas; j++)
+      {
+        TH1F *h = GetAverageLoGainArea(j).GetHGausHist();
+        h->SetTitle( Form("%s%i%s", h->GetTitle(),fRunNumbers[fRunNumbers.GetSize()-1]," "));
+      }
   
   for (Int_t j=0; j<nsectors; j++)
@@ -521,10 +534,11 @@
     }
   
-  for (Int_t j=0; j<nsectors; j++)
-    {
-      TH1F *h = GetAverageLoGainSector(j).GetHGausHist();
-      h->SetTitle( Form("%s%i%s", h->GetTitle(),fRunNumbers[fRunNumbers.GetSize()-1]," "));
-    }
-
+  if (fLoGain)
+    for (Int_t j=0; j<nsectors; j++)
+      {
+        TH1F *h = GetAverageLoGainSector(j).GetHGausHist();
+        h->SetTitle( Form("%s%i%s", h->GetTitle(),fRunNumbers[fRunNumbers.GetSize()-1]," "));
+      }
+  
   return kTRUE;
 }
@@ -564,9 +578,10 @@
     }
   
-  if (fLoGainArray->GetEntries() != npixels)
-    {
-      *fLog << err << "ERROR - Size mismatch... abort." << endl;
-      return kFALSE;
-    }
+  if (fLoGain)
+    if (fLoGainArray->GetEntries() != npixels)
+      {
+        *fLog << err << "ERROR - Size mismatch... abort." << endl;
+        return kFALSE;
+      }
   
   if (fAverageHiGainAreas->GetEntries() != nareas)
@@ -576,10 +591,11 @@
     }
 
-  if (fAverageLoGainAreas->GetEntries() != nareas)
-    {
-      *fLog << err << "ERROR - Size mismatch in number of areas ... abort." << endl;
-      return kFALSE;
-    }
-
+  if (fLoGain)
+    if (fAverageLoGainAreas->GetEntries() != nareas)
+      {
+        *fLog << err << "ERROR - Size mismatch in number of areas ... abort." << endl;
+        return kFALSE;
+    }
+  
   if (fAverageHiGainSectors->GetEntries() != nsectors)
     {
@@ -588,10 +604,11 @@
     }
 
-  if (fAverageLoGainSectors->GetEntries() != nsectors)
-    {
-      *fLog << err << "ERROR - Size mismatch in number of sectors ... abort." << endl;
-      return kFALSE;
-    }
-
+  if (fLoGain)
+    if (fAverageLoGainSectors->GetEntries() != nsectors)
+      {
+        *fLog << err << "ERROR - Size mismatch in number of sectors ... abort." << endl;
+        return kFALSE;
+      }
+  
   return FillHists(par, w);
 }
@@ -802,7 +819,7 @@
 
 
-  if (hist.IsEmpty())
+  if (hist.IsEmpty() || hist.IsOnlyOverflow() || hist.IsOnlyUnderflow())
     return;
-
+  
   //
   // 2) Fit the Hi Gain histograms with a Gaussian
@@ -881,5 +898,5 @@
 {
 
-  if (hist.IsEmpty())
+  if (hist.IsEmpty() || hist.IsOnlyOverflow() || hist.IsOnlyUnderflow())
       return;
   
@@ -970,10 +987,10 @@
   pad->SetBorderMode(0);
 
-  pad->Divide(2,nareas);
+  pad->Divide(fLoGain ? 2 : 1,nareas);
 
   for (Int_t i=0; i<nareas;i++) 
     {
 
-      pad->cd(2*(i+1)-1);
+      pad->cd(fLoGain ? 2*(i+1)-1 : i+1);
       GetAverageHiGainArea(i).Draw(opt);
 
@@ -983,6 +1000,9 @@
                          fAverageAreaRelSigma[i], fAverageAreaRelSigmaVar[i]);
 
-      pad->cd(2*(i+1));
-      GetAverageLoGainArea(i).Draw(opt);
+      if (fLoGain)
+        {
+          pad->cd(2*(i+1));
+          GetAverageLoGainArea(i).Draw(opt);
+        }
       
       if (fAverageAreaSat[i])
@@ -991,5 +1011,5 @@
                          fAverageAreaRelSigma[i], fAverageAreaRelSigmaVar[i]);
     }
-
+      
 }
 
Index: /trunk/MagicSoft/Mars/mcalib/MHCalibrationCam.h
===================================================================
--- /trunk/MagicSoft/Mars/mcalib/MHCalibrationCam.h	(revision 4872)
+++ /trunk/MagicSoft/Mars/mcalib/MHCalibrationCam.h	(revision 4873)
@@ -80,4 +80,5 @@
   Int_t      fPulserFrequency;           // Light pulser frequency
   Bool_t     fDebug;                     // Debug option is used?
+  Bool_t     fLoGain;                    // Is Low-Gain available 
   
   virtual Bool_t SetupHists(const MParList *pList);
@@ -161,4 +162,5 @@
   void SetColor               ( const MCalibrationCam::PulserColor_t color ) { fColor   = color; }
   void SetDebug               ( const Bool_t b=kTRUE )               { fDebug           = b;     }
+  void SetLoGain              ( const Bool_t b=kTRUE )               { fLoGain          = b;     }
   void SetAverageNbins        ( const Int_t bins=fgAverageNbins )    { fAverageNbins    = bins;  }
   void SetNumLoGainSaturationLimit( const Float_t lim )    { fNumLoGainSaturationLimit  = lim;   }
Index: /trunk/MagicSoft/Mars/mcalib/MHGausEvents.cc
===================================================================
--- /trunk/MagicSoft/Mars/mcalib/MHGausEvents.cc	(revision 4872)
+++ /trunk/MagicSoft/Mars/mcalib/MHGausEvents.cc	(revision 4873)
@@ -809,4 +809,9 @@
 
 
+// --------------------------------------------------------------------------
+//
+// If fFExpFit exists, returns fit parameter 1 (Slope of Exponential fit), 
+// otherwise 0.
+//
 const Double_t MHGausEvents::GetSlope()  const 
 {
Index: /trunk/MagicSoft/Mars/mcalib/MHGausEvents.h
===================================================================
--- /trunk/MagicSoft/Mars/mcalib/MHGausEvents.h	(revision 4872)
+++ /trunk/MagicSoft/Mars/mcalib/MHGausEvents.h	(revision 4873)
@@ -125,5 +125,5 @@
   const Bool_t IsGausFitOK()             const; 
   const Bool_t IsOnlyOverflow()          const;
-  const Bool_t IsUnderOverflow()         const;  
+  const Bool_t IsOnlyUnderflow()         const;  
 
   // Fill
