From 734b72235948bbaf2422aa18b2aa97a7db748531 Mon Sep 17 00:00:00 2001 From: Sebastian Scheid Date: Wed, 13 Aug 2025 11:26:44 +0200 Subject: [PATCH 1/5] Add task for model predictions for meson spectra --- PWGEM/Dilepton/Tasks/CMakeLists.txt | 4 ++ .../Tasks/mcParticlePredictionsOTF.cxx | 63 +++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 PWGEM/Dilepton/Tasks/mcParticlePredictionsOTF.cxx diff --git a/PWGEM/Dilepton/Tasks/CMakeLists.txt b/PWGEM/Dilepton/Tasks/CMakeLists.txt index 94ccb5f2ea4..fb0fb81fbcc 100644 --- a/PWGEM/Dilepton/Tasks/CMakeLists.txt +++ b/PWGEM/Dilepton/Tasks/CMakeLists.txt @@ -161,3 +161,7 @@ o2physics_add_dpl_workflow(dimuon-hadron-mpc PUBLIC_LINK_LIBRARIES O2::Framework O2::DetectorsBase O2Physics::AnalysisCore O2Physics::MLCore O2Physics::PWGEMDileptonCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(mc-particle-predictions-otf + SOURCES mcParticlePredictionsOTF.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore + COMPONENT_NAME Analysis) diff --git a/PWGEM/Dilepton/Tasks/mcParticlePredictionsOTF.cxx b/PWGEM/Dilepton/Tasks/mcParticlePredictionsOTF.cxx new file mode 100644 index 00000000000..6d8908ce59c --- /dev/null +++ b/PWGEM/Dilepton/Tasks/mcParticlePredictionsOTF.cxx @@ -0,0 +1,63 @@ +// 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 mcParticlePrediction.cxx +/// \author Sebastian Scheid, s.scheid@cern.ch +/// \brief Task to build the predictions from the models based on the generated particles +/// + +#include "Framework/AnalysisTask.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/runDataProcessing.h" + +using namespace o2; +using namespace o2::framework; + +struct otfParticlePrediction { + // histogram registry + HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + // define configurables + ConfigurableAxis binsEta{"binsEta", {100, -5, 5}, "Binning of the Eta axis"}; + ConfigurableAxis binsPt{"binsPt", {100, 0, 10}, "Binning of the Pt axis"}; + + // init function + void init() + { + + const AxisSpec axisEta{binsEta, "#eta"}; + const AxisSpec axisPt{binsPt, "#it{p}_{T} (GeV/#it{c})"}; + + histos.add("collisions/generated", "collisions", kTH1D, {{1, -0.5, 0.5}}); + histos.add("particles/generated/phi", "phi", kTH2D, {axisPt, axisEta}); + } + + void process(aod::McCollisions const& mcCollisions, + aod::McParticles const& mcParticles) + { + for (const auto& collission : mcCollisions) { + histos.fill(HIST("collisions/generated"), 0); + } + + for (const auto& particle : mcParticles) { + if (std::abs(particle.pdgCode()) == 333) // phi + { + histos.fill(HIST("particles/generated/phi"), particle.pt(), particle.eta()); + } + } + } +}; + +WorkflowSpec + defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc)}; +} From 1784321120b36b4609697c3edc951f31b2fc5668 Mon Sep 17 00:00:00 2001 From: Sebastian Scheid Date: Wed, 13 Aug 2025 11:57:21 +0200 Subject: [PATCH 2/5] Add more mesons used in LF cocktail --- .../Tasks/mcParticlePredictionsOTF.cxx | 36 +++++++++++++++++-- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/PWGEM/Dilepton/Tasks/mcParticlePredictionsOTF.cxx b/PWGEM/Dilepton/Tasks/mcParticlePredictionsOTF.cxx index 6d8908ce59c..a068f459c12 100644 --- a/PWGEM/Dilepton/Tasks/mcParticlePredictionsOTF.cxx +++ b/PWGEM/Dilepton/Tasks/mcParticlePredictionsOTF.cxx @@ -37,6 +37,11 @@ struct otfParticlePrediction { const AxisSpec axisPt{binsPt, "#it{p}_{T} (GeV/#it{c})"}; histos.add("collisions/generated", "collisions", kTH1D, {{1, -0.5, 0.5}}); + histos.add("particles/generated/pi0", "pi0", kTH2D, {axisPt, axisEta}); + histos.add("particles/generated/eta", "eta", kTH2D, {axisPt, axisEta}); + histos.add("particles/generated/etaP", "etaP", kTH2D, {axisPt, axisEta}); + histos.add("particles/generated/rho", "rho", kTH2D, {axisPt, axisEta}); + histos.add("particles/generated/omega", "omega", kTH2D, {axisPt, axisEta}); histos.add("particles/generated/phi", "phi", kTH2D, {axisPt, axisEta}); } @@ -48,9 +53,34 @@ struct otfParticlePrediction { } for (const auto& particle : mcParticles) { - if (std::abs(particle.pdgCode()) == 333) // phi - { - histos.fill(HIST("particles/generated/phi"), particle.pt(), particle.eta()); + auto pdg = std::abs(particle.pdgCode()); + if (pdg < 100) { + continue; + } + if (pdg > 1000) { + continue; + } + switch (pdg) { + case 111: + histos.fill(HIST("particles/generated/pi0"), particle.pt(), particle.eta()); + break; + case 221: + histos.fill(HIST("particles/generated/eta"), particle.pt(), particle.eta()); + break; + case 331: + histos.fill(HIST("particles/generated/etaP"), particle.pt(), particle.eta()); + break; + case 223: + histos.fill(HIST("particles/generated/omega"), particle.pt(), particle.eta()); + break; + case 113: + histos.fill(HIST("particles/generated/rho"), particle.pt(), particle.eta()); + break; + case 333: + histos.fill(HIST("particles/generated/phi"), particle.pt(), particle.eta()); + break; + default: + break; } } } From ffd6b30f41d3a72fd53c713c11059254b8e8a7ad Mon Sep 17 00:00:00 2001 From: Sebastian Scheid Date: Wed, 13 Aug 2025 13:39:39 +0200 Subject: [PATCH 3/5] Add counter for collisions in z +- 10 --- PWGEM/Dilepton/Tasks/mcParticlePredictionsOTF.cxx | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/PWGEM/Dilepton/Tasks/mcParticlePredictionsOTF.cxx b/PWGEM/Dilepton/Tasks/mcParticlePredictionsOTF.cxx index a068f459c12..02124fc60d5 100644 --- a/PWGEM/Dilepton/Tasks/mcParticlePredictionsOTF.cxx +++ b/PWGEM/Dilepton/Tasks/mcParticlePredictionsOTF.cxx @@ -29,14 +29,17 @@ struct otfParticlePrediction { ConfigurableAxis binsEta{"binsEta", {100, -5, 5}, "Binning of the Eta axis"}; ConfigurableAxis binsPt{"binsPt", {100, 0, 10}, "Binning of the Pt axis"}; + configurable maxEtaParticle{"maxEtaParticle", 5.0, "Max eta of particles considered"} + // init function - void init() + void + init() { const AxisSpec axisEta{binsEta, "#eta"}; const AxisSpec axisPt{binsPt, "#it{p}_{T} (GeV/#it{c})"}; - histos.add("collisions/generated", "collisions", kTH1D, {{1, -0.5, 0.5}}); + histos.add("collisions/generated", "collisions", kTH1D, {{2, -0.5, 1.5}}); histos.add("particles/generated/pi0", "pi0", kTH2D, {axisPt, axisEta}); histos.add("particles/generated/eta", "eta", kTH2D, {axisPt, axisEta}); histos.add("particles/generated/etaP", "etaP", kTH2D, {axisPt, axisEta}); @@ -48,12 +51,18 @@ struct otfParticlePrediction { void process(aod::McCollisions const& mcCollisions, aod::McParticles const& mcParticles) { - for (const auto& collission : mcCollisions) { + for (const auto& collision : mcCollisions) { histos.fill(HIST("collisions/generated"), 0); + if (std::abs(collision.posZ())) { + histos.fill(HIST("collisions/generated"), 1); + } } for (const auto& particle : mcParticles) { auto pdg = std::abs(particle.pdgCode()); + if (particle.eta() < maxEtaParticle) { + continue; + } if (pdg < 100) { continue; } From 83f3b80294f8551714bbfba23152cf5db86ce237 Mon Sep 17 00:00:00 2001 From: Sebastian Scheid Date: Wed, 13 Aug 2025 13:49:00 +0200 Subject: [PATCH 4/5] Fix code, remove event loop for now --- PWGEM/Dilepton/Tasks/mcParticlePredictionsOTF.cxx | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/PWGEM/Dilepton/Tasks/mcParticlePredictionsOTF.cxx b/PWGEM/Dilepton/Tasks/mcParticlePredictionsOTF.cxx index 02124fc60d5..5504e45b3aa 100644 --- a/PWGEM/Dilepton/Tasks/mcParticlePredictionsOTF.cxx +++ b/PWGEM/Dilepton/Tasks/mcParticlePredictionsOTF.cxx @@ -29,7 +29,7 @@ struct otfParticlePrediction { ConfigurableAxis binsEta{"binsEta", {100, -5, 5}, "Binning of the Eta axis"}; ConfigurableAxis binsPt{"binsPt", {100, 0, 10}, "Binning of the Pt axis"}; - configurable maxEtaParticle{"maxEtaParticle", 5.0, "Max eta of particles considered"} + Configurable maxEtaParticle{"maxEtaParticle", 5.f, "Max eta of particles considered"}; // init function void @@ -51,12 +51,8 @@ struct otfParticlePrediction { void process(aod::McCollisions const& mcCollisions, aod::McParticles const& mcParticles) { - for (const auto& collision : mcCollisions) { - histos.fill(HIST("collisions/generated"), 0); - if (std::abs(collision.posZ())) { - histos.fill(HIST("collisions/generated"), 1); - } - } + + histos.fill(HIST("collisions/generated"), 0, mcCollisions.size()); for (const auto& particle : mcParticles) { auto pdg = std::abs(particle.pdgCode()); From 787226797f3a133c1ab63d20679e4e4a9f81ea50 Mon Sep 17 00:00:00 2001 From: Sebastian Scheid Date: Wed, 13 Aug 2025 15:49:05 +0200 Subject: [PATCH 5/5] Select physical primary particles. --- PWGEM/Dilepton/Tasks/mcParticlePredictionsOTF.cxx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/PWGEM/Dilepton/Tasks/mcParticlePredictionsOTF.cxx b/PWGEM/Dilepton/Tasks/mcParticlePredictionsOTF.cxx index 5504e45b3aa..4ebd94f90a1 100644 --- a/PWGEM/Dilepton/Tasks/mcParticlePredictionsOTF.cxx +++ b/PWGEM/Dilepton/Tasks/mcParticlePredictionsOTF.cxx @@ -59,6 +59,9 @@ struct otfParticlePrediction { if (particle.eta() < maxEtaParticle) { continue; } + if (!particle.isPhysicalPrimary()) { + continue; + } if (pdg < 100) { continue; }