Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-13 08:54:36

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