File indexing completed on 2025-07-05 08:52:30
0001
0002
0003 #ifndef EDM4EIC_TrackerHit_H
0004 #define EDM4EIC_TrackerHit_H
0005
0006 #include "edm4eic/TrackerHitObj.h"
0007
0008 #include "edm4eic/CovDiag3f.h"
0009 #include "edm4hep/Vector3f.h"
0010 #include <cstdint>
0011
0012 #include "podio/utilities/MaybeSharedPtr.h"
0013 #include "podio/detail/OrderKey.h"
0014
0015 #include <ostream>
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 podio::detail {
0031
0032 OrderKey getOrderKey(const edm4eic::TrackerHit& obj);
0033 };
0034
0035 namespace edm4eic {
0036
0037 class MutableTrackerHit;
0038 class TrackerHitCollection;
0039 class TrackerHitCollectionData;
0040
0041
0042
0043
0044
0045 class TrackerHit {
0046
0047 friend class MutableTrackerHit;
0048 friend class TrackerHitCollection;
0049 friend class edm4eic::TrackerHitCollectionData;
0050 friend class TrackerHitCollectionIterator;
0051 friend podio::detail::OrderKey podio::detail::getOrderKey(const TrackerHit & obj);
0052
0053 public:
0054 using mutable_type = MutableTrackerHit;
0055 using collection_type = TrackerHitCollection;
0056
0057
0058 TrackerHit();
0059
0060
0061 TrackerHit(std::uint64_t cellID, edm4hep::Vector3f position, edm4eic::CovDiag3f positionError, float time, float timeError, float edep, float edepError);
0062
0063
0064 TrackerHit(const TrackerHit& other) = default;
0065
0066
0067 TrackerHit& operator=(TrackerHit other);
0068
0069
0070
0071 MutableTrackerHit clone(bool cloneRelations=true) const;
0072
0073
0074 ~TrackerHit() = default;
0075
0076
0077 TrackerHit(const MutableTrackerHit& other);
0078
0079 static TrackerHit makeEmpty();
0080
0081 public:
0082
0083 static constexpr auto typeName = "edm4eic::TrackerHit";
0084
0085
0086 std::uint64_t getCellID() const;
0087
0088
0089 const edm4hep::Vector3f& getPosition() const;
0090
0091
0092 const edm4eic::CovDiag3f& getPositionError() const;
0093
0094
0095 float getTime() const;
0096
0097
0098 float getTimeError() const;
0099
0100
0101 float getEdep() const;
0102
0103
0104 float getEdepError() const;
0105
0106
0107
0108 const edm4eic::RawTrackerHit getRawHit() const;
0109
0110
0111
0112
0113 bool isAvailable() const;
0114
0115 void unlink() { m_obj = podio::utils::MaybeSharedPtr<TrackerHitObj>{nullptr}; }
0116
0117 bool operator==(const TrackerHit& other) const { return m_obj == other.m_obj; }
0118 bool operator==(const MutableTrackerHit& other) const;
0119
0120 bool operator!=(const TrackerHit& other) const { return !(*this == other); }
0121 bool operator!=(const MutableTrackerHit& other) const { return !(*this == other); }
0122
0123
0124 bool operator<(const TrackerHit& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
0125
0126 podio::ObjectID id() const { return getObjectID(); }
0127
0128 const podio::ObjectID getObjectID() const;
0129
0130 friend void swap(TrackerHit& a, TrackerHit& b) {
0131 using std::swap;
0132 swap(a.m_obj, b.m_obj);
0133 }
0134
0135 private:
0136
0137 explicit TrackerHit(podio::utils::MaybeSharedPtr<TrackerHitObj> obj);
0138 TrackerHit(TrackerHitObj* obj);
0139
0140 podio::utils::MaybeSharedPtr<TrackerHitObj> m_obj{nullptr};
0141 };
0142
0143 std::ostream& operator<<(std::ostream& o, const TrackerHit& value);
0144
0145 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0146 void to_json(nlohmann::json& j, const TrackerHit& value);
0147 #endif
0148
0149
0150 }
0151
0152
0153 #endif