ATLAS Offline Software
Loading...
Searching...
No Matches
python.SherpaConfig Namespace Reference

Functions

 SherpaBaseCfg (flags, name="Sherpa_i", **kwargs)
 _SherpaBaseCfg (flags, name="Sherpa_i", _base_fragment="", **kwargs)
 Sherpa3_PDF4LHC21_Cfg (flags, **kwargs)

Variables

 log = logging.getLogger("SherpaConfig")

Function Documentation

◆ _SherpaBaseCfg()

python.SherpaConfig._SherpaBaseCfg ( flags,
name = "Sherpa_i",
_base_fragment = "",
** kwargs )
protected
Internal Sherpa base fragment builder.

Definition at line 37 of file SherpaConfig.py.

37def _SherpaBaseCfg(flags, name="Sherpa_i", _base_fragment="", **kwargs):
38 """
39 Internal Sherpa base fragment builder.
40 """
41
42 kwargs.setdefault("PluginCode", "")
43
44 # Build the Base.yaml fragment from an optional internal prefix plus Sherpa3 defaults.
45 base_fragment = _base_fragment
46 if base_fragment and not base_fragment.endswith("\n"):
47 base_fragment += "\n"
48 kwargs["BaseFragment"] = base_fragment + build_sherpa3_base_fragment(flags)
49 validate_sherpa3_yaml_fragment("BaseFragment", kwargs["BaseFragment"])
50 if "RunCard" in kwargs:
51 validate_sherpa3_yaml_fragment("RunCard", kwargs["RunCard"])
52
53 # Create CA object and add Sherpa algorithm
54 ca = ComponentAccumulator(EvgenSequenceFactory(EvgenSequence.Generator))
55 ca.addEventAlgo(CompFactory.Sherpa_i(name, **kwargs))
56
57 # Announce generator to service
58 from GeneratorConfig.GeneratorInfoSvcConfig import GeneratorInfoSvcCfg
59 ca.merge(GeneratorInfoSvcCfg(flags, Generators=["Sherpa"]))
60
61 return ca
62
63

◆ Sherpa3_PDF4LHC21_Cfg()

python.SherpaConfig.Sherpa3_PDF4LHC21_Cfg ( flags,
** kwargs )
Fragment for setting up Sherpa 3 with the PDF4LHC21 tune

Definition at line 64 of file SherpaConfig.py.

64def Sherpa3_PDF4LHC21_Cfg(flags, **kwargs):
65 """Fragment for setting up Sherpa 3 with the PDF4LHC21 tune"""
66
67 from os import environ
68 sherpa_version = environ.get("SHERPAVER")
69 if sherpa_version is None:
70 raise RuntimeError("SHERPAVER is not set in the environment.")
71 if not sherpa_version.startswith("3."):
72 raise RuntimeError("Sherpa3_PDF4LHC21_Cfg requires Sherpa 3.")
73
74 # Nominal PDF settings
75 pdf_fragment = write_pretty_fragment(
76 """
77 PDF_LIBRARY: LHAPDFSherpa
78 USE_PDF_ALPHAS: 1
79 PDF_SET: PDF4LHC21_40_pdfas
80 """
81 )
82
83 # Enable PDF variations by default
84 pdf_fragment += write_pretty_fragment(
85 """
86 PDF_VARIATIONS:
87 - PDF4LHC21_40_pdfas*
88 - MSHT20nnlo_as118
89 - CT18NNLO_as_0118
90 - NNPDF31_nnlo_as_0118_hessian
91 - NNPDF40_nnlo_as_01180_hessian
92 - CT18ANNLO
93 - CT18XNNLO
94 - CT18ZNNLO
95 """
96 )
97
98 # Append PDF settings through the internal BaseFragment prefix and create the CA object.
99 ca = _SherpaBaseCfg(flags, _base_fragment=pdf_fragment, **kwargs)
100
101 # Broadcast tune to service
102 from GeneratorConfig.GeneratorInfoSvcConfig import GeneratorInfoSvcCfg
103 ca.merge(GeneratorInfoSvcCfg(flags, Tune="PDF4LHC21"))
104
105 return ca

◆ SherpaBaseCfg()

python.SherpaConfig.SherpaBaseCfg ( flags,
name = "Sherpa_i",
** kwargs )
Public methods for Sherpa CA configuration fragment, 
migrated from Sherpa_i/share/common/Base_Fragment.py.
This is the the method that users should call (if needed)
in their jO. We don't want them to change the BaseFragment 
so we pop it from kwargs before calling the internal function.

Definition at line 24 of file SherpaConfig.py.

24def SherpaBaseCfg(flags, name="Sherpa_i", **kwargs):
25 """
26 Public methods for Sherpa CA configuration fragment,
27 migrated from Sherpa_i/share/common/Base_Fragment.py.
28 This is the the method that users should call (if needed)
29 in their jO. We don't want them to change the BaseFragment
30 so we pop it from kwargs before calling the internal function.
31 """
32 kwargs.pop("BaseFragment", None)
33
34 return _SherpaBaseCfg(flags, name=name, **kwargs)
35
36

Variable Documentation

◆ log

python.SherpaConfig.log = logging.getLogger("SherpaConfig")

Definition at line 14 of file SherpaConfig.py.