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