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