EDM4eic
EIC data model
Loading...
Searching...
No Matches
MutableCluster.h
Go to the documentation of this file.
1// AUTOMATICALLY GENERATED FILE - DO NOT EDIT
2
3#ifndef EDM4EIC_MutableCluster_H
4#define EDM4EIC_MutableCluster_H
5
7// Make the immutable class available from its mutable version but not vice versa
8#include "edm4eic/Cluster.h"
9
11#include "edm4eic/Cov2f.h"
12#include "edm4eic/Cov3f.h"
13#include "edm4hep/ParticleID.h"
14#include "edm4hep/Vector3f.h"
15#include "podio/RelationRange.h"
16#include <cstdint>
17#include <vector>
18
19#include "podio/utilities/MaybeSharedPtr.h"
20
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 edm4eic {
34
35
36/** @class MutableCluster
37 * EIC hit cluster, reworked to more closely resemble EDM4hep
38 * @author: W. Armstrong, S. Joosten, C.Peng
39 */
41
42 friend class ClusterCollection;
44 friend class Cluster;
45
46public:
49
50 /// default constructor
52
53 /// Constructor initializing all members
54 MutableCluster(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);
55
56 /// copy constructor
57 MutableCluster(const MutableCluster& other) = default;
58
59 /// copy-assignment operator
60 MutableCluster& operator=(MutableCluster other) &; // Rebind this to other's internal object
61 MutableCluster& operator=(MutableCluster other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
62
63 /// create a mutable deep-copy of the object with identical relations
64 /// if cloneRelations=false, the relations are not cloned and will be empty
65 MutableCluster clone(bool cloneRelations=true) const;
66
67 /// destructor
68 ~MutableCluster() = default;
69
70
71public:
72
73 /// Access the Flag-word that defines the type of the cluster
74 std::int32_t getType() const;
75
76 /// Access the Reconstructed energy of the cluster [GeV].
77 float getEnergy() const;
78
79 /// Access the Error on the cluster energy [GeV]
80 float getEnergyError() const;
81
82 /// Access the [ns]
83 float getTime() const;
84
85 /// Access the Error on the cluster time
86 float getTimeError() const;
87
88 /// Access the Number of hits in the cluster.
89 std::uint32_t getNhits() const;
90
91 /// Access the Global position of the cluster [mm].
92 const edm4hep::Vector3f& getPosition() const;
93
94 /// Access the Covariance matrix of the position (6 Parameters).
95 const edm4eic::Cov3f& getPositionError() const;
96
97 /// Access the Intrinsic cluster propagation direction polar angle [rad]
98 float getIntrinsicTheta() const;
99
100 /// Access the Intrinsic cluster propagation direction azimuthal angle [rad]
101 float getIntrinsicPhi() const;
102
103 /// Access the Error on the intrinsic cluster propagation direction
105
106
107
108 /// Set the Flag-word that defines the type of the cluster
109 void setType(const std::int32_t type);
110 /// Get mutable reference to Flag-word that defines the type of the cluster
111 std::int32_t& getType();
112 /// Get reference to Flag-word that defines the type of the cluster
113 [[deprecated("use getType instead")]]
114 std::int32_t& type();
115
116 /// Set the Reconstructed energy of the cluster [GeV].
117 void setEnergy(const float energy);
118 /// Get mutable reference to Reconstructed energy of the cluster [GeV].
119 float& getEnergy();
120 /// Get reference to Reconstructed energy of the cluster [GeV].
121 [[deprecated("use getEnergy instead")]]
122 float& energy();
123
124 /// Set the Error on the cluster energy [GeV]
125 void setEnergyError(const float energyError);
126 /// Get mutable reference to Error on the cluster energy [GeV]
127 float& getEnergyError();
128 /// Get reference to Error on the cluster energy [GeV]
129 [[deprecated("use getEnergyError instead")]]
130 float& energyError();
131
132 /// Set the [ns]
133 void setTime(const float time);
134 /// Get mutable reference to [ns]
135 float& getTime();
136 /// Get reference to [ns]
137 [[deprecated("use getTime instead")]]
138 float& time();
139
140 /// Set the Error on the cluster time
141 void setTimeError(const float timeError);
142 /// Get mutable reference to Error on the cluster time
143 float& getTimeError();
144 /// Get reference to Error on the cluster time
145 [[deprecated("use getTimeError instead")]]
146 float& timeError();
147
148 /// Set the Number of hits in the cluster.
149 void setNhits(const std::uint32_t nhits);
150 /// Get mutable reference to Number of hits in the cluster.
151 std::uint32_t& getNhits();
152 /// Get reference to Number of hits in the cluster.
153 [[deprecated("use getNhits instead")]]
154 std::uint32_t& nhits();
155
156 /// Set the Global position of the cluster [mm].
157 void setPosition(const edm4hep::Vector3f& position);
158 /// Get mutable reference to Global position of the cluster [mm].
159 edm4hep::Vector3f& getPosition();
160 /// Get reference to Global position of the cluster [mm].
161 [[deprecated("use getPosition instead")]]
162 edm4hep::Vector3f& position();
163
164 /// Set the Covariance matrix of the position (6 Parameters).
166 /// Get mutable reference to Covariance matrix of the position (6 Parameters).
168 /// Get reference to Covariance matrix of the position (6 Parameters).
169 [[deprecated("use getPositionError instead")]]
171
172 /// Set the Intrinsic cluster propagation direction polar angle [rad]
173 void setIntrinsicTheta(const float intrinsicTheta);
174 /// Get mutable reference to Intrinsic cluster propagation direction polar angle [rad]
175 float& getIntrinsicTheta();
176 /// Get reference to Intrinsic cluster propagation direction polar angle [rad]
177 [[deprecated("use getIntrinsicTheta instead")]]
178 float& intrinsicTheta();
179
180 /// Set the Intrinsic cluster propagation direction azimuthal angle [rad]
181 void setIntrinsicPhi(const float intrinsicPhi);
182 /// Get mutable reference to Intrinsic cluster propagation direction azimuthal angle [rad]
183 float& getIntrinsicPhi();
184 /// Get reference to Intrinsic cluster propagation direction azimuthal angle [rad]
185 [[deprecated("use getIntrinsicPhi instead")]]
186 float& intrinsicPhi();
187
188 /// Set the Error on the intrinsic cluster propagation direction
190 /// Get mutable reference to Error on the intrinsic cluster propagation direction
192 /// Get reference to Error on the intrinsic cluster propagation direction
193 [[deprecated("use getIntrinsicDirectionError instead")]]
195
196
197
198 void addToClusters(const edm4eic::Cluster&);
199 std::size_t clusters_size() const;
200 edm4eic::Cluster getClusters(std::size_t) const;
201 std::vector<edm4eic::Cluster>::const_iterator clusters_begin() const;
202 std::vector<edm4eic::Cluster>::const_iterator clusters_end() const;
203 podio::RelationRange<edm4eic::Cluster> getClusters() const;
205 std::size_t hits_size() const;
206 edm4eic::CalorimeterHit getHits(std::size_t) const;
207 std::vector<edm4eic::CalorimeterHit>::const_iterator hits_begin() const;
208 std::vector<edm4eic::CalorimeterHit>::const_iterator hits_end() const;
209 podio::RelationRange<edm4eic::CalorimeterHit> getHits() const;
210 void addToParticleIDs(const edm4hep::ParticleID&);
211 std::size_t particleIDs_size() const;
212 edm4hep::ParticleID getParticleIDs(std::size_t) const;
213 std::vector<edm4hep::ParticleID>::const_iterator particleIDs_begin() const;
214 std::vector<edm4hep::ParticleID>::const_iterator particleIDs_end() const;
215 podio::RelationRange<edm4hep::ParticleID> getParticleIDs() const;
216 void addToShapeParameters(const float&);
217 std::size_t shapeParameters_size() const;
218 float getShapeParameters(std::size_t) const;
219 std::vector<float>::const_iterator shapeParameters_begin() const;
220 std::vector<float>::const_iterator shapeParameters_end() const;
221 podio::RelationRange<float> getShapeParameters() const;
222 void addToHitContributions(const float&);
223 std::size_t hitContributions_size() const;
224 float getHitContributions(std::size_t) const;
225 std::vector<float>::const_iterator hitContributions_begin() const;
226 std::vector<float>::const_iterator hitContributions_end() const;
227 podio::RelationRange<float> getHitContributions() const;
228 void addToSubdetectorEnergies(const float&);
229 std::size_t subdetectorEnergies_size() const;
230 float getSubdetectorEnergies(std::size_t) const;
231 std::vector<float>::const_iterator subdetectorEnergies_begin() const;
232 std::vector<float>::const_iterator subdetectorEnergies_end() const;
233 podio::RelationRange<float> getSubdetectorEnergies() const;
234
235
236
237 /// check whether the object is actually available
238 bool isAvailable() const;
239 /// disconnect from ClusterObj instance
240 void unlink() { m_obj = podio::utils::MaybeSharedPtr<ClusterObj>{nullptr}; }
241
242 bool operator==(const MutableCluster& other) const { return m_obj == other.m_obj; }
243 bool operator==(const Cluster& other) const;
244
245 bool operator!=(const MutableCluster& other) const { return !(*this == other); }
246 bool operator!=(const Cluster& other) const { return !(*this == other); }
247
248 // less comparison operator, so that objects can be e.g. stored in sets.
249 bool operator<(const MutableCluster& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
250
251 podio::ObjectID id() const { return getObjectID(); }
252
253 const podio::ObjectID getObjectID() const;
254
255 friend std::hash<MutableCluster>;
256
257 friend void swap(MutableCluster& a, MutableCluster& b) {
258 using std::swap;
259 swap(a.m_obj, b.m_obj); // swap out the internal pointers
260 }
261
262private:
263 /// constructor from existing ClusterObj
264 explicit MutableCluster(podio::utils::MaybeSharedPtr<ClusterObj> obj);
265
266 podio::utils::MaybeSharedPtr<ClusterObj> m_obj{nullptr};
267};
268
269#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
270void to_json(nlohmann::json& j, const MutableCluster& value);
271#endif
272
273
274} // namespace edm4eic
275
276
277
278template<>
279struct std::hash<edm4eic::MutableCluster> {
280 std::size_t operator()(const edm4eic::MutableCluster& obj) const {
281 return std::hash<edm4eic::ClusterObj*>{}(obj.m_obj.get());
282 }
283};
284
285
286#endif
Definition CalorimeterHit.h:46
Definition ClusterCollection.h:137
Definition Cluster.h:48
Definition Cov2f.h:18
Definition Cov3f.h:18
Definition MutableCluster.h:40
Cluster object_type
Definition MutableCluster.h:47
const edm4hep::Vector3f & getPosition() const
Access the Global position of the cluster [mm].
Definition MutableCluster.cc:75
podio::RelationRange< float > getSubdetectorEnergies() const
Definition MutableCluster.cc:325
std::vector< edm4hep::ParticleID >::const_iterator particleIDs_begin() const
Definition MutableCluster.cc:194
friend class Cluster
Definition MutableCluster.h:44
float getTime() const
Access the [ns].
Definition MutableCluster.cc:72
void addToShapeParameters(const float &)
Definition MutableCluster.cc:225
podio::RelationRange< edm4eic::CalorimeterHit > getHits() const
Definition MutableCluster.cc:181
std::vector< edm4eic::CalorimeterHit >::const_iterator hits_end() const
Definition MutableCluster.cc:164
podio::ObjectID id() const
Definition MutableCluster.h:251
void setPosition(const edm4hep::Vector3f &position)
Set the Global position of the cluster [mm].
Definition MutableCluster.cc:100
ClusterCollection collection_type
Definition MutableCluster.h:48
std::vector< edm4eic::CalorimeterHit >::const_iterator hits_begin() const
Definition MutableCluster.cc:158
void addToParticleIDs(const edm4hep::ParticleID &)
Definition MutableCluster.cc:189
void setIntrinsicPhi(const float intrinsicPhi)
Set the Intrinsic cluster propagation direction azimuthal angle [rad].
Definition MutableCluster.cc:109
void setType(const std::int32_t type)
Set the Flag-word that defines the type of the cluster.
Definition MutableCluster.cc:82
float getTimeError() const
Access the Error on the cluster time.
Definition MutableCluster.cc:73
void unlink()
disconnect from ClusterObj instance
Definition MutableCluster.h:240
float getEnergyError() const
Access the Error on the cluster energy [GeV].
Definition MutableCluster.cc:71
bool operator!=(const Cluster &other) const
Definition MutableCluster.h:246
const edm4eic::Cov2f & getIntrinsicDirectionError() const
Access the Error on the intrinsic cluster propagation direction.
Definition MutableCluster.cc:79
bool isAvailable() const
check whether the object is actually available
Definition MutableCluster.cc:338
MutableCluster(const MutableCluster &other)=default
copy constructor
bool operator<(const MutableCluster &other) const
Definition MutableCluster.h:249
std::size_t particleIDs_size() const
Definition MutableCluster.cc:206
void setPositionError(const edm4eic::Cov3f &positionError)
Set the Covariance matrix of the position (6 Parameters).
Definition MutableCluster.cc:103
edm4eic::Cov2f & intrinsicDirectionError()
Get reference to Error on the intrinsic cluster propagation direction.
Definition MutableCluster.cc:114
std::size_t hits_size() const
Definition MutableCluster.cc:170
std::vector< edm4hep::ParticleID >::const_iterator particleIDs_end() const
Definition MutableCluster.cc:200
bool operator!=(const MutableCluster &other) const
Definition MutableCluster.h:245
MutableCluster & operator=(MutableCluster other) &&=delete
float & intrinsicTheta()
Get reference to Intrinsic cluster propagation direction polar angle [rad].
Definition MutableCluster.cc:108
float getIntrinsicTheta() const
Access the Intrinsic cluster propagation direction polar angle [rad].
Definition MutableCluster.cc:77
void addToHits(const edm4eic::CalorimeterHit &)
Definition MutableCluster.cc:153
std::int32_t & type()
Get reference to Flag-word that defines the type of the cluster.
Definition MutableCluster.cc:84
friend void swap(MutableCluster &a, MutableCluster &b)
Definition MutableCluster.h:257
podio::RelationRange< edm4hep::ParticleID > getParticleIDs() const
Definition MutableCluster.cc:217
void setTimeError(const float timeError)
Set the Error on the cluster time.
Definition MutableCluster.cc:94
MutableCluster & operator=(MutableCluster other) &
copy-assignment operator
Definition MutableCluster.cc:36
std::vector< edm4eic::Cluster >::const_iterator clusters_end() const
Definition MutableCluster.cc:128
friend class ClusterCollection
Definition MutableCluster.h:42
edm4eic::Cov3f & positionError()
Get reference to Covariance matrix of the position (6 Parameters).
Definition MutableCluster.cc:105
float & energyError()
Get reference to Error on the cluster energy [GeV].
Definition MutableCluster.cc:90
void setTime(const float time)
Set the [ns].
Definition MutableCluster.cc:91
void setIntrinsicTheta(const float intrinsicTheta)
Set the Intrinsic cluster propagation direction polar angle [rad].
Definition MutableCluster.cc:106
std::int32_t getType() const
Access the Flag-word that defines the type of the cluster.
Definition MutableCluster.cc:69
float & intrinsicPhi()
Get reference to Intrinsic cluster propagation direction azimuthal angle [rad].
Definition MutableCluster.cc:111
void addToSubdetectorEnergies(const float &)
Definition MutableCluster.cc:297
std::vector< float >::const_iterator hitContributions_begin() const
Definition MutableCluster.cc:266
std::vector< float >::const_iterator subdetectorEnergies_begin() const
Definition MutableCluster.cc:302
std::uint32_t getNhits() const
Access the Number of hits in the cluster.
Definition MutableCluster.cc:74
edm4hep::Vector3f & position()
Get reference to Global position of the cluster [mm].
Definition MutableCluster.cc:102
std::size_t clusters_size() const
Definition MutableCluster.cc:134
void addToHitContributions(const float &)
Definition MutableCluster.cc:261
std::size_t hitContributions_size() const
Definition MutableCluster.cc:278
bool operator==(const MutableCluster &other) const
Definition MutableCluster.h:242
~MutableCluster()=default
destructor
friend class ClusterMutableCollectionIterator
Definition MutableCluster.h:43
std::vector< edm4eic::Cluster >::const_iterator clusters_begin() const
Definition MutableCluster.cc:122
float getEnergy() const
Access the Reconstructed energy of the cluster [GeV].
Definition MutableCluster.cc:70
void setIntrinsicDirectionError(const edm4eic::Cov2f &intrinsicDirectionError)
Set the Error on the intrinsic cluster propagation direction.
Definition MutableCluster.cc:112
std::size_t shapeParameters_size() const
Definition MutableCluster.cc:242
MutableCluster()
default constructor
Definition MutableCluster.cc:18
const edm4eic::Cov3f & getPositionError() const
Access the Covariance matrix of the position (6 Parameters).
Definition MutableCluster.cc:76
MutableCluster clone(bool cloneRelations=true) const
Definition MutableCluster.cc:41
float & energy()
Get reference to Reconstructed energy of the cluster [GeV].
Definition MutableCluster.cc:87
std::vector< float >::const_iterator shapeParameters_end() const
Definition MutableCluster.cc:236
const podio::ObjectID getObjectID() const
Definition MutableCluster.cc:342
podio::RelationRange< edm4eic::Cluster > getClusters() const
Definition MutableCluster.cc:145
podio::RelationRange< float > getHitContributions() const
Definition MutableCluster.cc:289
void setNhits(const std::uint32_t nhits)
Set the Number of hits in the cluster.
Definition MutableCluster.cc:97
void addToClusters(const edm4eic::Cluster &)
Definition MutableCluster.cc:117
float getIntrinsicPhi() const
Access the Intrinsic cluster propagation direction azimuthal angle [rad].
Definition MutableCluster.cc:78
std::vector< float >::const_iterator subdetectorEnergies_end() const
Definition MutableCluster.cc:308
std::uint32_t & nhits()
Get reference to Number of hits in the cluster.
Definition MutableCluster.cc:99
std::vector< float >::const_iterator hitContributions_end() const
Definition MutableCluster.cc:272
void setEnergy(const float energy)
Set the Reconstructed energy of the cluster [GeV].
Definition MutableCluster.cc:85
void setEnergyError(const float energyError)
Set the Error on the cluster energy [GeV].
Definition MutableCluster.cc:88
float & time()
Get reference to [ns].
Definition MutableCluster.cc:93
float & timeError()
Get reference to Error on the cluster time.
Definition MutableCluster.cc:96
std::vector< float >::const_iterator shapeParameters_begin() const
Definition MutableCluster.cc:230
podio::RelationRange< float > getShapeParameters() const
Definition MutableCluster.cc:253
std::size_t subdetectorEnergies_size() const
Definition MutableCluster.cc:314
Definition CalorimeterHit.cc:17
OrderKey getOrderKey(const edm4eic::CalorimeterHit &obj)
Definition CalorimeterHit.cc:150
std::size_t operator()(const edm4eic::MutableCluster &obj) const
Definition MutableCluster.h:280