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