From c99af92ebf90c698fe44578d89c9b1ebdab96e78 Mon Sep 17 00:00:00 2001 From: SCHOTTER Romain <47983209+romainschotter@users.noreply.github.com> Date: Tue, 25 Aug 2026 17:54:35 +0200 Subject: [PATCH 01/27] Add MC centrality for FT0CVariant, FDDM, NTPVs, Nglobals, MFTs --- PWGLF/DataModel/mcCentrality.h | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/PWGLF/DataModel/mcCentrality.h b/PWGLF/DataModel/mcCentrality.h index 94544949017..8a8766e6ed8 100644 --- a/PWGLF/DataModel/mcCentrality.h +++ b/PWGLF/DataModel/mcCentrality.h @@ -20,10 +20,12 @@ #ifndef PWGLF_DATAMODEL_MCCENTRALITY_H_ #define PWGLF_DATAMODEL_MCCENTRALITY_H_ +// O2 includes #include "Common/DataModel/Centrality.h" -#include -#include +#include "Framework/ASoA.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/Logger.h" namespace o2::aod { @@ -38,8 +40,12 @@ DECLARE_SOA_TABLE(McCentFV0As, "AOD", "MCCENTFV0A", o2::soa::Marker<1>, cent::Ce DECLARE_SOA_TABLE(McCentFT0Ms, "AOD", "MCCENTFT0M", o2::soa::Marker<2>, cent::CentFT0M); DECLARE_SOA_TABLE(McCentFT0As, "AOD", "MCCENTFT0A", o2::soa::Marker<3>, cent::CentFT0A); DECLARE_SOA_TABLE(McCentFT0Cs, "AOD", "MCCENTFT0C", o2::soa::Marker<4>, cent::CentFT0C); -DECLARE_SOA_TABLE(McCentFDDMs, "AOD", "MCCENTFDDM", o2::soa::Marker<5>, cent::CentFDDM); -DECLARE_SOA_TABLE(McCentNTPVs, "AOD", "MCCENTNTPV", o2::soa::Marker<6>, cent::CentNTPV); +DECLARE_SOA_TABLE(McCentFT0CVariant1s, "AOD", "MCCENTFT0CVAR1", o2::soa::Marker<5>, cent::CentFT0CVariant1); +DECLARE_SOA_TABLE(McCentFT0CVariant2s, "AOD", "MCCENTFT0CVAR2", o2::soa::Marker<6>, cent::CentFT0CVariant2); +DECLARE_SOA_TABLE(McCentFDDMs, "AOD", "MCCENTFDDM", o2::soa::Marker<7>, cent::CentFDDM); +DECLARE_SOA_TABLE(McCentNTPVs, "AOD", "MCCENTNTPV", o2::soa::Marker<8>, cent::CentNTPV); +DECLARE_SOA_TABLE(McCentNGlobals, "AOD", "MCCENTNGLOBAL", o2::soa::Marker<9>, cent::CentNGlobal); +DECLARE_SOA_TABLE(McCentMFTs, "AOD", "MCCENTMFT", o2::soa::Marker<10>, cent::CentMFT); } // namespace o2::aod From 3ca438d21c835e95bd8ba1680baf693090c207f0 Mon Sep 17 00:00:00 2001 From: SCHOTTER Romain <47983209+romainschotter@users.noreply.github.com> Date: Tue, 25 Aug 2026 17:57:29 +0200 Subject: [PATCH 02/27] Update MC centrality task to use the mcCentModule.h --- PWGLF/TableProducer/Common/mcCentrality.cxx | 159 +++----------------- 1 file changed, 25 insertions(+), 134 deletions(-) diff --git a/PWGLF/TableProducer/Common/mcCentrality.cxx b/PWGLF/TableProducer/Common/mcCentrality.cxx index 3e017c5808b..8df661a4f46 100644 --- a/PWGLF/TableProducer/Common/mcCentrality.cxx +++ b/PWGLF/TableProducer/Common/mcCentrality.cxx @@ -18,175 +18,66 @@ /// #include "PWGLF/DataModel/mcCentrality.h" +#include "PWGLF/Utils/mcCentralityModule.h" + +#include "TableHelper.h" #include "PWGLF/Utils/inelGt.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/TrackSelectionTables.h" + #include #include #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; +using namespace o2::track; /// Task to produce the response table struct McCentrality { - - // Tables to produce - Produces centFV0A; - Produces centFT0M; - Produces centFT0A; - Produces centFT0C; - Produces centFDDM; - Produces centNTPV; - // Input parameters + o2::framework::Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; Service ccdb; - Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; - Configurable ccdbTimestamp{"ccdbTimestamp", -1, "timestamp of the object used to query in CCDB the detector response. If 0 the object corresponding to the run number is used, if < 0 the latest object is used"}; - Configurable path{"path", "/tmp/InputCalibMC.root", "path to calib file or ccdb path if begins with ccdb://"}; - Configurable selectPrimaries{"selectPrimaries", true, "Select only primary particles"}; - Service pdgDB; - ConfigurableAxis binsPercentile{"binsPercentile", {VARIABLE_WIDTH, 0, 0.001, 0.01, 1.0, 5.0, 10.0, 15.0, 20.0, 25.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0}, "Binning of the percentile axis"}; - ConfigurableAxis binsMultiplicity{"binsMultiplicity", {1000, 0, 5000}, "Binning of the multiplicity axis"}; - Configurable fillFt0M{"fillFt0M", true, "Fills the FT0M histogram"}; - Configurable fillFt0A{"fillFt0A", false, "Fills the FT0A histogram"}; - Configurable fillFt0C{"fillFt0C", false, "Fills the FT0C histogram"}; - Configurable doNotCrashOnNull{"doNotCrashOnNull", false, "If ccdb object does not exist, fill with dummy values"}; + + o2::pwglf::mccentrality::products products; + o2::pwglf::mccentrality::coreConfigurables baseOpts; + o2::pwglf::mccentrality::BuilderModule mcCentralityBuilderModule; HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; - TH1F* h1dFT0M = nullptr; - TH1F* h1dFT0A = nullptr; - TH1F* h1dFT0C = nullptr; - // TH1F* h1dFDD; - // TH1F* h1dNTP; - - o2::pwglf::ParticleCounter mCounter; - - void init(o2::framework::InitContext& /*initContext*/) + void init(o2::framework::InitContext& initContext) { // Set up the CCDB ccdb->setURL(ccdbUrl.value); ccdb->setCaching(true); ccdb->setLocalObjectValidityChecking(); - ccdb->setCreatedNotAfter(std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count()); ccdb->setFatalWhenNull(false); - mCounter.mPdgDatabase = pdgDB.service; - mCounter.mSelectPrimaries = selectPrimaries.value; - - if (fillFt0M) { - histos.add("FT0M/percentile", "FT0M percentile.", HistType::kTH1D, {{binsPercentile, "FT0M percentile"}}); - histos.add("FT0M/percentilevsMult", "FT0M percentile.", HistType::kTH2D, {{binsPercentile, "FT0M percentile"}, {binsMultiplicity, "FT0M mult."}}); - } - if (fillFt0A) { - histos.add("FT0A/percentile", "FT0A percentile.", HistType::kTH1D, {{binsPercentile, "FT0A percentile"}}); - histos.add("FT0A/percentilevsMult", "FT0A percentile.", HistType::kTH2D, {{binsPercentile, "FT0A percentile"}, {binsMultiplicity, "FT0A mult."}}); - } - if (fillFt0C) { - histos.add("FT0C/percentile", "FT0C percentile.", HistType::kTH1D, {{binsPercentile, "FT0C percentile"}}); - histos.add("FT0C/percentilevsMult", "FT0C percentile.", HistType::kTH2D, {{binsPercentile, "FT0C percentile"}, {binsMultiplicity, "FT0C mult."}}); - } - - TList* lOfInput = nullptr; - if (path.value.rfind("ccdb://", 0) == 0) { // Getting post calib. from CCDB - path.value.replace(0, 7, ""); - lOfInput = ccdb->get(path); - if (!lOfInput) { - if (doNotCrashOnNull) { - LOG(info) << "Could not find the calibration TList from CCDB in path " << path << ", will fill tables with dummy values"; - } else { - LOG(fatal) << "Could not find the calibration TList from CCDB in path " << path; - return; - } - } - } else { // Getting post calib. from file - TFile* f = TFile::Open(path.value.c_str(), "READ"); - if (!f) { - LOG(fatal) << "The input file " << path << " is not valid"; - } - if (!f->IsOpen()) { - LOG(fatal) << "The input file " << f->GetName() << " is not open"; - } - lOfInput = static_cast(f->Get("ccdb_object")); - if (!lOfInput) { - f->ls(); - LOG(fatal) << "The input file " << path.value << " does not contain the TList ccdb_object"; - } - } - auto getHist = [this, lOfInput](const char* name) -> TH1F* { - if (!lOfInput) { - return nullptr; - } - auto hist = static_cast(lOfInput->FindObject(name)); - if (!hist) { - lOfInput->ls(); - if (this->doNotCrashOnNull) { - LOG(info) << "Could not open histogram " << name << " from TList, will fill tables with dummy values"; - } else { - LOG(fatal) << "Could not open histogram " << name << " from TList"; - } - } - return hist; - }; - if (fillFt0M) { - h1dFT0M = getHist("h1dFT0M"); - } - if (fillFt0A) { - h1dFT0A = getHist("h1dFT0A"); - } - if (fillFt0C) { - h1dFT0C = getHist("h1dFT0C"); - } + mcCentralityBuilderModule.init(baseOpts, histos, initContext); } // Full tables (independent on central calibrations) - void process(aod::McCollision const& /*mcCollision*/, - aod::McParticles const& mcParticles) + void process(soa::Join const& mcCollisions, + aod::BCsWithTimestamps const& bcs) { - const float nFT0A = mCounter.countFT0A(mcParticles); - const float nFT0C = mCounter.countFT0C(mcParticles); - const float nFT0M = nFT0A + nFT0C; - // const float nFV0A = mCounter.countFV0A(mcParticles); - - if (fillFt0M) { - const float valueCentFT0M = h1dFT0M ? h1dFT0M->GetBinContent(h1dFT0M->FindBin(nFT0M)) : 105.0f; - centFT0M(valueCentFT0M); - histos.fill(HIST("FT0M/percentile"), valueCentFT0M); - histos.fill(HIST("FT0M/percentilevsMult"), valueCentFT0M, nFT0M); - } - if (fillFt0A) { - const float valueCentFT0A = h1dFT0A ? h1dFT0A->GetBinContent(h1dFT0A->FindBin(nFT0A)) : 105.0f; - centFT0A(valueCentFT0A); - histos.fill(HIST("FT0A/percentile"), valueCentFT0A); - histos.fill(HIST("FT0A/percentilevsMult"), valueCentFT0A, nFT0A); - } - if (fillFt0C) { - const float valueCentFT0C = h1dFT0C ? h1dFT0C->GetBinContent(h1dFT0C->FindBin(nFT0C)) : 105.0f; - centFT0C(valueCentFT0C); - histos.fill(HIST("FT0C/percentile"), valueCentFT0C); - histos.fill(HIST("FT0C/percentilevsMult"), valueCentFT0C, nFT0C); - } - // const float valueCentFV0A = h1dFT0M->GetBinContent(h1dFT0M->FindBin(nFV0A)); - // centFV0A(valueCentFV0A); + mcCentralityBuilderModule.dataProcess(ccdb, histos, bcs, mcCollisions, products); } }; -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask(cfgc)}; } +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { + return WorkflowSpec{ + adaptAnalysisTask(cfgc)}; +} From 84756971f495526af04b87625b7a9e70bbd2b5b0 Mon Sep 17 00:00:00 2001 From: SCHOTTER Romain <47983209+romainschotter@users.noreply.github.com> Date: Tue, 25 Aug 2026 18:01:13 +0200 Subject: [PATCH 03/27] Adapt strangederivedbuilder to new StraMCMults model --- PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx b/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx index 94cf60e61d6..220d0dcc63c 100644 --- a/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx +++ b/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx @@ -854,6 +854,7 @@ struct strangederivedbuilder { products.strangeMCColl(mccollision.posX(), mccollision.posY(), mccollision.posZ(), mccollision.impactParameter(), mccollision.eventPlaneAngle(), mccollision.generatorsID()); products.strangeMCMults(mccollision.multMCFT0A(), mccollision.multMCFT0C(), + mccollision.multMCFV0A(), mccollision.multMCFDDA(), mccollision.multMCFDDC(), mccollision.multMCNParticlesEta05(), mccollision.multMCNParticlesEta08(), mccollision.multMCNParticlesEta10(), From e827983e5516c21eaaf05888a612b48983aa8f65 Mon Sep 17 00:00:00 2001 From: SCHOTTER Romain <47983209+romainschotter@users.noreply.github.com> Date: Tue, 25 Aug 2026 18:02:56 +0200 Subject: [PATCH 04/27] Add new StraMCCollMult version --- PWGLF/DataModel/LFStrangenessTables.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/PWGLF/DataModel/LFStrangenessTables.h b/PWGLF/DataModel/LFStrangenessTables.h index 057ff318f03..56322a0e47c 100644 --- a/PWGLF/DataModel/LFStrangenessTables.h +++ b/PWGLF/DataModel/LFStrangenessTables.h @@ -440,8 +440,10 @@ DECLARE_SOA_TABLE(StraMCCollMults_000, "AOD", "STRAMCCOLLMULTS", //! MC collisio mult::MultMCFT0A, mult::MultMCFT0C, mult::MultMCNParticlesEta05, mult::MultMCNParticlesEta08, mult::MultMCNParticlesEta10, o2::soa::Marker<2>); DECLARE_SOA_TABLE_VERSIONED(StraMCCollMults_001, "AOD", "STRAMCCOLLMULTS", 1, //! MC collision multiplicities mult::MultMCFT0A, mult::MultMCFT0C, mult::MultMCNParticlesEta05, mult::MultMCNParticlesEta08, mult::MultMCNParticlesEta10, stramccollision::TotalMultMCParticles); +DECLARE_SOA_TABLE_VERSIONED(StraMCCollMults_002, "AOD", "STRAMCCOLLMULTS", 2, //! MC collision multiplicities + mult::MultMCFT0A, mult::MultMCFT0C, mult::MultMCFV0A, mult::MultMCFDDA, mult::MultMCFDDC, mult::MultMCNParticlesEta05, mult::MultMCNParticlesEta08, mult::MultMCNParticlesEta10, stramccollision::TotalMultMCParticles); -using StraMCCollMults = StraMCCollMults_001; +using StraMCCollMults = StraMCCollMults_002; namespace dautrack { From 8fdaed053e79245d5c760952c82ad63dd138ae6b Mon Sep 17 00:00:00 2001 From: SCHOTTER Romain <47983209+romainschotter@users.noreply.github.com> Date: Tue, 25 Aug 2026 18:04:48 +0200 Subject: [PATCH 05/27] Add StrangenessMcCentrality task --- .../Strangeness/strangenessMcCentrality.cxx | 80 +++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 PWGLF/TableProducer/Strangeness/strangenessMcCentrality.cxx diff --git a/PWGLF/TableProducer/Strangeness/strangenessMcCentrality.cxx b/PWGLF/TableProducer/Strangeness/strangenessMcCentrality.cxx new file mode 100644 index 00000000000..a20182178ce --- /dev/null +++ b/PWGLF/TableProducer/Strangeness/strangenessMcCentrality.cxx @@ -0,0 +1,80 @@ +// 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 mcCentrality.cxx +/// \author Romain Schotter romain.schotter@cern.ch +/// \brief Task to produce the MC centrality table for strangeness derived data +/// + +#include "PWGLF/DataModel/mcCentrality.h" +#include "PWGLF/Utils/mcCentralityModule.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" + +#include "TableHelper.h" + +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::track; + +/// Task to produce the response table +struct StrangenessMcCentrality { + // Input parameters + o2::framework::Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Service ccdb; + + o2::pwglf::mccentrality::products products; + o2::pwglf::mccentrality::coreConfigurables baseOpts; + o2::pwglf::mccentrality::BuilderModule mcCentralityBuilderModule; + + HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + + void init(o2::framework::InitContext& initContext) + { + // Set up the CCDB + ccdb->setURL(ccdbUrl.value); + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + ccdb->setFatalWhenNull(false); + + mcCentralityBuilderModule.init(baseOpts, histos, initContext); + } + + // Full tables (independent on central calibrations) + void process(aod::StraMCCollMults const& mcCollisions, + aod::StraStamps const& bcs) + { + mcCentralityBuilderModule.dataProcess(ccdb, histos, bcs, mcCollisions, products); + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { + return WorkflowSpec{ + adaptAnalysisTask(cfgc)}; +} From 7790b7fe681d49e412066089e797de06a564314d Mon Sep 17 00:00:00 2001 From: SCHOTTER Romain <47983209+romainschotter@users.noreply.github.com> Date: Tue, 25 Aug 2026 18:05:41 +0200 Subject: [PATCH 06/27] Add McCentralityModule.h --- PWGLF/Utils/mcCentralityModule.h | 735 +++++++++++++++++++++++++++++++ 1 file changed, 735 insertions(+) create mode 100644 PWGLF/Utils/mcCentralityModule.h diff --git a/PWGLF/Utils/mcCentralityModule.h b/PWGLF/Utils/mcCentralityModule.h new file mode 100644 index 00000000000..a0bf7743d91 --- /dev/null +++ b/PWGLF/Utils/mcCentralityModule.h @@ -0,0 +1,735 @@ +// 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 mcCentralityModule.cxx +/// \author Romain Schotter romain.schotter@cern.ch +/// \brief Module to produce MC centrality table based on ANY table containing MC multiplicity +/// + +#ifndef PWGLF_UTILS_MCCENTRALITYMODULE_H_ +#define PWGLF_UTILS_MCCENTRALITYMODULE_H + +#include "PWGLF/DataModel/mcCentrality.h" + +#include "TableHelper.h" + +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#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; +using namespace o2::track; + +//__________________________________________ +// strangeness builder module + +namespace o2 +{ +namespace pwglf +{ +namespace mccentrality // avoid polluting other namespaces +{ + +// statics necessary for the configurables in this namespace +static constexpr int nParameters = 1; +static const std::vector tableNames{ + "McCentFV0As", + "McCentFT0Ms", + "McCentFT0As", + "McCentFT0Cs", + "McCentFT0CVariant1s", + "McCentFT0CVariant2s", + "McCentFDDMs", + "McCentNTPVs", + "McCentNGlobals", + "McCentMFTs" +}; + +static constexpr int nTablesConst = 10; +static const std::vector parameterNames{"enable"}; +static const int defaultParameters[nTablesConst][nParameters]{ + {-1}, + {-1}, + {-1}, + {-1}, + {-1}, + {-1}, + {-1}, + {-1}, + {-1}, + {-1}}; + +// table index : match order above +enum tableIndex { kFV0A = 0, + kFT0M, + kFT0A, + kFT0C, + kFT0CVariant1, + kFT0CVariant2, + kFDDM, + kNTPV, + kNGlobal, + kMFT, + kNestimators}; + +static constexpr const char* DirList[] = { + "FV0A", + "FT0M", + "FT0A", + "FT0C", + "FT0CVariant1", + "FT0CVariant2", + "FDDM", + "NTPV", + "NGlobal", + "MFT" +}; + +// mcCentralityModule: 1st-order configurables +struct coreConfigurables : o2::framework::ConfigurableGroup { + o2::framework::Configurable> enabledTables{"enabledTables", + {defaultParameters[0], nTablesConst, nParameters, tableNames, parameterNames}, + "Produce this table: -1 for autodetect; otherwise, 0/1 is false/true"}; + std::vector mEnabledTables; // Vector of enabled tables + + Configurable recalibrateCentrality{"recalibrateCentrality", false, "If true, re-calibrate the MC centrality for the binning in binPercentile."}; + Configurable recalibrateMode{"recalibrateMode", 1, "Strategy to calibrate MC centrality? 0: from low to high mult.; 1: from high to low mult."}; + Configurable minEntries{"minEntries", 100.f, "Minimum number of entries for estimating the mean value for the recalibration"}; + Configurable doNotCrashOnNull{"doNotCrashOnNull", false, "If ccdb object does not exist, fill with dummy values"}; + + Configurable assignCentralityPerCandidate{"assignCentralityPerCandidate", false, "If true, assign centrality by sampling P(centrality|generated multiplicity) per MC collision instead of the class-averaged (statistical) value"}; + Configurable centralitySamplingSeed{"centralitySamplingSeed", 137, "Base seed of the RNG used to sample centrality in candidate-by-candidate mode (assignCentralityPerCandidate)"}; + ConfigurableAxis binsPercentile{"binsPercentile", {VARIABLE_WIDTH, 0, 1.0, 5.0, 10.0, 15.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0}, "Binning of the percentile axis"}; + ConfigurableAxis binsPercentileFine{"binsPercentileFine", {VARIABLE_WIDTH, 0, 0.001, 0.01, 1.0, 5.0, 10.0, 15.0, 20.0, 25.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0}, "Binning of the percentile axis"}; + ConfigurableAxis binsMultiplicity{"binsMultiplicity", {1000, 0, 5000}, "Binning of the multiplicity axis"}; + + //ccdb configurables + Configurable path{"path", "/tmp/InputCalibMC.root", "path to calib file or ccdb path if begins with ccdb://"}; + + // debug option + Configurable verbose{"verbose", false, "If true, display more messages"}; +}; + +struct products : o2::framework::ProducesGroup { + // Tables to produce + o2::framework::Produces centFV0A; + o2::framework::Produces centFT0M; + o2::framework::Produces centFT0A; + o2::framework::Produces centFT0C; + o2::framework::Produces centFT0CVariant1; + o2::framework::Produces centFT0CVariant2; + o2::framework::Produces centFDDM; + o2::framework::Produces centNTPV; + o2::framework::Produces centNGlobal; + o2::framework::Produces centMFT; +}; + +template +concept HasMcMults = requires(typename T::iterator a) { + { a.multMCFT0A() } -> std::convertible_to; + { a.multMCFT0C() } -> std::convertible_to; + { a.multMCFV0A() } -> std::convertible_to; + { a.multMCFDDA() } -> std::convertible_to; + { a.multMCFDDC() } -> std::convertible_to; + { a.multMCNParticlesEta08() } -> std::convertible_to; + { a.multMCNParticlesEta05() } -> std::convertible_to; +}; + +/// Task to produce the response table +struct BuilderModule { + // Input parameters + Service ccdb; + + // declaration of structs here + // (N.B.: will be invisible to the outside, create your own copies) + coreConfigurables baseOpts; + + TList* MCCentralityCalibObjects = nullptr; + TH1D* h1dFV0A = nullptr; + TH1D* h1dFT0M = nullptr; + TH1D* h1dFT0A = nullptr; + TH1D* h1dFT0C = nullptr; + TH1D* h1dFT0CVariant1 = nullptr; + TH1D* h1dFT0CVariant2 = nullptr; + TH1D* h1dFDDM = nullptr; + TH1D* h1dNTPV = nullptr; + TH1D* h1dNGlobal = nullptr; + TH1D* h1dMFT = nullptr; + + // Calibration objects for candidate-by-candidate sampling (assignCentralityPerCandidate): + // x = centrality (%) of the matched reconstructed MC collision, y = generated multiplicity (|eta| < 0.5) + std::vector h2dCentVsGenMult; + TRandom3 fRandomSampler; + + // QA of the on-the-fly calibration (recalibrateCentrality): mean _{|eta|<0.5} in data and MC + // (reco), one entry per centrality class -- filled in extractCentralityCalibration(). + // Must be TProfile, not TH1D+SetBinContent/SetBinError: every grid job redundantly derives the exact + // same calibration from the same CCDB input, and grid-merged output histograms are combined via a + // plain bin-content sum (TH1::Merge), which would turn a mean into N_jobs*mean. TProfile stores the + // underlying sum(w)/sum(wy)/sum(wy^2) per bin and merges those correctly, so the mean/error recomputed + // from the merged output stay correct however many jobs contributed. For the same reason there is no + // ratio histogram here: a ratio of two already-merged means can't be reconstructed after the fact, so + // compute PVMC/PVData downstream from the merged output if you need it, not inside the task. + std::vector> hCalibPVData; + std::vector> hCalibPVMC; + + int nEnabledTables = 0; + int mRunNumber; + + // TAxis + int nCentBins; + std::vector centralityBins; + + // Registers the on-the-fly-calibration QA histograms for one estimator (no-op unless recalibrateCentrality + // is on): mean _{|eta|<0.5} in data and in MC (reco), one entry per centrality class, as TProfile + // (see the comment on hCalibPVData/hCalibPVMC for why TH1D+SetBinContent doesn't survive grid merging). + // Uses the runtime add() overload (returning the type-erased HistPtr) since the estimator name/directory + // is only known at runtime here, unlike fillHistograms() which relies on a compile-time HIST() lookup. + template + void registerCalibQAHistos(THistoRegistry& histos, int idx, const char* name) + { + if (!baseOpts.recalibrateCentrality) { + return; + } + AxisSpec axisCentClass{baseOpts.binsPercentile, Form("%s percentile (%%)", name)}; + hCalibPVData[idx] = std::get>(histos.add(Form("%s/calibPVData", name), Form("#LT #it{N}_{PV}^{Data} #GT vs %s percentile;%s percentile (%%);#LT #it{N}_{PV}^{Data} #GT_{|#it{#eta}|<0.5}", name, name), HistType::kTProfile, {axisCentClass})); + hCalibPVMC[idx] = std::get>(histos.add(Form("%s/calibPVMC", name), Form("#LT #it{N}_{PV}^{MC} #GT (reco) vs %s percentile;%s percentile (%%);#LT #it{N}_{PV}^{MC} #GT_{|#it{#eta}|<0.5} (reco)", name, name), HistType::kTProfile, {axisCentClass})); + } + + // Registers the candidate-by-candidate sampling QA (no-op unless assignCentralityPerCandidate is on): + // sampled percentile vs the generated multiplicity (|eta| < 0.5) actually used to key the sampling, so + // it can be visually compared against the input calibration (hGenMultEta05VsCentrality) to + // check that the sampled distribution reproduces the expected P(centrality|genMult). This is a plain + // TH2D (not a TProfile): unlike the calibration QA above, it stores a distribution to look at, not a + // mean to merge, so ordinary bin-content-sum merging across grid jobs is exactly what's wanted here. + template + void registerCandidateQAHistos(THistoRegistry& histos, const char* name) + { + if (!baseOpts.assignCentralityPerCandidate) { + return; + } + histos.add(Form("%s/percentileVsGenMultEta05", name), Form("Sampled %s percentile vs generated mult (|#it{#eta}|<0.5);%s percentile (%%);generated mult (|#it{#eta}|<0.5)", name, name), HistType::kTH2D, {{baseOpts.binsPercentileFine, Form("%s percentile", name)}, {baseOpts.binsMultiplicity, "generated mult (|#eta|<0.5)"}}); + } + + template + void init(TBaseConfigurables const& inputBaseOpts, THistoRegistry& histos, TInitContext& context) + { + // read in configurations from the task where it's used + // could be grouped even further, but should work + baseOpts = inputBaseOpts; + + baseOpts.mEnabledTables.resize(nTablesConst, 0); + h2dCentVsGenMult.resize(nTablesConst, nullptr); + hCalibPVData.resize(nTablesConst); + hCalibPVMC.resize(nTablesConst); + fRandomSampler.SetSeed(baseOpts.centralitySamplingSeed); + + LOGF(info, "Checking if MC centrality is required"); + auto& workflows = context.services().template get(); + + nEnabledTables = 0; + + TString listOfRequestors[nTablesConst]; + for (int i = 0; i < nTablesConst; i++) { + int f = baseOpts.enabledTables->get(tableNames[i].c_str(), "enable"); + if (f == 1) { + baseOpts.mEnabledTables[i] = 1; + listOfRequestors[i] = "manual enabling"; + nEnabledTables++; + } + if (f == -1) { + // autodetect this table in other devices + for (o2::framework::DeviceSpec const& device : workflows.devices) { + // Step 1: check if this device subscribed to the V0data table + for (auto const& input : device.inputs) { + if (o2::framework::DataSpecUtils::partialMatch(input.matcher, o2::header::DataOrigin("AOD"))) { + auto&& [origin, description, version] = o2::framework::DataSpecUtils::asConcreteDataMatcher(input.matcher); + std::string tableNameWithVersion = tableNames[i]; + if (version > 0) { + tableNameWithVersion += Form("_%03d", version); + } + if (input.matcher.binding == tableNameWithVersion) { + LOGF(info, "Device %s has subscribed to %s (version %i)", device.name, tableNames[i], version); + listOfRequestors[i].Append(Form("%s ", device.name.c_str())); + baseOpts.mEnabledTables[i] = 1; + nEnabledTables++; + } + } + } + } + } + } + + if (nEnabledTables == 0) { + LOGF(info, "MC centrality not required. Will suppress all functionality, including logs, from this point forward."); + return; + } + mRunNumber = 0; + + // TAxis + AxisSpec axisBinsPercentile{baseOpts.binsPercentile, "axisBinsPercentile"}; + nCentBins = axisBinsPercentile.binEdges.size() - 1; + for (std::size_t iCent = 0; iCent < axisBinsPercentile.binEdges.size(); iCent++) { + centralityBins.push_back(axisBinsPercentile.binEdges[iCent]); + } + + if (baseOpts.mEnabledTables[kFV0A]) { + histos.add("FV0A/percentile", "FV0A percentile.", HistType::kTH1D, {{baseOpts.binsPercentileFine, "FV0A percentile"}}); + histos.add("FV0A/percentilevsMult", "FV0A percentile.", HistType::kTH2D, {{baseOpts.binsPercentileFine, "FV0A percentile"}, {baseOpts.binsMultiplicity, "FV0A mult."}}); + registerCalibQAHistos(histos, kFV0A, "FV0A"); + registerCandidateQAHistos(histos, "FV0A"); + } + if (baseOpts.mEnabledTables[kFT0M]) { + histos.add("FT0M/percentile", "FT0M percentile.", HistType::kTH1D, {{baseOpts.binsPercentileFine, "FT0M percentile"}}); + histos.add("FT0M/percentilevsMult", "FT0M percentile.", HistType::kTH2D, {{baseOpts.binsPercentileFine, "FT0M percentile"}, {baseOpts.binsMultiplicity, "FT0M mult."}}); + registerCalibQAHistos(histos, kFT0M, "FT0M"); + registerCandidateQAHistos(histos, "FT0M"); + } + if (baseOpts.mEnabledTables[kFT0A]) { + histos.add("FT0A/percentile", "FT0A percentile.", HistType::kTH1D, {{baseOpts.binsPercentileFine, "FT0A percentile"}}); + histos.add("FT0A/percentilevsMult", "FT0A percentile.", HistType::kTH2D, {{baseOpts.binsPercentileFine, "FT0A percentile"}, {baseOpts.binsMultiplicity, "FT0A mult."}}); + registerCalibQAHistos(histos, kFT0A, "FT0A"); + registerCandidateQAHistos(histos, "FT0A"); + } + if (baseOpts.mEnabledTables[kFT0C]) { + histos.add("FT0C/percentile", "FT0C percentile.", HistType::kTH1D, {{baseOpts.binsPercentileFine, "FT0C percentile"}}); + histos.add("FT0C/percentilevsMult", "FT0C percentile.", HistType::kTH2D, {{baseOpts.binsPercentileFine, "FT0C percentile"}, {baseOpts.binsMultiplicity, "FT0C mult."}}); + registerCalibQAHistos(histos, kFT0C, "FT0C"); + registerCandidateQAHistos(histos, "FT0C"); + } + if (baseOpts.mEnabledTables[kFT0CVariant1]) { + histos.add("FT0CVariant1/percentile", "FT0CVariant1 percentile.", HistType::kTH1D, {{baseOpts.binsPercentileFine, "FT0CVariant1 percentile"}}); + histos.add("FT0CVariant1/percentilevsMult", "FT0CVariant1 percentile.", HistType::kTH2D, {{baseOpts.binsPercentileFine, "FT0CVariant1 percentile"}, {baseOpts.binsMultiplicity, "FT0C mult."}}); + registerCalibQAHistos(histos, kFT0CVariant1, "FT0CVariant1"); + registerCandidateQAHistos(histos, "FT0CVariant1"); + } + if (baseOpts.mEnabledTables[kFT0CVariant2]) { + histos.add("FT0CVariant2/percentile", "FT0CVariant2 percentile.", HistType::kTH1D, {{baseOpts.binsPercentileFine, "FT0CVariant2 percentile"}}); + histos.add("FT0CVariant2/percentilevsMult", "FT0CVariant2 percentile.", HistType::kTH2D, {{baseOpts.binsPercentileFine, "FT0CVariant2 percentile"}, {baseOpts.binsMultiplicity, "FT0C mult."}}); + registerCalibQAHistos(histos, kFT0CVariant2, "FT0CVariant2"); + registerCandidateQAHistos(histos, "FT0CVariant2"); + } + if (baseOpts.mEnabledTables[kFDDM]) { + histos.add("FDDM/percentile", "FDDM percentile.", HistType::kTH1D, {{baseOpts.binsPercentileFine, "FDDM percentile"}}); + histos.add("FDDM/percentilevsMult", "FDDM percentile.", HistType::kTH2D, {{baseOpts.binsPercentileFine, "FDDM percentile"}, {baseOpts.binsMultiplicity, "FDDM mult."}}); + registerCalibQAHistos(histos, kFDDM, "FDDM"); + registerCandidateQAHistos(histos, "FDDM"); + } + if (baseOpts.mEnabledTables[kNTPV]) { + histos.add("NTPV/percentile", "NTPV percentile.", HistType::kTH1D, {{baseOpts.binsPercentileFine, "NTPV percentile"}}); + histos.add("NTPV/percentilevsMult", "NTPV percentile.", HistType::kTH2D, {{baseOpts.binsPercentileFine, "NTPV percentile"}, {baseOpts.binsMultiplicity, "NTPV mult."}}); + registerCalibQAHistos(histos, kNTPV, "NTPV"); + registerCandidateQAHistos(histos, "NTPV"); + } + if (baseOpts.mEnabledTables[kNGlobal]) { + histos.add("NGlobal/percentile", "NGlobal percentile.", HistType::kTH1D, {{baseOpts.binsPercentileFine, "NGlobal percentile"}}); + histos.add("NGlobal/percentilevsMult", "NGlobal percentile.", HistType::kTH2D, {{baseOpts.binsPercentileFine, "NGlobal percentile"}, {baseOpts.binsMultiplicity, "NGlobal mult."}}); + registerCalibQAHistos(histos, kNGlobal, "NGlobal"); + registerCandidateQAHistos(histos, "NGlobal"); + } + if (baseOpts.mEnabledTables[kMFT]) { + histos.add("MFT/percentile", "MFT percentile.", HistType::kTH1D, {{baseOpts.binsPercentileFine, "MFT percentile"}}); + histos.add("MFT/percentilevsMult", "MFT percentile.", HistType::kTH2D, {{baseOpts.binsPercentileFine, "MFT percentile"}, {baseOpts.binsMultiplicity, "MFT mult."}}); + } + + LOGF(info, "*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*"); + LOGF(info, " MC centrality: basic configuration listing"); + LOGF(info, "*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*"); + // list enabled tables + for (int i = 0; i < nTablesConst; i++) { + // printout to be improved in the future + if (baseOpts.mEnabledTables[i]) { + LOGF(info, " -~> Table enabled: %s, requested by %s", tableNames[i], listOfRequestors[i].Data()); + } + } + } + + template + THist* getHist(const char* name) { + if (!this->MCCentralityCalibObjects) { + return (THist*)0x0; + } + auto hist = reinterpret_cast(this->MCCentralityCalibObjects->FindObject(name)); + if (!hist) { + if (this->baseOpts.verbose) { + this->MCCentralityCalibObjects->ls(); + } + if (this->baseOpts.doNotCrashOnNull) { + LOG(info) << "Could not open histogram " << name << " from TList, will fill tables with dummy values"; + } else { + LOG(fatal) << "Could not open histogram " << name << " from TList"; + } + } + return hist; + } + + TH1D* extractCentralityCalibration(int idx, const char* name, bool reverse = false) { + + auto CalibMC = [&](TString estimator){ + printf("\e[1;31mCalibration for %s estimator\e[0;00m -> Starting...\n", estimator.Data()); + + std::vector percentile_center(nCentBins); + std::vector epercentile_center(nCentBins); + + //Histograms + TH2D *h2dMultVsCent_Data = getHist(Form("h2dMultVsCent%s_Data", estimator.Data())); + TH2D *h2dMultRecoVsMultGen_MC = getHist(Form("hMultEta05VsGenMult%s", estimator.Data())); + if (!h2dMultVsCent_Data || !h2dMultRecoVsMultGen_MC) { + return (TH1D*)0x0; + } + + // QA of this on-the-fly calibration: mean _{|eta|<0.5} in data/MC per centrality class, + // registered by registerCalibQAHistos() (only non-null when recalibrateCentrality is on). Filled + // bin-by-bin from projData/projMC below (TProfile::Fill(x, y, weight)), not via SetBinContent, so + // that the mean/error reconstructed from the merged grid output stay statistically correct. + TProfile* hPVData = hCalibPVData[idx].get(); + TProfile* hPVMC = hCalibPVMC[idx].get(); + + TH1D *h1dCalib = h2dMultRecoVsMultGen_MC->ProjectionX(Form("h1d%s", estimator.Data()), 1, h2dMultRecoVsMultGen_MC->GetNbinsX()); + h1dCalib->Reset(); + h1dCalib->SetTitle(Form("%s calibration object", estimator.Data())); + h1dCalib->GetXaxis()->SetTitle(Form("#it{N}_{%s, gen.}", estimator.Data())); + h1dCalib->GetYaxis()->SetTitle(Form("%s percentile (%%)", estimator.Data())); + + // NOTE: candidate-by-candidate assignment (assignCentralityPerCandidate) does not go through this + // mean-matching path at all. It samples directly from the "hGenMultEta05VsCentrality" + // joint histogram (x = reco centrality of the matched MC collision, y = generated mult |eta|<0.5) + // retrieved in initCCDB() below, see h2dCentVsGenMult and dataProcess(). + + if (reverse) { + for (int i = 0; i < nCentBins; i++) { + int irev = i; + percentile_center[i] = (centralityBins[irev] + centralityBins[irev+1]) / 2; + epercentile_center[i] = (centralityBins[irev] - centralityBins[irev+1]) / 2; + } + + int startBinMc = h1dCalib->GetNbinsX(); + for (int i = 0; i < nCentBins; i++) { // Loop over centrality bins + // start from the end (from the high multiplicity collisions) + int irev = i; + TH1D* projData = h2dMultVsCent_Data->ProjectionY(Form("projData_%d", i), h2dMultVsCent_Data->GetXaxis()->FindBin(centralityBins[irev]+1e-5), + h2dMultVsCent_Data->GetXaxis()->FindBin(centralityBins[irev+1]-1e-5)); + + double meanMult_Data = projData->GetMean(); + + double meanMult_MC = -1; + double diffMultDataVsMC = 1e+09; + int endBinMc = startBinMc; + for (int j = startBinMc; j >= 1; j--) { + // Loop over MC bins + TH1D* projMC = h2dMultRecoVsMultGen_MC->ProjectionY("", j, startBinMc); + int nEntries = projMC->Integral(); + double meanMC = projMC->GetMean(); + double ldiff = std::abs(meanMC - meanMult_Data); + // std::cout << ldiff << std::endl; + + // if less than 100 entries for estimating the mean, do not consider it + if (nEntries < baseOpts.minEntries) + continue; + + // Find the minimum difference and corresponding MC bin + if (ldiff < diffMultDataVsMC) { + diffMultDataVsMC = ldiff; + meanMult_MC = meanMC; + endBinMc = j; + } + } + if (i == nCentBins-1) { + endBinMc = 1; + } + + TH1D* projMC = h2dMultRecoVsMultGen_MC->ProjectionY(Form("projMC_%d", i), endBinMc, startBinMc); + + // Refill the per-class mean from the underlying (data/MC) multiplicity distributions, bin by + // bin, so the TProfile accumulates real sum(w)/sum(wy)/sum(wy^2) rather than a precomputed mean. + if (hPVData) { + for (int ybin = 1; ybin <= projData->GetNbinsX(); ybin++) { + double w = projData->GetBinContent(ybin); + if (w > 0) { + hPVData->Fill(percentile_center[i], projData->GetBinCenter(ybin), w); + } + } + } + if (hPVMC) { + for (int ybin = 1; ybin <= projMC->GetNbinsX(); ybin++) { + double w = projMC->GetBinContent(ybin); + if (w > 0) { + hPVMC->Fill(percentile_center[i], projMC->GetBinCenter(ybin), w); + } + } + } + + printf("\e[1;31mCalibration for %s estimator\e[0;00m -> Data centrality bin \e[1;31m%g-%g%%\e[0;00m\n", estimator.Data(), centralityBins[irev], centralityBins[irev+1]); + printf("\e[1;31mCalibration for %s estimator\e[0;00m -> MC multiplicity range %g-%g\n", estimator.Data(), projMC->GetBinLowEdge(endBinMc), projMC->GetBinLowEdge(startBinMc)); + printf("\e[1;31mCalibration for %s estimator\e[0;00m -> data = %.4f Vs MC = %.4f (MC/Data = %.4f%%)\n", estimator.Data(), meanMult_Data, meanMult_MC, (meanMult_MC-meanMult_Data) * 100 / meanMult_Data); + printf("\e[1;31mCalibration for %s estimator\e[0;00m -> N entries Data = %g Vs N entries MC = %g\n", estimator.Data(), projData->Integral(), projMC->Integral()); + printf("\n"); + for (int ibin = 1; ibin <= h1dCalib->GetNbinsX(); ibin++) { + if (ibin <= startBinMc && ibin >= endBinMc){ + h1dCalib->SetBinContent(ibin, percentile_center[i]); + } + } + startBinMc = endBinMc; + } // End loop over centrality bins + } else { + for (int i = 0; i < nCentBins; i++) { + int irev = nCentBins - i; + percentile_center[i] = (centralityBins[irev-1] + centralityBins[irev]) / 2; + epercentile_center[i] = (centralityBins[irev] - centralityBins[irev-1]) / 2; + } + int startBinMc = 1; + for (int i = 0; i < nCentBins; i++) { // Loop over centrality bins + // start from the end (from the low multiplicity collisions) + int irev = nCentBins - i; + TH1D* projData = h2dMultVsCent_Data->ProjectionY(Form("projData_%d", i), h2dMultVsCent_Data->GetXaxis()->FindBin(centralityBins[irev-1]+1e-5), + h2dMultVsCent_Data->GetXaxis()->FindBin(centralityBins[irev]-1e-5)); + + double meanMult_Data = projData->GetMean(); + + double meanMult_MC = -1; + double diffMultDataVsMC = 1e+09; + int endBinMc = h1dCalib->GetNbinsX(); + for (int j = startBinMc; j <= h1dCalib->GetNbinsX(); j++) { + // Loop over MC bins + TH1D* projMC = h2dMultRecoVsMultGen_MC->ProjectionY("", startBinMc, endBinMc); + int nEntries = projMC->Integral(); + double meanMC = projMC->GetMean(); + double ldiff = std::abs(meanMC - meanMult_Data); + // std::cout << ldiff << std::endl; + + // if less than 100 entries for estimating the mean, do not consider it + if (nEntries < baseOpts.minEntries) + continue; + + // Find the minimum difference and corresponding MC bin + if (ldiff < diffMultDataVsMC) { + diffMultDataVsMC = ldiff; + meanMult_MC = meanMC; + endBinMc = j; + } + } + if (i == nCentBins-1) { + endBinMc = h2dMultRecoVsMultGen_MC->GetNbinsX(); + } + + TH1D* projMC = h2dMultRecoVsMultGen_MC->ProjectionY(Form("projMC_%d", i), startBinMc, endBinMc); + + // Refill the per-class mean from the underlying (data/MC) multiplicity distributions, bin by + // bin, so the TProfile accumulates real sum(w)/sum(wy)/sum(wy^2) rather than a precomputed mean. + if (hPVData) { + for (int ybin = 1; ybin <= projData->GetNbinsX(); ybin++) { + double w = projData->GetBinContent(ybin); + if (w > 0) { + hPVData->Fill(percentile_center[i], projData->GetBinCenter(ybin), w); + } + } + } + if (hPVMC) { + for (int ybin = 1; ybin <= projMC->GetNbinsX(); ybin++) { + double w = projMC->GetBinContent(ybin); + if (w > 0) { + hPVMC->Fill(percentile_center[i], projMC->GetBinCenter(ybin), w); + } + } + } + + printf("\e[1;31mCalibration for %s estimator\e[0;00m -> Data centrality bin \e[1;31m%g-%g%%\e[0;00m\n", estimator.Data(), centralityBins[irev-1], centralityBins[irev]); + printf("\e[1;31mCalibration for %s estimator\e[0;00m -> MC multiplicity range %g-%g\n", estimator.Data(), projMC->GetBinLowEdge(startBinMc), projMC->GetBinLowEdge(endBinMc+1)); + printf("\e[1;31mCalibration for %s estimator\e[0;00m -> data = %.4f Vs MC = %.4f\n", estimator.Data(), meanMult_Data, meanMult_MC); + printf("\e[1;31mCalibration for %s estimator\e[0;00m -> N entries Data = %g Vs N entries MC = %g\n", estimator.Data(), projData->Integral(), projMC->Integral()); + for (int ibin = 1; ibin <= h1dCalib->GetNbinsX(); ibin++) { + if (ibin <= endBinMc && ibin >= startBinMc){ + h1dCalib->SetBinContent(ibin, percentile_center[i]); + } + } + + startBinMc = endBinMc+1; + } // End loop over centrality bins + } + + printf("\e[1;31mCalibration for %s estimator\e[0;00m -> Done!\n", estimator.Data()); + + return h1dCalib; + }; + return CalibMC(name); + } + + // Loads the calibration object(s) for a single estimator: either the class-averaged TH1D (statistical + // assignment) or, in candidate-by-candidate mode, the raw joint TH2D used to sample P(centrality|genMult). + void loadEstimatorCalibration(int idx, const char* name, TH1D*& h1dOut) + { + if (!baseOpts.mEnabledTables[idx]) { + return; + } + if (baseOpts.assignCentralityPerCandidate) { + // x = reco centrality of the matched MC collision, y = generated multiplicity (|eta| < 0.5) + // filled directly by the calibration-producing task (e.g. centralityQa.cxx); used as-is, no + // mean-matching required since it is already a genuine joint distribution. + h2dCentVsGenMult[idx] = getHist(Form("hGenMultEta05VsCentrality%s", name)); + return; + } + h1dOut = baseOpts.recalibrateCentrality ? extractCentralityCalibration(idx, name, baseOpts.recalibrateMode) : getHist(Form("h1d%s", name)); + } + + template + bool initCCDB(TCCDB& ccdb, TBCs const& bcs) + { + if (!bcs.size()) { + LOGF(warn, "No BC found, skipping this DF."); + return false; // signal to skip this DF + } + + if (mRunNumber == bcs.iteratorAt(0).runNumber()) { + return true; + } + // mark this run as configured + mRunNumber = bcs.iteratorAt(0).runNumber(); + + MCCentralityCalibObjects = ccdb->template getForRun(baseOpts.path, mRunNumber); + if (MCCentralityCalibObjects) { + LOGF(info, "loaded TList with this many objects: %i", MCCentralityCalibObjects->GetEntries()); + } + + loadEstimatorCalibration(kFV0A, "FV0A", h1dFV0A); + loadEstimatorCalibration(kFT0M, "FT0M", h1dFT0M); + loadEstimatorCalibration(kFT0A, "FT0A", h1dFT0A); + loadEstimatorCalibration(kFT0C, "FT0C", h1dFT0C); + loadEstimatorCalibration(kFT0CVariant1, "FT0CVariant1", h1dFT0CVariant1); + loadEstimatorCalibration(kFT0CVariant2, "FT0CVariant2", h1dFT0CVariant2); + loadEstimatorCalibration(kFDDM, "FDDM", h1dFDDM); + loadEstimatorCalibration(kNTPV, "NTPV", h1dNTPV); + loadEstimatorCalibration(kNGlobal, "NGlobal", h1dNGlobal); + if (baseOpts.mEnabledTables[kMFT]) { + // to be added later (multMCMFT not yet available), kept as a dedicated block on purpose + } + LOG(info) << "Fully configured for run: " << mRunNumber; + + return true; + } + + template + void fillHistograms(HistogramRegistry& histos, double percentile, double multiplicity, double genMultEta05) + { + histos.fill(HIST(DirList[tableIndex]) + HIST("/percentile"), percentile); + histos.fill(HIST(DirList[tableIndex]) + HIST("/percentilevsMult"), percentile, multiplicity); + if (baseOpts.assignCentralityPerCandidate) { + // QA of the sampling itself: sampled percentile vs the generated multiplicity it was actually keyed + // on (registered by registerCandidateQAHistos()), so it can be compared to the input calibration. + histos.fill(HIST(DirList[tableIndex]) + HIST("/percentileVsGenMultEta05"), percentile, genMultEta05); + } + } + + // Combines the run number, a per-DF collision sequence number and the estimator index into a single RNG + // seed, so that a given generated collision always draws the same sampled centrality for a given + // estimator, regardless of processing order (note: the sequence number is only unique within one DF, + // it is not a persistent table index). + // This is a simple hash-combine, not a cryptographic hash: the strides just keep the three fields from + // landing on the same seed value for the collision counts typically seen in one run, they don't + // guarantee it. A rare accidental collision only means two unrelated collisions share a random draw, + // which has no systematic effect on the sampled distribution. + ULong64_t computeSamplingSeed(int64_t collisionIndex, int tableIdx) const + { + static constexpr ULong64_t kCollisionStride = 131ull; // > kNestimators, so tableIdx can't alias into the collision term + static constexpr ULong64_t kRunStride = 1000003ull; // prime, well above kCollisionStride * (typical collisions per DF) + return baseOpts.centralitySamplingSeed.value + kRunStride * static_cast(mRunNumber) + + kCollisionStride * static_cast(collisionIndex) + static_cast(tableIdx); + } + + //__________________________________________________ + template + void dataProcess(TCCDB& ccdb, THistoRegistry& histos, TBCs const& bcs, const HasMcMults auto& mcCollisions, TProducts& products) + { + if (nEnabledTables == 0) { + return; // fully suppressed + } + + if (!initCCDB(ccdb, bcs)) + return; + + // Local per-DF sequence number used only to seed the candidate-by-candidate sampling below: not every + // joined mcCollisions type carries an index column (globalIndex()), so we cannot rely on that instead. + int64_t mcCollisionCounter = 0; + for (const auto& mcCollision : mcCollisions) { + const double nFV0A = mcCollision.multMCFV0A(); + const double nFT0A = mcCollision.multMCFT0A(); + const double nFT0C = mcCollision.multMCFT0C(); + const double nFDDA = mcCollision.multMCFDDA(); + const double nFDDC = mcCollision.multMCFDDC(); + const double nGlobal = mcCollision.multMCNParticlesEta08(); + const double nGenMultEta05 = mcCollision.multMCNParticlesEta05(); + // const double nMFT = mcCollision.multMCMFT(); // to be added later + const double nFT0M = nFT0A + nFT0C; + const double nFDDM = nFDDA + nFDDC; + + auto populateTable = [&](auto& table, TH1D* h1dMultCalib, TH2D* h2dCentCalib, double multiplicity, auto tableIndex) { + double percentile = 105.0f; + if (baseOpts.mEnabledTables[tableIndex]) { + if (baseOpts.assignCentralityPerCandidate && h2dCentCalib) { + // Sample P(centrality | genMult) for this generated collision: slice h2dCentCalib at the + // y-bin (generated mult |eta|<0.5) matching this collision and draw from that 1-D distribution. + fRandomSampler.SetSeed(computeSamplingSeed(mcCollisionCounter, tableIndex.value)); + int yBin = h2dCentCalib->GetYaxis()->FindBin(nGenMultEta05); + std::unique_ptr pdf{h2dCentCalib->ProjectionX(Form("pdfCent_%d", tableIndex.value), yBin, yBin)}; + if (pdf->Integral() > 0) { + percentile = pdf->GetRandom(&fRandomSampler); + } + fillHistograms(histos, percentile, multiplicity, nGenMultEta05); + } else if (h1dMultCalib) { + int bin = h1dMultCalib->FindBin(multiplicity); + percentile = h1dMultCalib->GetBinContent(bin); + fillHistograms(histos, percentile, multiplicity, nGenMultEta05); + } + table(percentile); + } + return percentile; + }; + + populateTable(products.centFV0A, h1dFV0A, h2dCentVsGenMult[kFV0A], nFV0A, std::integral_constant{}); + populateTable(products.centFT0M, h1dFT0M, h2dCentVsGenMult[kFT0M], nFT0M, std::integral_constant{}); + populateTable(products.centFT0A, h1dFT0A, h2dCentVsGenMult[kFT0A], nFT0A, std::integral_constant{}); + populateTable(products.centFT0C, h1dFT0C, h2dCentVsGenMult[kFT0C], nFT0C, std::integral_constant{}); + populateTable(products.centFT0CVariant1, h1dFT0CVariant1, h2dCentVsGenMult[kFT0CVariant1], nFT0C, std::integral_constant{}); + populateTable(products.centFT0CVariant2, h1dFT0CVariant2, h2dCentVsGenMult[kFT0CVariant2], nFT0C, std::integral_constant{}); + populateTable(products.centFDDM, h1dFDDM, h2dCentVsGenMult[kFDDM], nFDDM, std::integral_constant{}); + populateTable(products.centNTPV, h1dNTPV, h2dCentVsGenMult[kNTPV], nGlobal, std::integral_constant{}); + populateTable(products.centNGlobal, h1dNGlobal, h2dCentVsGenMult[kNGlobal], nGlobal, std::integral_constant{}); + // populateTable(products.centMFT, h1dMFT, h2dCentVsGenMult[kMFT], nMFT, std::integral_constant{}); // to be added later + + mcCollisionCounter++; + } + } +}; // end mcCentralityModule + +} // namespace mccentrality +} // namespace pwglf +} // namespace o2 + +#endif // PWGLF_UTILS_MCCENTRALITYMODULE_ From e0067a31876c99230256fc308bbc6d82d05d7246 Mon Sep 17 00:00:00 2001 From: SCHOTTER Romain <47983209+romainschotter@users.noreply.github.com> Date: Tue, 25 Aug 2026 18:06:31 +0200 Subject: [PATCH 07/27] Add converter task for StraMCCollMults_002 --- .../Converters/stramccollmultconverter2.cxx | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 PWGLF/TableProducer/Strangeness/Converters/stramccollmultconverter2.cxx diff --git a/PWGLF/TableProducer/Strangeness/Converters/stramccollmultconverter2.cxx b/PWGLF/TableProducer/Strangeness/Converters/stramccollmultconverter2.cxx new file mode 100644 index 00000000000..cc56470aacd --- /dev/null +++ b/PWGLF/TableProducer/Strangeness/Converters/stramccollmultconverter2.cxx @@ -0,0 +1,46 @@ +// 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. +#include "PWGLF/DataModel/LFStrangenessTables.h" + +#include +#include +#include +#include + +using namespace o2; +using namespace o2::framework; + +// Converts V0 version 001 to 002 +struct stramccollmultconverter2 { + Produces straMCCollMults_002; + + void process(aod::StraMCCollMults_001 const& straMCcolls) + { + straMCCollMults_002.reserve(straMCcolls.size()); + for (auto& straMCcoll : straMCcolls) { + straMCCollMults_002(straMCcoll.multMCFT0A(), + straMCcoll.multMCFT0C(), + -1., // dummy value multMCFV0A + -1., // dummy value multMCFDDA + -1., // dummy value multMCFDDC + straMCcoll.multMCNParticlesEta05(), + straMCcoll.multMCNParticlesEta08(), + straMCcoll.multMCNParticlesEta10(), + straMCcoll.totalMultMCParticles()); + } + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc)}; +} From 62d6737d5a5040355994ad8e4892a0f59ab41c8b Mon Sep 17 00:00:00 2001 From: SCHOTTER Romain <47983209+romainschotter@users.noreply.github.com> Date: Tue, 25 Aug 2026 18:12:36 +0200 Subject: [PATCH 08/27] Add option to use MC centrality --- .../derivedlambdakzeroanalysis.cxx | 66 ++++++++++++------- 1 file changed, 44 insertions(+), 22 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx b/PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx index 2a10605f42d..cdf9d6a9dbe 100644 --- a/PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx +++ b/PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx @@ -113,6 +113,7 @@ struct derivedlambdakzeroanalysis { Configurable irSource{"irSource", "", "Estimator of the interaction rate (Recommended: pp --> T0VTX, Pb-Pb --> ZNC hadronic)"}; Configurable centralityEstimator{"centralityEstimator", kCentFT0C, "Run 3 centrality estimator (0:CentFT0C, 1:CentFT0M, 2:CentFT0CVariant1, 3:CentMFT, 4:CentNGlobal, 5:CentFV0A)"}; Configurable doUPCanalysis{"doUPCanalysis", true, "Study V0s in hadronic and UPC collisions"}; + Configurable useMcCentrality{"useMcCentrality", false, "Use MC centrality?"}; Configurable doEventQA{"doEventQA", false, "do event QA histograms"}; Configurable doCompleteTopoQA{"doCompleteTopoQA", false, "do topological variable QA histograms"}; @@ -733,6 +734,9 @@ struct derivedlambdakzeroanalysis { histos.add("hEventCentrality", "hEventCentrality", kTH1D, {axisConfigurations.axisCentralityFine}); histos.add("hCentralityVsNch", "hCentralityVsNch", kTH2D, {axisConfigurations.axisCentralityFine, axisConfigurations.axisNch}); + if (useMcCentrality) { + histos.add("hEventVsGenCentrality", "hEventVsGenCentrality", kTH2D, {axisConfigurations.axisCentralityFine, axisConfigurations.axisCentralityFine}); + } if (doEventQA) { if (isRun3) { histos.add("hEventSelectionVsCentrality", "hEventSelectionVsCentrality", kTH2D, {{23, -0.5f, +22.5f}, axisConfigurations.axisCentralityFine}); @@ -1266,22 +1270,36 @@ struct derivedlambdakzeroanalysis { // If takeMcCentrality is enabled, the centrality is taken from the MC collision; otherwise it is taken // from the reconstructed collision. Returns -1 if no corresponding centrality estimator is found or if no MC collision is associated to the recoed collision. template - auto getCentralityRun3(TCollision const& collision) + auto getCentralityRun3(TCollision const& collision, bool takeMcCentrality) { - if (centralityEstimator == kCentFT0C) - return collision.centFT0C(); - else if (centralityEstimator == kCentFT0M) - return collision.centFT0M(); - else if (centralityEstimator == kCentFT0CVariant1) - return collision.centFT0CVariant1(); - else if (centralityEstimator == kCentMFT) - return collision.centMFT(); - else if (centralityEstimator == kCentNGlobal) - return collision.centNGlobal(); - else if (centralityEstimator == kCentFV0A) - return collision.centFV0A(); - - return -1.f; + // Helper lambda to extract centrality from any object exposing the cent* columns + auto extractCentrality = [this](auto const& coll) -> float { + switch (centralityEstimator) { + case kCentFT0C: return coll.centFT0C(); + case kCentFT0M: return coll.centFT0M(); + case kCentFT0CVariant1: return coll.centFT0CVariant1(); + // case kCentMFT: return coll.centMFT(); + case kCentNGlobal: return coll.centNGlobal(); + case kCentFV0A: return coll.centFV0A(); + default: return -1.f; + } + }; + + // check if we are in MC + if constexpr (requires { collision.straMCCollisionId(); }) { + if (takeMcCentrality) { // check if we need to extract centrality from recoed or generated collision + // if recoed collision has a MC collision, de-reference it and extract centrality from it + // otherwise return -1.f + if (collision.has_straMCCollision()) { + auto mcCollision = collision.template straMCCollision_as>(); + return extractCentrality(mcCollision); + } else { + return -1.f; + } + } + } + + return extractCentrality(collision); } // ______________________________________________________ @@ -2292,7 +2310,7 @@ struct derivedlambdakzeroanalysis { histos.fill(HIST("hEventSelection"), 0. /* all collisions */); if (doEventQA) { if constexpr (requires { collision.centFT0C(); }) { // check if we are in Run 3 - centrality = getCentralityRun3(collision); + centrality = getCentralityRun3(collision, useMcCentrality); } histos.fill(HIST("hEventSelectionVsCentrality"), 0. /* all collisions */, centrality); } @@ -2672,7 +2690,7 @@ struct derivedlambdakzeroanalysis { void fillReconstructedEventProperties(TCollision const& collision, float& centrality, float& collisionOccupancy, double& interactionRate, int& gapSide, int& selGapSide) { if constexpr (requires { collision.centFT0C(); }) { // check if we are in Run 3 - centrality = getCentralityRun3(collision); + centrality = getCentralityRun3(collision, useMcCentrality); collisionOccupancy = eventSelections.useFT0CbasedOccupancy ? collision.ft0cOccupancyInTimeRange() : collision.trackOccupancyInTimeRange(); // Fetch interaction rate only if required (in order to limit ccdb calls) interactionRate = !irSource.value.empty() ? rateFetcher.fetch(ccdb.service, collision.timestamp(), collision.runNumber(), irSource) * 1.e-3 : -1; @@ -2682,6 +2700,10 @@ struct derivedlambdakzeroanalysis { centrality = hRawCentrality->GetBinContent(hRawCentrality->FindBin(centralityEstimator == kCentFT0M ? collision.multFT0A() + collision.multFT0C() : collision.multFT0C())); } + if (useMcCentrality) { + histos.fill(HIST("hEventVsGenCentrality"), getCentralityRun3(collision, false), getCentralityRun3(collision, true)); + } + if (doUPCanalysis) { // gap side gapSide = collision.gapSide(); @@ -2772,7 +2794,7 @@ struct derivedlambdakzeroanalysis { if constexpr (run3) { // check if we are in Run 3 if (biggestNContribs < collision.multPVTotalContributors()) { biggestNContribs = collision.multPVTotalContributors(); - centrality = getCentralityRun3(collision); + centrality = getCentralityRun3(collision, useMcCentrality); } } else { // we are in Run 2: there should be only one collision in groupedCollisions centrality = eventSelections.useSPDTrackletsCent ? collision.centRun2SPDTracklets() : collision.centRun2V0M(); @@ -3009,7 +3031,7 @@ struct derivedlambdakzeroanalysis { if (listBestCollisionIdx[mcCollision.globalIndex()] > -1) { auto collision = collisions.iteratorAt(listBestCollisionIdx[mcCollision.globalIndex()]); if constexpr (requires { collision.centFT0C(); }) { // check if we are in Run 3 - centrality = getCentralityRun3(collision); + centrality = getCentralityRun3(collision, useMcCentrality); } else { // no, we are in Run 2 centrality = eventSelections.useSPDTrackletsCent ? collision.centRun2SPDTracklets() : collision.centRun2V0M(); } @@ -3073,7 +3095,7 @@ struct derivedlambdakzeroanalysis { if (listBestCollisionIdx[mcCollision.globalIndex()] > -1) { auto collision = collisions.iteratorAt(listBestCollisionIdx[mcCollision.globalIndex()]); if constexpr (requires { collision.centFT0C(); }) { // check if we are in Run 3 - centrality = getCentralityRun3(collision); + centrality = getCentralityRun3(collision, useMcCentrality); } else { // no, we are in Run 2 centrality = eventSelections.useSPDTrackletsCent ? collision.centRun2SPDTracklets() : collision.centRun2V0M(); } @@ -3194,7 +3216,7 @@ struct derivedlambdakzeroanalysis { // ______________________________________________________ // Simulated processing in Run 3 (subscribes to MC information too) - void processMonteCarloRun3(soa::Join::iterator const& collision, V0McCandidates const& fullV0s, DauTracks const&, aod::MotherMCParts const&, soa::Join const& /*mccollisions*/, soa::Join const&) + void processMonteCarloRun3(soa::Join::iterator const& collision, V0McCandidates const& fullV0s, DauTracks const&, aod::MotherMCParts const&, soa::Join const& /*mccollisions*/, soa::Join const&) { analyzeRecoedV0sInMonteCarlo(collision, fullV0s); } @@ -3208,7 +3230,7 @@ struct derivedlambdakzeroanalysis { // ______________________________________________________ // Simulated processing in Run 3 (subscribes to MC information too) - void processGeneratedRun3(soa::Join const& mcCollisions, soa::Join const& V0MCCores, soa::Join const& CascMCCores, soa::Join const& collisions) + void processGeneratedRun3(soa::Join const& mcCollisions, soa::Join const& V0MCCores, soa::Join const& CascMCCores, soa::Join const& collisions) { analyzeGeneratedV0s(mcCollisions, V0MCCores, CascMCCores, collisions); } From 4c5d1e7b901890a621d7afaa4a2514a7da1ec5e3 Mon Sep 17 00:00:00 2001 From: SCHOTTER Romain <47983209+romainschotter@users.noreply.github.com> Date: Tue, 25 Aug 2026 18:42:49 +0200 Subject: [PATCH 09/27] Add histograms as a function of MC Centrality Added histogram definitions for generated events and centrality analysis based on the use of MC centrality. Updated filling logic for histograms to accommodate new centrality-based conditions. --- .../derivedlambdakzeroanalysis.cxx | 158 ++++++++++++++---- 1 file changed, 123 insertions(+), 35 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx b/PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx index cdf9d6a9dbe..511c38a3061 100644 --- a/PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx +++ b/PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx @@ -1194,10 +1194,16 @@ struct derivedlambdakzeroanalysis { // Creation of histograms: MC generated if ((doprocessGeneratedRun3 || doprocessGeneratedRun2)) { - histos.add("hGenEvents", "hGenEvents", kTH2D, {{axisConfigurations.axisNch}, {2, -0.5f, +1.5f}}); - histos.get(HIST("hGenEvents"))->GetYaxis()->SetBinLabel(1, "All gen. events"); - histos.get(HIST("hGenEvents"))->GetYaxis()->SetBinLabel(2, "Gen. with at least 1 rec. events"); - histos.add("hGenEventCentrality", "hGenEventCentrality", kTH1D, {{101, 0.0f, 101.0f}}); + if (useMcCentrality) { + histos.add("hGenEventsVsMcCentrality", "hGenEventsVsMcCentrality", kTH2D, {axisCentralityFine, {2, -0.5f, +1.5f}}); + histos.get(HIST("hGenEventsVsMcCentrality"))->GetYaxis()->SetBinLabel(1, "All gen. events"); + histos.get(HIST("hGenEventsVsMcCentrality"))->GetYaxis()->SetBinLabel(2, "Gen. with at least 1 rec. events"); + } else { + histos.add("hGenEvents", "hGenEvents", kTH2D, {{axisConfigurations.axisNch}, {2, -0.5f, +1.5f}}); + histos.get(HIST("hGenEvents"))->GetYaxis()->SetBinLabel(1, "All gen. events"); + histos.get(HIST("hGenEvents"))->GetYaxis()->SetBinLabel(2, "Gen. with at least 1 rec. events"); + } + histos.add("hGenEventCentrality", "hGenEventCentrality", kTH1D, {axisCentralityFine}); histos.add("hCentralityVsNcoll_beforeEvSel", "hCentralityVsNcoll_beforeEvSel", kTH2D, {axisConfigurations.axisCentrality, {50, -0.5f, 49.5f}}); histos.add("hCentralityVsNcoll_afterEvSel", "hCentralityVsNcoll_afterEvSel", kTH2D, {axisConfigurations.axisCentrality, {50, -0.5f, 49.5f}}); @@ -1212,21 +1218,39 @@ struct derivedlambdakzeroanalysis { histos.add("h2dGenOmegaMinus", "h2dGenOmegaMinus", kTH2D, {axisConfigurations.axisCentrality, axisConfigurations.axisPt}); histos.add("h2dGenOmegaPlus", "h2dGenOmegaPlus", kTH2D, {axisConfigurations.axisCentrality, axisConfigurations.axisPt}); - histos.add("h2dGenK0ShortVsMultMC_RecoedEvt", "h2dGenK0ShortVsMultMC_RecoedEvt", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisPt}); - histos.add("h2dGenLambdaVsMultMC_RecoedEvt", "h2dGenLambdaVsMultMC_RecoedEvt", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisPt}); - histos.add("h2dGenAntiLambdaVsMultMC_RecoedEvt", "h2dGenAntiLambdaVsMultMC_RecoedEvt", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisPt}); - histos.add("h2dGenXiMinusVsMultMC_RecoedEvt", "h2dGenXiMinusVsMultMC_RecoedEvt", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisPt}); - histos.add("h2dGenXiPlusVsMultMC_RecoedEvt", "h2dGenXiPlusVsMultMC_RecoedEvt", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisPt}); - histos.add("h2dGenOmegaMinusVsMultMC_RecoedEvt", "h2dGenOmegaMinusVsMultMC_RecoedEvt", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisPt}); - histos.add("h2dGenOmegaPlusVsMultMC_RecoedEvt", "h2dGenOmegaPlusVsMultMC_RecoedEvt", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisPt}); - - histos.add("h2dGenK0ShortVsMultMC", "h2dGenK0ShortVsMultMC", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisPt}); - histos.add("h2dGenLambdaVsMultMC", "h2dGenLambdaVsMultMC", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisPt}); - histos.add("h2dGenAntiLambdaVsMultMC", "h2dGenAntiLambdaVsMultMC", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisPt}); - histos.add("h2dGenXiMinusVsMultMC", "h2dGenXiMinusVsMultMC", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisPt}); - histos.add("h2dGenXiPlusVsMultMC", "h2dGenXiPlusVsMultMC", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisPt}); - histos.add("h2dGenOmegaMinusVsMultMC", "h2dGenOmegaMinusVsMultMC", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisPt}); - histos.add("h2dGenOmegaPlusVsMultMC", "h2dGenOmegaPlusVsMultMC", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisPt}); + if (useMcCentrality) { + histos.add("h2dGenK0ShortVsMcCentrality_RecoedEvt", "h2dGenK0ShortVsMcCentrality_RecoedEvt", kTH2D, {axisConfigurations.axisCentralityFine, axisConfigurations.axisPt}); + histos.add("h2dGenLambdaVsMcCentrality_RecoedEvt", "h2dGenLambdaVsMcCentrality_RecoedEvt", kTH2D, {axisConfigurations.axisCentralityFine, axisConfigurations.axisPt}); + histos.add("h2dGenAntiLambdaVsMcCentrality_RecoedEvt", "h2dGenAntiLambdaVsMcCentrality_RecoedEvt", kTH2D, {axisConfigurations.axisCentralityFine, axisConfigurations.axisPt}); + histos.add("h2dGenXiMinusVsMcCentrality_RecoedEvt", "h2dGenXiMinusVsMcCentrality_RecoedEvt", kTH2D, {axisConfigurations.axisCentralityFine, axisConfigurations.axisPt}); + histos.add("h2dGenXiPlusVsMcCentrality_RecoedEvt", "h2dGenXiPlusVsMcCentrality_RecoedEvt", kTH2D, {axisConfigurations.axisCentralityFine, axisConfigurations.axisPt}); + histos.add("h2dGenOmegaMinusVsMcCentrality_RecoedEvt", "h2dGenOmegaMinusVsMcCentrality_RecoedEvt", kTH2D, {axisConfigurations.axisCentralityFine, axisConfigurations.axisPt}); + histos.add("h2dGenOmegaPlusVsMcCentrality_RecoedEvt", "h2dGenOmegaPlusVsMcCentrality_RecoedEvt", kTH2D, {axisConfigurations.axisCentralityFine, axisConfigurations.axisPt}); + + histos.add("h2dGenK0ShortVsMcCentrality", "h2dGenK0ShortVsMcCentrality", kTH2D, {axisConfigurations.axisCentralityFine, axisConfigurations.axisPt}); + histos.add("h2dGenLambdaVsMcCentrality", "h2dGenLambdaVsMcCentrality", kTH2D, {axisConfigurations.axisCentralityFine, axisConfigurations.axisPt}); + histos.add("h2dGenAntiLambdaVsMcCentrality", "h2dGenAntiLambdaVsMcCentrality", kTH2D, {axisConfigurations.axisCentralityFine, axisConfigurations.axisPt}); + histos.add("h2dGenXiMinusVsMcCentrality", "h2dGenXiMinusVsMcCentrality", kTH2D, {axisConfigurations.axisCentralityFine, axisConfigurations.axisPt}); + histos.add("h2dGenXiPlusVsMcCentrality", "h2dGenXiPlusVsMcCentrality", kTH2D, {axisConfigurations.axisCentralityFine, axisConfigurations.axisPt}); + histos.add("h2dGenOmegaMinusVsMcCentrality", "h2dGenOmegaMinusVsMcCentrality", kTH2D, {axisConfigurations.axisCentralityFine, axisConfigurations.axisPt}); + histos.add("h2dGenOmegaPlusVsMcCentrality", "h2dGenOmegaPlusVsMcCentrality", kTH2D, {axisConfigurations.axisCentralityFine, axisConfigurations.axisPt}); + } else { + histos.add("h2dGenK0ShortVsMultMC_RecoedEvt", "h2dGenK0ShortVsMultMC_RecoedEvt", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisPt}); + histos.add("h2dGenLambdaVsMultMC_RecoedEvt", "h2dGenLambdaVsMultMC_RecoedEvt", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisPt}); + histos.add("h2dGenAntiLambdaVsMultMC_RecoedEvt", "h2dGenAntiLambdaVsMultMC_RecoedEvt", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisPt}); + histos.add("h2dGenXiMinusVsMultMC_RecoedEvt", "h2dGenXiMinusVsMultMC_RecoedEvt", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisPt}); + histos.add("h2dGenXiPlusVsMultMC_RecoedEvt", "h2dGenXiPlusVsMultMC_RecoedEvt", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisPt}); + histos.add("h2dGenOmegaMinusVsMultMC_RecoedEvt", "h2dGenOmegaMinusVsMultMC_RecoedEvt", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisPt}); + histos.add("h2dGenOmegaPlusVsMultMC_RecoedEvt", "h2dGenOmegaPlusVsMultMC_RecoedEvt", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisPt}); + + histos.add("h2dGenK0ShortVsMultMC", "h2dGenK0ShortVsMultMC", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisPt}); + histos.add("h2dGenLambdaVsMultMC", "h2dGenLambdaVsMultMC", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisPt}); + histos.add("h2dGenAntiLambdaVsMultMC", "h2dGenAntiLambdaVsMultMC", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisPt}); + histos.add("h2dGenXiMinusVsMultMC", "h2dGenXiMinusVsMultMC", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisPt}); + histos.add("h2dGenXiPlusVsMultMC", "h2dGenXiPlusVsMultMC", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisPt}); + histos.add("h2dGenOmegaMinusVsMultMC", "h2dGenOmegaMinusVsMultMC", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisPt}); + histos.add("h2dGenOmegaPlusVsMultMC", "h2dGenOmegaPlusVsMultMC", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisPt}); + } if (doSecondaryV0s) { histos.add("h2dGenSecLambda", "h2dGenSecLambda", kTH2D, {axisConfigurations.axisCentrality, axisConfigurations.axisPt}); @@ -2776,7 +2800,11 @@ struct derivedlambdakzeroanalysis { continue; } - histos.fill(HIST("hGenEvents"), mcCollision.multMCNParticlesEta05(), 0 /* all gen. events*/); + if (useMcCentrality) { + histos.fill(HIST("hGenEventsVsMcCentrality"), getCentralityRun3(mcCollision), 0 /* all gen. events*/); + } else { + histos.fill(HIST("hGenEvents"), mcCollision.multMCNParticlesEta05(), 0 /* all gen. events*/); + } auto groupedCollisions = getGroupedCollisions(collisions, mcCollision.globalIndex()); // Check if there is at least one of the reconstructed collisions associated to this MC collision @@ -2812,7 +2840,11 @@ struct derivedlambdakzeroanalysis { histos.fill(HIST("hEventPVzMC"), mcCollision.posZ()); if (atLeastOne) { - histos.fill(HIST("hGenEvents"), mcCollision.multMCNParticlesEta05(), 1 /* at least 1 rec. event*/); + if (useMcCentrality) { + histos.fill(HIST("hGenEventsVsMcCentrality"), getCentralityRun3(mcCollision), 1 /* at least 1 rec. event*/); + } else { + histos.fill(HIST("hGenEvents"), mcCollision.multMCNParticlesEta05(), 1 /* at least 1 rec. event*/); + } histos.fill(HIST("hGenEventCentrality"), centrality); } @@ -3037,27 +3069,51 @@ struct derivedlambdakzeroanalysis { } if (v0MC.pdgCode() == PDG_t::kK0Short) { - histos.fill(HIST("h2dGenK0ShortVsMultMC_RecoedEvt"), mcCollision.multMCNParticlesEta05(), ptmc); + if (useMcCentrality) { + histos.fill(HIST("h2dGenK0ShortVsMcCentrality_RecoedEvt"), getCentralityRun3(mcCollision), ptmc); + } else { + histos.fill(HIST("h2dGenK0ShortVsMultMC_RecoedEvt"), mcCollision.multMCNParticlesEta05(), ptmc); + } } if (v0MC.pdgCode() == PDG_t::kLambda0) { - histos.fill(HIST("h2dGenLambdaVsMultMC_RecoedEvt"), mcCollision.multMCNParticlesEta05(), ptmc); + if (useMcCentrality) { + histos.fill(HIST("h2dGenLambdaVsMcCentrality_RecoedEvt"), getCentralityRun3(mcCollision), ptmc); + } else { + histos.fill(HIST("h2dGenLambdaVsMultMC_RecoedEvt"), mcCollision.multMCNParticlesEta05(), ptmc); + } } if (v0MC.pdgCode() == PDG_t::kLambda0Bar) { - histos.fill(HIST("h2dGenAntiLambdaVsMultMC_RecoedEvt"), mcCollision.multMCNParticlesEta05(), ptmc); + if (useMcCentrality) { + histos.fill(HIST("h2dGenAntiLambdaVsMcCentrality_RecoedEvt"), getCentralityRun3(mcCollision), ptmc); + } else { + histos.fill(HIST("h2dGenAntiLambdaVsMultMC_RecoedEvt"), mcCollision.multMCNParticlesEta05(), ptmc); + } } } if (v0MC.pdgCode() == PDG_t::kK0Short) { histos.fill(HIST("h2dGenK0Short"), centrality, ptmc); - histos.fill(HIST("h2dGenK0ShortVsMultMC"), mcCollision.multMCNParticlesEta05(), ptmc); + if (useMcCentrality) { + histos.fill(HIST("h2dGenK0ShortVsMcCentrality"), getCentralityRun3(mcCollision), ptmc); + } else { + histos.fill(HIST("h2dGenK0ShortVsMultMC"), mcCollision.multMCNParticlesEta05(), ptmc); + } } if (v0MC.pdgCode() == PDG_t::kLambda0) { histos.fill(HIST("h2dGenLambda"), centrality, ptmc); - histos.fill(HIST("h2dGenLambdaVsMultMC"), mcCollision.multMCNParticlesEta05(), ptmc); + if (useMcCentrality) { + histos.fill(HIST("h2dGenLambdaVsMcCentrality"), getCentralityRun3(mcCollision), ptmc); + } else { + histos.fill(HIST("h2dGenLambdaVsMultMC"), mcCollision.multMCNParticlesEta05(), ptmc); + } } if (v0MC.pdgCode() == PDG_t::kLambda0Bar) { histos.fill(HIST("h2dGenAntiLambda"), centrality, ptmc); - histos.fill(HIST("h2dGenAntiLambdaVsMultMC"), mcCollision.multMCNParticlesEta05(), ptmc); + if (useMcCentrality) { + histos.fill(HIST("h2dGenAntiLambdaVsMcCentrality"), getCentralityRun3(mcCollision), ptmc); + } else { + histos.fill(HIST("h2dGenAntiLambdaVsMultMC"), mcCollision.multMCNParticlesEta05(), ptmc); + } } } @@ -3101,16 +3157,32 @@ struct derivedlambdakzeroanalysis { } if (cascMC.pdgCode() == PDG_t::kXiMinus) { - histos.fill(HIST("h2dGenXiMinusVsMultMC_RecoedEvt"), mcCollision.multMCNParticlesEta05(), ptmc); + if (useMcCentrality) { + histos.fill(HIST("h2dGenXiMinusVsMcCentrality_RecoedEvt"), getCentralityRun3(mcCollision), ptmc); + } else { + histos.fill(HIST("h2dGenXiMinusVsMultMC_RecoedEvt"), mcCollision.multMCNParticlesEta05(), ptmc); + } } if (cascMC.pdgCode() == PDG_t::kXiPlusBar) { - histos.fill(HIST("h2dGenXiPlusVsMultMC_RecoedEvt"), mcCollision.multMCNParticlesEta05(), ptmc); + if (useMcCentrality) { + histos.fill(HIST("h2dGenXiPlusVsMcCentrality_RecoedEvt"), getCentralityRun3(mcCollision), ptmc); + } else { + histos.fill(HIST("h2dGenXiPlusVsMultMC_RecoedEvt"), mcCollision.multMCNParticlesEta05(), ptmc); + } } if (cascMC.pdgCode() == PDG_t::kOmegaMinus) { - histos.fill(HIST("h2dGenOmegaMinusVsMultMC_RecoedEvt"), mcCollision.multMCNParticlesEta05(), ptmc); + if (useMcCentrality) { + histos.fill(HIST("h2dGenOmegaMinusVsMcCentrality_RecoedEvt"), getCentralityRun3(mcCollision), ptmc); + } else { + histos.fill(HIST("h2dGenOmegaMinusVsMultMC_RecoedEvt"), mcCollision.multMCNParticlesEta05(), ptmc); + } } if (cascMC.pdgCode() == PDG_t::kOmegaPlusBar) { - histos.fill(HIST("h2dGenOmegaPlusVsMultMC_RecoedEvt"), mcCollision.multMCNParticlesEta05(), ptmc); + if (useMcCentrality) { + histos.fill(HIST("h2dGenOmegaPlusVsMcCentrality_RecoedEvt"), getCentralityRun3(mcCollision), ptmc); + } else { + histos.fill(HIST("h2dGenOmegaPlusVsMultMC_RecoedEvt"), mcCollision.multMCNParticlesEta05(), ptmc); + } } if (doSecondaryV0s && std::abs(cascMC.pdgCodeV0()) == kLambda0) { @@ -3138,19 +3210,35 @@ struct derivedlambdakzeroanalysis { if (cascMC.pdgCode() == PDG_t::kXiMinus) { histos.fill(HIST("h2dGenXiMinus"), centrality, ptmc); - histos.fill(HIST("h2dGenXiMinusVsMultMC"), mcCollision.multMCNParticlesEta05(), ptmc); + if (useMcCentrality) { + histos.fill(HIST("h2dGenXiMinusVsMcCentrality"), getCentralityRun3(mcCollision), ptmc); + } else { + histos.fill(HIST("h2dGenXiMinusVsMultMC"), mcCollision.multMCNParticlesEta05(), ptmc); + } } if (cascMC.pdgCode() == PDG_t::kXiPlusBar) { histos.fill(HIST("h2dGenXiPlus"), centrality, ptmc); - histos.fill(HIST("h2dGenXiPlusVsMultMC"), mcCollision.multMCNParticlesEta05(), ptmc); + if (useMcCentrality) { + histos.fill(HIST("h2dGenXiPlusVsMcCentrality"), getCentralityRun3(mcCollision), ptmc); + } else { + histos.fill(HIST("h2dGenXiPlusVsMultMC"), mcCollision.multMCNParticlesEta05(), ptmc); + } } if (cascMC.pdgCode() == PDG_t::kOmegaMinus) { histos.fill(HIST("h2dGenOmegaMinus"), centrality, ptmc); - histos.fill(HIST("h2dGenOmegaMinusVsMultMC"), mcCollision.multMCNParticlesEta05(), ptmc); + if (useMcCentrality) { + histos.fill(HIST("h2dGenOmegaMinusVsMcCentrality"), getCentralityRun3(mcCollision), ptmc); + } else { + histos.fill(HIST("h2dGenOmegaMinusVsMultMC"), mcCollision.multMCNParticlesEta05(), ptmc); + } } if (cascMC.pdgCode() == PDG_t::kOmegaPlusBar) { histos.fill(HIST("h2dGenOmegaPlus"), centrality, ptmc); - histos.fill(HIST("h2dGenOmegaPlusVsMultMC"), mcCollision.multMCNParticlesEta05(), ptmc); + if (useMcCentrality) { + histos.fill(HIST("h2dGenOmegaPlusVsMcCentrality"), getCentralityRun3(mcCollision), ptmc); + } else { + histos.fill(HIST("h2dGenOmegaPlusVsMultMC"), mcCollision.multMCNParticlesEta05(), ptmc); + } } if (doSecondaryV0s && std::abs(cascMC.pdgCodeV0()) == kLambda0) { From 58060ceca8aae361df51940499f9b819accb0e38 Mon Sep 17 00:00:00 2001 From: SCHOTTER Romain <47983209+romainschotter@users.noreply.github.com> Date: Tue, 25 Aug 2026 23:13:07 +0200 Subject: [PATCH 10/27] Remove unused include --- PWGLF/DataModel/mcCentrality.h | 1 - 1 file changed, 1 deletion(-) diff --git a/PWGLF/DataModel/mcCentrality.h b/PWGLF/DataModel/mcCentrality.h index 8a8766e6ed8..bfe0aff36e8 100644 --- a/PWGLF/DataModel/mcCentrality.h +++ b/PWGLF/DataModel/mcCentrality.h @@ -25,7 +25,6 @@ #include "Framework/ASoA.h" #include "Framework/AnalysisDataModel.h" -#include "Framework/Logger.h" namespace o2::aod { From 19e30545d9e67c0451f1b332fabd752ddbb4ec4e Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Tue, 25 Aug 2026 21:13:46 +0000 Subject: [PATCH 11/27] Please consider the following formatting changes --- PWGLF/DataModel/mcCentrality.h | 4 +- PWGLF/TableProducer/Common/mcCentrality.cxx | 9 +- .../Strangeness/strangenessMcCentrality.cxx | 13 +- .../derivedlambdakzeroanalysis.cxx | 22 ++- PWGLF/Utils/mcCentralityModule.h | 140 +++++++++--------- 5 files changed, 98 insertions(+), 90 deletions(-) diff --git a/PWGLF/DataModel/mcCentrality.h b/PWGLF/DataModel/mcCentrality.h index bfe0aff36e8..2bb14880953 100644 --- a/PWGLF/DataModel/mcCentrality.h +++ b/PWGLF/DataModel/mcCentrality.h @@ -23,8 +23,8 @@ // O2 includes #include "Common/DataModel/Centrality.h" -#include "Framework/ASoA.h" -#include "Framework/AnalysisDataModel.h" +#include +#include namespace o2::aod { diff --git a/PWGLF/TableProducer/Common/mcCentrality.cxx b/PWGLF/TableProducer/Common/mcCentrality.cxx index 8df661a4f46..a366c36c00b 100644 --- a/PWGLF/TableProducer/Common/mcCentrality.cxx +++ b/PWGLF/TableProducer/Common/mcCentrality.cxx @@ -18,11 +18,11 @@ /// #include "PWGLF/DataModel/mcCentrality.h" -#include "PWGLF/Utils/mcCentralityModule.h" #include "TableHelper.h" #include "PWGLF/Utils/inelGt.h" +#include "PWGLF/Utils/mcCentralityModule.h" #include "Common/DataModel/Centrality.h" #include "Common/DataModel/Multiplicity.h" @@ -51,7 +51,7 @@ struct McCentrality { // Input parameters o2::framework::Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; Service ccdb; - + o2::pwglf::mccentrality::products products; o2::pwglf::mccentrality::coreConfigurables baseOpts; o2::pwglf::mccentrality::BuilderModule mcCentralityBuilderModule; @@ -77,7 +77,8 @@ struct McCentrality { } }; -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ return WorkflowSpec{ - adaptAnalysisTask(cfgc)}; + adaptAnalysisTask(cfgc)}; } diff --git a/PWGLF/TableProducer/Strangeness/strangenessMcCentrality.cxx b/PWGLF/TableProducer/Strangeness/strangenessMcCentrality.cxx index a20182178ce..50191868e99 100644 --- a/PWGLF/TableProducer/Strangeness/strangenessMcCentrality.cxx +++ b/PWGLF/TableProducer/Strangeness/strangenessMcCentrality.cxx @@ -15,11 +15,11 @@ /// \brief Task to produce the MC centrality table for strangeness derived data /// +#include "TableHelper.h" + +#include "PWGLF/DataModel/LFStrangenessTables.h" #include "PWGLF/DataModel/mcCentrality.h" #include "PWGLF/Utils/mcCentralityModule.h" -#include "PWGLF/DataModel/LFStrangenessTables.h" - -#include "TableHelper.h" #include "Common/DataModel/Centrality.h" #include "Common/DataModel/Multiplicity.h" @@ -48,7 +48,7 @@ struct StrangenessMcCentrality { // Input parameters o2::framework::Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; Service ccdb; - + o2::pwglf::mccentrality::products products; o2::pwglf::mccentrality::coreConfigurables baseOpts; o2::pwglf::mccentrality::BuilderModule mcCentralityBuilderModule; @@ -74,7 +74,8 @@ struct StrangenessMcCentrality { } }; -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ return WorkflowSpec{ - adaptAnalysisTask(cfgc)}; + adaptAnalysisTask(cfgc)}; } diff --git a/PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx b/PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx index 511c38a3061..224b73842ac 100644 --- a/PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx +++ b/PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx @@ -1226,7 +1226,7 @@ struct derivedlambdakzeroanalysis { histos.add("h2dGenXiPlusVsMcCentrality_RecoedEvt", "h2dGenXiPlusVsMcCentrality_RecoedEvt", kTH2D, {axisConfigurations.axisCentralityFine, axisConfigurations.axisPt}); histos.add("h2dGenOmegaMinusVsMcCentrality_RecoedEvt", "h2dGenOmegaMinusVsMcCentrality_RecoedEvt", kTH2D, {axisConfigurations.axisCentralityFine, axisConfigurations.axisPt}); histos.add("h2dGenOmegaPlusVsMcCentrality_RecoedEvt", "h2dGenOmegaPlusVsMcCentrality_RecoedEvt", kTH2D, {axisConfigurations.axisCentralityFine, axisConfigurations.axisPt}); - + histos.add("h2dGenK0ShortVsMcCentrality", "h2dGenK0ShortVsMcCentrality", kTH2D, {axisConfigurations.axisCentralityFine, axisConfigurations.axisPt}); histos.add("h2dGenLambdaVsMcCentrality", "h2dGenLambdaVsMcCentrality", kTH2D, {axisConfigurations.axisCentralityFine, axisConfigurations.axisPt}); histos.add("h2dGenAntiLambdaVsMcCentrality", "h2dGenAntiLambdaVsMcCentrality", kTH2D, {axisConfigurations.axisCentralityFine, axisConfigurations.axisPt}); @@ -1242,7 +1242,7 @@ struct derivedlambdakzeroanalysis { histos.add("h2dGenXiPlusVsMultMC_RecoedEvt", "h2dGenXiPlusVsMultMC_RecoedEvt", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisPt}); histos.add("h2dGenOmegaMinusVsMultMC_RecoedEvt", "h2dGenOmegaMinusVsMultMC_RecoedEvt", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisPt}); histos.add("h2dGenOmegaPlusVsMultMC_RecoedEvt", "h2dGenOmegaPlusVsMultMC_RecoedEvt", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisPt}); - + histos.add("h2dGenK0ShortVsMultMC", "h2dGenK0ShortVsMultMC", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisPt}); histos.add("h2dGenLambdaVsMultMC", "h2dGenLambdaVsMultMC", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisPt}); histos.add("h2dGenAntiLambdaVsMultMC", "h2dGenAntiLambdaVsMultMC", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisPt}); @@ -1299,13 +1299,19 @@ struct derivedlambdakzeroanalysis { // Helper lambda to extract centrality from any object exposing the cent* columns auto extractCentrality = [this](auto const& coll) -> float { switch (centralityEstimator) { - case kCentFT0C: return coll.centFT0C(); - case kCentFT0M: return coll.centFT0M(); - case kCentFT0CVariant1: return coll.centFT0CVariant1(); + case kCentFT0C: + return coll.centFT0C(); + case kCentFT0M: + return coll.centFT0M(); + case kCentFT0CVariant1: + return coll.centFT0CVariant1(); // case kCentMFT: return coll.centMFT(); - case kCentNGlobal: return coll.centNGlobal(); - case kCentFV0A: return coll.centFV0A(); - default: return -1.f; + case kCentNGlobal: + return coll.centNGlobal(); + case kCentFV0A: + return coll.centFV0A(); + default: + return -1.f; } }; diff --git a/PWGLF/Utils/mcCentralityModule.h b/PWGLF/Utils/mcCentralityModule.h index a0bf7743d91..faa00391db0 100644 --- a/PWGLF/Utils/mcCentralityModule.h +++ b/PWGLF/Utils/mcCentralityModule.h @@ -18,10 +18,10 @@ #ifndef PWGLF_UTILS_MCCENTRALITYMODULE_H_ #define PWGLF_UTILS_MCCENTRALITYMODULE_H -#include "PWGLF/DataModel/mcCentrality.h" - #include "TableHelper.h" +#include "PWGLF/DataModel/mcCentrality.h" + #include "Common/DataModel/Centrality.h" #include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/TrackSelectionTables.h" @@ -61,17 +61,16 @@ namespace mccentrality // avoid polluting other namespaces // statics necessary for the configurables in this namespace static constexpr int nParameters = 1; static const std::vector tableNames{ - "McCentFV0As", - "McCentFT0Ms", - "McCentFT0As", - "McCentFT0Cs", - "McCentFT0CVariant1s", - "McCentFT0CVariant2s", - "McCentFDDMs", - "McCentNTPVs", - "McCentNGlobals", - "McCentMFTs" -}; + "McCentFV0As", + "McCentFT0Ms", + "McCentFT0As", + "McCentFT0Cs", + "McCentFT0CVariant1s", + "McCentFT0CVariant2s", + "McCentFDDMs", + "McCentNTPVs", + "McCentNGlobals", + "McCentMFTs"}; static constexpr int nTablesConst = 10; static const std::vector parameterNames{"enable"}; @@ -98,20 +97,19 @@ enum tableIndex { kFV0A = 0, kNTPV, kNGlobal, kMFT, - kNestimators}; + kNestimators }; static constexpr const char* DirList[] = { - "FV0A", - "FT0M", - "FT0A", - "FT0C", - "FT0CVariant1", - "FT0CVariant2", - "FDDM", - "NTPV", - "NGlobal", - "MFT" -}; + "FV0A", + "FT0M", + "FT0A", + "FT0C", + "FT0CVariant1", + "FT0CVariant2", + "FDDM", + "NTPV", + "NGlobal", + "MFT"}; // mcCentralityModule: 1st-order configurables struct coreConfigurables : o2::framework::ConfigurableGroup { @@ -131,7 +129,7 @@ struct coreConfigurables : o2::framework::ConfigurableGroup { ConfigurableAxis binsPercentileFine{"binsPercentileFine", {VARIABLE_WIDTH, 0, 0.001, 0.01, 1.0, 5.0, 10.0, 15.0, 20.0, 25.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0}, "Binning of the percentile axis"}; ConfigurableAxis binsMultiplicity{"binsMultiplicity", {1000, 0, 5000}, "Binning of the multiplicity axis"}; - //ccdb configurables + // ccdb configurables Configurable path{"path", "/tmp/InputCalibMC.root", "path to calib file or ccdb path if begins with ccdb://"}; // debug option @@ -154,11 +152,11 @@ struct products : o2::framework::ProducesGroup { template concept HasMcMults = requires(typename T::iterator a) { - { a.multMCFT0A() } -> std::convertible_to; - { a.multMCFT0C() } -> std::convertible_to; - { a.multMCFV0A() } -> std::convertible_to; - { a.multMCFDDA() } -> std::convertible_to; - { a.multMCFDDC() } -> std::convertible_to; + { a.multMCFT0A() } -> std::convertible_to; + { a.multMCFT0C() } -> std::convertible_to; + { a.multMCFV0A() } -> std::convertible_to; + { a.multMCFDDA() } -> std::convertible_to; + { a.multMCFDDC() } -> std::convertible_to; { a.multMCNParticlesEta08() } -> std::convertible_to; { a.multMCNParticlesEta05() } -> std::convertible_to; }; @@ -373,7 +371,8 @@ struct BuilderModule { } template - THist* getHist(const char* name) { + THist* getHist(const char* name) + { if (!this->MCCentralityCalibObjects) { return (THist*)0x0; } @@ -391,17 +390,18 @@ struct BuilderModule { return hist; } - TH1D* extractCentralityCalibration(int idx, const char* name, bool reverse = false) { + TH1D* extractCentralityCalibration(int idx, const char* name, bool reverse = false) + { - auto CalibMC = [&](TString estimator){ + auto CalibMC = [&](TString estimator) { printf("\e[1;31mCalibration for %s estimator\e[0;00m -> Starting...\n", estimator.Data()); std::vector percentile_center(nCentBins); std::vector epercentile_center(nCentBins); - //Histograms - TH2D *h2dMultVsCent_Data = getHist(Form("h2dMultVsCent%s_Data", estimator.Data())); - TH2D *h2dMultRecoVsMultGen_MC = getHist(Form("hMultEta05VsGenMult%s", estimator.Data())); + // Histograms + TH2D* h2dMultVsCent_Data = getHist(Form("h2dMultVsCent%s_Data", estimator.Data())); + TH2D* h2dMultRecoVsMultGen_MC = getHist(Form("hMultEta05VsGenMult%s", estimator.Data())); if (!h2dMultVsCent_Data || !h2dMultRecoVsMultGen_MC) { return (TH1D*)0x0; } @@ -413,12 +413,12 @@ struct BuilderModule { TProfile* hPVData = hCalibPVData[idx].get(); TProfile* hPVMC = hCalibPVMC[idx].get(); - TH1D *h1dCalib = h2dMultRecoVsMultGen_MC->ProjectionX(Form("h1d%s", estimator.Data()), 1, h2dMultRecoVsMultGen_MC->GetNbinsX()); + TH1D* h1dCalib = h2dMultRecoVsMultGen_MC->ProjectionX(Form("h1d%s", estimator.Data()), 1, h2dMultRecoVsMultGen_MC->GetNbinsX()); h1dCalib->Reset(); h1dCalib->SetTitle(Form("%s calibration object", estimator.Data())); h1dCalib->GetXaxis()->SetTitle(Form("#it{N}_{%s, gen.}", estimator.Data())); h1dCalib->GetYaxis()->SetTitle(Form("%s percentile (%%)", estimator.Data())); - + // NOTE: candidate-by-candidate assignment (assignCentralityPerCandidate) does not go through this // mean-matching path at all. It samples directly from the "hGenMultEta05VsCentrality" // joint histogram (x = reco centrality of the matched MC collision, y = generated mult |eta|<0.5) @@ -427,16 +427,16 @@ struct BuilderModule { if (reverse) { for (int i = 0; i < nCentBins; i++) { int irev = i; - percentile_center[i] = (centralityBins[irev] + centralityBins[irev+1]) / 2; - epercentile_center[i] = (centralityBins[irev] - centralityBins[irev+1]) / 2; + percentile_center[i] = (centralityBins[irev] + centralityBins[irev + 1]) / 2; + epercentile_center[i] = (centralityBins[irev] - centralityBins[irev + 1]) / 2; } int startBinMc = h1dCalib->GetNbinsX(); for (int i = 0; i < nCentBins; i++) { // Loop over centrality bins // start from the end (from the high multiplicity collisions) int irev = i; - TH1D* projData = h2dMultVsCent_Data->ProjectionY(Form("projData_%d", i), h2dMultVsCent_Data->GetXaxis()->FindBin(centralityBins[irev]+1e-5), - h2dMultVsCent_Data->GetXaxis()->FindBin(centralityBins[irev+1]-1e-5)); + TH1D* projData = h2dMultVsCent_Data->ProjectionY(Form("projData_%d", i), h2dMultVsCent_Data->GetXaxis()->FindBin(centralityBins[irev] + 1e-5), + h2dMultVsCent_Data->GetXaxis()->FindBin(centralityBins[irev + 1] - 1e-5)); double meanMult_Data = projData->GetMean(); @@ -462,7 +462,7 @@ struct BuilderModule { endBinMc = j; } } - if (i == nCentBins-1) { + if (i == nCentBins - 1) { endBinMc = 1; } @@ -487,14 +487,14 @@ struct BuilderModule { } } - printf("\e[1;31mCalibration for %s estimator\e[0;00m -> Data centrality bin \e[1;31m%g-%g%%\e[0;00m\n", estimator.Data(), centralityBins[irev], centralityBins[irev+1]); + printf("\e[1;31mCalibration for %s estimator\e[0;00m -> Data centrality bin \e[1;31m%g-%g%%\e[0;00m\n", estimator.Data(), centralityBins[irev], centralityBins[irev + 1]); printf("\e[1;31mCalibration for %s estimator\e[0;00m -> MC multiplicity range %g-%g\n", estimator.Data(), projMC->GetBinLowEdge(endBinMc), projMC->GetBinLowEdge(startBinMc)); - printf("\e[1;31mCalibration for %s estimator\e[0;00m -> data = %.4f Vs MC = %.4f (MC/Data = %.4f%%)\n", estimator.Data(), meanMult_Data, meanMult_MC, (meanMult_MC-meanMult_Data) * 100 / meanMult_Data); + printf("\e[1;31mCalibration for %s estimator\e[0;00m -> data = %.4f Vs MC = %.4f (MC/Data = %.4f%%)\n", estimator.Data(), meanMult_Data, meanMult_MC, (meanMult_MC - meanMult_Data) * 100 / meanMult_Data); printf("\e[1;31mCalibration for %s estimator\e[0;00m -> N entries Data = %g Vs N entries MC = %g\n", estimator.Data(), projData->Integral(), projMC->Integral()); printf("\n"); for (int ibin = 1; ibin <= h1dCalib->GetNbinsX(); ibin++) { - if (ibin <= startBinMc && ibin >= endBinMc){ - h1dCalib->SetBinContent(ibin, percentile_center[i]); + if (ibin <= startBinMc && ibin >= endBinMc) { + h1dCalib->SetBinContent(ibin, percentile_center[i]); } } startBinMc = endBinMc; @@ -502,15 +502,15 @@ struct BuilderModule { } else { for (int i = 0; i < nCentBins; i++) { int irev = nCentBins - i; - percentile_center[i] = (centralityBins[irev-1] + centralityBins[irev]) / 2; - epercentile_center[i] = (centralityBins[irev] - centralityBins[irev-1]) / 2; + percentile_center[i] = (centralityBins[irev - 1] + centralityBins[irev]) / 2; + epercentile_center[i] = (centralityBins[irev] - centralityBins[irev - 1]) / 2; } int startBinMc = 1; for (int i = 0; i < nCentBins; i++) { // Loop over centrality bins // start from the end (from the low multiplicity collisions) int irev = nCentBins - i; - TH1D* projData = h2dMultVsCent_Data->ProjectionY(Form("projData_%d", i), h2dMultVsCent_Data->GetXaxis()->FindBin(centralityBins[irev-1]+1e-5), - h2dMultVsCent_Data->GetXaxis()->FindBin(centralityBins[irev]-1e-5)); + TH1D* projData = h2dMultVsCent_Data->ProjectionY(Form("projData_%d", i), h2dMultVsCent_Data->GetXaxis()->FindBin(centralityBins[irev - 1] + 1e-5), + h2dMultVsCent_Data->GetXaxis()->FindBin(centralityBins[irev] - 1e-5)); double meanMult_Data = projData->GetMean(); @@ -536,8 +536,8 @@ struct BuilderModule { endBinMc = j; } } - if (i == nCentBins-1) { - endBinMc = h2dMultRecoVsMultGen_MC->GetNbinsX(); + if (i == nCentBins - 1) { + endBinMc = h2dMultRecoVsMultGen_MC->GetNbinsX(); } TH1D* projMC = h2dMultRecoVsMultGen_MC->ProjectionY(Form("projMC_%d", i), startBinMc, endBinMc); @@ -561,17 +561,17 @@ struct BuilderModule { } } - printf("\e[1;31mCalibration for %s estimator\e[0;00m -> Data centrality bin \e[1;31m%g-%g%%\e[0;00m\n", estimator.Data(), centralityBins[irev-1], centralityBins[irev]); - printf("\e[1;31mCalibration for %s estimator\e[0;00m -> MC multiplicity range %g-%g\n", estimator.Data(), projMC->GetBinLowEdge(startBinMc), projMC->GetBinLowEdge(endBinMc+1)); + printf("\e[1;31mCalibration for %s estimator\e[0;00m -> Data centrality bin \e[1;31m%g-%g%%\e[0;00m\n", estimator.Data(), centralityBins[irev - 1], centralityBins[irev]); + printf("\e[1;31mCalibration for %s estimator\e[0;00m -> MC multiplicity range %g-%g\n", estimator.Data(), projMC->GetBinLowEdge(startBinMc), projMC->GetBinLowEdge(endBinMc + 1)); printf("\e[1;31mCalibration for %s estimator\e[0;00m -> data = %.4f Vs MC = %.4f\n", estimator.Data(), meanMult_Data, meanMult_MC); printf("\e[1;31mCalibration for %s estimator\e[0;00m -> N entries Data = %g Vs N entries MC = %g\n", estimator.Data(), projData->Integral(), projMC->Integral()); for (int ibin = 1; ibin <= h1dCalib->GetNbinsX(); ibin++) { - if (ibin <= endBinMc && ibin >= startBinMc){ - h1dCalib->SetBinContent(ibin, percentile_center[i]); + if (ibin <= endBinMc && ibin >= startBinMc) { + h1dCalib->SetBinContent(ibin, percentile_center[i]); } } - startBinMc = endBinMc+1; + startBinMc = endBinMc + 1; } // End loop over centrality bins } @@ -657,8 +657,8 @@ struct BuilderModule { // which has no systematic effect on the sampled distribution. ULong64_t computeSamplingSeed(int64_t collisionIndex, int tableIdx) const { - static constexpr ULong64_t kCollisionStride = 131ull; // > kNestimators, so tableIdx can't alias into the collision term - static constexpr ULong64_t kRunStride = 1000003ull; // prime, well above kCollisionStride * (typical collisions per DF) + static constexpr ULong64_t kCollisionStride = 131ull; // > kNestimators, so tableIdx can't alias into the collision term + static constexpr ULong64_t kRunStride = 1000003ull; // prime, well above kCollisionStride * (typical collisions per DF) return baseOpts.centralitySamplingSeed.value + kRunStride * static_cast(mRunNumber) + kCollisionStride * static_cast(collisionIndex) + static_cast(tableIdx); } @@ -712,15 +712,15 @@ struct BuilderModule { return percentile; }; - populateTable(products.centFV0A, h1dFV0A, h2dCentVsGenMult[kFV0A], nFV0A, std::integral_constant{}); - populateTable(products.centFT0M, h1dFT0M, h2dCentVsGenMult[kFT0M], nFT0M, std::integral_constant{}); - populateTable(products.centFT0A, h1dFT0A, h2dCentVsGenMult[kFT0A], nFT0A, std::integral_constant{}); - populateTable(products.centFT0C, h1dFT0C, h2dCentVsGenMult[kFT0C], nFT0C, std::integral_constant{}); - populateTable(products.centFT0CVariant1, h1dFT0CVariant1, h2dCentVsGenMult[kFT0CVariant1], nFT0C, std::integral_constant{}); - populateTable(products.centFT0CVariant2, h1dFT0CVariant2, h2dCentVsGenMult[kFT0CVariant2], nFT0C, std::integral_constant{}); - populateTable(products.centFDDM, h1dFDDM, h2dCentVsGenMult[kFDDM], nFDDM, std::integral_constant{}); - populateTable(products.centNTPV, h1dNTPV, h2dCentVsGenMult[kNTPV], nGlobal, std::integral_constant{}); - populateTable(products.centNGlobal, h1dNGlobal, h2dCentVsGenMult[kNGlobal], nGlobal, std::integral_constant{}); + populateTable(products.centFV0A, h1dFV0A, h2dCentVsGenMult[kFV0A], nFV0A, std::integral_constant{}); + populateTable(products.centFT0M, h1dFT0M, h2dCentVsGenMult[kFT0M], nFT0M, std::integral_constant{}); + populateTable(products.centFT0A, h1dFT0A, h2dCentVsGenMult[kFT0A], nFT0A, std::integral_constant{}); + populateTable(products.centFT0C, h1dFT0C, h2dCentVsGenMult[kFT0C], nFT0C, std::integral_constant{}); + populateTable(products.centFT0CVariant1, h1dFT0CVariant1, h2dCentVsGenMult[kFT0CVariant1], nFT0C, std::integral_constant{}); + populateTable(products.centFT0CVariant2, h1dFT0CVariant2, h2dCentVsGenMult[kFT0CVariant2], nFT0C, std::integral_constant{}); + populateTable(products.centFDDM, h1dFDDM, h2dCentVsGenMult[kFDDM], nFDDM, std::integral_constant{}); + populateTable(products.centNTPV, h1dNTPV, h2dCentVsGenMult[kNTPV], nGlobal, std::integral_constant{}); + populateTable(products.centNGlobal, h1dNGlobal, h2dCentVsGenMult[kNGlobal], nGlobal, std::integral_constant{}); // populateTable(products.centMFT, h1dMFT, h2dCentVsGenMult[kMFT], nMFT, std::integral_constant{}); // to be added later mcCollisionCounter++; From 399d5bb510f098ac9f371eaf0aed92eaa7a41c6d Mon Sep 17 00:00:00 2001 From: SCHOTTER Romain <47983209+romainschotter@users.noreply.github.com> Date: Wed, 26 Aug 2026 00:03:31 +0200 Subject: [PATCH 12/27] Fix derivedlambdakzeroanalysis --- .../derivedlambdakzeroanalysis.cxx | 175 ++++++++++++------ 1 file changed, 117 insertions(+), 58 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx b/PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx index 224b73842ac..b006367f315 100644 --- a/PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx +++ b/PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx @@ -31,6 +31,7 @@ #include "PWGLF/DataModel/LFStrangenessMLTables.h" #include "PWGLF/DataModel/LFStrangenessPIDTables.h" #include "PWGLF/DataModel/LFStrangenessTables.h" +#include "PWGLF/DataModel/mcCentrality.h" #include "PWGUD/Core/SGSelector.h" #include "Common/CCDB/EventSelectionParams.h" @@ -1195,7 +1196,7 @@ struct derivedlambdakzeroanalysis { // Creation of histograms: MC generated if ((doprocessGeneratedRun3 || doprocessGeneratedRun2)) { if (useMcCentrality) { - histos.add("hGenEventsVsMcCentrality", "hGenEventsVsMcCentrality", kTH2D, {axisCentralityFine, {2, -0.5f, +1.5f}}); + histos.add("hGenEventsVsMcCentrality", "hGenEventsVsMcCentrality", kTH2D, {axisConfigurations.axisCentralityFine, {2, -0.5f, +1.5f}}); histos.get(HIST("hGenEventsVsMcCentrality"))->GetYaxis()->SetBinLabel(1, "All gen. events"); histos.get(HIST("hGenEventsVsMcCentrality"))->GetYaxis()->SetBinLabel(2, "Gen. with at least 1 rec. events"); } else { @@ -1203,7 +1204,7 @@ struct derivedlambdakzeroanalysis { histos.get(HIST("hGenEvents"))->GetYaxis()->SetBinLabel(1, "All gen. events"); histos.get(HIST("hGenEvents"))->GetYaxis()->SetBinLabel(2, "Gen. with at least 1 rec. events"); } - histos.add("hGenEventCentrality", "hGenEventCentrality", kTH1D, {axisCentralityFine}); + histos.add("hGenEventCentrality", "hGenEventCentrality", kTH1D, {axisConfigurations.axisCentralityFine}); histos.add("hCentralityVsNcoll_beforeEvSel", "hCentralityVsNcoll_beforeEvSel", kTH2D, {axisConfigurations.axisCentrality, {50, -0.5f, 49.5f}}); histos.add("hCentralityVsNcoll_afterEvSel", "hCentralityVsNcoll_afterEvSel", kTH2D, {axisConfigurations.axisCentrality, {50, -0.5f, 49.5f}}); @@ -1226,7 +1227,7 @@ struct derivedlambdakzeroanalysis { histos.add("h2dGenXiPlusVsMcCentrality_RecoedEvt", "h2dGenXiPlusVsMcCentrality_RecoedEvt", kTH2D, {axisConfigurations.axisCentralityFine, axisConfigurations.axisPt}); histos.add("h2dGenOmegaMinusVsMcCentrality_RecoedEvt", "h2dGenOmegaMinusVsMcCentrality_RecoedEvt", kTH2D, {axisConfigurations.axisCentralityFine, axisConfigurations.axisPt}); histos.add("h2dGenOmegaPlusVsMcCentrality_RecoedEvt", "h2dGenOmegaPlusVsMcCentrality_RecoedEvt", kTH2D, {axisConfigurations.axisCentralityFine, axisConfigurations.axisPt}); - + histos.add("h2dGenK0ShortVsMcCentrality", "h2dGenK0ShortVsMcCentrality", kTH2D, {axisConfigurations.axisCentralityFine, axisConfigurations.axisPt}); histos.add("h2dGenLambdaVsMcCentrality", "h2dGenLambdaVsMcCentrality", kTH2D, {axisConfigurations.axisCentralityFine, axisConfigurations.axisPt}); histos.add("h2dGenAntiLambdaVsMcCentrality", "h2dGenAntiLambdaVsMcCentrality", kTH2D, {axisConfigurations.axisCentralityFine, axisConfigurations.axisPt}); @@ -1242,7 +1243,7 @@ struct derivedlambdakzeroanalysis { histos.add("h2dGenXiPlusVsMultMC_RecoedEvt", "h2dGenXiPlusVsMultMC_RecoedEvt", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisPt}); histos.add("h2dGenOmegaMinusVsMultMC_RecoedEvt", "h2dGenOmegaMinusVsMultMC_RecoedEvt", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisPt}); histos.add("h2dGenOmegaPlusVsMultMC_RecoedEvt", "h2dGenOmegaPlusVsMultMC_RecoedEvt", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisPt}); - + histos.add("h2dGenK0ShortVsMultMC", "h2dGenK0ShortVsMultMC", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisPt}); histos.add("h2dGenLambdaVsMultMC", "h2dGenLambdaVsMultMC", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisPt}); histos.add("h2dGenAntiLambdaVsMultMC", "h2dGenAntiLambdaVsMultMC", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisPt}); @@ -1294,24 +1295,18 @@ struct derivedlambdakzeroanalysis { // If takeMcCentrality is enabled, the centrality is taken from the MC collision; otherwise it is taken // from the reconstructed collision. Returns -1 if no corresponding centrality estimator is found or if no MC collision is associated to the recoed collision. template - auto getCentralityRun3(TCollision const& collision, bool takeMcCentrality) + auto getCentralityRun3(TCollision const& collision, bool takeMcCentrality = false) { // Helper lambda to extract centrality from any object exposing the cent* columns auto extractCentrality = [this](auto const& coll) -> float { switch (centralityEstimator) { - case kCentFT0C: - return coll.centFT0C(); - case kCentFT0M: - return coll.centFT0M(); - case kCentFT0CVariant1: - return coll.centFT0CVariant1(); + case kCentFT0C: return coll.centFT0C(); + case kCentFT0M: return coll.centFT0M(); + case kCentFT0CVariant1: return coll.centFT0CVariant1(); // case kCentMFT: return coll.centMFT(); - case kCentNGlobal: - return coll.centNGlobal(); - case kCentFV0A: - return coll.centFV0A(); - default: - return -1.f; + case kCentNGlobal: return coll.centNGlobal(); + case kCentFV0A: return coll.centFV0A(); + default: return -1.f; } }; @@ -2806,8 +2801,12 @@ struct derivedlambdakzeroanalysis { continue; } - if (useMcCentrality) { - histos.fill(HIST("hGenEventsVsMcCentrality"), getCentralityRun3(mcCollision), 0 /* all gen. events*/); + if constexpr (run3) { + if (useMcCentrality) { + histos.fill(HIST("hGenEventsVsMcCentrality"), getCentralityRun3(mcCollision), 0 /* all gen. events*/); + } else { + histos.fill(HIST("hGenEvents"), mcCollision.multMCNParticlesEta05(), 0 /* all gen. events*/); + } } else { histos.fill(HIST("hGenEvents"), mcCollision.multMCNParticlesEta05(), 0 /* all gen. events*/); } @@ -2846,8 +2845,12 @@ struct derivedlambdakzeroanalysis { histos.fill(HIST("hEventPVzMC"), mcCollision.posZ()); if (atLeastOne) { - if (useMcCentrality) { - histos.fill(HIST("hGenEventsVsMcCentrality"), getCentralityRun3(mcCollision), 1 /* at least 1 rec. event*/); + if constexpr (run3) { + if (useMcCentrality) { + histos.fill(HIST("hGenEventsVsMcCentrality"), getCentralityRun3(mcCollision), 1 /* at least 1 rec. event*/); + } else { + histos.fill(HIST("hGenEvents"), mcCollision.multMCNParticlesEta05(), 1 /* at least 1 rec. event*/); + } } else { histos.fill(HIST("hGenEvents"), mcCollision.multMCNParticlesEta05(), 1 /* at least 1 rec. event*/); } @@ -2929,8 +2932,8 @@ struct derivedlambdakzeroanalysis { // ______________________________________________________ // Simulated processing (subscribes to MC information too) - template - void analyzeRecoedV0sInMonteCarlo(TCollision const& collision, TV0s const& fullV0s) + template + void analyzeRecoedV0sInMonteCarlo(TCollision const& collision, TV0s const& fullV0s, TMCCollisions const& /*mcCollisions*/) { // Fire up CCDB if ((mlConfigurations.useK0ShortScores && mlConfigurations.calculateK0ShortScores) || @@ -3007,7 +3010,7 @@ struct derivedlambdakzeroanalysis { bool correctCollision = false; int mcNch = -1; if (collision.has_straMCCollision()) { - auto mcCollision = collision.template straMCCollision_as>(); + auto mcCollision = collision.template straMCCollision_as(); mcNch = mcCollision.multMCNParticlesEta05(); correctCollision = (v0MC.straMCCollisionId() == mcCollision.globalIndex()); } @@ -3053,7 +3056,7 @@ struct derivedlambdakzeroanalysis { ymc > v0Selections.rapidityMaxCut) continue; - auto mcCollision = v0MC.template straMCCollision_as>(); + auto mcCollision = v0MC.template straMCCollision_as(); if (eventSelections.applyZVtxSelOnMCPV && std::abs(mcCollision.posZ()) > eventSelections.maxZVtxPosition) { continue; } @@ -3075,22 +3078,34 @@ struct derivedlambdakzeroanalysis { } if (v0MC.pdgCode() == PDG_t::kK0Short) { - if (useMcCentrality) { - histos.fill(HIST("h2dGenK0ShortVsMcCentrality_RecoedEvt"), getCentralityRun3(mcCollision), ptmc); + if constexpr (run3) { + if (useMcCentrality) { + histos.fill(HIST("h2dGenK0ShortVsMcCentrality_RecoedEvt"), getCentralityRun3(mcCollision), ptmc); + } else { + histos.fill(HIST("h2dGenK0ShortVsMultMC_RecoedEvt"), mcCollision.multMCNParticlesEta05(), ptmc); + } } else { histos.fill(HIST("h2dGenK0ShortVsMultMC_RecoedEvt"), mcCollision.multMCNParticlesEta05(), ptmc); } } if (v0MC.pdgCode() == PDG_t::kLambda0) { - if (useMcCentrality) { - histos.fill(HIST("h2dGenLambdaVsMcCentrality_RecoedEvt"), getCentralityRun3(mcCollision), ptmc); + if constexpr (run3) { + if (useMcCentrality) { + histos.fill(HIST("h2dGenLambdaVsMcCentrality_RecoedEvt"), getCentralityRun3(mcCollision), ptmc); + } else { + histos.fill(HIST("h2dGenLambdaVsMultMC_RecoedEvt"), mcCollision.multMCNParticlesEta05(), ptmc); + } } else { histos.fill(HIST("h2dGenLambdaVsMultMC_RecoedEvt"), mcCollision.multMCNParticlesEta05(), ptmc); } } if (v0MC.pdgCode() == PDG_t::kLambda0Bar) { - if (useMcCentrality) { - histos.fill(HIST("h2dGenAntiLambdaVsMcCentrality_RecoedEvt"), getCentralityRun3(mcCollision), ptmc); + if constexpr (run3) { + if (useMcCentrality) { + histos.fill(HIST("h2dGenAntiLambdaVsMcCentrality_RecoedEvt"), getCentralityRun3(mcCollision), ptmc); + } else { + histos.fill(HIST("h2dGenAntiLambdaVsMultMC_RecoedEvt"), mcCollision.multMCNParticlesEta05(), ptmc); + } } else { histos.fill(HIST("h2dGenAntiLambdaVsMultMC_RecoedEvt"), mcCollision.multMCNParticlesEta05(), ptmc); } @@ -3099,24 +3114,36 @@ struct derivedlambdakzeroanalysis { if (v0MC.pdgCode() == PDG_t::kK0Short) { histos.fill(HIST("h2dGenK0Short"), centrality, ptmc); - if (useMcCentrality) { - histos.fill(HIST("h2dGenK0ShortVsMcCentrality"), getCentralityRun3(mcCollision), ptmc); + if constexpr (run3) { + if (useMcCentrality) { + histos.fill(HIST("h2dGenK0ShortVsMcCentrality"), getCentralityRun3(mcCollision), ptmc); + } else { + histos.fill(HIST("h2dGenK0ShortVsMultMC"), mcCollision.multMCNParticlesEta05(), ptmc); + } } else { histos.fill(HIST("h2dGenK0ShortVsMultMC"), mcCollision.multMCNParticlesEta05(), ptmc); } } if (v0MC.pdgCode() == PDG_t::kLambda0) { histos.fill(HIST("h2dGenLambda"), centrality, ptmc); - if (useMcCentrality) { - histos.fill(HIST("h2dGenLambdaVsMcCentrality"), getCentralityRun3(mcCollision), ptmc); + if constexpr (run3) { + if (useMcCentrality) { + histos.fill(HIST("h2dGenLambdaVsMcCentrality"), getCentralityRun3(mcCollision), ptmc); + } else { + histos.fill(HIST("h2dGenLambdaVsMultMC"), mcCollision.multMCNParticlesEta05(), ptmc); + } } else { histos.fill(HIST("h2dGenLambdaVsMultMC"), mcCollision.multMCNParticlesEta05(), ptmc); } } if (v0MC.pdgCode() == PDG_t::kLambda0Bar) { histos.fill(HIST("h2dGenAntiLambda"), centrality, ptmc); - if (useMcCentrality) { - histos.fill(HIST("h2dGenAntiLambdaVsMcCentrality"), getCentralityRun3(mcCollision), ptmc); + if constexpr (run3) { + if (useMcCentrality) { + histos.fill(HIST("h2dGenAntiLambdaVsMcCentrality"), getCentralityRun3(mcCollision), ptmc); + } else { + histos.fill(HIST("h2dGenAntiLambdaVsMultMC"), mcCollision.multMCNParticlesEta05(), ptmc); + } } else { histos.fill(HIST("h2dGenAntiLambdaVsMultMC"), mcCollision.multMCNParticlesEta05(), ptmc); } @@ -3141,7 +3168,7 @@ struct derivedlambdakzeroanalysis { ymc > v0Selections.rapidityMaxCut) continue; - auto mcCollision = cascMC.template straMCCollision_as>(); + auto mcCollision = cascMC.template straMCCollision_as(); if (eventSelections.applyZVtxSelOnMCPV && std::abs(mcCollision.posZ()) > eventSelections.maxZVtxPosition) { continue; } @@ -3163,29 +3190,45 @@ struct derivedlambdakzeroanalysis { } if (cascMC.pdgCode() == PDG_t::kXiMinus) { - if (useMcCentrality) { - histos.fill(HIST("h2dGenXiMinusVsMcCentrality_RecoedEvt"), getCentralityRun3(mcCollision), ptmc); + if constexpr (run3) { + if (useMcCentrality) { + histos.fill(HIST("h2dGenXiMinusVsMcCentrality_RecoedEvt"), getCentralityRun3(mcCollision), ptmc); + } else { + histos.fill(HIST("h2dGenXiMinusVsMultMC_RecoedEvt"), mcCollision.multMCNParticlesEta05(), ptmc); + } } else { histos.fill(HIST("h2dGenXiMinusVsMultMC_RecoedEvt"), mcCollision.multMCNParticlesEta05(), ptmc); } } if (cascMC.pdgCode() == PDG_t::kXiPlusBar) { - if (useMcCentrality) { - histos.fill(HIST("h2dGenXiPlusVsMcCentrality_RecoedEvt"), getCentralityRun3(mcCollision), ptmc); + if constexpr (run3) { + if (useMcCentrality) { + histos.fill(HIST("h2dGenXiPlusVsMcCentrality_RecoedEvt"), getCentralityRun3(mcCollision), ptmc); + } else { + histos.fill(HIST("h2dGenXiPlusVsMultMC_RecoedEvt"), mcCollision.multMCNParticlesEta05(), ptmc); + } } else { histos.fill(HIST("h2dGenXiPlusVsMultMC_RecoedEvt"), mcCollision.multMCNParticlesEta05(), ptmc); } } if (cascMC.pdgCode() == PDG_t::kOmegaMinus) { - if (useMcCentrality) { - histos.fill(HIST("h2dGenOmegaMinusVsMcCentrality_RecoedEvt"), getCentralityRun3(mcCollision), ptmc); + if constexpr (run3) { + if (useMcCentrality) { + histos.fill(HIST("h2dGenOmegaMinusVsMcCentrality_RecoedEvt"), getCentralityRun3(mcCollision), ptmc); + } else { + histos.fill(HIST("h2dGenOmegaMinusVsMultMC_RecoedEvt"), mcCollision.multMCNParticlesEta05(), ptmc); + } } else { histos.fill(HIST("h2dGenOmegaMinusVsMultMC_RecoedEvt"), mcCollision.multMCNParticlesEta05(), ptmc); } } if (cascMC.pdgCode() == PDG_t::kOmegaPlusBar) { - if (useMcCentrality) { - histos.fill(HIST("h2dGenOmegaPlusVsMcCentrality_RecoedEvt"), getCentralityRun3(mcCollision), ptmc); + if constexpr (run3) { + if (useMcCentrality) { + histos.fill(HIST("h2dGenOmegaPlusVsMcCentrality_RecoedEvt"), getCentralityRun3(mcCollision), ptmc); + } else { + histos.fill(HIST("h2dGenOmegaPlusVsMultMC_RecoedEvt"), mcCollision.multMCNParticlesEta05(), ptmc); + } } else { histos.fill(HIST("h2dGenOmegaPlusVsMultMC_RecoedEvt"), mcCollision.multMCNParticlesEta05(), ptmc); } @@ -3216,32 +3259,48 @@ struct derivedlambdakzeroanalysis { if (cascMC.pdgCode() == PDG_t::kXiMinus) { histos.fill(HIST("h2dGenXiMinus"), centrality, ptmc); - if (useMcCentrality) { - histos.fill(HIST("h2dGenXiMinusVsMcCentrality"), getCentralityRun3(mcCollision), ptmc); + if constexpr (run3) { + if (useMcCentrality) { + histos.fill(HIST("h2dGenXiMinusVsMcCentrality"), getCentralityRun3(mcCollision), ptmc); + } else { + histos.fill(HIST("h2dGenXiMinusVsMultMC"), mcCollision.multMCNParticlesEta05(), ptmc); + } } else { histos.fill(HIST("h2dGenXiMinusVsMultMC"), mcCollision.multMCNParticlesEta05(), ptmc); } } if (cascMC.pdgCode() == PDG_t::kXiPlusBar) { histos.fill(HIST("h2dGenXiPlus"), centrality, ptmc); - if (useMcCentrality) { - histos.fill(HIST("h2dGenXiPlusVsMcCentrality"), getCentralityRun3(mcCollision), ptmc); + if constexpr (run3) { + if (useMcCentrality) { + histos.fill(HIST("h2dGenXiPlusVsMcCentrality"), getCentralityRun3(mcCollision), ptmc); + } else { + histos.fill(HIST("h2dGenXiPlusVsMultMC"), mcCollision.multMCNParticlesEta05(), ptmc); + } } else { histos.fill(HIST("h2dGenXiPlusVsMultMC"), mcCollision.multMCNParticlesEta05(), ptmc); } } if (cascMC.pdgCode() == PDG_t::kOmegaMinus) { histos.fill(HIST("h2dGenOmegaMinus"), centrality, ptmc); - if (useMcCentrality) { - histos.fill(HIST("h2dGenOmegaMinusVsMcCentrality"), getCentralityRun3(mcCollision), ptmc); + if constexpr (run3) { + if (useMcCentrality) { + histos.fill(HIST("h2dGenOmegaMinusVsMcCentrality"), getCentralityRun3(mcCollision), ptmc); + } else { + histos.fill(HIST("h2dGenOmegaMinusVsMultMC"), mcCollision.multMCNParticlesEta05(), ptmc); + } } else { histos.fill(HIST("h2dGenOmegaMinusVsMultMC"), mcCollision.multMCNParticlesEta05(), ptmc); } } if (cascMC.pdgCode() == PDG_t::kOmegaPlusBar) { histos.fill(HIST("h2dGenOmegaPlus"), centrality, ptmc); - if (useMcCentrality) { - histos.fill(HIST("h2dGenOmegaPlusVsMcCentrality"), getCentralityRun3(mcCollision), ptmc); + if constexpr (run3) { + if (useMcCentrality) { + histos.fill(HIST("h2dGenOmegaPlusVsMcCentrality"), getCentralityRun3(mcCollision), ptmc); + } else { + histos.fill(HIST("h2dGenOmegaPlusVsMultMC"), mcCollision.multMCNParticlesEta05(), ptmc); + } } else { histos.fill(HIST("h2dGenOmegaPlusVsMultMC"), mcCollision.multMCNParticlesEta05(), ptmc); } @@ -3310,16 +3369,16 @@ struct derivedlambdakzeroanalysis { // ______________________________________________________ // Simulated processing in Run 3 (subscribes to MC information too) - void processMonteCarloRun3(soa::Join::iterator const& collision, V0McCandidates const& fullV0s, DauTracks const&, aod::MotherMCParts const&, soa::Join const& /*mccollisions*/, soa::Join const&) + void processMonteCarloRun3(soa::Join::iterator const& collision, V0McCandidates const& fullV0s, DauTracks const&, aod::MotherMCParts const&, soa::Join const& mccollisions, soa::Join const&) { - analyzeRecoedV0sInMonteCarlo(collision, fullV0s); + analyzeRecoedV0sInMonteCarlo(collision, fullV0s, mccollisions); } // ______________________________________________________ // Simulated processing in Run 2 (subscribes to MC information too) - void processMonteCarloRun2(soa::Join::iterator const& collision, V0McCandidates const& fullV0s, DauTracks const&, aod::MotherMCParts const&, soa::Join const& /*mccollisions*/, soa::Join const&) + void processMonteCarloRun2(soa::Join::iterator const& collision, V0McCandidates const& fullV0s, DauTracks const&, aod::MotherMCParts const&, soa::Join const& mccollisions, soa::Join const&) { - analyzeRecoedV0sInMonteCarlo(collision, fullV0s); + analyzeRecoedV0sInMonteCarlo(collision, fullV0s, mccollisions); } // ______________________________________________________ From efbdd3d9501eb4a6fb738babd5fbfc6f67f17688 Mon Sep 17 00:00:00 2001 From: SCHOTTER Romain <47983209+romainschotter@users.noreply.github.com> Date: Wed, 26 Aug 2026 00:06:03 +0200 Subject: [PATCH 13/27] Fix include for mcCentrality.cxx --- PWGLF/TableProducer/Common/mcCentrality.cxx | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/PWGLF/TableProducer/Common/mcCentrality.cxx b/PWGLF/TableProducer/Common/mcCentrality.cxx index a366c36c00b..423ff62dabf 100644 --- a/PWGLF/TableProducer/Common/mcCentrality.cxx +++ b/PWGLF/TableProducer/Common/mcCentrality.cxx @@ -17,27 +17,19 @@ /// \brief Task to produce the table for the equalized multiplicity into centrality bins /// -#include "PWGLF/DataModel/mcCentrality.h" - -#include "TableHelper.h" - -#include "PWGLF/Utils/inelGt.h" #include "PWGLF/Utils/mcCentralityModule.h" -#include "Common/DataModel/Centrality.h" #include "Common/DataModel/Multiplicity.h" -#include "Common/DataModel/TrackSelectionTables.h" #include -#include #include +#include #include +#include #include -#include -#include -#include +#include +#include #include -#include #include From 63fd67b8de699c4db37f87bfc3b151cd8915ba00 Mon Sep 17 00:00:00 2001 From: SCHOTTER Romain <47983209+romainschotter@users.noreply.github.com> Date: Wed, 26 Aug 2026 00:09:55 +0200 Subject: [PATCH 14/27] Fix include in strangenessMcCentrality --- .../Strangeness/strangenessMcCentrality.cxx | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/PWGLF/TableProducer/Strangeness/strangenessMcCentrality.cxx b/PWGLF/TableProducer/Strangeness/strangenessMcCentrality.cxx index 50191868e99..61cdcf7faa7 100644 --- a/PWGLF/TableProducer/Strangeness/strangenessMcCentrality.cxx +++ b/PWGLF/TableProducer/Strangeness/strangenessMcCentrality.cxx @@ -15,26 +15,17 @@ /// \brief Task to produce the MC centrality table for strangeness derived data /// -#include "TableHelper.h" - -#include "PWGLF/DataModel/LFStrangenessTables.h" -#include "PWGLF/DataModel/mcCentrality.h" #include "PWGLF/Utils/mcCentralityModule.h" - -#include "Common/DataModel/Centrality.h" -#include "Common/DataModel/Multiplicity.h" -#include "Common/DataModel/TrackSelectionTables.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" #include -#include -#include +#include #include +#include #include -#include -#include -#include +#include +#include #include -#include #include From 222acf4614e9741cea572f01a224d79860118a8e Mon Sep 17 00:00:00 2001 From: SCHOTTER Romain <47983209+romainschotter@users.noreply.github.com> Date: Wed, 26 Aug 2026 00:18:29 +0200 Subject: [PATCH 15/27] Add strangeness-mc-centrality in CMakeLists.txt --- PWGLF/TableProducer/Strangeness/CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/PWGLF/TableProducer/Strangeness/CMakeLists.txt b/PWGLF/TableProducer/Strangeness/CMakeLists.txt index 83b05e9a1bc..4ec8dc02d4c 100644 --- a/PWGLF/TableProducer/Strangeness/CMakeLists.txt +++ b/PWGLF/TableProducer/Strangeness/CMakeLists.txt @@ -188,3 +188,8 @@ o2physics_add_dpl_workflow(phi-strange-correlator SOURCES phiStrangeCorrelator.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(strangeness-mc-centrality + SOURCES strangenessMcCentrality.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) From 1d329f8df9dde20f49337a657d1e36358bd4fc7e Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Tue, 25 Aug 2026 22:19:12 +0000 Subject: [PATCH 16/27] Please consider the following formatting changes --- .../Strangeness/strangenessMcCentrality.cxx | 2 +- .../derivedlambdakzeroanalysis.cxx | 22 ++++++++++++------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/PWGLF/TableProducer/Strangeness/strangenessMcCentrality.cxx b/PWGLF/TableProducer/Strangeness/strangenessMcCentrality.cxx index 61cdcf7faa7..b244d846df1 100644 --- a/PWGLF/TableProducer/Strangeness/strangenessMcCentrality.cxx +++ b/PWGLF/TableProducer/Strangeness/strangenessMcCentrality.cxx @@ -15,8 +15,8 @@ /// \brief Task to produce the MC centrality table for strangeness derived data /// -#include "PWGLF/Utils/mcCentralityModule.h" #include "PWGLF/DataModel/LFStrangenessTables.h" +#include "PWGLF/Utils/mcCentralityModule.h" #include #include diff --git a/PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx b/PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx index b006367f315..82c6ea33693 100644 --- a/PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx +++ b/PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx @@ -1227,7 +1227,7 @@ struct derivedlambdakzeroanalysis { histos.add("h2dGenXiPlusVsMcCentrality_RecoedEvt", "h2dGenXiPlusVsMcCentrality_RecoedEvt", kTH2D, {axisConfigurations.axisCentralityFine, axisConfigurations.axisPt}); histos.add("h2dGenOmegaMinusVsMcCentrality_RecoedEvt", "h2dGenOmegaMinusVsMcCentrality_RecoedEvt", kTH2D, {axisConfigurations.axisCentralityFine, axisConfigurations.axisPt}); histos.add("h2dGenOmegaPlusVsMcCentrality_RecoedEvt", "h2dGenOmegaPlusVsMcCentrality_RecoedEvt", kTH2D, {axisConfigurations.axisCentralityFine, axisConfigurations.axisPt}); - + histos.add("h2dGenK0ShortVsMcCentrality", "h2dGenK0ShortVsMcCentrality", kTH2D, {axisConfigurations.axisCentralityFine, axisConfigurations.axisPt}); histos.add("h2dGenLambdaVsMcCentrality", "h2dGenLambdaVsMcCentrality", kTH2D, {axisConfigurations.axisCentralityFine, axisConfigurations.axisPt}); histos.add("h2dGenAntiLambdaVsMcCentrality", "h2dGenAntiLambdaVsMcCentrality", kTH2D, {axisConfigurations.axisCentralityFine, axisConfigurations.axisPt}); @@ -1243,7 +1243,7 @@ struct derivedlambdakzeroanalysis { histos.add("h2dGenXiPlusVsMultMC_RecoedEvt", "h2dGenXiPlusVsMultMC_RecoedEvt", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisPt}); histos.add("h2dGenOmegaMinusVsMultMC_RecoedEvt", "h2dGenOmegaMinusVsMultMC_RecoedEvt", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisPt}); histos.add("h2dGenOmegaPlusVsMultMC_RecoedEvt", "h2dGenOmegaPlusVsMultMC_RecoedEvt", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisPt}); - + histos.add("h2dGenK0ShortVsMultMC", "h2dGenK0ShortVsMultMC", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisPt}); histos.add("h2dGenLambdaVsMultMC", "h2dGenLambdaVsMultMC", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisPt}); histos.add("h2dGenAntiLambdaVsMultMC", "h2dGenAntiLambdaVsMultMC", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisPt}); @@ -1300,13 +1300,19 @@ struct derivedlambdakzeroanalysis { // Helper lambda to extract centrality from any object exposing the cent* columns auto extractCentrality = [this](auto const& coll) -> float { switch (centralityEstimator) { - case kCentFT0C: return coll.centFT0C(); - case kCentFT0M: return coll.centFT0M(); - case kCentFT0CVariant1: return coll.centFT0CVariant1(); + case kCentFT0C: + return coll.centFT0C(); + case kCentFT0M: + return coll.centFT0M(); + case kCentFT0CVariant1: + return coll.centFT0CVariant1(); // case kCentMFT: return coll.centMFT(); - case kCentNGlobal: return coll.centNGlobal(); - case kCentFV0A: return coll.centFV0A(); - default: return -1.f; + case kCentNGlobal: + return coll.centNGlobal(); + case kCentFV0A: + return coll.centFV0A(); + default: + return -1.f; } }; From ec38e3e88b6ebecadf3538949be07bfc9c88684f Mon Sep 17 00:00:00 2001 From: SCHOTTER Romain <47983209+romainschotter@users.noreply.github.com> Date: Wed, 26 Aug 2026 00:27:04 +0200 Subject: [PATCH 17/27] Fix mcCentralityModule.h --- PWGLF/Utils/mcCentralityModule.h | 183 ++++++++++++++++--------------- 1 file changed, 94 insertions(+), 89 deletions(-) diff --git a/PWGLF/Utils/mcCentralityModule.h b/PWGLF/Utils/mcCentralityModule.h index faa00391db0..3e9a98013a9 100644 --- a/PWGLF/Utils/mcCentralityModule.h +++ b/PWGLF/Utils/mcCentralityModule.h @@ -18,35 +18,40 @@ #ifndef PWGLF_UTILS_MCCENTRALITYMODULE_H_ #define PWGLF_UTILS_MCCENTRALITYMODULE_H -#include "TableHelper.h" - #include "PWGLF/DataModel/mcCentrality.h" -#include "Common/DataModel/Centrality.h" -#include "Common/DataModel/Multiplicity.h" -#include "Common/DataModel/TrackSelectionTables.h" - #include -#include #include -#include +#include +#include +#include +#include +#include #include -#include +#include #include -#include #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; -using namespace o2::track; //__________________________________________ // strangeness builder module @@ -61,16 +66,17 @@ namespace mccentrality // avoid polluting other namespaces // statics necessary for the configurables in this namespace static constexpr int nParameters = 1; static const std::vector tableNames{ - "McCentFV0As", - "McCentFT0Ms", - "McCentFT0As", - "McCentFT0Cs", - "McCentFT0CVariant1s", - "McCentFT0CVariant2s", - "McCentFDDMs", - "McCentNTPVs", - "McCentNGlobals", - "McCentMFTs"}; + "McCentFV0As", + "McCentFT0Ms", + "McCentFT0As", + "McCentFT0Cs", + "McCentFT0CVariant1s", + "McCentFT0CVariant2s", + "McCentFDDMs", + "McCentNTPVs", + "McCentNGlobals", + "McCentMFTs" +}; static constexpr int nTablesConst = 10; static const std::vector parameterNames{"enable"}; @@ -97,19 +103,20 @@ enum tableIndex { kFV0A = 0, kNTPV, kNGlobal, kMFT, - kNestimators }; + kNestimators}; static constexpr const char* DirList[] = { - "FV0A", - "FT0M", - "FT0A", - "FT0C", - "FT0CVariant1", - "FT0CVariant2", - "FDDM", - "NTPV", - "NGlobal", - "MFT"}; + "FV0A", + "FT0M", + "FT0A", + "FT0C", + "FT0CVariant1", + "FT0CVariant2", + "FDDM", + "NTPV", + "NGlobal", + "MFT" +}; // mcCentralityModule: 1st-order configurables struct coreConfigurables : o2::framework::ConfigurableGroup { @@ -129,7 +136,7 @@ struct coreConfigurables : o2::framework::ConfigurableGroup { ConfigurableAxis binsPercentileFine{"binsPercentileFine", {VARIABLE_WIDTH, 0, 0.001, 0.01, 1.0, 5.0, 10.0, 15.0, 20.0, 25.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0}, "Binning of the percentile axis"}; ConfigurableAxis binsMultiplicity{"binsMultiplicity", {1000, 0, 5000}, "Binning of the multiplicity axis"}; - // ccdb configurables + //ccdb configurables Configurable path{"path", "/tmp/InputCalibMC.root", "path to calib file or ccdb path if begins with ccdb://"}; // debug option @@ -152,11 +159,11 @@ struct products : o2::framework::ProducesGroup { template concept HasMcMults = requires(typename T::iterator a) { - { a.multMCFT0A() } -> std::convertible_to; - { a.multMCFT0C() } -> std::convertible_to; - { a.multMCFV0A() } -> std::convertible_to; - { a.multMCFDDA() } -> std::convertible_to; - { a.multMCFDDC() } -> std::convertible_to; + { a.multMCFT0A() } -> std::convertible_to; + { a.multMCFT0C() } -> std::convertible_to; + { a.multMCFV0A() } -> std::convertible_to; + { a.multMCFDDA() } -> std::convertible_to; + { a.multMCFDDC() } -> std::convertible_to; { a.multMCNParticlesEta08() } -> std::convertible_to; { a.multMCNParticlesEta05() } -> std::convertible_to; }; @@ -371,8 +378,7 @@ struct BuilderModule { } template - THist* getHist(const char* name) - { + THist* getHist(const char* name) { if (!this->MCCentralityCalibObjects) { return (THist*)0x0; } @@ -390,18 +396,17 @@ struct BuilderModule { return hist; } - TH1D* extractCentralityCalibration(int idx, const char* name, bool reverse = false) - { + TH1D* extractCentralityCalibration(int idx, const char* name, bool reverse = false) { - auto CalibMC = [&](TString estimator) { - printf("\e[1;31mCalibration for %s estimator\e[0;00m -> Starting...\n", estimator.Data()); + auto CalibMC = [&](TString estimator){ + LOGF(info, "\e[1;31mCalibration for %s estimator\e[0;00m -> Starting...\n", estimator.Data()); std::vector percentile_center(nCentBins); std::vector epercentile_center(nCentBins); - // Histograms - TH2D* h2dMultVsCent_Data = getHist(Form("h2dMultVsCent%s_Data", estimator.Data())); - TH2D* h2dMultRecoVsMultGen_MC = getHist(Form("hMultEta05VsGenMult%s", estimator.Data())); + //Histograms + TH2D *h2dMultVsCent_Data = getHist(Form("h2dMultVsCent%s_Data", estimator.Data())); + TH2D *h2dMultRecoVsMultGen_MC = getHist(Form("hMultEta05VsGenMult%s", estimator.Data())); if (!h2dMultVsCent_Data || !h2dMultRecoVsMultGen_MC) { return (TH1D*)0x0; } @@ -413,12 +418,12 @@ struct BuilderModule { TProfile* hPVData = hCalibPVData[idx].get(); TProfile* hPVMC = hCalibPVMC[idx].get(); - TH1D* h1dCalib = h2dMultRecoVsMultGen_MC->ProjectionX(Form("h1d%s", estimator.Data()), 1, h2dMultRecoVsMultGen_MC->GetNbinsX()); + TH1D *h1dCalib = h2dMultRecoVsMultGen_MC->ProjectionX(Form("h1d%s", estimator.Data()), 1, h2dMultRecoVsMultGen_MC->GetNbinsX()); h1dCalib->Reset(); h1dCalib->SetTitle(Form("%s calibration object", estimator.Data())); h1dCalib->GetXaxis()->SetTitle(Form("#it{N}_{%s, gen.}", estimator.Data())); h1dCalib->GetYaxis()->SetTitle(Form("%s percentile (%%)", estimator.Data())); - + // NOTE: candidate-by-candidate assignment (assignCentralityPerCandidate) does not go through this // mean-matching path at all. It samples directly from the "hGenMultEta05VsCentrality" // joint histogram (x = reco centrality of the matched MC collision, y = generated mult |eta|<0.5) @@ -427,16 +432,16 @@ struct BuilderModule { if (reverse) { for (int i = 0; i < nCentBins; i++) { int irev = i; - percentile_center[i] = (centralityBins[irev] + centralityBins[irev + 1]) / 2; - epercentile_center[i] = (centralityBins[irev] - centralityBins[irev + 1]) / 2; + percentile_center[i] = (centralityBins[irev] + centralityBins[irev+1]) / 2; + epercentile_center[i] = (centralityBins[irev] - centralityBins[irev+1]) / 2; } int startBinMc = h1dCalib->GetNbinsX(); for (int i = 0; i < nCentBins; i++) { // Loop over centrality bins // start from the end (from the high multiplicity collisions) int irev = i; - TH1D* projData = h2dMultVsCent_Data->ProjectionY(Form("projData_%d", i), h2dMultVsCent_Data->GetXaxis()->FindBin(centralityBins[irev] + 1e-5), - h2dMultVsCent_Data->GetXaxis()->FindBin(centralityBins[irev + 1] - 1e-5)); + TH1D* projData = h2dMultVsCent_Data->ProjectionY(Form("projData_%d", i), h2dMultVsCent_Data->GetXaxis()->FindBin(centralityBins[irev]+1e-5), + h2dMultVsCent_Data->GetXaxis()->FindBin(centralityBins[irev+1]-1e-5)); double meanMult_Data = projData->GetMean(); @@ -462,7 +467,7 @@ struct BuilderModule { endBinMc = j; } } - if (i == nCentBins - 1) { + if (i == nCentBins-1) { endBinMc = 1; } @@ -487,14 +492,14 @@ struct BuilderModule { } } - printf("\e[1;31mCalibration for %s estimator\e[0;00m -> Data centrality bin \e[1;31m%g-%g%%\e[0;00m\n", estimator.Data(), centralityBins[irev], centralityBins[irev + 1]); - printf("\e[1;31mCalibration for %s estimator\e[0;00m -> MC multiplicity range %g-%g\n", estimator.Data(), projMC->GetBinLowEdge(endBinMc), projMC->GetBinLowEdge(startBinMc)); - printf("\e[1;31mCalibration for %s estimator\e[0;00m -> data = %.4f Vs MC = %.4f (MC/Data = %.4f%%)\n", estimator.Data(), meanMult_Data, meanMult_MC, (meanMult_MC - meanMult_Data) * 100 / meanMult_Data); - printf("\e[1;31mCalibration for %s estimator\e[0;00m -> N entries Data = %g Vs N entries MC = %g\n", estimator.Data(), projData->Integral(), projMC->Integral()); - printf("\n"); + LOGF(info, "\e[1;31mCalibration for %s estimator\e[0;00m -> Data centrality bin \e[1;31m%g-%g%%\e[0;00m\n", estimator.Data(), centralityBins[irev], centralityBins[irev+1]); + LOGF(info, "\e[1;31mCalibration for %s estimator\e[0;00m -> MC multiplicity range %g-%g\n", estimator.Data(), projMC->GetBinLowEdge(endBinMc), projMC->GetBinLowEdge(startBinMc)); + LOGF(info, "\e[1;31mCalibration for %s estimator\e[0;00m -> data = %.4f Vs MC = %.4f (MC/Data = %.4f%%)\n", estimator.Data(), meanMult_Data, meanMult_MC, (meanMult_MC-meanMult_Data) * 100 / meanMult_Data); + LOGF(info, "\e[1;31mCalibration for %s estimator\e[0;00m -> N entries Data = %g Vs N entries MC = %g\n", estimator.Data(), projData->Integral(), projMC->Integral()); + LOGF(info, "\n"); for (int ibin = 1; ibin <= h1dCalib->GetNbinsX(); ibin++) { - if (ibin <= startBinMc && ibin >= endBinMc) { - h1dCalib->SetBinContent(ibin, percentile_center[i]); + if (ibin <= startBinMc && ibin >= endBinMc){ + h1dCalib->SetBinContent(ibin, percentile_center[i]); } } startBinMc = endBinMc; @@ -502,15 +507,15 @@ struct BuilderModule { } else { for (int i = 0; i < nCentBins; i++) { int irev = nCentBins - i; - percentile_center[i] = (centralityBins[irev - 1] + centralityBins[irev]) / 2; - epercentile_center[i] = (centralityBins[irev] - centralityBins[irev - 1]) / 2; + percentile_center[i] = (centralityBins[irev-1] + centralityBins[irev]) / 2; + epercentile_center[i] = (centralityBins[irev] - centralityBins[irev-1]) / 2; } int startBinMc = 1; for (int i = 0; i < nCentBins; i++) { // Loop over centrality bins // start from the end (from the low multiplicity collisions) int irev = nCentBins - i; - TH1D* projData = h2dMultVsCent_Data->ProjectionY(Form("projData_%d", i), h2dMultVsCent_Data->GetXaxis()->FindBin(centralityBins[irev - 1] + 1e-5), - h2dMultVsCent_Data->GetXaxis()->FindBin(centralityBins[irev] - 1e-5)); + TH1D* projData = h2dMultVsCent_Data->ProjectionY(Form("projData_%d", i), h2dMultVsCent_Data->GetXaxis()->FindBin(centralityBins[irev-1]+1e-5), + h2dMultVsCent_Data->GetXaxis()->FindBin(centralityBins[irev]-1e-5)); double meanMult_Data = projData->GetMean(); @@ -536,8 +541,8 @@ struct BuilderModule { endBinMc = j; } } - if (i == nCentBins - 1) { - endBinMc = h2dMultRecoVsMultGen_MC->GetNbinsX(); + if (i == nCentBins-1) { + endBinMc = h2dMultRecoVsMultGen_MC->GetNbinsX(); } TH1D* projMC = h2dMultRecoVsMultGen_MC->ProjectionY(Form("projMC_%d", i), startBinMc, endBinMc); @@ -561,21 +566,21 @@ struct BuilderModule { } } - printf("\e[1;31mCalibration for %s estimator\e[0;00m -> Data centrality bin \e[1;31m%g-%g%%\e[0;00m\n", estimator.Data(), centralityBins[irev - 1], centralityBins[irev]); - printf("\e[1;31mCalibration for %s estimator\e[0;00m -> MC multiplicity range %g-%g\n", estimator.Data(), projMC->GetBinLowEdge(startBinMc), projMC->GetBinLowEdge(endBinMc + 1)); - printf("\e[1;31mCalibration for %s estimator\e[0;00m -> data = %.4f Vs MC = %.4f\n", estimator.Data(), meanMult_Data, meanMult_MC); - printf("\e[1;31mCalibration for %s estimator\e[0;00m -> N entries Data = %g Vs N entries MC = %g\n", estimator.Data(), projData->Integral(), projMC->Integral()); + LOGF(info, "\e[1;31mCalibration for %s estimator\e[0;00m -> Data centrality bin \e[1;31m%g-%g%%\e[0;00m\n", estimator.Data(), centralityBins[irev-1], centralityBins[irev]); + LOGF(info, "\e[1;31mCalibration for %s estimator\e[0;00m -> MC multiplicity range %g-%g\n", estimator.Data(), projMC->GetBinLowEdge(startBinMc), projMC->GetBinLowEdge(endBinMc+1)); + LOGF(info, "\e[1;31mCalibration for %s estimator\e[0;00m -> data = %.4f Vs MC = %.4f\n", estimator.Data(), meanMult_Data, meanMult_MC); + LOGF(info, "\e[1;31mCalibration for %s estimator\e[0;00m -> N entries Data = %g Vs N entries MC = %g\n", estimator.Data(), projData->Integral(), projMC->Integral()); for (int ibin = 1; ibin <= h1dCalib->GetNbinsX(); ibin++) { - if (ibin <= endBinMc && ibin >= startBinMc) { - h1dCalib->SetBinContent(ibin, percentile_center[i]); + if (ibin <= endBinMc && ibin >= startBinMc){ + h1dCalib->SetBinContent(ibin, percentile_center[i]); } } - startBinMc = endBinMc + 1; + startBinMc = endBinMc+1; } // End loop over centrality bins } - printf("\e[1;31mCalibration for %s estimator\e[0;00m -> Done!\n", estimator.Data()); + LOGF(info, "\e[1;31mCalibration for %s estimator\e[0;00m -> Done!\n", estimator.Data()); return h1dCalib; }; @@ -657,8 +662,8 @@ struct BuilderModule { // which has no systematic effect on the sampled distribution. ULong64_t computeSamplingSeed(int64_t collisionIndex, int tableIdx) const { - static constexpr ULong64_t kCollisionStride = 131ull; // > kNestimators, so tableIdx can't alias into the collision term - static constexpr ULong64_t kRunStride = 1000003ull; // prime, well above kCollisionStride * (typical collisions per DF) + static constexpr ULong64_t kCollisionStride = 131ull; // > kNestimators, so tableIdx can't alias into the collision term + static constexpr ULong64_t kRunStride = 1000003ull; // prime, well above kCollisionStride * (typical collisions per DF) return baseOpts.centralitySamplingSeed.value + kRunStride * static_cast(mRunNumber) + kCollisionStride * static_cast(collisionIndex) + static_cast(tableIdx); } @@ -712,15 +717,15 @@ struct BuilderModule { return percentile; }; - populateTable(products.centFV0A, h1dFV0A, h2dCentVsGenMult[kFV0A], nFV0A, std::integral_constant{}); - populateTable(products.centFT0M, h1dFT0M, h2dCentVsGenMult[kFT0M], nFT0M, std::integral_constant{}); - populateTable(products.centFT0A, h1dFT0A, h2dCentVsGenMult[kFT0A], nFT0A, std::integral_constant{}); - populateTable(products.centFT0C, h1dFT0C, h2dCentVsGenMult[kFT0C], nFT0C, std::integral_constant{}); - populateTable(products.centFT0CVariant1, h1dFT0CVariant1, h2dCentVsGenMult[kFT0CVariant1], nFT0C, std::integral_constant{}); - populateTable(products.centFT0CVariant2, h1dFT0CVariant2, h2dCentVsGenMult[kFT0CVariant2], nFT0C, std::integral_constant{}); - populateTable(products.centFDDM, h1dFDDM, h2dCentVsGenMult[kFDDM], nFDDM, std::integral_constant{}); - populateTable(products.centNTPV, h1dNTPV, h2dCentVsGenMult[kNTPV], nGlobal, std::integral_constant{}); - populateTable(products.centNGlobal, h1dNGlobal, h2dCentVsGenMult[kNGlobal], nGlobal, std::integral_constant{}); + populateTable(products.centFV0A, h1dFV0A, h2dCentVsGenMult[kFV0A], nFV0A, std::integral_constant{}); + populateTable(products.centFT0M, h1dFT0M, h2dCentVsGenMult[kFT0M], nFT0M, std::integral_constant{}); + populateTable(products.centFT0A, h1dFT0A, h2dCentVsGenMult[kFT0A], nFT0A, std::integral_constant{}); + populateTable(products.centFT0C, h1dFT0C, h2dCentVsGenMult[kFT0C], nFT0C, std::integral_constant{}); + populateTable(products.centFT0CVariant1, h1dFT0CVariant1, h2dCentVsGenMult[kFT0CVariant1], nFT0C, std::integral_constant{}); + populateTable(products.centFT0CVariant2, h1dFT0CVariant2, h2dCentVsGenMult[kFT0CVariant2], nFT0C, std::integral_constant{}); + populateTable(products.centFDDM, h1dFDDM, h2dCentVsGenMult[kFDDM], nFDDM, std::integral_constant{}); + populateTable(products.centNTPV, h1dNTPV, h2dCentVsGenMult[kNTPV], nGlobal, std::integral_constant{}); + populateTable(products.centNGlobal, h1dNGlobal, h2dCentVsGenMult[kNGlobal], nGlobal, std::integral_constant{}); // populateTable(products.centMFT, h1dMFT, h2dCentVsGenMult[kMFT], nMFT, std::integral_constant{}); // to be added later mcCollisionCounter++; From 68a2a19697152a669c429e464e5b66f5b4af933c Mon Sep 17 00:00:00 2001 From: SCHOTTER Romain <47983209+romainschotter@users.noreply.github.com> Date: Wed, 26 Aug 2026 00:27:46 +0200 Subject: [PATCH 18/27] Fix strangenessMcCentrality --- PWGLF/TableProducer/Strangeness/strangenessMcCentrality.cxx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/PWGLF/TableProducer/Strangeness/strangenessMcCentrality.cxx b/PWGLF/TableProducer/Strangeness/strangenessMcCentrality.cxx index b244d846df1..d51f3e60b78 100644 --- a/PWGLF/TableProducer/Strangeness/strangenessMcCentrality.cxx +++ b/PWGLF/TableProducer/Strangeness/strangenessMcCentrality.cxx @@ -15,8 +15,8 @@ /// \brief Task to produce the MC centrality table for strangeness derived data /// -#include "PWGLF/DataModel/LFStrangenessTables.h" #include "PWGLF/Utils/mcCentralityModule.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" #include #include @@ -32,7 +32,6 @@ using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; -using namespace o2::track; /// Task to produce the response table struct StrangenessMcCentrality { From 6ff23cb732c17528844ac1533ce40e84f9e43e31 Mon Sep 17 00:00:00 2001 From: SCHOTTER Romain <47983209+romainschotter@users.noreply.github.com> Date: Wed, 26 Aug 2026 00:28:33 +0200 Subject: [PATCH 19/27] Fix include of mcCentrality.cxx --- PWGLF/TableProducer/Common/mcCentrality.cxx | 1 - 1 file changed, 1 deletion(-) diff --git a/PWGLF/TableProducer/Common/mcCentrality.cxx b/PWGLF/TableProducer/Common/mcCentrality.cxx index 423ff62dabf..2a73fa6f785 100644 --- a/PWGLF/TableProducer/Common/mcCentrality.cxx +++ b/PWGLF/TableProducer/Common/mcCentrality.cxx @@ -36,7 +36,6 @@ using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; -using namespace o2::track; /// Task to produce the response table struct McCentrality { From 8a24243ed7b9fbe66b4251c2603216625a2ce8e1 Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Tue, 25 Aug 2026 22:28:37 +0000 Subject: [PATCH 20/27] Please consider the following formatting changes --- .../Strangeness/strangenessMcCentrality.cxx | 2 +- PWGLF/Utils/mcCentralityModule.h | 145 +++++++++--------- 2 files changed, 74 insertions(+), 73 deletions(-) diff --git a/PWGLF/TableProducer/Strangeness/strangenessMcCentrality.cxx b/PWGLF/TableProducer/Strangeness/strangenessMcCentrality.cxx index d51f3e60b78..31c969b5303 100644 --- a/PWGLF/TableProducer/Strangeness/strangenessMcCentrality.cxx +++ b/PWGLF/TableProducer/Strangeness/strangenessMcCentrality.cxx @@ -15,8 +15,8 @@ /// \brief Task to produce the MC centrality table for strangeness derived data /// -#include "PWGLF/Utils/mcCentralityModule.h" #include "PWGLF/DataModel/LFStrangenessTables.h" +#include "PWGLF/Utils/mcCentralityModule.h" #include #include diff --git a/PWGLF/Utils/mcCentralityModule.h b/PWGLF/Utils/mcCentralityModule.h index 3e9a98013a9..d982442a3fc 100644 --- a/PWGLF/Utils/mcCentralityModule.h +++ b/PWGLF/Utils/mcCentralityModule.h @@ -23,10 +23,10 @@ #include #include #include -#include #include -#include +#include #include +#include #include #include #include @@ -36,14 +36,15 @@ #include #include #include -#include #include +#include + #include #include +#include #include #include -#include #include #include #include @@ -66,17 +67,16 @@ namespace mccentrality // avoid polluting other namespaces // statics necessary for the configurables in this namespace static constexpr int nParameters = 1; static const std::vector tableNames{ - "McCentFV0As", - "McCentFT0Ms", - "McCentFT0As", - "McCentFT0Cs", - "McCentFT0CVariant1s", - "McCentFT0CVariant2s", - "McCentFDDMs", - "McCentNTPVs", - "McCentNGlobals", - "McCentMFTs" -}; + "McCentFV0As", + "McCentFT0Ms", + "McCentFT0As", + "McCentFT0Cs", + "McCentFT0CVariant1s", + "McCentFT0CVariant2s", + "McCentFDDMs", + "McCentNTPVs", + "McCentNGlobals", + "McCentMFTs"}; static constexpr int nTablesConst = 10; static const std::vector parameterNames{"enable"}; @@ -103,20 +103,19 @@ enum tableIndex { kFV0A = 0, kNTPV, kNGlobal, kMFT, - kNestimators}; + kNestimators }; static constexpr const char* DirList[] = { - "FV0A", - "FT0M", - "FT0A", - "FT0C", - "FT0CVariant1", - "FT0CVariant2", - "FDDM", - "NTPV", - "NGlobal", - "MFT" -}; + "FV0A", + "FT0M", + "FT0A", + "FT0C", + "FT0CVariant1", + "FT0CVariant2", + "FDDM", + "NTPV", + "NGlobal", + "MFT"}; // mcCentralityModule: 1st-order configurables struct coreConfigurables : o2::framework::ConfigurableGroup { @@ -136,7 +135,7 @@ struct coreConfigurables : o2::framework::ConfigurableGroup { ConfigurableAxis binsPercentileFine{"binsPercentileFine", {VARIABLE_WIDTH, 0, 0.001, 0.01, 1.0, 5.0, 10.0, 15.0, 20.0, 25.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0}, "Binning of the percentile axis"}; ConfigurableAxis binsMultiplicity{"binsMultiplicity", {1000, 0, 5000}, "Binning of the multiplicity axis"}; - //ccdb configurables + // ccdb configurables Configurable path{"path", "/tmp/InputCalibMC.root", "path to calib file or ccdb path if begins with ccdb://"}; // debug option @@ -159,11 +158,11 @@ struct products : o2::framework::ProducesGroup { template concept HasMcMults = requires(typename T::iterator a) { - { a.multMCFT0A() } -> std::convertible_to; - { a.multMCFT0C() } -> std::convertible_to; - { a.multMCFV0A() } -> std::convertible_to; - { a.multMCFDDA() } -> std::convertible_to; - { a.multMCFDDC() } -> std::convertible_to; + { a.multMCFT0A() } -> std::convertible_to; + { a.multMCFT0C() } -> std::convertible_to; + { a.multMCFV0A() } -> std::convertible_to; + { a.multMCFDDA() } -> std::convertible_to; + { a.multMCFDDC() } -> std::convertible_to; { a.multMCNParticlesEta08() } -> std::convertible_to; { a.multMCNParticlesEta05() } -> std::convertible_to; }; @@ -378,7 +377,8 @@ struct BuilderModule { } template - THist* getHist(const char* name) { + THist* getHist(const char* name) + { if (!this->MCCentralityCalibObjects) { return (THist*)0x0; } @@ -396,17 +396,18 @@ struct BuilderModule { return hist; } - TH1D* extractCentralityCalibration(int idx, const char* name, bool reverse = false) { + TH1D* extractCentralityCalibration(int idx, const char* name, bool reverse = false) + { - auto CalibMC = [&](TString estimator){ + auto CalibMC = [&](TString estimator) { LOGF(info, "\e[1;31mCalibration for %s estimator\e[0;00m -> Starting...\n", estimator.Data()); std::vector percentile_center(nCentBins); std::vector epercentile_center(nCentBins); - //Histograms - TH2D *h2dMultVsCent_Data = getHist(Form("h2dMultVsCent%s_Data", estimator.Data())); - TH2D *h2dMultRecoVsMultGen_MC = getHist(Form("hMultEta05VsGenMult%s", estimator.Data())); + // Histograms + TH2D* h2dMultVsCent_Data = getHist(Form("h2dMultVsCent%s_Data", estimator.Data())); + TH2D* h2dMultRecoVsMultGen_MC = getHist(Form("hMultEta05VsGenMult%s", estimator.Data())); if (!h2dMultVsCent_Data || !h2dMultRecoVsMultGen_MC) { return (TH1D*)0x0; } @@ -418,12 +419,12 @@ struct BuilderModule { TProfile* hPVData = hCalibPVData[idx].get(); TProfile* hPVMC = hCalibPVMC[idx].get(); - TH1D *h1dCalib = h2dMultRecoVsMultGen_MC->ProjectionX(Form("h1d%s", estimator.Data()), 1, h2dMultRecoVsMultGen_MC->GetNbinsX()); + TH1D* h1dCalib = h2dMultRecoVsMultGen_MC->ProjectionX(Form("h1d%s", estimator.Data()), 1, h2dMultRecoVsMultGen_MC->GetNbinsX()); h1dCalib->Reset(); h1dCalib->SetTitle(Form("%s calibration object", estimator.Data())); h1dCalib->GetXaxis()->SetTitle(Form("#it{N}_{%s, gen.}", estimator.Data())); h1dCalib->GetYaxis()->SetTitle(Form("%s percentile (%%)", estimator.Data())); - + // NOTE: candidate-by-candidate assignment (assignCentralityPerCandidate) does not go through this // mean-matching path at all. It samples directly from the "hGenMultEta05VsCentrality" // joint histogram (x = reco centrality of the matched MC collision, y = generated mult |eta|<0.5) @@ -432,16 +433,16 @@ struct BuilderModule { if (reverse) { for (int i = 0; i < nCentBins; i++) { int irev = i; - percentile_center[i] = (centralityBins[irev] + centralityBins[irev+1]) / 2; - epercentile_center[i] = (centralityBins[irev] - centralityBins[irev+1]) / 2; + percentile_center[i] = (centralityBins[irev] + centralityBins[irev + 1]) / 2; + epercentile_center[i] = (centralityBins[irev] - centralityBins[irev + 1]) / 2; } int startBinMc = h1dCalib->GetNbinsX(); for (int i = 0; i < nCentBins; i++) { // Loop over centrality bins // start from the end (from the high multiplicity collisions) int irev = i; - TH1D* projData = h2dMultVsCent_Data->ProjectionY(Form("projData_%d", i), h2dMultVsCent_Data->GetXaxis()->FindBin(centralityBins[irev]+1e-5), - h2dMultVsCent_Data->GetXaxis()->FindBin(centralityBins[irev+1]-1e-5)); + TH1D* projData = h2dMultVsCent_Data->ProjectionY(Form("projData_%d", i), h2dMultVsCent_Data->GetXaxis()->FindBin(centralityBins[irev] + 1e-5), + h2dMultVsCent_Data->GetXaxis()->FindBin(centralityBins[irev + 1] - 1e-5)); double meanMult_Data = projData->GetMean(); @@ -467,7 +468,7 @@ struct BuilderModule { endBinMc = j; } } - if (i == nCentBins-1) { + if (i == nCentBins - 1) { endBinMc = 1; } @@ -492,14 +493,14 @@ struct BuilderModule { } } - LOGF(info, "\e[1;31mCalibration for %s estimator\e[0;00m -> Data centrality bin \e[1;31m%g-%g%%\e[0;00m\n", estimator.Data(), centralityBins[irev], centralityBins[irev+1]); + LOGF(info, "\e[1;31mCalibration for %s estimator\e[0;00m -> Data centrality bin \e[1;31m%g-%g%%\e[0;00m\n", estimator.Data(), centralityBins[irev], centralityBins[irev + 1]); LOGF(info, "\e[1;31mCalibration for %s estimator\e[0;00m -> MC multiplicity range %g-%g\n", estimator.Data(), projMC->GetBinLowEdge(endBinMc), projMC->GetBinLowEdge(startBinMc)); - LOGF(info, "\e[1;31mCalibration for %s estimator\e[0;00m -> data = %.4f Vs MC = %.4f (MC/Data = %.4f%%)\n", estimator.Data(), meanMult_Data, meanMult_MC, (meanMult_MC-meanMult_Data) * 100 / meanMult_Data); + LOGF(info, "\e[1;31mCalibration for %s estimator\e[0;00m -> data = %.4f Vs MC = %.4f (MC/Data = %.4f%%)\n", estimator.Data(), meanMult_Data, meanMult_MC, (meanMult_MC - meanMult_Data) * 100 / meanMult_Data); LOGF(info, "\e[1;31mCalibration for %s estimator\e[0;00m -> N entries Data = %g Vs N entries MC = %g\n", estimator.Data(), projData->Integral(), projMC->Integral()); LOGF(info, "\n"); for (int ibin = 1; ibin <= h1dCalib->GetNbinsX(); ibin++) { - if (ibin <= startBinMc && ibin >= endBinMc){ - h1dCalib->SetBinContent(ibin, percentile_center[i]); + if (ibin <= startBinMc && ibin >= endBinMc) { + h1dCalib->SetBinContent(ibin, percentile_center[i]); } } startBinMc = endBinMc; @@ -507,15 +508,15 @@ struct BuilderModule { } else { for (int i = 0; i < nCentBins; i++) { int irev = nCentBins - i; - percentile_center[i] = (centralityBins[irev-1] + centralityBins[irev]) / 2; - epercentile_center[i] = (centralityBins[irev] - centralityBins[irev-1]) / 2; + percentile_center[i] = (centralityBins[irev - 1] + centralityBins[irev]) / 2; + epercentile_center[i] = (centralityBins[irev] - centralityBins[irev - 1]) / 2; } int startBinMc = 1; for (int i = 0; i < nCentBins; i++) { // Loop over centrality bins // start from the end (from the low multiplicity collisions) int irev = nCentBins - i; - TH1D* projData = h2dMultVsCent_Data->ProjectionY(Form("projData_%d", i), h2dMultVsCent_Data->GetXaxis()->FindBin(centralityBins[irev-1]+1e-5), - h2dMultVsCent_Data->GetXaxis()->FindBin(centralityBins[irev]-1e-5)); + TH1D* projData = h2dMultVsCent_Data->ProjectionY(Form("projData_%d", i), h2dMultVsCent_Data->GetXaxis()->FindBin(centralityBins[irev - 1] + 1e-5), + h2dMultVsCent_Data->GetXaxis()->FindBin(centralityBins[irev] - 1e-5)); double meanMult_Data = projData->GetMean(); @@ -541,8 +542,8 @@ struct BuilderModule { endBinMc = j; } } - if (i == nCentBins-1) { - endBinMc = h2dMultRecoVsMultGen_MC->GetNbinsX(); + if (i == nCentBins - 1) { + endBinMc = h2dMultRecoVsMultGen_MC->GetNbinsX(); } TH1D* projMC = h2dMultRecoVsMultGen_MC->ProjectionY(Form("projMC_%d", i), startBinMc, endBinMc); @@ -566,17 +567,17 @@ struct BuilderModule { } } - LOGF(info, "\e[1;31mCalibration for %s estimator\e[0;00m -> Data centrality bin \e[1;31m%g-%g%%\e[0;00m\n", estimator.Data(), centralityBins[irev-1], centralityBins[irev]); - LOGF(info, "\e[1;31mCalibration for %s estimator\e[0;00m -> MC multiplicity range %g-%g\n", estimator.Data(), projMC->GetBinLowEdge(startBinMc), projMC->GetBinLowEdge(endBinMc+1)); + LOGF(info, "\e[1;31mCalibration for %s estimator\e[0;00m -> Data centrality bin \e[1;31m%g-%g%%\e[0;00m\n", estimator.Data(), centralityBins[irev - 1], centralityBins[irev]); + LOGF(info, "\e[1;31mCalibration for %s estimator\e[0;00m -> MC multiplicity range %g-%g\n", estimator.Data(), projMC->GetBinLowEdge(startBinMc), projMC->GetBinLowEdge(endBinMc + 1)); LOGF(info, "\e[1;31mCalibration for %s estimator\e[0;00m -> data = %.4f Vs MC = %.4f\n", estimator.Data(), meanMult_Data, meanMult_MC); LOGF(info, "\e[1;31mCalibration for %s estimator\e[0;00m -> N entries Data = %g Vs N entries MC = %g\n", estimator.Data(), projData->Integral(), projMC->Integral()); for (int ibin = 1; ibin <= h1dCalib->GetNbinsX(); ibin++) { - if (ibin <= endBinMc && ibin >= startBinMc){ - h1dCalib->SetBinContent(ibin, percentile_center[i]); + if (ibin <= endBinMc && ibin >= startBinMc) { + h1dCalib->SetBinContent(ibin, percentile_center[i]); } } - startBinMc = endBinMc+1; + startBinMc = endBinMc + 1; } // End loop over centrality bins } @@ -662,8 +663,8 @@ struct BuilderModule { // which has no systematic effect on the sampled distribution. ULong64_t computeSamplingSeed(int64_t collisionIndex, int tableIdx) const { - static constexpr ULong64_t kCollisionStride = 131ull; // > kNestimators, so tableIdx can't alias into the collision term - static constexpr ULong64_t kRunStride = 1000003ull; // prime, well above kCollisionStride * (typical collisions per DF) + static constexpr ULong64_t kCollisionStride = 131ull; // > kNestimators, so tableIdx can't alias into the collision term + static constexpr ULong64_t kRunStride = 1000003ull; // prime, well above kCollisionStride * (typical collisions per DF) return baseOpts.centralitySamplingSeed.value + kRunStride * static_cast(mRunNumber) + kCollisionStride * static_cast(collisionIndex) + static_cast(tableIdx); } @@ -717,15 +718,15 @@ struct BuilderModule { return percentile; }; - populateTable(products.centFV0A, h1dFV0A, h2dCentVsGenMult[kFV0A], nFV0A, std::integral_constant{}); - populateTable(products.centFT0M, h1dFT0M, h2dCentVsGenMult[kFT0M], nFT0M, std::integral_constant{}); - populateTable(products.centFT0A, h1dFT0A, h2dCentVsGenMult[kFT0A], nFT0A, std::integral_constant{}); - populateTable(products.centFT0C, h1dFT0C, h2dCentVsGenMult[kFT0C], nFT0C, std::integral_constant{}); - populateTable(products.centFT0CVariant1, h1dFT0CVariant1, h2dCentVsGenMult[kFT0CVariant1], nFT0C, std::integral_constant{}); - populateTable(products.centFT0CVariant2, h1dFT0CVariant2, h2dCentVsGenMult[kFT0CVariant2], nFT0C, std::integral_constant{}); - populateTable(products.centFDDM, h1dFDDM, h2dCentVsGenMult[kFDDM], nFDDM, std::integral_constant{}); - populateTable(products.centNTPV, h1dNTPV, h2dCentVsGenMult[kNTPV], nGlobal, std::integral_constant{}); - populateTable(products.centNGlobal, h1dNGlobal, h2dCentVsGenMult[kNGlobal], nGlobal, std::integral_constant{}); + populateTable(products.centFV0A, h1dFV0A, h2dCentVsGenMult[kFV0A], nFV0A, std::integral_constant{}); + populateTable(products.centFT0M, h1dFT0M, h2dCentVsGenMult[kFT0M], nFT0M, std::integral_constant{}); + populateTable(products.centFT0A, h1dFT0A, h2dCentVsGenMult[kFT0A], nFT0A, std::integral_constant{}); + populateTable(products.centFT0C, h1dFT0C, h2dCentVsGenMult[kFT0C], nFT0C, std::integral_constant{}); + populateTable(products.centFT0CVariant1, h1dFT0CVariant1, h2dCentVsGenMult[kFT0CVariant1], nFT0C, std::integral_constant{}); + populateTable(products.centFT0CVariant2, h1dFT0CVariant2, h2dCentVsGenMult[kFT0CVariant2], nFT0C, std::integral_constant{}); + populateTable(products.centFDDM, h1dFDDM, h2dCentVsGenMult[kFDDM], nFDDM, std::integral_constant{}); + populateTable(products.centNTPV, h1dNTPV, h2dCentVsGenMult[kNTPV], nGlobal, std::integral_constant{}); + populateTable(products.centNGlobal, h1dNGlobal, h2dCentVsGenMult[kNGlobal], nGlobal, std::integral_constant{}); // populateTable(products.centMFT, h1dMFT, h2dCentVsGenMult[kMFT], nMFT, std::integral_constant{}); // to be added later mcCollisionCounter++; From 7648416a82d86f5b1a260d03de7d1d5f04343429 Mon Sep 17 00:00:00 2001 From: SCHOTTER Romain <47983209+romainschotter@users.noreply.github.com> Date: Wed, 26 Aug 2026 00:37:00 +0200 Subject: [PATCH 21/27] Fix typo in mcCentralityModule.h --- PWGLF/Utils/mcCentralityModule.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGLF/Utils/mcCentralityModule.h b/PWGLF/Utils/mcCentralityModule.h index d982442a3fc..b6ccf2e04b7 100644 --- a/PWGLF/Utils/mcCentralityModule.h +++ b/PWGLF/Utils/mcCentralityModule.h @@ -16,7 +16,7 @@ /// #ifndef PWGLF_UTILS_MCCENTRALITYMODULE_H_ -#define PWGLF_UTILS_MCCENTRALITYMODULE_H +#define PWGLF_UTILS_MCCENTRALITYMODULE_H_ #include "PWGLF/DataModel/mcCentrality.h" From cb93b45f1c6ca248df070b286d96d3adfe6c9772 Mon Sep 17 00:00:00 2001 From: SCHOTTER Romain <47983209+romainschotter@users.noreply.github.com> Date: Wed, 26 Aug 2026 09:43:24 +0200 Subject: [PATCH 22/27] Address cpp code-check errors for strangederivedbuilder.cxx --- .../Strangeness/strangederivedbuilder.cxx | 59 ++++++++++--------- 1 file changed, 30 insertions(+), 29 deletions(-) diff --git a/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx b/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx index 220d0dcc63c..2ea40b55f46 100644 --- a/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx +++ b/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx @@ -25,8 +25,6 @@ #include "PWGLF/DataModel/SPCalibrationTables.h" #include "PWGUD/DataModel/UDTables.h" -#include "Common/CCDB/EventSelectionParams.h" -#include "Common/CCDB/RCTSelectionFlags.h" #include "Common/DataModel/Centrality.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/McCollisionExtra.h" @@ -35,6 +33,8 @@ #include "Common/DataModel/PIDResponseTPC.h" #include "Common/DataModel/Qvectors.h" #include "Common/DataModel/TrackSelectionTables.h" +#include "Common/CCDB/EventSelectionParams.h" +#include "Common/CCDB/RCTSelectionFlags.h" #include #include @@ -196,15 +196,15 @@ struct strangederivedbuilder { Configurable inheritEvtSelFromTask{"inheritEvtSelFromTask", "propagation-service", "Inherit event selection parameters from which task?"}; Configurable inheritEvtSelFromTaskCfgGroup{"inheritEvtSelFromTaskCfgGroup", "eventSelectOpts", "What is the configurable group prefix? If none, put nothing"}; Configurable inheritEvtSelFromTaskVerbose{"inheritEvtSelFromTaskVerbose", false, "Enable verbose mode on the getTaskOption utility"}; - bool fillOnlySelectedCollisions = false; // Fill only tables for selected collisions? - bool requireTriggerTVX = false; // require FT0 vertex (acceptable FT0C-FT0A time difference) at trigger level (Run 3 only) - bool rejectITSROFBorder = false; // reject events at ITS ROF border (Run 3 only) - bool rejectTFBorder = false; // reject events at TF border (Run 3 only) - bool rejectSameBunchPileup = false; // reject collisions in case of pileup with another collision in the same foundBC (Run 3 only) - float maxZVtxPosition = 10.; // max Z vtx position (cm) - bool cfgApplyRCTrequirement = false; // Apply RCT requirement? - std::string cfgRCTLabel = ""; // Which detector condition requirements? (CBT, CBT_hadronPID, CBT_electronPID, CBT_calo, CBT_muon, CBT_muon_glo) - bool cfgCheckZDC = false; // Include ZDC flags in the bit selection (for Pb-Pb only) + bool fillOnlySelectedCollisions = false; // Fill only tables for selected collisions? + bool requireTriggerTVX = false; // require FT0 vertex (acceptable FT0C-FT0A time difference) at trigger level (Run 3 only) + bool rejectITSROFBorder = false; // reject events at ITS ROF border (Run 3 only) + bool rejectTFBorder = false; // reject events at TF border (Run 3 only) + bool rejectSameBunchPileup = false; // reject collisions in case of pileup with another collision in the same foundBC (Run 3 only) + float maxZVtxPosition = 10.; // max Z vtx position (cm) + bool cfgApplyRCTrequirement = false; // Apply RCT requirement? + std::string cfgRCTLabel = ""; // Which detector condition requirements? (CBT, CBT_hadronPID, CBT_electronPID, CBT_calo, CBT_muon, CBT_muon_glo) + bool cfgCheckZDC = false; // Include ZDC flags in the bit selection (for Pb-Pb only) bool cfgTreatLimitedAcceptanceAsBad = false; // reject all events where the detectors relevant for the specified Runlist are flagged as LimitedAcceptance o2::aod::rctsel::RCTFlagsChecker rctFlagsChecker; @@ -264,7 +264,7 @@ struct strangederivedbuilder { std::vector genOmegaPlus; // create collision indices beforehand - std::vector TrackCollIndices; // index -1: no collision + std::vector TrackGlobalBc; std::vector V0CollIndices; // index -1: no collision std::vector CascadeCollIndices; // index -1: no collision std::vector KFCascadeCollIndices; // index -1: no collision @@ -280,7 +280,7 @@ struct strangederivedbuilder { } template - void getCfg(o2::framework::InitContext& initContext, const std::string& name, VType& v, const std::string& task) + void getCfg(o2::framework::InitContext& initContext, const std::string name, VType& v, const std::string task) { if (!o2::common::core::getTaskOptionValue(initContext, task, name, v, inheritEvtSelFromTaskVerbose)) { LOG(fatal) << "Could not get " << name << " from " << task << " task"; @@ -288,7 +288,7 @@ struct strangederivedbuilder { } template - bool isCollisionAccepted(TCollision collision, std::array& nSelected) + bool isCollisionAccepted(TCollision const& collision, std::array& nSelected) // check whether the collision passes our collision selections { if (requireTriggerTVX && !collision.selection_bit(aod::evsel::kIsTriggerTVX)) { @@ -468,6 +468,7 @@ struct strangederivedbuilder { eventSelectOptsPrefix += "."; } + getCfg(initContext, eventSelectOptsPrefix + "fillOnlySelectedCollisions", fillOnlySelectedCollisions, inheritEvtSelFromTask); getCfg(initContext, eventSelectOptsPrefix + "requireTriggerTVX", requireTriggerTVX, inheritEvtSelFromTask); getCfg(initContext, eventSelectOptsPrefix + "rejectITSROFBorder", rejectITSROFBorder, inheritEvtSelFromTask); @@ -487,8 +488,8 @@ struct strangederivedbuilder { LOG(info) << "Reject same bunch pile-up..........: " << (rejectSameBunchPileup ? "yes" : "no"); LOG(info) << "Apply RCT requirement..............: " << (cfgApplyRCTrequirement ? "yes" : "no"); LOG(info) << "RCT requirement....................: " << cfgRCTLabel; - LOG(info) << "Check ZDC in RCT requirement.......: " << (cfgCheckZDC ? "yes" : "no"); - LOG(info) << "Treat limited acceptance as bad....: " << (cfgCheckZDC ? "yes" : "no"); + LOG(info) << "Check ZDC in RCT requirement.......: " << (cfgCheckZDC? "yes" : "no"); + LOG(info) << "Treat limited acceptance as bad....: " << (cfgCheckZDC? "yes" : "no"); LOG(info) << "================================================================="; // setup map for fast checking if enabled @@ -552,13 +553,13 @@ struct strangederivedbuilder { void populateCollisionTables(coll const& collisions, udcoll const& udCollisions, tracks const& Tracks, v0d const& V0s, cad const& Cascades, kfcad const& KFCascades, tracad const& TraCascades, bcType const& /*bcs*/) { // create collision indices beforehand - TrackCollIndices.clear(); + TrackGlobalBc.clear(); V0CollIndices.clear(); CascadeCollIndices.clear(); KFCascadeCollIndices.clear(); TraCascadeCollIndices.clear(); - TrackCollIndices.resize(Tracks.size(), 0); // index -1: no collision + TrackGlobalBc.resize(Tracks.size(), 0); V0CollIndices.resize(V0s.size(), -1); // index -1: no collision CascadeCollIndices.resize(Cascades.size(), -1); // index -1: no collision KFCascadeCollIndices.resize(KFCascades.size(), -1); // index -1: no collision @@ -645,7 +646,7 @@ struct strangederivedbuilder { } for (const auto& track : TrackTable_thisColl) - TrackCollIndices[track.globalIndex()] = bc.globalBC(); + TrackGlobalBc[track.globalIndex()] = bc.globalBC(); if (fillOnlySelectedCollisions && !isCollisionAccepted(collision, totalNbrCollisionsPerSelection)) { continue; @@ -726,7 +727,7 @@ struct strangederivedbuilder { totalFDDAmplitudeA, totalFDDAmplitudeC, timeZNA, timeZNC, // ZDC info energyCommonZNA, energyCommonZNC); - } else { // We are in Run 2 + } else { // We are in Run 2 products.strangeCentsRun2(collision.centRun2V0M(), collision.centRun2V0A(), collision.centRun2SPDTracklets(), collision.centRun2SPDClusters()); products.strangeEvSelsRun2(collision.sel8(), collision.sel7(), collision.selection_raw(), @@ -779,13 +780,13 @@ struct strangederivedbuilder { for (const auto& casc : TraCascades) { products.tracasccollref(TraCascadeCollIndices[casc.globalIndex()]); } - products.straSelection(totalNbrCollisions, totalNbrSelectedCollisions, - totalNbrCollisionsPerSelection[o2::aod::straselections::kIsTriggerTVX], - totalNbrCollisionsPerSelection[o2::aod::straselections::kNoITSROFrameBorder], - totalNbrCollisionsPerSelection[o2::aod::straselections::kNoTimeFrameBorder], - totalNbrCollisionsPerSelection[o2::aod::straselections::kIsGoodZvtxAcceptance], - totalNbrCollisionsPerSelection[o2::aod::straselections::kNoSameBunchPileup], - totalNbrCollisionsPerSelection[o2::aod::straselections::kIsGoodRCT]); + products.straSelection(totalNbrCollisions, totalNbrSelectedCollisions, + totalNbrCollisionsPerSelection[o2::aod::straselections::kIsTriggerTVX], + totalNbrCollisionsPerSelection[o2::aod::straselections::kNoITSROFrameBorder], + totalNbrCollisionsPerSelection[o2::aod::straselections::kNoTimeFrameBorder], + totalNbrCollisionsPerSelection[o2::aod::straselections::kIsGoodZvtxAcceptance], + totalNbrCollisionsPerSelection[o2::aod::straselections::kNoSameBunchPileup], + totalNbrCollisionsPerSelection[o2::aod::straselections::kIsGoodRCT]); } // helper function to estimate collision time @@ -810,7 +811,7 @@ struct strangederivedbuilder { collisionEventTime[collision.globalIndex()] /= static_cast(collisionNtracks[collision.globalIndex()]); collisionEventTimeErr[collision.globalIndex()] /= static_cast(collisionNtracks[collision.globalIndex()]); } else { - collisionEventTime[collision.globalIndex()] = -1e+6; // undefined + collisionEventTime[collision.globalIndex()] = -1e+6; // undefined collisionEventTimeErr[collision.globalIndex()] = -1e-6; // undefined } if (fillOnlySelectedCollisions && !isCollisionAccepted(collision, totalNbrCollisionsPerSelection)) { @@ -1048,7 +1049,7 @@ struct strangederivedbuilder { aod::dautrack::packing::packInInt8(tr.tpcNSigmaPr())); // populate daughter-level TOF information if (tr.hasTOF()) { - products.dauTrackTOFPIDs(TrackCollIndices[tr.globalIndex()], products.dauTrackExtras.lastIndex(), tr.tofSignal(), tr.tofEvTime(), tr.tofEvTimeErr(), tr.length(), tr.tofExpMom()); + products.dauTrackTOFPIDs(TrackGlobalBc[tr.globalIndex()], products.dauTrackExtras.lastIndex(), tr.tofSignal(), tr.tofEvTime(), tr.tofEvTimeErr(), tr.length(), tr.tofExpMom()); } } else { // populate with empty fully-compatible Nsigmas if no corresponding table available From bd775ebfc61ff93814bb03526442067689791bf8 Mon Sep 17 00:00:00 2001 From: SCHOTTER Romain <47983209+romainschotter@users.noreply.github.com> Date: Wed, 26 Aug 2026 09:44:05 +0200 Subject: [PATCH 23/27] Address cpp code-check errors in mcCentralityModule.h --- PWGLF/Utils/mcCentralityModule.h | 225 +++++++++++++++---------------- 1 file changed, 110 insertions(+), 115 deletions(-) diff --git a/PWGLF/Utils/mcCentralityModule.h b/PWGLF/Utils/mcCentralityModule.h index b6ccf2e04b7..233fa50a1dd 100644 --- a/PWGLF/Utils/mcCentralityModule.h +++ b/PWGLF/Utils/mcCentralityModule.h @@ -23,10 +23,10 @@ #include #include #include -#include #include -#include +#include #include +#include #include #include #include @@ -36,24 +36,19 @@ #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; - //__________________________________________ // strangeness builder module @@ -67,16 +62,17 @@ namespace mccentrality // avoid polluting other namespaces // statics necessary for the configurables in this namespace static constexpr int nParameters = 1; static const std::vector tableNames{ - "McCentFV0As", - "McCentFT0Ms", - "McCentFT0As", - "McCentFT0Cs", - "McCentFT0CVariant1s", - "McCentFT0CVariant2s", - "McCentFDDMs", - "McCentNTPVs", - "McCentNGlobals", - "McCentMFTs"}; + "McCentFV0As", + "McCentFT0Ms", + "McCentFT0As", + "McCentFT0Cs", + "McCentFT0CVariant1s", + "McCentFT0CVariant2s", + "McCentFDDMs", + "McCentNTPVs", + "McCentNGlobals", + "McCentMFTs" +}; static constexpr int nTablesConst = 10; static const std::vector parameterNames{"enable"}; @@ -103,19 +99,20 @@ enum tableIndex { kFV0A = 0, kNTPV, kNGlobal, kMFT, - kNestimators }; + kNestimators}; static constexpr const char* DirList[] = { - "FV0A", - "FT0M", - "FT0A", - "FT0C", - "FT0CVariant1", - "FT0CVariant2", - "FDDM", - "NTPV", - "NGlobal", - "MFT"}; + "FV0A", + "FT0M", + "FT0A", + "FT0C", + "FT0CVariant1", + "FT0CVariant2", + "FDDM", + "NTPV", + "NGlobal", + "MFT" +}; // mcCentralityModule: 1st-order configurables struct coreConfigurables : o2::framework::ConfigurableGroup { @@ -124,22 +121,22 @@ struct coreConfigurables : o2::framework::ConfigurableGroup { "Produce this table: -1 for autodetect; otherwise, 0/1 is false/true"}; std::vector mEnabledTables; // Vector of enabled tables - Configurable recalibrateCentrality{"recalibrateCentrality", false, "If true, re-calibrate the MC centrality for the binning in binPercentile."}; - Configurable recalibrateMode{"recalibrateMode", 1, "Strategy to calibrate MC centrality? 0: from low to high mult.; 1: from high to low mult."}; - Configurable minEntries{"minEntries", 100.f, "Minimum number of entries for estimating the mean value for the recalibration"}; - Configurable doNotCrashOnNull{"doNotCrashOnNull", false, "If ccdb object does not exist, fill with dummy values"}; + o2::framework::Configurable recalibrateCentrality{"recalibrateCentrality", false, "If true, re-calibrate the MC centrality for the binning in binPercentile."}; + o2::framework::Configurable recalibrateMode{"recalibrateMode", 1, "Strategy to calibrate MC centrality? 0: from low to high mult.; 1: from high to low mult."}; + o2::framework::Configurable minEntries{"minEntries", 100, "Minimum number of entries for estimating the mean value for the recalibration"}; + o2::framework::Configurable doNotCrashOnNull{"doNotCrashOnNull", false, "If ccdb object does not exist, fill with dummy values"}; - Configurable assignCentralityPerCandidate{"assignCentralityPerCandidate", false, "If true, assign centrality by sampling P(centrality|generated multiplicity) per MC collision instead of the class-averaged (statistical) value"}; - Configurable centralitySamplingSeed{"centralitySamplingSeed", 137, "Base seed of the RNG used to sample centrality in candidate-by-candidate mode (assignCentralityPerCandidate)"}; - ConfigurableAxis binsPercentile{"binsPercentile", {VARIABLE_WIDTH, 0, 1.0, 5.0, 10.0, 15.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0}, "Binning of the percentile axis"}; - ConfigurableAxis binsPercentileFine{"binsPercentileFine", {VARIABLE_WIDTH, 0, 0.001, 0.01, 1.0, 5.0, 10.0, 15.0, 20.0, 25.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0}, "Binning of the percentile axis"}; - ConfigurableAxis binsMultiplicity{"binsMultiplicity", {1000, 0, 5000}, "Binning of the multiplicity axis"}; + o2::framework::Configurable assignCentralityPerCandidate{"assignCentralityPerCandidate", false, "If true, assign centrality by sampling P(centrality|generated multiplicity) per MC collision instead of the class-averaged (statistical) value"}; + o2::framework::Configurable centralitySamplingSeed{"centralitySamplingSeed", 137, "Base seed of the RNG used to sample centrality in candidate-by-candidate mode (assignCentralityPerCandidate)"}; + o2::framework::ConfigurableAxis binsPercentile{"binsPercentile", {o2::framework::VARIABLE_WIDTH, 0, 1.0, 5.0, 10.0, 15.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0}, "Binning of the percentile axis"}; + o2::framework::ConfigurableAxis binsPercentileFine{"binsPercentileFine", {o2::framework::VARIABLE_WIDTH, 0, 0.001, 0.01, 1.0, 5.0, 10.0, 15.0, 20.0, 25.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0}, "Binning of the percentile axis"}; + o2::framework::ConfigurableAxis binsMultiplicity{"binsMultiplicity", {1000, 0, 5000}, "Binning of the multiplicity axis"}; - // ccdb configurables - Configurable path{"path", "/tmp/InputCalibMC.root", "path to calib file or ccdb path if begins with ccdb://"}; + //ccdb configurables + o2::framework::Configurable path{"path", "/tmp/InputCalibMC.root", "path to calib file or ccdb path if begins with ccdb://"}; // debug option - Configurable verbose{"verbose", false, "If true, display more messages"}; + o2::framework::Configurable verbose{"verbose", false, "If true, display more messages"}; }; struct products : o2::framework::ProducesGroup { @@ -158,11 +155,11 @@ struct products : o2::framework::ProducesGroup { template concept HasMcMults = requires(typename T::iterator a) { - { a.multMCFT0A() } -> std::convertible_to; - { a.multMCFT0C() } -> std::convertible_to; - { a.multMCFV0A() } -> std::convertible_to; - { a.multMCFDDA() } -> std::convertible_to; - { a.multMCFDDC() } -> std::convertible_to; + { a.multMCFT0A() } -> std::convertible_to; + { a.multMCFT0C() } -> std::convertible_to; + { a.multMCFV0A() } -> std::convertible_to; + { a.multMCFDDA() } -> std::convertible_to; + { a.multMCFDDC() } -> std::convertible_to; { a.multMCNParticlesEta08() } -> std::convertible_to; { a.multMCNParticlesEta05() } -> std::convertible_to; }; @@ -170,7 +167,7 @@ concept HasMcMults = requires(typename T::iterator a) { /// Task to produce the response table struct BuilderModule { // Input parameters - Service ccdb; + o2::framework::Service ccdb; // declaration of structs here // (N.B.: will be invisible to the outside, create your own copies) @@ -223,9 +220,9 @@ struct BuilderModule { if (!baseOpts.recalibrateCentrality) { return; } - AxisSpec axisCentClass{baseOpts.binsPercentile, Form("%s percentile (%%)", name)}; - hCalibPVData[idx] = std::get>(histos.add(Form("%s/calibPVData", name), Form("#LT #it{N}_{PV}^{Data} #GT vs %s percentile;%s percentile (%%);#LT #it{N}_{PV}^{Data} #GT_{|#it{#eta}|<0.5}", name, name), HistType::kTProfile, {axisCentClass})); - hCalibPVMC[idx] = std::get>(histos.add(Form("%s/calibPVMC", name), Form("#LT #it{N}_{PV}^{MC} #GT (reco) vs %s percentile;%s percentile (%%);#LT #it{N}_{PV}^{MC} #GT_{|#it{#eta}|<0.5} (reco)", name, name), HistType::kTProfile, {axisCentClass})); + o2::framework::AxisSpec axisCentClass{baseOpts.binsPercentile, Form("%s percentile (%%)", name)}; + hCalibPVData[idx] = std::get>(histos.add(Form("%s/calibPVData", name), Form("#LT #it{N}_{PV}^{Data} #GT vs %s percentile;%s percentile (%%);#LT #it{N}_{PV}^{Data} #GT_{|#it{#eta}|<0.5}", name, name), o2::framework::HistType::kTProfile, {axisCentClass})); + hCalibPVMC[idx] = std::get>(histos.add(Form("%s/calibPVMC", name), Form("#LT #it{N}_{PV}^{MC} #GT (reco) vs %s percentile;%s percentile (%%);#LT #it{N}_{PV}^{MC} #GT_{|#it{#eta}|<0.5} (reco)", name, name), o2::framework::HistType::kTProfile, {axisCentClass})); } // Registers the candidate-by-candidate sampling QA (no-op unless assignCentralityPerCandidate is on): @@ -240,7 +237,7 @@ struct BuilderModule { if (!baseOpts.assignCentralityPerCandidate) { return; } - histos.add(Form("%s/percentileVsGenMultEta05", name), Form("Sampled %s percentile vs generated mult (|#it{#eta}|<0.5);%s percentile (%%);generated mult (|#it{#eta}|<0.5)", name, name), HistType::kTH2D, {{baseOpts.binsPercentileFine, Form("%s percentile", name)}, {baseOpts.binsMultiplicity, "generated mult (|#eta|<0.5)"}}); + histos.add(Form("%s/percentileVsGenMultEta05", name), Form("Sampled %s percentile vs generated mult (|#it{#eta}|<0.5);%s percentile (%%);generated mult (|#it{#eta}|<0.5)", name, name), o2::framework::HistType::kTH2D, {{baseOpts.binsPercentileFine, Form("%s percentile", name)}, {baseOpts.binsMultiplicity, "generated mult (|#eta|<0.5)"}}); } template @@ -299,69 +296,69 @@ struct BuilderModule { mRunNumber = 0; // TAxis - AxisSpec axisBinsPercentile{baseOpts.binsPercentile, "axisBinsPercentile"}; + o2::framework::AxisSpec axisBinsPercentile{baseOpts.binsPercentile, "axisBinsPercentile"}; nCentBins = axisBinsPercentile.binEdges.size() - 1; for (std::size_t iCent = 0; iCent < axisBinsPercentile.binEdges.size(); iCent++) { centralityBins.push_back(axisBinsPercentile.binEdges[iCent]); } if (baseOpts.mEnabledTables[kFV0A]) { - histos.add("FV0A/percentile", "FV0A percentile.", HistType::kTH1D, {{baseOpts.binsPercentileFine, "FV0A percentile"}}); - histos.add("FV0A/percentilevsMult", "FV0A percentile.", HistType::kTH2D, {{baseOpts.binsPercentileFine, "FV0A percentile"}, {baseOpts.binsMultiplicity, "FV0A mult."}}); + histos.add("FV0A/percentile", "FV0A percentile.", o2::framework::HistType::kTH1D, {{baseOpts.binsPercentileFine, "FV0A percentile"}}); + histos.add("FV0A/percentilevsMult", "FV0A percentile.", o2::framework::HistType::kTH2D, {{baseOpts.binsPercentileFine, "FV0A percentile"}, {baseOpts.binsMultiplicity, "FV0A mult."}}); registerCalibQAHistos(histos, kFV0A, "FV0A"); registerCandidateQAHistos(histos, "FV0A"); } if (baseOpts.mEnabledTables[kFT0M]) { - histos.add("FT0M/percentile", "FT0M percentile.", HistType::kTH1D, {{baseOpts.binsPercentileFine, "FT0M percentile"}}); - histos.add("FT0M/percentilevsMult", "FT0M percentile.", HistType::kTH2D, {{baseOpts.binsPercentileFine, "FT0M percentile"}, {baseOpts.binsMultiplicity, "FT0M mult."}}); + histos.add("FT0M/percentile", "FT0M percentile.", o2::framework::HistType::kTH1D, {{baseOpts.binsPercentileFine, "FT0M percentile"}}); + histos.add("FT0M/percentilevsMult", "FT0M percentile.", o2::framework::HistType::kTH2D, {{baseOpts.binsPercentileFine, "FT0M percentile"}, {baseOpts.binsMultiplicity, "FT0M mult."}}); registerCalibQAHistos(histos, kFT0M, "FT0M"); registerCandidateQAHistos(histos, "FT0M"); } if (baseOpts.mEnabledTables[kFT0A]) { - histos.add("FT0A/percentile", "FT0A percentile.", HistType::kTH1D, {{baseOpts.binsPercentileFine, "FT0A percentile"}}); - histos.add("FT0A/percentilevsMult", "FT0A percentile.", HistType::kTH2D, {{baseOpts.binsPercentileFine, "FT0A percentile"}, {baseOpts.binsMultiplicity, "FT0A mult."}}); + histos.add("FT0A/percentile", "FT0A percentile.", o2::framework::HistType::kTH1D, {{baseOpts.binsPercentileFine, "FT0A percentile"}}); + histos.add("FT0A/percentilevsMult", "FT0A percentile.", o2::framework::HistType::kTH2D, {{baseOpts.binsPercentileFine, "FT0A percentile"}, {baseOpts.binsMultiplicity, "FT0A mult."}}); registerCalibQAHistos(histos, kFT0A, "FT0A"); registerCandidateQAHistos(histos, "FT0A"); } if (baseOpts.mEnabledTables[kFT0C]) { - histos.add("FT0C/percentile", "FT0C percentile.", HistType::kTH1D, {{baseOpts.binsPercentileFine, "FT0C percentile"}}); - histos.add("FT0C/percentilevsMult", "FT0C percentile.", HistType::kTH2D, {{baseOpts.binsPercentileFine, "FT0C percentile"}, {baseOpts.binsMultiplicity, "FT0C mult."}}); + histos.add("FT0C/percentile", "FT0C percentile.", o2::framework::HistType::kTH1D, {{baseOpts.binsPercentileFine, "FT0C percentile"}}); + histos.add("FT0C/percentilevsMult", "FT0C percentile.", o2::framework::HistType::kTH2D, {{baseOpts.binsPercentileFine, "FT0C percentile"}, {baseOpts.binsMultiplicity, "FT0C mult."}}); registerCalibQAHistos(histos, kFT0C, "FT0C"); registerCandidateQAHistos(histos, "FT0C"); } if (baseOpts.mEnabledTables[kFT0CVariant1]) { - histos.add("FT0CVariant1/percentile", "FT0CVariant1 percentile.", HistType::kTH1D, {{baseOpts.binsPercentileFine, "FT0CVariant1 percentile"}}); - histos.add("FT0CVariant1/percentilevsMult", "FT0CVariant1 percentile.", HistType::kTH2D, {{baseOpts.binsPercentileFine, "FT0CVariant1 percentile"}, {baseOpts.binsMultiplicity, "FT0C mult."}}); + histos.add("FT0CVariant1/percentile", "FT0CVariant1 percentile.", o2::framework::HistType::kTH1D, {{baseOpts.binsPercentileFine, "FT0CVariant1 percentile"}}); + histos.add("FT0CVariant1/percentilevsMult", "FT0CVariant1 percentile.", o2::framework::HistType::kTH2D, {{baseOpts.binsPercentileFine, "FT0CVariant1 percentile"}, {baseOpts.binsMultiplicity, "FT0C mult."}}); registerCalibQAHistos(histos, kFT0CVariant1, "FT0CVariant1"); registerCandidateQAHistos(histos, "FT0CVariant1"); } if (baseOpts.mEnabledTables[kFT0CVariant2]) { - histos.add("FT0CVariant2/percentile", "FT0CVariant2 percentile.", HistType::kTH1D, {{baseOpts.binsPercentileFine, "FT0CVariant2 percentile"}}); - histos.add("FT0CVariant2/percentilevsMult", "FT0CVariant2 percentile.", HistType::kTH2D, {{baseOpts.binsPercentileFine, "FT0CVariant2 percentile"}, {baseOpts.binsMultiplicity, "FT0C mult."}}); + histos.add("FT0CVariant2/percentile", "FT0CVariant2 percentile.", o2::framework::HistType::kTH1D, {{baseOpts.binsPercentileFine, "FT0CVariant2 percentile"}}); + histos.add("FT0CVariant2/percentilevsMult", "FT0CVariant2 percentile.", o2::framework::HistType::kTH2D, {{baseOpts.binsPercentileFine, "FT0CVariant2 percentile"}, {baseOpts.binsMultiplicity, "FT0C mult."}}); registerCalibQAHistos(histos, kFT0CVariant2, "FT0CVariant2"); registerCandidateQAHistos(histos, "FT0CVariant2"); } if (baseOpts.mEnabledTables[kFDDM]) { - histos.add("FDDM/percentile", "FDDM percentile.", HistType::kTH1D, {{baseOpts.binsPercentileFine, "FDDM percentile"}}); - histos.add("FDDM/percentilevsMult", "FDDM percentile.", HistType::kTH2D, {{baseOpts.binsPercentileFine, "FDDM percentile"}, {baseOpts.binsMultiplicity, "FDDM mult."}}); + histos.add("FDDM/percentile", "FDDM percentile.", o2::framework::HistType::kTH1D, {{baseOpts.binsPercentileFine, "FDDM percentile"}}); + histos.add("FDDM/percentilevsMult", "FDDM percentile.", o2::framework::HistType::kTH2D, {{baseOpts.binsPercentileFine, "FDDM percentile"}, {baseOpts.binsMultiplicity, "FDDM mult."}}); registerCalibQAHistos(histos, kFDDM, "FDDM"); registerCandidateQAHistos(histos, "FDDM"); } if (baseOpts.mEnabledTables[kNTPV]) { - histos.add("NTPV/percentile", "NTPV percentile.", HistType::kTH1D, {{baseOpts.binsPercentileFine, "NTPV percentile"}}); - histos.add("NTPV/percentilevsMult", "NTPV percentile.", HistType::kTH2D, {{baseOpts.binsPercentileFine, "NTPV percentile"}, {baseOpts.binsMultiplicity, "NTPV mult."}}); + histos.add("NTPV/percentile", "NTPV percentile.", o2::framework::HistType::kTH1D, {{baseOpts.binsPercentileFine, "NTPV percentile"}}); + histos.add("NTPV/percentilevsMult", "NTPV percentile.", o2::framework::HistType::kTH2D, {{baseOpts.binsPercentileFine, "NTPV percentile"}, {baseOpts.binsMultiplicity, "NTPV mult."}}); registerCalibQAHistos(histos, kNTPV, "NTPV"); registerCandidateQAHistos(histos, "NTPV"); } if (baseOpts.mEnabledTables[kNGlobal]) { - histos.add("NGlobal/percentile", "NGlobal percentile.", HistType::kTH1D, {{baseOpts.binsPercentileFine, "NGlobal percentile"}}); - histos.add("NGlobal/percentilevsMult", "NGlobal percentile.", HistType::kTH2D, {{baseOpts.binsPercentileFine, "NGlobal percentile"}, {baseOpts.binsMultiplicity, "NGlobal mult."}}); + histos.add("NGlobal/percentile", "NGlobal percentile.", o2::framework::HistType::kTH1D, {{baseOpts.binsPercentileFine, "NGlobal percentile"}}); + histos.add("NGlobal/percentilevsMult", "NGlobal percentile.", o2::framework::HistType::kTH2D, {{baseOpts.binsPercentileFine, "NGlobal percentile"}, {baseOpts.binsMultiplicity, "NGlobal mult."}}); registerCalibQAHistos(histos, kNGlobal, "NGlobal"); registerCandidateQAHistos(histos, "NGlobal"); } if (baseOpts.mEnabledTables[kMFT]) { - histos.add("MFT/percentile", "MFT percentile.", HistType::kTH1D, {{baseOpts.binsPercentileFine, "MFT percentile"}}); - histos.add("MFT/percentilevsMult", "MFT percentile.", HistType::kTH2D, {{baseOpts.binsPercentileFine, "MFT percentile"}, {baseOpts.binsMultiplicity, "MFT mult."}}); + histos.add("MFT/percentile", "MFT percentile.", o2::framework::HistType::kTH1D, {{baseOpts.binsPercentileFine, "MFT percentile"}}); + histos.add("MFT/percentilevsMult", "MFT percentile.", o2::framework::HistType::kTH2D, {{baseOpts.binsPercentileFine, "MFT percentile"}, {baseOpts.binsMultiplicity, "MFT mult."}}); } LOGF(info, "*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*"); @@ -377,8 +374,7 @@ struct BuilderModule { } template - THist* getHist(const char* name) - { + THist* getHist(const char* name) { if (!this->MCCentralityCalibObjects) { return (THist*)0x0; } @@ -396,18 +392,17 @@ struct BuilderModule { return hist; } - TH1D* extractCentralityCalibration(int idx, const char* name, bool reverse = false) - { + TH1D* extractCentralityCalibration(int idx, const char* name, bool reverse = false) { - auto CalibMC = [&](TString estimator) { + auto CalibMC = [&](TString const& estimator){ LOGF(info, "\e[1;31mCalibration for %s estimator\e[0;00m -> Starting...\n", estimator.Data()); std::vector percentile_center(nCentBins); std::vector epercentile_center(nCentBins); - // Histograms - TH2D* h2dMultVsCent_Data = getHist(Form("h2dMultVsCent%s_Data", estimator.Data())); - TH2D* h2dMultRecoVsMultGen_MC = getHist(Form("hMultEta05VsGenMult%s", estimator.Data())); + //Histograms + TH2D *h2dMultVsCent_Data = getHist(Form("h2dMultVsCent%s_Data", estimator.Data())); + TH2D *h2dMultRecoVsMultGen_MC = getHist(Form("hMultEta05VsGenMult%s", estimator.Data())); if (!h2dMultVsCent_Data || !h2dMultRecoVsMultGen_MC) { return (TH1D*)0x0; } @@ -419,12 +414,12 @@ struct BuilderModule { TProfile* hPVData = hCalibPVData[idx].get(); TProfile* hPVMC = hCalibPVMC[idx].get(); - TH1D* h1dCalib = h2dMultRecoVsMultGen_MC->ProjectionX(Form("h1d%s", estimator.Data()), 1, h2dMultRecoVsMultGen_MC->GetNbinsX()); + TH1D *h1dCalib = h2dMultRecoVsMultGen_MC->ProjectionX(Form("h1d%s", estimator.Data()), 1, h2dMultRecoVsMultGen_MC->GetNbinsX()); h1dCalib->Reset(); h1dCalib->SetTitle(Form("%s calibration object", estimator.Data())); h1dCalib->GetXaxis()->SetTitle(Form("#it{N}_{%s, gen.}", estimator.Data())); h1dCalib->GetYaxis()->SetTitle(Form("%s percentile (%%)", estimator.Data())); - + // NOTE: candidate-by-candidate assignment (assignCentralityPerCandidate) does not go through this // mean-matching path at all. It samples directly from the "hGenMultEta05VsCentrality" // joint histogram (x = reco centrality of the matched MC collision, y = generated mult |eta|<0.5) @@ -433,16 +428,16 @@ struct BuilderModule { if (reverse) { for (int i = 0; i < nCentBins; i++) { int irev = i; - percentile_center[i] = (centralityBins[irev] + centralityBins[irev + 1]) / 2; - epercentile_center[i] = (centralityBins[irev] - centralityBins[irev + 1]) / 2; + percentile_center[i] = (centralityBins[irev] + centralityBins[irev+1]) / 2; + epercentile_center[i] = (centralityBins[irev] - centralityBins[irev+1]) / 2; } int startBinMc = h1dCalib->GetNbinsX(); for (int i = 0; i < nCentBins; i++) { // Loop over centrality bins // start from the end (from the high multiplicity collisions) int irev = i; - TH1D* projData = h2dMultVsCent_Data->ProjectionY(Form("projData_%d", i), h2dMultVsCent_Data->GetXaxis()->FindBin(centralityBins[irev] + 1e-5), - h2dMultVsCent_Data->GetXaxis()->FindBin(centralityBins[irev + 1] - 1e-5)); + TH1D* projData = h2dMultVsCent_Data->ProjectionY(Form("projData_%d", i), h2dMultVsCent_Data->GetXaxis()->FindBin(centralityBins[irev]+1e-5), + h2dMultVsCent_Data->GetXaxis()->FindBin(centralityBins[irev+1]-1e-5)); double meanMult_Data = projData->GetMean(); @@ -468,7 +463,7 @@ struct BuilderModule { endBinMc = j; } } - if (i == nCentBins - 1) { + if (i == nCentBins-1) { endBinMc = 1; } @@ -493,14 +488,14 @@ struct BuilderModule { } } - LOGF(info, "\e[1;31mCalibration for %s estimator\e[0;00m -> Data centrality bin \e[1;31m%g-%g%%\e[0;00m\n", estimator.Data(), centralityBins[irev], centralityBins[irev + 1]); + LOGF(info, "\e[1;31mCalibration for %s estimator\e[0;00m -> Data centrality bin \e[1;31m%g-%g%%\e[0;00m\n", estimator.Data(), centralityBins[irev], centralityBins[irev+1]); LOGF(info, "\e[1;31mCalibration for %s estimator\e[0;00m -> MC multiplicity range %g-%g\n", estimator.Data(), projMC->GetBinLowEdge(endBinMc), projMC->GetBinLowEdge(startBinMc)); - LOGF(info, "\e[1;31mCalibration for %s estimator\e[0;00m -> data = %.4f Vs MC = %.4f (MC/Data = %.4f%%)\n", estimator.Data(), meanMult_Data, meanMult_MC, (meanMult_MC - meanMult_Data) * 100 / meanMult_Data); + LOGF(info, "\e[1;31mCalibration for %s estimator\e[0;00m -> data = %.4f Vs MC = %.4f (MC/Data = %.4f%%)\n", estimator.Data(), meanMult_Data, meanMult_MC, (meanMult_MC-meanMult_Data) * 100 / meanMult_Data); LOGF(info, "\e[1;31mCalibration for %s estimator\e[0;00m -> N entries Data = %g Vs N entries MC = %g\n", estimator.Data(), projData->Integral(), projMC->Integral()); LOGF(info, "\n"); for (int ibin = 1; ibin <= h1dCalib->GetNbinsX(); ibin++) { - if (ibin <= startBinMc && ibin >= endBinMc) { - h1dCalib->SetBinContent(ibin, percentile_center[i]); + if (ibin <= startBinMc && ibin >= endBinMc){ + h1dCalib->SetBinContent(ibin, percentile_center[i]); } } startBinMc = endBinMc; @@ -508,15 +503,15 @@ struct BuilderModule { } else { for (int i = 0; i < nCentBins; i++) { int irev = nCentBins - i; - percentile_center[i] = (centralityBins[irev - 1] + centralityBins[irev]) / 2; - epercentile_center[i] = (centralityBins[irev] - centralityBins[irev - 1]) / 2; + percentile_center[i] = (centralityBins[irev-1] + centralityBins[irev]) / 2; + epercentile_center[i] = (centralityBins[irev] - centralityBins[irev-1]) / 2; } int startBinMc = 1; for (int i = 0; i < nCentBins; i++) { // Loop over centrality bins // start from the end (from the low multiplicity collisions) int irev = nCentBins - i; - TH1D* projData = h2dMultVsCent_Data->ProjectionY(Form("projData_%d", i), h2dMultVsCent_Data->GetXaxis()->FindBin(centralityBins[irev - 1] + 1e-5), - h2dMultVsCent_Data->GetXaxis()->FindBin(centralityBins[irev] - 1e-5)); + TH1D* projData = h2dMultVsCent_Data->ProjectionY(Form("projData_%d", i), h2dMultVsCent_Data->GetXaxis()->FindBin(centralityBins[irev-1]+1e-5), + h2dMultVsCent_Data->GetXaxis()->FindBin(centralityBins[irev]-1e-5)); double meanMult_Data = projData->GetMean(); @@ -542,8 +537,8 @@ struct BuilderModule { endBinMc = j; } } - if (i == nCentBins - 1) { - endBinMc = h2dMultRecoVsMultGen_MC->GetNbinsX(); + if (i == nCentBins-1) { + endBinMc = h2dMultRecoVsMultGen_MC->GetNbinsX(); } TH1D* projMC = h2dMultRecoVsMultGen_MC->ProjectionY(Form("projMC_%d", i), startBinMc, endBinMc); @@ -567,17 +562,17 @@ struct BuilderModule { } } - LOGF(info, "\e[1;31mCalibration for %s estimator\e[0;00m -> Data centrality bin \e[1;31m%g-%g%%\e[0;00m\n", estimator.Data(), centralityBins[irev - 1], centralityBins[irev]); - LOGF(info, "\e[1;31mCalibration for %s estimator\e[0;00m -> MC multiplicity range %g-%g\n", estimator.Data(), projMC->GetBinLowEdge(startBinMc), projMC->GetBinLowEdge(endBinMc + 1)); + LOGF(info, "\e[1;31mCalibration for %s estimator\e[0;00m -> Data centrality bin \e[1;31m%g-%g%%\e[0;00m\n", estimator.Data(), centralityBins[irev-1], centralityBins[irev]); + LOGF(info, "\e[1;31mCalibration for %s estimator\e[0;00m -> MC multiplicity range %g-%g\n", estimator.Data(), projMC->GetBinLowEdge(startBinMc), projMC->GetBinLowEdge(endBinMc+1)); LOGF(info, "\e[1;31mCalibration for %s estimator\e[0;00m -> data = %.4f Vs MC = %.4f\n", estimator.Data(), meanMult_Data, meanMult_MC); LOGF(info, "\e[1;31mCalibration for %s estimator\e[0;00m -> N entries Data = %g Vs N entries MC = %g\n", estimator.Data(), projData->Integral(), projMC->Integral()); for (int ibin = 1; ibin <= h1dCalib->GetNbinsX(); ibin++) { - if (ibin <= endBinMc && ibin >= startBinMc) { - h1dCalib->SetBinContent(ibin, percentile_center[i]); + if (ibin <= endBinMc && ibin >= startBinMc){ + h1dCalib->SetBinContent(ibin, percentile_center[i]); } } - startBinMc = endBinMc + 1; + startBinMc = endBinMc+1; } // End loop over centrality bins } @@ -642,7 +637,7 @@ struct BuilderModule { } template - void fillHistograms(HistogramRegistry& histos, double percentile, double multiplicity, double genMultEta05) + void fillHistograms(o2::framework::HistogramRegistry& histos, double percentile, double multiplicity, double genMultEta05) { histos.fill(HIST(DirList[tableIndex]) + HIST("/percentile"), percentile); histos.fill(HIST(DirList[tableIndex]) + HIST("/percentilevsMult"), percentile, multiplicity); @@ -663,8 +658,8 @@ struct BuilderModule { // which has no systematic effect on the sampled distribution. ULong64_t computeSamplingSeed(int64_t collisionIndex, int tableIdx) const { - static constexpr ULong64_t kCollisionStride = 131ull; // > kNestimators, so tableIdx can't alias into the collision term - static constexpr ULong64_t kRunStride = 1000003ull; // prime, well above kCollisionStride * (typical collisions per DF) + static constexpr ULong64_t kCollisionStride = 131ull; // > kNestimators, so tableIdx can't alias into the collision term + static constexpr ULong64_t kRunStride = 1000003ull; // prime, well above kCollisionStride * (typical collisions per DF) return baseOpts.centralitySamplingSeed.value + kRunStride * static_cast(mRunNumber) + kCollisionStride * static_cast(collisionIndex) + static_cast(tableIdx); } @@ -718,15 +713,15 @@ struct BuilderModule { return percentile; }; - populateTable(products.centFV0A, h1dFV0A, h2dCentVsGenMult[kFV0A], nFV0A, std::integral_constant{}); - populateTable(products.centFT0M, h1dFT0M, h2dCentVsGenMult[kFT0M], nFT0M, std::integral_constant{}); - populateTable(products.centFT0A, h1dFT0A, h2dCentVsGenMult[kFT0A], nFT0A, std::integral_constant{}); - populateTable(products.centFT0C, h1dFT0C, h2dCentVsGenMult[kFT0C], nFT0C, std::integral_constant{}); - populateTable(products.centFT0CVariant1, h1dFT0CVariant1, h2dCentVsGenMult[kFT0CVariant1], nFT0C, std::integral_constant{}); - populateTable(products.centFT0CVariant2, h1dFT0CVariant2, h2dCentVsGenMult[kFT0CVariant2], nFT0C, std::integral_constant{}); - populateTable(products.centFDDM, h1dFDDM, h2dCentVsGenMult[kFDDM], nFDDM, std::integral_constant{}); - populateTable(products.centNTPV, h1dNTPV, h2dCentVsGenMult[kNTPV], nGlobal, std::integral_constant{}); - populateTable(products.centNGlobal, h1dNGlobal, h2dCentVsGenMult[kNGlobal], nGlobal, std::integral_constant{}); + populateTable(products.centFV0A, h1dFV0A, h2dCentVsGenMult[kFV0A], nFV0A, std::integral_constant{}); + populateTable(products.centFT0M, h1dFT0M, h2dCentVsGenMult[kFT0M], nFT0M, std::integral_constant{}); + populateTable(products.centFT0A, h1dFT0A, h2dCentVsGenMult[kFT0A], nFT0A, std::integral_constant{}); + populateTable(products.centFT0C, h1dFT0C, h2dCentVsGenMult[kFT0C], nFT0C, std::integral_constant{}); + populateTable(products.centFT0CVariant1, h1dFT0CVariant1, h2dCentVsGenMult[kFT0CVariant1], nFT0C, std::integral_constant{}); + populateTable(products.centFT0CVariant2, h1dFT0CVariant2, h2dCentVsGenMult[kFT0CVariant2], nFT0C, std::integral_constant{}); + populateTable(products.centFDDM, h1dFDDM, h2dCentVsGenMult[kFDDM], nFDDM, std::integral_constant{}); + populateTable(products.centNTPV, h1dNTPV, h2dCentVsGenMult[kNTPV], nGlobal, std::integral_constant{}); + populateTable(products.centNGlobal, h1dNGlobal, h2dCentVsGenMult[kNGlobal], nGlobal, std::integral_constant{}); // populateTable(products.centMFT, h1dMFT, h2dCentVsGenMult[kMFT], nMFT, std::integral_constant{}); // to be added later mcCollisionCounter++; From 21b131ee789bacce1f58995a75677864c687a459 Mon Sep 17 00:00:00 2001 From: SCHOTTER Romain <47983209+romainschotter@users.noreply.github.com> Date: Wed, 26 Aug 2026 09:51:43 +0200 Subject: [PATCH 24/27] Fix strangederivedbuilder.cxx --- .../Strangeness/strangederivedbuilder.cxx | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx b/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx index 2ea40b55f46..4c40f16e1fe 100644 --- a/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx +++ b/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx @@ -196,15 +196,15 @@ struct strangederivedbuilder { Configurable inheritEvtSelFromTask{"inheritEvtSelFromTask", "propagation-service", "Inherit event selection parameters from which task?"}; Configurable inheritEvtSelFromTaskCfgGroup{"inheritEvtSelFromTaskCfgGroup", "eventSelectOpts", "What is the configurable group prefix? If none, put nothing"}; Configurable inheritEvtSelFromTaskVerbose{"inheritEvtSelFromTaskVerbose", false, "Enable verbose mode on the getTaskOption utility"}; - bool fillOnlySelectedCollisions = false; // Fill only tables for selected collisions? - bool requireTriggerTVX = false; // require FT0 vertex (acceptable FT0C-FT0A time difference) at trigger level (Run 3 only) - bool rejectITSROFBorder = false; // reject events at ITS ROF border (Run 3 only) - bool rejectTFBorder = false; // reject events at TF border (Run 3 only) - bool rejectSameBunchPileup = false; // reject collisions in case of pileup with another collision in the same foundBC (Run 3 only) - float maxZVtxPosition = 10.; // max Z vtx position (cm) - bool cfgApplyRCTrequirement = false; // Apply RCT requirement? - std::string cfgRCTLabel = ""; // Which detector condition requirements? (CBT, CBT_hadronPID, CBT_electronPID, CBT_calo, CBT_muon, CBT_muon_glo) - bool cfgCheckZDC = false; // Include ZDC flags in the bit selection (for Pb-Pb only) + bool fillOnlySelectedCollisions = false; // Fill only tables for selected collisions? + bool requireTriggerTVX = false; // require FT0 vertex (acceptable FT0C-FT0A time difference) at trigger level (Run 3 only) + bool rejectITSROFBorder = false; // reject events at ITS ROF border (Run 3 only) + bool rejectTFBorder = false; // reject events at TF border (Run 3 only) + bool rejectSameBunchPileup = false; // reject collisions in case of pileup with another collision in the same foundBC (Run 3 only) + float maxZVtxPosition = 10.; // max Z vtx position (cm) + bool cfgApplyRCTrequirement = false; // Apply RCT requirement? + std::string cfgRCTLabel = ""; // Which detector condition requirements? (CBT, CBT_hadronPID, CBT_electronPID, CBT_calo, CBT_muon, CBT_muon_glo) + bool cfgCheckZDC = false; // Include ZDC flags in the bit selection (for Pb-Pb only) bool cfgTreatLimitedAcceptanceAsBad = false; // reject all events where the detectors relevant for the specified Runlist are flagged as LimitedAcceptance o2::aod::rctsel::RCTFlagsChecker rctFlagsChecker; @@ -280,7 +280,7 @@ struct strangederivedbuilder { } template - void getCfg(o2::framework::InitContext& initContext, const std::string name, VType& v, const std::string task) + void getCfg(o2::framework::InitContext& initContext, const std::string& name, VType& v, const std::string task) { if (!o2::common::core::getTaskOptionValue(initContext, task, name, v, inheritEvtSelFromTaskVerbose)) { LOG(fatal) << "Could not get " << name << " from " << task << " task"; @@ -488,8 +488,8 @@ struct strangederivedbuilder { LOG(info) << "Reject same bunch pile-up..........: " << (rejectSameBunchPileup ? "yes" : "no"); LOG(info) << "Apply RCT requirement..............: " << (cfgApplyRCTrequirement ? "yes" : "no"); LOG(info) << "RCT requirement....................: " << cfgRCTLabel; - LOG(info) << "Check ZDC in RCT requirement.......: " << (cfgCheckZDC? "yes" : "no"); - LOG(info) << "Treat limited acceptance as bad....: " << (cfgCheckZDC? "yes" : "no"); + LOG(info) << "Check ZDC in RCT requirement.......: " << (cfgCheckZDC ? "yes" : "no"); + LOG(info) << "Treat limited acceptance as bad....: " << (cfgCheckZDC ? "yes" : "no"); LOG(info) << "================================================================="; // setup map for fast checking if enabled @@ -727,7 +727,7 @@ struct strangederivedbuilder { totalFDDAmplitudeA, totalFDDAmplitudeC, timeZNA, timeZNC, // ZDC info energyCommonZNA, energyCommonZNC); - } else { // We are in Run 2 + } else { // We are in Run 2 products.strangeCentsRun2(collision.centRun2V0M(), collision.centRun2V0A(), collision.centRun2SPDTracklets(), collision.centRun2SPDClusters()); products.strangeEvSelsRun2(collision.sel8(), collision.sel7(), collision.selection_raw(), @@ -780,13 +780,13 @@ struct strangederivedbuilder { for (const auto& casc : TraCascades) { products.tracasccollref(TraCascadeCollIndices[casc.globalIndex()]); } - products.straSelection(totalNbrCollisions, totalNbrSelectedCollisions, - totalNbrCollisionsPerSelection[o2::aod::straselections::kIsTriggerTVX], - totalNbrCollisionsPerSelection[o2::aod::straselections::kNoITSROFrameBorder], - totalNbrCollisionsPerSelection[o2::aod::straselections::kNoTimeFrameBorder], - totalNbrCollisionsPerSelection[o2::aod::straselections::kIsGoodZvtxAcceptance], - totalNbrCollisionsPerSelection[o2::aod::straselections::kNoSameBunchPileup], - totalNbrCollisionsPerSelection[o2::aod::straselections::kIsGoodRCT]); + products.straSelection(totalNbrCollisions, totalNbrSelectedCollisions, + totalNbrCollisionsPerSelection[o2::aod::straselections::kIsTriggerTVX], + totalNbrCollisionsPerSelection[o2::aod::straselections::kNoITSROFrameBorder], + totalNbrCollisionsPerSelection[o2::aod::straselections::kNoTimeFrameBorder], + totalNbrCollisionsPerSelection[o2::aod::straselections::kIsGoodZvtxAcceptance], + totalNbrCollisionsPerSelection[o2::aod::straselections::kNoSameBunchPileup], + totalNbrCollisionsPerSelection[o2::aod::straselections::kIsGoodRCT]); } // helper function to estimate collision time @@ -811,7 +811,7 @@ struct strangederivedbuilder { collisionEventTime[collision.globalIndex()] /= static_cast(collisionNtracks[collision.globalIndex()]); collisionEventTimeErr[collision.globalIndex()] /= static_cast(collisionNtracks[collision.globalIndex()]); } else { - collisionEventTime[collision.globalIndex()] = -1e+6; // undefined + collisionEventTime[collision.globalIndex()] = -1e+6; // undefined collisionEventTimeErr[collision.globalIndex()] = -1e-6; // undefined } if (fillOnlySelectedCollisions && !isCollisionAccepted(collision, totalNbrCollisionsPerSelection)) { From a137dcd27854fe8db21ccc2f9aedeb51837ef64a Mon Sep 17 00:00:00 2001 From: SCHOTTER Romain <47983209+romainschotter@users.noreply.github.com> Date: Wed, 26 Aug 2026 09:52:31 +0200 Subject: [PATCH 25/27] Address cpp code check in derivedlambdakzeroanalysis --- .../derivedlambdakzeroanalysis.cxx | 72 +++++++++---------- 1 file changed, 33 insertions(+), 39 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx b/PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx index 82c6ea33693..ee1049f4fc4 100644 --- a/PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx +++ b/PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx @@ -103,7 +103,7 @@ enum CentEstimator { struct derivedlambdakzeroanalysis { HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; - bool isRun3; + bool isRun3 = true; // master analysis switches Configurable analyseK0Short{"analyseK0Short", true, "process K0Short-like candidates"}; @@ -313,8 +313,8 @@ struct derivedlambdakzeroanalysis { o2::ccdb::CcdbApi ccdbApi; Service ccdb; ctpRateFetcher rateFetcher; - int mRunNumber; - float magField; + int mRunNumber = 0.; + float magField = 0.; std::map metadata; o2::parameters::GRPMagField* grpmag = nullptr; @@ -439,24 +439,24 @@ struct derivedlambdakzeroanalysis { selPhysPrimAntiLambda, // for mc tagging }; - uint64_t maskTopological; - uint64_t maskTopoNoV0Radius; - uint64_t maskTopoNoDCANegToPV; - uint64_t maskTopoNoDCAPosToPV; - uint64_t maskTopoNoCosPA; - uint64_t maskTopoNoDCAV0Dau; - uint64_t maskTrackProperties; + uint64_t maskTopological = 0; + uint64_t maskTopoNoV0Radius = 0; + uint64_t maskTopoNoDCANegToPV = 0; + uint64_t maskTopoNoDCAPosToPV = 0; + uint64_t maskTopoNoCosPA = 0; + uint64_t maskTopoNoDCAV0Dau = 0; + uint64_t maskTrackProperties = 0; - uint64_t maskK0ShortSpecific; - uint64_t maskLambdaSpecific; - uint64_t maskAntiLambdaSpecific; + uint64_t maskK0ShortSpecific = 0; + uint64_t maskLambdaSpecific = 0; + uint64_t maskAntiLambdaSpecific = 0; - uint64_t maskSelectionK0Short; - uint64_t maskSelectionLambda; - uint64_t maskSelectionAntiLambda; + uint64_t maskSelectionK0Short = 0; + uint64_t maskSelectionLambda = 0; + uint64_t maskSelectionAntiLambda = 0; - uint64_t secondaryMaskSelectionLambda; - uint64_t secondaryMaskSelectionAntiLambda; + uint64_t secondaryMaskSelectionLambda = 0; + uint64_t secondaryMaskSelectionAntiLambda = 0; void init(InitContext const&) { @@ -1227,7 +1227,7 @@ struct derivedlambdakzeroanalysis { histos.add("h2dGenXiPlusVsMcCentrality_RecoedEvt", "h2dGenXiPlusVsMcCentrality_RecoedEvt", kTH2D, {axisConfigurations.axisCentralityFine, axisConfigurations.axisPt}); histos.add("h2dGenOmegaMinusVsMcCentrality_RecoedEvt", "h2dGenOmegaMinusVsMcCentrality_RecoedEvt", kTH2D, {axisConfigurations.axisCentralityFine, axisConfigurations.axisPt}); histos.add("h2dGenOmegaPlusVsMcCentrality_RecoedEvt", "h2dGenOmegaPlusVsMcCentrality_RecoedEvt", kTH2D, {axisConfigurations.axisCentralityFine, axisConfigurations.axisPt}); - + histos.add("h2dGenK0ShortVsMcCentrality", "h2dGenK0ShortVsMcCentrality", kTH2D, {axisConfigurations.axisCentralityFine, axisConfigurations.axisPt}); histos.add("h2dGenLambdaVsMcCentrality", "h2dGenLambdaVsMcCentrality", kTH2D, {axisConfigurations.axisCentralityFine, axisConfigurations.axisPt}); histos.add("h2dGenAntiLambdaVsMcCentrality", "h2dGenAntiLambdaVsMcCentrality", kTH2D, {axisConfigurations.axisCentralityFine, axisConfigurations.axisPt}); @@ -1243,7 +1243,7 @@ struct derivedlambdakzeroanalysis { histos.add("h2dGenXiPlusVsMultMC_RecoedEvt", "h2dGenXiPlusVsMultMC_RecoedEvt", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisPt}); histos.add("h2dGenOmegaMinusVsMultMC_RecoedEvt", "h2dGenOmegaMinusVsMultMC_RecoedEvt", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisPt}); histos.add("h2dGenOmegaPlusVsMultMC_RecoedEvt", "h2dGenOmegaPlusVsMultMC_RecoedEvt", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisPt}); - + histos.add("h2dGenK0ShortVsMultMC", "h2dGenK0ShortVsMultMC", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisPt}); histos.add("h2dGenLambdaVsMultMC", "h2dGenLambdaVsMultMC", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisPt}); histos.add("h2dGenAntiLambdaVsMultMC", "h2dGenAntiLambdaVsMultMC", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisPt}); @@ -1300,19 +1300,13 @@ struct derivedlambdakzeroanalysis { // Helper lambda to extract centrality from any object exposing the cent* columns auto extractCentrality = [this](auto const& coll) -> float { switch (centralityEstimator) { - case kCentFT0C: - return coll.centFT0C(); - case kCentFT0M: - return coll.centFT0M(); - case kCentFT0CVariant1: - return coll.centFT0CVariant1(); + case kCentFT0C: return coll.centFT0C(); + case kCentFT0M: return coll.centFT0M(); + case kCentFT0CVariant1: return coll.centFT0CVariant1(); // case kCentMFT: return coll.centMFT(); - case kCentNGlobal: - return coll.centNGlobal(); - case kCentFV0A: - return coll.centFV0A(); - default: - return -1.f; + case kCentNGlobal: return coll.centNGlobal(); + case kCentFV0A: return coll.centFV0A(); + default: return -1.f; } }; @@ -1346,7 +1340,7 @@ struct derivedlambdakzeroanalysis { } template - void initCCDB(TCollision collision) + void initCCDB(TCollision const& collision) { if (mRunNumber == collision.runNumber()) { return; @@ -1407,7 +1401,7 @@ struct derivedlambdakzeroanalysis { } template - uint64_t computeReconstructionBitmap(TV0 v0, TCollision collision, float rapidityLambda, float rapidityK0Short, float /*pT*/) + uint64_t computeReconstructionBitmap(TV0 const& v0, TCollision const& collision, float rapidityLambda, float rapidityK0Short, float /*pT*/) // precalculate this information so that a check is one mask operation, not many { uint64_t bitMap = 0; @@ -1670,7 +1664,7 @@ struct derivedlambdakzeroanalysis { } template - uint64_t computeMCAssociation(TV0 v0) + uint64_t computeMCAssociation(TV0 const& v0) // precalculate this information so that a check is one mask operation, not many { uint64_t bitMap = 0; @@ -1853,7 +1847,7 @@ struct derivedlambdakzeroanalysis { } template - void analyseCandidate(TV0 v0, float pt, float centrality, uint64_t selMap, uint8_t gapSide, int& nK0Shorts, int& nLambdas, int& nAntiLambdas) + void analyseCandidate(TV0 const& v0, float pt, float centrality, uint64_t selMap, uint8_t gapSide, int& nK0Shorts, int& nLambdas, int& nAntiLambdas) // precalculate this information so that a check is one mask operation, not many { bool passK0ShortSelections = false; @@ -2256,7 +2250,7 @@ struct derivedlambdakzeroanalysis { } template - void analyseCollisionAssociation(TV0 /*v0*/, float pt, int mcNch, bool correctAssociation, uint64_t selMap) + void analyseCollisionAssociation(TV0 const&/*v0*/, float pt, int mcNch, bool correctAssociation, uint64_t selMap) // analyse collision association { // __________________________________________ @@ -2279,7 +2273,7 @@ struct derivedlambdakzeroanalysis { } template - void fillFeeddownMatrix(TV0 v0, float pt, float centrality, uint64_t selMap) + void fillFeeddownMatrix(TV0 const& v0, float pt, float centrality, uint64_t selMap) // fill feeddown matrix for Lambdas or AntiLambdas // fixme: a potential improvement would be to consider mass windows for the l/al { @@ -2333,7 +2327,7 @@ struct derivedlambdakzeroanalysis { } template - bool isEventAccepted(TCollision collision, bool fillHists) + bool isEventAccepted(TCollision const& collision, bool fillHists) // check whether the collision passes our collision selections { float centrality = -1.0f; From f4de14bcbd267f244a2bd96f0304ffca197508dc Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Wed, 26 Aug 2026 07:52:42 +0000 Subject: [PATCH 26/27] Please consider the following formatting changes --- .../Strangeness/strangederivedbuilder.cxx | 5 +- PWGLF/Utils/mcCentralityModule.h | 145 +++++++++--------- 2 files changed, 75 insertions(+), 75 deletions(-) diff --git a/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx b/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx index 4c40f16e1fe..0c07172d25d 100644 --- a/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx +++ b/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx @@ -25,6 +25,8 @@ #include "PWGLF/DataModel/SPCalibrationTables.h" #include "PWGUD/DataModel/UDTables.h" +#include "Common/CCDB/EventSelectionParams.h" +#include "Common/CCDB/RCTSelectionFlags.h" #include "Common/DataModel/Centrality.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/McCollisionExtra.h" @@ -33,8 +35,6 @@ #include "Common/DataModel/PIDResponseTPC.h" #include "Common/DataModel/Qvectors.h" #include "Common/DataModel/TrackSelectionTables.h" -#include "Common/CCDB/EventSelectionParams.h" -#include "Common/CCDB/RCTSelectionFlags.h" #include #include @@ -468,7 +468,6 @@ struct strangederivedbuilder { eventSelectOptsPrefix += "."; } - getCfg(initContext, eventSelectOptsPrefix + "fillOnlySelectedCollisions", fillOnlySelectedCollisions, inheritEvtSelFromTask); getCfg(initContext, eventSelectOptsPrefix + "requireTriggerTVX", requireTriggerTVX, inheritEvtSelFromTask); getCfg(initContext, eventSelectOptsPrefix + "rejectITSROFBorder", rejectITSROFBorder, inheritEvtSelFromTask); diff --git a/PWGLF/Utils/mcCentralityModule.h b/PWGLF/Utils/mcCentralityModule.h index 233fa50a1dd..cf2b9de0a3a 100644 --- a/PWGLF/Utils/mcCentralityModule.h +++ b/PWGLF/Utils/mcCentralityModule.h @@ -23,10 +23,10 @@ #include #include #include -#include #include -#include +#include #include +#include #include #include #include @@ -36,14 +36,15 @@ #include #include #include -#include #include +#include + #include #include +#include #include #include -#include #include #include #include @@ -62,17 +63,16 @@ namespace mccentrality // avoid polluting other namespaces // statics necessary for the configurables in this namespace static constexpr int nParameters = 1; static const std::vector tableNames{ - "McCentFV0As", - "McCentFT0Ms", - "McCentFT0As", - "McCentFT0Cs", - "McCentFT0CVariant1s", - "McCentFT0CVariant2s", - "McCentFDDMs", - "McCentNTPVs", - "McCentNGlobals", - "McCentMFTs" -}; + "McCentFV0As", + "McCentFT0Ms", + "McCentFT0As", + "McCentFT0Cs", + "McCentFT0CVariant1s", + "McCentFT0CVariant2s", + "McCentFDDMs", + "McCentNTPVs", + "McCentNGlobals", + "McCentMFTs"}; static constexpr int nTablesConst = 10; static const std::vector parameterNames{"enable"}; @@ -99,20 +99,19 @@ enum tableIndex { kFV0A = 0, kNTPV, kNGlobal, kMFT, - kNestimators}; + kNestimators }; static constexpr const char* DirList[] = { - "FV0A", - "FT0M", - "FT0A", - "FT0C", - "FT0CVariant1", - "FT0CVariant2", - "FDDM", - "NTPV", - "NGlobal", - "MFT" -}; + "FV0A", + "FT0M", + "FT0A", + "FT0C", + "FT0CVariant1", + "FT0CVariant2", + "FDDM", + "NTPV", + "NGlobal", + "MFT"}; // mcCentralityModule: 1st-order configurables struct coreConfigurables : o2::framework::ConfigurableGroup { @@ -132,7 +131,7 @@ struct coreConfigurables : o2::framework::ConfigurableGroup { o2::framework::ConfigurableAxis binsPercentileFine{"binsPercentileFine", {o2::framework::VARIABLE_WIDTH, 0, 0.001, 0.01, 1.0, 5.0, 10.0, 15.0, 20.0, 25.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0}, "Binning of the percentile axis"}; o2::framework::ConfigurableAxis binsMultiplicity{"binsMultiplicity", {1000, 0, 5000}, "Binning of the multiplicity axis"}; - //ccdb configurables + // ccdb configurables o2::framework::Configurable path{"path", "/tmp/InputCalibMC.root", "path to calib file or ccdb path if begins with ccdb://"}; // debug option @@ -155,11 +154,11 @@ struct products : o2::framework::ProducesGroup { template concept HasMcMults = requires(typename T::iterator a) { - { a.multMCFT0A() } -> std::convertible_to; - { a.multMCFT0C() } -> std::convertible_to; - { a.multMCFV0A() } -> std::convertible_to; - { a.multMCFDDA() } -> std::convertible_to; - { a.multMCFDDC() } -> std::convertible_to; + { a.multMCFT0A() } -> std::convertible_to; + { a.multMCFT0C() } -> std::convertible_to; + { a.multMCFV0A() } -> std::convertible_to; + { a.multMCFDDA() } -> std::convertible_to; + { a.multMCFDDC() } -> std::convertible_to; { a.multMCNParticlesEta08() } -> std::convertible_to; { a.multMCNParticlesEta05() } -> std::convertible_to; }; @@ -374,7 +373,8 @@ struct BuilderModule { } template - THist* getHist(const char* name) { + THist* getHist(const char* name) + { if (!this->MCCentralityCalibObjects) { return (THist*)0x0; } @@ -392,17 +392,18 @@ struct BuilderModule { return hist; } - TH1D* extractCentralityCalibration(int idx, const char* name, bool reverse = false) { + TH1D* extractCentralityCalibration(int idx, const char* name, bool reverse = false) + { - auto CalibMC = [&](TString const& estimator){ + auto CalibMC = [&](TString const& estimator) { LOGF(info, "\e[1;31mCalibration for %s estimator\e[0;00m -> Starting...\n", estimator.Data()); std::vector percentile_center(nCentBins); std::vector epercentile_center(nCentBins); - //Histograms - TH2D *h2dMultVsCent_Data = getHist(Form("h2dMultVsCent%s_Data", estimator.Data())); - TH2D *h2dMultRecoVsMultGen_MC = getHist(Form("hMultEta05VsGenMult%s", estimator.Data())); + // Histograms + TH2D* h2dMultVsCent_Data = getHist(Form("h2dMultVsCent%s_Data", estimator.Data())); + TH2D* h2dMultRecoVsMultGen_MC = getHist(Form("hMultEta05VsGenMult%s", estimator.Data())); if (!h2dMultVsCent_Data || !h2dMultRecoVsMultGen_MC) { return (TH1D*)0x0; } @@ -414,12 +415,12 @@ struct BuilderModule { TProfile* hPVData = hCalibPVData[idx].get(); TProfile* hPVMC = hCalibPVMC[idx].get(); - TH1D *h1dCalib = h2dMultRecoVsMultGen_MC->ProjectionX(Form("h1d%s", estimator.Data()), 1, h2dMultRecoVsMultGen_MC->GetNbinsX()); + TH1D* h1dCalib = h2dMultRecoVsMultGen_MC->ProjectionX(Form("h1d%s", estimator.Data()), 1, h2dMultRecoVsMultGen_MC->GetNbinsX()); h1dCalib->Reset(); h1dCalib->SetTitle(Form("%s calibration object", estimator.Data())); h1dCalib->GetXaxis()->SetTitle(Form("#it{N}_{%s, gen.}", estimator.Data())); h1dCalib->GetYaxis()->SetTitle(Form("%s percentile (%%)", estimator.Data())); - + // NOTE: candidate-by-candidate assignment (assignCentralityPerCandidate) does not go through this // mean-matching path at all. It samples directly from the "hGenMultEta05VsCentrality" // joint histogram (x = reco centrality of the matched MC collision, y = generated mult |eta|<0.5) @@ -428,16 +429,16 @@ struct BuilderModule { if (reverse) { for (int i = 0; i < nCentBins; i++) { int irev = i; - percentile_center[i] = (centralityBins[irev] + centralityBins[irev+1]) / 2; - epercentile_center[i] = (centralityBins[irev] - centralityBins[irev+1]) / 2; + percentile_center[i] = (centralityBins[irev] + centralityBins[irev + 1]) / 2; + epercentile_center[i] = (centralityBins[irev] - centralityBins[irev + 1]) / 2; } int startBinMc = h1dCalib->GetNbinsX(); for (int i = 0; i < nCentBins; i++) { // Loop over centrality bins // start from the end (from the high multiplicity collisions) int irev = i; - TH1D* projData = h2dMultVsCent_Data->ProjectionY(Form("projData_%d", i), h2dMultVsCent_Data->GetXaxis()->FindBin(centralityBins[irev]+1e-5), - h2dMultVsCent_Data->GetXaxis()->FindBin(centralityBins[irev+1]-1e-5)); + TH1D* projData = h2dMultVsCent_Data->ProjectionY(Form("projData_%d", i), h2dMultVsCent_Data->GetXaxis()->FindBin(centralityBins[irev] + 1e-5), + h2dMultVsCent_Data->GetXaxis()->FindBin(centralityBins[irev + 1] - 1e-5)); double meanMult_Data = projData->GetMean(); @@ -463,7 +464,7 @@ struct BuilderModule { endBinMc = j; } } - if (i == nCentBins-1) { + if (i == nCentBins - 1) { endBinMc = 1; } @@ -488,14 +489,14 @@ struct BuilderModule { } } - LOGF(info, "\e[1;31mCalibration for %s estimator\e[0;00m -> Data centrality bin \e[1;31m%g-%g%%\e[0;00m\n", estimator.Data(), centralityBins[irev], centralityBins[irev+1]); + LOGF(info, "\e[1;31mCalibration for %s estimator\e[0;00m -> Data centrality bin \e[1;31m%g-%g%%\e[0;00m\n", estimator.Data(), centralityBins[irev], centralityBins[irev + 1]); LOGF(info, "\e[1;31mCalibration for %s estimator\e[0;00m -> MC multiplicity range %g-%g\n", estimator.Data(), projMC->GetBinLowEdge(endBinMc), projMC->GetBinLowEdge(startBinMc)); - LOGF(info, "\e[1;31mCalibration for %s estimator\e[0;00m -> data = %.4f Vs MC = %.4f (MC/Data = %.4f%%)\n", estimator.Data(), meanMult_Data, meanMult_MC, (meanMult_MC-meanMult_Data) * 100 / meanMult_Data); + LOGF(info, "\e[1;31mCalibration for %s estimator\e[0;00m -> data = %.4f Vs MC = %.4f (MC/Data = %.4f%%)\n", estimator.Data(), meanMult_Data, meanMult_MC, (meanMult_MC - meanMult_Data) * 100 / meanMult_Data); LOGF(info, "\e[1;31mCalibration for %s estimator\e[0;00m -> N entries Data = %g Vs N entries MC = %g\n", estimator.Data(), projData->Integral(), projMC->Integral()); LOGF(info, "\n"); for (int ibin = 1; ibin <= h1dCalib->GetNbinsX(); ibin++) { - if (ibin <= startBinMc && ibin >= endBinMc){ - h1dCalib->SetBinContent(ibin, percentile_center[i]); + if (ibin <= startBinMc && ibin >= endBinMc) { + h1dCalib->SetBinContent(ibin, percentile_center[i]); } } startBinMc = endBinMc; @@ -503,15 +504,15 @@ struct BuilderModule { } else { for (int i = 0; i < nCentBins; i++) { int irev = nCentBins - i; - percentile_center[i] = (centralityBins[irev-1] + centralityBins[irev]) / 2; - epercentile_center[i] = (centralityBins[irev] - centralityBins[irev-1]) / 2; + percentile_center[i] = (centralityBins[irev - 1] + centralityBins[irev]) / 2; + epercentile_center[i] = (centralityBins[irev] - centralityBins[irev - 1]) / 2; } int startBinMc = 1; for (int i = 0; i < nCentBins; i++) { // Loop over centrality bins // start from the end (from the low multiplicity collisions) int irev = nCentBins - i; - TH1D* projData = h2dMultVsCent_Data->ProjectionY(Form("projData_%d", i), h2dMultVsCent_Data->GetXaxis()->FindBin(centralityBins[irev-1]+1e-5), - h2dMultVsCent_Data->GetXaxis()->FindBin(centralityBins[irev]-1e-5)); + TH1D* projData = h2dMultVsCent_Data->ProjectionY(Form("projData_%d", i), h2dMultVsCent_Data->GetXaxis()->FindBin(centralityBins[irev - 1] + 1e-5), + h2dMultVsCent_Data->GetXaxis()->FindBin(centralityBins[irev] - 1e-5)); double meanMult_Data = projData->GetMean(); @@ -537,8 +538,8 @@ struct BuilderModule { endBinMc = j; } } - if (i == nCentBins-1) { - endBinMc = h2dMultRecoVsMultGen_MC->GetNbinsX(); + if (i == nCentBins - 1) { + endBinMc = h2dMultRecoVsMultGen_MC->GetNbinsX(); } TH1D* projMC = h2dMultRecoVsMultGen_MC->ProjectionY(Form("projMC_%d", i), startBinMc, endBinMc); @@ -562,17 +563,17 @@ struct BuilderModule { } } - LOGF(info, "\e[1;31mCalibration for %s estimator\e[0;00m -> Data centrality bin \e[1;31m%g-%g%%\e[0;00m\n", estimator.Data(), centralityBins[irev-1], centralityBins[irev]); - LOGF(info, "\e[1;31mCalibration for %s estimator\e[0;00m -> MC multiplicity range %g-%g\n", estimator.Data(), projMC->GetBinLowEdge(startBinMc), projMC->GetBinLowEdge(endBinMc+1)); + LOGF(info, "\e[1;31mCalibration for %s estimator\e[0;00m -> Data centrality bin \e[1;31m%g-%g%%\e[0;00m\n", estimator.Data(), centralityBins[irev - 1], centralityBins[irev]); + LOGF(info, "\e[1;31mCalibration for %s estimator\e[0;00m -> MC multiplicity range %g-%g\n", estimator.Data(), projMC->GetBinLowEdge(startBinMc), projMC->GetBinLowEdge(endBinMc + 1)); LOGF(info, "\e[1;31mCalibration for %s estimator\e[0;00m -> data = %.4f Vs MC = %.4f\n", estimator.Data(), meanMult_Data, meanMult_MC); LOGF(info, "\e[1;31mCalibration for %s estimator\e[0;00m -> N entries Data = %g Vs N entries MC = %g\n", estimator.Data(), projData->Integral(), projMC->Integral()); for (int ibin = 1; ibin <= h1dCalib->GetNbinsX(); ibin++) { - if (ibin <= endBinMc && ibin >= startBinMc){ - h1dCalib->SetBinContent(ibin, percentile_center[i]); + if (ibin <= endBinMc && ibin >= startBinMc) { + h1dCalib->SetBinContent(ibin, percentile_center[i]); } } - startBinMc = endBinMc+1; + startBinMc = endBinMc + 1; } // End loop over centrality bins } @@ -658,8 +659,8 @@ struct BuilderModule { // which has no systematic effect on the sampled distribution. ULong64_t computeSamplingSeed(int64_t collisionIndex, int tableIdx) const { - static constexpr ULong64_t kCollisionStride = 131ull; // > kNestimators, so tableIdx can't alias into the collision term - static constexpr ULong64_t kRunStride = 1000003ull; // prime, well above kCollisionStride * (typical collisions per DF) + static constexpr ULong64_t kCollisionStride = 131ull; // > kNestimators, so tableIdx can't alias into the collision term + static constexpr ULong64_t kRunStride = 1000003ull; // prime, well above kCollisionStride * (typical collisions per DF) return baseOpts.centralitySamplingSeed.value + kRunStride * static_cast(mRunNumber) + kCollisionStride * static_cast(collisionIndex) + static_cast(tableIdx); } @@ -713,15 +714,15 @@ struct BuilderModule { return percentile; }; - populateTable(products.centFV0A, h1dFV0A, h2dCentVsGenMult[kFV0A], nFV0A, std::integral_constant{}); - populateTable(products.centFT0M, h1dFT0M, h2dCentVsGenMult[kFT0M], nFT0M, std::integral_constant{}); - populateTable(products.centFT0A, h1dFT0A, h2dCentVsGenMult[kFT0A], nFT0A, std::integral_constant{}); - populateTable(products.centFT0C, h1dFT0C, h2dCentVsGenMult[kFT0C], nFT0C, std::integral_constant{}); - populateTable(products.centFT0CVariant1, h1dFT0CVariant1, h2dCentVsGenMult[kFT0CVariant1], nFT0C, std::integral_constant{}); - populateTable(products.centFT0CVariant2, h1dFT0CVariant2, h2dCentVsGenMult[kFT0CVariant2], nFT0C, std::integral_constant{}); - populateTable(products.centFDDM, h1dFDDM, h2dCentVsGenMult[kFDDM], nFDDM, std::integral_constant{}); - populateTable(products.centNTPV, h1dNTPV, h2dCentVsGenMult[kNTPV], nGlobal, std::integral_constant{}); - populateTable(products.centNGlobal, h1dNGlobal, h2dCentVsGenMult[kNGlobal], nGlobal, std::integral_constant{}); + populateTable(products.centFV0A, h1dFV0A, h2dCentVsGenMult[kFV0A], nFV0A, std::integral_constant{}); + populateTable(products.centFT0M, h1dFT0M, h2dCentVsGenMult[kFT0M], nFT0M, std::integral_constant{}); + populateTable(products.centFT0A, h1dFT0A, h2dCentVsGenMult[kFT0A], nFT0A, std::integral_constant{}); + populateTable(products.centFT0C, h1dFT0C, h2dCentVsGenMult[kFT0C], nFT0C, std::integral_constant{}); + populateTable(products.centFT0CVariant1, h1dFT0CVariant1, h2dCentVsGenMult[kFT0CVariant1], nFT0C, std::integral_constant{}); + populateTable(products.centFT0CVariant2, h1dFT0CVariant2, h2dCentVsGenMult[kFT0CVariant2], nFT0C, std::integral_constant{}); + populateTable(products.centFDDM, h1dFDDM, h2dCentVsGenMult[kFDDM], nFDDM, std::integral_constant{}); + populateTable(products.centNTPV, h1dNTPV, h2dCentVsGenMult[kNTPV], nGlobal, std::integral_constant{}); + populateTable(products.centNGlobal, h1dNGlobal, h2dCentVsGenMult[kNGlobal], nGlobal, std::integral_constant{}); // populateTable(products.centMFT, h1dMFT, h2dCentVsGenMult[kMFT], nMFT, std::integral_constant{}); // to be added later mcCollisionCounter++; From f037e34ae86cbb60ba5416aebfbcef73e574ff9f Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Wed, 26 Aug 2026 07:53:22 +0000 Subject: [PATCH 27/27] Please consider the following formatting changes --- .../Strangeness/strangederivedbuilder.cxx | 5 +- .../derivedlambdakzeroanalysis.cxx | 26 ++-- PWGLF/Utils/mcCentralityModule.h | 145 +++++++++--------- 3 files changed, 91 insertions(+), 85 deletions(-) diff --git a/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx b/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx index 4c40f16e1fe..0c07172d25d 100644 --- a/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx +++ b/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx @@ -25,6 +25,8 @@ #include "PWGLF/DataModel/SPCalibrationTables.h" #include "PWGUD/DataModel/UDTables.h" +#include "Common/CCDB/EventSelectionParams.h" +#include "Common/CCDB/RCTSelectionFlags.h" #include "Common/DataModel/Centrality.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/McCollisionExtra.h" @@ -33,8 +35,6 @@ #include "Common/DataModel/PIDResponseTPC.h" #include "Common/DataModel/Qvectors.h" #include "Common/DataModel/TrackSelectionTables.h" -#include "Common/CCDB/EventSelectionParams.h" -#include "Common/CCDB/RCTSelectionFlags.h" #include #include @@ -468,7 +468,6 @@ struct strangederivedbuilder { eventSelectOptsPrefix += "."; } - getCfg(initContext, eventSelectOptsPrefix + "fillOnlySelectedCollisions", fillOnlySelectedCollisions, inheritEvtSelFromTask); getCfg(initContext, eventSelectOptsPrefix + "requireTriggerTVX", requireTriggerTVX, inheritEvtSelFromTask); getCfg(initContext, eventSelectOptsPrefix + "rejectITSROFBorder", rejectITSROFBorder, inheritEvtSelFromTask); diff --git a/PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx b/PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx index ee1049f4fc4..aa35412c7f4 100644 --- a/PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx +++ b/PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx @@ -440,7 +440,7 @@ struct derivedlambdakzeroanalysis { }; uint64_t maskTopological = 0; - uint64_t maskTopoNoV0Radius = 0; + uint64_t maskTopoNoV0Radius = 0; uint64_t maskTopoNoDCANegToPV = 0; uint64_t maskTopoNoDCAPosToPV = 0; uint64_t maskTopoNoCosPA = 0; @@ -1227,7 +1227,7 @@ struct derivedlambdakzeroanalysis { histos.add("h2dGenXiPlusVsMcCentrality_RecoedEvt", "h2dGenXiPlusVsMcCentrality_RecoedEvt", kTH2D, {axisConfigurations.axisCentralityFine, axisConfigurations.axisPt}); histos.add("h2dGenOmegaMinusVsMcCentrality_RecoedEvt", "h2dGenOmegaMinusVsMcCentrality_RecoedEvt", kTH2D, {axisConfigurations.axisCentralityFine, axisConfigurations.axisPt}); histos.add("h2dGenOmegaPlusVsMcCentrality_RecoedEvt", "h2dGenOmegaPlusVsMcCentrality_RecoedEvt", kTH2D, {axisConfigurations.axisCentralityFine, axisConfigurations.axisPt}); - + histos.add("h2dGenK0ShortVsMcCentrality", "h2dGenK0ShortVsMcCentrality", kTH2D, {axisConfigurations.axisCentralityFine, axisConfigurations.axisPt}); histos.add("h2dGenLambdaVsMcCentrality", "h2dGenLambdaVsMcCentrality", kTH2D, {axisConfigurations.axisCentralityFine, axisConfigurations.axisPt}); histos.add("h2dGenAntiLambdaVsMcCentrality", "h2dGenAntiLambdaVsMcCentrality", kTH2D, {axisConfigurations.axisCentralityFine, axisConfigurations.axisPt}); @@ -1243,7 +1243,7 @@ struct derivedlambdakzeroanalysis { histos.add("h2dGenXiPlusVsMultMC_RecoedEvt", "h2dGenXiPlusVsMultMC_RecoedEvt", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisPt}); histos.add("h2dGenOmegaMinusVsMultMC_RecoedEvt", "h2dGenOmegaMinusVsMultMC_RecoedEvt", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisPt}); histos.add("h2dGenOmegaPlusVsMultMC_RecoedEvt", "h2dGenOmegaPlusVsMultMC_RecoedEvt", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisPt}); - + histos.add("h2dGenK0ShortVsMultMC", "h2dGenK0ShortVsMultMC", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisPt}); histos.add("h2dGenLambdaVsMultMC", "h2dGenLambdaVsMultMC", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisPt}); histos.add("h2dGenAntiLambdaVsMultMC", "h2dGenAntiLambdaVsMultMC", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisPt}); @@ -1300,13 +1300,19 @@ struct derivedlambdakzeroanalysis { // Helper lambda to extract centrality from any object exposing the cent* columns auto extractCentrality = [this](auto const& coll) -> float { switch (centralityEstimator) { - case kCentFT0C: return coll.centFT0C(); - case kCentFT0M: return coll.centFT0M(); - case kCentFT0CVariant1: return coll.centFT0CVariant1(); + case kCentFT0C: + return coll.centFT0C(); + case kCentFT0M: + return coll.centFT0M(); + case kCentFT0CVariant1: + return coll.centFT0CVariant1(); // case kCentMFT: return coll.centMFT(); - case kCentNGlobal: return coll.centNGlobal(); - case kCentFV0A: return coll.centFV0A(); - default: return -1.f; + case kCentNGlobal: + return coll.centNGlobal(); + case kCentFV0A: + return coll.centFV0A(); + default: + return -1.f; } }; @@ -2250,7 +2256,7 @@ struct derivedlambdakzeroanalysis { } template - void analyseCollisionAssociation(TV0 const&/*v0*/, float pt, int mcNch, bool correctAssociation, uint64_t selMap) + void analyseCollisionAssociation(TV0 const& /*v0*/, float pt, int mcNch, bool correctAssociation, uint64_t selMap) // analyse collision association { // __________________________________________ diff --git a/PWGLF/Utils/mcCentralityModule.h b/PWGLF/Utils/mcCentralityModule.h index 233fa50a1dd..cf2b9de0a3a 100644 --- a/PWGLF/Utils/mcCentralityModule.h +++ b/PWGLF/Utils/mcCentralityModule.h @@ -23,10 +23,10 @@ #include #include #include -#include #include -#include +#include #include +#include #include #include #include @@ -36,14 +36,15 @@ #include #include #include -#include #include +#include + #include #include +#include #include #include -#include #include #include #include @@ -62,17 +63,16 @@ namespace mccentrality // avoid polluting other namespaces // statics necessary for the configurables in this namespace static constexpr int nParameters = 1; static const std::vector tableNames{ - "McCentFV0As", - "McCentFT0Ms", - "McCentFT0As", - "McCentFT0Cs", - "McCentFT0CVariant1s", - "McCentFT0CVariant2s", - "McCentFDDMs", - "McCentNTPVs", - "McCentNGlobals", - "McCentMFTs" -}; + "McCentFV0As", + "McCentFT0Ms", + "McCentFT0As", + "McCentFT0Cs", + "McCentFT0CVariant1s", + "McCentFT0CVariant2s", + "McCentFDDMs", + "McCentNTPVs", + "McCentNGlobals", + "McCentMFTs"}; static constexpr int nTablesConst = 10; static const std::vector parameterNames{"enable"}; @@ -99,20 +99,19 @@ enum tableIndex { kFV0A = 0, kNTPV, kNGlobal, kMFT, - kNestimators}; + kNestimators }; static constexpr const char* DirList[] = { - "FV0A", - "FT0M", - "FT0A", - "FT0C", - "FT0CVariant1", - "FT0CVariant2", - "FDDM", - "NTPV", - "NGlobal", - "MFT" -}; + "FV0A", + "FT0M", + "FT0A", + "FT0C", + "FT0CVariant1", + "FT0CVariant2", + "FDDM", + "NTPV", + "NGlobal", + "MFT"}; // mcCentralityModule: 1st-order configurables struct coreConfigurables : o2::framework::ConfigurableGroup { @@ -132,7 +131,7 @@ struct coreConfigurables : o2::framework::ConfigurableGroup { o2::framework::ConfigurableAxis binsPercentileFine{"binsPercentileFine", {o2::framework::VARIABLE_WIDTH, 0, 0.001, 0.01, 1.0, 5.0, 10.0, 15.0, 20.0, 25.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0}, "Binning of the percentile axis"}; o2::framework::ConfigurableAxis binsMultiplicity{"binsMultiplicity", {1000, 0, 5000}, "Binning of the multiplicity axis"}; - //ccdb configurables + // ccdb configurables o2::framework::Configurable path{"path", "/tmp/InputCalibMC.root", "path to calib file or ccdb path if begins with ccdb://"}; // debug option @@ -155,11 +154,11 @@ struct products : o2::framework::ProducesGroup { template concept HasMcMults = requires(typename T::iterator a) { - { a.multMCFT0A() } -> std::convertible_to; - { a.multMCFT0C() } -> std::convertible_to; - { a.multMCFV0A() } -> std::convertible_to; - { a.multMCFDDA() } -> std::convertible_to; - { a.multMCFDDC() } -> std::convertible_to; + { a.multMCFT0A() } -> std::convertible_to; + { a.multMCFT0C() } -> std::convertible_to; + { a.multMCFV0A() } -> std::convertible_to; + { a.multMCFDDA() } -> std::convertible_to; + { a.multMCFDDC() } -> std::convertible_to; { a.multMCNParticlesEta08() } -> std::convertible_to; { a.multMCNParticlesEta05() } -> std::convertible_to; }; @@ -374,7 +373,8 @@ struct BuilderModule { } template - THist* getHist(const char* name) { + THist* getHist(const char* name) + { if (!this->MCCentralityCalibObjects) { return (THist*)0x0; } @@ -392,17 +392,18 @@ struct BuilderModule { return hist; } - TH1D* extractCentralityCalibration(int idx, const char* name, bool reverse = false) { + TH1D* extractCentralityCalibration(int idx, const char* name, bool reverse = false) + { - auto CalibMC = [&](TString const& estimator){ + auto CalibMC = [&](TString const& estimator) { LOGF(info, "\e[1;31mCalibration for %s estimator\e[0;00m -> Starting...\n", estimator.Data()); std::vector percentile_center(nCentBins); std::vector epercentile_center(nCentBins); - //Histograms - TH2D *h2dMultVsCent_Data = getHist(Form("h2dMultVsCent%s_Data", estimator.Data())); - TH2D *h2dMultRecoVsMultGen_MC = getHist(Form("hMultEta05VsGenMult%s", estimator.Data())); + // Histograms + TH2D* h2dMultVsCent_Data = getHist(Form("h2dMultVsCent%s_Data", estimator.Data())); + TH2D* h2dMultRecoVsMultGen_MC = getHist(Form("hMultEta05VsGenMult%s", estimator.Data())); if (!h2dMultVsCent_Data || !h2dMultRecoVsMultGen_MC) { return (TH1D*)0x0; } @@ -414,12 +415,12 @@ struct BuilderModule { TProfile* hPVData = hCalibPVData[idx].get(); TProfile* hPVMC = hCalibPVMC[idx].get(); - TH1D *h1dCalib = h2dMultRecoVsMultGen_MC->ProjectionX(Form("h1d%s", estimator.Data()), 1, h2dMultRecoVsMultGen_MC->GetNbinsX()); + TH1D* h1dCalib = h2dMultRecoVsMultGen_MC->ProjectionX(Form("h1d%s", estimator.Data()), 1, h2dMultRecoVsMultGen_MC->GetNbinsX()); h1dCalib->Reset(); h1dCalib->SetTitle(Form("%s calibration object", estimator.Data())); h1dCalib->GetXaxis()->SetTitle(Form("#it{N}_{%s, gen.}", estimator.Data())); h1dCalib->GetYaxis()->SetTitle(Form("%s percentile (%%)", estimator.Data())); - + // NOTE: candidate-by-candidate assignment (assignCentralityPerCandidate) does not go through this // mean-matching path at all. It samples directly from the "hGenMultEta05VsCentrality" // joint histogram (x = reco centrality of the matched MC collision, y = generated mult |eta|<0.5) @@ -428,16 +429,16 @@ struct BuilderModule { if (reverse) { for (int i = 0; i < nCentBins; i++) { int irev = i; - percentile_center[i] = (centralityBins[irev] + centralityBins[irev+1]) / 2; - epercentile_center[i] = (centralityBins[irev] - centralityBins[irev+1]) / 2; + percentile_center[i] = (centralityBins[irev] + centralityBins[irev + 1]) / 2; + epercentile_center[i] = (centralityBins[irev] - centralityBins[irev + 1]) / 2; } int startBinMc = h1dCalib->GetNbinsX(); for (int i = 0; i < nCentBins; i++) { // Loop over centrality bins // start from the end (from the high multiplicity collisions) int irev = i; - TH1D* projData = h2dMultVsCent_Data->ProjectionY(Form("projData_%d", i), h2dMultVsCent_Data->GetXaxis()->FindBin(centralityBins[irev]+1e-5), - h2dMultVsCent_Data->GetXaxis()->FindBin(centralityBins[irev+1]-1e-5)); + TH1D* projData = h2dMultVsCent_Data->ProjectionY(Form("projData_%d", i), h2dMultVsCent_Data->GetXaxis()->FindBin(centralityBins[irev] + 1e-5), + h2dMultVsCent_Data->GetXaxis()->FindBin(centralityBins[irev + 1] - 1e-5)); double meanMult_Data = projData->GetMean(); @@ -463,7 +464,7 @@ struct BuilderModule { endBinMc = j; } } - if (i == nCentBins-1) { + if (i == nCentBins - 1) { endBinMc = 1; } @@ -488,14 +489,14 @@ struct BuilderModule { } } - LOGF(info, "\e[1;31mCalibration for %s estimator\e[0;00m -> Data centrality bin \e[1;31m%g-%g%%\e[0;00m\n", estimator.Data(), centralityBins[irev], centralityBins[irev+1]); + LOGF(info, "\e[1;31mCalibration for %s estimator\e[0;00m -> Data centrality bin \e[1;31m%g-%g%%\e[0;00m\n", estimator.Data(), centralityBins[irev], centralityBins[irev + 1]); LOGF(info, "\e[1;31mCalibration for %s estimator\e[0;00m -> MC multiplicity range %g-%g\n", estimator.Data(), projMC->GetBinLowEdge(endBinMc), projMC->GetBinLowEdge(startBinMc)); - LOGF(info, "\e[1;31mCalibration for %s estimator\e[0;00m -> data = %.4f Vs MC = %.4f (MC/Data = %.4f%%)\n", estimator.Data(), meanMult_Data, meanMult_MC, (meanMult_MC-meanMult_Data) * 100 / meanMult_Data); + LOGF(info, "\e[1;31mCalibration for %s estimator\e[0;00m -> data = %.4f Vs MC = %.4f (MC/Data = %.4f%%)\n", estimator.Data(), meanMult_Data, meanMult_MC, (meanMult_MC - meanMult_Data) * 100 / meanMult_Data); LOGF(info, "\e[1;31mCalibration for %s estimator\e[0;00m -> N entries Data = %g Vs N entries MC = %g\n", estimator.Data(), projData->Integral(), projMC->Integral()); LOGF(info, "\n"); for (int ibin = 1; ibin <= h1dCalib->GetNbinsX(); ibin++) { - if (ibin <= startBinMc && ibin >= endBinMc){ - h1dCalib->SetBinContent(ibin, percentile_center[i]); + if (ibin <= startBinMc && ibin >= endBinMc) { + h1dCalib->SetBinContent(ibin, percentile_center[i]); } } startBinMc = endBinMc; @@ -503,15 +504,15 @@ struct BuilderModule { } else { for (int i = 0; i < nCentBins; i++) { int irev = nCentBins - i; - percentile_center[i] = (centralityBins[irev-1] + centralityBins[irev]) / 2; - epercentile_center[i] = (centralityBins[irev] - centralityBins[irev-1]) / 2; + percentile_center[i] = (centralityBins[irev - 1] + centralityBins[irev]) / 2; + epercentile_center[i] = (centralityBins[irev] - centralityBins[irev - 1]) / 2; } int startBinMc = 1; for (int i = 0; i < nCentBins; i++) { // Loop over centrality bins // start from the end (from the low multiplicity collisions) int irev = nCentBins - i; - TH1D* projData = h2dMultVsCent_Data->ProjectionY(Form("projData_%d", i), h2dMultVsCent_Data->GetXaxis()->FindBin(centralityBins[irev-1]+1e-5), - h2dMultVsCent_Data->GetXaxis()->FindBin(centralityBins[irev]-1e-5)); + TH1D* projData = h2dMultVsCent_Data->ProjectionY(Form("projData_%d", i), h2dMultVsCent_Data->GetXaxis()->FindBin(centralityBins[irev - 1] + 1e-5), + h2dMultVsCent_Data->GetXaxis()->FindBin(centralityBins[irev] - 1e-5)); double meanMult_Data = projData->GetMean(); @@ -537,8 +538,8 @@ struct BuilderModule { endBinMc = j; } } - if (i == nCentBins-1) { - endBinMc = h2dMultRecoVsMultGen_MC->GetNbinsX(); + if (i == nCentBins - 1) { + endBinMc = h2dMultRecoVsMultGen_MC->GetNbinsX(); } TH1D* projMC = h2dMultRecoVsMultGen_MC->ProjectionY(Form("projMC_%d", i), startBinMc, endBinMc); @@ -562,17 +563,17 @@ struct BuilderModule { } } - LOGF(info, "\e[1;31mCalibration for %s estimator\e[0;00m -> Data centrality bin \e[1;31m%g-%g%%\e[0;00m\n", estimator.Data(), centralityBins[irev-1], centralityBins[irev]); - LOGF(info, "\e[1;31mCalibration for %s estimator\e[0;00m -> MC multiplicity range %g-%g\n", estimator.Data(), projMC->GetBinLowEdge(startBinMc), projMC->GetBinLowEdge(endBinMc+1)); + LOGF(info, "\e[1;31mCalibration for %s estimator\e[0;00m -> Data centrality bin \e[1;31m%g-%g%%\e[0;00m\n", estimator.Data(), centralityBins[irev - 1], centralityBins[irev]); + LOGF(info, "\e[1;31mCalibration for %s estimator\e[0;00m -> MC multiplicity range %g-%g\n", estimator.Data(), projMC->GetBinLowEdge(startBinMc), projMC->GetBinLowEdge(endBinMc + 1)); LOGF(info, "\e[1;31mCalibration for %s estimator\e[0;00m -> data = %.4f Vs MC = %.4f\n", estimator.Data(), meanMult_Data, meanMult_MC); LOGF(info, "\e[1;31mCalibration for %s estimator\e[0;00m -> N entries Data = %g Vs N entries MC = %g\n", estimator.Data(), projData->Integral(), projMC->Integral()); for (int ibin = 1; ibin <= h1dCalib->GetNbinsX(); ibin++) { - if (ibin <= endBinMc && ibin >= startBinMc){ - h1dCalib->SetBinContent(ibin, percentile_center[i]); + if (ibin <= endBinMc && ibin >= startBinMc) { + h1dCalib->SetBinContent(ibin, percentile_center[i]); } } - startBinMc = endBinMc+1; + startBinMc = endBinMc + 1; } // End loop over centrality bins } @@ -658,8 +659,8 @@ struct BuilderModule { // which has no systematic effect on the sampled distribution. ULong64_t computeSamplingSeed(int64_t collisionIndex, int tableIdx) const { - static constexpr ULong64_t kCollisionStride = 131ull; // > kNestimators, so tableIdx can't alias into the collision term - static constexpr ULong64_t kRunStride = 1000003ull; // prime, well above kCollisionStride * (typical collisions per DF) + static constexpr ULong64_t kCollisionStride = 131ull; // > kNestimators, so tableIdx can't alias into the collision term + static constexpr ULong64_t kRunStride = 1000003ull; // prime, well above kCollisionStride * (typical collisions per DF) return baseOpts.centralitySamplingSeed.value + kRunStride * static_cast(mRunNumber) + kCollisionStride * static_cast(collisionIndex) + static_cast(tableIdx); } @@ -713,15 +714,15 @@ struct BuilderModule { return percentile; }; - populateTable(products.centFV0A, h1dFV0A, h2dCentVsGenMult[kFV0A], nFV0A, std::integral_constant{}); - populateTable(products.centFT0M, h1dFT0M, h2dCentVsGenMult[kFT0M], nFT0M, std::integral_constant{}); - populateTable(products.centFT0A, h1dFT0A, h2dCentVsGenMult[kFT0A], nFT0A, std::integral_constant{}); - populateTable(products.centFT0C, h1dFT0C, h2dCentVsGenMult[kFT0C], nFT0C, std::integral_constant{}); - populateTable(products.centFT0CVariant1, h1dFT0CVariant1, h2dCentVsGenMult[kFT0CVariant1], nFT0C, std::integral_constant{}); - populateTable(products.centFT0CVariant2, h1dFT0CVariant2, h2dCentVsGenMult[kFT0CVariant2], nFT0C, std::integral_constant{}); - populateTable(products.centFDDM, h1dFDDM, h2dCentVsGenMult[kFDDM], nFDDM, std::integral_constant{}); - populateTable(products.centNTPV, h1dNTPV, h2dCentVsGenMult[kNTPV], nGlobal, std::integral_constant{}); - populateTable(products.centNGlobal, h1dNGlobal, h2dCentVsGenMult[kNGlobal], nGlobal, std::integral_constant{}); + populateTable(products.centFV0A, h1dFV0A, h2dCentVsGenMult[kFV0A], nFV0A, std::integral_constant{}); + populateTable(products.centFT0M, h1dFT0M, h2dCentVsGenMult[kFT0M], nFT0M, std::integral_constant{}); + populateTable(products.centFT0A, h1dFT0A, h2dCentVsGenMult[kFT0A], nFT0A, std::integral_constant{}); + populateTable(products.centFT0C, h1dFT0C, h2dCentVsGenMult[kFT0C], nFT0C, std::integral_constant{}); + populateTable(products.centFT0CVariant1, h1dFT0CVariant1, h2dCentVsGenMult[kFT0CVariant1], nFT0C, std::integral_constant{}); + populateTable(products.centFT0CVariant2, h1dFT0CVariant2, h2dCentVsGenMult[kFT0CVariant2], nFT0C, std::integral_constant{}); + populateTable(products.centFDDM, h1dFDDM, h2dCentVsGenMult[kFDDM], nFDDM, std::integral_constant{}); + populateTable(products.centNTPV, h1dNTPV, h2dCentVsGenMult[kNTPV], nGlobal, std::integral_constant{}); + populateTable(products.centNGlobal, h1dNGlobal, h2dCentVsGenMult[kNGlobal], nGlobal, std::integral_constant{}); // populateTable(products.centMFT, h1dMFT, h2dCentVsGenMult[kMFT], nMFT, std::integral_constant{}); // to be added later mcCollisionCounter++;