EDM4eic
EIC data model
Loading...
Searching...
No Matches
ProtoCluster.h
Go to the documentation of this file.
1// AUTOMATICALLY GENERATED FILE - DO NOT EDIT
2
3#ifndef EDM4EIC_ProtoCluster_H
4#define EDM4EIC_ProtoCluster_H
5
7
9#include "podio/RelationRange.h"
10#include <vector>
11
12#include "podio/utilities/MaybeSharedPtr.h"
13#include "podio/detail/OrderKey.h"
14
15#include <ostream>
16#include <cstdint>
17
18#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
19#include "nlohmann/json_fwd.hpp"
20#endif
21
22// forward declarations
23namespace edm4eic {
25}
26
27
28namespace podio::detail {
29// Internal function used in less comparison operators of the datatypes and interface types
30OrderKey getOrderKey(const edm4eic::ProtoCluster& obj);
31};
32
33namespace edm4eic {
34
38
39/** @class ProtoCluster
40 * Collection of hits identified by the clustering algorithm to belong together
41 * @author: S. Joosten
42 */
44
45 friend class MutableProtoCluster;
49 friend podio::detail::OrderKey podio::detail::getOrderKey(const ProtoCluster & obj);
50
51public:
54
55 /// default constructor
56 ProtoCluster() = default;
57
58
59 /// copy constructor
60 ProtoCluster(const ProtoCluster& other) noexcept = default;
61
62 /// move constructor
63 ProtoCluster(ProtoCluster&& other) noexcept = default;
64
65 /// copy-assignment operator
66 ProtoCluster& operator=(ProtoCluster other) &; // Rebind this to other's internal object
67 ProtoCluster& operator=(ProtoCluster other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
68
69 /// create a mutable deep-copy of the object with identical relations
70 /// if cloneRelations=false, the relations are not cloned and will be empty
71 MutableProtoCluster clone(bool cloneRelations=true) const;
72
73 /// destructor
74 ~ProtoCluster() = default;
75
76 /// converting constructor from mutable object
78
79 static ProtoCluster makeEmpty();
80
81public:
82
83 static constexpr std::string_view typeName = "edm4eic::ProtoCluster";
84
85
86
87 std::size_t hits_size() const;
88 edm4eic::CalorimeterHit getHits(std::size_t) const;
89 std::vector<edm4eic::CalorimeterHit>::const_iterator hits_begin() const;
90 std::vector<edm4eic::CalorimeterHit>::const_iterator hits_end() const;
91 podio::RelationRange<edm4eic::CalorimeterHit> getHits() const;
92 std::size_t weights_size() const;
93 float getWeights(std::size_t) const;
94 std::vector<float>::const_iterator weights_begin() const;
95 std::vector<float>::const_iterator weights_end() const;
96 podio::RelationRange<float> getWeights() const;
97
98
99 /// check whether the object is actually available
100 bool isAvailable() const;
101 /// disconnect from ProtoClusterObj instance
102 void unlink() { m_obj = podio::utils::MaybeSharedPtr<ProtoClusterObj>{nullptr}; }
103
104 constexpr bool operator==(const ProtoCluster& other) const { return m_obj == other.m_obj; }
105 bool operator==(const MutableProtoCluster& other) const;
106
107 constexpr bool operator!=(const ProtoCluster& other) const { return !(*this == other); }
108 bool operator!=(const MutableProtoCluster& other) const { return !(*this == other); }
109
110 // less comparison operator, so that objects can be e.g. stored in sets.
111 bool operator<(const ProtoCluster& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
112
113 podio::ObjectID id() const { return getObjectID(); }
114
115 const podio::ObjectID getObjectID() const;
116
117 friend std::hash<ProtoCluster>;
118
119 friend void swap(ProtoCluster& a, ProtoCluster& b) {
120 using std::swap;
121 swap(a.m_obj, b.m_obj); // swap out the internal pointers
122 }
123
124private:
125 /// constructor from existing ProtoClusterObj
126 explicit ProtoCluster(podio::utils::MaybeSharedPtr<ProtoClusterObj> obj);
128
129 podio::utils::MaybeSharedPtr<ProtoClusterObj> m_obj{new ProtoClusterObj{}, podio::utils::MarkOwned};
130};
131
132std::ostream& operator<<(std::ostream& o, const ProtoCluster& value);
133
134#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
135void to_json(nlohmann::json& j, const ProtoCluster& value);
136#endif
137
138
139} // namespace edm4eic
140
141
142
143template<>
144struct std::hash<edm4eic::ProtoCluster> {
145 std::size_t operator()(const edm4eic::ProtoCluster& obj) const {
146 return std::hash<edm4eic::ProtoClusterObj*>{}(obj.m_obj.get());
147 }
148};
149
150
151// This is needed to avoid triggering opening every library in LD_LIBRARY_PATH
152// until it's fixed in ROOT. See https://github.com/root-project/root/issues/18489
153// and https://github.com/AIDASoft/podio/issues/770
154#if defined(__clang__)
155 #pragma clang diagnostic push
156 #pragma clang diagnostic ignored "-Wunknown-warning-option"
157 #pragma clang diagnostic ignored "-Wdeprecated-redundant-constexpr-static-def"
158 #pragma clang diagnostic ignored "-Wdeprecated"
159constexpr std::string_view edm4eic::ProtoCluster::typeName;
160 #pragma clang diagnostic pop
161#elif defined(__GNUC__)
162 #pragma GCC diagnostic push
163 #pragma GCC diagnostic ignored "-Wdeprecated"
164constexpr std::string_view edm4eic::ProtoCluster::typeName;
165 #pragma GCC diagnostic pop
166#endif
167
168
169#endif
Definition CalorimeterHit.h:46
Definition MutableProtoCluster.h:35
Definition ProtoClusterCollectionData.h:32
Definition ProtoClusterCollection.h:139
Definition ProtoCluster.h:43
const podio::ObjectID getObjectID() const
Definition ProtoCluster.cc:141
friend class ProtoClusterCollection
Definition ProtoCluster.h:46
friend class MutableProtoCluster
Definition ProtoCluster.h:45
ProtoCluster & operator=(ProtoCluster other) &&=delete
ProtoCluster & operator=(ProtoCluster other) &
copy-assignment operator
Definition ProtoCluster.cc:21
bool operator<(const ProtoCluster &other) const
Definition ProtoCluster.h:111
std::vector< float >::const_iterator weights_begin() const
Definition ProtoCluster.cc:102
podio::RelationRange< edm4eic::CalorimeterHit > getHits() const
Definition ProtoCluster.cc:93
ProtoCluster()=default
default constructor
friend void swap(ProtoCluster &a, ProtoCluster &b)
Definition ProtoCluster.h:119
ProtoCluster(ProtoCluster &&other) noexcept=default
move constructor
bool isAvailable() const
check whether the object is actually available
Definition ProtoCluster.cc:137
constexpr bool operator==(const ProtoCluster &other) const
Definition ProtoCluster.h:104
std::size_t weights_size() const
Definition ProtoCluster.cc:114
bool operator!=(const MutableProtoCluster &other) const
Definition ProtoCluster.h:108
ProtoClusterCollection collection_type
Definition ProtoCluster.h:53
constexpr bool operator!=(const ProtoCluster &other) const
Definition ProtoCluster.h:107
friend class ProtoClusterCollectionIterator
Definition ProtoCluster.h:48
podio::ObjectID id() const
Definition ProtoCluster.h:113
static constexpr std::string_view typeName
Definition ProtoCluster.h:83
ProtoCluster(const ProtoCluster &other) noexcept=default
copy constructor
MutableProtoCluster clone(bool cloneRelations=true) const
Definition ProtoCluster.cc:26
std::size_t hits_size() const
Definition ProtoCluster.cc:82
MutableProtoCluster mutable_type
Definition ProtoCluster.h:52
std::vector< float >::const_iterator weights_end() const
Definition ProtoCluster.cc:108
std::vector< edm4eic::CalorimeterHit >::const_iterator hits_begin() const
Definition ProtoCluster.cc:70
std::vector< edm4eic::CalorimeterHit >::const_iterator hits_end() const
Definition ProtoCluster.cc:76
~ProtoCluster()=default
destructor
static ProtoCluster makeEmpty()
Definition ProtoCluster.cc:63
void unlink()
disconnect from ProtoClusterObj instance
Definition ProtoCluster.h:102
podio::RelationRange< float > getWeights() const
Definition ProtoCluster.cc:125
Definition ProtoClusterObj.h:20
Definition ArrowMapper.cc:63
std::ostream & operator<<(std::ostream &o, const CalorimeterHit &value)
Definition CalorimeterHit.cc:99
Definition CalorimeterHit.h:31
OrderKey getOrderKey(const edm4eic::CalorimeterHit &obj)
Definition CalorimeterHit.cc:146
std::size_t operator()(const edm4eic::ProtoCluster &obj) const
Definition ProtoCluster.h:145