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"
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 CherenkovParticleID m_object { podio::utils::MaybeSharedPtr<CherenkovParticleIDObj>{
nullptr} };
107 return m_index <=> other.m_index;
111 return m_index == x.m_index;
130 MutableCherenkovParticleID m_object { podio::utils::MaybeSharedPtr<CherenkovParticleIDObj>{
nullptr} };
160 constexpr static std::string_view
typeName =
"edm4eic::CherenkovParticleIDCollection";
161 constexpr static std::string_view
valueTypeName =
"edm4eic::CherenkovParticleID";
162 constexpr static std::string_view
dataTypeName =
"edm4eic::CherenkovParticleIDData";
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(),
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<float> npe(
const size_t nElem = 0)
const;
296 std::vector<float> refractiveIndex(
const size_t nElem = 0)
const;
297 std::vector<float> photonEnergy(
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 CherenkovParticleIDCollection& 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 CherenkovParticleIDObj({
static_cast<int>(m_storage.entries.size()), m_collectionID}, {std::forward<Args>(args)...});
320 m_storage.entries.push_back(obj);
324 obj->m_hypotheses =
new std::vector<edm4eic::CherenkovParticleIDHypothesis>();
325 obj->m_thetaPhiPhotons =
new std::vector<edm4hep::Vector2f>();
326 m_storage.createRelations(obj);
330#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
340#if defined(__clang__)
341 #pragma clang diagnostic push
342 #pragma clang diagnostic ignored "-Wunknown-warning-option"
343 #pragma clang diagnostic ignored "-Wdeprecated-redundant-constexpr-static-def"
344 #pragma clang diagnostic ignored "-Wdeprecated"
348 #pragma clang diagnostic pop
349#elif defined(__GNUC__)
350 #pragma GCC diagnostic push
351 #pragma GCC diagnostic ignored "-Wdeprecated"
355 #pragma GCC diagnostic pop
Definition CherenkovParticleIDCollectionData.h:33
Definition CherenkovParticleIDCollection.h:138
void push_back(const MutableCherenkovParticleID &object)
Append object to the collection.
Definition CherenkovParticleIDCollection.cc:124
const_reverse_iterator crbegin() const
Definition CherenkovParticleIDCollection.h:281
const_reverse_iterator rend() const
Definition CherenkovParticleIDCollection.h:287
static constexpr std::string_view valueTypeName
Definition CherenkovParticleIDCollection.h:161
reverse_iterator rend()
Definition CherenkovParticleIDCollection.h:284
void clear() final
Definition CherenkovParticleIDCollection.cc:91
std::reverse_iterator< iterator > reverse_iterator
Definition CherenkovParticleIDCollection.h:147
const_iterator begin() const
Definition CherenkovParticleIDCollection.h:259
const_iterator end() const
Definition CherenkovParticleIDCollection.h:268
bool isValid() const final
Definition CherenkovParticleIDCollection.h:249
CherenkovParticleIDCollection & operator=(CherenkovParticleIDCollection &&)=default
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 CherenkovParticleIDCollection.h:167
void prepareForWrite() const final
Definition CherenkovParticleIDCollection.cc:96
void setID(uint32_t ID) final
Definition CherenkovParticleIDCollection.h:228
uint32_t getID() const final
Definition CherenkovParticleIDCollection.h:237
podio::CollectionWriteBuffers getBuffers() final
Get the collection buffers for this collection.
Definition CherenkovParticleIDCollection.cc:156
const_reverse_iterator rbegin() const
Definition CherenkovParticleIDCollection.h:278
const_iterator cbegin() const
Definition CherenkovParticleIDCollection.h:262
const_reverse_iterator crend() const
Definition CherenkovParticleIDCollection.h:290
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:140
void print(std::ostream &os=std::cout, bool flush=true) const final
Print this collection to the passed stream.
Definition CherenkovParticleIDCollection.cc:474
bool setReferences(const podio::ICollectionProvider *collectionProvider) final
Definition CherenkovParticleIDCollection.cc:120
CherenkovParticleIDMutableCollectionIterator iterator
Definition CherenkovParticleIDCollection.h:143
const std::string_view getDataTypeName() const final
fully qualified type name of stored POD elements - with namespace
Definition CherenkovParticleIDCollection.h:196
static constexpr std::string_view dataTypeName
Definition CherenkovParticleIDCollection.h:162
std::reverse_iterator< const_iterator > const_reverse_iterator
Definition CherenkovParticleIDCollection.h:146
const std::string_view getValueTypeName() const final
fully qualified type name of elements - with namespace
Definition CherenkovParticleIDCollection.h:194
const std::string_view getTypeName() const final
fully qualified type name
Definition CherenkovParticleIDCollection.h:192
MutableCherenkovParticleID create()
Append a new object to the collection, and return this object.
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:256
static constexpr std::string_view typeName
Definition CherenkovParticleIDCollection.h:160
const_iterator cend() const
Definition CherenkovParticleIDCollection.h:271
size_t size_type
Definition CherenkovParticleIDCollection.h:145
ptrdiff_t difference_type
Definition CherenkovParticleIDCollection.h:144
bool isSubsetCollection() const final
Definition CherenkovParticleIDCollection.h:200
CherenkovParticleIDCollectionIterator const_iterator
Definition CherenkovParticleIDCollection.h:142
podio::SchemaVersionT getSchemaVersion() const final
schema version
Definition CherenkovParticleIDCollection.cc:195
iterator end()
Definition CherenkovParticleIDCollection.h:265
MutableCherenkovParticleID mutable_type
Definition CherenkovParticleIDCollection.h:141
CherenkovParticleIDCollection & operator=(const CherenkovParticleIDCollection &)=delete
bool empty() const final
Is the collection empty.
Definition CherenkovParticleIDCollection.cc:64
friend class CherenkovParticleIDCollectionData
Definition CherenkovParticleIDCollection.h:303
bool hasID() const final
check if the collection has a valid ID
Definition CherenkovParticleIDCollection.h:242
reverse_iterator rbegin()
Definition CherenkovParticleIDCollection.h:275
Definition CherenkovParticleIDCollection.h:37
ptrdiff_t difference_type
Definition CherenkovParticleIDCollection.h:40
CherenkovParticleIDCollectionIterator operator+(difference_type n) const
Definition CherenkovParticleIDCollection.cc:339
CherenkovParticleID reference
Definition CherenkovParticleIDCollection.h:41
CherenkovParticleIDCollectionIterator & operator+=(difference_type n)
Definition CherenkovParticleIDCollection.cc:334
CherenkovParticleIDCollectionIterator & operator-=(difference_type n)
Definition CherenkovParticleIDCollection.cc:349
CherenkovParticleIDCollectionIterator(const CherenkovParticleIDCollectionIterator &)=default
bool operator==(const CherenkovParticleIDCollectionIterator &x) const
Definition CherenkovParticleIDCollection.h:61
CherenkovParticleID value_type
Definition CherenkovParticleIDCollection.h:39
~CherenkovParticleIDCollectionIterator()=default
CherenkovParticleIDCollectionIterator(CherenkovParticleIDCollectionIterator &&)=default
auto operator<=>(const CherenkovParticleIDCollectionIterator &other) const
Definition CherenkovParticleIDCollection.h:57
pointer operator->()
Definition CherenkovParticleIDCollection.cc:307
CherenkovParticleIDCollectionIterator(size_t index, const CherenkovParticleIDObjPointerContainer *collection)
Definition CherenkovParticleIDCollection.h:48
reference operator[](difference_type n) const
Definition CherenkovParticleIDCollection.cc:360
CherenkovParticleIDCollectionIterator & operator++()
Definition CherenkovParticleIDCollection.cc:312
CherenkovParticleIDCollectionIterator & operator=(CherenkovParticleIDCollectionIterator &&)=default
CherenkovParticleIDCollectionIterator & operator--()
Definition CherenkovParticleIDCollection.cc:323
CherenkovParticleIDCollectionIterator operator-(difference_type n) const
Definition CherenkovParticleIDCollection.cc:354
CherenkovParticleIDCollectionIterator()=default
reference operator*() const
Definition CherenkovParticleIDCollection.cc:303
std::random_access_iterator_tag iterator_concept
Definition CherenkovParticleIDCollection.h:46
std::input_iterator_tag iterator_category
Definition CherenkovParticleIDCollection.h:43
CherenkovParticleID * pointer
Definition CherenkovParticleIDCollection.h:42
CherenkovParticleIDCollectionIterator & operator=(const CherenkovParticleIDCollectionIterator &)=default
Definition CherenkovParticleID.h:46
Definition CherenkovParticleIDCollection.h:86
CherenkovParticleIDMutableCollectionIterator & operator++()
Definition CherenkovParticleIDCollection.cc:379
CherenkovParticleID value_type
Definition CherenkovParticleIDCollection.h:88
MutableCherenkovParticleID * pointer
Definition CherenkovParticleIDCollection.h:91
std::random_access_iterator_tag iterator_concept
Definition CherenkovParticleIDCollection.h:95
CherenkovParticleIDMutableCollectionIterator & operator=(CherenkovParticleIDMutableCollectionIterator &&)=default
CherenkovParticleIDMutableCollectionIterator(const CherenkovParticleIDMutableCollectionIterator &)=default
bool operator==(const CherenkovParticleIDMutableCollectionIterator &x) const
Definition CherenkovParticleIDCollection.h:110
CherenkovParticleIDMutableCollectionIterator operator+(difference_type n) const
Definition CherenkovParticleIDCollection.cc:406
CherenkovParticleIDMutableCollectionIterator(size_t index, const CherenkovParticleIDObjPointerContainer *collection)
Definition CherenkovParticleIDCollection.h:97
pointer operator->()
Definition CherenkovParticleIDCollection.cc:374
CherenkovParticleIDMutableCollectionIterator & operator--()
Definition CherenkovParticleIDCollection.cc:390
MutableCherenkovParticleID reference
Definition CherenkovParticleIDCollection.h:90
reference operator*() const
Definition CherenkovParticleIDCollection.cc:370
~CherenkovParticleIDMutableCollectionIterator()=default
reference operator[](difference_type n) const
Definition CherenkovParticleIDCollection.cc:427
ptrdiff_t difference_type
Definition CherenkovParticleIDCollection.h:89
CherenkovParticleIDMutableCollectionIterator & operator+=(difference_type n)
Definition CherenkovParticleIDCollection.cc:401
CherenkovParticleIDMutableCollectionIterator operator-(difference_type n) const
Definition CherenkovParticleIDCollection.cc:421
CherenkovParticleIDMutableCollectionIterator()=default
CherenkovParticleIDMutableCollectionIterator & operator-=(difference_type n)
Definition CherenkovParticleIDCollection.cc:416
CherenkovParticleIDMutableCollectionIterator(CherenkovParticleIDMutableCollectionIterator &&)=default
auto operator<=>(const CherenkovParticleIDMutableCollectionIterator &other) const
Definition CherenkovParticleIDCollection.h:106
std::input_iterator_tag iterator_category
Definition CherenkovParticleIDCollection.h:92
CherenkovParticleIDMutableCollectionIterator & operator=(const CherenkovParticleIDMutableCollectionIterator &)=default
Definition CherenkovParticleIDObj.h:26
std::vector< edm4eic::MCRecoTrackerHitAssociation > * m_rawHitAssociations
Definition CherenkovParticleIDObj.h:43
Definition MutableCherenkovParticleID.h:38
Definition CalorimeterHit.cc:17
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