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
48 MutableTrackerHit() = default;
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) noexcept = default;
55
56 /// move constructor
57 MutableTrackerHit(MutableTrackerHit&& other) noexcept = default;
58
59 /// copy-assignment operator
60 MutableTrackerHit& operator=(MutableTrackerHit other) &; // Rebind this to other's internal object
61 MutableTrackerHit& operator=(MutableTrackerHit other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
62
63 /// create a mutable deep-copy of the object with identical relations
64 /// if cloneRelations=false, the relations are not cloned and will be empty
65 MutableTrackerHit clone(bool cloneRelations=true) const;
66
67 /// destructor
68 ~MutableTrackerHit() = default;
69
70
71public:
72
73 /// Access the The detector specific (geometrical) cell id.
74 std::uint64_t getCellID() const;
75
76 /// Access the Hit (cell) position [mm]
77 const edm4hep::Vector3f& getPosition() const;
78
79 /// Access the Covariance Matrix
81
82 /// Access the Hit time [ns]
83 float getTime() const;
84
85 /// Access the Error on the time
86 float getTimeError() const;
87
88 /// Access the Energy deposit in this hit [GeV]
89 float getEdep() const;
90
91 /// Access the Error on the energy deposit [GeV]
92 float getEdepError() const;
93
94
95 /// Access the Related raw tracker hit
97
98 /// Set the The detector specific (geometrical) cell id.
99 void setCellID(const std::uint64_t cellID);
100 /// Get mutable reference to The detector specific (geometrical) cell id.
101 std::uint64_t& getCellID();
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
108 /// Set the Covariance Matrix
109 void setPositionError(const edm4eic::CovDiag3f& positionError);
110 /// Get mutable reference to Covariance Matrix
112
113 /// Set the Hit time [ns]
114 void setTime(const float time);
115 /// Get mutable reference to Hit time [ns]
116 float& getTime();
117
118 /// Set the Error on the time
119 void setTimeError(const float timeError);
120 /// Get mutable reference to Error on the time
121 float& getTimeError();
122
123 /// Set the Energy deposit in this hit [GeV]
124 void setEdep(const float edep);
125 /// Get mutable reference to Energy deposit in this hit [GeV]
126 float& getEdep();
127
128 /// Set the Error on the energy deposit [GeV]
129 void setEdepError(const float edepError);
130 /// Get mutable reference to Error on the energy deposit [GeV]
131 float& getEdepError();
132
133
134 /// Set the Related raw tracker hit
135 void setRawHit(const edm4eic::RawTrackerHit& value);
136
137
138
139
140 /// check whether the object is actually available
141 bool isAvailable() const;
142 /// disconnect from TrackerHitObj instance
143 void unlink() { m_obj = podio::utils::MaybeSharedPtr<TrackerHitObj>{nullptr}; }
144
145 constexpr bool operator==(const MutableTrackerHit& other) const { return m_obj == other.m_obj; }
146 bool operator==(const TrackerHit& other) const;
147
148 constexpr bool operator!=(const MutableTrackerHit& other) const { return !(*this == other); }
149 bool operator!=(const TrackerHit& other) const { return !(*this == other); }
150
151 // less comparison operator, so that objects can be e.g. stored in sets.
152 bool operator<(const MutableTrackerHit& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
153
154 podio::ObjectID id() const { return getObjectID(); }
155
156 const podio::ObjectID getObjectID() const;
157
158 friend std::hash<MutableTrackerHit>;
159
161 using std::swap;
162 swap(a.m_obj, b.m_obj); // swap out the internal pointers
163 }
164
165private:
166 /// constructor from existing TrackerHitObj
167 explicit MutableTrackerHit(podio::utils::MaybeSharedPtr<TrackerHitObj> obj);
168
169 podio::utils::MaybeSharedPtr<TrackerHitObj> m_obj{new TrackerHitObj{}, podio::utils::MarkOwned};
170};
171
172#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
173void to_json(nlohmann::json& j, const MutableTrackerHit& value);
174#endif
175
176
177} // namespace edm4eic
178
179
180
181template<>
182struct std::hash<edm4eic::MutableTrackerHit> {
183 std::size_t operator()(const edm4eic::MutableTrackerHit& obj) const {
184 return std::hash<edm4eic::TrackerHitObj*>{}(obj.m_obj.get());
185 }
186};
187
188
189#endif
Definition CovDiag3f.h:19
Definition MutableRawTrackerHit.h:33
Definition MutableTrackerHit.h:37
friend class TrackerHitCollection
Definition MutableTrackerHit.h:39
~MutableTrackerHit()=default
destructor
MutableTrackerHit(const MutableTrackerHit &other) noexcept=default
copy constructor
MutableTrackerHit & operator=(MutableTrackerHit other) &
copy-assignment operator
Definition MutableTrackerHit.cc:29
TrackerHit object_type
Definition MutableTrackerHit.h:44
MutableTrackerHit(MutableTrackerHit &&other) noexcept=default
move constructor
void setRawHit(const edm4eic::RawTrackerHit &value)
Set the Related raw tracker hit.
Definition MutableTrackerHit.cc:75
MutableTrackerHit & operator=(MutableTrackerHit other) &&=delete
friend class TrackerHit
Definition MutableTrackerHit.h:41
const podio::ObjectID getObjectID() const
Definition MutableTrackerHit.cc:89
float getEdep() const
Access the Energy deposit in this hit [GeV].
Definition MutableTrackerHit.cc:49
bool isAvailable() const
check whether the object is actually available
Definition MutableTrackerHit.cc:85
float getTimeError() const
Access the Error on the time.
Definition MutableTrackerHit.cc:48
void setCellID(const std::uint64_t cellID)
Set the The detector specific (geometrical) cell id.
Definition MutableTrackerHit.cc:60
void setTimeError(const float timeError)
Set the Error on the time.
Definition MutableTrackerHit.cc:68
void unlink()
disconnect from TrackerHitObj instance
Definition MutableTrackerHit.h:143
void setEdep(const float edep)
Set the Energy deposit in this hit [GeV].
Definition MutableTrackerHit.cc:70
bool operator!=(const TrackerHit &other) const
Definition MutableTrackerHit.h:149
float getTime() const
Access the Hit time [ns].
Definition MutableTrackerHit.cc:47
bool operator<(const MutableTrackerHit &other) const
Definition MutableTrackerHit.h:152
const edm4eic::RawTrackerHit getRawHit() const
Access the Related raw tracker hit.
Definition MutableTrackerHit.cc:52
void setEdepError(const float edepError)
Set the Error on the energy deposit [GeV].
Definition MutableTrackerHit.cc:72
MutableTrackerHit clone(bool cloneRelations=true) const
Definition MutableTrackerHit.cc:34
void setPosition(const edm4hep::Vector3f &position)
Set the Hit (cell) position [mm].
Definition MutableTrackerHit.cc:62
const edm4eic::CovDiag3f & getPositionError() const
Access the Covariance Matrix.
Definition MutableTrackerHit.cc:46
friend class TrackerHitMutableCollectionIterator
Definition MutableTrackerHit.h:40
std::uint64_t getCellID() const
Access the The detector specific (geometrical) cell id.
Definition MutableTrackerHit.cc:44
const edm4hep::Vector3f & getPosition() const
Access the Hit (cell) position [mm].
Definition MutableTrackerHit.cc:45
constexpr bool operator==(const MutableTrackerHit &other) const
Definition MutableTrackerHit.h:145
TrackerHitCollection collection_type
Definition MutableTrackerHit.h:45
void setPositionError(const edm4eic::CovDiag3f &positionError)
Set the Covariance Matrix.
Definition MutableTrackerHit.cc:64
friend void swap(MutableTrackerHit &a, MutableTrackerHit &b)
Definition MutableTrackerHit.h:160
MutableTrackerHit()=default
default constructor
void setTime(const float time)
Set the Hit time [ns].
Definition MutableTrackerHit.cc:66
constexpr bool operator!=(const MutableTrackerHit &other) const
Definition MutableTrackerHit.h:148
float getEdepError() const
Access the Error on the energy deposit [GeV].
Definition MutableTrackerHit.cc:50
podio::ObjectID id() const
Definition MutableTrackerHit.h:154
Definition RawTrackerHit.h:41
Definition TrackerHitCollection.h:139
Definition TrackerHit.h:45
Definition TrackerHitObj.h:21
Definition ArrowMapper.cc:63
OrderKey getOrderKey(const edm4eic::CalorimeterHit &obj)
Definition CalorimeterHit.cc:146
std::size_t operator()(const edm4eic::MutableTrackerHit &obj) const
Definition MutableTrackerHit.h:183