15#ifndef _ALICEO2_ITSMFT_GBTLINK_H_
16#define _ALICEO2_ITSMFT_GBTLINK_H_
18#define _RAW_READER_ERROR_CHECKS_
34#define GBTLINK_DECODE_ERRORCHECK(errRes, errEval) \
36 if ((errRes)&uint8_t(ErrorPrinted)) { \
37 ruPtr->linkHBFToDump[(uint64_t(subSpec) << 32) + hbfEntry] = irHBF.orbit; \
38 errRes &= ~uint8_t(ErrorPrinted); \
40 if ((errRes)&uint8_t(Abort)) { \
42 return (status = AbortedOnError); \
138 void clear(
bool resetStat =
true,
bool resetTFRaw =
false);
140 template <
class Mapping>
148 LOGP(info,
"Caching new RDH block for {}",
describe());
149 const auto* rdh =
reinterpret_cast<const RDH*
>(
ptr);
154 long szd = RDHUtils::getMemorySize(*rdh);
155 long offs =
sizeof(
RDH);
156 char* ptrR = ((
char*)
ptr) +
sizeof(
RDH);
159 std::string com = fmt::format(
" | FeeID:{:#06x} offs: {:6} ",
feeID, offs);
162 }
else if (
w->isDataHeader()) {
163 com +=
"data header";
164 }
else if (
w->isDataTrailer()) {
165 com +=
"data trailer";
166 }
else if (
w->isTriggerWord()) {
169 }
else if (
w->isDiagnosticWord()) {
171 }
else if (
w->isCalibrationWord()) {
173 }
else if (
w->isCableDiagnostic()) {
174 com +=
"cable diag word";
175 }
else if (
w->isStatus()) {
176 com +=
"status word";
190 void printTrigger(
const GBTTrigger* gbtTrg,
int offs);
196 void printCalibrationWord(
const GBTCalibration* gbtCal,
int offs);
200 bool isAlignmentPadding()
210#ifndef _RAW_READER_ERROR_CHECKS_
211 bool checkErrorsRDH(
const RDH& rdh)
const
218 uint8_t checkErrorsTriggerWord(
const GBTTrigger* gbtTrg)
const {
return NoError; }
219 uint8_t checkErrorsHeaderWord(
const GBTDataHeader* gbtH)
const {
return NoError; }
220 uint8_t checkErrorsHeaderWord(
const GBTDataHeaderL* gbtH)
const {
return NoError; }
221 uint8_t checkErrorsActiveLanes(
int cables)
const {
return NoError; }
222 uint8_t checkErrorsGBTData(
int cablePos)
const {
return NoError; }
223 uint8_t checkErrorsTrailerWord(
const GBTDataTrailer* gbtT)
const {
return NoError; }
224 uint8_t checkErrorsPacketDoneMissing(
const GBTDataTrailer* gbtT,
bool notEnd)
const {
return NoError; }
226 uint8_t checkErrorsDiagnosticWord(
const GBTDiagnostic* gbtD)
const {
return NoError; }
227 uint8_t checkErrorsCalibrationWord(
const GBTCalibration* gbtCal)
const {
return NoError; }
232 uint8_t checkErrorsAlignmentPadding();
235 uint8_t checkErrorsRDHStopPageEmpty(
const RDH& rdh);
236 uint8_t checkErrorsTriggerWord(
const GBTTrigger* gbtTrg);
237 uint8_t checkErrorsHeaderWord(
const GBTDataHeader* gbtH);
238 uint8_t checkErrorsHeaderWord(
const GBTDataHeaderL* gbtH);
239 uint8_t checkErrorsActiveLanes(
int cables);
240 uint8_t checkErrorsGBTData(
int cablePos);
241 uint8_t checkErrorsTrailerWord(
const GBTDataTrailer* gbtT);
242 uint8_t checkErrorsPacketDoneMissing(
const GBTDataTrailer* gbtT,
bool notEnd);
243 uint8_t checkErrorsLanesStops();
244 uint8_t checkErrorsDiagnosticWord(
const GBTDiagnostic* gbtD);
245 uint8_t checkErrorsCalibrationWord(
const GBTCalibration* gbtCal);
247 uint8_t checkErrorsIRNotExtracted();
250 uint8_t checkErrorsGBTDataID(
const GBTData* dbtD);
258template <
class Mapping>
268 bool expectPacketDone =
false;
289 if (RDHUtils::getPageCounter(*rdh) == 0 ||
irHBF.
isDummy()) {
290 irHBF = RDHUtils::getHeartBeatIR(*rdh);
300 if (RDHUtils::getStop(*rdh)) {
323 bool cruPageAlignmentPaddingSeen =
false;
329 while (dataOffset < currRawPiece->
size) {
349 if (gbtC->isCalibrationWord()) {
354 LOGP(
debug,
"SetCalibData for RU:{} at bc:{}/orb:{} : [{}/{}]",
ruPtr->
ruSWID, gbtTrg ? gbtTrg->
bc : -1, gbtTrg ? gbtTrg->
orbit : -1, gbtC->calibCounter, gbtC->calibUserField);
377 if (cruPageAlignmentPaddingSeen) {
382 LOGP(info,
"Offs {} End of the CRU page reached while scanning triggers, continue to next page, {}",
dataOffset,
int(
status),
describe());
391 expectPacketDone =
true;
393 while (!gbtD->isDataTrailer() && !(cruPageAlignmentPaddingSeen = isAlignmentPadding())) {
394 if (verboseRawData) {
399 int cableHW = gbtD->getCableID(), cableSW = chmap.cableHW2SW(
ruPtr->
ruInfo->
ruType, cableHW);
412 if (cruPageAlignmentPaddingSeen) {
424 if ((cruPageAlignmentPaddingSeen = isAlignmentPadding())) {
428 if (!gbtT->packetDone) {
435 LOGP(info,
"Offs {} Leaving collectROFCableData for {} with DataSeen",
dataOffset,
describe());
441 if (expectPacketDone) {
Alpide Chip and GBT link decoding statistics.
unsigned short int uint16_t
#define GBTLINK_DECODE_ERRORCHECK(errRes, errEval)
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char Directory with events to Events directory is and not inside events Show standalone event Run event generator maximum time bin of continuous for triggered for automatic continuous for automatic continuous triggered uint64_t
configStandalone Reconstruction rec_tpc multiplier for the combined cluster track error during track following area in cm for the search of for z only used if decrease removal by when above this local occupancy rowx Shift of TPC revert cluster flag edge bit distance to edge exceeds this ZOffset for secondary multiple of radius max P of electron K BB bands crossing max P of electron p BB bands crossing max P of electron d BB bands crossing max P of electron t BB bands crossing min accepted dEdxMaxTPC of the track Additive extra cluster error for Y2 if edge flag set Additive extra cluster error for Y2 if single set Additive extra cluster error for Y2 if or single set Additive extra cluster error for Z2 if or single set Extra errors to add to track when crossing depending on addErrorsCECrossing Inner portion of y range in sector that is not used in searching for extrapolated track candidates factor2YS for track merging factor2K for track merging Margin in cm of Y position when rejecting edge clusters based on uncorrected track Y Max fraction of shared clusters for tracklet Except pad from cluster finding if total number of charges in a fragment is above this Except pad from cluster finding if number of consecutive charges in a fragment is above this Threshold where a timebin is considered disabling the noisy pad check for that pad Treat signal above this minimum as saturated Smoothing factor for the exponential Highly Ionising Particle tail filter Number of timebins to use for the averaging Add additional custom track errors when crossing relative as fraction of Do N fit passes in final fit of< 0:reject at max -n hits") AddOptionRTC(rejectIFCLowRadiusCluster, uint8_t, 1, "", 0, "Reject clusters that get the IFC mask error during refit") AddOptionRTC(dEdxTruncLow, uint8_t, 2, "", 0, "Low truncation threshold, fraction of 128") AddOptionRTC(dEdxTruncHigh, uint8_t, 77, "", 0, "High truncation threshold, fraction of 128") AddOptionRTC(extrapolationTracking, int8_t, 1, "", 0, "Enable Extrapolation Tracking(prolong tracks to adjacent sectors to find short segments)") AddOptionRTC(disableRefitAttachment, uint8_t, 0, "", 0, "Bitmask to disable certain attachment steps during refit(1:attachment, 2:propagation, 4:loop following, 8:mirroring)") AddOptionRTC(rejectionStrategy, uint8_t, o2::gpu::GPUSettings::RejectionStrategyA, "", 0, "Enable rejection of TPC clusters for compression(0=no, 1=strategy A, 2=strategy B)") AddOptionRTC(mergeLoopersAfterburner, uint8_t, 1, "", 0, "Run afterburner for additional looper merging") AddOptionRTC(compressionTypeMask, uint8_t, o2::gpu::GPUSettings::CompressionFull, "", 0, "TPC Compression mode bits(1=truncate charge/width LSB, 2=differences, 4=track-model)") AddOptionRTC(compressionSortOrder, uint8_t, o2::gpu::GPUSettings::SortTime, "", 0, "Sort order of TPC compression(0=time, 1=pad, 2=Z-time-pad, 3=Z-pad-time, 4=no sorting(use incoming order))") AddOptionRTC(sigBitsCharge, uint8_t, 4, "", 0, "Number of significant bits for TPC cluster charge in compression mode 1") AddOptionRTC(sigBitsWidth, uint8_t, 3, "", 0, "Number of significant bits for TPC cluster width in compression mode 1") AddOptionRTC(dropLoopers, uint8_t, 0, "", 0, "Drop looping tracks starting from second loop") AddOptionRTC(mergerInterpolateErrors, uint8_t, 1, "", 0, "Use interpolation instead of extrapolation for chi2 based cluster rejection") AddOptionRTC(mergerInterpolateRejectAlsoOnCurrentPosition, uint8_t, 1, "", 0, "When using mergerInterpolateErrors, reject based on chi2 twice computed with interpolated and current track position starting from NDF > mergerNonInterpolateRejectMinNDF Merge tracks accross the central electrode Enable PID response Add sub threshold clusters in TPC dEdx computation OR mask of TPC flags that will reject the cluster in alternative dEdx Reject edge clusters based on uncorrected track Y during track fit Increase decrease removal by when on this number of pads from the edge h configStandalone Reconstruction rec_trd Max chi2 for TRD tracklets to be matched to a track Chi2 cut for strict matching mode Number of sigmas for ITS TPC track time error estimate Addition to search road around track prolongation along Y in cm Optimal tracklet rphi resolution in maximum chi2 per attached tracklet for TRD tracks take into account the full likelihood of the slope including exponential tails Tracks with less attached tracklets are discarded after the tracking Post trigger Pile up integration time in BCs fits all iterations but the last one in projections Use material lookup table for TPC refit Apply workarounds to avoid cyclic merge should not be needed tpc dyn configStandalone Processing proc_rtc Replace constant variables static by constexpr expressions false
configStandalone Reconstruction rec_tpc multiplier for the combined cluster track error during track following area in cm for the search of for z only used if decrease removal by when above this local occupancy rowx Shift of TPC revert cluster flag edge bit distance to edge exceeds this ZOffset for secondary multiple of radius max P of electron K BB bands crossing max P of electron p BB bands crossing max P of electron d BB bands crossing max P of electron t BB bands crossing min accepted dEdxMaxTPC of the track Additive extra cluster error for Y2 if edge flag set Additive extra cluster error for Y2 if single set Additive extra cluster error for Y2 if or single set Additive extra cluster error for Z2 if or single set Extra errors to add to track when crossing depending on addErrorsCECrossing Inner portion of y range in sector that is not used in searching for extrapolated track candidates factor2YS for track merging factor2K for track merging Margin in cm of Y position when rejecting edge clusters based on uncorrected track Y Max fraction of shared clusters for tracklet Except pad from cluster finding if total number of charges in a fragment is above this Except pad from cluster finding if number of consecutive charges in a fragment is above this Threshold where a timebin is considered disabling the noisy pad check for that pad Treat signal above this minimum as saturated Smoothing factor for the exponential Highly Ionising Particle tail filter Number of timebins to use for the averaging Add additional custom track errors when crossing relative as fraction of Do N fit passes in final fit of< 0:reject at max -n hits") AddOptionRTC(rejectIFCLowRadiusCluster, uint8_t, 1, "", 0, "Reject clusters that get the IFC mask error during refit") AddOptionRTC(dEdxTruncLow, uint8_t, 2, "", 0, "Low truncation threshold, fraction of 128") AddOptionRTC(dEdxTruncHigh, uint8_t, 77, "", 0, "High truncation threshold, fraction of 128") AddOptionRTC(extrapolationTracking, int8_t, 1, "", 0, "Enable Extrapolation Tracking(prolong tracks to adjacent sectors to find short segments)") AddOptionRTC(disableRefitAttachment, uint8_t, 0, "", 0, "Bitmask to disable certain attachment steps during refit(1:attachment, 2:propagation, 4:loop following, 8:mirroring)") AddOptionRTC(rejectionStrategy, uint8_t, o2::gpu::GPUSettings::RejectionStrategyA, "", 0, "Enable rejection of TPC clusters for compression(0=no, 1=strategy A, 2=strategy B)") AddOptionRTC(mergeLoopersAfterburner, uint8_t, 1, "", 0, "Run afterburner for additional looper merging") AddOptionRTC(compressionTypeMask, uint8_t, o2::gpu::GPUSettings::CompressionFull, "", 0, "TPC Compression mode bits(1=truncate charge/width LSB, 2=differences, 4=track-model)") AddOptionRTC(compressionSortOrder, uint8_t, o2::gpu::GPUSettings::SortTime, "", 0, "Sort order of TPC compression(0=time, 1=pad, 2=Z-time-pad, 3=Z-pad-time, 4=no sorting(use incoming order))") AddOptionRTC(sigBitsCharge, uint8_t, 4, "", 0, "Number of significant bits for TPC cluster charge in compression mode 1") AddOptionRTC(sigBitsWidth, uint8_t, 3, "", 0, "Number of significant bits for TPC cluster width in compression mode 1") AddOptionRTC(dropLoopers, uint8_t, 0, "", 0, "Drop looping tracks starting from second loop") AddOptionRTC(mergerInterpolateErrors, uint8_t, 1, "", 0, "Use interpolation instead of extrapolation for chi2 based cluster rejection") AddOptionRTC(mergerInterpolateRejectAlsoOnCurrentPosition, uint8_t, 1, "", 0, "When using mergerInterpolateErrors, reject based on chi2 twice computed with interpolated and current track position starting from NDF > mergerNonInterpolateRejectMinNDF Merge tracks accross the central electrode Enable PID response Add sub threshold clusters in TPC dEdx computation OR mask of TPC flags that will reject the cluster in alternative dEdx Reject edge clusters based on uncorrected track Y during track fit Increase decrease removal by when on this number of pads from the edge h configStandalone Reconstruction rec_trd Max chi2 for TRD tracklets to be matched to a track Chi2 cut for strict matching mode Number of sigmas for ITS TPC track time error estimate Addition to search road around track prolongation along Y in cm Optimal tracklet rphi resolution in maximum chi2 per attached tracklet for TRD tracks take into account the full likelihood of the slope including exponential tails Tracks with less attached tracklets are discarded after the tracking Post trigger Pile up integration time in BCs fits all iterations but the last one in projections Use material lookup table for TPC refit Apply workarounds to avoid cyclic merge should not be needed tpc dyn configStandalone Processing proc_rtc Replace constant variables static by constexpr expressions Compile RTC in deterministic with NO_FAST_MATH flags and GPUCA_DETERMINISTIC_MODE define Use RTC to optimize GPU code h configStandalone Processing proc_rtctech Use a file lock to serialize access to the cache folder int32_t
Declaration of class for continuos buffer of ALPIDE data.
Declaration of class for scatter-gather buffer.
Definition Physics trigger record extracted from the ITS/MFT stream.
Declaration of the Readout Unite decoder class.
Checks validity of hardware address (HW) and transform it to digit AbsId index.
const SGPiece * currentPiece() const
const SGPiece * nextPiece()
size_t & currentPieceID()
void add(const DataType *ptr, size_t n)
read current character value from buffer w/o stepping forward
GLubyte GLubyte GLubyte GLubyte w
constexpr int GBTPaddedWordLength
constexpr int GBTWordLength
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
uint16_t bc
bunch crossing ID of interaction
Statistics for per-link decoding.
std::array< uint32_t, GBTDataTrailer::MaxStateCombinations > packetStates
support for the GBT single link data
CollectedDataStatus status
bool needToPrintError(uint32_t count)
void cacheData(const void *ptr, size_t sz)
static constexpr int CRUPageAlignment
std::string describe() const
void accountLinkRecovery(o2::InteractionRecord ir)
const PayLoadSG::SGPiece * currRawPiece
GBTLinkDecodingStat statistics
CollectedDataStatus collectROFCableData(const Mapping &chmap)
CollectedDataStatus statusInTF
std::vector< PhysTrigger > * extTrigVec
o2::InteractionRecord irHBF
uint64_t continuation
13 No data expected (too close to previous trigger or error)
uint64_t noData
12 Used in Continuous Mode for internally generated trigger
uint64_t internal
0:11 12 lowest bits of trigger type received from CTP
uint64_t orbit
28:31 reserved
bool isTriggerWord() const
check if the GBT Header corresponds to GBT trigger word
void printX(bool padded=true, std::string com="") const
std::array< PayLoadCont, MaxCablesPerRU > cableData
std::array< uint8_t, MaxCablesPerRU > cableHWID
std::array< GBTLink *, MaxCablesPerRU > cableLinkPtr
std::array< uint8_t, MaxCablesPerRU > cableLinkID
static void printRDH(const RDHv4 &rdh)