EDM4eic
EIC data model
Loading...
Searching...
No Matches
Measurement2D.h
Go to the documentation of this file.
1// AUTOMATICALLY GENERATED FILE - DO NOT EDIT
2
3#ifndef EDM4EIC_Measurement2D_H
4#define EDM4EIC_Measurement2D_H
5
7
8#include "edm4eic/Cov3f.h"
10#include "edm4hep/Vector2f.h"
11#include "podio/RelationRange.h"
12#include <cstdint>
13#include <vector>
14
15#include "podio/utilities/MaybeSharedPtr.h"
16#include "podio/detail/OrderKey.h"
17
18#include <ostream>
19#include <cstdint>
20
21#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
22#include "nlohmann/json_fwd.hpp"
23#endif
24
25// forward declarations
26namespace edm4eic {
28}
29
30
31namespace podio::detail {
32// Internal function used in less comparison operators of the datatypes and interface types
33OrderKey getOrderKey(const edm4eic::Measurement2D& obj);
34};
35
36namespace edm4eic {
37
41
42/** @class Measurement2D
43 * 2D measurement (on an arbitrary surface)
44 * @author: W. Deconinck
45 */
47
52 friend podio::detail::OrderKey podio::detail::getOrderKey(const Measurement2D & obj);
53
54public:
57
58 /// default constructor
59 Measurement2D() = default;
60
61 /// Constructor initializing all members
62 Measurement2D(const std::uint64_t surface, const edm4hep::Vector2f& loc, const float time, const edm4eic::Cov3f& covariance);
63
64 /// copy constructor
65 Measurement2D(const Measurement2D& other) noexcept = default;
66
67 /// move constructor
68 Measurement2D(Measurement2D&& other) noexcept = default;
69
70 /// copy-assignment operator
71 Measurement2D& operator=(Measurement2D other) &; // Rebind this to other's internal object
72 Measurement2D& operator=(Measurement2D 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 MutableMeasurement2D clone(bool cloneRelations=true) const;
77
78 /// destructor
79 ~Measurement2D() = default;
80
81 /// converting constructor from mutable object
83
84 static Measurement2D makeEmpty();
85
86public:
87
88 static constexpr std::string_view typeName = "edm4eic::Measurement2D";
89
90 /// Access the Surface for bound coordinates (geometryID)
91 std::uint64_t getSurface() const;
92
93 /// Access the 2D location on surface
94 const edm4hep::Vector2f& getLoc() const;
95
96 /// Access the Measurement time
97 float getTime() const;
98
99 /// Access the Covariance on location and time
100 const edm4eic::Cov3f& getCovariance() const;
101
102
103
104 std::size_t hits_size() const;
105 edm4eic::TrackerHit getHits(std::size_t) const;
106 std::vector<edm4eic::TrackerHit>::const_iterator hits_begin() const;
107 std::vector<edm4eic::TrackerHit>::const_iterator hits_end() const;
108 podio::RelationRange<edm4eic::TrackerHit> getHits() const;
109 std::size_t weights_size() const;
110 float getWeights(std::size_t) const;
111 std::vector<float>::const_iterator weights_begin() const;
112 std::vector<float>::const_iterator weights_end() const;
113 podio::RelationRange<float> getWeights() const;
114
115
116 /// check whether the object is actually available
117 bool isAvailable() const;
118 /// disconnect from Measurement2DObj instance
119 void unlink() { m_obj = podio::utils::MaybeSharedPtr<Measurement2DObj>{nullptr}; }
120
121 constexpr bool operator==(const Measurement2D& other) const { return m_obj == other.m_obj; }
122 bool operator==(const MutableMeasurement2D& other) const;
123
124 constexpr bool operator!=(const Measurement2D& other) const { return !(*this == other); }
125 bool operator!=(const MutableMeasurement2D& other) const { return !(*this == other); }
126
127 // less comparison operator, so that objects can be e.g. stored in sets.
128 bool operator<(const Measurement2D& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
129
130 podio::ObjectID id() const { return getObjectID(); }
131
132 const podio::ObjectID getObjectID() const;
133
134 friend std::hash<Measurement2D>;
135
136 friend void swap(Measurement2D& a, Measurement2D& b) {
137 using std::swap;
138 swap(a.m_obj, b.m_obj); // swap out the internal pointers
139 }
140
141private:
142 /// constructor from existing Measurement2DObj
143 explicit Measurement2D(podio::utils::MaybeSharedPtr<Measurement2DObj> obj);
145
146 podio::utils::MaybeSharedPtr<Measurement2DObj> m_obj{new Measurement2DObj{}, podio::utils::MarkOwned};
147};
148
149std::ostream& operator<<(std::ostream& o, const Measurement2D& value);
150
151#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
152void to_json(nlohmann::json& j, const Measurement2D& value);
153#endif
154
155
156} // namespace edm4eic
157
158
159
160template<>
161struct std::hash<edm4eic::Measurement2D> {
162 std::size_t operator()(const edm4eic::Measurement2D& obj) const {
163 return std::hash<edm4eic::Measurement2DObj*>{}(obj.m_obj.get());
164 }
165};
166
167
168// This is needed to avoid triggering opening every library in LD_LIBRARY_PATH
169// until it's fixed in ROOT. See https://github.com/root-project/root/issues/18489
170// and https://github.com/AIDASoft/podio/issues/770
171#if defined(__clang__)
172 #pragma clang diagnostic push
173 #pragma clang diagnostic ignored "-Wunknown-warning-option"
174 #pragma clang diagnostic ignored "-Wdeprecated-redundant-constexpr-static-def"
175 #pragma clang diagnostic ignored "-Wdeprecated"
176constexpr std::string_view edm4eic::Measurement2D::typeName;
177 #pragma clang diagnostic pop
178#elif defined(__GNUC__)
179 #pragma GCC diagnostic push
180 #pragma GCC diagnostic ignored "-Wdeprecated"
181constexpr std::string_view edm4eic::Measurement2D::typeName;
182 #pragma GCC diagnostic pop
183#endif
184
185
186#endif
Definition Cov3f.h:19
Definition Measurement2DCollectionData.h:32
Definition Measurement2DCollection.h:139
Definition Measurement2D.h:46
std::uint64_t getSurface() const
Access the Surface for bound coordinates (geometryID).
Definition Measurement2D.cc:73
const edm4eic::Cov3f & getCovariance() const
Access the Covariance on location and time.
Definition Measurement2D.cc:76
bool isAvailable() const
check whether the object is actually available
Definition Measurement2D.cc:147
Measurement2D & operator=(Measurement2D other) &&=delete
friend class Measurement2DCollection
Definition Measurement2D.h:49
void unlink()
disconnect from Measurement2DObj instance
Definition Measurement2D.h:119
const edm4hep::Vector2f & getLoc() const
Access the 2D location on surface.
Definition Measurement2D.cc:74
std::vector< edm4eic::TrackerHit >::const_iterator hits_end() const
Definition Measurement2D.cc:86
MutableMeasurement2D clone(bool cloneRelations=true) const
Definition Measurement2D.cc:32
Measurement2D(Measurement2D &&other) noexcept=default
move constructor
std::size_t weights_size() const
Definition Measurement2D.cc:124
std::vector< float >::const_iterator weights_end() const
Definition Measurement2D.cc:118
Measurement2D & operator=(Measurement2D other) &
copy-assignment operator
Definition Measurement2D.cc:27
podio::RelationRange< edm4eic::TrackerHit > getHits() const
Definition Measurement2D.cc:103
Measurement2D()=default
default constructor
friend class Measurement2DCollectionIterator
Definition Measurement2D.h:51
Measurement2D(const Measurement2D &other) noexcept=default
copy constructor
~Measurement2D()=default
destructor
podio::RelationRange< float > getWeights() const
Definition Measurement2D.cc:135
std::size_t hits_size() const
Definition Measurement2D.cc:92
MutableMeasurement2D mutable_type
Definition Measurement2D.h:55
std::vector< edm4eic::TrackerHit >::const_iterator hits_begin() const
Definition Measurement2D.cc:80
bool operator<(const Measurement2D &other) const
Definition Measurement2D.h:128
float getTime() const
Access the Measurement time.
Definition Measurement2D.cc:75
const podio::ObjectID getObjectID() const
Definition Measurement2D.cc:151
static Measurement2D makeEmpty()
Definition Measurement2D.cc:69
friend void swap(Measurement2D &a, Measurement2D &b)
Definition Measurement2D.h:136
static constexpr std::string_view typeName
Definition Measurement2D.h:88
podio::ObjectID id() const
Definition Measurement2D.h:130
constexpr bool operator!=(const Measurement2D &other) const
Definition Measurement2D.h:124
Measurement2DCollection collection_type
Definition Measurement2D.h:56
constexpr bool operator==(const Measurement2D &other) const
Definition Measurement2D.h:121
std::vector< float >::const_iterator weights_begin() const
Definition Measurement2D.cc:112
friend class MutableMeasurement2D
Definition Measurement2D.h:48
bool operator!=(const MutableMeasurement2D &other) const
Definition Measurement2D.h:125
Definition Measurement2DObj.h:20
Definition MutableMeasurement2D.h:38
Definition TrackerHit.h:45
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::Measurement2D &obj) const
Definition Measurement2D.h:162