CbmRoot
Loading...
Searching...
No Matches
AccDataSis18.h
Go to the documentation of this file.
1/* Copyright (C) 2022-2025 Facility for Antiproton and Ion Research in Europe, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Pierre-Alain Loizeau [committer] */
4
5#ifndef ACCDATASIS18_H
6#define ACCDATASIS18_H 1
7
8#include <Rtypes.h> // for THashConsistencyHolder, ClassDef
9
10#include <cstdint>
11#include <string>
12#include <vector>
13
15public:
16 AccTimingEvent() = default;
17
18 AccTimingEvent(uint64_t ulPlannedUTCIn, uint64_t ulPlannedTAIIn, uint64_t ulRawEventIn, uint64_t ulRawParamsIn,
19 uint32_t uRawTimingFlagsIn, uint64_t ulExecutedUTCIn, uint64_t ulExecutedTAIIn);
20
21 AccTimingEvent(std::string sLine, bool bVerbose = false);
22
23 virtual ~AccTimingEvent() = default;
24
25 void Print() const;
26
27 uint32_t GetGroupId() const { return ((fulRawEvent >> kOffsetGroupId) & ((1ULL << kNbBitsGroupId) - 1)); }
28 uint32_t GetEventId() const { return ((fulRawEvent >> kOffsetEventId) & ((1ULL << kNbBitsEventId) - 1)); }
29
30 uint64_t GetTime() const { return fulPlannedUTC; }
31
32 inline bool IsCycleStart() const { return (kEventIdStartCycle == GetEventId()); }
33 inline bool IsCycleEnd() const { return (kEventIdEndCycle == GetEventId()); }
34 inline bool IsExtractionStart() const { return (kEventIdExtrStartSlow == GetEventId()); }
35 inline bool IsExtractionEnd() const { return (kEventIdExtrEnd == GetEventId()); }
36 inline bool IsKickerStart() const { return (kEventIdExtrKickerStart == GetEventId()); }
37 inline bool IsExtractionStopSlow() const { return (kEventIdExtrStopSlow == GetEventId()); }
38
39 inline bool operator<(const AccTimingEvent& rhs) const { return fulPlannedUTC < rhs.fulPlannedUTC; }
40 inline bool operator<(const uint64_t& rhs) const { return fulPlannedUTC < rhs; }
41
43 friend bool operator<(const uint64_t& lhs, const AccTimingEvent& rhs) { return lhs < rhs.fulPlannedUTC; }
44
45private:
49 static const uint32_t kNbBitsFormatId = 4; // Content of field should always be 1!!
50 static const uint32_t kNbBitsGroupId = 12;
51 static const uint32_t kNbBitsEventId = 12;
52 static const uint32_t kNbBitsFlags = 4;
53 static const uint32_t kNbBitsSequenceId = 12;
54 static const uint32_t kNbBitsBeamProcId = 14;
55 static const uint32_t kNbBitsReserved = 6;
57 static const uint32_t kOffsetReserved = 0;
61 static const uint32_t kOffsetEventId = kOffsetFlags + kNbBitsFlags;
62 static const uint32_t kOffsetGroupId = kOffsetEventId + kNbBitsEventId;
76 static const uint32_t kEventIdStartCycle = 32;
77 static const uint32_t kEventIdExtrStartSlow = 46;
78 static const uint32_t kEventIdExtrKickerStart = 49;
79 static const uint32_t kEventIdExtrEnd = 51;
80 static const uint32_t kEventIdEndCycle = 55;
81 static const uint32_t kEventIdExtrStopSlow = 78;
82
84 uint64_t fulPlannedUTC = 0;
85 uint64_t fulPlannedTAI = 0;
86 uint64_t fulRawEvent = 0;
87 uint64_t fulRawParams = 0;
88 uint32_t fuRawTimingFlags = 0;
89 uint64_t fulExecutedUTC = 0;
90 uint64_t fulExecutedTAI = 0;
91
93};
94
95//--------------------------------------------------------------------------------------------------------------------//
96
98 public:
99 AccPatternEvent() = default;
100
101 AccPatternEvent(uint64_t ulPlannedUTCIn, uint64_t ulPlannedTAIIn, bool bHtdPatternOnIn, uint64_t ulExecutedUTCIn,
102 uint64_t ulExecutedTAIIn);
103
104 AccPatternEvent(std::string sLine, bool bVerbose = false);
105
106 virtual ~AccPatternEvent() = default;
107
108 void Print() const;
109
110 uint64_t GetTime() const { return fulPlannedUTC; }
111
112 inline bool IsHtdOn() const { return fbHtdPatternOn; }
113 inline bool IsMcbmOn() const { return IsHtdOn(); } // More obvious alias for non-expert users
114
115 inline bool operator<(const AccPatternEvent& rhs) const { return fulPlannedUTC < rhs.fulPlannedUTC; }
116 inline bool operator<(const uint64_t& rhs) const { return fulPlannedUTC < rhs; }
117
119 friend bool operator<(const uint64_t& lhs, const AccPatternEvent& rhs) { return lhs < rhs.fulPlannedUTC; }
120
121 private:
123
125 uint64_t fulPlannedUTC = 0;
126 uint64_t fulPlannedTAI = 0;
127 bool fbHtdPatternOn = false;
128 uint64_t fulExecutedUTC = 0;
129 uint64_t fulExecutedTAI = 0;
130
132};
133
134//--------------------------------------------------------------------------------------------------------------------//
135
137public:
138 AccStatusTs() = default;
139
140 AccStatusTs(uint32_t uSpillIdx, AccTimingEvent lastEvtBefTs)
141 : fuSpillIndexAtStart(uSpillIdx)
142 , fLastEvtBeforeTs(lastEvtBefTs)
143 {
144 }
145
146 virtual ~AccStatusTs() = default;
147
148 void SetLastEvtBefTs(AccTimingEvent lastEvtBefTs) { fLastEvtBeforeTs = lastEvtBefTs; }
149 void SetLastPatternBefTs(AccPatternEvent lastPatternBefTs) { fLastPatternBeforeTs = lastPatternBefTs; }
150
152 inline bool IsCycleOnAtStart() const { return !(fLastEvtBeforeTs.IsCycleEnd()); }
154 inline bool IsSpillOnAtStart() const { return fLastEvtBeforeTs.IsExtractionStart(); }
156 inline bool IsPatternOnAtStart() const { return fLastPatternBeforeTs.IsHtdOn(); }
157
158 bool IsSpillOnAtTime(uint64_t uTimeUtc) const;
159 uint32_t GetSpillIdxAtTime(uint64_t uTimeUtc) const;
160
161 bool IsPatternOnAtTime(uint64_t uTimeUtc) const;
162 bool IsMcbmSpillOnAtTime(uint64_t uTimeUtc) const
163 {
164 return (IsPatternOnAtTime(uTimeUtc) && IsSpillOnAtTime(uTimeUtc));
165 }
166
171 std::vector<AccTimingEvent> fvEventsDuringTS = {};
172 std::vector<AccPatternEvent> fvPatternsDuringTS = {};
173
175};
176//--------------------------------------------------------------------------------------------------------------------//
177
178#endif /* ACCDATASIS18_H */
uint64_t fulExecutedTAI
virtual ~AccPatternEvent()=default
bool IsMcbmOn() const
ClassDef(AccPatternEvent, 1)
bool IsHtdOn() const
uint64_t fulPlannedUTC
Constants.
bool operator<(const uint64_t &rhs) const
AccPatternEvent()=default
bool operator<(const AccPatternEvent &rhs) const
uint64_t fulExecutedUTC
friend bool operator<(const uint64_t &lhs, const AccPatternEvent &rhs)
Needed for finding time position within a vector of AccTimingEvent with lower_bound/upper_bound.
uint64_t GetTime() const
uint64_t fulPlannedTAI
void Print() const
std::vector< AccPatternEvent > fvPatternsDuringTS
bool IsMcbmSpillOnAtTime(uint64_t uTimeUtc) const
AccPatternEvent fLastPatternBeforeTs
bool IsSpillOnAtTime(uint64_t uTimeUtc) const
bool IsCycleOnAtStart() const
True when we start within a spill cycle (not in short interval between cycle end and cycle start))
AccTimingEvent fLastEvtBeforeTs
bool IsPatternOnAtTime(uint64_t uTimeUtc) const
std::vector< AccTimingEvent > fvEventsDuringTS
uint32_t GetSpillIdxAtTime(uint64_t uTimeUtc) const
void SetLastPatternBefTs(AccPatternEvent lastPatternBefTs)
bool IsPatternOnAtStart() const
True when we start with an HTD cave pattern enabled.
void SetLastEvtBefTs(AccTimingEvent lastEvtBefTs)
AccStatusTs(uint32_t uSpillIdx, AccTimingEvent lastEvtBefTs)
bool IsSpillOnAtStart() const
True when we start in the middle of an extraction spill.
AccStatusTs()=default
virtual ~AccStatusTs()=default
uint32_t fuSpillIndexAtStart
Members.
ClassDef(AccStatusTs, 1)
static const uint32_t kOffsetEventId
friend bool operator<(const uint64_t &lhs, const AccTimingEvent &rhs)
Needed for finding time position within a vector of AccTimingEvent with lower_bound/upper_bound.
bool IsExtractionEnd() const
uint64_t fulRawParams
static const uint32_t kNbBitsEventId
uint32_t GetGroupId() const
bool operator<(const uint64_t &rhs) const
static const uint32_t kOffsetBeamProcId
static const uint32_t kEventIdExtrStartSlow
static const uint32_t kEventIdExtrStopSlow
static const uint32_t kNbBitsGroupId
static const uint32_t kEventIdEndCycle
uint64_t GetTime() const
static const uint32_t kNbBitsFormatId
uint64_t fulPlannedTAI
static const uint32_t kNbBitsFlags
bool IsKickerStart() const
static const uint32_t kEventIdExtrKickerStart
static const uint32_t kOffsetReserved
----> Field offset
uint64_t fulExecutedUTC
ClassDef(AccTimingEvent, 1)
static const uint32_t kOffsetFormatId
static const uint32_t kOffsetSequenceId
static const uint32_t kOffsetGroupId
bool IsExtractionStart() const
static const uint32_t kNbBitsReserved
bool IsExtractionStopSlow() const
bool IsCycleEnd() const
bool IsCycleStart() const
static const uint32_t kEventIdExtrEnd
uint32_t GetEventId() const
uint64_t fulRawEvent
static const uint32_t kNbBitsSequenceId
static const uint32_t kEventIdStartCycle
uint64_t fulExecutedTAI
AccTimingEvent()=default
bool operator<(const AccTimingEvent &rhs) const
void Print() const
virtual ~AccTimingEvent()=default
static const uint32_t kNbBitsBeamProcId
uint32_t fuRawTimingFlags
uint64_t fulPlannedUTC
Fields.
static const uint32_t kOffsetFlags