pyBabyMaker.babymaker

class pyBabyMaker.babymaker.BabyConfigParser(parsed_config, dumped_ntuple, literals={}, debug=False)

Basic parser for YAML C++ code instruction.

__init__(parsed_config, dumped_ntuple, literals={}, debug=False)

Initialize the config parser with parsed YAML file and dumped ntuple structure.

static match(patterns, string, return_value=True)

Test if string matches at least one element in the patterns (a list of regular expression).

If there’s a match, return return_value.

parse()

Parse the loaded YAML dict (in self.parsed_config) and dumped ntuple tree structure (in self.dumped_ntuple).

static parse_calculation(config, namespace)

Parse calculation section.

classmethod parse_drop_keep_rename(config, namespace)

Parse drop, keep, rename sections.

static parse_headers(config, directive)

Parse headers section.

classmethod parse_selection(config, namespace)

Parse selection section.

class pyBabyMaker.babymaker.BabyMaker(config_filename, ntuple_filename, friend_filenames, template_filename, use_reformatter=True)

babymaker class to glue parser and code generator together.

__init__(config_filename, ntuple_filename, friend_filenames, template_filename, use_reformatter=True)

Initialize with path to YAML file and ntuple file.

debug(filename, *args, **kwargs)

Generate a debug file for the directives that will be used for C++ generation.

static directive_debug(directive)

Generate a plain-text representation of the directive.

Currently we only generate the ‘trees’ part

static directive_gen(parsed_config, dumped_ntuple, literals={}, debug=False)

Generate data structure (directive) needed for the C++ macro template.

dump_ntuples(blocked_input_trees=[])

Dump main ntuple and all friend ntuples.

gen(filename, *args, **kwargs)

Generate C++ file based on inputs.

process(literals={}, blocked_input_trees=[], blocked_output_trees=[], directive_override={}, debug=False)

Generate raw directive and tree relations. This is the basis for processing.