File indexing completed on 2025-12-20 10:08:49
0001
0002
0003 #ifndef EDM4HEP_TrackerHitPlane_H
0004 #define EDM4HEP_TrackerHitPlane_H
0005
0006 #include "edm4hep/TrackerHitPlaneObj.h"
0007
0008 #include "edm4hep/CovMatrix3f.h"
0009 #include "edm4hep/Vector2f.h"
0010 #include "edm4hep/Vector3d.h"
0011 #include <cstdint>
0012 #include <edm4hep/Constants.h>
0013
0014 #include "podio/detail/OrderKey.h"
0015 #include "podio/utilities/MaybeSharedPtr.h"
0016
0017 #include <cstdint>
0018 #include <ostream>
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 podio::detail {
0031
0032 OrderKey getOrderKey(const edm4hep::TrackerHitPlane& obj);
0033 };
0034
0035 namespace edm4hep {
0036
0037 class MutableTrackerHitPlane;
0038 class TrackerHitPlaneCollection;
0039 class TrackerHitPlaneCollectionData;
0040
0041
0042
0043
0044
0045 class TrackerHitPlane {
0046
0047 friend class MutableTrackerHitPlane;
0048 friend class TrackerHitPlaneCollection;
0049 friend class edm4hep::TrackerHitPlaneCollectionData;
0050 friend class TrackerHitPlaneCollectionIterator;
0051 friend podio::detail::OrderKey podio::detail::getOrderKey(const TrackerHitPlane& obj);
0052
0053 public:
0054 using mutable_type = MutableTrackerHitPlane;
0055 using collection_type = TrackerHitPlaneCollection;
0056
0057
0058 TrackerHitPlane() = default;
0059
0060
0061 TrackerHitPlane(const std::uint64_t cellID, const std::int32_t type, const std::int32_t quality, const float time,
0062 const float eDep, const float eDepError, const edm4hep::Vector2f& u, const edm4hep::Vector2f& v,
0063 const float du, const float dv, const edm4hep::Vector3d& position,
0064 const edm4hep::CovMatrix3f& covMatrix);
0065
0066
0067 TrackerHitPlane(const TrackerHitPlane& other) = default;
0068
0069
0070 TrackerHitPlane& operator=(TrackerHitPlane other) &;
0071 TrackerHitPlane&
0072 operator=(TrackerHitPlane other) && = delete;
0073
0074
0075
0076 MutableTrackerHitPlane clone(bool cloneRelations = true) const;
0077
0078
0079 ~TrackerHitPlane() = default;
0080
0081
0082 TrackerHitPlane(const MutableTrackerHitPlane& other);
0083
0084 static TrackerHitPlane makeEmpty();
0085
0086 public:
0087 static constexpr std::string_view typeName = "edm4hep::TrackerHitPlane";
0088
0089
0090 std::uint64_t getCellID() const;
0091
0092
0093 std::int32_t getType() const;
0094
0095
0096 std::int32_t getQuality() const;
0097
0098
0099 float getTime() const;
0100
0101
0102 float getEDep() const;
0103
0104
0105 float getEDepError() const;
0106
0107
0108 const edm4hep::Vector2f& getU() const;
0109
0110
0111 const edm4hep::Vector2f& getV() const;
0112
0113
0114 float getDu() const;
0115
0116
0117 float getDv() const;
0118
0119
0120 const edm4hep::Vector3d& getPosition() const;
0121
0122
0123 const edm4hep::CovMatrix3f& getCovMatrix() const;
0124
0125
0126 float getCovMatrix(edm4hep::Cartesian dimI, edm4hep::Cartesian dimJ) const {
0127 return getCovMatrix().getValue(dimI, dimJ);
0128 }
0129
0130
0131 bool isAvailable() const;
0132
0133 void unlink() { m_obj = podio::utils::MaybeSharedPtr<TrackerHitPlaneObj>{nullptr}; }
0134
0135 bool operator==(const TrackerHitPlane& other) const { return m_obj == other.m_obj; }
0136 bool operator==(const MutableTrackerHitPlane& other) const;
0137
0138 bool operator!=(const TrackerHitPlane& other) const { return !(*this == other); }
0139 bool operator!=(const MutableTrackerHitPlane& other) const { return !(*this == other); }
0140
0141
0142 bool operator<(const TrackerHitPlane& other) const {
0143 return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other);
0144 }
0145
0146 podio::ObjectID id() const { return getObjectID(); }
0147
0148 const podio::ObjectID getObjectID() const;
0149
0150 friend std::hash<TrackerHitPlane>;
0151
0152 friend void swap(TrackerHitPlane& a, TrackerHitPlane& b) {
0153 using std::swap;
0154 swap(a.m_obj, b.m_obj);
0155 }
0156
0157 private:
0158
0159 explicit TrackerHitPlane(podio::utils::MaybeSharedPtr<TrackerHitPlaneObj> obj);
0160 TrackerHitPlane(TrackerHitPlaneObj* obj);
0161
0162 podio::utils::MaybeSharedPtr<TrackerHitPlaneObj> m_obj{new TrackerHitPlaneObj{}, podio::utils::MarkOwned};
0163 };
0164
0165 std::ostream& operator<<(std::ostream& o, const TrackerHitPlane& value);
0166
0167 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0168 void to_json(nlohmann::json& j, const TrackerHitPlane& value);
0169 #endif
0170
0171 }
0172
0173 template <>
0174 struct std::hash<edm4hep::TrackerHitPlane> {
0175 std::size_t operator()(const edm4hep::TrackerHitPlane& obj) const {
0176 return std::hash<edm4hep::TrackerHitPlaneObj*>{}(obj.m_obj.get());
0177 }
0178 };
0179
0180
0181
0182
0183 #if defined(__clang__)
0184 #pragma clang diagnostic push
0185 #pragma clang diagnostic ignored "-Wunknown-warning-option"
0186 #pragma clang diagnostic ignored "-Wdeprecated-redundant-constexpr-static-def"
0187 #pragma clang diagnostic ignored "-Wdeprecated"
0188 constexpr std::string_view edm4hep::TrackerHitPlane::typeName;
0189 #pragma clang diagnostic pop
0190 #elif defined(__GNUC__)
0191 #pragma GCC diagnostic push
0192 #pragma GCC diagnostic ignored "-Wdeprecated"
0193 constexpr std::string_view edm4hep::TrackerHitPlane::typeName;
0194 #pragma GCC diagnostic pop
0195 #endif
0196
0197 #endif