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