3#ifndef EDM4EIC_TrackSegmentCollection_H
4#define EDM4EIC_TrackSegmentCollection_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 TrackSegment m_object { podio::utils::MaybeSharedPtr<TrackSegmentObj>{
nullptr} };
106 return m_index <=> other.m_index;
110 return m_index == x.m_index;
129 MutableTrackSegment m_object { podio::utils::MaybeSharedPtr<TrackSegmentObj>{
nullptr} };
159 constexpr static std::string_view
typeName =
"edm4eic::TrackSegmentCollection";
161 constexpr static std::string_view
dataTypeName =
"edm4eic::TrackSegmentData";
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(),
229 [ID] (
TrackSegmentObj* obj) { obj->id = {obj->id.index, static_cast<uint32_t>(ID)}; }
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> length(
const size_t nElem = 0)
const;
286 std::vector<float> lengthError(
const size_t nElem = 0)
const;
294 bool m_isValid{
false};
295 mutable bool m_isPrepared{
false};
296 bool m_isSubsetColl{
false};
297 uint32_t m_collectionID{0};
298 mutable std::unique_ptr<std::mutex> m_storageMtx{
nullptr};
302std::ostream&
operator<<(std::ostream& o,
const TrackSegmentCollection& v);
304template<
typename... Args>
306 if (m_isSubsetColl) {
307 throw std::logic_error(
"Cannot create new elements on a subset collection");
309 const int size = m_storage.entries.size();
311 m_storage.entries.push_back(obj);
314 obj->
m_points =
new std::vector<edm4eic::TrackPoint>();
315 m_storage.createRelations(obj);
319#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
Definition MutableTrackSegment.h:37
Definition TrackSegmentCollectionData.h:31
Definition TrackSegmentCollection.h:137
void push_back(const MutableTrackSegment &object)
Append object to the collection.
Definition TrackSegmentCollection.cc:126
reverse_iterator rend()
Definition TrackSegmentCollection.h:274
std::size_t size() const final
number of elements in the collection
Definition TrackSegmentCollection.cc:52
const_iterator begin() const
Definition TrackSegmentCollection.h:249
TrackSegmentCollection & operator=(TrackSegmentCollection &&)=default
reverse_iterator rbegin()
Definition TrackSegmentCollection.h:265
const std::string_view getTypeName() const final
fully qualified type name
Definition TrackSegmentCollection.h:189
const_iterator cbegin() const
Definition TrackSegmentCollection.h:252
const_reverse_iterator crbegin() const
Definition TrackSegmentCollection.h:271
const_reverse_iterator crend() const
Definition TrackSegmentCollection.h:280
void clear() final
Definition TrackSegmentCollection.cc:93
iterator end()
Definition TrackSegmentCollection.h:255
static constexpr std::string_view valueTypeName
Definition TrackSegmentCollection.h:160
std::reverse_iterator< const_iterator > const_reverse_iterator
Definition TrackSegmentCollection.h:145
~TrackSegmentCollection() override
Definition TrackSegmentCollection.cc:31
void setID(uint32_t ID) final
Definition TrackSegmentCollection.h:225
TrackSegment at(std::size_t index) const
Returns the const object of given index.
Definition TrackSegmentCollection.cc:40
TrackSegmentMutableCollectionIterator iterator
Definition TrackSegmentCollection.h:142
const_iterator cend() const
Definition TrackSegmentCollection.h:261
static constexpr std::string_view typeName
Definition TrackSegmentCollection.h:159
TrackSegmentCollection(const TrackSegmentCollection &)=delete
TrackSegmentCollection(TrackSegmentCollection &&)=default
void print(std::ostream &os=std::cout, bool flush=true) const final
Print this collection to the passed stream.
Definition TrackSegmentCollection.cc:454
bool isValid() const final
Definition TrackSegmentCollection.h:239
void setSubsetCollection(bool setSubset=true) final
Definition TrackSegmentCollection.cc:70
MutableTrackSegment mutable_type
Definition TrackSegmentCollection.h:140
void prepareForWrite() const final
Definition TrackSegmentCollection.cc:98
const_iterator end() const
Definition TrackSegmentCollection.h:258
const_reverse_iterator rend() const
Definition TrackSegmentCollection.h:277
TrackSegmentCollection()
Definition TrackSegmentCollection.cc:25
podio::CollectionWriteBuffers getBuffers() final
Get the collection buffers for this collection.
Definition TrackSegmentCollection.cc:159
iterator begin()
Definition TrackSegmentCollection.h:246
const std::string_view getDataTypeName() const final
fully qualified type name of stored POD elements - with namespace
Definition TrackSegmentCollection.h:193
bool empty() const final
Is the collection empty.
Definition TrackSegmentCollection.cc:66
bool isSubsetCollection() const final
Definition TrackSegmentCollection.h:197
std::size_t max_size() const final
maximal number of elements in the collection
Definition TrackSegmentCollection.cc:56
MutableTrackSegment create()
Append a new object to the collection, and return this object.
Definition TrackSegmentCollection.cc:81
TrackSegment value_type
Definition TrackSegmentCollection.h:139
TrackSegmentCollection & operator=(const TrackSegmentCollection &)=delete
size_t size_type
Definition TrackSegmentCollection.h:144
friend class TrackSegmentCollectionData
Definition TrackSegmentCollection.h:292
bool setReferences(const podio::ICollectionProvider *collectionProvider) final
Definition TrackSegmentCollection.cc:122
void prepareAfterRead() final
Definition TrackSegmentCollection.cc:107
const std::string_view getValueTypeName() const final
fully qualified type name of elements - with namespace
Definition TrackSegmentCollection.h:191
std::reverse_iterator< iterator > reverse_iterator
Definition TrackSegmentCollection.h:146
static constexpr std::string_view dataTypeName
Definition TrackSegmentCollection.h:161
const_reverse_iterator rbegin() const
Definition TrackSegmentCollection.h:268
ptrdiff_t difference_type
Definition TrackSegmentCollection.h:143
TrackSegmentCollectionIterator const_iterator
Definition TrackSegmentCollection.h:141
podio::SchemaVersionT getSchemaVersion() const final
schema version
Definition TrackSegmentCollection.cc:188
uint32_t getID() const final
Definition TrackSegmentCollection.h:235
Definition TrackSegmentCollection.h:36
ptrdiff_t difference_type
Definition TrackSegmentCollection.h:39
TrackSegment * pointer
Definition TrackSegmentCollection.h:41
TrackSegmentCollectionIterator operator+(difference_type n) const
Definition TrackSegmentCollection.cc:330
TrackSegmentCollectionIterator & operator--()
Definition TrackSegmentCollection.cc:314
~TrackSegmentCollectionIterator()=default
TrackSegmentCollectionIterator operator-(difference_type n) const
Definition TrackSegmentCollection.cc:345
TrackSegmentCollectionIterator & operator=(TrackSegmentCollectionIterator &&)=default
TrackSegmentCollectionIterator(const TrackSegmentCollectionIterator &)=default
TrackSegmentCollectionIterator(size_t index, const TrackSegmentObjPointerContainer *collection)
Definition TrackSegmentCollection.h:47
std::input_iterator_tag iterator_category
Definition TrackSegmentCollection.h:42
TrackSegmentCollectionIterator & operator-=(difference_type n)
Definition TrackSegmentCollection.cc:340
TrackSegment reference
Definition TrackSegmentCollection.h:40
reference operator[](difference_type n) const
Definition TrackSegmentCollection.cc:351
TrackSegmentCollectionIterator & operator++()
Definition TrackSegmentCollection.cc:303
pointer operator->()
Definition TrackSegmentCollection.cc:298
TrackSegmentCollectionIterator & operator+=(difference_type n)
Definition TrackSegmentCollection.cc:325
TrackSegmentCollectionIterator & operator=(const TrackSegmentCollectionIterator &)=default
std::random_access_iterator_tag iterator_concept
Definition TrackSegmentCollection.h:45
auto operator<=>(const TrackSegmentCollectionIterator &other) const
Definition TrackSegmentCollection.h:56
TrackSegmentCollectionIterator(TrackSegmentCollectionIterator &&)=default
bool operator==(const TrackSegmentCollectionIterator &x) const
Definition TrackSegmentCollection.h:60
reference operator*() const
Definition TrackSegmentCollection.cc:294
TrackSegmentCollectionIterator()=default
TrackSegment value_type
Definition TrackSegmentCollection.h:38
Definition TrackSegment.h:45
Definition TrackSegmentCollection.h:85
bool operator==(const TrackSegmentMutableCollectionIterator &x) const
Definition TrackSegmentCollection.h:109
std::input_iterator_tag iterator_category
Definition TrackSegmentCollection.h:91
TrackSegmentMutableCollectionIterator operator-(difference_type n) const
Definition TrackSegmentCollection.cc:412
TrackSegmentMutableCollectionIterator(TrackSegmentMutableCollectionIterator &&)=default
TrackSegmentMutableCollectionIterator()=default
MutableTrackSegment reference
Definition TrackSegmentCollection.h:89
TrackSegmentMutableCollectionIterator(size_t index, const TrackSegmentObjPointerContainer *collection)
Definition TrackSegmentCollection.h:96
pointer operator->()
Definition TrackSegmentCollection.cc:365
TrackSegment value_type
Definition TrackSegmentCollection.h:87
~TrackSegmentMutableCollectionIterator()=default
TrackSegmentMutableCollectionIterator(const TrackSegmentMutableCollectionIterator &)=default
ptrdiff_t difference_type
Definition TrackSegmentCollection.h:88
MutableTrackSegment * pointer
Definition TrackSegmentCollection.h:90
reference operator*() const
Definition TrackSegmentCollection.cc:361
TrackSegmentMutableCollectionIterator & operator++()
Definition TrackSegmentCollection.cc:370
auto operator<=>(const TrackSegmentMutableCollectionIterator &other) const
Definition TrackSegmentCollection.h:105
TrackSegmentMutableCollectionIterator & operator=(const TrackSegmentMutableCollectionIterator &)=default
std::random_access_iterator_tag iterator_concept
Definition TrackSegmentCollection.h:94
TrackSegmentMutableCollectionIterator operator+(difference_type n) const
Definition TrackSegmentCollection.cc:397
TrackSegmentMutableCollectionIterator & operator=(TrackSegmentMutableCollectionIterator &&)=default
TrackSegmentMutableCollectionIterator & operator--()
Definition TrackSegmentCollection.cc:381
TrackSegmentMutableCollectionIterator & operator-=(difference_type n)
Definition TrackSegmentCollection.cc:407
TrackSegmentMutableCollectionIterator & operator+=(difference_type n)
Definition TrackSegmentCollection.cc:392
reference operator[](difference_type n) const
Definition TrackSegmentCollection.cc:418
Definition TrackSegmentObj.h:24
std::vector< edm4eic::TrackPoint > * m_points
Definition TrackSegmentObj.h:41
Definition CalorimeterHit.cc:17
std::deque< TrackSegmentObj * > TrackSegmentObjPointerContainer
Definition TrackSegmentCollectionData.h:23
std::ostream & operator<<(std::ostream &o, const CalorimeterHit &value)
Definition CalorimeterHit.cc:103
Definition CalorimeterHit.h:31