JANA2
C++ framework for multi-threaded data processing
JEventBuilder< T > Class Template Reference

JEventBuilder pulls JMessages off of a user-specified JTransport, aggregates them into JEvents using the JWindow of their choice, and decides which to keep via a user-specified JTrigger. More...

#include <JEventBuilder.h>

Inheritance diagram for JEventBuilder< T >:
[legend]
Collaboration diagram for JEventBuilder< T >:
[legend]

Public Member Functions

 JEventBuilder (std::unique_ptr< JTransport > &&transport, std::unique_ptr< JTrigger > &&trigger=std::unique_ptr< JTrigger >(new JTrigger()), std::unique_ptr< JWindow< T >> &&window=std::unique_ptr< JSessionWindow< T >>(new JSessionWindow< T >()))
 
void addJoin (std::unique_ptr< JDiscreteJoin< T >> &&join)
 
void Open () override
 Open is called by JANA when it is ready to accept events from this event source. More...
 
Result Emit (JEvent &event) override
 
- Public Member Functions inherited from JEventSource
 JEventSource (std::string resource_name, JApplication *app=nullptr)
 
virtual void Init ()
 
virtual void Preprocess (const JEvent &) const
 For work that should be done in parallel on a JEvent, but is tightly coupled to the JEventSource for some reason. More...
 
virtual void FinishEvent (JEvent &)
 FinishEvent is used to notify the JEventSource that an event has been completely processed. More...
 
virtual void Close ()
 Close is called by JANA when it is finished accepting events from this event source. More...
 
virtual void GetEvent (std::shared_ptr< JEvent >)
 GetEvent is called by JANA in order to emit a fresh event into the stream. More...
 
virtual bool GetObjects (const std::shared_ptr< const JEvent > &, JFactory *)
 GetObjects was historically used for lazily unpacking data from a JEvent and putting it into a "dummy" JFactory. More...
 
std::string GetResourceName () const
 
uint64_t GetEventCount () const
 
uint64_t GetEmittedEventCount () const
 
uint64_t GetFinishedEventCount () const
 
virtual std::string GetType () const
 
std::string GetName () const
 
bool IsGetObjectsEnabled () const
 
bool IsFinishEventEnabled () const
 
bool IsPreprocessEnabled () const
 
uint64_t GetNSkip ()
 
uint64_t GetNEvents ()
 
virtual std::string GetVDescription () const
 Optional for getting description via source rather than JEventSourceGenerator.
 
void SetResourceName (std::string resource_name)
 
void EnableFinishEvent (bool enable=true)
 EnableFinishEvent() is intended to be called by the user in the constructor in order to tell JANA to call the provided FinishEvent method after all JEventProcessors have finished with a given event. More...
 
void EnableGetObjects (bool enable=true)
 
void EnablePreprocess (bool enable=true)
 
void SetNEvents (uint64_t nevents)
 
void SetNSkip (uint64_t nskip)
 
void DoInitialize ()
 
virtual void DoInit ()
 
void DoOpen (bool with_lock=true)
 
void DoClose (bool with_lock=true)
 
Result DoNext (std::shared_ptr< JEvent > event)
 
Result DoNextCompatibility (std::shared_ptr< JEvent > event)
 
void DoFinish (JEvent &event)
 
void Summarize (JComponentSummary &summary) const override
 
- Public Member Functions inherited from jana::components::JComponent
void SetLevel (JEventLevel level)
 
void SetCallbackStyle (CallbackStyle style)
 
void SetPrefix (std::string prefix)
 
void SetTypeName (std::string type_name)
 For convenience, we provide a NAME_OF_THIS macro so that the user doesn't have to store the type name as a string, because that could get out of sync if automatic refactoring tools are used.
 
JApplicationGetApplication () const
 
JLoggerGetLogger ()
 
std::string GetPrefix () const
 
JEventLevel GetLevel () const
 
std::string GetLoggerName () const
 
std::string GetPluginName () const
 
void SetLoggerName (std::string logger_name)
 
void SetPluginName (std::string plugin_name)
 
std::string GetTypeName () const
 
CallbackStyle GetCallbackStyle () const
 
Status GetStatus () const
 
void SetApplication (JApplication *app)
 
void SetLogger (JLogger logger)
 
template<typename F >
void CallWithJExceptionWrapper (std::string func_name, F func)
 
void RegisterParameter (ParameterBase *parameter)
 
void RegisterService (ServiceBase *service)
 
void ConfigureAllParameters (std::map< std::string, std::string > fields)
 

Static Public Member Functions

static std::string GetDescription ()
 

Additional Inherited Members

- Public Types inherited from JEventSource
enum class  Result {
  Success ,
  FailureTryAgain ,
  FailureFinished
}
 Result describes what happened the last time a GetEvent() was attempted. More...
 
enum class  RETURN_STATUS {
  kSUCCESS ,
  kNO_MORE_EVENTS ,
  kBUSY ,
  kTRY_AGAIN ,
  kERROR ,
  kUNKNOWN
}
 The user is supposed to throw RETURN_STATUS::kNO_MORE_EVENTS or kBUSY from GetEvent()
 
- Public Types inherited from jana::components::JComponent
enum class  Status {
  Uninitialized ,
  Initialized ,
  Opened ,
  Closed ,
  Finalized
}
 
enum class  CallbackStyle {
  LegacyMode ,
  ExpertMode ,
  DeclarativeMode
}
 
- Protected Member Functions inherited from jana::components::JHasOutputs
void RegisterOutput (OutputBase *output)
 
- Protected Attributes inherited from jana::components::JComponent
std::vector< ParameterBase * > m_parameters
 
std::vector< ServiceBase * > m_services
 
JEventLevel m_level = JEventLevel::PhysicsEvent
 
CallbackStyle m_callback_style = CallbackStyle::LegacyMode
 
std::string m_prefix
 
std::string m_plugin_name
 
std::string m_logger_name
 
std::string m_type_name
 
Status m_status = Status::Uninitialized
 
std::mutex m_mutex
 
JApplicationm_app = nullptr
 
JLogger m_logger
 
- Protected Attributes inherited from jana::components::JHasOutputs
std::vector< OutputBase * > m_outputs
 

Detailed Description

template<typename T>
class JEventBuilder< T >

JEventBuilder pulls JMessages off of a user-specified JTransport, aggregates them into JEvents using the JWindow of their choice, and decides which to keep via a user-specified JTrigger.

Member Function Documentation

◆ Emit()

template<typename T >
Result JEventBuilder< T >::Emit ( JEvent event)
inlineoverridevirtual

This is really bad because we have to worry about downstream HitSource returning TryAgainLater and we really don't want to block here

Reimplemented from JEventSource.

◆ Open()

template<typename T >
void JEventBuilder< T >::Open ( )
inlineoverridevirtual

Open is called by JANA when it is ready to accept events from this event source.

The implementor should open file pointers or sockets here, instead of in the constructor. This is because the implementor won't know how many or which event sources the user will decide to activate within one job. Thus the implementor can avoid problems such as running out of file pointers, or multiple event sources attempting to bind to the same socket.

Reimplemented from JEventSource.


The documentation for this class was generated from the following file: