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