ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Generators
Starlight_i
python
StarlightConfig.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
AthenaConfiguration.ComponentFactory
import
CompFactory
5
from
GeneratorConfig.GeneratorSettingsSemantics
import
(
6
GeneratorSettingsLayer,
7
GeneratorSettingsPrecedence,
8
)
9
from
GeneratorConfig.Sequences
import
EvgenSequence, EvgenSequenceFactory
10
from
EvgenJobTransforms.EvgenHelpers
import
_get_nevents
11
from
Pythia8_i.Pythia8Config
import
Pythia8_A14_NNPDF23LO_Common_Cfg
12
from
AthenaCommon.SystemOfUnits
import
GeV
13
14
# Get logger
15
from
AthenaCommon.Logging
import
logging
16
log = logging.getLogger(
"StarlightConfig"
)
17
18
19
def
StarlightInitializeCfg
(flags, source, values, precedence, name="Starlight_i"):
20
"""
21
Return a CA fragment that adds one initialize layer to Starlight_i.
22
"""
23
ca = ComponentAccumulator(EvgenSequenceFactory(EvgenSequence.Generator))
24
ca.addEventAlgo(
25
CompFactory.Starlight_i(name, Initialize=GeneratorSettingsLayer(
26
source=source,
27
values=tuple(values
or
()),
28
precedence=precedence,
29
report_context=
"Starlight.Initialize"
,
30
))
31
)
32
return
ca
33
34
35
def
StarlightBaseCfg
(flags, name="Starlight_i", safety=1., **kwargs):
36
"""
37
The main Starlight configuration fragment that sets up the Starlight_i algorithm
38
and returns a CA instance.
39
By default Starlight is set to Pb+Pb collisions.
40
"""
41
42
# By default write output directly to HepMC
43
kwargs.setdefault(
"lheOutput"
,
False
)
44
45
# If lhe output is requested `maxevents` determines the number of events written
46
# to lhe file, else events are generated one by one and `maxevents` is not utilised
47
kwargs.setdefault(
"maxevents"
, _get_nevents(flags, safety))
48
49
# Gamma calculation for Pb208
50
# Gamma = E(Pb208) / (m(Pb208) in a.u. * atomic mass unit in GeV)
51
gamma = 208*flags.Beam.Energy/GeV / (207.9766359 * 0.931494)
52
53
# Basic initialize parameters
54
base_init = [
55
"beam1Z 82"
,
"beam1A 208"
,
#Z,A of projectile
56
"beam2Z 82"
,
"beam2A 208"
,
#Z,A of target
57
f
"beam1Gamma {int(gamma)}"
,
58
f
"beam2Gamma {int(gamma)}"
,
59
"maxW -1"
,
#Max value of w
60
"minW -1"
,
#Min value of w
61
"nmbWBins 400"
,
#Bins n w
62
"maxRapidity 3."
,
#max y
63
"nmbRapidityBins 300"
,
#Bins n_y
64
"accCutPt 0"
,
#Cut in pT? 0 = (no, 1 = yes)
65
"accCutEta 0"
,
#Cut in pseudorapidity? (0 = no, 1 = yes)
66
# `nmbEventsTot` is not utilised by the algorithm in any way, kept here only for printing
67
f
"nmbEventsTot {kwargs["
maxevents
"] if kwargs["
lheOutput
"] else 1}"
,
68
"interferenceEnabled 0"
,
#Interference (0 = off, 1 = on)
69
"interferenceStrength 1."
,
#% of intefernce (0.0 - 0.1)
70
"coherentProduction 1"
,
#Coherent=1,Incoherent=0
71
"incoherentFactor 1."
,
#percentage of incoherence
72
"maxPtInterference 0.24"
,
#Maximum pt considered, when interference is turned on
73
"nmbPtBinsInterference 120"
,
#Number of pt bins when interference is turned on
74
"xsecMethod 0"
,
#Set to 0 to use old method for calculating gamma-gamma luminosity
75
"nThreads 1"
,
#Number of threads used for calculating luminosity (when using the new method)
76
"pythFullRec 0"
#Write full pythia information to output (vertex, parents, daughter etc)
77
]
78
79
# Get user initialize parameters
80
user_init = kwargs.pop(
"Initialize"
,
None
)
81
kwargs[
"Initialize"
] = GeneratorSettingsLayer(
82
source=
"base_initialize"
,
83
values=tuple(base_init),
84
precedence=GeneratorSettingsPrecedence.BASE,
85
report_context=
"Starlight.Initialize"
,
86
)
87
88
# Create CA object
89
ca = ComponentAccumulator(EvgenSequenceFactory(EvgenSequence.Generator))
90
ca.addEventAlgo(
91
CompFactory.Starlight_i(name, **kwargs)
92
)
93
94
# Add user initialize parameters
95
if
user_init:
96
ca.merge(
StarlightInitializeCfg
(
97
flags,
98
source=
"user_initialize"
,
99
values=user_init,
100
precedence=GeneratorSettingsPrecedence.USER,
101
name=name,
102
))
103
104
# Announce generator to service
105
from
GeneratorConfig.GeneratorInfoSvcConfig
import
GeneratorInfoSvcCfg
106
ca.merge(GeneratorInfoSvcCfg(flags, Generators=[
"Starlight"
]), sequenceName=EvgenSequence.Generator.value)
107
108
return
ca
109
110
111
def
Starlight_Pythia8_Common_Cfg
(flags,
112
ShowerCfg=Pythia8_A14_NNPDF23LO_Common_Cfg,
113
Commands=[],
114
safety=1.1,
115
**kwargs):
116
"""
117
Fragment for setting up Starlight with Pythia8 for showering.
118
By deafault use Pythia8_A14_NNPDF23LO_Common_Cfg.
119
"""
120
121
# Increase the requested number of events with a safety factor
122
# to allow for failures in showering stage
123
kwargs.setdefault(
"maxevents"
, _get_nevents(flags, safety))
124
125
# Write the output to lhe file as input for Pythia8
126
kwargs.setdefault(
"lheOutput"
,
True
)
127
128
# Setup base Starlight configuration
129
ca =
StarlightBaseCfg
(flags, **kwargs)
130
131
# Add Pythia8
132
ca.merge(ShowerCfg(
133
flags,
134
Commands=Commands,
135
LHEFile=
"events.lhe"
,
136
# IsAfterburner must be true to remove empty
137
# HepMC events produced by Starlight GenModule
138
IsAfterburner=
True
,
139
))
140
141
return
ca
142
143
144
def
Starlight_EvtGen_Common_Cfg
(flags, **kwargs):
145
"""
146
Fragment for setting up Starlight with EvtGen for VM decays.
147
"""
148
149
# Configure base Starlight
150
ca =
StarlightBaseCfg
(
151
flags,
152
suppressVMdecay =
True
,
153
**kwargs
154
)
155
156
# Add EvtGen on top of Starlight
157
from
EvtGen_i.EvtGenConfig
import
EvtGenCfg
158
ca.merge(EvtGenCfg(
159
flags,
160
auxfiles=[
"inclusiveP8DsDPlus.pdt"
],
161
pdtFile=
"inclusiveP8DsDPlus.pdt"
,
162
setVMtransversePol=
True
163
))
164
165
return
ca
StarlightConfig.StarlightInitializeCfg
StarlightInitializeCfg(flags, source, values, precedence, name="Starlight_i")
Definition
StarlightConfig.py:19
StarlightConfig.Starlight_Pythia8_Common_Cfg
Starlight_Pythia8_Common_Cfg(flags, ShowerCfg=Pythia8_A14_NNPDF23LO_Common_Cfg, Commands=[], safety=1.1, **kwargs)
Definition
StarlightConfig.py:115
StarlightConfig.StarlightBaseCfg
StarlightBaseCfg(flags, name="Starlight_i", safety=1., **kwargs)
Definition
StarlightConfig.py:35
StarlightConfig.Starlight_EvtGen_Common_Cfg
Starlight_EvtGen_Common_Cfg(flags, **kwargs)
Definition
StarlightConfig.py:144
Generated on
for ATLAS Offline Software by
1.17.0