Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:18:17

0001 #include "TrackStateInfo_v1.h"
0002 #include <trackbase/TrkrDefs.h>
0003 
0004 #include <cmath>
0005 #include <cstddef>  // for size_t
0006 #include <iostream>
0007 #include <map>
0008 #include <utility>  // for pair
0009 
0010 namespace
0011 {
0012   // get unique index in cov. matrix array from i and j
0013   inline unsigned int covar_index(unsigned int i, unsigned int j)
0014   {
0015     if (i > j)
0016     {
0017       std::swap(i, j);
0018     }
0019     return i + 1 + (j + 1) * (j) / 2 - 1;
0020   }
0021 }  // namespace
0022 float TrackStateInfo_v1::get_covariance(int i, int j) const
0023 {
0024   return m_Covariance[covar_index(i, j)];
0025 }
0026 void TrackStateInfo_v1::set_covariance(int i, int j, float value)
0027 {
0028   m_Covariance[covar_index(i, j)] = value;
0029 }
0030 float TrackStateInfo_v1::get_px() const
0031 {
0032   return fabs(1. / get_qOp()) * std::cos(get_phi()) * std::sin(get_theta());
0033 }
0034 float TrackStateInfo_v1::get_py() const
0035 {
0036   return fabs(1. / get_qOp()) * std::sin(get_phi()) * std::sin(get_theta());
0037 }
0038 float TrackStateInfo_v1::get_pz() const
0039 {
0040   return fabs(1. / get_qOp()) * std::cos(get_theta());
0041 }