BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
DigiRunHeader.h
Go to the documentation of this file.
1#ifndef BMNDIGIRUNHEADER_H
2#define BMNDIGIRUNHEADER_H
3
4#include <map>
5#include <unordered_map>
6// ROOT
7#include "TObject.h"
8#include "TTimeStamp.h"
9// BmnRoot
10#include "BmnAliases.h"
11#include "BmnFunctionSet.h"
12#include "BmnSpillInfo.h"
13#include "BmnTrigConfig.h"
14#include "RawTypes.h"
15
16using std::map;
17using std::unordered_map;
18using std::vector;
19
20class DigiRunHeader : public TObject
21{
22 private:
23 /** Period Id **/
24 uint32_t fPeriodId;
25 /** Run Id **/
26 uint32_t fRunId;
27 /** Event count **/
28 uint64_t fEventCnt;
29 TTimeStamp fRunStartTime;
30 TTimeStamp fRunEndTime;
31 uint64_t fBeamTrigger;
32 uint64_t fBTnBusy;
33 Double_t fBTAccepted; ///< BT&notBusy normalized according to Acc/(Acc + BP + AP) | for SRC => sum [BT * (DAQ_Busy
34 ///< -peds)/ (DAQ_TRigger - peds)]
35 uint64_t fAccepted;
36 uint64_t fProtection;
37 uint64_t fL0;
38 uint64_t fBP;
39 uint64_t fAP;
40
41 map<SysPoint, BmnSpillInfo> fSpillMap;
45 vector<uint64_t> fScalersVec;
46 NameChMap scalers_name2index_map; ///< name -> index in fScalersVec (scaler index)
47 vector<string> scalers_index2name_map; ///< index -> name
48 map<uint16_t, uint16_t> fTrcIdx2ScalerIdx; ///< TRC index -> scaler index
49 unordered_map<uint32_t, vector<uint64_t>> fBoardSums; ///< (MSC serial, raw sums of the counters)
50
51 std::array<uint64_t, kT0_BIN_BLOCK_WORDS> rawt0_cntrs = {};
52 MapString2Cnt event_trig_count; // name -> total spill trigger (TRC bit inside events)
53
54 BmnTrigConfig trig_config;
55
56 public:
57 // /** Default constructor */
58 // DigiRunHeader();
59
60 /** Constructor
61 * \param[in] period_id : unique period id
62 * \param[in] run_id : unique run id
63 * \param[in] run_start_time : run start time
64 * \param[in] run_end_time : run end time
65 */
66 DigiRunHeader(uint32_t period_id = 9,
67 uint32_t run_id = 0,
68 TTimeStamp run_start_time = TTimeStamp(0, 0),
69 TTimeStamp run_end_time = TTimeStamp(0, 0));
70
71 /** Destructor */
72 virtual ~DigiRunHeader();
73
74 /** Get the period ID for this run */
75 uint64_t GetPeriodId() { return fPeriodId; }
76 /** Get the run ID */
77 uint64_t GetRunId() { return fRunId; }
78 /** Get the event count */
79 uint64_t GetNEvents() { return fEventCnt; }
80 /** Get the BeamTrigger counter */
81 uint64_t GetBT() { return fBeamTrigger; }
82 /** Get the BT and not Busy */
83 uint64_t GetBTnBusy() { return fBTnBusy; }
84 /** Get the (BT and not Busy) by live time */
86 /** Get the Accepted by live time */
87 uint64_t GetAccepted() { return fAccepted; }
88 /** Get the Trigger Protection */
89 uint64_t GetProtection() { return fProtection; }
90 /** Get the L0 */
91 uint64_t GetL0() { return fL0; }
92 /** Ref to the T0 map */
93 T0ChMap& T0Map() { return fT0Map; }
94 /** TRC bit map */
96 /** MSC bit map */
98
100
101 vector<string>& ScalersIndex2NameMap() { return scalers_index2name_map; }
102
103 map<uint16_t, uint16_t>& TrcIndex2ScalerIndexMap() { return fTrcIdx2ScalerIdx; }
104
106 {
107 for (size_t iSc = 0; iSc < scalers_index2name_map.size(); iSc++) {
108 string& name = scalers_index2name_map[iSc];
109 uint64_t& val = fScalersVec[iSc];
110 printf("MSC %-14s %10lu\n", name.c_str(), val);
111 }
112 }
113
114 vector<uint64_t>& ScalersVec() { return fScalersVec; }
115
116 uint64_t GetScaler(string name);
117
118 uint64_t GetRawT0Counter(string name, uint32_t ch = 0);
119 // uint64_t GetTrcCounter(string name);
120 /** Raw T0 counters (sum over all spills)*/
121 std::array<uint64_t, kT0_BIN_BLOCK_WORDS>& RawT0Counters() { return rawt0_cntrs; }
122
124
125 // vector<vector<> >
126 /** Get the raw MSC counters */
127 unordered_map<uint32_t, vector<uint64_t>>& GetRawMSC() { return fBoardSums; }
128 map<SysPoint, BmnSpillInfo>& GetSpillMap() { return fSpillMap; }
129
130 /** Get DAQ trigger config */
132
137
138 /** Set the period ID for this run
139 * \param[in] period_id : unique period id
140 */
141 void SetPeriodId(uint32_t period_id) { fPeriodId = period_id; }
142
143 /** Set the period ID for this run
144 * \param[in] run_id : unique run id
145 */
146 void SetRunId(uint32_t run_id) { fRunId = run_id; }
147 /** Set the event count */
148 void SetNEvents(uint64_t events) { fEventCnt = events; }
149
150 /** Set the period ID for this run
151 * \param[in] run_start_time : run start time
152 */
153 void SetRunStartTime(TTimeStamp run_start_time) { fRunStartTime = run_start_time; }
154 void SetRunStartTP(SysPoint run_start_time) { fRunStartTime = BmnFunctionSet::TimePoint2TS(run_start_time); }
155
156 /** Set the period ID for this run
157 * \param[in] run_end_time : run end time
158 */
159 void SetRunEndTime(TTimeStamp run_end_time) { fRunEndTime = run_end_time; }
160 void SetRunEndTP(SysPoint run_end_time) { fRunEndTime = BmnFunctionSet::TimePoint2TS(run_end_time); }
161
162 /** Set the Beam Trigger counter
163 * \param[in] cntr : Beam Trigger counter
164 */
165 void SetBT(uint64_t cntr) { fBeamTrigger = cntr; }
166 /** Set the BT and Busy counter
167 * \param[in] cntr : BT and Busy
168 */
169 void SetBTnBusy(uint64_t cntr) { fBTnBusy = cntr; }
170 /** Set the (BT and not Busy) by live time
171 * \param[in] cntr : BT Accepted
172 */
173 void SetBTAccepted(Double_t cntr) { fBTAccepted = cntr; }
174 /** Set the Accepted counter
175 * \param[in] cntr : Accepted counter
176 */
177 void SetAccepted(uint64_t cntr) { fAccepted = cntr; }
178 /** Set the Trigger Protection counter
179 * \param[in] cntr : Trigger Protection counter
180 */
181 void SetProtection(uint64_t cntr) { fProtection = cntr; }
182 /** Set the L0 counter
183 * \param[in] cntr : L0 counter
184 */
185 void SetL0(uint64_t cntr) { fL0 = cntr; }
186 /** Set the raw MSC counters
187 * \param[in] v : map < MSC serial, counters vector>
188 */
189 void SetRawMSC(unordered_map<uint32_t, vector<uint64_t>> v)
190 {
191 fBoardSums = v;
192 // printf("inner len %lu\n", fBoardSums.size());
193 }
194 void SetSpillMap(map<SysPoint, BmnSpillInfo> v)
195 {
196 fSpillMap = v;
197 // printf("inner len %lu\n", fSpillMap.size());
198 }
199
201
203};
204
205#endif /* BMNDIGIRUNHEADER_H */
__m128 v
Definition P4_F32vec4.h:1
double Double_t
#define ClassDef(name, id)
std::chrono::time_point< SysClock > SysPoint
std::unordered_map< std::string, std::pair< uint32_t, uint16_t > > Name2SerCh
Definition BmnAliases.h:9
std::unordered_map< std::string, uint64_t > MapString2Cnt
Definition BmnAliases.h:11
std::map< T0MapKey, uint16_t > T0ChMap
Definition BmnAliases.h:6
std::unordered_map< std::string, uint16_t > NameChMap
Definition BmnAliases.h:7
static SysPoint TimeStamp2TP(TTimeStamp p)
static TTimeStamp TimePoint2TS(SysPoint p)
Class BmnTrigConfig Trigger DAQ config.
MapString2Cnt event_trig_count
SysPoint GetRunEndTP()
vector< uint64_t > fScalersVec
void SetL0(uint64_t cntr)
Set the L0 counter.
void SetRunStartTime(TTimeStamp run_start_time)
Set the period ID for this run.
void SetTrigConfig(BmnTrigConfig tc)
NameChMap & GetTrcBitMap()
TRC bit map.
void SetBT(uint64_t cntr)
Set the Beam Trigger counter.
Name2SerCh & GetScalerMap()
MSC bit map.
uint64_t GetPeriodId()
Get the period ID for this run.
uint64_t GetScaler(string name)
uint64_t GetRunId()
Get the run ID.
void SetRunStartTP(SysPoint run_start_time)
unordered_map< uint32_t, vector< uint64_t > > fBoardSums
(MSC serial, raw sums of the counters)
uint64_t GetProtection()
Get the Trigger Protection.
uint64_t GetL0()
Get the L0.
SysPoint GetRunStartTP()
T0ChMap & T0Map()
Ref to the T0 map.
virtual ~DigiRunHeader()
Destructor.
void SetBTnBusy(uint64_t cntr)
Set the BT and Busy counter.
NameChMap scalers_name2index_map
name -> index in fScalersVec (scaler index)
void SetRunId(uint32_t run_id)
Set the period ID for this run.
void SetAccepted(uint64_t cntr)
Set the Accepted counter.
void SetRunEndTime(TTimeStamp run_end_time)
Set the period ID for this run.
TTimeStamp GetRunEndTime()
map< SysPoint, BmnSpillInfo > fSpillMap
void SetRunEndTP(SysPoint run_end_time)
vector< uint64_t > & ScalersVec()
std::array< uint64_t, kT0_BIN_BLOCK_WORDS > rawt0_cntrs
std::array< uint64_t, kT0_BIN_BLOCK_WORDS > & RawT0Counters()
Raw T0 counters (sum over all spills).
uint64_t fAccepted
void SetBTAccepted(Double_t cntr)
Set the (BT and not Busy) by live time.
TTimeStamp GetRunStartTime()
Double_t fBTAccepted
BT&notBusy normalized according to Acc/(Acc + BP + AP) | for SRC => sum [BT * (DAQ_Busy -peds)/ (DAQ_...
TTimeStamp fRunStartTime
uint32_t fRunId
Run Id.
BmnTrigConfig & GetTrigConfig()
Get DAQ trigger config.
uint32_t fPeriodId
Period Id.
Double_t GetBTAccepted()
Get the (BT and not Busy) by live time.
void SetRawMSC(unordered_map< uint32_t, vector< uint64_t > > v)
Set the raw MSC counters.
uint64_t fEventCnt
Event count.
NameChMap fTrcBitMap
TTimeStamp fRunEndTime
Name2SerCh fScalersMap
map< uint16_t, uint16_t > fTrcIdx2ScalerIdx
TRC index -> scaler index.
vector< string > & ScalersIndex2NameMap()
void SetSpillMap(map< SysPoint, BmnSpillInfo > v)
uint64_t fBTnBusy
void SetPeriodId(uint32_t period_id)
Set the period ID for this run.
unordered_map< uint32_t, vector< uint64_t > > & GetRawMSC()
Get the raw MSC counters.
BmnTrigConfig trig_config
map< SysPoint, BmnSpillInfo > & GetSpillMap()
void SetProtection(uint64_t cntr)
Set the Trigger Protection counter.
uint64_t GetBT()
Get the BeamTrigger counter.
uint64_t fBeamTrigger
uint64_t fProtection
uint64_t GetAccepted()
Get the Accepted by live time.
uint64_t GetNEvents()
Get the event count.
DigiRunHeader(uint32_t period_id=9, uint32_t run_id=0, TTimeStamp run_start_time=TTimeStamp(0, 0), TTimeStamp run_end_time=TTimeStamp(0, 0))
Constructor.
MapString2Cnt & EventTriggerCnt()
map< uint16_t, uint16_t > & TrcIndex2ScalerIndexMap()
NameChMap & ScalersName2IndexMap()
vector< string > scalers_index2name_map
index -> name
uint64_t GetRawT0Counter(string name, uint32_t ch=0)
uint64_t GetBTnBusy()
Get the BT and not Busy.
void SetNEvents(uint64_t events)
Set the event count.