Command Line Applications

twaml-root2pytables

Convert a set of ROOT files into a single pytables HDF5 file.

$ twaml-root2pytables --help
usage: twaml-root2pytables [-h] -i INPUT_FILES [INPUT_FILES ...] -n NAME -o
                           OUT_FILE [-b BRANCHES [BRANCHES ...]]
                           [--tree-name TREE_NAME] [--weight-name WEIGHT_NAME]
                           [--auxweights AUXWEIGHTS [AUXWEIGHTS ...]]
                           [--selection SELECTION] [--detect-weights]
                           [--nthreads NTHREADS]

Convert ROOT files to a pytables hdf5 dataset via twaml.data.root_dataset and
twaml.data.dataset.to_pytables

optional arguments:
  -h, --help            show this help message and exit
  -i INPUT_FILES [INPUT_FILES ...], --input-files INPUT_FILES [INPUT_FILES ...]
                        input ROOT files
  -n NAME, --name NAME  dataset name (required when reading back into
                        twaml.data.dataset)
  -o OUT_FILE, --out-file OUT_FILE
                        Output h5 file (existing file will be overwritten)
  -b BRANCHES [BRANCHES ...], --branches BRANCHES [BRANCHES ...]
                        branches to save (defaults to all)
  --tree-name TREE_NAME
                        tree name
  --weight-name WEIGHT_NAME
                        weight branch name
  --auxweights AUXWEIGHTS [AUXWEIGHTS ...]
                        extra auxiliary weights to save
  --selection SELECTION
                        A selection string or YAML file containing a map of
                        selections (see `selection` argument docs in
                        `twaml.dataset.from_root`)
  --detect-weights      detect weights in the dataset, --auxweights overrides
                        this
  --nthreads NTHREADS   number of threads to use via ThreadPoolExecutor

An example that uses the default --tree-name and --weight-name, while only saving the branches b1 and b2 and requiring the branch elmu to be true and pT_lep1 to be greater than 50 to save the event.

$ twaml-root2pytables -i file.root -o file.h5 --branches b1 b2 \
      --selection "(elmu == True) & (pT_lep1 > 50)"

The docs for the function that is being called:

twaml._apps.root2pytables()[source]

command line application which converts a set of ROOT files into a pytables HDF5 file via the twaml.data.root_dataset function and the to_pytables member function of the twaml.data.dataset class.