File indexing completed on 2025-01-18 09:55:31
0001
0002
0003 #ifndef EDM4EIC_MutableVertex_H
0004 #define EDM4EIC_MutableVertex_H
0005
0006 #include "edm4eic/VertexObj.h"
0007
0008 #include "edm4eic/Vertex.h"
0009
0010 #include "edm4eic/Cov4f.h"
0011 #include "edm4eic/ReconstructedParticle.h"
0012 #include "edm4hep/Vector4f.h"
0013 #include "podio/RelationRange.h"
0014 #include <cstdint>
0015 #include <vector>
0016
0017 #include "podio/utilities/MaybeSharedPtr.h"
0018
0019 #include <cstdint>
0020
0021 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0022 #include "nlohmann/json_fwd.hpp"
0023 #endif
0024
0025
0026
0027 namespace edm4eic {
0028
0029
0030
0031
0032
0033
0034 class MutableVertex {
0035
0036 friend class VertexCollection;
0037 friend class VertexMutableCollectionIterator;
0038 friend class Vertex;
0039
0040 public:
0041 using object_type = Vertex;
0042 using collection_type = VertexCollection;
0043
0044
0045 MutableVertex();
0046
0047
0048 MutableVertex(std::int32_t type, float chi2, int ndf, edm4hep::Vector4f position, edm4eic::Cov4f positionError);
0049
0050
0051 MutableVertex(const MutableVertex& other) = default;
0052
0053
0054 MutableVertex& operator=(MutableVertex other);
0055
0056
0057
0058 MutableVertex clone(bool cloneRelations=true) const;
0059
0060
0061 ~MutableVertex() = default;
0062
0063
0064 public:
0065
0066
0067 std::int32_t getType() const;
0068
0069
0070 float getChi2() const;
0071
0072
0073 int getNdf() const;
0074
0075
0076 const edm4hep::Vector4f& getPosition() const;
0077
0078
0079 const edm4eic::Cov4f& getPositionError() const;
0080
0081
0082
0083
0084 void setType(std::int32_t value);
0085
0086 std::int32_t& getType();
0087
0088 [[deprecated("use getType instead")]]
0089 std::int32_t& type();
0090
0091
0092 void setChi2(float value);
0093
0094 float& getChi2();
0095
0096 [[deprecated("use getChi2 instead")]]
0097 float& chi2();
0098
0099
0100 void setNdf(int value);
0101
0102 int& getNdf();
0103
0104 [[deprecated("use getNdf instead")]]
0105 int& ndf();
0106
0107
0108 void setPosition(edm4hep::Vector4f value);
0109
0110 edm4hep::Vector4f& getPosition();
0111
0112 [[deprecated("use getPosition instead")]]
0113 edm4hep::Vector4f& position();
0114
0115
0116 void setPositionError(edm4eic::Cov4f value);
0117
0118 edm4eic::Cov4f& getPositionError();
0119
0120 [[deprecated("use getPositionError instead")]]
0121 edm4eic::Cov4f& positionError();
0122
0123
0124
0125 void addToAssociatedParticles(const edm4eic::ReconstructedParticle&);
0126 std::size_t associatedParticles_size() const;
0127 edm4eic::ReconstructedParticle getAssociatedParticles(std::size_t) const;
0128 std::vector<edm4eic::ReconstructedParticle>::const_iterator associatedParticles_begin() const;
0129 std::vector<edm4eic::ReconstructedParticle>::const_iterator associatedParticles_end() const;
0130 podio::RelationRange<edm4eic::ReconstructedParticle> getAssociatedParticles() const;
0131
0132
0133
0134
0135 bool isAvailable() const;
0136
0137 void unlink() { m_obj = podio::utils::MaybeSharedPtr<VertexObj>{nullptr}; }
0138
0139 bool operator==(const MutableVertex& other) const { return m_obj == other.m_obj; }
0140 bool operator==(const Vertex& other) const;
0141
0142 bool operator!=(const MutableVertex& other) const { return !(*this == other); }
0143 bool operator!=(const Vertex& other) const { return !(*this == other); }
0144
0145
0146 bool operator<(const MutableVertex& other) const { return m_obj < other.m_obj; }
0147
0148 podio::ObjectID id() const { return getObjectID(); }
0149
0150 const podio::ObjectID getObjectID() const;
0151
0152 friend void swap(MutableVertex& a, MutableVertex& b) {
0153 using std::swap;
0154 swap(a.m_obj, b.m_obj);
0155 }
0156
0157 private:
0158
0159 explicit MutableVertex(podio::utils::MaybeSharedPtr<VertexObj> obj);
0160
0161 podio::utils::MaybeSharedPtr<VertexObj> m_obj{nullptr};
0162 };
0163
0164 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0165 void to_json(nlohmann::json& j, const MutableVertex& value);
0166 #endif
0167
0168
0169 }
0170
0171
0172 #endif