Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-02 09:05:44

0001 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
0002 
0003 #ifndef EDM4EIC_MutableMCRecoClusterParticleAssociation_H
0004 #define EDM4EIC_MutableMCRecoClusterParticleAssociation_H
0005 
0006 #include "edm4eic/MCRecoClusterParticleAssociationObj.h"
0007 // Make the immutable class available from its mutable version but not vice versa
0008 #include "edm4eic/MCRecoClusterParticleAssociation.h"
0009 
0010 #include <edm4eic/Cluster.h>
0011 #include <edm4hep/MCParticle.h>
0012 
0013 #include "podio/utilities/MaybeSharedPtr.h"
0014 
0015 #include <cstdint>
0016 
0017 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0018 #include "nlohmann/json_fwd.hpp"
0019 #endif
0020 
0021 // forward declarations
0022 namespace edm4eic {
0023 class MCRecoClusterParticleAssociationCollection;
0024 class Cluster;
0025 class MutableCluster;
0026 }
0027 namespace edm4hep {
0028 class MCParticle;
0029 class MutableMCParticle;
0030 }
0031 
0032 
0033 namespace edm4eic {
0034 
0035 
0036 /** @class MutableMCRecoClusterParticleAssociation
0037  *  Association between a Cluster and a MCParticle
0038  *  @author: S. Joosten
0039  */
0040 class MutableMCRecoClusterParticleAssociation {
0041 
0042   friend class MCRecoClusterParticleAssociationCollection;
0043   friend class MCRecoClusterParticleAssociationMutableCollectionIterator;
0044   friend class MCRecoClusterParticleAssociation;
0045 
0046 public:
0047   using object_type = MCRecoClusterParticleAssociation;
0048   using collection_type = MCRecoClusterParticleAssociationCollection;
0049 
0050   /// default constructor
0051   MutableMCRecoClusterParticleAssociation() = default;
0052 
0053   /// Constructor initializing all members
0054   MutableMCRecoClusterParticleAssociation(const float weight);
0055 
0056   /// copy constructor
0057   MutableMCRecoClusterParticleAssociation(const MutableMCRecoClusterParticleAssociation& other) = default;
0058 
0059   /// copy-assignment operator
0060   MutableMCRecoClusterParticleAssociation& operator=(MutableMCRecoClusterParticleAssociation other) &; // Rebind this to other's internal object
0061   MutableMCRecoClusterParticleAssociation& operator=(MutableMCRecoClusterParticleAssociation other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
0062 
0063   /// create a mutable deep-copy of the object with identical relations
0064   /// if cloneRelations=false, the relations are not cloned and will be empty
0065   MutableMCRecoClusterParticleAssociation clone(bool cloneRelations=true) const;
0066 
0067   /// destructor
0068   ~MutableMCRecoClusterParticleAssociation() = default;
0069 
0070 
0071 public:
0072 
0073   /// Access the weight of this association
0074   float getWeight() const;
0075 
0076 
0077   /// Access the reference to the cluster
0078   const edm4eic::Cluster getRec() const;
0079   /// Access the reference to the Monte-Carlo particle
0080   const edm4hep::MCParticle getSim() const;
0081 
0082   /// Set the weight of this association
0083   void setWeight(const float weight);
0084   /// Get mutable reference to weight of this association
0085   float& getWeight();
0086 
0087 
0088   /// Set the reference to the cluster
0089   void setRec(const edm4eic::Cluster& value);
0090   /// Set the reference to the Monte-Carlo particle
0091   void setSim(const edm4hep::MCParticle& value);
0092 
0093 
0094  [[deprecated("use getSim().getObjectID().index instead")]] int getSimID() const { return getSim().getObjectID().index; }
0095  [[deprecated("use getRec().getObjectID().index instead")]] int getRecID() const { return getRec().getObjectID().index; }
0096  
0097 
0098  [[deprecated("use setSim() instead; this function does nothing")]] void setSimID(int) { }
0099  [[deprecated("use setRec() instead; this function does nothing")]] void setRecID(int) { }
0100  
0101 
0102   /// check whether the object is actually available
0103   bool isAvailable() const;
0104   /// disconnect from MCRecoClusterParticleAssociationObj instance
0105   void unlink() { m_obj = podio::utils::MaybeSharedPtr<MCRecoClusterParticleAssociationObj>{nullptr}; }
0106 
0107   constexpr bool operator==(const MutableMCRecoClusterParticleAssociation& other) const { return m_obj == other.m_obj; }
0108   bool operator==(const MCRecoClusterParticleAssociation& other) const;
0109 
0110   constexpr bool operator!=(const MutableMCRecoClusterParticleAssociation& other) const { return !(*this == other); }
0111   bool operator!=(const MCRecoClusterParticleAssociation& other) const { return !(*this == other); }
0112 
0113   // less comparison operator, so that objects can be e.g. stored in sets.
0114   bool operator<(const MutableMCRecoClusterParticleAssociation& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
0115 
0116   podio::ObjectID id() const { return getObjectID(); }
0117 
0118   const podio::ObjectID getObjectID() const;
0119 
0120   friend std::hash<MutableMCRecoClusterParticleAssociation>;
0121 
0122   friend void swap(MutableMCRecoClusterParticleAssociation& a, MutableMCRecoClusterParticleAssociation& b) {
0123     using std::swap;
0124     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0125   }
0126 
0127 private:
0128   /// constructor from existing MCRecoClusterParticleAssociationObj
0129   explicit MutableMCRecoClusterParticleAssociation(podio::utils::MaybeSharedPtr<MCRecoClusterParticleAssociationObj> obj);
0130 
0131   podio::utils::MaybeSharedPtr<MCRecoClusterParticleAssociationObj> m_obj{new MCRecoClusterParticleAssociationObj{}, podio::utils::MarkOwned};
0132 };
0133 
0134 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0135 void to_json(nlohmann::json& j, const MutableMCRecoClusterParticleAssociation& value);
0136 #endif
0137 
0138 
0139 } // namespace edm4eic
0140 
0141 
0142 
0143 template<>
0144 struct std::hash<edm4eic::MutableMCRecoClusterParticleAssociation> {
0145   std::size_t operator()(const edm4eic::MutableMCRecoClusterParticleAssociation& obj) const {
0146     return std::hash<edm4eic::MCRecoClusterParticleAssociationObj*>{}(obj.m_obj.get());
0147   }
0148 };
0149 
0150 
0151 #endif