Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-04 07:50:49

0001 #pragma once
0002 
0003 #include <Acts/EventData/Seed.hpp>
0004 #include <Acts/Geometry/GeometryIdentifier.hpp>
0005 #include <Acts/Surfaces/Surface.hpp>
0006 #include "ActsGeometryProvider.h"
0007 namespace eicrecon {
0008 
0009 class SpacePoint : public edm4eic::TrackerHit {
0010 public:
0011   const Acts::Surface* m_surface = nullptr;
0012 
0013   SpacePoint(const TrackerHit& hit) : TrackerHit(hit) {}
0014 
0015   void setSurface(std::shared_ptr<const ActsGeometryProvider> m_geoSvc) {
0016     const auto its = m_geoSvc->surfaceMap().find(getCellID());
0017     if (its == m_geoSvc->surfaceMap().end()) {
0018       m_surface = nullptr;
0019     } else {
0020       m_surface = its->second;
0021     }
0022   }
0023 
0024   float x() const { return getPosition()[0]; }
0025   float y() const { return getPosition()[1]; }
0026   float z() const { return getPosition()[2]; }
0027   float r() const { return std::hypot(x(), y()); }
0028   float varianceR() const {
0029     return (std::pow(x(), 2) * getPositionError().xx + std::pow(y(), 2) * getPositionError().yy) /
0030            (std::pow(x(), 2) + std::pow(y(), 2));
0031   }
0032   float varianceZ() const { return getPositionError().zz; }
0033 
0034   float t() const { return getTime(); }
0035   float varianceT() const { return getTimeError(); }
0036 
0037   bool isOnSurface(const Acts::GeometryContext& gctx) const {
0038     if (m_surface == nullptr) {
0039       return false;
0040     }
0041     return m_surface->isOnSurface(gctx, {x(), y(), z()}, {0, 0, 0});
0042   }
0043 };
0044 
0045 inline bool operator==(SpacePoint a, SpacePoint b) { return (a.getObjectID() == b.getObjectID()); }
0046 
0047 using SpacePointPtr = std::unique_ptr<SpacePoint>;
0048 /// Container of sim seed
0049 using SeedContainer = std::vector<Acts::Seed<SpacePoint>>;
0050 
0051 } // namespace eicrecon