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