Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 34 additions & 34 deletions Common/DCAFitter/include/DCAFitter/DCAFitterN.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,11 @@ class DCAFitterN
using MatSymND = o2::math_utils::SMatrix<double, N, N, o2::math_utils::MatRepSym<double, N>>;
using MatStdND = o2::math_utils::SMatrix<double, N, N, o2::math_utils::MatRepStd<double, N>>;
using TrackCoefVtx = MatStd3D;
using ArrTrack = o2::gpu::gpustd::array<Track, N>; // container for prongs (tracks) at single vertex cand.
using ArrTrackCovI = o2::gpu::gpustd::array<TrackCovI, N>; // container for inv.cov.matrices at single vertex cand.
using ArrTrCoef = o2::gpu::gpustd::array<TrackCoefVtx, N>; // container of TrackCoefVtx coefficients at single vertex cand.
using ArrTrDer = o2::gpu::gpustd::array<TrackDeriv, N>; // container of Track 1st and 2nd derivative over their X param
using ArrTrPos = o2::gpu::gpustd::array<Vec3D, N>; // container of Track positions
using ArrTrack = std::array<Track, N>; // container for prongs (tracks) at single vertex cand.
using ArrTrackCovI = std::array<TrackCovI, N>; // container for inv.cov.matrices at single vertex cand.
using ArrTrCoef = std::array<TrackCoefVtx, N>; // container of TrackCoefVtx coefficients at single vertex cand.
using ArrTrDer = std::array<TrackDeriv, N>; // container of Track 1st and 2nd derivative over their X param
using ArrTrPos = std::array<Vec3D, N>; // container of Track positions

public:
enum BadCovPolicy : uint8_t { // if encountering non-positive defined cov. matrix, the choice is:
Expand Down Expand Up @@ -158,7 +158,7 @@ class DCAFitterN
GPUd() const auto getPCACandidatePos(int cand = 0) const
{
const auto& vd = mPCA[mOrder[cand]];
return o2::gpu::gpustd::array<float, 3>{static_cast<float>(vd[0]), static_cast<float>(vd[1]), static_cast<float>(vd[2])};
return std::array<float, 3>{static_cast<float>(vd[0]), static_cast<float>(vd[1]), static_cast<float>(vd[2])};
}

///< return position of quality-ordered candidate in the internal structures
Expand Down Expand Up @@ -213,7 +213,7 @@ class DCAFitterN

GPUd() MatSym3D calcPCACovMatrix(int cand = 0) const;

o2::gpu::gpustd::array<float, 6> calcPCACovMatrixFlat(int cand = 0) const
std::array<float, 6> calcPCACovMatrixFlat(int cand = 0) const
{
auto m = calcPCACovMatrix(cand);
return {static_cast<float>(m(0, 0)), static_cast<float>(m(1, 0)), static_cast<float>(m(1, 1)), static_cast<float>(m(2, 0)), static_cast<float>(m(2, 1)), static_cast<float>(m(2, 2))};
Expand Down Expand Up @@ -364,39 +364,39 @@ class DCAFitterN

private:
// vectors of 1st derivatives of track local residuals over X parameters
o2::gpu::gpustd::array<o2::gpu::gpustd::array<Vec3D, N>, N> mDResidDx;
std::array<std::array<Vec3D, N>, N> mDResidDx;
// vectors of 1nd derivatives of track local residuals over X parameters
// (cross-derivatives DR/(dx_j*dx_k) = 0 for j!=k, therefore the hessian is diagonal)
o2::gpu::gpustd::array<o2::gpu::gpustd::array<Vec3D, N>, N> mD2ResidDx2;
std::array<std::array<Vec3D, N>, N> mD2ResidDx2;
VecND mDChi2Dx; // 1st derivatives of chi2 over tracks X params
MatSymND mD2Chi2Dx2; // 2nd derivatives of chi2 over tracks X params (symmetric matrix)
MatSymND mCosDif; // matrix with cos(alp_j-alp_i) for j<i
MatSymND mSinDif; // matrix with sin(alp_j-alp_i) for j<i
o2::gpu::gpustd::array<const Track*, N> mOrigTrPtr;
o2::gpu::gpustd::array<TrackAuxPar, N> mTrAux; // Aux track info for each track at each cand. vertex
CrossInfo mCrossings; // info on track crossing

o2::gpu::gpustd::array<ArrTrackCovI, MAXHYP> mTrcEInv; // errors for each track at each cand. vertex
o2::gpu::gpustd::array<ArrTrack, MAXHYP> mCandTr; // tracks at each cond. vertex (Note: Errors are at seed XY point)
o2::gpu::gpustd::array<ArrTrCoef, MAXHYP> mTrCFVT; // TrackCoefVtx for each track at each cand. vertex
o2::gpu::gpustd::array<ArrTrDer, MAXHYP> mTrDer; // Track derivativse
o2::gpu::gpustd::array<ArrTrPos, MAXHYP> mTrPos; // Track positions
o2::gpu::gpustd::array<ArrTrPos, MAXHYP> mTrRes; // Track residuals
o2::gpu::gpustd::array<Vec3D, MAXHYP> mPCA; // PCA for each vertex candidate
o2::gpu::gpustd::array<float, MAXHYP> mChi2 = {0}; // Chi2 at PCA candidate
o2::gpu::gpustd::array<int, MAXHYP> mNIters; // number of iterations for each seed
o2::gpu::gpustd::array<bool, MAXHYP> mTrPropDone{}; // Flag that the tracks are fully propagated to PCA
o2::gpu::gpustd::array<bool, MAXHYP> mPropFailed{}; // Flag that some propagation failed for this PCA candidate
std::array<const Track*, N> mOrigTrPtr;
std::array<TrackAuxPar, N> mTrAux; // Aux track info for each track at each cand. vertex
CrossInfo mCrossings; // info on track crossing

std::array<ArrTrackCovI, MAXHYP> mTrcEInv; // errors for each track at each cand. vertex
std::array<ArrTrack, MAXHYP> mCandTr; // tracks at each cond. vertex (Note: Errors are at seed XY point)
std::array<ArrTrCoef, MAXHYP> mTrCFVT; // TrackCoefVtx for each track at each cand. vertex
std::array<ArrTrDer, MAXHYP> mTrDer; // Track derivativse
std::array<ArrTrPos, MAXHYP> mTrPos; // Track positions
std::array<ArrTrPos, MAXHYP> mTrRes; // Track residuals
std::array<Vec3D, MAXHYP> mPCA; // PCA for each vertex candidate
std::array<float, MAXHYP> mChi2 = {0}; // Chi2 at PCA candidate
std::array<int, MAXHYP> mNIters; // number of iterations for each seed
std::array<bool, MAXHYP> mTrPropDone{}; // Flag that the tracks are fully propagated to PCA
std::array<bool, MAXHYP> mPropFailed{}; // Flag that some propagation failed for this PCA candidate
LogLogThrottler mLoggerBadCov{};
LogLogThrottler mLoggerBadInv{};
LogLogThrottler mLoggerBadProp{};
MatSym3D mWeightInv; // inverse weight of single track, [sum{M^T E M}]^-1 in EQ.T
o2::gpu::gpustd::array<int, MAXHYP> mOrder{0};
std::array<int, MAXHYP> mOrder{0};
int mCurHyp = 0;
int mCrossIDCur = 0;
int mCrossIDAlt = -1;
BadCovPolicy mBadCovPolicy{BadCovPolicy::Discard}; // what to do in case of non-pos-def. cov. matrix, see BadCovPolicy enum
o2::gpu::gpustd::array<FitStatus, MAXHYP> mFitStatus{}; // fit status of each hypothesis fit
std::array<FitStatus, MAXHYP> mFitStatus{}; // fit status of each hypothesis fit
bool mAllowAltPreference = true; // if the fit converges to alternative PCA seed, abandon the current one
bool mUseAbsDCA = false; // use abs. distance minimization rather than chi2
bool mWeightedFinalPCA = false; // recalculate PCA as a cov-matrix weighted mean, even if absDCA method was used
Expand Down Expand Up @@ -657,7 +657,7 @@ template <int N, typename... Args>
GPUd() void DCAFitterN<N, Args...>::calcChi2Derivatives()
{
//< calculate 1st and 2nd derivatives of wighted DCA (chi2) over track parameters X, see EQ.Chi2 in the ref
o2::gpu::gpustd::array<o2::gpu::gpustd::array<Vec3D, N>, N> covIDrDx; // tempory vectors of covI_j * dres_j/dx_i
std::array<std::array<Vec3D, N>, N> covIDrDx; // tempory vectors of covI_j * dres_j/dx_i

// chi2 1st derivative
for (int i = N; i--;) {
Expand Down Expand Up @@ -1175,13 +1175,13 @@ GPUd() o2::track::TrackParCov DCAFitterN<N, Args...>::createParentTrackParCov(in
{
const auto& trP = getTrack(0, cand);
const auto& trN = getTrack(1, cand);
o2::gpu::gpustd::array<float, 21> covV = {0.};
o2::gpu::gpustd::array<float, 3> pvecV = {0.};
std::array<float, 21> covV = {0.};
std::array<float, 3> pvecV = {0.};
int q = 0;
for (int it = 0; it < N; it++) {
const auto& trc = getTrack(it, cand);
o2::gpu::gpustd::array<float, 3> pvecT = {0.};
o2::gpu::gpustd::array<float, 21> covT = {0.};
std::array<float, 3> pvecT = {0.};
std::array<float, 21> covT = {0.};
trc.getPxPyPzGlo(pvecT);
trc.getCovXYZPxPyPzGlo(covT);
constexpr int MomInd[6] = {9, 13, 14, 18, 19, 20}; // cov matrix elements for momentum component
Expand Down Expand Up @@ -1210,18 +1210,18 @@ GPUd() o2::track::TrackPar DCAFitterN<N, Args...>::createParentTrackPar(int cand
const auto& trP = getTrack(0, cand);
const auto& trN = getTrack(1, cand);
const auto& wvtx = getPCACandidate(cand);
o2::gpu::gpustd::array<float, 3> pvecV = {0.};
std::array<float, 3> pvecV = {0.};
int q = 0;
for (int it = 0; it < N; it++) {
const auto& trc = getTrack(it, cand);
o2::gpu::gpustd::array<float, 3> pvecT = {0.};
std::array<float, 3> pvecT = {0.};
trc.getPxPyPzGlo(pvecT);
for (int i = 0; i < 3; i++) {
pvecV[i] += pvecT[i];
}
q += trc.getCharge();
}
const o2::gpu::gpustd::array<float, 3> vertex = {(float)wvtx[0], (float)wvtx[1], (float)wvtx[2]};
const std::array<float, 3> vertex = {(float)wvtx[0], (float)wvtx[1], (float)wvtx[2]};
return o2::track::TrackPar(vertex, pvecV, q, sectorAlpha);
}

Expand Down
12 changes: 7 additions & 5 deletions Common/MathUtils/include/MathUtils/SMatrixGPU.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@
#define ALICEO2_SMATRIX_GPU_H

#include "GPUCommonDef.h"
#include "GPUCommonArray.h"
#include "GPUCommonMath.h"
#include "GPUCommonAlgorithm.h"
#include "GPUCommonLogger.h"
#include "GPUCommonTypeTraits.h"
#ifndef GPUCA_GPUCODE_DEVICE
#include <type_traits>
#include <array>
#endif

namespace o2::math_utils::detail
{
Expand Down Expand Up @@ -281,14 +283,14 @@ struct make_indices : make_indices_impl<0, indices<>, N> {
};

template <int I0, class F, int... I>
constexpr auto do_make(F f, indices<I...>) -> gpu::gpustd::array<int, sizeof...(I)>
constexpr auto do_make(F f, indices<I...>) -> std::array<int, sizeof...(I)>
{
gpu::gpustd::array<int, sizeof...(I)> retarr = {f(I0 + I)...};
std::array<int, sizeof...(I)> retarr = {f(I0 + I)...};
return retarr;
}

template <int N, int I0 = 0, class F>
constexpr auto make(F f) -> gpu::gpustd::array<int, N>
constexpr auto make(F f) -> std::array<int, N>
{
return do_make<I0>(f, typename make_indices<N>::type());
}
Expand Down
11 changes: 6 additions & 5 deletions Common/MathUtils/include/MathUtils/detail/basicMath.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@
#ifndef MATHUTILS_INCLUDE_MATHUTILS_DETAIL_BASICMATH_H_
#define MATHUTILS_INCLUDE_MATHUTILS_DETAIL_BASICMATH_H_

#include "GPUCommonDef.h"
#include "GPUCommonMath.h"
#include "CommonConstants/MathConstants.h"

#ifndef GPUCA_GPUCODE_DEVICE
#include <cmath>
#include <tuple>
#include <array>
#endif
#include "GPUCommonArray.h"
#include "GPUCommonDef.h"
#include "GPUCommonMath.h"
#include "CommonConstants/MathConstants.h"

namespace o2
{
Expand Down Expand Up @@ -130,4 +131,4 @@ GPUdi() double log(double x)
} // namespace math_utils
} // namespace o2

#endif /* MATHUTILS_INCLUDE_MATHUTILS_DETAIL_BASICMATH_H_ */
#endif /* MATHUTILS_INCLUDE_MATHUTILS_DETAIL_BASICMATH_H_ */
13 changes: 7 additions & 6 deletions Common/MathUtils/include/MathUtils/detail/trigonometric.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,17 @@
#ifndef MATHUTILS_INCLUDE_MATHUTILS_DETAIL_TRIGONOMETRIC_H_
#define MATHUTILS_INCLUDE_MATHUTILS_DETAIL_TRIGONOMETRIC_H_

#ifndef GPUCA_GPUCODE_DEVICE
#include <cmath>
#include <tuple>
#endif
#include "GPUCommonArray.h"
#include "GPUCommonDef.h"
#include "GPUCommonMath.h"
#include "CommonConstants/MathConstants.h"
#include "MathUtils/detail/basicMath.h"

#ifndef GPUCA_GPUCODE_DEVICE
#include <cmath>
#include <tuple>
#include <array>
#endif

namespace o2
{
namespace math_utils
Expand Down Expand Up @@ -156,7 +157,7 @@ GPUhdi() std::tuple<T, T> rotateZInv(T xG, T yG, T snAlp, T csAlp)
#endif

template <typename T>
GPUhdi() void rotateZ(gpu::gpustd::array<T, 3>& xy, T alpha)
GPUhdi() void rotateZ(std::array<T, 3>& xy, T alpha)
{
// transforms vector in tracking frame alpha to global frame
T sin, cos;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,14 +170,14 @@ class TrackITSExt : public TrackITS
using TrackITS::TrackITS; // inherit base constructors

GPUh() TrackITSExt(o2::track::TrackParCov&& parCov, short ncl, float chi2,
o2::track::TrackParCov&& outer, o2::gpu::gpustd::array<int, MaxClusters> cls)
o2::track::TrackParCov&& outer, std::array<int, MaxClusters> cls)
: TrackITS(parCov, chi2, outer), mIndex{cls}
{
setNumberOfClusters(ncl);
}

GPUh() TrackITSExt(o2::track::TrackParCov& parCov, short ncl, float chi2, std::uint32_t rof,
o2::track::TrackParCov& outer, o2::gpu::gpustd::array<int, MaxClusters> cls)
o2::track::TrackParCov& outer, std::array<int, MaxClusters> cls)
: TrackITS(parCov, chi2, outer), mIndex{cls}
{
setNumberOfClusters(ncl);
Expand Down Expand Up @@ -205,13 +205,13 @@ class TrackITSExt : public TrackITS
mIndex[layer] = idx;
}

GPUh() o2::gpu::gpustd::array<int, MaxClusters>& getClusterIndexes()
GPUh() std::array<int, MaxClusters>& getClusterIndexes()
{
return mIndex;
}

private:
o2::gpu::gpustd::array<int, MaxClusters> mIndex = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}; ///< Indices of associated clusters
std::array<int, MaxClusters> mIndex = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}; ///< Indices of associated clusters
ClassDefNV(TrackITSExt, 2);
};
} // namespace its
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@

#include "GPUCommonDef.h"
#include "GPUCommonRtypes.h"
#include "GPUCommonArray.h"

#ifndef GPUCA_GPUCODE_DEVICE
#include <iosfwd>
#include <array>
#endif

/// \author ruben.shahoyan@cern.ch
Expand Down Expand Up @@ -67,7 +67,7 @@ class DCA
private:
float mY = 0.f;
float mZ = 0.f;
gpu::gpustd::array<float, 3> mCov; ///< s2y, syz, s2z
std::array<float, 3> mCov; ///< s2y, syz, s2z

ClassDefNV(DCA, 1);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include <cstring>
#include <iosfwd>
#include <type_traits>
#include <array>
#endif

#ifndef GPUCA_ALIGPUCODE // Used only by functions that are hidden on the GPU
Expand Down Expand Up @@ -128,9 +129,9 @@ class TrackParametrization

public:
using value_t = value_T;
using dim2_t = gpu::gpustd::array<value_t, 2>;
using dim3_t = gpu::gpustd::array<value_t, 3>;
using params_t = gpu::gpustd::array<value_t, kNParams>;
using dim2_t = std::array<value_t, 2>;
using dim3_t = std::array<value_t, 3>;
using params_t = std::array<value_t, kNParams>;

struct yzerr_t { // 2 measurement with error
dim2_t yz;
Expand Down Expand Up @@ -209,7 +210,7 @@ class TrackParametrization
GPUd() math_utils::Point3D<value_t> getXYZGlo() const;
GPUd() void getXYZGlo(dim3_t& xyz) const;
GPUd() bool getPxPyPzGlo(dim3_t& pxyz) const;
GPUd() bool getPosDirGlo(gpu::gpustd::array<value_t, 9>& posdirp) const;
GPUd() bool getPosDirGlo(std::array<value_t, 9>& posdirp) const;

// methods for track params estimate at other point
GPUd() bool getYZAt(value_t xk, value_t b, value_t& y, value_t& z) const;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ class TrackParametrizationWithError : public TrackParametrization<value_T>
static_assert(std::is_floating_point_v<value_t>);
#endif

using covMat_t = gpu::gpustd::array<value_t, kCovMatSize>;
using covMat_t = std::array<value_t, kCovMatSize>;
using MatrixDSym5 = o2::math_utils::SMatrix<double, kNParams, kNParams, o2::math_utils::MatRepSym<double, kNParams>>;
using MatrixD5 = o2::math_utils::SMatrix<double, kNParams, kNParams, o2::math_utils::MatRepStd<double, kNParams, kNParams>>;

GPUhd() TrackParametrizationWithError();
GPUd() TrackParametrizationWithError(value_t x, value_t alpha, const params_t& par, const covMat_t& cov, int charge = 1, const PID pid = PID::Pion);
GPUd() TrackParametrizationWithError(const dim3_t& xyz, const dim3_t& pxpypz,
const gpu::gpustd::array<value_t, kLabCovMatSize>& cv, int sign, bool sectorAlpha = true, const PID pid = PID::Pion);
const std::array<value_t, kLabCovMatSize>& cv, int sign, bool sectorAlpha = true, const PID pid = PID::Pion);

GPUhdDefault() TrackParametrizationWithError(const TrackParametrizationWithError& src) = default;
GPUdDefault() TrackParametrizationWithError(TrackParametrizationWithError&& src) = default;
Expand All @@ -57,7 +57,7 @@ class TrackParametrizationWithError : public TrackParametrization<value_T>
using TrackParametrization<value_T>::set;
GPUd() void set(value_t x, value_t alpha, const params_t& par, const covMat_t& cov, int charge = 1, const PID pid = PID::Pion);
GPUd() void set(value_t x, value_t alpha, const value_t* par, const value_t* cov, int charge = 1, const PID pid = PID::Pion);
GPUd() void set(const dim3_t& xyz, const dim3_t& pxpypz, const gpu::gpustd::array<value_t, kLabCovMatSize>& cv, int sign, bool sectorAlpha = true, const PID pid = PID::Pion);
GPUd() void set(const dim3_t& xyz, const dim3_t& pxpypz, const std::array<value_t, kLabCovMatSize>& cv, int sign, bool sectorAlpha = true, const PID pid = PID::Pion);
GPUd() const covMat_t& getCov() const;
GPUd() value_t getSigmaY2() const;
GPUd() value_t getSigmaZY() const;
Expand All @@ -77,7 +77,7 @@ class TrackParametrizationWithError : public TrackParametrization<value_T>
GPUd() value_t getCovarElem(int i, int j) const;
GPUd() value_t getDiagError2(int i) const;

GPUd() bool getCovXYZPxPyPzGlo(gpu::gpustd::array<value_t, kLabCovMatSize>& c) const;
GPUd() bool getCovXYZPxPyPzGlo(std::array<value_t, kLabCovMatSize>& c) const;

GPUd() void print() const;
GPUd() void printHexadecimal();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
#define INCLUDE_RECONSTRUCTIONDATAFORMATS_TRACKUTILS_H_

#include "GPUCommonRtypes.h"
#include "GPUCommonArray.h"

#ifndef GPUCA_GPUCODE_DEVICE
#include <array>
#include <cmath>
#endif

Expand All @@ -39,11 +39,11 @@ template <typename value_T = float>
GPUd() value_T BetheBlochSolidOpt(value_T bg);

template <typename value_T = float>
GPUd() void g3helx3(value_T qfield, value_T step, gpu::gpustd::array<value_T, 7>& vect);
GPUd() void g3helx3(value_T qfield, value_T step, std::array<value_T, 7>& vect);

//____________________________________________________
template <typename value_T>
GPUd() void g3helx3(value_T qfield, value_T step, gpu::gpustd::array<value_T, 7>& vect)
GPUd() void g3helx3(value_T qfield, value_T step, std::array<value_T, 7>& vect)
{
/******************************************************************
* *
Expand Down
Loading