|
12 | 12 | /// \file GPUTPCClusterFilter.cxx |
13 | 13 | /// \author David Rohr |
14 | 14 |
|
| 15 | +#include "GPUCommonLogger.h" |
15 | 16 | #include "GPUTPCClusterFilter.h" |
16 | 17 | #include "DataFormatsTPC/ClusterNative.h" |
17 | 18 |
|
18 | 19 | using namespace o2::gpu; |
19 | 20 |
|
20 | | -GPUTPCClusterFilter::GPUTPCClusterFilter(const o2::tpc::ClusterNativeAccess& clusters) |
| 21 | +GPUTPCClusterFilter::GPUTPCClusterFilter(const o2::tpc::ClusterNativeAccess& clusters, uint8_t filterType) |
| 22 | + : mFilterType(filterType) |
21 | 23 | { |
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 | + } |
23 | 56 | } |
24 | 57 |
|
25 | 58 | bool GPUTPCClusterFilter::filter(uint32_t sector, uint32_t row, o2::tpc::ClusterNative& cl) |
26 | 59 | { |
27 | 60 | // Return true to keep the cluster, false to drop it. |
28 | 61 | // May change cluster properties by modifying the cl reference. |
29 | 62 | // 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 | + |
30 | 72 | return true; |
31 | 73 | } |
0 commit comments