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