File indexing completed on 2025-12-15 10:12:15
0001
0002
0003 #ifndef EDM4HEP_MutableSenseWireHit_H
0004 #define EDM4HEP_MutableSenseWireHit_H
0005
0006 #include "edm4hep/SenseWireHitObj.h"
0007
0008 #include "edm4hep/SenseWireHit.h"
0009
0010 #include "edm4hep/Vector3d.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 edm4hep {
0025 class SenseWireHitCollection;
0026 class TrackerHit;
0027 }
0028
0029 namespace edm4hep {
0030
0031
0032
0033
0034
0035
0036 class MutableSenseWireHit {
0037
0038 friend class SenseWireHitCollection;
0039 friend class SenseWireHitMutableCollectionIterator;
0040 friend class SenseWireHit;
0041
0042 public:
0043 using object_type = SenseWireHit;
0044 using collection_type = SenseWireHitCollection;
0045
0046
0047 MutableSenseWireHit() = default;
0048
0049
0050 MutableSenseWireHit(const std::uint64_t cellID, const std::int32_t type, const std::int32_t quality, const float time,
0051 const float eDep, const float eDepError, const float wireStereoAngle,
0052 const float wireAzimuthalAngle, const edm4hep::Vector3d& position,
0053 const double positionAlongWireError, const float distanceToWire, const float distanceToWireError);
0054
0055
0056 MutableSenseWireHit(const MutableSenseWireHit& other) = default;
0057
0058
0059 MutableSenseWireHit& operator=(MutableSenseWireHit other) &;
0060 MutableSenseWireHit&
0061 operator=(MutableSenseWireHit other) && = delete;
0062
0063
0064
0065 MutableSenseWireHit clone(bool cloneRelations = true) const;
0066
0067
0068 ~MutableSenseWireHit() = default;
0069
0070 public:
0071
0072 std::uint64_t getCellID() const;
0073
0074
0075 std::int32_t getType() const;
0076
0077
0078 std::int32_t getQuality() const;
0079
0080
0081 float getTime() const;
0082
0083
0084 float getEDep() const;
0085
0086
0087 float getEDepError() const;
0088
0089
0090
0091 float getWireStereoAngle() const;
0092
0093
0094
0095 float getWireAzimuthalAngle() const;
0096
0097
0098 const edm4hep::Vector3d& getPosition() const;
0099
0100
0101 double getPositionAlongWireError() const;
0102
0103
0104 float getDistanceToWire() const;
0105
0106
0107 float getDistanceToWireError() const;
0108
0109
0110 void setCellID(const std::uint64_t cellID);
0111
0112 std::uint64_t& getCellID();
0113
0114 [[deprecated("use getCellID instead")]] std::uint64_t& cellID();
0115
0116
0117 void setType(const std::int32_t type);
0118
0119 std::int32_t& getType();
0120
0121 [[deprecated("use getType instead")]] std::int32_t& type();
0122
0123
0124 void setQuality(const std::int32_t quality);
0125
0126 std::int32_t& getQuality();
0127
0128 [[deprecated("use getQuality instead")]] std::int32_t& quality();
0129
0130
0131 void setTime(const float time);
0132
0133 float& getTime();
0134
0135 [[deprecated("use getTime instead")]] float& time();
0136
0137
0138 void setEDep(const float eDep);
0139
0140 float& getEDep();
0141
0142 [[deprecated("use getEDep instead")]] float& eDep();
0143
0144
0145 void setEDepError(const float eDepError);
0146
0147 float& getEDepError();
0148
0149 [[deprecated("use getEDepError instead")]] float& eDepError();
0150
0151
0152
0153 void setWireStereoAngle(const float wireStereoAngle);
0154
0155
0156 float& getWireStereoAngle();
0157
0158
0159 [[deprecated("use getWireStereoAngle instead")]] float& wireStereoAngle();
0160
0161
0162
0163 void setWireAzimuthalAngle(const float wireAzimuthalAngle);
0164
0165
0166 float& getWireAzimuthalAngle();
0167
0168
0169 [[deprecated("use getWireAzimuthalAngle instead")]] float& wireAzimuthalAngle();
0170
0171
0172 void setPosition(const edm4hep::Vector3d& position);
0173
0174 edm4hep::Vector3d& getPosition();
0175
0176 [[deprecated("use getPosition instead")]] edm4hep::Vector3d& position();
0177
0178
0179 void setPositionAlongWireError(const double positionAlongWireError);
0180
0181 double& getPositionAlongWireError();
0182
0183 [[deprecated("use getPositionAlongWireError instead")]] double& positionAlongWireError();
0184
0185
0186 void setDistanceToWire(const float distanceToWire);
0187
0188 float& getDistanceToWire();
0189
0190 [[deprecated("use getDistanceToWire instead")]] float& distanceToWire();
0191
0192
0193 void setDistanceToWireError(const float distanceToWireError);
0194
0195 float& getDistanceToWireError();
0196
0197 [[deprecated("use getDistanceToWireError instead")]] float& distanceToWireError();
0198
0199 void addToNElectrons(const std::uint16_t&);
0200 std::size_t nElectrons_size() const;
0201 std::uint16_t getNElectrons(std::size_t) const;
0202 std::vector<std::uint16_t>::const_iterator nElectrons_begin() const;
0203 std::vector<std::uint16_t>::const_iterator nElectrons_end() const;
0204 podio::RelationRange<std::uint16_t> getNElectrons() const;
0205
0206
0207 auto getNClusters() const { return getNElectrons().size(); }
0208
0209
0210 bool isAvailable() const;
0211
0212 void unlink() { m_obj = podio::utils::MaybeSharedPtr<SenseWireHitObj>{nullptr}; }
0213
0214 bool operator==(const MutableSenseWireHit& other) const { return m_obj == other.m_obj; }
0215 bool operator==(const SenseWireHit& other) const;
0216
0217 bool operator!=(const MutableSenseWireHit& other) const { return !(*this == other); }
0218 bool operator!=(const SenseWireHit& other) const { return !(*this == other); }
0219
0220
0221 bool operator<(const MutableSenseWireHit& other) const {
0222 return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other);
0223 }
0224
0225 podio::ObjectID id() const { return getObjectID(); }
0226
0227 const podio::ObjectID getObjectID() const;
0228
0229 friend std::hash<MutableSenseWireHit>;
0230
0231 friend void swap(MutableSenseWireHit& a, MutableSenseWireHit& b) {
0232 using std::swap;
0233 swap(a.m_obj, b.m_obj);
0234 }
0235
0236 private:
0237
0238 explicit MutableSenseWireHit(podio::utils::MaybeSharedPtr<SenseWireHitObj> obj);
0239
0240 podio::utils::MaybeSharedPtr<SenseWireHitObj> m_obj{new SenseWireHitObj{}, podio::utils::MarkOwned};
0241 };
0242
0243 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0244 void to_json(nlohmann::json& j, const MutableSenseWireHit& value);
0245 #endif
0246
0247 }
0248
0249 template <>
0250 struct std::hash<edm4hep::MutableSenseWireHit> {
0251 std::size_t operator()(const edm4hep::MutableSenseWireHit& obj) const {
0252 return std::hash<edm4hep::SenseWireHitObj*>{}(obj.m_obj.get());
0253 }
0254 };
0255
0256 #endif