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