3#ifndef EDM4EIC_CherenkovParticleIDCollection_H
4#define EDM4EIC_CherenkovParticleIDCollection_H
13#include "podio/ICollectionProvider.h"
14#include "podio/CollectionBase.h"
16#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
17#include "nlohmann/json_fwd.hpp"
57 return m_index <=> other.m_index;
61 return m_index == x.m_index;
80 CherenkovParticleID m_object { podio::utils::MaybeSharedPtr<CherenkovParticleIDObj>{
nullptr} };
106 return m_index <=> other.m_index;
110 return m_index == x.m_index;
129 MutableCherenkovParticleID m_object { podio::utils::MaybeSharedPtr<CherenkovParticleIDObj>{
nullptr} };
159 constexpr static std::string_view
typeName =
"edm4eic::CherenkovParticleIDCollection";
160 constexpr static std::string_view
valueTypeName =
"edm4eic::CherenkovParticleID";
161 constexpr static std::string_view
dataTypeName =
"edm4eic::CherenkovParticleIDData";
166 void print(std::ostream& os=std::cout,
bool flush=true) const final;
176 template<
typename... Args>
180 std::size_t
size() const final;
186 bool empty() const final;
198 return m_isSubsetColl;
227 if (!m_isSubsetColl) {
228 std::for_each(m_storage.entries.begin(), m_storage.entries.end(),
236 return m_collectionID;
243 size_t getDatamodelRegistryIndex() const final;
247 return iterator(0, &m_storage.entries);
256 return iterator(m_storage.entries.size(), &m_storage.entries);
259 return const_iterator(m_storage.entries.size(), &m_storage.entries);
285 std::vector<float> npe(
const size_t nElem = 0)
const;
286 std::vector<float> refractiveIndex(
const size_t nElem = 0)
const;
287 std::vector<float> photonEnergy(
const size_t nElem = 0)
const;
295 bool m_isValid{
false};
296 mutable bool m_isPrepared{
false};
297 bool m_isSubsetColl{
false};
298 uint32_t m_collectionID{0};
299 mutable std::unique_ptr<std::mutex> m_storageMtx{
nullptr};
303std::ostream&
operator<<(std::ostream& o,
const CherenkovParticleIDCollection& v);
305template<
typename... Args>
307 if (m_isSubsetColl) {
308 throw std::logic_error(
"Cannot create new elements on a subset collection");
310 const int size = m_storage.entries.size();
312 m_storage.entries.push_back(obj);
316 obj->m_hypotheses =
new std::vector<edm4eic::CherenkovParticleIDHypothesis>();
317 obj->m_thetaPhiPhotons =
new std::vector<edm4hep::Vector2f>();
318 m_storage.createRelations(obj);
322#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
Definition CherenkovParticleIDCollectionData.h:32
Definition CherenkovParticleIDCollection.h:137
void push_back(const MutableCherenkovParticleID &object)
Append object to the collection.
Definition CherenkovParticleIDCollection.cc:127
const_reverse_iterator crbegin() const
Definition CherenkovParticleIDCollection.h:271
const_reverse_iterator rend() const
Definition CherenkovParticleIDCollection.h:277
static constexpr std::string_view valueTypeName
Definition CherenkovParticleIDCollection.h:160
reverse_iterator rend()
Definition CherenkovParticleIDCollection.h:274
void clear() final
Definition CherenkovParticleIDCollection.cc:94
std::reverse_iterator< iterator > reverse_iterator
Definition CherenkovParticleIDCollection.h:146
CherenkovParticleIDCollection()
Definition CherenkovParticleIDCollection.cc:26
const_iterator begin() const
Definition CherenkovParticleIDCollection.h:249
const_iterator end() const
Definition CherenkovParticleIDCollection.h:258
bool isValid() const final
Definition CherenkovParticleIDCollection.h:239
CherenkovParticleIDCollection & operator=(CherenkovParticleIDCollection &&)=default
void prepareForWrite() const final
Definition CherenkovParticleIDCollection.cc:99
void setID(uint32_t ID) final
Definition CherenkovParticleIDCollection.h:225
uint32_t getID() const final
Definition CherenkovParticleIDCollection.h:235
podio::CollectionWriteBuffers getBuffers() final
Get the collection buffers for this collection.
Definition CherenkovParticleIDCollection.cc:160
const_reverse_iterator rbegin() const
Definition CherenkovParticleIDCollection.h:268
const_iterator cbegin() const
Definition CherenkovParticleIDCollection.h:252
const_reverse_iterator crend() const
Definition CherenkovParticleIDCollection.h:280
void setSubsetCollection(bool setSubset=true) final
Definition CherenkovParticleIDCollection.cc:71
std::size_t size() const final
number of elements in the collection
Definition CherenkovParticleIDCollection.cc:53
CherenkovParticleID value_type
Definition CherenkovParticleIDCollection.h:139
void print(std::ostream &os=std::cout, bool flush=true) const final
Print this collection to the passed stream.
Definition CherenkovParticleIDCollection.cc:479
bool setReferences(const podio::ICollectionProvider *collectionProvider) final
Definition CherenkovParticleIDCollection.cc:123
CherenkovParticleIDMutableCollectionIterator iterator
Definition CherenkovParticleIDCollection.h:142
const std::string_view getDataTypeName() const final
fully qualified type name of stored POD elements - with namespace
Definition CherenkovParticleIDCollection.h:193
static constexpr std::string_view dataTypeName
Definition CherenkovParticleIDCollection.h:161
std::reverse_iterator< const_iterator > const_reverse_iterator
Definition CherenkovParticleIDCollection.h:145
const std::string_view getValueTypeName() const final
fully qualified type name of elements - with namespace
Definition CherenkovParticleIDCollection.h:191
const std::string_view getTypeName() const final
fully qualified type name
Definition CherenkovParticleIDCollection.h:189
MutableCherenkovParticleID create()
Append a new object to the collection, and return this object.
Definition CherenkovParticleIDCollection.cc:82
std::size_t max_size() const final
maximal number of elements in the collection
Definition CherenkovParticleIDCollection.cc:57
CherenkovParticleIDCollection(CherenkovParticleIDCollection &&)=default
CherenkovParticleID at(std::size_t index) const
Returns the const object of given index.
Definition CherenkovParticleIDCollection.cc:41
~CherenkovParticleIDCollection() override
Definition CherenkovParticleIDCollection.cc:32
void prepareAfterRead() final
Definition CherenkovParticleIDCollection.cc:108
CherenkovParticleIDCollection(const CherenkovParticleIDCollection &)=delete
iterator begin()
Definition CherenkovParticleIDCollection.h:246
static constexpr std::string_view typeName
Definition CherenkovParticleIDCollection.h:159
const_iterator cend() const
Definition CherenkovParticleIDCollection.h:261
size_t size_type
Definition CherenkovParticleIDCollection.h:144
ptrdiff_t difference_type
Definition CherenkovParticleIDCollection.h:143
bool isSubsetCollection() const final
Definition CherenkovParticleIDCollection.h:197
CherenkovParticleIDCollectionIterator const_iterator
Definition CherenkovParticleIDCollection.h:141
podio::SchemaVersionT getSchemaVersion() const final
schema version
Definition CherenkovParticleIDCollection.cc:199
iterator end()
Definition CherenkovParticleIDCollection.h:255
MutableCherenkovParticleID mutable_type
Definition CherenkovParticleIDCollection.h:140
CherenkovParticleIDCollection & operator=(const CherenkovParticleIDCollection &)=delete
bool empty() const final
Is the collection empty.
Definition CherenkovParticleIDCollection.cc:67
friend class CherenkovParticleIDCollectionData
Definition CherenkovParticleIDCollection.h:293
reverse_iterator rbegin()
Definition CherenkovParticleIDCollection.h:265
Definition CherenkovParticleIDCollection.h:36
ptrdiff_t difference_type
Definition CherenkovParticleIDCollection.h:39
CherenkovParticleIDCollectionIterator operator+(difference_type n) const
Definition CherenkovParticleIDCollection.cc:344
CherenkovParticleID reference
Definition CherenkovParticleIDCollection.h:40
CherenkovParticleIDCollectionIterator & operator+=(difference_type n)
Definition CherenkovParticleIDCollection.cc:339
CherenkovParticleIDCollectionIterator & operator-=(difference_type n)
Definition CherenkovParticleIDCollection.cc:354
CherenkovParticleIDCollectionIterator(const CherenkovParticleIDCollectionIterator &)=default
bool operator==(const CherenkovParticleIDCollectionIterator &x) const
Definition CherenkovParticleIDCollection.h:60
CherenkovParticleID value_type
Definition CherenkovParticleIDCollection.h:38
~CherenkovParticleIDCollectionIterator()=default
CherenkovParticleIDCollectionIterator(CherenkovParticleIDCollectionIterator &&)=default
auto operator<=>(const CherenkovParticleIDCollectionIterator &other) const
Definition CherenkovParticleIDCollection.h:56
pointer operator->()
Definition CherenkovParticleIDCollection.cc:312
CherenkovParticleIDCollectionIterator(size_t index, const CherenkovParticleIDObjPointerContainer *collection)
Definition CherenkovParticleIDCollection.h:47
reference operator[](difference_type n) const
Definition CherenkovParticleIDCollection.cc:365
CherenkovParticleIDCollectionIterator & operator++()
Definition CherenkovParticleIDCollection.cc:317
CherenkovParticleIDCollectionIterator & operator=(CherenkovParticleIDCollectionIterator &&)=default
CherenkovParticleIDCollectionIterator & operator--()
Definition CherenkovParticleIDCollection.cc:328
CherenkovParticleIDCollectionIterator operator-(difference_type n) const
Definition CherenkovParticleIDCollection.cc:359
CherenkovParticleIDCollectionIterator()=default
reference operator*() const
Definition CherenkovParticleIDCollection.cc:308
std::random_access_iterator_tag iterator_concept
Definition CherenkovParticleIDCollection.h:45
std::input_iterator_tag iterator_category
Definition CherenkovParticleIDCollection.h:42
CherenkovParticleID * pointer
Definition CherenkovParticleIDCollection.h:41
CherenkovParticleIDCollectionIterator & operator=(const CherenkovParticleIDCollectionIterator &)=default
Definition CherenkovParticleID.h:46
Definition CherenkovParticleIDCollection.h:85
CherenkovParticleIDMutableCollectionIterator & operator++()
Definition CherenkovParticleIDCollection.cc:384
CherenkovParticleID value_type
Definition CherenkovParticleIDCollection.h:87
MutableCherenkovParticleID * pointer
Definition CherenkovParticleIDCollection.h:90
std::random_access_iterator_tag iterator_concept
Definition CherenkovParticleIDCollection.h:94
CherenkovParticleIDMutableCollectionIterator & operator=(CherenkovParticleIDMutableCollectionIterator &&)=default
CherenkovParticleIDMutableCollectionIterator(const CherenkovParticleIDMutableCollectionIterator &)=default
bool operator==(const CherenkovParticleIDMutableCollectionIterator &x) const
Definition CherenkovParticleIDCollection.h:109
CherenkovParticleIDMutableCollectionIterator operator+(difference_type n) const
Definition CherenkovParticleIDCollection.cc:411
CherenkovParticleIDMutableCollectionIterator(size_t index, const CherenkovParticleIDObjPointerContainer *collection)
Definition CherenkovParticleIDCollection.h:96
pointer operator->()
Definition CherenkovParticleIDCollection.cc:379
CherenkovParticleIDMutableCollectionIterator & operator--()
Definition CherenkovParticleIDCollection.cc:395
MutableCherenkovParticleID reference
Definition CherenkovParticleIDCollection.h:89
reference operator*() const
Definition CherenkovParticleIDCollection.cc:375
~CherenkovParticleIDMutableCollectionIterator()=default
reference operator[](difference_type n) const
Definition CherenkovParticleIDCollection.cc:432
ptrdiff_t difference_type
Definition CherenkovParticleIDCollection.h:88
CherenkovParticleIDMutableCollectionIterator & operator+=(difference_type n)
Definition CherenkovParticleIDCollection.cc:406
CherenkovParticleIDMutableCollectionIterator operator-(difference_type n) const
Definition CherenkovParticleIDCollection.cc:426
CherenkovParticleIDMutableCollectionIterator()=default
CherenkovParticleIDMutableCollectionIterator & operator-=(difference_type n)
Definition CherenkovParticleIDCollection.cc:421
CherenkovParticleIDMutableCollectionIterator(CherenkovParticleIDMutableCollectionIterator &&)=default
auto operator<=>(const CherenkovParticleIDMutableCollectionIterator &other) const
Definition CherenkovParticleIDCollection.h:105
std::input_iterator_tag iterator_category
Definition CherenkovParticleIDCollection.h:91
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:103
std::deque< CherenkovParticleIDObj * > CherenkovParticleIDObjPointerContainer
Definition CherenkovParticleIDCollectionData.h:24
Definition CalorimeterHit.h:31