File indexing completed on 2025-07-09 08:30:12
0001
0002
0003 #ifndef EDM4EIC_TrackSegment_H
0004 #define EDM4EIC_TrackSegment_H
0005
0006 #include "edm4eic/TrackSegmentObj.h"
0007
0008 #include "edm4eic/TrackPoint.h"
0009 #include "podio/RelationRange.h"
0010 #include <vector>
0011
0012 #include "podio/utilities/MaybeSharedPtr.h"
0013 #include "podio/detail/OrderKey.h"
0014
0015 #include <ostream>
0016 #include <cstdint>
0017
0018 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0019 #include "nlohmann/json_fwd.hpp"
0020 #endif
0021
0022
0023 namespace edm4eic {
0024 class TrackSegmentCollection;
0025 class Track;
0026 class MutableTrack;
0027 }
0028
0029
0030 namespace podio::detail {
0031
0032 OrderKey getOrderKey(const edm4eic::TrackSegment& obj);
0033 };
0034
0035 namespace edm4eic {
0036
0037 class MutableTrackSegment;
0038 class TrackSegmentCollection;
0039 class TrackSegmentCollectionData;
0040
0041
0042
0043
0044
0045 class TrackSegment {
0046
0047 friend class MutableTrackSegment;
0048 friend class TrackSegmentCollection;
0049 friend class edm4eic::TrackSegmentCollectionData;
0050 friend class TrackSegmentCollectionIterator;
0051 friend podio::detail::OrderKey podio::detail::getOrderKey(const TrackSegment & obj);
0052
0053 public:
0054 using mutable_type = MutableTrackSegment;
0055 using collection_type = TrackSegmentCollection;
0056
0057
0058 TrackSegment();
0059
0060
0061 TrackSegment(float length, float lengthError);
0062
0063
0064 TrackSegment(const TrackSegment& other) = default;
0065
0066
0067 TrackSegment& operator=(TrackSegment other);
0068
0069
0070
0071 MutableTrackSegment clone(bool cloneRelations=true) const;
0072
0073
0074 ~TrackSegment() = default;
0075
0076
0077 TrackSegment(const MutableTrackSegment& other);
0078
0079 static TrackSegment makeEmpty();
0080
0081 public:
0082
0083 static constexpr auto typeName = "edm4eic::TrackSegment";
0084
0085
0086 float getLength() const;
0087
0088
0089 float getLengthError() const;
0090
0091
0092
0093 const edm4eic::Track getTrack() const;
0094
0095 std::size_t points_size() const;
0096 edm4eic::TrackPoint getPoints(std::size_t) const;
0097 std::vector<edm4eic::TrackPoint>::const_iterator points_begin() const;
0098 std::vector<edm4eic::TrackPoint>::const_iterator points_end() const;
0099 podio::RelationRange<edm4eic::TrackPoint> getPoints() const;
0100
0101
0102
0103 bool isAvailable() const;
0104
0105 void unlink() { m_obj = podio::utils::MaybeSharedPtr<TrackSegmentObj>{nullptr}; }
0106
0107 bool operator==(const TrackSegment& other) const { return m_obj == other.m_obj; }
0108 bool operator==(const MutableTrackSegment& other) const;
0109
0110 bool operator!=(const TrackSegment& other) const { return !(*this == other); }
0111 bool operator!=(const MutableTrackSegment& other) const { return !(*this == other); }
0112
0113
0114 bool operator<(const TrackSegment& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
0115
0116 podio::ObjectID id() const { return getObjectID(); }
0117
0118 const podio::ObjectID getObjectID() const;
0119
0120 friend void swap(TrackSegment& a, TrackSegment& b) {
0121 using std::swap;
0122 swap(a.m_obj, b.m_obj);
0123 }
0124
0125 private:
0126
0127 explicit TrackSegment(podio::utils::MaybeSharedPtr<TrackSegmentObj> obj);
0128 TrackSegment(TrackSegmentObj* obj);
0129
0130 podio::utils::MaybeSharedPtr<TrackSegmentObj> m_obj{nullptr};
0131 };
0132
0133 std::ostream& operator<<(std::ostream& o, const TrackSegment& value);
0134
0135 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0136 void to_json(nlohmann::json& j, const TrackSegment& value);
0137 #endif
0138
0139
0140 }
0141
0142
0143 #endif