EDM4eic
EIC data model
Loading...
Searching...
No Matches
MutableTrackerHit.h
Go to the documentation of this file.
1// AUTOMATICALLY GENERATED FILE - DO NOT EDIT
2
3#ifndef EDM4EIC_MutableTrackerHit_H
4#define EDM4EIC_MutableTrackerHit_H
5
7// Make the immutable class available from its mutable version but not vice versa
9
10#include "edm4eic/CovDiag3f.h"
11#include "edm4hep/Vector3f.h"
12#include <cstdint>
13
14#include "podio/utilities/MaybeSharedPtr.h"
15
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 edm4eic {
31
32
33/** @class MutableTrackerHit
34 * Tracker hit (reconstructed from Raw)
35 * @author: W. Armstrong, S. Joosten
36 */
38
41 friend class TrackerHit;
42
43public:
46
47 /// default constructor
49
50 /// Constructor initializing all members
51 MutableTrackerHit(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);
52
53 /// copy constructor
54 MutableTrackerHit(const MutableTrackerHit& other) = default;
55
56 /// copy-assignment operator
57 MutableTrackerHit& operator=(MutableTrackerHit other) &; // Rebind this to other's internal object
58 MutableTrackerHit& operator=(MutableTrackerHit other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
59
60 /// create a mutable deep-copy of the object with identical relations
61 /// if cloneRelations=false, the relations are not cloned and will be empty
62 MutableTrackerHit clone(bool cloneRelations=true) const;
63
64 /// destructor
65 ~MutableTrackerHit() = default;
66
67
68public:
69
70 /// Access the The detector specific (geometrical) cell id.
71 std::uint64_t getCellID() const;
72
73 /// Access the Hit (cell) position [mm]
74 const edm4hep::Vector3f& getPosition() const;
75
76 /// Access the Covariance Matrix
78
79 /// Access the Hit time [ns]
80 float getTime() const;
81
82 /// Access the Error on the time
83 float getTimeError() const;
84
85 /// Access the Energy deposit in this hit [GeV]
86 float getEdep() const;
87
88 /// Access the Error on the energy deposit [GeV]
89 float getEdepError() const;
90
91
92 /// Access the Related raw tracker hit
94
95 /// Set the The detector specific (geometrical) cell id.
96 void setCellID(const std::uint64_t cellID);
97 /// Get mutable reference to The detector specific (geometrical) cell id.
98 std::uint64_t& getCellID();
99 /// Get reference to The detector specific (geometrical) cell id.
100 [[deprecated("use getCellID instead")]]
101 std::uint64_t& cellID();
102
103 /// Set the Hit (cell) position [mm]
104 void setPosition(const edm4hep::Vector3f& position);
105 /// Get mutable reference to Hit (cell) position [mm]
106 edm4hep::Vector3f& getPosition();
107 /// Get reference to Hit (cell) position [mm]
108 [[deprecated("use getPosition instead")]]
109 edm4hep::Vector3f& position();
110
111 /// Set the Covariance Matrix
113 /// Get mutable reference to Covariance Matrix
115 /// Get reference to Covariance Matrix
116 [[deprecated("use getPositionError instead")]]
118
119 /// Set the Hit time [ns]
120 void setTime(const float time);
121 /// Get mutable reference to Hit time [ns]
122 float& getTime();
123 /// Get reference to Hit time [ns]
124 [[deprecated("use getTime instead")]]
125 float& time();
126
127 /// Set the Error on the time
128 void setTimeError(const float timeError);
129 /// Get mutable reference to Error on the time
130 float& getTimeError();
131 /// Get reference to Error on the time
132 [[deprecated("use getTimeError instead")]]
133 float& timeError();
134
135 /// Set the Energy deposit in this hit [GeV]
136 void setEdep(const float edep);
137 /// Get mutable reference to Energy deposit in this hit [GeV]
138 float& getEdep();
139 /// Get reference to Energy deposit in this hit [GeV]
140 [[deprecated("use getEdep instead")]]
141 float& edep();
142
143 /// Set the Error on the energy deposit [GeV]
144 void setEdepError(const float edepError);
145 /// Get mutable reference to Error on the energy deposit [GeV]
146 float& getEdepError();
147 /// Get reference to Error on the energy deposit [GeV]
148 [[deprecated("use getEdepError instead")]]
149 float& edepError();
150
151
152 /// Set the Related raw tracker hit
153 void setRawHit(const edm4eic::RawTrackerHit& value);
154
155
156
157
158 /// check whether the object is actually available
159 bool isAvailable() const;
160 /// disconnect from TrackerHitObj instance
161 void unlink() { m_obj = podio::utils::MaybeSharedPtr<TrackerHitObj>{nullptr}; }
162
163 bool operator==(const MutableTrackerHit& other) const { return m_obj == other.m_obj; }
164 bool operator==(const TrackerHit& other) const;
165
166 bool operator!=(const MutableTrackerHit& other) const { return !(*this == other); }
167 bool operator!=(const TrackerHit& other) const { return !(*this == other); }
168
169 // less comparison operator, so that objects can be e.g. stored in sets.
170 bool operator<(const MutableTrackerHit& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
171
172 podio::ObjectID id() const { return getObjectID(); }
173
174 const podio::ObjectID getObjectID() const;
175
176 friend std::hash<MutableTrackerHit>;
177
179 using std::swap;
180 swap(a.m_obj, b.m_obj); // swap out the internal pointers
181 }
182
183private:
184 /// constructor from existing TrackerHitObj
185 explicit MutableTrackerHit(podio::utils::MaybeSharedPtr<TrackerHitObj> obj);
186
187 podio::utils::MaybeSharedPtr<TrackerHitObj> m_obj{nullptr};
188};
189
190#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
191void to_json(nlohmann::json& j, const MutableTrackerHit& value);
192#endif
193
194
195} // namespace edm4eic
196
197
198
199template<>
200struct std::hash<edm4eic::MutableTrackerHit> {
201 std::size_t operator()(const edm4eic::MutableTrackerHit& obj) const {
202 return std::hash<edm4eic::TrackerHitObj*>{}(obj.m_obj.get());
203 }
204};
205
206
207#endif
Definition CovDiag3f.h:18
Definition MutableRawTrackerHit.h:33
Definition MutableTrackerHit.h:37
friend class TrackerHitCollection
Definition MutableTrackerHit.h:39
~MutableTrackerHit()=default
destructor
MutableTrackerHit & operator=(MutableTrackerHit other) &
copy-assignment operator
Definition MutableTrackerHit.cc:33
TrackerHit object_type
Definition MutableTrackerHit.h:44
void setRawHit(const edm4eic::RawTrackerHit &value)
Set the Related raw tracker hit.
Definition MutableTrackerHit.cc:86
MutableTrackerHit & operator=(MutableTrackerHit other) &&=delete
friend class TrackerHit
Definition MutableTrackerHit.h:41
std::uint64_t & cellID()
Get reference to The detector specific (geometrical) cell id.
Definition MutableTrackerHit.cc:66
const podio::ObjectID getObjectID() const
Definition MutableTrackerHit.cc:100
float & time()
Get reference to Hit time [ns].
Definition MutableTrackerHit.cc:75
float getEdep() const
Access the Energy deposit in this hit [GeV].
Definition MutableTrackerHit.cc:53
edm4eic::CovDiag3f & positionError()
Get reference to Covariance Matrix.
Definition MutableTrackerHit.cc:72
bool isAvailable() const
check whether the object is actually available
Definition MutableTrackerHit.cc:96
float getTimeError() const
Access the Error on the time.
Definition MutableTrackerHit.cc:52
void setCellID(const std::uint64_t cellID)
Set the The detector specific (geometrical) cell id.
Definition MutableTrackerHit.cc:64
void setTimeError(const float timeError)
Set the Error on the time.
Definition MutableTrackerHit.cc:76
void unlink()
disconnect from TrackerHitObj instance
Definition MutableTrackerHit.h:161
void setEdep(const float edep)
Set the Energy deposit in this hit [GeV].
Definition MutableTrackerHit.cc:79
bool operator!=(const TrackerHit &other) const
Definition MutableTrackerHit.h:167
float getTime() const
Access the Hit time [ns].
Definition MutableTrackerHit.cc:51
bool operator<(const MutableTrackerHit &other) const
Definition MutableTrackerHit.h:170
const edm4eic::RawTrackerHit getRawHit() const
Access the Related raw tracker hit.
Definition MutableTrackerHit.cc:56
float & edepError()
Get reference to Error on the energy deposit [GeV].
Definition MutableTrackerHit.cc:84
void setEdepError(const float edepError)
Set the Error on the energy deposit [GeV].
Definition MutableTrackerHit.cc:82
MutableTrackerHit clone(bool cloneRelations=true) const
Definition MutableTrackerHit.cc:38
float & edep()
Get reference to Energy deposit in this hit [GeV].
Definition MutableTrackerHit.cc:81
float & timeError()
Get reference to Error on the time.
Definition MutableTrackerHit.cc:78
void setPosition(const edm4hep::Vector3f &position)
Set the Hit (cell) position [mm].
Definition MutableTrackerHit.cc:67
const edm4eic::CovDiag3f & getPositionError() const
Access the Covariance Matrix.
Definition MutableTrackerHit.cc:50
friend class TrackerHitMutableCollectionIterator
Definition MutableTrackerHit.h:40
bool operator!=(const MutableTrackerHit &other) const
Definition MutableTrackerHit.h:166
std::uint64_t getCellID() const
Access the The detector specific (geometrical) cell id.
Definition MutableTrackerHit.cc:48
const edm4hep::Vector3f & getPosition() const
Access the Hit (cell) position [mm].
Definition MutableTrackerHit.cc:49
TrackerHitCollection collection_type
Definition MutableTrackerHit.h:45
void setPositionError(const edm4eic::CovDiag3f &positionError)
Set the Covariance Matrix.
Definition MutableTrackerHit.cc:70
friend void swap(MutableTrackerHit &a, MutableTrackerHit &b)
Definition MutableTrackerHit.h:178
edm4hep::Vector3f & position()
Get reference to Hit (cell) position [mm].
Definition MutableTrackerHit.cc:69
void setTime(const float time)
Set the Hit time [ns].
Definition MutableTrackerHit.cc:73
bool operator==(const MutableTrackerHit &other) const
Definition MutableTrackerHit.h:163
MutableTrackerHit(const MutableTrackerHit &other)=default
copy constructor
MutableTrackerHit()
default constructor
Definition MutableTrackerHit.cc:19
float getEdepError() const
Access the Error on the energy deposit [GeV].
Definition MutableTrackerHit.cc:54
podio::ObjectID id() const
Definition MutableTrackerHit.h:172
Definition RawTrackerHit.h:41
Definition TrackerHitCollection.h:137
Definition TrackerHit.h:45
Definition CalorimeterHit.cc:17
OrderKey getOrderKey(const edm4eic::CalorimeterHit &obj)
Definition CalorimeterHit.cc:150
std::size_t operator()(const edm4eic::MutableTrackerHit &obj) const
Definition MutableTrackerHit.h:201