Skip to content

Commit d5e7e64

Browse files
committed
added equipment option dropPagesWithError
1 parent df3958f commit d5e7e64

File tree

5 files changed

+23
-4
lines changed

5 files changed

+23
-4
lines changed

doc/configurationParameters.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ The parameters related to 3rd-party libraries are described here for convenience
103103
| equipment-* | dataPagesLogPath | string | | Path where to save a summary of each data pages generated by equipment. |
104104
| equipment-* | debugFirstPages | int | 0 | If set, print debug information for first (given number of) data pages readout. |
105105
| equipment-* | disableOutput | int | 0 | If non-zero, data generated by this equipment is discarded immediately and is not pushed to output fifo of readout thread. Used for testing. |
106+
| equipment-* | dropPagesWithError | int | 0 | If set, the pages with RDH errors are discarded (requires rdhCheckEnabled or rdhUseFirstInPage). |
106107
| equipment-* | enabled | int | 1 | Enable (value=1) or disable (value=0) the equipment. |
107108
| equipment-* | equipmentType | string | | The type of equipment to be instanciated. One of: dummy, rorc, cruEmulator |
108109
| equipment-* | firstPageOffset | bytes | | Offset of the first page, in bytes from the beginning of the memory pool. If not set (recommended), will start at memoryPoolPageSize (one free page is kept before the first usable page for readout internal use). |

doc/releaseNotes.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,3 +524,7 @@ This file describes the main feature changes for each readout.exe released versi
524524
## v2.17.0 - 01/03/2022
525525
- Updated configuration syntax: section names ending with `-*` can be used to define default parameters. They are applied to all section with similar names. Existing key-value pairs are not overwritten, but are defined according to defaults if they don't exist. For example, it is possible to define the TFperiod for all equipments by adding a section named `[equipment-*]` with `TFperiod=32`.
526526
- Updated readout to new bookkeeping API.
527+
528+
## next version
529+
- Updated configuration parameters:
530+
- added equipment-*.dropPagesWithError: if set, the pages with RDH errors are discarded (requires rdhCheckEnabled or rdhUseFirstInPage). This may be used if downstream software is not robust to RDH errors.

src/ReadoutEquipment.cxx

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,9 @@ ReadoutEquipment::ReadoutEquipment(ConfigFile& cfg, std::string cfgEntryPoint, b
145145
cfg.getOptionalValue<int>(cfgEntryPoint + ".rdhCheckDetectorField", cfgRdhCheckDetectorField);
146146
// configuration parameter: | equipment-* | rdhCheckTrigger | int | 0 | If set, the RDH trigger counters are checked for consistency. |
147147
cfg.getOptionalValue<int>(cfgEntryPoint + ".rdhCheckTrigger", cfgRdhCheckTrigger);
148-
theLog.log(LogInfoDevel_(3002), "RDH settings: rdhCheckEnabled=%d rdhDumpEnabled=%d rdhDumpErrorEnabled=%d rdhDumpWarningEnabled=%d rdhUseFirstInPageEnabled=%d rdhCheckFirstOrbit=%d rdhCheckDetectorField=%d", cfgRdhCheckEnabled, cfgRdhDumpEnabled, cfgRdhDumpErrorEnabled, cfgRdhDumpWarningEnabled, cfgRdhUseFirstInPageEnabled, cfgRdhCheckFirstOrbit, cfgRdhCheckDetectorField);
148+
// configuration parameter: | equipment-* | dropPagesWithError | int | 0 | If set, the pages with RDH errors are discarded (requires rdhCheckEnabled or rdhUseFirstInPage). |
149+
cfg.getOptionalValue<int>(cfgEntryPoint + ".dropPagesWithError", cfgDropPagesWithError);
150+
theLog.log(LogInfoDevel_(3002), "RDH settings: rdhCheckEnabled=%d rdhDumpEnabled=%d rdhDumpErrorEnabled=%d rdhDumpWarningEnabled=%d rdhUseFirstInPageEnabled=%d rdhCheckFirstOrbit=%d rdhCheckDetectorField=%d dropPagesWithError=%d", cfgRdhCheckEnabled, cfgRdhDumpEnabled, cfgRdhDumpErrorEnabled, cfgRdhDumpWarningEnabled, cfgRdhUseFirstInPageEnabled, cfgRdhCheckFirstOrbit, cfgRdhCheckDetectorField, cfgDropPagesWithError);
149151

150152
// configuration parameter: | equipment-* | ctpMode | int | 0 | If set, the detector field (CTP run mask) is checked. Incoming data is discarded until a new bit is set, and discarded again after this bit is unset. Automatically implies rdhCheckDetectorField=1 and rdhCheckDetectorField=1. |
151153
cfg.getOptionalValue<int>(cfgEntryPoint + ".ctpMode", cfgCtpMode);
@@ -430,7 +432,14 @@ Thread::CallbackResult ReadoutEquipment::threadCallback(void* arg)
430432

431433
// handle RDH-formatted data
432434
if (ptr->cfgRdhUseFirstInPageEnabled) {
433-
ptr->processRdh(nextBlock);
435+
if ((ptr->processRdh(nextBlock)) && ptr->cfgDropPagesWithError) {
436+
// drop pages with error when configured to do so
437+
ptr->statsRdhCheckPagesDropped++;
438+
static InfoLogger::AutoMuteToken logPageErrorDrop(LogWarningSupport_(3235), 10, 60);
439+
theLog.log(logPageErrorDrop, "Equipment %s : page with RDH error has been discarded (total: %llu)", ptr->name.c_str(), ptr->statsRdhCheckPagesDropped);
440+
nextBlock = nullptr;
441+
continue;
442+
}
434443
}
435444

436445
// discard data immediately if configured to do so
@@ -593,6 +602,7 @@ void ReadoutEquipment::initCounters()
593602
statsRdhCheckOk = 0;
594603
statsRdhCheckErr = 0;
595604
statsRdhCheckStreamErr = 0;
605+
statsRdhCheckPagesDropped = 0;
596606

597607
statsNumberOfTimeframes = 0;
598608

@@ -621,7 +631,8 @@ void ReadoutEquipment::initCounters()
621631
void ReadoutEquipment::finalCounters()
622632
{
623633
if (cfgRdhCheckEnabled) {
624-
theLog.log(LogInfoDevel_(3003), "Equipment %s : %llu timeframes, RDH checks %llu ok, %llu errors, %llu stream inconsistencies", name.c_str(), statsNumberOfTimeframes, statsRdhCheckOk, statsRdhCheckErr, statsRdhCheckStreamErr);
634+
theLog.log(LogInfoDevel_(3003), "Equipment %s : %llu timeframes, RDH checks %llu ok, %llu errors, %llu stream inconsistencies, %llu pages with error dropped",
635+
name.c_str(), statsNumberOfTimeframes, statsRdhCheckOk, statsRdhCheckErr, statsRdhCheckStreamErr, statsRdhCheckPagesDropped);
625636
}
626637
};
627638

@@ -1037,7 +1048,7 @@ int ReadoutEquipment::processRdh(DataBlockContainerReference& block)
10371048
}
10381049
}
10391050

1040-
return 0;
1051+
return isPageError;
10411052
}
10421053

10431054
void ReadoutEquipment::abortThread() {

src/ReadoutEquipment.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ class ReadoutEquipment
203203
int saveErrorPagesCount; // counter for number of pages dumped so far
204204
std::string cfgDataPagesLogPath; // path to write to disk a summary for each data page received
205205
FILE *fpDataPagesLog = nullptr; // handle to data page log file
206+
int cfgDropPagesWithError = 0; // if set, pages with RDH errors are dropped by readout
206207

207208
protected:
208209
// get timeframe from orbit
@@ -218,6 +219,7 @@ class ReadoutEquipment
218219
unsigned long long statsRdhCheckOk = 0; // number of RDH structs which have passed check ok
219220
unsigned long long statsRdhCheckErr = 0; // number of RDH structs which have not passed check
220221
unsigned long long statsRdhCheckStreamErr = 0; // number of inconsistencies in RDH stream (e.g. ids/timing compared to previous RDH)
222+
unsigned long long statsRdhCheckPagesDropped = 0; // number of pages discarded because of RDH errors (when configured to do so)
221223
};
222224

223225
std::unique_ptr<ReadoutEquipment> getReadoutEquipmentDummy(ConfigFile& cfg, std::string cfgEntryPoint);

src/readoutConfigEditor.tcl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ set configurationParametersDescriptor {
7979
| equipment-* | dataPagesLogPath | string | | Path where to save a summary of each data pages generated by equipment. |
8080
| equipment-* | debugFirstPages | int | 0 | If set, print debug information for first (given number of) data pages readout. |
8181
| equipment-* | disableOutput | int | 0 | If non-zero, data generated by this equipment is discarded immediately and is not pushed to output fifo of readout thread. Used for testing. |
82+
| equipment-* | dropPagesWithError | int | 0 | If set, the pages with RDH errors are discarded (requires rdhCheckEnabled or rdhUseFirstInPage). |
8283
| equipment-* | enabled | int | 1 | Enable (value=1) or disable (value=0) the equipment. |
8384
| equipment-* | equipmentType | string | | The type of equipment to be instanciated. One of: dummy, rorc, cruEmulator |
8485
| equipment-* | firstPageOffset | bytes | | Offset of the first page, in bytes from the beginning of the memory pool. If not set (recommended), will start at memoryPoolPageSize (one free page is kept before the first usable page for readout internal use). |

0 commit comments

Comments
 (0)