--- chewbacca/event/EventCounter.h 2008/09/23 07:19:51 1.1.1.1 +++ chewbacca/event/EventCounter.h 2015/01/19 12:34:17 1.6 @@ -1,27 +1,66 @@ /** @file - * $Source: /repository/event/EventCounter.h,v $ - * $Id: EventCounter.h,v 1.1 2008-01-11 17:14:21 messineo Exp $ - * $Author: messineo $ + * $Source: /afs/ba.infn.it/user/pamela/src/CVS/chewbacca/event/EventCounter.h,v $ + * $Id: EventCounter.h,v 1.5 2010/02/11 09:02:15 mocchiut Exp $ + * $Author: mocchiut $ * * Header file for the EventCounter class. */ #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(){this->Clear();}; + mapval(TString n, Int_t *i); + mapval(const mapval &val); + // Int_t fN; // + Int_t *count; //! + TString name; //! + void Clear(Option_t *t="") { name.Clear(); name.Resize(0); count=0;}; + mapval* GetMapVal(){return this;}; + ClassDef(mapval, 1); + }; + + class mappa: public TObject { + private: + Bool_t fend; + Int_t entries; + TClonesArray *val; + + public: + mappa(); + ~mappa(){this->Clear();}; + 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, 2); + }; + + /** * Event counter. Contains the event numbers of the last read event of * each event type. */ class EventCounter : public TObject { private: + int RunNumber; /**< Run number */ - int Pscu; int PhysEndRun; int CalibCalPulse1; @@ -70,21 +109,22 @@ int TsbT; int TsbB; - typedef std::map CounterMap; - CounterMap CMap; //! - + mappa CMap; + public: EventCounter(int = 0); + ~EventCounter(){this->Clear();}; /** 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, 7) + void PrintCounters(); + void Clear(Option_t *t=""){CMap.Clear();}; + ClassDef(EventCounter, 10) }; }