CbmRoot
Loading...
Searching...
No Matches
AccDataSis18.h
Go to the documentation of this file.
1/* Copyright (C) 2022 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#include <Rtypes.h> // for THashConsistencyHolder, ClassDef
6
7#include <cstdint>
8#include <string>
9#include <vector>
10
12public:
13 AccTimingEvent() = default;
14
15 AccTimingEvent(uint64_t ulPlannedUTCIn, uint64_t ulPlannedTAIIn, uint64_t ulRawEventIn, uint64_t ulRawParamsIn,
16 uint32_t uRawTimingFlagsIn, uint64_t ulExecutedUTCIn, uint64_t ulExecutedTAIIn);
17
18 AccTimingEvent(std::string sLine, bool bVerbose = false);
19
20 virtual ~AccTimingEvent() = default;
21
22 void Print() const;
23
24 uint32_t GetGroupId() const { return ((fulRawEvent >> kOffsetGroupId) & ((1ULL << kNbBitsGroupId) - 1)); }
25 uint32_t GetEventId() const { return ((fulRawEvent >> kOffsetEventId) & ((1ULL << kNbBitsEventId) - 1)); }
26
27 uint64_t GetTime() const { return fulPlannedUTC; }
28
29 inline bool IsCycleStart() const { return (kEventIdStartCycle == GetEventId()); }
30 inline bool IsCycleEnd() const { return (kEventIdEndCycle == GetEventId()); }
31 inline bool IsExtractionStart() const { return (kEventIdExtrStartSlow == GetEventId()); }
32 inline bool IsExtractionEnd() const { return (kEventIdExtrEnd == GetEventId()); }
33
34 inline bool operator<(const AccTimingEvent& rhs) { return fulPlannedUTC < rhs.fulPlannedUTC; }
35 inline bool operator<(const uint64_t& rhs) { return fulPlannedUTC < rhs; }
36
38 friend bool operator<(const uint64_t& lhs, const AccTimingEvent& rhs) { return lhs < rhs.fulPlannedUTC; }
39
40private:
44 static const uint32_t kNbBitsFormatId = 4; // Content of field should always be 1!!
45 static const uint32_t kNbBitsGroupId = 12;
46 static const uint32_t kNbBitsEventId = 12;
47 static const uint32_t kNbBitsFlags = 4;
48 static const uint32_t kNbBitsSequenceId = 12;
49 static const uint32_t kNbBitsBeamProcId = 14;
50 static const uint32_t kNbBitsReserved = 6;
52 static const uint32_t kOffsetReserved = 0;
56 static const uint32_t kOffsetEventId = kOffsetFlags + kNbBitsFlags;
57 static const uint32_t kOffsetGroupId = kOffsetEventId + kNbBitsEventId;
70 static const uint32_t kEventIdStartCycle = 32;
71 static const uint32_t kEventIdExtrStartSlow = 46;
72 static const uint32_t kEventIdExtrEnd = 51;
73 static const uint32_t kEventIdEndCycle = 55;
74 static const uint32_t kEventIdExtrStopSlow = 78;
75
77 uint64_t fulPlannedUTC = 0;
78 uint64_t fulPlannedTAI = 0;
79 uint64_t fulRawEvent = 0;
80 uint64_t fulRawParams = 0;
81 uint32_t fuRawTimingFlags = 0;
82 uint64_t fulExecutedUTC = 0;
83 uint64_t fulExecutedTAI = 0;
84
86};
87
88//--------------------------------------------------------------------------------------------------------------------//
89
91public:
92 AccStatusTs() = default;
93
94 AccStatusTs(uint32_t uSpillIdx, AccTimingEvent lastEvtBefTs)
95 : fuSpillIndexAtStart(uSpillIdx)
96 , fLastEvtBeforeTs(lastEvtBefTs)
97 {
98 }
99
100 virtual ~AccStatusTs() = default;
101
102 void SetLastEvtBefTs(AccTimingEvent lastEvtBefTs) { fLastEvtBeforeTs = lastEvtBefTs; }
103
105 inline bool IsCycleOnAtStart() const { return !(fLastEvtBeforeTs.IsCycleEnd()); }
107 inline bool IsSpillOnAtStart() const { return fLastEvtBeforeTs.IsExtractionStart(); }
108
109 bool IsSpillOnAtTime(uint64_t uTimeUtc);
110 uint32_t GetSpillIdxAtTime(uint64_t uTimeUtc);
111
115 std::vector<AccTimingEvent> fvEventsDuringTS = {};
116
118};
119//--------------------------------------------------------------------------------------------------------------------//
bool IsSpillOnAtTime(uint64_t uTimeUtc)
bool IsCycleOnAtStart() const
True when we start within a spill cycle (not in short interval between cycle end and cycle start))
AccTimingEvent fLastEvtBeforeTs
std::vector< AccTimingEvent > fvEventsDuringTS
void SetLastEvtBefTs(AccTimingEvent lastEvtBefTs)
uint32_t GetSpillIdxAtTime(uint64_t uTimeUtc)
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
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
static const uint32_t kOffsetReserved
----> Field offset
uint64_t fulExecutedUTC
ClassDef(AccTimingEvent, 1)
static const uint32_t kOffsetFormatId
bool operator<(const AccTimingEvent &rhs)
static const uint32_t kOffsetSequenceId
static const uint32_t kOffsetGroupId
bool IsExtractionStart() const
static const uint32_t kNbBitsReserved
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
void Print() const
virtual ~AccTimingEvent()=default
static const uint32_t kNbBitsBeamProcId
uint32_t fuRawTimingFlags
uint64_t fulPlannedUTC
Fields.
static const uint32_t kOffsetFlags
bool operator<(const uint64_t &rhs)