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