Skip to content

Commit abb43ca

Browse files
committed
dropEmptyHBFramesTriggerMask
1 parent b3a68d8 commit abb43ca

File tree

4 files changed

+22
-5
lines changed

4 files changed

+22
-5
lines changed

doc/configurationParameters.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ The parameters related to 3rd-party libraries are described here for convenience
6969
| consumer-FairMQChannel-* | unmanagedMemorySize | bytes | | Size of the memory region to be created. c.f. FairMQ::FairMQUnmanagedRegion.h. If not set, no special FMQ memory region is created. |
7070
| consumer-fileRecorder-* | bytesMax | bytes | 0 | Maximum number of bytes to write to each file. Data pages are never truncated, so if writing the full page would exceed this limit, no data from that page is written at all and file is closed. If zero (default), no maximum size set.|
7171
| consumer-fileRecorder-* | dataBlockHeaderEnabled | int | 0 | Enable (1) or disable (0) the writing to file of the internal readout header (Readout DataBlock.h) between the data pages, to easily navigate through the file without RDH decoding. If disabled, the raw data pages received from CRU are written without further formatting. |
72-
| consumer-fileRecorder-* | dropEmptyHBFrames | int | 0 | If 1, memory pages are scanned and empty HBframes are discarded, i.e. couples of packets which contain only RDH, the first one with pagesCounter=0 and the second with stop bit set. This setting does not change the content of in-memory data pages, other consumers would still get full data pages with empty packets. This setting is meant to reduce the amount of data recorded for continuous detectors in triggered mode.|
72+
| consumer-fileRecorder-* | dropEmptyHBFrames | int | 0 | If 1, memory pages are scanned and empty HBframes are discarded, i.e. couples of packets which contain only RDH, the first one with pagesCounter=0 and the second with stop bit set. This setting does not change the content of in-memory data pages, other consumers would still get full data pages with empty packets. This setting is meant to reduce the amount of data recorded for continuous detectors in triggered mode. Use with dropEmptyHBFramesTriggerMask, if some empty frames with specific trigger types need to be kept (eg TF or SOC). |
73+
| consumer-fileRecorder-* | dropEmptyHBFramesTriggerMask | int | 0 | (when using dropEmptyHBFrames = 1) empty HB frames are kept if any bit in RDH TriggerType field matches this pattern (RDHTriggerType & TriggerMask != 0). To be provided as a decimal value: eg 2048 (TF triggers, bit 11), 3584 (TF + SOC + EOC bits 9,10,11). |
7374
| consumer-fileRecorder-* | fileName | string | | Path to the file where to record data. The following variables are replaced at runtime: ${XXX} -> get variable XXX from environment, %t -> unix timestamp (seconds since epoch), %T -> formatted date/time, %i -> equipment ID of each data chunk (used to write data from different equipments to different output files), %l -> link ID (used to write data from different links to different output files). |
7475
| consumer-fileRecorder-* | filesMax | int | 1 | If 1 (default), file splitting is disabled: file is closed whenever a limit is reached on a given recording stream. Otherwise, file splitting is enabled: whenever the current file reaches a limit, it is closed an new one is created (with an incremental name). If <=0, an unlimited number of incremental chunks can be created. If non-zero, it defines the maximum number of chunks. The file name is suffixed with chunk number (by default, ".001, .002, ..." at the end of the file name. One may use "%f" in the file name to define where this incremental file counter is printed. |
7576
| consumer-fileRecorder-* | pagesMax | int | 0 | Maximum number of data pages accepted by recorder. If zero (default), no maximum set.|

src/ConsumerFileRecorder.cxx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ class ConsumerFileRecorder : public Consumer
211211
}
212212
}
213213

214-
// configuration parameter: | consumer-fileRecorder-* | dropEmptyHBFrames | int | 0 | If 1, memory pages are scanned and empty HBframes are discarded, i.e. couples of packets which contain only RDH, the first one with pagesCounter=0 and the second with stop bit set. This setting does not change the content of in-memory data pages, other consumers would still get full data pages with empty packets. This setting is meant to reduce the amount of data recorded for continuous detectors in triggered mode.|
214+
// configuration parameter: | consumer-fileRecorder-* | dropEmptyHBFrames | int | 0 | If 1, memory pages are scanned and empty HBframes are discarded, i.e. couples of packets which contain only RDH, the first one with pagesCounter=0 and the second with stop bit set. This setting does not change the content of in-memory data pages, other consumers would still get full data pages with empty packets. This setting is meant to reduce the amount of data recorded for continuous detectors in triggered mode. Use with dropEmptyHBFramesTriggerMask, if some empty frames with specific trigger types need to be kept (eg TF or SOC). |
215215
cfg.getOptionalValue(cfgEntryPoint + ".dropEmptyHBFrames", dropEmptyHBFrames, 0);
216216
if (dropEmptyHBFrames) {
217217
if (recordWithDataBlockHeader) {
@@ -220,6 +220,13 @@ class ConsumerFileRecorder : public Consumer
220220
}
221221
theLog.log(LogInfoSupport_(3002), "Some packets with RDH-only payload will not be recorded to file, option dropEmptyHBFrames is enabled");
222222
}
223+
224+
// configuration parameter: | consumer-fileRecorder-* | dropEmptyHBFramesTriggerMask | int | 0 | (when using dropEmptyHBFrames = 1) empty HB frames are kept if any bit in RDH TriggerType field matches this pattern (RDHTriggerType & TriggerMask != 0). To be provided as a decimal value: eg 2048 (TF triggers, bit 11), 3584 (TF + SOC + EOC bits 9,10,11). |
225+
cfg.getOptionalValue(cfgEntryPoint + ".dropEmptyHBFramesTriggerMask", dropEmptyHBFramesTriggerMask, 0);
226+
if ((dropEmptyHBFrames)&&(dropEmptyHBFramesTriggerMask)) {
227+
theLog.log(LogInfoSupport_(3002), "Some packets with RDH-only payload will be recorded when their trigger type matches mask 0x%X", dropEmptyHBFramesTriggerMask);
228+
}
229+
223230
}
224231

225232
~ConsumerFileRecorder() {}
@@ -504,14 +511,14 @@ class ConsumerFileRecorder : public Consumer
504511
};
505512

506513
auto isEmptyHBstop = [&](RdhHandle& h) {
507-
if ((h.getStopBit()) && (h.getHeaderSize() == h.getMemorySize())) {
514+
if ((h.getStopBit()) && (h.getHeaderSize() == h.getMemorySize()) && ((h.getTriggerType() & (uint32_t)dropEmptyHBFramesTriggerMask) == 0) ) {
508515
return true;
509516
}
510517
return false;
511518
};
512519

513520
auto isEmptyHBstart = [&](RdhHandle& h) {
514-
if ((h.getPagesCounter() == 0) && (h.getHeaderSize() == h.getMemorySize())) {
521+
if ((h.getPagesCounter() == 0) && (h.getHeaderSize() == h.getMemorySize()) && ((h.getTriggerType() & (uint32_t)dropEmptyHBFramesTriggerMask) == 0)) {
515522
return true;
516523
}
517524
return false;
@@ -642,6 +649,7 @@ class ConsumerFileRecorder : public Consumer
642649
int maxFileTF = 0; // maximum number of TF to write (in each file)
643650
int filesMax = 0; // maximum number of files to write (for each stream)
644651
int dropEmptyHBFrames = 0; // if set, some empty packets are discarded (see logic in code)
652+
int dropEmptyHBFramesTriggerMask = 0; // (when using dropEmptyHBFrames = 1) empty HB frames are kept if any bit in RDH TriggerType field matches this pattern. (TriggerType & TriggerMask != 0)
645653

646654
class Packet
647655
{

src/ReadoutEquipmentCruEmulator.cxx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ Thread::CallbackResult ReadoutEquipmentCruEmulator::prepareBlocks()
204204

205205
for (offset = 0; offset + cruBlockSize <= bytesAvailableInPage; offset += cruBlockSize) {
206206

207+
bool isNewTF = 0;
207208
if ((ls.payloadBytesLeft < 0)) {
208209
// this is a new HB frame
209210

@@ -219,6 +220,7 @@ Thread::CallbackResult ReadoutEquipmentCruEmulator::prepareBlocks()
219220
nextBc = nextBc % LHCBunches;
220221
unsigned int nextId = getTimeframeFromOrbit(nextOrbit); // timeframe ID
221222
if (nextId != nowId) {
223+
isNewTF = 1;
222224
if (offset) {
223225
// force page change on timeframe boundary
224226
// printf("TF boundary : %d != %d\n",nextId,nowId);
@@ -271,6 +273,11 @@ Thread::CallbackResult ReadoutEquipmentCruEmulator::prepareBlocks()
271273
rdh->stopBit = 0;
272274
rdh->packetCounter = ls.packetCounter;
273275
ls.packetCounter++;
276+
if (isNewTF) {
277+
rdh->triggerType = (uint32_t)1 << 11;
278+
} else {
279+
rdh->triggerType = 0;
280+
}
274281

275282
rdh->pagesCounter = ls.HBpagecount;
276283
if (ls.payloadBytesLeft > 0) {

src/readoutConfigEditor.tcl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ set configurationParametersDescriptor {
4747
| consumer-FairMQChannel-* | unmanagedMemorySize | bytes | | Size of the memory region to be created. c.f. FairMQ::FairMQUnmanagedRegion.h. If not set, no special FMQ memory region is created. |
4848
| consumer-fileRecorder-* | bytesMax | bytes | 0 | Maximum number of bytes to write to each file. Data pages are never truncated, so if writing the full page would exceed this limit, no data from that page is written at all and file is closed. If zero (default), no maximum size set.|
4949
| consumer-fileRecorder-* | dataBlockHeaderEnabled | int | 0 | Enable (1) or disable (0) the writing to file of the internal readout header (Readout DataBlock.h) between the data pages, to easily navigate through the file without RDH decoding. If disabled, the raw data pages received from CRU are written without further formatting. |
50-
| consumer-fileRecorder-* | dropEmptyHBFrames | int | 0 | If 1, memory pages are scanned and empty HBframes are discarded, i.e. couples of packets which contain only RDH, the first one with pagesCounter=0 and the second with stop bit set. This setting does not change the content of in-memory data pages, other consumers would still get full data pages with empty packets. This setting is meant to reduce the amount of data recorded for continuous detectors in triggered mode.|
50+
| consumer-fileRecorder-* | dropEmptyHBFrames | int | 0 | If 1, memory pages are scanned and empty HBframes are discarded, i.e. couples of packets which contain only RDH, the first one with pagesCounter=0 and the second with stop bit set. This setting does not change the content of in-memory data pages, other consumers would still get full data pages with empty packets. This setting is meant to reduce the amount of data recorded for continuous detectors in triggered mode. Use with dropEmptyHBFramesTriggerMask, if some empty frames with specific trigger types need to be kept (eg TF or SOC). |
51+
| consumer-fileRecorder-* | dropEmptyHBFramesTriggerMask | int | 0 | (when using dropEmptyHBFrames = 1) empty HB frames are kept if any bit in RDH TriggerType field matches this pattern (RDHTriggerType & TriggerMask != 0). To be provided as a decimal value: eg 2048 (TF triggers, bit 11), 3584 (TF + SOC + EOC bits 9,10,11). |
5152
| consumer-fileRecorder-* | fileName | string | | Path to the file where to record data. The following variables are replaced at runtime: ${XXX} -> get variable XXX from environment, %t -> unix timestamp (seconds since epoch), %T -> formatted date/time, %i -> equipment ID of each data chunk (used to write data from different equipments to different output files), %l -> link ID (used to write data from different links to different output files). |
5253
| consumer-fileRecorder-* | filesMax | int | 1 | If 1 (default), file splitting is disabled: file is closed whenever a limit is reached on a given recording stream. Otherwise, file splitting is enabled: whenever the current file reaches a limit, it is closed an new one is created (with an incremental name). If <=0, an unlimited number of incremental chunks can be created. If non-zero, it defines the maximum number of chunks. The file name is suffixed with chunk number (by default, ".001, .002, ..." at the end of the file name. One may use "%f" in the file name to define where this incremental file counter is printed. |
5354
| consumer-fileRecorder-* | pagesMax | int | 0 | Maximum number of data pages accepted by recorder. If zero (default), no maximum set.|

0 commit comments

Comments
 (0)