File indexing completed on 2025-07-01 08:35:18
0001
0002
0003 #ifndef EDM4EIC_RawTrackerHit_H
0004 #define EDM4EIC_RawTrackerHit_H
0005
0006 #include "edm4eic/RawTrackerHitObj.h"
0007
0008 #include <cstdint>
0009
0010 #include "podio/utilities/MaybeSharedPtr.h"
0011 #include "podio/detail/OrderKey.h"
0012
0013 #include <ostream>
0014 #include <cstdint>
0015
0016 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0017 #include "nlohmann/json_fwd.hpp"
0018 #endif
0019
0020
0021 namespace edm4eic {
0022 class RawTrackerHitCollection;
0023 }
0024
0025
0026 namespace podio::detail {
0027
0028 OrderKey getOrderKey(const edm4eic::RawTrackerHit& obj);
0029 };
0030
0031 namespace edm4eic {
0032
0033 class MutableRawTrackerHit;
0034 class RawTrackerHitCollection;
0035 class RawTrackerHitCollectionData;
0036
0037
0038
0039
0040
0041 class RawTrackerHit {
0042
0043 friend class MutableRawTrackerHit;
0044 friend class RawTrackerHitCollection;
0045 friend class edm4eic::RawTrackerHitCollectionData;
0046 friend class RawTrackerHitCollectionIterator;
0047 friend podio::detail::OrderKey podio::detail::getOrderKey(const RawTrackerHit & obj);
0048
0049 public:
0050 using mutable_type = MutableRawTrackerHit;
0051 using collection_type = RawTrackerHitCollection;
0052
0053
0054 RawTrackerHit();
0055
0056
0057 RawTrackerHit(std::uint64_t cellID, std::int32_t charge, std::int32_t timeStamp);
0058
0059
0060 RawTrackerHit(const RawTrackerHit& other) = default;
0061
0062
0063 RawTrackerHit& operator=(RawTrackerHit other);
0064
0065
0066
0067 MutableRawTrackerHit clone(bool cloneRelations=true) const;
0068
0069
0070 ~RawTrackerHit() = default;
0071
0072
0073 RawTrackerHit(const MutableRawTrackerHit& other);
0074
0075 static RawTrackerHit makeEmpty();
0076
0077 public:
0078
0079 static constexpr auto typeName = "edm4eic::RawTrackerHit";
0080
0081
0082 std::uint64_t getCellID() const;
0083
0084
0085 std::int32_t getCharge() const;
0086
0087
0088 std::int32_t getTimeStamp() const;
0089
0090
0091
0092
0093
0094
0095 bool isAvailable() const;
0096
0097 void unlink() { m_obj = podio::utils::MaybeSharedPtr<RawTrackerHitObj>{nullptr}; }
0098
0099 bool operator==(const RawTrackerHit& other) const { return m_obj == other.m_obj; }
0100 bool operator==(const MutableRawTrackerHit& other) const;
0101
0102 bool operator!=(const RawTrackerHit& other) const { return !(*this == other); }
0103 bool operator!=(const MutableRawTrackerHit& other) const { return !(*this == other); }
0104
0105
0106 bool operator<(const RawTrackerHit& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
0107
0108 podio::ObjectID id() const { return getObjectID(); }
0109
0110 const podio::ObjectID getObjectID() const;
0111
0112 friend void swap(RawTrackerHit& a, RawTrackerHit& b) {
0113 using std::swap;
0114 swap(a.m_obj, b.m_obj);
0115 }
0116
0117 private:
0118
0119 explicit RawTrackerHit(podio::utils::MaybeSharedPtr<RawTrackerHitObj> obj);
0120 RawTrackerHit(RawTrackerHitObj* obj);
0121
0122 podio::utils::MaybeSharedPtr<RawTrackerHitObj> m_obj{nullptr};
0123 };
0124
0125 std::ostream& operator<<(std::ostream& o, const RawTrackerHit& value);
0126
0127 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0128 void to_json(nlohmann::json& j, const RawTrackerHit& value);
0129 #endif
0130
0131
0132 }
0133
0134
0135 #endif