File indexing completed on 2025-01-18 09:55:29
0001
0002
0003 #ifndef EDM4EIC_MCRecoTrackParticleAssociation_H
0004 #define EDM4EIC_MCRecoTrackParticleAssociation_H
0005
0006 #include "edm4eic/MCRecoTrackParticleAssociationObj.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 Track;
0022 class MutableTrack;
0023 }
0024 namespace edm4hep {
0025 class MCParticle;
0026 class MutableMCParticle;
0027 }
0028
0029
0030 namespace edm4eic {
0031
0032 class MutableMCRecoTrackParticleAssociation;
0033 class MCRecoTrackParticleAssociationCollection;
0034 class MCRecoTrackParticleAssociationCollectionData;
0035
0036
0037
0038
0039
0040 class MCRecoTrackParticleAssociation {
0041
0042 friend class MutableMCRecoTrackParticleAssociation;
0043 friend class MCRecoTrackParticleAssociationCollection;
0044 friend class edm4eic::MCRecoTrackParticleAssociationCollectionData;
0045 friend class MCRecoTrackParticleAssociationCollectionIterator;
0046
0047 public:
0048 using mutable_type = MutableMCRecoTrackParticleAssociation;
0049 using collection_type = MCRecoTrackParticleAssociationCollection;
0050
0051
0052 MCRecoTrackParticleAssociation();
0053
0054
0055 MCRecoTrackParticleAssociation(std::uint32_t simID, std::uint32_t recID, float weight);
0056
0057
0058 MCRecoTrackParticleAssociation(const MCRecoTrackParticleAssociation& other) = default;
0059
0060
0061 MCRecoTrackParticleAssociation& operator=(MCRecoTrackParticleAssociation other);
0062
0063
0064
0065 MutableMCRecoTrackParticleAssociation clone(bool cloneRelations=true) const;
0066
0067
0068 ~MCRecoTrackParticleAssociation() = default;
0069
0070
0071 MCRecoTrackParticleAssociation(const MutableMCRecoTrackParticleAssociation& other);
0072
0073 static MCRecoTrackParticleAssociation 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::Track 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<MCRecoTrackParticleAssociationObj>{nullptr}; }
0098
0099 bool operator==(const MCRecoTrackParticleAssociation& other) const { return m_obj == other.m_obj; }
0100 bool operator==(const MutableMCRecoTrackParticleAssociation& other) const;
0101
0102 bool operator!=(const MCRecoTrackParticleAssociation& other) const { return !(*this == other); }
0103 bool operator!=(const MutableMCRecoTrackParticleAssociation& other) const { return !(*this == other); }
0104
0105
0106 bool operator<(const MCRecoTrackParticleAssociation& 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(MCRecoTrackParticleAssociation& a, MCRecoTrackParticleAssociation& b) {
0113 using std::swap;
0114 swap(a.m_obj, b.m_obj);
0115 }
0116
0117 private:
0118
0119 explicit MCRecoTrackParticleAssociation(podio::utils::MaybeSharedPtr<MCRecoTrackParticleAssociationObj> obj);
0120 MCRecoTrackParticleAssociation(MCRecoTrackParticleAssociationObj* obj);
0121
0122 podio::utils::MaybeSharedPtr<MCRecoTrackParticleAssociationObj> m_obj{nullptr};
0123 };
0124
0125 std::ostream& operator<<(std::ostream& o, const MCRecoTrackParticleAssociation& value);
0126
0127 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0128 void to_json(nlohmann::json& j, const MCRecoTrackParticleAssociation& value);
0129 #endif
0130
0131
0132 }
0133
0134
0135 #endif