CbmRoot
CbmMcbm2018UnpackerAlgoTrdR.cxx
Go to the documentation of this file.
2 #include "CbmTrdAddress.h"
3 #include "CbmTrdHardwareSetupR.h"
4 #include "CbmTrdParModDigi.h"
5 #include "CbmTrdParSpadic.h"
6 
7 #include <Logger.h>
8 
9 #include "TH2I.h"
10 #include "TObjString.h"
11 #include "TProfile.h"
12 #include "TSystem.h"
13 #include "TVector3.h"
14 
15 #include <iostream>
16 #include <map>
17 
19  : CbmStar2019Algo()
20  //, fRawToDigi( new CbmTrdRawToDigiR )
21  , fdMsSizeInCC(0)
22  , fbMonitorMode(kFALSE)
23  , fbDebugMonitorMode(kFALSE)
24  , fbWriteOutput(kTRUE)
25  , fbDebugWriteOutput(kFALSE)
26  , fbBaselineAvg(kFALSE)
27  , fTrdDigiVector(nullptr)
28  , fTrdRawMessageVector(nullptr)
29  , fSpadicInfoMsgVector(nullptr)
30  //, fHistoMap()
31  , fIsActiveHistoVec(ECbmTrdUnpackerHistograms::kEndDefinedHistos, false)
32  , fHistoArray()
33  , fLastDigiTimeVec()
34  , fNbTimeslices(0)
35  , fCurrTsIdx(0)
36  , fMsIndex(0)
37  , fTsStartTime(0.0)
38  , fTsStopTimeCore(0.0)
39  , fMsTime(0.0)
40  , fSpadicEpoch(0)
41  , fLastFulltime(0)
42  , fNbSpadicRawMsg(0)
43  , fNbWildRda(0)
44  , fNbSpadicErrorMsg(0)
45  , fNbUnkownWord(0)
46  , fNbSpadicEpochMsg(0)
47  , fParContList(nullptr)
48  , fRefGeoTag("trd_v20a_mcbm")
49  , fAsicPar(nullptr)
50  , fDigiPar(nullptr)
51  , fGasPar(nullptr)
52  , fGainPar(nullptr)
53  , fSpadicMap()
54  , fAsicChannelMap()
55  , fIsFirstChannelsElinkEven(false) {}
56 
58  if (fTrdRawMessageVector != nullptr) { delete fTrdRawMessageVector; }
59  if (nullptr != fParCList) delete fParCList;
60  if (nullptr != fParContList) delete fParContList;
61 
62  if (nullptr != fAsicPar) delete fAsicPar;
63  if (nullptr != fDigiPar) delete fDigiPar;
64  if (nullptr != fGasPar) delete fGasPar;
65  if (nullptr != fGainPar) delete fGainPar;
66 }
67 
69  LOG(debug) << "Initializing CbmMcbm2018UnpackerAlgoTrdR";
70  //fRawToDigi->Init();
71  fbIgnoreOverlapMs = kTRUE;
72  // fdMsSizeInNs = 1.28e6; //FIXME time should come from parameter file
73  fdMsSizeInCC = fdMsSizeInNs / 62.5;
74 
75  return kTRUE;
76 }
77 
79  if (fTrdDigiVector) fTrdDigiVector->clear();
81 }
82 
84  LOG(info) << "Finish of CbmMcbm2018UnpackerAlgoTrdR. Unpacked \n "
85  << fNbTimeslices << " Timeslices with \n " << fNbSpadicRawMsg
86  << " Spadic Raw Messages,\n " << fNbSpadicEpochMsg
87  << " Spadic Epoch Messages,\n " << fNbSpadicErrorMsg
88  << " Spadic Info Messages,\n " << fNbWildRda
89  << " Unexpected RDA Words and\n " << fNbUnkownWord
90  << " Unknown Words.";
91 }
92 
93 // ---- InitContainers ----------------------------------------------------
95  LOG(debug) << "Initializing Containers of CbmMcbm2018UnpackerAlgoTrdR";
96 
97  Bool_t initOK = ReInitContainers();
98 
99  return initOK;
100 }
101 
102 // ---- ReInitContainers ----------------------------------------------------
104  LOG(debug) << "(Re-)Initializing Containers of CbmMcbm2018UnpackerAlgoTrdR";
105 
106  Bool_t initOk = kTRUE;
107 
108  if (!(fAsicPar =
109  (CbmTrdParSetAsic*) fParContList->FindObject("CbmTrdParSetAsic"))) {
110  LOG(warning) << "CbmTrdParSetAsic not found";
111  initOk = kFALSE;
112  }
113  if (!(fDigiPar =
114  (CbmTrdParSetDigi*) fParContList->FindObject("CbmTrdParSetDigi"))) {
115  LOG(warning) << "CbmTrdParSetDigi not found";
116  initOk = kFALSE;
117  }
118  if (!(fGasPar =
119  (CbmTrdParSetGas*) fParContList->FindObject("CbmTrdParSetGas"))) {
120  LOG(warning) << "CbmTrdParSetGas not found";
121  initOk = kFALSE;
122  }
123  if (!(fGainPar =
124  (CbmTrdParSetGain*) fParContList->FindObject("CbmTrdParSetGain"))) {
125  LOG(warning) << "CbmTrdParSetGain not found";
126  initOk = kFALSE;
127  }
128 
129  if (initOk) initOk = InitParameters();
130 
131  return initOk;
132 }
133 
134 // ---- GetParList ----------------------------------------------------
136  if (fParContList) {
137  return fParContList;
138  } else // create list with default parameters for trd
139  {
140  fParContList = new TList();
141 
142  fAsicPar = new CbmTrdParSetAsic();
143  fDigiPar = new CbmTrdParSetDigi();
144  fGasPar = new CbmTrdParSetGas();
145  fGainPar = new CbmTrdParSetGain();
146 
147  fParContList->Add(fAsicPar);
148  fParContList->Add(fDigiPar);
149  fParContList->Add(fGasPar);
150  fParContList->Add(fGainPar);
151 
152  return fParContList;
153  }
154 }
155 
156 // ---- InitParameters ----------------------------------------------------
158  Bool_t initOk = kTRUE;
159 
160  // Initialize the spadic address map
161  CbmTrdHardwareSetupR hwSetup;
163  initOk &=
164  !(fSpadicMap.empty()); // at least check that the loaded map is not empty
165  fAsicChannelMap = hwSetup.CreateAsicChannelMap(true);
166  initOk &= !(fAsicChannelMap
167  .empty()); // at least check that the loaded map is not empty
168  if (initOk)
169  LOG(debug) << "CbmMcbm2018UnpackerAlgoTrdR - Successfully initialized "
170  "Spadic hardware address map";
171  return initOk;
172 }
173 
174 Bool_t CbmMcbm2018UnpackerAlgoTrdR::ProcessTs(const fles::Timeslice& ts) {
175  fCurrTsIdx = ts.index();
176  fTsStartTime = static_cast<Double_t>(ts.descriptor(0, 0).idx);
177 
179  if (0 == fNbTimeslices) {
180  fuNbCoreMsPerTs = ts.num_core_microslices();
181  fuNbOverMsPerTs = ts.num_microslices(0) - ts.num_core_microslices();
184  LOG(info) << "CbmMcbm2018UnpackerAlgoTrdR::ProcessTs :";
185  LOG(info) << "Timeslice parameters: each TS has " << fuNbCoreMsPerTs
186  << " Core MS and " << fuNbOverMsPerTs
187  << " Overlap MS, for a core duration of " << fdTsCoreSizeInNs
188  << " ns and a full duration of " << fdTsFullSizeInNs << " ns";
189 
192  if (kFALSE == fbIgnoreOverlapMs) fuNbMsLoop += fuNbOverMsPerTs;
193  LOG(info) << "In each TS " << fuNbMsLoop << " MS will be looped over";
194  }
195 
197  for (UInt_t MsIndex = 0; MsIndex < fuNbMsLoop; MsIndex++) {
199  for (UInt_t uMsCompIdx = 0; uMsCompIdx < fvMsComponentsList.size();
200  ++uMsCompIdx) {
201  UInt_t uMsComp = fvMsComponentsList[uMsCompIdx];
202 
203  if (kFALSE == ProcessMs(ts, uMsComp, MsIndex)) {
206  std::sort(fTrdDigiVector->begin(),
207  fTrdDigiVector->end(),
208  [](const CbmTrdDigi& a, const CbmTrdDigi& b) -> bool {
209  return a.GetTime() < b.GetTime();
210  });
212  std::sort(fTrdRawMessageVector->begin(),
213  fTrdRawMessageVector->end(),
214  [](const CbmTrdRawMessageSpadic& a,
215  const CbmTrdRawMessageSpadic& b) -> bool {
216  return a.GetTime() < b.GetTime();
217  });
218  }
219 
220  LOG(error) << "Failed to process ts " << fCurrTsIdx << " MS " << MsIndex
221  << " for component " << uMsComp;
222  return kFALSE;
223  }
224  }
225  }
226 
228  std::sort(fTrdDigiVector->begin(),
229  fTrdDigiVector->end(),
230  [](const CbmTrdDigi& a, const CbmTrdDigi& b) -> bool {
231  return a.GetTime() < b.GetTime();
232  });
233 
234  fNbTimeslices++;
235  return kTRUE;
236 }
237 
238 Bool_t CbmMcbm2018UnpackerAlgoTrdR::ProcessMs(const fles::Timeslice& ts,
239  size_t uMsCompIdx,
240  size_t uMsIdx) {
241  fles::MicrosliceDescriptor msDesc = ts.descriptor(uMsCompIdx, uMsIdx);
242  // uint16_t msEquipmentID = msDesc.eq_id; ///< Equipment identifier. Specifies the FLES input link. #FU 27.03.20 unused
243  uint32_t msSize =
244  msDesc
245  .size;
246  // uint64_t msTime = msDesc.idx; ///< Start time of the microslice in ns since global time zero. #FU 27.03.20 unused
247  uint32_t msNbWords =
248  (msSize - (msSize % kBytesPerWord))
249  / kBytesPerWord;
250 
251  const uint8_t* msPointer =
252  reinterpret_cast<const uint8_t*>(ts.content(uMsCompIdx, uMsIdx));
253  const uint64_t* msContent = reinterpret_cast<const uint64_t*>(
254  msPointer);
255 
257  for (uint32_t iWord = 0; iWord < msNbWords; iWord++) {
258  uint64_t curWord = static_cast<uint64_t>(msContent[iWord]);
259  Spadic::MsMessageType wordType = GetMessageType(curWord);
260 
261  if (wordType == Spadic::MsMessageType::kSOM) {
262  //LOG(info) << "New Spadic Message!" ; //debug
263  CbmTrdRawMessageSpadic raw = CreateRawMessage(curWord, msDesc);
264  uint8_t nSamples = raw.GetNrSamples();
266  if (nSamples > 3) {
267  uint8_t nRda = GetNumRda(nSamples);
268  uint8_t curSample = 3; // first 3 samples are in som
270  for (uint8_t iRda = 0; iRda < nRda; iRda++) {
271  ++iWord;
272  curWord = static_cast<uint64_t>(msContent[(iWord)]);
274  LOG(error)
275  << "[CbmMcbm2018UnpackerAlgoTrdR::ProcessMs] Incomplete Spadic "
276  "Message! RDA Word missing, Microslice corrupted.";
277  return kFALSE;
278  }
280  for (uint8_t j = 0; curSample < nSamples && curSample < 32 && j < 7;
281  curSample++, j++) {
282  raw.SetSample(ExtractSample(curWord, curSample), curSample);
283  }
284  }
285  }
286  fNbSpadicRawMsg++;
287 
289  std::shared_ptr<CbmTrdDigi> digi = MakeDigi(raw);
290  if (digi) fTrdDigiVector->emplace_back(*digi);
292  if (fbDebugWriteOutput && (fTrdRawMessageVector != nullptr)) {
293  fTrdRawMessageVector->emplace_back(raw);
294  }
295 
298  FillHistograms(); // fill histograms not based on digi or rawMessage input
299  if (digi && fbMonitorMode)
300  if (!FillHistograms(*digi))
301  LOG(error)
302  << "Failed to fill CbmTrdDigi histograms"; // fill digi histograms
303  if (fbDebugMonitorMode)
304  if (!FillHistograms(raw))
305  LOG(error)
306  << "Failed to fill CbmTrdRawMessageSpadic histograms"; // fill rawMessage histograms
307  }
308  } // endif (wordType == kSOM )
309 
310  if (wordType == Spadic::MsMessageType::kRDA) {
311  LOG(error) << "[CbmMcbm2018UnpackerAlgoTrdR::ProcessMs] Unexpected RDA "
312  "Word. Microslice corrupted.";
313  fNbWildRda++;
314  return kFALSE;
315  }
316 
317  if (wordType == Spadic::MsMessageType::kINF) {
319  if (fbDebugWriteOutput && (fSpadicInfoMsgVector != nullptr)) {
320  fSpadicInfoMsgVector->emplace_back(
321  std::make_pair(fLastFulltime, curWord));
322  }
324 
325  Spadic::MsInfoType infoType = GetInfoType(curWord);
326  // "Spadic_Info_Types";
328  ((TH2I*) fHistoArray.At(kSpadic_Info_Types))
329  ->Fill(fLastFulltime, (Int_t) infoType);
330  }
331  }
332 
333  if (wordType == Spadic::MsMessageType::kNUL) {
334  if (iWord != (msNbWords - 1)) // last word in Microslice is 0.
335  {
336  LOG(error) << "[CbmMcbm2018UnpackerAlgoTrdR::ProcessMs] Null Word but "
337  "not at end of Microslice.";
338  }
339  }
340  if (wordType == Spadic::MsMessageType::kUNK) {
341  LOG(error) << "[CbmMcbm2018UnpackerAlgoTrdR::ProcessMs] Unknown Word. "
342  "Microslice corrupted.";
343  fNbUnkownWord++;
344  //return kFALSE ;
345  }
346 
347  if (wordType == Spadic::MsMessageType::kEPO) {
348  uint64_t mask = 0x3FFFFFFF;
349  mask = mask << 32;
350  uint64_t uTS_MSB = (uint64_t)((curWord & mask) >> 32);
351  Long64_t dt_epoch = uTS_MSB - fSpadicEpoch;
352  if (dt_epoch != 1)
353  LOG(debug4) << "[CbmMcbm2018UnpackerAlgoTrdR::ProcessMs] dt_epoch = "
354  << dt_epoch;
355 
356  //fLastFulltime = uTS_MSB;
358  fSpadicEpoch = uTS_MSB;
359  }
360 
361  } // end for (uint32_t iWord = 0; iWord < msNbWords; iWord++)
362 
363  return kTRUE;
364 }
365 
367  UShort_t usDetectorId) {
369  for (UInt_t uCompIdx = 0; uCompIdx < fvMsComponentsList.size(); ++uCompIdx)
370  if (component == fvMsComponentsList[uCompIdx]) return;
371 
373  fvMsComponentsList.emplace_back(component);
374 
375  LOG(info) << "CbmMcbm2018UnpackerAlgoTrdR::AddMsComponentToList => Component "
376  << component << " with detector ID 0x" << std::hex << usDetectorId
377  << std::dec << " added to list";
378 }
379 
381  size_t uOverlapMsNb) {
383  fuNbCoreMsPerTs = uCoreMsNb;
385  fuNbOverMsPerTs = uOverlapMsNb;
386 }
387 
389  if (!fbMonitorMode && !fbDebugMonitorMode) return kFALSE;
390 
391  fHistoArray.SetOwner(kTRUE);
392 
393  Bool_t createHistosOk = kTRUE;
394  Int_t iHisto(ECbmTrdUnpackerHistograms::kBeginDefinedHistos);
395  for (auto isActive : fIsActiveHistoVec) {
396  if (isActive) {
397  createHistosOk &= CreateHistogram((ECbmTrdUnpackerHistograms) iHisto);
398  }
399  iHisto++;
400  }
401 
402  return createHistosOk;
403 }
404 
405 // ---- CreateHistogram ----
406 Bool_t
408  Bool_t createHistoOk = kFALSE;
409  TString histName = "";
410  TH1* newHisto = nullptr;
411  std::map<Int_t, CbmTrdParMod*> parDigiModuleMap =
412  (std::map<Int_t, CbmTrdParMod*>) fDigiPar->GetModuleMap();
413  // Raw Message Histos still need to be separated into module wise histo
414  for (auto mapIt : parDigiModuleMap) {
415  CbmTrdParModDigi* parDigiModule = (CbmTrdParModDigi*) mapIt.second;
416  Int_t moduleId = parDigiModule->GetModuleId();
417  histName.Form("Module%d-", moduleId);
418  switch (iHisto) {
420  histName += "RawMessage_Signalshape_all";
421  newHisto = new TH2I(
422  histName.Data(), histName.Data(), 32, -0.5, 31.5, 512, -256.5, 255.5);
423  newHisto->SetXTitle("time [cc]");
424  newHisto->SetYTitle("Pulse height [ADC channels]");
425  break;
427  histName += "RawMessage_Signalshape_St";
428  newHisto = new TH2I(
429  histName.Data(), histName.Data(), 32, -0.5, 31.5, 512, -256.5, 255.5);
430  newHisto->SetXTitle("time [cc]");
431  newHisto->SetYTitle("Pulse height [ADC channels]");
432  break;
434  histName += "RawMessage_Signalshape_Nt";
435  newHisto = new TH2I(
436  histName.Data(), histName.Data(), 32, -0.5, 31.5, 512, -256.5, 255.5);
437  newHisto->SetXTitle("time [cc]");
438  newHisto->SetYTitle("Pulse height [ADC channels]");
439  break;
441  histName += "RawMessage_Signalshape_filtered";
442  newHisto = new TH2I(
443  histName.Data(), histName.Data(), 32, -0.5, 31.5, 512, -256.5, 255.5);
444  break;
446  histName += "RawDistributionMapModule5";
447  newHisto = new TH2I(
448  histName.Data(), histName.Data(), 42, -0.5, 41.5, 16, -0.5, 15.5);
449  break;
450  case kRawHitType:
451  histName += "RawHitTypes";
452  newHisto = new TH1I(histName.Data(),
453  histName.Data(),
454  ((Int_t) Spadic::TriggerType::kSandN + 1),
455  ((Int_t) Spadic::TriggerType::kGlobal - 0.5),
456  ((Int_t) Spadic::TriggerType::kSandN) + 0.5);
457  break;
458  case kRawPulserDeltaT:
459  histName += "RawPulserDeltaT";
460  newHisto =
461  new TH1I(histName.Data(), histName.Data(), 40000, 0, 4000000);
462  newHisto->SetXTitle("#Delta t [cc]");
463  newHisto->SetYTitle("Counts");
464  break;
465  case kSpadic_Info_Types:
466  histName += "Spadic_Info_Types";
467  newHisto = new TH2I(
468  histName.Data(), histName.Data(), 500000, 0, 5e9, 5, -0.5, 4.5);
469  ((TH2I*) newHisto)->SetXTitle("t /Clockcycles");
470  ((TH2I*) newHisto)->SetYTitle("messagetype");
471  ((TH2I*) newHisto)->GetYaxis()->SetBinLabel(1, "BOM");
472  ((TH2I*) newHisto)->GetYaxis()->SetBinLabel(2, "MSB");
473  ((TH2I*) newHisto)->GetYaxis()->SetBinLabel(3, "BUF");
474  ((TH2I*) newHisto)->GetYaxis()->SetBinLabel(4, "UNU");
475  ((TH2I*) newHisto)->GetYaxis()->SetBinLabel(5, "MIS");
476  break;
477  case kDigiPulserDeltaT:
478  histName += "DigiPulserDeltaT";
479  newHisto = new TH1I(histName.Data(), histName.Data(), 60000, 0, 6e8);
480  newHisto->SetXTitle("#Delta t [ns]");
481  newHisto->SetYTitle("Counts");
482  break;
483  case kDigiDeltaT:
484  histName += "DigiDeltaT";
485  newHisto =
486  new TH1I(histName.Data(), histName.Data(), 6000, -10, ((6e7) - 10));
487  // FIXME this should be more flexibel and made available for all modules of a given geometry
488  fLastDigiTimeVec = std::vector<std::uint64_t>(
489  ((CbmTrdParModDigi*) fDigiPar->GetModulePar(5))->GetNofColumns()
490  * ((CbmTrdParModDigi*) fDigiPar->GetModulePar(5))->GetNofRows(),
491  0);
492  newHisto->SetXTitle("#Delta t [ns]");
493  newHisto->SetYTitle("Counts");
494  break;
496  histName += "DigiMeanHitFrequency";
497  newHisto = new TProfile(
498  histName.Data(),
499  histName.Data(),
500  parDigiModule->GetNofColumns() * parDigiModule->GetNofRows(),
501  -0.5,
502  parDigiModule->GetNofColumns() * parDigiModule->GetNofRows() - 0.5);
503  // FIXME this should be more flexibel and made available for all modules of a given geometry
504  fLastDigiTimeVec = std::vector<std::uint64_t>(
505  ((CbmTrdParModDigi*) fDigiPar->GetModulePar(5))->GetNofColumns()
506  * ((CbmTrdParModDigi*) fDigiPar->GetModulePar(5))->GetNofRows(),
507  0);
508  newHisto->SetXTitle("Pad-Channel");
509  newHisto->SetYTitle("Hit frequency [kHz]");
510  break;
512  histName += "DigiDistributionMap";
513  newHisto = new TH2I(histName.Data(),
514  histName.Data(),
515  parDigiModule->GetNofColumns(),
516  -0.5,
517  (parDigiModule->GetNofColumns() - 0.5),
518  parDigiModule->GetNofRows(),
519  -0.5,
520  (parDigiModule->GetNofRows() - 0.5));
521  // newHisto = new TH2I(histName.Data(), histName.Data(), 128, -0.5, 127.5, 6, -0.5, 5.5); // invert row value since they are count from top to bottom
522  newHisto->SetXTitle("Pad column");
523  newHisto->SetYTitle("Pad row");
524  break;
526  histName += "DigiDistributionMapSt";
527  newHisto = new TH2I(histName.Data(),
528  histName.Data(),
529  parDigiModule->GetNofColumns(),
530  -0.5,
531  (parDigiModule->GetNofColumns() - 0.5),
532  parDigiModule->GetNofRows(),
533  -0.5,
534  (parDigiModule->GetNofRows() - 0.5));
535  // newHisto = new TH2I(histName.Data(), histName.Data(), 128, -0.5, 127.5, 6, -0.5, 5.5); // invert row value since they are count from top to bottom
536  newHisto->SetXTitle("Pad column");
537  newHisto->SetYTitle("Pad row");
538  break;
540  histName += "DigiDistributionMapNt";
541  newHisto = new TH2I(histName.Data(),
542  histName.Data(),
543  parDigiModule->GetNofColumns(),
544  -0.5,
545  (parDigiModule->GetNofColumns() - 0.5),
546  parDigiModule->GetNofRows(),
547  -0.5,
548  (parDigiModule->GetNofRows() - 0.5));
549  // newHisto = new TH2I(histName.Data(), histName.Data(), 128, -0.5, 127.5, 6, -0.5, 5.5); // invert row value since they are count from top to bottom
550  newHisto->SetXTitle("Pad column");
551  newHisto->SetYTitle("Pad row");
552  break;
553  case kDigiChargeSpectrum:
554  histName += "DigiChargeSpectrum";
555  newHisto = new TH1I(histName.Data(), histName.Data(), 512, 0, 512);
556  newHisto->SetYTitle("Counts");
557  newHisto->SetXTitle("MaxAdc [ADC channels]");
558  break;
560  histName += "DigiChargeSpectrumSt";
561  newHisto = new TH1I(histName.Data(), histName.Data(), 512, 0, 512);
562  newHisto->SetYTitle("Counts");
563  newHisto->SetXTitle("MaxAdc [ADC channels]");
564  break;
566  histName += "DigiChargeSpectrumNt";
567  newHisto = new TH1I(histName.Data(), histName.Data(), 512, 0, 512);
568  newHisto->SetYTitle("Counts");
569  newHisto->SetXTitle("MaxAdc [ADC channels]");
570  break;
572  histName += "DigiRelativeTimeMicroslice";
573  newHisto = new TH1D(
574  histName.Data(), histName.Data(), fdMsSizeInNs, 0, fdMsSizeInNs);
575  break;
576  case kDigiTriggerType:
577  histName += "DigiTriggerType";
578  newHisto = new TH1I(histName.Data(),
579  histName.Data(),
581  -0.5,
582  (CbmTrdDigi::kNTrg - 0.5));
583  break;
584  case kDigiHitFrequency:
585  histName += "DigiHitFrequency";
586  newHisto =
587  new TProfile(histName.Data(), histName.Data(), 100000, 0, 100000);
588  newHisto->SetXTitle("Timeslice");
589  newHisto->SetYTitle("#langle hit frequency #rangle");
590  break;
591  default: return createHistoOk; break;
592  }
593  LOG(debug4) << Form(
594  "UnpackerTrdAlgo - Histo[%d]-%s - initialize", iHisto, histName.Data());
595  if (newHisto) {
596  TString moduleName(Form("%d", moduleId));
597  if (iHisto < kBeginDigiHistos) {
598  fHistoArray.AddAtAndExpand(newHisto, iHisto);
599  } else {
600  Int_t bitShift = Int_t(std::log2(std::double_t(kEndDefinedHistos))) + 1;
601  Int_t histoPosition = moduleId << bitShift;
602  histoPosition += iHisto;
603  if (iHisto >= kBeginDigiHistos)
604  fHistoArray.AddAtAndExpand(newHisto, histoPosition);
605  }
606  // If new HistosTypes are added, they need to be added here!
607  if (newHisto->IsA() == TProfile::Class())
608  AddHistoToVector((TProfile*) newHisto, moduleName.Data());
609 
610  if (newHisto->IsA() == TH2I::Class())
611  AddHistoToVector((TH2I*) newHisto, moduleName.Data());
612 
613  if (newHisto->IsA() == TH1I::Class())
614  AddHistoToVector((TH1I*) newHisto, moduleName.Data());
615 
616  if (newHisto->IsA() == TH1D::Class())
617  AddHistoToVector((TH1D*) newHisto, moduleName.Data());
618 
619  createHistoOk = kTRUE;
620  }
621  }
622  return createHistoOk;
623 }
624 
626 
627 // ---- FillHistograms(CbmTrdDigi) ----
629  Bool_t isOkFill = kTRUE;
630  Int_t channelAddress = digi.GetAddressChannel();
631  Int_t histoBaseId =
632  digi.GetAddressModule()
633  << (Int_t(std::log2(std::double_t(kEndDefinedHistos))) + 1);
634  //Digi position monitoring
638  CbmTrdParModDigi* parModDigi =
640  Int_t rotatedAddress =
641  parModDigi->GetOrientation() == 2
642  ? (channelAddress * (-1)
643  + (parModDigi->GetNofRows() * parModDigi->GetNofColumns()) - 1)
644  : channelAddress;
645  Int_t row = parModDigi->GetPadRow(rotatedAddress);
646  Int_t column = parModDigi->GetPadColumn(rotatedAddress);
647 
648  // "DigiDistributionModule5"
650  ((TH2I*) fHistoArray.At(histoBaseId + kDigiDistributionMap))
651  ->Fill(column, row);
652  }
654  if (digi.GetAddressModule() == 5
655  && digi.GetTriggerType() == CbmTrdDigi::kSelf)
656  ((TH2I*) fHistoArray.At(histoBaseId + kDigiDistributionMapSt))
657  ->Fill(column, row);
658  }
660  if (digi.GetAddressModule() == 5
662  ((TH2I*) fHistoArray.At(histoBaseId + kDigiDistributionMapNt))
663  ->Fill(column, row);
664  }
665  }
666  // "DigiRelativeTinTimeslice"
668  std::uint64_t digiTime = digi.GetTime();
669  std::uint64_t deltaT =
670  digiTime - (fSpadicEpoch * fdMsSizeInCC * 62.5); // in clockcycles
671  ((TH1D*) fHistoArray.At(histoBaseId + kDigiRelativeTimeMicroslice))
672  ->Fill(deltaT);
673  }
674  // "kDigiChargeSpectrum"
676  ((TH1I*) fHistoArray.At(histoBaseId + kDigiChargeSpectrum))
677  ->Fill(digi.GetCharge());
678  }
679  // "kDigiChargeSpectrumSt"
681  if (digi.GetTriggerType() == CbmTrdDigi::kSelf)
682  ((TH1I*) fHistoArray.At(histoBaseId + kDigiChargeSpectrumSt))
683  ->Fill(digi.GetCharge());
684  }
685  // "kDigiChargeSpectrumNt"
688  ((TH1I*) fHistoArray.At(histoBaseId + kDigiChargeSpectrumNt))
689  ->Fill(digi.GetCharge());
690  }
691  // "kDigiChargeSpectrumNt"
693  ((TH1I*) fHistoArray.At(histoBaseId + kDigiTriggerType))
694  ->Fill(digi.GetTriggerType());
695  }
696 
697 
698  // "kDigiDeltaT" // DigiPulserDeltaT // "kDigiMeanHitFrequency" // FIXME this works currently with only one module
701  std::uint64_t dt =
702  ((std::uint64_t) digi.GetTime() - fLastDigiTimeVec.at(channelAddress));
703  if (dt > 0) {
704  // "kDigiDeltaT"
706  ((TH1I*) fHistoArray.At(histoBaseId + kDigiDeltaT))->Fill(dt);
707  }
708  // "kDigiMeanHitFrequency"
710  if (dt > 0 && dt < fdTsFullSizeInNs) {
711  Double_t hitFreq = (Double_t) dt;
712  hitFreq *= 1e-9;
713  hitFreq = 1.0 / hitFreq;
714  hitFreq /= 1000.0;
715  ((TProfile*) fHistoArray.At(histoBaseId + kDigiMeanHitFrequency))
716  ->Fill(channelAddress, hitFreq);
717  }
718  }
719  // DigiPulserDeltaT
721  Int_t pulserChannelAddress(663); // status 03/27/2020
722  Int_t pulserModule(5); // status 03/27/2020
723  if (channelAddress == pulserChannelAddress
724  && digi.GetAddressModule() == pulserModule
725  && digi.GetTriggerType() == CbmTrdDigi::kSelf) {
726  ((TH1I*) fHistoArray.At(histoBaseId + kDigiPulserDeltaT))->Fill(dt);
727  }
728  }
729  // "kDigiMeanHitFrequency"
731  if (dt > 0 && dt < fdTsFullSizeInNs) {
732  Int_t tsCounter =
734  % ((TProfile*) fHistoArray.At(histoBaseId + kDigiHitFrequency))
735  ->GetNbinsX();
736  Double_t hitFreq = (Double_t) dt;
737  hitFreq *= 1e-9;
738  hitFreq = 1.0 / hitFreq;
739  hitFreq /= 1000.0;
740  ((TProfile*) fHistoArray.At(histoBaseId + kDigiHitFrequency))
741  ->Fill(tsCounter, hitFreq);
742  if (tsCounter == 0)
743  ((TProfile*) fHistoArray.At(histoBaseId + kDigiHitFrequency))
744  ->Reset();
745  }
746  }
747  fLastDigiTimeVec.at(channelAddress) = (std::uint64_t) digi.GetTime();
748  }
749  }
750  return isOkFill;
751 }
752 
753 // ---- FillHistograms(CbmTrdSpadicRawMessage) ----
754 Bool_t
756  Bool_t isOkFill = kTRUE;
757  // "RawMessage_Signalshape_filtered"
759  if (raw.GetHitType() < 2 && !raw.GetMultiHit()) {
760  for (unsigned int i = 0; i < raw.GetSamples().size(); i++) {
762  ->Fill(i, raw.GetSamples()[i]);
763  }
764  }
765  }
766  // "RawMessage_Signalshape_all"
768  for (unsigned int i = 0; i < raw.GetSamples().size(); i++) {
769  //fHistoMap.at(HistName.Data())->Fill(i, raw.GetSamples()[i]);
771  ->Fill(i, raw.GetSamples()[i]);
772  }
773  }
774  // "kRawMessage_Signalshape_St"
776  for (unsigned int i = 0; i < raw.GetSamples().size(); i++) {
777  if (raw.GetHitType() == (Int_t) Spadic::TriggerType::kSelf
778  || raw.GetHitType() == (Int_t) Spadic::TriggerType::kSandN)
780  ->Fill(i, raw.GetSamples()[i]);
781  }
782  }
783  // "kRawMessage_Signalshape_Nt"
785  for (unsigned int i = 0; i < raw.GetSamples().size(); i++) {
786  if (raw.GetHitType() == (Int_t) Spadic::TriggerType::kNeigh)
788  ->Fill(i, raw.GetSamples()[i]);
789  }
790  }
791  // "RawDistributionMapModule5"
794  ->Fill(raw.GetElinkId(), raw.GetChannelId());
795  }
796  // "kRawHitType"
798  ((TH1I*) fHistoArray.At(kRawHitType))->Fill(raw.GetHitType());
799  }
800  // "RawPulserDeltaT"
802  std::uint8_t pulserChannelId = 0; // status 03/27/2020
803  std::uint8_t pulserElinkId = 29; // status 03/27/2020
804  if (raw.GetChannelId() == pulserChannelId
805  && raw.GetElinkId() == pulserElinkId) {
806  Long64_t dt = ((Long64_t) raw.GetFullTime() - (Long64_t) fLastFulltime);
807  ((TH1I*) fHistoArray.At(kRawPulserDeltaT))->Fill(dt);
808  fLastFulltime = raw.GetFullTime();
809  }
810  }
811  return isOkFill;
812 }
813 
814 
816  /*
817  for ( auto &it : fHistoMap )
818  {
819  it.second->Reset() ;
820  }
821  */
822 
823  for (auto it = fHistoArray.begin(); it != fHistoArray.end(); ++it) {
824  ((TH1*) *it)->Reset();
825  }
826  return kTRUE;
827 }
828 
830  std::vector<CbmTrdDigi>* const pVector) {
831  if (nullptr == fTrdDigiVector) {
832  fTrdDigiVector = pVector;
833  return kTRUE;
834  } else {
835  return kFALSE;
836  }
837 }
838 
840  std::vector<CbmTrdRawMessageSpadic>* const pVector,
841  std::vector<std::pair<std::uint64_t, std::uint64_t>>* const qVector) {
842  Bool_t ret = 1;
843  if (nullptr == fTrdRawMessageVector) {
844  fTrdRawMessageVector = pVector;
845  } else {
846  ret &= 0;
847  }
848 
849  if (qVector != nullptr && fSpadicInfoMsgVector == nullptr) {
850  fSpadicInfoMsgVector = qVector;
851  } else {
852  ret &= 0;
853  }
854  return ret;
855 }
856 
857 // --------- private: -----------
858 
859 std::shared_ptr<CbmTrdDigi>
861  Int_t digiAddress = -1;
862  Float_t digiCharge =
863  (Float_t) raw.GetMaxAdc()
864  + 256; // REMARK raw.GetMaxADC returns a the value in the range of -256 til 255. However, the digiCharge is stored as unsigned. // TODO make Settable
865  ULong64_t digiTime = raw.GetTime() - fdTimeOffsetNs;
866  // Int_t digiTriggerType = raw.GetHitType() ; // Spadic::TriggerType this does not work 03/27/2020 - PR digiTriggerType is not Spadic::TriggerType!
867  Int_t digiTriggerType = raw.GetHitType();
868  if (digiTriggerType == 1)
869  digiTriggerType = 0; // Shift self trigger to digi selftrigger
870  if (digiTriggerType == 2)
871  digiTriggerType = 1; // Shift neighbour trigger to digi neighbour
872  if (digiTriggerType == 3) digiTriggerType = 0; // Hide spadic kSandN in Self
873 
874  Int_t digiErrClass = 0;
875 
876  std::uint64_t spadicHwAddress(0);
877  spadicHwAddress = (raw.GetElinkId())
880  Int_t asicAddress(0);
881  auto mapIt = fSpadicMap.find(spadicHwAddress); // check if asic exists
882  if (mapIt == fSpadicMap.end()) {
883  LOG(debug4) << Form("CbmMcbm2018UnpackerAlgoTrdR::MakeDigi - No asic "
884  "address found for Spadic hardware address %lu",
885  spadicHwAddress);
886  return nullptr;
887  }
888  asicAddress = mapIt->second;
889  Int_t uniqueModuleId = asicAddress / 1000;
890  // Int_t layerId(CbmTrdAddress::GetLayerId(uniqueModuleId));
891  // Int_t moduleId(CbmTrdAddress::GetModuleId(uniqueModuleId));
892 
893  // GetChannelId per eLink add NSPADICCH / 2 to the second(first) eLink in the case we start with odd(even) eLinks, since, our mapping is based on odd eLinks
894  auto asicChannelId = (raw.GetElinkId() % 2) == fIsFirstChannelsElinkEven
895  ? raw.GetChannelId()
896  : raw.GetChannelId() + (NSPADICCH / 2);
897 
898  digiAddress = (fAsicChannelMap.find(asicAddress))->second.at(asicChannelId);
899 
900  std::shared_ptr<CbmTrdDigi> digi =
901  std::make_shared<CbmTrdDigi>(CbmTrdDigi(digiAddress,
902  uniqueModuleId,
903  digiCharge,
904  digiTime,
905  digiTriggerType,
906  digiErrClass));
907 
908  return digi;
909 }
910 
913  if ((msg >> 61) == 1) // SOM 001. ....
914  {
916  } else if ((msg >> 63) == 1) // RDA 1... ....
917  {
919  } else if ((msg >> 62) == 1) // Epoch 01.. ....
920  {
922  } else if ((msg >> 60) == 1) // Spadic Info Message 0001 ....
923  {
925  } else if (msg == 0) // Last Word in a Microslice is 0
926  {
928  } else // not a spadic message
929  {
931  }
932 }
933 
936  uint64_t mask = 0x000FFFFF;
937 
938  if (((msg & mask) >> 18) == 3) // BOM
939  {
941  }
942  if (((msg & mask) >> 17) == 2) // MSB
943  {
945  }
946  if (((msg & mask) >> 17) == 3) // BUF
947  {
949  }
950  if (((msg & mask) >> 17) == 4) // UNU
951  {
953  }
954  if (((msg & mask) >> 17) == 5) // MIS
955  {
957  } else {
958  LOG(error) << "[CbmMcbm2018UnpackerAlgoTrdR::GetInfoType] unknown type!";
960  }
961 }
962 
964  const uint64_t word,
965  fles::MicrosliceDescriptor msDesc) {
967  LOG(error)
968  << "[CbmMcbm2018UnpackerAlgoTrdR::CreateRawMessage] Not a SOM word!";
969  return CbmTrdRawMessageSpadic();
970  }
972  uint8_t elinkId = 0, chId = 0, crobId = 0;
973  uint16_t criId = msDesc.eq_id;
974  // char crobId = msDesc.crob_id; // TODO this needs to be implemented into microslice! - PR 03.2020
975  uint8_t hitType = 0, nSamples = 0;
976  bool multihit = false;
977  uint16_t timestamp = 0;
978  uint64_t mask = 0x3F;
979  mask = mask << 55;
980  elinkId = (char) ((word & mask) >> 55);
981  //extract chID
982  mask = 0xF;
983  mask = mask << 51;
984  chId = (char) ((word & mask) >> 51);
985  //extract timestamp
986  mask = 0xFFFF;
987  mask = mask << 35;
988  timestamp = (uint16_t)((word & mask) >> 35);
989  //extract hitType
990  mask = 0x3;
991  mask = mask << 33;
992  hitType = (uint8_t)((word & mask) >> 33);
993  //extract MultiHit
994  mask = 0x1;
995  mask = mask << 32;
996  multihit = (bool) ((word & mask) >> 32);
997  //extract nrSamples
998  mask = 0x1F;
999  mask = mask << 27;
1000  nSamples = (uint8_t)((word & mask) >> 27);
1001  nSamples += 1; //spadic counts from 0 to 31
1002 
1003  // get the correct fulltime
1004  uint64_t fulltime =
1005  timestamp
1006  + (fSpadicEpoch * fdMsSizeInCC); // this is in units of clock cycles
1007  //uint64_t epoch = fSpadicEpoch >> 3 ;
1008 
1009 
1010  // put the first 3 samples, contained in som, into the message.
1011  std::vector<int16_t> samples;
1012  for (int i = 0; i < nSamples && i < 3; i++) {
1013  samples.emplace_back(ExtractSample(word, i, multihit));
1014  }
1015 
1016  // Create message
1017  CbmTrdRawMessageSpadic retval(chId,
1018  elinkId,
1019  crobId,
1020  criId,
1021  hitType,
1022  nSamples,
1023  multihit,
1024  fulltime,
1025  samples);
1026  return retval;
1027 }
1028 
1030  if (nsamples < 4)
1031  return 0;
1032  else if (nsamples < 11)
1033  return 1;
1034  else if (nsamples < 18)
1035  return 2;
1036  else if (nsamples < 25)
1037  return 3;
1038  else if (nsamples < 32)
1039  return 4;
1040  else
1041  return 5;
1042 }
1043 
1045  uint8_t sample,
1046  Bool_t multihit) {
1047  const std::array<uint16_t, 32> indices {{4, 5, 6, 0, 1, 2, 3, 4, 5, 6, 0,
1048  1, 2, 3, 4, 5, 6, 0, 1, 2, 3, 4,
1049  5, 6, 0, 1, 2, 3, 4, 5, 6, 0}};
1050  uint64_t mask = 0x1FF;
1053  LOG(error)
1054  << "[CbmMcbm2018UnpackerAlgoTrdR::ExtractSample] Wrong Message Type!";
1055  return -256;
1056  }
1057 
1058  if ((GetMessageType(word) == Spadic::MsMessageType::kSOM) && (sample > 2)) {
1059  LOG(error)
1060  << "[CbmMcbm2018UnpackerAlgoTrdR::ExtractSample] Wrong sample index!";
1061  return -256;
1062  }
1064  && (sample < 3 || sample > 31)) {
1065  LOG(error)
1066  << "[CbmMcbm2018UnpackerAlgoTrdR::ExtractSample] Wrong sample index!";
1067  return -256;
1068  }
1069  uint16_t index = indices[sample];
1070 
1071  mask = mask << (9 * (6 - index));
1072  uint64_t temp = word & mask;
1073  temp = temp >> (6 - index) * 9;
1074  if (fbBaselineAvg && (sample == 0) && !(multihit)) {
1082  temp = temp >> 2;
1083  temp ^= (-0 ^ temp) & (1 << 7);
1084  temp ^= (-1 ^ temp) & (1 << 8);
1085  }
1086  struct {
1087  signed int x : 9;
1088  } s;
1089  int16_t result = s.x = temp;
1090  return result;
1091 }
1092 
CbmMcbm2018UnpackerAlgoTrdR::Finish
virtual void Finish()
Definition: CbmMcbm2018UnpackerAlgoTrdR.cxx:83
CbmTrdRawMessageSpadic::GetTime
Double_t GetTime() const
Definition: CbmTrdRawMessageSpadic.h:121
CbmTrdRawMessageSpadic::GetMultiHit
bool GetMultiHit() const
Definition: CbmTrdRawMessageSpadic.h:116
CbmMcbm2018UnpackerAlgoTrdR::kDigiTriggerType
@ kDigiTriggerType
Definition: CbmMcbm2018UnpackerAlgoTrdR.h:98
Spadic::MsInfoType::kUNU
@ kUNU
Unused request. 100. .... .... .... cccc.
CbmMcbm2018UnpackerAlgoTrdR::kDigiMeanHitFrequency
@ kDigiMeanHitFrequency
Definition: CbmMcbm2018UnpackerAlgoTrdR.h:88
CbmMcbm2018UnpackerAlgoTrdR::GetMessageType
Spadic::MsMessageType GetMessageType(const uint64_t msg)
Definition: CbmMcbm2018UnpackerAlgoTrdR.cxx:912
CbmMcbm2018UnpackerAlgoTrdR::ECbmTrdUnpackerHistograms
ECbmTrdUnpackerHistograms
Definition: CbmMcbm2018UnpackerAlgoTrdR.h:74
CbmMcbm2018UnpackerAlgoTrdR::GetInfoType
Spadic::MsInfoType GetInfoType(const uint64_t msg)
Definition: CbmMcbm2018UnpackerAlgoTrdR.cxx:935
CbmTrdRawMessageSpadic::GetFullTime
std::uint64_t GetFullTime() const
Definition: CbmTrdRawMessageSpadic.h:117
CbmMcbm2018UnpackerAlgoTrdR::fNbTimeslices
ULong64_t fNbTimeslices
Instance of RawToDigi class.
Definition: CbmMcbm2018UnpackerAlgoTrdR.h:233
CbmMcbm2018UnpackerAlgoTrdR::kDigiChargeSpectrum
@ kDigiChargeSpectrum
Definition: CbmMcbm2018UnpackerAlgoTrdR.h:95
CbmMcbm2018UnpackerAlgoTrdR::fGainPar
CbmTrdParSetGain * fGainPar
CbmTrdParameter container.
Definition: CbmMcbm2018UnpackerAlgoTrdR.h:263
CbmMcbm2018UnpackerAlgoTrdR::InitParameters
Bool_t InitParameters()
Definition: CbmMcbm2018UnpackerAlgoTrdR.cxx:157
CbmStar2019Algo< CbmTrdDigi >::fdMsSizeInNs
Double_t fdMsSizeInNs
/‍** Ignore Overlap Ms: all fuOverlapMsNb MS at the end of timeslice **‍/
Definition: CbmStar2019Algo.h:117
CbmTrdAddress.h
Helper class to convert unique channel ID back and forth.
CbmMcbm2018UnpackerAlgoTrdR::fbDebugWriteOutput
Bool_t fbDebugWriteOutput
If ON the raw messages output vector is filled and written to disk.
Definition: CbmMcbm2018UnpackerAlgoTrdR.h:199
CbmMcbm2018UnpackerAlgoTrdR::kRawHitType
@ kRawHitType
Definition: CbmMcbm2018UnpackerAlgoTrdR.h:81
CbmMcbm2018UnpackerAlgoTrdR::fNbSpadicErrorMsg
ULong64_t fNbSpadicErrorMsg
Number of Spadic error Messages.
Definition: CbmMcbm2018UnpackerAlgoTrdR.h:250
CbmMcbm2018UnpackerAlgoTrdR::kBytesPerWord
static const UInt_t kBytesPerWord
Constants.
Definition: CbmMcbm2018UnpackerAlgoTrdR.h:272
CbmMcbm2018UnpackerAlgoTrdR::fDigiPar
CbmTrdParSetDigi * fDigiPar
CbmTrdParameter container.
Definition: CbmMcbm2018UnpackerAlgoTrdR.h:261
CbmTrdDigi::kNeighbor
@ kNeighbor
Definition: CbmTrdDigi.h:20
CbmStar2019Algo< CbmTrdDigi >::fuNbMsLoop
size_t fuNbMsLoop
Definition: CbmStar2019Algo.h:114
Spadic::MsMessageType::kNUL
@ kNUL
Microslice End. 0x0000000000000000 Last Word in a Microslice is 64 zeros.
CbmTrdParSetGas
Describe TRD module working settings (HV, etc)
Definition: CbmTrdParSetGas.h:15
CbmTrdRawMessageSpadic::SetSample
void SetSample(std::int16_t value, std::uint8_t pos)
Definition: CbmTrdRawMessageSpadic.cxx:70
CbmTrdParModDigi::GetNofRows
Int_t GetNofRows() const
Definition: CbmTrdParModDigi.cxx:340
CbmTrdRawMessageSpadic
Base class for storing raw information which comes from the Spadic v2.2 trough flib or from a tsa fil...
Definition: CbmTrdRawMessageSpadic.h:68
CbmTrdRawMessageSpadic::GetMaxAdc
int16_t GetMaxAdc()
Definition: CbmTrdRawMessageSpadic.cxx:64
Spadic::MsMessageType::kUNK
@ kUNK
Unkown Word.
CbmTrdParMod::GetModuleId
virtual Int_t GetModuleId() const
Definition: CbmTrdParMod.h:15
CbmTrdRawMessageSpadic::GetSamples
const std::vector< std::int16_t > GetSamples() const
Definition: CbmTrdRawMessageSpadic.h:118
CbmMcbm2018UnpackerAlgoTrdR::fTrdRawMessageVector
std::vector< CbmTrdRawMessageSpadic > * fTrdRawMessageVector
Output Spadic raw messages for debugging.
Definition: CbmMcbm2018UnpackerAlgoTrdR.h:212
CbmMcbm2018UnpackerAlgoTrdR::fAsicPar
CbmTrdParSetAsic * fAsicPar
CbmTrdParameter container.
Definition: CbmMcbm2018UnpackerAlgoTrdR.h:260
CbmMcbm2018UnpackerAlgoTrdR::fLastDigiTimeVec
std::vector< std::uint64_t > fLastDigiTimeVec
Definition: CbmMcbm2018UnpackerAlgoTrdR.h:222
CbmTrdDigi::GetAddressChannel
Int_t GetAddressChannel() const
Getter read-out id.
Definition: CbmTrdDigi.cxx:119
CbmMcbm2018UnpackerAlgoTrdR::kRawMessage_Signalshape_all
@ kRawMessage_Signalshape_all
Definition: CbmMcbm2018UnpackerAlgoTrdR.h:76
i
int i
Definition: L1/vectors/P4_F32vec4.h:25
CbmMcbm2018UnpackerAlgoTrdR::GetNumRda
Int_t GetNumRda(Int_t nsamples)
Definition: CbmMcbm2018UnpackerAlgoTrdR.cxx:1029
CbmMcbm2018UnpackerAlgoTrdR::kDigiPulserDeltaT
@ kDigiPulserDeltaT
Definition: CbmMcbm2018UnpackerAlgoTrdR.h:85
CbmTrdParSetAsic
Describe TRD module ASIC settings (electronic gain, delays, etc)
Definition: CbmTrdParSetAsic.h:18
CbmStar2019Algo< CbmTrdDigi >::fuNbOverMsPerTs
size_t fuNbOverMsPerTs
Definition: CbmStar2019Algo.h:113
CbmMcbm2018UnpackerAlgoTrdR::SetRawOutputPointer
Bool_t SetRawOutputPointer(std::vector< CbmTrdRawMessageSpadic > *const pVector, std::vector< std::pair< std::uint64_t, std::uint64_t >> *const qVector=nullptr)
Set fTrdRawMessageVector to the address of pVector.
Definition: CbmMcbm2018UnpackerAlgoTrdR.cxx:839
CbmMcbm2018UnpackerAlgoTrdR::fHistoArray
TObjArray fHistoArray
Definition: CbmMcbm2018UnpackerAlgoTrdR.h:221
CbmTrdDigi::kSelf
@ kSelf
Definition: CbmTrdDigi.h:19
CbmMcbm2018UnpackerAlgoTrdR::kDigiDistributionMap
@ kDigiDistributionMap
Definition: CbmMcbm2018UnpackerAlgoTrdR.h:92
CbmStar2019Algo< CbmTrdDigi >::AddHistoToVector
void AddHistoToVector(TNamed *pointer, std::string sFolder="")
For monitor algos.
Definition: CbmStar2019Algo.h:80
Spadic::MsMessageType::kRDA
@ kRDA
Raw Data. Preceded by SOM. MSB: 1... .... always 64bits, bits after last transmitted sample are fille...
CbmMcbm2018UnpackerAlgoTrdR::kDigiDistributionMapSt
@ kDigiDistributionMapSt
Definition: CbmMcbm2018UnpackerAlgoTrdR.h:93
CbmMcbm2018UnpackerAlgoTrdR::kRawMessage_Signalshape_filtered
@ kRawMessage_Signalshape_filtered
Definition: CbmMcbm2018UnpackerAlgoTrdR.h:79
CbmStar2019Algo< CbmTrdDigi >::fuNbCoreMsPerTs
size_t fuNbCoreMsPerTs
Definition: CbmStar2019Algo.h:112
CbmMcbm2018UnpackerAlgoTrdR::Init
virtual Bool_t Init()
Definition: CbmMcbm2018UnpackerAlgoTrdR.cxx:68
CbmMcbm2018UnpackerAlgoTrdR::kDigiDeltaT
@ kDigiDeltaT
Definition: CbmMcbm2018UnpackerAlgoTrdR.h:86
CbmMcbm2018UnpackerAlgoTrdR::fSpadicEpoch
ULong64_t fSpadicEpoch
Epoch counter (30 bits). Counts overflow of Spadic timestamp (11 bits).
Definition: CbmMcbm2018UnpackerAlgoTrdR.h:243
Spadic::MsMessageType::kSOM
@ kSOM
Start of Message. MSB: 001. .... timestamp (bits 50-35) in clockcycles. Currently (Feb 2020) only 11 ...
CbmMcbm2018UnpackerAlgoTrdR::fCurrTsIdx
ULong64_t fCurrTsIdx
Index of current Timeslice.
Definition: CbmMcbm2018UnpackerAlgoTrdR.h:234
CbmStar2019Algo< CbmTrdDigi >::fdTsFullSizeInNs
Double_t fdTsFullSizeInNs
Total size of the core MS in a TS, [nanoseconds].
Definition: CbmStar2019Algo.h:121
CbmStar2019Algo< CbmTrdDigi >::fParCList
TList * fParCList
Parameter management.
Definition: CbmStar2019Algo.h:108
CbmMcbm2018UnpackerAlgoTrdR::fAsicChannelMap
std::map< Int_t, std::vector< Int_t > > fAsicChannelMap
Map to retrieve module channelId from asicAddress and asicChannel.
Definition: CbmMcbm2018UnpackerAlgoTrdR.h:267
CbmTrdParSpadic.h
CbmMcbm2018UnpackerAlgoTrdR::fNbWildRda
ULong64_t fNbWildRda
Number of RDA Words outside of a Message.
Definition: CbmMcbm2018UnpackerAlgoTrdR.h:249
CbmStar2019Algo< CbmTrdDigi >::fvMsComponentsList
std::vector< size_t > fvMsComponentsList
Parameters related to FLES containers.
Definition: CbmStar2019Algo.h:111
CbmMcbm2018UnpackerAlgoTrdR::CreateRawMessage
CbmTrdRawMessageSpadic CreateRawMessage(const uint64_t word, fles::MicrosliceDescriptor msDesc)
Definition: CbmMcbm2018UnpackerAlgoTrdR.cxx:963
CbmMcbm2018UnpackerAlgoTrdR::fTsStartTime
Double_t fTsStartTime
Time in ns of current TS from the index of the first MS first componen.
Definition: CbmMcbm2018UnpackerAlgoTrdR.h:237
CbmMcbm2018UnpackerAlgoTrdR::ProcessTs
Bool_t ProcessTs(const fles::Timeslice &ts)
Definition: CbmMcbm2018UnpackerAlgoTrdR.cxx:174
CbmMcbm2018UnpackerAlgoTrdR::AddMsComponentToList
void AddMsComponentToList(size_t component, UShort_t usDetectorId)
Definition: CbmMcbm2018UnpackerAlgoTrdR.cxx:366
CbmTrdParSetGain
Definition: CbmTrdParSetGain.h:16
CbmTrdParModDigi::GetPadRow
Int_t GetPadRow(const Int_t channelNumber) const
Definition: CbmTrdParModDigi.cxx:914
CbmTrdRawMessageSpadic::GetElinkId
std::uint8_t GetElinkId() const
Definition: CbmTrdRawMessageSpadic.h:111
CbmMcbm2018UnpackerAlgoTrdR::fdTimeOffsetNs
Double_t fdTimeOffsetNs
User settings: Data correction parameters.
Definition: CbmMcbm2018UnpackerAlgoTrdR.h:206
CbmMcbm2018UnpackerAlgoTrdR::fbMonitorMode
Bool_t fbMonitorMode
Switch ON the filling of a minimal set of histograms.
Definition: CbmMcbm2018UnpackerAlgoTrdR.h:193
Spadic::TriggerType::kGlobal
@ kGlobal
global trigger.
Spadic::MsMessageType::kINF
@ kINF
Info Message. MSB: 0001 .... The 20 LSBs of the 64bit word contain the 20 LSBs of a raw spadic InfoTy...
CbmMcbm2018UnpackerAlgoTrdR::fIsActiveHistoVec
std::vector< bool > fIsActiveHistoVec
Stores all Histograms.
Definition: CbmMcbm2018UnpackerAlgoTrdR.h:220
CbmMcbm2018UnpackerAlgoTrdR::fNbUnkownWord
ULong64_t fNbUnkownWord
Number of unknown data words in the Microslice stream.
Definition: CbmMcbm2018UnpackerAlgoTrdR.h:252
CbmMcbm2018UnpackerAlgoTrdR::ProcessMs
Bool_t ProcessMs(const fles::Timeslice &ts, size_t uMsCompIdx, size_t uMsIdx)
Unpacks one Microslice.
Definition: CbmMcbm2018UnpackerAlgoTrdR.cxx:238
CbmMcbm2018UnpackerAlgoTrdR::fNbSpadicEpochMsg
ULong64_t fNbSpadicEpochMsg
Number of Spadic Epoch Messages.
Definition: CbmMcbm2018UnpackerAlgoTrdR.h:253
CbmMcbm2018UnpackerAlgoTrdR::fbDebugMonitorMode
Bool_t fbDebugMonitorMode
Switch ON the filling of a additional set of histograms.
Definition: CbmMcbm2018UnpackerAlgoTrdR.h:195
CbmMcbm2018UnpackerAlgoTrdR::fGasPar
CbmTrdParSetGas * fGasPar
CbmTrdParameter container.
Definition: CbmMcbm2018UnpackerAlgoTrdR.h:262
CbmMcbm2018UnpackerAlgoTrdR::fSpadicInfoMsgVector
std::vector< std::pair< std::uint64_t, std::uint64_t > > * fSpadicInfoMsgVector
vector< pair< fulltime, word > >
Definition: CbmMcbm2018UnpackerAlgoTrdR.h:215
CbmMcbm2018UnpackerAlgoTrdR::SetDigiOutputPointer
Bool_t SetDigiOutputPointer(std::vector< CbmTrdDigi > *const pVector)
Set fTrdDigiVector to the address of pVector.
Definition: CbmMcbm2018UnpackerAlgoTrdR.cxx:829
CbmMcbm2018UnpackerAlgoTrdR::fTrdDigiVector
std::vector< CbmTrdDigi > * fTrdDigiVector
Output Digi vector.
Definition: CbmMcbm2018UnpackerAlgoTrdR.h:209
CbmMcbm2018UnpackerAlgoTrdR::kSpadic_Info_Types
@ kSpadic_Info_Types
Definition: CbmMcbm2018UnpackerAlgoTrdR.h:83
CbmStar2019Algo
Definition: CbmStar2019Algo.h:43
CbmMcbm2018UnpackerAlgoTrdR::kRawDistributionMapModule5
@ kRawDistributionMapModule5
Definition: CbmMcbm2018UnpackerAlgoTrdR.h:80
CbmTrdParModDigi::GetOrientation
Int_t GetOrientation() const
Definition: CbmTrdParModDigi.h:35
CbmTrdHardwareSetupR::CreateHwToSwAsicAddressTranslatorMap
std::map< std::uint64_t, Int_t > CreateHwToSwAsicAddressTranslatorMap(bool isLoadedParameters)
Definition: CbmTrdHardwareSetupR.cxx:62
CbmMcbm2018UnpackerAlgoTrdR::fbDebugSortOutput
Bool_t fbDebugSortOutput
If ON the raw messages output vector is sorted within time.
Definition: CbmMcbm2018UnpackerAlgoTrdR.h:200
CbmMcbm2018UnpackerAlgoTrdR::kDigiChargeSpectrumNt
@ kDigiChargeSpectrumNt
Definition: CbmMcbm2018UnpackerAlgoTrdR.h:97
CbmTrdParModDigi
Definition of chamber gain conversion for one TRD module.
Definition: CbmTrdParModDigi.h:14
CbmMcbm2018UnpackerAlgoTrdR::kDigiRelativeTimeMicroslice
@ kDigiRelativeTimeMicroslice
Definition: CbmMcbm2018UnpackerAlgoTrdR.h:91
CbmMcbm2018UnpackerAlgoTrdR::kDigiChargeSpectrumSt
@ kDigiChargeSpectrumSt
Definition: CbmMcbm2018UnpackerAlgoTrdR.h:96
Spadic::TriggerType::kNeigh
@ kNeigh
Neighbor trigger.
CbmMcbm2018UnpackerAlgoTrdR::kRawMessage_Signalshape_St
@ kRawMessage_Signalshape_St
Definition: CbmMcbm2018UnpackerAlgoTrdR.h:77
CbmTrdParModDigi.h
CbmStar2019Algo< CbmTrdDigi >::fdTsCoreSizeInNs
Double_t fdTsCoreSizeInNs
Size of a single MS, [nanoseconds].
Definition: CbmStar2019Algo.h:119
CbmMcbm2018UnpackerAlgoTrdR::kRawPulserDeltaT
@ kRawPulserDeltaT
Definition: CbmMcbm2018UnpackerAlgoTrdR.h:82
CbmTrdRawMessageSpadic::GetCrobId
std::uint8_t GetCrobId() const
Definition: CbmTrdRawMessageSpadic.h:112
Spadic::MsMessageType
MsMessageType
Definition: CbmTrdRawMessageSpadic.h:25
CbmTrdParAsic::kCrobIdPosition
@ kCrobIdPosition
Definition: CbmTrdParAsic.h:30
CbmTrdParSet::GetModulePar
virtual const CbmTrdParMod * GetModulePar(Int_t detId) const
Definition: CbmTrdParSet.cxx:45
CbmMcbm2018UnpackerAlgoTrdR::kBeginDigiHistos
@ kBeginDigiHistos
Definition: CbmMcbm2018UnpackerAlgoTrdR.h:84
ClassImp
ClassImp(CbmConverterManager) InitStatus CbmConverterManager
Definition: CbmConverterManager.cxx:12
CbmTrdHardwareSetupR::CreateAsicChannelMap
std::map< Int_t, std::vector< Int_t > > CreateAsicChannelMap(bool isLoadedParameters)
Definition: CbmTrdHardwareSetupR.cxx:129
Spadic::MsInfoType
MsInfoType
Definition: CbmTrdRawMessageSpadic.h:53
CbmMcbm2018UnpackerAlgoTrdR::FillHistograms
Bool_t FillHistograms()
Definition: CbmMcbm2018UnpackerAlgoTrdR.cxx:625
CbmMcbm2018UnpackerAlgoTrdR::MakeDigi
std::shared_ptr< CbmTrdDigi > MakeDigi(CbmTrdRawMessageSpadic raw)
Definition: CbmMcbm2018UnpackerAlgoTrdR.cxx:860
CbmMcbm2018UnpackerAlgoTrdR.h
CbmTrdParSet::GetModuleMap
std::map< Int_t, CbmTrdParMod * > GetModuleMap()
Definition: CbmTrdParSet.h:35
CbmTrdHardwareSetupR.h
CbmTrdDigi::kNTrg
@ kNTrg
Definition: CbmTrdDigi.h:23
NSPADICCH
#define NSPADICCH
Definition: CbmTrdParSpadic.h:4
CbmMcbm2018UnpackerAlgoTrdR::kRawMessage_Signalshape_Nt
@ kRawMessage_Signalshape_Nt
Definition: CbmMcbm2018UnpackerAlgoTrdR.h:78
Spadic::MsInfoType::kBOM
@ kBOM
Buffer overflow count. 11nn nnnn nnnn nnnn cccc.
CbmTrdRawMessageSpadic::GetNrSamples
std::uint8_t GetNrSamples() const
Definition: CbmTrdRawMessageSpadic.h:115
CbmMcbm2018UnpackerAlgoTrdR::ReInitContainers
Bool_t ReInitContainers()
Definition: CbmMcbm2018UnpackerAlgoTrdR.cxx:103
Spadic::MsInfoType::kMSB
@ kMSB
Message build error. 010. .... .... .... cccc.
CbmTrdParModDigi::GetPadColumn
Int_t GetPadColumn(const Int_t channelNumber) const
Definition: CbmTrdParModDigi.cxx:902
CbmMcbm2018UnpackerAlgoTrdR::CreateHistograms
Bool_t CreateHistograms()
Goes through fIsActiveHistoVec and creates the activated histograms.
Definition: CbmMcbm2018UnpackerAlgoTrdR.cxx:388
CbmMcbm2018UnpackerAlgoTrdR::GetParList
TList * GetParList()
Definition: CbmMcbm2018UnpackerAlgoTrdR.cxx:135
CbmTrdHardwareSetupR
Definition: CbmTrdHardwareSetupR.h:35
CbmTrdRawMessageSpadic::GetCriId
std::uint16_t GetCriId() const
Definition: CbmTrdRawMessageSpadic.h:113
CbmMcbm2018UnpackerAlgoTrdR::fdMsSizeInCC
UInt_t fdMsSizeInCC
Definition: CbmMcbm2018UnpackerAlgoTrdR.h:167
CbmTrdDigi::GetTriggerType
Int_t GetTriggerType() const
Channel trigger type. SPADIC specific see CbmTrdTriggerType.
Definition: CbmTrdDigi.h:135
x
Double_t x
Definition: CbmMvdSensorDigiToHitTask.cxx:68
Spadic::TriggerType::kSelf
@ kSelf
Self trigger.
CbmMcbm2018UnpackerAlgoTrdR::Reset
virtual void Reset()
Definition: CbmMcbm2018UnpackerAlgoTrdR.cxx:78
CbmMcbm2018UnpackerAlgoTrdR::fSpadicMap
std::map< std::uint64_t, Int_t > fSpadicMap
Map to retrieve asic address from CriId/CrobId/ElinkId (see CbmTrdHardwareSetupR)
Definition: CbmMcbm2018UnpackerAlgoTrdR.h:265
CbmMcbm2018UnpackerAlgoTrdR::CbmMcbm2018UnpackerAlgoTrdR
CbmMcbm2018UnpackerAlgoTrdR()
Definition: CbmMcbm2018UnpackerAlgoTrdR.cxx:18
CbmMcbm2018UnpackerAlgoTrdR::InitContainers
Bool_t InitContainers()
Definition: CbmMcbm2018UnpackerAlgoTrdR.cxx:94
CbmTrdDigi
Definition: CbmTrdDigi.h:14
CbmTrdDigi::GetTime
Double_t GetTime() const
Getter for physical time [ns]. Accounts for clock representation of each ASIC. In SPADIC case physica...
Definition: CbmTrdDigi.h:127
CbmMcbm2018UnpackerAlgoTrdR::ExtractSample
int16_t ExtractSample(const uint64_t word, uint8_t sample, Bool_t multihit=kFALSE)
Extract a Sample from a given SOM or RDA word.
Definition: CbmMcbm2018UnpackerAlgoTrdR.cxx:1044
CbmTrdParSetDigi
Definition: CbmTrdParSetDigi.h:15
CbmMcbm2018UnpackerAlgoTrdR::kDigiHitFrequency
@ kDigiHitFrequency
Definition: CbmMcbm2018UnpackerAlgoTrdR.h:90
CbmMcbm2018UnpackerAlgoTrdR::kEndDefinedHistos
@ kEndDefinedHistos
Definition: CbmMcbm2018UnpackerAlgoTrdR.h:99
CbmMcbm2018UnpackerAlgoTrdR::SetNbMsInTs
void SetNbMsInTs(size_t uCoreMsNb, size_t uOverlapMsNb)
Definition: CbmMcbm2018UnpackerAlgoTrdR.cxx:380
CbmMcbm2018UnpackerAlgoTrdR::fLastFulltime
ULong64_t fLastFulltime
Definition: CbmMcbm2018UnpackerAlgoTrdR.h:245
CbmTrdRawMessageSpadic::GetHitType
std::uint8_t GetHitType() const
Definition: CbmTrdRawMessageSpadic.h:114
CbmMcbm2018UnpackerAlgoTrdR::~CbmMcbm2018UnpackerAlgoTrdR
~CbmMcbm2018UnpackerAlgoTrdR()
Definition: CbmMcbm2018UnpackerAlgoTrdR.cxx:57
CbmMcbm2018UnpackerAlgoTrdR::fParContList
TList * fParContList
Parameters and Address mapping.
Definition: CbmMcbm2018UnpackerAlgoTrdR.h:257
Spadic::MsMessageType::kEPO
@ kEPO
Epoch Marker. MSB: 01.. .... uTS-MSB (bits 61-32) in clockcycles.
CbmMcbm2018UnpackerAlgoTrdR::fIsFirstChannelsElinkEven
bool fIsFirstChannelsElinkEven
define if the first 16 channels (00..15) are found on the even (set true) or odd (false) eLinkId,...
Definition: CbmMcbm2018UnpackerAlgoTrdR.h:269
CbmTrdDigi::GetCharge
Double_t GetCharge() const
Charge getter for SPADIC.
Definition: CbmTrdDigi.cxx:133
CbmMcbm2018UnpackerAlgoTrdR::CreateHistogram
Bool_t CreateHistogram(ECbmTrdUnpackerHistograms iHisto)
create the histogram correlated to iHisto
Definition: CbmMcbm2018UnpackerAlgoTrdR.cxx:407
CbmMcbm2018UnpackerAlgoTrdR::fbBaselineAvg
Bool_t fbBaselineAvg
Set to true if Baseline Averaging is activated in Spadic.
Definition: CbmMcbm2018UnpackerAlgoTrdR.h:203
PairAnalysisStyler::Fill
static Int_t Fill[]
Definition: PairAnalysisStyleDefs.h:82
Spadic::TriggerType::kSandN
@ kSandN
Self and neighbor trigger at the same time.
CbmMcbm2018UnpackerAlgoTrdR::kDigiDistributionMapNt
@ kDigiDistributionMapNt
Definition: CbmMcbm2018UnpackerAlgoTrdR.h:94
CbmMcbm2018UnpackerAlgoTrdR::ResetHistograms
Bool_t ResetHistograms()
Definition: CbmMcbm2018UnpackerAlgoTrdR.cxx:815
CbmStar2019Algo< CbmTrdDigi >::fbIgnoreOverlapMs
Bool_t fbIgnoreOverlapMs
Definition: CbmStar2019Algo.h:116
CbmTrdParAsic::kCriIdPosition
@ kCriIdPosition
Definition: CbmTrdParAsic.h:31
Spadic::MsInfoType::kMIS
@ kMIS
Missing request. 101. .... .... .... ....
CbmTrdRawMessageSpadic::GetChannelId
std::uint8_t GetChannelId() const
Definition: CbmTrdRawMessageSpadic.h:110
Spadic::MsInfoType::kBUF
@ kBUF
Buffer full. 011b b... .... .... cccc.
CbmTrdParModDigi::GetNofColumns
Int_t GetNofColumns() const
Definition: CbmTrdParModDigi.cxx:321
CbmMcbm2018UnpackerAlgoTrdR::fNbSpadicRawMsg
ULong64_t fNbSpadicRawMsg
Counters.
Definition: CbmMcbm2018UnpackerAlgoTrdR.h:248
CbmTrdDigi::GetAddressModule
Int_t GetAddressModule() const
Getter module address in the experiment.
Definition: CbmTrdDigi.cxx:126
CbmMcbm2018UnpackerAlgoTrdR
Timeslice unpacker algorithm for Spadic v.2.2 .
Definition: CbmMcbm2018UnpackerAlgoTrdR.h:34