ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Generators
MadGraphControl
python
MGClassParamHelpers.py
Go to the documentation of this file.
1
# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2
3
# Helper functions for working with parameter settings in MadGraph
4
5
from
AthenaCommon
import
Logging
6
mgparlog = Logging.logging.getLogger(
'MadGraphParamHelpers'
)
7
8
def
set_SM_params
(class_instance,FourFS=False):
9
""" Set default SM parameters
10
Recommended parameter page from PMG:
11
https://twiki.cern.ch/twiki/bin/view/AtlasProtected/McProductionCommonParametersMC15
12
"""
13
14
param_card_settings = {
15
'mass'
: {
16
'5'
:
"0.000000"
,
17
'15'
:
"1.777000e+00"
,
18
'23'
:
"9.118760e+01"
,
19
'24'
:
"8.039900e+01"
,
20
'25'
:
"1.250000e+02"
,
21
},
22
'yukawa'
: {
'15'
:
"1.777000e+00 # ymtau"
},
23
'DECAY'
: {
24
'5'
:
"""DECAY 5 0.000000e+00"""
,
25
'15'
:
"""DECAY 15 0.000000e+00"""
,
26
'23'
:
"""DECAY 23 2.495200e+00"""
,
27
'24'
:
"""DECAY 24 2.085000e+00
28
3.377000e-01 2 -1 2
29
3.377000e-01 2 -3 4
30
1.082000e-01 2 -11 12
31
1.082000e-01 2 -13 14
32
1.082000e-01 2 -15 16"""
,
33
}
34
}
35
if
FourFS:
36
param_card_settings[
'mass'
][
'5'
]=
"4.950000e+00"
37
38
# do not set particle mass or yukawa if parameter does not exist in card
39
existing_particle_info= class_instance.paramCardDict
#parse_particle_info(process_dir)
40
for
block
in
param_card_settings:
41
for
pdgid
in
list(param_card_settings[block].keys()):
42
if
block
in
existing_particle_info
and
pdgid
not
in
existing_particle_info[block]:
43
mgparlog.warning(
'Not setting {} for {} as parameter does not exist in param card'
.format(block,pdgid))
44
param_card_settings[block].pop(pdgid)
45
46
class_instance.modify_paramCardDict(params=param_card_settings)
47
48
49
def
set_top_params
(class_instance,mTop=172.5,FourFS=False):
50
""" Set default parameters requested by the top group
51
This is a convenience helper function
52
Recommended parameter page from PMG:
53
https://twiki.cern.ch/twiki/bin/view/AtlasProtected/McProductionCommonParametersMC15
54
"""
55
# Set SM parameters
56
set_SM_params
(class_instance,FourFS)
57
# Set Higgs parameters
58
set_higgs_params
(class_instance)
59
# Calculate the top width based on the mass
60
# From https://gitlab.cern.ch/atlasphys-top/reco/MC/blob/master/MCinfo/get_t_width.py
61
import
math
62
# ATLAS MC11 conventions == PDG2010
63
# Vtb=0.999152
64
# using Vtb=1.0 since part of the inputs was already produced using this approximation
65
Vtb=1.0
66
M_W=80.399
67
# PDG2010
68
G_F=1.16637*(math.pow(10,-5))
69
# MSbar alpha_s(mt)
70
alpha_s=0.108
71
# Born gamma coeff.
72
C1=G_F/(8*math.pi*math.sqrt(2))
73
# Born approximation (taking intermediate W-boson to be on-shell) [1]
74
wTop_B=C1*math.pow(float(mTop),3)*math.pow(Vtb,2)*pow((1-math.pow((M_W/float(mTop)),2)),2)*(1+2*pow((M_W/float(mTop)),2))
75
# EW and QCD corrections to Born: QCD dominates, EW can be neglected [1],[2],[3]
76
wTop=wTop_B*(1-0.81*alpha_s-1.81*pow(alpha_s,2))
77
78
param_card_settings = {
79
'mass'
: {
'6'
: str(mTop) },
80
'yukawa'
: {
'6'
:
"1.725000e+02 # ymt"
},
81
82
'DECAY'
: {
'6'
:
"""DECAY 6 """
+str(wTop)+
"""
83
1.000000e+00 2 5 24 # 1.32"""
,
84
},
85
}
86
class_instance.modify_paramCardDict(params=param_card_settings)
87
88
89
def
set_higgs_params
(class_instance):
90
""" Set Higgs mass and decays
91
BR from the Higgs XSec working group for a 125.0 GeV Higgs
92
https://twiki.cern.ch/twiki/pub/LHCPhysics/LHCHXSWGBRs/BR.central.dat
93
"""
94
param_card_settings = {
95
'MASS'
: {
'25'
:
"1.250000e+02"
},
96
'DECAY'
: {
'25'
:
"""DECAY 25 6.382339e-03
97
5.767E-01 2 5 -5 # H->bb
98
6.319E-02 2 15 -15 # H->tautau
99
2.192E-04 2 13 -13 # H->mumu
100
2.462E-04 2 3 -3 # H->ss
101
2.911E-02 2 4 -4 # H->cc
102
8.569E-02 2 21 21 # H->gg
103
2.277E-03 2 22 22 # H->gammagamma
104
1.539E-03 2 22 23 # H->Zgamma
105
2.146E-01 2 24 -24 # H->WW
106
2.641E-02 2 23 23 # H->ZZ"""
}
107
}
108
109
class_instance.modify_paramCardDict(params=param_card_settings)
110
111
112
# Functions for PMG default parameters from S Moebius
113
def
do_PMG_updates
(class_instance):
114
""" Update the parameters according to PMG defaults
115
Takes a process directory
116
No return value -- updates the param card in place
117
"""
118
param_card_settings =
get_PMG_updates
(class_instance)
119
class_instance.modify_paramCardDict(params=param_card_settings)
120
121
122
def
check_PMG_updates
(class_instance):
123
""" Check if the param card is consistent with the PMG values
124
Takes a process directory
125
Prints info in case there is an inconsistency
126
Return value is an error code (0 for all ok)
127
"""
128
param_card_settings =
get_PMG_updates
(class_instance)
129
code = 0
130
for
block
in
param_card_settings:
131
if
len(param_card_settings[block].keys())>0:
132
mgparlog.info(
'Block '
+block+
' needs updates: '
+str(param_card_settings[block]))
133
code = 1
134
return
code
135
136
137
def
get_PMG_updates
(class_instance):
138
""" Get the required PMG parameter updates
139
Takes the location of a process directory
140
Returns the dictionary of changes needed for updating to the default params
141
"""
142
# Load the list of masses and widths from the param card
143
masses =
get_masses
(class_instance.paramCardDict)
144
widths =
get_widths
(class_instance.paramCardDict)
145
yukawas =
get_block
(class_instance.paramCardDict,
'yukawa'
)
146
147
# Read in parameters from dictionary
148
from
EvgenProdTools.offline_dict
import
parameters
149
150
# Create translation dictionary to be able to produce dictionary that can be read by build_param_card function
151
# for now only the quarks, leptons and bosons are included
152
particles_for_update = [
'6'
,
'5'
,
'4'
,
'3'
,
'2'
,
'1'
,
# Quarks
153
'25'
,
'24'
,
'23'
,
# Bosons
154
'11'
,
'13'
,
'15'
]
# Leptons
155
newparamdict = {
156
'mass'
: {},
157
'decay'
: {},
158
'yukawa'
: {},
159
}
160
161
# Loop through parameter dictionary and fill newparamdict, which will then be used to update the param_card
162
for
pid, settings
in
parameters[
'particles'
].items():
163
# dictionary key is the PID of a particle
164
# settings is a dictionary with mass, width and name as keys
165
# In case we need a name for debugging or other things, it's here
166
#particle_name = settings['name']
167
if
pid
in
particles_for_update:
168
width = settings[
'width'
]
169
mass = settings[
'mass'
]
170
# Mass: Always set it, even if it wasn't in the dictionary
171
if
pid
not
in
masses
or
masses[pid]!=mass:
172
newparamdict[
'mass'
][pid] = mass
173
# Width: Always set it, even if it wasn't in the dictionary
174
if
pid
not
in
widths
or
widths[pid]!=width:
175
newparamdict[
'decay'
][pid] =
'DECAY '
+pid+
' '
+width
176
# Yukawa: Set it only if it was in the dictionary
177
# This is to protect against models that don't use Yukawa blocks as normal
178
if
pid
in
yukawas
and
yukawas[pid]!=mass:
179
newparamdict[
'yukawa'
][pid] = mass
180
181
# Remove empty items from the dictionary for cleanliness
182
finalparamdict = { block : newparamdict[block]
for
block
in
newparamdict
if
len(newparamdict[block].keys())>0 }
183
184
mgparlog.info(
'The parameters that will be updated are:'
)
185
mgparlog.info(finalparamdict)
186
187
return
finalparamdict
188
189
190
# Functions to get values from a param card
191
def
get_masses
(paramDict):
192
""" Function to get the masses from a param card
193
Takes the location of a param card
194
Returns a dictionary of PID key, mass (string) values
195
"""
196
for
block
in
paramDict:
197
if
'mass'
in
block.lower():
198
return
paramDict[block]
199
# Just in case there is no 'mass' block
200
raise
RuntimeError(
'Could not find the MASS block in the parameter card dictionary'
)
201
202
203
204
205
def
get_widths
(paramDict):
206
""" Function to get the widths from a param card
207
Takes the location of a param card
208
Returns a dictionary of PID key, width (string) values
209
"""
210
for
block
in
paramDict:
211
if
block.lower() ==
'decay'
:
212
return
paramDict[block]
213
# Just in case there is no 'decay' block
214
raise
RuntimeError(
'Could not find the DECAY block in the parameter card dictionary'
)
215
216
217
def
get_block
(paramDict, block_name):
218
""" Function to get values from a block in the param card
219
Takes the location of a param card and block name
220
Returns a dictionary of key--value for that block
221
"""
222
for
block
in
paramDict:
223
if
block.lower() == block_name.lower():
224
return
paramDict[block]
225
# Just in case there is no block with that name block
226
mgparlog.warning(
'Could not find the %s block in the parameter card dictionary'
,str(block_name))
227
return
{}
python.MGClassParamHelpers.get_widths
get_widths(paramDict)
Definition
MGClassParamHelpers.py:205
python.MGClassParamHelpers.set_higgs_params
set_higgs_params(class_instance)
Definition
MGClassParamHelpers.py:89
python.MGClassParamHelpers.get_PMG_updates
get_PMG_updates(class_instance)
Definition
MGClassParamHelpers.py:137
python.MGClassParamHelpers.do_PMG_updates
do_PMG_updates(class_instance)
Definition
MGClassParamHelpers.py:113
python.MGClassParamHelpers.get_masses
get_masses(paramDict)
Definition
MGClassParamHelpers.py:191
python.MGClassParamHelpers.check_PMG_updates
check_PMG_updates(class_instance)
Definition
MGClassParamHelpers.py:122
python.MGClassParamHelpers.set_top_params
set_top_params(class_instance, mTop=172.5, FourFS=False)
Definition
MGClassParamHelpers.py:49
python.MGClassParamHelpers.get_block
get_block(paramDict, block_name)
Definition
MGClassParamHelpers.py:217
python.MGClassParamHelpers.set_SM_params
set_SM_params(class_instance, FourFS=False)
Definition
MGClassParamHelpers.py:8
Generated on
for ATLAS Offline Software by
1.17.0