Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
0002 
0003 #ifndef EDM4HEP_MutableCaloHitSimCaloHitLink_H
0004 #define EDM4HEP_MutableCaloHitSimCaloHitLink_H
0005 
0006 #include "edm4hep/CaloHitSimCaloHitLinkObj.h"
0007 // Make the immutable class available from its mutable version but not vice versa
0008 #include "edm4hep/CaloHitSimCaloHitLink.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 CaloHitSimCaloHitLinkCollection;
0021 class CalorimeterHit;
0022 class MutableCalorimeterHit;
0023 class SimCalorimeterHit;
0024 class MutableSimCalorimeterHit;
0025 } // namespace edm4hep
0026 
0027 namespace edm4hep {
0028 
0029 /** @class MutableCaloHitSimCaloHitLink
0030  *  Link between a CalorimeterHit and the corresponding SimCalorimeterHit
0031  *  @author: EDM4hep authors
0032  */
0033 class MutableCaloHitSimCaloHitLink {
0034 
0035   friend class CaloHitSimCaloHitLinkCollection;
0036   friend class CaloHitSimCaloHitLinkMutableCollectionIterator;
0037   friend class CaloHitSimCaloHitLink;
0038 
0039 public:
0040   using object_type = CaloHitSimCaloHitLink;
0041   using collection_type = CaloHitSimCaloHitLinkCollection;
0042 
0043   /// default constructor
0044   MutableCaloHitSimCaloHitLink();
0045 
0046   /// Constructor initializing all members
0047   MutableCaloHitSimCaloHitLink(float weight);
0048 
0049   /// copy constructor
0050   MutableCaloHitSimCaloHitLink(const MutableCaloHitSimCaloHitLink& other) = default;
0051 
0052   /// copy-assignment operator
0053   MutableCaloHitSimCaloHitLink& operator=(MutableCaloHitSimCaloHitLink 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   MutableCaloHitSimCaloHitLink clone(bool cloneRelations = true) const;
0058 
0059   /// destructor
0060   ~MutableCaloHitSimCaloHitLink() = 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::CalorimeterHit getFrom() const;
0068   /// Access the reference to the simulated hit
0069   const edm4hep::SimCalorimeterHit 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::CalorimeterHit& value);
0080   /// Set the reference to the simulated hit
0081   void setTo(const edm4hep::SimCalorimeterHit& value);
0082 
0083   [[deprecated("use getFrom instead")]] edm4hep::CalorimeterHit getRec() const;
0084   [[deprecated("use getTo instead")]] edm4hep::SimCalorimeterHit getSim() const;
0085 
0086   [[deprecated("use setFrom instead")]] void setRec(const edm4hep::CalorimeterHit& rec);
0087   [[deprecated("use setTo instead")]] void setSim(const edm4hep::SimCalorimeterHit& sim);
0088 
0089   /// check whether the object is actually available
0090   bool isAvailable() const;
0091   /// disconnect from CaloHitSimCaloHitLinkObj instance
0092   void unlink() {
0093     m_obj = podio::utils::MaybeSharedPtr<CaloHitSimCaloHitLinkObj>{nullptr};
0094   }
0095 
0096   bool operator==(const MutableCaloHitSimCaloHitLink& other) const {
0097     return m_obj == other.m_obj;
0098   }
0099   bool operator==(const CaloHitSimCaloHitLink& other) const;
0100 
0101   bool operator!=(const MutableCaloHitSimCaloHitLink& other) const {
0102     return !(*this == other);
0103   }
0104   bool operator!=(const CaloHitSimCaloHitLink& 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 MutableCaloHitSimCaloHitLink& 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(MutableCaloHitSimCaloHitLink& a, MutableCaloHitSimCaloHitLink& 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 CaloHitSimCaloHitLinkObj
0126   explicit MutableCaloHitSimCaloHitLink(podio::utils::MaybeSharedPtr<CaloHitSimCaloHitLinkObj> obj);
0127 
0128   podio::utils::MaybeSharedPtr<CaloHitSimCaloHitLinkObj> m_obj{nullptr};
0129 };
0130 
0131 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0132 void to_json(nlohmann::json& j, const MutableCaloHitSimCaloHitLink& value);
0133 #endif
0134 
0135 } // namespace edm4hep
0136 
0137 #endif