Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:08:11

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 #pragma once
0010 
0011 #include "Acts/Seeding/detail/StrawLineFitAuxiliaries.hpp"
0012 
0013 #include "Acts/Definitions/Units.hpp"
0014 #include "Acts/Surfaces/detail/LineHelper.hpp"
0015 #include "Acts/Utilities/StringHelpers.hpp"
0016 
0017 namespace Acts::Experimental::detail {
0018 
0019 template <CompositeSpacePoint Point_t>
0020 int StrawLineFitAuxiliaries::strawSign(const Line_t& line,
0021                                        const Point_t& strawSp) {
0022   if (!strawSp.isStraw()) {
0023     return 0;
0024   }
0025   const double dist = Acts::detail::LineHelper::signedDistance(
0026       line.position(), line.direction(), strawSp.localPosition(),
0027       strawSp.sensorDirection());
0028   return dist > 0. ? 1 : -1;
0029 }
0030 
0031 template <CompositeSpacePoint Point_t>
0032 void StrawLineFitAuxiliaries::updateSpatialResidual(const Line_t& line,
0033                                                     const Point_t& spacePoint) {
0034   if (spacePoint.isStraw()) {
0035     /// Fetch the hit position & direction
0036     const auto& wireDir{spacePoint.sensorDirection()};
0037     /// Calculate the distance from the two reference points
0038     const Vector hitMinSeg = spacePoint.localPosition() - line.position();
0039 
0040     if (!updateStrawResidual(line, hitMinSeg, wireDir,
0041                              spacePoint.driftRadius())) {
0042       return;
0043     }
0044 
0045     if (m_cfg.calcAlongStraw && spacePoint.measuresLoc0()) {
0046       /// If the tube is a twin-tube, the hit position is no longer arbitrary
0047       /// along the wire. Calculate the distance along the wire towards the
0048       /// point of closest approach.
0049       updateAlongTheStraw(line, hitMinSeg, wireDir);
0050     }
0051   } else {
0052     updateStripResidual(line, spacePoint.planeNormal(),
0053                         spacePoint.toNextSensor(), spacePoint.sensorDirection(),
0054                         spacePoint.localPosition(), spacePoint.measuresLoc1(),
0055                         spacePoint.measuresLoc0());
0056   }
0057 }
0058 
0059 }  // namespace Acts::Experimental::detail