File indexing completed on 2025-01-18 09:55:37
0001
0002
0003 #ifndef EDM4HEP_MutableRecDqdx_H
0004 #define EDM4HEP_MutableRecDqdx_H
0005
0006 #include "edm4hep/RecDqdxObj.h"
0007
0008 #include "edm4hep/RecDqdx.h"
0009
0010 #include "edm4hep/HitLevelData.h"
0011 #include "edm4hep/Hypothesis.h"
0012 #include "edm4hep/Quantity.h"
0013 #include "podio/RelationRange.h"
0014 #include <array>
0015 #include <cstdint>
0016 #include <vector>
0017
0018 #include "podio/utilities/MaybeSharedPtr.h"
0019
0020 #include <cstdint>
0021
0022 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0023 #include "nlohmann/json_fwd.hpp"
0024 #endif
0025
0026
0027 namespace edm4hep {
0028 class Track;
0029 class MutableTrack;
0030 }
0031
0032 namespace edm4hep {
0033
0034
0035
0036
0037
0038 class MutableRecDqdx {
0039
0040 friend class RecDqdxCollection;
0041 friend class RecDqdxMutableCollectionIterator;
0042 friend class RecDqdx;
0043
0044 public:
0045 using object_type = RecDqdx;
0046 using collection_type = RecDqdxCollection;
0047
0048
0049 MutableRecDqdx();
0050
0051
0052 MutableRecDqdx(edm4hep::Quantity dQdx, std::int16_t particleType, std::int16_t type,
0053 std::array<edm4hep::Hypothesis, 5> hypotheses);
0054
0055
0056 MutableRecDqdx(const MutableRecDqdx& other) = default;
0057
0058
0059 MutableRecDqdx& operator=(MutableRecDqdx other);
0060
0061
0062
0063 MutableRecDqdx clone(bool cloneRelations = true) const;
0064
0065
0066 ~MutableRecDqdx() = default;
0067
0068 public:
0069
0070 const edm4hep::Quantity& getDQdx() const;
0071
0072
0073 std::int16_t getParticleType() const;
0074
0075
0076 std::int16_t getType() const;
0077
0078
0079 const std::array<edm4hep::Hypothesis, 5>& getHypotheses() const;
0080
0081 const edm4hep::Hypothesis& getHypotheses(size_t i) const;
0082
0083
0084 const edm4hep::Track getTrack() const;
0085
0086
0087 void setDQdx(edm4hep::Quantity value);
0088
0089 edm4hep::Quantity& getDQdx();
0090
0091 [[deprecated("use getDQdx instead")]] edm4hep::Quantity& dQdx();
0092
0093
0094 void setParticleType(std::int16_t value);
0095
0096 std::int16_t& getParticleType();
0097
0098 [[deprecated("use getParticleType instead")]] std::int16_t& particleType();
0099
0100
0101 void setType(std::int16_t value);
0102
0103 std::int16_t& getType();
0104
0105 [[deprecated("use getType instead")]] std::int16_t& type();
0106
0107
0108 void setHypotheses(std::array<edm4hep::Hypothesis, 5> value);
0109 void setHypotheses(size_t i, edm4hep::Hypothesis value);
0110
0111 std::array<edm4hep::Hypothesis, 5>& getHypotheses();
0112
0113 [[deprecated("use getHypotheses instead")]] std::array<edm4hep::Hypothesis, 5>& hypotheses();
0114
0115
0116 void setTrack(const edm4hep::Track& value);
0117
0118 void addToHitData(const edm4hep::HitLevelData&);
0119 std::size_t hitData_size() const;
0120 edm4hep::HitLevelData getHitData(std::size_t) const;
0121 std::vector<edm4hep::HitLevelData>::const_iterator hitData_begin() const;
0122 std::vector<edm4hep::HitLevelData>::const_iterator hitData_end() const;
0123 podio::RelationRange<edm4hep::HitLevelData> getHitData() const;
0124
0125
0126 bool isAvailable() const;
0127
0128 void unlink() {
0129 m_obj = podio::utils::MaybeSharedPtr<RecDqdxObj>{nullptr};
0130 }
0131
0132 bool operator==(const MutableRecDqdx& other) const {
0133 return m_obj == other.m_obj;
0134 }
0135 bool operator==(const RecDqdx& other) const;
0136
0137 bool operator!=(const MutableRecDqdx& other) const {
0138 return !(*this == other);
0139 }
0140 bool operator!=(const RecDqdx& other) const {
0141 return !(*this == other);
0142 }
0143
0144
0145 bool operator<(const MutableRecDqdx& other) const {
0146 return m_obj < other.m_obj;
0147 }
0148
0149 podio::ObjectID id() const {
0150 return getObjectID();
0151 }
0152
0153 const podio::ObjectID getObjectID() const;
0154
0155 friend void swap(MutableRecDqdx& a, MutableRecDqdx& b) {
0156 using std::swap;
0157 swap(a.m_obj, b.m_obj);
0158 }
0159
0160 private:
0161
0162 explicit MutableRecDqdx(podio::utils::MaybeSharedPtr<RecDqdxObj> obj);
0163
0164 podio::utils::MaybeSharedPtr<RecDqdxObj> m_obj{nullptr};
0165 };
0166
0167 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0168 void to_json(nlohmann::json& j, const MutableRecDqdx& value);
0169 #endif
0170
0171 }
0172
0173 #endif