Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-11-24 10:16:41

0001 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
0002 
0003 #ifndef EDM4EIC_MCRecoCalorimeterHitAssociationCollection_H
0004 #define EDM4EIC_MCRecoCalorimeterHitAssociationCollection_H
0005 
0006 // datamodel specific includes
0007 #include "edm4eic/MCRecoCalorimeterHitAssociation.h"
0008 #include "edm4eic/MutableMCRecoCalorimeterHitAssociation.h"
0009 #include "edm4eic/MCRecoCalorimeterHitAssociationObj.h"
0010 #include "edm4eic/MCRecoCalorimeterHitAssociationCollectionData.h"
0011 
0012 // podio specific includes
0013 #include "podio/ICollectionProvider.h"
0014 #include "podio/CollectionBase.h"
0015 #include "podio/detail/Pythonizations.h"
0016 #include "podio/utilities/TypeHelpers.h"
0017 
0018 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0019 #include "nlohmann/json_fwd.hpp"
0020 #endif
0021 
0022 #include <string_view>
0023 #include <vector>
0024 #include <algorithm>
0025 #include <ostream>
0026 #include <mutex>
0027 #include <memory>
0028 #include <cstddef>
0029 
0030 namespace podio {
0031   struct RelationNames;
0032 }
0033 
0034 namespace edm4eic {
0035 
0036 
0037 
0038 class MCRecoCalorimeterHitAssociationCollectionIterator {
0039 public:
0040   using value_type = MCRecoCalorimeterHitAssociation;
0041   using difference_type = ptrdiff_t;
0042   using reference = MCRecoCalorimeterHitAssociation;
0043   using pointer = MCRecoCalorimeterHitAssociation*;
0044   using iterator_category = std::input_iterator_tag;
0045   // `std::forward_iterator` is supported except that the pointers obtained with `operator->()`
0046   // remain valid as long as the iterator is valid, not as long as the range is valid.
0047   using iterator_concept = std::random_access_iterator_tag;
0048 
0049   MCRecoCalorimeterHitAssociationCollectionIterator(size_t index, const MCRecoCalorimeterHitAssociationObjPointerContainer* collection) : m_index(index), m_object(podio::utils::MaybeSharedPtr<MCRecoCalorimeterHitAssociationObj>{nullptr}), m_collection(collection) {}
0050   MCRecoCalorimeterHitAssociationCollectionIterator() = default;
0051 
0052   MCRecoCalorimeterHitAssociationCollectionIterator(const MCRecoCalorimeterHitAssociationCollectionIterator&) = default;
0053   MCRecoCalorimeterHitAssociationCollectionIterator(MCRecoCalorimeterHitAssociationCollectionIterator&&) = default;
0054   MCRecoCalorimeterHitAssociationCollectionIterator& operator=(const MCRecoCalorimeterHitAssociationCollectionIterator&) = default;
0055   MCRecoCalorimeterHitAssociationCollectionIterator& operator=(MCRecoCalorimeterHitAssociationCollectionIterator&&) = default;
0056   ~MCRecoCalorimeterHitAssociationCollectionIterator() = default;
0057 
0058   constexpr auto operator<=>(const MCRecoCalorimeterHitAssociationCollectionIterator& other) const {
0059     return m_index <=> other.m_index;
0060   }
0061 
0062   constexpr bool operator==(const MCRecoCalorimeterHitAssociationCollectionIterator& x) const {
0063     return m_index ==  x.m_index;
0064   }
0065 
0066   reference operator*() const;
0067   pointer operator->();
0068   MCRecoCalorimeterHitAssociationCollectionIterator& operator++();
0069   MCRecoCalorimeterHitAssociationCollectionIterator operator++(int);
0070   MCRecoCalorimeterHitAssociationCollectionIterator& operator--();
0071   MCRecoCalorimeterHitAssociationCollectionIterator operator--(int);
0072   MCRecoCalorimeterHitAssociationCollectionIterator& operator+=(difference_type n);
0073   MCRecoCalorimeterHitAssociationCollectionIterator operator+(difference_type n) const;
0074   friend MCRecoCalorimeterHitAssociationCollectionIterator operator+(difference_type n, const MCRecoCalorimeterHitAssociationCollectionIterator& it);
0075   MCRecoCalorimeterHitAssociationCollectionIterator& operator-=(difference_type n);
0076   MCRecoCalorimeterHitAssociationCollectionIterator operator-(difference_type n) const;
0077   reference operator[](difference_type n) const;
0078   difference_type operator-(const MCRecoCalorimeterHitAssociationCollectionIterator& other) const;
0079 
0080 private:
0081   size_t m_index{0};
0082   MCRecoCalorimeterHitAssociation m_object { podio::utils::MaybeSharedPtr<MCRecoCalorimeterHitAssociationObj>{nullptr} };
0083   const MCRecoCalorimeterHitAssociationObjPointerContainer* m_collection{nullptr};
0084 };
0085 
0086 
0087 class MCRecoCalorimeterHitAssociationMutableCollectionIterator {
0088 public:
0089   using value_type = MCRecoCalorimeterHitAssociation;
0090   using difference_type = ptrdiff_t;
0091   using reference = MutableMCRecoCalorimeterHitAssociation;
0092   using pointer = MutableMCRecoCalorimeterHitAssociation*;
0093   using iterator_category = std::input_iterator_tag;
0094   // `std::forward_iterator` is supported except that the pointers obtained with `operator->()`
0095   // remain valid as long as the iterator is valid, not as long as the range is valid.
0096   using iterator_concept = std::random_access_iterator_tag;
0097 
0098   MCRecoCalorimeterHitAssociationMutableCollectionIterator(size_t index, const MCRecoCalorimeterHitAssociationObjPointerContainer* collection) : m_index(index), m_object(podio::utils::MaybeSharedPtr<MCRecoCalorimeterHitAssociationObj>{nullptr}), m_collection(collection) {}
0099   MCRecoCalorimeterHitAssociationMutableCollectionIterator() = default;
0100 
0101   MCRecoCalorimeterHitAssociationMutableCollectionIterator(const MCRecoCalorimeterHitAssociationMutableCollectionIterator&) = default;
0102   MCRecoCalorimeterHitAssociationMutableCollectionIterator(MCRecoCalorimeterHitAssociationMutableCollectionIterator&&) = default;
0103   MCRecoCalorimeterHitAssociationMutableCollectionIterator& operator=(const MCRecoCalorimeterHitAssociationMutableCollectionIterator&) = default;
0104   MCRecoCalorimeterHitAssociationMutableCollectionIterator& operator=(MCRecoCalorimeterHitAssociationMutableCollectionIterator&&) = default;
0105   ~MCRecoCalorimeterHitAssociationMutableCollectionIterator() = default;
0106 
0107   constexpr auto operator<=>(const MCRecoCalorimeterHitAssociationMutableCollectionIterator& other) const {
0108     return m_index <=> other.m_index;
0109   }
0110 
0111   constexpr bool operator==(const MCRecoCalorimeterHitAssociationMutableCollectionIterator& x) const {
0112     return m_index ==  x.m_index;
0113   }
0114 
0115   reference operator*() const;
0116   pointer operator->();
0117   MCRecoCalorimeterHitAssociationMutableCollectionIterator& operator++();
0118   MCRecoCalorimeterHitAssociationMutableCollectionIterator operator++(int);
0119   MCRecoCalorimeterHitAssociationMutableCollectionIterator& operator--();
0120   MCRecoCalorimeterHitAssociationMutableCollectionIterator operator--(int);
0121   MCRecoCalorimeterHitAssociationMutableCollectionIterator& operator+=(difference_type n);
0122   MCRecoCalorimeterHitAssociationMutableCollectionIterator operator+(difference_type n) const;
0123   friend MCRecoCalorimeterHitAssociationMutableCollectionIterator operator+(difference_type n, const MCRecoCalorimeterHitAssociationMutableCollectionIterator& it);
0124   MCRecoCalorimeterHitAssociationMutableCollectionIterator& operator-=(difference_type n);
0125   MCRecoCalorimeterHitAssociationMutableCollectionIterator operator-(difference_type n) const;
0126   reference operator[](difference_type n) const;
0127   difference_type operator-(const MCRecoCalorimeterHitAssociationMutableCollectionIterator& other) const;
0128 
0129 private:
0130   size_t m_index{0};
0131   MutableMCRecoCalorimeterHitAssociation m_object { podio::utils::MaybeSharedPtr<MCRecoCalorimeterHitAssociationObj>{nullptr} };
0132   const MCRecoCalorimeterHitAssociationObjPointerContainer* m_collection{nullptr};
0133 };
0134 
0135 
0136 /**
0137 A Collection is identified by an ID.
0138 */
0139 class MCRecoCalorimeterHitAssociationCollection : public podio::CollectionBase {
0140 public:
0141   using value_type = MCRecoCalorimeterHitAssociation;
0142   using mutable_type = MutableMCRecoCalorimeterHitAssociation;
0143   using const_iterator = MCRecoCalorimeterHitAssociationCollectionIterator;
0144   using iterator = MCRecoCalorimeterHitAssociationMutableCollectionIterator;
0145   using difference_type = ptrdiff_t;
0146   using size_type = size_t;
0147   using const_reverse_iterator = std::reverse_iterator<const_iterator>;
0148   using reverse_iterator = std::reverse_iterator<iterator>;
0149 
0150   MCRecoCalorimeterHitAssociationCollection() = default;
0151   MCRecoCalorimeterHitAssociationCollection(MCRecoCalorimeterHitAssociationCollectionData&& data, bool isSubsetColl);
0152   // This is a move-only type
0153   MCRecoCalorimeterHitAssociationCollection(const MCRecoCalorimeterHitAssociationCollection& ) = delete;
0154   MCRecoCalorimeterHitAssociationCollection& operator=(const MCRecoCalorimeterHitAssociationCollection& ) = delete;
0155   MCRecoCalorimeterHitAssociationCollection(MCRecoCalorimeterHitAssociationCollection&&) = default;
0156   MCRecoCalorimeterHitAssociationCollection& operator=(MCRecoCalorimeterHitAssociationCollection&&) = default;
0157 
0158   ~MCRecoCalorimeterHitAssociationCollection() override;
0159 #if defined(__cpp_lib_containers_ranges)
0160   template<podio::detail::RangeConvertibleTo<value_type> R>
0161   MCRecoCalorimeterHitAssociationCollection(std::from_range_t, R&& range);
0162 #endif
0163 
0164   /// Construct a MCRecoCalorimeterHitAssociation collection from a range of mutable or
0165   /// immutable handles
0166   template<podio::detail::RangeConvertibleTo<value_type> R>
0167   static MCRecoCalorimeterHitAssociationCollection from(R&& range);
0168 
0169   constexpr static std::string_view typeName = "edm4eic::MCRecoCalorimeterHitAssociationCollection";
0170   constexpr static std::string_view valueTypeName = "edm4eic::MCRecoCalorimeterHitAssociation";
0171   constexpr static std::string_view dataTypeName = "edm4eic::MCRecoCalorimeterHitAssociationData";
0172 
0173   /// Invalidates all iterators.
0174   void clear() final;
0175 
0176   /// Cppyy protocol to setup the pythonizations for this class. Not to be called directly.
0177   static void __cppjit_pythonize__(PyObject* klass, const std::string& name) {
0178           podio::detail::pythonizations::pythonize_subscript(klass, name);
0179   }
0180   /// Pythonizations for ROOT <= 6.40 before the switch to cppjit
0181   static void __cppyy_pythonize__(PyObject* klass, const std::string& name) {
0182         __cppjit_pythonize__(klass, name);
0183   }
0184 
0185   /// Print this collection to the passed stream
0186   void print(std::ostream& os=std::cout, bool flush=true) const final;
0187 
0188   /// Append a new object to the collection, and return this object.
0189   /// Does not invalidate iterators.
0190   MutableMCRecoCalorimeterHitAssociation create();
0191 
0192   /// Append a new object to the collection, and return this object.
0193   /// Initialized with the parameters given.
0194   /// Does not invalidate iterators.
0195   template<typename... Args>
0196   MutableMCRecoCalorimeterHitAssociation create(Args&&... args);
0197 
0198   /// number of elements in the collection
0199   std::size_t size() const final;
0200 
0201   /// maximal number of elements in the collection
0202   std::size_t max_size() const final;
0203 
0204   /// Is the collection empty
0205   bool empty() const final;
0206 
0207   /// fully qualified type name
0208   const std::string_view getTypeName() const final { return typeName; }
0209   /// fully qualified type name of elements - with namespace
0210   const std::string_view getValueTypeName() const final { return valueTypeName; }
0211   /// fully qualified type name of stored POD elements - with namespace
0212   const std::string_view getDataTypeName() const final { return dataTypeName; }
0213   /// schema version
0214   podio::SchemaVersionT getSchemaVersion() const final;
0215 
0216   bool isSubsetCollection() const final {
0217     return m_isSubsetColl;
0218   }
0219 
0220   void setSubsetCollection(bool setSubset=true) final;
0221 
0222   /// Returns the const object of given index
0223   MCRecoCalorimeterHitAssociation operator[](std::size_t index) const;
0224   /// Returns the object of a given index
0225   MutableMCRecoCalorimeterHitAssociation operator[](std::size_t index);
0226   /// Returns the const object of given index
0227   MCRecoCalorimeterHitAssociation at(std::size_t index) const;
0228   /// Returns the object of given index
0229   MutableMCRecoCalorimeterHitAssociation at(std::size_t index);
0230 
0231 
0232   /// Append object to the collection.
0233   /// Does not invalidate iterators.
0234   void push_back(const MutableMCRecoCalorimeterHitAssociation& object);
0235   /// Append an object to the (subset) collection.
0236   /// Does not invalidate iterators.
0237   void push_back(const MCRecoCalorimeterHitAssociation& object);
0238 
0239   void prepareForWrite() const final;
0240   void prepareAfterRead() final;
0241   bool setReferences(const podio::ICollectionProvider* collectionProvider) final;
0242 
0243   /// Get the collection buffers for this collection
0244   podio::CollectionWriteBuffers getBuffers() final;
0245 
0246   void setID(uint32_t ID) final {
0247     m_collectionID = ID;
0248     if (!m_isSubsetColl) {
0249       std::for_each(m_storage.entries.begin(), m_storage.entries.end(),
0250                   [ID] (MCRecoCalorimeterHitAssociationObj* obj) { obj->id = {obj->id.index, static_cast<uint32_t>(ID)}; }
0251       );
0252     }
0253   }
0254 
0255   uint32_t getID() const final {
0256     return m_collectionID;
0257   }
0258 
0259   /// check if the collection has a valid ID
0260   bool hasID() const final {
0261     return getID() != static_cast<uint32_t>(podio::ObjectID::untracked) &&
0262         getID() != static_cast<uint32_t>(podio::ObjectID::invalid);
0263   }
0264 
0265   size_t getDatamodelRegistryIndex() const final;
0266 
0267   // support for the iterator protocol
0268   iterator begin() {
0269     return iterator(0, &m_storage.entries);
0270   }
0271   const_iterator begin() const {
0272     return const_iterator(0, &m_storage.entries);
0273   }
0274   const_iterator cbegin() const {
0275     return begin();
0276   }
0277   iterator end() {
0278     return iterator(m_storage.entries.size(), &m_storage.entries);
0279   }
0280   const_iterator end() const {
0281     return const_iterator(m_storage.entries.size(), &m_storage.entries);
0282   }
0283   const_iterator cend() const {
0284     return end();
0285   }
0286   // reverse iterators
0287   reverse_iterator rbegin() {
0288     return reverse_iterator(end());
0289   }
0290   const_reverse_iterator rbegin() const {
0291     return const_reverse_iterator(end());
0292   }
0293   const_reverse_iterator crbegin() const {
0294     return rbegin();
0295   }
0296   reverse_iterator rend() {
0297     return reverse_iterator(begin());
0298   }
0299   const_reverse_iterator rend() const {
0300     return const_reverse_iterator(begin());
0301   }
0302   const_reverse_iterator crend() const {
0303     return rend();
0304   }
0305 
0306 
0307   std::vector<float> weight(const size_t nElem = 0) const;
0308 
0309 private:
0310   // For setReferences, we need to give our own CollectionData access to our
0311   // private entries. Otherwise we would need to expose a public member function
0312   // that gives access to the Obj* which is definitely not what we want
0313   friend class MCRecoCalorimeterHitAssociationCollectionData;
0314 
0315   mutable bool m_isPrepared{false};
0316   bool m_isSubsetColl{false};
0317   uint32_t m_collectionID{static_cast<uint32_t>(podio::ObjectID::untracked)};
0318   mutable std::unique_ptr<std::mutex> m_storageMtx{std::make_unique<std::mutex>()};
0319   mutable MCRecoCalorimeterHitAssociationCollectionData m_storage{};
0320 };
0321 
0322 std::ostream& operator<<(std::ostream& o, const MCRecoCalorimeterHitAssociationCollection& v);
0323 
0324 template<typename... Args>
0325 MutableMCRecoCalorimeterHitAssociation MCRecoCalorimeterHitAssociationCollection::create(Args&&... args) {
0326   if (m_isSubsetColl) {
0327     throw std::logic_error("Cannot create new elements on a subset collection");
0328   }
0329   auto obj = new MCRecoCalorimeterHitAssociationObj({static_cast<int>(m_storage.entries.size()), m_collectionID}, {std::forward<Args>(args)...});
0330   m_storage.entries.push_back(obj);
0331 
0332   return MutableMCRecoCalorimeterHitAssociation(podio::utils::MaybeSharedPtr(obj));
0333 }
0334 
0335 
0336 #if defined(__cpp_lib_containers_ranges)
0337 template<podio::detail::RangeConvertibleTo<MCRecoCalorimeterHitAssociationCollection::value_type> R>
0338 MCRecoCalorimeterHitAssociationCollection::MCRecoCalorimeterHitAssociationCollection(std::from_range_t, R&& range)
0339   : MCRecoCalorimeterHitAssociationCollection() {
0340   setSubsetCollection(podio::detail::RangeOf<R, value_type>);
0341 
0342   for (auto&& elem : range) {
0343     push_back(std::forward<decltype(elem)>(elem));
0344   }
0345 }
0346 #endif
0347 
0348 template<podio::detail::RangeConvertibleTo<MCRecoCalorimeterHitAssociationCollection::value_type> R>
0349 MCRecoCalorimeterHitAssociationCollection MCRecoCalorimeterHitAssociationCollection::from(R&& range) {
0350   MCRecoCalorimeterHitAssociationCollection coll;
0351   if constexpr (podio::detail::RangeOf<R, value_type>) {
0352     coll.setSubsetCollection();
0353   }
0354 
0355   for (auto&& elem : range) {
0356     coll.push_back(std::forward<decltype(elem)>(elem));
0357   }
0358 
0359   return coll;
0360 }
0361 
0362 
0363 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0364 void to_json(nlohmann::json& j, const MCRecoCalorimeterHitAssociationCollection& collection);
0365 #endif
0366 
0367 } // namespace edm4eic
0368 
0369 
0370 // This is needed to avoid triggering opening every library in LD_LIBRARY_PATH
0371 // until it's fixed in ROOT. See https://github.com/root-project/root/issues/18489
0372 // and https://github.com/AIDASoft/podio/issues/770
0373 #if defined(__clang__)
0374   #pragma clang diagnostic push
0375   #pragma clang diagnostic ignored "-Wunknown-warning-option"
0376   #pragma clang diagnostic ignored "-Wdeprecated-redundant-constexpr-static-def"
0377   #pragma clang diagnostic ignored "-Wdeprecated"
0378 constexpr std::string_view edm4eic::MCRecoCalorimeterHitAssociationCollection::typeName;
0379 constexpr std::string_view edm4eic::MCRecoCalorimeterHitAssociationCollection::valueTypeName;
0380 constexpr std::string_view edm4eic::MCRecoCalorimeterHitAssociationCollection::dataTypeName;
0381   #pragma clang diagnostic pop
0382 #elif defined(__GNUC__)
0383   #pragma GCC diagnostic push
0384   #pragma GCC diagnostic ignored "-Wdeprecated"
0385 constexpr std::string_view edm4eic::MCRecoCalorimeterHitAssociationCollection::typeName;
0386 constexpr std::string_view edm4eic::MCRecoCalorimeterHitAssociationCollection::valueTypeName;
0387 constexpr std::string_view edm4eic::MCRecoCalorimeterHitAssociationCollection::dataTypeName;
0388   #pragma GCC diagnostic pop
0389 #endif
0390 
0391 
0392 #endif