File indexing completed on 2025-01-18 09:55:28
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
0015 #include <ostream>
0016 #include <cstdint>
0017
0018 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0019 #include "nlohmann/json_fwd.hpp"
0020 #endif
0021
0022
0023 namespace edm4eic {
0024 class TrackSegment;
0025 class MutableTrackSegment;
0026 }
0027
0028
0029 namespace edm4eic {
0030
0031 class MutableCherenkovParticleID;
0032 class CherenkovParticleIDCollection;
0033 class CherenkovParticleIDCollectionData;
0034
0035
0036
0037
0038
0039 class CherenkovParticleID {
0040
0041 friend class MutableCherenkovParticleID;
0042 friend class CherenkovParticleIDCollection;
0043 friend class edm4eic::CherenkovParticleIDCollectionData;
0044 friend class CherenkovParticleIDCollectionIterator;
0045
0046 public:
0047 using mutable_type = MutableCherenkovParticleID;
0048 using collection_type = CherenkovParticleIDCollection;
0049
0050
0051 CherenkovParticleID();
0052
0053
0054 CherenkovParticleID(float npe, float refractiveIndex, float photonEnergy);
0055
0056
0057 CherenkovParticleID(const CherenkovParticleID& other) = default;
0058
0059
0060 CherenkovParticleID& operator=(CherenkovParticleID other);
0061
0062
0063
0064 MutableCherenkovParticleID clone(bool cloneRelations=true) const;
0065
0066
0067 ~CherenkovParticleID() = default;
0068
0069
0070 CherenkovParticleID(const MutableCherenkovParticleID& other);
0071
0072 static CherenkovParticleID makeEmpty();
0073
0074 public:
0075
0076
0077 float getNpe() const;
0078
0079
0080 float getRefractiveIndex() const;
0081
0082
0083 float getPhotonEnergy() const;
0084
0085
0086
0087 const edm4eic::TrackSegment getChargedParticle() const;
0088
0089 std::size_t rawHitAssociations_size() const;
0090 edm4eic::MCRecoTrackerHitAssociation getRawHitAssociations(std::size_t) const;
0091 std::vector<edm4eic::MCRecoTrackerHitAssociation>::const_iterator rawHitAssociations_begin() const;
0092 std::vector<edm4eic::MCRecoTrackerHitAssociation>::const_iterator rawHitAssociations_end() const;
0093 podio::RelationRange<edm4eic::MCRecoTrackerHitAssociation> getRawHitAssociations() const;
0094 std::size_t hypotheses_size() const;
0095 edm4eic::CherenkovParticleIDHypothesis getHypotheses(std::size_t) const;
0096 std::vector<edm4eic::CherenkovParticleIDHypothesis>::const_iterator hypotheses_begin() const;
0097 std::vector<edm4eic::CherenkovParticleIDHypothesis>::const_iterator hypotheses_end() const;
0098 podio::RelationRange<edm4eic::CherenkovParticleIDHypothesis> getHypotheses() const;
0099 std::size_t thetaPhiPhotons_size() const;
0100 edm4hep::Vector2f getThetaPhiPhotons(std::size_t) const;
0101 std::vector<edm4hep::Vector2f>::const_iterator thetaPhiPhotons_begin() const;
0102 std::vector<edm4hep::Vector2f>::const_iterator thetaPhiPhotons_end() const;
0103 podio::RelationRange<edm4hep::Vector2f> getThetaPhiPhotons() const;
0104
0105
0106
0107 bool isAvailable() const;
0108
0109 void unlink() { m_obj = podio::utils::MaybeSharedPtr<CherenkovParticleIDObj>{nullptr}; }
0110
0111 bool operator==(const CherenkovParticleID& other) const { return m_obj == other.m_obj; }
0112 bool operator==(const MutableCherenkovParticleID& other) const;
0113
0114 bool operator!=(const CherenkovParticleID& other) const { return !(*this == other); }
0115 bool operator!=(const MutableCherenkovParticleID& other) const { return !(*this == other); }
0116
0117
0118 bool operator<(const CherenkovParticleID& other) const { return m_obj < other.m_obj; }
0119
0120 podio::ObjectID id() const { return getObjectID(); }
0121
0122 const podio::ObjectID getObjectID() const;
0123
0124 friend void swap(CherenkovParticleID& a, CherenkovParticleID& b) {
0125 using std::swap;
0126 swap(a.m_obj, b.m_obj);
0127 }
0128
0129 private:
0130
0131 explicit CherenkovParticleID(podio::utils::MaybeSharedPtr<CherenkovParticleIDObj> obj);
0132 CherenkovParticleID(CherenkovParticleIDObj* obj);
0133
0134 podio::utils::MaybeSharedPtr<CherenkovParticleIDObj> m_obj{nullptr};
0135 };
0136
0137 std::ostream& operator<<(std::ostream& o, const CherenkovParticleID& value);
0138
0139 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0140 void to_json(nlohmann::json& j, const CherenkovParticleID& value);
0141 #endif
0142
0143
0144 }
0145
0146
0147 #endif