Skip to content
  • Enrico Bothmann's avatar
    Rewrite settings input using YAML · eb96f45c
    Enrico Bothmann authored
    This commit closes #10.
    
    - Replace custom configuration parsing and format with a YAML-based
      solution
    - Improve implementation of settings handling to enable features such
      as:
      - Generally only specify defaults once in the code, not scattered
        throughout with possibly different values
      - Print comprehensive report of values used for each setting at the
        end of a run
      - Warn when a setting is specified that is not used during a run (this
        is foreseen and now possible, but not implemented yet)
    
    NOTE: This is a squashed commit to keep the commit history of master
    simple. The full history of the development branch will be retained as
    10-rewrite-settings-input+commit-history in case it is needed, e.g. to
    find a (small) changeset that introduced a bug using git-bisect.
    
    A good example for new syntax is:
    Examples/V_plus_Jets/LHC_WJets/Sherpa.yaml
    
    The command line can process words using the YAML syntax, but also
    supports the old legacy syntax, at least for scalar settings.
    
    In the code, setting default settings and getting the resolved value
    for a setting can be done e.g. as follows:
    
    ```
    auto hds = Settings::GetMainSettings()["HARD_DECAYS"];
    const auto apply_br
      = hds["Apply_Branching_Ratios"].SetDefault(true).Get<bool>();
    ```
    
    Note also that Sherpa can now process several configuration files:
    `Sherpa "RUNDATA: [1.yaml, 2.yaml, ...]"`, with settings in files to the
    right taking precedence over settings in files to the left. This can be
    useful for specifying base set-ups and then deriving specialisations.
    
    A more detailed discussion of the new settings architecture is given
    in
    https://gitlab.com/sherpa-team/sherpa/wikis/The-new-Settings-implementation
    (accessing this link might require developer access to the repository).
    
    Lastly, note that physics results are guaranteed to stay the same after
    this commit. If you find that to be not true, please contact me. When
    soft physics is used, numerics sometimes causes the statistics not to be
    the same after this commit. However, I've got some patches to mitigate
    this to some degree. So in any case, contact me if you find differences
    between results generated with this commit and the preceding one.
    eb96f45c