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