Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:55:30

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