Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:11:28

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/Surfaces/detail/AlignmentHelper.hpp"
0010 
0011 #include <utility>
0012 
0013 namespace Acts {
0014 
0015 detail::RotationToAxes detail::rotationToLocalAxesDerivative(
0016     const RotationMatrix3& compositeRotation,
0017     const RotationMatrix3& relRotation) {
0018   // Suppose the local axes of the composite have small rotation first around
0019   // its original local x axis by alpha, then around its original local y by
0020   // beta, then last around its original local z by gamma, the new rotation
0021   // matrix of the composite is then compositeRotation*deltaRotation, where
0022   // deltaRotation has the following form:
0023   //  | cbeta*cgamma  salpha*sbeta*cgamma-calpha*sgamma calpha*sbeta*cgamma +
0024   //  salpha*sgamma|, | cbeta*sgamma  salpha*sbeta*sgamma+calpha*cgamma
0025   //  calpha*sbeta*sgamma-salpha*cgamma  |, | -sbeta        salpha*cbeta
0026   //  calpha*cbeta                       | where prefix 's' means sin and 'c'
0027   //  means cos, then:
0028   //  1) the derivatives of new local x axis of the composite
0029   //  w.r.t. (alpha, beta, gamma) is rotToCompositeLocalXAxis =
0030   //  compositeRotation* |0  0  0|,
0031   //                     |0  0  1|
0032   //                     |0 -1  0|
0033   //  2) the derivatives of new local y axis of the composite
0034   //  w.r.t. (alpha, beta, gamma) is rotToCompositeLocalYAxis =
0035   //  compositeRotation* |0  0 -1|,
0036   //                     |0  0  0|
0037   //                     |1  0  0|
0038   //  3) the derivatives of new local z axis of the composite
0039   //  w.r.t. (alpha, beta, gamma) is rotToCompositeLocalZAxis =
0040   //  compositeRotation* | 0  1  0|,
0041   //                     |-1  0  0|
0042   //                     | 0  0  0|
0043 
0044   // The object rotation is objectRotation = compositeRotation*relRotation, then
0045   // 1) the derivate of the new local
0046   // x axis of the object w.r.t. (alpha, beta, gamma) is
0047   // rotToCompositeLocalXAxis * relRotation(0,0) +
0048   // rotToCompositeLocalYAxis*relRotation(1,0) +
0049   // rotToCompositeLocalZAxis*relRotation(2,0),
0050   // 2) the derivate of the new local
0051   // y axis of the object w.r.t. (alpha, beta, gamma) is
0052   // rotToCompositeLocalXAxis * relRotation(0,1) +
0053   // rotToCompositeLocalYAxis*relRotation(1,1) +
0054   // rotToCompositeLocalZAxis*relRotation(2,1),
0055   // 3) the derivate of the new local
0056   // z axis of the object w.r.t. (alpha, beta, gamma) is
0057   // rotToCompositeLocalXAxis * relRotation(0,2) +
0058   // rotToCompositeLocalYAxis*relRotation(1,2) +
0059   // rotToCompositeLocalZAxis*relRotation(2,2),
0060 
0061   // Derivative of local x axis w.r.t. (rotX, rotY, rotZ)
0062   RotationMatrix3 rotToCompositeLocalXAxis = RotationMatrix3::Zero();
0063   rotToCompositeLocalXAxis.col(0) = compositeRotation * Vector3(0, 0, 0);
0064   rotToCompositeLocalXAxis.col(1) = compositeRotation * Vector3(0, 0, -1);
0065   rotToCompositeLocalXAxis.col(2) = compositeRotation * Vector3(0, 1, 0);
0066   // Derivative of local y axis w.r.t. (rotX, rotY, rotZ)
0067   RotationMatrix3 rotToCompositeLocalYAxis = RotationMatrix3::Zero();
0068   rotToCompositeLocalYAxis.col(0) = compositeRotation * Vector3(0, 0, 1);
0069   rotToCompositeLocalYAxis.col(1) = compositeRotation * Vector3(0, 0, 0);
0070   rotToCompositeLocalYAxis.col(2) = compositeRotation * Vector3(-1, 0, 0);
0071   // Derivative of local z axis w.r.t. (rotX, rotY, rotZ)
0072   RotationMatrix3 rotToCompositeLocalZAxis = RotationMatrix3::Zero();
0073   rotToCompositeLocalZAxis.col(0) = compositeRotation * Vector3(0, -1, 0);
0074   rotToCompositeLocalZAxis.col(1) = compositeRotation * Vector3(1, 0, 0);
0075   rotToCompositeLocalZAxis.col(2) = compositeRotation * Vector3(0, 0, 0);
0076 
0077   RotationMatrix3 rotToLocalXAxis = RotationMatrix3::Zero();
0078   RotationMatrix3 rotToLocalYAxis = RotationMatrix3::Zero();
0079   RotationMatrix3 rotToLocalZAxis = RotationMatrix3::Zero();
0080   rotToLocalXAxis = rotToCompositeLocalXAxis * relRotation(0, 0) +
0081                     rotToCompositeLocalYAxis * relRotation(1, 0) +
0082                     rotToCompositeLocalZAxis * relRotation(2, 0);
0083   rotToLocalYAxis = rotToCompositeLocalXAxis * relRotation(0, 1) +
0084                     rotToCompositeLocalYAxis * relRotation(1, 1) +
0085                     rotToCompositeLocalZAxis * relRotation(2, 1);
0086   rotToLocalZAxis = rotToCompositeLocalXAxis * relRotation(0, 2) +
0087                     rotToCompositeLocalYAxis * relRotation(1, 2) +
0088                     rotToCompositeLocalZAxis * relRotation(2, 2);
0089 
0090   return {std::move(rotToLocalXAxis), std::move(rotToLocalYAxis),
0091           std::move(rotToLocalZAxis)};
0092 }
0093 
0094 }  // namespace Acts