Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-06-03 08:33:27

0001 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
0002 
0003 #ifndef EDM4HEP_TrackerHit3D_H
0004 #define EDM4HEP_TrackerHit3D_H
0005 
0006 #include "edm4hep/TrackerHit3DObj.h"
0007 
0008 #include "edm4hep/CovMatrix3f.h"
0009 #include "edm4hep/Vector3d.h"
0010 #include <cstdint>
0011 #include <edm4hep/Constants.h>
0012 
0013 #include "podio/detail/OrderKey.h"
0014 #include "podio/utilities/MaybeSharedPtr.h"
0015 
0016 #include <cstdint>
0017 #include <ostream>
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 podio::detail {
0030 // Internal function used in less comparison operators of the datatypes and interface types
0031 OrderKey getOrderKey(const edm4hep::TrackerHit3D& obj);
0032 }; // namespace podio::detail
0033 
0034 namespace edm4hep {
0035 
0036 class MutableTrackerHit3D;
0037 class TrackerHit3DCollection;
0038 class TrackerHit3DCollectionData;
0039 
0040 /** @class TrackerHit3D
0041  *  Tracker hit
0042  *  @author: EDM4hep authors
0043  */
0044 class TrackerHit3D {
0045 
0046   friend class MutableTrackerHit3D;
0047   friend class TrackerHit3DCollection;
0048   friend class edm4hep::TrackerHit3DCollectionData;
0049   friend class TrackerHit3DCollectionIterator;
0050   friend podio::detail::OrderKey podio::detail::getOrderKey(const TrackerHit3D& obj);
0051 
0052 public:
0053   using mutable_type = MutableTrackerHit3D;
0054   using collection_type = TrackerHit3DCollection;
0055 
0056   /// default constructor
0057   TrackerHit3D();
0058 
0059   /// Constructor initializing all members
0060   TrackerHit3D(std::uint64_t cellID, std::int32_t type, std::int32_t quality, float time, float eDep, float eDepError,
0061                edm4hep::Vector3d position, edm4hep::CovMatrix3f covMatrix);
0062 
0063   /// copy constructor
0064   TrackerHit3D(const TrackerHit3D& other) = default;
0065 
0066   /// copy-assignment operator
0067   TrackerHit3D& operator=(TrackerHit3D other);
0068 
0069   /// create a mutable deep-copy of the object with identical relations
0070   /// if cloneRelations=false, the relations are not cloned and will be empty
0071   MutableTrackerHit3D clone(bool cloneRelations = true) const;
0072 
0073   /// destructor
0074   ~TrackerHit3D() = default;
0075 
0076   /// converting constructor from mutable object
0077   TrackerHit3D(const MutableTrackerHit3D& other);
0078 
0079   static TrackerHit3D makeEmpty();
0080 
0081 public:
0082   static constexpr auto typeName = "edm4hep::TrackerHit3D";
0083 
0084   /// Access the ID of the sensor that created this hit
0085   std::uint64_t getCellID() const;
0086 
0087   /// Access the type of raw data hit
0088   std::int32_t getType() const;
0089 
0090   /// Access the quality bit flag of the hit
0091   std::int32_t getQuality() const;
0092 
0093   /// Access the time of the hit [ns]
0094   float getTime() const;
0095 
0096   /// Access the energy deposited on the hit [GeV]
0097   float getEDep() const;
0098 
0099   /// Access the error measured on EDep [GeV]
0100   float getEDepError() const;
0101 
0102   /// Access the hit position [mm]
0103   const edm4hep::Vector3d& getPosition() const;
0104 
0105   /// Access the covariance matrix of the position (x,y,z)
0106   const edm4hep::CovMatrix3f& getCovMatrix() const;
0107 
0108   /// Get the position covariance matrix value for the two passed dimensions
0109   float getCovMatrix(edm4hep::Cartesian dimI, edm4hep::Cartesian dimJ) const {
0110     return getCovMatrix().getValue(dimI, dimJ);
0111   }
0112 
0113   /// check whether the object is actually available
0114   bool isAvailable() const;
0115   /// disconnect from TrackerHit3DObj instance
0116   void unlink() {
0117     m_obj = podio::utils::MaybeSharedPtr<TrackerHit3DObj>{nullptr};
0118   }
0119 
0120   bool operator==(const TrackerHit3D& other) const {
0121     return m_obj == other.m_obj;
0122   }
0123   bool operator==(const MutableTrackerHit3D& other) const;
0124 
0125   bool operator!=(const TrackerHit3D& other) const {
0126     return !(*this == other);
0127   }
0128   bool operator!=(const MutableTrackerHit3D& other) const {
0129     return !(*this == other);
0130   }
0131 
0132   // less comparison operator, so that objects can be e.g. stored in sets.
0133   bool operator<(const TrackerHit3D& other) const {
0134     return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other);
0135   }
0136 
0137   podio::ObjectID id() const {
0138     return getObjectID();
0139   }
0140 
0141   const podio::ObjectID getObjectID() const;
0142 
0143   friend void swap(TrackerHit3D& a, TrackerHit3D& b) {
0144     using std::swap;
0145     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0146   }
0147 
0148 private:
0149   /// constructor from existing TrackerHit3DObj
0150   explicit TrackerHit3D(podio::utils::MaybeSharedPtr<TrackerHit3DObj> obj);
0151   TrackerHit3D(TrackerHit3DObj* obj);
0152 
0153   podio::utils::MaybeSharedPtr<TrackerHit3DObj> m_obj{nullptr};
0154 };
0155 
0156 std::ostream& operator<<(std::ostream& o, const TrackerHit3D& value);
0157 
0158 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0159 void to_json(nlohmann::json& j, const TrackerHit3D& value);
0160 #endif
0161 
0162 } // namespace edm4hep
0163 
0164 #endif