Merge lp:~maddevelopers/mg5amcnlo/group_pythia8 into lp:~maddevelopers/mg5amcnlo/release_candidate
- group_pythia8
- Merge into release_candidate
Status: | Merged |
---|---|
Merged at revision: | 162 |
Proposed branch: | lp:~maddevelopers/mg5amcnlo/group_pythia8 |
Merge into: | lp:~maddevelopers/mg5amcnlo/release_candidate |
Diff against target: |
4434 lines (+2063/-841) 35 files modified
aloha/aloha_writers.py (+1/-1) aloha/create_aloha.py (+13/-4) madgraph/VERSION (+2/-2) madgraph/core/helas_objects.py (+19/-0) madgraph/interface/cmd_interface.py (+241/-246) madgraph/interface/extended_cmd.py (+58/-13) madgraph/interface/launch_ext_program.py (+155/-25) madgraph/interface/tutorial_text.py (+1/-0) madgraph/iolibs/export_cpp.py (+480/-143) madgraph/iolibs/group_subprocs.py (+17/-0) madgraph/iolibs/helas_call_writers.py (+1/-1) madgraph/iolibs/misc.py (+1/-1) madgraph/iolibs/template_files/Makefile_sa_cpp_src (+1/-1) madgraph/iolibs/template_files/cpp_hel_amps_cc.inc (+1/-1) madgraph/iolibs/template_files/cpp_hel_amps_h.inc (+3/-3) madgraph/iolibs/template_files/cpp_process_cc.inc (+2/-2) madgraph/iolibs/template_files/cpp_process_h.inc (+1/-1) madgraph/iolibs/template_files/cpp_process_sigmaKin_function.inc (+9/-2) madgraph/iolibs/template_files/pythia8_main_example_cc.inc (+71/-0) madgraph/iolibs/template_files/pythia8_main_makefile.inc (+39/-0) madgraph/iolibs/template_files/pythia8_makefile.inc (+107/-0) madgraph/iolibs/template_files/pythia8_model_parameters_cc.inc (+4/-7) madgraph/iolibs/template_files/pythia8_model_parameters_h.inc (+5/-6) madgraph/iolibs/template_files/pythia8_process_cc.inc (+1/-1) madgraph/iolibs/template_files/pythia8_process_function_definitions.inc (+4/-4) madgraph/iolibs/template_files/pythia8_process_sigmaKin_function.inc (+11/-3) madgraph/iolibs/template_files/pythia8_process_wavefunctions.inc (+1/-1) madgraph/iolibs/template_files/read_slha.cc (+2/-2) madgraph/iolibs/template_files/read_slha.h (+3/-3) tests/acceptance_tests/test_cmd.py (+15/-22) tests/parallel_tests/me_comparator.py (+20/-114) tests/parallel_tests/sample_script.py (+2/-2) tests/unit_tests/iolibs/test_export_cpp.py (+767/-224) tests/unit_tests/iolibs/test_helas_call_writers.py (+5/-5) tests/unit_tests/various/test_process_checks.py (+0/-1) |
To merge this branch: | bzr merge lp:~maddevelopers/mg5amcnlo/group_pythia8 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Olivier Mattelaer | Needs Information | ||
Review via email: mp+54942@code.launchpad.net |
Commit message
Description of the change
- Fixed Pythia 8 output to work for any model, implemented the correct subprocess grouping, added makefiles and example main program, and distribute files in a Pythia 8 distribution correctly
- Implemented launch also for Pythia 8
- 166. By Johan Alwall
-
Some tweaking of the launch command for pythia8
- 167. By Johan Alwall
-
Changed position of include files in Pythia 8 output to be together with process and model .cc files. Cleaned up command line interface cmd_interface.py to make it more DRY and make the behavior for generate and output more expected.
- 168. By Johan Alwall
-
Fixed ALOHA output of charge conjugate routines also when there are fermion-flow violating couplings but no Majorana particles in model
- 169. By Johan Alwall
-
Fixed launch (finally understood how Olivier meant it...)
- 170. By Johan Alwall
-
Fixed pythia8 launcher, replaced filename hel_amps_model with HelAmps_model in better accordance with other file names
- 171. By Johan Alwall
-
Changed example main file for Pythia to include all processes defined in one output by the output command.
Olivier Mattelaer (olivier-mattelaer) wrote : | # |
Johan Alwall (johan-alwall) wrote : | # |
Hello Olivier,
Can you please clarify?
> They are problem with the launch command.
> 1) It's not working now (but that you know and expect me to fix)
Exactly what are the problems you refer to?
> 2) It's not working as the "other" launch command
> - it has a timer, even in interactive mode (where they are only in shell mode for the other)
What I really want is to have "enter" select the default value, and to
have the default value displayed even without a timer (just like any
UNIX command with default values). Is this what you refer to above?
> - it require confirmation for the main (where for the other launch it launches directly)
For Pythia, this is a different philosophy. Since the main file is
just an example file, we generally assume that the user wants to
modify it. This is not the case for any other output format.
Furthermore, there is no way of knowing which of the main files the
user wants to run.
> All the launch routine should follow the same logic!!
Not this one. It depends on what the user expects, and this is very
different between the different output formats.
- 172. By Johan Alwall
-
Add on to tutorial text for launch command. Fixed parallel test.
- 173. By Olivier Mattelaer
-
correct the compute all. The conjugate pair were not set correctly
- 174. By Johan Alwall
-
Fixed bug in launch selection, remove timout in pythia8 question
- 175. By Olivier Mattelaer
-
nicer launch interface:
- underline for default
- tab completion for the possible choices
- return default when press enter
Olivier Mattelaer (olivier-mattelaer) wrote : | # |
Hi Johan,
This is a bit more of feedback on this module:
For the moment, I'm mainly try to use it, didn't look so deep in the code modification.
(I know that your are coding very elegantly)
1)
>All necessary files for Pythia 8 generated.
>Please go to /Users/
> make -f /Users/
>(with process_name replaced by process name).
>You can then run .//Users/
>events for the process.
>Or run launch and select /Users/
>Generated helas calls for 2 subprocesses (4 diagrams) in 0.109 s
I found a bit disturbing that : "Generated helas calls for 2 subprocesses (4 diagrams) in 0.109 s"
is after all the information text... is it possible to print it before?
2) In the file main_xxxx.
I found this:
pythia.init(2212, 2212, 14000.);
shouldn't we put the energy default to 7? (in fact the same for the run_card in madevent)
3) It fails to compile on my computer:
Running make for pythia8 directory
Command "launch" interrupted with error:
MadGraph5Error : make failed for pythia8 directory
Please report this bug on https:/
More information is found in 'MG5_debug'.
Please attach this file to your report.
So this should be due to my installation, so I think
a) It can be helpfull to put on the README some information on where we should put the pythia8 program in order that he detect it. (You can add the same type of information for pythia/...)
(and/or add some information in the help launch)
b) This error message should be a bit more instructive. Since here it doesn't help at all.
4) What is the sense of the last option in
Do you want to edit file: main_mssm_1.cc? [y, n, path of the new main_mssm_1.cc]
5) if you open a new mg5 command and try to launch ./examples/
return InvalidCmd ./examples/
and if put launch ./examples/
then he didn't launch pythia8 program.
So in order to launch in pythia8 mode, you should first run output pythia8.
This is very inelegant...
My idea was the following.
1) launch ./examples/
-> launch this in pytia8 mode
2) launch ./examples/
-> ask which main files to run (this options is not mandatory)
3) launch
-> only if a output pythia8 was run before. (and launch the last created main automaticaly)
If you don't like the point 3, and want to ask which one to launch, this is fine for me, but the two other options are very important to my point of view.
We can look to this little, but important point, together if you want
Cheers,
Olivier
- 176. By Johan Alwall
-
Changed order of info after pythia8 output. Added check for valid Pythia 8 directory (include/Pythia.h) before allowing Pythia 8 output.
- 177. By Johan Alwall
-
Allow output of pythia8 files to invalid directory, but let launch fail instead
- 178. By Johan Alwall
-
Fixed one last mistake in launch
- 179. By Johan Alwall
-
Fixed typo in warning message
Preview Diff
1 | === modified file 'aloha/aloha_writers.py' |
2 | --- aloha/aloha_writers.py 2011-01-26 13:23:54 +0000 |
3 | +++ aloha/aloha_writers.py 2011-03-31 16:46:04 +0000 |
4 | @@ -49,7 +49,7 @@ |
5 | elif len(indices) == 2: |
6 | return 4 * indices[0] + indices[1] + start |
7 | else: |
8 | - raise Exception |
9 | + raise Exception, 'WRONG CONTRACTION OF LORENTZ OBJECT' |
10 | |
11 | def collect_variables(self): |
12 | """Collects Momenta,Mass,Width into lists""" |
13 | |
14 | === modified file 'aloha/create_aloha.py' |
15 | --- aloha/create_aloha.py 2011-02-10 01:07:57 +0000 |
16 | +++ aloha/create_aloha.py 2011-03-31 16:46:04 +0000 |
17 | @@ -583,7 +583,16 @@ |
18 | if particle.spin == 2 and particle.selfconjugate: |
19 | need = True |
20 | break |
21 | - |
22 | + |
23 | + if not need: |
24 | + for interaction in self.model.all_vertices: |
25 | + fermions = [p for p in interaction.particles if p.spin == 2] |
26 | + for i in range(0, len(fermions), 2): |
27 | + if fermions[i].pdg_code * fermions[i+1].pdg_code > 0: |
28 | + # This is a fermion flow violating interaction |
29 | + need = True |
30 | + break |
31 | + |
32 | # No majorana particles |
33 | if not need: |
34 | return {} |
35 | @@ -591,7 +600,7 @@ |
36 | conjugate_request = {} |
37 | # Check each vertex if they are fermion and/or majorana |
38 | for vertex in self.model.all_vertices: |
39 | - for i in range(0, len(vertex.particles),2): |
40 | + for i in range(0, len(vertex.particles), 2): |
41 | part1 = vertex.particles[i] |
42 | if part1.spin !=2: |
43 | # deal only with fermion |
44 | @@ -606,9 +615,9 @@ |
45 | # No majorana => add the associate lorentz structure |
46 | for lorentz in vertex.lorentz: |
47 | try: |
48 | - conjugate_request[lorentz.name].add(i+1) |
49 | + conjugate_request[lorentz.name].add(i//2+1) |
50 | except: |
51 | - conjugate_request[lorentz.name] = set([i+1]) |
52 | + conjugate_request[lorentz.name] = set([i//2+1]) |
53 | |
54 | for elem in conjugate_request: |
55 | conjugate_request[elem] = list(conjugate_request[elem]) |
56 | |
57 | === modified file 'madgraph/VERSION' |
58 | --- madgraph/VERSION 2011-03-24 16:15:56 +0000 |
59 | +++ madgraph/VERSION 2011-03-31 16:46:04 +0000 |
60 | @@ -1,2 +1,2 @@ |
61 | -version = 1.0.0.RC1 |
62 | -date = 2011-04-23 |
63 | +version = 1.0.0.RC2 |
64 | +date = 2011-03-30 |
65 | |
66 | === modified file 'madgraph/core/helas_objects.py' |
67 | --- madgraph/core/helas_objects.py 2011-02-08 16:27:15 +0000 |
68 | +++ madgraph/core/helas_objects.py 2011-03-31 16:46:04 +0000 |
69 | @@ -3298,6 +3298,21 @@ |
70 | self.get_all_wavefunctions() + self.get_all_amplitudes() \ |
71 | if wa.get('interaction_id') != 0] |
72 | |
73 | + def get_mirror_processes(self): |
74 | + """Return a list of processes with initial states interchanged |
75 | + if has mirror processes""" |
76 | + |
77 | + if not self.get('has_mirror_process'): |
78 | + return [] |
79 | + processes = base_objects.ProcessList() |
80 | + for proc in self.get('processes'): |
81 | + legs = copy.copy(proc.get('legs')) |
82 | + legs[0:2] = [legs[1],legs[0]] |
83 | + process = copy.copy(proc) |
84 | + process.set('legs', legs) |
85 | + processes.append(process) |
86 | + return processes |
87 | + |
88 | @staticmethod |
89 | def check_equal_decay_processes(decay1, decay2): |
90 | """Check if two single-sided decay processes |
91 | @@ -3950,3 +3965,7 @@ |
92 | |
93 | return list(set(coupling_list)) |
94 | |
95 | + def get_matrix_elements(self): |
96 | + """Extract the list of matrix elements""" |
97 | + |
98 | + return self.get('matrix_elements') |
99 | |
100 | === modified file 'madgraph/interface/cmd_interface.py' |
101 | --- madgraph/interface/cmd_interface.py 2011-03-24 16:15:56 +0000 |
102 | +++ madgraph/interface/cmd_interface.py 2011-03-31 16:46:04 +0000 |
103 | @@ -294,30 +294,31 @@ |
104 | |
105 | def help_output(self): |
106 | logger.info("syntax [" + "|".join(self._export_formats) + \ |
107 | - "] [name|.|auto] [options]") |
108 | + "] [path|.|auto] [options]") |
109 | logger.info("-- Output any generated process(es) to file.") |
110 | - logger.info(" mode: Default mode is madevent. Default path is \'.\'.") |
111 | + logger.info(" mode: Default mode is madevent. Default path is \'.\' or auto.") |
112 | logger.info(" - If mode is madevent, create a MadEvent process directory.") |
113 | logger.info(" - If mode is standalone, create a Standalone directory") |
114 | logger.info(" - If mode is matrix, output the matrix.f files for all") |
115 | - logger.info(" generated processes in directory \"name\".") |
116 | - logger.info(" If mode is standalone_cpp, create a standalone C++") |
117 | - logger.info(" directory.") |
118 | - logger.info(" If mode is pythia8, output the .h and .cc files for") |
119 | - logger.info(" the processes in Pythia 8 format in directory \"name\".") |
120 | - logger.info(" If mode is pythia8_model, output the .h and .cc files for") |
121 | - logger.info(" for the model parameters and Aloha functions for the model.") |
122 | - logger.info(" name: The name of the process directory.") |
123 | - logger.info(" If you put '.' instead of a name, your pwd will be used.") |
124 | - logger.info(" If you put 'auto', an automatic name PROC_XX_n will be created.") |
125 | + logger.info(" generated processes in directory \"path\".") |
126 | + logger.info(" - If mode is standalone_cpp, create a standalone C++") |
127 | + logger.info(" directory in \"path\".") |
128 | + logger.info(" - If mode is pythia8, output all files needed to generate") |
129 | + logger.info(" the processes using Pythia 8. Directory \"path\"") |
130 | + logger.info(" should be a Pythia 8 main directory (v. 8.150 or later).") |
131 | + logger.info(" path: The path of the process directory.") |
132 | + logger.info(" If you put '.' as path, your pwd will be used.") |
133 | + logger.info(" If you put 'auto', an automatic directory PROC_XX_n will be created.") |
134 | logger.info(" options:") |
135 | logger.info(" -f: force cleaning of the directory if it already exists") |
136 | logger.info(" -d: specify other MG/ME directory") |
137 | - logger.info(" -noclean: no cleaning performed in \"name\"") |
138 | - logger.info(" -nojpeg: no jpeg diagrams will be generated") |
139 | - logger.info(" Example:") |
140 | + logger.info(" -noclean: no cleaning performed in \"path\".") |
141 | + logger.info(" -nojpeg: no jpeg diagrams will be generated.") |
142 | + logger.info(" -name: the postfix of the main file in pythia8 mode.") |
143 | + logger.info(" Examples:") |
144 | logger.info(" output") |
145 | logger.info(" output standalone MYRUN -f") |
146 | + logger.info(" output pythia8 ../pythia8/ -name qcdprocs") |
147 | |
148 | def help_check(self): |
149 | |
150 | @@ -640,13 +641,17 @@ |
151 | |
152 | if not args: |
153 | if self._done_export: |
154 | + mode = self.find_output_type(self._done_export[0]) |
155 | + if mode != self._done_export[1]: |
156 | + raise self.InvalidCmd, \ |
157 | + '%s not valid directory for launch' % self._done_export[0] |
158 | args.append(self._done_export[1]) |
159 | args.append(self._done_export[0]) |
160 | return |
161 | else: |
162 | self.help_launch() |
163 | raise self.InvalidCmd, \ |
164 | - 'Impossible to use default location: No output command runned' |
165 | + 'No default location available, please specify location.' |
166 | |
167 | if len(args) != 1: |
168 | self.help_launch() |
169 | @@ -675,17 +680,20 @@ |
170 | |
171 | card_path = os.path.join(path,'Cards') |
172 | bin_path = os.path.join(path,'bin') |
173 | + src_path = os.path.join(path,'src') |
174 | + include_path = os.path.join(path,'include') |
175 | subproc_path = os.path.join(path,'SubProcesses') |
176 | - |
177 | - if not os.path.isdir(card_path) or not os.path.isdir(subproc_path): |
178 | - raise self.InvalidCmd, '%s : Not a valid directory' % path |
179 | |
180 | - if not os.path.isdir(bin_path): |
181 | + if os.path.isfile(os.path.join(include_path, 'Pythia.h')): |
182 | + return 'pythia8' |
183 | + elif os.path.isdir(src_path): |
184 | return 'standalone_cpp' |
185 | elif os.path.isfile(os.path.join(bin_path,'generate_events')): |
186 | return 'madevent' |
187 | - else: |
188 | + elif os.path.isdir(card_path): |
189 | return 'standalone' |
190 | + |
191 | + raise self.InvalidCmd, '%s : Not a valid directory' % path |
192 | |
193 | def check_load(self, args): |
194 | """ check the validity of the line""" |
195 | @@ -727,8 +735,10 @@ |
196 | |
197 | if args and args[0] in self._export_formats: |
198 | self._export_format = args.pop(0) |
199 | + else: |
200 | + self._export_format = 'madevent' |
201 | |
202 | - if not self._curr_amps and self._export_format != "pythia8_model": |
203 | + if not self._curr_amps: |
204 | text = 'No processes generated. Please generate a process first.' |
205 | raise self.InvalidCmd(text) |
206 | |
207 | @@ -760,6 +770,12 @@ |
208 | # No valid path |
209 | self.get_default_path() |
210 | |
211 | + if self._done_export == (self._export_dir, self._export_format): |
212 | + # We have already done export in this path |
213 | + logger.info("Matrix elements already exported to directory %s" % \ |
214 | + self._export_dir) |
215 | + return |
216 | + |
217 | if self._export_format in ['madevent', 'standalone'] \ |
218 | and not self._mgme_dir and \ |
219 | os.path.realpath(self._export_dir) != os.path.realpath('.'): |
220 | @@ -1357,8 +1373,7 @@ |
221 | _check_opts = ['full', 'permutation', 'gauge', 'lorentz_invariance'] |
222 | _import_formats = ['model_v4', 'model', 'proc_v4', 'command'] |
223 | _v4_export_formats = ['madevent', 'standalone', 'matrix'] |
224 | - _export_formats = _v4_export_formats + ['standalone_cpp', 'pythia8', |
225 | - 'pythia8_model'] |
226 | + _export_formats = _v4_export_formats + ['standalone_cpp', 'pythia8'] |
227 | _set_options = ['group_subprocesses_output', |
228 | 'ignore_six_quark_processes'] |
229 | # Variables to store object information |
230 | @@ -1437,57 +1452,55 @@ |
231 | # Reset Helas matrix elements |
232 | self._curr_matrix_elements = helas_objects.HelasMultiProcess() |
233 | |
234 | - try: |
235 | - if line.find(',') == -1: |
236 | - myprocdef = self.extract_process(line) |
237 | + # Extract process from process definition |
238 | + if ',' in line: |
239 | + myprocdef, line = self.extract_decay_chain_process(line) |
240 | + else: |
241 | + myprocdef = self.extract_process(line) |
242 | + |
243 | + # Check that we have something |
244 | + if not myprocdef: |
245 | + raise MadGraph5Error("Empty or wrong format process, please try again.") |
246 | + |
247 | + cpu_time1 = time.time() |
248 | + |
249 | + # Generate processes |
250 | + collect_mirror_procs = \ |
251 | + self._options['group_subprocesses_output'] |
252 | + ignore_six_quark_processes = \ |
253 | + self._options['ignore_six_quark_processes'] if \ |
254 | + "ignore_six_quark_processes" in self._options \ |
255 | + else [] |
256 | + |
257 | + myproc = diagram_generation.MultiProcess(myprocdef, |
258 | + collect_mirror_procs =\ |
259 | + collect_mirror_procs, |
260 | + ignore_six_quark_processes = \ |
261 | + ignore_six_quark_processes) |
262 | + |
263 | + for amp in myproc.get('amplitudes'): |
264 | + if amp not in self._curr_amps: |
265 | + self._curr_amps.append(amp) |
266 | else: |
267 | - myprocdef, line = self.extract_decay_chain_process(line) |
268 | - except MadGraph5Error, error: |
269 | - logger_stderr.warning("Empty or wrong format process :\n" + \ |
270 | - str(error)) |
271 | - return |
272 | - |
273 | - if myprocdef: |
274 | - |
275 | - cpu_time1 = time.time() |
276 | - |
277 | - # Generate processes |
278 | - collect_mirror_procs = \ |
279 | - self._options['group_subprocesses_output'] |
280 | - ignore_six_quark_processes = \ |
281 | - self._options['ignore_six_quark_processes'] if \ |
282 | - "ignore_six_quark_processes" in self._options \ |
283 | - else [] |
284 | - |
285 | - myproc = diagram_generation.MultiProcess(myprocdef, |
286 | - collect_mirror_procs =\ |
287 | - collect_mirror_procs, |
288 | - ignore_six_quark_processes = \ |
289 | - ignore_six_quark_processes) |
290 | - |
291 | - for amp in myproc.get('amplitudes'): |
292 | - if amp not in self._curr_amps: |
293 | - self._curr_amps.append(amp) |
294 | - else: |
295 | - warning = "Warning: Already in processes:\n%s" % \ |
296 | - amp.nice_string_processes() |
297 | - logger.warning(warning) |
298 | - |
299 | - |
300 | - # Reset _done_export, since we have new process |
301 | - self._done_export = False |
302 | - |
303 | - cpu_time2 = time.time() |
304 | - |
305 | - nprocs = len(myproc.get('amplitudes')) |
306 | - ndiags = sum([amp.get_number_of_diagrams() for \ |
307 | - amp in myproc.get('amplitudes')]) |
308 | - logger.info("%i processes with %i diagrams generated in %0.3f s" % \ |
309 | - (nprocs, ndiags, (cpu_time2 - cpu_time1))) |
310 | - ndiags = sum([amp.get_number_of_diagrams() for \ |
311 | - amp in self._curr_amps]) |
312 | - logger.info("Total: %i processes with %i diagrams" % \ |
313 | - (len(self._curr_amps), ndiags)) |
314 | + warning = "Warning: Already in processes:\n%s" % \ |
315 | + amp.nice_string_processes() |
316 | + logger.warning(warning) |
317 | + |
318 | + |
319 | + # Reset _done_export, since we have new process |
320 | + self._done_export = False |
321 | + |
322 | + cpu_time2 = time.time() |
323 | + |
324 | + nprocs = len(myproc.get('amplitudes')) |
325 | + ndiags = sum([amp.get_number_of_diagrams() for \ |
326 | + amp in myproc.get('amplitudes')]) |
327 | + logger.info("%i processes with %i diagrams generated in %0.3f s" % \ |
328 | + (nprocs, ndiags, (cpu_time2 - cpu_time1))) |
329 | + ndiags = sum([amp.get_number_of_diagrams() for \ |
330 | + amp in self._curr_amps]) |
331 | + logger.info("Total: %i processes with %i diagrams" % \ |
332 | + (len(self._curr_amps), ndiags)) |
333 | |
334 | # Define a multiparticle label |
335 | def do_define(self, line, log=True): |
336 | @@ -1816,48 +1829,21 @@ |
337 | def do_generate(self, line): |
338 | """Generate an amplitude for a given process""" |
339 | |
340 | - args = split_arg(line) |
341 | - |
342 | - # Check args validity |
343 | - self.check_generate(args) |
344 | - |
345 | + # Reset amplitudes |
346 | + self._curr_amps = diagram_generation.AmplitudeList() |
347 | # Reset Helas matrix elements |
348 | - self._curr_matrix_elements = helas_objects.HelasMultiProcess() |
349 | + self._curr_matrix_elements = None |
350 | self._generate_info = line |
351 | # Reset _done_export, since we have new process |
352 | self._done_export = False |
353 | - |
354 | - # Extract process from process definition |
355 | - if ',' in line: |
356 | - myprocdef, line = self.extract_decay_chain_process(line) |
357 | - else: |
358 | - myprocdef = self.extract_process(line) |
359 | - |
360 | - # Check that we have something |
361 | - if not myprocdef: |
362 | - raise MadGraph5Error("Empty or wrong format process, please try again.") |
363 | - |
364 | - cpu_time1 = time.time() |
365 | - # Generate processes |
366 | - collect_mirror_procs = self._options['group_subprocesses_output'] |
367 | - ignore_six_quark_processes = \ |
368 | - self._options['ignore_six_quark_processes'] if \ |
369 | - "ignore_six_quark_processes" in self._options \ |
370 | - else [] |
371 | - |
372 | - myproc = diagram_generation.MultiProcess(myprocdef, |
373 | - collect_mirror_procs = \ |
374 | - collect_mirror_procs, |
375 | - ignore_six_quark_processes = \ |
376 | - ignore_six_quark_processes) |
377 | - self._curr_amps = myproc.get('amplitudes') |
378 | - cpu_time2 = time.time() |
379 | - |
380 | - nprocs = len(self._curr_amps) |
381 | - ndiags = sum([amp.get_number_of_diagrams() for \ |
382 | - amp in self._curr_amps]) |
383 | - logger.info("%i processes with %i diagrams generated in %0.3f s" % \ |
384 | - (nprocs, ndiags, (cpu_time2 - cpu_time1))) |
385 | + # Also reset _export_format and _export_dir |
386 | + self._export_format = None |
387 | + |
388 | + # Call add process |
389 | + args = split_arg(line) |
390 | + args.insert(0, 'process') |
391 | + |
392 | + self.do_add(" ".join(args)) |
393 | |
394 | def extract_process(self, line, proc_number = 0, overall_orders = {}): |
395 | """Extract a process definition from a string. Returns |
396 | @@ -2365,7 +2351,7 @@ |
397 | def check_for_export_dir(self, filepath): |
398 | """Check if the files is in a valid export directory and assign it to |
399 | export path if if is""" |
400 | - |
401 | + |
402 | # keep previous if a previous one is defined |
403 | if self._export_dir: |
404 | return |
405 | @@ -2373,8 +2359,8 @@ |
406 | path_split = filepath.split(os.path.sep) |
407 | if len(path_split) > 2 and path_split[-2] == 'Cards': |
408 | self._export_dir = os.path.sep.join(path_split[:-2]) |
409 | - |
410 | - |
411 | + |
412 | + |
413 | def do_launch(self, line): |
414 | """Ask for editing the parameter and then |
415 | Execute the code (madevent/standalone/...) |
416 | @@ -2390,7 +2376,9 @@ |
417 | if args[0].startswith('standalone'): |
418 | ext_program = launch_ext.SALauncher(args[1], self.timeout, **options) |
419 | elif args[0] == 'madevent': |
420 | - ext_program = launch_ext.MELauncher(args[1], self.timeout, **options) |
421 | + ext_program = launch_ext.MELauncher(args[1], self.timeout, **options) |
422 | + elif args[0] == 'pythia8': |
423 | + ext_program = launch_ext.Pythia8Launcher(args[1], self.timeout, **options) |
424 | else: |
425 | raise self.InvalidCmd , '%s cannot be run from MG5 interface' % args[0] |
426 | |
427 | @@ -2531,7 +2519,12 @@ |
428 | noclean = '-noclean' in args |
429 | force = '-f' in args |
430 | nojpeg = '-nojpeg' in args |
431 | - |
432 | + main_file_name = "" |
433 | + try: |
434 | + main_file_name = args[args.index('-name') + 1] |
435 | + except: |
436 | + pass |
437 | + |
438 | if self._done_export == (self._export_dir, self._export_format): |
439 | logger.info('Matrix elements already exported to directory %s' % \ |
440 | self._export_dir) |
441 | @@ -2575,134 +2568,104 @@ |
442 | self._done_export = False |
443 | |
444 | # Perform export and finalize right away |
445 | - options = '' |
446 | - if nojpeg: |
447 | - options = '-nojpeg' |
448 | + self.export(nojpeg, main_file_name) |
449 | |
450 | - self.export(options) |
451 | + # Reset _export_dir, so we don't overwrite by mistake later |
452 | + self._export_dir = None |
453 | |
454 | # Export a matrix element |
455 | - def export(self, line): |
456 | + def export(self, nojpeg = False, main_file_name = ""): |
457 | """Export a generated amplitude to file""" |
458 | |
459 | def generate_matrix_elements(self): |
460 | """Helper function to generate the matrix elements before |
461 | exporting""" |
462 | |
463 | + # Sort amplitudes according to number of diagrams, |
464 | + # to get most efficient multichannel output |
465 | + self._curr_amps.sort(lambda a1, a2: a2.get_number_of_diagrams() - \ |
466 | + a1.get_number_of_diagrams()) |
467 | + |
468 | cpu_time1 = time.time() |
469 | - if not self._curr_matrix_elements.get('matrix_elements'): |
470 | - self._curr_matrix_elements = \ |
471 | - helas_objects.HelasMultiProcess(\ |
472 | - self._curr_amps) |
473 | + ndiags = 0 |
474 | + if not self._curr_matrix_elements.get_matrix_elements(): |
475 | + if self._options['group_subprocesses_output']: |
476 | + cpu_time1 = time.time() |
477 | + dc_amps = [amp for amp in self._curr_amps if isinstance(amp, \ |
478 | + diagram_generation.DecayChainAmplitude)] |
479 | + non_dc_amps = diagram_generation.AmplitudeList(\ |
480 | + [amp for amp in self._curr_amps if not \ |
481 | + isinstance(amp, \ |
482 | + diagram_generation.DecayChainAmplitude)]) |
483 | + subproc_groups = group_subprocs.SubProcessGroupList() |
484 | + if non_dc_amps: |
485 | + subproc_groups.extend(\ |
486 | + group_subprocs.SubProcessGroup.group_amplitudes(\ |
487 | + non_dc_amps)) |
488 | + for dc_amp in dc_amps: |
489 | + dc_subproc_group = \ |
490 | + group_subprocs.DecayChainSubProcessGroup.\ |
491 | + group_amplitudes(dc_amp) |
492 | + subproc_groups.extend(\ |
493 | + dc_subproc_group.\ |
494 | + generate_helas_decay_chain_subproc_groups()) |
495 | + |
496 | + ndiags = sum([len(m.get('diagrams')) for m in \ |
497 | + subproc_groups.get_matrix_elements()]) |
498 | + self._curr_matrix_elements = subproc_groups |
499 | + # assign a unique id number to all groups |
500 | + uid = 0 |
501 | + for group in subproc_groups: |
502 | + uid += 1 # update the identification number |
503 | + for me in group.get('matrix_elements'): |
504 | + me.get('processes')[0].set('uid', uid) |
505 | + else: |
506 | + self._curr_matrix_elements = \ |
507 | + helas_objects.HelasMultiProcess(\ |
508 | + self._curr_amps) |
509 | + ndiags = sum([len(me.get('diagrams')) for \ |
510 | + me in self._curr_matrix_elements.\ |
511 | + get_matrix_elements()]) |
512 | + # assign a unique id number to all process |
513 | + uid = 0 |
514 | + for me in self._curr_matrix_elements.get_matrix_elements(): |
515 | + uid += 1 # update the identification number |
516 | + me.get('processes')[0].set('uid', uid) |
517 | + |
518 | cpu_time2 = time.time() |
519 | - |
520 | - ndiags = sum([len(me.get('diagrams')) for \ |
521 | - me in self._curr_matrix_elements.\ |
522 | - get('matrix_elements')]) |
523 | - |
524 | return ndiags, cpu_time2 - cpu_time1 |
525 | |
526 | # Start of the actual routine |
527 | |
528 | - args = split_arg(line) |
529 | - # Check the validity of the arguments and return the output path |
530 | - if __debug__: |
531 | - self.check_output(args) |
532 | - |
533 | - if self._export_format == 'pythia8_model': |
534 | - cpu_time1 = time.time() |
535 | - export_cpp.convert_model_to_pythia8(\ |
536 | - self._curr_model, self._export_dir) |
537 | - cpu_time2 = time.time() |
538 | - logger.info(("Exported UFO model to Pythia 8 format in %0.3f s") \ |
539 | - % (cpu_time2 - cpu_time1)) |
540 | - |
541 | - return |
542 | - |
543 | - if self._done_export == (self._export_dir, self._export_format): |
544 | - # We have already done export in this path |
545 | - logger.info("Matrix elements already exported to directory %s" % \ |
546 | - self._export_dir) |
547 | - return |
548 | - |
549 | - # Determine if we want to group subprocesses |
550 | - group_subprocesses = self._export_format == 'madevent' and \ |
551 | - self._options['group_subprocesses_output'] |
552 | - |
553 | - if not group_subprocesses: |
554 | - # Do not generate matrix elements, since this is done by the |
555 | - # SubProcessGroup objects |
556 | - ndiags, cpu_time = generate_matrix_elements(self) |
557 | + ndiags, cpu_time = generate_matrix_elements(self) |
558 | |
559 | calls = 0 |
560 | |
561 | - nojpeg = '-nojpeg' in args |
562 | - |
563 | path = self._export_dir |
564 | if self._export_format in ['standalone_cpp', 'madevent', 'standalone']: |
565 | path = os.path.join(path, 'SubProcesses') |
566 | - |
567 | + |
568 | + cpu_time1 = time.time() |
569 | + |
570 | + # First treat madevent and pythia8 exports, where we need to |
571 | + # distinguish between grouped and ungrouped subprocesses |
572 | + |
573 | + # MadEvent |
574 | if self._export_format == 'madevent': |
575 | - # Sort amplitudes according to number of diagrams, |
576 | - # to get most efficient multichannel output |
577 | - self._curr_amps.sort(lambda a1, a2: a2.get_number_of_diagrams() - \ |
578 | - a1.get_number_of_diagrams()) |
579 | - |
580 | - if group_subprocesses: |
581 | - ndiags = 0 |
582 | - cpu_time1 = time.time() |
583 | - dc_amps = [amp for amp in self._curr_amps if isinstance(amp, \ |
584 | - diagram_generation.DecayChainAmplitude)] |
585 | - non_dc_amps = diagram_generation.AmplitudeList(\ |
586 | - [amp for amp in self._curr_amps if not \ |
587 | - isinstance(amp, \ |
588 | - diagram_generation.DecayChainAmplitude)]) |
589 | - subproc_groups = group_subprocs.SubProcessGroupList() |
590 | - if non_dc_amps: |
591 | - subproc_groups.extend(\ |
592 | - group_subprocs.SubProcessGroup.group_amplitudes(\ |
593 | - non_dc_amps)) |
594 | - for dc_amp in dc_amps: |
595 | - dc_subproc_group = \ |
596 | - group_subprocs.DecayChainSubProcessGroup.\ |
597 | - group_amplitudes(dc_amp) |
598 | - subproc_groups.extend(\ |
599 | - dc_subproc_group.\ |
600 | - generate_helas_decay_chain_subproc_groups()) |
601 | - |
602 | - cpu_time1 = time.time() |
603 | - for sp_group in subproc_groups: |
604 | - ndiags = ndiags + sum([len(m.get('diagrams')) for m in \ |
605 | - sp_group.get('matrix_elements')]) |
606 | - cpu_time = time.time() - cpu_time1 |
607 | - cpu_time1 = time.time() |
608 | - for (group_number, me_group) in enumerate(subproc_groups): |
609 | + if isinstance(self._curr_matrix_elements, group_subprocs.SubProcessGroupList): |
610 | + for (group_number, me_group) in enumerate(self._curr_matrix_elements): |
611 | calls = calls + \ |
612 | self._curr_exporter.generate_subprocess_directory_v4(\ |
613 | me_group, self._curr_fortran_model, |
614 | group_number) |
615 | - matrix_elements = \ |
616 | - me_group.get('matrix_elements') |
617 | - self._curr_matrix_elements.get('matrix_elements').\ |
618 | - extend(matrix_elements) |
619 | - cpu_time2 = time.time() - cpu_time1 |
620 | else: |
621 | - cpu_time1 = time.time() |
622 | for me_number, me in \ |
623 | - enumerate(self._curr_matrix_elements.get('matrix_elements')): |
624 | + enumerate(self._curr_matrix_elements.get_matrix_elements()): |
625 | calls = calls + \ |
626 | self._curr_exporter.generate_subprocess_directory_v4(\ |
627 | me, self._curr_fortran_model, me_number) |
628 | |
629 | - cpu_time2 = time.time() - cpu_time1 |
630 | |
631 | - # assign a unique id number to all process |
632 | - uid = 0 |
633 | - for me in self._curr_matrix_elements.get('matrix_elements'): |
634 | - for proc in me.get('processes'): |
635 | - uid += 1 # update the identification number |
636 | - proc.set('uid', uid) # assign it to the process |
637 | - |
638 | # Write the procdef_mg5.dat file with process info |
639 | card_path = os.path.join(path, os.path.pardir, 'SubProcesses', \ |
640 | 'procdef_mg5.dat') |
641 | @@ -2715,15 +2678,48 @@ |
642 | except: |
643 | pass |
644 | |
645 | + # Pythia 8 |
646 | + if self._export_format == 'pythia8': |
647 | + # Output the model parameter and ALOHA files |
648 | + model_name, model_path = export_cpp.convert_model_to_pythia8(\ |
649 | + self._curr_model, self._export_dir) |
650 | + # Output the process files |
651 | + process_names = [] |
652 | + if isinstance(self._curr_matrix_elements, group_subprocs.SubProcessGroupList): |
653 | + for (group_number, me_group) in enumerate(self._curr_matrix_elements): |
654 | + exporter = export_cpp.generate_process_files_pythia8(\ |
655 | + me_group.get('matrix_elements'), self._curr_cpp_model, |
656 | + process_string = me_group.get('name'), |
657 | + process_number = group_number, path = path) |
658 | + process_names.append(exporter.process_name) |
659 | + else: |
660 | + exporter = export_cpp.generate_process_files_pythia8(\ |
661 | + self._curr_matrix_elements, self._curr_cpp_model, |
662 | + process_string = self._generate_info, path = path) |
663 | + process_names.append(exporter.process_file_name) |
664 | + |
665 | + # Generate the main program file |
666 | + filename, make_filename = \ |
667 | + export_cpp.generate_example_file_pythia8(path, |
668 | + model_path, |
669 | + process_names, |
670 | + exporter, |
671 | + main_file_name) |
672 | + |
673 | + # Pick out the matrix elements in a list |
674 | + matrix_elements = \ |
675 | + self._curr_matrix_elements.get_matrix_elements() |
676 | + |
677 | + # Fortran MadGraph Standalone |
678 | if self._export_format == 'standalone': |
679 | - for me in self._curr_matrix_elements.get('matrix_elements'): |
680 | + for me in matrix_elements: |
681 | calls = calls + \ |
682 | self._curr_exporter.generate_subprocess_directory_v4(\ |
683 | me, self._curr_fortran_model) |
684 | - |
685 | + |
686 | + # Just the matrix.f files |
687 | if self._export_format == 'matrix': |
688 | - cpu_time1 = time.time() |
689 | - for me in self._curr_matrix_elements.get('matrix_elements'): |
690 | + for me in matrix_elements: |
691 | filename = os.path.join(path, 'matrix_' + \ |
692 | me.get('processes')[0].shell_string() + ".f") |
693 | if os.path.isfile(filename): |
694 | @@ -2733,22 +2729,19 @@ |
695 | calls = calls + self._curr_exporter.write_matrix_element_v4(\ |
696 | writers.FortranWriter(filename),\ |
697 | me, self._curr_fortran_model) |
698 | - cpu_time2 = time.time() - cpu_time1 |
699 | |
700 | - if self._export_format == 'pythia8': |
701 | - export_cpp.generate_process_files_pythia8(\ |
702 | - self._curr_matrix_elements, self._curr_cpp_model, |
703 | - process_string = self._generate_info, path = path) |
704 | - |
705 | + # C++ standalone |
706 | if self._export_format == 'standalone_cpp': |
707 | - for me in self._curr_matrix_elements.get('matrix_elements'): |
708 | + for me in matrix_elements: |
709 | export_cpp.generate_subprocess_directory_standalone_cpp(\ |
710 | me, self._curr_cpp_model, |
711 | path = path) |
712 | |
713 | + cpu_time2 = time.time() - cpu_time1 |
714 | + |
715 | logger.info(("Generated helas calls for %d subprocesses " + \ |
716 | "(%d diagrams) in %0.3f s") % \ |
717 | - (len(self._curr_matrix_elements.get('matrix_elements')), |
718 | + (len(matrix_elements), |
719 | ndiags, cpu_time)) |
720 | |
721 | if calls: |
722 | @@ -2758,37 +2751,33 @@ |
723 | else: |
724 | logger.info("Wrote files for %d helas calls" % \ |
725 | (calls)) |
726 | + |
727 | + if self._export_format == 'pythia8': |
728 | + logger.info("- All necessary files for Pythia 8 generated.") |
729 | + logger.info(" Please go to %s/examples and run" % path) |
730 | + logger.info(" make -f %s" % make_filename) |
731 | + logger.info(" (with process_name replaced by process name).") |
732 | + logger.info(" You can then run ./%s to produce events for the process" % \ |
733 | + filename) |
734 | + logger.info("- Or run launch and select %s.cc." % filename) |
735 | + |
736 | # Replace the amplitudes with the actual amplitudes from the |
737 | # matrix elements, which allows proper diagram drawing also of |
738 | # decay chain processes |
739 | self._curr_amps = diagram_generation.AmplitudeList(\ |
740 | [me.get('base_amplitude') for me in \ |
741 | - self._curr_matrix_elements.get('matrix_elements')]) |
742 | + matrix_elements]) |
743 | |
744 | # Remember that we have done export |
745 | self._done_export = (self._export_dir, self._export_format) |
746 | |
747 | - if self._export_format in ['madevent', 'standalone', 'standalone_cpp']: |
748 | - # Automatically run finalize |
749 | - options = [] |
750 | - if nojpeg: |
751 | - options = ['-nojpeg'] |
752 | - |
753 | - self.finalize(options) |
754 | + # Automatically run finalize |
755 | + self.finalize(nojpeg) |
756 | |
757 | - #reinitialize to empty the default output dir |
758 | - self._export_dir = None |
759 | - |
760 | - def finalize(self, options): |
761 | + def finalize(self, nojpeg): |
762 | """Make the html output, write proc_card_mg5.dat and create |
763 | madevent.tar.gz for a MadEvent directory""" |
764 | |
765 | - #look if the user ask to bypass the jpeg creation |
766 | - if '-nojpeg' in options: |
767 | - makejpg = False |
768 | - else: |
769 | - makejpg = True |
770 | - |
771 | # For v4 models, copy the model/HELAS information. |
772 | if self._model_v4_path: |
773 | logger.info('Copy %s model files to directory %s' % \ |
774 | @@ -2822,14 +2811,18 @@ |
775 | self._curr_exporter.finalize_v4_directory( \ |
776 | [self.history_header] + \ |
777 | self.history, |
778 | - makejpg) |
779 | + not nojpeg) |
780 | |
781 | - logger.info('Output to directory ' + self._export_dir + ' done.') |
782 | + if self._export_format in ['madevent', 'standalone', 'standalone_cpp']: |
783 | + logger.info('Output to directory ' + self._export_dir + ' done.') |
784 | if self._export_format == 'madevent': |
785 | logger.info('Please see ' + self._export_dir + '/README') |
786 | logger.info('for information about how to generate events from this process.') |
787 | logger.info('You can also use the launch command.') |
788 | |
789 | + #reinitialize to empty the default output dir |
790 | + self._export_dir = None |
791 | + |
792 | def do_restrict(self, line): |
793 | """ from a param_card.dat remove all zero interactions |
794 | and all zero external parameter.""" |
795 | @@ -2939,9 +2932,11 @@ |
796 | |
797 | # LAUNCH PROGRAM |
798 | _launch_usage = "launch [DIRPATH] [options]\n" + \ |
799 | - "-- execute the madevent/standalone output present in DIRPATH\n" + \ |
800 | + "-- execute the madevent/standalone/standalone_cpp/pythia8 output present in DIRPATH\n" + \ |
801 | " By default DIRPATH is the latest created directory \n" + \ |
802 | - " Example: launch PROC_SM_1 --name=run2 \n" |
803 | + " (for pythia8, it should be the Pythia 8 main directory) \n" + \ |
804 | + " Example: launch PROC_sm_1 --name=run2 \n" + \ |
805 | + " Example: launch ../pythia8 \n" |
806 | _launch_parser = optparse.OptionParser(usage=_launch_usage) |
807 | _launch_parser.add_option("-f", "--force", default=False, action='store_true', |
808 | help="Use the card present in the directory in order to launch the different program") |
809 | |
810 | === modified file 'madgraph/interface/extended_cmd.py' |
811 | --- madgraph/interface/extended_cmd.py 2011-03-15 12:57:11 +0000 |
812 | +++ madgraph/interface/extended_cmd.py 2011-03-31 16:46:04 +0000 |
813 | @@ -239,7 +239,8 @@ |
814 | text+='\t %s \n' % option |
815 | print text |
816 | |
817 | - def list_completion(self, text, list): |
818 | + @staticmethod |
819 | + def list_completion(text, list): |
820 | """Propose completions of text in list""" |
821 | if not text: |
822 | completions = list |
823 | @@ -299,9 +300,9 @@ |
824 | |
825 | |
826 | #=============================================================================== |
827 | -# Question in order to return a path with auto-completion |
828 | +# Question with auto-completion |
829 | #=============================================================================== |
830 | -class OneLinePathCompletion(cmd.Cmd): |
831 | +class SmartQuestion(cmd.Cmd): |
832 | """ a class for answering a question with the path autocompletion""" |
833 | |
834 | def preloop(self): |
835 | @@ -309,31 +310,42 @@ |
836 | self.prompt = '' |
837 | self.value = None |
838 | |
839 | - def __init__(self, allow_arg=[],*arg, **opt): |
840 | + def __init__(self, allow_arg=[], default=None, *arg, **opt): |
841 | self.allow_arg = allow_arg |
842 | self.history_header = '' |
843 | + self.default_value = default |
844 | cmd.Cmd.__init__(self, *arg, **opt) |
845 | |
846 | def completenames(self, text, *ignored): |
847 | signal.alarm(0) # avoid timer if any |
848 | try: |
849 | - return Cmd.path_completion(text,'.', only_dirs = False) |
850 | + return Cmd.list_completion(text, self.allow_arg) |
851 | except Exception, error: |
852 | print error |
853 | |
854 | def default(self, line): |
855 | """Default action if line is not recognized""" |
856 | - self.value = line |
857 | + |
858 | + if line == '' and self.default_value is not None: |
859 | + self.value = self.default_value |
860 | + else: |
861 | + self.value = line |
862 | + |
863 | + def emptyline(self): |
864 | + """If empty line, return default""" |
865 | + |
866 | + if self.default_value is not None: |
867 | + self.value = self.default_value |
868 | |
869 | def postcmd(self, stop, line): |
870 | |
871 | try: |
872 | - if self.value in self.allow_arg or os.path.isfile(self.value): |
873 | + if self.value in self.allow_arg: |
874 | return True |
875 | else: |
876 | raise Exception |
877 | except Exception: |
878 | - print """not valid argument. Valid argument are file path or value in (%s).""" \ |
879 | + print """not valid argument. Valid argument are in (%s).""" \ |
880 | % ','.join(self.allow_arg) |
881 | print 'please retry' |
882 | return False |
883 | @@ -343,11 +355,44 @@ |
884 | return self.value |
885 | |
886 | # a function helper |
887 | -def raw_path_input(input_text, allow_arg=[]): |
888 | - print input_text |
889 | - obj = OneLinePathCompletion(allow_arg=allow_arg) |
890 | - return os.path.relpath(obj.cmdloop()) |
891 | - |
892 | +def smart_input(input_text, allow_arg=[], default=None): |
893 | + print input_text |
894 | + obj = SmartQuestion(allow_arg=allow_arg, default=default) |
895 | + return obj.cmdloop() |
896 | + |
897 | +#=============================================================================== |
898 | +# Question in order to return a path with auto-completion |
899 | +#=============================================================================== |
900 | +class OneLinePathCompletion(SmartQuestion): |
901 | + """ a class for answering a question with the path autocompletion""" |
902 | + |
903 | + |
904 | + def completenames(self, text, *ignored): |
905 | + signal.alarm(0) # avoid timer if any |
906 | + |
907 | + return SmartQuestion.completenames(self, text) + Cmd.path_completion(text,'.', only_dirs = False) |
908 | + |
909 | + def postcmd(self, stop, line): |
910 | + |
911 | + try: |
912 | + if self.value in self.allow_arg: |
913 | + return True |
914 | + elif os.path.isfile(self.value): |
915 | + return os.path.relpath(self.value) |
916 | + else: |
917 | + raise Exception |
918 | + except Exception, error: |
919 | + print """not valid argument. Valid argument are file path or value in (%s).""" \ |
920 | + % ','.join(self.allow_arg) |
921 | + print 'please retry' |
922 | + return False |
923 | + |
924 | +# a function helper |
925 | +def raw_path_input(input_text, allow_arg=[], default=None): |
926 | + print input_text |
927 | + obj = OneLinePathCompletion(allow_arg=allow_arg, default=default ) |
928 | + return obj.cmdloop() |
929 | + |
930 | #=============================================================================== |
931 | # |
932 | #=============================================================================== |
933 | |
934 | === modified file 'madgraph/interface/launch_ext_program.py' |
935 | --- madgraph/interface/launch_ext_program.py 2011-03-20 20:39:57 +0000 |
936 | +++ madgraph/interface/launch_ext_program.py 2011-03-31 16:46:04 +0000 |
937 | @@ -13,10 +13,13 @@ |
938 | # |
939 | ################################################################################ |
940 | |
941 | +import glob |
942 | import logging |
943 | import os |
944 | +import pydoc |
945 | +import re |
946 | import subprocess |
947 | - |
948 | +import time |
949 | |
950 | import madgraph.iolibs.files as files |
951 | import madgraph.iolibs.misc as misc |
952 | @@ -93,13 +96,33 @@ |
953 | path = os.path.realpath(path) |
954 | subprocess.call([self.editor, path], cwd=os.getcwd()) |
955 | |
956 | - def ask(self, question, default): |
957 | + def ask(self, question, default, choices=[], path_info=[]): |
958 | """ ask a question """ |
959 | |
960 | + assert type(path_info) == list |
961 | + |
962 | if not self.force: |
963 | + # add choice info to the question |
964 | + if choices + path_info: |
965 | + question += ' [' |
966 | + |
967 | + for data in choices[:9] + path_info: |
968 | + if default == data: |
969 | + question += "\033[%dm%s\033[0m" % (4, data) |
970 | + else: |
971 | + question += "%s" % data |
972 | + question += ', ' |
973 | + if len(choices) > 9: |
974 | + question += ', ... , ' |
975 | + question = question[:-2]+']' |
976 | + |
977 | + if path_info: |
978 | + fct = lambda q: cmd.raw_path_input(q, allow_arg=choices, default=default) |
979 | + else: |
980 | + fct = lambda q: cmd.smart_input(q, allow_arg=choices, default=default) |
981 | try: |
982 | out = misc.timed_input(question, default, timeout=self.timeout, |
983 | - noerror=False) |
984 | + noerror=False, fct=fct) |
985 | except misc.TimeOutError: |
986 | # avoid to always wait a given time for the next answer |
987 | self.force = True |
988 | @@ -122,19 +145,13 @@ |
989 | |
990 | if not self.force: |
991 | if msg: print msg |
992 | - question = 'Do you want to edit file: %(card)s? [y/n/path of the new %(card)s]' |
993 | - question = question % {'card':filename} |
994 | - try: |
995 | - ans = misc.timed_input(question, default, timeout=self.timeout, |
996 | - noerror=False, fct=fct) |
997 | - except misc.TimeOutError: |
998 | - # avoid to always wait a given time for the next answer |
999 | - self.force = True |
1000 | - else: |
1001 | - self.timeout=None # answer at least one question so wait... |
1002 | + question = 'Do you want to edit file: %(card)s?' % {'card':filename} |
1003 | + choices = ['y', 'n'] |
1004 | + path_info = ['path of the new %(card)s' % {'card':os.path.basename(filename)}] |
1005 | + ans = self.ask(question, default, choices, path_info) |
1006 | else: |
1007 | ans = default |
1008 | - |
1009 | + |
1010 | if ans == 'y': |
1011 | path = os.path.join(self.card_dir, filename) |
1012 | self.edit_file(path) |
1013 | @@ -143,9 +160,7 @@ |
1014 | else: |
1015 | path = os.path.join(self.card_dir, filename) |
1016 | files.cp(ans, path) |
1017 | - |
1018 | - |
1019 | - |
1020 | + |
1021 | |
1022 | class SALauncher(ExtLauncher): |
1023 | """ A class to launch a simple Standalone test """ |
1024 | @@ -207,7 +222,7 @@ |
1025 | for i in range(1000): |
1026 | path = os.path.join(self.running_dir, 'Events','run_%02i_banner.txt' % i) |
1027 | if not os.path.exists(path): |
1028 | - self.name = 'run%s' % i |
1029 | + self.name = 'run_%02i' % i |
1030 | break |
1031 | |
1032 | if self.name == '': |
1033 | @@ -230,22 +245,22 @@ |
1034 | if not self.pythia or self.force: |
1035 | return |
1036 | |
1037 | - answer = self.ask('Do you want to run pythia? [y/n]','n') |
1038 | + answer = self.ask('Do you want to run pythia?','auto', ['y','n','auto']) |
1039 | if answer == 'y': |
1040 | self.copy_default_card('pythia') |
1041 | self.cards.append('pythia_card.dat') |
1042 | - else: |
1043 | + elif answer == 'n': |
1044 | path = os.path.join(self.card_dir, 'pythia_card.dat') |
1045 | try: os.remove(path) |
1046 | except OSError: pass |
1047 | return # no Need to ask for PGS |
1048 | |
1049 | - answer = self.ask('Do you want to run PGS? [y/n]','n') |
1050 | + answer = self.ask('Do you want to run PGS?','auto', ['y','n','auto']) |
1051 | if answer == 'y': |
1052 | self.copy_default_card('pgs') |
1053 | self.cards.append('pgs_card.dat') |
1054 | return # No Need to ask for Delphes |
1055 | - else: |
1056 | + elif answer == 'n': |
1057 | path = os.path.join(self.card_dir, 'pgs_card.dat') |
1058 | try: os.remove(path) |
1059 | except OSError: pass |
1060 | @@ -253,11 +268,11 @@ |
1061 | if not self.delphes: |
1062 | return |
1063 | |
1064 | - answer = self.ask('Do you want to run Delphes? [y/n]','n') |
1065 | + answer = self.ask('Do you want to run Delphes?','n', ['y','n','auto']) |
1066 | if answer == 'y': |
1067 | self.copy_default_card('delphes') |
1068 | self.cards.append('delphes_card.dat') |
1069 | - else: |
1070 | + elif answer == 'n': |
1071 | path = os.path.join(self.card_dir, 'delphes_card.dat') |
1072 | try: os.remove(path) |
1073 | except OSError: pass |
1074 | @@ -287,7 +302,122 @@ |
1075 | logger.info('The total cross-section is %s +- %s pb' % (cross, error)) |
1076 | logger.info('more information in %s' |
1077 | % os.path.join(self.running_dir, 'index.html')) |
1078 | - |
1079 | + |
1080 | + |
1081 | +class Pythia8Launcher(ExtLauncher): |
1082 | + """A class to launch Pythia8 run""" |
1083 | + |
1084 | + cards = [] |
1085 | + |
1086 | + def __init__(self, running_dir, timeout, **option): |
1087 | + """ initialize launching Pythia 8""" |
1088 | + |
1089 | + running_dir = os.path.join(running_dir, 'examples') |
1090 | + ExtLauncher.__init__(self, running_dir, '.', timeout, **option) |
1091 | + |
1092 | + |
1093 | + def prepare_run(self): |
1094 | + """ ask for pythia-pgs/delphes run """ |
1095 | + |
1096 | + self.cards = [] |
1097 | + |
1098 | + # Find all main_model_process.cc files |
1099 | + date_file_list = [] |
1100 | + for file in glob.glob(os.path.join(self.running_dir,'main_*_*.cc')): |
1101 | + # retrieves the stats for the current file as a tuple |
1102 | + # (mode, ino, dev, nlink, uid, gid, size, atime, mtime, ctime) |
1103 | + # the tuple element mtime at index 8 is the last-modified-date |
1104 | + stats = os.stat(file) |
1105 | + # create tuple (year yyyy, month(1-12), day(1-31), hour(0-23), minute(0-59), second(0-59), |
1106 | + # weekday(0-6, 0 is monday), Julian day(1-366), daylight flag(-1,0 or 1)) from seconds since epoch |
1107 | + # note: this tuple can be sorted properly by date and time |
1108 | + lastmod_date = time.localtime(stats[8]) |
1109 | + date_file_list.append((lastmod_date, os.path.split(file)[-1])) |
1110 | + |
1111 | + if not date_file_list: |
1112 | + raise MadGraph5Error, 'No Pythia output found' |
1113 | + # Sort files according to date with newest first |
1114 | + date_file_list.sort() |
1115 | + date_file_list.reverse() |
1116 | + files = [d[1] for d in date_file_list] |
1117 | + |
1118 | + answer = '' |
1119 | + answer = self.ask('Select a main file to run:', files[0], files) |
1120 | + |
1121 | + self.cards.append(answer) |
1122 | + |
1123 | + self.executable = self.cards[-1].replace(".cc","") |
1124 | + |
1125 | + # Assign a valid run name if not put in options |
1126 | + if self.name == '': |
1127 | + for i in range(1000): |
1128 | + path = os.path.join(self.running_dir, '', |
1129 | + '%s_%02i.log' % (self.executable, i)) |
1130 | + if not os.path.exists(path): |
1131 | + self.name = '%s_%02i.log' % (self.executable, i) |
1132 | + break |
1133 | + |
1134 | + if self.name == '': |
1135 | + raise MadGraph5Error, 'too many runs in this directory' |
1136 | + |
1137 | + # Find all exported models |
1138 | + models = glob.glob(os.path.join(self.running_dir,os.path.pardir, |
1139 | + "Processes_*")) |
1140 | + models = [os.path.split(m)[-1].replace("Processes_","") for m in models] |
1141 | + # Extract model name from executable |
1142 | + models.sort(key=len) |
1143 | + models.reverse() |
1144 | + model_dir = "" |
1145 | + for model in models: |
1146 | + if self.executable.replace("main_", "").startswith(model): |
1147 | + model_dir = "Processes_%s" % model |
1148 | + break |
1149 | + if model_dir: |
1150 | + self.model = model |
1151 | + self.model_dir = os.path.realpath(os.path.join(self.running_dir, |
1152 | + os.path.pardir, |
1153 | + model_dir)) |
1154 | + self.cards.append(os.path.join(self.model_dir, |
1155 | + "param_card_%s.dat" % model)) |
1156 | + |
1157 | + def launch_program(self): |
1158 | + """launch the main program""" |
1159 | + |
1160 | + # Make pythia8 |
1161 | + print "Running make for pythia8 directory" |
1162 | + status = subprocess.call(['make'], stdout = open(os.devnull, 'w'), |
1163 | + stderr = open(os.devnull, 'w'), |
1164 | + cwd=os.path.join(self.running_dir, os.path.pardir)) |
1165 | + if status != 0: |
1166 | + raise MadGraph5Error, "make failed for pythia8 directory" |
1167 | + if self.model_dir: |
1168 | + print "Running make in %s" % self.model_dir |
1169 | + status = subprocess.call(['make'], stdout = open(os.devnull, 'w'), |
1170 | + stderr = open(os.devnull, 'w'), |
1171 | + cwd=self.model_dir) |
1172 | + if status != 0: |
1173 | + raise MadGraph5Error, "make failed for %s directory" % self.model_dir |
1174 | + # Finally run make for executable |
1175 | + makefile = self.executable.replace("main_","Makefile_") |
1176 | + print "Running make with %s" % makefile |
1177 | + status = subprocess.call(['make', '-f', makefile], |
1178 | + stdout = open(os.devnull, 'w'), |
1179 | + cwd=self.running_dir) |
1180 | + if status != 0: |
1181 | + raise MadGraph5Error, "make failed for %s" % self.executable |
1182 | + |
1183 | + print "Running " + self.executable |
1184 | + |
1185 | + output = open(os.path.join(self.running_dir, self.name), 'w') |
1186 | + subprocess.call([self.executable], stdout = output, stderr = output, |
1187 | + cwd=self.running_dir) |
1188 | + |
1189 | + # Display the cross-section to the screen |
1190 | + path = os.path.join(self.running_dir, self.name) |
1191 | + pydoc.pager(open(path).read()) |
1192 | + |
1193 | + print "Output of the run is found at " + \ |
1194 | + os.path.realpath(os.path.join(self.running_dir, self.name)) |
1195 | |
1196 | |
1197 | |
1198 | |
1199 | === modified file 'madgraph/interface/tutorial_text.py' |
1200 | --- madgraph/interface/tutorial_text.py 2011-03-09 14:46:13 +0000 |
1201 | +++ madgraph/interface/tutorial_text.py 2011-03-31 16:46:04 +0000 |
1202 | @@ -84,6 +84,7 @@ |
1203 | generate your events/compute the cross-section from this interface: |
1204 | Please Enter: |
1205 | mg5> launch MY_FIRST_MG5_RUN |
1206 | +(you can interrupt the computation to continue the tutorial by pressing Ctrl-C) |
1207 | """ |
1208 | |
1209 | launch = """This step ends the tutorial of the basic commands of MG5. You can |
1210 | |
1211 | === modified file 'madgraph/iolibs/export_cpp.py' |
1212 | --- madgraph/iolibs/export_cpp.py 2011-03-10 01:04:29 +0000 |
1213 | +++ madgraph/iolibs/export_cpp.py 2011-03-31 16:46:04 +0000 |
1214 | @@ -104,7 +104,7 @@ |
1215 | |
1216 | # Copy src Makefile |
1217 | makefile = read_template_file('Makefile_sa_cpp_src') % \ |
1218 | - {'model': model.get('name')} |
1219 | + {'model': model.get('name').replace('-','_')} |
1220 | open(os.path.join('src', 'Makefile'), 'w').write(makefile) |
1221 | |
1222 | # Copy SubProcesses files |
1223 | @@ -112,7 +112,7 @@ |
1224 | |
1225 | # Copy SubProcesses Makefile |
1226 | makefile = read_template_file('Makefile_sa_cpp_sp') % \ |
1227 | - {'model': model.get('name')} |
1228 | + {'model': model.get('name').replace('-', '_')} |
1229 | open(os.path.join('SubProcesses', 'Makefile'), 'w').write(makefile) |
1230 | |
1231 | # Return to original PWD |
1232 | @@ -183,6 +183,8 @@ |
1233 | C++ format.""" |
1234 | |
1235 | # Static variables (for inheritance) |
1236 | + process_dir = '.' |
1237 | + include_dir = '.' |
1238 | process_template_h = 'cpp_process_h.inc' |
1239 | process_template_cc = 'cpp_process_cc.inc' |
1240 | process_class_template = 'cpp_process_class.inc' |
1241 | @@ -194,7 +196,7 @@ |
1242 | pass |
1243 | |
1244 | def __init__(self, matrix_elements, cpp_helas_call_writer, process_string = "", |
1245 | - path = os.getcwd()): |
1246 | + process_number = 0, path = os.getcwd()): |
1247 | """Initiate with matrix elements, helas call writer, process |
1248 | string, path. Generate the process .h and .cc files.""" |
1249 | |
1250 | @@ -213,20 +215,28 @@ |
1251 | raise MadGraph5Error("No matrix elements to export") |
1252 | |
1253 | self.model = self.matrix_elements[0].get('processes')[0].get('model') |
1254 | + self.model_name = self.model.get('name').replace('-', '_') |
1255 | |
1256 | self.processes = sum([me.get('processes') for \ |
1257 | me in self.matrix_elements], []) |
1258 | + self.processes.extend(sum([me.get_mirror_processes() for \ |
1259 | + me in self.matrix_elements], [])) |
1260 | + |
1261 | + self.nprocesses = len(self.matrix_elements) |
1262 | + if any([m.get('has_mirror_process') for m in self.matrix_elements]): |
1263 | + self.nprocesses = 2*len(self.matrix_elements) |
1264 | |
1265 | if process_string: |
1266 | self.process_string = process_string |
1267 | else: |
1268 | self.process_string = self.processes[0].base_string() |
1269 | |
1270 | + self.process_number = process_number |
1271 | + |
1272 | self.process_name = self.get_process_name() |
1273 | self.process_class = "CPPProcess" |
1274 | |
1275 | self.path = path |
1276 | - self.process_number = self.processes[0].get('id') |
1277 | self.helas_call_writer = cpp_helas_call_writer |
1278 | |
1279 | if not isinstance(self.helas_call_writer, helas_call_writers.CPPUFOHelasCallWriter): |
1280 | @@ -273,42 +283,31 @@ |
1281 | """Generate the .h and .cc files needed for C++, for the |
1282 | processes described by multi_matrix_element""" |
1283 | |
1284 | - cwd = os.getcwd() |
1285 | - |
1286 | - os.chdir(self.path) |
1287 | - |
1288 | - pathdir = os.getcwd() |
1289 | - |
1290 | - def generate_process_files(self): |
1291 | - |
1292 | - """Generate the .h and .cc files needed for Pythia 8, for the |
1293 | - processes described by multi_matrix_element""" |
1294 | - |
1295 | - cwd = os.getcwd() |
1296 | - |
1297 | - os.chdir(self.path) |
1298 | - |
1299 | - pathdir = os.getcwd() |
1300 | - |
1301 | - logger.info('Creating files %(process)s.h and %(process)s.cc in' % \ |
1302 | - {'process': self.process_class} +\ |
1303 | - ' directory %(dir)s' % {'dir': self.path}) |
1304 | - |
1305 | # Create the files |
1306 | - filename = '%s.h' % self.process_class |
1307 | + if not os.path.isdir(os.path.join(self.path, self.include_dir)): |
1308 | + os.makedirs(os.path.join(self.path, self.include_dir)) |
1309 | + filename = os.path.join(self.path, self.include_dir, |
1310 | + '%s.h' % self.process_class) |
1311 | self.write_process_h_file(writers.CPPWriter(filename)) |
1312 | |
1313 | - filename = '%s.cc' % self.process_class |
1314 | + if not os.path.isdir(os.path.join(self.path, self.process_dir)): |
1315 | + os.makedirs(os.path.join(self.path, self.process_dir)) |
1316 | + filename = os.path.join(self.path, self.process_dir, |
1317 | + '%s.cc' % self.process_class) |
1318 | self.write_process_cc_file(writers.CPPWriter(filename)) |
1319 | |
1320 | - os.chdir(cwd) |
1321 | + logger.info('Created files %(process)s.h and %(process)s.cc in' % \ |
1322 | + {'process': self.process_class} + \ |
1323 | + ' directory %(dir)s' % {'dir': os.path.split(filename)[0]}) |
1324 | + |
1325 | + |
1326 | |
1327 | #=========================================================================== |
1328 | # write_process_h_file |
1329 | #=========================================================================== |
1330 | def write_process_h_file(self, writer): |
1331 | """Write the class definition (.h) file for the process""" |
1332 | - |
1333 | + |
1334 | if not isinstance(writer, writers.CPPWriter): |
1335 | raise writers.CPPWriter.CPPWriterError(\ |
1336 | "writer not CPPWriter") |
1337 | @@ -321,7 +320,7 @@ |
1338 | |
1339 | # Extract model name |
1340 | replace_dict['model_name'] = \ |
1341 | - self.model.get('name') |
1342 | + self.model_name |
1343 | |
1344 | # Extract process file name |
1345 | replace_dict['process_file_name'] = self.process_name |
1346 | @@ -356,7 +355,7 @@ |
1347 | replace_dict['process_file_name'] = self.process_name |
1348 | |
1349 | # Extract model name |
1350 | - replace_dict['model_name'] = self.model.get('name') |
1351 | + replace_dict['model_name'] = self.model_name |
1352 | |
1353 | |
1354 | # Extract class function definitions |
1355 | @@ -379,7 +378,7 @@ |
1356 | replace_dict = {} |
1357 | |
1358 | # Extract model name |
1359 | - replace_dict['model_name'] = self.model.get('name') |
1360 | + replace_dict['model_name'] = self.model_name |
1361 | |
1362 | # Extract process info lines for all processes |
1363 | process_lines = "\n".join([self.get_process_info_lines(me) for me in \ |
1364 | @@ -398,19 +397,19 @@ |
1365 | |
1366 | # Extract process definition |
1367 | process_definition = "%s (%s)" % (self.process_string, |
1368 | - self.model.get('name')) |
1369 | + self.model_name) |
1370 | replace_dict['process_definition'] = process_definition |
1371 | |
1372 | process = self.processes[0] |
1373 | |
1374 | replace_dict['process_code'] = self.process_number |
1375 | replace_dict['nexternal'] = self.nexternal |
1376 | - replace_dict['nprocesses'] = len(self.matrix_elements) |
1377 | + replace_dict['nprocesses'] = self.nprocesses |
1378 | |
1379 | if self.single_helicities: |
1380 | replace_dict['all_sigma_kin_definitions'] = \ |
1381 | """// Calculate wavefunctions |
1382 | - void calculate_wavefunctions(const int hel[]); |
1383 | + void calculate_wavefunctions(const int perm[], const int hel[]); |
1384 | static const int nwavefuncs = %d; |
1385 | std::complex<double> w[nwavefuncs][18];""" % \ |
1386 | len(self.wavefunctions) |
1387 | @@ -443,7 +442,7 @@ |
1388 | replace_dict = {} |
1389 | |
1390 | # Extract model name |
1391 | - replace_dict['model_name'] = self.model.get('name') |
1392 | + replace_dict['model_name'] = self.model_name |
1393 | |
1394 | # Extract process info lines |
1395 | replace_dict['process_lines'] = \ |
1396 | @@ -507,7 +506,7 @@ |
1397 | if proc_number != 0: |
1398 | process_string = "%d_%s" % (proc_number, process_string) |
1399 | |
1400 | - process_string = "Sigma_%s_%s" % (self.model.get('name'), |
1401 | + process_string = "Sigma_%s_%s" % (self.model_name, |
1402 | process_string) |
1403 | return process_string |
1404 | |
1405 | @@ -585,16 +584,42 @@ |
1406 | self.get_helicity_matrix(self.matrix_elements[0]) |
1407 | |
1408 | # Extract denominator |
1409 | - replace_dict['den_factors'] = \ |
1410 | - ",".join([str(me.get_denominator_factor()) for me in \ |
1411 | - self.matrix_elements]) |
1412 | - |
1413 | + den_factors = [str(me.get_denominator_factor()) for me in \ |
1414 | + self.matrix_elements] |
1415 | + if self.nprocesses != len(self.matrix_elements): |
1416 | + den_factors.extend(den_factors) |
1417 | + replace_dict['den_factors'] = ",".join(den_factors) |
1418 | replace_dict['get_matrix_t_lines'] = "\n".join( |
1419 | ["t[%(iproc)d]=matrix_%(proc_name)s();" % \ |
1420 | {"iproc": i, "proc_name": \ |
1421 | me.get('processes')[0].shell_string().replace("0_", "")} \ |
1422 | for i, me in enumerate(self.matrix_elements)]) |
1423 | |
1424 | + # Generate lines for mirror matrix element calculation |
1425 | + mirror_matrix_lines = "" |
1426 | + |
1427 | + if any([m.get('has_mirror_process') for m in self.matrix_elements]): |
1428 | + mirror_matrix_lines += \ |
1429 | +""" // Mirror initial state momenta for mirror process |
1430 | + perm[0]=1; |
1431 | + perm[1]=0; |
1432 | + // Calculate wavefunctions |
1433 | + calculate_wavefunctions(perm, helicities[ihel]); |
1434 | + // Mirror back |
1435 | + perm[0]=0; |
1436 | + perm[1]=1; |
1437 | + // Calculate matrix elements |
1438 | + """ |
1439 | + |
1440 | + mirror_matrix_lines += "\n".join( |
1441 | + ["t[%(iproc)d]=matrix_%(proc_name)s();" % \ |
1442 | + {"iproc": i + len(self.matrix_elements), "proc_name": \ |
1443 | + me.get('processes')[0].shell_string().replace("0_", "")} \ |
1444 | + for i, me in enumerate(self.matrix_elements) if me.get('has_mirror_process')]) |
1445 | + |
1446 | + replace_dict['get_mirror_matrix_lines'] = mirror_matrix_lines |
1447 | + |
1448 | + |
1449 | file = \ |
1450 | read_template_file(\ |
1451 | self.process_sigmaKin_function_template) %\ |
1452 | @@ -616,7 +641,7 @@ |
1453 | ret_lines = [] |
1454 | if self.single_helicities: |
1455 | ret_lines.append(\ |
1456 | - "void %s::calculate_wavefunctions(const int hel[]){" % \ |
1457 | + "void %s::calculate_wavefunctions(const int perm[], const int hel[]){" % \ |
1458 | class_name) |
1459 | ret_lines.append("// Calculate wavefunctions for all processes") |
1460 | ret_lines.append(self.get_calculate_wavefunctions(\ |
1461 | @@ -741,6 +766,13 @@ |
1462 | process.get('legs')[1].get('id')) \ |
1463 | for process in me.get('processes')]] |
1464 | |
1465 | + # Add mirror processes, |
1466 | + beam_processes.extend([(len(self.matrix_elements) + i, me) for (i, me) in \ |
1467 | + enumerate(self.matrix_elements) if beam_parts in \ |
1468 | + [(process.get('legs')[0].get('id'), |
1469 | + process.get('legs')[1].get('id')) \ |
1470 | + for process in me.get_mirror_processes()]]) |
1471 | + |
1472 | # Now add matrix elements for the processes with the right factors |
1473 | res_lines.append("// Add matrix elements for processes with beams %s" % \ |
1474 | repr(beam_parts)) |
1475 | @@ -749,7 +781,11 @@ |
1476 | (i, len([proc for proc in \ |
1477 | me.get('processes') if beam_parts == \ |
1478 | (proc.get('legs')[0].get('id'), |
1479 | - proc.get('legs')[1].get('id'))])) \ |
1480 | + proc.get('legs')[1].get('id')) or \ |
1481 | + me.get('has_mirror_process') and \ |
1482 | + beam_parts == \ |
1483 | + (proc.get('legs')[1].get('id'), |
1484 | + proc.get('legs')[0].get('id'))])) \ |
1485 | for (i, me) in beam_processes]).\ |
1486 | replace('*1', ''))) |
1487 | res_lines.append("}") |
1488 | @@ -769,8 +805,8 @@ |
1489 | helicity_line_list = [] |
1490 | |
1491 | for helicities in matrix_element.get_helicity_matrix(): |
1492 | - helicity_line_list.append(",".join(['%d'] * len(helicities)) % \ |
1493 | - tuple(helicities)) |
1494 | + helicity_line_list.append("{"+",".join(['%d'] * len(helicities)) % \ |
1495 | + tuple(helicities) + "}") |
1496 | |
1497 | return helicity_line + ",".join(helicity_line_list) + "};" |
1498 | |
1499 | @@ -800,7 +836,7 @@ |
1500 | num_list = matrix_element.get('color_matrix').\ |
1501 | get_line_numerators(index, denominator) |
1502 | |
1503 | - matrix_strings.append("%s" % \ |
1504 | + matrix_strings.append("{%s}" % \ |
1505 | ",".join(["%d" % i for i in num_list])) |
1506 | matrix_string = "static const double cf[ncolor][ncolor] = {" + \ |
1507 | ",".join(matrix_strings) + "};" |
1508 | @@ -852,7 +888,8 @@ |
1509 | # generate_process_files_pythia8 |
1510 | #=============================================================================== |
1511 | def generate_process_files_pythia8(multi_matrix_element, cpp_helas_call_writer, |
1512 | - process_string = "", path = os.getcwd()): |
1513 | + process_string = "", |
1514 | + process_number = 0, path = os.getcwd()): |
1515 | |
1516 | """Generate the .h and .cc files needed for Pythia 8, for the |
1517 | processes described by multi_matrix_element""" |
1518 | @@ -860,10 +897,18 @@ |
1519 | process_exporter_pythia8 = ProcessExporterPythia8(multi_matrix_element, |
1520 | cpp_helas_call_writer, |
1521 | process_string, |
1522 | + process_number, |
1523 | path) |
1524 | |
1525 | + # Set process directory |
1526 | + model = process_exporter_pythia8.model |
1527 | + model_name = process_exporter_pythia8.model_name |
1528 | + process_exporter_pythia8.process_dir = \ |
1529 | + 'Processes_%(model)s' % {'model': \ |
1530 | + model_name} |
1531 | + process_exporter_pythia8.include_dir = process_exporter_pythia8.process_dir |
1532 | process_exporter_pythia8.generate_process_files() |
1533 | - |
1534 | + return process_exporter_pythia8 |
1535 | |
1536 | #=============================================================================== |
1537 | # ProcessExporterPythia8 |
1538 | @@ -897,7 +942,7 @@ |
1539 | replace_dict = {} |
1540 | |
1541 | # Extract model name |
1542 | - replace_dict['model_name'] = self.model.get('name') |
1543 | + replace_dict['model_name'] = self.model_name |
1544 | |
1545 | # Extract process info lines for all processes |
1546 | process_lines = "\n".join([self.get_process_info_lines(me) for me in \ |
1547 | @@ -913,12 +958,13 @@ |
1548 | |
1549 | # Extract process definition |
1550 | process_definition = "%s (%s)" % (self.process_string, |
1551 | - self.model.get('name')) |
1552 | + self.model_name) |
1553 | replace_dict['process_definition'] = process_definition |
1554 | |
1555 | process = self.processes[0] |
1556 | replace_dict['process_code'] = 10000 + \ |
1557 | - process.get('id') |
1558 | + 100*process.get('id') + \ |
1559 | + self.process_number |
1560 | |
1561 | replace_dict['inFlux'] = self.get_process_influx() |
1562 | |
1563 | @@ -926,12 +972,12 @@ |
1564 | replace_dict['resonances'] = self.get_resonance_lines() |
1565 | |
1566 | replace_dict['nexternal'] = self.nexternal |
1567 | - replace_dict['nprocesses'] = len(self.matrix_elements) |
1568 | + replace_dict['nprocesses'] = self.nprocesses |
1569 | |
1570 | if self.single_helicities: |
1571 | replace_dict['all_sigma_kin_definitions'] = \ |
1572 | """// Calculate wavefunctions |
1573 | - void calculate_wavefunctions(const int hel[]); |
1574 | + void calculate_wavefunctions(const int perm[], const int hel[]); |
1575 | static const int nwavefuncs = %d; |
1576 | std::complex<double> w[nwavefuncs][18];""" % \ |
1577 | len(self.wavefunctions) |
1578 | @@ -964,7 +1010,7 @@ |
1579 | replace_dict = {} |
1580 | |
1581 | # Extract model name |
1582 | - replace_dict['model_name'] = self.model.get('name') |
1583 | + replace_dict['model_name'] = self.model_name |
1584 | |
1585 | # Extract process info lines |
1586 | replace_dict['process_lines'] = \ |
1587 | @@ -1185,8 +1231,17 @@ |
1588 | [(process.get('legs')[0].get('id'), |
1589 | process.get('legs')[1].get('id')) \ |
1590 | for process in me.get('processes')]] |
1591 | + # Pick out all mirror processes for this beam pair |
1592 | + beam_mirror_processes = [] |
1593 | + if beam_parts[0] != beam_parts[1]: |
1594 | + beam_mirror_processes = [(i, me) for (i, me) in \ |
1595 | + enumerate(self.matrix_elements) if beam_parts in \ |
1596 | + [(process.get('legs')[1].get('id'), |
1597 | + process.get('legs')[0].get('id')) \ |
1598 | + for process in me.get('processes')]] |
1599 | |
1600 | final_id_list = [] |
1601 | + final_mirror_id_list = [] |
1602 | for (i, me) in beam_processes: |
1603 | final_id_list.extend([tuple([l.get('id') for l in \ |
1604 | proc.get('legs') if l.get('state')]) \ |
1605 | @@ -1194,9 +1249,23 @@ |
1606 | if beam_parts == \ |
1607 | (proc.get('legs')[0].get('id'), |
1608 | proc.get('legs')[1].get('id'))]) |
1609 | + for (i, me) in beam_mirror_processes: |
1610 | + final_mirror_id_list.extend([tuple([l.get('id') for l in \ |
1611 | + proc.get('legs') if l.get('state')]) \ |
1612 | + for proc in me.get_mirror_processes() \ |
1613 | + if beam_parts == \ |
1614 | + (proc.get('legs')[0].get('id'), |
1615 | + proc.get('legs')[1].get('id'))]) |
1616 | final_id_list = set(final_id_list) |
1617 | - ncombs = len(final_id_list) |
1618 | - #for ids in final_id_list |
1619 | + final_mirror_id_list = set(final_mirror_id_list) |
1620 | + |
1621 | + if final_id_list and final_mirror_id_list or \ |
1622 | + not final_id_list and not final_mirror_id_list: |
1623 | + raise ProcessExporterCPPError,\ |
1624 | + "Missing processes, or both process and mirror process" |
1625 | + |
1626 | + |
1627 | + ncombs = len(final_id_list)+len(final_mirror_id_list) |
1628 | |
1629 | res_lines.append("// Pick one of the flavor combinations %s" % \ |
1630 | ", ".join([repr(ids) for ids in final_id_list])) |
1631 | @@ -1216,11 +1285,32 @@ |
1632 | "More than one process with identical " + \ |
1633 | "external particles is not supported" |
1634 | |
1635 | - res_lines.append("int flavors[%d][%d] = {%s};" % \ |
1636 | - (ncombs, self.nfinal, |
1637 | - ",".join(str(id) for id in \ |
1638 | - sum([list(ids) for ids in final_id_list], |
1639 | - [])))) |
1640 | + for final_ids in final_mirror_id_list: |
1641 | + items = [(i, len([ p for p in me.get_mirror_processes() \ |
1642 | + if [l.get('id') for l in p.get('legs')] == \ |
1643 | + list(beam_parts) + list(final_ids)])) \ |
1644 | + for (i, me) in beam_mirror_processes] |
1645 | + me_weight.append("+".join(["matrix_element[%i]*%i" % \ |
1646 | + (i+len(self.matrix_elements), l) for\ |
1647 | + (i, l) in items if l > 0]).\ |
1648 | + replace('*1', '')) |
1649 | + if any([l>1 for (i, l) in items]): |
1650 | + raise ProcessExporterCPPError,\ |
1651 | + "More than one process with identical " + \ |
1652 | + "external particles is not supported" |
1653 | + |
1654 | + if final_id_list: |
1655 | + res_lines.append("int flavors[%d][%d] = {%s};" % \ |
1656 | + (ncombs, self.nfinal, |
1657 | + ",".join(["{" + ",".join([str(id) for id \ |
1658 | + in ids]) + "}" for ids \ |
1659 | + in final_id_list]))) |
1660 | + elif final_mirror_id_list: |
1661 | + res_lines.append("int flavors[%d][%d] = {%s};" % \ |
1662 | + (ncombs, self.nfinal, |
1663 | + ",".join(["{" + ",".join([str(id) for id \ |
1664 | + in ids]) + "}" for ids \ |
1665 | + in final_mirror_id_list]))) |
1666 | res_lines.append("vector<double> probs;") |
1667 | res_lines.append("double sum = %s;" % "+".join(me_weight)) |
1668 | for me in me_weight: |
1669 | @@ -1292,12 +1382,67 @@ |
1670 | for (l,i) in itertools.product(legs, [0,1])]) |
1671 | |
1672 | # Write out colors for the selected color flow |
1673 | - res_lines.append("static int col[%d][%d] = {%s};" % \ |
1674 | - (ncolor, 2 * self.nexternal, |
1675 | - ",".join(str(i) for i in sum(color_flows, [])))) |
1676 | - |
1677 | - res_lines.append("setColAcol(%s);" % \ |
1678 | - ",".join(["col[ic][%d]" % i for i in \ |
1679 | + res_lines.append("static int colors[%d][%d] = {%s};" % \ |
1680 | + (ncolor, 2 * self.nexternal, |
1681 | + ",".join(["{" + ",".join([str(id) for id \ |
1682 | + in flows]) + "}" for flows \ |
1683 | + in color_flows]))) |
1684 | + |
1685 | + res_lines.append("setColAcol(%s);" % \ |
1686 | + ",".join(["colors[ic][%d]" % i for i in \ |
1687 | + range(2 * self.nexternal)])) |
1688 | + res_lines.append('}') |
1689 | + |
1690 | + # Same thing but for mirror processes |
1691 | + for ime, me in enumerate(self.matrix_elements): |
1692 | + if not me.get('has_mirror_process'): |
1693 | + continue |
1694 | + res_lines.append("else if(%s){" % \ |
1695 | + "||".join(["&&".join(["id%d == %d" % \ |
1696 | + (i+1, l.get('id')) for (i, l) in \ |
1697 | + enumerate(p.get('legs'))])\ |
1698 | + for p in me.get_mirror_processes()])) |
1699 | + |
1700 | + proc = me.get('processes')[0] |
1701 | + if not me.get('color_basis'): |
1702 | + # If no color basis, just output trivial color flow |
1703 | + res_lines.append("setColAcol(%s);" % ",".join(["0"]*2*self.nfinal)) |
1704 | + else: |
1705 | + # Else, build a color representation dictionnary |
1706 | + repr_dict = {} |
1707 | + legs = proc.get_legs_with_decays() |
1708 | + legs[0:2] = [legs[1],legs[0]] |
1709 | + for l in legs: |
1710 | + repr_dict[l.get('number')] = \ |
1711 | + proc.get('model').get_particle(l.get('id')).get_color() |
1712 | + # Get the list of color flows |
1713 | + color_flow_list = \ |
1714 | + me.get('color_basis').color_flow_decomposition(\ |
1715 | + repr_dict, self.ninitial) |
1716 | + # Select a color flow |
1717 | + ncolor = len(me.get('color_basis')) |
1718 | + res_lines.append("""vector<double> probs; |
1719 | + double sum = %s; |
1720 | + for(int i=0;i<ncolor[%i];i++) |
1721 | + probs.push_back(jamp2[%i][i]/sum); |
1722 | + int ic = rndmPtr->pick(probs);""" % \ |
1723 | + ("+".join(["jamp2[%d][%d]" % (ime, i) for i \ |
1724 | + in range(ncolor)]), ime, ime)) |
1725 | + |
1726 | + color_flows = [] |
1727 | + for color_flow_dict in color_flow_list: |
1728 | + color_flows.append([color_flow_dict[l.get('number')][i] % 500 \ |
1729 | + for (l,i) in itertools.product(legs, [0,1])]) |
1730 | + |
1731 | + # Write out colors for the selected color flow |
1732 | + res_lines.append("static int colors[%d][%d] = {%s};" % \ |
1733 | + (ncolor, 2 * self.nexternal, |
1734 | + ",".join(["{" + ",".join([str(id) for id \ |
1735 | + in flows]) + "}" for flows \ |
1736 | + in color_flows]))) |
1737 | + |
1738 | + res_lines.append("setColAcol(%s);" % \ |
1739 | + ",".join(["colors[ic][%d]" % i for i in \ |
1740 | range(2 * self.nexternal)])) |
1741 | res_lines.append('}') |
1742 | |
1743 | @@ -1330,13 +1475,13 @@ |
1744 | info = misc.get_pkg_info() |
1745 | info_lines = "" |
1746 | if info and info.has_key('version') and info.has_key('date'): |
1747 | - info_lines = "# by MadGraph 5 v. %s, %s\n" % \ |
1748 | + info_lines = "# MadGraph 5 v. %s, %s\n" % \ |
1749 | (info['version'], info['date']) |
1750 | info_lines = info_lines + \ |
1751 | "# By the MadGraph Development Team\n" + \ |
1752 | "# Please visit us at https://launchpad.net/madgraph5" |
1753 | else: |
1754 | - info_lines = "# by MadGraph 5\n" + \ |
1755 | + info_lines = "# MadGraph 5\n" + \ |
1756 | "# By the MadGraph Development Team\n" + \ |
1757 | "# Please visit us at https://launchpad.net/madgraph5" |
1758 | |
1759 | @@ -1370,7 +1515,7 @@ |
1760 | return res_str + '*' |
1761 | |
1762 | #=============================================================================== |
1763 | -# Routines to output UFO models in C++ format |
1764 | +# Routines to export/output UFO models in C++ format |
1765 | #=============================================================================== |
1766 | |
1767 | def convert_model_to_cpp(model, output_dir, wanted_lorentz = [], |
1768 | @@ -1407,19 +1552,22 @@ |
1769 | ('SMINPUTS', (1,)): ('aEM',)} |
1770 | |
1771 | # Template files to use |
1772 | + include_dir = '.' |
1773 | + cc_file_dir = '.' |
1774 | param_template_h = 'cpp_model_parameters_h.inc' |
1775 | param_template_cc = 'cpp_model_parameters_cc.inc' |
1776 | aloha_template_h = 'cpp_hel_amps_h.inc' |
1777 | aloha_template_cc = 'cpp_hel_amps_cc.inc' |
1778 | |
1779 | - copy_files = ["read_slha.h", "read_slha.cc"] |
1780 | + copy_include_files = [] |
1781 | + copy_cc_files = [] |
1782 | |
1783 | def __init__(self, model, output_path, wanted_lorentz = [], |
1784 | wanted_couplings = []): |
1785 | """ initialization of the objects """ |
1786 | |
1787 | self.model = model |
1788 | - self.model_name = model['name'] |
1789 | + self.model_name = model['name'].replace('-','_') |
1790 | |
1791 | self.dir_path = output_path |
1792 | |
1793 | @@ -1464,17 +1612,19 @@ |
1794 | elif 'aS' in key: |
1795 | for p in self.model['parameters'][key]: |
1796 | self.params_dep.append(base_objects.ModelVariable(p.name, |
1797 | - self.p_to_cpp.parse(p.expr), |
1798 | - p.type, |
1799 | - p.depend)) |
1800 | + p.name + " = " + \ |
1801 | + self.p_to_cpp.parse(p.expr) + ";", |
1802 | + p.type, |
1803 | + p.depend)) |
1804 | else: |
1805 | for p in self.model['parameters'][key]: |
1806 | if p.name == 'ZERO': |
1807 | continue |
1808 | self.params_indep.append(base_objects.ModelVariable(p.name, |
1809 | - self.p_to_cpp.parse(p.expr), |
1810 | - p.type, |
1811 | - p.depend)) |
1812 | + p.name + " = " + \ |
1813 | + self.p_to_cpp.parse(p.expr) + ";", |
1814 | + p.type, |
1815 | + p.depend)) |
1816 | |
1817 | # For external parameters, want to read off the SLHA block code |
1818 | while params_ext: |
1819 | @@ -1483,19 +1633,19 @@ |
1820 | expression = "" |
1821 | assert param.value.imag == 0 |
1822 | if len(param.lhacode) == 1: |
1823 | - expression = "slha.get_block_entry(\"%s\", %d, %e);" % \ |
1824 | - (param.lhablock.lower(), param.lhacode[0], |
1825 | - param.value.real) |
1826 | + expression = "%s = slha.get_block_entry(\"%s\", %d, %e);" % \ |
1827 | + (param.name, param.lhablock.lower(), |
1828 | + param.lhacode[0], param.value.real) |
1829 | elif len(param.lhacode) == 2: |
1830 | expression = "indices[0] = %d;\nindices[1] = %d;\n" % \ |
1831 | (param.lhacode[0], param.lhacode[1]) |
1832 | - expression += "%s=slha.get_block_entry(\"%s\", indices, %e);" \ |
1833 | + expression += "%s = slha.get_block_entry(\"%s\", indices, %e);" \ |
1834 | % (param.name, param.lhablock.lower(), param.value.real) |
1835 | else: |
1836 | raise MadGraph5Error("Only support for SLHA blocks with 1 or 2 indices") |
1837 | self.params_indep.insert(0, |
1838 | base_objects.ModelVariable(param.name, |
1839 | - expression, |
1840 | + expression, |
1841 | 'real')) |
1842 | |
1843 | def prepare_couplings(self, wanted_couplings = []): |
1844 | @@ -1525,7 +1675,7 @@ |
1845 | |
1846 | # Convert coupling expressions from Python to C++ |
1847 | for coup in self.coups_dep.values() + self.coups_indep: |
1848 | - coup.expr = self.p_to_cpp.parse(coup.expr) |
1849 | + coup.expr = coup.name + " = " + self.p_to_cpp.parse(coup.expr) + ";" |
1850 | |
1851 | # Routines for writing the parameter files |
1852 | |
1853 | @@ -1533,15 +1683,47 @@ |
1854 | """Generate the parameters_model.h and parameters_model.cc |
1855 | files, which have the parameters and couplings for the model.""" |
1856 | |
1857 | - parameter_h_file = os.path.join(self.dir_path, |
1858 | - 'Parameters_%s.h' % self.model.get('name')) |
1859 | - parameter_cc_file = os.path.join(self.dir_path, |
1860 | - 'Parameters_%s.cc' % self.model.get('name')) |
1861 | + if not os.path.isdir(os.path.join(self.dir_path, self.include_dir)): |
1862 | + os.makedirs(os.path.join(self.dir_path, self.include_dir)) |
1863 | + if not os.path.isdir(os.path.join(self.dir_path, self.cc_file_dir)): |
1864 | + os.makedirs(os.path.join(self.dir_path, self.cc_file_dir)) |
1865 | + |
1866 | + parameter_h_file = os.path.join(self.dir_path, self.include_dir, |
1867 | + 'Parameters_%s.h' % self.model_name) |
1868 | + parameter_cc_file = os.path.join(self.dir_path, self.cc_file_dir, |
1869 | + 'Parameters_%s.cc' % self.model_name) |
1870 | + |
1871 | + file_h, file_cc = self.generate_parameters_class_files() |
1872 | + |
1873 | + # Write the files |
1874 | + writers.CPPWriter(parameter_h_file).writelines(file_h) |
1875 | + writers.CPPWriter(parameter_cc_file).writelines(file_cc) |
1876 | + |
1877 | + # Copy additional needed files |
1878 | + for copy_file in self.copy_include_files: |
1879 | + shutil.copy(os.path.join(_file_path, 'iolibs', |
1880 | + 'template_files',copy_file), |
1881 | + os.path.join(self.dir_path, self.include_dir)) |
1882 | + # Copy additional needed files |
1883 | + for copy_file in self.copy_cc_files: |
1884 | + shutil.copy(os.path.join(_file_path, 'iolibs', |
1885 | + 'template_files',copy_file), |
1886 | + os.path.join(self.dir_path, self.cc_file_dir)) |
1887 | + |
1888 | + logger.info("Created files %s and %s in directory" \ |
1889 | + % (os.path.split(parameter_h_file)[-1], |
1890 | + os.path.split(parameter_cc_file)[-1])) |
1891 | + logger.info("%s and %s" % \ |
1892 | + (os.path.split(parameter_h_file)[0], |
1893 | + os.path.split(parameter_cc_file)[0])) |
1894 | + |
1895 | + def generate_parameters_class_files(self): |
1896 | + """Create the content of the Parameters_model.h and .cc files""" |
1897 | |
1898 | replace_dict = {} |
1899 | |
1900 | replace_dict['info_lines'] = get_mg5_info_lines() |
1901 | - replace_dict['model_name'] = self.model.get('name') |
1902 | + replace_dict['model_name'] = self.model_name |
1903 | |
1904 | replace_dict['independent_parameters'] = \ |
1905 | "// Model parameters independent of aS\n" + \ |
1906 | @@ -1578,21 +1760,8 @@ |
1907 | replace_dict |
1908 | file_cc = read_template_file(self.param_template_cc) % \ |
1909 | replace_dict |
1910 | - |
1911 | - # Write the files |
1912 | - writers.CPPWriter(parameter_h_file).writelines(file_h) |
1913 | - writers.CPPWriter(parameter_cc_file).writelines(file_cc) |
1914 | - |
1915 | - # Copy additional needed files |
1916 | - for copy_file in self.copy_files: |
1917 | - shutil.copy(os.path.join(_file_path, 'iolibs', |
1918 | - 'template_files',copy_file), |
1919 | - self.dir_path) |
1920 | - |
1921 | - logger.info("Created files %s and %s in directory %s" \ |
1922 | - % (os.path.split(parameter_h_file)[-1], |
1923 | - os.path.split(parameter_cc_file)[-1], |
1924 | - os.path.split(parameter_h_file)[0])) |
1925 | + |
1926 | + return file_h, file_cc |
1927 | |
1928 | def write_parameters(self, params): |
1929 | """Write out the definitions of parameters""" |
1930 | @@ -1620,10 +1789,7 @@ |
1931 | |
1932 | res_strings = [] |
1933 | for param in params: |
1934 | - if param.expr.find('\n') >= 0: |
1935 | - res_strings.append("%s;" % param.expr) |
1936 | - else: |
1937 | - res_strings.append("%s=%s;" % (param.name, param.expr)) |
1938 | + res_strings.append("%s" % param.expr) |
1939 | |
1940 | # Correct width sign for Majorana particles (where the width |
1941 | # and mass need to have the same sign) |
1942 | @@ -1652,18 +1818,23 @@ |
1943 | def write_aloha_routines(self): |
1944 | """Generate the hel_amps_model.h and hel_amps_model.cc files, which |
1945 | have the complete set of generalized Helas routines for the model""" |
1946 | + |
1947 | + if not os.path.isdir(os.path.join(self.dir_path, self.include_dir)): |
1948 | + os.makedirs(os.path.join(self.dir_path, self.include_dir)) |
1949 | + if not os.path.isdir(os.path.join(self.dir_path, self.cc_file_dir)): |
1950 | + os.makedirs(os.path.join(self.dir_path, self.cc_file_dir)) |
1951 | |
1952 | - model_h_file = os.path.join(self.dir_path, |
1953 | - 'hel_amps_%s.h' % self.model.get('name')) |
1954 | - model_cc_file = os.path.join(self.dir_path, |
1955 | - 'hel_amps_%s.cc' % self.model.get('name')) |
1956 | + model_h_file = os.path.join(self.dir_path, self.include_dir, |
1957 | + 'HelAmps_%s.h' % self.model_name) |
1958 | + model_cc_file = os.path.join(self.dir_path, self.cc_file_dir, |
1959 | + 'HelAmps_%s.cc' % self.model_name) |
1960 | |
1961 | replace_dict = {} |
1962 | |
1963 | replace_dict['output_name'] = self.output_name |
1964 | replace_dict['info_lines'] = get_mg5_info_lines() |
1965 | replace_dict['namespace'] = self.namespace |
1966 | - replace_dict['model_name'] = self.model.get('name') |
1967 | + replace_dict['model_name'] = self.model_name |
1968 | |
1969 | # Read in the template .h and .cc files, stripped of compiler |
1970 | # commands and namespaces |
1971 | @@ -1671,14 +1842,14 @@ |
1972 | template_cc_files = self.read_aloha_template_files(ext = 'cc') |
1973 | |
1974 | aloha_model = create_aloha.AbstractALOHAModel(\ |
1975 | - self.model.get('name')) |
1976 | + self.model_name) |
1977 | if self.wanted_lorentz: |
1978 | aloha_model.compute_subset(self.wanted_lorentz) |
1979 | else: |
1980 | aloha_model.compute_all(save=False) |
1981 | for abstracthelas in dict(aloha_model).values(): |
1982 | aloha_writer = aloha_writers.ALOHAWriterForCPP(abstracthelas, |
1983 | - self.dir_path) |
1984 | + self.dir_path) |
1985 | header = aloha_writer.define_header() |
1986 | template_h_files.append(self.write_function_declaration(\ |
1987 | aloha_writer, header)) |
1988 | @@ -1695,10 +1866,12 @@ |
1989 | writers.CPPWriter(model_h_file).writelines(file_h) |
1990 | writers.CPPWriter(model_cc_file).writelines(file_cc) |
1991 | |
1992 | - logger.info("Created files %s and %s in directory %s" \ |
1993 | + logger.info("Created files %s and %s in directory" \ |
1994 | % (os.path.split(model_h_file)[-1], |
1995 | - os.path.split(model_cc_file)[-1], |
1996 | - os.path.split(model_h_file)[0])) |
1997 | + os.path.split(model_cc_file)[-1])) |
1998 | + logger.info("%s and %s" % \ |
1999 | + (os.path.split(model_h_file)[0], |
2000 | + os.path.split(model_cc_file)[0])) |
2001 | |
2002 | |
2003 | def read_aloha_template_files(self, ext): |
2004 | @@ -1752,15 +1925,113 @@ |
2005 | return line |
2006 | |
2007 | #=============================================================================== |
2008 | -# Routines to output UFO models in Pythia8 format |
2009 | -#=============================================================================== |
2010 | - |
2011 | -def convert_model_to_pythia8(model, output_dir): |
2012 | +# generate_example_file_pythia8 |
2013 | +#=============================================================================== |
2014 | +def generate_example_file_pythia8(path, |
2015 | + model_path, |
2016 | + process_names, |
2017 | + exporter, |
2018 | + main_file_name = "", |
2019 | + example_dir = "examples"): |
2020 | + """Generate the main_model_name.cc file and Makefile in the examples dir""" |
2021 | + |
2022 | + filepath = os.path.join(path, example_dir) |
2023 | + if not os.path.isdir(filepath): |
2024 | + os.makedirs(filepath) |
2025 | + |
2026 | + replace_dict = {} |
2027 | + |
2028 | + # Extract version number and date from VERSION file |
2029 | + info_lines = get_mg5_info_lines() |
2030 | + replace_dict['info_lines'] = info_lines |
2031 | + |
2032 | + # Extract model name |
2033 | + replace_dict['model_name'] = exporter.model_name |
2034 | + |
2035 | + # Extract include line |
2036 | + replace_dict['include_lines'] = \ |
2037 | + "\n".join(["#include \"%s.h\"" % proc_name \ |
2038 | + for proc_name in process_names]) |
2039 | + |
2040 | + # Extract setSigmaPtr line |
2041 | + replace_dict['sigma_pointer_lines'] = \ |
2042 | + "\n".join(["pythia.setSigmaPtr(new %s());" % proc_name \ |
2043 | + for proc_name in process_names]) |
2044 | + |
2045 | + # Extract param_card path |
2046 | + replace_dict['param_card'] = os.path.join(os.path.pardir,model_path, |
2047 | + "param_card_%s.dat" % \ |
2048 | + exporter.model_name) |
2049 | + |
2050 | + # Create the example main file |
2051 | + file = read_template_file('pythia8_main_example_cc.inc') % \ |
2052 | + replace_dict |
2053 | + |
2054 | + if not main_file_name: |
2055 | + num = 1 |
2056 | + while os.path.exists(os.path.join(filepath, |
2057 | + 'main_%s_%i' % (exporter.model_name, num))): |
2058 | + num += 1 |
2059 | + main_file_name = str(num) |
2060 | + |
2061 | + main_file = 'main_%s_%s' % (exporter.model_name, |
2062 | + main_file_name) |
2063 | + |
2064 | + main_filename = os.path.join(filepath, main_file + '.cc') |
2065 | + |
2066 | + # Write the file |
2067 | + writers.CPPWriter(main_filename).writelines(file) |
2068 | + |
2069 | + replace_dict = {} |
2070 | + |
2071 | + # Extract version number and date from VERSION file |
2072 | + replace_dict['info_lines'] = get_mg5_info_lines() |
2073 | + |
2074 | + replace_dict['main_file'] = main_file |
2075 | + |
2076 | + replace_dict['process_dir'] = model_path |
2077 | + |
2078 | + replace_dict['include_dir'] = exporter.include_dir |
2079 | + |
2080 | + # Create the makefile |
2081 | + file = read_template_file('pythia8_main_makefile.inc') % \ |
2082 | + replace_dict |
2083 | + |
2084 | + make_filename = os.path.join(filepath, 'Makefile_%s_%s' % \ |
2085 | + (exporter.model_name, main_file_name)) |
2086 | + |
2087 | + # Write the file |
2088 | + open(make_filename, 'w').write(file) |
2089 | + |
2090 | + logger.info("Created files %s and %s in directory %s" \ |
2091 | + % (os.path.split(main_filename)[-1], |
2092 | + os.path.split(make_filename)[-1], |
2093 | + os.path.split(make_filename)[0])) |
2094 | + return main_file, make_filename |
2095 | + |
2096 | + |
2097 | + |
2098 | +#=============================================================================== |
2099 | +# Routines to export/output UFO models in Pythia8 format |
2100 | +#=============================================================================== |
2101 | + |
2102 | +def convert_model_to_pythia8(model, pythia_dir): |
2103 | """Create a full valid Pythia 8 model from an MG5 model (coming from UFO)""" |
2104 | |
2105 | + if not os.path.isfile(os.path.join(pythia_dir, 'include', 'Pythia.h')): |
2106 | + logger.warning('Directory %s is not a valid Pythia 8 main dir.' % pythia_dir) |
2107 | + |
2108 | # create the model parameter files |
2109 | - model_builder = UFOModelConverterPythia8(model, output_dir) |
2110 | + model_builder = UFOModelConverterPythia8(model, pythia_dir) |
2111 | + model_builder.cc_file_dir = "Processes_" + model_builder.model_name |
2112 | + model_builder.include_dir = model_builder.cc_file_dir |
2113 | + |
2114 | model_builder.write_files() |
2115 | + # Write makefile |
2116 | + model_builder.write_makefile() |
2117 | + # Write param_card |
2118 | + model_builder.write_param_card() |
2119 | + return model_builder.model_name, model_builder.cc_file_dir |
2120 | |
2121 | #=============================================================================== |
2122 | # UFOModelConverterPythia8 |
2123 | @@ -1772,7 +2043,7 @@ |
2124 | # Static variables (for inheritance) |
2125 | output_name = 'Pythia 8' |
2126 | namespace = 'Pythia8' |
2127 | - |
2128 | + |
2129 | # Dictionaries for expression of MG5 SM parameters into Pythia 8 |
2130 | slha_to_expr = {('SMINPUTS', (1,)): '1./csm->alphaEM(pow(pd->m0(23),2))', |
2131 | ('SMINPUTS', (2,)): 'M_PI*csm->alphaEM(pow(pd->m0(23),2))*pow(pd->m0(23),2)/(sqrt(2.)*pow(pd->m0(24),2)*(pow(pd->m0(23),2)-pow(pd->m0(24),2)))', |
2132 | @@ -1798,20 +2069,21 @@ |
2133 | elif 'aS' in key: |
2134 | for p in self.model['parameters'][key]: |
2135 | self.params_dep.append(base_objects.ModelVariable(p.name, |
2136 | - self.p_to_cpp.parse(p.expr), |
2137 | + p.name + " = " + \ |
2138 | + self.p_to_cpp.parse(p.expr) + ';', |
2139 | p.type, |
2140 | p.depend)) |
2141 | else: |
2142 | for p in self.model['parameters'][key]: |
2143 | self.params_indep.append(base_objects.ModelVariable(p.name, |
2144 | - self.p_to_cpp.parse(p.expr), |
2145 | + p.name + " = " + \ |
2146 | + self.p_to_cpp.parse(p.expr) + ';', |
2147 | p.type, |
2148 | p.depend)) |
2149 | |
2150 | # For external parameters, want to use the internal Pythia |
2151 | # parameters for SM params and masses and widths. For other |
2152 | - # parameters, want to read off the SLHA block code (TO BE |
2153 | - # IMPLEMENTED) |
2154 | + # parameters, want to read off the SLHA block code |
2155 | while params_ext: |
2156 | param = params_ext.pop(0) |
2157 | key = (param.lhablock, tuple(param.lhacode)) |
2158 | @@ -1819,35 +2091,100 @@ |
2159 | # This value needs to be set event by event |
2160 | self.params_dep.insert(0, |
2161 | base_objects.ModelVariable(param.name, |
2162 | - self.slha_to_expr[key], |
2163 | - 'real')) |
2164 | + param.name + ' = ' + \ |
2165 | + self.slha_to_expr[key] + ';', |
2166 | + 'real')) |
2167 | else: |
2168 | try: |
2169 | # This is an SM parameter defined above |
2170 | self.params_indep.insert(0, |
2171 | base_objects.ModelVariable(param.name, |
2172 | - self.slha_to_expr[key], |
2173 | - 'real')) |
2174 | + param.name + ' = ' + \ |
2175 | + self.slha_to_expr[key] + ';', |
2176 | + 'real')) |
2177 | except: |
2178 | # For Yukawa couplings, masses and widths, insert |
2179 | # the Pythia 8 value |
2180 | if param.lhablock == 'YUKAWA': |
2181 | - self.slha_to_expr[key] = 'pd->mRun(%i, 120.)' \ |
2182 | + self.slha_to_expr[key] = 'pd->mRun(%i, pd->m0(24))' \ |
2183 | % param.lhacode[0] |
2184 | if param.lhablock == 'MASS': |
2185 | self.slha_to_expr[key] = 'pd->m0(%i)' \ |
2186 | % param.lhacode[0] |
2187 | if param.lhablock == 'DECAY': |
2188 | - self.slha_to_expr[key] = 'pd->mWidth(%i)' \ |
2189 | - % param.lhacode[0] |
2190 | + self.slha_to_expr[key] = \ |
2191 | + 'pd->mWidth(%i)' % param.lhacode[0] |
2192 | if key in self.slha_to_expr: |
2193 | self.params_indep.insert(0,\ |
2194 | - base_objects.ModelVariable(param.name, |
2195 | - self.slha_to_expr[key], |
2196 | - 'real')) |
2197 | + base_objects.ModelVariable(param.name, |
2198 | + param.name + "=" + self.slha_to_expr[key] \ |
2199 | + + ';', |
2200 | + 'real')) |
2201 | else: |
2202 | - # Fix unknown parameters as soon as Pythia has fixed this |
2203 | - raise MadGraph5Error, \ |
2204 | - "Parameter with key " + repr(key) + \ |
2205 | - " unknown in model export to Pythia 8" |
2206 | - |
2207 | + # This is a BSM parameter which is read from SLHA |
2208 | + if len(param.lhacode) == 1: |
2209 | + expression = "if(!slhaPtr->getEntry<double>(\"%s\", %d, %s)){\n" % \ |
2210 | + (param.lhablock.lower(), |
2211 | + param.lhacode[0], |
2212 | + param.name) + \ |
2213 | + ("cout << \"Warning, setting %s to %e\" << endl;\n" \ |
2214 | + + "%s = %e;}") % (param.name, param.value.real, |
2215 | + param.name, param.value.real) |
2216 | + elif len(param.lhacode) == 2: |
2217 | + expression = "if(!slhaPtr->getEntry<double>(\"%s\", %d, %d, %s)){\n" % \ |
2218 | + (param.lhablock.lower(), |
2219 | + param.lhacode[0], |
2220 | + param.lhacode[1], |
2221 | + param.name) + \ |
2222 | + ("cout << \"Warning, setting %s to %e\" << endl;\n" \ |
2223 | + + "%s = %e;}") % (param.name, param.value.real, |
2224 | + param.name, param.value.real) |
2225 | + elif len(param.lhacode) == 3: |
2226 | + expression = "if(!slhaPtr->getEntry<double>(\"%s\", %d, %d, %d, %s)){\n" % \ |
2227 | + (param.lhablock.lower(), |
2228 | + param.lhacode[0], |
2229 | + param.lhacode[1], |
2230 | + param.lhacode[2], |
2231 | + param.name) + \ |
2232 | + ("cout << \"Warning, setting %s to %e\" << endl;\n" \ |
2233 | + + "%s = %e;}") % (param.name, param.value.real, |
2234 | + param.name, param.value.real) |
2235 | + else: |
2236 | + raise MadGraph5Error("Only support for SLHA blocks with 1 or 2 indices") |
2237 | + self.params_indep.insert(0, |
2238 | + base_objects.ModelVariable(param.name, |
2239 | + expression, |
2240 | + 'real')) |
2241 | + |
2242 | + def write_makefile(self): |
2243 | + """Generate the Makefile, which creates library files.""" |
2244 | + |
2245 | + makefilename = os.path.join(self.dir_path, self.cc_file_dir, |
2246 | + 'Makefile') |
2247 | + |
2248 | + replace_dict = {} |
2249 | + |
2250 | + replace_dict['info_lines'] = get_mg5_info_lines() |
2251 | + replace_dict['model'] = self.model_name |
2252 | + |
2253 | + makefile = read_template_file('pythia8_makefile.inc') % replace_dict |
2254 | + |
2255 | + # Write the files |
2256 | + open(makefilename, 'w').write(makefile) |
2257 | + |
2258 | + logger.info("Created %s in directory %s" \ |
2259 | + % (os.path.split(makefilename)[-1], |
2260 | + os.path.split(makefilename)[0])) |
2261 | + |
2262 | + def write_param_card(self): |
2263 | + """Generate the param_card for the model.""" |
2264 | + |
2265 | + paramcardname = os.path.join(self.dir_path, self.cc_file_dir, |
2266 | + 'param_card_%s.dat' % self.model_name) |
2267 | + # Write out param_card |
2268 | + open(paramcardname, 'w').write(\ |
2269 | + self.model.write_param_card()) |
2270 | + |
2271 | + logger.info("Created %s in directory %s" \ |
2272 | + % (os.path.split(paramcardname)[-1], |
2273 | + os.path.split(paramcardname)[0])) |
2274 | |
2275 | === modified file 'madgraph/iolibs/group_subprocs.py' |
2276 | --- madgraph/iolibs/group_subprocs.py 2011-03-23 13:50:59 +0000 |
2277 | +++ madgraph/iolibs/group_subprocs.py 2011-03-31 16:46:04 +0000 |
2278 | @@ -384,6 +384,23 @@ |
2279 | """Test if object obj is a valid element.""" |
2280 | |
2281 | return isinstance(obj, SubProcessGroup) |
2282 | + |
2283 | + def get_matrix_elements(self): |
2284 | + """Extract the list of matrix elements""" |
2285 | + return helas_objects.HelasMatrixElementList(\ |
2286 | + sum([group.get('matrix_elements') for group in self], [])) |
2287 | + |
2288 | + def get_used_lorentz(self): |
2289 | + """Return the list of ALOHA routines used in these matrix elements""" |
2290 | + |
2291 | + return helas_objects.HelasMultiProcess( |
2292 | + {'matrix_elements': self.get_matrix_elements()}).get_used_lorentz() |
2293 | + |
2294 | + def get_used_couplings(self): |
2295 | + """Return the list of ALOHA routines used in these matrix elements""" |
2296 | + |
2297 | + return helas_objects.HelasMultiProcess( |
2298 | + {'matrix_elements': self.get_matrix_elements()}).get_used_couplings() |
2299 | |
2300 | #=============================================================================== |
2301 | # DecayChainSubProcessGroup |
2302 | |
2303 | === modified file 'madgraph/iolibs/helas_call_writers.py' |
2304 | --- madgraph/iolibs/helas_call_writers.py 2010-12-19 03:57:07 +0000 |
2305 | +++ madgraph/iolibs/helas_call_writers.py 2011-03-31 16:46:04 +0000 |
2306 | @@ -977,7 +977,7 @@ |
2307 | # Fill out with X up to 6 positions |
2308 | call = call + 'x' * (6 - len(call)) |
2309 | # Specify namespace for Helas calls |
2310 | - call = call + "(p[%d]," |
2311 | + call = call + "(p[perm[%d]]," |
2312 | if argument.get('spin') != 1: |
2313 | # For non-scalars, need mass and helicity |
2314 | call = call + "mME[%d],hel[%d]," |
2315 | |
2316 | === modified file 'madgraph/iolibs/misc.py' |
2317 | --- madgraph/iolibs/misc.py 2011-03-16 09:16:15 +0000 |
2318 | +++ madgraph/iolibs/misc.py 2011-03-31 16:46:04 +0000 |
2319 | @@ -120,7 +120,7 @@ |
2320 | |
2321 | if timeout: |
2322 | signal.alarm(timeout) |
2323 | - question += '[%ss to answer [%s]] ' % (timeout, str(default)) |
2324 | + question += '[%ss to answer] ' % (timeout) |
2325 | try: |
2326 | result = fct(question) |
2327 | except TimeOutError: |
2328 | |
2329 | === modified file 'madgraph/iolibs/template_files/Makefile_sa_cpp_src' |
2330 | --- madgraph/iolibs/template_files/Makefile_sa_cpp_src 2010-10-27 16:56:32 +0000 |
2331 | +++ madgraph/iolibs/template_files/Makefile_sa_cpp_src 2011-03-31 16:46:04 +0000 |
2332 | @@ -5,7 +5,7 @@ |
2333 | |
2334 | all: $(target) |
2335 | |
2336 | -objects=hel_amps_%(model)s.o Parameters_%(model)s.o rambo.o read_slha.o |
2337 | +objects=HelAmps_%(model)s.o Parameters_%(model)s.o rambo.o read_slha.o |
2338 | |
2339 | $(target): $(objects) |
2340 | $(AR) cru $@ $(objects) |
2341 | |
2342 | === modified file 'madgraph/iolibs/template_files/cpp_hel_amps_cc.inc' |
2343 | --- madgraph/iolibs/template_files/cpp_hel_amps_cc.inc 2010-10-27 21:30:35 +0000 |
2344 | +++ madgraph/iolibs/template_files/cpp_hel_amps_cc.inc 2011-03-31 16:46:04 +0000 |
2345 | @@ -3,7 +3,7 @@ |
2346 | %(info_lines)s |
2347 | //========================================================================== |
2348 | |
2349 | -#include "hel_amps_%(model_name)s.h" |
2350 | +#include "HelAmps_%(model_name)s.h" |
2351 | |
2352 | namespace %(namespace)s_%(model_name)s { |
2353 | |
2354 | |
2355 | === modified file 'madgraph/iolibs/template_files/cpp_hel_amps_h.inc' |
2356 | --- madgraph/iolibs/template_files/cpp_hel_amps_h.inc 2010-10-27 21:30:35 +0000 |
2357 | +++ madgraph/iolibs/template_files/cpp_hel_amps_h.inc 2011-03-31 16:46:04 +0000 |
2358 | @@ -3,8 +3,8 @@ |
2359 | %(info_lines)s |
2360 | //========================================================================== |
2361 | |
2362 | -#ifndef hel_amps_%(model_name)s_H |
2363 | -#define hel_amps_%(model_name)s_H |
2364 | +#ifndef HelAmps_%(model_name)s_H |
2365 | +#define HelAmps_%(model_name)s_H |
2366 | |
2367 | #include <cmath> |
2368 | #include <complex> |
2369 | @@ -15,4 +15,4 @@ |
2370 | %(function_declarations)s |
2371 | } // end namespace %(namespace)s_%(model_name)s |
2372 | |
2373 | -#endif // hel_amps_%(model_name)s_H |
2374 | \ No newline at end of file |
2375 | +#endif // HelAmps_%(model_name)s_H |
2376 | \ No newline at end of file |
2377 | |
2378 | === modified file 'madgraph/iolibs/template_files/cpp_process_cc.inc' |
2379 | --- madgraph/iolibs/template_files/cpp_process_cc.inc 2010-10-27 16:56:32 +0000 |
2380 | +++ madgraph/iolibs/template_files/cpp_process_cc.inc 2011-03-31 16:46:04 +0000 |
2381 | @@ -1,10 +1,10 @@ |
2382 | //========================================================================== |
2383 | -// This file has been automatically generated for Pythia 8 by |
2384 | +// This file has been automatically generated for C++ Standalone by |
2385 | %(info_lines)s |
2386 | //========================================================================== |
2387 | |
2388 | #include "CPPProcess.h" |
2389 | -#include "hel_amps_%(model_name)s.h" |
2390 | +#include "HelAmps_%(model_name)s.h" |
2391 | |
2392 | using namespace MG5_%(model_name)s; |
2393 | |
2394 | |
2395 | === modified file 'madgraph/iolibs/template_files/cpp_process_h.inc' |
2396 | --- madgraph/iolibs/template_files/cpp_process_h.inc 2010-10-27 16:56:32 +0000 |
2397 | +++ madgraph/iolibs/template_files/cpp_process_h.inc 2011-03-31 16:46:04 +0000 |
2398 | @@ -1,5 +1,5 @@ |
2399 | //========================================================================== |
2400 | -// This file has been automatically generated for Pythia 8 |
2401 | +// This file has been automatically generated for C++ Standalone by |
2402 | %(info_lines)s |
2403 | //========================================================================== |
2404 | |
2405 | |
2406 | === modified file 'madgraph/iolibs/template_files/cpp_process_sigmaKin_function.inc' |
2407 | --- madgraph/iolibs/template_files/cpp_process_sigmaKin_function.inc 2010-10-27 16:56:32 +0000 |
2408 | +++ madgraph/iolibs/template_files/cpp_process_sigmaKin_function.inc 2011-03-31 16:46:04 +0000 |
2409 | @@ -17,13 +17,19 @@ |
2410 | for(int i = 0; i < nprocesses; i++){ |
2411 | matrix_element[i] = 0.; |
2412 | } |
2413 | +// Define permutation |
2414 | +int perm[nexternal]; |
2415 | +for(int i = 0; i < nexternal; i++){ |
2416 | + perm[i]=i; |
2417 | +} |
2418 | |
2419 | if (sum_hel == 0 || ntry < 10){ |
2420 | // Calculate the matrix element for all helicities |
2421 | for(int ihel = 0; ihel < ncomb; ihel ++){ |
2422 | if (goodhel[ihel] || ntry < 2){ |
2423 | - calculate_wavefunctions(helicities[ihel]); |
2424 | + calculate_wavefunctions(perm, helicities[ihel]); |
2425 | %(get_matrix_t_lines)s |
2426 | +%(get_mirror_matrix_lines)s |
2427 | double tsum = 0; |
2428 | for(int iproc = 0;iproc < nprocesses; iproc++){ |
2429 | matrix_element[iproc]+=t[iproc]; |
2430 | @@ -48,8 +54,9 @@ |
2431 | if (jhel >= ngood) jhel=0; |
2432 | double hwgt = double(ngood)/double(sum_hel); |
2433 | int ihel = igood[jhel]; |
2434 | - calculate_wavefunctions(helicities[ihel]); |
2435 | + calculate_wavefunctions(perm, helicities[ihel]); |
2436 | %(get_matrix_t_lines)s |
2437 | +%(get_mirror_matrix_lines)s |
2438 | for(int iproc = 0;iproc < nprocesses; iproc++){ |
2439 | matrix_element[iproc]+=t[iproc]*hwgt; |
2440 | } |
2441 | |
2442 | === added file 'madgraph/iolibs/template_files/pythia8_main_example_cc.inc' |
2443 | --- madgraph/iolibs/template_files/pythia8_main_example_cc.inc 1970-01-01 00:00:00 +0000 |
2444 | +++ madgraph/iolibs/template_files/pythia8_main_example_cc.inc 2011-03-31 16:46:04 +0000 |
2445 | @@ -0,0 +1,71 @@ |
2446 | +//========================================================================== |
2447 | +// This file has been automatically generated for Pythia 8 by |
2448 | +%(info_lines)s |
2449 | +// File based on main25.cc in Pythia 8.149 |
2450 | +//========================================================================== |
2451 | + |
2452 | +#include "Pythia.h" |
2453 | +%(include_lines)s |
2454 | + |
2455 | +using namespace Pythia8; |
2456 | + |
2457 | +int main() { |
2458 | + |
2459 | + // Number of events to generate and to list. Max number of errors. |
2460 | + // Warning: generation of complete events is much slower than if you use |
2461 | + // PartonLevel:all = off to only get cross sections, so adjust nEvent. |
2462 | + int nEvent = 3000; |
2463 | + int nList = 1; |
2464 | + int nAbort = 5; |
2465 | + |
2466 | + // Pythia generator. |
2467 | + Pythia pythia; |
2468 | + |
2469 | + // Read param_card file |
2470 | + pythia.readString("SLHA:file = %(param_card)s"); |
2471 | + |
2472 | + // Provide process pointers to Pythia |
2473 | + %(sigma_pointer_lines)s |
2474 | + |
2475 | + // Phase space cut on pThat. |
2476 | + pythia.readString("PhaseSpace:pTHatMin = 20."); |
2477 | + |
2478 | + // Optionally only compare cross sections. |
2479 | + pythia.readString("PartonLevel:all = off"); |
2480 | + |
2481 | + // Initialization for LHC. |
2482 | + pythia.init( 2212, 2212, 14000.); |
2483 | + |
2484 | + // List changes. |
2485 | + pythia.settings.listChanged(); |
2486 | + pythia.particleData.listChanged(); |
2487 | + |
2488 | + // Begin event loop. |
2489 | + int iAbort = 0; |
2490 | + for (int iEvent = 0; iEvent < nEvent; ++iEvent) { |
2491 | + if (iEvent%%(max(1,nEvent/20)) == 0) |
2492 | + cout << " Now begin event " << iEvent << "\n"; |
2493 | + |
2494 | + // Generate events. Quit if many failures. |
2495 | + if (!pythia.next()) { |
2496 | + if (++iAbort < nAbort) continue; |
2497 | + cout << " Event generation aborted prematurely, owing to error!\n"; |
2498 | + break; |
2499 | + } |
2500 | + |
2501 | + // List first few events. |
2502 | + if (iEvent < nList) { |
2503 | + pythia.info.list(); |
2504 | + pythia.process.list(); |
2505 | + pythia.event.list(); |
2506 | + } |
2507 | + |
2508 | + // End of event loop. |
2509 | + } |
2510 | + |
2511 | + // Final statistics. |
2512 | + pythia.statistics(); |
2513 | + |
2514 | + // Done. |
2515 | + return 0; |
2516 | +} |
2517 | |
2518 | === added file 'madgraph/iolibs/template_files/pythia8_main_makefile.inc' |
2519 | --- madgraph/iolibs/template_files/pythia8_main_makefile.inc 1970-01-01 00:00:00 +0000 |
2520 | +++ madgraph/iolibs/template_files/pythia8_main_makefile.inc 2011-03-31 16:46:04 +0000 |
2521 | @@ -0,0 +1,39 @@ |
2522 | +#========================================================================== |
2523 | +# This file has been automatically generated for Pythia 8 by |
2524 | +%(info_lines)s |
2525 | +#========================================================================== |
2526 | + |
2527 | +SHELL = /bin/sh |
2528 | + |
2529 | +-include ../config.mk |
2530 | + |
2531 | +# flags: |
2532 | +# |
2533 | +#FFLAGSSHARED = -fPIC |
2534 | +CFLAGSSHARED = -fPIC |
2535 | +CXXFLAGSSHARED = -fPIC |
2536 | + |
2537 | +# Location of directories. |
2538 | +TMPDIR=../tmp |
2539 | +INCDIR1=include |
2540 | +INCDIR2=%(include_dir)s |
2541 | +SRCDIR=. |
2542 | +LIBDIR=lib |
2543 | +LIBDIRARCH=lib/archive |
2544 | +PROCDIR=%(process_dir)s |
2545 | + |
2546 | +all: $(targets) ../config.mk |
2547 | + |
2548 | +config.mk: ../configure |
2549 | + cd ..; ./configure |
2550 | + |
2551 | +CPPFLAGS= -I../$(INCDIR1) -I../$(INCDIR2) |
2552 | +LIBS=-L../$(LIBDIRARCH) -lpythia8 -llhapdfdummy -l$(PROCDIR) |
2553 | + |
2554 | +all: %(main_file)s |
2555 | + |
2556 | +%(main_file)s: %(main_file)s.o ../$(LIBDIRARCH)/lib$(PROCDIR).a |
2557 | + g++ -o %(main_file)s %(main_file)s.o $(LIBS) |
2558 | + |
2559 | +../$(LIBDIRARCH)/lib$(PROCDIR).a: ../$(PROCDIR)/Makefile |
2560 | + cd ../$(PROCDIR); make |
2561 | |
2562 | === added file 'madgraph/iolibs/template_files/pythia8_makefile.inc' |
2563 | --- madgraph/iolibs/template_files/pythia8_makefile.inc 1970-01-01 00:00:00 +0000 |
2564 | +++ madgraph/iolibs/template_files/pythia8_makefile.inc 2011-03-31 16:46:04 +0000 |
2565 | @@ -0,0 +1,107 @@ |
2566 | +#========================================================================== |
2567 | +# This file has been automatically generated for Pythia 8 by |
2568 | +%(info_lines)s |
2569 | +# Makefile in compliance with the Pythia 8 1.4.9 makefile |
2570 | +#========================================================================== |
2571 | + |
2572 | +SHELL = /bin/sh |
2573 | + |
2574 | +-include ../config.mk |
2575 | + |
2576 | +# flags: |
2577 | +# |
2578 | +#FFLAGSSHARED = -fPIC |
2579 | +CFLAGSSHARED = -fPIC |
2580 | +CXXFLAGSSHARED = -fPIC |
2581 | + |
2582 | +# Location of directories. |
2583 | +TMPDIR=tmp |
2584 | +INCDIR=../include |
2585 | +SRCDIR=. |
2586 | +LIBDIR=../lib |
2587 | +LIBDIRARCH=../lib/archive |
2588 | + |
2589 | +# Location of libraries to be built. |
2590 | +ifeq ($(SHAREDLIBS),yes) |
2591 | + targets=$(LIBDIRARCH)/libProcesses_%(model)s.a |
2592 | + targets+=$(LIBDIR)/libProcesses_%(model)s.$(SHAREDSUFFIX) |
2593 | +else |
2594 | + targets=$(LIBDIRARCH)/libProcesses_%(model)s.a |
2595 | +endif |
2596 | + |
2597 | +all: $(targets) ../config.mk |
2598 | + |
2599 | +config.mk: ../configure |
2600 | + cd ..; ./configure |
2601 | + |
2602 | +# Main part: build library. |
2603 | + |
2604 | +$(TMPDIR)/%%.o : $(SRCDIR)/%%.cc |
2605 | + @mkdir -p $(TMPDIR) |
2606 | + $(CXX) $(CXXFLAGS) $(CXXFLAGSSHARED) -c -I$(INCDIR) -I$(SRCDIR) $< -o $@ |
2607 | + |
2608 | +$(TMPDIR)/archive/%%.o : $(SRCDIR)/%%.cc |
2609 | + @mkdir -p $(TMPDIR)/archive |
2610 | + $(CXX) $(CXXFLAGS) -c -I$(INCDIR) -I$(SRCDIR) $< -o $@ |
2611 | + |
2612 | +# Creating the dependency files *.d |
2613 | +# The compiler with option -M is used to build the dependency strings. They |
2614 | +# are further edited with sed (stream editor). The first sed command adds the |
2615 | +# dependency for the *.d files themselves, the second one is needed because |
2616 | +# object files are put in the directory different from src. The last line |
2617 | +# removes empty *.d files produced in case of error. |
2618 | + |
2619 | +ifeq ($(SHAREDLIBS),yes) |
2620 | + $(TMPDIR)/%%.d : $(SRCDIR)/%%.cc |
2621 | + @echo Making dependency for file $<; \ |
2622 | + mkdir -p $(TMPDIR); \ |
2623 | + $(CC) -M -I$(INCDIR) -I$(SRCDIR) $< | \ |
2624 | + sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' | \ |
2625 | + sed 's/$*\.o/$(TMPDIR)\/$*.o/' > $@; \ |
2626 | + [ -s $@ ] || rm -f $@ |
2627 | +endif |
2628 | + |
2629 | +$(TMPDIR)/archive/%%.d : $(SRCDIR)/%%.cc |
2630 | + @echo Making dependency for file $<; \ |
2631 | + mkdir -p $(TMPDIR)/archive; \ |
2632 | + $(CC) -M -I$(INCDIR) -I$(SRCDIR) $< | \ |
2633 | + sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' | \ |
2634 | + sed 's/$*\.o/$(TMPDIR)\/archive\/$*.o/' > $@; \ |
2635 | + [ -s $@ ] || rm -f $@ |
2636 | + |
2637 | +objects := $(patsubst $(SRCDIR)/%%.cc,$(TMPDIR)/%%.o,$(wildcard $(SRCDIR)/*.cc)) |
2638 | +objectsarch := $(patsubst $(SRCDIR)/%%.cc,$(TMPDIR)/archive/%%.o,$(wildcard $(SRCDIR)/*.cc)) |
2639 | + |
2640 | +$(LIBDIR)/libProcesses_%(model)s.$(SHAREDSUFFIX): $(objects) |
2641 | + @mkdir -p $(LIBDIR) |
2642 | + $(CXX) $(LDFLAGSSHARED) -o $@ $(objects) $(LDFLAGLIBNAME),$(notdir $@) |
2643 | + |
2644 | +$(LIBDIRARCH)/libProcesses_%(model)s.a: $(objectsarch) |
2645 | + @mkdir -p $(LIBDIRARCH) |
2646 | + ar cru $@ $(objectsarch) |
2647 | + |
2648 | +deps := $(patsubst $(SRCDIR)/%%.cc,$(TMPDIR)/%%.d,$(wildcard $(SRCDIR)/*.cc)) |
2649 | +depsarch := $(patsubst $(SRCDIR)/%%.cc,$(TMPDIR)/archive/%%.d,$(wildcard $(SRCDIR)/*.cc)) |
2650 | + |
2651 | + |
2652 | +# The "if" below is needed in order to avoid producing the dependency files |
2653 | +# when you want to just clean |
2654 | + |
2655 | +ifeq (,$(findstring clean, $(MAKECMDGOALS))) |
2656 | +-include $(deps) |
2657 | +-include $(depsarch) |
2658 | +endif |
2659 | + |
2660 | +# Clean up: remove (almost?) everything that cannot be recreated. |
2661 | + |
2662 | +.PHONY: clean distclean |
2663 | + |
2664 | +clean: |
2665 | + rm -rf $(TMPDIR) |
2666 | + rm -rf $(LIBDIR) |
2667 | + |
2668 | +distclean: clean |
2669 | + rm -f config.mk |
2670 | + rm -f *~; rm -f \#*; |
2671 | + cd $(SRCDIR); rm -f *~; rm -f \#*; cd - |
2672 | + cd $(INCDIR); rm -f *~; rm -f \#*; cd - |
2673 | |
2674 | === modified file 'madgraph/iolibs/template_files/pythia8_model_parameters_cc.inc' |
2675 | --- madgraph/iolibs/template_files/pythia8_model_parameters_cc.inc 2010-07-30 07:30:26 +0000 |
2676 | +++ madgraph/iolibs/template_files/pythia8_model_parameters_cc.inc 2011-03-31 16:46:04 +0000 |
2677 | @@ -20,19 +20,16 @@ |
2678 | return instance; |
2679 | } |
2680 | |
2681 | - void Parameters_%(model_name)s::setIndependentParameters(ParticleData*& pd, CoupSM*& csm){ |
2682 | - // First set "zero" |
2683 | - zero=0; |
2684 | - ZERO=0; |
2685 | + void Parameters_%(model_name)s::setIndependentParameters(ParticleData*& pd, Couplings*& csm, SusyLesHouches*& slhaPtr){ |
2686 | %(set_independent_parameters)s |
2687 | } |
2688 | - void Parameters_%(model_name)s::setIndependentCouplings(ParticleData*& pd, CoupSM*& csm){ |
2689 | + void Parameters_%(model_name)s::setIndependentCouplings(){ |
2690 | %(set_independent_couplings)s |
2691 | } |
2692 | - void Parameters_%(model_name)s::setDependentParameters(ParticleData*& pd, CoupSM*& csm, double alpS){ |
2693 | + void Parameters_%(model_name)s::setDependentParameters(ParticleData*& pd, Couplings*& csm, SusyLesHouches*& slhaPtr, double alpS){ |
2694 | %(set_dependent_parameters)s |
2695 | } |
2696 | - void Parameters_%(model_name)s::setDependentCouplings(ParticleData*& pd, CoupSM*&csm){ |
2697 | + void Parameters_%(model_name)s::setDependentCouplings(){ |
2698 | %(set_dependent_couplings)s |
2699 | } |
2700 | |
2701 | |
2702 | === modified file 'madgraph/iolibs/template_files/pythia8_model_parameters_h.inc' |
2703 | --- madgraph/iolibs/template_files/pythia8_model_parameters_h.inc 2010-09-21 04:20:25 +0000 |
2704 | +++ madgraph/iolibs/template_files/pythia8_model_parameters_h.inc 2011-03-31 16:46:04 +0000 |
2705 | @@ -10,6 +10,7 @@ |
2706 | |
2707 | #include "ParticleData.h" |
2708 | #include "StandardModel.h" |
2709 | +#include "SusyLesHouches.h" |
2710 | |
2711 | using namespace std; |
2712 | |
2713 | @@ -21,21 +22,19 @@ |
2714 | |
2715 | static Parameters_%(model_name)s* getInstance(); |
2716 | |
2717 | -// Define "zero" |
2718 | -double zero, ZERO; |
2719 | %(independent_parameters)s |
2720 | %(independent_couplings)s |
2721 | %(dependent_parameters)s |
2722 | %(dependent_couplings)s |
2723 | |
2724 | // Set parameters that are unchanged during the run |
2725 | -void setIndependentParameters(ParticleData*& pd, CoupSM*& csm); |
2726 | +void setIndependentParameters(ParticleData*& pd, Couplings*& csm, SusyLesHouches*& slhaPtr); |
2727 | // Set couplings that are unchanged during the run |
2728 | -void setIndependentCouplings(ParticleData*& pd, CoupSM*& csm); |
2729 | +void setIndependentCouplings(); |
2730 | // Set parameters that are changed event by event |
2731 | -void setDependentParameters(ParticleData*& pd, CoupSM*& csm, double alpS); |
2732 | +void setDependentParameters(ParticleData*& pd, Couplings*& csm, SusyLesHouches*& slhaPtr, double alpS); |
2733 | // Set couplings that are changed event by event |
2734 | -void setDependentCouplings(ParticleData*& pd, CoupSM*& csm); |
2735 | +void setDependentCouplings(); |
2736 | |
2737 | // Print parameters that are unchanged during the run |
2738 | void printIndependentParameters(); |
2739 | |
2740 | === modified file 'madgraph/iolibs/template_files/pythia8_process_cc.inc' |
2741 | --- madgraph/iolibs/template_files/pythia8_process_cc.inc 2010-08-08 10:22:18 +0000 |
2742 | +++ madgraph/iolibs/template_files/pythia8_process_cc.inc 2011-03-31 16:46:04 +0000 |
2743 | @@ -4,7 +4,7 @@ |
2744 | //========================================================================== |
2745 | |
2746 | #include "%(process_file_name)s.h" |
2747 | -#include "hel_amps_%(model_name)s.h" |
2748 | +#include "HelAmps_%(model_name)s.h" |
2749 | |
2750 | using namespace Pythia8_%(model_name)s; |
2751 | |
2752 | |
2753 | === modified file 'madgraph/iolibs/template_files/pythia8_process_function_definitions.inc' |
2754 | --- madgraph/iolibs/template_files/pythia8_process_function_definitions.inc 2010-08-08 14:06:25 +0000 |
2755 | +++ madgraph/iolibs/template_files/pythia8_process_function_definitions.inc 2011-03-31 16:46:04 +0000 |
2756 | @@ -8,8 +8,8 @@ |
2757 | void %(process_class_name)s::initProc() { |
2758 | // Instantiate the model class and set parameters that stay fixed during run |
2759 | pars = Parameters_%(model_name)s::getInstance(); |
2760 | - pars->setIndependentParameters(particleDataPtr, coupSMPtr); |
2761 | - pars->setIndependentCouplings(particleDataPtr, coupSMPtr); |
2762 | + pars->setIndependentParameters(particleDataPtr, couplingsPtr, slhaPtr); |
2763 | + pars->setIndependentCouplings(); |
2764 | %(initProc_lines)s |
2765 | } |
2766 | |
2767 | @@ -18,8 +18,8 @@ |
2768 | |
2769 | void %(process_class_name)s::sigmaKin() { |
2770 | // Set the parameters which change event by event |
2771 | - pars->setDependentParameters(particleDataPtr, coupSMPtr, alpS); |
2772 | - pars->setDependentCouplings(particleDataPtr, coupSMPtr); |
2773 | + pars->setDependentParameters(particleDataPtr, couplingsPtr, slhaPtr, alpS); |
2774 | + pars->setDependentCouplings(); |
2775 | // Reset color flows |
2776 | %(reset_jamp_lines)s |
2777 | %(sigmaKin_lines)s |
2778 | |
2779 | === modified file 'madgraph/iolibs/template_files/pythia8_process_sigmaKin_function.inc' |
2780 | --- madgraph/iolibs/template_files/pythia8_process_sigmaKin_function.inc 2010-09-21 04:20:25 +0000 |
2781 | +++ madgraph/iolibs/template_files/pythia8_process_sigmaKin_function.inc 2011-03-31 16:46:04 +0000 |
2782 | @@ -4,7 +4,6 @@ |
2783 | static int ntry = 0, sum_hel = 0, ngood = 0; |
2784 | static int igood[ncomb]; |
2785 | static int jhel; |
2786 | -std::complex<double> **wfs; |
2787 | double t[nprocesses]; |
2788 | // Helicities for the process |
2789 | %(helicity_matrix)s |
2790 | @@ -16,6 +15,13 @@ |
2791 | // Reset the matrix elements |
2792 | for(int i = 0; i < nprocesses; i++){ |
2793 | matrix_element[i] = 0.; |
2794 | + t[i] = 0.; |
2795 | +} |
2796 | + |
2797 | +// Define permutation |
2798 | +int perm[nexternal]; |
2799 | +for(int i = 0; i < nexternal; i++){ |
2800 | + perm[i]=i; |
2801 | } |
2802 | |
2803 | // For now, call setupForME() here |
2804 | @@ -29,8 +35,9 @@ |
2805 | // Calculate the matrix element for all helicities |
2806 | for(int ihel = 0; ihel < ncomb; ihel ++){ |
2807 | if (goodhel[ihel] || ntry < 2){ |
2808 | - calculate_wavefunctions(helicities[ihel]); |
2809 | + calculate_wavefunctions(perm, helicities[ihel]); |
2810 | %(get_matrix_t_lines)s |
2811 | +%(get_mirror_matrix_lines)s |
2812 | double tsum = 0; |
2813 | for(int iproc = 0;iproc < nprocesses; iproc++){ |
2814 | matrix_element[iproc]+=t[iproc]; |
2815 | @@ -55,8 +62,9 @@ |
2816 | if (jhel >= ngood) jhel=0; |
2817 | double hwgt = double(ngood)/double(sum_hel); |
2818 | int ihel = igood[jhel]; |
2819 | - calculate_wavefunctions(helicities[ihel]); |
2820 | + calculate_wavefunctions(perm, helicities[ihel]); |
2821 | %(get_matrix_t_lines)s |
2822 | +%(get_mirror_matrix_lines)s |
2823 | for(int iproc = 0;iproc < nprocesses; iproc++){ |
2824 | matrix_element[iproc]+=t[iproc]*hwgt; |
2825 | } |
2826 | |
2827 | === modified file 'madgraph/iolibs/template_files/pythia8_process_wavefunctions.inc' |
2828 | --- madgraph/iolibs/template_files/pythia8_process_wavefunctions.inc 2010-08-23 01:56:08 +0000 |
2829 | +++ madgraph/iolibs/template_files/pythia8_process_wavefunctions.inc 2011-03-31 16:46:04 +0000 |
2830 | @@ -1,5 +1,5 @@ |
2831 | double p[nexternal][4]; |
2832 | -int i,j; |
2833 | +int i; |
2834 | |
2835 | // Convert Pythia 4-vectors to double[] |
2836 | for(i=0;i < nexternal;i++){ |
2837 | |
2838 | === modified file 'madgraph/iolibs/template_files/read_slha.cc' |
2839 | --- madgraph/iolibs/template_files/read_slha.cc 2010-09-21 04:20:25 +0000 |
2840 | +++ madgraph/iolibs/template_files/read_slha.cc 2011-03-31 16:46:04 +0000 |
2841 | @@ -123,7 +123,7 @@ |
2842 | } |
2843 | |
2844 | |
2845 | -double SLHAReader::set_block_entry(string block_name, vector<int> indices, |
2846 | +void SLHAReader::set_block_entry(string block_name, vector<int> indices, |
2847 | double value) |
2848 | { |
2849 | if (_blocks.find(block_name) == _blocks.end()){ |
2850 | @@ -137,7 +137,7 @@ |
2851 | cout << "to " << _blocks[block_name].get_entry(indices) << endl;*/ |
2852 | } |
2853 | |
2854 | -double SLHAReader::set_block_entry(string block_name, int index, |
2855 | +void SLHAReader::set_block_entry(string block_name, int index, |
2856 | double value) |
2857 | { |
2858 | vector<int> indices; |
2859 | |
2860 | === modified file 'madgraph/iolibs/template_files/read_slha.h' |
2861 | --- madgraph/iolibs/template_files/read_slha.h 2010-09-21 04:20:25 +0000 |
2862 | +++ madgraph/iolibs/template_files/read_slha.h 2011-03-31 16:46:04 +0000 |
2863 | @@ -20,7 +20,7 @@ |
2864 | private: |
2865 | string _name; |
2866 | map<vector<int>,double> _entries; |
2867 | - int _indices; |
2868 | + unsigned int _indices; |
2869 | }; |
2870 | |
2871 | class SLHAReader |
2872 | @@ -34,9 +34,9 @@ |
2873 | double def_val = 0); |
2874 | double get_block_entry(string block_name, int index, |
2875 | double def_val = 0); |
2876 | - double set_block_entry(string block_name, vector<int> indices, |
2877 | + void set_block_entry(string block_name, vector<int> indices, |
2878 | double value); |
2879 | - double set_block_entry(string block_name, int index, |
2880 | + void set_block_entry(string block_name, int index, |
2881 | double value); |
2882 | private: |
2883 | map<string, SLHABlock> _blocks; |
2884 | |
2885 | === modified file 'tests/acceptance_tests/test_cmd.py' |
2886 | --- tests/acceptance_tests/test_cmd.py 2011-03-24 16:15:56 +0000 |
2887 | +++ tests/acceptance_tests/test_cmd.py 2011-03-31 16:46:04 +0000 |
2888 | @@ -117,7 +117,6 @@ |
2889 | |
2890 | def tearDown(self): |
2891 | """ basic destruction after have run """ |
2892 | - return |
2893 | if os.path.exists(self.out_dir): |
2894 | shutil.rmtree(self.out_dir) |
2895 | |
2896 | @@ -878,30 +877,24 @@ |
2897 | if os.path.isdir(self.out_dir): |
2898 | shutil.rmdir(self.out_dir) |
2899 | |
2900 | - os.mkdir(self.out_dir) |
2901 | + # Create out_dir and out_dir/include |
2902 | + os.makedirs(os.path.join(self.out_dir,'include')) |
2903 | + # Touch the file Pythia.h, which is needed to verify that this is a Pythia dir |
2904 | + py_h_file = open(os.path.join(self.out_dir,'include','Pythia.h'), 'w') |
2905 | + py_h_file.close() |
2906 | |
2907 | self.do('import model sm') |
2908 | - self.do('output pythia8_model %s ' % self.out_dir) |
2909 | - # Check that the needed files are generated |
2910 | - files = ['hel_amps_sm.h', 'hel_amps_sm.cc', |
2911 | - 'Parameters_sm.h', 'Parameters_sm.cc'] |
2912 | - for f in files: |
2913 | - self.assertTrue(os.path.isfile(os.path.join(self.out_dir, f)), |
2914 | - '%s file is not in directory' % f) |
2915 | - self.do('define p u u~ d d~') |
2916 | - self.do('generate p p > e+ e-') |
2917 | - self.do('output pythia8 %s ' % self.out_dir) |
2918 | - # Check that the needed files are generated |
2919 | - files = ['Sigma_sm_pp_epem.h', 'Sigma_sm_pp_epem.cc'] |
2920 | - for f in files: |
2921 | - self.assertTrue(os.path.isfile(os.path.join(self.out_dir, f)), |
2922 | - '%s file is not in directory' % f) |
2923 | - self.do('define j u u~ d d~') |
2924 | - self.do('generate g p > w+ j') |
2925 | - self.do('add process p g > w+ j') |
2926 | + self.do('define p g u d u~ d~') |
2927 | + self.do('define j g u d u~ d~') |
2928 | + self.do('generate p p > w+ j') |
2929 | self.do('output pythia8 %s' % self.out_dir) |
2930 | # Check that the needed files are generated |
2931 | - files = ['Sigma_sm_gp_wpj.h', 'Sigma_sm_gp_wpj.cc'] |
2932 | + files = ['Processes_sm/Sigma_sm_gq_wpq.h', 'Processes_sm/Sigma_sm_gq_wpq.cc', |
2933 | + 'Processes_sm/Sigma_sm_qq_wpg.h', 'Processes_sm/Sigma_sm_qq_wpg.cc', |
2934 | + 'Processes_sm/HelAmps_sm.h', 'Processes_sm/HelAmps_sm.cc', |
2935 | + 'Processes_sm/Parameters_sm.h', |
2936 | + 'Processes_sm/Parameters_sm.cc', 'Processes_sm/Makefile', |
2937 | + 'examples/main_sm_1.cc', 'examples/Makefile_sm_1'] |
2938 | for f in files: |
2939 | self.assertTrue(os.path.isfile(os.path.join(self.out_dir, f)), |
2940 | '%s file is not in directory' % f) |
2941 | @@ -917,7 +910,7 @@ |
2942 | self.do('output standalone_cpp %s' % self.out_dir) |
2943 | |
2944 | # Check that all needed src files are generated |
2945 | - files = ['hel_amps_sm.h', 'hel_amps_sm.cc', 'Makefile', |
2946 | + files = ['HelAmps_sm.h', 'HelAmps_sm.cc', 'Makefile', |
2947 | 'Parameters_sm.h', 'Parameters_sm.cc', |
2948 | 'rambo.h', 'rambo.cc', 'read_slha.h', 'read_slha.cc'] |
2949 | |
2950 | |
2951 | === modified file 'tests/parallel_tests/me_comparator.py' |
2952 | --- tests/parallel_tests/me_comparator.py 2010-12-19 03:57:07 +0000 |
2953 | +++ tests/parallel_tests/me_comparator.py 2011-03-31 16:46:04 +0000 |
2954 | @@ -323,19 +323,16 @@ |
2955 | def setup(self, mg5_path, mg4_path, temp_dir=None): |
2956 | """Wrapper for the mg4 setup, also initializing the mg5 path variable""" |
2957 | |
2958 | - super(MG5Runner, self).setup(mg4_path, temp_dir) |
2959 | - |
2960 | - if not os.path.isdir(mg5_path): |
2961 | - raise IOError, "Path %s is not valid" % str(mg5_path) |
2962 | - |
2963 | - self.mg5_path = os.path.abspath(mg5_path) |
2964 | - |
2965 | - def check_path(self, mg4_path): |
2966 | - """Check the path for necessary directories""" |
2967 | - |
2968 | - if not os.path.isdir(os.path.join(mg4_path, "Template")) or \ |
2969 | - not os.path.isdir(os.path.join(mg4_path, "HELAS")): |
2970 | - raise IOError, "Path %s is not a valid MG4 path" % str(mg4_path) |
2971 | + self.mg4_path = os.path.abspath(mg4_path) |
2972 | + |
2973 | + if not temp_dir: |
2974 | + i=0 |
2975 | + while os.path.exists(os.path.join(mg4_path, |
2976 | + "test_%s_%s" % (self.type, i))): |
2977 | + i += 1 |
2978 | + temp_dir = "test_%s_%s" % (self.type, i) |
2979 | + |
2980 | + self.temp_dir_name = temp_dir |
2981 | |
2982 | def run(self, proc_list, model, orders={}, energy=1000): |
2983 | """Execute MG5 on the list of processes mentioned in proc_list, using |
2984 | @@ -350,10 +347,10 @@ |
2985 | |
2986 | dir_name = os.path.join(self.mg4_path, self.temp_dir_name) |
2987 | |
2988 | - self.fix_energy_in_check(dir_name, energy) |
2989 | - |
2990 | # Create a proc_card.dat in the v5 format |
2991 | - proc_card_file = open(os.path.join(dir_name, 'Cards', 'proc_card_v5.dat'), 'w') |
2992 | + proc_card_location = os.path.join(self.mg4_path, 'proc_card_%s.dat' % \ |
2993 | + self.temp_dir_name) |
2994 | + proc_card_file = open(proc_card_location, 'w') |
2995 | proc_card_file.write(self.format_mg5_proc_card(proc_list, model, orders)) |
2996 | proc_card_file.close() |
2997 | |
2998 | @@ -362,13 +359,18 @@ |
2999 | |
3000 | # Run mg5 |
3001 | logging.info("Running mg5") |
3002 | - proc_card = open(os.path.join(dir_name, 'Cards', 'proc_card_v5.dat'), 'r').read() |
3003 | + proc_card = open(proc_card_location, 'r').read() |
3004 | cmd = cmd_interface.MadGraphCmdShell() |
3005 | for line in proc_card.split('\n'): |
3006 | try: |
3007 | cmd.run_cmd(line) |
3008 | except MadGraph5Error: |
3009 | raise Exception |
3010 | + |
3011 | + # Remove the temporary proc_card |
3012 | + os.remove(proc_card_location) |
3013 | + self.fix_energy_in_check(dir_name, energy) |
3014 | + |
3015 | # Get the ME value |
3016 | for i, proc in enumerate(proc_list): |
3017 | self.res_list.append(self.get_me_value(proc, i)) |
3018 | @@ -395,12 +397,6 @@ |
3019 | name = 'UFO-ALOHA-MG5' |
3020 | type = 'ufo' |
3021 | |
3022 | - def check_path(self, mg4_path): |
3023 | - """Check the path for necessary directories""" |
3024 | - |
3025 | - if not os.path.isdir(os.path.join(mg4_path, "Template")): |
3026 | - raise IOError, "Path %s is not a valid MG4 path" % str(mg4_path) |
3027 | - |
3028 | def format_mg5_proc_card(self, proc_list, model, orders): |
3029 | """Create a proc_card.dat string following v5 conventions.""" |
3030 | |
3031 | @@ -416,7 +412,7 @@ |
3032 | |
3033 | return v5_string |
3034 | |
3035 | -class MG5_CPP_Runner(MG4Runner): |
3036 | +class MG5_CPP_Runner(MG5Runner): |
3037 | """Runner object for the MG5 C++ Standalone output.""" |
3038 | |
3039 | mg5_path = "" |
3040 | @@ -425,96 +421,6 @@ |
3041 | name = 'MG5-C++' |
3042 | compilator ='g++' |
3043 | |
3044 | - def setup(self, mg5_path, mg4_path, temp_dir=None): |
3045 | - """Setup routine: create a temporary C++ Standalone |
3046 | - directory. the temp_dir variable can be given to specify the |
3047 | - name of the process directory, otherwise a temporary one is |
3048 | - created.""" |
3049 | - |
3050 | - self.proc_list = [] |
3051 | - self.res_list = [] |
3052 | - |
3053 | - self.setup_flag = False |
3054 | - |
3055 | - if not os.path.isdir(mg4_path): |
3056 | - raise IOError, "Path %s is not valid" % str(mg4_path) |
3057 | - |
3058 | - self.mg4_path = os.path.abspath(mg4_path) |
3059 | - |
3060 | - if not os.path.isdir(mg5_path): |
3061 | - raise IOError, "Path %s is not valid" % str(mg5_path) |
3062 | - |
3063 | - self.mg5_path = os.path.abspath(mg5_path) |
3064 | - |
3065 | - if not temp_dir: |
3066 | - i=0 |
3067 | - while os.path.exists(os.path.join(mg4_path, |
3068 | - "test_%s_%s" % (self.type, i))): |
3069 | - i += 1 |
3070 | - temp_dir = "test_%s_%s" % (self.type, i) |
3071 | - |
3072 | - if os.path.exists(os.path.join(mg4_path, temp_dir)): |
3073 | - raise IOError, "Path %s for test already exist" % \ |
3074 | - str(os.path.join(mg4_path, temp_dir)) |
3075 | - |
3076 | - try: |
3077 | - os.mkdir(os.path.join(mg4_path, temp_dir)) |
3078 | - except os.error as error: |
3079 | - raise IOError, error.strerror + " " + temp_dir |
3080 | - |
3081 | - try: |
3082 | - os.mkdir(os.path.join(mg4_path, temp_dir, 'Cards')) |
3083 | - except os.error as error: |
3084 | - raise IOError, error.strerror + " " + temp_dir + '/Cards' |
3085 | - |
3086 | - self.temp_dir_name = temp_dir |
3087 | - |
3088 | - # Set the setup flag to true to tell other routines everything is OK |
3089 | - self.setup_flag = True |
3090 | - |
3091 | - # print some info |
3092 | - logging.info("Temporary standalone C++ directory %s successfully created" % \ |
3093 | - temp_dir) |
3094 | - |
3095 | - def run(self, proc_list, model, orders={}, energy=1000): |
3096 | - """Execute MG5 on the list of processes mentioned in proc_list, using |
3097 | - the specified model, the specified maximal coupling orders and a certain |
3098 | - energy for incoming particles (for decay, incoming particle is at rest). |
3099 | - """ |
3100 | - |
3101 | - self.proc_list = proc_list |
3102 | - self.model = model |
3103 | - self.orders = orders |
3104 | - self.energy = energy |
3105 | - |
3106 | - dir_name = os.path.join(self.mg4_path, self.temp_dir_name) |
3107 | - |
3108 | - # Create a proc_card.dat in the v5 format |
3109 | - proc_card_file = open(os.path.join(dir_name, 'Cards', 'proc_card_v5.dat'), 'w') |
3110 | - proc_card_file.write(self.format_mg5_proc_card(proc_list, model, orders)) |
3111 | - proc_card_file.close() |
3112 | - |
3113 | - logging.info("proc_card.dat file for %i processes successfully created in %s" % \ |
3114 | - (len(proc_list), os.path.join(dir_name, 'Cards'))) |
3115 | - |
3116 | - # Run mg5 |
3117 | - logging.info("Running MG5 Standalone C++ output") |
3118 | - proc_card = open(os.path.join(dir_name, 'Cards', 'proc_card_v5.dat'), 'r').read() |
3119 | - cmd = cmd_interface.MadGraphCmdShell() |
3120 | - for line in proc_card.split('\n'): |
3121 | - try: |
3122 | - cmd.run_cmd(line) |
3123 | - except MadGraph5Error: |
3124 | - pass |
3125 | - |
3126 | - self.fix_energy_in_check(dir_name, energy) |
3127 | - |
3128 | - # Get the ME value |
3129 | - for i, proc in enumerate(proc_list): |
3130 | - self.res_list.append(self.get_me_value(proc, i)) |
3131 | - |
3132 | - return self.res_list |
3133 | - |
3134 | def format_mg5_proc_card(self, proc_list, model, orders): |
3135 | """Create a proc_card.dat string following v5 conventions.""" |
3136 | |
3137 | |
3138 | === modified file 'tests/parallel_tests/sample_script.py' |
3139 | --- tests/parallel_tests/sample_script.py 2011-03-03 00:09:21 +0000 |
3140 | +++ tests/parallel_tests/sample_script.py 2011-03-31 16:46:04 +0000 |
3141 | @@ -80,11 +80,11 @@ |
3142 | |
3143 | # Create and setup a comparator |
3144 | my_comp = me_comparator.MEComparator() |
3145 | - my_comp.set_me_runners(my_mg5, my_mg5_ufo) |
3146 | + my_comp.set_me_runners(my_mg4, my_mg5, my_mg5_ufo, my_mg5_cpp) |
3147 | |
3148 | # Run the actual comparison |
3149 | my_comp.run_comparison(my_proc_list, |
3150 | - model=['mssm','MSSM_UFO',], |
3151 | + model='mssm', |
3152 | orders={'QED':4, 'QCD':4}, energy=2000) |
3153 | |
3154 | # Do some cleanup |
3155 | |
3156 | === modified file 'tests/unit_tests/iolibs/test_export_cpp.py' |
3157 | --- tests/unit_tests/iolibs/test_export_cpp.py 2011-02-15 16:32:30 +0000 |
3158 | +++ tests/unit_tests/iolibs/test_export_cpp.py 2011-03-31 16:46:04 +0000 |
3159 | @@ -240,7 +240,7 @@ |
3160 | self.cpp_exporter = export_cpp.ProcessExporterCPP(\ |
3161 | self.mymatrixelement, self.mycppwriter, |
3162 | process_string = "q q~ > q q~") |
3163 | - |
3164 | + |
3165 | tearDown = test_file_writers.CheckFileCreate.clean_files |
3166 | |
3167 | def test_pythia8_export_functions(self): |
3168 | @@ -273,7 +273,7 @@ |
3169 | goal_string = \ |
3170 | """//========================================================================== |
3171 | // This file has been automatically generated for Pythia 8 |
3172 | -// by MadGraph 5 v. %(version)s, %(date)s |
3173 | +// MadGraph 5 v. %(version)s, %(date)s |
3174 | // By the MadGraph Development Team |
3175 | // Please visit us at https://launchpad.net/madgraph5 |
3176 | //========================================================================== |
3177 | @@ -333,7 +333,7 @@ |
3178 | |
3179 | // Private functions to calculate the matrix element for all subprocesses |
3180 | // Calculate wavefunctions |
3181 | - void calculate_wavefunctions(const int hel[]); |
3182 | + void calculate_wavefunctions(const int perm[], const int hel[]); |
3183 | static const int nwavefuncs = 10; |
3184 | std::complex<double> w[nwavefuncs][18]; |
3185 | double matrix_uux_uux(); |
3186 | @@ -371,13 +371,13 @@ |
3187 | goal_string = \ |
3188 | """//========================================================================== |
3189 | // This file has been automatically generated for Pythia 8 by |
3190 | -// by MadGraph 5 v. %(version)s, %(date)s |
3191 | +// MadGraph 5 v. %(version)s, %(date)s |
3192 | // By the MadGraph Development Team |
3193 | // Please visit us at https://launchpad.net/madgraph5 |
3194 | //========================================================================== |
3195 | |
3196 | #include "Sigma_sm_qqx_qqx.h" |
3197 | -#include "hel_amps_sm.h" |
3198 | +#include "HelAmps_sm.h" |
3199 | |
3200 | using namespace Pythia8_sm; |
3201 | |
3202 | @@ -396,8 +396,8 @@ |
3203 | { |
3204 | // Instantiate the model class and set parameters that stay fixed during run |
3205 | pars = Parameters_sm::getInstance(); |
3206 | - pars->setIndependentParameters(particleDataPtr, coupSMPtr); |
3207 | - pars->setIndependentCouplings(particleDataPtr, coupSMPtr); |
3208 | + pars->setIndependentParameters(particleDataPtr, couplingsPtr, slhaPtr); |
3209 | + pars->setIndependentCouplings(); |
3210 | // Set massive/massless matrix elements for c/b/mu/tau |
3211 | mcME = particleDataPtr->m0(4); |
3212 | mbME = 0.; |
3213 | @@ -412,8 +412,8 @@ |
3214 | void Sigma_sm_qqx_qqx::sigmaKin() |
3215 | { |
3216 | // Set the parameters which change event by event |
3217 | - pars->setDependentParameters(particleDataPtr, coupSMPtr, alpS); |
3218 | - pars->setDependentCouplings(particleDataPtr, coupSMPtr); |
3219 | + pars->setDependentParameters(particleDataPtr, couplingsPtr, slhaPtr, alpS); |
3220 | + pars->setDependentCouplings(); |
3221 | // Reset color flows |
3222 | for(int i = 0; i < 2; i++ ) |
3223 | jamp2[0][i] = 0.; |
3224 | @@ -424,13 +424,13 @@ |
3225 | static int ntry = 0, sum_hel = 0, ngood = 0; |
3226 | static int igood[ncomb]; |
3227 | static int jhel; |
3228 | - std::complex<double> * * wfs; |
3229 | double t[nprocesses]; |
3230 | // Helicities for the process |
3231 | - static const int helicities[ncomb][nexternal] = {-1, -1, -1, -1, -1, -1, -1, |
3232 | - 1, -1, -1, 1, -1, -1, -1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1, -1, 1, 1, |
3233 | - -1, -1, 1, 1, 1, 1, -1, -1, -1, 1, -1, -1, 1, 1, -1, 1, -1, 1, -1, 1, 1, |
3234 | - 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, -1, 1, 1, 1, 1}; |
3235 | + static const int helicities[ncomb][nexternal] = {{-1, -1, -1, -1}, {-1, -1, |
3236 | + -1, 1}, {-1, -1, 1, -1}, {-1, -1, 1, 1}, {-1, 1, -1, -1}, {-1, 1, -1, 1}, |
3237 | + {-1, 1, 1, -1}, {-1, 1, 1, 1}, {1, -1, -1, -1}, {1, -1, -1, 1}, {1, -1, |
3238 | + 1, -1}, {1, -1, 1, 1}, {1, 1, -1, -1}, {1, 1, -1, 1}, {1, 1, 1, -1}, {1, |
3239 | + 1, 1, 1}}; |
3240 | // Denominators: spins, colors and identical particles |
3241 | const int denominators[nprocesses] = {36}; |
3242 | |
3243 | @@ -440,6 +440,14 @@ |
3244 | for(int i = 0; i < nprocesses; i++ ) |
3245 | { |
3246 | matrix_element[i] = 0.; |
3247 | + t[i] = 0.; |
3248 | + } |
3249 | + |
3250 | + // Define permutation |
3251 | + int perm[nexternal]; |
3252 | + for(int i = 0; i < nexternal; i++ ) |
3253 | + { |
3254 | + perm[i] = i; |
3255 | } |
3256 | |
3257 | // For now, call setupForME() here |
3258 | @@ -457,8 +465,9 @@ |
3259 | { |
3260 | if (goodhel[ihel] || ntry < 2) |
3261 | { |
3262 | - calculate_wavefunctions(helicities[ihel]); |
3263 | + calculate_wavefunctions(perm, helicities[ihel]); |
3264 | t[0] = matrix_uux_uux(); |
3265 | + |
3266 | double tsum = 0; |
3267 | for(int iproc = 0; iproc < nprocesses; iproc++ ) |
3268 | { |
3269 | @@ -487,8 +496,9 @@ |
3270 | jhel = 0; |
3271 | double hwgt = double(ngood)/double(sum_hel); |
3272 | int ihel = igood[jhel]; |
3273 | - calculate_wavefunctions(helicities[ihel]); |
3274 | + calculate_wavefunctions(perm, helicities[ihel]); |
3275 | t[0] = matrix_uux_uux(); |
3276 | + |
3277 | for(int iproc = 0; iproc < nprocesses; iproc++ ) |
3278 | { |
3279 | matrix_element[iproc] += t[iproc] * hwgt; |
3280 | @@ -534,7 +544,7 @@ |
3281 | if(id1 == 4 && id2 == -4) |
3282 | { |
3283 | // Pick one of the flavor combinations (4, -4) |
3284 | - int flavors[1][2] = {4, -4}; |
3285 | + int flavors[1][2] = {{4, -4}}; |
3286 | vector<double> probs; |
3287 | double sum = matrix_element[0]; |
3288 | probs.push_back(matrix_element[0]/sum); |
3289 | @@ -545,7 +555,7 @@ |
3290 | else if(id1 == 2 && id2 == -2) |
3291 | { |
3292 | // Pick one of the flavor combinations (2, -2) |
3293 | - int flavors[1][2] = {2, -2}; |
3294 | + int flavors[1][2] = {{2, -2}}; |
3295 | vector<double> probs; |
3296 | double sum = matrix_element[0]; |
3297 | probs.push_back(matrix_element[0]/sum); |
3298 | @@ -564,9 +574,10 @@ |
3299 | for(int i = 0; i < ncolor[0]; i++ ) |
3300 | probs.push_back(jamp2[0][i]/sum); |
3301 | int ic = rndmPtr->pick(probs); |
3302 | - static int col[2][8] = {1, 0, 0, 1, 2, 0, 0, 2, 2, 0, 0, 1, 2, 0, 0, 1}; |
3303 | - setColAcol(col[ic][0], col[ic][1], col[ic][2], col[ic][3], col[ic][4], |
3304 | - col[ic][5], col[ic][6], col[ic][7]); |
3305 | + static int colors[2][8] = {{1, 0, 0, 1, 2, 0, 0, 2}, {2, 0, 0, 1, 2, 0, 0, |
3306 | + 1}}; |
3307 | + setColAcol(colors[ic][0], colors[ic][1], colors[ic][2], colors[ic][3], |
3308 | + colors[ic][4], colors[ic][5], colors[ic][6], colors[ic][7]); |
3309 | } |
3310 | } |
3311 | |
3312 | @@ -585,11 +596,12 @@ |
3313 | //-------------------------------------------------------------------------- |
3314 | // Evaluate |M|^2 for each subprocess |
3315 | |
3316 | -void Sigma_sm_qqx_qqx::calculate_wavefunctions(const int hel[]) |
3317 | +void Sigma_sm_qqx_qqx::calculate_wavefunctions(const int perm[], const int |
3318 | + hel[]) |
3319 | { |
3320 | // Calculate wavefunctions for all processes |
3321 | double p[nexternal][4]; |
3322 | - int i, j; |
3323 | + int i; |
3324 | |
3325 | // Convert Pythia 4-vectors to double[] |
3326 | for(i = 0; i < nexternal; i++ ) |
3327 | @@ -601,10 +613,10 @@ |
3328 | } |
3329 | |
3330 | // Calculate all wavefunctions |
3331 | - ixxxxx(p[0], mME[0], hel[0], +1, w[0]); |
3332 | - oxxxxx(p[1], mME[1], hel[1], -1, w[1]); |
3333 | - oxxxxx(p[2], mME[2], hel[2], +1, w[2]); |
3334 | - ixxxxx(p[3], mME[3], hel[3], -1, w[3]); |
3335 | + ixxxxx(p[perm[0]], mME[0], hel[0], +1, w[0]); |
3336 | + oxxxxx(p[perm[1]], mME[1], hel[1], -1, w[1]); |
3337 | + oxxxxx(p[perm[2]], mME[2], hel[2], +1, w[2]); |
3338 | + ixxxxx(p[perm[3]], mME[3], hel[3], -1, w[3]); |
3339 | FFV1_3(w[0], w[1], pars->GC_10, pars->ZERO, pars->ZERO, w[4]); |
3340 | FFV2_3(w[0], w[1], pars->GC_35, pars->MZ, pars->WZ, w[5]); |
3341 | FFV5_3(w[0], w[1], pars->GC_47, pars->MZ, pars->WZ, w[6]); |
3342 | @@ -624,7 +636,7 @@ |
3343 | std::complex<double> amp[ngraphs], jamp[ncolor]; |
3344 | // The color matrix; |
3345 | static const double denom[ncolor] = {1, 1}; |
3346 | - static const double cf[ncolor][ncolor] = {9, 3, 3, 9}; |
3347 | + static const double cf[ncolor][ncolor] = {{9, 3}, {3, 9}}; |
3348 | // Calculate all amplitudes |
3349 | // Amplitude(s) for diagram number 1 |
3350 | FFV1_0(w[3], w[2], w[4], pars->GC_10, amp[0]); |
3351 | @@ -677,13 +689,13 @@ |
3352 | self.assertFileContains('test.cc', goal_string) |
3353 | |
3354 | def test_write_cpp_go_process_cc_file(self): |
3355 | - """Test writing the .cc C++ standalone file for g g > go go""" |
3356 | + """Test writing the .cc C++ standalone file for u u~ > go go""" |
3357 | |
3358 | myleglist = base_objects.LegList() |
3359 | |
3360 | - myleglist.append(base_objects.Leg({'id':21, |
3361 | + myleglist.append(base_objects.Leg({'id':2, |
3362 | 'state':False})) |
3363 | - myleglist.append(base_objects.Leg({'id':21, |
3364 | + myleglist.append(base_objects.Leg({'id':-2, |
3365 | 'state':False})) |
3366 | myleglist.append(base_objects.Leg({'id':1000021, |
3367 | 'state':True})) |
3368 | @@ -696,23 +708,25 @@ |
3369 | myamplitude = diagram_generation.Amplitude({'process': myproc}) |
3370 | |
3371 | matrix_element = helas_objects.HelasMultiProcess(myamplitude) |
3372 | + matrix_element.get('matrix_elements')[0].set('has_mirror_process', |
3373 | + True) |
3374 | |
3375 | goal_string = \ |
3376 | """//========================================================================== |
3377 | -// This file has been automatically generated for Pythia 8 by |
3378 | -// by MadGraph 5 v. %(version)s, %(date)s |
3379 | +// This file has been automatically generated for C++ Standalone by |
3380 | +// MadGraph 5 v. %(version)s, %(date)s |
3381 | // By the MadGraph Development Team |
3382 | // Please visit us at https://launchpad.net/madgraph5 |
3383 | //========================================================================== |
3384 | |
3385 | #include "CPPProcess.h" |
3386 | -#include "hel_amps_sm.h" |
3387 | +#include "HelAmps_sm.h" |
3388 | |
3389 | using namespace MG5_sm; |
3390 | |
3391 | //========================================================================== |
3392 | // Class member functions for calculating the matrix elements for |
3393 | -// Process: g g > go go |
3394 | +// Process: u u~ > go go |
3395 | |
3396 | //-------------------------------------------------------------------------- |
3397 | // Initialize process. |
3398 | @@ -731,7 +745,7 @@ |
3399 | mME.push_back(pars->ZERO); |
3400 | mME.push_back(pars->MGO); |
3401 | mME.push_back(pars->MGO); |
3402 | - jamp2[0] = new double[6]; |
3403 | + jamp2[0] = new double[2]; |
3404 | } |
3405 | |
3406 | //-------------------------------------------------------------------------- |
3407 | @@ -751,7 +765,7 @@ |
3408 | } |
3409 | |
3410 | // Reset color flows |
3411 | - for(int i = 0; i < 6; i++ ) |
3412 | + for(int i = 0; i < 2; i++ ) |
3413 | jamp2[0][i] = 0.; |
3414 | |
3415 | // Local variables and constants |
3416 | @@ -763,12 +777,13 @@ |
3417 | std::complex<double> * * wfs; |
3418 | double t[nprocesses]; |
3419 | // Helicities for the process |
3420 | - static const int helicities[ncomb][nexternal] = {-1, -1, -1, -1, -1, -1, -1, |
3421 | - 1, -1, -1, 1, -1, -1, -1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1, -1, 1, 1, |
3422 | - -1, -1, 1, 1, 1, 1, -1, -1, -1, 1, -1, -1, 1, 1, -1, 1, -1, 1, -1, 1, 1, |
3423 | - 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, -1, 1, 1, 1, 1}; |
3424 | + static const int helicities[ncomb][nexternal] = {{-1, -1, -1, -1}, {-1, -1, |
3425 | + -1, 1}, {-1, -1, 1, -1}, {-1, -1, 1, 1}, {-1, 1, -1, -1}, {-1, 1, -1, 1}, |
3426 | + {-1, 1, 1, -1}, {-1, 1, 1, 1}, {1, -1, -1, -1}, {1, -1, -1, 1}, {1, -1, |
3427 | + 1, -1}, {1, -1, 1, 1}, {1, 1, -1, -1}, {1, 1, -1, 1}, {1, 1, 1, -1}, {1, |
3428 | + 1, 1, 1}}; |
3429 | // Denominators: spins, colors and identical particles |
3430 | - const int denominators[nprocesses] = {512}; |
3431 | + const int denominators[nprocesses] = {72, 72}; |
3432 | |
3433 | ntry = ntry + 1; |
3434 | |
3435 | @@ -777,6 +792,12 @@ |
3436 | { |
3437 | matrix_element[i] = 0.; |
3438 | } |
3439 | + // Define permutation |
3440 | + int perm[nexternal]; |
3441 | + for(int i = 0; i < nexternal; i++ ) |
3442 | + { |
3443 | + perm[i] = i; |
3444 | + } |
3445 | |
3446 | if (sum_hel == 0 || ntry < 10) |
3447 | { |
3448 | @@ -785,8 +806,18 @@ |
3449 | { |
3450 | if (goodhel[ihel] || ntry < 2) |
3451 | { |
3452 | - calculate_wavefunctions(helicities[ihel]); |
3453 | - t[0] = matrix_gg_gogo(); |
3454 | + calculate_wavefunctions(perm, helicities[ihel]); |
3455 | + t[0] = matrix_uux_gogo(); |
3456 | + // Mirror initial state momenta for mirror process |
3457 | + perm[0] = 1; |
3458 | + perm[1] = 0; |
3459 | + // Calculate wavefunctions |
3460 | + calculate_wavefunctions(perm, helicities[ihel]); |
3461 | + // Mirror back |
3462 | + perm[0] = 0; |
3463 | + perm[1] = 1; |
3464 | + // Calculate matrix elements |
3465 | + t[1] = matrix_uux_gogo(); |
3466 | double tsum = 0; |
3467 | for(int iproc = 0; iproc < nprocesses; iproc++ ) |
3468 | { |
3469 | @@ -815,8 +846,18 @@ |
3470 | jhel = 0; |
3471 | double hwgt = double(ngood)/double(sum_hel); |
3472 | int ihel = igood[jhel]; |
3473 | - calculate_wavefunctions(helicities[ihel]); |
3474 | - t[0] = matrix_gg_gogo(); |
3475 | + calculate_wavefunctions(perm, helicities[ihel]); |
3476 | + t[0] = matrix_uux_gogo(); |
3477 | + // Mirror initial state momenta for mirror process |
3478 | + perm[0] = 1; |
3479 | + perm[1] = 0; |
3480 | + // Calculate wavefunctions |
3481 | + calculate_wavefunctions(perm, helicities[ihel]); |
3482 | + // Mirror back |
3483 | + perm[0] = 0; |
3484 | + perm[1] = 1; |
3485 | + // Calculate matrix elements |
3486 | + t[1] = matrix_uux_gogo(); |
3487 | for(int iproc = 0; iproc < nprocesses; iproc++ ) |
3488 | { |
3489 | matrix_element[iproc] += t[iproc] * hwgt; |
3490 | @@ -837,11 +878,16 @@ |
3491 | double CPPProcess::sigmaHat() |
3492 | { |
3493 | // Select between the different processes |
3494 | - if(id1 == 21 && id2 == 21) |
3495 | + if(id1 == 2 && id2 == -2) |
3496 | { |
3497 | - // Add matrix elements for processes with beams (21, 21) |
3498 | + // Add matrix elements for processes with beams (2, -2) |
3499 | return matrix_element[0]; |
3500 | } |
3501 | + else if(id1 == -2 && id2 == 2) |
3502 | + { |
3503 | + // Add matrix elements for processes with beams (-2, 2) |
3504 | + return matrix_element[1]; |
3505 | + } |
3506 | else |
3507 | { |
3508 | // Return 0 if not correct initial state assignment |
3509 | @@ -855,47 +901,38 @@ |
3510 | //-------------------------------------------------------------------------- |
3511 | // Evaluate |M|^2 for each subprocess |
3512 | |
3513 | -void CPPProcess::calculate_wavefunctions(const int hel[]) |
3514 | +void CPPProcess::calculate_wavefunctions(const int perm[], const int hel[]) |
3515 | { |
3516 | // Calculate wavefunctions for all processes |
3517 | int i, j; |
3518 | |
3519 | // Calculate all wavefunctions |
3520 | - vxxxxx(p[0], mME[0], hel[0], -1, w[0]); |
3521 | - vxxxxx(p[1], mME[1], hel[1], -1, w[1]); |
3522 | - oxxxxx(p[2], mME[2], hel[2], +1, w[2]); |
3523 | - ixxxxx(p[3], mME[3], hel[3], -1, w[3]); |
3524 | - FFV1_1(w[2], w[0], pars->GC_8, pars->MGO, pars->WGO, w[4]); |
3525 | - FFV1_2(w[3], w[0], -pars->GC_8, pars->MGO, pars->WGO, w[5]); |
3526 | + ixxxxx(p[perm[0]], mME[0], hel[0], +1, w[0]); |
3527 | + oxxxxx(p[perm[1]], mME[1], hel[1], -1, w[1]); |
3528 | + ixxxxx(p[perm[2]], mME[2], hel[2], -1, w[2]); |
3529 | + oxxxxx(p[perm[3]], mME[3], hel[3], +1, w[3]); |
3530 | + FFV1_3(w[0], w[1], pars->GC_10, pars->ZERO, pars->ZERO, w[4]); |
3531 | |
3532 | |
3533 | } |
3534 | -double CPPProcess::matrix_gg_gogo() |
3535 | +double CPPProcess::matrix_uux_gogo() |
3536 | { |
3537 | int i, j; |
3538 | // Local variables |
3539 | - const int ngraphs = 2; |
3540 | - const int ncolor = 6; |
3541 | + const int ngraphs = 1; |
3542 | + const int ncolor = 2; |
3543 | std::complex<double> ztemp; |
3544 | std::complex<double> amp[ngraphs], jamp[ncolor]; |
3545 | // The color matrix; |
3546 | - static const double denom[ncolor] = {6, 6, 6, 6, 6, 6}; |
3547 | - static const double cf[ncolor][ncolor] = {19, -2, -2, -2, -2, 4, -2, 19, -2, |
3548 | - 4, -2, -2, -2, -2, 19, -2, 4, -2, -2, 4, -2, 19, -2, -2, -2, -2, 4, -2, |
3549 | - 19, -2, 4, -2, -2, -2, -2, 19}; |
3550 | + static const double denom[ncolor] = {3, 3}; |
3551 | + static const double cf[ncolor][ncolor] = {{16, -2}, {-2, 16}}; |
3552 | // Calculate all amplitudes |
3553 | // Amplitude(s) for diagram number 1 |
3554 | - FFV1_0(w[3], w[4], w[1], pars->GC_8, amp[0]); |
3555 | - // Amplitude(s) for diagram number 2 |
3556 | - FFV1_0(w[5], w[2], w[1], pars->GC_8, amp[1]); |
3557 | + FFV1_0(w[2], w[3], w[4], pars->GC_8, amp[0]); |
3558 | |
3559 | // Calculate color flows |
3560 | - jamp[0] = +2. * (-amp[1]); |
3561 | - jamp[1] = +2. * (+amp[0]); |
3562 | - jamp[2] = +2. * (-amp[0] + amp[1]); |
3563 | - jamp[3] = +2. * (+amp[0]); |
3564 | - jamp[4] = +2. * (-amp[0] + amp[1]); |
3565 | - jamp[5] = +2. * (-amp[1]); |
3566 | + jamp[0] = -std::complex<double> (0, 1) * amp[0]; |
3567 | + jamp[1] = +std::complex<double> (0, 1) * amp[0]; |
3568 | |
3569 | // Sum and square the color flows to get the matrix element |
3570 | double matrix = 0; |
3571 | @@ -939,6 +976,104 @@ |
3572 | print "cd /tmp; g++ -c -I $PATH_TO_PYTHIA8/include Sigma_sm_qqx_qqx.cc.cc" |
3573 | |
3574 | |
3575 | + def test_write_process_h_file(self): |
3576 | + """Test writing the .h Pythia file for a matrix element""" |
3577 | + |
3578 | + goal_string = \ |
3579 | +"""//========================================================================== |
3580 | +// This file has been automatically generated for Pythia 8 |
3581 | +// MadGraph 5 v. %(version)s, %(date)s |
3582 | +// By the MadGraph Development Team |
3583 | +// Please visit us at https://launchpad.net/madgraph5 |
3584 | +//========================================================================== |
3585 | + |
3586 | +#ifndef Pythia8_Sigma_sm_qqx_qqx_H |
3587 | +#define Pythia8_Sigma_sm_qqx_qqx_H |
3588 | + |
3589 | +#include <complex> |
3590 | + |
3591 | +#include "SigmaProcess.h" |
3592 | +#include "Parameters_sm.h" |
3593 | + |
3594 | +using namespace std; |
3595 | + |
3596 | +namespace Pythia8 |
3597 | +{ |
3598 | +//========================================================================== |
3599 | +// A class for calculating the matrix elements for |
3600 | +// Process: u u~ > u u~ |
3601 | +// Process: c c~ > c c~ |
3602 | +//-------------------------------------------------------------------------- |
3603 | + |
3604 | +class Sigma_sm_qqx_qqx : public Sigma2Process |
3605 | +{ |
3606 | + public: |
3607 | + |
3608 | + // Constructor. |
3609 | + Sigma_sm_qqx_qqx() {} |
3610 | + |
3611 | + // Initialize process. |
3612 | + virtual void initProc(); |
3613 | + |
3614 | + // Calculate flavour-independent parts of cross section. |
3615 | + virtual void sigmaKin(); |
3616 | + |
3617 | + // Evaluate sigmaHat(sHat). |
3618 | + virtual double sigmaHat(); |
3619 | + |
3620 | + // Select flavour, colour and anticolour. |
3621 | + virtual void setIdColAcol(); |
3622 | + |
3623 | + // Evaluate weight for decay angles. |
3624 | + virtual double weightDecay(Event& process, int iResBeg, int iResEnd); |
3625 | + |
3626 | + // Info on the subprocess. |
3627 | + virtual string name() const {return "q q~ > q q~ (sm)";} |
3628 | + |
3629 | + virtual int code() const {return 10000;} |
3630 | + |
3631 | + virtual string inFlux() const {return "qqbarSame";} |
3632 | + |
3633 | + virtual int resonanceA() const {return 23;} |
3634 | + // Tell Pythia that sigmaHat returns the ME^2 |
3635 | + virtual bool convertM2() const {return true;} |
3636 | + |
3637 | + private: |
3638 | + |
3639 | + // Private functions to calculate the matrix element for all subprocesses |
3640 | + // Calculate wavefunctions |
3641 | + void calculate_wavefunctions(const int perm[], const int hel[]); |
3642 | + static const int nwavefuncs = 10; |
3643 | + std::complex<double> w[nwavefuncs][18]; |
3644 | + double matrix_uux_uux(); |
3645 | + |
3646 | + // Constants for array limits |
3647 | + static const int nexternal = 4; |
3648 | + static const int nprocesses = 1; |
3649 | + |
3650 | + // Store the matrix element value from sigmaKin |
3651 | + double matrix_element[nprocesses]; |
3652 | + |
3653 | + // Color flows, used when selecting color |
3654 | + double * jamp2[nprocesses]; |
3655 | + |
3656 | + // Pointer to the model parameters |
3657 | + Parameters_sm * pars; |
3658 | + |
3659 | +}; |
3660 | + |
3661 | +} // end namespace Pythia |
3662 | + |
3663 | +#endif // Pythia8_Sigma_sm_qqx_qqx_H |
3664 | +""" % misc.get_pkg_info() |
3665 | + |
3666 | + self.pythia8_exporter.write_process_h_file(\ |
3667 | + writers.CPPWriter(self.give_pos('test.h'))) |
3668 | + |
3669 | + #print open(self.give_pos('test.h')).read() |
3670 | + |
3671 | + self.assertFileContains('test.h', goal_string) |
3672 | + |
3673 | #=============================================================================== |
3674 | # ExportUFOModelPythia8Test |
3675 | #=============================================================================== |
3676 | @@ -948,7 +1083,7 @@ |
3677 | created_files = [ |
3678 | ] |
3679 | |
3680 | - def disabled_setUp(self): |
3681 | + def setUp(self): |
3682 | |
3683 | model_pkl = os.path.join(MG5DIR, 'models','sm','model.pkl') |
3684 | if os.path.isfile(model_pkl): |
3685 | @@ -957,156 +1092,564 @@ |
3686 | sm_path = import_ufo.find_ufo_path('sm') |
3687 | self.model = import_ufo.import_model(sm_path) |
3688 | self.model_builder = export_cpp.UFOModelConverterPythia8(\ |
3689 | - self.model, "/tmp") |
3690 | - |
3691 | - test_file_writers.CheckFileCreate.clean_files |
3692 | - |
3693 | - tearDown = test_file_writers.CheckFileCreate.clean_files |
3694 | - |
3695 | - def disabled_test_read_aloha_template_files(self): |
3696 | - """Test reading the ALOHA template .h and .cc files""" |
3697 | - |
3698 | - template_h = self.model_builder.read_aloha_template_files("h") |
3699 | - self.assertTrue(template_h) |
3700 | - for file_lines in template_h: |
3701 | - self.assertFalse(file_lines.find('#include') > -1) |
3702 | - self.assertFalse(file_lines.find('namespace') > -1) |
3703 | - template_cc = self.model_builder.read_aloha_template_files("cc") |
3704 | - self.assertTrue(template_cc) |
3705 | - for file_lines in template_cc: |
3706 | - self.assertFalse(file_lines.find('#include') > -1) |
3707 | - self.assertFalse(file_lines.find('namespace') > -1) |
3708 | - |
3709 | - def disabled_test_write_aloha_functions(self): |
3710 | - """Test writing function declarations and definitions""" |
3711 | - |
3712 | - template_h_files = [] |
3713 | - template_cc_files = [] |
3714 | - |
3715 | - aloha_model = create_aloha.AbstractALOHAModel(\ |
3716 | - self.model_builder.model.get('name')) |
3717 | - aloha_model.compute_all(save=False) |
3718 | - for abstracthelas in dict(aloha_model).values(): |
3719 | - abstracthelas.write('/tmp', 'CPP') |
3720 | - #abstracthelas.write('/tmp', 'Fortran') |
3721 | - |
3722 | - print "Please try compiling the files /tmp/*.cc and /tmp/*.f:" |
3723 | - print "cd /tmp; g++ -c *.cc; gfortran -c *.f" |
3724 | - |
3725 | - |
3726 | - def disabled_test_write_aloha_routines(self): |
3727 | - """Test writing the aloha .h and.cc files""" |
3728 | - |
3729 | - self.model_builder.write_aloha_routines() |
3730 | - print "Please try compiling the file /tmp/hel_amps_sm.cc:" |
3731 | - print "cd /tmp; g++ -c hel_amps_sm.cc" |
3732 | - |
3733 | - def disabled_test_couplings_and_parameters(self): |
3734 | - """Test generation of couplings and parameters""" |
3735 | - |
3736 | - self.assertTrue(self.model_builder.params_indep) |
3737 | - self.assertTrue(self.model_builder.params_dep) |
3738 | - self.assertTrue(self.model_builder.coups_indep) |
3739 | - self.assertTrue(self.model_builder.coups_dep) |
3740 | - |
3741 | - g_expr = re.compile("G(?!f)") |
3742 | - |
3743 | - for indep_par in self.model_builder.params_indep: |
3744 | - self.assertFalse(g_expr.search(indep_par.expr)) |
3745 | - for indep_coup in self.model_builder.coups_indep: |
3746 | - self.assertFalse(g_expr.search(indep_coup.expr)) |
3747 | - |
3748 | - def disabled_test_write_parameter_files(self): |
3749 | - """Test writing the model parameter .h and.cc files""" |
3750 | - |
3751 | - self.model_builder.write_parameter_class_files() |
3752 | - |
3753 | - print "Please try compiling the file /tmp/Parameters_sm.cc:" |
3754 | - print "cd /tmp; g++ -c -I $PATH_TO_PYTHIA8/include Parameters_sm.cc" |
3755 | - |
3756 | - |
3757 | -#=============================================================================== |
3758 | -# ExportUFOModelCPPTest |
3759 | -#=============================================================================== |
3760 | -class ExportUFOModelCPPTest(unittest.TestCase, |
3761 | - test_file_writers.CheckFileCreate): |
3762 | - |
3763 | - created_files = [ |
3764 | - ] |
3765 | - |
3766 | - def setUp(self): |
3767 | - |
3768 | - model_pkl = os.path.join(MG5DIR, 'models','sm','model.pkl') |
3769 | - if os.path.isfile(model_pkl): |
3770 | - self.model = save_load_object.load_from_file(model_pkl) |
3771 | - else: |
3772 | - sm_path = import_ufo.find_ufo_path('sm') |
3773 | - self.model = import_ufo.import_model(sm_path) |
3774 | - self.model_builder = export_cpp.UFOModelConverterCPP(\ |
3775 | - self.model, "/tmp") |
3776 | - |
3777 | - test_file_writers.CheckFileCreate.clean_files |
3778 | - |
3779 | - tearDown = test_file_writers.CheckFileCreate.clean_files |
3780 | - |
3781 | - def disabled_test_read_aloha_template_files(self): |
3782 | - """Test reading the ALOHA template .h and .cc files""" |
3783 | - |
3784 | - template_h = self.model_builder.read_aloha_template_files("h") |
3785 | - self.assertTrue(template_h) |
3786 | - for file_lines in template_h: |
3787 | - self.assertFalse(file_lines.find('#include') > -1) |
3788 | - self.assertFalse(file_lines.find('namespace') > -1) |
3789 | - template_cc = self.model_builder.read_aloha_template_files("cc") |
3790 | - self.assertTrue(template_cc) |
3791 | - for file_lines in template_cc: |
3792 | - self.assertFalse(file_lines.find('#include') > -1) |
3793 | - self.assertFalse(file_lines.find('namespace') > -1) |
3794 | - |
3795 | - def disabled_test_write_aloha_functions(self): |
3796 | - """Test writing function declarations and definitions""" |
3797 | - |
3798 | - template_h_files = [] |
3799 | - template_cc_files = [] |
3800 | - |
3801 | - aloha_model = create_aloha.AbstractALOHAModel(\ |
3802 | - self.model_builder.model.get('name')) |
3803 | - aloha_model.compute_all(save=False) |
3804 | - for abstracthelas in dict(aloha_model).values(): |
3805 | - abstracthelas.write('/tmp', 'CPP') |
3806 | - #abstracthelas.write('/tmp', 'Fortran') |
3807 | - |
3808 | - print "Please try compiling the files /tmp/*.cc and /tmp/*.f:" |
3809 | - print "cd /tmp; g++ -c *.cc; gfortran -c *.f" |
3810 | - |
3811 | - |
3812 | - def disabled_test_write_aloha_routines(self): |
3813 | - """Test writing the aloha .h and.cc files""" |
3814 | - |
3815 | - self.model_builder.write_aloha_routines() |
3816 | - print "Please try compiling the file /tmp/hel_amps_sm.cc:" |
3817 | - print "cd /tmp; g++ -c hel_amps_sm.cc" |
3818 | - |
3819 | - def disabled_test_couplings_and_parameters(self): |
3820 | - """Test generation of couplings and parameters""" |
3821 | - |
3822 | - self.assertTrue(self.model_builder.params_indep) |
3823 | - self.assertTrue(self.model_builder.params_dep) |
3824 | - self.assertTrue(self.model_builder.coups_indep) |
3825 | - self.assertTrue(self.model_builder.coups_dep) |
3826 | - |
3827 | - g_expr = re.compile("G(?!f)") |
3828 | - |
3829 | - for indep_par in self.model_builder.params_indep: |
3830 | - self.assertFalse(g_expr.search(indep_par.expr)) |
3831 | - for indep_coup in self.model_builder.coups_indep: |
3832 | - self.assertFalse(g_expr.search(indep_coup.expr)) |
3833 | - |
3834 | - def disabled_test_write_parameter_files(self): |
3835 | - """Test writing the model parameter .h and.cc files""" |
3836 | - |
3837 | - self.model_builder.write_parameter_class_files() |
3838 | - |
3839 | - print "Please try compiling the file /tmp/Parameters_sm.cc:" |
3840 | - print "cd /tmp; g++ -c Parameters_sm.cc" |
3841 | + self.model, "/tmp") |
3842 | + |
3843 | + test_file_writers.CheckFileCreate.clean_files |
3844 | + |
3845 | + tearDown = test_file_writers.CheckFileCreate.clean_files |
3846 | + |
3847 | + def test_write_pythia8_parameter_files(self): |
3848 | + """Test writing the Pythia model parameter files""" |
3849 | + |
3850 | + goal_file_h = \ |
3851 | +"""//========================================================================== |
3852 | +// This file has been automatically generated for Pythia 8 |
3853 | +# MadGraph 5 v. %(version)s, %(date)s |
3854 | +# By the MadGraph Development Team |
3855 | +# Please visit us at https://launchpad.net/madgraph5 |
3856 | +//========================================================================== |
3857 | + |
3858 | +#ifndef Pythia8_parameters_sm_H |
3859 | +#define Pythia8_parameters_sm_H |
3860 | + |
3861 | +#include <complex> |
3862 | + |
3863 | +#include "ParticleData.h" |
3864 | +#include "StandardModel.h" |
3865 | +#include "SusyLesHouches.h" |
3866 | + |
3867 | +using namespace std; |
3868 | + |
3869 | +namespace Pythia8 { |
3870 | + |
3871 | +class Parameters_sm |
3872 | +{ |
3873 | +public: |
3874 | + |
3875 | +static Parameters_sm* getInstance(); |
3876 | + |
3877 | +// Model parameters independent of aS |
3878 | +double WH,WW,WZ,WT,MH,MZ,MB,MS,MD,MT,MC,MU,MTA,MM,Me,ymtau,ymt,ymb,ymc,Gf,aEWM1,cabi,ZERO,ye,ym,yup,ydo,ys,cos__cabi,sin__cabi,MZ__exp__2,MZ__exp__4,sqrt__2,MH__exp__2,aEW,MW,sqrt__aEW,ee,MW__exp__2,sw2,cw,sqrt__sw2,sw,g1,gw,v,v__exp__2,lam,yb,yc,yt,ytau,muH,ee__exp__2,gw__exp__2,cw__exp__2,sw__exp__2; |
3879 | +std::complex<double> CKM11,CKM12,CKM13,CKM21,CKM22,CKM23,CKM31,CKM32,CKM33,complexi,conjg__CKM11,conjg__CKM12,conjg__CKM13,conjg__CKM21,conjg__CKM22,conjg__CKM23,conjg__CKM31,conjg__CKM32,conjg__CKM33; |
3880 | +// Model parameters dependent on aS |
3881 | +double aS,sqrt__aS,G,G__exp__2; |
3882 | +// Model couplings independent of aS |
3883 | +std::complex<double> GC_1,GC_2,GC_3,GC_4,GC_5,GC_6,GC_7,GC_8,GC_12,GC_13,GC_14,GC_15,GC_16,GC_17,GC_18,GC_19,GC_20,GC_21,GC_22,GC_23,GC_24,GC_25,GC_26,GC_27,GC_28,GC_29,GC_30,GC_31,GC_32,GC_33,GC_34,GC_35,GC_36,GC_37,GC_38,GC_39,GC_40,GC_41,GC_42,GC_43,GC_44,GC_45,GC_46,GC_47,GC_48,GC_49,GC_50,GC_51,GC_52,GC_53,GC_54,GC_55,GC_56,GC_57,GC_58,GC_59,GC_60,GC_61,GC_62,GC_63,GC_64,GC_65,GC_66,GC_67,GC_68,GC_69,GC_70,GC_71,GC_72,GC_73,GC_74,GC_75,GC_76,GC_77,GC_96,GC_97,GC_98,GC_99,GC_100,GC_101,GC_102,GC_103,GC_104,GC_110,GC_113,GC_116,GC_117,GC_119,GC_120,GC_122,GC_123,GC_125,GC_126,GC_127,GC_128,GC_130,GC_131,GC_133,GC_134,GC_135,GC_136,GC_78,GC_79,GC_80,GC_81,GC_82,GC_83,GC_84,GC_85,GC_86,GC_87,GC_88,GC_89,GC_90,GC_91,GC_92,GC_93,GC_94,GC_95,GC_105,GC_106,GC_107,GC_108,GC_109,GC_111,GC_112,GC_114,GC_115,GC_118,GC_121,GC_124,GC_129,GC_132; |
3884 | +// Model couplings dependent on aS |
3885 | +std::complex<double> GC_9,GC_11,GC_10; |
3886 | + |
3887 | +// Set parameters that are unchanged during the run |
3888 | +void setIndependentParameters(ParticleData*& pd, Couplings*& csm, SusyLesHouches*& slhaPtr); |
3889 | +// Set couplings that are unchanged during the run |
3890 | +void setIndependentCouplings(); |
3891 | +// Set parameters that are changed event by event |
3892 | +void setDependentParameters(ParticleData*& pd, Couplings*& csm, SusyLesHouches*& slhaPtr, double alpS); |
3893 | +// Set couplings that are changed event by event |
3894 | +void setDependentCouplings(); |
3895 | + |
3896 | +// Print parameters that are unchanged during the run |
3897 | +void printIndependentParameters(); |
3898 | +// Print couplings that are unchanged during the run |
3899 | +void printIndependentCouplings(); |
3900 | +// Print parameters that are changed event by event |
3901 | +void printDependentParameters(); |
3902 | +// Print couplings that are changed event by event |
3903 | +void printDependentCouplings(); |
3904 | + |
3905 | + |
3906 | + private: |
3907 | +static Parameters_sm* instance; |
3908 | +}; |
3909 | + |
3910 | +} // end namespace Pythia8 |
3911 | +#endif // Pythia8_parameters_sm_H |
3912 | +""" % misc.get_pkg_info() |
3913 | + |
3914 | + goal_file_cc = \ |
3915 | +"""//========================================================================== |
3916 | +// This file has been automatically generated for Pythia 8 by |
3917 | +# MadGraph 5 v. %(version)s, %(date)s |
3918 | +# By the MadGraph Development Team |
3919 | +# Please visit us at https://launchpad.net/madgraph5 |
3920 | +//========================================================================== |
3921 | + |
3922 | +#include <iostream> |
3923 | +#include "Parameters_sm.h" |
3924 | +#include "PythiaStdlib.h" |
3925 | + |
3926 | +namespace Pythia8 { |
3927 | + |
3928 | + // Initialize static instance |
3929 | + Parameters_sm* Parameters_sm::instance = 0; |
3930 | + |
3931 | + // Function to get static instance - only one instance per program |
3932 | + Parameters_sm* Parameters_sm::getInstance(){ |
3933 | + if (instance == 0) |
3934 | + instance = new Parameters_sm(); |
3935 | + |
3936 | + return instance; |
3937 | + } |
3938 | + |
3939 | + void Parameters_sm::setIndependentParameters(ParticleData*& pd, Couplings*& csm, SusyLesHouches*& slhaPtr){ |
3940 | + WH=pd->mWidth(25); |
3941 | +WW=pd->mWidth(24); |
3942 | +WZ=pd->mWidth(23); |
3943 | +WT=pd->mWidth(6); |
3944 | +MH=pd->m0(25); |
3945 | +MZ=pd->m0(23); |
3946 | +MB=pd->m0(5); |
3947 | +MS=pd->m0(3); |
3948 | +MD=pd->m0(1); |
3949 | +MT=pd->m0(6); |
3950 | +MC=pd->m0(4); |
3951 | +MU=pd->m0(2); |
3952 | +MTA=pd->m0(15); |
3953 | +MM=pd->m0(13); |
3954 | +Me=pd->m0(11); |
3955 | +ymtau=pd->mRun(15, pd->m0(24)); |
3956 | +ymt=pd->mRun(6, pd->m0(24)); |
3957 | +ymb=pd->mRun(5, pd->m0(24)); |
3958 | +ymc=pd->mRun(4, pd->m0(24)); |
3959 | +Gf = M_PI*csm->alphaEM(pow(pd->m0(23),2))*pow(pd->m0(23),2)/(sqrt(2.)*pow(pd->m0(24),2)*(pow(pd->m0(23),2)-pow(pd->m0(24),2))); |
3960 | +aEWM1 = 1./csm->alphaEM(pow(pd->m0(23),2)); |
3961 | +cabi = csm->VCKMgen(1,2); |
3962 | +ZERO = 0.; |
3963 | +ye = 0.; |
3964 | +ym = 0.; |
3965 | +yup = 0.; |
3966 | +ydo = 0.; |
3967 | +ys = 0.; |
3968 | +cos__cabi = cos(cabi); |
3969 | +CKM11 = cos__cabi; |
3970 | +sin__cabi = sin(cabi); |
3971 | +CKM12 = sin__cabi; |
3972 | +CKM13 = 0.; |
3973 | +CKM21 = -sin__cabi; |
3974 | +CKM22 = cos__cabi; |
3975 | +CKM23 = 0.; |
3976 | +CKM31 = 0.; |
3977 | +CKM32 = 0.; |
3978 | +CKM33 = 1.; |
3979 | +MZ__exp__2 = pow(MZ,2.); |
3980 | +MZ__exp__4 = pow(MZ,4.); |
3981 | +sqrt__2 = sqrt(2.); |
3982 | +MH__exp__2 = pow(MH,2.); |
3983 | +complexi = std::complex<double>(0.,1.); |
3984 | +conjg__CKM11 = conj(CKM11); |
3985 | +conjg__CKM12 = conj(CKM12); |
3986 | +conjg__CKM13 = conj(CKM13); |
3987 | +conjg__CKM21 = conj(CKM21); |
3988 | +conjg__CKM22 = conj(CKM22); |
3989 | +conjg__CKM23 = conj(CKM23); |
3990 | +conjg__CKM31 = conj(CKM31); |
3991 | +conjg__CKM32 = conj(CKM32); |
3992 | +conjg__CKM33 = conj(CKM33); |
3993 | +aEW = 1./aEWM1; |
3994 | +MW = sqrt(MZ__exp__2/2.+sqrt(MZ__exp__4/4.-(aEW*M_PI*MZ__exp__2)/(Gf*sqrt__2))); |
3995 | +sqrt__aEW = sqrt(aEW); |
3996 | +ee = 2.*sqrt__aEW*sqrt(M_PI); |
3997 | +MW__exp__2 = pow(MW,2.); |
3998 | +sw2 = 1.-MW__exp__2/MZ__exp__2; |
3999 | +cw = sqrt(1.-sw2); |
4000 | +sqrt__sw2 = sqrt(sw2); |
4001 | +sw = sqrt__sw2; |
4002 | +g1 = ee/cw; |
4003 | +gw = ee/sw; |
4004 | +v = (2.*MW*sw)/ee; |
4005 | +v__exp__2 = pow(v,2.); |
4006 | +lam = MH__exp__2/(2.*v__exp__2); |
4007 | +yb = (ymb*sqrt__2)/v; |
4008 | +yc = (ymc*sqrt__2)/v; |
4009 | +yt = (ymt*sqrt__2)/v; |
4010 | +ytau = (ymtau*sqrt__2)/v; |
4011 | +muH = sqrt(lam*v__exp__2); |
4012 | +ee__exp__2 = pow(ee,2.); |
4013 | +gw__exp__2 = pow(gw,2.); |
4014 | +cw__exp__2 = pow(cw,2.); |
4015 | +sw__exp__2 = pow(sw,2.); |
4016 | + } |
4017 | + void Parameters_sm::setIndependentCouplings(){ |
4018 | + GC_1 = -(ee*complexi)/3.; |
4019 | +GC_2 = (2.*ee*complexi)/3.; |
4020 | +GC_3 = -(ee*complexi); |
4021 | +GC_4 = ee*complexi; |
4022 | +GC_5 = 2.*ee__exp__2*complexi; |
4023 | +GC_6 = -ee__exp__2/(2.*cw); |
4024 | +GC_7 = (ee__exp__2*complexi)/(2.*cw); |
4025 | +GC_8 = ee__exp__2/(2.*cw); |
4026 | +GC_12 = cw*complexi*gw; |
4027 | +GC_13 = -(complexi*gw__exp__2); |
4028 | +GC_14 = cw__exp__2*complexi*gw__exp__2; |
4029 | +GC_15 = -2.*complexi*lam; |
4030 | +GC_16 = -4.*complexi*lam; |
4031 | +GC_17 = -6.*complexi*lam; |
4032 | +GC_18 = -(ee*MW); |
4033 | +GC_19 = ee*MW; |
4034 | +GC_20 = (ee__exp__2*complexi)/(2.*sw__exp__2); |
4035 | +GC_21 = -(ee*complexi)/(2.*sw); |
4036 | +GC_22 = (ee*complexi)/(2.*sw); |
4037 | +GC_23 = ee/(2.*sw); |
4038 | +GC_24 = (ee*complexi)/(sw*sqrt__2); |
4039 | +GC_25 = (CKM11*ee*complexi)/(sw*sqrt__2); |
4040 | +GC_26 = (CKM12*ee*complexi)/(sw*sqrt__2); |
4041 | +GC_27 = (CKM13*ee*complexi)/(sw*sqrt__2); |
4042 | +GC_28 = (CKM21*ee*complexi)/(sw*sqrt__2); |
4043 | +GC_29 = (CKM22*ee*complexi)/(sw*sqrt__2); |
4044 | +GC_30 = (CKM23*ee*complexi)/(sw*sqrt__2); |
4045 | +GC_31 = (CKM31*ee*complexi)/(sw*sqrt__2); |
4046 | +GC_32 = (CKM32*ee*complexi)/(sw*sqrt__2); |
4047 | +GC_33 = (CKM33*ee*complexi)/(sw*sqrt__2); |
4048 | +GC_34 = -(cw*ee*complexi)/(2.*sw); |
4049 | +GC_35 = (cw*ee*complexi)/(2.*sw); |
4050 | +GC_36 = -((cw*ee*complexi)/sw); |
4051 | +GC_37 = (cw*ee*complexi)/sw; |
4052 | +GC_38 = -ee__exp__2/(2.*sw); |
4053 | +GC_39 = -(ee__exp__2*complexi)/(2.*sw); |
4054 | +GC_40 = ee__exp__2/(2.*sw); |
4055 | +GC_41 = -(ee*MW)/(2.*sw); |
4056 | +GC_42 = -(ee*complexi*MW)/(2.*sw); |
4057 | +GC_43 = (ee*MW)/(2.*sw); |
4058 | +GC_44 = -(ee*MZ)/(2.*sw); |
4059 | +GC_45 = (ee*MZ)/(2.*sw); |
4060 | +GC_46 = -(ee*complexi*MZ)/(2.*cw*sw); |
4061 | +GC_47 = -(ee*complexi*sw)/(6.*cw); |
4062 | +GC_48 = (ee*complexi*sw)/(2.*cw); |
4063 | +GC_49 = complexi*gw*sw; |
4064 | +GC_50 = -2.*cw*complexi*gw__exp__2*sw; |
4065 | +GC_51 = complexi*gw__exp__2*sw__exp__2; |
4066 | +GC_52 = -(cw*ee*complexi)/(2.*sw)+(ee*complexi*sw)/(2.*cw); |
4067 | +GC_53 = (cw*ee*complexi)/(2.*sw)+(ee*complexi*sw)/(2.*cw); |
4068 | +GC_54 = (cw*ee)/(2.*sw)+(ee*sw)/(2.*cw); |
4069 | +GC_55 = (cw*ee__exp__2*complexi)/sw-(ee__exp__2*complexi*sw)/cw; |
4070 | +GC_56 = (cw*ee*MW)/(2.*sw)-(ee*MW*sw)/(2.*cw); |
4071 | +GC_57 = -(cw*ee*MW)/(2.*sw)+(ee*MW*sw)/(2.*cw); |
4072 | +GC_58 = -(ee__exp__2*complexi)+(cw__exp__2*ee__exp__2*complexi)/(2.*sw__exp__2)+(ee__exp__2*complexi*sw__exp__2)/(2.*cw__exp__2); |
4073 | +GC_59 = ee__exp__2*complexi+(cw__exp__2*ee__exp__2*complexi)/(2.*sw__exp__2)+(ee__exp__2*complexi*sw__exp__2)/(2.*cw__exp__2); |
4074 | +GC_60 = -(ee__exp__2*v)/(2.*cw); |
4075 | +GC_61 = (ee__exp__2*v)/(2.*cw); |
4076 | +GC_62 = -2.*complexi*lam*v; |
4077 | +GC_63 = -6.*complexi*lam*v; |
4078 | +GC_64 = (ee__exp__2*complexi*v)/(2.*sw__exp__2); |
4079 | +GC_65 = -(ee__exp__2*v)/(2.*sw); |
4080 | +GC_66 = (ee__exp__2*v)/(2.*sw); |
4081 | +GC_67 = ee__exp__2*complexi*v+(cw__exp__2*ee__exp__2*complexi*v)/(2.*sw__exp__2)+(ee__exp__2*complexi*sw__exp__2*v)/(2.*cw__exp__2); |
4082 | +GC_68 = -((complexi*yb)/sqrt__2); |
4083 | +GC_69 = yb/sqrt__2; |
4084 | +GC_70 = -(CKM13*yb); |
4085 | +GC_71 = -(CKM23*yb); |
4086 | +GC_72 = -(CKM33*yb); |
4087 | +GC_73 = -(yc/sqrt__2); |
4088 | +GC_74 = -((complexi*yc)/sqrt__2); |
4089 | +GC_75 = CKM21*yc; |
4090 | +GC_76 = CKM22*yc; |
4091 | +GC_77 = CKM23*yc; |
4092 | +GC_96 = -(yt/sqrt__2); |
4093 | +GC_97 = -((complexi*yt)/sqrt__2); |
4094 | +GC_98 = CKM31*yt; |
4095 | +GC_99 = CKM32*yt; |
4096 | +GC_100 = CKM33*yt; |
4097 | +GC_101 = -ytau; |
4098 | +GC_102 = ytau; |
4099 | +GC_103 = -((complexi*ytau)/sqrt__2); |
4100 | +GC_104 = ytau/sqrt__2; |
4101 | +GC_110 = (ee*complexi*conjg__CKM11)/(sw*sqrt__2); |
4102 | +GC_113 = (ee*complexi*conjg__CKM12)/(sw*sqrt__2); |
4103 | +GC_116 = (ee*complexi*conjg__CKM13)/(sw*sqrt__2); |
4104 | +GC_117 = yb*conjg__CKM13; |
4105 | +GC_119 = (ee*complexi*conjg__CKM21)/(sw*sqrt__2); |
4106 | +GC_120 = -(yc*conjg__CKM21); |
4107 | +GC_122 = (ee*complexi*conjg__CKM22)/(sw*sqrt__2); |
4108 | +GC_123 = -(yc*conjg__CKM22); |
4109 | +GC_125 = (ee*complexi*conjg__CKM23)/(sw*sqrt__2); |
4110 | +GC_126 = yb*conjg__CKM23; |
4111 | +GC_127 = -(yc*conjg__CKM23); |
4112 | +GC_128 = (ee*complexi*conjg__CKM31)/(sw*sqrt__2); |
4113 | +GC_130 = -(yt*conjg__CKM31); |
4114 | +GC_131 = (ee*complexi*conjg__CKM32)/(sw*sqrt__2); |
4115 | +GC_133 = -(yt*conjg__CKM32); |
4116 | +GC_134 = (ee*complexi*conjg__CKM33)/(sw*sqrt__2); |
4117 | +GC_135 = yb*conjg__CKM33; |
4118 | +GC_136 = -(yt*conjg__CKM33); |
4119 | +GC_78 = -((complexi*ydo)/sqrt__2); |
4120 | +GC_79 = ydo/sqrt__2; |
4121 | +GC_80 = -(CKM11*ydo); |
4122 | +GC_81 = -(CKM21*ydo); |
4123 | +GC_82 = -(CKM31*ydo); |
4124 | +GC_83 = -ye; |
4125 | +GC_84 = ye; |
4126 | +GC_85 = -((complexi*ye)/sqrt__2); |
4127 | +GC_86 = ye/sqrt__2; |
4128 | +GC_87 = -ym; |
4129 | +GC_88 = ym; |
4130 | +GC_89 = -((complexi*ym)/sqrt__2); |
4131 | +GC_90 = ym/sqrt__2; |
4132 | +GC_91 = -((complexi*ys)/sqrt__2); |
4133 | +GC_92 = ys/sqrt__2; |
4134 | +GC_93 = -(CKM12*ys); |
4135 | +GC_94 = -(CKM22*ys); |
4136 | +GC_95 = -(CKM32*ys); |
4137 | +GC_105 = -(yup/sqrt__2); |
4138 | +GC_106 = -((complexi*yup)/sqrt__2); |
4139 | +GC_107 = CKM11*yup; |
4140 | +GC_108 = CKM12*yup; |
4141 | +GC_109 = CKM13*yup; |
4142 | +GC_111 = ydo*conjg__CKM11; |
4143 | +GC_112 = -(yup*conjg__CKM11); |
4144 | +GC_114 = ys*conjg__CKM12; |
4145 | +GC_115 = -(yup*conjg__CKM12); |
4146 | +GC_118 = -(yup*conjg__CKM13); |
4147 | +GC_121 = ydo*conjg__CKM21; |
4148 | +GC_124 = ys*conjg__CKM22; |
4149 | +GC_129 = ydo*conjg__CKM31; |
4150 | +GC_132 = ys*conjg__CKM32; |
4151 | + } |
4152 | + void Parameters_sm::setDependentParameters(ParticleData*& pd, Couplings*& csm, SusyLesHouches*& slhaPtr, double alpS){ |
4153 | + aS = alpS; |
4154 | +sqrt__aS = sqrt(aS); |
4155 | +G = 2.*sqrt__aS*sqrt(M_PI); |
4156 | +G__exp__2 = pow(G,2.); |
4157 | + } |
4158 | + void Parameters_sm::setDependentCouplings(){ |
4159 | + GC_9 = -G; |
4160 | +GC_11 = complexi*G__exp__2; |
4161 | +GC_10 = complexi*G; |
4162 | + } |
4163 | + |
4164 | + // Routines for printing out parameters |
4165 | + void Parameters_sm::printIndependentParameters(){ |
4166 | + cout << "sm model parameters independent of event kinematics:" << endl; |
4167 | + cout << setw(20) << "WH " << "= " << setiosflags(ios::scientific) << setw(10) << WH << endl; |
4168 | +cout << setw(20) << "WW " << "= " << setiosflags(ios::scientific) << setw(10) << WW << endl; |
4169 | +cout << setw(20) << "WZ " << "= " << setiosflags(ios::scientific) << setw(10) << WZ << endl; |
4170 | +cout << setw(20) << "WT " << "= " << setiosflags(ios::scientific) << setw(10) << WT << endl; |
4171 | +cout << setw(20) << "MH " << "= " << setiosflags(ios::scientific) << setw(10) << MH << endl; |
4172 | +cout << setw(20) << "MZ " << "= " << setiosflags(ios::scientific) << setw(10) << MZ << endl; |
4173 | +cout << setw(20) << "MB " << "= " << setiosflags(ios::scientific) << setw(10) << MB << endl; |
4174 | +cout << setw(20) << "MS " << "= " << setiosflags(ios::scientific) << setw(10) << MS << endl; |
4175 | +cout << setw(20) << "MD " << "= " << setiosflags(ios::scientific) << setw(10) << MD << endl; |
4176 | +cout << setw(20) << "MT " << "= " << setiosflags(ios::scientific) << setw(10) << MT << endl; |
4177 | +cout << setw(20) << "MC " << "= " << setiosflags(ios::scientific) << setw(10) << MC << endl; |
4178 | +cout << setw(20) << "MU " << "= " << setiosflags(ios::scientific) << setw(10) << MU << endl; |
4179 | +cout << setw(20) << "MTA " << "= " << setiosflags(ios::scientific) << setw(10) << MTA << endl; |
4180 | +cout << setw(20) << "MM " << "= " << setiosflags(ios::scientific) << setw(10) << MM << endl; |
4181 | +cout << setw(20) << "Me " << "= " << setiosflags(ios::scientific) << setw(10) << Me << endl; |
4182 | +cout << setw(20) << "ymtau " << "= " << setiosflags(ios::scientific) << setw(10) << ymtau << endl; |
4183 | +cout << setw(20) << "ymt " << "= " << setiosflags(ios::scientific) << setw(10) << ymt << endl; |
4184 | +cout << setw(20) << "ymb " << "= " << setiosflags(ios::scientific) << setw(10) << ymb << endl; |
4185 | +cout << setw(20) << "ymc " << "= " << setiosflags(ios::scientific) << setw(10) << ymc << endl; |
4186 | +cout << setw(20) << "Gf " << "= " << setiosflags(ios::scientific) << setw(10) << Gf << endl; |
4187 | +cout << setw(20) << "aEWM1 " << "= " << setiosflags(ios::scientific) << setw(10) << aEWM1 << endl; |
4188 | +cout << setw(20) << "cabi " << "= " << setiosflags(ios::scientific) << setw(10) << cabi << endl; |
4189 | +cout << setw(20) << "ZERO " << "= " << setiosflags(ios::scientific) << setw(10) << ZERO << endl; |
4190 | +cout << setw(20) << "ye " << "= " << setiosflags(ios::scientific) << setw(10) << ye << endl; |
4191 | +cout << setw(20) << "ym " << "= " << setiosflags(ios::scientific) << setw(10) << ym << endl; |
4192 | +cout << setw(20) << "yup " << "= " << setiosflags(ios::scientific) << setw(10) << yup << endl; |
4193 | +cout << setw(20) << "ydo " << "= " << setiosflags(ios::scientific) << setw(10) << ydo << endl; |
4194 | +cout << setw(20) << "ys " << "= " << setiosflags(ios::scientific) << setw(10) << ys << endl; |
4195 | +cout << setw(20) << "cos__cabi " << "= " << setiosflags(ios::scientific) << setw(10) << cos__cabi << endl; |
4196 | +cout << setw(20) << "CKM11 " << "= " << setiosflags(ios::scientific) << setw(10) << CKM11 << endl; |
4197 | +cout << setw(20) << "sin__cabi " << "= " << setiosflags(ios::scientific) << setw(10) << sin__cabi << endl; |
4198 | +cout << setw(20) << "CKM12 " << "= " << setiosflags(ios::scientific) << setw(10) << CKM12 << endl; |
4199 | +cout << setw(20) << "CKM13 " << "= " << setiosflags(ios::scientific) << setw(10) << CKM13 << endl; |
4200 | +cout << setw(20) << "CKM21 " << "= " << setiosflags(ios::scientific) << setw(10) << CKM21 << endl; |
4201 | +cout << setw(20) << "CKM22 " << "= " << setiosflags(ios::scientific) << setw(10) << CKM22 << endl; |
4202 | +cout << setw(20) << "CKM23 " << "= " << setiosflags(ios::scientific) << setw(10) << CKM23 << endl; |
4203 | +cout << setw(20) << "CKM31 " << "= " << setiosflags(ios::scientific) << setw(10) << CKM31 << endl; |
4204 | +cout << setw(20) << "CKM32 " << "= " << setiosflags(ios::scientific) << setw(10) << CKM32 << endl; |
4205 | +cout << setw(20) << "CKM33 " << "= " << setiosflags(ios::scientific) << setw(10) << CKM33 << endl; |
4206 | +cout << setw(20) << "MZ__exp__2 " << "= " << setiosflags(ios::scientific) << setw(10) << MZ__exp__2 << endl; |
4207 | +cout << setw(20) << "MZ__exp__4 " << "= " << setiosflags(ios::scientific) << setw(10) << MZ__exp__4 << endl; |
4208 | +cout << setw(20) << "sqrt__2 " << "= " << setiosflags(ios::scientific) << setw(10) << sqrt__2 << endl; |
4209 | +cout << setw(20) << "MH__exp__2 " << "= " << setiosflags(ios::scientific) << setw(10) << MH__exp__2 << endl; |
4210 | +cout << setw(20) << "complexi " << "= " << setiosflags(ios::scientific) << setw(10) << complexi << endl; |
4211 | +cout << setw(20) << "conjg__CKM11 " << "= " << setiosflags(ios::scientific) << setw(10) << conjg__CKM11 << endl; |
4212 | +cout << setw(20) << "conjg__CKM12 " << "= " << setiosflags(ios::scientific) << setw(10) << conjg__CKM12 << endl; |
4213 | +cout << setw(20) << "conjg__CKM13 " << "= " << setiosflags(ios::scientific) << setw(10) << conjg__CKM13 << endl; |
4214 | +cout << setw(20) << "conjg__CKM21 " << "= " << setiosflags(ios::scientific) << setw(10) << conjg__CKM21 << endl; |
4215 | +cout << setw(20) << "conjg__CKM22 " << "= " << setiosflags(ios::scientific) << setw(10) << conjg__CKM22 << endl; |
4216 | +cout << setw(20) << "conjg__CKM23 " << "= " << setiosflags(ios::scientific) << setw(10) << conjg__CKM23 << endl; |
4217 | +cout << setw(20) << "conjg__CKM31 " << "= " << setiosflags(ios::scientific) << setw(10) << conjg__CKM31 << endl; |
4218 | +cout << setw(20) << "conjg__CKM32 " << "= " << setiosflags(ios::scientific) << setw(10) << conjg__CKM32 << endl; |
4219 | +cout << setw(20) << "conjg__CKM33 " << "= " << setiosflags(ios::scientific) << setw(10) << conjg__CKM33 << endl; |
4220 | +cout << setw(20) << "aEW " << "= " << setiosflags(ios::scientific) << setw(10) << aEW << endl; |
4221 | +cout << setw(20) << "MW " << "= " << setiosflags(ios::scientific) << setw(10) << MW << endl; |
4222 | +cout << setw(20) << "sqrt__aEW " << "= " << setiosflags(ios::scientific) << setw(10) << sqrt__aEW << endl; |
4223 | +cout << setw(20) << "ee " << "= " << setiosflags(ios::scientific) << setw(10) << ee << endl; |
4224 | +cout << setw(20) << "MW__exp__2 " << "= " << setiosflags(ios::scientific) << setw(10) << MW__exp__2 << endl; |
4225 | +cout << setw(20) << "sw2 " << "= " << setiosflags(ios::scientific) << setw(10) << sw2 << endl; |
4226 | +cout << setw(20) << "cw " << "= " << setiosflags(ios::scientific) << setw(10) << cw << endl; |
4227 | +cout << setw(20) << "sqrt__sw2 " << "= " << setiosflags(ios::scientific) << setw(10) << sqrt__sw2 << endl; |
4228 | +cout << setw(20) << "sw " << "= " << setiosflags(ios::scientific) << setw(10) << sw << endl; |
4229 | +cout << setw(20) << "g1 " << "= " << setiosflags(ios::scientific) << setw(10) << g1 << endl; |
4230 | +cout << setw(20) << "gw " << "= " << setiosflags(ios::scientific) << setw(10) << gw << endl; |
4231 | +cout << setw(20) << "v " << "= " << setiosflags(ios::scientific) << setw(10) << v << endl; |
4232 | +cout << setw(20) << "v__exp__2 " << "= " << setiosflags(ios::scientific) << setw(10) << v__exp__2 << endl; |
4233 | +cout << setw(20) << "lam " << "= " << setiosflags(ios::scientific) << setw(10) << lam << endl; |
4234 | +cout << setw(20) << "yb " << "= " << setiosflags(ios::scientific) << setw(10) << yb << endl; |
4235 | +cout << setw(20) << "yc " << "= " << setiosflags(ios::scientific) << setw(10) << yc << endl; |
4236 | +cout << setw(20) << "yt " << "= " << setiosflags(ios::scientific) << setw(10) << yt << endl; |
4237 | +cout << setw(20) << "ytau " << "= " << setiosflags(ios::scientific) << setw(10) << ytau << endl; |
4238 | +cout << setw(20) << "muH " << "= " << setiosflags(ios::scientific) << setw(10) << muH << endl; |
4239 | +cout << setw(20) << "ee__exp__2 " << "= " << setiosflags(ios::scientific) << setw(10) << ee__exp__2 << endl; |
4240 | +cout << setw(20) << "gw__exp__2 " << "= " << setiosflags(ios::scientific) << setw(10) << gw__exp__2 << endl; |
4241 | +cout << setw(20) << "cw__exp__2 " << "= " << setiosflags(ios::scientific) << setw(10) << cw__exp__2 << endl; |
4242 | +cout << setw(20) << "sw__exp__2 " << "= " << setiosflags(ios::scientific) << setw(10) << sw__exp__2 << endl; |
4243 | + } |
4244 | + void Parameters_sm::printIndependentCouplings(){ |
4245 | + cout << "sm model couplings independent of event kinematics:" << endl; |
4246 | + cout << setw(20) << "GC_1 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_1 << endl; |
4247 | +cout << setw(20) << "GC_2 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_2 << endl; |
4248 | +cout << setw(20) << "GC_3 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_3 << endl; |
4249 | +cout << setw(20) << "GC_4 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_4 << endl; |
4250 | +cout << setw(20) << "GC_5 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_5 << endl; |
4251 | +cout << setw(20) << "GC_6 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_6 << endl; |
4252 | +cout << setw(20) << "GC_7 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_7 << endl; |
4253 | +cout << setw(20) << "GC_8 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_8 << endl; |
4254 | +cout << setw(20) << "GC_12 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_12 << endl; |
4255 | +cout << setw(20) << "GC_13 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_13 << endl; |
4256 | +cout << setw(20) << "GC_14 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_14 << endl; |
4257 | +cout << setw(20) << "GC_15 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_15 << endl; |
4258 | +cout << setw(20) << "GC_16 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_16 << endl; |
4259 | +cout << setw(20) << "GC_17 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_17 << endl; |
4260 | +cout << setw(20) << "GC_18 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_18 << endl; |
4261 | +cout << setw(20) << "GC_19 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_19 << endl; |
4262 | +cout << setw(20) << "GC_20 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_20 << endl; |
4263 | +cout << setw(20) << "GC_21 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_21 << endl; |
4264 | +cout << setw(20) << "GC_22 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_22 << endl; |
4265 | +cout << setw(20) << "GC_23 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_23 << endl; |
4266 | +cout << setw(20) << "GC_24 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_24 << endl; |
4267 | +cout << setw(20) << "GC_25 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_25 << endl; |
4268 | +cout << setw(20) << "GC_26 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_26 << endl; |
4269 | +cout << setw(20) << "GC_27 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_27 << endl; |
4270 | +cout << setw(20) << "GC_28 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_28 << endl; |
4271 | +cout << setw(20) << "GC_29 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_29 << endl; |
4272 | +cout << setw(20) << "GC_30 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_30 << endl; |
4273 | +cout << setw(20) << "GC_31 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_31 << endl; |
4274 | +cout << setw(20) << "GC_32 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_32 << endl; |
4275 | +cout << setw(20) << "GC_33 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_33 << endl; |
4276 | +cout << setw(20) << "GC_34 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_34 << endl; |
4277 | +cout << setw(20) << "GC_35 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_35 << endl; |
4278 | +cout << setw(20) << "GC_36 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_36 << endl; |
4279 | +cout << setw(20) << "GC_37 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_37 << endl; |
4280 | +cout << setw(20) << "GC_38 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_38 << endl; |
4281 | +cout << setw(20) << "GC_39 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_39 << endl; |
4282 | +cout << setw(20) << "GC_40 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_40 << endl; |
4283 | +cout << setw(20) << "GC_41 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_41 << endl; |
4284 | +cout << setw(20) << "GC_42 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_42 << endl; |
4285 | +cout << setw(20) << "GC_43 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_43 << endl; |
4286 | +cout << setw(20) << "GC_44 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_44 << endl; |
4287 | +cout << setw(20) << "GC_45 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_45 << endl; |
4288 | +cout << setw(20) << "GC_46 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_46 << endl; |
4289 | +cout << setw(20) << "GC_47 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_47 << endl; |
4290 | +cout << setw(20) << "GC_48 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_48 << endl; |
4291 | +cout << setw(20) << "GC_49 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_49 << endl; |
4292 | +cout << setw(20) << "GC_50 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_50 << endl; |
4293 | +cout << setw(20) << "GC_51 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_51 << endl; |
4294 | +cout << setw(20) << "GC_52 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_52 << endl; |
4295 | +cout << setw(20) << "GC_53 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_53 << endl; |
4296 | +cout << setw(20) << "GC_54 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_54 << endl; |
4297 | +cout << setw(20) << "GC_55 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_55 << endl; |
4298 | +cout << setw(20) << "GC_56 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_56 << endl; |
4299 | +cout << setw(20) << "GC_57 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_57 << endl; |
4300 | +cout << setw(20) << "GC_58 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_58 << endl; |
4301 | +cout << setw(20) << "GC_59 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_59 << endl; |
4302 | +cout << setw(20) << "GC_60 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_60 << endl; |
4303 | +cout << setw(20) << "GC_61 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_61 << endl; |
4304 | +cout << setw(20) << "GC_62 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_62 << endl; |
4305 | +cout << setw(20) << "GC_63 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_63 << endl; |
4306 | +cout << setw(20) << "GC_64 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_64 << endl; |
4307 | +cout << setw(20) << "GC_65 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_65 << endl; |
4308 | +cout << setw(20) << "GC_66 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_66 << endl; |
4309 | +cout << setw(20) << "GC_67 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_67 << endl; |
4310 | +cout << setw(20) << "GC_68 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_68 << endl; |
4311 | +cout << setw(20) << "GC_69 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_69 << endl; |
4312 | +cout << setw(20) << "GC_70 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_70 << endl; |
4313 | +cout << setw(20) << "GC_71 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_71 << endl; |
4314 | +cout << setw(20) << "GC_72 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_72 << endl; |
4315 | +cout << setw(20) << "GC_73 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_73 << endl; |
4316 | +cout << setw(20) << "GC_74 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_74 << endl; |
4317 | +cout << setw(20) << "GC_75 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_75 << endl; |
4318 | +cout << setw(20) << "GC_76 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_76 << endl; |
4319 | +cout << setw(20) << "GC_77 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_77 << endl; |
4320 | +cout << setw(20) << "GC_96 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_96 << endl; |
4321 | +cout << setw(20) << "GC_97 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_97 << endl; |
4322 | +cout << setw(20) << "GC_98 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_98 << endl; |
4323 | +cout << setw(20) << "GC_99 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_99 << endl; |
4324 | +cout << setw(20) << "GC_100 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_100 << endl; |
4325 | +cout << setw(20) << "GC_101 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_101 << endl; |
4326 | +cout << setw(20) << "GC_102 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_102 << endl; |
4327 | +cout << setw(20) << "GC_103 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_103 << endl; |
4328 | +cout << setw(20) << "GC_104 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_104 << endl; |
4329 | +cout << setw(20) << "GC_110 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_110 << endl; |
4330 | +cout << setw(20) << "GC_113 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_113 << endl; |
4331 | +cout << setw(20) << "GC_116 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_116 << endl; |
4332 | +cout << setw(20) << "GC_117 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_117 << endl; |
4333 | +cout << setw(20) << "GC_119 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_119 << endl; |
4334 | +cout << setw(20) << "GC_120 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_120 << endl; |
4335 | +cout << setw(20) << "GC_122 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_122 << endl; |
4336 | +cout << setw(20) << "GC_123 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_123 << endl; |
4337 | +cout << setw(20) << "GC_125 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_125 << endl; |
4338 | +cout << setw(20) << "GC_126 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_126 << endl; |
4339 | +cout << setw(20) << "GC_127 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_127 << endl; |
4340 | +cout << setw(20) << "GC_128 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_128 << endl; |
4341 | +cout << setw(20) << "GC_130 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_130 << endl; |
4342 | +cout << setw(20) << "GC_131 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_131 << endl; |
4343 | +cout << setw(20) << "GC_133 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_133 << endl; |
4344 | +cout << setw(20) << "GC_134 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_134 << endl; |
4345 | +cout << setw(20) << "GC_135 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_135 << endl; |
4346 | +cout << setw(20) << "GC_136 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_136 << endl; |
4347 | +cout << setw(20) << "GC_78 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_78 << endl; |
4348 | +cout << setw(20) << "GC_79 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_79 << endl; |
4349 | +cout << setw(20) << "GC_80 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_80 << endl; |
4350 | +cout << setw(20) << "GC_81 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_81 << endl; |
4351 | +cout << setw(20) << "GC_82 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_82 << endl; |
4352 | +cout << setw(20) << "GC_83 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_83 << endl; |
4353 | +cout << setw(20) << "GC_84 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_84 << endl; |
4354 | +cout << setw(20) << "GC_85 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_85 << endl; |
4355 | +cout << setw(20) << "GC_86 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_86 << endl; |
4356 | +cout << setw(20) << "GC_87 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_87 << endl; |
4357 | +cout << setw(20) << "GC_88 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_88 << endl; |
4358 | +cout << setw(20) << "GC_89 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_89 << endl; |
4359 | +cout << setw(20) << "GC_90 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_90 << endl; |
4360 | +cout << setw(20) << "GC_91 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_91 << endl; |
4361 | +cout << setw(20) << "GC_92 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_92 << endl; |
4362 | +cout << setw(20) << "GC_93 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_93 << endl; |
4363 | +cout << setw(20) << "GC_94 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_94 << endl; |
4364 | +cout << setw(20) << "GC_95 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_95 << endl; |
4365 | +cout << setw(20) << "GC_105 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_105 << endl; |
4366 | +cout << setw(20) << "GC_106 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_106 << endl; |
4367 | +cout << setw(20) << "GC_107 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_107 << endl; |
4368 | +cout << setw(20) << "GC_108 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_108 << endl; |
4369 | +cout << setw(20) << "GC_109 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_109 << endl; |
4370 | +cout << setw(20) << "GC_111 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_111 << endl; |
4371 | +cout << setw(20) << "GC_112 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_112 << endl; |
4372 | +cout << setw(20) << "GC_114 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_114 << endl; |
4373 | +cout << setw(20) << "GC_115 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_115 << endl; |
4374 | +cout << setw(20) << "GC_118 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_118 << endl; |
4375 | +cout << setw(20) << "GC_121 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_121 << endl; |
4376 | +cout << setw(20) << "GC_124 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_124 << endl; |
4377 | +cout << setw(20) << "GC_129 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_129 << endl; |
4378 | +cout << setw(20) << "GC_132 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_132 << endl; |
4379 | + } |
4380 | + void Parameters_sm::printDependentParameters(){ |
4381 | + cout << "sm model parameters dependent on event kinematics:" << endl; |
4382 | + cout << setw(20) << "aS " << "= " << setiosflags(ios::scientific) << setw(10) << aS << endl; |
4383 | +cout << setw(20) << "sqrt__aS " << "= " << setiosflags(ios::scientific) << setw(10) << sqrt__aS << endl; |
4384 | +cout << setw(20) << "G " << "= " << setiosflags(ios::scientific) << setw(10) << G << endl; |
4385 | +cout << setw(20) << "G__exp__2 " << "= " << setiosflags(ios::scientific) << setw(10) << G__exp__2 << endl; |
4386 | + } |
4387 | + void Parameters_sm::printDependentCouplings(){ |
4388 | + cout << "sm model couplings dependent on event kinematics:" << endl; |
4389 | + cout << setw(20) << "GC_9 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_9 << endl; |
4390 | +cout << setw(20) << "GC_11 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_11 << endl; |
4391 | +cout << setw(20) << "GC_10 " << "= " << setiosflags(ios::scientific) << setw(10) << GC_10 << endl; |
4392 | + } |
4393 | + |
4394 | +} // end namespace Pythia8 |
4395 | +""" % misc.get_pkg_info() |
4396 | + |
4397 | + file_h, file_cc = self.model_builder.generate_parameters_class_files() |
4398 | + |
4399 | + self.assertEqual(file_h, goal_file_h) |
4400 | + self.assertEqual(file_cc, goal_file_cc) |
4401 | |
4402 | |
4403 | === modified file 'tests/unit_tests/iolibs/test_helas_call_writers.py' |
4404 | --- tests/unit_tests/iolibs/test_helas_call_writers.py 2010-12-17 18:31:51 +0000 |
4405 | +++ tests/unit_tests/iolibs/test_helas_call_writers.py 2011-03-31 16:46:04 +0000 |
4406 | @@ -902,11 +902,11 @@ |
4407 | self.mybasemodel) |
4408 | |
4409 | result = cpp_model.get_matrix_element_calls(self.mymatrixelement) |
4410 | - solution =['vxxxxx(p[0],mME[0],hel[0],-1,w[0]);', |
4411 | - 'vxxxxx(p[1],mME[1],hel[1],-1,w[1]);', |
4412 | - 'vxxxxx(p[2],mME[2],hel[2],+1,w[2]);', |
4413 | - 'vxxxxx(p[3],mME[3],hel[3],+1,w[3]);', |
4414 | - 'vxxxxx(p[4],mME[4],hel[4],+1,w[4]);', |
4415 | + solution =['vxxxxx(p[perm[0]],mME[0],hel[0],-1,w[0]);', |
4416 | + 'vxxxxx(p[perm[1]],mME[1],hel[1],-1,w[1]);', |
4417 | + 'vxxxxx(p[perm[2]],mME[2],hel[2],+1,w[2]);', |
4418 | + 'vxxxxx(p[perm[3]],mME[3],hel[3],+1,w[3]);', |
4419 | + 'vxxxxx(p[perm[4]],mME[4],hel[4],+1,w[4]);', |
4420 | 'VVVV1_4(w[0],w[2],w[1],pars->GC_51,pars->wmas, pars->wwid, w[5]);', |
4421 | '# Amplitude(s) for diagram number 1', |
4422 | 'VVV1_0(w[5],w[3],w[4],pars->GC_12,amp[0]);', |
4423 | |
4424 | === modified file 'tests/unit_tests/various/test_process_checks.py' |
4425 | --- tests/unit_tests/various/test_process_checks.py 2011-03-24 16:15:56 +0000 |
4426 | +++ tests/unit_tests/various/test_process_checks.py 2011-03-31 16:46:04 +0000 |
4427 | @@ -323,7 +323,6 @@ |
4428 | for i in range(len(invariant_mass_boost)): |
4429 | self.assertAlmostEqual(invariant_mass_boost[i], |
4430 | invariant_mass_result[i]) |
4431 | - |
4432 | |
4433 | def test_boost_momenta_gluino(self): |
4434 | """check if the momenta are boosted correctly by checking invariant mass |
Hi Johan,
They are problem with the launch command.
1) It's not working now (but that you know and expect me to fix)
2) It's not working as the "other" launch command
- it has a timer, even in interactive mode (where they are only in shell mode for the other)
- it require confirmation for the main (where for the other launch it launches directly)
All the launch routine should follow the same logic!!