#ifndef MARS_MHFadcCam
#define MARS_MHFadcCam

#ifndef ROOT_TObjArray
#include <TObjArray.h>
#endif

#ifndef MARS_MH
#include "MH.h"
#endif
#ifndef MARS_MHFadcPix
#include "MHFadcPix.h"
#endif

#ifndef ROOT_TH1
#include <TH1.h>
#endif

class MHFadcCam : public MH
{
private:
    TObjArray *fArray;	// List of Lo/Hi gain Histograms

    void FillHi(UInt_t ipix, Byte_t data) { (*this)[ipix]->FillHi(data); }
    void FillLo(UInt_t ipix, Byte_t data) { (*this)[ipix]->FillLo(data); }

public:
    MHFadcCam(const char *name=NULL, const char *title=NULL);
    ~MHFadcCam();

    //    void SaveHist(char *name);

    MHFadcPix *operator[](UInt_t i) { return (MHFadcPix*)(fArray->At(i)); }

    TH1F *GetHistHi(UInt_t i)  { return (*this)[i]->GetHistHi(); }
    TH1F *GetHistLo(UInt_t i)  { return (*this)[i]->GetHistLo(); }

    void Fill(const MParContainer *par);

    //
    // FIXME! This should be replaced by a Draw(Option_t)-function
    //
    void DrawHi(UInt_t i)      { GetHistHi(i)->Draw(); }
    void DrawLo(UInt_t i)      { GetHistLo(i)->Draw(); }

    void DrawPix(UInt_t i)     { (*this)[i]->Draw(); }

    Int_t GetEntries() const   { return fArray->GetEntries(); }

    TObject *Clone(const char *opt="") const;

    ClassDef(MHFadcCam, 1) // A list of histograms storing the Fadc spektrum of one pixel
};

#endif

