File indexing completed on 2025-01-18 09:55:40
0001
0002
0003 #ifndef EDM4HEP_TrackerPulse_H
0004 #define EDM4HEP_TrackerPulse_H
0005
0006 #include "edm4hep/TrackerPulseObj.h"
0007
0008 #include <array>
0009 #include <cstdint>
0010
0011 #include "podio/utilities/MaybeSharedPtr.h"
0012
0013 #include <cstdint>
0014 #include <ostream>
0015
0016 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0017 #include "nlohmann/json_fwd.hpp"
0018 #endif
0019
0020
0021 namespace edm4hep {
0022 class TimeSeries;
0023 class MutableTimeSeries;
0024 }
0025
0026 namespace edm4hep {
0027
0028 class MutableTrackerPulse;
0029 class TrackerPulseCollection;
0030 class TrackerPulseCollectionData;
0031
0032
0033
0034
0035
0036 class TrackerPulse {
0037
0038 friend class MutableTrackerPulse;
0039 friend class TrackerPulseCollection;
0040 friend class edm4hep::TrackerPulseCollectionData;
0041 friend class TrackerPulseCollectionIterator;
0042
0043 public:
0044 using mutable_type = MutableTrackerPulse;
0045 using collection_type = TrackerPulseCollection;
0046
0047
0048 TrackerPulse();
0049
0050
0051 TrackerPulse(std::uint64_t cellID, float time, float charge, std::int16_t quality, std::array<float, 3> covMatrix);
0052
0053
0054 TrackerPulse(const TrackerPulse& other) = default;
0055
0056
0057 TrackerPulse& operator=(TrackerPulse other);
0058
0059
0060
0061 MutableTrackerPulse clone(bool cloneRelations = true) const;
0062
0063
0064 ~TrackerPulse() = default;
0065
0066
0067 TrackerPulse(const MutableTrackerPulse& other);
0068
0069 static TrackerPulse makeEmpty();
0070
0071 public:
0072
0073 std::uint64_t getCellID() const;
0074
0075
0076 float getTime() const;
0077
0078
0079 float getCharge() const;
0080
0081
0082 std::int16_t getQuality() const;
0083
0084
0085 const std::array<float, 3>& getCovMatrix() const;
0086
0087 float getCovMatrix(size_t i) const;
0088
0089
0090 const edm4hep::TimeSeries getTimeSeries() const;
0091
0092
0093 bool isAvailable() const;
0094
0095 void unlink() {
0096 m_obj = podio::utils::MaybeSharedPtr<TrackerPulseObj>{nullptr};
0097 }
0098
0099 bool operator==(const TrackerPulse& other) const {
0100 return m_obj == other.m_obj;
0101 }
0102 bool operator==(const MutableTrackerPulse& other) const;
0103
0104 bool operator!=(const TrackerPulse& other) const {
0105 return !(*this == other);
0106 }
0107 bool operator!=(const MutableTrackerPulse& other) const {
0108 return !(*this == other);
0109 }
0110
0111
0112 bool operator<(const TrackerPulse& other) const {
0113 return m_obj < other.m_obj;
0114 }
0115
0116 podio::ObjectID id() const {
0117 return getObjectID();
0118 }
0119
0120 const podio::ObjectID getObjectID() const;
0121
0122 friend void swap(TrackerPulse& a, TrackerPulse& b) {
0123 using std::swap;
0124 swap(a.m_obj, b.m_obj);
0125 }
0126
0127 private:
0128
0129 explicit TrackerPulse(podio::utils::MaybeSharedPtr<TrackerPulseObj> obj);
0130 TrackerPulse(TrackerPulseObj* obj);
0131
0132 podio::utils::MaybeSharedPtr<TrackerPulseObj> m_obj{nullptr};
0133 };
0134
0135 std::ostream& operator<<(std::ostream& o, const TrackerPulse& value);
0136
0137 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0138 void to_json(nlohmann::json& j, const TrackerPulse& value);
0139 #endif
0140
0141 }
0142
0143 #endif