File indexing completed on 2025-07-11 08:30:05
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(float npe, float refractiveIndex, float photonEnergy);
0063
0064
0065 CherenkovParticleID(const CherenkovParticleID& other) = default;
0066
0067
0068 CherenkovParticleID& operator=(CherenkovParticleID other);
0069
0070
0071
0072 MutableCherenkovParticleID clone(bool cloneRelations=true) const;
0073
0074
0075 ~CherenkovParticleID() = default;
0076
0077
0078 CherenkovParticleID(const MutableCherenkovParticleID& other);
0079
0080 static CherenkovParticleID makeEmpty();
0081
0082 public:
0083
0084 static constexpr auto typeName = "edm4eic::CherenkovParticleID";
0085
0086
0087 float getNpe() const;
0088
0089
0090 float getRefractiveIndex() const;
0091
0092
0093 float getPhotonEnergy() const;
0094
0095
0096
0097 const edm4eic::TrackSegment getChargedParticle() const;
0098
0099 std::size_t rawHitAssociations_size() const;
0100 edm4eic::MCRecoTrackerHitAssociation getRawHitAssociations(std::size_t) const;
0101 std::vector<edm4eic::MCRecoTrackerHitAssociation>::const_iterator rawHitAssociations_begin() const;
0102 std::vector<edm4eic::MCRecoTrackerHitAssociation>::const_iterator rawHitAssociations_end() const;
0103 podio::RelationRange<edm4eic::MCRecoTrackerHitAssociation> getRawHitAssociations() const;
0104 std::size_t hypotheses_size() const;
0105 edm4eic::CherenkovParticleIDHypothesis getHypotheses(std::size_t) const;
0106 std::vector<edm4eic::CherenkovParticleIDHypothesis>::const_iterator hypotheses_begin() const;
0107 std::vector<edm4eic::CherenkovParticleIDHypothesis>::const_iterator hypotheses_end() const;
0108 podio::RelationRange<edm4eic::CherenkovParticleIDHypothesis> getHypotheses() const;
0109 std::size_t thetaPhiPhotons_size() const;
0110 edm4hep::Vector2f getThetaPhiPhotons(std::size_t) const;
0111 std::vector<edm4hep::Vector2f>::const_iterator thetaPhiPhotons_begin() const;
0112 std::vector<edm4hep::Vector2f>::const_iterator thetaPhiPhotons_end() const;
0113 podio::RelationRange<edm4hep::Vector2f> getThetaPhiPhotons() const;
0114
0115
0116
0117 bool isAvailable() const;
0118
0119 void unlink() { m_obj = podio::utils::MaybeSharedPtr<CherenkovParticleIDObj>{nullptr}; }
0120
0121 bool operator==(const CherenkovParticleID& other) const { return m_obj == other.m_obj; }
0122 bool operator==(const MutableCherenkovParticleID& other) const;
0123
0124 bool operator!=(const CherenkovParticleID& other) const { return !(*this == other); }
0125 bool operator!=(const MutableCherenkovParticleID& other) const { return !(*this == other); }
0126
0127
0128 bool operator<(const CherenkovParticleID& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
0129
0130 podio::ObjectID id() const { return getObjectID(); }
0131
0132 const podio::ObjectID getObjectID() const;
0133
0134 friend void swap(CherenkovParticleID& a, CherenkovParticleID& b) {
0135 using std::swap;
0136 swap(a.m_obj, b.m_obj);
0137 }
0138
0139 private:
0140
0141 explicit CherenkovParticleID(podio::utils::MaybeSharedPtr<CherenkovParticleIDObj> obj);
0142 CherenkovParticleID(CherenkovParticleIDObj* obj);
0143
0144 podio::utils::MaybeSharedPtr<CherenkovParticleIDObj> m_obj{nullptr};
0145 };
0146
0147 std::ostream& operator<<(std::ostream& o, const CherenkovParticleID& value);
0148
0149 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0150 void to_json(nlohmann::json& j, const CherenkovParticleID& value);
0151 #endif
0152
0153
0154 }
0155
0156
0157 #endif