Go to the documentation of this file.
34 , fbDebugMonitorMode(kFALSE)
35 , fvbMaskedComponents()
46 , fvdTimeOffsetNsAsics()
47 , fbUseChannelMask(kFALSE)
48 , fvvbMaskedChannels()
53 , fdTsStopTimeCore(-1.0)
57 , fuCurrentEquipmentId(0)
60 , fiRunStartDateTimeSec(-1)
61 , fiBinSizeDatePlots(-1)
63 , fvuCurrentTsMsbCycle()
65 , fdStartTimeMsSz(0.0)
66 , ftStartTimeUnix(std::chrono::steady_clock::now())
70 , fvvusLastTsMsbChan()
71 , fvvusLastTsMsbCycleChan()
72 , fhDigisTimeInRun(nullptr)
96 LOG(info) <<
"Initializing mCBM MUCH 2019 unpacker algo";
109 LOG(info) <<
"Init parameter containers for CbmMcbm2018UnpackerAlgoMuch";
115 LOG(info) <<
"**********************************************";
116 LOG(info) <<
"ReInit parameter containers for CbmMcbm2018UnpackerAlgoMuch";
135 LOG(info) <<
"Nr. of MUCH DPBs: " <<
fuNrOfDpbs;
138 for (UInt_t uDpb = 0; uDpb <
fuNrOfDpbs; ++uDpb) {
140 LOG(info) <<
"Eq. ID for DPB #" << std::setw(2) << uDpb <<
" = 0x"
142 << std::dec <<
" => "
147 LOG(info) <<
"Nr. of FEBs: " <<
fuNbFebs;
157 for (UInt_t uDpb = 0; uDpb <
fuNrOfDpbs; ++uDpb) {
166 for (UInt_t uDpb = 0; uDpb <
fuNrOfDpbs; ++uDpb) {
167 TString sPrintoutLine = Form(
"DPB #%02u CROB Active ?: ", uDpb);
173 LOG(info) << sPrintoutLine;
200 LOG(info) <<
"Unpacking data in bin sorter FW mode";
202 LOG(info) <<
"Unpacking data in full time sorter FW mode (legacy)";
207 for (UInt_t uDpb = 0; uDpb <
fuNrOfDpbs; ++uDpb) {
216 for (UInt_t uAsicIdx = 0; uAsicIdx <
fuNbStsXyters; ++uAsicIdx) {
228 UShort_t usDetectorId) {
236 LOG(info) <<
"CbmMcbm2018UnpackerAlgoMuch::AddMsComponentToList => Component "
237 << component <<
" with detector ID 0x" << std::hex << usDetectorId
238 << std::dec <<
" added to list";
244 fdTsStartTime =
static_cast<Double_t
>(ts.descriptor(0, 0).idx);
263 LOG(info) <<
"In each TS " <<
fuNbMsLoop <<
" MS will be looped over";
279 <<
fuMsIndex <<
" for component " << uMsComp;
294 if (digi == NULL)
continue;
317 return a.GetTime() < b.GetTime();
349 UInt_t uAsicIdx = itHitIn->
GetAsic();
356 Short_t layerside = 0;
363 Int_t usChan = itHitIn->
GetChan();
378 if (
fiFlag == 1 && layer == 0) {
380 if (iFebId == 0 || iFebId == 1 || iFebId == 2 || iFebId == 3 || iFebId == 4
381 || iFebId == 8 || iFebId == 9 || iFebId == 10 || iFebId == 11
394 if (iFebId == 0 || iFebId == 1 || iFebId == 2 || iFebId == 3 || iFebId == 4
395 || iFebId == 8 || iFebId == 9 || iFebId == 10 || iFebId == 11
406 if (iFebId == 0 || iFebId == 1 || iFebId == 2 || iFebId == 3 || iFebId == 4
407 || iFebId == 8 || iFebId == 9 || iFebId == 10 || iFebId == 11
419 if (sSector < 0 || sChannel < 0) {
421 <<
"Sector " << sSector <<
" channel " << sChannel
422 <<
" is not connected or misconnected to pad. Skipping this hit message.";
427 station, layer, layerside, module, sChannel, sSector);
432 ULong64_t ulTimeInNs =
static_cast<ULong64_t
>(dTimeInNs);
440 LOG(debug) <<
"Sector " << sSector <<
" channel " << sChannel <<
" layer "
441 << layer <<
" Address " << address <<
" Time " << ulTimeInNs;
458 auto msDescriptor = ts.descriptor(uMsCompIdx, uMsIdx);
460 const uint8_t* msContent =
461 reinterpret_cast<const uint8_t*
>(ts.content(uMsCompIdx, uMsIdx));
463 uint32_t uSize = msDescriptor.size;
466 LOG(debug) <<
"Microslice: " <<
fulCurrentMsIdx <<
" from EqId " << std::hex
480 <<
"---------------------------------------------------------------";
491 LOG(warning) <<
"Could not find the sDPB index for AFCK id 0x" << std::hex
494 <<
" component " << uMsCompIdx <<
"\n"
495 <<
"If valid this index has to be added in the MUCH "
496 "parameter file in the DbpIdArray field";
512 UInt_t uTsMsbCycleHeader = std::floor(
517 uTsMsbCycleHeader = std::floor(
525 << std::setw(4) << uMsIdx <<
" Msg Idx " << std::setw(5) << 0
526 <<
" DPB " << std::setw(2) <<
fuCurrDpbIdx <<
" Old TsMsb "
528 <<
" Old MsbCy " << std::setw(5)
530 << uTsMsbCycleHeader;
538 << std::setw(4) << uMsIdx <<
" Msg Idx " << std::setw(5) << 0
539 <<
" DPB " << std::setw(2) <<
fuCurrDpbIdx <<
" Old TsMsb "
541 <<
" Old MsbCy " << std::setw(5)
543 << uTsMsbCycleHeader;
546 <<
"TS MSB cycle from MS header does not match current cycle from data "
550 << uTsMsbCycleHeader;
557 LOG(error) <<
"The input microslice buffer does NOT "
558 <<
"contain only complete sDPB messages!";
561 uint32_t uNbMessages =
567 for (uint32_t uIdx = 0; uIdx < uNbMessages; uIdx++) {
588 LOG(warning) <<
"CbmMcbm2018UnpackerAlgoMuch::DoUnpack => "
589 <<
"Wrong elink Idx! Elink raw "
590 << Form(
"%d remap %d", usElinkIdx, uFebIdx);
615 LOG(info) <<
"CbmMcbm2018UnpackerAlgoMuch::DoUnpack => "
616 <<
"EPOCH message at unexpected position in MS: message "
617 << uIdx <<
" VS message 0 expected!";
627 LOG(warning) <<
"CbmMcbm2018UnpackerAlgoMuch::DoUnpack => "
628 <<
"Wrong elink Idx! Elink raw "
629 << Form(
"%d remap %d", usElinkIdx, uFebIdx);
647 if (pMess[uIdx].IsMsErrorFlagOn()) {
652 pMess[uIdx].GetMsErrorType()));
661 LOG(fatal) <<
"CbmMcbm2018UnpackerAlgoMuch::DoUnpack => "
662 <<
"Unknown message type, should never happen, stopping "
663 "here! Type found was: "
664 <<
static_cast<int>(typeMess);
674 const UShort_t& usElinkIdx,
675 const UInt_t& uAsicIdx,
733 Long64_t ulHitTime = usRawTs;
759 ulHitTime, usRawAdc, uAsicIdx, usChan,
fuCurrDpbIdx, uCrobIdx));
836 << uMsIdx <<
" Msg Idx " << std::setw(5) << uMessIdx <<
" DPB "
837 << std::setw(2) <<
fuCurrDpbIdx <<
" Old TsMsb " << std::setw(5)
840 << std::setw(5) << uVal;
854 LOG(info) <<
"TS MSb Jump in "
857 << uMsIdx <<
" Msg Idx " << std::setw(5) << uMessIdx <<
" DPB "
860 << std::setw(5) << uVal;
865 if (4194303 == uVal && 1 == uMessIdx)
903 const UInt_t& uAsicIdx) {
947 new TH1I(
"hMuchDigisTimeInRun",
948 "Digis Nb vs Time in Run; Time in run [s]; Digis Nb []",
955 new TH1I(
"fhVectorSize",
956 "Size of the vector VS TS index; TS index; Size [bytes]",
961 new TH1I(
"fhVectorCapacity",
962 "Size of the vector VS TS index; TS index; Size [bytes]",
1250 Double_t dOffsetIn) {
1264 for (UInt_t uFebIdx = 0; uFebIdx <
fuNbFebs; ++uFebIdx) {
1268 if (uFeb <
fuNbFebs && uChan < fUnpackPar->GetNbChanPerFeb())
1271 LOG(fatal) <<
"CbmMcbm2018UnpackerAlgoMuch::MaskNoisyChannel => Invalid "
1272 "FEB and/or CHAN index:"
1273 << Form(
" %u vs %u and %u vs %u",
static constexpr UInt_t GetNbAsicsPerCrob()
std::map< stsxyter::MessType, UInt_t > fmMsgCounter
void MaskNoisyChannel(UInt_t uFeb, UInt_t uChan, Bool_t bMasked=kTRUE)
Bool_t IsCrobActive(UInt_t uDpbIdx, UInt_t uCrobIdx)
UInt_t fdAdcCut
Vector of channel masks, [ NbFeb ][ NbCHanInFeb ], used only if fbUseChannelMask is true.
Bool_t CreateHistograms()
Double_t fdMsSizeInNs
/** Ignore Overlap Ms: all fuOverlapMsNb MS at the end of timeslice **/
static constexpr UInt_t GetNbElinkPerCrob()
UInt_t ElinkIdxToAsicIdx(UInt_t uElink)
void ProcessHitInfo(const stsxyter::Message &mess, const UShort_t &usElinkIdx, const UInt_t &uAsicIdx, const UInt_t &uMsIdx)
Bool_t fbBinningFw
=> Quick and dirty hack for binning FW!!!
std::vector< CbmErrorMessage > fErrVect
UInt_t GetDpbId(UInt_t uDpbIdx)
std::vector< ULong64_t > fvulCurrentTsMsb
static const uint64_t kulTsCycleNbBinsBinning
uint16_t GetLinkIndexHitBinning() const
void AddHistoToVector(TNamed *pointer, std::string sFolder="")
For monitor algos.
uint32_t GetTsMsbVal() const
For TS MSB data: Returns the TS MSB 22 bit field)
Bool_t fbMonitorMode
Control flags.
static const UInt_t kuMaxTsMsbDiffDuplicates
All hits (time in bins, ADC in bins, asic, channel) in last MS, sorted with "<" operator.
static constexpr UInt_t GetNbChanPerFeb()
uint16_t GetLinkIndex() const
For all data: Returns the (global) index of the eLink on which the message was received (n bit field)
void SetRocId(Int_t rocId)
std::vector< std::vector< UShort_t > > fvvusLastTsMsbCycleChan
TS MSB of last hit message for each channel, [ AsicIdx ][ Chan ].
Bool_t ProcessTs(const fles::Timeslice &ts)
static const uint64_t kulTsCycleNbBins
Double_t fdTsFullSizeInNs
Total size of the core MS in a TS, [nanoseconds].
TList * fParCList
Parameter management.
std::vector< size_t > fvMsComponentsList
Parameters related to FLES containers.
bool IsHitMissedEvts() const
For Hit data: Returns Missed event flag (1 bit field)
uint16_t GetHitAdc() const
For Hit data: Returns ADC value (5 bit field)
Short_t GetPadYA(UShort_t febid, UShort_t channelid)
void SetTimeOffsetNsAsic(UInt_t uAsicIdx, Double_t dOffsetIn=0.0)
void ProcessStatusInfo(const stsxyter::Message &mess, const UInt_t &uAsicIdx)
std::vector< UInt_t > fvuCurrentTsMsbCycle
Current TS MSB for each DPB.
~CbmMcbm2018UnpackerAlgoMuch()
Bool_t ProcessMs(const fles::Timeslice &ts, size_t uMsCompIdx, size_t uMsIdx)
static constexpr UInt_t GetNbCrobsPerDpb()
std::map< UInt_t, UInt_t > fDpbIdIndexMap
Total number of STS DPBs in system.
CbmRoot (+externals) headers.
UInt_t fuCurrDpbIdx
Temp holder until Current equipment ID is properly filled in MS.
static const uint32_t kuHitNbTsBins
Double_t fdTsCoreSizeInNs
Size of a single MS, [nanoseconds].
void ProcessEpochInfo(const stsxyter::Message &mess)
Bool_t ReInitContainers()
std::vector< std::vector< UShort_t > > fvvusLastTsChan
Limit how many different TS_MSB are checked for same duplicate hit => set to 1 uS.
uint16_t GetStatusStatus() const
For Status data: Returns the Status field from ACK frame (4 bit field)
std::vector< std::vector< UShort_t > > fvvusLastAdcChan
TS of last hit message for each channel, [ AsicIdx ][ Chan ].
UInt_t fuCurrDpbId
Current equipment ID, tells from which DPB the current MS is originating.
std::vector< CbmMuchBeamTimeDigi > fDigiVect
Vector of pointers to canvases + optional folder name.
Double_t fdCapacityIncFactor
UInt_t fuMsIndex
Start Time in ns of current MS from its index field in header.
Double_t fdTimeOffsetNs
Number of StsXyter ASICs.
CbmMcbm2018MuchPar * fUnpackPar
Switch to smx2.0/smx2.1 data-> fiFlag = 0 for 2.0 and fiFlag = 1 for 2.1.
void ProcessTsMsbInfo(const stsxyter::Message &mess, UInt_t uMessIdx=0, UInt_t uMsIdx=0)
std::vector< std::vector< bool > > fvvbMaskedChannels
Double_t fdTsStopTimeCore
Time in ns of current TS from the index of the first MS first component.
static const double kdClockCycleNs
ULong64_t fulCurrentTsIdx
static const uint32_t kuHitNbTsBinsBinning
Short_t GetPadXB(UShort_t febid, UShort_t channelid)
UInt_t fuNbStsXyters
Number of FEBs with StsXyter ASICs.
MessType GetMessType() const
Returns the message type, see enum MessType.
TH1 * fhDigisTimeInRun
TS MSB cycle of last hit message for each channel, [ AsicIdx ][ Chan ].
std::vector< stsxyter::FinalHit > fvmHitsInMs
Hits time-sorting.
Short_t GetPadYB(UShort_t febid, UShort_t channelid)
UInt_t fuCurrentEquipmentId
Int_t ElinkIdxToFebIdx(UInt_t uElink)
uint16_t GetHitChannel() const
For Hit data: Returns StsXYTER channel number (7 bit field)
uint16_t GetStatusLink() const
For Status data: Returns the Link Inedx (9 bit field)
std::vector< std::vector< UShort_t > > fvvusLastTsMsbChan
ADC of last hit message for each channel, [ AsicIdx ][ Chan ].
CbmMuchBeamTimeDigi * CreateMuchDigi(stsxyter::FinalHit *)
@ kMuch
Muon detection system.
uint16_t GetHitTime() const
For Hit data: Returns timestamp (8 bit field, 2 MSB bits overlap removed)
std::vector< Bool_t > fvbMaskedComponents
Switch ON the filling of a additional set of histograms.
CbmMcbm2018UnpackerAlgoMuch()
static constexpr UInt_t GetNbChanPerAsic()
static UInt_t GetAddress(Int_t station=0, Int_t layer=0, Int_t side=0, Int_t module=0, Int_t sector=0, Int_t channel=0)
std::vector< Double_t > fvdTimeOffsetNsAsics
uint32_t GetTsMsbValBinning() const
For TS MSB data: Returns the TS MSB 29 bit field)
UInt_t fuNbFebs
Array to hold the active flag for all CROBs, [ NbDpb ][ NbCrobPerDpb ].
Short_t GetPadXA(UShort_t febid, UShort_t channelid)
ULong64_t fulCurrentMsIdx
static const uint16_t kusLenStatStatus
std::vector< std::vector< Bool_t > > fvbCrobActiveFlag
Map of DPB Identifier to DPB index.
void AddMsComponentToList(size_t component, UShort_t usDetectorId)
uint16_t GetHitTimeBinning() const