File indexing completed on 2025-01-18 09:55:33
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
0014 #include <ostream>
0015 #include <cstdint>
0016
0017 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0018 #include "nlohmann/json_fwd.hpp"
0019 #endif
0020
0021
0022 namespace edm4eic {
0023 class RawTrackerHit;
0024 class MutableRawTrackerHit;
0025 }
0026
0027
0028 namespace edm4eic {
0029
0030 class MutableTrackerHit;
0031 class TrackerHitCollection;
0032 class TrackerHitCollectionData;
0033
0034
0035
0036
0037
0038 class TrackerHit {
0039
0040 friend class MutableTrackerHit;
0041 friend class TrackerHitCollection;
0042 friend class edm4eic::TrackerHitCollectionData;
0043 friend class TrackerHitCollectionIterator;
0044
0045 public:
0046 using mutable_type = MutableTrackerHit;
0047 using collection_type = TrackerHitCollection;
0048
0049
0050 TrackerHit();
0051
0052
0053 TrackerHit(std::uint64_t cellID, edm4hep::Vector3f position, edm4eic::CovDiag3f positionError, float time, float timeError, float edep, float edepError);
0054
0055
0056 TrackerHit(const TrackerHit& other) = default;
0057
0058
0059 TrackerHit& operator=(TrackerHit other);
0060
0061
0062
0063 MutableTrackerHit clone(bool cloneRelations=true) const;
0064
0065
0066 ~TrackerHit() = default;
0067
0068
0069 TrackerHit(const MutableTrackerHit& other);
0070
0071 static TrackerHit makeEmpty();
0072
0073 public:
0074
0075
0076 std::uint64_t getCellID() const;
0077
0078
0079 const edm4hep::Vector3f& getPosition() const;
0080
0081
0082 const edm4eic::CovDiag3f& getPositionError() const;
0083
0084
0085 float getTime() const;
0086
0087
0088 float getTimeError() const;
0089
0090
0091 float getEdep() const;
0092
0093
0094 float getEdepError() const;
0095
0096
0097
0098 const edm4eic::RawTrackerHit getRawHit() const;
0099
0100
0101
0102
0103 bool isAvailable() const;
0104
0105 void unlink() { m_obj = podio::utils::MaybeSharedPtr<TrackerHitObj>{nullptr}; }
0106
0107 bool operator==(const TrackerHit& other) const { return m_obj == other.m_obj; }
0108 bool operator==(const MutableTrackerHit& other) const;
0109
0110 bool operator!=(const TrackerHit& other) const { return !(*this == other); }
0111 bool operator!=(const MutableTrackerHit& other) const { return !(*this == other); }
0112
0113
0114 bool operator<(const TrackerHit& other) const { return m_obj < other.m_obj; }
0115
0116 podio::ObjectID id() const { return getObjectID(); }
0117
0118 const podio::ObjectID getObjectID() const;
0119
0120 friend void swap(TrackerHit& a, TrackerHit& b) {
0121 using std::swap;
0122 swap(a.m_obj, b.m_obj);
0123 }
0124
0125 private:
0126
0127 explicit TrackerHit(podio::utils::MaybeSharedPtr<TrackerHitObj> obj);
0128 TrackerHit(TrackerHitObj* obj);
0129
0130 podio::utils::MaybeSharedPtr<TrackerHitObj> m_obj{nullptr};
0131 };
0132
0133 std::ostream& operator<<(std::ostream& o, const TrackerHit& value);
0134
0135 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0136 void to_json(nlohmann::json& j, const TrackerHit& value);
0137 #endif
0138
0139
0140 }
0141
0142
0143 #endif