Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-11-30 09:45:58

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