Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-07-09 08:30:16

0001 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
0002 
0003 #ifndef EDM4HEP_MutableSimCalorimeterHit_H
0004 #define EDM4HEP_MutableSimCalorimeterHit_H
0005 
0006 #include "edm4hep/SimCalorimeterHitObj.h"
0007 // Make the immutable class available from its mutable version but not vice versa
0008 #include "edm4hep/SimCalorimeterHit.h"
0009 
0010 #include "edm4hep/CaloHitContribution.h"
0011 #include "edm4hep/Vector3f.h"
0012 #include "podio/RelationRange.h"
0013 #include <cstdint>
0014 #include <vector>
0015 
0016 #include "podio/utilities/MaybeSharedPtr.h"
0017 
0018 #include <cstdint>
0019 
0020 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0021 #include "nlohmann/json_fwd.hpp"
0022 #endif
0023 
0024 // forward declarations
0025 namespace edm4hep {
0026 class SimCalorimeterHitCollection;
0027 }
0028 
0029 namespace edm4hep {
0030 
0031 /** @class MutableSimCalorimeterHit
0032  *  Simulated calorimeter hit
0033  *  @author: EDM4hep authors
0034  */
0035 class MutableSimCalorimeterHit {
0036 
0037   friend class SimCalorimeterHitCollection;
0038   friend class SimCalorimeterHitMutableCollectionIterator;
0039   friend class SimCalorimeterHit;
0040 
0041 public:
0042   using object_type = SimCalorimeterHit;
0043   using collection_type = SimCalorimeterHitCollection;
0044 
0045   /// default constructor
0046   MutableSimCalorimeterHit();
0047 
0048   /// Constructor initializing all members
0049   MutableSimCalorimeterHit(std::uint64_t cellID, float energy, edm4hep::Vector3f position);
0050 
0051   /// copy constructor
0052   MutableSimCalorimeterHit(const MutableSimCalorimeterHit& other) = default;
0053 
0054   /// copy-assignment operator
0055   MutableSimCalorimeterHit& operator=(MutableSimCalorimeterHit other);
0056 
0057   /// create a mutable deep-copy of the object with identical relations
0058   /// if cloneRelations=false, the relations are not cloned and will be empty
0059   MutableSimCalorimeterHit clone(bool cloneRelations = true) const;
0060 
0061   /// destructor
0062   ~MutableSimCalorimeterHit() = default;
0063 
0064 public:
0065   /// Access the ID of the sensor that created this hit
0066   std::uint64_t getCellID() const;
0067 
0068   /// Access the energy of the hit [GeV]
0069   float getEnergy() const;
0070 
0071   /// Access the position of the hit in world coordinates [mm]
0072   const edm4hep::Vector3f& getPosition() const;
0073 
0074   /// Set the ID of the sensor that created this hit
0075   void setCellID(std::uint64_t value);
0076   /// Get mutable reference to ID of the sensor that created this hit
0077   std::uint64_t& getCellID();
0078   /// Get reference to ID of the sensor that created this hit
0079   [[deprecated("use getCellID instead")]] std::uint64_t& cellID();
0080 
0081   /// Set the energy of the hit [GeV]
0082   void setEnergy(float value);
0083   /// Get mutable reference to energy of the hit [GeV]
0084   float& getEnergy();
0085   /// Get reference to energy of the hit [GeV]
0086   [[deprecated("use getEnergy instead")]] float& energy();
0087 
0088   /// Set the position of the hit in world coordinates [mm]
0089   void setPosition(edm4hep::Vector3f value);
0090   /// Get mutable reference to position of the hit in world coordinates [mm]
0091   edm4hep::Vector3f& getPosition();
0092   /// Get reference to position of the hit in world coordinates [mm]
0093   [[deprecated("use getPosition instead")]] edm4hep::Vector3f& position();
0094 
0095   void addToContributions(const edm4hep::CaloHitContribution&);
0096   std::size_t contributions_size() const;
0097   edm4hep::CaloHitContribution getContributions(std::size_t) const;
0098   std::vector<edm4hep::CaloHitContribution>::const_iterator contributions_begin() const;
0099   std::vector<edm4hep::CaloHitContribution>::const_iterator contributions_end() const;
0100   podio::RelationRange<edm4hep::CaloHitContribution> getContributions() const;
0101 
0102   /// check whether the object is actually available
0103   bool isAvailable() const;
0104   /// disconnect from SimCalorimeterHitObj instance
0105   void unlink() {
0106     m_obj = podio::utils::MaybeSharedPtr<SimCalorimeterHitObj>{nullptr};
0107   }
0108 
0109   bool operator==(const MutableSimCalorimeterHit& other) const {
0110     return m_obj == other.m_obj;
0111   }
0112   bool operator==(const SimCalorimeterHit& other) const;
0113 
0114   bool operator!=(const MutableSimCalorimeterHit& other) const {
0115     return !(*this == other);
0116   }
0117   bool operator!=(const SimCalorimeterHit& other) const {
0118     return !(*this == other);
0119   }
0120 
0121   // less comparison operator, so that objects can be e.g. stored in sets.
0122   bool operator<(const MutableSimCalorimeterHit& other) const {
0123     return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other);
0124   }
0125 
0126   podio::ObjectID id() const {
0127     return getObjectID();
0128   }
0129 
0130   const podio::ObjectID getObjectID() const;
0131 
0132   friend void swap(MutableSimCalorimeterHit& a, MutableSimCalorimeterHit& b) {
0133     using std::swap;
0134     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0135   }
0136 
0137 private:
0138   /// constructor from existing SimCalorimeterHitObj
0139   explicit MutableSimCalorimeterHit(podio::utils::MaybeSharedPtr<SimCalorimeterHitObj> obj);
0140 
0141   podio::utils::MaybeSharedPtr<SimCalorimeterHitObj> m_obj{nullptr};
0142 };
0143 
0144 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0145 void to_json(nlohmann::json& j, const MutableSimCalorimeterHit& value);
0146 #endif
0147 
0148 } // namespace edm4hep
0149 
0150 #endif