Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-15 10:12:14

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 } // namespace edm4hep
0026 
0027 namespace edm4hep {
0028 
0029 /** @class MutableRecDqdx
0030  *  dN/dx or dE/dx info of a Track
0031  *  @author: EDM4hep authors
0032  */
0033 class MutableRecDqdx {
0034 
0035   friend class RecDqdxCollection;
0036   friend class RecDqdxMutableCollectionIterator;
0037   friend class RecDqdx;
0038 
0039 public:
0040   using object_type = RecDqdx;
0041   using collection_type = RecDqdxCollection;
0042 
0043   /// default constructor
0044   MutableRecDqdx() = default;
0045 
0046   /// Constructor initializing all members
0047   MutableRecDqdx(const edm4hep::Quantity& dQdx);
0048 
0049   /// copy constructor
0050   MutableRecDqdx(const MutableRecDqdx& other) = default;
0051 
0052   /// copy-assignment operator
0053   MutableRecDqdx& operator=(MutableRecDqdx other) &; // Rebind this to other's internal object
0054   MutableRecDqdx&
0055   operator=(MutableRecDqdx other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
0056 
0057   /// create a mutable deep-copy of the object with identical relations
0058   /// if cloneRelations=false, the relations are not cloned and will be empty
0059   MutableRecDqdx clone(bool cloneRelations = true) const;
0060 
0061   /// destructor
0062   ~MutableRecDqdx() = default;
0063 
0064 public:
0065   /// Access the the reconstructed dEdx or dNdx and its error
0066   const edm4hep::Quantity& getDQdx() const;
0067 
0068   /// Access the the corresponding track
0069   const edm4hep::Track getTrack() const;
0070 
0071   /// Set the the reconstructed dEdx or dNdx and its error
0072   void setDQdx(const edm4hep::Quantity& dQdx);
0073   /// Get mutable reference to the reconstructed dEdx or dNdx and its error
0074   edm4hep::Quantity& getDQdx();
0075   /// Get reference to the reconstructed dEdx or dNdx and its error
0076   [[deprecated("use getDQdx instead")]] edm4hep::Quantity& dQdx();
0077 
0078   /// Set the the corresponding track
0079   void setTrack(const edm4hep::Track& value);
0080 
0081   /// check whether the object is actually available
0082   bool isAvailable() const;
0083   /// disconnect from RecDqdxObj instance
0084   void unlink() { m_obj = podio::utils::MaybeSharedPtr<RecDqdxObj>{nullptr}; }
0085 
0086   bool operator==(const MutableRecDqdx& other) const { return m_obj == other.m_obj; }
0087   bool operator==(const RecDqdx& other) const;
0088 
0089   bool operator!=(const MutableRecDqdx& other) const { return !(*this == other); }
0090   bool operator!=(const RecDqdx& other) const { return !(*this == other); }
0091 
0092   // less comparison operator, so that objects can be e.g. stored in sets.
0093   bool operator<(const MutableRecDqdx& other) const {
0094     return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other);
0095   }
0096 
0097   podio::ObjectID id() const { return getObjectID(); }
0098 
0099   const podio::ObjectID getObjectID() const;
0100 
0101   friend std::hash<MutableRecDqdx>;
0102 
0103   friend void swap(MutableRecDqdx& a, MutableRecDqdx& b) {
0104     using std::swap;
0105     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0106   }
0107 
0108 private:
0109   /// constructor from existing RecDqdxObj
0110   explicit MutableRecDqdx(podio::utils::MaybeSharedPtr<RecDqdxObj> obj);
0111 
0112   podio::utils::MaybeSharedPtr<RecDqdxObj> m_obj{new RecDqdxObj{}, podio::utils::MarkOwned};
0113 };
0114 
0115 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0116 void to_json(nlohmann::json& j, const MutableRecDqdx& value);
0117 #endif
0118 
0119 } // namespace edm4hep
0120 
0121 template <>
0122 struct std::hash<edm4hep::MutableRecDqdx> {
0123   std::size_t operator()(const edm4hep::MutableRecDqdx& obj) const {
0124     return std::hash<edm4hep::RecDqdxObj*>{}(obj.m_obj.get());
0125   }
0126 };
0127 
0128 #endif