11#ifndef ALICEO2_EMCAL_EVENTHANDLER_H_
12#define ALICEO2_EMCAL_EVENTHANDLER_H_
20#include "fmt/format.h"
85template <
class CellInputType>
104 mMaxEvents(maxEvents),
107 mErrorMessage = fmt::format(
"Exceeding range: %d, max %d", mEventID, mMaxEvents);
115 const
char*
what() const noexcept final {
return mErrorMessage.data(); }
128 std::string mErrorMessage;
144 const
char*
what() const noexcept final {
return "EventHandler not initialized"; }
156 mInteractionRecordCells(ircells)
165 const
char*
what() const noexcept final {
return "Interaction records for clusters and cells not matching"; }
189 mTriggerBitsCells(bitscells)
198 const
char*
what() const noexcept final {
return "Tigger bits for clusters and cells not matching"; }
209 uint64_t mTriggerBitsClusters;
210 uint64_t mTriggerBitsCells;
285 bool mForward =
true;
385 bool hasClusters()
const {
return mTriggerRecordsClusters.size() > 0; }
393 bool hasCells()
const {
return mTriggerRecordsCells.size() > 0; }
403 mClusterCellIndices = cellIndices;
404 mTriggerRecordsClusters = triggersCluster;
405 mTriggerRecordsCellIndices = triggersCellIndex;
414 mTriggerRecordsCells = triggers;
421 mCellLabels = mclabels;
Definition of a container to keep Monte Carlo truth external to simulation objects.
EventIterator & operator=(const EventIterator &other)=default
Assignment operator.
bool operator!=(const EventIterator &rhs) const
Check for not equalness.
EventIterator & operator++()
Prefix incrementation operator.
~EventIterator()=default
Destructor.
int current_index() const
Get the index of the current event.
EventData< CellInputType > & operator&()
Get reference to the current event.
bool operator==(const EventIterator &rhs) const
Check for equalness.
EventData< CellInputType > * operator*()
Get pointer to the current event.
EventIterator & operator--()
Prefix decrementation operator.
EventIterator(const EventIterator &other)=default
Copy constructor.
Error handling in case the interaction records from various sources do not match.
InteractionRecordInvalidException(const InteractionRecord &irclusters, const InteractionRecord &ircells)
Constructor initializing the exception.
const InteractionRecord & getInteractionRecordCells() const
Get the interaction record for the cells subevent.
const InteractionRecord & getInteractionRecordClusters() const
Get the interaction record for the cluster subevent.
~InteractionRecordInvalidException() noexcept final=default
Destructor.
const char * what() const noexcept final
Creating error message of the exception.
Exception handling unitialized event handler.
const char * what() const noexcept final
Creating error message of the exception.
~NotInitializedException() noexcept final=default
Destructor.
NotInitializedException()=default
Constructor initializing the exception.
Exception handling errors due to exceeding the range of triggers handled by the handler.
RangeException(int eventID, int maxEvents)
Constructor defining the error.
int getMaxNumberOfEvents() const
Get the maximum number of events handled by the event handler.
int getEventID() const
Get the ID of the event raising the exception.
~RangeException() noexcept final=default
Destructor.
const char * what() const noexcept final
Provide error message.
Error handling in case the trigger bits from various sources do not match.
uint64_t getTriggerBitsCells() const
Get the trigger bits for the cells subevent.
const char * what() const noexcept final
Creating error message of the exception.
~TriggerBitsInvalidException() noexcept final=default
Destructor.
TriggerBitsInvalidException(uint64_t bitsclusters, uint64_t bitscells)
Constructor initializing the exception.
uint64_t getTriggerBitsClusters() const
Get the trigger bits for the cluster subevent.
Handler for EMCAL event data.
EventData< CellInputType > buildEvent(int eventID) const
Build event information for a given event number within the timeframe.
EventHandler()=default
Dummy constructor.
EventIterator rbegin() const
Get backward start iterator.
bool hasClusterIndices() const
Check whether event handler has cell index data.
const CellRange getCellsForEvent(int eventID) const
Get range of cells belonging to the given event.
~EventHandler()=default
Destructor.
const CellIndexRange getClusterCellIndicesForEvent(int eventID) const
Get range of cluster cell indices belonging to the given event.
EventIterator end() const
Get forward end iteration marker.
void setClusterData(ClusterRange clusters, CellIndexRange cellIndices, TriggerRange triggersCluster, TriggerRange triggersCellIndex)
Setting data at cluster level.
EventIterator begin() const
Get forward start iterator.
const ClusterRange getClustersForEvent(int eventID) const
Get range of clusters belonging to the given event.
bool hasClusters() const
Check whether event handler has cluster data.
gsl::span< const Cluster > ClusterRange
EventIterator rend() const
Get backward end iteration marker.
gsl::span< const CellInputType > CellRange
std::vector< gsl::span< const o2::emcal::MCLabel > > getCellMCLabelForEvent(int eventID) const
Get vector of MC labels belonging to the given event.
void reset()
Reset containers with empty ranges.
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.
bool hasCells() const
Check whether event handler has cell data.
gsl::span< const int > CellIndexRange
gsl::span< const TriggerRecord > TriggerRange
InteractionRecord getInteractionRecordForEvent(int eventID) const
Get the interaction record for the given event.
int getNumberOfEvents() const
Get the number of events handled by the event handler.
uint64_t getTriggerBitsForEvent(int eventID) const
Get the interaction record for the given event.
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
Defining DataPointCompositeObject explicitly as copiable.
EMCAL event information (per trigger)
VectorOfTObjectPtrs other
std::vector< Cluster > clusters
std::vector< Cell > cells