File indexing completed on 2026-03-30 07:57:06
0001
0002
0003 #ifndef ACTSPODIOEDM_Measurement_H
0004 #define ACTSPODIOEDM_Measurement_H
0005
0006 #include "ActsPodioEdm/MeasurementObj.h"
0007
0008 #include <cstdint>
0009 #include <ostream>
0010 #include <vector>
0011
0012 #include "podio/RelationRange.h"
0013 #include "podio/detail/OrderKey.h"
0014 #include "podio/utilities/MaybeSharedPtr.h"
0015
0016 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0017 #include "nlohmann/json_fwd.hpp"
0018 #endif
0019
0020
0021 namespace ActsPodioEdm {
0022 class MeasurementCollection;
0023 }
0024 namespace edm4hep {
0025 class SimTrackerHit;
0026 class MutableSimTrackerHit;
0027 }
0028
0029 namespace podio::detail {
0030
0031
0032 OrderKey getOrderKey(const ActsPodioEdm::Measurement& obj);
0033 };
0034
0035 namespace ActsPodioEdm {
0036
0037 class MutableMeasurement;
0038 class MeasurementCollection;
0039 class MeasurementCollectionData;
0040
0041
0042
0043
0044
0045 class Measurement {
0046 friend class MutableMeasurement;
0047 friend class MeasurementCollection;
0048 friend class ActsPodioEdm::MeasurementCollectionData;
0049 friend class MeasurementCollectionIterator;
0050 friend podio::detail::OrderKey podio::detail::getOrderKey(
0051 const Measurement& obj);
0052
0053 public:
0054 using mutable_type = MutableMeasurement;
0055 using collection_type = MeasurementCollection;
0056
0057
0058 Measurement() = default;
0059
0060
0061 Measurement(const std::uint64_t geometryId);
0062
0063
0064 Measurement(const Measurement& other) = default;
0065
0066
0067 Measurement& operator=(
0068 Measurement other) &;
0069 Measurement& operator=(Measurement other) && =
0070 delete;
0071
0072
0073
0074 MutableMeasurement clone(bool cloneRelations = true) const;
0075
0076
0077 ~Measurement() = default;
0078
0079
0080 Measurement(const MutableMeasurement& other);
0081
0082 static Measurement makeEmpty();
0083
0084 public:
0085 static constexpr std::string_view typeName = "ActsPodioEdm::Measurement";
0086
0087
0088 std::uint64_t getGeometryId() const;
0089
0090
0091 const edm4hep::SimTrackerHit getSimHit() const;
0092
0093 std::size_t indices_size() const;
0094 std::uint16_t getIndices(std::size_t) const;
0095 std::vector<std::uint16_t>::const_iterator indices_begin() const;
0096 std::vector<std::uint16_t>::const_iterator indices_end() const;
0097 podio::RelationRange<std::uint16_t> getIndices() const;
0098 std::size_t parameterValues_size() const;
0099 double getParameterValues(std::size_t) const;
0100 std::vector<double>::const_iterator parameterValues_begin() const;
0101 std::vector<double>::const_iterator parameterValues_end() const;
0102 podio::RelationRange<double> getParameterValues() const;
0103 std::size_t covarianceValues_size() const;
0104 double getCovarianceValues(std::size_t) const;
0105 std::vector<double>::const_iterator covarianceValues_begin() const;
0106 std::vector<double>::const_iterator covarianceValues_end() const;
0107 podio::RelationRange<double> getCovarianceValues() const;
0108
0109 std::size_t size() const { return indices_size(); }
0110
0111
0112 bool isAvailable() const;
0113
0114 void unlink() {
0115 m_obj = podio::utils::MaybeSharedPtr<MeasurementObj>{nullptr};
0116 }
0117
0118 bool operator==(const Measurement& other) const {
0119 return m_obj == other.m_obj;
0120 }
0121 bool operator==(const MutableMeasurement& other) const;
0122
0123 bool operator!=(const Measurement& other) const { return !(*this == other); }
0124 bool operator!=(const MutableMeasurement& other) const {
0125 return !(*this == other);
0126 }
0127
0128
0129 bool operator<(const Measurement& other) const {
0130 return podio::detail::getOrderKey(*this) <
0131 podio::detail::getOrderKey(other);
0132 }
0133
0134 podio::ObjectID id() const { return getObjectID(); }
0135
0136 const podio::ObjectID getObjectID() const;
0137
0138 friend std::hash<Measurement>;
0139
0140 friend void swap(Measurement& a, Measurement& b) {
0141 using std::swap;
0142 swap(a.m_obj, b.m_obj);
0143 }
0144
0145 private:
0146
0147 explicit Measurement(podio::utils::MaybeSharedPtr<MeasurementObj> obj);
0148 Measurement(MeasurementObj* obj);
0149
0150 podio::utils::MaybeSharedPtr<MeasurementObj> m_obj{new MeasurementObj{},
0151 podio::utils::MarkOwned};
0152 };
0153
0154 std::ostream& operator<<(std::ostream& o, const Measurement& value);
0155
0156 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0157 void to_json(nlohmann::json& j, const Measurement& value);
0158 #endif
0159
0160 }
0161
0162 template <>
0163 struct std::hash<ActsPodioEdm::Measurement> {
0164 std::size_t operator()(const ActsPodioEdm::Measurement& obj) const {
0165 return std::hash<ActsPodioEdm::MeasurementObj*>{}(obj.m_obj.get());
0166 }
0167 };
0168
0169
0170
0171
0172
0173 #if defined(__clang__)
0174 #pragma clang diagnostic push
0175 #pragma clang diagnostic ignored "-Wunknown-warning-option"
0176 #pragma clang diagnostic ignored "-Wdeprecated-redundant-constexpr-static-def"
0177 #pragma clang diagnostic ignored "-Wdeprecated"
0178 constexpr std::string_view ActsPodioEdm::Measurement::typeName;
0179 #pragma clang diagnostic pop
0180 #elif defined(__GNUC__)
0181 #pragma GCC diagnostic push
0182 #pragma GCC diagnostic ignored "-Wdeprecated"
0183 constexpr std::string_view ActsPodioEdm::Measurement::typeName;
0184 #pragma GCC diagnostic pop
0185 #endif
0186
0187 #endif