Skip to main content

Generalised graph neural network based fast simulation tool for LHCb.

Project description

Rex Banner

Rex

Rex offers a fast emulation of the LHCb detector simulation. From truth level kinematics to reconstructed quantities and all commonly used reconstruction quality variables.

Table of Contents

About

A full description of the tool can be found in this 📖 arXiv preprint.

📖 Project Docs | 💬 Mattermost Chat | 📬 Developer Email

Installation

On lxplus

Set some environment variables

export REX_DIR=/afs/cern.ch/work/X/XXXXXXX/Rex_install
export REX_WEIGHT_DIR=$REX_DIR  # note without this variable set weights default to ~/.cache/lhcb_rex/
export RAPIDSIM_ROOT=$REX_DIR/RapidSim

Make package install directory

mkdir $REX_DIR

Install RapidSim

source /cvmfs/sft.cern.ch/lcg/views/setupViews.sh LCG_105 x86_64-el9-gcc11-opt
cd $REX_DIR && git clone git@github.com:gcowan/RapidSim.git && cd RapidSim && mkdir build && cd build && cmake .. && make -j4 && cd $REX_DIR

for full use of the package we also need an EVTGEN install evtgen.hepforge.

export EVTGEN_ROOT=....

Create new localised python environment and install lhcb_rex

uv venv --python 3.9
source $REX_DIR.venv/bin/activate
uv pip install lhcb_rex

remove any reference to /cvmfs/ from PYTHONPATH (had problemes with cross-contamination)

export PYTHONPATH=$(echo "$PYTHONPATH" | tr ':' '\n' | grep -v "/cvmfs/sft.cern.ch" | paste -sd ':' -)

change version of safetensors

pip uninstall safetensors
pip install safetensors==0.5.3

Check install has succeeded

python -c "import lhcb_rex"

or

python -c 'import lhcb_rex; lhcb_rex.run(events=1000,decay="Bs0 -> mu+ mu-",naming_scheme="MOTHER -> DAUGHTER1 DAUGHTER2",decay_models="PHSP -> NA NA",workingDir="./Bs_mumu",)'

Create ~/rex_setup.sh to configure environment next time, something like this

export REX_DIR=/afs/cern.ch/work/X/XXXXXXX/Rex_install
export REX_WEIGHT_DIR=$REX_DIR
export RAPIDSIM_ROOT=~/RapidSim
source /cvmfs/sft.cern.ch/lcg/views/setupViews.sh LCG_105 x86_64-el9-gcc11-opt
export PYTHONPATH=$(echo "$PYTHONPATH" | tr ':' '\n' | grep -v "/cvmfs/sft.cern.ch" | paste -sd ':' -)
source $REX_DIR/.venv/bin/activate

then on login

source ~/rex_setup.sh

Usage

Examples below

Click to see an example
import lhcb_rex

lhcb_rex.run(
    events=1000,
    decay="Bs0 -> mu+ mu-",
    naming_scheme="MOTHER -> DAUGHTER1 DAUGHTER2",
    decay_models="PHSP -> NA NA",
    workingDir="./Bs_mumu",
)

Installation for development

git clone
uv sync
uv run pip install -e .

📬 Have questions? Reach out at alex.marshall@bristol.ac.uk

Notes for me

/dice/users/am13743/fast_vertex_quality/graveyard /dice/users/am13743/fast_vertex_quality/checkpoints/

Relevant tags/checkpoints:

  • 21_03_2025 - Plotting for paper draft
rm -rf dist/
uv build
uv publish

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lhcb_rex-0.1.4.tar.gz (3.4 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lhcb_rex-0.1.4-py3-none-any.whl (3.4 MB view details)

Uploaded Python 3

File details

Details for the file lhcb_rex-0.1.4.tar.gz.

File metadata

  • Download URL: lhcb_rex-0.1.4.tar.gz
  • Upload date:
  • Size: 3.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.3

File hashes

Hashes for lhcb_rex-0.1.4.tar.gz
Algorithm Hash digest
SHA256 dbe90e559ddc786ff0b62500343d5f47afb872ba61c3e91b3b0ab6b928ba5274
MD5 b93fc1dad7c5a0d8705d056388c8b12c
BLAKE2b-256 de51253662c8883fb3e0f533fadd11ca6099f5c11c98cc2444a738a82533edbe

See more details on using hashes here.

File details

Details for the file lhcb_rex-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: lhcb_rex-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 3.4 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.3

File hashes

Hashes for lhcb_rex-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 faed619c5bf8f3e9366313a11e1e6bf9cfbb7b4c425986da7c4904e024ffcce9
MD5 5d7078f92193fdd76640b3d7c78d14f2
BLAKE2b-256 bcfae20372f7552e31d4a6b70777d52598e5cccb421bf45e7d6536cded298ee5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page