File indexing completed on 2025-01-18 09:55:37
0001
0002
0003 #ifndef EDM4HEP_MutableTrack_H
0004 #define EDM4HEP_MutableTrack_H
0005
0006 #include "edm4hep/TrackObj.h"
0007
0008 #include "edm4hep/Track.h"
0009
0010 #include "edm4hep/Quantity.h"
0011 #include "edm4hep/TrackState.h"
0012 #include "edm4hep/TrackerHit.h"
0013 #include "podio/RelationRange.h"
0014 #include <cstdint>
0015 #include <vector>
0016
0017 #include "podio/utilities/MaybeSharedPtr.h"
0018
0019 #include <cstdint>
0020
0021 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0022 #include "nlohmann/json_fwd.hpp"
0023 #endif
0024
0025 namespace edm4hep {
0026
0027
0028
0029
0030
0031 class MutableTrack {
0032
0033 friend class TrackCollection;
0034 friend class TrackMutableCollectionIterator;
0035 friend class Track;
0036
0037 public:
0038 using object_type = Track;
0039 using collection_type = TrackCollection;
0040
0041
0042 MutableTrack();
0043
0044
0045 MutableTrack(std::int32_t type, float chi2, std::int32_t ndf, float dEdx, float dEdxError,
0046 float radiusOfInnermostHit);
0047
0048
0049 MutableTrack(const MutableTrack& other) = default;
0050
0051
0052 MutableTrack& operator=(MutableTrack other);
0053
0054
0055
0056 MutableTrack clone(bool cloneRelations = true) const;
0057
0058
0059 ~MutableTrack() = default;
0060
0061 public:
0062
0063 std::int32_t getType() const;
0064
0065
0066 float getChi2() const;
0067
0068
0069 std::int32_t getNdf() const;
0070
0071
0072 float getDEdx() const;
0073
0074
0075 float getDEdxError() const;
0076
0077
0078 float getRadiusOfInnermostHit() const;
0079
0080
0081 void setType(std::int32_t value);
0082
0083 std::int32_t& getType();
0084
0085 [[deprecated("use getType instead")]] std::int32_t& type();
0086
0087
0088 void setChi2(float value);
0089
0090 float& getChi2();
0091
0092 [[deprecated("use getChi2 instead")]] float& chi2();
0093
0094
0095 void setNdf(std::int32_t value);
0096
0097 std::int32_t& getNdf();
0098
0099 [[deprecated("use getNdf instead")]] std::int32_t& ndf();
0100
0101
0102 void setDEdx(float value);
0103
0104 float& getDEdx();
0105
0106 [[deprecated("use getDEdx instead")]] float& dEdx();
0107
0108
0109 void setDEdxError(float value);
0110
0111 float& getDEdxError();
0112
0113 [[deprecated("use getDEdxError instead")]] float& dEdxError();
0114
0115
0116 void setRadiusOfInnermostHit(float value);
0117
0118 float& getRadiusOfInnermostHit();
0119
0120 [[deprecated("use getRadiusOfInnermostHit instead")]] float& radiusOfInnermostHit();
0121
0122 void addToTrackerHits(const edm4hep::TrackerHit&);
0123 std::size_t trackerHits_size() const;
0124 edm4hep::TrackerHit getTrackerHits(std::size_t) const;
0125 std::vector<edm4hep::TrackerHit>::const_iterator trackerHits_begin() const;
0126 std::vector<edm4hep::TrackerHit>::const_iterator trackerHits_end() const;
0127 podio::RelationRange<edm4hep::TrackerHit> getTrackerHits() const;
0128 void addToTracks(const edm4hep::Track&);
0129 std::size_t tracks_size() const;
0130 edm4hep::Track getTracks(std::size_t) const;
0131 std::vector<edm4hep::Track>::const_iterator tracks_begin() const;
0132 std::vector<edm4hep::Track>::const_iterator tracks_end() const;
0133 podio::RelationRange<edm4hep::Track> getTracks() const;
0134 void addToSubdetectorHitNumbers(const std::int32_t&);
0135 std::size_t subdetectorHitNumbers_size() const;
0136 std::int32_t getSubdetectorHitNumbers(std::size_t) const;
0137 std::vector<std::int32_t>::const_iterator subdetectorHitNumbers_begin() const;
0138 std::vector<std::int32_t>::const_iterator subdetectorHitNumbers_end() const;
0139 podio::RelationRange<std::int32_t> getSubdetectorHitNumbers() const;
0140 void addToTrackStates(const edm4hep::TrackState&);
0141 std::size_t trackStates_size() const;
0142 edm4hep::TrackState getTrackStates(std::size_t) const;
0143 std::vector<edm4hep::TrackState>::const_iterator trackStates_begin() const;
0144 std::vector<edm4hep::TrackState>::const_iterator trackStates_end() const;
0145 podio::RelationRange<edm4hep::TrackState> getTrackStates() const;
0146 void addToDxQuantities(const edm4hep::Quantity&);
0147 std::size_t dxQuantities_size() const;
0148 edm4hep::Quantity getDxQuantities(std::size_t) const;
0149 std::vector<edm4hep::Quantity>::const_iterator dxQuantities_begin() const;
0150 std::vector<edm4hep::Quantity>::const_iterator dxQuantities_end() const;
0151 podio::RelationRange<edm4hep::Quantity> getDxQuantities() const;
0152
0153
0154 bool isAvailable() const;
0155
0156 void unlink() {
0157 m_obj = podio::utils::MaybeSharedPtr<TrackObj>{nullptr};
0158 }
0159
0160 bool operator==(const MutableTrack& other) const {
0161 return m_obj == other.m_obj;
0162 }
0163 bool operator==(const Track& other) const;
0164
0165 bool operator!=(const MutableTrack& other) const {
0166 return !(*this == other);
0167 }
0168 bool operator!=(const Track& other) const {
0169 return !(*this == other);
0170 }
0171
0172
0173 bool operator<(const MutableTrack& other) const {
0174 return m_obj < other.m_obj;
0175 }
0176
0177 podio::ObjectID id() const {
0178 return getObjectID();
0179 }
0180
0181 const podio::ObjectID getObjectID() const;
0182
0183 friend void swap(MutableTrack& a, MutableTrack& b) {
0184 using std::swap;
0185 swap(a.m_obj, b.m_obj);
0186 }
0187
0188 private:
0189
0190 explicit MutableTrack(podio::utils::MaybeSharedPtr<TrackObj> obj);
0191
0192 podio::utils::MaybeSharedPtr<TrackObj> m_obj{nullptr};
0193 };
0194
0195 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0196 void to_json(nlohmann::json& j, const MutableTrack& value);
0197 #endif
0198
0199 }
0200
0201 #endif