File indexing completed on 2024-11-15 09:35:42
0001
0002
0003 #ifndef EDM4HEP_MutableSimCalorimeterHit_H
0004 #define EDM4HEP_MutableSimCalorimeterHit_H
0005
0006 #include "edm4hep/SimCalorimeterHitObj.h"
0007
0008 #include "edm4hep/SimCalorimeterHit.h"
0009
0010 #include "edm4hep/CaloHitContribution.h"
0011 #include "edm4hep/Vector3f.h"
0012 #include "podio/RelationRange.h"
0013 #include <cstdint>
0014 #include <vector>
0015
0016 #include "podio/utilities/MaybeSharedPtr.h"
0017
0018 #include <cstddef>
0019 #include <ostream>
0020
0021 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0022 #include "nlohmann/json_fwd.hpp"
0023 #endif
0024
0025 namespace edm4hep {
0026
0027
0028
0029
0030
0031 class MutableSimCalorimeterHit {
0032
0033 friend class SimCalorimeterHitCollection;
0034 friend class SimCalorimeterHitMutableCollectionIterator;
0035 friend class SimCalorimeterHit;
0036
0037 public:
0038 using object_type = SimCalorimeterHit;
0039 using collection_type = SimCalorimeterHitCollection;
0040
0041
0042 MutableSimCalorimeterHit();
0043
0044
0045 MutableSimCalorimeterHit(std::uint64_t cellID, float energy, edm4hep::Vector3f position);
0046
0047
0048 MutableSimCalorimeterHit(const MutableSimCalorimeterHit& other) = default;
0049
0050
0051 MutableSimCalorimeterHit& operator=(MutableSimCalorimeterHit other);
0052
0053
0054 MutableSimCalorimeterHit clone() const;
0055
0056
0057 ~MutableSimCalorimeterHit() = default;
0058
0059
0060 operator SimCalorimeterHit() const;
0061
0062 public:
0063
0064 std::uint64_t getCellID() const;
0065
0066
0067 float getEnergy() const;
0068
0069
0070 const edm4hep::Vector3f& getPosition() const;
0071
0072
0073 void setCellID(std::uint64_t value);
0074
0075
0076 void setEnergy(float value);
0077
0078
0079 void setPosition(edm4hep::Vector3f value);
0080
0081 edm4hep::Vector3f& position();
0082
0083 void addToContributions(edm4hep::CaloHitContribution);
0084 std::size_t contributions_size() const;
0085 edm4hep::CaloHitContribution getContributions(std::size_t) const;
0086 std::vector<edm4hep::CaloHitContribution>::const_iterator contributions_begin() const;
0087 std::vector<edm4hep::CaloHitContribution>::const_iterator contributions_end() const;
0088 podio::RelationRange<edm4hep::CaloHitContribution> getContributions() const;
0089
0090
0091 bool isAvailable() const;
0092
0093 void unlink() {
0094 m_obj = podio::utils::MaybeSharedPtr<SimCalorimeterHitObj>{nullptr};
0095 }
0096
0097 bool operator==(const MutableSimCalorimeterHit& other) const {
0098 return m_obj == other.m_obj;
0099 }
0100 bool operator==(const SimCalorimeterHit& other) const;
0101
0102
0103 bool operator<(const MutableSimCalorimeterHit& other) const {
0104 return m_obj < other.m_obj;
0105 }
0106
0107 podio::ObjectID id() const {
0108 return getObjectID();
0109 }
0110
0111 const podio::ObjectID getObjectID() const;
0112
0113 friend void swap(MutableSimCalorimeterHit& a, MutableSimCalorimeterHit& b) {
0114 using std::swap;
0115 swap(a.m_obj, b.m_obj);
0116 }
0117
0118 private:
0119
0120 explicit MutableSimCalorimeterHit(podio::utils::MaybeSharedPtr<SimCalorimeterHitObj> obj);
0121
0122 podio::utils::MaybeSharedPtr<SimCalorimeterHitObj> m_obj{nullptr};
0123 };
0124
0125 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0126 void to_json(nlohmann::json& j, const MutableSimCalorimeterHit& value);
0127 #endif
0128
0129 }
0130
0131 #endif