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