BmnRoot
Loading...
Searching...
No Matches
BmnSpillHeader.h
Go to the documentation of this file.
1#ifndef BMNSPILLHEADER_H
2#define BMNSPILLHEADER_H
3// STL
4#include <chrono>
5#include <map>
6#include <unordered_map>
7// ROOT
8#include <TTimeStamp.h>
9// bmnroot
10#include "BmnAliases.h"
11#include "BmnEnums.h"
12#include "BmnFunctionSet.h"
13#include "RawTypes.h"
14
15using SysClock = std::chrono::system_clock;
16using SysPoint = std::chrono::time_point<SysClock>;
17using std::array;
18using std::string;
19using std::vector;
20
21typedef std::map<string, vector<std::pair<SysPoint, UInt_t>>> ScalerNameSliceCntMap;
22
23class BmnSpillHeader : public TObject
24{
25 private:
27 UInt_t fEventIdStart;
29 UInt_t fEventIdEnd;
31 UInt_t fEventCnt;
33 UInt_t fPeriodId;
35 UInt_t fSpillId;
36 SysPoint fStartTS;
37 SysPoint fStopTS;
38 // ScalerNameSliceCntMap fScalers; // name -> count for each time slice
39 MapString2Cnt fScalersTotal; // name -> total spill MSC count
40 vector<uint64_t> fScalersVec;
41 MapString2Cnt fEventTrigCount; // name -> total spill trigger (TRC bit inside events)
42
43 // Name2SerCh fScalersMap;
44 array<UInt_t, kT0_BIN_BLOCK_WORDS> fRawT0Cntrs;
45
46 UInt_t fBeamTrigger;
47 UInt_t fBTnBusy;
48 UInt_t fL0;
49 UInt_t fTrigProtection;
50 UInt_t fBC1;
51 UInt_t fBC2;
52 UInt_t fBC3;
53 UInt_t fAccepted;
54 UInt_t fCand;
55 UInt_t fBP;
56 UInt_t fAP;
57 UInt_t fRj;
58 UInt_t fAll;
59 UInt_t fAvail;
60 // UInt_t fBC1H; ///< BC1 (high threshold)
61 // UInt_t fBC1BP; ///< BC1 (before protection)
62 // UInt_t fBC1xBC2;
63 // UInt_t fBC1nBusy;
64 // UInt_t fIntTrig;
65 // UInt_t fSRCTrig;
66 // UInt_t fTrignBusy; ///< Trigger * !Busy
67
68 public:
71
73 BmnSpillHeader(UInt_t run_id, UInt_t event_id, TTimeStamp event_time);
74
76 virtual ~BmnSpillHeader();
77
78 void Clear();
79
81 UInt_t GetLastEventId() { return fEventIdEnd; }
83 UInt_t GetFirstEventId() { return fEventIdStart; }
85 UInt_t GetNEvents() { return fEventCnt; }
86
88 UInt_t GetPeriodId() { return fPeriodId; }
89
91 UInt_t GetSpillId() { return fSpillId; }
92
93 // ScalerNameSliceCntMap& ScalersVec() { return fScalers; }
94
95 vector<uint64_t>& ScalersVec() { return fScalersVec; }
96
97 MapString2Cnt& Scalers() { return fScalersTotal; }
98
99 MapString2Cnt& EventTriggerCnt() { return fEventTrigCount; }
100
101 array<UInt_t, kT0_BIN_BLOCK_WORDS>& RawT0Counters() { return fRawT0Cntrs; }
102
104 SysPoint GetStartTime() { return fStartTS; }
105
107 SysPoint GetStopTime() { return fStopTS; }
108
110 TTimeStamp GetStartTS() { return BmnFunctionSet::TimePoint2TS(fStartTS); }
111
113 TTimeStamp GetStopTS() { return BmnFunctionSet::TimePoint2TS(fStopTS); }
114
115 void SetCand(UInt_t _v) { fCand = _v; }
116
117 UInt_t GetCand() { return fCand; }
118
119 void SetAccepted(UInt_t _v) { fAccepted = _v; }
120
121 UInt_t GetAccepted() { return fAccepted; }
122
123 void SetBefo(UInt_t _v) { fBP = _v; }
124
125 UInt_t GetBefo() { return fBP; }
126
127 void SetAfter(UInt_t _v) { fAP = _v; }
128
129 UInt_t GetAfter() { return fAP; }
130
131 void SetRjct(UInt_t _v) { fRj = _v; }
132
133 UInt_t GetRjct() { return fRj; }
134
135 void SetAll(UInt_t _v) { fAll = _v; }
136
137 UInt_t GetAll() { return fAll; }
138
139 void SetAvail(UInt_t _v) { fAvail = _v; }
140
141 UInt_t GetAvail() { return fAvail; }
142
143 void SetBT(UInt_t _v) { fBeamTrigger = _v; }
144
145 UInt_t GetBT() { return fBeamTrigger; }
146
147 void SetBTnBusy(UInt_t _v) { fBTnBusy = _v; }
148
149 UInt_t GetBTnBusy() { return fBTnBusy; }
150
151 void SetL0(UInt_t _v) { fL0 = _v; }
152
153 UInt_t GetL0() { return fL0; }
154
155 void SetProt(UInt_t _v) { fTrigProtection = _v; }
156
157 UInt_t GetProt() { return fTrigProtection; }
158
159 void SetBC1(UInt_t _v) { fBC1 = _v; }
160
161 UInt_t GetBC1() { return fBC1; }
162
163 void SetBC2(UInt_t _v) { fBC2 = _v; }
164
165 UInt_t GetBC2() { return fBC2; }
166
167 void SetBC3(UInt_t _v) { fBC3 = _v; }
168
169 UInt_t GetBC3() { return fBC3; }
170 // // SRC trig counters
171 // void SetBC1H(UInt_t _v) { fBC1H = _v; }
172 //
173 // UInt_t GetBC1H() { return fBC1H; }
174 //
175 // void SetBC1BP(UInt_t _v) { fBC1BP = _v; }
176 //
177 // UInt_t GetBC1BP() { return fBC1BP; }
178 //
179 // void SetBC1xBC2(UInt_t _v) { fBC1xBC2 = _v; }
180 //
181 // UInt_t GetBC1xBC2() { return fBC1xBC2; }
182 //
183 // void SetBC1nBusy(UInt_t _v) { fBC1nBusy = _v; }
184 //
185 // UInt_t GetBC1nBusy() { return fBC1nBusy; }
186 //
187 // void SetIntTrig(UInt_t _v) { fIntTrig = _v; }
188 //
189 // UInt_t GetIntTrig() { return fIntTrig; }
190 //
191 // void SetSRCTrig(UInt_t _v) { fSRCTrig = _v; }
192 //
193 // UInt_t GetSRCTrig() { return fSRCTrig; }
194 //
195 // void SetTrignBusy(UInt_t _v) { fTrignBusy = _v; }
196 //
197 // UInt_t GetTrignBusy() { return fTrignBusy; }
198
202 void SetFirstEventId(UInt_t event_id) { fEventIdStart = event_id; }
203
207 void SetLastEventId(UInt_t event_id) { fEventIdEnd = event_id; }
208
210 void SetNEvents(UInt_t events) { fEventCnt = events; }
211
215 void SetPeriodId(UInt_t period_id) { fPeriodId = period_id; }
216
220 void SetSpillId(UInt_t spill) { fSpillId = spill; }
221
223 void SetStartTime(SysPoint time) { fStartTS = time; }
224
226 void SetStopTime(SysPoint time) { fStopTS = time; }
227
229 void SetStartTS(TTimeStamp ts) { fStartTS = BmnFunctionSet::TimeStamp2TP(ts); }
230
232 void SetStopTS(TTimeStamp ts) { fStopTS = BmnFunctionSet::TimeStamp2TP(ts); }
233
234 ClassDef(BmnSpillHeader, 11)
235};
236
237#endif /* BMNSPILLHEADER_H */
std::chrono::system_clock SysClock
std::chrono::time_point< SysClock > SysPoint
std::unordered_map< std::string, uint64_t > MapString2Cnt
Definition BmnAliases.h:11
std::map< string, vector< std::pair< SysPoint, UInt_t > > > ScalerNameSliceCntMap
static SysPoint TimeStamp2TP(TTimeStamp p)
static TTimeStamp TimePoint2TS(SysPoint p)
SysPoint GetStopTime()
TTimeStamp GetStopTS()
UInt_t GetFirstEventId()
void SetSpillId(UInt_t spill)
SysPoint GetStartTime()
void SetBC3(UInt_t _v)
void SetBC2(UInt_t _v)
virtual ~BmnSpillHeader()
void SetBT(UInt_t _v)
void SetLastEventId(UInt_t event_id)
UInt_t GetLastEventId()
UInt_t GetNEvents()
void SetStartTime(SysPoint time)
UInt_t GetSpillId()
void SetAccepted(UInt_t _v)
void SetBC1(UInt_t _v)
void SetBTnBusy(UInt_t _v)
vector< uint64_t > & ScalersVec()
MapString2Cnt & EventTriggerCnt()
UInt_t GetPeriodId()
void SetStartTS(TTimeStamp ts)
void SetAvail(UInt_t _v)
void SetStopTS(TTimeStamp ts)
void SetProt(UInt_t _v)
void SetAll(UInt_t _v)
MapString2Cnt & Scalers()
void SetFirstEventId(UInt_t event_id)
array< UInt_t, kT0_BIN_BLOCK_WORDS > & RawT0Counters()
void SetBefo(UInt_t _v)
void SetL0(UInt_t _v)
void SetStopTime(SysPoint time)
TTimeStamp GetStartTS()
void SetCand(UInt_t _v)
void SetRjct(UInt_t _v)
void SetNEvents(UInt_t events)
void SetPeriodId(UInt_t period_id)
void SetAfter(UInt_t _v)
std::chrono::time_point< SysClock > SysPoint