Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-06-30 07:55:44

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