#ifndef ADVEVCOUNTCHECK_H
#define ADVEVCOUNTCHECK_H

#include <Rtypes.h>

class AdvEvCountCheck {

 public:
  AdvEvCountCheck();
  virtual ~AdvEvCountCheck();

  void   Reset();
  void   NewChipHeader(UInt_t eq, UInt_t hs, UInt_t chip, Short_t evCo, UInt_t eventNum);
  void   ProcessPayload(Char_t *tempChar, UInt_t eqid, UInt_t eventNum);
  void   PrepareNewEvent();
  void   CompareEvCount(UInt_t eventNum);
  void   CompareEvCountZero(UInt_t eventNum);
  void   DumpEvCount(Bool_t dispExp=kFALSE);
  void   SetDumpAll(Bool_t set=kTRUE);

  void   SetEqPresent(UInt_t eq, Bool_t set=kTRUE);
  void   SetHSPresent(UInt_t eq, UInt_t hs, Bool_t set=kTRUE);

  Bool_t IsErrorEventZero();
  Bool_t IsErrorEvent(UInt_t eq, UInt_t hs, UInt_t chip);
  Bool_t IsJumpErrorEvent(UInt_t eq, UInt_t hs, UInt_t chip);

 private:
  Bool_t   fDumpAll;
  UInt_t   nrProcessedEvents;
  Int_t    payloadSize;
  UInt_t   evNum[20][6][10];
  UInt_t   evNumPrevious[20][6][10];
  Short_t  evCounter[20][6][10];
  Short_t  evCounterPrevious[20][6][10];
  Bool_t   fEqPresent[20];
  Bool_t   fHSPresent[20][6];
  
  Bool_t   problemEventZero;
  Bool_t   problemEvent[20][6][10];
  Bool_t   problemJumpEvent[20][6][10];
  

};

#endif
