File indexing completed on 2025-01-18 09:55:30
0001
0002
0003 #ifndef EDM4EIC_MutableMeasurement2D_H
0004 #define EDM4EIC_MutableMeasurement2D_H
0005
0006 #include "edm4eic/Measurement2DObj.h"
0007
0008 #include "edm4eic/Measurement2D.h"
0009
0010 #include "edm4eic/Cov3f.h"
0011 #include "edm4eic/TrackerHit.h"
0012 #include "edm4hep/Vector2f.h"
0013 #include "podio/RelationRange.h"
0014 #include <cstdint>
0015 #include <vector>
0016
0017 #include "podio/utilities/MaybeSharedPtr.h"
0018
0019 #include <cstdint>
0020
0021 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0022 #include "nlohmann/json_fwd.hpp"
0023 #endif
0024
0025
0026
0027 namespace edm4eic {
0028
0029
0030
0031
0032
0033
0034 class MutableMeasurement2D {
0035
0036 friend class Measurement2DCollection;
0037 friend class Measurement2DMutableCollectionIterator;
0038 friend class Measurement2D;
0039
0040 public:
0041 using object_type = Measurement2D;
0042 using collection_type = Measurement2DCollection;
0043
0044
0045 MutableMeasurement2D();
0046
0047
0048 MutableMeasurement2D(std::uint64_t surface, edm4hep::Vector2f loc, float time, edm4eic::Cov3f covariance);
0049
0050
0051 MutableMeasurement2D(const MutableMeasurement2D& other) = default;
0052
0053
0054 MutableMeasurement2D& operator=(MutableMeasurement2D other);
0055
0056
0057
0058 MutableMeasurement2D clone(bool cloneRelations=true) const;
0059
0060
0061 ~MutableMeasurement2D() = default;
0062
0063
0064 public:
0065
0066
0067 std::uint64_t getSurface() const;
0068
0069
0070 const edm4hep::Vector2f& getLoc() const;
0071
0072
0073 float getTime() const;
0074
0075
0076 const edm4eic::Cov3f& getCovariance() const;
0077
0078
0079
0080
0081 void setSurface(std::uint64_t value);
0082
0083 std::uint64_t& getSurface();
0084
0085 [[deprecated("use getSurface instead")]]
0086 std::uint64_t& surface();
0087
0088
0089 void setLoc(edm4hep::Vector2f value);
0090
0091 edm4hep::Vector2f& getLoc();
0092
0093 [[deprecated("use getLoc instead")]]
0094 edm4hep::Vector2f& loc();
0095
0096
0097 void setTime(float value);
0098
0099 float& getTime();
0100
0101 [[deprecated("use getTime instead")]]
0102 float& time();
0103
0104
0105 void setCovariance(edm4eic::Cov3f value);
0106
0107 edm4eic::Cov3f& getCovariance();
0108
0109 [[deprecated("use getCovariance instead")]]
0110 edm4eic::Cov3f& covariance();
0111
0112
0113
0114 void addToHits(const edm4eic::TrackerHit&);
0115 std::size_t hits_size() const;
0116 edm4eic::TrackerHit getHits(std::size_t) const;
0117 std::vector<edm4eic::TrackerHit>::const_iterator hits_begin() const;
0118 std::vector<edm4eic::TrackerHit>::const_iterator hits_end() const;
0119 podio::RelationRange<edm4eic::TrackerHit> getHits() const;
0120 void addToWeights(const float&);
0121 std::size_t weights_size() const;
0122 float getWeights(std::size_t) const;
0123 std::vector<float>::const_iterator weights_begin() const;
0124 std::vector<float>::const_iterator weights_end() const;
0125 podio::RelationRange<float> getWeights() const;
0126
0127
0128
0129
0130 bool isAvailable() const;
0131
0132 void unlink() { m_obj = podio::utils::MaybeSharedPtr<Measurement2DObj>{nullptr}; }
0133
0134 bool operator==(const MutableMeasurement2D& other) const { return m_obj == other.m_obj; }
0135 bool operator==(const Measurement2D& other) const;
0136
0137 bool operator!=(const MutableMeasurement2D& other) const { return !(*this == other); }
0138 bool operator!=(const Measurement2D& other) const { return !(*this == other); }
0139
0140
0141 bool operator<(const MutableMeasurement2D& other) const { return m_obj < other.m_obj; }
0142
0143 podio::ObjectID id() const { return getObjectID(); }
0144
0145 const podio::ObjectID getObjectID() const;
0146
0147 friend void swap(MutableMeasurement2D& a, MutableMeasurement2D& b) {
0148 using std::swap;
0149 swap(a.m_obj, b.m_obj);
0150 }
0151
0152 private:
0153
0154 explicit MutableMeasurement2D(podio::utils::MaybeSharedPtr<Measurement2DObj> obj);
0155
0156 podio::utils::MaybeSharedPtr<Measurement2DObj> m_obj{nullptr};
0157 };
0158
0159 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0160 void to_json(nlohmann::json& j, const MutableMeasurement2D& value);
0161 #endif
0162
0163
0164 }
0165
0166
0167 #endif