23#include <fairlogger/Logger.h>
36 "Row Marker Word with 0 words",
37 "Duplicated Pad Word !",
38 "Row Marker Wrong/Lost -> to EoE",
39 "Row Marker Wrong/Lost -> to EoE",
40 "Row Marker reports an ERROR !",
43 "Wrong size definition in EoE Marker",
44 "Double Mark Word",
"Wrong Size in Segment Marker",
46 "HMPID Header Errors"};
50 "L1-Trigger received without L0",
51 "L1-Trigger received before the L1-Latency",
52 "L1-Trigger received after the L1-Time-Latency-Window",
53 "L1-Trigger after L1-Message or after timeout (12.8us)",
54 "L1-Message before L1-Trigger or after timeout (12.8us)"};
196 if ((wp & 0x0000ffff) == 0x000036A8 || (wp & 0x0000ffff) == 0x000032A8 || (wp & 0x0000ffff) == 0x000030A0 || (wp & 0x0800ffff) == 0x080010A0) {
197 *
p2 = (wp & 0x03ff0000) >> 16;
198 *
p1 = wp & 0x0000ffff;
201 if ((wp & 0xfff00000) >> 20 == 0xAB0) {
202 *
p2 = (wp & 0x000fff00) >> 8;
203 *
p1 = (wp & 0xfff00000) >> 20;
204 *p3 = wp & 0x0000000F;
205 if (*p3 < 4 && *p3 > 0) {
210 if ((wp & 0x0803FF80) == 0x08000080) {
211 *
p1 = (wp & 0x07c00000) >> 22;
212 *
p2 = (wp & 0x003C0000) >> 18;
213 *p3 = (wp & 0x0000007F);
214 if (*
p1 < 25 && *
p2 < 11) {
218 if ((wp & 0x08000000) == 0) {
220 *
p1 = (wp & 0x07c00000) >> 22;
221 *
p2 = (wp & 0x003C0000) >> 18;
222 *p3 = (wp & 0x0003F000) >> 12;
223 *p4 = (wp & 0x00000FFF);
224 if (*
p1 > 0 && *p1 < 25 && *p2 > 0 && *
p2 < 11 && *p3 < 48) {
241 if ((wp & 0x0000ffff) == 0x36A8 || (wp & 0x0000ffff) == 0x32A8 || (wp & 0x0000ffff) == 0x30A0 || (wp & 0x0800ffff) == 0x080010A0) {
242 *rowSize = (wp & 0x03ff0000) >> 16;
243 *mark = wp & 0x0000ffff;
262 if ((wp & 0xfff00000) >> 20 == 0xAB0) {
263 *segSize = (wp & 0x000fff00) >> 8;
264 *mark = (wp & 0xfff00000) >> 20;
265 *Seg = wp & 0x0000000F;
266 if (*Seg > 3 || *Seg < 1) {
268 std::cout <<
"HMPID Decoder2 : [INFO] "
269 <<
" Wrong segment Marker Word, bad Number of segment" << *Seg <<
"!" << std::endl;
292 if ((wp & 0x08000000) != 0) {
295 *Col = (wp & 0x07c00000) >> 22;
296 *Dilogic = (wp & 0x003C0000) >> 18;
297 *Channel = (wp & 0x0003F000) >> 12;
298 *Charge = (wp & 0x00000FFF);
301 row = (wp & 0x03ff0000) >> 16;
303 if (mark == 0x036A8 || mark == 0x032A8 || mark == 0x030A0 || mark == 0x010A0) {
304 if (*Dilogic > 10 || *Channel > 47 || *Dilogic < 1 || *Col > 24 || *Col < 1 || row <= 490 || row > 10) {
308 if (*Dilogic > 10 || *Channel > 47 || *Dilogic < 1 || *Col > 24 || *Col < 1) {
328 if ((wp & 0x0803FF80) == 0x08000080) {
329 *Col = (wp & 0x07c00000) >> 22;
330 *Dilogic = (wp & 0x003C0000) >> 18;
331 *Eoesize = (wp & 0x0000007F);
332 if (*Col > 24 || *Dilogic > 10) {
334 std::cout <<
"HMPID Decoder2 : [DEBUG] "
335 <<
" EoE size wrong definition. Col=" << *Col <<
" Dilogic=" << *Dilogic << std::endl;
356 if ((ErrorField & (0x01 <<
i)) != 0) {
411 std::cout <<
"HMPID Decoder2 : [INFO] "
417 if (*EquipIndex == -1) {
419 std::cout <<
"HMPID Decoder2 : [ERROR] "
420 <<
"ERROR ! Bad equipment Number: " <<
mEquipment << std::endl;
426 std::cout <<
"HMPID Decoder2 : [ERROR] "
427 <<
"ERROR ! Bad Detector Id Number: " <<
mHeDetectorID << std::endl;
460 if (EquipmentIndex < 0 || EquipmentIndex > 13) {
462 std::cout <<
"HMPID Decoder2 : [ERROR] "
463 <<
"Bad Equipment number !" << EquipmentIndex << std::endl;
482 std::cout <<
"HMPID Header reports an error : " <<
mHeHmpidError << std::endl;
503 std::cout <<
"HMPID Decoder2 : [DEBUG] "
504 <<
"End main decoding loop !" << std::endl;
512 std::cout <<
"HMPID Decoder2 : [ERROR] "
513 <<
"Failed to decode the Header !" << std::endl;
534 if (newOne ==
true) {
555 std::cout <<
"HMPID Decoder2 : [INFO] "
557 << eq->
mEventNumber <<
" >" << std::hex << wp << std::dec <<
"<" <<
type << std::endl;
576 std::cout <<
"HMPID Decoder2 : [INFO] "
625 if (isIt ==
true &&
error ==
false) {
637 std::cout <<
"HMPID Decoder2 : [INFO] "
638 <<
"Event" << eq->
mEventNumber <<
" >" <<
p1 - 1 <<
"," <<
p2 - 1 <<
"," << p3 <<
"," << p4 << std::endl;
657 if (isIt ==
true &&
error ==
false) {
704 int typb, p1b, p2b, p3b, p4b;
705 typb =
checkType((wp | 0x08000000), &p1b, &p2b, &p3b, &p4b);
724 }
else if (
type == 2) {
767 std::cout <<
"HMPID Decoder2 : [DEBUG] "
768 <<
"Enter decoding !" << std::endl;
777 std::cout <<
"HMPID Decoder2 : [DEBUG] "
778 <<
"End main buffer decoding loop !" << std::endl;
824 std::cout <<
"HMPID Decoder2 : [INFO] "
825 <<
"End Fast Page decoding loop ! (" <<
e <<
")" << std::endl;
833 std::cout <<
"HMPID Decoder2 : [INFO] "
834 <<
"Failed to decode the Header ! (" <<
e <<
")" << std::endl;
843 std::cout <<
"HMPID Decoder2 : [INFO] "
844 <<
"Failed to evaluate the Header ! (" <<
e <<
")" << std::endl;
851 int Column, Dilogic, Channel, Charge;
859 std::cout <<
"HMPID Decoder2 : [DEBUG] "
863 if (
isPadWord(wp, &pwer, &Column, &Dilogic, &Channel, &Charge) ==
true) {
865 if (!((equipmentIndex == 6 && Column == 16 && Dilogic == 10) || (equipmentIndex == 13 && Column == 18 && Dilogic == 2))) {
866 setPad(eq, Column - 1, Dilogic - 1, Channel, Charge);
888 bool isNotEmpty =
true;
896 std::cout <<
"HMPID Decoder2 : [INFO] "
897 <<
"Enter FAST decoding !" << std::endl;
905 std::cout <<
"HMPID Decoder2 : [ERROR] "
906 <<
"End Buffer Fast Decoding! Exit code error = " <<
e << std::endl;
983 return (
mTheEquipments[EqInd]->mPadSamples[Column][Dilogic][Channel]);
998 return (
mTheEquipments[EqInd]->mPadSum[Column][Dilogic][Channel]);
1013 return (
mTheEquipments[EqInd]->mPadSquares[Column][Dilogic][Channel]);
1052 std::cout <<
"Dump Errors for the Equipment = " << EquipmId << std::endl;
1056 std::cout <<
" -------- " << std::endl;
1070 int Module = EquipmId / 2;
1071 int StartRow = (EquipmId % 2 == 1) ? 80 : 0;
1072 int EndRow = (EquipmId % 2 == 1) ? 160 : 80;
1073 std::cout <<
"Dump Pads for the Equipment = " << EquipmId << std::endl;
1074 for (
int c = 0;
c < 144;
c++) {
1075 for (
int r = StartRow;
r < EndRow;
r++) {
1088 std::cout << std::endl;
1090 std::cout <<
" -------- " << std::endl;
1101 std::cout <<
"HMPID Decoder2 : [ERROR] "
1102 <<
"HMPID Error field = " << ErrorField <<
" : " << printbuf << std::endl;
1104 LOG(warn) <<
"HMPID Header Error Field =" << ErrorField <<
" [" << printbuf <<
"]"
1116 const unsigned char*
data =
static_cast<const unsigned char*
>(MemoryStartPtr);
1117 for (std::size_t
i = 0;
i < Dimension;
i += 16) {
1118 std::cout << std::hex << std::setw(4) << std::setfill(
'0') <<
i <<
" : ";
1120 for (std::size_t
j = 0;
j < 16; ++
j) {
1121 if (
i +
j < Dimension) {
1122 std::cout << std::hex << std::setw(2) << std::setfill('0') << static_cast<int>(
data[
i +
j]) <<
" ";
1129 for (std::size_t
j = 0;
j < 16 &&
i +
j < Dimension; ++
j) {
1130 char ch = (
data[
i +
j] >= 32 &&
data[
i +
j] <= 126) ?
static_cast<char>(
data[
i +
j]) :
'.';
1133 std::cout << std::endl;
1144 FILE* fs = fopen(summaryFileName,
"w");
1145 if (fs ==
nullptr) {
1146 printf(
"Error opening the file %s !\n", summaryFileName);
1150 fprintf(fs,
"HMPID Readout Raw Data Decoding Summary File\n");
1151 fprintf(fs,
"Equipment Id\t");
1157 fprintf(fs,
"Number of events\t");
1163 fprintf(fs,
"Average Event Size\t");
1169 fprintf(fs,
"Total pads\t");
1175 fprintf(fs,
"Average pads per event\t");
1181 fprintf(fs,
"Busy Time average\t");
1187 fprintf(fs,
"Event rate\t");
1193 fprintf(fs,
"Number of Empty Events\t");
1199 fprintf(fs,
"-------------Errors--------------------\n");
1200 fprintf(fs,
"Wrong events\t");
1214 fprintf(fs,
"Total errors\t");
1279 long wordsBufferLen = BufferLen / (
sizeof(
int32_t) /
sizeof(
char));
1280 if (Buffer ==
nullptr) {
1282 std::cout <<
"HMPID Decoder2 : [ERROR] "
1283 <<
"Raw data buffer null Pointer ! " << std::endl;
1287 if (wordsBufferLen == 0) {
1289 std::cout <<
"HMPID Decoder2 : [ERROR] "
1290 <<
"Raw data buffer Empty ! " << std::endl;
1294 if (wordsBufferLen < 16) {
1296 std::cout <<
"HMPID Decoder2 : [ERROR] "
1297 <<
"Raw data buffer less then the Header Dimension = " << wordsBufferLen << std::endl;
1307 std::cout <<
"HMPID Decoder2 : setUpStream() "
1309 <<
" BufferLen = " << std::dec << BufferLen << std::endl;
1310 if (BufferLen < 256) {
unsigned short int uint16_t
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 e
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 d
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
constexpr int p1()
constexpr to accelerate the coordinates changing
#define MAXDESCRIPTIONLENGHT
char error[CURL_ERROR_SIZE]
Class for time synchronization of RawReader instances.
static void absolute2Equipment(int Module, int x, int y, int *Equi, int *Colu, int *Dilo, int *Chan)
static constexpr int MAXEQUIPMENTS
float getAverageEventSize(int Equipment)
HmpidDecoder2(int *EqIds, int *CruIds, int *LinkIds, int numOfEquipments)
static char sHmpidErrorDescription[MAXHMPIDERRORS][MAXDESCRIPTIONLENGHT]
HMPID Firmware Error Messages Definitions.
void dumpPads(int Equipment, int type=0)
bool isPadWord(uint32_t wp, int *Err, int *Col, int *Dilogic, int *Channel, int *Charge)
void setPad(HmpidEquipment *eq, int col, int dil, int ch, uint16_t charge)
int checkType(uint32_t wp, int *p1, int *p2, int *p3, int *p4)
bool isEoEmarker(uint32_t wp, int *Err, int *Col, int *Dilogic, int *Eoesize)
void decodePageFast(uint32_t **streamBuf)
void init()
Init all the members variables.
std::vector< o2::hmpid::Digit > mDigits
uint32_t readWordFromStream()
bool decodeHmpidError(int ErrorField, char *outbuf)
void dumpMemory(const void *MemoryStartPtr, std::size_t Dimension)
uint32_t * mActualStreamPtr
double getChannelSquare(int Equipment, int Column, int Dilogic, int Channel)
static char sErrorDescription[MAXERRORS][MAXDESCRIPTIONLENGHT]
Decoding Error Messages Definitions.
HmpidEquipment * evaluateHeaderContents(int EquipmentIndex)
void decodePage(uint32_t **streamBuffer)
uint16_t getChannelSamples(int Equipment, int Column, int Dilogic, int Channel)
~HmpidDecoder2()
Destructor : remove the Equipments instances.
bool isRowMarker(uint32_t wp, int *Err, int *rowSize, int *mark)
o2::InteractionRecord mIntReco
bool setUpStream(void *Buffer, long BufferLen)
int decodeHeader(uint32_t *streamPtrAdr, int *EquipIndex)
void writeSummaryFile(char *summaryFileName)
void dumpErrors(int Equipment)
int getEquipmentIndex(int EquipmentId)
double getPadSum(int Module, int Row, int Column)
bool isSegmentMarker(uint32_t wp, int *Err, int *segSize, int *Seg, int *mark)
HmpidEquipment * mTheEquipments[Geo::MAXEQUIPMENTS]
uint16_t getPadSamples(int Module, int Row, int Column)
bool getHeaderFromStream(uint32_t **streamPtr)
uint32_t * mStartStreamPtr
void updateStatistics(HmpidEquipment *eq)
void dumpHmpidError(HmpidEquipment *eq, int ErrorField, int mHeBCDI, int mHeORBIT)
float getAverageBusyTime(int Equipment)
bool getBlockFromStream(uint32_t **streamPtr, uint32_t Size)
double getPadSquares(int Module, int Row, int Column)
double getChannelSum(int Equipment, int Column, int Dilogic, int Channel)
int getEquipmentID(int CruId, int LinkId)
int mWordsPerDilogicCounter
void setPad(int col, int dil, int cha, uint16_t charge)
void setError(int ErrType)
void init()
Inits the members for the decoding.
void resetPadMap()
Resets the matrix that contains the results of the decoding.
void resetErrors()
Resets the decoding errors statistics.
float mPadsPerEventAverage
static int FeeId(unsigned int idx)
static int CruId(unsigned int idx)
static int LnkId(unsigned int idx)
GLint GLint GLsizei GLint GLenum GLenum type
const int ERR_DOUBLEEOEMARK
const int TH_WRONGEQUIPINDEX
const int ERR_DOUBLEMARKWORD
const int ERR_DUPLICATEPAD
const int ERR_LOSTEOEMARK
const int ERR_WRONGSIZESEGMENTMARK
const int TH_NULLBUFFERPOINTER
const int ERR_ROWMARKEMPTY
const int TH_BUFFERPOINTERTOEND
const uint64_t OUTRANGEEVENTNUMBER
const int ERR_LOSTEOSMARK
const int ERR_ROWMARKWRONG
const int ERR_ROWMARKERROR
const int ERR_ROWMARKLOST
const int TH_WRONGBUFFERDIM
const int ERR_WRONGSIZEINEOE
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"