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