#ifndef MARS_MCerPhotPix_H
#define MARS_MCerPhotPix_H

#ifndef MARS_MParContainer
#include "MParContainer.h"
#endif

class MCerPhotPix : public MParContainer
{
private:

    Int_t    fPixId;     // the pixel Id

    Bool_t   fIsCore;     // the pixel is a Core pixel -> kTRUE
    Short_t  fRing;       // NT: number of analyzed rings around the core pixels, fRing>0 means: used, fRing= 0 means: unused, fRing= -1 means: unmapped (no possible to use in the calculation of the image parameters)
    Short_t  fIdxIsland;  // the pixel is a Core pixel -> kTRUE

    Float_t  fPhot;      // The number of Cerenkov photons
    Float_t  fErrPhot;   // the error of fPhot

    Bool_t   fIsSaturated;   // the pixel's low gain is saturated
    Bool_t   fIsHGSaturated; // the pixel's high gain is saturated

    // FIXME: arrival time t, and it's error sigma t

public:
    MCerPhotPix(Int_t pix=-1, Float_t phot=0, Float_t errphot=0);

    Int_t   GetPixId() const            { return fPixId;   }
    Float_t GetNumPhotons() const       { return fPhot;    }
    Float_t GetErrorPhot() const        { return fErrPhot; }
    
    Bool_t  IsPixelUsed() const         { return fRing>0; }
    Bool_t  IsPixelUnmapped() const     { return fRing==-1; }
    void    SetPixelUnused()            { fRing=0; }
    void    SetPixelUsed()              { fRing=1; }
    void    SetPixelUnmapped()          { fRing=-1;}
    void    SetIdxIsland(Short_t num)   { fIdxIsland=num; }
    Short_t GetIdxIsland() const        { return fIdxIsland; }

    void    SetRing(UShort_t r)         { fRing = r;   }
    Short_t GetRing() const             { return fRing;}

    void    SetPixelCore()              { fIsCore = kTRUE; }
    Bool_t  IsPixelCore() const         { return fIsCore;  }

    void    SetNumPhotons(Float_t f)    { fPhot    = f; }
    void    SetErrorPhot(Float_t f)     { fErrPhot = f; }
    void    Set(Float_t np, Float_t ep) { fPhot = np; fErrPhot = ep; }

    void    SetPixelSaturated()         { fIsSaturated = kTRUE; }
    Bool_t  IsPixelSaturated() const    { return fIsSaturated; }

    void    SetPixelHGSaturated()       { fIsHGSaturated = kTRUE; }
    Bool_t  IsPixelHGSaturated() const  { return fIsHGSaturated; }

    void    AddNumPhotons(Float_t f)    { fPhot += f; }

    void    Scale(Float_t f)            { fPhot/=f; }

    void    Print(Option_t *opt = NULL) const;
    Int_t   Compare(const TObject *obj) const;
    Bool_t  IsSortable() const { return kTRUE; }

    ClassDef(MCerPhotPix, 5)  // class containing information about the Cerenkov Photons in a pixel
};

#endif



