Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-17 08:55:12

0001 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
0002 
0003 #ifndef EDM4HEP_MutableRecDqdx_H
0004 #define EDM4HEP_MutableRecDqdx_H
0005 
0006 #include "edm4hep/RecDqdxObj.h"
0007 // Make the immutable class available from its mutable version but not vice versa
0008 #include "edm4hep/RecDqdx.h"
0009 
0010 #include "edm4hep/Quantity.h"
0011 
0012 #include "podio/utilities/MaybeSharedPtr.h"
0013 
0014 #include <cstdint>
0015 
0016 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0017 #include "nlohmann/json_fwd.hpp"
0018 #endif
0019 
0020 // forward declarations
0021 namespace edm4hep {
0022 class RecDqdxCollection;
0023 class Track;
0024 class MutableTrack;
0025 }
0026 
0027 
0028 namespace edm4hep {
0029 
0030 
0031 /** @class MutableRecDqdx
0032  *  dN/dx or dE/dx info of a Track
0033  *  @author: EDM4hep authors
0034  */
0035 class MutableRecDqdx {
0036 
0037   friend class RecDqdxCollection;
0038   friend class RecDqdxMutableCollectionIterator;
0039   friend class RecDqdx;
0040 
0041 public:
0042   using object_type = RecDqdx;
0043   using collection_type = RecDqdxCollection;
0044 
0045   /// default constructor
0046   MutableRecDqdx();
0047 
0048   /// Constructor initializing all members
0049   MutableRecDqdx(const edm4hep::Quantity& dQdx);
0050 
0051   /// copy constructor
0052   MutableRecDqdx(const MutableRecDqdx& other) = default;
0053 
0054   /// copy-assignment operator
0055   MutableRecDqdx& operator=(MutableRecDqdx other) &; // Rebind this to other's internal object
0056   MutableRecDqdx& operator=(MutableRecDqdx other) && = 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   MutableRecDqdx clone(bool cloneRelations=true) const;
0061 
0062   /// destructor
0063   ~MutableRecDqdx() = default;
0064 
0065 
0066 public:
0067 
0068   /// Access the the reconstructed dEdx or dNdx and its error
0069   const edm4hep::Quantity& getDQdx() const;
0070 
0071 
0072   /// Access the the corresponding track
0073   const edm4hep::Track getTrack() const;
0074 
0075   /// Set the the reconstructed dEdx or dNdx and its error
0076   void setDQdx(const edm4hep::Quantity& dQdx);
0077   /// Get mutable reference to the reconstructed dEdx or dNdx and its error
0078   edm4hep::Quantity& getDQdx();
0079   /// Get reference to the reconstructed dEdx or dNdx and its error
0080   [[deprecated("use getDQdx instead")]]
0081   edm4hep::Quantity& dQdx();
0082 
0083 
0084   /// Set the the corresponding track
0085   void setTrack(const edm4hep::Track& value);
0086 
0087 
0088 
0089 
0090   /// check whether the object is actually available
0091   bool isAvailable() const;
0092   /// disconnect from RecDqdxObj instance
0093   void unlink() { m_obj = podio::utils::MaybeSharedPtr<RecDqdxObj>{nullptr}; }
0094 
0095   bool operator==(const MutableRecDqdx& other) const { return m_obj == other.m_obj; }
0096   bool operator==(const RecDqdx& other) const;
0097 
0098   bool operator!=(const MutableRecDqdx& other) const { return !(*this == other); }
0099   bool operator!=(const RecDqdx& other) const { return !(*this == other); }
0100 
0101   // less comparison operator, so that objects can be e.g. stored in sets.
0102   bool operator<(const MutableRecDqdx& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
0103 
0104   podio::ObjectID id() const { return getObjectID(); }
0105 
0106   const podio::ObjectID getObjectID() const;
0107 
0108   friend std::hash<MutableRecDqdx>;
0109 
0110   friend void swap(MutableRecDqdx& a, MutableRecDqdx& b) {
0111     using std::swap;
0112     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0113   }
0114 
0115 private:
0116   /// constructor from existing RecDqdxObj
0117   explicit MutableRecDqdx(podio::utils::MaybeSharedPtr<RecDqdxObj> obj);
0118 
0119   podio::utils::MaybeSharedPtr<RecDqdxObj> m_obj{nullptr};
0120 };
0121 
0122 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0123 void to_json(nlohmann::json& j, const MutableRecDqdx& value);
0124 #endif
0125 
0126 
0127 } // namespace edm4hep
0128 
0129 
0130 
0131 template<>
0132 struct std::hash<edm4hep::MutableRecDqdx> {
0133   std::size_t operator()(const edm4hep::MutableRecDqdx& obj) const {
0134     return std::hash<edm4hep::RecDqdxObj*>{}(obj.m_obj.get());
0135   }
0136 };
0137 
0138 
0139 #endif