EDM4eic
EIC data model
Loading...
Searching...
No Matches
Vertex.h
Go to the documentation of this file.
1// AUTOMATICALLY GENERATED FILE - DO NOT EDIT
2
3#ifndef EDM4EIC_Vertex_H
4#define EDM4EIC_Vertex_H
5
6#include "edm4eic/VertexObj.h"
7
8#include "edm4eic/Cov4f.h"
10#include "edm4hep/Vector4f.h"
11#include "podio/RelationRange.h"
12#include <cstdint>
13#include <vector>
14
15#include "podio/utilities/MaybeSharedPtr.h"
16#include "podio/detail/OrderKey.h"
17
18#include <ostream>
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 podio::detail {
32// Internal function used in less comparison operators of the datatypes and interface types
33OrderKey getOrderKey(const edm4eic::Vertex& obj);
34};
35
36namespace edm4eic {
37
38class MutableVertex;
41
42/** @class Vertex
43 * EIC vertex
44 * @author: J. Osborn
45 */
46class Vertex {
47
48 friend class MutableVertex;
49 friend class VertexCollection;
52 friend podio::detail::OrderKey podio::detail::getOrderKey(const Vertex & obj);
53
54public:
57
58 /// default constructor
59 Vertex() = default;
60
61 /// Constructor initializing all members
62 Vertex(const std::int32_t type, const float chi2, const float ndf, const edm4hep::Vector4f& position, const edm4eic::Cov4f& positionError);
63
64 /// copy constructor
65 Vertex(const Vertex& other) noexcept = default;
66
67 /// move constructor
68 Vertex(Vertex&& other) noexcept = default;
69
70 /// copy-assignment operator
71 Vertex& operator=(Vertex other) &; // Rebind this to other's internal object
72 Vertex& operator=(Vertex other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
73
74 /// create a mutable deep-copy of the object with identical relations
75 /// if cloneRelations=false, the relations are not cloned and will be empty
76 MutableVertex clone(bool cloneRelations=true) const;
77
78 /// destructor
79 ~Vertex() = default;
80
81 /// converting constructor from mutable object
82 Vertex(const MutableVertex& other);
83
84 static Vertex makeEmpty();
85
86public:
87
88 static constexpr std::string_view typeName = "edm4eic::Vertex";
89
90 /// Access the Type flag, to identify what type of vertex it is (e.g. primary, secondary, generated, etc.)
91 std::int32_t getType() const;
92
93 /// Access the Chi-squared of the vertex fit
94 float getChi2() const;
95
96 /// Access the Ndf of the vertex fit, float allows for fractional numbers seen from AMVF - consistent with Acts EDM
97 float getNdf() const;
98
99 /// Access the position [mm] + time t0 [ns] of the vertex. Time is 4th component in vector
100 const edm4hep::Vector4f& getPosition() const;
101
102 /// Access the Covariance matrix of the position+time. Time is 4th component, similarly to 4vector
103 const edm4eic::Cov4f& getPositionError() const;
104
105
106
107 std::size_t associatedParticles_size() const;
109 std::vector<edm4eic::ReconstructedParticle>::const_iterator associatedParticles_begin() const;
110 std::vector<edm4eic::ReconstructedParticle>::const_iterator associatedParticles_end() const;
111 podio::RelationRange<edm4eic::ReconstructedParticle> getAssociatedParticles() const;
112
113
114 /// check whether the object is actually available
115 bool isAvailable() const;
116 /// disconnect from VertexObj instance
117 void unlink() { m_obj = podio::utils::MaybeSharedPtr<VertexObj>{nullptr}; }
118
119 constexpr bool operator==(const Vertex& other) const { return m_obj == other.m_obj; }
120 bool operator==(const MutableVertex& other) const;
121
122 constexpr bool operator!=(const Vertex& other) const { return !(*this == other); }
123 bool operator!=(const MutableVertex& other) const { return !(*this == other); }
124
125 // less comparison operator, so that objects can be e.g. stored in sets.
126 bool operator<(const Vertex& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
127
128 podio::ObjectID id() const { return getObjectID(); }
129
130 const podio::ObjectID getObjectID() const;
131
132 friend std::hash<Vertex>;
133
134 friend void swap(Vertex& a, Vertex& b) {
135 using std::swap;
136 swap(a.m_obj, b.m_obj); // swap out the internal pointers
137 }
138
139private:
140 /// constructor from existing VertexObj
141 explicit Vertex(podio::utils::MaybeSharedPtr<VertexObj> obj);
142 Vertex(VertexObj* obj);
143
144 podio::utils::MaybeSharedPtr<VertexObj> m_obj{new VertexObj{}, podio::utils::MarkOwned};
145};
146
147std::ostream& operator<<(std::ostream& o, const Vertex& value);
148
149#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
150void to_json(nlohmann::json& j, const Vertex& value);
151#endif
152
153
154} // namespace edm4eic
155
156
157
158template<>
159struct std::hash<edm4eic::Vertex> {
160 std::size_t operator()(const edm4eic::Vertex& obj) const {
161 return std::hash<edm4eic::VertexObj*>{}(obj.m_obj.get());
162 }
163};
164
165
166// This is needed to avoid triggering opening every library in LD_LIBRARY_PATH
167// until it's fixed in ROOT. See https://github.com/root-project/root/issues/18489
168// and https://github.com/AIDASoft/podio/issues/770
169#if defined(__clang__)
170 #pragma clang diagnostic push
171 #pragma clang diagnostic ignored "-Wunknown-warning-option"
172 #pragma clang diagnostic ignored "-Wdeprecated-redundant-constexpr-static-def"
173 #pragma clang diagnostic ignored "-Wdeprecated"
174constexpr std::string_view edm4eic::Vertex::typeName;
175 #pragma clang diagnostic pop
176#elif defined(__GNUC__)
177 #pragma GCC diagnostic push
178 #pragma GCC diagnostic ignored "-Wdeprecated"
179constexpr std::string_view edm4eic::Vertex::typeName;
180 #pragma GCC diagnostic pop
181#endif
182
183
184#endif
Definition Cov4f.h:19
Definition MutableVertex.h:38
Definition ReconstructedParticle.h:54
Definition VertexCollectionData.h:32
Definition VertexCollection.h:139
Definition Vertex.h:46
bool operator<(const Vertex &other) const
Definition Vertex.h:126
const edm4hep::Vector4f & getPosition() const
Access the position [mm] + time t0 [ns] of the vertex. Time is 4th component in vector.
Definition Vertex.cc:66
friend class MutableVertex
Definition Vertex.h:48
podio::ObjectID id() const
Definition Vertex.h:128
void unlink()
disconnect from VertexObj instance
Definition Vertex.h:117
bool operator!=(const MutableVertex &other) const
Definition Vertex.h:123
constexpr bool operator==(const Vertex &other) const
Definition Vertex.h:119
podio::RelationRange< edm4eic::ReconstructedParticle > getAssociatedParticles() const
Definition Vertex.cc:94
friend class VertexCollectionIterator
Definition Vertex.h:51
const edm4eic::Cov4f & getPositionError() const
Access the Covariance matrix of the position+time. Time is 4th component, similarly to 4vector.
Definition Vertex.cc:67
const podio::ObjectID getObjectID() const
Definition Vertex.cc:110
friend class VertexCollection
Definition Vertex.h:49
MutableVertex mutable_type
Definition Vertex.h:55
constexpr bool operator!=(const Vertex &other) const
Definition Vertex.h:122
float getNdf() const
Access the Ndf of the vertex fit, float allows for fractional numbers seen from AMVF - consistent wit...
Definition Vertex.cc:65
Vertex & operator=(Vertex other) &
copy-assignment operator
Definition Vertex.cc:28
friend void swap(Vertex &a, Vertex &b)
Definition Vertex.h:134
std::vector< edm4eic::ReconstructedParticle >::const_iterator associatedParticles_begin() const
Definition Vertex.cc:71
~Vertex()=default
destructor
Vertex()=default
default constructor
std::vector< edm4eic::ReconstructedParticle >::const_iterator associatedParticles_end() const
Definition Vertex.cc:77
std::size_t associatedParticles_size() const
Definition Vertex.cc:83
float getChi2() const
Access the Chi-squared of the vertex fit.
Definition Vertex.cc:64
static Vertex makeEmpty()
Definition Vertex.cc:59
VertexCollection collection_type
Definition Vertex.h:56
Vertex & operator=(Vertex other) &&=delete
Vertex(const Vertex &other) noexcept=default
copy constructor
MutableVertex clone(bool cloneRelations=true) const
Definition Vertex.cc:33
std::int32_t getType() const
Access the Type flag, to identify what type of vertex it is (e.g. primary, secondary,...
Definition Vertex.cc:63
bool isAvailable() const
check whether the object is actually available
Definition Vertex.cc:106
static constexpr std::string_view typeName
Definition Vertex.h:88
Vertex(Vertex &&other) noexcept=default
move constructor
Definition VertexObj.h:20
Definition ArrowMapper.cc:60
std::ostream & operator<<(std::ostream &o, const CalorimeterHit &value)
Definition CalorimeterHit.cc:99
Definition CalorimeterHit.h:31
OrderKey getOrderKey(const edm4eic::CalorimeterHit &obj)
Definition CalorimeterHit.cc:146
std::size_t operator()(const edm4eic::Vertex &obj) const
Definition Vertex.h:160