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