Skip to content

Hierarchical yaml structure for TTree config, supporting multiple trees

Teng Jian Khoo requested to merge khoo/easyjet:tree-yaml-hierarchy into master

Addresses #84 (closed)

Firstly, this builds more structure into AnalysisMiniTree-config.yaml as a template for output TTree configuration that can be passed into minituple_cfg(). Easiest simply to refer to this file for the model.

In the top-level RunConfig, we then set it up as follows (AnalysisMiniTreeCopy is hypothetical):

ttree_output:
  ttree_names:
    - AnalysisMiniTree
    - AnalysisMiniTreeCopy
  AnalysisMiniTree:
    include: AnalysisMiniTree-config.yaml
  AnalysisMiniTreeCopy:
    include: AnalysisMiniTree-config.yaml
    tree_name: AnalysisMiniTreeCopy

and could of course modify more of the details of AnalysisMiniTreeCopy, or import a different yaml file there.

In the standard output configuration, we then loop over all the defined tree configs -- minor workaround above so that we iterate over the list of tree (config) names and then use the name to retrieve the config flags for that tree:

if flags.Analysis.out_file:
   for tree_name in flags.Analysis.ttree_output.ttree_names:
       cfg.merge(
           minituple_cfg(
               flags,tree_name,
               flags.Analysis.out_file,
           ),
           seqname,
        )

This is more as an example, as these trees will all have the same event selection and are limited to go to the same output file. However, in a more custom setup, one could build separate sequences each with their own filter algorithms, and plug the corresponding tree in as desired.

Edited by Teng Jian Khoo

Merge request reports