Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-09-28 07:02:58

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