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