Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-07-11 08:30:09

0001 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
0002 
0003 #ifndef EDM4EIC_ProtoCluster_H
0004 #define EDM4EIC_ProtoCluster_H
0005 
0006 #include "edm4eic/ProtoClusterObj.h"
0007 
0008 #include "edm4eic/CalorimeterHit.h"
0009 #include "podio/RelationRange.h"
0010 #include <vector>
0011 
0012 #include "podio/utilities/MaybeSharedPtr.h"
0013 #include "podio/detail/OrderKey.h"
0014 
0015 #include <ostream>
0016 #include <cstdint>
0017 
0018 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0019 #include "nlohmann/json_fwd.hpp"
0020 #endif
0021 
0022 // forward declarations
0023 namespace edm4eic {
0024 class ProtoClusterCollection;
0025 }
0026 
0027 
0028 namespace podio::detail {
0029 // Internal function used in less comparison operators of the datatypes and interface types
0030 OrderKey getOrderKey(const edm4eic::ProtoCluster& obj);
0031 };
0032 
0033 namespace edm4eic {
0034 
0035 class MutableProtoCluster;
0036 class ProtoClusterCollection;
0037 class ProtoClusterCollectionData;
0038 
0039 /** @class ProtoCluster
0040  *  Collection of hits identified by the clustering algorithm to belong together
0041  *  @author: S. Joosten
0042  */
0043 class ProtoCluster {
0044 
0045   friend class MutableProtoCluster;
0046   friend class ProtoClusterCollection;
0047   friend class edm4eic::ProtoClusterCollectionData;
0048   friend class ProtoClusterCollectionIterator;
0049   friend podio::detail::OrderKey podio::detail::getOrderKey(const ProtoCluster & obj);
0050 
0051 public:
0052   using mutable_type = MutableProtoCluster;
0053   using collection_type = ProtoClusterCollection;
0054 
0055   /// default constructor
0056   ProtoCluster();
0057 
0058 
0059   /// copy constructor
0060   ProtoCluster(const ProtoCluster& other) = default;
0061 
0062   /// copy-assignment operator
0063   ProtoCluster& operator=(ProtoCluster other);
0064 
0065   /// create a mutable deep-copy of the object with identical relations
0066   /// if cloneRelations=false, the relations are not cloned and will be empty
0067   MutableProtoCluster clone(bool cloneRelations=true) const;
0068 
0069   /// destructor
0070   ~ProtoCluster() = default;
0071 
0072   /// converting constructor from mutable object
0073   ProtoCluster(const MutableProtoCluster& other);
0074 
0075   static ProtoCluster makeEmpty();
0076 
0077 public:
0078 
0079   static constexpr auto typeName = "edm4eic::ProtoCluster";
0080 
0081 
0082 
0083   std::size_t hits_size() const;
0084   edm4eic::CalorimeterHit getHits(std::size_t) const;
0085   std::vector<edm4eic::CalorimeterHit>::const_iterator hits_begin() const;
0086   std::vector<edm4eic::CalorimeterHit>::const_iterator hits_end() const;
0087   podio::RelationRange<edm4eic::CalorimeterHit> getHits() const;
0088   std::size_t weights_size() const;
0089   float getWeights(std::size_t) const;
0090   std::vector<float>::const_iterator weights_begin() const;
0091   std::vector<float>::const_iterator weights_end() const;
0092   podio::RelationRange<float> getWeights() const;
0093 
0094 
0095   /// check whether the object is actually available
0096   bool isAvailable() const;
0097   /// disconnect from ProtoClusterObj instance
0098   void unlink() { m_obj = podio::utils::MaybeSharedPtr<ProtoClusterObj>{nullptr}; }
0099 
0100   bool operator==(const ProtoCluster& other) const { return m_obj == other.m_obj; }
0101   bool operator==(const MutableProtoCluster& other) const;
0102 
0103   bool operator!=(const ProtoCluster& other) const { return !(*this == other); }
0104   bool operator!=(const MutableProtoCluster& other) const { return !(*this == other); }
0105 
0106   // less comparison operator, so that objects can be e.g. stored in sets.
0107   bool operator<(const ProtoCluster& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
0108 
0109   podio::ObjectID id() const { return getObjectID(); }
0110 
0111   const podio::ObjectID getObjectID() const;
0112 
0113   friend void swap(ProtoCluster& a, ProtoCluster& b) {
0114     using std::swap;
0115     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0116   }
0117 
0118 private:
0119   /// constructor from existing ProtoClusterObj
0120   explicit ProtoCluster(podio::utils::MaybeSharedPtr<ProtoClusterObj> obj);
0121   ProtoCluster(ProtoClusterObj* obj);
0122 
0123   podio::utils::MaybeSharedPtr<ProtoClusterObj> m_obj{nullptr};
0124 };
0125 
0126 std::ostream& operator<<(std::ostream& o, const ProtoCluster& value);
0127 
0128 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0129 void to_json(nlohmann::json& j, const ProtoCluster& value);
0130 #endif
0131 
0132 
0133 } // namespace edm4eic
0134 
0135 
0136 #endif