Index: /trunk/MagicSoft/Mars/Changelog
===================================================================
--- /trunk/MagicSoft/Mars/Changelog	(revision 8278)
+++ /trunk/MagicSoft/Mars/Changelog	(revision 8279)
@@ -18,4 +18,23 @@
 
                                                  -*-*- END OF LINE -*-*-
+
+ 2007/01/30 Thomas Bretz
+
+   * mbadpixels/MBadPixelsCam.[h,cc]:
+     - added function to return the uncalibrated and unsuitable
+       pixels as TArrayC (to be used in MHCamera)
+
+   * mhcalib/MHCalibrationChargeCam.cc:
+     - added a FIXME-comment
+
+   * mhist/MHCamEvent.[h,cc]:
+     - added an option to change the kind of error which is displayed
+     - consequently increased version number by 1
+
+   * mhist/MHCamera.[h,cc]:
+     - added a new bit to allow the error to be switched between 
+       mean and spread
+
+
 
  2007/01/27 Thomas Bretz
Index: /trunk/MagicSoft/Mars/mbadpixels/MBadPixelsCam.cc
===================================================================
--- /trunk/MagicSoft/Mars/mbadpixels/MBadPixelsCam.cc	(revision 8278)
+++ /trunk/MagicSoft/Mars/mbadpixels/MBadPixelsCam.cc	(revision 8279)
@@ -1,3 +1,5 @@
 /* ======================================================================== *\
+! $Name: not supported by cvs2svn $:$Id: MBadPixelsCam.cc,v 1.48 2007-01-30 14:16:44 tbretz Exp $
+! --------------------------------------------------------------------------
 !
 ! *
@@ -17,5 +19,5 @@
 !
 !   Author(s): Thomas Bretz 1/2004 <mailto:tbretz@astro.uni-wuerzburg.de>
-!              Markus Gaug  3/2004 <mailto:markus@ifae.es>
+!   Author(s): Markus Gaug  3/2004 <mailto:markus@ifae.es>
 !
 !   Copyright: MAGIC Software Development, 2000-2004
@@ -36,4 +38,5 @@
 #include <iostream>
 
+#include <TArrayC.h>
 #include <TClonesArray.h>
 
@@ -525,4 +528,24 @@
   PrintBadPixels(MBadPixelsPix::kRelTimeOscillating ,"Relative Arr. Times Oscillation");
   PrintBadPixels(MBadPixelsPix::kDeviatingFFactor   ,"Deviating global F-Factor");
+}
+
+TArrayC MBadPixelsCam::GetUnsuitable(MBadPixelsPix::UnsuitableType_t typ) const
+{
+    TArrayC rc(GetSize());
+
+    for (Int_t i=0; i<rc.GetSize(); i++)
+        rc[i] = (*this)[i].IsUnsuitable(typ) ? 0 : 1;
+
+    return rc;
+}
+
+TArrayC MBadPixelsCam::GetUncalibrated(MBadPixelsPix::UncalibratedType_t typ) const
+{
+    TArrayC rc(GetSize());
+
+    for (Int_t i=0; i<rc.GetSize(); i++)
+        rc[i] = (*this)[i].IsUncalibrated(typ) ? 0 : 1;
+
+    return rc;
 }
 
Index: /trunk/MagicSoft/Mars/mbadpixels/MBadPixelsCam.h
===================================================================
--- /trunk/MagicSoft/Mars/mbadpixels/MBadPixelsCam.h	(revision 8278)
+++ /trunk/MagicSoft/Mars/mbadpixels/MBadPixelsCam.h	(revision 8279)
@@ -1,2 +1,5 @@
+/* ======================================================================== *\
+!  $Name: not supported by cvs2svn $:$Id: MBadPixelsCam.h,v 1.11 2007-01-30 14:16:44 tbretz Exp $
+\* ======================================================================== */
 #ifndef MARS_MBadPixelsCam
 #define MARS_MBadPixelsCam
@@ -9,6 +12,8 @@
 #endif
 
+class TArrayC;
+class TClonesArray;
+
 class MGeomPix;
-class TClonesArray;
 
 class MBadPixelsCam : public MParContainer, public MCamEvent
@@ -50,4 +55,7 @@
     Short_t GetNumMaxCluster(const MGeomCam &geom, Int_t aidx=-1) { return GetNumMaxCluster(MBadPixelsPix::kUnsuitableRun, geom, aidx); }
 
+    TArrayC GetUnsuitable(MBadPixelsPix::UnsuitableType_t typ=MBadPixelsPix::kUnsuitable) const;
+    TArrayC GetUncalibrated(MBadPixelsPix::UncalibratedType_t typ) const;
+
     void   AsciiRead(istream &fin);
     Bool_t AsciiWrite(ostream &out) const;
Index: /trunk/MagicSoft/Mars/mhcalib/MHCalibrationChargeCam.cc
===================================================================
--- /trunk/MagicSoft/Mars/mhcalib/MHCalibrationChargeCam.cc	(revision 8278)
+++ /trunk/MagicSoft/Mars/mhcalib/MHCalibrationChargeCam.cc	(revision 8279)
@@ -1,4 +1,4 @@
 /* ======================================================================== *\
-! $Name: not supported by cvs2svn $:$Id: MHCalibrationChargeCam.cc,v 1.48 2007-01-11 14:14:37 tbretz Exp $
+! $Name: not supported by cvs2svn $:$Id: MHCalibrationChargeCam.cc,v 1.49 2007-01-30 14:16:45 tbretz Exp $
 ! --------------------------------------------------------------------------
 !
@@ -1142,4 +1142,8 @@
     const Float_t upperlimit = (Float_t)last ;// - fTimeUpperLimit;
 
+    // FIXME: instead of checking whether the maximum is in the first or
+    //        last extracted slice we should check whether the extractor
+    //        was able to properly extract the signal!!!
+
     if (mean<lowerlimit)
     {
Index: /trunk/MagicSoft/Mars/mhist/MHCamEvent.cc
===================================================================
--- /trunk/MagicSoft/Mars/mhist/MHCamEvent.cc	(revision 8278)
+++ /trunk/MagicSoft/Mars/mhist/MHCamEvent.cc	(revision 8279)
@@ -90,5 +90,5 @@
 //
 MHCamEvent::MHCamEvent(const char *name, const char *title)
-    : fSum(NULL), fEvt(NULL), fType(0), fThreshold(0), fUseThreshold(0)
+    : fSum(NULL), fEvt(NULL), fType(0), fErrorSpread(kTRUE), fThreshold(0), fUseThreshold(0)
 {
     Init(name, title);
@@ -100,5 +100,5 @@
 //
 MHCamEvent::MHCamEvent(Int_t type, const char *name, const char *title)
-    : fSum(NULL), fEvt(NULL), fType(type), fThreshold(0), fUseThreshold(0)
+    : fSum(NULL), fEvt(NULL), fType(type), fErrorSpread(kTRUE), fThreshold(0), fUseThreshold(0)
 {
     Init(name, title);
@@ -156,4 +156,6 @@
         fSum->SetYTitle("a.u.");
     fSum->SetBit(MHCamera::kProfile);
+    if (!fErrorSpread)
+        fSum->SetBit(MHCamera::kErrorMean);
 
     fSum->SetXTitle("Pixel Idx");
@@ -282,5 +284,5 @@
     MHCamera *cam = new MHCamera(*fSum->GetGeometry());
     cam->SetName(Form("%s;err", fName.Data()));
-    cam->SetTitle("Sqrt(Variance)");
+    cam->SetTitle(fErrorSpread?"Sqrt(Variance)":"Sqrt(Variance)/Sqrt(n_{i})");
     cam->SetYTitle(fSum->GetYaxis()->GetTitle());
     cam->SetCamContent(*fSum, 1);
Index: /trunk/MagicSoft/Mars/mhist/MHCamEvent.h
===================================================================
--- /trunk/MagicSoft/Mars/mhist/MHCamEvent.h	(revision 8278)
+++ /trunk/MagicSoft/Mars/mhist/MHCamEvent.h	(revision 8279)
@@ -23,4 +23,5 @@
 
     Int_t fType;           // Type to used for calling GetPixelContent
+    Bool_t fErrorSpread;   // kFALSE==mean, kTRUE==spread
 
     Float_t fThreshold;    // Count pixel above/below this threshold
@@ -51,6 +52,7 @@
 
     void SetThreshold(Float_t f=0, Char_t direction=kIsLowerBound) { fThreshold = f; fUseThreshold=direction; }
+    void SetErrorSpread(Bool_t b=kTRUE) { fErrorSpread = b; }
 
-    ClassDef(MHCamEvent, 1) // Histogram to sum camera events
+    ClassDef(MHCamEvent, 2) // Histogram to sum camera events
 };
 
Index: /trunk/MagicSoft/Mars/mhist/MHCamera.cc
===================================================================
--- /trunk/MagicSoft/Mars/mhist/MHCamera.cc	(revision 8278)
+++ /trunk/MagicSoft/Mars/mhist/MHCamera.cc	(revision 8279)
@@ -1,4 +1,4 @@
 /* ======================================================================== *\
-! $Name: not supported by cvs2svn $:$Id: MHCamera.cc,v 1.95 2006-10-17 17:16:00 tbretz Exp $
+! $Name: not supported by cvs2svn $:$Id: MHCamera.cc,v 1.96 2007-01-30 14:16:45 tbretz Exp $
 ! --------------------------------------------------------------------------
 !
@@ -1333,4 +1333,10 @@
 }
 
+// ------------------------------------------------------------------------
+//
+// In the case the kProfile flag is set the spread of the bin is returned.
+// If you want to have the mean error instead set the kErrorMean bit via
+//  SetBit(kErrorMean) first.
+//
 Stat_t MHCamera::GetBinError(Int_t bin) const
 {
@@ -1346,5 +1352,7 @@
     const Double_t val = fArray[bin]        / n;
 
-    return sqr>val*val ? TMath::Sqrt(sqr - val*val) / n : 0;
+    const Double_t spread = sqr>val*val ? TMath::Sqrt(sqr - val*val);
+
+    return TestBit(kErrorMean) ? spread/TMath::Sqrt(n) : spread;
 
     /*
