Index: /trunk/MagicSoft/Mars/Changelog
===================================================================
--- /trunk/MagicSoft/Mars/Changelog	(revision 4765)
+++ /trunk/MagicSoft/Mars/Changelog	(revision 4766)
@@ -19,5 +19,5 @@
 
                                                  -*-*- END OF LINE -*-*-
- 2004/08/27: 
+ 2004/08/27: Markus Gaug
 
    * mjobs/MJCalibration.h
@@ -35,4 +35,5 @@
 
 
+
  2004/08/27: Thomas Bretz
 
@@ -43,4 +44,5 @@
    * callisto.cc: 
      - fixed some output
+     - fixed batch mode
 
    * mbadpixels/Makefile:
@@ -60,6 +62,7 @@
        took a lot of time.
 
-   * mjobs/MJCalibrateSignal.cc, mjobs/MJPedestal.cc:
+   * mjobs/MJCalibrateSignal.cc, mjobs/MJPedestal.cc, MJCalibration.cc:
      - added two empty lines to output if finished
+     - added a sanity check around the call to CheckEnv
 
    * mpedestal/MPedPhotCam.cc:
@@ -100,4 +103,23 @@
    * mmain/MEventDisplay.cc:
      - fixed reading of resource file
+
+   * mbase/MStatusDisplay.cc:
+     - made Reset() batch-mode safe
+
+   * mcalib/MCalibrateData.cc:
+     - simplified a calculation
+
+   * mfileio/MReadReports.[h,cc]:
+     - implemented GetEntries()
+     - implemented GetFileName()
+     - changed kHasMaster from BIT(15) to BIT(14)
+     - fixed a bug in AddTree which caused the Master-Bit to be
+       set for the wrong object
+
+   * mfileio/MReadTree.cc:
+     - return 0 entries if entrie==TChain::kBigNumber
+
+   * msignal/MExtractFixedWindow.cc:
+     - updated output to fitz into a std 80-col console
 
 
Index: /trunk/MagicSoft/Mars/callisto.cc
===================================================================
--- /trunk/MagicSoft/Mars/callisto.cc	(revision 4765)
+++ /trunk/MagicSoft/Mars/callisto.cc	(revision 4766)
@@ -258,5 +258,5 @@
 
     TApplication app("Callisto", &argc, argv);
-    if (gROOT->IsBatch() || !gClient)
+    if (!gROOT->IsBatch() && !gClient)
     {
         gLog << err << "Bombing... maybe your DISPLAY variable is not set correctly!" << endl;
Index: /trunk/MagicSoft/Mars/mars.rc
===================================================================
--- /trunk/MagicSoft/Mars/mars.rc	(revision 4766)
+++ /trunk/MagicSoft/Mars/mars.rc	(revision 4766)
@@ -0,0 +1,26 @@
+# ==========================================================================
+#############################################################################
+# ==========================================================================
+#
+#  This is a resource file for the Mars executable. You can here setup
+#   setup the tasks of the eventloops executed in the Mars executable -
+#   if supported by these tasks.
+#
+# ==========================================================================
+#############################################################################
+# ==========================================================================
+
+# -------------------------------------------------------------------------
+# Use this if you want to setup the logging stream for the jobs
+# (overwrites command line options)
+# -------------------------------------------------------------------------
+#MLog.VerbosityLevel: 2
+#MLog.DebugLevel:     1
+#MLog.NoColors:       yes
+
+# -------------------------------------------------------------------------
+# This is how you can setup the Image cleaning used in the Camera Display
+# -------------------------------------------------------------------------
+#MImgCleanStd.CleaningMethod: kProbability
+#MImgCleanStd.CleaningLevel1: 0.3
+#MImgCleanStd.CleaningLevel2: 0.05
Index: /trunk/MagicSoft/Mars/mbase/MArgs.cc
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MArgs.cc	(revision 4765)
+++ /trunk/MagicSoft/Mars/mbase/MArgs.cc	(revision 4766)
@@ -57,5 +57,8 @@
 //  fArgv: A TList containing all other command line arguments
 //
-MArgs::MArgs(int argc, char **argv) : fArgc(argc)
+//  If root==kFALSE all root commandline options are deleted from
+//  the list, namely: -b
+//
+MArgs::MArgs(int argc, char **argv, Bool_t root) : fArgc(argc)
 {
     // FIXME: argv has no const-qualifier to be idetical with
@@ -72,4 +75,9 @@
         fArgv->Add(&o);
     }
+
+    if (root)
+        return;
+
+    HasOnlyAndRemove("-b");
 }
 
@@ -408,4 +416,6 @@
     const TString name = n.Strip(TString::kBoth);
 
+    Bool_t rc = kFALSE;
+
     TIter Next(fArgv);
     TString *s = NULL;
@@ -414,7 +424,7 @@
         {
             delete fArgv->Remove(dynamic_cast<TObject*>(s));
-            return kTRUE;
+            rc = kTRUE;
         }
 
-    return kFALSE;
-}
+    return rc;
+}
Index: /trunk/MagicSoft/Mars/mbase/MArgs.h
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MArgs.h	(revision 4765)
+++ /trunk/MagicSoft/Mars/mbase/MArgs.h	(revision 4766)
@@ -27,5 +27,5 @@
 
 public:
-    MArgs(int argc, char **argv);
+    MArgs(int argc, char **argv, Bool_t root=kFALSE);
     ~MArgs();
 
Index: /trunk/MagicSoft/Mars/mbase/MStatusDisplay.cc
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MStatusDisplay.cc	(revision 4765)
+++ /trunk/MagicSoft/Mars/mbase/MStatusDisplay.cc	(revision 4766)
@@ -1131,4 +1131,10 @@
 void MStatusDisplay::Reset()
 {
+    if (gROOT->IsBatch())
+    {
+        fBatch->Delete();
+        return;
+    }
+
     for (int i=fTab->GetNumberOfTabs()-1; i>0; i--)
         RemoveTab(i);
Index: /trunk/MagicSoft/Mars/mcalib/MCalibrateData.cc
===================================================================
--- /trunk/MagicSoft/Mars/mcalib/MCalibrateData.cc	(revision 4765)
+++ /trunk/MagicSoft/Mars/mcalib/MCalibrateData.cc	(revision 4766)
@@ -430,7 +430,8 @@
     if (calibConv != 0. && calibQE != 0.)
     {
-        const Float_t calibConv2 = calibConv*calibConv;
-        calibConvVar  = calibConvVar/calibConv2 + calibQEVar/(calibQE*calibQE);
-        calibConvVar *= calibConv2;
+        // Now doing:
+        // calibConvVar  = calibConvVar/(calibConv*calibConv) + calibQEVar/(calibQE*calibQE);
+        // calibConvVar *= (calibConv*calibConv);
+        calibConvVar += calibQEVar*(calibConv*calibConv)/(calibQE*calibQE);
     }
 
Index: /trunk/MagicSoft/Mars/mfileio/MReadReports.cc
===================================================================
--- /trunk/MagicSoft/Mars/mfileio/MReadReports.cc	(revision 4765)
+++ /trunk/MagicSoft/Mars/mfileio/MReadReports.cc	(revision 4766)
@@ -113,4 +113,40 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Return the number of entries in all trees.
+//
+UInt_t MReadReports::GetEntries()
+{
+    UInt_t n=0;
+
+    TIter NextT(fTrees->GetList());
+    MReadTree *tree=0;
+    while ((tree=(MReadTree*)NextT()))
+        n += tree->GetEntries();
+
+    return n;
+}
+
+// --------------------------------------------------------------------------
+//
+// In case of a Master Tree GetFileName() of the MReadMarsFile is returned.
+// If no master is available "<MReadReports>" is returned.
+//
+TString MReadReports::GetFileName() const
+{
+    if (!TestBit(kHasMaster))
+        return "<MReadReports>";
+
+    TIter NextT(fTrees->GetList());
+    MReadTree *tree=0;
+    while ((tree=(MReadTree*)NextT()))
+        if (tree->InheritsFrom("MReadMarsFile"))
+            return tree->GetFileName();
+
+    return "<n/a>";
+
+}
+
 void MReadReports::AddToBranchList(const char *name)
 {
@@ -150,5 +186,5 @@
     t->SetTitle(time?time:"");
     if (master)
-        t->SetBit(kHasMaster);
+        SetBit(kHasMaster);
 
     if (!fEnableAutoScheme)
Index: /trunk/MagicSoft/Mars/mfileio/MReadReports.h
===================================================================
--- /trunk/MagicSoft/Mars/mfileio/MReadReports.h	(revision 4765)
+++ /trunk/MagicSoft/Mars/mfileio/MReadReports.h	(revision 4766)
@@ -30,6 +30,6 @@
     Int_t   FindNextTime();
 
-    UInt_t  GetEntries() { return 0; }
-    TString GetFileName() const { return "<MReadReports>"; };
+    UInt_t  GetEntries();
+    TString GetFileName() const;
 
     Int_t   PreProcess(MParList *plist);
@@ -37,9 +37,6 @@
     Int_t   PostProcess();
 
-    //Bool_t  Notify();
-
     enum {
-        //MReadTree::kChainWasChanged = BIT(14)
-        kHasMaster = BIT(15)
+        kHasMaster = BIT(14)
     };
 
Index: /trunk/MagicSoft/Mars/mfileio/MReadTree.cc
===================================================================
--- /trunk/MagicSoft/Mars/mfileio/MReadTree.cc	(revision 4765)
+++ /trunk/MagicSoft/Mars/mfileio/MReadTree.cc	(revision 4766)
@@ -566,5 +566,5 @@
         ResetBit(kChainWasChanged);
     }
-    return fNumEntries;
+    return fNumEntries==TChain::kBigNumber ? 0 : fNumEntries;
 }
 
@@ -616,4 +616,7 @@
     //
     fChain->ResetTree();
+    // Maybe this would be enough, but the above might be safer...
+    //if (fChain->GetTreeNumber()==0)
+    //    fChain->ResetTree();
 
     //
Index: /trunk/MagicSoft/Mars/msignal/MExtractFixedWindow.cc
===================================================================
--- /trunk/MagicSoft/Mars/msignal/MExtractFixedWindow.cc	(revision 4765)
+++ /trunk/MagicSoft/Mars/msignal/MExtractFixedWindow.cc	(revision 4766)
@@ -165,9 +165,9 @@
   *fLog << endl;
   *fLog << inf << GetDescriptor() << ": Taking " << fNumHiGainSamples
-        << " HiGain FADC samples from slice: " << (Int_t)fHiGainFirst 
-        << " to (including) slice: " << (Int_t)(fHiGainLast+fHiLoLast) << endl;
+        << " HiGain samples from slice " << (Int_t)fHiGainFirst
+        << " to " << (Int_t)(fHiGainLast+fHiLoLast) << "incl" << endl;
   *fLog << inf << GetDescriptor() << ": Taking " << fNumLoGainSamples
-        << " LoGain FADC samples from slice: " << (Int_t)fLoGainFirst 
-        << " to (including) slice: " << (Int_t)fLoGainLast << endl;
+        << " LoGain samples from slice " << (Int_t)fLoGainFirst
+        << " to " << (Int_t)fLoGainLast << "incl" << endl;
   return kTRUE;
   
