From 63792d9d26130b7ebfe130e2914ca390c2cc7bba Mon Sep 17 00:00:00 2001 From: fchinu Date: Tue, 30 Sep 2025 19:08:59 +0200 Subject: [PATCH 1/6] Add checkMcPvContr task --- PWGHF/Tasks/CMakeLists.txt | 10 ++ PWGHF/Tasks/checkMcPvContr.cxx | 167 +++++++++++++++++++++++++++++++++ 2 files changed, 177 insertions(+) create mode 100644 PWGHF/Tasks/checkMcPvContr.cxx diff --git a/PWGHF/Tasks/CMakeLists.txt b/PWGHF/Tasks/CMakeLists.txt index b212b705b23..43307a440d0 100644 --- a/PWGHF/Tasks/CMakeLists.txt +++ b/PWGHF/Tasks/CMakeLists.txt @@ -49,6 +49,16 @@ o2physics_add_dpl_workflow(task-pid-studies PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::EventFilteringUtils O2Physics::AnalysisCCDB COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(check-mc-pv-contr + SOURCES checkMcPvContr.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::EventFilteringUtils + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(check-aod + SOURCES checkAod.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::EventFilteringUtils O2Physics::AnalysisCCDB + COMPONENT_NAME Analysis) + # o2physics_add_dpl_workflow(task-sel-optimisation # SOURCES taskSelOptimisation.cxx # PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore diff --git a/PWGHF/Tasks/checkMcPvContr.cxx b/PWGHF/Tasks/checkMcPvContr.cxx new file mode 100644 index 00000000000..c70c46820fc --- /dev/null +++ b/PWGHF/Tasks/checkMcPvContr.cxx @@ -0,0 +1,167 @@ +// 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 taskMultiplicityEstimatorCorrelation.cxx +/// \brief Task for correlating the multiplicity estimator with generated dN/deta +/// +/// \author Fabrizio Chinu , Università and INFN Torino + +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Multiplicity.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; + +namespace o2::aod +{ +namespace check_mc_pv_contr +{ +// V0s +DECLARE_SOA_COLUMN(IdCollGen, idCollGen, int); //! Generated collision index +DECLARE_SOA_COLUMN(ImpParGen, impParGen, float); //! Generated impact parameter +DECLARE_SOA_COLUMN(TimeGen, timeGen, float); //! Generated collision time +DECLARE_SOA_COLUMN(TimeRec, timeRec, float); //! Reconstructed collision time +DECLARE_SOA_COLUMN(NCharm, nCharm, int); //! Number of charm quarks in the collision +DECLARE_SOA_COLUMN(NCharmFromInj, nCharmFromInj, int); //! Number of charm quarks from injected events +DECLARE_SOA_COLUMN(NPVContributors, nPVContributors, int); //! Number of contributors to the PV +DECLARE_SOA_COLUMN(Centrality, centrality, int); //! Centrality FT0C +DECLARE_SOA_COLUMN(BC, Bc, int); //! Bunch crossing +} // namespace check_mc_pv_contr + +DECLARE_SOA_TABLE(CheckInj, "AOD", "CHECKINJ", //! Table with PID information + check_mc_pv_contr::IdCollGen, + check_mc_pv_contr::ImpParGen, + check_mc_pv_contr::TimeGen, + check_mc_pv_contr::TimeRec, + check_mc_pv_contr::NCharm, + check_mc_pv_contr::NCharmFromInj, + check_mc_pv_contr::NPVContributors, + check_mc_pv_contr::Centrality, + check_mc_pv_contr::BC); +} // namespace o2::aod + +struct checkMcPvContr { + + Produces checkInj; + + using TrackWLabels = soa::Join; + using CollisionWLabels = soa::Join; + + PresliceUnsorted colPerMcCollision = aod::mccollisionlabel::mcCollisionId; + Preslice tracksPerCollision = aod::track::collisionId; + + HistogramRegistry registry{"registry", {}}; + std::shared_ptr hCharmPerCollImpPar; + + void init(InitContext&) + { + registry.add("hCharmImpPar", ";Impact parameter (fm);Charm counts", {HistType::kTH1F, {{200, 0, 20}}}); + registry.add("hCollImpPar", ";Impact parameter (fm);Counts", {HistType::kTH1F, {{200, 0, 20}}}); + hCharmPerCollImpPar = registry.add("hCharmPerCollImpPar", ";Impact parameter (fm);Charm counts per collision", {HistType::kTH1F, {{200, 0, 20}}}); + + registry.add("hDeltaX", ";#DeltaX (cm);Counts", {HistType::kTH1F, {{200, 0.01, 0.01}}}); + registry.add("hDeltaY", ";#DeltaY (cm);Counts", {HistType::kTH1F, {{200, 0.01, 0.01}}}); + registry.add("hDeltaZ", ";#DeltaZ (cm);Counts", {HistType::kTH1F, {{200, -0.01, 0.01}}}); + } + + void process(CollisionWLabels const& collisions, + TrackWLabels const& tracks, + aod::McParticles const& mcParticles, + aod::McCollisions const& mcCollisions) + { + int splitColls{0}; + for (const auto& mcColl : mcCollisions) { + const auto collSlice = collisions.sliceBy(colPerMcCollision, mcColl.globalIndex()); + int64_t idxCollMostPVContrib{-1}; + int nPVContribMost{0}; + // First we find the collision with most PV contributors + for (const auto& collision : collSlice) { + if (collision.centFT0C() < 20.f) { + if (collision.numContrib() > nPVContribMost) { + nPVContribMost = collision.numContrib(); + idxCollMostPVContrib = collision.globalIndex(); + } + } + } + + // Then we fill the histogram with the distances of the collisions + for (const auto& collision : collSlice) { + const auto collTracks = tracks.sliceBy(tracksPerCollision, collision.globalIndex()); + std::vector charmIds{}; + int fromSignalEv{0}; + for (const auto& track : collTracks) { + if (track.has_mcParticle()) { + auto mcPart = track.mcParticle_as(); + for (const auto& mother : mcPart.mothers_as()) { + if (std::abs(mother.pdgCode()) == 4) { // (anti)charm quark + registry.fill(HIST("hDeltaX"), collision.posX() - collisions.rawIteratorAt(idxCollMostPVContrib).posX()); + registry.fill(HIST("hDeltaY"), collision.posY() - collisions.rawIteratorAt(idxCollMostPVContrib).posY()); + registry.fill(HIST("hDeltaZ"), collision.posZ() - collisions.rawIteratorAt(idxCollMostPVContrib).posZ()); + if (std::find(charmIds.begin(), charmIds.end(), mother.globalIndex()) == charmIds.end()) { + charmIds.push_back(mother.globalIndex()); + fromSignalEv += static_cast(!mother.fromBackgroundEvent()); + } + break; + } + } + } + } + checkInj(mcColl.globalIndex(), mcColl.impactParameter(), mcColl.t(), collision.collisionTime(), charmIds.size(), fromSignalEv, collision.numContrib(), collision.centFT0C(), collision.bcId()); + } + } + for (const auto& mcColl : mcCollisions) { + registry.fill(HIST("hCollImpPar"), mcColl.impactParameter()); + } + int count_bkg{0}, count_sgn{0}; + for (const auto& mcPart : mcParticles) { + if (std::abs(mcPart.pdgCode()) == 4) { // (anti)charm quark + if (!mcPart.fromBackgroundEvent()) { + auto mcCollision = mcPart.mcCollision_as(); + registry.fill(HIST("hCharmImpPar"), mcCollision.impactParameter()); + count_sgn++; + } else { + count_bkg++; + } + } + } + hCharmPerCollImpPar->Divide(registry.get(HIST("hCharmImpPar")).get(), registry.get(HIST("hCollImpPar")).get(), 1, 1); + LOG(info) << "Number of bkgev particles: " << count_bkg; + LOG(info) << "Number of sngev particles: " << count_sgn; + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc)}; +} From 96f9ae428cf31796110a1345be3bbb817f79dfeb Mon Sep 17 00:00:00 2001 From: fchinu Date: Wed, 1 Oct 2025 20:06:06 +0200 Subject: [PATCH 2/6] Fix MC check for charm + add more collision information --- PWGHF/Tasks/checkMcPvContr.cxx | 44 ++++++++++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 5 deletions(-) diff --git a/PWGHF/Tasks/checkMcPvContr.cxx b/PWGHF/Tasks/checkMcPvContr.cxx index c70c46820fc..c927188e404 100644 --- a/PWGHF/Tasks/checkMcPvContr.cxx +++ b/PWGHF/Tasks/checkMcPvContr.cxx @@ -50,24 +50,36 @@ namespace check_mc_pv_contr // V0s DECLARE_SOA_COLUMN(IdCollGen, idCollGen, int); //! Generated collision index DECLARE_SOA_COLUMN(ImpParGen, impParGen, float); //! Generated impact parameter +DECLARE_SOA_COLUMN(XCollGen, xCollGen, float); //! Generated x coordinate of the collision +DECLARE_SOA_COLUMN(YCollGen, yCollGen, float); //! Generated y coordinate of the collision +DECLARE_SOA_COLUMN(ZCollGen, zCollGen, float); //! Generated z coordinate of the collision DECLARE_SOA_COLUMN(TimeGen, timeGen, float); //! Generated collision time DECLARE_SOA_COLUMN(TimeRec, timeRec, float); //! Reconstructed collision time DECLARE_SOA_COLUMN(NCharm, nCharm, int); //! Number of charm quarks in the collision DECLARE_SOA_COLUMN(NCharmFromInj, nCharmFromInj, int); //! Number of charm quarks from injected events DECLARE_SOA_COLUMN(NPVContributors, nPVContributors, int); //! Number of contributors to the PV DECLARE_SOA_COLUMN(Centrality, centrality, int); //! Centrality FT0C +DECLARE_SOA_COLUMN(XCollRec, xCollRec, float); //! Reconstructed x coordinate of the collision +DECLARE_SOA_COLUMN(YCollRec, yCollRec, float); //! Reconstructed y coordinate of the collision +DECLARE_SOA_COLUMN(ZCollRec, zCollRec, float); //! Reconstructed z coordinate of the collision DECLARE_SOA_COLUMN(BC, Bc, int); //! Bunch crossing } // namespace check_mc_pv_contr DECLARE_SOA_TABLE(CheckInj, "AOD", "CHECKINJ", //! Table with PID information check_mc_pv_contr::IdCollGen, check_mc_pv_contr::ImpParGen, + check_mc_pv_contr::XCollGen, + check_mc_pv_contr::YCollGen, + check_mc_pv_contr::ZCollGen, check_mc_pv_contr::TimeGen, check_mc_pv_contr::TimeRec, check_mc_pv_contr::NCharm, check_mc_pv_contr::NCharmFromInj, check_mc_pv_contr::NPVContributors, check_mc_pv_contr::Centrality, + check_mc_pv_contr::XCollRec, + check_mc_pv_contr::YCollRec, + check_mc_pv_contr::ZCollRec, check_mc_pv_contr::BC); } // namespace o2::aod @@ -84,14 +96,32 @@ struct checkMcPvContr { HistogramRegistry registry{"registry", {}}; std::shared_ptr hCharmPerCollImpPar; + bool isCharm(int pdg) + { + if (std::abs(pdg) / 1000 == 4) + return true; + if (std::abs(pdg) / 100 == 4) + return true; + return false; + } + + bool isBeauty(int pdg) + { + if (std::abs(pdg) / 1000 == 5) + return true; + if (std::abs(pdg) / 100 == 5) + return true; + return false; + } + void init(InitContext&) { registry.add("hCharmImpPar", ";Impact parameter (fm);Charm counts", {HistType::kTH1F, {{200, 0, 20}}}); registry.add("hCollImpPar", ";Impact parameter (fm);Counts", {HistType::kTH1F, {{200, 0, 20}}}); hCharmPerCollImpPar = registry.add("hCharmPerCollImpPar", ";Impact parameter (fm);Charm counts per collision", {HistType::kTH1F, {{200, 0, 20}}}); - registry.add("hDeltaX", ";#DeltaX (cm);Counts", {HistType::kTH1F, {{200, 0.01, 0.01}}}); - registry.add("hDeltaY", ";#DeltaY (cm);Counts", {HistType::kTH1F, {{200, 0.01, 0.01}}}); + registry.add("hDeltaX", ";#DeltaX (cm);Counts", {HistType::kTH1F, {{200, -0.01, 0.01}}}); + registry.add("hDeltaY", ";#DeltaY (cm);Counts", {HistType::kTH1F, {{200, -0.01, 0.01}}}); registry.add("hDeltaZ", ";#DeltaZ (cm);Counts", {HistType::kTH1F, {{200, -0.01, 0.01}}}); } @@ -100,6 +130,7 @@ struct checkMcPvContr { aod::McParticles const& mcParticles, aod::McCollisions const& mcCollisions) { + assert(isCharm(413)); int splitColls{0}; for (const auto& mcColl : mcCollisions) { const auto collSlice = collisions.sliceBy(colPerMcCollision, mcColl.globalIndex()); @@ -124,7 +155,7 @@ struct checkMcPvContr { if (track.has_mcParticle()) { auto mcPart = track.mcParticle_as(); for (const auto& mother : mcPart.mothers_as()) { - if (std::abs(mother.pdgCode()) == 4) { // (anti)charm quark + if (isCharm(mother.pdgCode())) { // charm hadron registry.fill(HIST("hDeltaX"), collision.posX() - collisions.rawIteratorAt(idxCollMostPVContrib).posX()); registry.fill(HIST("hDeltaY"), collision.posY() - collisions.rawIteratorAt(idxCollMostPVContrib).posY()); registry.fill(HIST("hDeltaZ"), collision.posZ() - collisions.rawIteratorAt(idxCollMostPVContrib).posZ()); @@ -137,7 +168,10 @@ struct checkMcPvContr { } } } - checkInj(mcColl.globalIndex(), mcColl.impactParameter(), mcColl.t(), collision.collisionTime(), charmIds.size(), fromSignalEv, collision.numContrib(), collision.centFT0C(), collision.bcId()); + checkInj( + mcColl.globalIndex(), mcColl.impactParameter(), mcColl.posX(), mcColl.posY(), mcColl.posZ(), mcColl.t(), collision.collisionTime(), + charmIds.size(), fromSignalEv, collision.numContrib(), collision.centFT0C(), collision.posX(), collision.posY(), collision.posZ(), + collision.bcId()); } } for (const auto& mcColl : mcCollisions) { @@ -145,7 +179,7 @@ struct checkMcPvContr { } int count_bkg{0}, count_sgn{0}; for (const auto& mcPart : mcParticles) { - if (std::abs(mcPart.pdgCode()) == 4) { // (anti)charm quark + if (isCharm(mcPart.pdgCode())) { // charm hadron if (!mcPart.fromBackgroundEvent()) { auto mcCollision = mcPart.mcCollision_as(); registry.fill(HIST("hCharmImpPar"), mcCollision.impactParameter()); From 89244077d2f65075a68175c1125e5607a8b46fa5 Mon Sep 17 00:00:00 2001 From: fchinu Date: Sat, 4 Oct 2025 17:44:48 +0200 Subject: [PATCH 3/6] Add more output information --- PWGHF/Tasks/CMakeLists.txt | 9 +- ...checkMcPvContr.cxx => taskMcInjection.cxx} | 148 ++++++++++++------ 2 files changed, 100 insertions(+), 57 deletions(-) rename PWGHF/Tasks/{checkMcPvContr.cxx => taskMcInjection.cxx} (56%) diff --git a/PWGHF/Tasks/CMakeLists.txt b/PWGHF/Tasks/CMakeLists.txt index 43307a440d0..33c6bf7948e 100644 --- a/PWGHF/Tasks/CMakeLists.txt +++ b/PWGHF/Tasks/CMakeLists.txt @@ -49,16 +49,11 @@ o2physics_add_dpl_workflow(task-pid-studies PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::EventFilteringUtils O2Physics::AnalysisCCDB COMPONENT_NAME Analysis) -o2physics_add_dpl_workflow(check-mc-pv-contr - SOURCES checkMcPvContr.cxx +o2physics_add_dpl_workflow(task-mc-injection + SOURCES taskMcInjection.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::EventFilteringUtils COMPONENT_NAME Analysis) -o2physics_add_dpl_workflow(check-aod - SOURCES checkAod.cxx - PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::EventFilteringUtils O2Physics::AnalysisCCDB - COMPONENT_NAME Analysis) - # o2physics_add_dpl_workflow(task-sel-optimisation # SOURCES taskSelOptimisation.cxx # PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore diff --git a/PWGHF/Tasks/checkMcPvContr.cxx b/PWGHF/Tasks/taskMcInjection.cxx similarity index 56% rename from PWGHF/Tasks/checkMcPvContr.cxx rename to PWGHF/Tasks/taskMcInjection.cxx index c927188e404..4d8426a65bd 100644 --- a/PWGHF/Tasks/checkMcPvContr.cxx +++ b/PWGHF/Tasks/taskMcInjection.cxx @@ -9,8 +9,8 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -/// \file taskMultiplicityEstimatorCorrelation.cxx -/// \brief Task for correlating the multiplicity estimator with generated dN/deta +/// \file taskMcInjection.cxx +/// \brief Task for checking injected events in Pb-Pb MC productions /// /// \author Fabrizio Chinu , Università and INFN Torino @@ -47,7 +47,7 @@ namespace o2::aod { namespace check_mc_pv_contr { -// V0s +// Collisions DECLARE_SOA_COLUMN(IdCollGen, idCollGen, int); //! Generated collision index DECLARE_SOA_COLUMN(ImpParGen, impParGen, float); //! Generated impact parameter DECLARE_SOA_COLUMN(XCollGen, xCollGen, float); //! Generated x coordinate of the collision @@ -63,6 +63,11 @@ DECLARE_SOA_COLUMN(XCollRec, xCollRec, float); //! Reconstructed x c DECLARE_SOA_COLUMN(YCollRec, yCollRec, float); //! Reconstructed y coordinate of the collision DECLARE_SOA_COLUMN(ZCollRec, zCollRec, float); //! Reconstructed z coordinate of the collision DECLARE_SOA_COLUMN(BC, Bc, int); //! Bunch crossing +// Tracks +DECLARE_SOA_COLUMN(VX, vx, float); // x coordinate of the track production vertex +DECLARE_SOA_COLUMN(VY, vy, float); // y coordinate of the track production vertex +DECLARE_SOA_COLUMN(VZ, vz, float); // z coordinate of the track production vertex +DECLARE_SOA_COLUMN(IsFromSignal, isFromSignal, bool); // Whether the track is from the signal event } // namespace check_mc_pv_contr DECLARE_SOA_TABLE(CheckInj, "AOD", "CHECKINJ", //! Table with PID information @@ -72,29 +77,42 @@ DECLARE_SOA_TABLE(CheckInj, "AOD", "CHECKINJ", //! Table with PID information check_mc_pv_contr::YCollGen, check_mc_pv_contr::ZCollGen, check_mc_pv_contr::TimeGen, + check_mc_pv_contr::XCollRec, + check_mc_pv_contr::YCollRec, + check_mc_pv_contr::ZCollRec, check_mc_pv_contr::TimeRec, check_mc_pv_contr::NCharm, check_mc_pv_contr::NCharmFromInj, check_mc_pv_contr::NPVContributors, check_mc_pv_contr::Centrality, - check_mc_pv_contr::XCollRec, - check_mc_pv_contr::YCollRec, - check_mc_pv_contr::ZCollRec, check_mc_pv_contr::BC); + +DECLARE_SOA_TABLE(TracksInjection, "AOD", "TRKINJ", //! Table with MC labels for tracks + check_mc_pv_contr::IdCollGen, + check_mc_pv_contr::VX, + check_mc_pv_contr::VY, + check_mc_pv_contr::VZ, + check_mc_pv_contr::IsFromSignal); } // namespace o2::aod -struct checkMcPvContr { +struct taskMcInjection { Produces checkInj; + Produces tracksInj; using TrackWLabels = soa::Join; using CollisionWLabels = soa::Join; PresliceUnsorted colPerMcCollision = aod::mccollisionlabel::mcCollisionId; Preslice tracksPerCollision = aod::track::collisionId; + Preslice perMcCollision = aod::mcparticle::mcCollisionId; HistogramRegistry registry{"registry", {}}; - std::shared_ptr hCharmPerCollImpPar; + std::shared_ptr hCharmPerCollImpPar, hCollisions; + + AxisSpec impParBins = {200, 0, 20}; + AxisSpec deltaXYbins = {200, -0.05, 0.05}; + AxisSpec deltaZbins = {200, -10, 10}; bool isCharm(int pdg) { @@ -105,7 +123,7 @@ struct checkMcPvContr { return false; } - bool isBeauty(int pdg) + bool isBeauty(int pdg) // if needed in the future { if (std::abs(pdg) / 1000 == 5) return true; @@ -116,13 +134,29 @@ struct checkMcPvContr { void init(InitContext&) { - registry.add("hCharmImpPar", ";Impact parameter (fm);Charm counts", {HistType::kTH1F, {{200, 0, 20}}}); - registry.add("hCollImpPar", ";Impact parameter (fm);Counts", {HistType::kTH1F, {{200, 0, 20}}}); - hCharmPerCollImpPar = registry.add("hCharmPerCollImpPar", ";Impact parameter (fm);Charm counts per collision", {HistType::kTH1F, {{200, 0, 20}}}); + registry.add("hCharmImpPar", ";Impact parameter (fm);Charm counts", {HistType::kTH1F, {impParBins}}); + registry.add("hCollImpPar", ";Impact parameter (fm);Counts", {HistType::kTH1F, {impParBins}}); + hCharmPerCollImpPar = registry.add("hCharmPerCollImpPar", ";Impact parameter (fm);Charm counts per collision", {HistType::kTH1F, {impParBins}}); - registry.add("hDeltaX", ";#DeltaX (cm);Counts", {HistType::kTH1F, {{200, -0.01, 0.01}}}); - registry.add("hDeltaY", ";#DeltaY (cm);Counts", {HistType::kTH1F, {{200, -0.01, 0.01}}}); - registry.add("hDeltaZ", ";#DeltaZ (cm);Counts", {HistType::kTH1F, {{200, -0.01, 0.01}}}); + registry.add("hDeltaX", ";#DeltaX (cm);Counts", {HistType::kTH1F, {{deltaXYbins}}}); + registry.add("hDeltaY", ";#DeltaY (cm);Counts", {HistType::kTH1F, {{deltaXYbins}}}); + registry.add("hDeltaZ", ";#DeltaZ (cm);Counts", {HistType::kTH1F, {{deltaZbins}}}); + + registry.add("hDeltaX_NPV_lt2000", ";#DeltaX (cm);Counts", {HistType::kTH1F, {{deltaXYbins}}}); + registry.add("hDeltaY_NPV_lt2000", ";#DeltaY (cm);Counts", {HistType::kTH1F, {{deltaXYbins}}}); + registry.add("hDeltaZ_NPV_lt2000", ";#DeltaZ (cm);Counts", {HistType::kTH1F, {{deltaZbins}}}); + + registry.add("hDeltaX_NPV_gt2000", ";#DeltaX (cm);Counts", {HistType::kTH1F, {{deltaXYbins}}}); + registry.add("hDeltaY_NPV_gt2000", ";#DeltaY (cm);Counts", {HistType::kTH1F, {{deltaXYbins}}}); + registry.add("hDeltaZ_NPV_gt2000", ";#DeltaZ (cm);Counts", {HistType::kTH1F, {{deltaZbins}}}); + + registry.add("hDeltaXSngBkg", ";#DeltaX (signal/bkg) (cm);Counts", {HistType::kTH1F, {{200, -10, 10}}}); + registry.add("hDeltaYSngBkg", ";#DeltaY (signal/bkg) (cm);Counts", {HistType::kTH1F, {{200, -10, 10}}}); + registry.add("hDeltaZSngBkg", ";#DeltaZ (signal/bkg) (cm);Counts", {HistType::kTH1F, {{200, -20, 20}}}); + + hCollisions = registry.add("hCollisions", ";;Counts", {HistType::kTH1F, {{2, 0.5, 2.5}}}); + hCollisions->GetXaxis()->SetBinLabel(1, "Generated"); + hCollisions->GetXaxis()->SetBinLabel(2, "Reconstructed"); } void process(CollisionWLabels const& collisions, @@ -130,35 +164,62 @@ struct checkMcPvContr { aod::McParticles const& mcParticles, aod::McCollisions const& mcCollisions) { - assert(isCharm(413)); int splitColls{0}; for (const auto& mcColl : mcCollisions) { - const auto collSlice = collisions.sliceBy(colPerMcCollision, mcColl.globalIndex()); - int64_t idxCollMostPVContrib{-1}; - int nPVContribMost{0}; - // First we find the collision with most PV contributors - for (const auto& collision : collSlice) { - if (collision.centFT0C() < 20.f) { - if (collision.numContrib() > nPVContribMost) { - nPVContribMost = collision.numContrib(); - idxCollMostPVContrib = collision.globalIndex(); - } + registry.fill(HIST("hCollImpPar"), mcColl.impactParameter()); + const auto mcPartColl = mcParticles.sliceBy(perMcCollision, mcColl.globalIndex()); + double xAvgSgn{0.}, yAvgSgn{0.}, zAvgSgn{0.}; + double xAvgBkg{0.}, yAvgBkg{0.}, zAvgBkg{0.}; + int nSgn{0}, nBkg{0}; + for (const auto& mcPart : mcPartColl) { + if (isCharm(mcPart.pdgCode())) { // charm hadron + registry.fill(HIST("hCharmImpPar"), mcColl.impactParameter()); + } + if (mcPart.fromBackgroundEvent()) { + xAvgBkg += mcPart.vx(); + yAvgBkg += mcPart.vy(); + zAvgBkg += mcPart.vz(); + nBkg++; + tracksInj(mcPart.mcCollisionId(), mcPart.vx(), mcPart.vy(), mcPart.vz(), false); + } else { + xAvgSgn += mcPart.vx(); + yAvgSgn += mcPart.vy(); + zAvgSgn += mcPart.vz(); + nSgn++; + tracksInj(mcPart.mcCollisionId(), mcPart.vx(), mcPart.vy(), mcPart.vz(), true); } } + registry.fill(HIST("hDeltaXSngBkg"), xAvgSgn / nSgn - xAvgBkg / nBkg); + registry.fill(HIST("hDeltaYSngBkg"), yAvgSgn / nSgn - yAvgBkg / nBkg); + registry.fill(HIST("hDeltaZSngBkg"), zAvgSgn / nSgn - zAvgBkg / nBkg); + + const auto collSlice = collisions.sliceBy(colPerMcCollision, mcColl.globalIndex()); // Then we fill the histogram with the distances of the collisions for (const auto& collision : collSlice) { const auto collTracks = tracks.sliceBy(tracksPerCollision, collision.globalIndex()); std::vector charmIds{}; int fromSignalEv{0}; + if (collision.centFT0C() < 20.f) { + registry.fill(HIST("hDeltaX"), collision.posX() - collision.mcCollision().posX()); + registry.fill(HIST("hDeltaY"), collision.posY() - collision.mcCollision().posY()); + registry.fill(HIST("hDeltaZ"), collision.posZ() - collision.mcCollision().posZ()); + + if (collision.numContrib() > 2000) { + registry.fill(HIST("hDeltaX_NPV_gt2000"), collision.posX() - collision.mcCollision().posX()); + registry.fill(HIST("hDeltaY_NPV_gt2000"), collision.posY() - collision.mcCollision().posY()); + registry.fill(HIST("hDeltaZ_NPV_gt2000"), collision.posZ() - collision.mcCollision().posZ()); + } else { + registry.fill(HIST("hDeltaX_NPV_lt2000"), collision.posX() - collision.mcCollision().posX()); + registry.fill(HIST("hDeltaY_NPV_lt2000"), collision.posY() - collision.mcCollision().posY()); + registry.fill(HIST("hDeltaZ_NPV_lt2000"), collision.posZ() - collision.mcCollision().posZ()); + } + } for (const auto& track : collTracks) { if (track.has_mcParticle()) { auto mcPart = track.mcParticle_as(); for (const auto& mother : mcPart.mothers_as()) { if (isCharm(mother.pdgCode())) { // charm hadron - registry.fill(HIST("hDeltaX"), collision.posX() - collisions.rawIteratorAt(idxCollMostPVContrib).posX()); - registry.fill(HIST("hDeltaY"), collision.posY() - collisions.rawIteratorAt(idxCollMostPVContrib).posY()); - registry.fill(HIST("hDeltaZ"), collision.posZ() - collisions.rawIteratorAt(idxCollMostPVContrib).posZ()); if (std::find(charmIds.begin(), charmIds.end(), mother.globalIndex()) == charmIds.end()) { charmIds.push_back(mother.globalIndex()); fromSignalEv += static_cast(!mother.fromBackgroundEvent()); @@ -169,33 +230,20 @@ struct checkMcPvContr { } } checkInj( - mcColl.globalIndex(), mcColl.impactParameter(), mcColl.posX(), mcColl.posY(), mcColl.posZ(), mcColl.t(), collision.collisionTime(), - charmIds.size(), fromSignalEv, collision.numContrib(), collision.centFT0C(), collision.posX(), collision.posY(), collision.posZ(), - collision.bcId()); - } - } - for (const auto& mcColl : mcCollisions) { - registry.fill(HIST("hCollImpPar"), mcColl.impactParameter()); - } - int count_bkg{0}, count_sgn{0}; - for (const auto& mcPart : mcParticles) { - if (isCharm(mcPart.pdgCode())) { // charm hadron - if (!mcPart.fromBackgroundEvent()) { - auto mcCollision = mcPart.mcCollision_as(); - registry.fill(HIST("hCharmImpPar"), mcCollision.impactParameter()); - count_sgn++; - } else { - count_bkg++; - } + mcColl.globalIndex(), mcColl.impactParameter(), + mcColl.posX(), mcColl.posY(), mcColl.posZ(), mcColl.t(), + collision.posX(), collision.posY(), collision.posZ(), collision.collisionTime(), + charmIds.size(), fromSignalEv, collision.numContrib(), collision.centFT0C(), collision.bcId()); } } + hCharmPerCollImpPar->Divide(registry.get(HIST("hCharmImpPar")).get(), registry.get(HIST("hCollImpPar")).get(), 1, 1); - LOG(info) << "Number of bkgev particles: " << count_bkg; - LOG(info) << "Number of sngev particles: " << count_sgn; + hCollisions->Fill(1, mcCollisions.size()); + hCollisions->Fill(2, collisions.size()); } }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { - return WorkflowSpec{adaptAnalysisTask(cfgc)}; + return WorkflowSpec{adaptAnalysisTask(cfgc)}; } From 0c785900ff3afc7a84ffa8ab466236a4521d4e95 Mon Sep 17 00:00:00 2001 From: fchinu Date: Mon, 6 Oct 2025 10:29:50 +0200 Subject: [PATCH 4/6] linter and clang tidy --- PWGHF/Tasks/CMakeLists.txt | 2 +- PWGHF/Tasks/taskMcInjection.cxx | 84 ++++++++++++++++----------------- 2 files changed, 41 insertions(+), 45 deletions(-) diff --git a/PWGHF/Tasks/CMakeLists.txt b/PWGHF/Tasks/CMakeLists.txt index 33c6bf7948e..d276ac35c57 100644 --- a/PWGHF/Tasks/CMakeLists.txt +++ b/PWGHF/Tasks/CMakeLists.txt @@ -51,7 +51,7 @@ o2physics_add_dpl_workflow(task-pid-studies o2physics_add_dpl_workflow(task-mc-injection SOURCES taskMcInjection.cxx - PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::EventFilteringUtils + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore COMPONENT_NAME Analysis) # o2physics_add_dpl_workflow(task-sel-optimisation diff --git a/PWGHF/Tasks/taskMcInjection.cxx b/PWGHF/Tasks/taskMcInjection.cxx index 4d8426a65bd..8ffae233f60 100644 --- a/PWGHF/Tasks/taskMcInjection.cxx +++ b/PWGHF/Tasks/taskMcInjection.cxx @@ -15,28 +15,21 @@ /// \author Fabrizio Chinu , Università and INFN Torino #include "Common/DataModel/Centrality.h" -#include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/Multiplicity.h" #include #include +#include #include -#include #include #include #include -#include #include -#include -#include +#include -#include -#include +#include #include #include -#include -#include #include using namespace o2; @@ -62,11 +55,11 @@ DECLARE_SOA_COLUMN(Centrality, centrality, int); //! Centrality FT0C DECLARE_SOA_COLUMN(XCollRec, xCollRec, float); //! Reconstructed x coordinate of the collision DECLARE_SOA_COLUMN(YCollRec, yCollRec, float); //! Reconstructed y coordinate of the collision DECLARE_SOA_COLUMN(ZCollRec, zCollRec, float); //! Reconstructed z coordinate of the collision -DECLARE_SOA_COLUMN(BC, Bc, int); //! Bunch crossing +DECLARE_SOA_COLUMN(Bc, bc, int); //! Bunch crossing // Tracks -DECLARE_SOA_COLUMN(VX, vx, float); // x coordinate of the track production vertex -DECLARE_SOA_COLUMN(VY, vy, float); // y coordinate of the track production vertex -DECLARE_SOA_COLUMN(VZ, vz, float); // z coordinate of the track production vertex +DECLARE_SOA_COLUMN(Vx, vx, float); // x coordinate of the track production vertex +DECLARE_SOA_COLUMN(Vy, vy, float); // y coordinate of the track production vertex +DECLARE_SOA_COLUMN(Vz, vz, float); // z coordinate of the track production vertex DECLARE_SOA_COLUMN(IsFromSignal, isFromSignal, bool); // Whether the track is from the signal event } // namespace check_mc_pv_contr @@ -85,52 +78,37 @@ DECLARE_SOA_TABLE(CheckInj, "AOD", "CHECKINJ", //! Table with PID information check_mc_pv_contr::NCharmFromInj, check_mc_pv_contr::NPVContributors, check_mc_pv_contr::Centrality, - check_mc_pv_contr::BC); + check_mc_pv_contr::Bc); DECLARE_SOA_TABLE(TracksInjection, "AOD", "TRKINJ", //! Table with MC labels for tracks check_mc_pv_contr::IdCollGen, - check_mc_pv_contr::VX, - check_mc_pv_contr::VY, - check_mc_pv_contr::VZ, + check_mc_pv_contr::Vx, + check_mc_pv_contr::Vy, + check_mc_pv_contr::Vz, check_mc_pv_contr::IsFromSignal); } // namespace o2::aod -struct taskMcInjection { +struct HfTaskMcInjection { Produces checkInj; Produces tracksInj; + Configurable centMaxForCollDelta{"centMaxForCollDelta", 20., "max. cent. for gen-rec collision position histograms"}; + + std::shared_ptr hCharmPerCollImpPar, hCollisions; + using TrackWLabels = soa::Join; using CollisionWLabels = soa::Join; - PresliceUnsorted colPerMcCollision = aod::mccollisionlabel::mcCollisionId; Preslice tracksPerCollision = aod::track::collisionId; Preslice perMcCollision = aod::mcparticle::mcCollisionId; - - HistogramRegistry registry{"registry", {}}; - std::shared_ptr hCharmPerCollImpPar, hCollisions; + PresliceUnsorted colPerMcCollision = aod::mccollisionlabel::mcCollisionId; AxisSpec impParBins = {200, 0, 20}; AxisSpec deltaXYbins = {200, -0.05, 0.05}; AxisSpec deltaZbins = {200, -10, 10}; - bool isCharm(int pdg) - { - if (std::abs(pdg) / 1000 == 4) - return true; - if (std::abs(pdg) / 100 == 4) - return true; - return false; - } - - bool isBeauty(int pdg) // if needed in the future - { - if (std::abs(pdg) / 1000 == 5) - return true; - if (std::abs(pdg) / 100 == 5) - return true; - return false; - } + HistogramRegistry registry{"registry", {}}; void init(InitContext&) { @@ -159,12 +137,29 @@ struct taskMcInjection { hCollisions->GetXaxis()->SetBinLabel(2, "Reconstructed"); } + bool isCharm(int pdg) + { + if (std::abs(pdg) / 1000 == 4) // o2-linter: disable=pdg/explicit-code magic-number + return true; + if (std::abs(pdg) / 100 == 4) // o2-linter: disable=pdg/explicit-code magic-number + return true; + return false; + } + + bool isBeauty(int pdg) // if needed in the future + { + if (std::abs(pdg) / 1000 == 5) // o2-linter: disable=pdg/explicit-code magic-number + return true; + if (std::abs(pdg) / 100 == 5) // o2-linter: disable=pdg/explicit-code magic-number + return true; + return false; + } + void process(CollisionWLabels const& collisions, TrackWLabels const& tracks, aod::McParticles const& mcParticles, aod::McCollisions const& mcCollisions) { - int splitColls{0}; for (const auto& mcColl : mcCollisions) { registry.fill(HIST("hCollImpPar"), mcColl.impactParameter()); const auto mcPartColl = mcParticles.sliceBy(perMcCollision, mcColl.globalIndex()); @@ -200,12 +195,13 @@ struct taskMcInjection { const auto collTracks = tracks.sliceBy(tracksPerCollision, collision.globalIndex()); std::vector charmIds{}; int fromSignalEv{0}; - if (collision.centFT0C() < 20.f) { + if (collision.centFT0C() < centMaxForCollDelta) { registry.fill(HIST("hDeltaX"), collision.posX() - collision.mcCollision().posX()); registry.fill(HIST("hDeltaY"), collision.posY() - collision.mcCollision().posY()); registry.fill(HIST("hDeltaZ"), collision.posZ() - collision.mcCollision().posZ()); - if (collision.numContrib() > 2000) { + constexpr unsigned maxNcontrib{2000}; + if (collision.numContrib() > maxNcontrib) { registry.fill(HIST("hDeltaX_NPV_gt2000"), collision.posX() - collision.mcCollision().posX()); registry.fill(HIST("hDeltaY_NPV_gt2000"), collision.posY() - collision.mcCollision().posY()); registry.fill(HIST("hDeltaZ_NPV_gt2000"), collision.posZ() - collision.mcCollision().posZ()); @@ -245,5 +241,5 @@ struct taskMcInjection { WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { - return WorkflowSpec{adaptAnalysisTask(cfgc)}; + return WorkflowSpec{adaptAnalysisTask(cfgc)}; } From f900a8c91398891cbf878f668f97281d63155e12 Mon Sep 17 00:00:00 2001 From: fchinu Date: Mon, 6 Oct 2025 14:06:19 +0200 Subject: [PATCH 5/6] Address Vit's suggestions --- PWGHF/Tasks/taskMcInjection.cxx | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/PWGHF/Tasks/taskMcInjection.cxx b/PWGHF/Tasks/taskMcInjection.cxx index 8ffae233f60..25217aa0ae1 100644 --- a/PWGHF/Tasks/taskMcInjection.cxx +++ b/PWGHF/Tasks/taskMcInjection.cxx @@ -20,16 +20,18 @@ #include #include #include +#include #include #include #include #include #include +#include -#include #include #include +#include #include using namespace o2; @@ -104,14 +106,14 @@ struct HfTaskMcInjection { Preslice perMcCollision = aod::mcparticle::mcCollisionId; PresliceUnsorted colPerMcCollision = aod::mccollisionlabel::mcCollisionId; - AxisSpec impParBins = {200, 0, 20}; - AxisSpec deltaXYbins = {200, -0.05, 0.05}; - AxisSpec deltaZbins = {200, -10, 10}; - HistogramRegistry registry{"registry", {}}; void init(InitContext&) { + AxisSpec impParBins = {200, 0, 20}; + AxisSpec deltaXYbins = {200, -0.05, 0.05}; + AxisSpec deltaZbins = {200, -10, 10}; + registry.add("hCharmImpPar", ";Impact parameter (fm);Charm counts", {HistType::kTH1F, {impParBins}}); registry.add("hCollImpPar", ";Impact parameter (fm);Counts", {HistType::kTH1F, {impParBins}}); hCharmPerCollImpPar = registry.add("hCharmPerCollImpPar", ";Impact parameter (fm);Charm counts per collision", {HistType::kTH1F, {impParBins}}); @@ -139,18 +141,18 @@ struct HfTaskMcInjection { bool isCharm(int pdg) { - if (std::abs(pdg) / 1000 == 4) // o2-linter: disable=pdg/explicit-code magic-number + if (std::abs(pdg) / 1000 == PDG_t::kCharm) return true; - if (std::abs(pdg) / 100 == 4) // o2-linter: disable=pdg/explicit-code magic-number + if (std::abs(pdg) / 100 == PDG_t::kCharm) return true; return false; } bool isBeauty(int pdg) // if needed in the future { - if (std::abs(pdg) / 1000 == 5) // o2-linter: disable=pdg/explicit-code magic-number + if (std::abs(pdg) / 1000 == PDG_t::kBottom) return true; - if (std::abs(pdg) / 100 == 5) // o2-linter: disable=pdg/explicit-code magic-number + if (std::abs(pdg) / 100 == PDG_t::kBottom) return true; return false; } @@ -193,7 +195,6 @@ struct HfTaskMcInjection { // Then we fill the histogram with the distances of the collisions for (const auto& collision : collSlice) { const auto collTracks = tracks.sliceBy(tracksPerCollision, collision.globalIndex()); - std::vector charmIds{}; int fromSignalEv{0}; if (collision.centFT0C() < centMaxForCollDelta) { registry.fill(HIST("hDeltaX"), collision.posX() - collision.mcCollision().posX()); @@ -211,13 +212,14 @@ struct HfTaskMcInjection { registry.fill(HIST("hDeltaZ_NPV_lt2000"), collision.posZ() - collision.mcCollision().posZ()); } } + std::unordered_set charmIds{}; for (const auto& track : collTracks) { if (track.has_mcParticle()) { auto mcPart = track.mcParticle_as(); for (const auto& mother : mcPart.mothers_as()) { if (isCharm(mother.pdgCode())) { // charm hadron - if (std::find(charmIds.begin(), charmIds.end(), mother.globalIndex()) == charmIds.end()) { - charmIds.push_back(mother.globalIndex()); + if (!charmIds.contains(mother.globalIndex())) { + charmIds.emplace(mother.globalIndex()); fromSignalEv += static_cast(!mother.fromBackgroundEvent()); } break; From e9b6f88a573599267f4a74bf3670d6d0f208c5ad Mon Sep 17 00:00:00 2001 From: fchinu Date: Mon, 6 Oct 2025 14:15:22 +0200 Subject: [PATCH 6/6] fix linter and add configurable for PV contributors --- PWGHF/Tasks/taskMcInjection.cxx | 36 ++++++++++++++++----------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/PWGHF/Tasks/taskMcInjection.cxx b/PWGHF/Tasks/taskMcInjection.cxx index 25217aa0ae1..b0377cecc23 100644 --- a/PWGHF/Tasks/taskMcInjection.cxx +++ b/PWGHF/Tasks/taskMcInjection.cxx @@ -96,6 +96,7 @@ struct HfTaskMcInjection { Produces tracksInj; Configurable centMaxForCollDelta{"centMaxForCollDelta", 20., "max. cent. for gen-rec collision position histograms"}; + Configurable nPvContribMaxForCollDelta{"nPvContribMaxForCollDelta", 2000, "max. PV contrib. for gen-rec collision position histograms"}; std::shared_ptr hCharmPerCollImpPar, hCollisions; @@ -122,13 +123,13 @@ struct HfTaskMcInjection { registry.add("hDeltaY", ";#DeltaY (cm);Counts", {HistType::kTH1F, {{deltaXYbins}}}); registry.add("hDeltaZ", ";#DeltaZ (cm);Counts", {HistType::kTH1F, {{deltaZbins}}}); - registry.add("hDeltaX_NPV_lt2000", ";#DeltaX (cm);Counts", {HistType::kTH1F, {{deltaXYbins}}}); - registry.add("hDeltaY_NPV_lt2000", ";#DeltaY (cm);Counts", {HistType::kTH1F, {{deltaXYbins}}}); - registry.add("hDeltaZ_NPV_lt2000", ";#DeltaZ (cm);Counts", {HistType::kTH1F, {{deltaZbins}}}); + registry.add("hDeltaX_NPV_lt", ";#DeltaX (cm);Counts", {HistType::kTH1F, {{deltaXYbins}}}); + registry.add("hDeltaY_NPV_lt", ";#DeltaY (cm);Counts", {HistType::kTH1F, {{deltaXYbins}}}); + registry.add("hDeltaZ_NPV_lt", ";#DeltaZ (cm);Counts", {HistType::kTH1F, {{deltaZbins}}}); - registry.add("hDeltaX_NPV_gt2000", ";#DeltaX (cm);Counts", {HistType::kTH1F, {{deltaXYbins}}}); - registry.add("hDeltaY_NPV_gt2000", ";#DeltaY (cm);Counts", {HistType::kTH1F, {{deltaXYbins}}}); - registry.add("hDeltaZ_NPV_gt2000", ";#DeltaZ (cm);Counts", {HistType::kTH1F, {{deltaZbins}}}); + registry.add("hDeltaX_NPV_gt", ";#DeltaX (cm);Counts", {HistType::kTH1F, {{deltaXYbins}}}); + registry.add("hDeltaY_NPV_gt", ";#DeltaY (cm);Counts", {HistType::kTH1F, {{deltaXYbins}}}); + registry.add("hDeltaZ_NPV_gt", ";#DeltaZ (cm);Counts", {HistType::kTH1F, {{deltaZbins}}}); registry.add("hDeltaXSngBkg", ";#DeltaX (signal/bkg) (cm);Counts", {HistType::kTH1F, {{200, -10, 10}}}); registry.add("hDeltaYSngBkg", ";#DeltaY (signal/bkg) (cm);Counts", {HistType::kTH1F, {{200, -10, 10}}}); @@ -141,18 +142,18 @@ struct HfTaskMcInjection { bool isCharm(int pdg) { - if (std::abs(pdg) / 1000 == PDG_t::kCharm) + if (std::abs(pdg) / 1000 == PDG_t::kCharm) // o2-linter: disable=magic-number (get thousands digit) return true; - if (std::abs(pdg) / 100 == PDG_t::kCharm) + if (std::abs(pdg) / 100 == PDG_t::kCharm) // o2-linter: disable=magic-number (get hundreds digit) return true; return false; } bool isBeauty(int pdg) // if needed in the future { - if (std::abs(pdg) / 1000 == PDG_t::kBottom) + if (std::abs(pdg) / 1000 == PDG_t::kBottom) // o2-linter: disable=magic-number (get thousands digit) return true; - if (std::abs(pdg) / 100 == PDG_t::kBottom) + if (std::abs(pdg) / 100 == PDG_t::kBottom) // o2-linter: disable=magic-number (get hundreds digit) return true; return false; } @@ -201,15 +202,14 @@ struct HfTaskMcInjection { registry.fill(HIST("hDeltaY"), collision.posY() - collision.mcCollision().posY()); registry.fill(HIST("hDeltaZ"), collision.posZ() - collision.mcCollision().posZ()); - constexpr unsigned maxNcontrib{2000}; - if (collision.numContrib() > maxNcontrib) { - registry.fill(HIST("hDeltaX_NPV_gt2000"), collision.posX() - collision.mcCollision().posX()); - registry.fill(HIST("hDeltaY_NPV_gt2000"), collision.posY() - collision.mcCollision().posY()); - registry.fill(HIST("hDeltaZ_NPV_gt2000"), collision.posZ() - collision.mcCollision().posZ()); + if (collision.numContrib() > nPvContribMaxForCollDelta) { + registry.fill(HIST("hDeltaX_NPV_gt"), collision.posX() - collision.mcCollision().posX()); + registry.fill(HIST("hDeltaY_NPV_gt"), collision.posY() - collision.mcCollision().posY()); + registry.fill(HIST("hDeltaZ_NPV_gt"), collision.posZ() - collision.mcCollision().posZ()); } else { - registry.fill(HIST("hDeltaX_NPV_lt2000"), collision.posX() - collision.mcCollision().posX()); - registry.fill(HIST("hDeltaY_NPV_lt2000"), collision.posY() - collision.mcCollision().posY()); - registry.fill(HIST("hDeltaZ_NPV_lt2000"), collision.posZ() - collision.mcCollision().posZ()); + registry.fill(HIST("hDeltaX_NPV_lt"), collision.posX() - collision.mcCollision().posX()); + registry.fill(HIST("hDeltaY_NPV_lt"), collision.posY() - collision.mcCollision().posY()); + registry.fill(HIST("hDeltaZ_NPV_lt"), collision.posZ() - collision.mcCollision().posZ()); } } std::unordered_set charmIds{};