5 from AthenaCommon
import Logging
6 mgparlog = Logging.logging.getLogger(
'MadGraphParamHelpers')
9 """ Parses param card in process_dir (except for decays, which have different structure)
10 and returns dict with structure dict['block']['pdgid']='value'.
13 with open(process_dir+
'/Cards/param_card.dat')
as f:
16 if line.strip().startswith(
'#'):
18 sl=line.lower().strip().
split()
21 mgparlog.warning(
'Unexpected line in param card:')
22 mgparlog.warning(line)
33 info[block][sl[0]]=sl[1]
38 """ Set default SM parameters
39 Recommended parameter page from PMG:
40 https://twiki.cern.ch/twiki/bin/view/AtlasProtected/McProductionCommonParametersMC15
43 param_card_settings = {
51 'yukawa' : {
'15':
"1.777000e+00 # ymtau" },
53 '5' :
"""DECAY 5 0.000000e+00""",
54 '15' :
"""DECAY 15 0.000000e+00""",
55 '23' :
"""DECAY 23 2.495200e+00""",
56 '24':
"""DECAY 24 2.085000e+00
61 1.082000e-01 2 -15 16""",
65 param_card_settings[
'mass'][
'5']=
"4.950000e+00"
69 for block
in param_card_settings:
70 for pdgid
in list(param_card_settings[block].
keys()):
71 if block
in existing_particle_info
and pdgid
not in existing_particle_info[block]:
72 mgparlog.warning(
'Not setting {} for {} as parameter does not exist in param card'.
format(block,pdgid))
73 param_card_settings[block].pop(pdgid)
80 """ Set default parameters requested by the top group
81 This is a convenience helper function
82 Recommended parameter page from PMG:
83 https://twiki.cern.ch/twiki/bin/view/AtlasProtected/McProductionCommonParametersMC15
98 G_F=1.16637*(math.pow(10,-5))
102 C1=G_F/(8*math.pi*math.sqrt(2))
104 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))
106 wTop=wTop_B*(1-0.81*alpha_s-1.81*
pow(alpha_s,2))
108 param_card_settings = {
109 'mass' : {
'6':
str(mTop) },
110 'yukawa' : {
'6':
"1.725000e+02 # ymt" },
112 'DECAY' : {
'6' :
"""DECAY 6 """+
str(wTop)+
"""
113 1.000000e+00 2 5 24 # 1.32""",
121 """ Set Higgs mass and decays
122 BR from the Higgs XSec working group for a 125.0 GeV Higgs
123 https://twiki.cern.ch/twiki/pub/LHCPhysics/LHCHXSWGBRs/BR.central.dat
125 param_card_settings = {
126 'MASS' : {
'25':
"1.250000e+02" },
127 'DECAY': {
'25':
"""DECAY 25 6.382339e-03
128 5.767E-01 2 5 -5 # H->bb
129 6.319E-02 2 15 -15 # H->tautau
130 2.192E-04 2 13 -13 # H->mumu
131 2.462E-04 2 3 -3 # H->ss
132 2.911E-02 2 4 -4 # H->cc
133 8.569E-02 2 21 21 # H->gg
134 2.277E-03 2 22 22 # H->gammagamma
135 1.539E-03 2 22 23 # H->Zgamma
136 2.146E-01 2 24 -24 # H->WW
137 2.641E-02 2 23 23 # H->ZZ""" }
145 """ Update the parameters according to PMG defaults
146 Takes a process directory
147 No return value -- updates the param card in place
155 """ Check if the param card is consistent with the PMG values
156 Takes a process directory
157 Prints info in case there is an inconsistency
158 Return value is an error code (0 for all ok)
162 for block
in param_card_settings:
163 if len(param_card_settings[block].
keys())>0:
164 mgparlog.info(
'Block '+block+
' needs updates: '+
str(param_card_settings[block]))
170 """ Get the required PMG parameter updates
171 Takes the location of a process directory
172 Returns the dictionary of changes needed for updating to the default params
175 param_card_loc = process_dir+
'/Cards/param_card.dat'
178 yukawas =
get_block(param_card_loc,
'yukawa')
181 from EvgenProdTools.offline_dict
import parameters
185 particles_for_update = [
'6',
'5',
'4',
'3',
'2',
'1',
195 for pid, settings
in parameters[
'particles'].
items():
200 if pid
in particles_for_update:
201 width = settings[
'width']
202 mass = settings[
'mass']
204 if pid
not in masses
or masses[pid]!=mass:
205 newparamdict[
'mass'][pid] = mass
207 if pid
not in widths
or widths[pid]!=width:
208 newparamdict[
'decay'][pid] =
'DECAY '+pid+
' '+width
211 if pid
in yukawas
and yukawas[pid]!=mass:
212 newparamdict[
'yukawa'][pid] = mass
215 finalparamdict = { block : newparamdict[block]
for block
in newparamdict
if len(newparamdict[block].
keys())>0 }
217 mgparlog.info(
'The parameters that will be updated are:')
218 mgparlog.info(finalparamdict)
220 return finalparamdict
225 """ Function to get the masses from a param card
226 Takes the location of a param card
227 Returns a dictionary of PID key, mass (string) values
233 """ Function to get the widths from a param card
234 Takes the location of a param card
235 Returns a dictionary of PID key, width (string) values
238 with open(param_card_loc,
'r')
as param_card_in:
239 for aline
in param_card_in:
240 command_bits = aline.lower().
split(
'#')[0].
split()
241 if len(command_bits)>2
and 'decay'==command_bits[0]:
242 widths[command_bits[1]] = command_bits[2]
247 """ Function to get values from a block in the param card
248 Takes the location of a param card and block name
249 Returns a dictionary of key--value for that block
253 with open(param_card_loc,
'r')
as param_card_in:
254 for aline
in param_card_in:
255 command_bits = aline.lower().
split(
'#')[0].
split()
256 if len(command_bits)>1
and 'block'==command_bits[0]
and block_name==command_bits[1]:
259 elif len(command_bits)>1
and 'block'==command_bits[0]
and in_block:
262 elif len(command_bits)>1
and in_block:
265 values[
' '.
join(command_bits[:-1])] = command_bits[-1]