Skip to content

Commit 1483b58

Browse files
committed
added equipment.autoTimeframeId
1 parent 4103fdc commit 1483b58

File tree

5 files changed

+27
-2
lines changed

5 files changed

+27
-2
lines changed

doc/configurationParameters.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ The parameters related to 3rd-party libraries are described here for convenience
130130
| consumer-zmq-* | maxRate | int| 0 | Maximum number of pages to publish per second. The associated memory copy has an impact on cpu load, so this should be limited when one does not use all the data (eg for eventDump). |
131131
| consumer-zmq-* | pagesPerBurst | int | 1 | Number of consecutive pages guaranteed to be part of each publish sequence. The maxRate limit is checked at the end of each burst. |
132132
| consumer-zmq-* | zmqOptions | string | | Additional ZMQ options, as a comma-separated list of key=value pairs. Possible keys: ZMQ_CONFLATE, ZMQ_IO_THREADS, ZMQ_LINGER, ZMQ_SNDBUF, ZMQ_SNDHWM, ZMQ_SNDTIMEO. |
133+
| equipment-* | autoTimeframeId | int | 0 | When set, timeframe IDs are generated incrementally instead of being computed from trigger orbit counters. Useful to replay files with unordered / gap between TF. BC still used to detect boundaries between TFs. |
133134
| equipment-* | blockAlign | bytes | 2M | Alignment of the beginning of the big memory block from which the pool is created. Pool will start at a multiple of this value. Each page will then begin at a multiple of memoryPoolPageSize from the beginning of big block. |
134135
| equipment-* | consoleStatsUpdateTime | double | 0 | If set, number of seconds between printing statistics on console. |
135136
| 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. |

doc/releaseNotes.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,4 +575,5 @@ This file describes the main feature changes for each readout.exe released versi
575575
- When running from the command line, the environment variable O2_RUN can be used to set the run number. It is set to 0 by default, i.e. undefined run number.
576576
- Updated configuration parameters:
577577
- added readout.numberOfRuns: in standalone mode, number of START/STOP cycles to execute (used for testing).
578-
- added readout.tfRateLimitMode: can be set to 1 to use number of TF instead of computed TF id. Useful when replaying files with jumps in TF ids.
578+
- added readout.tfRateLimitMode: can be set to 1 to use number of TF instead of computed TF id for rate throttling. Useful when replaying files with jumps in TF ids. (not needed with autoTimeframeId)
579+
- added equipment.autoTimeframeId: to force incremental timeframe IDs. Useful when replaying files with jumps in TF ids. BC still used to detect boundaries between TFs.

src/ReadoutEquipment.cxx

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,9 @@ ReadoutEquipment::ReadoutEquipment(ConfigFile& cfg, std::string cfgEntryPoint, b
166166
cfg.getOptionalValue<int>(cfgEntryPoint + ".TFperiod", cfgTFperiod);
167167
timeframePeriodOrbits = cfgTFperiod;
168168

169+
// configuration parameter: | equipment-* | autoTimeframeId | int | 0 | When set, timeframe IDs are generated incrementally instead of being computed from trigger orbit counters. Useful to replay files with unordered / gap between TF. BC still used to detect boundaries between TFs. |
170+
cfg.getOptionalValue<int>(cfgEntryPoint + ".autoTimeframeId", cfgAutoTimeframeId, 0);
171+
169172
if (!cfgRdhUseFirstInPageEnabled) {
170173
usingSoftwareClock = true; // if RDH disabled, use internal clock for TF id
171174
}
@@ -174,7 +177,11 @@ ReadoutEquipment::ReadoutEquipment(ConfigFile& cfg, std::string cfgEntryPoint, b
174177
timeframeRate = LHCOrbitRate * 1.0 / timeframePeriodOrbits; // timeframe rate, in Hz
175178
theLog.log(LogInfoDevel_(3002), "Timeframe IDs generated by software, %.2lf Hz", timeframeRate);
176179
} else {
177-
theLog.log(LogInfoDevel_(3002), "Timeframe IDs generated from RDH trigger counters");
180+
if (cfgAutoTimeframeId) {
181+
theLog.log(LogInfoDevel_(3002), "Timeframe IDs generated incrementally with boundaries detected from RDH trigger counters");
182+
} else {
183+
theLog.log(LogInfoDevel_(3002), "Timeframe IDs generated from RDH trigger counters");
184+
}
178185
}
179186
}
180187

@@ -465,6 +472,15 @@ Thread::CallbackResult ReadoutEquipment::threadCallback(void* arg)
465472
if (nextBlock->getData()->header.timeframeId == undefinedTimeframeId) {
466473
nextBlock->getData()->header.timeframeId = ptr->getCurrentTimeframe();
467474
}
475+
476+
if (ptr->cfgAutoTimeframeId) {
477+
uint64_t tfId = nextBlock->getData()->header.timeframeId;
478+
if (tfId != ptr->autoTimeframeIdLatestFromBC) {
479+
ptr->autoTimeframeIdLatestFromBC = tfId;
480+
ptr->autoTimeframeIdCounter++;
481+
}
482+
nextBlock->getData()->header.timeframeId = ptr->autoTimeframeIdCounter;
483+
}
468484
}
469485

470486
// tag data with run number
@@ -614,6 +630,9 @@ void ReadoutEquipment::initCounters()
614630

615631
statsNumberOfTimeframes = 0;
616632

633+
autoTimeframeIdLatestFromBC = undefinedTimeframeId;
634+
autoTimeframeIdCounter = 0;
635+
617636
// reset timeframe clock
618637
currentTimeframe = undefinedTimeframeId;
619638
lastTimeframe = undefinedTimeframeId;

src/ReadoutEquipment.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,9 @@ class ReadoutEquipment
184184
int cfgDisableTimeframes = 0; // When set, all TF features disabled
185185
RateRegulator TFregulator; // clock counter for TF rate checks
186186
DataBlockContainerReference throttlePendingBlock; // in case TF rate limit was reached, a block may be set aside for later (when it belongs to next TF)
187+
int cfgAutoTimeframeId = 0; // when set, TFids are generated incrementally instead of taken from RDH BC.
188+
uint64_t autoTimeframeIdLatestFromBC = undefinedTimeframeId; // latest TFid (computed from BC)
189+
uint64_t autoTimeframeIdCounter = 0; // TFid counter for sequence
187190

188191
bool isRdhEquipment = false; // to be set true for RDH equipments
189192

src/readoutConfigEditor.tcl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ set configurationParametersDescriptor {
7676
| consumer-zmq-* | maxRate | int| 0 | Maximum number of pages to publish per second. The associated memory copy has an impact on cpu load, so this should be limited when one does not use all the data (eg for eventDump). |
7777
| consumer-zmq-* | pagesPerBurst | int | 1 | Number of consecutive pages guaranteed to be part of each publish sequence. The maxRate limit is checked at the end of each burst. |
7878
| consumer-zmq-* | zmqOptions | string | | Additional ZMQ options, as a comma-separated list of key=value pairs. Possible keys: ZMQ_CONFLATE, ZMQ_IO_THREADS, ZMQ_LINGER, ZMQ_SNDBUF, ZMQ_SNDHWM, ZMQ_SNDTIMEO. |
79+
| equipment-* | autoTimeframeId | int | 0 | When set, timeframe IDs are generated incrementally instead of being computed from trigger orbit counters. Useful to replay files with unordered / gap between TF. BC still used to detect boundaries between TFs. |
7980
| equipment-* | blockAlign | bytes | 2M | Alignment of the beginning of the big memory block from which the pool is created. Pool will start at a multiple of this value. Each page will then begin at a multiple of memoryPoolPageSize from the beginning of big block. |
8081
| equipment-* | consoleStatsUpdateTime | double | 0 | If set, number of seconds between printing statistics on console. |
8182
| 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. |

0 commit comments

Comments
 (0)