CbmRoot
Loading...
Searching...
No Matches
CbmDeviceUnpackTofCri.cxx
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
13
14#include "CbmDefs.h"
15#include "CbmMQDefs.h"
16#include "CbmMcbm2018TofPar.h"
17#include "CbmTofUnpackAlgo.h"
18#include "CbmTofUnpackConfig.h"
19//#include "CbmHistManager.h"
20#include "CbmTbDaqBuffer.h"
21#include "CbmTimeSlice.h"
22#include "CbmTofAddress.h"
23#include "CbmTofDetectorId_v21a.h" // in cbmdata/tof
24#include "CbmTofDigi.h"
25//#include "CbmRawEvent.h"
26
27#include "StorableTimeslice.hpp"
28
29#include "FairMQLogger.h"
30#include "FairMQProgOptions.h" // device->fConfig
31#include "FairParGenericSet.h"
32#include "FairRuntimeDb.h"
33
34#include "TH1.h"
35#include "TH2.h"
36
37#include <boost/archive/binary_iarchive.hpp>
38#include <boost/archive/binary_oarchive.hpp>
39
40// include this header to serialize vectors
41#include <boost/serialization/vector.hpp>
42
43#include <array>
44#include <iomanip>
45#include <stdexcept>
46#include <string>
47struct InitTaskError : std::runtime_error {
48 using std::runtime_error::runtime_error;
49};
50
51using namespace std;
52
53static Int_t iReportMess = 0;
54
55//const Int_t DetMask = 0x001FFFFF;
56std::shared_ptr<CbmTofUnpackConfig> fTofConfig = nullptr;
57
59 : fNumMessages(0)
61 , fNumTint(0)
62 , fEventHeader()
63 , fiReqMode(0)
64 , fiReqTint(0)
65 , fiReqBeam(-1)
66 , fiReqDigiAddr()
67 , fiPulserMode(0)
68 , fiPulMulMin(0)
69 , fiPulTotMin(0)
70 , fiPulTotMax(1000)
71 , fuTotalMsNb(0)
72 , fuOverlapMsNb(0)
73 , fuCoreMs(0)
74 , fdMsSizeInNs(0)
75 , fdTsCoreSizeInNs(0)
76 , fuMinNbGdpb(0)
77 , fuNrOfGdpbs(0)
78 , fuNrOfFeePerGdpb(0)
79 , fuNrOfGet4PerFee(0)
80 , fuNrOfChannelsPerGet4(0)
81 , fuNrOfChannelsPerFee(0)
82 , fuNrOfGet4(0)
83 , fuNrOfGet4PerGdpb(0)
84 , fuNrOfChannelsPerGdpb(0)
85 , fuGdpbId(0)
86 , fuGdpbNr(0)
87 , fuGet4Id(0)
88 , fuGet4Nr(0)
89 , fMsgCounter(11, 0) // length of enum MessageTypes initialized with 0
90 , fGdpbIdIndexMap()
91 , fvulCurrentEpoch()
92 , fvbFirstEpochSeen()
93 , fNofEpochs(0)
94 , fulCurrentEpochTime(0.)
95 //, fdMsIndex(0.)
96 , fdToffTof(0.)
97 , fiAddrRef(-1)
98 //, fuDiamondDpbIdx(3)
99 //, fbEpochSuppModeOn( kTRUE )
100 //, fbGet4M24b( kFALSE )
101 //, fbGet4v20( kTRUE )
102 //, fbMergedEpochsOn( kTRUE )
103 , fUnpackPar(nullptr)
104 , fdLastDigiTime(0.)
105 , fdFirstDigiTimeDif(0.)
106 //, fdEvTime0(0.)
107 , fhRawTDigEvBmon(nullptr)
108 , fhRawTDigRef0(nullptr)
109 , fhRawTDigRef(nullptr)
110 , fhRawTRefDig0(nullptr)
111 , fhRawTRefDig1(nullptr)
112 , fhRawDigiLastDigi(nullptr)
113 , fhRawTotCh()
114 , fhChCount()
115 , fvbChanThere()
116 , fhChanCoinc()
117 , fhDetChanCoinc(nullptr)
118 , fvuPadiToGet4()
119 , fvuGet4ToPadi()
120 , fvuElinkToGet4()
121 , fvuGet4ToElink()
122 , fviRpcType()
123 , fviModuleId()
124 , fviNrOfRpc()
125 , fviRpcSide()
126 , fviRpcChUId()
127 , fBuffer(CbmTbDaqBuffer::Instance())
128 , fUnpackerAlgo(nullptr)
129{
130 //fUnpackerAlgo = new CbmTofUnpackAlgo();
131}
132
134
136try {
137 // Get the information about created channels from the device
138 // Check if the defined channels from the topology (by name)
139 // are in the list of channels which are possible/allowed
140 // for the device
141 // The idea is to check at initilization if the devices are
142 // properly connected. For the time beeing this is done with a
143 // nameing convention. It is not avoided that someone sends other
144 // data on this channel.
145 //logger::SetLogLevel("INFO");
146
147 int noChannel = fChannels.size();
148 LOG(info) << "Number of defined channels: " << noChannel;
149 for (auto const& entry : fChannels) {
150 LOG(info) << "Channel name: " << entry.first;
151 if (!IsChannelNameAllowed(entry.first)) throw InitTaskError("Channel name does not match.");
152 if (entry.first == "syscmd") {
153 OnData(entry.first, &CbmDeviceUnpackTofCri::HandleMessage);
154 continue;
155 }
156 //if(entry.first != "tofdigis") OnData(entry.first, &CbmDeviceUnpackTofCri::HandleData);
157 if (entry.first != "tofdigis") OnData(entry.first, &CbmDeviceUnpackTofCri::HandleParts);
158 else {
159 fChannelsToSend[0].push_back(entry.first);
160 LOG(info) << "Init to send data to channel " << fChannelsToSend[0][0];
161 }
162 }
163
164 // ---- TOF ----
165 Int_t runid = 111;
166
167 fTofConfig = std::make_shared<CbmTofUnpackConfig>("", runid);
168 // fTofConfig->SetDoWriteOutput();
169 // fTofConfig->SetDoWriteOptOutA("CbmTofErrors");
170 if (fTofConfig) {
171 LOG(info) << "Configure Tof Unpacker ";
172 fTofConfig->SetDebugState();
173 fTofConfig->SetAlgo();
174 fUnpackerAlgo = fTofConfig->GetUnpacker();
176 //fTofConfig->InitUnpacker();
177 }
178 else
179 LOG(fatal) << "Tof Unpacker not configured ";
180
181 const Int_t iHeaderSize = 5;
182 fEventHeader.resize(iHeaderSize); // define size of eventheader int[]
183 for (int i = 0; i < iHeaderSize; i++)
184 fEventHeader[i] = 0;
185 LOG(info) << "Read config";
186 fiSelectComponents = fConfig->GetValue<uint64_t>("SelectComponents");
187 fiReqMode = fConfig->GetValue<uint64_t>("ReqMode");
188 fiReqTint = fConfig->GetValue<uint64_t>("ReqTint");
189 fiReqBeam = fConfig->GetValue<uint64_t>("ReqBeam");
190 fiPulserMode = fConfig->GetValue<int64_t>("PulserMode");
191 fiPulMulMin = fConfig->GetValue<uint64_t>("PulMulMin");
192 fiPulTotMin = fConfig->GetValue<uint64_t>("PulTotMin");
193 fiPulTotMax = fConfig->GetValue<uint64_t>("PulTotMax");
194 fdToffTof = fConfig->GetValue<double_t>("ToffTof");
195 Int_t iRefModType = fConfig->GetValue<int64_t>("RefModType");
196 Int_t iRefModId = fConfig->GetValue<int64_t>("RefModId");
197 Int_t iRefCtrType = fConfig->GetValue<int64_t>("RefCtrType");
198 Int_t iRefCtrId = fConfig->GetValue<int64_t>("RefCtrId");
199 if (iRefModType > -1)
200 fiAddrRef = CbmTofAddress::GetUniqueAddress(iRefModId, iRefCtrId, 0, 0, iRefModType, iRefCtrType);
201 LOG(info) << " Using reference counter address 0x" << std::hex << fiAddrRef << " and offset shift " << std::dec
202 << fdToffTof;
203
204 // Int_t iMaxAsicInactive = fConfig->GetValue<uint64_t>("MaxAsicInactive");
205 // fUnpackerAlgo->SetMaxAsicInactive( iMaxAsicInactive );
206 Int_t iReqDet = 1;
207 Int_t iNReq = 0;
208 const Int_t iMaxReq = 50;
209
210 while (iNReq < iMaxReq) { // FIXME, setup parameter hardwired!
211 iReqDet = fConfig->GetValue<uint64_t>(Form("ReqDet%d", iNReq));
212 if (iReqDet == 0) break;
213 AddReqDigiAddr(iReqDet);
214 iNReq++;
215 }
216 LOG(info) << "Setup request";
217 if (fiReqMode > 0)
218 if (iNReq == 0) { // take all defined detectors
219 for (UInt_t iGbtx = 0; iGbtx < fviNrOfRpc.size(); iGbtx++) {
220 switch (fviRpcType[iGbtx]) {
221 case 0: // mTof modules
222 case 1: // eTof modules
223 case 2: // M6 modules
224 if (iGbtx % 2 == 0)
225 for (Int_t iRpc = 0; iRpc < fviNrOfRpc[iGbtx]; iRpc++) {
226 Int_t iAddr = CbmTofAddress::GetUniqueAddress(fviModuleId[iGbtx], iRpc, 0, 0, fviRpcType[iGbtx]);
227 AddReqDigiAddr(iAddr);
228 }
229 break;
230
231 case 4:
232 case 9: // HD 2-RPC boxes
233 for (Int_t iRpc = 0; iRpc < 2; iRpc++) {
234 Int_t iAddr = CbmTofAddress::GetUniqueAddress(fviModuleId[iGbtx], iRpc, 0, 0, fviRpcType[iGbtx]);
235 AddReqDigiAddr(iAddr);
236 }
237 break;
238 case 6: // Buc box
239 for (Int_t iRpc = 0; iRpc < 2; iRpc++) {
240 Int_t iAddr = CbmTofAddress::GetUniqueAddress(fviModuleId[iGbtx], iRpc, 0, 0, fviRpcType[iGbtx]);
241 AddReqDigiAddr(iAddr);
242 }
243 break;
244
245 case 7: // CERN box
246 for (Int_t iRpc = 0; iRpc < 1; iRpc++) {
247 Int_t iAddr = CbmTofAddress::GetUniqueAddress(fviModuleId[iGbtx], iRpc, 0, 0, 7);
248 AddReqDigiAddr(iAddr);
249 }
250 break;
251 case 8: // ceramics
252 for (Int_t iRpc = 0; iRpc < 8; iRpc++) {
253 Int_t iAddr = CbmTofAddress::GetUniqueAddress(fviModuleId[iGbtx], iRpc, 0, 0, fviRpcType[iGbtx]);
254 AddReqDigiAddr(iAddr);
255 }
256 break;
257 case 5: // add Diamond, single cell RPC
258 Int_t iAddr = CbmTofAddress::GetUniqueAddress(fviModuleId[iGbtx], 0, 0, 0, 5);
259 AddReqDigiAddr(iAddr);
260 break;
261 }
262 }
263 }
264
265 LOG(info) << "ReqMode " << fiReqMode << " in " << fiReqTint << " ns "
266 << " with " << fiReqDigiAddr.size() << " detectors out of " << fviNrOfRpc.size() << " GBTx, PulserMode "
267 << fiPulserMode << " with Mul " << fiPulMulMin << ", TotMin " << fiPulTotMin;
268 LOG(info) << Form("ReqBeam 0x%08x", (uint) fiReqBeam);
269}
270catch (InitTaskError& e) {
271 LOG(error) << e.what();
272 // Wrapper defined in CbmMQDefs.h to support different FairMQ versions
274}
275
277{
278 for (auto const& entry : fAllowedChannels) {
279 LOG(info) << "Inspect " << entry;
280 std::size_t pos1 = channelName.find(entry);
281 if (pos1 != std::string::npos) {
282 const vector<std::string>::const_iterator pos =
283 std::find(fAllowedChannels.begin(), fAllowedChannels.end(), entry);
284 const vector<std::string>::size_type idx = pos - fAllowedChannels.begin();
285 LOG(info) << "Found " << entry << " in " << channelName;
286 LOG(info) << "Channel name " << channelName << " found in list of allowed channel names at position " << idx;
287 return true;
288 }
289 }
290 LOG(info) << "Channel name " << channelName << " not found in list of allowed channel names.";
291 LOG(error) << "Stop device.";
292 return false;
293}
294
296{
297 LOG(info) << "Init parameter containers for CbmDeviceUnpackTofCri";
298 // FairRuntimeDb* fRtdb = FairRuntimeDb::instance();
299
300 // NewSimpleMessage creates a copy of the data and takes care of its destruction (after the transfer takes place).
301 // Should only be used for small data because of the cost of an additional copy
302 std::string message {"CbmMcbm2018TofPar,111"};
303 LOG(info) << "Requesting parameter container CbmMcbm2018TofPar, sending message: " << message;
304
305 FairMQMessagePtr req(NewSimpleMessage("CbmMcbm2018TofPar,111"));
306 FairMQMessagePtr rep(NewMessage());
307
308 if (Send(req, "parameters") > 0) {
309 if (Receive(rep, "parameters") >= 0) {
310 if (rep->GetSize() != 0) {
311 CbmMQTMessage tmsg(rep->GetData(), rep->GetSize());
312 fUnpackPar = dynamic_cast<CbmMcbm2018TofPar*>(tmsg.ReadObject(tmsg.GetClass()));
313 LOG(info) << "Received unpack parameter from parmq server: " << fUnpackPar;
314 LOG(info) << "NrOfGdpbs: " << fUnpackPar->GetNrOfGdpbs();
315 }
316 else {
317 LOG(error) << "Received empty reply. Parameter not available";
318 }
319 }
320 }
321
322 //FairParGenericSet* parset=
324
325 Bool_t initOK = kTRUE;
326 //Int_t fRunId=111;
327 //string fGeoSetupTag="v21c";
328 //initOK &= fUnpackerAlgo->InitContainers();
329 //auto reqparvec = fUnpackerAlgo->GetParContainerRequest(fGeoSetupTag, fRunId);
330 //initOk &= initParContainers(reqparvec);
331 initOK &= ReInitContainers(); // needed for TInt parameters
332
333 // CreateHistograms();
334 // initOK &= fUnpackerAlgo->CreateHistograms();
335
338 fvbChanThere.resize(fviRpcChUId.size(), kFALSE);
339 for (UInt_t i = 0; i < fuNrOfGdpbs; ++i) {
340 for (UInt_t j = 0; j < fuNrOfGet4PerGdpb; ++j) {
342 fvbFirstEpochSeen[GetArrayIndex(i, j)] = kFALSE;
343 } // for( UInt_t j = 0; j < fuNrOfGet4PerGdpb; ++j )
344 } // for( UInt_t i = 0; i < fuNrOfGdpbs; ++i )
345
346 fNumTint = 0;
347 return initOK;
348}
349
351{
352 //FairRuntimeDb* fRtdb = FairRuntimeDb::instance();
353 LOG(info) << "NrOfGdpbs: " << fUnpackPar->GetNrOfGdpbs();
354
355 // PAL, 2022/07/05: use algo native pointer interface + sanity checks to set the parameter
356 auto reqparvec = fTofConfig->GetParContainerRequest();
357 if (1 == reqparvec->size() && (reqparvec->at(0).second->IsA() == CbmMcbm2018TofPar::Class())) {
358 reqparvec->at(0).second.reset(fUnpackPar);
359 }
360 else {
361 LOG(fatal) << "CbmDeviceUnpackTofCri::SetParContainers => wronf number of parameters needed for the algo or wrong "
362 << "Parameter type";
363 }
364 /*
365 TList* fParCList; // = fUnpackerAlgo->GetParList();
366
367 LOG(info) << "Setting parameter containers for " << fParCList->GetEntries() << " entries ";
368
369 for (Int_t iparC = 0; iparC < fParCList->GetEntries(); ++iparC) {
370 FairParGenericSet* tempObj = (FairParGenericSet*) (fParCList->At(iparC));
371 fParCList->Remove(tempObj);
372
373 std::string sParamName {tempObj->GetName()};
374
375 FairParGenericSet* newObj = dynamic_cast<FairParGenericSet*>(fRtdb->getContainer(sParamName.data()));
376 LOG(info) << " - Get " << sParamName.data() << " at " << newObj;
377 if (nullptr == newObj) {
378
379 LOG(error) << "Failed to obtain parameter container " << sParamName << ", for parameter index " << iparC;
380 return;
381 } // if( nullptr == newObj )
382 if (iparC == 0) {
383 newObj = (FairParGenericSet*) fUnpackPar;
384 LOG(info) << " - Mod " << sParamName.data() << " to " << newObj;
385 }
386 fParCList->AddAt(newObj, iparC);
387 // delete tempObj;
388 } // for( Int_t iparC = 0; iparC < fParCList->GetEntries(); ++iparC )
389 */
390}
391
392void CbmDeviceUnpackTofCri::AddMsComponentToList(size_t /*component*/, UShort_t /*usDetectorId*/)
393{
394 //fUnpackerAlgo->AddMsComponentToList(component, usDetectorId);
395}
396
398{
399 LOG(info) << "ReInit parameter containers for CbmDeviceUnpackCriTofPar.";
400
401 UInt_t uNrOfGbtx = fUnpackPar->GetNrOfGbtx();
402 fviRpcType.resize(uNrOfGbtx);
403 fviModuleId.resize(uNrOfGbtx);
404 fviNrOfRpc.resize(uNrOfGbtx);
405 fviRpcSide.resize(uNrOfGbtx);
406
407 for (UInt_t iGbtx = 0; iGbtx < uNrOfGbtx; ++iGbtx) {
408 fviNrOfRpc[iGbtx] = fUnpackPar->GetNrOfRpc(iGbtx);
409 fviRpcType[iGbtx] = fUnpackPar->GetRpcType(iGbtx);
410 fviRpcSide[iGbtx] = fUnpackPar->GetRpcSide(iGbtx);
411 fviModuleId[iGbtx] = fUnpackPar->GetModuleId(iGbtx);
412 }
413 return kTRUE;
414}
415
417{
418 LOG(info) << "create Histos for " << fuNrOfGdpbs << " gDPBs ";
419
421 new TH1F(Form("Raw_TDig-EvBmon"), Form("Raw digi time difference to 1st digi ; time [ns]; cts"), 500, 0, 100.);
422 // fHM->Add( Form("Raw_TDig-EvBmon"), fhRawTDigEvBmon);
423
425 new TH1F(Form("Raw_TDig-Ref0"), Form("Raw digi time difference to Ref ; time [ns]; cts"), 6000, -10000, 50000);
426 // fHM->Add( Form("Raw_TDig-Ref0"), fhRawTDigRef0);
427
429 new TH1F(Form("Raw_TDig-Ref"), Form("Raw digi time difference to Ref ; time [ns]; cts"), 6000, -1000, 5000);
430 // fHM->Add( Form("Raw_TDig-Ref"), fhRawTDigRef);
431
432 fhRawTRefDig0 = new TH1F(Form("Raw_TRef-Dig0"), Form("Raw Ref time difference to last digi ; time [ns]; cts"), 9999,
433 -50000, 50000);
434 // fHM->Add( Form("Raw_TRef-Dig0"), fhRawTRefDig0);
435
437 new TH1F(Form("Raw_TRef-Dig1"), Form("Raw Ref time difference to last digi ; time [ns]; cts"), 9999, -5000, 5000);
438 // fHM->Add( Form("Raw_TRef-Dig1"), fhRawTRefDig1);
439
440 fhRawDigiLastDigi = new TH1F(Form("Raw_Digi-LastDigi"),
441 Form("Raw Digi time difference to last digi ; time [ns]; cts"), 9999, -5000, 5000);
442 // 9999, -5000000, 5000000);
443 // fHM->Add( Form("Raw_Digi-LastDigi"), fhRawDigiLastDigi);
444
445 fhRawTotCh.resize(fuNrOfGdpbs);
446 fhChCount.resize(fuNrOfGdpbs);
448 for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; uGdpb++) {
449 fhRawTotCh[uGdpb] = new TH2F(Form("Raw_Tot_gDPB_%02u", uGdpb), Form("Raw TOT gDPB %02u; channel; TOT [bin]", uGdpb),
450 fuNrOfChannelsPerGdpb, 0., fuNrOfChannelsPerGdpb, 256, 0., 256.);
451 // fHM->Add( Form("Raw_Tot_gDPB_%02u", uGdpb), fhRawTotCh[ uGdpb ]);
452
453 fhChCount[uGdpb] =
454 new TH1I(Form("ChCount_gDPB_%02u", uGdpb), Form("Channel counts gDPB %02u; channel; Hits", uGdpb),
456 // fHM->Add( Form("ChCount_gDPB_%02u", uGdpb), fhChCount[ uGdpb ]);
457 /*
458 for( UInt_t uLeftFeb = uGdpb*fuNrOfFebsPerGdpb / 2;
459 uLeftFeb < (uGdpb + 1 )*fuNrOfFebsPerGdpb / 2;
460 ++uLeftFeb )
461 {
462 fhChanCoinc[ uLeftFeb ] = new TH2F( Form("fhChanCoinc_%02u", uLeftFeb),
463 Form("Channels Coincidence %02; Left; Right", uLeftFeb),
464 fuNrOfChannelsPerFee, 0., fuNrOfChannelsPerFee,
465 fuNrOfChannelsPerFee, 0., fuNrOfChannelsPerFee );
466 } // for( UInt_t uLeftFeb = 0; uLeftFeb < fuNrOfFebsPerGdpb / 2; uLeftFeb ++ )
467 */
468 fhChanCoinc[uGdpb] =
469 new TH2F(Form("fhChanCoinc_%02u", uGdpb), Form("Channels Coincidence %02u; Left; Right", uGdpb),
471 } // for( UInt_t uGdpb = 0; uGdpb < fuMinNbGdpb; uGdpb ++)
472 fhDetChanCoinc = new TH2F("fhDetChanCoinc", "Det Channels Coincidence; Left; Right", 32, 0., 32, 32, 0., 32);
473}
474
475// handler is called whenever a message arrives on "data", with a reference to the message and a sub-channel index (here 0)
476bool CbmDeviceUnpackTofCri::HandleData(FairMQMessagePtr& msg, int /*index*/)
477{
478 // Don't do anything with the data
479 // Maybe add an message counter which counts the incomming messages and add
480 // an output
481 fNumMessages++;
482 LOG(debug) << "Received message number " << fNumMessages << " with size " << msg->GetSize();
483
484 std::string msgStr(static_cast<char*>(msg->GetData()), msg->GetSize());
485 std::istringstream iss(msgStr);
486 boost::archive::binary_iarchive inputArchive(iss);
487
488 fles::StorableTimeslice component {0};
489 inputArchive >> component;
490
491 // CheckTimeslice(component);
492
493 DoUnpack(component, 0);
494
495 BuildTint(component.start_time(), 0);
496
497 if (fNumMessages % 1000 == 0) LOG(info) << "Processed " << fNumMessages << " time slices";
498
499 return true;
500}
501
502bool CbmDeviceUnpackTofCri::HandleParts(FairMQParts& parts, int /*index*/)
503{
504 // Don't do anything with the data
505 // Maybe add an message counter which counts the incomming messages and add
506 // an output
507 fNumMessages++;
508 LOG(debug) << "Received message number " << fNumMessages << " with " << parts.Size() << " parts";
509
510 fles::StorableTimeslice ts {0};
511 uint64_t ulTsStartTime = 0;
512
513 switch (fiSelectComponents) {
514 case 0: {
515 std::string msgStr(static_cast<char*>(parts.At(0)->GetData()), (parts.At(0))->GetSize());
516 std::istringstream iss(msgStr);
517 boost::archive::binary_iarchive inputArchive(iss);
518 inputArchive >> ts;
519 //CheckTimeslice(ts);
520 for (size_t c {0}; c < ts.num_components(); c++) {
521 auto systemID = static_cast<int>(ts.descriptor(c, 0).sys_id);
522 if (1 == fNumMessages) {
523 LOG(info) << "Found systemID: " << std::hex << systemID << std::dec;
524 //fUnpackerAlgo->AddMsComponentToList(c, systemID); // TOF data
525 }
526 if (systemID == 0x60 || systemID == 0x90) { // FIXME hardwired numbers
527 //LOG(info) << "Call unpacker for component " << c;
528 DoUnpack(ts, c);
529 }
530 }
531 ulTsStartTime = ts.start_time();
532 } break;
533 case 1: {
534 fles::StorableTimeslice component {0};
535
536 uint ncomp = parts.Size();
537 for (uint i = 0; i < ncomp; i++) {
538 std::string msgStr(static_cast<char*>(parts.At(i)->GetData()), (parts.At(i))->GetSize());
539 std::istringstream iss(msgStr);
540 boost::archive::binary_iarchive inputArchive(iss);
541 //fles::StorableTimeslice component{i};
542 inputArchive >> component;
543
544 // CheckTimeslice(component);
545 //fUnpackerAlgo->AddMsComponentToList(0, 0x60); // TOF data
546 LOG(debug) << "HandleParts message " << fNumMessages << ", component " << i << ",size "
547 << (parts.At(i))->GetSize();
548 DoUnpack(component, 0);
549 }
550 ulTsStartTime = component.start_time();
551 } break;
552 default:;
553 }
554
555 BuildTint(ulTsStartTime, 0);
556
557 if (fNumMessages % 100 == 0) LOG(info) << "Processed " << fNumMessages << " time slices";
558 //LOG(info) << "HandleParts done with message number " << fNumMessages;
559
560 return true;
561}
562
563bool CbmDeviceUnpackTofCri::HandleMessage(FairMQMessagePtr& msg, int /*index*/)
564{
565 const char* cmd = (char*) (msg->GetData());
566 const char cmda[4] = {*cmd};
567 LOG(info) << "Handle message " << cmd << ", " << cmd[0];
568 cbm::mq::LogState(this);
569
570 // only one implemented so far "Stop"
571
572 if (strcmp(cmda, "STOP")) {
573 LOG(info) << "STOP";
574 fUnpackerAlgo->Finish();
576 cbm::mq::LogState(this);
578 cbm::mq::LogState(this);
580 cbm::mq::LogState(this);
582 cbm::mq::LogState(this);
583 }
584 return true;
585}
586
587Bool_t CbmDeviceUnpackTofCri::DoUnpack(const fles::Timeslice& ts, size_t component)
588{
589 LOG(debug) << "Timeslice " << ts.index() << " contains " << ts.num_microslices(component)
590 << " microslices of component " << component << ", NCoreMs: " << ts.num_core_microslices();
591
592 fUnpackerAlgo->SetTsStartTime(ts.start_time());
593 std::vector<CbmTofDigi> vDigi = fUnpackerAlgo->Unpack(&ts, component);
594
595 LOG(debug) << "TS " << ts.index() << ", startTime " << ts.start_time() << ": insert " << vDigi.size()
596 << " digis of component " << component << " into DAQ buffer with size " << fBuffer->GetSize();
597
598 CbmTofDigi* fDigi = NULL;
599 CbmTofDigi* fDigiLast = NULL;
600 for (auto digi : vDigi) {
601 // Memorize last digi
602 if (NULL != fDigi) fDigiLast = fDigi;
603 // copy Digi for insertion into DAQ buffer
604 fDigi = new CbmTofDigi(digi);
605
606 //if( (fDigi->GetAddress() & 0x000F00F ) != fiAddrRef ) fDigi->SetTime(fDigi->GetTime()+fdToffTof); // shift all Tof Times for v14a geometries
607 if ((fDigi->GetAddress() & 0x000780F) != fiAddrRef)
608 fDigi->SetTime(fDigi->GetTime() + fdToffTof); // shift all Tof Times for V21a
609
610 LOG(debug) << "BufferInsert TSRCS "
611 << Form("%d%d%d%02d%d", (int) fDigi->GetType(), (int) fDigi->GetSm(), (int) fDigi->GetRpc(),
612 (int) fDigi->GetChannel(), (int) fDigi->GetSide())
613 << Form(", 0x%08x, t %012.2f", fDigi->GetAddress(), fDigi->GetTime())
614 << Form(", first %012.2f, last %012.2f, size %u", fBuffer->GetTimeFirst(), fBuffer->GetTimeLast(),
615 fBuffer->GetSize());
616 if (NULL != fDigiLast) {
617 if ((fDigi->GetTime() * 1000) == (fDigiLast->GetTime() * 1000)) {
618 if (iReportMess++ < 1000)
619 LOG(warn) << "Successive digis with same time: "
620 << Form("%12.3f, TSRCS %d%d%d%02d%d - %d%d%d%02d%d", fDigi->GetTime(), (Int_t) fDigi->GetType(),
621 (Int_t) fDigi->GetSm(), (Int_t) fDigi->GetRpc(), (Int_t) fDigi->GetChannel(),
622 (Int_t) fDigi->GetSide(), (Int_t) fDigiLast->GetType(), (Int_t) fDigiLast->GetSm(),
623 (Int_t) fDigiLast->GetRpc(), (Int_t) fDigiLast->GetChannel(), (Int_t) fDigiLast->GetSide());
624 }
625 else
627 }
628 else
630
631 LOG(debug) << "I "
632 << " TSRC " << fDigi->GetType() << fDigi->GetSm() << fDigi->GetRpc() << fDigi->GetChannel() << " S "
633 << fDigi->GetSide() << " : " << Form("T %15.3f, Tot %5.1f", fDigi->GetTime(), fDigi->GetTot());
634 }
635 vDigi.clear();
636 //fUnpackerAlgo->ClearVector();
637
638 return kTRUE;
639}
640
641void CbmDeviceUnpackTofCri::BuildTint(uint64_t ulTsStartTime, int iMode)
642{
643 // iMode - sending condition
644 // 0 (default)- build time interval only if last buffer entry is older the start + TSLength
645 // 1 (finish), empty buffer without checking
646 // Steering variables
647 double TSLENGTH = 1.E6;
648 double fdMaxDeltaT = (double) fiReqTint; // in ns
649
650 LOG(debug) << "BuildTint: Buffer size " << fBuffer->GetSize() << ", DeltaT "
651 << (fBuffer->GetTimeLast() - fBuffer->GetTimeFirst()) / 1.E9 << " s";
653 CbmTofDigi* digi;
654
655 while (fBuffer->GetSize() > 0) {
656 Double_t fTimeBufferLast = fBuffer->GetTimeLast();
657
658 switch (iMode) {
659 case 0:
660 if (fTimeBufferLast - fBuffer->GetTimeFirst() < TSLENGTH) {
661 LOG(debug) << "BuildTint: refill DAQ buffer ";
662 return;
663 }
664 break;
665 case 1:; break;
666 }
667
668 data = fBuffer->GetNextData(fTimeBufferLast);
669 digi = boost::any_cast<CbmTofDigi*>(data.first);
670 assert(digi);
671
672 Double_t dTEnd = digi->GetTime() + fdMaxDeltaT;
673 Double_t dTEndMax = digi->GetTime() + 2 * fdMaxDeltaT;
674 LOG(debug) << Form("Next event at %f until %f, max %f ", digi->GetTime(), dTEnd, dTEndMax);
675
676 if (dTEnd > fTimeBufferLast) {
677 LOG(warn) << Form("Remaining buffer < %f with %d entries is not "
678 "sufficient for digi ending at %f -> skipped ",
679 fTimeBufferLast, fBuffer->GetSize(), dTEnd);
680 return;
681 }
682
683 LOG(debug) << "BuildTint0 with digi " << Form("0x%08x at %012.2f", digi->GetAddress(), digi->GetTime());
684
685 Bool_t bDet[fiReqDigiAddr.size()][2];
686 for (UInt_t i = 0; i < fiReqDigiAddr.size(); i++)
687 for (Int_t j = 0; j < 2; j++)
688 bDet[i][j] = kFALSE; //initialize
689 Bool_t bPul[fiReqDigiAddr.size()][2];
690 for (UInt_t i = 0; i < fiReqDigiAddr.size(); i++)
691 for (Int_t j = 0; j < 2; j++)
692 bPul[i][j] = kFALSE; //initialize
693 Bool_t bBeam = kFALSE;
694
695 std::vector<CbmTofDigi*> vdigi;
696 UInt_t nDigi = 0;
697 //const Int_t AddrMask=0x003FFFFF;
698 const Int_t AddrMask = 0x001FFFFF;
699 Bool_t bOut = kFALSE;
700 Int_t iBucMul = 0;
701
702 while (data.second != ECbmModuleId::kNotExist) { // build digi array
703 digi = boost::any_cast<CbmTofDigi*>(data.first);
704 LOG(debug) << "GetNextData " << digi << ", " << data.second << ", " << Form("%f %f", digi->GetTime(), dTEnd)
705 << ", Mul " << nDigi;
706 assert(digi);
707
708 if (nDigi == vdigi.size()) vdigi.resize(nDigi + 100);
709 vdigi[nDigi++] = digi;
710
711 Int_t iAddr = digi->GetAddress() & AddrMask;
712 if (iAddr == 0x00003006 || iAddr == 0x0000b006) {
713 iBucMul++;
714 LOG(debug) << Form("Event %10lu: BucMul %2d, addr 0x%08x, side %d, strip %2d, rpc %d", fEventHeader[0], iBucMul,
715 (uint) digi->GetAddress(), (Int_t) digi->GetSide(), (Int_t) digi->GetChannel(),
716 (int) digi->GetRpc());
717 }
718 for (UInt_t i = 0; i < fiReqDigiAddr.size(); i++)
719 if ((digi->GetAddress() & AddrMask) == fiReqDigiAddr[i]) {
720 Int_t j = ((CbmTofDigi*) digi)->GetSide();
721 bDet[i][j] = kTRUE;
722 if (fiReqDigiAddr[i] == (Int_t) fiReqBeam) {
723 bBeam = kTRUE;
724 LOG(debug) << "Found ReqBeam at index " << nDigi - 1 << ", req " << i;
725 }
726 if ((UInt_t) fiReqDigiAddr[i] == fiAddrRef) bDet[i][1] = kTRUE; // diamond with pad readout
727 if ((fiReqDigiAddr[i] & 0x0000F00F) == 0x00004006) { // pad counters v21a
728 bDet[i][1] = kTRUE;
729 LOG(debug) << Form("Pad counter 0x%08x found in ev %10lu", fiReqDigiAddr[i], fEventHeader[0]);
730 }
731 Int_t str = ((CbmTofDigi*) digi)->GetChannel();
732
733 switch (j) { // treat both strip ends separately
734 case 0: {
735 switch (fiPulserMode) {
736 case 0:
737 case 1:
738 if (str == 31)
739 if (digi->GetTot() > fiPulTotMin && digi->GetTot() < fiPulTotMax) bPul[i][0] = kTRUE;
740 if (str == 0) bPul[i][1] = kFALSE;
741 if ((UInt_t) fiReqDigiAddr[i] == fiAddrRef) { //special mapping for MAr2019 diamond (Bmon)
742 if (str == 0) bPul[i][0] = kTRUE;
743 if (str == 40) bPul[i][1] = kTRUE;
744 }
745 break;
746 case 2:
747 if (str == 0) {
748 if (digi->GetTot() > fiPulTotMin && digi->GetTot() < fiPulTotMax) {
749 bPul[i][0] = kTRUE;
750 if ((fiReqDigiAddr[i] & 0x000FF00F) == 0x00078006) {
751 bPul[i][1] = kTRUE; // ceramic with pad readout
752 bDet[i][1] = kFALSE; // remove Hit flag
753 }
754 if (str == 31) bPul[i][1] = kFALSE;
755 }
756 }
757 default:;
758 }
759 } break;
760
761 case 1:
762 switch (fiPulserMode) {
763 case 0:
764 case 1:
765 if (str == 31) bPul[i][0] = kFALSE;
766 if (str == 0)
767 if (digi->GetTot() > fiPulTotMin && digi->GetTot() < fiPulTotMax) bPul[i][1] = kTRUE;
768 break;
769 case 2:
770 if (str == 0) bPul[i][0] = kFALSE;
771 if (str == 31)
772 if (digi->GetTot() > fiPulTotMin && digi->GetTot() < fiPulTotMax) bPul[i][1] = kTRUE;
773 break;
774 default:;
775 }
776 break;
777 default:;
778 }
779 }
780 //if(bOut) LOG(info)<<Form("Found 0x%08x, Req 0x%08x ", digi->GetAddress(), fiReqDigiAddr);
781 if (dTEnd - digi->GetTime() < fdMaxDeltaT * 0.5) {
782 if (digi->GetTime() + fdMaxDeltaT * 0.5 < dTEndMax) dTEnd = digi->GetTime() + fdMaxDeltaT * 0.5;
783 else
784 dTEnd = dTEndMax;
785 };
786 data = fBuffer->GetNextData(dTEnd);
787
788 } // end while
789
790 LOG(debug) << Form(" %d digis associated to dTEnd = %15.9f", nDigi, dTEnd);
791 //for(UInt_t iDigi=0; iDigi<nDigi; iDigi++) LOG(debug)<<Form(" 0x%08x",vdigi[iDigi]->GetAddress());
792 //for (UInt_t iDigi = 0; iDigi < nDigi; iDigi++) LOG(debug) << vdigi[iDigi]->ToString();
793 for (UInt_t iDigi = 0; iDigi < nDigi; iDigi++)
794 LOG(debug) << "B " << iDigi << " TSRC " << vdigi[iDigi]->GetType() << vdigi[iDigi]->GetSm()
795 << vdigi[iDigi]->GetRpc() << vdigi[iDigi]->GetChannel() << " S " << vdigi[iDigi]->GetSide() << " : "
796 << Form("T %15.3f, Tot %5.1f", vdigi[iDigi]->GetTime(), vdigi[iDigi]->GetTot());
797
798 UInt_t iDetMul = 0;
799 if (fiReqDigiAddr.size() == 0) bOut = kTRUE; // output everything
800 else {
801 if (fiReqMode == 0) { // check for presence of requested detectors
802 for (UInt_t i = 0; i < fiReqDigiAddr.size(); i++)
803 if (bDet[i][0] == kFALSE || bDet[i][1] == kFALSE) break;
804 else if (i == fiReqDigiAddr.size() - 1) {
805 bOut = kTRUE;
806 iDetMul = i;
807 }
808 }
809 else { // check for presence of any known detector
810 for (UInt_t i = 0; i < fiReqDigiAddr.size(); i++)
811 if (bDet[i][0] == kTRUE && bDet[i][1] == kTRUE) { iDetMul++; }
812 if (iDetMul >= fiReqMode) { bOut = kTRUE; }
813 }
814 }
815
816 if (bOut && fiReqDigiAddr.size() > 1) {
817 LOG(debug) << "Found Req coinc in event with " << nDigi << " digis in " << iDetMul
818 << " detectors, dTEnd = " << dTEnd;
819 }
820
821 // determine Pulser status
822 UInt_t iPulMul = 0; // Count Potential Pulser Signals
823 for (UInt_t i = 0; i < fiReqDigiAddr.size(); i++) {
824 if (bPul[i][0] == kTRUE && bPul[i][1] == kTRUE) iPulMul++;
825 }
826
827 if (fiPulserMode > 0 && iPulMul > fiPulMulMin) {
828 LOG(debug) << "@Event " << fEventHeader[0] << ": iPulMul = " << iPulMul;
829 bOut = kTRUE;
830 }
831
832 LOG(debug) << "Process Ev " << fEventHeader[0] << " with iDetMul = " << iDetMul << ", iPulMul = " << iPulMul;
833
834 fEventHeader[0]++;
835
836 if ((Int_t) fiReqBeam > -1) {
837 if (bBeam) { LOG(debug) << "Beam counter is present "; }
838 else {
839 LOG(debug) << "Beam counter is not present";
840 bOut = kFALSE; // request beam counter for event
841 }
842 }
843
844 if (bOut) {
845 fEventHeader[1] = iDetMul;
847 fEventHeader[3] = iPulMul;
848 fEventHeader[4] = ulTsStartTime; // PAL, 2022/07/05: no need to go to algo to get this value
849 /*
850 LOG(info) << "Sevt # " << fEventHeader[0]
851 <<", DetMul "<< fEventHeader[1]
852 <<", ReqMod "<< fEventHeader[2]
853 <<", PulMul "<< fEventHeader[3]
854 <<", TsStart "<< fEventHeader[4];
855 */
856 vdigi.resize(nDigi);
857 const Int_t NDigiMax = 10000; //FIXME constant number in code
858 if (nDigi > NDigiMax) {
859 LOG(warn) << "Oversized event " << fEventHeader[0] << ", size " << nDigi << " truncated! ";
860 for (UInt_t iDigi = NDigiMax; iDigi < nDigi; iDigi++) {
861 LOG(debug) << "Discard digi " << iDigi << ": " << vdigi[iDigi]->ToString();
862 delete vdigi[iDigi];
863 }
864 nDigi = 1; //NDigiMax;
865 vdigi.resize(nDigi);
866 }
867 LOG(debug) << "Send " << nDigi << " digis to HitBuilder";
868 SendDigis(vdigi, 0);
869
870 for (UInt_t iDigi = 0; iDigi < nDigi; iDigi++)
871 delete vdigi[iDigi];
872 }
873 else {
874 LOG(debug) << " BuildTint cleanup of " << nDigi << " digis";
875 for (UInt_t iDigi = 0; iDigi < nDigi; iDigi++) {
876 delete vdigi[iDigi];
877 // vdigi[iDigi]->Delete();
878 }
879 LOG(debug) << " Digis deleted ";
880 //vdigi.clear();
881 //delete &vdigi; // crashes, since local variable, will be done at return (?)
882 }
883 }
884}
885
886bool CbmDeviceUnpackTofCri::SendDigis(std::vector<CbmTofDigi*> vdigi, int idx)
887{
888 LOG(debug) << "Send Digis for event " << fNumTint << " with size " << vdigi.size() << Form(" at %p ", &vdigi);
889 LOG(debug) << "EventHeader: " << fEventHeader[0] << " " << fEventHeader[1] << " " << fEventHeader[2] << " "
890 << fEventHeader[3];
891
892 // Int_t NDigi=vdigi.size();
893
894 std::stringstream ossE;
895 boost::archive::binary_oarchive oaE(ossE);
896 oaE << fEventHeader;
897 std::string* strMsgE = new std::string(ossE.str());
898
899 std::stringstream oss;
900 boost::archive::binary_oarchive oa(oss);
901 oa << vdigi;
902 std::string* strMsg = new std::string(oss.str());
903
904 FairMQParts parts;
905 parts.AddPart(NewMessage(
906 const_cast<char*>(strMsgE->c_str()), // data
907 strMsgE->length(), // size
908 [](void*, void* object) { delete static_cast<std::string*>(object); },
909 strMsgE)); // object that manages the data
910
911 parts.AddPart(NewMessage(
912 const_cast<char*>(strMsg->c_str()), // data
913 strMsg->length(), // size
914 [](void*, void* object) { delete static_cast<std::string*>(object); },
915 strMsg)); // object that manages the data
916
917
918 /*
919 std::vector<CbmTofDigi>vTofDigi;
920 vTofDigi.resize(vdigi.size());
921 for (Int_t i=0; i<vdigi.size(); i++) {
922 CbmTofDigi *pdigi = (CbmTofDigi *) vdigi[i];
923 CbmTofDigi digi = *pdigi;
924 vTofDigi[i] = digi;
925 LOG(debug) << vTofDigi[i].ToString()<<" bits "<<Form("0x%08x",vTofDigi[i].TestBits(0xFFFF));
926 }
927 FairMQMessagePtr msg(NewMessage(static_cast<std::vector<CbmTofDigi>*> (&vTofDigi), // data
928 NDigi*sizeof(CbmTofDigi), // size
929 [](void* , void* object){ delete static_cast<CbmTofDigi*>(object); }
930 )); // object that manages the data
931
932 // transfer of TofDigi array, ... works
933 CbmTofDigi aTofDigi[NDigi];
934 // const Int_t iNDigiOut=100;
935 // NDigi=TMath::Min(NDigi,iNDigiOut);
936 // std::array<CbmTofDigi,iNDigiOut> aTofDigi;
937 for (Int_t i=0; i<NDigi; i++) {
938 aTofDigi[i] = *vdigi[i];
939 LOG(debug) << aTofDigi[i].ToString()<<" bits "<<Form("0x%08x",aTofDigi[i].TestBits(0xFFFF));
940 }
941 FairMQMessagePtr msg(NewMessage(static_cast<CbmTofDigi*> (&aTofDigi[0]), // data
942 NDigi*sizeof(CbmTofDigi), // size
943 [](void* , void* object){ delete static_cast<CbmTofDigi*>(object); }
944 )); // object that manages the data
945
946
947 LOG(info) << "Send aTofDigi sizes "<<NDigi<<", "<<sizeof(CbmTofDigi)<<", msg size "<<msg->GetSize();
948
949 // serialize the timeslice and create the message
950
951 std::stringstream oss;
952 boost::archive::binary_oarchive oa(oss);
953 oa << vdigi;
954 std::string* strMsg = new std::string(oss.str());
955
956 LOG(debug) << "send strMsg with length " << strMsg->length()<<" "<<strMsg;
957 FairMQMessagePtr msg(NewMessage(const_cast<char*>(strMsg->c_str()), // data
958 strMsg->length(), // size
959 [](void* , void* object){ delete static_cast<std::string*>(object); },
960 strMsg)); // object that manages the data
961 */
962 /*
963 FairMQMessagePtr msg(NewMessage(static_cast<CbmTofDigi*> (vTofDigi.data()), // data
964 vTofDigi.size()*sizeof(CbmTofDigi), // size
965 [](void* , void* object){ delete static_cast<CbmTofDigi*>(object); }
966 )); // object that manages the data
967 */
968
969 /* --------------------------------------- compiles but crashes .... ---------------------------------------------------
970 const Int_t WSize=8;
971 FairMQMessagePtr msg(NewMessage(static_cast<std::vector<CbmTofDigi>*> (&vTofDigi), // data
972 vTofDigi.size()*sizeof(CbmTofDigi)*WSize, // size, FIXME, numerical value in code!
973 [](void* , void* object){ delete static_cast<std::vector<CbmTofDigi>*>(object); }
974 )); // object that manages the data
975
976 LOG(info) << "Send TofDigi sizes "<<vTofDigi.size()<<", "<<sizeof(CbmTofDigi)<<", msg size "<<msg->GetSize();
977 int *pData = static_cast <int *>(vTofDigi.data());
978
979 int *pData = static_cast <int *>(msg->GetData());
980 const Int_t NBytes=4;
981 for (int iData=0; iData<msg->GetSize()/NBytes; iData++) {
982 LOG(info) << Form(" ind %d, poi %p, data: 0x%08x",iData,pData,*pData++);
983 }
984 */
985 /*
986 auto msg = NewMessageFor("my_channel", 0,
987 static_cast<void*>(vTofDigi.data()),
988 vTofDigi.size() * sizeof(CbmTofDigi),
989 FairMQNoCleanup, nullptr);
990 */
991
992 // TODO: Implement sending same data to more than one channel
993 // Need to create new message (copy message??)
994 /*
995 if (fChannelsToSend[idx]>1) {
996 LOG(info) << "Need to copy FairMessage ?";
997 }
998 */
999 // in case of error or transfer interruption,
1000 // return false to go to IDLE state
1001 // successfull transfer will return number of bytes
1002 // transfered (can be 0 if sending an empty message).
1003
1004 LOG(debug) << "Send data to channel " << idx << " " << fChannelsToSend[idx][0];
1005
1006
1007 // if (Send(msg, fChannelsToSend[idx][0]) < 0) {
1008 if (Send(parts, fChannelsToSend[idx][0]) < 0) {
1009 LOG(error) << "Problem sending data " << fChannelsToSend[idx][0];
1010 return false;
1011 }
1012
1013 LOG(debug) << "Sent event # " << fNumTint << " from " << vdigi.size() << " Digis at " << vdigi.data() << ", "
1014 << &vdigi;
1015
1016 fNumTint++;
1017 //if(fNumTint==100) FairMQStateMachine::ChangeState(PAUSE); //sleep(10000); // Stop for debugging ...
1018 /*
1019 LOG(info) << "Send message " << fNumTint << " with a size of "
1020 << msg->GetSize();
1021 */
1022 return true;
1023}
1024
1026{
1027 UInt_t iNReq = fiReqDigiAddr.size();
1028 for (UInt_t i = 0; i < iNReq; i++)
1029 if (fiReqDigiAddr[i] == iAddr) return; // det already present, avoid double counting
1030 fiReqDigiAddr.resize(iNReq + 1); // hopefully the old entries are preserved ...
1031 fiReqDigiAddr[iNReq] = iAddr;
1032 LOG(info) << Form("Request Digi Address 0x%08x at index %d", iAddr, iNReq);
1033}
1034
1035void CbmDeviceUnpackTofCri::SetIgnoreOverlapMs(Bool_t bFlagIn) { fUnpackerAlgo->SetDoIgnoreOverlappMs(bFlagIn); }
1036
1037//void CbmDeviceUnpackTofCri::SetTimeOffsetNs(Double_t dOffsetIn) { fUnpackerAlgo->SetTimeOffsetNs(dOffsetIn); }
1038//void CbmDeviceUnpackTofCri::SetDiamondDpbIdx(UInt_t uIdx) { fUnpackerAlgo->SetDiamondDpbIdx(uIdx); }
@ kNotExist
If not found.
static uint fiSelectComponents
std::shared_ptr< CbmTofUnpackConfig > fTofConfig
static Int_t iReportMess
Baseclass for the TrdR unpacker algorithms.
Configuration class for an unpacker algorithm.
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
std::vector< TH1 * > fhChCount
std::vector< Int_t > fviModuleId
virtual void BuildTint(uint64_t ulTsStartTime, int iMode=0)
std::vector< Bool_t > fvbChanThere
std::vector< ULong64_t > fvulCurrentEpoch
std::shared_ptr< CbmTofUnpackAlgo > fUnpackerAlgo
Processing algo.
std::vector< Int_t > fviNrOfRpc
void SetIgnoreOverlapMs(Bool_t bFlagIn=kTRUE)
Algo settings setters.
Int_t GetArrayIndex(Int_t gdpbId, Int_t get4Id)
std::vector< std::string > fAllowedChannels
CbmMcbm2018TofPar * fUnpackPar
std::vector< Int_t > fviRpcChUId
bool HandleMessage(FairMQMessagePtr &, int)
std::vector< std::vector< std::string > > fChannelsToSend
bool HandleParts(FairMQParts &, int)
std::vector< Int_t > fiReqDigiAddr
bool IsChannelNameAllowed(std::string channelName)
std::vector< TH2 * > fhRawTotCh
virtual bool SendDigis(std::vector< CbmTofDigi * >, int)
std::vector< TH2 * > fhChanCoinc
Int_t GetModuleId(Int_t i)
Int_t GetRpcSide(Int_t i)
Int_t GetNrOfGdpbs()
FIXME: replace with method returning the correspondign constants! see Star2019 parameter.
Int_t GetNrOfRpc(Int_t i)
Int_t GetRpcType(Int_t i)
Singleton buffer class for CBM raw data.
Double_t GetTimeLast() const
Data GetNextData(Double_t time)
Int_t GetSize() const
std::pair< boost::any, ECbmModuleId > Data
Double_t GetTimeFirst() const
void InsertData(Digi *digi)
static uint32_t GetUniqueAddress(uint32_t Sm, uint32_t Rpc, uint32_t Channel, uint32_t Side=0, uint32_t SmType=0, uint32_t RpcType=0)
Data class for expanded digital TOF information.
Definition CbmTofDigi.h:47
double GetSide() const
Channel Side.
Definition CbmTofDigi.h:160
double GetChannel() const
Channel .
Definition CbmTofDigi.h:156
int32_t GetAddress() const
Inherited from CbmDigi.
Definition CbmTofDigi.h:112
double GetSm() const
Sm.
Definition CbmTofDigi.h:144
double GetTime() const
Inherited from CbmDigi.
Definition CbmTofDigi.h:131
double GetType() const
Sm Type .
Definition CbmTofDigi.h:148
double GetRpc() const
Detector aka Module aka RPC .
Definition CbmTofDigi.h:152
double GetTot() const
Alias for GetCharge.
Definition CbmTofDigi.h:140
void SetTime(double time)
Definition CbmTofDigi.h:165
void ChangeState(FairMQDevice *device, cbm::mq::Transition transition)
Definition CbmMQDefs.h:26
void LogState(FairMQDevice *device)
Definition CbmMQDefs.h:47
Hash for CbmL1LinkKey.