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