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