File indexing completed on 2025-01-18 09:55:40
0001
0002
0003 #ifndef EDM4HEP_TrackerHit_H
0004 #define EDM4HEP_TrackerHit_H
0005
0006 #include "edm4hep/TrackerHitObj.h"
0007
0008 #include "edm4hep/ObjectID.h"
0009 #include "edm4hep/Vector3d.h"
0010 #include "podio/RelationRange.h"
0011 #include <array>
0012 #include <cstdint>
0013 #include <vector>
0014
0015 #include "podio/utilities/MaybeSharedPtr.h"
0016
0017 #include <cstdint>
0018 #include <ostream>
0019
0020 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0021 #include "nlohmann/json_fwd.hpp"
0022 #endif
0023
0024 namespace edm4hep {
0025
0026 class MutableTrackerHit;
0027 class TrackerHitCollection;
0028 class TrackerHitCollectionData;
0029
0030
0031
0032
0033
0034 class TrackerHit {
0035
0036 friend class MutableTrackerHit;
0037 friend class TrackerHitCollection;
0038 friend class edm4hep::TrackerHitCollectionData;
0039 friend class TrackerHitCollectionIterator;
0040
0041 public:
0042 using mutable_type = MutableTrackerHit;
0043 using collection_type = TrackerHitCollection;
0044
0045
0046 TrackerHit();
0047
0048
0049 TrackerHit(std::uint64_t cellID, std::int32_t type, std::int32_t quality, float time, float eDep, float eDepError,
0050 edm4hep::Vector3d position, std::array<float, 6> covMatrix);
0051
0052
0053 TrackerHit(const TrackerHit& other) = default;
0054
0055
0056 TrackerHit& operator=(TrackerHit other);
0057
0058
0059
0060 MutableTrackerHit clone(bool cloneRelations = true) const;
0061
0062
0063 ~TrackerHit() = default;
0064
0065
0066 TrackerHit(const MutableTrackerHit& other);
0067
0068 static TrackerHit makeEmpty();
0069
0070 public:
0071
0072 std::uint64_t getCellID() const;
0073
0074
0075
0076 std::int32_t getType() const;
0077
0078
0079 std::int32_t getQuality() const;
0080
0081
0082 float getTime() const;
0083
0084
0085 float getEDep() const;
0086
0087
0088 float getEDepError() const;
0089
0090
0091 const edm4hep::Vector3d& getPosition() const;
0092
0093
0094
0095 const std::array<float, 6>& getCovMatrix() const;
0096
0097
0098 float getCovMatrix(size_t i) const;
0099
0100 std::size_t rawHits_size() const;
0101 edm4hep::ObjectID getRawHits(std::size_t) const;
0102 std::vector<edm4hep::ObjectID>::const_iterator rawHits_begin() const;
0103 std::vector<edm4hep::ObjectID>::const_iterator rawHits_end() const;
0104 podio::RelationRange<edm4hep::ObjectID> getRawHits() const;
0105
0106
0107 bool isAvailable() const;
0108
0109 void unlink() {
0110 m_obj = podio::utils::MaybeSharedPtr<TrackerHitObj>{nullptr};
0111 }
0112
0113 bool operator==(const TrackerHit& other) const {
0114 return m_obj == other.m_obj;
0115 }
0116 bool operator==(const MutableTrackerHit& other) const;
0117
0118 bool operator!=(const TrackerHit& other) const {
0119 return !(*this == other);
0120 }
0121 bool operator!=(const MutableTrackerHit& other) const {
0122 return !(*this == other);
0123 }
0124
0125
0126 bool operator<(const TrackerHit& other) const {
0127 return m_obj < other.m_obj;
0128 }
0129
0130 podio::ObjectID id() const {
0131 return getObjectID();
0132 }
0133
0134 const podio::ObjectID getObjectID() const;
0135
0136 friend void swap(TrackerHit& a, TrackerHit& b) {
0137 using std::swap;
0138 swap(a.m_obj, b.m_obj);
0139 }
0140
0141 private:
0142
0143 explicit TrackerHit(podio::utils::MaybeSharedPtr<TrackerHitObj> obj);
0144 TrackerHit(TrackerHitObj* obj);
0145
0146 podio::utils::MaybeSharedPtr<TrackerHitObj> m_obj{nullptr};
0147 };
0148
0149 std::ostream& operator<<(std::ostream& o, const TrackerHit& value);
0150
0151 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0152 void to_json(nlohmann::json& j, const TrackerHit& value);
0153 #endif
0154
0155 }
0156
0157 #endif