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