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) = 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
98 /// Set the Estimated number of photo-electrons [#]
99 void setNpe(const float npe);
100 /// Get mutable reference to Estimated number of photo-electrons [#]
101 float& getNpe();
102
103 /// Set the Time [ns]
104 void setTime(const float time);
105 /// Get mutable reference to Time [ns]
106 float& getTime();
107
108 /// Set the Error on the time [ns]
109 void setTimeError(const float timeError);
110 /// Get mutable reference to Error on the time [ns]
111 float& getTimeError();
112
113 /// Set the PMT hit position [mm]
114 void setPosition(const edm4hep::Vector3f& position);
115 /// Get mutable reference to PMT hit position [mm]
116 edm4hep::Vector3f& getPosition();
117
118 /// Set the The dimension information of the pixel [mm].
119 void setDimension(const edm4hep::Vector3f& dimension);
120 /// Get mutable reference to The dimension information of the pixel [mm].
121 edm4hep::Vector3f& getDimension();
122
123 /// Set the The sector this hit occurred in
124 void setSector(const std::int32_t sector);
125 /// Get mutable reference to The sector this hit occurred in
126 std::int32_t& getSector();
127
128 /// Set the The local position of the hit in detector coordinates (relative to the sector) [mm]
129 void setLocal(const edm4hep::Vector3f& local);
130 /// Get mutable reference to The local position of the hit in detector coordinates (relative to the sector) [mm]
131 edm4hep::Vector3f& getLocal();
132
133
134
135
136
137
138 /// check whether the object is actually available
139 bool isAvailable() const;
140 /// disconnect from PMTHitObj instance
141 void unlink() { m_obj = podio::utils::MaybeSharedPtr<PMTHitObj>{nullptr}; }
142
143 constexpr bool operator==(const MutablePMTHit& other) const { return m_obj == other.m_obj; }
144 bool operator==(const PMTHit& other) const;
145
146 constexpr bool operator!=(const MutablePMTHit& other) const { return !(*this == other); }
147 bool operator!=(const PMTHit& other) const { return !(*this == other); }
148
149 // less comparison operator, so that objects can be e.g. stored in sets.
150 bool operator<(const MutablePMTHit& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
151
152 podio::ObjectID id() const { return getObjectID(); }
153
154 const podio::ObjectID getObjectID() const;
155
156 friend std::hash<MutablePMTHit>;
157
158 friend void swap(MutablePMTHit& a, MutablePMTHit& b) {
159 using std::swap;
160 swap(a.m_obj, b.m_obj); // swap out the internal pointers
161 }
162
163private:
164 /// constructor from existing PMTHitObj
165 explicit MutablePMTHit(podio::utils::MaybeSharedPtr<PMTHitObj> obj);
166
167 podio::utils::MaybeSharedPtr<PMTHitObj> m_obj{new PMTHitObj{}, podio::utils::MarkOwned};
168};
169
170#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
171void to_json(nlohmann::json& j, const MutablePMTHit& value);
172#endif
173
174
175} // namespace edm4eic
176
177
178
179template<>
180struct std::hash<edm4eic::MutablePMTHit> {
181 std::size_t operator()(const edm4eic::MutablePMTHit& obj) const {
182 return std::hash<edm4eic::PMTHitObj*>{}(obj.m_obj.get());
183 }
184};
185
186
187#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:147
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
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:152
constexpr bool operator==(const MutablePMTHit &other) const
Definition MutablePMTHit.h:143
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
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:150
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:158
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
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:54
constexpr bool operator!=(const MutablePMTHit &other) const
Definition MutablePMTHit.h:146
void unlink()
disconnect from PMTHitObj instance
Definition MutablePMTHit.h:141
Definition PMTHitCollection.h:139
Definition PMTHit.h:42
Definition PMTHitObj.h:17
Definition ArrowMapper.cc:61
OrderKey getOrderKey(const edm4eic::CalorimeterHit &obj)
Definition CalorimeterHit.cc:146
std::size_t operator()(const edm4eic::MutablePMTHit &obj) const
Definition MutablePMTHit.h:181