3#ifndef EDM4EIC_RawCALOROCHitCollection_H
4#define EDM4EIC_RawCALOROCHitCollection_H
13#include "podio/ICollectionProvider.h"
14#include "podio/CollectionBase.h"
15#include "podio/detail/Pythonizations.h"
17#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
18#include "nlohmann/json_fwd.hpp"
58 return m_index <=> other.m_index;
62 return m_index == x.m_index;
81 RawCALOROCHit m_object { podio::utils::MaybeSharedPtr<RawCALOROCHitObj>{
nullptr} };
107 return m_index <=> other.m_index;
111 return m_index == x.m_index;
130 MutableRawCALOROCHit m_object { podio::utils::MaybeSharedPtr<RawCALOROCHitObj>{
nullptr} };
160 constexpr static std::string_view
typeName =
"edm4eic::RawCALOROCHitCollection";
162 constexpr static std::string_view
dataTypeName =
"edm4eic::RawCALOROCHitData";
168 podio::detail::pythonizations::pythonize_subscript(klass, name);
172 void print(std::ostream& os=std::cout,
bool flush=
true) const final;
179 template<typename... Args>
183 std::
size_t size() const final;
189 bool empty() const final;
201 return m_isSubsetColl;
230 if (!m_isSubsetColl) {
231 std::for_each(m_storage.entries.begin(), m_storage.entries.end(),
232 [ID] (
RawCALOROCHitObj* obj) { obj->id = {obj->id.index, static_cast<uint32_t>(ID)}; }
238 return m_collectionID;
243 return getID() !=
static_cast<uint32_t
>(podio::ObjectID::untracked) &&
244 getID() !=
static_cast<uint32_t
>(podio::ObjectID::invalid);
247 [[deprecated(
"isValid will be removed, use hasID() if you want to check if it has an ID, otherwise assume the "
248 "collection is valid")]]
253 size_t getDatamodelRegistryIndex() const final;
257 return iterator(0, &m_storage.entries);
266 return iterator(m_storage.entries.size(), &m_storage.entries);
269 return const_iterator(m_storage.entries.size(), &m_storage.entries);
295 std::vector<std::uint64_t> cellID(
const size_t nElem = 0)
const;
296 std::vector<std::int32_t> samplePhase(
const size_t nElem = 0)
const;
297 std::vector<std::int32_t> timeStamp(
const size_t nElem = 0)
const;
305 mutable bool m_isPrepared{
false};
306 bool m_isSubsetColl{
false};
307 uint32_t m_collectionID{
static_cast<uint32_t
>(podio::ObjectID::untracked)};
308 mutable std::unique_ptr<std::mutex> m_storageMtx{std::make_unique<std::mutex>()};
312std::ostream&
operator<<(std::ostream& o,
const RawCALOROCHitCollection& v);
314template<
typename... Args>
316 if (m_isSubsetColl) {
317 throw std::logic_error(
"Cannot create new elements on a subset collection");
319 auto obj =
new RawCALOROCHitObj({
static_cast<int>(m_storage.entries.size()), m_collectionID}, {std::forward<Args>(args)...});
320 m_storage.entries.push_back(obj);
323 obj->
m_aSamples =
new std::vector<edm4eic::CALOROC1ASample>();
324 obj->m_bSamples =
new std::vector<edm4eic::CALOROC1BSample>();
325 m_storage.createRelations(obj);
329#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
339#if defined(__clang__)
340 #pragma clang diagnostic push
341 #pragma clang diagnostic ignored "-Wunknown-warning-option"
342 #pragma clang diagnostic ignored "-Wdeprecated-redundant-constexpr-static-def"
343 #pragma clang diagnostic ignored "-Wdeprecated"
347 #pragma clang diagnostic pop
348#elif defined(__GNUC__)
349 #pragma GCC diagnostic push
350 #pragma GCC diagnostic ignored "-Wdeprecated"
354 #pragma GCC diagnostic pop
Definition MutableRawCALOROCHit.h:37
Definition RawCALOROCHitCollectionData.h:31
Definition RawCALOROCHitCollection.h:138
podio::SchemaVersionT getSchemaVersion() const final
schema version
Definition RawCALOROCHitCollection.cc:193
RawCALOROCHitCollection & operator=(RawCALOROCHitCollection &&)=default
MutableRawCALOROCHit create()
Append a new object to the collection, and return this object.
Definition RawCALOROCHitCollection.cc:77
const_reverse_iterator rend() const
Definition RawCALOROCHitCollection.h:287
std::size_t size() const final
number of elements in the collection
Definition RawCALOROCHitCollection.cc:48
size_t size_type
Definition RawCALOROCHitCollection.h:145
reverse_iterator rend()
Definition RawCALOROCHitCollection.h:284
bool isSubsetCollection() const final
Definition RawCALOROCHitCollection.h:200
const_iterator cend() const
Definition RawCALOROCHitCollection.h:271
ptrdiff_t difference_type
Definition RawCALOROCHitCollection.h:144
std::size_t max_size() const final
maximal number of elements in the collection
Definition RawCALOROCHitCollection.cc:52
RawCALOROCHitCollection(const RawCALOROCHitCollection &)=delete
void push_back(const MutableRawCALOROCHit &object)
Append object to the collection.
Definition RawCALOROCHitCollection.cc:122
RawCALOROCHitCollection(RawCALOROCHitCollection &&)=default
iterator begin()
Definition RawCALOROCHitCollection.h:256
RawCALOROCHit value_type
Definition RawCALOROCHitCollection.h:140
std::reverse_iterator< iterator > reverse_iterator
Definition RawCALOROCHitCollection.h:147
const_iterator end() const
Definition RawCALOROCHitCollection.h:268
podio::CollectionWriteBuffers getBuffers() final
Get the collection buffers for this collection.
Definition RawCALOROCHitCollection.cc:154
RawCALOROCHitCollection()=default
RawCALOROCHitMutableCollectionIterator iterator
Definition RawCALOROCHitCollection.h:143
bool setReferences(const podio::ICollectionProvider *collectionProvider) final
Definition RawCALOROCHitCollection.cc:118
const_iterator begin() const
Definition RawCALOROCHitCollection.h:259
const_iterator cbegin() const
Definition RawCALOROCHitCollection.h:262
static constexpr std::string_view dataTypeName
Definition RawCALOROCHitCollection.h:162
iterator end()
Definition RawCALOROCHitCollection.h:265
~RawCALOROCHitCollection() override
Definition RawCALOROCHitCollection.cc:27
reverse_iterator rbegin()
Definition RawCALOROCHitCollection.h:275
RawCALOROCHitCollection & operator=(const RawCALOROCHitCollection &)=delete
std::reverse_iterator< const_iterator > const_reverse_iterator
Definition RawCALOROCHitCollection.h:146
void prepareForWrite() const final
Definition RawCALOROCHitCollection.cc:94
friend class RawCALOROCHitCollectionData
Definition RawCALOROCHitCollection.h:303
const_reverse_iterator rbegin() const
Definition RawCALOROCHitCollection.h:278
MutableRawCALOROCHit mutable_type
Definition RawCALOROCHitCollection.h:141
uint32_t getID() const final
Definition RawCALOROCHitCollection.h:237
static constexpr std::string_view typeName
Definition RawCALOROCHitCollection.h:160
bool isValid() const final
Definition RawCALOROCHitCollection.h:249
const_reverse_iterator crend() const
Definition RawCALOROCHitCollection.h:290
static void __cppyy_pythonize__(PyObject *klass, const std::string &name)
Cppyy protocol to setup the pythonizations for this class. Not to be called directly.
Definition RawCALOROCHitCollection.h:167
bool hasID() const final
check if the collection has a valid ID
Definition RawCALOROCHitCollection.h:242
const_reverse_iterator crbegin() const
Definition RawCALOROCHitCollection.h:281
const std::string_view getValueTypeName() const final
fully qualified type name of elements - with namespace
Definition RawCALOROCHitCollection.h:194
bool empty() const final
Is the collection empty.
Definition RawCALOROCHitCollection.cc:62
const std::string_view getDataTypeName() const final
fully qualified type name of stored POD elements - with namespace
Definition RawCALOROCHitCollection.h:196
void setID(uint32_t ID) final
Definition RawCALOROCHitCollection.h:228
void print(std::ostream &os=std::cout, bool flush=true) const final
Print this collection to the passed stream.
Definition RawCALOROCHitCollection.cc:465
void setSubsetCollection(bool setSubset=true) final
Definition RawCALOROCHitCollection.cc:66
void clear() final
Definition RawCALOROCHitCollection.cc:89
void prepareAfterRead() final
Definition RawCALOROCHitCollection.cc:103
const std::string_view getTypeName() const final
fully qualified type name
Definition RawCALOROCHitCollection.h:192
RawCALOROCHitCollectionIterator const_iterator
Definition RawCALOROCHitCollection.h:142
RawCALOROCHit at(std::size_t index) const
Returns the const object of given index.
Definition RawCALOROCHitCollection.cc:36
static constexpr std::string_view valueTypeName
Definition RawCALOROCHitCollection.h:161
Definition RawCALOROCHitCollection.h:37
RawCALOROCHitCollectionIterator(RawCALOROCHitCollectionIterator &&)=default
RawCALOROCHitCollectionIterator operator-(difference_type n) const
Definition RawCALOROCHitCollection.cc:352
reference operator*() const
Definition RawCALOROCHitCollection.cc:301
reference operator[](difference_type n) const
Definition RawCALOROCHitCollection.cc:358
RawCALOROCHitCollectionIterator & operator+=(difference_type n)
Definition RawCALOROCHitCollection.cc:332
bool operator==(const RawCALOROCHitCollectionIterator &x) const
Definition RawCALOROCHitCollection.h:61
RawCALOROCHitCollectionIterator(size_t index, const RawCALOROCHitObjPointerContainer *collection)
Definition RawCALOROCHitCollection.h:48
~RawCALOROCHitCollectionIterator()=default
RawCALOROCHit * pointer
Definition RawCALOROCHitCollection.h:42
ptrdiff_t difference_type
Definition RawCALOROCHitCollection.h:40
RawCALOROCHitCollectionIterator & operator=(RawCALOROCHitCollectionIterator &&)=default
RawCALOROCHitCollectionIterator & operator++()
Definition RawCALOROCHitCollection.cc:310
RawCALOROCHitCollectionIterator & operator--()
Definition RawCALOROCHitCollection.cc:321
RawCALOROCHitCollectionIterator operator+(difference_type n) const
Definition RawCALOROCHitCollection.cc:337
RawCALOROCHitCollectionIterator & operator-=(difference_type n)
Definition RawCALOROCHitCollection.cc:347
RawCALOROCHitCollectionIterator & operator=(const RawCALOROCHitCollectionIterator &)=default
RawCALOROCHitCollectionIterator()=default
std::input_iterator_tag iterator_category
Definition RawCALOROCHitCollection.h:43
auto operator<=>(const RawCALOROCHitCollectionIterator &other) const
Definition RawCALOROCHitCollection.h:57
std::random_access_iterator_tag iterator_concept
Definition RawCALOROCHitCollection.h:46
RawCALOROCHitCollectionIterator(const RawCALOROCHitCollectionIterator &)=default
RawCALOROCHit reference
Definition RawCALOROCHitCollection.h:41
RawCALOROCHit value_type
Definition RawCALOROCHitCollection.h:39
pointer operator->()
Definition RawCALOROCHitCollection.cc:305
Definition RawCALOROCHit.h:45
Definition RawCALOROCHitCollection.h:86
RawCALOROCHitMutableCollectionIterator(RawCALOROCHitMutableCollectionIterator &&)=default
RawCALOROCHitMutableCollectionIterator & operator--()
Definition RawCALOROCHitCollection.cc:388
std::random_access_iterator_tag iterator_concept
Definition RawCALOROCHitCollection.h:95
RawCALOROCHitMutableCollectionIterator & operator++()
Definition RawCALOROCHitCollection.cc:377
RawCALOROCHitMutableCollectionIterator()=default
RawCALOROCHitMutableCollectionIterator & operator=(const RawCALOROCHitMutableCollectionIterator &)=default
reference operator*() const
Definition RawCALOROCHitCollection.cc:368
MutableRawCALOROCHit reference
Definition RawCALOROCHitCollection.h:90
~RawCALOROCHitMutableCollectionIterator()=default
RawCALOROCHit value_type
Definition RawCALOROCHitCollection.h:88
ptrdiff_t difference_type
Definition RawCALOROCHitCollection.h:89
RawCALOROCHitMutableCollectionIterator(size_t index, const RawCALOROCHitObjPointerContainer *collection)
Definition RawCALOROCHitCollection.h:97
RawCALOROCHitMutableCollectionIterator(const RawCALOROCHitMutableCollectionIterator &)=default
RawCALOROCHitMutableCollectionIterator & operator+=(difference_type n)
Definition RawCALOROCHitCollection.cc:399
bool operator==(const RawCALOROCHitMutableCollectionIterator &x) const
Definition RawCALOROCHitCollection.h:110
reference operator[](difference_type n) const
Definition RawCALOROCHitCollection.cc:425
RawCALOROCHitMutableCollectionIterator & operator=(RawCALOROCHitMutableCollectionIterator &&)=default
RawCALOROCHitMutableCollectionIterator operator-(difference_type n) const
Definition RawCALOROCHitCollection.cc:419
auto operator<=>(const RawCALOROCHitMutableCollectionIterator &other) const
Definition RawCALOROCHitCollection.h:106
RawCALOROCHitMutableCollectionIterator operator+(difference_type n) const
Definition RawCALOROCHitCollection.cc:404
std::input_iterator_tag iterator_category
Definition RawCALOROCHitCollection.h:92
MutableRawCALOROCHit * pointer
Definition RawCALOROCHitCollection.h:91
pointer operator->()
Definition RawCALOROCHitCollection.cc:372
RawCALOROCHitMutableCollectionIterator & operator-=(difference_type n)
Definition RawCALOROCHitCollection.cc:414
Definition RawCALOROCHitObj.h:21
std::vector< edm4eic::CALOROC1ASample > * m_aSamples
Definition RawCALOROCHitObj.h:37
Definition CalorimeterHit.cc:17
std::ostream & operator<<(std::ostream &o, const CalorimeterHit &value)
Definition CalorimeterHit.cc:99
std::deque< RawCALOROCHitObj * > RawCALOROCHitObjPointerContainer
Definition RawCALOROCHitCollectionData.h:23
Definition CalorimeterHit.h:31