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 {
27class Measurement2DCollection;
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(std::uint64_t surface, edm4hep::Vector2f loc, float time, edm4eic::Cov3f covariance);
53
54 /// copy constructor
56
57 /// copy-assignment operator
59
60 /// create a mutable deep-copy of the object with identical relations
61 /// if cloneRelations=false, the relations are not cloned and will be empty
62 MutableMeasurement2D clone(bool cloneRelations=true) const;
63
64 /// destructor
66
67
68public:
69
70 /// Access the Surface for bound coordinates (geometryID)
71 std::uint64_t getSurface() const;
72
73 /// Access the 2D location on surface
74 const edm4hep::Vector2f& getLoc() const;
75
76 /// Access the Measurement time
77 float getTime() const;
78
79 /// Access the Covariance on location and time
80 const edm4eic::Cov3f& getCovariance() const;
81
82
83
84 /// Set the Surface for bound coordinates (geometryID)
85 void setSurface(std::uint64_t value);
86 /// Get mutable reference to Surface for bound coordinates (geometryID)
87 std::uint64_t& getSurface();
88 /// Get reference to Surface for bound coordinates (geometryID)
89 [[deprecated("use getSurface instead")]]
90 std::uint64_t& surface();
91
92 /// Set the 2D location on surface
93 void setLoc(edm4hep::Vector2f value);
94 /// Get mutable reference to 2D location on surface
95 edm4hep::Vector2f& getLoc();
96 /// Get reference to 2D location on surface
97 [[deprecated("use getLoc instead")]]
98 edm4hep::Vector2f& loc();
99
100 /// Set the Measurement time
101 void setTime(float value);
102 /// Get mutable reference to Measurement time
103 float& getTime();
104 /// Get reference to Measurement time
105 [[deprecated("use getTime instead")]]
106 float& time();
107
108 /// Set the Covariance on location and time
109 void setCovariance(edm4eic::Cov3f value);
110 /// Get mutable reference to Covariance on location and time
112 /// Get reference to Covariance on location and time
113 [[deprecated("use getCovariance instead")]]
115
116
117
118 void addToHits(const edm4eic::TrackerHit&);
119 std::size_t hits_size() const;
120 edm4eic::TrackerHit getHits(std::size_t) const;
121 std::vector<edm4eic::TrackerHit>::const_iterator hits_begin() const;
122 std::vector<edm4eic::TrackerHit>::const_iterator hits_end() const;
123 podio::RelationRange<edm4eic::TrackerHit> getHits() const;
124 void addToWeights(const float&);
125 std::size_t weights_size() const;
126 float getWeights(std::size_t) const;
127 std::vector<float>::const_iterator weights_begin() const;
128 std::vector<float>::const_iterator weights_end() const;
129 podio::RelationRange<float> getWeights() const;
130
131
132
133 /// check whether the object is actually available
134 bool isAvailable() const;
135 /// disconnect from Measurement2DObj instance
136 void unlink() { m_obj = podio::utils::MaybeSharedPtr<Measurement2DObj>{nullptr}; }
137
138 bool operator==(const MutableMeasurement2D& other) const { return m_obj == other.m_obj; }
139 bool operator==(const Measurement2D& other) const;
140
141 bool operator!=(const MutableMeasurement2D& other) const { return !(*this == other); }
142 bool operator!=(const Measurement2D& other) const { return !(*this == other); }
143
144 // less comparison operator, so that objects can be e.g. stored in sets.
145 bool operator<(const MutableMeasurement2D& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
146
147 podio::ObjectID id() const { return getObjectID(); }
148
149 const podio::ObjectID getObjectID() const;
150
152 using std::swap;
153 swap(a.m_obj, b.m_obj); // swap out the internal pointers
154 }
155
156private:
157 /// constructor from existing Measurement2DObj
158 explicit MutableMeasurement2D(podio::utils::MaybeSharedPtr<Measurement2DObj> obj);
159
160 podio::utils::MaybeSharedPtr<Measurement2DObj> m_obj{nullptr};
161};
162
163#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
164void to_json(nlohmann::json& j, const MutableMeasurement2D& value);
165#endif
166
167
168} // namespace edm4eic
169
170
171#endif
Definition Cov3f.h:18
Definition Measurement2DCollection.h:91
Definition Measurement2D.h:46
Definition Measurement2DCollection.h:62
Definition MutableMeasurement2D.h:38
std::size_t weights_size() const
Definition MutableMeasurement2D.cc:123
void setCovariance(edm4eic::Cov3f value)
Set the Covariance on location and time.
Definition MutableMeasurement2D.cc:65
void addToHits(const edm4eic::TrackerHit &)
Definition MutableMeasurement2D.cc:70
friend class Measurement2D
Definition MutableMeasurement2D.h:42
MutableMeasurement2D & operator=(MutableMeasurement2D other)
copy-assignment operator
Definition MutableMeasurement2D.cc:29
friend class Measurement2DCollection
Definition MutableMeasurement2D.h:40
MutableMeasurement2D()
default constructor
Definition MutableMeasurement2D.cc:18
bool operator!=(const Measurement2D &other) const
Definition MutableMeasurement2D.h:142
friend void swap(MutableMeasurement2D &a, MutableMeasurement2D &b)
Definition MutableMeasurement2D.h:151
float & time()
Get reference to Measurement time.
Definition MutableMeasurement2D.cc:64
std::vector< edm4eic::TrackerHit >::const_iterator hits_begin() const
Definition MutableMeasurement2D.cc:75
bool operator!=(const MutableMeasurement2D &other) const
Definition MutableMeasurement2D.h:141
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
void setLoc(edm4hep::Vector2f value)
Set the 2D location on surface.
Definition MutableMeasurement2D.cc:59
podio::RelationRange< edm4eic::TrackerHit > getHits() const
Definition MutableMeasurement2D.cc:98
bool operator<(const MutableMeasurement2D &other) const
Definition MutableMeasurement2D.h:145
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:136
podio::ObjectID id() const
Definition MutableMeasurement2D.h:147
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
void setSurface(std::uint64_t value)
Set the Surface for bound coordinates (geometryID)
Definition MutableMeasurement2D.cc:56
bool operator==(const MutableMeasurement2D &other) const
Definition MutableMeasurement2D.h:138
std::vector< float >::const_iterator weights_end() const
Definition MutableMeasurement2D.cc:117
void setTime(float value)
Set the Measurement time.
Definition MutableMeasurement2D.cc:62
~MutableMeasurement2D()=default
destructor
float getTime() const
Access the Measurement time.
Definition MutableMeasurement2D.cc:52
std::size_t hits_size() const
Definition MutableMeasurement2D.cc:87
Definition TrackerHit.h:45
Definition CalorimeterHit.cc:17
OrderKey getOrderKey(const edm4eic::CalorimeterHit &obj)
Definition CalorimeterHit.cc:150