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
1 change: 0 additions & 1 deletion Detectors/ITSMFT/ITS/tracking/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ o2_add_library(ITStracking
src/TimeFrame.cxx
src/IOUtils.cxx
src/Label.cxx
src/Road.cxx
src/Tracker.cxx
src/TrackerTraits.cxx
src/TrackingConfigParam.cxx
Expand Down
84 changes: 37 additions & 47 deletions Detectors/ITSMFT/ITS/tracking/include/ITStracking/Cell.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,27 @@

#include "GPUCommonDef.h"

namespace o2
{
namespace its
namespace o2::its
{

class Cell final
{
public:
GPUhd() Cell();
GPUd() Cell(const int, const int, const int, const int, const int);
GPUhdDefault() Cell() = default;
GPUhd() Cell(const int firstClusterIndex, const int secondClusterIndex, const int thirdClusterIndex,
const int firstTrackletIndex, const int secondTrackletIndex)
: mFirstClusterIndex(firstClusterIndex),
mSecondClusterIndex(secondClusterIndex),
mThirdClusterIndex(thirdClusterIndex),
mFirstTrackletIndex(firstTrackletIndex),
mSecondTrackletIndex(secondTrackletIndex),
mLevel(1) {}
GPUhdDefault() Cell(const Cell&) = default;
GPUhdDefault() Cell(Cell&&) = default;
GPUhdDefault() ~Cell() = default;

GPUhdDefault() Cell& operator=(const Cell&) = default;
GPUhdDefault() Cell& operator=(Cell&&) noexcept = default;

GPUhd() int getFirstClusterIndex() const { return mFirstClusterIndex; };
GPUhd() int getSecondClusterIndex() const { return mSecondClusterIndex; };
Expand All @@ -44,44 +55,19 @@ class Cell final
GPUhd() int* getLevelPtr() { return &mLevel; }

private:
const int mFirstClusterIndex;
const int mSecondClusterIndex;
const int mThirdClusterIndex;
const int mFirstTrackletIndex;
const int mSecondTrackletIndex;
int mLevel;
int mFirstClusterIndex{0};
int mSecondClusterIndex{0};
int mThirdClusterIndex{0};
int mFirstTrackletIndex{0};
int mSecondTrackletIndex{0};
int mLevel{0};
};

GPUhdi() Cell::Cell()
: mFirstClusterIndex{0},
mSecondClusterIndex{0},
mThirdClusterIndex{0},
mFirstTrackletIndex{0},
mSecondTrackletIndex{0},
mLevel{0}
{
// Nothing to do
}

GPUdi() Cell::Cell(const int firstClusterIndex, const int secondClusterIndex, const int thirdClusterIndex,
const int firstTrackletIndex, const int secondTrackletIndex)
: mFirstClusterIndex{firstClusterIndex},
mSecondClusterIndex{secondClusterIndex},
mThirdClusterIndex{thirdClusterIndex},
mFirstTrackletIndex{firstTrackletIndex},
mSecondTrackletIndex{secondTrackletIndex},
mLevel{1}
{
// Nothing to do
}

class CellSeed final : public o2::track::TrackParCovF
{
public:
GPUhdDefault() CellSeed() = default;
GPUhdDefault() CellSeed(const CellSeed&) = default;
GPUhdDefault() ~CellSeed() = default;
GPUd() CellSeed(int innerL, int cl0, int cl1, int cl2, int trkl0, int trkl1, o2::track::TrackParCovF& tpc, float chi2) : o2::track::TrackParCovF{tpc}, mLevel{1}, mChi2{chi2}
GPUhd() CellSeed(int innerL, int cl0, int cl1, int cl2, int trkl0, int trkl1, o2::track::TrackParCovF& tpc, float chi2) : o2::track::TrackParCovF{tpc}, mLevel{1}, mChi2{chi2}
{
setUserField(innerL);
mClusters[innerL + 0] = cl0;
Expand All @@ -90,6 +76,12 @@ class CellSeed final : public o2::track::TrackParCovF
mTracklets[0] = trkl0;
mTracklets[1] = trkl1;
}
GPUhdDefault() CellSeed(const CellSeed&) = default;
GPUhdDefault() ~CellSeed() = default;
// GPUhdDefault() CellSeed(CellSeed&&) = default; TODO cannot use this yet since TrackPar only has device
GPUhdDefault() CellSeed& operator=(const CellSeed&) = default;
GPUhdDefault() CellSeed& operator=(CellSeed&&) = default;

GPUhd() int getFirstClusterIndex() const { return mClusters[getUserField()]; };
GPUhd() int getSecondClusterIndex() const { return mClusters[getUserField() + 1]; };
GPUhd() int getThirdClusterIndex() const { return mClusters[getUserField() + 2]; };
Expand All @@ -104,20 +96,18 @@ class CellSeed final : public o2::track::TrackParCovF
GPUhd() int* getLevelPtr() { return &mLevel; }
GPUhd() int* getClusters() { return mClusters; }
GPUhd() int getCluster(int i) const { return mClusters[i]; }
GPUhdi() void printCell() const;
GPUhd() void printCell() const
{
printf("trkl: %d, %d\t lvl: %d\t chi2: %f\n", mTracklets[0], mTracklets[1], mLevel, mChi2);
}

private:
int mClusters[7] = {-1, -1, -1, -1, -1, -1, -1};
int mTracklets[2] = {-1, -1};
int mLevel = 0;
float mChi2 = 0.f;
int mLevel = 0;
int mTracklets[2] = {-1, -1};
int mClusters[7] = {-1, -1, -1, -1, -1, -1, -1};
};

GPUhdi() void CellSeed::printCell() const
{
printf("trkl: %d, %d\t lvl: %d\t chi2: %f\n", mTracklets[0], mTracklets[1], mLevel, mChi2);
}
} // namespace o2::its

} // namespace its
} // namespace o2
#endif /* TRACKINGITSU_INCLUDE_CACELL_H_ */
101 changes: 52 additions & 49 deletions Detectors/ITSMFT/ITS/tracking/include/ITStracking/Cluster.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,71 +17,74 @@
#define TRACKINGITSU_INCLUDE_CACLUSTER_H_

#include "GPUCommonRtypes.h"
#include "ITStracking/Definitions.h"
#include "ITStracking/MathUtils.h"
#include "GPUCommonArray.h"

#ifndef GPUCA_GPUCODE_DEVICE
#include <array>
#endif

namespace o2
{
namespace its
namespace o2::its
{

class IndexTableUtils;

struct Cluster final {
Cluster() = default;
Cluster(const float x, const float y, const float z, const int idx);
Cluster(const int, const IndexTableUtils& utils, const Cluster&);
Cluster(const int, const float3&, const IndexTableUtils& utils, const Cluster&);
void Init(const int, const float3&, const IndexTableUtils& utils, const Cluster&);
bool operator==(const Cluster&) const;
GPUhdDefault() Cluster() = default;
GPUhd() Cluster(const float x, const float y, const float z, const int idx);
GPUhd() Cluster(const int, const IndexTableUtils& utils, const Cluster&);
GPUhd() Cluster(const int, const float3&, const IndexTableUtils& utils, const Cluster&);
GPUhdDefault() Cluster(const Cluster&) = default;
GPUhdDefault() Cluster(Cluster&&) noexcept = default;
GPUhdDefault() ~Cluster() = default;

GPUhdDefault() Cluster& operator=(const Cluster&) = default;
GPUhdDefault() Cluster& operator=(Cluster&&) noexcept = default;

// TODO
/*GPUhdDefault() bool operator==(const Cluster&) const = default;*/
GPUhd() bool operator==(const Cluster& other) const
{
return xCoordinate == other.xCoordinate &&
yCoordinate == other.yCoordinate &&
zCoordinate == other.zCoordinate &&
phi == other.phi &&
radius == other.radius &&
clusterId == other.clusterId &&
indexTableBinIndex == other.indexTableBinIndex;
}

GPUhd() void print() const;

float xCoordinate; // = -999.f;
float yCoordinate; // = -999.f;
float zCoordinate; // = -999.f;
float phi; // = -999.f;
float radius; // = -999.f;
int clusterId; // = -1;
int indexTableBinIndex; // = -1;
float xCoordinate{-999.f};
float yCoordinate{-999.f};
float zCoordinate{-999.f};
float phi{-999.f};
float radius{-999.f};
int clusterId{-1};
int indexTableBinIndex{-1};

ClassDefNV(Cluster, 1);
};

GPUhdi() void Cluster::print() const
{
#if !defined(GPUCA_GPUCODE_DEVICE) || (!defined(__OPENCL__) && defined(GPUCA_GPU_DEBUG_PRINT))
printf("Cluster: %f %f %f %f %f %d %d\n", xCoordinate, yCoordinate, zCoordinate, phi, radius, clusterId, indexTableBinIndex);
#endif
}

struct TrackingFrameInfo {
TrackingFrameInfo() = default;
TrackingFrameInfo(float x, float y, float z, float xTF, float alpha, std::array<float, 2>&& posTF, std::array<float, 3>&& covTF);

float xCoordinate;
float yCoordinate;
float zCoordinate;
float xTrackingFrame;
float alphaTrackingFrame;
struct TrackingFrameInfo final {
GPUhdDefault() TrackingFrameInfo() = default;
GPUhd() TrackingFrameInfo(float x, float y, float z, float xTF, float alpha, std::array<float, 2>&& posTF, std::array<float, 3>&& covTF);
GPUhdDefault() TrackingFrameInfo(const TrackingFrameInfo&) = default;
GPUhdDefault() TrackingFrameInfo(TrackingFrameInfo&&) noexcept = default;
GPUhdDefault() ~TrackingFrameInfo() = default;

GPUhdDefault() TrackingFrameInfo& operator=(const TrackingFrameInfo&) = default;
GPUhdDefault() TrackingFrameInfo& operator=(TrackingFrameInfo&&) = default;

GPUhd() void print() const;

float xCoordinate{-999.f};
float yCoordinate{-999.f};
float zCoordinate{-999.f};
float xTrackingFrame{-999.f};
float alphaTrackingFrame{-999.f};
std::array<float, 2> positionTrackingFrame = {-1., -1.};
std::array<float, 3> covarianceTrackingFrame = {999., 999., 999.};
GPUdi() void print() const
{
#if !defined(GPUCA_GPUCODE_DEVICE) || (!defined(__OPENCL__) && defined(GPUCA_GPU_DEBUG_PRINT))
printf("x: %f y: %f z: %f xTF: %f alphaTF: %f posTF: %f %f covTF: %f %f %f\n",
xCoordinate, yCoordinate, zCoordinate, xTrackingFrame, alphaTrackingFrame,
positionTrackingFrame[0], positionTrackingFrame[1],
covarianceTrackingFrame[0], covarianceTrackingFrame[1], covarianceTrackingFrame[2]);
#endif
}

ClassDefNV(TrackingFrameInfo, 1);
};
} // namespace its
} // namespace o2

} // namespace o2::its

#endif /* TRACKINGITSU_INCLUDE_CACLUSTER_H_ */
69 changes: 19 additions & 50 deletions Detectors/ITSMFT/ITS/tracking/include/ITStracking/Road.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,32 +16,31 @@
#ifndef TRACKINGCA_INCLUDE_ROAD_H
#define TRACKINGCA_INCLUDE_ROAD_H

#ifndef GPUCA_GPUCODE_DEVICE
#include <array>
#endif

#include "ITStracking/Constants.h"
#include "GPUCommonDef.h"

namespace o2
{
namespace its
namespace o2::its
{

template <unsigned char maxRoadSize = 5>
class Road final
{
public:
GPUhd() Road() : mCellIds{}, mRoadSize{}, mIsFakeRoad{} { resetRoad(); }
GPUhdDefault() Road() = default;
GPUhd() Road(int cellLayer, int cellId) : Road() { addCell(cellLayer, cellId); }

GPUhd() int getRoadSize() const;
int getLabel() const;
void setLabel(const int);
GPUhd() bool isFakeRoad() const;
void setFakeRoad(const bool);
GPUhd() int& operator[](const int&);
GPUhd() int operator[](const int&) const;
GPUhdDefault() Road(const Road&) = default;
GPUhdDefault() Road(Road&&) noexcept = default;
GPUhdDefault() ~Road() = default;

GPUhdDefault() Road& operator=(const Road&) = default;
GPUhdDefault() Road& operator=(Road&&) noexcept = default;

GPUhdi() uint8_t getRoadSize() const { return mRoadSize; }
GPUhdi() bool isFakeRoad() const { return mIsFakeRoad; }
GPUhdi() void setFakeRoad(const bool fake) { mIsFakeRoad = fake; }
GPUhdi() int& operator[](const int& i) { return mCellIds[i]; }
GPUhdi() int operator[](const int& i) const { return mCellIds[i]; }

GPUhd() void resetRoad()
{
Expand All @@ -61,42 +60,12 @@ class Road final
}

private:
int mCellIds[maxRoadSize];
int mCellIds[maxRoadSize]{constants::its::UnusedIndex};
// int mLabel;
unsigned char mRoadSize;
bool mIsFakeRoad;
unsigned char mRoadSize{0};
bool mIsFakeRoad{false};
};

template <unsigned char maxRoadSize>
GPUhdi() int Road<maxRoadSize>::getRoadSize() const
{
return mRoadSize;
}

template <unsigned char maxRoadSize>
GPUhdi() int& Road<maxRoadSize>::operator[](const int& i)
{
return mCellIds[i];
}
} // namespace o2::its

template <unsigned char maxRoadSize>
GPUhdi() int Road<maxRoadSize>::operator[](const int& i) const
{
return mCellIds[i];
}

template <unsigned char maxRoadSize>
GPUhdi() bool Road<maxRoadSize>::isFakeRoad() const
{
return mIsFakeRoad;
}

template <unsigned char maxRoadSize>
inline void Road<maxRoadSize>::setFakeRoad(const bool isFakeRoad)
{
mIsFakeRoad = isFakeRoad;
}
} // namespace its
} // namespace o2

#endif
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,6 @@ class TrackerTraits
virtual int getTFNumberOfTracklets() const { return mTimeFrame->getNumberOfTracklets(); }
virtual int getTFNumberOfCells() const { return mTimeFrame->getNumberOfCells(); }

float mBz = 5.f;

private:
track::TrackParCov buildTrackSeed(const Cluster& cluster1, const Cluster& cluster2, const TrackingFrameInfo& tf3);
bool fitTrack(TrackITSExt& track, int start, int end, int step, float chi2clcut = o2::constants::math::VeryBig, float chi2ndfcut = o2::constants::math::VeryBig, float maxQoverPt = o2::constants::math::VeryBig, int nCl = 0);
Expand All @@ -106,6 +104,9 @@ class TrackerTraits
o2::gpu::GPUChainITS* mChain = nullptr;
TimeFrame<nLayers>* mTimeFrame;
std::vector<TrackingParameters> mTrkParams;

float mBz{-999.f};
bool mIsZeroField{false};
};

template <int nLayers>
Expand Down
Loading