3#ifndef EDM4EIC_CherenkovParticleIDCollection_H
4#define EDM4EIC_CherenkovParticleIDCollection_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 CherenkovParticleID m_object { podio::utils::MaybeSharedPtr<CherenkovParticleIDObj>{
nullptr} };
108 return m_index <=> other.m_index;
112 return m_index == x.m_index;
131 MutableCherenkovParticleID m_object { podio::utils::MaybeSharedPtr<CherenkovParticleIDObj>{
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::CherenkovParticleIDCollection";
170 constexpr static std::string_view
valueTypeName =
"edm4eic::CherenkovParticleID";
171 constexpr static std::string_view
dataTypeName =
"edm4eic::CherenkovParticleIDData";
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(),
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<float> npe(
const size_t nElem = 0)
const;
308 std::vector<float> refractiveIndex(
const size_t nElem = 0)
const;
309 std::vector<float> photonEnergy(
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 CherenkovParticleIDCollection& 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 CherenkovParticleIDObj({
static_cast<int>(m_storage.entries.size()), m_collectionID}, {std::forward<Args>(args)...});
332 m_storage.entries.push_back(obj);
335 obj->
m_rawHits =
new std::vector<edm4eic::RawTrackerHit>();
336 obj->m_hypotheses =
new std::vector<edm4eic::CherenkovParticleIDHypothesis>();
337 obj->m_thetaPhiPhotons =
new std::vector<edm4hep::Vector2f>();
338 m_storage.createRelations(obj);
343#if defined(__cpp_lib_containers_ranges)
344template<podio::detail::RangeConvertibleTo<CherenkovParticleIDCollection::value_type> R>
349 for (
auto&& elem : range) {
350 push_back(std::forward<
decltype(elem)>(elem));
355template<podio::detail::RangeConvertibleTo<CherenkovParticleIDCollection::value_type> R>
358 if constexpr (podio::detail::RangeOf<R, value_type>) {
362 for (
auto&& elem : range) {
363 coll.
push_back(std::forward<
decltype(elem)>(elem));
370#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
380#if defined(__clang__)
381 #pragma clang diagnostic push
382 #pragma clang diagnostic ignored "-Wunknown-warning-option"
383 #pragma clang diagnostic ignored "-Wdeprecated-redundant-constexpr-static-def"
384 #pragma clang diagnostic ignored "-Wdeprecated"
388 #pragma clang diagnostic pop
389#elif defined(__GNUC__)
390 #pragma GCC diagnostic push
391 #pragma GCC diagnostic ignored "-Wdeprecated"
395 #pragma GCC diagnostic pop
Definition CherenkovParticleIDCollectionData.h:33
Definition CherenkovParticleIDCollection.h:139
void push_back(const MutableCherenkovParticleID &object)
Definition CherenkovParticleIDCollection.cc:124
const_reverse_iterator crbegin() const
Definition CherenkovParticleIDCollection.h:293
const_reverse_iterator rend() const
Definition CherenkovParticleIDCollection.h:299
static constexpr std::string_view valueTypeName
Definition CherenkovParticleIDCollection.h:170
reverse_iterator rend()
Definition CherenkovParticleIDCollection.h:296
void clear() final
Invalidates all iterators.
Definition CherenkovParticleIDCollection.cc:91
std::reverse_iterator< iterator > reverse_iterator
Definition CherenkovParticleIDCollection.h:148
const_iterator begin() const
Definition CherenkovParticleIDCollection.h:271
const_iterator end() const
Definition CherenkovParticleIDCollection.h:280
CherenkovParticleIDCollection & operator=(CherenkovParticleIDCollection &&)=default
static void __cppyy_pythonize__(PyObject *klass, const std::string &name)
Pythonizations for ROOT <= 6.40 before the switch to cppjit.
Definition CherenkovParticleIDCollection.h:181
void prepareForWrite() const final
Definition CherenkovParticleIDCollection.cc:96
void setID(uint32_t ID) final
Definition CherenkovParticleIDCollection.h:246
uint32_t getID() const final
Definition CherenkovParticleIDCollection.h:255
podio::CollectionWriteBuffers getBuffers() final
Get the collection buffers for this collection.
Definition CherenkovParticleIDCollection.cc:156
const_reverse_iterator rbegin() const
Definition CherenkovParticleIDCollection.h:290
const_iterator cbegin() const
Definition CherenkovParticleIDCollection.h:274
const_reverse_iterator crend() const
Definition CherenkovParticleIDCollection.h:302
CherenkovParticleIDCollection()=default
void setSubsetCollection(bool setSubset=true) final
Definition CherenkovParticleIDCollection.cc:68
std::size_t size() const final
number of elements in the collection
Definition CherenkovParticleIDCollection.cc:50
CherenkovParticleID value_type
Definition CherenkovParticleIDCollection.h:141
void print(std::ostream &os=std::cout, bool flush=true) const final
Print this collection to the passed stream.
Definition CherenkovParticleIDCollection.cc:468
bool setReferences(const podio::ICollectionProvider *collectionProvider) final
Definition CherenkovParticleIDCollection.cc:120
CherenkovParticleIDMutableCollectionIterator iterator
Definition CherenkovParticleIDCollection.h:144
const std::string_view getDataTypeName() const final
fully qualified type name of stored POD elements - with namespace
Definition CherenkovParticleIDCollection.h:212
static constexpr std::string_view dataTypeName
Definition CherenkovParticleIDCollection.h:171
std::reverse_iterator< const_iterator > const_reverse_iterator
Definition CherenkovParticleIDCollection.h:147
const std::string_view getValueTypeName() const final
fully qualified type name of elements - with namespace
Definition CherenkovParticleIDCollection.h:210
const std::string_view getTypeName() const final
fully qualified type name
Definition CherenkovParticleIDCollection.h:208
MutableCherenkovParticleID create()
Definition CherenkovParticleIDCollection.cc:79
std::size_t max_size() const final
maximal number of elements in the collection
Definition CherenkovParticleIDCollection.cc:54
CherenkovParticleIDCollection(CherenkovParticleIDCollection &&)=default
CherenkovParticleID at(std::size_t index) const
Returns the const object of given index.
Definition CherenkovParticleIDCollection.cc:38
~CherenkovParticleIDCollection() override
Definition CherenkovParticleIDCollection.cc:29
void prepareAfterRead() final
Definition CherenkovParticleIDCollection.cc:105
CherenkovParticleIDCollection(const CherenkovParticleIDCollection &)=delete
iterator begin()
Definition CherenkovParticleIDCollection.h:268
static constexpr std::string_view typeName
Definition CherenkovParticleIDCollection.h:169
const_iterator cend() const
Definition CherenkovParticleIDCollection.h:283
size_t size_type
Definition CherenkovParticleIDCollection.h:146
static CherenkovParticleIDCollection from(R &&range)
Definition CherenkovParticleIDCollection.h:356
ptrdiff_t difference_type
Definition CherenkovParticleIDCollection.h:145
bool isSubsetCollection() const final
Definition CherenkovParticleIDCollection.h:216
CherenkovParticleIDCollectionIterator const_iterator
Definition CherenkovParticleIDCollection.h:143
podio::SchemaVersionT getSchemaVersion() const final
schema version
Definition CherenkovParticleIDCollection.cc:195
iterator end()
Definition CherenkovParticleIDCollection.h:277
MutableCherenkovParticleID mutable_type
Definition CherenkovParticleIDCollection.h:142
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 CherenkovParticleIDCollection.h:177
CherenkovParticleIDCollection & operator=(const CherenkovParticleIDCollection &)=delete
bool empty() const final
Is the collection empty.
Definition CherenkovParticleIDCollection.cc:64
friend class CherenkovParticleIDCollectionData
Definition CherenkovParticleIDCollection.h:315
bool hasID() const final
check if the collection has a valid ID
Definition CherenkovParticleIDCollection.h:260
reverse_iterator rbegin()
Definition CherenkovParticleIDCollection.h:287
Definition CherenkovParticleIDCollection.h:38
ptrdiff_t difference_type
Definition CherenkovParticleIDCollection.h:41
CherenkovParticleIDCollectionIterator operator+(difference_type n) const
Definition CherenkovParticleIDCollection.cc:333
CherenkovParticleID reference
Definition CherenkovParticleIDCollection.h:42
CherenkovParticleIDCollectionIterator & operator+=(difference_type n)
Definition CherenkovParticleIDCollection.cc:328
CherenkovParticleIDCollectionIterator & operator-=(difference_type n)
Definition CherenkovParticleIDCollection.cc:343
CherenkovParticleIDCollectionIterator(const CherenkovParticleIDCollectionIterator &)=default
CherenkovParticleID value_type
Definition CherenkovParticleIDCollection.h:40
~CherenkovParticleIDCollectionIterator()=default
constexpr bool operator==(const CherenkovParticleIDCollectionIterator &x) const
Definition CherenkovParticleIDCollection.h:62
CherenkovParticleIDCollectionIterator(CherenkovParticleIDCollectionIterator &&)=default
pointer operator->()
Definition CherenkovParticleIDCollection.cc:301
CherenkovParticleIDCollectionIterator(size_t index, const CherenkovParticleIDObjPointerContainer *collection)
Definition CherenkovParticleIDCollection.h:49
reference operator[](difference_type n) const
Definition CherenkovParticleIDCollection.cc:354
CherenkovParticleIDCollectionIterator & operator++()
Definition CherenkovParticleIDCollection.cc:306
CherenkovParticleIDCollectionIterator & operator=(CherenkovParticleIDCollectionIterator &&)=default
CherenkovParticleIDCollectionIterator & operator--()
Definition CherenkovParticleIDCollection.cc:317
CherenkovParticleIDCollectionIterator operator-(difference_type n) const
Definition CherenkovParticleIDCollection.cc:348
CherenkovParticleIDCollectionIterator()=default
reference operator*() const
Definition CherenkovParticleIDCollection.cc:297
std::random_access_iterator_tag iterator_concept
Definition CherenkovParticleIDCollection.h:47
std::input_iterator_tag iterator_category
Definition CherenkovParticleIDCollection.h:44
CherenkovParticleID * pointer
Definition CherenkovParticleIDCollection.h:43
CherenkovParticleIDCollectionIterator & operator=(const CherenkovParticleIDCollectionIterator &)=default
constexpr auto operator<=>(const CherenkovParticleIDCollectionIterator &other) const
Definition CherenkovParticleIDCollection.h:58
Definition CherenkovParticleID.h:46
Definition CherenkovParticleIDCollection.h:87
constexpr auto operator<=>(const CherenkovParticleIDMutableCollectionIterator &other) const
Definition CherenkovParticleIDCollection.h:107
CherenkovParticleIDMutableCollectionIterator & operator++()
Definition CherenkovParticleIDCollection.cc:373
CherenkovParticleID value_type
Definition CherenkovParticleIDCollection.h:89
MutableCherenkovParticleID * pointer
Definition CherenkovParticleIDCollection.h:92
std::random_access_iterator_tag iterator_concept
Definition CherenkovParticleIDCollection.h:96
CherenkovParticleIDMutableCollectionIterator & operator=(CherenkovParticleIDMutableCollectionIterator &&)=default
CherenkovParticleIDMutableCollectionIterator(const CherenkovParticleIDMutableCollectionIterator &)=default
CherenkovParticleIDMutableCollectionIterator operator+(difference_type n) const
Definition CherenkovParticleIDCollection.cc:400
CherenkovParticleIDMutableCollectionIterator(size_t index, const CherenkovParticleIDObjPointerContainer *collection)
Definition CherenkovParticleIDCollection.h:98
pointer operator->()
Definition CherenkovParticleIDCollection.cc:368
CherenkovParticleIDMutableCollectionIterator & operator--()
Definition CherenkovParticleIDCollection.cc:384
MutableCherenkovParticleID reference
Definition CherenkovParticleIDCollection.h:91
reference operator*() const
Definition CherenkovParticleIDCollection.cc:364
~CherenkovParticleIDMutableCollectionIterator()=default
reference operator[](difference_type n) const
Definition CherenkovParticleIDCollection.cc:421
ptrdiff_t difference_type
Definition CherenkovParticleIDCollection.h:90
constexpr bool operator==(const CherenkovParticleIDMutableCollectionIterator &x) const
Definition CherenkovParticleIDCollection.h:111
CherenkovParticleIDMutableCollectionIterator & operator+=(difference_type n)
Definition CherenkovParticleIDCollection.cc:395
CherenkovParticleIDMutableCollectionIterator operator-(difference_type n) const
Definition CherenkovParticleIDCollection.cc:415
CherenkovParticleIDMutableCollectionIterator()=default
CherenkovParticleIDMutableCollectionIterator & operator-=(difference_type n)
Definition CherenkovParticleIDCollection.cc:410
CherenkovParticleIDMutableCollectionIterator(CherenkovParticleIDMutableCollectionIterator &&)=default
std::input_iterator_tag iterator_category
Definition CherenkovParticleIDCollection.h:93
CherenkovParticleIDMutableCollectionIterator & operator=(const CherenkovParticleIDMutableCollectionIterator &)=default
Definition CherenkovParticleIDObj.h:26
std::vector< edm4eic::RawTrackerHit > * m_rawHits
Definition CherenkovParticleIDObj.h:43
Definition MutableCherenkovParticleID.h:38
Definition ArrowMapper.cc:63
std::ostream & operator<<(std::ostream &o, const CalorimeterHit &value)
Definition CalorimeterHit.cc:99
std::deque< CherenkovParticleIDObj * > CherenkovParticleIDObjPointerContainer
Definition CherenkovParticleIDCollectionData.h:25
Definition CalorimeterHit.h:31