ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Generators
Superchic_i
python
SuperChicConfig.py
Go to the documentation of this file.
1
# Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
2
3
from
AthenaConfiguration.ComponentAccumulator
import
ComponentAccumulator
4
from
GeneratorConfig.Sequences
import
EvgenSequence, EvgenSequenceFactory
5
from
Pythia8_i.Pythia8Config
import
(
6
Pythia8BaseCfg,
7
Pythia8_A14_NNPDF23LO_Common_Cfg
8
)
9
from
AthenaCommon.SystemOfUnits
import
GeV
10
from
EvgenJobTransforms.EvgenHelpers
import
_get_nevents
11
12
# Get logger
13
from
AthenaCommon.Logging
import
logging
14
log = logging.getLogger(
"SuperChicConfig"
)
15
16
17
def
SuperChicBaseCfg
(flags, Config={}, safety=1.1,gridpack="auto", makeGridpack=False, strictGridpack=True, **kwargs):
18
"""
19
The main SuperChic configuration fragment. It creates a SuperChicControl
20
instance that stores the generator configuration parameters and is used
21
to call SuperChicUtils functions responsible for event generation.
22
23
All the configurable parameters and their default values can be found
24
in SuperChicUtils.
25
26
Gridpack options (the gridpack is written by the SuperChic init step):
27
gridpack="auto" use the gridpack mc_<E>TeV.<physics_short>.GRID.tar.gz
28
from the DSID directory if it exists, else run init
29
gridpack=<path> use this gridpack
30
gridpack=False ignore gridpacks and run init
31
makeGridpack run init and pack the grids into a gridpack
32
strictGridpack differences in input.DAT (other than iseed, nev) between
33
the gridpack and the job are errors, not warnings
34
A gridpack from a different SuperChic version or with different grid-defining
35
parameters is always an error; a different AthGeneration version is a warning.
36
"""
37
38
Config = dict(Config)
39
Config.setdefault(
"rts"
, 2*flags.Beam.Energy/GeV)
40
Config.setdefault(
"nev"
, _get_nevents(flags, safety))
41
Config.setdefault(
"iseed"
, flags.Random.SeedOffset)
42
43
# Create SuperChicControl instance and generate events
44
from
Superchic_i.SuperChicControl
import
SuperChicControl
45
control =
SuperChicControl
(Config=Config, gridpack=gridpack, makeGridpack=makeGridpack, strictGridpack=strictGridpack)
46
control.initialize()
47
control.generate()
48
49
# Create CA object
50
ca = ComponentAccumulator(EvgenSequenceFactory(EvgenSequence.Generator))
51
52
# Announce generator to service
53
from
GeneratorConfig.GeneratorInfoSvcConfig
import
GeneratorInfoSvcCfg
54
ca.merge(GeneratorInfoSvcCfg(flags, Generators=[
"SuperChic"
]), sequenceName=EvgenSequence.Generator.value)
55
56
return
ca
57
58
59
def
SuperChicPythia8BaseCfg
(flags, Config={}, **kwargs):
60
"""
61
Modular fragment for setting up base Pythia8 on top of SuperChic.
62
63
LHEFile is the path to LHE output file produced by SuperChic,
64
that is taken as input for Pythia8. If no specific output tag
65
was set in `Config`, it is set to the default "evrecs/evrecout.dat".
66
67
TestHepMC selection is additionally loosened to avoid crashes.
68
"""
69
70
# Add Pythia8
71
ca = Pythia8BaseCfg(
72
flags,
73
LHEFile=
_get_path_to_LHE
(Config),
74
**kwargs
75
)
76
77
# Add TestHepMC configuration
78
from
EvgenProdTools.EvgenProdToolsConfig
import
TestHepMCCfg
79
ca.merge(TestHepMCCfg(
80
flags,
81
MaxTransVtxDisp=1000000,
82
MaxVtxDisp=1000000000
83
))
84
85
return
ca
86
87
88
def
SuperChic_Pythia8_A14_NNPDF23LO_Common_Cfg
(flags, Config={}, **kwargs):
89
"""
90
Modular fragment for setting up Pythia8 with A14_NNPDF23LO
91
tunes on top of SuperChic.
92
93
LHEFile is the path to LHE output file produced by SuperChic,
94
that is taken as input for Pythia8. If no specific output tag
95
was set in `Config`, it is set to the default "evrecs/evrecout.dat".
96
97
TestHepMC selection is additionally loosened to avoid crashes.
98
"""
99
100
# Add Pythia8
101
ca = Pythia8_A14_NNPDF23LO_Common_Cfg(
102
flags,
103
LHEFile=
_get_path_to_LHE
(Config),
104
**kwargs
105
)
106
107
# Add TestHepMC configuration
108
from
EvgenProdTools.EvgenProdToolsConfig
import
TestHepMCCfg
109
ca.merge(TestHepMCCfg(
110
flags,
111
MaxTransVtxDisp=1000000,
112
MaxVtxDisp=1000000000
113
))
114
115
return
ca
116
117
118
def
SuperChicPythia8LheConverterUpcCfg
(flags, Config={}, **kwargs):
119
"""
120
Modular fragment for setting the LheConverterUpc.
121
"""
122
123
kwargs.setdefault(
"energy"
, 2*flags.Beam.Energy/GeV)
124
kwargs.setdefault(
"inFileName"
,
_get_path_to_LHE
(Config))
125
kwargs.setdefault(
"outFileName"
,
_get_path_to_LHE
(Config))
126
127
from
MCJobOptionUtils.LheConverterUpc
import
LheConverterUpc
128
lheConverter = LheConverterUpc(generator=
'Superchic'
,
129
mode=
'Pythia8'
,
130
**kwargs
131
)
132
133
# Create CA object
134
ca = ComponentAccumulator(EvgenSequenceFactory(EvgenSequence.Generator))
135
ca.addEventAlgo(lheConverter)
136
137
return
ca
138
139
140
def
SuperChicLheEvntFillerCfg
(flags, name="LheEVNTFiller", **kwargs):
141
"""
142
Modular fragment for setting the LheEVNTFiller.
143
"""
144
145
from
Superchic_i.EventFiller
import
LheEVNTFiller
146
147
# Create CA object
148
ca = ComponentAccumulator(EvgenSequenceFactory(EvgenSequence.Generator))
149
ca.addEventAlgo(LheEVNTFiller(
150
flags,
151
ecmEnergy=2*flags.Beam.Energy/GeV,
152
name=name,
153
**kwargs
154
))
155
156
return
ca
157
158
159
def
_get_path_to_LHE
(Config):
160
LHEFile =
"evrecs/evrecout.dat"
161
162
if
'outtg'
in
Config:
163
LHEFile = f
"evrecs/evrec{Config['outtg']}.dat"
164
165
return
LHEFile
166
SuperChicConfig.SuperChicPythia8BaseCfg
SuperChicPythia8BaseCfg(flags, Config={}, **kwargs)
Definition
SuperChicConfig.py:59
SuperChicConfig._get_path_to_LHE
_get_path_to_LHE(Config)
Definition
SuperChicConfig.py:159
SuperChicConfig.SuperChicBaseCfg
SuperChicBaseCfg(flags, Config={}, safety=1.1, gridpack="auto", makeGridpack=False, strictGridpack=True, **kwargs)
Definition
SuperChicConfig.py:17
SuperChicConfig.SuperChic_Pythia8_A14_NNPDF23LO_Common_Cfg
SuperChic_Pythia8_A14_NNPDF23LO_Common_Cfg(flags, Config={}, **kwargs)
Definition
SuperChicConfig.py:88
SuperChicConfig.SuperChicLheEvntFillerCfg
SuperChicLheEvntFillerCfg(flags, name="LheEVNTFiller", **kwargs)
Definition
SuperChicConfig.py:140
SuperChicConfig.SuperChicPythia8LheConverterUpcCfg
SuperChicPythia8LheConverterUpcCfg(flags, Config={}, **kwargs)
Definition
SuperChicConfig.py:118
SuperChicControl
Definition
SuperChicControl.py:1
Generated on
for ATLAS Offline Software by
1.17.0