File indexing completed on 2025-12-16 10:13:01
0001
0002
0003 #ifndef EDM4HEP_SenseWireHit_H
0004 #define EDM4HEP_SenseWireHit_H
0005
0006 #include "edm4hep/SenseWireHitObj.h"
0007
0008 #include "edm4hep/Vector3d.h"
0009 #include "podio/RelationRange.h"
0010 #include <cstdint>
0011 #include <vector>
0012
0013 #include "podio/detail/OrderKey.h"
0014 #include "podio/utilities/MaybeSharedPtr.h"
0015
0016 #include <cstdint>
0017 #include <ostream>
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 podio::detail {
0030
0031 OrderKey getOrderKey(const edm4hep::SenseWireHit& obj);
0032 };
0033
0034 namespace edm4hep {
0035
0036 class MutableSenseWireHit;
0037 class SenseWireHitCollection;
0038 class SenseWireHitCollectionData;
0039
0040
0041
0042
0043
0044
0045 class SenseWireHit {
0046
0047 friend class MutableSenseWireHit;
0048 friend class SenseWireHitCollection;
0049 friend class edm4hep::SenseWireHitCollectionData;
0050 friend class SenseWireHitCollectionIterator;
0051 friend podio::detail::OrderKey podio::detail::getOrderKey(const SenseWireHit& obj);
0052
0053 public:
0054 using mutable_type = MutableSenseWireHit;
0055 using collection_type = SenseWireHitCollection;
0056
0057
0058 SenseWireHit() = default;
0059
0060
0061 SenseWireHit(const std::uint64_t cellID, const std::int32_t type, const std::int32_t quality, const float time,
0062 const float eDep, const float eDepError, const float wireStereoAngle, const float wireAzimuthalAngle,
0063 const edm4hep::Vector3d& position, const double positionAlongWireError, const float distanceToWire,
0064 const float distanceToWireError);
0065
0066
0067 SenseWireHit(const SenseWireHit& other) = default;
0068
0069
0070 SenseWireHit& operator=(SenseWireHit other) &;
0071 SenseWireHit&
0072 operator=(SenseWireHit other) && = delete;
0073
0074
0075
0076 MutableSenseWireHit clone(bool cloneRelations = true) const;
0077
0078
0079 ~SenseWireHit() = default;
0080
0081
0082 SenseWireHit(const MutableSenseWireHit& other);
0083
0084 static SenseWireHit makeEmpty();
0085
0086 public:
0087 static constexpr std::string_view typeName = "edm4hep::SenseWireHit";
0088
0089
0090 std::uint64_t getCellID() const;
0091
0092
0093 std::int32_t getType() const;
0094
0095
0096 std::int32_t getQuality() const;
0097
0098
0099 float getTime() const;
0100
0101
0102 float getEDep() const;
0103
0104
0105 float getEDepError() const;
0106
0107
0108
0109 float getWireStereoAngle() const;
0110
0111
0112
0113 float getWireAzimuthalAngle() const;
0114
0115
0116 const edm4hep::Vector3d& getPosition() const;
0117
0118
0119 double getPositionAlongWireError() const;
0120
0121
0122 float getDistanceToWire() const;
0123
0124
0125 float getDistanceToWireError() const;
0126
0127 std::size_t nElectrons_size() const;
0128 std::uint16_t getNElectrons(std::size_t) const;
0129 std::vector<std::uint16_t>::const_iterator nElectrons_begin() const;
0130 std::vector<std::uint16_t>::const_iterator nElectrons_end() const;
0131 podio::RelationRange<std::uint16_t> getNElectrons() const;
0132
0133
0134 auto getNClusters() const { return getNElectrons().size(); }
0135
0136
0137 bool isAvailable() const;
0138
0139 void unlink() { m_obj = podio::utils::MaybeSharedPtr<SenseWireHitObj>{nullptr}; }
0140
0141 bool operator==(const SenseWireHit& other) const { return m_obj == other.m_obj; }
0142 bool operator==(const MutableSenseWireHit& other) const;
0143
0144 bool operator!=(const SenseWireHit& other) const { return !(*this == other); }
0145 bool operator!=(const MutableSenseWireHit& other) const { return !(*this == other); }
0146
0147
0148 bool operator<(const SenseWireHit& other) const {
0149 return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other);
0150 }
0151
0152 podio::ObjectID id() const { return getObjectID(); }
0153
0154 const podio::ObjectID getObjectID() const;
0155
0156 friend std::hash<SenseWireHit>;
0157
0158 friend void swap(SenseWireHit& a, SenseWireHit& b) {
0159 using std::swap;
0160 swap(a.m_obj, b.m_obj);
0161 }
0162
0163 private:
0164
0165 explicit SenseWireHit(podio::utils::MaybeSharedPtr<SenseWireHitObj> obj);
0166 SenseWireHit(SenseWireHitObj* obj);
0167
0168 podio::utils::MaybeSharedPtr<SenseWireHitObj> m_obj{new SenseWireHitObj{}, podio::utils::MarkOwned};
0169 };
0170
0171 std::ostream& operator<<(std::ostream& o, const SenseWireHit& value);
0172
0173 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0174 void to_json(nlohmann::json& j, const SenseWireHit& value);
0175 #endif
0176
0177 }
0178
0179 template <>
0180 struct std::hash<edm4hep::SenseWireHit> {
0181 std::size_t operator()(const edm4hep::SenseWireHit& obj) const {
0182 return std::hash<edm4hep::SenseWireHitObj*>{}(obj.m_obj.get());
0183 }
0184 };
0185
0186
0187
0188
0189 #if defined(__clang__)
0190 #pragma clang diagnostic push
0191 #pragma clang diagnostic ignored "-Wunknown-warning-option"
0192 #pragma clang diagnostic ignored "-Wdeprecated-redundant-constexpr-static-def"
0193 #pragma clang diagnostic ignored "-Wdeprecated"
0194 constexpr std::string_view edm4hep::SenseWireHit::typeName;
0195 #pragma clang diagnostic pop
0196 #elif defined(__GNUC__)
0197 #pragma GCC diagnostic push
0198 #pragma GCC diagnostic ignored "-Wdeprecated"
0199 constexpr std::string_view edm4hep::SenseWireHit::typeName;
0200 #pragma GCC diagnostic pop
0201 #endif
0202
0203 #endif