Skip to content

[DPG] tpcSkimsTableCreator: develop adaptive downsampling - #18902

Merged
alcaliva merged 22 commits into
AliceO2Group:masterfrom
lubynets:tpc-skim-dwnspl
Nov 25, 2026
Merged

alcaliva merged 22 commits into
AliceO2Group:masterfrom
lubynets:tpc-skim-dwnspl

Conversation

@lubynets

Copy link
Copy Markdown
Contributor

1. Adaptive downsampling
Adaptive means "such that adapts for expected particles distribution (both shape and yield)".

Preparation of calibration histogram
Each time when the tpcSkimsTableCreator is run with saveMomentumHistograms configurable set to true, it will create a 2D histogram with momentum's logarithm for each (anti)particle species. This histogram is filled with the full available statistics, i.e. w/o downsampling, however with all cuts applied to the tree's entries. An example of such histogram is attached.
hParticleVsMomentum
For later we call this histogram a "calibration" one with expected $p$-distribution.

Applying adaptive downsampling
-- The user needs to upload the file with calibration histogram(s) to CCDB and set path, file name and histogram name in the configuration.
⚠️ When two workflows are run, TreeWriterTpcV0 and TreeWriterTpcTof, there should be provided two distinct files even if they are identical. Otherwise a conflict between two workflows happens in some rate of jobs. This issue is planned to be fixed by merging the two mentioned workflows into a single one.

-- The user sets adaptDwnsplHistoScaleFactor configurable to a value which is a ratio between the size of the dataset to be processed and the size of the dataset used for preparation of the calibration histogram.

-- The user sets the requested yield adaptDwnsplTargetYield of each (anti)particle species per unity of log10(p).

Then the particles' distribution looks like in the attached file (5 M particles per unity log10(p) were requested).
histograms.pdf

2. Removed old-style downsampling
(Tsallis-spectrum and momentum-common coefficient)

3. Code refactory
-- maxMomHardCutOnly cut introduced for protons and pions in TreeWriterTpcTof (before it was missing for 2 out of 5 particle species)
-- Configurables, common for TreeWriterTpcV0 and TreeWriterTpcTof factored out into a ConfigurableGroup.

Tagging @amaringarcia

@github-actions github-actions Bot added the dpg label Nov 24, 2026
@github-actions github-actions Bot changed the title tpcSkimsTableCreator: develop adaptive downsampling [DPG] tpcSkimsTableCreator: develop adaptive downsampling Nov 24, 2026
@github-actions

Copy link
Copy Markdown

O2 linter results: ❌ 0 errors, ⚠️ 9 warnings, 🔕 1 disabled

@alibuild

Copy link
Copy Markdown
Collaborator

Error while checking build/O2Physics/code-check for d9d3e1d at 2026-11-24 17:34:

## sw/BUILD/O2Physics-code-check-latest/log
--
========== List of issues found ==========
++ echo 'To reproduce the results below locally, run: '\''aliBuild build O2Physics-code-check -e ALIBUILD_BASE_HASH=upstream/master'\''.'
To reproduce the results below locally, run: 'aliBuild build O2Physics-code-check -e ALIBUILD_BASE_HASH=upstream/master'.
++ echo 'To apply all automatic fixes, add the '\''-e O2PHYSICS_CHECKER_FIX=1'\'' option.'
To apply all automatic fixes, add the '-e O2PHYSICS_CHECKER_FIX=1' option.
++ echo 'See the documentation for more details at: <https://aliceo2group.github.io/analysis-framework/docs/tools/#running-with-o2physics-code-check>.'
See the documentation for more details at: <https://aliceo2group.github.io/analysis-framework/docs/tools/#running-with-o2physics-code-check>.
++ echo 'Found 2 errors and 42 warnings.'
Found 2 errors and 42 warnings.
++ [[ 2 -gt 0 ]]
++ cat /sw/BUILD/57c14c2e2b8f1dbc322bb1933da77a65c1891a42/O2Physics-code-check/errors.txt
DPG/Tasks/TPC/tpcSkimsTableCreator.cxx:40:1: error: included header PhysicsConstants.h is not used directly [misc-include-cleaner,-warnings-as-errors]
DPG/Tasks/TPC/utilsTpcSkimsTableCreator.h:184:91: error: no header providing "o2::track::PID" is directly included [misc-include-cleaner,-warnings-as-errors]
++ [[ 42 -gt 0 ]]
++ cat /sw/BUILD/57c14c2e2b8f1dbc322bb1933da77a65c1891a42/O2Physics-code-check/warnings.txt
DPG/Tasks/TPC/tpcSkimsTableCreator.cxx:129:15: warning: member 'nSigmaTofUnmatchedEqualityTolerance' of type 'const float' is const qualified [cppcoreguidelines-avoid-const-or-ref-data-members]
DPG/Tasks/TPC/tpcSkimsTableCreator.cxx:133:3: warning: initial values in enum '<unnamed>' are not consistent, consider explicit initialization of all, none or only the first enumerator [readability-enum-initial-value]
DPG/Tasks/TPC/tpcSkimsTableCreator.cxx:143:3: warning: initial values in enum '<unnamed>' are not consistent, consider explicit initialization of all, none or only the first enumerator [readability-enum-initial-value]
DPG/Tasks/TPC/tpcSkimsTableCreator.cxx:168:30: warning: initializer for member 'mRateFetcher' is redundant [readability-redundant-member-init]
DPG/Tasks/TPC/tpcSkimsTableCreator.cxx:170:46: warning: initializer for member 'rctChecker' is redundant [readability-redundant-member-init]
DPG/Tasks/TPC/tpcSkimsTableCreator.cxx:241:16: warning: avoid repeating the return type from the declaration; use a braced initializer list instead [modernize-return-braced-init-list]
DPG/Tasks/TPC/tpcSkimsTableCreator.cxx:250:24: warning: use designated initializer list to initialize 'V0Mother' [modernize-use-designated-initializers]
DPG/Tasks/TPC/tpcSkimsTableCreator.cxx:252:24: warning: use designated initializer list to initialize 'V0Mother' [modernize-use-designated-initializers]
DPG/Tasks/TPC/tpcSkimsTableCreator.cxx:254:24: warning: use designated initializer list to initialize 'V0Mother' [modernize-use-designated-initializers]
DPG/Tasks/TPC/tpcSkimsTableCreator.cxx:256:24: warning: use designated initializer list to initialize 'V0Mother' [modernize-use-designated-initializers]
DPG/Tasks/TPC/tpcSkimsTableCreator.cxx:258:24: warning: use designated initializer list to initialize 'V0Mother' [modernize-use-designated-initializers]
DPG/Tasks/TPC/tpcSkimsTableCreator.cxx:260:24: warning: use designated initializer list to initialize 'V0Mother' [modernize-use-designated-initializers]
DPG/Tasks/TPC/tpcSkimsTableCreator.cxx:263:16: warning: avoid repeating the return type from the declaration; use a braced initializer list instead [modernize-return-braced-init-list]
DPG/Tasks/TPC/tpcSkimsTableCreator.cxx:272:7: warning: do not use 'else' after 'return' [readability-else-after-return]
DPG/Tasks/TPC/tpcSkimsTableCreator.cxx:273:22: warning: statement should be inside braces [readability-braces-around-statements]
DPG/Tasks/TPC/tpcSkimsTableCreator.cxx:275:7: warning: do not use 'else' after 'return' [readability-else-after-return]
DPG/Tasks/TPC/tpcSkimsTableCreator.cxx:275:11: warning: statement should be inside braces [readability-braces-around-statements]
DPG/Tasks/TPC/tpcSkimsTableCreator.cxx:278:54: warning: statement should be inside braces [readability-braces-around-statements]
DPG/Tasks/TPC/tpcSkimsTableCreator.cxx:280:7: warning: do not use 'else' after 'return' [readability-else-after-return]
DPG/Tasks/TPC/tpcSkimsTableCreator.cxx:280:58: warning: statement should be inside braces [readability-braces-around-statements]
DPG/Tasks/TPC/tpcSkimsTableCreator.cxx:283:55: warning: statement should be inside braces [readability-braces-around-statements]
DPG/Tasks/TPC/tpcSkimsTableCreator.cxx:285:7: warning: do not use 'else' after 'return' [readability-else-after-return]
DPG/Tasks/TPC/tpcSkimsTableCreator.cxx:285:57: warning: statement should be inside braces [readability-braces-around-statements]
DPG/Tasks/TPC/tpcSkimsTableCreator.cxx:295:96: warning: statement should be inside braces [readability-braces-around-statements]
DPG/Tasks/TPC/tpcSkimsTableCreator.cxx:418:63: warning: statement should be inside braces [readability-braces-around-statements]
DPG/Tasks/TPC/tpcSkimsTableCreator.cxx:420:9: warning: statement should be inside braces [readability-braces-around-statements]
DPG/Tasks/TPC/tpcSkimsTableCreator.cxx:428:63: warning: statement should be inside braces [readability-braces-around-statements]
DPG/Tasks/TPC/tpcSkimsTableCreator.cxx:430:9: warning: statement should be inside braces [readability-braces-around-statements]
DPG/Tasks/TPC/tpcSkimsTableCreator.cxx:438:63: warning: statement should be inside braces [readability-braces-around-statements]
DPG/Tasks/TPC/tpcSkimsTableCreator.cxx:440:9: warning: statement should be inside braces [readability-braces-around-statements]
DPG/Tasks/TPC/tpcSkimsTableCreator.cxx:471:11: warning: use auto when initializing with a cast to avoid duplicating the type name [modernize-use-auto]
DPG/Tasks/TPC/tpcSkimsTableCreator.cxx:580:69: warning: redundant boolean literal in ternary expression result [readability-simplify-boolean-expr]
[0 more errors; see full log]

Full log here.

@alibuild

Copy link
Copy Markdown
Collaborator

Error while checking build/O2Physics/code-check for d740a76 at 2026-11-24 17:46:

## sw/BUILD/O2Physics-code-check-latest/log
--
========== List of issues found ==========
++ echo 'To reproduce the results below locally, run: '\''aliBuild build O2Physics-code-check -e ALIBUILD_BASE_HASH=upstream/master'\''.'
To reproduce the results below locally, run: 'aliBuild build O2Physics-code-check -e ALIBUILD_BASE_HASH=upstream/master'.
++ echo 'To apply all automatic fixes, add the '\''-e O2PHYSICS_CHECKER_FIX=1'\'' option.'
To apply all automatic fixes, add the '-e O2PHYSICS_CHECKER_FIX=1' option.
++ echo 'See the documentation for more details at: <https://aliceo2group.github.io/analysis-framework/docs/tools/#running-with-o2physics-code-check>.'
See the documentation for more details at: <https://aliceo2group.github.io/analysis-framework/docs/tools/#running-with-o2physics-code-check>.
++ echo 'Found 2 errors and 42 warnings.'
Found 2 errors and 42 warnings.
++ [[ 2 -gt 0 ]]
++ cat /sw/BUILD/4bbbf4137fbcd0d267f5a296a7ef4aed04090ed3/O2Physics-code-check/errors.txt
DPG/Tasks/TPC/tpcSkimsTableCreator.cxx:40:1: error: included header PhysicsConstants.h is not used directly [misc-include-cleaner,-warnings-as-errors]
DPG/Tasks/TPC/utilsTpcSkimsTableCreator.h:189:91: error: no header providing "o2::track::PID" is directly included [misc-include-cleaner,-warnings-as-errors]
++ [[ 42 -gt 0 ]]
++ cat /sw/BUILD/4bbbf4137fbcd0d267f5a296a7ef4aed04090ed3/O2Physics-code-check/warnings.txt
DPG/Tasks/TPC/tpcSkimsTableCreator.cxx:129:15: warning: member 'nSigmaTofUnmatchedEqualityTolerance' of type 'const float' is const qualified [cppcoreguidelines-avoid-const-or-ref-data-members]
DPG/Tasks/TPC/tpcSkimsTableCreator.cxx:133:3: warning: initial values in enum '<unnamed>' are not consistent, consider explicit initialization of all, none or only the first enumerator [readability-enum-initial-value]
DPG/Tasks/TPC/tpcSkimsTableCreator.cxx:143:3: warning: initial values in enum '<unnamed>' are not consistent, consider explicit initialization of all, none or only the first enumerator [readability-enum-initial-value]
DPG/Tasks/TPC/tpcSkimsTableCreator.cxx:168:30: warning: initializer for member 'mRateFetcher' is redundant [readability-redundant-member-init]
DPG/Tasks/TPC/tpcSkimsTableCreator.cxx:170:46: warning: initializer for member 'rctChecker' is redundant [readability-redundant-member-init]
DPG/Tasks/TPC/tpcSkimsTableCreator.cxx:241:16: warning: avoid repeating the return type from the declaration; use a braced initializer list instead [modernize-return-braced-init-list]
DPG/Tasks/TPC/tpcSkimsTableCreator.cxx:250:24: warning: use designated initializer list to initialize 'V0Mother' [modernize-use-designated-initializers]
DPG/Tasks/TPC/tpcSkimsTableCreator.cxx:252:24: warning: use designated initializer list to initialize 'V0Mother' [modernize-use-designated-initializers]
DPG/Tasks/TPC/tpcSkimsTableCreator.cxx:254:24: warning: use designated initializer list to initialize 'V0Mother' [modernize-use-designated-initializers]
DPG/Tasks/TPC/tpcSkimsTableCreator.cxx:256:24: warning: use designated initializer list to initialize 'V0Mother' [modernize-use-designated-initializers]
DPG/Tasks/TPC/tpcSkimsTableCreator.cxx:258:24: warning: use designated initializer list to initialize 'V0Mother' [modernize-use-designated-initializers]
DPG/Tasks/TPC/tpcSkimsTableCreator.cxx:260:24: warning: use designated initializer list to initialize 'V0Mother' [modernize-use-designated-initializers]
DPG/Tasks/TPC/tpcSkimsTableCreator.cxx:263:16: warning: avoid repeating the return type from the declaration; use a braced initializer list instead [modernize-return-braced-init-list]
DPG/Tasks/TPC/tpcSkimsTableCreator.cxx:272:7: warning: do not use 'else' after 'return' [readability-else-after-return]
DPG/Tasks/TPC/tpcSkimsTableCreator.cxx:273:22: warning: statement should be inside braces [readability-braces-around-statements]
DPG/Tasks/TPC/tpcSkimsTableCreator.cxx:275:7: warning: do not use 'else' after 'return' [readability-else-after-return]
DPG/Tasks/TPC/tpcSkimsTableCreator.cxx:275:11: warning: statement should be inside braces [readability-braces-around-statements]
DPG/Tasks/TPC/tpcSkimsTableCreator.cxx:278:54: warning: statement should be inside braces [readability-braces-around-statements]
DPG/Tasks/TPC/tpcSkimsTableCreator.cxx:280:7: warning: do not use 'else' after 'return' [readability-else-after-return]
DPG/Tasks/TPC/tpcSkimsTableCreator.cxx:280:58: warning: statement should be inside braces [readability-braces-around-statements]
DPG/Tasks/TPC/tpcSkimsTableCreator.cxx:283:55: warning: statement should be inside braces [readability-braces-around-statements]
DPG/Tasks/TPC/tpcSkimsTableCreator.cxx:285:7: warning: do not use 'else' after 'return' [readability-else-after-return]
DPG/Tasks/TPC/tpcSkimsTableCreator.cxx:285:57: warning: statement should be inside braces [readability-braces-around-statements]
DPG/Tasks/TPC/tpcSkimsTableCreator.cxx:295:96: warning: statement should be inside braces [readability-braces-around-statements]
DPG/Tasks/TPC/tpcSkimsTableCreator.cxx:418:63: warning: statement should be inside braces [readability-braces-around-statements]
DPG/Tasks/TPC/tpcSkimsTableCreator.cxx:420:9: warning: statement should be inside braces [readability-braces-around-statements]
DPG/Tasks/TPC/tpcSkimsTableCreator.cxx:428:63: warning: statement should be inside braces [readability-braces-around-statements]
DPG/Tasks/TPC/tpcSkimsTableCreator.cxx:430:9: warning: statement should be inside braces [readability-braces-around-statements]
DPG/Tasks/TPC/tpcSkimsTableCreator.cxx:438:63: warning: statement should be inside braces [readability-braces-around-statements]
DPG/Tasks/TPC/tpcSkimsTableCreator.cxx:440:9: warning: statement should be inside braces [readability-braces-around-statements]
DPG/Tasks/TPC/tpcSkimsTableCreator.cxx:471:11: warning: use auto when initializing with a cast to avoid duplicating the type name [modernize-use-auto]
DPG/Tasks/TPC/tpcSkimsTableCreator.cxx:580:69: warning: redundant boolean literal in ternary expression result [readability-simplify-boolean-expr]
[0 more errors; see full log]

Full log here.

@alcaliva
alcaliva merged commit aeefb89 into AliceO2Group:master Nov 25, 2026
14 checks passed
@lubynets
lubynets deleted the tpc-skim-dwnspl branch November 25, 2026 12:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

3 participants