1 |
/** @file |
2 |
* $Source: /afs/ba.infn.it/user/pamela/src/CVS/chewbacca/event/EventCounter.h,v $ |
3 |
* $Id: EventCounter.h,v 1.5 2010/02/11 09:02:15 mocchiut Exp $ |
4 |
* $Author: mocchiut $ |
5 |
* |
6 |
* Header file for the EventCounter class. |
7 |
*/ |
8 |
#ifndef EVENTCOUNTER_H |
9 |
#define EVENTCOUNTER_H |
10 |
|
11 |
#include "Exception.h" |
12 |
#include "PacketType.h" |
13 |
#include <TObject.h> |
14 |
#include <TClonesArray.h> |
15 |
|
16 |
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 |
58 |
* each event type. |
59 |
*/ |
60 |
class EventCounter : public TObject { |
61 |
private: |
62 |
|
63 |
int RunNumber; /**< Run number */ |
64 |
int Pscu; |
65 |
int PhysEndRun; |
66 |
int CalibCalPulse1; |
67 |
int CalibCalPulse2; |
68 |
int Physics; |
69 |
int CalibTrkBoth; |
70 |
int CalibTrk1; |
71 |
int CalibTrk2; |
72 |
int CalibCal; |
73 |
int CalibTof; |
74 |
int CalibS4; |
75 |
int CalibCalPed; |
76 |
int Calib1_Ac1; |
77 |
int Calib1_Ac2; |
78 |
int Calib2_Ac1; |
79 |
int Calib2_Ac2; |
80 |
int RunHeader; |
81 |
int RunTrailer; |
82 |
int CalibHeader; |
83 |
int CalibTrailer; |
84 |
int InitHeader; |
85 |
int InitTrailer; |
86 |
int EventTrk; |
87 |
int Log; |
88 |
int VarDump; |
89 |
int ArrDump; |
90 |
int TabDump; |
91 |
int Tmtc; |
92 |
int Mcmd; |
93 |
int ForcedFECmd; |
94 |
int Ac1Init; |
95 |
int CalInit; |
96 |
int TrkInit; |
97 |
int TofInit; |
98 |
int TrgInit; |
99 |
int NdInit; |
100 |
int S4Init; |
101 |
int Ac2Init; |
102 |
int CalAlarm; |
103 |
int Ac1Alarm; |
104 |
int TrkAlarm; |
105 |
int TrgAlarm; |
106 |
int TofAlarm; |
107 |
int S4Alarm; |
108 |
int Ac2Alarm; |
109 |
int TsbT; |
110 |
int TsbB; |
111 |
|
112 |
mappa CMap; |
113 |
|
114 |
public: |
115 |
EventCounter(int = 0); |
116 |
~EventCounter(){this->Clear();}; |
117 |
/** Get the run number for the last read event of this type. */ |
118 |
int getPscu() const { return Pscu; }; |
119 |
/** Get the run number for the last read event of this type. */ |
120 |
int Get(pamela::PacketType const *) throw (NotExistingCounterException); |
121 |
/** Get the run number for the next event of this type. */ |
122 |
int Next(pamela::PacketType const *) throw (NotExistingCounterException); |
123 |
int GetRunNumber(void) const { return RunNumber; } |
124 |
void Increment(pamela::PacketType const *) throw (NotExistingCounterException); |
125 |
void PrintCounters(); |
126 |
void Clear(Option_t *t=""){CMap.Clear();}; |
127 |
ClassDef(EventCounter, 10) |
128 |
}; |
129 |
} |
130 |
|
131 |
#endif /* EVENTCOUNTER_H */ |
132 |
|
133 |
|