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