EDM4eic
EIC data model
Loading...
Searching...
No Matches
MutableReconstructedParticle.h
Go to the documentation of this file.
1// AUTOMATICALLY GENERATED FILE - DO NOT EDIT
2
3#ifndef EDM4EIC_MutableReconstructedParticle_H
4#define EDM4EIC_MutableReconstructedParticle_H
5
7// Make the immutable class available from its mutable version but not vice versa
9
10#include "edm4eic/Cluster.h"
11#include "edm4eic/Cov4f.h"
12#include "edm4eic/Track.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 {
30class Vertex;
31class MutableVertex;
32}
33namespace edm4hep {
34class ParticleID;
35class MutableParticleID;
36}
37
38
39namespace edm4eic {
40
41
42/** @class MutableReconstructedParticle
43 * EIC Reconstructed Particle
44 * @author: W. Armstrong, S. Joosten, F. Gaede
45 */
47
51
52public:
55
56 /// default constructor
58
59 /// Constructor initializing all members
60 MutableReconstructedParticle(const std::int32_t type, const float energy, const edm4hep::Vector3f& momentum, const edm4hep::Vector3f& referencePoint, const float charge, const float mass, const float goodnessOfPID, const edm4eic::Cov4f& covMatrix, const std::int32_t PDG);
61
62 /// copy constructor
64
65 /// copy-assignment operator
66 MutableReconstructedParticle& operator=(MutableReconstructedParticle other) &; // Rebind this to other's internal object
67 MutableReconstructedParticle& operator=(MutableReconstructedParticle 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 MutableReconstructedParticle clone(bool cloneRelations=true) const;
72
73 /// destructor
75
76
77public:
78
79 /// Access the type of reconstructed particle. Check/set collection parameters ReconstructedParticleTypeNames and ReconstructedParticleTypeValues.
80 std::int32_t getType() const;
81
82 /// Access the [GeV] energy of the reconstructed particle. Four momentum state is not kept consistent internally.
83 float getEnergy() const;
84
85 /// Access the [GeV] particle momentum. Four momentum state is not kept consistent internally.
86 const edm4hep::Vector3f& getMomentum() const;
87
88 /// Access the [mm] reference, i.e. where the particle has been measured
89 const edm4hep::Vector3f& getReferencePoint() const;
90
91 /// Access the charge of the reconstructed particle.
92 float getCharge() const;
93
94 /// Access the [GeV] mass of the reconstructed particle, set independently from four vector. Four momentum state is not kept consistent internally.
95 float getMass() const;
96
97 /// Access the overall goodness of the PID on a scale of [0;1]
98 float getGoodnessOfPID() const;
99
100 /// Access the covariance matrix of the reconstructed particle 4vector (10 parameters).
101 const edm4eic::Cov4f& getCovMatrix() const;
102
103 /// Access the PDG code for this particle
104 std::int32_t getPDG() const;
105
106
107 /// Access the Start vertex associated to this particle
108 const edm4eic::Vertex getStartVertex() const;
109 /// Access the particle ID used for the kinematics of this particle
110 const edm4hep::ParticleID getParticleIDUsed() const;
111
112 /// Set the type of reconstructed particle. Check/set collection parameters ReconstructedParticleTypeNames and ReconstructedParticleTypeValues.
113 void setType(const std::int32_t type);
114 /// Get mutable reference to type of reconstructed particle. Check/set collection parameters ReconstructedParticleTypeNames and ReconstructedParticleTypeValues.
115 std::int32_t& getType();
116 /// Get reference to type of reconstructed particle. Check/set collection parameters ReconstructedParticleTypeNames and ReconstructedParticleTypeValues.
117 [[deprecated("use getType instead")]]
118 std::int32_t& type();
119
120 /// Set the [GeV] energy of the reconstructed particle. Four momentum state is not kept consistent internally.
121 void setEnergy(const float energy);
122 /// Get mutable reference to [GeV] energy of the reconstructed particle. Four momentum state is not kept consistent internally.
123 float& getEnergy();
124 /// Get reference to [GeV] energy of the reconstructed particle. Four momentum state is not kept consistent internally.
125 [[deprecated("use getEnergy instead")]]
126 float& energy();
127
128 /// Set the [GeV] particle momentum. Four momentum state is not kept consistent internally.
129 void setMomentum(const edm4hep::Vector3f& momentum);
130 /// Get mutable reference to [GeV] particle momentum. Four momentum state is not kept consistent internally.
131 edm4hep::Vector3f& getMomentum();
132 /// Get reference to [GeV] particle momentum. Four momentum state is not kept consistent internally.
133 [[deprecated("use getMomentum instead")]]
134 edm4hep::Vector3f& momentum();
135
136 /// Set the [mm] reference, i.e. where the particle has been measured
137 void setReferencePoint(const edm4hep::Vector3f& referencePoint);
138 /// Get mutable reference to [mm] reference, i.e. where the particle has been measured
139 edm4hep::Vector3f& getReferencePoint();
140 /// Get reference to [mm] reference, i.e. where the particle has been measured
141 [[deprecated("use getReferencePoint instead")]]
142 edm4hep::Vector3f& referencePoint();
143
144 /// Set the charge of the reconstructed particle.
145 void setCharge(const float charge);
146 /// Get mutable reference to charge of the reconstructed particle.
147 float& getCharge();
148 /// Get reference to charge of the reconstructed particle.
149 [[deprecated("use getCharge instead")]]
150 float& charge();
151
152 /// Set the [GeV] mass of the reconstructed particle, set independently from four vector. Four momentum state is not kept consistent internally.
153 void setMass(const float mass);
154 /// Get mutable reference to [GeV] mass of the reconstructed particle, set independently from four vector. Four momentum state is not kept consistent internally.
155 float& getMass();
156 /// Get reference to [GeV] mass of the reconstructed particle, set independently from four vector. Four momentum state is not kept consistent internally.
157 [[deprecated("use getMass instead")]]
158 float& mass();
159
160 /// Set the overall goodness of the PID on a scale of [0;1]
161 void setGoodnessOfPID(const float goodnessOfPID);
162 /// Get mutable reference to overall goodness of the PID on a scale of [0;1]
163 float& getGoodnessOfPID();
164 /// Get reference to overall goodness of the PID on a scale of [0;1]
165 [[deprecated("use getGoodnessOfPID instead")]]
166 float& goodnessOfPID();
167
168 /// Set the covariance matrix of the reconstructed particle 4vector (10 parameters).
170 /// Get mutable reference to covariance matrix of the reconstructed particle 4vector (10 parameters).
172 /// Get reference to covariance matrix of the reconstructed particle 4vector (10 parameters).
173 [[deprecated("use getCovMatrix instead")]]
175
176 /// Set the PDG code for this particle
177 void setPDG(const std::int32_t PDG);
178 /// Get mutable reference to PDG code for this particle
179 std::int32_t& getPDG();
180 /// Get reference to PDG code for this particle
181 [[deprecated("use getPDG instead")]]
182 std::int32_t& PDG();
183
184
185 /// Set the Start vertex associated to this particle
186 void setStartVertex(const edm4eic::Vertex& value);
187 /// Set the particle ID used for the kinematics of this particle
188 void setParticleIDUsed(const edm4hep::ParticleID& value);
189
190 void addToClusters(const edm4eic::Cluster&);
191 std::size_t clusters_size() const;
192 edm4eic::Cluster getClusters(std::size_t) const;
193 std::vector<edm4eic::Cluster>::const_iterator clusters_begin() const;
194 std::vector<edm4eic::Cluster>::const_iterator clusters_end() const;
195 podio::RelationRange<edm4eic::Cluster> getClusters() const;
196 void addToTracks(const edm4eic::Track&);
197 std::size_t tracks_size() const;
198 edm4eic::Track getTracks(std::size_t) const;
199 std::vector<edm4eic::Track>::const_iterator tracks_begin() const;
200 std::vector<edm4eic::Track>::const_iterator tracks_end() const;
201 podio::RelationRange<edm4eic::Track> getTracks() const;
203 std::size_t particles_size() const;
205 std::vector<edm4eic::ReconstructedParticle>::const_iterator particles_begin() const;
206 std::vector<edm4eic::ReconstructedParticle>::const_iterator particles_end() const;
207 podio::RelationRange<edm4eic::ReconstructedParticle> getParticles() const;
208 void addToParticleIDs(const edm4hep::ParticleID&);
209 std::size_t particleIDs_size() const;
210 edm4hep::ParticleID getParticleIDs(std::size_t) const;
211 std::vector<edm4hep::ParticleID>::const_iterator particleIDs_begin() const;
212 std::vector<edm4hep::ParticleID>::const_iterator particleIDs_end() const;
213 podio::RelationRange<edm4hep::ParticleID> getParticleIDs() const;
214
215 bool isCompound() const {return particles_size() > 0;}
216
217
218
219 /// check whether the object is actually available
220 bool isAvailable() const;
221 /// disconnect from ReconstructedParticleObj instance
222 void unlink() { m_obj = podio::utils::MaybeSharedPtr<ReconstructedParticleObj>{nullptr}; }
223
224 bool operator==(const MutableReconstructedParticle& other) const { return m_obj == other.m_obj; }
225 bool operator==(const ReconstructedParticle& other) const;
226
227 bool operator!=(const MutableReconstructedParticle& other) const { return !(*this == other); }
228 bool operator!=(const ReconstructedParticle& other) const { return !(*this == other); }
229
230 // less comparison operator, so that objects can be e.g. stored in sets.
232
233 podio::ObjectID id() const { return getObjectID(); }
234
235 const podio::ObjectID getObjectID() const;
236
237 friend std::hash<MutableReconstructedParticle>;
238
240 using std::swap;
241 swap(a.m_obj, b.m_obj); // swap out the internal pointers
242 }
243
244private:
245 /// constructor from existing ReconstructedParticleObj
246 explicit MutableReconstructedParticle(podio::utils::MaybeSharedPtr<ReconstructedParticleObj> obj);
247
248 podio::utils::MaybeSharedPtr<ReconstructedParticleObj> m_obj{nullptr};
249};
250
251#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
252void to_json(nlohmann::json& j, const MutableReconstructedParticle& value);
253#endif
254
255
256} // namespace edm4eic
257
258
259
260template<>
261struct std::hash<edm4eic::MutableReconstructedParticle> {
262 std::size_t operator()(const edm4eic::MutableReconstructedParticle& obj) const {
263 return std::hash<edm4eic::ReconstructedParticleObj*>{}(obj.m_obj.get());
264 }
265};
266
267
268#endif
Definition Cluster.h:48
Definition Cov4f.h:18
Definition MutableReconstructedParticle.h:46
ReconstructedParticle object_type
Definition MutableReconstructedParticle.h:53
void setReferencePoint(const edm4hep::Vector3f &referencePoint)
Set the [mm] reference, i.e. where the particle has been measured.
Definition MutableReconstructedParticle.cc:97
std::size_t clusters_size() const
Definition MutableReconstructedParticle.cc:142
const edm4eic::Vertex getStartVertex() const
Access the Start vertex associated to this particle.
Definition MutableReconstructedParticle.cc:73
void addToParticleIDs(const edm4hep::ParticleID &)
Definition MutableReconstructedParticle.cc:233
void unlink()
disconnect from ReconstructedParticleObj instance
Definition MutableReconstructedParticle.h:222
bool isCompound() const
Definition MutableReconstructedParticle.h:215
std::vector< edm4eic::Track >::const_iterator tracks_begin() const
Definition MutableReconstructedParticle.cc:166
void addToTracks(const edm4eic::Track &)
Definition MutableReconstructedParticle.cc:161
MutableReconstructedParticle clone(bool cloneRelations=true) const
Definition MutableReconstructedParticle.cc:41
void setGoodnessOfPID(const float goodnessOfPID)
Set the overall goodness of the PID on a scale of [0;1].
Definition MutableReconstructedParticle.cc:106
podio::ObjectID id() const
Definition MutableReconstructedParticle.h:233
friend class ReconstructedParticleCollection
Definition MutableReconstructedParticle.h:48
MutableReconstructedParticle & operator=(MutableReconstructedParticle other) &&=delete
std::size_t particleIDs_size() const
Definition MutableReconstructedParticle.cc:250
MutableReconstructedParticle & operator=(MutableReconstructedParticle other) &
copy-assignment operator
Definition MutableReconstructedParticle.cc:36
std::vector< edm4eic::Cluster >::const_iterator clusters_begin() const
Definition MutableReconstructedParticle.cc:130
const edm4hep::Vector3f & getMomentum() const
Access the [GeV] particle momentum. Four momentum state is not kept consistent internally.
Definition MutableReconstructedParticle.cc:65
void setCharge(const float charge)
Set the charge of the reconstructed particle.
Definition MutableReconstructedParticle.cc:100
edm4eic::Cov4f & covMatrix()
Get reference to covariance matrix of the reconstructed particle 4vector (10 parameters).
Definition MutableReconstructedParticle.cc:111
float getEnergy() const
Access the [GeV] energy of the reconstructed particle. Four momentum state is not kept consistent int...
Definition MutableReconstructedParticle.cc:64
std::vector< edm4eic::ReconstructedParticle >::const_iterator particles_begin() const
Definition MutableReconstructedParticle.cc:202
float & goodnessOfPID()
Get reference to overall goodness of the PID on a scale of [0;1].
Definition MutableReconstructedParticle.cc:108
void setMomentum(const edm4hep::Vector3f &momentum)
Set the [GeV] particle momentum. Four momentum state is not kept consistent internally.
Definition MutableReconstructedParticle.cc:94
bool operator<(const MutableReconstructedParticle &other) const
Definition MutableReconstructedParticle.h:231
std::vector< edm4hep::ParticleID >::const_iterator particleIDs_end() const
Definition MutableReconstructedParticle.cc:244
std::int32_t getPDG() const
Access the PDG code for this particle.
Definition MutableReconstructedParticle.cc:71
float & mass()
Get reference to [GeV] mass of the reconstructed particle, set independently from four vector....
Definition MutableReconstructedParticle.cc:105
const edm4hep::Vector3f & getReferencePoint() const
Access the [mm] reference, i.e. where the particle has been measured.
Definition MutableReconstructedParticle.cc:66
float & charge()
Get reference to charge of the reconstructed particle.
Definition MutableReconstructedParticle.cc:102
std::vector< edm4eic::Track >::const_iterator tracks_end() const
Definition MutableReconstructedParticle.cc:172
const podio::ObjectID getObjectID() const
Definition MutableReconstructedParticle.cc:278
float getGoodnessOfPID() const
Access the overall goodness of the PID on a scale of [0;1].
Definition MutableReconstructedParticle.cc:69
bool operator==(const MutableReconstructedParticle &other) const
Definition MutableReconstructedParticle.h:224
std::vector< edm4eic::Cluster >::const_iterator clusters_end() const
Definition MutableReconstructedParticle.cc:136
void setCovMatrix(const edm4eic::Cov4f &covMatrix)
Set the covariance matrix of the reconstructed particle 4vector (10 parameters).
Definition MutableReconstructedParticle.cc:109
const edm4eic::Cov4f & getCovMatrix() const
Access the covariance matrix of the reconstructed particle 4vector (10 parameters).
Definition MutableReconstructedParticle.cc:70
podio::RelationRange< edm4eic::Cluster > getClusters() const
Definition MutableReconstructedParticle.cc:153
MutableReconstructedParticle()
default constructor
Definition MutableReconstructedParticle.cc:20
void setParticleIDUsed(const edm4hep::ParticleID &value)
Set the particle ID used for the kinematics of this particle.
Definition MutableReconstructedParticle.cc:120
std::int32_t & PDG()
Get reference to PDG code for this particle.
Definition MutableReconstructedParticle.cc:114
bool operator!=(const MutableReconstructedParticle &other) const
Definition MutableReconstructedParticle.h:227
std::int32_t & type()
Get reference to type of reconstructed particle. Check/set collection parameters ReconstructedParticl...
Definition MutableReconstructedParticle.cc:90
~MutableReconstructedParticle()=default
destructor
bool isAvailable() const
check whether the object is actually available
Definition MutableReconstructedParticle.cc:274
std::size_t tracks_size() const
Definition MutableReconstructedParticle.cc:178
podio::RelationRange< edm4eic::ReconstructedParticle > getParticles() const
Definition MutableReconstructedParticle.cc:225
edm4hep::Vector3f & referencePoint()
Get reference to [mm] reference, i.e. where the particle has been measured.
Definition MutableReconstructedParticle.cc:99
friend class ReconstructedParticleMutableCollectionIterator
Definition MutableReconstructedParticle.h:49
std::int32_t getType() const
Access the type of reconstructed particle. Check/set collection parameters ReconstructedParticleTypeN...
Definition MutableReconstructedParticle.cc:63
void setEnergy(const float energy)
Set the [GeV] energy of the reconstructed particle. Four momentum state is not kept consistent intern...
Definition MutableReconstructedParticle.cc:91
float getMass() const
Access the [GeV] mass of the reconstructed particle, set independently from four vector....
Definition MutableReconstructedParticle.cc:68
std::vector< edm4hep::ParticleID >::const_iterator particleIDs_begin() const
Definition MutableReconstructedParticle.cc:238
float & energy()
Get reference to [GeV] energy of the reconstructed particle. Four momentum state is not kept consiste...
Definition MutableReconstructedParticle.cc:93
const edm4hep::ParticleID getParticleIDUsed() const
Access the particle ID used for the kinematics of this particle.
Definition MutableReconstructedParticle.cc:80
MutableReconstructedParticle(const MutableReconstructedParticle &other)=default
copy constructor
ReconstructedParticleCollection collection_type
Definition MutableReconstructedParticle.h:54
std::size_t particles_size() const
Definition MutableReconstructedParticle.cc:214
friend class ReconstructedParticle
Definition MutableReconstructedParticle.h:50
edm4hep::Vector3f & momentum()
Get reference to [GeV] particle momentum. Four momentum state is not kept consistent internally.
Definition MutableReconstructedParticle.cc:96
void setPDG(const std::int32_t PDG)
Set the PDG code for this particle.
Definition MutableReconstructedParticle.cc:112
std::vector< edm4eic::ReconstructedParticle >::const_iterator particles_end() const
Definition MutableReconstructedParticle.cc:208
friend void swap(MutableReconstructedParticle &a, MutableReconstructedParticle &b)
Definition MutableReconstructedParticle.h:239
float getCharge() const
Access the charge of the reconstructed particle.
Definition MutableReconstructedParticle.cc:67
void setType(const std::int32_t type)
Set the type of reconstructed particle. Check/set collection parameters ReconstructedParticleTypeName...
Definition MutableReconstructedParticle.cc:88
bool operator!=(const ReconstructedParticle &other) const
Definition MutableReconstructedParticle.h:228
void addToParticles(const edm4eic::ReconstructedParticle &)
Definition MutableReconstructedParticle.cc:197
podio::RelationRange< edm4eic::Track > getTracks() const
Definition MutableReconstructedParticle.cc:189
void setStartVertex(const edm4eic::Vertex &value)
Set the Start vertex associated to this particle.
Definition MutableReconstructedParticle.cc:116
podio::RelationRange< edm4hep::ParticleID > getParticleIDs() const
Definition MutableReconstructedParticle.cc:261
void addToClusters(const edm4eic::Cluster &)
Definition MutableReconstructedParticle.cc:125
void setMass(const float mass)
Set the [GeV] mass of the reconstructed particle, set independently from four vector....
Definition MutableReconstructedParticle.cc:103
Definition MutableVertex.h:38
Definition ReconstructedParticleCollection.h:137
Definition ReconstructedParticle.h:54
Definition Track.h:48
Definition Vertex.h:46
Definition CalorimeterHit.cc:17
Definition CalorimeterHit.h:25
OrderKey getOrderKey(const edm4eic::CalorimeterHit &obj)
Definition CalorimeterHit.cc:150
std::size_t operator()(const edm4eic::MutableReconstructedParticle &obj) const
Definition MutableReconstructedParticle.h:262