From cf83bf235df28f18fb0f622a9e28ca38d60d9018 Mon Sep 17 00:00:00 2001 From: jesgum Date: Mon, 2 Nov 2026 10:27:20 +0100 Subject: [PATCH 1/3] Add LPM to mc generator map for autodetect generator from metadata --- Common/Core/MetadataHelper.cxx | 28 ++++++++++++++++++++++++++ Common/Core/MetadataHelper.h | 4 ++++ Common/Tools/Multiplicity/MultModule.h | 16 +++++---------- 3 files changed, 37 insertions(+), 11 deletions(-) diff --git a/Common/Core/MetadataHelper.cxx b/Common/Core/MetadataHelper.cxx index c1712c3f3b6..b9a420283cd 100644 --- a/Common/Core/MetadataHelper.cxx +++ b/Common/Core/MetadataHelper.cxx @@ -25,6 +25,7 @@ #include #include +#include #include using namespace o2::common::core; @@ -153,6 +154,33 @@ std::string MetadataHelper::getO2Version() const return get("O2Version"); } +std::string MetadataHelper::getGenerator() const +{ + if (!isMC()) { + return {}; + } + + // MC production tag (LPMProductionTag) -> generator name, for AO2Ds without the generator in the metadata + static const std::map mcGeneratorMap = { + {"LHC26f3", "EPOS"}}; + + // FIXME: use the "Generator" key first once it is available in AO2Ds (it must also be added to the key list in the constructor) + // if (isKeyDefined("Generator")) { + // return get("Generator"); + // } + + // older AO2Ds: rely on the LPMProductionTag to generator map + if (isKeyDefined("LPMProductionTag")) { + auto it = mcGeneratorMap.find(get("LPMProductionTag")); + if (it != mcGeneratorMap.end()) { + return it->second; + } + } + + // no generator found in the metadata, fall back to PYTHIA + return "PYTHIA"; +} + bool MetadataHelper::isCommitInSoftwareTag(const std::string& commitHash, const std::string& ccdbUrl) const { const std::string softwareTag = getO2Version(); diff --git a/Common/Core/MetadataHelper.h b/Common/Core/MetadataHelper.h index 7b871084f9a..45e511a01a9 100644 --- a/Common/Core/MetadataHelper.h +++ b/Common/Core/MetadataHelper.h @@ -55,6 +55,10 @@ struct MetadataHelper { /// @return the O2 version from the metadata std::string getO2Version() const; + /// @brief Function to get the MC generator name from the metadata + /// @return the generator name (e.g. "PYTHIA", "EPOS"), "PYTHIA" for MC if it cannot be determined, or an empty string for data + std::string getGenerator() const; + /// @brief Function to get the metadata value for a given key /// @param key the key of the metadata /// @return the value of the metadata. Throws an exception if the key is not found diff --git a/Common/Tools/Multiplicity/MultModule.h b/Common/Tools/Multiplicity/MultModule.h index e9a64798915..3e251ff618d 100644 --- a/Common/Tools/Multiplicity/MultModule.h +++ b/Common/Tools/Multiplicity/MultModule.h @@ -346,7 +346,7 @@ struct standardConfigurables : o2::framework::ConfigurableGroup { o2::framework::Configurable reconstructionPass{"reconstructionPass", "", {"Apass to use when fetching the calibration tables. Empty (default) does not check for any pass. Use `metadata` to fetch it from the AO2D metadata. Otherwise it will override the metadata."}}; // centrality operation - o2::framework::Configurable generatorName{"generatorName", "", {"Specify if and only if this is MC. Typical: PYTHIA"}}; + o2::framework::Configurable generatorName{"generatorName", "", {"MC generator name for centrality calibration (e.g. PYTHIA, EPOS). Empty: autodetect from metadata in Run 3, falling back to PYTHIA"}}; o2::framework::Configurable embedINELgtZEROselection{"embedINELgtZEROselection", false, {"Option to do percentile 100.5 if not INELgtZERO"}}; }; @@ -1199,16 +1199,10 @@ class MultModule mRunNumberCentrality = bc.runNumber(); // mark that this run has been attempted already regardless of outcome LOGF(info, "centrality loading procedure for timestamp=%llu, run number=%d", bc.timestamp(), bc.runNumber()); - // capture the need for PYTHIA calibration in Pb-Pb runs - if (metadataInfo.isMC() && mRunNumber >= 544013 && mRunNumber <= 545367 && internalOpts.generatorName.value.empty()) { - LOGF(info, "This is MC for Pb-Pb. Setting generatorName automatically to PYTHIA"); - internalOpts.generatorName.value = "PYTHIA"; - } - - // capture the need for PYTHIA calibration in light ion runs automatically - if (metadataInfo.isMC() && mRunNumber >= 564250 && mRunNumber <= 564472 && internalOpts.generatorName.value.empty()) { - LOGF(info, "This is MC for light ion runs. Setting generatorName automatically to PYTHIA"); - internalOpts.generatorName.value = "PYTHIA"; + // autodetect the generator from the metadata if not explicitly configured + if (metadataInfo.isMC() && internalOpts.generatorName.value.empty()) { + internalOpts.generatorName.value = metadataInfo.getGenerator(); + LOGF(info, "Setting generatorName automatically from metadata to %s", internalOpts.generatorName.value); } LOGF(info, "centrality loading procedure for timestamp=%llu, run number=%d", bc.timestamp(), bc.runNumber()); From 15c8564f36a59b85a051a26d86495c2dc66e1294 Mon Sep 17 00:00:00 2001 From: jesgum Date: Mon, 2 Nov 2026 10:40:03 +0100 Subject: [PATCH 2/3] Update configurabe description --- Common/Tools/Multiplicity/MultModule.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Common/Tools/Multiplicity/MultModule.h b/Common/Tools/Multiplicity/MultModule.h index 3e251ff618d..b63af1bc3c5 100644 --- a/Common/Tools/Multiplicity/MultModule.h +++ b/Common/Tools/Multiplicity/MultModule.h @@ -346,7 +346,7 @@ struct standardConfigurables : o2::framework::ConfigurableGroup { o2::framework::Configurable reconstructionPass{"reconstructionPass", "", {"Apass to use when fetching the calibration tables. Empty (default) does not check for any pass. Use `metadata` to fetch it from the AO2D metadata. Otherwise it will override the metadata."}}; // centrality operation - o2::framework::Configurable generatorName{"generatorName", "", {"MC generator name for centrality calibration (e.g. PYTHIA, EPOS). Empty: autodetect from metadata in Run 3, falling back to PYTHIA"}}; + o2::framework::Configurable generatorName{"generatorName", "", {"MC generator name for centrality calibration (e.g. PYTHIA, EPOS). Empty: autodetect from metadata in Run 3, falling back to PYTHIA. Specify if and only if this is MC to override autodetect from metadata"}}; o2::framework::Configurable embedINELgtZEROselection{"embedINELgtZEROselection", false, {"Option to do percentile 100.5 if not INELgtZERO"}}; }; From 1b69c06ff3b6d8d572d80231d2923411cb55fa90 Mon Sep 17 00:00:00 2001 From: jesgum Date: Wed, 4 Nov 2026 11:18:00 +0100 Subject: [PATCH 3/3] Add EPOS Pb--Pb production --- Common/Core/MetadataHelper.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Common/Core/MetadataHelper.cxx b/Common/Core/MetadataHelper.cxx index b9a420283cd..7530e2a9900 100644 --- a/Common/Core/MetadataHelper.cxx +++ b/Common/Core/MetadataHelper.cxx @@ -162,7 +162,8 @@ std::string MetadataHelper::getGenerator() const // MC production tag (LPMProductionTag) -> generator name, for AO2Ds without the generator in the metadata static const std::map mcGeneratorMap = { - {"LHC26f3", "EPOS"}}; + {"LHC26f3", "EPOS"}, + {"LHC26k3", "EPOS"}}; // FIXME: use the "Generator" key first once it is available in AO2Ds (it must also be added to the key list in the constructor) // if (isKeyDefined("Generator")) {