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