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
kwargs.setdefault(
"beam1Energy"
, flags.Beam.Energy/GeV)
50
kwargs.setdefault(
"beam2Energy"
, flags.Beam.Energy/GeV)
51
52
# Gamma calculation for Pb208
53
# Gamma = E(Pb208) / (m(Pb208) in a.u. * atomic mass unit in GeV)
54
gamma1 = 208 * kwargs[
'beam1Energy'
] / (207.9766359 * 0.931494)
55
gamma2 = 208 * kwargs[
'beam2Energy'
] / (207.9766359 * 0.931494)
56
57
# Basic initialize parameters
58
base_init = [
59
"beam1Z 82"
,
"beam1A 208"
,
#Z,A of projectile
60
"beam2Z 82"
,
"beam2A 208"
,
#Z,A of target
61
f
"beam1Gamma {int(gamma1)}"
,
62
f
"beam2Gamma {int(gamma2)}"
,
63
"maxW -1"
,
#Max value of w
64
"minW -1"
,
#Min value of w
65
"nmbWBins 400"
,
#Bins n w
66
"maxRapidity 3."
,
#max y
67
"nmbRapidityBins 300"
,
#Bins n_y
68
"accCutPt 0"
,
#Cut in pT? 0 = (no, 1 = yes)
69
"accCutEta 0"
,
#Cut in pseudorapidity? (0 = no, 1 = yes)
70
# `nmbEventsTot` is not utilised by the algorithm in any way, kept here only for printing
71
f
"nmbEventsTot {kwargs["
maxevents
"] if kwargs["
lheOutput
"] else 1}"
,
72
"interferenceEnabled 0"
,
#Interference (0 = off, 1 = on)
73
"interferenceStrength 1."
,
#% of intefernce (0.0 - 0.1)
74
"coherentProduction 1"
,
#Coherent=1,Incoherent=0
75
"incoherentFactor 1."
,
#percentage of incoherence
76
"maxPtInterference 0.24"
,
#Maximum pt considered, when interference is turned on
77
"nmbPtBinsInterference 120"
,
#Number of pt bins when interference is turned on
78
"xsecMethod 0"
,
#Set to 0 to use old method for calculating gamma-gamma luminosity
79
"nThreads 1"
,
#Number of threads used for calculating luminosity (when using the new method)
80
"pythFullRec 0"
#Write full pythia information to output (vertex, parents, daughter etc)
81
]
82
83
# Get user initialize parameters
84
user_init = kwargs.pop(
"Initialize"
,
None
)
85
kwargs[
"Initialize"
] = GeneratorSettingsLayer(
86
source=
"base_initialize"
,
87
values=tuple(base_init),
88
precedence=GeneratorSettingsPrecedence.BASE,
89
report_context=
"Starlight.Initialize"
,
90
)
91
92
# Create CA object
93
ca = ComponentAccumulator(EvgenSequenceFactory(EvgenSequence.Generator))
94
ca.addEventAlgo(
95
CompFactory.Starlight_i(name, **kwargs)
96
)
97
98
# Add user initialize parameters
99
if
user_init:
100
ca.merge(
StarlightInitializeCfg
(
101
flags,
102
source=
"user_initialize"
,
103
values=user_init,
104
precedence=GeneratorSettingsPrecedence.USER,
105
name=name,
106
))
107
108
# Announce generator to service
109
from
GeneratorConfig.GeneratorInfoSvcConfig
import
GeneratorInfoSvcCfg
110
ca.merge(GeneratorInfoSvcCfg(flags, Generators=[
"Starlight"
]), sequenceName=EvgenSequence.Generator.value)
111
112
return
ca
113
114
115
def
Starlight_Pythia8_Common_Cfg
(flags,
116
ShowerCfg=Pythia8_A14_NNPDF23LO_Common_Cfg,
117
Commands=[],
118
safety=1.1,
119
**kwargs):
120
"""
121
Fragment for setting up Starlight with Pythia8 for showering.
122
By deafault use Pythia8_A14_NNPDF23LO_Common_Cfg.
123
"""
124
125
# Increase the requested number of events with a safety factor
126
# to allow for failures in showering stage
127
kwargs.setdefault(
"maxevents"
, _get_nevents(flags, safety))
128
129
# Write the output to lhe file as input for Pythia8
130
kwargs.setdefault(
"lheOutput"
,
True
)
131
132
# Setup base Starlight configuration
133
ca =
StarlightBaseCfg
(flags, **kwargs)
134
135
# Add Pythia8
136
ca.merge(ShowerCfg(
137
flags,
138
Commands=Commands,
139
LHEFile=
"events.lhe"
,
140
# IsAfterburner must be true to remove empty
141
# HepMC events produced by Starlight GenModule
142
IsAfterburner=
True
,
143
))
144
145
return
ca
146
147
148
def
Starlight_EvtGen_Common_Cfg
(flags, **kwargs):
149
"""
150
Fragment for setting up Starlight with EvtGen for VM decays.
151
"""
152
153
# Configure base Starlight
154
ca =
StarlightBaseCfg
(
155
flags,
156
suppressVMdecay =
True
,
157
**kwargs
158
)
159
160
# Add EvtGen on top of Starlight
161
from
EvtGen_i.EvtGenConfig
import
EvtGenCfg
162
ca.merge(EvtGenCfg(
163
flags,
164
auxfiles=[
"inclusiveP8DsDPlus.pdt"
],
165
pdtFile=
"inclusiveP8DsDPlus.pdt"
,
166
setVMtransversePol=
True
167
))
168
169
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:119
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:148
Generated on
for ATLAS Offline Software by
1.17.0