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 /// move constructor
67
68 /// copy-assignment operator
69 MutableReconstructedParticle& operator=(MutableReconstructedParticle other) &; // Rebind this to other's internal object
70 MutableReconstructedParticle& operator=(MutableReconstructedParticle other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
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 MutableReconstructedParticle clone(bool cloneRelations=true) const;
75
76 /// destructor
78
79
80public:
81
82 /// Access the type of reconstructed particle. Check/set collection parameters ReconstructedParticleTypeNames and ReconstructedParticleTypeValues.
83 std::int32_t getType() const;
84
85 /// Access the [GeV] energy of the reconstructed particle. Four momentum state is not kept consistent internally.
86 float getEnergy() const;
87
88 /// Access the [GeV] particle momentum. Four momentum state is not kept consistent internally.
89 const edm4hep::Vector3f& getMomentum() const;
90
91 /// Access the [mm] reference, i.e. where the particle has been measured
92 const edm4hep::Vector3f& getReferencePoint() const;
93
94 /// Access the charge of the reconstructed particle.
95 float getCharge() const;
96
97 /// Access the [GeV] mass of the reconstructed particle, set independently from four vector. Four momentum state is not kept consistent internally.
98 float getMass() const;
99
100 /// Access the overall goodness of the PID on a scale of [0;1]
101 float getGoodnessOfPID() const;
102
103 /// Access the covariance matrix of the reconstructed particle 4vector (10 parameters).
104 const edm4eic::Cov4f& getCovMatrix() const;
105
106 /// Access the PDG code for this particle
107 std::int32_t getPDG() const;
108
109
110 /// Access the Start vertex associated to this particle
111 const edm4eic::Vertex getStartVertex() const;
112 /// Access the particle ID used for the kinematics of this particle
113 const edm4hep::ParticleID getParticleIDUsed() const;
114
115 /// Set the type of reconstructed particle. Check/set collection parameters ReconstructedParticleTypeNames and ReconstructedParticleTypeValues.
116 void setType(const std::int32_t type);
117 /// Get mutable reference to type of reconstructed particle. Check/set collection parameters ReconstructedParticleTypeNames and ReconstructedParticleTypeValues.
118 std::int32_t& getType();
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
125 /// Set the [GeV] particle momentum. Four momentum state is not kept consistent internally.
126 void setMomentum(const edm4hep::Vector3f& momentum);
127 /// Get mutable reference to [GeV] particle momentum. Four momentum state is not kept consistent internally.
128 edm4hep::Vector3f& getMomentum();
129
130 /// Set the [mm] reference, i.e. where the particle has been measured
131 void setReferencePoint(const edm4hep::Vector3f& referencePoint);
132 /// Get mutable reference to [mm] reference, i.e. where the particle has been measured
133 edm4hep::Vector3f& getReferencePoint();
134
135 /// Set the charge of the reconstructed particle.
136 void setCharge(const float charge);
137 /// Get mutable reference to charge of the reconstructed particle.
138 float& getCharge();
139
140 /// Set the [GeV] mass of the reconstructed particle, set independently from four vector. Four momentum state is not kept consistent internally.
141 void setMass(const float mass);
142 /// Get mutable reference to [GeV] mass of the reconstructed particle, set independently from four vector. Four momentum state is not kept consistent internally.
143 float& getMass();
144
145 /// Set the overall goodness of the PID on a scale of [0;1]
146 void setGoodnessOfPID(const float goodnessOfPID);
147 /// Get mutable reference to overall goodness of the PID on a scale of [0;1]
148 float& getGoodnessOfPID();
149
150 /// Set the covariance matrix of the reconstructed particle 4vector (10 parameters).
151 void setCovMatrix(const edm4eic::Cov4f& covMatrix);
152 /// Get mutable reference to covariance matrix of the reconstructed particle 4vector (10 parameters).
154
155 /// Set the PDG code for this particle
156 void setPDG(const std::int32_t PDG);
157 /// Get mutable reference to PDG code for this particle
158 std::int32_t& getPDG();
159
160
161 /// Set the Start vertex associated to this particle
162 void setStartVertex(const edm4eic::Vertex& value);
163 /// Set the particle ID used for the kinematics of this particle
164 void setParticleIDUsed(const edm4hep::ParticleID& value);
165
166 void addToClusters(const edm4eic::Cluster&);
167 std::size_t clusters_size() const;
168 edm4eic::Cluster getClusters(std::size_t) const;
169 std::vector<edm4eic::Cluster>::const_iterator clusters_begin() const;
170 std::vector<edm4eic::Cluster>::const_iterator clusters_end() const;
171 podio::RelationRange<edm4eic::Cluster> getClusters() const;
172 void addToTracks(const edm4eic::Track&);
173 std::size_t tracks_size() const;
174 edm4eic::Track getTracks(std::size_t) const;
175 std::vector<edm4eic::Track>::const_iterator tracks_begin() const;
176 std::vector<edm4eic::Track>::const_iterator tracks_end() const;
177 podio::RelationRange<edm4eic::Track> getTracks() const;
179 std::size_t particles_size() const;
181 std::vector<edm4eic::ReconstructedParticle>::const_iterator particles_begin() const;
182 std::vector<edm4eic::ReconstructedParticle>::const_iterator particles_end() const;
183 podio::RelationRange<edm4eic::ReconstructedParticle> getParticles() const;
184 void addToParticleIDs(const edm4hep::ParticleID&);
185 std::size_t particleIDs_size() const;
186 edm4hep::ParticleID getParticleIDs(std::size_t) const;
187 std::vector<edm4hep::ParticleID>::const_iterator particleIDs_begin() const;
188 std::vector<edm4hep::ParticleID>::const_iterator particleIDs_end() const;
189 podio::RelationRange<edm4hep::ParticleID> getParticleIDs() const;
190
191 bool isCompound() const {return particles_size() > 0;}
192
193
194
195 /// check whether the object is actually available
196 bool isAvailable() const;
197 /// disconnect from ReconstructedParticleObj instance
198 void unlink() { m_obj = podio::utils::MaybeSharedPtr<ReconstructedParticleObj>{nullptr}; }
199
200 constexpr bool operator==(const MutableReconstructedParticle& other) const { return m_obj == other.m_obj; }
201 bool operator==(const ReconstructedParticle& other) const;
202
203 constexpr bool operator!=(const MutableReconstructedParticle& other) const { return !(*this == other); }
204 bool operator!=(const ReconstructedParticle& other) const { return !(*this == other); }
205
206 // less comparison operator, so that objects can be e.g. stored in sets.
208
209 podio::ObjectID id() const { return getObjectID(); }
210
211 const podio::ObjectID getObjectID() const;
212
213 friend std::hash<MutableReconstructedParticle>;
214
216 using std::swap;
217 swap(a.m_obj, b.m_obj); // swap out the internal pointers
218 }
219
220private:
221 /// constructor from existing ReconstructedParticleObj
222 explicit MutableReconstructedParticle(podio::utils::MaybeSharedPtr<ReconstructedParticleObj> obj);
223
224 podio::utils::MaybeSharedPtr<ReconstructedParticleObj> m_obj{new ReconstructedParticleObj{}, podio::utils::MarkOwned};
225};
226
227#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
228void to_json(nlohmann::json& j, const MutableReconstructedParticle& value);
229#endif
230
231
232} // namespace edm4eic
233
234
235
236template<>
237struct std::hash<edm4eic::MutableReconstructedParticle> {
238 std::size_t operator()(const edm4eic::MutableReconstructedParticle& obj) const {
239 return std::hash<edm4eic::ReconstructedParticleObj*>{}(obj.m_obj.get());
240 }
241};
242
243
244#endif
Definition Cluster.h:49
Definition Cov4f.h:19
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:90
std::size_t clusters_size() const
Definition MutableReconstructedParticle.cc:129
const edm4eic::Vertex getStartVertex() const
Access the Start vertex associated to this particle.
Definition MutableReconstructedParticle.cc:69
void addToParticleIDs(const edm4hep::ParticleID &)
Definition MutableReconstructedParticle.cc:220
void unlink()
disconnect from ReconstructedParticleObj instance
Definition MutableReconstructedParticle.h:198
bool isCompound() const
Definition MutableReconstructedParticle.h:191
std::vector< edm4eic::Track >::const_iterator tracks_begin() const
Definition MutableReconstructedParticle.cc:153
void addToTracks(const edm4eic::Track &)
Definition MutableReconstructedParticle.cc:148
MutableReconstructedParticle clone(bool cloneRelations=true) const
Definition MutableReconstructedParticle.cc:37
void setGoodnessOfPID(const float goodnessOfPID)
Set the overall goodness of the PID on a scale of [0;1].
Definition MutableReconstructedParticle.cc:96
podio::ObjectID id() const
Definition MutableReconstructedParticle.h:209
friend class ReconstructedParticleCollection
Definition MutableReconstructedParticle.h:48
MutableReconstructedParticle & operator=(MutableReconstructedParticle other) &&=delete
std::size_t particleIDs_size() const
Definition MutableReconstructedParticle.cc:237
MutableReconstructedParticle & operator=(MutableReconstructedParticle other) &
copy-assignment operator
Definition MutableReconstructedParticle.cc:32
std::vector< edm4eic::Cluster >::const_iterator clusters_begin() const
Definition MutableReconstructedParticle.cc:117
const edm4hep::Vector3f & getMomentum() const
Access the [GeV] particle momentum. Four momentum state is not kept consistent internally.
Definition MutableReconstructedParticle.cc:61
void setCharge(const float charge)
Set the charge of the reconstructed particle.
Definition MutableReconstructedParticle.cc:92
float getEnergy() const
Access the [GeV] energy of the reconstructed particle. Four momentum state is not kept consistent int...
Definition MutableReconstructedParticle.cc:60
std::vector< edm4eic::ReconstructedParticle >::const_iterator particles_begin() const
Definition MutableReconstructedParticle.cc:189
void setMomentum(const edm4hep::Vector3f &momentum)
Set the [GeV] particle momentum. Four momentum state is not kept consistent internally.
Definition MutableReconstructedParticle.cc:88
bool operator<(const MutableReconstructedParticle &other) const
Definition MutableReconstructedParticle.h:207
std::vector< edm4hep::ParticleID >::const_iterator particleIDs_end() const
Definition MutableReconstructedParticle.cc:231
std::int32_t getPDG() const
Access the PDG code for this particle.
Definition MutableReconstructedParticle.cc:67
const edm4hep::Vector3f & getReferencePoint() const
Access the [mm] reference, i.e. where the particle has been measured.
Definition MutableReconstructedParticle.cc:62
std::vector< edm4eic::Track >::const_iterator tracks_end() const
Definition MutableReconstructedParticle.cc:159
MutableReconstructedParticle(MutableReconstructedParticle &&other) noexcept=default
move constructor
const podio::ObjectID getObjectID() const
Definition MutableReconstructedParticle.cc:265
float getGoodnessOfPID() const
Access the overall goodness of the PID on a scale of [0;1].
Definition MutableReconstructedParticle.cc:65
constexpr bool operator==(const MutableReconstructedParticle &other) const
Definition MutableReconstructedParticle.h:200
std::vector< edm4eic::Cluster >::const_iterator clusters_end() const
Definition MutableReconstructedParticle.cc:123
MutableReconstructedParticle()=default
default constructor
void setCovMatrix(const edm4eic::Cov4f &covMatrix)
Set the covariance matrix of the reconstructed particle 4vector (10 parameters).
Definition MutableReconstructedParticle.cc:98
const edm4eic::Cov4f & getCovMatrix() const
Access the covariance matrix of the reconstructed particle 4vector (10 parameters).
Definition MutableReconstructedParticle.cc:66
podio::RelationRange< edm4eic::Cluster > getClusters() const
Definition MutableReconstructedParticle.cc:140
void setParticleIDUsed(const edm4hep::ParticleID &value)
Set the particle ID used for the kinematics of this particle.
Definition MutableReconstructedParticle.cc:107
~MutableReconstructedParticle()=default
destructor
bool isAvailable() const
check whether the object is actually available
Definition MutableReconstructedParticle.cc:261
std::size_t tracks_size() const
Definition MutableReconstructedParticle.cc:165
podio::RelationRange< edm4eic::ReconstructedParticle > getParticles() const
Definition MutableReconstructedParticle.cc:212
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:59
void setEnergy(const float energy)
Set the [GeV] energy of the reconstructed particle. Four momentum state is not kept consistent intern...
Definition MutableReconstructedParticle.cc:86
float getMass() const
Access the [GeV] mass of the reconstructed particle, set independently from four vector....
Definition MutableReconstructedParticle.cc:64
std::vector< edm4hep::ParticleID >::const_iterator particleIDs_begin() const
Definition MutableReconstructedParticle.cc:225
const edm4hep::ParticleID getParticleIDUsed() const
Access the particle ID used for the kinematics of this particle.
Definition MutableReconstructedParticle.cc:76
ReconstructedParticleCollection collection_type
Definition MutableReconstructedParticle.h:54
std::size_t particles_size() const
Definition MutableReconstructedParticle.cc:201
friend class ReconstructedParticle
Definition MutableReconstructedParticle.h:50
void setPDG(const std::int32_t PDG)
Set the PDG code for this particle.
Definition MutableReconstructedParticle.cc:100
MutableReconstructedParticle(const MutableReconstructedParticle &other) noexcept=default
copy constructor
std::vector< edm4eic::ReconstructedParticle >::const_iterator particles_end() const
Definition MutableReconstructedParticle.cc:195
friend void swap(MutableReconstructedParticle &a, MutableReconstructedParticle &b)
Definition MutableReconstructedParticle.h:215
float getCharge() const
Access the charge of the reconstructed particle.
Definition MutableReconstructedParticle.cc:63
void setType(const std::int32_t type)
Set the type of reconstructed particle. Check/set collection parameters ReconstructedParticleTypeName...
Definition MutableReconstructedParticle.cc:84
bool operator!=(const ReconstructedParticle &other) const
Definition MutableReconstructedParticle.h:204
void addToParticles(const edm4eic::ReconstructedParticle &)
Definition MutableReconstructedParticle.cc:184
constexpr bool operator!=(const MutableReconstructedParticle &other) const
Definition MutableReconstructedParticle.h:203
podio::RelationRange< edm4eic::Track > getTracks() const
Definition MutableReconstructedParticle.cc:176
void setStartVertex(const edm4eic::Vertex &value)
Set the Start vertex associated to this particle.
Definition MutableReconstructedParticle.cc:103
podio::RelationRange< edm4hep::ParticleID > getParticleIDs() const
Definition MutableReconstructedParticle.cc:248
void addToClusters(const edm4eic::Cluster &)
Definition MutableReconstructedParticle.cc:112
void setMass(const float mass)
Set the [GeV] mass of the reconstructed particle, set independently from four vector....
Definition MutableReconstructedParticle.cc:94
Definition MutableVertex.h:38
Definition ReconstructedParticleCollection.h:139
Definition ReconstructedParticle.h:54
Definition ReconstructedParticleObj.h:29
Definition Track.h:48
Definition Vertex.h:46
Definition ArrowMapper.cc:63
Definition CalorimeterHit.h:25
OrderKey getOrderKey(const edm4eic::CalorimeterHit &obj)
Definition CalorimeterHit.cc:146
std::size_t operator()(const edm4eic::MutableReconstructedParticle &obj) const
Definition MutableReconstructedParticle.h:238