From 4c9bbd17c2994d439c9087b3d19571b8d8b254f6 Mon Sep 17 00:00:00 2001 From: Alexander Richards Date: Tue, 5 May 2026 18:56:29 +0000 Subject: [PATCH 01/18] creating tutorial plugin --- Mach3Plugins/CMakeLists.txt | 19 +++++++++ Mach3Plugins/MCMCTutorialPlugin.cpp | 62 +++++++++++++++++++++++++++++ Mach3Plugins/MCMCTutorialPlugin.hpp | 19 +++++++++ 3 files changed, 100 insertions(+) create mode 100644 Mach3Plugins/CMakeLists.txt create mode 100644 Mach3Plugins/MCMCTutorialPlugin.cpp create mode 100644 Mach3Plugins/MCMCTutorialPlugin.hpp diff --git a/Mach3Plugins/CMakeLists.txt b/Mach3Plugins/CMakeLists.txt new file mode 100644 index 0000000..9b2ccd2 --- /dev/null +++ b/Mach3Plugins/CMakeLists.txt @@ -0,0 +1,19 @@ +add_custom_target(TutorialPlugins) + +foreach(app + MCMCTutorialPlugin + ) + + add_library(${app} SHARED ${app}.cpp) + + target_link_libraries(${app} PRIVATE MaCh3Tutorial::SamplesTutorial MaCh3::All) + target_include_directories(${app} PUBLIC $) + + +# add_executable(${app} ${app}.cpp) +# target_link_libraries(${app} MaCh3Tutorial::ValidationsUtils MaCh3Tutorial::SamplesTutorial) + +# add_dependencies(TutorialApps ${app}) +# install(TARGETS ${app} DESTINATION bin) +endforeach(app) + diff --git a/Mach3Plugins/MCMCTutorialPlugin.cpp b/Mach3Plugins/MCMCTutorialPlugin.cpp new file mode 100644 index 0000000..086f2ed --- /dev/null +++ b/Mach3Plugins/MCMCTutorialPlugin.cpp @@ -0,0 +1,62 @@ +// MaCh3 includes +#include "Fitters/MaCh3Factory.h" +#include "SamplesTutorial/SampleHandlerTutorial.h" +#include "MaCh3Plugins/MCMCTutorialPlugin.hpp" + +MACH3_REGISTER_PLUGIN(mach3::MCMCTutorialPlugin) + +namespace mach3{ + MaCh3ArgumentParser* MCMCTutorialPlugin::get_parser(){ + m_parser = new MaCh3ArgumentParser("tutorial", "1.0", argparse::default_arguments::help); + m_parser->add_argument("config") + .help("Config file.") + .metavar("CONFIG") + .required(); + // m_parser->add_argument("root-file") + // .help("Root file.") + // .metavar("ROOT_FILE") + // .required(); + + return m_parser; + } + int MCMCTutorialPlugin::run(){ + std::string config = m_parser->get("config"); + // std::string inputFile = m_parser->get("root-file"); + + std::vector args = { m_parser->name(), config };//, inputFile }; + + // Convert to char* array + std::vector argv; + argv.reserve(args.size()); + for (auto& s : args) + argv.push_back(s.data()); + + // Initialise manger responsible for config handling + auto FitManager = MaCh3ManagerFactory(argv.size(), argv.data()); + + // Initialise covariance class reasonable for Systematics + auto xsec = MaCh3CovarianceFactory(FitManager.get(), "Xsec"); + + // Initialise samplePDF + auto SampleConfig = Get>(FitManager->raw()["General"]["TutorialSamples"], __FILE__ , __LINE__); + auto mySamples = MaCh3SampleHandlerFactory(SampleConfig, xsec.get()); + + // Create MCMC Class + std::unique_ptr MaCh3Fitter = MaCh3FitterFactory(FitManager.get()); + // Add covariance to MCM + MaCh3Fitter->AddSystObj(xsec.get()); + for (size_t i = 0; i < SampleConfig.size(); ++i) { + MaCh3Fitter->AddSampleHandler(mySamples[i]); + } + // Run MCMCM + MaCh3Fitter->RunMCMC(); + + for (size_t i = 0; i < SampleConfig.size(); ++i) { + delete mySamples[i]; + } + return 0; + } + + + +}; diff --git a/Mach3Plugins/MCMCTutorialPlugin.hpp b/Mach3Plugins/MCMCTutorialPlugin.hpp new file mode 100644 index 0000000..dc6ba30 --- /dev/null +++ b/Mach3Plugins/MCMCTutorialPlugin.hpp @@ -0,0 +1,19 @@ +#pragma once +#include "api/plugin.hpp" + +namespace mach3{ + + class MCMCTutorialPlugin: public IPlugin{ + + public: + virtual ~MCMCTutorialPlugin(){ + if (m_parser) { delete m_parser; } + } + MaCh3ArgumentParser* get_parser() override; + int run() override; + + + private: + MaCh3ArgumentParser* m_parser; + }; +}; From 7fb9cdb394c76a69bd5ecd977a1c0ee867a3ebdc Mon Sep 17 00:00:00 2001 From: Alexander Richards Date: Tue, 5 May 2026 18:57:53 +0000 Subject: [PATCH 02/18] Updating cmake file --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6713a45..ed20606 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -147,6 +147,7 @@ add_subdirectory(CIValidations) add_subdirectory(Tutorial) add_subdirectory(SplinesTutorial) add_subdirectory(SamplesTutorial) +add_subdirectory(MaCh3Plugins) # MOVE THIS BLOCK HERE - BEFORE add_subdirectory(python) # After MaCh3 is added/found, determine MaCh3_PREFIX From f1e17c602ea5f8f93b3c4820f1851724d6949296 Mon Sep 17 00:00:00 2001 From: Alexander Richards Date: Wed, 6 May 2026 13:08:40 +0000 Subject: [PATCH 03/18] fix typo --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ed20606..65f0b5a 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -147,7 +147,7 @@ add_subdirectory(CIValidations) add_subdirectory(Tutorial) add_subdirectory(SplinesTutorial) add_subdirectory(SamplesTutorial) -add_subdirectory(MaCh3Plugins) +add_subdirectory(Mach3Plugins) # MOVE THIS BLOCK HERE - BEFORE add_subdirectory(python) # After MaCh3 is added/found, determine MaCh3_PREFIX From b8e0cbbbb5b5a30161cf9e240b7b701a4c122011 Mon Sep 17 00:00:00 2001 From: Alexander Richards Date: Mon, 18 May 2026 13:51:57 +0000 Subject: [PATCH 04/18] remove header file. --- Mach3Plugins/MCMCTutorialPlugin.cpp | 22 +++++++++++++++++----- Mach3Plugins/MCMCTutorialPlugin.hpp | 19 ------------------- 2 files changed, 17 insertions(+), 24 deletions(-) delete mode 100644 Mach3Plugins/MCMCTutorialPlugin.hpp diff --git a/Mach3Plugins/MCMCTutorialPlugin.cpp b/Mach3Plugins/MCMCTutorialPlugin.cpp index 086f2ed..33b3947 100644 --- a/Mach3Plugins/MCMCTutorialPlugin.cpp +++ b/Mach3Plugins/MCMCTutorialPlugin.cpp @@ -1,12 +1,18 @@ // MaCh3 includes +#include "api/plugin.hpp" #include "Fitters/MaCh3Factory.h" #include "SamplesTutorial/SampleHandlerTutorial.h" -#include "MaCh3Plugins/MCMCTutorialPlugin.hpp" +// #include "Mach3Plugins/MCMCTutorialPlugin.hpp" -MACH3_REGISTER_PLUGIN(mach3::MCMCTutorialPlugin) +namespace M3{ -namespace mach3{ - MaCh3ArgumentParser* MCMCTutorialPlugin::get_parser(){ + class MCMCTutorialPlugin: public IPlugin{ + + public: + virtual ~MCMCTutorialPlugin(){ + if (m_parser) { delete m_parser; } + } + MaCh3ArgumentParser* get_parser(){ m_parser = new MaCh3ArgumentParser("tutorial", "1.0", argparse::default_arguments::help); m_parser->add_argument("config") .help("Config file.") @@ -19,7 +25,8 @@ namespace mach3{ return m_parser; } - int MCMCTutorialPlugin::run(){ + + int run(){ std::string config = m_parser->get("config"); // std::string inputFile = m_parser->get("root-file"); @@ -58,5 +65,10 @@ namespace mach3{ } + private: + MaCh3ArgumentParser* m_parser; + }; }; + +MACH3_REGISTER_PLUGIN(M3::MCMCTutorialPlugin) diff --git a/Mach3Plugins/MCMCTutorialPlugin.hpp b/Mach3Plugins/MCMCTutorialPlugin.hpp deleted file mode 100644 index dc6ba30..0000000 --- a/Mach3Plugins/MCMCTutorialPlugin.hpp +++ /dev/null @@ -1,19 +0,0 @@ -#pragma once -#include "api/plugin.hpp" - -namespace mach3{ - - class MCMCTutorialPlugin: public IPlugin{ - - public: - virtual ~MCMCTutorialPlugin(){ - if (m_parser) { delete m_parser; } - } - MaCh3ArgumentParser* get_parser() override; - int run() override; - - - private: - MaCh3ArgumentParser* m_parser; - }; -}; From 010a0283ec9ccd12e36013b0ec53ce7ce2354a94 Mon Sep 17 00:00:00 2001 From: Alexander Richards Date: Wed, 27 May 2026 13:11:49 +0000 Subject: [PATCH 05/18] adding the nsteps and override CLI options --- Mach3Plugins/MCMCTutorialPlugin.cpp | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/Mach3Plugins/MCMCTutorialPlugin.cpp b/Mach3Plugins/MCMCTutorialPlugin.cpp index 33b3947..c303336 100644 --- a/Mach3Plugins/MCMCTutorialPlugin.cpp +++ b/Mach3Plugins/MCMCTutorialPlugin.cpp @@ -18,19 +18,28 @@ namespace M3{ .help("Config file.") .metavar("CONFIG") .required(); - // m_parser->add_argument("root-file") - // .help("Root file.") - // .metavar("ROOT_FILE") - // .required(); - + m_parser->add_argument("--nsteps") + .scan<'d', int>() + .help("specify the number of steps."); + m_parser->add_argument("--override") + .append() + .help("specify any config overrides."); return m_parser; } int run(){ std::string config = m_parser->get("config"); - // std::string inputFile = m_parser->get("root-file"); - std::vector args = { m_parser->name(), config };//, inputFile }; + std::vector args = { m_parser->name(), config }; + + if (auto fn = m_parser->present("--nsteps")) { + args.push_back("General:MCMC:NSteps:" + std::to_string(*fn)); + } + + std::vector overrides = m_parser->get>("--override"); + for (const std::string& override_str : overrides) { + args.push_back(override_str); + } // Convert to char* array std::vector argv; From 803c801bb65c73e940e6470da4c268a0aed4cc52 Mon Sep 17 00:00:00 2001 From: Charlotte Knight Date: Mon, 1 Jun 2026 10:57:39 +0100 Subject: [PATCH 06/18] naming conventions + plugin export in setup script --- CMakeLists.txt | 2 +- {Mach3Plugins => MaCh3Plugins}/CMakeLists.txt | 0 {Mach3Plugins => MaCh3Plugins}/MCMCTutorialPlugin.cpp | 4 ++-- cmake/Templates/setup.MaCh3Tutorial.sh.in | 2 ++ 4 files changed, 5 insertions(+), 3 deletions(-) rename {Mach3Plugins => MaCh3Plugins}/CMakeLists.txt (100%) rename {Mach3Plugins => MaCh3Plugins}/MCMCTutorialPlugin.cpp (96%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 65f0b5a..ed20606 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -147,7 +147,7 @@ add_subdirectory(CIValidations) add_subdirectory(Tutorial) add_subdirectory(SplinesTutorial) add_subdirectory(SamplesTutorial) -add_subdirectory(Mach3Plugins) +add_subdirectory(MaCh3Plugins) # MOVE THIS BLOCK HERE - BEFORE add_subdirectory(python) # After MaCh3 is added/found, determine MaCh3_PREFIX diff --git a/Mach3Plugins/CMakeLists.txt b/MaCh3Plugins/CMakeLists.txt similarity index 100% rename from Mach3Plugins/CMakeLists.txt rename to MaCh3Plugins/CMakeLists.txt diff --git a/Mach3Plugins/MCMCTutorialPlugin.cpp b/MaCh3Plugins/MCMCTutorialPlugin.cpp similarity index 96% rename from Mach3Plugins/MCMCTutorialPlugin.cpp rename to MaCh3Plugins/MCMCTutorialPlugin.cpp index c303336..b1ebea7 100644 --- a/Mach3Plugins/MCMCTutorialPlugin.cpp +++ b/MaCh3Plugins/MCMCTutorialPlugin.cpp @@ -18,7 +18,7 @@ namespace M3{ .help("Config file.") .metavar("CONFIG") .required(); - m_parser->add_argument("--nsteps") + m_parser->add_argument("--MCMCSteps") .scan<'d', int>() .help("specify the number of steps."); m_parser->add_argument("--override") @@ -32,7 +32,7 @@ namespace M3{ std::vector args = { m_parser->name(), config }; - if (auto fn = m_parser->present("--nsteps")) { + if (auto fn = m_parser->present("--MCMCSteps")) { args.push_back("General:MCMC:NSteps:" + std::to_string(*fn)); } diff --git a/cmake/Templates/setup.MaCh3Tutorial.sh.in b/cmake/Templates/setup.MaCh3Tutorial.sh.in index db250e6..23c2e47 100755 --- a/cmake/Templates/setup.MaCh3Tutorial.sh.in +++ b/cmake/Templates/setup.MaCh3Tutorial.sh.in @@ -107,4 +107,6 @@ else fi fi +export MACH3_PLUGINS=${SETUPDIR}/MaCh3Plugins/libMCMCTutorialPlugin.so + unset SETUPDIR From ca79bd1a612347d49b3cdf6d2f678b113fb14f76 Mon Sep 17 00:00:00 2001 From: Alexander Richards Date: Wed, 3 Jun 2026 16:44:09 +0000 Subject: [PATCH 07/18] add new api location --- MaCh3Plugins/MCMCTutorialPlugin.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MaCh3Plugins/MCMCTutorialPlugin.cpp b/MaCh3Plugins/MCMCTutorialPlugin.cpp index b1ebea7..c6662d6 100644 --- a/MaCh3Plugins/MCMCTutorialPlugin.cpp +++ b/MaCh3Plugins/MCMCTutorialPlugin.cpp @@ -1,5 +1,5 @@ // MaCh3 includes -#include "api/plugin.hpp" +#include "cli/api/plugin.hpp" #include "Fitters/MaCh3Factory.h" #include "SamplesTutorial/SampleHandlerTutorial.h" // #include "Mach3Plugins/MCMCTutorialPlugin.hpp" From bc91016f6ccaeb7a94dbc1eece3d0a031af0a5ed Mon Sep 17 00:00:00 2001 From: Alexander Richards Date: Tue, 16 Jun 2026 08:25:46 +0000 Subject: [PATCH 08/18] add option -o short form --- MaCh3Plugins/MCMCTutorialPlugin.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MaCh3Plugins/MCMCTutorialPlugin.cpp b/MaCh3Plugins/MCMCTutorialPlugin.cpp index c6662d6..f298fbe 100644 --- a/MaCh3Plugins/MCMCTutorialPlugin.cpp +++ b/MaCh3Plugins/MCMCTutorialPlugin.cpp @@ -21,7 +21,7 @@ namespace M3{ m_parser->add_argument("--MCMCSteps") .scan<'d', int>() .help("specify the number of steps."); - m_parser->add_argument("--override") + m_parser->add_argument("-o", "--override") .append() .help("specify any config overrides."); return m_parser; From 9dd467936b230ce9f3f03460be867f265f80bc28 Mon Sep 17 00:00:00 2001 From: Alexander Richards Date: Mon, 6 Jul 2026 14:57:29 +0000 Subject: [PATCH 09/18] migrate to changes in the plugin system --- MaCh3Plugins/MCMCTutorialPlugin.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/MaCh3Plugins/MCMCTutorialPlugin.cpp b/MaCh3Plugins/MCMCTutorialPlugin.cpp index f298fbe..7dcca5b 100644 --- a/MaCh3Plugins/MCMCTutorialPlugin.cpp +++ b/MaCh3Plugins/MCMCTutorialPlugin.cpp @@ -6,7 +6,7 @@ namespace M3{ - class MCMCTutorialPlugin: public IPlugin{ + class MCMCTutorialPlugin: public IPluginBase{ public: virtual ~MCMCTutorialPlugin(){ @@ -27,7 +27,7 @@ namespace M3{ return m_parser; } - int run(){ + int Run(){ std::string config = m_parser->get("config"); std::vector args = { m_parser->name(), config }; @@ -74,8 +74,8 @@ namespace M3{ } - private: - MaCh3ArgumentParser* m_parser; + // private: + // MaCh3ArgumentParser* m_parser; }; }; From faf866c59fe9881d21edc2b61d8093587a42ba51 Mon Sep 17 00:00:00 2001 From: Alexander Richards Date: Mon, 6 Jul 2026 15:00:09 +0000 Subject: [PATCH 10/18] Allow dynamic loading of plugin directories --- cmake/Templates/setup.MaCh3Tutorial.sh.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/Templates/setup.MaCh3Tutorial.sh.in b/cmake/Templates/setup.MaCh3Tutorial.sh.in index 23c2e47..8c2dc57 100755 --- a/cmake/Templates/setup.MaCh3Tutorial.sh.in +++ b/cmake/Templates/setup.MaCh3Tutorial.sh.in @@ -107,6 +107,6 @@ else fi fi -export MACH3_PLUGINS=${SETUPDIR}/MaCh3Plugins/libMCMCTutorialPlugin.so +export MACH3_PLUGINS=${SETUPDIR}/MaCh3Plugins unset SETUPDIR From b2d4d706ede58ab257ed862ec0926eecb455bd05 Mon Sep 17 00:00:00 2001 From: Alexander Richards Date: Mon, 6 Jul 2026 16:10:51 +0000 Subject: [PATCH 11/18] fixing changes from upstream plugin system --- MaCh3Plugins/MCMCTutorialPlugin.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/MaCh3Plugins/MCMCTutorialPlugin.cpp b/MaCh3Plugins/MCMCTutorialPlugin.cpp index 7dcca5b..70c5e6a 100644 --- a/MaCh3Plugins/MCMCTutorialPlugin.cpp +++ b/MaCh3Plugins/MCMCTutorialPlugin.cpp @@ -1,19 +1,18 @@ // MaCh3 includes -#include "cli/api/plugin.hpp" +#include "CLI/API/plugin.hpp" #include "Fitters/MaCh3Factory.h" #include "SamplesTutorial/SampleHandlerTutorial.h" // #include "Mach3Plugins/MCMCTutorialPlugin.hpp" namespace M3{ - class MCMCTutorialPlugin: public IPluginBase{ + class MCMCTutorialPlugin: public PluginBase{ public: - virtual ~MCMCTutorialPlugin(){ - if (m_parser) { delete m_parser; } - } + virtual ~MCMCTutorialPlugin() = default; + MaCh3ArgumentParser* get_parser(){ - m_parser = new MaCh3ArgumentParser("tutorial", "1.0", argparse::default_arguments::help); + m_parser = std::make_unique("tutorial", "1.0", argparse::default_arguments::help); m_parser->add_argument("config") .help("Config file.") .metavar("CONFIG") @@ -24,7 +23,7 @@ namespace M3{ m_parser->add_argument("-o", "--override") .append() .help("specify any config overrides."); - return m_parser; + return m_parser.get(); } int Run(){ From 85cc0e5b4257b3900dda2553d75bcbd2af40c3ed Mon Sep 17 00:00:00 2001 From: Alexander Richards Date: Thu, 9 Jul 2026 16:31:46 +0000 Subject: [PATCH 12/18] linking old style binary to new plugin shared library --- MaCh3Plugins/CMakeLists.txt | 1 + MaCh3Plugins/MCMCTutorialPlugin.cpp | 120 +++++++++++++--------------- MaCh3Plugins/MCMCTutorialPlugin.hpp | 18 +++++ Tutorial/CMakeLists.txt | 17 +++- Tutorial/MCMCTutorial.cpp | 40 +++------- 5 files changed, 102 insertions(+), 94 deletions(-) create mode 100644 MaCh3Plugins/MCMCTutorialPlugin.hpp diff --git a/MaCh3Plugins/CMakeLists.txt b/MaCh3Plugins/CMakeLists.txt index 9b2ccd2..0eb58a0 100644 --- a/MaCh3Plugins/CMakeLists.txt +++ b/MaCh3Plugins/CMakeLists.txt @@ -9,6 +9,7 @@ foreach(app target_link_libraries(${app} PRIVATE MaCh3Tutorial::SamplesTutorial MaCh3::All) target_include_directories(${app} PUBLIC $) + add_library(MaCh3Tutorial::${app} ALIAS ${app}) # add_executable(${app} ${app}.cpp) # target_link_libraries(${app} MaCh3Tutorial::ValidationsUtils MaCh3Tutorial::SamplesTutorial) diff --git a/MaCh3Plugins/MCMCTutorialPlugin.cpp b/MaCh3Plugins/MCMCTutorialPlugin.cpp index 70c5e6a..50b298e 100644 --- a/MaCh3Plugins/MCMCTutorialPlugin.cpp +++ b/MaCh3Plugins/MCMCTutorialPlugin.cpp @@ -1,82 +1,70 @@ // MaCh3 includes -#include "CLI/API/plugin.hpp" +#include "Manager/MaCh3Logger.h" #include "Fitters/MaCh3Factory.h" #include "SamplesTutorial/SampleHandlerTutorial.h" -// #include "Mach3Plugins/MCMCTutorialPlugin.hpp" +#include "Mach3Plugins/MCMCTutorialPlugin.hpp" namespace M3{ - class MCMCTutorialPlugin: public PluginBase{ - - public: - virtual ~MCMCTutorialPlugin() = default; - - MaCh3ArgumentParser* get_parser(){ - m_parser = std::make_unique("tutorial", "1.0", argparse::default_arguments::help); - m_parser->add_argument("config") - .help("Config file.") - .metavar("CONFIG") - .required(); - m_parser->add_argument("--MCMCSteps") - .scan<'d', int>() - .help("specify the number of steps."); - m_parser->add_argument("-o", "--override") - .append() - .help("specify any config overrides."); - return m_parser.get(); + MaCh3ArgumentParser* MCMCTutorialPlugin::get_parser(){ + m_parser = std::make_unique("tutorial", "1.0", argparse::default_arguments::help); + m_parser->add_argument("config") + .help("Config file.") + .metavar("CONFIG") + .required(); + m_parser->add_argument("--MCMCSteps") + .scan<'d', int>() + .help("specify the number of steps."); + m_parser->add_argument("-o", "--override") + .append() + .help("specify any config overrides."); + return m_parser.get(); + } + + int MCMCTutorialPlugin::Run(){ + std::string config = m_parser->get("config"); + + std::vector args = { m_parser->name(), config }; + + if (auto fn = m_parser->present("--MCMCSteps")) { + args.push_back("General:MCMC:NSteps:" + std::to_string(*fn)); + } + + std::vector overrides = m_parser->get>("--override"); + for (const std::string& override_str : overrides) { + args.push_back(override_str); } - int Run(){ - std::string config = m_parser->get("config"); - - std::vector args = { m_parser->name(), config }; - - if (auto fn = m_parser->present("--MCMCSteps")) { - args.push_back("General:MCMC:NSteps:" + std::to_string(*fn)); - } - - std::vector overrides = m_parser->get>("--override"); - for (const std::string& override_str : overrides) { - args.push_back(override_str); - } - - // Convert to char* array - std::vector argv; - argv.reserve(args.size()); - for (auto& s : args) - argv.push_back(s.data()); - - // Initialise manger responsible for config handling - auto FitManager = MaCh3ManagerFactory(argv.size(), argv.data()); + // Convert to char* array + std::vector argv; + argv.reserve(args.size()); + for (auto& s : args) + argv.push_back(s.data()); - // Initialise covariance class reasonable for Systematics - auto xsec = MaCh3CovarianceFactory(FitManager.get(), "Xsec"); + // Initialise manger responsible for config handling + auto FitManager = MaCh3ManagerFactory(argv.size(), argv.data()); - // Initialise samplePDF - auto SampleConfig = Get>(FitManager->raw()["General"]["TutorialSamples"], __FILE__ , __LINE__); - auto mySamples = MaCh3SampleHandlerFactory(SampleConfig, xsec.get()); + // Initialise covariance class reasonable for Systematics + auto xsec = MaCh3CovarianceFactory(FitManager.get(), "Xsec"); - // Create MCMC Class - std::unique_ptr MaCh3Fitter = MaCh3FitterFactory(FitManager.get()); - // Add covariance to MCM - MaCh3Fitter->AddSystObj(xsec.get()); - for (size_t i = 0; i < SampleConfig.size(); ++i) { - MaCh3Fitter->AddSampleHandler(mySamples[i]); - } - // Run MCMCM - MaCh3Fitter->RunMCMC(); + // Initialise samplePDF + auto SampleConfig = Get>(FitManager->raw()["General"]["TutorialSamples"], __FILE__ , __LINE__); + auto mySamples = MaCh3SampleHandlerFactory(SampleConfig, xsec.get()); - for (size_t i = 0; i < SampleConfig.size(); ++i) { - delete mySamples[i]; - } - return 0; + // Create MCMC Class + std::unique_ptr MaCh3Fitter = MaCh3FitterFactory(FitManager.get()); + // Add covariance to MCM + MaCh3Fitter->AddSystObj(xsec.get()); + for (size_t i = 0; i < SampleConfig.size(); ++i) { + MaCh3Fitter->AddSampleHandler(mySamples[i]); } + // Run MCMCM + MaCh3Fitter->RunMCMC(); - - // private: - // MaCh3ArgumentParser* m_parser; - }; + for (size_t i = 0; i < SampleConfig.size(); ++i) { + delete mySamples[i]; + } + return 0; + } }; - -MACH3_REGISTER_PLUGIN(M3::MCMCTutorialPlugin) diff --git a/MaCh3Plugins/MCMCTutorialPlugin.hpp b/MaCh3Plugins/MCMCTutorialPlugin.hpp new file mode 100644 index 0000000..b304e86 --- /dev/null +++ b/MaCh3Plugins/MCMCTutorialPlugin.hpp @@ -0,0 +1,18 @@ +#include "CLI/API/plugin.hpp" + +namespace M3{ + + class MCMCTutorialPlugin: public PluginBase{ + + public: + virtual ~MCMCTutorialPlugin() = default; + + MaCh3ArgumentParser* get_parser(); + + int Run(); + + }; + +}; + +MACH3_REGISTER_PLUGIN(M3::MCMCTutorialPlugin) diff --git a/Tutorial/CMakeLists.txt b/Tutorial/CMakeLists.txt index 3b32241..db92bbd 100755 --- a/Tutorial/CMakeLists.txt +++ b/Tutorial/CMakeLists.txt @@ -1,7 +1,6 @@ add_custom_target(TutorialApps) foreach(app - MCMCTutorial LLHScanTutorial PredictiveTutorial SigmaVarTutorial @@ -20,6 +19,22 @@ foreach(app install(TARGETS ${app} DESTINATION bin) endforeach(app) +foreach(plugin_app + MCMCTutorial + ) + add_executable(${plugin_app} ${plugin_app}.cpp) + target_link_libraries(${plugin_app} MaCh3Tutorial::${plugin_app}Plugin MaCh3Tutorial::ValidationsUtils MaCh3Tutorial::SamplesTutorial) + add_dependencies(${plugin_app} ${plugin_app}Plugin) # must be real target, not alias + if(MaCh3Tutorial_PROFILING_ENABLED) + target_link_libraries(${plugin_app} + profiler # Add this line to link gperftools + ) + endif() + + add_dependencies(TutorialApps ${plugin_app}) + install(TARGETS ${plugin_app} DESTINATION bin) +endforeach(plugin_app) + install(FILES TutorialDiagConfig.yaml DESTINATION ${CMAKE_BINARY_DIR}/bin) diff --git a/Tutorial/MCMCTutorial.cpp b/Tutorial/MCMCTutorial.cpp index f6e2fe4..904c566 100755 --- a/Tutorial/MCMCTutorial.cpp +++ b/Tutorial/MCMCTutorial.cpp @@ -1,30 +1,16 @@ // MaCh3 includes -#include "Fitters/MaCh3Factory.h" -#include "SamplesTutorial/SampleHandlerTutorial.h" +#include "Manager/MaCh3Logger.h" +#include "Mach3Plugins/MCMCTutorialPlugin.hpp" -int main(int argc, char *argv[]) { - // Initialise manger responsible for config handling - auto FitManager = MaCh3ManagerFactory(argc, argv); - - // Initialise covariance class reasonable for Systematics - auto xsec = MaCh3CovarianceFactory(FitManager.get(), "Xsec"); - - // Initialise samplePDF - auto SampleConfig = Get>(FitManager->raw()["General"]["TutorialSamples"], __FILE__ , __LINE__); - auto mySamples = MaCh3SampleHandlerFactory(SampleConfig, xsec.get()); - - // Create MCMC Class - std::unique_ptr MaCh3Fitter = MaCh3FitterFactory(FitManager.get()); - // Add covariance to MCM - MaCh3Fitter->AddSystObj(xsec.get()); - for (size_t i = 0; i < SampleConfig.size(); ++i) { - MaCh3Fitter->AddSampleHandler(mySamples[i]); - } - // Run MCMCM - MaCh3Fitter->RunMCMC(); - - for (size_t i = 0; i < SampleConfig.size(); ++i) { - delete mySamples[i]; - } - return 0; +int main(int argc, char const* argv[]) { + MACH3LOG_WARN("Deprecation Warning: Use of the standalone executable will be deprecated in future releases."); + MACH3LOG_WARN(" : you can use 'mach3 tutorial' as a direct replacement instead."); + argv[0] = "tutorial"; + M3::MCMCTutorialPlugin tutorial; + ArgumentParser* parser = tutorial.get_parser(); + parser->parse_args(argc, argv); + tutorial.Run(); + MACH3LOG_WARN("Deprecation Warning: Use of the standalone executable will be deprecated in future releases."); + MACH3LOG_WARN(" : you can use 'mach3 tutorial' as a direct replacement instead."); + return 0; } From 8ae4a214b3c03d46c886402e41f3ca6a336ae2b2 Mon Sep 17 00:00:00 2001 From: Alexander Richards Date: Fri, 10 Jul 2026 10:58:23 +0000 Subject: [PATCH 13/18] attempt fix for compiling validations --- MaCh3Plugins/CMakeLists.txt | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/MaCh3Plugins/CMakeLists.txt b/MaCh3Plugins/CMakeLists.txt index 0eb58a0..6254eab 100644 --- a/MaCh3Plugins/CMakeLists.txt +++ b/MaCh3Plugins/CMakeLists.txt @@ -7,7 +7,24 @@ foreach(app add_library(${app} SHARED ${app}.cpp) target_link_libraries(${app} PRIVATE MaCh3Tutorial::SamplesTutorial MaCh3::All) - target_include_directories(${app} PUBLIC $) + # target_include_directories(${app} PUBLIC $) + + target_include_directories(${app} + PUBLIC + $ + $ + ) + + install( + TARGETS ${app} + EXPORT MaCh3TutorialTargets + LIBRARY DESTINATION lib + ) + + install( + FILES ${app}.hpp + DESTINATION include/Mach3Plugins + ) add_library(MaCh3Tutorial::${app} ALIAS ${app}) From 45384b828619802e08a225ea2a1c438aa867cc72 Mon Sep 17 00:00:00 2001 From: Alexander Richards Date: Fri, 10 Jul 2026 13:13:05 +0000 Subject: [PATCH 14/18] fix typo in header include --- MaCh3Plugins/MCMCTutorialPlugin.cpp | 2 +- Tutorial/MCMCTutorial.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/MaCh3Plugins/MCMCTutorialPlugin.cpp b/MaCh3Plugins/MCMCTutorialPlugin.cpp index 50b298e..73f7991 100644 --- a/MaCh3Plugins/MCMCTutorialPlugin.cpp +++ b/MaCh3Plugins/MCMCTutorialPlugin.cpp @@ -2,7 +2,7 @@ #include "Manager/MaCh3Logger.h" #include "Fitters/MaCh3Factory.h" #include "SamplesTutorial/SampleHandlerTutorial.h" -#include "Mach3Plugins/MCMCTutorialPlugin.hpp" +#include "MaCh3Plugins/MCMCTutorialPlugin.hpp" namespace M3{ diff --git a/Tutorial/MCMCTutorial.cpp b/Tutorial/MCMCTutorial.cpp index 904c566..9ace3e0 100755 --- a/Tutorial/MCMCTutorial.cpp +++ b/Tutorial/MCMCTutorial.cpp @@ -1,6 +1,6 @@ // MaCh3 includes #include "Manager/MaCh3Logger.h" -#include "Mach3Plugins/MCMCTutorialPlugin.hpp" +#include "MaCh3Plugins/MCMCTutorialPlugin.hpp" int main(int argc, char const* argv[]) { MACH3LOG_WARN("Deprecation Warning: Use of the standalone executable will be deprecated in future releases."); From 2efca4a369258cab8ef5695f8cdb46de8797a0b2 Mon Sep 17 00:00:00 2001 From: Alexander Richards Date: Fri, 10 Jul 2026 14:11:23 +0000 Subject: [PATCH 15/18] Fix CIValidations/MaCh3CLI by using the -o config override option --- CIValidations/MaCh3CLI | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CIValidations/MaCh3CLI b/CIValidations/MaCh3CLI index 901a2fe..e216045 100755 --- a/CIValidations/MaCh3CLI +++ b/CIValidations/MaCh3CLI @@ -109,7 +109,7 @@ run_multicanoical_validations() { mkdir ${MaCh3Tutorial_ROOT}/outputs/ mkdir ${MaCh3Tutorial_ROOT}/outputs/plotting/ - ${MaCh3Tutorial_ROOT}/bin/MCMCTutorial TutorialConfigs/FitterConfig.yaml General:MCMC:Multicanonical:Enabled:True General:OutputFile:umbrella/umbrellafile0.root + ${MaCh3Tutorial_ROOT}/bin/MCMCTutorial TutorialConfigs/FitterConfig.yaml -o General:MCMC:Multicanonical:Enabled:True -o General:OutputFile:umbrella/umbrellafile0.root # Create umbrellafile1.root ... umbrellafile59.root for i in $(seq 1 59); do From 126c1a3d3eddbd8e64b897f68e064b123cfd7276 Mon Sep 17 00:00:00 2001 From: Charlotte Knight Date: Sat, 11 Jul 2026 14:47:54 +0100 Subject: [PATCH 16/18] Updated README for TutorialMCMC, ProcessMCMC, and DiagMCMC --- README.md | 62 ++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 45 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 7ab61c9..bcafe33 100644 --- a/README.md +++ b/README.md @@ -126,10 +126,14 @@ And get some reference values from other users, this can look something like: By comparing rates for each sample much what other users observe you can very simply ensure you correctly setup MaCh3. ## How to run MCMC -To run MCMC simply +To run MCMC simply: ```bash -./bin/MCMCTutorial TutorialConfigs/FitterConfig.yaml +mach3 tutorial TutorialConfigs/FitterConfig.yaml ``` + +> [!NOTE] +> The `mach3` CLI is new, and not every executable in this tutorial has been integrated into it yet. If you have any issues or feedback, please contact the developers or raise issues on this GitHub repository or the MaCh3 GitHub repository. + Congratulations! 🎉 You have just finished your first MCMC chain. You can view `Test.root` for example in TBrowser like in plot below. @@ -146,33 +150,57 @@ General: ``` and then re-running `MCMCTutorial`. -**Warning**: If you modified files in the main `MaCh3Tutorial` folder instead of `build`, you will have to call `make install` for the changes to propagate! Generally speaking, it is good practice to work from the `build` directory and make your config changes there so that local changes do not have to be tracked by git. +> [!WARNING] +> If you modified files in the main `MaCh3Tutorial` folder instead of `build`, you will have to call `make install` for the changes to propagate! Generally speaking, it is good practice to work from the `build` directory and make your config changes there so that local changes do not have to be tracked by git. ### Config Overrides Instead of changing the config file `TutorialConfigs/FitterConfig.yaml` above directly, you can instead dynamically override your configurations at the command line like this: ```bash -./bin/MCMCTutorial TutorialConfigs/FitterConfig.yaml General:MCMC:NSteps:100000 +mach3 tutorial TutorialConfigs/FitterConfig.yaml --override General:MCMC:NSteps:100000 ``` -In this way, you can add as many configuration overrides here as you like, as long as the format is `[executable] [config] ([option1] [option2] ...)`. +You can also use the short form `-o` instead of `--override`. You can add as many configuration overrides here as you like: `[executable] [config] (-o [option1] -o [option2] ...)`. -**Warning** This overriding process is only possible for the "main config" (i.e., configs that respond directly to the `Manager` class in MaCh3 core). This main config is used with the apps in the `Tutorial` folder here; -for the other apps (mainly plotting apps like `PredictivePlotting`) that read from `bin/TutorialDiagConfig.yaml`, this is not possible, as further command line arguments are interpreted as *input ROOT files*, not override directives. +> [!WARNING] +> This overriding process is only possible for the "main config" (i.e., configs that respond directly to the `Manager` class in MaCh3 core). This main config is used with the apps in the `Tutorial` folder here; for the other apps (mainly plotting apps like `PredictivePlotting`) that read from `bin/TutorialDiagConfig.yaml`, this is not possible, as further command line arguments are interpreted as *input ROOT files*, not override directives. + +> [!WARNING] +> The format required for overriding is different for the executables described later on in this tutorial which have not been integrated into the `mach3` CLI. For those executables, the `--override` option is not needed, simply write the settings you want to override as arguments at the end of the command. For example `./bin/PredictiveTutorial TutorialConfigs/FitterConfig.yaml General:OutputFile:PriorPredictiveOutputTest.root`. + +If you're lucky, the setting you plan to override may have an explicit option in `mach3 tutrorial`. To find out run `mach3 tutorial --help`: +``` +Usage: mach3 tutorial [--help] [--MCMCSteps VAR] [--override VAR]... CONFIG + +Positional arguments: + CONFIG Config file. [required] + +Optional arguments: + -h, --help shows help message and exits + --MCMCSteps specify the number of steps. + -o, --override specify any config overrides. [may be repeated] +``` +You can see the `--MCMCSteps` option, so earlier we could have instead written: +``` +mach3 tutorial TutorialConfigs/FitterConfig.yaml --MCMCSteps 100000 +``` ### Processing MCMC Outputs -Being able to visualise and analyse the output of the MCMC is standard procedure after a chain has finished. MaCh3 uses `ProcessMCMC` to transform the raw output from the MCMC into smaller outputs that are more easily digested by downstream plotting macros. You can run it using +Being able to visualise and analyse the output of the MCMC is standard procedure after a chain has finished. MaCh3 uses `mach3 process` (previously `ProcessMCMC`) to transform the raw output from the MCMC into smaller outputs that are more easily digested by downstream plotting macros. You can run it using ```bash -./bin/ProcessMCMC bin/TutorialDiagConfig.yaml Test.root +mach3 process bin/TutorialDiagConfig.yaml Test.root ``` -where `Test.root` is the output of running `MCMCTutorial` as described [here](#how-to-run-mcmc). You can find some quickly-generated plots in `Test_drawCorr.pdf`. One of plots you will encounter is: +where `Test.root` is the output of running `mach3 tutorial` as described [here](#how-to-run-mcmc). You can find some quickly-generated plots in `Test_drawCorr.pdf`. One of plots you will encounter is: Posterior example This is the marginalised posterior of a single parameter. This is the main output of the MCMC. -There are many options in `ProcessMCMC` that allow you to make many more analysis plots from the MCMC output; we recommend that you see [here](https://mach3-software.github.io/MaCh3/BayesianAnalysis.html) to get better idea what each plot means. In particular, we recommend comparing 2D posteriors with the correlation matrix, and playing with triangle plots. +There are many options in `mach3 process` that allow you to make many more analysis plots from the MCMC output; we recommend that you see [here](https://mach3-software.github.io/MaCh3/BayesianAnalysis.html) to get better idea what each plot means. In particular, we recommend comparing 2D posteriors with the correlation matrix, and playing with triangle plots. + +> [!TIP] +> Some of those option are immediately available in the command line, find out which ones with `mach3 process --help`. ### Plotting MCMC Posteriors -Once you have the processed MCMC output from `ProcessMCMC`, which will be called something like `_Process.root`, you can make fancier analysis plots from it using the `GetPostfitParamPlots` app like: +Once you have the processed MCMC output from `mach3 process`, which will be called something like `_Process.root`, you can make fancier analysis plots from it using the `GetPostfitParamPlots` app like: ```bash ./bin/GetPostfitParamPlots Test_drawCorr.root @@ -191,14 +219,14 @@ The output should look like plot below. This conveys same information as the ind Ridge **Violin Plot** - This also allow to see nicely non-Gaussian parameters but also is useful in comparing two chains. -`ProcessMCMC` must be run with option "PlotCorr" to be able to produce violin plot. +`mach3 process` must be run with option "PlotCorr" to be able to produce violin plot. Violin example ### Plotting Correlation Matrix -If you have run `ProcessMCMC` with option "PlotCorr" you will have a correlation matrix in the outputs. This is a handy tool for viewing how correlated different parameters are. +If you have run `mach3 process` with option "PlotCorr" you will have a correlation matrix in the outputs. This is a handy tool for viewing how correlated different parameters are. However, mature analyses with hundreds of parameters may run into the problem of having too large of plots to be useful. To combat this, you can plot a subset of parameters using `MatrixPlotter`: ```bash ./bin/MatrixPlotter bin/TutorialDiagConfig.yaml Test_drawCorr.root @@ -317,7 +345,7 @@ Congratulations, you have successfully modified the MCMC! 🎉 ### How to Compare Chains Now that you have two chains you can try comparing them using the following: ```bash -./bin/ProcessMCMC bin/TutorialDiagConfig.yaml Test.root Default_Chain Test_Modified.root Modified_Chain +mach3 process bin/TutorialDiagConfig.yaml Test.root Default_Chain Test_Modified.root Modified_Chain ``` This will produce a pdf with plots showing overlayed posteriors from both chains. Most should be similarly except modified parameter. @@ -426,7 +454,7 @@ You can also easily change what variable the sample is binned in to get slightly ``` You can run the MCMC again using this new configuration (after changing the output file name again!), and then compare all 3 chains using: ```bash -./bin/ProcessMCMC bin/TutorialDiagConfig.yaml Test.root Default_Chain Test_Modified.root Modified_Chain Test_Modified_Sample.root ModifiedSameple_Chain +mach3 process bin/TutorialDiagConfig.yaml Test.root Default_Chain Test_Modified.root Modified_Chain Test_Modified_Sample.root ModifiedSameple_Chain ```
@@ -621,7 +649,7 @@ The latter class deals with actual event reweighting and general heavy lifting. ## MCMC Diagnostic A crucial part of MCMC is diagnosing whether a chain has converged or not. You can produce chain diagnostics by running: ```bash -./bin/DiagMCMC Test.root bin/TutorialDiagConfig.yaml +mach3 diag Test.root bin/TutorialDiagConfig.yaml ``` This will produce a plethora of diagnostic information. One of most important of these are the autocorrelations for each of the parameters. Autocorrelation indicates how correlated MCMC steps are when they are n-steps apart in the chain. Generally speaking, we want the autocorrelation to drop to 0 fast and stay around there (like in the plot below). You can read about other diagnostics [here](https://mach3-software.github.io/MaCh3/MCMCconvergance.html), but it is sufficient for now to focus on autocorrelation. From 95a40a3319274802268be53c243ef089400ff968 Mon Sep 17 00:00:00 2001 From: Charlotte Knight Date: Sat, 11 Jul 2026 14:59:21 +0100 Subject: [PATCH 17/18] typo and missed PlotCorr option in README --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index bcafe33..c0de2a6 100644 --- a/README.md +++ b/README.md @@ -166,7 +166,7 @@ You can also use the short form `-o` instead of `--override`. You can add as man > [!WARNING] > The format required for overriding is different for the executables described later on in this tutorial which have not been integrated into the `mach3` CLI. For those executables, the `--override` option is not needed, simply write the settings you want to override as arguments at the end of the command. For example `./bin/PredictiveTutorial TutorialConfigs/FitterConfig.yaml General:OutputFile:PriorPredictiveOutputTest.root`. -If you're lucky, the setting you plan to override may have an explicit option in `mach3 tutrorial`. To find out run `mach3 tutorial --help`: +If you're lucky, the setting you plan to override may have an explicit option in `mach3 tutorial`. To find out run `mach3 tutorial --help`: ``` Usage: mach3 tutorial [--help] [--MCMCSteps VAR] [--override VAR]... CONFIG @@ -219,14 +219,14 @@ The output should look like plot below. This conveys same information as the ind Ridge **Violin Plot** - This also allow to see nicely non-Gaussian parameters but also is useful in comparing two chains. -`mach3 process` must be run with option "PlotCorr" to be able to produce violin plot. +`mach3 process` must be run with option "--corr" to be able to produce violin plot. Violin example
### Plotting Correlation Matrix -If you have run `mach3 process` with option "PlotCorr" you will have a correlation matrix in the outputs. This is a handy tool for viewing how correlated different parameters are. +If you have run `mach3 process` with option "-corr" you will have a correlation matrix in the outputs. This is a handy tool for viewing how correlated different parameters are. However, mature analyses with hundreds of parameters may run into the problem of having too large of plots to be useful. To combat this, you can plot a subset of parameters using `MatrixPlotter`: ```bash ./bin/MatrixPlotter bin/TutorialDiagConfig.yaml Test_drawCorr.root From 2be85c5491879a5e5bff9474ed690c74256badd2 Mon Sep 17 00:00:00 2001 From: Kamil Skwarczynski Date: Mon, 13 Jul 2026 08:56:02 +0000 Subject: [PATCH 18/18] minor tweaks to readme --- .github/workflows/CIBenchmark.yml | 2 +- README.md | 17 +++++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/workflows/CIBenchmark.yml b/.github/workflows/CIBenchmark.yml index 01d9a69..23d2287 100644 --- a/.github/workflows/CIBenchmark.yml +++ b/.github/workflows/CIBenchmark.yml @@ -103,7 +103,7 @@ jobs: source bin/setup.MaCh3.sh source bin/setup.MaCh3Tutorial.sh - pprof ./bin/MCMCTutorial ${{ matrix.outpath }}/MaCh3Tutorial --focus="RunMCMC" --pdf > ${{ matrix.outpath }}/${{ matrix.title }}.pdf + pprof ./bin/${{ matrix.app }} ${{ matrix.outpath }}/MaCh3Tutorial --focus="RunMCMC" --pdf > ${{ matrix.outpath }}/${{ matrix.title }}.pdf - name: Push Plot to gh-benchmarks Branch run: | diff --git a/README.md b/README.md index c0de2a6..7d812a4 100644 --- a/README.md +++ b/README.md @@ -150,7 +150,7 @@ General: ``` and then re-running `MCMCTutorial`. -> [!WARNING] +> [!WARNING] > If you modified files in the main `MaCh3Tutorial` folder instead of `build`, you will have to call `make install` for the changes to propagate! Generally speaking, it is good practice to work from the `build` directory and make your config changes there so that local changes do not have to be tracked by git. ### Config Overrides @@ -161,13 +161,18 @@ mach3 tutorial TutorialConfigs/FitterConfig.yaml --override General:MCMC:NSteps: You can also use the short form `-o` instead of `--override`. You can add as many configuration overrides here as you like: `[executable] [config] (-o [option1] -o [option2] ...)`. > [!WARNING] -> This overriding process is only possible for the "main config" (i.e., configs that respond directly to the `Manager` class in MaCh3 core). This main config is used with the apps in the `Tutorial` folder here; for the other apps (mainly plotting apps like `PredictivePlotting`) that read from `bin/TutorialDiagConfig.yaml`, this is not possible, as further command line arguments are interpreted as *input ROOT files*, not override directives. - +> This overriding process is only possible for the "main config" (i.e., configs that respond directly to the `Manager` class in MaCh3 core). +> This main config is used with the apps in the `Tutorial` folder here; for the other apps (mainly plotting apps like `PredictivePlotting`) +> that read from `bin/TutorialDiagConfig.yaml`, this is not possible, +> as further command line arguments are interpreted as *input ROOT files*, not override directives. +> > [!WARNING] -> The format required for overriding is different for the executables described later on in this tutorial which have not been integrated into the `mach3` CLI. For those executables, the `--override` option is not needed, simply write the settings you want to override as arguments at the end of the command. For example `./bin/PredictiveTutorial TutorialConfigs/FitterConfig.yaml General:OutputFile:PriorPredictiveOutputTest.root`. +> The format required for overriding is different for the executables described later on in this tutorial which have not been integrated into the `mach3` CLI. +> For those executables, the `--override` option is not needed, simply write the settings you want to override as arguments at the end of the command. +> For example `./bin/PredictiveTutorial TutorialConfigs/FitterConfig.yaml General:OutputFile:PriorPredictiveOutputTest.root`. If you're lucky, the setting you plan to override may have an explicit option in `mach3 tutorial`. To find out run `mach3 tutorial --help`: -``` +```console Usage: mach3 tutorial [--help] [--MCMCSteps VAR] [--override VAR]... CONFIG Positional arguments: @@ -179,7 +184,7 @@ Optional arguments: -o, --override specify any config overrides. [may be repeated] ``` You can see the `--MCMCSteps` option, so earlier we could have instead written: -``` +```bash mach3 tutorial TutorialConfigs/FitterConfig.yaml --MCMCSteps 100000 ```