BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
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:
26 /** Event Id **/
28 /** Event Id **/
30 /** Event count **/
32 /** Period Id **/
33 UInt_t fPeriodId;
34 /** Spill Id **/
36 // SysPoint fStartTS;
37 // SysPoint fStopTS;
38 // SysPoint fFirstEventTS;
39 // SysPoint fLastEventTS;
44 // ScalerNameSliceCntMap fScalers; // name -> count for each time slice
45 MapString2Cnt fScalersTotal; // name -> total spill MSC count
46 // vector<uint64_t> fScalersVec;
47 MapString2Cnt fEventTrigCount; // name -> total spill trigger (TRC bit inside events)
48
49 // Name2SerCh fScalersMap;
50 array<UInt_t, kT0_BIN_BLOCK_WORDS> fRawT0Cntrs;
51
54 UInt_t fL0;
61 UInt_t fBP;
62 UInt_t fAP;
63 UInt_t fRj;
66
67 public:
68 /** Constructor */
69 BmnSpillHeader(UInt_t period_id = 0, UInt_t event_id = 0);
70
71 /** Destructor */
72 virtual ~BmnSpillHeader();
73
74 void Clear();
75
76 /** Get the the first event ID for the spill */
78 /** Get the the last event ID for the spill */
80 /** Get the event count in the spill */
82
83 /** Get the period ID */
85
86 /** Get the spill ID */
88
89 // ScalerNameSliceCntMap& ScalersVec() { return fScalers; }
90
91 // vector<uint64_t>& ScalersVec() { return fScalersVec; }
92
94
96
97 array<UInt_t, kT0_BIN_BLOCK_WORDS>& RawT0Counters() { return fRawT0Cntrs; }
98
99 /** Get the start TS */
101
102 /** Get the stop TS */
104
105 /** Get the start TS */
106 const TTimeStamp& GetStartTS() { return fStartTS; }
107 // const TTimeStamp GetStartTS() { return BmnFunctionSet::TimePoint2TS(fStartTS); }
108
109 /** Get the stop TS */
110 const TTimeStamp& GetStopTS() { return fStopTS; }
111 // const TTimeStamp GetStopTS() { return BmnFunctionSet::TimePoint2TS(fStopTS); }
112
113 /** Get time the first event in the spill */
115
116 /** Get time the last event in the spill */
118
119 /** Get time the first event in the spill */
121 // const TTimeStamp GetFirstEventTS() { return BmnFunctionSet::TimePoint2TS(fFirstEventTS); }
122
123 /** Get time the last event in the spill */
125 // const TTimeStamp GetLastEventTS() { return BmnFunctionSet::TimePoint2TS(fLastEventTS); }
126
127 void SetCand(UInt_t _v) { fCand = _v; }
128
129 UInt_t GetCand() { return fCand; }
130
131 void SetAccepted(UInt_t _v) { fAccepted = _v; }
132
134
135 void SetBefo(UInt_t _v) { fBP = _v; }
136
137 UInt_t GetBefo() { return fBP; }
138
139 void SetAfter(UInt_t _v) { fAP = _v; }
140
141 UInt_t GetAfter() { return fAP; }
142
143 void SetRjct(UInt_t _v) { fRj = _v; }
144
145 UInt_t GetRjct() { return fRj; }
146
147 void SetAll(UInt_t _v) { fAll = _v; }
148
149 UInt_t GetAll() { return fAll; }
150
151 void SetAvail(UInt_t _v) { fAvail = _v; }
152
153 UInt_t GetAvail() { return fAvail; }
154
155 void SetBT(UInt_t _v) { fBeamTrigger = _v; }
156
158
159 void SetBTnBusy(UInt_t _v) { fBTnBusy = _v; }
160
162
163 void SetL0(UInt_t _v) { fL0 = _v; }
164
165 UInt_t GetL0() { return fL0; }
166
167 void SetProt(UInt_t _v) { fTrigProtection = _v; }
168
170
171 void SetBC1(UInt_t _v) { fBC1 = _v; }
172
173 UInt_t GetBC1() { return fBC1; }
174
175 void SetBC2(UInt_t _v) { fBC2 = _v; }
176
177 UInt_t GetBC2() { return fBC2; }
178
179 void SetBC3(UInt_t _v) { fBC3 = _v; }
180
181 UInt_t GetBC3() { return fBC3; }
182
183 /** Set the first event ID for the spill
184 * @param event_id : unique event id
185 */
186 void SetFirstEventId(UInt_t event_id) { fEventIdStart = event_id; }
187
188 /** Set the last event ID for the spill
189 * @param event_id : unique event id
190 */
191 void SetLastEventId(UInt_t event_id) { fEventIdEnd = event_id; }
192
193 /** Set the event count in the spill */
194 void SetNEvents(UInt_t events) { fEventCnt = events; }
195
196 /** Set the period ID
197 * @param period_id : unique period id
198 */
199 void SetPeriodId(UInt_t period_id) { fPeriodId = period_id; }
200
201 /** Set the spill ID
202 * @param spill : spill id
203 */
204 void SetSpillId(UInt_t spill) { fSpillId = spill; }
205
206 /** Set the time for spill start */
208
209 /** Set the time for spill stop */
211
212 /** Set the time for spill start */
213 void SetStartTS(const TTimeStamp& ts) { fStartTS = ts; }
214 // void SetStartTS(TTimeStamp ts) { fStartTS = BmnFunctionSet::TimeStamp2TP(ts); }
215
216 /** Set the time for spill stop */
217 void SetStopTS(const TTimeStamp& ts) { fStopTS = ts; }
218 // void SetStopTS(TTimeStamp ts) { fStopTS = BmnFunctionSet::TimeStamp2TP(ts); }
219
220 /** Set the time for the first event in the spill */
222
223 /** Set the time for the last event in the spill */
225
226 /** Set the time for the first event in the spill */
227 void SetFirstEventTS(const TTimeStamp& ts) { fFirstEventTS = ts; }
228 // void SetFirstEventTS(TTimeStamp ts) { fFirstEventTS = BmnFunctionSet::TimeStamp2TP(ts); }
229
230 /** Set the time for the last event in the spill */
231 void SetLastEventTS(const TTimeStamp& ts) { fLastEventTS = ts; }
232 // void SetLastEventTS(TTimeStamp ts) { fLastEventTS = BmnFunctionSet::TimeStamp2TP(ts); }
233
235};
236
237#endif /* BMNSPILLHEADER_H */
unsigned int UInt_t
#define ClassDef(name, id)
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)
TTimeStamp fLastEventTS
TTimeStamp fStartTS
TTimeStamp fFirstEventTS
const SysPoint GetFirstEventTime()
Get time the first event in the spill.
UInt_t GetFirstEventId()
Get the the first event ID for the spill.
void SetSpillId(UInt_t spill)
Set the spill ID.
MapString2Cnt fScalersTotal
UInt_t fEventIdEnd
Event Id.
BmnSpillHeader(UInt_t period_id=0, UInt_t event_id=0)
Constructor.
const TTimeStamp & GetFirstEventTS()
Get time the first event in the spill.
void SetBC3(UInt_t _v)
virtual ~BmnSpillHeader()
Destructor.
void SetLastEventTS(const TTimeStamp &ts)
Set the time for the last event in the spill.
void SetStartTS(const TTimeStamp &ts)
Set the time for spill start.
UInt_t fSpillId
Spill Id.
const TTimeStamp & GetStartTS()
Get the start TS.
void SetStartTime(const SysPoint &time)
Set the time for spill start.
void SetBC2(UInt_t _v)
void SetBT(UInt_t _v)
void SetLastEventId(UInt_t event_id)
Set the last event ID for the spill.
const TTimeStamp & GetLastEventTS()
Get time the last event in the spill.
UInt_t GetLastEventId()
Get the the last event ID for the spill.
UInt_t GetNEvents()
Get the event count in the spill.
const SysPoint GetStopTime()
Get the stop TS.
UInt_t GetSpillId()
Get the spill ID.
void SetAccepted(UInt_t _v)
void SetBC1(UInt_t _v)
void SetBTnBusy(UInt_t _v)
MapString2Cnt & EventTriggerCnt()
const SysPoint GetLastEventTime()
Get time the last event in the spill.
UInt_t GetPeriodId()
Get the period ID.
MapString2Cnt fEventTrigCount
void SetStopTS(const TTimeStamp &ts)
Set the time for spill stop.
void SetAvail(UInt_t _v)
void SetProt(UInt_t _v)
const SysPoint GetStartTime()
Get the start TS.
void SetAll(UInt_t _v)
UInt_t fEventCnt
Event count.
void SetLastEventTime(const SysPoint &time)
Set the time for the last event in the spill.
MapString2Cnt & Scalers()
void SetFirstEventId(UInt_t event_id)
Set the first event ID for the spill.
array< UInt_t, kT0_BIN_BLOCK_WORDS > & RawT0Counters()
UInt_t fEventIdStart
Event Id.
void SetBefo(UInt_t _v)
TTimeStamp fStopTS
const TTimeStamp & GetStopTS()
Get the stop TS.
void SetL0(UInt_t _v)
void SetCand(UInt_t _v)
void SetRjct(UInt_t _v)
void SetNEvents(UInt_t events)
Set the event count in the spill.
void SetPeriodId(UInt_t period_id)
Set the period ID.
UInt_t fPeriodId
Period Id.
array< UInt_t, kT0_BIN_BLOCK_WORDS > fRawT0Cntrs
void SetFirstEventTS(const TTimeStamp &ts)
Set the time for the first event in the spill.
void SetStopTime(const SysPoint &time)
Set the time for spill stop.
void SetAfter(UInt_t _v)
void SetFirstEventTime(const SysPoint &time)
Set the time for the first event in the spill.
Define enumerations used in tracking.
std::chrono::time_point< SysClock > SysPoint