29 runcard_systematics_arguments={}
31 basefragment_settings={}
32 basefragment_settings[
'central_pdf']=
None
33 basefragment_settings[
'alternative_pdfs']=
None
34 basefragment_settings[
'pdf_variations']=
None
35 basefragment_settings[
'scale_variations']=
None
36 basefragment_settings[
'alternative_dynamic_scales']=
None
37 for s
in basefragment_settings:
38 if s
in the_base_fragment:
39 if isinstance(basefragment_settings[s],list)
and len(basefragment_settings[s])==0:
41 basefragment_settings[s]=the_base_fragment[s]
44 raise RuntimeError(
'No "central_pdf" configured in base fragment')
45 if s==
'alternative_dynamic_scales':
47 mgsyslog.warning(
'base fragment or pdf settings does not define "'+s+
'"')
50 for s
in basefragment_settings:
52 if not isinstance(basefragment_settings[s],int):
53 raise RuntimeError(s+
', configured in base fragment, has to be an integer')
55 if basefragment_settings[s]
is None:
57 if s==
'scale_variations':
58 if not isinstance(basefragment_settings[s],list):
59 raise RuntimeError(s+
', configured in base fragment, has to be a list of numbers')
60 for pdf
in basefragment_settings[s]:
61 if not isinstance(pdf,float)
and not isinstance(pdf,int):
62 raise RuntimeError(s+
', configured in base fragment, has to be a list of numbers')
64 if not isinstance(basefragment_settings[s],list):
65 raise RuntimeError(s+
', configured in base fragment, has to be a list of integers')
66 for element
in basefragment_settings[s]:
67 if not isinstance(element,int)
or not element>0:
68 raise RuntimeError(s+
', configured in base fragment, has to be a list of positive integers')
71 if basefragment_settings[
'alternative_pdfs']
is not None:
73 if basefragment_settings[
'pdf_variations']
is not None:
74 basefragment_settings[
'alternative_pdfs']=[ a
for a
in basefragment_settings[
'alternative_pdfs']
if a
not in basefragment_settings[
'pdf_variations'] ]
76 if basefragment_settings[
'central_pdf']
in basefragment_settings[
'alternative_pdfs']:
77 basefragment_settings[
'alternative_pdfs'].
remove(basefragment_settings[
'central_pdf'])
80 runcard_settings[
'pdlabel']=
'lhapdf'
81 runcard_settings[
'lhaid']=
str(basefragment_settings[
'central_pdf'])
85 if basefragment_settings[
'alternative_dynamic_scales']
is not None:
86 runcard_systematics_arguments[
'weight_info']=SYSTEMATICS_WEIGHT_INFO_ALTDYNSCALES
88 runcard_systematics_arguments[
'weight_info']=SYSTEMATICS_WEIGHT_INFO
89 runcard_systematics_arguments[
'remove_wgts']=
'".*MUR0.5_MUF2.0.*|.*MUR2.0_MUF0.5.*"'
91 runcard_settings[
'systematics_program']=
'none'
92 for s
in [
'alternative_pdfs',
'pdf_variations',
'scale_variations']:
93 if basefragment_settings[s]
is not None and len(basefragment_settings[s])>0:
96 runcard_settings[
'store_rwgt_info']=
'True'
98 runcard_settings[
'use_syst']=
'True'
100 runcard_settings[
'systematics_program']=
'systematics'
106 if basefragment_settings[
'pdf_variations']
is not None and basefragment_settings[
'central_pdf']
in basefragment_settings[
'pdf_variations']:
107 runcard_settings[
'reweight_pdf']=
'True'
109 runcard_settings[
'reweight_pdf']=
'False'
110 if basefragment_settings[
'pdf_variations']
is not None:
111 for v
in basefragment_settings[
'pdf_variations']:
112 if v==basefragment_settings[
'central_pdf']:
114 runcard_settings[
'lhaid']+=
' '+
str(v)
115 runcard_settings[
'reweight_pdf']+=
' True'
116 if basefragment_settings[
'alternative_pdfs']
is not None:
117 for a
in basefragment_settings[
'alternative_pdfs']:
118 runcard_settings[
'lhaid']+=
' '+
str(a)
119 runcard_settings[
'reweight_pdf']+=
' False'
123 if basefragment_settings[
'pdf_variations']
is not None:
124 for v
in basefragment_settings[
'pdf_variations']:
126 if basefragment_settings[
'alternative_pdfs']
is not None:
127 for a
in basefragment_settings[
'alternative_pdfs']:
130 runcard_systematics_arguments[
'pdf']=
','.
join(sys_pdfs)
132 runcard_settings[
'reweight_pdf']=
'False'
136 if basefragment_settings[
'scale_variations']
is None and isNLO:
137 runcard_settings[
'reweight_scale']=
'False'
138 if basefragment_settings[
'scale_variations']
is not None:
140 runcard_settings[
'reweight_scale']=
'True'
141 runcard_settings[
'rw_rscale']=
' '.
join([
str(s)
for s
in basefragment_settings[
'scale_variations']])
142 runcard_settings[
'rw_fscale']=
' '.
join([
str(s)
for s
in basefragment_settings[
'scale_variations']])
144 runcard_systematics_arguments[
'muf']=
','.
join([
str(s)
for s
in basefragment_settings[
'scale_variations']])
145 runcard_systematics_arguments[
'mur']=
','.
join([
str(s)
for s
in basefragment_settings[
'scale_variations']])
146 runcard_systematics_arguments[
'dyn']=
'-1'
148 runcard_settings[
'reweight_scale']=
'False'
150 if basefragment_settings[
'alternative_dynamic_scales']
is not None:
152 raise RuntimeError(
'Cannot reweight to alternative dynamic scales using the NLO OTF module')
154 runcard_systematics_arguments[
'dyn']=
','.
join([
str(s)
for s
in [-1]+basefragment_settings[
'alternative_dynamic_scales']])
159 return runcard_settings