File indexing completed on 2026-06-04 08:12:04
0001
0002
0003 #ifndef ACTSPODIOEDM_MutableTrackerHitLocal_H
0004 #define ACTSPODIOEDM_MutableTrackerHitLocal_H
0005
0006 #include "ActsPodioEdm/TrackerHitLocalObj.h"
0007
0008
0009 #include "ActsPodioEdm/TrackerHitLocal.h"
0010
0011 #include <cstdint>
0012 #include <vector>
0013
0014 #include "edm4hep/Vector3d.h"
0015 #include "podio/RelationRange.h"
0016 #include "podio/utilities/MaybeSharedPtr.h"
0017
0018 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0019 #include "nlohmann/json_fwd.hpp"
0020 #endif
0021
0022
0023 namespace ActsPodioEdm {
0024 class TrackerHitLocalCollection;
0025 }
0026
0027 namespace ActsPodioEdm {
0028
0029
0030
0031
0032
0033 class MutableTrackerHitLocal {
0034 friend class TrackerHitLocalCollection;
0035 friend class TrackerHitLocalMutableCollectionIterator;
0036 friend class TrackerHitLocal;
0037
0038 public:
0039 using object_type = TrackerHitLocal;
0040 using collection_type = TrackerHitLocalCollection;
0041
0042
0043 MutableTrackerHitLocal() = default;
0044
0045
0046 MutableTrackerHitLocal(const std::uint64_t cellID, const std::int32_t type,
0047 const std::int32_t quality, const float time,
0048 const float eDep, const float eDepError,
0049 const edm4hep::Vector3d& position);
0050
0051
0052 MutableTrackerHitLocal(const MutableTrackerHitLocal& other) = default;
0053
0054
0055 MutableTrackerHitLocal& operator=(
0056 MutableTrackerHitLocal
0057 other) &;
0058 MutableTrackerHitLocal& operator=(MutableTrackerHitLocal other) && =
0059 delete;
0060
0061
0062
0063 MutableTrackerHitLocal clone(bool cloneRelations = true) const;
0064
0065
0066 ~MutableTrackerHitLocal() = default;
0067
0068 public:
0069
0070 std::uint64_t getCellID() const;
0071
0072
0073 std::int32_t getType() const;
0074
0075
0076 std::int32_t getQuality() const;
0077
0078
0079 float getTime() const;
0080
0081
0082 float getEDep() const;
0083
0084
0085 float getEDepError() const;
0086
0087
0088 const edm4hep::Vector3d& getPosition() const;
0089
0090
0091 void setCellID(const std::uint64_t cellID);
0092
0093 std::uint64_t& getCellID();
0094
0095 [[deprecated("use getCellID instead")]]
0096 std::uint64_t& cellID();
0097
0098
0099 void setType(const std::int32_t type);
0100
0101 std::int32_t& getType();
0102
0103 [[deprecated("use getType instead")]]
0104 std::int32_t& type();
0105
0106
0107 void setQuality(const std::int32_t quality);
0108
0109 std::int32_t& getQuality();
0110
0111 [[deprecated("use getQuality instead")]]
0112 std::int32_t& quality();
0113
0114
0115 void setTime(const float time);
0116
0117
0118 float& getTime();
0119
0120 [[deprecated("use getTime instead")]]
0121 float& time();
0122
0123
0124 void setEDep(const float eDep);
0125
0126 float& getEDep();
0127
0128 [[deprecated("use getEDep instead")]]
0129 float& eDep();
0130
0131
0132 void setEDepError(const float eDepError);
0133
0134 float& getEDepError();
0135
0136 [[deprecated("use getEDepError instead")]]
0137 float& eDepError();
0138
0139
0140 void setPosition(const edm4hep::Vector3d& position);
0141
0142
0143 edm4hep::Vector3d& getPosition();
0144
0145 [[deprecated("use getPosition instead")]]
0146 edm4hep::Vector3d& position();
0147
0148 void addToMeasurement(const float&);
0149 std::size_t measurement_size() const;
0150 float getMeasurement(std::size_t) const;
0151 std::vector<float>::const_iterator measurement_begin() const;
0152 std::vector<float>::const_iterator measurement_end() const;
0153 podio::RelationRange<float> getMeasurement() const;
0154 void addToCovariance(const float&);
0155 std::size_t covariance_size() const;
0156 float getCovariance(std::size_t) const;
0157 std::vector<float>::const_iterator covariance_begin() const;
0158 std::vector<float>::const_iterator covariance_end() const;
0159 podio::RelationRange<float> getCovariance() const;
0160
0161
0162 bool isAvailable() const;
0163
0164 void unlink() {
0165 m_obj = podio::utils::MaybeSharedPtr<TrackerHitLocalObj>{nullptr};
0166 }
0167
0168 bool operator==(const MutableTrackerHitLocal& other) const {
0169 return m_obj == other.m_obj;
0170 }
0171 bool operator==(const TrackerHitLocal& other) const;
0172
0173 bool operator!=(const MutableTrackerHitLocal& other) const {
0174 return !(*this == other);
0175 }
0176 bool operator!=(const TrackerHitLocal& other) const {
0177 return !(*this == other);
0178 }
0179
0180
0181 bool operator<(const MutableTrackerHitLocal& other) const {
0182 return podio::detail::getOrderKey(*this) <
0183 podio::detail::getOrderKey(other);
0184 }
0185
0186 podio::ObjectID id() const { return getObjectID(); }
0187
0188 const podio::ObjectID getObjectID() const;
0189
0190 friend std::hash<MutableTrackerHitLocal>;
0191
0192 friend void swap(MutableTrackerHitLocal& a, MutableTrackerHitLocal& b) {
0193 using std::swap;
0194 swap(a.m_obj, b.m_obj);
0195 }
0196
0197 private:
0198
0199 explicit MutableTrackerHitLocal(
0200 podio::utils::MaybeSharedPtr<TrackerHitLocalObj> obj);
0201
0202 podio::utils::MaybeSharedPtr<TrackerHitLocalObj> m_obj{
0203 new TrackerHitLocalObj{}, podio::utils::MarkOwned};
0204 };
0205
0206 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0207 void to_json(nlohmann::json& j, const MutableTrackerHitLocal& value);
0208 #endif
0209
0210 }
0211
0212 template <>
0213 struct std::hash<ActsPodioEdm::MutableTrackerHitLocal> {
0214 std::size_t operator()(
0215 const ActsPodioEdm::MutableTrackerHitLocal& obj) const {
0216 return std::hash<ActsPodioEdm::TrackerHitLocalObj*>{}(obj.m_obj.get());
0217 }
0218 };
0219
0220 #endif