EDM4eic
EIC data model
Loading...
Searching...
No Matches
MutableMeasurement2D.h
Go to the documentation of this file.
1// AUTOMATICALLY GENERATED FILE - DO NOT EDIT
2
3#ifndef EDM4EIC_MutableMeasurement2D_H
4#define EDM4EIC_MutableMeasurement2D_H
5
7// Make the immutable class available from its mutable version but not vice versa
9
10#include "edm4eic/Cov3f.h"
11#include "edm4eic/TrackerHit.h"
12#include "edm4hep/Vector2f.h"
13#include "podio/RelationRange.h"
14#include <cstdint>
15#include <vector>
16
17#include "podio/utilities/MaybeSharedPtr.h"
18
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 edm4eic {
32
33
34/** @class MutableMeasurement2D
35 * 2D measurement (on an arbitrary surface)
36 * @author: W. Deconinck
37 */
39
42 friend class Measurement2D;
43
44public:
47
48 /// default constructor
50
51 /// Constructor initializing all members
52 MutableMeasurement2D(const std::uint64_t surface, const edm4hep::Vector2f& loc, const float time, const edm4eic::Cov3f& covariance);
53
54 /// copy constructor
56
57 /// copy-assignment operator
58 MutableMeasurement2D& operator=(MutableMeasurement2D other) &; // Rebind this to other's internal object
59 MutableMeasurement2D& operator=(MutableMeasurement2D other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
60
61 /// create a mutable deep-copy of the object with identical relations
62 /// if cloneRelations=false, the relations are not cloned and will be empty
63 MutableMeasurement2D clone(bool cloneRelations=true) const;
64
65 /// destructor
67
68
69public:
70
71 /// Access the Surface for bound coordinates (geometryID)
72 std::uint64_t getSurface() const;
73
74 /// Access the 2D location on surface
75 const edm4hep::Vector2f& getLoc() const;
76
77 /// Access the Measurement time
78 float getTime() const;
79
80 /// Access the Covariance on location and time
81 const edm4eic::Cov3f& getCovariance() const;
82
83
84
85 /// Set the Surface for bound coordinates (geometryID)
86 void setSurface(const std::uint64_t surface);
87 /// Get mutable reference to Surface for bound coordinates (geometryID)
88 std::uint64_t& getSurface();
89 /// Get reference to Surface for bound coordinates (geometryID)
90 [[deprecated("use getSurface instead")]]
91 std::uint64_t& surface();
92
93 /// Set the 2D location on surface
94 void setLoc(const edm4hep::Vector2f& loc);
95 /// Get mutable reference to 2D location on surface
96 edm4hep::Vector2f& getLoc();
97 /// Get reference to 2D location on surface
98 [[deprecated("use getLoc instead")]]
99 edm4hep::Vector2f& loc();
100
101 /// Set the Measurement time
102 void setTime(const float time);
103 /// Get mutable reference to Measurement time
104 float& getTime();
105 /// Get reference to Measurement time
106 [[deprecated("use getTime instead")]]
107 float& time();
108
109 /// Set the Covariance on location and time
111 /// Get mutable reference to Covariance on location and time
113 /// Get reference to Covariance on location and time
114 [[deprecated("use getCovariance instead")]]
116
117
118
119 void addToHits(const edm4eic::TrackerHit&);
120 std::size_t hits_size() const;
121 edm4eic::TrackerHit getHits(std::size_t) const;
122 std::vector<edm4eic::TrackerHit>::const_iterator hits_begin() const;
123 std::vector<edm4eic::TrackerHit>::const_iterator hits_end() const;
124 podio::RelationRange<edm4eic::TrackerHit> getHits() const;
125 void addToWeights(const float&);
126 std::size_t weights_size() const;
127 float getWeights(std::size_t) const;
128 std::vector<float>::const_iterator weights_begin() const;
129 std::vector<float>::const_iterator weights_end() const;
130 podio::RelationRange<float> getWeights() const;
131
132
133
134 /// check whether the object is actually available
135 bool isAvailable() const;
136 /// disconnect from Measurement2DObj instance
137 void unlink() { m_obj = podio::utils::MaybeSharedPtr<Measurement2DObj>{nullptr}; }
138
139 bool operator==(const MutableMeasurement2D& other) const { return m_obj == other.m_obj; }
140 bool operator==(const Measurement2D& other) const;
141
142 bool operator!=(const MutableMeasurement2D& other) const { return !(*this == other); }
143 bool operator!=(const Measurement2D& other) const { return !(*this == other); }
144
145 // less comparison operator, so that objects can be e.g. stored in sets.
146 bool operator<(const MutableMeasurement2D& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
147
148 podio::ObjectID id() const { return getObjectID(); }
149
150 const podio::ObjectID getObjectID() const;
151
152 friend std::hash<MutableMeasurement2D>;
153
155 using std::swap;
156 swap(a.m_obj, b.m_obj); // swap out the internal pointers
157 }
158
159private:
160 /// constructor from existing Measurement2DObj
161 explicit MutableMeasurement2D(podio::utils::MaybeSharedPtr<Measurement2DObj> obj);
162
163 podio::utils::MaybeSharedPtr<Measurement2DObj> m_obj{nullptr};
164};
165
166#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
167void to_json(nlohmann::json& j, const MutableMeasurement2D& value);
168#endif
169
170
171} // namespace edm4eic
172
173
174
175template<>
176struct std::hash<edm4eic::MutableMeasurement2D> {
177 std::size_t operator()(const edm4eic::MutableMeasurement2D& obj) const {
178 return std::hash<edm4eic::Measurement2DObj*>{}(obj.m_obj.get());
179 }
180};
181
182
183#endif
Definition Cov3f.h:18
Definition Measurement2DCollection.h:137
Definition Measurement2D.h:46
Definition MutableMeasurement2D.h:38
Measurement2D object_type
Definition MutableMeasurement2D.h:45
Measurement2DCollection collection_type
Definition MutableMeasurement2D.h:46
void setCovariance(const edm4eic::Cov3f &covariance)
Set the Covariance on location and time.
Definition MutableMeasurement2D.cc:65
std::size_t weights_size() const
Definition MutableMeasurement2D.cc:123
void addToHits(const edm4eic::TrackerHit &)
Definition MutableMeasurement2D.cc:70
friend class Measurement2D
Definition MutableMeasurement2D.h:42
void setSurface(const std::uint64_t surface)
Set the Surface for bound coordinates (geometryID)
Definition MutableMeasurement2D.cc:56
void setLoc(const edm4hep::Vector2f &loc)
Set the 2D location on surface.
Definition MutableMeasurement2D.cc:59
friend class Measurement2DCollection
Definition MutableMeasurement2D.h:40
MutableMeasurement2D()
default constructor
Definition MutableMeasurement2D.cc:18
bool operator!=(const Measurement2D &other) const
Definition MutableMeasurement2D.h:143
friend void swap(MutableMeasurement2D &a, MutableMeasurement2D &b)
Definition MutableMeasurement2D.h:154
float & time()
Get reference to Measurement time.
Definition MutableMeasurement2D.cc:64
std::vector< edm4eic::TrackerHit >::const_iterator hits_begin() const
Definition MutableMeasurement2D.cc:75
friend class Measurement2DMutableCollectionIterator
Definition MutableMeasurement2D.h:41
bool operator!=(const MutableMeasurement2D &other) const
Definition MutableMeasurement2D.h:142
edm4eic::Cov3f & covariance()
Get reference to Covariance on location and time.
Definition MutableMeasurement2D.cc:67
std::vector< edm4eic::TrackerHit >::const_iterator hits_end() const
Definition MutableMeasurement2D.cc:81
MutableMeasurement2D(const MutableMeasurement2D &other)=default
copy constructor
edm4hep::Vector2f & loc()
Get reference to 2D location on surface.
Definition MutableMeasurement2D.cc:61
bool isAvailable() const
check whether the object is actually available
Definition MutableMeasurement2D.cc:147
podio::RelationRange< edm4eic::TrackerHit > getHits() const
Definition MutableMeasurement2D.cc:98
bool operator<(const MutableMeasurement2D &other) const
Definition MutableMeasurement2D.h:146
podio::RelationRange< float > getWeights() const
Definition MutableMeasurement2D.cc:134
std::vector< float >::const_iterator weights_begin() const
Definition MutableMeasurement2D.cc:111
const podio::ObjectID getObjectID() const
Definition MutableMeasurement2D.cc:151
const edm4hep::Vector2f & getLoc() const
Access the 2D location on surface.
Definition MutableMeasurement2D.cc:51
std::uint64_t getSurface() const
Access the Surface for bound coordinates (geometryID)
Definition MutableMeasurement2D.cc:50
void addToWeights(const float &)
Definition MutableMeasurement2D.cc:106
void unlink()
disconnect from Measurement2DObj instance
Definition MutableMeasurement2D.h:137
podio::ObjectID id() const
Definition MutableMeasurement2D.h:148
std::uint64_t & surface()
Get reference to Surface for bound coordinates (geometryID)
Definition MutableMeasurement2D.cc:58
const edm4eic::Cov3f & getCovariance() const
Access the Covariance on location and time.
Definition MutableMeasurement2D.cc:53
MutableMeasurement2D clone(bool cloneRelations=true) const
Definition MutableMeasurement2D.cc:34
bool operator==(const MutableMeasurement2D &other) const
Definition MutableMeasurement2D.h:139
std::vector< float >::const_iterator weights_end() const
Definition MutableMeasurement2D.cc:117
~MutableMeasurement2D()=default
destructor
float getTime() const
Access the Measurement time.
Definition MutableMeasurement2D.cc:52
std::size_t hits_size() const
Definition MutableMeasurement2D.cc:87
MutableMeasurement2D & operator=(MutableMeasurement2D other) &
copy-assignment operator
Definition MutableMeasurement2D.cc:29
void setTime(const float time)
Set the Measurement time.
Definition MutableMeasurement2D.cc:62
MutableMeasurement2D & operator=(MutableMeasurement2D other) &&=delete
Definition TrackerHit.h:45
Definition CalorimeterHit.cc:17
OrderKey getOrderKey(const edm4eic::CalorimeterHit &obj)
Definition CalorimeterHit.cc:150
std::size_t operator()(const edm4eic::MutableMeasurement2D &obj) const
Definition MutableMeasurement2D.h:177