Index: trunk/MagicSoft/Mars/mraw/MRawEvtData.cc
===================================================================
--- trunk/MagicSoft/Mars/mraw/MRawEvtData.cc	(revision 2200)
+++ trunk/MagicSoft/Mars/mraw/MRawEvtData.cc	(revision 2207)
@@ -64,4 +64,5 @@
 #include "MArrayS.h"
 #include "MArrayB.h"
+#include "MGeomCam.h"
 #include "MRawRunHeader.h"
 #include "MRawEvtPixelIter.h"
@@ -472,5 +473,5 @@
 }
 
-Bool_t MRawEvtData::GetPixelContent(Float_t &val, Int_t idx, Float_t ratio, Int_t type) const
+Bool_t MRawEvtData::GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type) const
 {
     MRawEvtPixelIter Next(const_cast<MRawEvtData*>(this));
@@ -478,5 +479,7 @@
         return kFALSE;
 
-    val = Next.GetSumHiGainSamples();
+    val = Next.GetSumHiGainSamples()-(float)GetNumHiGainSamples()*fHiGainFadcSamples->GetArray()[0];
+    val *= cam.GetPixRatio(idx);
+
     return kTRUE;
 }
Index: trunk/MagicSoft/Mars/mraw/MRawEvtData.h
===================================================================
--- trunk/MagicSoft/Mars/mraw/MRawEvtData.h	(revision 2200)
+++ trunk/MagicSoft/Mars/mraw/MRawEvtData.h	(revision 2207)
@@ -64,5 +64,5 @@
     void ReadEvt(istream &fin);
 
-    Bool_t GetPixelContent(Float_t &val, Int_t idx, Float_t ratio=1, Int_t type=0) const;
+    Bool_t GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0) const;
     void   DrawPixelContent(Int_t num) const
     {
Index: trunk/MagicSoft/Mars/mraw/MRawEvtPixelIter.cc
===================================================================
--- trunk/MagicSoft/Mars/mraw/MRawEvtPixelIter.cc	(revision 2200)
+++ trunk/MagicSoft/Mars/mraw/MRawEvtPixelIter.cc	(revision 2207)
@@ -203,4 +203,19 @@
 }
 
+Byte_t MRawEvtPixelIter::GetNumMaxHiGainSample() const
+{
+    Byte_t max  = 0;
+    Byte_t maxi = 0;
+
+    for (int i=0; i<fNumHiGainSamples; i++)
+        if (fHiGainPos[i]>max)
+        {
+            max = fHiGainPos[i];
+            maxi = i;
+        }
+
+    return maxi;
+}
+
 // --------------------------------------------------------------------------
 //
Index: trunk/MagicSoft/Mars/mraw/MRawEvtPixelIter.h
===================================================================
--- trunk/MagicSoft/Mars/mraw/MRawEvtPixelIter.h	(revision 2200)
+++ trunk/MagicSoft/Mars/mraw/MRawEvtPixelIter.h	(revision 2207)
@@ -81,4 +81,6 @@
     Float_t GetVarHiGainSamples() const;
 
+    Byte_t GetNumMaxHiGainSample() const;
+
     Bool_t HasLoGain() const
     {
Index: trunk/MagicSoft/Mars/mraw/MRawFileRead.cc
===================================================================
--- trunk/MagicSoft/Mars/mraw/MRawFileRead.cc	(revision 2200)
+++ trunk/MagicSoft/Mars/mraw/MRawFileRead.cc	(revision 2207)
@@ -128,5 +128,5 @@
 // Now the EvtHeader and EvtData containers are initialized.
 //
-Bool_t MRawFileRead::PreProcess(MParList *pList)
+Int_t MRawFileRead::PreProcess(MParList *pList)
 {
     //
@@ -192,5 +192,5 @@
 //  - the raw data information of one event is read
 //
-Bool_t MRawFileRead::Process()
+Int_t MRawFileRead::Process()
 {
     //
@@ -236,5 +236,5 @@
 //  if it doesn't match.
 //
-Bool_t MRawFileRead::PostProcess()
+Int_t MRawFileRead::PostProcess()
 {
     //
Index: trunk/MagicSoft/Mars/mraw/MRawFileRead.h
===================================================================
--- trunk/MagicSoft/Mars/mraw/MRawFileRead.h	(revision 2200)
+++ trunk/MagicSoft/Mars/mraw/MRawFileRead.h	(revision 2207)
@@ -29,11 +29,12 @@
     ifstream       *fIn;            //! buffered input stream (file to read from)
 
+    Int_t PreProcess(MParList *pList);
+    Int_t Process();
+    Int_t PostProcess();
+
+
 public:
     MRawFileRead(const char *filename, const char *name=NULL, const char *title=NULL);
     ~MRawFileRead();
-
-    Bool_t PreProcess(MParList *pList);
-    Bool_t Process();
-    Bool_t PostProcess();
 
     ClassDef(MRawFileRead, 0)	// Task to read the raw data binary file
Index: trunk/MagicSoft/Mars/mraw/MRawFileWrite.cc
===================================================================
--- trunk/MagicSoft/Mars/mraw/MRawFileWrite.cc	(revision 2200)
+++ trunk/MagicSoft/Mars/mraw/MRawFileWrite.cc	(revision 2207)
@@ -109,5 +109,5 @@
 // are created.
 //
-Bool_t MRawFileWrite::PreProcess (MParList *pList)
+Int_t MRawFileWrite::PreProcess (MParList *pList)
 {
     //
@@ -231,5 +231,5 @@
 // event should be filled in and fills  it into this tree.
 //
-Bool_t MRawFileWrite::Process()
+Int_t MRawFileWrite::Process()
 {
     //
Index: trunk/MagicSoft/Mars/mraw/MRawFileWrite.h
===================================================================
--- trunk/MagicSoft/Mars/mraw/MRawFileWrite.h	(revision 2200)
+++ trunk/MagicSoft/Mars/mraw/MRawFileWrite.h	(revision 2207)
@@ -41,6 +41,6 @@
     ~MRawFileWrite();
 
-    Bool_t PreProcess(MParList *pList);
-    Bool_t Process();
+    Int_t PreProcess(MParList *pList);
+    Int_t Process();
 
     ClassDef(MRawFileWrite, 0)	// Task to write the raw data containers to a root file
Index: trunk/MagicSoft/Mars/mraw/Makefile
===================================================================
--- trunk/MagicSoft/Mars/mraw/Makefile	(revision 2200)
+++ trunk/MagicSoft/Mars/mraw/Makefile	(revision 2207)
@@ -22,5 +22,5 @@
 #  connect the include files defined in the config.mk file
 #
-INCLUDES = -I. -I../mbase -I../MBase -I../mgui
+INCLUDES = -I. -I../mbase -I../mgui -I../mgeom -I../MBase
 
 #------------------------------------------------------------------------------
