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