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.1.1.1 2008/09/23 07:19:51 mocchiut Exp $ |
* $Id: EventCounter.h,v 1.3 2009/07/29 15:47:20 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(TString n, Int_t *i); |
24 |
|
mapval(const mapval &val); |
25 |
|
// Int_t fN; // |
26 |
|
Int_t *count; //! |
27 |
|
TString name; //! |
28 |
|
void Clear(Option_t *t="") { t="";}; |
29 |
|
mapval* GetMapVal(){return this;}; |
30 |
|
ClassDef(mapval, 0); |
31 |
|
}; |
32 |
|
|
33 |
|
class mappa: public TObject { |
34 |
|
private: |
35 |
|
Bool_t fend; |
36 |
|
Int_t entries; |
37 |
|
TClonesArray *val; |
38 |
|
|
39 |
|
public: |
40 |
|
mappa(); |
41 |
|
void Clear(Option_t *t=""); |
42 |
|
void Delete(Option_t *t=""); |
43 |
|
// |
44 |
|
int GetEntries(){ return val->GetEntries();}; |
45 |
|
void Insert(TString, Int_t *); |
46 |
|
mapval* Find(TString); |
47 |
|
mapval* Get(Int_t i){ return ((mapval*)val->At(i));}; |
48 |
|
Bool_t end(){ return fend;}; |
49 |
|
void Set(); |
50 |
|
ClassDef(mappa, 1); |
51 |
|
}; |
52 |
|
|
53 |
|
|
54 |
/** |
/** |
55 |
* Event counter. Contains the event numbers of the last read event of |
* Event counter. Contains the event numbers of the last read event of |
56 |
* each event type. |
* each event type. |
58 |
class EventCounter : public TObject { |
class EventCounter : public TObject { |
59 |
private: |
private: |
60 |
|
|
61 |
|
int RunNumber; /**< Run number */ |
62 |
int Pscu; |
int Pscu; |
63 |
int PhysEndRun; |
int PhysEndRun; |
64 |
int CalibCalPulse1; |
int CalibCalPulse1; |
106 |
int Ac2Alarm; |
int Ac2Alarm; |
107 |
int TsbT; |
int TsbT; |
108 |
int TsbB; |
int TsbB; |
|
int RunNumber; /**< Run number */ |
|
109 |
|
|
110 |
typedef std::map<const pamela::PacketType *, int *> CounterMap; |
mappa CMap; |
111 |
CounterMap CMap; //! |
|
|
|
|
112 |
public: |
public: |
113 |
EventCounter(int = 0); |
EventCounter(int = 0); |
114 |
/** Get the run number for the last read event of this type. */ |
/** Get the run number for the last read event of this type. */ |
115 |
int getPscu() const { return Pscu; }; |
int getPscu() const { return Pscu; }; |
116 |
/** Get the run number for the last read event of this type. */ |
/** Get the run number for the last read event of this type. */ |
117 |
int Get(pamela::PacketType const *) const throw (NotExistingCounterException); |
int Get(pamela::PacketType const *) throw (NotExistingCounterException); |
118 |
/** Get the run number for the next event of this type. */ |
/** Get the run number for the next event of this type. */ |
119 |
int Next(pamela::PacketType const *) const throw (NotExistingCounterException); |
int Next(pamela::PacketType const *) throw (NotExistingCounterException); |
120 |
int GetRunNumber(void) const { return RunNumber; } |
int GetRunNumber(void) const { return RunNumber; } |
121 |
void Increment(pamela::PacketType const *) throw (NotExistingCounterException); |
void Increment(pamela::PacketType const *) throw (NotExistingCounterException); |
122 |
void PrintCounters() const ; |
void PrintCounters(); |
123 |
ClassDef(EventCounter, 7) |
ClassDef(EventCounter, 9) |
124 |
}; |
}; |
125 |
} |
} |
126 |
|
|