File indexing completed on 2025-07-14 08:50:40
0001
0002
0003 #ifndef EDM4EIC_PMTHit_H
0004 #define EDM4EIC_PMTHit_H
0005
0006 #include "edm4eic/PMTHitObj.h"
0007
0008 #include "edm4hep/Vector3f.h"
0009 #include <cstdint>
0010
0011 #include "podio/utilities/MaybeSharedPtr.h"
0012 #include "podio/detail/OrderKey.h"
0013
0014 #include <ostream>
0015 #include <cstdint>
0016
0017 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0018 #include "nlohmann/json_fwd.hpp"
0019 #endif
0020
0021
0022 namespace edm4eic {
0023 class PMTHitCollection;
0024 }
0025
0026
0027 namespace podio::detail {
0028
0029 OrderKey getOrderKey(const edm4eic::PMTHit& obj);
0030 };
0031
0032 namespace edm4eic {
0033
0034 class MutablePMTHit;
0035 class PMTHitCollection;
0036 class PMTHitCollectionData;
0037
0038
0039
0040
0041
0042 class PMTHit {
0043
0044 friend class MutablePMTHit;
0045 friend class PMTHitCollection;
0046 friend class edm4eic::PMTHitCollectionData;
0047 friend class PMTHitCollectionIterator;
0048 friend podio::detail::OrderKey podio::detail::getOrderKey(const PMTHit & obj);
0049
0050 public:
0051 using mutable_type = MutablePMTHit;
0052 using collection_type = PMTHitCollection;
0053
0054
0055 PMTHit();
0056
0057
0058 PMTHit(std::uint64_t cellID, float npe, float time, float timeError, edm4hep::Vector3f position, edm4hep::Vector3f dimension, std::int32_t sector, edm4hep::Vector3f local);
0059
0060
0061 PMTHit(const PMTHit& other) = default;
0062
0063
0064 PMTHit& operator=(PMTHit other);
0065
0066
0067
0068 MutablePMTHit clone(bool cloneRelations=true) const;
0069
0070
0071 ~PMTHit() = default;
0072
0073
0074 PMTHit(const MutablePMTHit& other);
0075
0076 static PMTHit makeEmpty();
0077
0078 public:
0079
0080 static constexpr auto typeName = "edm4eic::PMTHit";
0081
0082
0083 std::uint64_t getCellID() const;
0084
0085
0086 float getNpe() const;
0087
0088
0089 float getTime() const;
0090
0091
0092 float getTimeError() const;
0093
0094
0095 const edm4hep::Vector3f& getPosition() const;
0096
0097
0098 const edm4hep::Vector3f& getDimension() const;
0099
0100
0101 std::int32_t getSector() const;
0102
0103
0104 const edm4hep::Vector3f& getLocal() const;
0105
0106
0107
0108
0109
0110
0111 bool isAvailable() const;
0112
0113 void unlink() { m_obj = podio::utils::MaybeSharedPtr<PMTHitObj>{nullptr}; }
0114
0115 bool operator==(const PMTHit& other) const { return m_obj == other.m_obj; }
0116 bool operator==(const MutablePMTHit& other) const;
0117
0118 bool operator!=(const PMTHit& other) const { return !(*this == other); }
0119 bool operator!=(const MutablePMTHit& other) const { return !(*this == other); }
0120
0121
0122 bool operator<(const PMTHit& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
0123
0124 podio::ObjectID id() const { return getObjectID(); }
0125
0126 const podio::ObjectID getObjectID() const;
0127
0128 friend void swap(PMTHit& a, PMTHit& b) {
0129 using std::swap;
0130 swap(a.m_obj, b.m_obj);
0131 }
0132
0133 private:
0134
0135 explicit PMTHit(podio::utils::MaybeSharedPtr<PMTHitObj> obj);
0136 PMTHit(PMTHitObj* obj);
0137
0138 podio::utils::MaybeSharedPtr<PMTHitObj> m_obj{nullptr};
0139 };
0140
0141 std::ostream& operator<<(std::ostream& o, const PMTHit& value);
0142
0143 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0144 void to_json(nlohmann::json& j, const PMTHit& value);
0145 #endif
0146
0147
0148 }
0149
0150
0151 #endif