File indexing completed on 2025-06-03 08:33:28
0001
0002
0003 #ifndef EDM4HEP_VertexRecoParticleLink_H
0004 #define EDM4HEP_VertexRecoParticleLink_H
0005
0006 #include "edm4hep/VertexRecoParticleLinkObj.h"
0007
0008 #include "podio/detail/OrderKey.h"
0009 #include "podio/utilities/MaybeSharedPtr.h"
0010
0011 #include <cstdint>
0012 #include <ostream>
0013
0014 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0015 #include "nlohmann/json_fwd.hpp"
0016 #endif
0017
0018
0019 namespace edm4hep {
0020 class VertexRecoParticleLinkCollection;
0021 class ReconstructedParticle;
0022 class MutableReconstructedParticle;
0023 class Vertex;
0024 class MutableVertex;
0025 }
0026
0027 namespace podio::detail {
0028
0029 OrderKey getOrderKey(const edm4hep::VertexRecoParticleLink& obj);
0030 };
0031
0032 namespace edm4hep {
0033
0034 class MutableVertexRecoParticleLink;
0035 class VertexRecoParticleLinkCollection;
0036 class VertexRecoParticleLinkCollectionData;
0037
0038
0039
0040
0041
0042 class VertexRecoParticleLink {
0043
0044 friend class MutableVertexRecoParticleLink;
0045 friend class VertexRecoParticleLinkCollection;
0046 friend class edm4hep::VertexRecoParticleLinkCollectionData;
0047 friend class VertexRecoParticleLinkCollectionIterator;
0048 friend podio::detail::OrderKey podio::detail::getOrderKey(const VertexRecoParticleLink& obj);
0049
0050 public:
0051 using mutable_type = MutableVertexRecoParticleLink;
0052 using collection_type = VertexRecoParticleLinkCollection;
0053
0054
0055 VertexRecoParticleLink();
0056
0057
0058 VertexRecoParticleLink(float weight);
0059
0060
0061 VertexRecoParticleLink(const VertexRecoParticleLink& other) = default;
0062
0063
0064 VertexRecoParticleLink& operator=(VertexRecoParticleLink other);
0065
0066
0067
0068 MutableVertexRecoParticleLink clone(bool cloneRelations = true) const;
0069
0070
0071 ~VertexRecoParticleLink() = default;
0072
0073
0074 VertexRecoParticleLink(const MutableVertexRecoParticleLink& other);
0075
0076 static VertexRecoParticleLink makeEmpty();
0077
0078 public:
0079 static constexpr auto typeName = "edm4hep::VertexRecoParticleLink";
0080
0081
0082 float getWeight() const;
0083
0084
0085 const edm4hep::ReconstructedParticle getTo() const;
0086
0087 const edm4hep::Vertex getFrom() const;
0088
0089 [[deprecated("use getTo instead")]] edm4hep::ReconstructedParticle getRec() const;
0090 [[deprecated("use getFrom instead")]] edm4hep::Vertex getVertex() const;
0091
0092
0093 bool isAvailable() const;
0094
0095 void unlink() {
0096 m_obj = podio::utils::MaybeSharedPtr<VertexRecoParticleLinkObj>{nullptr};
0097 }
0098
0099 bool operator==(const VertexRecoParticleLink& other) const {
0100 return m_obj == other.m_obj;
0101 }
0102 bool operator==(const MutableVertexRecoParticleLink& other) const;
0103
0104 bool operator!=(const VertexRecoParticleLink& other) const {
0105 return !(*this == other);
0106 }
0107 bool operator!=(const MutableVertexRecoParticleLink& other) const {
0108 return !(*this == other);
0109 }
0110
0111
0112 bool operator<(const VertexRecoParticleLink& other) const {
0113 return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other);
0114 }
0115
0116 podio::ObjectID id() const {
0117 return getObjectID();
0118 }
0119
0120 const podio::ObjectID getObjectID() const;
0121
0122 friend void swap(VertexRecoParticleLink& a, VertexRecoParticleLink& b) {
0123 using std::swap;
0124 swap(a.m_obj, b.m_obj);
0125 }
0126
0127 private:
0128
0129 explicit VertexRecoParticleLink(podio::utils::MaybeSharedPtr<VertexRecoParticleLinkObj> obj);
0130 VertexRecoParticleLink(VertexRecoParticleLinkObj* obj);
0131
0132 podio::utils::MaybeSharedPtr<VertexRecoParticleLinkObj> m_obj{nullptr};
0133 };
0134
0135 std::ostream& operator<<(std::ostream& o, const VertexRecoParticleLink& value);
0136
0137 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0138 void to_json(nlohmann::json& j, const VertexRecoParticleLink& value);
0139 #endif
0140
0141 }
0142
0143 #endif