Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 3373)
+++ trunk/MagicSoft/Mars/Changelog	(revision 3374)
@@ -13,4 +13,6 @@
      - fixed an include (from MArrivalTime.h to MArrivalTimeCam.h)
 
+
+
  2004/03/01: Wolfgang Wittek
   
@@ -46,4 +48,31 @@
    * mhist/MHStarMap.[h,cc]:
      - changes to use MObservatory member function
+
+   * manalysis/MCerPhotAnal.cc, manalysis/MCerPhotAnal2.cc,
+     manalysis/MCerPhotCalc.cc, manalysis/MMcCalibrationUpdate.cc,
+     manalysis/MMcPedestalCopy.cc, manalysis/MMcPedestalNSBAdd.cc,
+     manalysis/MPedCalcPedRun.cc, manalysis/MPedPhotCalc.cc,
+     mcalib/MCalibrationChargeCalc.cc, mcalib/MMcCalibrationCalc.cc
+     - changed to use IsMonteCarloRun() now
+
+   * manalysis/MMcCalibrationUpdate.cc:
+     - unified output to log-stream
+     - replaced sqrt by TMath::Sqrt
+
+   * mcalib/MCalibrationChargeCalc.cc:
+     - unified output to log-stream
+     - removed .Data() from TString where obsolete
+     - fixed memory leak using gSystem->ExpandPathName
+
+   * mpointing/MPointingPosCalc.cc, mraw/MRawFileWrite.cc:
+     - adde class name to used kRT*/kTT* enums
+
+   * mraw/MRawEvtHeader.h:
+     - made enum data member of class
+
+   * mraw/MRawRunHeader.[h,cc]:
+     - made kMagicNumber and kMaxFormatVersion a static data
+       member of the class
+     - added IsMonteCarloRun member function
 
 
Index: trunk/MagicSoft/Mars/manalysis/MCerPhotAnal.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MCerPhotAnal.cc	(revision 3373)
+++ trunk/MagicSoft/Mars/manalysis/MCerPhotAnal.cc	(revision 3374)
@@ -103,13 +103,12 @@
         return kFALSE;
 
+    fPedestals = NULL;
+
     const MRawRunHeader *runheader = (MRawRunHeader*)pList->FindObject("MRawRunHeader");
     if (!runheader)
         *fLog << warn << dbginf << "Warning - cannot check file type, MRawRunHeader not found." << endl;
     else
-        if (runheader->GetRunType() == kRTMonteCarlo)
-        {
-            fPedestals=NULL;
+        if (runheader->IsMonteCarloRun())
             return kTRUE;
-        }
 
     fPedestals = (MPedestalCam*)pList->FindCreateObj("MPedestalCam");
Index: trunk/MagicSoft/Mars/manalysis/MCerPhotAnal2.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MCerPhotAnal2.cc	(revision 3373)
+++ trunk/MagicSoft/Mars/manalysis/MCerPhotAnal2.cc	(revision 3374)
@@ -106,13 +106,12 @@
         return kFALSE;
 
+    fPedestals=NULL;
+
     const MRawRunHeader *runheader = (MRawRunHeader*)pList->FindObject("MRawRunHeader");
     if (!runheader)
         *fLog << warn << dbginf << "Warning - cannot check file type, MRawRunHeader not found." << endl;
     else
-        if (runheader->GetRunType() == kRTMonteCarlo)
-        {
-            fPedestals=NULL;
+        if (runheader->IsMonteCarloRun())
             return kTRUE;
-        }
 
     fPedestals = (MPedPhotCam*)pList->FindCreateObj("MPedPhotCam");
Index: trunk/MagicSoft/Mars/manalysis/MCerPhotCalc.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MCerPhotCalc.cc	(revision 3373)
+++ trunk/MagicSoft/Mars/manalysis/MCerPhotCalc.cc	(revision 3374)
@@ -154,6 +154,5 @@
     }
 
-    Bool_t fIsMcFile = runheader->GetRunType() == kRTMonteCarlo;
-    if (!fIsMcFile)
+    if (!runheader->IsMonteCarloRun())
         return kTRUE;
 
Index: trunk/MagicSoft/Mars/manalysis/MMcCalibrationUpdate.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MMcCalibrationUpdate.cc	(revision 3373)
+++ trunk/MagicSoft/Mars/manalysis/MMcCalibrationUpdate.cc	(revision 3374)
@@ -99,5 +99,5 @@
     }
 
-    return  run->GetRunType() == kRTMonteCarlo;
+    return run->IsMonteCarloRun();
 }
 
@@ -108,38 +108,29 @@
 Int_t MMcCalibrationUpdate::PreProcess(MParList *pList)
 {
-  fCalCam = (MCalibrationChargeCam*) pList->FindObject(AddSerialNumber("MCalibrationChargeCam"));
-  if ( !fCalCam )
-    {
-      *fLog << inf << dbginf << AddSerialNumber("MCalibrationChargeCam") << " does not exist... Creating." << endl;
-
-      fCalCam = (MCalibrationChargeCam*) pList->FindCreateObj(AddSerialNumber("MCalibrationChargeCam"));
-      if ( !fCalCam )
-	{
-	  *fLog << err << dbginf << "Cannot create " << AddSerialNumber("MCalibrationChargeCam") << "... aborting." << endl;
-	  return kFALSE;
-	}
-    }
-  else
-    {
-      fFillCalibrationCam = kFALSE;
-      *fLog << inf << AddSerialNumber("MCalibrationChargeCam") << " already exists... " << endl;
-    }
-
-  fPedPhotCam = (MPedPhotCam*) pList->FindCreateObj(AddSerialNumber("MPedPhotCam"));
-  if ( ! fPedPhotCam)
-    {
-      *fLog << err << dbginf << "Cannot create " << AddSerialNumber("MPedPhotCam") << "... aborting." << endl;
-      return kFALSE;
-    }
-
-  fSignalCam = (MExtractedSignalCam*) pList->FindObject(AddSerialNumber("MExtractedSignalCam"));
-  if ( ! fSignalCam)
-    {
-      *fLog << err << dbginf << "Cannot find " << AddSerialNumber("MExtractedSignalCam") << "... aborting." << endl;
-      return kFALSE;
-    }
-
-  return kTRUE;
-
+    fCalCam = (MCalibrationChargeCam*) pList->FindObject(AddSerialNumber("MCalibrationChargeCam"));
+    if (!fCalCam)
+    {
+        fCalCam = (MCalibrationChargeCam*) pList->FindCreateObj(AddSerialNumber("MCalibrationChargeCam"));
+        if (!fCalCam)
+            return kFALSE;
+    }
+    else
+    {
+        fFillCalibrationCam = kFALSE;
+        *fLog << inf << AddSerialNumber("MCalibrationChargeCam") << " already exists... " << endl;
+    }
+
+    fPedPhotCam = (MPedPhotCam*) pList->FindCreateObj(AddSerialNumber("MPedPhotCam"));
+    if (!fPedPhotCam)
+        return kFALSE;
+
+    fSignalCam = (MExtractedSignalCam*) pList->FindObject(AddSerialNumber("MExtractedSignalCam"));
+    if (!fSignalCam)
+    {
+        *fLog << err << AddSerialNumber("MExtractedSignalCam") << " not found... aborting." << endl;
+        return kFALSE;
+    }
+
+    return kTRUE;
 }
 
@@ -156,24 +147,23 @@
     //
     if (!CheckRunType(pList))
-      {
-	*fLog << inf << "This is no MC file... skipping." << endl;
+    {
+        *fLog << inf << "This is no MC file... skipping." << endl;
         return kTRUE;
-      }
+    }
 	
     //
     // Now check the existence of all necessary containers.
     //
-
     fGeom = (MGeomCam*) pList->FindObject(AddSerialNumber("MGeomCam"));
-    if ( ! fGeom )
-      {
-	*fLog << err << dbginf << "Cannot find " << AddSerialNumber("MGeomCam") << "... aborting." << endl;
-	return kFALSE;
-      }
+    if (!fGeom)
+    {
+        *fLog << err << AddSerialNumber("MGeomCam") << " not found... aborting." << endl;
+        return kFALSE;
+    }
 
     fHeaderFadc = (MMcFadcHeader*)pList->FindObject(AddSerialNumber("MMcFadcHeader"));
     if (!fHeaderFadc)
     {
-      *fLog << err << dbginf << AddSerialNumber("MMcFadcHeader") << " not found... aborting." << endl;
+        *fLog << err << AddSerialNumber("MMcFadcHeader") << " not found... aborting." << endl;
         return kFALSE;
     }
@@ -182,20 +172,20 @@
     // Initialize Fadc simulation parameters:
     //
-    if ( fAmplitude < 0. )
-      {
+    if (fAmplitude < 0)
+    {
 	fAmplitude = fHeaderFadc->GetAmplitud();
 	fAmplitudeOuter = fHeaderFadc->GetAmplitudOuter();
 	fConversionHiLo = fHeaderFadc->GetLow2HighGain();
-      }
+    }
     else   // Check that following files have all the same FADC parameters
-      {
-	if ( fabs(fHeaderFadc->GetAmplitud()-fAmplitude) > 1.e-6  ||
+    {
+	if ( fabs(fHeaderFadc->GetAmplitud()-fAmplitude)           > 1.e-6  ||
 	     fabs(fHeaderFadc->GetAmplitudOuter()-fAmplitudeOuter) > 1.e-6  ||
-	     fabs(fConversionHiLo-fHeaderFadc->GetLow2HighGain()) > 1.e-6 )
+	     fabs(fConversionHiLo-fHeaderFadc->GetLow2HighGain())  > 1.e-6 )
 	  {
-	    *fLog << err << endl << endl << dbginf << "Parameters of MMcFadcHeader are not the same for all the read files. Aborting..." << endl << endl;
-	    return kFALSE;
-	  }
-      }
+              *fLog << err << "Parameters of MMcFadcHeader are not the same for all files... aborting." << endl;
+            return kFALSE;
+          }
+    }
 
     //
@@ -205,6 +195,6 @@
     // else has to be done in ReInit:
     //
-    if ( !fFillCalibrationCam )
-      return kTRUE;
+    if (!fFillCalibrationCam)
+        return kTRUE;
 
     //
@@ -278,11 +268,13 @@
 	// counts for the RMS per slice:
 	//
-
-        const Float_t pedestrms  = sigpix.IsLoGainUsed()? 
-	  sqrt((Double_t)(fSignalCam->GetNumUsedLoGainFADCSlices())) * 
-	  (fHeaderFadc->GetPedestalRmsLow(i)>0.? fHeaderFadc->GetPedestalRmsLow(i): 0.01)
-	  : 
-	  sqrt((Double_t)(fSignalCam->GetNumUsedHiGainFADCSlices())) * 
-	  (fHeaderFadc->GetPedestalRmsHigh(i)>0.? fHeaderFadc->GetPedestalRmsHigh(i) : 0.01);
+        const Double_t used = (Double_t)(sigpix.IsLoGainUsed() ?
+                                         fSignalCam->GetNumUsedLoGainFADCSlices() :
+                                         fSignalCam->GetNumUsedHiGainFADCSlices());
+
+        const Float_t rms0 = sigpix.IsLoGainUsed() ?
+            fHeaderFadc->GetPedestalRmsLow(i) :
+            fHeaderFadc->GetPedestalRmsHigh(i);
+
+        const Float_t pedestrms = TMath::Sqrt(used) * (rms0>0 ? rms0 : 0.01);
 
 	//
@@ -297,8 +289,7 @@
 
 	if (sigpix.IsLoGainUsed())
-	  pedpix.Set(adc2phot*hi2lo*pedestmean, 
-		     adc2phot*hi2lo*pedestrms);
+            pedpix.Set(adc2phot*hi2lo*pedestmean, adc2phot*hi2lo*pedestrms);
 	else
-	  pedpix.Set(adc2phot*pedestmean, adc2phot*pedestrms);
+            pedpix.Set(adc2phot*pedestmean, adc2phot*pedestrms);
 
     }
Index: trunk/MagicSoft/Mars/manalysis/MMcPedestalCopy.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MMcPedestalCopy.cc	(revision 3373)
+++ trunk/MagicSoft/Mars/manalysis/MMcPedestalCopy.cc	(revision 3374)
@@ -86,5 +86,5 @@
     }
 
-    return run->GetRunType() == kRTMonteCarlo;
+    return run->IsMonteCarloRun();
 }
 
Index: trunk/MagicSoft/Mars/manalysis/MMcPedestalNSBAdd.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MMcPedestalNSBAdd.cc	(revision 3373)
+++ trunk/MagicSoft/Mars/manalysis/MMcPedestalNSBAdd.cc	(revision 3374)
@@ -106,5 +106,5 @@
     }
 
-    return runheader->GetRunType() == kRTMonteCarlo;
+    return runheader->IsMonteCarloRun();
 }
 
Index: trunk/MagicSoft/Mars/manalysis/MPedCalcPedRun.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MPedCalcPedRun.cc	(revision 3373)
+++ trunk/MagicSoft/Mars/manalysis/MPedCalcPedRun.cc	(revision 3374)
@@ -175,5 +175,5 @@
     }
     else
-        if (runheader->GetRunType() == kRTMonteCarlo)
+        if (runheader->IsMonteCarloRun())
             return kTRUE;
 
Index: trunk/MagicSoft/Mars/manalysis/MPedPhotCalc.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MPedPhotCalc.cc	(revision 3373)
+++ trunk/MagicSoft/Mars/manalysis/MPedPhotCalc.cc	(revision 3374)
@@ -109,26 +109,26 @@
   const MRawRunHeader *runheader = (MRawRunHeader*)pList->FindObject("MRawRunHeader");
   if (!runheader)
-    {
+  {
       *fLog << warn << dbginf;
       *fLog << "Warning - cannot check file type, MRawRunHeader not found." << endl;
-    }
+  }
   else
-    if (runheader->GetRunType() == kRTMonteCarlo)
-      return kTRUE;
+      if (runheader->IsMonteCarloRun())
+          return kTRUE;
   
 
   // Initialize arrays
   if(fSumx.GetSize()==0)
-    {
-        const UShort_t num = fPedestals->GetSize();
+  {
+      const UShort_t num = fPedestals->GetSize();
 
-        fSumx.Set(num);
-        fSumx2.Set(num);
+      fSumx.Set(num);
+      fSumx2.Set(num);
 
-        memset(fSumx.GetArray(),  0, sizeof(Float_t)*num);
-        memset(fSumx2.GetArray(), 0, sizeof(Float_t)*num);
-    }
+      memset(fSumx.GetArray(),  0, sizeof(Float_t)*num);
+      memset(fSumx2.GetArray(), 0, sizeof(Float_t)*num);
+  }
 
-    return kTRUE;
+  return kTRUE;
 }
 
@@ -140,18 +140,18 @@
 Int_t MPedPhotCalc::Process()
 {
-  for(UInt_t i=0;i<fCerPhot->GetNumPixels();i++)
+    for(UInt_t i=0;i<fCerPhot->GetNumPixels();i++)
     {
-      const MCerPhotPix &pix = (*fCerPhot)[i];
+        const MCerPhotPix &pix = (*fCerPhot)[i];
 
-      const Float_t nphot = pix.GetNumPhotons();
-      const Int_t idx     = pix.GetPixId();
-      
-      fSumx[idx]  += nphot;
-      fSumx2[idx] += nphot*nphot;
+        const Float_t nphot = pix.GetNumPhotons();
+        const Int_t idx     = pix.GetPixId();
+
+        fSumx[idx]  += nphot;
+        fSumx2[idx] += nphot*nphot;
     }
-  
-  fPedestals->SetReadyToSave();
-  
-  return kTRUE;
+
+    fPedestals->SetReadyToSave();
+
+    return kTRUE;
 }
 
@@ -161,5 +161,5 @@
 //
 Int_t MPedPhotCalc::PostProcess()
-  {
+{
     // Compute pedestals and rms from fSumx and fSumx2 arrays
     const Int_t n    = GetNumExecutions();
@@ -167,14 +167,14 @@
 
     for(Int_t i=0; i<npix; i++)
-      {
+    {
         const Float_t sum  = fSumx[i];
 	const Float_t sum2 = fSumx2[i];
-	
+
         const Float_t photped = sum/n;
         const Float_t photrms = TMath::Sqrt((sum2-sum*sum/n)/(n-1.));
 
-	(*fPedestals)[i].Set(photped,photrms);	
-      }
-    
+        (*fPedestals)[i].Set(photped,photrms);
+    }
+
     return kTRUE;
 }
Index: trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc	(revision 3373)
+++ trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc	(revision 3374)
@@ -164,5 +164,5 @@
     if (!fRawEvt)
     {
-      *fLog << err << dbginf << "MRawEvtData not found... aborting." << endl;
+      *fLog << err << "MRawEvtData not found... aborting." << endl;
       return kFALSE;
     }
@@ -170,24 +170,16 @@
     const MRawRunHeader *runheader = (MRawRunHeader*)pList->FindObject("MRawRunHeader");
     if (!runheader)
-      *fLog << warn << dbginf << "Warning - cannot check file type, MRawRunHeader not found." << endl;
+      *fLog << warn << "Warning - cannot check file type, MRawRunHeader not found." << endl;
     else
-      if (runheader->GetRunType() == kRTMonteCarlo)
-        {
+      if (runheader->IsMonteCarloRun())
           return kTRUE;
-        }
     
     fCam = (MCalibrationChargeCam*)pList->FindCreateObj("MCalibrationChargeCam");
     if (!fCam)
-      {
-        *fLog << err << dbginf << "MCalibrationChargeCam could not be created ... aborting." << endl;        
-        return kFALSE;
-      }
+        return kFALSE;
 
     fPINDiode = (MCalibrationChargePINDiode*)pList->FindCreateObj("MCalibrationChargePINDiode");
     if (!fPINDiode)
-      {
-        *fLog << err << dbginf << "MCalibrationChargePINDiode could not be created ... aborting." << endl;        
-        return kFALSE;
-      }
+        return kFALSE;
 
     fCam->SetPINDiode(fPINDiode);
@@ -195,27 +187,23 @@
     fBlindPixel = (MCalibrationChargeBlindPix*)pList->FindCreateObj("MCalibrationChargeBlindPix");
     if (!fBlindPixel)
-      {
-        *fLog << err << dbginf << "MCalibrationChargeBlindPix could not be created ... aborting." << endl;        
-        return kFALSE;
-      }
+        return kFALSE;
 
     fCam->SetBlindPixel(fBlindPixel);
 
-    fEvtTime      = (MTime*)pList->FindObject("MTime");
+    fEvtTime = (MTime*)pList->FindObject("MTime");
 
     fPedestals = (MPedestalCam*)pList->FindObject("MPedestalCam");
     if (!fPedestals)
-      {
-        *fLog << err << dbginf << "Cannot find MPedestalCam ... aborting" << endl;
-        return kFALSE;
-      }
-
+    {
+        *fLog << err << "MPedestalCam not found... aborting" << endl;
+        return kFALSE;
+    }
 
     fSignals = (MExtractedSignalCam*)pList->FindObject("MExtractedSignalCam");
     if (!fSignals)
-      {
-        *fLog << err << dbginf << "Cannot find MExtractedSignalCam ... aborting" << endl;
-        return kFALSE;
-      }
+    {
+        *fLog << err << "MExtractedSignalCam not found... aborting" << endl;
+        return kFALSE;
+    }
 
     return kTRUE;
@@ -230,18 +218,16 @@
 Bool_t MCalibrationChargeCalc::ReInit(MParList *pList )
 {
- 
     fRunHeader = (MRawRunHeader*)pList->FindObject("MRawRunHeader");
     if (!fRunHeader)
     {
-      *fLog << err << dbginf << ": MRawRunHeader not found... aborting." << endl;
+      *fLog << err << "MRawRunHeader not found... aborting." << endl;
       return kFALSE;
     }
-
 
     fGeom = (MGeomCam*)pList->FindObject("MGeomCam");
     if (!fGeom)
     {
-      *fLog << err << GetDescriptor() << ": No MGeomCam found... aborting." << endl;
-      return kFALSE;
+        *fLog << err << "No MGeomCam found... aborting." << endl;
+        return kFALSE;
     }
 
@@ -255,6 +241,5 @@
 
     for (UInt_t i=0; i<npixels; i++)
-      {
-        
+    {
         MCalibrationChargePix &pix = (*fCam)[i];
         pix.DefinePixId(i);
@@ -264,65 +249,60 @@
         pix.SetAbsTimeBordersLoGain(fSignals->GetFirstUsedSliceLoGain(),
                                     fSignals->GetLastUsedSliceLoGain());
-        
-     }
+    }
     
+    if (fExcludedPixelsFile.IsNull())
+        return kTRUE;
+
     //
     // Look for file to exclude pixels from analysis
     //
-    if (!fExcludedPixelsFile.IsNull())
-      {
-        
-        fExcludedPixelsFile = gSystem->ExpandPathName(fExcludedPixelsFile.Data());
-        
+    gSystem->ExpandPathName(fExcludedPixelsFile);
+
+    //
+    // Initialize reading the file
+    //
+    ifstream in(fExcludedPixelsFile);
+    if (!in)
+    {
+        *fLog << warn << "Cannot open file '" << fExcludedPixelsFile << "'" << endl;
+        return kTRUE;
+    }
+
+    *fLog << inf << "Use excluded pixels from file: '" << fExcludedPixelsFile << "'" << endl;
+
+    //
+    // Read the file and count the number of entries
+    //
+    UInt_t pixel = 0;
+
+    while (++fNumExcludedPixels)
+    {
+        in >> pixel;
+        if (!in)
+            break;
+
         //
-        // Initialize reading the file
+        // Check for out of range
         //
-        ifstream in(fExcludedPixelsFile.Data(),ios::in);
-
-        if (in)
-          {
-            *fLog << inf << "Use excluded pixels from file: '" << fExcludedPixelsFile.Data() << "'" << endl;
-            //
-            // Read the file and count the number of entries
-            //
-            UInt_t pixel = 0;
-            
-            while (++fNumExcludedPixels)
-              {
-                
-                in >> pixel;
-
-                if (!in.good())
-                  break;
-                //
-                // Check for out of range
-                //
-                if (pixel > npixels)
-                  {
-                    *fLog << warn << "WARNING: To be excluded pixel: " << pixel 
-                          << " is out of range " << endl;
-                    continue;
-                  }
-                //
-                // Exclude pixel
-                //
-                MCalibrationChargePix &pix = (*fCam)[pixel];
-                pix.SetExcluded();
-                
-                *fLog << GetDescriptor() << inf << ": Exclude Pixel: " << pixel << endl;
-                
-              }
-            
-            if (--fNumExcludedPixels == 0)
-              *fLog << warn << "WARNING: File '" << fExcludedPixelsFile.Data() 
-                    << "'" << " is empty " << endl;
-            else
-              fCam->SetNumPixelsExcluded(fNumExcludedPixels);
-            
-          }
-        else
-          *fLog << warn << dbginf << "Cannot open file '" << fExcludedPixelsFile.Data() << "'" << endl;
-      }
-    
+        if (pixel > npixels)
+        {
+            *fLog << warn << "WARNING: To be excluded pixel: " << pixel << " is out of range " << endl;
+            continue;
+        }
+        //
+        // Exclude pixel
+        //
+        MCalibrationChargePix &pix = (*fCam)[pixel];
+        pix.SetExcluded();
+
+        *fLog << GetDescriptor() << inf << ": Exclude Pixel: " << pixel << endl;
+
+    }
+
+    if (--fNumExcludedPixels == 0)
+        *fLog << warn << "WARNING: File '" << fExcludedPixelsFile << "'" << " is empty " << endl;
+    else
+        fCam->SetNumPixelsExcluded(fNumExcludedPixels);
+
     return kTRUE;
 }
@@ -513,9 +493,2 @@
   return kTRUE;
 }
-
-
-
-
-
-
-
Index: trunk/MagicSoft/Mars/mcalib/MMcCalibrationCalc.cc
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MMcCalibrationCalc.cc	(revision 3373)
+++ trunk/MagicSoft/Mars/mcalib/MMcCalibrationCalc.cc	(revision 3374)
@@ -87,5 +87,5 @@
     }
 
-    return  run->GetRunType() == kRTMonteCarlo;
+    return  run->IsMonteCarloRun();
 }
 
Index: trunk/MagicSoft/Mars/mpointing/MPointingPosCalc.cc
===================================================================
--- trunk/MagicSoft/Mars/mpointing/MPointingPosCalc.cc	(revision 3373)
+++ trunk/MagicSoft/Mars/mpointing/MPointingPosCalc.cc	(revision 3374)
@@ -80,5 +80,5 @@
     switch (fRunType)
     {
-    case kRTData:
+    case MRawRunHeader::kRTData:
         fReport = (MReportDrive*)plist->FindObject("MReportDrive");
         if (!fReport)
@@ -89,5 +89,5 @@
         return kTRUE;
 
-    case kRTMonteCarlo:
+    case MRawRunHeader::kRTMonteCarlo:
         fMcEvt = (MMcEvt*)plist->FindObject("MMcEvt");
         if (!fMcEvt)
@@ -98,9 +98,9 @@
         return kTRUE;
 
-    case kRTPedestal:
+    case MRawRunHeader::kRTPedestal:
         *fLog << err << "Cannot work in a pedestal Run!... aborting." << endl;
         return kFALSE;
 
-    case kRTCalibration:
+    case MRawRunHeader::kRTCalibration:
         *fLog << err << "Cannot work in a calibration Run!... aborting." << endl;
         return kFALSE;
@@ -132,9 +132,9 @@
     switch (fRunType)
     {
-    case kRTData:
+    case MRawRunHeader::kRTData:
         fPosition->SetLocalPosition(fReport->GetNominalZd(), fReport->GetNominalAz());
         return kTRUE;
 
-    case kRTMonteCarlo:
+    case MRawRunHeader::kRTMonteCarlo:
         fPosition->SetLocalPosition(fMcEvt->GetTelescopeTheta()*TMath::RadToDeg(), fMcEvt->GetTelescopePhi()*TMath::RadToDeg());
         return kTRUE;
Index: trunk/MagicSoft/Mars/mraw/MRawEvtHeader.h
===================================================================
--- trunk/MagicSoft/Mars/mraw/MRawEvtHeader.h	(revision 3373)
+++ trunk/MagicSoft/Mars/mraw/MRawEvtHeader.h	(revision 3374)
@@ -14,15 +14,16 @@
 class MRawRunHeader;
 
-//
-// Trigger Type (TT)
-//
-enum {
-    kTTEvent       = 0,
-    kTTPedestal    = 1,
-    kTTCalibration = 2
-};
-
 class MRawEvtHeader : public MParContainer
 {
+public:
+    //
+    // Trigger Type (TT)
+    //
+    enum {
+        kTTEvent       = 0,
+        kTTPedestal    = 1,
+        kTTCalibration = 2
+    };
+
 private:
     MTime   *fTime;            //! object to store the time in (ReadEvt)
Index: trunk/MagicSoft/Mars/mraw/MRawFileWrite.cc
===================================================================
--- trunk/MagicSoft/Mars/mraw/MRawFileWrite.cc	(revision 3373)
+++ trunk/MagicSoft/Mars/mraw/MRawFileWrite.cc	(revision 3374)
@@ -247,13 +247,13 @@
     switch (type)
     {
-    case kTTEvent:
+    case MRawEvtHeader::kTTEvent:
         fTData->Fill();
         return kTRUE;
 
-    case kTTPedestal:
+    case MRawEvtHeader::kTTPedestal:
         fTPedestal->Fill();
         return kTRUE;
 
-    case kTTCalibration:
+    case MRawEvtHeader::kTTCalibration:
         fTCalibration->Fill();
         return kTRUE;
Index: trunk/MagicSoft/Mars/mraw/MRawRunHeader.cc
===================================================================
--- trunk/MagicSoft/Mars/mraw/MRawRunHeader.cc	(revision 3373)
+++ trunk/MagicSoft/Mars/mraw/MRawRunHeader.cc	(revision 3374)
@@ -61,4 +61,7 @@
 using namespace std;
 
+const UShort_t MRawRunHeader::kMagicNumber      = 0xc0c0;
+const Byte_t   MRawRunHeader::kMaxFormatVersion =      3;
+
 // --------------------------------------------------------------------------
 //
Index: trunk/MagicSoft/Mars/mraw/MRawRunHeader.h
===================================================================
--- trunk/MagicSoft/Mars/mraw/MRawRunHeader.h	(revision 3373)
+++ trunk/MagicSoft/Mars/mraw/MRawRunHeader.h	(revision 3374)
@@ -14,24 +14,25 @@
 class MArrayS;
 
-//
-// Magic number to detect the magic file type
-//
-const UShort_t kMagicNumber      = 0xc0c0;
-const Byte_t   kMaxFormatVersion =      3;
-
-//
-// enum for the Run Type. Monte Carlo Runs have
-// to have a value greater than 255 (>0xff)
-//
-enum {
-    kRTData        = 0x0000,
-    kRTPedestal    = 0x0001,
-    kRTCalibration = 0x0002,
-    kRTMonteCarlo  = 0x0100,
-    kRTNone        = 0xffff
-};
-
 class MRawRunHeader : public MParContainer
 {
+public:
+    //
+    // enum for the Run Type. Monte Carlo Runs have
+    // to have a value greater than 255 (>0xff)
+    //
+    enum {
+        kRTData        = 0x0000,
+        kRTPedestal    = 0x0001,
+        kRTCalibration = 0x0002,
+        kRTMonteCarlo  = 0x0100,
+        kRTNone        = 0xffff
+    };
+
+    //
+    // Magic number to detect the magic file type
+    //
+    static const UShort_t kMagicNumber;
+    static const Byte_t   kMaxFormatVersion;
+
 private:
     /* ---- Run Header Informations ---- */
@@ -105,4 +106,6 @@
     Int_t GetNumTotalBytes() const;
 
+    Bool_t IsMonteCarloRun() const { return fRunType>0x00ff; }
+
     void Print(Option_t *t=NULL) const;
 
