File indexing completed on 2025-01-18 09:55:38
0001
0002
0003 #ifndef EDM4HEP_MutableTrackerPulse_H
0004 #define EDM4HEP_MutableTrackerPulse_H
0005
0006 #include "edm4hep/TrackerPulseObj.h"
0007
0008 #include "edm4hep/TrackerPulse.h"
0009
0010 #include <array>
0011 #include <cstdint>
0012
0013 #include "podio/utilities/MaybeSharedPtr.h"
0014
0015 #include <cstdint>
0016
0017 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0018 #include "nlohmann/json_fwd.hpp"
0019 #endif
0020
0021
0022 namespace edm4hep {
0023 class TimeSeries;
0024 class MutableTimeSeries;
0025 }
0026
0027 namespace edm4hep {
0028
0029
0030
0031
0032
0033 class MutableTrackerPulse {
0034
0035 friend class TrackerPulseCollection;
0036 friend class TrackerPulseMutableCollectionIterator;
0037 friend class TrackerPulse;
0038
0039 public:
0040 using object_type = TrackerPulse;
0041 using collection_type = TrackerPulseCollection;
0042
0043
0044 MutableTrackerPulse();
0045
0046
0047 MutableTrackerPulse(std::uint64_t cellID, float time, float charge, std::int16_t quality,
0048 std::array<float, 3> covMatrix);
0049
0050
0051 MutableTrackerPulse(const MutableTrackerPulse& other) = default;
0052
0053
0054 MutableTrackerPulse& operator=(MutableTrackerPulse other);
0055
0056
0057
0058 MutableTrackerPulse clone(bool cloneRelations = true) const;
0059
0060
0061 ~MutableTrackerPulse() = default;
0062
0063 public:
0064
0065 std::uint64_t getCellID() const;
0066
0067
0068 float getTime() const;
0069
0070
0071 float getCharge() const;
0072
0073
0074 std::int16_t getQuality() const;
0075
0076
0077 const std::array<float, 3>& getCovMatrix() const;
0078
0079 float getCovMatrix(size_t i) const;
0080
0081
0082 const edm4hep::TimeSeries getTimeSeries() const;
0083
0084
0085 void setCellID(std::uint64_t value);
0086
0087 std::uint64_t& getCellID();
0088
0089 [[deprecated("use getCellID instead")]] std::uint64_t& cellID();
0090
0091
0092 void setTime(float value);
0093
0094 float& getTime();
0095
0096 [[deprecated("use getTime instead")]] float& time();
0097
0098
0099 void setCharge(float value);
0100
0101 float& getCharge();
0102
0103 [[deprecated("use getCharge instead")]] float& charge();
0104
0105
0106 void setQuality(std::int16_t value);
0107
0108 std::int16_t& getQuality();
0109
0110 [[deprecated("use getQuality instead")]] std::int16_t& quality();
0111
0112
0113 void setCovMatrix(std::array<float, 3> value);
0114 void setCovMatrix(size_t i, float value);
0115
0116 std::array<float, 3>& getCovMatrix();
0117
0118 [[deprecated("use getCovMatrix instead")]] std::array<float, 3>& covMatrix();
0119
0120
0121 void setTimeSeries(const edm4hep::TimeSeries& value);
0122
0123
0124 bool isAvailable() const;
0125
0126 void unlink() {
0127 m_obj = podio::utils::MaybeSharedPtr<TrackerPulseObj>{nullptr};
0128 }
0129
0130 bool operator==(const MutableTrackerPulse& other) const {
0131 return m_obj == other.m_obj;
0132 }
0133 bool operator==(const TrackerPulse& other) const;
0134
0135 bool operator!=(const MutableTrackerPulse& other) const {
0136 return !(*this == other);
0137 }
0138 bool operator!=(const TrackerPulse& other) const {
0139 return !(*this == other);
0140 }
0141
0142
0143 bool operator<(const MutableTrackerPulse& other) const {
0144 return m_obj < other.m_obj;
0145 }
0146
0147 podio::ObjectID id() const {
0148 return getObjectID();
0149 }
0150
0151 const podio::ObjectID getObjectID() const;
0152
0153 friend void swap(MutableTrackerPulse& a, MutableTrackerPulse& b) {
0154 using std::swap;
0155 swap(a.m_obj, b.m_obj);
0156 }
0157
0158 private:
0159
0160 explicit MutableTrackerPulse(podio::utils::MaybeSharedPtr<TrackerPulseObj> obj);
0161
0162 podio::utils::MaybeSharedPtr<TrackerPulseObj> m_obj{nullptr};
0163 };
0164
0165 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0166 void to_json(nlohmann::json& j, const MutableTrackerPulse& value);
0167 #endif
0168
0169 }
0170
0171 #endif