File indexing completed on 2025-01-18 09:55:40
0001
0002
0003 #ifndef EDM4HEP_Vertex_H
0004 #define EDM4HEP_Vertex_H
0005
0006 #include "edm4hep/VertexObj.h"
0007
0008 #include "edm4hep/Vector3f.h"
0009 #include "podio/RelationRange.h"
0010 #include <array>
0011 #include <cstdint>
0012 #include <vector>
0013
0014 #include "podio/utilities/MaybeSharedPtr.h"
0015
0016 #include <cstdint>
0017 #include <ostream>
0018
0019 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0020 #include "nlohmann/json_fwd.hpp"
0021 #endif
0022
0023
0024 namespace edm4hep {
0025 class ReconstructedParticle;
0026 class MutableReconstructedParticle;
0027 }
0028
0029 namespace edm4hep {
0030
0031 class MutableVertex;
0032 class VertexCollection;
0033 class VertexCollectionData;
0034
0035
0036
0037
0038
0039 class Vertex {
0040
0041 friend class MutableVertex;
0042 friend class VertexCollection;
0043 friend class edm4hep::VertexCollectionData;
0044 friend class VertexCollectionIterator;
0045
0046 public:
0047 using mutable_type = MutableVertex;
0048 using collection_type = VertexCollection;
0049
0050
0051 Vertex();
0052
0053
0054 Vertex(std::int32_t primary, float chi2, float probability, edm4hep::Vector3f position,
0055 std::array<float, 6> covMatrix, std::int32_t algorithmType);
0056
0057
0058 Vertex(const Vertex& other) = default;
0059
0060
0061 Vertex& operator=(Vertex other);
0062
0063
0064
0065 MutableVertex clone(bool cloneRelations = true) const;
0066
0067
0068 ~Vertex() = default;
0069
0070
0071 Vertex(const MutableVertex& other);
0072
0073 static Vertex makeEmpty();
0074
0075 public:
0076
0077 std::int32_t getPrimary() const;
0078
0079
0080 float getChi2() const;
0081
0082
0083 float getProbability() const;
0084
0085
0086 const edm4hep::Vector3f& getPosition() const;
0087
0088
0089
0090 const std::array<float, 6>& getCovMatrix() const;
0091
0092
0093 float getCovMatrix(size_t i) const;
0094
0095
0096 std::int32_t getAlgorithmType() const;
0097
0098
0099 const edm4hep::ReconstructedParticle getAssociatedParticle() const;
0100
0101 std::size_t parameters_size() const;
0102 float getParameters(std::size_t) const;
0103 std::vector<float>::const_iterator parameters_begin() const;
0104 std::vector<float>::const_iterator parameters_end() const;
0105 podio::RelationRange<float> getParameters() const;
0106
0107
0108 bool isAvailable() const;
0109
0110 void unlink() {
0111 m_obj = podio::utils::MaybeSharedPtr<VertexObj>{nullptr};
0112 }
0113
0114 bool operator==(const Vertex& other) const {
0115 return m_obj == other.m_obj;
0116 }
0117 bool operator==(const MutableVertex& other) const;
0118
0119 bool operator!=(const Vertex& other) const {
0120 return !(*this == other);
0121 }
0122 bool operator!=(const MutableVertex& other) const {
0123 return !(*this == other);
0124 }
0125
0126
0127 bool operator<(const Vertex& other) const {
0128 return m_obj < other.m_obj;
0129 }
0130
0131 podio::ObjectID id() const {
0132 return getObjectID();
0133 }
0134
0135 const podio::ObjectID getObjectID() const;
0136
0137 friend void swap(Vertex& a, Vertex& b) {
0138 using std::swap;
0139 swap(a.m_obj, b.m_obj);
0140 }
0141
0142 private:
0143
0144 explicit Vertex(podio::utils::MaybeSharedPtr<VertexObj> obj);
0145 Vertex(VertexObj* obj);
0146
0147 podio::utils::MaybeSharedPtr<VertexObj> m_obj{nullptr};
0148 };
0149
0150 std::ostream& operator<<(std::ostream& o, const Vertex& value);
0151
0152 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0153 void to_json(nlohmann::json& j, const Vertex& value);
0154 #endif
0155
0156 }
0157
0158 #endif