Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-07-05 08:52:34

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();
0044 
0045   /// Constructor initializing all members
0046   MutableCalorimeterHit(std::uint64_t cellID, float energy, float energyError, float time, edm4hep::Vector3f position,
0047                         std::int32_t type);
0048 
0049   /// copy constructor
0050   MutableCalorimeterHit(const MutableCalorimeterHit& other) = default;
0051 
0052   /// copy-assignment operator
0053   MutableCalorimeterHit& operator=(MutableCalorimeterHit 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   MutableCalorimeterHit clone(bool cloneRelations = true) const;
0058 
0059   /// destructor
0060   ~MutableCalorimeterHit() = default;
0061 
0062 public:
0063   /// Access the detector specific (geometrical) cell id
0064   std::uint64_t getCellID() const;
0065 
0066   /// Access the energy of the hit [GeV]
0067   float getEnergy() const;
0068 
0069   /// Access the error of the hit energy [GeV]
0070   float getEnergyError() const;
0071 
0072   /// Access the time of the hit [ns]
0073   float getTime() const;
0074 
0075   /// Access the position of the hit in world coordinates [mm]
0076   const edm4hep::Vector3f& getPosition() const;
0077 
0078   /// Access the type of hit
0079   std::int32_t getType() const;
0080 
0081   /// Set the detector specific (geometrical) cell id
0082   void setCellID(std::uint64_t value);
0083   /// Get mutable reference to detector specific (geometrical) cell id
0084   std::uint64_t& getCellID();
0085   /// Get reference to detector specific (geometrical) cell id
0086   [[deprecated("use getCellID instead")]] std::uint64_t& cellID();
0087 
0088   /// Set the energy of the hit [GeV]
0089   void setEnergy(float value);
0090   /// Get mutable reference to energy of the hit [GeV]
0091   float& getEnergy();
0092   /// Get reference to energy of the hit [GeV]
0093   [[deprecated("use getEnergy instead")]] float& energy();
0094 
0095   /// Set the error of the hit energy [GeV]
0096   void setEnergyError(float value);
0097   /// Get mutable reference to error of the hit energy [GeV]
0098   float& getEnergyError();
0099   /// Get reference to error of the hit energy [GeV]
0100   [[deprecated("use getEnergyError instead")]] float& energyError();
0101 
0102   /// Set the time of the hit [ns]
0103   void setTime(float value);
0104   /// Get mutable reference to time of the hit [ns]
0105   float& getTime();
0106   /// Get reference to time of the hit [ns]
0107   [[deprecated("use getTime instead")]] float& time();
0108 
0109   /// Set the position of the hit in world coordinates [mm]
0110   void setPosition(edm4hep::Vector3f value);
0111   /// Get mutable reference to position of the hit in world coordinates [mm]
0112   edm4hep::Vector3f& getPosition();
0113   /// Get reference to position of the hit in world coordinates [mm]
0114   [[deprecated("use getPosition instead")]] edm4hep::Vector3f& position();
0115 
0116   /// Set the type of hit
0117   void setType(std::int32_t value);
0118   /// Get mutable reference to type of hit
0119   std::int32_t& getType();
0120   /// Get reference to type of hit
0121   [[deprecated("use getType instead")]] std::int32_t& type();
0122 
0123   /// check whether the object is actually available
0124   bool isAvailable() const;
0125   /// disconnect from CalorimeterHitObj instance
0126   void unlink() {
0127     m_obj = podio::utils::MaybeSharedPtr<CalorimeterHitObj>{nullptr};
0128   }
0129 
0130   bool operator==(const MutableCalorimeterHit& other) const {
0131     return m_obj == other.m_obj;
0132   }
0133   bool operator==(const CalorimeterHit& other) const;
0134 
0135   bool operator!=(const MutableCalorimeterHit& other) const {
0136     return !(*this == other);
0137   }
0138   bool operator!=(const CalorimeterHit& other) const {
0139     return !(*this == other);
0140   }
0141 
0142   // less comparison operator, so that objects can be e.g. stored in sets.
0143   bool operator<(const MutableCalorimeterHit& other) const {
0144     return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other);
0145   }
0146 
0147   podio::ObjectID id() const {
0148     return getObjectID();
0149   }
0150 
0151   const podio::ObjectID getObjectID() const;
0152 
0153   friend void swap(MutableCalorimeterHit& a, MutableCalorimeterHit& b) {
0154     using std::swap;
0155     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0156   }
0157 
0158 private:
0159   /// constructor from existing CalorimeterHitObj
0160   explicit MutableCalorimeterHit(podio::utils::MaybeSharedPtr<CalorimeterHitObj> obj);
0161 
0162   podio::utils::MaybeSharedPtr<CalorimeterHitObj> m_obj{nullptr};
0163 };
0164 
0165 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0166 void to_json(nlohmann::json& j, const MutableCalorimeterHit& value);
0167 #endif
0168 
0169 } // namespace edm4hep
0170 
0171 #endif