File indexing completed on 2025-12-16 10:13:01
0001
0002
0003 #ifndef EDM4HEP_RecDqdx_H
0004 #define EDM4HEP_RecDqdx_H
0005
0006 #include "edm4hep/RecDqdxObj.h"
0007
0008 #include "edm4hep/Quantity.h"
0009
0010 #include "podio/detail/OrderKey.h"
0011 #include "podio/utilities/MaybeSharedPtr.h"
0012
0013 #include <cstdint>
0014 #include <ostream>
0015
0016 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0017 #include "nlohmann/json_fwd.hpp"
0018 #endif
0019
0020
0021 namespace edm4hep {
0022 class RecDqdxCollection;
0023 class Track;
0024 class MutableTrack;
0025 }
0026
0027 namespace podio::detail {
0028
0029 OrderKey getOrderKey(const edm4hep::RecDqdx& obj);
0030 };
0031
0032 namespace edm4hep {
0033
0034 class MutableRecDqdx;
0035 class RecDqdxCollection;
0036 class RecDqdxCollectionData;
0037
0038
0039
0040
0041
0042 class RecDqdx {
0043
0044 friend class MutableRecDqdx;
0045 friend class RecDqdxCollection;
0046 friend class edm4hep::RecDqdxCollectionData;
0047 friend class RecDqdxCollectionIterator;
0048 friend podio::detail::OrderKey podio::detail::getOrderKey(const RecDqdx& obj);
0049
0050 public:
0051 using mutable_type = MutableRecDqdx;
0052 using collection_type = RecDqdxCollection;
0053
0054
0055 RecDqdx() = default;
0056
0057
0058 RecDqdx(const edm4hep::Quantity& dQdx);
0059
0060
0061 RecDqdx(const RecDqdx& other) = default;
0062
0063
0064 RecDqdx& operator=(RecDqdx other) &;
0065 RecDqdx& operator=(RecDqdx other) && = delete;
0066
0067
0068
0069 MutableRecDqdx clone(bool cloneRelations = true) const;
0070
0071
0072 ~RecDqdx() = default;
0073
0074
0075 RecDqdx(const MutableRecDqdx& other);
0076
0077 static RecDqdx makeEmpty();
0078
0079 public:
0080 static constexpr std::string_view typeName = "edm4hep::RecDqdx";
0081
0082
0083 const edm4hep::Quantity& getDQdx() const;
0084
0085
0086 const edm4hep::Track getTrack() const;
0087
0088
0089 bool isAvailable() const;
0090
0091 void unlink() { m_obj = podio::utils::MaybeSharedPtr<RecDqdxObj>{nullptr}; }
0092
0093 bool operator==(const RecDqdx& other) const { return m_obj == other.m_obj; }
0094 bool operator==(const MutableRecDqdx& other) const;
0095
0096 bool operator!=(const RecDqdx& other) const { return !(*this == other); }
0097 bool operator!=(const MutableRecDqdx& other) const { return !(*this == other); }
0098
0099
0100 bool operator<(const RecDqdx& other) const {
0101 return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other);
0102 }
0103
0104 podio::ObjectID id() const { return getObjectID(); }
0105
0106 const podio::ObjectID getObjectID() const;
0107
0108 friend std::hash<RecDqdx>;
0109
0110 friend void swap(RecDqdx& a, RecDqdx& b) {
0111 using std::swap;
0112 swap(a.m_obj, b.m_obj);
0113 }
0114
0115 private:
0116
0117 explicit RecDqdx(podio::utils::MaybeSharedPtr<RecDqdxObj> obj);
0118 RecDqdx(RecDqdxObj* obj);
0119
0120 podio::utils::MaybeSharedPtr<RecDqdxObj> m_obj{new RecDqdxObj{}, podio::utils::MarkOwned};
0121 };
0122
0123 std::ostream& operator<<(std::ostream& o, const RecDqdx& value);
0124
0125 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0126 void to_json(nlohmann::json& j, const RecDqdx& value);
0127 #endif
0128
0129 }
0130
0131 template <>
0132 struct std::hash<edm4hep::RecDqdx> {
0133 std::size_t operator()(const edm4hep::RecDqdx& obj) const {
0134 return std::hash<edm4hep::RecDqdxObj*>{}(obj.m_obj.get());
0135 }
0136 };
0137
0138
0139
0140
0141 #if defined(__clang__)
0142 #pragma clang diagnostic push
0143 #pragma clang diagnostic ignored "-Wunknown-warning-option"
0144 #pragma clang diagnostic ignored "-Wdeprecated-redundant-constexpr-static-def"
0145 #pragma clang diagnostic ignored "-Wdeprecated"
0146 constexpr std::string_view edm4hep::RecDqdx::typeName;
0147 #pragma clang diagnostic pop
0148 #elif defined(__GNUC__)
0149 #pragma GCC diagnostic push
0150 #pragma GCC diagnostic ignored "-Wdeprecated"
0151 constexpr std::string_view edm4hep::RecDqdx::typeName;
0152 #pragma GCC diagnostic pop
0153 #endif
0154
0155 #endif