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