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
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) = default;
66
67 /// copy-assignment operator
68 Measurement2D& operator=(Measurement2D other) &; // Rebind this to other's internal object
69 Measurement2D& operator=(Measurement2D 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 MutableMeasurement2D clone(bool cloneRelations=true) const;
74
75 /// destructor
76 ~Measurement2D() = default;
77
78 /// converting constructor from mutable object
80
81 static Measurement2D makeEmpty();
82
83public:
84
85 static constexpr std::string_view typeName = "edm4eic::Measurement2D";
86
87 /// Access the Surface for bound coordinates (geometryID)
88 std::uint64_t getSurface() const;
89
90 /// Access the 2D location on surface
91 const edm4hep::Vector2f& getLoc() const;
92
93 /// Access the Measurement time
94 float getTime() const;
95
96 /// Access the Covariance on location and time
97 const edm4eic::Cov3f& getCovariance() const;
98
99
100
101 std::size_t hits_size() const;
102 edm4eic::TrackerHit getHits(std::size_t) const;
103 std::vector<edm4eic::TrackerHit>::const_iterator hits_begin() const;
104 std::vector<edm4eic::TrackerHit>::const_iterator hits_end() const;
105 podio::RelationRange<edm4eic::TrackerHit> getHits() const;
106 std::size_t weights_size() const;
107 float getWeights(std::size_t) const;
108 std::vector<float>::const_iterator weights_begin() const;
109 std::vector<float>::const_iterator weights_end() const;
110 podio::RelationRange<float> getWeights() const;
111
112
113 /// check whether the object is actually available
114 bool isAvailable() const;
115 /// disconnect from Measurement2DObj instance
116 void unlink() { m_obj = podio::utils::MaybeSharedPtr<Measurement2DObj>{nullptr}; }
117
118 bool operator==(const Measurement2D& other) const { return m_obj == other.m_obj; }
119 bool operator==(const MutableMeasurement2D& other) const;
120
121 bool operator!=(const Measurement2D& other) const { return !(*this == other); }
122 bool operator!=(const MutableMeasurement2D& other) const { return !(*this == other); }
123
124 // less comparison operator, so that objects can be e.g. stored in sets.
125 bool operator<(const Measurement2D& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
126
127 podio::ObjectID id() const { return getObjectID(); }
128
129 const podio::ObjectID getObjectID() const;
130
131 friend std::hash<Measurement2D>;
132
133 friend void swap(Measurement2D& a, Measurement2D& b) {
134 using std::swap;
135 swap(a.m_obj, b.m_obj); // swap out the internal pointers
136 }
137
138private:
139 /// constructor from existing Measurement2DObj
140 explicit Measurement2D(podio::utils::MaybeSharedPtr<Measurement2DObj> obj);
142
143 podio::utils::MaybeSharedPtr<Measurement2DObj> m_obj{nullptr};
144};
145
146std::ostream& operator<<(std::ostream& o, const Measurement2D& value);
147
148#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
149void to_json(nlohmann::json& j, const Measurement2D& value);
150#endif
151
152
153} // namespace edm4eic
154
155
156
157template<>
158struct std::hash<edm4eic::Measurement2D> {
159 std::size_t operator()(const edm4eic::Measurement2D& obj) const {
160 return std::hash<edm4eic::Measurement2DObj*>{}(obj.m_obj.get());
161 }
162};
163
164
165// This is needed to avoid triggering opening every library in LD_LIBRARY_PATH
166// until it's fixed in ROOT. See https://github.com/root-project/root/issues/18489
167// and https://github.com/AIDASoft/podio/issues/770
168#if defined(__clang__)
169#pragma clang diagnostic push
170#pragma clang diagnostic ignored "-Wunknown-warning-option"
171#pragma clang diagnostic ignored "-Wdeprecated-redundant-constexpr-static-def"
172#pragma clang diagnostic ignored "-Wdeprecated"
173constexpr std::string_view edm4eic::Measurement2D::typeName;
174#pragma clang diagnostic pop
175#elif defined(__GNUC__)
176#pragma GCC diagnostic push
177#pragma GCC diagnostic ignored "-Wdeprecated"
178constexpr std::string_view edm4eic::Measurement2D::typeName;
179#pragma GCC diagnostic pop
180#endif
181
182#endif
Definition Cov3f.h:18
Definition Measurement2DCollectionData.h:31
Definition Measurement2DCollection.h:137
Definition Measurement2D.h:46
std::uint64_t getSurface() const
Access the Surface for bound coordinates (geometryID)
Definition Measurement2D.cc:77
const edm4eic::Cov3f & getCovariance() const
Access the Covariance on location and time.
Definition Measurement2D.cc:80
bool isAvailable() const
check whether the object is actually available
Definition Measurement2D.cc:151
Measurement2D & operator=(Measurement2D other) &&=delete
friend class Measurement2DCollection
Definition Measurement2D.h:49
void unlink()
disconnect from Measurement2DObj instance
Definition Measurement2D.h:116
const edm4hep::Vector2f & getLoc() const
Access the 2D location on surface.
Definition Measurement2D.cc:78
std::vector< edm4eic::TrackerHit >::const_iterator hits_end() const
Definition Measurement2D.cc:90
MutableMeasurement2D clone(bool cloneRelations=true) const
Definition Measurement2D.cc:36
std::size_t weights_size() const
Definition Measurement2D.cc:128
Measurement2D(const Measurement2D &other)=default
copy constructor
std::vector< float >::const_iterator weights_end() const
Definition Measurement2D.cc:122
Measurement2D & operator=(Measurement2D other) &
copy-assignment operator
Definition Measurement2D.cc:31
podio::RelationRange< edm4eic::TrackerHit > getHits() const
Definition Measurement2D.cc:107
friend class Measurement2DCollectionIterator
Definition Measurement2D.h:51
bool operator==(const Measurement2D &other) const
Definition Measurement2D.h:118
~Measurement2D()=default
destructor
podio::RelationRange< float > getWeights() const
Definition Measurement2D.cc:139
std::size_t hits_size() const
Definition Measurement2D.cc:96
MutableMeasurement2D mutable_type
Definition Measurement2D.h:55
std::vector< edm4eic::TrackerHit >::const_iterator hits_begin() const
Definition Measurement2D.cc:84
bool operator<(const Measurement2D &other) const
Definition Measurement2D.h:125
float getTime() const
Access the Measurement time.
Definition Measurement2D.cc:79
const podio::ObjectID getObjectID() const
Definition Measurement2D.cc:155
static Measurement2D makeEmpty()
Definition Measurement2D.cc:73
Measurement2D()
default constructor
Definition Measurement2D.cc:20
friend void swap(Measurement2D &a, Measurement2D &b)
Definition Measurement2D.h:133
static constexpr std::string_view typeName
Definition Measurement2D.h:85
podio::ObjectID id() const
Definition Measurement2D.h:127
bool operator!=(const Measurement2D &other) const
Definition Measurement2D.h:121
Measurement2DCollection collection_type
Definition Measurement2D.h:56
std::vector< float >::const_iterator weights_begin() const
Definition Measurement2D.cc:116
friend class MutableMeasurement2D
Definition Measurement2D.h:48
bool operator!=(const MutableMeasurement2D &other) const
Definition Measurement2D.h:122
Definition Measurement2DObj.h:20
Definition MutableMeasurement2D.h:38
Definition TrackerHit.h:45
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::Measurement2D &obj) const
Definition Measurement2D.h:159