--- chewbacca/event/EventCounter.h 2009/07/29 15:47:20 1.3 +++ chewbacca/event/EventCounter.h 2009/08/04 13:58:16 1.4 @@ -1,6 +1,6 @@ /** @file * $Source: /afs/ba.infn.it/user/pamela/src/CVS/chewbacca/event/EventCounter.h,v $ - * $Id: EventCounter.h,v 1.2 2009/07/24 13:53:49 mocchiut Exp $ + * $Id: EventCounter.h,v 1.3 2009/07/29 15:47:20 mocchiut Exp $ * $Author: mocchiut $ * * Header file for the EventCounter class. @@ -8,12 +8,49 @@ #ifndef EVENTCOUNTER_H #define EVENTCOUNTER_H -#include #include "Exception.h" #include "PacketType.h" #include +#include namespace pamela { + + class mapval: public TObject { + private: + + public: + mapval(); + mapval(TString n, Int_t *i); + mapval(const mapval &val); + // Int_t fN; // + Int_t *count; //! + TString name; //! + void Clear(Option_t *t="") { t="";}; + mapval* GetMapVal(){return this;}; + ClassDef(mapval, 0); + }; + + class mappa: public TObject { + private: + Bool_t fend; + Int_t entries; + TClonesArray *val; + + public: + mappa(); + void Clear(Option_t *t=""); + void Delete(Option_t *t=""); + // + int GetEntries(){ return val->GetEntries();}; + void Insert(TString, Int_t *); + mapval* Find(TString); + mapval* Get(Int_t i){ return ((mapval*)val->At(i));}; + Bool_t end(){ return fend;}; + void Set(); + ClassDef(mappa, 1); + }; + + /** * Event counter. Contains the event numbers of the last read event of * each event type. @@ -70,21 +107,20 @@ int TsbT; int TsbB; - typedef std::map CounterMap; - CounterMap CMap; //! - + mappa CMap; + public: EventCounter(int = 0); /** Get the run number for the last read event of this type. */ int getPscu() const { return Pscu; }; /** Get the run number for the last read event of this type. */ - int Get(pamela::PacketType const *) const throw (NotExistingCounterException); + int Get(pamela::PacketType const *) throw (NotExistingCounterException); /** Get the run number for the next event of this type. */ - int Next(pamela::PacketType const *) const throw (NotExistingCounterException); + int Next(pamela::PacketType const *) throw (NotExistingCounterException); int GetRunNumber(void) const { return RunNumber; } void Increment(pamela::PacketType const *) throw (NotExistingCounterException); - void PrintCounters() const ; - ClassDef(EventCounter, 8) + void PrintCounters(); + ClassDef(EventCounter, 9) }; }