fire v0.19.0
Framework for sImulation and Reconstruction of Events
|
Isolation of voting system deciding if events should be kept. More...
#include <StorageControl.h>
Public Types | |
enum class | Hint { NoOpinion = 0 , Undefined = -1 , ShouldKeep = 1 , MustKeep = 10 , ShouldDrop = 2 , MustDrop = 20 } |
Hints that can be provided by processors to the storage controller. More... | |
Public Member Functions | |
StorageControl (const config::Parameters &ps) | |
Configure the various options for how the storage contol behaves. More... | |
void | resetEventState () |
Reset the event-by-event state by removing any hints provided by processors during the previous event. | |
void | addHint (Hint hint, const std::string &purpose, const std::string &processor_name) |
Add a storage hint for a given processor. More... | |
bool | keepEvent () const |
Determine if the current event should be kept, based on the defined rules. More... | |
Private Attributes | |
bool | default_keep_ {true} |
Default state for storage control. | |
std::vector< std::pair< std::regex, std::regex > > | rules_ |
Collection of rules allowing certain processors or purposes to be considered ("listened to") during the storage decision. More... | |
std::vector< Hint > | hints_ |
Collection of hints from the event processors. | |
Isolation of voting system deciding if events should be kept.
Any Processor can provide a hint as to whether a given event should be kept or dropped. The hint is cached in the StorageControl object until the end of the event. At that point, the process queries the StorageControl to determine if the event should be stored in the output file.
|
strong |
Hints that can be provided by processors to the storage controller.
Integer values of the hints are currently not used for anything, although one could imagine a "weighting" system being implemented where different Hints are weighted based on how "strong" the hint is.
fire::StorageControl::StorageControl | ( | const config::Parameters & | ps | ) |
void fire::StorageControl::addHint | ( | Hint | hint, |
const std::string & | purpose, | ||
const std::string & | processor_name | ||
) |
Add a storage hint for a given processor.
The hint needs to match at least one of the listening rules in order to be considered.
[in] | hint | The storage control hint to apply for the given event |
[in] | purpose | A purpose string which can be used in the skim control configuration |
[in] | processor_name | Name of the event processor |
bool fire::StorageControl::keepEvent | ( | ) | const |
Determine if the current event should be kept, based on the defined rules.
Both "should" and "must" type of hints are given equal weighting. The "keep" and "drop" votes are counted and then the following logic is applied.
|
private |
Collection of rules allowing certain processors or purposes to be considered ("listened to") during the storage decision.
Each rule has two entries: