Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
#ifndef ALICEO2_TRACK_LTINTEGRAL_H_
#define ALICEO2_TRACK_LTINTEGRAL_H_

#include <Rtypes.h>
#include "GPUCommonRtypes.h"
#include "GPUCommonDef.h"
#include "ReconstructionDataFormats/PID.h"
#include "ReconstructionDataFormats/Track.h"

Expand All @@ -27,17 +28,17 @@ namespace track
class TrackLTIntegral
{
public:
TrackLTIntegral() = default;
TrackLTIntegral(const TrackLTIntegral& stc) = default;
~TrackLTIntegral() = default;
GPUdDefault() TrackLTIntegral() = default;
GPUdDefault() TrackLTIntegral(const TrackLTIntegral& stc) = default;
GPUdDefault() ~TrackLTIntegral() = default;

static constexpr int getNTOFs() { return o2::track::PID::NIDs; }
GPUd() static constexpr int getNTOFs() { return o2::track::PID::NIDs; }

float getL() const { return mL; }
float getX2X0() const { return mX2X0; }
float getTOF(int id) const { return mT[id]; }
GPUd() float getL() const { return mL; }
GPUd() float getX2X0() const { return mX2X0; }
GPUd() float getTOF(int id) const { return mT[id]; }

void clear()
GPUd() void clear()
{
mL = 0.f;
mX2X0 = 0.f;
Expand All @@ -46,14 +47,14 @@ class TrackLTIntegral
}
}

void addStep(float dL, const TrackPar& track);
void addX2X0(float d) { mX2X0 += d; }
GPUd() void addStep(float dL, const TrackPar& track);
GPUd() void addX2X0(float d) { mX2X0 += d; }

void setL(float l) { mL = l; }
void setX2X0(float x) { mX2X0 = x; }
void setTOF(float t, int id) { mT[id] = t; }
GPUd() void setL(float l) { mL = l; }
GPUd() void setX2X0(float x) { mX2X0 = x; }
GPUd() void setTOF(float t, int id) { mT[id] = t; }

void print() const;
GPUd() void print() const;

private:
float mL = 0.; // length in cm
Expand Down
9 changes: 7 additions & 2 deletions DataFormats/Reconstruction/src/TrackLTIntegral.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,27 @@

#include "ReconstructionDataFormats/TrackLTIntegral.h"
#include "CommonConstants/PhysicsConstants.h"

#ifndef GPUCA_GPUCODE_DEVICE
#include <cmath>
#endif

using namespace o2::track;

//_____________________________________________________
void TrackLTIntegral::print() const
GPUd() void TrackLTIntegral::print() const
{
#ifndef GPUCA_GPUCODE_DEVICE
printf("L(cm): %6.2f, X2X0: %5.3f TOF(ps): ", getL(), getX2X0());
for (int i = 0; i < getNTOFs(); i++) {
printf(" %7.1f |", getTOF(i));
}
printf("\n");
#endif
}

//_____________________________________________________
void TrackLTIntegral::addStep(float dL, const TrackPar& track)
GPUd() void TrackLTIntegral::addStep(float dL, const TrackPar& track)
{
///< add step in cm to integrals
mL += dL;
Expand Down
87 changes: 48 additions & 39 deletions Detectors/Base/include/DetectorsBase/Propagator.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,18 @@
#ifndef ALICEO2_BASE_PROPAGATOR_
#define ALICEO2_BASE_PROPAGATOR_

#include <string>
#include "GPUCommonRtypes.h"
#include "GPUCommonArray.h"
#include "CommonConstants/PhysicsConstants.h"
#include "ReconstructionDataFormats/Track.h"
#include "ReconstructionDataFormats/DCA.h"
#include "ReconstructionDataFormats/TrackLTIntegral.h"
#include "DetectorsBase/MatLayerCylSet.h"

#ifndef GPUCA_GPUCODE
#include <string>
#endif

namespace o2
{
namespace parameters
Expand Down Expand Up @@ -50,70 +55,74 @@ class Propagator
USEMatCorrLUT
}; // flag to use LUT for material queries (user must provide a pointer

static Propagator* Instance()
{
static Propagator instance;
return &instance;
}

static constexpr float MAX_SIN_PHI = 0.85f;
static constexpr float MAX_STEP = 2.0f;

bool PropagateToXBxByBz(o2::track::TrackParCov& track, float x,
float maxSnp = MAX_SIN_PHI, float maxStep = MAX_STEP, MatCorrType matCorr = MatCorrType::USEMatCorrTGeo,
o2::track::TrackLTIntegral* tofInfo = nullptr, int signCorr = 0) const;
GPUd() bool PropagateToXBxByBz(o2::track::TrackParCov& track, float x,
float maxSnp = MAX_SIN_PHI, float maxStep = MAX_STEP, MatCorrType matCorr = MatCorrType::USEMatCorrTGeo,
o2::track::TrackLTIntegral* tofInfo = nullptr, int signCorr = 0) const;

bool PropagateToXBxByBz(o2::track::TrackPar& track, float x,
float maxSnp = MAX_SIN_PHI, float maxStep = MAX_STEP, MatCorrType matCorr = MatCorrType::USEMatCorrTGeo,
o2::track::TrackLTIntegral* tofInfo = nullptr, int signCorr = 0) const;
GPUd() bool PropagateToXBxByBz(o2::track::TrackPar& track, float x,
float maxSnp = MAX_SIN_PHI, float maxStep = MAX_STEP, MatCorrType matCorr = MatCorrType::USEMatCorrTGeo,
o2::track::TrackLTIntegral* tofInfo = nullptr, int signCorr = 0) const;

bool propagateToX(o2::track::TrackParCov& track, float x, float bZ,
float maxSnp = MAX_SIN_PHI, float maxStep = MAX_STEP, MatCorrType matCorr = MatCorrType::USEMatCorrTGeo,
o2::track::TrackLTIntegral* tofInfo = nullptr, int signCorr = 0) const;
GPUd() bool propagateToX(o2::track::TrackParCov& track, float x, float bZ,
float maxSnp = MAX_SIN_PHI, float maxStep = MAX_STEP, MatCorrType matCorr = MatCorrType::USEMatCorrTGeo,
o2::track::TrackLTIntegral* tofInfo = nullptr, int signCorr = 0) const;

bool propagateToX(o2::track::TrackPar& track, float x, float bZ,
float maxSnp = MAX_SIN_PHI, float maxStep = MAX_STEP, MatCorrType matCorr = MatCorrType::USEMatCorrTGeo,
o2::track::TrackLTIntegral* tofInfo = nullptr, int signCorr = 0) const;
GPUd() bool propagateToX(o2::track::TrackPar& track, float x, float bZ,
float maxSnp = MAX_SIN_PHI, float maxStep = MAX_STEP, MatCorrType matCorr = MatCorrType::USEMatCorrTGeo,
o2::track::TrackLTIntegral* tofInfo = nullptr, int signCorr = 0) const;

bool propagateToDCA(const o2::dataformats::VertexBase& vtx, o2::track::TrackParCov& track, float bZ,
float maxStep = MAX_STEP, MatCorrType matCorr = MatCorrType::USEMatCorrTGeo,
o2::dataformats::DCA* dcaInfo = nullptr, o2::track::TrackLTIntegral* tofInfo = nullptr,
int signCorr = 0, float maxD = 999.f) const;
GPUd() bool propagateToDCA(const o2::dataformats::VertexBase& vtx, o2::track::TrackParCov& track, float bZ,
float maxStep = MAX_STEP, MatCorrType matCorr = MatCorrType::USEMatCorrTGeo,
o2::dataformats::DCA* dcaInfo = nullptr, o2::track::TrackLTIntegral* tofInfo = nullptr,
int signCorr = 0, float maxD = 999.f) const;

bool propagateToDCABxByBz(const o2::dataformats::VertexBase& vtx, o2::track::TrackParCov& track,
float maxStep = MAX_STEP, MatCorrType matCorr = MatCorrType::USEMatCorrTGeo,
o2::dataformats::DCA* dcaInfo = nullptr, o2::track::TrackLTIntegral* tofInfo = nullptr,
int signCorr = 0, float maxD = 999.f) const;
GPUd() bool propagateToDCABxByBz(const o2::dataformats::VertexBase& vtx, o2::track::TrackParCov& track,
float maxStep = MAX_STEP, MatCorrType matCorr = MatCorrType::USEMatCorrTGeo,
o2::dataformats::DCA* dcaInfo = nullptr, o2::track::TrackLTIntegral* tofInfo = nullptr,
int signCorr = 0, float maxD = 999.f) const;

bool propagateToDCA(const o2::math_utils::Point3D<float>& vtx, o2::track::TrackPar& track, float bZ,
float maxStep = MAX_STEP, MatCorrType matCorr = MatCorrType::USEMatCorrTGeo,
std::array<float, 2>* dca = nullptr, o2::track::TrackLTIntegral* tofInfo = nullptr,
int signCorr = 0, float maxD = 999.f) const;
GPUd() bool propagateToDCA(const o2::math_utils::Point3D<float>& vtx, o2::track::TrackPar& track, float bZ,
float maxStep = MAX_STEP, MatCorrType matCorr = MatCorrType::USEMatCorrTGeo,
gpu::gpustd::array<float, 2>* dca = nullptr, o2::track::TrackLTIntegral* tofInfo = nullptr,
int signCorr = 0, float maxD = 999.f) const;

bool propagateToDCABxByBz(const o2::math_utils::Point3D<float>& vtx, o2::track::TrackPar& track,
float maxStep = MAX_STEP, MatCorrType matCorr = MatCorrType::USEMatCorrTGeo,
std::array<float, 2>* dca = nullptr, o2::track::TrackLTIntegral* tofInfo = nullptr,
int signCorr = 0, float maxD = 999.f) const;
GPUd() bool propagateToDCABxByBz(const o2::math_utils::Point3D<float>& vtx, o2::track::TrackPar& track,
float maxStep = MAX_STEP, MatCorrType matCorr = MatCorrType::USEMatCorrTGeo,
gpu::gpustd::array<float, 2>* dca = nullptr, o2::track::TrackLTIntegral* tofInfo = nullptr,
int signCorr = 0, float maxD = 999.f) const;

Propagator(Propagator const&) = delete;
Propagator(Propagator&&) = delete;
Propagator& operator=(Propagator const&) = delete;
Propagator& operator=(Propagator&&) = delete;

// Bz at the origin
float getNominalBz() const { return mBz; }
GPUd() float getNominalBz() const { return mBz; }

void setMatLUT(const o2::base::MatLayerCylSet* lut) { mMatLUT = lut; }
const o2::base::MatLayerCylSet* getMatLUT() const { return mMatLUT; }
GPUd() void setMatLUT(const o2::base::MatLayerCylSet* lut) { mMatLUT = lut; }
GPUd() const o2::base::MatLayerCylSet* getMatLUT() const { return mMatLUT; }

#ifndef GPUCA_GPUCODE
static Propagator* Instance()
{
static Propagator instance;
return &instance;
}

static int initFieldFromGRP(const o2::parameters::GRPObject* grp, bool verbose = false);
static int initFieldFromGRP(const std::string grpFileName, std::string grpName = "GRP", bool verbose = false);
#endif

private:
#ifndef GPUCA_GPUCODE
Propagator();
~Propagator() = default;
#endif

MatBudget getMatBudget(MatCorrType corrType, const o2::math_utils::Point3D<float>& p0, const o2::math_utils::Point3D<float>& p1) const;
GPUd() MatBudget getMatBudget(MatCorrType corrType, const o2::math_utils::Point3D<float>& p0, const o2::math_utils::Point3D<float>& p1) const;

const o2::field::MagFieldFast* mField = nullptr; ///< External fast field (barrel only for the moment)
float mBz = 0; // nominal field
Expand Down
58 changes: 29 additions & 29 deletions Detectors/Base/src/Propagator.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ int Propagator::initFieldFromGRP(const o2::parameters::GRPObject* grp, bool verb
#endif

//_______________________________________________________________________
bool Propagator::PropagateToXBxByBz(o2::track::TrackParCov& track, float xToGo, float maxSnp, float maxStep,
Propagator::MatCorrType matCorr, o2::track::TrackLTIntegral* tofInfo, int signCorr) const
GPUd() bool Propagator::PropagateToXBxByBz(o2::track::TrackParCov& track, float xToGo, float maxSnp, float maxStep,
Propagator::MatCorrType matCorr, o2::track::TrackLTIntegral* tofInfo, int signCorr) const
{
//----------------------------------------------------------------
//
Expand All @@ -117,15 +117,15 @@ bool Propagator::PropagateToXBxByBz(o2::track::TrackParCov& track, float xToGo,
signCorr = -dir; // sign of eloss correction is not imposed
}

std::array<float, 3> b;
gpu::gpustd::array<float, 3> b;
while (std::abs(dx) > Epsilon) {
auto step = std::min(std::abs(dx), maxStep);
if (dir < 0) {
step = -step;
}
auto x = track.getX() + step;
auto xyz0 = track.getXYZGlo();
mField->Field(xyz0, b.data());
mField->Field(xyz0, &b[0]);

if (!track.propagateTo(x, b)) {
return false;
Expand Down Expand Up @@ -155,8 +155,8 @@ bool Propagator::PropagateToXBxByBz(o2::track::TrackParCov& track, float xToGo,
}

//_______________________________________________________________________
bool Propagator::PropagateToXBxByBz(o2::track::TrackPar& track, float xToGo, float maxSnp, float maxStep,
Propagator::MatCorrType matCorr, o2::track::TrackLTIntegral* tofInfo, int signCorr) const
GPUd() bool Propagator::PropagateToXBxByBz(o2::track::TrackPar& track, float xToGo, float maxSnp, float maxStep,
Propagator::MatCorrType matCorr, o2::track::TrackLTIntegral* tofInfo, int signCorr) const
{
//----------------------------------------------------------------
//
Expand All @@ -176,15 +176,15 @@ bool Propagator::PropagateToXBxByBz(o2::track::TrackPar& track, float xToGo, flo
signCorr = -dir; // sign of eloss correction is not imposed
}

std::array<float, 3> b;
gpu::gpustd::array<float, 3> b;
while (std::abs(dx) > Epsilon) {
auto step = std::min(std::abs(dx), maxStep);
if (dir < 0) {
step = -step;
}
auto x = track.getX() + step;
auto xyz0 = track.getXYZGlo();
mField->Field(xyz0, b.data());
mField->Field(xyz0, &b[0]);

if (!track.propagateParamTo(x, b)) {
return false;
Expand Down Expand Up @@ -213,8 +213,8 @@ bool Propagator::PropagateToXBxByBz(o2::track::TrackPar& track, float xToGo, flo
}

//_______________________________________________________________________
bool Propagator::propagateToX(o2::track::TrackParCov& track, float xToGo, float bZ, float maxSnp, float maxStep,
Propagator::MatCorrType matCorr, o2::track::TrackLTIntegral* tofInfo, int signCorr) const
GPUd() bool Propagator::propagateToX(o2::track::TrackParCov& track, float xToGo, float bZ, float maxSnp, float maxStep,
Propagator::MatCorrType matCorr, o2::track::TrackLTIntegral* tofInfo, int signCorr) const
{
//----------------------------------------------------------------
//
Expand Down Expand Up @@ -271,8 +271,8 @@ bool Propagator::propagateToX(o2::track::TrackParCov& track, float xToGo, float
}

//_______________________________________________________________________
bool Propagator::propagateToX(o2::track::TrackPar& track, float xToGo, float bZ, float maxSnp, float maxStep,
Propagator::MatCorrType matCorr, o2::track::TrackLTIntegral* tofInfo, int signCorr) const
GPUd() bool Propagator::propagateToX(o2::track::TrackPar& track, float xToGo, float bZ, float maxSnp, float maxStep,
Propagator::MatCorrType matCorr, o2::track::TrackLTIntegral* tofInfo, int signCorr) const
{
//----------------------------------------------------------------
//
Expand Down Expand Up @@ -329,10 +329,10 @@ bool Propagator::propagateToX(o2::track::TrackPar& track, float xToGo, float bZ,
}

//_______________________________________________________________________
bool Propagator::propagateToDCA(const o2::dataformats::VertexBase& vtx, o2::track::TrackParCov& track, float bZ,
float maxStep, Propagator::MatCorrType matCorr,
o2::dataformats::DCA* dca, o2::track::TrackLTIntegral* tofInfo,
int signCorr, float maxD) const
GPUd() bool Propagator::propagateToDCA(const o2::dataformats::VertexBase& vtx, o2::track::TrackParCov& track, float bZ,
float maxStep, Propagator::MatCorrType matCorr,
o2::dataformats::DCA* dca, o2::track::TrackLTIntegral* tofInfo,
int signCorr, float maxD) const
{
// propagate track to DCA to the vertex
float sn, cs, alp = track.getAlpha();
Expand Down Expand Up @@ -374,10 +374,10 @@ bool Propagator::propagateToDCA(const o2::dataformats::VertexBase& vtx, o2::trac
}

//_______________________________________________________________________
bool Propagator::propagateToDCABxByBz(const o2::dataformats::VertexBase& vtx, o2::track::TrackParCov& track,
float maxStep, Propagator::MatCorrType matCorr,
o2::dataformats::DCA* dca, o2::track::TrackLTIntegral* tofInfo,
int signCorr, float maxD) const
GPUd() bool Propagator::propagateToDCABxByBz(const o2::dataformats::VertexBase& vtx, o2::track::TrackParCov& track,
float maxStep, Propagator::MatCorrType matCorr,
o2::dataformats::DCA* dca, o2::track::TrackLTIntegral* tofInfo,
int signCorr, float maxD) const
{
// propagate track to DCA to the vertex
float sn, cs, alp = track.getAlpha();
Expand Down Expand Up @@ -419,10 +419,10 @@ bool Propagator::propagateToDCABxByBz(const o2::dataformats::VertexBase& vtx, o2
}

//_______________________________________________________________________
bool Propagator::propagateToDCA(const math_utils::Point3D<float>& vtx, o2::track::TrackPar& track, float bZ,
float maxStep, Propagator::MatCorrType matCorr,
std::array<float, 2>* dca, o2::track::TrackLTIntegral* tofInfo,
int signCorr, float maxD) const
GPUd() bool Propagator::propagateToDCA(const math_utils::Point3D<float>& vtx, o2::track::TrackPar& track, float bZ,
float maxStep, Propagator::MatCorrType matCorr,
gpu::gpustd::array<float, 2>* dca, o2::track::TrackLTIntegral* tofInfo,
int signCorr, float maxD) const
{
// propagate track to DCA to the vertex
float sn, cs, alp = track.getAlpha();
Expand Down Expand Up @@ -463,10 +463,10 @@ bool Propagator::propagateToDCA(const math_utils::Point3D<float>& vtx, o2::track
}

//_______________________________________________________________________
bool Propagator::propagateToDCABxByBz(const math_utils::Point3D<float>& vtx, o2::track::TrackPar& track,
float maxStep, Propagator::MatCorrType matCorr,
std::array<float, 2>* dca, o2::track::TrackLTIntegral* tofInfo,
int signCorr, float maxD) const
GPUd() bool Propagator::propagateToDCABxByBz(const math_utils::Point3D<float>& vtx, o2::track::TrackPar& track,
float maxStep, Propagator::MatCorrType matCorr,
gpu::gpustd::array<float, 2>* dca, o2::track::TrackLTIntegral* tofInfo,
int signCorr, float maxD) const
{
// propagate track to DCA to the vertex
float sn, cs, alp = track.getAlpha();
Expand Down Expand Up @@ -507,7 +507,7 @@ bool Propagator::propagateToDCABxByBz(const math_utils::Point3D<float>& vtx, o2:
}

//____________________________________________________________
MatBudget Propagator::getMatBudget(Propagator::MatCorrType corrType, const math_utils::Point3D<float>& p0, const math_utils::Point3D<float>& p1) const
GPUd() MatBudget Propagator::getMatBudget(Propagator::MatCorrType corrType, const math_utils::Point3D<float>& p0, const math_utils::Point3D<float>& p1) const
{
#ifndef GPUCA_STANDALONE
if (corrType == MatCorrType::USEMatCorrTGeo) {
Expand Down