EDM4eic
EIC data model
Loading...
Searching...
No Matches
ReconstructedParticle.h
Go to the documentation of this file.
1// AUTOMATICALLY GENERATED FILE - DO NOT EDIT
2
3#ifndef EDM4EIC_ReconstructedParticle_H
4#define EDM4EIC_ReconstructedParticle_H
5
7
8#include "edm4eic/Cluster.h"
9#include "edm4eic/Cov4f.h"
10#include "edm4eic/Track.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 {
30class Vertex;
31class MutableVertex;
32}
33namespace edm4hep {
34class ParticleID;
35class MutableParticleID;
36}
37
38
39namespace podio::detail {
40// Internal function used in less comparison operators of the datatypes and interface types
41OrderKey getOrderKey(const edm4eic::ReconstructedParticle& obj);
42};
43
44namespace edm4eic {
45
49
50/** @class ReconstructedParticle
51 * EIC Reconstructed Particle
52 * @author: W. Armstrong, S. Joosten, F. Gaede
53 */
55
60 friend podio::detail::OrderKey podio::detail::getOrderKey(const ReconstructedParticle & obj);
61
62public:
65
66 /// default constructor
68
69 /// Constructor initializing all members
70 ReconstructedParticle(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);
71
72 /// copy constructor
73 ReconstructedParticle(const ReconstructedParticle& other) noexcept = default;
74
75 /// move constructor
76 ReconstructedParticle(ReconstructedParticle&& other) noexcept = default;
77
78 /// copy-assignment operator
79 ReconstructedParticle& operator=(ReconstructedParticle other) &; // Rebind this to other's internal object
80 ReconstructedParticle& operator=(ReconstructedParticle other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
81
82 /// create a mutable deep-copy of the object with identical relations
83 /// if cloneRelations=false, the relations are not cloned and will be empty
84 MutableReconstructedParticle clone(bool cloneRelations=true) const;
85
86 /// destructor
88
89 /// converting constructor from mutable object
91
93
94public:
95
96 static constexpr std::string_view typeName = "edm4eic::ReconstructedParticle";
97
98 /// Access the type of reconstructed particle. Check/set collection parameters ReconstructedParticleTypeNames and ReconstructedParticleTypeValues.
99 std::int32_t getType() const;
100
101 /// Access the [GeV] energy of the reconstructed particle. Four momentum state is not kept consistent internally.
102 float getEnergy() const;
103
104 /// Access the [GeV] particle momentum. Four momentum state is not kept consistent internally.
105 const edm4hep::Vector3f& getMomentum() const;
106
107 /// Access the [mm] reference, i.e. where the particle has been measured
108 const edm4hep::Vector3f& getReferencePoint() const;
109
110 /// Access the charge of the reconstructed particle.
111 float getCharge() const;
112
113 /// Access the [GeV] mass of the reconstructed particle, set independently from four vector. Four momentum state is not kept consistent internally.
114 float getMass() const;
115
116 /// Access the overall goodness of the PID on a scale of [0;1]
117 float getGoodnessOfPID() const;
118
119 /// Access the covariance matrix of the reconstructed particle 4vector (10 parameters).
120 const edm4eic::Cov4f& getCovMatrix() const;
121
122 /// Access the PDG code for this particle
123 std::int32_t getPDG() const;
124
125
126 /// Access the Start vertex associated to this particle
127 const edm4eic::Vertex getStartVertex() const;
128 /// Access the particle ID used for the kinematics of this particle
129 const edm4hep::ParticleID getParticleIDUsed() const;
130
131 std::size_t clusters_size() const;
132 edm4eic::Cluster getClusters(std::size_t) const;
133 std::vector<edm4eic::Cluster>::const_iterator clusters_begin() const;
134 std::vector<edm4eic::Cluster>::const_iterator clusters_end() const;
135 podio::RelationRange<edm4eic::Cluster> getClusters() const;
136 std::size_t tracks_size() const;
137 edm4eic::Track getTracks(std::size_t) const;
138 std::vector<edm4eic::Track>::const_iterator tracks_begin() const;
139 std::vector<edm4eic::Track>::const_iterator tracks_end() const;
140 podio::RelationRange<edm4eic::Track> getTracks() const;
141 std::size_t particles_size() const;
143 std::vector<edm4eic::ReconstructedParticle>::const_iterator particles_begin() const;
144 std::vector<edm4eic::ReconstructedParticle>::const_iterator particles_end() const;
145 podio::RelationRange<edm4eic::ReconstructedParticle> getParticles() const;
146 std::size_t particleIDs_size() const;
147 edm4hep::ParticleID getParticleIDs(std::size_t) const;
148 std::vector<edm4hep::ParticleID>::const_iterator particleIDs_begin() const;
149 std::vector<edm4hep::ParticleID>::const_iterator particleIDs_end() const;
150 podio::RelationRange<edm4hep::ParticleID> getParticleIDs() const;
151
152 bool isCompound() const {return particles_size() > 0;}
153
154
155 /// check whether the object is actually available
156 bool isAvailable() const;
157 /// disconnect from ReconstructedParticleObj instance
158 void unlink() { m_obj = podio::utils::MaybeSharedPtr<ReconstructedParticleObj>{nullptr}; }
159
160 constexpr bool operator==(const ReconstructedParticle& other) const { return m_obj == other.m_obj; }
161 bool operator==(const MutableReconstructedParticle& other) const;
162
163 constexpr bool operator!=(const ReconstructedParticle& other) const { return !(*this == other); }
164 bool operator!=(const MutableReconstructedParticle& other) const { return !(*this == other); }
165
166 // less comparison operator, so that objects can be e.g. stored in sets.
168
169 podio::ObjectID id() const { return getObjectID(); }
170
171 const podio::ObjectID getObjectID() const;
172
173 friend std::hash<ReconstructedParticle>;
174
176 using std::swap;
177 swap(a.m_obj, b.m_obj); // swap out the internal pointers
178 }
179
180private:
181 /// constructor from existing ReconstructedParticleObj
182 explicit ReconstructedParticle(podio::utils::MaybeSharedPtr<ReconstructedParticleObj> obj);
184
185 podio::utils::MaybeSharedPtr<ReconstructedParticleObj> m_obj{new ReconstructedParticleObj{}, podio::utils::MarkOwned};
186};
187
188std::ostream& operator<<(std::ostream& o, const ReconstructedParticle& value);
189
190#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
191void to_json(nlohmann::json& j, const ReconstructedParticle& value);
192#endif
193
194
195} // namespace edm4eic
196
197
198
199template<>
200struct std::hash<edm4eic::ReconstructedParticle> {
201 std::size_t operator()(const edm4eic::ReconstructedParticle& obj) const {
202 return std::hash<edm4eic::ReconstructedParticleObj*>{}(obj.m_obj.get());
203 }
204};
205
206
207// This is needed to avoid triggering opening every library in LD_LIBRARY_PATH
208// until it's fixed in ROOT. See https://github.com/root-project/root/issues/18489
209// and https://github.com/AIDASoft/podio/issues/770
210#if defined(__clang__)
211 #pragma clang diagnostic push
212 #pragma clang diagnostic ignored "-Wunknown-warning-option"
213 #pragma clang diagnostic ignored "-Wdeprecated-redundant-constexpr-static-def"
214 #pragma clang diagnostic ignored "-Wdeprecated"
215constexpr std::string_view edm4eic::ReconstructedParticle::typeName;
216 #pragma clang diagnostic pop
217#elif defined(__GNUC__)
218 #pragma GCC diagnostic push
219 #pragma GCC diagnostic ignored "-Wdeprecated"
220constexpr std::string_view edm4eic::ReconstructedParticle::typeName;
221 #pragma GCC diagnostic pop
222#endif
223
224
225#endif
Definition Cluster.h:49
Definition Cov4f.h:19
Definition MutableReconstructedParticle.h:46
Definition MutableVertex.h:38
Definition ReconstructedParticleCollectionData.h:35
Definition ReconstructedParticleCollection.h:139
Definition ReconstructedParticle.h:54
std::size_t particleIDs_size() const
Definition ReconstructedParticle.cc:242
std::vector< edm4hep::ParticleID >::const_iterator particleIDs_end() const
Definition ReconstructedParticle.cc:236
friend class ReconstructedParticleCollection
Definition ReconstructedParticle.h:57
const edm4eic::Cov4f & getCovMatrix() const
Access the covariance matrix of the reconstructed particle 4vector (10 parameters).
Definition ReconstructedParticle.cc:115
std::size_t clusters_size() const
Definition ReconstructedParticle.cc:146
std::size_t tracks_size() const
Definition ReconstructedParticle.cc:178
constexpr bool operator!=(const ReconstructedParticle &other) const
Definition ReconstructedParticle.h:163
std::vector< edm4eic::Cluster >::const_iterator clusters_begin() const
Definition ReconstructedParticle.cc:134
std::int32_t getType() const
Access the type of reconstructed particle. Check/set collection parameters ReconstructedParticleTypeN...
Definition ReconstructedParticle.cc:108
float getGoodnessOfPID() const
Access the overall goodness of the PID on a scale of [0;1].
Definition ReconstructedParticle.cc:114
podio::RelationRange< edm4eic::Cluster > getClusters() const
Definition ReconstructedParticle.cc:157
std::vector< edm4hep::ParticleID >::const_iterator particleIDs_begin() const
Definition ReconstructedParticle.cc:230
podio::ObjectID id() const
Definition ReconstructedParticle.h:169
std::vector< edm4eic::Track >::const_iterator tracks_end() const
Definition ReconstructedParticle.cc:172
friend class MutableReconstructedParticle
Definition ReconstructedParticle.h:56
const edm4hep::Vector3f & getReferencePoint() const
Access the [mm] reference, i.e. where the particle has been measured.
Definition ReconstructedParticle.cc:111
std::int32_t getPDG() const
Access the PDG code for this particle.
Definition ReconstructedParticle.cc:116
MutableReconstructedParticle clone(bool cloneRelations=true) const
Definition ReconstructedParticle.cc:39
ReconstructedParticleCollection collection_type
Definition ReconstructedParticle.h:64
std::vector< edm4eic::Track >::const_iterator tracks_begin() const
Definition ReconstructedParticle.cc:166
const edm4hep::Vector3f & getMomentum() const
Access the [GeV] particle momentum. Four momentum state is not kept consistent internally.
Definition ReconstructedParticle.cc:110
friend void swap(ReconstructedParticle &a, ReconstructedParticle &b)
Definition ReconstructedParticle.h:175
ReconstructedParticle & operator=(ReconstructedParticle other) &
copy-assignment operator
Definition ReconstructedParticle.cc:34
std::vector< edm4eic::ReconstructedParticle >::const_iterator particles_end() const
Definition ReconstructedParticle.cc:204
bool isCompound() const
Definition ReconstructedParticle.h:152
const edm4eic::Vertex getStartVertex() const
Access the Start vertex associated to this particle.
Definition ReconstructedParticle.cc:118
ReconstructedParticle(ReconstructedParticle &&other) noexcept=default
move constructor
constexpr bool operator==(const ReconstructedParticle &other) const
Definition ReconstructedParticle.h:160
ReconstructedParticle()=default
default constructor
friend class ReconstructedParticleCollectionIterator
Definition ReconstructedParticle.h:59
~ReconstructedParticle()=default
destructor
const podio::ObjectID getObjectID() const
Definition ReconstructedParticle.cc:269
bool isAvailable() const
check whether the object is actually available
Definition ReconstructedParticle.cc:265
ReconstructedParticle & operator=(ReconstructedParticle other) &&=delete
float getMass() const
Access the [GeV] mass of the reconstructed particle, set independently from four vector....
Definition ReconstructedParticle.cc:113
float getCharge() const
Access the charge of the reconstructed particle.
Definition ReconstructedParticle.cc:112
float getEnergy() const
Access the [GeV] energy of the reconstructed particle. Four momentum state is not kept consistent int...
Definition ReconstructedParticle.cc:109
const edm4hep::ParticleID getParticleIDUsed() const
Access the particle ID used for the kinematics of this particle.
Definition ReconstructedParticle.cc:125
podio::RelationRange< edm4eic::Track > getTracks() const
Definition ReconstructedParticle.cc:189
static constexpr std::string_view typeName
Definition ReconstructedParticle.h:96
std::vector< edm4eic::Cluster >::const_iterator clusters_end() const
Definition ReconstructedParticle.cc:140
std::size_t particles_size() const
Definition ReconstructedParticle.cc:210
ReconstructedParticle(const ReconstructedParticle &other) noexcept=default
copy constructor
std::vector< edm4eic::ReconstructedParticle >::const_iterator particles_begin() const
Definition ReconstructedParticle.cc:198
static ReconstructedParticle makeEmpty()
Definition ReconstructedParticle.cc:104
bool operator<(const ReconstructedParticle &other) const
Definition ReconstructedParticle.h:167
bool operator!=(const MutableReconstructedParticle &other) const
Definition ReconstructedParticle.h:164
MutableReconstructedParticle mutable_type
Definition ReconstructedParticle.h:63
podio::RelationRange< edm4eic::ReconstructedParticle > getParticles() const
Definition ReconstructedParticle.cc:221
void unlink()
disconnect from ReconstructedParticleObj instance
Definition ReconstructedParticle.h:158
podio::RelationRange< edm4hep::ParticleID > getParticleIDs() const
Definition ReconstructedParticle.cc:253
Definition ReconstructedParticleObj.h:29
Definition Track.h:48
Definition Vertex.h:46
Definition ArrowMapper.cc:63
std::ostream & operator<<(std::ostream &o, const CalorimeterHit &value)
Definition CalorimeterHit.cc:99
Definition CalorimeterHit.h:25
Definition CalorimeterHit.h:31
OrderKey getOrderKey(const edm4eic::CalorimeterHit &obj)
Definition CalorimeterHit.cc:146
std::size_t operator()(const edm4eic::ReconstructedParticle &obj) const
Definition ReconstructedParticle.h:201