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 {
29class ClusterCollection;
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;
41class ClusterCollection;
42class ClusterCollectionData;
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(std::int32_t type, float energy, float energyError, float time, float timeError, std::uint32_t nhits, edm4hep::Vector3f position, edm4eic::Cov3f positionError, float intrinsicTheta, float intrinsicPhi, edm4eic::Cov2f intrinsicDirectionError);
65
66 /// copy constructor
67 Cluster(const Cluster& other) = default;
68
69 /// copy-assignment operator
71
72 /// create a mutable deep-copy of the object with identical relations
73 /// if cloneRelations=false, the relations are not cloned and will be empty
74 MutableCluster clone(bool cloneRelations=true) const;
75
76 /// destructor
77 ~Cluster() = default;
78
79 /// converting constructor from mutable object
80 Cluster(const MutableCluster& other);
81
82 static Cluster makeEmpty();
83
84public:
85
86 static constexpr auto typeName = "edm4eic::Cluster";
87
88 /// Access the Flag-word that defines the type of the cluster
89 std::int32_t getType() const;
90
91 /// Access the Reconstructed energy of the cluster [GeV].
92 float getEnergy() const;
93
94 /// Access the Error on the cluster energy [GeV]
95 float getEnergyError() const;
96
97 /// Access the [ns]
98 float getTime() const;
99
100 /// Access the Error on the cluster time
101 float getTimeError() const;
102
103 /// Access the Number of hits in the cluster.
104 std::uint32_t getNhits() const;
105
106 /// Access the Global position of the cluster [mm].
107 const edm4hep::Vector3f& getPosition() const;
108
109 /// Access the Covariance matrix of the position (6 Parameters).
110 const edm4eic::Cov3f& getPositionError() const;
111
112 /// Access the Intrinsic cluster propagation direction polar angle [rad]
113 float getIntrinsicTheta() const;
114
115 /// Access the Intrinsic cluster propagation direction azimuthal angle [rad]
116 float getIntrinsicPhi() const;
117
118 /// Access the Error on the intrinsic cluster propagation direction
120
121
122
123 std::size_t clusters_size() const;
124 edm4eic::Cluster getClusters(std::size_t) const;
125 std::vector<edm4eic::Cluster>::const_iterator clusters_begin() const;
126 std::vector<edm4eic::Cluster>::const_iterator clusters_end() const;
127 podio::RelationRange<edm4eic::Cluster> getClusters() const;
128 std::size_t hits_size() const;
129 edm4eic::CalorimeterHit getHits(std::size_t) const;
130 std::vector<edm4eic::CalorimeterHit>::const_iterator hits_begin() const;
131 std::vector<edm4eic::CalorimeterHit>::const_iterator hits_end() const;
132 podio::RelationRange<edm4eic::CalorimeterHit> getHits() const;
133 std::size_t particleIDs_size() const;
134 edm4hep::ParticleID getParticleIDs(std::size_t) const;
135 std::vector<edm4hep::ParticleID>::const_iterator particleIDs_begin() const;
136 std::vector<edm4hep::ParticleID>::const_iterator particleIDs_end() const;
137 podio::RelationRange<edm4hep::ParticleID> getParticleIDs() const;
138 std::size_t shapeParameters_size() const;
139 float getShapeParameters(std::size_t) const;
140 std::vector<float>::const_iterator shapeParameters_begin() const;
141 std::vector<float>::const_iterator shapeParameters_end() const;
142 podio::RelationRange<float> getShapeParameters() const;
143 std::size_t hitContributions_size() const;
144 float getHitContributions(std::size_t) const;
145 std::vector<float>::const_iterator hitContributions_begin() const;
146 std::vector<float>::const_iterator hitContributions_end() const;
147 podio::RelationRange<float> getHitContributions() const;
148 std::size_t subdetectorEnergies_size() const;
149 float getSubdetectorEnergies(std::size_t) const;
150 std::vector<float>::const_iterator subdetectorEnergies_begin() const;
151 std::vector<float>::const_iterator subdetectorEnergies_end() const;
152 podio::RelationRange<float> getSubdetectorEnergies() const;
153
154
155 /// check whether the object is actually available
156 bool isAvailable() const;
157 /// disconnect from ClusterObj instance
158 void unlink() { m_obj = podio::utils::MaybeSharedPtr<ClusterObj>{nullptr}; }
159
160 bool operator==(const Cluster& other) const { return m_obj == other.m_obj; }
161 bool operator==(const MutableCluster& other) const;
162
163 bool operator!=(const Cluster& other) const { return !(*this == other); }
164 bool operator!=(const MutableCluster& other) const { return !(*this == other); }
165
166 // less comparison operator, so that objects can be e.g. stored in sets.
167 bool operator<(const Cluster& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
168
169 podio::ObjectID id() const { return getObjectID(); }
170
171 const podio::ObjectID getObjectID() const;
172
173 friend void swap(Cluster& a, Cluster& b) {
174 using std::swap;
175 swap(a.m_obj, b.m_obj); // swap out the internal pointers
176 }
177
178private:
179 /// constructor from existing ClusterObj
180 explicit Cluster(podio::utils::MaybeSharedPtr<ClusterObj> obj);
181 Cluster(ClusterObj* obj);
182
183 podio::utils::MaybeSharedPtr<ClusterObj> m_obj{nullptr};
184};
185
186std::ostream& operator<<(std::ostream& o, const Cluster& value);
187
188#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
189void to_json(nlohmann::json& j, const Cluster& value);
190#endif
191
192
193} // namespace edm4eic
194
195
196#endif
Definition CalorimeterHit.h:46
Definition ClusterCollectionData.h:32
Definition ClusterCollection.h:91
Definition ClusterCollection.h:36
Definition Cluster.h:48
std::size_t particleIDs_size() const
Definition Cluster.cc:218
static constexpr auto typeName
Definition Cluster.h:86
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:167
std::vector< float >::const_iterator hitContributions_end() const
Definition Cluster.cc:276
bool operator==(const Cluster &other) const
Definition Cluster.h:160
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:158
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
Cluster & operator=(Cluster other)
copy-assignment operator
Definition Cluster.cc:38
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 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
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:163
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 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:169
~Cluster()=default
destructor
std::int32_t getType() const
Access the Flag-word that defines the type of the cluster.
Definition Cluster.cc:128
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:164
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:173
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