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) = 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
100 /// Set the Hit (cell) position [mm]
101 void setPosition(const edm4hep::Vector3f& position);
102 /// Get mutable reference to Hit (cell) position [mm]
103 edm4hep::Vector3f& getPosition();
104
105 /// Set the Covariance Matrix
106 void setPositionError(const edm4eic::CovDiag3f& positionError);
107 /// Get mutable reference to Covariance Matrix
109
110 /// Set the Hit time [ns]
111 void setTime(const float time);
112 /// Get mutable reference to Hit time [ns]
113 float& getTime();
114
115 /// Set the Error on the time
116 void setTimeError(const float timeError);
117 /// Get mutable reference to Error on the time
118 float& getTimeError();
119
120 /// Set the Energy deposit in this hit [GeV]
121 void setEdep(const float edep);
122 /// Get mutable reference to Energy deposit in this hit [GeV]
123 float& getEdep();
124
125 /// Set the Error on the energy deposit [GeV]
126 void setEdepError(const float edepError);
127 /// Get mutable reference to Error on the energy deposit [GeV]
128 float& getEdepError();
129
130
131 /// Set the Related raw tracker hit
132 void setRawHit(const edm4eic::RawTrackerHit& value);
133
134
135
136
137 /// check whether the object is actually available
138 bool isAvailable() const;
139 /// disconnect from TrackerHitObj instance
140 void unlink() { m_obj = podio::utils::MaybeSharedPtr<TrackerHitObj>{nullptr}; }
141
142 constexpr bool operator==(const MutableTrackerHit& other) const { return m_obj == other.m_obj; }
143 bool operator==(const TrackerHit& other) const;
144
145 constexpr bool operator!=(const MutableTrackerHit& other) const { return !(*this == other); }
146 bool operator!=(const TrackerHit& other) const { return !(*this == other); }
147
148 // less comparison operator, so that objects can be e.g. stored in sets.
149 bool operator<(const MutableTrackerHit& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
150
151 podio::ObjectID id() const { return getObjectID(); }
152
153 const podio::ObjectID getObjectID() const;
154
155 friend std::hash<MutableTrackerHit>;
156
158 using std::swap;
159 swap(a.m_obj, b.m_obj); // swap out the internal pointers
160 }
161
162private:
163 /// constructor from existing TrackerHitObj
164 explicit MutableTrackerHit(podio::utils::MaybeSharedPtr<TrackerHitObj> obj);
165
166 podio::utils::MaybeSharedPtr<TrackerHitObj> m_obj{new TrackerHitObj{}, podio::utils::MarkOwned};
167};
168
169#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
170void to_json(nlohmann::json& j, const MutableTrackerHit& value);
171#endif
172
173
174} // namespace edm4eic
175
176
177
178template<>
179struct std::hash<edm4eic::MutableTrackerHit> {
180 std::size_t operator()(const edm4eic::MutableTrackerHit& obj) const {
181 return std::hash<edm4eic::TrackerHitObj*>{}(obj.m_obj.get());
182 }
183};
184
185
186#endif
Definition CovDiag3f.h:19
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:29
TrackerHit object_type
Definition MutableTrackerHit.h:44
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:140
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:146
float getTime() const
Access the Hit time [ns].
Definition MutableTrackerHit.cc:47
bool operator<(const MutableTrackerHit &other) const
Definition MutableTrackerHit.h:149
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:142
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:157
MutableTrackerHit()=default
default constructor
void setTime(const float time)
Set the Hit time [ns].
Definition MutableTrackerHit.cc:66
MutableTrackerHit(const MutableTrackerHit &other)=default
copy constructor
constexpr bool operator!=(const MutableTrackerHit &other) const
Definition MutableTrackerHit.h:145
float getEdepError() const
Access the Error on the energy deposit [GeV].
Definition MutableTrackerHit.cc:50
podio::ObjectID id() const
Definition MutableTrackerHit.h:151
Definition RawTrackerHit.h:41
Definition TrackerHitCollection.h:139
Definition TrackerHit.h:45
Definition TrackerHitObj.h:21
Definition ArrowMapper.cc:61
OrderKey getOrderKey(const edm4eic::CalorimeterHit &obj)
Definition CalorimeterHit.cc:146
std::size_t operator()(const edm4eic::MutableTrackerHit &obj) const
Definition MutableTrackerHit.h:180