File indexing completed on 2025-01-18 09:28:05
0001
0002
0003 #ifndef ACTSPODIOEDM_Track_H
0004 #define ACTSPODIOEDM_Track_H
0005
0006 #include "ActsPodioEdm/ParticleHypothesis.h"
0007 #include "ActsPodioEdm/Surface.h"
0008 #include "ActsPodioEdm/TrackInfo.h"
0009 #include "ActsPodioEdm/TrackObj.h"
0010
0011 #include <cstdint>
0012 #include <ostream>
0013
0014 #include "podio/utilities/MaybeSharedPtr.h"
0015
0016 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0017 #include "nlohmann/json_fwd.hpp"
0018 #endif
0019
0020 namespace ActsPodioEdm {
0021
0022 class MutableTrack;
0023 class TrackCollection;
0024 class TrackCollectionData;
0025
0026
0027
0028
0029
0030 class Track {
0031 friend class MutableTrack;
0032 friend class TrackCollection;
0033 friend class ActsPodioEdm::TrackCollectionData;
0034 friend class TrackCollectionIterator;
0035
0036 public:
0037 using mutable_type = MutableTrack;
0038 using collection_type = TrackCollection;
0039
0040
0041 Track();
0042
0043
0044 Track(ActsPodioEdm::TrackInfo data, ActsPodioEdm::Surface referenceSurface,
0045 ActsPodioEdm::ParticleHypothesis particleHypothesis);
0046
0047
0048 Track(const Track& other) = default;
0049
0050
0051 Track& operator=(Track other);
0052
0053
0054
0055 MutableTrack clone(bool cloneRelations = true) const;
0056
0057
0058 ~Track() = default;
0059
0060
0061 Track(const MutableTrack& other);
0062
0063 static Track makeEmpty();
0064
0065 public:
0066
0067 const ActsPodioEdm::TrackInfo& getData() const;
0068
0069
0070 const ActsPodioEdm::Surface& getReferenceSurface() const;
0071
0072
0073 const ActsPodioEdm::ParticleHypothesis& getParticleHypothesis() const;
0074
0075
0076 bool isAvailable() const;
0077
0078 void unlink() { m_obj = podio::utils::MaybeSharedPtr<TrackObj>{nullptr}; }
0079
0080 bool operator==(const Track& other) const { return m_obj == other.m_obj; }
0081 bool operator==(const MutableTrack& other) const;
0082
0083 bool operator!=(const Track& other) const { return !(*this == other); }
0084 bool operator!=(const MutableTrack& other) const { return !(*this == other); }
0085
0086
0087 bool operator<(const Track& other) const { return m_obj < other.m_obj; }
0088
0089 podio::ObjectID id() const { return getObjectID(); }
0090
0091 const podio::ObjectID getObjectID() const;
0092
0093 friend void swap(Track& a, Track& b) {
0094 using std::swap;
0095 swap(a.m_obj, b.m_obj);
0096 }
0097
0098 private:
0099
0100 explicit Track(podio::utils::MaybeSharedPtr<TrackObj> obj);
0101 Track(TrackObj* obj);
0102
0103 podio::utils::MaybeSharedPtr<TrackObj> m_obj{nullptr};
0104 };
0105
0106 std::ostream& operator<<(std::ostream& o, const Track& value);
0107
0108 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0109 void to_json(nlohmann::json& j, const Track& value);
0110 #endif
0111
0112 }
0113
0114 #endif