Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-13 08:54:37

0001 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
0002 
0003 #ifndef EDM4EIC_MutableTrackerHit_H
0004 #define EDM4EIC_MutableTrackerHit_H
0005 
0006 #include "edm4eic/TrackerHitObj.h"
0007 // Make the immutable class available from its mutable version but not vice versa
0008 #include "edm4eic/TrackerHit.h"
0009 
0010 #include "edm4eic/CovDiag3f.h"
0011 #include "edm4hep/Vector3f.h"
0012 #include <cstdint>
0013 
0014 #include "podio/utilities/MaybeSharedPtr.h"
0015 
0016 #include <cstdint>
0017 
0018 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0019 #include "nlohmann/json_fwd.hpp"
0020 #endif
0021 
0022 // forward declarations
0023 namespace edm4eic {
0024 class TrackerHitCollection;
0025 class RawTrackerHit;
0026 class MutableRawTrackerHit;
0027 }
0028 
0029 
0030 namespace edm4eic {
0031 
0032 
0033 /** @class MutableTrackerHit
0034  *  Tracker hit (reconstructed from Raw)
0035  *  @author: W. Armstrong, S. Joosten
0036  */
0037 class MutableTrackerHit {
0038 
0039   friend class TrackerHitCollection;
0040   friend class TrackerHitMutableCollectionIterator;
0041   friend class TrackerHit;
0042 
0043 public:
0044   using object_type = TrackerHit;
0045   using collection_type = TrackerHitCollection;
0046 
0047   /// default constructor
0048   MutableTrackerHit();
0049 
0050   /// Constructor initializing all members
0051   MutableTrackerHit(const std::uint64_t cellID, const edm4hep::Vector3f& position, const edm4eic::CovDiag3f& positionError, const float time, const float timeError, const float edep, const float edepError);
0052 
0053   /// copy constructor
0054   MutableTrackerHit(const MutableTrackerHit& other) = default;
0055 
0056   /// copy-assignment operator
0057   MutableTrackerHit& operator=(MutableTrackerHit other) &; // Rebind this to other's internal object
0058   MutableTrackerHit& operator=(MutableTrackerHit other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
0059 
0060   /// create a mutable deep-copy of the object with identical relations
0061   /// if cloneRelations=false, the relations are not cloned and will be empty
0062   MutableTrackerHit clone(bool cloneRelations=true) const;
0063 
0064   /// destructor
0065   ~MutableTrackerHit() = default;
0066 
0067 
0068 public:
0069 
0070   /// Access the The detector specific (geometrical) cell id.
0071   std::uint64_t getCellID() const;
0072 
0073   /// Access the Hit (cell) position [mm]
0074   const edm4hep::Vector3f& getPosition() const;
0075 
0076   /// Access the Covariance Matrix
0077   const edm4eic::CovDiag3f& getPositionError() const;
0078 
0079   /// Access the Hit time [ns]
0080   float getTime() const;
0081 
0082   /// Access the Error on the time
0083   float getTimeError() const;
0084 
0085   /// Access the Energy deposit in this hit [GeV]
0086   float getEdep() const;
0087 
0088   /// Access the Error on the energy deposit [GeV]
0089   float getEdepError() const;
0090 
0091 
0092   /// Access the Related raw tracker hit
0093   const edm4eic::RawTrackerHit getRawHit() const;
0094 
0095   /// Set the The detector specific (geometrical) cell id.
0096   void setCellID(const std::uint64_t cellID);
0097   /// Get mutable reference to The detector specific (geometrical) cell id.
0098   std::uint64_t& getCellID();
0099   /// Get reference to The detector specific (geometrical) cell id.
0100   [[deprecated("use getCellID instead")]]
0101   std::uint64_t& cellID();
0102 
0103   /// Set the Hit (cell) position [mm]
0104   void setPosition(const edm4hep::Vector3f& position);
0105   /// Get mutable reference to Hit (cell) position [mm]
0106   edm4hep::Vector3f& getPosition();
0107   /// Get reference to Hit (cell) position [mm]
0108   [[deprecated("use getPosition instead")]]
0109   edm4hep::Vector3f& position();
0110 
0111   /// Set the Covariance Matrix
0112   void setPositionError(const edm4eic::CovDiag3f& positionError);
0113   /// Get mutable reference to Covariance Matrix
0114   edm4eic::CovDiag3f& getPositionError();
0115   /// Get reference to Covariance Matrix
0116   [[deprecated("use getPositionError instead")]]
0117   edm4eic::CovDiag3f& positionError();
0118 
0119   /// Set the Hit time [ns]
0120   void setTime(const float time);
0121   /// Get mutable reference to Hit time [ns]
0122   float& getTime();
0123   /// Get reference to Hit time [ns]
0124   [[deprecated("use getTime instead")]]
0125   float& time();
0126 
0127   /// Set the Error on the time
0128   void setTimeError(const float timeError);
0129   /// Get mutable reference to Error on the time
0130   float& getTimeError();
0131   /// Get reference to Error on the time
0132   [[deprecated("use getTimeError instead")]]
0133   float& timeError();
0134 
0135   /// Set the Energy deposit in this hit [GeV]
0136   void setEdep(const float edep);
0137   /// Get mutable reference to Energy deposit in this hit [GeV]
0138   float& getEdep();
0139   /// Get reference to Energy deposit in this hit [GeV]
0140   [[deprecated("use getEdep instead")]]
0141   float& edep();
0142 
0143   /// Set the Error on the energy deposit [GeV]
0144   void setEdepError(const float edepError);
0145   /// Get mutable reference to Error on the energy deposit [GeV]
0146   float& getEdepError();
0147   /// Get reference to Error on the energy deposit [GeV]
0148   [[deprecated("use getEdepError instead")]]
0149   float& edepError();
0150 
0151 
0152   /// Set the Related raw tracker hit
0153   void setRawHit(const edm4eic::RawTrackerHit& value);
0154 
0155 
0156 
0157 
0158   /// check whether the object is actually available
0159   bool isAvailable() const;
0160   /// disconnect from TrackerHitObj instance
0161   void unlink() { m_obj = podio::utils::MaybeSharedPtr<TrackerHitObj>{nullptr}; }
0162 
0163   bool operator==(const MutableTrackerHit& other) const { return m_obj == other.m_obj; }
0164   bool operator==(const TrackerHit& other) const;
0165 
0166   bool operator!=(const MutableTrackerHit& other) const { return !(*this == other); }
0167   bool operator!=(const TrackerHit& other) const { return !(*this == other); }
0168 
0169   // less comparison operator, so that objects can be e.g. stored in sets.
0170   bool operator<(const MutableTrackerHit& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
0171 
0172   podio::ObjectID id() const { return getObjectID(); }
0173 
0174   const podio::ObjectID getObjectID() const;
0175 
0176   friend std::hash<MutableTrackerHit>;
0177 
0178   friend void swap(MutableTrackerHit& a, MutableTrackerHit& b) {
0179     using std::swap;
0180     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0181   }
0182 
0183 private:
0184   /// constructor from existing TrackerHitObj
0185   explicit MutableTrackerHit(podio::utils::MaybeSharedPtr<TrackerHitObj> obj);
0186 
0187   podio::utils::MaybeSharedPtr<TrackerHitObj> m_obj{nullptr};
0188 };
0189 
0190 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0191 void to_json(nlohmann::json& j, const MutableTrackerHit& value);
0192 #endif
0193 
0194 
0195 } // namespace edm4eic
0196 
0197 
0198 
0199 template<>
0200 struct std::hash<edm4eic::MutableTrackerHit> {
0201   std::size_t operator()(const edm4eic::MutableTrackerHit& obj) const {
0202     return std::hash<edm4eic::TrackerHitObj*>{}(obj.m_obj.get());
0203   }
0204 };
0205 
0206 
0207 #endif