Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-07 08:40:39

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) = default;
0052 
0053   /// copy-assignment operator
0054   MutableTrack& operator=(
0055       MutableTrack other) &;  // Rebind this to other's internal object
0056   MutableTrack& operator=(MutableTrack other) && =
0057       delete;  // Prevent rebinding temporary as the changes wouldn't persist
0058 
0059   /// create a mutable deep-copy of the object with identical relations
0060   /// if cloneRelations=false, the relations are not cloned and will be empty
0061   MutableTrack clone(bool cloneRelations = true) const;
0062 
0063   /// destructor
0064   ~MutableTrack() = default;
0065 
0066  public:
0067   /// Access the local parameters and covariance
0068   const ActsPodioEdm::TrackInfo& getData() const;
0069 
0070   /// Access the reference surface
0071   const ActsPodioEdm::Surface& getReferenceSurface() const;
0072 
0073   /// Access the particle hypothesis
0074   const ActsPodioEdm::ParticleHypothesis& getParticleHypothesis() const;
0075 
0076   /// Set the local parameters and covariance
0077   void setData(const ActsPodioEdm::TrackInfo& data);
0078   /// Get mutable reference to local parameters and covariance
0079   ActsPodioEdm::TrackInfo& getData();
0080 
0081   /// Set the reference surface
0082   void setReferenceSurface(const ActsPodioEdm::Surface& referenceSurface);
0083   /// Get mutable reference to reference surface
0084   ActsPodioEdm::Surface& getReferenceSurface();
0085 
0086   /// Set the particle hypothesis
0087   void setParticleHypothesis(
0088       const ActsPodioEdm::ParticleHypothesis& particleHypothesis);
0089   /// Get mutable reference to particle hypothesis
0090   ActsPodioEdm::ParticleHypothesis& getParticleHypothesis();
0091 
0092   /// check whether the object is actually available
0093   bool isAvailable() const;
0094   /// disconnect from TrackObj instance
0095   void unlink() { m_obj = podio::utils::MaybeSharedPtr<TrackObj>{nullptr}; }
0096 
0097   constexpr bool operator==(const MutableTrack& other) const {
0098     return m_obj == other.m_obj;
0099   }
0100   bool operator==(const Track& other) const;
0101 
0102   constexpr bool operator!=(const MutableTrack& other) const {
0103     return !(*this == other);
0104   }
0105   bool operator!=(const Track& other) const { return !(*this == other); }
0106 
0107   // less comparison operator, so that objects can be e.g. stored in sets.
0108   bool operator<(const MutableTrack& other) const {
0109     return podio::detail::getOrderKey(*this) <
0110            podio::detail::getOrderKey(other);
0111   }
0112 
0113   podio::ObjectID id() const { return getObjectID(); }
0114 
0115   const podio::ObjectID getObjectID() const;
0116 
0117   friend std::hash<MutableTrack>;
0118 
0119   friend void swap(MutableTrack& a, MutableTrack& b) {
0120     using std::swap;
0121     swap(a.m_obj, b.m_obj);  // swap out the internal pointers
0122   }
0123 
0124  private:
0125   /// constructor from existing TrackObj
0126   explicit MutableTrack(podio::utils::MaybeSharedPtr<TrackObj> obj);
0127 
0128   podio::utils::MaybeSharedPtr<TrackObj> m_obj{new TrackObj{},
0129                                                podio::utils::MarkOwned};
0130 };
0131 
0132 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0133 void to_json(nlohmann::json& j, const MutableTrack& value);
0134 #endif
0135 
0136 }  // namespace ActsPodioEdm
0137 
0138 template <>
0139 struct std::hash<ActsPodioEdm::MutableTrack> {
0140   std::size_t operator()(const ActsPodioEdm::MutableTrack& obj) const {
0141     return std::hash<ActsPodioEdm::TrackObj*>{}(obj.m_obj.get());
0142   }
0143 };
0144 
0145 #endif