Merge lp:~maddevelopers/mg5amcnlo/1.4.4 into lp:~madteam/mg5amcnlo/trunk
- 1.4.4
- Merge into trunk
Status: | Merged |
---|---|
Merged at revision: | 209 |
Proposed branch: | lp:~maddevelopers/mg5amcnlo/1.4.4 |
Merge into: | lp:~madteam/mg5amcnlo/trunk |
Diff against target: |
2714 lines (+786/-316) 35 files modified
Template/Cards/run_card.dat (+2/-1) Template/README (+17/-0) Template/Source/PDF/pdfwrap.f (+7/-7) Template/Source/PDF/pdfwrap_lhapdf.f (+1/-1) Template/bin/internal/addmasses.py (+16/-37) UpdateNotes.txt (+24/-0) aloha/aloha_fct.py (+38/-1) aloha/create_aloha.py (+1/-1) input/mg5_configuration.txt (+11/-8) madgraph/VERSION (+1/-1) madgraph/core/base_objects.py (+13/-0) madgraph/core/helas_objects.py (+7/-1) madgraph/interface/extended_cmd.py (+61/-19) madgraph/interface/launch_ext_program.py (+11/-12) madgraph/interface/madevent_interface.py (+103/-78) madgraph/interface/madgraph_interface.py (+162/-58) madgraph/interface/master_interface.py (+3/-3) madgraph/iolibs/export_v4.py (+17/-8) madgraph/iolibs/group_subprocs.py (+7/-1) madgraph/iolibs/template_files/madevent_combine_events.f (+1/-1) madgraph/various/cluster.py (+129/-6) madgraph/various/gen_crossxhtml.py (+5/-1) madgraph/various/misc.py (+45/-1) models/check_param_card.py (+5/-4) models/import_ufo.py (+11/-6) models/mssm/restrict_default.dat (+10/-10) models/mssm/restrict_no_b_mass.dat (+10/-11) models/mssm/restrict_no_masses.dat (+10/-11) models/mssm/restrict_no_tau_mass.dat (+10/-11) models/nmssm/parameters.py (+2/-2) models/nmssm/restrict_default.dat (+2/-2) tests/acceptance_tests/test_cmd.py (+1/-0) tests/acceptance_tests/test_cmd_madevent.py (+5/-3) tests/acceptance_tests/test_model_equivalence.py (+3/-3) tests/unit_tests/iolibs/test_export_v4.py (+35/-7) |
To merge this branch: | bzr merge lp:~maddevelopers/mg5amcnlo/1.4.4 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Johan Alwall (community) | Approve | ||
Review via email: mp+98530@code.launchpad.net |
Commit message
Description of the change
I think that we can now start an official review on this branch
Thanks in advance Johan,
Olivier
- 223. By Olivier Mattelaer
-
forbid < > ; & in the output name
- 224. By Olivier Mattelaer
-
allow correct treatment of space in auto-completion
support ~ and ~users and $ARG (inside path only) - 225. By Olivier Mattelaer
-
fix the space in the path for the call to self.history (when a crash occurs)
- 226. By Olivier Mattelaer
-
improve install MadAnalysis (three people had trouble at my tutorial)
forbids that MadAnalysis makes ME5 crashes.
check that UFO doesn't have a coupling '1' which means that a coupling is not linked to any order.
(That makes MG5 crashes) - 227. By Olivier Mattelaer
-
allowing to move the output directory after a launch was done.
- 228. By Olivier Mattelaer
-
improve log messages for incoherent incoming/outcoming particles between different interactions.
- 229. By Olivier Mattelaer
-
change default width in nmssm (for Z and W)
- 230. By Johan Alwall
-
Added discussion about cluster and multicore run modes in Template/README. Fixed problem with gen_crossxhtml.py for certain user scenarios.
Olivier Mattelaer (olivier-mattelaer) wrote : | # |
Johan Alwall (johan-alwall) wrote : | # |
Sorry for the delay. I agree, it is time. If you're fine with my last little commit, please do the merge.
Thanks a lot,
Johan
Johan Alwall (johan-alwall) wrote : | # |
Hello Olivier,
It seems that your recent modifs broke something:
=======
ERROR: test that the model name is correctly set
-------
Traceback (most recent call last):
File "/Users/
model = import_
File "/Users/
model_path = find_ufo_
File "/Users/
raise InvalidModel("Path %s is not a valid pathname" % model_name)
InvalidModel: Path sm-full is not a valid pathname
=======
ERROR: Check that we found all mass-width which are not external.
-------
Traceback (most recent call last):
File "/Users/
self.model = import_
File "/Users/
model_path = find_ufo_
File "/Users/
raise InvalidModel("Path %s is not a valid pathname" % model_name)
InvalidModel: Path sm-full is not a valid pathname
=======
ERROR: test that we can write a file
-------
Traceback (most recent call last):
File "/Users/
self.model = import_
File "/Users/
model_path = find_ufo_
File "/Users/
raise InvalidModel("Path %s is not a valid pathname" % model_name)
InvalidModel: Path sm-full is not a valid pathname
-------
Ran 505 tests in 69.934s
FAILED (errors=3)
Also several acceptance tests fail.
Cheers,
Johan
Johan Alwall (johan-alwall) wrote : | # |
(this happened in rev. 226)
- 231. By Johan Alwall
-
Fixed maxconfigs.inc in presence of competing resonances
Johan Alwall (johan-alwall) wrote : | # |
Since this branch isn't merged yet, I'll report one more thing that has been a bit disturbing for a while:
If I want to rerun Pythia with the same tag (to replace the pythia files and save some disk space), for a run done with ickkw=1, I do:
Johan-Alwalls-
...
MGME5>Will run in mode pythia
compile directory
Running Pythia
Creating Pythia LHE File
...
Create matching plots for Pythia
gzip: events.tree: No such file or directory
Command "pythia run_01 --tag=tag_1 -f" interrupted with error:
IOError : [Errno 2] No such file or directory: '/Users/
Please report this bug on https:/
More information is found in '/Users/
Please attach this file to your report.
MGME5>Storing Pythia files of Previous run
Done
Could you check what's happening?
Thanks,
Johan
- 232. By Olivier Mattelaer
-
fix auto-completion + default timeout
- 233. By Olivier Mattelaer
-
fix the import restricted file
Johan Alwall (johan-alwall) wrote : | # |
Hello Olivier,
Thanks for fixing the test suite errors. We need this bug fix (for maxconfigs.inc) out a.s.a.p, so please merge the branch. My last suggestion can wait if you don't have time to fix it right away (and it's very quick to do).
Thanks,
Johan
Preview Diff
1 | === modified file 'Template/Cards/run_card.dat' |
2 | --- Template/Cards/run_card.dat 2011-12-10 06:11:03 +0000 |
3 | +++ Template/Cards/run_card.dat 2012-03-28 09:12:20 +0000 |
4 | @@ -27,7 +27,8 @@ |
5 | .false. = gridpack !True = setting up the grid pack |
6 | #********************************************************************* |
7 | # Number of events and rnd seed * |
8 | -# Warning: Do not generate more than 100K event in a single run * |
9 | +# Warning: Do not generate more than 1M events in a single run * |
10 | +# If you want to run Pythia, avoid more than 50k events in a run. * |
11 | #********************************************************************* |
12 | 10000 = nevents ! Number of unweighted events requested |
13 | 0 = iseed ! rnd seed (0=assigned automatically=default)) |
14 | |
15 | === modified file 'Template/README' |
16 | --- Template/README 2011-07-06 23:13:41 +0000 |
17 | +++ Template/README 2012-03-28 09:12:20 +0000 |
18 | @@ -49,3 +49,20 @@ |
19 | If this is the case, Pythia and PGS will automatically be run by |
20 | generate_events, or, for an existing run, use bin/run_pythia and |
21 | bin/run_pgs. |
22 | + |
23 | + |
24 | +Running in cluster or multicore mode: |
25 | +------------------------------------- |
26 | + |
27 | +In order to automatically run in cluster or multicore mode, please set |
28 | +the flag run_mode in the Cards/me5_configuration.txt file (or in the |
29 | +input/mg5_configuration.txt file before you generate your process): |
30 | + |
31 | +# Default Running mode |
32 | +# 0: single machine/ 1: cluster / 2: multicore |
33 | +run_mode = 0 |
34 | + |
35 | +You can also specify the cluster type (for cluster mode) or your |
36 | +preferred number of CPUs (for multicore mode - note that by default, |
37 | +the maximum number of cores is used) by setting cluster_type and |
38 | +nb_core. |
39 | \ No newline at end of file |
40 | |
41 | === modified file 'Template/Source/PDF/pdfwrap.f' |
42 | --- Template/Source/PDF/pdfwrap.f 2010-10-30 03:26:37 +0000 |
43 | +++ Template/Source/PDF/pdfwrap.f 2012-03-28 09:12:20 +0000 |
44 | @@ -250,13 +250,13 @@ |
45 | .'cteq5f3,','cteq5f4,','cteq5m1,','ctq5hq1,','cteq5l1,', |
46 | .'cteq6_m,','cteq6_d,','cteq6_l,','cteq6l1,' |
47 | c |
48 | -c |
49 | - write(6,*) 'Setting it to default cteq6l1' |
50 | - pdlabel='cteq6l1' |
51 | - asmz=0.130d0 |
52 | - nloop=1 |
53 | - Call SetCtq6(4) |
54 | - |
55 | +c make madgraph to stop evaluating |
56 | + stop 1 |
57 | +c write(6,*) 'Setting it to default cteq6l1' |
58 | +c pdlabel='cteq6l1' |
59 | +c asmz=0.130d0 |
60 | +c nloop=1 |
61 | +c Call SetCtq6(4) |
62 | endif |
63 | return |
64 | end |
65 | |
66 | === modified file 'Template/Source/PDF/pdfwrap_lhapdf.f' |
67 | --- Template/Source/PDF/pdfwrap_lhapdf.f 2010-10-30 03:26:37 +0000 |
68 | +++ Template/Source/PDF/pdfwrap_lhapdf.f 2012-03-28 09:12:20 +0000 |
69 | @@ -54,7 +54,7 @@ |
70 | if(exists)return |
71 | enddo |
72 | print*,'Could not find PDFsets directory, quitting' |
73 | - stop |
74 | + stop 1 |
75 | |
76 | return |
77 | end |
78 | |
79 | === modified file 'Template/bin/internal/addmasses.py' |
80 | --- Template/bin/internal/addmasses.py 2011-07-26 16:15:01 +0000 |
81 | +++ Template/bin/internal/addmasses.py 2012-03-28 09:12:20 +0000 |
82 | @@ -174,7 +174,6 @@ |
83 | event.append(Particle(nup,t)) |
84 | counter=counter+1 |
85 | |
86 | - |
87 | #default is to skip this |
88 | if motherFlag: |
89 | |
90 | @@ -223,41 +222,20 @@ |
91 | mySub = re.compile(s1) |
92 | event_description = mySub.sub(str(nup),event_description) |
93 | |
94 | - |
95 | if nAdded>0: |
96 | - totalLength = len(event)+1 |
97 | - newPosition = [] |
98 | - iPos=0 |
99 | - while iPos<totalLength: |
100 | - for p in event: |
101 | - if p.mo1==iPos: |
102 | - newPosition.append(p.no) |
103 | - iPos=iPos+1 |
104 | - |
105 | - iUp=1 |
106 | - event0=[] |
107 | - for ip in newPosition: |
108 | - event0.append(event[ip-1]) |
109 | - |
110 | - iUp=0 |
111 | - for p in event0: |
112 | - iUp=iUp+1 |
113 | - if p.no != iUp: |
114 | - ip=iUp |
115 | - while ip<totalLength-1: |
116 | - pp=event0[ip] |
117 | - if pp.mo1==p.no and pp.mo1>pp.no: |
118 | - pp.mo1=pp.mo2=iUp |
119 | - ip=ip+1 |
120 | - p.no=iUp |
121 | - |
122 | - iUp=0 |
123 | - for p in event0: |
124 | - event[iUp]=event0[iUp] |
125 | - iUp=iUp+1 |
126 | - |
127 | - |
128 | - |
129 | + for ip in range(len(event)): |
130 | + l=event[ip] |
131 | + if l.mo1 > ip + 1: |
132 | + nmo=l.mo1 |
133 | + event.insert(ip, event.pop(l.mo1-1)) |
134 | + event[ip].no = ip + 1 |
135 | + for l2 in event[ip + 1:]: |
136 | + if l2.no > ip and l2.no < nmo + 1: |
137 | + l2.no += 1 |
138 | + if l2.mo1 == nmo: |
139 | + l2.mo1 = l2.mo2 = ip + 1 |
140 | + elif l2.mo1 > ip and l2.mo1 < nmo: |
141 | + l2.mo1 = l2.mo2 = l2.mo1 + 1 |
142 | |
143 | # identify mothers |
144 | particleDict={} |
145 | @@ -268,14 +246,15 @@ |
146 | pass |
147 | else: |
148 | if p.mo1 in particleDict: |
149 | - l=[particleDict[p.mo1]] |
150 | + l=particleDict[p.mo1] |
151 | l.append(p.no) |
152 | else: |
153 | - l=p.no |
154 | + l=[p.no] |
155 | particleDict[p.mo1]=l |
156 | |
157 | # repair kinematics |
158 | for k in particleDict: |
159 | + if len(particleDict[k]) != 2: continue |
160 | t=particleDict[k] |
161 | p1=event[t[0]-1] |
162 | p1.mom.boost(event[k-1].mom,-1) |
163 | |
164 | === modified file 'UpdateNotes.txt' |
165 | --- UpdateNotes.txt 2012-03-08 17:26:21 +0000 |
166 | +++ UpdateNotes.txt 2012-03-28 09:12:20 +0000 |
167 | @@ -1,5 +1,29 @@ |
168 | Update notes for MadGraph 5 (in reverse time order) |
169 | |
170 | +1.4.4 (XX/XX/XX) OM: Added a command: "output aloha" which allows to creates a |
171 | + subset (or all) of the aloha routines linked to the |
172 | + current model |
173 | + OM: allow to choose the duration of the timer for the questions. |
174 | + (via ./input/mg5_configuration.txt) |
175 | + OM: Allow UFO model where G is not defined. |
176 | + OM: allow to use ~,~user, ${var} in the path. Improve support |
177 | + for path containing spaces. |
178 | + JA: Fixed LHAPDF functionality which was broken in v. 1.4.0 |
179 | + JA: Allow non-equal mixing angles in mssm restrict cards |
180 | + (as needed for cards from some spectrum generators) |
181 | + JA: Fixed script addmasses.py for complicated events such as |
182 | + p p > t t~ + jets with decays of t and t~. |
183 | + JA: Added GE cluster to the list in cluster.py. |
184 | + JA: Allow up to 1M events in a single run. Note that the |
185 | + unweighting (combine events) step gets quite slow with |
186 | + so many events. Also note that if Pythia is run, still |
187 | + maximum 50k events is recommended in a single run. |
188 | + OM: Fix problem linked to filesystem which makes new files |
189 | + non executables by default. (bug #958616) |
190 | + JA: Fixed buffer overflow in gen_ximprove when number of |
191 | + configs > number of diagrams due to competing resonances |
192 | + (introduced in v. 1.4.3). |
193 | + |
194 | 1.4.3 (08/03/12) JA: Reintroduced the possibility to completely forbid |
195 | s-channel diagrams, using the $$ notation. Note that |
196 | this should be used with great care, since the result |
197 | |
198 | === modified file 'aloha/aloha_fct.py' |
199 | --- aloha/aloha_fct.py 2012-02-06 19:57:04 +0000 |
200 | +++ aloha/aloha_fct.py 2012-03-28 09:12:20 +0000 |
201 | @@ -73,4 +73,41 @@ |
202 | raise WrongFermionFlow, 'Not coherent Incoming/outcoming fermion flow' |
203 | elif pos == i+1: |
204 | break |
205 | - |
206 | + |
207 | +def guess_routine_from_name(names): |
208 | + """ return (UFO name, tag , offshell) from a given name """ |
209 | + |
210 | + output =[] |
211 | + for name in names: |
212 | + data = name.split('_') |
213 | + if len(data) == 2: |
214 | + main, offshell = data |
215 | + multiple = [] |
216 | + else: |
217 | + main, multiple, offshell = data[0], data[1:-1],data[-1] |
218 | + |
219 | + # search for tag allow tag [L, C$] |
220 | + allow_tag = ['C1','C2','C3','C4','C5','C6','C7'] |
221 | + tags = [] |
222 | + len_tag = -1 |
223 | + while len(tags) != len_tag: |
224 | + len_tag = len(tags) |
225 | + for tag in allow_tag: |
226 | + if main.endswith(tag): |
227 | + main = main[:-len(tag)] |
228 | + tags.append(int(tag[1:])) |
229 | + break |
230 | + |
231 | + # create the correct lorentz |
232 | + lorentz = [main] |
233 | + if multiple: |
234 | + base = main |
235 | + while base[-1].isdigit(): |
236 | + base = base[:-1] |
237 | + for nb in multiple: |
238 | + lorentz.append('%s%s' % (base, nb)) |
239 | + |
240 | + # add in the results |
241 | + output.append((tuple(lorentz), tuple(tags), int(offshell))) |
242 | + return output |
243 | + |
244 | |
245 | === modified file 'aloha/create_aloha.py' |
246 | --- aloha/create_aloha.py 2012-03-01 21:47:03 +0000 |
247 | +++ aloha/create_aloha.py 2012-03-28 09:12:20 +0000 |
248 | @@ -236,7 +236,7 @@ |
249 | lorentz *= SpinorPropagator(id, 'I2', outgoing) |
250 | else: |
251 | #propagator incoming |
252 | - lorentz *= SpinorPropagator('I2', id, outgoing) |
253 | + lorentz *= SpinorPropagator('I2', id, outgoing) |
254 | elif spin == 3 : |
255 | lorentz *= VectorPropagator(id, 'I2', id) |
256 | elif spin == 5 : |
257 | |
258 | === modified file 'input/mg5_configuration.txt' |
259 | --- input/mg5_configuration.txt 2012-02-03 23:38:43 +0000 |
260 | +++ input/mg5_configuration.txt 2012-03-28 09:12:20 +0000 |
261 | @@ -20,10 +20,9 @@ |
262 | # |
263 | ################################################################################ |
264 | |
265 | -# Pythia8 Path. |
266 | -# Define the path to the pythia8 directory. |
267 | -# relative path start from mg5 directory |
268 | -pythia8_path = ./pythia8 |
269 | +# Prefered Fortran Compiler |
270 | +# If None: try to find g77 or gfortran on the system |
271 | +fortran_compiler = None |
272 | |
273 | # Prefered Text Editor |
274 | # Default: use the shell default Editor |
275 | @@ -39,10 +38,14 @@ |
276 | # If None: try to find one available on the system |
277 | eps_viewer = None |
278 | |
279 | -# Prefered Fortran Compiler |
280 | -# If None: try to find g77 or gfortran on the system |
281 | -fortran_compiler = None |
282 | +# Time allowed to answer question (if no answer takes default value) |
283 | +# 0: No time limit |
284 | +timeout = 20 |
285 | |
286 | +# Pythia8 Path. |
287 | +# Define the path to the pythia8 directory. |
288 | +# relative path start from mg5 directory |
289 | +pythia8_path = ./pythia8 |
290 | |
291 | ################################################################################ |
292 | # INFO FOR MADEVENT |
293 | @@ -59,7 +62,7 @@ |
294 | # 0: single machine/ 1: cluster / 2: multicore |
295 | run_mode = 0 |
296 | |
297 | -# Cluster Type [pbs|sge|condor] Use for cluster run only |
298 | +# Cluster Type [pbs|sge|condor|lsf|ge] Use for cluster run only |
299 | # And cluster queue |
300 | cluster_type = condor |
301 | cluster_queue = madgraph |
302 | |
303 | === modified file 'madgraph/VERSION' |
304 | --- madgraph/VERSION 2012-03-08 17:26:21 +0000 |
305 | +++ madgraph/VERSION 2012-03-28 09:12:20 +0000 |
306 | @@ -1,3 +1,3 @@ |
307 | -version = 1.4.3 |
308 | +version = 1.4.4.beta |
309 | date = 2012-03-08 |
310 | |
311 | |
312 | === modified file 'madgraph/core/base_objects.py' |
313 | --- madgraph/core/base_objects.py 2012-02-24 06:55:34 +0000 |
314 | +++ madgraph/core/base_objects.py 2012-03-28 09:12:20 +0000 |
315 | @@ -1473,7 +1473,20 @@ |
316 | this diagram""" |
317 | |
318 | return [len(v.get('legs')) for v in self.get('vertices')] |
319 | + |
320 | + def get_num_configs(self, model, ninitial): |
321 | + """Return the maximum number of configs from this diagram, |
322 | + given by 2^(number of non-zero width s-channel propagators)""" |
323 | + |
324 | + s_channels = [v.get_s_channel_id(model,ninitial) for v in \ |
325 | + self.get('vertices')[:-1]] |
326 | + num_props = len([i for i in s_channels if i != 0 and \ |
327 | + model.get_particle(i).get('width').lower() != 'zero']) |
328 | |
329 | + if num_props <= 1: |
330 | + return 1 |
331 | + else: |
332 | + return 2**num_props |
333 | #=============================================================================== |
334 | # DiagramList |
335 | #=============================================================================== |
336 | |
337 | === modified file 'madgraph/core/helas_objects.py' |
338 | --- madgraph/core/helas_objects.py 2011-11-22 09:18:50 +0000 |
339 | +++ madgraph/core/helas_objects.py 2012-03-28 09:12:20 +0000 |
340 | @@ -3387,7 +3387,13 @@ |
341 | """Get number of diagrams, which is always more than number of |
342 | configs""" |
343 | |
344 | - return len(self.get('diagrams')) |
345 | + model = self.get('processes')[0].\ |
346 | + get('model') |
347 | + |
348 | + next, nini = self.get_nexternal_ninitial() |
349 | + |
350 | + return sum([d.get_num_configs(model, nini) for d in \ |
351 | + self.get('base_amplitude').get('diagrams')]) |
352 | |
353 | def get_number_of_wavefunctions(self): |
354 | """Gives the total number of wavefunctions for this ME""" |
355 | |
356 | === modified file 'madgraph/interface/extended_cmd.py' |
357 | --- madgraph/interface/extended_cmd.py 2012-03-08 20:38:22 +0000 |
358 | +++ madgraph/interface/extended_cmd.py 2012-03-28 09:12:20 +0000 |
359 | @@ -38,7 +38,8 @@ |
360 | import madgraph.various.misc as misc |
361 | from madgraph import MG5DIR |
362 | MADEVENT = False |
363 | -except: |
364 | +except Exception, error: |
365 | + print error |
366 | import internal.misc as misc |
367 | MADEVENT = True |
368 | |
369 | @@ -47,6 +48,24 @@ |
370 | class TimeOutError(Exception): |
371 | """Class for run-time error""" |
372 | |
373 | +def debug(debug_only=True): |
374 | + |
375 | + def deco_debug(f): |
376 | + |
377 | + if debug_only and not __debug__: |
378 | + return f |
379 | + |
380 | + def deco_f(*args, **opt): |
381 | + try: |
382 | + return f(*args, **opt) |
383 | + except Exception, error: |
384 | + print error |
385 | + print traceback.print_exc(file=sys.stdout) |
386 | + return |
387 | + return deco_f |
388 | + return deco_debug |
389 | + |
390 | + |
391 | #=============================================================================== |
392 | # CmdExtended |
393 | #=============================================================================== |
394 | @@ -90,7 +109,8 @@ |
395 | if valid == 1: |
396 | out = out[1:] |
397 | return out |
398 | - |
399 | + |
400 | + @debug() |
401 | def print_suggestions(self, substitution, matches, longest_match_length) : |
402 | """print auto-completions by category""" |
403 | longest_match_length += len(self.completion_prefix) |
404 | @@ -162,6 +182,7 @@ |
405 | If a command has not been entered, then complete against command list. |
406 | Otherwise try to call complete_<command> to get list of completions. |
407 | """ |
408 | + |
409 | if state == 0: |
410 | import readline |
411 | origline = readline.get_line_buffer() |
412 | @@ -188,8 +209,18 @@ |
413 | compfunc = self.completedefault |
414 | else: |
415 | compfunc = self.completenames |
416 | + |
417 | + # correct wrong splittion with '\ ' |
418 | + if line and begidx > 2 and line[begidx-2:begidx] == '\ ': |
419 | + Ntext = line.split(os.path.sep)[-1] |
420 | + self.completion_prefix = Ntext.rsplit('\ ', 1)[0] + '\ ' |
421 | + to_rm = len(self.completion_prefix) - 1 |
422 | + Nbegidx = len(line.rsplit(os.path.sep, 1)[0]) + 1 |
423 | + data = compfunc(Ntext.replace('\ ', ' '), line, Nbegidx, endidx) |
424 | + self.completion_matches = [p[to_rm:] for p in data |
425 | + if len(p)>to_rm] |
426 | # correct wrong splitting with '-' |
427 | - if line and line[begidx-1] == '-': |
428 | + elif line and line[begidx-1] == '-': |
429 | try: |
430 | Ntext = line.split()[-1] |
431 | self.completion_prefix = Ntext.rsplit('-',1)[0] +'-' |
432 | @@ -244,12 +275,12 @@ |
433 | |
434 | if len(args) > 2: |
435 | self.help_save() |
436 | - raise self.InvalidCmd, '\'%s\' is not recoginzed as first argument.' |
437 | + raise self.InvalidCmd, 'too many arguments for save command.' |
438 | |
439 | if len(args) == 2: |
440 | if args[0] != 'options': |
441 | self.help_save() |
442 | - raise self.InvalidCmd, '\'%s\' is not recoginzed as first argument.' % \ |
443 | + raise self.InvalidCmd, '\'%s\' is not recognized as first argument.' % \ |
444 | args[0] |
445 | else: |
446 | args.pop(0) |
447 | @@ -336,7 +367,6 @@ |
448 | next_possibility = {} # command : [list of suggested command] |
449 | history_header = "" |
450 | |
451 | - timeout = 1 # time authorize to answer question [0 is no time limit] |
452 | _display_opts = ['options','variable'] |
453 | |
454 | class InvalidCmd(Exception): |
455 | @@ -428,7 +458,7 @@ |
456 | if os.path.exists(self.debug_output): |
457 | os.remove(self.debug_output) |
458 | try: |
459 | - cmd.Cmd.onecmd(self, 'history %s' % self.debug_output) |
460 | + cmd.Cmd.onecmd(self, 'history %s' % self.debug_output.replace(' ', '\ ')) |
461 | except Exception, error: |
462 | print error |
463 | |
464 | @@ -587,7 +617,9 @@ |
465 | if data[-1] == '\\': |
466 | tmp += data[:-1]+' ' |
467 | elif tmp: |
468 | - out.append(tmp+data) |
469 | + tmp += data |
470 | + tmp = os.path.expanduser(os.path.expandvars(tmp)) |
471 | + out.append(tmp) |
472 | else: |
473 | out.append(data) |
474 | return out |
475 | @@ -674,7 +706,6 @@ |
476 | # remove this call from history |
477 | if self.history: |
478 | self.history.pop() |
479 | - self.timeout, old_time_out = 20, self.timeout |
480 | |
481 | # Read the lines of the file and execute them |
482 | self.inputfile = open(filepath) |
483 | @@ -691,7 +722,6 @@ |
484 | if self.child: |
485 | self.child.exec_cmd('quit') |
486 | |
487 | - self.timeout = old_time_out |
488 | return |
489 | |
490 | def get_history_header(self): |
491 | @@ -771,7 +801,7 @@ |
492 | # Ask a question with nice options handling |
493 | #=============================================================================== |
494 | def ask(self, question, default, choices=[], path_msg=None, |
495 | - timeout = None, fct_timeout=None): |
496 | + timeout = True, fct_timeout=None): |
497 | """ ask a question with some pre-define possibility |
498 | path info is |
499 | """ |
500 | @@ -780,6 +810,12 @@ |
501 | path_msg = [path_msg] |
502 | else: |
503 | path_msg = [] |
504 | + |
505 | + if timeout: |
506 | + try: |
507 | + timeout = self.options['timeout'] |
508 | + except: |
509 | + pass |
510 | |
511 | # add choice info to the question |
512 | if choices + path_msg: |
513 | @@ -796,16 +832,19 @@ |
514 | question = question[:-2]+']' |
515 | |
516 | if path_msg: |
517 | - fct = lambda q: raw_path_input(q, allow_arg=choices, default=default) |
518 | + f = lambda q: raw_path_input(q, allow_arg=choices, default=default) |
519 | else: |
520 | - fct = lambda q: smart_input(q, allow_arg=choices, default=default) |
521 | + f = lambda q: smart_input(q, allow_arg=choices, default=default) |
522 | |
523 | answer = self.check_answer_in_input_file(choices, path_msg) |
524 | if answer is not None: |
525 | return answer |
526 | |
527 | - return Cmd.timed_input(question, default, timeout=timeout, |
528 | - fct=fct, fct_timeout=fct_timeout) |
529 | + value = Cmd.timed_input(question, default, timeout=timeout, |
530 | + fct=f, fct_timeout=fct_timeout) |
531 | + |
532 | + self.preloop() |
533 | + return value |
534 | |
535 | def check_answer_in_input_file(self, options, path=False): |
536 | """Questions can have answer in output file (or not)""" |
537 | @@ -1093,10 +1132,12 @@ |
538 | def path_completion(text, base_dir = None, only_dirs = False, |
539 | relative=True): |
540 | """Propose completions of text to compose a valid path""" |
541 | - |
542 | + |
543 | if base_dir is None: |
544 | base_dir = os.getcwd() |
545 | - |
546 | + |
547 | + base_dir = os.path.expanduser(os.path.expandvars(base_dir)) |
548 | + |
549 | prefix, text = os.path.split(text) |
550 | base_dir = os.path.join(base_dir, prefix) |
551 | if prefix: |
552 | @@ -1128,7 +1169,8 @@ |
553 | if relative: |
554 | completion += [prefix + f for f in ['.'+os.path.sep, '..'+os.path.sep] if \ |
555 | f.startswith(text) and not prefix.startswith('.')] |
556 | - |
557 | + |
558 | + completion = [a.replace(' ','\ ') for a in completion] |
559 | return completion |
560 | |
561 | |
562 | @@ -1252,7 +1294,7 @@ |
563 | #=============================================================================== |
564 | class OneLinePathCompletion(SmartQuestion): |
565 | """ a class for answering a question with the path autocompletion""" |
566 | - |
567 | + |
568 | |
569 | def completenames(self, text, line, begidx, endidx): |
570 | prev_timer = signal.alarm(0) # avoid timer if any |
571 | |
572 | === modified file 'madgraph/interface/launch_ext_program.py' |
573 | --- madgraph/interface/launch_ext_program.py 2012-02-17 06:01:41 +0000 |
574 | +++ madgraph/interface/launch_ext_program.py 2012-03-28 09:12:20 +0000 |
575 | @@ -43,13 +43,12 @@ |
576 | |
577 | force = False |
578 | |
579 | - def __init__(self, cmd, running_dir, card_dir='', timeout=None, |
580 | + def __init__(self, cmd, running_dir, card_dir='', |
581 | **options): |
582 | """ initialize an object """ |
583 | |
584 | self.running_dir = running_dir |
585 | self.card_dir = os.path.join(self.running_dir, card_dir) |
586 | - self.timeout = timeout |
587 | self.cmd_int = cmd |
588 | #include/overwrite options |
589 | for key,value in options.items(): |
590 | @@ -87,15 +86,13 @@ |
591 | if timeout: |
592 | # avoid to always wait a given time for the next answer |
593 | self.force = True |
594 | - else: |
595 | - self.timeout = None # answer at least one question so wait... |
596 | |
597 | def ask(self, question, default, choices=[], path_msg=None): |
598 | """nice handling of question""" |
599 | |
600 | if not self.force: |
601 | - return self.cmd_int.ask(question, default, choices=choices, path_msg=path_msg, |
602 | - timeout=self.timeout, fct_timeout=self.timeout_fct) |
603 | + return self.cmd_int.ask(question, default, choices=choices, |
604 | + path_msg=path_msg, fct_timeout=self.timeout_fct) |
605 | else: |
606 | return str(default) |
607 | |
608 | @@ -135,10 +132,10 @@ |
609 | class SALauncher(ExtLauncher): |
610 | """ A class to launch a simple Standalone test """ |
611 | |
612 | - def __init__(self, cmd_int, running_dir, timeout, **options): |
613 | + def __init__(self, cmd_int, running_dir, **options): |
614 | """ initialize the StandAlone Version""" |
615 | |
616 | - ExtLauncher.__init__(self, cmd_int, running_dir, './Cards', timeout, **options) |
617 | + ExtLauncher.__init__(self, cmd_int, running_dir, './Cards', **options) |
618 | self.cards = ['param_card.dat'] |
619 | |
620 | |
621 | @@ -158,11 +155,13 @@ |
622 | class MELauncher(ExtLauncher): |
623 | """A class to launch MadEvent run""" |
624 | |
625 | - def __init__(self, running_dir, timeout, cmd_int , unit='pb', **option): |
626 | + def __init__(self, running_dir, cmd_int , unit='pb', **option): |
627 | """ initialize the StandAlone Version""" |
628 | |
629 | - ExtLauncher.__init__(self, cmd_int, running_dir, './Cards', timeout, **option) |
630 | + ExtLauncher.__init__(self, cmd_int, running_dir, './Cards', **option) |
631 | #self.executable = os.path.join('.', 'bin','generate_events') |
632 | + self.pythia = cmd_int.options['pythia-pgs_path'] |
633 | + self.delphes = cmd_int.options['delphes_path'], |
634 | |
635 | assert hasattr(self, 'cluster') |
636 | assert hasattr(self, 'multicore') |
637 | @@ -267,11 +266,11 @@ |
638 | class Pythia8Launcher(ExtLauncher): |
639 | """A class to launch Pythia8 run""" |
640 | |
641 | - def __init__(self, running_dir, timeout, cmd_int, **option): |
642 | + def __init__(self, running_dir, cmd_int, **option): |
643 | """ initialize launching Pythia 8""" |
644 | |
645 | running_dir = os.path.join(running_dir, 'examples') |
646 | - ExtLauncher.__init__(self, cmd_int, running_dir, '.', timeout, **option) |
647 | + ExtLauncher.__init__(self, cmd_int, running_dir, '.', **option) |
648 | self.cards = [] |
649 | |
650 | def prepare_run(self): |
651 | |
652 | === modified file 'madgraph/interface/madevent_interface.py' |
653 | --- madgraph/interface/madevent_interface.py 2012-03-05 14:54:21 +0000 |
654 | +++ madgraph/interface/madevent_interface.py 2012-03-28 09:12:20 +0000 |
655 | @@ -206,9 +206,9 @@ |
656 | arg = line.split() |
657 | if len(arg) == 0: |
658 | return stop |
659 | - if self.results.status.startswith('Error'): |
660 | + if isinstance(self.results.status, str) and self.results.status.startswith('Error'): |
661 | return stop |
662 | - if self.results.status == 'Stop by the user': |
663 | + if isinstance(self.results.status, str) and self.results.status == 'Stop by the user': |
664 | self.update_status('%s Stop by the user' % arg[0], level=None, error=True) |
665 | return stop |
666 | elif not self.results.status: |
667 | @@ -291,7 +291,9 @@ |
668 | logger.info("-- set options") |
669 | logger.info(" stdout_level DEBUG|INFO|WARNING|ERROR|CRITICAL") |
670 | logger.info(" change the default level for printed information") |
671 | - |
672 | + logger.info(" timeout VALUE") |
673 | + logger.info(" (default 20) Seconds allowed to answer questions.") |
674 | + logger.info(" Note that pressing tab always stops the timer.") |
675 | |
676 | def run_options_help(self, data): |
677 | if data: |
678 | @@ -349,9 +351,9 @@ |
679 | |
680 | def help_combine_events(self): |
681 | """ """ |
682 | - logger.info("syntax: combine_events [--run_options]") |
683 | + logger.info("syntax: combine_events [run_name] [--tag=tag_name] [--run_options]") |
684 | logger.info("-- Combine the last run in order to write the number of events") |
685 | - logger.info(" require in the run_card.") |
686 | + logger.info(" asked in the run_card.") |
687 | self.run_options_help([]) |
688 | |
689 | def help_store_events(self): |
690 | @@ -504,6 +506,11 @@ |
691 | if args[1] not in ['DEBUG','INFO','WARNING','ERROR','CRITICAL']: |
692 | raise self.InvalidCmd('output_level needs ' + \ |
693 | 'a valid level') |
694 | + |
695 | + if args[0] in ['timeout']: |
696 | + if not args[1].isdigit(): |
697 | + raise self.InvalidCmd('timeout values should be a integer') |
698 | + |
699 | def check_open(self, args): |
700 | """ check the validity of the line """ |
701 | |
702 | @@ -699,16 +706,28 @@ |
703 | def check_combine_events(self, arg): |
704 | """ Check the argument for the combine events command """ |
705 | |
706 | - if len(arg): |
707 | + tag = [a for a in arg if a.startswith('--tag=')] |
708 | + if tag: |
709 | + args.remove(tag[0]) |
710 | + tag = tag[0][6:] |
711 | + elif not self.run_tag: |
712 | + tag = 'tag_1' |
713 | + else: |
714 | + tag = self.run_tag |
715 | + self.run_tag = tag |
716 | + |
717 | + if len(arg) > 1: |
718 | self.help_combine_events() |
719 | raise self.InvalidCmd('Too many argument for combine_events command') |
720 | |
721 | + if len(arg) == 1: |
722 | + self.set_run_name(arg[0], self.run_tag, 'parton', True) |
723 | + |
724 | if not self.run_name: |
725 | if not self.results.lastrun: |
726 | raise self.InvalidCmd('No run_name currently define. Impossible to run combine') |
727 | else: |
728 | self.set_run_name(self.results.lastrun) |
729 | - self.set_run_name(arg[0]) |
730 | |
731 | return True |
732 | |
733 | @@ -732,14 +751,14 @@ |
734 | if tag: |
735 | args.remove(tag[0]) |
736 | tag = tag[0][6:] |
737 | - |
738 | + |
739 | if len(args) == 0 and not self.run_name: |
740 | if self.results.lastrun: |
741 | args.insert(0, self.results.lastrun) |
742 | else: |
743 | raise self.InvalidCmd('No run name currently define. Please add this information.') |
744 | |
745 | - if len(args) == 1: |
746 | + if len(args) >= 1: |
747 | if args[0] != self.run_name and\ |
748 | not os.path.exists(pjoin(self.me_dir,'Events',args[0], 'unweighted_events.lhe.gz')): |
749 | raise self.InvalidCmd('No events file corresponding to %s run. '% args[0]) |
750 | @@ -748,7 +767,6 @@ |
751 | if tag: |
752 | self.run_card['run_tag'] = tag |
753 | self.set_run_name(self.run_name, tag, 'pythia') |
754 | - |
755 | |
756 | if not os.path.exists(pjoin(self.me_dir,'Events',self.run_name,'unweighted_events.lhe.gz')): |
757 | raise self.InvalidCmd('No events file corresponding to %s run. '% self.run_name) |
758 | @@ -1270,7 +1288,7 @@ |
759 | _run_options = ['--cluster','--multicore','--nb_core=','--nb_core=2', '-c', '-m'] |
760 | _generate_options = ['-f', '--laststep=parton', '--laststep=pythia', '--laststep=pgs', '--laststep=delphes'] |
761 | _calculate_decay_options = ['-f', '--accuracy=0.'] |
762 | - _set_options = ['stdout_level','fortran_compiler'] |
763 | + _set_options = ['stdout_level','fortran_compiler','timeout'] |
764 | _plot_mode = ['all', 'parton','pythia','pgs','delphes','channel', 'banner'] |
765 | _clean_mode = _plot_mode |
766 | _display_opts = ['run_name', 'options', 'variable'] |
767 | @@ -1332,7 +1350,7 @@ |
768 | raise MadEventAlreadyRunning, message |
769 | else: |
770 | os.system('touch %s' % pjoin(me_dir,'RunWeb')) |
771 | - subprocess.Popen([pjoin(self.dirbin, 'gen_cardhtml-pl')], cwd=me_dir) |
772 | + misc.Popen([pjoin(self.dirbin, 'gen_cardhtml-pl')], cwd=me_dir) |
773 | |
774 | self.to_store = [] |
775 | self.run_name = None |
776 | @@ -1351,7 +1369,6 @@ |
777 | |
778 | # Load the configuration file |
779 | self.set_configuration() |
780 | - self.timeout = 20 |
781 | self.nb_refine=0 |
782 | if self.web: |
783 | os.system('touch %s' % pjoin(self.me_dir,'Online')) |
784 | @@ -1360,13 +1377,13 @@ |
785 | # load the current status of the directory |
786 | if os.path.exists(pjoin(self.me_dir,'HTML','results.pkl')): |
787 | self.results = save_load_object.load_from_file(pjoin(self.me_dir,'HTML','results.pkl')) |
788 | + self.results.path = self.me_dir # allowed to move the directory after some launch |
789 | self.results.resetall() |
790 | else: |
791 | model = self.find_model_name() |
792 | process = self.process # define in find_model_name |
793 | self.results = gen_crossxhtml.AllResults(model, process, self.me_dir) |
794 | self.results.def_web_mode(self.web) |
795 | - |
796 | |
797 | self.configured = 0 # time for reading the card |
798 | self._options = {} # for compatibility with extended_cmd |
799 | @@ -1446,7 +1463,8 @@ |
800 | 'automatic_html_opening':True, |
801 | 'run_mode':0, |
802 | 'cluster_queue':'madgraph', |
803 | - 'nb_core':None} |
804 | + 'nb_core':None, |
805 | + 'timeout':20} |
806 | |
807 | if os.environ.has_key('MADGRAPH_BASE'): |
808 | config_file = open(os.path.join(os.environ['MADGRAPH_BASE'],'mg5_configuration.txt')) |
809 | @@ -1545,8 +1563,7 @@ |
810 | |
811 | # Check if we want to modify the run |
812 | if not force: |
813 | - ans = self.ask('Do you want to modify the Cards?', 'n', ['y','n'], |
814 | - timeout=self.timeout) |
815 | + ans = self.ask('Do you want to modify the Cards?', 'n', ['y','n']) |
816 | if ans == 'n': |
817 | force = True |
818 | |
819 | @@ -1644,6 +1661,8 @@ |
820 | raise self.InvalidCmd('nb_core should be a positive number') |
821 | self.nb_core = int(args[1]) |
822 | self.options['nb_core'] = self.nb_core |
823 | + elif args[0] == 'timeout': |
824 | + self.options[args[0]] = int(args[1]) |
825 | elif args[0] in self.options: |
826 | if args[1] in ['None','True','False']: |
827 | self.options[args[0]] = eval(args[1]) |
828 | @@ -1998,7 +2017,7 @@ |
829 | raise MadEventError, 'Error make gensym not successful' |
830 | |
831 | # Launch gensym |
832 | - p = subprocess.Popen(['./gensym'], stdin=subprocess.PIPE, |
833 | + p = misc.Popen(['./gensym'], stdin=subprocess.PIPE, |
834 | stdout=subprocess.PIPE, |
835 | stderr=subprocess.STDOUT, cwd=Pdir) |
836 | sym_input = "%(points)d %(iterations)d %(accuracy)f %(gridpack)s\n" % self.opts |
837 | @@ -2061,7 +2080,7 @@ |
838 | if os.path.basename(match)[:4] in ['ajob', 'wait', 'run.', 'done']: |
839 | os.remove(pjoin(Pdir, match)) |
840 | |
841 | - proc = subprocess.Popen([pjoin(bindir, 'gen_ximprove')], |
842 | + proc = misc.Popen([pjoin(bindir, 'gen_ximprove')], |
843 | stdout=devnull, |
844 | stdin=subprocess.PIPE, |
845 | cwd=Pdir) |
846 | @@ -2087,7 +2106,7 @@ |
847 | pass |
848 | |
849 | bindir = pjoin(os.path.relpath(self.dirbin, pjoin(self.me_dir,'SubProcesses'))) |
850 | - subprocess.call([pjoin(bindir, 'combine_runs')], |
851 | + misc.call([pjoin(bindir, 'combine_runs')], |
852 | cwd=pjoin(self.me_dir,'SubProcesses'), |
853 | stdout=devnull) |
854 | |
855 | @@ -2111,7 +2130,7 @@ |
856 | cwd=pjoin(self.me_dir,'SubProcesses'), |
857 | stdout=pjoin(self.me_dir,'SubProcesses', 'combine.log')) |
858 | else: |
859 | - out = subprocess.call(['../bin/internal/run_combine'], |
860 | + out = misc.call(['../bin/internal/run_combine'], |
861 | cwd=pjoin(self.me_dir,'SubProcesses'), |
862 | stdout=open(pjoin(self.me_dir,'SubProcesses','combine.log'),'w')) |
863 | |
864 | @@ -2124,7 +2143,11 @@ |
865 | |
866 | # Define The Banner |
867 | tag = self.run_card['run_tag'] |
868 | + # Update the banner with the pythia card |
869 | + if not self.banner: |
870 | + self.banner = banner_mod.recover_banner(self.results, 'parton') |
871 | self.banner.load_basic(self.me_dir) |
872 | + if not hasattr(self, 'random'): self.random = 0 |
873 | self.banner.change_seed(self.random) |
874 | if not os.path.exists(pjoin(self.me_dir, 'Events', self.run_name)): |
875 | os.mkdir(pjoin(self.me_dir, 'Events', self.run_name)) |
876 | @@ -2134,13 +2157,13 @@ |
877 | self.banner.add(pjoin(self.me_dir, 'Cards', 'run_card.dat')) |
878 | |
879 | |
880 | - subprocess.call(['%s/put_banner' % self.dirbin, 'events.lhe'], |
881 | + misc.call(['%s/put_banner' % self.dirbin, 'events.lhe'], |
882 | cwd=pjoin(self.me_dir, 'Events')) |
883 | - subprocess.call(['%s/put_banner'% self.dirbin, 'unweighted_events.lhe'], |
884 | + misc.call(['%s/put_banner'% self.dirbin, 'unweighted_events.lhe'], |
885 | cwd=pjoin(self.me_dir, 'Events')) |
886 | |
887 | #if os.path.exists(pjoin(self.me_dir, 'Events', 'unweighted_events.lhe')): |
888 | - # subprocess.call(['%s/extract_banner-pl' % self.dirbin, |
889 | + # misc.call(['%s/extract_banner-pl' % self.dirbin, |
890 | # 'unweighted_events.lhe', 'banner.txt'], |
891 | # cwd=pjoin(self.me_dir, 'Events')) |
892 | |
893 | @@ -2197,7 +2220,7 @@ |
894 | input = pjoin(G_path, name) |
895 | output = pjoin(G_path, '%s_%s' % (run,name)) |
896 | files.mv(input, output) |
897 | - subprocess.call(['gzip', output], stdout=devnull, |
898 | + misc.call(['gzip', output], stdout=devnull, |
899 | stderr=devnull, cwd=G_path) |
900 | |
901 | # 2) restore links in local this is require due to chrome over-security |
902 | @@ -2210,7 +2233,7 @@ |
903 | open(results, 'w').write(text) |
904 | |
905 | # 3) Update the index.html |
906 | - subprocess.call(['%s/gen_cardhtml-pl' % self.dirbin], |
907 | + misc.call(['%s/gen_cardhtml-pl' % self.dirbin], |
908 | cwd=pjoin(self.me_dir)) |
909 | |
910 | # 4) Move the Files present in Events directory |
911 | @@ -2224,7 +2247,7 @@ |
912 | input = pjoin(E_path, name) |
913 | output = pjoin(O_path, name) |
914 | files.mv(input, output) |
915 | - subprocess.call(['gzip', output], stdout=devnull, stderr=devnull, |
916 | + misc.call(['gzip', output], stdout=devnull, stderr=devnull, |
917 | cwd=O_path) |
918 | |
919 | self.update_status('End Parton', level='parton', makehtml=False) |
920 | @@ -2236,14 +2259,15 @@ |
921 | self.update_status('Creating gridpack', level='parton') |
922 | args = self.split_arg(line) |
923 | self.check_combine_events(args) |
924 | + if not self.run_tag: self.run_tag = 'tag_1' |
925 | os.system("sed -i.bak \"s/ *.false.*=.*GridRun/ .true. = GridRun/g\" %s/Cards/grid_card.dat" \ |
926 | % self.me_dir) |
927 | - subprocess.call(['./bin/internal/restore_data', self.run_name], |
928 | + misc.call(['./bin/internal/restore_data', self.run_name], |
929 | cwd=self.me_dir) |
930 | - subprocess.call(['./bin/internal/store4grid', |
931 | + misc.call(['./bin/internal/store4grid', |
932 | self.run_name, self.run_tag], |
933 | cwd=self.me_dir) |
934 | - subprocess.call(['./bin/internal/clean'], cwd=self.me_dir) |
935 | + misc.call(['./bin/internal/clean'], cwd=self.me_dir) |
936 | misc.compile(['gridpack.tar.gz'], cwd=self.me_dir) |
937 | files.mv(pjoin(self.me_dir, 'gridpack.tar.gz'), |
938 | pjoin(self.me_dir, '%s_gridpack.tar.gz' % self.run_name)) |
939 | @@ -2291,7 +2315,7 @@ |
940 | # return |
941 | |
942 | #self.exec_cmd('remove %s pythia -f' % self.run_name) |
943 | - |
944 | + |
945 | pythia_src = pjoin(self.options['pythia-pgs_path'],'src') |
946 | |
947 | self.update_status('Running Pythia', 'pythia') |
948 | @@ -2311,7 +2335,7 @@ |
949 | cwd=pjoin(self.me_dir,'Events')) |
950 | else: |
951 | pythia_log = open(pjoin(self.me_dir, 'Events', self.run_name , '%s_pythia.log' % tag), 'w') |
952 | - subprocess.call(['../bin/internal/run_pythia', pythia_src], |
953 | + misc.call(['../bin/internal/run_pythia', pythia_src], |
954 | stdout=pythia_log, |
955 | stderr=subprocess.STDOUT, |
956 | cwd=pjoin(self.me_dir,'Events')) |
957 | @@ -2363,13 +2387,13 @@ |
958 | argument= [pydir], |
959 | cwd=pjoin(self.me_dir,'Events')) |
960 | else: |
961 | - subprocess.call([self.dirbin+'/run_hep2lhe', pydir], |
962 | + misc.call([self.dirbin+'/run_hep2lhe', pydir], |
963 | cwd=pjoin(self.me_dir,'Events')) |
964 | |
965 | # Creating ROOT file |
966 | if eradir and misc.is_executable(pjoin(eradir, 'ExRootLHEFConverter')): |
967 | self.update_status('Creating Pythia LHE Root File', level='pythia') |
968 | - subprocess.call([eradir+'/ExRootLHEFConverter', |
969 | + misc.call([eradir+'/ExRootLHEFConverter', |
970 | 'pythia_events.lhe', |
971 | pjoin(self.run_name, '%s_pythia_lhe_events.root' % tag)], |
972 | cwd=pjoin(self.me_dir,'Events')) |
973 | @@ -2377,15 +2401,15 @@ |
974 | |
975 | if int(self.run_card['ickkw']): |
976 | self.update_status('Create matching plots for Pythia', level='pythia') |
977 | - subprocess.call([self.dirbin+'/create_matching_plots.sh', self.run_name, tag], |
978 | + misc.call([self.dirbin+'/create_matching_plots.sh', self.run_name, tag], |
979 | stdout = os.open(os.devnull, os.O_RDWR), |
980 | cwd=pjoin(self.me_dir,'Events')) |
981 | #Clean output |
982 | - subprocess.call(['gzip','-f','events.tree'], |
983 | + misc.call(['gzip','-f','events.tree'], |
984 | cwd=pjoin(self.me_dir,'Events')) |
985 | files.mv(pjoin(self.me_dir,'Events','events.tree.gz'), |
986 | pjoin(self.me_dir,'Events',self.run_name, tag + '_pythia_events.tree.gz')) |
987 | - subprocess.call(['gzip','-f','beforeveto.tree'], |
988 | + misc.call(['gzip','-f','beforeveto.tree'], |
989 | cwd=pjoin(self.me_dir,'Events')) |
990 | files.mv(pjoin(self.me_dir,'Events','beforeveto.tree.gz'), |
991 | pjoin(self.me_dir,'Events',self.run_name, tag+'_pythia_beforeveto.tree.gz')) |
992 | @@ -2489,7 +2513,7 @@ |
993 | if '-f' not in args and len(to_suppress): |
994 | question = 'Do you want to suppress the following files?\n %s' % \ |
995 | '\n '.join(to_suppress) |
996 | - ans = self.ask(question, 'y', choices=['y','n'], timeout = self.timeout) |
997 | + ans = self.ask(question, 'y', choices=['y','n']) |
998 | else: |
999 | ans = 'y' |
1000 | |
1001 | @@ -2525,7 +2549,7 @@ |
1002 | else: |
1003 | question = 'Do you want to suppress the following files?\n %s' % \ |
1004 | '\n '.join(to_suppress) |
1005 | - ans = self.ask(question, 'y', choices=['y','n'], timeout = self.timeout) |
1006 | + ans = self.ask(question, 'y', choices=['y','n']) |
1007 | |
1008 | if ans == 'y': |
1009 | for file2rm in to_suppress: |
1010 | @@ -2743,7 +2767,7 @@ |
1011 | stdout=pgs_log, stderr=subprocess.STDOUT) |
1012 | else: |
1013 | pgs_log = open(pjoin(self.me_dir, 'Events', self.run_name,"%s_pgs.log" % tag),'w') |
1014 | - subprocess.call([self.dirbin+'/run_pgs', pgsdir], stdout= pgs_log, |
1015 | + misc.call([self.dirbin+'/run_pgs', pgsdir], stdout= pgs_log, |
1016 | stderr=subprocess.STDOUT, |
1017 | cwd=pjoin(self.me_dir, 'Events')) |
1018 | |
1019 | @@ -2754,14 +2778,14 @@ |
1020 | os.remove(pjoin(self.me_dir, 'Events', 'pgs.done')) |
1021 | |
1022 | if os.path.getsize(banner_path) == os.path.getsize(pjoin(self.me_dir, 'Events','pgs_events.lhco')): |
1023 | - subprocess.call(['cat pgs_uncleaned_events.lhco >> pgs_events.lhco'], |
1024 | + misc.call(['cat pgs_uncleaned_events.lhco >> pgs_events.lhco'], |
1025 | cwd=pjoin(self.me_dir, 'Events')) |
1026 | os.remove(pjoin(self.me_dir, 'Events', 'pgs_uncleaned_events.lhco ')) |
1027 | |
1028 | # Creating Root file |
1029 | if eradir and misc.is_executable(pjoin(eradir, 'ExRootLHCOlympicsConverter')): |
1030 | self.update_status('Creating PGS Root File', level='pgs') |
1031 | - subprocess.call([eradir+'/ExRootLHCOlympicsConverter', |
1032 | + misc.call([eradir+'/ExRootLHCOlympicsConverter', |
1033 | 'pgs_events.lhco',pjoin('%s/%s_pgs_events.root' % (self.run_name, tag))], |
1034 | cwd=pjoin(self.me_dir, 'Events')) |
1035 | |
1036 | @@ -2770,7 +2794,7 @@ |
1037 | self.create_plot('PGS') |
1038 | files.mv(pjoin(self.me_dir, 'Events', 'pgs_events.lhco'), |
1039 | pjoin(self.me_dir, 'Events', self.run_name, '%s_pgs_events.lhco' % tag)) |
1040 | - subprocess.call(['gzip','-f', pjoin(self.me_dir, 'Events', |
1041 | + misc.call(['gzip','-f', pjoin(self.me_dir, 'Events', |
1042 | self.run_name, '%s_pgs_events.lhco' % tag)]) |
1043 | |
1044 | |
1045 | @@ -2835,7 +2859,7 @@ |
1046 | cwd=pjoin(self.me_dir,'Events')) |
1047 | else: |
1048 | delphes_log = open(pjoin(self.me_dir, 'Events', self.run_name, "%s_delphes.log" % tag),'w') |
1049 | - subprocess.call(['../bin/internal/run_delphes', delphes_dir, |
1050 | + misc.call(['../bin/internal/run_delphes', delphes_dir, |
1051 | self.run_name, tag, str(cross)], |
1052 | stdout= delphes_log, stderr=subprocess.STDOUT, |
1053 | cwd=pjoin(self.me_dir,'Events')) |
1054 | @@ -2858,7 +2882,7 @@ |
1055 | self.create_plot('Delphes') |
1056 | |
1057 | if os.path.exists(pjoin(self.me_dir, 'Events', self.run_name, '%s_delphes_events.lhco' % tag)): |
1058 | - subprocess.call(['gzip','-f', pjoin(self.me_dir, 'Events', self.run_name, '%s_delphes_events.lhco' % tag)]) |
1059 | + misc.call(['gzip','-f', pjoin(self.me_dir, 'Events', self.run_name, '%s_delphes_events.lhco' % tag)]) |
1060 | |
1061 | |
1062 | |
1063 | @@ -2877,7 +2901,7 @@ |
1064 | start = time.time() |
1065 | if (cwd and os.path.exists(pjoin(cwd, exe))) or os.path.exists(exe): |
1066 | exe = './' + exe |
1067 | - subprocess.call([exe] + argument, cwd=cwd, stdout=stdout, |
1068 | + misc.call([exe] + argument, cwd=cwd, stdout=stdout, |
1069 | stderr=subprocess.STDOUT, **opt) |
1070 | #logger.info('%s run in %f s' % (exe, time.time() -start)) |
1071 | |
1072 | @@ -2899,7 +2923,7 @@ |
1073 | self.total_jobs - remaining -1, run_type), level=None, force=False) |
1074 | start = time.time() |
1075 | #os.system('cd %s; ./%s' % (cwd,exe)) |
1076 | - status = subprocess.call(['./'+exe] + argument, cwd=cwd, |
1077 | + status = misc.call(['./'+exe] + argument, cwd=cwd, |
1078 | stdout=stdout, **opt) |
1079 | logger.info('%s run in %f s' % (exe, time.time() -start)) |
1080 | if status: |
1081 | @@ -3047,13 +3071,13 @@ |
1082 | self.check_nb_events() |
1083 | |
1084 | # set environment variable for lhapdf. |
1085 | - if self.run_card['pdlabel'] == "'lhapdf'": |
1086 | + if self.run_card['pdlabel'] == "lhapdf": |
1087 | os.environ['lhapdf'] = 'True' |
1088 | elif 'lhapdf' in os.environ.keys(): |
1089 | del os.environ['lhapdf'] |
1090 | |
1091 | # Compile |
1092 | - out = subprocess.call([pjoin(self.dirbin, 'compile_Source')], |
1093 | + out = misc.call([pjoin(self.dirbin, 'compile_Source')], |
1094 | cwd = self.me_dir) |
1095 | if out: |
1096 | raise MadEventError, 'Impossible to compile' |
1097 | @@ -3228,13 +3252,13 @@ |
1098 | |
1099 | |
1100 | nb_event = int(self.run_card['nevents']) |
1101 | - if nb_event > 100000: |
1102 | - logger.warning("Attempting to generate more than 100K events") |
1103 | - logger.warning("Limiting number to 100K. Use multi_run for larger statistics.") |
1104 | + if nb_event > 1000000: |
1105 | + logger.warning("Attempting to generate more than 1M events") |
1106 | + logger.warning("Limiting number to 1M. Use multi_run for larger statistics.") |
1107 | path = pjoin(self.me_dir, 'Cards', 'run_card.dat') |
1108 | - os.system(r"""perl -p -i.bak -e "s/\d+\s*=\s*nevents/100000 = nevents/" %s""" \ |
1109 | + os.system(r"""perl -p -i.bak -e "s/\d+\s*=\s*nevents/1000000 = nevents/" %s""" \ |
1110 | % path) |
1111 | - self.run_card['nevents'] = 100000 |
1112 | + self.run_card['nevents'] = 1000000 |
1113 | |
1114 | return |
1115 | |
1116 | @@ -3270,7 +3294,7 @@ |
1117 | except Exception, error: |
1118 | pass |
1119 | try: |
1120 | - subprocess.call(['./bin/internal/gen_cardhtml-pl'], cwd=self.me_dir, |
1121 | + misc.call(['./bin/internal/gen_cardhtml-pl'], cwd=self.me_dir, |
1122 | stdout=devnull, stderr=devnull) |
1123 | except: |
1124 | pass |
1125 | @@ -3343,7 +3367,7 @@ |
1126 | self.update_status('Creating root files', level='parton') |
1127 | |
1128 | eradir = self.options['exrootanalysis_path'] |
1129 | - subprocess.call(['%s/ExRootLHEFConverter' % eradir, |
1130 | + misc.call(['%s/ExRootLHEFConverter' % eradir, |
1131 | input, output], |
1132 | cwd=pjoin(self.me_dir, 'Events')) |
1133 | |
1134 | @@ -3390,28 +3414,31 @@ |
1135 | os.makedirs(plot_dir) |
1136 | |
1137 | files.ln(pjoin(self.me_dir, 'Cards','plot_card.dat'), plot_dir, 'ma_card.dat') |
1138 | - proc = subprocess.Popen([os.path.join(madir, 'plot_events')], |
1139 | + try: |
1140 | + proc = misc.Popen([os.path.join(madir, 'plot_events')], |
1141 | stdout = open(pjoin(plot_dir, 'plot.log'),'w'), |
1142 | stderr = subprocess.STDOUT, |
1143 | stdin=subprocess.PIPE, |
1144 | cwd=plot_dir) |
1145 | - proc.communicate('%s\n' % event_path) |
1146 | - del proc |
1147 | - #proc.wait() |
1148 | - subprocess.call(['%s/plot' % self.dirbin, madir, td], |
1149 | + proc.communicate('%s\n' % event_path) |
1150 | + del proc |
1151 | + #proc.wait() |
1152 | + misc.call(['%s/plot' % self.dirbin, madir, td], |
1153 | stdout = open(pjoin(plot_dir, 'plot.log'),'a'), |
1154 | stderr = subprocess.STDOUT, |
1155 | cwd=plot_dir) |
1156 | |
1157 | - subprocess.call(['%s/plot_page-pl' % self.dirbin, |
1158 | + misc.call(['%s/plot_page-pl' % self.dirbin, |
1159 | os.path.basename(plot_dir), |
1160 | mode], |
1161 | stdout = open(pjoin(plot_dir, 'plot.log'),'a'), |
1162 | stderr = subprocess.STDOUT, |
1163 | cwd=pjoin(self.me_dir, 'HTML', self.run_name)) |
1164 | - |
1165 | - shutil.move(pjoin(self.me_dir, 'HTML',self.run_name ,'plots.html'), |
1166 | + shutil.move(pjoin(self.me_dir, 'HTML',self.run_name ,'plots.html'), |
1167 | output) |
1168 | + |
1169 | + except OSError, error: |
1170 | + logger.error('fail to create plot: %s. Please check that MadAnalysis is correctly installed.' % error) |
1171 | |
1172 | self.update_status('End Plots for %s level' % mode, level = mode.lower(), |
1173 | makehtml=False) |
1174 | @@ -3462,7 +3489,7 @@ |
1175 | |
1176 | if not force: |
1177 | if not mode: |
1178 | - mode = self.ask(question, '0', options, timeout=self.timeout) |
1179 | + mode = self.ask(question, '0', options) |
1180 | elif not mode: |
1181 | mode = 'auto' |
1182 | |
1183 | @@ -3536,7 +3563,7 @@ |
1184 | answer = 'no' |
1185 | while answer != 'done': |
1186 | question, possible_answer, card = get_question(mode) |
1187 | - answer = self.ask(question, '0', possible_answer, timeout=int(1.5*self.timeout), path_msg='enter path') |
1188 | + answer = self.ask(question, '0', possible_answer, timeout=int(1.5*self.options['timeout']), path_msg='enter path') |
1189 | if answer.isdigit(): |
1190 | answer = card[int(answer)] |
1191 | if answer == 'done': |
1192 | @@ -3546,7 +3573,6 @@ |
1193 | path = pjoin(self.me_dir,'Cards','%s_card.dat' % answer) |
1194 | else: |
1195 | path = pjoin(self.me_dir,'Cards','delphes_trigger.dat') |
1196 | - print path |
1197 | self.exec_cmd('open %s' % path) |
1198 | else: |
1199 | # detect which card is provide |
1200 | @@ -3590,7 +3616,7 @@ |
1201 | |
1202 | if not force: |
1203 | if not mode: |
1204 | - mode = self.ask(question, '0', options, timeout=self.timeout) |
1205 | + mode = self.ask(question, '0', options) |
1206 | elif not mode: |
1207 | mode = 'auto' |
1208 | |
1209 | @@ -3655,7 +3681,7 @@ |
1210 | # Loop as long as the user is not done. |
1211 | answer = 'no' |
1212 | while answer != 'done': |
1213 | - answer = self.ask(question, '0', possible_answer, timeout=int(1.5*self.timeout), path_msg='enter path') |
1214 | + answer = self.ask(question, '0', possible_answer, timeout=int(1.5*self.options['timeout']), path_msg='enter path') |
1215 | if answer.isdigit(): |
1216 | answer = card[int(answer)] |
1217 | if answer == 'done': |
1218 | @@ -3714,7 +3740,7 @@ |
1219 | # Loop as long as the user is not done. |
1220 | answer = 'no' |
1221 | while answer != 'done': |
1222 | - answer = self.ask(question, '0', possible_answer, timeout=int(1.5*self.timeout), path_msg='enter path') |
1223 | + answer = self.ask(question, '0', possible_answer, timeout=int(1.5*self.options['timeout']), path_msg='enter path') |
1224 | if answer.isdigit(): |
1225 | answer = card[int(answer)] |
1226 | if answer == 'done': |
1227 | @@ -3739,7 +3765,7 @@ |
1228 | |
1229 | |
1230 | question = """Do you want to edit the %s?""" % card |
1231 | - answer = self.ask(question, 'n', ['y','n'], timeout=self.timeout,path_msg='enter path') |
1232 | + answer = self.ask(question, 'n', ['y','n'],path_msg='enter path') |
1233 | if answer == 'y': |
1234 | path = pjoin(self.me_dir,'Cards', card) |
1235 | self.exec_cmd('open %s' % path) |
1236 | @@ -3928,13 +3954,13 @@ |
1237 | logger.info('generate %s events' % nb_event) |
1238 | self.set_run_name('GridRun_%s' % seed) |
1239 | self.update_status('restoring default data', level=None) |
1240 | - subprocess.call([pjoin(self.me_dir,'bin','internal','restore_data'), |
1241 | + misc.call([pjoin(self.me_dir,'bin','internal','restore_data'), |
1242 | 'default'], |
1243 | cwd=self.me_dir) |
1244 | |
1245 | # 2) Run the refine for the grid |
1246 | self.update_status('Generating Events', level=None) |
1247 | - #subprocess.call([pjoin(self.me_dir,'bin','refine4grid'), |
1248 | + #misc.call([pjoin(self.me_dir,'bin','refine4grid'), |
1249 | # str(nb_event), '0', 'Madevent','1','GridRun_%s' % seed], |
1250 | # cwd=self.me_dir) |
1251 | self.refine4grid(nb_event) |
1252 | @@ -3942,7 +3968,6 @@ |
1253 | # 3) Combine the events/pythia/... |
1254 | self.exec_cmd('combine_events') |
1255 | self.exec_cmd('store_events') |
1256 | - self.exec_cmd('pythia --no_default -f') |
1257 | self.print_results_in_shell(self.results.current) |
1258 | |
1259 | def refine4grid(self, nb_event): |
1260 | @@ -3974,7 +3999,7 @@ |
1261 | |
1262 | devnull = os.open(os.devnull, os.O_RDWR) |
1263 | logfile = pjoin(Pdir, 'gen_ximprove.log') |
1264 | - proc = subprocess.Popen([pjoin(bindir, 'gen_ximprove')], |
1265 | + proc = misc.Popen([pjoin(bindir, 'gen_ximprove')], |
1266 | stdin=subprocess.PIPE, |
1267 | stdout=open(logfile,'w'), |
1268 | cwd=Pdir) |
1269 | @@ -3990,7 +4015,7 @@ |
1270 | for i, job in enumerate(alljobs): |
1271 | job = os.path.basename(job) |
1272 | self.launch_job('./%s' % job, cwd=Pdir, remaining=(nb_tot-i-1), |
1273 | - run_type='Refine number %s on %s (%s/%s)' % (self.nb_refine, subdir, nb_proc+1, len(subproc))) |
1274 | + run_type='Refine number %s on %s (%s/%s)' % (self.nb_refine, subdir, nb_proc+1, len(subproc))) |
1275 | self.monitor(run_type='All job submitted for refine number %s' % self.nb_refine, |
1276 | html=True) |
1277 | |
1278 | @@ -4001,11 +4026,11 @@ |
1279 | pass |
1280 | |
1281 | bindir = pjoin(os.path.relpath(self.dirbin, pjoin(self.me_dir,'SubProcesses'))) |
1282 | - subprocess.call([pjoin(bindir, 'combine_runs')], |
1283 | + misc.call([pjoin(bindir, 'combine_runs')], |
1284 | cwd=pjoin(self.me_dir,'SubProcesses'), |
1285 | stdout=devnull) |
1286 | |
1287 | - #subprocess.call([pjoin(self.dirbin, 'sumall')], |
1288 | + #misc.call([pjoin(self.dirbin, 'sumall')], |
1289 | # cwd=pjoin(self.me_dir,'SubProcesses'), |
1290 | # stdout=devnull) |
1291 | |
1292 | |
1293 | === modified file 'madgraph/interface/madgraph_interface.py' |
1294 | --- madgraph/interface/madgraph_interface.py 2012-03-08 20:38:22 +0000 |
1295 | +++ madgraph/interface/madgraph_interface.py 2012-03-28 09:12:20 +0000 |
1296 | @@ -69,6 +69,9 @@ |
1297 | import models as ufomodels |
1298 | import models.import_ufo as import_ufo |
1299 | |
1300 | +import aloha.aloha_fct as aloha_fct |
1301 | +import aloha.create_aloha as create_aloha |
1302 | + |
1303 | # Special logger for the Cmd Interface |
1304 | logger = logging.getLogger('cmdprint') # -> stdout |
1305 | logger_stderr = logging.getLogger('fatalerror') # ->stderr |
1306 | @@ -313,6 +316,11 @@ |
1307 | logger.info(" the processes using Pythia 8. The files are written in") |
1308 | logger.info(" the Pythia 8 directory (default).") |
1309 | logger.info(" NOTE: The Pythia 8 directory is set in the ./input/mg5_configuration.txt") |
1310 | + logger.info(" - If mode is aloha: Special syntax output:") |
1311 | + logger.info(" syntax: aloha [ROUTINE] [--options]" ) |
1312 | + logger.info(" valid options for aloha output are:") |
1313 | + logger.info(" --format=Fortran|Python|Cpp : defining the output language") |
1314 | + logger.info(" --output= : defining output directory") |
1315 | logger.info(" path: The path of the process directory.") |
1316 | logger.info(" If you put '.' as path, your pwd will be used.") |
1317 | logger.info(" If you put 'auto', an automatic directory PROC_XX_n will be created.") |
1318 | @@ -403,7 +411,9 @@ |
1319 | logger.info(" fortran_compiler NAME") |
1320 | logger.info(" (default None) Force a specific fortran compiler.") |
1321 | logger.info(" If None, it tries first g77 and if not present gfortran.") |
1322 | - |
1323 | + logger.info(" timeout VALUE") |
1324 | + logger.info(" (default 20) Seconds allowed to answer questions.") |
1325 | + logger.info(" Note that pressing tab always stops the timer.") |
1326 | |
1327 | #=============================================================================== |
1328 | # CheckValidForCmd |
1329 | @@ -797,6 +807,11 @@ |
1330 | if args[1] not in ['DEBUG','INFO','WARNING','ERROR','CRITICAL']: |
1331 | raise self.InvalidCmd('output_level needs ' + \ |
1332 | 'a valid level') |
1333 | + |
1334 | + if args[0] in ['timeout']: |
1335 | + if not args[1].isdigit(): |
1336 | + raise self.InvalidCmd('timeout values should be a integer') |
1337 | + |
1338 | |
1339 | def check_open(self, args): |
1340 | """ check the validity of the line """ |
1341 | @@ -845,10 +860,6 @@ |
1342 | else: |
1343 | self._export_format = 'madevent' |
1344 | |
1345 | - if not self._curr_amps: |
1346 | - text = 'No processes generated. Please generate a process first.' |
1347 | - raise self.InvalidCmd(text) |
1348 | - |
1349 | if not self._curr_model: |
1350 | text = 'No model found. Please import a model first and then retry.' |
1351 | raise self.InvalidCmd(text) |
1352 | @@ -862,9 +873,25 @@ |
1353 | logger.warning(text) |
1354 | raise self.InvalidCmd('') |
1355 | |
1356 | + if self._export_format == 'aloha': |
1357 | + return |
1358 | + |
1359 | + |
1360 | + if not self._curr_amps: |
1361 | + text = 'No processes generated. Please generate a process first.' |
1362 | + raise self.InvalidCmd(text) |
1363 | + |
1364 | + |
1365 | + |
1366 | + |
1367 | + |
1368 | if args and args[0][0] != '-': |
1369 | # This is a path |
1370 | path = args.pop(0) |
1371 | + forbiden_chars = ['>','<',';','&'] |
1372 | + for char in forbiden_chars: |
1373 | + if char in path: |
1374 | + raise self.invalidCmd('%s is not allowed in the output path' % char) |
1375 | # Check for special directory treatment |
1376 | if path == 'auto' and self._export_format in \ |
1377 | ['madevent', 'standalone', 'standalone_cpp']: |
1378 | @@ -1126,8 +1153,7 @@ |
1379 | |
1380 | # Directory continuation |
1381 | if args[-1].endswith(os.path.sep): |
1382 | - return self.path_completion(text, |
1383 | - pjoin('.',*[a for a in args \ |
1384 | + return self.path_completion(text, pjoin(*[a for a in args \ |
1385 | if a.endswith(os.path.sep)])) |
1386 | # autocompletion for particles/couplings |
1387 | model_comp = self.model_completion(text, ' '.join(args[2:])) |
1388 | @@ -1159,7 +1185,7 @@ |
1389 | return self.list_completion(text, self._display_opts) |
1390 | |
1391 | if len(args) == 2 and args[1] == 'checks': |
1392 | - return self.list_completion(text, 'failed') |
1393 | + return self.list_completion(text, ['failed']) |
1394 | |
1395 | if len(args) == 2 and args[1] == 'particles': |
1396 | return self.model_completion(text, line[begidx:]) |
1397 | @@ -1172,7 +1198,7 @@ |
1398 | # Directory continuation |
1399 | if args[-1].endswith(os.path.sep): |
1400 | return self.path_completion(text, |
1401 | - pjoin('.',*[a for a in args if a.endswith(os.path.sep)]), |
1402 | + pjoin(*[a for a in args if a.endswith(os.path.sep)]), |
1403 | only_dirs = True) |
1404 | # Format |
1405 | if len(args) == 1: |
1406 | @@ -1192,7 +1218,7 @@ |
1407 | # Directory continuation |
1408 | if args[-1].endswith(os.path.sep): |
1409 | return self.path_completion(text, |
1410 | - pjoin('.',*[a for a in args if a.endswith(os.path.sep)]), |
1411 | + pjoin(*[a for a in args if a.endswith(os.path.sep)]), |
1412 | only_dirs = True) |
1413 | # Format |
1414 | if len(args) == 1: |
1415 | @@ -1233,7 +1259,7 @@ |
1416 | # Directory continuation |
1417 | if args[-1].endswith(os.path.sep): |
1418 | return self.path_completion(text, |
1419 | - pjoin('.',*[a for a in args if \ |
1420 | + pjoin(*[a for a in args if \ |
1421 | a.endswith(os.path.sep)])) |
1422 | |
1423 | # Filename if directory is not given |
1424 | @@ -1252,22 +1278,23 @@ |
1425 | # Directory continuation |
1426 | if args[-1].endswith(os.path.sep): |
1427 | return self.path_completion(text, |
1428 | - pjoin('.',*[a for a in args if a.endswith(os.path.sep)]), |
1429 | + pjoin(*[a for a in args if a.endswith(os.path.sep)]), |
1430 | only_dirs = True) |
1431 | |
1432 | # Filename if directory is not given |
1433 | if len(args) == 2: |
1434 | return self.path_completion(text) |
1435 | - |
1436 | + |
1437 | + @cmd.debug() |
1438 | def complete_open(self, text, line, begidx, endidx): |
1439 | """ complete the open command """ |
1440 | - |
1441 | + |
1442 | args = self.split_arg(line[0:begidx]) |
1443 | |
1444 | # Directory continuation |
1445 | if os.path.sep in args[-1] + text: |
1446 | return self.path_completion(text, |
1447 | - pjoin('.',*[a for a in args if \ |
1448 | + pjoin(*[a for a in args if \ |
1449 | a.endswith(os.path.sep)])) |
1450 | |
1451 | possibility = [] |
1452 | @@ -1290,7 +1317,8 @@ |
1453 | possibility.append('ME5_debug') |
1454 | |
1455 | return self.list_completion(text, possibility) |
1456 | - |
1457 | + |
1458 | + @cmd.debug() |
1459 | def complete_output(self, text, line, begidx, endidx, |
1460 | possible_options = ['f', 'noclean', 'nojpeg'], |
1461 | possible_options_full = ['-f', '-noclean', '-nojpeg']): |
1462 | @@ -1301,15 +1329,20 @@ |
1463 | forbidden_names = ['MadGraphII', 'Template', 'pythia-pgs', 'CVS', |
1464 | 'Calculators', 'MadAnalysis', 'SimpleAnalysis', |
1465 | 'mg5', 'DECAY', 'EventConverter', 'Models', |
1466 | - 'ExRootAnalysis', 'HELAS', 'Transfer_Fct'] |
1467 | + 'ExRootAnalysis', 'HELAS', 'Transfer_Fct', 'aloha'] |
1468 | |
1469 | #name of the run =>proposes old run name |
1470 | args = self.split_arg(line[0:begidx]) |
1471 | if len(args) >= 1: |
1472 | + if len(args) > 1 and args[1] == 'aloha': |
1473 | + try: |
1474 | + return self.aloha_complete_output(text, line, begidx, endidx) |
1475 | + except Exception, error: |
1476 | + print error |
1477 | # Directory continuation |
1478 | if args[-1].endswith(os.path.sep): |
1479 | return [name for name in self.path_completion(text, |
1480 | - pjoin('.',*[a for a in args if a.endswith(os.path.sep)]), |
1481 | + pjoin(*[a for a in args if a.endswith(os.path.sep)]), |
1482 | only_dirs = True) if name not in forbidden_names] |
1483 | # options |
1484 | if args[-1][0] == '-' or len(args) > 1 and args[-2] == '-': |
1485 | @@ -1318,11 +1351,8 @@ |
1486 | return self.list_completion(text, possible_options_full) |
1487 | # Formats |
1488 | if len(args) == 1: |
1489 | - if any([p.startswith(text) for p in possible_format]): |
1490 | - return [name for name in \ |
1491 | - self.list_completion(text, possible_format) + \ |
1492 | - ['.' + os.path.sep, '..' + os.path.sep, 'auto'] \ |
1493 | - if name.startswith(text)] |
1494 | + format = possible_format + ['.' + os.path.sep, '..' + os.path.sep, 'auto'] |
1495 | + return self.list_completion(text, format) |
1496 | |
1497 | # directory names |
1498 | content = [name for name in self.path_completion(text, '.', only_dirs = True) \ |
1499 | @@ -1330,6 +1360,46 @@ |
1500 | content += ['auto'] |
1501 | return self.list_completion(text, content) |
1502 | |
1503 | + def aloha_complete_output(self, text, line, begidx, endidx): |
1504 | + "Complete the output aloha command" |
1505 | + args = self.split_arg(line[0:begidx]) |
1506 | + completion_categories = {} |
1507 | + |
1508 | + forbidden_names = ['MadGraphII', 'Template', 'pythia-pgs', 'CVS', |
1509 | + 'Calculators', 'MadAnalysis', 'SimpleAnalysis', |
1510 | + 'mg5', 'DECAY', 'EventConverter', 'Models', |
1511 | + 'ExRootAnalysis', 'Transfer_Fct', 'aloha', |
1512 | + 'apidoc','vendor'] |
1513 | + |
1514 | + |
1515 | + # options |
1516 | + options = ['--format=Fortran', '--format=Python','--format=Cpp','--output='] |
1517 | + options = self.list_completion(text, options) |
1518 | + if options: |
1519 | + completion_categories['options'] = options |
1520 | + |
1521 | + if args[-1] == '--output=' or args[-1].endswith(os.path.sep): |
1522 | + # Directory continuation |
1523 | + completion_categories['path'] = [name for name in self.path_completion(text, |
1524 | + pjoin(*[a for a in args if a.endswith(os.path.sep)]), |
1525 | + only_dirs = True) if name not in forbidden_names] |
1526 | + |
1527 | + else: |
1528 | + ufomodel = ufomodels.load_model(self._curr_model.get('name')) |
1529 | + wf_opt = [] |
1530 | + amp_opt = [] |
1531 | + opt_conjg = [] |
1532 | + for lor in ufomodel.all_lorentz: |
1533 | + amp_opt.append('%s_0' % lor.name) |
1534 | + for i in range(len(lor.spins)): |
1535 | + wf_opt.append('%s_%i' % (lor.name,i+1)) |
1536 | + if i % 2 == 0 and lor.spins[i] == 2: |
1537 | + opt_conjg.append('%sC%i_%i' % (lor.name,i //2 +1,i+1)) |
1538 | + completion_categories['amplitude routines'] = self.list_completion(text, amp_opt) |
1539 | + completion_categories['Wavefunctions routines'] = self.list_completion(text, wf_opt) |
1540 | + completion_categories['conjugate_routines'] = self.list_completion(text, opt_conjg) |
1541 | + |
1542 | + return self.deal_multiple_categories(completion_categories) |
1543 | |
1544 | def complete_set(self, text, line, begidx, endidx): |
1545 | "Complete the set command" |
1546 | @@ -1368,7 +1438,7 @@ |
1547 | return self.list_completion(text, first_set + second_set) |
1548 | elif len(args) >2 and args[-1].endswith(os.path.sep): |
1549 | return self.path_completion(text, |
1550 | - pjoin('.',*[a for a in args if a.endswith(os.path.sep)]), |
1551 | + pjoin(*[a for a in args if a.endswith(os.path.sep)]), |
1552 | only_dirs = True) |
1553 | |
1554 | def complete_import(self, text, line, begidx, endidx): |
1555 | @@ -1460,7 +1530,7 @@ |
1556 | or os.path.exists(pjoin(MG5DIR,'models',p,'particles.dat')) \ |
1557 | or os.path.exists(pjoin(self._mgme_dir,'Models',p,'particles.dat')) |
1558 | else: |
1559 | - cur_path = pjoin('.',*[a for a in args \ |
1560 | + cur_path = pjoin(*[a for a in args \ |
1561 | if a.endswith(os.path.sep)]) |
1562 | all_path = self.path_completion(text, cur_path) |
1563 | completion_categories['model name'] = all_path |
1564 | @@ -1482,7 +1552,7 @@ |
1565 | all_name += self.find_restrict_card(model_name, |
1566 | base_dir=pjoin(MG5DIR,'models')) |
1567 | if mode == 'all': |
1568 | - cur_path = pjoin('.',*[a for a in args \ |
1569 | + cur_path = pjoin(*[a for a in args \ |
1570 | if a.endswith(os.path.sep)]) |
1571 | all_path = self.path_completion(text, cur_path) |
1572 | completion_categories['model name'] = all_path + all_name |
1573 | @@ -1553,7 +1623,6 @@ |
1574 | """The command line processor of MadGraph""" |
1575 | |
1576 | writing_dir = '.' |
1577 | - timeout = 0 # time authorize to answer question [0 is no time limit] |
1578 | |
1579 | # Options and formats available |
1580 | _display_opts = ['particles', 'interactions', 'processes', 'diagrams', |
1581 | @@ -1566,7 +1635,7 @@ |
1582 | _import_formats = ['model_v4', 'model', 'proc_v4', 'command', 'banner'] |
1583 | _install_opts = ['pythia-pgs', 'Delphes', 'MadAnalysis', 'ExRootAnalysis'] |
1584 | _v4_export_formats = ['madevent', 'standalone', 'matrix'] |
1585 | - _export_formats = _v4_export_formats + ['standalone_cpp', 'pythia8'] |
1586 | + _export_formats = _v4_export_formats + ['standalone_cpp', 'pythia8', 'aloha'] |
1587 | _set_options = ['group_subprocesses', |
1588 | 'ignore_six_quark_processes', |
1589 | 'stdout_level', |
1590 | @@ -2709,11 +2778,11 @@ |
1591 | # Load that path |
1592 | logger.info('Downloading %s' % path[args[0]]) |
1593 | if sys.platform == "darwin": |
1594 | - subprocess.call(['curl', path[args[0]], '-o%s.tgz' % name], cwd=MG5DIR) |
1595 | + misc.call(['curl', path[args[0]], '-o%s.tgz' % name], cwd=MG5DIR) |
1596 | else: |
1597 | - subprocess.call(['wget', path[args[0]], '--output-document=%s.tgz'% name], cwd=MG5DIR) |
1598 | + misc.call(['wget', path[args[0]], '--output-document=%s.tgz'% name], cwd=MG5DIR) |
1599 | # Untar the file |
1600 | - returncode = subprocess.call(['tar', '-xzpvf', '%s.tgz' % name], cwd=MG5DIR, |
1601 | + returncode = misc.call(['tar', '-xzpvf', '%s.tgz' % name], cwd=MG5DIR, |
1602 | stdout=open(os.devnull, 'w')) |
1603 | if returncode: |
1604 | raise MadGraph5Error, 'Fail to download correctly the File. Stop' |
1605 | @@ -2739,7 +2808,9 @@ |
1606 | # Compile the file |
1607 | # Check for F77 compiler |
1608 | if 'FC' not in os.environ or not os.environ['FC']: |
1609 | - if misc.which('gfortran'): |
1610 | + if self.options['fortran_compiler']: |
1611 | + compiler = self.options['fortran_compiler'] |
1612 | + elif misc.which('gfortran'): |
1613 | compiler = 'gfortran' |
1614 | elif misc.which('g77'): |
1615 | compiler = 'g77' |
1616 | @@ -2750,15 +2821,21 @@ |
1617 | text = open(path).read() |
1618 | text = text.replace('FC=g77','FC=gfortran') |
1619 | open(path, 'w').writelines(text) |
1620 | - |
1621 | + elif compiler == 'gfortran' and args[0] == 'MadAnalysis': |
1622 | + path = os.path.join(MG5DIR, 'MadAnalysis', 'makefile') |
1623 | + text = open(path).read() |
1624 | + text = text.replace('F77 = g77','F77 = gfortran') |
1625 | + open(path, 'w').writelines(text) |
1626 | if logger.level <= logging.INFO: |
1627 | - subprocess.call(['make', 'clean'], ) |
1628 | - status = subprocess.call(['make'], cwd = os.path.join(MG5DIR, name)) |
1629 | + misc.call(['make', 'clean'], ) |
1630 | + status = misc.call(['make'], cwd = os.path.join(MG5DIR, name)) |
1631 | else: |
1632 | misc.compile(['clean'], mode='', cwd = os.path.join(MG5DIR, name)) |
1633 | status = misc.compile(mode='', cwd = os.path.join(MG5DIR, name)) |
1634 | if not status: |
1635 | logger.info('compilation succeeded') |
1636 | + else: |
1637 | + logger.warning('Error detected during the compilation. Please check the compilation error and run make manually.') |
1638 | |
1639 | |
1640 | # Special treatment for TD program (require by MadAnalysis) |
1641 | @@ -2773,15 +2850,15 @@ |
1642 | if sys.platform == "darwin": |
1643 | logger.info('Downloading TD for Mac') |
1644 | target = 'http://theory.fnal.gov/people/parke/TD/td_mac_intel.tar.gz' |
1645 | - subprocess.call(['curl', target, '-otd.tgz'], |
1646 | + misc.call(['curl', target, '-otd.tgz'], |
1647 | cwd=pjoin(MG5DIR,'td')) |
1648 | - subprocess.call(['tar', '-xzpvf', 'td.tgz'], |
1649 | + misc.call(['tar', '-xzpvf', 'td.tgz'], |
1650 | cwd=pjoin(MG5DIR,'td')) |
1651 | files.mv(MG5DIR + '/td/td_mac_intel',MG5DIR+'/td/td') |
1652 | else: |
1653 | logger.info('Downloading TD for Linux 32 bit') |
1654 | target = 'http://madgraph.phys.ucl.ac.be/Downloads/td' |
1655 | - subprocess.call(['wget', target], cwd=pjoin(MG5DIR,'td')) |
1656 | + misc.call(['wget', target], cwd=pjoin(MG5DIR,'td')) |
1657 | os.chmod(pjoin(MG5DIR,'td','td'), 0775) |
1658 | if sys.maxsize > 2**32: |
1659 | logger.warning('''td program (needed by MadAnalysis) is not compile for 64 bit computer |
1660 | @@ -2794,6 +2871,7 @@ |
1661 | ./input/mg5_configuration.txt. assign to default if not define """ |
1662 | |
1663 | self.options = {'pythia8_path': './pythia8', |
1664 | + 'timeout': 20, |
1665 | 'web_browser':None, |
1666 | 'eps_viewer':None, |
1667 | 'text_editor':None, |
1668 | @@ -2895,8 +2973,7 @@ |
1669 | # args is now MODE PATH |
1670 | |
1671 | if args[0].startswith('standalone'): |
1672 | - ext_program = launch_ext.SALauncher(self, args[1], self.timeout, |
1673 | - **options) |
1674 | + ext_program = launch_ext.SALauncher(self, args[1], **options) |
1675 | elif args[0] == 'madevent': |
1676 | if options['interactive']: |
1677 | if hasattr(self, 'do_shell'): |
1678 | @@ -2921,23 +2998,17 @@ |
1679 | generate_info = self._generate_info |
1680 | |
1681 | if len(generate_info.split('>')[0].strip().split())>1: |
1682 | - ext_program = launch_ext.MELauncher(args[1], self.timeout, self, |
1683 | - pythia=self.options['pythia-pgs_path'], |
1684 | - delphes=self.options['delphes_path'], |
1685 | + ext_program = launch_ext.MELauncher(args[1], self, |
1686 | shell = hasattr(self, 'do_shell'), |
1687 | **options) |
1688 | else: |
1689 | # This is a width computation |
1690 | - ext_program = launch_ext.MELauncher(args[1], self.timeout, self, |
1691 | - unit='GeV', |
1692 | - pythia=self.options['pythia-pgs_path'], |
1693 | - delphes=self.options['delphes_path'], |
1694 | + ext_program = launch_ext.MELauncher(args[1], self, unit='GeV', |
1695 | shell = hasattr(self, 'do_shell'), |
1696 | **options) |
1697 | |
1698 | elif args[0] == 'pythia8': |
1699 | - ext_program = launch_ext.Pythia8Launcher( args[1], self.timeout, self, |
1700 | - **options) |
1701 | + ext_program = launch_ext.Pythia8Launcher( args[1], self, **options) |
1702 | else: |
1703 | os.chdir(start_cwd) #ensure to go to the initial path |
1704 | raise self.InvalidCmd , '%s cannot be run from MG5 interface' % args[0] |
1705 | @@ -3092,11 +3163,8 @@ |
1706 | self.options['fortran_compiler'] = args[1] |
1707 | else: |
1708 | self.options['fortran_compiler'] = None |
1709 | - elif args[0] in self.options: |
1710 | - if args[1] in ['None','True', 'False']: |
1711 | - self.options[args[0]] = eval(args[1]) |
1712 | - else: |
1713 | - self.options[args[0]] = args[1] |
1714 | + elif args[0] == 'timeout': |
1715 | + self.options[args[0]] = int(args[1]) |
1716 | elif args[0] in self.options: |
1717 | if args[1] in ['None','True','False']: |
1718 | self.options[args[0]] = eval(args[1]) |
1719 | @@ -3134,14 +3202,50 @@ |
1720 | main_file_name = args[args.index('-name') + 1] |
1721 | except: |
1722 | pass |
1723 | - |
1724 | + |
1725 | + ################ |
1726 | + # ALOHA OUTPUT # |
1727 | + ################ |
1728 | + if self._export_format == 'aloha': |
1729 | + # catch format |
1730 | + format = [d[11:] for d in args if d.startswith('--language=')] |
1731 | + if not format: |
1732 | + format = 'Fortran' |
1733 | + else: |
1734 | + format = format[-1] |
1735 | + # catch output dir |
1736 | + output = [d for d in args if d.startswith('--output=')] |
1737 | + if not output: |
1738 | + output = import_ufo.find_ufo_path(self._curr_model['name']) |
1739 | + output = pjoin(output, format) |
1740 | + if not os.path.isdir(output): |
1741 | + os.mkdir(output) |
1742 | + else: |
1743 | + output = output[-1] |
1744 | + if not os.path.isdir(output): |
1745 | + raise self.InvalidCmd('%s is not a valid directory' % output) |
1746 | + logger.info('creating routines in directory %s ' % output) |
1747 | + # build the calling list for aloha |
1748 | + names = [d for d in args if not d.startswith('-')] |
1749 | + wanted_lorentz = aloha_fct.guess_routine_from_name(names) |
1750 | + # Create and write ALOHA Routine |
1751 | + aloha_model = create_aloha.AbstractALOHAModel(self._curr_model.get('name')) |
1752 | + if wanted_lorentz: |
1753 | + aloha_model.compute_subset(wanted_lorentz) |
1754 | + else: |
1755 | + aloha_model.compute_all(save=False) |
1756 | + aloha_model.write(output, format) |
1757 | + return |
1758 | + |
1759 | + ################# |
1760 | + ## Other Output # |
1761 | + ################# |
1762 | if not force and not noclean and os.path.isdir(self._export_dir)\ |
1763 | and self._export_format in ['madevent', 'standalone']: |
1764 | # Don't ask if user already specified force or noclean |
1765 | logger.info('INFO: directory %s already exists.' % self._export_dir) |
1766 | logger.info('If you continue this directory will be cleaned') |
1767 | - answer = self.ask('Do you want to continue?', 'y', ['y','n'], |
1768 | - timeout=self.timeout) |
1769 | + answer = self.ask('Do you want to continue?', 'y', ['y','n']) |
1770 | if answer != 'y': |
1771 | raise self.InvalidCmd('Stopped by user request') |
1772 | |
1773 | @@ -3434,7 +3538,7 @@ |
1774 | elif self._export_format == 'madevent': |
1775 | # Create configuration file [path to executable] for madevent |
1776 | filename = os.path.join(self._export_dir, 'Cards', 'me5_configuration.txt') |
1777 | - self.do_save('options %s' % filename, check=False) |
1778 | + self.do_save('options %s' % filename.replace(' ', '\ '), check=False) |
1779 | |
1780 | if self._export_format in ['madevent', 'standalone']: |
1781 | |
1782 | |
1783 | === modified file 'madgraph/interface/master_interface.py' |
1784 | --- madgraph/interface/master_interface.py 2012-03-09 22:38:09 +0000 |
1785 | +++ madgraph/interface/master_interface.py 2012-03-28 09:12:20 +0000 |
1786 | @@ -376,9 +376,7 @@ |
1787 | self.debug_link_to_command() |
1788 | |
1789 | class MasterCmdWeb(Switcher, MGcmd.MadGraphCmdWeb): |
1790 | - |
1791 | - timeout = 1 # time authorize to answer question [0 is no time limit] |
1792 | - |
1793 | + |
1794 | def __init__(self, *arg, **opt): |
1795 | |
1796 | if os.environ.has_key('_CONDOR_SCRATCH_DIR'): |
1797 | @@ -392,6 +390,8 @@ |
1798 | #standard initialization |
1799 | Switcher.__init__(self, mgme_dir = '', *arg, **opt) |
1800 | |
1801 | + self.options['timeout'] = 1 # time authorize to answer question [0 is no time limit] |
1802 | + |
1803 | def change_principal_cmd(self, name): |
1804 | if name == 'MadGraph': |
1805 | self.cmd = MGcmd.MadGraphCmdWeb |
1806 | |
1807 | === modified file 'madgraph/iolibs/export_v4.py' |
1808 | --- madgraph/iolibs/export_v4.py 2012-03-06 03:20:37 +0000 |
1809 | +++ madgraph/iolibs/export_v4.py 2012-03-28 09:12:20 +0000 |
1810 | @@ -1380,7 +1380,12 @@ |
1811 | logger.info("Generate jpeg diagrams") |
1812 | for Pdir in P_dir_list: |
1813 | os.chdir(Pdir) |
1814 | - subprocess.call([os.path.join(old_pos, self.dir_path, 'bin', 'internal', 'gen_jpeg-pl')], |
1815 | + try: |
1816 | + subprocess.call([os.path.join(old_pos, self.dir_path, 'bin', 'internal', 'gen_jpeg-pl')], |
1817 | + stdout = devnull) |
1818 | + except: |
1819 | + os.system('chmod +x %s ' % os.path.join(old_pos, self.dir_path, 'bin', 'internal', '*')) |
1820 | + subprocess.call([os.path.join(old_pos, self.dir_path, 'bin', 'internal', 'gen_jpeg-pl')], |
1821 | stdout = devnull) |
1822 | os.chdir(os.path.pardir) |
1823 | |
1824 | @@ -2843,11 +2848,14 @@ |
1825 | |
1826 | # MG4 use G and not aS as it basic object for alphas related computation |
1827 | #Pass G in the independant list |
1828 | - index = self.params_dep.index('G') |
1829 | - self.params_indep.insert(0, self.params_dep.pop(index)) |
1830 | - index = self.params_dep.index('sqrt__aS') |
1831 | - self.params_indep.insert(0, self.params_dep.pop(index)) |
1832 | - |
1833 | + if 'G' in self.params_dep: |
1834 | + index = self.params_dep.index('G') |
1835 | + G = self.params_dep.pop(index) |
1836 | + # G.expr = '2*cmath.sqrt(as*pi)' |
1837 | + # self.params_indep.insert(0, self.params_dep.pop(index)) |
1838 | + # No need to add it if not defined |
1839 | + |
1840 | + |
1841 | def build(self, wanted_couplings = [], full=True): |
1842 | """modify the couplings to fit with MG4 convention and creates all the |
1843 | different files""" |
1844 | @@ -2987,7 +2995,7 @@ |
1845 | already_def.add(particle.get('mass').lower()) |
1846 | already_def.add(particle.get('width').lower()) |
1847 | |
1848 | - is_valid = lambda name: name!='G' and name.lower() not in already_def |
1849 | + is_valid = lambda name: name !='G' and name.lower() not in already_def |
1850 | |
1851 | real_parameters = [param.name for param in self.params_dep + |
1852 | self.params_indep if param.type == 'real' |
1853 | @@ -3017,7 +3025,7 @@ |
1854 | fsock.write_comments(\ |
1855 | "Parameters that should not be recomputed event by event.\n") |
1856 | fsock.writelines("if(readlha) then\n") |
1857 | - |
1858 | + fsock.writelines("G = 2 * DSQRT(AS*PI) ! for the first init\n") |
1859 | for param in self.params_indep: |
1860 | if param.name == 'ZERO': |
1861 | continue |
1862 | @@ -3027,6 +3035,7 @@ |
1863 | fsock.writelines('endif') |
1864 | |
1865 | fsock.write_comments('\nParameters that should be recomputed at an event by even basis.\n') |
1866 | + fsock.writelines("aS = G**2/4/pi\n") |
1867 | for param in self.params_dep: |
1868 | fsock.writelines("%s = %s\n" % (param.name, |
1869 | self.p_to_f.parse(param.expr))) |
1870 | |
1871 | === modified file 'madgraph/iolibs/group_subprocs.py' |
1872 | --- madgraph/iolibs/group_subprocs.py 2012-02-17 06:01:41 +0000 |
1873 | +++ madgraph/iolibs/group_subprocs.py 2012-03-28 09:12:20 +0000 |
1874 | @@ -258,7 +258,13 @@ |
1875 | def get_num_configs(self): |
1876 | """Get number of configs for this group""" |
1877 | |
1878 | - return len(self.get('mapping_diagrams')) |
1879 | + model = self.get('matrix_elements')[0].get('processes')[0].\ |
1880 | + get('model') |
1881 | + |
1882 | + next, nini = self.get_nexternal_ninitial() |
1883 | + |
1884 | + return sum([md.get_num_configs(model, nini) for md in |
1885 | + self.get('mapping_diagrams')]) |
1886 | |
1887 | def find_mapping_diagrams(self): |
1888 | """Find all unique diagrams for all processes in this |
1889 | |
1890 | === modified file 'madgraph/iolibs/template_files/madevent_combine_events.f' |
1891 | --- madgraph/iolibs/template_files/madevent_combine_events.f 2012-03-06 03:20:37 +0000 |
1892 | +++ madgraph/iolibs/template_files/madevent_combine_events.f 2012-03-28 09:12:20 +0000 |
1893 | @@ -10,7 +10,7 @@ |
1894 | integer maxsubprocesses |
1895 | parameter (maxsubprocesses=9999) |
1896 | integer cmax_events |
1897 | - parameter (cmax_events=500000) |
1898 | + parameter (cmax_events=5000000) |
1899 | integer sfnum |
1900 | parameter (sfnum=17) !Unit number for scratch file |
1901 | include 'maxparticles.inc' |
1902 | |
1903 | === modified file 'madgraph/various/cluster.py' |
1904 | --- madgraph/various/cluster.py 2012-03-06 20:10:09 +0000 |
1905 | +++ madgraph/various/cluster.py 2012-03-28 09:12:20 +0000 |
1906 | @@ -28,6 +28,8 @@ |
1907 | class ClusterManagmentError(MadGraph5Error): |
1908 | pass |
1909 | |
1910 | +class NotImplemented(MadGraph5Error): |
1911 | + pass |
1912 | |
1913 | def multiple_try(nb_try=5, sleep=1): |
1914 | |
1915 | @@ -56,7 +58,6 @@ |
1916 | return deco_f_interupt |
1917 | return deco_interupt |
1918 | |
1919 | - |
1920 | class Cluster(object): |
1921 | """Basic Class for all cluster type submission""" |
1922 | name = 'mother class' |
1923 | @@ -105,6 +106,7 @@ |
1924 | if fail: |
1925 | raise ClusterManagmentError('Some Jobs are in a Hold/... state. Please try to investigate or contact the IT team') |
1926 | if idle + run == 0: |
1927 | + time.sleep(20) #security to ensure that the file are really written on the disk |
1928 | logger.info('All jobs finished') |
1929 | break |
1930 | fct(idle, run, finish) |
1931 | @@ -120,6 +122,7 @@ |
1932 | while 1: |
1933 | status = self.control_one_job(id) |
1934 | if not status in ['R','I']: |
1935 | + time.sleep(20) #security to ensure that the file are really written on the disk |
1936 | break |
1937 | time.sleep(30) |
1938 | |
1939 | @@ -322,7 +325,6 @@ |
1940 | elif status in self.running_tag: |
1941 | run += 1 |
1942 | else: |
1943 | - print line |
1944 | fail += 1 |
1945 | |
1946 | return idle, run, self.submitted - (idle+run+fail), fail |
1947 | @@ -465,6 +467,7 @@ |
1948 | fail += 1 |
1949 | |
1950 | return idle, run, self.submitted - (idle+run+fail), fail |
1951 | + |
1952 | |
1953 | |
1954 | @multiple_try() |
1955 | @@ -476,6 +479,7 @@ |
1956 | cmd = "qdel %s" % ' '.join(self.submitted_ids) |
1957 | status = subprocess.Popen([cmd], shell=True, stdout=open(os.devnull,'w')) |
1958 | |
1959 | + |
1960 | class LSFCluster(Cluster): |
1961 | """Basic class for dealing with cluster submission""" |
1962 | |
1963 | @@ -595,8 +599,127 @@ |
1964 | cmd = "bdel %s" % ' '.join(self.submitted_ids) |
1965 | status = subprocess.Popen([cmd], shell=True, stdout=open(os.devnull,'w')) |
1966 | |
1967 | +class GECluster(Cluster): |
1968 | + """Class for dealing with cluster submission on a GE cluster""" |
1969 | + |
1970 | + name = 'ge' |
1971 | + idle_tag = ['qw'] |
1972 | + running_tag = ['r'] |
1973 | + |
1974 | + @multiple_try() |
1975 | + def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None): |
1976 | + """Submit the prog to the cluser""" |
1977 | + |
1978 | + text = "" |
1979 | + if cwd is None: |
1980 | + cwd = os.getcwd() |
1981 | + else: |
1982 | + text = " cd %s; bash " % cwd |
1983 | + if stdout is None: |
1984 | + stdout = os.path.join(cwd, "log.%s" % prog.split('/')[-1]) |
1985 | + if stderr is None: |
1986 | + stderr = os.path.join(cwd, "err.%s" % prog.split('/')[-1]) |
1987 | + elif stderr == -2: # -2 is subprocess.STDOUT |
1988 | + stderr = stdout |
1989 | + if log is None: |
1990 | + log = '/dev/null' |
1991 | + |
1992 | + text += prog |
1993 | + if argument: |
1994 | + text += ' ' + ' '.join(argument) |
1995 | + text += '\n' |
1996 | + tmp_submit = os.path.join(cwd, 'tmp_submit') |
1997 | + open(tmp_submit,'w').write(text) |
1998 | + |
1999 | + a = subprocess.Popen(['qsub','-o', stdout, |
2000 | + '-e', stderr, |
2001 | + tmp_submit], |
2002 | + stdout=subprocess.PIPE, |
2003 | + stderr=subprocess.STDOUT, |
2004 | + stdin=subprocess.PIPE, cwd=cwd) |
2005 | + |
2006 | + output = a.communicate()[0] |
2007 | + #Your job 874511 ("test.sh") has been submitted |
2008 | + pat = re.compile("Your job (\d*) \(",re.MULTILINE) |
2009 | + try: |
2010 | + id = pat.search(output).groups()[0] |
2011 | + except: |
2012 | + raise ClusterManagmentError, 'fail to submit to the cluster: \n%s' \ |
2013 | + % output |
2014 | + self.submitted += 1 |
2015 | + self.submitted_ids.append(id) |
2016 | + return id |
2017 | + |
2018 | + @multiple_try() |
2019 | + def control_one_job(self, id): |
2020 | + """ control the status of a single job with it's cluster id """ |
2021 | + cmd = 'qstat | grep '+str(id) |
2022 | + status = subprocess.Popen([cmd], shell=True, stdout=subprocess.PIPE) |
2023 | + if not status: |
2024 | + return 'F' |
2025 | + #874516 0.00000 test.sh alwall qw 03/04/2012 22:30:35 1 |
2026 | + pat = re.compile("^(\d+)\s+[\d\.]+\s+[\w\d\.]+\s+[\w\d\.]+\s+(\w+)\s") |
2027 | + stat = '' |
2028 | + for line in status.stdout.read().split('\n'): |
2029 | + if not line: |
2030 | + continue |
2031 | + line = line.strip() |
2032 | + try: |
2033 | + groups = pat.search(line).groups() |
2034 | + except: |
2035 | + raise ClusterManagmentError, 'bad syntax for stat: \n\"%s\"' % line |
2036 | + if groups[0] != id: continue |
2037 | + stat = groups[1] |
2038 | + if not stat: |
2039 | + return 'F' |
2040 | + if stat in self.idle_tag: |
2041 | + return 'I' |
2042 | + if stat in self.running_tag: |
2043 | + return 'R' |
2044 | + |
2045 | + @multiple_try() |
2046 | + def control(self, me_dir=None): |
2047 | + """Check the status of job associated to directory me_dir. return (idle, run, finish, fail)""" |
2048 | + if not self.submitted_ids: |
2049 | + return 0, 0, 0, 0 |
2050 | + idle, run, fail = 0, 0, 0 |
2051 | + ongoing = [] |
2052 | + for statusflag in ['p', 'r', 'sh']: |
2053 | + cmd = 'qstat -s %s' % statusflag |
2054 | + status = subprocess.Popen([cmd], shell=True, stdout=subprocess.PIPE) |
2055 | + #874516 0.00000 test.sh alwall qw 03/04/2012 22:30:35 1 |
2056 | + pat = re.compile("^(\d+)") |
2057 | + for line in status.stdout.read().split('\n'): |
2058 | + line = line.strip() |
2059 | + try: |
2060 | + id = pat.search(line).groups()[0] |
2061 | + except: |
2062 | + pass |
2063 | + else: |
2064 | + if id not in self.submitted_ids: |
2065 | + continue |
2066 | + ongoing.append(id) |
2067 | + if statusflag == 'p': |
2068 | + idle += 1 |
2069 | + if statusflag == 'r': |
2070 | + run += 1 |
2071 | + if statusflag == 'sh': |
2072 | + fail += 1 |
2073 | + |
2074 | + self.submitted_ids = ongoing |
2075 | + |
2076 | + return idle, run, self.submitted - idle - run - fail, fail |
2077 | + |
2078 | + @multiple_try() |
2079 | + def remove(self, *args): |
2080 | + """Clean the jobs on the cluster""" |
2081 | + |
2082 | + if not self.submitted_ids: |
2083 | + return |
2084 | + cmd = "qdel %s" % ' '.join(self.submitted_ids) |
2085 | + status = subprocess.Popen([cmd], shell=True, stdout=open(os.devnull,'w')) |
2086 | + |
2087 | from_name = {'condor':CondorCluster, 'pbs': PBSCluster, 'sge': SGECluster, |
2088 | - 'lsf': LSFCluster} |
2089 | - |
2090 | - |
2091 | - |
2092 | + 'lsf': LSFCluster, 'ge':GECluster} |
2093 | + |
2094 | + |
2095 | |
2096 | === modified file 'madgraph/various/gen_crossxhtml.py' |
2097 | --- madgraph/various/gen_crossxhtml.py 2012-03-06 03:20:37 +0000 |
2098 | +++ madgraph/various/gen_crossxhtml.py 2012-03-28 09:12:20 +0000 |
2099 | @@ -279,6 +279,10 @@ |
2100 | def add_detail(self, name, value, run=None, tag=None): |
2101 | """ add information to current run (cross/error/event)""" |
2102 | assert name in ['cross', 'error', 'nb_event', 'cross_pythia'] |
2103 | + |
2104 | + if not run and not self.current: |
2105 | + return |
2106 | + |
2107 | if not run: |
2108 | run = self.current |
2109 | else: |
2110 | @@ -770,7 +774,7 @@ |
2111 | pass |
2112 | |
2113 | elif (self.pgs or self.delphes) and not self['nb_event']: |
2114 | - if runresults[-2]['cross_pythia']: |
2115 | + if runresults[-2]['cross_pythia'] and runresults[-2]['cross']: |
2116 | self['cross'] = runresults[-2]['cross_pythia'] |
2117 | self['nb_event'] = int(0.5+(runresults[-2]['nb_event'] * self['cross'] /runresults[-2]['cross'])) |
2118 | self['error'] = self.get_pythia_error(runresults[-2]['cross'], |
2119 | |
2120 | === modified file 'madgraph/various/misc.py' |
2121 | --- madgraph/various/misc.py 2012-03-02 17:16:45 +0000 |
2122 | +++ madgraph/various/misc.py 2012-03-28 09:12:20 +0000 |
2123 | @@ -37,7 +37,7 @@ |
2124 | import internal.files as files |
2125 | |
2126 | logger = logging.getLogger('cmdprint.ext_program') |
2127 | - |
2128 | +pjoin = os.path.join |
2129 | |
2130 | #=============================================================================== |
2131 | # parse_info_str |
2132 | @@ -194,6 +194,50 @@ |
2133 | raise MadGraph5Error, error_text |
2134 | return p.returncode |
2135 | |
2136 | +# Control |
2137 | +def check_system_error(value=1): |
2138 | + def deco_check(f): |
2139 | + def deco_f(arg, *args, **opt): |
2140 | + try: |
2141 | + return f(arg, *args, **opt) |
2142 | + except OSError, error: |
2143 | + if isinstance(arg, list): |
2144 | + prog = arg[0] |
2145 | + else: |
2146 | + prog = arg[0] |
2147 | + |
2148 | + # Permission denied |
2149 | + if error.errno == 13: |
2150 | + if os.path.exists(prog): |
2151 | + os.system('chmod +x %s' % prog) |
2152 | + elif 'cwd' in opt and opt['cwd'] and \ |
2153 | + os.path.isfile(pjoin(opt['cwd'],arg[0])): |
2154 | + os.system('chmod +x %s' % pjoin(opt['cwd'],arg[0])) |
2155 | + return f(arg, *args, **opt) |
2156 | + # NO such file or directory |
2157 | + elif error.errno == 2: |
2158 | + # raise a more meaningfull error message |
2159 | + raise Exception, '%s fails with no such file or directory' \ |
2160 | + % arg |
2161 | + else: |
2162 | + raise |
2163 | + return deco_f |
2164 | + return deco_check |
2165 | + |
2166 | + |
2167 | +@check_system_error() |
2168 | +def call(arg, *args, **opt): |
2169 | + """nice way to call an external program with nice error treatment""" |
2170 | + return subprocess.call(arg, *args, **opt) |
2171 | + |
2172 | +@check_system_error() |
2173 | +def Popen(arg, *args, **opt): |
2174 | + """nice way to call an external program with nice error treatment""" |
2175 | + return subprocess.Popen(arg, *args, **opt) |
2176 | + |
2177 | + |
2178 | + |
2179 | + |
2180 | |
2181 | ################################################################################ |
2182 | # TAIL FUNCTION |
2183 | |
2184 | === modified file 'models/check_param_card.py' |
2185 | --- models/check_param_card.py 2012-02-23 00:20:17 +0000 |
2186 | +++ models/check_param_card.py 2012-03-28 09:12:20 +0000 |
2187 | @@ -312,9 +312,10 @@ |
2188 | |
2189 | def remove_param(self, block, lhacode): |
2190 | """ remove a parameter """ |
2191 | - self[block].remove(lhacode) |
2192 | - if len(self[block]) == 0: |
2193 | - self.remove_block(block) |
2194 | + if self.has_param(block, lhacode): |
2195 | + self[block].remove(lhacode) |
2196 | + if len(self[block]) == 0: |
2197 | + self.remove_block(block) |
2198 | |
2199 | def has_param(self, block, lhacode): |
2200 | """check if param exists""" |
2201 | @@ -875,7 +876,7 @@ |
2202 | # Decay: Nothing to do. |
2203 | |
2204 | # MODSEL |
2205 | - card.check_and_remove('modsel',[1], value=1) |
2206 | + card.remove_param('modsel',[1]) |
2207 | |
2208 | |
2209 | # USQMIX |
2210 | |
2211 | === modified file 'models/import_ufo.py' |
2212 | --- models/import_ufo.py 2012-03-08 00:24:17 +0000 |
2213 | +++ models/import_ufo.py 2012-03-28 09:12:20 +0000 |
2214 | @@ -36,7 +36,7 @@ |
2215 | |
2216 | import models as ufomodels |
2217 | import models.model_reader as model_reader |
2218 | -logger = logging.getLogger('models.import_ufo') |
2219 | +logger = logging.getLogger('madgraph.model') |
2220 | logger_mod = logging.getLogger('madgraph.model') |
2221 | |
2222 | root_path = os.path.dirname(os.path.realpath( __file__ )) |
2223 | @@ -206,7 +206,7 @@ |
2224 | for param in self.ufomodel.all_parameters: |
2225 | if param.nature == "external": |
2226 | if len(param.lhablock.split())>1: |
2227 | - raise UFOImportError, '''LHABlock should be single word which is not the case for |
2228 | + raise InvalidModel, '''LHABlock should be single word which is not the case for |
2229 | \'%s\' parameter with lhablock \'%s\'''' % (param.name, param.lhablock) |
2230 | |
2231 | |
2232 | @@ -385,11 +385,13 @@ |
2233 | # check if the interaction meet requirements: |
2234 | pdg = [p.pdg_code for p in interaction_info.particles if p.spin in [2,4]] |
2235 | if len(pdg) % 2: |
2236 | - raise UFOImportError, 'Odd number of fermion in vertex: %s' % [p.pdg_code for p in interaction_info.particles] |
2237 | + raise InvalidModel, 'Odd number of fermion in vertex: %s' % [p.pdg_code for p in interaction_info.particles] |
2238 | for i in range(0, len(pdg),2): |
2239 | if pdg[i] == - pdg[i+1]: |
2240 | if pdg[i] in self.outcoming: |
2241 | - raise UFOImportError, 'Input output not coherent' |
2242 | + raise InvalidModel, '%s has not coherent incoming/outcoming status between interactions' %\ |
2243 | + [p for p in interaction_info.particles if p.spin in [2,4]][i].name |
2244 | + |
2245 | elif not pdg[i] in self.incoming: |
2246 | self.incoming.append(pdg[i]) |
2247 | self.outcoming.append(pdg[i+1]) |
2248 | @@ -437,6 +439,10 @@ |
2249 | couplings = [couplings] |
2250 | for coupling in couplings: |
2251 | order = tuple(coupling.order.items()) |
2252 | + if '1' in order: |
2253 | + raise InvalidModel, '''Some couplings have \'1\' order. |
2254 | + This is not allowed in MG. |
2255 | + Please defines an additional coupling to your model''' |
2256 | if order in order_to_int: |
2257 | order_to_int[order].get('couplings')[key] = coupling.name |
2258 | else: |
2259 | @@ -624,13 +630,12 @@ |
2260 | |
2261 | if coupling.name in self.all_expr.keys(): |
2262 | return |
2263 | - |
2264 | self.all_expr[coupling.value] = coupling |
2265 | try: |
2266 | self.coupling[coupling.depend].append(coupling) |
2267 | except: |
2268 | self.coupling[coupling.depend] = [coupling] |
2269 | - |
2270 | + |
2271 | |
2272 | |
2273 | def analyze_couplings(self): |
2274 | |
2275 | === modified file 'models/mssm/restrict_default.dat' |
2276 | --- models/mssm/restrict_default.dat 2011-12-14 00:04:26 +0000 |
2277 | +++ models/mssm/restrict_default.dat 2012-03-28 09:12:20 +0000 |
2278 | @@ -8,8 +8,8 @@ |
2279 | Block USQMIX |
2280 | 1 1 1.000000e+00 # RRu11 |
2281 | 2 2 1.000000e+00 # RRu22 |
2282 | - 3 3 5.536450e-01 # RRu33 |
2283 | - 3 6 8.327528e-01 # RRu36 |
2284 | + 3 3 5.5364501e-01 # RRu33 |
2285 | + 3 6 8.3275281e-01 # RRu36 |
2286 | 4 4 1.000000e+00 # RRu44 |
2287 | 5 5 1.000000e+00 # RRu55 |
2288 | 6 3 8.327528e-01 # RRu63 |
2289 | @@ -89,8 +89,8 @@ |
2290 | Block DSQMIX |
2291 | 1 1 1.000000e+00 # RRd11 |
2292 | 2 2 1.000000e+00 # RRd22 |
2293 | - 3 3 9.387379e-01 # RRd33 |
2294 | - 3 6 3.446319e-01 # RRd36 |
2295 | + 3 3 9.3873791e-01 # RRd33 |
2296 | + 3 6 3.4463191e-01 # RRd36 |
2297 | 4 4 1.000000e+00 # RRd44 |
2298 | 5 5 1.000000e+00 # RRd55 |
2299 | 6 3 -3.446319e-01 # RRd63 |
2300 | @@ -165,8 +165,8 @@ |
2301 | Block SELMIX |
2302 | 1 1 1.000000e+00 # RRl11 |
2303 | 2 2 1.000000e+00 # RRl22 |
2304 | - 3 3 2.824872e-01 # RRl33 |
2305 | - 3 6 9.592711e-01 # RRl36 |
2306 | + 3 3 2.8248721e-01 # RRl33 |
2307 | + 3 6 9.5927111e-01 # RRl36 |
2308 | 4 4 1.000000e+00 # RRl44 |
2309 | 5 5 1.000000e+00 # RRl55 |
2310 | 6 3 9.592711e-01 # RRl63 |
2311 | @@ -255,8 +255,8 @@ |
2312 | ## INFORMATION FOR UMIX |
2313 | ################################### |
2314 | Block UMIX |
2315 | - 1 1 9.168349e-01 # RUU11 |
2316 | - 1 2 -3.992666e-01 # RUU12 |
2317 | + 1 1 9.1683491e-01 # RUU11 |
2318 | + 1 2 -3.9926661e-01 # RUU12 |
2319 | 2 1 3.992666e-01 # RUU21 |
2320 | 2 2 9.168349e-01 # RUU22 |
2321 | |
2322 | @@ -295,8 +295,8 @@ |
2323 | ## INFORMATION FOR VMIX |
2324 | ################################### |
2325 | Block VMIX |
2326 | - 1 1 9.725578e-01 # RVV11 |
2327 | - 1 2 -2.326612e-01 # RVV12 |
2328 | + 1 1 9.7255781e-01 # RVV11 |
2329 | + 1 2 -2.3266121e-01 # RVV12 |
2330 | 2 1 2.326612e-01 # RVV21 |
2331 | 2 2 9.725578e-01 # RVV22 |
2332 | |
2333 | |
2334 | === modified file 'models/mssm/restrict_no_b_mass.dat' |
2335 | --- models/mssm/restrict_no_b_mass.dat 2011-04-19 18:31:12 +0000 |
2336 | +++ models/mssm/restrict_no_b_mass.dat 2012-03-28 09:12:20 +0000 |
2337 | @@ -8,8 +8,8 @@ |
2338 | Block USQMIX |
2339 | 1 1 1.000000e+00 # RRu11 |
2340 | 2 2 1.000000e+00 # RRu22 |
2341 | - 3 3 5.536450e-01 # RRu33 |
2342 | - 3 6 8.327528e-01 # RRu36 |
2343 | + 3 3 5.5364501e-01 # RRu33 |
2344 | + 3 6 8.3275281e-01 # RRu36 |
2345 | 4 4 1.000000e+00 # RRu44 |
2346 | 5 5 1.000000e+00 # RRu55 |
2347 | 6 3 8.327528e-01 # RRu63 |
2348 | @@ -89,8 +89,8 @@ |
2349 | Block DSQMIX |
2350 | 1 1 1.000000e+00 # RRd11 |
2351 | 2 2 1.000000e+00 # RRd22 |
2352 | - 3 3 9.387379e-01 # RRd33 |
2353 | - 3 6 3.446319e-01 # RRd36 |
2354 | + 3 3 9.3873791e-01 # RRd33 |
2355 | + 3 6 3.4463191e-01 # RRd36 |
2356 | 4 4 1.000000e+00 # RRd44 |
2357 | 5 5 1.000000e+00 # RRd55 |
2358 | 6 3 -3.446319e-01 # RRd63 |
2359 | @@ -165,8 +165,8 @@ |
2360 | Block SELMIX |
2361 | 1 1 1.000000e+00 # RRl11 |
2362 | 2 2 1.000000e+00 # RRl22 |
2363 | - 3 3 2.824872e-01 # RRl33 |
2364 | - 3 6 9.592711e-01 # RRl36 |
2365 | + 3 3 2.8248721e-01 # RRl33 |
2366 | + 3 6 9.5927111e-01 # RRl36 |
2367 | 4 4 1.000000e+00 # RRl44 |
2368 | 5 5 1.000000e+00 # RRl55 |
2369 | 6 3 9.592711e-01 # RRl63 |
2370 | @@ -255,8 +255,8 @@ |
2371 | ## INFORMATION FOR UMIX |
2372 | ################################### |
2373 | Block UMIX |
2374 | - 1 1 9.168349e-01 # RUU11 |
2375 | - 1 2 -3.992666e-01 # RUU12 |
2376 | + 1 1 9.1683491e-01 # RUU11 |
2377 | + 1 2 -3.9926661e-01 # RUU12 |
2378 | 2 1 3.992666e-01 # RUU21 |
2379 | 2 2 9.168349e-01 # RUU22 |
2380 | |
2381 | @@ -295,8 +295,8 @@ |
2382 | ## INFORMATION FOR VMIX |
2383 | ################################### |
2384 | Block VMIX |
2385 | - 1 1 9.725578e-01 # RVV11 |
2386 | - 1 2 -2.326612e-01 # RVV12 |
2387 | + 1 1 9.7255781e-01 # RVV11 |
2388 | + 1 2 -2.3266121e-01 # RVV12 |
2389 | 2 1 2.326612e-01 # RVV21 |
2390 | 2 2 9.725578e-01 # RVV22 |
2391 | |
2392 | @@ -313,7 +313,6 @@ |
2393 | ################################### |
2394 | Block FRALPHA |
2395 | 1 -1.138252e-01 # alp |
2396 | - |
2397 | ################################### |
2398 | ## INFORMATION FOR UPMNS |
2399 | ################################### |
2400 | |
2401 | === modified file 'models/mssm/restrict_no_masses.dat' |
2402 | --- models/mssm/restrict_no_masses.dat 2011-04-19 18:31:12 +0000 |
2403 | +++ models/mssm/restrict_no_masses.dat 2012-03-28 09:12:20 +0000 |
2404 | @@ -8,8 +8,8 @@ |
2405 | Block USQMIX |
2406 | 1 1 1.000000e+00 # RRu11 |
2407 | 2 2 1.000000e+00 # RRu22 |
2408 | - 3 3 5.536450e-01 # RRu33 |
2409 | - 3 6 8.327528e-01 # RRu36 |
2410 | + 3 3 5.5364501e-01 # RRu33 |
2411 | + 3 6 8.3275281e-01 # RRu36 |
2412 | 4 4 1.000000e+00 # RRu44 |
2413 | 5 5 1.000000e+00 # RRu55 |
2414 | 6 3 8.327528e-01 # RRu63 |
2415 | @@ -89,8 +89,8 @@ |
2416 | Block DSQMIX |
2417 | 1 1 1.000000e+00 # RRd11 |
2418 | 2 2 1.000000e+00 # RRd22 |
2419 | - 3 3 9.387379e-01 # RRd33 |
2420 | - 3 6 3.446319e-01 # RRd36 |
2421 | + 3 3 9.3873791e-01 # RRd33 |
2422 | + 3 6 3.4463191e-01 # RRd36 |
2423 | 4 4 1.000000e+00 # RRd44 |
2424 | 5 5 1.000000e+00 # RRd55 |
2425 | 6 3 -3.446319e-01 # RRd63 |
2426 | @@ -165,8 +165,8 @@ |
2427 | Block SELMIX |
2428 | 1 1 1.000000e+00 # RRl11 |
2429 | 2 2 1.000000e+00 # RRl22 |
2430 | - 3 3 2.824872e-01 # RRl33 |
2431 | - 3 6 9.592711e-01 # RRl36 |
2432 | + 3 3 2.8248721e-01 # RRl33 |
2433 | + 3 6 9.5927111e-01 # RRl36 |
2434 | 4 4 1.000000e+00 # RRl44 |
2435 | 5 5 1.000000e+00 # RRl55 |
2436 | 6 3 9.592711e-01 # RRl63 |
2437 | @@ -255,8 +255,8 @@ |
2438 | ## INFORMATION FOR UMIX |
2439 | ################################### |
2440 | Block UMIX |
2441 | - 1 1 9.168349e-01 # RUU11 |
2442 | - 1 2 -3.992666e-01 # RUU12 |
2443 | + 1 1 9.1683491e-01 # RUU11 |
2444 | + 1 2 -3.9926661e-01 # RUU12 |
2445 | 2 1 3.992666e-01 # RUU21 |
2446 | 2 2 9.168349e-01 # RUU22 |
2447 | |
2448 | @@ -295,8 +295,8 @@ |
2449 | ## INFORMATION FOR VMIX |
2450 | ################################### |
2451 | Block VMIX |
2452 | - 1 1 9.725578e-01 # RVV11 |
2453 | - 1 2 -2.326612e-01 # RVV12 |
2454 | + 1 1 9.7255781e-01 # RVV11 |
2455 | + 1 2 -2.3266121e-01 # RVV12 |
2456 | 2 1 2.326612e-01 # RVV21 |
2457 | 2 2 9.725578e-01 # RVV22 |
2458 | |
2459 | @@ -313,7 +313,6 @@ |
2460 | ################################### |
2461 | Block FRALPHA |
2462 | 1 -1.138252e-01 # alp |
2463 | - |
2464 | ################################### |
2465 | ## INFORMATION FOR UPMNS |
2466 | ################################### |
2467 | |
2468 | === modified file 'models/mssm/restrict_no_tau_mass.dat' |
2469 | --- models/mssm/restrict_no_tau_mass.dat 2011-04-19 18:31:12 +0000 |
2470 | +++ models/mssm/restrict_no_tau_mass.dat 2012-03-28 09:12:20 +0000 |
2471 | @@ -8,8 +8,8 @@ |
2472 | Block USQMIX |
2473 | 1 1 1.000000e+00 # RRu11 |
2474 | 2 2 1.000000e+00 # RRu22 |
2475 | - 3 3 5.536450e-01 # RRu33 |
2476 | - 3 6 8.327528e-01 # RRu36 |
2477 | + 3 3 5.5364501e-01 # RRu33 |
2478 | + 3 6 8.3275281e-01 # RRu36 |
2479 | 4 4 1.000000e+00 # RRu44 |
2480 | 5 5 1.000000e+00 # RRu55 |
2481 | 6 3 8.327528e-01 # RRu63 |
2482 | @@ -89,8 +89,8 @@ |
2483 | Block DSQMIX |
2484 | 1 1 1.000000e+00 # RRd11 |
2485 | 2 2 1.000000e+00 # RRd22 |
2486 | - 3 3 9.387379e-01 # RRd33 |
2487 | - 3 6 3.446319e-01 # RRd36 |
2488 | + 3 3 9.3873791e-01 # RRd33 |
2489 | + 3 6 3.4463191e-01 # RRd36 |
2490 | 4 4 1.000000e+00 # RRd44 |
2491 | 5 5 1.000000e+00 # RRd55 |
2492 | 6 3 -3.446319e-01 # RRd63 |
2493 | @@ -165,8 +165,8 @@ |
2494 | Block SELMIX |
2495 | 1 1 1.000000e+00 # RRl11 |
2496 | 2 2 1.000000e+00 # RRl22 |
2497 | - 3 3 2.824872e-01 # RRl33 |
2498 | - 3 6 9.592711e-01 # RRl36 |
2499 | + 3 3 2.8248721e-01 # RRl33 |
2500 | + 3 6 9.5927111e-01 # RRl36 |
2501 | 4 4 1.000000e+00 # RRl44 |
2502 | 5 5 1.000000e+00 # RRl55 |
2503 | 6 3 9.592711e-01 # RRl63 |
2504 | @@ -255,8 +255,8 @@ |
2505 | ## INFORMATION FOR UMIX |
2506 | ################################### |
2507 | Block UMIX |
2508 | - 1 1 9.168349e-01 # RUU11 |
2509 | - 1 2 -3.992666e-01 # RUU12 |
2510 | + 1 1 9.1683491e-01 # RUU11 |
2511 | + 1 2 -3.9926661e-01 # RUU12 |
2512 | 2 1 3.992666e-01 # RUU21 |
2513 | 2 2 9.168349e-01 # RUU22 |
2514 | |
2515 | @@ -295,8 +295,8 @@ |
2516 | ## INFORMATION FOR VMIX |
2517 | ################################### |
2518 | Block VMIX |
2519 | - 1 1 9.725578e-01 # RVV11 |
2520 | - 1 2 -2.326612e-01 # RVV12 |
2521 | + 1 1 9.7255781e-01 # RVV11 |
2522 | + 1 2 -2.3266121e-01 # RVV12 |
2523 | 2 1 2.326612e-01 # RVV21 |
2524 | 2 2 9.725578e-01 # RVV22 |
2525 | |
2526 | @@ -313,7 +313,6 @@ |
2527 | ################################### |
2528 | Block FRALPHA |
2529 | 1 -1.138252e-01 # alp |
2530 | - |
2531 | ################################### |
2532 | ## INFORMATION FOR UPMNS |
2533 | ################################### |
2534 | |
2535 | === modified file 'models/nmssm/parameters.py' |
2536 | --- models/nmssm/parameters.py 2011-04-12 16:11:45 +0000 |
2537 | +++ models/nmssm/parameters.py 2012-03-28 09:12:20 +0000 |
2538 | @@ -1348,7 +1348,7 @@ |
2539 | WZ = Parameter(name = 'WZ', |
2540 | nature = 'external', |
2541 | type = 'real', |
2542 | - value = 0., |
2543 | + value = 2.41143316e+00, |
2544 | texname = '\\text{WZ}', |
2545 | lhablock = 'DECAY', |
2546 | lhacode = [ 23 ]) |
2547 | @@ -1356,7 +1356,7 @@ |
2548 | WW = Parameter(name = 'WW', |
2549 | nature = 'external', |
2550 | type = 'real', |
2551 | - value = 0., |
2552 | + value = 2.00282196e+00 , |
2553 | texname = '\\text{WW}', |
2554 | lhablock = 'DECAY', |
2555 | lhacode = [ 24 ]) |
2556 | |
2557 | === modified file 'models/nmssm/restrict_default.dat' |
2558 | --- models/nmssm/restrict_default.dat 2011-04-12 16:11:45 +0000 |
2559 | +++ models/nmssm/restrict_default.dat 2012-03-28 09:12:20 +0000 |
2560 | @@ -75,8 +75,8 @@ |
2561 | ## INFORMATION FOR DECAY |
2562 | ################################### |
2563 | DECAY 6 1.334825e+00 |
2564 | -DECAY 23 0.000000e+00 |
2565 | -DECAY 24 0.000000e+00 |
2566 | +DECAY 23 2.41143316e+00 # WZ |
2567 | +DECAY 24 2.00282196e+00 # WW |
2568 | DECAY 25 3.037863e-02 |
2569 | DECAY 35 4.956578e+00 |
2570 | DECAY 36 2.495587e-04 |
2571 | |
2572 | === modified file 'tests/acceptance_tests/test_cmd.py' |
2573 | --- tests/acceptance_tests/test_cmd.py 2012-03-06 03:20:37 +0000 |
2574 | +++ tests/acceptance_tests/test_cmd.py 2012-03-28 09:12:20 +0000 |
2575 | @@ -125,6 +125,7 @@ |
2576 | 'automatic_html_opening': 'True', |
2577 | 'pythia8_path': './pythia8', |
2578 | 'group_subprocesses': 'Auto', |
2579 | + 'timeout': '20', |
2580 | 'ignore_six_quark_processes': False |
2581 | } |
2582 | |
2583 | |
2584 | === modified file 'tests/acceptance_tests/test_cmd_madevent.py' |
2585 | --- tests/acceptance_tests/test_cmd_madevent.py 2012-02-29 23:15:40 +0000 |
2586 | +++ tests/acceptance_tests/test_cmd_madevent.py 2012-03-28 09:12:20 +0000 |
2587 | @@ -293,10 +293,12 @@ |
2588 | ff.write('set automatic_html_opening False\n') |
2589 | ff.write('generate_events -f \n') |
2590 | ff.close() |
2591 | - devnull =open(os.devnull,'w') |
2592 | - id = subprocess.call(['./bin/madevent','cmd.cmd'],stdout=devnull,stderr=devnull) |
2593 | + if logger.getEffectiveLevel() > 20: |
2594 | + output = open(os.devnull,'w') |
2595 | + else: |
2596 | + output = None |
2597 | + id = subprocess.call(['./bin/madevent','cmd.cmd'], stdout=output, stderr=output) |
2598 | self.assertEqual(id, 0) |
2599 | - |
2600 | self.check_parton_output(cross=944.4, error=1e-2) |
2601 | os.chdir(cmd) |
2602 | |
2603 | |
2604 | === modified file 'tests/acceptance_tests/test_model_equivalence.py' |
2605 | --- tests/acceptance_tests/test_model_equivalence.py 2011-07-22 13:21:35 +0000 |
2606 | +++ tests/acceptance_tests/test_model_equivalence.py 2012-03-28 09:12:20 +0000 |
2607 | @@ -326,7 +326,7 @@ |
2608 | # else: |
2609 | # solutions[variable].append(singlevalue) |
2610 | |
2611 | - self.assertEqual(nb_value, 72) |
2612 | + self.assertEqual(nb_value, 71) |
2613 | |
2614 | |
2615 | |
2616 | @@ -337,7 +337,7 @@ |
2617 | alreadydefine = [] |
2618 | for line in self.ReturnFile('intparam_definition.inc'): |
2619 | if 'ENDIF' in line: |
2620 | - self.assertEqual(len(alreadydefine), 30) |
2621 | + self.assertEqual(len(alreadydefine), 29) |
2622 | if '=' not in line: |
2623 | continue |
2624 | new_def = line.split('=')[0].lstrip() |
2625 | @@ -346,7 +346,7 @@ |
2626 | alreadydefine.append(new_def) |
2627 | alreadydefine = [name.lower() for name in alreadydefine] |
2628 | alreadydefine.sort() |
2629 | - solution = ['aew ', 'ckm22 ', 'complexi ', 'cw ', 'cw__exp__2 ', 'ee ', 'ee__exp__2 ', 'g ', 'g1 ', 'g__exp__2 ', 'gal(1) ', 'gal(2) ', 'gw ', 'gw__exp__2 ', 'lam ', 'mh__exp__2 ', 'muh ', 'mw ', 'mw__exp__2 ', 'mz__exp__2 ', 'mz__exp__4 ', 'sqrt__2 ', 'sqrt__aew ', 'sqrt__as ', 'sqrt__sw2 ', 'sw ', 'sw2 ', 'sw__exp__2 ', 'v ', 'v__exp__2 ', 'yb ', 'yt ', 'ytau '] |
2630 | + solution = ['aew ', 'as ', 'ckm22 ', 'complexi ', 'cw ', 'cw__exp__2 ', 'ee ', 'ee__exp__2 ','g ', 'g1 ', 'g__exp__2 ', 'gal(1) ', 'gal(2) ', 'gw ', 'gw__exp__2 ', 'lam ', 'mh__exp__2 ', 'muh ', 'mw ', 'mw__exp__2 ', 'mz__exp__2 ', 'mz__exp__4 ', 'sqrt__2 ', 'sqrt__aew ', 'sqrt__as ', 'sqrt__sw2 ', 'sw ', 'sw2 ', 'sw__exp__2 ', 'v ', 'v__exp__2 ', 'yb ', 'yt ', 'ytau '] |
2631 | self.assertEqual(alreadydefine, solution) |
2632 | |
2633 | |
2634 | |
2635 | === modified file 'tests/unit_tests/iolibs/test_export_v4.py' |
2636 | --- tests/unit_tests/iolibs/test_export_v4.py 2012-02-25 10:46:05 +0000 |
2637 | +++ tests/unit_tests/iolibs/test_export_v4.py 2012-03-28 09:12:20 +0000 |
2638 | @@ -1908,6 +1908,15 @@ |
2639 | DATA MAPCONFIG(0)/8/ |
2640 | """) |
2641 | |
2642 | + # Test maxconfigs.inc |
2643 | + writer = writers.FortranWriter(self.give_pos('test')) |
2644 | + exporter.write_maxconfigs_file(writer, subproc_groups) |
2645 | + writer.close() |
2646 | + self.assertFileContains('test', |
2647 | + """ INTEGER LMAXCONFIGS |
2648 | + PARAMETER(LMAXCONFIGS=32) |
2649 | +""") |
2650 | + |
2651 | # Test config_subproc_map.inc |
2652 | |
2653 | exporter.write_config_subproc_map_file(\ |
2654 | @@ -7205,6 +7214,15 @@ |
2655 | "MAXPROC, MAXSPROC\n" + \ |
2656 | " PARAMETER (MAXAMPS=8, MAXFLOW=1)\n" + \ |
2657 | " PARAMETER (MAXPROC=1, MAXSPROC=1)\n") |
2658 | + # Test maxconfigs.inc |
2659 | + writer = writers.FortranWriter(self.give_pos('test')) |
2660 | + exporter.write_maxconfigs_file(writer, matrix_elements) |
2661 | + writer.close() |
2662 | + self.assertFileContains('test', |
2663 | + """ INTEGER LMAXCONFIGS |
2664 | + PARAMETER(LMAXCONFIGS=72) |
2665 | +""") |
2666 | + |
2667 | # Test mg.sym |
2668 | writer = writers.FortranWriter(self.give_pos('test')) |
2669 | exporter.write_mg_sym_file(writer, me) |
2670 | @@ -8533,6 +8551,15 @@ |
2671 | DATA MAPCONFIG(0)/10/ |
2672 | """) |
2673 | |
2674 | + # Test maxconfigs.inc |
2675 | + writer = writers.FortranWriter(self.give_pos('test')) |
2676 | + exporter.write_maxconfigs_file(writer, [me]) |
2677 | + writer.close() |
2678 | + self.assertFileContains('test', |
2679 | + """ INTEGER LMAXCONFIGS |
2680 | + PARAMETER(LMAXCONFIGS=10) |
2681 | +""") |
2682 | + |
2683 | def test_configs_4f_decay(self): |
2684 | """Test configs.inc for 4f decay process that failed in v. 1.3.27 |
2685 | """ |
2686 | @@ -9285,8 +9312,8 @@ |
2687 | self.assertEqual(expected, solution) |
2688 | |
2689 | # internal params |
2690 | - self.assertEqual(len(mg4_model.params_dep), 1) |
2691 | - self.assertEqual(len(mg4_model.params_indep), 31) |
2692 | + self.assertEqual(len(mg4_model.params_dep), 2) |
2693 | + self.assertEqual(len(mg4_model.params_indep), 29) |
2694 | |
2695 | # couplings |
2696 | self.assertEqual(len(mg4_model.coups_dep), 3) |
2697 | @@ -9296,11 +9323,12 @@ |
2698 | |
2699 | |
2700 | # MG4 use G and not aS as it basic object for alphas related computation |
2701 | - #Pass G in the independant list |
2702 | - self.assertTrue('G' not in [p.name for p in mg4_model.params_dep]) |
2703 | - self.assertTrue('G' in [p.name for p in mg4_model.params_indep]) |
2704 | - self.assertTrue('sqrt__aS' not in [p.name for p in mg4_model.params_dep]) |
2705 | - self.assertTrue('sqrt__aS' in [p.name for p in mg4_model.params_indep]) |
2706 | + # G is out of any list! |
2707 | + self.assertFalse('G' in [p.name for p in mg4_model.params_dep]) |
2708 | + self.assertFalse('G' in [p.name for p in mg4_model.params_indep]) |
2709 | + # check that sqrt__aS is correctly set |
2710 | + self.assertTrue('sqrt__aS' in [p.name for p in mg4_model.params_dep]) |
2711 | + self.assertTrue('sqrt__aS' not in [p.name for p in mg4_model.params_indep]) |
2712 | |
2713 | |
2714 | def test_case_sensitive(self): |
Hi Johan,
Any news about this merge?
I think this is really time to release all those small fixes.
Cheers,
Olivier