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