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
45 MutablePMTHit() = default;
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) noexcept = default;
52
53 /// move constructor
54 MutablePMTHit(MutablePMTHit&& other) noexcept = default;
55
56 /// copy-assignment operator
57 MutablePMTHit& operator=(MutablePMTHit other) &; // Rebind this to other's internal object
58 MutablePMTHit& operator=(MutablePMTHit 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 MutablePMTHit clone(bool cloneRelations=true) const;
63
64 /// destructor
65 ~MutablePMTHit() = default;
66
67
68public:
69
70 /// Access the The detector specific (geometrical) cell id.
71 std::uint64_t getCellID() const;
72
73 /// Access the Estimated number of photo-electrons [#]
74 float getNpe() const;
75
76 /// Access the Time [ns]
77 float getTime() const;
78
79 /// Access the Error on the time [ns]
80 float getTimeError() const;
81
82 /// Access the PMT hit position [mm]
83 const edm4hep::Vector3f& getPosition() const;
84
85 /// Access the The dimension information of the pixel [mm].
86 const edm4hep::Vector3f& getDimension() const;
87
88 /// Access the The sector this hit occurred in
89 std::int32_t getSector() const;
90
91 /// Access the The local position of the hit in detector coordinates (relative to the sector) [mm]
92 const edm4hep::Vector3f& getLocal() const;
93
94
95
96 /// Set the The detector specific (geometrical) cell id.
97 void setCellID(const std::uint64_t cellID);
98 /// Get mutable reference to The detector specific (geometrical) cell id.
99 std::uint64_t& getCellID();
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
106 /// Set the Time [ns]
107 void setTime(const float time);
108 /// Get mutable reference to Time [ns]
109 float& getTime();
110
111 /// Set the Error on the time [ns]
112 void setTimeError(const float timeError);
113 /// Get mutable reference to Error on the time [ns]
114 float& getTimeError();
115
116 /// Set the PMT hit position [mm]
117 void setPosition(const edm4hep::Vector3f& position);
118 /// Get mutable reference to PMT hit position [mm]
119 edm4hep::Vector3f& getPosition();
120
121 /// Set the The dimension information of the pixel [mm].
122 void setDimension(const edm4hep::Vector3f& dimension);
123 /// Get mutable reference to The dimension information of the pixel [mm].
124 edm4hep::Vector3f& getDimension();
125
126 /// Set the The sector this hit occurred in
127 void setSector(const std::int32_t sector);
128 /// Get mutable reference to The sector this hit occurred in
129 std::int32_t& getSector();
130
131 /// Set the The local position of the hit in detector coordinates (relative to the sector) [mm]
132 void setLocal(const edm4hep::Vector3f& local);
133 /// Get mutable reference to The local position of the hit in detector coordinates (relative to the sector) [mm]
134 edm4hep::Vector3f& getLocal();
135
136
137
138
139
140
141 /// check whether the object is actually available
142 bool isAvailable() const;
143 /// disconnect from PMTHitObj instance
144 void unlink() { m_obj = podio::utils::MaybeSharedPtr<PMTHitObj>{nullptr}; }
145
146 constexpr bool operator==(const MutablePMTHit& other) const { return m_obj == other.m_obj; }
147 bool operator==(const PMTHit& other) const;
148
149 constexpr bool operator!=(const MutablePMTHit& other) const { return !(*this == other); }
150 bool operator!=(const PMTHit& other) const { return !(*this == other); }
151
152 // less comparison operator, so that objects can be e.g. stored in sets.
153 bool operator<(const MutablePMTHit& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
154
155 podio::ObjectID id() const { return getObjectID(); }
156
157 const podio::ObjectID getObjectID() const;
158
159 friend std::hash<MutablePMTHit>;
160
161 friend void swap(MutablePMTHit& a, MutablePMTHit& b) {
162 using std::swap;
163 swap(a.m_obj, b.m_obj); // swap out the internal pointers
164 }
165
166private:
167 /// constructor from existing PMTHitObj
168 explicit MutablePMTHit(podio::utils::MaybeSharedPtr<PMTHitObj> obj);
169
170 podio::utils::MaybeSharedPtr<PMTHitObj> m_obj{new PMTHitObj{}, podio::utils::MarkOwned};
171};
172
173#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
174void to_json(nlohmann::json& j, const MutablePMTHit& value);
175#endif
176
177
178} // namespace edm4eic
179
180
181
182template<>
183struct std::hash<edm4eic::MutablePMTHit> {
184 std::size_t operator()(const edm4eic::MutablePMTHit& obj) const {
185 return std::hash<edm4eic::PMTHitObj*>{}(obj.m_obj.get());
186 }
187};
188
189
190#endif
Definition MutablePMTHit.h:34
bool isAvailable() const
check whether the object is actually available
Definition MutablePMTHit.cc:77
MutablePMTHit clone(bool cloneRelations=true) const
Definition MutablePMTHit.cc:34
bool operator!=(const PMTHit &other) const
Definition MutablePMTHit.h:150
void setTime(const float time)
Set the Time [ns].
Definition MutablePMTHit.cc:58
const edm4hep::Vector3f & getPosition() const
Access the PMT hit position [mm].
Definition MutablePMTHit.cc:48
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:66
MutablePMTHit & operator=(MutablePMTHit other) &&=delete
const edm4hep::Vector3f & getDimension() const
Access the The dimension information of the pixel [mm].
Definition MutablePMTHit.cc:49
std::int32_t getSector() const
Access the The sector this hit occurred in.
Definition MutablePMTHit.cc:50
MutablePMTHit()=default
default constructor
~MutablePMTHit()=default
destructor
void setDimension(const edm4hep::Vector3f &dimension)
Set the The dimension information of the pixel [mm].
Definition MutablePMTHit.cc:64
PMTHit object_type
Definition MutablePMTHit.h:41
float getNpe() const
Access the Estimated number of photo-electrons [#].
Definition MutablePMTHit.cc:45
void setPosition(const edm4hep::Vector3f &position)
Set the PMT hit position [mm].
Definition MutablePMTHit.cc:62
MutablePMTHit(const MutablePMTHit &other) noexcept=default
copy constructor
float getTimeError() const
Access the Error on the time [ns].
Definition MutablePMTHit.cc:47
friend class PMTHit
Definition MutablePMTHit.h:38
PMTHitCollection collection_type
Definition MutablePMTHit.h:42
podio::ObjectID id() const
Definition MutablePMTHit.h:155
constexpr bool operator==(const MutablePMTHit &other) const
Definition MutablePMTHit.h:146
const edm4hep::Vector3f & getLocal() const
Access the The local position of the hit in detector coordinates (relative to the sector) [mm].
Definition MutablePMTHit.cc:51
MutablePMTHit(MutablePMTHit &&other) noexcept=default
move constructor
float getTime() const
Access the Time [ns].
Definition MutablePMTHit.cc:46
void setTimeError(const float timeError)
Set the Error on the time [ns].
Definition MutablePMTHit.cc:60
bool operator<(const MutablePMTHit &other) const
Definition MutablePMTHit.h:153
const podio::ObjectID getObjectID() const
Definition MutablePMTHit.cc:81
MutablePMTHit & operator=(MutablePMTHit other) &
copy-assignment operator
Definition MutablePMTHit.cc:29
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:68
friend class PMTHitMutableCollectionIterator
Definition MutablePMTHit.h:37
friend void swap(MutablePMTHit &a, MutablePMTHit &b)
Definition MutablePMTHit.h:161
std::uint64_t getCellID() const
Access the The detector specific (geometrical) cell id.
Definition MutablePMTHit.cc:44
void setNpe(const float npe)
Set the Estimated number of photo-electrons [#].
Definition MutablePMTHit.cc:56
void setCellID(const std::uint64_t cellID)
Set the The detector specific (geometrical) cell id.
Definition MutablePMTHit.cc:54
constexpr bool operator!=(const MutablePMTHit &other) const
Definition MutablePMTHit.h:149
void unlink()
disconnect from PMTHitObj instance
Definition MutablePMTHit.h:144
Definition PMTHitCollection.h:139
Definition PMTHit.h:42
Definition PMTHitObj.h:17
Definition ArrowMapper.cc:63
OrderKey getOrderKey(const edm4eic::CalorimeterHit &obj)
Definition CalorimeterHit.cc:146
std::size_t operator()(const edm4eic::MutablePMTHit &obj) const
Definition MutablePMTHit.h:184