CbmRoot
CbmDeviceUnpackTofMcbm2018.cxx
Go to the documentation of this file.
1 
9 #include "CbmMQDefs.h"
10 
11 #include "CbmDigi.h"
12 
13 #include "CbmMcbm2018TofPar.h"
15 //#include "CbmHistManager.h"
16 #include "CbmTbDaqBuffer.h"
17 #include "CbmTofAddress.h"
18 #include "CbmTofDetectorId_v14a.h" // in cbmdata/tof
19 #include "CbmTofDigi.h"
20 
21 #include "StorableTimeslice.hpp"
22 
23 #include "FairMQLogger.h"
24 #include "FairMQProgOptions.h" // device->fConfig
25 #include "FairParGenericSet.h"
26 #include "FairRuntimeDb.h"
27 
28 #include "TH1.h"
29 #include "TH2.h"
30 
31 #include <boost/archive/binary_iarchive.hpp>
32 #include <boost/archive/binary_oarchive.hpp>
33 
34 // include this header to serialize vectors
35 #include <boost/serialization/vector.hpp>
36 
37 #include <array>
38 #include <iomanip>
39 #include <string>
40 
41 #include <stdexcept>
42 struct InitTaskError : std::runtime_error {
43  using std::runtime_error::runtime_error;
44 };
45 
46 using namespace std;
47 
48 //static Int_t iMess=0;
49 const Int_t DetMask = 0x003FFFFF;
50 
52  : fNumMessages(0)
54  , fNumTint(0)
55  , fEventHeader()
56  , fiReqMode(0)
57  , fiReqTint(0)
58  , fiReqDigiAddr()
59  , fiPulserMode(0)
60  , fiPulMulMin(0)
61  , fiPulTotMin(0)
62  , fiPulTotMax(1000)
63  // , fAllowedChannels()
64  // , fChannelsToSend()
65  //, fuMsAcceptsPercent(100)
66  , fuTotalMsNb(0)
67  , fuOverlapMsNb(0)
68  , fuCoreMs(0)
69  , fdMsSizeInNs(0)
70  , fdTsCoreSizeInNs(0)
71  , fuMinNbGdpb(0)
72  //, fuCurrNbGdpb( 0 )
73  , fuNrOfGdpbs(0)
74  , fuNrOfFeePerGdpb(0)
75  , fuNrOfGet4PerFee(0)
76  , fuNrOfChannelsPerGet4(0)
77  , fuNrOfChannelsPerFee(0)
78  , fuNrOfGet4(0)
79  , fuNrOfGet4PerGdpb(0)
80  , fuNrOfChannelsPerGdpb(0)
81  , fuGdpbId(0)
82  , fuGdpbNr(0)
83  , fuGet4Id(0)
84  , fuGet4Nr(0)
85  //, fiEquipmentId(0)
86  , fMsgCounter(11, 0) // length of enum MessageTypes initialized with 0
87  , fGdpbIdIndexMap()
88  , fvulGdpbTsMsb()
89  , fvulGdpbTsLsb()
90  , fvulStarTsMsb()
91  , fvulStarTsMid()
92  , fvulGdpbTsFullLast()
93  , fvulStarTsFullLast()
94  , fvuStarTokenLast()
95  , fvuStarDaqCmdLast()
96  , fvuStarTrigCmdLast()
97  , fvulCurrentEpoch()
98  , fvbFirstEpochSeen()
99  , fNofEpochs(0)
100  , fulCurrentEpochTime(0.)
101  //, fdMsIndex(0.)
102  , fdTShiftRef(0.)
103  //, fuDiamondDpbIdx(3)
104  //, fbEpochSuppModeOn( kTRUE )
105  //, fbGet4M24b( kFALSE )
106  //, fbGet4v20( kTRUE )
107  //, fbMergedEpochsOn( kTRUE )
108  , fDigi(nullptr)
109  , fUnpackPar(nullptr)
110  //, fdRefTime(0.)
111  , fdLastDigiTime(0.)
112  , fdFirstDigiTimeDif(0.)
113  //, fdEvTime0(0.)
114  , fhRawTDigEvT0(nullptr)
115  , fhRawTDigRef0(nullptr)
116  , fhRawTDigRef(nullptr)
117  , fhRawTRefDig0(nullptr)
118  , fhRawTRefDig1(nullptr)
119  , fhRawDigiLastDigi(nullptr)
120  , fhRawTotCh()
121  , fhChCount()
122  , fvbChanThere()
123  , fhChanCoinc()
124  , fhDetChanCoinc(nullptr)
125  , fvuPadiToGet4()
126  , fvuGet4ToPadi()
127  , fvuElinkToGet4()
128  , fvuGet4ToElink()
129  , fviRpcType()
130  , fviModuleId()
131  , fviNrOfRpc()
132  , fviRpcSide()
133  , fviRpcChUId()
134  , fvmEpSupprBuffer()
135  , fBuffer(CbmTbDaqBuffer::Instance())
136  , fulGdpbTsMsb(0.)
137  , fulGdpbTsLsb(0.)
138  , fulStarTsMsb(0.)
139  , fulStarTsMid(0.)
140  , fulGdpbTsFullLast(0.)
141  , fulStarTsFullLast(0.)
142  , fuStarTokenLast(0)
143  , fuStarDaqCmdLast(0)
144  , fuStarTrigCmdLast(0)
145  , fUnpackerAlgo(nullptr) {
147 }
148 
150  delete fUnpackerAlgo;
151 }
152 
154  // Get the information about created channels from the device
155  // Check if the defined channels from the topology (by name)
156  // are in the list of channels which are possible/allowed
157  // for the device
158  // The idea is to check at initilization if the devices are
159  // properly connected. For the time beeing this is done with a
160  // nameing convention. It is not avoided that someone sends other
161  // data on this channel.
162  //logger::SetLogLevel("INFO");
163 
164  int noChannel = fChannels.size();
165  LOG(info) << "Number of defined channels: " << noChannel;
166  for (auto const& entry : fChannels) {
167  LOG(info) << "Channel name: " << entry.first;
168  if (!IsChannelNameAllowed(entry.first))
169  throw InitTaskError("Channel name does not match.");
170  if (entry.first == "syscmd") {
171  OnData(entry.first, &CbmDeviceUnpackTofMcbm2018::HandleMessage);
172  continue;
173  }
174  //if(entry.first != "tofdigis") OnData(entry.first, &CbmDeviceUnpackTofMcbm2018::HandleData);
175  if (entry.first != "tofdigis")
176  OnData(entry.first, &CbmDeviceUnpackTofMcbm2018::HandleParts);
177  else {
178  fChannelsToSend[0].push_back(entry.first);
179  LOG(info) << "Init to send data to channel " << fChannelsToSend[0][0];
180  }
181  }
182  InitContainers();
183  const Int_t iHeaderSize = 4;
184  fEventHeader.resize(iHeaderSize); // define size of eventheader int[]
185  for (int i = 0; i < iHeaderSize; i++)
186  fEventHeader[i] = 0;
187  fiSelectComponents = fConfig->GetValue<uint64_t>("SelectComponents");
188  fiReqMode = fConfig->GetValue<uint64_t>("ReqMode");
189  fiReqTint = fConfig->GetValue<uint64_t>("ReqTint");
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  fdTShiftRef = fConfig->GetValue<double_t>("TShiftRef");
195  // Int_t iMaxAsicInactive = fConfig->GetValue<uint64_t>("MaxAsicInactive");
196  // fUnpackerAlgo->SetMaxAsicInactive( iMaxAsicInactive );
197  Int_t iReqDet = 1;
198  Int_t iNReq = 0;
199  const Int_t iMaxReq = 36;
200 
201  while (iNReq < iMaxReq) { // FIXME, setup parameter hardwired!
202  iReqDet = fConfig->GetValue<uint64_t>(Form("ReqDet%d", iNReq));
203  if (iReqDet == 0) break;
204  AddReqDigiAddr(iReqDet);
205  iNReq++;
206  }
207 
208  if (fiReqMode > 0)
209  if (iNReq == 0) { // take all defined detectors
210  for (UInt_t iGbtx = 0; iGbtx < fviNrOfRpc.size(); iGbtx++) {
211  switch (fviRpcType[iGbtx]) {
212  case 0: // mTof modules
213  case 1: // eTof modules
214  if (iGbtx % 2 == 0)
215  for (Int_t iRpc = 0; iRpc < fviNrOfRpc[iGbtx]; iRpc++) {
216  Int_t iAddr = CbmTofAddress::GetUniqueAddress(
217  fviModuleId[iGbtx], iRpc, 0, 0, fviRpcType[iGbtx]);
218  AddReqDigiAddr(iAddr);
219  }
220  break;
221 
222  case 9: // HD 2-RPC boxes
223  for (Int_t iRpc = 0; iRpc < 2; iRpc++) {
224  Int_t iAddr = CbmTofAddress::GetUniqueAddress(
225  fviModuleId[iGbtx], iRpc, 0, 0, fviRpcType[iGbtx]);
226  AddReqDigiAddr(iAddr);
227  }
228  break;
229  case 6: // Buc box
230  for (Int_t iRpc = 0; iRpc < 2; iRpc++) {
231  Int_t iAddr = CbmTofAddress::GetUniqueAddress(
232  fviModuleId[iGbtx], iRpc, 0, 0, fviRpcType[iGbtx]);
233  AddReqDigiAddr(iAddr);
234  }
235  break;
236 
237  case 7: // CERN box
238  for (Int_t iRpc = 0; iRpc < 1; iRpc++) {
239  Int_t iAddr = CbmTofAddress::GetUniqueAddress(
240  fviModuleId[iGbtx], iRpc, 0, 0, 7);
241  AddReqDigiAddr(iAddr);
242  }
243  break;
244  case 8: // ceramics
245  for (Int_t iRpc = 0; iRpc < 8; iRpc++) {
246  Int_t iAddr = CbmTofAddress::GetUniqueAddress(
247  fviModuleId[iGbtx], iRpc, 0, 0, fviRpcType[iGbtx]);
248  AddReqDigiAddr(iAddr);
249  }
250  break;
251  case 5: // add Diamond, single cell RPC
252  Int_t iAddr =
253  CbmTofAddress::GetUniqueAddress(fviModuleId[iGbtx], 0, 0, 0, 5);
254  AddReqDigiAddr(iAddr);
255  break;
256  }
257  }
258  }
259 
260  LOG(info) << "ReqMode " << fiReqMode << " in " << fiReqTint << " ns "
261  << " with " << fiReqDigiAddr.size() << " detectors out of "
262  << fviNrOfRpc.size() << " GBTx, PulserMode " << fiPulserMode
263  << " with Mul " << fiPulMulMin << ", TotMin " << fiPulTotMin;
264 
265 } catch (InitTaskError& e) {
266  LOG(error) << e.what();
267  // Wrapper defined in CbmMQDefs.h to support different FairMQ versions
269 }
270 
272  for (auto const& entry : fAllowedChannels) {
273  LOG(info) << "Inspect " << entry;
274  std::size_t pos1 = channelName.find(entry);
275  if (pos1 != std::string::npos) {
276  const vector<std::string>::const_iterator pos =
277  std::find(fAllowedChannels.begin(), fAllowedChannels.end(), entry);
278  const vector<std::string>::size_type idx = pos - fAllowedChannels.begin();
279  LOG(info) << "Found " << entry << " in " << channelName;
280  LOG(info) << "Channel name " << channelName
281  << " found in list of allowed channel names at position "
282  << idx;
283  return true;
284  }
285  }
286  LOG(info) << "Channel name " << channelName
287  << " not found in list of allowed channel names.";
288  LOG(error) << "Stop device.";
289  return false;
290 }
291 
293  LOG(info) << "Init parameter containers for CbmDeviceUnpackTofMcbm2018.";
294  // FairRuntimeDb* fRtdb = FairRuntimeDb::instance();
295 
296  // NewSimpleMessage creates a copy of the data and takes care of its destruction (after the transfer takes place).
297  // Should only be used for small data because of the cost of an additional copy
298  std::string message {"CbmMcbm2018TofPar,111"};
299  LOG(info)
300  << "Requesting parameter container CbmMcbm2018TofPar, sending message: "
301  << message;
302 
303  FairMQMessagePtr req(NewSimpleMessage("CbmMcbm2018TofPar,111"));
304  FairMQMessagePtr rep(NewMessage());
305 
306  if (Send(req, "parameters") > 0) {
307  if (Receive(rep, "parameters") >= 0) {
308  if (rep->GetSize() != 0) {
309  CbmMQTMessage tmsg(rep->GetData(), rep->GetSize());
310  fUnpackPar =
311  dynamic_cast<CbmMcbm2018TofPar*>(tmsg.ReadObject(tmsg.GetClass()));
312  LOG(info) << "Received unpack parameter from parmq server: "
313  << fUnpackPar;
314  fUnpackPar->Print();
315  } else {
316  LOG(error) << "Received empty reply. Parameter not available";
317  }
318  }
319  }
320 
321 
323 
324  Bool_t initOK = kTRUE;
325  initOK &= fUnpackerAlgo->InitContainers();
326  initOK &= ReInitContainers(); // needed for TInt parameters
327 
328  // CreateHistograms();
329  initOK &= fUnpackerAlgo->CreateHistograms();
330 
333  fvbChanThere.resize(fviRpcChUId.size(), kFALSE);
334  for (UInt_t i = 0; i < fuNrOfGdpbs; ++i) {
335  for (UInt_t j = 0; j < fuNrOfGet4PerGdpb; ++j) {
337  fvbFirstEpochSeen[GetArrayIndex(i, j)] = kFALSE;
338  } // for( UInt_t j = 0; j < fuNrOfGet4PerGdpb; ++j )
339  } // for( UInt_t i = 0; i < fuNrOfGdpbs; ++i )
340 
341  fNumTint = 0;
342  return initOK;
343 }
344 
346  FairRuntimeDb* fRtdb = FairRuntimeDb::instance();
347 
348  TList* fParCList = fUnpackerAlgo->GetParList();
349 
350  LOG(info) << "Setting parameter containers for " << fParCList->GetEntries()
351  << " entries ";
352 
353  for (Int_t iparC = 0; iparC < fParCList->GetEntries(); ++iparC) {
354  FairParGenericSet* tempObj = (FairParGenericSet*) (fParCList->At(iparC));
355  fParCList->Remove(tempObj);
356 
357  std::string sParamName {tempObj->GetName()};
358 
359  FairParGenericSet* newObj =
360  dynamic_cast<FairParGenericSet*>(fRtdb->getContainer(sParamName.data()));
361  LOG(info) << " - Get " << sParamName.data() << " at " << newObj;
362  if (nullptr == newObj) {
363 
364  LOG(error) << "Failed to obtain parameter container " << sParamName
365  << ", for parameter index " << iparC;
366  return;
367  } // if( nullptr == newObj )
368  if (iparC == 0) {
369  newObj = (FairParGenericSet*) fUnpackPar;
370  LOG(info) << " - Mod " << sParamName.data() << " to " << newObj;
371  }
372  fParCList->AddAt(newObj, iparC);
373  // delete tempObj;
374  } // for( Int_t iparC = 0; iparC < fParCList->GetEntries(); ++iparC )
375 }
376 
378  UShort_t usDetectorId) {
379  fUnpackerAlgo->AddMsComponentToList(component, usDetectorId);
380 }
381 
383  LOG(info) << "ReInit parameter containers for CbmDeviceUnpackMcbm2018TofPar.";
384 
386  LOG(info) << "Nr. of Tof GDPBs: " << fuNrOfGdpbs;
388 
390  LOG(info) << "Nr. of FEES per Tof GDPB: " << fuNrOfFeePerGdpb;
391 
393  LOG(info) << "Nr. of GET4 per Tof FEE: " << fuNrOfGet4PerFee;
394 
396  LOG(info) << "Nr. of channels per GET4: " << fuNrOfChannelsPerGet4;
397 
399  LOG(info) << "Nr. of channels per FEE: " << fuNrOfChannelsPerFee;
400 
402  LOG(info) << "Nr. of GET4s: " << fuNrOfGet4;
403 
405  LOG(info) << "Nr. of GET4s per GDPB: " << fuNrOfGet4PerGdpb;
406 
408  LOG(info) << "Nr. of channels per GDPB: " << fuNrOfChannelsPerGdpb;
409 
410  fGdpbIdIndexMap.clear();
411  for (UInt_t i = 0; i < fuNrOfGdpbs; ++i) {
413  LOG(info) << "GDPB Id of TOF " << i << " : " << std::hex
414  << fUnpackPar->GetGdpbId(i);
415  } // for( UInt_t i = 0; i < fuNrOfGdpbs; ++i )
416 
422  LOG(info) << "Timeslice parameters: " << fuTotalMsNb
423  << " MS per link, of which " << fuOverlapMsNb
424  << " overlap MS, each MS is " << fdMsSizeInNs << " ns";
425 
427  fvulGdpbTsMsb.resize(fuNrOfGdpbs);
428  fvulGdpbTsLsb.resize(fuNrOfGdpbs);
429  fvulStarTsMsb.resize(fuNrOfGdpbs);
430  fvulStarTsMid.resize(fuNrOfGdpbs);
436  for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb) {
437  fvulGdpbTsMsb[uGdpb] = 0;
438  fvulGdpbTsLsb[uGdpb] = 0;
439  fvulStarTsMsb[uGdpb] = 0;
440  fvulStarTsMid[uGdpb] = 0;
441  fvulGdpbTsFullLast[uGdpb] = 0;
442  fvulStarTsFullLast[uGdpb] = 0;
443  fvuStarTokenLast[uGdpb] = 0;
444  fvuStarDaqCmdLast[uGdpb] = 0;
445  fvuStarTrigCmdLast[uGdpb] = 0;
446  } // for (Int_t iGdpb = 0; iGdpb < fuNrOfGdpbs; ++iGdpb)
447 
449 
450 
454  /* source: Monitor
455  UInt_t uGet4topadi[32] = {
456  4, 3, 2, 1, // provided by Jochen
457  24, 23, 22, 21,
458  8, 7, 6, 5,
459  28, 27, 26, 25,
460  12, 11, 10, 9,
461  32, 31, 30, 29,
462  16, 15, 14, 13,
463  20, 19, 18, 17 };
464  */
465 
466  UInt_t uGet4topadi[32] = {4, 3, 2, 1, // provided by Jochen
467  8, 7, 6, 5, 12, 11, 10, 9, 16, 15,
468  14, 13, 20, 19, 18, 17, 24, 23, 22, 21,
469  28, 27, 26, 25, 32, 31, 30, 29};
470 
471  UInt_t uPaditoget4[32] = {4, 3, 2, 1, // provided by Jochen
472  12, 11, 10, 9, 20, 19, 18, 17, 28, 27,
473  26, 25, 32, 31, 30, 29, 8, 7, 6, 5,
474  16, 15, 14, 13, 24, 23, 22, 21};
475 
476  for (UInt_t uChan = 0; uChan < fuNrOfChannelsPerFee; ++uChan) {
477  fvuPadiToGet4[uChan] = uPaditoget4[uChan] - 1;
478  fvuGet4ToPadi[uChan] = uGet4topadi[uChan] - 1;
479  } // for( UInt_t uChan = 0; uChan < fuNrOfChannelsPerFee; ++uChan )
480 
484  UInt_t kuElinkToGet4[kuNbGet4PerGbtx] = {
485  27, 2, 7, 3, 31, 26, 30, 1, 33, 37, 32, 13, 9, 14,
486  10, 15, 17, 21, 16, 35, 34, 38, 25, 24, 0, 6, 20, 23,
487  18, 22, 28, 4, 29, 5, 19, 36, 39, 8, 12, 11};
488  UInt_t kuGet4ToElink[kuNbGet4PerGbtx] = {
489  24, 7, 1, 3, 31, 33, 25, 2, 37, 12, 14, 39, 38, 11,
490  13, 15, 18, 16, 28, 34, 26, 17, 29, 27, 23, 22, 5, 0,
491  30, 32, 6, 4, 10, 8, 20, 19, 35, 9, 21, 36};
492  for (UInt_t uLinkAsic = 0; uLinkAsic < kuNbGet4PerGbtx; ++uLinkAsic) {
493  fvuElinkToGet4[uLinkAsic] = kuElinkToGet4[uLinkAsic];
494  fvuGet4ToElink[uLinkAsic] = kuGet4ToElink[uLinkAsic];
495  } // for( UInt_t uChan = 0; uChan < fuNrOfChannelsPerFee; ++uChan )
496 
497  UInt_t uNrOfGbtx = fUnpackPar->GetNrOfGbtx();
498  fviRpcType.resize(uNrOfGbtx);
499  fviModuleId.resize(uNrOfGbtx);
500  fviNrOfRpc.resize(uNrOfGbtx);
501  fviRpcSide.resize(uNrOfGbtx);
502 
503  for (UInt_t iGbtx = 0; iGbtx < uNrOfGbtx; ++iGbtx) {
504  fviNrOfRpc[iGbtx] = fUnpackPar->GetNrOfRpc(iGbtx);
505  fviRpcType[iGbtx] = fUnpackPar->GetRpcType(iGbtx);
506  fviRpcSide[iGbtx] = fUnpackPar->GetRpcSide(iGbtx);
507  fviModuleId[iGbtx] = fUnpackPar->GetModuleId(iGbtx);
508  }
509 
510  UInt_t uNrOfChannels = fuNrOfGet4 * fuNrOfChannelsPerGet4;
511  LOG(info) << "Nr. of possible Tof channels: " << uNrOfChannels;
512 
513  // CbmTofDetectorId* fTofId = new CbmTofDetectorId_v14a();
514  fviRpcChUId.resize(uNrOfChannels);
515  UInt_t iCh = 0;
516  for (UInt_t iGbtx = 0; iGbtx < uNrOfGbtx; iGbtx++) {
517  switch (fviRpcType[iGbtx]) {
518 
519  case 0: // CBM modules
520  if (fviRpcSide[iGbtx] < 2) { // mTof modules
521  const Int_t RpcMap[5] = {4, 2, 0, 3, 1};
522  for (Int_t iRpc = 0; iRpc < fviNrOfRpc[iGbtx]; iRpc++) {
523  Int_t iStrMax = 32;
524  Int_t iChNext = 1;
525 
526  for (Int_t iStr = 0; iStr < iStrMax; iStr++) {
527  Int_t iStrMap = iStr;
528  Int_t iRpcMap = RpcMap[iRpc];
529 
530  if (fviRpcSide[iGbtx] == 0) iStrMap = 31 - iStr;
531  if (fviModuleId[iGbtx] > -1)
532  fviRpcChUId[iCh] =
534  iRpcMap,
535  iStrMap,
536  fviRpcSide[iGbtx],
537  fviRpcType[iGbtx]);
538  else
539  fviRpcChUId[iCh] = 0;
540  // LOG(debug)<<Form("Map Ch %d to Address 0x%08x",iCh,fviRpcChUId[iCh]);
541 
542  iCh += iChNext;
543  }
544  }
545  }
546  break;
547 
548 
549  case 1: // STAR eTOF modules
550  if (fviRpcSide[iGbtx] < 2) { // mTof modules
551  const Int_t RpcMap[3] = {0, 1, 2};
552  for (Int_t iRpc = 0; iRpc < fviNrOfRpc[iGbtx]; iRpc++) {
553  Int_t iStrMax = 32;
554  Int_t iChNext = 1;
555 
556  for (Int_t iStr = 0; iStr < iStrMax; iStr++) {
557  Int_t iStrMap = iStr;
558  Int_t iRpcMap = RpcMap[iRpc];
559 
560  if (fviRpcSide[iGbtx] == 0) iStrMap = 31 - iStr;
561  if (fviModuleId[iGbtx] > -1)
562  fviRpcChUId[iCh] =
564  iRpcMap,
565  iStrMap,
566  fviRpcSide[iGbtx],
567  fviRpcType[iGbtx]);
568  else
569  fviRpcChUId[iCh] = 0;
570  // LOG(DEBUG)<<Form("Map Ch %d to Address 0x%08x",iCh,fviRpcChUId[iCh]);
571  iCh += iChNext;
572  }
573  }
574  }
575  iCh += 64;
576  break;
577 
578  case 5: // Diamond
579  {
580  LOG(info) << " Map diamond at GBTX - iCh = " << iCh;
581  for (UInt_t uFee = 0; uFee < fUnpackPar->GetNrOfFeePerGbtx(); ++uFee) {
582  for (UInt_t uCh = 0; uCh < fUnpackPar->GetNrOfChannelsPerFee();
583  ++uCh) {
584  if (uFee < 4 && (0 == uCh % 4 || uCh < 4)) {
585  // if( 0 == uCh ) {
587  fviModuleId[iGbtx],
588  0,
589  uFee * fUnpackPar->GetNrOfChannelsPerFee() / 4 + uCh / 4
590  + 40 * fviRpcSide[iGbtx],
591  // 0, uFee + 10 * fviRpcSide[iGbtx],
592  0,
593  fviRpcType[iGbtx]);
594  LOG(info) << Form(
595  "Map T0 Ch %d to Address 0x%08x", iCh, fviRpcChUId[iCh]);
596  } else
597  fviRpcChUId[iCh] = 0;
598 
599  iCh++;
600  } // for( UInt_t uCh = 0; uCh < fUnpackPar->GetNrOfChannelsPerFee(); ++uCh )
601  } // for( UInt_t uFee = 0; uFee < fUnpackPar->GetNrOfFeePerGbtx(); ++uFee )
602  } break;
603 
604  case 78: // cern-20-gap + ceramic module
605  {
606  LOG(info) << " Map CERN 20 gap at GBTX - iCh = " << iCh;
607  const Int_t StrMap[32] = {0, 1, 2, 3, 4, 31, 5, 6, 7, 30, 8,
608  9, 10, 29, 11, 12, 13, 14, 28, 15, 16, 17,
609  18, 27, 26, 25, 24, 23, 22, 21, 20, 19};
610  Int_t iModuleId = 0;
611  Int_t iModuleType = 7;
612  Int_t iRpcMap = 0;
613  for (Int_t iFeet = 0; iFeet < 2; iFeet++) {
614  for (Int_t iStr = 0; iStr < 32; iStr++) {
615  Int_t iStrMap = 31 - 12 - StrMap[iStr];
616  Int_t iSideMap = iFeet;
617 
618  if (iStrMap < 20)
620  iModuleId, iRpcMap, iStrMap, iSideMap, iModuleType);
621  else
622  fviRpcChUId[iCh] = 0;
623  iCh++;
624  }
625  }
626  }
627  // fall through is intended
628  case 8: // ceramics
629  {
630  Int_t iModuleId = 0;
631  Int_t iModuleType = 8;
632  for (Int_t iRpc = 0; iRpc < 8; iRpc++) {
634  iModuleId, 7 - iRpc, 0, 0, iModuleType);
635  iCh++;
636  }
637  iCh += (24 + 2 * 32);
638  }
639  LOG(info) << " Map end ceramics box at GBTX - iCh = " << iCh;
640 
641  break;
642 
643  case 9: // Star2 boxes
644  {
645  LOG(info) << " Map Star2 box at GBTX - iCh = " << iCh;
646  const Int_t iRpc[5] = {1, -1, 1, 0, 0};
647  const Int_t iSide[5] = {1, -1, 0, 1, 0};
648  for (Int_t iFeet = 0; iFeet < 5; iFeet++) {
649  for (Int_t iStr = 0; iStr < 32; iStr++) {
650  Int_t iStrMap = iStr;
651  Int_t iRpcMap = iRpc[iFeet];
652  Int_t iSideMap = iSide[iFeet];
653  if (iSideMap == 0) iStrMap = 31 - iStr;
654  if (iSideMap > -1)
655  fviRpcChUId[iCh] =
657  iRpcMap,
658  iStrMap,
659  iSideMap,
660  fviRpcType[iGbtx]);
661  else
662  fviRpcChUId[iCh] = 0;
663 
664  iCh++;
665  }
666  }
667  } break;
668 
669  case 6: // Buc box
670  {
671  LOG(info) << " Map Buc box at GBTX - iCh = " << iCh;
672  const Int_t iRpc[5] = {0, -1, 0, 1, 1};
673  const Int_t iSide[5] = {1, -1, 0, 1, 0};
674  for (Int_t iFeet = 0; iFeet < 5; iFeet++) {
675  for (Int_t iStr = 0; iStr < 32; iStr++) {
676  Int_t iStrMap = iStr;
677  Int_t iRpcMap = iRpc[iFeet];
678  Int_t iSideMap = iSide[iFeet];
679  //if(iSideMap == 0)iStrMap=31-iStr;
680  switch (fviRpcSide[iGbtx]) {
681  case 0:; break;
682  case 1: // HD cosmic 2019, Buc2018, v18n
683  iStrMap = 31 - iStr;
684  iRpcMap = 1 - iRpcMap;
685  break;
686  case 2: // v18m_cosmicHD
687  // iStrMap=31-iStr;
688  iSideMap = 1 - iSideMap;
689  break;
690  case 3:
691  iStrMap = 31 - iStr;
692  iRpcMap = 1 - iRpcMap;
693  iSideMap = 1 - iSideMap;
694  break;
695  case 4: // HD cosmic 2019, Buc2018, v18o
696  iRpcMap = 1 - iRpcMap;
697  break;
698  default:;
699  }
700  if (iSideMap > -1)
701  fviRpcChUId[iCh] =
703  iRpcMap,
704  iStrMap,
705  iSideMap,
706  fviRpcType[iGbtx]);
707  else
708  fviRpcChUId[iCh] = 0;
709 
710  iCh++;
711  }
712  }
713  } break;
714 
715  case -1:
716  LOG(info) << " Found unused GBTX link at iCh = " << iCh;
717  iCh += 160;
718  break;
719 
720  default:
721  LOG(error) << "Invalid Type specifier for Gbtx " << iGbtx << ": "
722  << fviRpcType[iGbtx];
723  }
724  }
725 
726  for (UInt_t i = 0; i < uNrOfChannels; i = i + 8) {
727  if (i % 64 == 0) LOG(info) << " Index " << i;
728  LOG(info) << Form("0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x",
729  fviRpcChUId[i],
730  fviRpcChUId[i + 1],
731  fviRpcChUId[i + 2],
732  fviRpcChUId[i + 3],
733  fviRpcChUId[i + 4],
734  fviRpcChUId[i + 5],
735  fviRpcChUId[i + 6],
736  fviRpcChUId[i + 7]);
737  } // for( UInt_t i = 0; i < uNrOfChannels; ++i)
738 
739  return kTRUE;
740 }
741 
743  LOG(info) << "create Histos for " << fuNrOfGdpbs << " gDPBs ";
744 
745  fhRawTDigEvT0 =
746  new TH1F(Form("Raw_TDig-EvT0"),
747  Form("Raw digi time difference to 1st digi ; time [ns]; cts"),
748  500,
749  0,
750  100.);
751  // fHM->Add( Form("Raw_TDig-EvT0"), fhRawTDigEvT0);
752 
753  fhRawTDigRef0 =
754  new TH1F(Form("Raw_TDig-Ref0"),
755  Form("Raw digi time difference to Ref ; time [ns]; cts"),
756  6000,
757  -10000,
758  50000);
759  // fHM->Add( Form("Raw_TDig-Ref0"), fhRawTDigRef0);
760 
761  fhRawTDigRef =
762  new TH1F(Form("Raw_TDig-Ref"),
763  Form("Raw digi time difference to Ref ; time [ns]; cts"),
764  6000,
765  -1000,
766  5000);
767  // fHM->Add( Form("Raw_TDig-Ref"), fhRawTDigRef);
768 
769  fhRawTRefDig0 =
770  new TH1F(Form("Raw_TRef-Dig0"),
771  Form("Raw Ref time difference to last digi ; time [ns]; cts"),
772  9999,
773  -50000,
774  50000);
775  // fHM->Add( Form("Raw_TRef-Dig0"), fhRawTRefDig0);
776 
777  fhRawTRefDig1 =
778  new TH1F(Form("Raw_TRef-Dig1"),
779  Form("Raw Ref time difference to last digi ; time [ns]; cts"),
780  9999,
781  -5000,
782  5000);
783  // fHM->Add( Form("Raw_TRef-Dig1"), fhRawTRefDig1);
784 
786  new TH1F(Form("Raw_Digi-LastDigi"),
787  Form("Raw Digi time difference to last digi ; time [ns]; cts"),
788  9999,
789  -5000,
790  5000);
791  // 9999, -5000000, 5000000);
792  // fHM->Add( Form("Raw_Digi-LastDigi"), fhRawDigiLastDigi);
793 
794  fhRawTotCh.resize(fuNrOfGdpbs);
795  fhChCount.resize(fuNrOfGdpbs);
797  for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; uGdpb++) {
798  fhRawTotCh[uGdpb] =
799  new TH2F(Form("Raw_Tot_gDPB_%02u", uGdpb),
800  Form("Raw TOT gDPB %02u; channel; TOT [bin]", uGdpb),
802  0.,
804  256,
805  0.,
806  256.);
807  // fHM->Add( Form("Raw_Tot_gDPB_%02u", uGdpb), fhRawTotCh[ uGdpb ]);
808 
809  fhChCount[uGdpb] =
810  new TH1I(Form("ChCount_gDPB_%02u", uGdpb),
811  Form("Channel counts gDPB %02u; channel; Hits", uGdpb),
813  0.,
815  // fHM->Add( Form("ChCount_gDPB_%02u", uGdpb), fhChCount[ uGdpb ]);
816  /*
817  for( UInt_t uLeftFeb = uGdpb*fuNrOfFebsPerGdpb / 2;
818  uLeftFeb < (uGdpb + 1 )*fuNrOfFebsPerGdpb / 2;
819  ++uLeftFeb )
820  {
821  fhChanCoinc[ uLeftFeb ] = new TH2F( Form("fhChanCoinc_%02u", uLeftFeb),
822  Form("Channels Coincidence %02; Left; Right", uLeftFeb),
823  fuNrOfChannelsPerFee, 0., fuNrOfChannelsPerFee,
824  fuNrOfChannelsPerFee, 0., fuNrOfChannelsPerFee );
825  } // for( UInt_t uLeftFeb = 0; uLeftFeb < fuNrOfFebsPerGdpb / 2; uLeftFeb ++ )
826  */
827  fhChanCoinc[uGdpb] =
828  new TH2F(Form("fhChanCoinc_%02u", uGdpb),
829  Form("Channels Coincidence %02u; Left; Right", uGdpb),
831  0.,
834  0.,
836  } // for( UInt_t uGdpb = 0; uGdpb < fuMinNbGdpb; uGdpb ++)
837  fhDetChanCoinc = new TH2F("fhDetChanCoinc",
838  "Det Channels Coincidence; Left; Right",
839  32,
840  0.,
841  32,
842  32,
843  0.,
844  32);
845 }
846 
847 // handler is called whenever a message arrives on "data", with a reference to the message and a sub-channel index (here 0)
848 bool CbmDeviceUnpackTofMcbm2018::HandleData(FairMQMessagePtr& msg,
849  int /*index*/) {
850  // Don't do anything with the data
851  // Maybe add an message counter which counts the incomming messages and add
852  // an output
853  fNumMessages++;
854  LOG(debug) << "Received message number " << fNumMessages << " with size "
855  << msg->GetSize();
856 
857  std::string msgStr(static_cast<char*>(msg->GetData()), msg->GetSize());
858  std::istringstream iss(msgStr);
859  boost::archive::binary_iarchive inputArchive(iss);
860 
861  fles::StorableTimeslice component {0};
862  inputArchive >> component;
863 
864  CheckTimeslice(component);
865 
866  DoUnpack(component, 0);
867 
868  BuildTint(0);
869 
870  if (fNumMessages % 10000 == 0)
871  LOG(info) << "Processed " << fNumMessages << " time slices";
872 
873  return true;
874 }
875 
877  int /*index*/) {
878  // Don't do anything with the data
879  // Maybe add an message counter which counts the incomming messages and add
880  // an output
881  fNumMessages++;
882  LOG(debug) << "Received message number " << fNumMessages << " with "
883  << parts.Size() << " parts";
884 
885  fles::StorableTimeslice ts {0};
886 
887  switch (fiSelectComponents) {
888  case 0: {
889  std::string msgStr(static_cast<char*>(parts.At(0)->GetData()),
890  (parts.At(0))->GetSize());
891  std::istringstream iss(msgStr);
892  boost::archive::binary_iarchive inputArchive(iss);
893  inputArchive >> ts;
894  CheckTimeslice(ts);
895  if (1 == fNumMessages) {
896  LOG(info) << "Initialize TS components list to " << ts.num_components();
897  for (size_t c {0}; c < ts.num_components(); c++) {
898  auto systemID = static_cast<int>(ts.descriptor(c, 0).sys_id);
899  LOG(info) << "Found systemID: " << std::hex << systemID << std::dec;
900  fUnpackerAlgo->AddMsComponentToList(c, systemID); // TOF data
901  }
902  }
903  DoUnpack(ts, 0);
904  } break;
905  case 1: {
906  fles::StorableTimeslice component {0};
907 
908  uint ncomp = parts.Size();
909  for (uint i = 0; i < ncomp; i++) {
910  std::string msgStr(static_cast<char*>(parts.At(i)->GetData()),
911  (parts.At(i))->GetSize());
912  std::istringstream iss(msgStr);
913  boost::archive::binary_iarchive inputArchive(iss);
914  //fles::StorableTimeslice component{i};
915  inputArchive >> component;
916 
917  CheckTimeslice(component);
918  fUnpackerAlgo->AddMsComponentToList(0, 0x60); // TOF data
919  LOG(debug) << "HandleParts message " << fNumMessages << " with indx "
920  << component.index();
921  DoUnpack(component, 0);
922  }
923  } break;
924  default:;
925  }
926 
927  BuildTint(0);
928 
929  if (fNumMessages % 10000 == 0)
930  LOG(info) << "Processed " << fNumMessages << " time slices";
931 
932  return true;
933 }
934 
935 bool CbmDeviceUnpackTofMcbm2018::HandleMessage(FairMQMessagePtr& msg,
936  int /*index*/) {
937  const char* cmd = (char*) (msg->GetData());
938  const char cmda[4] = {*cmd};
939  LOG(info) << "Handle message " << cmd << ", " << cmd[0];
940  cbm::mq::LogState(this);
941 
942  // only one implemented so far "Stop"
943 
944  if (strcmp(cmda, "STOP")) {
945  LOG(info) << "STOP";
947  cbm::mq::LogState(this);
949  cbm::mq::LogState(this);
951  cbm::mq::LogState(this);
953  cbm::mq::LogState(this);
954  }
955  return true;
956 }
957 
958 Bool_t CbmDeviceUnpackTofMcbm2018::DoUnpack(const fles::Timeslice& ts,
959  size_t component) {
960  LOG(debug) << "Timeslice " << ts.index() << " contains "
961  << ts.num_microslices(component) << " microslices of component "
962  << component;
963 
964  if (kFALSE == fUnpackerAlgo->ProcessTs(ts)) {
965  LOG(error) << "Failed processing TS " << ts.index()
966  << " in unpacker algorithm class";
967  return kTRUE;
968  } // if( kFALSE == fUnpackerAlgo->ProcessTs( ts ) )
969 
971  std::vector<CbmTofDigi> vDigi = fUnpackerAlgo->GetVector();
972 
973  /*
974  // time sort vDigis
975  sort(vDigi.begin(), vDigi.end(),
976  [](const CbmTofDigi & a, const CbmTofDigi & b) -> bool
977  {
978  return a.GetTime() < b.GetTime();
979  });
980  */
981 
982  LOG(debug) << "Insert " << vDigi.size()
983  << " digis into DAQ buffer with size " << fBuffer->GetSize();
984 
985  for (auto digi : vDigi) {
986  // copy Digi for insertion into DAQ buffer
987  fDigi = new CbmTofDigi(digi);
988 
989  LOG(debug) << "BufferInsert digi "
990  << Form(
991  "0x%08x at %012.2f", fDigi->GetAddress(), fDigi->GetTime())
992  << Form(", first %012.2f, last %012.2f, size %u",
993  fBuffer->GetTimeFirst(),
994  fBuffer->GetTimeLast(),
995  fBuffer->GetSize());
996 
997  fBuffer->InsertData<CbmTofDigi>(fDigi);
998  }
999  vDigi.clear();
1001 
1002  return kTRUE;
1003 }
1004 
1005 static Int_t iErrorMess = 0;
1006 static Int_t iWarnMess = 0;
1007 
1008 
1010  UInt_t uChannel = mess.getGdpbHitChanId(); // Get4 channel nr
1011  UInt_t uTot = mess.getGdpbHit32Tot();
1012  // UInt_t uFts = mess.getGdpbHitFineTs();
1013 
1014  ULong_t ulCurEpochGdpbGet4 = fvulCurrentEpoch[fuGet4Nr];
1015 
1016  // In Ep. Suppr. Mode, receive following epoch instead of previous
1017  if (0 < ulCurEpochGdpbGet4)
1018  ulCurEpochGdpbGet4--;
1019  else
1020  ulCurEpochGdpbGet4 = gdpbv100::kuEpochCounterSz; // Catch epoch cycle!
1021 
1022  UInt_t uChannelNr = fuGet4Id * fuNrOfChannelsPerGet4 + uChannel;
1023  UInt_t uChannelNrInFee =
1025  UInt_t uFeeNr = (fuGet4Id / fuNrOfGet4PerFee);
1026  UInt_t uFeeNrInSys = fuGdpbNr * fuNrOfFeePerGdpb + uFeeNr;
1027  UInt_t uGbtxNr = (uFeeNr / kuNbFeePerGbtx);
1028  // UInt_t uFeeInGbtx = (uFeeNr % kuNbFeePerGbtx);
1029  UInt_t uGbtxNrInSys = fuGdpbNr * kuNbGbtxPerGdpb + uGbtxNr;
1030  UInt_t uRemappedChannelNr = fuGdpbNr * fuNrOfChannelsPerGdpb
1031  + uFeeNr * fuNrOfChannelsPerFee
1032  + fvuGet4ToPadi[uChannelNrInFee];
1034  if (fviRpcType[uGbtxNrInSys] == 5) {
1035  uRemappedChannelNr = fuGdpbNr * fuNrOfChannelsPerGdpb + uChannelNr;
1036  }
1037  /*
1038  UInt_t uRemappedChannelNr = fuGdpbNr * fuNrOfChannelsPerGdpb +
1039  + ( fviRpcType[uGbtxNrInSys]==5 ? uChannelNr // Diamond
1040  : uFeeNr * fuNrOfChannelsPerFee +fvuGet4ToPadi[ uChannelNrInFee ] );
1041  */
1042  // + ( fviRpcType[uGbtxNrInSys]==5 ? uChannelNrInFee : fvuGet4ToPadi[ uChannelNrInFee ] );
1043  // UInt_t uRemappedChannelNr = uFeeNr * fuNrOfChannelsPerFee + uChannelNrInFee;
1044  /*
1045  if( fuGdpbNr==2)
1046  LOG(info)<<" Fill Hit GdpbNr" << fuGdpbNr
1047  <<", ChNr "<<uChannelNr<<", CIF "<< uChannelNrInFee
1048  <<", FNr "<<uFeeNr<<", FIS "<<uFeeNrInSys
1049  <<", GbtxNr "<<uGbtxNr
1050  <<", Remap "<<uRemappedChannelNr;
1051  */
1052  // ULong_t ulHitTime = mess.getMsgFullTime(ulCurEpochGdpbGet4);
1053  Double_t dHitTime = mess.getMsgFullTimeD(ulCurEpochGdpbGet4);
1054 
1055  // uFts = mess.getGdpbHitFullTs() % 112;
1056 
1057  if (kTRUE == fvbFirstEpochSeen[fuGet4Nr]) {
1058  Double_t dHitTot = uTot; // in bins
1059 
1060  //if( fUnpackPar->GetNumberOfChannels() < uRemappedChannelNr )
1061  if (fviRpcChUId.size() < uRemappedChannelNr) {
1062  if (iErrorMess++ < 10000) {
1063  LOG(error) << "Invalid mapping index " << uRemappedChannelNr << " vs "
1064  << fviRpcChUId.size() << ", from GdpbNr " << fuGdpbNr
1065  << ", Get4 " << fuGet4Id << ", Ch " << uChannel << ", ChNr "
1066  << uChannelNr << ", ChNrIF " << uChannelNrInFee << ", FiS "
1067  << uFeeNrInSys;
1068  return;
1069  } else
1070  LOG(error) << "Max number of error messages reached ";
1071 
1072  } // if( fUnpackPar->GetNumberOfChannels() < uChanUId )
1073 
1074  fvbChanThere[uRemappedChannelNr] = kTRUE;
1075 
1076  // UInt_t uChanUId = fUnpackPar->GetChannelToDetUIdMap( uRemappedChannelNr );
1077  UInt_t uChanUId = fviRpcChUId[uRemappedChannelNr];
1078  if (0 == uChanUId) {
1079  if (iWarnMess++ < 1000) {
1080  LOG(warn) << "Invalid ChanUId for " << uRemappedChannelNr << ", ChOff "
1082  + uFeeNr * fuNrOfChannelsPerFee
1083  << ", ChIF "
1084  << (fviRpcType[uGbtxNrInSys] == 5
1085  ? uChannelNrInFee
1086  : fvuGet4ToPadi[uChannelNrInFee])
1087  << ", GdpbNr " << fuGdpbNr << ", GbtxNr " << uGbtxNrInSys
1088  << ", Get4 " << fuGet4Id << ", Ch " << uChannel << ", ChNr "
1089  << uChannelNr << ", ChNrIF " << uChannelNrInFee << ", FiS "
1090  << uFeeNrInSys;
1091  } else {
1092  if (iWarnMess == 1000)
1093  LOG(warn) << "No more messages. Fix your mapping problem!";
1094  //FairMQStateMachine::ChangeState(PAUSE);
1095  }
1096  return; // Hit not mapped to digi
1097  }
1098  if ((uChanUId & DetMask) == 0x00005006) dHitTime += fdTShiftRef;
1099  fdLastDigiTime = dHitTime;
1100 
1101  LOG(debug) << Form("Insert 0x%08x digi with time ", uChanUId) << dHitTime
1102  << Form(", Tot %4.0f", dHitTot) << " into buffer with "
1103  << fBuffer->GetSize() << " data from "
1104  << Form("%11.1f to %11.1f ",
1105  fBuffer->GetTimeFirst(),
1106  fBuffer->GetTimeLast())
1107  << " at epoch " << ulCurEpochGdpbGet4;
1108 
1109  fDigi = new CbmTofDigi(uChanUId, dHitTime, dHitTot);
1110 
1111  fBuffer->InsertData<CbmTofDigi>(fDigi);
1112 
1113  // Histograms filling
1114  // fhRawTotCh[ fuGdpbNr ]->Fill( uRemappedChannelNr, dHitTot);
1115  // fhChCount[ fuGdpbNr ] ->Fill( uRemappedChannelNr );
1116  // for debugging
1117  if (0) {
1118  if (fuGdpbNr == 2) {
1119  LOG(info) << Form(
1120  "Insert 0x%08x digi at %d with time ", uChanUId, uRemappedChannelNr)
1121  << dHitTime << Form(", Tot %4.0f", dHitTot);
1122  }
1123  }
1124 
1125  } // if( kTRUE == fvbFirstEpochSeen[ fuGet4Nr ] )
1126 }
1127 
1128 
1130  ULong64_t ulEpochNr = mess.getGdpbEpEpochNb();
1131 
1132  //LOG(debug) << "Get4Nr "<<fuGet4Nr<< " in epoch "<<ulEpochNr;
1133 
1134  fvulCurrentEpoch[fuGet4Nr] = ulEpochNr;
1135 
1136  if (kFALSE == fvbFirstEpochSeen[fuGet4Nr])
1137  fvbFirstEpochSeen[fuGet4Nr] = kTRUE;
1138 
1139  fulCurrentEpochTime = mess.getMsgFullTime(ulEpochNr);
1140  fNofEpochs++;
1141 
1145  if (0 < ulEpochNr)
1146  mess.setGdpbEpEpochNb(ulEpochNr - 1);
1147  else
1149 
1150  Int_t iBufferSize = fvmEpSupprBuffer[fuGet4Nr].size();
1151  if (0 < iBufferSize) {
1152  LOG(debug) << "Now processing " << iBufferSize
1153  << " stored messages for get4 " << fuGet4Nr
1154  << " with epoch number " << (fvulCurrentEpoch[fuGet4Nr] - 1);
1155  const Int_t MaxBufferSize = 1000; // FIXME: hardwired setup parameter
1156  if (iBufferSize < MaxBufferSize) {
1159  std::stable_sort(fvmEpSupprBuffer[fuGet4Nr].begin(),
1160  fvmEpSupprBuffer[fuGet4Nr].begin());
1161 
1162  for (Int_t iMsgIdx = 0; iMsgIdx < iBufferSize; iMsgIdx++) {
1164  } // for( Int_t iMsgIdx = 0; iMsgIdx < iBufferSize; iMsgIdx++ )
1165  }
1166  fvmEpSupprBuffer[fuGet4Nr].clear();
1167  } // if( 0 < fvmEpSupprBuffer[fGet4Nr] )
1168 }
1169 
1172  /*
1173  if( fGdpbIdIndexMap.end() != fGdpbIdIndexMap.find( rocId ) )
1174  LOG(info) << "GET4 Slow Control message, epoch " << static_cast<Int_t>(fCurrentEpoch[rocId][get4Id])
1175  << ", time " << std::setprecision(9) << std::fixed
1176  << Double_t(fulCurrentEpochTime) * 1.e-9 << " s "
1177  << " for board ID " << std::hex << std::setw(4) << rocId << std::dec
1178  << " +++++++ > Chip = " << std::setw(2) << mess.getGdpbGenChipId()
1179  << ", Chan = " << std::setw(1) << mess.getGdpbSlcChan()
1180  << ", Edge = " << std::setw(1) << mess.getGdpbSlcEdge()
1181  << ", Type = " << std::setw(1) << mess.getGdpbSlcType()
1182  << ", Data = " << std::hex << std::setw(6) << mess.getGdpbSlcData() << std::dec
1183  << ", Type = " << mess.getGdpbSlcCrc();
1184 */
1185 }
1186 
1188  Int_t mType = mess.getMessageType();
1189  Int_t channel = mess.getGdpbHitChanId();
1190  uint64_t uData = mess.getData();
1191 
1192  LOG(debug) << "Get4 MSG type " << mType << " from gdpbId " << fuGdpbId
1193  << ", getId " << fuGet4Id << ", (hit channel) " << channel
1194  << " data " << std::hex << uData;
1195 }
1196 
1198  if (fGdpbIdIndexMap.end() != fGdpbIdIndexMap.find(fuGdpbId))
1199  LOG(debug) << "GET4 System message, epoch "
1200  << static_cast<Int_t>(fvulCurrentEpoch[fuGet4Nr]) << ", time "
1201  << std::setprecision(9) << std::fixed
1202  << Double_t(fulCurrentEpochTime) * 1.e-9 << " s "
1203  << " for board ID " << std::hex << std::setw(4) << fuGdpbId
1204  << std::dec;
1205 
1206  switch (mess.getGdpbSysSubType()) {
1207  case gdpbv100::SYS_GET4_ERROR: {
1208  uint32_t uData = mess.getGdpbSysErrData();
1215  LOG(debug) << " +++++++ > gDPB: " << std::hex << std::setw(4)
1216  << fuGdpbId << std::dec << ", Chip = " << std::setw(2)
1217  << mess.getGdpbGenChipId() << ", Chan = " << std::setw(1)
1218  << mess.getGdpbSysErrChanId() << ", Edge = " << std::setw(1)
1219  << mess.getGdpbSysErrEdge() << ", Empt = " << std::setw(1)
1220  << mess.getGdpbSysErrUnused() << ", Data = " << std::hex
1221  << std::setw(2) << uData << std::dec
1222  << " -- GET4 V1 Error Event";
1223  else
1224  LOG(debug) << " +++++++ >gDPB: " << std::hex << std::setw(4) << fuGdpbId
1225  << std::dec << ", Chip = " << std::setw(2)
1226  << mess.getGdpbGenChipId() << ", Chan = " << std::setw(1)
1227  << mess.getGdpbSysErrChanId() << ", Edge = " << std::setw(1)
1228  << mess.getGdpbSysErrEdge() << ", Empt = " << std::setw(1)
1229  << mess.getGdpbSysErrUnused() << ", Data = " << std::hex
1230  << std::setw(2) << uData << std::dec
1231  << " -- GET4 V1 Error Event ";
1232  break;
1233  } // case gdpbv100::SYSMSG_GET4_EVENT
1234  case gdpbv100::SYS_GDPB_UNKWN: {
1235  LOG(debug) << "Unknown GET4 message, data: " << std::hex << std::setw(8)
1236  << mess.getGdpbSysUnkwData() << std::dec
1237  << " Full message: " << std::hex << std::setw(16)
1238  << mess.getData() << std::dec;
1239  break;
1240  } // case gdpbv100::SYS_GDPB_UNKWN:
1241  case gdpbv100::SYS_PATTERN: {
1242  LOG(debug) << "ASIC pattern for missmatch, disable or resync";
1243  break;
1244  } // case gdpbv100::SYS_PATTERN:
1245 
1246  } // switch( getGdpbSysSubType() )
1247 }
1248 
1250  Int_t iMsgIndex = mess.getStarTrigMsgIndex();
1251 
1252  //mess.printDataCout();
1253 
1254  switch (iMsgIndex) {
1255  case 0: fulGdpbTsMsb = mess.getGdpbTsMsbStarA(); break;
1256  case 1:
1259  break;
1260  case 2: fulStarTsMid = mess.getStarTsMidStarC(); break;
1261  case 3: {
1262  ULong64_t ulNewGdpbTsFull = (fulGdpbTsMsb << 24) + (fulGdpbTsLsb);
1263  ULong64_t ulNewStarTsFull =
1264  (fulStarTsMsb << 48) + (fulStarTsMid << 8) + mess.getStarTsLsbStarD();
1265  UInt_t uNewToken = mess.getStarTokenStarD();
1266  UInt_t uNewDaqCmd = mess.getStarDaqCmdStarD();
1267  UInt_t uNewTrigCmd = mess.getStarTrigCmdStarD();
1268  if ((uNewToken == fuStarTokenLast)
1269  && (ulNewGdpbTsFull == fulGdpbTsFullLast)
1270  && (ulNewStarTsFull == fulStarTsFullLast)
1271  && (uNewDaqCmd == fuStarDaqCmdLast)
1272  && (uNewTrigCmd == fuStarTrigCmdLast))
1273 
1274  {
1275  LOG(debug) << "Possible error: identical STAR tokens found twice in a "
1276  "row => ignore 2nd! "
1277  << Form("token = %5u ", fuStarTokenLast)
1278  << Form("gDPB ts = %12llu ", fulGdpbTsFullLast)
1279  << Form("STAR ts = %12llu ", fulStarTsFullLast)
1280  << Form("DAQ cmd = %2u ", fuStarDaqCmdLast)
1281  << Form("TRG cmd = %2u ", fuStarTrigCmdLast);
1282  return;
1283  } // if exactly same message repeated
1284  /*
1285  if( (uNewToken != fuStarTokenLast + 1) &&
1286  0 < fulGdpbTsFullLast && 0 < fulStarTsFullLast &&
1287  ( 4095 != fuStarTokenLast || 1 != uNewToken) )
1288  LOG(warn) << "Possible error: STAR token did not increase by exactly 1! "
1289  << Form("old = %5u vs new = %5u ", fuStarTokenLast, uNewToken)
1290  << Form("old = %12llu vs new = %12llu ", fulGdpbTsFullLast, ulNewGdpbTsFull)
1291  << Form("old = %12llu vs new = %12llu ", fulStarTsFullLast, ulNewStarTsFull)
1292  << Form("old = %2u vs new = %2u ", fuStarDaqCmdLast, uNewDaqCmd)
1293  << Form("old = %2u vs new = %2u ", fuStarTrigCmdLast, uNewTrigCmd);
1294 */
1295  fulGdpbTsFullLast = ulNewGdpbTsFull;
1296  fulStarTsFullLast = ulNewStarTsFull;
1297  fuStarTokenLast = uNewToken;
1298  fuStarDaqCmdLast = uNewDaqCmd;
1299  fuStarTrigCmdLast = uNewTrigCmd;
1300 
1301  Double_t dTot = 1.;
1302  Double_t dTime = fulGdpbTsFullLast * 6.25;
1303  if (0. == fdFirstDigiTimeDif && 0. != fdLastDigiTime) {
1305  LOG(info) << "Reference fake digi time shift initialized to "
1306  << fdFirstDigiTimeDif << ", default: " << fdTShiftRef;
1307  } // if( 0. == fdFirstDigiTimeDif && 0. != fdLastDigiTime )
1308 
1309  // dTime -= fdFirstDigiTimeDif;
1310  // dTime += fdTShiftRef;
1311 
1312  LOG(debug) << "Insert fake digi with time " << dTime << ", Tot " << dTot;
1313  fhRawTRefDig0->Fill(dTime - fdLastDigiTime);
1314  fhRawTRefDig1->Fill(dTime - fdLastDigiTime);
1315 
1316  fDigi =
1317  new CbmTofDigi(0x00005006, dTime, dTot); // fake start counter signal
1318  fBuffer->InsertData<CbmTofDigi>(fDigi);
1319  break;
1320  } // case 3
1321  default: LOG(error) << "Unknown Star Trigger messageindex: " << iMsgIndex;
1322  } // switch( iMsgIndex )
1323 }
1324 
1326  const fles::MicrosliceDescriptor& mdsc) {
1327  LOG(info) << "Header ID: Ox" << std::hex << static_cast<int>(mdsc.hdr_id)
1328  << std::dec;
1329  LOG(info) << "Header version: Ox" << std::hex
1330  << static_cast<int>(mdsc.hdr_ver) << std::dec;
1331  LOG(info) << "Equipement ID: " << mdsc.eq_id;
1332  LOG(info) << "Flags: " << mdsc.flags;
1333  LOG(info) << "Sys ID: Ox" << std::hex << static_cast<int>(mdsc.sys_id)
1334  << std::dec;
1335  LOG(info) << "Sys version: Ox" << std::hex << static_cast<int>(mdsc.sys_ver)
1336  << std::dec;
1337  LOG(info) << "Microslice Idx: " << mdsc.idx;
1338  LOG(info) << "Checksum: " << mdsc.crc;
1339  LOG(info) << "Size: " << mdsc.size;
1340  LOG(info) << "Offset: " << mdsc.offset;
1341 }
1342 
1343 bool CbmDeviceUnpackTofMcbm2018::CheckTimeslice(const fles::Timeslice& ts) {
1344  if (0 == ts.num_components()) {
1345  LOG(error) << "No Component in TS " << ts.index();
1346  return 1;
1347  }
1348  auto tsIndex = ts.index();
1349 
1350  LOG(debug) << "Found " << ts.num_components()
1351  << " different components in timeslice " << tsIndex;
1352 
1353  /*
1354  for (size_t c = 0; c < ts.num_components(); ++c) {
1355  LOG(debug) << "Found " << ts.num_microslices(c)
1356  << " microslices in component " << c;
1357  LOG(debug) << "Component " << c << " has a size of "
1358  << ts.size_component(c) << " bytes";
1359  LOG(debug) << "Sys ID: Ox" << std::hex << static_cast<int>(ts.descriptor(0,0).sys_id)
1360  << std::dec;
1361 
1362  for (size_t m = 0; m < ts.num_microslices(c); ++m) {
1363  PrintMicroSliceDescriptor(ts.descriptor(c,m));
1364  }
1365  }
1366 */
1367  return true;
1368 }
1369 
1371  // iMode - sending condition
1372  // 0 (default)- build time interval only if last buffer entry is older the start + TSLength
1373  // 1 (finish), empty buffer without checking
1374  // Steering variables
1375  double TSLENGTH = 1.E6;
1376  double fdMaxDeltaT = (double) fiReqTint; // in ns
1377 
1378  LOG(debug) << " Buffer size " << fBuffer->GetSize() << ", DeltaT "
1379  << (fBuffer->GetTimeLast() - fBuffer->GetTimeFirst()) / 1.E9
1380  << " s";
1381 
1382  while (fBuffer->GetSize() > 0) {
1383  Double_t fTimeBufferLast = fBuffer->GetTimeLast();
1384 
1385  switch (iMode) {
1386  case 0:
1387  if (fTimeBufferLast - fBuffer->GetTimeFirst() < TSLENGTH) return;
1388  break;
1389  case 1:; break;
1390  }
1391 
1392  CbmTofDigi* digi = (CbmTofDigi*) fBuffer->GetNextData(fTimeBufferLast);
1393  Double_t dTEnd = digi->GetTime() + fdMaxDeltaT;
1394  Double_t dTEndMax = digi->GetTime() + 2 * fdMaxDeltaT;
1395  if (dTEnd > fTimeBufferLast) {
1396  LOG(warn) << Form("Remaining buffer < %f with %d entries is not "
1397  "sufficient for digi ending at %f -> skipped ",
1398  fTimeBufferLast,
1399  fBuffer->GetSize(),
1400  dTEnd);
1401  return;
1402  }
1403 
1404  Bool_t bDet[fiReqDigiAddr.size()][2];
1405  for (UInt_t i = 0; i < fiReqDigiAddr.size(); i++)
1406  for (Int_t j = 0; j < 2; j++)
1407  bDet[i][j] = kFALSE; //initialize
1408  Bool_t bPul[fiReqDigiAddr.size()][2];
1409  for (UInt_t i = 0; i < fiReqDigiAddr.size(); i++)
1410  for (Int_t j = 0; j < 2; j++)
1411  bPul[i][j] = kFALSE; //initialize
1412 
1413  std::vector<CbmTofDigi*> vdigi;
1414  UInt_t nDigi = 0;
1415  const Int_t AddrMask = 0x003FFFFF;
1416  Bool_t bOut = kFALSE;
1417 
1418  while (digi) { // build digi array
1419  if (nDigi == vdigi.size()) vdigi.resize(nDigi + 100);
1420  vdigi[nDigi++] = digi;
1421  for (UInt_t i = 0; i < fiReqDigiAddr.size(); i++)
1422  if ((digi->GetAddress() & AddrMask) == fiReqDigiAddr[i]) {
1423  Int_t j = ((CbmTofDigi*) digi)->GetSide();
1424  bDet[i][j] = kTRUE;
1425  if (fiReqDigiAddr[i] == 0x00005006)
1426  bDet[i][1] = kTRUE; // diamond with pad readout
1427  if ((fiReqDigiAddr[i] & 0x0000F00F) == 0x00008006)
1428  bDet[i][1] = kTRUE; // ceramic with pad readout
1429  Int_t str = ((CbmTofDigi*) digi)->GetChannel();
1430 
1431  switch (j) { // treat both strip ends separately
1432  case 0:
1433  switch (fiPulserMode) {
1434  case 0:
1435  case 1:
1436  if (str == 31)
1437  if (digi->GetTot() > fiPulTotMin
1438  && digi->GetTot() < fiPulTotMax)
1439  bPul[i][0] = kTRUE;
1440  if (str == 0) bPul[i][1] = kFALSE;
1441  if (
1442  fiReqDigiAddr[i]
1443  == 0x00005006) { //special mapping for MAr2019 diamond (T0)
1444  if (str == 0) bPul[i][0] = kTRUE;
1445  if (str == 40) bPul[i][1] = kTRUE;
1446  }
1447  break;
1448  case 2:
1449  if (str == 0)
1450  if (digi->GetTot() > fiPulTotMin
1451  && digi->GetTot() < fiPulTotMax) {
1452  bPul[i][0] = kTRUE;
1453  if ((fiReqDigiAddr[i] & 0x000FF00F) == 0x00078006) {
1454  bPul[i][1] = kTRUE; // ceramic with pad readout
1455  bDet[i][1] = kFALSE; // remove Hit flag
1456  }
1457  if (str == 31) bPul[i][1] = kFALSE;
1458  }
1459  default:;
1460  }
1461  break;
1462 
1463  case 1:
1464  switch (fiPulserMode) {
1465  case 0:
1466  case 1:
1467  if (str == 31) bPul[i][0] = kFALSE;
1468  if (str == 0)
1469  if (digi->GetTot() > fiPulTotMin
1470  && digi->GetTot() < fiPulTotMax)
1471  bPul[i][1] = kTRUE;
1472  break;
1473  case 2:
1474  if (str == 0) bPul[i][0] = kFALSE;
1475  if (str == 31)
1476  if (digi->GetTot() > fiPulTotMin
1477  && digi->GetTot() < fiPulTotMax)
1478  bPul[i][1] = kTRUE;
1479  break;
1480  default:;
1481  }
1482  break;
1483  default:;
1484  }
1485  }
1486  //if(bOut) LOG(info)<<Form("Found 0x%08x, Req 0x%08x ", digi->GetAddress(), fiReqDigiAddr);
1487  if (dTEnd - digi->GetTime() < fdMaxDeltaT * 0.5) {
1488  if (digi->GetTime() + fdMaxDeltaT * 0.5 < dTEndMax)
1489  dTEnd = digi->GetTime() + fdMaxDeltaT * 0.5;
1490  else
1491  dTEnd = dTEndMax;
1492  };
1493  digi = (CbmTofDigi*) fBuffer->GetNextData(dTEnd);
1494  } // end while
1495 
1496  LOG(debug) << nDigi << " digis associated to dTEnd = " << dTEnd << ":";
1497  //for(UInt_t iDigi=0; iDigi<nDigi; iDigi++) LOG(debug)<<Form(" 0x%08x",vdigi[iDigi]->GetAddress());
1498  for (UInt_t iDigi = 0; iDigi < nDigi; iDigi++)
1499  LOG(debug) << vdigi[iDigi]->ToString();
1500 
1501  UInt_t iDetMul = 0;
1502  if (fiReqDigiAddr.size() == 0)
1503  bOut = kTRUE; // output everything
1504  else {
1505  if (fiReqMode == 0) { // check for presence of requested detectors
1506  for (UInt_t i = 0; i < fiReqDigiAddr.size(); i++)
1507  if (bDet[i][0] == kFALSE || bDet[i][1] == kFALSE)
1508  break;
1509  else if (i == fiReqDigiAddr.size() - 1) {
1510  bOut = kTRUE;
1511  iDetMul = i;
1512  }
1513  } else { // check for presence of any known detector
1514  for (UInt_t i = 0; i < fiReqDigiAddr.size(); i++)
1515  if (bDet[i][0] == kTRUE && bDet[i][1] == kTRUE) { iDetMul++; }
1516  if (iDetMul >= fiReqMode) { bOut = kTRUE; }
1517  }
1518  }
1519 
1520  if (bOut && fiReqDigiAddr.size() > 1) {
1521  LOG(debug) << "Found Req coinc in event with " << nDigi << " digis in "
1522  << iDetMul << " detectors, dTEnd = " << dTEnd;
1523  }
1524 
1525  // determine Pulser status
1526  UInt_t iPulMul = 0; // Count Potential Pulser Signals
1527  for (UInt_t i = 0; i < fiReqDigiAddr.size(); i++) {
1528  if (bPul[i][0] == kTRUE && bPul[i][1] == kTRUE) iPulMul++;
1529  }
1530 
1531  if (fiPulserMode > 0 && iPulMul > fiPulMulMin) {
1532  LOG(debug) << "@Event " << fEventHeader[0] << ": iPulMul = " << iPulMul;
1533  bOut = kTRUE;
1534  }
1535  LOG(debug) << "Process Ev " << fEventHeader[0]
1536  << " with iDetMul = " << iDetMul << ", iPulMul = " << iPulMul;
1537 
1538  fEventHeader[0]++;
1539 
1540  if (bOut) {
1541  fEventHeader[1] = iDetMul;
1542  fEventHeader[2] = fiReqMode;
1543  fEventHeader[3] = iPulMul;
1544  vdigi.resize(nDigi);
1545  const Int_t NDigiMax = 10000;
1546  if (nDigi > NDigiMax) {
1547  LOG(warn) << "Oversized event, truncated! ";
1548  for (UInt_t iDigi = NDigiMax; iDigi < nDigi; iDigi++)
1549  vdigi[iDigi]->Delete();
1550  nDigi = 1; //NDigiMax;
1551  vdigi.resize(nDigi);
1552  }
1553  SendDigis(vdigi, 0);
1554 
1555  for (UInt_t iDigi = 0; iDigi < nDigi; iDigi++)
1556  vdigi[iDigi]->Delete();
1557  } else {
1558  for (UInt_t iDigi = 0; iDigi < nDigi; iDigi++) {
1559  digi = vdigi[iDigi];
1560  digi->Delete();
1561  }
1562  //LOG(debug) << " Digis deleted ";
1563  //vdigi.clear();
1564  //delete &vdigi; // crashes, since local variable, will be done at return (?)
1565  }
1566  }
1567 }
1568 
1569 bool CbmDeviceUnpackTofMcbm2018::SendDigis(std::vector<CbmTofDigi*> vdigi,
1570  int idx) {
1571  LOG(debug) << "Send Digis for event " << fNumTint << " with size "
1572  << vdigi.size() << Form(" at %p ", &vdigi);
1573  LOG(debug) << "EventHeader: " << fEventHeader[0] << " " << fEventHeader[1]
1574  << " " << fEventHeader[2] << " " << fEventHeader[3];
1575 
1576  // Int_t NDigi=vdigi.size();
1577 
1578  std::stringstream ossE;
1579  boost::archive::binary_oarchive oaE(ossE);
1580  oaE << fEventHeader;
1581  std::string* strMsgE = new std::string(ossE.str());
1582 
1583  std::stringstream oss;
1584  boost::archive::binary_oarchive oa(oss);
1585  oa << vdigi;
1586  std::string* strMsg = new std::string(oss.str());
1587 
1588  FairMQParts parts;
1589  parts.AddPart(NewMessage(
1590  const_cast<char*>(strMsgE->c_str()), // data
1591  strMsgE->length(), // size
1592  [](void*, void* object) { delete static_cast<std::string*>(object); },
1593  strMsgE)); // object that manages the data
1594 
1595  parts.AddPart(NewMessage(
1596  const_cast<char*>(strMsg->c_str()), // data
1597  strMsg->length(), // size
1598  [](void*, void* object) { delete static_cast<std::string*>(object); },
1599  strMsg)); // object that manages the data
1600 
1601 
1602  /*
1603  std::vector<CbmTofDigi>vTofDigi;
1604  vTofDigi.resize(vdigi.size());
1605  for (Int_t i=0; i<vdigi.size(); i++) {
1606  CbmTofDigi *pdigi = (CbmTofDigi *) vdigi[i];
1607  CbmTofDigi digi = *pdigi;
1608  vTofDigi[i] = digi;
1609  LOG(debug) << vTofDigi[i].ToString()<<" bits "<<Form("0x%08x",vTofDigi[i].TestBits(0xFFFF));
1610  }
1611  FairMQMessagePtr msg(NewMessage(static_cast<std::vector<CbmTofDigi>*> (&vTofDigi), // data
1612  NDigi*sizeof(CbmTofDigi), // size
1613  [](void* , void* object){ delete static_cast<CbmTofDigi*>(object); }
1614  )); // object that manages the data
1615 
1616  // transfer of TofDigi array, ... works
1617  CbmTofDigi aTofDigi[NDigi];
1618  // const Int_t iNDigiOut=100;
1619  // NDigi=TMath::Min(NDigi,iNDigiOut);
1620  // std::array<CbmTofDigi,iNDigiOut> aTofDigi;
1621  for (Int_t i=0; i<NDigi; i++) {
1622  aTofDigi[i] = *vdigi[i];
1623  LOG(debug) << aTofDigi[i].ToString()<<" bits "<<Form("0x%08x",aTofDigi[i].TestBits(0xFFFF));
1624  }
1625  FairMQMessagePtr msg(NewMessage(static_cast<CbmTofDigi*> (&aTofDigi[0]), // data
1626  NDigi*sizeof(CbmTofDigi), // size
1627  [](void* , void* object){ delete static_cast<CbmTofDigi*>(object); }
1628  )); // object that manages the data
1629 
1630 
1631  LOG(info) << "Send aTofDigi sizes "<<NDigi<<", "<<sizeof(CbmTofDigi)<<", msg size "<<msg->GetSize();
1632 
1633  // serialize the timeslice and create the message
1634 
1635  std::stringstream oss;
1636  boost::archive::binary_oarchive oa(oss);
1637  oa << vdigi;
1638  std::string* strMsg = new std::string(oss.str());
1639 
1640  LOG(debug) << "send strMsg with length " << strMsg->length()<<" "<<strMsg;
1641  FairMQMessagePtr msg(NewMessage(const_cast<char*>(strMsg->c_str()), // data
1642  strMsg->length(), // size
1643  [](void* , void* object){ delete static_cast<std::string*>(object); },
1644  strMsg)); // object that manages the data
1645  */
1646  /*
1647  FairMQMessagePtr msg(NewMessage(static_cast<CbmTofDigi*> (vTofDigi.data()), // data
1648  vTofDigi.size()*sizeof(CbmTofDigi), // size
1649  [](void* , void* object){ delete static_cast<CbmTofDigi*>(object); }
1650  )); // object that manages the data
1651  */
1652 
1653  /* --------------------------------------- compiles but crashes .... ---------------------------------------------------
1654  const Int_t WSize=8;
1655  FairMQMessagePtr msg(NewMessage(static_cast<std::vector<CbmTofDigi>*> (&vTofDigi), // data
1656  vTofDigi.size()*sizeof(CbmTofDigi)*WSize, // size, FIXME, numerical value in code!
1657  [](void* , void* object){ delete static_cast<std::vector<CbmTofDigi>*>(object); }
1658  )); // object that manages the data
1659 
1660  LOG(info) << "Send TofDigi sizes "<<vTofDigi.size()<<", "<<sizeof(CbmTofDigi)<<", msg size "<<msg->GetSize();
1661  int *pData = static_cast <int *>(vTofDigi.data());
1662 
1663  int *pData = static_cast <int *>(msg->GetData());
1664  const Int_t NBytes=4;
1665  for (int iData=0; iData<msg->GetSize()/NBytes; iData++) {
1666  LOG(info) << Form(" ind %d, poi %p, data: 0x%08x",iData,pData,*pData++);
1667  }
1668  */
1669  /*
1670  auto msg = NewMessageFor("my_channel", 0,
1671  static_cast<void*>(vTofDigi.data()),
1672  vTofDigi.size() * sizeof(CbmTofDigi),
1673  FairMQNoCleanup, nullptr);
1674  */
1675 
1676  // TODO: Implement sending same data to more than one channel
1677  // Need to create new message (copy message??)
1678  /*
1679  if (fChannelsToSend[idx]>1) {
1680  LOG(info) << "Need to copy FairMessage ?";
1681  }
1682  */
1683  // in case of error or transfer interruption,
1684  // return false to go to IDLE state
1685  // successfull transfer will return number of bytes
1686  // transfered (can be 0 if sending an empty message).
1687 
1688  LOG(debug) << "Send data to channel " << idx << " "
1689  << fChannelsToSend[idx][0];
1690 
1691 
1692  // if (Send(msg, fChannelsToSend[idx][0]) < 0) {
1693  if (Send(parts, fChannelsToSend[idx][0]) < 0) {
1694  LOG(error) << "Problem sending data " << fChannelsToSend[idx][0];
1695  return false;
1696  }
1697  /*
1698  LOG(info) << "Sent message # "<< fNumTint << " at " << msg->GetData()
1699  << ", size " << msg->GetSize()<<" for "<<vTofDigi.size()<<" Digis at "
1700  << vTofDigi.data() << ", "<<&vTofDigi;
1701  */
1702  fNumTint++;
1703  //if(fNumTint==100) FairMQStateMachine::ChangeState(PAUSE); //sleep(10000); // Stop for debugging ...
1704  /*
1705  LOG(info) << "Send message " << fNumTint << " with a size of "
1706  << msg->GetSize();
1707  */
1708  return true;
1709 }
1710 
1712  UInt_t iNReq = fiReqDigiAddr.size();
1713  for (UInt_t i = 0; i < iNReq; i++)
1714  if (fiReqDigiAddr[i] == iAddr)
1715  return; // det already present, avoid double counting
1716  fiReqDigiAddr.resize(iNReq
1717  + 1); // hopefully the old entries are preserved ...
1718  fiReqDigiAddr[iNReq] = iAddr;
1719  LOG(info) << Form("Request Digi Address 0x%08x ", iAddr);
1720 }
1721 
1724 }
1725 
1727  fUnpackerAlgo->SetTimeOffsetNs(dOffsetIn);
1728 }
1731 }
gdpbv100::Message::getStarTrigCmdStarD
uint32_t getStarTrigCmdStarD() const
Definition: gDpbMessv100.h:278
CbmDeviceUnpackTofMcbm2018::fulGdpbTsFullLast
ULong64_t fulGdpbTsFullLast
Definition: CbmDeviceUnpackTofMcbm2018.h:194
gdpbv100::Message
Definition: gDpbMessv100.h:133
CbmDeviceUnpackTofMcbm2018::fviNrOfRpc
std::vector< Int_t > fviNrOfRpc
Definition: CbmDeviceUnpackTofMcbm2018.h:182
CbmDeviceUnpackTofMcbm2018::IsChannelNameAllowed
bool IsChannelNameAllowed(std::string channelName)
Definition: CbmDeviceUnpackTofMcbm2018.cxx:271
CbmDeviceUnpackTofMcbm2018.h
CbmDeviceUnpackTofMcbm2018::fuStarDaqCmdLast
UInt_t fuStarDaqCmdLast
Definition: CbmDeviceUnpackTofMcbm2018.h:197
gdpbv100::Message::getMsgFullTimeD
double getMsgFullTimeD(uint64_t epoch) const
Returns expanded and adjusted time of message in double (in ns)
Definition: gDpbMessv100.cxx:103
CbmDeviceUnpackTofMcbm2018::fuNrOfChannelsPerFee
UInt_t fuNrOfChannelsPerFee
Definition: CbmDeviceUnpackTofMcbm2018.h:85
CbmDeviceUnpackTofMcbm2018::SetParContainers
void SetParContainers()
Definition: CbmDeviceUnpackTofMcbm2018.cxx:345
gdpbv100::Message::getGdpbSysErrChanId
uint16_t getGdpbSysErrChanId() const
Definition: gDpbMessv100.h:251
CbmDeviceUnpackTofMcbm2018::fdFirstDigiTimeDif
Double_t fdFirstDigiTimeDif
Definition: CbmDeviceUnpackTofMcbm2018.h:145
iWarnMess
static Int_t iWarnMess
Definition: CbmDeviceUnpackTofMcbm2018.cxx:1006
CbmDeviceUnpackTofMcbm2018::PrintMicroSliceDescriptor
void PrintMicroSliceDescriptor(const fles::MicrosliceDescriptor &mdsc)
Definition: CbmDeviceUnpackTofMcbm2018.cxx:1325
CbmDeviceUnpackTofMcbm2018::fvmEpSupprBuffer
std::vector< std::vector< gdpbv100::Message > > fvmEpSupprBuffer
Definition: CbmDeviceUnpackTofMcbm2018.h:186
CbmDeviceUnpackTofMcbm2018::fvbChanThere
std::vector< Bool_t > fvbChanThere
Definition: CbmDeviceUnpackTofMcbm2018.h:155
CbmDeviceUnpackTofMcbm2018::fvulStarTsFullLast
std::vector< ULong64_t > fvulStarTsFullLast
Definition: CbmDeviceUnpackTofMcbm2018.h:111
CbmMcbm2018UnpackerAlgoTof
Definition: CbmMcbm2018UnpackerAlgoTof.h:35
gdpbv100::Message::getGdpbTsMsbStarA
uint64_t getGdpbTsMsbStarA() const
Definition: gDpbMessv100.h:266
gdpbv100::Message::getGdpbEpEpochNb
uint32_t getGdpbEpEpochNb() const
Definition: gDpbMessv100.h:231
CbmDeviceUnpackTofMcbm2018::fuNrOfGet4PerGdpb
UInt_t fuNrOfGet4PerGdpb
Definition: CbmDeviceUnpackTofMcbm2018.h:87
CbmDeviceUnpackTofMcbm2018::fuCoreMs
size_t fuCoreMs
Definition: CbmDeviceUnpackTofMcbm2018.h:74
CbmDeviceUnpackTofMcbm2018::fvulGdpbTsMsb
std::vector< ULong64_t > fvulGdpbTsMsb
Definition: CbmDeviceUnpackTofMcbm2018.h:106
CbmDeviceUnpackTofMcbm2018::fvuElinkToGet4
std::vector< UInt_t > fvuElinkToGet4
5 FEE with 8 GET4 each
Definition: CbmDeviceUnpackTofMcbm2018.h:170
CbmDeviceUnpackTofMcbm2018::FillEpochInfo
void FillEpochInfo(gdpbv100::Message)
Definition: CbmDeviceUnpackTofMcbm2018.cxx:1129
gdpbv100::GET4_V2X_ERR_TOT_OVERWRT
@ GET4_V2X_ERR_TOT_OVERWRT
Definition: gDpbMessv100.h:121
CbmDeviceUnpackTofMcbm2018::fvuStarDaqCmdLast
std::vector< UInt_t > fvuStarDaqCmdLast
Definition: CbmDeviceUnpackTofMcbm2018.h:113
CbmMcbm2018TofPar::GetNbMsTot
Int_t GetNbMsTot()
Definition: CbmMcbm2018TofPar.h:79
CbmMcbm2018TofPar::GetGdpbId
Int_t GetGdpbId(Int_t i)
Definition: CbmMcbm2018TofPar.h:67
CbmDeviceUnpackTofMcbm2018::fvbFirstEpochSeen
std::vector< Bool_t > fvbFirstEpochSeen
Definition: CbmDeviceUnpackTofMcbm2018.h:125
CbmStar2019Algo::GetVector
std::vector< T > & GetVector()
Definition: CbmStar2019Algo.h:97
CbmMcbm2018TofPar.h
CbmDeviceUnpackTofMcbm2018::fhChCount
std::vector< TH1 * > fhChCount
Definition: CbmDeviceUnpackTofMcbm2018.h:154
CbmDeviceUnpackTofMcbm2018::fNofEpochs
Int_t fNofEpochs
Definition: CbmDeviceUnpackTofMcbm2018.h:127
gdpbv100::SYS_GET4_ERROR
@ SYS_GET4_ERROR
Definition: gDpbMessv100.h:70
CbmDeviceUnpackTofMcbm2018::fiReqDigiAddr
std::vector< Int_t > fiReqDigiAddr
Definition: CbmDeviceUnpackTofMcbm2018.h:58
InitTaskError
CBM headers.
Definition: CbmDeviceEventBuilderEtofStar2019.cxx:36
CbmDeviceUnpackTofMcbm2018::fuNrOfFeePerGdpb
UInt_t fuNrOfFeePerGdpb
Definition: CbmDeviceUnpackTofMcbm2018.h:81
CbmDeviceUnpackTofMcbm2018::fuGdpbNr
UInt_t fuGdpbNr
Definition: CbmDeviceUnpackTofMcbm2018.h:95
CbmDeviceUnpackTofMcbm2018::fulGdpbTsMsb
ULong64_t fulGdpbTsMsb
Definition: CbmDeviceUnpackTofMcbm2018.h:190
i
int i
Definition: L1/vectors/P4_F32vec4.h:25
cbm::mq::Transition::End
@ End
CbmDeviceUnpackTofMcbm2018::PrintSysInfo
void PrintSysInfo(gdpbv100::Message)
Definition: CbmDeviceUnpackTofMcbm2018.cxx:1197
CbmDeviceUnpackTofMcbm2018::kuNbGbtxPerGdpb
const UInt_t kuNbGbtxPerGdpb
Definition: CbmDeviceUnpackTofMcbm2018.h:91
gdpbv100::Message::getMessageType
uint8_t getMessageType() const
Returns the message type. Valid for all message types. 4 bit.
Definition: gDpbMessv100.h:206
CbmDeviceUnpackTofMcbm2018::fAllowedChannels
std::vector< std::string > fAllowedChannels
Definition: CbmDeviceUnpackTofMcbm2018.h:64
CbmMcbm2018TofPar::GetNrOfChannelsPerFee
static constexpr UInt_t GetNrOfChannelsPerFee()
Definition: CbmMcbm2018TofPar.h:51
CbmDeviceUnpackTofMcbm2018::FillHitInfo
void FillHitInfo(gdpbv100::Message)
Definition: CbmDeviceUnpackTofMcbm2018.cxx:1009
CbmDeviceUnpackTofMcbm2018::fBuffer
CbmTbDaqBuffer * fBuffer
Definition: CbmDeviceUnpackTofMcbm2018.h:188
gdpbv100::Message::getGdpbSysSubType
uint16_t getGdpbSysSubType() const
Definition: gDpbMessv100.h:245
CbmDeviceUnpackTofMcbm2018::CreateHistograms
void CreateHistograms()
Definition: CbmDeviceUnpackTofMcbm2018.cxx:742
CbmMcbm2018UnpackerAlgoTof::InitContainers
Bool_t InitContainers()
Definition: CbmMcbm2018UnpackerAlgoTof.cxx:137
gdpbv100::Message::setGdpbEpEpochNb
void setGdpbEpEpochNb(uint32_t v)
Definition: gDpbMessv100.h:283
CbmDeviceUnpackTofMcbm2018::fuGet4Id
UInt_t fuGet4Id
Definition: CbmDeviceUnpackTofMcbm2018.h:97
CbmMcbm2018TofPar::GetNrOfFeePerGbtx
static constexpr UInt_t GetNrOfFeePerGbtx()
Definition: CbmMcbm2018TofPar.h:49
CbmMQTMessage
Definition: CbmDeviceEventBuilderEtofStar2019.h:96
CbmMcbm2018UnpackerAlgoTof.h
CbmMcbm2018TofPar::GetNrOfGbtx
Int_t GetNrOfGbtx()
Definition: CbmMcbm2018TofPar.h:72
gdpbv100::kuEpochCounterSz
const uint32_t kuEpochCounterSz
Definition: gDpbMessv100.h:40
CbmDeviceUnpackTofMcbm2018::AddReqDigiAddr
void AddReqDigiAddr(int)
Definition: CbmDeviceUnpackTofMcbm2018.cxx:1711
CbmTofDigi.h
CbmDeviceUnpackTofMcbm2018::fChannelsToSend
std::vector< std::vector< std::string > > fChannelsToSend
Definition: CbmDeviceUnpackTofMcbm2018.h:68
CbmDeviceUnpackTofMcbm2018::fulCurrentEpochTime
ULong64_t fulCurrentEpochTime
Definition: CbmDeviceUnpackTofMcbm2018.h:128
CbmDeviceUnpackTofMcbm2018::fviRpcSide
std::vector< Int_t > fviRpcSide
Definition: CbmDeviceUnpackTofMcbm2018.h:183
CbmDeviceUnpackTofMcbm2018::~CbmDeviceUnpackTofMcbm2018
virtual ~CbmDeviceUnpackTofMcbm2018()
Definition: CbmDeviceUnpackTofMcbm2018.cxx:149
CbmMcbm2018TofPar::GetNbMsOverlap
Int_t GetNbMsOverlap()
Definition: CbmMcbm2018TofPar.h:80
gdpbv100::Message::getGdpbSysErrData
uint16_t getGdpbSysErrData() const
Definition: gDpbMessv100.h:253
CbmDeviceUnpackTofMcbm2018::fGdpbIdIndexMap
std::map< UInt_t, UInt_t > fGdpbIdIndexMap
Definition: CbmDeviceUnpackTofMcbm2018.h:103
CbmDeviceUnpackTofMcbm2018::DoUnpack
Bool_t DoUnpack(const fles::Timeslice &ts, size_t component)
Definition: CbmDeviceUnpackTofMcbm2018.cxx:958
CbmDeviceUnpackTofMcbm2018::fuNrOfChannelsPerGdpb
UInt_t fuNrOfChannelsPerGdpb
Definition: CbmDeviceUnpackTofMcbm2018.h:88
cbm::mq::Transition::ErrorFound
@ ErrorFound
CbmDeviceUnpackTofMcbm2018::fiPulMulMin
uint64_t fiPulMulMin
Definition: CbmDeviceUnpackTofMcbm2018.h:60
CbmDeviceUnpackTofMcbm2018::fdTsCoreSizeInNs
Double_t fdTsCoreSizeInNs
Definition: CbmDeviceUnpackTofMcbm2018.h:76
CbmDeviceUnpackTofMcbm2018::fviRpcType
std::vector< Int_t > fviRpcType
Definition: CbmDeviceUnpackTofMcbm2018.h:180
CbmDeviceUnpackTofMcbm2018::fhChanCoinc
std::vector< TH2 * > fhChanCoinc
Definition: CbmDeviceUnpackTofMcbm2018.h:156
CbmDeviceUnpackTofMcbm2018::SetIgnoreOverlapMs
void SetIgnoreOverlapMs(Bool_t bFlagIn=kTRUE)
Definition: CbmDeviceUnpackTofMcbm2018.cxx:1722
CbmTofDetectorId_v14a.h
CbmDeviceUnpackTofMcbm2018::fvuGet4ToPadi
std::vector< UInt_t > fvuGet4ToPadi
Definition: CbmDeviceUnpackTofMcbm2018.h:166
CbmTofDigi::GetSide
Double_t GetSide() const
Channel Side.
Definition: CbmTofDigi.h:142
gdpbv100::Message::getStarTsLsbStarD
uint64_t getStarTsLsbStarD() const
Definition: gDpbMessv100.h:273
CbmMcbm2018TofPar::GetNrOfGdpbs
Int_t GetNrOfGdpbs()
FIXME: replace with method returning the correspondign constants! see Star2019 parameter.
Definition: CbmMcbm2018TofPar.h:66
CbmDeviceUnpackTofMcbm2018::fuGet4Nr
UInt_t fuGet4Nr
Definition: CbmDeviceUnpackTofMcbm2018.h:99
cbm::mq::LogState
void LogState(FairMQDevice *device)
Definition: CbmMQDefs.h:53
CbmDeviceUnpackTofMcbm2018::HandleMessage
bool HandleMessage(FairMQMessagePtr &, int)
Definition: CbmDeviceUnpackTofMcbm2018.cxx:935
CbmDeviceUnpackTofMcbm2018::fhRawTDigRef0
TH1 * fhRawTDigRef0
Definition: CbmDeviceUnpackTofMcbm2018.h:148
CbmDeviceUnpackTofMcbm2018::fvuPadiToGet4
std::vector< UInt_t > fvuPadiToGet4
Definition: CbmDeviceUnpackTofMcbm2018.h:165
CbmDeviceUnpackTofMcbm2018::fvulStarTsMsb
std::vector< ULong64_t > fvulStarTsMsb
Definition: CbmDeviceUnpackTofMcbm2018.h:108
CbmDeviceUnpackTofMcbm2018::fdLastDigiTime
Double_t fdLastDigiTime
Definition: CbmDeviceUnpackTofMcbm2018.h:144
CbmDeviceUnpackTofMcbm2018::SetDiamondDpbIdx
void SetDiamondDpbIdx(UInt_t uIdx=2)
Definition: CbmDeviceUnpackTofMcbm2018.cxx:1729
CbmDeviceUnpackTofMcbm2018::fNumMessages
uint64_t fNumMessages
Definition: CbmDeviceUnpackTofMcbm2018.h:52
gdpbv100::Message::getData
uint64_t getData() const
Definition: gDpbMessv100.h:156
fiSelectComponents
static uint fiSelectComponents
Definition: CbmDeviceEventBuilderEtofStar2019.cxx:44
CbmDeviceUnpackTofMcbm2018::BuildTint
virtual void BuildTint(int)
Definition: CbmDeviceUnpackTofMcbm2018.cxx:1370
CbmDeviceUnpackTofMcbm2018::fhRawDigiLastDigi
TH1 * fhRawDigiLastDigi
Definition: CbmDeviceUnpackTofMcbm2018.h:152
CbmMcbm2018TofPar::GetNrOfRpc
Int_t GetNrOfRpc(Int_t i)
Definition: CbmMcbm2018TofPar.h:74
CbmDeviceUnpackTofMcbm2018::fviModuleId
std::vector< Int_t > fviModuleId
Definition: CbmDeviceUnpackTofMcbm2018.h:181
gdpbv100::GET4_V2X_ERR_SEQUENCE_ER
@ GET4_V2X_ERR_SEQUENCE_ER
Definition: gDpbMessv100.h:127
CbmDeviceUnpackTofMcbm2018::fuGdpbId
UInt_t fuGdpbId
Definition: CbmDeviceUnpackTofMcbm2018.h:93
gdpbv100::Message::getGdpbTsLsbStarB
uint64_t getGdpbTsLsbStarB() const
Definition: gDpbMessv100.h:268
gdpbv100::Message::getStarTrigMsgIndex
uint16_t getStarTrigMsgIndex() const
Definition: gDpbMessv100.h:264
CbmDeviceUnpackTofMcbm2018::fiReqMode
uint64_t fiReqMode
Definition: CbmDeviceUnpackTofMcbm2018.h:56
CbmDeviceUnpackTofMcbm2018::fEventHeader
std::vector< int > fEventHeader
Definition: CbmDeviceUnpackTofMcbm2018.h:55
CbmMcbm2018UnpackerAlgoTof::SetDiamondDpbIdx
void SetDiamondDpbIdx(UInt_t uIdx=2)
Definition: CbmMcbm2018UnpackerAlgoTof.h:68
CbmDeviceUnpackTofMcbm2018::kuNbFeePerGbtx
const UInt_t kuNbFeePerGbtx
Definition: CbmDeviceUnpackTofMcbm2018.h:90
CbmDeviceUnpackTofMcbm2018::PrintSlcInfo
void PrintSlcInfo(gdpbv100::Message)
Definition: CbmDeviceUnpackTofMcbm2018.cxx:1170
CbmTofDigi::GetTime
Double_t GetTime() const
Inherited from CbmDigi.
Definition: CbmTofDigi.h:111
CbmTofAddress.h
CbmDeviceUnpackTofMcbm2018::fvulStarTsMid
std::vector< ULong64_t > fvulStarTsMid
Definition: CbmDeviceUnpackTofMcbm2018.h:109
gdpbv100::GET4_V2X_ERR_ADD_RIS_EDG
@ GET4_V2X_ERR_ADD_RIS_EDG
Definition: gDpbMessv100.h:125
CbmDeviceUnpackTofMcbm2018::fuStarTrigCmdLast
UInt_t fuStarTrigCmdLast
Definition: CbmDeviceUnpackTofMcbm2018.h:198
CbmDeviceUnpackTofMcbm2018::fvulGdpbTsFullLast
std::vector< ULong64_t > fvulGdpbTsFullLast
Definition: CbmDeviceUnpackTofMcbm2018.h:110
CbmDeviceUnpackTofMcbm2018::fiReqTint
uint64_t fiReqTint
Definition: CbmDeviceUnpackTofMcbm2018.h:57
cbm::mq::Transition::Ready
@ Ready
CbmDeviceUnpackTofMcbm2018::fuStarTokenLast
UInt_t fuStarTokenLast
Definition: CbmDeviceUnpackTofMcbm2018.h:196
CbmDeviceUnpackTofMcbm2018::AddMsComponentToList
void AddMsComponentToList(size_t component, UShort_t usDetectorId)
Temp until we change from CbmMcbmUnpack to something else.
Definition: CbmDeviceUnpackTofMcbm2018.cxx:377
CbmDeviceUnpackTofMcbm2018::fulGdpbTsLsb
ULong64_t fulGdpbTsLsb
Definition: CbmDeviceUnpackTofMcbm2018.h:191
CbmDeviceUnpackTofMcbm2018::fulStarTsMsb
ULong64_t fulStarTsMsb
Definition: CbmDeviceUnpackTofMcbm2018.h:192
CbmDeviceUnpackTofMcbm2018::fhDetChanCoinc
TH2 * fhDetChanCoinc
Definition: CbmDeviceUnpackTofMcbm2018.h:158
CbmMcbm2018TofPar::GetModuleId
Int_t GetModuleId(Int_t i)
Definition: CbmMcbm2018TofPar.h:77
CbmDeviceUnpackTofMcbm2018::fvuStarTokenLast
std::vector< UInt_t > fvuStarTokenLast
Definition: CbmDeviceUnpackTofMcbm2018.h:112
CbmDeviceUnpackTofMcbm2018::fUnpackPar
CbmMcbm2018TofPar * fUnpackPar
Definition: CbmDeviceUnpackTofMcbm2018.h:140
CbmDeviceUnpackTofMcbm2018::fulStarTsFullLast
ULong64_t fulStarTsFullLast
Definition: CbmDeviceUnpackTofMcbm2018.h:195
CbmDeviceUnpackTofMcbm2018::GetArrayIndex
Int_t GetArrayIndex(Int_t gdpbId, Int_t get4Id)
Definition: CbmDeviceUnpackTofMcbm2018.h:160
CbmDeviceUnpackTofMcbm2018::fvulCurrentEpoch
std::vector< ULong64_t > fvulCurrentEpoch
Definition: CbmDeviceUnpackTofMcbm2018.h:124
CbmTofDigi
Data class for expanded digital TOF information.
Definition: CbmTofDigi.h:38
CbmDeviceUnpackTofMcbm2018::fNumTint
uint64_t fNumTint
Definition: CbmDeviceUnpackTofMcbm2018.h:54
gdpbv100::Message::getStarTsMidStarC
uint64_t getStarTsMidStarC() const
Definition: gDpbMessv100.h:271
CbmDeviceUnpackTofMcbm2018::fvuStarTrigCmdLast
std::vector< UInt_t > fvuStarTrigCmdLast
Definition: CbmDeviceUnpackTofMcbm2018.h:114
CbmDeviceUnpackTofMcbm2018::InitTask
virtual void InitTask()
Definition: CbmDeviceUnpackTofMcbm2018.cxx:153
CbmDeviceUnpackTofMcbm2018::fuMinNbGdpb
UInt_t fuMinNbGdpb
Definition: CbmDeviceUnpackTofMcbm2018.h:77
gdpbv100::GET4_V2X_ERR_TOT_RANGE
@ GET4_V2X_ERR_TOT_RANGE
Definition: gDpbMessv100.h:123
CbmDeviceUnpackTofMcbm2018::fvulGdpbTsLsb
std::vector< ULong64_t > fvulGdpbTsLsb
Definition: CbmDeviceUnpackTofMcbm2018.h:107
CbmDeviceUnpackTofMcbm2018::PrintGenInfo
void PrintGenInfo(gdpbv100::Message)
Definition: CbmDeviceUnpackTofMcbm2018.cxx:1187
iErrorMess
static Int_t iErrorMess
Definition: CbmDeviceUnpackTofMcbm2018.cxx:1005
CbmDeviceUnpackTofMcbm2018::FillStarTrigInfo
void FillStarTrigInfo(gdpbv100::Message)
Definition: CbmDeviceUnpackTofMcbm2018.cxx:1249
CbmDeviceUnpackTofMcbm2018::fvuGet4ToElink
std::vector< UInt_t > fvuGet4ToElink
Definition: CbmDeviceUnpackTofMcbm2018.h:171
CbmDeviceUnpackTofMcbm2018::ReInitContainers
Bool_t ReInitContainers()
Definition: CbmDeviceUnpackTofMcbm2018.cxx:382
CbmMcbm2018UnpackerAlgoTof::ProcessTs
Bool_t ProcessTs(const fles::Timeslice &ts)
Definition: CbmMcbm2018UnpackerAlgoTof.cxx:535
CbmMcbm2018TofPar
Definition: CbmMcbm2018TofPar.h:18
CbmDeviceUnpackTofMcbm2018::fuNrOfChannelsPerGet4
UInt_t fuNrOfChannelsPerGet4
Definition: CbmDeviceUnpackTofMcbm2018.h:83
CbmDeviceUnpackTofMcbm2018::fiPulserMode
Int_t fiPulserMode
Definition: CbmDeviceUnpackTofMcbm2018.h:59
CbmMcbm2018TofPar::GetNrOfChannelsPerGet4
Int_t GetNrOfChannelsPerGet4()
Definition: CbmMcbm2018TofPar.h:70
CbmMcbm2018TofPar::GetSizeMsInNs
Double_t GetSizeMsInNs()
Definition: CbmMcbm2018TofPar.h:81
CbmMcbm2018TofPar::GetRpcType
Int_t GetRpcType(Int_t i)
Definition: CbmMcbm2018TofPar.h:75
gdpbv100::Message::getGdpbSysUnkwData
uint32_t getGdpbSysUnkwData() const
Definition: gDpbMessv100.h:255
CbmDeviceUnpackTofMcbm2018::InitContainers
Bool_t InitContainers()
Definition: CbmDeviceUnpackTofMcbm2018.cxx:292
CbmDeviceUnpackTofMcbm2018::fUnpackerAlgo
CbmMcbm2018UnpackerAlgoTof * fUnpackerAlgo
Processing algo.
Definition: CbmDeviceUnpackTofMcbm2018.h:232
CbmDeviceUnpackTofMcbm2018::fviRpcChUId
std::vector< Int_t > fviRpcChUId
Definition: CbmDeviceUnpackTofMcbm2018.h:184
CbmMcbm2018UnpackerAlgoTof::SetTimeOffsetNs
void SetTimeOffsetNs(Double_t dOffsetIn=0.0)
Definition: CbmMcbm2018UnpackerAlgoTof.h:65
CbmDeviceUnpackTofMcbm2018::CbmDeviceUnpackTofMcbm2018
CbmDeviceUnpackTofMcbm2018()
Definition: CbmDeviceUnpackTofMcbm2018.cxx:51
gdpbv100::Message::getGdpbGenChipId
uint16_t getGdpbGenChipId() const
Definition: gDpbMessv100.h:214
cbm::mq::Transition::DeviceReady
@ DeviceReady
CbmDeviceUnpackTofMcbm2018::HandleData
bool HandleData(FairMQMessagePtr &, int)
Definition: CbmDeviceUnpackTofMcbm2018.cxx:848
DetMask
const Int_t DetMask
Definition: CbmDeviceUnpackTofMcbm2018.cxx:49
CbmDeviceUnpackTofMcbm2018::fiSelectComponents
uint64_t fiSelectComponents
Definition: CbmDeviceUnpackTofMcbm2018.h:53
CbmDeviceUnpackTofMcbm2018::fhRawTDigEvT0
TH1 * fhRawTDigEvT0
Definition: CbmDeviceUnpackTofMcbm2018.h:147
pos
TVector3 pos
Definition: CbmMvdSensorDigiToHitTask.cxx:60
CbmDeviceUnpackTofMcbm2018::fuNrOfGet4PerFee
UInt_t fuNrOfGet4PerFee
Definition: CbmDeviceUnpackTofMcbm2018.h:82
gdpbv100::Message::getGdpbSysErrEdge
bool getGdpbSysErrEdge() const
Definition: gDpbMessv100.h:252
gdpbv100::SYS_PATTERN
@ SYS_PATTERN
Definition: gDpbMessv100.h:76
CbmDeviceUnpackTofMcbm2018::SetTimeOffsetNs
void SetTimeOffsetNs(Double_t dOffsetIn=0.0)
Definition: CbmDeviceUnpackTofMcbm2018.cxx:1726
CbmMcbm2018UnpackerAlgoTof::CreateHistograms
Bool_t CreateHistograms()
Definition: CbmMcbm2018UnpackerAlgoTof.cxx:1319
CbmDeviceUnpackTofMcbm2018::fhRawTRefDig0
TH1 * fhRawTRefDig0
Definition: CbmDeviceUnpackTofMcbm2018.h:150
CbmDeviceUnpackTofMcbm2018::fiPulTotMin
uint64_t fiPulTotMin
Definition: CbmDeviceUnpackTofMcbm2018.h:61
CbmMcbm2018TofPar::GetRpcSide
Int_t GetRpcSide(Int_t i)
Definition: CbmMcbm2018TofPar.h:76
CbmMcbm2018UnpackerAlgoTof::AddMsComponentToList
void AddMsComponentToList(size_t component, UShort_t usDetectorId)
Definition: CbmMcbm2018UnpackerAlgoTof.cxx:520
CbmTofDigi::GetTot
Double_t GetTot() const
Alias for GetCharge.
Definition: CbmTofDigi.h:120
CbmTofAddress::GetUniqueAddress
static UInt_t GetUniqueAddress(UInt_t Sm, UInt_t Rpc, UInt_t Channel, UInt_t Side=0, UInt_t SmType=0)
Definition: CbmTofAddress.h:124
CbmDeviceUnpackTofMcbm2018::fDigi
CbmTofDigi * fDigi
Definition: CbmDeviceUnpackTofMcbm2018.h:138
CbmDeviceUnpackTofMcbm2018::fhRawTRefDig1
TH1 * fhRawTRefDig1
Definition: CbmDeviceUnpackTofMcbm2018.h:151
gdpbv100::Message::getStarTokenStarD
uint32_t getStarTokenStarD() const
Definition: gDpbMessv100.h:280
CbmTofDigi::GetAddress
Int_t GetAddress() const
Inherited from CbmDigi.
Definition: CbmTofDigi.h:98
CbmDeviceUnpackTofMcbm2018::kuNbGet4PerGbtx
static const UInt_t kuNbGet4PerGbtx
Definition: CbmDeviceUnpackTofMcbm2018.h:169
CbmMQDefs.h
CbmDeviceUnpackTofMcbm2018::fuNrOfGet4
UInt_t fuNrOfGet4
Definition: CbmDeviceUnpackTofMcbm2018.h:86
gdpbv100::Message::getStarTsMsbStarB
uint64_t getStarTsMsbStarB() const
Definition: gDpbMessv100.h:269
CbmDeviceUnpackTofMcbm2018::fdMsSizeInNs
Double_t fdMsSizeInNs
Definition: CbmDeviceUnpackTofMcbm2018.h:75
cbm::mq::ChangeState
void ChangeState(FairMQDevice *device, cbm::mq::Transition transition)
Definition: CbmMQDefs.h:19
CbmDeviceUnpackTofMcbm2018::HandleParts
bool HandleParts(FairMQParts &, int)
Definition: CbmDeviceUnpackTofMcbm2018.cxx:876
gdpbv100::Message::getGdpbHitChanId
uint16_t getGdpbHitChanId() const
Definition: gDpbMessv100.h:219
CbmDeviceUnpackTofMcbm2018::fuTotalMsNb
size_t fuTotalMsNb
Definition: CbmDeviceUnpackTofMcbm2018.h:71
gdpbv100::Message::getMsgFullTime
uint64_t getMsgFullTime(uint64_t epoch) const
Returns expanded and adjusted time of message (in ns)
Definition: gDpbMessv100.cxx:98
CbmStar2019Algo::ClearVector
void ClearVector()
For unpacker algos.
Definition: CbmStar2019Algo.h:96
CbmDeviceUnpackTofMcbm2018::fhRawTotCh
std::vector< TH2 * > fhRawTotCh
Definition: CbmDeviceUnpackTofMcbm2018.h:153
CbmMcbm2018TofPar::GetNrOfGet4PerFee
Int_t GetNrOfGet4PerFee()
Definition: CbmMcbm2018TofPar.h:69
CbmMcbm2018UnpackerAlgoTof::GetParList
TList * GetParList()
Definition: CbmMcbm2018UnpackerAlgoTof.cxx:157
gdpbv100::GET4_V2X_ERR_UNPAIR_FALL
@ GET4_V2X_ERR_UNPAIR_FALL
Definition: gDpbMessv100.h:126
CbmDeviceUnpackTofMcbm2018::SendDigis
virtual bool SendDigis(std::vector< CbmTofDigi * >, int)
Definition: CbmDeviceUnpackTofMcbm2018.cxx:1569
CbmDeviceUnpackTofMcbm2018::fhRawTDigRef
TH1 * fhRawTDigRef
Definition: CbmDeviceUnpackTofMcbm2018.h:149
gdpbv100::Message::getGdpbSysErrUnused
uint16_t getGdpbSysErrUnused() const
Definition: gDpbMessv100.h:249
gdpbv100::Message::getGdpbHit32Tot
uint16_t getGdpbHit32Tot() const
Definition: gDpbMessv100.h:227
CbmDeviceUnpackTofMcbm2018::fdTShiftRef
Double_t fdTShiftRef
Definition: CbmDeviceUnpackTofMcbm2018.h:131
CbmDeviceUnpackTofMcbm2018::fiPulTotMax
uint64_t fiPulTotMax
Definition: CbmDeviceUnpackTofMcbm2018.h:62
CbmDeviceUnpackTofMcbm2018::CheckTimeslice
bool CheckTimeslice(const fles::Timeslice &ts)
Definition: CbmDeviceUnpackTofMcbm2018.cxx:1343
cbm::mq::Transition::Idle
@ Idle
CbmMcbm2018TofPar::GetNrOfFeesPerGdpb
Int_t GetNrOfFeesPerGdpb()
Definition: CbmMcbm2018TofPar.h:68
gdpbv100::GET4_V2X_ERR_EVT_DISCARD
@ GET4_V2X_ERR_EVT_DISCARD
Definition: gDpbMessv100.h:124
CbmDeviceUnpackTofMcbm2018::fulStarTsMid
ULong64_t fulStarTsMid
Definition: CbmDeviceUnpackTofMcbm2018.h:193
gdpbv100::Message::getStarDaqCmdStarD
uint32_t getStarDaqCmdStarD() const
Definition: gDpbMessv100.h:279
CbmDeviceUnpackTofMcbm2018::fuNrOfGdpbs
UInt_t fuNrOfGdpbs
Definition: CbmDeviceUnpackTofMcbm2018.h:80
CbmDeviceUnpackTofMcbm2018::fuOverlapMsNb
size_t fuOverlapMsNb
Definition: CbmDeviceUnpackTofMcbm2018.h:73
CbmStar2019Algo::SetIgnoreOverlapMs
void SetIgnoreOverlapMs(Bool_t bFlagIn=kTRUE)
Control flags.
Definition: CbmStar2019Algo.h:102
gdpbv100::SYS_GDPB_UNKWN
@ SYS_GDPB_UNKWN
Definition: gDpbMessv100.h:71