Pottu
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
pottu::LogicalEventSorterBase< Ev, Tr > Class Template Referenceabstract

Convenience base class for user sort classes. More...

#include <LogicalEventSorterBase.hpp>

Inheritance diagram for pottu::LogicalEventSorterBase< Ev, Tr >:
Inheritance graph
[legend]
Collaboration diagram for pottu::LogicalEventSorterBase< Ev, Tr >:
Collaboration graph
[legend]

Public Types

using logical_event_pool_t = SharedResourcePool< Ev >
 
using logical_event_handle_t = typename logical_event_pool_t::logical_event_handle_t
 

Public Member Functions

 LogicalEventSorterBase (const std::string &name, int triggerDeadTime, int eventDelay, int maxEventLength)
 Constructor. More...
 
void process (std::vector< DetectorEvent > &data) noexcept
 Uses or modifies detector events in a container. More...
 
int64_t getEventMaxLength () const
 Returns the maximum event length. More...
 
int64_t getEventDelay () const
 Returns the event delay. More...
 
int64_t getTriggerDeadtime () const
 Returns the trigger dead time. More...
 
- Public Member Functions inherited from pottu::StageDetectorEvent
virtual ~StageDetectorEvent ()
 Virtual desctructor.
 

Protected Member Functions

virtual void onTimeOrderError () noexcept=0
 Called if the object observes a time order error. This must be implemented in the derived class.
 
virtual void constructAndProcessLogicalEvent (std::deque< pottu::DetectorEvent >::iterator first, std::deque< pottu::DetectorEvent >::iterator last, int64_t triggerTime, int64_t eventStartTime, int64_t eventStopTime) noexcept=0
 Called if the object has found a new trigger. This must be implemented in the derived class. More...
 
logical_event_handle_t getNewEvent () noexcept
 Returns new logical event. More...
 
ContextHandlecontext () noexcept
 Returns pointer to the ContextHandle. More...
 

Protected Attributes

ContextHandle_ctxh
 
logical_event_pool_t _logicalEventPool
 
Tr _triggerer
 
LogicalEventCollector< LogicalEventSorterBase, Tr > _eventCollector
 

Friends

class LogicalEventCollector< LogicalEventSorterBase, Tr >
 

Detailed Description

template<class Ev, class Tr>
class pottu::LogicalEventSorterBase< Ev, Tr >

Convenience base class for user sort classes.

This base class implements process() method which calls LogicalEventCollector which then calls the methods onTimeOrderError() and constructAndProcessLogicalEvent() of the user class.

Template Parameters
EvLogical event class. Must be derived from SharedResource and implement clear() method. The clear should initiate an instance so that it can be used again.
TrTrigger class. Should implement methods feed() and reset(). Trigger can have internal state. One instance of this class will be created by LogicalEventSorterBase.

Constructor & Destructor Documentation

◆ LogicalEventSorterBase()

template<class Ev , class Tr >
pottu::LogicalEventSorterBase< Ev, Tr >::LogicalEventSorterBase ( const std::string &  name,
int  triggerDeadTime,
int  eventDelay,
int  maxEventLength 
)
inline

Constructor.

Parameters
nameName for the instance handle to the context. This is used in prosessing stage statistics.
triggerDeadTimeTime [tics] after trigger a new trigger is not allowed.
eventDelayTime [tics] after trigger the event will be started. Can be also negative to collect detector event before a trigger.
maxEventLengthMaximum length of the collected event [tics] from triggertime + eventDelay.

Member Function Documentation

◆ constructAndProcessLogicalEvent()

template<class Ev , class Tr >
virtual void pottu::LogicalEventSorterBase< Ev, Tr >::constructAndProcessLogicalEvent ( std::deque< pottu::DetectorEvent >::iterator  first,
std::deque< pottu::DetectorEvent >::iterator  last,
int64_t  triggerTime,
int64_t  eventStartTime,
int64_t  eventStopTime 
)
protectedpure virtualnoexcept

Called if the object has found a new trigger. This must be implemented in the derived class.

Parameters
firstIterator to the first detector event inside the logical event window.
lastIterator pointing to the first detector event after the logical event.
triggerTimeTime stamp of the trigger.
eventStartTimeTime stamp of the beginning of the logical event window.
eventStopTimeTime stamp of the end of the logical event window. This is the smallest time stamp which is NOT included.

◆ context()

template<class Ev , class Tr >
ContextHandle* pottu::LogicalEventSorterBase< Ev, Tr >::context ( )
inlineprotectednoexcept

Returns pointer to the ContextHandle.

Typically this is used to print some log messages by calling

context->logInfo("Something happened");
ContextHandle * context() noexcept
Returns pointer to the ContextHandle.
Definition: LogicalEventSorterBase.hpp:130

◆ getEventDelay()

template<class Ev , class Tr >
int64_t pottu::LogicalEventSorterBase< Ev, Tr >::getEventDelay ( ) const
inline

Returns the event delay.

Returns
The event delay.

◆ getEventMaxLength()

template<class Ev , class Tr >
int64_t pottu::LogicalEventSorterBase< Ev, Tr >::getEventMaxLength ( ) const
inline

Returns the maximum event length.

Returns
The maximum event length

◆ getNewEvent()

template<class Ev , class Tr >
logical_event_handle_t pottu::LogicalEventSorterBase< Ev, Tr >::getNewEvent ( )
inlineprotectednoexcept

Returns new logical event.

The returned event is allocated or recycled and clear() has been called for it.

◆ getTriggerDeadtime()

template<class Ev , class Tr >
int64_t pottu::LogicalEventSorterBase< Ev, Tr >::getTriggerDeadtime ( ) const
inline

Returns the trigger dead time.

Returns
The trigger dead time

◆ process()

template<class Ev , class Tr >
void pottu::LogicalEventSorterBase< Ev, Tr >::process ( std::vector< DetectorEvent > &  data)
inlinevirtualnoexcept

Uses or modifies detector events in a container.

Parameters
dataVector containing detector events to be modified or used.

Typically only the fields of each detector event is modified and the event is otherwise kept the same.

Implements pottu::StageDetectorEvent.


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