Skip to content

Commit cd40d12

Browse files
authored
ITS: buildSeeds check only once of b=0 (#14370)
1 parent 893836d commit cd40d12

File tree

12 files changed

+182
-246
lines changed

12 files changed

+182
-246
lines changed

Detectors/ITSMFT/ITS/tracking/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ o2_add_library(ITStracking
1919
src/TimeFrame.cxx
2020
src/IOUtils.cxx
2121
src/Label.cxx
22-
src/Road.cxx
2322
src/Tracker.cxx
2423
src/TrackerTraits.cxx
2524
src/TrackingConfigParam.cxx

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

Lines changed: 37 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,27 @@
2323

2424
#include "GPUCommonDef.h"
2525

26-
namespace o2
27-
{
28-
namespace its
26+
namespace o2::its
2927
{
3028

3129
class Cell final
3230
{
3331
public:
34-
GPUhd() Cell();
35-
GPUd() Cell(const int, const int, const int, const int, const int);
32+
GPUhdDefault() Cell() = default;
33+
GPUhd() Cell(const int firstClusterIndex, const int secondClusterIndex, const int thirdClusterIndex,
34+
const int firstTrackletIndex, const int secondTrackletIndex)
35+
: mFirstClusterIndex(firstClusterIndex),
36+
mSecondClusterIndex(secondClusterIndex),
37+
mThirdClusterIndex(thirdClusterIndex),
38+
mFirstTrackletIndex(firstTrackletIndex),
39+
mSecondTrackletIndex(secondTrackletIndex),
40+
mLevel(1) {}
41+
GPUhdDefault() Cell(const Cell&) = default;
42+
GPUhdDefault() Cell(Cell&&) = default;
43+
GPUhdDefault() ~Cell() = default;
44+
45+
GPUhdDefault() Cell& operator=(const Cell&) = default;
46+
GPUhdDefault() Cell& operator=(Cell&&) noexcept = default;
3647

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

4657
private:
47-
const int mFirstClusterIndex;
48-
const int mSecondClusterIndex;
49-
const int mThirdClusterIndex;
50-
const int mFirstTrackletIndex;
51-
const int mSecondTrackletIndex;
52-
int mLevel;
58+
int mFirstClusterIndex{0};
59+
int mSecondClusterIndex{0};
60+
int mThirdClusterIndex{0};
61+
int mFirstTrackletIndex{0};
62+
int mSecondTrackletIndex{0};
63+
int mLevel{0};
5364
};
5465

55-
GPUhdi() Cell::Cell()
56-
: mFirstClusterIndex{0},
57-
mSecondClusterIndex{0},
58-
mThirdClusterIndex{0},
59-
mFirstTrackletIndex{0},
60-
mSecondTrackletIndex{0},
61-
mLevel{0}
62-
{
63-
// Nothing to do
64-
}
65-
66-
GPUdi() Cell::Cell(const int firstClusterIndex, const int secondClusterIndex, const int thirdClusterIndex,
67-
const int firstTrackletIndex, const int secondTrackletIndex)
68-
: mFirstClusterIndex{firstClusterIndex},
69-
mSecondClusterIndex{secondClusterIndex},
70-
mThirdClusterIndex{thirdClusterIndex},
71-
mFirstTrackletIndex{firstTrackletIndex},
72-
mSecondTrackletIndex{secondTrackletIndex},
73-
mLevel{1}
74-
{
75-
// Nothing to do
76-
}
77-
7866
class CellSeed final : public o2::track::TrackParCovF
7967
{
8068
public:
8169
GPUhdDefault() CellSeed() = default;
82-
GPUhdDefault() CellSeed(const CellSeed&) = default;
83-
GPUhdDefault() ~CellSeed() = default;
84-
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}
70+
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}
8571
{
8672
setUserField(innerL);
8773
mClusters[innerL + 0] = cl0;
@@ -90,6 +76,12 @@ class CellSeed final : public o2::track::TrackParCovF
9076
mTracklets[0] = trkl0;
9177
mTracklets[1] = trkl1;
9278
}
79+
GPUhdDefault() CellSeed(const CellSeed&) = default;
80+
GPUhdDefault() ~CellSeed() = default;
81+
// GPUhdDefault() CellSeed(CellSeed&&) = default; TODO cannot use this yet since TrackPar only has device
82+
GPUhdDefault() CellSeed& operator=(const CellSeed&) = default;
83+
GPUhdDefault() CellSeed& operator=(CellSeed&&) = default;
84+
9385
GPUhd() int getFirstClusterIndex() const { return mClusters[getUserField()]; };
9486
GPUhd() int getSecondClusterIndex() const { return mClusters[getUserField() + 1]; };
9587
GPUhd() int getThirdClusterIndex() const { return mClusters[getUserField() + 2]; };
@@ -104,20 +96,18 @@ class CellSeed final : public o2::track::TrackParCovF
10496
GPUhd() int* getLevelPtr() { return &mLevel; }
10597
GPUhd() int* getClusters() { return mClusters; }
10698
GPUhd() int getCluster(int i) const { return mClusters[i]; }
107-
GPUhdi() void printCell() const;
99+
GPUhd() void printCell() const
100+
{
101+
printf("trkl: %d, %d\t lvl: %d\t chi2: %f\n", mTracklets[0], mTracklets[1], mLevel, mChi2);
102+
}
108103

109104
private:
110-
int mClusters[7] = {-1, -1, -1, -1, -1, -1, -1};
111-
int mTracklets[2] = {-1, -1};
112-
int mLevel = 0;
113105
float mChi2 = 0.f;
106+
int mLevel = 0;
107+
int mTracklets[2] = {-1, -1};
108+
int mClusters[7] = {-1, -1, -1, -1, -1, -1, -1};
114109
};
115110

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

121-
} // namespace its
122-
} // namespace o2
123113
#endif /* TRACKINGITSU_INCLUDE_CACELL_H_ */

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

Lines changed: 52 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -17,71 +17,74 @@
1717
#define TRACKINGITSU_INCLUDE_CACLUSTER_H_
1818

1919
#include "GPUCommonRtypes.h"
20-
#include "ITStracking/Definitions.h"
21-
#include "ITStracking/MathUtils.h"
20+
#include "GPUCommonArray.h"
2221

23-
#ifndef GPUCA_GPUCODE_DEVICE
24-
#include <array>
25-
#endif
26-
27-
namespace o2
28-
{
29-
namespace its
22+
namespace o2::its
3023
{
3124

3225
class IndexTableUtils;
3326

3427
struct Cluster final {
35-
Cluster() = default;
36-
Cluster(const float x, const float y, const float z, const int idx);
37-
Cluster(const int, const IndexTableUtils& utils, const Cluster&);
38-
Cluster(const int, const float3&, const IndexTableUtils& utils, const Cluster&);
39-
void Init(const int, const float3&, const IndexTableUtils& utils, const Cluster&);
40-
bool operator==(const Cluster&) const;
28+
GPUhdDefault() Cluster() = default;
29+
GPUhd() Cluster(const float x, const float y, const float z, const int idx);
30+
GPUhd() Cluster(const int, const IndexTableUtils& utils, const Cluster&);
31+
GPUhd() Cluster(const int, const float3&, const IndexTableUtils& utils, const Cluster&);
32+
GPUhdDefault() Cluster(const Cluster&) = default;
33+
GPUhdDefault() Cluster(Cluster&&) noexcept = default;
34+
GPUhdDefault() ~Cluster() = default;
35+
36+
GPUhdDefault() Cluster& operator=(const Cluster&) = default;
37+
GPUhdDefault() Cluster& operator=(Cluster&&) noexcept = default;
38+
39+
// TODO
40+
/*GPUhdDefault() bool operator==(const Cluster&) const = default;*/
41+
GPUhd() bool operator==(const Cluster& other) const
42+
{
43+
return xCoordinate == other.xCoordinate &&
44+
yCoordinate == other.yCoordinate &&
45+
zCoordinate == other.zCoordinate &&
46+
phi == other.phi &&
47+
radius == other.radius &&
48+
clusterId == other.clusterId &&
49+
indexTableBinIndex == other.indexTableBinIndex;
50+
}
51+
4152
GPUhd() void print() const;
4253

43-
float xCoordinate; // = -999.f;
44-
float yCoordinate; // = -999.f;
45-
float zCoordinate; // = -999.f;
46-
float phi; // = -999.f;
47-
float radius; // = -999.f;
48-
int clusterId; // = -1;
49-
int indexTableBinIndex; // = -1;
54+
float xCoordinate{-999.f};
55+
float yCoordinate{-999.f};
56+
float zCoordinate{-999.f};
57+
float phi{-999.f};
58+
float radius{-999.f};
59+
int clusterId{-1};
60+
int indexTableBinIndex{-1};
5061

5162
ClassDefNV(Cluster, 1);
5263
};
5364

54-
GPUhdi() void Cluster::print() const
55-
{
56-
#if !defined(GPUCA_GPUCODE_DEVICE) || (!defined(__OPENCL__) && defined(GPUCA_GPU_DEBUG_PRINT))
57-
printf("Cluster: %f %f %f %f %f %d %d\n", xCoordinate, yCoordinate, zCoordinate, phi, radius, clusterId, indexTableBinIndex);
58-
#endif
59-
}
60-
61-
struct TrackingFrameInfo {
62-
TrackingFrameInfo() = default;
63-
TrackingFrameInfo(float x, float y, float z, float xTF, float alpha, std::array<float, 2>&& posTF, std::array<float, 3>&& covTF);
64-
65-
float xCoordinate;
66-
float yCoordinate;
67-
float zCoordinate;
68-
float xTrackingFrame;
69-
float alphaTrackingFrame;
65+
struct TrackingFrameInfo final {
66+
GPUhdDefault() TrackingFrameInfo() = default;
67+
GPUhd() TrackingFrameInfo(float x, float y, float z, float xTF, float alpha, std::array<float, 2>&& posTF, std::array<float, 3>&& covTF);
68+
GPUhdDefault() TrackingFrameInfo(const TrackingFrameInfo&) = default;
69+
GPUhdDefault() TrackingFrameInfo(TrackingFrameInfo&&) noexcept = default;
70+
GPUhdDefault() ~TrackingFrameInfo() = default;
71+
72+
GPUhdDefault() TrackingFrameInfo& operator=(const TrackingFrameInfo&) = default;
73+
GPUhdDefault() TrackingFrameInfo& operator=(TrackingFrameInfo&&) = default;
74+
75+
GPUhd() void print() const;
76+
77+
float xCoordinate{-999.f};
78+
float yCoordinate{-999.f};
79+
float zCoordinate{-999.f};
80+
float xTrackingFrame{-999.f};
81+
float alphaTrackingFrame{-999.f};
7082
std::array<float, 2> positionTrackingFrame = {-1., -1.};
7183
std::array<float, 3> covarianceTrackingFrame = {999., 999., 999.};
72-
GPUdi() void print() const
73-
{
74-
#if !defined(GPUCA_GPUCODE_DEVICE) || (!defined(__OPENCL__) && defined(GPUCA_GPU_DEBUG_PRINT))
75-
printf("x: %f y: %f z: %f xTF: %f alphaTF: %f posTF: %f %f covTF: %f %f %f\n",
76-
xCoordinate, yCoordinate, zCoordinate, xTrackingFrame, alphaTrackingFrame,
77-
positionTrackingFrame[0], positionTrackingFrame[1],
78-
covarianceTrackingFrame[0], covarianceTrackingFrame[1], covarianceTrackingFrame[2]);
79-
#endif
80-
}
8184

8285
ClassDefNV(TrackingFrameInfo, 1);
8386
};
84-
} // namespace its
85-
} // namespace o2
87+
88+
} // namespace o2::its
8689

8790
#endif /* TRACKINGITSU_INCLUDE_CACLUSTER_H_ */

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

Lines changed: 19 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -16,32 +16,31 @@
1616
#ifndef TRACKINGCA_INCLUDE_ROAD_H
1717
#define TRACKINGCA_INCLUDE_ROAD_H
1818

19-
#ifndef GPUCA_GPUCODE_DEVICE
20-
#include <array>
21-
#endif
22-
2319
#include "ITStracking/Constants.h"
2420
#include "GPUCommonDef.h"
2521

26-
namespace o2
27-
{
28-
namespace its
22+
namespace o2::its
2923
{
3024

3125
template <unsigned char maxRoadSize = 5>
3226
class Road final
3327
{
3428
public:
35-
GPUhd() Road() : mCellIds{}, mRoadSize{}, mIsFakeRoad{} { resetRoad(); }
29+
GPUhdDefault() Road() = default;
3630
GPUhd() Road(int cellLayer, int cellId) : Road() { addCell(cellLayer, cellId); }
3731

38-
GPUhd() int getRoadSize() const;
39-
int getLabel() const;
40-
void setLabel(const int);
41-
GPUhd() bool isFakeRoad() const;
42-
void setFakeRoad(const bool);
43-
GPUhd() int& operator[](const int&);
44-
GPUhd() int operator[](const int&) const;
32+
GPUhdDefault() Road(const Road&) = default;
33+
GPUhdDefault() Road(Road&&) noexcept = default;
34+
GPUhdDefault() ~Road() = default;
35+
36+
GPUhdDefault() Road& operator=(const Road&) = default;
37+
GPUhdDefault() Road& operator=(Road&&) noexcept = default;
38+
39+
GPUhdi() uint8_t getRoadSize() const { return mRoadSize; }
40+
GPUhdi() bool isFakeRoad() const { return mIsFakeRoad; }
41+
GPUhdi() void setFakeRoad(const bool fake) { mIsFakeRoad = fake; }
42+
GPUhdi() int& operator[](const int& i) { return mCellIds[i]; }
43+
GPUhdi() int operator[](const int& i) const { return mCellIds[i]; }
4544

4645
GPUhd() void resetRoad()
4746
{
@@ -61,42 +60,12 @@ class Road final
6160
}
6261

6362
private:
64-
int mCellIds[maxRoadSize];
63+
int mCellIds[maxRoadSize]{constants::its::UnusedIndex};
6564
// int mLabel;
66-
unsigned char mRoadSize;
67-
bool mIsFakeRoad;
65+
unsigned char mRoadSize{0};
66+
bool mIsFakeRoad{false};
6867
};
6968

70-
template <unsigned char maxRoadSize>
71-
GPUhdi() int Road<maxRoadSize>::getRoadSize() const
72-
{
73-
return mRoadSize;
74-
}
75-
76-
template <unsigned char maxRoadSize>
77-
GPUhdi() int& Road<maxRoadSize>::operator[](const int& i)
78-
{
79-
return mCellIds[i];
80-
}
69+
} // namespace o2::its
8170

82-
template <unsigned char maxRoadSize>
83-
GPUhdi() int Road<maxRoadSize>::operator[](const int& i) const
84-
{
85-
return mCellIds[i];
86-
}
87-
88-
template <unsigned char maxRoadSize>
89-
GPUhdi() bool Road<maxRoadSize>::isFakeRoad() const
90-
{
91-
return mIsFakeRoad;
92-
}
93-
94-
template <unsigned char maxRoadSize>
95-
inline void Road<maxRoadSize>::setFakeRoad(const bool isFakeRoad)
96-
{
97-
mIsFakeRoad = isFakeRoad;
98-
}
99-
} // namespace its
100-
} // namespace o2
101-
102-
#endif
71+
#endif

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,6 @@ class TrackerTraits
9090
virtual int getTFNumberOfTracklets() const { return mTimeFrame->getNumberOfTracklets(); }
9191
virtual int getTFNumberOfCells() const { return mTimeFrame->getNumberOfCells(); }
9292

93-
float mBz = 5.f;
94-
9593
private:
9694
track::TrackParCov buildTrackSeed(const Cluster& cluster1, const Cluster& cluster2, const TrackingFrameInfo& tf3);
9795
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);
@@ -106,6 +104,9 @@ class TrackerTraits
106104
o2::gpu::GPUChainITS* mChain = nullptr;
107105
TimeFrame<nLayers>* mTimeFrame;
108106
std::vector<TrackingParameters> mTrkParams;
107+
108+
float mBz{-999.f};
109+
bool mIsZeroField{false};
109110
};
110111

111112
template <int nLayers>

0 commit comments

Comments
 (0)