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