From 69a4d586f7ab549e2aa1cd9933cfeab2760f774c Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Sat, 21 Jun 2025 12:35:06 +0200 Subject: [PATCH 1/5] Add selection bias study data model --- Common/DataModel/SelectionStudyTables.h | 57 +++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 Common/DataModel/SelectionStudyTables.h diff --git a/Common/DataModel/SelectionStudyTables.h b/Common/DataModel/SelectionStudyTables.h new file mode 100644 index 00000000000..a55892d85ac --- /dev/null +++ b/Common/DataModel/SelectionStudyTables.h @@ -0,0 +1,57 @@ +// 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. + +/// \file SelectionStudyTables +/// \brief tables meant to do event selection studies for O-O / light systems +/// +/// \author ALICE + +#include + +#include "Framework/ASoA.h" +#include "Framework/AnalysisDataModel.h" + +#ifndef COMMON_DATAMODEL_SELECTIONSTUDYTABLES_H_ +#define COMMON_DATAMODEL_SELECTIONSTUDYTABLES_H_ + +namespace o2::aod +{ +namespace selectionstudy +{ +DECLARE_SOA_COLUMN(PtPions, ptPions, std::vector); +DECLARE_SOA_COLUMN(PtKaons, ptKaons, std::vector); +DECLARE_SOA_COLUMN(PtProtons, ptProtons, std::vector); +DECLARE_SOA_COLUMN(PtK0s, ptPK0s, std::vector); +DECLARE_SOA_COLUMN(PtLambdas, ptLambdas, std::vector); +DECLARE_SOA_COLUMN(PtXis, ptXis, std::vector); +DECLARE_SOA_COLUMN(PtOmegas, ptOmegas, std::vector); +DECLARE_SOA_COLUMN(PtPhis, ptPhis, std::vector); +DECLARE_SOA_COLUMN(PtKStars, ptKStars, std::vector); +DECLARE_SOA_COLUMN(PtDs, ptDs, std::vector); +DECLARE_SOA_COLUMN(PtLambdaCs, ptLambdaCs, std::vector); +DECLARE_SOA_COLUMN(PtJPsis, ptJPsis, std::vector); +} // namespace selectionstudy + +DECLARE_SOA_TABLE(PIDPts, "AOD", "PIDPTS", o2::soa::Index<>, + o2::aod::selectionstudy::PtPions, + o2::aod::selectionstudy::PtKaons, + o2::aod::selectionstudy::PtProtons, + o2::aod::selectionstudy::PtK0s, + o2::aod::selectionstudy::PtLambdas, + o2::aod::selectionstudy::PtXis, + o2::aod::selectionstudy::PtOmegas, + o2::aod::selectionstudy::PtPhis, + o2::aod::selectionstudy::PtKStars, + o2::aod::selectionstudy::PtDs, + o2::aod::selectionstudy::PtLambdaCs, + o2::aod::selectionstudy::PtJPsis); +} // namespace o2::aod +#endif // COMMON_DATAMODEL_SELECTIONSTUDYTABLES_H_ From 12d10b69a210f4acd65069561d4eb9f74496f5fa Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Sat, 21 Jun 2025 12:35:43 +0200 Subject: [PATCH 2/5] Add selection bias study table producer --- Common/TableProducer/selectionStudyTable.cxx | 133 +++++++++++++++++++ 1 file changed, 133 insertions(+) create mode 100644 Common/TableProducer/selectionStudyTable.cxx diff --git a/Common/TableProducer/selectionStudyTable.cxx b/Common/TableProducer/selectionStudyTable.cxx new file mode 100644 index 00000000000..6086b7a51f4 --- /dev/null +++ b/Common/TableProducer/selectionStudyTable.cxx @@ -0,0 +1,133 @@ +// 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. +// +/// \file selectionStudyTable.cxx +/// \brief Produces tables for centrality selection bias studies +/// +/// \author ALICE +/// + +#include +#include +#include +#include + +#include "Framework/ConfigParamSpec.h" +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/O2DatabasePDGPlugin.h" +#include "Common/DataModel/SelectionStudyTables.h" + + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; + +struct SelectionStudyTable { + Produces pidpts; + + // could be done in a vector of vectors + // left for future iteration + std::vector ptpi; + std::vector ptka; + std::vector ptpr; + std::vector ptk0; + std::vector ptla; + std::vector ptxi; + std::vector ptom; + std::vector ptph; + std::vector ptks; + std::vector ptd; + std::vector ptlc; + std::vector ptjp; + + void init(InitContext&) + { + } + + void process(aod::McCollision const& mcCollision, aod::McParticles const& mcParticles) + { + ptpi.clear(); + ptka.clear(); + ptpr.clear(); + ptk0.clear(); + ptla.clear(); + ptxi.clear(); + ptom.clear(); + ptph.clear(); + ptks.clear(); + ptd.clear(); + ptlc.clear(); + ptjp.clear(); + for (auto const& mcPart : mcParticles) { + if(std::fabs(mcPart.y())>0.5){ + continue; // only do midrapidity particles + } + + // handle resonances first to make sure phys prim crit does not reject them + if(mcPart.pdgCode()==333){ + ptph.push_back(mcPart.pt()); + } + if(std::abs(mcPart.pdgCode())==313){ + ptks.push_back(mcPart.pt()); + } + + // resonances handled, move to primaries + if (!mcPart.isPhysicalPrimary()) { + continue; + } + if(std::abs(mcPart.pdgCode())==211){ + ptpi.push_back(mcPart.pt()); + } + if(std::abs(mcPart.pdgCode())==321){ + ptka.push_back(mcPart.pt()); + } + if(std::abs(mcPart.pdgCode())==2212){ + ptpr.push_back(mcPart.pt()); + } + if(std::abs(mcPart.pdgCode())==310){ + ptk0.push_back(mcPart.pt()); + } + if(std::abs(mcPart.pdgCode())==3122){ + ptla.push_back(mcPart.pt()); + } + if(std::abs(mcPart.pdgCode())==3312){ + ptxi.push_back(mcPart.pt()); + } + if(std::abs(mcPart.pdgCode())==3334){ + ptom.push_back(mcPart.pt()); + } + if(std::abs(mcPart.pdgCode())==3334){ + ptom.push_back(mcPart.pt()); + } + // inclusive HF for now + if(std::abs(mcPart.pdgCode())==421){ + ptd.push_back(mcPart.pt()); + } + if(std::abs(mcPart.pdgCode())==4122){ + ptd.push_back(mcPart.pt()); + } + if(std::abs(mcPart.pdgCode())==443){ + ptjp.push_back(mcPart.pt()); + } + } + + pidpts(ptpi, ptka, ptpr, ptk0, ptla, ptxi, ptom, ptph, ptks, ptd, ptlc, ptjp); + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc)}; +} From 08bcc95d037985505bd1b345a75d58b5bbf86462 Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Sat, 21 Jun 2025 12:36:19 +0200 Subject: [PATCH 3/5] Update CMakeLists.txt --- Common/TableProducer/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Common/TableProducer/CMakeLists.txt b/Common/TableProducer/CMakeLists.txt index 62211406807..502f3c3d076 100644 --- a/Common/TableProducer/CMakeLists.txt +++ b/Common/TableProducer/CMakeLists.txt @@ -160,3 +160,7 @@ o2physics_add_dpl_workflow(muon-realignment PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2::DetectorsBase O2::DetectorsCommonDataFormats O2::MathUtils O2::MCHTracking O2::DataFormatsMCH O2::GlobalTracking O2::MCHBase O2::MCHGeometryTransformer O2::CommonUtils COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(selectionstudytable + SOURCES selectionStudyTable.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) From 9972e154dc206f480857cae4051d59e73ba2b1f6 Mon Sep 17 00:00:00 2001 From: ALICE Builder Date: Sat, 21 Jun 2025 12:37:54 +0200 Subject: [PATCH 4/5] Please consider the following formatting changes (#433) --- Common/DataModel/SelectionStudyTables.h | 8 +-- Common/TableProducer/selectionStudyTable.cxx | 72 ++++++++++---------- 2 files changed, 40 insertions(+), 40 deletions(-) diff --git a/Common/DataModel/SelectionStudyTables.h b/Common/DataModel/SelectionStudyTables.h index a55892d85ac..3a62c30b267 100644 --- a/Common/DataModel/SelectionStudyTables.h +++ b/Common/DataModel/SelectionStudyTables.h @@ -14,11 +14,11 @@ /// /// \author ALICE -#include - #include "Framework/ASoA.h" #include "Framework/AnalysisDataModel.h" +#include + #ifndef COMMON_DATAMODEL_SELECTIONSTUDYTABLES_H_ #define COMMON_DATAMODEL_SELECTIONSTUDYTABLES_H_ @@ -40,8 +40,8 @@ DECLARE_SOA_COLUMN(PtLambdaCs, ptLambdaCs, std::vector); DECLARE_SOA_COLUMN(PtJPsis, ptJPsis, std::vector); } // namespace selectionstudy -DECLARE_SOA_TABLE(PIDPts, "AOD", "PIDPTS", o2::soa::Index<>, - o2::aod::selectionstudy::PtPions, +DECLARE_SOA_TABLE(PIDPts, "AOD", "PIDPTS", o2::soa::Index<>, + o2::aod::selectionstudy::PtPions, o2::aod::selectionstudy::PtKaons, o2::aod::selectionstudy::PtProtons, o2::aod::selectionstudy::PtK0s, diff --git a/Common/TableProducer/selectionStudyTable.cxx b/Common/TableProducer/selectionStudyTable.cxx index 6086b7a51f4..8ee84134cf3 100644 --- a/Common/TableProducer/selectionStudyTable.cxx +++ b/Common/TableProducer/selectionStudyTable.cxx @@ -15,20 +15,20 @@ /// \author ALICE /// -#include -#include -#include -#include +#include "Common/DataModel/SelectionStudyTables.h" -#include "Framework/ConfigParamSpec.h" -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" +#include "Framework/ASoAHelpers.h" #include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/ConfigParamSpec.h" #include "Framework/HistogramRegistry.h" -#include "Framework/ASoAHelpers.h" #include "Framework/O2DatabasePDGPlugin.h" -#include "Common/DataModel/SelectionStudyTables.h" +#include "Framework/runDataProcessing.h" +#include +#include +#include +#include using namespace o2; using namespace o2::framework; @@ -39,18 +39,18 @@ struct SelectionStudyTable { // could be done in a vector of vectors // left for future iteration - std::vector ptpi; - std::vector ptka; - std::vector ptpr; - std::vector ptk0; - std::vector ptla; - std::vector ptxi; - std::vector ptom; - std::vector ptph; - std::vector ptks; - std::vector ptd; - std::vector ptlc; - std::vector ptjp; + std::vector ptpi; + std::vector ptka; + std::vector ptpr; + std::vector ptk0; + std::vector ptla; + std::vector ptxi; + std::vector ptom; + std::vector ptph; + std::vector ptks; + std::vector ptd; + std::vector ptlc; + std::vector ptjp; void init(InitContext&) { @@ -71,15 +71,15 @@ struct SelectionStudyTable { ptlc.clear(); ptjp.clear(); for (auto const& mcPart : mcParticles) { - if(std::fabs(mcPart.y())>0.5){ + if (std::fabs(mcPart.y()) > 0.5) { continue; // only do midrapidity particles } // handle resonances first to make sure phys prim crit does not reject them - if(mcPart.pdgCode()==333){ + if (mcPart.pdgCode() == 333) { ptph.push_back(mcPart.pt()); } - if(std::abs(mcPart.pdgCode())==313){ + if (std::abs(mcPart.pdgCode()) == 313) { ptks.push_back(mcPart.pt()); } @@ -87,38 +87,38 @@ struct SelectionStudyTable { if (!mcPart.isPhysicalPrimary()) { continue; } - if(std::abs(mcPart.pdgCode())==211){ + if (std::abs(mcPart.pdgCode()) == 211) { ptpi.push_back(mcPart.pt()); } - if(std::abs(mcPart.pdgCode())==321){ + if (std::abs(mcPart.pdgCode()) == 321) { ptka.push_back(mcPart.pt()); } - if(std::abs(mcPart.pdgCode())==2212){ + if (std::abs(mcPart.pdgCode()) == 2212) { ptpr.push_back(mcPart.pt()); } - if(std::abs(mcPart.pdgCode())==310){ + if (std::abs(mcPart.pdgCode()) == 310) { ptk0.push_back(mcPart.pt()); } - if(std::abs(mcPart.pdgCode())==3122){ + if (std::abs(mcPart.pdgCode()) == 3122) { ptla.push_back(mcPart.pt()); } - if(std::abs(mcPart.pdgCode())==3312){ + if (std::abs(mcPart.pdgCode()) == 3312) { ptxi.push_back(mcPart.pt()); } - if(std::abs(mcPart.pdgCode())==3334){ + if (std::abs(mcPart.pdgCode()) == 3334) { ptom.push_back(mcPart.pt()); } - if(std::abs(mcPart.pdgCode())==3334){ + if (std::abs(mcPart.pdgCode()) == 3334) { ptom.push_back(mcPart.pt()); } - // inclusive HF for now - if(std::abs(mcPart.pdgCode())==421){ + // inclusive HF for now + if (std::abs(mcPart.pdgCode()) == 421) { ptd.push_back(mcPart.pt()); } - if(std::abs(mcPart.pdgCode())==4122){ + if (std::abs(mcPart.pdgCode()) == 4122) { ptd.push_back(mcPart.pt()); } - if(std::abs(mcPart.pdgCode())==443){ + if (std::abs(mcPart.pdgCode()) == 443) { ptjp.push_back(mcPart.pt()); } } From 16d0109efa7846f19848f6ff656d869d3ceae996 Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Sat, 21 Jun 2025 12:57:38 +0200 Subject: [PATCH 5/5] Update selectionStudyTable.cxx --- Common/TableProducer/selectionStudyTable.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Common/TableProducer/selectionStudyTable.cxx b/Common/TableProducer/selectionStudyTable.cxx index 8ee84134cf3..4d27e358ed1 100644 --- a/Common/TableProducer/selectionStudyTable.cxx +++ b/Common/TableProducer/selectionStudyTable.cxx @@ -56,7 +56,7 @@ struct SelectionStudyTable { { } - void process(aod::McCollision const& mcCollision, aod::McParticles const& mcParticles) + void process(aod::McCollision const&, aod::McParticles const& mcParticles) { ptpi.clear(); ptka.clear();