Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-18 09:10:42

0001 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
0002 
0003 #ifndef EDM4EIC_MutableMCRecoTrackerHitAssociation_H
0004 #define EDM4EIC_MutableMCRecoTrackerHitAssociation_H
0005 
0006 #include "edm4eic/MCRecoTrackerHitAssociationObj.h"
0007 // Make the immutable class available from its mutable version but not vice versa
0008 #include "edm4eic/MCRecoTrackerHitAssociation.h"
0009 
0010 
0011 #include "podio/utilities/MaybeSharedPtr.h"
0012 
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 MCRecoTrackerHitAssociationCollection;
0022 class RawTrackerHit;
0023 class MutableRawTrackerHit;
0024 }
0025 namespace edm4hep {
0026 class SimTrackerHit;
0027 class MutableSimTrackerHit;
0028 }
0029 
0030 
0031 namespace edm4eic {
0032 
0033 
0034 /** @class MutableMCRecoTrackerHitAssociation
0035  *  Association between a RawTrackerHit and a SimTrackerHit
0036  *  @author: C. Dilks, W. Deconinck
0037  */
0038 class MutableMCRecoTrackerHitAssociation {
0039 
0040   friend class MCRecoTrackerHitAssociationCollection;
0041   friend class MCRecoTrackerHitAssociationMutableCollectionIterator;
0042   friend class MCRecoTrackerHitAssociation;
0043 
0044 public:
0045   using object_type = MCRecoTrackerHitAssociation;
0046   using collection_type = MCRecoTrackerHitAssociationCollection;
0047 
0048   /// default constructor
0049   MutableMCRecoTrackerHitAssociation();
0050 
0051   /// Constructor initializing all members
0052   MutableMCRecoTrackerHitAssociation(const float weight);
0053 
0054   /// copy constructor
0055   MutableMCRecoTrackerHitAssociation(const MutableMCRecoTrackerHitAssociation& other) = default;
0056 
0057   /// copy-assignment operator
0058   MutableMCRecoTrackerHitAssociation& operator=(MutableMCRecoTrackerHitAssociation other) &; // Rebind this to other's internal object
0059   MutableMCRecoTrackerHitAssociation& operator=(MutableMCRecoTrackerHitAssociation other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
0060 
0061   /// create a mutable deep-copy of the object with identical relations
0062   /// if cloneRelations=false, the relations are not cloned and will be empty
0063   MutableMCRecoTrackerHitAssociation clone(bool cloneRelations=true) const;
0064 
0065   /// destructor
0066   ~MutableMCRecoTrackerHitAssociation() = default;
0067 
0068 
0069 public:
0070 
0071   /// Access the weight of this association
0072   float getWeight() const;
0073 
0074 
0075   /// Access the reference to the digitized hit
0076   const edm4eic::RawTrackerHit getRawHit() const;
0077   /// Access the reference to the simulated hit
0078   const edm4hep::SimTrackerHit getSimHit() const;
0079 
0080   /// Set the weight of this association
0081   void setWeight(const float weight);
0082   /// Get mutable reference to weight of this association
0083   float& getWeight();
0084   /// Get reference to weight of this association
0085   [[deprecated("use getWeight instead")]]
0086   float& weight();
0087 
0088 
0089   /// Set the reference to the digitized hit
0090   void setRawHit(const edm4eic::RawTrackerHit& value);
0091   /// Set the reference to the simulated hit
0092   void setSimHit(const edm4hep::SimTrackerHit& value);
0093 
0094 
0095 
0096 
0097   /// check whether the object is actually available
0098   bool isAvailable() const;
0099   /// disconnect from MCRecoTrackerHitAssociationObj instance
0100   void unlink() { m_obj = podio::utils::MaybeSharedPtr<MCRecoTrackerHitAssociationObj>{nullptr}; }
0101 
0102   bool operator==(const MutableMCRecoTrackerHitAssociation& other) const { return m_obj == other.m_obj; }
0103   bool operator==(const MCRecoTrackerHitAssociation& other) const;
0104 
0105   bool operator!=(const MutableMCRecoTrackerHitAssociation& other) const { return !(*this == other); }
0106   bool operator!=(const MCRecoTrackerHitAssociation& other) const { return !(*this == other); }
0107 
0108   // less comparison operator, so that objects can be e.g. stored in sets.
0109   bool operator<(const MutableMCRecoTrackerHitAssociation& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
0110 
0111   podio::ObjectID id() const { return getObjectID(); }
0112 
0113   const podio::ObjectID getObjectID() const;
0114 
0115   friend std::hash<MutableMCRecoTrackerHitAssociation>;
0116 
0117   friend void swap(MutableMCRecoTrackerHitAssociation& a, MutableMCRecoTrackerHitAssociation& b) {
0118     using std::swap;
0119     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0120   }
0121 
0122 private:
0123   /// constructor from existing MCRecoTrackerHitAssociationObj
0124   explicit MutableMCRecoTrackerHitAssociation(podio::utils::MaybeSharedPtr<MCRecoTrackerHitAssociationObj> obj);
0125 
0126   podio::utils::MaybeSharedPtr<MCRecoTrackerHitAssociationObj> m_obj{nullptr};
0127 };
0128 
0129 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0130 void to_json(nlohmann::json& j, const MutableMCRecoTrackerHitAssociation& value);
0131 #endif
0132 
0133 
0134 } // namespace edm4eic
0135 
0136 
0137 
0138 template<>
0139 struct std::hash<edm4eic::MutableMCRecoTrackerHitAssociation> {
0140   std::size_t operator()(const edm4eic::MutableMCRecoTrackerHitAssociation& obj) const {
0141     return std::hash<edm4eic::MCRecoTrackerHitAssociationObj*>{}(obj.m_obj.get());
0142   }
0143 };
0144 
0145 
0146 #endif