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