Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-06-03 08:33:25

0001 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
0002 
0003 #ifndef EDM4HEP_MutableTrackerHitSimTrackerHitLink_H
0004 #define EDM4HEP_MutableTrackerHitSimTrackerHitLink_H
0005 
0006 #include "edm4hep/TrackerHitSimTrackerHitLinkObj.h"
0007 // Make the immutable class available from its mutable version but not vice versa
0008 #include "edm4hep/TrackerHitSimTrackerHitLink.h"
0009 
0010 #include "podio/utilities/MaybeSharedPtr.h"
0011 
0012 #include <cstdint>
0013 
0014 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0015 #include "nlohmann/json_fwd.hpp"
0016 #endif
0017 
0018 // forward declarations
0019 namespace edm4hep {
0020 class TrackerHitSimTrackerHitLinkCollection;
0021 class TrackerHit;
0022 class MutableTrackerHit;
0023 class SimTrackerHit;
0024 class MutableSimTrackerHit;
0025 } // namespace edm4hep
0026 
0027 namespace edm4hep {
0028 
0029 /** @class MutableTrackerHitSimTrackerHitLink
0030  *  Link between a TrackerHit and the corresponding SimTrackerHit
0031  *  @author: EDM4hep authors
0032  */
0033 class MutableTrackerHitSimTrackerHitLink {
0034 
0035   friend class TrackerHitSimTrackerHitLinkCollection;
0036   friend class TrackerHitSimTrackerHitLinkMutableCollectionIterator;
0037   friend class TrackerHitSimTrackerHitLink;
0038 
0039 public:
0040   using object_type = TrackerHitSimTrackerHitLink;
0041   using collection_type = TrackerHitSimTrackerHitLinkCollection;
0042 
0043   /// default constructor
0044   MutableTrackerHitSimTrackerHitLink();
0045 
0046   /// Constructor initializing all members
0047   MutableTrackerHitSimTrackerHitLink(float weight);
0048 
0049   /// copy constructor
0050   MutableTrackerHitSimTrackerHitLink(const MutableTrackerHitSimTrackerHitLink& other) = default;
0051 
0052   /// copy-assignment operator
0053   MutableTrackerHitSimTrackerHitLink& operator=(MutableTrackerHitSimTrackerHitLink other);
0054 
0055   /// create a mutable deep-copy of the object with identical relations
0056   /// if cloneRelations=false, the relations are not cloned and will be empty
0057   MutableTrackerHitSimTrackerHitLink clone(bool cloneRelations = true) const;
0058 
0059   /// destructor
0060   ~MutableTrackerHitSimTrackerHitLink() = default;
0061 
0062 public:
0063   /// Access the weight of this link
0064   float getWeight() const;
0065 
0066   /// Access the reference to the reconstructed hit
0067   const edm4hep::TrackerHit getFrom() const;
0068   /// Access the reference to the simulated hit
0069   const edm4hep::SimTrackerHit getTo() const;
0070 
0071   /// Set the weight of this link
0072   void setWeight(float value);
0073   /// Get mutable reference to weight of this link
0074   float& getWeight();
0075   /// Get reference to weight of this link
0076   [[deprecated("use getWeight instead")]] float& weight();
0077 
0078   /// Set the reference to the reconstructed hit
0079   void setFrom(const edm4hep::TrackerHit& value);
0080   /// Set the reference to the simulated hit
0081   void setTo(const edm4hep::SimTrackerHit& value);
0082 
0083   [[deprecated("use getFrom instead")]] edm4hep::TrackerHit getRec() const;
0084   [[deprecated("use getTo instead")]] edm4hep::SimTrackerHit getSim() const;
0085 
0086   [[deprecated("use setFrom instead")]] void setRec(const edm4hep::TrackerHit& rec);
0087   [[deprecated("use setTo instead")]] void setSim(const edm4hep::SimTrackerHit& sim);
0088 
0089   /// check whether the object is actually available
0090   bool isAvailable() const;
0091   /// disconnect from TrackerHitSimTrackerHitLinkObj instance
0092   void unlink() {
0093     m_obj = podio::utils::MaybeSharedPtr<TrackerHitSimTrackerHitLinkObj>{nullptr};
0094   }
0095 
0096   bool operator==(const MutableTrackerHitSimTrackerHitLink& other) const {
0097     return m_obj == other.m_obj;
0098   }
0099   bool operator==(const TrackerHitSimTrackerHitLink& other) const;
0100 
0101   bool operator!=(const MutableTrackerHitSimTrackerHitLink& other) const {
0102     return !(*this == other);
0103   }
0104   bool operator!=(const TrackerHitSimTrackerHitLink& other) const {
0105     return !(*this == other);
0106   }
0107 
0108   // less comparison operator, so that objects can be e.g. stored in sets.
0109   bool operator<(const MutableTrackerHitSimTrackerHitLink& other) const {
0110     return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other);
0111   }
0112 
0113   podio::ObjectID id() const {
0114     return getObjectID();
0115   }
0116 
0117   const podio::ObjectID getObjectID() const;
0118 
0119   friend void swap(MutableTrackerHitSimTrackerHitLink& a, MutableTrackerHitSimTrackerHitLink& 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 TrackerHitSimTrackerHitLinkObj
0126   explicit MutableTrackerHitSimTrackerHitLink(podio::utils::MaybeSharedPtr<TrackerHitSimTrackerHitLinkObj> obj);
0127 
0128   podio::utils::MaybeSharedPtr<TrackerHitSimTrackerHitLinkObj> m_obj{nullptr};
0129 };
0130 
0131 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0132 void to_json(nlohmann::json& j, const MutableTrackerHitSimTrackerHitLink& value);
0133 #endif
0134 
0135 } // namespace edm4hep
0136 
0137 #endif