EDM4eic
EIC data model
Loading...
Searching...
No Matches
MutableVertex.h
Go to the documentation of this file.
1// AUTOMATICALLY GENERATED FILE - DO NOT EDIT
2
3#ifndef EDM4EIC_MutableVertex_H
4#define EDM4EIC_MutableVertex_H
5
6#include "edm4eic/VertexObj.h"
7// Make the immutable class available from its mutable version but not vice versa
8#include "edm4eic/Vertex.h"
9
10#include "edm4eic/Cov4f.h"
12#include "edm4hep/Vector4f.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 MutableVertex
35 * EIC vertex
36 * @author: J. Osborn
37 */
39
40 friend class VertexCollection;
42 friend class Vertex;
43
44public:
47
48 /// default constructor
49 MutableVertex() = default;
50
51 /// Constructor initializing all members
52 MutableVertex(const std::int32_t type, const float chi2, const float ndf, const edm4hep::Vector4f& position, const edm4eic::Cov4f& positionError);
53
54 /// copy constructor
55 MutableVertex(const MutableVertex& other) noexcept = default;
56
57 /// move constructor
58 MutableVertex(MutableVertex&& other) noexcept = default;
59
60 /// copy-assignment operator
61 MutableVertex& operator=(MutableVertex other) &; // Rebind this to other's internal object
62 MutableVertex& operator=(MutableVertex 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 MutableVertex clone(bool cloneRelations=true) const;
67
68 /// destructor
69 ~MutableVertex() = default;
70
71
72public:
73
74 /// Access the Type flag, to identify what type of vertex it is (e.g. primary, secondary, generated, etc.)
75 std::int32_t getType() const;
76
77 /// Access the Chi-squared of the vertex fit
78 float getChi2() const;
79
80 /// Access the Ndf of the vertex fit, float allows for fractional numbers seen from AMVF - consistent with Acts EDM
81 float getNdf() const;
82
83 /// Access the position [mm] + time t0 [ns] of the vertex. Time is 4th component in vector
84 const edm4hep::Vector4f& getPosition() const;
85
86 /// Access the Covariance matrix of the position+time. Time is 4th component, similarly to 4vector
87 const edm4eic::Cov4f& getPositionError() const;
88
89
90
91 /// Set the Type flag, to identify what type of vertex it is (e.g. primary, secondary, generated, etc.)
92 void setType(const std::int32_t type);
93 /// Get mutable reference to Type flag, to identify what type of vertex it is (e.g. primary, secondary, generated, etc.)
94 std::int32_t& getType();
95
96 /// Set the Chi-squared of the vertex fit
97 void setChi2(const float chi2);
98 /// Get mutable reference to Chi-squared of the vertex fit
99 float& getChi2();
100
101 /// Set the Ndf of the vertex fit, float allows for fractional numbers seen from AMVF - consistent with Acts EDM
102 void setNdf(const float ndf);
103 /// Get mutable reference to Ndf of the vertex fit, float allows for fractional numbers seen from AMVF - consistent with Acts EDM
104 float& getNdf();
105
106 /// Set the position [mm] + time t0 [ns] of the vertex. Time is 4th component in vector
107 void setPosition(const edm4hep::Vector4f& position);
108 /// Get mutable reference to position [mm] + time t0 [ns] of the vertex. Time is 4th component in vector
109 edm4hep::Vector4f& getPosition();
110
111 /// Set the Covariance matrix of the position+time. Time is 4th component, similarly to 4vector
112 void setPositionError(const edm4eic::Cov4f& positionError);
113 /// Get mutable reference to Covariance matrix of the position+time. Time is 4th component, similarly to 4vector
115
116
117
119 std::size_t associatedParticles_size() const;
121 std::vector<edm4eic::ReconstructedParticle>::const_iterator associatedParticles_begin() const;
122 std::vector<edm4eic::ReconstructedParticle>::const_iterator associatedParticles_end() const;
123 podio::RelationRange<edm4eic::ReconstructedParticle> getAssociatedParticles() const;
124
125
126
127 /// check whether the object is actually available
128 bool isAvailable() const;
129 /// disconnect from VertexObj instance
130 void unlink() { m_obj = podio::utils::MaybeSharedPtr<VertexObj>{nullptr}; }
131
132 constexpr bool operator==(const MutableVertex& other) const { return m_obj == other.m_obj; }
133 bool operator==(const Vertex& other) const;
134
135 constexpr bool operator!=(const MutableVertex& other) const { return !(*this == other); }
136 bool operator!=(const Vertex& other) const { return !(*this == other); }
137
138 // less comparison operator, so that objects can be e.g. stored in sets.
139 bool operator<(const MutableVertex& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
140
141 podio::ObjectID id() const { return getObjectID(); }
142
143 const podio::ObjectID getObjectID() const;
144
145 friend std::hash<MutableVertex>;
146
147 friend void swap(MutableVertex& a, MutableVertex& b) {
148 using std::swap;
149 swap(a.m_obj, b.m_obj); // swap out the internal pointers
150 }
151
152private:
153 /// constructor from existing VertexObj
154 explicit MutableVertex(podio::utils::MaybeSharedPtr<VertexObj> obj);
155
156 podio::utils::MaybeSharedPtr<VertexObj> m_obj{new VertexObj{}, podio::utils::MarkOwned};
157};
158
159#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
160void to_json(nlohmann::json& j, const MutableVertex& value);
161#endif
162
163
164} // namespace edm4eic
165
166
167
168template<>
169struct std::hash<edm4eic::MutableVertex> {
170 std::size_t operator()(const edm4eic::MutableVertex& obj) const {
171 return std::hash<edm4eic::VertexObj*>{}(obj.m_obj.get());
172 }
173};
174
175
176#endif
Definition Cov4f.h:19
Definition MutableVertex.h:38
void setType(const std::int32_t type)
Set the Type flag, to identify what type of vertex it is (e.g. primary, secondary,...
Definition MutableVertex.cc:51
friend class Vertex
Definition MutableVertex.h:42
MutableVertex(MutableVertex &&other) noexcept=default
move constructor
void unlink()
disconnect from VertexObj instance
Definition MutableVertex.h:130
float getNdf() const
Access the Ndf of the vertex fit, float allows for fractional numbers seen from AMVF - consistent wit...
Definition MutableVertex.cc:46
MutableVertex(const MutableVertex &other) noexcept=default
copy constructor
void setNdf(const float ndf)
Set the Ndf of the vertex fit, float allows for fractional numbers seen from AMVF - consistent with A...
Definition MutableVertex.cc:55
void addToAssociatedParticles(const edm4eic::ReconstructedParticle &)
Definition MutableVertex.cc:63
constexpr bool operator==(const MutableVertex &other) const
Definition MutableVertex.h:132
const podio::ObjectID getObjectID() const
Definition MutableVertex.cc:108
constexpr bool operator!=(const MutableVertex &other) const
Definition MutableVertex.h:135
friend class VertexMutableCollectionIterator
Definition MutableVertex.h:41
MutableVertex()=default
default constructor
void setPositionError(const edm4eic::Cov4f &positionError)
Set the Covariance matrix of the position+time. Time is 4th component, similarly to 4vector.
Definition MutableVertex.cc:59
const edm4eic::Cov4f & getPositionError() const
Access the Covariance matrix of the position+time. Time is 4th component, similarly to 4vector.
Definition MutableVertex.cc:48
bool operator<(const MutableVertex &other) const
Definition MutableVertex.h:139
friend class VertexCollection
Definition MutableVertex.h:40
std::vector< edm4eic::ReconstructedParticle >::const_iterator associatedParticles_end() const
Definition MutableVertex.cc:74
void setPosition(const edm4hep::Vector4f &position)
Set the position [mm] + time t0 [ns] of the vertex. Time is 4th component in vector.
Definition MutableVertex.cc:57
podio::ObjectID id() const
Definition MutableVertex.h:141
VertexCollection collection_type
Definition MutableVertex.h:46
void setChi2(const float chi2)
Set the Chi-squared of the vertex fit.
Definition MutableVertex.cc:53
float getChi2() const
Access the Chi-squared of the vertex fit.
Definition MutableVertex.cc:45
~MutableVertex()=default
destructor
bool operator!=(const Vertex &other) const
Definition MutableVertex.h:136
friend void swap(MutableVertex &a, MutableVertex &b)
Definition MutableVertex.h:147
const edm4hep::Vector4f & getPosition() const
Access the position [mm] + time t0 [ns] of the vertex. Time is 4th component in vector.
Definition MutableVertex.cc:47
std::size_t associatedParticles_size() const
Definition MutableVertex.cc:80
bool isAvailable() const
check whether the object is actually available
Definition MutableVertex.cc:104
std::vector< edm4eic::ReconstructedParticle >::const_iterator associatedParticles_begin() const
Definition MutableVertex.cc:68
MutableVertex & operator=(MutableVertex other) &
copy-assignment operator
Definition MutableVertex.cc:26
podio::RelationRange< edm4eic::ReconstructedParticle > getAssociatedParticles() const
Definition MutableVertex.cc:91
MutableVertex clone(bool cloneRelations=true) const
Definition MutableVertex.cc:31
MutableVertex & operator=(MutableVertex other) &&=delete
std::int32_t getType() const
Access the Type flag, to identify what type of vertex it is (e.g. primary, secondary,...
Definition MutableVertex.cc:44
Vertex object_type
Definition MutableVertex.h:45
Definition ReconstructedParticle.h:54
Definition VertexCollection.h:139
Definition Vertex.h:46
Definition VertexObj.h:20
Definition ArrowMapper.cc:63
OrderKey getOrderKey(const edm4eic::CalorimeterHit &obj)
Definition CalorimeterHit.cc:146
std::size_t operator()(const edm4eic::MutableVertex &obj) const
Definition MutableVertex.h:170