Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-07-05 08:52:30

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(std::uint64_t cellID, edm4hep::Vector3f position, edm4eic::CovDiag3f positionError, float time, float timeError, float edep, float edepError);
0062 
0063   /// copy constructor
0064   TrackerHit(const TrackerHit& other) = default;
0065 
0066   /// copy-assignment operator
0067   TrackerHit& operator=(TrackerHit 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   MutableTrackerHit clone(bool cloneRelations=true) const;
0072 
0073   /// destructor
0074   ~TrackerHit() = default;
0075 
0076   /// converting constructor from mutable object
0077   TrackerHit(const MutableTrackerHit& other);
0078 
0079   static TrackerHit makeEmpty();
0080 
0081 public:
0082 
0083   static constexpr auto typeName = "edm4eic::TrackerHit";
0084 
0085   /// Access the The detector specific (geometrical) cell id.
0086   std::uint64_t getCellID() const;
0087 
0088   /// Access the Hit (cell) position [mm]
0089   const edm4hep::Vector3f& getPosition() const;
0090 
0091   /// Access the Covariance Matrix
0092   const edm4eic::CovDiag3f& getPositionError() const;
0093 
0094   /// Access the Hit time [ns]
0095   float getTime() const;
0096 
0097   /// Access the Error on the time
0098   float getTimeError() const;
0099 
0100   /// Access the Energy deposit in this hit [GeV]
0101   float getEdep() const;
0102 
0103   /// Access the Error on the energy deposit [GeV]
0104   float getEdepError() const;
0105 
0106 
0107   /// Access the Related raw tracker hit
0108   const edm4eic::RawTrackerHit getRawHit() const;
0109 
0110 
0111 
0112   /// check whether the object is actually available
0113   bool isAvailable() const;
0114   /// disconnect from TrackerHitObj instance
0115   void unlink() { m_obj = podio::utils::MaybeSharedPtr<TrackerHitObj>{nullptr}; }
0116 
0117   bool operator==(const TrackerHit& other) const { return m_obj == other.m_obj; }
0118   bool operator==(const MutableTrackerHit& other) const;
0119 
0120   bool operator!=(const TrackerHit& other) const { return !(*this == other); }
0121   bool operator!=(const MutableTrackerHit& other) const { return !(*this == other); }
0122 
0123   // less comparison operator, so that objects can be e.g. stored in sets.
0124   bool operator<(const TrackerHit& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
0125 
0126   podio::ObjectID id() const { return getObjectID(); }
0127 
0128   const podio::ObjectID getObjectID() const;
0129 
0130   friend void swap(TrackerHit& a, TrackerHit& b) {
0131     using std::swap;
0132     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0133   }
0134 
0135 private:
0136   /// constructor from existing TrackerHitObj
0137   explicit TrackerHit(podio::utils::MaybeSharedPtr<TrackerHitObj> obj);
0138   TrackerHit(TrackerHitObj* obj);
0139 
0140   podio::utils::MaybeSharedPtr<TrackerHitObj> m_obj{nullptr};
0141 };
0142 
0143 std::ostream& operator<<(std::ostream& o, const TrackerHit& value);
0144 
0145 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0146 void to_json(nlohmann::json& j, const TrackerHit& value);
0147 #endif
0148 
0149 
0150 } // namespace edm4eic
0151 
0152 
0153 #endif