Skip to main content

Project with lists of LFNs and utilities needed to download filteres ntuples

Project description

$R_X$ data

This repository contains:

  • Versioned lists of LFNs
  • Utilities to download them and link them into a tree structure

for all the $R_X$ like analyses.

Installation

To install this project run:

pip install rx_data

# The line below will upgrade it, in case new samples are available, the list of LFNs is part of the
# project itself
pip install --upgrade rx_data

The download would require a grid proxy, which can be made with:

. /cvmfs/lhcb.cern.ch/lib/LbEnv

# This will create a 100 hours long proxy
lhcb-proxy-init -v 100:00

Listing available triggers

In order to see what triggers are present in the current version of the ntuples do:

list_triggers -v v1

# And this will save them to a yaml file
list_triggers -v v1 -o triggers.yaml

Downloading the ntuples

For this, run:

download_rx_data -m 5 -p /path/to/downloaded/.data -v v1 -d -t triggers.yaml

which will use 5 threads to download the ntuples associated to the triggers in triggers.yaml and version v1 to the specified path.

IMPORTANT:

  • In order to prevent deleting the data, save it in a hiden folder, e.g. one starting with a period. Above it is .data.
  • This path is optional, one can export DOWNLOAD_NTUPPATH and the path will be picked up

Potential problems: The download happens through XROOTD, which will try to pick a kerberos token. If authentication problems happen, do:

which kinit

and make sure that your kinit does not come from a virtual environment but it is the one in the LHCb stack or the native one.

Organizing paths

Building directory structure

All the ntuples will be downloaded in a single directory. In order to group them by sample and trigger run:

make_tree_structure -i /path/to/downloaded/.data/v1 -o /path/to/directory/structure

this will not make a copy of the ntuples, it will only create symbolic links to them.

Making YAML with files list

If instead one does:

make_tree_structure -i /path/to/downloaded/.data/v1 -f samples.yaml

the links won't be made, instead a YAML file will be created with the list of files for each sample and trigger.

Lists from files in the grid

If instead of taking the downloaded files, one wants the ones in the grid, one can do:

make_tree_structure -v v4 -f samples.yaml

where v4 is the version of the JSON files holding the LFNs. In case one needs the old naming, used in Run1 and Run2 one would run:

make_tree_structure -v v4 -f samples.yaml -n old

This will likely drop samples that have no old naming, because they were not used in the past.

Dropping triggers

The YAML outputs of the commands above will be very large and not all of it will be needed. One can drop triggers by:

# This will dump a list of triggers to triggers.yaml
# You can optionally remove not needed triggers
list_triggers -v v4 -o triggers.yaml

# This will use those triggers only to make samples.yaml
make_tree_structure -v v4 -f samples.yaml -t triggers.yaml

Samples naming

The samples were named after the DecFiles names for the samples and:

  • Replacing certain special charactes as shown here
  • Adding a _SS suffix for split sim samples. I.e. samples where the photon converts into an electron pair.

A useful guide showing the correspondence between event type and name is here

Accessing ntuples

If the ntuples are stored in a directory where each tuple is accompanied by a friend tree, a preliminary step that attaches all friend trees is needed. This is done by RDFGetter as shown below:

from rx_data.rdf_getter     import RDFGetter

# This is where the directories with the samples are
RDFGetter.samples_dir = '/publicfs/ucas/user/campoverde/Data/RX_run3/v4/NO_q2_bdt_mass_Q2_central_VR_v1'

# This picks one sample for a given trigger
# The sample accepts wildcards, e.g. `DATA_24_MagUp_24c*` for all the periods
gtr = RDFGetter(sample='DATA_24_MagUp_24c2', trigger='Hlt2RD_BuToKpMuMu_MVA')
rdf = gtr.get_rdf()

In the case of the MVA friend trees the branches added would be mva.mva_cmb and mva.mva_prc.

Accessing metadata

Information on the ntuples can be accessed through the metadata instance of the TStringObj class, which is stored in the ROOT files. This information can be dumped in a YAML file for easy access with:

dump_metadata -f root://x509up_u12477@eoslhcb.cern.ch//eos/lhcb/grid/user/lhcb/user/a/acampove/2025_02/1044184/1044184991/data_24_magdown_turbo_24c2_Hlt2RD_BuToKpEE_MVA_4df98a7f32.root

which will produce metadata.yaml.

Project details


Release history Release notifications | RSS feed

This version

0.1.6

Download files

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

Source Distribution

rx_data-0.1.6.tar.gz (3.7 MB view details)

Uploaded Source

Built Distribution

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

rx_data-0.1.6-py3-none-any.whl (3.7 MB view details)

Uploaded Python 3

File details

Details for the file rx_data-0.1.6.tar.gz.

File metadata

  • Download URL: rx_data-0.1.6.tar.gz
  • Upload date:
  • Size: 3.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for rx_data-0.1.6.tar.gz
Algorithm Hash digest
SHA256 62fbc9edc88b7edca3be7f326f03eaa0b3cf82fd4df821227f7b59b5f8abac00
MD5 a5a556f759a047acbba0e4c08df12ff4
BLAKE2b-256 52715dab830d837af68d6f9ce823a60cda8472c5821002eca1dab792d7a05b7a

See more details on using hashes here.

Provenance

The following attestation bundles were made for rx_data-0.1.6.tar.gz:

Publisher: publish.yaml on acampove/rx_data

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rx_data-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: rx_data-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 3.7 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for rx_data-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 d60b61a8c9dcaa0a8d9449f87adac4a42011db0c2a72a601d414312db3e89688
MD5 6210bd835216aae394c573c01a1445fe
BLAKE2b-256 a9ee375dc0fb0d9a6429e7609a464cf74a8a637b8bc49d339979d31e4a6cc4e7

See more details on using hashes here.

Provenance

The following attestation bundles were made for rx_data-0.1.6-py3-none-any.whl:

Publisher: publish.yaml on acampove/rx_data

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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