Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-21 09:58:22

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 MCParticle;
0024 class MutableMCParticle;
0025 } // namespace edm4hep
0026 
0027 namespace edm4hep {
0028 
0029 /** @class MutableCaloHitContribution
0030  *  Monte Carlo contribution to SimCalorimeterHit
0031  *  @author: F.Gaede, DESY
0032  */
0033 class MutableCaloHitContribution {
0034 
0035   friend class CaloHitContributionCollection;
0036   friend class CaloHitContributionMutableCollectionIterator;
0037   friend class CaloHitContribution;
0038 
0039 public:
0040   using object_type = CaloHitContribution;
0041   using collection_type = CaloHitContributionCollection;
0042 
0043   /// default constructor
0044   MutableCaloHitContribution();
0045 
0046   /// Constructor initializing all members
0047   MutableCaloHitContribution(std::int32_t PDG, float energy, float time, edm4hep::Vector3f stepPosition);
0048 
0049   /// copy constructor
0050   MutableCaloHitContribution(const MutableCaloHitContribution& other) = default;
0051 
0052   /// copy-assignment operator
0053   MutableCaloHitContribution& operator=(MutableCaloHitContribution other);
0054 
0055   /// create a mutable deep-copy of the object with identical relations
0056   /// if cloneRelations=false, the relations are not cloned and will be empty
0057   MutableCaloHitContribution clone(bool cloneRelations = true) const;
0058 
0059   /// destructor
0060   ~MutableCaloHitContribution() = default;
0061 
0062 public:
0063   /// Access the PDG code of the shower particle that caused this contribution.
0064   std::int32_t getPDG() const;
0065 
0066   /// Access the energy in [GeV] of the this contribution
0067   float getEnergy() const;
0068 
0069   /// Access the time in [ns] of this contribution
0070   float getTime() const;
0071 
0072   /// Access the position of this energy deposition (step) [mm]
0073   const edm4hep::Vector3f& getStepPosition() const;
0074 
0075   /// Access the primary MCParticle that caused the shower responsible for this contribution to the hit.
0076   const edm4hep::MCParticle getParticle() const;
0077 
0078   /// Set the PDG code of the shower particle that caused this contribution.
0079   void setPDG(std::int32_t value);
0080   /// Get mutable reference to PDG code of the shower particle that caused this contribution.
0081   std::int32_t& getPDG();
0082   /// Get reference to PDG code of the shower particle that caused this contribution.
0083   [[deprecated("use getPDG instead")]] std::int32_t& PDG();
0084 
0085   /// Set the energy in [GeV] of the this contribution
0086   void setEnergy(float value);
0087   /// Get mutable reference to energy in [GeV] of the this contribution
0088   float& getEnergy();
0089   /// Get reference to energy in [GeV] of the this contribution
0090   [[deprecated("use getEnergy instead")]] float& energy();
0091 
0092   /// Set the time in [ns] of this contribution
0093   void setTime(float value);
0094   /// Get mutable reference to time in [ns] of this contribution
0095   float& getTime();
0096   /// Get reference to time in [ns] of this contribution
0097   [[deprecated("use getTime instead")]] float& time();
0098 
0099   /// Set the position of this energy deposition (step) [mm]
0100   void setStepPosition(edm4hep::Vector3f value);
0101   /// Get mutable reference to position of this energy deposition (step) [mm]
0102   edm4hep::Vector3f& getStepPosition();
0103   /// Get reference to position of this energy deposition (step) [mm]
0104   [[deprecated("use getStepPosition instead")]] edm4hep::Vector3f& stepPosition();
0105 
0106   /// Set the primary MCParticle that caused the shower responsible for this contribution to the hit.
0107   void setParticle(const edm4hep::MCParticle& value);
0108 
0109   /// check whether the object is actually available
0110   bool isAvailable() const;
0111   /// disconnect from CaloHitContributionObj instance
0112   void unlink() {
0113     m_obj = podio::utils::MaybeSharedPtr<CaloHitContributionObj>{nullptr};
0114   }
0115 
0116   bool operator==(const MutableCaloHitContribution& other) const {
0117     return m_obj == other.m_obj;
0118   }
0119   bool operator==(const CaloHitContribution& other) const;
0120 
0121   bool operator!=(const MutableCaloHitContribution& other) const {
0122     return !(*this == other);
0123   }
0124   bool operator!=(const CaloHitContribution& other) const {
0125     return !(*this == other);
0126   }
0127 
0128   // less comparison operator, so that objects can be e.g. stored in sets.
0129   bool operator<(const MutableCaloHitContribution& other) const {
0130     return m_obj < other.m_obj;
0131   }
0132 
0133   podio::ObjectID id() const {
0134     return getObjectID();
0135   }
0136 
0137   const podio::ObjectID getObjectID() const;
0138 
0139   friend void swap(MutableCaloHitContribution& a, MutableCaloHitContribution& b) {
0140     using std::swap;
0141     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0142   }
0143 
0144 private:
0145   /// constructor from existing CaloHitContributionObj
0146   explicit MutableCaloHitContribution(podio::utils::MaybeSharedPtr<CaloHitContributionObj> obj);
0147 
0148   podio::utils::MaybeSharedPtr<CaloHitContributionObj> m_obj{nullptr};
0149 };
0150 
0151 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0152 void to_json(nlohmann::json& j, const MutableCaloHitContribution& value);
0153 #endif
0154 
0155 } // namespace edm4hep
0156 
0157 #endif