Index: /trunk/MagicSoft/Mars/Changelog
===================================================================
--- /trunk/MagicSoft/Mars/Changelog	(revision 8998)
+++ /trunk/MagicSoft/Mars/Changelog	(revision 8999)
@@ -18,4 +18,60 @@
 
                                                  -*-*- END OF LINE -*-*-
+
+ 2008/07/14 Thomas Bretz
+
+   * datacenter/macros/fillsignal.C:
+     - moved sql.rc to constructor of MSQLMagic
+
+   * datacenter/macros/plotstat.C:
+     - improved beauty of the SQL queries
+     - join by telescope number, run number and file number
+
+   * mbase/MString.[h,cc]:
+     - removed everything except Format which is then identical to
+       newwer root versions TString::Format
+
+   * mastro/MAstro.cc, mastro/MAstroCatalog.cc:
+     - replaced MString::Print by MString::Format
+
+   * mbase/MTime.cc:
+     - In SetSqlDateTime allow also to set dates without time
+
+   * mbase/Makefile, mbase/BaseLinkDef.h:
+     - removed MRunIter
+
+   * mfileio/MWriteRootFile.cc:
+     - sow in status line if a tree has been finally copied
+
+   * mhist/MHEvent.cc:
+     - replaced GetRunNumber by GetStringID
+
+   * mjobs/MJCalibrateSignal.cc:
+     - Replaced RunNumber by FileId in trogger pattern display
+     - do not allow to divide by 0
+
+   * mjobs/MJExtractSignal.cc, mjobs/MJCalibTest.cc:
+     - removed obsolete include of MDirIter
+
+   * mjobs/MJPedestal.cc, mjobs/MJCalibration.cc:
+     - replaced MRunIter by MDirIter
+
+   * mjobs/MSequence.[h,cc]:
+     - moved code to compile (inflate) a run filename or a its path
+       to new static function such that they can be accessed from the outside
+
+   * star.cc, callisto.cc, mjobs/MSequence.[h,cc], mmain/MEventDisplay.cc
+     - renamed InflatePath to InflateSeq
+
+   * mpedestal/MPedCalcPedRun.cc:
+     - when checking the runnumber check also for the telescope number
+
+   * mraw/MRawRunHeader.[h,cc]:
+     - added new function GetStringID
+
+   * mraw/RawLinkDef.h, mraw/Makefile:
+     - removed MRawSocketRead
+
+
 
  2008/07/08 Daniel Hoehne
Index: /trunk/MagicSoft/Mars/callisto.cc
===================================================================
--- /trunk/MagicSoft/Mars/callisto.cc	(revision 8998)
+++ /trunk/MagicSoft/Mars/callisto.cc	(revision 8999)
@@ -281,5 +281,5 @@
     TString kSequence = arg.GetArgumentStr(0);
 
-    if (!MSequence::InflatePath(kSequence, kIsMC))
+    if (!MSequence::InflateSeq(kSequence, kIsMC))
         return 3;
 
@@ -345,4 +345,6 @@
     MArray::Class()->IgnoreTObjectStreamer();
     MParContainer::Class()->IgnoreTObjectStreamer();
+
+    // FIXME: Remove all non-root arguments and options from argc, argv
 
     TApplication app("callisto", &argc, argv);
Index: /trunk/MagicSoft/Mars/datacenter/macros/fillsignal.C
===================================================================
--- /trunk/MagicSoft/Mars/datacenter/macros/fillsignal.C	(revision 8998)
+++ /trunk/MagicSoft/Mars/datacenter/macros/fillsignal.C	(revision 8999)
@@ -59,5 +59,4 @@
 #include <iomanip>
 
-#include <TEnv.h>
 #include <TRegexp.h>
 
@@ -381,7 +380,5 @@
 int fillsignal(TString fname, Bool_t dummy=kTRUE)
 {
-    TEnv env("sql.rc");
-
-    MSQLMagic serv(env);
+    MSQLMagic serv("sql.rc");
     if (!serv.IsConnected())
     {
Index: /trunk/MagicSoft/Mars/datacenter/macros/plotstat.C
===================================================================
--- /trunk/MagicSoft/Mars/datacenter/macros/plotstat.C	(revision 8998)
+++ /trunk/MagicSoft/Mars/datacenter/macros/plotstat.C	(revision 8999)
@@ -1,4 +1,4 @@
 /* ======================================================================== *\
-! $Name: not supported by cvs2svn $:$Id: plotstat.C,v 1.7 2008-07-05 19:01:42 tbretz Exp $
+! $Name: not supported by cvs2svn $:$Id: plotstat.C,v 1.8 2008-07-14 19:59:06 tbretz Exp $
 ! --------------------------------------------------------------------------
 !
@@ -319,36 +319,46 @@
 
     // 0: All data for which are files available
-    query[0]  = "select SUM(TIME_TO_SEC(TIMEDIFF(fRunStop, fRunStart)))/3600 ";
-    query[0] += "from RunData left join RunProcessStatus on RunData.fRunNumber=RunProcessStatus.fRunNumber ";
-    query[0] += "where fRunTypeKey=2 and not ISNULL(fRawFileAvail)";
+    query[0]  = "SELECT SUM(TIME_TO_SEC(TIMEDIFF(fRunStop, fRunStart)))/3600 ";
+    query[0] += "FROM RunData ";
+    query[0] += "LEFT JOIN RunProcessStatus USING (fTelescopeNumber, fRunNumber, fFileNumber) ";
+    query[0] += "WHERE fRunTypeKey=2 AND NOT ISNULL(fRawFileAvail)";
+    /*
+    if (tel>0)
+    {
+        query[0] += " AND fTelescopeNumber=";
+        query[0] += tel;
+    }
+    */
 
     // 1: All data
-    query[1]  = "select SUM(TIME_TO_SEC(TIMEDIFF(fRunStop,fRunStart)))/3600 ";
-    query[1] += "from RunData where fRunTypeKEY=2";
+    query[1]  = "SELECTT SUM(TIME_TO_SEC(TIMEDIFF(fRunStop,fRunStart)))/3600 ";
+    query[1] += "FROM RunData WHERE fRunTypeKEY=2";
 
     // 2: All data which is not excluded
-    query[2]  = "select SUM(TIME_TO_SEC(TIMEDIFF(fRunStop,fRunStart)))/3600 ";
-    query[2] += "from RunData where fRunTypeKEY=2 and fExcludedFDAKEY=1";
+    query[2]  = "SELECT SUM(TIME_TO_SEC(TIMEDIFF(fRunStop,fRunStart)))/3600 ";
+    query[2] += "FROM RunData WHERE fRunTypeKEY=2 AND fExcludedFDAKEY=1";
 
     // 3: All sequences
-    query[3]  = "select SUM(fRunTime)/3600 from Sequences";
+    query[3]  = "SELECT SUM(fRunTime)/3600 FROM Sequences";
 
     // 4: All sequences with callisto failed
-    query[4]  = "select SUM(fRunTime)/3600 from Sequences left join SequenceProcessStatus on ";
-    query[4] += "Sequences.fSequenceFirst=SequenceProcessStatus.fSequenceFirst where ";
-    query[4] += "ISNULL(fCallisto) and not ISNULL(fFailedTime) and not ISNULL(fAllFilesAvail)";
+    query[4]  = "SELECT SUM(fRunTime)/3600 FROM Sequences ";
+    query[4] += "LEFT JOIN SequenceProcessStatus USING (fSequenceFirst) ";
+    query[4] += "WHERE ISNULL(fCallisto) AND NOT ISNULL(fFailedTime) AND NOT ISNULL(fAllFilesAvail)";
 
     // 5: All sequences with callisto=OK
-    query[5]  = "select SUM(fRunTime)/3600 from Sequences left join SequenceProcessStatus on ";
-    query[5] += "Sequences.fSequenceFirst=SequenceProcessStatus.fSequenceFirst where not ISNULL(fCallisto)";
+    query[5]  = "SELECT SUM(fRunTime)/3600 FROM Sequences ";
+    query[5] += "LEFT JOIN SequenceProcessStatus USING (fSequenceFirst) ";
+    query[5] += "WHERE NOT ISNULL(fCallisto)";
 
     // 6: All sequences with star failed
-    query[6]  = "select SUM(fRunTime)/3600 from Sequences left join SequenceProcessStatus on ";
-    query[6] += "Sequences.fSequenceFirst=SequenceProcessStatus.fSequenceFirst where ";
-    query[6] += "ISNULL(fStar) and not ISNULL(fFailedTime) and not ISNULL(fCallisto)";
+    query[6]  = "SELECT SUM(fRunTime)/3600 FROM Sequences ";
+    query[6] += "LEFT JOIN SequenceProcessStatus USING (fSequenceFirst) ";
+    query[6] += "WHERE ISNULL(fStar) AND NOT ISNULL(fFailedTime) AND NOT ISNULL(fCallisto)";
 
     // 7: All sequences with star=OK
-    query[7]  = "select SUM(fRunTime)/3600 from Sequences left join SequenceProcessStatus on ";
-    query[7] += "Sequences.fSequenceFirst=SequenceProcessStatus.fSequenceFirst where not ISNULL(fStar)";
+    query[7]  = "SELECT SUM(fRunTime)/3600 FROM Sequences ";
+    query[7] += "LEFT JOIN SequenceProcessStatus USING (fSequenceFirst) ";
+    query[7] += "WHERE NOT ISNULL(fStar)";
 
     // 0: All data
Index: /trunk/MagicSoft/Mars/mastro/MAstro.cc
===================================================================
--- /trunk/MagicSoft/Mars/mastro/MAstro.cc	(revision 8998)
+++ /trunk/MagicSoft/Mars/mastro/MAstro.cc	(revision 8999)
@@ -213,7 +213,5 @@
     Deg2Dms(deg, sgn, d, m, s);
 
-    MString str;
-    str.Print(fmt, sgn, d, m ,s);
-    return str;
+    return MString::Format(fmt, sgn, d, m ,s);
 }
 
@@ -224,7 +222,5 @@
     Hor2Hms(deg, sgn, h, m, s);
 
-    MString str;
-    str.Print(fmt, sgn, h, m ,s);
-    return str;
+    return MString::Format(fmt, sgn, h, m ,s);
 }
 
Index: /trunk/MagicSoft/Mars/mastro/MAstroCatalog.cc
===================================================================
--- /trunk/MagicSoft/Mars/mastro/MAstroCatalog.cc	(revision 8998)
+++ /trunk/MagicSoft/Mars/mastro/MAstroCatalog.cc	(revision 8999)
@@ -1,4 +1,4 @@
 /* ======================================================================== *\
-! $Name: not supported by cvs2svn $:$Id: MAstroCatalog.cc,v 1.30 2008-06-02 08:46:39 tbretz Exp $
+! $Name: not supported by cvs2svn $:$Id: MAstroCatalog.cc,v 1.31 2008-07-14 19:59:08 tbretz Exp $
 ! --------------------------------------------------------------------------
 !
@@ -959,9 +959,7 @@
     const TVector2 deg = va*TMath::RadToDeg();
 
-    MString txt;
-    if (type==1)
-        txt.Print("Ra=%.2fh  Dec=%.1fd", fmod(deg.X()/15+48, 24),  fmod(90-deg.Y()+270,180)-90);
-    else
-        txt.Print("Zd=%.1fd  Az=%.1fd",  fmod(deg.Y()+270,180)-90, fmod(deg.X()+720, 360));
+    const TString txt = type==1 ?
+        MString::Format("Ra=%.2fh  Dec=%.1fd", fmod(deg.X()/15+48, 24),  fmod(90-deg.Y()+270,180)-90) :
+        MString::Format("Zd=%.1fd  Az=%.1fd",  fmod(deg.Y()+270,180)-90, fmod(deg.X()+720, 360));
 
     TMarker *tip=new TMarker(v0.X(), v0.Y(), kDot);
Index: /trunk/MagicSoft/Mars/mbase/BaseLinkDef.h
===================================================================
--- /trunk/MagicSoft/Mars/mbase/BaseLinkDef.h	(revision 8998)
+++ /trunk/MagicSoft/Mars/mbase/BaseLinkDef.h	(revision 8999)
@@ -32,5 +32,5 @@
 #pragma link C++ class MIter+;
 #pragma link C++ class MDirIter+;
-#pragma link C++ class MRunIter+;
+//#pragma link C++ class MRunIter+;
 #pragma link C++ class MThread+;
 
Index: /trunk/MagicSoft/Mars/mbase/MString.cc
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MString.cc	(revision 8998)
+++ /trunk/MagicSoft/Mars/mbase/MString.cc	(revision 8999)
@@ -18,5 +18,5 @@
 !   Author(s): Thomas Bretz, 3/2004 <mailto:tbretz@astro.uni-wuerzburg.de>
 !
-!   Copyright: MAGIC Software Development, 2000-2004
+!   Copyright: MAGIC Software Development, 2000-2008
 !
 !
@@ -44,4 +44,6 @@
 /////////////////////////////////////////////////////////////////////////////
 #include "MString.h"
+
+#include <stdarg.h>
 
 ClassImp(MString);
@@ -97,4 +99,5 @@
 //  string.Print("  MyString has %d bytes  ", 128).Strip(TString::kBoth);
 //
+/*
 MString &MString::Print(const char *fmt, ...)
 {
@@ -104,4 +107,5 @@
     return Print(fmt, ap);
 }
+*/
 
 // --------------------------------------------------------------------------
@@ -120,5 +124,6 @@
 // M/TString.
 //
-MString MString::Format(const char *fmt, ...)
+#if ROOT_VERSION_CODE<ROOT_VERSION(5,18,00)
+TString MString::Format(const char *fmt, ...)
 {
     va_list ap;
@@ -129,4 +134,5 @@
     return ret;
 }
+#endif
 
 // --------------------------------------------------------------------------
@@ -135,4 +141,5 @@
 // TString::Form didn't exist.
 //
+/*
 void MString::Form(const char *fmt, ...)
 {
@@ -142,2 +149,3 @@
     Print(fmt, ap);
 }
+*/
Index: /trunk/MagicSoft/Mars/mbase/MString.h
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MString.h	(revision 8998)
+++ /trunk/MagicSoft/Mars/mbase/MString.h	(revision 8999)
@@ -6,23 +6,23 @@
 #endif
 
-#include <stdio.h>
-#include <stdarg.h>
-
 class MString : public TString
 {
+private:
+    MString &Print(const char *fmt, va_list &ap);
+//    MString &Print(const char *fmt, ...);
+
 public:
     MString(const char *txt=0)  : TString(txt) { }
-    MString(const MString &txt) : TString(txt) { }
-
-    MString &Print(const char *fmt, va_list &ap);
-    MString &Print(const char *fmt, ...);
+    MString(const TString &txt) : TString(txt) { }
 
 #ifndef __CINT__
-    static MString Format(const char *fmt, ...);
+#if ROOT_VERSION_CODE<ROOT_VERSION(5,18,00)
+    static TString Format(const char *fmt, ...);
+#endif
 #endif
 
-    void Form(const char *fmt, ...);
+    //void Form(const char *fmt, ...);
 
-    ClassDef(MString, 1) // Tool to make Form() thread safe against other TStrings
+    ClassDef(MString, 1) // Tool to make Form() thread safe against other TStrings for root prior 5.18.00
 };
 
Index: /trunk/MagicSoft/Mars/mbase/MTime.cc
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MTime.cc	(revision 8998)
+++ /trunk/MagicSoft/Mars/mbase/MTime.cc	(revision 8999)
@@ -403,9 +403,12 @@
         return kFALSE;
 
-    UInt_t y, mon, d, h, m, s;
-    const Int_t n = sscanf(str, "%04u-%02u-%02u %02u:%02u:%02u",
-                           &y, &mon, &d, &h, &m, &s);
-
-    return n==6 ? Set(y, mon, d, h, m, s) : kFALSE;
+    UInt_t  y, mon, d, h, m, s;
+    if (6==sscanf(str, "%04u-%02u-%02u %02u:%02u:%02u", &y, &mon, &d, &h, &m, &s))
+        return Set(y, mon, d, h, m, s);
+
+    if (3==sscanf(str, "%04u-%02u-%02u", &y, &mon, &d))
+        return Set(y, mon, d);
+
+    return kFALSE;
 }
 
Index: /trunk/MagicSoft/Mars/mbase/Makefile
===================================================================
--- /trunk/MagicSoft/Mars/mbase/Makefile	(revision 8998)
+++ /trunk/MagicSoft/Mars/mbase/Makefile	(revision 8999)
@@ -43,5 +43,4 @@
            MIter.cc \
            MDirIter.cc \
-           MRunIter.cc \
            MReadSocket.cc \
            MGGroupFrame.cc \
Index: /trunk/MagicSoft/Mars/mfileio/MWriteRootFile.cc
===================================================================
--- /trunk/MagicSoft/Mars/mfileio/MWriteRootFile.cc	(revision 8998)
+++ /trunk/MagicSoft/Mars/mfileio/MWriteRootFile.cc	(revision 8999)
@@ -925,4 +925,10 @@
 
     *fLog << "done." << endl;
+
+    if (fDisplay)
+    {
+        out += " done.";
+        fDisplay->SetStatusLine2(out);
+    }
 }
 
Index: /trunk/MagicSoft/Mars/mhist/MHEvent.cc
===================================================================
--- /trunk/MagicSoft/Mars/mhist/MHEvent.cc	(revision 8998)
+++ /trunk/MagicSoft/Mars/mhist/MHEvent.cc	(revision 8999)
@@ -271,6 +271,6 @@
     if (fRawRunHeader)
     {
-        s += "Run #";
-        s += fRawRunHeader->GetRunNumber();
+        s += "M";
+        s += fRawRunHeader->GetStringID();
     }
     if (fTime)
Index: /trunk/MagicSoft/Mars/mjobs/MJCalibTest.cc
===================================================================
--- /trunk/MagicSoft/Mars/mjobs/MJCalibTest.cc	(revision 8998)
+++ /trunk/MagicSoft/Mars/mjobs/MJCalibTest.cc	(revision 8999)
@@ -42,5 +42,4 @@
 #include "MLogManip.h"
 
-#include "MRunIter.h"
 #include "MParList.h"
 #include "MTaskList.h"
Index: /trunk/MagicSoft/Mars/mjobs/MJCalibrateSignal.cc
===================================================================
--- /trunk/MagicSoft/Mars/mjobs/MJCalibrateSignal.cc	(revision 8998)
+++ /trunk/MagicSoft/Mars/mjobs/MJCalibrateSignal.cc	(revision 8999)
@@ -410,8 +410,8 @@
     MTriggerPatternDecode     decode;
 
-    MH3 hpat("MRawRunHeader.fRunNumber", "MTriggerPattern.GetUnprescaled");
-    hpat.SetWeight("1./MRawRunHeader.GetRunLength");
+    MH3 hpat("MRawRunHeader.GetFileID", "MTriggerPattern.GetUnprescaled");
+    hpat.SetWeight("1./TMath::Max(MRawRunHeader.GetRunLength,1)");
     hpat.SetName("TrigPat");
-    hpat.SetTitle("Rate of the trigger pattern [Hz];Run Number;Trigger Pattern;Rate [Hz]");
+    hpat.SetTitle("Rate of the trigger pattern [Hz];File Id;Trigger Pattern;Rate [Hz]");
     hpat.InitLabels(MH3::kLabelsXY);
     //hpat.DefineLabelsY("1=Lvl1;2=Cal;3=Cal;4=Lvl2;5=Cal;7=Cal;8=Ped;9=Ped+Trig;13=Ped+Trig;16=Pin;32=Sum");
Index: /trunk/MagicSoft/Mars/mjobs/MJCalibration.cc
===================================================================
--- /trunk/MagicSoft/Mars/mjobs/MJCalibration.cc	(revision 8998)
+++ /trunk/MagicSoft/Mars/mjobs/MJCalibration.cc	(revision 8999)
@@ -105,5 +105,5 @@
 
 #include "MEnv.h"
-#include "MRunIter.h"
+#include "MDirIter.h"
 #include "MSequence.h"
 #include "MParList.h"
Index: /trunk/MagicSoft/Mars/mjobs/MJExtractSignal.cc
===================================================================
--- /trunk/MagicSoft/Mars/mjobs/MJExtractSignal.cc	(revision 8998)
+++ /trunk/MagicSoft/Mars/mjobs/MJExtractSignal.cc	(revision 8999)
@@ -38,5 +38,4 @@
 #include "MLogManip.h"
 
-#include "MRunIter.h"
 #include "MParList.h"
 #include "MTaskList.h"
Index: /trunk/MagicSoft/Mars/mjobs/MJPedestal.cc
===================================================================
--- /trunk/MagicSoft/Mars/mjobs/MJPedestal.cc	(revision 8998)
+++ /trunk/MagicSoft/Mars/mjobs/MJPedestal.cc	(revision 8999)
@@ -52,7 +52,7 @@
 #include "MLogManip.h"
 
+#include "MDirIter.h"
 #include "MTaskEnv.h"
 #include "MSequence.h"
-#include "MRunIter.h"
 #include "MParList.h"
 #include "MTaskList.h"
Index: /trunk/MagicSoft/Mars/mjobs/MSequence.cc
===================================================================
--- /trunk/MagicSoft/Mars/mjobs/MSequence.cc	(revision 8998)
+++ /trunk/MagicSoft/Mars/mjobs/MSequence.cc	(revision 8999)
@@ -379,4 +379,17 @@
 }
 
+TString MSequence::InflateRunPath(const MTime &night, Bool_t mc)
+{
+    TString rc = GetStandardPath(mc);
+    rc += "rawfiles/";
+    rc += night.GetStringFmt("%Y/%m/%d/");
+    return rc;
+}
+
+TString MSequence::InflateRunPath(const MTime &night, UShort_t tel, Int_t run, Int_t file, Int_t type)
+{
+    return InflateRunPath(night)+InflateRunName(night, tel, run, file, type);
+}
+
 // --------------------------------------------------------------------------
 //
@@ -421,12 +434,5 @@
 }
 
-// --------------------------------------------------------------------------
-//
-// Return the expression describing the file-name for the file defined
-// by i-th entry of the the given arrays. The file type identifier is
-// defined by type. The source name is replaced by a wildcard and
-// the extension is defined by the type as well.
-//
-TString MSequence::GetFileName(UInt_t i, const TArrayI &arr, const TArrayI &sub, FileType_t type) const
+TString MSequence::InflateRunName(const MTime &night, UShort_t tel, Int_t run, Int_t file, Int_t type)
 {
     const char *id="_";
@@ -458,16 +464,22 @@
 
     // ------------- Create file name --------------
-    TString n = fNight.GetStringFmt("%Y%m%d_");
-
-    if (arr[i]>999999)
-        n += "M1_";
-
-    // R. DeLosReyes and T. Bretz
-    // Changes to read the DAQ numbering format. Changes takes place
-    // between runs 35487 and 00035488 (2004_08_30)
-    n += Form(arr[i]>35487 || fMonteCarlo ? "%08d" : "%05d", arr[i]);
-
-    if (arr[i]>999999 && sub.GetSize()>0)
-        n += Form(".%05d", sub[i]);
+    TString n = night.GetStringFmt("%Y%m%d_");
+
+    // This is for MCs (FIXME!!!!)
+    if (run<0)
+        n += Form("%08d", -run);
+    else
+    {
+        if (tel>0)
+            n += Form("M%d_", tel);
+
+        // R. DeLosReyes and T. Bretz
+        // Changes to read the DAQ numbering format. Changes takes place
+        // between runs 35487 and 00035488 (2004_08_30)
+        n += Form(run>35487 ? "%08d" : "%05d", run);
+
+        if (tel>0)
+            n += Form(".%05d", file);
+    }
 
     n += "_";
@@ -475,5 +487,5 @@
     n += "_*";
 
-    if (arr[i]<1000000)
+    if (tel==0)
         n += "_E";
 
@@ -484,5 +496,5 @@
     case kRawCal:
     case kRawAll:
-        n += ".raw.?g?z?";
+        n += ".raw.?g?z?";  // TPRegexp: (\.gz)?
         break;
     default:
@@ -491,4 +503,17 @@
 
     return n;
+}
+
+// --------------------------------------------------------------------------
+//
+// Return the expression describing the file-name for the file defined
+// by i-th entry of the the given arrays. The file type identifier is
+// defined by type. The source name is replaced by a wildcard and
+// the extension is defined by the type as well.
+//
+TString MSequence::GetFileName(UInt_t i, const TArrayI &arr, const TArrayI &sub, FileType_t type) const
+{
+    const Int_t tel = 1;
+    return InflateRunName(fNight, arr[i]>999999?tel:0, fMonteCarlo?-arr[i]:arr[i], sub.GetSize()>0?sub[i]:0, type);
 }
 
@@ -1183,5 +1208,5 @@
 // Returns if file accessible or not.
 //
-Bool_t MSequence::InflatePath(TString &seq, Bool_t ismc)
+Bool_t MSequence::InflateSeq(TString &seq, Bool_t ismc)
 {
     if (seq.IsDigit())
Index: /trunk/MagicSoft/Mars/mjobs/MSequence.h
===================================================================
--- /trunk/MagicSoft/Mars/mjobs/MSequence.h	(revision 8998)
+++ /trunk/MagicSoft/Mars/mjobs/MSequence.h	(revision 8999)
@@ -27,4 +27,6 @@
 
     UInt_t fSequence;          // Sequence number
+
+    // FIXME: UShort_t fTelescopeNumber ???
 
     MTime  fStart;             // Start time of sequence
@@ -170,7 +172,17 @@
     const TString &GetDataPath() const { return fDataPath; }
 
-    const TString GetStandardPath() const { return fMonteCarlo?"/magic/montecarlo/":"/magic/data/"; }
+    const TString  GetStandardPath() const { return GetStandardPath(fMonteCarlo); }
 
-    static Bool_t InflatePath(TString &seq, Bool_t ismc=kFALSE);
+    // Static function for external access
+    static TString GetStandardPath(Bool_t mc) { return mc?"/magic/montecarlo/":"/magic/data/"; }
+    static Bool_t  InflateSeq(TString &seq, /*FIXME: TELNUM*/ Bool_t ismc=kFALSE);
+
+    static TString InflateRunName(const MTime &night, UShort_t tel, Int_t run, Int_t file, Int_t type=kRawAll);
+    static TString InflateRunName(const MTime &night, Int_t run, Int_t type=kRawAll) { return InflateRunName(night, 1, run, 0, type); }
+
+    static TString InflateRunPath(const MTime &night, UShort_t tel, Int_t run, Int_t file=0, Int_t type=kRawAll);
+    static TString InflateRunPath(const MTime &night, Int_t run, Int_t type=kRawAll) { return InflateRunPath(night, 1, run, 0, type); }
+
+    static TString InflateRunPath(const MTime &night, Bool_t mc=kFALSE);
 
     ClassDef(MSequence, 5) // Describes a sequences, reads and writes sequence files
Index: /trunk/MagicSoft/Mars/mmain/MEventDisplay.cc
===================================================================
--- /trunk/MagicSoft/Mars/mmain/MEventDisplay.cc	(revision 8998)
+++ /trunk/MagicSoft/Mars/mmain/MEventDisplay.cc	(revision 8999)
@@ -1,4 +1,4 @@
 /* ======================================================================== *\
-! $Name: not supported by cvs2svn $:$Id: MEventDisplay.cc,v 1.63 2008-06-12 14:40:21 tbretz Exp $
+! $Name: not supported by cvs2svn $:$Id: MEventDisplay.cc,v 1.64 2008-07-14 19:59:11 tbretz Exp $
 ! --------------------------------------------------------------------------
 !
@@ -200,5 +200,5 @@
     }
 
-    if (type==0 && !MSequence::InflatePath(fname))
+    if (type==0 && !MSequence::InflateSeq(fname))
         return;
 
Index: /trunk/MagicSoft/Mars/mpedestal/MPedCalcPedRun.cc
===================================================================
--- /trunk/MagicSoft/Mars/mpedestal/MPedCalcPedRun.cc	(revision 8998)
+++ /trunk/MagicSoft/Mars/mpedestal/MPedCalcPedRun.cc	(revision 8999)
@@ -1,4 +1,4 @@
 /* ======================================================================== *\
-! $Name: not supported by cvs2svn $:$Id: MPedCalcPedRun.cc,v 1.52 2007-12-14 09:56:03 tbretz Exp $
+! $Name: not supported by cvs2svn $:$Id: MPedCalcPedRun.cc,v 1.53 2008-07-14 19:59:12 tbretz Exp $
 ! --------------------------------------------------------------------------
 !
@@ -323,5 +323,5 @@
 Bool_t MPedCalcPedRun::IsPedBitSet()
 {
-    if (fRunHeader->GetRunNumber()<gkFirstRunWithFinalBits)
+    if (fRunHeader->GetTelescopeNumber()==1 && fRunHeader->GetRunNumber()<gkFirstRunWithFinalBits)
         return kFALSE;
 
Index: /trunk/MagicSoft/Mars/mraw/MRawRunHeader.cc
===================================================================
--- /trunk/MagicSoft/Mars/mraw/MRawRunHeader.cc	(revision 8998)
+++ /trunk/MagicSoft/Mars/mraw/MRawRunHeader.cc	(revision 8999)
@@ -156,4 +156,5 @@
 
 #include "MArrayS.h"
+#include "MString.h"
 
 ClassImp(MRawRunHeader);
@@ -268,4 +269,17 @@
 // --------------------------------------------------------------------------
 //
+// Return Telescope number, runnumber and filenumber on the form:
+//      run
+// as string for runnumber<1000000 and
+//      telescope:run/file
+// otherwise.
+//
+TString  MRawRunHeader::GetStringID() const
+{
+    return fRunNumber<1000000?MString::Format("%d", fRunNumber):MString::Format("%d:%d/%d", fTelescopeNumber, fRunNumber, fFileNumber);
+}
+
+// --------------------------------------------------------------------------
+//
 // Consistency checks. See code for detils.
 //
Index: /trunk/MagicSoft/Mars/mraw/MRawRunHeader.h
===================================================================
--- /trunk/MagicSoft/Mars/mraw/MRawRunHeader.h	(revision 8998)
+++ /trunk/MagicSoft/Mars/mraw/MRawRunHeader.h	(revision 8999)
@@ -108,4 +108,5 @@
     UInt_t   GetTypeID() const            { return (fRunNumber/1000000)%100; }
     UInt_t   GetFileID() const            { return fRunNumber>1000000?(fRunNumber%1000000)*1000+(fFileNumber%1000):fRunNumber; }
+    TString  GetStringID() const;
     UShort_t GetTelescopeNumber() const   { return fRunType; }
     UShort_t GetRunType() const           { return fRunType; }
Index: /trunk/MagicSoft/Mars/mraw/Makefile
===================================================================
--- /trunk/MagicSoft/Mars/mraw/Makefile	(revision 8998)
+++ /trunk/MagicSoft/Mars/mraw/Makefile	(revision 8999)
@@ -29,6 +29,5 @@
 	   MRawCrateData.cc \
            MRawRead.cc \
-           MRawFileRead.cc \
-           MRawSocketRead.cc
+           MRawFileRead.cc
 
 ############################################################
Index: /trunk/MagicSoft/Mars/mraw/RawLinkDef.h
===================================================================
--- /trunk/MagicSoft/Mars/mraw/RawLinkDef.h	(revision 8998)
+++ /trunk/MagicSoft/Mars/mraw/RawLinkDef.h	(revision 8999)
@@ -15,6 +15,6 @@
 
 #pragma link C++ class MRawRead+;
-#pragma link C++ class MRawSocketRead+;
 #pragma link C++ class MRawFileRead+;
+//#pragma link C++ class MRawSocketRead+;
 //#pragma link C++ class MRawFileWrite+;
 
Index: /trunk/MagicSoft/Mars/star.cc
===================================================================
--- /trunk/MagicSoft/Mars/star.cc	(revision 8998)
+++ /trunk/MagicSoft/Mars/star.cc	(revision 8999)
@@ -180,5 +180,5 @@
     // Something special for datacenter access
     //
-    if (!MSequence::InflatePath(kSequence, kIsMC))
+    if (!MSequence::InflateSeq(kSequence, kIsMC))
         return 2;
 
