From ebae3f368bf153a4939b6f2b06be7cda9c3fff59 Mon Sep 17 00:00:00 2001 From: Oleksii Lubynets Date: Thu, 8 Oct 2026 16:59:11 +0200 Subject: [PATCH 1/7] extend particleWiseCuts (not packed into array and not applied yet) --- .../TPC/treeCreatorPidTpcDiagnostics.cxx | 26 ++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/DPG/Tasks/TPC/treeCreatorPidTpcDiagnostics.cxx b/DPG/Tasks/TPC/treeCreatorPidTpcDiagnostics.cxx index 9f30e558d2c..1f3491ebead 100644 --- a/DPG/Tasks/TPC/treeCreatorPidTpcDiagnostics.cxx +++ b/DPG/Tasks/TPC/treeCreatorPidTpcDiagnostics.cxx @@ -86,25 +86,33 @@ struct TreeCreatorPidTpcDiagnostics { Configurable treatLimitedAcceptanceAsBad{"treatLimitedAcceptanceAsBad", false, "reject all events where the detectors relevant for the specified Runlist are flagged as LimitedAcceptance"}; Configurable requireGoodRct{"requireGoodRct", false, "require good detector flag in run condtion table"}; -#define DECLARE_PARTICLE_WISE_CONFIGURABLES(ParticleNameShort, ParticleNameLong) \ - Configurable cutTpcInnerParameterMin##ParticleNameLong{"cutTpcInnerParameterMin" #ParticleNameLong, 0.f, "Lower-value cut on tpcInnerParam for " #ParticleNameLong}; /* o2-linter: disable=name/configurable (Configurable defined in macro)*/ \ - Configurable cutTpcInnerParameterMax##ParticleNameLong{"cutTpcInnerParameterMax" #ParticleNameLong, 999.f, "Upper-value cut on tpcInnerParam for " #ParticleNameLong}; /* o2-linter: disable=name/configurable (Configurable defined in macro)*/ \ - Configurable cutNSigmaTpcAbs##ParticleNameLong{"cutNSigmaTpcAbs" #ParticleNameLong, 999.f, "Cut on absolute value of nSigmaTpc for " #ParticleNameLong}; // o2-linter: disable=name/configurable (Configurable defined in macro) - - DO_FOR_ALL_PARTICLES(DECLARE_PARTICLE_WISE_CONFIGURABLES) + struct ParticleWiseCuts : ConfigurableGroup { + +#define DECLARE_PARTICLE_WISE_CONFIGURABLES(ParticleNameShort, ParticleNameLong) \ + Configurable cutTpcInnerParameterMin##ParticleNameLong{"cutTpcInnerParameterMin" #ParticleNameLong, 0.f, "Lower-value cut on tpcInnerParam for " #ParticleNameLong}; /* o2-linter: disable=name/configurable (Configurable defined in macro)*/ \ + Configurable cutTpcInnerParameterMax##ParticleNameLong{"cutTpcInnerParameterMax" #ParticleNameLong, 999.f, "Upper-value cut on tpcInnerParam for " #ParticleNameLong}; /* o2-linter: disable=name/configurable (Configurable defined in macro)*/ \ + Configurable cutExpSigmaMax##ParticleNameLong{"cutExpSigmaMax" #ParticleNameLong, 1e9f, "Upper-value cut on (positively-defined) expected sigma for " #ParticleNameLong}; /* o2-linter: disable=name/configurable (Configurable defined in macro)*/ \ + Configurable cutDeDxExpectedMin##ParticleNameLong{"cutDeDxExpectedMin" #ParticleNameLong, -1e9f, "Lower-value cut on expected dE/dx for " #ParticleNameLong}; /* o2-linter: disable=name/configurable (Configurable defined in macro)*/ \ + Configurable cutDeDxExpectedMax##ParticleNameLong{"cutDeDxExpectedMax" #ParticleNameLong, 1e9f, "Upper-value cut on expected dE/dx for " #ParticleNameLong}; /* o2-linter: disable=name/configurable (Configurable defined in macro)*/ \ + Configurable cutDeDxDiffMin##ParticleNameLong{"cutDeDxDiffMin" #ParticleNameLong, -1e9f, "Lower-value cut on real - expected dE/dx difference for " #ParticleNameLong}; /* o2-linter: disable=name/configurable (Configurable defined in macro)*/ \ + Configurable cutDeDxDiffMax##ParticleNameLong{"cutDeDxDiffMax" #ParticleNameLong, 1e9f, "Upper-value cut on real - expected dE/dx difference for " #ParticleNameLong}; /* o2-linter: disable=name/configurable (Configurable defined in macro)*/ \ + Configurable cutNSigmaTpcAbs##ParticleNameLong{"cutNSigmaTpcAbs" #ParticleNameLong, 999.f, "Cut on absolute value of nSigmaTpc for " #ParticleNameLong}; // o2-linter: disable=name/configurable (Configurable defined in macro) + + DO_FOR_ALL_PARTICLES(DECLARE_PARTICLE_WISE_CONFIGURABLES) #undef DECLARE_PARTICLE_WISE_CONFIGURABLES + } particleWiseCuts; -#define PACK_CONFIGURABLES_TO_ARRAY(ParticleNameShort, ParticleNameLong) &cutTpcInnerParameterMin##ParticleNameLong, +#define PACK_CONFIGURABLES_TO_ARRAY(ParticleNameShort, ParticleNameLong) &particleWiseCuts.cutTpcInnerParameterMin##ParticleNameLong, std::array*, PID::Alpha + 1> cutTpcInnerParameterMin{ DO_FOR_ALL_PARTICLES(PACK_CONFIGURABLES_TO_ARRAY)}; #undef PACK_CONFIGURABLES_TO_ARRAY -#define PACK_CONFIGURABLES_TO_ARRAY(ParticleNameShort, ParticleNameLong) &cutTpcInnerParameterMax##ParticleNameLong, +#define PACK_CONFIGURABLES_TO_ARRAY(ParticleNameShort, ParticleNameLong) &particleWiseCuts.cutTpcInnerParameterMax##ParticleNameLong, std::array*, PID::Alpha + 1> cutTpcInnerParameterMax{ DO_FOR_ALL_PARTICLES(PACK_CONFIGURABLES_TO_ARRAY)}; #undef PACK_CONFIGURABLES_TO_ARRAY -#define PACK_CONFIGURABLES_TO_ARRAY(ParticleNameShort, ParticleNameLong) &cutNSigmaTpcAbs##ParticleNameLong, +#define PACK_CONFIGURABLES_TO_ARRAY(ParticleNameShort, ParticleNameLong) &particleWiseCuts.cutNSigmaTpcAbs##ParticleNameLong, std::array*, PID::Alpha + 1> cutNSigmaTpcAbs{ DO_FOR_ALL_PARTICLES(PACK_CONFIGURABLES_TO_ARRAY)}; #undef PACK_CONFIGURABLES_TO_ARRAY From 7b27fdc1cede2ec1f260d534cadb2b3b47e3790c Mon Sep 17 00:00:00 2001 From: Oleksii Lubynets Date: Thu, 8 Oct 2026 18:34:28 +0200 Subject: [PATCH 2/7] DRY PACK_CONFIGURABLES_TO_ARRAY --- .../TPC/treeCreatorPidTpcDiagnostics.cxx | 58 ++++++++++--------- 1 file changed, 31 insertions(+), 27 deletions(-) diff --git a/DPG/Tasks/TPC/treeCreatorPidTpcDiagnostics.cxx b/DPG/Tasks/TPC/treeCreatorPidTpcDiagnostics.cxx index 1f3491ebead..48f4f865cfe 100644 --- a/DPG/Tasks/TPC/treeCreatorPidTpcDiagnostics.cxx +++ b/DPG/Tasks/TPC/treeCreatorPidTpcDiagnostics.cxx @@ -43,6 +43,9 @@ #include +#include +#include + #include #include #include @@ -53,16 +56,16 @@ using namespace o2::framework; using namespace o2::track; using namespace o2::dpg_tpcskimstablecreator; -#define DO_FOR_ALL_PARTICLES(MACRO) \ - MACRO(El, Electron) \ - MACRO(Mu, Muon) \ - MACRO(Pi, Pion) \ - MACRO(Ka, Kaon) \ - MACRO(Pr, Proton) \ - MACRO(De, Deuteron) \ - MACRO(Tr, Triton) \ - MACRO(He, Helium3) \ - MACRO(Al, Alpha) +#define DO_FOR_ALL_PARTICLES(MACRO, ARG) \ + MACRO(El, Electron, ARG) \ + MACRO(Mu, Muon, ARG) \ + MACRO(Pi, Pion, ARG) \ + MACRO(Ka, Kaon, ARG) \ + MACRO(Pr, Proton, ARG) \ + MACRO(De, Deuteron, ARG) \ + MACRO(Tr, Triton, ARG) \ + MACRO(He, Helium3, ARG) \ + MACRO(Al, Alpha, ARG) struct TreeCreatorPidTpcDiagnostics { Produces rowPidTpcDiagnostics; @@ -88,7 +91,7 @@ struct TreeCreatorPidTpcDiagnostics { struct ParticleWiseCuts : ConfigurableGroup { -#define DECLARE_PARTICLE_WISE_CONFIGURABLES(ParticleNameShort, ParticleNameLong) \ +#define DECLARE_PARTICLE_WISE_CONFIGURABLES(ParticleNameShort, ParticleNameLong, Unused) \ Configurable cutTpcInnerParameterMin##ParticleNameLong{"cutTpcInnerParameterMin" #ParticleNameLong, 0.f, "Lower-value cut on tpcInnerParam for " #ParticleNameLong}; /* o2-linter: disable=name/configurable (Configurable defined in macro)*/ \ Configurable cutTpcInnerParameterMax##ParticleNameLong{"cutTpcInnerParameterMax" #ParticleNameLong, 999.f, "Upper-value cut on tpcInnerParam for " #ParticleNameLong}; /* o2-linter: disable=name/configurable (Configurable defined in macro)*/ \ Configurable cutExpSigmaMax##ParticleNameLong{"cutExpSigmaMax" #ParticleNameLong, 1e9f, "Upper-value cut on (positively-defined) expected sigma for " #ParticleNameLong}; /* o2-linter: disable=name/configurable (Configurable defined in macro)*/ \ @@ -98,24 +101,25 @@ struct TreeCreatorPidTpcDiagnostics { Configurable cutDeDxDiffMax##ParticleNameLong{"cutDeDxDiffMax" #ParticleNameLong, 1e9f, "Upper-value cut on real - expected dE/dx difference for " #ParticleNameLong}; /* o2-linter: disable=name/configurable (Configurable defined in macro)*/ \ Configurable cutNSigmaTpcAbs##ParticleNameLong{"cutNSigmaTpcAbs" #ParticleNameLong, 999.f, "Cut on absolute value of nSigmaTpc for " #ParticleNameLong}; // o2-linter: disable=name/configurable (Configurable defined in macro) - DO_FOR_ALL_PARTICLES(DECLARE_PARTICLE_WISE_CONFIGURABLES) + DO_FOR_ALL_PARTICLES(DECLARE_PARTICLE_WISE_CONFIGURABLES, _) #undef DECLARE_PARTICLE_WISE_CONFIGURABLES } particleWiseCuts; -#define PACK_CONFIGURABLES_TO_ARRAY(ParticleNameShort, ParticleNameLong) &particleWiseCuts.cutTpcInnerParameterMin##ParticleNameLong, - std::array*, PID::Alpha + 1> cutTpcInnerParameterMin{ - DO_FOR_ALL_PARTICLES(PACK_CONFIGURABLES_TO_ARRAY)}; -#undef PACK_CONFIGURABLES_TO_ARRAY +#define PARTICLE_WISE_CUT_NAMES \ + (cutTpcInnerParameterMin)(cutTpcInnerParameterMax)(cutNSigmaTpcAbs) -#define PACK_CONFIGURABLES_TO_ARRAY(ParticleNameShort, ParticleNameLong) &particleWiseCuts.cutTpcInnerParameterMax##ParticleNameLong, - std::array*, PID::Alpha + 1> cutTpcInnerParameterMax{ - DO_FOR_ALL_PARTICLES(PACK_CONFIGURABLES_TO_ARRAY)}; -#undef PACK_CONFIGURABLES_TO_ARRAY +#define MAKE_PARTICLE_CUT_POINTER(ShortName, LongName, CutName) \ + &particleWiseCuts.BOOST_PP_CAT(CutName, LongName), + +#define PACK_CONFIGURABLES_TO_ARRAY(Unused1, Unused2, CutName) \ + std::array*, PID::Alpha + 1> CutName{ \ + DO_FOR_ALL_PARTICLES(MAKE_PARTICLE_CUT_POINTER, CutName)}; + + BOOST_PP_SEQ_FOR_EACH(PACK_CONFIGURABLES_TO_ARRAY, _, PARTICLE_WISE_CUT_NAMES) -#define PACK_CONFIGURABLES_TO_ARRAY(ParticleNameShort, ParticleNameLong) &particleWiseCuts.cutNSigmaTpcAbs##ParticleNameLong, - std::array*, PID::Alpha + 1> cutNSigmaTpcAbs{ - DO_FOR_ALL_PARTICLES(PACK_CONFIGURABLES_TO_ARRAY)}; #undef PACK_CONFIGURABLES_TO_ARRAY +#undef MAKE_PARTICLE_CUT_POINTER +#undef PARTICLE_WISE_CUT_NAMES HistogramRegistry registry{"registry", {}}; @@ -140,7 +144,7 @@ struct TreeCreatorPidTpcDiagnostics { int enabledProcesses{0}; switch (ParticleId) { -#define INIT_PARTICLE(ParticleNameShort, ParticleNameLong) \ +#define INIT_PARTICLE(ParticleNameShort, ParticleNameLong, Unused) \ case PID::ParticleNameLong: \ if (!doprocess##ParticleNameLong && !doprocessFull##ParticleNameLong && !doprocessFullWithTOF##ParticleNameLong) { \ return false; \ @@ -157,7 +161,7 @@ struct TreeCreatorPidTpcDiagnostics { LOG(info) << "Enabled TPC QA for " << #ParticleNameLong; \ break; - DO_FOR_ALL_PARTICLES(INIT_PARTICLE) + DO_FOR_ALL_PARTICLES(INIT_PARTICLE, _) #undef INIT_PARTICLE } if (enabledProcesses != 1) { @@ -273,7 +277,7 @@ struct TreeCreatorPidTpcDiagnostics { } } -#define MAKE_PROCESS_FUNCTIONS(ParticleNameShort, ParticleNameLong) \ +#define MAKE_PROCESS_FUNCTIONS(ParticleNameShort, ParticleNameLong, Unused) \ void process##ParticleNameLong(CollisionsExtra const& collisions, \ soa::Join const& tracks, \ aod::BCsWithTimestamps const&) \ @@ -298,7 +302,7 @@ struct TreeCreatorPidTpcDiagnostics { } \ PROCESS_SWITCH(TreeCreatorPidTpcDiagnostics, processFullWithTOF##ParticleNameLong, Form("Process for the %s hypothesis for full TPC PID QA with the TOF info added", #ParticleNameLong), false); - DO_FOR_ALL_PARTICLES(MAKE_PROCESS_FUNCTIONS) + DO_FOR_ALL_PARTICLES(MAKE_PROCESS_FUNCTIONS, _) #undef MAKE_PROCESS_FUNCTIONS }; From 90665be9ec43cf5ef63c59200d2804d254a8c49d Mon Sep 17 00:00:00 2001 From: Oleksii Lubynets Date: Thu, 8 Oct 2026 22:50:29 +0200 Subject: [PATCH 3/7] apply newly introduced cuts --- .../TPC/treeCreatorPidTpcDiagnostics.cxx | 38 +++++++++++-------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/DPG/Tasks/TPC/treeCreatorPidTpcDiagnostics.cxx b/DPG/Tasks/TPC/treeCreatorPidTpcDiagnostics.cxx index 48f4f865cfe..b3e5b6149b5 100644 --- a/DPG/Tasks/TPC/treeCreatorPidTpcDiagnostics.cxx +++ b/DPG/Tasks/TPC/treeCreatorPidTpcDiagnostics.cxx @@ -91,28 +91,28 @@ struct TreeCreatorPidTpcDiagnostics { struct ParticleWiseCuts : ConfigurableGroup { -#define DECLARE_PARTICLE_WISE_CONFIGURABLES(ParticleNameShort, ParticleNameLong, Unused) \ - Configurable cutTpcInnerParameterMin##ParticleNameLong{"cutTpcInnerParameterMin" #ParticleNameLong, 0.f, "Lower-value cut on tpcInnerParam for " #ParticleNameLong}; /* o2-linter: disable=name/configurable (Configurable defined in macro)*/ \ - Configurable cutTpcInnerParameterMax##ParticleNameLong{"cutTpcInnerParameterMax" #ParticleNameLong, 999.f, "Upper-value cut on tpcInnerParam for " #ParticleNameLong}; /* o2-linter: disable=name/configurable (Configurable defined in macro)*/ \ - Configurable cutExpSigmaMax##ParticleNameLong{"cutExpSigmaMax" #ParticleNameLong, 1e9f, "Upper-value cut on (positively-defined) expected sigma for " #ParticleNameLong}; /* o2-linter: disable=name/configurable (Configurable defined in macro)*/ \ - Configurable cutDeDxExpectedMin##ParticleNameLong{"cutDeDxExpectedMin" #ParticleNameLong, -1e9f, "Lower-value cut on expected dE/dx for " #ParticleNameLong}; /* o2-linter: disable=name/configurable (Configurable defined in macro)*/ \ - Configurable cutDeDxExpectedMax##ParticleNameLong{"cutDeDxExpectedMax" #ParticleNameLong, 1e9f, "Upper-value cut on expected dE/dx for " #ParticleNameLong}; /* o2-linter: disable=name/configurable (Configurable defined in macro)*/ \ - Configurable cutDeDxDiffMin##ParticleNameLong{"cutDeDxDiffMin" #ParticleNameLong, -1e9f, "Lower-value cut on real - expected dE/dx difference for " #ParticleNameLong}; /* o2-linter: disable=name/configurable (Configurable defined in macro)*/ \ - Configurable cutDeDxDiffMax##ParticleNameLong{"cutDeDxDiffMax" #ParticleNameLong, 1e9f, "Upper-value cut on real - expected dE/dx difference for " #ParticleNameLong}; /* o2-linter: disable=name/configurable (Configurable defined in macro)*/ \ - Configurable cutNSigmaTpcAbs##ParticleNameLong{"cutNSigmaTpcAbs" #ParticleNameLong, 999.f, "Cut on absolute value of nSigmaTpc for " #ParticleNameLong}; // o2-linter: disable=name/configurable (Configurable defined in macro) +#define DECLARE_PARTICLE_WISE_CONFIGURABLES(ParticleNameShort, ParticleNameLong, Unused) \ + Configurable cutTpcInnerParameterMin##ParticleNameLong{"cutTpcInnerParameterMin" #ParticleNameLong, 0.f, "Lower-value cut on tpcInnerParam for " #ParticleNameLong}; /* o2-linter: disable=name/configurable (Configurable defined in macro)*/ \ + Configurable cutTpcInnerParameterMax##ParticleNameLong{"cutTpcInnerParameterMax" #ParticleNameLong, 999.f, "Upper-value cut on tpcInnerParam for " #ParticleNameLong}; /* o2-linter: disable=name/configurable (Configurable defined in macro)*/ \ + Configurable cutExpSigmaMax##ParticleNameLong{"cutExpSigmaMax" #ParticleNameLong, 1e9f, "Upper-value cut on expected sigma for " #ParticleNameLong}; /* o2-linter: disable=name/configurable (Configurable defined in macro)*/ \ + Configurable cutDeDxExpectedMin##ParticleNameLong{"cutDeDxExpectedMin" #ParticleNameLong, -1e9f, "Lower-value cut on expected dE/dx for " #ParticleNameLong}; /* o2-linter: disable=name/configurable (Configurable defined in macro)*/ \ + Configurable cutDeDxExpectedMax##ParticleNameLong{"cutDeDxExpectedMax" #ParticleNameLong, 1e9f, "Upper-value cut on expected dE/dx for " #ParticleNameLong}; /* o2-linter: disable=name/configurable (Configurable defined in macro)*/ \ + Configurable cutDeDxDiffMin##ParticleNameLong{"cutDeDxDiffMin" #ParticleNameLong, -1e9f, "Lower-value cut on real - expected dE/dx difference for " #ParticleNameLong}; /* o2-linter: disable=name/configurable (Configurable defined in macro)*/ \ + Configurable cutDeDxDiffMax##ParticleNameLong{"cutDeDxDiffMax" #ParticleNameLong, 1e9f, "Upper-value cut on real - expected dE/dx difference for " #ParticleNameLong}; /* o2-linter: disable=name/configurable (Configurable defined in macro)*/ \ + Configurable cutNSigmaTpcAbs##ParticleNameLong{"cutNSigmaTpcAbs" #ParticleNameLong, 999.f, "Cut on absolute value of nSigmaTpc for " #ParticleNameLong}; // o2-linter: disable=name/configurable (Configurable defined in macro) DO_FOR_ALL_PARTICLES(DECLARE_PARTICLE_WISE_CONFIGURABLES, _) #undef DECLARE_PARTICLE_WISE_CONFIGURABLES } particleWiseCuts; #define PARTICLE_WISE_CUT_NAMES \ - (cutTpcInnerParameterMin)(cutTpcInnerParameterMax)(cutNSigmaTpcAbs) + (cutTpcInnerParameterMin)(cutTpcInnerParameterMax)(cutExpSigmaMax)(cutDeDxExpectedMin)(cutDeDxExpectedMax)(cutDeDxDiffMin)(cutDeDxDiffMax)(cutNSigmaTpcAbs) #define MAKE_PARTICLE_CUT_POINTER(ShortName, LongName, CutName) \ &particleWiseCuts.BOOST_PP_CAT(CutName, LongName), -#define PACK_CONFIGURABLES_TO_ARRAY(Unused1, Unused2, CutName) \ - std::array*, PID::Alpha + 1> CutName{ \ +#define PACK_CONFIGURABLES_TO_ARRAY(Unused1, Unused2, CutName) \ + const std::array*, PID::Alpha + 1> CutName{ \ DO_FOR_ALL_PARTICLES(MAKE_PARTICLE_CUT_POINTER, CutName)}; BOOST_PP_SEQ_FOR_EACH(PACK_CONFIGURABLES_TO_ARRAY, _, PARTICLE_WISE_CUT_NAMES) @@ -245,10 +245,6 @@ struct TreeCreatorPidTpcDiagnostics { isGoodTrack &= (tpcInnerParam <= *cutTpcInnerParameterMax.at(ParticleId)); isGoodTrack &= (std::fabs(nSigmaTpc) <= *cutNSigmaTpcAbs.at(ParticleId)); - if (!isGoodTrack) { - continue; - } - float dedxDiff{UndefValueFloat}; float dedxExpected{UndefValueFloat}; float expSigma{UndefValueFloat}; @@ -257,6 +253,16 @@ struct TreeCreatorPidTpcDiagnostics { dedxDiff = o2::aod::pidutils::tpcExpSignalDiff(track); dedxExpected = track.tpcSignal() - dedxDiff; expSigma = o2::aod::pidutils::tpcExpSigma(track); + + isGoodTrack &= (expSigma <= *cutExpSigmaMax.at(ParticleId)); + isGoodTrack &= (dedxExpected >= *cutDeDxExpectedMin.at(ParticleId)); + isGoodTrack &= (dedxExpected <= *cutDeDxExpectedMax.at(ParticleId)); + isGoodTrack &= (dedxDiff >= *cutDeDxDiffMin.at(ParticleId)); + isGoodTrack &= (dedxDiff <= *cutDeDxDiffMax.at(ParticleId)); + } + + if (!isGoodTrack) { + continue; } float nSigmaTof{UndefValueFloat}; From 444db7566c9e2f3c07a81081558adc8c8e8cb9a9 Mon Sep 17 00:00:00 2001 From: Oleksii Lubynets Date: Fri, 9 Oct 2026 17:19:33 +0200 Subject: [PATCH 4/7] rename unused macro arguments --- DPG/Tasks/TPC/treeCreatorPidTpcDiagnostics.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/DPG/Tasks/TPC/treeCreatorPidTpcDiagnostics.cxx b/DPG/Tasks/TPC/treeCreatorPidTpcDiagnostics.cxx index b3e5b6149b5..74ef39565d7 100644 --- a/DPG/Tasks/TPC/treeCreatorPidTpcDiagnostics.cxx +++ b/DPG/Tasks/TPC/treeCreatorPidTpcDiagnostics.cxx @@ -91,7 +91,7 @@ struct TreeCreatorPidTpcDiagnostics { struct ParticleWiseCuts : ConfigurableGroup { -#define DECLARE_PARTICLE_WISE_CONFIGURABLES(ParticleNameShort, ParticleNameLong, Unused) \ +#define DECLARE_PARTICLE_WISE_CONFIGURABLES(Unused1, ParticleNameLong, Unused2) \ Configurable cutTpcInnerParameterMin##ParticleNameLong{"cutTpcInnerParameterMin" #ParticleNameLong, 0.f, "Lower-value cut on tpcInnerParam for " #ParticleNameLong}; /* o2-linter: disable=name/configurable (Configurable defined in macro)*/ \ Configurable cutTpcInnerParameterMax##ParticleNameLong{"cutTpcInnerParameterMax" #ParticleNameLong, 999.f, "Upper-value cut on tpcInnerParam for " #ParticleNameLong}; /* o2-linter: disable=name/configurable (Configurable defined in macro)*/ \ Configurable cutExpSigmaMax##ParticleNameLong{"cutExpSigmaMax" #ParticleNameLong, 1e9f, "Upper-value cut on expected sigma for " #ParticleNameLong}; /* o2-linter: disable=name/configurable (Configurable defined in macro)*/ \ @@ -108,7 +108,7 @@ struct TreeCreatorPidTpcDiagnostics { #define PARTICLE_WISE_CUT_NAMES \ (cutTpcInnerParameterMin)(cutTpcInnerParameterMax)(cutExpSigmaMax)(cutDeDxExpectedMin)(cutDeDxExpectedMax)(cutDeDxDiffMin)(cutDeDxDiffMax)(cutNSigmaTpcAbs) -#define MAKE_PARTICLE_CUT_POINTER(ShortName, LongName, CutName) \ +#define MAKE_PARTICLE_CUT_POINTER(Unused, LongName, CutName) \ &particleWiseCuts.BOOST_PP_CAT(CutName, LongName), #define PACK_CONFIGURABLES_TO_ARRAY(Unused1, Unused2, CutName) \ @@ -144,7 +144,7 @@ struct TreeCreatorPidTpcDiagnostics { int enabledProcesses{0}; switch (ParticleId) { -#define INIT_PARTICLE(ParticleNameShort, ParticleNameLong, Unused) \ +#define INIT_PARTICLE(Unused1, ParticleNameLong, Unused2) \ case PID::ParticleNameLong: \ if (!doprocess##ParticleNameLong && !doprocessFull##ParticleNameLong && !doprocessFullWithTOF##ParticleNameLong) { \ return false; \ From 9ddea565783088621a50184040c6b3f9693e540e Mon Sep 17 00:00:00 2001 From: Oleksii Lubynets Date: Fri, 9 Oct 2026 18:19:28 +0200 Subject: [PATCH 5/7] provide downsampling --- .../TPC/treeCreatorPidTpcDiagnostics.cxx | 32 ++++++++++++------- 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/DPG/Tasks/TPC/treeCreatorPidTpcDiagnostics.cxx b/DPG/Tasks/TPC/treeCreatorPidTpcDiagnostics.cxx index 74ef39565d7..9d81363e6cb 100644 --- a/DPG/Tasks/TPC/treeCreatorPidTpcDiagnostics.cxx +++ b/DPG/Tasks/TPC/treeCreatorPidTpcDiagnostics.cxx @@ -41,6 +41,7 @@ #include #include +#include #include #include @@ -89,7 +90,7 @@ struct TreeCreatorPidTpcDiagnostics { Configurable treatLimitedAcceptanceAsBad{"treatLimitedAcceptanceAsBad", false, "reject all events where the detectors relevant for the specified Runlist are flagged as LimitedAcceptance"}; Configurable requireGoodRct{"requireGoodRct", false, "require good detector flag in run condtion table"}; - struct ParticleWiseCuts : ConfigurableGroup { + struct ParticleWiseCfgs : ConfigurableGroup { #define DECLARE_PARTICLE_WISE_CONFIGURABLES(Unused1, ParticleNameLong, Unused2) \ Configurable cutTpcInnerParameterMin##ParticleNameLong{"cutTpcInnerParameterMin" #ParticleNameLong, 0.f, "Lower-value cut on tpcInnerParam for " #ParticleNameLong}; /* o2-linter: disable=name/configurable (Configurable defined in macro)*/ \ @@ -99,27 +100,28 @@ struct TreeCreatorPidTpcDiagnostics { Configurable cutDeDxExpectedMax##ParticleNameLong{"cutDeDxExpectedMax" #ParticleNameLong, 1e9f, "Upper-value cut on expected dE/dx for " #ParticleNameLong}; /* o2-linter: disable=name/configurable (Configurable defined in macro)*/ \ Configurable cutDeDxDiffMin##ParticleNameLong{"cutDeDxDiffMin" #ParticleNameLong, -1e9f, "Lower-value cut on real - expected dE/dx difference for " #ParticleNameLong}; /* o2-linter: disable=name/configurable (Configurable defined in macro)*/ \ Configurable cutDeDxDiffMax##ParticleNameLong{"cutDeDxDiffMax" #ParticleNameLong, 1e9f, "Upper-value cut on real - expected dE/dx difference for " #ParticleNameLong}; /* o2-linter: disable=name/configurable (Configurable defined in macro)*/ \ - Configurable cutNSigmaTpcAbs##ParticleNameLong{"cutNSigmaTpcAbs" #ParticleNameLong, 999.f, "Cut on absolute value of nSigmaTpc for " #ParticleNameLong}; // o2-linter: disable=name/configurable (Configurable defined in macro) + Configurable cutNSigmaTpcAbs##ParticleNameLong{"cutNSigmaTpcAbs" #ParticleNameLong, 999.f, "Cut on absolute value of nSigmaTpc for " #ParticleNameLong}; /* o2-linter: disable=name/configurable (Configurable defined in macro)*/ \ + Configurable downsampleFactor##ParticleNameLong{"downsampleFactor" #ParticleNameLong, 1.f, "Downsampling factor for " #ParticleNameLong}; // o2-linter: disable=name/configurable (Configurable defined in macro) DO_FOR_ALL_PARTICLES(DECLARE_PARTICLE_WISE_CONFIGURABLES, _) #undef DECLARE_PARTICLE_WISE_CONFIGURABLES - } particleWiseCuts; + } particleWiseCfgs; -#define PARTICLE_WISE_CUT_NAMES \ - (cutTpcInnerParameterMin)(cutTpcInnerParameterMax)(cutExpSigmaMax)(cutDeDxExpectedMin)(cutDeDxExpectedMax)(cutDeDxDiffMin)(cutDeDxDiffMax)(cutNSigmaTpcAbs) +#define PARTICLE_WISE_CFG_NAMES \ + (cutTpcInnerParameterMin)(cutTpcInnerParameterMax)(cutExpSigmaMax)(cutDeDxExpectedMin)(cutDeDxExpectedMax)(cutDeDxDiffMin)(cutDeDxDiffMax)(cutNSigmaTpcAbs)(downsampleFactor) -#define MAKE_PARTICLE_CUT_POINTER(Unused, LongName, CutName) \ - &particleWiseCuts.BOOST_PP_CAT(CutName, LongName), +#define MAKE_PARTICLE_CUT_POINTER(Unused, ParticleNameLong, CfgName) \ + &particleWiseCfgs.BOOST_PP_CAT(CfgName, ParticleNameLong), -#define PACK_CONFIGURABLES_TO_ARRAY(Unused1, Unused2, CutName) \ - const std::array*, PID::Alpha + 1> CutName{ \ - DO_FOR_ALL_PARTICLES(MAKE_PARTICLE_CUT_POINTER, CutName)}; +#define PACK_CONFIGURABLES_TO_ARRAY(Unused1, Unused2, CfgName) \ + const std::array*, PID::Alpha + 1> CfgName{ \ + DO_FOR_ALL_PARTICLES(MAKE_PARTICLE_CUT_POINTER, CfgName)}; - BOOST_PP_SEQ_FOR_EACH(PACK_CONFIGURABLES_TO_ARRAY, _, PARTICLE_WISE_CUT_NAMES) + BOOST_PP_SEQ_FOR_EACH(PACK_CONFIGURABLES_TO_ARRAY, _, PARTICLE_WISE_CFG_NAMES) #undef PACK_CONFIGURABLES_TO_ARRAY #undef MAKE_PARTICLE_CUT_POINTER -#undef PARTICLE_WISE_CUT_NAMES +#undef PARTICLE_WISE_CFG_NAMES HistogramRegistry registry{"registry", {}}; @@ -129,6 +131,8 @@ struct TreeCreatorPidTpcDiagnostics { o2::aod::rctsel::RCTFlagsChecker rctChecker; + TRandom3 mRnd{}; + using CollisionsExtra = soa::Join; using TrackCandidates = soa::Join; @@ -224,6 +228,10 @@ struct TreeCreatorPidTpcDiagnostics { const auto tracksFromCollision = tracks.sliceBy(perCollisionTracks, static_cast(collision.globalIndex())); for (const auto& track : tracksFromCollision) { + if (*downsampleFactor.at(ParticleId) < 1.f && mRnd.Uniform(1) > *downsampleFactor.at(ParticleId)) { + continue; + } + bool isGoodTrack = isTrackSelected(track, trackSelection); isGoodTrack &= (!requireGlobalTrack || track.isGlobalTrack()); isGoodTrack &= (!requireIts || track.hasITS()); From dd61857a255cc533ff346439b228d80d50f0cbd2 Mon Sep 17 00:00:00 2001 From: Oleksii Lubynets Date: Fri, 9 Oct 2026 18:55:41 +0200 Subject: [PATCH 6/7] fix clang-tidy warnings --- DPG/Tasks/TPC/treeCreatorPidTpcDiagnostics.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/DPG/Tasks/TPC/treeCreatorPidTpcDiagnostics.cxx b/DPG/Tasks/TPC/treeCreatorPidTpcDiagnostics.cxx index 9d81363e6cb..eb26d7a7499 100644 --- a/DPG/Tasks/TPC/treeCreatorPidTpcDiagnostics.cxx +++ b/DPG/Tasks/TPC/treeCreatorPidTpcDiagnostics.cxx @@ -113,8 +113,8 @@ struct TreeCreatorPidTpcDiagnostics { #define MAKE_PARTICLE_CUT_POINTER(Unused, ParticleNameLong, CfgName) \ &particleWiseCfgs.BOOST_PP_CAT(CfgName, ParticleNameLong), -#define PACK_CONFIGURABLES_TO_ARRAY(Unused1, Unused2, CfgName) \ - const std::array*, PID::Alpha + 1> CfgName{ \ +#define PACK_CONFIGURABLES_TO_ARRAY(Unused1, Unused2, CfgName) \ + std::array*, PID::Alpha + 1> CfgName{ \ DO_FOR_ALL_PARTICLES(MAKE_PARTICLE_CUT_POINTER, CfgName)}; BOOST_PP_SEQ_FOR_EACH(PACK_CONFIGURABLES_TO_ARRAY, _, PARTICLE_WISE_CFG_NAMES) @@ -131,7 +131,7 @@ struct TreeCreatorPidTpcDiagnostics { o2::aod::rctsel::RCTFlagsChecker rctChecker; - TRandom3 mRnd{}; + TRandom3 mRnd; using CollisionsExtra = soa::Join; using TrackCandidates = soa::Join; From 8efdba5fda5d882d17650f4b42b3badd375a61d3 Mon Sep 17 00:00:00 2001 From: Oleksii Lubynets Date: Fri, 9 Oct 2026 19:22:37 +0200 Subject: [PATCH 7/7] fix clang-tidy warnings (x2) --- DPG/Tasks/TPC/treeCreatorPidTpcDiagnostics.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DPG/Tasks/TPC/treeCreatorPidTpcDiagnostics.cxx b/DPG/Tasks/TPC/treeCreatorPidTpcDiagnostics.cxx index eb26d7a7499..66b1d831d3c 100644 --- a/DPG/Tasks/TPC/treeCreatorPidTpcDiagnostics.cxx +++ b/DPG/Tasks/TPC/treeCreatorPidTpcDiagnostics.cxx @@ -320,8 +320,8 @@ struct TreeCreatorPidTpcDiagnostics { #undef MAKE_PROCESS_FUNCTIONS }; -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +WorkflowSpec defineDataProcessing(ConfigContext const& context) { - return WorkflowSpec{adaptAnalysisTask(cfgc)}; + return WorkflowSpec{adaptAnalysisTask(context)}; } #undef DO_FOR_ALL_PARTICLES