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