Go to the documentation of this file.
3 #ifndef EICD_ProtoClusterCollection_H
4 #define EICD_ProtoClusterCollection_H
12 #include "podio/ICollectionProvider.h"
13 #include "podio/CollectionBase.h"
14 #include "podio/CollectionIDTable.h"
37 return m_index != x.m_index;
59 return m_index != x.m_index;
88 void clear() override final;
98 template<
typename... Args>
102 size_t size() const override final;
122 void setBuffer(
void* address) override final;
123 bool setReferences(const podio::ICollectionProvider* collectionProvider) override final;
127 podio::VectorMembersInfo*
vectorMembers()
override {
return &m_vecmem_info; }
129 void setID(
unsigned ID)
override final {
131 std::for_each(m_entries.begin(),m_entries.end(),
132 [ID] (
ProtoClusterObj* obj) { obj->id = {obj->id.index, static_cast<int>(ID)}; }
137 unsigned getID() const override final {
138 return m_collectionID;
153 return iterator(m_entries.size(), &m_entries);
163 std::vector<ProtoClusterData>*
_getBuffer() {
return m_data; }
165 template<
size_t arraysize>
166 const std::array<eic::Index, arraysize> hitID()
const;
167 template<
size_t arraysize>
168 const std::array<eic::Index, arraysize> clusterID()
const;
169 template<
size_t arraysize>
170 const std::array<eic::Weight, arraysize> weight()
const;
173 bool m_isValid{
false};
174 bool m_isReadFromFile{
false};
175 int m_collectionID{0};
182 podio::CollRefCollection m_refCollections{};
183 podio::VectorMembersInfo m_vecmem_info{};
187 std::ostream&
operator<<(std::ostream& o,
const ProtoClusterCollection& v);
189 template<
typename... Args>
191 const int size = m_entries.size();
193 m_entries.push_back(obj);
197 template<
size_t arraysize>
198 const std::array<eic::Index, arraysize> ProtoClusterCollection::hitID()
const {
199 std::array<eic::Index, arraysize> tmp;
200 const auto valid_size = std::min(arraysize, m_entries.size());
201 for (
unsigned i = 0; i < valid_size; ++i) {
202 tmp[i] = m_entries[i]->data.hitID;
207 template<
size_t arraysize>
208 const std::array<eic::Index, arraysize> ProtoClusterCollection::clusterID()
const {
209 std::array<eic::Index, arraysize> tmp;
210 const auto valid_size = std::min(arraysize, m_entries.size());
211 for (
unsigned i = 0; i < valid_size; ++i) {
212 tmp[i] = m_entries[i]->data.clusterID;
217 template<
size_t arraysize>
218 const std::array<eic::Weight, arraysize> ProtoClusterCollection::weight()
const {
219 std::array<eic::Weight, arraysize> tmp;
220 const auto valid_size = std::min(arraysize, m_entries.size());
221 for (
unsigned i = 0; i < valid_size; ++i) {
222 tmp[i] = m_entries[i]->data.weight;
std::ostream & operator<<(std::ostream &o, const ConstBasicParticle &value)
Definition: BasicParticle.cc:102
ProtoClusterCollection()
Definition: ProtoClusterCollection.cc:13
podio::CollRefCollection * referenceCollections() override final
Definition: ProtoClusterCollection.h:125
void setBuffer(void *address) override final
Definition: ProtoClusterCollection.cc:101
~ProtoClusterCollection()
Definition: ProtoClusterCollection.cc:18
ProtoClusterCollection & operator=(const ProtoClusterCollection &)=delete
ProtoClusterCollectionIterator(size_t index, const ProtoClusterObjPointerContainer *collection)
Definition: ProtoClusterCollection.h:31
Definition: ProtoClusterCollection.h:51
ProtoClusterConstCollectionIterator(size_t index, const ProtoClusterObjPointerContainer *collection)
Definition: ProtoClusterCollection.h:53
unsigned getID() const override final
Definition: ProtoClusterCollection.h:137
ProtoClusterConstCollectionIterator(const ProtoClusterConstCollectionIterator &)=delete
bool operator!=(const ProtoClusterCollectionIterator &x) const
Definition: ProtoClusterCollection.h:36
podio::VectorMembersInfo * vectorMembers() override
Definition: ProtoClusterCollection.h:127
void setID(unsigned ID) override final
Definition: ProtoClusterCollection.h:129
void clear() override final
Definition: ProtoClusterCollection.cc:50
Definition: BasicParticle.cc:13
bool setReferences(const podio::ICollectionProvider *collectionProvider) override final
Definition: ProtoClusterCollection.cc:84
ConstProtoCluster operator[](unsigned int index) const
Returns the const object of given index.
Definition: ProtoClusterCollection.cc:23
Definition: ProtoCluster.h:23
Definition: ProtoClusterConst.h:21
ProtoClusterCollection(const ProtoClusterCollection &)=delete
iterator end()
Definition: ProtoClusterCollection.h:152
std::deque< ProtoClusterObj * > ProtoClusterObjPointerContainer
Definition: ProtoClusterCollection.h:27
size_t size() const override final
number of elements in the collection
Definition: ProtoClusterCollection.cc:39
std::vector< ProtoClusterData > ProtoClusterDataContainer
Definition: ProtoClusterCollection.h:26
Definition: ProtoClusterCollection.h:29
void prepareAfterRead() override final
Definition: ProtoClusterCollection.cc:69
Definition: ProtoClusterCollection.h:76
ConstProtoCluster * operator->()
Definition: ProtoClusterCollection.cc:128
bool operator!=(const ProtoClusterConstCollectionIterator &x) const
Definition: ProtoClusterCollection.h:58
iterator begin()
Definition: ProtoClusterCollection.h:146
ProtoCluster * operator->()
Definition: ProtoClusterCollection.cc:111
void * getBufferAddress() override final
returns the address of the pointer to the data buffer
Definition: ProtoClusterCollection.h:160
Definition: ProtoClusterObj.h:18
ConstProtoCluster operator*()
Definition: ProtoClusterCollection.cc:123
bool isValid() const override final
Definition: ProtoClusterCollection.h:141
ProtoClusterCollectionIterator & operator++()
Definition: ProtoClusterCollection.cc:116
ProtoClusterCollectionIterator(const ProtoClusterCollectionIterator &)=delete
ProtoCluster operator*()
Definition: ProtoClusterCollection.cc:106
const_iterator begin() const
Definition: ProtoClusterCollection.h:149
ProtoClusterCollectionIterator & operator=(const ProtoClusterCollectionIterator &)=delete
ProtoClusterConstCollectionIterator & operator=(const ProtoClusterConstCollectionIterator &)=delete
void prepareForWrite() override final
Definition: ProtoClusterCollection.cc:56
const_iterator end() const
Definition: ProtoClusterCollection.h:155
ProtoCluster create()
Append a new object to the collection, and return this object.
Definition: ProtoClusterCollection.cc:43
void push_back(ConstProtoCluster object)
Append object to the collection.
Definition: ProtoClusterCollection.cc:89
std::vector< ProtoClusterData > * _getBuffer()
Returns the pointer to the data buffer.
Definition: ProtoClusterCollection.h:163
ProtoClusterConstCollectionIterator & operator++()
Definition: ProtoClusterCollection.cc:133
std::string getValueTypeName() const override
fully qualified type name of elements - with namespace
Definition: ProtoClusterCollection.h:105
ConstProtoCluster at(unsigned int index) const
Returns the const object of given index.
Definition: ProtoClusterCollection.cc:27