Merge lp:~maddevelopers/mg5amcnlo/LI_NLO into lp:~olivier-mattelaer/mg5amcnlo/2.5.3
- LI_NLO
- Merge into 2.5.3
Status: | Merged |
---|---|
Merge reported by: | Olivier Mattelaer |
Merged at revision: | not available |
Proposed branch: | lp:~maddevelopers/mg5amcnlo/LI_NLO |
Merge into: | lp:~olivier-mattelaer/mg5amcnlo/2.5.3 |
Diff against target: |
3552 lines (+1486/-773) 43 files modified
Template/loop_material/StandAlone/SubProcesses/makefile (+10/-1) madgraph/core/base_objects.py (+15/-1) madgraph/core/diagram_generation.py (+3/-4) madgraph/interface/amcatnlo_run_interface.py (+0/-2) madgraph/interface/common_run_interface.py (+2/-2) madgraph/interface/extended_cmd.py (+3/-3) madgraph/interface/loop_interface.py (+3/-1) madgraph/interface/madevent_interface.py (+6/-5) madgraph/interface/madgraph_interface.py (+5/-2) madgraph/interface/reweight_interface.py (+661/-593) madgraph/iolibs/export_cpp.py (+3/-2) madgraph/iolibs/export_v4.py (+175/-36) madgraph/iolibs/template_files/loop/improve_ps.inc (+22/-3) madgraph/iolibs/template_files/loop/loop_matrix_standalone.inc (+9/-0) madgraph/iolibs/template_files/loop_optimized/check_py.f.inc (+2/-2) madgraph/iolibs/template_files/loop_optimized/check_sa.py.inc (+2/-2) madgraph/iolibs/template_files/loop_optimized/check_sa_all.py.inc (+139/-0) madgraph/iolibs/template_files/loop_optimized/loop_matrix_standalone.inc (+9/-0) madgraph/iolibs/template_files/makefile_sa_f2py (+23/-0) madgraph/iolibs/template_files/matrix_standalone_splitOrders_v4.inc (+3/-3) madgraph/iolibs/template_files/matrix_standalone_v4.inc (+5/-3) madgraph/loop/loop_diagram_generation.py (+9/-1) madgraph/loop/loop_exporters.py (+144/-4) madgraph/various/banner.py (+0/-1) madgraph/various/lhe_parser.py (+147/-52) madgraph/various/misc.py (+17/-1) models/template_files/fortran/lha_read.f (+2/-2) models/template_files/fortran/lha_read_mp.f (+2/-2) tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%born_matrix.f (+3/-3) tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%V0_udx_wp%born_matrix.f (+3/-3) tests/input_files/IOTestsComparison/IOExportV4IOTest/export_matrix_element_v4_standalone/matrix.f (+5/-3) tests/input_files/IOTestsComparison/MadLoop_output_from_the_interface/TIR_output/%ggttx_IOTest%SubProcesses%P0_gg_ttx%born_matrix.f (+3/-3) tests/input_files/IOTestsComparison/SquaredOrder_IOTest/sqso_uux_uuxuuxx/matrix_NoSQSO.f (+5/-3) tests/input_files/IOTestsComparison/SquaredOrder_IOTest/sqso_uux_uuxuuxx/matrix_QCDsq_le_6.f (+3/-3) tests/input_files/IOTestsComparison/SquaredOrder_IOTest/sqso_uux_uuxuuxx/matrix_ampOrderQED2_eq_2_WGTsq_le_14_QCDsq_gt_4.f (+3/-3) tests/input_files/IOTestsComparison/long_ML_SMQCD_default/dux_mumvmxg/born_matrix.f (+5/-3) tests/input_files/IOTestsComparison/long_ML_SMQCD_default/gg_wmtbx/born_matrix.f (+5/-3) tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/dux_mumvmxg/born_matrix.f (+5/-3) tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/gg_wmtbx/born_matrix.f (+5/-3) tests/input_files/IOTestsComparison/short_ML_SMQCD_default/ddx_ttx/born_matrix.f (+5/-3) tests/input_files/IOTestsComparison/short_ML_SMQCD_default/gg_ttx/born_matrix.f (+5/-3) tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/ddx_ttx/born_matrix.f (+5/-3) tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/gg_ttx/born_matrix.f (+5/-3) |
To merge this branch: | bzr merge lp:~maddevelopers/mg5amcnlo/LI_NLO |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Valentin Hirschi (community) | Approve | ||
Review via email: mp+318332@code.launchpad.net |
Commit message
Description of the change
Those are deep change in order to improve re-weighting (memory consumption and speed are highly improved due to better structure of the code (i.e. only use a single library))
- 344. By olivier-mattelaer
-
small fix of bug in reweighting
- 345. By olivier-mattelaer
-
merge with some old version of 2.5.4
- 346. By olivier-mattelaer
-
allow symmetric matrix element to go trough for the re-weighting
- 347. By olivier-mattelaer
-
small fix
- 348. By olivier-mattelaer
-
new fix (not very save but ok)
- 349. By Valentin Hirschi
-
1. Fixed an issue in the algorithm for numerically solving the rescaling factor for the PS point accuracy improvement using the parton-shower technique. This issue was affecting only the case where all external particles are massless.
I solved it by rescaling the first momentum by x**2 instead of just x, so that the derivative of the function to optimize is not
also zero when the optimzed function is zero. - 350. By Valentin Hirschi
-
1. Added NaN's detection when computing the accuracy of the evaluation.
If a NaN is detected the resulting accuracy is hardset to 1.0d99. - 351. By Valentin Hirschi
-
1. Fixed the scale setting in the NLO all_matrix.f wrapper.
- 352. By Manoj Kumar Mandal
-
improve onshell particle when merging particle
- 353. By olivier-mattelaer
-
use the born configuration related to the weight rather than merging fks particles in presence of too soft/colinear sector
- 354. By olivier-mattelaer
-
remove one file
Olivier Mattelaer (olivier-mattelaer) wrote : | # |
> a)
> It would be nice to wrap the look-up into both PLUGIN and MG5aMC_PLUGIN in a
> misc.function so that we won't have to code up this dual plugin look-up
> everywhere.
replaced by:
> b) What is the difference between
>
> elif args[0] in ['virtual_path', 'tree_path']:
>
> and change rwgt_me_dir
If the path to "rwgt_dir" does not exists,then this path will be created and all the code required for the code will be created at that position (and kept at the end of the run)
if the path exists, then those file will be re-used. (This include the standalone library for the original hyppothesis)
While 'virtual_path', 'tree_path' defines only path for the new hyppothesis if someone needs to specify them in advance (in principle only if someone needs to modify them like in the case of the two loop re-weighting).
> c) Remove
> os.environ[
done
>
> d) Use a similar wrapper like in handle_param for the lines (460 rwgt
> interface):
maybe later.
>
> e) Make sure to use nhel=-1 (and not 0!) for the convention 'sum over
> helicity' for MadLoop in the f2py splitter.
For this I'm a bit confused. In the file f2py_wrapper, I see this:
IF (NHEL.EQ.0) THEN
CALL ML5_0_SLOOPMATR
$ RETURNCODE)
ELSE
CALL ML5_0_SLOOPMATR
$ PREC_FOUND, RETURNCODE)
ENDIF
So this sounds wrong according to your comment (at the same time, I did not modify such lines).
Now I'm a bit confused by the handling of nhel in madloop.
USERHEL is never reset to -1 inside the code at the end of the ML5_0_SLOOPMATR
[Like it is at tree level]
Do you want me to change
1) the above line to (NHEL.EQ.-1)
2) systematically reset USERHEL to -1 at the end of ML5_0_SLOOPMATR
>
> f) IMPORTANT: Make sure WIKI is updated with *ALL* the new fancy options of
> the reweight interface!! :)
DONE
- 355. By olivier-mattelaer
-
implement Valentin comment but the one on nhel
Valentin Hirschi (valentin-hirschi) wrote : | # |
> > a)
> > It would be nice to wrap the look-up into both PLUGIN and MG5aMC_PLUGIN in a
> > misc.function so that we won't have to code up this dual plugin look-up
> > everywhere.
>
> replaced by:
> remove_diag = misc.plugin_
> 'user filter required to be
> defined in PLUGIN/
> returns True if the diagram has to be removed',
> fcts=['
>
> > b) What is the difference between
> >
> > elif args[0] in ['virtual_path', 'tree_path']:
> >
> > and change rwgt_me_dir
>
> If the path to "rwgt_dir" does not exists,then this path will be created and
> all the code required for the code will be created at that position (and kept
> at the end of the run)
> if the path exists, then those file will be re-used. (This include the
> standalone library for the original hyppothesis)
>
> While 'virtual_path', 'tree_path' defines only path for the new hyppothesis if
> someone needs to specify them in advance (in principle only if someone needs
> to modify them like in the case of the two loop re-weighting).
Got it. Can you confirm that the directories set with 'change virtual_path' and 'change tree_path' have indeed precedence over 'change rwgt_dir' if it is set as well?
>
> > c) Remove
> > os.environ[
>
> done
>
> >
> > d) Use a similar wrapper like in handle_param for the lines (460 rwgt
> > interface):
>
> maybe later.
>
> >
> > e) Make sure to use nhel=-1 (and not 0!) for the convention 'sum over
> > helicity' for MadLoop in the f2py splitter.
>
> For this I'm a bit confused. In the file f2py_wrapper, I see this:
>
> IF (NHEL.EQ.0) THEN
> CALL ML5_0_SLOOPMATR
> $ RETURNCODE)
> ELSE
> CALL ML5_0_SLOOPMATR
> $ PREC_FOUND, RETURNCODE)
> ENDIF
>
> So this sounds wrong according to your comment (at the same time, I did not
> modify such lines).
> Now I'm a bit confused by the handling of nhel in madloop.
> USERHEL is never reset to -1 inside the code at the end of the
> ML5_0_SLOOPMATR
> [Like it is at tree level]
> Do you want me to change
> 1) the above line to (NHEL.EQ.-1)
> 2) systematically reset USERHEL to -1 at the end of ML5_0_SLOOPMATR
Exactly, I had already noticed this "bug" of me not resetting USERHEL to -1 at the end of ML5_0_SLOOPMATR
So sorry for this; What you suggested is exactly what I would see appropriate indeed. Otherwise it is a bit weird to have two different conventions for the summation (i.e. NHEL = 0 or NHEL = -1) at two different levels of the code.
>
>
> >
> > f) IMPORTANT: Make sure WIKI is updated with *ALL* the new fancy options of
> > the reweight interface!! :)
>
> DONE
Seems good, I didn't re-read it carefully but I trust you that all what new functionalities that need to be documented now indeed are :)
Preview Diff
1 | === modified file 'Template/loop_material/StandAlone/SubProcesses/makefile' |
2 | --- Template/loop_material/StandAlone/SubProcesses/makefile 2017-02-27 15:22:19 +0000 |
3 | +++ Template/loop_material/StandAlone/SubProcesses/makefile 2017-07-29 19:33:46 +0000 |
4 | @@ -68,6 +68,11 @@ |
5 | $(patsubst $(DOTF),$(DOTO),$(wildcard $(LOOP_PREFIX)*/COLLIER_interface.f)) \ |
6 | $(patsubst $(DOTF),$(DOTO),$(wildcard $(LOOP_PREFIX)*/compute_color_flows.f)) |
7 | |
8 | +POLYNOMIAL = $(patsubst $(DOTF),$(DOTO),$(wildcard polynomial.f)) |
9 | +OLP_POLYNOMIAL = $(patsubst $(DOTF),$(DOTO),$(wildcard $(LOOP_PREFIX)*/polynomial.f)) |
10 | + |
11 | + |
12 | + |
13 | $(PROG): check_sa.o $(PROCESS) makefile $(LIBS) |
14 | $(FC) $(FFLAGS) -o $(PROG) check_sa.o $(PROCESS) $(LINKLIBS) |
15 | |
16 | @@ -86,7 +91,7 @@ |
17 | $(FC) $(patsubst -O%,, $(subst -fbounds-check,,$(FFLAGS))) $(POLYNOMIAL_OPTIMIZATION) $(POLYNOMIAL_BOUNDS_CHECK) -c $< -o $@ $(LOOP_INCLUDE) |
18 | |
19 | |
20 | -$(DOTO) : $(DOTF) |
21 | +$(DOTO) : $(DOTF) $(POLYNOMIAL) $(OLP_POLYNOMIAL) |
22 | $(FC) $(FFLAGS) -c $< -o $@ $(LOOP_INCLUDE) |
23 | |
24 | $(OLP): $(OLP_PROCESS) $(LIBS) |
25 | @@ -113,5 +118,9 @@ |
26 | touch __init__.py |
27 | $(F2PY) $(MADLOOP_LIB) -m matrix$(MENUM)py -c f2py_wrapper.f --fcompiler=$(FC) -L../../lib/ -ldhelas -lmodel $(LINK_LOOP_LIBS) $(STDLIB) |
28 | |
29 | +allmatrix$(MENUM)py.so: $(OLP)_static all_matrix.f $(LIBS) $(WRAPPER) |
30 | + touch __init__.py |
31 | + $(F2PY) $(MADLOOP_LIB) -m allmatrix$(MENUM)py -c all_matrix.f $(wildcard $(LOOP_PREFIX)*/f2py_wrapper.f) --fcompiler=$(FC) -L../lib/ -ldhelas -lmodel $(LINK_LOOP_LIBS) $(STDLIB) |
32 | + |
33 | clean: |
34 | @rm -f *.o *.so *.$(libext) *.$(dylibext) |
35 | |
36 | === modified file 'madgraph/core/base_objects.py' |
37 | --- madgraph/core/base_objects.py 2017-01-11 21:56:50 +0000 |
38 | +++ madgraph/core/base_objects.py 2017-07-29 19:33:46 +0000 |
39 | @@ -2950,9 +2950,11 @@ |
40 | if order not in self['sqorders_types']: |
41 | # Then assign its type to the default '=' |
42 | self['sqorders_types'][order]='=' |
43 | - |
44 | + |
45 | return super(Process, self).get(name) # call the mother routine |
46 | |
47 | + |
48 | + |
49 | def get_sorted_keys(self): |
50 | """Return process property names as a nicely sorted list.""" |
51 | |
52 | @@ -3436,6 +3438,18 @@ |
53 | self['legs_with_decays'] = LegList(legs) |
54 | |
55 | return self['legs_with_decays'] |
56 | + |
57 | + def get_tag(self): |
58 | + """return the tag for standalone call""" |
59 | + |
60 | + initial = [] #filled in the next line |
61 | + final = [l.get('id') for l in self.get('legs')\ |
62 | + if l.get('state') or initial.append(l.get('id'))] |
63 | + decay_finals = self.get_final_ids_after_decay() |
64 | + decay_finals.sort() |
65 | + tag = (tuple(initial), tuple(decay_finals)) |
66 | + return tag |
67 | + |
68 | |
69 | def list_for_sort(self): |
70 | """Output a list that can be compared to other processes as: |
71 | |
72 | === modified file 'madgraph/core/diagram_generation.py' |
73 | --- madgraph/core/diagram_generation.py 2017-02-02 14:05:47 +0000 |
74 | +++ madgraph/core/diagram_generation.py 2017-07-29 19:33:46 +0000 |
75 | @@ -892,10 +892,9 @@ |
76 | list in argument.""" |
77 | |
78 | if True: |
79 | - try: |
80 | - from PLUGIN.user_filter import remove_diag |
81 | - except ImportError: |
82 | - raise MadGraph5Error, 'user filter required to be defined in PLUGIN/user_filter.py with the function remove_diag(ONEDIAG) which returns True if the daigram has to be removed' |
83 | + remove_diag = misc.plugin_import('user_filter', |
84 | + 'user filter required to be defined in PLUGIN/user_filter.py with the function remove_diag(ONEDIAG) which returns True if the diagram has to be removed', |
85 | + fcts=['remove_diag']) |
86 | else: |
87 | #example and simple tests |
88 | def remove_diag(diag): |
89 | |
90 | === modified file 'madgraph/interface/amcatnlo_run_interface.py' |
91 | --- madgraph/interface/amcatnlo_run_interface.py 2017-03-07 15:43:44 +0000 |
92 | +++ madgraph/interface/amcatnlo_run_interface.py 2017-07-29 19:33:46 +0000 |
93 | @@ -4784,8 +4784,6 @@ |
94 | file.write(content) |
95 | file.close() |
96 | |
97 | - |
98 | - |
99 | ############################################################################ |
100 | def find_model_name(self): |
101 | """ return the model name """ |
102 | |
103 | === modified file 'madgraph/interface/common_run_interface.py' |
104 | --- madgraph/interface/common_run_interface.py 2017-03-03 23:41:19 +0000 |
105 | +++ madgraph/interface/common_run_interface.py 2017-07-29 19:33:46 +0000 |
106 | @@ -1878,7 +1878,7 @@ |
107 | if 'nevt_job' in self.run_card and self.run_card['nevt_job'] !=-1: |
108 | nevt_job = self.run_card['nevt_job'] |
109 | else: |
110 | - nevt_job = max(5000, self.run_card['nevents']/50) |
111 | + nevt_job = max(2500, self.run_card['nevents']/self.options['nb_core']) |
112 | logger.info("split the event file in bunch of %s events" % nevt_job) |
113 | nb_file = lhe_parser.EventFile(new_args[0]).split(nevt_job) |
114 | starttime = time.time() |
115 | @@ -5094,7 +5094,7 @@ |
116 | isinstance(self.run_card,banner_mod.RunCardNLO) and \ |
117 | not self.run_card['store_rwgt_info']: |
118 | #check if a NLO reweighting is required |
119 | - re_pattern = re.compile(r'''^\s*change\s*mode\s* (LO\+NLO|LO|NLO)\s*(?:#|$)''', re.M+re.I) |
120 | + re_pattern = re.compile(r'''^\s*change\s*mode\s* (LO\+NLO|LO|NLO|NLO_tree)\s*(?:#|$)''', re.M+re.I) |
121 | text = open(self.paths['reweight']).read() |
122 | options = re_pattern.findall(text) |
123 | if any(o in ['NLO', 'LO+NLO'] for o in options): |
124 | |
125 | === modified file 'madgraph/interface/extended_cmd.py' |
126 | --- madgraph/interface/extended_cmd.py 2017-02-02 14:05:47 +0000 |
127 | +++ madgraph/interface/extended_cmd.py 2017-07-29 19:33:46 +0000 |
128 | @@ -36,7 +36,7 @@ |
129 | |
130 | try: |
131 | import madgraph.various.misc as misc |
132 | - from madgraph import MG5DIR |
133 | + from madgraph import MG5DIR, MadGraph5Error |
134 | MADEVENT = False |
135 | except ImportError, error: |
136 | try: |
137 | @@ -862,7 +862,6 @@ |
138 | keyboard_stop_msg = """stopping all current operation |
139 | in order to quit the program please enter exit""" |
140 | |
141 | - |
142 | if MADEVENT: |
143 | plugin_path = [] |
144 | else: |
145 | @@ -1135,7 +1134,8 @@ |
146 | |
147 | # Execute the card |
148 | self.import_command_file(args[1]) |
149 | - |
150 | + |
151 | + |
152 | def check_import(self, args): |
153 | """check import command""" |
154 | |
155 | |
156 | === modified file 'madgraph/interface/loop_interface.py' |
157 | --- madgraph/interface/loop_interface.py 2016-09-01 10:26:58 +0000 |
158 | +++ madgraph/interface/loop_interface.py 2017-07-29 19:33:46 +0000 |
159 | @@ -428,6 +428,7 @@ |
160 | main_file_name = args[args.index('-name') + 1] |
161 | except Exception: |
162 | pass |
163 | + line_options = dict(arg[2:].split('=') for arg in args if arg.startswith('--') and '=' in arg) |
164 | |
165 | # Whatever the format we always output the quadruple precision routines |
166 | # to allow for curing possible unstable points. |
167 | @@ -463,7 +464,8 @@ |
168 | output_type = 'madloop_matchbox' |
169 | |
170 | self._curr_exporter = export_v4.ExportV4Factory(self, \ |
171 | - noclean, output_type=output_type, group_subprocesses=False) |
172 | + noclean, output_type=output_type, group_subprocesses=False, |
173 | + cmd_options=line_options) |
174 | |
175 | if self._export_format in ['standalone', 'matchbox']: |
176 | self._curr_exporter.copy_template(self._curr_model) |
177 | |
178 | === modified file 'madgraph/interface/madevent_interface.py' |
179 | --- madgraph/interface/madevent_interface.py 2017-03-06 20:39:01 +0000 |
180 | +++ madgraph/interface/madevent_interface.py 2017-07-29 19:33:46 +0000 |
181 | @@ -42,7 +42,8 @@ |
182 | |
183 | root_path = os.path.split(os.path.dirname(os.path.realpath( __file__ )))[0] |
184 | root_path = os.path.split(root_path)[0] |
185 | -sys.path.insert(0, os.path.join(root_path,'bin')) |
186 | +if __name__ == '__main__': |
187 | + sys.path.insert(0, os.path.join(root_path,'bin')) |
188 | |
189 | # usefull shortcut |
190 | pjoin = os.path.join |
191 | @@ -52,7 +53,7 @@ |
192 | |
193 | try: |
194 | import madgraph |
195 | -except ImportError: |
196 | +except ImportError,error: |
197 | # import from madevent directory |
198 | MADEVENT = True |
199 | import internal.extended_cmd as cmd |
200 | @@ -5938,7 +5939,7 @@ |
201 | |
202 | # Now that we know in which mode we are check that all the card |
203 | #exists (copy default if needed) |
204 | - |
205 | + |
206 | cards = ['param_card.dat', 'run_card.dat'] |
207 | if switch['shower'] in ['PY6', 'PYTHIA6']: |
208 | cards.append('pythia_card.dat') |
209 | @@ -6732,9 +6733,9 @@ |
210 | if '--web' in args: |
211 | i = args.index('--web') |
212 | args.pop(i) |
213 | - cmd_line = MadEventCmd(force_run=True) |
214 | + cmd_line = MadEventCmd(os.path.dirname(root_path),force_run=True) |
215 | else: |
216 | - cmd_line = MadEventCmdShell(force_run=True) |
217 | + cmd_line = MadEventCmdShell(os.path.dirname(root_path),force_run=True) |
218 | if not hasattr(cmd_line, 'do_%s' % args[0]): |
219 | if parser_error: |
220 | print parser_error |
221 | |
222 | === modified file 'madgraph/interface/madgraph_interface.py' |
223 | --- madgraph/interface/madgraph_interface.py 2017-03-07 15:43:44 +0000 |
224 | +++ madgraph/interface/madgraph_interface.py 2017-07-29 19:33:46 +0000 |
225 | @@ -7288,6 +7288,7 @@ |
226 | if '--postpone_model' in args: |
227 | flaglist.append('store_model') |
228 | |
229 | + line_options = dict(arg[2:].split('=') for arg in args if arg.startswith('--') and '=' in arg) |
230 | main_file_name = "" |
231 | try: |
232 | main_file_name = args[args.index('-name') + 1] |
233 | @@ -7416,9 +7417,11 @@ |
234 | #Exporter + Template |
235 | if options['exporter'] == 'v4': |
236 | self._curr_exporter = export_v4.ExportV4Factory(self, noclean, |
237 | - group_subprocesses=group_processes) |
238 | + group_subprocesses=group_processes, |
239 | + cmd_options=line_options) |
240 | elif options['exporter'] == 'cpp': |
241 | - self._curr_exporter = export_cpp.ExportCPPFactory(self, group_subprocesses=group_processes) |
242 | + self._curr_exporter = export_cpp.ExportCPPFactory(self, group_subprocesses=group_processes, |
243 | + cmd_options=line_options) |
244 | |
245 | self._curr_exporter.pass_information_from_cmd(self) |
246 | |
247 | |
248 | === modified file 'madgraph/interface/reweight_interface.py' |
249 | --- madgraph/interface/reweight_interface.py 2017-03-03 10:07:55 +0000 |
250 | +++ madgraph/interface/reweight_interface.py 2017-07-29 19:33:46 +0000 |
251 | @@ -66,6 +66,7 @@ |
252 | |
253 | prompt = 'Reweight>' |
254 | debug_output = 'Reweight_debug' |
255 | + rwgt_dir_possibility = ['rw_me','rw_me_second','rw_mevirt','rw_mevirt_second'] |
256 | |
257 | @misc.mute_logger() |
258 | def __init__(self, event_path=None, allow_madspin=False, mother=None, *completekey, **stdin): |
259 | @@ -89,8 +90,10 @@ |
260 | |
261 | self.events_file = None |
262 | self.processes = {} |
263 | + self.f2pylib = {} |
264 | self.second_model = None |
265 | self.second_process = None |
266 | + self.dedicated_path = {} |
267 | self.mg5cmd = master_interface.MasterCmd() |
268 | if mother: |
269 | self.mg5cmd.options.update(mother.options) |
270 | @@ -198,6 +201,7 @@ |
271 | raise Exception, msg |
272 | process, option = mg_interface.MadGraphCmd.split_process_line(process) |
273 | self.proc_option = option |
274 | + self.is_decay = len(process.split('>',1)[0].split()) == 1 |
275 | |
276 | logger.info("process: %s" % process) |
277 | logger.info("options: %s" % option) |
278 | @@ -242,7 +246,7 @@ |
279 | r='QCD<=%i' % (int(ior[1])+1) |
280 | process=process+r+' ' |
281 | #handle special tag $ | / @ |
282 | - result = re.split('([/$@]|\w+(?:^2)?(?:=|<=|>)?\w+)', process, 1) |
283 | + result = re.split('([/$@]|\w+(?:^2)?(?:=|<=|>)+\w+)', process, 1) |
284 | if len(result) ==3: |
285 | process, split, rest = result |
286 | commandline+="add process %s pert_%s %s%s %s --no_warning=duplicate;" % (process, order.replace(' ','') ,split, rest, final) |
287 | @@ -344,6 +348,8 @@ |
288 | self.second_process.append(" ".join(args[1:-1])) |
289 | else: |
290 | self.second_process = [" ".join(args[1:])] |
291 | + elif args[0] in ['virtual_path', 'tree_path']: |
292 | + self.dedicated_path[args[0]] = args[1] |
293 | elif args[0] == "output": |
294 | if args[1] in ['default', '2.0', 'unweight']: |
295 | self.output_type = args[1] |
296 | @@ -429,36 +435,244 @@ |
297 | |
298 | model_line = self.banner.get('proc_card', 'full_model_line') |
299 | |
300 | - if not self.has_standalone_dir: |
301 | + if not self.has_standalone_dir: |
302 | if self.rwgt_dir and os.path.exists(pjoin(self.rwgt_dir,'rw_me','rwgt.pkl')): |
303 | self.load_from_pickle() |
304 | if not self.rwgt_dir: |
305 | self.me_dir = self.rwgt_dir |
306 | + self.load_module() |
307 | elif self.multicore == 'wait': |
308 | + i=0 |
309 | while not os.path.exists(pjoin(self.me_dir,'rw_me','rwgt.pkl')): |
310 | - time.sleep(60) |
311 | + time.sleep(10+i) |
312 | + i+=5 |
313 | print 'wait for pickle' |
314 | print "loading from pickle" |
315 | if not self.rwgt_dir: |
316 | self.rwgt_dir = self.me_dir |
317 | self.load_from_pickle(keep_name=True) |
318 | + self.load_module() |
319 | else: |
320 | - self.create_standalone_directory() |
321 | + self.create_standalone_directory() |
322 | + self.compile() |
323 | + self.load_module() |
324 | if self.multicore == 'create': |
325 | + self.load_module() |
326 | if not self.rwgt_dir: |
327 | self.rwgt_dir = self.me_dir |
328 | self.save_to_pickle() |
329 | |
330 | - if self.rwgt_dir: |
331 | - path_me =self.rwgt_dir |
332 | - else: |
333 | - path_me = self.me_dir |
334 | - |
335 | - if self.second_model or self.second_process: |
336 | - rw_dir = pjoin(path_me, 'rw_me_second') |
337 | - else: |
338 | - rw_dir = pjoin(path_me, 'rw_me') |
339 | - |
340 | + |
341 | + type_rwgt = self.get_weight_names() |
342 | + param_card_iterator, tag_name, output2 = self.handle_param_card(model_line, args, type_rwgt) |
343 | + |
344 | + if self.rwgt_dir: |
345 | + path_me =self.rwgt_dir |
346 | + else: |
347 | + path_me = self.me_dir |
348 | + |
349 | + if self.second_model or self.second_process or self.dedicated_path: |
350 | + rw_dir = pjoin(path_me, 'rw_me_second') |
351 | + else: |
352 | + rw_dir = pjoin(path_me, 'rw_me') |
353 | + |
354 | + |
355 | + start = time.time() |
356 | + cross, ratio, ratio_square,error = {},{},{}, {} |
357 | + for name in type_rwgt + ['orig']: |
358 | + cross[name], error[name] = 0.,0. |
359 | + ratio[name],ratio_square[name] = 0., 0.# to compute the variance and associate error |
360 | + |
361 | + if self.output_type == "default": |
362 | + output = open( self.lhe_input.name +'rw', 'w') |
363 | + #write the banner to the output file |
364 | + self.banner.write(output, close_tag=False) |
365 | + else: |
366 | + output = {} |
367 | + for name in type_rwgt: |
368 | + output[name] = open( self.lhe_input.name +'rw'+name, 'w') |
369 | + #write the banner to the output file |
370 | + self.banner.write(output[name], close_tag=False) |
371 | + |
372 | + |
373 | + if self.lhe_input.closed: |
374 | + self.lhe_input = lhe_parser.EventFile(self.lhe_input.name) |
375 | + |
376 | + self.lhe_input.seek(0) |
377 | + for event_nb,event in enumerate(self.lhe_input): |
378 | + #control logger |
379 | + if (event_nb % max(int(10**int(math.log10(float(event_nb)+1))),10)==0): |
380 | + running_time = misc.format_timer(time.time()-start) |
381 | + logger.info('Event nb %s %s' % (event_nb, running_time)) |
382 | + if (event_nb==10001): logger.info('reducing number of print status. Next status update in 10000 events') |
383 | + |
384 | + |
385 | + weight = self.calculate_weight(event) |
386 | + if not isinstance(weight, dict): |
387 | + weight = {'':weight} |
388 | + |
389 | + for name in weight: |
390 | + cross[name] += weight[name] |
391 | + ratio[name] += weight[name]/event.wgt |
392 | + ratio_square[name] += (weight[name]/event.wgt)**2 |
393 | + |
394 | + # ensure to have a consistent order of the weights. new one are put |
395 | + # at the back, remove old position if already defines |
396 | + for tag in type_rwgt: |
397 | + try: |
398 | + event.reweight_order.remove('%s%s' % (tag_name,tag)) |
399 | + except ValueError: |
400 | + continue |
401 | + |
402 | + event.reweight_order += ['%s%s' % (tag_name,name) for name in type_rwgt] |
403 | + if self.output_type == "default": |
404 | + for name in weight: |
405 | + if 'orig' in name: |
406 | + continue |
407 | + event.reweight_data['%s%s' % (tag_name,name)] = weight[name] |
408 | + #write this event with weight |
409 | + output.write(str(event)) |
410 | + if self.mother: |
411 | + event.wgt = weight[type_rwgt[0]] |
412 | + event.reweight_data = {} |
413 | + output2.write(str(event)) |
414 | + else: |
415 | + for i,name in enumerate(weight): |
416 | + event.wgt = weight[name] |
417 | + event.reweight_data = {} |
418 | + if self.mother and len(weight)==1: |
419 | + output2.write(str(event)) |
420 | + elif self.mother and i == 0: |
421 | + output[name].write(str(event)) |
422 | + output2.write(str(event)) |
423 | + else: |
424 | + output[name].write(str(event)) |
425 | + |
426 | + # check normalisation of the events: |
427 | + if 'event_norm' in self.run_card: |
428 | + if self.run_card['event_norm'] == 'average': |
429 | + for key, value in cross.items(): |
430 | + cross[key] = value / (event_nb+1) |
431 | + |
432 | + running_time = misc.format_timer(time.time()-start) |
433 | + logger.info('All event done (nb_event: %s) %s' % (event_nb+1, running_time)) |
434 | + |
435 | + |
436 | + if self.output_type == "default": |
437 | + output.write('</LesHouchesEvents>\n') |
438 | + output.close() |
439 | + else: |
440 | + for key in output: |
441 | + output[key].write('</LesHouchesEvents>\n') |
442 | + output.close() |
443 | + |
444 | + if self.mother: |
445 | + output2.write('</LesHouchesEvents>\n') |
446 | + output2.close() |
447 | + # add output information |
448 | + if hasattr(self.mother, 'results'): |
449 | + run_name = self.mother.run_name |
450 | + results = self.mother.results |
451 | + results.add_run(run_name, self.run_card, current=True) |
452 | + results.add_detail('nb_event', event_nb+1) |
453 | + name = type_rwgt[0] |
454 | + results.add_detail('cross', cross[name]) |
455 | + event_nb +=1 |
456 | + for name in type_rwgt: |
457 | + variance = ratio_square[name]/event_nb - (ratio[name]/event_nb)**2 |
458 | + orig_cross, orig_error = self.orig_cross |
459 | + error[name] = variance/math.sqrt(event_nb) * orig_cross + ratio[name]/event_nb * orig_error |
460 | + results.add_detail('error', error[type_rwgt[0]]) |
461 | + import madgraph.interface.madevent_interface as ME_interface |
462 | + if isinstance(self.mother, ME_interface.MadEventCmd): |
463 | + self.mother.create_plot(mode='reweight', event_path=output2.name, |
464 | + tag=self.run_card['run_tag']) |
465 | + #modify the html output to add the original run |
466 | + if 'plot' in results.current.reweight: |
467 | + html_dir = pjoin(self.mother.me_dir, 'HTML', run_name) |
468 | + td = pjoin(self.mother.options['td_path'], 'td') |
469 | + MA = pjoin(self.mother.options['madanalysis_path']) |
470 | + path1 = pjoin(html_dir, 'plots_parton') |
471 | + path2 = pjoin(html_dir, 'plots_%s' % self.run_card['run_tag']) |
472 | + outputplot = path2 |
473 | + combine_plots.merge_all_plots(path2, path1, outputplot, td, MA) |
474 | + #results.update_status(level='reweight') |
475 | + #results.update(status, level, makehtml=True, error=False) |
476 | + |
477 | + #old_name = self.mother.results.current['run_name'] |
478 | + #new_run = '%s_rw_%s' % (old_name, rewgtid) |
479 | + #self.mother.results.add_run( new_run, self.run_card) |
480 | + #self.mother.results.add_detail('nb_event', event_nb+1) |
481 | + #self.mother.results.add_detail('cross', cross) |
482 | + #self.mother.results.add_detail('error', 'nan') |
483 | + #self.mother.do_plot('%s -f' % new_run) |
484 | + #self.mother.update_status('Reweight %s done' % rewgtid, 'madspin') |
485 | + #self.mother.results.def_current(old_name) |
486 | + #self.run_card['run_tag'] = self.run_card['run_tag'][9:] |
487 | + #self.mother.run_name = old_name |
488 | + self.lhe_input.close() |
489 | + if not self.mother or self.output_type != "default" : |
490 | + target = pjoin(self.mother.me_dir, 'Events', run_name, 'events.lhe') |
491 | + else: |
492 | + target = self.lhe_input.name |
493 | + |
494 | + if self.output_type == "default": |
495 | + files.mv(output.name, target) |
496 | + logger.info('Event %s have now the additional weight' % self.lhe_input.name) |
497 | + elif self.output_type == "unweight": |
498 | + output2.close() |
499 | + lhe = lhe_parser.EventFile(output2.name) |
500 | + nb_event = lhe.unweight(target) |
501 | + if self.mother and hasattr(self.mother, 'results'): |
502 | + results = self.mother.results |
503 | + results.add_detail('nb_event', nb_event) |
504 | + results.current.parton.append('lhe') |
505 | + logger.info('Event %s is now unweighted under the new theory' % output2.name) |
506 | + else: |
507 | + files.mv(output2.name, self.lhe_input.name) |
508 | + if self.mother and hasattr(self.mother, 'results'): |
509 | + results = self.mother.results |
510 | + results.current.parton.append('lhe') |
511 | + logger.info('Event %s is now created with new central weight' % output2.name) |
512 | + |
513 | + if self.multicore != 'create': |
514 | + for name in cross: |
515 | + if name == 'orig': |
516 | + continue |
517 | + logger.info('new cross-section is %s: %g pb (indicative error: %g pb)' %\ |
518 | + ('(%s)' %name if name else '',cross[name], error[name])) |
519 | + |
520 | + self.terminate_fortran_executables(new_card_only=True) |
521 | + #store result |
522 | + for name in cross: |
523 | + if name == 'orig': |
524 | + self.all_cross_section[name] = (cross[name], error[name]) |
525 | + else: |
526 | + self.all_cross_section[(tag_name,name)] = (cross[name], error[name]) |
527 | + |
528 | + # perform the scanning |
529 | + if param_card_iterator: |
530 | + for i,card in enumerate(param_card_iterator): |
531 | + if self.options['rwgt_name']: |
532 | + self.options['rwgt_name'] = '%s_%s' % (self.options['rwgt_name'].rsplit('_',1)[0], i+1) |
533 | + card.write(pjoin(rw_dir, 'Cards', 'param_card.dat')) |
534 | + self.exec_cmd("launch --keep_card", printcmd=False, precmd=True) |
535 | + |
536 | + self.options['rwgt_name'] = None |
537 | + |
538 | + def handle_param_card(self, model_line, args, type_rwgt): |
539 | + |
540 | + if self.rwgt_dir: |
541 | + path_me =self.rwgt_dir |
542 | + else: |
543 | + path_me = self.me_dir |
544 | + |
545 | + if self.second_model or self.second_process or self.dedicated_path: |
546 | + rw_dir = pjoin(path_me, 'rw_me_second') |
547 | + else: |
548 | + rw_dir = pjoin(path_me, 'rw_me') |
549 | + |
550 | + |
551 | if not '--keep_card' in args: |
552 | ff = open(pjoin(rw_dir,'Cards', 'param_card.dat'), 'w') |
553 | ff.write(self.banner['slha']) |
554 | @@ -476,7 +690,7 @@ |
555 | self.stored_line = None |
556 | |
557 | # get the names of type of reweighting requested |
558 | - type_rwgt = self.get_weight_names() |
559 | + #type_rwgt = self.get_weight_names() |
560 | |
561 | # check for potential scan in the new card |
562 | new_card = open(pjoin(rw_dir, 'Cards', 'param_card.dat')).read() |
563 | @@ -499,7 +713,8 @@ |
564 | param_card_iterator = main_card |
565 | first_card = param_card_iterator.next(autostart=True) |
566 | new_card = first_card.write() |
567 | - first_card.write(pjoin(rw_dir, 'Cards', 'param_card.dat')) |
568 | + first_card.write(pjoin(rw_dir, 'Cards', 'param_card.dat')) |
569 | + |
570 | # check if "Auto" is present for a width parameter |
571 | if "auto" in new_card.lower(): |
572 | self.mother.check_param_card(pjoin(rw_dir, 'Cards', 'param_card.dat')) |
573 | @@ -556,16 +771,15 @@ |
574 | else: |
575 | tag = str(rewgtid) |
576 | |
577 | - if not self.second_model: |
578 | + if not self.second_model and not self.dedicated_path: |
579 | old_param = check_param_card.ParamCard(s_orig.splitlines()) |
580 | new_param = check_param_card.ParamCard(s_new.splitlines()) |
581 | card_diff = old_param.create_diff(new_param) |
582 | if card_diff == '' and not self.second_process: |
583 | - if not __debug__: |
584 | - logger.warning(' REWEIGHTING: original card and new card are identical. Bypass this run') |
585 | - return |
586 | - else: |
587 | - logger.warning(' REWEIGHTING: original card and new card are identical. Run it due to debug mode') |
588 | + logger.warning(' REWEIGHTING: original card and new card are identical.') |
589 | +# return |
590 | +# else: |
591 | +# logger.warning(' REWEIGHTING: original card and new card are identical. Run it due to debug mode') |
592 | #raise self.InvalidCmd, 'original card and new card are identical' |
593 | try: |
594 | if old_param['sminputs'].get(3)- new_param['sminputs'].get(3) > 1e-3 * new_param['sminputs'].get(3): |
595 | @@ -581,9 +795,15 @@ |
596 | for name in type_rwgt: |
597 | mg_rwgt_info.append((tag, name, str_proc + '\n'+ card_diff)) |
598 | else: |
599 | - str_info = "change model %s" % self.second_model |
600 | + if self.second_model: |
601 | + str_info = "change model %s" % self.second_model |
602 | + else: |
603 | + str_info ='' |
604 | if self.second_process: |
605 | str_info += "\n change process ".join([""]+self.second_process) |
606 | + if self.dedicated_path: |
607 | + for k,v in self.dedicated_path.items(): |
608 | + str_info += "\n change %s %s" % (k,v) |
609 | card_diff = str_info |
610 | str_info += '\n' + s_new |
611 | for name in type_rwgt: |
612 | @@ -602,23 +822,6 @@ |
613 | self.banner['initrwgt'] = self.banner['initrwgt'].replace('\n\n', '\n') |
614 | |
615 | |
616 | - start = time.time() |
617 | - cross, ratio, ratio_square,error = {},{},{}, {} |
618 | - for name in type_rwgt + ['orig']: |
619 | - cross[name], error[name] = 0.,0. |
620 | - ratio[name],ratio_square[name] = 0., 0.# to compute the variance and associate error |
621 | - |
622 | - if self.output_type == "default": |
623 | - output = open( self.lhe_input.name +'rw', 'w') |
624 | - #write the banner to the output file |
625 | - self.banner.write(output, close_tag=False) |
626 | - else: |
627 | - output = {} |
628 | - for name in type_rwgt: |
629 | - output[name] = open( self.lhe_input.name +'rw'+name, 'w') |
630 | - #write the banner to the output file |
631 | - self.banner.write(output[name], close_tag=False) |
632 | - |
633 | logger.info('starts to compute weight for events with the following modification to the param_card:') |
634 | logger.info(card_diff.replace('\n','\nKEEP:')) |
635 | # prepare the output file for the weight plot |
636 | @@ -640,195 +843,26 @@ |
637 | (self.mother.run_name, self.run_card['run_tag'])),'w') |
638 | new_banner.write(ff) |
639 | ff.close() |
640 | - |
641 | + |
642 | # Loop over all events |
643 | if self.options['rwgt_name']: |
644 | tag_name = self.options['rwgt_name'] |
645 | else: |
646 | tag_name = 'rwgt_%s' % rewgtid |
647 | - |
648 | - os.environ['GFORTRAN_UNBUFFERED_ALL'] = 'y' |
649 | - if self.lhe_input.closed: |
650 | - self.lhe_input = lhe_parser.EventFile(self.lhe_input.name) |
651 | - |
652 | -# Multicore option not really stable -> not use it |
653 | - nb_core = 1 |
654 | -# if nb_core >1: |
655 | -# multicore = cluster.MultiCore(nb_core) |
656 | - |
657 | - self.lhe_input.seek(0) |
658 | - for event_nb,event in enumerate(self.lhe_input): |
659 | - #control logger |
660 | - if (event_nb % max(int(10**int(math.log10(float(event_nb)+1))),10)==0): |
661 | - running_time = misc.format_timer(time.time()-start) |
662 | - logger.info('Event nb %s %s' % (event_nb, running_time)) |
663 | - if (event_nb==10001): logger.info('reducing number of print status. Next status update in 10000 events') |
664 | - |
665 | - if nb_core > 1: |
666 | - # Multicore option not really stable -> not use it |
667 | - while 1: |
668 | - if multicore.queue.qsize() < 100 * nb_core: |
669 | - multicore.submit(self.write_reweighted_event, argument=[event, tag_name]) |
670 | - break |
671 | - #else: |
672 | - # time.sleep(0.001) |
673 | - continue |
674 | - else: |
675 | - weight = self.calculate_weight(event) |
676 | - if not isinstance(weight, dict): |
677 | - weight = {'':weight} |
678 | - |
679 | - for name in weight: |
680 | - cross[name] += weight[name] |
681 | - ratio[name] += weight[name]/event.wgt |
682 | - ratio_square[name] += (weight[name]/event.wgt)**2 |
683 | - |
684 | - # ensure to have a consistent order of the weights. new one are put |
685 | - # at the back, remove old position if already defines |
686 | - for tag in type_rwgt: |
687 | - try: |
688 | - event.reweight_order.remove('%s%s' % (tag_name,tag)) |
689 | - except ValueError: |
690 | - continue |
691 | - |
692 | - event.reweight_order += ['%s%s' % (tag_name,name) for name in type_rwgt] |
693 | - if self.output_type == "default": |
694 | - for name in weight: |
695 | - if 'orig' in name: |
696 | - continue |
697 | - event.reweight_data['%s%s' % (tag_name,name)] = weight[name] |
698 | - #write this event with weight |
699 | - output.write(str(event)) |
700 | - if self.mother: |
701 | - event.wgt = weight[type_rwgt[0]] |
702 | - event.reweight_data = {} |
703 | - output2.write(str(event)) |
704 | + |
705 | + |
706 | + #initialise module. |
707 | + |
708 | + for (path,tag), module in self.f2pylib.items(): |
709 | + with misc.chdir(pjoin(os.path.dirname(rw_dir), path)): |
710 | +# with misc.stdchannel_redirected(sys.stdout, os.devnull): |
711 | + if 'second' in path or tag == 3: |
712 | + module.initialise(pjoin(rw_dir, 'Cards', 'param_card.dat')) |
713 | else: |
714 | - for i,name in enumerate(weight): |
715 | - event.wgt = weight[name] |
716 | - event.reweight_data = {} |
717 | - if self.mother and len(weight)==1: |
718 | - output2.write(str(event)) |
719 | - elif self.mother and i == 0: |
720 | - output[name].write(str(event)) |
721 | - output2.write(str(event)) |
722 | - else: |
723 | - output[name].write(str(event)) |
724 | - |
725 | - # check normalisation of the events: |
726 | - if 'event_norm' in self.run_card: |
727 | - if self.run_card['event_norm'] == 'average': |
728 | - for key, value in cross.items(): |
729 | - cross[key] = value / (event_nb+1) |
730 | - |
731 | - running_time = misc.format_timer(time.time()-start) |
732 | - logger.info('All event done (nb_event: %s) %s' % (event_nb+1, running_time)) |
733 | - |
734 | - |
735 | - if self.output_type == "default": |
736 | - output.write('</LesHouchesEvents>\n') |
737 | - output.close() |
738 | - else: |
739 | - for key in output: |
740 | - output[key].write('</LesHouchesEvents>\n') |
741 | - output.close() |
742 | - |
743 | - os.environ['GFORTRAN_UNBUFFERED_ALL'] = 'n' |
744 | - |
745 | - if self.mother: |
746 | - output2.write('</LesHouchesEvents>\n') |
747 | - output2.close() |
748 | - # add output information |
749 | - if hasattr(self.mother, 'results'): |
750 | - run_name = self.mother.run_name |
751 | - results = self.mother.results |
752 | - results.add_run(run_name, self.run_card, current=True) |
753 | - results.add_detail('nb_event', event_nb+1) |
754 | - name = type_rwgt[0] |
755 | - results.add_detail('cross', cross[name]) |
756 | - event_nb +=1 |
757 | - for name in type_rwgt: |
758 | - variance = ratio_square[name]/event_nb - (ratio[name]/event_nb)**2 |
759 | - orig_cross, orig_error = self.orig_cross |
760 | - error[name] = variance/math.sqrt(event_nb) * orig_cross + ratio[name]/event_nb * orig_error |
761 | - results.add_detail('error', error[type_rwgt[0]]) |
762 | - import madgraph.interface.madevent_interface as ME_interface |
763 | - if isinstance(self.mother, ME_interface.MadEventCmd): |
764 | - self.mother.create_plot(mode='reweight', event_path=output2.name, |
765 | - tag=self.run_card['run_tag']) |
766 | - #modify the html output to add the original run |
767 | - if 'plot' in results.current.reweight: |
768 | - html_dir = pjoin(self.mother.me_dir, 'HTML', run_name) |
769 | - td = pjoin(self.mother.options['td_path'], 'td') |
770 | - MA = pjoin(self.mother.options['madanalysis_path']) |
771 | - path1 = pjoin(html_dir, 'plots_parton') |
772 | - path2 = pjoin(html_dir, 'plots_%s' % self.run_card['run_tag']) |
773 | - outputplot = path2 |
774 | - combine_plots.merge_all_plots(path2, path1, outputplot, td, MA) |
775 | - #results.update_status(level='reweight') |
776 | - #results.update(status, level, makehtml=True, error=False) |
777 | - |
778 | - #old_name = self.mother.results.current['run_name'] |
779 | - #new_run = '%s_rw_%s' % (old_name, rewgtid) |
780 | - #self.mother.results.add_run( new_run, self.run_card) |
781 | - #self.mother.results.add_detail('nb_event', event_nb+1) |
782 | - #self.mother.results.add_detail('cross', cross) |
783 | - #self.mother.results.add_detail('error', 'nan') |
784 | - #self.mother.do_plot('%s -f' % new_run) |
785 | - #self.mother.update_status('Reweight %s done' % rewgtid, 'madspin') |
786 | - #self.mother.results.def_current(old_name) |
787 | - #self.run_card['run_tag'] = self.run_card['run_tag'][9:] |
788 | - #self.mother.run_name = old_name |
789 | - self.lhe_input.close() |
790 | - if not self.mother or self.output_type != "default" : |
791 | - target = pjoin(self.mother.me_dir, 'Events', run_name, 'events.lhe') |
792 | - else: |
793 | - target = self.lhe_input.name |
794 | - |
795 | - if self.output_type == "default": |
796 | - files.mv(output.name, target) |
797 | - logger.info('Event %s have now the additional weight' % self.lhe_input.name) |
798 | - elif self.output_type == "unweight": |
799 | - output2.close() |
800 | - lhe = lhe_parser.EventFile(output2.name) |
801 | - nb_event = lhe.unweight(target) |
802 | - if self.mother and hasattr(self.mother, 'results'): |
803 | - results = self.mother.results |
804 | - results.add_detail('nb_event', nb_event) |
805 | - results.current.parton.append('lhe') |
806 | - logger.info('Event %s is now unweighted under the new theory' % output2.name) |
807 | - else: |
808 | - files.mv(output2.name, self.lhe_input.name) |
809 | - if self.mother and hasattr(self.mother, 'results'): |
810 | - results = self.mother.results |
811 | - results.current.parton.append('lhe') |
812 | - logger.info('Event %s is now created with new central weight' % output2.name) |
813 | - |
814 | - if self.multicore != 'create': |
815 | - for name in cross: |
816 | - if name == 'orig': |
817 | - continue |
818 | - logger.info('new cross-section is %s: %g pb (indicative error: %g pb)' %\ |
819 | - ('(%s)' %name if name else '',cross[name], error[name])) |
820 | - |
821 | - self.terminate_fortran_executables(new_card_only=True) |
822 | - #store result |
823 | - for name in cross: |
824 | - if name == 'orig': |
825 | - self.all_cross_section[name] = (cross[name], error[name]) |
826 | - else: |
827 | - self.all_cross_section[(tag_name,name)] = (cross[name], error[name]) |
828 | - |
829 | - # perform the scanning |
830 | - if param_card_iterator: |
831 | - for i,card in enumerate(param_card_iterator): |
832 | - if self.options['rwgt_name']: |
833 | - self.options['rwgt_name'] = '%s_%s' % (self.options['rwgt_name'].rsplit('_',1)[0], i+1) |
834 | - card.write(pjoin(rw_dir, 'Cards', 'param_card.dat')) |
835 | - self.exec_cmd("launch --keep_card", printcmd=False, precmd=True) |
836 | - |
837 | - self.options['rwgt_name'] = None |
838 | + module.initialise(pjoin(path_me, 'rw_me', 'Cards', 'param_card_orig.dat')) |
839 | + return param_card_iterator, tag_name, output2 |
840 | |
841 | + |
842 | def do_set(self, line): |
843 | "Not in help" |
844 | |
845 | @@ -882,19 +916,18 @@ |
846 | def do_compute_widths(self, line): |
847 | return self.mother.do_compute_widths(line) |
848 | |
849 | - def calculate_weight(self, event, space=None): |
850 | + def calculate_weight(self, event): |
851 | """space defines where to find the calculator (in multicore)""" |
852 | |
853 | if self.has_nlo and self.rwgt_mode != "LO": |
854 | - return self.calculate_nlo_weight(event, space) |
855 | + return self.calculate_nlo_weight(event) |
856 | |
857 | - if not space: |
858 | - space = self |
859 | event.parse_reweight() |
860 | |
861 | # LO reweighting |
862 | - w_orig = self.calculate_matrix_element(event, 0, space) |
863 | - w_new = self.calculate_matrix_element(event, 1, space) |
864 | + w_orig = self.calculate_matrix_element(event, 0) |
865 | + w_new = self.calculate_matrix_element(event, 1) |
866 | + |
867 | if w_orig == 0: |
868 | tag, order = event.get_tag_and_order() |
869 | orig_order, Pdir, hel_dict = self.id_to_path[tag] |
870 | @@ -913,14 +946,11 @@ |
871 | |
872 | return {'orig': event.wgt, '': w_new/w_orig*event.wgt} |
873 | |
874 | - def calculate_nlo_weight(self, event, space=None): |
875 | + def calculate_nlo_weight(self, event): |
876 | |
877 | |
878 | type_nlo = self.get_weight_names() |
879 | final_weight = {'orig': event.wgt} |
880 | - |
881 | - if not space: |
882 | - space = self #for multicore: not use so far |
883 | |
884 | event.parse_reweight() |
885 | event.parse_nlo_weight() |
886 | @@ -944,20 +974,20 @@ |
887 | if '_nlo' in type_nlo and any(c in all_ctype for c in [2,14,15]): |
888 | need_V =True |
889 | |
890 | - w_orig = self.calculate_matrix_element(cevent, 0, space) |
891 | - w_new = self.calculate_matrix_element(cevent, 1, space) |
892 | + w_orig = self.calculate_matrix_element(cevent, 0) |
893 | + w_new = self.calculate_matrix_element(cevent, 1) |
894 | ratio_T = w_new/w_orig |
895 | if need_V: |
896 | scale2 = cevent.wgts[0].scales2[0] |
897 | #for scale2 in set(c.scales2[1] for c in cevent.wgts): |
898 | - w_origV = self.calculate_matrix_element(cevent, 'V0', space, scale2=scale2) |
899 | - w_newV = self.calculate_matrix_element(cevent, 'V1', space, scale2=scale2) |
900 | + w_origV = self.calculate_matrix_element(cevent, 'V0', scale2=scale2) |
901 | + w_newV = self.calculate_matrix_element(cevent, 'V1', scale2=scale2) |
902 | ratio_BV = (w_newV + w_new) / (w_origV + w_orig) |
903 | ratio_V = w_newV/w_origV |
904 | else: |
905 | ratio_V = "should not be used" |
906 | ratio_BV = "should not be used" |
907 | - |
908 | + |
909 | for c_wgt in cevent.wgts: |
910 | orig_wgt += c_wgt.ref_wgt |
911 | #add the information to the input |
912 | @@ -1018,8 +1048,8 @@ |
913 | final_weight['_tree'] = new_out/orig_wgt*event.wgt |
914 | |
915 | if '_lo' in type_nlo: |
916 | - w_orig = self.calculate_matrix_element(event, 0, space) |
917 | - w_new = self.calculate_matrix_element(event, 1, space) |
918 | + w_orig = self.calculate_matrix_element(event, 0) |
919 | + w_new = self.calculate_matrix_element(event, 1) |
920 | final_weight['_lo'] = w_new/w_orig*event.wgt |
921 | |
922 | return final_weight |
923 | @@ -1045,7 +1075,7 @@ |
924 | open(pjoin(Pdir, 'matrix%spy.so' % tag),'w').write(open(pjoin(Pdir, 'matrix2py.so') |
925 | ).read().replace('matrix2py', 'matrix%spy' % tag)) |
926 | |
927 | - def calculate_matrix_element(self, event, hypp_id, space, scale2=0): |
928 | + def calculate_matrix_element(self, event, hypp_id, scale2=0): |
929 | """routine to return the matrix element""" |
930 | |
931 | if self.has_nlo: |
932 | @@ -1057,130 +1087,23 @@ |
933 | if isinstance(hypp_id, str) and hypp_id.startswith('V'): |
934 | tag = (tag,'V') |
935 | hypp_id = int(hypp_id[1:]) |
936 | - base = "rw_mevirt" |
937 | - else: |
938 | - base = "rw_me" |
939 | + # base = "rw_mevirt" |
940 | + #else: |
941 | + # base = "rw_me" |
942 | |
943 | - if (not self.second_model and not self.second_process) or hypp_id==0: |
944 | + if (not self.second_model and not self.second_process and not self.dedicated_path) or hypp_id==0: |
945 | orig_order, Pdir, hel_dict = self.id_to_path[tag] |
946 | else: |
947 | orig_order, Pdir, hel_dict = self.id_to_path_second[tag] |
948 | |
949 | - |
950 | - run_id = (tag, hypp_id) |
951 | - |
952 | - assert space == self |
953 | - start = False |
954 | - if run_id in space.calculator: |
955 | - external = space.calculator[run_id] |
956 | - # mod = space.calculator[(run_id,'module')] |
957 | - # #with misc.chdir(Pdir): |
958 | - # # if hypp_id==0: |
959 | - # # mod.initialise('param_card_orig.dat') |
960 | - # # else: |
961 | - # # mod.initialise('param_card.dat') |
962 | - elif (not self.second_model and not self.second_process) or hypp_id==0: |
963 | - # create the executable for this param_card |
964 | - subdir = pjoin(self.me_dir, base, 'SubProcesses') |
965 | - if self.me_dir not in sys.path: |
966 | - sys.path.insert(0,self.me_dir) |
967 | - if self.rwgt_dir and self.rwgt_dir not in sys.path: |
968 | - sys.path.insert(0,self.rwgt_dir) |
969 | - Pname = os.path.basename(Pdir) |
970 | - if hypp_id == 0: |
971 | - if (Pdir, 0) not in dir_to_f2py_free_mod: |
972 | - metag = 1 |
973 | - dir_to_f2py_free_mod[(Pdir,0)] = (metag, nb_f2py_module) |
974 | - else: |
975 | - metag, old_module = dir_to_f2py_free_mod[(Pdir,0)] |
976 | - if old_module != nb_f2py_module: |
977 | - metag += 1 |
978 | - dir_to_f2py_free_mod[(Pdir,0)] = (metag, nb_f2py_module) |
979 | - os.environ['MENUM'] = '2' |
980 | - if not self.rwgt_dir or not os.path.exists(pjoin(Pdir, 'matrix2py.so')): |
981 | - misc.multiple_try(nb_retry,sleep)(misc.compile)(['matrix2py.so'], cwd=Pdir) |
982 | - self.rename_f2py_lib(Pdir, 2*metag) |
983 | - try: |
984 | - mymod = __import__('%s.SubProcesses.%s.matrix%spy' % (base, Pname, 2*metag), globals(), locals(), [],-1) |
985 | - except: |
986 | - import platform |
987 | - if platform.system() == 'Darwin': |
988 | - os.system('install_name_tool -change libMadLoop.dylib %s/libMadLoop.dylib matrix%spy.so' % (Pdir,2*metag)) |
989 | - mymod = __import__('%s.SubProcesses.%s.matrix%spy' % (base, Pname, 2*metag), globals(), locals(), [],-1) |
990 | - else: |
991 | - misc.sprint("fail compilation") |
992 | - raise |
993 | - S = mymod.SubProcesses |
994 | - P = getattr(S, Pname) |
995 | - mymod = getattr(P, 'matrix%spy' % (2*metag)) |
996 | - with misc.chdir(Pdir): |
997 | - with misc.stdchannel_redirected(sys.stdout, os.devnull): |
998 | - mymod.initialise('param_card_orig.dat') |
999 | - |
1000 | - |
1001 | - if hypp_id == 1: |
1002 | - #incorrect line |
1003 | - metag = dir_to_f2py_free_mod[(Pdir,0)][0] |
1004 | - newtag = 2*metag+1 |
1005 | - self.rename_f2py_lib(Pdir, newtag) |
1006 | - try: |
1007 | - mymod = __import__('%s.SubProcesses.%s.matrix%spy' % (base, Pname, newtag), globals(), locals(), [],-1) |
1008 | - except Exception, error: |
1009 | - newtag = "L%s" % newtag |
1010 | - os.environ['MENUM'] = newtag |
1011 | - misc.multiple_try(nb_retry,sleep)(misc.compile)(['matrix%spy.so' % newtag], cwd=Pdir) |
1012 | - mymod = __import__('%s.SubProcesses.%s.matrix%spy' % (base, Pname, newtag), globals(), locals(), [],-1) |
1013 | - |
1014 | - S = mymod.SubProcesses |
1015 | - P = getattr(S, Pname) |
1016 | - mymod = getattr(P, 'matrix%spy' % newtag) |
1017 | - with misc.chdir(Pdir): |
1018 | - with misc.stdchannel_redirected(sys.stdout, os.devnull): |
1019 | - mymod.initialise('param_card.dat') |
1020 | - |
1021 | - space.calculator[run_id] = mymod.get_me |
1022 | - space.calculator[(run_id,'module')] = mymod |
1023 | - external = space.calculator[run_id] |
1024 | + base = os.path.basename(os.path.dirname(Pdir)) |
1025 | + if '_second' in base: |
1026 | + moduletag = (base, 2) |
1027 | else: |
1028 | - subdir = pjoin(self.me_dir,'%s_second' % base, 'SubProcesses') |
1029 | - if self.me_dir not in sys.path: |
1030 | - sys.path.append(self.me_dir) |
1031 | - |
1032 | - assert hypp_id == 1 |
1033 | - Pname = os.path.basename(Pdir) |
1034 | - os.environ['MENUM'] = '2' |
1035 | - if not self.rwgt_dir or not os.path.exists(pjoin(Pdir, 'matrix2py.so')): |
1036 | - misc.multiple_try(nb_retry,sleep)(misc.compile)(['matrix2py.so'], cwd=pjoin(subdir, Pdir)) |
1037 | - if (Pdir, 1) not in dir_to_f2py_free_mod: |
1038 | - metag = 1 |
1039 | - dir_to_f2py_free_mod[(Pdir,1)] = (metag, nb_f2py_module) |
1040 | - else: |
1041 | - metag, old_module = dir_to_f2py_free_mod[(Pdir,1)] |
1042 | - if old_module != nb_f2py_module: |
1043 | - metag += 1 |
1044 | - dir_to_f2py_free_mod[(Pdir,1)] = (metag, nb_f2py_module) |
1045 | - self.rename_f2py_lib(Pdir, metag) |
1046 | - try: |
1047 | - mymod = __import__("%s_second.SubProcesses.%s.matrix%spy" % (base, Pname, metag)) |
1048 | - except ImportError: |
1049 | - metag = "L%s" % metag |
1050 | - os.environ['MENUM'] = str(metag) |
1051 | - misc.multiple_try(nb_retry,sleep)(misc.compile)(['matrix%spy.so' % metag], cwd=pjoin(subdir, Pdir)) |
1052 | - mymod = __import__("%s_second.SubProcesses.%s.matrix%spy" % (base, Pname, metag)) |
1053 | - |
1054 | - reload(mymod) |
1055 | - S = mymod.SubProcesses |
1056 | - P = getattr(S, Pname) |
1057 | - mymod = getattr(P, 'matrix%spy' % metag) |
1058 | - with misc.chdir(Pdir): |
1059 | - with misc.stdchannel_redirected(sys.stdout, os.devnull): |
1060 | - mymod.initialise('param_card.dat') |
1061 | - space.calculator[run_id] = mymod.get_me |
1062 | - space.calculator[(run_id,'module')] = mymod |
1063 | - external = space.calculator[run_id] |
1064 | + moduletag = (base, 2+hypp_id) |
1065 | |
1066 | + module = self.f2pylib[moduletag] |
1067 | |
1068 | - |
1069 | p = event.get_momenta(orig_order) |
1070 | # add helicity information |
1071 | |
1072 | @@ -1192,26 +1115,18 @@ |
1073 | pboost = lhe_parser.FourMomentum(p[0]) + lhe_parser.FourMomentum(p[1]) |
1074 | for i,thisp in enumerate(p): |
1075 | p[i] = lhe_parser.FourMomentum(thisp).zboost(pboost).get_tuple() |
1076 | - assert p[0][1] == p[0][2] == 0 == p[1][2] == p[1][2] == 0 |
1077 | - |
1078 | - |
1079 | + assert p[0][1] == p[0][2] == 0 == p[1][2] == p[1][2] == 0 |
1080 | else: |
1081 | - nhel = 0 |
1082 | + nhel = -1 |
1083 | pold = list(p) |
1084 | p = self.invert_momenta(p) |
1085 | + pdg = list(orig_order[0])+list(orig_order[1]) |
1086 | |
1087 | with misc.chdir(Pdir): |
1088 | with misc.stdchannel_redirected(sys.stdout, os.devnull): |
1089 | - if 'V' in tag or \ |
1090 | - (hypp_id ==1 and self.second_process and any('sqrvirt' in l for l in self.second_process)): |
1091 | - me_value = external(p,event.aqcd, math.sqrt(scale2), nhel) |
1092 | - else: |
1093 | - try: |
1094 | - me_value = external(p,event.aqcd, nhel) |
1095 | - except TypeError: |
1096 | - me_value = external(p,event.aqcd, math.sqrt(scale2), nhel) |
1097 | - |
1098 | - # for NLO we have also the stability status code |
1099 | + me_value = module.smatrixhel(pdg,p, event.aqcd, scale2, nhel) |
1100 | + |
1101 | + # for loop we have also the stability status code |
1102 | if isinstance(me_value, tuple): |
1103 | me_value, code = me_value |
1104 | #if code points unstability -> returns 0 |
1105 | @@ -1277,6 +1192,226 @@ |
1106 | |
1107 | |
1108 | @misc.mute_logger() |
1109 | + def create_standalone_tree_directory(self, data ,second=False): |
1110 | + """generate the various directory for the weight evaluation""" |
1111 | + |
1112 | + mgcmd = self.mg5cmd |
1113 | + path_me = data['path'] |
1114 | + # 2. compute the production matrix element ----------------------------- |
1115 | + has_nlo = False |
1116 | + mgcmd.exec_cmd("set group_subprocesses False") |
1117 | + |
1118 | + if not second: |
1119 | + logger.info('generating the square matrix element for reweighting') |
1120 | + else: |
1121 | + logger.info('generating the square matrix element for reweighting (second model and/or processes)') |
1122 | + start = time.time() |
1123 | + commandline='' |
1124 | + for i,proc in enumerate(data['processes']): |
1125 | + if '[' not in proc: |
1126 | + commandline += "add process %s ;" % proc |
1127 | + else: |
1128 | + has_nlo = True |
1129 | + if self.banner.get('run_card','ickkw') == 3: |
1130 | + if len(proc) == min([len(p.strip()) for p in data['processes']]): |
1131 | + commandline += self.get_LO_definition_from_NLO(proc, self.model) |
1132 | + else: |
1133 | + commandline += self.get_LO_definition_from_NLO(proc, |
1134 | + self.model, real_only=True) |
1135 | + else: |
1136 | + commandline += self.get_LO_definition_from_NLO(proc, self.model) |
1137 | + |
1138 | + commandline = commandline.replace('add process', 'generate',1) |
1139 | + logger.info(commandline) |
1140 | + try: |
1141 | + mgcmd.exec_cmd(commandline, precmd=True, errorhandling=False) |
1142 | + except diagram_generation.NoDiagramException: |
1143 | + commandline='' |
1144 | + for proc in data['processes']: |
1145 | + if '[' not in proc: |
1146 | + raise |
1147 | + # pass to virtsq= |
1148 | + base, post = proc.split('[',1) |
1149 | + nlo_order, post = post.split(']',1) |
1150 | + if '=' not in nlo_order: |
1151 | + nlo_order = 'virt=%s' % nlo_order |
1152 | + elif 'noborn' in nlo_order: |
1153 | + nlo_order = nlo_order.replace('noborn', 'virt') |
1154 | + commandline += "add process %s [%s] %s;" % (base,nlo_order,post) |
1155 | + commandline = commandline.replace('add process', 'generate',1) |
1156 | + logger.info("RETRY with %s", commandline) |
1157 | + mgcmd.exec_cmd(commandline, precmd=True) |
1158 | + has_nlo = False |
1159 | + except Exception, error: |
1160 | + raise |
1161 | + |
1162 | + commandline = 'output standalone_rw %s --prefix=int' % pjoin(path_me,data['paths'][0]) |
1163 | + mgcmd.exec_cmd(commandline, precmd=True) |
1164 | + logger.info('Done %.4g' % (time.time()-start)) |
1165 | + self.has_standalone_dir = True |
1166 | + |
1167 | + |
1168 | + # 3. Store id to directory information --------------------------------- |
1169 | + if False: |
1170 | + # keep this for debugging |
1171 | + matrix_elements = mgcmd._curr_matrix_elements.get_matrix_elements() |
1172 | + |
1173 | + to_check = [] # list of tag that do not have a Pdir at creation time. |
1174 | + for me in matrix_elements: |
1175 | + for proc in me.get('processes'): |
1176 | + initial = [] #filled in the next line |
1177 | + final = [l.get('id') for l in proc.get('legs')\ |
1178 | + if l.get('state') or initial.append(l.get('id'))] |
1179 | + order = (initial, final) |
1180 | + tag = proc.get_initial_final_ids() |
1181 | + decay_finals = proc.get_final_ids_after_decay() |
1182 | + |
1183 | + if tag[1] != decay_finals: |
1184 | + order = (initial, list(decay_finals)) |
1185 | + decay_finals.sort() |
1186 | + tag = (tag[0], tuple(decay_finals)) |
1187 | + Pdir = pjoin(path_me, data['paths'][0], 'SubProcesses', |
1188 | + 'P%s' % me.get('processes')[0].shell_string()) |
1189 | + |
1190 | + if not os.path.exists(Pdir): |
1191 | + to_check.append(tag) |
1192 | + continue |
1193 | + if tag in data['id2path']: |
1194 | + if not Pdir == data['id2path'][tag][1]: |
1195 | + misc.sprint(tag, Pdir, data['id2path'][tag][1]) |
1196 | + raise self.InvalidCmd, '2 different process have the same final states. This module can not handle such situation' |
1197 | + else: |
1198 | + continue |
1199 | + # build the helicity dictionary |
1200 | + hel_nb = 0 |
1201 | + hel_dict = {9:0} # unknown helicity -> use full ME |
1202 | + for helicities in me.get_helicity_matrix(): |
1203 | + hel_nb +=1 #fortran starts at 1 |
1204 | + hel_dict[tuple(helicities)] = hel_nb |
1205 | + |
1206 | + data['id2path'][tag] = [order, Pdir, hel_dict] |
1207 | + |
1208 | + for tag in to_check: |
1209 | + if tag not in self.id_to_path: |
1210 | + logger.warning("no valid path for %s" % (tag,)) |
1211 | + #raise self.InvalidCmd, "no valid path for %s" % (tag,) |
1212 | + |
1213 | + # 4. Check MadLoopParam for Loop induced |
1214 | + if os.path.exists(pjoin(path_me, data['paths'][0], 'Cards', 'MadLoopParams.dat')): |
1215 | + MLCard = banner.MadLoopParam(pjoin(path_me, data['paths'][0], 'Cards', 'MadLoopParams.dat')) |
1216 | + MLCard.set('WriteOutFilters', False) |
1217 | + MLCard.set('UseLoopFilter', False) |
1218 | + MLCard.set("DoubleCheckHelicityFilter", False) |
1219 | + MLCard.set("HelicityFilterLevel", 0) |
1220 | + MLCard.write(pjoin(path_me, data['paths'][0], 'SubProcesses', 'MadLoopParams.dat'), |
1221 | + pjoin(path_me, data['paths'][0], 'Cards', 'MadLoopParams.dat'), |
1222 | + commentdefault=False) |
1223 | + |
1224 | + #if self.multicore == 'create': |
1225 | + # print "compile OLP", data['paths'][0] |
1226 | + # misc.compile(['OLP_static'], cwd=pjoin(path_me, data['paths'][0],'SubProcesses'), |
1227 | + # nb_core=self.mother.options['nb_core']) |
1228 | + |
1229 | + if os.path.exists(pjoin(path_me, data['paths'][1], 'Cards', 'MadLoopParams.dat')): |
1230 | + if self.multicore == 'create': |
1231 | + print "compile OLP", data['paths'][1] |
1232 | + # It is potentially unsafe to use several cores, We limit ourself to one for now |
1233 | + # n_cores = self.mother.options['nb_core'] |
1234 | + n_cores = 1 |
1235 | + misc.compile(['OLP_static'], cwd=pjoin(path_me, data['paths'][1],'SubProcesses'), |
1236 | + nb_core=self.mother.options['nb_core']) |
1237 | + |
1238 | + return has_nlo |
1239 | + |
1240 | + |
1241 | + @misc.mute_logger() |
1242 | + def create_standalone_virt_directory(self, data ,second=False): |
1243 | + """generate the various directory for the weight evaluation""" |
1244 | + |
1245 | + mgcmd = self.mg5cmd |
1246 | + path_me = data['path'] |
1247 | + # Do not pass here for LO/NLO_tree |
1248 | + start = time.time() |
1249 | + commandline='' |
1250 | + for proc in data['processes']: |
1251 | + if '[' not in proc: |
1252 | + pass |
1253 | + else: |
1254 | + proc = proc.replace('[', '[ virt=') |
1255 | + commandline += "add process %s ;" % proc |
1256 | + # deactivate golem since it creates troubles |
1257 | + old_options = dict(mgcmd.options) |
1258 | + if mgcmd.options['golem'] or mgcmd.options['pjfry']: |
1259 | + logger.info(" When doing NLO reweighting, MG5aMC cannot use the loop reduction algorithms Golem and/or PJFry++") |
1260 | + mgcmd.options['golem'] = None |
1261 | + mgcmd.options['pjfry'] = None |
1262 | + commandline = commandline.replace('add process', 'generate',1) |
1263 | + logger.info(commandline) |
1264 | + mgcmd.exec_cmd(commandline, precmd=True) |
1265 | + commandline = 'output standalone_rw %s --prefix=int -f' % pjoin(path_me, data['paths'][1]) |
1266 | + mgcmd.exec_cmd(commandline, precmd=True) |
1267 | + |
1268 | + #put back golem to original value |
1269 | + mgcmd.options['golem'] = old_options['golem'] |
1270 | + mgcmd.options['pjfry'] = old_options['pjfry'] |
1271 | + # update make_opts |
1272 | + m_opts = {} |
1273 | + if mgcmd.options['lhapdf']: |
1274 | + #lhapdfversion = subprocess.Popen([mgcmd.options['lhapdf'], '--version'], |
1275 | + # stdout = subprocess.PIPE).stdout.read().strip()[0] |
1276 | + m_opts['lhapdf'] = True |
1277 | + m_opts['f2pymode'] = True |
1278 | + m_opts['lhapdfversion'] = 5 # 6 always fail on my computer since 5 is compatible but slower always use 5 |
1279 | + m_opts['llhapdf'] = self.mother.get_lhapdf_libdir() |
1280 | + else: |
1281 | + raise Exception, "NLO reweighting requires LHAPDF to work correctly" |
1282 | + |
1283 | + path = pjoin(path_me,data['paths'][1], 'Source', 'make_opts') |
1284 | + common_run_interface.CommonRunCmd.update_make_opts_full(path, m_opts) |
1285 | + logger.info('Done %.4g' % (time.time()-start)) |
1286 | + |
1287 | + |
1288 | + # Download LHAPDF SET |
1289 | + common_run_interface.CommonRunCmd.install_lhapdf_pdfset_static(\ |
1290 | + mgcmd.options['lhapdf'], None, self.banner.run_card.get_lhapdf_id()) |
1291 | + |
1292 | + # now store the id information |
1293 | + if False: |
1294 | + # keep it for debugging purposes |
1295 | + matrix_elements = mgcmd._curr_matrix_elements.get_matrix_elements() |
1296 | + for me in matrix_elements: |
1297 | + for proc in me.get('processes'): |
1298 | + initial = [] #filled in the next line |
1299 | + final = [l.get('id') for l in proc.get('legs')\ |
1300 | + if l.get('state') or initial.append(l.get('id'))] |
1301 | + order = (initial, final) |
1302 | + tag = proc.get_initial_final_ids() |
1303 | + decay_finals = proc.get_final_ids_after_decay() |
1304 | + |
1305 | + if tag[1] != decay_finals: |
1306 | + order = (initial, list(decay_finals)) |
1307 | + decay_finals.sort() |
1308 | + tag = (tag[0], tuple(decay_finals)) |
1309 | + Pdir = pjoin(path_me, data['paths'][1], 'SubProcesses', |
1310 | + 'P%s' % me.get('processes')[0].shell_string()) |
1311 | + assert os.path.exists(Pdir), "Pdir %s do not exists" % Pdir |
1312 | + if (tag,'V') in data['id2path']: |
1313 | + if not Pdir == data['id2path'][(tag,'V')][1]: |
1314 | + misc.sprint(tag, Pdir, self.id_to_path[(tag,'V')][1]) |
1315 | + raise self.InvalidCmd, '2 different process have the same final states. This module can not handle such situation' |
1316 | + else: |
1317 | + continue |
1318 | + # build the helicity dictionary |
1319 | + hel_nb = 0 |
1320 | + hel_dict = {9:0} # unknown helicity -> use full ME |
1321 | + for helicities in me.get_helicity_matrix(): |
1322 | + hel_nb +=1 #fortran starts at 1 |
1323 | + hel_dict[tuple(helicities)] = hel_nb |
1324 | + |
1325 | + data['id2path'][(tag,'V')] = [order, Pdir, hel_dict] |
1326 | + |
1327 | + |
1328 | + @misc.mute_logger() |
1329 | def create_standalone_directory(self, second=False): |
1330 | """generate the various directory for the weight evaluation""" |
1331 | |
1332 | @@ -1296,8 +1431,8 @@ |
1333 | data['processes'] += [' '.join(line.split()[2:]) for line in self.banner.proc_card |
1334 | if re.search('^\s*add\s+process', line)] |
1335 | #object_collector |
1336 | - self.id_to_path = {} |
1337 | - data['id2path'] = self.id_to_path |
1338 | + #self.id_to_path = {} |
1339 | + #data['id2path'] = self.id_to_path |
1340 | else: |
1341 | data['paths'] = ['rw_me_second', 'rw_mevirt_second'] |
1342 | # model |
1343 | @@ -1322,14 +1457,15 @@ |
1344 | for line in self.banner.proc_card |
1345 | if re.search('^\s*add\s+process', line)] |
1346 | #object_collector |
1347 | - self.id_to_path_second = {} |
1348 | - data['id2path'] = self.id_to_path_second |
1349 | + #self.id_to_path_second = {} |
1350 | + #data['id2path'] = self.id_to_path_second |
1351 | |
1352 | # 0. clean previous run ------------------------------------------------ |
1353 | if not self.rwgt_dir: |
1354 | path_me = self.me_dir |
1355 | else: |
1356 | path_me = self.rwgt_dir |
1357 | + data['path'] = path_me |
1358 | try: |
1359 | shutil.rmtree(pjoin(path_me,data['paths'][0])) |
1360 | except Exception: |
1361 | @@ -1374,229 +1510,45 @@ |
1362 | for name, content in self.banner.get('proc_card', 'multiparticles'): |
1363 | mgcmd.exec_cmd("define %s = %s" % (name, content)) |
1364 | |
1365 | - # 2. compute the production matrix element ----------------------------- |
1366 | - has_nlo = False |
1367 | - mgcmd.exec_cmd("set group_subprocesses False") |
1368 | - |
1369 | - if not second: |
1370 | - logger.info('generating the square matrix element for reweighting') |
1371 | + if second and 'tree_path' in self.dedicated_path: |
1372 | + files.ln(self.dedicated_path['tree_path'], path_me,name=data['paths'][0]) |
1373 | + if 'virtual_path' in self.dedicated_path: |
1374 | + has_nlo=True |
1375 | + else: |
1376 | + has_nlo=False |
1377 | else: |
1378 | - logger.info('generating the square matrix element for reweighting (second model and/or processes)') |
1379 | - start = time.time() |
1380 | - commandline='' |
1381 | - for i,proc in enumerate(data['processes']): |
1382 | - if '[' not in proc: |
1383 | - commandline += "add process %s ;" % proc |
1384 | - else: |
1385 | - has_nlo = True |
1386 | - if self.banner.get('run_card','ickkw') == 3: |
1387 | - if len(proc) == min([len(p.strip()) for p in data['processes']]): |
1388 | - commandline += self.get_LO_definition_from_NLO(proc,self.model) |
1389 | - else: |
1390 | - commandline += self.get_LO_definition_from_NLO(proc,self.model, real_only=True) |
1391 | - else: |
1392 | - commandline += self.get_LO_definition_from_NLO(proc,self.model) |
1393 | - |
1394 | - commandline = commandline.replace('add process', 'generate',1) |
1395 | - logger.info(commandline) |
1396 | - try: |
1397 | - mgcmd.exec_cmd(commandline, precmd=True, errorhandling=False) |
1398 | - except diagram_generation.NoDiagramException: |
1399 | - commandline='' |
1400 | - for proc in data['processes']: |
1401 | - if '[' not in proc: |
1402 | - raise |
1403 | - # pass to virtsq= |
1404 | - base, post = proc.split('[',1) |
1405 | - nlo_order, post = post.split(']',1) |
1406 | - if '=' not in nlo_order: |
1407 | - nlo_order = 'virt=%s' % nlo_order |
1408 | - elif 'noborn' in nlo_order: |
1409 | - nlo_order = nlo_order.replace('noborn', 'virt') |
1410 | - commandline += "add process %s [%s] %s;" % (base,nlo_order,post) |
1411 | - commandline = commandline.replace('add process', 'generate',1) |
1412 | - logger.info("RETRY with %s", commandline) |
1413 | - mgcmd.exec_cmd(commandline, precmd=True) |
1414 | - has_nlo = False |
1415 | - except Exception, error: |
1416 | - raise |
1417 | - |
1418 | - commandline = 'output standalone_rw %s' % pjoin(path_me,data['paths'][0]) |
1419 | - mgcmd.exec_cmd(commandline, precmd=True) |
1420 | - logger.info('Done %.4g' % (time.time()-start)) |
1421 | - self.has_standalone_dir = True |
1422 | - |
1423 | - |
1424 | - # 3. Store id to directory information --------------------------------- |
1425 | - matrix_elements = mgcmd._curr_matrix_elements.get_matrix_elements() |
1426 | - |
1427 | - to_check = [] # list of tag that do not have a Pdir at creation time. |
1428 | - for me in matrix_elements: |
1429 | - for proc in me.get('processes'): |
1430 | - initial = [] #filled in the next line |
1431 | - final = [l.get('id') for l in proc.get('legs')\ |
1432 | - if l.get('state') or initial.append(l.get('id'))] |
1433 | - order = (initial, final) |
1434 | - tag = proc.get_initial_final_ids() |
1435 | - decay_finals = proc.get_final_ids_after_decay() |
1436 | - |
1437 | - if tag[1] != decay_finals: |
1438 | - order = (initial, list(decay_finals)) |
1439 | - decay_finals.sort() |
1440 | - tag = (tag[0], tuple(decay_finals)) |
1441 | - Pdir = pjoin(path_me, data['paths'][0], 'SubProcesses', |
1442 | - 'P%s' % me.get('processes')[0].shell_string()) |
1443 | - |
1444 | - if not os.path.exists(Pdir): |
1445 | - to_check.append(tag) |
1446 | - continue |
1447 | - if tag in data['id2path']: |
1448 | - if not Pdir == data['id2path'][tag][1]: |
1449 | - misc.sprint(tag, Pdir, data['id2path'][tag][1]) |
1450 | - raise self.InvalidCmd, '2 different process have the same final states. This module can not handle such situation' |
1451 | - else: |
1452 | - continue |
1453 | - # build the helicity dictionary |
1454 | - hel_nb = 0 |
1455 | - hel_dict = {9:0} # unknown helicity -> use full ME |
1456 | - for helicities in me.get_helicity_matrix(): |
1457 | - hel_nb +=1 #fortran starts at 1 |
1458 | - hel_dict[tuple(helicities)] = hel_nb |
1459 | - |
1460 | - data['id2path'][tag] = [order, Pdir, hel_dict] |
1461 | - |
1462 | - for tag in to_check: |
1463 | - if tag not in self.id_to_path: |
1464 | - logger.warning("no valid path for %s" % (tag,)) |
1465 | - #raise self.InvalidCmd, "no valid path for %s" % (tag,) |
1466 | - |
1467 | - # 4. Check MadLoopParam for Loop induced |
1468 | - if os.path.exists(pjoin(path_me, data['paths'][0], 'Cards', 'MadLoopParams.dat')): |
1469 | - MLCard = banner.MadLoopParam(pjoin(path_me, data['paths'][0], 'Cards', 'MadLoopParams.dat')) |
1470 | - MLCard.set('WriteOutFilters', False) |
1471 | - MLCard.set('UseLoopFilter', False) |
1472 | - MLCard.set("DoubleCheckHelicityFilter", False) |
1473 | - MLCard.set("HelicityFilterLevel", 0) |
1474 | - MLCard.write(pjoin(path_me, data['paths'][0], 'SubProcesses', 'MadLoopParams.dat'), |
1475 | - pjoin(path_me, data['paths'][0], 'Cards', 'MadLoopParams.dat'), |
1476 | - commentdefault=False) |
1477 | - |
1478 | - if self.multicore == 'create': |
1479 | - try: |
1480 | - misc.compile(['OLP_static'], cwd=pjoin(path_me, data['paths'][0],'SubProcesses'), |
1481 | - nb_core=self.mother.options['nb_core']) |
1482 | - except: |
1483 | - misc.compile(['OLP_static'], cwd=pjoin(path_me, data['paths'][0],'SubProcesses')) |
1484 | - |
1485 | - if os.path.exists(pjoin(path_me, data['paths'][1], 'Cards', 'MadLoopParams.dat')): |
1486 | - if self.multicore == 'create': |
1487 | - print "compile OLP", data['paths'][1] |
1488 | - try: |
1489 | - misc.compile(['OLP_static'], cwd=pjoin(path_me, data['paths'][1],'SubProcesses'), |
1490 | - nb_core=self.mother.options['nb_core']) |
1491 | - except: |
1492 | - misc.compile(['OLP_static'], cwd=pjoin(path_me, data['paths'][1],'SubProcesses')) |
1493 | - |
1494 | + has_nlo = self.create_standalone_tree_directory(data, second) |
1495 | + |
1496 | |
1497 | # 5. create the virtual for NLO reweighting --------------------------- |
1498 | - if has_nlo and 'NLO' in self.rwgt_mode: |
1499 | - # Do not pass here for LO/NLO_tree |
1500 | - start = time.time() |
1501 | - commandline='' |
1502 | - for proc in data['processes']: |
1503 | - if '[' not in proc: |
1504 | - pass |
1505 | - else: |
1506 | - proc = proc.replace('[', '[ virt=') |
1507 | - commandline += "add process %s ;" % proc |
1508 | - # deactivate golem since it creates troubles |
1509 | - old_options = dict(mgcmd.options) |
1510 | - if mgcmd.options['golem'] or mgcmd.options['pjfry']: |
1511 | - logger.info(" When doing NLO reweighting, MG5aMC cannot use the loop reduction algorithms Golem and/or PJFry++") |
1512 | - mgcmd.options['golem'] = None |
1513 | - mgcmd.options['pjfry'] = None |
1514 | - commandline = commandline.replace('add process', 'generate',1) |
1515 | - logger.info(commandline) |
1516 | - mgcmd.exec_cmd(commandline, precmd=True) |
1517 | - commandline = 'output standalone_rw %s -f' % pjoin(path_me, data['paths'][1]) |
1518 | - mgcmd.exec_cmd(commandline, precmd=True) |
1519 | - |
1520 | - #put back golem to original value |
1521 | - mgcmd.options['golem'] = old_options['golem'] |
1522 | - mgcmd.options['pjfry'] = old_options['pjfry'] |
1523 | - # update make_opts |
1524 | - m_opts = {} |
1525 | - if mgcmd.options['lhapdf']: |
1526 | - #lhapdfversion = subprocess.Popen([mgcmd.options['lhapdf'], '--version'], |
1527 | - # stdout = subprocess.PIPE).stdout.read().strip()[0] |
1528 | - m_opts['lhapdf'] = True |
1529 | - m_opts['f2pymode'] = True |
1530 | - m_opts['lhapdfversion'] = 5 # 6 always fail on my computer since 5 is compatible but slower always use 5 |
1531 | - m_opts['llhapdf'] = self.mother.get_lhapdf_libdir() |
1532 | - else: |
1533 | - raise Exception, "NLO reweighting requires LHAPDF to work correctly" |
1534 | - |
1535 | - path = pjoin(path_me,data['paths'][1], 'Source', 'make_opts') |
1536 | - common_run_interface.CommonRunCmd.update_make_opts_full(path, m_opts) |
1537 | - logger.info('Done %.4g' % (time.time()-start)) |
1538 | - |
1539 | - |
1540 | - # Download LHAPDF SET |
1541 | - common_run_interface.CommonRunCmd.install_lhapdf_pdfset_static(\ |
1542 | - mgcmd.options['lhapdf'], None, self.banner.run_card.get_lhapdf_id()) |
1543 | - |
1544 | - # now store the id information |
1545 | - matrix_elements = mgcmd._curr_matrix_elements.get_matrix_elements() |
1546 | - for me in matrix_elements: |
1547 | - for proc in me.get('processes'): |
1548 | - initial = [] #filled in the next line |
1549 | - final = [l.get('id') for l in proc.get('legs')\ |
1550 | - if l.get('state') or initial.append(l.get('id'))] |
1551 | - order = (initial, final) |
1552 | - tag = proc.get_initial_final_ids() |
1553 | - decay_finals = proc.get_final_ids_after_decay() |
1554 | - |
1555 | - if tag[1] != decay_finals: |
1556 | - order = (initial, list(decay_finals)) |
1557 | - decay_finals.sort() |
1558 | - tag = (tag[0], tuple(decay_finals)) |
1559 | - Pdir = pjoin(path_me, data['paths'][1], 'SubProcesses', |
1560 | - 'P%s' % me.get('processes')[0].shell_string()) |
1561 | - assert os.path.exists(Pdir), "Pdir %s do not exists" % Pdir |
1562 | - if (tag,'V') in data['id2path']: |
1563 | - if not Pdir == data['id2path'][(tag,'V')][1]: |
1564 | - misc.sprint(tag, Pdir, self.id_to_path[(tag,'V')][1]) |
1565 | - raise self.InvalidCmd, '2 different process have the same final states. This module can not handle such situation' |
1566 | - else: |
1567 | - continue |
1568 | - # build the helicity dictionary |
1569 | - hel_nb = 0 |
1570 | - hel_dict = {9:0} # unknown helicity -> use full ME |
1571 | - for helicities in me.get_helicity_matrix(): |
1572 | - hel_nb +=1 #fortran starts at 1 |
1573 | - hel_dict[tuple(helicities)] = hel_nb |
1574 | - |
1575 | - data['id2path'][(tag,'V')] = [order, Pdir, hel_dict] |
1576 | - |
1577 | - #compile the module to combine the weight |
1578 | - misc.compile(cwd=pjoin(path_me, data['paths'][1], 'Source')) |
1579 | - #link it |
1580 | - if path_me not in sys.path: |
1581 | - sys.path.insert(0, os.path.realpath(path_me)) |
1582 | - with misc.chdir(pjoin(path_me)): |
1583 | - mymod = __import__('%s.Source.rwgt2py' % data['paths'][1], globals(), locals(), [],-1) |
1584 | - mymod = mymod.Source.rwgt2py |
1585 | - with misc.stdchannel_redirected(sys.stdout, os.devnull): |
1586 | - mymod.initialise([self.banner.run_card['lpp1'], |
1587 | - self.banner.run_card['lpp2']], |
1588 | - self.banner.run_card.get_lhapdf_id()) |
1589 | - self.combine_wgt = mymod.get_wgt |
1590 | + if second and 'virtual_path' in self.dedicated_path: |
1591 | + files.ln(self.dedicated_path['virtual_path'], path_me, name=data['paths'][1]) |
1592 | + elif has_nlo and 'NLO' in self.rwgt_mode: |
1593 | + self.create_standalone_virt_directory(data, second) |
1594 | + |
1595 | + if not second: |
1596 | + #compile the module to combine the weight |
1597 | + misc.compile(cwd=pjoin(path_me, data['paths'][1], 'Source')) |
1598 | + #link it |
1599 | + if path_me not in sys.path: |
1600 | + sys.path.insert(0, os.path.realpath(path_me)) |
1601 | + with misc.chdir(pjoin(path_me)): |
1602 | + mymod = __import__('%s.Source.rwgt2py' % data['paths'][1], globals(), locals(), [],-1) |
1603 | + mymod = mymod.Source.rwgt2py |
1604 | + with misc.stdchannel_redirected(sys.stdout, os.devnull): |
1605 | + mymod.initialise([self.banner.run_card['lpp1'], |
1606 | + self.banner.run_card['lpp2']], |
1607 | + self.banner.run_card.get_lhapdf_id()) |
1608 | + self.combine_wgt = mymod.get_wgt |
1609 | |
1610 | if self.multicore == 'create': |
1611 | print "compile OLP", data['paths'][1] |
1612 | - misc.compile(['OLP_static'], cwd=pjoin(path_me, data['paths'][1],'SubProcesses'), |
1613 | + try: |
1614 | + misc.compile(['OLP_static'], cwd=pjoin(path_me, data['paths'][1],'SubProcesses'), |
1615 | nb_core=self.mother.options['nb_core']) |
1616 | - |
1617 | + except: |
1618 | + misc.compile(['OLP_static'], cwd=pjoin(path_me, data['paths'][1],'SubProcesses'), |
1619 | + nb_core=1) |
1620 | elif has_nlo and not second and self.rwgt_mode == ['NLO_tree']: |
1621 | # We do not have any virtual reweighting to do but we still have to |
1622 | #combine the weights. |
1623 | @@ -1610,7 +1562,7 @@ |
1624 | commandline = commandline.replace('add process', 'generate',1) |
1625 | logger.info(commandline) |
1626 | mgcmd.exec_cmd(commandline, precmd=True) |
1627 | - commandline = 'output standalone_rw %s -f' % pjoin(path_me, data['paths'][1]) |
1628 | + commandline = 'output standalone_rw %s --prefix=int -f' % pjoin(path_me, data['paths'][1]) |
1629 | mgcmd.exec_cmd(commandline, precmd=True) |
1630 | #put back golem to original value |
1631 | mgcmd.options['golem'] = old_options['golem'] |
1632 | @@ -1651,7 +1603,7 @@ |
1633 | |
1634 | |
1635 | # 6. If we need a new model/process------------------------------------- |
1636 | - if (self.second_model or self.second_process) and not second: |
1637 | + if (self.second_model or self.second_process or self.dedicated_path) and not second : |
1638 | self.create_standalone_directory(second=True) |
1639 | |
1640 | if not second: |
1641 | @@ -1659,7 +1611,123 @@ |
1642 | |
1643 | |
1644 | |
1645 | - |
1646 | + def compile(self): |
1647 | + """compile the code""" |
1648 | + |
1649 | + if self.multicore=='wait': |
1650 | + return |
1651 | + |
1652 | + if not self.rwgt_dir: |
1653 | + path_me = self.me_dir |
1654 | + else: |
1655 | + path_me = self.rwgt_dir |
1656 | + for onedir in self.rwgt_dir_possibility: |
1657 | + if not os.path.isdir(pjoin(path_me,onedir)): |
1658 | + continue |
1659 | + pdir = pjoin(path_me, onedir, 'SubProcesses') |
1660 | + nb_core = self.mother.options['nb_core'] if self.mother.options['run_mode'] !=0 else 1 |
1661 | + os.environ['MENUM'] = '2' |
1662 | + misc.compile(['allmatrix2py.so'], cwd=pdir, nb_core=nb_core) |
1663 | + if not (self.second_model or self.second_process or self.dedicated_path): |
1664 | + os.environ['MENUM'] = '3' |
1665 | + misc.compile(['allmatrix3py.so'], cwd=pdir, nb_core=nb_core) |
1666 | + |
1667 | + def load_module(self, metag=1): |
1668 | + """load the various module and load the associate information""" |
1669 | + |
1670 | + |
1671 | + if not self.rwgt_dir: |
1672 | + path_me = self.me_dir |
1673 | + else: |
1674 | + path_me = self.rwgt_dir |
1675 | + |
1676 | + self.id_to_path = {} |
1677 | + self.id_to_path_second = {} |
1678 | + for onedir in self.rwgt_dir_possibility: |
1679 | + if not os.path.exists(pjoin(path_me,onedir)): |
1680 | + continue |
1681 | + pdir = pjoin(path_me, onedir, 'SubProcesses') |
1682 | + for tag in [2*metag,2*metag+1]: |
1683 | + with misc.TMP_variable(sys, 'path', [pjoin(path_me)]+sys.path): |
1684 | + mymod = __import__('%s.SubProcesses.allmatrix%spy' % (onedir, tag), globals(), locals(), [],-1) |
1685 | + reload(mymod) |
1686 | + S = mymod.SubProcesses |
1687 | + mymod = getattr(S, 'allmatrix%spy' % tag) |
1688 | + |
1689 | + # Param card not available -> no initialisation |
1690 | + self.f2pylib[(onedir,tag)] = mymod |
1691 | + if hasattr(mymod, 'set_madloop_path'): |
1692 | + mymod.set_madloop_path(pjoin(path_me,onedir,'SubProcesses','MadLoop5_resources')) |
1693 | + if (self.second_model or self.second_process or self.dedicated_path): |
1694 | + break |
1695 | + |
1696 | + data = self.id_to_path |
1697 | + if '_second' in onedir: |
1698 | + data = self.id_to_path_second |
1699 | + |
1700 | + # get all the information |
1701 | + all_pdgs = mymod.get_pdg_order() |
1702 | + all_pdgs = [[pdg for pdg in pdgs if pdg!=0] for pdgs in mymod.get_pdg_order()] |
1703 | + all_prefix = [''.join(j).strip().lower() for j in mymod.get_prefix()] |
1704 | + prefix_set = set(all_prefix) |
1705 | + |
1706 | + |
1707 | + hel_dict={} |
1708 | + for prefix in prefix_set: |
1709 | + if hasattr(mymod,'%sprocess_nhel' % prefix): |
1710 | + nhel = getattr(mymod, '%sprocess_nhel' % prefix).nhel |
1711 | + hel_dict[prefix] = {} |
1712 | + for i, onehel in enumerate(zip(*nhel)): |
1713 | + hel_dict[prefix][tuple(onehel)] = i+1 |
1714 | + elif hasattr(mymod, 'set_madloop_path') and \ |
1715 | + os.path.exists(pjoin(path_me,onedir,'SubProcesses','MadLoop5_resources', '%sHelConfigs.dat' % prefix.upper())): |
1716 | + hel_dict[prefix] = {} |
1717 | + for i,line in enumerate(open(pjoin(path_me,onedir,'SubProcesses','MadLoop5_resources', '%sHelConfigs.dat' % prefix.upper()))): |
1718 | + onehel = [int(h) for h in line.split()] |
1719 | + hel_dict[prefix][tuple(onehel)] = i+1 |
1720 | + else: |
1721 | + misc.sprint(pjoin(path_me,onedir,'SubProcesses','MadLoop5_resources', '%sHelConfigs.dat' % prefix.upper() )) |
1722 | + misc.sprint(os.path.exists(pjoin(path_me,onedir,'SubProcesses','MadLoop5_resources', '%sHelConfigs.dat' % prefix.upper()))) |
1723 | + continue |
1724 | + |
1725 | + for i,pdg in enumerate(all_pdgs): |
1726 | + if self.is_decay: |
1727 | + incoming = pdg[0] |
1728 | + outgoing = pdg[1:] |
1729 | + else: |
1730 | + incoming = pdg[0:2] |
1731 | + outgoing = pdg[2:] |
1732 | + order = (list(incoming), list(outgoing)) |
1733 | + incoming.sort() |
1734 | + outgoing.sort() |
1735 | + tag = (tuple(incoming), tuple(outgoing)) |
1736 | + if 'virt' in onedir: |
1737 | + tag = (tag, 'V') |
1738 | + prefix = all_prefix[i] |
1739 | + hel = hel_dict[prefix] |
1740 | + if tag in data: |
1741 | + oldpdg = data[tag][0][0]+data[tag][0][1] |
1742 | + if all_prefix[all_pdgs.index(pdg)] == all_prefix[all_pdgs.index(oldpdg)]: |
1743 | + for i in range(len(pdg)): |
1744 | + if pdg[i] == oldpdg[i]: |
1745 | + continue |
1746 | + if not self.model: |
1747 | + continue |
1748 | + if self.model.get_mass(int(pdg[i])) == self.model.get_mass(int(oldpdg[i])): |
1749 | + continue |
1750 | + misc.sprint(tag, onedir) |
1751 | + misc.sprint(data[tag][:-1]) |
1752 | + misc.sprint(order, pdir,) |
1753 | + raise Exception |
1754 | + else: |
1755 | + misc.sprint(tag, onedir) |
1756 | + misc.sprint(data[tag][:-1]) |
1757 | + misc.sprint(order, pdir,) |
1758 | + raise Exception |
1759 | + |
1760 | + data[tag] = order, pdir, hel |
1761 | + |
1762 | + |
1763 | def load_model(self, name, use_mg_default, complex_mass=False): |
1764 | """load the model""" |
1765 | |
1766 | |
1767 | === modified file 'madgraph/iolibs/export_cpp.py' |
1768 | --- madgraph/iolibs/export_cpp.py 2016-08-26 23:45:51 +0000 |
1769 | +++ madgraph/iolibs/export_cpp.py 2017-07-29 19:33:46 +0000 |
1770 | @@ -2512,12 +2512,13 @@ |
1771 | |
1772 | return OneProcessExporterPythia8.read_template_file(*args, **opts) |
1773 | |
1774 | -def ExportCPPFactory(cmd, group_subprocesses=False): |
1775 | +def ExportCPPFactory(cmd, group_subprocesses=False, cmd_options={}): |
1776 | """ Determine which Export class is required. cmd is the command |
1777 | interface containing all potential usefull information. |
1778 | """ |
1779 | |
1780 | - opt = cmd.options |
1781 | + opt = dict(cmd.options) |
1782 | + opt['output_options'] = cmd_options |
1783 | cformat = cmd._export_format |
1784 | |
1785 | if cformat == 'pythia8': |
1786 | |
1787 | === modified file 'madgraph/iolibs/export_v4.py' |
1788 | --- madgraph/iolibs/export_v4.py 2017-03-03 10:07:55 +0000 |
1789 | +++ madgraph/iolibs/export_v4.py 2017-07-29 19:33:46 +0000 |
1790 | @@ -96,6 +96,7 @@ |
1791 | |
1792 | |
1793 | def __init__(self, dir_path = "", opt=None): |
1794 | + # cmd_options is a dictionary with all the optional argurment passed at output time |
1795 | return |
1796 | |
1797 | def copy_template(self, model): |
1798 | @@ -138,7 +139,8 @@ |
1799 | |
1800 | default_opt = {'clean': False, 'complex_mass':False, |
1801 | 'export_format':'madevent', 'mp': False, |
1802 | - 'v5_model': True |
1803 | + 'v5_model': True, |
1804 | + 'output_options':{} |
1805 | } |
1806 | grouped_mode = False |
1807 | |
1808 | @@ -152,6 +154,8 @@ |
1809 | if opt: |
1810 | self.opt.update(opt) |
1811 | |
1812 | + self.cmd_options = self.opt['output_options'] |
1813 | + |
1814 | #place holder to pass information to the run_interface |
1815 | self.proc_characteristic = banner_mod.ProcCharacteristic() |
1816 | |
1817 | @@ -1848,7 +1852,7 @@ |
1818 | |
1819 | matrix_template = "matrix_standalone_v4.inc" |
1820 | |
1821 | - def __init__(self, *args, **opts): |
1822 | + def __init__(self, *args,**opts): |
1823 | """add the format information compare to standard init""" |
1824 | |
1825 | if 'format' in opts: |
1826 | @@ -1856,6 +1860,8 @@ |
1827 | del opts['format'] |
1828 | else: |
1829 | self.format = 'standalone' |
1830 | + |
1831 | + self.prefix_info = {} |
1832 | ProcessExporterFortran.__init__(self, *args, **opts) |
1833 | |
1834 | def copy_template(self, model): |
1835 | @@ -1894,7 +1900,7 @@ |
1836 | |
1837 | # Add file in SubProcesses |
1838 | shutil.copy(pjoin(self.mgme_dir, 'madgraph', 'iolibs', 'template_files', 'makefile_sa_f_sp'), |
1839 | - pjoin(self.dir_path, 'SubProcesses', 'makefile')) |
1840 | + pjoin(self.dir_path, 'SubProcesses', 'makefileP')) |
1841 | |
1842 | if self.format == 'standalone': |
1843 | shutil.copy(pjoin(self.mgme_dir, 'madgraph', 'iolibs', 'template_files', 'check_sa.f'), |
1844 | @@ -1982,24 +1988,141 @@ |
1845 | pjoin(self.dir_path, 'Source', 'PDF')) |
1846 | self.write_pdf_opendata() |
1847 | |
1848 | - # create a single makefile to compile all the subprocesses |
1849 | - text = '''\n# For python linking (require f2py part of numpy)\nifeq ($(origin MENUM),undefined)\n MENUM=2\nendif\n''' |
1850 | - deppython = '' |
1851 | - for Pdir in os.listdir(pjoin(self.dir_path,'SubProcesses')): |
1852 | - if os.path.isdir(pjoin(self.dir_path, 'SubProcesses', Pdir)): |
1853 | - text += '%(0)s/matrix$(MENUM)py.so:\n\tcd %(0)s;make matrix$(MENUM)py.so\n'% {'0': Pdir} |
1854 | - deppython += ' %(0)s/matrix$(MENUM)py.so ' % {'0': Pdir} |
1855 | - |
1856 | - text+='all: %s\n\techo \'done\'' % deppython |
1857 | - |
1858 | - ff = open(pjoin(self.dir_path, 'SubProcesses', 'makefile'),'a') |
1859 | - ff.write(text) |
1860 | - ff.close() |
1861 | - |
1862 | - |
1863 | - |
1864 | - |
1865 | - |
1866 | + if self.prefix_info: |
1867 | + self.write_f2py_splitter() |
1868 | + self.write_f2py_makefile() |
1869 | + self.write_f2py_check_sa(matrix_elements, |
1870 | + pjoin(self.dir_path,'SubProcesses','check_sa.py')) |
1871 | + else: |
1872 | + # create a single makefile to compile all the subprocesses |
1873 | + text = '''\n# For python linking (require f2py part of numpy)\nifeq ($(origin MENUM),undefined)\n MENUM=2\nendif\n''' |
1874 | + deppython = '' |
1875 | + for Pdir in os.listdir(pjoin(self.dir_path,'SubProcesses')): |
1876 | + if os.path.isdir(pjoin(self.dir_path, 'SubProcesses', Pdir)): |
1877 | + text += '%(0)s/matrix$(MENUM)py.so:\n\tcd %(0)s;make matrix$(MENUM)py.so\n'% {'0': Pdir} |
1878 | + deppython += ' %(0)s/matrix$(MENUM)py.so ' % {'0': Pdir} |
1879 | + text+='all: %s\n\techo \'done\'' % deppython |
1880 | + |
1881 | + ff = open(pjoin(self.dir_path, 'SubProcesses', 'makefile'),'a') |
1882 | + ff.write(text) |
1883 | + ff.close() |
1884 | + |
1885 | + def write_f2py_splitter(self): |
1886 | + """write a function to call the correct matrix element""" |
1887 | + |
1888 | + template = """ |
1889 | +%(python_information)s |
1890 | + subroutine smatrixhel(pdgs, npdg, p, ALPHAS, SCALE2, nhel, ANS) |
1891 | + IMPLICIT NONE |
1892 | + |
1893 | +CF2PY double precision, intent(in), dimension(0:3,npdg) :: p |
1894 | +CF2PY integer, intent(in), dimension(npdg) :: pdgs |
1895 | +CF2PY integer, intent(in) :: npdg |
1896 | +CF2PY double precision, intent(out) :: ANS |
1897 | +CF2PY double precision, intent(in) :: ALPHAS |
1898 | +CF2PY double precision, intent(in) :: SCALE2 |
1899 | + integer pdgs(*) |
1900 | + integer npdg, nhel |
1901 | + double precision p(*) |
1902 | + double precision ANS, ALPHAS, PI,SCALE2 |
1903 | + include 'coupl.inc' |
1904 | + |
1905 | + PI = 3.141592653589793D0 |
1906 | + G = 2* DSQRT(ALPHAS*PI) |
1907 | + CALL UPDATE_AS_PARAM() |
1908 | + if (scale2.ne.0d0) stop 1 |
1909 | + |
1910 | +%(smatrixhel)s |
1911 | + |
1912 | + return |
1913 | + end |
1914 | + |
1915 | + SUBROUTINE INITIALISE(PATH) |
1916 | +C ROUTINE FOR F2PY to read the benchmark point. |
1917 | + IMPLICIT NONE |
1918 | + CHARACTER*512 PATH |
1919 | +CF2PY INTENT(IN) :: PATH |
1920 | + CALL SETPARA(PATH) !first call to setup the paramaters |
1921 | + RETURN |
1922 | + END |
1923 | + |
1924 | + subroutine get_pdg_order(PDG) |
1925 | + IMPLICIT NONE |
1926 | +CF2PY INTEGER, intent(out) :: PDG(%(nb_me)i,%(maxpart)i) |
1927 | + INTEGER PDG(%(nb_me)i,%(maxpart)i), PDGS(%(nb_me)i,%(maxpart)i) |
1928 | + DATA PDGS/ %(pdgs)s / |
1929 | + PDG = PDGS |
1930 | + RETURN |
1931 | + END |
1932 | + |
1933 | + subroutine get_prefix(PREFIX) |
1934 | + IMPLICIT NONE |
1935 | +CF2PY CHARACTER*20, intent(out) :: PREFIX(%(nb_me)i) |
1936 | + character*20 PREFIX(%(nb_me)i),PREF(%(nb_me)i) |
1937 | + DATA PREF / '%(prefix)s'/ |
1938 | + PREFIX = PREF |
1939 | + RETURN |
1940 | + END |
1941 | + |
1942 | + |
1943 | + """ |
1944 | + |
1945 | + allids = self.prefix_info.keys() |
1946 | + allprefix = [self.prefix_info[key][0] for key in allids] |
1947 | + min_nexternal = min([len(ids) for ids in allids]) |
1948 | + max_nexternal = max([len(ids) for ids in allids]) |
1949 | + |
1950 | + info = [] |
1951 | + for key, (prefix, tag) in self.prefix_info.items(): |
1952 | + info.append('#PY %s : %s # %s' % (tag, key, prefix)) |
1953 | + |
1954 | + |
1955 | + text = [] |
1956 | + for n_ext in range(min_nexternal, max_nexternal+1): |
1957 | + current = [ids for ids in allids if len(ids)==n_ext] |
1958 | + if not current: |
1959 | + continue |
1960 | + if min_nexternal != max_nexternal: |
1961 | + if n_ext == min_nexternal: |
1962 | + text.append(' if (npdg.eq.%i)then' % n_ext) |
1963 | + else: |
1964 | + text.append(' else if (npdg.eq.%i)then' % n_ext) |
1965 | + for ii,pdgs in enumerate(current): |
1966 | + condition = '.and.'.join(['%i.eq.pdgs(%i)' %(pdg, i+1) for i, pdg in enumerate(pdgs)]) |
1967 | + if ii==0: |
1968 | + text.append( ' if(%s) then ! %i' % (condition, i)) |
1969 | + else: |
1970 | + text.append( ' else if(%s) then ! %i' % (condition,i)) |
1971 | + text.append(' call %ssmatrixhel(p, nhel, ans)' % self.prefix_info[pdgs][0]) |
1972 | + text.append(' endif') |
1973 | + #close the function |
1974 | + if min_nexternal != max_nexternal: |
1975 | + text.append('endif') |
1976 | + |
1977 | + formatting = {'python_information':'\n'.join(info), |
1978 | + 'smatrixhel': '\n'.join(text), |
1979 | + 'maxpart': max_nexternal, |
1980 | + 'nb_me': len(allids), |
1981 | + 'pdgs': ','.join(str(pdg[i]) if i<len(pdg) else '0' |
1982 | + for i in range(max_nexternal) for pdg in allids), |
1983 | + 'prefix':'\',\''.join(allprefix) |
1984 | + } |
1985 | + formatting['lenprefix'] = len(formatting['prefix']) |
1986 | + text = template % formatting |
1987 | + fsock = writers.FortranWriter(pjoin(self.dir_path, 'SubProcesses', 'all_matrix.f'),'w') |
1988 | + fsock.writelines(text) |
1989 | + fsock.close() |
1990 | + |
1991 | + def write_f2py_check_sa(self, matrix_element, writer): |
1992 | + """ Write the general check_sa.py in SubProcesses that calls all processes successively.""" |
1993 | + # To be implemented. It is just an example file, i.e. not crucial. |
1994 | + return |
1995 | + |
1996 | + def write_f2py_makefile(self): |
1997 | + """ """ |
1998 | + # Add file in SubProcesses |
1999 | + shutil.copy(pjoin(self.mgme_dir, 'madgraph', 'iolibs', 'template_files', 'makefile_sa_f2py'), |
2000 | + pjoin(self.dir_path, 'SubProcesses', 'makefile')) |
2001 | |
2002 | def create_MA5_cards(self,*args,**opts): |
2003 | """ Overload the function of the mother so as to bypass this in StandAlone.""" |
2004 | @@ -2027,13 +2150,8 @@ |
2005 | if self.opt['sa_symmetry']: |
2006 | # avoid symmetric output |
2007 | for i,proc in enumerate(matrix_element.get('processes')): |
2008 | - |
2009 | - initial = [] #filled in the next line |
2010 | - final = [l.get('id') for l in proc.get('legs')\ |
2011 | - if l.get('state') or initial.append(l.get('id'))] |
2012 | - decay_finals = proc.get_final_ids_after_decay() |
2013 | - decay_finals.sort() |
2014 | - tag = (tuple(initial), tuple(decay_finals)) |
2015 | + |
2016 | + tag = proc.get_tag() |
2017 | legs = proc.get('legs')[:] |
2018 | leg0 = proc.get('legs')[0] |
2019 | leg1 = proc.get('legs')[1] |
2020 | @@ -2074,10 +2192,24 @@ |
2021 | filename = pjoin(dirpath, 'matrix_prod.f') |
2022 | else: |
2023 | filename = pjoin(dirpath, 'matrix.f') |
2024 | + |
2025 | + proc_prefix = '' |
2026 | + if 'prefix' in self.cmd_options: |
2027 | + if self.cmd_options['prefix'] == 'int': |
2028 | + proc_prefix = 'M%s_' % number |
2029 | + elif self.cmd_options['prefix'] == 'proc': |
2030 | + proc_prefix = matrix_element.get('processes')[0].shell_string().split('_',1)[1] |
2031 | + else: |
2032 | + raise Exception, '--prefix options supports only \'int\' and \'proc\'' |
2033 | + for proc in matrix_element.get('processes'): |
2034 | + ids = [l.get('id') for l in proc.get('legs_with_decays')] |
2035 | + self.prefix_info[tuple(ids)] = [proc_prefix, proc.get_tag()] |
2036 | + |
2037 | calls = self.write_matrix_element_v4( |
2038 | writers.FortranWriter(filename), |
2039 | matrix_element, |
2040 | - fortran_model) |
2041 | + fortran_model, |
2042 | + proc_prefix=proc_prefix) |
2043 | |
2044 | if self.opt['export_format'] == 'standalone_msP': |
2045 | filename = pjoin(dirpath,'configs_production.inc') |
2046 | @@ -2124,11 +2256,18 @@ |
2047 | matrix_element.get('processes')[0].nice_string()) |
2048 | plot.draw() |
2049 | |
2050 | - linkfiles = ['check_sa.f', 'coupl.inc', 'makefile'] |
2051 | + linkfiles = ['check_sa.f', 'coupl.inc'] |
2052 | + |
2053 | + if proc_prefix and os.path.exists(pjoin(dirpath, '..', 'check_sa.f')): |
2054 | + text = open(pjoin(dirpath, '..', 'check_sa.f')).read() |
2055 | + new_text, n = re.subn('smatrix', '%ssmatrix' % proc_prefix, text, flags=re.I) |
2056 | + with open(pjoin(dirpath, 'check_sa.f'),'w') as f: |
2057 | + f.write(new_text) |
2058 | + linkfiles.pop(0) |
2059 | |
2060 | for file in linkfiles: |
2061 | ln('../%s' % file, cwd=dirpath) |
2062 | - |
2063 | + ln('../makefileP', name='makefile', cwd=dirpath) |
2064 | # Return to original PWD |
2065 | #os.chdir(cwd) |
2066 | |
2067 | @@ -2176,7 +2315,6 @@ |
2068 | self.opt['sa_symmetry']=False |
2069 | |
2070 | |
2071 | - |
2072 | # The proc_id is for MadEvent grouping which is never used in SA. |
2073 | replace_dict = {'global_variable':'', 'amp2_lines':'', |
2074 | 'proc_prefix':proc_prefix, 'proc_id':''} |
2075 | @@ -6445,14 +6583,15 @@ |
2076 | rule_card_path=rule_card, |
2077 | mssm_convert=True) |
2078 | |
2079 | -def ExportV4Factory(cmd, noclean, output_type='default', group_subprocesses=True): |
2080 | +def ExportV4Factory(cmd, noclean, output_type='default', group_subprocesses=True, cmd_options={}): |
2081 | """ Determine which Export_v4 class is required. cmd is the command |
2082 | interface containing all potential usefull information. |
2083 | The output_type argument specifies from which context the output |
2084 | is called. It is 'madloop' for MadLoop5, 'amcatnlo' for FKS5 output |
2085 | and 'default' for tree-level outputs.""" |
2086 | |
2087 | - opt = cmd.options |
2088 | + opt = dict(cmd.options) |
2089 | + opt['output_options'] = cmd_options |
2090 | |
2091 | # ========================================================================== |
2092 | # First check whether Ninja must be installed. |
2093 | @@ -6501,10 +6640,10 @@ |
2094 | 'SubProc_prefix':'P', |
2095 | 'compute_color_flows':cmd.options['loop_color_flows'], |
2096 | 'mode': 'reweight' if cmd._export_format == "standalone_rw" else '', |
2097 | - 'cluster_local_path': cmd.options['cluster_local_path'] |
2098 | + 'cluster_local_path': cmd.options['cluster_local_path'], |
2099 | + 'output_options': cmd_options |
2100 | } |
2101 | |
2102 | - |
2103 | if output_type.startswith('madloop'): |
2104 | import madgraph.loop.loop_exporters as loop_exporters |
2105 | if os.path.isdir(os.path.join(cmd._mgme_dir, 'Template/loop_material')): |
2106 | |
2107 | === added symlink 'madgraph/iolibs/template_files/loop/check_sa_all.py.inc' |
2108 | === target is u'../loop_optimized/check_sa_all.py.inc' |
2109 | === modified file 'madgraph/iolibs/template_files/loop/improve_ps.inc' |
2110 | --- madgraph/iolibs/template_files/loop/improve_ps.inc 2014-11-17 15:32:46 +0000 |
2111 | +++ madgraph/iolibs/template_files/loop/improve_ps.inc 2017-07-29 19:33:46 +0000 |
2112 | @@ -733,7 +733,14 @@ |
2113 | C Apply the rescaling |
2114 | DO I=1,NEXTERNAL |
2115 | DO J=1,3 |
2116 | - NEWP(J,I)=NEWP(J,I)*XSCALE |
2117 | +C Consider scaling by x**2 for the first particle so that |
2118 | +C the algorithm for numerically solving for XSCALE has a non-vanishing |
2119 | +C derivative in the case that all particle are massless. |
2120 | + IF (I.eq.1) THEN |
2121 | + NEWP(J,I)=NEWP(J,I)*XSCALE**2 |
2122 | + ELSE |
2123 | + NEWP(J,I)=NEWP(J,I)*XSCALE |
2124 | + ENDIF |
2125 | ENDDO |
2126 | ENDDO |
2127 | |
2128 | @@ -912,20 +919,32 @@ |
2129 | RES=ZERO |
2130 | BUFF=ZERO |
2131 | |
2132 | +C Consider scaling by x**2 for the first particle so that |
2133 | +C the algorithm for numerically solving for XSCALE has a non-vanishing |
2134 | +C derivative in the case that all particle are massless. |
2135 | + |
2136 | DO I=1,NEXTERNAL |
2137 | IF (I.LE.NINITIAL) THEN |
2138 | FACTOR=-ONE |
2139 | ELSE |
2140 | FACTOR=ONE |
2141 | ENDIF |
2142 | - BUFF=MASSES(I)**2+PVECSQ(I)*X**2 |
2143 | + IF (I.eq.1) THEN |
2144 | + BUFF=MASSES(I)**2+PVECSQ(I)*X**4 |
2145 | + ELSE |
2146 | + BUFF=MASSES(I)**2+PVECSQ(I)*X**2 |
2147 | + ENDIF |
2148 | IF (BUFF.LT.ZERO) THEN |
2149 | RES=ZERO |
2150 | ERROR = 1 |
2151 | GOTO 800 |
2152 | ENDIF |
2153 | IF (DERIVATIVE) THEN |
2154 | - RES=RES + FACTOR*((X*PVECSQ(I))/SQRT(BUFF)) |
2155 | + IF (I.eq.1) THEN |
2156 | + RES=RES + FACTOR*((2*X*PVECSQ(I))/SQRT(BUFF)) |
2157 | + ELSE |
2158 | + RES=RES + FACTOR*((X*PVECSQ(I))/SQRT(BUFF)) |
2159 | + ENDIF |
2160 | ELSE |
2161 | RES=RES + FACTOR*SQRT(BUFF) |
2162 | ENDIF |
2163 | |
2164 | === modified file 'madgraph/iolibs/template_files/loop/loop_matrix_standalone.inc' |
2165 | --- madgraph/iolibs/template_files/loop/loop_matrix_standalone.inc 2016-03-22 20:44:25 +0000 |
2166 | +++ madgraph/iolibs/template_files/loop/loop_matrix_standalone.inc 2017-07-29 19:33:46 +0000 |
2167 | @@ -1001,6 +1001,15 @@ |
2168 | ENDDO |
2169 | ACC = ACC / ( ABS(AVG) / 3.0d0) |
2170 | |
2171 | +c If NaN are present in the evaluation, automatically set the accuracy to 1.0d99. |
2172 | + DO I=1,3 |
2173 | + DO J=1,MAXSTABILITYLENGTH |
2174 | + IF (isnan(FULLLIST(I,J))) then |
2175 | + ACC = 1.0d99 |
2176 | + ENDIF |
2177 | + ENDDO |
2178 | + ENDDO |
2179 | + |
2180 | end |
2181 | |
2182 | SUBROUTINE %(proc_prefix)sSET_N_EVALS(N_DP_EVALS,N_QP_EVALS) |
2183 | |
2184 | === modified file 'madgraph/iolibs/template_files/loop_optimized/check_py.f.inc' |
2185 | --- madgraph/iolibs/template_files/loop_optimized/check_py.f.inc 2016-03-03 22:14:52 +0000 |
2186 | +++ madgraph/iolibs/template_files/loop_optimized/check_py.f.inc 2017-07-29 19:33:46 +0000 |
2187 | @@ -1,4 +1,4 @@ |
2188 | - Subroutine Initialise(path) |
2189 | + Subroutine %(prefix_routine)sInitialise(path) |
2190 | |
2191 | CHARACTER(128) path |
2192 | CF2PY intent(in)::path |
2193 | @@ -12,7 +12,7 @@ |
2194 | return |
2195 | end |
2196 | |
2197 | - SUBROUTINE GET_ME(P, ALPHAS, SCALE2, NHEL , ANS,RETURNCODE) |
2198 | + SUBROUTINE %(prefix_routine)sGET_ME(P, ALPHAS, SCALE2, NHEL , ANS,RETURNCODE) |
2199 | IMPLICIT NONE |
2200 | C |
2201 | C CONSTANTS |
2202 | |
2203 | === modified file 'madgraph/iolibs/template_files/loop_optimized/check_sa.py.inc' |
2204 | --- madgraph/iolibs/template_files/loop_optimized/check_sa.py.inc 2016-03-04 17:56:39 +0000 |
2205 | +++ madgraph/iolibs/template_files/loop_optimized/check_sa.py.inc 2017-07-29 19:33:46 +0000 |
2206 | @@ -44,7 +44,7 @@ |
2207 | # print help(matrix2py) |
2208 | |
2209 | # Read the model parameters |
2210 | -matrix2py.initialise(os.path.abspath(pjoin(root_path,os.pardir,os.pardir,'Cards','param_card.dat'))) |
2211 | +matrix2py.{2}initialise(os.path.abspath(pjoin(root_path,os.pardir,os.pardir,'Cards','param_card.dat'))) |
2212 | |
2213 | |
2214 | def invert_momenta(p): |
2215 | @@ -86,7 +86,7 @@ |
2216 | # Choice of renormalization scale |
2217 | renormalization_scale = 91.188 |
2218 | |
2219 | -finite_loop_me, return_code = matrix2py.get_me(P, alphas, renormalization_scale, nhel) |
2220 | +finite_loop_me, return_code = matrix2py.{2}get_me(P, alphas, renormalization_scale, nhel) |
2221 | |
2222 | |
2223 | print '='*112 |
2224 | |
2225 | === added file 'madgraph/iolibs/template_files/loop_optimized/check_sa_all.py.inc' |
2226 | --- madgraph/iolibs/template_files/loop_optimized/check_sa_all.py.inc 1970-01-01 00:00:00 +0000 |
2227 | +++ madgraph/iolibs/template_files/loop_optimized/check_sa_all.py.inc 2017-07-29 19:33:46 +0000 |
2228 | @@ -0,0 +1,139 @@ |
2229 | +#! /usr/bin/env python |
2230 | + |
2231 | +# This is an example of how to run MadLoop from Python using the f2py compilation of the wrapper file 'f2py_wrapper.f'. |
2232 | + |
2233 | +import os |
2234 | +import sys |
2235 | +import subprocess |
2236 | + |
2237 | +pjoin = os.path.join |
2238 | +root_path = os.path.dirname(os.path.realpath( __file__ )) |
2239 | +sys.path.insert(0, root_path) |
2240 | + |
2241 | +try: |
2242 | + import allmatrix2py |
2243 | +except: |
2244 | + if os.path.isfile(pjoin(root_path,'makefile')) and \ |
2245 | + os.path.isfile(pjoin(root_path,'all_matrix.f')) and \ |
2246 | + not os.path.isfile(pjoin(root_path,'allmatrix2py.so')): |
2247 | + print "Trying to automatically generate the python module 'allmatrix2py.so' with f2py..." |
2248 | + p = subprocess.Popen(['make','allmatrix2py.so'], stdout=subprocess.PIPE, |
2249 | + stderr=subprocess.PIPE, cwd=root_path) |
2250 | + (out, err) = p.communicate() |
2251 | + if p.returncode or not os.path.isfile(pjoin(root_path,'allmatrix2py.so')): |
2252 | + print "ERROR: Failed to produce 'allmatrix2py.so' with 'make allmatrix2py.so' in '%s'. The error was:\n%s"%(root_path,err) |
2253 | + sys.exit(0) |
2254 | + try: |
2255 | + import allmatrix2py |
2256 | + except: |
2257 | + print "ERROR: Could not load the f2py module 'allmatrix2py.so'. The following error occurred:\n",sys.exc_info()[0] |
2258 | + sys.exit(0) |
2259 | + else: |
2260 | + if os.path.exists(pjoin(root_path,'allmatrix2py.so')): |
2261 | + print "ERROR: Could not load the f2py module 'matrix2py.so'. The following error occurred:\n",sys.exc_info()[0] |
2262 | + sys.exit(0) |
2263 | + else: |
2264 | + print "ERROR: Could not find the 'matrix2py.so' f2py module. Please generate it by running:\n"+\ |
2265 | + " > make matrix2py.so\n"+\ |
2266 | + "in the <PROC_OUTPUT>/SubProcesses/P<chosen_proc> directory." |
2267 | + sys.exit(0) |
2268 | + |
2269 | +# Now we can use this MadLoop python module. |
2270 | + |
2271 | +# This is a handy way of looking at what is available in the imported f2py module |
2272 | +# print help(matrix2py) |
2273 | + |
2274 | +# Read the model parameters |
2275 | +allmatrix2py.initialise(os.path.abspath(pjoin(root_path,os.pardir,'Cards','param_card.dat'))) |
2276 | +# Specify where MadLoop5_resources is |
2277 | +allmatrix2py.set_madloop_path(os.path.abspath(pjoin(root_path,'MadLoop5_resources'))) |
2278 | +# List all processes available in this module |
2279 | + |
2280 | +all_procs_available = [[pdg for pdg in proc_pdgs if pdg!=0] for proc_pdgs in allmatrix2py.get_pdg_order()] |
2281 | +print "Available processes are:" |
2282 | +for process_pdgs in all_procs_available: |
2283 | + print " --> %s"%str(process_pdgs) |
2284 | + |
2285 | +def invert_momenta(p): |
2286 | + """ fortran/C-python do not order table in the same order""" |
2287 | + return [[p[j][i] for j in range(len(p))] for i in range(len(p[0]))] |
2288 | + |
2289 | +# Now choose MadLoop's inputs for this evaluation |
2290 | + |
2291 | +# The kinematic configuration in the convention (E, px, py, pz) and with particles ordered as in the process definition. |
2292 | +# This is the structure of this dictionary. |
2293 | +p= dict( (tuple(process_pdgs),[[None,]*4]*len(process_pdgs)) for process_pdgs in all_procs_available) |
2294 | + |
2295 | +if (p.values()[0])[0][0] is None: |
2296 | + if not os.path.isfile(pjoin(root_path,'PS.input')): |
2297 | + print "\n\n===================================================================================================================" |
2298 | + print "* No kinematics defined! *" |
2299 | + print "* ------------------------------------- *" |
2300 | + print "* Please either define your kinematic configuration directly in check_sa.py or in a file 'PS.input'. Exiting now. *" |
2301 | + print " Here is an example of the content of such a file for a process output containing g g > h and g g > h g." |
2302 | + print \ |
2303 | +""" |
2304 | + |
2305 | +\"\"\" |
2306 | +Process=[21,21,25] |
2307 | +6.250000000000000E+001 0.000000000000000E+000 0.000000000000000E+000 6.250000000000000E+001 |
2308 | +6.250000000000000E+001 0.000000000000000E+000 0.000000000000000E+000 -6.250000000000000E+001 |
2309 | +1.250000000000000E+002 0.000000000000000E+000 0.000000000000000E+000 0.000000000000000E+000 |
2310 | + |
2311 | +Process=[21,21,25,21] |
2312 | +5.000000000000000E+002 0.000000000000000E+000 0.000000000000000E+000 5.000000000000000E+002 |
2313 | +5.000000000000000E+002 0.000000000000000E+000 0.000000000000000E+000 -5.000000000000000E+002 |
2314 | +5.078125000000001E+002 -1.567603625592635E+002 2.039552324827553E+002 4.196152845517468E+002 |
2315 | +4.921874999999999E+002 1.567603625592635E+002 -2.039552324827552E+002 -4.196152845517467E+002 |
2316 | +\"\"\" |
2317 | +""" |
2318 | + print "===================================================================================================================\n\n" |
2319 | + sys.exit(0) |
2320 | + try: |
2321 | + p = {} |
2322 | + current_process = None |
2323 | + current_p = [] |
2324 | + for line in open(pjoin(root_path,'PS.input'),'r').readlines(): |
2325 | + if line.startswith('Process='): |
2326 | + if not current_process is None: |
2327 | + p[current_process] = current_p |
2328 | + current_p = [] |
2329 | + current_process = tuple(eval(line[8:])) |
2330 | + continue |
2331 | + if len(line.split())>0: |
2332 | + current_p.append([float(line.split()[j]) for j in range(4)]) |
2333 | + p[current_process] = current_p |
2334 | + except: |
2335 | + print "ERROR: File PS.input is malformed. Error was:\n",sys.exc_info()[0] |
2336 | + sys.exit(0) |
2337 | + |
2338 | + |
2339 | +for iProc, (process_pdgs, kinematic_config) in enumerate(p.items()): |
2340 | + print '='*112 |
2341 | + P =invert_momenta(kinematic_config) |
2342 | + # Alpha_s value |
2343 | + alphas = 0.118 |
2344 | + # -1 means that the MadLoop averages/sum over helicity configuration. |
2345 | + # If a positive integer is picked it corresponds to the position of the helicity configuration listed in the file |
2346 | + # 'MadLoop5_resouces/ML5_<id>_HelConfigs.dat' |
2347 | + nhel = -1 # means sum over all helicity |
2348 | + # Choice of renormalization scale |
2349 | + renormalization_scale = 91.188 |
2350 | + |
2351 | + finite_loop_me, return_code = allmatrix2py.smatrixhel(pdgs=list(process_pdgs), |
2352 | + p=P, alphas=alphas,scales2=renormalization_scale,nhel=nhel) |
2353 | + |
2354 | + print '* %-108s *'%' MadLoop evaluation for the process ' |
2355 | + print '* %-108s *'%(' %s'%str(process_pdgs)) |
2356 | + print '* %-108s *'%' and the kinematic configuration:' |
2357 | + print '* %-108s *'%((' %-3s'+' %-25s'*4)%('#','E',' p_x',' p_y',' p_z')) |
2358 | + for i,k in enumerate(kinematic_config): |
2359 | + # The complicated printout below is just so as to align the digits negative numbers with positive ones |
2360 | + print '* %-108s *'%((' %-3d%s')%(i, |
2361 | + ''.join([' %-25.15e'%e if j==0 or e<0.0 else ' %-24.15e'%e for j,e in enumerate(k)]))) |
2362 | + print '* %-108s *'%('-'*108) |
2363 | + print '* %-108s *'%(' Finite part obtained for the loop matrix element (Madloop return_code=%d )'%return_code) |
2364 | + print '* %-108s *'%'' |
2365 | + print '* %-108s *'%(' %.18e'%finite_loop_me) |
2366 | + print '* %-108s *'%'' |
2367 | + print '='*112 |
2368 | |
2369 | === modified file 'madgraph/iolibs/template_files/loop_optimized/loop_matrix_standalone.inc' |
2370 | --- madgraph/iolibs/template_files/loop_optimized/loop_matrix_standalone.inc 2016-09-08 23:15:34 +0000 |
2371 | +++ madgraph/iolibs/template_files/loop_optimized/loop_matrix_standalone.inc 2017-07-29 19:33:46 +0000 |
2372 | @@ -2149,6 +2149,15 @@ |
2373 | ENDDO |
2374 | ENDIF |
2375 | |
2376 | +c If NaN are present in the evaluation, automatically set the accuracy to 1.0d99. |
2377 | + DO I=1,3 |
2378 | + DO J=1,MAXSTABILITYLENGTH |
2379 | + IF (isnan(FULLLIST(I,K,J))) then |
2380 | + ACC(K) = 1.0d99 |
2381 | + ENDIF |
2382 | + ENDDO |
2383 | + ENDDO |
2384 | + |
2385 | enddo |
2386 | |
2387 | end |
2388 | |
2389 | === added file 'madgraph/iolibs/template_files/makefile_sa_f2py' |
2390 | --- madgraph/iolibs/template_files/makefile_sa_f2py 1970-01-01 00:00:00 +0000 |
2391 | +++ madgraph/iolibs/template_files/makefile_sa_f2py 2017-07-29 19:33:46 +0000 |
2392 | @@ -0,0 +1,23 @@ |
2393 | +include ../Source/make_opts |
2394 | +SHELL = /bin/bash |
2395 | +LIBDIR = ../lib/ |
2396 | +PROG = check |
2397 | +LINKLIBS = -L../lib/ -ldhelas -lmodel |
2398 | +LIBS = $(LIBDIR)libdhelas.$(libext) $(LIBDIR)libmodel.$(libext) |
2399 | +PROCESS= allmatrix.o |
2400 | +LIBRARY = libmatrix.a |
2401 | + |
2402 | +# For python linking (require f2py part of numpy) |
2403 | +ifeq ($(origin MENUM),undefined) |
2404 | + MENUM=2 |
2405 | +endif |
2406 | + |
2407 | + |
2408 | +allmatrix$(MENUM)py.so: $(LIBDIR)/$(LIBRARY) all_matrix.o |
2409 | + $(F2PY) $(LINKLIBS) -lmatrix -c all_matrix.f */matrix.f -m allmatrix$(MENUM)py |
2410 | + |
2411 | + |
2412 | + |
2413 | +$(LIBDIR)/$(LIBRARY): $(patsubst %.f,%.o,$(wildcard */matrix.f)) all_matrix.o |
2414 | + $(call CREATELIB, $@, $^) |
2415 | + |
2416 | |
2417 | === modified file 'madgraph/iolibs/template_files/matrix_standalone_splitOrders_v4.inc' |
2418 | --- madgraph/iolibs/template_files/matrix_standalone_splitOrders_v4.inc 2016-03-22 20:44:25 +0000 |
2419 | +++ madgraph/iolibs/template_files/matrix_standalone_splitOrders_v4.inc 2017-07-29 19:33:46 +0000 |
2420 | @@ -292,7 +292,7 @@ |
2421 | |
2422 | END |
2423 | |
2424 | - SUBROUTINE %(proc_prefix)sGET_ME(P, ALPHAS, NHEL ,ANS) |
2425 | + SUBROUTINE %(proc_prefix)sGET_value(P, ALPHAS, NHEL ,ANS) |
2426 | IMPLICIT NONE |
2427 | C |
2428 | C CONSTANT |
2429 | @@ -325,10 +325,10 @@ |
2430 | return |
2431 | end |
2432 | |
2433 | - SUBROUTINE %(proc_prefix)sINITIALISE(PATH) |
2434 | + SUBROUTINE %(proc_prefix)sINITIALISEMODEL(PATH) |
2435 | C ROUTINE FOR F2PY to read the benchmark point. |
2436 | IMPLICIT NONE |
2437 | - CHARACTER*180 PATH |
2438 | + CHARACTER*512 PATH |
2439 | CF2PY INTENT(IN) :: PATH |
2440 | call setpara(PATH) !first call to setup the paramaters |
2441 | return |
2442 | |
2443 | === modified file 'madgraph/iolibs/template_files/matrix_standalone_v4.inc' |
2444 | --- madgraph/iolibs/template_files/matrix_standalone_v4.inc 2016-03-22 20:44:25 +0000 |
2445 | +++ madgraph/iolibs/template_files/matrix_standalone_v4.inc 2017-07-29 19:33:46 +0000 |
2446 | @@ -66,6 +66,8 @@ |
2447 | C LOCAL VARIABLES |
2448 | C |
2449 | INTEGER NHEL(NEXTERNAL,NCOMB),NTRY |
2450 | +C put in common block to expose this variable to python interface |
2451 | + COMMON/%(proc_prefix)sPROCESS_NHEL/NHEL |
2452 | REAL*8 T |
2453 | REAL*8 %(proc_prefix)sMATRIX |
2454 | INTEGER IHEL,IDEN, I, J |
2455 | @@ -208,7 +210,7 @@ |
2456 | %(amp2_lines)s |
2457 | END |
2458 | |
2459 | - SUBROUTINE %(proc_prefix)sGET_ME(P, ALPHAS, NHEL ,ANS) |
2460 | + SUBROUTINE %(proc_prefix)sGET_value(P, ALPHAS, NHEL ,ANS) |
2461 | IMPLICIT NONE |
2462 | C |
2463 | C CONSTANT |
2464 | @@ -241,10 +243,10 @@ |
2465 | return |
2466 | end |
2467 | |
2468 | - SUBROUTINE %(proc_prefix)sINITIALISE(PATH) |
2469 | + SUBROUTINE %(proc_prefix)sINITIALISEMODEL(PATH) |
2470 | C ROUTINE FOR F2PY to read the benchmark point. |
2471 | IMPLICIT NONE |
2472 | - CHARACTER*180 PATH |
2473 | + CHARACTER*512 PATH |
2474 | CF2PY INTENT(IN) :: PATH |
2475 | call setpara(PATH) !first call to setup the paramaters |
2476 | return |
2477 | |
2478 | === modified file 'madgraph/loop/loop_diagram_generation.py' |
2479 | --- madgraph/loop/loop_diagram_generation.py 2016-08-25 12:35:03 +0000 |
2480 | +++ madgraph/loop/loop_diagram_generation.py 2017-07-29 19:33:46 +0000 |
2481 | @@ -384,7 +384,7 @@ |
2482 | # By default the user filter does nothing if filter is not set, |
2483 | # if you want to turn it on and edit it by hand, then set the |
2484 | # variable edit_filter_manually to True |
2485 | - edit_filter_manually = False |
2486 | + edit_filter_manually = False |
2487 | if not edit_filter_manually and filter in [None,'None']: |
2488 | return |
2489 | if isinstance(filter,str) and filter.lower() == 'true': |
2490 | @@ -414,11 +414,19 @@ |
2491 | except Exception as e: |
2492 | raise InvalidCmd("The user-defined filter '%s' did not"%filter+ |
2493 | " returned the following error:\n > %s"%str(e)) |
2494 | + |
2495 | +# if any([abs(pdg) not in range(1,7) for pdg in diag.get_loop_lines_pdgs()]): |
2496 | +# valid_diag = False |
2497 | + |
2498 | # if any([abs(i)!=1000021 for i in diag.get_loop_lines_pdgs()]): |
2499 | # valid_diag=False |
2500 | # if len(diag.get_loop_lines_pdgs())<4: |
2501 | # valid_diag = False |
2502 | |
2503 | +# connected_id = diag.get_pdgs_attached_to_loop(structs) |
2504 | +# if connected_id.count(22)!=2 or not all(abs(pdg) in range(7) for pdg in diag.get_loop_lines_pdgs()): |
2505 | +# valid_diag=False |
2506 | + |
2507 | # Ex. 0: Chose a specific diagram number, here the 8th one for ex. |
2508 | # if i not in [31]: |
2509 | # valid_diag = False |
2510 | |
2511 | === modified file 'madgraph/loop/loop_exporters.py' |
2512 | --- madgraph/loop/loop_exporters.py 2017-03-07 15:43:44 +0000 |
2513 | +++ madgraph/loop/loop_exporters.py 2017-07-29 19:33:46 +0000 |
2514 | @@ -80,14 +80,15 @@ |
2515 | ProcessExporterFortran but give access to arguments like dir_path and |
2516 | clean using options. This avoids method resolution object ambiguity""" |
2517 | |
2518 | - default_opt = {'clean': False, 'complex_mass':False, |
2519 | + default_opt = dict(export_v4.ProcessExporterFortran.default_opt) |
2520 | + default_opt.update({'clean': False, 'complex_mass':False, |
2521 | 'export_format':'madloop', 'mp':True, |
2522 | 'loop_dir':'', 'cuttools_dir':'', |
2523 | 'fortran_compiler':'gfortran', |
2524 | 'SubProc_prefix': 'P', |
2525 | 'output_dependencies': 'external', |
2526 | 'compute_color_flows': False, |
2527 | - 'mode':''} |
2528 | + 'mode':''}) |
2529 | |
2530 | include_names = {'ninja' : 'mninja.mod', |
2531 | 'golem' : 'generic_function_1p.mod', |
2532 | @@ -242,6 +243,133 @@ |
2533 | |
2534 | self.loop_additional_template_setup() |
2535 | |
2536 | + def write_f2py_makefile(self): |
2537 | + return |
2538 | + |
2539 | + def write_f2py_check_sa(self, matrix_element, output_path): |
2540 | + """ Write the general check_sa.py in SubProcesses that calls all processes successively.""" |
2541 | + |
2542 | + # No need to further edit this file for now. |
2543 | + file = open(os.path.join(self.template_dir,\ |
2544 | + 'check_sa_all.py.inc')).read() |
2545 | + open(output_path,'w').writelines(file) |
2546 | + # Make it executable |
2547 | + os.chmod(output_path, os.stat(output_path).st_mode | stat.S_IEXEC) |
2548 | + |
2549 | + def write_f2py_splitter(self): |
2550 | + """write a function to call the correct matrix element""" |
2551 | + |
2552 | + template = """ |
2553 | +%(python_information)s |
2554 | + |
2555 | + SUBROUTINE INITIALISE(PATH) |
2556 | +C ROUTINE FOR F2PY to read the benchmark point. |
2557 | + IMPLICIT NONE |
2558 | + CHARACTER*512 PATH |
2559 | +CF2PY INTENT(IN) :: PATH |
2560 | + CALL SETPARA(PATH) !first call to setup the paramaters |
2561 | + RETURN |
2562 | + END |
2563 | + |
2564 | + SUBROUTINE SET_MADLOOP_PATH(PATH) |
2565 | +C Routine to set the path of the folder 'MadLoop5_resources' to MadLoop |
2566 | + CHARACTER(512) PATH |
2567 | +CF2PY intent(in)::path |
2568 | + CALL SETMADLOOPPATH(PATH) |
2569 | + END |
2570 | + |
2571 | + subroutine smatrixhel(pdgs, npdg, p, ALPHAS, SCALES2, nhel, ANS, RETURNCODE) |
2572 | + IMPLICIT NONE |
2573 | + |
2574 | +CF2PY double precision, intent(in), dimension(0:3,npdg) :: p |
2575 | +CF2PY integer, intent(in), dimension(npdg) :: pdgs |
2576 | +CF2PY integer, intent(in) :: npdg |
2577 | +CF2PY double precision, intent(out) :: ANS |
2578 | +CF2PY integer, intent(out) :: RETURNCODE |
2579 | +CF2PY double precision, intent(in) :: ALPHAS |
2580 | +CF2PY double precision, intent(in) :: SCALES2 |
2581 | + |
2582 | + integer pdgs(*) |
2583 | + integer npdg, nhel, RETURNCODE |
2584 | + double precision p(*) |
2585 | + double precision ANS, ALPHAS, PI,SCALES2 |
2586 | + |
2587 | +%(smatrixhel)s |
2588 | + |
2589 | + return |
2590 | + end |
2591 | + |
2592 | + subroutine get_pdg_order(OUT) |
2593 | + IMPLICIT NONE |
2594 | +CF2PY INTEGER, intent(out) :: OUT(%(nb_me)i,%(maxpart)i) |
2595 | + |
2596 | + INTEGER OUT(%(nb_me)i,%(maxpart)i), PDGS(%(nb_me)i,%(maxpart)i) |
2597 | + DATA PDGS/ %(pdgs)s / |
2598 | + OUT=PDGS |
2599 | + RETURN |
2600 | + END |
2601 | + |
2602 | + subroutine get_prefix(PREFIX) |
2603 | + IMPLICIT NONE |
2604 | +CF2PY CHARACTER*20, intent(out) :: PREFIX(%(nb_me)i) |
2605 | + character*20 PREFIX(%(nb_me)i),PREF(%(nb_me)i) |
2606 | + DATA PREF / '%(prefix)s'/ |
2607 | + PREFIX = PREF |
2608 | + RETURN |
2609 | + END |
2610 | + |
2611 | + """ |
2612 | + |
2613 | + allids = self.prefix_info.keys() |
2614 | + allprefix = [self.prefix_info[key][0] for key in allids] |
2615 | + min_nexternal = min([len(ids) for ids in allids]) |
2616 | + max_nexternal = max([len(ids) for ids in allids]) |
2617 | + |
2618 | + info = [] |
2619 | + for key, (prefix, tag) in self.prefix_info.items(): |
2620 | + info.append('#PY %s : %s # %s' % (tag, key, prefix)) |
2621 | + |
2622 | + |
2623 | + text = [] |
2624 | + for n_ext in range(min_nexternal, max_nexternal+1): |
2625 | + current = [ids for ids in allids if len(ids)==n_ext] |
2626 | + if not current: |
2627 | + continue |
2628 | + if min_nexternal != max_nexternal: |
2629 | + if n_ext == min_nexternal: |
2630 | + text.append(' if (npdg.eq.%i)then' % n_ext) |
2631 | + else: |
2632 | + text.append(' else if (npdg.eq.%i)then' % n_ext) |
2633 | + for ii,pdgs in enumerate(current): |
2634 | + condition = '.and.'.join(['%i.eq.pdgs(%i)' %(pdg, i+1) for i, pdg in enumerate(pdgs)]) |
2635 | + if ii==0: |
2636 | + text.append( ' if(%s) then ! %i' % (condition, i)) |
2637 | + else: |
2638 | + text.append( ' else if(%s) then ! %i' % (condition,i)) |
2639 | + text.append(' call %sget_me(p, ALPHAS, DSQRT(SCALES2), NHEL, ANS, RETURNCODE)' % self.prefix_info[pdgs][0]) |
2640 | + text.append(' endif') |
2641 | + #close the function |
2642 | + if min_nexternal != max_nexternal: |
2643 | + text.append('endif') |
2644 | + |
2645 | + formatting = {'python_information':'\n'.join(info), |
2646 | + 'smatrixhel': '\n'.join(text), |
2647 | + 'maxpart': max_nexternal, |
2648 | + 'nb_me': len(allids), |
2649 | + 'pdgs': ','.join([str(pdg[i]) if i<len(pdg) else '0' |
2650 | + for i in range(max_nexternal) \ |
2651 | + for pdg in allids]), |
2652 | + 'prefix':'\',\''.join(allprefix) |
2653 | + } |
2654 | + |
2655 | + |
2656 | + text = template % formatting |
2657 | + fsock = writers.FortranWriter(pjoin(self.dir_path, 'SubProcesses', 'all_matrix.f'),'w') |
2658 | + fsock.writelines(text) |
2659 | + fsock.close() |
2660 | + |
2661 | + |
2662 | + |
2663 | def loop_additional_template_setup(self, copy_Source_makefile = True): |
2664 | """ Perform additional actions specific for this class when setting |
2665 | up the template with the copy_template function.""" |
2666 | @@ -832,6 +960,11 @@ |
2667 | dict['proc_prefix'] = self.get_ME_identifier(matrix_element, |
2668 | group_number = group_number, group_elem_number = proc_id) |
2669 | |
2670 | + if 'prefix' in self.cmd_options and self.cmd_options['prefix'] in ['int','proc']: |
2671 | + for proc in matrix_element.get('processes'): |
2672 | + ids = [l.get('id') for l in proc.get('legs_with_decays')] |
2673 | + self.prefix_info[tuple(ids)] = [dict['proc_prefix'], proc.get_tag()] |
2674 | + |
2675 | # The proc_id is used for MadEvent grouping, so none of our concern here |
2676 | # and it is simply set to an empty string. |
2677 | dict['proc_id'] = '' |
2678 | @@ -1071,9 +1204,15 @@ |
2679 | # We can always write the f2py wrapper if present (in loop optimized mode, it is) |
2680 | if not os.path.isfile(pjoin(self.template_dir,'check_py.f.inc')): |
2681 | return |
2682 | + |
2683 | file = open(os.path.join(self.template_dir,\ |
2684 | 'check_py.f.inc')).read() |
2685 | - file=file%replace_dict |
2686 | + |
2687 | + if 'prefix' in self.cmd_options and self.cmd_options['prefix'] in ['int','proc']: |
2688 | + replace_dict['prefix_routine'] = replace_dict['proc_prefix'] |
2689 | + else: |
2690 | + replace_dict['prefix_routine'] = '' |
2691 | + file=file%replace_dict |
2692 | new_path = writer.name.replace('check_sa.f', 'f2py_wrapper.f') |
2693 | new_writer = writer.__class__(new_path, 'w') |
2694 | new_writer.writelines(file) |
2695 | @@ -1088,7 +1227,8 @@ |
2696 | p= [[None,]*4]*%d"""%len(curr_proc.get('legs')) |
2697 | |
2698 | process_definition_string = curr_proc.nice_string().replace('Process:','') |
2699 | - file=file.format(random_PSpoint_python_formatted,process_definition_string) |
2700 | + file=file.format(random_PSpoint_python_formatted,process_definition_string, |
2701 | + replace_dict['proc_prefix'].lower()) |
2702 | new_path = writer.name.replace('check_sa.f', 'check_sa.py') |
2703 | new_writer = open(new_path, 'w') |
2704 | new_writer.writelines(file) |
2705 | |
2706 | === modified file 'madgraph/various/banner.py' |
2707 | --- madgraph/various/banner.py 2017-03-03 10:01:29 +0000 |
2708 | +++ madgraph/various/banner.py 2017-07-29 19:33:46 +0000 |
2709 | @@ -333,7 +333,6 @@ |
2710 | |
2711 | def modify_init_cross(self, cross): |
2712 | """modify the init information with the associate cross-section""" |
2713 | - |
2714 | assert isinstance(cross, dict) |
2715 | # assert "all" in cross |
2716 | assert "init" in self |
2717 | |
2718 | === modified file 'madgraph/various/lhe_parser.py' |
2719 | --- madgraph/various/lhe_parser.py 2017-03-04 20:26:57 +0000 |
2720 | +++ madgraph/various/lhe_parser.py 2017-07-29 19:33:46 +0000 |
2721 | @@ -2019,7 +2019,7 @@ |
2722 | |
2723 | @property |
2724 | def mass(self): |
2725 | - """return the mass""" |
2726 | + """return the mass""" |
2727 | return math.sqrt(self.E**2 - self.px**2 - self.py**2 - self.pz**2) |
2728 | |
2729 | @property |
2730 | @@ -2029,7 +2029,7 @@ |
2731 | |
2732 | @property |
2733 | def pt(self): |
2734 | - return math.sqrt(max(0, self.pt2())) |
2735 | + return math.sqrt(max(0, self.pt2)) |
2736 | |
2737 | @property |
2738 | def pseudorapidity(self): |
2739 | @@ -2041,7 +2041,7 @@ |
2740 | return 0.5* math.log((self.E +self.pz) / (self.E - self.pz)) |
2741 | |
2742 | |
2743 | - |
2744 | + @property |
2745 | def pt2(self): |
2746 | """ return the pt square """ |
2747 | |
2748 | @@ -2314,11 +2314,13 @@ |
2749 | class NLO_PARTIALWEIGHT(object): |
2750 | |
2751 | class BasicEvent(list): |
2752 | + |
2753 | |
2754 | def __init__(self, momenta, wgts, event, real_type=(1,11)): |
2755 | + |
2756 | list.__init__(self, momenta) |
2757 | - |
2758 | assert self |
2759 | + self.soft = False |
2760 | self.wgts = wgts |
2761 | self.pdgs = list(wgts[0].pdgs) |
2762 | self.event = event |
2763 | @@ -2338,58 +2340,130 @@ |
2764 | self.pop(ind2) |
2765 | self.pdgs.pop(ind1) |
2766 | self.pdgs.insert(ind1, wgts[0].merge_new_pdg ) |
2767 | - self.pdgs.pop(ind2) |
2768 | + self.pdgs.pop(ind2) |
2769 | + #ensure the onshell of the particle |
2770 | + self.put_onshell(ind1, 0) |
2771 | # DO NOT update the pdgs of the partial weight! |
2772 | + |
2773 | elif any(w.type in self.real_type for w in wgts): |
2774 | if any(w.type not in self.real_type for w in wgts): |
2775 | raise Exception |
2776 | - # check if this is too soft/colinear if so use the born |
2777 | - ind1, ind2 = [ind-1 for ind in wgts[0].to_merge_pdg] |
2778 | - if ind1> ind2: |
2779 | - ind1, ind2 = ind2, ind1 |
2780 | - if ind1 >= sum(1 for p in event if p.status==-1): |
2781 | - new_p = self[ind1] + self[ind2] |
2782 | - else: |
2783 | - new_p = self[ind1] - self[ind2] |
2784 | - |
2785 | - if __debug__: |
2786 | - ptot = FourMomentum() |
2787 | - for i in xrange(len(self)): |
2788 | - if i <2: |
2789 | - ptot += self[i] |
2790 | - else: |
2791 | - ptot -= self[i] |
2792 | - if ptot.mass_sqr > 1e-16: |
2793 | - misc.sprint(ptot, ptot.mass_sqr) |
2794 | - |
2795 | - inv_mass = new_p.mass_sqr |
2796 | - shat = (self[0]+self[1]).mass_sqr |
2797 | - if (abs(inv_mass)/shat < 1e-6): |
2798 | -# misc.sprint(abs(inv_mass)/shat) |
2799 | - self.pop(ind1) |
2800 | - self.insert(ind1, new_p) |
2801 | - self.pop(ind2) |
2802 | - self.pdgs.pop(ind1) |
2803 | - self.pdgs.insert(ind1, wgts[0].merge_new_pdg ) |
2804 | - self.pdgs.pop(ind2) |
2805 | - # DO NOT update the pdgs of the partial weight! |
2806 | - |
2807 | - if __debug__: |
2808 | - ptot = FourMomentum() |
2809 | - for i in xrange(len(self)): |
2810 | - if i <2: |
2811 | - ptot += self[i] |
2812 | - else: |
2813 | - ptot -= self[i] |
2814 | - if ptot.mass_sqr > 1e-16: |
2815 | - misc.sprint(ptot, ptot.mass_sqr) |
2816 | -# raise Exception |
2817 | + # Do nothing !!! |
2818 | + # previously (commented we were checking here if the particle |
2819 | + # were too soft this is done later now |
2820 | +# The comment line below allow to convert this event |
2821 | +# to a born one (old method) |
2822 | +# self.pop(ind1) |
2823 | +# self.insert(ind1, new_p) |
2824 | +# self.pop(ind2) |
2825 | +# self.pdgs.pop(ind1) |
2826 | +# self.pdgs.insert(ind1, wgts[0].merge_new_pdg ) |
2827 | +# self.pdgs.pop(ind2) |
2828 | +# # DO NOT update the pdgs of the partial weight! |
2829 | else: |
2830 | raise Exception |
2831 | + |
2832 | + def check_fks_singularity(self, ind1, ind2, nb_init=2, threshold=1e-6): |
2833 | + """check that the propagator associated to ij is not too light |
2834 | + [related to soft-collinear singularity]""" |
2835 | + |
2836 | + if ind1> ind2: |
2837 | + ind1, ind2 = ind2, ind1 |
2838 | + if ind1 >= nb_init: |
2839 | + new_p = self[ind1] + self[ind2] |
2840 | + else: |
2841 | + new_p = self[ind1] - self[ind2] |
2842 | + |
2843 | + inv_mass = new_p.mass_sqr |
2844 | + shat = (self[0]+self[1]).mass_sqr |
2845 | + if (abs(inv_mass)/shat < threshold): |
2846 | + return True |
2847 | + else: |
2848 | + return False |
2849 | + |
2850 | |
2851 | def get_pdg_code(self): |
2852 | return self.pdgs |
2853 | - |
2854 | + |
2855 | + def put_onshell(self, ind, mass): |
2856 | + """ check that particle mass of particle number 'ind' |
2857 | + is onshell and if not use algorithm from VH thesis |
2858 | + to restore them.""" |
2859 | + |
2860 | + if misc.equal(self[ind].mass_sqr, mass**2, 20): |
2861 | + return # nothing to do |
2862 | + |
2863 | + if sum(1 for p in self.event if p.status==-1) == 1: |
2864 | + logger.debug('1 to N can not be put back onshell. Continue') |
2865 | + return # does not work for 1 to N: keep it offshell |
2866 | + |
2867 | + assert self.pdgs[ind] in (range(-6,7)+[21,22]) ,"onshell routine works only for zero mass particle. PDG is not assume massless." |
2868 | + |
2869 | + if ind<2: |
2870 | + self.put_onshell_initial(ind, mass) |
2871 | + else: |
2872 | + raise Exception, 'code not implemented for final state' |
2873 | +# self.put_onshell_final(ind, mass) |
2874 | + |
2875 | + def put_onshell_initial(self, ind, mass): |
2876 | + """ """ |
2877 | + |
2878 | + assert mass == 0 |
2879 | + |
2880 | + ptot = self[0] + self[1] |
2881 | + |
2882 | + # particle 2 should not have any pt. The one reshuffle has a pt |
2883 | + if ind == 0: |
2884 | + p1 = self[0] # the one we modify with pt |
2885 | + p2 = self[1] # original one no pt |
2886 | + else: |
2887 | + p1 = self[1] # the one we modify with pt |
2888 | + p2 = self[0] # original one no pt |
2889 | + |
2890 | + assert misc.equal(p2.px, 0 , 8) |
2891 | + assert misc.equal(p2.py, 0 , 8) |
2892 | + |
2893 | + discr = -ptot.mass_sqr |
2894 | + |
2895 | + shifte1 = ( ptot.E*(ptot.pt2 -2*p1.E*ptot.E +ptot.E**2) + |
2896 | + (2*p1.E-ptot.E)*ptot.pz**2 + ptot.pz*discr |
2897 | + )/ (2*(ptot.E**2-ptot.pz**2)) |
2898 | + |
2899 | + shifte2 = -( ptot.E*(ptot.pt2 + 2*p2.E*ptot.E - ptot.E**2) + |
2900 | + (-2*p2.E + ptot.E)*ptot.pz**2 + ptot.pz*discr |
2901 | + )/ (2*(ptot.E**2-ptot.pz**2)) |
2902 | + |
2903 | + shiftz1 = ( -2*p1.pz*(ptot.E**2 - ptot.pz**2) |
2904 | + + ptot.pz*(ptot.pt2 + ptot.E**2 - ptot.pz**2) |
2905 | + + ptot.E*discr |
2906 | + )/ (2*(ptot.E**2 - ptot.pz**2)) |
2907 | + |
2908 | + |
2909 | + shiftz2 = -( 2*p2.pz*(ptot.E**2 - ptot.pz**2) |
2910 | + + ptot.pz*(ptot.pt2 - ptot.E**2 + ptot.pz**2) |
2911 | + + ptot.E*discr |
2912 | + )/ (2*(ptot.E**2 - ptot.pz**2)) |
2913 | + |
2914 | + |
2915 | + p1 = FourMomentum(p1.E + shifte1, |
2916 | + p1.px, |
2917 | + p1.py, |
2918 | + p1.pz + shiftz1) |
2919 | + |
2920 | + p2 = FourMomentum(p2.E + shifte2, |
2921 | + 0., |
2922 | + 0., |
2923 | + p2.pz + shiftz2) |
2924 | + |
2925 | + if ind == 0: |
2926 | + self[0], self[1] = p1, p2 |
2927 | + else: |
2928 | + self[0], self[1] = p2, p1 |
2929 | + |
2930 | + assert misc.equal(self[0].mass_sqr, 0, 8) |
2931 | + assert misc.equal(self[1].mass_sqr, 0, 8) |
2932 | + |
2933 | + |
2934 | def get_tag_and_order(self): |
2935 | """ return the tag and order for this basic event""" |
2936 | (initial, _), _ = self.event.get_tag_and_order() |
2937 | @@ -2403,7 +2477,7 @@ |
2938 | |
2939 | def get_momenta(self, get_order, allow_reversed=True): |
2940 | """return the momenta vector in the order asked for""" |
2941 | - |
2942 | + |
2943 | #avoid to modify the input |
2944 | order = [list(get_order[0]), list(get_order[1])] |
2945 | out = [''] *(len(order[0])+len(order[1])) |
2946 | @@ -2518,6 +2592,7 @@ |
2947 | #0.359257891118d-05 0.000000000000d+00 0.000000000000d+00 5 21 3 -11 11 3 2 0.12292838d-02 0.43683926d-01 0.58606724d+03 0.58606724d+03 0.58606724d+03 1 12 3 0.334254554762d+00 |
2948 | #0.929944817736d-03 0.000000000000d+00 0.000000000000d+00 5 21 3 -11 11 3 2 0.12112732d-02 0.45047393d-01 0.58606724d+03 0.58606724d+03 0.58606724d+03 2 11 3 0.835109616010d+02 |
2949 | |
2950 | + |
2951 | text = text.lower().replace('d','e') |
2952 | all_line = text.split('\n') |
2953 | #get global information |
2954 | @@ -2541,27 +2616,47 @@ |
2955 | |
2956 | assert len(wgts) == int(nb_wgt) |
2957 | |
2958 | - get_weights_for_momenta = {} |
2959 | + get_weights_for_momenta = dict( (i,[]) for i in range(1,nb_event+1) ) |
2960 | size_momenta = 0 |
2961 | for wgt in wgts: |
2962 | if wgt.momenta_config in get_weights_for_momenta: |
2963 | get_weights_for_momenta[wgt.momenta_config].append(wgt) |
2964 | else: |
2965 | + misc.sprint(wgt.type, wgt.real_related,wgt.momenta_config) |
2966 | if size_momenta == 0: size_momenta = wgt.nexternal |
2967 | assert size_momenta == wgt.nexternal |
2968 | get_weights_for_momenta[wgt.momenta_config] = [wgt] |
2969 | |
2970 | assert sum(len(c) for c in get_weights_for_momenta.values()) == int(nb_wgt), "%s != %s" % (sum(len(c) for c in get_weights_for_momenta.values()), nb_wgt) |
2971 | |
2972 | + # check singular behavior |
2973 | + for key in range(1, nb_event+1): |
2974 | + wgts = get_weights_for_momenta[key] |
2975 | + if not wgts: |
2976 | + continue |
2977 | + if size_momenta == 0: size_momenta = wgts[0].nexternal |
2978 | + p = momenta[size_momenta*(key-1):key*size_momenta] |
2979 | + evt = self.BasicEvent(p, wgts, self.event, self.real_type) |
2980 | + if len(evt) == size_momenta: #real type |
2981 | + for wgt in wgts: |
2982 | + if evt.check_fks_singularity(wgt.to_merge_pdg[0]-1, |
2983 | + wgt.to_merge_pdg[1]-1, |
2984 | + nb_init=sum(1 for p in self.event if p.status==-1)): |
2985 | + get_weights_for_momenta[wgt.momenta_config].remove(wgt) |
2986 | + get_weights_for_momenta[wgt.born_related].append(wgt) |
2987 | + |
2988 | |
2989 | - |
2990 | + assert sum(len(c) for c in get_weights_for_momenta.values()) == int(nb_wgt), "%s != %s" % (sum(len(c) for c in get_weights_for_momenta.values()), nb_wgt) |
2991 | + |
2992 | self.cevents = [] |
2993 | for key in range(1, nb_event+1): |
2994 | if key in get_weights_for_momenta: |
2995 | wgt = get_weights_for_momenta[key] |
2996 | - evt = self.BasicEvent(momenta[:size_momenta], get_weights_for_momenta[key], self.event, self.real_type) |
2997 | + if not wgt: |
2998 | + continue |
2999 | + p = momenta[size_momenta*(key-1):key*size_momenta] |
3000 | + evt = self.BasicEvent(p, get_weights_for_momenta[key], self.event, self.real_type) |
3001 | self.cevents.append(evt) |
3002 | - momenta = momenta[size_momenta:] |
3003 | |
3004 | nb_wgt_check = 0 |
3005 | for cevt in self.cevents: |
3006 | |
3007 | === modified file 'madgraph/various/misc.py' |
3008 | --- madgraph/various/misc.py 2017-03-03 23:41:19 +0000 |
3009 | +++ madgraph/various/misc.py 2017-07-29 19:33:46 +0000 |
3010 | @@ -1689,7 +1689,23 @@ |
3011 | |
3012 | |
3013 | |
3014 | - |
3015 | +def plugin_import(module, error_msg, fcts=[]): |
3016 | + """convenient way to import a plugin file/function""" |
3017 | + |
3018 | + try: |
3019 | + _temp = __import__('PLUGIN.%s' % module, globals(), locals(), fcts, -1) |
3020 | + except ImportError: |
3021 | + try: |
3022 | + _temp = __import__('MG5aMC_PLUGIN.%s' % module, globals(), locals(), fcts, -1) |
3023 | + except ImportError: |
3024 | + raise MadGraph5Error, error_msg |
3025 | + |
3026 | + if not fcts: |
3027 | + return _temp |
3028 | + elif len(fcts) == 1: |
3029 | + return getattr(_temp,fcts[0]) |
3030 | + else: |
3031 | + return [getattr(_temp,name) for name in fcts] |
3032 | |
3033 | |
3034 | python_lhapdf=None |
3035 | |
3036 | === modified file 'models/template_files/fortran/lha_read.f' |
3037 | --- models/template_files/fortran/lha_read.f 2014-10-23 00:33:10 +0000 |
3038 | +++ models/template_files/fortran/lha_read.f 2017-07-29 19:33:46 +0000 |
3039 | @@ -259,12 +259,12 @@ |
3040 | enddo |
3041 | |
3042 | npara=npara-1 |
3043 | -c close(iunit) |
3044 | +99 close(iunit) |
3045 | if (WriteParamLog) then |
3046 | close(logfile) |
3047 | endif |
3048 | |
3049 | - 99 return |
3050 | + return |
3051 | |
3052 | end |
3053 | |
3054 | |
3055 | === modified file 'models/template_files/fortran/lha_read_mp.f' |
3056 | --- models/template_files/fortran/lha_read_mp.f 2014-10-23 00:33:10 +0000 |
3057 | +++ models/template_files/fortran/lha_read_mp.f 2017-07-29 19:33:46 +0000 |
3058 | @@ -279,12 +279,12 @@ |
3059 | enddo |
3060 | |
3061 | npara=npara-1 |
3062 | -c close(iunit) |
3063 | + 99 close(iunit) |
3064 | if (WriteParamLog) then |
3065 | close(logfile) |
3066 | endif |
3067 | |
3068 | - 99 return |
3069 | + return |
3070 | |
3071 | end |
3072 | |
3073 | |
3074 | === modified file 'tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%born_matrix.f' |
3075 | --- tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%born_matrix.f 2016-09-15 20:20:30 +0000 |
3076 | +++ tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%born_matrix.f 2017-07-29 19:33:46 +0000 |
3077 | @@ -325,7 +325,7 @@ |
3078 | |
3079 | END |
3080 | |
3081 | - SUBROUTINE GET_ME(P, ALPHAS, NHEL ,ANS) |
3082 | + SUBROUTINE GET_VALUE(P, ALPHAS, NHEL ,ANS) |
3083 | IMPLICIT NONE |
3084 | C |
3085 | C CONSTANT |
3086 | @@ -358,10 +358,10 @@ |
3087 | RETURN |
3088 | END |
3089 | |
3090 | - SUBROUTINE INITIALISE(PATH) |
3091 | + SUBROUTINE INITIALISEMODEL(PATH) |
3092 | C ROUTINE FOR F2PY to read the benchmark point. |
3093 | IMPLICIT NONE |
3094 | - CHARACTER*180 PATH |
3095 | + CHARACTER*512 PATH |
3096 | CF2PY INTENT(IN) :: PATH |
3097 | CALL SETPARA(PATH) !first call to setup the paramaters |
3098 | RETURN |
3099 | |
3100 | === modified file 'tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%V0_udx_wp%born_matrix.f' |
3101 | --- tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%V0_udx_wp%born_matrix.f 2016-09-15 20:20:30 +0000 |
3102 | +++ tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%V0_udx_wp%born_matrix.f 2017-07-29 19:33:46 +0000 |
3103 | @@ -325,7 +325,7 @@ |
3104 | |
3105 | END |
3106 | |
3107 | - SUBROUTINE GET_ME(P, ALPHAS, NHEL ,ANS) |
3108 | + SUBROUTINE GET_VALUE(P, ALPHAS, NHEL ,ANS) |
3109 | IMPLICIT NONE |
3110 | C |
3111 | C CONSTANT |
3112 | @@ -358,10 +358,10 @@ |
3113 | RETURN |
3114 | END |
3115 | |
3116 | - SUBROUTINE INITIALISE(PATH) |
3117 | + SUBROUTINE INITIALISEMODEL(PATH) |
3118 | C ROUTINE FOR F2PY to read the benchmark point. |
3119 | IMPLICIT NONE |
3120 | - CHARACTER*180 PATH |
3121 | + CHARACTER*512 PATH |
3122 | CF2PY INTENT(IN) :: PATH |
3123 | CALL SETPARA(PATH) !first call to setup the paramaters |
3124 | RETURN |
3125 | |
3126 | === modified file 'tests/input_files/IOTestsComparison/IOExportV4IOTest/export_matrix_element_v4_standalone/matrix.f' |
3127 | --- tests/input_files/IOTestsComparison/IOExportV4IOTest/export_matrix_element_v4_standalone/matrix.f 2016-09-15 20:20:30 +0000 |
3128 | +++ tests/input_files/IOTestsComparison/IOExportV4IOTest/export_matrix_element_v4_standalone/matrix.f 2017-07-29 19:33:46 +0000 |
3129 | @@ -68,6 +68,8 @@ |
3130 | C LOCAL VARIABLES |
3131 | C |
3132 | INTEGER NHEL(NEXTERNAL,NCOMB),NTRY |
3133 | +C put in common block to expose this variable to python interface |
3134 | + COMMON/PROCESS_NHEL/NHEL |
3135 | REAL*8 T |
3136 | REAL*8 MATRIX |
3137 | INTEGER IHEL,IDEN, I, J |
3138 | @@ -275,7 +277,7 @@ |
3139 | |
3140 | END |
3141 | |
3142 | - SUBROUTINE GET_ME(P, ALPHAS, NHEL ,ANS) |
3143 | + SUBROUTINE GET_VALUE(P, ALPHAS, NHEL ,ANS) |
3144 | IMPLICIT NONE |
3145 | C |
3146 | C CONSTANT |
3147 | @@ -308,10 +310,10 @@ |
3148 | RETURN |
3149 | END |
3150 | |
3151 | - SUBROUTINE INITIALISE(PATH) |
3152 | + SUBROUTINE INITIALISEMODEL(PATH) |
3153 | C ROUTINE FOR F2PY to read the benchmark point. |
3154 | IMPLICIT NONE |
3155 | - CHARACTER*180 PATH |
3156 | + CHARACTER*512 PATH |
3157 | CF2PY INTENT(IN) :: PATH |
3158 | CALL SETPARA(PATH) !first call to setup the paramaters |
3159 | RETURN |
3160 | |
3161 | === modified file 'tests/input_files/IOTestsComparison/MadLoop_output_from_the_interface/TIR_output/%ggttx_IOTest%SubProcesses%P0_gg_ttx%born_matrix.f' |
3162 | --- tests/input_files/IOTestsComparison/MadLoop_output_from_the_interface/TIR_output/%ggttx_IOTest%SubProcesses%P0_gg_ttx%born_matrix.f 2016-09-15 20:20:30 +0000 |
3163 | +++ tests/input_files/IOTestsComparison/MadLoop_output_from_the_interface/TIR_output/%ggttx_IOTest%SubProcesses%P0_gg_ttx%born_matrix.f 2017-07-29 19:33:46 +0000 |
3164 | @@ -339,7 +339,7 @@ |
3165 | |
3166 | END |
3167 | |
3168 | - SUBROUTINE ML5_0_GET_ME(P, ALPHAS, NHEL ,ANS) |
3169 | + SUBROUTINE ML5_0_GET_VALUE(P, ALPHAS, NHEL ,ANS) |
3170 | IMPLICIT NONE |
3171 | C |
3172 | C CONSTANT |
3173 | @@ -372,10 +372,10 @@ |
3174 | RETURN |
3175 | END |
3176 | |
3177 | - SUBROUTINE ML5_0_INITIALISE(PATH) |
3178 | + SUBROUTINE ML5_0_INITIALISEMODEL(PATH) |
3179 | C ROUTINE FOR F2PY to read the benchmark point. |
3180 | IMPLICIT NONE |
3181 | - CHARACTER*180 PATH |
3182 | + CHARACTER*512 PATH |
3183 | CF2PY INTENT(IN) :: PATH |
3184 | CALL SETPARA(PATH) !first call to setup the paramaters |
3185 | RETURN |
3186 | |
3187 | === modified file 'tests/input_files/IOTestsComparison/SquaredOrder_IOTest/sqso_uux_uuxuuxx/matrix_NoSQSO.f' |
3188 | --- tests/input_files/IOTestsComparison/SquaredOrder_IOTest/sqso_uux_uuxuuxx/matrix_NoSQSO.f 2016-09-15 20:20:30 +0000 |
3189 | +++ tests/input_files/IOTestsComparison/SquaredOrder_IOTest/sqso_uux_uuxuuxx/matrix_NoSQSO.f 2017-07-29 19:33:46 +0000 |
3190 | @@ -68,6 +68,8 @@ |
3191 | C LOCAL VARIABLES |
3192 | C |
3193 | INTEGER NHEL(NEXTERNAL,NCOMB),NTRY |
3194 | +C put in common block to expose this variable to python interface |
3195 | + COMMON/PROCESS_NHEL/NHEL |
3196 | REAL*8 T |
3197 | REAL*8 MATRIX |
3198 | INTEGER IHEL,IDEN, I, J |
3199 | @@ -451,7 +453,7 @@ |
3200 | |
3201 | END |
3202 | |
3203 | - SUBROUTINE GET_ME(P, ALPHAS, NHEL ,ANS) |
3204 | + SUBROUTINE GET_VALUE(P, ALPHAS, NHEL ,ANS) |
3205 | IMPLICIT NONE |
3206 | C |
3207 | C CONSTANT |
3208 | @@ -484,10 +486,10 @@ |
3209 | RETURN |
3210 | END |
3211 | |
3212 | - SUBROUTINE INITIALISE(PATH) |
3213 | + SUBROUTINE INITIALISEMODEL(PATH) |
3214 | C ROUTINE FOR F2PY to read the benchmark point. |
3215 | IMPLICIT NONE |
3216 | - CHARACTER*180 PATH |
3217 | + CHARACTER*512 PATH |
3218 | CF2PY INTENT(IN) :: PATH |
3219 | CALL SETPARA(PATH) !first call to setup the paramaters |
3220 | RETURN |
3221 | |
3222 | === modified file 'tests/input_files/IOTestsComparison/SquaredOrder_IOTest/sqso_uux_uuxuuxx/matrix_QCDsq_le_6.f' |
3223 | --- tests/input_files/IOTestsComparison/SquaredOrder_IOTest/sqso_uux_uuxuuxx/matrix_QCDsq_le_6.f 2016-09-15 20:20:30 +0000 |
3224 | +++ tests/input_files/IOTestsComparison/SquaredOrder_IOTest/sqso_uux_uuxuuxx/matrix_QCDsq_le_6.f 2017-07-29 19:33:46 +0000 |
3225 | @@ -537,7 +537,7 @@ |
3226 | |
3227 | END |
3228 | |
3229 | - SUBROUTINE GET_ME(P, ALPHAS, NHEL ,ANS) |
3230 | + SUBROUTINE GET_VALUE(P, ALPHAS, NHEL ,ANS) |
3231 | IMPLICIT NONE |
3232 | C |
3233 | C CONSTANT |
3234 | @@ -570,10 +570,10 @@ |
3235 | RETURN |
3236 | END |
3237 | |
3238 | - SUBROUTINE INITIALISE(PATH) |
3239 | + SUBROUTINE INITIALISEMODEL(PATH) |
3240 | C ROUTINE FOR F2PY to read the benchmark point. |
3241 | IMPLICIT NONE |
3242 | - CHARACTER*180 PATH |
3243 | + CHARACTER*512 PATH |
3244 | CF2PY INTENT(IN) :: PATH |
3245 | CALL SETPARA(PATH) !first call to setup the paramaters |
3246 | RETURN |
3247 | |
3248 | === modified file 'tests/input_files/IOTestsComparison/SquaredOrder_IOTest/sqso_uux_uuxuuxx/matrix_ampOrderQED2_eq_2_WGTsq_le_14_QCDsq_gt_4.f' |
3249 | --- tests/input_files/IOTestsComparison/SquaredOrder_IOTest/sqso_uux_uuxuuxx/matrix_ampOrderQED2_eq_2_WGTsq_le_14_QCDsq_gt_4.f 2016-09-15 20:20:30 +0000 |
3250 | +++ tests/input_files/IOTestsComparison/SquaredOrder_IOTest/sqso_uux_uuxuuxx/matrix_ampOrderQED2_eq_2_WGTsq_le_14_QCDsq_gt_4.f 2017-07-29 19:33:46 +0000 |
3251 | @@ -537,7 +537,7 @@ |
3252 | |
3253 | END |
3254 | |
3255 | - SUBROUTINE GET_ME(P, ALPHAS, NHEL ,ANS) |
3256 | + SUBROUTINE GET_VALUE(P, ALPHAS, NHEL ,ANS) |
3257 | IMPLICIT NONE |
3258 | C |
3259 | C CONSTANT |
3260 | @@ -570,10 +570,10 @@ |
3261 | RETURN |
3262 | END |
3263 | |
3264 | - SUBROUTINE INITIALISE(PATH) |
3265 | + SUBROUTINE INITIALISEMODEL(PATH) |
3266 | C ROUTINE FOR F2PY to read the benchmark point. |
3267 | IMPLICIT NONE |
3268 | - CHARACTER*180 PATH |
3269 | + CHARACTER*512 PATH |
3270 | CF2PY INTENT(IN) :: PATH |
3271 | CALL SETPARA(PATH) !first call to setup the paramaters |
3272 | RETURN |
3273 | |
3274 | === modified file 'tests/input_files/IOTestsComparison/long_ML_SMQCD_default/dux_mumvmxg/born_matrix.f' |
3275 | --- tests/input_files/IOTestsComparison/long_ML_SMQCD_default/dux_mumvmxg/born_matrix.f 2016-09-15 20:20:30 +0000 |
3276 | +++ tests/input_files/IOTestsComparison/long_ML_SMQCD_default/dux_mumvmxg/born_matrix.f 2017-07-29 19:33:46 +0000 |
3277 | @@ -68,6 +68,8 @@ |
3278 | C LOCAL VARIABLES |
3279 | C |
3280 | INTEGER NHEL(NEXTERNAL,NCOMB),NTRY |
3281 | +C put in common block to expose this variable to python interface |
3282 | + COMMON/ML5_0_PROCESS_NHEL/NHEL |
3283 | REAL*8 T |
3284 | REAL*8 ML5_0_MATRIX |
3285 | INTEGER IHEL,IDEN, I, J |
3286 | @@ -264,7 +266,7 @@ |
3287 | |
3288 | END |
3289 | |
3290 | - SUBROUTINE ML5_0_GET_ME(P, ALPHAS, NHEL ,ANS) |
3291 | + SUBROUTINE ML5_0_GET_VALUE(P, ALPHAS, NHEL ,ANS) |
3292 | IMPLICIT NONE |
3293 | C |
3294 | C CONSTANT |
3295 | @@ -297,10 +299,10 @@ |
3296 | RETURN |
3297 | END |
3298 | |
3299 | - SUBROUTINE ML5_0_INITIALISE(PATH) |
3300 | + SUBROUTINE ML5_0_INITIALISEMODEL(PATH) |
3301 | C ROUTINE FOR F2PY to read the benchmark point. |
3302 | IMPLICIT NONE |
3303 | - CHARACTER*180 PATH |
3304 | + CHARACTER*512 PATH |
3305 | CF2PY INTENT(IN) :: PATH |
3306 | CALL SETPARA(PATH) !first call to setup the paramaters |
3307 | RETURN |
3308 | |
3309 | === modified file 'tests/input_files/IOTestsComparison/long_ML_SMQCD_default/gg_wmtbx/born_matrix.f' |
3310 | --- tests/input_files/IOTestsComparison/long_ML_SMQCD_default/gg_wmtbx/born_matrix.f 2016-09-15 20:20:30 +0000 |
3311 | +++ tests/input_files/IOTestsComparison/long_ML_SMQCD_default/gg_wmtbx/born_matrix.f 2017-07-29 19:33:46 +0000 |
3312 | @@ -68,6 +68,8 @@ |
3313 | C LOCAL VARIABLES |
3314 | C |
3315 | INTEGER NHEL(NEXTERNAL,NCOMB),NTRY |
3316 | +C put in common block to expose this variable to python interface |
3317 | + COMMON/ML5_0_PROCESS_NHEL/NHEL |
3318 | REAL*8 T |
3319 | REAL*8 ML5_0_MATRIX |
3320 | INTEGER IHEL,IDEN, I, J |
3321 | @@ -300,7 +302,7 @@ |
3322 | |
3323 | END |
3324 | |
3325 | - SUBROUTINE ML5_0_GET_ME(P, ALPHAS, NHEL ,ANS) |
3326 | + SUBROUTINE ML5_0_GET_VALUE(P, ALPHAS, NHEL ,ANS) |
3327 | IMPLICIT NONE |
3328 | C |
3329 | C CONSTANT |
3330 | @@ -333,10 +335,10 @@ |
3331 | RETURN |
3332 | END |
3333 | |
3334 | - SUBROUTINE ML5_0_INITIALISE(PATH) |
3335 | + SUBROUTINE ML5_0_INITIALISEMODEL(PATH) |
3336 | C ROUTINE FOR F2PY to read the benchmark point. |
3337 | IMPLICIT NONE |
3338 | - CHARACTER*180 PATH |
3339 | + CHARACTER*512 PATH |
3340 | CF2PY INTENT(IN) :: PATH |
3341 | CALL SETPARA(PATH) !first call to setup the paramaters |
3342 | RETURN |
3343 | |
3344 | === modified file 'tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/dux_mumvmxg/born_matrix.f' |
3345 | --- tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/dux_mumvmxg/born_matrix.f 2016-09-15 20:20:30 +0000 |
3346 | +++ tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/dux_mumvmxg/born_matrix.f 2017-07-29 19:33:46 +0000 |
3347 | @@ -68,6 +68,8 @@ |
3348 | C LOCAL VARIABLES |
3349 | C |
3350 | INTEGER NHEL(NEXTERNAL,NCOMB),NTRY |
3351 | +C put in common block to expose this variable to python interface |
3352 | + COMMON/ML5_0_PROCESS_NHEL/NHEL |
3353 | REAL*8 T |
3354 | REAL*8 ML5_0_MATRIX |
3355 | INTEGER IHEL,IDEN, I, J |
3356 | @@ -264,7 +266,7 @@ |
3357 | |
3358 | END |
3359 | |
3360 | - SUBROUTINE ML5_0_GET_ME(P, ALPHAS, NHEL ,ANS) |
3361 | + SUBROUTINE ML5_0_GET_VALUE(P, ALPHAS, NHEL ,ANS) |
3362 | IMPLICIT NONE |
3363 | C |
3364 | C CONSTANT |
3365 | @@ -297,10 +299,10 @@ |
3366 | RETURN |
3367 | END |
3368 | |
3369 | - SUBROUTINE ML5_0_INITIALISE(PATH) |
3370 | + SUBROUTINE ML5_0_INITIALISEMODEL(PATH) |
3371 | C ROUTINE FOR F2PY to read the benchmark point. |
3372 | IMPLICIT NONE |
3373 | - CHARACTER*180 PATH |
3374 | + CHARACTER*512 PATH |
3375 | CF2PY INTENT(IN) :: PATH |
3376 | CALL SETPARA(PATH) !first call to setup the paramaters |
3377 | RETURN |
3378 | |
3379 | === modified file 'tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/gg_wmtbx/born_matrix.f' |
3380 | --- tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/gg_wmtbx/born_matrix.f 2016-09-15 20:20:30 +0000 |
3381 | +++ tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/gg_wmtbx/born_matrix.f 2017-07-29 19:33:46 +0000 |
3382 | @@ -68,6 +68,8 @@ |
3383 | C LOCAL VARIABLES |
3384 | C |
3385 | INTEGER NHEL(NEXTERNAL,NCOMB),NTRY |
3386 | +C put in common block to expose this variable to python interface |
3387 | + COMMON/ML5_0_PROCESS_NHEL/NHEL |
3388 | REAL*8 T |
3389 | REAL*8 ML5_0_MATRIX |
3390 | INTEGER IHEL,IDEN, I, J |
3391 | @@ -300,7 +302,7 @@ |
3392 | |
3393 | END |
3394 | |
3395 | - SUBROUTINE ML5_0_GET_ME(P, ALPHAS, NHEL ,ANS) |
3396 | + SUBROUTINE ML5_0_GET_VALUE(P, ALPHAS, NHEL ,ANS) |
3397 | IMPLICIT NONE |
3398 | C |
3399 | C CONSTANT |
3400 | @@ -333,10 +335,10 @@ |
3401 | RETURN |
3402 | END |
3403 | |
3404 | - SUBROUTINE ML5_0_INITIALISE(PATH) |
3405 | + SUBROUTINE ML5_0_INITIALISEMODEL(PATH) |
3406 | C ROUTINE FOR F2PY to read the benchmark point. |
3407 | IMPLICIT NONE |
3408 | - CHARACTER*180 PATH |
3409 | + CHARACTER*512 PATH |
3410 | CF2PY INTENT(IN) :: PATH |
3411 | CALL SETPARA(PATH) !first call to setup the paramaters |
3412 | RETURN |
3413 | |
3414 | === modified file 'tests/input_files/IOTestsComparison/short_ML_SMQCD_default/ddx_ttx/born_matrix.f' |
3415 | --- tests/input_files/IOTestsComparison/short_ML_SMQCD_default/ddx_ttx/born_matrix.f 2016-09-15 20:20:30 +0000 |
3416 | +++ tests/input_files/IOTestsComparison/short_ML_SMQCD_default/ddx_ttx/born_matrix.f 2017-07-29 19:33:46 +0000 |
3417 | @@ -68,6 +68,8 @@ |
3418 | C LOCAL VARIABLES |
3419 | C |
3420 | INTEGER NHEL(NEXTERNAL,NCOMB),NTRY |
3421 | +C put in common block to expose this variable to python interface |
3422 | + COMMON/ML5_0_PROCESS_NHEL/NHEL |
3423 | REAL*8 T |
3424 | REAL*8 ML5_0_MATRIX |
3425 | INTEGER IHEL,IDEN, I, J |
3426 | @@ -247,7 +249,7 @@ |
3427 | |
3428 | END |
3429 | |
3430 | - SUBROUTINE ML5_0_GET_ME(P, ALPHAS, NHEL ,ANS) |
3431 | + SUBROUTINE ML5_0_GET_VALUE(P, ALPHAS, NHEL ,ANS) |
3432 | IMPLICIT NONE |
3433 | C |
3434 | C CONSTANT |
3435 | @@ -280,10 +282,10 @@ |
3436 | RETURN |
3437 | END |
3438 | |
3439 | - SUBROUTINE ML5_0_INITIALISE(PATH) |
3440 | + SUBROUTINE ML5_0_INITIALISEMODEL(PATH) |
3441 | C ROUTINE FOR F2PY to read the benchmark point. |
3442 | IMPLICIT NONE |
3443 | - CHARACTER*180 PATH |
3444 | + CHARACTER*512 PATH |
3445 | CF2PY INTENT(IN) :: PATH |
3446 | CALL SETPARA(PATH) !first call to setup the paramaters |
3447 | RETURN |
3448 | |
3449 | === modified file 'tests/input_files/IOTestsComparison/short_ML_SMQCD_default/gg_ttx/born_matrix.f' |
3450 | --- tests/input_files/IOTestsComparison/short_ML_SMQCD_default/gg_ttx/born_matrix.f 2016-09-15 20:20:30 +0000 |
3451 | +++ tests/input_files/IOTestsComparison/short_ML_SMQCD_default/gg_ttx/born_matrix.f 2017-07-29 19:33:46 +0000 |
3452 | @@ -68,6 +68,8 @@ |
3453 | C LOCAL VARIABLES |
3454 | C |
3455 | INTEGER NHEL(NEXTERNAL,NCOMB),NTRY |
3456 | +C put in common block to expose this variable to python interface |
3457 | + COMMON/ML5_0_PROCESS_NHEL/NHEL |
3458 | REAL*8 T |
3459 | REAL*8 ML5_0_MATRIX |
3460 | INTEGER IHEL,IDEN, I, J |
3461 | @@ -253,7 +255,7 @@ |
3462 | |
3463 | END |
3464 | |
3465 | - SUBROUTINE ML5_0_GET_ME(P, ALPHAS, NHEL ,ANS) |
3466 | + SUBROUTINE ML5_0_GET_VALUE(P, ALPHAS, NHEL ,ANS) |
3467 | IMPLICIT NONE |
3468 | C |
3469 | C CONSTANT |
3470 | @@ -286,10 +288,10 @@ |
3471 | RETURN |
3472 | END |
3473 | |
3474 | - SUBROUTINE ML5_0_INITIALISE(PATH) |
3475 | + SUBROUTINE ML5_0_INITIALISEMODEL(PATH) |
3476 | C ROUTINE FOR F2PY to read the benchmark point. |
3477 | IMPLICIT NONE |
3478 | - CHARACTER*180 PATH |
3479 | + CHARACTER*512 PATH |
3480 | CF2PY INTENT(IN) :: PATH |
3481 | CALL SETPARA(PATH) !first call to setup the paramaters |
3482 | RETURN |
3483 | |
3484 | === modified file 'tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/ddx_ttx/born_matrix.f' |
3485 | --- tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/ddx_ttx/born_matrix.f 2016-09-15 20:20:30 +0000 |
3486 | +++ tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/ddx_ttx/born_matrix.f 2017-07-29 19:33:46 +0000 |
3487 | @@ -68,6 +68,8 @@ |
3488 | C LOCAL VARIABLES |
3489 | C |
3490 | INTEGER NHEL(NEXTERNAL,NCOMB),NTRY |
3491 | +C put in common block to expose this variable to python interface |
3492 | + COMMON/ML5_0_PROCESS_NHEL/NHEL |
3493 | REAL*8 T |
3494 | REAL*8 ML5_0_MATRIX |
3495 | INTEGER IHEL,IDEN, I, J |
3496 | @@ -247,7 +249,7 @@ |
3497 | |
3498 | END |
3499 | |
3500 | - SUBROUTINE ML5_0_GET_ME(P, ALPHAS, NHEL ,ANS) |
3501 | + SUBROUTINE ML5_0_GET_VALUE(P, ALPHAS, NHEL ,ANS) |
3502 | IMPLICIT NONE |
3503 | C |
3504 | C CONSTANT |
3505 | @@ -280,10 +282,10 @@ |
3506 | RETURN |
3507 | END |
3508 | |
3509 | - SUBROUTINE ML5_0_INITIALISE(PATH) |
3510 | + SUBROUTINE ML5_0_INITIALISEMODEL(PATH) |
3511 | C ROUTINE FOR F2PY to read the benchmark point. |
3512 | IMPLICIT NONE |
3513 | - CHARACTER*180 PATH |
3514 | + CHARACTER*512 PATH |
3515 | CF2PY INTENT(IN) :: PATH |
3516 | CALL SETPARA(PATH) !first call to setup the paramaters |
3517 | RETURN |
3518 | |
3519 | === modified file 'tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/gg_ttx/born_matrix.f' |
3520 | --- tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/gg_ttx/born_matrix.f 2016-09-15 20:20:30 +0000 |
3521 | +++ tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/gg_ttx/born_matrix.f 2017-07-29 19:33:46 +0000 |
3522 | @@ -68,6 +68,8 @@ |
3523 | C LOCAL VARIABLES |
3524 | C |
3525 | INTEGER NHEL(NEXTERNAL,NCOMB),NTRY |
3526 | +C put in common block to expose this variable to python interface |
3527 | + COMMON/ML5_0_PROCESS_NHEL/NHEL |
3528 | REAL*8 T |
3529 | REAL*8 ML5_0_MATRIX |
3530 | INTEGER IHEL,IDEN, I, J |
3531 | @@ -253,7 +255,7 @@ |
3532 | |
3533 | END |
3534 | |
3535 | - SUBROUTINE ML5_0_GET_ME(P, ALPHAS, NHEL ,ANS) |
3536 | + SUBROUTINE ML5_0_GET_VALUE(P, ALPHAS, NHEL ,ANS) |
3537 | IMPLICIT NONE |
3538 | C |
3539 | C CONSTANT |
3540 | @@ -286,10 +288,10 @@ |
3541 | RETURN |
3542 | END |
3543 | |
3544 | - SUBROUTINE ML5_0_INITIALISE(PATH) |
3545 | + SUBROUTINE ML5_0_INITIALISEMODEL(PATH) |
3546 | C ROUTINE FOR F2PY to read the benchmark point. |
3547 | IMPLICIT NONE |
3548 | - CHARACTER*180 PATH |
3549 | + CHARACTER*512 PATH |
3550 | CF2PY INTENT(IN) :: PATH |
3551 | CALL SETPARA(PATH) !first call to setup the paramaters |
3552 | RETURN |
a) For:
- raise MadGraph5Error, 'user filter required to be defined in PLUGIN/ user_filter. py with the function remove_ diag(ONEDIAG) which returns True if the daigram has to be removed' PLUGIN. user_filter import remove_diag user_filter. py with the function remove_ diag(ONEDIAG) which returns True if the daigram has to be removed'
189 + try:
190 + from MG5aMC_
191 + except ImportError:
192 + raise MadGraph5Error, 'user filter required to be defined in PLUGIN/
It would be nice to wrap the look-up into both PLUGIN and MG5aMC_PLUGIN in a misc.function so that we won't have to code up this dual plugin look-up everywhere.
b) What is the difference between
elif args[0] in ['virtual_path', 'tree_path']:
and change rwgt_me_dir
c) Remove 'GFORTRAN_ UNBUFFERED_ ALL'] =
os.environ[
d) Use a similar wrapper like in handle_param for the lines (460 rwgt interface):
if self.rwgt_dir: path:
442 + path_me =self.rwgt_dir
443 + else:
444 + path_me = self.me_dir
445 +
446 + if self.second_model or self.second_process or self.dedicated_
447 + rw_dir = pjoin(path_me, 'rw_me_second')
448 + else:
449 + rw_dir = pjoin(path_me, 'rw_me')
e) Make sure to use nhel=-1 (and not 0!) for the convention 'sum over helicity' for MadLoop in the f2py splitter.
f) IMPORTANT: Make sure WIKI is updated with *ALL* the new fancy options of the reweight interface!! :)