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 {
24class ProtoClusterCollection;
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
35class MutableProtoCluster;
36class ProtoClusterCollection;
37class ProtoClusterCollectionData;
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
57
58
59 /// copy constructor
60 ProtoCluster(const ProtoCluster& other) = default;
61
62 /// copy-assignment operator
64
65 /// create a mutable deep-copy of the object with identical relations
66 /// if cloneRelations=false, the relations are not cloned and will be empty
67 MutableProtoCluster clone(bool cloneRelations=true) const;
68
69 /// destructor
70 ~ProtoCluster() = default;
71
72 /// converting constructor from mutable object
74
75 static ProtoCluster makeEmpty();
76
77public:
78
79 static constexpr auto typeName = "edm4eic::ProtoCluster";
80
81
82
83 std::size_t hits_size() const;
84 edm4eic::CalorimeterHit getHits(std::size_t) const;
85 std::vector<edm4eic::CalorimeterHit>::const_iterator hits_begin() const;
86 std::vector<edm4eic::CalorimeterHit>::const_iterator hits_end() const;
87 podio::RelationRange<edm4eic::CalorimeterHit> getHits() const;
88 std::size_t weights_size() const;
89 float getWeights(std::size_t) const;
90 std::vector<float>::const_iterator weights_begin() const;
91 std::vector<float>::const_iterator weights_end() const;
92 podio::RelationRange<float> getWeights() const;
93
94
95 /// check whether the object is actually available
96 bool isAvailable() const;
97 /// disconnect from ProtoClusterObj instance
98 void unlink() { m_obj = podio::utils::MaybeSharedPtr<ProtoClusterObj>{nullptr}; }
99
100 bool operator==(const ProtoCluster& other) const { return m_obj == other.m_obj; }
101 bool operator==(const MutableProtoCluster& other) const;
102
103 bool operator!=(const ProtoCluster& other) const { return !(*this == other); }
104 bool operator!=(const MutableProtoCluster& other) const { return !(*this == other); }
105
106 // less comparison operator, so that objects can be e.g. stored in sets.
107 bool operator<(const ProtoCluster& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
108
109 podio::ObjectID id() const { return getObjectID(); }
110
111 const podio::ObjectID getObjectID() const;
112
113 friend void swap(ProtoCluster& a, ProtoCluster& b) {
114 using std::swap;
115 swap(a.m_obj, b.m_obj); // swap out the internal pointers
116 }
117
118private:
119 /// constructor from existing ProtoClusterObj
120 explicit ProtoCluster(podio::utils::MaybeSharedPtr<ProtoClusterObj> obj);
122
123 podio::utils::MaybeSharedPtr<ProtoClusterObj> m_obj{nullptr};
124};
125
126std::ostream& operator<<(std::ostream& o, const ProtoCluster& value);
127
128#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
129void to_json(nlohmann::json& j, const ProtoCluster& value);
130#endif
131
132
133} // namespace edm4eic
134
135
136#endif
Definition CalorimeterHit.h:46
Definition MutableProtoCluster.h:35
Definition ProtoClusterCollectionData.h:31
Definition ProtoClusterCollection.h:91
Definition ProtoClusterCollection.h:36
Definition ProtoCluster.h:43
const podio::ObjectID getObjectID() const
Definition ProtoCluster.cc:144
friend class ProtoClusterCollection
Definition ProtoCluster.h:46
friend class MutableProtoCluster
Definition ProtoCluster.h:45
bool operator==(const ProtoCluster &other) const
Definition ProtoCluster.h:100
bool operator<(const ProtoCluster &other) const
Definition ProtoCluster.h:107
std::vector< float >::const_iterator weights_begin() const
Definition ProtoCluster.cc:105
podio::RelationRange< edm4eic::CalorimeterHit > getHits() const
Definition ProtoCluster.cc:96
friend void swap(ProtoCluster &a, ProtoCluster &b)
Definition ProtoCluster.h:113
ProtoCluster(const ProtoCluster &other)=default
copy constructor
bool isAvailable() const
check whether the object is actually available
Definition ProtoCluster.cc:140
std::size_t weights_size() const
Definition ProtoCluster.cc:117
bool operator!=(const MutableProtoCluster &other) const
Definition ProtoCluster.h:104
podio::ObjectID id() const
Definition ProtoCluster.h:109
ProtoCluster()
default constructor
Definition ProtoCluster.cc:20
MutableProtoCluster clone(bool cloneRelations=true) const
Definition ProtoCluster.cc:29
std::size_t hits_size() const
Definition ProtoCluster.cc:85
static constexpr auto typeName
Definition ProtoCluster.h:79
std::vector< float >::const_iterator weights_end() const
Definition ProtoCluster.cc:111
std::vector< edm4eic::CalorimeterHit >::const_iterator hits_begin() const
Definition ProtoCluster.cc:73
std::vector< edm4eic::CalorimeterHit >::const_iterator hits_end() const
Definition ProtoCluster.cc:79
~ProtoCluster()=default
destructor
bool operator!=(const ProtoCluster &other) const
Definition ProtoCluster.h:103
ProtoCluster & operator=(ProtoCluster other)
copy-assignment operator
Definition ProtoCluster.cc:24
static ProtoCluster makeEmpty()
Definition ProtoCluster.cc:66
void unlink()
disconnect from ProtoClusterObj instance
Definition ProtoCluster.h:98
podio::RelationRange< float > getWeights() const
Definition ProtoCluster.cc:128
Definition ProtoClusterObj.h:20
Definition CalorimeterHit.cc:17
std::ostream & operator<<(std::ostream &o, const CalorimeterHit &value)
Definition CalorimeterHit.cc:103
Definition CalorimeterHit.h:31
OrderKey getOrderKey(const edm4eic::CalorimeterHit &obj)
Definition CalorimeterHit.cc:150