File indexing completed on 2026-04-17 08:20:53
0001
0002
0003 #ifndef EDM4EIC_RawCALOROCHit_H
0004 #define EDM4EIC_RawCALOROCHit_H
0005
0006 #include "edm4eic/RawCALOROCHitObj.h"
0007
0008 #include "edm4eic/CALOROC1ASample.h"
0009 #include "edm4eic/CALOROC1BSample.h"
0010 #include "podio/RelationRange.h"
0011 #include <cstdint>
0012 #include <vector>
0013
0014 #include "podio/utilities/MaybeSharedPtr.h"
0015 #include "podio/detail/OrderKey.h"
0016
0017 #include <ostream>
0018 #include <cstdint>
0019
0020 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0021 #include "nlohmann/json_fwd.hpp"
0022 #endif
0023
0024
0025 namespace edm4eic {
0026 class RawCALOROCHitCollection;
0027 }
0028
0029
0030 namespace podio::detail {
0031
0032 OrderKey getOrderKey(const edm4eic::RawCALOROCHit& obj);
0033 };
0034
0035 namespace edm4eic {
0036
0037 class MutableRawCALOROCHit;
0038 class RawCALOROCHitCollection;
0039 class RawCALOROCHitCollectionData;
0040
0041
0042
0043
0044
0045 class RawCALOROCHit {
0046
0047 friend class MutableRawCALOROCHit;
0048 friend class RawCALOROCHitCollection;
0049 friend class edm4eic::RawCALOROCHitCollectionData;
0050 friend class RawCALOROCHitCollectionIterator;
0051 friend podio::detail::OrderKey podio::detail::getOrderKey(const RawCALOROCHit & obj);
0052
0053 public:
0054 using mutable_type = MutableRawCALOROCHit;
0055 using collection_type = RawCALOROCHitCollection;
0056
0057
0058 RawCALOROCHit() = default;
0059
0060
0061 RawCALOROCHit(const std::uint64_t cellID, const std::int32_t samplePhase, const std::int32_t timeStamp);
0062
0063
0064 RawCALOROCHit(const RawCALOROCHit& other) = default;
0065
0066
0067 RawCALOROCHit& operator=(RawCALOROCHit other) &;
0068 RawCALOROCHit& operator=(RawCALOROCHit other) && = delete;
0069
0070
0071
0072 MutableRawCALOROCHit clone(bool cloneRelations=true) const;
0073
0074
0075 ~RawCALOROCHit() = default;
0076
0077
0078 RawCALOROCHit(const MutableRawCALOROCHit& other);
0079
0080 static RawCALOROCHit makeEmpty();
0081
0082 public:
0083
0084 static constexpr std::string_view typeName = "edm4eic::RawCALOROCHit";
0085
0086
0087 std::uint64_t getCellID() const;
0088
0089
0090 std::int32_t getSamplePhase() const;
0091
0092
0093 std::int32_t getTimeStamp() const;
0094
0095
0096
0097 std::size_t aSamples_size() const;
0098 edm4eic::CALOROC1ASample getASamples(std::size_t) const;
0099 std::vector<edm4eic::CALOROC1ASample>::const_iterator aSamples_begin() const;
0100 std::vector<edm4eic::CALOROC1ASample>::const_iterator aSamples_end() const;
0101 podio::RelationRange<edm4eic::CALOROC1ASample> getASamples() const;
0102 std::size_t bSamples_size() const;
0103 edm4eic::CALOROC1BSample getBSamples(std::size_t) const;
0104 std::vector<edm4eic::CALOROC1BSample>::const_iterator bSamples_begin() const;
0105 std::vector<edm4eic::CALOROC1BSample>::const_iterator bSamples_end() const;
0106 podio::RelationRange<edm4eic::CALOROC1BSample> getBSamples() const;
0107
0108
0109
0110 bool isAvailable() const;
0111
0112 void unlink() { m_obj = podio::utils::MaybeSharedPtr<RawCALOROCHitObj>{nullptr}; }
0113
0114 bool operator==(const RawCALOROCHit& other) const { return m_obj == other.m_obj; }
0115 bool operator==(const MutableRawCALOROCHit& other) const;
0116
0117 bool operator!=(const RawCALOROCHit& other) const { return !(*this == other); }
0118 bool operator!=(const MutableRawCALOROCHit& other) const { return !(*this == other); }
0119
0120
0121 bool operator<(const RawCALOROCHit& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
0122
0123 podio::ObjectID id() const { return getObjectID(); }
0124
0125 const podio::ObjectID getObjectID() const;
0126
0127 friend std::hash<RawCALOROCHit>;
0128
0129 friend void swap(RawCALOROCHit& a, RawCALOROCHit& b) {
0130 using std::swap;
0131 swap(a.m_obj, b.m_obj);
0132 }
0133
0134 private:
0135
0136 explicit RawCALOROCHit(podio::utils::MaybeSharedPtr<RawCALOROCHitObj> obj);
0137 RawCALOROCHit(RawCALOROCHitObj* obj);
0138
0139 podio::utils::MaybeSharedPtr<RawCALOROCHitObj> m_obj{new RawCALOROCHitObj{}, podio::utils::MarkOwned};
0140 };
0141
0142 std::ostream& operator<<(std::ostream& o, const RawCALOROCHit& value);
0143
0144 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0145 void to_json(nlohmann::json& j, const RawCALOROCHit& value);
0146 #endif
0147
0148
0149 }
0150
0151
0152
0153 template<>
0154 struct std::hash<edm4eic::RawCALOROCHit> {
0155 std::size_t operator()(const edm4eic::RawCALOROCHit& obj) const {
0156 return std::hash<edm4eic::RawCALOROCHitObj*>{}(obj.m_obj.get());
0157 }
0158 };
0159
0160
0161
0162
0163
0164 #if defined(__clang__)
0165 #pragma clang diagnostic push
0166 #pragma clang diagnostic ignored "-Wunknown-warning-option"
0167 #pragma clang diagnostic ignored "-Wdeprecated-redundant-constexpr-static-def"
0168 #pragma clang diagnostic ignored "-Wdeprecated"
0169 constexpr std::string_view edm4eic::RawCALOROCHit::typeName;
0170 #pragma clang diagnostic pop
0171 #elif defined(__GNUC__)
0172 #pragma GCC diagnostic push
0173 #pragma GCC diagnostic ignored "-Wdeprecated"
0174 constexpr std::string_view edm4eic::RawCALOROCHit::typeName;
0175 #pragma GCC diagnostic pop
0176 #endif
0177
0178
0179 #endif