Project
Loading...
Searching...
No Matches
o2::emcal::EventHandler< CellInputType > Class Template Reference

Handler for EMCAL event data. More...

#include <EventHandler.h>

Classes

class  EventIterator
 
class  InteractionRecordInvalidException
 Error handling in case the interaction records from various sources do not match. More...
 
class  NotInitializedException
 Exception handling unitialized event handler. More...
 
class  RangeException
 Exception handling errors due to exceeding the range of triggers handled by the handler. More...
 
class  TriggerBitsInvalidException
 Error handling in case the trigger bits from various sources do not match. More...
 

Public Types

using TriggerRange = gsl::span< const TriggerRecord >
 
using ClusterRange = gsl::span< const Cluster >
 
using CellIndexRange = gsl::span< const int >
 
using CellRange = gsl::span< const CellInputType >
 

Public Member Functions

 EventHandler ()=default
 Dummy constructor.
 
 EventHandler (CellRange cells, TriggerRange triggers)
 Constructor, initializing event handler for cells only.
 
 EventHandler (ClusterRange clusters, CellIndexRange cellIndices, TriggerRange triggersCluster, TriggerRange triggersCellIndex)
 Constructor, initializing event handler for clusters only.
 
 EventHandler (ClusterRange clusters, CellIndexRange cellIndices, CellRange cells, TriggerRange triggersCluster, TriggerRange triggersCellIndex, TriggerRange triggersCell)
 Constructor, initializing event handler for clusters and cells.
 
 ~EventHandler ()=default
 Destructor.
 
EventIterator begin () const
 Get forward start iterator.
 
EventIterator end () const
 Get forward end iteration marker.
 
EventIterator rbegin () const
 Get backward start iterator.
 
EventIterator rend () const
 Get backward end iteration marker.
 
int getNumberOfEvents () const
 Get the number of events handled by the event handler.
 
InteractionRecord getInteractionRecordForEvent (int eventID) const
 Get the interaction record for the given event.
 
uint64_t getTriggerBitsForEvent (int eventID) const
 Get the interaction record for the given event.
 
const ClusterRange getClustersForEvent (int eventID) const
 Get range of clusters belonging to the given event.
 
const CellRange getCellsForEvent (int eventID) const
 Get range of cells belonging to the given event.
 
std::vector< gsl::span< const o2::emcal::MCLabel > > getCellMCLabelForEvent (int eventID) const
 Get vector of MC labels belonging to the given event.
 
const CellIndexRange getClusterCellIndicesForEvent (int eventID) const
 Get range of cluster cell indices belonging to the given event.
 
bool hasClusters () const
 Check whether event handler has cluster data.
 
bool hasClusterIndices () const
 Check whether event handler has cell index data.
 
bool hasCells () const
 Check whether event handler has cell data.
 
void setClusterData (ClusterRange clusters, CellIndexRange cellIndices, TriggerRange triggersCluster, TriggerRange triggersCellIndex)
 Setting data at cluster level.
 
void setCellData (CellRange cells, TriggerRange triggers)
 Setting the data at cell level.
 
void setCellMCTruthContainer (const o2::dataformats::MCTruthContainer< o2::emcal::MCLabel > *mclabels)
 Setting the pointer for the MCTruthContainer for cells.
 
void reset ()
 Reset containers with empty ranges.
 
EventData< CellInputType > buildEvent (int eventID) const
 Build event information for a given event number within the timeframe.
 

Detailed Description

template<class CellInputType>
class o2::emcal::EventHandler< CellInputType >

Handler for EMCAL event data.

Author
Markus Fasel marku.nosp@m.s.fa.nosp@m.sel@c.nosp@m.ern..nosp@m.ch, Oak Ridge National Laboratory
Since
March 1st, 2020

Initializing the event handler

The event handler is initialized with EMCAL data (clusters and / or cells) from an entire time frame. In order to identify objects within the time frame belonging to the same collision the event handler needs to be always initialized with the object and the corresponding range of trigger records. The event handler supports full and partial event information. Different constructors allow the initialization either as full event (with cluster and cell information) or with either cluster or cell information.

Example (full event):

auto cells = ctx.inputs().get<gsl::span<o2::emcal::Cell>("cells");
auto celltriggers = ctx.inputs().get<gsl::span<o2::emcal::TriggerRecord>>("CellsTR");
auto cluster = ctx.inputs().get<gsl::span<o2::emcal::Cluster>>("clusters");
auto clustertriggers = ctx.inputs().get<gsl::span<o2::emcal::TriggerRecord>>("ClustersTR");
auto cellIndices = ctx.inputs().get<gsl::span<int>>("cellindices");
auto citriggers = ctx.inputs().get<gsl::span<o2::emcal::TriggerRecord>>("CITR");
o2::emcal::EventHandler<o2::emcal::Cell> evhandler(clusters, cellIndices, cells, clustertriggers, citriggers, celltriggers);
Handler for EMCAL event data.
std::vector< Cluster > clusters
std::vector< Cell > cells

.{cxx}

#Getting the event data

Access to the data is possible either directly via the buildEvent method for a certain event number or via an iterator iterating over the triggers in the Trigger record collection. For the buildEvent method the event ID must be in a valid range.

Example (buildEvent):

o2::emcal::EventHander<o2::emcal::Cell> handler(clusters, cellIndices, cells, clustertriggers, citriggers, celltriggers);
for(int iev = 0; iev < handler.getNumberOfEvents(); iev++) {
auto event = handler.buildEvent(iev);
// Do something with the event ...
}

.{cxx}

Example (iterator):

o2::emcal::EventHander<o2::emcal::Cell> handler(clusters, cellIndices, cells, clustertriggers, citriggers, celltriggers);
for(const auto &ev : handler) {
// Do something with the event ...
}

.{cxx}

#Supported cell input types The event handler can support o2::emcal::Digit or o2::emcal::Cell as input type for cells.

Definition at line 86 of file EventHandler.h.

Member Typedef Documentation

◆ CellIndexRange

template<class CellInputType >
using o2::emcal::EventHandler< CellInputType >::CellIndexRange = gsl::span<const int>

Definition at line 91 of file EventHandler.h.

◆ CellRange

template<class CellInputType >
using o2::emcal::EventHandler< CellInputType >::CellRange = gsl::span<const CellInputType>

Definition at line 92 of file EventHandler.h.

◆ ClusterRange

template<class CellInputType >
using o2::emcal::EventHandler< CellInputType >::ClusterRange = gsl::span<const Cluster>

Definition at line 90 of file EventHandler.h.

◆ TriggerRange

template<class CellInputType >
using o2::emcal::EventHandler< CellInputType >::TriggerRange = gsl::span<const TriggerRecord>

Definition at line 89 of file EventHandler.h.

Constructor & Destructor Documentation

◆ EventHandler() [1/4]

template<class CellInputType >
o2::emcal::EventHandler< CellInputType >::EventHandler ( )
default

Dummy constructor.

◆ EventHandler() [2/4]

template<class CellInputType >
EventHandler::EventHandler ( CellRange  cells,
TriggerRange  triggers 
)

Constructor, initializing event handler for cells only.

Parameters
cellsContainer with cells for the full time frame
triggersContainer with the trigger records corresponding to the cell container

Definition at line 18 of file EventHandler.cxx.

◆ EventHandler() [3/4]

template<class CellInputType >
EventHandler::EventHandler ( ClusterRange  clusters,
CellIndexRange  cellIndices,
TriggerRange  triggersCluster,
TriggerRange  triggersCellIndex 
)

Constructor, initializing event handler for clusters only.

Parameters
clustersContainer with clusters for the full time frame
cellIndicesContainer with cell indices used by the clusters in the cluster container
triggerClusterContainer with trigger records corresponding to the cluster container
triggersCellIndexContainer with trigger records corresponding to the cell index container

Definition at line 24 of file EventHandler.cxx.

◆ EventHandler() [4/4]

template<class CellInputType >
EventHandler::EventHandler ( ClusterRange  clusters,
CellIndexRange  cellIndices,
CellRange  cells,
TriggerRange  triggersCluster,
TriggerRange  triggersCellIndex,
TriggerRange  triggersCell 
)

Constructor, initializing event handler for clusters and cells.

Parameters
clustersContainer with clusters for the full time frame
cellIndicesContainer with cell indices used by the clusters in the cluster container
cellsContainer with cells for the full time frame
triggerClusterContainer with trigger records corresponding to the cluster container
triggersCellIndexContainer with trigger records corresponding to the cell index container

Definition at line 32 of file EventHandler.cxx.

◆ ~EventHandler()

template<class CellInputType >
o2::emcal::EventHandler< CellInputType >::~EventHandler ( )
default

Destructor.

Member Function Documentation

◆ begin()

template<class CellInputType >
EventIterator o2::emcal::EventHandler< CellInputType >::begin ( ) const
inline

Get forward start iterator.

Returns
Start iterator

Definition at line 316 of file EventHandler.h.

◆ buildEvent()

template<class CellInputType >
EventData< CellInputType > EventHandler::buildEvent ( int  eventID) const

Build event information for a given event number within the timeframe.

Parameters
eventIDNumber of the event within the timeframe
Returns
Event data for the given event
Exceptions
RangeExceptionin case the requested event ID is outside the range
InteractionRecordInvalidExceptionin case the interaction records from cells and clusters do not match
NotInitializedExceptionin case the event handler is not initialized

Building new EMCAL event for a certain event number. Based on the input data specified in the constructors or the different setters the event contains either all data consisting of clusters, cell indices and cells, or either clusters and cell indices or cells. eventID must be a valid event within the list of triggers. In case the full event is built the trigger records from the various contributors must match.

Definition at line 184 of file EventHandler.cxx.

◆ end()

template<class CellInputType >
EventIterator o2::emcal::EventHandler< CellInputType >::end ( ) const
inline

Get forward end iteration marker.

Returns
Iteration end marker

Definition at line 320 of file EventHandler.h.

◆ getCellMCLabelForEvent()

template<class CellInputType >
std::vector< gsl::span< const o2::emcal::MCLabel > > EventHandler::getCellMCLabelForEvent ( int  eventID) const

Get vector of MC labels belonging to the given event.

Parameters
eventIDID of the event
Returns
vector of MC labels for the event
Exceptions
RangeExceptionin case the required event ID exceeds the maximum number of events
NotInitializedExceptionin case the event handler is not initialized for cell

Definition at line 142 of file EventHandler.cxx.

◆ getCellsForEvent()

template<class CellInputType >
const EventHandler< CellInputType >::CellRange EventHandler::getCellsForEvent ( int  eventID) const

Get range of cells belonging to the given event.

Parameters
eventIDID of the event
Returns
Cell range for the event
Exceptions
RangeExceptionin case the required event ID exceeds the maximum number of events
NotInitializedExceptionin case the event handler is not initialized for cell

Definition at line 129 of file EventHandler.cxx.

◆ getClusterCellIndicesForEvent()

template<class CellInputType >
const EventHandler< CellInputType >::CellIndexRange EventHandler::getClusterCellIndicesForEvent ( int  eventID) const

Get range of cluster cell indices belonging to the given event.

Parameters
eventIDID of the event
Returns
Cluster cell index range for the event
Exceptions
RangeExceptionin case the required event ID exceeds the maximum number of events
NotInitializedExceptionin case the event handler is not initialized for clusters/cellIndices

Definition at line 159 of file EventHandler.cxx.

◆ getClustersForEvent()

template<class CellInputType >
const EventHandler< CellInputType >::ClusterRange EventHandler::getClustersForEvent ( int  eventID) const

Get range of clusters belonging to the given event.

Parameters
eventIDID of the event
Returns
Cluster range for the event
Exceptions
RangeExceptionin case the required event ID exceeds the maximum number of events
NotInitializedExceptionin case the event handler is not initialized for clusters

Definition at line 116 of file EventHandler.cxx.

◆ getInteractionRecordForEvent()

template<class CellInputType >
o2::InteractionRecord EventHandler::getInteractionRecordForEvent ( int  eventID) const

Get the interaction record for the given event.

Parameters
eventIDID of the event in timeframe
Returns
Interaction record for the event
Exceptions
RangeExceptionin case the required event ID exceeds the maximum number of events
InteractionRecordInvalidExceptionIf the interaction record for the same event from differnt containers has different content
NotInitializedExceptionin case the event handler is not initialized

Requires at least on interaction record container to be set (clusters, cells or cell indices).

Definition at line 56 of file EventHandler.cxx.

◆ getNumberOfEvents()

template<class CellInputType >
int EventHandler::getNumberOfEvents ( ) const

Get the number of events handled by the event handler.

Returns
Number of events
Exceptions
NotInitializedExceptionIf the event handler is not initialized

Definition at line 42 of file EventHandler.cxx.

◆ getTriggerBitsForEvent()

template<class CellInputType >
uint64_t EventHandler::getTriggerBitsForEvent ( int  eventID) const

Get the interaction record for the given event.

Parameters
eventIDID of the event in timeframe
Returns
Interaction record for the event
Exceptions
RangeExceptionin case the required event ID exceeds the maximum number of events
TriggerBitsInvalidExceptionin case the trigger bits for the same event from differnt containers are different
NotInitializedExceptionin case the event handler is not initialized

Requires at least on interaction record container to be set (clusters, cells or cell indices).

Definition at line 86 of file EventHandler.cxx.

◆ hasCells()

template<class CellInputType >
bool o2::emcal::EventHandler< CellInputType >::hasCells ( ) const
inline

Check whether event handler has cell data.

Returns
True in case trigger records connected to the cell container are found

Definition at line 393 of file EventHandler.h.

◆ hasClusterIndices()

template<class CellInputType >
bool o2::emcal::EventHandler< CellInputType >::hasClusterIndices ( ) const
inline

Check whether event handler has cell index data.

Returns
True in case trigger records connected to the cell index container are found

Definition at line 389 of file EventHandler.h.

◆ hasClusters()

template<class CellInputType >
bool o2::emcal::EventHandler< CellInputType >::hasClusters ( ) const
inline

Check whether event handler has cluster data.

Returns
True in case trigger records connected to the cluster container are found

Definition at line 385 of file EventHandler.h.

◆ rbegin()

template<class CellInputType >
EventIterator o2::emcal::EventHandler< CellInputType >::rbegin ( ) const
inline

Get backward start iterator.

Returns
Start iterator

Definition at line 324 of file EventHandler.h.

◆ rend()

template<class CellInputType >
EventIterator o2::emcal::EventHandler< CellInputType >::rend ( ) const
inline

Get backward end iteration marker.

Returns
Iteration end marker

Definition at line 328 of file EventHandler.h.

◆ reset()

template<class CellInputType >
void EventHandler::reset ( )

Reset containers with empty ranges.

Definition at line 172 of file EventHandler.cxx.

◆ setCellData()

template<class CellInputType >
void o2::emcal::EventHandler< CellInputType >::setCellData ( CellRange  cells,
TriggerRange  triggers 
)
inline

Setting the data at cell level.

Parameters
cellsContainer for cells within the timeframe
triggersContainer with trigger records corresponding to the cell container

Definition at line 411 of file EventHandler.h.

◆ setCellMCTruthContainer()

template<class CellInputType >
void o2::emcal::EventHandler< CellInputType >::setCellMCTruthContainer ( const o2::dataformats::MCTruthContainer< o2::emcal::MCLabel > *  mclabels)
inline

Setting the pointer for the MCTruthContainer for cells.

Parameters
mclabelsPointer to the MCTruthContainer for cells in timeframe

Definition at line 419 of file EventHandler.h.

◆ setClusterData()

template<class CellInputType >
void o2::emcal::EventHandler< CellInputType >::setClusterData ( ClusterRange  clusters,
CellIndexRange  cellIndices,
TriggerRange  triggersCluster,
TriggerRange  triggersCellIndex 
)
inline

Setting data at cluster level.

Parameters
clustersContainer with clusters for the full time frame
cellIndicesContainer with cell indices used by the clusters in the cluster container
triggerClusterContainer with trigger records corresponding to the cluster container
triggersCellIndexContainer with trigger records corresponding to the cell index container

Definition at line 400 of file EventHandler.h.


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