Skip to main content

Project used to apply selection to ntuples used for RX measurements filtered and skimmed by post_ap project

Project description

[TOC]

$R_X$ selection

This project is meant to apply an offline selection to ntuples produced by post_ap and downloaded with rx_data. the selection is done with jobs sent to an HTCondor cluster.

How to pick up selection and apply it to data and MC

For this do:

from rx_selection import selection as sel

# trigger : HLT2 trigger, e.g. Hlt2RD_BuToKpEE_MVA 
# q2bin   : low, central, jpsi, psi2, high
# smeared : If true (default), the selection will use cuts on smeared masses. Only makes sense for electron MC samples
# process : 
#     One of the keys in https://gitlab.cern.ch/rx_run3/rx_data/-/blob/master/src/rx_data_lfns/rx/v7/rk_samples.yaml
#     DATA will do all the data combined

d_sel = sel.selection(trigger='Hlt2RD_BuToKpEE_MVA', q2bin='jpsi', process='DATA', smeared=True)

# You can override the selection here
for cut_name, cut_value in d_sel.items():
    rdf = rdf.Filter(cut_value, cut_name)

rep = rdf.Report()
# Here you cross check that the cuts were applied and see the statistics
rep.Print()

Changing selection

Overriding default

The selection stored in the config files can be overriden with:

from rx_selection import selection as sel

with sel.custom_selection(d_sel = {'bdt' : 'mva_cmb > 0.1'}):
    run_function_that_uses_selection()

This will make sure that the bdt field:

  • Is added with a mva_cmb > 0.1 cut, if it does not exist
  • Is updated, if it exists

inside the context, outside, the nominal selection will be used.

This manager implements a lock that prevents custom selections from been set more than once in a nested way.

If the user has to use a ustom selection inside a context already using a custom selection, he has to use:

from rx_selection import selection as sel

with sel.custom_selection(d_sel = {'bdt_cmb' : 'mva_cmb > 0.1'}):
    # mva_cmb cut added on top of default selection
    run_with_cmb_cut()
    with sel.custom_selection(d_sel = {'bdt_prc' : 'mva_prc > 0.2'}, force_override=True):
        # mva_prc cut added on top of default selection
        run_with_prc_cut()

Overriding current selection

In order to override whatever is the current selection do:

from rx_selection import selection as sel

with sel.custom_selection(d_sel = {'bdt' : 'mva_cmb > 0.1'}):
    # Here you run with mva_cmb only
    with sel.update_selection(d_sel = {'bdt_prc' : 'mva_prc > 0.2'}):
        # Here you run with both mva_cmb and mva_prc
        run_function_that_uses_selection()

This will not override the default selection, as custom_selection does. It will override the current selection, which might be a custom selection.

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

rx_selection-0.1.9.dev298.tar.gz (16.1 kB view details)

Uploaded Source

Built Distribution

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

rx_selection-0.1.9.dev298-py3-none-any.whl (21.2 kB view details)

Uploaded Python 3

File details

Details for the file rx_selection-0.1.9.dev298.tar.gz.

File metadata

  • Download URL: rx_selection-0.1.9.dev298.tar.gz
  • Upload date:
  • Size: 16.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for rx_selection-0.1.9.dev298.tar.gz
Algorithm Hash digest
SHA256 f9d41442557fe15a354c5722e1981dcb0ff8cc4d29e9c98e0d29b6054f4c74f9
MD5 c766091da430d2cd293544b40f477a5d
BLAKE2b-256 08c7896891c54079fee5aea582b95f46c3cc25a786fcfab28d75ec7caf837155

See more details on using hashes here.

Provenance

The following attestation bundles were made for rx_selection-0.1.9.dev298.tar.gz:

Publisher: publish.yaml on RX-Run3/rx_selection

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_selection-0.1.9.dev298-py3-none-any.whl.

File metadata

File hashes

Hashes for rx_selection-0.1.9.dev298-py3-none-any.whl
Algorithm Hash digest
SHA256 95b7de0c6790006acdff0fe176fc170af38cede96aa91052dde4c968b0ce0cf7
MD5 664fed9b8fd7ee7f78a04314a52f0da9
BLAKE2b-256 dd8a4cb6cc0c41868441812128f38d30b5e776668bd84613206f377077dd8925

See more details on using hashes here.

Provenance

The following attestation bundles were made for rx_selection-0.1.9.dev298-py3-none-any.whl:

Publisher: publish.yaml on RX-Run3/rx_selection

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