File indexing completed on 2025-07-01 08:35:25
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();
0048
0049
0050 MutableTrackerHitPlane(std::uint64_t cellID, std::int32_t type, std::int32_t quality, float time, float eDep,
0051 float eDepError, edm4hep::Vector2f u, edm4hep::Vector2f v, float du, float dv,
0052 edm4hep::Vector3d position, edm4hep::CovMatrix3f covMatrix);
0053
0054
0055 MutableTrackerHitPlane(const MutableTrackerHitPlane& other) = default;
0056
0057
0058 MutableTrackerHitPlane& operator=(MutableTrackerHitPlane other);
0059
0060
0061
0062 MutableTrackerHitPlane clone(bool cloneRelations = true) const;
0063
0064
0065 ~MutableTrackerHitPlane() = default;
0066
0067 public:
0068
0069 std::uint64_t getCellID() const;
0070
0071
0072 std::int32_t getType() const;
0073
0074
0075 std::int32_t getQuality() const;
0076
0077
0078 float getTime() const;
0079
0080
0081 float getEDep() const;
0082
0083
0084 float getEDepError() const;
0085
0086
0087 const edm4hep::Vector2f& getU() const;
0088
0089
0090 const edm4hep::Vector2f& getV() const;
0091
0092
0093 float getDu() const;
0094
0095
0096 float getDv() const;
0097
0098
0099 const edm4hep::Vector3d& getPosition() const;
0100
0101
0102 const edm4hep::CovMatrix3f& getCovMatrix() const;
0103
0104
0105 void setCellID(std::uint64_t value);
0106
0107 std::uint64_t& getCellID();
0108
0109 [[deprecated("use getCellID instead")]] std::uint64_t& cellID();
0110
0111
0112 void setType(std::int32_t value);
0113
0114 std::int32_t& getType();
0115
0116 [[deprecated("use getType instead")]] std::int32_t& type();
0117
0118
0119 void setQuality(std::int32_t value);
0120
0121 std::int32_t& getQuality();
0122
0123 [[deprecated("use getQuality instead")]] std::int32_t& quality();
0124
0125
0126 void setTime(float value);
0127
0128 float& getTime();
0129
0130 [[deprecated("use getTime instead")]] float& time();
0131
0132
0133 void setEDep(float value);
0134
0135 float& getEDep();
0136
0137 [[deprecated("use getEDep instead")]] float& eDep();
0138
0139
0140 void setEDepError(float value);
0141
0142 float& getEDepError();
0143
0144 [[deprecated("use getEDepError instead")]] float& eDepError();
0145
0146
0147 void setU(edm4hep::Vector2f value);
0148
0149 edm4hep::Vector2f& getU();
0150
0151 [[deprecated("use getU instead")]] edm4hep::Vector2f& u();
0152
0153
0154 void setV(edm4hep::Vector2f value);
0155
0156 edm4hep::Vector2f& getV();
0157
0158 [[deprecated("use getV instead")]] edm4hep::Vector2f& v();
0159
0160
0161 void setDu(float value);
0162
0163 float& getDu();
0164
0165 [[deprecated("use getDu instead")]] float& du();
0166
0167
0168 void setDv(float value);
0169
0170 float& getDv();
0171
0172 [[deprecated("use getDv instead")]] float& dv();
0173
0174
0175 void setPosition(edm4hep::Vector3d value);
0176
0177 edm4hep::Vector3d& getPosition();
0178
0179 [[deprecated("use getPosition instead")]] edm4hep::Vector3d& position();
0180
0181
0182 void setCovMatrix(edm4hep::CovMatrix3f value);
0183
0184 edm4hep::CovMatrix3f& getCovMatrix();
0185
0186 [[deprecated("use getCovMatrix instead")]] edm4hep::CovMatrix3f& covMatrix();
0187
0188
0189 float getCovMatrix(edm4hep::Cartesian dimI, edm4hep::Cartesian dimJ) const {
0190 return getCovMatrix().getValue(dimI, dimJ);
0191 }
0192
0193
0194 void setCovMatrix(float value, edm4hep::Cartesian dimI, edm4hep::Cartesian dimJ) {
0195 getCovMatrix().setValue(value, dimI, dimJ);
0196 }
0197
0198
0199 bool isAvailable() const;
0200
0201 void unlink() {
0202 m_obj = podio::utils::MaybeSharedPtr<TrackerHitPlaneObj>{nullptr};
0203 }
0204
0205 bool operator==(const MutableTrackerHitPlane& other) const {
0206 return m_obj == other.m_obj;
0207 }
0208 bool operator==(const TrackerHitPlane& other) const;
0209
0210 bool operator!=(const MutableTrackerHitPlane& other) const {
0211 return !(*this == other);
0212 }
0213 bool operator!=(const TrackerHitPlane& other) const {
0214 return !(*this == other);
0215 }
0216
0217
0218 bool operator<(const MutableTrackerHitPlane& other) const {
0219 return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other);
0220 }
0221
0222 podio::ObjectID id() const {
0223 return getObjectID();
0224 }
0225
0226 const podio::ObjectID getObjectID() const;
0227
0228 friend void swap(MutableTrackerHitPlane& a, MutableTrackerHitPlane& b) {
0229 using std::swap;
0230 swap(a.m_obj, b.m_obj);
0231 }
0232
0233 private:
0234
0235 explicit MutableTrackerHitPlane(podio::utils::MaybeSharedPtr<TrackerHitPlaneObj> obj);
0236
0237 podio::utils::MaybeSharedPtr<TrackerHitPlaneObj> m_obj{nullptr};
0238 };
0239
0240 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0241 void to_json(nlohmann::json& j, const MutableTrackerHitPlane& value);
0242 #endif
0243
0244 }
0245
0246 #endif