Skip to content

Commit 0912aa3

Browse files
authored
Merge branch 'AliceO2Group:dev' into new-detector4
2 parents f2b04d4 + 2395824 commit 0912aa3

File tree

14 files changed

+106
-29
lines changed

14 files changed

+106
-29
lines changed

Detectors/TPC/qc/include/TPCQC/Tracks.h

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,19 +81,26 @@ class Tracks
8181
mUseCutMaxAbsDCArOnHistos = useCutMaxAbsDCArOnHistos;
8282
}
8383

84+
// Set PV position
85+
void setPVposition(const o2::math_utils::Point3D<float> meanVtxPoint3D)
86+
{
87+
mPositionOfPV = meanVtxPoint3D;
88+
}
89+
8490
/// get ratios of 1D histograms
8591
std::unordered_map<std::string, std::unique_ptr<TH1>>& getMapHist() { return mMapHist; }
8692
const std::unordered_map<std::string, std::unique_ptr<TH1>>& getMapHist() const { return mMapHist; }
8793

8894
private:
89-
float mCutAbsEta = 1.f; // Eta cut
90-
int mCutMinnCls = 60; // minimum N clusters
91-
float mCutMindEdxTot = 20.f; // dEdxTot min value
92-
float mCutMinPtDCAr = 1.5f; // minimum pT for DCAr plots DCAr vs. phi, eta, nCluster
93-
float mSamplingFractionDCAr = 0.1f; // sampling rate for calculation of DCAr
94-
bool mTurnOffHistosForAsync = false; // Decide whether to turn off some histograms for async to reduce memory
95-
float mCutMaxAbsDCAr = 1.f; // maximum DCAr
96-
bool mUseCutMaxAbsDCArOnHistos = false; // Decide whether to use the cut on maximum DCAr for the histograms
95+
float mCutAbsEta = 1.f; // Eta cut
96+
int mCutMinnCls = 60; // minimum N clusters
97+
float mCutMindEdxTot = 20.f; // dEdxTot min value
98+
float mCutMinPtDCAr = 1.5f; // minimum pT for DCAr plots DCAr vs. phi, eta, nCluster
99+
float mSamplingFractionDCAr = 0.1f; // sampling rate for calculation of DCAr
100+
bool mTurnOffHistosForAsync = false; // Decide whether to turn off some histograms for async to reduce memory
101+
float mCutMaxAbsDCAr = 1.f; // maximum DCAr
102+
bool mUseCutMaxAbsDCArOnHistos = false; // Decide whether to use the cut on maximum DCAr for the histograms
103+
o2::math_utils::Point3D<float> mPositionOfPV{}; // Position of the PV
97104

98105
std::unordered_map<std::string, std::unique_ptr<TH1>> mMapHist;
99106
std::vector<TH1F> mHist1D{}; ///< Initialize vector of 1D histograms

Detectors/TPC/qc/src/Tracks.cxx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,8 @@ bool Tracks::processTrack(const o2::tpc::TrackTPC& track)
180180
if (propagator->getMatLUT() && propagator->hasMagFieldSet()) {
181181
// ---| fill DCA histos |---
182182
o2::gpu::gpustd::array<float, 2> dca;
183-
const o2::math_utils::Point3D<float> refPoint{0, 0, 0};
184183
o2::track::TrackPar propTrack(track);
185-
if (propagator->propagateToDCABxByBz(refPoint, propTrack, 2.f, o2::base::Propagator::MatCorrType::USEMatCorrLUT, &dca)) {
184+
if (propagator->propagateToDCABxByBz(mPositionOfPV, propTrack, 2.f, o2::base::Propagator::MatCorrType::USEMatCorrLUT, &dca)) {
186185
const auto phi = o2::math_utils::to02PiGen(track.getPhi());
187186
dcaHistPT->Fill(pt, dca[0]);
188187
dcaHist->Fill(phi, dca[0]);

Detectors/TPC/workflow/src/MIPTrackFilterSpec.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ void MIPTrackFilterDevice::init(framework::InitContext& ic)
106106

107107
void MIPTrackFilterDevice::run(ProcessingContext& pc)
108108
{
109+
o2::base::GRPGeomHelper::instance().checkUpdates(pc);
109110
const auto currentTF = processing_helpers::getCurrentTF(pc);
110111
if ((mTFCounter++ % mProcessEveryNthTF) && (currentTF >= mProcessNFirstTFs)) {
111112
LOGP(info, "Skipping TF {}", currentTF);
@@ -115,7 +116,6 @@ void MIPTrackFilterDevice::run(ProcessingContext& pc)
115116
}
116117
return;
117118
}
118-
o2::base::GRPGeomHelper::instance().checkUpdates(pc);
119119

120120
const auto tracks = pc.inputs().get<gsl::span<TrackTPC>>("tracks");
121121
const auto nTracks = tracks.size();

GPU/GPUTracking/Base/cuda/GPUReconstructionCUDA.cu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ int32_t GPUReconstructionCUDA::InitDevice_Runtime()
416416
mInternals = master->mInternals;
417417
GPUFailedMsg(cudaSetDevice(mDeviceId));
418418

419-
GPUInfo("CUDA Initialized from master");
419+
GPUInfo("CUDA Initialisation successfull (from master)");
420420
}
421421

422422
for (uint32_t i = 0; i < mEvents.size(); i++) {

GPU/GPUTracking/Base/hip/GPUReconstructionHIPIncludesHost.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#include <hip/hip_ext.h>
2222
#include <hipcub/hipcub.hpp>
2323
#pragma GCC diagnostic push
24-
#pragma GCC diagnostic ignored "-Wshadow"
24+
#pragma GCC diagnostic ignored "-Wshadow" // FIXME: Is this still needed?
2525
#include <thrust/sort.h>
2626
#include <thrust/execution_policy.h>
2727
#include <thrust/device_ptr.h>

GPU/GPUTracking/Debug/GPUTPCClusterFilter.cxx

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,62 @@
1212
/// \file GPUTPCClusterFilter.cxx
1313
/// \author David Rohr
1414

15+
#include "GPUCommonLogger.h"
1516
#include "GPUTPCClusterFilter.h"
1617
#include "DataFormatsTPC/ClusterNative.h"
1718

1819
using namespace o2::gpu;
1920

20-
GPUTPCClusterFilter::GPUTPCClusterFilter(const o2::tpc::ClusterNativeAccess& clusters)
21+
GPUTPCClusterFilter::GPUTPCClusterFilter(const o2::tpc::ClusterNativeAccess& clusters, uint8_t filterType)
22+
: mFilterType(filterType)
2123
{
22-
// Could initialize private variables based on the clusters here
24+
if (filterType == 1) {
25+
// Custom filter settings go here
26+
27+
} else if (filterType == 2) {
28+
// PbPb23 filter
29+
mClusterStats = std::make_unique<std::vector<int>[]>(MaxStacks);
30+
static bool called = false;
31+
if (!called) {
32+
LOGP(info, "GPUTPCClusterFilter called for PbPb 2023 settings");
33+
called = true;
34+
}
35+
36+
for (uint32_t iSector = 0; iSector < GPUCA_NSECTORS; iSector++) {
37+
for (uint32_t iRow = 0; iRow < GPUCA_ROW_COUNT; iRow++) {
38+
const uint32_t globalStack = getGlobalStack(iSector, iRow);
39+
mClusterStats[globalStack].resize(MaxTimeBin);
40+
41+
for (uint32_t k = 0; k < clusters.nClusters[iSector][iRow]; k++) {
42+
const o2::tpc::ClusterNative& cl = clusters.clusters[iSector][iRow][k];
43+
const int clTime = static_cast<int>(cl.getTime());
44+
const float clQmax = cl.getQmax();
45+
46+
if (clQmax < 12) {
47+
if (clTime >= static_cast<int>(mClusterStats[globalStack].size())) {
48+
mClusterStats[globalStack].resize(mClusterStats[globalStack].size() + 445);
49+
}
50+
++mClusterStats[globalStack][clTime];
51+
}
52+
}
53+
}
54+
}
55+
}
2356
}
2457

2558
bool GPUTPCClusterFilter::filter(uint32_t sector, uint32_t row, o2::tpc::ClusterNative& cl)
2659
{
2760
// Return true to keep the cluster, false to drop it.
2861
// May change cluster properties by modifying the cl reference.
2962
// Note that this function might be called multiple times for the same cluster, in which case the final modified cl reference goes into the output clusters.
63+
if (mFilterType == 2) {
64+
const uint32_t globalStack = getGlobalStack(sector, row);
65+
const int clTime = static_cast<int>(cl.getTime());
66+
const float clQmax = cl.getQmax();
67+
if ((mClusterStats[globalStack][clTime] > 40 && clQmax < 12) || (mClusterStats[globalStack][clTime] > 200)) {
68+
return false;
69+
}
70+
}
71+
3072
return true;
3173
}

GPU/GPUTracking/Debug/GPUTPCClusterFilter.h

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@
1515
#ifndef GPUTPCCLUSTERFILTER_H
1616
#define GPUTPCCLUSTERFILTER_H
1717

18+
#include <memory>
1819
#include <cstdint>
20+
#include <vector>
21+
#include "GPUDefConstantsAndSettings.h"
1922

2023
namespace o2::tpc
2124
{
@@ -28,8 +31,29 @@ namespace o2::gpu
2831
class GPUTPCClusterFilter
2932
{
3033
public:
31-
GPUTPCClusterFilter(const o2::tpc::ClusterNativeAccess& clusters);
34+
GPUTPCClusterFilter(const o2::tpc::ClusterNativeAccess& clusters, uint8_t filterType);
3235
bool filter(uint32_t sector, uint32_t row, o2::tpc::ClusterNative& cl);
36+
37+
private:
38+
static constexpr uint32_t MaxTimeBin = 14256;
39+
static constexpr uint32_t MaxStacks = GPUCA_NSECTORS * 4;
40+
uint8_t mFilterType = 0; //< 0: off, 1: custom, 2: PbPb23
41+
42+
std::unique_ptr<std::vector<int>[]> mClusterStats; //< Number of clusters per stack and time bin
43+
44+
uint32_t getGlobalStack(uint32_t sector, uint32_t row) const
45+
{
46+
int stack = 3;
47+
if (row < 63) {
48+
stack = 0;
49+
} else if (row < 97) {
50+
stack = 1;
51+
} else if (row < 127) {
52+
stack = 2;
53+
}
54+
55+
return sector * 4 + stack;
56+
};
3357
};
3458
} // namespace o2::gpu
3559

GPU/GPUTracking/Definitions/GPUSettingsList.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ AddOption(tpcDownscaledEdx, uint8_t, 0, "", 0, "If != 0, downscale dEdx processi
291291
AddOption(tpcMaxAttachedClustersPerSectorRow, uint32_t, 51000, "", 0, "Maximum number of TPC attached clusters which can be decoded per SectorRow")
292292
AddOption(tpcUseOldCPUDecoding, bool, false, "", 0, "Enable old CPU-based TPC decoding")
293293
AddOption(tpcApplyCFCutsAtDecoding, bool, false, "", 0, "Apply cluster cuts from clusterization during decoding of compressed clusters")
294-
AddOption(tpcApplyDebugClusterFilter, bool, false, "", 0, "Apply custom cluster filter of GPUTPCClusterFilter class")
294+
AddOption(tpcApplyClusterFilterOnCPU, uint8_t, 0, "", 0, "Apply custom cluster filter of GPUTPCClusterFilter class, 0: off, 1: debug, 2: PbPb23")
295295
AddOption(RTCcacheFolder, std::string, "./rtccache/", "", 0, "Folder in which the cache file is stored")
296296
AddOption(RTCprependCommand, std::string, "", "", 0, "Prepend RTC compilation commands by this string")
297297
AddOption(RTCoverrideArchitecture, std::string, "", "", 0, "Override arhcitecture part of RTC compilation command line")

GPU/GPUTracking/Global/GPUChainTracking.cxx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -294,16 +294,12 @@ bool GPUChainTracking::ValidateSettings()
294294
return false;
295295
}
296296
}
297-
if ((GetRecoSteps() & GPUDataTypes::RecoStep::TPCDecompression) && GetProcessingSettings().tpcApplyCFCutsAtDecoding && !GetProcessingSettings().tpcUseOldCPUDecoding) {
298-
GPUError("tpcApplyCFCutsAtDecoding currently requires tpcUseOldCPUDecoding");
299-
return false;
300-
}
301297
if ((GetRecoStepsGPU() & GPUDataTypes::RecoStep::TPCCompression) && !(GetRecoStepsGPU() & GPUDataTypes::RecoStep::TPCCompression) && (GetProcessingSettings().tpcCompressionGatherMode == 1 || GetProcessingSettings().tpcCompressionGatherMode == 3)) {
302298
GPUError("Invalid tpcCompressionGatherMode for compression on CPU");
303299
return false;
304300
}
305-
if (GetProcessingSettings().tpcApplyDebugClusterFilter == 1 && (GetRecoStepsGPU() & GPUDataTypes::RecoStep::TPCClusterFinding || GetProcessingSettings().delayedOutput || GetProcessingSettings().runMC)) {
306-
GPUError("tpcApplyDebugClusterFilter cannot be used with GPU clusterization or with delayedOutput for GPU or with MC labels");
301+
if (GetProcessingSettings().tpcApplyClusterFilterOnCPU > 0 && (GetRecoStepsGPU() & GPUDataTypes::RecoStep::TPCClusterFinding || GetProcessingSettings().delayedOutput || GetProcessingSettings().runMC)) {
302+
GPUError("tpcApplyClusterFilterOnCPU cannot be used with GPU clusterization or with delayedOutput for GPU or with MC labels");
307303
return false;
308304
}
309305
if (GetRecoSteps() & RecoStep::TRDTracking) {
@@ -815,7 +811,7 @@ int32_t GPUChainTracking::RunChainFinalize()
815811

816812
PrintDebugOutput();
817813

818-
//PrintMemoryRelations();
814+
// PrintMemoryRelations();
819815

820816
if (GetProcessingSettings().eventDisplay) {
821817
if (!mDisplayRunning) {

GPU/GPUTracking/Global/GPUChainTrackingClusterizer.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,7 @@ int32_t GPUChainTracking::RunTPCClusterizer(bool synchronizeOutput)
635635
if (mWaitForFinalInputs) {
636636
GPUFatal("Cannot use waitForFinalInput callback without delayed output");
637637
}
638-
if (!GetProcessingSettings().tpcApplyDebugClusterFilter) {
638+
if (!GetProcessingSettings().tpcApplyClusterFilterOnCPU) {
639639
AllocateRegisteredMemory(mInputsHost->mResourceClusterNativeOutput, mSubOutputControls[GPUTrackingOutputs::getIndex(&GPUTrackingOutputs::clustersNative)]);
640640
tmpNativeClusters = mInputsHost->mPclusterNativeOutput;
641641
} else {
@@ -1021,7 +1021,7 @@ int32_t GPUChainTracking::RunTPCClusterizer(bool synchronizeOutput)
10211021
tmpNativeAccess->clustersMCTruth = mcLabelsConstView;
10221022
tmpNativeAccess->setOffsetPtrs();
10231023
mIOPtrs.clustersNative = tmpNativeAccess;
1024-
if (GetProcessingSettings().tpcApplyDebugClusterFilter) {
1024+
if (GetProcessingSettings().tpcApplyClusterFilterOnCPU) {
10251025
auto allocator = [this, &tmpNativeClusters](size_t size) {
10261026
this->mInputsHost->mNClusterNative = size;
10271027
this->AllocateRegisteredMemory(this->mInputsHost->mResourceClusterNativeOutput, this->mSubOutputControls[GPUTrackingOutputs::getIndex(&GPUTrackingOutputs::clustersNative)]);

0 commit comments

Comments
 (0)