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"
16#include "podio/utilities/TypeHelpers.h"
18#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
19#include "nlohmann/json_fwd.hpp"
59 return m_index <=> other.m_index;
63 return m_index == x.m_index;
82 RawCALOROCHit m_object { podio::utils::MaybeSharedPtr<RawCALOROCHitObj>{
nullptr} };
108 return m_index <=> other.m_index;
112 return m_index == x.m_index;
131 MutableRawCALOROCHit m_object { podio::utils::MaybeSharedPtr<RawCALOROCHitObj>{
nullptr} };
159#if defined(__cpp_lib_containers_ranges)
160 template<podio::detail::RangeConvertibleTo<value_type> R>
166 template<podio::detail::RangeConvertibleTo<value_type> R>
169 constexpr static std::string_view
typeName =
"edm4eic::RawCALOROCHitCollection";
171 constexpr static std::string_view
dataTypeName =
"edm4eic::RawCALOROCHitData";
178 podio::detail::pythonizations::pythonize_subscript(klass, name);
186 void print(std::ostream& os=std::cout,
bool flush=
true) const final;
195 template<typename... Args>
199 std::
size_t size() const final;
205 bool empty() const final;
217 return m_isSubsetColl;
248 if (!m_isSubsetColl) {
249 std::for_each(m_storage.entries.begin(), m_storage.entries.end(),
250 [ID] (
RawCALOROCHitObj* obj) { obj->id = {obj->id.index, static_cast<uint32_t>(ID)}; }
256 return m_collectionID;
261 return getID() !=
static_cast<uint32_t
>(podio::ObjectID::untracked) &&
262 getID() !=
static_cast<uint32_t
>(podio::ObjectID::invalid);
265 size_t getDatamodelRegistryIndex() const final;
269 return iterator(0, &m_storage.entries);
278 return iterator(m_storage.entries.size(), &m_storage.entries);
281 return const_iterator(m_storage.entries.size(), &m_storage.entries);
307 std::vector<std::uint64_t> cellID(
const size_t nElem = 0)
const;
308 std::vector<std::int32_t> samplePhase(
const size_t nElem = 0)
const;
309 std::vector<std::int32_t> timeStamp(
const size_t nElem = 0)
const;
317 mutable bool m_isPrepared{
false};
318 bool m_isSubsetColl{
false};
319 uint32_t m_collectionID{
static_cast<uint32_t
>(podio::ObjectID::untracked)};
320 mutable std::unique_ptr<std::mutex> m_storageMtx{std::make_unique<std::mutex>()};
324std::ostream&
operator<<(std::ostream& o,
const RawCALOROCHitCollection& v);
326template<
typename... Args>
328 if (m_isSubsetColl) {
329 throw std::logic_error(
"Cannot create new elements on a subset collection");
331 auto obj =
new RawCALOROCHitObj({
static_cast<int>(m_storage.entries.size()), m_collectionID}, {std::forward<Args>(args)...});
332 m_storage.entries.push_back(obj);
335 obj->
m_aSamples =
new std::vector<edm4eic::CALOROC1ASample>();
336 obj->m_bSamples =
new std::vector<edm4eic::CALOROC1BSample>();
337 m_storage.createRelations(obj);
342#if defined(__cpp_lib_containers_ranges)
343template<podio::detail::RangeConvertibleTo<RawCALOROCHitCollection::value_type> R>
348 for (
auto&& elem : range) {
349 push_back(std::forward<
decltype(elem)>(elem));
354template<podio::detail::RangeConvertibleTo<RawCALOROCHitCollection::value_type> R>
357 if constexpr (podio::detail::RangeOf<R, value_type>) {
361 for (
auto&& elem : range) {
362 coll.
push_back(std::forward<
decltype(elem)>(elem));
369#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
379#if defined(__clang__)
380 #pragma clang diagnostic push
381 #pragma clang diagnostic ignored "-Wunknown-warning-option"
382 #pragma clang diagnostic ignored "-Wdeprecated-redundant-constexpr-static-def"
383 #pragma clang diagnostic ignored "-Wdeprecated"
387 #pragma clang diagnostic pop
388#elif defined(__GNUC__)
389 #pragma GCC diagnostic push
390 #pragma GCC diagnostic ignored "-Wdeprecated"
394 #pragma GCC diagnostic pop
Definition MutableRawCALOROCHit.h:37
Definition RawCALOROCHitCollectionData.h:31
Definition RawCALOROCHitCollection.h:139
podio::SchemaVersionT getSchemaVersion() const final
schema version
Definition RawCALOROCHitCollection.cc:193
RawCALOROCHitCollection & operator=(RawCALOROCHitCollection &&)=default
MutableRawCALOROCHit create()
Definition RawCALOROCHitCollection.cc:77
const_reverse_iterator rend() const
Definition RawCALOROCHitCollection.h:299
std::size_t size() const final
number of elements in the collection
Definition RawCALOROCHitCollection.cc:48
size_t size_type
Definition RawCALOROCHitCollection.h:146
reverse_iterator rend()
Definition RawCALOROCHitCollection.h:296
static void __cppjit_pythonize__(PyObject *klass, const std::string &name)
Cppyy protocol to setup the pythonizations for this class. Not to be called directly.
Definition RawCALOROCHitCollection.h:177
bool isSubsetCollection() const final
Definition RawCALOROCHitCollection.h:216
const_iterator cend() const
Definition RawCALOROCHitCollection.h:283
ptrdiff_t difference_type
Definition RawCALOROCHitCollection.h:145
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)
Definition RawCALOROCHitCollection.cc:122
RawCALOROCHitCollection(RawCALOROCHitCollection &&)=default
iterator begin()
Definition RawCALOROCHitCollection.h:268
RawCALOROCHit value_type
Definition RawCALOROCHitCollection.h:141
std::reverse_iterator< iterator > reverse_iterator
Definition RawCALOROCHitCollection.h:148
const_iterator end() const
Definition RawCALOROCHitCollection.h:280
podio::CollectionWriteBuffers getBuffers() final
Get the collection buffers for this collection.
Definition RawCALOROCHitCollection.cc:154
RawCALOROCHitCollection()=default
RawCALOROCHitMutableCollectionIterator iterator
Definition RawCALOROCHitCollection.h:144
bool setReferences(const podio::ICollectionProvider *collectionProvider) final
Definition RawCALOROCHitCollection.cc:118
const_iterator begin() const
Definition RawCALOROCHitCollection.h:271
const_iterator cbegin() const
Definition RawCALOROCHitCollection.h:274
static constexpr std::string_view dataTypeName
Definition RawCALOROCHitCollection.h:171
iterator end()
Definition RawCALOROCHitCollection.h:277
~RawCALOROCHitCollection() override
Definition RawCALOROCHitCollection.cc:27
reverse_iterator rbegin()
Definition RawCALOROCHitCollection.h:287
RawCALOROCHitCollection & operator=(const RawCALOROCHitCollection &)=delete
std::reverse_iterator< const_iterator > const_reverse_iterator
Definition RawCALOROCHitCollection.h:147
void prepareForWrite() const final
Definition RawCALOROCHitCollection.cc:94
friend class RawCALOROCHitCollectionData
Definition RawCALOROCHitCollection.h:315
const_reverse_iterator rbegin() const
Definition RawCALOROCHitCollection.h:290
MutableRawCALOROCHit mutable_type
Definition RawCALOROCHitCollection.h:142
uint32_t getID() const final
Definition RawCALOROCHitCollection.h:255
static constexpr std::string_view typeName
Definition RawCALOROCHitCollection.h:169
const_reverse_iterator crend() const
Definition RawCALOROCHitCollection.h:302
static void __cppyy_pythonize__(PyObject *klass, const std::string &name)
Pythonizations for ROOT <= 6.40 before the switch to cppjit.
Definition RawCALOROCHitCollection.h:181
bool hasID() const final
check if the collection has a valid ID
Definition RawCALOROCHitCollection.h:260
const_reverse_iterator crbegin() const
Definition RawCALOROCHitCollection.h:293
const std::string_view getValueTypeName() const final
fully qualified type name of elements - with namespace
Definition RawCALOROCHitCollection.h:210
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:212
void setID(uint32_t ID) final
Definition RawCALOROCHitCollection.h:246
void print(std::ostream &os=std::cout, bool flush=true) const final
Print this collection to the passed stream.
Definition RawCALOROCHitCollection.cc:459
void setSubsetCollection(bool setSubset=true) final
Definition RawCALOROCHitCollection.cc:66
void clear() final
Invalidates all iterators.
Definition RawCALOROCHitCollection.cc:89
void prepareAfterRead() final
Definition RawCALOROCHitCollection.cc:103
static RawCALOROCHitCollection from(R &&range)
Definition RawCALOROCHitCollection.h:355
const std::string_view getTypeName() const final
fully qualified type name
Definition RawCALOROCHitCollection.h:208
RawCALOROCHitCollectionIterator const_iterator
Definition RawCALOROCHitCollection.h:143
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:170
Definition RawCALOROCHitCollection.h:38
RawCALOROCHitCollectionIterator(RawCALOROCHitCollectionIterator &&)=default
RawCALOROCHitCollectionIterator operator-(difference_type n) const
Definition RawCALOROCHitCollection.cc:346
reference operator*() const
Definition RawCALOROCHitCollection.cc:295
reference operator[](difference_type n) const
Definition RawCALOROCHitCollection.cc:352
RawCALOROCHitCollectionIterator & operator+=(difference_type n)
Definition RawCALOROCHitCollection.cc:326
RawCALOROCHitCollectionIterator(size_t index, const RawCALOROCHitObjPointerContainer *collection)
Definition RawCALOROCHitCollection.h:49
~RawCALOROCHitCollectionIterator()=default
RawCALOROCHit * pointer
Definition RawCALOROCHitCollection.h:43
ptrdiff_t difference_type
Definition RawCALOROCHitCollection.h:41
constexpr auto operator<=>(const RawCALOROCHitCollectionIterator &other) const
Definition RawCALOROCHitCollection.h:58
RawCALOROCHitCollectionIterator & operator=(RawCALOROCHitCollectionIterator &&)=default
RawCALOROCHitCollectionIterator & operator++()
Definition RawCALOROCHitCollection.cc:304
RawCALOROCHitCollectionIterator & operator--()
Definition RawCALOROCHitCollection.cc:315
RawCALOROCHitCollectionIterator operator+(difference_type n) const
Definition RawCALOROCHitCollection.cc:331
RawCALOROCHitCollectionIterator & operator-=(difference_type n)
Definition RawCALOROCHitCollection.cc:341
RawCALOROCHitCollectionIterator & operator=(const RawCALOROCHitCollectionIterator &)=default
RawCALOROCHitCollectionIterator()=default
std::input_iterator_tag iterator_category
Definition RawCALOROCHitCollection.h:44
constexpr bool operator==(const RawCALOROCHitCollectionIterator &x) const
Definition RawCALOROCHitCollection.h:62
std::random_access_iterator_tag iterator_concept
Definition RawCALOROCHitCollection.h:47
RawCALOROCHitCollectionIterator(const RawCALOROCHitCollectionIterator &)=default
RawCALOROCHit reference
Definition RawCALOROCHitCollection.h:42
RawCALOROCHit value_type
Definition RawCALOROCHitCollection.h:40
pointer operator->()
Definition RawCALOROCHitCollection.cc:299
Definition RawCALOROCHit.h:45
Definition RawCALOROCHitCollection.h:87
RawCALOROCHitMutableCollectionIterator(RawCALOROCHitMutableCollectionIterator &&)=default
RawCALOROCHitMutableCollectionIterator & operator--()
Definition RawCALOROCHitCollection.cc:382
std::random_access_iterator_tag iterator_concept
Definition RawCALOROCHitCollection.h:96
RawCALOROCHitMutableCollectionIterator & operator++()
Definition RawCALOROCHitCollection.cc:371
RawCALOROCHitMutableCollectionIterator()=default
RawCALOROCHitMutableCollectionIterator & operator=(const RawCALOROCHitMutableCollectionIterator &)=default
constexpr bool operator==(const RawCALOROCHitMutableCollectionIterator &x) const
Definition RawCALOROCHitCollection.h:111
reference operator*() const
Definition RawCALOROCHitCollection.cc:362
MutableRawCALOROCHit reference
Definition RawCALOROCHitCollection.h:91
~RawCALOROCHitMutableCollectionIterator()=default
RawCALOROCHit value_type
Definition RawCALOROCHitCollection.h:89
ptrdiff_t difference_type
Definition RawCALOROCHitCollection.h:90
RawCALOROCHitMutableCollectionIterator(size_t index, const RawCALOROCHitObjPointerContainer *collection)
Definition RawCALOROCHitCollection.h:98
RawCALOROCHitMutableCollectionIterator(const RawCALOROCHitMutableCollectionIterator &)=default
RawCALOROCHitMutableCollectionIterator & operator+=(difference_type n)
Definition RawCALOROCHitCollection.cc:393
constexpr auto operator<=>(const RawCALOROCHitMutableCollectionIterator &other) const
Definition RawCALOROCHitCollection.h:107
reference operator[](difference_type n) const
Definition RawCALOROCHitCollection.cc:419
RawCALOROCHitMutableCollectionIterator & operator=(RawCALOROCHitMutableCollectionIterator &&)=default
RawCALOROCHitMutableCollectionIterator operator-(difference_type n) const
Definition RawCALOROCHitCollection.cc:413
RawCALOROCHitMutableCollectionIterator operator+(difference_type n) const
Definition RawCALOROCHitCollection.cc:398
std::input_iterator_tag iterator_category
Definition RawCALOROCHitCollection.h:93
MutableRawCALOROCHit * pointer
Definition RawCALOROCHitCollection.h:92
pointer operator->()
Definition RawCALOROCHitCollection.cc:366
RawCALOROCHitMutableCollectionIterator & operator-=(difference_type n)
Definition RawCALOROCHitCollection.cc:408
Definition RawCALOROCHitObj.h:21
std::vector< edm4eic::CALOROC1ASample > * m_aSamples
Definition RawCALOROCHitObj.h:37
Definition ArrowMapper.cc:63
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