File indexing completed on 2025-09-18 09:10:43
0001
0002
0003 #ifndef EDM4EIC_MutableTrackParameters_H
0004 #define EDM4EIC_MutableTrackParameters_H
0005
0006 #include "edm4eic/TrackParametersObj.h"
0007
0008 #include "edm4eic/TrackParameters.h"
0009
0010 #include "edm4eic/Cov6f.h"
0011 #include "edm4hep/Vector2f.h"
0012 #include <cstdint>
0013
0014 #include "podio/utilities/MaybeSharedPtr.h"
0015
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 edm4eic {
0029
0030
0031
0032
0033
0034
0035 class MutableTrackParameters {
0036
0037 friend class TrackParametersCollection;
0038 friend class TrackParametersMutableCollectionIterator;
0039 friend class TrackParameters;
0040
0041 public:
0042 using object_type = TrackParameters;
0043 using collection_type = TrackParametersCollection;
0044
0045
0046 MutableTrackParameters();
0047
0048
0049 MutableTrackParameters(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);
0050
0051
0052 MutableTrackParameters(const MutableTrackParameters& other) = default;
0053
0054
0055 MutableTrackParameters& operator=(MutableTrackParameters other) &;
0056 MutableTrackParameters& operator=(MutableTrackParameters other) && = delete;
0057
0058
0059
0060 MutableTrackParameters clone(bool cloneRelations=true) const;
0061
0062
0063 ~MutableTrackParameters() = default;
0064
0065
0066 public:
0067
0068
0069 std::int32_t getType() const;
0070
0071
0072 std::uint64_t getSurface() const;
0073
0074
0075 const edm4hep::Vector2f& getLoc() const;
0076
0077
0078 float getTheta() const;
0079
0080
0081 float getPhi() const;
0082
0083
0084 float getQOverP() const;
0085
0086
0087 float getTime() const;
0088
0089
0090 std::int32_t getPdg() const;
0091
0092
0093 const edm4eic::Cov6f& getCovariance() const;
0094
0095
0096
0097
0098 void setType(const std::int32_t type);
0099
0100 std::int32_t& getType();
0101
0102 [[deprecated("use getType instead")]]
0103 std::int32_t& type();
0104
0105
0106 void setSurface(const std::uint64_t surface);
0107
0108 std::uint64_t& getSurface();
0109
0110 [[deprecated("use getSurface instead")]]
0111 std::uint64_t& surface();
0112
0113
0114 void setLoc(const edm4hep::Vector2f& loc);
0115
0116 edm4hep::Vector2f& getLoc();
0117
0118 [[deprecated("use getLoc instead")]]
0119 edm4hep::Vector2f& loc();
0120
0121
0122 void setTheta(const float theta);
0123
0124 float& getTheta();
0125
0126 [[deprecated("use getTheta instead")]]
0127 float& theta();
0128
0129
0130 void setPhi(const float phi);
0131
0132 float& getPhi();
0133
0134 [[deprecated("use getPhi instead")]]
0135 float& phi();
0136
0137
0138 void setQOverP(const float qOverP);
0139
0140 float& getQOverP();
0141
0142 [[deprecated("use getQOverP instead")]]
0143 float& qOverP();
0144
0145
0146 void setTime(const float time);
0147
0148 float& getTime();
0149
0150 [[deprecated("use getTime instead")]]
0151 float& time();
0152
0153
0154 void setPdg(const std::int32_t pdg);
0155
0156 std::int32_t& getPdg();
0157
0158 [[deprecated("use getPdg instead")]]
0159 std::int32_t& pdg();
0160
0161
0162 void setCovariance(const edm4eic::Cov6f& covariance);
0163
0164 edm4eic::Cov6f& getCovariance();
0165
0166 [[deprecated("use getCovariance instead")]]
0167 edm4eic::Cov6f& covariance();
0168
0169
0170
0171
0172
0173
0174
0175 bool isAvailable() const;
0176
0177 void unlink() { m_obj = podio::utils::MaybeSharedPtr<TrackParametersObj>{nullptr}; }
0178
0179 bool operator==(const MutableTrackParameters& other) const { return m_obj == other.m_obj; }
0180 bool operator==(const TrackParameters& other) const;
0181
0182 bool operator!=(const MutableTrackParameters& other) const { return !(*this == other); }
0183 bool operator!=(const TrackParameters& other) const { return !(*this == other); }
0184
0185
0186 bool operator<(const MutableTrackParameters& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
0187
0188 podio::ObjectID id() const { return getObjectID(); }
0189
0190 const podio::ObjectID getObjectID() const;
0191
0192 friend std::hash<MutableTrackParameters>;
0193
0194 friend void swap(MutableTrackParameters& a, MutableTrackParameters& b) {
0195 using std::swap;
0196 swap(a.m_obj, b.m_obj);
0197 }
0198
0199 private:
0200
0201 explicit MutableTrackParameters(podio::utils::MaybeSharedPtr<TrackParametersObj> obj);
0202
0203 podio::utils::MaybeSharedPtr<TrackParametersObj> m_obj{nullptr};
0204 };
0205
0206 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0207 void to_json(nlohmann::json& j, const MutableTrackParameters& value);
0208 #endif
0209
0210
0211 }
0212
0213
0214
0215 template<>
0216 struct std::hash<edm4eic::MutableTrackParameters> {
0217 std::size_t operator()(const edm4eic::MutableTrackParameters& obj) const {
0218 return std::hash<edm4eic::TrackParametersObj*>{}(obj.m_obj.get());
0219 }
0220 };
0221
0222
0223 #endif