CbmRoot
Loading...
Searching...
No Matches
CbmTofStarData2019.h
Go to the documentation of this file.
1/* Copyright (C) 2017-2019 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// -----------------------------------------------------------------------------
6// ----- -----
7// ----- CbmTofStarData2019 -----
8// ----- Created 13.01.2017 by P.-A. Loizeau -----
9// ----- -----
10// -----------------------------------------------------------------------------
11
12#ifndef CbmTofStarData2019_H
13#define CbmTofStarData2019_H
14
15#include "Rtypes.h"
16
17#include <vector>
18
19#include "gDpbMessv100.h"
20
22public:
23 // Constructors
24 CbmTofStarTrigger2019(ULong64_t ulGdpbTsFullIn, ULong64_t ulStarTsFullIn, UInt_t uStarTokenIn, UInt_t uStarDaqCmdIn,
25 UInt_t uStarTrigCmdIn, UShort_t usGdpbId = 0);
26
27 // Destructor
29
30 // Setters
31 inline void SetFullGdpbTs(ULong64_t ulGdpbTsFullIn) { fulGdpbTsFull = ulGdpbTsFullIn; }
32 inline void SetFullStarTs(ULong64_t ulStarTsFullIn) { fulStarTsFull = ulStarTsFullIn; }
33 inline void SetStarToken(UInt_t uStarTokenIn) { fuStarToken = uStarTokenIn; }
34 inline void SetStarDaqCmd(UInt_t uStarDaqCmdIn) { fusStarDaqCmd = uStarDaqCmdIn; }
35 inline void SetStarTRigCmd(UInt_t uStarTrigCmdIn) { fusStarTrigCmd = uStarTrigCmdIn; }
36
37 // Accessors
38 inline ULong64_t GetFullGdpbTs() const { return fulGdpbTsFull; }
39 inline ULong64_t GetFullStarTs() const { return fulStarTsFull; }
40 inline UInt_t GetStarToken() const { return fuStarToken; }
41 inline UShort_t GetStarDaqCmd() const { return fusStarDaqCmd; }
42 inline UShort_t GetStarTrigCmd() const { return fusStarTrigCmd; }
43 UInt_t GetStarTrigerWord() const;
44 UInt_t GetFullGdpbEpoch() const;
45 std::vector<gdpbv100::FullMessage> GetGdpbMessages() const;
46
47 // Operators
48 bool operator<(const CbmTofStarTrigger2019& other) const;
49
50private:
51 UShort_t fusGdpbId;
52 ULong64_t fulGdpbTsFull;
53 ULong64_t fulStarTsFull;
55 UShort_t fusStarDaqCmd;
57
58 // CbmTofStarTrigger2019(const CbmTofStarTrigger2019&);
59 // CbmTofStarTrigger2019 operator=(const CbmTofStarTrigger2019&);
60
61 // ClassDef(CbmTofStarTrigger2019, 1)
62};
63
65 // Methods implementation can be found at the end of CbmTsMonitorTofStar.cxx!
66public:
67 // Constructors
69 CbmTofStarSubevent2019(CbmTofStarTrigger2019 triggerIn, UShort_t sourceIdIn);
72
73 // Destructor
75
76 // Setters
77 inline void SetTrigger(CbmTofStarTrigger2019 triggerIn)
78 {
79 fTrigger = triggerIn;
80 fbTriggerSet = kTRUE;
81 }
82 inline void SetSource(UShort_t sourceIdIn)
83 {
84 fusSourceId = sourceIdIn;
86 | ((sourceIdIn & kulSourceIdMask) << kulSourceIdOffset);
87 }
88 inline void SetBadEventFlag(Bool_t bFlagState = kTRUE)
89 {
91 }
92 inline void SetOverlapEventFlag(Bool_t bFlagState = kTRUE)
93 {
95 }
96 inline void SetEmptyEventFlag(Bool_t bFlagState = kTRUE)
97 {
99 }
100 inline void SetStartBorderEventFlag(Bool_t bFlagState = kTRUE)
101 {
103 }
104 inline void SetEndBorderEventFlag(Bool_t bFlagState = kTRUE)
105 {
107 }
108 inline void SetIncompleteEventFlag(Bool_t bFlagState = kTRUE)
109 {
111 }
112 inline void AddMsg(const gdpbv100::FullMessage& msgIn)
113 {
114 fvMsgBuffer.push_back(msgIn);
115 fuEventSizeBytes += 2 * sizeof(ULong64_t);
116 }
117
118 // Accessors
119 inline CbmTofStarTrigger2019 GetTrigger() const { return fTrigger; }
120 inline UShort_t GetSource() const { return fusSourceId; }
121 inline Bool_t GetBadEventFlag() const { return 0 < (fulEventStatusFlags & kulFlagBadEvt); }
122 inline Bool_t GetOverlapEventFlag() const { return 0 < (fulEventStatusFlags & kulFlagOverlapEvt); }
123 inline Bool_t GetEmptyEventFlag() const { return 0 < (fulEventStatusFlags & kulFlagEmptyEvt); }
124 inline Bool_t GetStartBorderEventFlag() const { return 0 < (fulEventStatusFlags & kulFlagStartBorderEvt); }
125 inline Bool_t GetEndBorderEventFlag() const { return 0 < (fulEventStatusFlags & kulFlagEndBorderEvt); }
126 inline Bool_t GetIncompleteEventFlag() const { return 0 < (fulEventStatusFlags & kulFlagIncompleteEvt); }
127 inline Int_t GetEventSize() const { return fuEventSizeBytes; }
128 inline gdpbv100::Message GetMsg(UInt_t uMsgIdx) const;
129 inline UInt_t GetMsgBuffSize() const { return fvMsgBuffer.size(); }
130 inline static uint32_t GetMaxOutputSize() { return kuMaxOutputSize; }
131 inline Double_t GetEventTimeSec() const { return (1e-9) * gdpbv100::kdClockCycleSizeNs * fTrigger.GetFullGdpbTs(); }
132
133 // Content clearing
134 void ClearSubEvent();
135
136 // Sort content of output buffer
137 void SortMessages();
138
139 // Sub-event output
140 void* BuildOutput(Int_t& iOutputSizeBytes);
141
142 // Sub-event input
143 Bool_t LoadInput(void* pBuff, Int_t iInputSizeBytes);
144
145 // Print the heade and the messages in the buffer
146 void PrintSubEvent();
147
148private:
149 static const uint32_t kuMaxOutputSize = 131072; // 2^17
150 static const uint32_t kuMaxNbMsgs = 8190; // 4 * 64b in header => floor( (2^17 / 8 ) - 4) / 2
151 static const uint64_t kulFlagBadEvt = 0x1 << 0;
152 static const uint64_t kulFlagOverlapEvt = 0x1 << 1;
153 static const uint64_t kulFlagEmptyEvt = 0x1 << 2;
154 static const uint64_t kulFlagStartBorderEvt = 0x1 << 3;
155 static const uint64_t kulFlagEndBorderEvt = 0x1 << 4;
156 static const uint64_t kulFlagIncompleteEvt = 0x1
157 << 5;
158 static const uint64_t kulSourceIdOffset = 16;
159 static const uint64_t kulSourceIdMask = 0xFFFF;
160 static const uint64_t kulEventSizeOffset = 32;
161 static const uint64_t kulEventSizeMask = 0xFFFFFFFF;
162
165 UShort_t fusSourceId;
168 std::vector<gdpbv100::FullMessage> fvMsgBuffer;
170
171
172 // ClassDef(CbmTofStarSubevent2019, 1)
173};
174
175#endif
void SetEmptyEventFlag(Bool_t bFlagState=kTRUE)
void SetTrigger(CbmTofStarTrigger2019 triggerIn)
static const uint64_t kulFlagEndBorderEvt
Event containing data from previous overlap MS.
void SetBadEventFlag(Bool_t bFlagState=kTRUE)
void SetEndBorderEventFlag(Bool_t bFlagState=kTRUE)
Bool_t GetIncompleteEventFlag() const
Bool_t GetEndBorderEventFlag() const
static const uint32_t kuMaxOutputSize
static const uint64_t kulEventSizeMask
static const uint64_t kulSourceIdMask
void * BuildOutput(Int_t &iOutputSizeBytes)
Bool_t GetStartBorderEventFlag() const
void SetSource(UShort_t sourceIdIn)
static const uint64_t kulFlagStartBorderEvt
Empty event.
static const uint64_t kulSourceIdOffset
Incomplete event: at least one gDPB missed the trigger signal.
std::vector< gdpbv100::FullMessage > fvMsgBuffer
static const uint64_t kulFlagOverlapEvt
General flag for bad event.
Bool_t LoadInput(void *pBuff, Int_t iInputSizeBytes)
CbmTofStarTrigger2019 GetTrigger() const
void SetIncompleteEventFlag(Bool_t bFlagState=kTRUE)
void AddMsg(const gdpbv100::FullMessage &msgIn)
static const uint64_t kulFlagIncompleteEvt
Event containing data from following overlap MS.
static const uint64_t kulFlagEmptyEvt
Event in overlap with the previous event.
static const uint32_t kuMaxNbMsgs
void SetStartBorderEventFlag(Bool_t bFlagState=kTRUE)
gdpbv100::Message GetMsg(UInt_t uMsgIdx) const
Double_t GetEventTimeSec() const
static uint32_t GetMaxOutputSize()
void SetOverlapEventFlag(Bool_t bFlagState=kTRUE)
static const uint64_t kulEventSizeOffset
ULong64_t fpulBuff[kuMaxOutputSize]
CbmTofStarTrigger2019 fTrigger
Bool_t GetOverlapEventFlag() const
CbmTofStarSubevent2019 operator=(const CbmTofStarSubevent2019 &)
static const uint64_t kulFlagBadEvt
ULong64_t GetFullGdpbTs() const
std::vector< gdpbv100::FullMessage > GetGdpbMessages() const
UShort_t GetStarTrigCmd() const
CbmTofStarTrigger2019(ULong64_t ulGdpbTsFullIn, ULong64_t ulStarTsFullIn, UInt_t uStarTokenIn, UInt_t uStarDaqCmdIn, UInt_t uStarTrigCmdIn, UShort_t usGdpbId=0)
ULong64_t GetFullStarTs() const
void SetFullStarTs(ULong64_t ulStarTsFullIn)
void SetStarDaqCmd(UInt_t uStarDaqCmdIn)
void SetStarTRigCmd(UInt_t uStarTrigCmdIn)
void SetStarToken(UInt_t uStarTokenIn)
UShort_t GetStarDaqCmd() const
bool operator<(const CbmTofStarTrigger2019 &other) const
strict weak ordering operator, assumes same TS cycle for both triggers
void SetFullGdpbTs(ULong64_t ulGdpbTsFullIn)
const double kdClockCycleSizeNs