Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/edm4eic/MCRecoVertexParticleAssociationCollection.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

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