17template <
class CellInputType>
23template <
class CellInputType>
25 mTriggerRecordsCellIndices(triggersCells),
27 mClusterCellIndices(cellIndices)
31template <
class CellInputType>
33 mTriggerRecordsCellIndices(triggersCellIndex),
34 mTriggerRecordsCells(triggersCell),
36 mClusterCellIndices(cellIndices),
41template <
class CellInputType>
44 int neventsClusters = mTriggerRecordsClusters.size(),
45 neventsCells = mTriggerRecordsCells.size();
46 if (neventsClusters) {
47 return neventsClusters;
48 }
else if (neventsCells) {
55template <
class CellInputType>
58 std::optional<o2::InteractionRecord> irClusters, irCells;
59 if (mTriggerRecordsClusters.size()) {
60 if (eventID >= mTriggerRecordsClusters.size()) {
63 irClusters = mTriggerRecordsClusters[eventID].getBCData();
65 if (mTriggerRecordsCells.size()) {
66 if (eventID >= mTriggerRecordsCells.size()) {
69 irCells = mTriggerRecordsCells[eventID].getBCData();
71 if (irClusters && irCells) {
72 if (compareInteractionRecords(irClusters.value(), irCells.value())) {
73 return irClusters.value();
77 }
else if (irClusters) {
78 return irClusters.value();
80 return irCells.value();
85template <
class CellInputType>
88 std::optional<uint64_t> triggerBitsClusters, triggerBitsCells;
89 if (mTriggerRecordsClusters.size()) {
90 if (eventID >= mTriggerRecordsClusters.size()) {
93 triggerBitsClusters = mTriggerRecordsClusters[eventID].getTriggerBits();
95 if (mTriggerRecordsCells.size()) {
96 if (eventID >= mTriggerRecordsCells.size()) {
99 triggerBitsClusters = mTriggerRecordsCells[eventID].getTriggerBits();
101 if (triggerBitsClusters && triggerBitsCells) {
102 if (triggerBitsClusters == triggerBitsCells) {
103 return triggerBitsClusters.value();
107 }
else if (triggerBitsClusters) {
108 return triggerBitsClusters.value();
109 }
else if (triggerBitsCells) {
110 return triggerBitsCells.value();
115template <
class CellInputType>
118 if (mTriggerRecordsClusters.size()) {
119 if (eventID >= mTriggerRecordsClusters.size()) {
122 auto& trgrecord = mTriggerRecordsClusters[eventID];
123 return ClusterRange(mClusters.data() + trgrecord.getFirstEntry(), trgrecord.getNumberOfObjects());
128template <
class CellInputType>
131 if (mTriggerRecordsCells.size()) {
132 if (eventID >= mTriggerRecordsCells.size()) {
135 auto& trgrecord = mTriggerRecordsCells[eventID];
136 return CellRange(mCells.data() + trgrecord.getFirstEntry(), trgrecord.getNumberOfObjects());
141template <
class CellInputType>
144 if (mCellLabels && mTriggerRecordsCells.size()) {
145 if (eventID >= mTriggerRecordsCells.size()) {
148 auto& trgrecord = mTriggerRecordsCells[eventID];
149 std::vector<gsl::span<const o2::emcal::MCLabel>> eventlabels(trgrecord.getNumberOfObjects());
151 eventlabels[
index] = mCellLabels->getLabels(trgrecord.getFirstEntry() +
index);
158template <
class CellInputType>
161 if (mTriggerRecordsCellIndices.size()) {
162 if (eventID >= mTriggerRecordsCellIndices.size()) {
165 auto& trgrecord = mTriggerRecordsCellIndices[eventID];
166 return CellIndexRange(mClusterCellIndices.data() + trgrecord.getFirstEntry(), trgrecord.getNumberOfObjects());
171template <
class CellInputType>
180 mCellLabels =
nullptr;
183template <
class CellInputType>
188 outputEvent.
mTriggerBits = getTriggerBitsForEvent(eventID);
190 outputEvent.
mClusters = getClustersForEvent(eventID);
192 if (hasClusterIndices()) {
193 outputEvent.
mCellIndices = getClusterCellIndicesForEvent(eventID);
196 outputEvent.
mCells = getCellsForEvent(eventID);
205template <
class CellInputType>
208 return lhs.bc == rhs.bc && lhs.orbit == rhs.orbit;
211template <
class CellInputType>
217 mCurrentEvent = mEventHandler.
buildEvent(mEventID);
220template <
class CellInputType>
223 return &mEventHandler == &rhs.mEventHandler && mEventID == rhs.mEventID && mForward == rhs.mForward;
226template <
class CellInputType>
234 mCurrentEvent = mEventHandler.buildEvent(mEventID);
238template <
class CellInputType>
246template <
class CellInputType>
254 mCurrentEvent = mEventHandler.buildEvent(mEventID);
258template <
class CellInputType>
EventIterator & operator++()
Prefix incrementation operator.
bool operator==(const EventIterator &rhs) const
Check for equalness.
EventIterator(const EventHandler &handler, int eventID, bool forward)
Constructor, initializing the iterator.
EventIterator & operator--()
Prefix decrementation operator.
Error handling in case the interaction records from various sources do not match.
Exception handling unitialized event handler.
Exception handling errors due to exceeding the range of triggers handled by the handler.
Error handling in case the trigger bits from various sources do not match.
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.
const CellRange getCellsForEvent(int eventID) const
Get range of cells belonging to the given event.
const CellIndexRange getClusterCellIndicesForEvent(int eventID) const
Get range of cluster cell indices belonging to the given event.
const ClusterRange getClustersForEvent(int eventID) const
Get range of clusters belonging to the given event.
gsl::span< const Cluster > ClusterRange
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.
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.
EMCAL event information (per trigger)
uint64_t mTriggerBits
Trigger bits for the event.
gsl::span< const int > mCellIndices
Cell indices in cluster.
gsl::span< const Cluster > mClusters
EMCAL clusters.
gsl::span< const InputType > mCells
EMCAL cells / digits.
std::vector< gsl::span< const o2::emcal::MCLabel > > mMCCellLabels
span of MC labels for each cell
InteractionRecord mInteractionRecord
Interaction record for the trigger corresponding to this event.
std::vector< Cluster > clusters
std::vector< Cell > cells