File indexing completed on 2025-01-18 09:55:30
0001
0002
0003 #ifndef EDM4EIC_MutablePMTHit_H
0004 #define EDM4EIC_MutablePMTHit_H
0005
0006 #include "edm4eic/PMTHitObj.h"
0007
0008 #include "edm4eic/PMTHit.h"
0009
0010 #include "edm4hep/Vector3f.h"
0011 #include <cstdint>
0012
0013 #include "podio/utilities/MaybeSharedPtr.h"
0014
0015 #include <cstdint>
0016
0017 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0018 #include "nlohmann/json_fwd.hpp"
0019 #endif
0020
0021
0022
0023 namespace edm4eic {
0024
0025
0026
0027
0028
0029
0030 class MutablePMTHit {
0031
0032 friend class PMTHitCollection;
0033 friend class PMTHitMutableCollectionIterator;
0034 friend class PMTHit;
0035
0036 public:
0037 using object_type = PMTHit;
0038 using collection_type = PMTHitCollection;
0039
0040
0041 MutablePMTHit();
0042
0043
0044 MutablePMTHit(std::uint64_t cellID, float npe, float time, float timeError, edm4hep::Vector3f position, edm4hep::Vector3f dimension, std::int32_t sector, edm4hep::Vector3f local);
0045
0046
0047 MutablePMTHit(const MutablePMTHit& other) = default;
0048
0049
0050 MutablePMTHit& operator=(MutablePMTHit other);
0051
0052
0053
0054 MutablePMTHit clone(bool cloneRelations=true) const;
0055
0056
0057 ~MutablePMTHit() = default;
0058
0059
0060 public:
0061
0062
0063 std::uint64_t getCellID() const;
0064
0065
0066 float getNpe() const;
0067
0068
0069 float getTime() const;
0070
0071
0072 float getTimeError() const;
0073
0074
0075 const edm4hep::Vector3f& getPosition() const;
0076
0077
0078 const edm4hep::Vector3f& getDimension() const;
0079
0080
0081 std::int32_t getSector() const;
0082
0083
0084 const edm4hep::Vector3f& getLocal() const;
0085
0086
0087
0088
0089 void setCellID(std::uint64_t value);
0090
0091 std::uint64_t& getCellID();
0092
0093 [[deprecated("use getCellID instead")]]
0094 std::uint64_t& cellID();
0095
0096
0097 void setNpe(float value);
0098
0099 float& getNpe();
0100
0101 [[deprecated("use getNpe instead")]]
0102 float& npe();
0103
0104
0105 void setTime(float value);
0106
0107 float& getTime();
0108
0109 [[deprecated("use getTime instead")]]
0110 float& time();
0111
0112
0113 void setTimeError(float value);
0114
0115 float& getTimeError();
0116
0117 [[deprecated("use getTimeError instead")]]
0118 float& timeError();
0119
0120
0121 void setPosition(edm4hep::Vector3f value);
0122
0123 edm4hep::Vector3f& getPosition();
0124
0125 [[deprecated("use getPosition instead")]]
0126 edm4hep::Vector3f& position();
0127
0128
0129 void setDimension(edm4hep::Vector3f value);
0130
0131 edm4hep::Vector3f& getDimension();
0132
0133 [[deprecated("use getDimension instead")]]
0134 edm4hep::Vector3f& dimension();
0135
0136
0137 void setSector(std::int32_t value);
0138
0139 std::int32_t& getSector();
0140
0141 [[deprecated("use getSector instead")]]
0142 std::int32_t& sector();
0143
0144
0145 void setLocal(edm4hep::Vector3f value);
0146
0147 edm4hep::Vector3f& getLocal();
0148
0149 [[deprecated("use getLocal instead")]]
0150 edm4hep::Vector3f& local();
0151
0152
0153
0154
0155
0156
0157
0158 bool isAvailable() const;
0159
0160 void unlink() { m_obj = podio::utils::MaybeSharedPtr<PMTHitObj>{nullptr}; }
0161
0162 bool operator==(const MutablePMTHit& other) const { return m_obj == other.m_obj; }
0163 bool operator==(const PMTHit& other) const;
0164
0165 bool operator!=(const MutablePMTHit& other) const { return !(*this == other); }
0166 bool operator!=(const PMTHit& other) const { return !(*this == other); }
0167
0168
0169 bool operator<(const MutablePMTHit& other) const { return m_obj < other.m_obj; }
0170
0171 podio::ObjectID id() const { return getObjectID(); }
0172
0173 const podio::ObjectID getObjectID() const;
0174
0175 friend void swap(MutablePMTHit& a, MutablePMTHit& b) {
0176 using std::swap;
0177 swap(a.m_obj, b.m_obj);
0178 }
0179
0180 private:
0181
0182 explicit MutablePMTHit(podio::utils::MaybeSharedPtr<PMTHitObj> obj);
0183
0184 podio::utils::MaybeSharedPtr<PMTHitObj> m_obj{nullptr};
0185 };
0186
0187 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0188 void to_json(nlohmann::json& j, const MutablePMTHit& value);
0189 #endif
0190
0191
0192 }
0193
0194
0195 #endif