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