18#include "FairParGenericSet.h"
19#include "FairRootManager.h"
21#include "FairRunOnline.h"
22#include "FairRuntimeDb.h"
33 , fvbMaskedComponents()
34 , fvMsComponentsList()
38 , fbIgnoreOverlapMs(kFALSE)
40 , fdTsCoreSizeInNs(-1.0)
44 , fdTsStopTimeCore(0.0)
47 , fuCurrentEquipmentId(0)
58 LOG(info) <<
"CbmMcbm2018RawConverterSdpb::Init";
59 LOG(info) <<
"Initializing mCBM sDPB 2018 Raw Messages Converter";
66 LOG(info) <<
"Setting parameter containers for " << GetName();
72 for (Int_t iparC = 0; iparC <
fParCList->GetEntries(); ++iparC) {
73 FairParGenericSet* tempObj = (FairParGenericSet*) (
fParCList->At(iparC));
76 std::string sParamName {tempObj->GetName()};
77 FairParGenericSet* newObj =
78 dynamic_cast<FairParGenericSet*
>(FairRun::Instance()->GetRuntimeDb()->getContainer(sParamName.data()));
80 if (
nullptr == newObj) {
81 LOG(error) <<
"Failed to obtain parameter container " << sParamName <<
", for parameter index " << iparC;
92 LOG(info) <<
"Init parameter containers for " << GetName();
97 LOG(error) <<
"Failed to obtain parameter container CbmMcbm2018StsPar";
102 LOG(info) <<
"Nr. of STS DPBs: " <<
fuNrOfDpbs;
105 for (UInt_t uDpb = 0; uDpb <
fuNrOfDpbs; ++uDpb) {
107 LOG(info) <<
"Eq. ID for DPB #" << std::setw(2) << uDpb <<
" = 0x" << std::setw(4) << std::hex
112 FairRootManager* ioman = FairRootManager::Instance();
113 if (NULL == ioman) { LOG(fatal) <<
"No FairRootManager instance"; }
116 for (UInt_t uDpb = 0; uDpb <
fuNrOfDpbs; ++uDpb) {
119 LOG(fatal) <<
"Failed creating the sDPB messages vector ";
121 ioman->RegisterAny(Form(
"CbmSdpbMsg%03u", uDpb),
fvSdpbMessages[uDpb], kTRUE);
129 LOG(info) <<
"ReInit parameter containers for " << GetName();
143 LOG(info) <<
"CbmMcbm2018RawConverterSdpb::AddMsComponentToList => Component " << component <<
" with detector ID 0x"
144 << std::hex << usDetectorId << std::dec <<
" added to list";
150 fdTsStartTime =
static_cast<Double_t
>(ts.descriptor(0, 0).idx);
162 <<
" Overlap MS, for a core duration of " <<
fdTsCoreSizeInNs <<
" ns and a full duration of "
168 LOG(info) <<
"In each TS " <<
fuNbMsLoop <<
" MS will be looped over";
180 auto msDescriptor = ts.descriptor(uMsComp,
fuMsIndex);
182 const uint8_t* msContent =
reinterpret_cast<const uint8_t*
>(ts.content(uMsComp,
fuMsIndex));
184 uint32_t uSize = msDescriptor.size;
188 <<
" has size: " << uSize;
198 LOG(info) <<
"-------------------------------------------------------"
210 LOG(warning) <<
"Could not find the sDPB index for AFCK id 0x" << std::hex <<
fuCurrDpbId << std::dec
212 << uMsCompIdx <<
"\n"
213 <<
"If valid this index has to be added in the STS "
214 "parameter file in the DbpIdArray field";
231 LOG(error) <<
"The input microslice buffer does NOT "
232 <<
"contain only complete sDPB messages!";
238 const uint32_t* pInBuff =
reinterpret_cast<const uint32_t*
>(msContent);
239 for (uint32_t uIdx = 0; uIdx < uNbMessages; uIdx++) {
241 uint32_t ulData =
static_cast<uint32_t
>(pInBuff[uIdx]);
258 for (UInt_t uDpb = 0; uDpb <
fuNrOfDpbs; ++uDpb)
ClassImp(CbmConverterManager)
void AddMsComponentToList(size_t component, UShort_t usDetectorId)
Temp until we change from CbmMcbmUnpack to something else.
UInt_t fuCurrDpbId
Current equipment ID, tells from which DPB the current MS is originating.
ULong64_t fulCurrentTsIdx
Total size of the core MS in a TS, [nanoseconds].
std::map< UInt_t, UInt_t > fDpbIdIndexMap
Total number of sDPBs to convert.
ULong64_t fulCurrentMsIdx
UInt_t fuCurrentEquipmentId
virtual ~CbmMcbm2018RawConverterSdpb()
Double_t fdTsStopTimeCore
Time in ns of current TS from the index of the first MS first component.
std::vector< size_t > fvMsComponentsList
Parameters related to FLES containers.
Double_t fdMsSizeInNs
/** Ignore Overlap Ms: all fuNbOverMsPerTs MS at the end of timeslice **/
std::vector< Bool_t > fvbMaskedComponents
Control flags.
TList * fParCList
Settings from parameter file.
std::vector< std::vector< stsxyter::Message > * > fvSdpbMessages
Index of the DPB from which the MS currently unpacked is coming.
Bool_t ReInitContainers()
CbmMcbm2018RawConverterSdpb(UInt_t uNbSdpb=1)
Double_t fdTsFullSizeInNs
Total size of the core MS in a TS, [nanoseconds].
Double_t fdTsCoreSizeInNs
Size of a single MS, [nanoseconds].
static const UInt_t kuBytesPerMessage
CbmMcbm2018StsPar * fUnpackPar
UInt_t fuMsIndex
Start Time in ns of current MS from its index field in header.
UInt_t fuCurrDpbIdx
Temp holder until Current equipment ID is properly filled in MS.
virtual Bool_t DoUnpack(const fles::Timeslice &ts, size_t component)
UInt_t GetDpbId(UInt_t uDpbIdx)