File indexing completed on 2025-01-18 09:55:37
0001
0002
0003 #ifndef EDM4HEP_MutableMCRecoCaloParticleAssociation_H
0004 #define EDM4HEP_MutableMCRecoCaloParticleAssociation_H
0005
0006 #include "edm4hep/MCRecoCaloParticleAssociationObj.h"
0007
0008 #include "edm4hep/MCRecoCaloParticleAssociation.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 CalorimeterHit;
0021 class MutableCalorimeterHit;
0022 class MCParticle;
0023 class MutableMCParticle;
0024 }
0025
0026 namespace edm4hep {
0027
0028
0029
0030
0031
0032 class MutableMCRecoCaloParticleAssociation {
0033
0034 friend class MCRecoCaloParticleAssociationCollection;
0035 friend class MCRecoCaloParticleAssociationMutableCollectionIterator;
0036 friend class MCRecoCaloParticleAssociation;
0037
0038 public:
0039 using object_type = MCRecoCaloParticleAssociation;
0040 using collection_type = MCRecoCaloParticleAssociationCollection;
0041
0042
0043 MutableMCRecoCaloParticleAssociation();
0044
0045
0046 MutableMCRecoCaloParticleAssociation(float weight);
0047
0048
0049 MutableMCRecoCaloParticleAssociation(const MutableMCRecoCaloParticleAssociation& other) = default;
0050
0051
0052 MutableMCRecoCaloParticleAssociation& operator=(MutableMCRecoCaloParticleAssociation other);
0053
0054
0055
0056 MutableMCRecoCaloParticleAssociation clone(bool cloneRelations = true) const;
0057
0058
0059 ~MutableMCRecoCaloParticleAssociation() = default;
0060
0061 public:
0062
0063 float getWeight() const;
0064
0065
0066 const edm4hep::CalorimeterHit getRec() const;
0067
0068 const edm4hep::MCParticle getSim() const;
0069
0070
0071 void setWeight(float value);
0072
0073 float& getWeight();
0074
0075 [[deprecated("use getWeight instead")]] float& weight();
0076
0077
0078 void setRec(const edm4hep::CalorimeterHit& value);
0079
0080 void setSim(const edm4hep::MCParticle& value);
0081
0082
0083 bool isAvailable() const;
0084
0085 void unlink() {
0086 m_obj = podio::utils::MaybeSharedPtr<MCRecoCaloParticleAssociationObj>{nullptr};
0087 }
0088
0089 bool operator==(const MutableMCRecoCaloParticleAssociation& other) const {
0090 return m_obj == other.m_obj;
0091 }
0092 bool operator==(const MCRecoCaloParticleAssociation& other) const;
0093
0094 bool operator!=(const MutableMCRecoCaloParticleAssociation& other) const {
0095 return !(*this == other);
0096 }
0097 bool operator!=(const MCRecoCaloParticleAssociation& other) const {
0098 return !(*this == other);
0099 }
0100
0101
0102 bool operator<(const MutableMCRecoCaloParticleAssociation& other) const {
0103 return m_obj < other.m_obj;
0104 }
0105
0106 podio::ObjectID id() const {
0107 return getObjectID();
0108 }
0109
0110 const podio::ObjectID getObjectID() const;
0111
0112 friend void swap(MutableMCRecoCaloParticleAssociation& a, MutableMCRecoCaloParticleAssociation& b) {
0113 using std::swap;
0114 swap(a.m_obj, b.m_obj);
0115 }
0116
0117 private:
0118
0119 explicit MutableMCRecoCaloParticleAssociation(podio::utils::MaybeSharedPtr<MCRecoCaloParticleAssociationObj> obj);
0120
0121 podio::utils::MaybeSharedPtr<MCRecoCaloParticleAssociationObj> m_obj{nullptr};
0122 };
0123
0124 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0125 void to_json(nlohmann::json& j, const MutableMCRecoCaloParticleAssociation& value);
0126 #endif
0127
0128 }
0129
0130 #endif