EDM4eic
EIC data model
Loading...
Searching...
No Matches
Cluster.h
Go to the documentation of this file.
1// AUTOMATICALLY GENERATED FILE - DO NOT EDIT
2
3#ifndef EDM4EIC_Cluster_H
4#define EDM4EIC_Cluster_H
5
7
9#include "edm4eic/Cov2f.h"
10#include "edm4eic/Cov3f.h"
11#include "edm4hep/ParticleID.h"
12#include "edm4hep/Vector3f.h"
13#include "podio/RelationRange.h"
14#include <cstdint>
15#include <vector>
16
17#include "podio/utilities/MaybeSharedPtr.h"
18#include "podio/detail/OrderKey.h"
19
20#include <ostream>
21#include <cstdint>
22
23#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
24#include "nlohmann/json_fwd.hpp"
25#endif
26
27// forward declarations
28namespace edm4eic {
30}
31
32
33namespace podio::detail {
34// Internal function used in less comparison operators of the datatypes and interface types
35OrderKey getOrderKey(const edm4eic::Cluster& obj);
36};
37
38namespace edm4eic {
39
40class MutableCluster;
43
44/** @class Cluster
45 * EIC hit cluster, reworked to more closely resemble EDM4hep
46 * @author: W. Armstrong, S. Joosten, C.Peng
47 */
48class Cluster {
49
50 friend class MutableCluster;
51 friend class ClusterCollection;
54 friend podio::detail::OrderKey podio::detail::getOrderKey(const Cluster & obj);
55
56public:
59
60 /// default constructor
61 Cluster();
62
63 /// Constructor initializing all members
64 Cluster(const std::int32_t type, const float energy, const float energyError, const float time, const float timeError, const std::uint32_t nhits, const edm4hep::Vector3f& position, const edm4eic::Cov3f& positionError, const float intrinsicTheta, const float intrinsicPhi, const edm4eic::Cov2f& intrinsicDirectionError);
65
66 /// copy constructor
67 Cluster(const Cluster& other) = default;
68
69 /// copy-assignment operator
70 Cluster& operator=(Cluster other) &; // Rebind this to other's internal object
71 Cluster& operator=(Cluster other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
72
73 /// create a mutable deep-copy of the object with identical relations
74 /// if cloneRelations=false, the relations are not cloned and will be empty
75 MutableCluster clone(bool cloneRelations=true) const;
76
77 /// destructor
78 ~Cluster() = default;
79
80 /// converting constructor from mutable object
81 Cluster(const MutableCluster& other);
82
83 static Cluster makeEmpty();
84
85public:
86
87 static constexpr std::string_view typeName = "edm4eic::Cluster";
88
89 /// Access the Flag-word that defines the type of the cluster
90 std::int32_t getType() const;
91
92 /// Access the Reconstructed energy of the cluster [GeV].
93 float getEnergy() const;
94
95 /// Access the Error on the cluster energy [GeV]
96 float getEnergyError() const;
97
98 /// Access the [ns]
99 float getTime() const;
100
101 /// Access the Error on the cluster time
102 float getTimeError() const;
103
104 /// Access the Number of hits in the cluster.
105 std::uint32_t getNhits() const;
106
107 /// Access the Global position of the cluster [mm].
108 const edm4hep::Vector3f& getPosition() const;
109
110 /// Access the Covariance matrix of the position (6 Parameters).
111 const edm4eic::Cov3f& getPositionError() const;
112
113 /// Access the Intrinsic cluster propagation direction polar angle [rad]
114 float getIntrinsicTheta() const;
115
116 /// Access the Intrinsic cluster propagation direction azimuthal angle [rad]
117 float getIntrinsicPhi() const;
118
119 /// Access the Error on the intrinsic cluster propagation direction
121
122
123
124 std::size_t clusters_size() const;
125 edm4eic::Cluster getClusters(std::size_t) const;
126 std::vector<edm4eic::Cluster>::const_iterator clusters_begin() const;
127 std::vector<edm4eic::Cluster>::const_iterator clusters_end() const;
128 podio::RelationRange<edm4eic::Cluster> getClusters() const;
129 std::size_t hits_size() const;
130 edm4eic::CalorimeterHit getHits(std::size_t) const;
131 std::vector<edm4eic::CalorimeterHit>::const_iterator hits_begin() const;
132 std::vector<edm4eic::CalorimeterHit>::const_iterator hits_end() const;
133 podio::RelationRange<edm4eic::CalorimeterHit> getHits() const;
134 std::size_t particleIDs_size() const;
135 edm4hep::ParticleID getParticleIDs(std::size_t) const;
136 std::vector<edm4hep::ParticleID>::const_iterator particleIDs_begin() const;
137 std::vector<edm4hep::ParticleID>::const_iterator particleIDs_end() const;
138 podio::RelationRange<edm4hep::ParticleID> getParticleIDs() const;
139 std::size_t shapeParameters_size() const;
140 float getShapeParameters(std::size_t) const;
141 std::vector<float>::const_iterator shapeParameters_begin() const;
142 std::vector<float>::const_iterator shapeParameters_end() const;
143 podio::RelationRange<float> getShapeParameters() const;
144 std::size_t hitContributions_size() const;
145 float getHitContributions(std::size_t) const;
146 std::vector<float>::const_iterator hitContributions_begin() const;
147 std::vector<float>::const_iterator hitContributions_end() const;
148 podio::RelationRange<float> getHitContributions() const;
149 std::size_t subdetectorEnergies_size() const;
150 float getSubdetectorEnergies(std::size_t) const;
151 std::vector<float>::const_iterator subdetectorEnergies_begin() const;
152 std::vector<float>::const_iterator subdetectorEnergies_end() const;
153 podio::RelationRange<float> getSubdetectorEnergies() const;
154
155
156 /// check whether the object is actually available
157 bool isAvailable() const;
158 /// disconnect from ClusterObj instance
159 void unlink() { m_obj = podio::utils::MaybeSharedPtr<ClusterObj>{nullptr}; }
160
161 bool operator==(const Cluster& other) const { return m_obj == other.m_obj; }
162 bool operator==(const MutableCluster& other) const;
163
164 bool operator!=(const Cluster& other) const { return !(*this == other); }
165 bool operator!=(const MutableCluster& other) const { return !(*this == other); }
166
167 // less comparison operator, so that objects can be e.g. stored in sets.
168 bool operator<(const Cluster& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
169
170 podio::ObjectID id() const { return getObjectID(); }
171
172 const podio::ObjectID getObjectID() const;
173
174 friend std::hash<Cluster>;
175
176 friend void swap(Cluster& a, Cluster& b) {
177 using std::swap;
178 swap(a.m_obj, b.m_obj); // swap out the internal pointers
179 }
180
181private:
182 /// constructor from existing ClusterObj
183 explicit Cluster(podio::utils::MaybeSharedPtr<ClusterObj> obj);
184 Cluster(ClusterObj* obj);
185
186 podio::utils::MaybeSharedPtr<ClusterObj> m_obj{nullptr};
187};
188
189std::ostream& operator<<(std::ostream& o, const Cluster& value);
190
191#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
192void to_json(nlohmann::json& j, const Cluster& value);
193#endif
194
195
196} // namespace edm4eic
197
198
199
200template<>
201struct std::hash<edm4eic::Cluster> {
202 std::size_t operator()(const edm4eic::Cluster& obj) const {
203 return std::hash<edm4eic::ClusterObj*>{}(obj.m_obj.get());
204 }
205};
206
207
208// This is needed to avoid triggering opening every library in LD_LIBRARY_PATH
209// until it's fixed in ROOT. See https://github.com/root-project/root/issues/18489
210// and https://github.com/AIDASoft/podio/issues/770
211#if defined(__clang__)
212#pragma clang diagnostic push
213#pragma clang diagnostic ignored "-Wunknown-warning-option"
214#pragma clang diagnostic ignored "-Wdeprecated-redundant-constexpr-static-def"
215#pragma clang diagnostic ignored "-Wdeprecated"
216constexpr std::string_view edm4eic::Cluster::typeName;
217#pragma clang diagnostic pop
218#elif defined(__GNUC__)
219#pragma GCC diagnostic push
220#pragma GCC diagnostic ignored "-Wdeprecated"
221constexpr std::string_view edm4eic::Cluster::typeName;
222#pragma GCC diagnostic pop
223#endif
224
225#endif
Definition CalorimeterHit.h:46
Definition ClusterCollectionData.h:32
Definition ClusterCollection.h:137
Definition Cluster.h:48
std::size_t particleIDs_size() const
Definition Cluster.cc:218
podio::RelationRange< float > getSubdetectorEnergies() const
Definition Cluster.cc:325
std::vector< edm4hep::ParticleID >::const_iterator particleIDs_begin() const
Definition Cluster.cc:206
bool operator<(const Cluster &other) const
Definition Cluster.h:168
std::vector< float >::const_iterator hitContributions_end() const
Definition Cluster.cc:276
bool operator==(const Cluster &other) const
Definition Cluster.h:161
std::vector< edm4eic::Cluster >::const_iterator clusters_begin() const
Definition Cluster.cc:142
podio::RelationRange< float > getShapeParameters() const
Definition Cluster.cc:261
void unlink()
disconnect from ClusterObj instance
Definition Cluster.h:159
const edm4hep::Vector3f & getPosition() const
Access the Global position of the cluster [mm].
Definition Cluster.cc:134
std::vector< float >::const_iterator shapeParameters_end() const
Definition Cluster.cc:244
friend class ClusterCollectionIterator
Definition Cluster.h:53
Cluster(const Cluster &other)=default
copy constructor
std::vector< float >::const_iterator subdetectorEnergies_begin() const
Definition Cluster.cc:302
float getEnergyError() const
Access the Error on the cluster energy [GeV].
Definition Cluster.cc:130
std::uint32_t getNhits() const
Access the Number of hits in the cluster.
Definition Cluster.cc:133
std::vector< float >::const_iterator hitContributions_begin() const
Definition Cluster.cc:270
podio::RelationRange< edm4hep::ParticleID > getParticleIDs() const
Definition Cluster.cc:229
std::vector< edm4eic::CalorimeterHit >::const_iterator hits_begin() const
Definition Cluster.cc:174
MutableCluster mutable_type
Definition Cluster.h:57
MutableCluster clone(bool cloneRelations=true) const
Definition Cluster.cc:43
friend class ClusterCollection
Definition Cluster.h:51
bool isAvailable() const
check whether the object is actually available
Definition Cluster.cc:337
float getTime() const
Access the [ns].
Definition Cluster.cc:131
podio::RelationRange< float > getHitContributions() const
Definition Cluster.cc:293
Cluster & operator=(Cluster other) &&=delete
std::size_t hits_size() const
Definition Cluster.cc:186
podio::RelationRange< edm4eic::Cluster > getClusters() const
Definition Cluster.cc:165
const edm4eic::Cov2f & getIntrinsicDirectionError() const
Access the Error on the intrinsic cluster propagation direction.
Definition Cluster.cc:138
Cluster()
default constructor
Definition Cluster.cc:20
std::size_t subdetectorEnergies_size() const
Definition Cluster.cc:314
podio::RelationRange< edm4eic::CalorimeterHit > getHits() const
Definition Cluster.cc:197
std::size_t hitContributions_size() const
Definition Cluster.cc:282
float getIntrinsicPhi() const
Access the Intrinsic cluster propagation direction azimuthal angle [rad].
Definition Cluster.cc:137
bool operator!=(const Cluster &other) const
Definition Cluster.h:164
friend class MutableCluster
Definition Cluster.h:50
std::size_t clusters_size() const
Definition Cluster.cc:154
const edm4eic::Cov3f & getPositionError() const
Access the Covariance matrix of the position (6 Parameters).
Definition Cluster.cc:135
std::vector< float >::const_iterator shapeParameters_begin() const
Definition Cluster.cc:238
static constexpr std::string_view typeName
Definition Cluster.h:87
static Cluster makeEmpty()
Definition Cluster.cc:124
float getIntrinsicTheta() const
Access the Intrinsic cluster propagation direction polar angle [rad].
Definition Cluster.cc:136
float getTimeError() const
Access the Error on the cluster time.
Definition Cluster.cc:132
std::vector< edm4eic::CalorimeterHit >::const_iterator hits_end() const
Definition Cluster.cc:180
podio::ObjectID id() const
Definition Cluster.h:170
~Cluster()=default
destructor
std::int32_t getType() const
Access the Flag-word that defines the type of the cluster.
Definition Cluster.cc:128
Cluster & operator=(Cluster other) &
copy-assignment operator
Definition Cluster.cc:38
std::size_t shapeParameters_size() const
Definition Cluster.cc:250
float getEnergy() const
Access the Reconstructed energy of the cluster [GeV].
Definition Cluster.cc:129
bool operator!=(const MutableCluster &other) const
Definition Cluster.h:165
ClusterCollection collection_type
Definition Cluster.h:58
const podio::ObjectID getObjectID() const
Definition Cluster.cc:341
std::vector< edm4eic::Cluster >::const_iterator clusters_end() const
Definition Cluster.cc:148
std::vector< edm4hep::ParticleID >::const_iterator particleIDs_end() const
Definition Cluster.cc:212
friend void swap(Cluster &a, Cluster &b)
Definition Cluster.h:176
std::vector< float >::const_iterator subdetectorEnergies_end() const
Definition Cluster.cc:308
Definition ClusterObj.h:21
Definition Cov2f.h:18
Definition Cov3f.h:18
Definition MutableCluster.h:40
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
std::size_t operator()(const edm4eic::Cluster &obj) const
Definition Cluster.h:202