From 3fcb300e2c2d5a5dbaaec780ddc45de8d5ab51f6 Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Tue, 8 Oct 2024 20:53:00 +0200 Subject: [PATCH 01/14] PWGLF: add strangeness derived QA for debugging and tests --- PWGLF/Tasks/QC/CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/PWGLF/Tasks/QC/CMakeLists.txt b/PWGLF/Tasks/QC/CMakeLists.txt index c640ee82586..511b7ea3ca4 100644 --- a/PWGLF/Tasks/QC/CMakeLists.txt +++ b/PWGLF/Tasks/QC/CMakeLists.txt @@ -113,3 +113,8 @@ o2physics_add_dpl_workflow(mc-particle-predictions SOURCES mcParticlePrediction.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(strange-derived-qa + SOURCES strangederivedqa.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) From b07abc3021a6fc3e2ac583e2138181cf8d6ab254 Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Tue, 8 Oct 2024 20:55:17 +0200 Subject: [PATCH 02/14] Add missing file --- PWGLF/Tasks/QC/strangederivedqa.cxx | 99 +++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 PWGLF/Tasks/QC/strangederivedqa.cxx diff --git a/PWGLF/Tasks/QC/strangederivedqa.cxx b/PWGLF/Tasks/QC/strangederivedqa.cxx new file mode 100644 index 00000000000..cdf4eaa9d44 --- /dev/null +++ b/PWGLF/Tasks/QC/strangederivedqa.cxx @@ -0,0 +1,99 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. +// +// V0 analysis task +// ================ +// +// This code does basic QA of strangeness derived data + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/ASoAHelpers.h" +#include "ReconstructionDataFormats/Track.h" +#include "CommonConstants/PhysicsConstants.h" +#include "Common/Core/trackUtilities.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" +#include "PWGLF/DataModel/LFStrangenessMLTables.h" +#include "PWGLF/DataModel/LFStrangenessPIDTables.h" +#include "Common/Core/TrackSelection.h" +#include "Common/DataModel/TrackSelectionTables.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/PIDResponse.h" +#include "PWGUD/Core/SGSelector.h" +#include "Tools/ML/MlResponse.h" +#include "Tools/ML/model.h" + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; +using std::array; + +using v0Candidates = soa::Join; + +struct strangederivedqa { + HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + + ConfigurableAxis axisNCollisions{"axisNCollisions", {50000, -0.5f, 49999.5f}, "collisions"}; + + void init(InitContext const&) + { + auto h = histos.add("hDFCounter", "hDFCounter", kTH1D, {{6, -0.5f, 5.5f}}); + h->GetXaxis()->SetBinLabel(1, "All"); + h->GetXaxis()->SetBinLabel(2, "Ordered"); + h->GetXaxis()->SetBinLabel(3, "Unordered"); + + auto h = histos.add("hEventCounter", "hEventCounter", kTH1D, {{1, -0.5f, 0.5f}}); + auto h = histos.add("hEventsPerDF", "hEventsPerDF", kTH1D, {axisNCollisions}); + } + +_____________________________________________ + // Real data processing - no MC subscription + void process(aod::StraCollisions const& collisions, v0Candidates const& fullV0s) + { + histos.fill(HIST("hDFCounter"), 0.0f); + histos.fill(HIST("hEventCounter"), 0.0, collisions.size()); + histos.fill(HIST("hEventsPerDF"), collisions.size()); + bool ordered = true; + int previousIndex = -100; + for (auto const& v0 : fullV0s) { + if(v0.straCollisionId() < previousIndex){ + ordered = false; + } + previousIndex = v0.straCollisionId(); + } + if(ordered){ + histos.fill(HIST("hDFCounter"), 1.0f); + }else{ + histos.fill(HIST("hDFCounter"), 2.0f); + } + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc)}; +} From 02a1f09062ff733197f1c162124a97129a52612b Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Tue, 8 Oct 2024 22:15:55 +0200 Subject: [PATCH 03/14] Clean headers --- PWGLF/Tasks/QC/strangederivedqa.cxx | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/PWGLF/Tasks/QC/strangederivedqa.cxx b/PWGLF/Tasks/QC/strangederivedqa.cxx index cdf4eaa9d44..cb442149e07 100644 --- a/PWGLF/Tasks/QC/strangederivedqa.cxx +++ b/PWGLF/Tasks/QC/strangederivedqa.cxx @@ -34,17 +34,6 @@ #include "CommonConstants/PhysicsConstants.h" #include "Common/Core/trackUtilities.h" #include "PWGLF/DataModel/LFStrangenessTables.h" -#include "PWGLF/DataModel/LFStrangenessMLTables.h" -#include "PWGLF/DataModel/LFStrangenessPIDTables.h" -#include "Common/Core/TrackSelection.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/Multiplicity.h" -#include "Common/DataModel/Centrality.h" -#include "Common/DataModel/PIDResponse.h" -#include "PWGUD/Core/SGSelector.h" -#include "Tools/ML/MlResponse.h" -#include "Tools/ML/model.h" using namespace o2; using namespace o2::framework; From 6d92e4011e76c368a28d6b30cd67cef03913bae9 Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Tue, 8 Oct 2024 22:16:53 +0200 Subject: [PATCH 04/14] Bug fixes --- PWGLF/Tasks/QC/strangederivedqa.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PWGLF/Tasks/QC/strangederivedqa.cxx b/PWGLF/Tasks/QC/strangederivedqa.cxx index cb442149e07..e57c5592dcc 100644 --- a/PWGLF/Tasks/QC/strangederivedqa.cxx +++ b/PWGLF/Tasks/QC/strangederivedqa.cxx @@ -54,8 +54,8 @@ struct strangederivedqa { h->GetXaxis()->SetBinLabel(2, "Ordered"); h->GetXaxis()->SetBinLabel(3, "Unordered"); - auto h = histos.add("hEventCounter", "hEventCounter", kTH1D, {{1, -0.5f, 0.5f}}); - auto h = histos.add("hEventsPerDF", "hEventsPerDF", kTH1D, {axisNCollisions}); + auto h2 = histos.add("hEventCounter", "hEventCounter", kTH1D, {{1, -0.5f, 0.5f}}); + auto h3 = histos.add("hEventsPerDF", "hEventsPerDF", kTH1D, {axisNCollisions}); } _____________________________________________ From 04b29eb6995570f26b0506af9ce89617faa8bf98 Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Tue, 8 Oct 2024 22:17:50 +0200 Subject: [PATCH 05/14] Bug fixes 2 --- PWGLF/Tasks/QC/strangederivedqa.cxx | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/PWGLF/Tasks/QC/strangederivedqa.cxx b/PWGLF/Tasks/QC/strangederivedqa.cxx index e57c5592dcc..59e92481f53 100644 --- a/PWGLF/Tasks/QC/strangederivedqa.cxx +++ b/PWGLF/Tasks/QC/strangederivedqa.cxx @@ -40,12 +40,10 @@ using namespace o2::framework; using namespace o2::framework::expressions; using std::array; -using v0Candidates = soa::Join; - struct strangederivedqa { HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; - ConfigurableAxis axisNCollisions{"axisNCollisions", {50000, -0.5f, 49999.5f}, "collisions"}; + ConfigurableAxis axisNCollisions{"axisNCollisions", {50000, -0.5f, 49999.5f}, "collisions"}; void init(InitContext const&) { @@ -58,9 +56,8 @@ struct strangederivedqa { auto h3 = histos.add("hEventsPerDF", "hEventsPerDF", kTH1D, {axisNCollisions}); } -_____________________________________________ // Real data processing - no MC subscription - void process(aod::StraCollisions const& collisions, v0Candidates const& fullV0s) + void process(aod::StraCollisions const& collisions, soa::Join const& fullV0s) { histos.fill(HIST("hDFCounter"), 0.0f); histos.fill(HIST("hEventCounter"), 0.0, collisions.size()); From 2c650614d0560a295c699a3532d18904ce7b4919 Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Wed, 9 Oct 2024 15:48:18 +0200 Subject: [PATCH 06/14] Add original data qa --- PWGLF/Tasks/QC/strangederivedqa.cxx | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/PWGLF/Tasks/QC/strangederivedqa.cxx b/PWGLF/Tasks/QC/strangederivedqa.cxx index 59e92481f53..b433195eaab 100644 --- a/PWGLF/Tasks/QC/strangederivedqa.cxx +++ b/PWGLF/Tasks/QC/strangederivedqa.cxx @@ -56,8 +56,29 @@ struct strangederivedqa { auto h3 = histos.add("hEventsPerDF", "hEventsPerDF", kTH1D, {axisNCollisions}); } - // Real data processing - no MC subscription - void process(aod::StraCollisions const& collisions, soa::Join const& fullV0s) + // Real data processing + void processOriginal(aod::Collisions const& collisions, soa::Join const& fullV0s) + { + histos.fill(HIST("hDFCounter"), 0.0f); + histos.fill(HIST("hEventCounter"), 0.0, collisions.size()); + histos.fill(HIST("hEventsPerDF"), collisions.size()); + bool ordered = true; + int previousIndex = -100; + for (auto const& v0 : fullV0s) { + if(v0.collisionId() < previousIndex){ + ordered = false; + } + previousIndex = v0.collisionId(); + } + if(ordered){ + histos.fill(HIST("hDFCounter"), 1.0f); + }else{ + histos.fill(HIST("hDFCounter"), 2.0f); + } + } + + // Real data processing + void processDerived(aod::StraCollisions const& collisions, soa::Join const& fullV0s) { histos.fill(HIST("hDFCounter"), 0.0f); histos.fill(HIST("hEventCounter"), 0.0, collisions.size()); @@ -76,6 +97,9 @@ struct strangederivedqa { histos.fill(HIST("hDFCounter"), 2.0f); } } + + PROCESS_SWITCH(strangederivedqa, processOriginal, "Process original data", false); + PROCESS_SWITCH(strangederivedqa, processDerived, "Process derived data", true); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From 802d5d02e3bec7c84523fde8aa0f0085ab845456 Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Wed, 9 Oct 2024 20:46:01 +0200 Subject: [PATCH 07/14] Extra information --- PWGLF/Tasks/QC/strangederivedqa.cxx | 42 ++++++++++++++++++++++------- 1 file changed, 32 insertions(+), 10 deletions(-) diff --git a/PWGLF/Tasks/QC/strangederivedqa.cxx b/PWGLF/Tasks/QC/strangederivedqa.cxx index b433195eaab..4865fb84468 100644 --- a/PWGLF/Tasks/QC/strangederivedqa.cxx +++ b/PWGLF/Tasks/QC/strangederivedqa.cxx @@ -44,6 +44,7 @@ struct strangederivedqa { HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; ConfigurableAxis axisNCollisions{"axisNCollisions", {50000, -0.5f, 49999.5f}, "collisions"}; + ConfigurableAxis axisNV0s{"axisNV0s", {50000, -0.5f, 49999.5f}, "V0s"}; void init(InitContext const&) { @@ -52,16 +53,28 @@ struct strangederivedqa { h->GetXaxis()->SetBinLabel(2, "Ordered"); h->GetXaxis()->SetBinLabel(3, "Unordered"); - auto h2 = histos.add("hEventCounter", "hEventCounter", kTH1D, {{1, -0.5f, 0.5f}}); - auto h3 = histos.add("hEventsPerDF", "hEventsPerDF", kTH1D, {axisNCollisions}); + auto h2 = histos.add("hEventCounter", "hEventCounter", kTH1D, {{1, -0.5f, 0.5f}, {3, -0.5f, 2.5f}}); + auto h3 = histos.add("hEventsPerDF", "hEventsPerDF", kTH1D, {axisNCollisions, {3, -0.5f, 2.5f}}); + auto h4 = histos.add("V0sPerDF", "V0sPerDF", kTH1D, {axisNV0s, {3, -0.5f, 2.5f}}); + + h2->GetYaxis()->SetBinLabel(1, "All"); + h2->GetYaxis()->SetBinLabel(2, "Ordered"); + h2->GetYaxis()->SetBinLabel(3, "Unordered"); + h3->GetYaxis()->SetBinLabel(1, "All"); + h3->GetYaxis()->SetBinLabel(2, "Ordered"); + h3->GetYaxis()->SetBinLabel(3, "Unordered"); + h4->GetYaxis()->SetBinLabel(1, "All"); + h4->GetYaxis()->SetBinLabel(2, "Ordered"); + h4->GetYaxis()->SetBinLabel(3, "Unordered"); } // Real data processing void processOriginal(aod::Collisions const& collisions, soa::Join const& fullV0s) { histos.fill(HIST("hDFCounter"), 0.0f); - histos.fill(HIST("hEventCounter"), 0.0, collisions.size()); - histos.fill(HIST("hEventsPerDF"), collisions.size()); + histos.fill(HIST("hEventCounter"), 0.0f, 0.0f, collisions.size()); + histos.fill(HIST("hEventsPerDF"), collisions.size(), 0.0f); + histos.fill(HIST("hV0sPerDF"), fullV0s.size(), 0.0f); bool ordered = true; int previousIndex = -100; for (auto const& v0 : fullV0s) { @@ -71,9 +84,13 @@ struct strangederivedqa { previousIndex = v0.collisionId(); } if(ordered){ - histos.fill(HIST("hDFCounter"), 1.0f); + histos.fill(HIST("hEventCounter"), 0.0f, 1.0f, collisions.size()); + histos.fill(HIST("hEventsPerDF"), collisions.size(), 1.0f); + histos.fill(HIST("hV0sPerDF"), fullV0s.size(), 1.0f); }else{ - histos.fill(HIST("hDFCounter"), 2.0f); + histos.fill(HIST("hEventCounter"), 0.0f, 2.0f, collisions.size()); + histos.fill(HIST("hEventsPerDF"), collisions.size(), 2.0f); + histos.fill(HIST("hV0sPerDF"), fullV0s.size(), 2.0f); } } @@ -81,8 +98,9 @@ struct strangederivedqa { void processDerived(aod::StraCollisions const& collisions, soa::Join const& fullV0s) { histos.fill(HIST("hDFCounter"), 0.0f); - histos.fill(HIST("hEventCounter"), 0.0, collisions.size()); - histos.fill(HIST("hEventsPerDF"), collisions.size()); + histos.fill(HIST("hEventCounter"), 0.0f, 0.0f, collisions.size()); + histos.fill(HIST("hEventsPerDF"), collisions.size(), 0.0f); + histos.fill(HIST("hV0sPerDF"), fullV0s.size(), 0.0f); bool ordered = true; int previousIndex = -100; for (auto const& v0 : fullV0s) { @@ -92,9 +110,13 @@ struct strangederivedqa { previousIndex = v0.straCollisionId(); } if(ordered){ - histos.fill(HIST("hDFCounter"), 1.0f); + histos.fill(HIST("hEventCounter"), 0.0f, 1.0f, collisions.size()); + histos.fill(HIST("hEventsPerDF"), collisions.size(), 1.0f); + histos.fill(HIST("hV0sPerDF"), fullV0s.size(), 1.0f); }else{ - histos.fill(HIST("hDFCounter"), 2.0f); + histos.fill(HIST("hEventCounter"), 0.0f, 2.0f, collisions.size()); + histos.fill(HIST("hEventsPerDF"), collisions.size(), 2.0f); + histos.fill(HIST("hV0sPerDF"), fullV0s.size(), 2.0f); } } From 091b08611deeb22ece674c09ff4fd68b0275f356 Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Wed, 9 Oct 2024 21:22:07 +0200 Subject: [PATCH 08/14] bugfix --- PWGLF/Tasks/QC/strangederivedqa.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/PWGLF/Tasks/QC/strangederivedqa.cxx b/PWGLF/Tasks/QC/strangederivedqa.cxx index 4865fb84468..292d51ec987 100644 --- a/PWGLF/Tasks/QC/strangederivedqa.cxx +++ b/PWGLF/Tasks/QC/strangederivedqa.cxx @@ -53,9 +53,9 @@ struct strangederivedqa { h->GetXaxis()->SetBinLabel(2, "Ordered"); h->GetXaxis()->SetBinLabel(3, "Unordered"); - auto h2 = histos.add("hEventCounter", "hEventCounter", kTH1D, {{1, -0.5f, 0.5f}, {3, -0.5f, 2.5f}}); - auto h3 = histos.add("hEventsPerDF", "hEventsPerDF", kTH1D, {axisNCollisions, {3, -0.5f, 2.5f}}); - auto h4 = histos.add("V0sPerDF", "V0sPerDF", kTH1D, {axisNV0s, {3, -0.5f, 2.5f}}); + auto h2 = histos.add("hEventCounter", "hEventCounter", kTH2D, {{1, -0.5f, 0.5f}, {3, -0.5f, 2.5f}}); + auto h3 = histos.add("hEventsPerDF", "hEventsPerDF", kTH2D, {axisNCollisions, {3, -0.5f, 2.5f}}); + auto h4 = histos.add("V0sPerDF", "V0sPerDF", kTH2D, {axisNV0s, {3, -0.5f, 2.5f}}); h2->GetYaxis()->SetBinLabel(1, "All"); h2->GetYaxis()->SetBinLabel(2, "Ordered"); From f6fa5f3b867ebc3c80bdf0e6a49c94b8ee22e0aa Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Wed, 9 Oct 2024 21:25:04 +0200 Subject: [PATCH 09/14] One more fix --- PWGLF/Tasks/QC/strangederivedqa.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGLF/Tasks/QC/strangederivedqa.cxx b/PWGLF/Tasks/QC/strangederivedqa.cxx index 292d51ec987..58de0269d49 100644 --- a/PWGLF/Tasks/QC/strangederivedqa.cxx +++ b/PWGLF/Tasks/QC/strangederivedqa.cxx @@ -55,7 +55,7 @@ struct strangederivedqa { auto h2 = histos.add("hEventCounter", "hEventCounter", kTH2D, {{1, -0.5f, 0.5f}, {3, -0.5f, 2.5f}}); auto h3 = histos.add("hEventsPerDF", "hEventsPerDF", kTH2D, {axisNCollisions, {3, -0.5f, 2.5f}}); - auto h4 = histos.add("V0sPerDF", "V0sPerDF", kTH2D, {axisNV0s, {3, -0.5f, 2.5f}}); + auto h4 = histos.add("hV0sPerDF", "hV0sPerDF", kTH2D, {axisNV0s, {3, -0.5f, 2.5f}}); h2->GetYaxis()->SetBinLabel(1, "All"); h2->GetYaxis()->SetBinLabel(2, "Ordered"); From e83afbb97b6fce56f4e300872a4d4be1d2fcb6eb Mon Sep 17 00:00:00 2001 From: gianniliveraro Date: Thu, 10 Oct 2024 01:01:48 -0300 Subject: [PATCH 10/14] Extracting DF IDs using Origin table --- PWGLF/Tasks/QC/strangederivedqa.cxx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/PWGLF/Tasks/QC/strangederivedqa.cxx b/PWGLF/Tasks/QC/strangederivedqa.cxx index 58de0269d49..3adffcfe0c0 100644 --- a/PWGLF/Tasks/QC/strangederivedqa.cxx +++ b/PWGLF/Tasks/QC/strangederivedqa.cxx @@ -38,6 +38,7 @@ using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; +using namespace std; using std::array; struct strangederivedqa { @@ -95,7 +96,7 @@ struct strangederivedqa { } // Real data processing - void processDerived(aod::StraCollisions const& collisions, soa::Join const& fullV0s) + void processDerived(aod::StraCollisions const& collisions, aod::Origins const& origins, soa::Join const& fullV0s) { histos.fill(HIST("hDFCounter"), 0.0f); histos.fill(HIST("hEventCounter"), 0.0f, 0.0f, collisions.size()); @@ -117,6 +118,11 @@ struct strangederivedqa { histos.fill(HIST("hEventCounter"), 0.0f, 2.0f, collisions.size()); histos.fill(HIST("hEventsPerDF"), collisions.size(), 2.0f); histos.fill(HIST("hV0sPerDF"), fullV0s.size(), 2.0f); + + for (auto const& origin : origins) { + //uint64_t DF_ID = origin.dataframeID(); + cout << "Unsorted DF ID = " << origin.dataframeID() << endl; + } } } From 327d0c0aab037365491db01f3802037545f20300 Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Thu, 10 Oct 2024 14:03:19 +0200 Subject: [PATCH 11/14] switch origins use to list only dir name --- PWGLF/Tasks/QC/strangederivedqa.cxx | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/PWGLF/Tasks/QC/strangederivedqa.cxx b/PWGLF/Tasks/QC/strangederivedqa.cxx index 3adffcfe0c0..f3c9e072ebf 100644 --- a/PWGLF/Tasks/QC/strangederivedqa.cxx +++ b/PWGLF/Tasks/QC/strangederivedqa.cxx @@ -47,6 +47,8 @@ struct strangederivedqa { ConfigurableAxis axisNCollisions{"axisNCollisions", {50000, -0.5f, 49999.5f}, "collisions"}; ConfigurableAxis axisNV0s{"axisNV0s", {50000, -0.5f, 49999.5f}, "V0s"}; + Configurable verbose{"verbose", false, "do more printouts"}; + void init(InitContext const&) { auto h = histos.add("hDFCounter", "hDFCounter", kTH1D, {{6, -0.5f, 5.5f}}); @@ -70,7 +72,7 @@ struct strangederivedqa { } // Real data processing - void processOriginal(aod::Collisions const& collisions, soa::Join const& fullV0s) + void processOriginal(aod::Collisions const& collisions, aod::Origins const& origins, soa::Join const& fullV0s) { histos.fill(HIST("hDFCounter"), 0.0f); histos.fill(HIST("hEventCounter"), 0.0f, 0.0f, collisions.size()); @@ -88,10 +90,20 @@ struct strangederivedqa { histos.fill(HIST("hEventCounter"), 0.0f, 1.0f, collisions.size()); histos.fill(HIST("hEventsPerDF"), collisions.size(), 1.0f); histos.fill(HIST("hV0sPerDF"), fullV0s.size(), 1.0f); + + if(verbose){ + auto origin = origins.begin(); + LOGF(info, "Sorted DF ID: %lld collisions: %i V0s: %i", origin.dataframeID(), collisions.size(), fullV0s.size()); + } }else{ histos.fill(HIST("hEventCounter"), 0.0f, 2.0f, collisions.size()); histos.fill(HIST("hEventsPerDF"), collisions.size(), 2.0f); histos.fill(HIST("hV0sPerDF"), fullV0s.size(), 2.0f); + + if(verbose){ + auto origin = origins.begin(); + LOGF(info, "Unsorted DF ID: %lld collisions: %i V0s: %i", origin.dataframeID(), collisions.size(), fullV0s.size()); + } } } @@ -114,14 +126,19 @@ struct strangederivedqa { histos.fill(HIST("hEventCounter"), 0.0f, 1.0f, collisions.size()); histos.fill(HIST("hEventsPerDF"), collisions.size(), 1.0f); histos.fill(HIST("hV0sPerDF"), fullV0s.size(), 1.0f); + + if(verbose){ + auto origin = origins.begin(); + LOGF(info, "Sorted DF ID: %lld collisions: %i V0s: %i", origin.dataframeID(), collisions.size(), fullV0s.size()); + } }else{ histos.fill(HIST("hEventCounter"), 0.0f, 2.0f, collisions.size()); histos.fill(HIST("hEventsPerDF"), collisions.size(), 2.0f); histos.fill(HIST("hV0sPerDF"), fullV0s.size(), 2.0f); - for (auto const& origin : origins) { - //uint64_t DF_ID = origin.dataframeID(); - cout << "Unsorted DF ID = " << origin.dataframeID() << endl; + if(verbose){ + auto origin = origins.begin(); + LOGF(info, "Unsorted DF ID: %lld collisions: %i V0s: %i", origin.dataframeID(), collisions.size(), fullV0s.size()); } } } From 7a2b0976d36cbe604af2502aa84aab03e78fdd9b Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Thu, 10 Oct 2024 14:35:15 +0200 Subject: [PATCH 12/14] Add DataFrameID for debug --- PWGLF/DataModel/LFStrangenessTables.h | 9 +++++++++ .../Strangeness/strangederivedbuilder.cxx | 14 ++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/PWGLF/DataModel/LFStrangenessTables.h b/PWGLF/DataModel/LFStrangenessTables.h index 9bdbe5d29f5..82eb0addc28 100644 --- a/PWGLF/DataModel/LFStrangenessTables.h +++ b/PWGLF/DataModel/LFStrangenessTables.h @@ -27,6 +27,15 @@ namespace o2::aod { +// for DF name follow-up and debug +namespace straorigin +{ +DECLARE_SOA_COLUMN(DataframeID, dataframeID, uint64_t); //! Data frame ID (what is usually found in directory name in the AO2D.root, i.e. +} // namespace straorigin + +DECLARE_SOA_TABLE(StraOrigins, "AOD", "STRAORIGIN", //! Table which contains the IDs of all dataframes merged into this dataframe + o2::soa::Index<>, straorigin::DataframeID); + namespace stracollision { DECLARE_SOA_DYNAMIC_COLUMN(IsUPC, isUPC, //! check whether this is a UPC or hadronic collision diff --git a/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx b/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx index 098aca4b874..aa89d593e5d 100644 --- a/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx +++ b/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx @@ -129,6 +129,11 @@ struct strangederivedbuilder { Produces v0FoundTags; Produces cascFoundTags; + //__________________________________________________ + // Debug + Produces straOrigin; + + // histogram registry for bookkeeping HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; @@ -864,6 +869,15 @@ struct strangederivedbuilder { } } + void processDataframeIDs(aod::Origins const& origins) + { + auto origin = origins.begin(); + straOrigin(origin.dataframeID()); + } + + // debug processing + PROCESS_SWITCH(strangederivedbuilder, processDataframeIDs, "Produce data frame ID tags", false); + // collision processing PROCESS_SWITCH(strangederivedbuilder, processCollisions, "Produce collisions", true); PROCESS_SWITCH(strangederivedbuilder, processCollisionsWithUD, "Produce collisions with UD info", true); From 598c4a06151643a887f129332bdf1a85933d9f34 Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Thu, 10 Oct 2024 20:46:10 +0200 Subject: [PATCH 13/14] fix struct counters --- .../Strangeness/strangederivedbuilder.cxx | 54 ++++++++++--------- PWGLF/Tasks/QC/strangederivedqa.cxx | 10 ++-- 2 files changed, 35 insertions(+), 29 deletions(-) diff --git a/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx b/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx index aa89d593e5d..c1e604b580a 100644 --- a/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx +++ b/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx @@ -169,15 +169,17 @@ struct strangederivedbuilder { Configurable roundNSigmaVariables{"roundNSigmaVariables", false, "round NSigma variables"}; Configurable precisionNSigmas{"precisionNSigmas", 0.1f, "precision to keep NSigmas"}; - Configurable fillRawFT0A{"fillRawFT0A", false, "Fill raw FT0A information for debug"}; - Configurable fillRawFT0C{"fillRawFT0C", true, "Fill raw FT0C information for debug"}; - Configurable fillRawFV0A{"fillRawFV0A", false, "Fill raw FV0A information for debug"}; - Configurable fillRawFDDA{"fillRawFDDA", false, "Fill raw FDDA information for debug"}; - Configurable fillRawFDDC{"fillRawFDDC", false, "Fill raw FDDC information for debug"}; - Configurable fillRawZDC{"fillRawZDC", false, "Fill raw ZDC information for debug"}; - Configurable fillRawNTracksEta1{"fillRawNTracksEta1", true, "Fill raw NTracks |eta|<1 information for debug"}; - Configurable fillRawNTracksForCorrelation{"fillRawNTracksForCorrelation", true, "Fill raw NTracks for correlation cuts"}; - Configurable fillTOFInformation{"fillTOFInformation", true, "Fill Daughter Track TOF information"}; + struct : ConfigurableGroup { + Configurable fillRawFT0A{"fillRawFT0A", false, "Fill raw FT0A information for debug"}; + Configurable fillRawFT0C{"fillRawFT0C", true, "Fill raw FT0C information for debug"}; + Configurable fillRawFV0A{"fillRawFV0A", false, "Fill raw FV0A information for debug"}; + Configurable fillRawFDDA{"fillRawFDDA", false, "Fill raw FDDA information for debug"}; + Configurable fillRawFDDC{"fillRawFDDC", false, "Fill raw FDDC information for debug"}; + Configurable fillRawZDC{"fillRawZDC", false, "Fill raw ZDC information for debug"}; + Configurable fillRawNTracksEta1{"fillRawNTracksEta1", true, "Fill raw NTracks |eta|<1 information for debug"}; + Configurable fillRawNTracksForCorrelation{"fillRawNTracksForCorrelation", true, "Fill raw NTracks for correlation cuts"}; + Configurable fillTOFInformation{"fillTOFInformation", true, "Fill Daughter Track TOF information"}; + } fillTruncationOptions; Configurable qaCentrality{"qaCentrality", false, "qa centrality flag: check base raw values"}; struct : ConfigurableGroup { @@ -352,23 +354,23 @@ struct strangederivedbuilder { strangeCents(collision.centFT0M(), collision.centFT0A(), centrality, collision.centFV0A()); strangeEvSels(collision.sel8(), collision.selection_raw(), - collision.multFT0A() * static_cast(fillRawFT0A), - collision.multFT0C() * static_cast(fillRawFT0C), - collision.multFV0A() * static_cast(fillRawFV0A), - collision.multFDDA() * static_cast(fillRawFDDA), - collision.multFDDC() * static_cast(fillRawFDDC), - collision.multNTracksPVeta1() * static_cast(fillRawNTracksEta1), - collision.multPVTotalContributors() * static_cast(fillRawNTracksForCorrelation), - collision.multNTracksGlobal() * static_cast(fillRawNTracksForCorrelation), - collision.multNTracksITSTPC() * static_cast(fillRawNTracksForCorrelation), - collision.multAllTracksTPCOnly() * static_cast(fillRawNTracksForCorrelation), - collision.multAllTracksITSTPC() * static_cast(fillRawNTracksForCorrelation), - collision.multZNA() * static_cast(fillRawZDC), - collision.multZNC() * static_cast(fillRawZDC), - collision.multZEM1() * static_cast(fillRawZDC), - collision.multZEM2() * static_cast(fillRawZDC), - collision.multZPA() * static_cast(fillRawZDC), - collision.multZPC() * static_cast(fillRawZDC), + collision.multFT0A() * static_cast(fillTruncationOptions.fillRawFT0A), + collision.multFT0C() * static_cast(fillTruncationOptions.fillRawFT0C), + collision.multFV0A() * static_cast(fillTruncationOptions.fillRawFV0A), + collision.multFDDA() * static_cast(fillTruncationOptions.fillRawFDDA), + collision.multFDDC() * static_cast(fillTruncationOptions.fillRawFDDC), + collision.multNTracksPVeta1() * static_cast(fillTruncationOptions.fillRawNTracksEta1), + collision.multPVTotalContributors() * static_cast(fillTruncationOptions.fillRawNTracksForCorrelation), + collision.multNTracksGlobal() * static_cast(fillTruncationOptions.fillRawNTracksForCorrelation), + collision.multNTracksITSTPC() * static_cast(fillTruncationOptions.fillRawNTracksForCorrelation), + collision.multAllTracksTPCOnly() * static_cast(fillTruncationOptions.fillRawNTracksForCorrelation), + collision.multAllTracksITSTPC() * static_cast(fillTruncationOptions.fillRawNTracksForCorrelation), + collision.multZNA() * static_cast(fillTruncationOptions.fillRawZDC), + collision.multZNC() * static_cast(fillTruncationOptions.fillRawZDC), + collision.multZEM1() * static_cast(fillTruncationOptions.fillRawZDC), + collision.multZEM2() * static_cast(fillTruncationOptions.fillRawZDC), + collision.multZPA() * static_cast(fillTruncationOptions.fillRawZDC), + collision.multZPC() * static_cast(fillTruncationOptions.fillRawZDC), collision.trackOccupancyInTimeRange(), // UPC info gapSide, diff --git a/PWGLF/Tasks/QC/strangederivedqa.cxx b/PWGLF/Tasks/QC/strangederivedqa.cxx index f3c9e072ebf..c3afe19331a 100644 --- a/PWGLF/Tasks/QC/strangederivedqa.cxx +++ b/PWGLF/Tasks/QC/strangederivedqa.cxx @@ -108,7 +108,7 @@ struct strangederivedqa { } // Real data processing - void processDerived(aod::StraCollisions const& collisions, aod::Origins const& origins, soa::Join const& fullV0s) + void processDerived(aod::StraCollisions const& collisions, aod::StraOrigins const& origins, soa::Join const& fullV0s) { histos.fill(HIST("hDFCounter"), 0.0f); histos.fill(HIST("hEventCounter"), 0.0f, 0.0f, collisions.size()); @@ -129,7 +129,7 @@ struct strangederivedqa { if(verbose){ auto origin = origins.begin(); - LOGF(info, "Sorted DF ID: %lld collisions: %i V0s: %i", origin.dataframeID(), collisions.size(), fullV0s.size()); + LOGF(info, "Sorted DF ID: %lld collisions: %i V0s: %i Origins size: %i", origin.dataframeID(), collisions.size(), fullV0s.size(), origins.size()); } }else{ histos.fill(HIST("hEventCounter"), 0.0f, 2.0f, collisions.size()); @@ -138,7 +138,11 @@ struct strangederivedqa { if(verbose){ auto origin = origins.begin(); - LOGF(info, "Unsorted DF ID: %lld collisions: %i V0s: %i", origin.dataframeID(), collisions.size(), fullV0s.size()); + LOGF(info, "Unsorted DF ID: %lld collisions: %i V0s: %i Origins size: %i", origin.dataframeID(), collisions.size(), fullV0s.size(), origins.size()); + uint64_t directoryName = origin.dataframeID(); + for(auto const& orig : origins){ + LOGF(info, "Unsorted DF ID: %lld separate origin: %lld", directoryName, orig.dataframeID()); + } } } } From 16b27c6cab0b8994e78afb7c32a8f8910f7c9492 Mon Sep 17 00:00:00 2001 From: ALICE Builder Date: Thu, 10 Oct 2024 20:49:11 +0200 Subject: [PATCH 14/14] Please consider the following formatting changes (#347) --- PWGLF/DataModel/LFStrangenessTables.h | 2 +- .../Strangeness/strangederivedbuilder.cxx | 3 +- PWGLF/Tasks/QC/strangederivedqa.cxx | 44 +++++++++---------- 3 files changed, 24 insertions(+), 25 deletions(-) diff --git a/PWGLF/DataModel/LFStrangenessTables.h b/PWGLF/DataModel/LFStrangenessTables.h index 82eb0addc28..cdb3047a4a0 100644 --- a/PWGLF/DataModel/LFStrangenessTables.h +++ b/PWGLF/DataModel/LFStrangenessTables.h @@ -30,7 +30,7 @@ namespace o2::aod // for DF name follow-up and debug namespace straorigin { -DECLARE_SOA_COLUMN(DataframeID, dataframeID, uint64_t); //! Data frame ID (what is usually found in directory name in the AO2D.root, i.e. +DECLARE_SOA_COLUMN(DataframeID, dataframeID, uint64_t); //! Data frame ID (what is usually found in directory name in the AO2D.root, i.e. } // namespace straorigin DECLARE_SOA_TABLE(StraOrigins, "AOD", "STRAORIGIN", //! Table which contains the IDs of all dataframes merged into this dataframe diff --git a/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx b/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx index c1e604b580a..f96c54599b3 100644 --- a/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx +++ b/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx @@ -133,7 +133,6 @@ struct strangederivedbuilder { // Debug Produces straOrigin; - // histogram registry for bookkeeping HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; @@ -873,7 +872,7 @@ struct strangederivedbuilder { void processDataframeIDs(aod::Origins const& origins) { - auto origin = origins.begin(); + auto origin = origins.begin(); straOrigin(origin.dataframeID()); } diff --git a/PWGLF/Tasks/QC/strangederivedqa.cxx b/PWGLF/Tasks/QC/strangederivedqa.cxx index c3afe19331a..2e709e07338 100644 --- a/PWGLF/Tasks/QC/strangederivedqa.cxx +++ b/PWGLF/Tasks/QC/strangederivedqa.cxx @@ -81,28 +81,28 @@ struct strangederivedqa { bool ordered = true; int previousIndex = -100; for (auto const& v0 : fullV0s) { - if(v0.collisionId() < previousIndex){ + if (v0.collisionId() < previousIndex) { ordered = false; } - previousIndex = v0.collisionId(); + previousIndex = v0.collisionId(); } - if(ordered){ + if (ordered) { histos.fill(HIST("hEventCounter"), 0.0f, 1.0f, collisions.size()); histos.fill(HIST("hEventsPerDF"), collisions.size(), 1.0f); histos.fill(HIST("hV0sPerDF"), fullV0s.size(), 1.0f); - if(verbose){ - auto origin = origins.begin(); - LOGF(info, "Sorted DF ID: %lld collisions: %i V0s: %i", origin.dataframeID(), collisions.size(), fullV0s.size()); + if (verbose) { + auto origin = origins.begin(); + LOGF(info, "Sorted DF ID: %lld collisions: %i V0s: %i", origin.dataframeID(), collisions.size(), fullV0s.size()); } - }else{ + } else { histos.fill(HIST("hEventCounter"), 0.0f, 2.0f, collisions.size()); histos.fill(HIST("hEventsPerDF"), collisions.size(), 2.0f); histos.fill(HIST("hV0sPerDF"), fullV0s.size(), 2.0f); - if(verbose){ - auto origin = origins.begin(); - LOGF(info, "Unsorted DF ID: %lld collisions: %i V0s: %i", origin.dataframeID(), collisions.size(), fullV0s.size()); + if (verbose) { + auto origin = origins.begin(); + LOGF(info, "Unsorted DF ID: %lld collisions: %i V0s: %i", origin.dataframeID(), collisions.size(), fullV0s.size()); } } } @@ -117,31 +117,31 @@ struct strangederivedqa { bool ordered = true; int previousIndex = -100; for (auto const& v0 : fullV0s) { - if(v0.straCollisionId() < previousIndex){ + if (v0.straCollisionId() < previousIndex) { ordered = false; } - previousIndex = v0.straCollisionId(); + previousIndex = v0.straCollisionId(); } - if(ordered){ + if (ordered) { histos.fill(HIST("hEventCounter"), 0.0f, 1.0f, collisions.size()); histos.fill(HIST("hEventsPerDF"), collisions.size(), 1.0f); histos.fill(HIST("hV0sPerDF"), fullV0s.size(), 1.0f); - if(verbose){ - auto origin = origins.begin(); - LOGF(info, "Sorted DF ID: %lld collisions: %i V0s: %i Origins size: %i", origin.dataframeID(), collisions.size(), fullV0s.size(), origins.size()); + if (verbose) { + auto origin = origins.begin(); + LOGF(info, "Sorted DF ID: %lld collisions: %i V0s: %i Origins size: %i", origin.dataframeID(), collisions.size(), fullV0s.size(), origins.size()); } - }else{ + } else { histos.fill(HIST("hEventCounter"), 0.0f, 2.0f, collisions.size()); histos.fill(HIST("hEventsPerDF"), collisions.size(), 2.0f); histos.fill(HIST("hV0sPerDF"), fullV0s.size(), 2.0f); - if(verbose){ - auto origin = origins.begin(); - LOGF(info, "Unsorted DF ID: %lld collisions: %i V0s: %i Origins size: %i", origin.dataframeID(), collisions.size(), fullV0s.size(), origins.size()); + if (verbose) { + auto origin = origins.begin(); + LOGF(info, "Unsorted DF ID: %lld collisions: %i V0s: %i Origins size: %i", origin.dataframeID(), collisions.size(), fullV0s.size(), origins.size()); uint64_t directoryName = origin.dataframeID(); - for(auto const& orig : origins){ - LOGF(info, "Unsorted DF ID: %lld separate origin: %lld", directoryName, orig.dataframeID()); + for (auto const& orig : origins) { + LOGF(info, "Unsorted DF ID: %lld separate origin: %lld", directoryName, orig.dataframeID()); } } }