Skip to content

Commit 4dc97cd

Browse files
committed
Move core tracking functions to traits
1 parent 1615f22 commit 4dc97cd

5 files changed

Lines changed: 477 additions & 454 deletions

File tree

Detectors/ITSMFT/ITS/tracking/GPU/ITStrackingGPU/TimeFrameGPU.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class TimeFrameGPU : public TimeFrame
4949

5050
void checkBufferSizes();
5151
void initialise(const int iteration,
52-
const TrackingParameters& trkParam,
52+
const TrackingParameters& trkParam,
5353
const int maxLayers);
5454
/// Getters
5555
float getDeviceMemory();

Detectors/ITSMFT/ITS/tracking/include/ITStracking/Tracker.h

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,10 @@
2727
#include <sstream>
2828

2929
#include "ITStracking/Configuration.h"
30-
#include "DetectorsBase/MatLayerCylSet.h"
3130
#include "CommonConstants/MathConstants.h"
3231
#include "ITStracking/Definitions.h"
3332
#include "ITStracking/ROframe.h"
3433
#include "ITStracking/MathUtils.h"
35-
#include "DetectorsBase/Propagator.h"
3634
#include "ITStracking/TimeFrame.h"
3735
#include "ITStracking/Road.h"
3836

@@ -61,37 +59,26 @@ class Tracker
6159
~Tracker();
6260

6361
void adoptTimeFrame(TimeFrame& tf);
64-
void setBz(float bz);
65-
float getBz() const;
6662

6763
void clustersToTracks(
6864
std::function<void(std::string s)> = [](std::string s) { std::cout << s << std::endl; }, std::function<void(std::string s)> = [](std::string s) { std::cerr << s << std::endl; });
69-
void clustersToTracksGPU(std::function<void(std::string s)> = [](std::string s) { std::cout << s << std::endl; });
70-
void setSmoothing(bool v) { mApplySmoothing = v; }
71-
bool getSmoothing() const { return mApplySmoothing; }
72-
7365
std::vector<TrackITSExt>& getTracks();
7466

75-
void setCorrType(const o2::base::PropagatorImpl<float>::MatCorrType& type) { mCorrType = type; }
7667
void setParameters(const std::vector<TrackingParameters>&);
7768
void getGlobalConfiguration();
78-
bool isMatLUT() const { return o2::base::Propagator::Instance()->getMatLUT() && (mCorrType == o2::base::PropagatorImpl<float>::MatCorrType::USEMatCorrLUT); }
79-
// GPU-specific interfaces
80-
TimeFrame* getTimeFrameGPU();
81-
void loadToDevice();
69+
void setBz(float);
70+
void setCorrType(const o2::base::PropagatorImpl<float>::MatCorrType& type);
8271

8372
private:
84-
track::TrackParCov buildTrackSeed(const Cluster& cluster1, const Cluster& cluster2, const Cluster& cluster3,
85-
const TrackingFrameInfo& tf3, float resolution);
8673
void initialiseTimeFrame(int& iteration);
8774
void computeTracklets(int& iteration);
8875
void computeCells(int& iteration);
8976
void findCellsNeighbours(int& iteration);
9077
void findRoads(int& iteration);
91-
void findTracks();
78+
void findTracks(int& iteration);
9279
void extendTracks(int& iteration);
93-
bool fitTrack(TrackITSExt& track, int start, int end, int step, const float chi2cut = o2::constants::math::VeryBig, const float maxQoverPt = o2::constants::math::VeryBig);
94-
void traverseCellsTree(const int, const int);
80+
81+
// MC interaction
9582
void computeRoadsMClabels();
9683
void computeTracksMClabels();
9784
void rectifyClusterIndices();
@@ -103,10 +90,6 @@ class Tracker
10390
TimeFrame* mTimeFrame = nullptr; /// Observer pointer, not owned by this class
10491

10592
std::vector<TrackingParameters> mTrkParams;
106-
107-
bool mApplySmoothing = false;
108-
o2::base::PropagatorImpl<float>::MatCorrType mCorrType = o2::base::PropagatorImpl<float>::MatCorrType::USEMatCorrNONE;
109-
float mBz = 5.f;
11093
std::uint32_t mTimeFrameCounter = 0;
11194
o2::gpu::GPUChainITS* mRecoChain = nullptr;
11295

@@ -118,11 +101,6 @@ inline void Tracker::setParameters(const std::vector<TrackingParameters>& trkPar
118101
mTrkParams = trkPars;
119102
}
120103

121-
inline float Tracker::getBz() const
122-
{
123-
return mBz;
124-
}
125-
126104
inline void Tracker::initialiseTimeFrame(int& iteration)
127105
{
128106
mTimeFrame->initialise(iteration, mTrkParams[iteration]);

Detectors/ITSMFT/ITS/tracking/include/ITStracking/TrackerTraits.h

Lines changed: 35 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
#include <utility>
2727
#include <functional>
2828

29+
#include "DetectorsBase/Propagator.h"
30+
#include "DetectorsBase/MatLayerCylSet.h"
2931
#include "ITStracking/Configuration.h"
3032
#include "ITStracking/Definitions.h"
3133
#include "ITStracking/MathUtils.h"
@@ -50,29 +52,44 @@ class TrackerTraits
5052
{
5153
public:
5254
virtual ~TrackerTraits() = default;
55+
virtual void computeLayerTracklets(const int iteration);
56+
virtual void computeLayerCells(const int iteration);
57+
virtual void findCellsNeighbours(const int iteration);
58+
virtual void findRoads(const int iteration);
59+
virtual void findTracks(const int iteration);
60+
virtual void extendTracks(const int iteration);
61+
virtual void refitTracks(const int iteration, const std::vector<std::vector<TrackingFrameInfo>>&, std::vector<TrackITSExt>&);
62+
virtual bool trackFollowing(TrackITSExt* track, int rof, bool outward, const int iteration);
5363

64+
void UpdateTrackingParameters(const std::vector<TrackingParameters>& trkPars);
65+
TimeFrame* getTimeFrame() { return mTimeFrame; }
66+
void adoptTimeFrame(TimeFrame* tf) { mTimeFrame = tf; }
67+
void setBz(float bz);
68+
float getBz() const;
69+
void setCorrType(const o2::base::PropagatorImpl<float>::MatCorrType& type) { mCorrType = type; }
70+
bool isMatLUT() const;
71+
72+
// Others
5473
GPUhd() static constexpr int4 getEmptyBinsRect() { return int4{0, 0, 0, 0}; }
5574
const int4 getBinsRect(const Cluster&, int layer, float z1, float z2, float maxdeltaz, float maxdeltaphi);
5675
const int4 getBinsRect(int layer, float phi, float maxdeltaphi, float z, float maxdeltaz);
5776
const int4 getBinsRect(int layer, float phi, float maxdeltaphi, float z1, float z2, float maxdeltaz);
58-
5977
void SetRecoChain(o2::gpu::GPUChainITS* chain, FuncRunITSTrackFit_t&& funcRunITSTrackFit)
6078
{
6179
mChainRunITSTrackFit = funcRunITSTrackFit;
6280
mChain = chain;
6381
}
82+
void setSmoothing(bool v) { mApplySmoothing = v; }
83+
bool getSmoothing() const { return mApplySmoothing; }
6484

65-
virtual void computeLayerTracklets(const int iteration);
66-
virtual void computeLayerCells(const int iteration);
67-
virtual void refitTracks(const int iteration, const std::vector<std::vector<TrackingFrameInfo>>&, std::vector<TrackITSExt>&);
68-
virtual bool trackFollowing(TrackITSExt* track, int rof, bool outward, const int iteration);
69-
70-
void UpdateTrackingParameters(const std::vector<TrackingParameters>& trkPars);
71-
TimeFrame* getTimeFrame() { return mTimeFrame; }
72-
void adoptTimeFrame(TimeFrame* tf) { mTimeFrame = tf; }
85+
private:
86+
void traverseCellsTree(const int, const int);
87+
track::TrackParCov buildTrackSeed(const Cluster& cluster1, const Cluster& cluster2, const Cluster& cluster3, const TrackingFrameInfo& tf3, float resolution);
88+
bool fitTrack(TrackITSExt& track, int start, int end, int step, const float chi2cut = o2::constants::math::VeryBig, const float maxQoverPt = o2::constants::math::VeryBig);
7389

74-
// GPU-specific interfaces
75-
virtual void loadToDevice(){};
90+
bool mApplySmoothing = false;
91+
o2::base::PropagatorImpl<float>::MatCorrType mCorrType = o2::base::PropagatorImpl<float>::MatCorrType::USEMatCorrNONE;
92+
float mBz = 5.f;
7693

7794
protected:
7895
TimeFrame* mTimeFrame;
@@ -82,19 +99,22 @@ class TrackerTraits
8299
FuncRunITSTrackFit_t mChainRunITSTrackFit;
83100
};
84101

102+
inline float TrackerTraits::getBz() const
103+
{
104+
return mBz;
105+
}
106+
85107
inline void TrackerTraits::UpdateTrackingParameters(const std::vector<TrackingParameters>& trkPars)
86108
{
87109
mTrkParams = trkPars;
88110
}
89111

90-
inline const int4 TrackerTraits::getBinsRect(const int layerIndex, float phi, float maxdeltaphi,
91-
float z, float maxdeltaz)
112+
inline const int4 TrackerTraits::getBinsRect(const int layerIndex, float phi, float maxdeltaphi, float z, float maxdeltaz)
92113
{
93114
return getBinsRect(layerIndex, phi, maxdeltaphi, z, z, maxdeltaz);
94115
}
95116

96-
inline const int4 TrackerTraits::getBinsRect(const Cluster& currentCluster, int layerIndex,
97-
float z1, float z2, float maxdeltaz, float maxdeltaphi)
117+
inline const int4 TrackerTraits::getBinsRect(const Cluster& currentCluster, int layerIndex, float z1, float z2, float maxdeltaz, float maxdeltaphi)
98118
{
99119
return getBinsRect(layerIndex, currentCluster.phi, maxdeltaphi, z1, z2, maxdeltaz);
100120
}

0 commit comments

Comments
 (0)