1 |
/** @file |
/** @file |
2 |
* $Source: /afs/ba.infn.it/user/pamela/src/CVS/chewbacca/event/EventCounter.h,v $ |
* $Source: /afs/ba.infn.it/user/pamela/src/CVS/chewbacca/event/EventCounter.h,v $ |
3 |
* $Id: EventCounter.h,v 1.2 2009/07/24 13:53:49 mocchiut Exp $ |
* $Id: EventCounter.h,v 1.5 2010/02/11 09:02:15 mocchiut Exp $ |
4 |
* $Author: mocchiut $ |
* $Author: mocchiut $ |
5 |
* |
* |
6 |
* Header file for the EventCounter class. |
* Header file for the EventCounter class. |
8 |
#ifndef EVENTCOUNTER_H |
#ifndef EVENTCOUNTER_H |
9 |
#define EVENTCOUNTER_H |
#define EVENTCOUNTER_H |
10 |
|
|
|
#include <map> |
|
11 |
#include "Exception.h" |
#include "Exception.h" |
12 |
#include "PacketType.h" |
#include "PacketType.h" |
13 |
#include <TObject.h> |
#include <TObject.h> |
14 |
|
#include <TClonesArray.h> |
15 |
|
|
16 |
namespace pamela { |
namespace pamela { |
17 |
|
|
18 |
|
class mapval: public TObject { |
19 |
|
private: |
20 |
|
|
21 |
|
public: |
22 |
|
mapval(); |
23 |
|
~mapval(){this->Clear();}; |
24 |
|
mapval(TString n, Int_t *i); |
25 |
|
mapval(const mapval &val); |
26 |
|
// Int_t fN; // |
27 |
|
Int_t *count; //! |
28 |
|
TString name; //! |
29 |
|
void Clear(Option_t *t="") { name.Clear(); name.Resize(0); count=0;}; |
30 |
|
mapval* GetMapVal(){return this;}; |
31 |
|
ClassDef(mapval, 1); |
32 |
|
}; |
33 |
|
|
34 |
|
class mappa: public TObject { |
35 |
|
private: |
36 |
|
Bool_t fend; |
37 |
|
Int_t entries; |
38 |
|
TClonesArray *val; |
39 |
|
|
40 |
|
public: |
41 |
|
mappa(); |
42 |
|
~mappa(){this->Clear();}; |
43 |
|
void Clear(Option_t *t=""); |
44 |
|
void Delete(Option_t *t=""); |
45 |
|
// |
46 |
|
int GetEntries(){ return val->GetEntries();}; |
47 |
|
void Insert(TString, Int_t *); |
48 |
|
mapval* Find(TString); |
49 |
|
mapval* Get(Int_t i){ return ((mapval*)val->At(i));}; |
50 |
|
Bool_t end(){ return fend;}; |
51 |
|
void Set(); |
52 |
|
ClassDef(mappa, 2); |
53 |
|
}; |
54 |
|
|
55 |
|
|
56 |
/** |
/** |
57 |
* Event counter. Contains the event numbers of the last read event of |
* Event counter. Contains the event numbers of the last read event of |
58 |
* each event type. |
* each event type. |
109 |
int TsbT; |
int TsbT; |
110 |
int TsbB; |
int TsbB; |
111 |
|
|
112 |
typedef std::map<const pamela::PacketType *, int *> CounterMap; |
mappa CMap; |
113 |
CounterMap CMap; //! |
|
|
|
|
114 |
public: |
public: |
115 |
EventCounter(int = 0); |
EventCounter(int = 0); |
116 |
|
~EventCounter(){this->Clear();}; |
117 |
/** Get the run number for the last read event of this type. */ |
/** Get the run number for the last read event of this type. */ |
118 |
int getPscu() const { return Pscu; }; |
int getPscu() const { return Pscu; }; |
119 |
/** Get the run number for the last read event of this type. */ |
/** Get the run number for the last read event of this type. */ |
120 |
int Get(pamela::PacketType const *) const throw (NotExistingCounterException); |
int Get(pamela::PacketType const *) throw (NotExistingCounterException); |
121 |
/** Get the run number for the next event of this type. */ |
/** Get the run number for the next event of this type. */ |
122 |
int Next(pamela::PacketType const *) const throw (NotExistingCounterException); |
int Next(pamela::PacketType const *) throw (NotExistingCounterException); |
123 |
int GetRunNumber(void) const { return RunNumber; } |
int GetRunNumber(void) const { return RunNumber; } |
124 |
void Increment(pamela::PacketType const *) throw (NotExistingCounterException); |
void Increment(pamela::PacketType const *) throw (NotExistingCounterException); |
125 |
void PrintCounters() const ; |
void PrintCounters(); |
126 |
ClassDef(EventCounter, 8) |
void Clear(Option_t *t=""){CMap.Clear();}; |
127 |
|
ClassDef(EventCounter, 10) |
128 |
}; |
}; |
129 |
} |
} |
130 |
|
|