EDM4eic
EIC data model
All Classes Namespaces Files Functions Variables Typedefs Friends Pages
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 {
27class VertexCollection;
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
50
51 /// Constructor initializing all members
52 MutableVertex(std::int32_t type, float chi2, int ndf, edm4hep::Vector4f position, edm4eic::Cov4f positionError);
53
54 /// copy constructor
55 MutableVertex(const MutableVertex& other) = default;
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 MutableVertex clone(bool cloneRelations=true) const;
63
64 /// destructor
65 ~MutableVertex() = default;
66
67
68public:
69
70 /// Access the Type flag, to identify what type of vertex it is (e.g. primary, secondary, generated, etc.)
71 std::int32_t getType() const;
72
73 /// Access the Chi-squared of the vertex fit
74 float getChi2() const;
75
76 /// Access the NDF of the vertex fit
77 int getNdf() const;
78
79 /// Access the position [mm] + time t0 [ns] of the vertex. Time is 4th component in vector
80 const edm4hep::Vector4f& getPosition() const;
81
82 /// Access the Covariance matrix of the position+time. Time is 4th component, similarly to 4vector
83 const edm4eic::Cov4f& getPositionError() const;
84
85
86
87 /// Set the Type flag, to identify what type of vertex it is (e.g. primary, secondary, generated, etc.)
88 void setType(std::int32_t value);
89 /// Get mutable reference to Type flag, to identify what type of vertex it is (e.g. primary, secondary, generated, etc.)
90 std::int32_t& getType();
91 /// Get reference to Type flag, to identify what type of vertex it is (e.g. primary, secondary, generated, etc.)
92 [[deprecated("use getType instead")]]
93 std::int32_t& type();
94
95 /// Set the Chi-squared of the vertex fit
96 void setChi2(float value);
97 /// Get mutable reference to Chi-squared of the vertex fit
98 float& getChi2();
99 /// Get reference to Chi-squared of the vertex fit
100 [[deprecated("use getChi2 instead")]]
101 float& chi2();
102
103 /// Set the NDF of the vertex fit
104 void setNdf(int value);
105 /// Get mutable reference to NDF of the vertex fit
106 int& getNdf();
107 /// Get reference to NDF of the vertex fit
108 [[deprecated("use getNdf instead")]]
109 int& ndf();
110
111 /// Set the position [mm] + time t0 [ns] of the vertex. Time is 4th component in vector
112 void setPosition(edm4hep::Vector4f value);
113 /// Get mutable reference to position [mm] + time t0 [ns] of the vertex. Time is 4th component in vector
114 edm4hep::Vector4f& getPosition();
115 /// Get reference to position [mm] + time t0 [ns] of the vertex. Time is 4th component in vector
116 [[deprecated("use getPosition instead")]]
117 edm4hep::Vector4f& position();
118
119 /// Set the Covariance matrix of the position+time. Time is 4th component, similarly to 4vector
121 /// Get mutable reference to Covariance matrix of the position+time. Time is 4th component, similarly to 4vector
123 /// Get reference to Covariance matrix of the position+time. Time is 4th component, similarly to 4vector
124 [[deprecated("use getPositionError instead")]]
126
127
128
130 std::size_t associatedParticles_size() const;
132 std::vector<edm4eic::ReconstructedParticle>::const_iterator associatedParticles_begin() const;
133 std::vector<edm4eic::ReconstructedParticle>::const_iterator associatedParticles_end() const;
134 podio::RelationRange<edm4eic::ReconstructedParticle> getAssociatedParticles() const;
135
136
137
138 /// check whether the object is actually available
139 bool isAvailable() const;
140 /// disconnect from VertexObj instance
141 void unlink() { m_obj = podio::utils::MaybeSharedPtr<VertexObj>{nullptr}; }
142
143 bool operator==(const MutableVertex& other) const { return m_obj == other.m_obj; }
144 bool operator==(const Vertex& other) const;
145
146 bool operator!=(const MutableVertex& other) const { return !(*this == other); }
147 bool operator!=(const Vertex& other) const { return !(*this == other); }
148
149 // less comparison operator, so that objects can be e.g. stored in sets.
150 bool operator<(const MutableVertex& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
151
152 podio::ObjectID id() const { return getObjectID(); }
153
154 const podio::ObjectID getObjectID() const;
155
156 friend void swap(MutableVertex& a, MutableVertex& b) {
157 using std::swap;
158 swap(a.m_obj, b.m_obj); // swap out the internal pointers
159 }
160
161private:
162 /// constructor from existing VertexObj
163 explicit MutableVertex(podio::utils::MaybeSharedPtr<VertexObj> obj);
164
165 podio::utils::MaybeSharedPtr<VertexObj> m_obj{nullptr};
166};
167
168#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
169void to_json(nlohmann::json& j, const MutableVertex& value);
170#endif
171
172
173} // namespace edm4eic
174
175
176#endif
Definition Cov4f.h:18
Definition MutableVertex.h:38
friend class Vertex
Definition MutableVertex.h:42
int & ndf()
Get reference to NDF of the vertex fit.
Definition MutableVertex.cc:63
void unlink()
disconnect from VertexObj instance
Definition MutableVertex.h:141
float & chi2()
Get reference to Chi-squared of the vertex fit.
Definition MutableVertex.cc:60
void setPosition(edm4hep::Vector4f value)
Set the position [mm] + time t0 [ns] of the vertex. Time is 4th component in vector.
Definition MutableVertex.cc:64
MutableVertex & operator=(MutableVertex other)
copy-assignment operator
Definition MutableVertex.cc:30
void addToAssociatedParticles(const edm4eic::ReconstructedParticle &)
Definition MutableVertex.cc:72
bool operator!=(const MutableVertex &other) const
Definition MutableVertex.h:146
const podio::ObjectID getObjectID() const
Definition MutableVertex.cc:117
const edm4eic::Cov4f & getPositionError() const
Access the Covariance matrix of the position+time. Time is 4th component, similarly to 4vector.
Definition MutableVertex.cc:52
bool operator<(const MutableVertex &other) const
Definition MutableVertex.h:150
edm4eic::Cov4f & positionError()
Get reference to Covariance matrix of the position+time. Time is 4th component, similarly to 4vector.
Definition MutableVertex.cc:69
friend class VertexCollection
Definition MutableVertex.h:40
std::vector< edm4eic::ReconstructedParticle >::const_iterator associatedParticles_end() const
Definition MutableVertex.cc:83
edm4hep::Vector4f & position()
Get reference to position [mm] + time t0 [ns] of the vertex. Time is 4th component in vector.
Definition MutableVertex.cc:66
podio::ObjectID id() const
Definition MutableVertex.h:152
float getChi2() const
Access the Chi-squared of the vertex fit.
Definition MutableVertex.cc:49
int getNdf() const
Access the NDF of the vertex fit.
Definition MutableVertex.cc:50
~MutableVertex()=default
destructor
MutableVertex(const MutableVertex &other)=default
copy constructor
bool operator!=(const Vertex &other) const
Definition MutableVertex.h:147
friend void swap(MutableVertex &a, MutableVertex &b)
Definition MutableVertex.h:156
const edm4hep::Vector4f & getPosition() const
Access the position [mm] + time t0 [ns] of the vertex. Time is 4th component in vector.
Definition MutableVertex.cc:51
std::size_t associatedParticles_size() const
Definition MutableVertex.cc:89
bool isAvailable() const
check whether the object is actually available
Definition MutableVertex.cc:113
std::vector< edm4eic::ReconstructedParticle >::const_iterator associatedParticles_begin() const
Definition MutableVertex.cc:77
void setChi2(float value)
Set the Chi-squared of the vertex fit.
Definition MutableVertex.cc:58
void setNdf(int value)
Set the NDF of the vertex fit.
Definition MutableVertex.cc:61
bool operator==(const MutableVertex &other) const
Definition MutableVertex.h:143
void setPositionError(edm4eic::Cov4f value)
Set the Covariance matrix of the position+time. Time is 4th component, similarly to 4vector.
Definition MutableVertex.cc:67
std::int32_t & type()
Get reference to Type flag, to identify what type of vertex it is (e.g. primary, secondary,...
Definition MutableVertex.cc:57
podio::RelationRange< edm4eic::ReconstructedParticle > getAssociatedParticles() const
Definition MutableVertex.cc:100
MutableVertex()
default constructor
Definition MutableVertex.cc:18
MutableVertex clone(bool cloneRelations=true) const
Definition MutableVertex.cc:35
void setType(std::int32_t value)
Set the Type flag, to identify what type of vertex it is (e.g. primary, secondary,...
Definition MutableVertex.cc:55
std::int32_t getType() const
Access the Type flag, to identify what type of vertex it is (e.g. primary, secondary,...
Definition MutableVertex.cc:48
Definition ReconstructedParticle.h:54
Definition VertexCollection.h:91
Definition Vertex.h:46
Definition VertexCollection.h:62
Definition CalorimeterHit.cc:17
OrderKey getOrderKey(const edm4eic::CalorimeterHit &obj)
Definition CalorimeterHit.cc:150