Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 10:13:00

0001 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
0002 
0003 #ifndef EDM4HEP_MutableTrackerHit3D_H
0004 #define EDM4HEP_MutableTrackerHit3D_H
0005 
0006 #include "edm4hep/TrackerHit3DObj.h"
0007 // Make the immutable class available from its mutable version but not vice versa
0008 #include "edm4hep/TrackerHit3D.h"
0009 
0010 #include "edm4hep/CovMatrix3f.h"
0011 #include "edm4hep/Vector3d.h"
0012 #include <cstdint>
0013 #include <edm4hep/Constants.h>
0014 
0015 #include "podio/utilities/MaybeSharedPtr.h"
0016 
0017 #include <cstdint>
0018 
0019 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0020 #include "nlohmann/json_fwd.hpp"
0021 #endif
0022 
0023 // forward declarations
0024 namespace edm4hep {
0025 class TrackerHit3DCollection;
0026 class TrackerHit;
0027 } // namespace edm4hep
0028 
0029 namespace edm4hep {
0030 
0031 /** @class MutableTrackerHit3D
0032  *  Tracker hit
0033  *  @author: EDM4hep authors
0034  */
0035 class MutableTrackerHit3D {
0036 
0037   friend class TrackerHit3DCollection;
0038   friend class TrackerHit3DMutableCollectionIterator;
0039   friend class TrackerHit3D;
0040 
0041 public:
0042   using object_type = TrackerHit3D;
0043   using collection_type = TrackerHit3DCollection;
0044 
0045   /// default constructor
0046   MutableTrackerHit3D() = default;
0047 
0048   /// Constructor initializing all members
0049   MutableTrackerHit3D(const std::uint64_t cellID, const std::int32_t type, const std::int32_t quality, const float time,
0050                       const float eDep, const float eDepError, const edm4hep::Vector3d& position,
0051                       const edm4hep::CovMatrix3f& covMatrix);
0052 
0053   /// copy constructor
0054   MutableTrackerHit3D(const MutableTrackerHit3D& other) = default;
0055 
0056   /// copy-assignment operator
0057   MutableTrackerHit3D& operator=(MutableTrackerHit3D other) &; // Rebind this to other's internal object
0058   MutableTrackerHit3D&
0059   operator=(MutableTrackerHit3D 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   MutableTrackerHit3D clone(bool cloneRelations = true) const;
0064 
0065   /// destructor
0066   ~MutableTrackerHit3D() = default;
0067 
0068 public:
0069   /// Access the ID of the sensor that created this hit
0070   std::uint64_t getCellID() const;
0071 
0072   /// Access the type of raw data hit
0073   std::int32_t getType() const;
0074 
0075   /// Access the quality bit flag of the hit
0076   std::int32_t getQuality() const;
0077 
0078   /// Access the time of the hit [ns]
0079   float getTime() const;
0080 
0081   /// Access the energy deposited on the hit [GeV]
0082   float getEDep() const;
0083 
0084   /// Access the error measured on eDep [GeV]
0085   float getEDepError() const;
0086 
0087   /// Access the hit position [mm]
0088   const edm4hep::Vector3d& getPosition() const;
0089 
0090   /// Access the covariance matrix of the position (x,y,z) [mm^2]
0091   const edm4hep::CovMatrix3f& getCovMatrix() const;
0092 
0093   /// Set the ID of the sensor that created this hit
0094   void setCellID(const std::uint64_t cellID);
0095   /// Get mutable reference to ID of the sensor that created this hit
0096   std::uint64_t& getCellID();
0097   /// Get reference to ID of the sensor that created this hit
0098   [[deprecated("use getCellID instead")]] std::uint64_t& cellID();
0099 
0100   /// Set the type of raw data hit
0101   void setType(const std::int32_t type);
0102   /// Get mutable reference to type of raw data hit
0103   std::int32_t& getType();
0104   /// Get reference to type of raw data hit
0105   [[deprecated("use getType instead")]] std::int32_t& type();
0106 
0107   /// Set the quality bit flag of the hit
0108   void setQuality(const std::int32_t quality);
0109   /// Get mutable reference to quality bit flag of the hit
0110   std::int32_t& getQuality();
0111   /// Get reference to quality bit flag of the hit
0112   [[deprecated("use getQuality instead")]] std::int32_t& quality();
0113 
0114   /// Set the time of the hit [ns]
0115   void setTime(const float time);
0116   /// Get mutable reference to time of the hit [ns]
0117   float& getTime();
0118   /// Get reference to time of the hit [ns]
0119   [[deprecated("use getTime instead")]] float& time();
0120 
0121   /// Set the energy deposited on the hit [GeV]
0122   void setEDep(const float eDep);
0123   /// Get mutable reference to energy deposited on the hit [GeV]
0124   float& getEDep();
0125   /// Get reference to energy deposited on the hit [GeV]
0126   [[deprecated("use getEDep instead")]] float& eDep();
0127 
0128   /// Set the error measured on eDep [GeV]
0129   void setEDepError(const float eDepError);
0130   /// Get mutable reference to error measured on eDep [GeV]
0131   float& getEDepError();
0132   /// Get reference to error measured on eDep [GeV]
0133   [[deprecated("use getEDepError instead")]] float& eDepError();
0134 
0135   /// Set the hit position [mm]
0136   void setPosition(const edm4hep::Vector3d& position);
0137   /// Get mutable reference to hit position [mm]
0138   edm4hep::Vector3d& getPosition();
0139   /// Get reference to hit position [mm]
0140   [[deprecated("use getPosition instead")]] edm4hep::Vector3d& position();
0141 
0142   /// Set the covariance matrix of the position (x,y,z) [mm^2]
0143   void setCovMatrix(const edm4hep::CovMatrix3f& covMatrix);
0144   /// Get mutable reference to covariance matrix of the position (x,y,z) [mm^2]
0145   edm4hep::CovMatrix3f& getCovMatrix();
0146   /// Get reference to covariance matrix of the position (x,y,z) [mm^2]
0147   [[deprecated("use getCovMatrix instead")]] edm4hep::CovMatrix3f& covMatrix();
0148 
0149   /// Get the position covariance matrix value for the two passed dimensions
0150   float getCovMatrix(edm4hep::Cartesian dimI, edm4hep::Cartesian dimJ) const {
0151     return getCovMatrix().getValue(dimI, dimJ);
0152   }
0153 
0154   /// Set the position covariance matrix value for the two passed dimensions
0155   void setCovMatrix(float value, edm4hep::Cartesian dimI, edm4hep::Cartesian dimJ) {
0156     getCovMatrix().setValue(value, dimI, dimJ);
0157   }
0158 
0159   /// check whether the object is actually available
0160   bool isAvailable() const;
0161   /// disconnect from TrackerHit3DObj instance
0162   void unlink() { m_obj = podio::utils::MaybeSharedPtr<TrackerHit3DObj>{nullptr}; }
0163 
0164   bool operator==(const MutableTrackerHit3D& other) const { return m_obj == other.m_obj; }
0165   bool operator==(const TrackerHit3D& other) const;
0166 
0167   bool operator!=(const MutableTrackerHit3D& other) const { return !(*this == other); }
0168   bool operator!=(const TrackerHit3D& other) const { return !(*this == other); }
0169 
0170   // less comparison operator, so that objects can be e.g. stored in sets.
0171   bool operator<(const MutableTrackerHit3D& other) const {
0172     return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other);
0173   }
0174 
0175   podio::ObjectID id() const { return getObjectID(); }
0176 
0177   const podio::ObjectID getObjectID() const;
0178 
0179   friend std::hash<MutableTrackerHit3D>;
0180 
0181   friend void swap(MutableTrackerHit3D& a, MutableTrackerHit3D& b) {
0182     using std::swap;
0183     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0184   }
0185 
0186 private:
0187   /// constructor from existing TrackerHit3DObj
0188   explicit MutableTrackerHit3D(podio::utils::MaybeSharedPtr<TrackerHit3DObj> obj);
0189 
0190   podio::utils::MaybeSharedPtr<TrackerHit3DObj> m_obj{new TrackerHit3DObj{}, podio::utils::MarkOwned};
0191 };
0192 
0193 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0194 void to_json(nlohmann::json& j, const MutableTrackerHit3D& value);
0195 #endif
0196 
0197 } // namespace edm4hep
0198 
0199 template <>
0200 struct std::hash<edm4hep::MutableTrackerHit3D> {
0201   std::size_t operator()(const edm4hep::MutableTrackerHit3D& obj) const {
0202     return std::hash<edm4hep::TrackerHit3DObj*>{}(obj.m_obj.get());
0203   }
0204 };
0205 
0206 #endif