File indexing completed on 2025-01-18 09:55:37
0001
0002
0003 #ifndef EDM4HEP_MutableRawCalorimeterHit_H
0004 #define EDM4HEP_MutableRawCalorimeterHit_H
0005
0006 #include "edm4hep/RawCalorimeterHitObj.h"
0007
0008 #include "edm4hep/RawCalorimeterHit.h"
0009
0010 #include <cstdint>
0011
0012 #include "podio/utilities/MaybeSharedPtr.h"
0013
0014 #include <cstdint>
0015
0016 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0017 #include "nlohmann/json_fwd.hpp"
0018 #endif
0019
0020 namespace edm4hep {
0021
0022
0023
0024
0025
0026 class MutableRawCalorimeterHit {
0027
0028 friend class RawCalorimeterHitCollection;
0029 friend class RawCalorimeterHitMutableCollectionIterator;
0030 friend class RawCalorimeterHit;
0031
0032 public:
0033 using object_type = RawCalorimeterHit;
0034 using collection_type = RawCalorimeterHitCollection;
0035
0036
0037 MutableRawCalorimeterHit();
0038
0039
0040 MutableRawCalorimeterHit(std::uint64_t cellID, std::int32_t amplitude, std::int32_t timeStamp);
0041
0042
0043 MutableRawCalorimeterHit(const MutableRawCalorimeterHit& other) = default;
0044
0045
0046 MutableRawCalorimeterHit& operator=(MutableRawCalorimeterHit other);
0047
0048
0049
0050 MutableRawCalorimeterHit clone(bool cloneRelations = true) const;
0051
0052
0053 ~MutableRawCalorimeterHit() = default;
0054
0055 public:
0056
0057 std::uint64_t getCellID() const;
0058
0059
0060 std::int32_t getAmplitude() const;
0061
0062
0063 std::int32_t getTimeStamp() const;
0064
0065
0066 void setCellID(std::uint64_t value);
0067
0068 std::uint64_t& getCellID();
0069
0070 [[deprecated("use getCellID instead")]] std::uint64_t& cellID();
0071
0072
0073 void setAmplitude(std::int32_t value);
0074
0075 std::int32_t& getAmplitude();
0076
0077 [[deprecated("use getAmplitude instead")]] std::int32_t& amplitude();
0078
0079
0080 void setTimeStamp(std::int32_t value);
0081
0082 std::int32_t& getTimeStamp();
0083
0084 [[deprecated("use getTimeStamp instead")]] std::int32_t& timeStamp();
0085
0086
0087 bool isAvailable() const;
0088
0089 void unlink() {
0090 m_obj = podio::utils::MaybeSharedPtr<RawCalorimeterHitObj>{nullptr};
0091 }
0092
0093 bool operator==(const MutableRawCalorimeterHit& other) const {
0094 return m_obj == other.m_obj;
0095 }
0096 bool operator==(const RawCalorimeterHit& other) const;
0097
0098 bool operator!=(const MutableRawCalorimeterHit& other) const {
0099 return !(*this == other);
0100 }
0101 bool operator!=(const RawCalorimeterHit& other) const {
0102 return !(*this == other);
0103 }
0104
0105
0106 bool operator<(const MutableRawCalorimeterHit& other) const {
0107 return m_obj < other.m_obj;
0108 }
0109
0110 podio::ObjectID id() const {
0111 return getObjectID();
0112 }
0113
0114 const podio::ObjectID getObjectID() const;
0115
0116 friend void swap(MutableRawCalorimeterHit& a, MutableRawCalorimeterHit& b) {
0117 using std::swap;
0118 swap(a.m_obj, b.m_obj);
0119 }
0120
0121 private:
0122
0123 explicit MutableRawCalorimeterHit(podio::utils::MaybeSharedPtr<RawCalorimeterHitObj> obj);
0124
0125 podio::utils::MaybeSharedPtr<RawCalorimeterHitObj> m_obj{nullptr};
0126 };
0127
0128 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0129 void to_json(nlohmann::json& j, const MutableRawCalorimeterHit& value);
0130 #endif
0131
0132 }
0133
0134 #endif