File indexing completed on 2026-10-31 09:24:16
0001
0002
0003 #ifndef EDM4EIC_MutableTrackerHit_H
0004 #define EDM4EIC_MutableTrackerHit_H
0005
0006 #include "edm4eic/TrackerHitObj.h"
0007
0008 #include "edm4eic/TrackerHit.h"
0009
0010 #include "edm4eic/CovDiag3f.h"
0011 #include "edm4hep/Vector3f.h"
0012 #include <cstdint>
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 edm4eic {
0024 class TrackerHitCollection;
0025 class RawTrackerHit;
0026 class MutableRawTrackerHit;
0027 }
0028
0029
0030 namespace edm4eic {
0031
0032
0033
0034
0035
0036
0037 class MutableTrackerHit {
0038
0039 friend class TrackerHitCollection;
0040 friend class TrackerHitMutableCollectionIterator;
0041 friend class TrackerHit;
0042
0043 public:
0044 using object_type = TrackerHit;
0045 using collection_type = TrackerHitCollection;
0046
0047
0048 MutableTrackerHit() = default;
0049
0050
0051 MutableTrackerHit(const std::uint64_t cellID, const edm4hep::Vector3f& position, const edm4eic::CovDiag3f& positionError, const float time, const float timeError, const float edep, const float edepError);
0052
0053
0054 MutableTrackerHit(const MutableTrackerHit& other) = default;
0055
0056
0057 MutableTrackerHit& operator=(MutableTrackerHit other) &;
0058 MutableTrackerHit& operator=(MutableTrackerHit other) && = delete;
0059
0060
0061
0062 MutableTrackerHit clone(bool cloneRelations=true) const;
0063
0064
0065 ~MutableTrackerHit() = default;
0066
0067
0068 public:
0069
0070
0071 std::uint64_t getCellID() const;
0072
0073
0074 const edm4hep::Vector3f& getPosition() const;
0075
0076
0077 const edm4eic::CovDiag3f& getPositionError() const;
0078
0079
0080 float getTime() const;
0081
0082
0083 float getTimeError() const;
0084
0085
0086 float getEdep() const;
0087
0088
0089 float getEdepError() const;
0090
0091
0092
0093 const edm4eic::RawTrackerHit getRawHit() const;
0094
0095
0096 void setCellID(const std::uint64_t cellID);
0097
0098 std::uint64_t& getCellID();
0099
0100
0101 void setPosition(const edm4hep::Vector3f& position);
0102
0103 edm4hep::Vector3f& getPosition();
0104
0105
0106 void setPositionError(const edm4eic::CovDiag3f& positionError);
0107
0108 edm4eic::CovDiag3f& getPositionError();
0109
0110
0111 void setTime(const float time);
0112
0113 float& getTime();
0114
0115
0116 void setTimeError(const float timeError);
0117
0118 float& getTimeError();
0119
0120
0121 void setEdep(const float edep);
0122
0123 float& getEdep();
0124
0125
0126 void setEdepError(const float edepError);
0127
0128 float& getEdepError();
0129
0130
0131
0132 void setRawHit(const edm4eic::RawTrackerHit& value);
0133
0134
0135
0136
0137
0138 bool isAvailable() const;
0139
0140 void unlink() { m_obj = podio::utils::MaybeSharedPtr<TrackerHitObj>{nullptr}; }
0141
0142 constexpr bool operator==(const MutableTrackerHit& other) const { return m_obj == other.m_obj; }
0143 bool operator==(const TrackerHit& other) const;
0144
0145 constexpr bool operator!=(const MutableTrackerHit& other) const { return !(*this == other); }
0146 bool operator!=(const TrackerHit& other) const { return !(*this == other); }
0147
0148
0149 bool operator<(const MutableTrackerHit& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
0150
0151 podio::ObjectID id() const { return getObjectID(); }
0152
0153 const podio::ObjectID getObjectID() const;
0154
0155 friend std::hash<MutableTrackerHit>;
0156
0157 friend void swap(MutableTrackerHit& a, MutableTrackerHit& b) {
0158 using std::swap;
0159 swap(a.m_obj, b.m_obj);
0160 }
0161
0162 private:
0163
0164 explicit MutableTrackerHit(podio::utils::MaybeSharedPtr<TrackerHitObj> obj);
0165
0166 podio::utils::MaybeSharedPtr<TrackerHitObj> m_obj{new TrackerHitObj{}, podio::utils::MarkOwned};
0167 };
0168
0169 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0170 void to_json(nlohmann::json& j, const MutableTrackerHit& value);
0171 #endif
0172
0173
0174 }
0175
0176
0177
0178 template<>
0179 struct std::hash<edm4eic::MutableTrackerHit> {
0180 std::size_t operator()(const edm4eic::MutableTrackerHit& obj) const {
0181 return std::hash<edm4eic::TrackerHitObj*>{}(obj.m_obj.get());
0182 }
0183 };
0184
0185
0186 #endif