Skip to content

Commit ce79769

Browse files
committed
Add GPUTPCClusterFilter class to remove TPC clusters in generic way for cluster studies
1 parent 63d8c5b commit ce79769

File tree

5 files changed

+75
-2
lines changed

5 files changed

+75
-2
lines changed

GPU/GPUTracking/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ set(SRCS_NO_CINT
9494
Global/GPUErrors.cxx
9595
Merger/GPUTPCGMMergerGPU.cxx
9696
Debug/GPUROOTDumpCore.cxx
97+
Debug/GPUTPCClusterFilter.cxx
9798
utils/timer.cxx)
9899

99100
set(SRCS_NO_H SliceTracker/GPUTPCTrackerDump.cxx
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
12+
/// \file GPUTPCClusterFilter.cxx
13+
/// \author David Rohr
14+
15+
#include "GPUTPCClusterFilter.h"
16+
#include "DataFormatsTPC/ClusterNative.h"
17+
18+
using namespace o2::gpu;
19+
20+
GPUTPCClusterFilter::GPUTPCClusterFilter(const o2::tpc::ClusterNativeAccess& clusters)
21+
{
22+
// Could initialize private variables based on the clusters here
23+
}
24+
25+
bool GPUTPCClusterFilter::filter(uint32_t sector, uint32_t row, o2::tpc::ClusterNative& cl)
26+
{
27+
// Return true to keep the cluster, false to drop it.
28+
// May change cluster properties by modifying the cl reference.
29+
// 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.
30+
return true;
31+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
12+
/// \file GPUTPCClusterFilter.h
13+
/// \author David Rohr
14+
15+
#ifndef GPUTPCCLUSTERFILTER_H
16+
#define GPUTPCCLUSTERFILTER_H
17+
18+
#include <cstdint>
19+
20+
namespace o2::tpc
21+
{
22+
struct ClusterNativeAccess;
23+
struct ClusterNative;
24+
} // namespace o2::tpc
25+
26+
namespace o2::gpu
27+
{
28+
class GPUTPCClusterFilter
29+
{
30+
public:
31+
GPUTPCClusterFilter(const o2::tpc::ClusterNativeAccess& clusters);
32+
bool filter(uint32_t sector, uint32_t row, o2::tpc::ClusterNative& cl);
33+
};
34+
} // namespace o2::gpu
35+
36+
#endif

GPU/GPUTracking/Definitions/GPUSettingsList.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@ AddOption(tpcDownscaledEdx, uint8_t, 0, "", 0, "If != 0, downscale dEdx processi
286286
AddOption(tpcMaxAttachedClustersPerSectorRow, uint32_t, 51000, "", 0, "Maximum number of TPC attached clusters which can be decoded per SectorRow")
287287
AddOption(tpcUseOldCPUDecoding, bool, false, "", 0, "Enable old CPU-based TPC decoding")
288288
AddOption(tpcApplyCFCutsAtDecoding, bool, false, "", 0, "Apply cluster cuts from clusterization during decoding of compressed clusters")
289+
AddOption(tpcApplyDebugClusterFilter, bool, false, "", 0, "Apply custom cluster filter of GPUTPCClusterFilter class")
289290
AddOption(RTCcacheFolder, std::string, "./rtccache/", "", 0, "Folder in which the cache file is stored")
290291
AddOption(RTCprependCommand, std::string, "", "", 0, "Prepend RTC compilation commands by this string")
291292
AddOption(RTCoverrideArchitecture, std::string, "", "", 0, "Override arhcitecture part of RTC compilation command line")

GPU/GPUTracking/Global/GPUChainTrackingCompression.cxx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#ifdef GPUCA_HAVE_O2HEADERS
2222
#include "GPUTPCCFChainContext.h"
2323
#include "TPCClusterDecompressor.h"
24+
#include "GPUTPCClusterFilter.h"
2425
#endif
2526
#include "utils/strtag.h"
2627

@@ -226,15 +227,18 @@ int32_t GPUChainTracking::RunTPCDecompression()
226227
return 1;
227228
}
228229
if (GetProcessingSettings().tpcApplyCFCutsAtDecoding) {
230+
GPUTPCClusterFilter clusterFilter(*mClusterNativeAccess);
229231
ClusterNative* outputBuffer;
230232
for (int32_t iPhase = 0; iPhase < 2; iPhase++) {
231233
uint32_t countTotal = 0;
232234
for (uint32_t iSector = 0; iSector < GPUCA_NSLICES; iSector++) {
233235
for (uint32_t iRow = 0; iRow < GPUCA_ROW_COUNT; iRow++) {
234236
uint32_t count = 0;
235237
for (uint32_t k = 0; k < mClusterNativeAccess->nClusters[iSector][iRow]; k++) {
236-
const ClusterNative& cl = mClusterNativeAccess->clusters[iSector][iRow][k];
237-
bool keep = cl.qTot > param().rec.tpc.cfQTotCutoff && cl.qMax > param().rec.tpc.cfQMaxCutoff && (cl.sigmaPadPacked || !(cl.getFlags() & ClusterNative::flagSingle) || cl.qMax > param().rec.tpc.cfQMaxCutoffSinglePad) && (cl.sigmaTimePacked || !(cl.getFlags() & ClusterNative::flagSingle) || cl.qMax > param().rec.tpc.cfQMaxCutoffSingleTime);
238+
ClusterNative cl = mClusterNativeAccess->clusters[iSector][iRow][k];
239+
bool keep = cl.qTot > param().rec.tpc.cfQTotCutoff && cl.qMax > param().rec.tpc.cfQMaxCutoff;
240+
keep = keep && (cl.sigmaPadPacked || !(cl.getFlags() & ClusterNative::flagSingle) || cl.qMax > param().rec.tpc.cfQMaxCutoffSinglePad) && (cl.sigmaTimePacked || !(cl.getFlags() & ClusterNative::flagSingle) || cl.qMax > param().rec.tpc.cfQMaxCutoffSingleTime);
241+
keep = keep && (!GetProcessingSettings().tpcApplyDebugClusterFilter || clusterFilter.filter(iSector, iRow, cl));
238242
count += keep;
239243
countTotal += keep;
240244
if (iPhase) {

0 commit comments

Comments
 (0)