File indexing completed on 2025-09-17 08:55:05
0001
0002
0003 #ifndef EDM4EIC_TrackClusterMatch_H
0004 #define EDM4EIC_TrackClusterMatch_H
0005
0006 #include "edm4eic/TrackClusterMatchObj.h"
0007
0008
0009 #include "podio/utilities/MaybeSharedPtr.h"
0010 #include "podio/detail/OrderKey.h"
0011
0012 #include <ostream>
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 TrackClusterMatchCollection;
0022 class Cluster;
0023 class MutableCluster;
0024 class Track;
0025 class MutableTrack;
0026 }
0027
0028
0029 namespace podio::detail {
0030
0031 OrderKey getOrderKey(const edm4eic::TrackClusterMatch& obj);
0032 };
0033
0034 namespace edm4eic {
0035
0036 class MutableTrackClusterMatch;
0037 class TrackClusterMatchCollection;
0038 class TrackClusterMatchCollectionData;
0039
0040
0041
0042
0043
0044 class TrackClusterMatch {
0045
0046 friend class MutableTrackClusterMatch;
0047 friend class TrackClusterMatchCollection;
0048 friend class edm4eic::TrackClusterMatchCollectionData;
0049 friend class TrackClusterMatchCollectionIterator;
0050 friend podio::detail::OrderKey podio::detail::getOrderKey(const TrackClusterMatch & obj);
0051
0052 public:
0053 using mutable_type = MutableTrackClusterMatch;
0054 using collection_type = TrackClusterMatchCollection;
0055
0056
0057 TrackClusterMatch();
0058
0059
0060 TrackClusterMatch(const float weight);
0061
0062
0063 TrackClusterMatch(const TrackClusterMatch& other) = default;
0064
0065
0066 TrackClusterMatch& operator=(TrackClusterMatch other) &;
0067 TrackClusterMatch& operator=(TrackClusterMatch other) && = delete;
0068
0069
0070
0071 MutableTrackClusterMatch clone(bool cloneRelations=true) const;
0072
0073
0074 ~TrackClusterMatch() = default;
0075
0076
0077 TrackClusterMatch(const MutableTrackClusterMatch& other);
0078
0079 static TrackClusterMatch makeEmpty();
0080
0081 public:
0082
0083 static constexpr std::string_view typeName = "edm4eic::TrackClusterMatch";
0084
0085
0086 float getWeight() const;
0087
0088
0089
0090 const edm4eic::Cluster getCluster() const;
0091
0092 const edm4eic::Track getTrack() const;
0093
0094
0095
0096
0097 bool isAvailable() const;
0098
0099 void unlink() { m_obj = podio::utils::MaybeSharedPtr<TrackClusterMatchObj>{nullptr}; }
0100
0101 bool operator==(const TrackClusterMatch& other) const { return m_obj == other.m_obj; }
0102 bool operator==(const MutableTrackClusterMatch& other) const;
0103
0104 bool operator!=(const TrackClusterMatch& other) const { return !(*this == other); }
0105 bool operator!=(const MutableTrackClusterMatch& other) const { return !(*this == other); }
0106
0107
0108 bool operator<(const TrackClusterMatch& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
0109
0110 podio::ObjectID id() const { return getObjectID(); }
0111
0112 const podio::ObjectID getObjectID() const;
0113
0114 friend std::hash<TrackClusterMatch>;
0115
0116 friend void swap(TrackClusterMatch& a, TrackClusterMatch& b) {
0117 using std::swap;
0118 swap(a.m_obj, b.m_obj);
0119 }
0120
0121 private:
0122
0123 explicit TrackClusterMatch(podio::utils::MaybeSharedPtr<TrackClusterMatchObj> obj);
0124 TrackClusterMatch(TrackClusterMatchObj* obj);
0125
0126 podio::utils::MaybeSharedPtr<TrackClusterMatchObj> m_obj{nullptr};
0127 };
0128
0129 std::ostream& operator<<(std::ostream& o, const TrackClusterMatch& value);
0130
0131 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0132 void to_json(nlohmann::json& j, const TrackClusterMatch& value);
0133 #endif
0134
0135
0136 }
0137
0138
0139
0140 template<>
0141 struct std::hash<edm4eic::TrackClusterMatch> {
0142 std::size_t operator()(const edm4eic::TrackClusterMatch& obj) const {
0143 return std::hash<edm4eic::TrackClusterMatchObj*>{}(obj.m_obj.get());
0144 }
0145 };
0146
0147
0148
0149
0150
0151 #if defined(__clang__)
0152 #pragma clang diagnostic push
0153 #pragma clang diagnostic ignored "-Wunknown-warning-option"
0154 #pragma clang diagnostic ignored "-Wdeprecated-redundant-constexpr-static-def"
0155 #pragma clang diagnostic ignored "-Wdeprecated"
0156 constexpr std::string_view edm4eic::TrackClusterMatch::typeName;
0157 #pragma clang diagnostic pop
0158 #elif defined(__GNUC__)
0159 #pragma GCC diagnostic push
0160 #pragma GCC diagnostic ignored "-Wdeprecated"
0161 constexpr std::string_view edm4eic::TrackClusterMatch::typeName;
0162 #pragma GCC diagnostic pop
0163 #endif
0164
0165 #endif