66 def setup_SMEFT(process,model_nick,param_name,reweight_name,eft_params):
68 if model_nick==
"EFTAaUm":
69 model=
"SMEFTsim_A_U35_alphaScheme_UFO"
70 eft_parameter_block=
'frblock'
72 sm_restriction=
'SMlimit'
73 elif model_nick==
"EFTAWUm":
74 model=
"SMEFTsim_A_U35_MwScheme_UFO"
75 eft_parameter_block=
'frblock'
77 sm_restriction=
'SMlimit'
78 elif model_nick==
"EFTBaUm":
79 model=
"SMEFT_alpha_FLU_UFO"
80 eft_parameter_block=
'NEWCOUP'
83 elif model_nick==
"EFTBWUm":
84 model=
"SMEFT_mW_FLU_UFO"
85 eft_parameter_block=
'NEWCOUP'
88 elif model_nick==
"EFTAaU":
89 model=
"SMEFTsim_A_U35_alphaScheme_UFO"
90 eft_parameter_block=
'frblock'
91 restriction=
'massless'
92 sm_restriction=
'SMlimit_massless'
93 elif model_nick==
"EFTAWU":
94 model=
"SMEFTsim_A_U35_MwScheme_UFO"
95 eft_parameter_block=
'frblock'
96 restriction=
'massless'
97 sm_restriction=
'SMlimit_massless'
100 raise RuntimeError(
"Unkown model: "+model_nick)
103 reweight_card_loc=
None
104 if reweight_name!=
None:
105 param_card_loc=
'MadGraph_param_card_'+model_nick+
'_reweight'+reweight_name+
'.dat'
106 restrict_card_loc=
'MadGraph_restrict_card_'+model_nick+
'_reweight'+reweight_name+
'.dat'
107 reweight_card_loc=
'MadGraph_reweight_card_'+model_nick+
'_'+reweight_name+
'.dat'
108 get_param_file = subprocess.Popen([
'get_files',
'-data', param_card_loc])
109 get_param_file.wait()
110 if not os.path.exists(param_card_loc):
111 raise RuntimeError(
"Cannot find "+param_card_loc)
112 get_restrict_file = subprocess.Popen([
'get_files',
'-data', restrict_card_loc])
113 get_restrict_file.wait()
114 if not os.path.exists(restrict_card_loc):
115 print 'running without user defined restriction card'
116 restrict_card_loc=
None
117 get_reweight_file = subprocess.Popen([
'get_files',
'-data', reweight_card_loc])
118 get_reweight_file.wait()
119 if not os.path.exists(reweight_card_loc):
120 raise RuntimeError(
"Cannot find "+reweight_card_loc)
124 elif param_name!=
None:
125 param_card_loc=
'MadGraph_param_card_'+model_nick+
'_'+param_name+
'.dat'
126 restrict_card_loc=
'MadGraph_restrict_card_'+model_nick+
'_'+param_name+
'.dat'
127 get_param_file = subprocess.Popen([
'get_files',
'-data', param_card_loc])
128 get_param_file.wait()
129 if not os.path.exists(param_card_loc):
130 raise RuntimeError(
"Cannot find "+param_card_loc)
131 get_restrict_file = subprocess.Popen([
'get_files',
'-data', restrict_card_loc])
132 get_restrict_file.wait()
133 if not os.path.exists(restrict_card_loc):
134 print 'running without user defined restriction card'
135 restrict_card_loc=
None
140 param_card_default=
'MadGraph_param_card_'+model_nick+
'.dat'
141 param_card_loc=param_card_default.replace(
'.dat',
'_updated.dat')
142 modify_param_card(param_card_default,output_location=param_card_loc,params={eft_parameter_block:eft_params})
143 if os.path.exists(
'mgmodels_local'):
144 shutil.rmtree(
'mgmodels_local')
145 os.mkdir(
'mgmodels_local')
146 restricted_model=
'mgmodels_local/'+model
147 shutil.copytree(mgmodels+model,restricted_model)
148 eft_params_to_keep=eft_params
149 for p
in eft_params_to_keep:
150 eft_params_to_keep[p]=
'9.999999e-01'
151 if len(eft_params_to_keep)==0:
152 process=process.replace(
'NP==0',
'')
153 restriction=
'without_irrelevant_couplings'
154 if len(eft_params_to_keep)>0:
155 modify_param_card(param_card_default,output_location=restricted_model+
'/'+
'restrict_'+restriction+
'.dat',params={eft_parameter_block:eft_params_to_keep})
157 shutil.copy(param_card_default,restricted_model+
'/'+
'restrict_'+restriction+
'.dat')
158 model=
'./'+restricted_model
159 restrict_card_loc=
None
161 if restrict_card_loc!=
None and (reweight_name!=
None or param_name!=
None):
162 if os.path.exists(
'mgmodels_local'):
163 shutil.rmtree(
'mgmodels_local')
164 os.mkdir(
'mgmodels_local')
165 restricted_model=
'mgmodels_local/'+model
166 shutil.copytree(mgmodels+model,restricted_model)
167 restriction=
'without_irrelevant_couplings'
168 shutil.copy(restrict_card_loc,restricted_model+
'/'+
'restrict_'+restriction+
'.dat')
169 model=
'./'+restricted_model
172 proc_card=
"import model "+model
173 if restriction!=
None:
174 proc_card+=
'-'+restriction
176 proc_card+=process+
"\noutput -f\n"
179 if param_card_loc!=
None:
180 shutil.move(param_card_loc,process_dir+
'/Cards/param_card.dat')
181 if reweight_card_loc!=
None:
182 shutil.move(reweight_card_loc,process_dir+
'/Cards/reweight_card.dat')