12#ifndef ALICEO2_PHOS_EVENTHANDLER_H_
13#define ALICEO2_PHOS_EVENTHANDLER_H_
20#include "fmt/format.h"
35template <
class CellInputType>
54 mMaxEvents(maxEvents),
57 mErrorMessage = fmt::format(
"Exceeding range: %d, max %d", mEventID, mMaxEvents);
65 const
char*
what() const noexcept final {
return mErrorMessage.data(); }
78 std::string mErrorMessage;
94 const
char*
what() const noexcept final {
return "EventHandler not initialized"; }
106 mInteractionRecordCells(ircells)
115 const
char*
what() const noexcept final {
return "Interaction records for clusters and cells not matching"; }
202 bool mForward =
true;
281 bool hasClusters()
const {
return mTriggerRecordsClusters.size() > 0; }
289 bool hasCells()
const {
return mTriggerRecordsCells.size() > 0; }
299 mClusterCellIndices = cellIndices;
300 mTriggerRecordsClusters = triggersCluster;
301 mTriggerRecordsCellIndices = triggersCellIndex;
310 mTriggerRecordsCells = triggers;
317 mCellLabels = mclabels;
Definition of a container to keep Monte Carlo truth external to simulation objects.
EventIterator & operator=(const EventIterator &other)=default
Assignment operator.
EventData< CellInputType > * operator*()
Get pointer to the current event.
EventIterator & operator++()
Prefix incrementation operator.
bool operator==(const EventIterator &rhs) const
Check for equalness.
EventIterator(const EventIterator &other)=default
Copy constructor.
~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 not equalness.
EventIterator & operator--()
Prefix decrementation operator.
Error handling in case the interaction records from various sources do not match.
const char * what() const noexcept final
Creating error message of the exception.
InteractionRecordInvalidException(const InteractionRecord &irclusters, const InteractionRecord &ircells)
Constructor initializing the exception.
const InteractionRecord & getInteractionRecordCells() const
Get the interaction record for the cells subevent.
~InteractionRecordInvalidException() noexcept final=default
Destructor.
const InteractionRecord & getInteractionRecordClusters() const
Get the interaction record for the cluster subevent.
Exception handling unitialized event handler.
~NotInitializedException() noexcept final=default
Destructor.
NotInitializedException()=default
Constructor initializing the exception.
const char * what() const noexcept final
Creating error message of the exception.
Exception handling errors due to exceeding the range of triggers handled by the handler.
~RangeException() noexcept final=default
Destructor.
const char * what() const noexcept final
Provide error message.
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.
EventData< CellInputType > buildEvent(int eventID) const
Build event information for a given event number within the timeframe.
gsl::span< const CellInputType > CellRange
bool hasCells() const
Check whether event handler has cell data.
bool hasClusters() const
Check whether event handler has cluster data.
void setCellMCTruthContainer(const o2::dataformats::MCTruthContainer< o2::phos::MCLabel > *mclabels)
Setting the pointer for the MCTruthContainer for cells.
EventHandler()=default
Dummy constructor.
const CellRange getCellsForEvent(int eventID) const
Get range of cells belonging to the given event.
EventIterator rbegin() const
Get backward start iterator.
const CellIndexRange getClusterCellIndicesForEvent(int eventID) const
Get range of cluster cell indices belonging to the given event.
~EventHandler()=default
Destructor.
gsl::span< const int > CellIndexRange
const ClusterRange getClustersForEvent(int eventID) const
Get range of clusters belonging to the given event.
bool hasClusterIndices() const
Check whether event handler has cell index data.
void setCellData(CellRange cells, TriggerRange triggers)
Setting the data at cell level.
void reset()
Reset containers with empty ranges.
std::vector< gsl::span< const o2::phos::MCLabel > > getCellMCLabelForEvent(int eventID) const
Get vector of MC labels belonging to the given event.
EventIterator end() const
Get forward end iteration marker.
EventIterator begin() const
Get forward start iterator.
InteractionRecord getInteractionRecordForEvent(int eventID) const
void setClusterData(ClusterRange clusters, CellIndexRange cellIndices, TriggerRange triggersCluster, TriggerRange triggersCellIndex)
Setting data at cluster level.
int getNumberOfEvents() const
gsl::span< const Cluster > ClusterRange
gsl::span< const TriggerRecord > TriggerRange
EventIterator rend() const
Get backward end iteration marker.
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
Defining DataPointCompositeObject explicitly as copiable.
VectorOfTObjectPtrs other
std::vector< Cluster > clusters
std::vector< Cell > cells