Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-12-17 09:20:44

0001 #ifndef TRACKRECO_ACTSTRANSFORMATIONS_H
0002 #define TRACKRECO_ACTSTRANSFORMATIONS_H
0003 
0004 #include "SvtxTrack.h"
0005 
0006 #include <trackbase/ActsGeometry.h>
0007 #include <trackbase/ActsTrackFittingAlgorithm.h>
0008 #include <trackbase/TrkrDefs.h>
0009 
0010 /// Acts includes to create all necessary definitions
0011 #include <Acts/Definitions/Algebra.hpp>
0012 #include <Acts/EventData/VectorMultiTrajectory.hpp>
0013 #include <Acts/Utilities/BinnedArray.hpp>
0014 #include <Acts/Utilities/Logger.hpp>
0015 
0016 /// std (and the like) includes
0017 #include <cmath>
0018 #include <iostream>
0019 #include <memory>
0020 #include <utility>
0021 
0022 // forward declarations
0023 class SvtxTrack;
0024 class SvtxTrackState;
0025 class TrkrCluster;
0026 
0027 /**
0028  * This is a helper class for rotating track covariance matrices to and from
0029  * the basis that Acts expects. The covariance matrix is nominally given in the
0030  * global basis (x,y,z,px,py,pz). Acts expects the covariance matrix in a local
0031  * basis with respect to the given reference point that is provided as an
0032  * option to the KalmanFitter.
0033  */
0034 class ActsTransformations
0035 {
0036  public:
0037   ActsTransformations() = default;
0038 
0039   /// Rotates an SvtxTrack covariance matrix from (x,y,z,px,py,pz) global
0040   /// cartesian coordinates to (d0, z0, phi, theta, q/p, time) coordinates for
0041   /// Acts. The track fitter performs the fitting with respect to the nominal
0042   /// origin of sPHENIX, so we rotate accordingly
0043   Acts::BoundSquareMatrix rotateSvtxTrackCovToActs(const SvtxTrack*) const;
0044 
0045   /// Rotates an SvtxTrack state covariance matrix from (x,y,z,px,py,pz) global
0046   /// cartesian coordinates to (d0, z0, phi, theta, q/p, time) coordinates for
0047   /// Acts. The track fitter performs the fitting with respect to the nominal
0048   /// origin of sPHENIX, so we rotate accordingly
0049   Acts::BoundSquareMatrix rotateSvtxTrackCovToActs(const SvtxTrackState*) const;
0050 
0051   /// Rotates an Acts covariance matrix from (d0, z0, phi, theta, q/p, time) local curvilinear coordinates
0052   /// to global cartesian coordinates (x,y,z,px,py,pz) coordinates
0053   Acts::BoundSquareMatrix rotateActsCovToSvtxTrack(const ActsTrackFittingAlgorithm::TrackParameters&) const;
0054 
0055   void setVerbosity(int verbosity) { m_verbosity = verbosity; }
0056 
0057   void printMatrix(const std::string& message, const Acts::BoundSquareMatrix& matrix) const;
0058 
0059   /// Calculate the DCA for a given Acts fitted track parameters and
0060   /// vertex
0061   void calculateDCA(
0062     const ActsTrackFittingAlgorithm::TrackParameters& param,
0063     const Acts::Vector3& vertex,
0064     Acts::BoundSquareMatrix cov,
0065     Acts::GeometryContext& geoCtxt,
0066     float& dca3Dxy,
0067     float& dca3Dz,
0068     float& dca3DxyCov,
0069     float& dca3DzCov) const;
0070 
0071   //___________________________________________________________________________________________________________
0072   void fillSvtxTrackStates(
0073     const Acts::ConstVectorMultiTrajectory& traj,
0074     const size_t& trackTip,
0075     SvtxTrack* svtxTrack,
0076     const Acts::GeometryContext& geoContext
0077     ) const;
0078 
0079   //___________________________________________________________________________________________________________
0080   void addTrackState(
0081     SvtxTrack* track,
0082     TrkrDefs::cluskey key,
0083     float pathlength,
0084     const Acts::BoundTrackParameters& params,
0085     const Acts::GeometryContext& geoContext ) const;
0086 
0087  private:
0088   int m_verbosity = 0;
0089 };
0090 
0091 #endif