Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-12-05 10:56:50

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() = default;
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) noexcept = default;
0056 
0057   /// move constructor
0058   MutableCalorimeterHit(MutableCalorimeterHit&& other) noexcept = default;
0059 
0060   /// copy-assignment operator
0061   MutableCalorimeterHit& operator=(MutableCalorimeterHit other) &; // Rebind this to other's internal object
0062   MutableCalorimeterHit& operator=(MutableCalorimeterHit other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
0063 
0064   /// create a mutable deep-copy of the object with identical relations
0065   /// if cloneRelations=false, the relations are not cloned and will be empty
0066   MutableCalorimeterHit clone(bool cloneRelations=true) const;
0067 
0068   /// destructor
0069   ~MutableCalorimeterHit() = default;
0070 
0071 
0072 public:
0073 
0074   /// Access the The detector specific (geometrical) cell id.
0075   std::uint64_t getCellID() const;
0076 
0077   /// Access the The energy for this hit in [GeV].
0078   float getEnergy() const;
0079 
0080   /// Access the Error on energy [GeV].
0081   float getEnergyError() const;
0082 
0083   /// Access the The time of the hit in [ns].
0084   float getTime() const;
0085 
0086   /// Access the Error on the time
0087   float getTimeError() const;
0088 
0089   /// Access the The global position of the hit in world coordinates [mm].
0090   const edm4hep::Vector3f& getPosition() const;
0091 
0092   /// Access the The dimension information of the cell [mm].
0093   const edm4hep::Vector3f& getDimension() const;
0094 
0095   /// Access the Sector that this hit occurred in
0096   std::int32_t getSector() const;
0097 
0098   /// Access the Layer that the hit occurred in
0099   std::int32_t getLayer() const;
0100 
0101   /// Access the The local coordinates of the hit in the detector segment [mm].
0102   const edm4hep::Vector3f& getLocal() const;
0103 
0104 
0105   /// Access the Related raw calorimeter hit
0106   const edm4hep::RawCalorimeterHit getRawHit() const;
0107 
0108   /// Set the The detector specific (geometrical) cell id.
0109   void setCellID(const std::uint64_t cellID);
0110   /// Get mutable reference to The detector specific (geometrical) cell id.
0111   std::uint64_t& getCellID();
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 
0118   /// Set the Error on energy [GeV].
0119   void setEnergyError(const float energyError);
0120   /// Get mutable reference to Error on energy [GeV].
0121   float& getEnergyError();
0122 
0123   /// Set the The time of the hit in [ns].
0124   void setTime(const float time);
0125   /// Get mutable reference to The time of the hit in [ns].
0126   float& getTime();
0127 
0128   /// Set the Error on the time
0129   void setTimeError(const float timeError);
0130   /// Get mutable reference to Error on the time
0131   float& getTimeError();
0132 
0133   /// Set the The global position of the hit in world coordinates [mm].
0134   void setPosition(const edm4hep::Vector3f& position);
0135   /// Get mutable reference to The global position of the hit in world coordinates [mm].
0136   edm4hep::Vector3f& getPosition();
0137 
0138   /// Set the The dimension information of the cell [mm].
0139   void setDimension(const edm4hep::Vector3f& dimension);
0140   /// Get mutable reference to The dimension information of the cell [mm].
0141   edm4hep::Vector3f& getDimension();
0142 
0143   /// Set the Sector that this hit occurred in
0144   void setSector(const std::int32_t sector);
0145   /// Get mutable reference to Sector that this hit occurred in
0146   std::int32_t& getSector();
0147 
0148   /// Set the Layer that the hit occurred in
0149   void setLayer(const std::int32_t layer);
0150   /// Get mutable reference to Layer that the hit occurred in
0151   std::int32_t& getLayer();
0152 
0153   /// Set the The local coordinates of the hit in the detector segment [mm].
0154   void setLocal(const edm4hep::Vector3f& local);
0155   /// Get mutable reference to The local coordinates of the hit in the detector segment [mm].
0156   edm4hep::Vector3f& getLocal();
0157 
0158 
0159   /// Set the Related raw calorimeter hit
0160   void setRawHit(const edm4hep::RawCalorimeterHit& value);
0161 
0162 
0163 
0164 
0165   /// check whether the object is actually available
0166   bool isAvailable() const;
0167   /// disconnect from CalorimeterHitObj instance
0168   void unlink() { m_obj = podio::utils::MaybeSharedPtr<CalorimeterHitObj>{nullptr}; }
0169 
0170   constexpr bool operator==(const MutableCalorimeterHit& other) const { return m_obj == other.m_obj; }
0171   bool operator==(const CalorimeterHit& other) const;
0172 
0173   constexpr bool operator!=(const MutableCalorimeterHit& other) const { return !(*this == other); }
0174   bool operator!=(const CalorimeterHit& other) const { return !(*this == other); }
0175 
0176   // less comparison operator, so that objects can be e.g. stored in sets.
0177   bool operator<(const MutableCalorimeterHit& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
0178 
0179   podio::ObjectID id() const { return getObjectID(); }
0180 
0181   const podio::ObjectID getObjectID() const;
0182 
0183   friend std::hash<MutableCalorimeterHit>;
0184 
0185   friend void swap(MutableCalorimeterHit& a, MutableCalorimeterHit& b) {
0186     using std::swap;
0187     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0188   }
0189 
0190 private:
0191   /// constructor from existing CalorimeterHitObj
0192   explicit MutableCalorimeterHit(podio::utils::MaybeSharedPtr<CalorimeterHitObj> obj);
0193 
0194   podio::utils::MaybeSharedPtr<CalorimeterHitObj> m_obj{new CalorimeterHitObj{}, podio::utils::MarkOwned};
0195 };
0196 
0197 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0198 void to_json(nlohmann::json& j, const MutableCalorimeterHit& value);
0199 #endif
0200 
0201 
0202 } // namespace edm4eic
0203 
0204 
0205 
0206 template<>
0207 struct std::hash<edm4eic::MutableCalorimeterHit> {
0208   std::size_t operator()(const edm4eic::MutableCalorimeterHit& obj) const {
0209     return std::hash<edm4eic::CalorimeterHitObj*>{}(obj.m_obj.get());
0210   }
0211 };
0212 
0213 
0214 #endif