ATLAS Offline Software
Loading...
Searching...
No Matches
Herwig7CAConfig Namespace Reference

Functions

 _builtin_me_local_pre_commands ()
 _builtin_me_local_post_commands (run_name)
 _finalize_h7c_commands (h7c, shower_var=True)
 Herwig7BaseCfg (flags, name="Herwig7", run_name="Herwig", **kwargs)
 Herwig7BuiltinMECfg (flags, name="Herwig7", run_name="Herwig", **kwargs)

Detailed Description

This module contains all the CA fragments for Herwig7.

It is analogous to MadGraphConfig.py but more CA friendly since it avoids side effects.
It creates the Athena Herwig7 algorithm, hands the flags to the
control object H7C, and adds the configured algorithm to the evgen
sequence. The actual execution happens later when Athena runs the sequence.

Function Documentation

◆ _builtin_me_local_post_commands()

Herwig7CAConfig._builtin_me_local_post_commands ( run_name)
protected
Default local post-commands for built-in matrix-element setups

Definition at line 34 of file Herwig7CAConfig.py.

34def _builtin_me_local_post_commands(run_name):
35 """Default local post-commands for built-in matrix-element setups"""
36 return dedent(
37 f"""
38 ## ==================================================
39 ## Local Post-Commands from Herwig7ConfigBuiltinME.py
40 ## ==================================================
41
42 saverun {run_name} /Herwig/Generators/EventGenerator
43 """
44 )
45
46

◆ _builtin_me_local_pre_commands()

Herwig7CAConfig._builtin_me_local_pre_commands ( )
protected
Default local pre-commands for built-in matrix-element setups

Definition at line 21 of file Herwig7CAConfig.py.

21def _builtin_me_local_pre_commands():
22 """Default local pre-commands for built-in matrix-element setups"""
23 return dedent(
24 """
25 ## =================================================
26 ## Local Pre-Commands from Herwig7ConfigBuiltinME.py
27 ## =================================================
28
29 # > no local pre-commands at the moment
30 """
31 )
32
33

◆ _finalize_h7c_commands()

Herwig7CAConfig._finalize_h7c_commands ( h7c,
shower_var = True )
protected
Add the necessary settings fir beams, energy, seed,
etc. It uses the h7c object which inherits from Hw7Config,
so several of the methods called below are defined in the parent class.

Definition at line 47 of file Herwig7CAConfig.py.

47def _finalize_h7c_commands(h7c, shower_var=True):
48 """
49 Add the necessary settings fir beams, energy, seed,
50 etc. It uses the h7c object which inherits from Hw7Config,
51 so several of the methods called below are defined in the parent class.
52 """
53 h7c.default_commands += h7c.beam_commands()
54 h7c.default_commands += h7c.energy_commands()
55 h7c.default_commands += h7c.random_seed_commands()
56
57 if not h7c.set_printout_commands:
58 h7c.default_commands += h7c.printout_commands()
59 if not h7c.set_physics_parameter_commands:
60 h7c.default_commands += h7c.physics_parameter_commands()
61 if not h7c.set_technical_parameter_commands:
62 h7c.default_commands += h7c.technical_parameter_commands()
63
64 h7c.enable_angularShowerScaleVariations(shower_var)
65
66

◆ Herwig7BaseCfg()

Herwig7CAConfig.Herwig7BaseCfg ( flags,
name = "Herwig7",
run_name = "Herwig",
** kwargs )
This is the CA equivalent of Herwig7Config.py

Definition at line 67 of file Herwig7CAConfig.py.

70 **kwargs):
71 """This is the CA equivalent of Herwig7Config.py"""
72
73 commands = kwargs.pop("commands", None)
74 shower_var = kwargs.pop("shower_var", True)
75 cleanup_herwig_scratch = kwargs.pop("cleanup_herwig_scratch", False)
76 local_pre_commands = kwargs.pop("local_pre_commands", None)
77 local_post_commands = kwargs.pop("local_post_commands", None)
78 me_pdf_order = kwargs.pop("me_pdf_order", None)
79 me_pdf_name = kwargs.pop("me_pdf_name", None)
80 mpi_pdf_name = kwargs.pop("mpi_pdf_name", None)
81 shower_pdf_order = kwargs.pop("shower_pdf_order", None)
82 shower_pdf_name = kwargs.pop("shower_pdf_name", None)
83
84 # Pop the tune - we don't want the user to set it in the jO
85 # and we also don't want to forward it to the C++ instance
86 # via the herwig7 object below
87 kwargs.pop("tune", None)
88
89 # Instantiate H7 algorithm with base settings
90 # TODO: add deduplication using GeneratorSettingsLayer as done in Pythia
91 herwig7 = CompFactory.Herwig7(name, **kwargs)
92 h7c = H7C(
93 flags,
94 run_name=run_name,
95 local_pre_commands=local_pre_commands,
96 local_post_commands=local_post_commands
97 )
98 h7c.add_flags(flags)
99
100 if me_pdf_name is not None:
101 h7c.me_pdf_commands(order=me_pdf_order or "NLO", name=me_pdf_name)
102
103 if mpi_pdf_name is not None:
104 h7c.mpi_pdf_commands(name=mpi_pdf_name)
105
106 if shower_pdf_name is not None:
107 h7c.shower_pdf_commands(order=shower_pdf_order or "LO", name=shower_pdf_name)
108
109 if commands:
110 h7c.add_commands(dedent(commands))
111
112 _finalize_h7c_commands(h7c, shower_var=shower_var)
113
114 from Herwig7_i import Herwig7Control as hw7Control
115
116 run_settings = hw7Control.render_infile(h7c)
117 hw7Control.configure_algorithm(
118 herwig7,
119 hw7Control.get_runfile_name(h7c.run_name),
120 h7c.random_seed,
121 me_pdf_name=h7c.me_pdf_name,
122 mpi_pdf_name=h7c.mpi_pdf_name,
123 cleanup_herwig_scratch=cleanup_herwig_scratch,
124 run_settings=run_settings,
125 )
126
127 # The algorithm is scheduled here. Athena executes it later with the evgen sequence
128 # so that there are no side effects.
129 ca = ComponentAccumulator(EvgenSequenceFactory(EvgenSequence.Generator))
130 ca.addEventAlgo(herwig7)
131
132 from GeneratorConfig.GeneratorInfoSvcConfig import GeneratorInfoSvcCfg
133 ca.merge(
134 GeneratorInfoSvcCfg(flags,
135 Generators=["Herwig7"],
136 Tune=hw7Control.default_tune_name()
137 )
138 )
139
140 return ca
141
142
Definition H7C.py:1

◆ Herwig7BuiltinMECfg()

Herwig7CAConfig.Herwig7BuiltinMECfg ( flags,
name = "Herwig7",
run_name = "Herwig",
** kwargs )
This is the CA equivalent of Herwig7ConfigBuiltinME.py

Definition at line 143 of file Herwig7CAConfig.py.

146 **kwargs):
147 """This is the CA equivalent of Herwig7ConfigBuiltinME.py"""
148
149 kwargs.setdefault("local_pre_commands", _builtin_me_local_pre_commands)
150 kwargs.setdefault("local_post_commands", lambda: _builtin_me_local_post_commands(run_name))
151
152 # Get CA from base fragment
153 return Herwig7BaseCfg(
154 flags,
155 name=name,
156 run_name=run_name,
157 **kwargs
158 )