File indexing completed on 2025-07-05 08:52:28
0001
0002
0003 #ifndef EDM4EIC_MutableMCRecoVertexParticleAssociation_H
0004 #define EDM4EIC_MutableMCRecoVertexParticleAssociation_H
0005
0006 #include "edm4eic/MCRecoVertexParticleAssociationObj.h"
0007
0008 #include "edm4eic/MCRecoVertexParticleAssociation.h"
0009
0010 #include <cstdint>
0011
0012 #include "podio/utilities/MaybeSharedPtr.h"
0013
0014 #include <cstdint>
0015
0016 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0017 #include "nlohmann/json_fwd.hpp"
0018 #endif
0019
0020
0021 namespace edm4eic {
0022 class MCRecoVertexParticleAssociationCollection;
0023 class Vertex;
0024 class MutableVertex;
0025 }
0026 namespace edm4hep {
0027 class MCParticle;
0028 class MutableMCParticle;
0029 }
0030
0031
0032 namespace edm4eic {
0033
0034
0035
0036
0037
0038
0039 class MutableMCRecoVertexParticleAssociation {
0040
0041 friend class MCRecoVertexParticleAssociationCollection;
0042 friend class MCRecoVertexParticleAssociationMutableCollectionIterator;
0043 friend class MCRecoVertexParticleAssociation;
0044
0045 public:
0046 using object_type = MCRecoVertexParticleAssociation;
0047 using collection_type = MCRecoVertexParticleAssociationCollection;
0048
0049
0050 MutableMCRecoVertexParticleAssociation();
0051
0052
0053 MutableMCRecoVertexParticleAssociation(std::uint32_t simID, std::uint32_t recID, float weight);
0054
0055
0056 MutableMCRecoVertexParticleAssociation(const MutableMCRecoVertexParticleAssociation& other) = default;
0057
0058
0059 MutableMCRecoVertexParticleAssociation& operator=(MutableMCRecoVertexParticleAssociation other);
0060
0061
0062
0063 MutableMCRecoVertexParticleAssociation clone(bool cloneRelations=true) const;
0064
0065
0066 ~MutableMCRecoVertexParticleAssociation() = default;
0067
0068
0069 public:
0070
0071
0072 std::uint32_t getSimID() const;
0073
0074
0075 std::uint32_t getRecID() const;
0076
0077
0078 float getWeight() const;
0079
0080
0081
0082 const edm4eic::Vertex getRec() const;
0083
0084 const edm4hep::MCParticle getSim() const;
0085
0086
0087 void setSimID(std::uint32_t value);
0088
0089 std::uint32_t& getSimID();
0090
0091 [[deprecated("use getSimID instead")]]
0092 std::uint32_t& simID();
0093
0094
0095 void setRecID(std::uint32_t value);
0096
0097 std::uint32_t& getRecID();
0098
0099 [[deprecated("use getRecID instead")]]
0100 std::uint32_t& recID();
0101
0102
0103 void setWeight(float value);
0104
0105 float& getWeight();
0106
0107 [[deprecated("use getWeight instead")]]
0108 float& weight();
0109
0110
0111
0112 void setRec(const edm4eic::Vertex& value);
0113
0114 void setSim(const edm4hep::MCParticle& value);
0115
0116
0117
0118
0119
0120 bool isAvailable() const;
0121
0122 void unlink() { m_obj = podio::utils::MaybeSharedPtr<MCRecoVertexParticleAssociationObj>{nullptr}; }
0123
0124 bool operator==(const MutableMCRecoVertexParticleAssociation& other) const { return m_obj == other.m_obj; }
0125 bool operator==(const MCRecoVertexParticleAssociation& other) const;
0126
0127 bool operator!=(const MutableMCRecoVertexParticleAssociation& other) const { return !(*this == other); }
0128 bool operator!=(const MCRecoVertexParticleAssociation& other) const { return !(*this == other); }
0129
0130
0131 bool operator<(const MutableMCRecoVertexParticleAssociation& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
0132
0133 podio::ObjectID id() const { return getObjectID(); }
0134
0135 const podio::ObjectID getObjectID() const;
0136
0137 friend void swap(MutableMCRecoVertexParticleAssociation& a, MutableMCRecoVertexParticleAssociation& b) {
0138 using std::swap;
0139 swap(a.m_obj, b.m_obj);
0140 }
0141
0142 private:
0143
0144 explicit MutableMCRecoVertexParticleAssociation(podio::utils::MaybeSharedPtr<MCRecoVertexParticleAssociationObj> obj);
0145
0146 podio::utils::MaybeSharedPtr<MCRecoVertexParticleAssociationObj> m_obj{nullptr};
0147 };
0148
0149 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0150 void to_json(nlohmann::json& j, const MutableMCRecoVertexParticleAssociation& value);
0151 #endif
0152
0153
0154 }
0155
0156
0157 #endif