File indexing completed on 2025-01-18 10:01:27
0001
0002
0003 #ifndef PODIODATAMODEL_ExampleCluster_H
0004 #define PODIODATAMODEL_ExampleCluster_H
0005
0006 #include "PodioDatamodel/ExampleClusterObj.h"
0007
0008 #include "PodioDatamodel/ExampleHit.h"
0009 #include "podio/RelationRange.h"
0010 #include <vector>
0011
0012 #include "podio/utilities/MaybeSharedPtr.h"
0013
0014 #include <ostream>
0015 #include <cstdint>
0016
0017 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0018 #include "nlohmann/json_fwd.hpp"
0019 #endif
0020
0021
0022
0023
0024 class MutableExampleCluster;
0025 class ExampleClusterCollection;
0026 class ExampleClusterCollectionData;
0027
0028
0029
0030
0031
0032 class ExampleCluster {
0033
0034 friend class MutableExampleCluster;
0035 friend class ExampleClusterCollection;
0036 friend class ExampleClusterCollectionData;
0037 friend class ExampleClusterCollectionIterator;
0038
0039 public:
0040 using mutable_type = MutableExampleCluster;
0041 using collection_type = ExampleClusterCollection;
0042
0043
0044 ExampleCluster();
0045
0046
0047 ExampleCluster(double energy);
0048
0049
0050 ExampleCluster(const ExampleCluster& other) = default;
0051
0052
0053 ExampleCluster& operator=(ExampleCluster other);
0054
0055
0056
0057 MutableExampleCluster clone(bool cloneRelations=true) const;
0058
0059
0060 ~ExampleCluster() = default;
0061
0062
0063 ExampleCluster(const MutableExampleCluster& other);
0064
0065 static ExampleCluster makeEmpty();
0066
0067 public:
0068
0069
0070 double energy() const;
0071
0072
0073
0074 std::size_t Hits_size() const;
0075 ExampleHit Hits(std::size_t) const;
0076 std::vector<ExampleHit>::const_iterator Hits_begin() const;
0077 std::vector<ExampleHit>::const_iterator Hits_end() const;
0078 podio::RelationRange<ExampleHit> Hits() const;
0079 std::size_t Clusters_size() const;
0080 ExampleCluster Clusters(std::size_t) const;
0081 std::vector<ExampleCluster>::const_iterator Clusters_begin() const;
0082 std::vector<ExampleCluster>::const_iterator Clusters_end() const;
0083 podio::RelationRange<ExampleCluster> Clusters() const;
0084
0085
0086
0087 bool isAvailable() const;
0088
0089 void unlink() { m_obj = podio::utils::MaybeSharedPtr<ExampleClusterObj>{nullptr}; }
0090
0091 bool operator==(const ExampleCluster& other) const { return m_obj == other.m_obj; }
0092 bool operator==(const MutableExampleCluster& other) const;
0093
0094 bool operator!=(const ExampleCluster& other) const { return !(*this == other); }
0095 bool operator!=(const MutableExampleCluster& other) const { return !(*this == other); }
0096
0097
0098 bool operator<(const ExampleCluster& other) const { return m_obj < other.m_obj; }
0099
0100 podio::ObjectID id() const { return getObjectID(); }
0101
0102 const podio::ObjectID getObjectID() const;
0103
0104 friend void swap(ExampleCluster& a, ExampleCluster& b) {
0105 using std::swap;
0106 swap(a.m_obj, b.m_obj);
0107 }
0108
0109 private:
0110
0111 explicit ExampleCluster(podio::utils::MaybeSharedPtr<ExampleClusterObj> obj);
0112 ExampleCluster(ExampleClusterObj* obj);
0113
0114 podio::utils::MaybeSharedPtr<ExampleClusterObj> m_obj{nullptr};
0115 };
0116
0117 std::ostream& operator<<(std::ostream& o, const ExampleCluster& value);
0118
0119 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0120 void to_json(nlohmann::json& j, const ExampleCluster& value);
0121 #endif
0122
0123
0124
0125
0126 #endif