ATLAS Offline Software
Loading...
Searching...
No Matches
python.MGClassParamHelpers Namespace Reference

Functions

 set_SM_params (class_instance, FourFS=False)
 set_top_params (class_instance, mTop=172.5, FourFS=False)
 set_higgs_params (class_instance)
 do_PMG_updates (class_instance)
 check_PMG_updates (class_instance)
 get_PMG_updates (class_instance)
 get_masses (paramDict)
 get_widths (paramDict)
 get_block (paramDict, block_name)

Variables

 mgparlog = Logging.logging.getLogger('MadGraphParamHelpers')

Function Documentation

◆ check_PMG_updates()

python.MGClassParamHelpers.check_PMG_updates ( class_instance)
 Check if the param card is consistent with the PMG values
Takes a process directory
Prints info in case there is an inconsistency
Return value is an error code (0 for all ok)

Definition at line 122 of file MGClassParamHelpers.py.

122def 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

◆ do_PMG_updates()

python.MGClassParamHelpers.do_PMG_updates ( class_instance)
 Update the parameters according to PMG defaults
Takes a process directory
No return value -- updates the param card in place

Definition at line 113 of file MGClassParamHelpers.py.

113def 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

◆ get_block()

python.MGClassParamHelpers.get_block ( paramDict,
block_name )
 Function to get values from a block in the param card
Takes the location of a param card and block name
Returns a dictionary of key--value for that block

Definition at line 217 of file MGClassParamHelpers.py.

217def 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 {}

◆ get_masses()

python.MGClassParamHelpers.get_masses ( paramDict)
 Function to get the masses from a param card
Takes the location of a param card
Returns a dictionary of PID key, mass (string) values

Definition at line 191 of file MGClassParamHelpers.py.

191def 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

◆ get_PMG_updates()

python.MGClassParamHelpers.get_PMG_updates ( class_instance)
 Get the required PMG parameter updates
Takes the location of a process directory
Returns the dictionary of changes needed for updating to the default params

Definition at line 137 of file MGClassParamHelpers.py.

137def 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

◆ get_widths()

python.MGClassParamHelpers.get_widths ( paramDict)
 Function to get the widths from a param card
Takes the location of a param card
Returns a dictionary of PID key, width (string) values

Definition at line 205 of file MGClassParamHelpers.py.

205def 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

◆ set_higgs_params()

python.MGClassParamHelpers.set_higgs_params ( class_instance)
 Set Higgs mass and decays
BR from the Higgs XSec working group for a 125.0 GeV Higgs
https://twiki.cern.ch/twiki/pub/LHCPhysics/LHCHXSWGBRs/BR.central.dat

Definition at line 89 of file MGClassParamHelpers.py.

89def 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

◆ set_SM_params()

python.MGClassParamHelpers.set_SM_params ( class_instance,
FourFS = False )
 Set default SM parameters
Recommended parameter page from PMG:
https://twiki.cern.ch/twiki/bin/view/AtlasProtected/McProductionCommonParametersMC15

Definition at line 8 of file MGClassParamHelpers.py.

8def 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

◆ set_top_params()

python.MGClassParamHelpers.set_top_params ( class_instance,
mTop = 172.5,
FourFS = False )
 Set default parameters requested by the top group
This is a convenience helper function
Recommended parameter page from PMG:
https://twiki.cern.ch/twiki/bin/view/AtlasProtected/McProductionCommonParametersMC15

Definition at line 49 of file MGClassParamHelpers.py.

49def 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

Variable Documentation

◆ mgparlog

python.MGClassParamHelpers.mgparlog = Logging.logging.getLogger('MadGraphParamHelpers')

Definition at line 6 of file MGClassParamHelpers.py.