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
90 /// Set the 2D location on surface
91 void setLoc(const edm4hep::Vector2f& loc);
92 /// Get mutable reference to 2D location on surface
93 edm4hep::Vector2f& getLoc();
94
95 /// Set the Measurement time
96 void setTime(const float time);
97 /// Get mutable reference to Measurement time
98 float& getTime();
99
100 /// Set the Covariance on location and time
101 void setCovariance(const edm4eic::Cov3f& covariance);
102 /// Get mutable reference to Covariance on location and time
104
105
106
107 void addToHits(const edm4eic::TrackerHit&);
108 std::size_t hits_size() const;
109 edm4eic::TrackerHit getHits(std::size_t) const;
110 std::vector<edm4eic::TrackerHit>::const_iterator hits_begin() const;
111 std::vector<edm4eic::TrackerHit>::const_iterator hits_end() const;
112 podio::RelationRange<edm4eic::TrackerHit> getHits() const;
113 void addToWeights(const float&);
114 std::size_t weights_size() const;
115 float getWeights(std::size_t) const;
116 std::vector<float>::const_iterator weights_begin() const;
117 std::vector<float>::const_iterator weights_end() const;
118 podio::RelationRange<float> getWeights() const;
119
120
121
122 /// check whether the object is actually available
123 bool isAvailable() const;
124 /// disconnect from Measurement2DObj instance
125 void unlink() { m_obj = podio::utils::MaybeSharedPtr<Measurement2DObj>{nullptr}; }
126
127 constexpr bool operator==(const MutableMeasurement2D& other) const { return m_obj == other.m_obj; }
128 bool operator==(const Measurement2D& other) const;
129
130 constexpr bool operator!=(const MutableMeasurement2D& other) const { return !(*this == other); }
131 bool operator!=(const Measurement2D& other) const { return !(*this == other); }
132
133 // less comparison operator, so that objects can be e.g. stored in sets.
134 bool operator<(const MutableMeasurement2D& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
135
136 podio::ObjectID id() const { return getObjectID(); }
137
138 const podio::ObjectID getObjectID() const;
139
140 friend std::hash<MutableMeasurement2D>;
141
143 using std::swap;
144 swap(a.m_obj, b.m_obj); // swap out the internal pointers
145 }
146
147private:
148 /// constructor from existing Measurement2DObj
149 explicit MutableMeasurement2D(podio::utils::MaybeSharedPtr<Measurement2DObj> obj);
150
151 podio::utils::MaybeSharedPtr<Measurement2DObj> m_obj{new Measurement2DObj{}, podio::utils::MarkOwned};
152};
153
154#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
155void to_json(nlohmann::json& j, const MutableMeasurement2D& value);
156#endif
157
158
159} // namespace edm4eic
160
161
162
163template<>
164struct std::hash<edm4eic::MutableMeasurement2D> {
165 std::size_t operator()(const edm4eic::MutableMeasurement2D& obj) const {
166 return std::hash<edm4eic::Measurement2DObj*>{}(obj.m_obj.get());
167 }
168};
169
170
171#endif
Definition Cov3f.h:19
Definition Measurement2DCollection.h:139
Definition Measurement2D.h:46
Definition Measurement2DObj.h:20
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: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
friend class Measurement2DCollection
Definition MutableMeasurement2D.h:40
bool operator!=(const Measurement2D &other) const
Definition MutableMeasurement2D.h:131
friend void swap(MutableMeasurement2D &a, MutableMeasurement2D &b)
Definition MutableMeasurement2D.h:142
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:130
std::vector< edm4eic::TrackerHit >::const_iterator hits_end() const
Definition MutableMeasurement2D.cc:73
MutableMeasurement2D(const MutableMeasurement2D &other)=default
copy constructor
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:134
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:125
podio::ObjectID id() const
Definition MutableMeasurement2D.h:136
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:127
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:61
OrderKey getOrderKey(const edm4eic::CalorimeterHit &obj)
Definition CalorimeterHit.cc:146
std::size_t operator()(const edm4eic::MutableMeasurement2D &obj) const
Definition MutableMeasurement2D.h:165