File indexing completed on 2025-10-26 08:41:17
0001 
0002 
0003 #ifndef EDM4EIC_MutableCalorimeterHit_H
0004 #define EDM4EIC_MutableCalorimeterHit_H
0005 
0006 #include "edm4eic/CalorimeterHitObj.h"
0007 
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 
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 
0035 
0036 
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   
0049   MutableCalorimeterHit();
0050 
0051   
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   
0055   MutableCalorimeterHit(const MutableCalorimeterHit& other) = default;
0056 
0057   
0058   MutableCalorimeterHit& operator=(MutableCalorimeterHit other) &; 
0059   MutableCalorimeterHit& operator=(MutableCalorimeterHit other) && = delete; 
0060 
0061   
0062   
0063   MutableCalorimeterHit clone(bool cloneRelations=true) const;
0064 
0065   
0066   ~MutableCalorimeterHit() = default;
0067 
0068 
0069 public:
0070 
0071   
0072   std::uint64_t getCellID() const;
0073 
0074   
0075   float getEnergy() const;
0076 
0077   
0078   float getEnergyError() const;
0079 
0080   
0081   float getTime() const;
0082 
0083   
0084   float getTimeError() const;
0085 
0086   
0087   const edm4hep::Vector3f& getPosition() const;
0088 
0089   
0090   const edm4hep::Vector3f& getDimension() const;
0091 
0092   
0093   std::int32_t getSector() const;
0094 
0095   
0096   std::int32_t getLayer() const;
0097 
0098   
0099   const edm4hep::Vector3f& getLocal() const;
0100 
0101 
0102   
0103   const edm4hep::RawCalorimeterHit getRawHit() const;
0104 
0105   
0106   void setCellID(const std::uint64_t cellID);
0107   
0108   std::uint64_t& getCellID();
0109   
0110   [[deprecated("use getCellID instead")]]
0111   std::uint64_t& cellID();
0112 
0113   
0114   void setEnergy(const float energy);
0115   
0116   float& getEnergy();
0117   
0118   [[deprecated("use getEnergy instead")]]
0119   float& energy();
0120 
0121   
0122   void setEnergyError(const float energyError);
0123   
0124   float& getEnergyError();
0125   
0126   [[deprecated("use getEnergyError instead")]]
0127   float& energyError();
0128 
0129   
0130   void setTime(const float time);
0131   
0132   float& getTime();
0133   
0134   [[deprecated("use getTime instead")]]
0135   float& time();
0136 
0137   
0138   void setTimeError(const float timeError);
0139   
0140   float& getTimeError();
0141   
0142   [[deprecated("use getTimeError instead")]]
0143   float& timeError();
0144 
0145   
0146   void setPosition(const edm4hep::Vector3f& position);
0147   
0148   edm4hep::Vector3f& getPosition();
0149   
0150   [[deprecated("use getPosition instead")]]
0151   edm4hep::Vector3f& position();
0152 
0153   
0154   void setDimension(const edm4hep::Vector3f& dimension);
0155   
0156   edm4hep::Vector3f& getDimension();
0157   
0158   [[deprecated("use getDimension instead")]]
0159   edm4hep::Vector3f& dimension();
0160 
0161   
0162   void setSector(const std::int32_t sector);
0163   
0164   std::int32_t& getSector();
0165   
0166   [[deprecated("use getSector instead")]]
0167   std::int32_t& sector();
0168 
0169   
0170   void setLayer(const std::int32_t layer);
0171   
0172   std::int32_t& getLayer();
0173   
0174   [[deprecated("use getLayer instead")]]
0175   std::int32_t& layer();
0176 
0177   
0178   void setLocal(const edm4hep::Vector3f& local);
0179   
0180   edm4hep::Vector3f& getLocal();
0181   
0182   [[deprecated("use getLocal instead")]]
0183   edm4hep::Vector3f& local();
0184 
0185 
0186   
0187   void setRawHit(const edm4hep::RawCalorimeterHit& value);
0188 
0189 
0190 
0191 
0192   
0193   bool isAvailable() const;
0194   
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   
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); 
0215   }
0216 
0217 private:
0218   
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 } 
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