Index: trunk/MagicSoft/Mars/mtemp/mifae/library/IFAELinkDef.h
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/library/IFAELinkDef.h	(revision 5963)
+++ trunk/MagicSoft/Mars/mtemp/mifae/library/IFAELinkDef.h	(revision 6192)
@@ -32,4 +32,8 @@
 #pragma link C++ class MFDisp+;
 #pragma link C++ class MFindDisp+;
+#pragma link C++ class MGainFluctuationPix+;
+#pragma link C++ class MGainFluctuationCam+;
+#pragma link C++ class MGainFluctuationCamIter+;
+#pragma link C++ class MAddGainFluctuation+;
 
 #endif
Index: trunk/MagicSoft/Mars/mtemp/mifae/library/MAddGainFluctuation.cc
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/library/MAddGainFluctuation.cc	(revision 6192)
+++ trunk/MagicSoft/Mars/mtemp/mifae/library/MAddGainFluctuation.cc	(revision 6192)
@@ -0,0 +1,219 @@
+/* ======================================================================== *\
+!
+! *
+! * This file is part of MARS, the MAGIC Analysis and Reconstruction
+! * Software. It is distributed to you in the hope that it can be a useful
+! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
+! * It is distributed WITHOUT ANY WARRANTY.
+! *
+! * Permission to use, copy, modify and distribute this software and its
+! * documentation for any purpose is hereby granted without fee,
+! * provided that the above copyright notice appear in all copies and
+! * that both that copyright notice and this permission notice appear
+! * in supporting documentation. It is provided "as is" without express
+! * or implied warranty.
+! *
+!
+!
+!   Author(s): Oscar Blanch Bigas 01/2005  <mailto:blanch@ifae.es>
+!
+!   Copyright: MAGIC Software Development, 2002-2005
+!
+!
+\* ======================================================================== */
+
+//////////////////////////////////////////////////////////////////////////////
+//
+//   MAddGainFluctuation
+//
+//   This is a task which add gain fluctuatins
+//
+//  Input Containers:
+//   MCerPhotEvt
+//   MGainFluctuationCam
+//   MGeomCam
+//
+//  Output Containers:
+//   MCerPhotEvt
+//
+//////////////////////////////////////////////////////////////////////////////
+#include "MAddGainFluctuation.h"
+
+#include "MParList.h"
+
+#include "MLog.h"
+#include "MLogManip.h"
+
+#include "MGeomCam.h"
+
+#include "MCerPhotEvt.h"
+#include "MCerPhotPix.h"
+#include "MGainFluctuationCam.h"
+
+#include "TRandom.h"
+
+ClassImp(MAddGainFluctuation);
+
+using namespace std;
+
+// --------------------------------------------------------------------------
+//
+// Default constructor.
+//
+MAddGainFluctuation::MAddGainFluctuation(const char *name, const char *title)
+{
+    fName  = name  ? name  : "MAddGainFluctuation";
+    fTitle = title ? title : "Add gain fluctuation";
+
+    FillHist(1,0.1);
+}
+
+// --------------------------------------------------------------------------
+//
+// The PreProcess searches for the following input containers:
+//  - MCerPhotEvt
+//  - MGeomCam
+//
+// The following containers are also searched and created if
+// they were not found:
+// - MGainFluctuationCam
+//
+//
+Int_t MAddGainFluctuation::PreProcess(MParList *pList)
+{
+
+    fGeomCam = (MGeomCam*)pList->FindObject(AddSerialNumber("MGeomCam"));
+    if (!fGeomCam)
+    {
+        *fLog << err << "MGeomCam not found... aborting." << endl;
+        return kFALSE;
+    }
+
+    fCerPhotEvt = (MCerPhotEvt*)pList->FindObject(AddSerialNumber("MCerPhotEvt"));
+    if (!fCerPhotEvt)
+        return kFALSE;
+
+    fGainFlucCam = (MGainFluctuationCam*)pList->FindCreateObj(AddSerialNumber("MGainFluctuationCam"));
+    if (!fGainFlucCam)
+        return kFALSE;
+
+
+    Fill();
+
+    return kTRUE;
+}
+
+// --------------------------------------------------------------------------
+//
+//
+Bool_t MAddGainFluctuation::ReInit(MParList *pList)
+{
+    return kTRUE;
+}
+
+// --------------------------------------------------------------------------
+//
+// Scale the content of MCerPhotPix by Gain fluctuaion
+//
+Int_t MAddGainFluctuation::Process()
+{
+    //fCerPhotEvt->InitSize(fRawEvt->GetNumPixels());
+
+//    if (fIsMcFile)
+//        ScalePedestals();
+
+    if(!fAddFluctuations)
+      return kTRUE;
+
+    Double_t gain;
+
+    MCerPhotPix *pix = 0;
+
+    TIter Next(*fCerPhotEvt);
+
+    while ((pix=(MCerPhotPix*)Next()))
+    {
+        const UInt_t idx = pix->GetPixId();
+
+	fGainFlucCam->GetPixelContent(gain,idx,*fGeomCam,1);
+	pix->Scale(1.0/gain);
+    }
+
+    return kTRUE;
+}
+
+// --------------------------------------------------------------------------
+//
+//  Fill Histogram with Gain Fluctuations distribution in the Camera
+//
+//  flag:
+//
+//     0 : All to one
+//     1 : Gaussian centered at one with sigma "sigma"
+//     2 : Uniform distribution from 1/sigma to 1*sigma
+void MAddGainFluctuation::FillHist(int flag, float sigma){
+
+  TRandom rnd;
+  Float_t val;
+
+  fGainsDistribution = new TH1F("Gain","Gain Fluctuatins",1000,0.0,2.0);
+
+  switch(flag){
+  case 0:
+    fAddFluctuations=0;
+    break;
+  case 1:
+    fAddFluctuations=0;
+    for(int i=0;i<10000;i++){
+      val=rnd.Gaus(1.0,sigma);
+      fGainsDistribution->Fill(val);
+    }
+    break;
+  case 2:
+    fAddFluctuations=0;
+    for(int i=0;i<10000;i++){
+      val=rnd.Uniform(1.0/sigma,1.0*sigma);
+      fGainsDistribution->Fill(val);
+    }
+    break;
+  default:
+    fAddFluctuations=0;
+    for(int i=0;i<10000;i++){
+      val=rnd.Gaus(1.0,sigma);
+      fGainsDistribution->Fill(val);
+    }
+    break;
+  }
+}
+
+// --------------------------------------------------------------------------
+//
+//  Set and Fill Histogram with Gain Fluctuations distribution in the Camera
+//
+void MAddGainFluctuation::SetHist(int bins, float fb, float lb, float *values){
+
+  fGainsDistribution = new TH1F("Gain","Gain Fluctuatins",bins,fb,lb);
+  
+  for(int i=0;i<bins;i++){
+    fGainsDistribution->SetBinContent(i,values[i]);
+  }
+
+}
+
+// --------------------------------------------------------------------------
+//
+//  Fill MGainFluctuatinCam 
+//
+void MAddGainFluctuation::Fill(){
+
+  const Int_t pixels=fGeomCam->GetNumPixels();
+  
+  if(fAddFluctuations)
+    for (int idx=0;idx<pixels;idx++)
+      fGainFlucCam->AddPixel(idx,fGainsDistribution->GetRandom());
+  else
+    for (int idx=0;idx<pixels;idx++)
+      fGainFlucCam->AddPixel(idx,1.0);
+
+}
+
Index: trunk/MagicSoft/Mars/mtemp/mifae/library/MAddGainFluctuation.h
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/library/MAddGainFluctuation.h	(revision 6192)
+++ trunk/MagicSoft/Mars/mtemp/mifae/library/MAddGainFluctuation.h	(revision 6192)
@@ -0,0 +1,54 @@
+#ifndef MARS_MAddGainFluctuation
+#define MARS_MAddGainFluctuation
+
+/////////////////////////////////////////////////////////////////////////////
+//                                                                         //
+// MCerPhotCalc                                                            //
+//                                                                         //
+// Integrates the desired ADC time slices of one pixel and substracts the  //
+// pedestal (offset) value                                                 //
+//                                                                         //
+/////////////////////////////////////////////////////////////////////////////
+#ifndef ROOT_TArrayF
+#include <TArrayF.h>
+#endif
+
+#ifndef ROOT_TH1F
+#include <TH1F.h>
+#endif
+
+#ifndef MARS_MTask
+#include "MTask.h"
+#endif
+
+class MCerPhotEvt;
+class MGainFluctuationCam;
+class MGeomCam;
+class TH1F;
+
+class MAddGainFluctuation : public MTask
+{
+    const MGeomCam     *fGeomCam;
+    MCerPhotEvt    *fCerPhotEvt; // Cerenkov Photon Event used for calculation
+    MGainFluctuationCam    *fGainFlucCam; // Gain Fluctuation
+    TH1F *fGainsDistribution;   // Distribution of Gain fluctuatins in the Camera
+    Int_t fAddFluctuations;     // If 0 skip Process
+
+    void Fill();
+
+    Int_t PreProcess(MParList *pList);
+    Int_t Process();
+
+    Bool_t ReInit(MParList *pList);
+
+public:
+    MAddGainFluctuation(const char *name=NULL, const char *title=NULL);
+
+    void SetHist(int bins, float fb, float lb, float *values);
+    void FillHist(int flag, float sigma);
+
+    ClassDef(MAddGainFluctuation, 0)   // Task to add Gain fluctuations
+};
+ 
+
+#endif
Index: trunk/MagicSoft/Mars/mtemp/mifae/library/MGainFluctuationCam.cc
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/library/MGainFluctuationCam.cc	(revision 6192)
+++ trunk/MagicSoft/Mars/mtemp/mifae/library/MGainFluctuationCam.cc	(revision 6192)
@@ -0,0 +1,259 @@
+/* ======================================================================== *\
+!
+! *
+! * This file is part of MARS, the MAGIC Analysis and Reconstruction
+! * Software. It is distributed to you in the hope that it can be a useful
+! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
+! * It is distributed WITHOUT ANY WARRANTY.
+! *
+! * Permission to use, copy, modify and distribute this software and its
+! * documentation for any purpose is hereby granted without fee,
+! * provided that the above copyright notice appear in all copies and
+! * that both that copyright notice and this permission notice appear
+! * in supporting documentation. It is provided "as is" without express
+! * or implied warranty.
+! *
+!
+!
+!   Author(s): Oscar Blanch 1/2005 <mailto:blanch@ifae.es>
+!
+!   Copyright: MAGIC Software Development, 2000-2003
+!
+!
+\* ======================================================================== */
+
+/////////////////////////////////////////////////////////////////////////////
+//            
+// MGainFluctuationCam
+//
+/////////////////////////////////////////////////////////////////////////////
+#include "MGainFluctuationCam.h"
+
+#include <math.h>
+#include <limits.h>
+#include <fstream>
+
+#include <TArrayD.h>
+#include <TCanvas.h>
+
+#include "MLog.h"
+#include "MLogManip.h"
+
+#include "MGeomCam.h"
+#include "MGeomPix.h"
+
+ClassImp(MGainFluctuationCam);
+ClassImp(MGainFluctuationCamIter);
+
+using namespace std;
+
+// --------------------------------------------------------------------------
+//
+// Creates a MGainFluctuationPix object for each pixel in the event
+//
+MGainFluctuationCam::MGainFluctuationCam(const char *name, const char *title) : fNumPixels(0)
+{
+    fName  = name  ? name  : "MGainFluctuationCam";
+    fTitle = title ? title : "(Gain Fluctuation)-Event Information";
+
+    fPixels = new TClonesArray("MGainFluctuationPix", 0);
+}
+
+
+// --------------------------------------------------------------------------
+//
+// reset counter and delete netries in list.
+//
+void MGainFluctuationCam::Reset()
+{
+    fNumPixels  =  0;
+    fMaxIndex   = -1;
+    fLut.Set(0);
+    // fPixels->Delete();
+}
+
+void MGainFluctuationCam::FixSize()
+{
+    fLut.Set(fMaxIndex+1);
+
+    if (fPixels->GetEntriesFast() == (Int_t)fNumPixels)
+        return;
+
+    fPixels->ExpandCreateFast(fNumPixels);
+}
+
+// --------------------------------------------------------------------------
+//
+//  Dump the gain fluctuation event to *fLog
+//
+void MGainFluctuationCam::Print(Option_t *) const
+{
+    const Int_t entries = fPixels->GetEntries();
+
+    *fLog << GetDescriptor() << dec << endl;
+    *fLog << " Number of Pixels: " << fNumPixels << "(" << entries << ")" << endl;
+
+    for (Int_t i=0; i<entries; i++ )
+        (*this)[i].Print();
+}
+
+Float_t MGainFluctuationCam::GetGain(int i) const
+{
+  const MGainFluctuationPix &pix = (*this)[i];
+  
+  return pix.GetGain();
+}
+
+// --------------------------------------------------------------------------
+//
+// get the minimum number of photons  of all valid pixels in the list
+// If you specify a geometry the number of photons is weighted with the
+// area of the pixel
+//
+Float_t MGainFluctuationCam::GetGainMin(const MGeomCam *geom) const
+{
+    if (fNumPixels <= 0)
+        return -5.;
+
+    const UInt_t n = geom->GetNumPixels();
+
+    Float_t minval = FLT_MAX;
+
+    for (UInt_t i=0; i<fNumPixels; i++)
+    {
+        const MGainFluctuationPix &pix = (*this)[i];
+
+        const UInt_t id = pix.GetPixId();
+        if (id<0 || id>=n)
+            continue;
+
+        Float_t testval = pix.GetGain();
+
+        if (testval < minval)
+            minval = testval;
+    }
+
+    return minval;
+}
+
+// --------------------------------------------------------------------------
+//
+// get the maximum number of photons of all valid pixels in the list
+// If you specify a geometry the number of photons is weighted with the
+// area of the pixel
+//
+Float_t MGainFluctuationCam::GetGainMax(const MGeomCam *geom) const
+{
+    if (fNumPixels <= 0)
+        return 50.;
+
+    const UInt_t n = geom->GetNumPixels();
+
+    Float_t maxval = -FLT_MAX;
+
+    for (UInt_t i=0; i<fNumPixels; i++)
+    {
+        const MGainFluctuationPix &pix = (*this)[i];
+
+        const UInt_t id = pix.GetPixId();
+        if (id<0 || id>=n)
+            continue;
+
+        Float_t testval = pix.GetGain();
+
+        if (testval > maxval)
+            maxval = testval;
+    }
+    return maxval;
+}
+
+
+// --------------------------------------------------------------------------
+//
+// Return a pointer to the pixel with the requested idx. NULL if it doesn't
+// exist. The Look-up-table fLut is used. If its size is zero (according
+// to Rene this will happen if an old class object is loaded) we still
+// try to search in the array.
+//
+MGainFluctuationPix *MGainFluctuationCam::GetPixById(Int_t idx) const
+{
+    if (idx<0)
+        return 0;
+
+    if (fLut.GetSize()>0)
+    {
+        if (idx>=fLut.GetSize())
+            return 0;
+        return fLut[idx]<0 ? 0 : (MGainFluctuationPix*)(fPixels->UncheckedAt(fLut[idx]));
+    }
+
+    TIter Next(fPixels);
+    MGainFluctuationPix *pix = NULL;
+
+    while ((pix=(MGainFluctuationPix*)Next()))
+        if (pix->GetPixId()==idx)
+            return pix;
+
+    return NULL;
+}
+
+MGainFluctuationPix *MGainFluctuationCam::AddPixel(Int_t idx, Float_t gain)
+    {
+        //
+        // If this is too slow or takes to much space we might use
+        // MGeomApply and an InitSize member function instead.
+        //
+        if (idx>=fLut.GetSize())
+        {
+            const Int_t n = fLut.GetSize();
+            fLut.Set(idx*2+1); //idx+1 is slower than idx*2+1
+            for (int i=n; i<idx*2+1; i++)
+                fLut[i] = -1;
+        }
+
+        fLut[idx] = fNumPixels;
+        if (idx>fMaxIndex)
+            fMaxIndex=idx;
+
+        return new ((*fPixels)[fNumPixels++]) MGainFluctuationPix(idx, gain);
+    }
+
+// --------------------------------------------------------------------------
+//
+// Returns, depending on the type flag:
+//
+//  0: Number of Photons*PixRatio
+//  1: Error*sqrt(PixRatio)
+//  2: Cleaning level = Num Photons*sqrt(PixRatio)/Error
+//  3: Number of Photons
+//  4: Error
+//  5: Island index
+//
+Bool_t MGainFluctuationCam::GetPixelContent(Double_t &val, Int_t idx,const MGeomCam&, Int_t type) const
+{
+    MGainFluctuationPix *pix = GetPixById(idx);
+
+    switch (type)
+    {
+    case 1:
+        val = pix->GetGain();
+        return kTRUE;
+    }
+    return kTRUE;
+}
+
+void MGainFluctuationCam::DrawPixelContent(Int_t num) const
+{
+    *fLog << warn << "MGainFluctuationCam::DrawPixelContent - not available." << endl;
+}
+
+TObject *MGainFluctuationCamIter::Next()
+{
+    if (!fUsedOnly)
+        return TObjArrayIter::Next();
+
+    MGainFluctuationPix *pix;
+    while ((pix = (MGainFluctuationPix*)TObjArrayIter::Next()))
+            return pix;
+    return pix;
+}
Index: trunk/MagicSoft/Mars/mtemp/mifae/library/MGainFluctuationCam.h
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/library/MGainFluctuationCam.h	(revision 6192)
+++ trunk/MagicSoft/Mars/mtemp/mifae/library/MGainFluctuationCam.h	(revision 6192)
@@ -0,0 +1,104 @@
+#ifndef MARS_MGainFluctuationCam
+#define MARS_MGainFluctuationCam
+
+#ifndef ROOT_TClonesArray
+#include <TClonesArray.h>
+#endif
+#ifndef ROOT_TArrayI
+#include <TArrayI.h>
+#endif
+#ifndef MARS_MCamEvent
+#include "MCamEvent.h"
+#endif
+#ifndef MARS_MGainFluctuationPix
+#include "MGainFluctuationPix.h"
+#endif
+
+class MGeomCam;
+class MGainFluctuationPix;
+class MGainFluctuationCamIter;
+
+class MGainFluctuationCam : public MParContainer, public MCamEvent
+{
+    friend class MGainFluctuationCamIter;
+private:
+    UInt_t        fNumPixels;
+     Int_t        fMaxIndex;
+    TArrayI       fLut;        // Lookup tabel to lookup pixel by index
+    TClonesArray *fPixels;     //-> FIXME: Change TClonesArray away from a pointer?
+
+    void RebuildLut()
+    {
+        // Resize Lut
+        fLut.Set(fMaxIndex+1);
+
+        // Reset Lut
+        fLut.Reset(-1);
+
+        // Rebuild Lut
+        for (UInt_t i=0; i<GetNumPixels(); i++)
+        {
+            const MGainFluctuationPix &pix = (*this)[i];
+            fLut[pix.GetPixId()] = i;
+        }
+    }
+
+public:
+    MGainFluctuationCam(const char *name=NULL, const char *title=NULL);
+    ~MGainFluctuationCam() { delete fPixels; }
+
+    // Setter function to fill pixels
+    MGainFluctuationPix *AddPixel(Int_t idx, Float_t gain);
+    void FixSize();
+
+    // Getter functions
+    UInt_t  GetNumPixels() const { return fNumPixels; }
+    Float_t GetGain(int i) const;
+
+    Float_t GetGainMin(const MGeomCam *geom=NULL) const;
+    Float_t GetGainMax(const MGeomCam *geom=NULL) const;
+
+    // Getter functions to access single pixels
+    MGainFluctuationPix &operator[](int i)       { return *(MGainFluctuationPix*)(fPixels->UncheckedAt(i)); }
+    MGainFluctuationPix &operator[](int i) const { return *(MGainFluctuationPix*)(fPixels->UncheckedAt(i)); }
+
+    MGainFluctuationPix *GetPixById(Int_t idx) const;
+
+    void Sort(Int_t upto = kMaxInt)
+    {
+        // Sort pixels by index
+        fPixels->Sort(upto);
+        RebuildLut();
+    } // For convinience: Sort pixels by index
+
+    // class MParContainer
+    void Reset();
+
+    // class TObject
+    void Print(Option_t *opt=NULL) const;
+    void Clear(Option_t *opt=NULL) { Reset(); }
+
+    // class MCamEvent
+    Bool_t GetPixelContent(Double_t &val, Int_t idx,const MGeomCam&, Int_t type=1) const;
+    void DrawPixelContent(Int_t num) const;
+
+    // To build an iterator for this class
+    operator TIterator*() const;
+
+    ClassDef(MGainFluctuationCam, 1)    // class for an event containing cerenkov photons
+};
+
+class MGainFluctuationCamIter : public TObjArrayIter
+{
+private:
+    Bool_t fUsedOnly;
+public:
+    MGainFluctuationCamIter(const MGainFluctuationCam *evt, Bool_t usedonly=kTRUE, Bool_t dir=kIterForward) : TObjArrayIter(evt->fPixels, dir), fUsedOnly(usedonly) { }
+    TObject *Next();
+    TIterator &operator=(const TIterator &) { return *this; }
+    ClassDef(MGainFluctuationCamIter, 0)
+};
+
+inline MGainFluctuationCam::operator TIterator*() const { return new MGainFluctuationCamIter(this); }
+
+#endif
Index: trunk/MagicSoft/Mars/mtemp/mifae/library/MGainFluctuationPix.cc
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/library/MGainFluctuationPix.cc	(revision 6192)
+++ trunk/MagicSoft/Mars/mtemp/mifae/library/MGainFluctuationPix.cc	(revision 6192)
@@ -0,0 +1,59 @@
+/* ======================================================================== *\
+!
+! *
+! * This file is part of MARS, the MAGIC Analysis and Reconstruction
+! * Software. It is distributed to you in the hope that it can be a useful
+! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
+! * It is distributed WITHOUT ANY WARRANTY.
+! *
+! * Permission to use, copy, modify and distribute this software and its
+! * documentation for any purpose is hereby granted without fee,
+! * provided that the above copyright notice appear in all copies and
+! * that both that copyright notice and this permission notice appear
+! * in supporting documentation. It is provided "as is" without express
+! * or implied warranty.
+! *
+!
+!
+!   Author(s): Oscar Blanch 1/2005 <mailto:blanch@ifae.es>
+!
+!   Copyright: MAGIC Software Development, 2000-2004
+!
+!
+\* ======================================================================== */
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// MGainFluctuationPix
+//
+// Storage container for the gain fluctuation in a pixel in relative value.
+//
+////////////////////////////////////////////////////////////////////////////
+#include "MGainFluctuationPix.h"
+
+#include "MLog.h"
+
+ClassImp(MGainFluctuationPix);
+
+using namespace std;
+
+// --------------------------------------------------------------------------
+//
+// Default constructor. 
+//
+MGainFluctuationPix::MGainFluctuationPix(Int_t pix, Float_t gain):
+  fPixId(pix), fGain(gain)
+{
+} 
+
+
+// --------------------------------------------------------------------------
+//
+//  Print information to gLog.
+//
+void MGainFluctuationPix::Print(Option_t *) const
+{ 
+    gLog << GetDescriptor() <<" Pixel: "<< fPixId;
+    gLog << "Relative gain " << fGain << endl;
+}
Index: trunk/MagicSoft/Mars/mtemp/mifae/library/MGainFluctuationPix.h
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/library/MGainFluctuationPix.h	(revision 6192)
+++ trunk/MagicSoft/Mars/mtemp/mifae/library/MGainFluctuationPix.h	(revision 6192)
@@ -0,0 +1,28 @@
+#ifndef MARS_MGainFluctuationPix_H
+#define MARS_MGainFluctuationPix_H
+
+#ifndef MARS_MParContainer
+#include "MParContainer.h"
+#endif
+
+class MGainFluctuationPix : public MParContainer
+{
+private:
+
+    Int_t    fPixId;     // the pixel Id
+
+    Float_t  fGain;      // The relative gain repect to nominal one
+
+public:
+    MGainFluctuationPix(Int_t pix=-1, Float_t gain=0);
+
+    Int_t   GetPixId() const            { return fPixId;   }
+    Float_t GetGain() const             { return fGain;    }
+    void    SetGain(Float_t g)          { fGain    = g; }
+
+    void    Print(Option_t *opt = NULL) const;
+
+    ClassDef(MGainFluctuationPix, 1)  // class containing information about the Cerenkov Photons in a pixel
+};
+
+#endif
Index: trunk/MagicSoft/Mars/mtemp/mifae/library/Makefile
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/library/Makefile	(revision 5963)
+++ trunk/MagicSoft/Mars/mtemp/mifae/library/Makefile	(revision 6192)
@@ -78,5 +78,8 @@
 	MHDisp.cc \
 	MFDisp.cc \
-	MFindDisp.cc
+	MFindDisp.cc \
+	MGainFluctuationPix.cc \
+	MGainFluctuationCam.cc \
+	MAddGainFluctuation.cc
 
 
