3#ifndef EDM4EIC_HadronicFinalStateCollection_H
4#define EDM4EIC_HadronicFinalStateCollection_H
14#include "podio/ICollectionProvider.h"
15#include "podio/CollectionBase.h"
16#include "podio/CollectionIDTable.h"
18#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
19#include "nlohmann/json_fwd.hpp"
48 return m_index != x.m_index;
52 return m_index == x.m_index;
74 return m_index != x.m_index;
78 return m_index == x.m_index;
112 constexpr static auto typeName =
"edm4eic::HadronicFinalStateCollection";
114 constexpr static auto dataTypeName =
"edm4eic::HadronicFinalStateData";
119 void print(std::ostream& os=std::cout,
bool flush=true) const final;
129 template<
typename... Args>
133 std::size_t
size() const final;
136 bool empty() const final;
148 return m_isSubsetColl;
177 if (!m_isSubsetColl) {
186 return m_collectionID;
193 size_t getDatamodelRegistryIndex() const final;
197 return iterator(0, &m_storage.entries);
203 return iterator(m_storage.entries.size(), &m_storage.entries);
206 return const_iterator(m_storage.entries.size(), &m_storage.entries);
209 std::vector<float> sigma(
const size_t nElem = 0)
const;
210 std::vector<float> pT(
const size_t nElem = 0)
const;
211 std::vector<float> gamma(
const size_t nElem = 0)
const;
219 bool m_isValid{
false};
220 mutable bool m_isPrepared{
false};
221 bool m_isSubsetColl{
false};
222 uint32_t m_collectionID{0};
223 mutable std::unique_ptr<std::mutex> m_storageMtx{
nullptr};
224 mutable HadronicFinalStateCollectionData m_storage{};
227std::ostream&
operator<<(std::ostream& o,
const HadronicFinalStateCollection& v);
229template<
typename... Args>
231 if (m_isSubsetColl) {
232 throw std::logic_error(
"Cannot create new elements on a subset collection");
234 const int size = m_storage.entries.size();
236 m_storage.entries.push_back(obj);
239 obj->
m_hadrons =
new std::vector<edm4eic::ReconstructedParticle>();
240 m_storage.createRelations(obj);
244#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
Definition HadronicFinalStateCollectionData.h:31
HadronicFinalStateObjPointerContainer entries
Definition HadronicFinalStateCollectionData.h:36
Definition HadronicFinalStateCollection.h:95
~HadronicFinalStateCollection()
Definition HadronicFinalStateCollection.cc:29
static constexpr auto valueTypeName
Definition HadronicFinalStateCollection.h:113
void clear() final
Definition HadronicFinalStateCollection.cc:81
void setSubsetCollection(bool setSubset=true) final
Definition HadronicFinalStateCollection.cc:58
const std::string_view getDataTypeName() const final
fully qualified type name of stored POD elements - with namespace
Definition HadronicFinalStateCollection.h:143
podio::CollectionWriteBuffers getBuffers() final
Get the collection buffers for this collection.
Definition HadronicFinalStateCollection.cc:159
HadronicFinalStateCollection(const HadronicFinalStateCollection &)=delete
void print(std::ostream &os=std::cout, bool flush=true) const final
Print this collection to the passed stream.
Definition HadronicFinalStateCollection.cc:355
HadronicFinalStateCollection & operator=(HadronicFinalStateCollection &&)=default
HadronicFinalStateCollection(HadronicFinalStateCollection &&)=default
void setID(uint32_t ID) final
Definition HadronicFinalStateCollection.h:175
bool setReferences(const podio::ICollectionProvider *collectionProvider) final
Definition HadronicFinalStateCollection.cc:122
bool empty() const final
Is the collection empty.
Definition HadronicFinalStateCollection.cc:54
HadronicFinalState at(std::size_t index) const
Returns the const object of given index.
Definition HadronicFinalStateCollection.cc:38
bool isValid() const final
Definition HadronicFinalStateCollection.h:189
uint32_t getID() const final
Definition HadronicFinalStateCollection.h:185
std::size_t size() const final
number of elements in the collection
Definition HadronicFinalStateCollection.cc:50
MutableHadronicFinalState create()
Append a new object to the collection, and return this object.
Definition HadronicFinalStateCollection.cc:69
HadronicFinalStateCollection()
Definition HadronicFinalStateCollection.cc:23
podio::SchemaVersionT getSchemaVersion() const final
schema version
Definition HadronicFinalStateCollection.cc:198
void prepareForWrite() const final
Definition HadronicFinalStateCollection.cc:86
const_iterator begin() const
Definition HadronicFinalStateCollection.h:199
iterator end()
Definition HadronicFinalStateCollection.h:202
void prepareAfterRead() final
Definition HadronicFinalStateCollection.cc:107
static constexpr auto dataTypeName
Definition HadronicFinalStateCollection.h:114
const std::string_view getTypeName() const final
fully qualified type name
Definition HadronicFinalStateCollection.h:139
const std::string_view getValueTypeName() const final
fully qualified type name of elements - with namespace
Definition HadronicFinalStateCollection.h:141
static constexpr auto typeName
Definition HadronicFinalStateCollection.h:112
void push_back(MutableHadronicFinalState object)
Append object to the collection.
Definition HadronicFinalStateCollection.cc:126
const_iterator end() const
Definition HadronicFinalStateCollection.h:205
bool isSubsetCollection() const final
Definition HadronicFinalStateCollection.h:147
HadronicFinalStateCollection & operator=(const HadronicFinalStateCollection &)=delete
Definition HadronicFinalStateCollection.h:40
HadronicFinalStateCollectionIterator & operator=(const HadronicFinalStateCollectionIterator &)=delete
HadronicFinalStateCollectionIterator(size_t index, const HadronicFinalStateObjPointerContainer *collection)
Definition HadronicFinalStateCollection.h:42
HadronicFinalStateCollectionIterator & operator++()
Definition HadronicFinalStateCollection.cc:306
bool operator!=(const HadronicFinalStateCollectionIterator &x) const
Definition HadronicFinalStateCollection.h:47
HadronicFinalState * operator->()
Definition HadronicFinalStateCollection.cc:301
bool operator==(const HadronicFinalStateCollectionIterator &x) const
Definition HadronicFinalStateCollection.h:51
HadronicFinalState operator*()
Definition HadronicFinalStateCollection.cc:296
HadronicFinalStateCollectionIterator(const HadronicFinalStateCollectionIterator &)=delete
Definition HadronicFinalState.h:33
Definition HadronicFinalStateCollection.h:66
HadronicFinalStateMutableCollectionIterator(size_t index, const HadronicFinalStateObjPointerContainer *collection)
Definition HadronicFinalStateCollection.h:68
HadronicFinalStateMutableCollectionIterator & operator++()
Definition HadronicFinalStateCollection.cc:323
bool operator==(const HadronicFinalStateMutableCollectionIterator &x) const
Definition HadronicFinalStateCollection.h:77
MutableHadronicFinalState * operator->()
Definition HadronicFinalStateCollection.cc:318
HadronicFinalStateMutableCollectionIterator & operator=(const HadronicFinalStateMutableCollectionIterator &)=delete
MutableHadronicFinalState operator*()
Definition HadronicFinalStateCollection.cc:313
bool operator!=(const HadronicFinalStateMutableCollectionIterator &x) const
Definition HadronicFinalStateCollection.h:73
HadronicFinalStateMutableCollectionIterator(const HadronicFinalStateMutableCollectionIterator &)=delete
Definition HadronicFinalStateObj.h:19
std::vector< edm4eic::ReconstructedParticle > * m_hadrons
Definition HadronicFinalStateObj.h:35
Definition MutableHadronicFinalState.h:32
Definition CalorimeterHit.cc:18
std::ostream & operator<<(std::ostream &o, const CalorimeterHit &value)
Definition CalorimeterHit.cc:97
std::deque< HadronicFinalStateObj * > HadronicFinalStateObjPointerContainer
Definition HadronicFinalStateCollectionData.h:23
Definition CalorimeterHitCollection.h:32