File indexing completed on 2025-01-18 09:55:31
0001
0002
0003 #ifndef EDM4EIC_MutableReconstructedParticle_H
0004 #define EDM4EIC_MutableReconstructedParticle_H
0005
0006 #include "edm4eic/ReconstructedParticleObj.h"
0007
0008 #include "edm4eic/ReconstructedParticle.h"
0009
0010 #include "edm4eic/Cluster.h"
0011 #include "edm4eic/Cov4f.h"
0012 #include "edm4eic/Track.h"
0013 #include "edm4hep/ParticleID.h"
0014 #include "edm4hep/Vector3f.h"
0015 #include "podio/RelationRange.h"
0016 #include <cstdint>
0017 #include <vector>
0018
0019 #include "podio/utilities/MaybeSharedPtr.h"
0020
0021 #include <cstdint>
0022
0023 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0024 #include "nlohmann/json_fwd.hpp"
0025 #endif
0026
0027
0028 namespace edm4eic {
0029 class Vertex;
0030 class MutableVertex;
0031 }
0032 namespace edm4hep {
0033 class ParticleID;
0034 class MutableParticleID;
0035 }
0036
0037
0038 namespace edm4eic {
0039
0040
0041
0042
0043
0044
0045 class MutableReconstructedParticle {
0046
0047 friend class ReconstructedParticleCollection;
0048 friend class ReconstructedParticleMutableCollectionIterator;
0049 friend class ReconstructedParticle;
0050
0051 public:
0052 using object_type = ReconstructedParticle;
0053 using collection_type = ReconstructedParticleCollection;
0054
0055
0056 MutableReconstructedParticle();
0057
0058
0059 MutableReconstructedParticle(std::int32_t type, float energy, edm4hep::Vector3f momentum, edm4hep::Vector3f referencePoint, float charge, float mass, float goodnessOfPID, edm4eic::Cov4f covMatrix, std::int32_t PDG);
0060
0061
0062 MutableReconstructedParticle(const MutableReconstructedParticle& other) = default;
0063
0064
0065 MutableReconstructedParticle& operator=(MutableReconstructedParticle other);
0066
0067
0068
0069 MutableReconstructedParticle clone(bool cloneRelations=true) const;
0070
0071
0072 ~MutableReconstructedParticle() = default;
0073
0074
0075 public:
0076
0077
0078 std::int32_t getType() const;
0079
0080
0081 float getEnergy() const;
0082
0083
0084 const edm4hep::Vector3f& getMomentum() const;
0085
0086
0087 const edm4hep::Vector3f& getReferencePoint() const;
0088
0089
0090 float getCharge() const;
0091
0092
0093 float getMass() const;
0094
0095
0096 float getGoodnessOfPID() const;
0097
0098
0099 const edm4eic::Cov4f& getCovMatrix() const;
0100
0101
0102 std::int32_t getPDG() const;
0103
0104
0105
0106 const edm4eic::Vertex getStartVertex() const;
0107
0108 const edm4hep::ParticleID getParticleIDUsed() const;
0109
0110
0111 void setType(std::int32_t value);
0112
0113 std::int32_t& getType();
0114
0115 [[deprecated("use getType instead")]]
0116 std::int32_t& type();
0117
0118
0119 void setEnergy(float value);
0120
0121 float& getEnergy();
0122
0123 [[deprecated("use getEnergy instead")]]
0124 float& energy();
0125
0126
0127 void setMomentum(edm4hep::Vector3f value);
0128
0129 edm4hep::Vector3f& getMomentum();
0130
0131 [[deprecated("use getMomentum instead")]]
0132 edm4hep::Vector3f& momentum();
0133
0134
0135 void setReferencePoint(edm4hep::Vector3f value);
0136
0137 edm4hep::Vector3f& getReferencePoint();
0138
0139 [[deprecated("use getReferencePoint instead")]]
0140 edm4hep::Vector3f& referencePoint();
0141
0142
0143 void setCharge(float value);
0144
0145 float& getCharge();
0146
0147 [[deprecated("use getCharge instead")]]
0148 float& charge();
0149
0150
0151 void setMass(float value);
0152
0153 float& getMass();
0154
0155 [[deprecated("use getMass instead")]]
0156 float& mass();
0157
0158
0159 void setGoodnessOfPID(float value);
0160
0161 float& getGoodnessOfPID();
0162
0163 [[deprecated("use getGoodnessOfPID instead")]]
0164 float& goodnessOfPID();
0165
0166
0167 void setCovMatrix(edm4eic::Cov4f value);
0168
0169 edm4eic::Cov4f& getCovMatrix();
0170
0171 [[deprecated("use getCovMatrix instead")]]
0172 edm4eic::Cov4f& covMatrix();
0173
0174
0175 void setPDG(std::int32_t value);
0176
0177 std::int32_t& getPDG();
0178
0179 [[deprecated("use getPDG instead")]]
0180 std::int32_t& PDG();
0181
0182
0183
0184 void setStartVertex(const edm4eic::Vertex& value);
0185
0186 void setParticleIDUsed(const edm4hep::ParticleID& value);
0187
0188 void addToClusters(const edm4eic::Cluster&);
0189 std::size_t clusters_size() const;
0190 edm4eic::Cluster getClusters(std::size_t) const;
0191 std::vector<edm4eic::Cluster>::const_iterator clusters_begin() const;
0192 std::vector<edm4eic::Cluster>::const_iterator clusters_end() const;
0193 podio::RelationRange<edm4eic::Cluster> getClusters() const;
0194 void addToTracks(const edm4eic::Track&);
0195 std::size_t tracks_size() const;
0196 edm4eic::Track getTracks(std::size_t) const;
0197 std::vector<edm4eic::Track>::const_iterator tracks_begin() const;
0198 std::vector<edm4eic::Track>::const_iterator tracks_end() const;
0199 podio::RelationRange<edm4eic::Track> getTracks() const;
0200 void addToParticles(const edm4eic::ReconstructedParticle&);
0201 std::size_t particles_size() const;
0202 edm4eic::ReconstructedParticle getParticles(std::size_t) const;
0203 std::vector<edm4eic::ReconstructedParticle>::const_iterator particles_begin() const;
0204 std::vector<edm4eic::ReconstructedParticle>::const_iterator particles_end() const;
0205 podio::RelationRange<edm4eic::ReconstructedParticle> getParticles() const;
0206 void addToParticleIDs(const edm4hep::ParticleID&);
0207 std::size_t particleIDs_size() const;
0208 edm4hep::ParticleID getParticleIDs(std::size_t) const;
0209 std::vector<edm4hep::ParticleID>::const_iterator particleIDs_begin() const;
0210 std::vector<edm4hep::ParticleID>::const_iterator particleIDs_end() const;
0211 podio::RelationRange<edm4hep::ParticleID> getParticleIDs() const;
0212
0213 bool isCompound() const {return particles_size() > 0;}
0214
0215
0216
0217
0218 bool isAvailable() const;
0219
0220 void unlink() { m_obj = podio::utils::MaybeSharedPtr<ReconstructedParticleObj>{nullptr}; }
0221
0222 bool operator==(const MutableReconstructedParticle& other) const { return m_obj == other.m_obj; }
0223 bool operator==(const ReconstructedParticle& other) const;
0224
0225 bool operator!=(const MutableReconstructedParticle& other) const { return !(*this == other); }
0226 bool operator!=(const ReconstructedParticle& other) const { return !(*this == other); }
0227
0228
0229 bool operator<(const MutableReconstructedParticle& other) const { return m_obj < other.m_obj; }
0230
0231 podio::ObjectID id() const { return getObjectID(); }
0232
0233 const podio::ObjectID getObjectID() const;
0234
0235 friend void swap(MutableReconstructedParticle& a, MutableReconstructedParticle& b) {
0236 using std::swap;
0237 swap(a.m_obj, b.m_obj);
0238 }
0239
0240 private:
0241
0242 explicit MutableReconstructedParticle(podio::utils::MaybeSharedPtr<ReconstructedParticleObj> obj);
0243
0244 podio::utils::MaybeSharedPtr<ReconstructedParticleObj> m_obj{nullptr};
0245 };
0246
0247 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0248 void to_json(nlohmann::json& j, const MutableReconstructedParticle& value);
0249 #endif
0250
0251
0252 }
0253
0254
0255 #endif