Warning, file /include/edm4hep/MutableReconstructedParticle.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003 #ifndef EDM4HEP_MutableReconstructedParticle_H
0004 #define EDM4HEP_MutableReconstructedParticle_H
0005
0006 #include "edm4hep/ReconstructedParticleObj.h"
0007
0008 #include "edm4hep/ReconstructedParticle.h"
0009
0010 #include "edm4hep/Cluster.h"
0011 #include "edm4hep/CovMatrix4f.h"
0012 #include "edm4hep/Track.h"
0013 #include "edm4hep/Vector3f.h"
0014 #include "podio/RelationRange.h"
0015 #include <cstdint>
0016 #include <edm4hep/Constants.h>
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 edm4hep {
0029 class ReconstructedParticleCollection;
0030 class Vertex;
0031 class MutableVertex;
0032 }
0033
0034 namespace edm4hep {
0035
0036
0037
0038
0039
0040 class MutableReconstructedParticle {
0041
0042 friend class ReconstructedParticleCollection;
0043 friend class ReconstructedParticleMutableCollectionIterator;
0044 friend class ReconstructedParticle;
0045
0046 public:
0047 using object_type = ReconstructedParticle;
0048 using collection_type = ReconstructedParticleCollection;
0049
0050
0051 MutableReconstructedParticle() = default;
0052
0053
0054 MutableReconstructedParticle(const std::int32_t PDG, const float energy, const edm4hep::Vector3f& momentum,
0055 const edm4hep::Vector3f& referencePoint, const float charge, const float mass,
0056 const float goodnessOfPID, const edm4hep::CovMatrix4f& covMatrix);
0057
0058
0059 MutableReconstructedParticle(const MutableReconstructedParticle& other) = default;
0060
0061
0062 MutableReconstructedParticle&
0063 operator=(MutableReconstructedParticle other) &;
0064 MutableReconstructedParticle& operator=(MutableReconstructedParticle other) && =
0065 delete;
0066
0067
0068
0069 MutableReconstructedParticle clone(bool cloneRelations = true) const;
0070
0071
0072 ~MutableReconstructedParticle() = default;
0073
0074 public:
0075
0076 std::int32_t getPDG() const;
0077
0078
0079 float getEnergy() const;
0080
0081
0082 const edm4hep::Vector3f& getMomentum() const;
0083
0084
0085 const edm4hep::Vector3f& getReferencePoint() const;
0086
0087
0088 float getCharge() const;
0089
0090
0091
0092 float getMass() const;
0093
0094
0095 float getGoodnessOfPID() const;
0096
0097
0098 const edm4hep::CovMatrix4f& getCovMatrix() const;
0099
0100
0101 const edm4hep::Vertex getDecayVertex() const;
0102
0103
0104 void setPDG(const std::int32_t PDG);
0105
0106 std::int32_t& getPDG();
0107
0108 [[deprecated("use getPDG instead")]] std::int32_t& PDG();
0109
0110
0111 void setEnergy(const float energy);
0112
0113
0114 float& getEnergy();
0115
0116 [[deprecated("use getEnergy instead")]] float& energy();
0117
0118
0119 void setMomentum(const edm4hep::Vector3f& momentum);
0120
0121 edm4hep::Vector3f& getMomentum();
0122
0123 [[deprecated("use getMomentum instead")]] edm4hep::Vector3f& momentum();
0124
0125
0126 void setReferencePoint(const edm4hep::Vector3f& referencePoint);
0127
0128 edm4hep::Vector3f& getReferencePoint();
0129
0130 [[deprecated("use getReferencePoint instead")]] edm4hep::Vector3f& referencePoint();
0131
0132
0133 void setCharge(const float charge);
0134
0135 float& getCharge();
0136
0137 [[deprecated("use getCharge instead")]] float& charge();
0138
0139
0140
0141 void setMass(const float mass);
0142
0143
0144 float& getMass();
0145
0146
0147 [[deprecated("use getMass instead")]] float& mass();
0148
0149
0150 void setGoodnessOfPID(const float goodnessOfPID);
0151
0152 float& getGoodnessOfPID();
0153
0154 [[deprecated("use getGoodnessOfPID instead")]] float& goodnessOfPID();
0155
0156
0157 void setCovMatrix(const edm4hep::CovMatrix4f& covMatrix);
0158
0159 edm4hep::CovMatrix4f& getCovMatrix();
0160
0161 [[deprecated("use getCovMatrix instead")]] edm4hep::CovMatrix4f& covMatrix();
0162
0163
0164 void setDecayVertex(const edm4hep::Vertex& value);
0165
0166 void addToClusters(const edm4hep::Cluster&);
0167 std::size_t clusters_size() const;
0168 edm4hep::Cluster getClusters(std::size_t) const;
0169 std::vector<edm4hep::Cluster>::const_iterator clusters_begin() const;
0170 std::vector<edm4hep::Cluster>::const_iterator clusters_end() const;
0171 podio::RelationRange<edm4hep::Cluster> getClusters() const;
0172 void addToTracks(const edm4hep::Track&);
0173 std::size_t tracks_size() const;
0174 edm4hep::Track getTracks(std::size_t) const;
0175 std::vector<edm4hep::Track>::const_iterator tracks_begin() const;
0176 std::vector<edm4hep::Track>::const_iterator tracks_end() const;
0177 podio::RelationRange<edm4hep::Track> getTracks() const;
0178 void addToParticles(const edm4hep::ReconstructedParticle&);
0179 std::size_t particles_size() const;
0180 edm4hep::ReconstructedParticle getParticles(std::size_t) const;
0181 std::vector<edm4hep::ReconstructedParticle>::const_iterator particles_begin() const;
0182 std::vector<edm4hep::ReconstructedParticle>::const_iterator particles_end() const;
0183 podio::RelationRange<edm4hep::ReconstructedParticle> getParticles() const;
0184
0185 bool isCompound() const { return particles_size() > 0; }
0186
0187 float getCovMatrix(edm4hep::FourMomCoords dimI, edm4hep::FourMomCoords dimJ) const {
0188 return getCovMatrix().getValue(dimI, dimJ);
0189 }
0190
0191
0192
0193
0194
0195
0196 void setCovMatrix(float value, edm4hep::FourMomCoords dimI, edm4hep::FourMomCoords dimJ) {
0197 getCovMatrix().setValue(value, dimI, dimJ);
0198 }
0199
0200
0201 bool isAvailable() const;
0202
0203 void unlink() { m_obj = podio::utils::MaybeSharedPtr<ReconstructedParticleObj>{nullptr}; }
0204
0205 bool operator==(const MutableReconstructedParticle& other) const { return m_obj == other.m_obj; }
0206 bool operator==(const ReconstructedParticle& other) const;
0207
0208 bool operator!=(const MutableReconstructedParticle& other) const { return !(*this == other); }
0209 bool operator!=(const ReconstructedParticle& other) const { return !(*this == other); }
0210
0211
0212 bool operator<(const MutableReconstructedParticle& other) const {
0213 return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other);
0214 }
0215
0216 podio::ObjectID id() const { return getObjectID(); }
0217
0218 const podio::ObjectID getObjectID() const;
0219
0220 friend std::hash<MutableReconstructedParticle>;
0221
0222 friend void swap(MutableReconstructedParticle& a, MutableReconstructedParticle& b) {
0223 using std::swap;
0224 swap(a.m_obj, b.m_obj);
0225 }
0226
0227 private:
0228
0229 explicit MutableReconstructedParticle(podio::utils::MaybeSharedPtr<ReconstructedParticleObj> obj);
0230
0231 podio::utils::MaybeSharedPtr<ReconstructedParticleObj> m_obj{new ReconstructedParticleObj{}, podio::utils::MarkOwned};
0232 };
0233
0234 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0235 void to_json(nlohmann::json& j, const MutableReconstructedParticle& value);
0236 #endif
0237
0238 }
0239
0240 template <>
0241 struct std::hash<edm4hep::MutableReconstructedParticle> {
0242 std::size_t operator()(const edm4hep::MutableReconstructedParticle& obj) const {
0243 return std::hash<edm4hep::ReconstructedParticleObj*>{}(obj.m_obj.get());
0244 }
0245 };
0246
0247 #endif