Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-12-01 09:39:03

0001 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
0002 
0003 #ifndef ACTSPODIOEDM_MutableTrack_H
0004 #define ACTSPODIOEDM_MutableTrack_H
0005 
0006 #include "ActsPodioEdm/TrackObj.h"
0007 // Make the immutable class available from its mutable version but not vice
0008 // versa
0009 #include "ActsPodioEdm/ParticleHypothesis.h"
0010 #include "ActsPodioEdm/Surface.h"
0011 #include "ActsPodioEdm/Track.h"
0012 #include "ActsPodioEdm/TrackInfo.h"
0013 
0014 #include <cstdint>
0015 
0016 #include "podio/utilities/MaybeSharedPtr.h"
0017 
0018 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0019 #include "nlohmann/json_fwd.hpp"
0020 #endif
0021 
0022 // forward declarations
0023 namespace ActsPodioEdm {
0024 class TrackCollection;
0025 }
0026 
0027 namespace ActsPodioEdm {
0028 
0029 /** @class MutableTrack
0030  *  Reconstructed track
0031  *  @author: Paul Gessinger, CERN
0032  */
0033 class MutableTrack {
0034   friend class TrackCollection;
0035   friend class TrackMutableCollectionIterator;
0036   friend class Track;
0037 
0038  public:
0039   using object_type = Track;
0040   using collection_type = TrackCollection;
0041 
0042   /// default constructor
0043   MutableTrack() = default;
0044 
0045   /// Constructor initializing all members
0046   MutableTrack(const ActsPodioEdm::TrackInfo& data,
0047                const ActsPodioEdm::Surface& referenceSurface,
0048                const ActsPodioEdm::ParticleHypothesis& particleHypothesis);
0049 
0050   /// copy constructor
0051   MutableTrack(const MutableTrack& other) noexcept = default;
0052 
0053   /// move constructor
0054   MutableTrack(MutableTrack&& other) noexcept = default;
0055 
0056   /// copy-assignment operator
0057   MutableTrack& operator=(
0058       MutableTrack other) &;  // Rebind this to other's internal object
0059   MutableTrack& operator=(MutableTrack other) && =
0060       delete;  // Prevent rebinding temporary as the changes wouldn't persist
0061 
0062   /// create a mutable deep-copy of the object with identical relations
0063   /// if cloneRelations=false, the relations are not cloned and will be empty
0064   MutableTrack clone(bool cloneRelations = true) const;
0065 
0066   /// destructor
0067   ~MutableTrack() = default;
0068 
0069  public:
0070   /// Access the local parameters and covariance
0071   const ActsPodioEdm::TrackInfo& getData() const;
0072 
0073   /// Access the reference surface
0074   const ActsPodioEdm::Surface& getReferenceSurface() const;
0075 
0076   /// Access the particle hypothesis
0077   const ActsPodioEdm::ParticleHypothesis& getParticleHypothesis() const;
0078 
0079   /// Set the local parameters and covariance
0080   void setData(const ActsPodioEdm::TrackInfo& data);
0081   /// Get mutable reference to local parameters and covariance
0082   ActsPodioEdm::TrackInfo& getData();
0083 
0084   /// Set the reference surface
0085   void setReferenceSurface(const ActsPodioEdm::Surface& referenceSurface);
0086   /// Get mutable reference to reference surface
0087   ActsPodioEdm::Surface& getReferenceSurface();
0088 
0089   /// Set the particle hypothesis
0090   void setParticleHypothesis(
0091       const ActsPodioEdm::ParticleHypothesis& particleHypothesis);
0092   /// Get mutable reference to particle hypothesis
0093   ActsPodioEdm::ParticleHypothesis& getParticleHypothesis();
0094 
0095   /// check whether the object is actually available
0096   bool isAvailable() const;
0097   /// disconnect from TrackObj instance
0098   void unlink() { m_obj = podio::utils::MaybeSharedPtr<TrackObj>{nullptr}; }
0099 
0100   constexpr bool operator==(const MutableTrack& other) const {
0101     return m_obj == other.m_obj;
0102   }
0103   bool operator==(const Track& other) const;
0104 
0105   constexpr bool operator!=(const MutableTrack& other) const {
0106     return !(*this == other);
0107   }
0108   bool operator!=(const Track& other) const { return !(*this == other); }
0109 
0110   // less comparison operator, so that objects can be e.g. stored in sets.
0111   bool operator<(const MutableTrack& other) const {
0112     return podio::detail::getOrderKey(*this) <
0113            podio::detail::getOrderKey(other);
0114   }
0115 
0116   podio::ObjectID id() const { return getObjectID(); }
0117 
0118   const podio::ObjectID getObjectID() const;
0119 
0120   friend std::hash<MutableTrack>;
0121 
0122   friend void swap(MutableTrack& a, MutableTrack& b) {
0123     using std::swap;
0124     swap(a.m_obj, b.m_obj);  // swap out the internal pointers
0125   }
0126 
0127  private:
0128   /// constructor from existing TrackObj
0129   explicit MutableTrack(podio::utils::MaybeSharedPtr<TrackObj> obj);
0130 
0131   podio::utils::MaybeSharedPtr<TrackObj> m_obj{new TrackObj{},
0132                                                podio::utils::MarkOwned};
0133 };
0134 
0135 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0136 void to_json(nlohmann::json& j, const MutableTrack& value);
0137 #endif
0138 
0139 }  // namespace ActsPodioEdm
0140 
0141 template <>
0142 struct std::hash<ActsPodioEdm::MutableTrack> {
0143   std::size_t operator()(const ActsPodioEdm::MutableTrack& obj) const {
0144     return std::hash<ActsPodioEdm::TrackObj*>{}(obj.m_obj.get());
0145   }
0146 };
0147 
0148 #endif