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