Go to the documentation of this file.
34 , fbDebugMonitorMode(kFALSE)
35 , fvbMaskedComponents()
53 , fvdTimeOffsetNsAsics()
54 , fbUseChannelMask(kFALSE)
55 , fvvbMaskedChannels()
60 , fdTsStopTimeCore(-1.0)
64 , fuCurrentEquipmentId(0)
67 , fiRunStartDateTimeSec(-1)
68 , fiBinSizeDatePlots(-1)
71 , fdStartTimeMsSz(0.0)
72 , ftStartTimeUnix(std::chrono::steady_clock::now())
76 , fvvusLastTsMsbChan()
77 , fvvusLastTsMsbCycleChan()
78 , fhDigisTimeInRun(nullptr)
101 LOG(info) <<
"Initializing mCBM STS 2019 unpacker algo";
114 LOG(info) <<
"Init parameter containers for CbmMcbm2018UnpackerAlgoSts";
120 LOG(info) <<
"**********************************************";
121 LOG(info) <<
"ReInit parameter containers for CbmMcbm2018UnpackerAlgoSts";
139 LOG(info) <<
"Nr. of STS Modules: " <<
fuNbModules;
143 for (UInt_t uModIdx = 0; uModIdx <
fuNbModules; ++uModIdx) {
146 LOG(info) <<
"Module #" << std::setw(2) << uModIdx <<
" Type "
148 << std::setw(8) << std::hex <<
fviModAddress[uModIdx] << std::dec;
152 LOG(info) <<
"Nr. of STS DPBs: " <<
fuNrOfDpbs;
155 for (UInt_t uDpb = 0; uDpb <
fuNrOfDpbs; ++uDpb) {
157 LOG(info) <<
"Eq. ID for DPB #" << std::setw(2) << uDpb <<
" = 0x"
159 << std::dec <<
" => "
164 LOG(info) <<
"Nr. of FEBs: " <<
fuNbFebs;
177 for (UInt_t uDpb = 0; uDpb <
fuNrOfDpbs; ++uDpb) {
247 "Bad module type for DPB #%02u CROB #%u FEB %02u: %d",
261 LOG(fatal) << Form(
"Bad module Index and/or Side for DPB #%02u CROB "
262 "#%u FEB %02u: %d %d",
273 for (UInt_t uDpb = 0; uDpb <
fuNrOfDpbs; ++uDpb) {
274 TString sPrintoutLine = Form(
"DPB #%02u CROB Active ?: ", uDpb);
280 LOG(info) << sPrintoutLine;
283 UInt_t uGlobalFebIdx = 0;
284 for (UInt_t uDpb = 0; uDpb <
fuNrOfDpbs; ++uDpb) {
287 LOG(info) << Form(
"DPB #%02u CROB #%u: ", uDpb, uCrobIdx);
292 " FEB #%02u (%02u): Mod. Idx = %03d Side %c (%2d) Type %c "
293 "(%2d) (Addr. 0x%08x) ADC gain %4.0f e- ADC Offs %5.0f e-",
299 1 ==
fviFebType[uDpb][uCrobIdx][uFebIdx] ?
'B' :
'A',
306 "Disabled FEB #%02u (%02u): Mod. Idx = %03d Side %c (%2d) Type %c "
307 "(%2d) (Addr. 0x%08x) ADC gain %4.0f e- ADC Offs %5.0f e-",
313 1 ==
fviFebType[uDpb][uCrobIdx][uFebIdx] ?
'B' :
'A',
324 LOG(info) <<
"Unpacking data in bin sorter FW mode";
326 LOG(info) <<
"Unpacking data in full time sorter FW mode (legacy)";
331 for (UInt_t uDpb = 0; uDpb <
fuNrOfDpbs; ++uDpb) {
340 for (UInt_t uAsicIdx = 0; uAsicIdx <
fuNbStsXyters; ++uAsicIdx) {
352 UShort_t usDetectorId) {
360 LOG(info) <<
"CbmMcbm2018UnpackerAlgoSts::AddMsComponentToList => Component "
361 << component <<
" with detector ID 0x" << std::hex << usDetectorId
362 << std::dec <<
" added to list";
368 fdTsStartTime =
static_cast<Double_t
>(ts.descriptor(0, 0).idx);
387 LOG(info) <<
"In each TS " <<
fuNbMsLoop <<
" MS will be looped over";
403 <<
fuMsIndex <<
" for component " << uMsComp;
420 UInt_t uAsicIdx = itHitIn->GetAsic();
439 ULong64_t ulTimeInNs =
static_cast<ULong64_t
>(dTimeInNs);
446 "Digi on disabled FEB %02u has address 0x%08x and side %d",
473 return a.GetTime() < b.GetTime();
499 auto msDescriptor = ts.descriptor(uMsCompIdx, uMsIdx);
501 const uint8_t* msContent =
502 reinterpret_cast<const uint8_t*
>(ts.content(uMsCompIdx, uMsIdx));
504 uint32_t uSize = msDescriptor.size;
507 LOG(debug) <<
"Microslice: " <<
fulCurrentMsIdx <<
" from EqId " << std::hex
521 <<
"---------------------------------------------------------------";
532 LOG(warning) <<
"Could not find the sDPB index for AFCK id 0x" << std::hex
535 <<
" component " << uMsCompIdx <<
"\n"
536 <<
"If valid this index has to be added in the STS "
537 "parameter file in the DbpIdArray field";
556 UInt_t uTsMsbCycleHeader = std::floor(
561 uTsMsbCycleHeader = std::floor(
569 << std::setw(4) << uMsIdx <<
" Msg Idx " << std::setw(5) << 0
570 <<
" DPB " << std::setw(2) <<
fuCurrDpbIdx <<
" Old TsMsb "
572 <<
" Old MsbCy " << std::setw(5)
574 << uTsMsbCycleHeader;
582 << std::setw(4) << uMsIdx <<
" Msg Idx " << std::setw(5) << 0
583 <<
" DPB " << std::setw(2) <<
fuCurrDpbIdx <<
" Old TsMsb "
585 <<
" Old MsbCy " << std::setw(5)
587 << uTsMsbCycleHeader;
590 <<
"TS MSB cycle from MS header does not match current cycle from data "
594 <<
" (cnt) VS " << uTsMsbCycleHeader <<
" (header)";
601 LOG(error) <<
"The input microslice buffer does NOT "
602 <<
"contain only complete sDPB messages!";
605 uint32_t uNbMessages =
615 for (uint32_t uIdx = 0; uIdx < uNbMessages; uIdx++) {
640 LOG(warning) <<
"CbmMcbm2018UnpackerAlgoSts::DoUnpack => "
641 <<
"Wrong elink Idx! Elink raw "
642 << Form(
"%d remap %d", usElinkIdx, uFebIdx);
674 LOG(info) <<
"CbmMcbm2018UnpackerAlgoSts::DoUnpack => "
675 <<
"EPOCH message at unexpected position in MS: message "
676 << uIdx <<
" VS message 0 expected!";
690 LOG(warning) <<
"CbmMcbm2018UnpackerAlgoSts::DoUnpack => "
691 <<
"Wrong elink Idx! Elink raw "
692 << Form(
"%d remap %d", usElinkIdx, uFebIdx);
719 if (pMess[uIdx].IsMsErrorFlagOn()) {
722 pMess[uIdx].GetMsErrorType());
727 pMess[uIdx].GetMsErrorType()));
739 LOG(fatal) <<
"CbmMcbm2018UnpackerAlgoSts::DoUnpack => "
740 <<
"Unknown message type, should never happen, stopping "
741 "here! Type found was: "
742 <<
static_cast<int>(typeMess);
774 const UShort_t& usElinkIdx,
775 const UInt_t& uAsicIdx,
799 UInt_t uChanInFeb = usChan
832 Long64_t ulHitTime = usRawTs;
877 ulHitTime, usRawAdc, uAsicIdx, usChan,
fuCurrDpbIdx, uCrobIdx));
951 << uMsIdx <<
" Msg Idx " << std::setw(5) << uMessIdx <<
" DPB "
952 << std::setw(2) <<
fuCurrDpbIdx <<
" Old TsMsb " << std::setw(5)
955 << std::setw(5) << uVal;
971 LOG(info) <<
"TS MSb Jump in "
974 << uMsIdx <<
" Msg Idx " << std::setw(5) << uMessIdx <<
" DPB "
977 << std::setw(5) << uVal;
982 if (4194303 == uVal && 1 == uMessIdx)
1020 const UInt_t& uAsicIdx) {
1064 new TH1I(
"hStsDigisTimeInRun",
1065 "Digis Nb vs Time in Run; Time in run [s]; Digis Nb []",
1072 new TH1I(
"fhVectorSize",
1073 "Size of the vector VS TS index; TS index; Size [bytes]",
1078 new TH1I(
"fhVectorCapacity",
1079 "Size of the vector VS TS index; TS index; Size [bytes]",
1088 new TH1I(
"fhMsCntEvo",
"; MS index [s]; Counts []", 600, 0.0, 600.0);
1092 "; MS index [s]; Error type []; Counts []",
1388 Double_t dOffsetIn) {
1402 for (UInt_t uFebIdx = 0; uFebIdx <
fuNbFebs; ++uFebIdx) {
1407 if (uFeb <
fuNbFebs && uChan < fUnpackPar->GetNbChanPerFeb())
1410 LOG(fatal) <<
"CbmMcbm2018UnpackerAlgoSts::MaskNoisyChannel => Invalid FEB "
1411 "and/or CHAN index:"
1412 << Form(
" %u vs %u and %u vs %u",
void ProcessStatusInfo(const stsxyter::Message &mess, const UInt_t &uAsicIdx)
std::vector< std::vector< UShort_t > > fvvusLastTsMsbChan
ADC of last hit message for each channel, [ AsicIdx ][ Chan ].
UInt_t fuMsIndex
Start Time in ns of current MS from its index field in header.
static constexpr UInt_t GetNbChanPerFeb()
Double_t fdCapacityIncFactor
UInt_t GetModuleAddress(UInt_t uModuleIdx)
Bool_t fbBinningFw
=> Quick and dirty hack for binning FW!!!
Bool_t CreateHistograms()
std::vector< std::vector< std::vector< Int_t > > > fviFebModuleSide
Idx of the STS module for each FEB, [ NbDpb ][ NbCrobPerDpb ][ NbFebsPerCrob ], -1 if inactive.
Int_t GetFebModuleSide(UInt_t uDpbIdx, UInt_t uCrobIdx, UInt_t uFebIdx)
Double_t fdMsSizeInNs
/** Ignore Overlap Ms: all fuOverlapMsNb MS at the end of timeslice **/
UInt_t GetModuleType(UInt_t uModuleIdx)
void ProcessHitInfo(const stsxyter::Message &mess, const UShort_t &usElinkIdx, const UInt_t &uAsicIdx, const UInt_t &uMsIdx)
std::vector< std::vector< UShort_t > > fvvusLastTsChan
std::vector< std::vector< std::vector< Int_t > > > fviFebModuleIdx
Number of StsXyter ASICs.
std::vector< CbmErrorMessage > fErrVect
UInt_t fuNbFebs
Array to hold the active flag for all CROBs, [ NbDpb ][ NbCrobPerDpb ].
std::vector< std::vector< UShort_t > > fvvusLastTsMsbCycleChan
TS MSB of last hit message for each channel, [ AsicIdx ][ Chan ].
UInt_t GetDpbId(UInt_t uDpbIdx)
CbmMcbm2018UnpackerAlgoSts()
Bool_t IsCrobActive(UInt_t uDpbIdx, UInt_t uCrobIdx)
std::vector< Int_t > fviModAddress
Type of each module: 0 for connectors on the right, 1 for connectors on the left.
static const uint64_t kulTsCycleNbBinsBinning
UInt_t fdAdcCut
Vector of channel masks, [ NbFeb ][ NbCHanInFeb ], used only if fbUseChannelMask is true.
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)
UInt_t fuCurrDpbIdx
Temp holder until Current equipment ID is properly filled in MS.
std::vector< Int_t > fviFebAddress
FEB type, [ NbDpb ][ NbCrobPerDpb ][ NbFebsPerCrob ], 0 = A, 1 = B, -1 if inactive.
uint16_t GetLinkIndex() const
For all data: Returns the (global) index of the eLink on which the message was received (n bit field)
Double_t fdTimeOffsetNs
ADC offset in e-, [ NbDpb * NbCrobPerDpb * NbFebsPerCrob ].
static const uint64_t kulTsCycleNbBins
static constexpr UInt_t GetNbFebsPerCrob()
ULong64_t fulCurrentTsIdx
Double_t fdTsFullSizeInNs
Total size of the core MS in a TS, [nanoseconds].
TList * fParCList
Parameter management.
static constexpr UInt_t GetNbAsicsPerCrob()
std::vector< size_t > fvMsComponentsList
Parameters related to FLES containers.
bool IsHitMissedEvts() const
For Hit data: Returns Missed event flag (1 bit field)
void AddMsComponentToList(size_t component, UShort_t usDetectorId)
void ProcessEpochInfo(const stsxyter::Message &mess)
Bool_t ProcessMs(const fles::Timeslice &ts, size_t uMsCompIdx, size_t uMsIdx)
uint16_t GetHitAdc() const
For Hit data: Returns ADC value (5 bit field)
std::vector< std::vector< bool > > fvvbMaskedChannels
std::vector< Bool_t > fvbMaskedComponents
Switch ON the filling of a additional set of histograms.
std::vector< Double_t > fvdTimeOffsetNsAsics
Double_t fdTsStopTimeCore
Time in ns of current TS from the index of the first MS first component.
Double_t GetFebAdcOffset(UInt_t uDpbIdx, UInt_t uCrobIdx, UInt_t uFebIdx)
static constexpr UInt_t GetNbAsicsPerFeb()
Bool_t fbDebugMonitorMode
Switch ON the filling of a minimal set of histograms.
std::vector< Int_t > fviModuleType
Total number of STS modules in the setup.
TH1 * fhDigisTimeInRun
TS MSB cycle of last hit message for each channel, [ AsicIdx ][ Chan ].
void SetTimeOffsetNsAsic(UInt_t uAsicIdx, Double_t dOffsetIn=0.0)
std::vector< std::vector< UShort_t > > fvvusLastAdcChan
TS of last hit message for each channel, [ AsicIdx ][ Chan ].
CbmRoot (+externals) headers.
static const uint32_t kuHitNbTsBins
UInt_t ElinkIdxToAsicIdx(Bool_t bFebType, UInt_t uElink)
Double_t fdTsCoreSizeInNs
Size of a single MS, [nanoseconds].
~CbmMcbm2018UnpackerAlgoSts()
uint16_t GetStatusStatus() const
For Status data: Returns the Status field from ACK frame (4 bit field)
std::vector< CbmStsDigi > fDigiVect
Vector of pointers to canvases + optional folder name.
UInt_t fuCurrDpbId
Current equipment ID, tells from which DPB the current MS is originating.
std::vector< Int_t > fviFebSide
STS address for each FEB, [ NbDpb * NbCrobPerDpb * NbFebsPerCrob ].
Data class for a single-channel message in the STS.
UInt_t fuNbStsXyters
Number of FEBs with StsXyter ASICs.
CbmMcbm2018StsPar * fUnpackPar
Settings from parameter file.
std::vector< stsxyter::FinalHit > fvmHitsInMs
Hits time-sorting.
static const double kdClockCycleNs
static constexpr UInt_t GetNbElinkPerCrob()
static const uint32_t kuHitNbTsBinsBinning
std::vector< Double_t > fvdFebAdcOffs
ADC gain in e-/b, [ NbDpb * NbCrobPerDpb * NbFebsPerCrob ].
MessType GetMessType() const
Returns the message type, see enum MessType.
Int_t GetFebModuleIdx(UInt_t uDpbIdx, UInt_t uCrobIdx, UInt_t uFebIdx)
Bool_t fbMonitorMode
Control flags.
std::vector< std::vector< Bool_t > > fvbCrobActiveFlag
Map of DPB Identifier to DPB index.
ULong64_t fulCurrentMsIdx
std::vector< ULong64_t > fvulCurrentTsMsb
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)
UInt_t fuCurrentEquipmentId
void MaskNoisyChannel(UInt_t uFeb, UInt_t uChan, Bool_t bMasked=kTRUE)
Double_t GetFebAdcGain(UInt_t uDpbIdx, UInt_t uCrobIdx, UInt_t uFebIdx)
Bool_t ReInitContainers()
void ProcessTsMsbInfo(const stsxyter::Message &mess, UInt_t uMessIdx=0, UInt_t uMsIdx=0)
uint16_t GetHitTime() const
For Hit data: Returns timestamp (8 bit field, 2 MSB bits overlap removed)
std::vector< std::vector< std::vector< Int_t > > > fviFebType
STS module side for each FEB, [ NbDpb ][ NbCrobPerDpb ][ NbFebsPerCrob ], 0 = P, 1 = N,...
std::vector< UInt_t > fvuCurrentTsMsbCycle
Current TS MSB for each DPB.
uint32_t GetTsMsbValBinning() const
For TS MSB data: Returns the TS MSB 29 bit field)
@ kSts
Silicon Tracking System.
std::map< stsxyter::MessType, UInt_t > fmMsgCounter
std::vector< Double_t > fvdFebAdcGain
Module side for each FEB, [ NbDpb * NbCrobPerDpb * NbFebsPerCrob ].
static const UInt_t kuMaxTsMsbDiffDuplicates
All hits (time in bins, ADC in bins, asic, channel) in last MS, sorted with "<" operator.
Int_t ElinkIdxToFebIdx(UInt_t uElink)
static const uint16_t kusLenStatStatus
static constexpr UInt_t GetNbCrobsPerDpb()
static constexpr UInt_t GetNbChanPerAsic()
std::map< UInt_t, UInt_t > fDpbIdIndexMap
Total number of STS DPBs in system.
Bool_t ProcessTs(const fles::Timeslice &ts)
UInt_t fuNrOfDpbs
STS address for the first strip of each module.
uint16_t GetHitTimeBinning() const