File indexing completed on 2025-12-15 10:12:03
0001
0002
0003 #ifndef EDM4EIC_MCRecoClusterParticleAssociation_H
0004 #define EDM4EIC_MCRecoClusterParticleAssociation_H
0005
0006 #include "edm4eic/MCRecoClusterParticleAssociationObj.h"
0007
0008 #include <cstdint>
0009
0010 #include "podio/utilities/MaybeSharedPtr.h"
0011 #include "podio/detail/OrderKey.h"
0012
0013 #include <ostream>
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 MCRecoClusterParticleAssociationCollection;
0023 class Cluster;
0024 class MutableCluster;
0025 }
0026 namespace edm4hep {
0027 class MCParticle;
0028 class MutableMCParticle;
0029 }
0030
0031
0032 namespace podio::detail {
0033
0034 OrderKey getOrderKey(const edm4eic::MCRecoClusterParticleAssociation& obj);
0035 };
0036
0037 namespace edm4eic {
0038
0039 class MutableMCRecoClusterParticleAssociation;
0040 class MCRecoClusterParticleAssociationCollection;
0041 class MCRecoClusterParticleAssociationCollectionData;
0042
0043
0044
0045
0046
0047 class MCRecoClusterParticleAssociation {
0048
0049 friend class MutableMCRecoClusterParticleAssociation;
0050 friend class MCRecoClusterParticleAssociationCollection;
0051 friend class edm4eic::MCRecoClusterParticleAssociationCollectionData;
0052 friend class MCRecoClusterParticleAssociationCollectionIterator;
0053 friend podio::detail::OrderKey podio::detail::getOrderKey(const MCRecoClusterParticleAssociation & obj);
0054
0055 public:
0056 using mutable_type = MutableMCRecoClusterParticleAssociation;
0057 using collection_type = MCRecoClusterParticleAssociationCollection;
0058
0059
0060 MCRecoClusterParticleAssociation() = default;
0061
0062
0063 MCRecoClusterParticleAssociation(const std::uint32_t simID, const std::uint32_t recID, const float weight);
0064
0065
0066 MCRecoClusterParticleAssociation(const MCRecoClusterParticleAssociation& other) = default;
0067
0068
0069 MCRecoClusterParticleAssociation& operator=(MCRecoClusterParticleAssociation other) &;
0070 MCRecoClusterParticleAssociation& operator=(MCRecoClusterParticleAssociation other) && = delete;
0071
0072
0073
0074 MutableMCRecoClusterParticleAssociation clone(bool cloneRelations=true) const;
0075
0076
0077 ~MCRecoClusterParticleAssociation() = default;
0078
0079
0080 MCRecoClusterParticleAssociation(const MutableMCRecoClusterParticleAssociation& other);
0081
0082 static MCRecoClusterParticleAssociation makeEmpty();
0083
0084 public:
0085
0086 static constexpr std::string_view typeName = "edm4eic::MCRecoClusterParticleAssociation";
0087
0088
0089 std::uint32_t getSimID() const;
0090
0091
0092 std::uint32_t getRecID() const;
0093
0094
0095 float getWeight() const;
0096
0097
0098
0099 const edm4eic::Cluster getRec() const;
0100
0101 const edm4hep::MCParticle getSim() const;
0102
0103
0104
0105
0106 bool isAvailable() const;
0107
0108 void unlink() { m_obj = podio::utils::MaybeSharedPtr<MCRecoClusterParticleAssociationObj>{nullptr}; }
0109
0110 bool operator==(const MCRecoClusterParticleAssociation& other) const { return m_obj == other.m_obj; }
0111 bool operator==(const MutableMCRecoClusterParticleAssociation& other) const;
0112
0113 bool operator!=(const MCRecoClusterParticleAssociation& other) const { return !(*this == other); }
0114 bool operator!=(const MutableMCRecoClusterParticleAssociation& other) const { return !(*this == other); }
0115
0116
0117 bool operator<(const MCRecoClusterParticleAssociation& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
0118
0119 podio::ObjectID id() const { return getObjectID(); }
0120
0121 const podio::ObjectID getObjectID() const;
0122
0123 friend std::hash<MCRecoClusterParticleAssociation>;
0124
0125 friend void swap(MCRecoClusterParticleAssociation& a, MCRecoClusterParticleAssociation& b) {
0126 using std::swap;
0127 swap(a.m_obj, b.m_obj);
0128 }
0129
0130 private:
0131
0132 explicit MCRecoClusterParticleAssociation(podio::utils::MaybeSharedPtr<MCRecoClusterParticleAssociationObj> obj);
0133 MCRecoClusterParticleAssociation(MCRecoClusterParticleAssociationObj* obj);
0134
0135 podio::utils::MaybeSharedPtr<MCRecoClusterParticleAssociationObj> m_obj{new MCRecoClusterParticleAssociationObj{}, podio::utils::MarkOwned};
0136 };
0137
0138 std::ostream& operator<<(std::ostream& o, const MCRecoClusterParticleAssociation& value);
0139
0140 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0141 void to_json(nlohmann::json& j, const MCRecoClusterParticleAssociation& value);
0142 #endif
0143
0144
0145 }
0146
0147
0148
0149 template<>
0150 struct std::hash<edm4eic::MCRecoClusterParticleAssociation> {
0151 std::size_t operator()(const edm4eic::MCRecoClusterParticleAssociation& obj) const {
0152 return std::hash<edm4eic::MCRecoClusterParticleAssociationObj*>{}(obj.m_obj.get());
0153 }
0154 };
0155
0156
0157
0158
0159
0160 #if defined(__clang__)
0161 #pragma clang diagnostic push
0162 #pragma clang diagnostic ignored "-Wunknown-warning-option"
0163 #pragma clang diagnostic ignored "-Wdeprecated-redundant-constexpr-static-def"
0164 #pragma clang diagnostic ignored "-Wdeprecated"
0165 constexpr std::string_view edm4eic::MCRecoClusterParticleAssociation::typeName;
0166 #pragma clang diagnostic pop
0167 #elif defined(__GNUC__)
0168 #pragma GCC diagnostic push
0169 #pragma GCC diagnostic ignored "-Wdeprecated"
0170 constexpr std::string_view edm4eic::MCRecoClusterParticleAssociation::typeName;
0171 #pragma GCC diagnostic pop
0172 #endif
0173
0174
0175 #endif