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