File indexing completed on 2025-09-18 09:10:47
0001
0002
0003 #ifndef EDM4EIC_TrackParameters_H
0004 #define EDM4EIC_TrackParameters_H
0005
0006 #include "edm4eic/TrackParametersObj.h"
0007
0008 #include "edm4eic/Cov6f.h"
0009 #include "edm4hep/Vector2f.h"
0010 #include <cstdint>
0011
0012 #include "podio/utilities/MaybeSharedPtr.h"
0013 #include "podio/detail/OrderKey.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 TrackParametersCollection;
0025 }
0026
0027
0028 namespace podio::detail {
0029
0030 OrderKey getOrderKey(const edm4eic::TrackParameters& obj);
0031 };
0032
0033 namespace edm4eic {
0034
0035 class MutableTrackParameters;
0036 class TrackParametersCollection;
0037 class TrackParametersCollectionData;
0038
0039
0040
0041
0042
0043 class TrackParameters {
0044
0045 friend class MutableTrackParameters;
0046 friend class TrackParametersCollection;
0047 friend class edm4eic::TrackParametersCollectionData;
0048 friend class TrackParametersCollectionIterator;
0049 friend podio::detail::OrderKey podio::detail::getOrderKey(const TrackParameters & obj);
0050
0051 public:
0052 using mutable_type = MutableTrackParameters;
0053 using collection_type = TrackParametersCollection;
0054
0055
0056 TrackParameters();
0057
0058
0059 TrackParameters(const std::int32_t type, const std::uint64_t surface, const edm4hep::Vector2f& loc, const float theta, const float phi, const float qOverP, const float time, const std::int32_t pdg, const edm4eic::Cov6f& covariance);
0060
0061
0062 TrackParameters(const TrackParameters& other) = default;
0063
0064
0065 TrackParameters& operator=(TrackParameters other) &;
0066 TrackParameters& operator=(TrackParameters other) && = delete;
0067
0068
0069
0070 MutableTrackParameters clone(bool cloneRelations=true) const;
0071
0072
0073 ~TrackParameters() = default;
0074
0075
0076 TrackParameters(const MutableTrackParameters& other);
0077
0078 static TrackParameters makeEmpty();
0079
0080 public:
0081
0082 static constexpr std::string_view typeName = "edm4eic::TrackParameters";
0083
0084
0085 std::int32_t getType() const;
0086
0087
0088 std::uint64_t getSurface() const;
0089
0090
0091 const edm4hep::Vector2f& getLoc() const;
0092
0093
0094 float getTheta() const;
0095
0096
0097 float getPhi() const;
0098
0099
0100 float getQOverP() const;
0101
0102
0103 float getTime() const;
0104
0105
0106 std::int32_t getPdg() const;
0107
0108
0109 const edm4eic::Cov6f& getCovariance() const;
0110
0111
0112
0113
0114
0115
0116 bool isAvailable() const;
0117
0118 void unlink() { m_obj = podio::utils::MaybeSharedPtr<TrackParametersObj>{nullptr}; }
0119
0120 bool operator==(const TrackParameters& other) const { return m_obj == other.m_obj; }
0121 bool operator==(const MutableTrackParameters& other) const;
0122
0123 bool operator!=(const TrackParameters& other) const { return !(*this == other); }
0124 bool operator!=(const MutableTrackParameters& other) const { return !(*this == other); }
0125
0126
0127 bool operator<(const TrackParameters& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
0128
0129 podio::ObjectID id() const { return getObjectID(); }
0130
0131 const podio::ObjectID getObjectID() const;
0132
0133 friend std::hash<TrackParameters>;
0134
0135 friend void swap(TrackParameters& a, TrackParameters& b) {
0136 using std::swap;
0137 swap(a.m_obj, b.m_obj);
0138 }
0139
0140 private:
0141
0142 explicit TrackParameters(podio::utils::MaybeSharedPtr<TrackParametersObj> obj);
0143 TrackParameters(TrackParametersObj* obj);
0144
0145 podio::utils::MaybeSharedPtr<TrackParametersObj> m_obj{nullptr};
0146 };
0147
0148 std::ostream& operator<<(std::ostream& o, const TrackParameters& value);
0149
0150 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0151 void to_json(nlohmann::json& j, const TrackParameters& value);
0152 #endif
0153
0154
0155 }
0156
0157
0158
0159 template<>
0160 struct std::hash<edm4eic::TrackParameters> {
0161 std::size_t operator()(const edm4eic::TrackParameters& obj) const {
0162 return std::hash<edm4eic::TrackParametersObj*>{}(obj.m_obj.get());
0163 }
0164 };
0165
0166
0167
0168
0169
0170 #if defined(__clang__)
0171 #pragma clang diagnostic push
0172 #pragma clang diagnostic ignored "-Wunknown-warning-option"
0173 #pragma clang diagnostic ignored "-Wdeprecated-redundant-constexpr-static-def"
0174 #pragma clang diagnostic ignored "-Wdeprecated"
0175 constexpr std::string_view edm4eic::TrackParameters::typeName;
0176 #pragma clang diagnostic pop
0177 #elif defined(__GNUC__)
0178 #pragma GCC diagnostic push
0179 #pragma GCC diagnostic ignored "-Wdeprecated"
0180 constexpr std::string_view edm4eic::TrackParameters::typeName;
0181 #pragma GCC diagnostic pop
0182 #endif
0183
0184 #endif