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