Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 8787)
+++ trunk/MagicSoft/Mars/Changelog	(revision 8788)
@@ -18,4 +18,44 @@
 
                                                  -*-*- END OF LINE -*-*-
+
+ 2007/12/14 Thomas Bretz
+
+   * mbadpixels/MBadPixelsCam.h:
+     - add Print to conext menu
+
+   * mjobs/MJCalibrateSignal.cc:
+     - add sequence to the output file
+
+   * mjobs/MJCalibration.[h,cc]:
+     - implemented a minimum number of required calibration events
+     - set a proper name to the extractor extracted pedetsl cam before
+       writing to the output file
+     - add sequence to the output file
+
+   * mjobs/MJPedestal.[h,cc]:
+     - removed member function SetMinEvents
+
+   * mjobs/MJStar.cc:
+     - added fSequence to the output file
+     - The pre-Muon cut now also containes a cut on the RelTimeSigma
+       this accelerates the muon processing even more by excluding
+       non-muons as early as possible
+
+   * mpedestal/MExtractPedestal.[h,cc]:
+     - added a new data meber fCounter to count the processed
+       pedestal events
+
+   * mpedestal/MPedCalcFromLoGain.cc, mpedestal/MPedCalcPedRun.cc:
+     - count the processed pedestal events
+
+   * mpedestal/MPedestalCam.[h,cc]:
+     - added data member fNumEvents to store the number of processed
+       events
+     - improved Print
+     - added Print to context menu
+     - commented out obsolete GetPedestalMin/Max
+     - increased version number by 1
+
+
 
  2007/12/13 Thomas Bretz
Index: trunk/MagicSoft/Mars/NEWS
===================================================================
--- trunk/MagicSoft/Mars/NEWS	(revision 8787)
+++ trunk/MagicSoft/Mars/NEWS	(revision 8788)
@@ -3,37 +3,60 @@
 == <cvs> ==
 
-;general
-* fixed GroupBy options in plot*.C macros
-* only display KVA points (not the Tuorla points) in plotoptical.C
-* all programs now allow to add resources to the ones from the resource
-file or overwrite them from the command line. This can be done like this
-::ganymed --config=ganymed.rc --rc=Cut1.Param1:0.25 --rc=Cut1.Param3:5.5
-:if something seems to be wrong you can debug what the program is doing
-using the option --debug-env=3
-* increased the diversity of debug levels. That also means that with -v3
-you get now less output, i.e. only the output which is important for
-an analysis. To get more output which helps for debugging try 4, 5 and 6.
-* fixed a problem in the task synchronizing the reading of the reports
-and the data stream. The effect was that in some circumstances the last
-events of some trees could have been skipped. Since this is only a
-very tiny part of the data no severe effect to your analysis results 
-is expected.
-* Dataset file now allow to include the sequence file directly within
-the dataset file and also allow to exclude single runs from the dataset.
-(for more details see Class reference of MDataSet)
-* Sequence files now allow for excluding runs from the analysis
-(for more details see Class reference of MSequence)
-* added code to process the sum-trigger flag
-
-;callisto
-* in the pedestal processing now at least 50 processed events are
-required for succeeding.
-
-;ganymed/sponde
-* Now data points are even shown correctly if they have error bars larger
-than one sigma. Points with null or negative significances are omitted.
-
-;sponde
-*fixed resource files ('''Spectrum''' instead of '''MJSpectrum''')
+ ;general
+
+   * fixed GroupBy options in plot*.C macros
+
+   * only display KVA points (not the Tuorla points) in plotoptical.C
+
+   * all programs now allow to add resources to the ones from the resource
+     file or overwrite them from the command line. This can be done like this
+          ganymed --config=ganymed.rc --rc=Cut1.Param1:0.25 --rc=Cut1.Param3:5.5
+     if something seems to be wrong you can debug what the program is doing
+     using the option --debug-env=3
+
+   * increased the diversity of debug levels. That also means that with -v3
+     you get now less output, i.e. only the output which is important for
+     an analysis. To get more output which helps for debugging try 4, 5 and 6.
+
+   * fixed a problem in the task synchronizing the reading of the reports
+     and the data stream. The effect was that in some circumstances the last
+     events of some trees could have been skipped. Since this is only a
+     very tiny part of the data no severe effect to your analysis results 
+     is expected.
+
+   * Dataset file now allow to include the sequence file directly within
+     the dataset file and also allow to exclude single runs from the dataset.
+     (for more details see Class reference of MDataSet)
+  
+   * Sequence files now allow for excluding runs from the analysis
+     (for more details see Class reference of MSequence)
+
+   * added code to process the sum-trigger flag
+
+ ;callisto
+
+    * in the pedestal processing now at least 50 processed events are
+      required for succeeding.
+
+    * the signal and calib files now contain also the sequence information
+
+    * the two MPedestalCam in the calib file now have proper names
+      to distinguish them from each other (MPedestalCam, MPedestalExtracted)
+
+    * Both pedestal cams now conatain the number of events processed
+
+ ;star
+
+    * the star file now contains also the sequence information
+
+ ;ganymed/sponde
+
+    * Now data points are even shown correctly if they have error bars larger
+      than one sigma. Points with null or negative significances are omitted.
+
+ ;sponde
+
+    * fixed resource files ('''Spectrum''' instead of '''MJSpectrum''')
+
 
 
Index: trunk/MagicSoft/Mars/mbadpixels/MBadPixelsCam.h
===================================================================
--- trunk/MagicSoft/Mars/mbadpixels/MBadPixelsCam.h	(revision 8787)
+++ trunk/MagicSoft/Mars/mbadpixels/MBadPixelsCam.h	(revision 8788)
@@ -1,4 +1,4 @@
 /* ======================================================================== *\
-!  $Name: not supported by cvs2svn $:$Id: MBadPixelsCam.h,v 1.11 2007-01-30 14:16:44 tbretz Exp $
+!  $Name: not supported by cvs2svn $:$Id: MBadPixelsCam.h,v 1.12 2007-12-14 09:56:01 tbretz Exp $
 \* ======================================================================== */
 #ifndef MARS_MBadPixelsCam
@@ -34,5 +34,5 @@
     void Reset();
     void Clear(Option_t *o="");
-    void Print(Option_t *o="") const;
+    void Print(Option_t *o="") const; //*MENU*
     void Copy(TObject &object) const;
 
Index: trunk/MagicSoft/Mars/mjobs/MJCalibrateSignal.cc
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJCalibrateSignal.cc	(revision 8787)
+++ trunk/MagicSoft/Mars/mjobs/MJCalibrateSignal.cc	(revision 8788)
@@ -153,4 +153,5 @@
     TObjArray cont;
     cont.Add(const_cast<TEnv*>(GetEnv()));
+    cont.Add(&fSequence);
 
     if (fDisplay)
Index: trunk/MagicSoft/Mars/mjobs/MJCalibration.cc
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJCalibration.cc	(revision 8787)
+++ trunk/MagicSoft/Mars/mjobs/MJCalibration.cc	(revision 8788)
@@ -188,10 +188,10 @@
     : fExtractor(NULL), fTimeExtractor(NULL), 
       fColor(MCalibrationCam::kNONE), fDisplayType(kDataCheckDisplay),
-      fGeometry("MGeomCamMagic")
+      fMinEvents(1000), fGeometry("MGeomCamMagic")
 {
 
   fName  = name  ? name  : "MJCalibration";
   fTitle = title ? title : "Tool to create the calibration constants for one calibration run";
-  
+
   //SetHiLoCalibration();
   SetRelTimeCalibration();
@@ -1521,5 +1521,5 @@
     if (!MJCalib::CheckEnvLocal())
         return kFALSE;
-    
+
     SetRelTimeCalibration(GetEnv("RelTimeCalibration", IsRelTimes()));
     SetDebug(GetEnv("Debug", IsDebug()));
@@ -1528,4 +1528,6 @@
     SetUsePINDiode(GetEnv("UsePINDiode", IsUsePINDiode()));
     SetGeometry(GetEnv("Geometry", fGeometry));
+
+    fMinEvents = (UInt_t)GetEnv("MinEvents", (Int_t)fMinEvents);
 
     fReferenceFile = GetEnv("ReferenceFile",fReferenceFile.Data());
@@ -1662,5 +1664,5 @@
     plist.AddToList(&pedcam);
     plist.AddToList(&fBadPixels);
-        
+
     //
     // Calibration Results containers
@@ -1904,4 +1906,10 @@
     {
         *fLog << err << GetDescriptor() << ": Failed." << endl;
+        return kFALSE;
+    }
+
+    if (calcalc.GetNumExecutions()<fMinEvents)
+    {
+        *fLog << err << GetDescriptor() << ": Failed. Less than the required " << fMinEvents << " evts processed." << endl;
         return kFALSE;
     }
@@ -2001,5 +2009,8 @@
 
     if (fExtractorCam.GetSize() != 0)
+    {
+        fExtractorCam.SetName("MPedestalExtracted");
         cont.Add(&fExtractorCam);
+    }
 
     TObject *pedcam = plist.FindObject("MPedestalCam");
@@ -2028,4 +2039,5 @@
 
     cont.Add(const_cast<TEnv*>(GetEnv()));
+    cont.Add(&fSequence);
 
     return WriteContainer(cont, GetOutputFileName(), "UPDATE");
Index: trunk/MagicSoft/Mars/mjobs/MJCalibration.h
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJCalibration.h	(revision 8787)
+++ trunk/MagicSoft/Mars/mjobs/MJCalibration.h	(revision 8788)
@@ -111,4 +111,6 @@
   Byte_t fFlags;                                       // Bit-field for the flags
 
+  UInt_t fMinEvents;                                   // Minimum number of events
+
   TString fGeometry;                                   // Class name geometry
 
Index: trunk/MagicSoft/Mars/mjobs/MJPedestal.cc
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJPedestal.cc	(revision 8787)
+++ trunk/MagicSoft/Mars/mjobs/MJPedestal.cc	(revision 8788)
@@ -764,5 +764,5 @@
     SetExtractWinRight(GetEnv("ExtractWinRight", fExtractWinRight));
 
-    SetMinEvents(GetEnv("MinEvents", (Int_t)fMinEvents));
+    fMinEvents = (UInt_t)GetEnv("MinEvents", (Int_t)fMinEvents);
 
     if (!MJCalib::CheckEnvLocal())
Index: trunk/MagicSoft/Mars/mjobs/MJPedestal.h
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJPedestal.h	(revision 8787)
+++ trunk/MagicSoft/Mars/mjobs/MJPedestal.h	(revision 8788)
@@ -130,6 +130,4 @@
     void SetExtractWinRight( const Float_t f=fgExtractWinRight ) { fExtractWinRight = f; }    
 
-    void SetMinEvents(UInt_t min) { fMinEvents = min; }
-
     MExtractor *GetExtractor() const { return fExtractor; }
 
Index: trunk/MagicSoft/Mars/mjobs/MJStar.cc
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJStar.cc	(revision 8787)
+++ trunk/MagicSoft/Mars/mjobs/MJStar.cc	(revision 8788)
@@ -105,4 +105,5 @@
     TObjArray cont;
     cont.Add(const_cast<TEnv*>(GetEnv()));
+    cont.Add(&fSequence);
 
     if (fDisplay)
@@ -371,5 +372,6 @@
     // Filter to fill the MHMuonPar
     MFDataPhrase fmuon3("(MMuonCalibPar.fArcPhi>190) && (MMuonSearchPar.fDeviation<35) &&"
-                        "(MMuonCalibPar.fArcWidth<0.20) && (MMuonCalibPar.fArcWidth>0.04)",
+                        "(MMuonCalibPar.fArcWidth<0.20) && (MMuonCalibPar.fArcWidth>0.04) &&"
+                        "MMuonCalibPar.fRelTimeSigma<1.5",
                         "MuonFinalCut");
     // Filter to write Muons to Muon tree
Index: trunk/MagicSoft/Mars/mpedestal/MExtractPedestal.cc
===================================================================
--- trunk/MagicSoft/Mars/mpedestal/MExtractPedestal.cc	(revision 8787)
+++ trunk/MagicSoft/Mars/mpedestal/MExtractPedestal.cc	(revision 8788)
@@ -1,4 +1,4 @@
 /* ======================================================================== *\
-! $Name: not supported by cvs2svn $:$Id: MExtractPedestal.cc,v 1.36 2007-09-07 12:17:16 tbretz Exp $
+! $Name: not supported by cvs2svn $:$Id: MExtractPedestal.cc,v 1.37 2007-12-14 09:56:03 tbretz Exp $
 ! --------------------------------------------------------------------------
 !
@@ -197,5 +197,6 @@
     : fGeom(NULL), fPedestalsInter(NULL),
     fPedestalsOut(NULL), fExtractor(NULL), fSignal(0),
-    fExtractWinFirst(0), fExtractWinSize(0), fUseSpecialPixels(kFALSE)
+    fExtractWinFirst(0), fExtractWinSize(0), fUseSpecialPixels(kFALSE),
+    fCounter(0)
 {
     fName  = name  ? name  : "MExtractPedestal";
@@ -468,4 +469,6 @@
   }
 
+  fCounter = 0;
+
   return fExtractor ? fExtractor->CallPreProcess(pList) : kTRUE;
 }
@@ -621,4 +624,6 @@
 Int_t MExtractPedestal::PostProcess()
 {
+    fPedestalsOut->SetNumEvents(fCounter);
+
     return fExtractor ? fExtractor->CallPostProcess() : kTRUE;
 }
Index: trunk/MagicSoft/Mars/mpedestal/MExtractPedestal.h
===================================================================
--- trunk/MagicSoft/Mars/mpedestal/MExtractPedestal.h	(revision 8787)
+++ trunk/MagicSoft/Mars/mpedestal/MExtractPedestal.h	(revision 8788)
@@ -90,4 +90,6 @@
   MArrayI fNumEventsUsed;            // Number of events used for pedestal calc for each pixel
 
+  UInt_t  fCounter;                  // Counter for events processed
+
   // MTask virtual functions
   Int_t  PreProcess(MParList *pList);
Index: trunk/MagicSoft/Mars/mpedestal/MPedCalcFromLoGain.cc
===================================================================
--- trunk/MagicSoft/Mars/mpedestal/MPedCalcFromLoGain.cc	(revision 8787)
+++ trunk/MagicSoft/Mars/mpedestal/MPedCalcFromLoGain.cc	(revision 8788)
@@ -1,4 +1,4 @@
 /* ======================================================================== *\
-! $Name: not supported by cvs2svn $:$Id: MPedCalcFromLoGain.cc,v 1.38 2007-05-11 10:25:45 tbretz Exp $
+! $Name: not supported by cvs2svn $:$Id: MPedCalcFromLoGain.cc,v 1.39 2007-12-14 09:56:03 tbretz Exp $
 ! --------------------------------------------------------------------------
 !
@@ -238,4 +238,6 @@
     }
 
+    fCounter++;
+
     if (fPedestalUpdate)
         fPedestalsOut->SetReadyToSave();
Index: trunk/MagicSoft/Mars/mpedestal/MPedCalcPedRun.cc
===================================================================
--- trunk/MagicSoft/Mars/mpedestal/MPedCalcPedRun.cc	(revision 8787)
+++ trunk/MagicSoft/Mars/mpedestal/MPedCalcPedRun.cc	(revision 8788)
@@ -1,4 +1,4 @@
 /* ======================================================================== *\
-! $Name: not supported by cvs2svn $:$Id: MPedCalcPedRun.cc,v 1.51 2007-05-11 10:25:45 tbretz Exp $
+! $Name: not supported by cvs2svn $:$Id: MPedCalcPedRun.cc,v 1.52 2007-12-14 09:56:03 tbretz Exp $
 ! --------------------------------------------------------------------------
 !
@@ -265,4 +265,6 @@
         CalcPixel(pixel, 0, fUseSpecialPixels);
 
+    fCounter++;
+
     fPedestalsOut->SetReadyToSave();
 
Index: trunk/MagicSoft/Mars/mpedestal/MPedestalCam.cc
===================================================================
--- trunk/MagicSoft/Mars/mpedestal/MPedestalCam.cc	(revision 8787)
+++ trunk/MagicSoft/Mars/mpedestal/MPedestalCam.cc	(revision 8788)
@@ -36,4 +36,8 @@
 //  - fTotalEntries
 //
+// Class Version 3:
+// ----------------
+//  + fNumEvents
+//
 /////////////////////////////////////////////////////////////////////////////
 #include "MPedestalCam.h"
@@ -78,5 +82,5 @@
 //
 MPedestalCam::MPedestalCam(const char *name, const char *title) 
-    : fNumSlices(0)
+    : fNumSlices(0), fNumEvents(0)
 {
   fName  = name  ? name  : "MPedestalCam";
@@ -122,4 +126,7 @@
     (*this)[i].Copy(cam[i]);
 
+  cam.fNumEvents = fNumEvents;
+  cam.fNumSlices = fNumSlices;
+
   n = GetNumAverageArea();
   cam.InitAverageAreas(n);
@@ -293,25 +300,26 @@
 }
 
-void MPedestalCam::Print(Option_t *o) const
-{
-    *fLog << all << GetDescriptor() << ":" << endl;
-    *fLog << "Pixels:" << endl;    
+void MPedestalCam::Print(Option_t *option) const
+{
+    *fLog << all << GetDescriptor();
+    *fLog << " - Events=" << fNumEvents << ", Slices=" << fNumSlices << ":" << endl;
     *fLog << endl;
 
-    PrintArr(*fArray);
-
     *fLog << endl;
-    *fLog << "Event-by-event averaged areas:" << endl;    
-    *fLog << endl;
-
+    *fLog << "Event-by-event averaged areas:" << endl;
     PrintArr(*fAverageAreas);
 
     *fLog << endl;
     *fLog << "Event-by-event averaged sectors:" << endl;
-    *fLog << endl;
-
     PrintArr(*fAverageSectors);
-}
-
+
+    if (TString(option).Contains("all", TString::kIgnoreCase))
+    {
+        *fLog << "Pixels:" << endl;
+        PrintArr(*fArray);
+    }
+}
+
+/*
 Float_t MPedestalCam::GetPedestalMin(const MGeomCam *geom) const
 {
@@ -357,4 +365,5 @@
     return maxval;
 }
+*/
 
 // --------------------------------------------------------------------------
Index: trunk/MagicSoft/Mars/mpedestal/MPedestalCam.h
===================================================================
--- trunk/MagicSoft/Mars/mpedestal/MPedestalCam.h	(revision 8787)
+++ trunk/MagicSoft/Mars/mpedestal/MPedestalCam.h	(revision 8788)
@@ -24,4 +24,5 @@
 
   UInt_t fNumSlices;  // Total number of slices
+  UInt_t fNumEvents;  // Number of events used for pedestal calculation
 
   void PrintArr(const TCollection &list) const;
@@ -31,8 +32,10 @@
   MPedestalCam(const char *name=NULL, const char *title=NULL);
   ~MPedestalCam();
-  
+
+  // TObject
   void Clear(Option_t *o="");
   void Copy(TObject &object) const;
-  
+  void Print(Option_t *o="") const; //*MENU*
+
   // Getters 
         MPedestalPix &GetAverageArea   ( UInt_t i );
@@ -42,8 +45,9 @@
   const MPedestalPix &GetAverageSector ( UInt_t i )            const;
   const Int_t         GetNumAverageSector()                    const;
-  Float_t             GetPedestalMin   ( const MGeomCam *cam ) const;
-  Float_t             GetPedestalMax   ( const MGeomCam *cam ) const;
+  //Float_t             GetPedestalMin   ( const MGeomCam *cam ) const;
+  //Float_t             GetPedestalMax   ( const MGeomCam *cam ) const;
   Int_t               GetSize          ()                      const;
   ULong_t             GetNumSlices() const { return fNumSlices; }
+  UInt_t              GetNumEvents() const { return fNumEvents; }
 
   TArrayF GetAveragedPedPerArea  ( const MGeomCam &geom, const UInt_t ai=0,  MBadPixelsCam *bad=NULL );
@@ -51,5 +55,5 @@
   TArrayF GetAveragedRmsPerArea  ( const MGeomCam &geom, const UInt_t ai=0,  MBadPixelsCam *bad=NULL );
   TArrayF GetAveragedRmsPerSector( const MGeomCam &geom, const UInt_t sec=0, MBadPixelsCam *bad=NULL );
-  
+
         MPedestalPix &operator[]       ( Int_t i             );
   const MPedestalPix &operator[]       ( Int_t i             ) const;
@@ -60,13 +64,13 @@
   void  InitAverageSectors             ( const UInt_t i      );
 
-  void Print(Option_t *o="") const;
-  
   // Setters
   void SetNumSlices(const ULong_t n) { fNumSlices = n; }
-  
+  void SetNumEvents(const UInt_t n)  { fNumEvents = n; }
+
+  // MCamEvent
   Bool_t GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0) const;
   void DrawPixelContent(Int_t idx) const;
 
-  ClassDef(MPedestalCam, 2)	// Storage Container for all pedestal information of the camera
+  ClassDef(MPedestalCam, 3)	// Storage Container for all pedestal information of the camera
 };
 
