Skip to content

Commit a4c346c

Browse files
authored
Added unit test for partition combinations (AliceO2Group#4170)
1 parent a358bf9 commit a4c346c

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

Tutorials/src/tracksCombinations.cxx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,31 @@ struct ConfigurableBinnedCollisionCombinations {
8888
}
8989
};
9090

91+
struct BinnedTrackPartitionsCombinations {
92+
std::vector<double> xBins{VARIABLE_WIDTH, -0.064, -0.062, -0.060, 0.066, 0.068, 0.070, 0.072};
93+
std::vector<double> yBins{VARIABLE_WIDTH, -0.320, -0.301, -0.300, 0.330, 0.340, 0.350, 0.360};
94+
ColumnBinningPolicy<aod::track::X, aod::track::Y> trackBinning{{xBins, yBins}, true};
95+
Configurable<float> philow{"phiLow", 1.0f, "lowest phi"};
96+
97+
void process(aod::Tracks const& tracks)
98+
{
99+
Partition<aod::Tracks> leftPhi = aod::track::phi < philow;
100+
Partition<aod::Tracks> rightPhi = aod::track::phi >= philow;
101+
leftPhi.bindTable(tracks);
102+
rightPhi.bindTable(tracks);
103+
104+
int count = 0;
105+
// Strictly upper tracks binned by x and y position
106+
for (auto& [t0, t1] : selfCombinations(trackBinning, 5, -1, leftPhi, rightPhi)) {
107+
int bin = trackBinning.getBin({t0.x(), t0.y()});
108+
LOGF(info, "Tracks bin: %d pair: %d (%f, %f, %f) phi %f, %d (%f, %f, %f) phi %f", bin, t0.index(), t0.x(), t0.y(), t0.z(), t0.phi(), t1.index(), t1.x(), t1.y(), t1.z(), t1.phi());
109+
count++;
110+
if (count > 100)
111+
break;
112+
}
113+
}
114+
};
115+
91116
struct HashTask {
92117
std::vector<float> xBins{-0.064f, -0.062f, -0.060f, 0.066f, 0.068f, 0.070f, 0.072};
93118
std::vector<float> yBins{-0.320f, -0.301f, -0.300f, 0.330f, 0.340f, 0.350f, 0.360};
@@ -149,6 +174,7 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
149174
adaptAnalysisTask<TrackCombinations>(cfgc),
150175
adaptAnalysisTask<BinnedTrackCombinations>(cfgc),
151176
adaptAnalysisTask<ConfigurableBinnedCollisionCombinations>(cfgc),
177+
adaptAnalysisTask<BinnedTrackPartitionsCombinations>(cfgc),
152178
adaptAnalysisTask<HashTask>(cfgc),
153179
adaptAnalysisTask<BinnedTrackCombinationsWithHashTable>(cfgc),
154180
};

0 commit comments

Comments
 (0)