/** @file
 * $Source: /home/cvspamela/yoda/event/EventCounter.h,v $
 * $Id: EventCounter.h,v 1.7 2004/04/22 15:51:03 nagni Exp $
 * $Author: nagni $
 * 
 * Header file for the EventCounter class.
 */
#ifndef EVENTCOUNTER_H
#define EVENTCOUNTER_H

#include <map>
//#include <root/TObject.h>
#include <TObject.h> //Substituted by Maurizio 05 Feb 2004

#include "PscuHeader.h"

namespace pamela {
  /**
   * Event counter. Contains the event numbers of the last read event of 
   * each event type.
   */
  class EventCounter : public TObject {
  private:
    int RunNumber;    /**< Run number */
    
    // New Packets. 
    int Pscu;
    int Physics;
    int Forced_Pkt;
    int Calib_Trk;
    int Calib_Trg;
    int Calib_Cal;
    int Calib_Trd;
    int Calib_Tof;
    int Calib_S4;
    int Run_Header;
    int Run_Trailer;
    int Alarm;
    int Khb;
    int Log;
    int VarDump;
    int ArrDump;
    int TabDump;
    int Tmtc;
    int Mcmd;
    int HA_Header_E5;

    typedef std::map<const pamela::PacketType *, int *> CounterMap;
    CounterMap CMap; //!
  public:
    EventCounter(int = 0);
    /** Get the run number for the last read event of this type. */
    int Get(pamela::PacketType const *) const;
    /** Get the run number for the next event of this type. */
    int Next(pamela::PacketType const *) const;
    int GetRunNumber(void) const { return RunNumber; }
    void Increment(pamela::PacketType const *);
    void PrintCounters() const ;
    ClassDef(EventCounter, 1)
  };
}

#endif /* EVENTCOUNTER_H */