Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-10-13 08:16:38

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 #include "Acts/SpacePointFormation2/PixelSpacePointBuilder.hpp"
0010 
0011 #include "Acts/Definitions/Algebra.hpp"
0012 #include "Acts/Surfaces/Surface.hpp"
0013 #include "Acts/Utilities/MathHelpers.hpp"
0014 
0015 namespace Acts {
0016 
0017 Vector2 PixelSpacePointBuilder::computeVarianceZR(
0018     const GeometryContext& gctx, const Surface& surface,
0019     const Vector3& spacePoint, const SquareMatrix2& localCov) {
0020   // the space point requires only the variance of the transverse and
0021   // longitudinal position. reduce computations by transforming the
0022   // covariance directly from local to z/r.
0023   //
0024   // compute Jacobian from global coordinates to z/r
0025   //
0026   //       dz/dz = 1
0027   //           r = sqrt(x² + y²)
0028   //   dr/d{x,y} = (1 / sqrt(x² + y²)) * 2 * {x,y}
0029   //             = 2 * {x,y} / r
0030   //
0031   const double x = spacePoint.x();
0032   const double y = spacePoint.y();
0033   const double scale = 2 / fastHypot(x, y);
0034   ActsMatrix<2, 3> jacXyzToZr = ActsMatrix<2, 3>::Zero();
0035   jacXyzToZr(0, 2) = 1;
0036   jacXyzToZr(1, 0) = scale * x;
0037   jacXyzToZr(1, 1) = scale * y;
0038 
0039   // using invalid direction vector, as it is usually not needed by the surface
0040   SquareMatrix3 rotLocalToGlobal =
0041       surface.referenceFrame(gctx, spacePoint, Vector3::Zero());
0042 
0043   // compute Jacobian from local coordinates to z/r
0044   SquareMatrix2 jac = jacXyzToZr * rotLocalToGlobal.topLeftCorner<3, 2>();
0045 
0046   // compute z/r variance
0047   Vector2 result = (jac * localCov * jac.transpose()).diagonal();
0048   return result;
0049 }
0050 
0051 }  // namespace Acts