Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-01-01 09:41:40

0001 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
0002 
0003 #ifndef EDM4HEP_MutableCalorimeterHit_H
0004 #define EDM4HEP_MutableCalorimeterHit_H
0005 
0006 #include "edm4hep/CalorimeterHitObj.h"
0007 // Make the immutable class available from its mutable version but not vice versa
0008 #include "edm4hep/CalorimeterHit.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 CalorimeterHitCollection;
0024 }
0025 
0026 namespace edm4hep {
0027 
0028 /** @class MutableCalorimeterHit
0029  *  Calorimeter hit
0030  *  @author: EDM4hep authors
0031  */
0032 class MutableCalorimeterHit {
0033 
0034   friend class CalorimeterHitCollection;
0035   friend class CalorimeterHitMutableCollectionIterator;
0036   friend class CalorimeterHit;
0037 
0038 public:
0039   using object_type = CalorimeterHit;
0040   using collection_type = CalorimeterHitCollection;
0041 
0042   /// default constructor
0043   MutableCalorimeterHit() = default;
0044 
0045   /// Constructor initializing all members
0046   MutableCalorimeterHit(const std::uint64_t cellID, const float energy, const float energyError, const float time,
0047                         const edm4hep::Vector3f& position, const std::int32_t type);
0048 
0049   /// copy constructor
0050   MutableCalorimeterHit(const MutableCalorimeterHit& other) = default;
0051 
0052   /// copy-assignment operator
0053   MutableCalorimeterHit& operator=(MutableCalorimeterHit other) &; // Rebind this to other's internal object
0054   MutableCalorimeterHit&
0055   operator=(MutableCalorimeterHit other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
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   MutableCalorimeterHit clone(bool cloneRelations = true) const;
0060 
0061   /// destructor
0062   ~MutableCalorimeterHit() = default;
0063 
0064 public:
0065   /// Access the detector specific (geometrical) cell id
0066   std::uint64_t getCellID() const;
0067 
0068   /// Access the energy of the hit [GeV]
0069   float getEnergy() const;
0070 
0071   /// Access the error of the hit energy [GeV]
0072   float getEnergyError() const;
0073 
0074   /// Access the time of the hit [ns]
0075   float getTime() const;
0076 
0077   /// Access the position of the hit in world coordinates [mm]
0078   const edm4hep::Vector3f& getPosition() const;
0079 
0080   /// Access the type of hit
0081   std::int32_t getType() const;
0082 
0083   /// Set the detector specific (geometrical) cell id
0084   void setCellID(const std::uint64_t cellID);
0085   /// Get mutable reference to detector specific (geometrical) cell id
0086   std::uint64_t& getCellID();
0087   /// Get reference to detector specific (geometrical) cell id
0088   [[deprecated("use getCellID instead")]] std::uint64_t& cellID();
0089 
0090   /// Set the energy of the hit [GeV]
0091   void setEnergy(const float energy);
0092   /// Get mutable reference to energy of the hit [GeV]
0093   float& getEnergy();
0094   /// Get reference to energy of the hit [GeV]
0095   [[deprecated("use getEnergy instead")]] float& energy();
0096 
0097   /// Set the error of the hit energy [GeV]
0098   void setEnergyError(const float energyError);
0099   /// Get mutable reference to error of the hit energy [GeV]
0100   float& getEnergyError();
0101   /// Get reference to error of the hit energy [GeV]
0102   [[deprecated("use getEnergyError instead")]] float& energyError();
0103 
0104   /// Set the time of the hit [ns]
0105   void setTime(const float time);
0106   /// Get mutable reference to time of the hit [ns]
0107   float& getTime();
0108   /// Get reference to time of the hit [ns]
0109   [[deprecated("use getTime instead")]] float& time();
0110 
0111   /// Set the position of the hit in world coordinates [mm]
0112   void setPosition(const edm4hep::Vector3f& position);
0113   /// Get mutable reference to position of the hit in world coordinates [mm]
0114   edm4hep::Vector3f& getPosition();
0115   /// Get reference to position of the hit in world coordinates [mm]
0116   [[deprecated("use getPosition instead")]] edm4hep::Vector3f& position();
0117 
0118   /// Set the type of hit
0119   void setType(const std::int32_t type);
0120   /// Get mutable reference to type of hit
0121   std::int32_t& getType();
0122   /// Get reference to type of hit
0123   [[deprecated("use getType instead")]] std::int32_t& type();
0124 
0125   /// check whether the object is actually available
0126   bool isAvailable() const;
0127   /// disconnect from CalorimeterHitObj instance
0128   void unlink() { m_obj = podio::utils::MaybeSharedPtr<CalorimeterHitObj>{nullptr}; }
0129 
0130   bool operator==(const MutableCalorimeterHit& other) const { return m_obj == other.m_obj; }
0131   bool operator==(const CalorimeterHit& other) const;
0132 
0133   bool operator!=(const MutableCalorimeterHit& other) const { return !(*this == other); }
0134   bool operator!=(const CalorimeterHit& other) const { return !(*this == other); }
0135 
0136   // less comparison operator, so that objects can be e.g. stored in sets.
0137   bool operator<(const MutableCalorimeterHit& other) const {
0138     return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other);
0139   }
0140 
0141   podio::ObjectID id() const { return getObjectID(); }
0142 
0143   const podio::ObjectID getObjectID() const;
0144 
0145   friend std::hash<MutableCalorimeterHit>;
0146 
0147   friend void swap(MutableCalorimeterHit& a, MutableCalorimeterHit& b) {
0148     using std::swap;
0149     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0150   }
0151 
0152 private:
0153   /// constructor from existing CalorimeterHitObj
0154   explicit MutableCalorimeterHit(podio::utils::MaybeSharedPtr<CalorimeterHitObj> obj);
0155 
0156   podio::utils::MaybeSharedPtr<CalorimeterHitObj> m_obj{new CalorimeterHitObj{}, podio::utils::MarkOwned};
0157 };
0158 
0159 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0160 void to_json(nlohmann::json& j, const MutableCalorimeterHit& value);
0161 #endif
0162 
0163 } // namespace edm4hep
0164 
0165 template <>
0166 struct std::hash<edm4hep::MutableCalorimeterHit> {
0167   std::size_t operator()(const edm4hep::MutableCalorimeterHit& obj) const {
0168     return std::hash<edm4hep::CalorimeterHitObj*>{}(obj.m_obj.get());
0169   }
0170 };
0171 
0172 #endif