File indexing completed on 2026-10-05 09:11:10
0001
0002
0003 #ifndef EDM4HEP_MutableTrackerHitPlane_H
0004 #define EDM4HEP_MutableTrackerHitPlane_H
0005
0006 #include "edm4hep/TrackerHitPlaneObj.h"
0007
0008 #include "edm4hep/TrackerHitPlane.h"
0009
0010 #include "edm4hep/CovMatrix3f.h"
0011 #include "edm4hep/Vector2f.h"
0012 #include "edm4hep/Vector3d.h"
0013 #include <cstdint>
0014 #include <edm4hep/Constants.h>
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 edm4hep {
0026 class TrackerHitPlaneCollection;
0027 class TrackerHit;
0028 }
0029
0030 namespace edm4hep {
0031
0032
0033
0034
0035
0036 class MutableTrackerHitPlane {
0037
0038 friend class TrackerHitPlaneCollection;
0039 friend class TrackerHitPlaneMutableCollectionIterator;
0040 friend class TrackerHitPlane;
0041
0042 public:
0043 using object_type = TrackerHitPlane;
0044 using collection_type = TrackerHitPlaneCollection;
0045
0046
0047 MutableTrackerHitPlane() = default;
0048
0049
0050 MutableTrackerHitPlane(const std::uint64_t cellID, const std::int32_t type, const std::int32_t quality,
0051 const float time, const float eDep, const float eDepError, const edm4hep::Vector2f& u,
0052 const edm4hep::Vector2f& v, const float du, const float dv, const edm4hep::Vector3d& position,
0053 const edm4hep::CovMatrix3f& covMatrix);
0054
0055
0056 MutableTrackerHitPlane(const MutableTrackerHitPlane& other) = default;
0057
0058
0059 MutableTrackerHitPlane& operator=(MutableTrackerHitPlane other) &;
0060 MutableTrackerHitPlane&
0061 operator=(MutableTrackerHitPlane other) && = delete;
0062
0063
0064
0065 MutableTrackerHitPlane clone(bool cloneRelations = true) const;
0066
0067
0068 ~MutableTrackerHitPlane() = default;
0069
0070 public:
0071
0072 std::uint64_t getCellID() const;
0073
0074
0075 std::int32_t getType() const;
0076
0077
0078 std::int32_t getQuality() const;
0079
0080
0081 float getTime() const;
0082
0083
0084 float getEDep() const;
0085
0086
0087 float getEDepError() const;
0088
0089
0090 const edm4hep::Vector2f& getU() const;
0091
0092
0093 const edm4hep::Vector2f& getV() const;
0094
0095
0096 float getDu() const;
0097
0098
0099 float getDv() const;
0100
0101
0102 const edm4hep::Vector3d& getPosition() const;
0103
0104
0105 const edm4hep::CovMatrix3f& getCovMatrix() const;
0106
0107
0108 void setCellID(const std::uint64_t cellID);
0109
0110 std::uint64_t& getCellID();
0111
0112
0113 void setType(const std::int32_t type);
0114
0115 std::int32_t& getType();
0116
0117
0118 void setQuality(const std::int32_t quality);
0119
0120 std::int32_t& getQuality();
0121
0122
0123 void setTime(const float time);
0124
0125 float& getTime();
0126
0127
0128 void setEDep(const float eDep);
0129
0130 float& getEDep();
0131
0132
0133 void setEDepError(const float eDepError);
0134
0135 float& getEDepError();
0136
0137
0138 void setU(const edm4hep::Vector2f& u);
0139
0140 edm4hep::Vector2f& getU();
0141
0142
0143 void setV(const edm4hep::Vector2f& v);
0144
0145 edm4hep::Vector2f& getV();
0146
0147
0148 void setDu(const float du);
0149
0150 float& getDu();
0151
0152
0153 void setDv(const float dv);
0154
0155 float& getDv();
0156
0157
0158 void setPosition(const edm4hep::Vector3d& position);
0159
0160 edm4hep::Vector3d& getPosition();
0161
0162
0163 void setCovMatrix(const edm4hep::CovMatrix3f& covMatrix);
0164
0165 edm4hep::CovMatrix3f& getCovMatrix();
0166
0167
0168 float getCovMatrix(edm4hep::Cartesian dimI, edm4hep::Cartesian dimJ) const {
0169 return getCovMatrix().getValue(dimI, dimJ);
0170 }
0171
0172
0173 void setCovMatrix(float value, edm4hep::Cartesian dimI, edm4hep::Cartesian dimJ) {
0174 getCovMatrix().setValue(value, dimI, dimJ);
0175 }
0176
0177
0178 bool isAvailable() const;
0179
0180 void unlink() { m_obj = podio::utils::MaybeSharedPtr<TrackerHitPlaneObj>{nullptr}; }
0181
0182 constexpr bool operator==(const MutableTrackerHitPlane& other) const { return m_obj == other.m_obj; }
0183 bool operator==(const TrackerHitPlane& other) const;
0184
0185 constexpr bool operator!=(const MutableTrackerHitPlane& other) const { return !(*this == other); }
0186 bool operator!=(const TrackerHitPlane& other) const { return !(*this == other); }
0187
0188
0189 bool operator<(const MutableTrackerHitPlane& other) const {
0190 return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other);
0191 }
0192
0193 podio::ObjectID id() const { return getObjectID(); }
0194
0195 const podio::ObjectID getObjectID() const;
0196
0197 friend std::hash<MutableTrackerHitPlane>;
0198
0199 friend void swap(MutableTrackerHitPlane& a, MutableTrackerHitPlane& b) {
0200 using std::swap;
0201 swap(a.m_obj, b.m_obj);
0202 }
0203
0204 private:
0205
0206 explicit MutableTrackerHitPlane(podio::utils::MaybeSharedPtr<TrackerHitPlaneObj> obj);
0207
0208 podio::utils::MaybeSharedPtr<TrackerHitPlaneObj> m_obj{new TrackerHitPlaneObj{}, podio::utils::MarkOwned};
0209 };
0210
0211 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0212 void to_json(nlohmann::json& j, const MutableTrackerHitPlane& value);
0213 #endif
0214
0215 }
0216
0217 template <>
0218 struct std::hash<edm4hep::MutableTrackerHitPlane> {
0219 std::size_t operator()(const edm4hep::MutableTrackerHitPlane& obj) const {
0220 return std::hash<edm4hep::TrackerHitPlaneObj*>{}(obj.m_obj.get());
0221 }
0222 };
0223
0224 #endif