File indexing completed on 2025-09-16 08:53:22
0001
0002
0003 #ifndef EDM4EIC_CherenkovParticleID_H
0004 #define EDM4EIC_CherenkovParticleID_H
0005
0006 #include "edm4eic/CherenkovParticleIDObj.h"
0007
0008 #include "edm4eic/CherenkovParticleIDHypothesis.h"
0009 #include "edm4eic/MCRecoTrackerHitAssociation.h"
0010 #include "podio/RelationRange.h"
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 CherenkovParticleIDCollection;
0026 class TrackSegment;
0027 class MutableTrackSegment;
0028 }
0029
0030
0031 namespace podio::detail {
0032
0033 OrderKey getOrderKey(const edm4eic::CherenkovParticleID& obj);
0034 };
0035
0036 namespace edm4eic {
0037
0038 class MutableCherenkovParticleID;
0039 class CherenkovParticleIDCollection;
0040 class CherenkovParticleIDCollectionData;
0041
0042
0043
0044
0045
0046 class CherenkovParticleID {
0047
0048 friend class MutableCherenkovParticleID;
0049 friend class CherenkovParticleIDCollection;
0050 friend class edm4eic::CherenkovParticleIDCollectionData;
0051 friend class CherenkovParticleIDCollectionIterator;
0052 friend podio::detail::OrderKey podio::detail::getOrderKey(const CherenkovParticleID & obj);
0053
0054 public:
0055 using mutable_type = MutableCherenkovParticleID;
0056 using collection_type = CherenkovParticleIDCollection;
0057
0058
0059 CherenkovParticleID();
0060
0061
0062 CherenkovParticleID(const float npe, const float refractiveIndex, const float photonEnergy);
0063
0064
0065 CherenkovParticleID(const CherenkovParticleID& other) = default;
0066
0067
0068 CherenkovParticleID& operator=(CherenkovParticleID other) &;
0069 CherenkovParticleID& operator=(CherenkovParticleID other) && = delete;
0070
0071
0072
0073 MutableCherenkovParticleID clone(bool cloneRelations=true) const;
0074
0075
0076 ~CherenkovParticleID() = default;
0077
0078
0079 CherenkovParticleID(const MutableCherenkovParticleID& other);
0080
0081 static CherenkovParticleID makeEmpty();
0082
0083 public:
0084
0085 static constexpr std::string_view typeName = "edm4eic::CherenkovParticleID";
0086
0087
0088 float getNpe() const;
0089
0090
0091 float getRefractiveIndex() const;
0092
0093
0094 float getPhotonEnergy() const;
0095
0096
0097
0098 const edm4eic::TrackSegment getChargedParticle() const;
0099
0100 std::size_t rawHitAssociations_size() const;
0101 edm4eic::MCRecoTrackerHitAssociation getRawHitAssociations(std::size_t) const;
0102 std::vector<edm4eic::MCRecoTrackerHitAssociation>::const_iterator rawHitAssociations_begin() const;
0103 std::vector<edm4eic::MCRecoTrackerHitAssociation>::const_iterator rawHitAssociations_end() const;
0104 podio::RelationRange<edm4eic::MCRecoTrackerHitAssociation> getRawHitAssociations() const;
0105 std::size_t hypotheses_size() const;
0106 edm4eic::CherenkovParticleIDHypothesis getHypotheses(std::size_t) const;
0107 std::vector<edm4eic::CherenkovParticleIDHypothesis>::const_iterator hypotheses_begin() const;
0108 std::vector<edm4eic::CherenkovParticleIDHypothesis>::const_iterator hypotheses_end() const;
0109 podio::RelationRange<edm4eic::CherenkovParticleIDHypothesis> getHypotheses() const;
0110 std::size_t thetaPhiPhotons_size() const;
0111 edm4hep::Vector2f getThetaPhiPhotons(std::size_t) const;
0112 std::vector<edm4hep::Vector2f>::const_iterator thetaPhiPhotons_begin() const;
0113 std::vector<edm4hep::Vector2f>::const_iterator thetaPhiPhotons_end() const;
0114 podio::RelationRange<edm4hep::Vector2f> getThetaPhiPhotons() const;
0115
0116
0117
0118 bool isAvailable() const;
0119
0120 void unlink() { m_obj = podio::utils::MaybeSharedPtr<CherenkovParticleIDObj>{nullptr}; }
0121
0122 bool operator==(const CherenkovParticleID& other) const { return m_obj == other.m_obj; }
0123 bool operator==(const MutableCherenkovParticleID& other) const;
0124
0125 bool operator!=(const CherenkovParticleID& other) const { return !(*this == other); }
0126 bool operator!=(const MutableCherenkovParticleID& other) const { return !(*this == other); }
0127
0128
0129 bool operator<(const CherenkovParticleID& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
0130
0131 podio::ObjectID id() const { return getObjectID(); }
0132
0133 const podio::ObjectID getObjectID() const;
0134
0135 friend std::hash<CherenkovParticleID>;
0136
0137 friend void swap(CherenkovParticleID& a, CherenkovParticleID& b) {
0138 using std::swap;
0139 swap(a.m_obj, b.m_obj);
0140 }
0141
0142 private:
0143
0144 explicit CherenkovParticleID(podio::utils::MaybeSharedPtr<CherenkovParticleIDObj> obj);
0145 CherenkovParticleID(CherenkovParticleIDObj* obj);
0146
0147 podio::utils::MaybeSharedPtr<CherenkovParticleIDObj> m_obj{nullptr};
0148 };
0149
0150 std::ostream& operator<<(std::ostream& o, const CherenkovParticleID& value);
0151
0152 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0153 void to_json(nlohmann::json& j, const CherenkovParticleID& value);
0154 #endif
0155
0156
0157 }
0158
0159
0160
0161 template<>
0162 struct std::hash<edm4eic::CherenkovParticleID> {
0163 std::size_t operator()(const edm4eic::CherenkovParticleID& obj) const {
0164 return std::hash<edm4eic::CherenkovParticleIDObj*>{}(obj.m_obj.get());
0165 }
0166 };
0167
0168
0169
0170
0171
0172 #if defined(__clang__)
0173 #pragma clang diagnostic push
0174 #pragma clang diagnostic ignored "-Wunknown-warning-option"
0175 #pragma clang diagnostic ignored "-Wdeprecated-redundant-constexpr-static-def"
0176 #pragma clang diagnostic ignored "-Wdeprecated"
0177 constexpr std::string_view edm4eic::CherenkovParticleID::typeName;
0178 #pragma clang diagnostic pop
0179 #elif defined(__GNUC__)
0180 #pragma GCC diagnostic push
0181 #pragma GCC diagnostic ignored "-Wdeprecated"
0182 constexpr std::string_view edm4eic::CherenkovParticleID::typeName;
0183 #pragma GCC diagnostic pop
0184 #endif
0185
0186 #endif