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