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