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