File indexing completed on 2025-09-18 09:10:44
0001
0002
0003 #ifndef EDM4EIC_MutableTrajectory_H
0004 #define EDM4EIC_MutableTrajectory_H
0005
0006 #include "edm4eic/TrajectoryObj.h"
0007
0008 #include "edm4eic/Trajectory.h"
0009
0010 #include "edm4eic/Measurement2D.h"
0011 #include "edm4eic/TrackParameters.h"
0012 #include "podio/RelationRange.h"
0013 #include <cstdint>
0014 #include <vector>
0015
0016 #include "podio/utilities/MaybeSharedPtr.h"
0017
0018 #include <cstdint>
0019
0020 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0021 #include "nlohmann/json_fwd.hpp"
0022 #endif
0023
0024
0025 namespace edm4eic {
0026 class TrajectoryCollection;
0027 class TrackSeed;
0028 class MutableTrackSeed;
0029 }
0030
0031
0032 namespace edm4eic {
0033
0034
0035
0036
0037
0038
0039 class MutableTrajectory {
0040
0041 friend class TrajectoryCollection;
0042 friend class TrajectoryMutableCollectionIterator;
0043 friend class Trajectory;
0044
0045 public:
0046 using object_type = Trajectory;
0047 using collection_type = TrajectoryCollection;
0048
0049
0050 MutableTrajectory();
0051
0052
0053 MutableTrajectory(const std::uint32_t type, const std::uint32_t nStates, const std::uint32_t nMeasurements, const std::uint32_t nOutliers, const std::uint32_t nHoles, const std::uint32_t nSharedHits);
0054
0055
0056 MutableTrajectory(const MutableTrajectory& other) = default;
0057
0058
0059 MutableTrajectory& operator=(MutableTrajectory other) &;
0060 MutableTrajectory& operator=(MutableTrajectory other) && = delete;
0061
0062
0063
0064 MutableTrajectory clone(bool cloneRelations=true) const;
0065
0066
0067 ~MutableTrajectory() = default;
0068
0069
0070 public:
0071
0072
0073 std::uint32_t getType() const;
0074
0075
0076 std::uint32_t getNStates() const;
0077
0078
0079 std::uint32_t getNMeasurements() const;
0080
0081
0082 std::uint32_t getNOutliers() const;
0083
0084
0085 std::uint32_t getNHoles() const;
0086
0087
0088 std::uint32_t getNSharedHits() const;
0089
0090
0091
0092 const edm4eic::TrackSeed getSeed() const;
0093
0094
0095 void setType(const std::uint32_t type);
0096
0097 std::uint32_t& getType();
0098
0099 [[deprecated("use getType instead")]]
0100 std::uint32_t& type();
0101
0102
0103 void setNStates(const std::uint32_t nStates);
0104
0105 std::uint32_t& getNStates();
0106
0107 [[deprecated("use getNStates instead")]]
0108 std::uint32_t& nStates();
0109
0110
0111 void setNMeasurements(const std::uint32_t nMeasurements);
0112
0113 std::uint32_t& getNMeasurements();
0114
0115 [[deprecated("use getNMeasurements instead")]]
0116 std::uint32_t& nMeasurements();
0117
0118
0119 void setNOutliers(const std::uint32_t nOutliers);
0120
0121 std::uint32_t& getNOutliers();
0122
0123 [[deprecated("use getNOutliers instead")]]
0124 std::uint32_t& nOutliers();
0125
0126
0127 void setNHoles(const std::uint32_t nHoles);
0128
0129 std::uint32_t& getNHoles();
0130
0131 [[deprecated("use getNHoles instead")]]
0132 std::uint32_t& nHoles();
0133
0134
0135 void setNSharedHits(const std::uint32_t nSharedHits);
0136
0137 std::uint32_t& getNSharedHits();
0138
0139 [[deprecated("use getNSharedHits instead")]]
0140 std::uint32_t& nSharedHits();
0141
0142
0143
0144 void setSeed(const edm4eic::TrackSeed& value);
0145
0146 void addToTrackParameters(const edm4eic::TrackParameters&);
0147 std::size_t trackParameters_size() const;
0148 edm4eic::TrackParameters getTrackParameters(std::size_t) const;
0149 std::vector<edm4eic::TrackParameters>::const_iterator trackParameters_begin() const;
0150 std::vector<edm4eic::TrackParameters>::const_iterator trackParameters_end() const;
0151 podio::RelationRange<edm4eic::TrackParameters> getTrackParameters() const;
0152 void addToMeasurements_deprecated(const edm4eic::Measurement2D&);
0153 std::size_t measurements_deprecated_size() const;
0154 edm4eic::Measurement2D getMeasurements_deprecated(std::size_t) const;
0155 std::vector<edm4eic::Measurement2D>::const_iterator measurements_deprecated_begin() const;
0156 std::vector<edm4eic::Measurement2D>::const_iterator measurements_deprecated_end() const;
0157 podio::RelationRange<edm4eic::Measurement2D> getMeasurements_deprecated() const;
0158 void addToOutliers_deprecated(const edm4eic::Measurement2D&);
0159 std::size_t outliers_deprecated_size() const;
0160 edm4eic::Measurement2D getOutliers_deprecated(std::size_t) const;
0161 std::vector<edm4eic::Measurement2D>::const_iterator outliers_deprecated_begin() const;
0162 std::vector<edm4eic::Measurement2D>::const_iterator outliers_deprecated_end() const;
0163 podio::RelationRange<edm4eic::Measurement2D> getOutliers_deprecated() const;
0164 void addToMeasurementChi2(const float&);
0165 std::size_t measurementChi2_size() const;
0166 float getMeasurementChi2(std::size_t) const;
0167 std::vector<float>::const_iterator measurementChi2_begin() const;
0168 std::vector<float>::const_iterator measurementChi2_end() const;
0169 podio::RelationRange<float> getMeasurementChi2() const;
0170 void addToOutlierChi2(const float&);
0171 std::size_t outlierChi2_size() const;
0172 float getOutlierChi2(std::size_t) const;
0173 std::vector<float>::const_iterator outlierChi2_begin() const;
0174 std::vector<float>::const_iterator outlierChi2_end() const;
0175 podio::RelationRange<float> getOutlierChi2() const;
0176
0177
0178
0179
0180 bool isAvailable() const;
0181
0182 void unlink() { m_obj = podio::utils::MaybeSharedPtr<TrajectoryObj>{nullptr}; }
0183
0184 bool operator==(const MutableTrajectory& other) const { return m_obj == other.m_obj; }
0185 bool operator==(const Trajectory& other) const;
0186
0187 bool operator!=(const MutableTrajectory& other) const { return !(*this == other); }
0188 bool operator!=(const Trajectory& other) const { return !(*this == other); }
0189
0190
0191 bool operator<(const MutableTrajectory& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
0192
0193 podio::ObjectID id() const { return getObjectID(); }
0194
0195 const podio::ObjectID getObjectID() const;
0196
0197 friend std::hash<MutableTrajectory>;
0198
0199 friend void swap(MutableTrajectory& a, MutableTrajectory& b) {
0200 using std::swap;
0201 swap(a.m_obj, b.m_obj);
0202 }
0203
0204 private:
0205
0206 explicit MutableTrajectory(podio::utils::MaybeSharedPtr<TrajectoryObj> obj);
0207
0208 podio::utils::MaybeSharedPtr<TrajectoryObj> m_obj{nullptr};
0209 };
0210
0211 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0212 void to_json(nlohmann::json& j, const MutableTrajectory& value);
0213 #endif
0214
0215
0216 }
0217
0218
0219
0220 template<>
0221 struct std::hash<edm4eic::MutableTrajectory> {
0222 std::size_t operator()(const edm4eic::MutableTrajectory& obj) const {
0223 return std::hash<edm4eic::TrajectoryObj*>{}(obj.m_obj.get());
0224 }
0225 };
0226
0227
0228 #endif