JANA2
|
Public Types | |
enum | Status { Unopened, Opened, Finished } |
Public Member Functions | |
JEventProcessor (JApplication *app=nullptr) | |
Status | GetStatus () const |
std::string | GetPluginName () const |
std::string | GetTypeName () const |
std::string | GetResourceName () const |
uint64_t | GetEventCount () const |
JApplication * | GetApplication () const |
bool | AreEventsOrdered () const |
virtual void | DoInitialize () |
virtual void | DoMap (const std::shared_ptr< const JEvent > &e) |
virtual void | DoReduce (const std::shared_ptr< const JEvent > &e) |
virtual void | DoFinalize () |
virtual void | Init () |
JEventProcessor::Init, Process, and Finish are meant to be written by the user. More... | |
virtual void | Process (const std::shared_ptr< const JEvent > &aEvent) |
Process i. | |
virtual void | Finish () |
virtual std::string | GetType () const |
Protected Member Functions | |
void | SetTypeName (std::string type_name) |
SetTypeName is intended as a replacement to GetType(), which should be less confusing for the user. More... | |
void | SetResourceName (std::string resource_name) |
Resource name lets the user tell the parallelization engine to synchronize different EventProcessors which write to the same shared resource; e.g. More... | |
void | SetEventsOrdered (bool receive_events_in_order) |
SetEventsOrdered allows the user to tell the parallelization engine that it needs to see the event stream ordered by increasing event IDs. More... | |
Protected Attributes | |
JApplication * | mApplication = nullptr |
|
inlinevirtual |
JEventProcessor::Init, Process, and Finish are meant to be written by the user.
Each JEventProcessor is intended to generate one distinct output,
Reimplemented in JCsvWriter< T >.
|
inlineprotected |
SetEventsOrdered allows the user to tell the parallelization engine that it needs to see the event stream ordered by increasing event IDs.
(Note that this requires all EventSources emit event IDs which are consecutive.) Ordering by event ID makes for cleaner output, but comes with a performance penalty, so it is best if this is enabled during debugging, and disabled otherwise.
|
inlineprotected |
Resource name lets the user tell the parallelization engine to synchronize different EventProcessors which write to the same shared resource; e.g.
if you have two EventProcessors which both write to a ROOT tree, they should both set the resource name 'ROOT'. On the flip side, if you have two EventProcessors which write to different resources, e.g. ROOT and a CSV file, and you set different resource names, the parallelization engine will know that it is safe to pipeline these two processors. If you don't set a resource name at all, the parallelization engine will assume that you are manually synchronizing access via your own mutex, which will be safe if and only if you use your locks correctly, and also may result in a performance penalty.
|
inlineprotected |
SetTypeName is intended as a replacement to GetType(), which should be less confusing for the user.
It should be called from the constructor. For convenience, we provide a NAME_OF_THIS macro so that the user doesn't have to type the class name as a string, which may get out of sync if automatic refactoring tools are used.