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