Warning, file /include/edm4hep/MutableRawTimeSeries.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
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() = default;
0045
0046
0047 MutableRawTimeSeries(const std::uint64_t cellID, const std::int32_t quality, const float time, const float charge,
0048 const float interval);
0049
0050
0051 MutableRawTimeSeries(const MutableRawTimeSeries& other) = default;
0052
0053
0054 MutableRawTimeSeries& operator=(MutableRawTimeSeries other) &;
0055 MutableRawTimeSeries&
0056 operator=(MutableRawTimeSeries other) && = delete;
0057
0058
0059
0060 MutableRawTimeSeries clone(bool cloneRelations = true) const;
0061
0062
0063 ~MutableRawTimeSeries() = default;
0064
0065 public:
0066
0067 std::uint64_t getCellID() const;
0068
0069
0070 std::int32_t getQuality() const;
0071
0072
0073 float getTime() const;
0074
0075
0076 float getCharge() const;
0077
0078
0079 float getInterval() const;
0080
0081
0082 void setCellID(const std::uint64_t cellID);
0083
0084 std::uint64_t& getCellID();
0085
0086 [[deprecated("use getCellID instead")]] std::uint64_t& cellID();
0087
0088
0089 void setQuality(const std::int32_t quality);
0090
0091 std::int32_t& getQuality();
0092
0093 [[deprecated("use getQuality instead")]] std::int32_t& quality();
0094
0095
0096 void setTime(const float time);
0097
0098 float& getTime();
0099
0100 [[deprecated("use getTime instead")]] float& time();
0101
0102
0103 void setCharge(const float charge);
0104
0105 float& getCharge();
0106
0107 [[deprecated("use getCharge instead")]] float& charge();
0108
0109
0110 void setInterval(const float interval);
0111
0112 float& getInterval();
0113
0114 [[deprecated("use getInterval instead")]] float& interval();
0115
0116 void addToAdcCounts(const std::int32_t&);
0117 std::size_t adcCounts_size() const;
0118 std::int32_t getAdcCounts(std::size_t) const;
0119 std::vector<std::int32_t>::const_iterator adcCounts_begin() const;
0120 std::vector<std::int32_t>::const_iterator adcCounts_end() const;
0121 podio::RelationRange<std::int32_t> getAdcCounts() const;
0122
0123
0124 bool isAvailable() const;
0125
0126 void unlink() { m_obj = podio::utils::MaybeSharedPtr<RawTimeSeriesObj>{nullptr}; }
0127
0128 bool operator==(const MutableRawTimeSeries& other) const { return m_obj == other.m_obj; }
0129 bool operator==(const RawTimeSeries& other) const;
0130
0131 bool operator!=(const MutableRawTimeSeries& other) const { return !(*this == other); }
0132 bool operator!=(const RawTimeSeries& other) const { return !(*this == other); }
0133
0134
0135 bool operator<(const MutableRawTimeSeries& other) const {
0136 return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other);
0137 }
0138
0139 podio::ObjectID id() const { return getObjectID(); }
0140
0141 const podio::ObjectID getObjectID() const;
0142
0143 friend std::hash<MutableRawTimeSeries>;
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{new RawTimeSeriesObj{}, podio::utils::MarkOwned};
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 template <>
0164 struct std::hash<edm4hep::MutableRawTimeSeries> {
0165 std::size_t operator()(const edm4hep::MutableRawTimeSeries& obj) const {
0166 return std::hash<edm4hep::RawTimeSeriesObj*>{}(obj.m_obj.get());
0167 }
0168 };
0169
0170 #endif