Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 1171)
+++ trunk/MagicSoft/Mars/Changelog	(revision 1172)
@@ -1,5 +1,31 @@
                                                                   -*-*- END -*-*-
+ 2002/01/14: Thomas Bretz
+ 
+   * manalysis/MMcPedestalCopy.cc, manalysis/MMcPedestalNSBAdd.cc:
+     - added comments
+
+   * mbase/MReadMarsFile.cc:
+     - changed output when switching to new file
+     
+   * meventdisp/MGFadcDisp.cc:
+     - made char array in constructor const
+     - changed char-array to TString
+
+   * mmain/MBrowser.[h,cc]:
+     - changed char-arrays to TString
+
+   * mmain/MDataCheck.[h,cc]:
+     - made char array in constructor const
+     
+   * Makefile.conf.linux, Makefile.conf.linux-gnu:
+     - changed to O5
+     
+   * mbase/MEvtLoop.cc:
+     - check for inheritance from MTaskList
+
+
+
  2002/01/11: Oscar Blanch Bigas
-   * main/MAnalysis.cc:
+   * mmain/MAnalysis.cc:
      - added MBlindPixelCalc step.
 
Index: trunk/MagicSoft/Mars/Makefile.conf.linux
===================================================================
--- trunk/MagicSoft/Mars/Makefile.conf.linux	(revision 1171)
+++ trunk/MagicSoft/Mars/Makefile.conf.linux	(revision 1172)
@@ -20,5 +20,5 @@
 #  ----->>>   settings for compilation
 #
-OPTIM    = -O3 -Wall -fno-rtti -fnonnull-objects -fno-exceptions -fPIC -Wtraditional -Wpointer-arith -Wcast-align -Wconversion -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Woverloaded-virtual
+OPTIM    = -O5 -Wall -fno-rtti -fnonnull-objects -fno-exceptions -fPIC -Wtraditional -Wpointer-arith -Wcast-align -Wconversion -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Woverloaded-virtual
 DEBUG    =
 ARCHDEF  = -D__LINUX__
Index: trunk/MagicSoft/Mars/Makefile.conf.linux-gnu
===================================================================
--- trunk/MagicSoft/Mars/Makefile.conf.linux-gnu	(revision 1171)
+++ trunk/MagicSoft/Mars/Makefile.conf.linux-gnu	(revision 1172)
@@ -20,5 +20,5 @@
 #
 
-OPTIM    = -O3 -Wall -fno-rtti -fnonnull-objects -fno-exceptions -fPIC -Wtraditional -Wpointer-arith -Wcast-align -Wconversion -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Woverloaded-virtual
+OPTIM    = -O5 -Wall -fno-rtti -fnonnull-objects -fno-exceptions -fPIC -Wtraditional -Wpointer-arith -Wcast-align -Wconversion -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Woverloaded-virtual
 DEBUG    =
 ARCHDEF  = -D__LINUX__
Index: trunk/MagicSoft/Mars/NEWS
===================================================================
--- trunk/MagicSoft/Mars/NEWS	(revision 1171)
+++ trunk/MagicSoft/Mars/NEWS	(revision 1172)
@@ -21,4 +21,7 @@
 
    - Introduced MMcRunHeaders which contains monte carlo run informations
+
+   - Added a 'Print'-Task (MPrint) which calls the Print function
+     of a parameter container for each event
 
 
Index: trunk/MagicSoft/Mars/manalysis/MMcPedestalCopy.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MMcPedestalCopy.cc	(revision 1171)
+++ trunk/MagicSoft/Mars/manalysis/MMcPedestalCopy.cc	(revision 1172)
@@ -26,4 +26,5 @@
 //                                                                         //
 //  MMcPedestalCopy                                                        //
+//                                                                         //
 //  This task looks for the ìnformation about FADC pedestals in            //
 //  MMcFadcHeader and translates it to the pedestal values in              //
@@ -64,4 +65,10 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Check for the run type. Return kTRUE if it is a MC run or if there
+// is no MC run header (old camera files) kFALSE in case of a different
+// run type
+//
 Bool_t MMcPedestalCopy::CheckRunType(MParList *pList) const
 {
@@ -76,4 +83,9 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Check runtype and search for MPedestalCam and MMcFadcHeader.
+// If the runtype check fails the task is removed from the task list.
+//
 Bool_t MMcPedestalCopy::PreProcess(MParList *pList)
 {
@@ -99,4 +111,11 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Check for the runtype. (not yet: If the check fails the eventloop is
+// stopped.)
+// Initialize the size of MPedestalCam to the number of pixels from
+// MMcFadcHeader.
+//
 Bool_t MMcPedestalCopy::ReInit(MParList *pList)
 {
Index: trunk/MagicSoft/Mars/manalysis/MMcPedestalNSBAdd.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MMcPedestalNSBAdd.cc	(revision 1171)
+++ trunk/MagicSoft/Mars/manalysis/MMcPedestalNSBAdd.cc	(revision 1172)
@@ -33,5 +33,5 @@
 //  MPedestalCam the NSB contribution.                                     //
 //  The number of photons from the diffuse NSB follows a poisson           // 
-//  distribution with expected mean value X, then its standard desviation  //
+//  distribution with expected mean value X, then its standard deviation   //
 //  is sqrt(X).                                                            //
 //  X is the number of phe per ns so we have to convert in FADC counts per // 
@@ -85,4 +85,10 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Check for the run type. Return kTRUE if it is a MC run or if there
+// is no MC run header (old camera files) kFALSE in case of a different
+// run type
+//
 Bool_t MMcPedestalNSBAdd::CheckRunType(MParList *pList) const
 {
@@ -141,4 +147,28 @@
 
     return kTRUE;
+}
+
+Float_t MMcPedestalNSBAdd::GetDnsb(MParList *pList) const
+{
+    MMcRunHeader *mcrunheader = (MMcRunHeader*)pList->FindObject("MMcRunHeader");
+    if (!mcrunheader && fDnsbPixel < 0 )
+    {
+        *fLog << err << dbginf << "Using the default argument of MMcPedestalNSB::MMcPedestalNSB() ";
+        *fLog << "only allowed if MMcRunHeader is available... aborting." << endl;
+        return -1;
+    }
+
+    if (!mcrunheader)
+        return fDnsbPixel;
+
+    if (fDnsbPixel >= 0 && fDnsbPixel != mcrunheader->GetNumPheFromDNSB())
+    {
+        *fLog << warn << dbginf << "The MC file has been generated with diffuse nsb " << mcrunheader->GetNumPheFromDNSB();
+        *fLog <<" but you set up the diffuse NSB to " << fDnsbPixel << endl;
+
+        return fDnsbPixel;
+    }
+
+    return mcrunheader->GetNumPheFromDNSB();
 }
 
@@ -158,28 +188,4 @@
 //   - MPedestalCam
 //
-Float_t MMcPedestalNSBAdd::GetDnsb(MParList *pList) const
-{
-    MMcRunHeader *mcrunheader = (MMcRunHeader*)pList->FindObject("MMcRunHeader");
-    if (!mcrunheader && fDnsbPixel < 0 )
-    {
-        *fLog << err << dbginf << "Using the default argument of MMcPedestalNSB::MMcPedestalNSB() ";
-        *fLog << "only allowed if MMcRunHeader is available... aborting." << endl;
-        return -1;
-    }
-
-    if (!mcrunheader)
-        return fDnsbPixel;
-
-    if (fDnsbPixel >= 0 && fDnsbPixel != mcrunheader->GetNumPheFromDNSB())
-    {
-        *fLog << warn << dbginf << "The MC file has been generated with diffuse nsb " << mcrunheader->GetNumPheFromDNSB();
-        *fLog <<" but you set up the diffuse NSB to " << fDnsbPixel << endl;
-
-        return fDnsbPixel;
-    }
-
-    return mcrunheader->GetNumPheFromDNSB();
-}
-
 Bool_t MMcPedestalNSBAdd::ReInit(MParList *pList)
 {
Index: trunk/MagicSoft/Mars/mbase/MEvtLoop.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MEvtLoop.cc	(revision 1171)
+++ trunk/MagicSoft/Mars/mbase/MEvtLoop.cc	(revision 1172)
@@ -129,6 +129,12 @@
     }
 
+    if (!fTaskList->InheritsFrom("MTasklist"))
+    {
+        *fLog << err << dbginf << "'" << tlist << "' doesn't inherit from MTaskList!" << endl;
+        return kFALSE;
+    }
+
     if (fLog != &gLog)
-        fParList ->SetLogStream(fLog);
+        fParList->SetLogStream(fLog);
 
     //
Index: trunk/MagicSoft/Mars/mbase/MReadMarsFile.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MReadMarsFile.cc	(revision 1171)
+++ trunk/MagicSoft/Mars/mbase/MReadMarsFile.cc	(revision 1172)
@@ -114,6 +114,9 @@
     if (fRun->Process())
     {
-        *fLog << inf << "MReadMarsFile: Switching to '" << GetFileName() << "' ";
-        *fLog << "(before processing event #" << GetEventNum()-1 << ")" << endl;
+        TString name(GetFileName());
+        name.Remove(0, name.Last('/')+1);
+
+        *fLog << inf << "MReadMarsFile: Switching to '" << name << "' ";
+        *fLog << "(before event #" << GetEventNum()-1 << ")" << endl;
 
         fTaskList->ReInit();
Index: trunk/MagicSoft/Mars/meventdisp/MGFadcDisp.cc
===================================================================
--- trunk/MagicSoft/Mars/meventdisp/MGFadcDisp.cc	(revision 1171)
+++ trunk/MagicSoft/Mars/meventdisp/MGFadcDisp.cc	(revision 1172)
@@ -112,5 +112,5 @@
 //  Constructor
 //
-MGFadcDisp::MGFadcDisp(char *filename, char *treename,
+MGFadcDisp::MGFadcDisp(const char *filename, const char *treename,
                        const TGWindow *p, const TGWindow *main,
                        UInt_t w, UInt_t h)
@@ -172,6 +172,6 @@
         while (pixel.Next())
         {
-            char txt[100];
-            sprintf(txt, "%d", pixel.GetPixelId());
+            TString txt;
+            txt += pixel.GetPixelId();
             fPixelList->AddEntry(txt, pixel.GetPixelId());
         }
@@ -193,7 +193,9 @@
     }
 
-    char txt[100];
-    sprintf(txt, "GRAPH%d", lastsel);
+    TString txt("GRAPH");
+    txt += lastsel;
+
     data->Draw(txt);
+
     fPixelList->Select(lastsel, kTRUE);
     fPixelList->SetTopEntry(lastsel);
Index: trunk/MagicSoft/Mars/meventdisp/MGFadcDisp.h
===================================================================
--- trunk/MagicSoft/Mars/meventdisp/MGFadcDisp.h	(revision 1171)
+++ trunk/MagicSoft/Mars/meventdisp/MGFadcDisp.h	(revision 1172)
@@ -22,5 +22,5 @@
 public:
 
-    MGFadcDisp(char *filename, char *treename,
+    MGFadcDisp(const char *filename, const char *treename,
                const TGWindow *p, const TGWindow *main, UInt_t w, UInt_t h);
 
Index: trunk/MagicSoft/Mars/mmain/MBrowser.cc
===================================================================
--- trunk/MagicSoft/Mars/mmain/MBrowser.cc	(revision 1171)
+++ trunk/MagicSoft/Mars/mmain/MBrowser.cc	(revision 1172)
@@ -280,6 +280,4 @@
                    main?main:gClient->GetRoot(), w, h)
 {
-    fInputFile[0] = '\0';
-
     fList = new MGList;
     fList->SetOwner();
@@ -382,5 +380,5 @@
     // Checks if there is a selected input root file
     //
-    return fInputFile[0]!='\0';
+    return !fInputFile.IsNull(); //[0]!='\0';
 }
 
@@ -417,43 +415,21 @@
 }
 
-void MBrowser::SetFileName(const char *name)
-{
-    //
-    // determine the file type by extensions
-    //
-    const char *ext=strrchr(name, '.');
-
-    Bool_t failed = kFALSE;
-
-    if (!ext)
-        failed = kTRUE;
-    else
-        if (strcasecmp(ext, ".root"))
-            failed = kTRUE;
-
-    char *fname=NULL;
-    if (!failed)
+void MBrowser::SetFileName(TString name)
+{
+    if (name[0]!='/')
     {
-        const char *dir = fFileCont->GetDirectory();
-
-        fname = Form("%s/%s", dir, name);
-
-        failed = gSystem->AccessPathName(fname, kFileExists);
+        name.Insert(0, "/");
+        name.Insert(0, fFileCont->GetDirectory());
     }
 
-    if (!failed)
-        strcpy(fInputFile, fname);
-    else
-        fname = Form(fInputFile);
-
-    char *slash = strrchr(fname, '/');
-
-    fEntry->SetText(slash ? slash+1 : "");
-
-    if (!slash)
+    if (gSystem->AccessPathName(name, kFileExists))
         return;
 
-    *slash = '\0';
-    ChangeDir(fname);
+    if (name.EndsWith(".root", TString::kIgnoreCase))
+        fInputFile = name;
+
+    fEntry->SetText(gSystem->BaseName(name));
+
+    ChangeDir(gSystem->DirName(name));
 }
 
@@ -483,23 +459,19 @@
     const TGTextLBEntry *selected = (TGTextLBEntry*)filter->GetListBox()->GetSelectedEntry();
 
-    const char *txt = StrDup(selected->GetText()->GetString());
-
     //
     // find filter and remove leading spaces
     //
-    char *lt = strchr(txt, '<');
-    if (lt)
-    {
-        do *lt-- = '\0';
-        while (lt>txt && *lt==' ');
-
-        //
-        // Set new filter and refresh the file container
-        //
-        fFileCont->SetFilter(txt);
-        fFileCont->DisplayDirectory();
-    }
-
-    delete [] txt;
+    TString txt = selected->GetText()->GetString();
+    if (txt.First('<') < 0)
+        return;
+
+    //
+    // Set new filter and refresh the file container
+    //
+    txt.Remove(txt.First('<'));
+
+    TString ftxt = txt.Strip();
+    fFileCont->SetFilter(ftxt);
+    fFileCont->DisplayDirectory();
 }
 
Index: trunk/MagicSoft/Mars/mmain/MBrowser.h
===================================================================
--- trunk/MagicSoft/Mars/mmain/MBrowser.h	(revision 1171)
+++ trunk/MagicSoft/Mars/mmain/MBrowser.h	(revision 1172)
@@ -36,5 +36,5 @@
     void CreateDirListBox(TGCompositeFrame *frame);
 
-    void SetFileName(const char *name);
+    void SetFileName(TString name);
 
     void SetFilter();
@@ -44,5 +44,5 @@
 protected:
     MGList *fList;
-    Char_t  fInputFile[256];
+    TString fInputFile;
 
     TGCompositeFrame *CreateNewTab(const char *name);
Index: trunk/MagicSoft/Mars/mmain/MDataCheck.cc
===================================================================
--- trunk/MagicSoft/Mars/mmain/MDataCheck.cc	(revision 1171)
+++ trunk/MagicSoft/Mars/mmain/MDataCheck.cc	(revision 1172)
@@ -97,5 +97,5 @@
 //  histograms.
 //
-void MDataCheck::ViewAdcSpectra(Char_t *inputfile, Char_t *treeName)
+void MDataCheck::ViewAdcSpectra(const Char_t *inputfile, const Char_t *treeName)
 {
     //
Index: trunk/MagicSoft/Mars/mmain/MDataCheck.h
===================================================================
--- trunk/MagicSoft/Mars/mmain/MDataCheck.h	(revision 1171)
+++ trunk/MagicSoft/Mars/mmain/MDataCheck.h	(revision 1172)
@@ -9,5 +9,5 @@
 {
 private:
-    void ViewAdcSpectra(Char_t *inputfile, Char_t *treeName);
+    void ViewAdcSpectra(const Char_t *inputfile, const Char_t *treeName);
 
 public:
