{"id":36339212,"url":"https://github.com/mach3-software/mach3","last_synced_at":"2026-05-14T21:01:15.755Z","repository":{"id":73607959,"uuid":"331049416","full_name":"mach3-software/MaCh3","owner":"mach3-software","description":"The official repository for MaCh3","archived":false,"fork":false,"pushed_at":"2026-05-12T15:04:38.000Z","size":229650,"stargazers_count":12,"open_issues_count":19,"forks_count":11,"subscribers_count":10,"default_branch":"develop","last_synced_at":"2026-05-12T15:37:17.596Z","etag":null,"topics":["bayesian","cuda","data-analysis","markov-chain-monte-carlo","mathematics","neutrino","neutrino-oscillations","physics","statistics"],"latest_commit_sha":null,"homepage":"https://mach3-software.github.io/MaCh3/","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mach3-software.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":".zenodo.json","notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-01-19T16:58:20.000Z","updated_at":"2026-05-12T14:09:38.000Z","dependencies_parsed_at":"2026-04-20T01:02:04.634Z","dependency_job_id":null,"html_url":"https://github.com/mach3-software/MaCh3","commit_stats":null,"previous_names":[],"tags_count":47,"template":false,"template_full_name":null,"purl":"pkg:github/mach3-software/MaCh3","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mach3-software%2FMaCh3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mach3-software%2FMaCh3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mach3-software%2FMaCh3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mach3-software%2FMaCh3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mach3-software","download_url":"https://codeload.github.com/mach3-software/MaCh3/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mach3-software%2FMaCh3/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33043249,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-13T13:14:54.681Z","status":"online","status_checked_at":"2026-05-14T02:00:06.663Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bayesian","cuda","data-analysis","markov-chain-monte-carlo","mathematics","neutrino","neutrino-oscillations","physics","statistics"],"created_at":"2026-01-11T12:54:35.476Z","updated_at":"2026-05-14T21:01:15.748Z","avatar_url":"https://github.com/mach3-software.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MaCh3 \u003cimg src=\"Doc/mach3logo.png\" alt=\"MaCh3\" align=\"center\" width=\"100\"/\u003e\n\nThe Markov Chain 3 flavour is a framework born in 2013 as a Bayesian MCMC\nfitter for [T2K](https://t2k-experiment.org/pl/) oscillation analysis. It has\nnow been used for multiple T2K Oscillation analyses at both the Near and Far\ndetectors throughout the years. The framework is also utilized by the\n[DUNE](https://www.dunescience.org/) and [HK](https://www-sk.icrr.u-tokyo.ac.jp/en/hk/)\noscillation analysis groups. Additionally, it supports joint fits between T2K\nand NOvA, as well as T2K and SK's atmospheric data.\n\nThe framework has also evolved to allow non-MCMC modules to interrogate the\nlikelihoods implemented.\n\n[![License](https://img.shields.io/badge/License-BSD_3--Clause-blue.svg)](https://github.com/mach3-software/MaCh3/blob/develop/LICENSE.txt)\n[![DOI](https://zenodo.org/badge/331049416.svg)](https://doi.org/10.5281/zenodo.7608367)\n[![Release](https://img.shields.io/github/release/mach3-software/MaCh3.svg)](https://github.com/mach3-software/MaCh3/releases/latest)\n[![Container Image](https://img.shields.io/badge/Container-Image-brightgreen)](https://github.com/mach3-software/MaCh3/pkgs/container/mach3)\n[![Code - Documented](https://img.shields.io/badge/Code-Documented-2ea44f)](https://mach3-software.github.io/MaCh3/index.html)\n[![Build CI](https://github.com/mach3-software/MaCh3/actions/workflows/CIBuild.yml/badge.svg)](https://github.com/mach3-software/MaCh3/actions/workflows/CIBuild.yml)\n[![CodeFactor](https://www.codefactor.io/repository/github/mach3-software/mach3/badge/develop)](https://www.codefactor.io/repository/github/mach3-software/mach3/overview/develop)\n\n## Famous Plots\nExample of plots made using MaCh3 apparent in scientific publications, for more see [here](https://mach3-software.github.io/MaCh3/ResultsPublications.html)\n\n\u003cimg width=\"200\" alt=\"Delta\" src=\"https://github.com/user-attachments/assets/ac267b79-999d-4911-8e6e-1932147d440b\" /\u003e\n\u003cimg width=\"200\" alt=\"Jarlskog\" src=\"https://github.com/user-attachments/assets/67624cfd-89f0-4897-a9d2-485d295ac4c2\" /\u003e\n\n## Cite\nWhen using MaCh3 you must cite our doi from Zenodo. The bibtex file can be found by exporting the citation from this link: [on Zenodo](https://zenodo.org/records/7608367) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.7608367.svg)](https://doi.org/10.5281/zenodo.7608367).\n\n## Help and Guidelines 📄\n- [Tutorial](https://github.com/mach3-software/MaCh3Tutorial)\n- [Documentation](https://mach3-software.github.io/MaCh3/index.html)\n- [Indico](https://indico.global/category/1289/) If you need a password, please reach out to MaCh3-leadership for access.\n- [How to contribute](https://github.com/mach3-software/MaCh3/blob/develop/.github/CONTRIBUTING.md)\n- [Slack](https://t2k-experiment.slack.com/archives/C06EM0C6D7W/p1705599931356889)\n- [Discussions](https://github.com/mach3-software/MaCh3/discussions)\n- [Benchmark](https://mach3-software.github.io/MaCh3Tutorial/)\n\n## How to Compile\nMaCh3 follows standard cmake pattern. By default you should get most optimal build setting although below we list many configurable options:\n```bash\nmkdir build;\ncd build;\ncmake ../\nmake -jN [Where N is number of threads]\nmake install\n```\n\nDon't forget to:\n```bash\nsource bin/setup.MaCh3.sh\n```\n\nIf the build fails, check your [system/environment requirements](#system-requirements).\n\n## Building against MaCh3\nTo include MaCh3 in your cmake project you can use following syntax\n```cmake\nCPMFindPackage(\n  NAME MaCh3\n  GIT_TAG \"blarb\"\n  GITHUB_REPOSITORY mach3-software/MaCh3\n)\n```\nWhere \"blarb\" is the MaCh3 version. You can find a list of releases [here](https://mach3-software.github.io/MaCh3/ReleaseNotes.html)  \nIf you compiled MaCh3 and sourced it you can simply call\n```cmake\nfind_package(MaCh3)\n```\n\nOnce you found MaCh3 you might want to link your library against MaCh3. You can do this as follows:\n```cmake\ntarget_link_libraries(blarb MaCh3::All)\n```\n\nSome functionalities rely on setting `Env{MACH3}` which should point to path experiment specific MaCh3. This way MaCh3 can easily find `Env{MACH3}/inputs/SomeInput.root` for example.\n\n## Python 🐍\n\nMaCh3 has an optional python interface (pyMaCh3) which provides much of the same functionality as the c++ interface. The recommended way of building the pyMaCh3 module is using pip. After checking out the MaCh3 repository, from the root directory (the one containing pyproject.toml) simply run:\n\n```bash\npip install .\n```\n\nThis will give you a pyMaCh3 module with all functionality of core MaCh3. You can implement any experiment specific code by extending the base classes purely in python. MaCh3 also provides functionality to bind your c++ based experiment specific code so you can maintain all the speed benifits of c++ with the ease of use of python. Details on how to do this are given in the wiki [here](https://github.com/mach3-software/MaCh3/wiki/Python-Binding).\n\nYou can also find documentation for the pyMaCh3 module [here](https://mach3-software.github.io/MaCh3/pyMaCh3/mainpage.html).\n\n## Multithreading\nMaCh3 quite heavily relies on Multithreading, it is turned on by default. If for debugging purposes you would like to turn it off please use\n```bash\ncmake ../ -DMaCh3_MULTITHREAD_ENABLED=OFF\n```\n\n## CUDA\nIf the system has access to GPU, MaCh3 will enable GPU functionality automatically. If you would like to CPU only despite having access to [CUDA](https://developer.nvidia.com/cuda-toolkit)\n```bash\nmkdir build; cd build;\ncmake ../ -DMaCh3_GPU_ENABLED=OFF\n```\nMaCh3 supports quite a high range of CUDA architectures if something doesn't work on your GPU let us know. MaCh3 supports only NVIDIA GPUs.\n\n## Oscillator\nMaCh3 has access to several neutrino oscillation calculators via [NuOscillator](https://github.com/dbarrow257/NuOscillator/tree/main) framework.\n\nFollowing neutrino oscillation calculators are available:\n|Oscillator        | Hardware   | Source     | Reference  |\n|------------------|------------|------------|------------|\n| CUDAProb3Linear  | CPU/GPU    | Beam       |            |\n| CUDAProb3        | CPU/GPU    | Atm        | [Ref](https://doi.org/10.1016/j.cpc.2018.07.022)        |\n| ProbGPULinear    | GPU        | Beam       | [Ref](http://dx.doi.org/10.3204/DESY-PROC-2014-05/23)   |\n| Prob3++Linear    | CPU        | Beam       |            |\n| NuFastLinear     | CPU        | Beam       | [Ref](https://doi.org/10.48550/arXiv.2405.02400)        |\n| NuFastEarth      | CPU        | ATM        | [Ref](https://arxiv.org/abs/2511.04735)                 |\n| OscProb          | CPU        | Beam/Atm   | [Ref](https://doi.org/10.5281/zenodo.6347002)           |\n| NuSQUIDSLinear   | CPU        | Beam       | [Ref](https://doi.org/10.1016/j.cpc.2022.108346)        |\n| GLoBESLinear     | CPU        | Beam       | [Ref](https://doi.org/10.1016/j.cpc.2005.01.003)        |\n| CHICLinear       | CPU        | Beam       | [Ref](https://arxiv.org/pdf/2512.16427)                 |\n| OscLib           | CPU        | Beam       | [Ref](https://github.com/cafana/OscLib)                 |\n\nIf nothing is specified in cmake build then NuFastLinear_ENABLED will be used. To control which oscillation calculators you want to use here is syntax:\n\n```bash\ncmake ../ -DCUDAProb3Linear_ENABLED=ON -DCUDAProb3_ENABLED=ON -DProbGPULinear_ENABLED=ON -DProb3ppLinear_ENABLED=ON -DNuFastLinear_ENABLED=ON -DOscProb_ENABLED=ON\n```\nYou can specify more than one engine, and MaCh3 support different engines for different samples.\nFor example, you can use NuFast for beam samples and CUDAProb3 for atmospheric samples.\n\n## Fitting algorithms\nThe following fitting algorithms are available:\n\n| Algorithm    | Reference        |Need Ext Lib  |\n|--------------|------------------|--------------|\n| MR2T2        | [Ref](https://doi.org/10.1063/1.1699114)          | No       |\n| DelayedMR2T2 | [Ref](https://doi.org/10.1007/s11222-006-9438-0)  | No       |\n| MINUIT2      | [Ref](https://cds.cern.ch/record/2296388/)        | Yes      |\n| PSO          | [Ref](https://doi.org/10.1162/EVCO_r_00180)       | No       |\n\n## Debug\nSeveral debugging options are available which are heavy for RAM and performance and, therefore not used by default. To enable it:\n```bash\ncmake ../ -DMaCh3_DEBUG_ENABLED=\u003cON,OFF\u003e\n```\nThere are several debug modes, to enable more detailed but very heavy specific debug levels. Level 1 is the default debug activated by the above.\n\n```bash\ncmake ../ -DMaCh3_DEBUG_ENABLED=\u003cON,OFF\u003e -DDEBUG_LEVEL=\u003c1,2,3\u003e\n```\n## Logger\nSeveral logging options are available. By default, MaCh3 uses `INFO` level logging.\nYou can enable more verbose logging by specifying the desired level during configuration:\n```bash\ncmake ../ -DLOG_LEVEL=\"TRACE\"\n```\nYou can find more [here](https://github.com/mach3-software/MaCh3/blob/develop/cmake/Modules/Logger.cmake).\n\n## Other CMake Options\n\n| Option                               | Meaning                                                                         |\n| ------                               | -------                                                                         |\n| `MaCh3_NATIVE_ENABLED`               | Enables native CPU optimizations for improved performance. Not recommended on clusters with multiple CPU configurations due to potential compatibility issues.   |\n| `MaCh3_NuOsc_GPU_ENABLED`            | By default MaCh3 will use NuOscillator with GPU if MaCh3 is compiled with GPU, this flag allows disabling GPU for NuOscillator even if MaCh3 has GPU enabled     |\n| `MaCh3_LOW_MEMORY_STRUCTS_ENABLED`   | This will use float/short int for many structures |\n\n\n## System Requirements\nMaCh3 requires a C++ compiler (e.g. [gcc](https://gcc.gnu.org)), [CMake](https://cmake.org), and [ROOT](https://root.cern/). Based on several tests, recommended versions are:\n```bash\n  GCC:   \u003e= 8.5   [lower versions may work]\n  C++:   \u003e= 14\n  CMake: \u003e= 3.14\n  ROOT:  \u003e= 6.20\n```\n\nIf you don't already have the correct dependencies, you can install them in a variety of ways, e.g. building from source, via a package manager. If you have access to `cvmfs`, the easiest solution is probably to source an [LCG release](https://lcgdocs.web.cern.ch/lcgdocs/lcgreleases/introduction/). For example, on an x86_64 Alma9 machine:\n```bash\nsource /cvmfs/sft.cern.ch/lcg/views/LCG_108/x86_64-el9-gcc15-opt/setup.sh\n```\nAlternatively, you can create a conda environment which *should* provide a ready-to-go environment. If you have micromamba, you can do:\n```bash\nmicromamba env create -n MaCh3 -c conda-forge root cmake\n```\nand if you don't have micromamba installed, you can follow the instructions [here](https://mamba.readthedocs.io/en/latest/installation/micromamba-installation.html).\n\nBefore you build MaCh3 following the instructions at the [start](#building-against-mach3) of this README, make sure to activate the environment:\n```bash\nmicromamba activate MaCh3\n```\nand do this everytime you begin from a fresh terminal and want to use MaCh3.\n\n\u003e [!TIP]\n\u003e For MacOS users: the conda environment approach has been validated to work for MacOS. Other avenues are likely to be more difficult.\n\nOther external libraries, which currently include:\n1. [yaml-cpp](https://github.com/jbeder/yaml-cpp)\n2. [spdlog](https://github.com/gabime/spdlog)\n\nare being handled through [CPM](https://github.com/cpm-cmake/CPM.cmake).\n\n### Supported operational systems\n| Name        | Status |\n|-------------|--------|\n| Alma9       | ✅     |\n| Rocky9      | ✅     |\n| Ubi9        | ✅     |\n| Ubuntu22.04 | ✅     |\n| Ubuntu25.04 | ✅     |\n| Fedora32    | ✅     |\n| CentOS7     | ❔     |\n| MacOS       | ❔     |\n| Windows     | ❌     |\n\n✅ - Part of CI/CD \u003cbr\u003e\n❔ - Not part of CI/CD but used by some users/developers so it might work \u003cbr\u003e\n❌ - Not supported and no plans right now \u003cbr\u003e\n\n### Supported compilers\n| Name        | Status |\n|-------------|--------|\n| GNU         | ✅     |\n| CLANG       | ❔     |\n| INTELLLVM   | ❔     |\n| MSVC        | ❌     |\n\n✅ - Fully working with every feature fully tested by CI/CD \u003cbr\u003e\n❔ - Not every feature may work, only compilation being tested by CI/CD \u003cbr\u003e\n❌ - Not supported and no plans right now \u003cbr\u003e\n\n## Plotting and Diagnostic 📊\nExample of chain diagnostic utils can be found [here](https://github.com/mach3-software/MaCh3/tree/develop/Diagnostics) with example of config.\nThe MaCh3 core plotting library code can be found [here](https://github.com/mach3-software/MaCh3/tree/develop/plotting) along with example config files and some apps for making standard plots.\n\n## How To Use\nThis is an example how your executable can look like using MaCh3:\n```cpp\n  //Manager is responsible for reading from config\n  std::unique_ptr\u003cmanager\u003e FitManager = MaCh3ManagerFactory(argc, argv);\n\n  std::vector\u003cSampleHandlerBase*\u003e sample; //vector storing information about sample for different detector\n  std::vector\u003cParameterHandlerBase*\u003e Cov; // vector with systematic implementation\n  MakeMaCh3Instance(FitManager.get(), sample, Cov); //Factory like function which initialises everything\n\n  // FitterBase class has implementation of validation procedures and fitting algorithms\n  std::unique_ptr\u003cFitterBase\u003e MarkovChain = MaCh3FitterFactory(FitManager.get());\n\n  //Adding samples and covariances to the Fitter class could be in the factory\n  for(unsigned int i = 0; sample.size(); i++)\n    MarkovChain-\u003eAddSampleHandler(sample[i]);\n  for(unsigned int i = 0; Cov.size(); i++)\n    MarkovChain-\u003eAddSystObj(Cov[i]);\n\n  MarkovChain-\u003eRunLLHScan(); // can run LLH scan\n  MarkovChain-\u003eRunMCMC(); //or run actual fit\n```\nFor more see [here](https://github.com/mach3-software/MaCh3Tutorial/blob/main/Tutorial/MCMCTutorial.cpp)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmach3-software%2Fmach3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmach3-software%2Fmach3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmach3-software%2Fmach3/lists"}