EDM4eic
EIC data model
Loading...
Searching...
No Matches
TrackerHit.h
Go to the documentation of this file.
1// AUTOMATICALLY GENERATED FILE - DO NOT EDIT
2
3#ifndef EDM4EIC_TrackerHit_H
4#define EDM4EIC_TrackerHit_H
5
7
8#include "edm4eic/CovDiag3f.h"
9#include "edm4hep/Vector3f.h"
10#include <cstdint>
11
12#include "podio/utilities/MaybeSharedPtr.h"
13#include "podio/detail/OrderKey.h"
14
15#include <ostream>
16#include <cstdint>
17
18#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
19#include "nlohmann/json_fwd.hpp"
20#endif
21
22// forward declarations
23namespace edm4eic {
25class RawTrackerHit;
27}
28
29
30namespace podio::detail {
31// Internal function used in less comparison operators of the datatypes and interface types
32OrderKey getOrderKey(const edm4eic::TrackerHit& obj);
33};
34
35namespace edm4eic {
36
40
41/** @class TrackerHit
42 * Tracker hit (reconstructed from Raw)
43 * @author: W. Armstrong, S. Joosten
44 */
46
47 friend class MutableTrackerHit;
51 friend podio::detail::OrderKey podio::detail::getOrderKey(const TrackerHit & obj);
52
53public:
56
57 /// default constructor
58 TrackerHit();
59
60 /// Constructor initializing all members
61 TrackerHit(const std::uint64_t cellID, const edm4hep::Vector3f& position, const edm4eic::CovDiag3f& positionError, const float time, const float timeError, const float edep, const float edepError);
62
63 /// copy constructor
64 TrackerHit(const TrackerHit& other) = default;
65
66 /// copy-assignment operator
67 TrackerHit& operator=(TrackerHit other) &; // Rebind this to other's internal object
68 TrackerHit& operator=(TrackerHit other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
69
70 /// create a mutable deep-copy of the object with identical relations
71 /// if cloneRelations=false, the relations are not cloned and will be empty
72 MutableTrackerHit clone(bool cloneRelations=true) const;
73
74 /// destructor
75 ~TrackerHit() = default;
76
77 /// converting constructor from mutable object
78 TrackerHit(const MutableTrackerHit& other);
79
80 static TrackerHit makeEmpty();
81
82public:
83
84 static constexpr std::string_view typeName = "edm4eic::TrackerHit";
85
86 /// Access the The detector specific (geometrical) cell id.
87 std::uint64_t getCellID() const;
88
89 /// Access the Hit (cell) position [mm]
90 const edm4hep::Vector3f& getPosition() const;
91
92 /// Access the Covariance Matrix
94
95 /// Access the Hit time [ns]
96 float getTime() const;
97
98 /// Access the Error on the time
99 float getTimeError() const;
100
101 /// Access the Energy deposit in this hit [GeV]
102 float getEdep() const;
103
104 /// Access the Error on the energy deposit [GeV]
105 float getEdepError() const;
106
107
108 /// Access the Related raw tracker hit
109 const edm4eic::RawTrackerHit getRawHit() const;
110
111
112
113 /// check whether the object is actually available
114 bool isAvailable() const;
115 /// disconnect from TrackerHitObj instance
116 void unlink() { m_obj = podio::utils::MaybeSharedPtr<TrackerHitObj>{nullptr}; }
117
118 bool operator==(const TrackerHit& other) const { return m_obj == other.m_obj; }
119 bool operator==(const MutableTrackerHit& other) const;
120
121 bool operator!=(const TrackerHit& other) const { return !(*this == other); }
122 bool operator!=(const MutableTrackerHit& other) const { return !(*this == other); }
123
124 // less comparison operator, so that objects can be e.g. stored in sets.
125 bool operator<(const TrackerHit& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
126
127 podio::ObjectID id() const { return getObjectID(); }
128
129 const podio::ObjectID getObjectID() const;
130
131 friend std::hash<TrackerHit>;
132
133 friend void swap(TrackerHit& a, TrackerHit& b) {
134 using std::swap;
135 swap(a.m_obj, b.m_obj); // swap out the internal pointers
136 }
137
138private:
139 /// constructor from existing TrackerHitObj
140 explicit TrackerHit(podio::utils::MaybeSharedPtr<TrackerHitObj> obj);
142
143 podio::utils::MaybeSharedPtr<TrackerHitObj> m_obj{nullptr};
144};
145
146std::ostream& operator<<(std::ostream& o, const TrackerHit& value);
147
148#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
149void to_json(nlohmann::json& j, const TrackerHit& value);
150#endif
151
152
153} // namespace edm4eic
154
155
156
157template<>
158struct std::hash<edm4eic::TrackerHit> {
159 std::size_t operator()(const edm4eic::TrackerHit& obj) const {
160 return std::hash<edm4eic::TrackerHitObj*>{}(obj.m_obj.get());
161 }
162};
163
164
165// This is needed to avoid triggering opening every library in LD_LIBRARY_PATH
166// until it's fixed in ROOT. See https://github.com/root-project/root/issues/18489
167// and https://github.com/AIDASoft/podio/issues/770
168#if defined(__clang__)
169#pragma clang diagnostic push
170#pragma clang diagnostic ignored "-Wunknown-warning-option"
171#pragma clang diagnostic ignored "-Wdeprecated-redundant-constexpr-static-def"
172#pragma clang diagnostic ignored "-Wdeprecated"
173constexpr std::string_view edm4eic::TrackerHit::typeName;
174#pragma clang diagnostic pop
175#elif defined(__GNUC__)
176#pragma GCC diagnostic push
177#pragma GCC diagnostic ignored "-Wdeprecated"
178constexpr std::string_view edm4eic::TrackerHit::typeName;
179#pragma GCC diagnostic pop
180#endif
181
182#endif
Definition CovDiag3f.h:18
Definition MutableRawTrackerHit.h:33
Definition MutableTrackerHit.h:37
Definition RawTrackerHit.h:41
Definition TrackerHitCollectionData.h:31
Definition TrackerHitCollection.h:137
Definition TrackerHit.h:45
friend class TrackerHitCollection
Definition TrackerHit.h:48
bool operator!=(const TrackerHit &other) const
Definition TrackerHit.h:121
float getEdep() const
Access the Energy deposit in this hit [GeV].
Definition TrackerHit.cc:67
const edm4eic::CovDiag3f & getPositionError() const
Access the Covariance Matrix.
Definition TrackerHit.cc:64
~TrackerHit()=default
destructor
bool isAvailable() const
check whether the object is actually available
Definition TrackerHit.cc:82
const edm4eic::RawTrackerHit getRawHit() const
Access the Related raw tracker hit.
Definition TrackerHit.cc:70
friend void swap(TrackerHit &a, TrackerHit &b)
Definition TrackerHit.h:133
MutableTrackerHit mutable_type
Definition TrackerHit.h:54
bool operator!=(const MutableTrackerHit &other) const
Definition TrackerHit.h:122
MutableTrackerHit clone(bool cloneRelations=true) const
Definition TrackerHit.cc:40
float getTimeError() const
Access the Error on the time.
Definition TrackerHit.cc:66
static TrackerHit makeEmpty()
Definition TrackerHit.cc:58
float getEdepError() const
Access the Error on the energy deposit [GeV].
Definition TrackerHit.cc:68
TrackerHit & operator=(TrackerHit other) &
copy-assignment operator
Definition TrackerHit.cc:35
const podio::ObjectID getObjectID() const
Definition TrackerHit.cc:86
bool operator==(const TrackerHit &other) const
Definition TrackerHit.h:118
friend class TrackerHitCollectionIterator
Definition TrackerHit.h:50
float getTime() const
Access the Hit time [ns].
Definition TrackerHit.cc:65
TrackerHitCollection collection_type
Definition TrackerHit.h:55
std::uint64_t getCellID() const
Access the The detector specific (geometrical) cell id.
Definition TrackerHit.cc:62
TrackerHit()
default constructor
Definition TrackerHit.cc:21
void unlink()
disconnect from TrackerHitObj instance
Definition TrackerHit.h:116
TrackerHit(const TrackerHit &other)=default
copy constructor
friend class MutableTrackerHit
Definition TrackerHit.h:47
bool operator<(const TrackerHit &other) const
Definition TrackerHit.h:125
podio::ObjectID id() const
Definition TrackerHit.h:127
const edm4hep::Vector3f & getPosition() const
Access the Hit (cell) position [mm].
Definition TrackerHit.cc:63
TrackerHit & operator=(TrackerHit other) &&=delete
static constexpr std::string_view typeName
Definition TrackerHit.h:84
Definition TrackerHitObj.h:21
Definition CalorimeterHit.cc:17
std::ostream & operator<<(std::ostream &o, const CalorimeterHit &value)
Definition CalorimeterHit.cc:103
Definition CalorimeterHit.h:31
OrderKey getOrderKey(const edm4eic::CalorimeterHit &obj)
Definition CalorimeterHit.cc:150
std::size_t operator()(const edm4eic::TrackerHit &obj) const
Definition TrackerHit.h:159