From 25d3b560bfa61cafeee2e96e33ed02d1a21bdbc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Tue, 16 Dec 2025 07:38:31 +0100 Subject: [PATCH] Refactor includes and simplify vertex histogram addition Reordered includes and removed conditional for adding vertex histograms. --- ALICE3/Tasks/alice3-qa-singleparticle.cxx | 43 ++++++++++++++++------- 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/ALICE3/Tasks/alice3-qa-singleparticle.cxx b/ALICE3/Tasks/alice3-qa-singleparticle.cxx index 1c8f0f19330..66251deb281 100644 --- a/ALICE3/Tasks/alice3-qa-singleparticle.cxx +++ b/ALICE3/Tasks/alice3-qa-singleparticle.cxx @@ -15,13 +15,13 @@ /// \brief Task to monitor the single particle QA, at the particle and track level, showing the tracked and the origin of particles /// -// O2 includes -#include "Framework/AnalysisTask.h" -#include "Framework/runDataProcessing.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/O2DatabasePDGPlugin.h" -#include "TDatabasePDG.h" -#include "TMCProcess.h" +#include +#include +#include +#include + +#include +#include using namespace o2; using namespace o2::framework; @@ -97,11 +97,9 @@ struct Alice3SingleParticle { const AxisSpec axisProdz{prodBinsZ, prodMinZ, prodMaxZ, "Prod. Vertex Z (cm)"}; const AxisSpec axisProdRadius{prodBins, 0., 2. * prodMax, "Prod. Vertex Radius (cm)"}; - if (!doprocessParticleOnly) { - histos.add("event/VtxX", "Vertex X", kTH1D, {axisVx}); - histos.add("event/VtxY", "Vertex Y", kTH1D, {axisVy}); - histos.add("event/VtxZ", "Vertex Z", kTH1D, {axisVz}); - } + histos.add("event/VtxX", "Vertex X", kTH1D, {axisVx}); + histos.add("event/VtxY", "Vertex Y", kTH1D, {axisVy}); + histos.add("event/VtxZ", "Vertex Z", kTH1D, {axisVz}); histos.add("particle/PDGs", "Particle PDGs", kTH2D, {axisPDGs, axisCharge}); histos.add("particle/PDGsPrimaries", "Particle PDGs of Primaries", kTH2D, {axisPDGs, axisCharge}); @@ -145,6 +143,7 @@ struct Alice3SingleParticle { histos.add("particle/Py", "Particle Py " + tit, kTH1D, {axisPy}); histos.add("particle/Pz", "Particle Pz " + tit, kTH1D, {axisPz}); + histos.add("particle/daughters/Number", "Number of Daughters " + tit, kTH1D, {{20, -0.5, 19.5}}); histos.add("particle/daughters/PDGs", "Daughters PDGs " + tit, kTH2D, {axisPDGs, axisCharge}); histos.add("particle/daughters/PDGsPrimaries", "Daughters PDGs Primaries of " + tit, kTH2D, {axisPDGs, axisCharge}); histos.add("particle/daughters/PDGsSecondaries", "Daughters PDGs Secondaries of " + tit, kTH2D, {axisPDGs, axisCharge}); @@ -158,6 +157,7 @@ struct Alice3SingleParticle { histos.add("particle/daughters/prodRadiusVsPt", "Daughters Prod. Vertex Radius " + tit, kTH2D, {axisPt, axisProdRadius}); histos.add("particle/daughters/prodRadius3DVsPt", "Daughters Prod. Vertex Radius XYZ " + tit, kTH2D, {axisPt, axisProdRadius}); + histos.add("particle/mothers/Number", "Number of Mothers " + tit, kTH1D, {{20, -0.5, 19.5}}); histos.add("particle/mothers/PDGs", "Mothers PDGs " + tit, kTH2D, {axisPDGs, axisCharge}); histos.add("particle/mothers/PDGsPrimaries", "Mothers PDGs Primaries of " + tit, kTH2D, {axisPDGs, axisCharge}); histos.add("particle/mothers/PDGsSecondaries", "Mothers PDGs Secondaries of " + tit, kTH2D, {axisPDGs, axisCharge}); @@ -167,6 +167,8 @@ struct Alice3SingleParticle { histos.add("particle/mothers/prodRadiusVsPt", "Mothers Prod. Vertex Radius " + tit, kTH2D, {axisPt, axisProdRadius}); histos.add("particle/mothers/prodRadius3DVsPt", "Mothers Prod. Vertex Radius XYZ " + tit, kTH2D, {axisPt, axisProdRadius}); + // Go up one generation + histos.add("particle/mothers/mothers/Number", "Number of Mothers mothers " + tit, kTH1D, {{20, -0.5, 19.5}}); histos.add("particle/mothers/mothers/PDGs", "Mothers mothers PDGs " + tit, kTH2D, {axisPDGs, axisCharge}); histos.add("particle/mothers/mothers/PDGsPrimaries", "Mothers mothers PDGs Primaries of " + tit, kTH2D, {axisPDGs, axisCharge}); histos.add("particle/mothers/mothers/PDGsSecondaries", "Mothers mothers PDGs Secondaries of " + tit, kTH2D, {axisPDGs, axisCharge}); @@ -272,6 +274,7 @@ struct Alice3SingleParticle { histos.fill(HIST("particle/prodVz"), mcParticle.vz()); if (mcParticle.has_daughters()) { auto daughters = mcParticle.daughters_as(); + histos.fill(HIST("particle/daughters/Number"), daughters.size()); for (const auto& daughter : daughters) { const auto& pdgStringDau = getPdgCodeString(daughter); const auto& pdgChargeDau = getCharge(daughter); @@ -293,6 +296,8 @@ struct Alice3SingleParticle { histos.fill(HIST("particle/daughters/prodRadiusVsPt"), mcParticle.pt(), std::sqrt(daughter.vx() * daughter.vx() + daughter.vy() * daughter.vy())); histos.fill(HIST("particle/daughters/prodRadius3DVsPt"), mcParticle.pt(), std::sqrt(daughter.vx() * daughter.vx() + daughter.vy() * daughter.vy() + daughter.vz() * daughter.vz())); } + } else { + histos.fill(HIST("particle/daughters/Number"), 0.f); } if (mcParticle.has_mothers()) { const auto& mothers = mcParticle.mothers_as(); @@ -415,8 +420,14 @@ struct Alice3SingleParticle { } PROCESS_SWITCH(Alice3SingleParticle, processStandard, "Process IU tracks", true); - void processParticleOnly(const aod::McParticles& mcParticles) + void processParticleOnly(const o2::aod::McCollisions& colls, + const aod::McParticles& mcParticles) { + for (const auto& col : colls) { + histos.fill(HIST("event/VtxX"), col.posX()); + histos.fill(HIST("event/VtxY"), col.posY()); + histos.fill(HIST("event/VtxZ"), col.posZ()); + } for (const auto& mcParticle : mcParticles) { const auto& pdgString = getPdgCodeString(mcParticle); const auto& pdgCharge = getCharge(mcParticle); @@ -467,6 +478,7 @@ struct Alice3SingleParticle { histos.fill(HIST("particle/prodVz"), mcParticle.vz()); if (mcParticle.has_daughters()) { auto daughters = mcParticle.daughters_as(); + histos.fill(HIST("particle/daughters/Number"), daughters.size()); for (const auto& daughter : daughters) { const auto& pdgStringDau = getPdgCodeString(daughter); const auto& pdgChargeDau = getCharge(daughter); @@ -484,6 +496,8 @@ struct Alice3SingleParticle { histos.fill(HIST("particle/daughters/prodRadiusVsPt"), mcParticle.pt(), std::sqrt(mcParticle.vx() * mcParticle.vx() + mcParticle.vy() * mcParticle.vy())); histos.fill(HIST("particle/daughters/prodRadius3DVsPt"), mcParticle.pt(), std::sqrt(mcParticle.vx() * mcParticle.vx() + mcParticle.vy() * mcParticle.vy() + mcParticle.vz() * mcParticle.vz())); } + } else { + histos.fill(HIST("particle/daughters/Number"), 0.f); } if (mcParticle.has_mothers()) { auto mothers = mcParticle.mothers_as(); @@ -586,6 +600,7 @@ struct Alice3SingleParticle { histos.fill(HIST("particle/prodVz"), mcParticle.vz()); if (mcParticle.has_daughters()) { auto daughters = mcParticle.daughters_as(); + histos.fill(HIST("particle/daughters/Number"), daughters.size()); for (const auto& daughter : daughters) { const auto& pdgStringDau = getPdgCodeString(daughter); const auto& pdgChargeDau = getCharge(daughter); @@ -603,6 +618,8 @@ struct Alice3SingleParticle { histos.fill(HIST("particle/daughters/prodRadiusVsPt"), mcParticle.pt(), std::sqrt(mcParticle.vx() * mcParticle.vx() + mcParticle.vy() * mcParticle.vy())); histos.fill(HIST("particle/daughters/prodRadius3DVsPt"), mcParticle.pt(), std::sqrt(mcParticle.vx() * mcParticle.vx() + mcParticle.vy() * mcParticle.vy() + mcParticle.vz() * mcParticle.vz())); } + } else { + histos.fill(HIST("particle/daughters/Number"), 0.f); } if (mcParticle.has_mothers()) { auto mothers = mcParticle.mothers_as();