CbmRoot
Loading...
Searching...
No Matches
CbmDeviceUnpackTofCri.h
Go to the documentation of this file.
1/* Copyright (C) 2018-2020 PI-UHd, GSI
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Florian Uhlig, Norbert Herrmann [committer] */
4
12// TODO: (VF, 190914) Many unused private members were commented out.
13// The class has to be revised.
14
15#ifndef CBMDEVICEUNPACKTOFCri_H_
16#define CBMDEVICEUNPACKTOFCri_H_
17
18#include "CbmMcbm2018TofPar.h"
19
20#include "MicrosliceDescriptor.hpp"
21#include "Timeslice.hpp"
22
23#include "FairMQDevice.h"
24
25#include "Rtypes.h"
26#include "TMessage.h"
27
28#include <map>
29#include <vector>
30
31#include "gDpbMessv100.h"
32
35class CbmTbDaqBuffer;
36class CbmHistManager;
37class CbmTofDigi;
38class TH1;
39class TH2;
40
41class CbmDeviceUnpackTofCri : public FairMQDevice {
42public:
44 virtual ~CbmDeviceUnpackTofCri();
45
46protected:
47 virtual void InitTask();
48 bool HandleData(FairMQMessagePtr&, int);
49 bool HandleParts(FairMQParts&, int);
50 bool HandleMessage(FairMQMessagePtr&, int);
51 virtual void BuildTint(uint64_t ulTsStartTime, int iMode = 0);
52 virtual bool SendDigis(std::vector<CbmTofDigi*>, int);
53
54private:
55 uint64_t fNumMessages;
57 uint64_t fNumTint;
58 std::vector<uint64_t> fEventHeader;
59 uint64_t fiReqMode;
60 uint64_t fiReqTint;
61 uint64_t fiReqBeam;
62 std::vector<Int_t> fiReqDigiAddr;
64 uint64_t fiPulMulMin;
65 uint64_t fiPulTotMin;
66 uint64_t fiPulTotMax;
67
68 std::vector<std::string> fAllowedChannels = {"tofcomponent", "parameters", "tofdigis", "syscmd"};
69 std::vector<std::vector<std::string>> fChannelsToSend = {{}, {}, {}};
70
71 size_t fuTotalMsNb;
73 size_t fuCoreMs;
74 Double_t fdMsSizeInNs;
77 UInt_t fuNrOfGdpbs; // Total number of GDPBs in the system
78 UInt_t fuNrOfFeePerGdpb; // Number of FEEs per GDPB
79 UInt_t fuNrOfGet4PerFee; // Number of GET4s per FEE
80 UInt_t fuNrOfChannelsPerGet4; // Number of channels in each GET4
81
82 UInt_t fuNrOfChannelsPerFee; // Number of channels in each FEET
83 UInt_t fuNrOfGet4; // Total number of Get4 chips in the system
84 UInt_t fuNrOfGet4PerGdpb; // Number of GET4s per GDPB
85 UInt_t fuNrOfChannelsPerGdpb; // Number of channels per GDPB
86
87 const UInt_t kuNbFeePerGbtx = 5;
88 const UInt_t kuNbGbtxPerGdpb = 6;
89
90 UInt_t fuGdpbId; // Id (hex number) of the GDPB for current message
91 UInt_t fuGdpbNr; // running number (0 to fNrOfGdpbs) of the GDPB for current message
92 UInt_t fuGet4Id; // running number (0 to fNrOfGet4PerGdpb) of the Get4 chip of a unique GDPB for current message
93 UInt_t fuGet4Nr; // running number (0 to fNrOfGet4) of the Get4 chip in the system for current message
94
95 std::vector<int> fMsgCounter;
96 std::map<UInt_t, UInt_t> fGdpbIdIndexMap;
97
98 // CbmHistManager* fHM; ///< Histogram manager
99
106 std::vector<ULong64_t> fvulCurrentEpoch;
107 std::vector<Bool_t> fvbFirstEpochSeen;
108
112 //Double_t fdMsIndex;
113 Double_t fdToffTof;
114 UInt_t fiAddrRef;
115
116 //UInt_t fuDiamondDpbIdx;
117 //Bool_t fbEpochSuppModeOn;
118 //Bool_t fbGet4M24b;
119 //Bool_t fbGet4v20;
120 //Bool_t fbMergedEpochsOn;
121
123
124 // Variables used for histo filling
127 //Double_t fdEvTime0;
134 std::vector<TH2*> fhRawTotCh;
135 std::vector<TH1*> fhChCount;
136 std::vector<Bool_t> fvbChanThere;
137 std::vector<TH2*> fhChanCoinc;
138 //Bool_t fbDetChanThere[64]; // FIXME
140
141 inline Int_t GetArrayIndex(Int_t gdpbId, Int_t get4Id) { return gdpbId * fuNrOfGet4PerGdpb + get4Id; }
142
144 std::vector<UInt_t> fvuPadiToGet4;
145 std::vector<UInt_t> fvuGet4ToPadi;
146
148 static const UInt_t kuNbGet4PerGbtx = 5 * 8;
149 std::vector<UInt_t> fvuElinkToGet4;
150 std::vector<UInt_t> fvuGet4ToElink;
151 inline UInt_t ConvertElinkToGet4(UInt_t uElinkIdx)
152 {
153 return fvuElinkToGet4[uElinkIdx % kuNbGet4PerGbtx] + kuNbGet4PerGbtx * (uElinkIdx / kuNbGet4PerGbtx);
154 }
155 inline UInt_t ConvertGet4ToElink(UInt_t uGet4Idx)
156 {
157 return fvuGet4ToElink[uGet4Idx % kuNbGet4PerGbtx] + kuNbGet4PerGbtx * (uGet4Idx / kuNbGet4PerGbtx);
158 }
159 std::vector<Int_t> fviRpcType;
160 std::vector<Int_t> fviModuleId;
161 std::vector<Int_t> fviNrOfRpc;
162 std::vector<Int_t> fviRpcSide;
163 std::vector<Int_t> fviRpcChUId;
164
166
167 bool CheckTimeslice(const fles::Timeslice& ts);
168 void PrintMicroSliceDescriptor(const fles::MicrosliceDescriptor& mdsc);
169 bool IsChannelNameAllowed(std::string channelName);
170
171 void SetParContainers();
172 Bool_t InitContainers();
173 Bool_t ReInitContainers();
174 void CreateHistograms();
175 void AddReqDigiAddr(int);
176
177 Bool_t DoUnpack(const fles::Timeslice& ts, size_t component);
178
180 void AddMsComponentToList(size_t component, UShort_t usDetectorId);
181 void SetNbMsInTs(size_t /*uCoreMsNb*/, size_t /*uOverlapMsNb*/) {};
182
184 void SetIgnoreOverlapMs(Bool_t bFlagIn = kTRUE);
185 void SetTimeOffsetNs(Double_t dOffsetIn = 0.0);
186 void SetDiamondDpbIdx(UInt_t uIdx = 2);
187
189 std::shared_ptr<CbmTofUnpackAlgo> fUnpackerAlgo;
191 // Bool_t fbMonitorMode; //! Switch ON the filling of a minimal set of histograms
192 // Bool_t fbDebugMonitorMode; //! Switch ON the filling of a additional set of histograms
193 // Bool_t fbSeparateArrayBmon; //! If ON, Bmon digis are saved in separate TClonesArray
194 // Bool_t fbWriteOutput; //! If ON the output TClonesArray of digi is written to disk
195
198};
199
200// special class to expose protected TMessage constructor
201class CbmMQTMessage : public TMessage {
202public:
203 CbmMQTMessage(void* buf, Int_t len) : TMessage(buf, len) { ResetBit(kIsOwner); }
204};
205
206#endif /* CBMDEVICEUNPACKTOFCri_H_ */
std::vector< Int_t > fviRpcType
Bool_t DoUnpack(const fles::Timeslice &ts, size_t component)
void AddMsComponentToList(size_t component, UShort_t usDetectorId)
Temp until we change from CbmMcbmUnpack to something else.
bool HandleData(FairMQMessagePtr &, int)
std::vector< Bool_t > fvbFirstEpochSeen
std::vector< uint64_t > fEventHeader
std::vector< Int_t > fviRpcSide
CbmDeviceUnpackTofCri operator=(const CbmDeviceUnpackTofCri &)=delete
std::vector< TH1 * > fhChCount
std::vector< Int_t > fviModuleId
virtual void BuildTint(uint64_t ulTsStartTime, int iMode=0)
void SetNbMsInTs(size_t, size_t)
std::vector< Bool_t > fvbChanThere
std::vector< ULong64_t > fvulCurrentEpoch
std::vector< UInt_t > fvuGet4ToElink
std::shared_ptr< CbmTofUnpackAlgo > fUnpackerAlgo
Processing algo.
std::vector< int > fMsgCounter
std::vector< Int_t > fviNrOfRpc
CbmDeviceUnpackTofCri(const CbmDeviceUnpackTofCri &)=delete
Control flags.
void SetIgnoreOverlapMs(Bool_t bFlagIn=kTRUE)
Algo settings setters.
static const UInt_t kuNbGet4PerGbtx
Int_t GetArrayIndex(Int_t gdpbId, Int_t get4Id)
std::vector< UInt_t > fvuElinkToGet4
5 FEE with 8 GET4 each
void SetDiamondDpbIdx(UInt_t uIdx=2)
std::map< UInt_t, UInt_t > fGdpbIdIndexMap
std::vector< std::string > fAllowedChannels
CbmMcbm2018TofPar * fUnpackPar
std::vector< Int_t > fviRpcChUId
bool HandleMessage(FairMQMessagePtr &, int)
std::vector< std::vector< std::string > > fChannelsToSend
std::vector< UInt_t > fvuPadiToGet4
bool CheckTimeslice(const fles::Timeslice &ts)
bool HandleParts(FairMQParts &, int)
UInt_t ConvertElinkToGet4(UInt_t uElinkIdx)
UInt_t ConvertGet4ToElink(UInt_t uGet4Idx)
std::vector< Int_t > fiReqDigiAddr
void SetTimeOffsetNs(Double_t dOffsetIn=0.0)
bool IsChannelNameAllowed(std::string channelName)
std::vector< TH2 * > fhRawTotCh
virtual bool SendDigis(std::vector< CbmTofDigi * >, int)
std::vector< TH2 * > fhChanCoinc
std::vector< UInt_t > fvuGet4ToPadi
void PrintMicroSliceDescriptor(const fles::MicrosliceDescriptor &mdsc)
Histogram manager.
CbmMQTMessage(void *buf, Int_t len)
Singleton buffer class for CBM raw data.
Data class for expanded digital TOF information.
Definition CbmTofDigi.h:47