#ifndef TMHistogrammingList_H
#define TMHistogrammingList_H

#include "TMHistogrammingListNode.h"
#include <list>
#include <Rtypes.h>
#include <fstream.h>

class TMHistogramming;
class HenrikClusterFinderSPD;
class AliITSRawStreamSPD;
struct eventHeaderStruct;

class TMHistogrammingList {
 public:
  static TMHistogrammingList* Instance();
  virtual ~TMHistogrammingList();

  virtual TMHistogramming* GetHistogrammingObj(UInt_t id, UInt_t plotNr);

  virtual void Clear();

  virtual Bool_t GetAutoReset(UInt_t id, UInt_t plotNr);
  virtual void   SetAutoReset(UInt_t id, UInt_t plotNr, Bool_t autoreset);
  virtual Bool_t GetPaused(UInt_t id, UInt_t plotNr);
  virtual void   SetPaused(UInt_t id, UInt_t plotNr, Bool_t paused);
  virtual void   SetTriggerMask(UInt_t id, UInt_t plotNr, ULong_t word0, ULong_t word1);
  virtual void   SetTriggerMaskAll(ULong_t word0, ULong_t word1);

  virtual void AddHistogrammingObj(TMHistogramming *disp, UInt_t id, UInt_t plotNr);
  virtual void RemoveHistogrammingObj(UInt_t id, UInt_t plotNr);

  virtual void Reset();
  virtual void ResetAuto();

  virtual void ResetID(UInt_t id, UInt_t plotNr);

  virtual void StartEvent(eventHeaderStruct *event, UInt_t globalEventNumber);
  virtual void ProcessEvent(eventHeaderStruct *event);
  virtual void ProcessPixel(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row);
  virtual void ProcessCluster(Float_t x, Float_t y, Float_t z, UInt_t module, UInt_t size, UInt_t widz, UInt_t widphi, UInt_t type);
  virtual void ProcessClusters(HenrikClusterFinderSPD* clFinder);
  virtual void EndEvent(AliITSRawStreamSPD *str, UInt_t globalEventNumber);

  virtual void SaveEntries(ofstream& sFile);


 protected:
  std::list<TMHistogrammingListNode*>  fList;

 private:
  TMHistogrammingList();
  static Bool_t instanceFlag;
  static TMHistogrammingList *single;

};

#endif
