Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-04 08:36:55

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   /// Get reference to weight of this association
0087   [[deprecated("use getWeight instead")]]
0088   float& weight();
0089 
0090 
0091   /// Set the reference to the cluster
0092   void setRec(const edm4eic::Cluster& value);
0093   /// Set the reference to the Monte-Carlo particle
0094   void setSim(const edm4hep::MCParticle& value);
0095 
0096 
0097  [[deprecated("use getSim().getObjectID().index instead")]] int getSimID() const { return getSim().getObjectID().index; }
0098  [[deprecated("use getRec().getObjectID().index instead")]] int getRecID() const { return getRec().getObjectID().index; }
0099  
0100 
0101  [[deprecated("use setSim() instead; this function does nothing")]] void setSimID(int) { }
0102  [[deprecated("use setRec() instead; this function does nothing")]] void setRecID(int) { }
0103  
0104 
0105   /// check whether the object is actually available
0106   bool isAvailable() const;
0107   /// disconnect from MCRecoClusterParticleAssociationObj instance
0108   void unlink() { m_obj = podio::utils::MaybeSharedPtr<MCRecoClusterParticleAssociationObj>{nullptr}; }
0109 
0110   bool operator==(const MutableMCRecoClusterParticleAssociation& other) const { return m_obj == other.m_obj; }
0111   bool operator==(const MCRecoClusterParticleAssociation& other) const;
0112 
0113   bool operator!=(const MutableMCRecoClusterParticleAssociation& other) const { return !(*this == other); }
0114   bool operator!=(const MCRecoClusterParticleAssociation& other) const { return !(*this == other); }
0115 
0116   // less comparison operator, so that objects can be e.g. stored in sets.
0117   bool operator<(const MutableMCRecoClusterParticleAssociation& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
0118 
0119   podio::ObjectID id() const { return getObjectID(); }
0120 
0121   const podio::ObjectID getObjectID() const;
0122 
0123   friend std::hash<MutableMCRecoClusterParticleAssociation>;
0124 
0125   friend void swap(MutableMCRecoClusterParticleAssociation& a, MutableMCRecoClusterParticleAssociation& b) {
0126     using std::swap;
0127     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0128   }
0129 
0130 private:
0131   /// constructor from existing MCRecoClusterParticleAssociationObj
0132   explicit MutableMCRecoClusterParticleAssociation(podio::utils::MaybeSharedPtr<MCRecoClusterParticleAssociationObj> obj);
0133 
0134   podio::utils::MaybeSharedPtr<MCRecoClusterParticleAssociationObj> m_obj{new MCRecoClusterParticleAssociationObj{}, podio::utils::MarkOwned};
0135 };
0136 
0137 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0138 void to_json(nlohmann::json& j, const MutableMCRecoClusterParticleAssociation& value);
0139 #endif
0140 
0141 
0142 } // namespace edm4eic
0143 
0144 
0145 
0146 template<>
0147 struct std::hash<edm4eic::MutableMCRecoClusterParticleAssociation> {
0148   std::size_t operator()(const edm4eic::MutableMCRecoClusterParticleAssociation& obj) const {
0149     return std::hash<edm4eic::MCRecoClusterParticleAssociationObj*>{}(obj.m_obj.get());
0150   }
0151 };
0152 
0153 
0154 #endif