Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:17:04

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(const ActsTrackFittingAlgorithm::TrackParameters& param,
0062                     const Acts::Vector3& vertex,
0063                     Acts::BoundSquareMatrix cov,
0064                     Acts::GeometryContext& geoCtxt,
0065                     float& dca3Dxy,
0066                     float& dca3Dz,
0067                     float& dca3DxyCov,
0068                     float& dca3DzCov) const;
0069 
0070   void fillSvtxTrackStates(const Acts::ConstVectorMultiTrajectory& traj,
0071                            const size_t& trackTip,
0072                            SvtxTrack* svtxTrack,
0073                            Acts::GeometryContext& geoContext) const;
0074 
0075  private:
0076   int m_verbosity = 0;
0077 };
0078 
0079 #endif