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