Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-17 08:55:11

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