Keeps track of duplicate events in the job. More...
#include <DuplicateEventTracker.h>
Classes | |
struct | Config |
Service configuration. More... | |
Public Types | |
using | Parameters = art::ServiceTable< Config > |
Public Member Functions | |
DuplicateEventTracker (Parameters const &config, art::ActivityRegistry ®) | |
Constructor: reads the configuration. More... | |
void | printSummary () const |
Prints a summary of the current duplicates. More... | |
Protected Member Functions | |
Callback functions | |
void | postEventReading (art::Event const &event, art::ScheduleContext) |
Records the event and throws an exception depending on the configuration. More... | |
void | postOpenFile (std::string const &fileName) |
Records the current file name. More... | |
void | postEndJob () |
Prints the summary and throws an exception depending on the configuration. More... | |
Protected Attributes | |
bool const | fWarningOnly |
Only warning, no exception. More... | |
bool const | fSkipSummary |
Do not print the summary of duplicate events. More... | |
bool const | fExceptionAtEnd |
Throw exception as late as possible. More... | |
std::string const | fLogCategory |
Message service category tag. More... | |
sbn::EventRegistry::FileID_t | fCurrentInputFileID = sbn::EventRegistry::NoFileID |
ID in the event registry of the current input file. More... | |
sbn::EventRegistry | fEventRegistry |
Record of all events and their source. More... | |
std::atomic< unsigned int > | fNDuplicateEvents { 0U } |
Duplicate event count. More... | |
Keeps track of duplicate events in the job.
This art service maintains a record of all the processed events, and it takes action when one is processed more than once. The main purpose of the service is to detect the duplication as soon as possible and in such case to interrupt the job with an error, so that the input can be amended.
The default action is to immediately throw an exception. Alternatively, a warning message can be emitted each time an event is reprocessed, and a summary of all duplication can be emitted at the end of the job.
The service also offers an interface, to receive the current list of events that have been processed so far.
See sbn::EventRegistry
for a description of the (large) memory usage of this service.
false
): this flag has effect on warning messages and on exception throwing:true
, the service will emit a warning on each duplicate event encountered, otherwise it will not emit any warning (summary will still describe the duplicates if not skipped);false
, an exception will be thrown at the first duplicate event, unless ExceptionAtEnd
is set, in which case the exception will be thrown at the end; if the flag is set to true
, an exception is thrown at the end if ExceptionAtEnd
is set, otherwise no exception is thrown at allfalse
): when set to true
, it disables the printout of the duplicate events at the end of the job; unless WarningOnly
is also set, this summary is going to be one-entry onlyfalse
): if duplicate events are detected, an exception is thrown at the end of the job instead of at the first duplicate event; this allows to assess all the duplicate events at once; if set, it is recommended that SkipSummary
be disabled; note that with this option enabled, if duplicate events are detected an exception is always thrown (at the end of the job), regardless the setting of WarningOnly
end of the job)"DuplicateEventTracker"
): tag of the output category used by this service to the message facilityThis service is designed to work with the concurrent processing of events from the same file. Reading multiple files is not supported (but art 3 doesn't do that anyway).
Definition at line 99 of file DuplicateEventTracker.h.
using sbn::DuplicateEventTracker::Parameters = art::ServiceTable<Config> |
Definition at line 139 of file DuplicateEventTracker.h.
sbn::DuplicateEventTracker::DuplicateEventTracker | ( | Parameters const & | config, |
art::ActivityRegistry & | reg | ||
) |
Constructor: reads the configuration.
Definition at line 27 of file DuplicateEventTracker_service.cc.
|
protected |
Prints the summary and throws an exception depending on the configuration.
Definition at line 140 of file DuplicateEventTracker_service.cc.
|
protected |
Records the event and throws an exception depending on the configuration.
Definition at line 101 of file DuplicateEventTracker_service.cc.
|
protected |
Records the current file name.
Definition at line 90 of file DuplicateEventTracker_service.cc.
void sbn::DuplicateEventTracker::printSummary | ( | ) | const |
Prints a summary of the current duplicates.
Definition at line 45 of file DuplicateEventTracker_service.cc.
|
protected |
ID in the event registry of the current input file.
Definition at line 163 of file DuplicateEventTracker.h.
|
protected |
Record of all events and their source.
Definition at line 165 of file DuplicateEventTracker.h.
|
protected |
Throw exception as late as possible.
Definition at line 155 of file DuplicateEventTracker.h.
|
protected |
Message service category tag.
Definition at line 157 of file DuplicateEventTracker.h.
|
protected |
Duplicate event count.
Definition at line 167 of file DuplicateEventTracker.h.
|
protected |
Do not print the summary of duplicate events.
Definition at line 154 of file DuplicateEventTracker.h.
|
protected |
Only warning, no exception.
Definition at line 153 of file DuplicateEventTracker.h.