Merge lp:~maddevelopers/mg5amcnlo/mg5_1_4_2 into lp:~madteam/mg5amcnlo/trunk

Proposed by Olivier Mattelaer
Status: Merged
Merged at revision: 227
Proposed branch: lp:~maddevelopers/mg5amcnlo/mg5_1_4_2
Merge into: lp:~madteam/mg5amcnlo/trunk
Diff against target: 1381 lines (+697/-149)
17 files modified
Template/Source/combine_runs.f (+1/-1)
Template/Source/rw_events.f (+10/-10)
Template/SubProcesses/addmothers.f (+6/-3)
Template/SubProcesses/unwgt.f (+2/-2)
Template/bin/madevent (+4/-0)
UpdateNotes.txt (+17/-4)
bin/mg5 (+4/-4)
madgraph/VERSION (+2/-2)
madgraph/interface/cmd_interface.py (+49/-13)
madgraph/interface/launch_ext_program.py (+0/-4)
madgraph/interface/madevent_interface.py (+150/-79)
madgraph/iolibs/template_files/madevent_combine_events.f (+3/-3)
madgraph/various/banner.py (+17/-17)
madgraph/various/gen_crossxhtml.py (+4/-3)
models/import_ufo.py (+24/-3)
tests/acceptance_tests/test_cmd.py (+14/-1)
tests/input_files/tt_banner.txt (+390/-0)
To merge this branch: bzr merge lp:~maddevelopers/mg5amcnlo/mg5_1_4_2
Reviewer Review Type Date Requested Status
Johan Alwall (community) Approve
Olivier Mattelaer Approve
Review via email: mp+93146@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Johan Alwall (johan-alwall) wrote :

Hello Olivier,

Nice job (as usual!). Just a tiny remark:

> @@ -701,6 +705,10 @@
> text = open(path).read()
> if 'Begin PROCESS' in text:
> return 'proc_v4'
> + elif '<MGVERSION>' in text:
> + return 'banner'
> + elif '<MGVersion>' in text:
> + return 'banner'
> else:
> return 'command'

I would recommend to make all these case independent (i.e., use
text.lower()), since HTML tags are case independent.

> + if 'MG5ProcCard' in ban:

Same thing here.

As I wrote in an email, it would be nice if a banner is automatically
detected as command line argument, so you can run
bin/mg5 banner.txt
(which also nicely simplifies the syntax in the web interface :-)).

And of course (did you implement this already?), automatic splitting of
the banner and use of the relevant cards if a banner path is given in
the cards question. That way the banner functionality will be complete.

Cheers,
Johan

Revision history for this message
Johan Alwall (johan-alwall) wrote :

Oh no... I found another problem (or question?):
I canceled the automatic banner run (by pressing Ctrl-C), and now on the crossx.html page there is an ERROR under "Banner". However, the associated debug file is not there, and in the main directory the ME5_debug file points to this non-existant file:
ME5_debug -> /Users/alwall/MadGraph/mg5_1_4_2/PROC_sm_0/run_01_fermi_debug.log

There is also a link to the banner ("fermi"), but the corresponding file doesn't exist.

It's not something urgent, but just a bit strange behavior...

Johan

222. By Olivier Mattelaer

allow
./bin/mg5 BANNER_PATH
./bin/mg5 PROC_CARD_V4_PATH
this implementation is fine if the cmd files is the same as one model name

Revision history for this message
Olivier Mattelaer (olivier-mattelaer) wrote :

ok for the lower case.
I was reluctant to do it since the file might be quite large. I will maybe use a regular expression instead (much nicer in fact since this allow to scan only one the content of the file).

>As I wrote in an email, it would be nice if a banner is automatically
>detected as command line argument, so you can run
>bin/mg5 banner.txt
>(which also nicely simplifies the syntax in the web interface :-)).

Done

>And of course (did you implement this already?), automatic splitting of
>the banner and use of the relevant cards if a banner path is given in
>the cards question. That way the banner functionality will be complete.

>Oh no... I found another problem (or question?):
>I canceled the automatic banner run (by pressing Ctrl-C), and now on the crossx.html page >there is an ERROR under "Banner". However, the associated debug file is not there, and in >the main directory the ME5_debug file points to this non-existant file:
>ME5_debug -> /Users/alwall/MadGraph/mg5_1_4_2/PROC_sm_0/run_01_fermi_debug.log
>There is also a link to the banner ("fermi"), but the corresponding file doesn't exist.

In fact I fact that before. But don't know what to do in this case.
I like to have the error in the html output since the job didn't finish correctly.
(which explains why the banner didn't exists, you stop the job before it's creation)
But the ME5_debug is pointless since this is a stop by the user.

yeah done for this.

223. By Olivier Mattelaer

pass banner tag to case insensitive
detection of import/card pass to regular expression (and case insensitive)

Revision history for this message
Johan Alwall (johan-alwall) wrote :

Excellent. How about the automatic splitting of a banner during card import? This should be very quick to implement (if you agree that it's a good thing).

Johan

Revision history for this message
Olivier Mattelaer (olivier-mattelaer) wrote :

All the case problem should be (in principle) resolve.
The banner detection is now case insensitive and all the tag associate to the banner are now lower case.

Revision history for this message
Olivier Mattelaer (olivier-mattelaer) wrote :

Otherwise,

One remark concerning the length of string variable in fortran:
./Source/banner.f: character*35 infile,outfile
./Source/banner.f: character*30 process,QED,QCD

is this enough?

Cheers,

Olivier

Revision history for this message
Johan Alwall (johan-alwall) wrote :

> ./Source/banner.f: character*35 infile,outfile
> ./Source/banner.f: character*30 process,QED,QCD

This file is not used (and has never been in recent history), so you can simply remove it.

However, there is another problem: I used a banner (I'll send it to you by email) for banner_run, running only parton level, and the tag is used appropriately to name the banner, but is not properly used in the crossx.html page (so the link to the banner doesn't work).

Cheers,
Johan

Revision history for this message
Olivier Mattelaer (olivier-mattelaer) wrote :

> Excellent. How about the automatic splitting of a banner during card import?
> This should be very quick to implement (if you agree that it's a good thing).

This is done (Do you trouble with that?), and I have the automatic launch of the process as well.
so this is exactly the same as
./bin/mg5
import banner PATH
(which makes a lot of sense)

Revision history for this message
Olivier Mattelaer (olivier-mattelaer) wrote :

Did you send me the correct banner?(p p > e+ e-) It's working perfectly on my computer.
(or I did not understand your problem).

I have remove the banner.f (pointless to keep it -> remove)
Then your change seems perfect.

review: Approve
Revision history for this message
Johan Alwall (johan-alwall) wrote :

> > Excellent. How about the automatic splitting of a banner during card import?
> > This should be very quick to implement (if you agree that it's a good
> thing).
>
> This is done (Do you trouble with that?), and I have the automatic launch of
> the process as well.
> so this is exactly the same as
> ./bin/mg5
> import banner PATH
> (which makes a lot of sense)

I am referring to the following:
bin/madevent
MGME5> generate_events
0
/Users/alwall/Downloads/run_01_fermi_banner.txt
copy //Users/alwall/Downloads/run_01_fermi_banner.txt as banner

Now if I check the cards, they are not replaced by the ones in the banner. In fact, I don't understand what "copy ... as banner" means, since the banner is then not used. To me it's clear that the user wants to use the cards in the banner if he does this.

Cheers,
Johan

Revision history for this message
Olivier Mattelaer (olivier-mattelaer) wrote :

Hi Johan,

> I am referring to the following:
> bin/madevent
> MGME5> generate_events
> 0
> /Users/alwall/Downloads/run_01_fermi_banner.txt
> copy //Users/alwall/Downloads/run_01_fermi_banner.txt as banner

Aaah ok now I understand.

> Now if I check the cards, they are not replaced by the ones in the
> banner. In fact, I don't understand what "copy ... as banner" means,
> since the banner is then not used.
> To me it's clear that the user wants to use the cards in the banner
> if he does this.

That's clear, just never think about that possibility before you speak
about that.
So this is quite easy to do.
Note that this super-seeds the previous question (so the mode of
running is redefine automatically to the banner level).

Cheers,

Olivier

>
> Cheers,
> Johan
>
> --
> https://code.launchpad.net/~maddevelopers/madgraph5/mg5_1_4_2/+merge/
> 93146
> You proposed lp:~maddevelopers/madgraph5/mg5_1_4_2 for merging.

Revision history for this message
Johan Alwall (johan-alwall) wrote :

> That's clear, just never think about that possibility before you speak
> about that.
> So this is quite easy to do.

Oh, I'm sorry I thought I had mentioned it in a previous comment (that's why I didn't specify well before).

> Note that this super-seeds the previous question (so the mode of
> running is redefine automatically to the banner level).

I don't agree - since you anyway seem to keep the cards even if I choose a shorter running, I would suggest to override only if it is "auto", but keep the user's choice if it's something else. This would be the most natural behavior.

Anyway, once this also works, I'll be perfectly happy. If you do it within a couple of hours, I'll approve so you can finally do the merge.

Thanks,
Johan

Revision history for this message
Olivier Mattelaer (olivier-mattelaer) wrote :

Hi Johan,

> I don't agree - since you anyway seem to keep the cards even if I
> choose a shorter running, I would suggest to override only if it is
> "auto", but keep the user's choice if it's something else. This
> would be the most natural behavior.

In fact generate_events ALWAYS launch pythia.
this one stops directly if pyhia-pgs is not installed
if they are no pythia-card.

So in fact the way to forbid the running is to remove the card. Is
this fine for you?

Cheers,

Olivier

On 16-févr.-12, at 05:11, Johan Alwall wrote:

>> That's clear, just never think about that possibility before you
>> speak
>> about that.
>> So this is quite easy to do.
>
> Oh, I'm sorry I thought I had mentioned it in a previous comment
> (that's why I didn't specify well before).
>
>> Note that this super-seeds the previous question (so the mode of
>> running is redefine automatically to the banner level).
>
> I don't agree - since you anyway seem to keep the cards even if I
> choose a shorter running, I would suggest to override only if it is
> "auto", but keep the user's choice if it's something else. This
> would be the most natural behavior.
>
> Anyway, once this also works, I'll be perfectly happy. If you do it
> within a couple of hours, I'll approve so you can finally do the
> merge.
>
> Thanks,
> Johan
> --
> https://code.launchpad.net/~maddevelopers/madgraph5/mg5_1_4_2/+merge/
> 93146
> You proposed lp:~maddevelopers/madgraph5/mg5_1_4_2 for merging.

224. By Olivier Mattelaer

treat correctly the case when the user enter a banner in the questions of madevent.

225. By Olivier Mattelaer

changing the mode of run when a banner is provided only if the mode is in auto

Revision history for this message
Olivier Mattelaer (olivier-mattelaer) wrote :

I implement it in that way (remove the additional card)
so you can see.

Revision history for this message
Johan Alwall (johan-alwall) wrote :

Perfect! Thanks a lot for this awesome version!

Johan

review: Approve
226. By Olivier Mattelaer

modify the date of the release

227. By Olivier Mattelaer

change the path for td binary from cp3wks05 to madgraph.phys

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Template/Source/combine_runs.f'
2--- Template/Source/combine_runs.f 2011-05-05 21:56:41 +0000
3+++ Template/Source/combine_runs.f 2012-02-16 19:14:18 +0000
4@@ -275,7 +275,7 @@
5 double precision P(0:4,maxexternal),xwgt
6 integer n,ic(7,maxexternal),ievent
7 double precision scale,aqcd,aqed
8- character*140 buff
9+ character*300 buff
10 logical done
11 c-----
12 c Begin Code
13
14=== modified file 'Template/Source/rw_events.f'
15--- Template/Source/rw_events.f 2010-10-30 03:26:37 +0000
16+++ Template/Source/rw_events.f 2012-02-16 19:14:18 +0000
17@@ -21,12 +21,12 @@
18 logical done
19 double precision P(0:4,*),wgt,aqcd,aqed,scale
20 integer ievent
21- character*140 buff2
22+ character*300 buff2
23 c
24 c Local
25 c
26 integer i,j,k
27- character*(256) buff
28+ character*(300) buff
29 double precision xdum1,xdum2
30 c
31 c Global
32@@ -46,10 +46,10 @@
33 open (unit=lun_ban, status='scratch')
34 banner_open=.true.
35 endif
36- 11 read(lun,'(a256)',end=99,err=99) buff
37+ 11 read(lun,'(a300)',end=99,err=99) buff
38 do while(index(buff,"<event") .eq. 0)
39 write(lun_ban,'(a)') buff
40- read(lun,'(a256)',end=99,err=99) buff
41+ read(lun,'(a300)',end=99,err=99) buff
42 enddo
43 read(lun,*,err=11, end=11) nexternal,ievent,wgt,scale,aqed,aqcd
44 do i=1,nexternal
45@@ -58,8 +58,8 @@
46 ic(7,i)=xdum2
47 enddo
48 do while(index(buff,"</event") .eq. 0)
49- read(lun,'(a256)',end=99,err=99) buff
50- if(buff(1:1).eq.'#') buff2=buff(1:140)
51+ read(lun,'(a300)',end=99,err=99) buff
52+ if(buff(1:1).eq.'#') buff2=buff(1:300)
53 enddo
54 c gal(1) = sqrt(4d0*pi*aqed)
55 c g = sqrt(4d0*pi*aqcd)
56@@ -93,7 +93,7 @@
57 integer nexternal, ic(7,*)
58 double precision P(0:4,*),wgt
59 double precision aqcd, aqed, scale
60- character*140 buff
61+ character*300 buff
62 c
63 c Local
64 c
65@@ -133,7 +133,7 @@
66 c
67 c Local
68 c
69- character*(80) buff
70+ character*(200) buff
71 c
72 c Global
73 c
74@@ -148,8 +148,8 @@
75 if (banner_open) then
76 rewind(lun_ban)
77 do while (.true.)
78- read(lun_ban,'(a79)',end=99,err=99) buff
79- write(lun,'(a79)') buff
80+ read(lun_ban,'(a)',end=99,err=99) buff
81+ write(lun,'(a)') buff
82 c write(*,*) buff
83 enddo
84 99 close(lun_ban)
85
86=== modified file 'Template/SubProcesses/addmothers.f'
87--- Template/SubProcesses/addmothers.f 2012-01-25 03:54:07 +0000
88+++ Template/SubProcesses/addmothers.f 2012-02-16 19:14:18 +0000
89@@ -14,7 +14,8 @@
90 integer jpart(7,-nexternal+3:2*nexternal-3),npart,ip,numproc
91 double precision pb(0:4,-nexternal+3:2*nexternal-3)
92 double precision rscale,aqcd,aqed,targetamp(maxflow)
93- character*140 buff
94+ character*300 buff
95+ character*20 cform
96
97 integer isym(nexternal,99), jsym
98 integer i,j,k,ida(2),ns,nres,ires,icl,ito2,idenpart,nc,ic
99@@ -323,8 +324,10 @@
100 enddo
101 enddo
102
103- if(ickkw.gt.0)
104- $ write(buff,'(a1,9e15.7)') '#',(ptclus(i),i=3,min(nexternal,11))
105+ if(ickkw.gt.0) then
106+ write(cform,'(a4,i2,a6)') '(a1,',max(nexternal,10),'e15.7)'
107+ write(buff,cform) '#',(ptclus(i),i=3,nexternal)
108+ endif
109 npart = nexternal+nres
110
111 return
112
113=== modified file 'Template/SubProcesses/unwgt.f'
114--- Template/SubProcesses/unwgt.f 2012-01-30 03:26:48 +0000
115+++ Template/SubProcesses/unwgt.f 2012-02-16 19:14:18 +0000
116@@ -240,7 +240,7 @@
117 integer iseed, nover, nstore
118 double precision scale,aqcd,aqed
119 integer ievent
120- character*140 buff
121+ character*300 buff
122 C
123 C GLOBAL
124 C
125@@ -397,7 +397,7 @@
126 real ran1
127 external ran1
128
129- character*140 buff
130+ character*300 buff
131
132 C
133 C GLOBAL
134
135=== modified file 'Template/bin/madevent'
136--- Template/bin/madevent 2012-02-03 21:44:27 +0000
137+++ Template/bin/madevent 2012-02-16 19:14:18 +0000
138@@ -159,6 +159,10 @@
139 if cmd_line.history[-1] not in ['EOF','quit','exit']:
140 cmd_line.results.store_result()
141 # Remove lock file
142+except:
143+ pass
144+
145+try:
146 os.remove(os.path.join(root_path,os.pardir, 'RunWeb'))
147 except:
148 pass
149
150=== modified file 'UpdateNotes.txt'
151--- UpdateNotes.txt 2012-02-06 19:57:04 +0000
152+++ UpdateNotes.txt 2012-02-16 19:14:18 +0000
153@@ -1,9 +1,22 @@
154 Update notes for MadGraph 5 (in reverse time order)
155
156-1.4.1 (06/02/12) OM: Fix the fermion flow check which was wrongly failing on some model
157- (Thanks to Benjamin)
158- OM: Improve run organization efficiency (which fastenize the code on cluster)
159- (Thanks to Johan)
160+1.4.2 (16/02/12) JA: Ensure that matching works properly with > 9 final state
161+ particles (by increasing a buffer size in event output)
162+ OM: add a command "import banner" in order to run a full run
163+ from a given banner.
164+ OM: Fix the Bug #921487, fixing a problem with home made model
165+ In the definition of Particle/Anti-Particle. (Thanks Ben)
166+ OM: Fix a formatting problem in me5_configuration.txt
167+ (Bug #930101) Thanks to Arian
168+ OM: allow to run ./bin/mg5 BANNER_PATH and
169+ ./bin/mg5 PROC_CARD_V4_PATH
170+ OM: Various small fixes concerning the stability of the html
171+ output.
172+
173+1.4.1 (06/02/12) OM: Fix the fermion flow check which was wrongly failing on
174+ some model (Thanks to Benjamin)
175+ OM: Improve run organization efficiency (which speeds up the
176+ code on cluster) (Thanks to Johan)
177 OM: More secure html output (Thanks to Simon)
178
179 1.4.0 (04/02/12): OM: New user interface for the madevent run. Type:
180
181=== modified file 'bin/mg5'
182--- bin/mg5 2011-12-14 21:52:20 +0000
183+++ bin/mg5 2012-02-16 19:14:18 +0000
184@@ -119,18 +119,18 @@
185 if options.file or args:
186 # They are an input file
187 if args:
188- input_file = args[0]
189+ input_file = os.path.realpath(args[0])
190 else:
191- input_file = options.file
192+ input_file = os.path.realpath(options.file)
193 if options.web:
194 cmd_line = cmd_interface.MadGraphCmdWeb()
195 cmd_line.debug_output = os.path.join(os.path.dirname(input_file),'generation.log')
196 cmd_line.use_rawinput = False
197- cmd_line.run_cmd('import command ' + input_file)
198+ cmd_line.run_cmd('import ' + input_file)
199 else:
200 cmd_line = cmd_interface.MadGraphCmdShell(mgme_dir = options.mgme_dir)
201 cmd_line.use_rawinput = False
202- cmd_line.run_cmd('import command ' + input_file)
203+ cmd_line.run_cmd('import ' + input_file)
204
205 else:
206 # Interactive mode
207
208=== modified file 'madgraph/VERSION'
209--- madgraph/VERSION 2012-02-06 19:57:04 +0000
210+++ madgraph/VERSION 2012-02-16 19:14:18 +0000
211@@ -1,3 +1,3 @@
212-version = 1.4.1
213-date = 2012-06-02
214+version = 1.4.2
215+date = 2012-02-16
216
217
218=== modified file 'madgraph/interface/cmd_interface.py'
219--- madgraph/interface/cmd_interface.py 2012-02-03 22:14:20 +0000
220+++ madgraph/interface/cmd_interface.py 2012-02-16 19:14:18 +0000
221@@ -63,6 +63,7 @@
222 import madgraph.interface.madevent_interface as madevent_interface
223
224 import madgraph.various.process_checks as process_checks
225+import madgraph.various.banner as banner_module
226
227 import models as ufomodels
228 import models.import_ufo as import_ufo
229@@ -258,6 +259,9 @@
230 logger.info("")
231 logger.info(" import command PATH :")
232 logger.info(" Execute the list of command in the file at PATH")
233+ logger.info("")
234+ logger.info(" import banner PATH [--no_launch]:")
235+ logger.info(" Rerun the exact same run define in the valid banner.")
236
237 def help_install(self):
238 logger.info("syntax: install " + "|".join(self._install_opts))
239@@ -417,7 +421,7 @@
240
241 if len(args) < 2:
242 self.help_add()
243- raise self.InvalidCmd('\"add\" requires two arguments')
244+ raise self.InvalidCmd('\"add\" requires at least two arguments')
245
246 if args[0] != 'process':
247 raise self.InvalidCmd('\"add\" requires the argument \"process\"')
248@@ -699,10 +703,16 @@
249 # Not valid directory so maybe a file
250 if os.path.isfile(path):
251 text = open(path).read()
252- if 'Begin PROCESS' in text:
253+ pat = re.compile('(Begin process|<MGVERSION>)', re.I)
254+ matches = pat.findall(text)
255+ if not matches:
256+ return 'command'
257+ elif len(matches) > 1:
258+ return 'banner'
259+ elif matches[0].lower() == 'begin process':
260 return 'proc_v4'
261 else:
262- return 'command'
263+ return 'banner'
264 else:
265 return 'proc_v4'
266
267@@ -1489,6 +1499,8 @@
268 return ['--modelname']
269 elif not (os.path.sep in args[-1] and line[-1] != ' '):
270 completion_categories['options'] = self.list_completion(text, ['--modelname','-modelname'])
271+ if len(args) >= 3 and mode.startswith('banner') and not '--no_launch' in line:
272+ completion_categories['options'] = self.list_completion(text, ['--no_launch'])
273 return self.deal_multiple_categories(completion_categories)
274
275
276@@ -1549,7 +1561,7 @@
277 _save_opts = ['model', 'processes', 'options']
278 _tutorial_opts = ['start', 'stop']
279 _check_opts = ['full', 'permutation', 'gauge', 'lorentz_invariance']
280- _import_formats = ['model_v4', 'model', 'proc_v4', 'command']
281+ _import_formats = ['model_v4', 'model', 'proc_v4', 'command', 'banner']
282 _install_opts = ['pythia-pgs', 'Delphes', 'MadAnalysis', 'ExRootAnalysis']
283 _v4_export_formats = ['madevent', 'standalone', 'matrix']
284 _export_formats = _v4_export_formats + ['standalone_cpp', 'pythia8']
285@@ -2465,8 +2477,31 @@
286 # Execute the card
287 self.use_rawinput = False
288 self.import_command_file(args[1])
289- self.use_rawinput = True
290-
291+ self.use_rawinput = True
292+
293+ elif args[0] == 'banner':
294+ type = madevent_interface.MadEventCmd.detect_card_type(args[1])
295+ if type != 'banner':
296+ raise self.InvalidCmd, 'The File should be a valid banner'
297+ ban = banner_module.Banner(args[1])
298+ # Check that this is MG5 banner
299+ if 'mg5proccard' in ban:
300+ for line in ban['mg5proccard'].split('\n'):
301+ if line.startswith('#') or line.startswith('<'):
302+ continue
303+ self.exec_cmd(line)
304+ else:
305+ raise self.InvalidCmd, 'Only MG5 banner are supported'
306+
307+ if not self._done_export:
308+ self.exec_cmd('output . -f')
309+
310+ ban.split(self._done_export[0])
311+ logger.info('All Cards from the banner have been place in directory %s' % pjoin(self._done_export[0], 'Cards'))
312+ if '--no_launch' not in args:
313+ self.exec_cmd('launch')
314+
315+
316 elif args[0] == 'proc_v4':
317
318 # Remove previous imports, generations and outputs from history
319@@ -2697,7 +2732,7 @@
320 files.mv(MG5DIR + '/td/td_mac_intel',MG5DIR+'/td/td')
321 else:
322 logger.info('Downloading TD for Linux 32 bit')
323- target = 'http://cp3wks05.fynu.ucl.ac.be/twiki/pub/Software/TopDrawer/td'
324+ target = 'http://madgraph.phys.ucl.ac.be/Downloads/td'
325 subprocess.call(['wget', target], cwd=pjoin(MG5DIR,'td'))
326 os.chmod(pjoin(MG5DIR,'td','td'), 0775)
327 if sys.maxsize > 2**32:
328@@ -2930,12 +2965,13 @@
329 else:
330 raise self.RWError('Could not load processes from file %s' % args[1])
331
332- def do_save(self, line):
333+ def do_save(self, line, check=True):
334 """Not in help: Save information to file"""
335
336 args = self.split_arg(line)
337 # Check argument validity
338- self.check_save(args)
339+ if check:
340+ self.check_save(args)
341
342 if args[0] == 'model':
343 if self._curr_model:
344@@ -2985,12 +3021,12 @@
345 to_write.remove(key)
346 except:
347 pass
348- if '_path' in key:
349+ if '_path' in key:
350 # special case need to update path
351 # check if absolute path
352 if value.startswith('./'):
353- realpath = os.path.realpath(os.path.join(MG5DIR, value))
354- writer.writelines('%s = %s # %s' % (key, value, comment))
355+ value = os.path.realpath(os.path.join(MG5DIR, value))
356+ writer.writelines('%s = %s # %s \n' % (key, value, comment))
357 for key in to_write:
358 if key in self._options:
359 writer.writelines('%s = %s \n' % (key,self._options[key]))
360@@ -3405,7 +3441,7 @@
361 if self._export_format == 'madevent':
362 # Create configuration file [path to executable] for madevent
363 filename = os.path.join(self._export_dir, 'Cards', 'me5_configuration.txt')
364- self.do_save('options %s' % filename)
365+ self.do_save('options %s' % filename, check=False)
366
367 logger.info('Type \"launch\" to generate events from this process, or see')
368 logger.info(self._export_dir + '/README')
369
370=== modified file 'madgraph/interface/launch_ext_program.py'
371--- madgraph/interface/launch_ext_program.py 2011-12-21 14:44:13 +0000
372+++ madgraph/interface/launch_ext_program.py 2012-02-16 19:14:18 +0000
373@@ -257,10 +257,6 @@
374 line = fsock.readline()
375 cross, error = line.split()[0:2]
376
377- if self.unit != 'GeV':
378- logger.info('The total cross-section is %s +- %s %s' % (cross, error, self.unit))
379- else:
380- logger.info('The width is %s +- %s GeV' % (cross, error))
381 logger.info('more information in %s'
382 % os.path.join(self.running_dir, 'index.html'))
383
384
385=== modified file 'madgraph/interface/madevent_interface.py'
386--- madgraph/interface/madevent_interface.py 2012-02-06 21:23:06 +0000
387+++ madgraph/interface/madevent_interface.py 2012-02-16 19:14:18 +0000
388@@ -396,21 +396,21 @@
389 logger.info("syntax: pythia [RUN] [--run_options]")
390 logger.info("-- run pythia on RUN (current one by default)")
391 self.run_options_help([('-f','answer all question by default'),
392- ('-tag=', 'define the tag for the pythia run'),
393+ ('--tag=', 'define the tag for the pythia run'),
394 ('--no_default', 'not run if pythia_card not present')])
395
396 def help_pgs(self):
397 logger.info("syntax: pgs [RUN] [--run_options]")
398 logger.info("-- run pgs on RUN (current one by default)")
399 self.run_options_help([('-f','answer all question by default'),
400- ('-tag=', 'define the tag for the pgs run'),
401+ ('--tag=', 'define the tag for the pgs run'),
402 ('--no_default', 'not run if pgs_card not present')])
403
404 def help_delphes(self):
405 logger.info("syntax: delphes [RUN] [--run_options]")
406 logger.info("-- run delphes on RUN (current one by default)")
407 self.run_options_help([('-f','answer all question by default'),
408- ('-tag=', 'define the tag for the delphes run'),
409+ ('--tag=', 'define the tag for the delphes run'),
410 ('--no_default', 'not run if delphes_card not present')])
411
412 #===============================================================================
413@@ -792,7 +792,7 @@
414 args.append('-f')
415
416 if len(tmp_args) == 0:
417- self.help_clean()
418+ self.help_remove()
419 raise self.InvalidCmd('clean command require the name of the run to clean')
420 elif len(tmp_args) == 1:
421 return tmp_args[0], tag, ['all']
422@@ -1216,8 +1216,8 @@
423
424 def complete_pythia(self,text, line, begidx, endidx):
425 "Complete the pythia command"
426-
427 args = self.split_arg(line[0:begidx], error=False)
428+
429 if len(args) == 1:
430 #return valid run_name
431 data = glob.glob(pjoin(self.me_dir, 'Events', '*','unweighted_events.lhe.gz'))
432@@ -1229,7 +1229,7 @@
433 tmp2 = self.list_completion(text, self._run_options + ['-f',
434 '--no_default', '--tag='], line)
435 return tmp1 + tmp2
436- else:
437+ elif line[-1] != '=':
438 return self.list_completion(text, self._run_options + ['-f',
439 '--no_default','--tag='], line)
440
441@@ -1728,6 +1728,34 @@
442 self.exec_cmd('pythia --no_default', postcmd=False, printcmd=False)
443 # pythia launches pgs/delphes if needed
444 self.store_result()
445+ self.print_results_in_shell(self.results.current)
446+
447+
448+ def print_results_in_shell(self, data):
449+ """Have a nice results prints in the shell,
450+ data should be of type: gen_crossxhtml.OneTagResults"""
451+
452+ logger.info(" === Results Summary for run: %s tag: %s ===\n" % (data['run_name'],data['tag']))
453+ if self.ninitial == 1:
454+ logger.info(" Width : %.4g +- %.4g GeV" % (data['cross'], data['error']))
455+ else:
456+ logger.info(" Cross-section : %.4g +- %.4g pb" % (data['cross'], data['error']))
457+ logger.info(" Nb of events : %s" % data['nb_event'] )
458+ if data['cross_pythia']:
459+ error = data.get_pythia_error(data['cross'], data['error'],
460+ data['cross_pythia'], data['nb_event'])
461+ nb_event = 0
462+ if data['cross']:
463+ nb_event = int(0.5+(data['nb_event'] * data['cross_pythia'] /data['cross']))
464+
465+ if self.ninitial == 1:
466+ logger.info(" Matched Width : %.4g +- %.4g GeV" % (data['cross_pythia'], error))
467+ else:
468+ logger.info(" Matched Cross-section : %.4g +- %.4g pb" % (data['cross'], error))
469+ logger.info(" Nb of events after Matching : %s" % nb_event)
470+ logger.info(" " )
471+
472+
473
474 ############################################################################
475 def do_calculate_decay_widths(self, line):
476@@ -1921,6 +1949,7 @@
477 (pjoin(self.me_dir, 'Events'), self.run_name))
478
479 self.update_status('', level='parton')
480+ self.print_results_in_shell(self.results.current)
481 self.results.def_current(None)
482
483 ############################################################################
484@@ -2413,10 +2442,19 @@
485 if tag:
486 to_suppress = [f for f in to_suppress if tag in f]
487 if 'parton' in mode or 'all' in mode:
488- if os.path.exists(pjoin(self.me_dir, 'Events', run, 'events.lhe.gz')):
489- to_suppress.append('events.lhe.gz')
490- if os.path.exists(pjoin(self.me_dir, 'Events', run, 'unweighted_events.lhe.gz')):
491- to_suppress.append('unweighted_events.lhe.gz')
492+ try:
493+ if self.results[run][0]['tag'] != tag:
494+ raise Exception, 'dummy'
495+ except:
496+ pass
497+ else:
498+ nb_rm = len(to_suppress)
499+ if os.path.exists(pjoin(self.me_dir, 'Events', run, 'events.lhe.gz')):
500+ to_suppress.append('events.lhe.gz')
501+ if os.path.exists(pjoin(self.me_dir, 'Events', run, 'unweighted_events.lhe.gz')):
502+ to_suppress.append('unweighted_events.lhe.gz')
503+ if nb_rm != len(to_suppress):
504+ logger.warning('Be carefull that partonic information are on the point to be removed.')
505 if 'all' in mode:
506 pass # suppress everything
507 else:
508@@ -2454,21 +2492,27 @@
509
510 # Remove file in SubProcess directory
511 if 'all' in mode or 'channel' in mode:
512- to_suppress = glob.glob(pjoin(self.me_dir, 'SubProcesses', '%s*' % run))
513- to_suppress += glob.glob(pjoin(self.me_dir, 'SubProcesses', '*','%s*' % run))
514- to_suppress += glob.glob(pjoin(self.me_dir, 'SubProcesses', '*','*','%s*' % run))
515-
516- if '-f' in args or len(to_suppress) == 0:
517- ans = 'y'
518+ try:
519+ if self.results[run][0]['tag'] != tag:
520+ raise Exception, 'dummy'
521+ except:
522+ pass
523 else:
524- question = 'Do you want to suppress the following files?\n %s' % \
525+ to_suppress = glob.glob(pjoin(self.me_dir, 'SubProcesses', '%s*' % run))
526+ to_suppress += glob.glob(pjoin(self.me_dir, 'SubProcesses', '*','%s*' % run))
527+ to_suppress += glob.glob(pjoin(self.me_dir, 'SubProcesses', '*','*','%s*' % run))
528+
529+ if '-f' in args or len(to_suppress) == 0:
530+ ans = 'y'
531+ else:
532+ question = 'Do you want to suppress the following files?\n %s' % \
533 '\n '.join(to_suppress)
534- ans = self.ask(question, 'y', choices=['y','n'], timeout = self.timeout)
535-
536- if ans == 'y':
537- for file2rm in to_suppress:
538- os.remove(file2rm)
539-
540+ ans = self.ask(question, 'y', choices=['y','n'], timeout = self.timeout)
541+
542+ if ans == 'y':
543+ for file2rm in to_suppress:
544+ os.remove(file2rm)
545+
546 if 'banner' in mode:
547 to_suppress = glob.glob(pjoin(self.me_dir, 'Events', run, '*'))
548 if tag:
549@@ -3084,8 +3128,14 @@
550 new_tag = True
551 elif not self.run_name in self.results and level =='parton':
552 pass # No results yet, so current tag is fine
553+ elif not self.run_name in self.results:
554+ #This is only for case when you want to trick the interface
555+ logger.warning('Trying to run data on unknown run.')
556+ self.results.add_run(name, self.run_card)
557+ self.results.update('add run %s' % name, 'all', makehtml=False)
558 else:
559 for tag in upgrade_tag[level]:
560+
561 if getattr(self.results[self.run_name][-1], tag):
562 # LEVEL is already define in the last tag -> need to switch tag
563 tag = self.get_available_tag()
564@@ -3380,8 +3430,9 @@
565
566 if mode.isdigit():
567 mode = name[mode]
568-
569+ auto = False
570 if mode == 'auto':
571+ auto = True
572 if not os.path.exists(pjoin(self.me_dir, 'Cards', 'pythia_card.dat')):
573 mode = 'parton'
574 elif os.path.exists(pjoin(self.me_dir, 'Cards', 'pgs_card.dat')):
575@@ -3391,22 +3442,24 @@
576 else:
577 mode = 'pythia'
578 logger.info('Will run in mode %s' % mode)
579-
580- # Clean the pointless card
581- if mode == 'parton':
582- if os.path.exists(pjoin(self.me_dir,'Cards','pythia_card.dat')):
583- os.remove(pjoin(self.me_dir,'Cards','pythia_card.dat'))
584- if os.path.exists(pjoin(self.me_dir,'Cards','pgs_card.dat')):
585- os.remove(pjoin(self.me_dir,'Cards','pgs_card.dat'))
586- if os.path.exists(pjoin(self.me_dir,'Cards','delphes_card.dat')):
587- os.remove(pjoin(self.me_dir,'Cards','delphes_card.dat'))
588- elif mode == 'pgs':
589- if os.path.exists(pjoin(self.me_dir,'Cards','delphes_card.dat')):
590- os.remove(pjoin(self.me_dir,'Cards','delphes_card.dat'))
591- elif mode == 'delphes':
592- if os.path.exists(pjoin(self.me_dir,'Cards','pgs_card.dat')):
593- os.remove(pjoin(self.me_dir,'Cards','pgs_card.dat'))
594-
595+
596+ def clean_pointless_card(mode):
597+ """ Clean the pointless card """
598+ if mode == 'parton':
599+ if os.path.exists(pjoin(self.me_dir,'Cards','pythia_card.dat')):
600+ os.remove(pjoin(self.me_dir,'Cards','pythia_card.dat'))
601+ if os.path.exists(pjoin(self.me_dir,'Cards','pgs_card.dat')):
602+ os.remove(pjoin(self.me_dir,'Cards','pgs_card.dat'))
603+ if os.path.exists(pjoin(self.me_dir,'Cards','delphes_card.dat')):
604+ os.remove(pjoin(self.me_dir,'Cards','delphes_card.dat'))
605+ elif mode == 'pgs':
606+ if os.path.exists(pjoin(self.me_dir,'Cards','delphes_card.dat')):
607+ os.remove(pjoin(self.me_dir,'Cards','delphes_card.dat'))
608+ elif mode == 'delphes':
609+ if os.path.exists(pjoin(self.me_dir,'Cards','pgs_card.dat')):
610+ os.remove(pjoin(self.me_dir,'Cards','pgs_card.dat'))
611+
612+ clean_pointless_card(mode)
613 # Now that we know in which mode we are check that all the card
614 #exists (copy default if needed)
615
616@@ -3424,39 +3477,42 @@
617 if force:
618 return
619
620- # Ask the user if he wants to edit any of the files
621- #First create the asking text
622- question = """Do you want to edit one cards (press enter to bypass editing)?
623+ def get_question(mode):
624+ # Ask the user if he wants to edit any of the files
625+ #First create the asking text
626+ question = """Do you want to edit one cards (press enter to bypass editing)?
627 1 / param : param_card.dat (be carefull about parameter consistency, especially widths)
628 2 / run : run_card.dat\n"""
629- possible_answer = ['0','done', 1, 'param', 2, 'run']
630- if mode in ['pythia', 'pgs', 'delphes']:
631- question += ' 3 / pythia : pythia_card.dat\n'
632- possible_answer.append(3)
633- possible_answer.append('pythia')
634- if mode == 'pgs':
635- question += ' 4 / pgs : pgs_card.dat\n'
636- possible_answer.append(4)
637- possible_answer.append('pgs')
638- elif mode == 'delphes':
639- question += ' 5 / delphes : delphes_card.dat\n'
640- question += ' 6 / trigger : delphes_trigger.dat\n'
641- possible_answer.append(5)
642- possible_answer.append('delphes')
643- possible_answer.append(6)
644- possible_answer.append('trigger')
645- if self.configuration['madanalysis_path']:
646- question += ' 9 / plot : plot_card.dat\n'
647- possible_answer.append(9)
648- possible_answer.append('plot')
649- card = {0:'done', 1:'param', 2:'run', 3:'pythia',
650- 4: 'pgs', 5: 'delphes', 6:'trigger',9:'plot'}
651- # Add the path options
652- question += ' Path to a valid card.\n'
653-
654+ possible_answer = ['0','done', 1, 'param', 2, 'run']
655+ if mode in ['pythia', 'pgs', 'delphes']:
656+ question += ' 3 / pythia : pythia_card.dat\n'
657+ possible_answer.append(3)
658+ possible_answer.append('pythia')
659+ if mode == 'pgs':
660+ question += ' 4 / pgs : pgs_card.dat\n'
661+ possible_answer.append(4)
662+ possible_answer.append('pgs')
663+ elif mode == 'delphes':
664+ question += ' 5 / delphes : delphes_card.dat\n'
665+ question += ' 6 / trigger : delphes_trigger.dat\n'
666+ possible_answer.append(5)
667+ possible_answer.append('delphes')
668+ possible_answer.append(6)
669+ possible_answer.append('trigger')
670+ if self.configuration['madanalysis_path']:
671+ question += ' 9 / plot : plot_card.dat\n'
672+ possible_answer.append(9)
673+ possible_answer.append('plot')
674+ card = {0:'done', 1:'param', 2:'run', 3:'pythia',
675+ 4: 'pgs', 5: 'delphes', 6:'trigger',9:'plot'}
676+ # Add the path options
677+ question += ' Path to a valid card.\n'
678+ return question, possible_answer, card
679+
680 # Loop as long as the user is not done.
681 answer = 'no'
682 while answer != 'done':
683+ question, possible_answer, card = get_question(mode)
684 answer = self.ask(question, '0', possible_answer, timeout=int(1.5*self.timeout), path_msg='enter path')
685 if answer.isdigit():
686 answer = card[int(answer)]
687@@ -3472,10 +3528,23 @@
688 card_name = self.ask('Fail to determine the type of the file. Please specify the format',
689 ['param_card.dat', 'run_card.dat','pythia_card.dat','pgs_card.dat',
690 'delphes_card.dat', 'delphes_trigger.dat','plot_card.dat'])
691-
692- logger.info('copy %s as %s' % (answer, card_name))
693- files.cp(answer, pjoin(self.me_dir, 'Cards', card_name))
694-
695+ elif card_name != 'banner':
696+ logger.info('copy %s as %s' % (answer, card_name))
697+ files.cp(answer, pjoin(self.me_dir, 'Cards', card_name))
698+ elif card_name == 'banner':
699+ banner_mod.split_banner(answer, self.me_dir, proc_card=False)
700+ logger.info('Splitting the banner in it\'s component')
701+ if auto:
702+ # Re-compute the current mode
703+ mode = 'parton'
704+ for level in ['delphes','pgs','pythia']:
705+ if os.path.exists(pjoin(self.me_dir,'Cards','%s_card.dat' % level)):
706+ mode = level
707+ break
708+ else:
709+ clean_pointless_card(mode)
710+
711+
712 ############################################################################
713 def ask_pythia_run_configuration(self, mode=None, force=False):
714 """Ask the question when launching pythia"""
715@@ -3677,25 +3746,27 @@
716 """
717
718 text = open(path).read()
719- if '<MGVersion>' in text:
720+ text = re.findall('(<MGVersion>|CEN_max_tracker|#TRIGGER CARD|parameter set name|muon eta coverage|MSTP|MSTU|Begin Minpts|gridpack|ebeam1|BLOCK|DECAY)', text, re.I)
721+ text = [t.lower() for t in text]
722+ if '<mgversion>' in text:
723 return 'banner'
724- if 'CEN_max_tracker' in text:
725+ elif 'cen_max_tracker' in text:
726 return 'delphes_card.dat'
727- elif '#TRIGGER CARD' in text:
728+ elif '#trigger card' in text:
729 return 'delphes_trigger.dat'
730 elif 'parameter set name' in text:
731 return 'pgs_card.dat'
732 elif 'muon eta coverage' in text:
733 return 'pgs_card.dat'
734- elif 'MSTP' in text:
735+ elif 'mstp' in text:
736 return 'pythia_card.dat'
737- elif 'MSTU' in text:
738+ elif 'mstu' in text:
739 return 'pythia_param_card.dat'
740- elif 'Begin Minpts' in text:
741+ elif 'begin minpts' in text:
742 return 'plot_card.dat'
743 elif 'gridpack' in text and 'ebeam1' in text:
744 return 'run_card.dat'
745- elif 'BLOCK' in text.upper() and 'DECAY' in text.upper():
746+ elif 'block' in text and 'decay' in text:
747 return 'param_card.dat'
748 else:
749 return 'unknown'
750
751=== modified file 'madgraph/iolibs/template_files/madevent_combine_events.f'
752--- madgraph/iolibs/template_files/madevent_combine_events.f 2011-10-14 05:15:02 +0000
753+++ madgraph/iolibs/template_files/madevent_combine_events.f 2012-02-16 19:14:18 +0000
754@@ -48,7 +48,7 @@
755 character*30 param_card_name
756 common/to_param_card_name/param_card_name
757
758- character*140 buff
759+ character*300 buff
760
761 data iseed/-1/
762 c-----
763@@ -100,7 +100,7 @@
764 I4 = 4
765 R8 = 8
766 record_length = 4*I4+maxexternal*I4*7+maxexternal*5*R8+3*R8+
767- & 140
768+ & 300
769 C $B$ scratch_name $B$ !this is tag for automatic modification by MW
770 filename='scratch'
771 C $E$ scratch_name $E$ !this is tag for automatic modification by MW
772@@ -541,7 +541,7 @@
773 double precision scale,aqcd,aqed,tmpsum
774 integer ievent,iseed
775 logical done,found
776- character*140 buff
777+ character*300 buff
778 character*300 fullname
779 c
780 c Les Houches init block (for the <init> info)
781
782=== modified file 'madgraph/various/banner.py'
783--- madgraph/various/banner.py 2012-01-05 20:56:14 +0000
784+++ madgraph/various/banner.py 2012-02-16 19:14:18 +0000
785@@ -41,10 +41,10 @@
786
787 #Look at the version
788 if MADEVENT:
789- self['MGVERSION'] = '#%s\n' % open(pjoin(MEDIR, 'MGMEVersion.txt')).read()
790+ self['mgversion'] = '#%s\n' % open(pjoin(MEDIR, 'MGMEVersion.txt')).read()
791 else:
792 info = misc.get_pkg_info()
793- self['MGVERSION'] = info['version']+'\n'
794+ self['mgversion'] = info['version']+'\n'
795
796 if banner_path:
797 self.read_banner(banner_path)
798@@ -56,13 +56,13 @@
799 pat_end=re.compile('</(?P<name>\w*)>')
800
801 tag_to_file={'slha':'param_card.dat',
802- 'MGRunCard':'run_card.dat',
803- 'MGPythiaCard':'pythia_card.dat',
804- 'MGPGSCard' : 'pgs_card.dat',
805- 'MGDelphesCard':'delphes_card.dat',
806- 'MGDelphesTrigger':'delphes_trigger.dat',
807- 'MG5ProcCard':'proc_card_mg5.dat',
808- 'MGProcCard': 'proc_card.dat',
809+ 'mgruncard':'run_card.dat',
810+ 'mgpythiacard':'pythia_card.dat',
811+ 'mgpgscard' : 'pgs_card.dat',
812+ 'mgdelphescard':'delphes_card.dat',
813+ 'mgdelphestrigger':'delphes_trigger.dat',
814+ 'mg5proccard':'proc_card_mg5.dat',
815+ 'mgproccard': 'proc_card.dat',
816 }
817
818 def read_banner(self, input_path):
819@@ -74,12 +74,12 @@
820 if store:
821 text += line
822 if self.pat_begin.search(line):
823- tag = self.pat_begin.search(line).group('name')
824+ tag = self.pat_begin.search(line).group('name').lower()
825 if tag in self.tag_to_file:
826 store = True
827 continue
828 if store and self.pat_end.search(line):
829- if tag == self.pat_end.search(line).group('name'):
830+ if tag == self.pat_end.search(line).group('name').lower():
831 self[tag] = text
832 text = ''
833 store = False
834@@ -105,9 +105,9 @@
835 information"""
836
837 for tag, text in self.items():
838- if tag == 'MGVERSION':
839+ if tag == 'mgversion':
840 continue
841- if not proc_card and tag in ['MG5ProcCard','MGProcCard']:
842+ if not proc_card and tag in ['mg5proccard','mgproccard']:
843 continue
844 ff = open(pjoin(me_dir, 'Cards', self.tag_to_file[tag]), 'w')
845 ff.write(text)
846@@ -158,7 +158,7 @@
847 else:
848 raise Exception, 'Impossible to know the type of the card'
849
850- self[tag] = open(path).read()
851+ self[tag.lower()] = open(path).read()
852
853
854
855@@ -191,10 +191,10 @@
856
857
858 if level == 'pythia':
859- if 'MGPythiaCard' in banner:
860- del banner['MGPythiaCard']
861+ if 'mgpythiacard' in banner:
862+ del banner['mgpythiacard']
863 if level in ['pythia','pgs','delphes']:
864- for tag in ['MGPGSCard', 'MGDelphesCard', 'MGDelphesTrigger']:
865+ for tag in ['mgpgscard', 'mgdelphescard', 'mgdelphestrigger']:
866 if tag in banner:
867 del banner[tag]
868 return banner
869
870=== modified file 'madgraph/various/gen_crossxhtml.py'
871--- madgraph/various/gen_crossxhtml.py 2012-02-07 00:09:26 +0000
872+++ madgraph/various/gen_crossxhtml.py 2012-02-16 19:14:18 +0000
873@@ -236,6 +236,7 @@
874 self.current.update_status()
875 else:
876 self.current.update_status(nolevel='parton')
877+ self.output()
878
879 def clean(self, levels = ['all'], run=None, tag=None):
880 """clean the run for the levels"""
881@@ -446,11 +447,11 @@
882 output = {}
883 current = self[-1]
884 # Check that cross/nb_event/error are define
885- if current.pythia and not current['nb_event']:
886+ if current.pythia and not current['nb_event'] and len(self) > 1:
887 output['nb_event'] = self[-2]['nb_event']
888 output['cross'] = self[-2]['cross']
889 output['error'] = self[-2]['error']
890- elif (current.pgs or current.delphes) and not current['nb_event']:
891+ elif (current.pgs or current.delphes) and not current['nb_event'] and len(self) > 1:
892 if self[-2]['cross_pythia']:
893 output['cross'] = self[-2]['cross_pythia']
894 output['nb_event'] = int(0.5+(self[-2]['nb_event'] * current['cross'] /self[-2]['cross']))
895@@ -617,7 +618,7 @@
896
897 id = '%s_%s_%s_%s' % (self['run_name'],self['tag'], level, name)
898
899- return " <a id='%(id)s' href='%(link)s' onClick=\"check_link('%(link)s.gz','%(link)s','%(id)s')\">%(name)s</a>" \
900+ return " <a id='%(id)s' href='%(link)s.gz' onClick=\"check_link('%(link)s.gz','%(link)s','%(id)s')\">%(name)s</a>" \
901 % {'link': link, 'id': id, 'name':name}
902
903 def double_link(self, link1, link2, name, id):
904
905=== modified file 'models/import_ufo.py'
906--- models/import_ufo.py 2012-02-06 19:57:04 +0000
907+++ models/import_ufo.py 2012-02-16 19:14:18 +0000
908@@ -218,6 +218,9 @@
909 [p.antiname.lower() for p in self.ufomodel.all_particles])):
910 self.use_lower_part_names = True
911
912+ # check which of the fermion/anti-fermion should be set as incoming
913+ self.detect_incoming_fermion()
914+
915 for particle_info in self.ufomodel.all_particles:
916 self.add_particle(particle_info)
917
918@@ -268,9 +271,10 @@
919
920 # MG5 have only one entry for particle and anti particles.
921 #UFO has two. use the color to avoid duplictions
922- if particle_info.pdg_code < 0:
923+ pdg = particle_info.pdg_code
924+ if pdg in self.incoming or (pdg not in self.outcoming and pdg <0):
925 return
926-
927+
928 # MG5 doesn't use ghost (use unitary gauges)
929 if particle_info.spin < 0:
930 return
931@@ -369,7 +373,24 @@
932 output[anticolor.pdg_code] = -3
933
934 return output
935-
936+
937+ def detect_incoming_fermion(self):
938+ """define which fermion should be incoming
939+ for that we look at F F~ X interactions
940+ """
941+ self.incoming = []
942+ self.outcoming = []
943+ for interaction_info in self.ufomodel.all_vertices:
944+ # check if the interation meet requirements:
945+ pdg = [p.pdg_code for p in interaction_info.particles if p.spin==2]
946+ for i in range(0, len(pdg),2):
947+ if pdg[i] == - pdg[i+1]:
948+ if pdg[i] in self.outcoming:
949+ raise UFOImportError, 'Input output not coherent'
950+ elif not pdg[i] in self.incoming:
951+ self.incoming.append(pdg[i])
952+ self.outcoming.append(pdg[i+1])
953+
954
955 def add_interaction(self, interaction_info, color_info):
956 """add an interaction in the MG5 model. interaction_info is the
957
958=== modified file 'tests/acceptance_tests/test_cmd.py'
959--- tests/acceptance_tests/test_cmd.py 2012-02-04 19:53:54 +0000
960+++ tests/acceptance_tests/test_cmd.py 2012-02-16 19:14:18 +0000
961@@ -20,7 +20,7 @@
962 import sys
963 import logging
964
965-
966+pjoin = os.path.join
967
968 logger = logging.getLogger('test_cmd')
969
970@@ -1083,3 +1083,16 @@
971 self.assertTrue(me_groups)
972 self.assertAlmostEqual(float(me_groups.group('value')), 1.953735e-2)
973
974+ def test_import_banner_command(self):
975+ """check that the import banner command works"""
976+ self.do('import banner %s --no_launch' % pjoin(MG5DIR, 'tests', 'input_files', 'tt_banner.txt'))
977+
978+ # check that the output exists:
979+ self.assertTrue(os.path.exists(self.out_dir))
980+
981+ # check that the Cards have been modified
982+ run_card = open(pjoin(self.out_dir,'Cards','run_card.dat')).read()
983+ self.assertTrue("'tt' = run_tag" in run_card)
984+ self.assertTrue("200 = nevents" in run_card)
985+
986+
987
988=== added file 'tests/input_files/tt_banner.txt'
989--- tests/input_files/tt_banner.txt 1970-01-01 00:00:00 +0000
990+++ tests/input_files/tt_banner.txt 2012-02-16 19:14:18 +0000
991@@ -0,0 +1,390 @@
992+<LesHouchesEvents version="1.0">
993+<header>
994+<!--
995+#*********************************************************************
996+# *
997+# MadGraph 5 *
998+# *
999+# Going Beyond *
1000+# *
1001+# http://madgraph.hep.uiuc.edu *
1002+# http://madgraph.phys.ucl.ac.be *
1003+# http://madgraph.roma2.infn.it *
1004+# *
1005+# The MadGraph team *
1006+# *
1007+#....................................................................*
1008+# *
1009+# This file contains all the information necessary to reproduce *
1010+# the events generated: *
1011+# *
1012+# 1. software version *
1013+# 2. proc_card : code generation info including model *
1014+# 3. param_card : model primary parameters in the LH format *
1015+# 4. run_card : running parameters (collider and cuts) *
1016+# 5. pythia_card : present only if pythia has been run *
1017+# 6. pgs_card : present only if pgs has been run *
1018+# 7. delphes_cards : present only if delphes has been run *
1019+# *
1020+# *
1021+#*********************************************************************
1022+-->
1023+<slha>
1024+######################################################################
1025+## PARAM_CARD AUTOMATICALY GENERATED BY MG5 FOLLOWING UFO MODEL ####
1026+######################################################################
1027+
1028+###################################
1029+## INFORMATION FOR MASS
1030+###################################
1031+Block mass
1032+ 5 4.700000e+00 # MB
1033+ 6 1.730000e+02 # MT
1034+ 15 1.777000e+00 # MTA
1035+ 23 9.118800e+01 # MZ
1036+ 25 1.200000e+02 # MH
1037+## Not dependent paramater.
1038+## Those values should be edited following the
1039+## analytical expression. MG5 ignore those values
1040+## but they are important for interfacing the output of MG5
1041+## to external program such as Pythia.
1042+ 12 0.000000 # ve : 0.0
1043+ 14 0.000000 # vm : 0.0
1044+ 16 0.000000 # vt : 0.0
1045+ 2 0.000000 # u : 0.0
1046+ 4 0.000000 # c : 0.0
1047+ 1 0.000000 # d : 0.0
1048+ 3 0.000000 # s : 0.0
1049+ 22 0.000000 # a : 0.0
1050+ 24 80.419002 # w+ : cmath.sqrt(MZ__exp__2/2. + cmath.sqrt(MZ__exp__4/4. - (aEW*cmath.pi*MZ__exp__2)/(Gf*sqrt__2)))
1051+ 21 0.000000 # g : 0.0
1052+ 11 0.000000 # e- : 0.0
1053+ 13 0.000000 # mu- : 0.0
1054+
1055+###################################
1056+## INFORMATION FOR SMINPUTS
1057+###################################
1058+Block sminputs
1059+ 1 1.325070e+02 # aEWM1
1060+ 2 1.166390e-05 # Gf
1061+ 3 1.180000e-01 # aS
1062+
1063+###################################
1064+## INFORMATION FOR YUKAWA
1065+###################################
1066+Block yukawa
1067+ 5 4.200000e+00 # ymb
1068+ 6 1.645000e+02 # ymt
1069+ 15 1.777000e+00 # ymtau
1070+
1071+###################################
1072+## INFORMATION FOR DECAY
1073+###################################
1074+DECAY 6 1.491500e+00 # WT
1075+DECAY 23 2.441404e+00 # WZ
1076+DECAY 24 2.047600e+00 # WW
1077+DECAY 25 5.753088e-03 # WH
1078+## Not dependent paramater.
1079+## Those values should be edited following the
1080+## analytical expression. MG5 ignore those values
1081+## but they are important for interfacing the output of MG5
1082+## to external program such as Pythia.
1083+DECAY 12 0.000000 # ve : 0.0
1084+DECAY 14 0.000000 # vm : 0.0
1085+DECAY 16 0.000000 # vt : 0.0
1086+DECAY 2 0.000000 # u : 0.0
1087+DECAY 4 0.000000 # c : 0.0
1088+DECAY 1 0.000000 # d : 0.0
1089+DECAY 3 0.000000 # s : 0.0
1090+DECAY 5 0.000000 # b : 0.0
1091+DECAY 22 0.000000 # a : 0.0
1092+DECAY 21 0.000000 # g : 0.0
1093+DECAY 11 0.000000 # e- : 0.0
1094+DECAY 13 0.000000 # mu- : 0.0
1095+DECAY 15 0.000000 # ta- : 0.0
1096+
1097+</slha>
1098+<MGProcCard>
1099+#*********************************************************************
1100+# MadGraph/MadEvent *
1101+# http://madgraph.hep.uiuc.edu *
1102+# *
1103+# proc_card.dat *
1104+#*********************************************************************
1105+# *
1106+# This Files is generated by MADGRAPH 5 *
1107+# *
1108+# WARNING: This Files is generated for MADEVENT (compatibility issue)*
1109+# This files is NOT a valid MG4 proc_card.dat *
1110+# Running this in MG4 will NEVER reproduce the result of MG5*
1111+# *
1112+#*********************************************************************
1113+#*********************************************************************
1114+# Process(es) requested : mg2 input *
1115+#*********************************************************************
1116+# Begin PROCESS # This is TAG. Do not modify this line
1117+p p > t t~ @1 #Process
1118+# Be carefull the coupling are here in MG5 convention
1119+
1120+end_coup # End the couplings input
1121+
1122+done # this tells MG there are no more procs
1123+# End PROCESS # This is TAG. Do not modify this line
1124+#*********************************************************************
1125+# Model information *
1126+#*********************************************************************
1127+# Begin MODEL # This is TAG. Do not modify this line
1128+sm
1129+# End MODEL # This is TAG. Do not modify this line
1130+#*********************************************************************
1131+# Start multiparticle definitions *
1132+#*********************************************************************
1133+# Begin MULTIPARTICLES # This is TAG. Do not modify this line
1134+
1135+# End MULTIPARTICLES # This is TAG. Do not modify this line
1136+
1137+</MGProcCard>
1138+<MGRunCard>
1139+#*********************************************************************
1140+# MadGraph/MadEvent *
1141+# http://madgraph.hep.uiuc.edu *
1142+# *
1143+# run_card.dat *
1144+# *
1145+# This file is used to set the parameters of the run. *
1146+# *
1147+# Some notation/conventions: *
1148+# *
1149+# Lines starting with a '# ' are info or comments *
1150+# *
1151+# mind the format: value = variable ! comment *
1152+#*********************************************************************
1153+#
1154+#*******************
1155+# Running parameters
1156+#*******************
1157+#
1158+#*********************************************************************
1159+# Tag name for the run (one word) *
1160+#*********************************************************************
1161+ 'tt' = run_tag ! name of the run
1162+#*********************************************************************
1163+# Run to generate the grid pack *
1164+#*********************************************************************
1165+ .false. = gridpack !True = setting up the grid pack
1166+#*********************************************************************
1167+# Number of events and rnd seed *
1168+#*********************************************************************
1169+ 200 = nevents ! Number of unweighted events requested
1170+ 0 = iseed ! rnd seed (0=assigned automatically=default))
1171+#*********************************************************************
1172+# Collider type and energy *
1173+#*********************************************************************
1174+ 1 = lpp1 ! beam 1 type (0=NO PDF)
1175+ 1 = lpp2 ! beam 2 type (0=NO PDF)
1176+ 3500 = ebeam1 ! beam 1 energy in GeV
1177+ 3500 = ebeam2 ! beam 2 energy in GeV
1178+#*********************************************************************
1179+# Beam polarization from -100 (left-handed) to 100 (right-handed) *
1180+#*********************************************************************
1181+ 0 = polbeam1 ! beam polarization for beam 1
1182+ 0 = polbeam2 ! beam polarization for beam 2
1183+#*********************************************************************
1184+# PDF CHOICE: this automatically fixes also alpha_s and its evol. *
1185+#*********************************************************************
1186+ 'cteq6l1' = pdlabel ! PDF set
1187+#*********************************************************************
1188+# Renormalization and factorization scales *
1189+#*********************************************************************
1190+ F = fixed_ren_scale ! if .true. use fixed ren scale
1191+ F = fixed_fac_scale ! if .true. use fixed fac scale
1192+ 91.1880 = scale ! fixed ren scale
1193+ 91.1880 = dsqrt_q2fact1 ! fixed fact scale for pdf1
1194+ 91.1880 = dsqrt_q2fact2 ! fixed fact scale for pdf2
1195+ 1 = scalefact ! scale factor for event-by-event scales
1196+#*********************************************************************
1197+# Matching - Warning! ickkw > 0 is still beta
1198+#*********************************************************************
1199+ 1 = ickkw ! 0 no matching, 1 MLM, 2 CKKW matching
1200+ 1 = highestmult ! for ickkw=2, highest mult group
1201+ 1 = ktscheme ! for ickkw=1, 1 Durham kT, 2 Pythia pTE
1202+ 1 = alpsfact ! scale factor for QCD emission vx
1203+ F = chcluster ! cluster only according to channel diag
1204+ F = pdfwgt ! for ickkw=1, perform pdf reweighting
1205+#*********************************************************************
1206+#
1207+#**********************************
1208+# BW cutoff (M+/-bwcutoff*Gamma)
1209+#**********************************
1210+ 15 = bwcutoff !
1211+
1212+ F = cut_decays ! Apply decays to products
1213+#*******************
1214+# Standard Cuts
1215+#*******************
1216+#
1217+#*********************************************************************
1218+# Minimum and maximum pt's *
1219+#*********************************************************************
1220+ 20 = ptj ! minimum pt for the jets
1221+ 20 = ptb ! minimum pt for the b
1222+ 0 = pta ! minimum pt for the photons
1223+ 0 = ptl ! minimum pt for the charged leptons
1224+ 0 = misset ! minimum missing Et (sum of neutrino's momenta)
1225+ 0 = ptheavy ! minimum pt for one heavy final state
1226+ 1d5 = ptjmax ! maximum pt for the jets
1227+ 1d5 = ptbmax ! maximum pt for the b
1228+ 1d5 = ptamax ! maximum pt for the photons
1229+ 1d5 = ptlmax ! maximum pt for the charged leptons
1230+ 1d5 = missetmax ! maximum missing Et (sum of neutrino's momenta)
1231+#*********************************************************************
1232+# Minimum and maximum E's (in the lab frame) *
1233+#*********************************************************************
1234+ 0 = ej ! minimum E for the jets
1235+ 0 = eb ! minimum E for the b
1236+ 0 = ea ! minimum E for the photons
1237+ 0 = el ! minimum E for the charged leptons
1238+ 1d5 = ejmax ! maximum E for the jets
1239+ 1d5 = ebmax ! maximum E for the b
1240+ 1d5 = eamax ! maximum E for the photons
1241+ 1d5 = elmax ! maximum E for the charged leptons
1242+#*********************************************************************
1243+# Maximum and minimum rapidity *
1244+#*********************************************************************
1245+ 5d0 = etaj ! max rap for the jets
1246+ 5d0 = etab ! max rap for the b
1247+ 2d5 = etaa ! max rap for the photons
1248+ 2d5 = etal ! max rap for the charged leptons
1249+ 0d0 = etajmin ! min rap for the jets
1250+ 0d0 = etabmin ! min rap for the b
1251+ 0d0 = etaamin ! min rap for the photons
1252+ 0d0 = etalmin ! main rap for the charged leptons
1253+#*********************************************************************
1254+# Minimum and maximum DeltaR distance *
1255+#*********************************************************************
1256+ 0.001 = drjj ! min distance between jets
1257+ 0.001 = drbb ! min distance between b's
1258+ 0 = drll ! min distance between leptons
1259+ 0 = draa ! min distance between gammas
1260+ 0.001 = drbj ! min distance between b and jet
1261+ 0 = draj ! min distance between gamma and jet
1262+ 0 = drjl ! min distance between jet and lepton
1263+ 0 = drab ! min distance between gamma and b
1264+ 0 = drbl ! min distance between b and lepton
1265+ 0 = dral ! min distance between gamma and lepton
1266+ 1d2 = drjjmax ! max distance between jets
1267+ 1d2 = drbbmax ! max distance between b's
1268+ 1d2 = drllmax ! max distance between leptons
1269+ 1d2 = draamax ! max distance between gammas
1270+ 1d2 = drbjmax ! max distance between b and jet
1271+ 1d2 = drajmax ! max distance between gamma and jet
1272+ 1d2 = drjlmax ! max distance between jet and lepton
1273+ 1d2 = drabmax ! max distance between gamma and b
1274+ 1d2 = drblmax ! max distance between b and lepton
1275+ 1d2 = dralmax ! maxdistance between gamma and lepton
1276+#*********************************************************************
1277+# Minimum and maximum invariant mass for pairs *
1278+#*********************************************************************
1279+ 0 = mmjj ! min invariant mass of a jet pair
1280+ 0 = mmbb ! min invariant mass of a b pair
1281+ 0 = mmaa ! min invariant mass of gamma gamma pair
1282+ 0 = mmll ! min invariant mass of l+l- (same flavour) lepton pair
1283+ 1d5 = mmjjmax ! max invariant mass of a jet pair
1284+ 1d5 = mmbbmax ! max invariant mass of a b pair
1285+ 1d5 = mmaamax ! max invariant mass of gamma gamma pair
1286+ 1d5 = mmllmax ! max invariant mass of l+l- (same flavour) lepton pair
1287+#*********************************************************************
1288+# Minimum and maximum invariant mass for all letpons *
1289+#*********************************************************************
1290+ 0 = mmnl ! min invariant mass for all letpons (l+- and vl)
1291+ 1d5 = mmnlmax ! max invariant mass for all letpons (l+- and vl)
1292+#*********************************************************************
1293+# Inclusive cuts *
1294+#*********************************************************************
1295+ 0 = xptj ! minimum pt for at least one jet
1296+ 0 = xptb ! minimum pt for at least one b
1297+ 0 = xpta ! minimum pt for at least one photon
1298+ 0 = xptl ! minimum pt for at least one charged lepton
1299+#*********************************************************************
1300+# Control the pt's of the jets sorted by pt *
1301+#*********************************************************************
1302+ 0 = ptj1min ! minimum pt for the leading jet in pt
1303+ 0 = ptj2min ! minimum pt for the second jet in pt
1304+ 0 = ptj3min ! minimum pt for the third jet in pt
1305+ 0 = ptj4min ! minimum pt for the fourth jet in pt
1306+ 1d5 = ptj1max ! maximum pt for the leading jet in pt
1307+ 1d5 = ptj2max ! maximum pt for the second jet in pt
1308+ 1d5 = ptj3max ! maximum pt for the third jet in pt
1309+ 1d5 = ptj4max ! maximum pt for the fourth jet in pt
1310+ 0 = cutuse ! reject event if fails any (0) / all (1) jet pt cuts
1311+#*********************************************************************
1312+# Control the Ht(k)=Sum of k leading jets *
1313+#*********************************************************************
1314+ 0 = htjmin ! minimum jet HT=Sum(jet pt)
1315+ 1d5 = htjmax ! maximum jet HT=Sum(jet pt)
1316+ 0 = ht2min ! minimum Ht for the two leading jets
1317+ 0 = ht3min ! minimum Ht for the three leading jets
1318+ 0 = ht4min ! minimum Ht for the four leading jets
1319+ 1d5 = ht2max ! maximum Ht for the two leading jets
1320+ 1d5 = ht3max ! maximum Ht for the three leading jets
1321+ 1d5 = ht4max ! maximum Ht for the four leading jets
1322+#*********************************************************************
1323+# WBF cuts *
1324+#*********************************************************************
1325+ 0 = xetamin ! minimum rapidity for two jets in the WBF case
1326+ 0 = deltaeta ! minimum rapidity for two jets in the WBF case
1327+#*********************************************************************
1328+# maximal pdg code for quark to be considered as a jet *
1329+# otherwise b cuts are applied *
1330+#*********************************************************************
1331+ 5 = maxjetflavor ! Apply b cuts
1332+#*********************************************************************
1333+# Jet measure cuts *
1334+#*********************************************************************
1335+ 0 = xqcut ! minimum kt jet measure between partons
1336+#*********************************************************************
1337+
1338+</MGRunCard>
1339+<MGVERSION>
1340+#5.1.4.2
1341+
1342+</MGVERSION>
1343+<MG5ProcCard>
1344+#************************************************************
1345+#* MadGraph 5 *
1346+#* *
1347+#* * * *
1348+#* * * * * *
1349+#* * * * * 5 * * * * *
1350+#* * * * * *
1351+#* * * *
1352+#* *
1353+#* *
1354+#* VERSION 1.4.2 2012-02-08 *
1355+#* *
1356+#* The MadGraph Development Team - Please visit us at *
1357+#* https://server06.fynu.ucl.ac.be/projects/madgraph *
1358+#* *
1359+#************************************************************
1360+#* *
1361+#* Command File for MadGraph 5 *
1362+#* *
1363+#* run as ./bin/mg5 filename *
1364+#* *
1365+#************************************************************
1366+
1367+import model sm
1368+# Define multiparticle labels
1369+define p = g u c d s u~ c~ d~ s~
1370+define j = g u c d s u~ c~ d~ s~
1371+define l+ = e+ mu+
1372+define l- = e- mu-
1373+define vl = ve vm vt
1374+define vl~ = ve~ vm~ vt~
1375+# Specify process(es) to run
1376+generate p p > t t~ @1
1377+# Output processes to MadEvent directory
1378+output AUTO_TEST_MG5 -f
1379+
1380+</MG5ProcCard>
1381+</LesHouchesEvents>

Subscribers

People subscribed via source and target branches