Skip to content

Commit a741e75

Browse files
authored
Merge 9be6fb1 into sapling-pr-archive-ktf
2 parents ba4d89f + 9be6fb1 commit a741e75

62 files changed

Lines changed: 2026 additions & 1162 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Common/Constants/include/CommonConstants/PhysicsConstants.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,9 @@ enum Pdg {
9292
kHyperHelium4 = 1010020040,
9393
kHyperHelium5 = 1010020050,
9494
kHyperHelium4Sigma = 1110020040,
95-
kLambda1520_Py = 102134
95+
kLambda1520_Py = 102134,
96+
kK1_1270_0 = 10313,
97+
kK1_1270Plus = 10323
9698
};
9799

98100
/// \brief Declarations of masses for additional particles
@@ -158,6 +160,8 @@ constexpr double MassHyperHelium4 = 3.921728;
158160
constexpr double MassHyperHelium5 = 4.839961;
159161
constexpr double MassHyperHelium4Sigma = 3.995;
160162
constexpr double MassLambda1520_Py = 1.5195;
163+
constexpr double MassK1_1270_0 = 1.253;
164+
constexpr double MassK1_1270Plus = 1.272;
161165

162166
/// \brief Declarations of masses for particles in ROOT PDG_t
163167
constexpr double MassDown = 0.00467;

Common/Constants/include/CommonConstants/make_pdg_header.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,8 @@ class Pdg(Enum):
151151
kHyperHelium5 = 1010020050
152152
kHyperHelium4Sigma = 1110020040
153153
kLambda1520_Py = 102134 # PYTHIA code different from PDG
154+
kK1_1270_0 = 10313
155+
kK1_1270Plus = 10323
154156

155157

156158
dbPdg = o2.O2DatabasePDG

Detectors/GlobalTracking/src/MatchTPCITS.cxx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -880,9 +880,13 @@ void MatchTPCITS::doMatching(int sec)
880880
int idxMinTPC = timeStartTPC[minROFITS]; // index of 1st cached TPC track within cached ITS ROFrames
881881
auto t2nbs = tpcTimeBin2MUS(mZ2TPCBin * mParams->tpcTimeICMatchingNSigma);
882882
bool checkInteractionCandidates = mUseFT0 && mParams->validateMatchByFIT != MatchTPCITSParams::Disable;
883+
LOGP(alarm, "doMatching sec={} nTPC={} nITS={} idxMinTPC={} mTPCWork.size={} mITSWork.size={}", sec, nTracksTPC, nTracksITS, idxMinTPC, mTPCWork.size(), mITSWork.size());
883884

884885
int itsROBin = 0;
885886
for (int itpc = idxMinTPC; itpc < nTracksTPC; itpc++) {
887+
if (cacheTPC[itpc] >= (int)mTPCWork.size()) {
888+
LOGP(alarm, "OOB TPC: itpc={} cacheTPC[itpc]={} mTPCWork.size={}", itpc, cacheTPC[itpc], mTPCWork.size());
889+
}
886890
auto& trefTPC = mTPCWork[cacheTPC[itpc]];
887891
// estimate ITS 1st ROframe bin this track may match to: TPC track are sorted according to their
888892
// timeMax, hence the timeMax - MaxmNTPCBinsFullDrift are non-decreasing
@@ -895,6 +899,9 @@ void MatchTPCITS::doMatching(int sec)
895899
int iits0 = timeStartITS[itsROBin];
896900
nCheckTPCControl++;
897901
for (auto iits = iits0; iits < nTracksITS; iits++) {
902+
if (cacheITS[iits] >= (int)mITSWork.size()) {
903+
LOGP(alarm, "OOB ITS: iits={} cacheITS[iits]={} mITSWork.size={}", iits, cacheITS[iits], mITSWork.size());
904+
}
898905
auto& trefITS = mITSWork[cacheITS[iits]];
899906
// compare if the ITS and TPC tracks may overlap in time
900907
LOG(debug) << "TPC bracket: " << trefTPC.tBracket.asString() << " ITS bracket: " << trefITS.tBracket.asString() << " TPCtgl: " << trefTPC.getTgl() << " ITStgl: " << trefITS.getTgl();
@@ -934,6 +941,9 @@ void MatchTPCITS::doMatching(int sec)
934941
}
935942

936943
nCheckITSControl++;
944+
if (nCheckITSControl <= 3) {
945+
LOGP(alarm, "doMatching sec={} itpc={} iits={} nCheckITS={}", sec, itpc, iits, nCheckITSControl);
946+
}
937947
float chi2 = -1;
938948
int rejFlag = compareTPCITSTracks(trefITS, trefTPC, chi2);
939949

@@ -1006,6 +1016,7 @@ void MatchTPCITS::doMatching(int sec)
10061016
<< " N TPC tracks checked: " << nCheckTPCControl << " (starting from " << idxMinTPC
10071017
<< "), checks: " << nCheckITSControl << ", matches:" << nMatchesControl;
10081018
}
1019+
LOGP(alarm, "doMatching sec={} done: nCheckTPC={} nCheckITS={} nMatches={}", sec, nCheckTPCControl, nCheckITSControl, nMatchesControl);
10091020
mNMatchesControl += nMatchesControl;
10101021
}
10111022

Detectors/ITSMFT/ITS/macros/test/CheckStaggering.C

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ void CheckStaggering(int runNumber, int max = -1, const std::string& dir = "")
8080
auto& ccdbmgr = o2::ccdb::BasicCCDBManager::instance();
8181
ccdbmgr.setURL("https://alice-ccdb.cern.ch");
8282
auto runDuration = ccdbmgr.getRunDuration(runNumber);
83-
auto tRun = runDuration.first + (runDuration.second - runDuration.first) / 2; // time stamp for the middle of the run duration
83+
auto tRun = runDuration.first + ((runDuration.second - runDuration.first) / 2); // time stamp for the middle of the run duration
8484
ccdbmgr.setTimestamp(tRun);
85-
printf("Run %d has TS %lld", runNumber, tRun);
85+
printf("Run %d has TS %ld", runNumber, tRun);
8686
auto geoAligned = ccdbmgr.get<TGeoManager>("GLO/Config/GeometryAligned");
8787
auto magField = ccdbmgr.get<o2::parameters::GRPMagField>("GLO/Config/GRPMagField");
8888
auto grpLHC = ccdbmgr.get<o2::parameters::GRPLHCIFData>("GLO/Config/GRPLHCIF");
@@ -134,7 +134,7 @@ void CheckStaggering(int runNumber, int max = -1, const std::string& dir = "")
134134
auto hVtxZ = new TH1F("hVtxZ", "seeding vertices Z", 200, -16, 16);
135135
auto hVtxNCont = new TH1F("hVtxNCont", "seeding vertices contributors", 100, 0, 100);
136136
auto hVtxZNCont = new TProfile("hVtxZNCont", "seeding vertices z-contributors", 200, -16, 16);
137-
auto hVtxCls = new TProfile("hVtxCls", ";Cls/TF;Cls/Vtx", 400, 20000, 60000);
137+
auto hVtxCls = new TProfile("hVtxCls", ";Cls/TF;Cls/Vtx", 2000, 600000, 900000);
138138
auto hVtxTS = new TH1D("hVtxTS", "vtx time t0;t0 (BC)", o2::constants::lhc::LHCMaxBunches, 0, o2::constants::lhc::LHCMaxBunches);
139139

140140
const float minVtxWeight{5};
@@ -183,8 +183,12 @@ void CheckStaggering(int runNumber, int max = -1, const std::string& dir = "")
183183

184184
tTrks->SetBranchAddress("ITSTrack", &trkArrPtr);
185185
tTrks->SetBranchAddress("Vertices", &vtxArrPtr);
186-
for (int i{0}; i < 7; ++i) {
187-
tCls->SetBranchAddress(Form("ITSClusterComp_%d", i), &clsArr[i]);
186+
if (tCls->GetBranchStatus("ITSClusterComp")) {
187+
tCls->SetBranchAddress("ITSClusterComp", &clsArr[0]);
188+
} else {
189+
for (int i{0}; i < 7; ++i) {
190+
tCls->SetBranchAddress(Form("ITSClusterComp_%d", i), &clsArr[i]);
191+
}
188192
}
189193

190194
for (int iTF{0}; tTrks->LoadTree(iTF) >= 0; ++iTF) {
@@ -193,7 +197,9 @@ void CheckStaggering(int runNumber, int max = -1, const std::string& dir = "")
193197

194198
size_t ncls = 0;
195199
for (int i{0}; i < 7; ++i) {
196-
ncls += clsArr[i]->size();
200+
if (clsArr[i]) {
201+
ncls += clsArr[i]->size();
202+
}
197203
}
198204

199205
// for each TF built pool of positive and negaitve tracks

Detectors/ITSMFT/ITS/tracking/GPU/cuda/TrackingKernels.cu

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -47,20 +47,6 @@ namespace o2::its
4747
namespace gpu
4848
{
4949

50-
struct sort_tracklets {
51-
GPUhd() bool operator()(const Tracklet& a, const Tracklet& b)
52-
{
53-
if (a.firstClusterIndex != b.firstClusterIndex) {
54-
return a.firstClusterIndex < b.firstClusterIndex;
55-
}
56-
return a.secondClusterIndex < b.secondClusterIndex;
57-
}
58-
};
59-
60-
struct equal_tracklets {
61-
GPUhd() bool operator()(const Tracklet& a, const Tracklet& b) { return a.firstClusterIndex == b.firstClusterIndex && a.secondClusterIndex == b.secondClusterIndex; }
62-
};
63-
6450
template <typename T1, typename T2>
6551
struct sort_by_second {
6652
GPUhd() bool operator()(const gpuPair<T1, T2>& a, const gpuPair<T1, T2>& b) const { return a.second < b.second; }
@@ -408,7 +394,7 @@ GPUg() void __launch_bounds__(256, 1) computeLayerTrackletsMultiROFKernel(
408394
const float sqInverseDeltaZ0{1.f / (math_utils::Sq(currentCluster.zCoordinate - primaryVertex.getZ()) + constants::Tolerance)}; /// protecting from overflows adding the detector resolution
409395
const float sigmaZ{o2::gpu::CAMath::Sqrt(math_utils::Sq(resolution) * math_utils::Sq(tanLambda) * ((math_utils::Sq(inverseR0) + sqInverseDeltaZ0) * math_utils::Sq(meanDeltaR) + 1.f) + math_utils::Sq(meanDeltaR * MSAngle))};
410396
const int4 selectedBinsRect{o2::its::getBinsRect(currentCluster, layerIndex + 1, zAtRmin, zAtRmax, sigmaZ * NSigmaCut, phiCut, *utils)};
411-
if (selectedBinsRect.x == 0 && selectedBinsRect.y == 0 && selectedBinsRect.z == 0 && selectedBinsRect.w == 0) {
397+
if (selectedBinsRect.x < 0) {
412398
continue;
413399
}
414400
int phiBinsNum{selectedBinsRect.w - selectedBinsRect.y + 1};
@@ -687,8 +673,8 @@ void computeTrackletsInROFsHandler(const IndexTableUtils<NLayers>* utils,
687673
mulScatAng[layer]);
688674
thrust::device_ptr<Tracklet> tracklets_ptr(spanTracklets[layer]);
689675
auto nosync_policy = THRUST_NAMESPACE::par_nosync(gpu::TypedAllocator<char>(alloc)).on(streams[layer].get());
690-
thrust::sort(nosync_policy, tracklets_ptr, tracklets_ptr + nTracklets[layer], gpu::sort_tracklets());
691-
auto unique_end = thrust::unique(nosync_policy, tracklets_ptr, tracklets_ptr + nTracklets[layer], gpu::equal_tracklets());
676+
thrust::sort(nosync_policy, tracklets_ptr, tracklets_ptr + nTracklets[layer]);
677+
auto unique_end = thrust::unique(nosync_policy, tracklets_ptr, tracklets_ptr + nTracklets[layer]);
692678
nTracklets[layer] = unique_end - tracklets_ptr;
693679
if (layer) {
694680
GPUChkErrS(cudaMemsetAsync(trackletsLUTsHost[layer], 0, (nClusters[layer] + 1) * sizeof(int), streams[layer].get()));

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,18 +56,17 @@ class SeedBase : public o2::track::TrackParCovF
5656
GPUhd() const auto& clustersRaw() const { return mClusters; }
5757

5858
private:
59-
float mChi2 = -999.f;
60-
int mLevel = constants::UnusedIndex;
59+
float mChi2{constants::UnsetValue};
60+
int mLevel{constants::UnusedIndex};
6161
std::array<int, 2> mTracklets = constants::helpers::initArray<int, 2, constants::UnusedIndex>();
6262
std::array<int, NClusters> mClusters = constants::helpers::initArray<int, NClusters, constants::UnusedIndex>();
6363
TimeEstBC mTime;
6464
};
6565

6666
/// CellSeed: connections of three clusters
67-
class CellSeed final : public SeedBase<3>
67+
class CellSeed final : public SeedBase<constants::ClustersPerCell>
6868
{
69-
static constexpr int NStoredClusters = 3;
70-
using Base = SeedBase<NStoredClusters>;
69+
using Base = SeedBase<constants::ClustersPerCell>;
7170

7271
public:
7372
GPUhdDefault() CellSeed() = default;
@@ -98,7 +97,7 @@ class CellSeed final : public SeedBase<3>
9897
GPUhd() int getCluster(int layer) const
9998
{
10099
const int rel = layer - getInnerLayer();
101-
return (rel >= 0 && rel < NStoredClusters) ? this->clustersRaw()[rel] : constants::UnusedIndex;
100+
return (rel >= 0 && rel < constants::ClustersPerCell) ? this->clustersRaw()[rel] : constants::UnusedIndex;
102101
}
103102
};
104103

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

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@
1919
#include <array>
2020
#include <utility>
2121

22-
#include "GPUCommonDef.h"
23-
#include "GPUCommonDefAPI.h"
24-
2522
namespace o2::its::constants
2623
{
2724

@@ -30,12 +27,14 @@ constexpr float MB = KB * KB;
3027
constexpr float GB = MB * KB;
3128
constexpr bool DoTimeBenchmarks = true;
3229
constexpr bool SaveTimeBenchmarks = false;
33-
constexpr float Tolerance = 1e-12; // numerical tolerance
34-
constexpr int ClustersPerCell = 3;
35-
constexpr int UnusedIndex = -1;
36-
constexpr float Radl = 9.36f; // Radiation length of Si [cm]
37-
constexpr float Rho = 2.33f; // Density of Si [g/cm^3]
38-
constexpr int MaxIter = 4; // Max. supported iterations
30+
constexpr float Tolerance = 1e-12; // numerical tolerance
31+
constexpr int ClustersPerCell = 3; // number of clusters for a cell
32+
constexpr int UnusedIndex = -1; // global unused flag
33+
constexpr float UnsetValue = -999.f; // global unset value
34+
constexpr float Radl = 9.36f; // Radiation length of Si [cm]
35+
constexpr float Rho = 2.33f; // Density of Si [g/cm^3]
36+
constexpr int MaxIter = 4; // Max. supported iterations
37+
constexpr int MaxSelectedTrackletsPerCluster = 100; // vertexer: max lines per cluster
3938

4039
namespace helpers
4140
{

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

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,19 @@ struct LogLogThrottler {
5050
return false;
5151
}
5252
};
53+
54+
struct TimingStats {
55+
std::uint64_t calls = 0;
56+
double totalTimeMs = 0.;
57+
58+
void add(double timeMs)
59+
{
60+
++calls;
61+
totalTimeMs += timeMs;
62+
}
63+
double averageTimeMs() const { return calls ? totalTimeMs / static_cast<double>(calls) : 0.; }
64+
};
65+
5366
} // namespace o2::its
5467

55-
#endif
68+
#endif

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ GPUhdi() int4 getBinsRect(const Cluster& currentCluster, const int layerIndex,
124124

125125
if (zRangeMax < -utils.getLayerZ(layerIndex) ||
126126
zRangeMin > utils.getLayerZ(layerIndex) || zRangeMin > zRangeMax) {
127-
return int4{0, 0, 0, 0};
127+
return int4{-1, -1, -1, -1};
128128
}
129129

130130
return int4{o2::gpu::GPUCommonMath::Max(0, utils.getZBinIndex(layerIndex, zRangeMin)),

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,12 @@ GPUhdi() float smallestAngleDifference(float a, float b)
8989
return o2::gpu::CAMath::Remainderf(b - a, o2::constants::math::TwoPI);
9090
}
9191

92+
GPUhdi() bool isPhiDifferenceBelow(const float phiA, const float phiB, const float phiCut)
93+
{
94+
const float deltaPhi = o2::gpu::CAMath::Abs(phiA - phiB);
95+
return deltaPhi < phiCut || deltaPhi > o2::constants::math::TwoPI - phiCut;
96+
}
97+
9298
GPUhdi() constexpr float Sq(float v)
9399
{
94100
return v * v;

0 commit comments

Comments
 (0)