Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 3388)
+++ trunk/MagicSoft/Mars/Changelog	(revision 3389)
@@ -4,16 +4,48 @@
 
                                                  -*-*- END OF LINE -*-*-
+ 2004/03/03: Thomas Bretz
+
+   * mgeom/MGeomCam.cc:
+     - give a name and title also if the default constructor is used
+
+   * mgeom/MGeomMirror.[h,cc]:
+     - added member function GetReflection
+     - added persistent data member fReflector
+
+   * mjobs/MJCalibration.cc, mjobs/MJExtractSignal.cc, mjobs/MJPedestal.cc:
+     - fixed a typo in the output
+
+   * mraw/MRawFileWrite.cc:
+     - added the missing '.' to MRawRunHeader. Because of the design of
+       MReadTree this is backward compatible
+
+   * mraw/MRawRunHeader.h:
+     - removed last change from Abelardo. '>255' is the correct 
+       check for MC files following the definition that all MC files
+       have run types >255 which was made in the past. 
+
+   * manalysis/MCerPhotAnal.[h,cc], manalysis/MCerPhotAnal2.[h,cc]:
+     - created ReInit member function to hold all code (moved from
+       PreProcess) accessing the run header. The run header is not
+       available in PreProcess. That it was working before was only
+       by chance, because the run type is initialized with 65535 which
+       is != 255 but not >255.
+
+
 
  2004/03/03: Sebastian Raducci
+
    * msignal/MArrivalTimeCalc.cc
      - The calculation of the arrival times is made only when needed
        (when the HalfMax is over the pedestal)
 
+
+
  2004/03/03: Abelardo Moralejo
+
    * mraw/MRawRunHeader.h
      - Replaced
          Bool_t IsMonteCarloRun() const { return fRunType>0x00ff; }  by
          Bool_t IsMonteCarloRun() const { return (fRunType==0x0100); }
-
      since the latter is the exact translation of what the function
      intends to do. I do not know why, but the display of real data 
@@ -24,4 +56,6 @@
        fails after that change, both for old and new camera files. 
        Put back fPixels[i] = new MGeomPix; in constructor.
+
+
 
  2004/03/02: Abelardo Moralejo
@@ -33,9 +67,8 @@
      - Added GetNumCT() function.
      - Replaced
-          fTelescopes[i]= new MGeomCorsikaCT;   by
-
+          fTelescopes[i]= new MGeomCorsikaCT;   
+       by
           MGeomCorsikaCT* dummy = new  MGeomCorsikaCT();
           fTelescopes.Add(dummy);
-
 
    * mgeom/MGeomCorsikaCT.[h,cc]
@@ -45,8 +78,9 @@
    * mgeom/MGeomCam.cc  => NOTE: this change was undone later!
      - Replaced
-	fPixels[i] = new MGeomPix;   by
-
-        MGeomPix* dummy = new MGeomPix();
-        fPixels.Add(dummy);
+          fPixels[i] = new MGeomPix;   
+       by
+          MGeomPix* dummy = new MGeomPix();
+          fPixels.Add(dummy);
+
 
 
Index: trunk/MagicSoft/Mars/manalysis/MCerPhotAnal.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MCerPhotAnal.cc	(revision 3388)
+++ trunk/MagicSoft/Mars/manalysis/MCerPhotAnal.cc	(revision 3389)
@@ -103,6 +103,13 @@
         return kFALSE;
 
+    return kTRUE;
+}
+
+Bool_t MCerPhotAnal::ReInit(MParList *pList)
+{
     fPedestals = NULL;
 
+    // This must be done in ReInit because in PreProcess the
+    // headers are not available
     const MRawRunHeader *runheader = (MRawRunHeader*)pList->FindObject("MRawRunHeader");
     if (!runheader)
Index: trunk/MagicSoft/Mars/manalysis/MCerPhotAnal.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MCerPhotAnal.h	(revision 3388)
+++ trunk/MagicSoft/Mars/manalysis/MCerPhotAnal.h	(revision 3389)
@@ -27,6 +27,7 @@
     MRawRunHeader *fRunHeader;  // RunHeader information
 
-    Int_t PreProcess(MParList *pList);
-    Int_t Process();
+    Int_t  PreProcess(MParList *pList);
+    Bool_t ReInit(MParList *pList);
+    Int_t  Process();
  
 public:
Index: trunk/MagicSoft/Mars/manalysis/MCerPhotAnal2.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MCerPhotAnal2.cc	(revision 3388)
+++ trunk/MagicSoft/Mars/manalysis/MCerPhotAnal2.cc	(revision 3389)
@@ -106,12 +106,22 @@
         return kFALSE;
 
+    return kTRUE;
+}
+
+Bool_t MCerPhotAnal2::ReInit(MParList *pList)
+{
     fPedestals=NULL;
 
+    // This must be done in ReInit because in PreProcess the
+    // headers are not available
     const MRawRunHeader *runheader = (MRawRunHeader*)pList->FindObject("MRawRunHeader");
     if (!runheader)
         *fLog << warn << dbginf << "Warning - cannot check file type, MRawRunHeader not found." << endl;
     else
+    {
+        *fLog << all << "CHECK: " << runheader->GetRunType() << endl;
         if (runheader->IsMonteCarloRun())
             return kTRUE;
+    }
 
     fPedestals = (MPedPhotCam*)pList->FindCreateObj("MPedPhotCam");
Index: trunk/MagicSoft/Mars/manalysis/MCerPhotAnal2.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MCerPhotAnal2.h	(revision 3388)
+++ trunk/MagicSoft/Mars/manalysis/MCerPhotAnal2.h	(revision 3389)
@@ -33,7 +33,8 @@
     Int_t fSkip;                //!
 
-    Int_t PreProcess(MParList *pList);
-    Int_t Process();
-    Int_t PostProcess();
+    Int_t  PreProcess(MParList *pList);
+    Bool_t ReInit(MParList *pList);
+    Int_t  Process();
+    Int_t  PostProcess();
 
 public:
Index: trunk/MagicSoft/Mars/mraw/MRawRunHeader.h
===================================================================
--- trunk/MagicSoft/Mars/mraw/MRawRunHeader.h	(revision 3388)
+++ trunk/MagicSoft/Mars/mraw/MRawRunHeader.h	(revision 3389)
@@ -80,10 +80,10 @@
     UShort_t GetFormatVersion() const     { return fFormatVersion; }
     UShort_t GetSoftVersion() const       { return fSoftVersion; }
+    UInt_t   GetRunNumber() const         { return fRunNumber; }
     UShort_t GetRunType() const           { return fRunType; }
-    const char *GetRunTypeStr() const;
-    UInt_t   GetRunNumber() const         { return fRunNumber; }
-    const Char_t  *GetProjectName() const { return fProjectName; }
-    const Char_t  *GetSourceName() const  { return fSourceName; }
-    const Char_t  *GetSourceEpocheChar() const { return fSourceEpochChar; }
+    const Char_t *GetRunTypeStr() const;
+    const Char_t *GetProjectName() const { return fProjectName; }
+    const Char_t *GetSourceName() const  { return fSourceName; }
+    const Char_t *GetSourceEpocheChar() const { return fSourceEpochChar; }
     UShort_t GetSourceEpocheDate() const  { return fSourceEpochDate; }
     UShort_t GetNumCrates() const         { return fNumCrates; }
@@ -106,5 +106,5 @@
     Int_t GetNumTotalBytes() const;
 
-    Bool_t IsMonteCarloRun() const { return (fRunType==0x0100); }
+    Bool_t IsMonteCarloRun() const { return fRunType>0x00ff; }
 
     void Print(Option_t *t=NULL) const;
