fire v0.19.0
Framework for sImulation and Reconstruction of Events
|
Base class for all event processing components. More...
#include <Processor.h>
Classes | |
class | AbortEventException |
Specific exception used to abort an event. More... | |
class | Factory |
The special factory used to create processors. More... | |
Public Member Functions | |
Processor (const config::Parameters &ps) | |
Configure the processor upon construction. More... | |
virtual | ~Processor ()=default |
virtual default destructor so derived classes can be destructed | |
virtual void | beforeNewRun (RunHeader &header) |
Handle allowing processors to modify run headers before the run begins. More... | |
virtual void | onNewRun (const RunHeader &runHeader) |
Callback for the Processor to take any necessary action when the run being processed changes. More... | |
virtual void | onFileOpen (const std::string &file_name) |
Callback for the Processor to take any necessary action when a new input event file is opened. More... | |
virtual void | onFileClose (const std::string &file_name) |
Callback for the Processor to take any necessary action when a event input file is closed. More... | |
virtual void | onProcessStart () |
Callback for the Processor to take any necessary action when the processing of events starts. | |
virtual void | onProcessEnd () |
Callback for the Processor to take any necessary action when the processing of events finishes, such as calculating job-summary quantities. | |
const std::string & | getName () const |
Get the processor name. | |
virtual void | process (Event &event)=0 |
have the derived processors do what they need to do More... | |
virtual void | attach (Process *p) final |
Attach the current process to this processor. More... | |
template<class T > | |
const T & | getCondition (const std::string &condition_name) |
Access a conditions object for the current event. More... | |
Protected Member Functions | |
void | setStorageHint (StorageControl::Hint hint, const std::string &purpose="") const |
Mark the current event as having the given storage control hint from this processor and the given purpose string. More... | |
void | abortEvent () |
Abort the event immediately. More... | |
void | fatalError (const std::string &msg) |
End processing due to a fatal runtime error. More... | |
Protected Attributes | |
logging::logger | theLog_ |
The logger for this Processor. More... | |
Private Member Functions | |
Conditions & | getConditions () const |
Internal getter for conditions without exposing all of Process. | |
Private Attributes | |
std::string | name_ |
The name of the Processor. | |
Process * | process_ {nullptr} |
Handle to current process. | |
Base class for all event processing components.
This is the main interface that users of fire will interact with. In order to perform a new task, a user would define a new Processor which can take data from the event bus, process it in some way, and then add new data onto the event bus. This format is applicable all along the data processing chain from generation (simulation or raw decoding) to reconstruction to analysis.
The ordering of the callback functions is decided by the Process::run and is helpful to document here for users creating new Processors.
fire::Processor::Processor | ( | const config::Parameters & | ps | ) |
Configure the processor upon construction.
The parameters a processor has access to are the member variables of the python class in the sequence that has class_name equal to the Processor class name.
This base class assumes the existence of an additional parameter 'name' for which a logger can be constructed and an error message can be labeled.
[in] | ps | Parameter set to be used to configure this processor |
|
inlineprotected |
Abort the event immediately.
Skip the rest of the sequence and don't save anything in the event bus.
|
inlinefinalvirtual |
Attach the current process to this processor.
Marked 'final' to prevent derived classes from redefining this function and potentially abusing the handle to the current process.
[in] | p | pointer to current Process |
|
inlinevirtual |
Handle allowing processors to modify run headers before the run begins.
This is called before any conditions providers are given the run header, so it can be used to provide parameters that conditions providers require.
Reimplemented in framework::Analyzer.
|
inlineprotected |
End processing due to a fatal runtime error.
[in] | msg | Error message to printout |
|
inline |
Access a conditions object for the current event.
Inside of the process function, this function can be used following the example below.
The const
and &
are there because auto
is not usually able to deduce that they are necessary and without them, a deep copy of the condition object would be made at this point.
T | type of condition object |
[in] | condition_name | Name of condition object to retrieve |
|
inlinevirtual |
Callback for the Processor to take any necessary action when a event input file is closed.
[in] | filename | Input event file name |
|
inlinevirtual |
Callback for the Processor to take any necessary action when a new input event file is opened.
[in] | filename | Input event file name. |
|
inlinevirtual |
Callback for the Processor to take any necessary action when the run being processed changes.
This is called after any conditions providers are configured with the run header, so it can be used for internal book-keeping within the processor and it can be used to acquire conditions that do not change with respect to changing event contexts.
runHeader | The RunHeader containing run information. |
|
pure virtual |
have the derived processors do what they need to do
[in] | event | Event holding the data to be processed |
Implemented in framework::Producer, framework::Analyzer, and framework::EventProcessor.
|
protected |
Mark the current event as having the given storage control hint from this processor and the given purpose string.
[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 to select which hints to "listen" to |
|
mutableprotected |