#ifndef MARS_MCalibrationCam
#define MARS_MCalibrationCam

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

class TClonesArray;

class MCalibrationPix;
class MBadPixelsPix;
class MBadPixelsCam;
class MCalibrationCam : public MParContainer, public MCamEvent
{

protected:
  
  TClonesArray *fPixels;             //-> Array of MCalibrationPix, one per pixel
  TClonesArray *fAverageAreas;       //-> Array of MCalibrationPix, one per pixel area
  TClonesArray *fAverageSectors;     //-> Array of MCalibrationPix, one per camera sector
  TClonesArray *fAverageBadAreas;    //-> Array of MBadPixelsPix, one per pixel area
  TClonesArray *fAverageBadSectors;  //-> Array of MBadPixelsPix, one per camera sector
  
  Byte_t fFlags;                     // Byte to hold the flags
  
public:

  MCalibrationCam(const char *name=NULL, const char *title=NULL);
  ~MCalibrationCam();
  
  virtual void Clear(    Option_t *o="" );
  void InitSize( const UInt_t i );
  void InitAverageAreas(  const UInt_t i );
  void InitAverageSectors( const UInt_t i );

  // Getters
  Int_t   GetSize()               const;
  Int_t   GetAverageAreas()       const;
  Int_t   GetAverageSectors()     const;  

  // Others
  MCalibrationPix &operator[](UInt_t i);
  const MCalibrationPix &operator[](UInt_t i) const;

  MCalibrationPix &GetAverageArea(UInt_t i);
  const MCalibrationPix &GetAverageArea(UInt_t i) const;

  MBadPixelsPix &GetAverageBadArea(UInt_t i);
  const MBadPixelsPix &GetAverageBadArea(UInt_t i) const;

  MCalibrationPix &GetAverageSector(UInt_t i);
  const MCalibrationPix &GetAverageSector(UInt_t i) const;

  MBadPixelsPix &GetAverageBadSector(UInt_t i);
  const MBadPixelsPix &GetAverageBadSector(UInt_t i) const;

  // Draws
  virtual void DrawPixelContent(Int_t num) const;    
  
  // Others
  virtual Bool_t GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0) const;

  ClassDef(MCalibrationCam, 1)	// Base class Container for camera calibration
};

#endif
