EDM4eic
EIC data model
Loading...
Searching...
No Matches
PMTHit.h
Go to the documentation of this file.
1// AUTOMATICALLY GENERATED FILE - DO NOT EDIT
2
3#ifndef EDM4EIC_PMTHit_H
4#define EDM4EIC_PMTHit_H
5
6#include "edm4eic/PMTHitObj.h"
7
8#include "edm4hep/Vector3f.h"
9#include <cstdint>
10
11#include "podio/utilities/MaybeSharedPtr.h"
12#include "podio/detail/OrderKey.h"
13
14#include <ostream>
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 podio::detail {
28// Internal function used in less comparison operators of the datatypes and interface types
29OrderKey getOrderKey(const edm4eic::PMTHit& obj);
30};
31
32namespace edm4eic {
33
34class MutablePMTHit;
37
38/** @class PMTHit
39 * EIC PMT hit
40 * @author: S. Joosten, C. Peng
41 */
42class PMTHit {
43
44 friend class MutablePMTHit;
45 friend class PMTHitCollection;
48 friend podio::detail::OrderKey podio::detail::getOrderKey(const PMTHit & obj);
49
50public:
53
54 /// default constructor
55 PMTHit() = default;
56
57 /// Constructor initializing all members
58 PMTHit(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);
59
60 /// copy constructor
61 PMTHit(const PMTHit& other) noexcept = default;
62
63 /// move constructor
64 PMTHit(PMTHit&& other) noexcept = default;
65
66 /// copy-assignment operator
67 PMTHit& operator=(PMTHit other) &; // Rebind this to other's internal object
68 PMTHit& operator=(PMTHit other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
69
70 /// create a mutable deep-copy of the object with identical relations
71 /// if cloneRelations=false, the relations are not cloned and will be empty
72 MutablePMTHit clone(bool cloneRelations=true) const;
73
74 /// destructor
75 ~PMTHit() = default;
76
77 /// converting constructor from mutable object
78 PMTHit(const MutablePMTHit& other);
79
80 static PMTHit makeEmpty();
81
82public:
83
84 static constexpr std::string_view typeName = "edm4eic::PMTHit";
85
86 /// Access the The detector specific (geometrical) cell id.
87 std::uint64_t getCellID() const;
88
89 /// Access the Estimated number of photo-electrons [#]
90 float getNpe() const;
91
92 /// Access the Time [ns]
93 float getTime() const;
94
95 /// Access the Error on the time [ns]
96 float getTimeError() const;
97
98 /// Access the PMT hit position [mm]
99 const edm4hep::Vector3f& getPosition() const;
100
101 /// Access the The dimension information of the pixel [mm].
102 const edm4hep::Vector3f& getDimension() const;
103
104 /// Access the The sector this hit occurred in
105 std::int32_t getSector() const;
106
107 /// Access the The local position of the hit in detector coordinates (relative to the sector) [mm]
108 const edm4hep::Vector3f& getLocal() const;
109
110
111
112
113
114 /// check whether the object is actually available
115 bool isAvailable() const;
116 /// disconnect from PMTHitObj instance
117 void unlink() { m_obj = podio::utils::MaybeSharedPtr<PMTHitObj>{nullptr}; }
118
119 constexpr bool operator==(const PMTHit& other) const { return m_obj == other.m_obj; }
120 bool operator==(const MutablePMTHit& other) const;
121
122 constexpr bool operator!=(const PMTHit& other) const { return !(*this == other); }
123 bool operator!=(const MutablePMTHit& other) const { return !(*this == other); }
124
125 // less comparison operator, so that objects can be e.g. stored in sets.
126 bool operator<(const PMTHit& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
127
128 podio::ObjectID id() const { return getObjectID(); }
129
130 const podio::ObjectID getObjectID() const;
131
132 friend std::hash<PMTHit>;
133
134 friend void swap(PMTHit& a, PMTHit& b) {
135 using std::swap;
136 swap(a.m_obj, b.m_obj); // swap out the internal pointers
137 }
138
139private:
140 /// constructor from existing PMTHitObj
141 explicit PMTHit(podio::utils::MaybeSharedPtr<PMTHitObj> obj);
142 PMTHit(PMTHitObj* obj);
143
144 podio::utils::MaybeSharedPtr<PMTHitObj> m_obj{new PMTHitObj{}, podio::utils::MarkOwned};
145};
146
147std::ostream& operator<<(std::ostream& o, const PMTHit& value);
148
149#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
150void to_json(nlohmann::json& j, const PMTHit& value);
151#endif
152
153
154} // namespace edm4eic
155
156
157
158template<>
159struct std::hash<edm4eic::PMTHit> {
160 std::size_t operator()(const edm4eic::PMTHit& obj) const {
161 return std::hash<edm4eic::PMTHitObj*>{}(obj.m_obj.get());
162 }
163};
164
165
166// This is needed to avoid triggering opening every library in LD_LIBRARY_PATH
167// until it's fixed in ROOT. See https://github.com/root-project/root/issues/18489
168// and https://github.com/AIDASoft/podio/issues/770
169#if defined(__clang__)
170 #pragma clang diagnostic push
171 #pragma clang diagnostic ignored "-Wunknown-warning-option"
172 #pragma clang diagnostic ignored "-Wdeprecated-redundant-constexpr-static-def"
173 #pragma clang diagnostic ignored "-Wdeprecated"
174constexpr std::string_view edm4eic::PMTHit::typeName;
175 #pragma clang diagnostic pop
176#elif defined(__GNUC__)
177 #pragma GCC diagnostic push
178 #pragma GCC diagnostic ignored "-Wdeprecated"
179constexpr std::string_view edm4eic::PMTHit::typeName;
180 #pragma GCC diagnostic pop
181#endif
182
183
184#endif
Definition MutablePMTHit.h:34
Definition PMTHitCollectionData.h:31
Definition PMTHitCollection.h:139
Definition PMTHit.h:42
void unlink()
disconnect from PMTHitObj instance
Definition PMTHit.h:117
constexpr bool operator==(const PMTHit &other) const
Definition PMTHit.h:119
float getNpe() const
Access the Estimated number of photo-electrons [#].
Definition PMTHit.cc:56
MutablePMTHit clone(bool cloneRelations=true) const
Definition PMTHit.cc:36
PMTHit & operator=(PMTHit other) &
copy-assignment operator
Definition PMTHit.cc:31
bool operator<(const PMTHit &other) const
Definition PMTHit.h:126
friend class PMTHitCollection
Definition PMTHit.h:45
friend class MutablePMTHit
Definition PMTHit.h:44
const edm4hep::Vector3f & getDimension() const
Access the The dimension information of the pixel [mm].
Definition PMTHit.cc:60
constexpr bool operator!=(const PMTHit &other) const
Definition PMTHit.h:122
MutablePMTHit mutable_type
Definition PMTHit.h:51
PMTHit(PMTHit &&other) noexcept=default
move constructor
std::uint64_t getCellID() const
Access the The detector specific (geometrical) cell id.
Definition PMTHit.cc:55
static constexpr std::string_view typeName
Definition PMTHit.h:84
friend void swap(PMTHit &a, PMTHit &b)
Definition PMTHit.h:134
const edm4hep::Vector3f & getLocal() const
Access the The local position of the hit in detector coordinates (relative to the sector) [mm].
Definition PMTHit.cc:62
~PMTHit()=default
destructor
float getTime() const
Access the Time [ns].
Definition PMTHit.cc:57
friend class PMTHitCollectionIterator
Definition PMTHit.h:47
const podio::ObjectID getObjectID() const
Definition PMTHit.cc:73
bool operator!=(const MutablePMTHit &other) const
Definition PMTHit.h:123
const edm4hep::Vector3f & getPosition() const
Access the PMT hit position [mm].
Definition PMTHit.cc:59
PMTHit(const PMTHit &other) noexcept=default
copy constructor
float getTimeError() const
Access the Error on the time [ns].
Definition PMTHit.cc:58
PMTHitCollection collection_type
Definition PMTHit.h:52
static PMTHit makeEmpty()
Definition PMTHit.cc:51
PMTHit()=default
default constructor
PMTHit & operator=(PMTHit other) &&=delete
podio::ObjectID id() const
Definition PMTHit.h:128
bool isAvailable() const
check whether the object is actually available
Definition PMTHit.cc:69
std::int32_t getSector() const
Access the The sector this hit occurred in.
Definition PMTHit.cc:61
Definition PMTHitObj.h:17
Definition ArrowMapper.cc:63
std::ostream & operator<<(std::ostream &o, const CalorimeterHit &value)
Definition CalorimeterHit.cc:99
Definition CalorimeterHit.h:31
OrderKey getOrderKey(const edm4eic::CalorimeterHit &obj)
Definition CalorimeterHit.cc:146
std::size_t operator()(const edm4eic::PMTHit &obj) const
Definition PMTHit.h:160