File indexing completed on 2025-01-18 09:55:33
0001
0002
0003 #ifndef EDM4EIC_Trajectory_H
0004 #define EDM4EIC_Trajectory_H
0005
0006 #include "edm4eic/TrajectoryObj.h"
0007
0008 #include "edm4eic/Measurement2D.h"
0009 #include "edm4eic/TrackParameters.h"
0010 #include "podio/RelationRange.h"
0011 #include <cstdint>
0012 #include <vector>
0013
0014 #include "podio/utilities/MaybeSharedPtr.h"
0015
0016 #include <ostream>
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 TrackSeed;
0026 class MutableTrackSeed;
0027 }
0028
0029
0030 namespace edm4eic {
0031
0032 class MutableTrajectory;
0033 class TrajectoryCollection;
0034 class TrajectoryCollectionData;
0035
0036
0037
0038
0039
0040 class Trajectory {
0041
0042 friend class MutableTrajectory;
0043 friend class TrajectoryCollection;
0044 friend class edm4eic::TrajectoryCollectionData;
0045 friend class TrajectoryCollectionIterator;
0046
0047 public:
0048 using mutable_type = MutableTrajectory;
0049 using collection_type = TrajectoryCollection;
0050
0051
0052 Trajectory();
0053
0054
0055 Trajectory(std::uint32_t type, std::uint32_t nStates, std::uint32_t nMeasurements, std::uint32_t nOutliers, std::uint32_t nHoles, std::uint32_t nSharedHits);
0056
0057
0058 Trajectory(const Trajectory& other) = default;
0059
0060
0061 Trajectory& operator=(Trajectory other);
0062
0063
0064
0065 MutableTrajectory clone(bool cloneRelations=true) const;
0066
0067
0068 ~Trajectory() = default;
0069
0070
0071 Trajectory(const MutableTrajectory& other);
0072
0073 static Trajectory makeEmpty();
0074
0075 public:
0076
0077
0078 std::uint32_t getType() const;
0079
0080
0081 std::uint32_t getNStates() const;
0082
0083
0084 std::uint32_t getNMeasurements() const;
0085
0086
0087 std::uint32_t getNOutliers() const;
0088
0089
0090 std::uint32_t getNHoles() const;
0091
0092
0093 std::uint32_t getNSharedHits() const;
0094
0095
0096
0097 const edm4eic::TrackSeed getSeed() const;
0098
0099 std::size_t trackParameters_size() const;
0100 edm4eic::TrackParameters getTrackParameters(std::size_t) const;
0101 std::vector<edm4eic::TrackParameters>::const_iterator trackParameters_begin() const;
0102 std::vector<edm4eic::TrackParameters>::const_iterator trackParameters_end() const;
0103 podio::RelationRange<edm4eic::TrackParameters> getTrackParameters() const;
0104 std::size_t measurements_deprecated_size() const;
0105 edm4eic::Measurement2D getMeasurements_deprecated(std::size_t) const;
0106 std::vector<edm4eic::Measurement2D>::const_iterator measurements_deprecated_begin() const;
0107 std::vector<edm4eic::Measurement2D>::const_iterator measurements_deprecated_end() const;
0108 podio::RelationRange<edm4eic::Measurement2D> getMeasurements_deprecated() const;
0109 std::size_t outliers_deprecated_size() const;
0110 edm4eic::Measurement2D getOutliers_deprecated(std::size_t) const;
0111 std::vector<edm4eic::Measurement2D>::const_iterator outliers_deprecated_begin() const;
0112 std::vector<edm4eic::Measurement2D>::const_iterator outliers_deprecated_end() const;
0113 podio::RelationRange<edm4eic::Measurement2D> getOutliers_deprecated() const;
0114 std::size_t measurementChi2_size() const;
0115 float getMeasurementChi2(std::size_t) const;
0116 std::vector<float>::const_iterator measurementChi2_begin() const;
0117 std::vector<float>::const_iterator measurementChi2_end() const;
0118 podio::RelationRange<float> getMeasurementChi2() const;
0119 std::size_t outlierChi2_size() const;
0120 float getOutlierChi2(std::size_t) const;
0121 std::vector<float>::const_iterator outlierChi2_begin() const;
0122 std::vector<float>::const_iterator outlierChi2_end() const;
0123 podio::RelationRange<float> getOutlierChi2() const;
0124
0125
0126
0127 bool isAvailable() const;
0128
0129 void unlink() { m_obj = podio::utils::MaybeSharedPtr<TrajectoryObj>{nullptr}; }
0130
0131 bool operator==(const Trajectory& other) const { return m_obj == other.m_obj; }
0132 bool operator==(const MutableTrajectory& other) const;
0133
0134 bool operator!=(const Trajectory& other) const { return !(*this == other); }
0135 bool operator!=(const MutableTrajectory& other) const { return !(*this == other); }
0136
0137
0138 bool operator<(const Trajectory& other) const { return m_obj < other.m_obj; }
0139
0140 podio::ObjectID id() const { return getObjectID(); }
0141
0142 const podio::ObjectID getObjectID() const;
0143
0144 friend void swap(Trajectory& a, Trajectory& b) {
0145 using std::swap;
0146 swap(a.m_obj, b.m_obj);
0147 }
0148
0149 private:
0150
0151 explicit Trajectory(podio::utils::MaybeSharedPtr<TrajectoryObj> obj);
0152 Trajectory(TrajectoryObj* obj);
0153
0154 podio::utils::MaybeSharedPtr<TrajectoryObj> m_obj{nullptr};
0155 };
0156
0157 std::ostream& operator<<(std::ostream& o, const Trajectory& value);
0158
0159 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0160 void to_json(nlohmann::json& j, const Trajectory& value);
0161 #endif
0162
0163
0164 }
0165
0166
0167 #endif