Friend Trees
- class code_generation.friend_trees.FriendTreeConfiguration(era, sample, scope, shifts, available_sample_types, available_eras, available_scopes, input_information)[source]
Configuration class for a FriendTree production with the CROWN framework. Based on the main Configuration class, but with a few modifications nessessary for a FriendTree configuration. The biggest differences are
the nominal version of quantities is optional and should only run if the user specifies it
no global scope is required
only one scope is allowed
The ordering is not optimized, but taken directly from the configuration file
information about the input file is required. This information can be provided by a json file, or by providing an input root file.
When using an input root file, only a single sample type and a single scope are allowed
Generate a configuration for a FriendTree production.
- Parameters:
era (str) – The era of the sample
sample (str) – The sample type
scope (Union[str, List[str]]) – The scope of the sample
shifts (Set[str]) – The shifts to be applied, can be “all”, “none” or a list of shifts
available_sample_types (Union[str, List[str]]) – A list of available sample types
available_eras (Union[str, List[str]]) – A list of available eras
available_scopes (Union[str, List[str]]) – A list of available scopes
input_information (Union[str, Dict[str, List[str]]]) – Information about the input file. Can be a json file or a root file
- add_modification_rule(scopes, rule)[source]
Function used to add a rule to the configuration.
- Parameters:
scopes (str | List[str]) – The scopes to which the rule should be added. This can be a list of scopes or a single scope.
rule (ProducerRule) – The rule to be added. This must be a ProducerRule object.
- Returns:
None
- Return type:
None
- expanded_configuration()[source]
Function used to generate an expanded version of the configuration, where all shifts are applied. This expanded configuration is used by the code generator to generate the C++ code.
- Returns:
Expanded configuration
- Return type:
- optimize()[source]
Function used to optimize the FriendTreeConfiguration. In this case, no ordering optimization is performed. Optimizaion steps are:
Apply rules
- Add all requested shifts to all producers. This addition is trivial, since
the shifted quantities are already available in the input file
Remove empty scopes
- Parameters:
None
- Returns:
None
- Return type:
None