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