EDM4eic
EIC data model
Loading...
Searching...
No Matches
MutableCalorimeterHit.h
Go to the documentation of this file.
1// AUTOMATICALLY GENERATED FILE - DO NOT EDIT
2
3#ifndef EDM4EIC_MutableCalorimeterHit_H
4#define EDM4EIC_MutableCalorimeterHit_H
5
7// Make the immutable class available from its mutable version but not vice versa
9
10#include "edm4hep/Vector3f.h"
11#include <cstdint>
12
13#include "podio/utilities/MaybeSharedPtr.h"
14
15#include <cstdint>
16
17#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
18#include "nlohmann/json_fwd.hpp"
19#endif
20
21// forward declarations
22namespace edm4eic {
24}
25namespace edm4hep {
26class RawCalorimeterHit;
27class MutableRawCalorimeterHit;
28}
29
30
31namespace edm4eic {
32
33
34/** @class MutableCalorimeterHit
35 * Calorimeter hit
36 * @author: W. Armstrong, S. Joosten
37 */
39
42 friend class CalorimeterHit;
43
44public:
47
48 /// default constructor
50
51 /// Constructor initializing all members
52 MutableCalorimeterHit(const std::uint64_t cellID, const float energy, const float energyError, const float time, const float timeError, const edm4hep::Vector3f& position, const edm4hep::Vector3f& dimension, const std::int32_t sector, const std::int32_t layer, const edm4hep::Vector3f& local);
53
54 /// copy constructor
55 MutableCalorimeterHit(const MutableCalorimeterHit& other) noexcept = default;
56
57 /// move constructor
58 MutableCalorimeterHit(MutableCalorimeterHit&& other) noexcept = default;
59
60 /// copy-assignment operator
61 MutableCalorimeterHit& operator=(MutableCalorimeterHit other) &; // Rebind this to other's internal object
62 MutableCalorimeterHit& operator=(MutableCalorimeterHit other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
63
64 /// create a mutable deep-copy of the object with identical relations
65 /// if cloneRelations=false, the relations are not cloned and will be empty
66 MutableCalorimeterHit clone(bool cloneRelations=true) const;
67
68 /// destructor
70
71
72public:
73
74 /// Access the The detector specific (geometrical) cell id.
75 std::uint64_t getCellID() const;
76
77 /// Access the The energy for this hit in [GeV].
78 float getEnergy() const;
79
80 /// Access the Error on energy [GeV].
81 float getEnergyError() const;
82
83 /// Access the The time of the hit in [ns].
84 float getTime() const;
85
86 /// Access the Error on the time
87 float getTimeError() const;
88
89 /// Access the The global position of the hit in world coordinates [mm].
90 const edm4hep::Vector3f& getPosition() const;
91
92 /// Access the The dimension information of the cell [mm].
93 const edm4hep::Vector3f& getDimension() const;
94
95 /// Access the Sector that this hit occurred in
96 std::int32_t getSector() const;
97
98 /// Access the Layer that the hit occurred in
99 std::int32_t getLayer() const;
100
101 /// Access the The local coordinates of the hit in the detector segment [mm].
102 const edm4hep::Vector3f& getLocal() const;
103
104
105 /// Access the Related raw calorimeter hit
106 const edm4hep::RawCalorimeterHit getRawHit() const;
107
108 /// Set the The detector specific (geometrical) cell id.
109 void setCellID(const std::uint64_t cellID);
110 /// Get mutable reference to The detector specific (geometrical) cell id.
111 std::uint64_t& getCellID();
112
113 /// Set the The energy for this hit in [GeV].
114 void setEnergy(const float energy);
115 /// Get mutable reference to The energy for this hit in [GeV].
116 float& getEnergy();
117
118 /// Set the Error on energy [GeV].
119 void setEnergyError(const float energyError);
120 /// Get mutable reference to Error on energy [GeV].
121 float& getEnergyError();
122
123 /// Set the The time of the hit in [ns].
124 void setTime(const float time);
125 /// Get mutable reference to The time of the hit in [ns].
126 float& getTime();
127
128 /// Set the Error on the time
129 void setTimeError(const float timeError);
130 /// Get mutable reference to Error on the time
131 float& getTimeError();
132
133 /// Set the The global position of the hit in world coordinates [mm].
134 void setPosition(const edm4hep::Vector3f& position);
135 /// Get mutable reference to The global position of the hit in world coordinates [mm].
136 edm4hep::Vector3f& getPosition();
137
138 /// Set the The dimension information of the cell [mm].
139 void setDimension(const edm4hep::Vector3f& dimension);
140 /// Get mutable reference to The dimension information of the cell [mm].
141 edm4hep::Vector3f& getDimension();
142
143 /// Set the Sector that this hit occurred in
144 void setSector(const std::int32_t sector);
145 /// Get mutable reference to Sector that this hit occurred in
146 std::int32_t& getSector();
147
148 /// Set the Layer that the hit occurred in
149 void setLayer(const std::int32_t layer);
150 /// Get mutable reference to Layer that the hit occurred in
151 std::int32_t& getLayer();
152
153 /// Set the The local coordinates of the hit in the detector segment [mm].
154 void setLocal(const edm4hep::Vector3f& local);
155 /// Get mutable reference to The local coordinates of the hit in the detector segment [mm].
156 edm4hep::Vector3f& getLocal();
157
158
159 /// Set the Related raw calorimeter hit
160 void setRawHit(const edm4hep::RawCalorimeterHit& value);
161
162
163
164
165 /// check whether the object is actually available
166 bool isAvailable() const;
167 /// disconnect from CalorimeterHitObj instance
168 void unlink() { m_obj = podio::utils::MaybeSharedPtr<CalorimeterHitObj>{nullptr}; }
169
170 constexpr bool operator==(const MutableCalorimeterHit& other) const { return m_obj == other.m_obj; }
171 bool operator==(const CalorimeterHit& other) const;
172
173 constexpr bool operator!=(const MutableCalorimeterHit& other) const { return !(*this == other); }
174 bool operator!=(const CalorimeterHit& other) const { return !(*this == other); }
175
176 // less comparison operator, so that objects can be e.g. stored in sets.
178
179 podio::ObjectID id() const { return getObjectID(); }
180
181 const podio::ObjectID getObjectID() const;
182
183 friend std::hash<MutableCalorimeterHit>;
184
186 using std::swap;
187 swap(a.m_obj, b.m_obj); // swap out the internal pointers
188 }
189
190private:
191 /// constructor from existing CalorimeterHitObj
192 explicit MutableCalorimeterHit(podio::utils::MaybeSharedPtr<CalorimeterHitObj> obj);
193
194 podio::utils::MaybeSharedPtr<CalorimeterHitObj> m_obj{new CalorimeterHitObj{}, podio::utils::MarkOwned};
195};
196
197#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
198void to_json(nlohmann::json& j, const MutableCalorimeterHit& value);
199#endif
200
201
202} // namespace edm4eic
203
204
205
206template<>
207struct std::hash<edm4eic::MutableCalorimeterHit> {
208 std::size_t operator()(const edm4eic::MutableCalorimeterHit& obj) const {
209 return std::hash<edm4eic::CalorimeterHitObj*>{}(obj.m_obj.get());
210 }
211};
212
213
214#endif
Definition CalorimeterHitCollection.h:139
Definition CalorimeterHit.h:46
Definition CalorimeterHitObj.h:21
Definition MutableCalorimeterHit.h:38
std::int32_t getLayer() const
Access the Layer that the hit occurred in.
Definition MutableCalorimeterHit.cc:55
void unlink()
disconnect from CalorimeterHitObj instance
Definition MutableCalorimeterHit.h:168
void setDimension(const edm4hep::Vector3f &dimension)
Set the The dimension information of the cell [mm].
Definition MutableCalorimeterHit.cc:78
void setLayer(const std::int32_t layer)
Set the Layer that the hit occurred in.
Definition MutableCalorimeterHit.cc:82
MutableCalorimeterHit clone(bool cloneRelations=true) const
Definition MutableCalorimeterHit.cc:37
void setTime(const float time)
Set the The time of the hit in [ns].
Definition MutableCalorimeterHit.cc:72
bool operator!=(const CalorimeterHit &other) const
Definition MutableCalorimeterHit.h:174
void setSector(const std::int32_t sector)
Set the Sector that this hit occurred in.
Definition MutableCalorimeterHit.cc:80
std::uint64_t getCellID() const
Access the The detector specific (geometrical) cell id.
Definition MutableCalorimeterHit.cc:47
MutableCalorimeterHit()=default
default constructor
bool operator<(const MutableCalorimeterHit &other) const
Definition MutableCalorimeterHit.h:177
const edm4hep::Vector3f & getDimension() const
Access the The dimension information of the cell [mm].
Definition MutableCalorimeterHit.cc:53
const edm4hep::Vector3f & getPosition() const
Access the The global position of the hit in world coordinates [mm].
Definition MutableCalorimeterHit.cc:52
MutableCalorimeterHit(MutableCalorimeterHit &&other) noexcept=default
move constructor
void setEnergy(const float energy)
Set the The energy for this hit in [GeV].
Definition MutableCalorimeterHit.cc:68
float getEnergy() const
Access the The energy for this hit in [GeV].
Definition MutableCalorimeterHit.cc:48
MutableCalorimeterHit & operator=(MutableCalorimeterHit other) &
copy-assignment operator
Definition MutableCalorimeterHit.cc:32
float getTimeError() const
Access the Error on the time.
Definition MutableCalorimeterHit.cc:51
void setCellID(const std::uint64_t cellID)
Set the The detector specific (geometrical) cell id.
Definition MutableCalorimeterHit.cc:66
constexpr bool operator!=(const MutableCalorimeterHit &other) const
Definition MutableCalorimeterHit.h:173
~MutableCalorimeterHit()=default
destructor
std::int32_t getSector() const
Access the Sector that this hit occurred in.
Definition MutableCalorimeterHit.cc:54
friend void swap(MutableCalorimeterHit &a, MutableCalorimeterHit &b)
Definition MutableCalorimeterHit.h:185
const podio::ObjectID getObjectID() const
Definition MutableCalorimeterHit.cc:101
MutableCalorimeterHit(const MutableCalorimeterHit &other) noexcept=default
copy constructor
CalorimeterHit object_type
Definition MutableCalorimeterHit.h:45
constexpr bool operator==(const MutableCalorimeterHit &other) const
Definition MutableCalorimeterHit.h:170
friend class CalorimeterHitMutableCollectionIterator
Definition MutableCalorimeterHit.h:41
CalorimeterHitCollection collection_type
Definition MutableCalorimeterHit.h:46
void setTimeError(const float timeError)
Set the Error on the time.
Definition MutableCalorimeterHit.cc:74
float getTime() const
Access the The time of the hit in [ns].
Definition MutableCalorimeterHit.cc:50
friend class CalorimeterHitCollection
Definition MutableCalorimeterHit.h:40
MutableCalorimeterHit & operator=(MutableCalorimeterHit other) &&=delete
bool isAvailable() const
check whether the object is actually available
Definition MutableCalorimeterHit.cc:97
float getEnergyError() const
Access the Error on energy [GeV].
Definition MutableCalorimeterHit.cc:49
void setLocal(const edm4hep::Vector3f &local)
Set the The local coordinates of the hit in the detector segment [mm].
Definition MutableCalorimeterHit.cc:84
podio::ObjectID id() const
Definition MutableCalorimeterHit.h:179
void setPosition(const edm4hep::Vector3f &position)
Set the The global position of the hit in world coordinates [mm].
Definition MutableCalorimeterHit.cc:76
friend class CalorimeterHit
Definition MutableCalorimeterHit.h:42
const edm4hep::RawCalorimeterHit getRawHit() const
Access the Related raw calorimeter hit.
Definition MutableCalorimeterHit.cc:58
void setEnergyError(const float energyError)
Set the Error on energy [GeV].
Definition MutableCalorimeterHit.cc:70
void setRawHit(const edm4hep::RawCalorimeterHit &value)
Set the Related raw calorimeter hit.
Definition MutableCalorimeterHit.cc:87
const edm4hep::Vector3f & getLocal() const
Access the The local coordinates of the hit in the detector segment [mm].
Definition MutableCalorimeterHit.cc:56
Definition ArrowMapper.cc:63
Definition CalorimeterHit.h:25
OrderKey getOrderKey(const edm4eic::CalorimeterHit &obj)
Definition CalorimeterHit.cc:146
std::size_t operator()(const edm4eic::MutableCalorimeterHit &obj) const
Definition MutableCalorimeterHit.h:208