Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-06 09:04:47

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) = 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 
0110   /// Set the The energy for this hit in [GeV].
0111   void setEnergy(const float energy);
0112   /// Get mutable reference to The energy for this hit in [GeV].
0113   float& getEnergy();
0114 
0115   /// Set the Error on energy [GeV].
0116   void setEnergyError(const float energyError);
0117   /// Get mutable reference to Error on energy [GeV].
0118   float& getEnergyError();
0119 
0120   /// Set the The time of the hit in [ns].
0121   void setTime(const float time);
0122   /// Get mutable reference to The time of the hit in [ns].
0123   float& getTime();
0124 
0125   /// Set the Error on the time
0126   void setTimeError(const float timeError);
0127   /// Get mutable reference to Error on the time
0128   float& getTimeError();
0129 
0130   /// Set the The global position of the hit in world coordinates [mm].
0131   void setPosition(const edm4hep::Vector3f& position);
0132   /// Get mutable reference to The global position of the hit in world coordinates [mm].
0133   edm4hep::Vector3f& getPosition();
0134 
0135   /// Set the The dimension information of the cell [mm].
0136   void setDimension(const edm4hep::Vector3f& dimension);
0137   /// Get mutable reference to The dimension information of the cell [mm].
0138   edm4hep::Vector3f& getDimension();
0139 
0140   /// Set the Sector that this hit occurred in
0141   void setSector(const std::int32_t sector);
0142   /// Get mutable reference to Sector that this hit occurred in
0143   std::int32_t& getSector();
0144 
0145   /// Set the Layer that the hit occurred in
0146   void setLayer(const std::int32_t layer);
0147   /// Get mutable reference to Layer that the hit occurred in
0148   std::int32_t& getLayer();
0149 
0150   /// Set the The local coordinates of the hit in the detector segment [mm].
0151   void setLocal(const edm4hep::Vector3f& local);
0152   /// Get mutable reference to The local coordinates of the hit in the detector segment [mm].
0153   edm4hep::Vector3f& getLocal();
0154 
0155 
0156   /// Set the Related raw calorimeter hit
0157   void setRawHit(const edm4hep::RawCalorimeterHit& value);
0158 
0159 
0160 
0161 
0162   /// check whether the object is actually available
0163   bool isAvailable() const;
0164   /// disconnect from CalorimeterHitObj instance
0165   void unlink() { m_obj = podio::utils::MaybeSharedPtr<CalorimeterHitObj>{nullptr}; }
0166 
0167   constexpr bool operator==(const MutableCalorimeterHit& other) const { return m_obj == other.m_obj; }
0168   bool operator==(const CalorimeterHit& other) const;
0169 
0170   constexpr bool operator!=(const MutableCalorimeterHit& other) const { return !(*this == other); }
0171   bool operator!=(const CalorimeterHit& other) const { return !(*this == other); }
0172 
0173   // less comparison operator, so that objects can be e.g. stored in sets.
0174   bool operator<(const MutableCalorimeterHit& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
0175 
0176   podio::ObjectID id() const { return getObjectID(); }
0177 
0178   const podio::ObjectID getObjectID() const;
0179 
0180   friend std::hash<MutableCalorimeterHit>;
0181 
0182   friend void swap(MutableCalorimeterHit& a, MutableCalorimeterHit& b) {
0183     using std::swap;
0184     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0185   }
0186 
0187 private:
0188   /// constructor from existing CalorimeterHitObj
0189   explicit MutableCalorimeterHit(podio::utils::MaybeSharedPtr<CalorimeterHitObj> obj);
0190 
0191   podio::utils::MaybeSharedPtr<CalorimeterHitObj> m_obj{new CalorimeterHitObj{}, podio::utils::MarkOwned};
0192 };
0193 
0194 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0195 void to_json(nlohmann::json& j, const MutableCalorimeterHit& value);
0196 #endif
0197 
0198 
0199 } // namespace edm4eic
0200 
0201 
0202 
0203 template<>
0204 struct std::hash<edm4eic::MutableCalorimeterHit> {
0205   std::size_t operator()(const edm4eic::MutableCalorimeterHit& obj) const {
0206     return std::hash<edm4eic::CalorimeterHitObj*>{}(obj.m_obj.get());
0207   }
0208 };
0209 
0210 
0211 #endif