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 {
27class VertexCollection;
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;
39class VertexCollection;
40class VertexCollectionData;
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(std::int32_t type, float chi2, int ndf, edm4hep::Vector4f position, edm4eic::Cov4f positionError);
63
64 /// copy constructor
65 Vertex(const Vertex& other) = default;
66
67 /// copy-assignment operator
68 Vertex& operator=(Vertex other);
69
70 /// create a mutable deep-copy of the object with identical relations
71 /// if cloneRelations=false, the relations are not cloned and will be empty
72 MutableVertex clone(bool cloneRelations=true) const;
73
74 /// destructor
75 ~Vertex() = default;
76
77 /// converting constructor from mutable object
78 Vertex(const MutableVertex& other);
79
80 static Vertex makeEmpty();
81
82public:
83
84 static constexpr auto typeName = "edm4eic::Vertex";
85
86 /// Access the Type flag, to identify what type of vertex it is (e.g. primary, secondary, generated, etc.)
87 std::int32_t getType() const;
88
89 /// Access the Chi-squared of the vertex fit
90 float getChi2() const;
91
92 /// Access the NDF of the vertex fit
93 int getNdf() const;
94
95 /// Access the position [mm] + time t0 [ns] of the vertex. Time is 4th component in vector
96 const edm4hep::Vector4f& getPosition() const;
97
98 /// Access the Covariance matrix of the position+time. Time is 4th component, similarly to 4vector
99 const edm4eic::Cov4f& getPositionError() const;
100
101
102
103 std::size_t associatedParticles_size() const;
105 std::vector<edm4eic::ReconstructedParticle>::const_iterator associatedParticles_begin() const;
106 std::vector<edm4eic::ReconstructedParticle>::const_iterator associatedParticles_end() const;
107 podio::RelationRange<edm4eic::ReconstructedParticle> getAssociatedParticles() const;
108
109
110 /// check whether the object is actually available
111 bool isAvailable() const;
112 /// disconnect from VertexObj instance
113 void unlink() { m_obj = podio::utils::MaybeSharedPtr<VertexObj>{nullptr}; }
114
115 bool operator==(const Vertex& other) const { return m_obj == other.m_obj; }
116 bool operator==(const MutableVertex& other) const;
117
118 bool operator!=(const Vertex& other) const { return !(*this == other); }
119 bool operator!=(const MutableVertex& other) const { return !(*this == other); }
120
121 // less comparison operator, so that objects can be e.g. stored in sets.
122 bool operator<(const Vertex& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
123
124 podio::ObjectID id() const { return getObjectID(); }
125
126 const podio::ObjectID getObjectID() const;
127
128 friend void swap(Vertex& a, Vertex& b) {
129 using std::swap;
130 swap(a.m_obj, b.m_obj); // swap out the internal pointers
131 }
132
133private:
134 /// constructor from existing VertexObj
135 explicit Vertex(podio::utils::MaybeSharedPtr<VertexObj> obj);
136 Vertex(VertexObj* obj);
137
138 podio::utils::MaybeSharedPtr<VertexObj> m_obj{nullptr};
139};
140
141std::ostream& operator<<(std::ostream& o, const Vertex& value);
142
143#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
144void to_json(nlohmann::json& j, const Vertex& value);
145#endif
146
147
148} // namespace edm4eic
149
150
151#endif
Definition Cov4f.h:18
Definition MutableVertex.h:38
Definition ReconstructedParticle.h:54
Definition VertexCollectionData.h:31
Definition VertexCollection.h:91
Definition VertexCollection.h:36
Definition Vertex.h:46
bool operator<(const Vertex &other) const
Definition Vertex.h:122
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:124
void unlink()
disconnect from VertexObj instance
Definition Vertex.h:113
bool operator!=(const MutableVertex &other) const
Definition Vertex.h:119
podio::RelationRange< edm4eic::ReconstructedParticle > getAssociatedParticles() const
Definition Vertex.cc:98
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
friend void swap(Vertex &a, Vertex &b)
Definition Vertex.h:128
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
static constexpr auto typeName
Definition Vertex.h:84
bool operator!=(const Vertex &other) const
Definition Vertex.h:118
static Vertex makeEmpty()
Definition Vertex.cc:63
Vertex(const Vertex &other)=default
copy constructor
Vertex & operator=(Vertex other)
copy-assignment operator
Definition Vertex.cc:32
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
bool operator==(const Vertex &other) const
Definition Vertex.h:115
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