Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-10-26 08:41:17

0001 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
0002 
0003 #ifndef EDM4EIC_MutableCalorimeterHit_H
0004 #define EDM4EIC_MutableCalorimeterHit_H
0005 
0006 #include "edm4eic/CalorimeterHitObj.h"
0007 // Make the immutable class available from its mutable version but not vice versa
0008 #include "edm4eic/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 edm4eic {
0023 class CalorimeterHitCollection;
0024 }
0025 namespace edm4hep {
0026 class RawCalorimeterHit;
0027 class MutableRawCalorimeterHit;
0028 }
0029 
0030 
0031 namespace edm4eic {
0032 
0033 
0034 /** @class MutableCalorimeterHit
0035  *  Calorimeter hit
0036  *  @author: W. Armstrong, S. Joosten
0037  */
0038 class MutableCalorimeterHit {
0039 
0040   friend class CalorimeterHitCollection;
0041   friend class CalorimeterHitMutableCollectionIterator;
0042   friend class CalorimeterHit;
0043 
0044 public:
0045   using object_type = CalorimeterHit;
0046   using collection_type = CalorimeterHitCollection;
0047 
0048   /// default constructor
0049   MutableCalorimeterHit();
0050 
0051   /// Constructor initializing all members
0052   MutableCalorimeterHit(const std::uint64_t cellID, const float energy, const float energyError, const float time, const float timeError, const edm4hep::Vector3f& position, const edm4hep::Vector3f& dimension, const std::int32_t sector, const std::int32_t layer, const edm4hep::Vector3f& local);
0053 
0054   /// copy constructor
0055   MutableCalorimeterHit(const MutableCalorimeterHit& other) = default;
0056 
0057   /// copy-assignment operator
0058   MutableCalorimeterHit& operator=(MutableCalorimeterHit other) &; // Rebind this to other's internal object
0059   MutableCalorimeterHit& operator=(MutableCalorimeterHit other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
0060 
0061   /// create a mutable deep-copy of the object with identical relations
0062   /// if cloneRelations=false, the relations are not cloned and will be empty
0063   MutableCalorimeterHit clone(bool cloneRelations=true) const;
0064 
0065   /// destructor
0066   ~MutableCalorimeterHit() = default;
0067 
0068 
0069 public:
0070 
0071   /// Access the The detector specific (geometrical) cell id.
0072   std::uint64_t getCellID() const;
0073 
0074   /// Access the The energy for this hit in [GeV].
0075   float getEnergy() const;
0076 
0077   /// Access the Error on energy [GeV].
0078   float getEnergyError() const;
0079 
0080   /// Access the The time of the hit in [ns].
0081   float getTime() const;
0082 
0083   /// Access the Error on the time
0084   float getTimeError() const;
0085 
0086   /// Access the The global position of the hit in world coordinates [mm].
0087   const edm4hep::Vector3f& getPosition() const;
0088 
0089   /// Access the The dimension information of the cell [mm].
0090   const edm4hep::Vector3f& getDimension() const;
0091 
0092   /// Access the Sector that this hit occurred in
0093   std::int32_t getSector() const;
0094 
0095   /// Access the Layer that the hit occurred in
0096   std::int32_t getLayer() const;
0097 
0098   /// Access the The local coordinates of the hit in the detector segment [mm].
0099   const edm4hep::Vector3f& getLocal() const;
0100 
0101 
0102   /// Access the Related raw calorimeter hit
0103   const edm4hep::RawCalorimeterHit getRawHit() const;
0104 
0105   /// Set the The detector specific (geometrical) cell id.
0106   void setCellID(const std::uint64_t cellID);
0107   /// Get mutable reference to The detector specific (geometrical) cell id.
0108   std::uint64_t& getCellID();
0109   /// Get reference to The detector specific (geometrical) cell id.
0110   [[deprecated("use getCellID instead")]]
0111   std::uint64_t& cellID();
0112 
0113   /// Set the The energy for this hit in [GeV].
0114   void setEnergy(const float energy);
0115   /// Get mutable reference to The energy for this hit in [GeV].
0116   float& getEnergy();
0117   /// Get reference to The energy for this hit in [GeV].
0118   [[deprecated("use getEnergy instead")]]
0119   float& energy();
0120 
0121   /// Set the Error on energy [GeV].
0122   void setEnergyError(const float energyError);
0123   /// Get mutable reference to Error on energy [GeV].
0124   float& getEnergyError();
0125   /// Get reference to Error on energy [GeV].
0126   [[deprecated("use getEnergyError instead")]]
0127   float& energyError();
0128 
0129   /// Set the The time of the hit in [ns].
0130   void setTime(const float time);
0131   /// Get mutable reference to The time of the hit in [ns].
0132   float& getTime();
0133   /// Get reference to The time of the hit in [ns].
0134   [[deprecated("use getTime instead")]]
0135   float& time();
0136 
0137   /// Set the Error on the time
0138   void setTimeError(const float timeError);
0139   /// Get mutable reference to Error on the time
0140   float& getTimeError();
0141   /// Get reference to Error on the time
0142   [[deprecated("use getTimeError instead")]]
0143   float& timeError();
0144 
0145   /// Set the The global position of the hit in world coordinates [mm].
0146   void setPosition(const edm4hep::Vector3f& position);
0147   /// Get mutable reference to The global position of the hit in world coordinates [mm].
0148   edm4hep::Vector3f& getPosition();
0149   /// Get reference to The global position of the hit in world coordinates [mm].
0150   [[deprecated("use getPosition instead")]]
0151   edm4hep::Vector3f& position();
0152 
0153   /// Set the The dimension information of the cell [mm].
0154   void setDimension(const edm4hep::Vector3f& dimension);
0155   /// Get mutable reference to The dimension information of the cell [mm].
0156   edm4hep::Vector3f& getDimension();
0157   /// Get reference to The dimension information of the cell [mm].
0158   [[deprecated("use getDimension instead")]]
0159   edm4hep::Vector3f& dimension();
0160 
0161   /// Set the Sector that this hit occurred in
0162   void setSector(const std::int32_t sector);
0163   /// Get mutable reference to Sector that this hit occurred in
0164   std::int32_t& getSector();
0165   /// Get reference to Sector that this hit occurred in
0166   [[deprecated("use getSector instead")]]
0167   std::int32_t& sector();
0168 
0169   /// Set the Layer that the hit occurred in
0170   void setLayer(const std::int32_t layer);
0171   /// Get mutable reference to Layer that the hit occurred in
0172   std::int32_t& getLayer();
0173   /// Get reference to Layer that the hit occurred in
0174   [[deprecated("use getLayer instead")]]
0175   std::int32_t& layer();
0176 
0177   /// Set the The local coordinates of the hit in the detector segment [mm].
0178   void setLocal(const edm4hep::Vector3f& local);
0179   /// Get mutable reference to The local coordinates of the hit in the detector segment [mm].
0180   edm4hep::Vector3f& getLocal();
0181   /// Get reference to The local coordinates of the hit in the detector segment [mm].
0182   [[deprecated("use getLocal instead")]]
0183   edm4hep::Vector3f& local();
0184 
0185 
0186   /// Set the Related raw calorimeter hit
0187   void setRawHit(const edm4hep::RawCalorimeterHit& value);
0188 
0189 
0190 
0191 
0192   /// check whether the object is actually available
0193   bool isAvailable() const;
0194   /// disconnect from CalorimeterHitObj instance
0195   void unlink() { m_obj = podio::utils::MaybeSharedPtr<CalorimeterHitObj>{nullptr}; }
0196 
0197   bool operator==(const MutableCalorimeterHit& other) const { return m_obj == other.m_obj; }
0198   bool operator==(const CalorimeterHit& other) const;
0199 
0200   bool operator!=(const MutableCalorimeterHit& other) const { return !(*this == other); }
0201   bool operator!=(const CalorimeterHit& other) const { return !(*this == other); }
0202 
0203   // less comparison operator, so that objects can be e.g. stored in sets.
0204   bool operator<(const MutableCalorimeterHit& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
0205 
0206   podio::ObjectID id() const { return getObjectID(); }
0207 
0208   const podio::ObjectID getObjectID() const;
0209 
0210   friend std::hash<MutableCalorimeterHit>;
0211 
0212   friend void swap(MutableCalorimeterHit& a, MutableCalorimeterHit& b) {
0213     using std::swap;
0214     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0215   }
0216 
0217 private:
0218   /// constructor from existing CalorimeterHitObj
0219   explicit MutableCalorimeterHit(podio::utils::MaybeSharedPtr<CalorimeterHitObj> obj);
0220 
0221   podio::utils::MaybeSharedPtr<CalorimeterHitObj> m_obj{nullptr};
0222 };
0223 
0224 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0225 void to_json(nlohmann::json& j, const MutableCalorimeterHit& value);
0226 #endif
0227 
0228 
0229 } // namespace edm4eic
0230 
0231 
0232 
0233 template<>
0234 struct std::hash<edm4eic::MutableCalorimeterHit> {
0235   std::size_t operator()(const edm4eic::MutableCalorimeterHit& obj) const {
0236     return std::hash<edm4eic::CalorimeterHitObj*>{}(obj.m_obj.get());
0237   }
0238 };
0239 
0240 
0241 #endif