3#ifndef EDM4EIC_TrackParametersCollection_H
4#define EDM4EIC_TrackParametersCollection_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"
45 return m_index != x.m_index;
49 return m_index == x.m_index;
71 return m_index != x.m_index;
75 return m_index == x.m_index;
111 constexpr static auto typeName =
"edm4eic::TrackParametersCollection";
118 void print(std::ostream& os=std::cout,
bool flush=true) const final;
128 template<
typename... Args>
132 std::size_t
size() const final;
138 bool empty() const final;
150 return m_isSubsetColl;
179 if (!m_isSubsetColl) {
181 [ID] (
TrackParametersObj* obj) { obj->id = {obj->id.index, static_cast<uint32_t>(ID)}; }
188 return m_collectionID;
195 size_t getDatamodelRegistryIndex() const final;
199 return iterator(0, &m_storage.entries);
208 return iterator(m_storage.entries.size(), &m_storage.entries);
211 return const_iterator(m_storage.entries.size(), &m_storage.entries);
217 std::vector<std::int32_t> type(
const size_t nElem = 0)
const;
218 std::vector<std::uint64_t> surface(
const size_t nElem = 0)
const;
219 std::vector<edm4hep::Vector2f> loc(
const size_t nElem = 0)
const;
220 std::vector<float> theta(
const size_t nElem = 0)
const;
221 std::vector<float> phi(
const size_t nElem = 0)
const;
222 std::vector<float> qOverP(
const size_t nElem = 0)
const;
223 std::vector<float> time(
const size_t nElem = 0)
const;
224 std::vector<std::int32_t> pdg(
const size_t nElem = 0)
const;
225 std::vector<edm4eic::Cov6f> covariance(
const size_t nElem = 0)
const;
233 bool m_isValid{
false};
234 mutable bool m_isPrepared{
false};
235 bool m_isSubsetColl{
false};
236 uint32_t m_collectionID{0};
237 mutable std::unique_ptr<std::mutex> m_storageMtx{
nullptr};
238 mutable TrackParametersCollectionData m_storage{};
241std::ostream&
operator<<(std::ostream& o,
const TrackParametersCollection& v);
243template<
typename... Args>
245 if (m_isSubsetColl) {
246 throw std::logic_error(
"Cannot create new elements on a subset collection");
248 const int size = m_storage.entries.size();
249 auto obj =
new TrackParametersObj({size, m_collectionID}, {std::forward<Args>(args)...});
250 m_storage.entries.push_back(obj);
255#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
Definition MutableTrackParameters.h:31
Definition TrackParametersCollectionData.h:30
TrackParametersObjPointerContainer entries
Definition TrackParametersCollectionData.h:35
Definition TrackParametersCollection.h:92
TrackParametersCollection(const TrackParametersCollection &)=delete
podio::CollectionWriteBuffers getBuffers() final
Get the collection buffers for this collection.
Definition TrackParametersCollection.cc:160
void prepareAfterRead() final
Definition TrackParametersCollection.cc:109
static constexpr auto typeName
Definition TrackParametersCollection.h:111
void clear() final
Definition TrackParametersCollection.cc:83
void prepareForWrite() const final
Definition TrackParametersCollection.cc:88
static constexpr auto dataTypeName
Definition TrackParametersCollection.h:113
TrackParametersCollection(TrackParametersCollection &&)=default
size_t size_type
Definition TrackParametersCollection.h:98
const_iterator cbegin() const
Definition TrackParametersCollection.h:204
const std::string_view getDataTypeName() const final
fully qualified type name of stored POD elements - with namespace
Definition TrackParametersCollection.h:145
bool setReferences(const podio::ICollectionProvider *collectionProvider) final
Definition TrackParametersCollection.cc:124
TrackParametersCollection & operator=(const TrackParametersCollection &)=delete
bool isValid() const final
Definition TrackParametersCollection.h:191
void push_back(const MutableTrackParameters &object)
Append object to the collection.
Definition TrackParametersCollection.cc:128
const_iterator cend() const
Definition TrackParametersCollection.h:213
TrackParametersCollection & operator=(TrackParametersCollection &&)=default
void print(std::ostream &os=std::cout, bool flush=true) const final
Print this collection to the passed stream.
Definition TrackParametersCollection.cc:422
std::size_t size() const final
number of elements in the collection
Definition TrackParametersCollection.cc:49
uint32_t getID() const final
Definition TrackParametersCollection.h:187
ptrdiff_t difference_type
Definition TrackParametersCollection.h:97
bool empty() const final
Is the collection empty.
Definition TrackParametersCollection.cc:57
const std::string_view getValueTypeName() const final
fully qualified type name of elements - with namespace
Definition TrackParametersCollection.h:143
const_iterator begin() const
Definition TrackParametersCollection.h:201
iterator end()
Definition TrackParametersCollection.h:207
MutableTrackParameters create()
Append a new object to the collection, and return this object.
Definition TrackParametersCollection.cc:72
podio::SchemaVersionT getSchemaVersion() const final
schema version
Definition TrackParametersCollection.cc:259
bool isSubsetCollection() const final
Definition TrackParametersCollection.h:149
TrackParameters at(std::size_t index) const
Returns the const object of given index.
Definition TrackParametersCollection.cc:37
std::size_t max_size() const final
maximal number of elements in the collection
Definition TrackParametersCollection.cc:53
const_iterator end() const
Definition TrackParametersCollection.h:210
void setID(uint32_t ID) final
Definition TrackParametersCollection.h:177
const std::string_view getTypeName() const final
fully qualified type name
Definition TrackParametersCollection.h:141
void setSubsetCollection(bool setSubset=true) final
Definition TrackParametersCollection.cc:61
static constexpr auto valueTypeName
Definition TrackParametersCollection.h:112
TrackParametersCollection()
Definition TrackParametersCollection.cc:22
~TrackParametersCollection()
Definition TrackParametersCollection.cc:28
Definition TrackParametersCollection.h:37
TrackParametersCollectionIterator & operator=(const TrackParametersCollectionIterator &)=delete
TrackParametersCollectionIterator(size_t index, const TrackParametersObjPointerContainer *collection)
Definition TrackParametersCollection.h:39
TrackParametersCollectionIterator(const TrackParametersCollectionIterator &)=delete
TrackParameters * operator->()
Definition TrackParametersCollection.cc:367
TrackParameters operator*()
Definition TrackParametersCollection.cc:362
bool operator==(const TrackParametersCollectionIterator &x) const
Definition TrackParametersCollection.h:48
bool operator!=(const TrackParametersCollectionIterator &x) const
Definition TrackParametersCollection.h:44
TrackParametersCollectionIterator & operator++()
Definition TrackParametersCollection.cc:372
Definition TrackParameters.h:33
Definition TrackParametersCollection.h:63
TrackParametersMutableCollectionIterator & operator=(const TrackParametersMutableCollectionIterator &)=delete
TrackParametersMutableCollectionIterator & operator++()
Definition TrackParametersCollection.cc:389
MutableTrackParameters operator*()
Definition TrackParametersCollection.cc:379
bool operator!=(const TrackParametersMutableCollectionIterator &x) const
Definition TrackParametersCollection.h:70
MutableTrackParameters * operator->()
Definition TrackParametersCollection.cc:384
TrackParametersMutableCollectionIterator(const TrackParametersMutableCollectionIterator &)=delete
TrackParametersMutableCollectionIterator(size_t index, const TrackParametersObjPointerContainer *collection)
Definition TrackParametersCollection.h:65
bool operator==(const TrackParametersMutableCollectionIterator &x) const
Definition TrackParametersCollection.h:74
Definition TrackParametersObj.h:17
Definition CalorimeterHit.cc:17
std::ostream & operator<<(std::ostream &o, const CalorimeterHit &value)
Definition CalorimeterHit.cc:103
std::deque< TrackParametersObj * > TrackParametersObjPointerContainer
Definition TrackParametersCollectionData.h:22
Definition CalorimeterHitCollection.h:29