Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-15 08:55:50

0001 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
0002 
0003 #ifndef EDM4EIC_MutablePMTHit_H
0004 #define EDM4EIC_MutablePMTHit_H
0005 
0006 #include "edm4eic/PMTHitObj.h"
0007 // Make the immutable class available from its mutable version but not vice versa
0008 #include "edm4eic/PMTHit.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 PMTHitCollection;
0024 }
0025 
0026 
0027 namespace edm4eic {
0028 
0029 
0030 /** @class MutablePMTHit
0031  *  EIC PMT hit
0032  *  @author: S. Joosten, C. Peng
0033  */
0034 class MutablePMTHit {
0035 
0036   friend class PMTHitCollection;
0037   friend class PMTHitMutableCollectionIterator;
0038   friend class PMTHit;
0039 
0040 public:
0041   using object_type = PMTHit;
0042   using collection_type = PMTHitCollection;
0043 
0044   /// default constructor
0045   MutablePMTHit();
0046 
0047   /// Constructor initializing all members
0048   MutablePMTHit(const std::uint64_t cellID, const float npe, const float time, const float timeError, const edm4hep::Vector3f& position, const edm4hep::Vector3f& dimension, const std::int32_t sector, const edm4hep::Vector3f& local);
0049 
0050   /// copy constructor
0051   MutablePMTHit(const MutablePMTHit& other) = default;
0052 
0053   /// copy-assignment operator
0054   MutablePMTHit& operator=(MutablePMTHit other) &; // Rebind this to other's internal object
0055   MutablePMTHit& operator=(MutablePMTHit other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
0056 
0057   /// create a mutable deep-copy of the object with identical relations
0058   /// if cloneRelations=false, the relations are not cloned and will be empty
0059   MutablePMTHit clone(bool cloneRelations=true) const;
0060 
0061   /// destructor
0062   ~MutablePMTHit() = default;
0063 
0064 
0065 public:
0066 
0067   /// Access the The detector specific (geometrical) cell id.
0068   std::uint64_t getCellID() const;
0069 
0070   /// Access the Estimated number of photo-electrons [#]
0071   float getNpe() const;
0072 
0073   /// Access the Time [ns]
0074   float getTime() const;
0075 
0076   /// Access the Error on the time [ns]
0077   float getTimeError() const;
0078 
0079   /// Access the PMT hit position [mm]
0080   const edm4hep::Vector3f& getPosition() const;
0081 
0082   /// Access the The dimension information of the pixel [mm].
0083   const edm4hep::Vector3f& getDimension() const;
0084 
0085   /// Access the The sector this hit occurred in
0086   std::int32_t getSector() const;
0087 
0088   /// Access the The local position of the hit in detector coordinates (relative to the sector) [mm]
0089   const edm4hep::Vector3f& getLocal() const;
0090 
0091 
0092 
0093   /// Set the The detector specific (geometrical) cell id.
0094   void setCellID(const std::uint64_t cellID);
0095   /// Get mutable reference to The detector specific (geometrical) cell id.
0096   std::uint64_t& getCellID();
0097   /// Get reference to The detector specific (geometrical) cell id.
0098   [[deprecated("use getCellID instead")]]
0099   std::uint64_t& cellID();
0100 
0101   /// Set the Estimated number of photo-electrons [#]
0102   void setNpe(const float npe);
0103   /// Get mutable reference to Estimated number of photo-electrons [#]
0104   float& getNpe();
0105   /// Get reference to Estimated number of photo-electrons [#]
0106   [[deprecated("use getNpe instead")]]
0107   float& npe();
0108 
0109   /// Set the Time [ns]
0110   void setTime(const float time);
0111   /// Get mutable reference to Time [ns]
0112   float& getTime();
0113   /// Get reference to Time [ns]
0114   [[deprecated("use getTime instead")]]
0115   float& time();
0116 
0117   /// Set the Error on the time [ns]
0118   void setTimeError(const float timeError);
0119   /// Get mutable reference to Error on the time [ns]
0120   float& getTimeError();
0121   /// Get reference to Error on the time [ns]
0122   [[deprecated("use getTimeError instead")]]
0123   float& timeError();
0124 
0125   /// Set the PMT hit position [mm]
0126   void setPosition(const edm4hep::Vector3f& position);
0127   /// Get mutable reference to PMT hit position [mm]
0128   edm4hep::Vector3f& getPosition();
0129   /// Get reference to PMT hit position [mm]
0130   [[deprecated("use getPosition instead")]]
0131   edm4hep::Vector3f& position();
0132 
0133   /// Set the The dimension information of the pixel [mm].
0134   void setDimension(const edm4hep::Vector3f& dimension);
0135   /// Get mutable reference to The dimension information of the pixel [mm].
0136   edm4hep::Vector3f& getDimension();
0137   /// Get reference to The dimension information of the pixel [mm].
0138   [[deprecated("use getDimension instead")]]
0139   edm4hep::Vector3f& dimension();
0140 
0141   /// Set the The sector this hit occurred in
0142   void setSector(const std::int32_t sector);
0143   /// Get mutable reference to The sector this hit occurred in
0144   std::int32_t& getSector();
0145   /// Get reference to The sector this hit occurred in
0146   [[deprecated("use getSector instead")]]
0147   std::int32_t& sector();
0148 
0149   /// Set the The local position of the hit in detector coordinates (relative to the sector) [mm]
0150   void setLocal(const edm4hep::Vector3f& local);
0151   /// Get mutable reference to The local position of the hit in detector coordinates (relative to the sector) [mm]
0152   edm4hep::Vector3f& getLocal();
0153   /// Get reference to The local position of the hit in detector coordinates (relative to the sector) [mm]
0154   [[deprecated("use getLocal instead")]]
0155   edm4hep::Vector3f& local();
0156 
0157 
0158 
0159 
0160 
0161 
0162   /// check whether the object is actually available
0163   bool isAvailable() const;
0164   /// disconnect from PMTHitObj instance
0165   void unlink() { m_obj = podio::utils::MaybeSharedPtr<PMTHitObj>{nullptr}; }
0166 
0167   bool operator==(const MutablePMTHit& other) const { return m_obj == other.m_obj; }
0168   bool operator==(const PMTHit& other) const;
0169 
0170   bool operator!=(const MutablePMTHit& other) const { return !(*this == other); }
0171   bool operator!=(const PMTHit& other) const { return !(*this == other); }
0172 
0173   // less comparison operator, so that objects can be e.g. stored in sets.
0174   bool operator<(const MutablePMTHit& 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<MutablePMTHit>;
0181 
0182   friend void swap(MutablePMTHit& a, MutablePMTHit& 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 PMTHitObj
0189   explicit MutablePMTHit(podio::utils::MaybeSharedPtr<PMTHitObj> obj);
0190 
0191   podio::utils::MaybeSharedPtr<PMTHitObj> m_obj{nullptr};
0192 };
0193 
0194 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0195 void to_json(nlohmann::json& j, const MutablePMTHit& value);
0196 #endif
0197 
0198 
0199 } // namespace edm4eic
0200 
0201 
0202 
0203 template<>
0204 struct std::hash<edm4eic::MutablePMTHit> {
0205   std::size_t operator()(const edm4eic::MutablePMTHit& obj) const {
0206     return std::hash<edm4eic::PMTHitObj*>{}(obj.m_obj.get());
0207   }
0208 };
0209 
0210 
0211 #endif