File indexing completed on 2026-11-19 10:38:22
0001
0002
0003 #ifndef EDM4EIC_MutableTrackSeed_H
0004 #define EDM4EIC_MutableTrackSeed_H
0005
0006 #include "edm4eic/TrackSeedObj.h"
0007
0008 #include "edm4eic/TrackSeed.h"
0009
0010 #include "edm4eic/TrackerHit.h"
0011 #include "edm4hep/Vector3f.h"
0012 #include "podio/RelationRange.h"
0013 #include <vector>
0014
0015 #include "podio/utilities/MaybeSharedPtr.h"
0016
0017 #include <cstdint>
0018
0019 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0020 #include "nlohmann/json_fwd.hpp"
0021 #endif
0022
0023
0024 namespace edm4eic {
0025 class TrackSeedCollection;
0026 class TrackParameters;
0027 class MutableTrackParameters;
0028 }
0029
0030
0031 namespace edm4eic {
0032
0033
0034
0035
0036
0037
0038 class MutableTrackSeed {
0039
0040 friend class TrackSeedCollection;
0041 friend class TrackSeedMutableCollectionIterator;
0042 friend class TrackSeed;
0043
0044 public:
0045 using object_type = TrackSeed;
0046 using collection_type = TrackSeedCollection;
0047
0048
0049 MutableTrackSeed() = default;
0050
0051
0052 MutableTrackSeed(const edm4hep::Vector3f& perigee, const float quality);
0053
0054
0055 MutableTrackSeed(const MutableTrackSeed& other) noexcept = default;
0056
0057
0058 MutableTrackSeed(MutableTrackSeed&& other) noexcept = default;
0059
0060
0061 MutableTrackSeed& operator=(MutableTrackSeed other) &;
0062 MutableTrackSeed& operator=(MutableTrackSeed other) && = delete;
0063
0064
0065
0066 MutableTrackSeed clone(bool cloneRelations=true) const;
0067
0068
0069 ~MutableTrackSeed() = default;
0070
0071
0072 public:
0073
0074
0075 const edm4hep::Vector3f& getPerigee() const;
0076
0077
0078 float getQuality() const;
0079
0080
0081
0082 const edm4eic::TrackParameters getParams() const;
0083
0084
0085 void setPerigee(const edm4hep::Vector3f& perigee);
0086
0087 edm4hep::Vector3f& getPerigee();
0088
0089
0090 void setQuality(const float quality);
0091
0092 float& getQuality();
0093
0094
0095
0096 void setParams(const edm4eic::TrackParameters& value);
0097
0098 void addToHits(const edm4eic::TrackerHit&);
0099 std::size_t hits_size() const;
0100 edm4eic::TrackerHit getHits(std::size_t) const;
0101 std::vector<edm4eic::TrackerHit>::const_iterator hits_begin() const;
0102 std::vector<edm4eic::TrackerHit>::const_iterator hits_end() const;
0103 podio::RelationRange<edm4eic::TrackerHit> getHits() const;
0104
0105
0106
0107
0108 bool isAvailable() const;
0109
0110 void unlink() { m_obj = podio::utils::MaybeSharedPtr<TrackSeedObj>{nullptr}; }
0111
0112 constexpr bool operator==(const MutableTrackSeed& other) const { return m_obj == other.m_obj; }
0113 bool operator==(const TrackSeed& other) const;
0114
0115 constexpr bool operator!=(const MutableTrackSeed& other) const { return !(*this == other); }
0116 bool operator!=(const TrackSeed& other) const { return !(*this == other); }
0117
0118
0119 bool operator<(const MutableTrackSeed& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
0120
0121 podio::ObjectID id() const { return getObjectID(); }
0122
0123 const podio::ObjectID getObjectID() const;
0124
0125 friend std::hash<MutableTrackSeed>;
0126
0127 friend void swap(MutableTrackSeed& a, MutableTrackSeed& b) {
0128 using std::swap;
0129 swap(a.m_obj, b.m_obj);
0130 }
0131
0132 private:
0133
0134 explicit MutableTrackSeed(podio::utils::MaybeSharedPtr<TrackSeedObj> obj);
0135
0136 podio::utils::MaybeSharedPtr<TrackSeedObj> m_obj{new TrackSeedObj{}, podio::utils::MarkOwned};
0137 };
0138
0139 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0140 void to_json(nlohmann::json& j, const MutableTrackSeed& value);
0141 #endif
0142
0143
0144 }
0145
0146
0147
0148 template<>
0149 struct std::hash<edm4eic::MutableTrackSeed> {
0150 std::size_t operator()(const edm4eic::MutableTrackSeed& obj) const {
0151 return std::hash<edm4eic::TrackSeedObj*>{}(obj.m_obj.get());
0152 }
0153 };
0154
0155
0156 #endif