Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-20 10:08:49

0001 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
0002 
0003 #ifndef EDM4HEP_TrackerHitPlane_H
0004 #define EDM4HEP_TrackerHitPlane_H
0005 
0006 #include "edm4hep/TrackerHitPlaneObj.h"
0007 
0008 #include "edm4hep/CovMatrix3f.h"
0009 #include "edm4hep/Vector2f.h"
0010 #include "edm4hep/Vector3d.h"
0011 #include <cstdint>
0012 #include <edm4hep/Constants.h>
0013 
0014 #include "podio/detail/OrderKey.h"
0015 #include "podio/utilities/MaybeSharedPtr.h"
0016 
0017 #include <cstdint>
0018 #include <ostream>
0019 
0020 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0021 #include "nlohmann/json_fwd.hpp"
0022 #endif
0023 
0024 // forward declarations
0025 namespace edm4hep {
0026 class TrackerHitPlaneCollection;
0027 class TrackerHit;
0028 } // namespace edm4hep
0029 
0030 namespace podio::detail {
0031 // Internal function used in less comparison operators of the datatypes and interface types
0032 OrderKey getOrderKey(const edm4hep::TrackerHitPlane& obj);
0033 }; // namespace podio::detail
0034 
0035 namespace edm4hep {
0036 
0037 class MutableTrackerHitPlane;
0038 class TrackerHitPlaneCollection;
0039 class TrackerHitPlaneCollectionData;
0040 
0041 /** @class TrackerHitPlane
0042  *  Tracker hit plane
0043  *  @author: EDM4hep authors
0044  */
0045 class TrackerHitPlane {
0046 
0047   friend class MutableTrackerHitPlane;
0048   friend class TrackerHitPlaneCollection;
0049   friend class edm4hep::TrackerHitPlaneCollectionData;
0050   friend class TrackerHitPlaneCollectionIterator;
0051   friend podio::detail::OrderKey podio::detail::getOrderKey(const TrackerHitPlane& obj);
0052 
0053 public:
0054   using mutable_type = MutableTrackerHitPlane;
0055   using collection_type = TrackerHitPlaneCollection;
0056 
0057   /// default constructor
0058   TrackerHitPlane() = default;
0059 
0060   /// Constructor initializing all members
0061   TrackerHitPlane(const std::uint64_t cellID, const std::int32_t type, const std::int32_t quality, const float time,
0062                   const float eDep, const float eDepError, const edm4hep::Vector2f& u, const edm4hep::Vector2f& v,
0063                   const float du, const float dv, const edm4hep::Vector3d& position,
0064                   const edm4hep::CovMatrix3f& covMatrix);
0065 
0066   /// copy constructor
0067   TrackerHitPlane(const TrackerHitPlane& other) = default;
0068 
0069   /// copy-assignment operator
0070   TrackerHitPlane& operator=(TrackerHitPlane other) &; // Rebind this to other's internal object
0071   TrackerHitPlane&
0072   operator=(TrackerHitPlane other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
0073 
0074   /// create a mutable deep-copy of the object with identical relations
0075   /// if cloneRelations=false, the relations are not cloned and will be empty
0076   MutableTrackerHitPlane clone(bool cloneRelations = true) const;
0077 
0078   /// destructor
0079   ~TrackerHitPlane() = default;
0080 
0081   /// converting constructor from mutable object
0082   TrackerHitPlane(const MutableTrackerHitPlane& other);
0083 
0084   static TrackerHitPlane makeEmpty();
0085 
0086 public:
0087   static constexpr std::string_view typeName = "edm4hep::TrackerHitPlane";
0088 
0089   /// Access the ID of the sensor that created this hit
0090   std::uint64_t getCellID() const;
0091 
0092   /// Access the type of raw data hit
0093   std::int32_t getType() const;
0094 
0095   /// Access the quality bit flag of the hit
0096   std::int32_t getQuality() const;
0097 
0098   /// Access the time of the hit [ns]
0099   float getTime() const;
0100 
0101   /// Access the energy deposited on the hit [GeV]
0102   float getEDep() const;
0103 
0104   /// Access the error measured on eDep [GeV]
0105   float getEDepError() const;
0106 
0107   /// Access the direction of the first measurement given as (theta, phi) in spherical coordinates [rad]
0108   const edm4hep::Vector2f& getU() const;
0109 
0110   /// Access the direction of the second measurement given as (theta, phi) in spherical coordinates [rad]
0111   const edm4hep::Vector2f& getV() const;
0112 
0113   /// Access the measurement error along the direction [mm]
0114   float getDu() const;
0115 
0116   /// Access the measurement error along the direction [mm]
0117   float getDv() const;
0118 
0119   /// Access the hit position [mm]
0120   const edm4hep::Vector3d& getPosition() const;
0121 
0122   /// Access the covariance of the position (x,y,z) [mm^2]
0123   const edm4hep::CovMatrix3f& getCovMatrix() const;
0124 
0125   /// Get the position covariance matrix value for the two passed dimensions
0126   float getCovMatrix(edm4hep::Cartesian dimI, edm4hep::Cartesian dimJ) const {
0127     return getCovMatrix().getValue(dimI, dimJ);
0128   }
0129 
0130   /// check whether the object is actually available
0131   bool isAvailable() const;
0132   /// disconnect from TrackerHitPlaneObj instance
0133   void unlink() { m_obj = podio::utils::MaybeSharedPtr<TrackerHitPlaneObj>{nullptr}; }
0134 
0135   bool operator==(const TrackerHitPlane& other) const { return m_obj == other.m_obj; }
0136   bool operator==(const MutableTrackerHitPlane& other) const;
0137 
0138   bool operator!=(const TrackerHitPlane& other) const { return !(*this == other); }
0139   bool operator!=(const MutableTrackerHitPlane& other) const { return !(*this == other); }
0140 
0141   // less comparison operator, so that objects can be e.g. stored in sets.
0142   bool operator<(const TrackerHitPlane& other) const {
0143     return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other);
0144   }
0145 
0146   podio::ObjectID id() const { return getObjectID(); }
0147 
0148   const podio::ObjectID getObjectID() const;
0149 
0150   friend std::hash<TrackerHitPlane>;
0151 
0152   friend void swap(TrackerHitPlane& a, TrackerHitPlane& b) {
0153     using std::swap;
0154     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0155   }
0156 
0157 private:
0158   /// constructor from existing TrackerHitPlaneObj
0159   explicit TrackerHitPlane(podio::utils::MaybeSharedPtr<TrackerHitPlaneObj> obj);
0160   TrackerHitPlane(TrackerHitPlaneObj* obj);
0161 
0162   podio::utils::MaybeSharedPtr<TrackerHitPlaneObj> m_obj{new TrackerHitPlaneObj{}, podio::utils::MarkOwned};
0163 };
0164 
0165 std::ostream& operator<<(std::ostream& o, const TrackerHitPlane& value);
0166 
0167 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0168 void to_json(nlohmann::json& j, const TrackerHitPlane& value);
0169 #endif
0170 
0171 } // namespace edm4hep
0172 
0173 template <>
0174 struct std::hash<edm4hep::TrackerHitPlane> {
0175   std::size_t operator()(const edm4hep::TrackerHitPlane& obj) const {
0176     return std::hash<edm4hep::TrackerHitPlaneObj*>{}(obj.m_obj.get());
0177   }
0178 };
0179 
0180 // This is needed to avoid triggering opening every library in LD_LIBRARY_PATH
0181 // until it's fixed in ROOT. See https://github.com/root-project/root/issues/18489
0182 // and https://github.com/AIDASoft/podio/issues/770
0183 #if defined(__clang__)
0184 #pragma clang diagnostic push
0185 #pragma clang diagnostic ignored "-Wunknown-warning-option"
0186 #pragma clang diagnostic ignored "-Wdeprecated-redundant-constexpr-static-def"
0187 #pragma clang diagnostic ignored "-Wdeprecated"
0188 constexpr std::string_view edm4hep::TrackerHitPlane::typeName;
0189 #pragma clang diagnostic pop
0190 #elif defined(__GNUC__)
0191 #pragma GCC diagnostic push
0192 #pragma GCC diagnostic ignored "-Wdeprecated"
0193 constexpr std::string_view edm4hep::TrackerHitPlane::typeName;
0194 #pragma GCC diagnostic pop
0195 #endif
0196 
0197 #endif