File indexing completed on 2025-06-03 08:33:24
0001
0002
0003 #ifndef EDM4HEP_MutableCaloHitSimCaloHitLink_H
0004 #define EDM4HEP_MutableCaloHitSimCaloHitLink_H
0005
0006 #include "edm4hep/CaloHitSimCaloHitLinkObj.h"
0007
0008 #include "edm4hep/CaloHitSimCaloHitLink.h"
0009
0010 #include "podio/utilities/MaybeSharedPtr.h"
0011
0012 #include <cstdint>
0013
0014 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0015 #include "nlohmann/json_fwd.hpp"
0016 #endif
0017
0018
0019 namespace edm4hep {
0020 class CaloHitSimCaloHitLinkCollection;
0021 class CalorimeterHit;
0022 class MutableCalorimeterHit;
0023 class SimCalorimeterHit;
0024 class MutableSimCalorimeterHit;
0025 }
0026
0027 namespace edm4hep {
0028
0029
0030
0031
0032
0033 class MutableCaloHitSimCaloHitLink {
0034
0035 friend class CaloHitSimCaloHitLinkCollection;
0036 friend class CaloHitSimCaloHitLinkMutableCollectionIterator;
0037 friend class CaloHitSimCaloHitLink;
0038
0039 public:
0040 using object_type = CaloHitSimCaloHitLink;
0041 using collection_type = CaloHitSimCaloHitLinkCollection;
0042
0043
0044 MutableCaloHitSimCaloHitLink();
0045
0046
0047 MutableCaloHitSimCaloHitLink(float weight);
0048
0049
0050 MutableCaloHitSimCaloHitLink(const MutableCaloHitSimCaloHitLink& other) = default;
0051
0052
0053 MutableCaloHitSimCaloHitLink& operator=(MutableCaloHitSimCaloHitLink other);
0054
0055
0056
0057 MutableCaloHitSimCaloHitLink clone(bool cloneRelations = true) const;
0058
0059
0060 ~MutableCaloHitSimCaloHitLink() = default;
0061
0062 public:
0063
0064 float getWeight() const;
0065
0066
0067 const edm4hep::CalorimeterHit getFrom() const;
0068
0069 const edm4hep::SimCalorimeterHit getTo() const;
0070
0071
0072 void setWeight(float value);
0073
0074 float& getWeight();
0075
0076 [[deprecated("use getWeight instead")]] float& weight();
0077
0078
0079 void setFrom(const edm4hep::CalorimeterHit& value);
0080
0081 void setTo(const edm4hep::SimCalorimeterHit& value);
0082
0083 [[deprecated("use getFrom instead")]] edm4hep::CalorimeterHit getRec() const;
0084 [[deprecated("use getTo instead")]] edm4hep::SimCalorimeterHit getSim() const;
0085
0086 [[deprecated("use setFrom instead")]] void setRec(const edm4hep::CalorimeterHit& rec);
0087 [[deprecated("use setTo instead")]] void setSim(const edm4hep::SimCalorimeterHit& sim);
0088
0089
0090 bool isAvailable() const;
0091
0092 void unlink() {
0093 m_obj = podio::utils::MaybeSharedPtr<CaloHitSimCaloHitLinkObj>{nullptr};
0094 }
0095
0096 bool operator==(const MutableCaloHitSimCaloHitLink& other) const {
0097 return m_obj == other.m_obj;
0098 }
0099 bool operator==(const CaloHitSimCaloHitLink& other) const;
0100
0101 bool operator!=(const MutableCaloHitSimCaloHitLink& other) const {
0102 return !(*this == other);
0103 }
0104 bool operator!=(const CaloHitSimCaloHitLink& other) const {
0105 return !(*this == other);
0106 }
0107
0108
0109 bool operator<(const MutableCaloHitSimCaloHitLink& other) const {
0110 return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other);
0111 }
0112
0113 podio::ObjectID id() const {
0114 return getObjectID();
0115 }
0116
0117 const podio::ObjectID getObjectID() const;
0118
0119 friend void swap(MutableCaloHitSimCaloHitLink& a, MutableCaloHitSimCaloHitLink& b) {
0120 using std::swap;
0121 swap(a.m_obj, b.m_obj);
0122 }
0123
0124 private:
0125
0126 explicit MutableCaloHitSimCaloHitLink(podio::utils::MaybeSharedPtr<CaloHitSimCaloHitLinkObj> obj);
0127
0128 podio::utils::MaybeSharedPtr<CaloHitSimCaloHitLinkObj> m_obj{nullptr};
0129 };
0130
0131 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0132 void to_json(nlohmann::json& j, const MutableCaloHitSimCaloHitLink& value);
0133 #endif
0134
0135 }
0136
0137 #endif