File indexing completed on 2025-01-18 09:55:32
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
0011 #include <ostream>
0012 #include <cstdint>
0013
0014 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0015 #include "nlohmann/json_fwd.hpp"
0016 #endif
0017
0018
0019 namespace edm4eic {
0020 class Cluster;
0021 class MutableCluster;
0022 class Track;
0023 class MutableTrack;
0024 }
0025
0026
0027 namespace edm4eic {
0028
0029 class MutableTrackClusterMatch;
0030 class TrackClusterMatchCollection;
0031 class TrackClusterMatchCollectionData;
0032
0033
0034
0035
0036
0037 class TrackClusterMatch {
0038
0039 friend class MutableTrackClusterMatch;
0040 friend class TrackClusterMatchCollection;
0041 friend class edm4eic::TrackClusterMatchCollectionData;
0042 friend class TrackClusterMatchCollectionIterator;
0043
0044 public:
0045 using mutable_type = MutableTrackClusterMatch;
0046 using collection_type = TrackClusterMatchCollection;
0047
0048
0049 TrackClusterMatch();
0050
0051
0052 TrackClusterMatch(float weight);
0053
0054
0055 TrackClusterMatch(const TrackClusterMatch& other) = default;
0056
0057
0058 TrackClusterMatch& operator=(TrackClusterMatch other);
0059
0060
0061
0062 MutableTrackClusterMatch clone(bool cloneRelations=true) const;
0063
0064
0065 ~TrackClusterMatch() = default;
0066
0067
0068 TrackClusterMatch(const MutableTrackClusterMatch& other);
0069
0070 static TrackClusterMatch makeEmpty();
0071
0072 public:
0073
0074
0075 float getWeight() const;
0076
0077
0078
0079 const edm4eic::Cluster getCluster() const;
0080
0081 const edm4eic::Track getTrack() const;
0082
0083
0084
0085
0086 bool isAvailable() const;
0087
0088 void unlink() { m_obj = podio::utils::MaybeSharedPtr<TrackClusterMatchObj>{nullptr}; }
0089
0090 bool operator==(const TrackClusterMatch& other) const { return m_obj == other.m_obj; }
0091 bool operator==(const MutableTrackClusterMatch& other) const;
0092
0093 bool operator!=(const TrackClusterMatch& other) const { return !(*this == other); }
0094 bool operator!=(const MutableTrackClusterMatch& other) const { return !(*this == other); }
0095
0096
0097 bool operator<(const TrackClusterMatch& other) const { return m_obj < other.m_obj; }
0098
0099 podio::ObjectID id() const { return getObjectID(); }
0100
0101 const podio::ObjectID getObjectID() const;
0102
0103 friend void swap(TrackClusterMatch& a, TrackClusterMatch& b) {
0104 using std::swap;
0105 swap(a.m_obj, b.m_obj);
0106 }
0107
0108 private:
0109
0110 explicit TrackClusterMatch(podio::utils::MaybeSharedPtr<TrackClusterMatchObj> obj);
0111 TrackClusterMatch(TrackClusterMatchObj* obj);
0112
0113 podio::utils::MaybeSharedPtr<TrackClusterMatchObj> m_obj{nullptr};
0114 };
0115
0116 std::ostream& operator<<(std::ostream& o, const TrackClusterMatch& value);
0117
0118 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0119 void to_json(nlohmann::json& j, const TrackClusterMatch& value);
0120 #endif
0121
0122
0123 }
0124
0125
0126 #endif