Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-10-31 08:59:56

0001 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
0002 
0003 #ifndef EDM4EIC_TrackerHit_H
0004 #define EDM4EIC_TrackerHit_H
0005 
0006 #include "edm4eic/TrackerHitObj.h"
0007 
0008 #include "edm4eic/CovDiag3f.h"
0009 #include "edm4hep/Vector3f.h"
0010 #include <cstdint>
0011 
0012 #include "podio/utilities/MaybeSharedPtr.h"
0013 #include "podio/detail/OrderKey.h"
0014 
0015 #include <ostream>
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 podio::detail {
0031 // Internal function used in less comparison operators of the datatypes and interface types
0032 OrderKey getOrderKey(const edm4eic::TrackerHit& obj);
0033 };
0034 
0035 namespace edm4eic {
0036 
0037 class MutableTrackerHit;
0038 class TrackerHitCollection;
0039 class TrackerHitCollectionData;
0040 
0041 /** @class TrackerHit
0042  *  Tracker hit (reconstructed from Raw)
0043  *  @author: W. Armstrong, S. Joosten
0044  */
0045 class TrackerHit {
0046 
0047   friend class MutableTrackerHit;
0048   friend class TrackerHitCollection;
0049   friend class edm4eic::TrackerHitCollectionData;
0050   friend class TrackerHitCollectionIterator;
0051   friend podio::detail::OrderKey podio::detail::getOrderKey(const TrackerHit & obj);
0052 
0053 public:
0054   using mutable_type = MutableTrackerHit;
0055   using collection_type = TrackerHitCollection;
0056 
0057   /// default constructor
0058   TrackerHit();
0059 
0060   /// Constructor initializing all members
0061   TrackerHit(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);
0062 
0063   /// copy constructor
0064   TrackerHit(const TrackerHit& other) = default;
0065 
0066   /// copy-assignment operator
0067   TrackerHit& operator=(TrackerHit other) &; // Rebind this to other's internal object
0068   TrackerHit& operator=(TrackerHit other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
0069 
0070   /// create a mutable deep-copy of the object with identical relations
0071   /// if cloneRelations=false, the relations are not cloned and will be empty
0072   MutableTrackerHit clone(bool cloneRelations=true) const;
0073 
0074   /// destructor
0075   ~TrackerHit() = default;
0076 
0077   /// converting constructor from mutable object
0078   TrackerHit(const MutableTrackerHit& other);
0079 
0080   static TrackerHit makeEmpty();
0081 
0082 public:
0083 
0084   static constexpr std::string_view typeName = "edm4eic::TrackerHit";
0085 
0086   /// Access the The detector specific (geometrical) cell id.
0087   std::uint64_t getCellID() const;
0088 
0089   /// Access the Hit (cell) position [mm]
0090   const edm4hep::Vector3f& getPosition() const;
0091 
0092   /// Access the Covariance Matrix
0093   const edm4eic::CovDiag3f& getPositionError() const;
0094 
0095   /// Access the Hit time [ns]
0096   float getTime() const;
0097 
0098   /// Access the Error on the time
0099   float getTimeError() const;
0100 
0101   /// Access the Energy deposit in this hit [GeV]
0102   float getEdep() const;
0103 
0104   /// Access the Error on the energy deposit [GeV]
0105   float getEdepError() const;
0106 
0107 
0108   /// Access the Related raw tracker hit
0109   const edm4eic::RawTrackerHit getRawHit() const;
0110 
0111 
0112 
0113   /// check whether the object is actually available
0114   bool isAvailable() const;
0115   /// disconnect from TrackerHitObj instance
0116   void unlink() { m_obj = podio::utils::MaybeSharedPtr<TrackerHitObj>{nullptr}; }
0117 
0118   bool operator==(const TrackerHit& other) const { return m_obj == other.m_obj; }
0119   bool operator==(const MutableTrackerHit& other) const;
0120 
0121   bool operator!=(const TrackerHit& other) const { return !(*this == other); }
0122   bool operator!=(const MutableTrackerHit& other) const { return !(*this == other); }
0123 
0124   // less comparison operator, so that objects can be e.g. stored in sets.
0125   bool operator<(const TrackerHit& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
0126 
0127   podio::ObjectID id() const { return getObjectID(); }
0128 
0129   const podio::ObjectID getObjectID() const;
0130 
0131   friend std::hash<TrackerHit>;
0132 
0133   friend void swap(TrackerHit& a, TrackerHit& b) {
0134     using std::swap;
0135     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0136   }
0137 
0138 private:
0139   /// constructor from existing TrackerHitObj
0140   explicit TrackerHit(podio::utils::MaybeSharedPtr<TrackerHitObj> obj);
0141   TrackerHit(TrackerHitObj* obj);
0142 
0143   podio::utils::MaybeSharedPtr<TrackerHitObj> m_obj{nullptr};
0144 };
0145 
0146 std::ostream& operator<<(std::ostream& o, const TrackerHit& value);
0147 
0148 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0149 void to_json(nlohmann::json& j, const TrackerHit& value);
0150 #endif
0151 
0152 
0153 } // namespace edm4eic
0154 
0155 
0156 
0157 template<>
0158 struct std::hash<edm4eic::TrackerHit> {
0159   std::size_t operator()(const edm4eic::TrackerHit& obj) const {
0160     return std::hash<edm4eic::TrackerHitObj*>{}(obj.m_obj.get());
0161   }
0162 };
0163 
0164 
0165 // This is needed to avoid triggering opening every library in LD_LIBRARY_PATH
0166 // until it's fixed in ROOT. See https://github.com/root-project/root/issues/18489
0167 // and https://github.com/AIDASoft/podio/issues/770
0168 #if defined(__clang__)
0169 #pragma clang diagnostic push
0170 #pragma clang diagnostic ignored "-Wunknown-warning-option"
0171 #pragma clang diagnostic ignored "-Wdeprecated-redundant-constexpr-static-def"
0172 #pragma clang diagnostic ignored "-Wdeprecated"
0173 constexpr std::string_view edm4eic::TrackerHit::typeName;
0174 #pragma clang diagnostic pop
0175 #elif defined(__GNUC__)
0176 #pragma GCC diagnostic push
0177 #pragma GCC diagnostic ignored "-Wdeprecated"
0178 constexpr std::string_view edm4eic::TrackerHit::typeName;
0179 #pragma GCC diagnostic pop
0180 #endif
0181 
0182 #endif