CbmRoot
Loading...
Searching...
No Matches
CbmTofUnpackAlgo.h
Go to the documentation of this file.
1/* Copyright (C) 2021 Goethe-University Frankfurt, Frankfurt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Pierre-Alain Loizeau, Pascal Raisig [committer] */
4
20
21#ifndef CbmTofUnpackAlgo_H
22#define CbmTofUnpackAlgo_H
23
24#include "CbmErrorMessage.h"
25#include "CbmMcbm2018TofPar.h"
26#include "CbmRecoUnpackAlgo.tmpl"
27#include "CbmTofDigi.h"
28#include "CbmTofUnpackMonitor.h"
29#include "CriGet4Mess001.h"
30#include "Timeslice.hpp" // timeslice
31
32#include <Rtypes.h> // for types
33#include <RtypesCore.h>
34
35#include <cstddef>
36#include <cstdint>
37#include <memory>
38#include <utility>
39
40class CbmTofUnpackAlgo : public CbmRecoUnpackAlgo<CbmTofDigi, CbmErrorMessage> {
41 public:
44
46 virtual ~CbmTofUnpackAlgo();
47
50
53
63 virtual std::vector<std::pair<std::string, std::shared_ptr<FairParGenericSet>>>*
64 GetParContainerRequest(std::string geoTag, uint32_t runId);
65
71 void SetFlagEpochCountHack2021(bool bFlagin = true) { fbEpochCountHack2021 = bFlagin; }
72
78 void SetFlagBmonParMode(bool bFlagin = true) { fbBmonParMode = bFlagin; }
79
85 void SetParFileName(std::string sNewName) { fParFileName = sNewName; }
86
88 void SetMonitor(std::shared_ptr<CbmTofUnpackMonitor> monitor) { fMonitor = monitor; }
89
95 std::vector<CbmTofDigi>& GetOutputVec() { return fOutputVec; }
96
97 public:
99
101 void finish()
102 {
104 // Finish the monitor if we have one
105 if (fMonitor) {
106 std::cout << "Finish Monitor" << std::endl;
107 fMonitor->Finish();
108 }
109 }
110
112 void finishDerived();
113
119 Bool_t init();
120
127 Bool_t initParSet(FairParGenericSet* parset);
128
136
146 bool setDerivedTsParameters(size_t /*itimeslice*/) { return true; }
147
159 bool unpack(const fles::Timeslice* ts, uint16_t icomp, UInt_t imslice);
160
161 private:
164
166 void ExtractTsStartEpoch(const uint64_t& ulTsStart);
167 void ProcessEpoch(const critof001::Message& mess, uint32_t uMesgIdx);
169 void ProcessHit(const critof001::Message& mess);
170
171 inline Int_t GetArrayIndex(Int_t gdpbId, Int_t get4Id) { return gdpbId * fuNrOfGet4PerGdpb + get4Id; }
172
173
175 std::string fParFileName = "mTofCriPar.par";
177
179 UInt_t fuNrOfGdpbs = 0;
180 std::map<UInt_t, UInt_t> fGdpbIdIndexMap = {};
181 UInt_t fuNrOfFeePerGdpb = 0;
182 UInt_t fuNrOfGet4PerFee = 0;
185 UInt_t fuNrOfGet4 = 0;
186 UInt_t fuNrOfGet4PerGdpb = 0;
188
190 UInt_t fuNrOfGbtx = 0;
191 UInt_t fuNrOfModules = 0;
192 std::vector<Int_t> fviRpcChUId = {};
193
195 UInt_t fuMapWarnToPrint = 100;
196 ULong64_t fulCurrentTsIdx = 0;
197 ULong64_t fulCurrentMsIdx = 0;
198 double fdCurrentMsTime = 0.0;
199 size_t fuCurrentMsSysId = 0;
201 UInt_t fuCurrDpbId = 0;
202 UInt_t fuCurrDpbIdx = 0;
203 UInt_t fuGet4Id =
204 0;
205 UInt_t fuGet4Nr = 0;
207 ULong64_t fulCurrentEpoch = 0;
208
211 bool fbBmonParMode = false;
212 std::vector<bool> fvbMaskedComponents = {};
213 bool fbLastEpochGood = false;
214 uint64_t fulBadEpochNb = 0;
215 uint64_t fulBadEpochHitNb = 0;
216
219 uint64_t fulTsStartInEpoch = 0;
220 uint64_t fulEpochIndexInTs = 0;
221
223 std::shared_ptr<CbmTofUnpackMonitor> fMonitor = nullptr;
224
225 ClassDef(CbmTofUnpackAlgo, 2)
226};
227
228#endif // CbmTofUnpackAlgo_H
int Int_t
bool Bool_t
CbmMcbm2018TofPar * fUnpackPar
size_t fuCurrentMsSysId
Time of the current MS in s.
ULong64_t fulCurrentEpoch
Data format control: Current time references for each GDPB: merged epoch marker, epoch cycle,...
UInt_t fuCurrDpbIdx
Temp holder until Current equipment ID is properly filled in MS.
UInt_t fuNrOfGdpbs
For static/inline mapping functions.
UInt_t fuCurrDpbId
Current equipment ID, tells from which DPB the current MS is originating.
void ExtractTsStartEpoch(const uint64_t &ulTsStart)
Message processing methods.
bool fbEpochCountHack2021
Current epoch index.
void SetMonitor(std::shared_ptr< CbmTofUnpackMonitor > monitor)
Set a predefined monitor.
UInt_t fuNrOfChannelsPerFee
Number of channels in each GET4.
void SetFlagEpochCountHack2021(bool bFlagin=true)
Sets the flag enabling the epoch offset hack for the July 2021 data. Default is enable.
Bool_t initParSet(FairParGenericSet *parset)
Handles the distribution of the hidden derived classes to their explicit functions.
void ProcessEpSupprBuffer()
Buffers processing.
UInt_t fuGet4Nr
running number (0 to fuNrOfGet4PerGdpb) of the Get4 chip of a unique GDPB for current message
void ProcessEpoch(const critof001::Message &mess, uint32_t uMesgIdx)
UInt_t fuNrOfChannelsPerGet4
Number of GET4s per FEE.
bool unpack(const fles::Timeslice *ts, uint16_t icomp, UInt_t imslice)
Unpack a given microslice. To be implemented in the derived unpacker algos.
virtual ~CbmTofUnpackAlgo()
Destroy the Cbm Trd Unpack Task object.
ULong64_t fulCurrentMsIdx
Idx of the current TS.
std::vector< CbmTofDigi > & GetOutputVec()
Get a reference to the output vector. Used by BMON encapsulating algo to access output.
void SetParFileName(std::string sNewName)
Sets the name of the parameter file to be used.
CbmTofUnpackAlgo & operator=(const CbmTofUnpackAlgo &)=delete
Assignment operator - not implemented.
CbmTofUnpackAlgo()
Create the Cbm Trd Unpack AlgoBase object.
UInt_t fuNrOfGet4PerFee
Number of FEBs per GDPB.
UInt_t fuMapWarnToPrint
Running indices.
virtual std::vector< std::pair< std::string, std::shared_ptr< FairParGenericSet > > > * GetParContainerRequest(std::string geoTag, uint32_t runId)
Get the requested parameter containers. To be defined in the derived classes! Return the required par...
void finishDerived()
Function that allows special calls during Finish in the derived algos.
void ProcessHit(const critof001::Message &mess)
std::vector< bool > fvbMaskedComponents
void SetFlagBmonParMode(bool bFlagin=true)
Sets the flag switching to a request of CbmMcbm2018BmonPar. Default is enable.
std::string fParFileName
Settings from parameter file.
CbmTofUnpackAlgo(const CbmTofUnpackAlgo &)=delete
Copy constructor - not implemented.
UInt_t fuCurrentEquipmentId
SysId of the current MS in TS (0 to fuTotalMsNb)
UInt_t fuNrOfGet4
Number of channels in each FEE.
double fdCurrentMsTime
Idx of the current MS in TS (0 to fuTotalMsNb)
uint32_t fuProcEpochUntilError
Book-keeping members.
bool setDerivedTsParameters(size_t)
Set the Derived Ts Parameters.
std::vector< Int_t > fviRpcChUId
std::map< UInt_t, UInt_t > fGdpbIdIndexMap
Total number of GDPBs in the system.
void finish()
Raise permissions for access to these protected methods to allow access in encapsulating BMON algo.
UInt_t fuNrOfGet4PerGdpb
Total number of Get4 chips in the system.
UInt_t fuNrOfFeePerGdpb
gDPB ID to index map
UInt_t fuGet4Id
Index of the DPB from which the MS currently unpacked is coming.
std::shared_ptr< CbmTofUnpackMonitor > fMonitor
Potential (online) monitor for the unpacking process.
void ProcessEndOfMsEpoch()
UInt_t fuNrOfChannelsPerGdpb
Number of GET4s per GDPB.
Bool_t init()
Initialisation at begin of run. Special inits of the derived algos.
Int_t GetArrayIndex(Int_t gdpbId, Int_t get4Id)
UInt_t fuNrOfGbtx
Number of channels per GDPB.