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