3#ifndef EICD_RawCalorimeterHitCollection_H
4#define EICD_RawCalorimeterHitCollection_H
14#include "podio/ICollectionProvider.h"
15#include "podio/CollectionBase.h"
16#include "podio/CollectionIDTable.h"
18#ifdef PODIO_JSON_OUTPUT
19#include "nlohmann/json.hpp"
43 return m_index != x.m_index;
65 return m_index != x.m_index;
107 template<
typename... Args>
111 size_t size() const final;
114 std::
string getTypeName() const final {
return std::string(
"eicd::RawCalorimeterHitCollection"); }
116 std::string
getValueTypeName() const final {
return std::string(
"eicd::RawCalorimeterHit"); }
118 std::string
getDataTypeName() const final {
return std::string(
"eicd::RawCalorimeterHitData"); }
121 return m_isSubsetColl;
141 bool setReferences(const podio::ICollectionProvider* collectionProvider) final;
148 if (!m_isSubsetColl) {
157 return m_collectionID;
166 return iterator(0, &m_storage.entries);
172 return iterator(m_storage.entries.size(), &m_storage.entries);
175 return const_iterator(m_storage.entries.size(), &m_storage.entries);
178 template<
size_t arraysize>
179 const std::array<std::uint64_t, arraysize> cellID()
const;
180 template<
size_t arraysize>
181 const std::array<std::uint64_t, arraysize> amplitude()
const;
182 template<
size_t arraysize>
183 const std::array<std::uint64_t, arraysize> timeStamp()
const;
191 bool m_isValid{
false};
192 mutable bool m_isPrepared{
false};
193 bool m_isSubsetColl{
false};
194 int m_collectionID{0};
195 mutable std::unique_ptr<std::mutex> m_storageMtx{std::make_unique<std::mutex>()};
196 mutable RawCalorimeterHitCollectionData m_storage{};
199std::ostream&
operator<<(std::ostream& o,
const RawCalorimeterHitCollection& v);
201template<
typename... Args>
203 if (m_isSubsetColl) {
204 throw std::logic_error(
"Cannot create new elements on a subset collection");
206 const int size = m_storage.entries.size();
208 m_storage.entries.push_back(obj);
213template<
size_t arraysize>
214const std::array<std::uint64_t, arraysize> RawCalorimeterHitCollection::cellID()
const {
215 std::array<std::uint64_t, arraysize> tmp{};
216 const auto valid_size = std::min(arraysize, m_storage.entries.size());
217 for (
unsigned i = 0; i < valid_size; ++i) {
218 tmp[i] = m_storage.entries[i]->data.cellID;
223template<
size_t arraysize>
224const std::array<std::uint64_t, arraysize> RawCalorimeterHitCollection::amplitude()
const {
225 std::array<std::uint64_t, arraysize> tmp{};
226 const auto valid_size = std::min(arraysize, m_storage.entries.size());
227 for (
unsigned i = 0; i < valid_size; ++i) {
228 tmp[i] = m_storage.entries[i]->data.amplitude;
233template<
size_t arraysize>
234const std::array<std::uint64_t, arraysize> RawCalorimeterHitCollection::timeStamp()
const {
235 std::array<std::uint64_t, arraysize> tmp{};
236 const auto valid_size = std::min(arraysize, m_storage.entries.size());
237 for (
unsigned i = 0; i < valid_size; ++i) {
238 tmp[i] = m_storage.entries[i]->data.timeStamp;
244#ifdef PODIO_JSON_OUTPUT
Definition: MutableRawCalorimeterHit.h:27
Definition: RawCalorimeterHitCollectionData.h:28
RawCalorimeterHitObjPointerContainer entries
Definition: RawCalorimeterHitCollectionData.h:33
Definition: RawCalorimeterHitCollection.h:82
RawCalorimeterHitCollection(const RawCalorimeterHitCollection &)=delete
RawCalorimeterHitCollection(RawCalorimeterHitCollection &&)=default
const_iterator begin() const
Definition: RawCalorimeterHitCollection.h:168
bool setReferences(const podio::ICollectionProvider *collectionProvider) final
Definition: RawCalorimeterHitCollection.cc:104
RawCalorimeterHit at(unsigned int index) const
Returns the const object of given index.
Definition: RawCalorimeterHitCollection.cc:25
void setID(unsigned ID) final
Definition: RawCalorimeterHitCollection.h:146
iterator end()
Definition: RawCalorimeterHitCollection.h:171
bool isSubsetCollection() const final
Definition: RawCalorimeterHitCollection.h:120
iterator begin()
Definition: RawCalorimeterHitCollection.h:165
podio::CollectionBuffers getBuffers() final
Get the collection buffers for this collection.
Definition: RawCalorimeterHitCollection.cc:133
void prepareForWrite() const final
Definition: RawCalorimeterHitCollection.cc:68
bool isValid() const final
Definition: RawCalorimeterHitCollection.h:160
unsigned getID() const final
Definition: RawCalorimeterHitCollection.h:156
~RawCalorimeterHitCollection()
Definition: RawCalorimeterHitCollection.cc:16
std::string getDataTypeName() const final
fully qualified type name of stored POD elements - with namespace
Definition: RawCalorimeterHitCollection.h:118
std::string getTypeName() const final
fully qualified type name
Definition: RawCalorimeterHitCollection.h:114
RawCalorimeterHitCollection & operator=(const RawCalorimeterHitCollection &)=delete
void clear() final
Definition: RawCalorimeterHitCollection.cc:63
MutableRawCalorimeterHit create()
Append a new object to the collection, and return this object.
Definition: RawCalorimeterHitCollection.cc:52
RawCalorimeterHitCollection & operator=(RawCalorimeterHitCollection &&)=default
RawCalorimeterHitCollection()
Definition: RawCalorimeterHitCollection.cc:13
void push_back(RawCalorimeterHit object)
Append object to the collection.
Definition: RawCalorimeterHitCollection.cc:108
std::string getValueTypeName() const final
fully qualified type name of elements - with namespace
Definition: RawCalorimeterHitCollection.h:116
void setSubsetCollection(bool setSubset=true) final
Definition: RawCalorimeterHitCollection.cc:41
void prepareAfterRead() final
Definition: RawCalorimeterHitCollection.cc:89
const_iterator end() const
Definition: RawCalorimeterHitCollection.h:174
size_t size() const final
number of elements in the collection
Definition: RawCalorimeterHitCollection.cc:37
Definition: RawCalorimeterHitCollection.h:35
RawCalorimeterHitCollectionIterator & operator=(const RawCalorimeterHitCollectionIterator &)=delete
RawCalorimeterHit operator*()
Definition: RawCalorimeterHitCollection.cc:147
bool operator!=(const RawCalorimeterHitCollectionIterator &x) const
Definition: RawCalorimeterHitCollection.h:42
RawCalorimeterHit * operator->()
Definition: RawCalorimeterHitCollection.cc:152
RawCalorimeterHitCollectionIterator & operator++()
Definition: RawCalorimeterHitCollection.cc:157
RawCalorimeterHitCollectionIterator(const RawCalorimeterHitCollectionIterator &)=delete
RawCalorimeterHitCollectionIterator(size_t index, const RawCalorimeterHitObjPointerContainer *collection)
Definition: RawCalorimeterHitCollection.h:37
Definition: RawCalorimeterHit.h:26
Definition: RawCalorimeterHitCollection.h:57
MutableRawCalorimeterHit * operator->()
Definition: RawCalorimeterHitCollection.cc:169
MutableRawCalorimeterHit operator*()
Definition: RawCalorimeterHitCollection.cc:164
bool operator!=(const RawCalorimeterHitMutableCollectionIterator &x) const
Definition: RawCalorimeterHitCollection.h:64
RawCalorimeterHitMutableCollectionIterator & operator=(const RawCalorimeterHitMutableCollectionIterator &)=delete
RawCalorimeterHitMutableCollectionIterator & operator++()
Definition: RawCalorimeterHitCollection.cc:174
RawCalorimeterHitMutableCollectionIterator(const RawCalorimeterHitMutableCollectionIterator &)=delete
RawCalorimeterHitMutableCollectionIterator(size_t index, const RawCalorimeterHitObjPointerContainer *collection)
Definition: RawCalorimeterHitCollection.h:59
Definition: RawCalorimeterHitObj.h:17
Definition: CalorimeterHit.cc:13
std::deque< RawCalorimeterHitObj * > RawCalorimeterHitObjPointerContainer
Definition: RawCalorimeterHitCollectionData.h:20
std::ostream & operator<<(std::ostream &o, const CalorimeterHit &value)
Definition: CalorimeterHit.cc:93