File indexing completed on 2025-02-21 09:58:22
0001
0002
0003 #ifndef EDM4HEP_MutableCaloHitContribution_H
0004 #define EDM4HEP_MutableCaloHitContribution_H
0005
0006 #include "edm4hep/CaloHitContributionObj.h"
0007
0008 #include "edm4hep/CaloHitContribution.h"
0009
0010 #include "edm4hep/Vector3f.h"
0011 #include <cstdint>
0012
0013 #include "podio/utilities/MaybeSharedPtr.h"
0014
0015 #include <cstdint>
0016
0017 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0018 #include "nlohmann/json_fwd.hpp"
0019 #endif
0020
0021
0022 namespace edm4hep {
0023 class MCParticle;
0024 class MutableMCParticle;
0025 }
0026
0027 namespace edm4hep {
0028
0029
0030
0031
0032
0033 class MutableCaloHitContribution {
0034
0035 friend class CaloHitContributionCollection;
0036 friend class CaloHitContributionMutableCollectionIterator;
0037 friend class CaloHitContribution;
0038
0039 public:
0040 using object_type = CaloHitContribution;
0041 using collection_type = CaloHitContributionCollection;
0042
0043
0044 MutableCaloHitContribution();
0045
0046
0047 MutableCaloHitContribution(std::int32_t PDG, float energy, float time, edm4hep::Vector3f stepPosition);
0048
0049
0050 MutableCaloHitContribution(const MutableCaloHitContribution& other) = default;
0051
0052
0053 MutableCaloHitContribution& operator=(MutableCaloHitContribution other);
0054
0055
0056
0057 MutableCaloHitContribution clone(bool cloneRelations = true) const;
0058
0059
0060 ~MutableCaloHitContribution() = default;
0061
0062 public:
0063
0064 std::int32_t getPDG() const;
0065
0066
0067 float getEnergy() const;
0068
0069
0070 float getTime() const;
0071
0072
0073 const edm4hep::Vector3f& getStepPosition() const;
0074
0075
0076 const edm4hep::MCParticle getParticle() const;
0077
0078
0079 void setPDG(std::int32_t value);
0080
0081 std::int32_t& getPDG();
0082
0083 [[deprecated("use getPDG instead")]] std::int32_t& PDG();
0084
0085
0086 void setEnergy(float value);
0087
0088 float& getEnergy();
0089
0090 [[deprecated("use getEnergy instead")]] float& energy();
0091
0092
0093 void setTime(float value);
0094
0095 float& getTime();
0096
0097 [[deprecated("use getTime instead")]] float& time();
0098
0099
0100 void setStepPosition(edm4hep::Vector3f value);
0101
0102 edm4hep::Vector3f& getStepPosition();
0103
0104 [[deprecated("use getStepPosition instead")]] edm4hep::Vector3f& stepPosition();
0105
0106
0107 void setParticle(const edm4hep::MCParticle& value);
0108
0109
0110 bool isAvailable() const;
0111
0112 void unlink() {
0113 m_obj = podio::utils::MaybeSharedPtr<CaloHitContributionObj>{nullptr};
0114 }
0115
0116 bool operator==(const MutableCaloHitContribution& other) const {
0117 return m_obj == other.m_obj;
0118 }
0119 bool operator==(const CaloHitContribution& other) const;
0120
0121 bool operator!=(const MutableCaloHitContribution& other) const {
0122 return !(*this == other);
0123 }
0124 bool operator!=(const CaloHitContribution& other) const {
0125 return !(*this == other);
0126 }
0127
0128
0129 bool operator<(const MutableCaloHitContribution& other) const {
0130 return m_obj < other.m_obj;
0131 }
0132
0133 podio::ObjectID id() const {
0134 return getObjectID();
0135 }
0136
0137 const podio::ObjectID getObjectID() const;
0138
0139 friend void swap(MutableCaloHitContribution& a, MutableCaloHitContribution& b) {
0140 using std::swap;
0141 swap(a.m_obj, b.m_obj);
0142 }
0143
0144 private:
0145
0146 explicit MutableCaloHitContribution(podio::utils::MaybeSharedPtr<CaloHitContributionObj> obj);
0147
0148 podio::utils::MaybeSharedPtr<CaloHitContributionObj> m_obj{nullptr};
0149 };
0150
0151 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0152 void to_json(nlohmann::json& j, const MutableCaloHitContribution& value);
0153 #endif
0154
0155 }
0156
0157 #endif