Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
0002 
0003 #ifndef EDM4EIC_MCRecoTrackParticleAssociation_H
0004 #define EDM4EIC_MCRecoTrackParticleAssociation_H
0005 
0006 #include "edm4eic/MCRecoTrackParticleAssociationObj.h"
0007 
0008 #include <cstdint>
0009 
0010 #include "podio/utilities/MaybeSharedPtr.h"
0011 
0012 #include <ostream>
0013 #include <cstdint>
0014 
0015 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0016 #include "nlohmann/json_fwd.hpp"
0017 #endif
0018 
0019 // forward declarations
0020 namespace edm4eic {
0021 class Track;
0022 class MutableTrack;
0023 }
0024 namespace edm4hep {
0025 class MCParticle;
0026 class MutableMCParticle;
0027 }
0028 
0029 
0030 namespace edm4eic {
0031 
0032 class MutableMCRecoTrackParticleAssociation;
0033 class MCRecoTrackParticleAssociationCollection;
0034 class MCRecoTrackParticleAssociationCollectionData;
0035 
0036 /** @class MCRecoTrackParticleAssociation
0037  *  Association between a Track and a MCParticle
0038  *  @author: S. Joosten
0039  */
0040 class MCRecoTrackParticleAssociation {
0041 
0042   friend class MutableMCRecoTrackParticleAssociation;
0043   friend class MCRecoTrackParticleAssociationCollection;
0044   friend class edm4eic::MCRecoTrackParticleAssociationCollectionData;
0045   friend class MCRecoTrackParticleAssociationCollectionIterator;
0046 
0047 public:
0048   using mutable_type = MutableMCRecoTrackParticleAssociation;
0049   using collection_type = MCRecoTrackParticleAssociationCollection;
0050 
0051   /// default constructor
0052   MCRecoTrackParticleAssociation();
0053 
0054   /// Constructor initializing all members
0055   MCRecoTrackParticleAssociation(std::uint32_t simID, std::uint32_t recID, float weight);
0056 
0057   /// copy constructor
0058   MCRecoTrackParticleAssociation(const MCRecoTrackParticleAssociation& other) = default;
0059 
0060   /// copy-assignment operator
0061   MCRecoTrackParticleAssociation& operator=(MCRecoTrackParticleAssociation other);
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   MutableMCRecoTrackParticleAssociation clone(bool cloneRelations=true) const;
0066 
0067   /// destructor
0068   ~MCRecoTrackParticleAssociation() = default;
0069 
0070   /// converting constructor from mutable object
0071   MCRecoTrackParticleAssociation(const MutableMCRecoTrackParticleAssociation& other);
0072 
0073   static MCRecoTrackParticleAssociation makeEmpty();
0074 
0075 public:
0076 
0077   /// Access the Index of corresponding MCParticle (position in MCParticles array)
0078   std::uint32_t getSimID() const;
0079 
0080   /// Access the Index of corresponding Track (position in Tracks array)
0081   std::uint32_t getRecID() const;
0082 
0083   /// Access the weight of this association
0084   float getWeight() const;
0085 
0086 
0087   /// Access the reference to the track
0088   const edm4eic::Track getRec() const;
0089   /// Access the reference to the Monte-Carlo particle
0090   const edm4hep::MCParticle getSim() const;
0091 
0092 
0093 
0094   /// check whether the object is actually available
0095   bool isAvailable() const;
0096   /// disconnect from MCRecoTrackParticleAssociationObj instance
0097   void unlink() { m_obj = podio::utils::MaybeSharedPtr<MCRecoTrackParticleAssociationObj>{nullptr}; }
0098 
0099   bool operator==(const MCRecoTrackParticleAssociation& other) const { return m_obj == other.m_obj; }
0100   bool operator==(const MutableMCRecoTrackParticleAssociation& other) const;
0101 
0102   bool operator!=(const MCRecoTrackParticleAssociation& other) const { return !(*this == other); }
0103   bool operator!=(const MutableMCRecoTrackParticleAssociation& other) const { return !(*this == other); }
0104 
0105   // less comparison operator, so that objects can be e.g. stored in sets.
0106   bool operator<(const MCRecoTrackParticleAssociation& other) const { return m_obj < other.m_obj; }
0107 
0108   podio::ObjectID id() const { return getObjectID(); }
0109 
0110   const podio::ObjectID getObjectID() const;
0111 
0112   friend void swap(MCRecoTrackParticleAssociation& a, MCRecoTrackParticleAssociation& b) {
0113     using std::swap;
0114     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0115   }
0116 
0117 private:
0118   /// constructor from existing MCRecoTrackParticleAssociationObj
0119   explicit MCRecoTrackParticleAssociation(podio::utils::MaybeSharedPtr<MCRecoTrackParticleAssociationObj> obj);
0120   MCRecoTrackParticleAssociation(MCRecoTrackParticleAssociationObj* obj);
0121 
0122   podio::utils::MaybeSharedPtr<MCRecoTrackParticleAssociationObj> m_obj{nullptr};
0123 };
0124 
0125 std::ostream& operator<<(std::ostream& o, const MCRecoTrackParticleAssociation& value);
0126 
0127 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0128 void to_json(nlohmann::json& j, const MCRecoTrackParticleAssociation& value);
0129 #endif
0130 
0131 
0132 } // namespace edm4eic
0133 
0134 
0135 #endif