Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-11 08:39:08

0001 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
0002 
0003 #ifndef EDM4EIC_MCRecoVertexParticleAssociation_H
0004 #define EDM4EIC_MCRecoVertexParticleAssociation_H
0005 
0006 #include "edm4eic/MCRecoVertexParticleAssociationObj.h"
0007 
0008 #include <edm4eic/Vertex.h>
0009 #include <edm4hep/MCParticle.h>
0010 
0011 #include "podio/utilities/MaybeSharedPtr.h"
0012 #include "podio/detail/OrderKey.h"
0013 
0014 #include <ostream>
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 MCRecoVertexParticleAssociationCollection;
0024 class Vertex;
0025 class MutableVertex;
0026 }
0027 namespace edm4hep {
0028 class MCParticle;
0029 class MutableMCParticle;
0030 }
0031 
0032 
0033 namespace podio::detail {
0034 // Internal function used in less comparison operators of the datatypes and interface types
0035 OrderKey getOrderKey(const edm4eic::MCRecoVertexParticleAssociation& obj);
0036 };
0037 
0038 namespace edm4eic {
0039 
0040 class MutableMCRecoVertexParticleAssociation;
0041 class MCRecoVertexParticleAssociationCollection;
0042 class MCRecoVertexParticleAssociationCollectionData;
0043 
0044 /** @class MCRecoVertexParticleAssociation
0045  *  Association between a Vertex and a MCParticle
0046  *  @author: S. Joosten
0047  */
0048 class MCRecoVertexParticleAssociation {
0049 
0050   friend class MutableMCRecoVertexParticleAssociation;
0051   friend class MCRecoVertexParticleAssociationCollection;
0052   friend class edm4eic::MCRecoVertexParticleAssociationCollectionData;
0053   friend class MCRecoVertexParticleAssociationCollectionIterator;
0054   friend podio::detail::OrderKey podio::detail::getOrderKey(const MCRecoVertexParticleAssociation & obj);
0055 
0056 public:
0057   using mutable_type = MutableMCRecoVertexParticleAssociation;
0058   using collection_type = MCRecoVertexParticleAssociationCollection;
0059 
0060   /// default constructor
0061   MCRecoVertexParticleAssociation() = default;
0062 
0063   /// Constructor initializing all members
0064   MCRecoVertexParticleAssociation(const float weight);
0065 
0066   /// copy constructor
0067   MCRecoVertexParticleAssociation(const MCRecoVertexParticleAssociation& other) = default;
0068 
0069   /// copy-assignment operator
0070   MCRecoVertexParticleAssociation& operator=(MCRecoVertexParticleAssociation other) &; // Rebind this to other's internal object
0071   MCRecoVertexParticleAssociation& operator=(MCRecoVertexParticleAssociation other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
0072 
0073   /// create a mutable deep-copy of the object with identical relations
0074   /// if cloneRelations=false, the relations are not cloned and will be empty
0075   MutableMCRecoVertexParticleAssociation clone(bool cloneRelations=true) const;
0076 
0077   /// destructor
0078   ~MCRecoVertexParticleAssociation() = default;
0079 
0080   /// converting constructor from mutable object
0081   MCRecoVertexParticleAssociation(const MutableMCRecoVertexParticleAssociation& other);
0082 
0083   static MCRecoVertexParticleAssociation makeEmpty();
0084 
0085 public:
0086 
0087   static constexpr std::string_view typeName = "edm4eic::MCRecoVertexParticleAssociation";
0088 
0089   /// Access the weight of this association
0090   float getWeight() const;
0091 
0092 
0093   /// Access the reference to the vertex
0094   const edm4eic::Vertex getRec() const;
0095   /// Access the reference to the Monte-Carlo particle
0096   const edm4hep::MCParticle getSim() const;
0097 
0098 
0099  [[deprecated("use getSim().getObjectID().index instead")]] int getSimID() const { return getSim().getObjectID().index; }
0100  [[deprecated("use getRec().getObjectID().index instead")]] int getRecID() const { return getRec().getObjectID().index; }
0101  
0102 
0103   /// check whether the object is actually available
0104   bool isAvailable() const;
0105   /// disconnect from MCRecoVertexParticleAssociationObj instance
0106   void unlink() { m_obj = podio::utils::MaybeSharedPtr<MCRecoVertexParticleAssociationObj>{nullptr}; }
0107 
0108   bool operator==(const MCRecoVertexParticleAssociation& other) const { return m_obj == other.m_obj; }
0109   bool operator==(const MutableMCRecoVertexParticleAssociation& other) const;
0110 
0111   bool operator!=(const MCRecoVertexParticleAssociation& other) const { return !(*this == other); }
0112   bool operator!=(const MutableMCRecoVertexParticleAssociation& other) const { return !(*this == other); }
0113 
0114   // less comparison operator, so that objects can be e.g. stored in sets.
0115   bool operator<(const MCRecoVertexParticleAssociation& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
0116 
0117   podio::ObjectID id() const { return getObjectID(); }
0118 
0119   const podio::ObjectID getObjectID() const;
0120 
0121   friend std::hash<MCRecoVertexParticleAssociation>;
0122 
0123   friend void swap(MCRecoVertexParticleAssociation& a, MCRecoVertexParticleAssociation& b) {
0124     using std::swap;
0125     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0126   }
0127 
0128 private:
0129   /// constructor from existing MCRecoVertexParticleAssociationObj
0130   explicit MCRecoVertexParticleAssociation(podio::utils::MaybeSharedPtr<MCRecoVertexParticleAssociationObj> obj);
0131   MCRecoVertexParticleAssociation(MCRecoVertexParticleAssociationObj* obj);
0132 
0133   podio::utils::MaybeSharedPtr<MCRecoVertexParticleAssociationObj> m_obj{new MCRecoVertexParticleAssociationObj{}, podio::utils::MarkOwned};
0134 };
0135 
0136 std::ostream& operator<<(std::ostream& o, const MCRecoVertexParticleAssociation& value);
0137 
0138 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0139 void to_json(nlohmann::json& j, const MCRecoVertexParticleAssociation& value);
0140 #endif
0141 
0142 
0143 } // namespace edm4eic
0144 
0145 
0146 
0147 template<>
0148 struct std::hash<edm4eic::MCRecoVertexParticleAssociation> {
0149   std::size_t operator()(const edm4eic::MCRecoVertexParticleAssociation& obj) const {
0150     return std::hash<edm4eic::MCRecoVertexParticleAssociationObj*>{}(obj.m_obj.get());
0151   }
0152 };
0153 
0154 
0155 // This is needed to avoid triggering opening every library in LD_LIBRARY_PATH
0156 // until it's fixed in ROOT. See https://github.com/root-project/root/issues/18489
0157 // and https://github.com/AIDASoft/podio/issues/770
0158 #if defined(__clang__)
0159   #pragma clang diagnostic push
0160   #pragma clang diagnostic ignored "-Wunknown-warning-option"
0161   #pragma clang diagnostic ignored "-Wdeprecated-redundant-constexpr-static-def"
0162   #pragma clang diagnostic ignored "-Wdeprecated"
0163 constexpr std::string_view edm4eic::MCRecoVertexParticleAssociation::typeName;
0164   #pragma clang diagnostic pop
0165 #elif defined(__GNUC__)
0166   #pragma GCC diagnostic push
0167   #pragma GCC diagnostic ignored "-Wdeprecated"
0168 constexpr std::string_view edm4eic::MCRecoVertexParticleAssociation::typeName;
0169   #pragma GCC diagnostic pop
0170 #endif
0171 
0172 
0173 #endif