File indexing completed on 2025-06-03 08:33:27
0001
0002
0003 #ifndef EDM4HEP_TrackerHit3D_H
0004 #define EDM4HEP_TrackerHit3D_H
0005
0006 #include "edm4hep/TrackerHit3DObj.h"
0007
0008 #include "edm4hep/CovMatrix3f.h"
0009 #include "edm4hep/Vector3d.h"
0010 #include <cstdint>
0011 #include <edm4hep/Constants.h>
0012
0013 #include "podio/detail/OrderKey.h"
0014 #include "podio/utilities/MaybeSharedPtr.h"
0015
0016 #include <cstdint>
0017 #include <ostream>
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 podio::detail {
0030
0031 OrderKey getOrderKey(const edm4hep::TrackerHit3D& obj);
0032 };
0033
0034 namespace edm4hep {
0035
0036 class MutableTrackerHit3D;
0037 class TrackerHit3DCollection;
0038 class TrackerHit3DCollectionData;
0039
0040
0041
0042
0043
0044 class TrackerHit3D {
0045
0046 friend class MutableTrackerHit3D;
0047 friend class TrackerHit3DCollection;
0048 friend class edm4hep::TrackerHit3DCollectionData;
0049 friend class TrackerHit3DCollectionIterator;
0050 friend podio::detail::OrderKey podio::detail::getOrderKey(const TrackerHit3D& obj);
0051
0052 public:
0053 using mutable_type = MutableTrackerHit3D;
0054 using collection_type = TrackerHit3DCollection;
0055
0056
0057 TrackerHit3D();
0058
0059
0060 TrackerHit3D(std::uint64_t cellID, std::int32_t type, std::int32_t quality, float time, float eDep, float eDepError,
0061 edm4hep::Vector3d position, edm4hep::CovMatrix3f covMatrix);
0062
0063
0064 TrackerHit3D(const TrackerHit3D& other) = default;
0065
0066
0067 TrackerHit3D& operator=(TrackerHit3D other);
0068
0069
0070
0071 MutableTrackerHit3D clone(bool cloneRelations = true) const;
0072
0073
0074 ~TrackerHit3D() = default;
0075
0076
0077 TrackerHit3D(const MutableTrackerHit3D& other);
0078
0079 static TrackerHit3D makeEmpty();
0080
0081 public:
0082 static constexpr auto typeName = "edm4hep::TrackerHit3D";
0083
0084
0085 std::uint64_t getCellID() const;
0086
0087
0088 std::int32_t getType() const;
0089
0090
0091 std::int32_t getQuality() const;
0092
0093
0094 float getTime() const;
0095
0096
0097 float getEDep() const;
0098
0099
0100 float getEDepError() const;
0101
0102
0103 const edm4hep::Vector3d& getPosition() const;
0104
0105
0106 const edm4hep::CovMatrix3f& getCovMatrix() const;
0107
0108
0109 float getCovMatrix(edm4hep::Cartesian dimI, edm4hep::Cartesian dimJ) const {
0110 return getCovMatrix().getValue(dimI, dimJ);
0111 }
0112
0113
0114 bool isAvailable() const;
0115
0116 void unlink() {
0117 m_obj = podio::utils::MaybeSharedPtr<TrackerHit3DObj>{nullptr};
0118 }
0119
0120 bool operator==(const TrackerHit3D& other) const {
0121 return m_obj == other.m_obj;
0122 }
0123 bool operator==(const MutableTrackerHit3D& other) const;
0124
0125 bool operator!=(const TrackerHit3D& other) const {
0126 return !(*this == other);
0127 }
0128 bool operator!=(const MutableTrackerHit3D& other) const {
0129 return !(*this == other);
0130 }
0131
0132
0133 bool operator<(const TrackerHit3D& other) const {
0134 return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other);
0135 }
0136
0137 podio::ObjectID id() const {
0138 return getObjectID();
0139 }
0140
0141 const podio::ObjectID getObjectID() const;
0142
0143 friend void swap(TrackerHit3D& a, TrackerHit3D& b) {
0144 using std::swap;
0145 swap(a.m_obj, b.m_obj);
0146 }
0147
0148 private:
0149
0150 explicit TrackerHit3D(podio::utils::MaybeSharedPtr<TrackerHit3DObj> obj);
0151 TrackerHit3D(TrackerHit3DObj* obj);
0152
0153 podio::utils::MaybeSharedPtr<TrackerHit3DObj> m_obj{nullptr};
0154 };
0155
0156 std::ostream& operator<<(std::ostream& o, const TrackerHit3D& value);
0157
0158 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0159 void to_json(nlohmann::json& j, const TrackerHit3D& value);
0160 #endif
0161
0162 }
0163
0164 #endif