Merge lp:~maddevelopers/mg5amcnlo/1.4.3 into lp:~madteam/mg5amcnlo/trunk
- 1.4.3
- Merge into trunk
Status: | Merged |
---|---|
Merged at revision: | 206 |
Proposed branch: | lp:~maddevelopers/mg5amcnlo/1.4.3 |
Merge into: | lp:~madteam/mg5amcnlo/trunk |
Diff against target: |
7260 lines (+2432/-1929) 73 files modified
Template/Source/banner.f (+0/-120) Template/Source/gen_ximprove.f (+28/-31) Template/Source/maxconfigs.inc (+0/-2) Template/Source/maxparticles.inc (+0/-2) Template/Source/sum.f (+0/-55) Template/Source/sum_html.f (+0/-775) Template/SubProcesses/setcuts.f (+11/-5) Template/bin/generate_events (+17/-15) Template/bin/internal/compile_Source (+1/-1) Template/bin/internal/sumall (+0/-29) UpdateNotes.txt (+83/-45) aloha/aloha_object.py (+1/-1) aloha/aloha_writers.py (+123/-44) aloha/create_aloha.py (+22/-14) aloha/template_files/aloha_functions.f (+2/-2) aloha/template_files/oxxxxx.cc (+4/-4) aloha/template_files/wavefunctions.py (+2/-2) bin/create_aloha_release.py (+1/-1) bin/create_release.py (+5/-5) bin/mg5 (+5/-6) madgraph/VERSION (+2/-2) madgraph/core/base_objects.py (+28/-5) madgraph/core/diagram_generation.py (+21/-3) madgraph/interface/coloring_logging.py (+2/-2) madgraph/interface/extended_cmd.py (+130/-4) madgraph/interface/launch_ext_program.py (+4/-1) madgraph/interface/madevent_interface.py (+161/-138) madgraph/interface/madgraph_interface.py (+142/-213) madgraph/interface/master_interface.py (+435/-0) madgraph/iolibs/export_cpp.py (+2/-1) madgraph/iolibs/export_python.py (+2/-1) madgraph/iolibs/export_v4.py (+8/-30) madgraph/iolibs/group_subprocs.py (+2/-1) madgraph/iolibs/import_v4.py (+2/-4) madgraph/iolibs/template_files/madevent_combine_events.f (+1/-3) madgraph/iolibs/template_files/madevent_makefile_source (+1/-5) madgraph/iolibs/template_files/madevent_symmetry.f (+8/-5) madgraph/iolibs/template_files/madevent_write_banner.f (+0/-116) madgraph/various/banner.py (+11/-2) madgraph/various/cluster.py (+204/-9) madgraph/various/diagram_symmetry.py (+1/-1) madgraph/various/gen_crossxhtml.py (+10/-1) madgraph/various/misc.py (+5/-4) madgraph/various/process_checks.py (+2/-1) madgraph/various/sum_html.py (+65/-45) models/check_param_card.py (+5/-0) models/heft/restrict_ckm.dat (+2/-0) models/heft/restrict_default.dat (+2/-0) models/heft/restrict_no_b_mass.dat (+2/-0) models/heft/restrict_no_masses.dat (+2/-0) models/heft/restrict_no_tau_mass.dat (+2/-0) models/heft/restrict_zeromass_ckm.dat (+2/-0) models/import_ufo.py (+11/-5) models/model_reader.py (+24/-64) tests/acceptance_tests/test_cmd.py (+52/-26) tests/acceptance_tests/test_cmd_madevent.py (+75/-3) tests/parallel_tests/compare_with_old_mg5_version.py (+38/-2) tests/parallel_tests/madevent_comparator.py (+6/-5) tests/parallel_tests/me_comparator.py (+5/-3) tests/unit_tests/core/test_base_objects.py (+4/-0) tests/unit_tests/core/test_diagram_generation.py (+77/-6) tests/unit_tests/core/test_helas_objects.py (+4/-4) tests/unit_tests/interface/test_cmd.py (+19/-11) tests/unit_tests/interface/test_madevent.py (+2/-2) tests/unit_tests/iolibs/test_export_cpp.py (+3/-1) tests/unit_tests/iolibs/test_export_python.py (+3/-1) tests/unit_tests/iolibs/test_export_v4.py (+17/-2) tests/unit_tests/iolibs/test_group_subprocs.py (+1/-1) tests/unit_tests/iolibs/test_helas_call_writers.py (+1/-1) tests/unit_tests/iolibs/test_misc.py (+1/-1) tests/unit_tests/various/test_4fermion_models.py (+7/-3) tests/unit_tests/various/test_aloha.py (+509/-30) tests/unit_tests/various/test_model_reader.py (+2/-2) |
To merge this branch: | bzr merge lp:~maddevelopers/mg5amcnlo/1.4.3 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Johan Alwall (community) | Approve | ||
Olivier Mattelaer | Approve | ||
Pierre Artoisenet | Pending | ||
Review via email: mp+95286@code.launchpad.net |
Commit message
Description of the change
This version, corrects multiple bugs linked to the cluster
- allow failure to respond from the cluster (up to 5 times)
- fix the problem which blocks Delphes to be runned on the cluster.
The rest is explained in the Updates Notes or the log of the revisions.
Olivier Mattelaer (olivier-mattelaer) wrote : | # |
Olivier Mattelaer (olivier-mattelaer) wrote : | # |
Pierre send me an email with the following:
./tests/
.......
=======
FAIL: test that python writer works
-------
Traceback (most recent call last):
File "/localstore/
self.
Johan do you have the same error?
Olivier Mattelaer (olivier-mattelaer) wrote : | # |
Ok I reproduced it (So I will be able to solve it).
This is a problem specific to python2.6, the test is fine with python2.7.
Thanks a lot Pierre for pointing this to me.
Cheers,
Olivier
Olivier Mattelaer (olivier-mattelaer) wrote : | # |
ok this was simply that python 2.6 writes the complexx number i like
1j
amd python 2.7
(-0+1j)
Since I was comparing the strings....
Johan Alwall (johan-alwall) wrote : | # |
Hi Olivier,
Thanks for your comments and questions!
> First, concerning the $$ syntax.
> 1) First the selection is done at the end of the generation.
> Wouldn't be more efficient to do it on the flight?
That might be the case, but I'm not sure, since if I do it on the flight, I will check many more vertices than the ones that end up in the diagrams (before checking). Since this check takes non-negligible time, I'm not sure it's more efficient that way.
> 2) looks like you have two times the line
> dollar = line.find("$")
> in cmd_interface
Thanks.
> 3) you remove the load from the test,
> I aggree that this test is often annoying, but shouldn't be better to keep it
> in order to ensure that this function is working correctly. (Or we can also
> remove this functions)
It's indeed quite annoying, and quite useless. I would suggest to have a dedicated test for it, by both saving and loading a process in the same test.
> 4) You also ask me about, every configuration not set in an automaitc way:
> and you have this one (which might be cross in extreme cases):
> ./Source/
> ./Source/
> ./Source/
> ./Source/
> ./Source/
> ./Source/
>
> I also found:
> ./iolibs/
> (maxsubprocesse
> But this one is less critical (even if I receive an email of someone with 2600
> subprocesses...
> but python failed to do the refine in that cases --I think that I solve the
> python problem, but maybe not...)
Ok, I'll look into this. Thanks.
> 5) Do you plan to put the change for ALOHA in this version, or do you want to
> wait the next one.
> (Except for spin 3/2 this is not urgent at all)
I would perhaps wait for next time, also because spin 3/2 is a big enough inclusion to merit its own version number.
> Cheers, and thanks for this very good work,
Thanks to you, both for your great work with this version and for the careful revision.
Johan
Olivier Mattelaer (olivier-mattelaer) wrote : | # |
Hi Johan,
> > First, concerning the $$ syntax.
> > 1) First the selection is done at the end of the generation.
> > Wouldn't be more efficient to do it on the flight?
>
> That might be the case, but I'm not sure, since if I do it on the flight, I
> will check many more vertices than the ones that end up in the diagrams
> (before checking). Since this check takes non-negligible time, I'm not sure
> it's more efficient that way.
Yes I think you are right. So let's keep it like that.
> > 3) you remove the load from the test,
> > I aggree that this test is often annoying, but shouldn't be better to keep
> it
> > in order to ensure that this function is working correctly. (Or we can also
> > remove this functions)
>
> It's indeed quite annoying, and quite useless. I would suggest to have a
> dedicated test for it, by both saving and loading a process in the same test.
Ok will add a specific test for this.
> > 5) Do you plan to put the change for ALOHA in this version, or do you want
> to
> > wait the next one.
> > (Except for spin 3/2 this is not urgent at all)
>
> I would perhaps wait for next time, also because spin 3/2 is a big enough
> inclusion to merit its own version number.
Ok I aggree. What do you think to have a 1.5.0 release
including
a) spin 3/2
b) complex mass scheme
c) Feynman gauge
Those three branch are all very close for an official release.
Thanks,
Olivier
Johan Alwall (johan-alwall) wrote : | # |
Hi Olivier,
> 4) You also ask me about, every configuration not set in an automaitc way:
> and you have this one (which might be cross in extreme cases):
> ./Source/
> ./Source/
> ./Source/
> ./Source/
> ./Source/
> ./Source/
This was a pure oversight, thanks for that. max_amps should have been changed to lmaxconfigs. It's done now.
> I also found:
> ./iolibs/
> (maxsubprocesse
In fact this has no impact since it's the argument of a subroutine. The limit is 9999 subprocesses, which should be big enough anyway, so I don't bother to change it for now at least.
> Ok I aggree. What do you think to have a 1.5.0 release
> including
> a) spin 3/2
> b) complex mass scheme
> c) Feynman gauge
>
> Those three branch are all very close for an official release.
Wow that's really cool. Indeed let's do that!
Cheers,
Johan
Olivier Mattelaer (olivier-mattelaer) wrote : | # |
Thanks for your modifications Johan.
Could we try to have your review for tomorrow? and the final approval for the next day.
Some people ask to have delphes running on the cluster (or simply the jpg on uiuc) and both fix are present in this version.
Thanks in advance,
Olivier
Johan Alwall (johan-alwall) wrote : | # |
Hello Olivier,
Very impressive, and very nice that you have included a large number of new tests for ALOHA. Great, great job!
My only further comments is if you could include the change in the ALOHA definition in the UpdateNotes? It looks to me like you have changed so _1 always corresponds to inflowing and _2 outflowing fermion, right? It also looks like (some of?) the spin-3/2 modifications are there. If we want to wait with these for 1.5, perhaps remove them from here.
I might come up with new requests (in terms of user interface/web pages) while I work more with this version, but in that case we can take it in a future version. This is already a great improvement in many ways and a very rigorous work.
Many thanks!
Johan
Olivier Mattelaer (olivier-mattelaer) wrote : | # |
Hi Johan,
Thanks a lot for your review.
> My only further comments is if you could include the change in the
> ALOHA definition in the UpdateNotes? It looks to me like you have
> changed so _1 always corresponds to inflowing and _2 outflowing
> fermion, right?
Ohhhh shit... Should have done this merge by mistake.
But in some sense this makes more sense to include it since
- change Epsilon convention
- Force the argument to be in Incoming/outcoming order for _0 (Even in
case of conjugate)
(This fix one bug if they are fermion momentum in the Lorentz
expression)
was already included.
So I will run all parralel tests for the check, and cross-check
modifications done in spin3/2 for that inclusion. To be 100% sure that
everything is fine.
An I will detailled the aloha changes in the UpdateNotes.
> It also looks like (some of?) the spin-3/2 modifications are there.
> If we want to wait with these for 1.5, perhaps remove them from here.
In fact the merged modifications seems to be aloha_new_
the specific modifications for spin 3/2 (not the debugging modif) are
not included.
Cheers,
Olivier
On Mar 7, 2012, at 3:15 AM, Johan Alwall wrote:
> Review: Approve
>
> Hello Olivier,
>
> Very impressive, and very nice that you have included a large number
> of new tests for ALOHA. Great, great job!
>
> My only further comments is if you could include the change in the
> ALOHA definition in the UpdateNotes? It looks to me like you have
> changed so _1 always corresponds to inflowing and _2 outflowing
> fermion, right? It also looks like (some of?) the spin-3/2
> modifications are there. If we want to wait with these for 1.5,
> perhaps remove them from here.
>
> I might come up with new requests (in terms of user interface/web
> pages) while I work more with this version, but in that case we can
> take it in a future version. This is already a great improvement in
> many ways and a very rigorous work.
>
> Many thanks!
> Johan
> --
> https:/
> You proposed lp:~maddevelopers/madgraph5/1.4.3 for merging.
Olivier Mattelaer (olivier-mattelaer) wrote : | # |
The re-run of the parralel test provides few error:
=======
FAIL: test_mg5_mssm_22 (tests.
Test a semi-complete list of mssm 2->2 processes
-------
AssertionError: '
Failed for processes:\n
a a > x1- x2+ 1.9918958496e-34 4.7490497800e-41 9.9999952316e-01 \n
a a > x1+ x2- 1.9918958496e-34 4.7490497800e-41 9.9999952316e-01 '
!= 'Failed for processes:'
=======
FAIL: test_mg5_mssm_23_p2 (tests.
Test a semi-complete list of mssm 2->3 processes
-------
AssertionError: 'Failed for processes:\n
a a > a x1- x2+ 1.8410268017e-40 4.3893499400e-47 9.9999952316e-01 \n
a a > a x1+ x2- 1.8401745086e-40 4.3873179200e-47 9.9999952316e-01 \n
a a > a x2- x1+ 1.9670095850e-40 4.6897163000e-47 9.9999952316e-01 \n
a a > a x2+ x1- 1.9662593729e-40 4.6879276600e-47 9.9999952316e-01 '
!= 'Failed for processes:'
In a similar point, they are some error in the checks:
a a > a x1+ x1- 3.3518802892e-07 1.3892395543e-22 4.1446574293e-16 Passed
a a > a x1+ x2- 1.4882175885e-37 1.3577052143e-40 9.1230289498e-04 Failed
JAMP 0 5.9528703538e-37 5.4308208572e-40 9.1230289498e-04 Failed
a a > a x2+ x1- 2.7545076962e-39 2.4103023528e-40 8.7503925151e-02 Failed
JAMP 0 1.1018030785e-38 9.6412094111e-40 8.7503925151e-02 Failed
a a > a x2+ x2- 1.5949968107e-07 3.0519707826e-21 1.9134651319e-14 Passed
JAMP 0 6.3799872426e-07 1.2207883131e-20 1.9134651319e-14 Failed
Summary: 1/4 passed, 3/4 failed
Failed processes: a a > a x1+ x2-, a a > a x2+ x1-, a a > a x2+ x2-
Lorentz invariance results:
Process Min element Max element Relative diff. Result
a a > a x1+ x1- 1.7972253047e-07 1.7972253047e-07 1.0162414182e-14 Passed
a a > a x1+ x2- 1.9214323028e-39 2.2795442342e-39 1.5709804008e-01 Failed
JAMP 0 7.6857292110e-39 9.1181769369e-39 1.5709804008e-01 Failed
a a > a x2+ x1- 8.9135903783e-40 9.5437851692e-40 6.6031954797e-02 Failed
JAMP 0 3.5654361513e-39 3.8175140677e-39 6.6031954797e-02 Failed
a a > a x2+ x2- 1.2699686784e-07 1.2699686784e-07 8.1287154717e-15 Passed
Summary: 2/4 passed, 2/4 failed
Failed processes: a a > a x1+ x2-, a a > a x2+ x1-
Process permutation results:
Process Min element Max element Relative diff. Result
a a > a x1+ x1- 1.4588924268e-07 1.4588924268e-07 0.0000000000e+00 Passed
a a > a x1+ x2- 8.6091343492e-40 8.6091343492e-40 3.7897564397e-16 Passed
a a > a x2+ x1- 3.8434943924e-38 3.8434943924e-38 2.7164049386e-16 Passed
a a > a x2+ x2- 2.0721671782e-07 2.0721671782e-07 1.2773959495e-16 Passed
But the absolute value is very small, due to a a x1+ x2- coupling at
-1.38777878078e
the restrict_card but which is not (since this is not exactly zero).
Therefore this is probably simply a numerical problem.
So I'm adding a thresho...
Johan Alwall (johan-alwall) wrote : | # |
Hello Olivier,
> Failed for processes:\n
> a a > x1- x2+ 1.9918958496e-34 4.7490497800e-41 9.9999952316e-01 \n
> a a > x1+ x2- 1.9918958496e-34 4.7490497800e-41 9.9999952316e-01 '
> AssertionError: 'Failed for processes:\n
> a a > a x1- x2+ 1.8410268017e-40 4.3893499400e-47 9.9999952316e-01 \n
> a a > a x1+ x2- 1.8401745086e-40 4.3873179200e-47 9.9999952316e-01 \n
> a a > a x2- x1+ 1.9670095850e-40 4.6897163000e-47 9.9999952316e-01 \n
> a a > a x2+ x1- 1.9662593729e-40 4.6879276600e-47 9.9999952316e-01 '
>
> In a similar point, they are some error in the checks:
> a a > a x1+ x1- 3.3518802892e-07 1.3892395543e-22 4.1446574293e-16 Passed
> a a > a x1+ x2- 1.4882175885e-37 1.3577052143e-40 9.1230289498e-04 Failed
> JAMP 0 5.9528703538e-37 5.4308208572e-40 9.1230289498e-04 Failed
> a a > a x2+ x1- 2.7545076962e-39 2.4103023528e-40 8.7503925151e-02 Failed
> JAMP 0 1.1018030785e-38 9.6412094111e-40 8.7503925151e-02 Failed
> a a > a x2+ x2- 1.5949968107e-07 3.0519707826e-21 1.9134651319e-14 Passed
> JAMP 0 6.3799872426e-07 1.2207883131e-20 1.9134651319e-14 Failed
> Summary: 1/4 passed, 3/4 failed
> Failed processes: a a > a x1+ x2-, a a > a x2+ x1-, a a > a x2+ x2-
> Lorentz invariance results:
> Process Min element Max element Relative diff. Result
> a a > a x1+ x1- 1.7972253047e-07 1.7972253047e-07 1.0162414182e-14 Passed
> a a > a x1+ x2- 1.9214323028e-39 2.2795442342e-39 1.5709804008e-01 Failed
> JAMP 0 7.6857292110e-39 9.1181769369e-39 1.5709804008e-01 Failed
> a a > a x2+ x1- 8.9135903783e-40 9.5437851692e-40 6.6031954797e-02 Failed
> JAMP 0 3.5654361513e-39 3.8175140677e-39 6.6031954797e-02 Failed
> a a > a x2+ x2- 1.2699686784e-07 1.2699686784e-07 8.1287154717e-15 Passed
> Summary: 2/4 passed, 2/4 failed
> Failed processes: a a > a x1+ x2-, a a > a x2+ x1-
> But the absolute value is very small, due to a a x1+ x2- coupling at
> -1.38777878078e
> the restrict_card but which is not (since this is not exactly zero).
> Therefore this is probably simply a numerical problem.
> So I'm adding a threshold and restart the procedure. Do you aggree with that?
I'm not sure, this might be an indication of the same problem I see with the effective diquark model from Claude. You can try increasing the coupling and see if the problem goes away. In any case, x1x2 couplings is the only place in the MSSM where we would expect to be able to see those problems, since they are the only new non-Majorana fermions, and we can only see it where you have two different fermions in a vertex. So I would not write this off without further investigation. It's up to you if you want to release this already now (knowing that we might have a bug here, but which only matters in such very particular circumstances), or wait with all the ALOHA modification for 1.5.0.
Cheers,
Johan
- 206. By mattelaer-olivier
-
pass to version 1.4.3
Preview Diff
1 | === removed file 'Template/Source/banner.f' |
2 | --- Template/Source/banner.f 2010-10-30 03:26:37 +0000 |
3 | +++ Template/Source/banner.f 1970-01-01 00:00:00 +0000 |
4 | @@ -1,120 +0,0 @@ |
5 | - subroutine create_banner(lunw, swgt, nw) |
6 | - implicit none |
7 | -c include 'nexternal.inc' |
8 | -c |
9 | -c parameters |
10 | -c |
11 | - integer MaxParticles |
12 | - parameter (MaxParticles=15) |
13 | -c |
14 | -c Arguments |
15 | -c |
16 | - integer lunw, nw |
17 | - double precision swgt(99999) |
18 | -c |
19 | -c Local |
20 | -c |
21 | - integer ic(7,MaxParticles),next, luni |
22 | - double precision P(0:3,MaxParticles),wgt |
23 | - real*8 sum,mxwgt |
24 | - logical done |
25 | - integer i,imax,j, nevent, nfound |
26 | - character*35 infile,outfile |
27 | - integer iseed |
28 | - data iseed/9999/ |
29 | - character*30 process,QED,QCD |
30 | -c--cuts |
31 | -c double precision etmin(3:nexternal),etamax(3:nexternal) |
32 | -c double precision r2min(3:nexternal,3:nexternal) |
33 | -c double precision s_min(nexternal,nexternal) |
34 | -c common/to_cuts/ etmin ,etamax , r2min, s_min |
35 | -c |
36 | -c open the Process/input.dat |
37 | -c |
38 | - luni = 67 |
39 | - infile='Process/input.dat' |
40 | - i=0 |
41 | - done=.false. |
42 | - do while (.not. done .and. i .lt. 5) |
43 | -c write(*,*) 'Attempting to open file ',infile |
44 | - open(unit=luni,file=infile,status='old',err=101) |
45 | - done = .true. |
46 | - 101 i = i+1 |
47 | - infile='../' // infile |
48 | - enddo |
49 | - if (done) then |
50 | - read(luni,'(a30)') process |
51 | - read(luni,'(a30)') QCD |
52 | - read(luni,'(a30)') QED |
53 | - close(luni) |
54 | - else |
55 | - process = '???? Process' |
56 | - QCD = '???? QCD' |
57 | - QED = '???? QED' |
58 | - endif |
59 | - |
60 | -c call get_seed(iseed) |
61 | -c |
62 | -c All the info is gathered. Now start writing it out. |
63 | -c |
64 | - |
65 | - call write_para(lunw) |
66 | - write(lunw,'(a70)') '## ' |
67 | - write(lunw,'(a70)') '##=================== ' |
68 | - write(lunw,'(a70)') '## Run-time options ' |
69 | - write(lunw,'(a70)') '##=================== ' |
70 | - write(lunw,'(a70)') '## ' |
71 | - write(lunw,'(a70)') '##********************************************************************' |
72 | - write(lunw,'(a70)') '## Random Number seed *' |
73 | - write(lunw,'(a70)') '##********************************************************************' |
74 | - write(lunw,'(a3,i8,a)') '## ',iseed,' = iseed' |
75 | -c write(lunw,'(a70)') '##********************************************************************' |
76 | -c write(lunw,'(a70)') '## Standard Cuts *' |
77 | -c write(lunw,'(a70)') '##********************************************************************' |
78 | -c write(lunw,'(a13,8i8)') '## Particle ',(i,i=3,nexternal) |
79 | -c write(lunw,'(a13,8f8.1)') '## Et >',(etmin(i),i=3,nexternal) |
80 | -c write(lunw,'(a13,8f8.1)') '## Eta <',(etamax(i),i=3,nexternal) |
81 | -c do j=3,nexternal-1 |
82 | -c write(lunw,'(a,i2,a,8f8.1)') '## d R #',j,' >',(-0.0,i=3,j), |
83 | -c & (r2min(i,j),i=j+1,nexternal) |
84 | -c do i=j+1,nexternal |
85 | -c r2min(i,j)=r2min(i,j)**2 !Since r2 returns distance squared |
86 | -c enddo |
87 | -c enddo |
88 | -c do j=1,nexternal-1 |
89 | -c write(lunw,'(a,i2,a,8f8.1)') '## s min #',j,'>', |
90 | -c & (s_min(i,j),i=3,nexternal) |
91 | -c enddo |
92 | -c write(lunw,'(a70)') '##********************************************************************' |
93 | -c |
94 | -c Now write out specific information on the event set |
95 | -c |
96 | - done=.false. |
97 | - nevent=0 |
98 | - nfound=0 |
99 | - sum=0d0 |
100 | - mxwgt=-1d0 |
101 | - do i=1,nw |
102 | - sum=sum+swgt(i) |
103 | - mxwgt = max(swgt(i),mxwgt) |
104 | - enddo |
105 | - nevent = nw |
106 | - write(lunw,'(a70)') '## ' |
107 | - write(lunw,'(a70)') '##=================== ' |
108 | - write(lunw,'(a70)') '## Event information ' |
109 | - write(lunw,'(a70)') '##=================== ' |
110 | - write(lunw,'(a70)') '## ' |
111 | - write(lunw,'(a70)') '##********************************************************************' |
112 | - write(lunw,'(a12,a30)') '## Process: ',process |
113 | - write(lunw,'(a12,a30)') '## Max QCD: ',QCD |
114 | - write(lunw,'(a12,a30)') '## Max QED: ',QED |
115 | - write(lunw,'(a70)') '##********************************************************************' |
116 | - write(lunw,'(a30,i10)') '## Number of Events : ',nevent |
117 | - write(lunw,'(a30,e10.5)') '## Integrated weight (pb) : ',sum |
118 | - write(lunw,'(a30,e10.5)') '## Max wgt : ',mxwgt |
119 | - write(lunw,'(a30,e10.5)') '## Average wgt : ',sum/nevent |
120 | - write(lunw,'(a70)') '##********************************************************************' |
121 | - |
122 | -c close(lunw) |
123 | - |
124 | - end |
125 | |
126 | === modified file 'Template/Source/gen_ximprove.f' |
127 | --- Template/Source/gen_ximprove.f 2012-01-30 12:00:54 +0000 |
128 | +++ Template/Source/gen_ximprove.f 2012-03-08 17:31:22 +0000 |
129 | @@ -11,11 +11,10 @@ |
130 | parameter (rfile='results.dat') |
131 | character*(*) symfile |
132 | parameter (symfile='symfact.dat') |
133 | - integer max_amps |
134 | - parameter (max_amps=9999) |
135 | |
136 | include 'run_config.inc' |
137 | include 'maxparticles.inc' |
138 | + include 'maxconfigs.inc' |
139 | c |
140 | c global |
141 | c |
142 | @@ -25,19 +24,19 @@ |
143 | c |
144 | c local |
145 | c |
146 | - double precision xsec(max_amps), xerr(max_amps) |
147 | - double precision xerru(max_amps),xerrc(max_amps) |
148 | - double precision xmax(max_amps), eff(max_amps) |
149 | - double precision xlum(max_amps) |
150 | + double precision xsec(lmaxconfigs), xerr(lmaxconfigs) |
151 | + double precision xerru(lmaxconfigs),xerrc(lmaxconfigs) |
152 | + double precision xmax(lmaxconfigs), eff(lmaxconfigs) |
153 | + double precision xlum(lmaxconfigs) |
154 | double precision ysec, yerr, yeff, ymax |
155 | double precision tsec, terr, teff, tmax, xi |
156 | - integer nw(max_amps), nevents(max_amps), maxit |
157 | - integer nunwgt(max_amps) |
158 | - character*80 fname, gname(max_amps) |
159 | + integer nw(lmaxconfigs), nevents(lmaxconfigs), maxit |
160 | + integer nunwgt(lmaxconfigs) |
161 | + character*80 fname, gname(lmaxconfigs) |
162 | integer i,j,k,l,n,ipp |
163 | double precision xtot,errtot,err_goal |
164 | double precision errtotu,errtotc |
165 | - integer mfact(max_amps) |
166 | + integer mfact(lmaxconfigs) |
167 | logical parallel, gen_events |
168 | character*20 param(maxpara),value(maxpara) |
169 | integer npara, nreq, ngran, nhel_refine |
170 | @@ -225,8 +224,8 @@ |
171 | c Constants |
172 | c |
173 | include 'run_config.inc' |
174 | - integer max_amps |
175 | - parameter (max_amps=9999) |
176 | + include 'maxconfigs.inc' |
177 | + |
178 | c integer max_np |
179 | c parameter (max_np = 30) |
180 | c |
181 | @@ -237,16 +236,16 @@ |
182 | c |
183 | c Arguments |
184 | c |
185 | - double precision xsec(max_amps), xerru(max_amps),xerrc(max_amps) |
186 | + double precision xsec(lmaxconfigs), xerru(lmaxconfigs),xerrc(lmaxconfigs) |
187 | double precision err_goal,xtot |
188 | - integer mfact(max_amps),jpoints(max_amps),nhel_refine |
189 | + integer mfact(lmaxconfigs),jpoints(lmaxconfigs),nhel_refine |
190 | integer ng |
191 | - character*(80) gn(max_amps) |
192 | + character*(80) gn(lmaxconfigs) |
193 | c |
194 | c Local |
195 | c |
196 | - integer i,j,k, io(max_amps), npoints, ip, np |
197 | - double precision xt(max_amps),elimit |
198 | + integer i,j,k, io(lmaxconfigs), npoints, ip, np |
199 | + double precision xt(lmaxconfigs),elimit |
200 | double precision yerr,ysec,rerr |
201 | logical fopened |
202 | c----- |
203 | @@ -474,8 +473,7 @@ |
204 | c Constants |
205 | c |
206 | include 'run_config.inc' |
207 | - integer max_amps |
208 | - parameter (max_amps=9999) |
209 | + include 'maxconfigs.inc' |
210 | c |
211 | c global |
212 | c |
213 | @@ -487,16 +485,16 @@ |
214 | c |
215 | c Arguments |
216 | c |
217 | - double precision goal_lum, xlum(max_amps), xsec(max_amps),xtot |
218 | - double precision xerr(max_amps) |
219 | - integer jpoints(max_amps), mfact(max_amps) |
220 | + double precision goal_lum, xlum(lmaxconfigs), xsec(lmaxconfigs),xtot |
221 | + double precision xerr(lmaxconfigs) |
222 | + integer jpoints(lmaxconfigs), mfact(lmaxconfigs) |
223 | integer ng, np, nhel_refine |
224 | - character*(80) gn(max_amps) |
225 | + character*(80) gn(lmaxconfigs) |
226 | c |
227 | c Local |
228 | c |
229 | - integer i,j,k,kk, io(max_amps), npoints, ip, nfiles,ifile,npfile |
230 | - double precision xt(max_amps),elimit |
231 | + integer i,j,k,kk, io(lmaxconfigs), npoints, ip, nfiles,ifile,npfile |
232 | + double precision xt(lmaxconfigs+1),elimit |
233 | double precision yerr,ysec,rerr |
234 | logical fopened |
235 | character*26 cjobs |
236 | @@ -738,8 +736,7 @@ |
237 | c Constants |
238 | c |
239 | include 'run_config.inc' |
240 | - integer max_amps |
241 | - parameter (max_amps=9999) |
242 | + include 'maxconfigs.inc' |
243 | c |
244 | c global |
245 | c |
246 | @@ -748,16 +745,16 @@ |
247 | c |
248 | c Arguments |
249 | c |
250 | - double precision goal_lum, xlum(max_amps), xsec(max_amps),xtot |
251 | + double precision goal_lum, xlum(lmaxconfigs), xsec(lmaxconfigs),xtot |
252 | double precision ngran !Granularity.... min # points from channel |
253 | - integer jpoints(max_amps), mfact(max_amps) |
254 | + integer jpoints(lmaxconfigs), mfact(lmaxconfigs) |
255 | integer ng, np, nhel_refine |
256 | - character*(80) gn(max_amps) |
257 | + character*(80) gn(lmaxconfigs) |
258 | c |
259 | c Local |
260 | c |
261 | integer i,j,k, npoints, ip |
262 | - double precision xt(max_amps),elimit |
263 | + double precision xt(lmaxconfigs),elimit |
264 | double precision yerr,ysec,rerr |
265 | character*72 fname |
266 | logical fopened |
267 | |
268 | === removed file 'Template/Source/maxconfigs.inc' |
269 | --- Template/Source/maxconfigs.inc 2011-04-03 22:11:58 +0000 |
270 | +++ Template/Source/maxconfigs.inc 1970-01-01 00:00:00 +0000 |
271 | @@ -1,2 +0,0 @@ |
272 | - integer lmaxconfigs |
273 | - parameter (lmaxconfigs=4000) !Used for iforest |
274 | |
275 | === removed file 'Template/Source/maxparticles.inc' |
276 | --- Template/Source/maxparticles.inc 2011-04-16 05:25:14 +0000 |
277 | +++ Template/Source/maxparticles.inc 1970-01-01 00:00:00 +0000 |
278 | @@ -1,2 +0,0 @@ |
279 | - integer max_particles |
280 | - parameter (max_particles=10) |
281 | |
282 | === removed file 'Template/Source/sum.f' |
283 | --- Template/Source/sum.f 2010-10-30 03:26:37 +0000 |
284 | +++ Template/Source/sum.f 1970-01-01 00:00:00 +0000 |
285 | @@ -1,55 +0,0 @@ |
286 | - program sum |
287 | -c******************************************************************************** |
288 | -c Program to combine results from all of the different sub amplitudes |
289 | -c and given total |
290 | -c cross section and error. |
291 | -c***************************************************************************** |
292 | - implicit none |
293 | -c |
294 | -c Constants |
295 | -c |
296 | - character*(*) rfile |
297 | - parameter (rfile='result') |
298 | - character*(*) symfile |
299 | - parameter (symfile='symfact.dat') |
300 | - integer max_amps |
301 | - parameter (max_amps=999) |
302 | -c |
303 | -c local |
304 | -c |
305 | - double precision xsec(max_amps), xerr(max_amps) |
306 | - character*80 fname |
307 | - integer i,j |
308 | - double precision xtot,errtot |
309 | -c----- |
310 | -c Begin Code |
311 | -c----- |
312 | - xtot=0d0 |
313 | - errtot=0d0 |
314 | - open(unit=15,file=symfile,status='old',err=999) |
315 | - do while (.true.) |
316 | - read(15,*,err=99) i,j |
317 | - if (j .gt. 0) then |
318 | - if (i .lt. 10) then |
319 | - write(fname,'(a,i1,a,a)') 'G',i,'/',rfile |
320 | -c write(*,*) fname |
321 | - else if (i .lt. 100) then |
322 | - write(fname,'(a,i2,a,a)') 'G',i,'/',rfile |
323 | -c write(*,*) fname |
324 | - else if (i .lt. 1000) then |
325 | - write(fname,'(a,i3,a,a)') 'G',i,'/',rfile |
326 | -c write(*,*) fname |
327 | - endif |
328 | - open(unit=25,file=fname,status='old',err=95) |
329 | - read(25,*) xsec(i), xerr(i) |
330 | - xtot = xtot+xsec(i)*j |
331 | - errtot=errtot+j*xerr(i)**2 |
332 | - write(*,'(2i4,2e12.4)') i,j, xsec(i),xerr(i) |
333 | - 95 close(25) |
334 | - endif |
335 | - enddo |
336 | - 99 write(*,*) 'done',xtot,sqrt(errtot) |
337 | - close(15) |
338 | - stop |
339 | - 999 write(*,*) 'error' |
340 | - end |
341 | |
342 | === removed file 'Template/Source/sum_html.f' |
343 | --- Template/Source/sum_html.f 2011-05-29 07:23:58 +0000 |
344 | +++ Template/Source/sum_html.f 1970-01-01 00:00:00 +0000 |
345 | @@ -1,775 +0,0 @@ |
346 | - program sum_html |
347 | -c***************************************************************************** |
348 | -c Program to combine results from all of the different sub amplitudes |
349 | -c and given total cross section and error. |
350 | -c***************************************************************************** |
351 | - implicit none |
352 | -c |
353 | -c Constants |
354 | -c |
355 | - include 'maxparticles.inc' |
356 | - character*(*) subfile |
357 | - parameter (subfile='subproc.mg') |
358 | - character*(*) symfile |
359 | - parameter (symfile='symfact.dat') |
360 | - character*(*) rfile |
361 | - parameter (rfile='results.dat') |
362 | - integer max_amps , max_iter |
363 | - parameter (max_amps=9999, max_iter=50) |
364 | -c |
365 | -c local |
366 | -c |
367 | - double precision xsec(max_amps), xerr(max_amps) |
368 | - double precision xerru(max_amps),xerrc(max_amps) |
369 | - double precision xmax(max_amps), eff(max_amps) |
370 | - double precision xlum(max_amps), xlum_min |
371 | - double precision ysec_iter(0:max_iter) |
372 | - double precision yerr_iter(0:max_iter) |
373 | - double precision tsec_iter(0:max_iter) |
374 | - double precision terr_iter(0:max_iter) |
375 | - double precision f(0:max_iter) |
376 | - double precision ysec, yerr, yeff, ymax |
377 | - double precision tsec, terr, teff, tmax |
378 | - double precision tmean, tsig, chi2 |
379 | - integer nw(max_amps), nevents(max_amps), maxit |
380 | - integer icor(max_amps) |
381 | - integer nunwgt(max_amps) |
382 | - integer minit |
383 | - character*300 fname, pname |
384 | - character*320 linkname(max_amps) |
385 | - integer i,j,k,l |
386 | - double precision xtot,errtot,err_goal, xi |
387 | - double precision errtotc, errtotu |
388 | - logical correlated |
389 | - integer mfact(max_amps) |
390 | - integer ntevents, ntw |
391 | - integer ilen |
392 | - logical errex |
393 | - integer ncode,npos |
394 | - character*20 formstr |
395 | - |
396 | - logical sumproc |
397 | - common/to_sumproc/sumproc |
398 | -c----- |
399 | -c Begin Code |
400 | -c----- |
401 | - correlated = .true. |
402 | - minit = max_iter |
403 | - do i=0,max_iter |
404 | - tsec_iter(i)=0d0 |
405 | - terr_iter(i)=0d0 |
406 | - enddo |
407 | - sumproc = .true. |
408 | - open(unit=15,file=symfile,status='old',err=10) |
409 | - sumproc=.false. |
410 | - 10 if (sumproc) then |
411 | - open(unit=15,file=subfile,status='old',err=999) |
412 | - endif |
413 | - errtot=0d0 |
414 | - errtotu=0d0 !uncorrelated errors |
415 | - errtotc=0d0 !correlated errors |
416 | - xtot = 0d0 |
417 | - xlum_min = 1d99 |
418 | - ntevents = 0 |
419 | - ntw = 0 |
420 | - i = 0 |
421 | -c ncode is number of digits needed for the bw coding |
422 | - ncode=int(dlog10(3d0)*(max_particles-3))+1 |
423 | - do while (.true.) |
424 | - if (sumproc) then |
425 | - j = 1 |
426 | - read(15,*,err=99,end=99) pname |
427 | - i=i+1 |
428 | - ilen = index(pname,' ')-1 |
429 | -c write(*,*) 'found ilen',ilen,pname |
430 | - write(fname,'(a,a,a)') pname(1:ilen),'/',rfile |
431 | - write(linkname(i),'(a,a,a)')pname(1:ilen),'/','results.html' |
432 | -c write(*,*) i,'found ilen',ilen,fname(1:ilen+10) |
433 | - else |
434 | - read(15,*,err=99,end=99) xi,j |
435 | - if (j .gt. 0) then |
436 | - i=i+1 |
437 | - k = int(xi*(1+10**(-ncode))) |
438 | - npos=int(dlog10(dble(k)))+1 |
439 | - if ( (xi-k) .eq. 0) then |
440 | -c Write with correct number of digits |
441 | - write(formstr,'(a,i1,a)') '(a,i',npos,',a,a)' |
442 | - write(fname, formstr) 'G',k,'/',rfile |
443 | - write(linkname(i),formstr) 'G',k,'/','log.txt' |
444 | - else !Handle B.W. |
445 | -c Write with correct number of digits |
446 | - write(formstr,'(a,i1,a,i1,a)') '(a,f',npos+ncode+1, |
447 | - $ '.',ncode,',a,a)' |
448 | - write(fname, formstr) 'G',xi,'/',rfile |
449 | - write(linkname(i),formstr) 'G',xi,'/','log.txt' |
450 | - endif |
451 | -c write(*,*) 'log name ',fname |
452 | - endif |
453 | - endif |
454 | - |
455 | - |
456 | - if (j .gt. 0) then |
457 | - nevents(i)=0d0 |
458 | - xsec(i)=0d0 |
459 | - xerr(i)=0d0 |
460 | - xerru(i)=0d0 |
461 | - xerrc(i)=0d0 |
462 | - nw(i) =0d0 |
463 | - mfact(i)=j |
464 | -c |
465 | -c Read in integration data from run |
466 | -c |
467 | - open(unit=25,file=fname,status='old',err=95) |
468 | - read(25,*) xsec(i),xerru(i),xerrc(i),nevents(i),nw(i) |
469 | - $ ,maxit,nunwgt(i),xlum(i) |
470 | - 11 xerr(i) = sqrt(xerru(i)**2+xerrc(i)**2) |
471 | - xlum(i)=xlum(i)/mfact(i) |
472 | - ntevents=ntevents+nevents(i) |
473 | - ntw=ntw+nw(i) |
474 | -c maxit = min(maxit,2) |
475 | - if (sumproc) then |
476 | - write(*,'(a,e15.5)') pname(2:ilen), xsec(i) |
477 | - else |
478 | - write(*,*) fname,i,xsec(i),mfact(i) |
479 | - endif |
480 | - tmax = -1d0 |
481 | - terr = 0d0 |
482 | - teff = 0d0 |
483 | - tsec = 0d0 |
484 | - if (.true.) then |
485 | - k = 0 |
486 | - ysec_iter(0) = xsec(i) |
487 | - do while ( k .le. maxit .and. ysec_iter(k) .gt. 0) |
488 | - k=k+1 |
489 | - read(25,*,err=92,end=92) l,ysec_iter(k),yerr_iter(k) |
490 | -c write(*,*) k,ysec_iter(k),yerr_iter(k) |
491 | - enddo |
492 | - 92 maxit = k-1 !In case of error reading file |
493 | - if (maxit .gt. 0) then |
494 | -c |
495 | -c Check to see if we need to reduce the number of iterations |
496 | -c |
497 | - if (maxit .lt. minit) then !need to reset minit |
498 | - do k=1,minit-maxit !and combine first iterations |
499 | - tsec_iter(1)=tsec_iter(1)+tsec_iter(k+1) |
500 | - terr_iter(1)=terr_iter(1)+terr_iter(k+1) |
501 | - enddo |
502 | - tsec_iter(1)=tsec_iter(1)/(minit-maxit+1) |
503 | - terr_iter(1)=terr_iter(1)/(minit-maxit+1) |
504 | - do k=2,maxit |
505 | - tsec_iter(k) = tsec_iter(k+maxit-1) |
506 | - terr_iter(k) = terr_iter(k+maxit-1) |
507 | - tsec_iter(k+maxit-1) = 0d0 |
508 | - terr_iter(k+maxit-1) = 0d0 |
509 | -c write(*,*) k+1,k+maxit |
510 | - enddo |
511 | - minit = maxit |
512 | - endif |
513 | -c |
514 | -c If this channel has more iterations, combine first few |
515 | -c together into 1 |
516 | -c |
517 | - if (maxit .gt. minit) then |
518 | - do k=1,maxit-minit |
519 | - ysec_iter(1)=ysec_iter(1)+ysec_iter(k+1) |
520 | - yerr_iter(1)=sqrt(yerr_iter(1)**2+yerr_iter(k+1)**2) |
521 | - enddo |
522 | - ysec_iter(1)=ysec_iter(1)/(maxit-minit+1) |
523 | - yerr_iter(1)=yerr_iter(1)/(maxit-minit+1) |
524 | - do k=2,minit |
525 | - ysec_iter(k) = ysec_iter(k+minit-1) |
526 | - yerr_iter(k) = yerr_iter(k+minit-1) |
527 | - ysec_iter(k+minit-1) = 0d0 |
528 | - yerr_iter(k+minit-1) = 0d0 |
529 | - enddo |
530 | - endif |
531 | -c |
532 | -c Now add these statistics to our totals for each iteration |
533 | -c |
534 | - do k=1,minit |
535 | - tsec_iter(k)=tsec_iter(k)+ysec_iter(k)*mfact(i) |
536 | - terr_iter(k)=terr_iter(k)+(yerr_iter(k)*mfact(i))**2 |
537 | -c write(*,*) k,ysec_iter(k),yerr_iter(k) |
538 | - enddo |
539 | - endif |
540 | -c if (maxit .gt. 0) then |
541 | -c xsec(i)=tsec/maxit |
542 | -c xerr(i)=sqrt(terr)/maxit |
543 | -c else |
544 | -c xsec(i)=0d0 |
545 | -c xerr(i)=0d0 |
546 | -c endif |
547 | - endif |
548 | - if (xsec(i) .gt. 0d0) then |
549 | - xlum_min = min(xlum(i),xlum_min) |
550 | - xmax(i)=tmax/xsec(i) |
551 | - eff(i)= xerr(i)*sqrt(real(nevents(i)))/xsec(i) |
552 | - else |
553 | - eff(i) = 0d0 |
554 | - endif |
555 | - xtot = xtot+ xsec(i)*mfact(i) |
556 | - errtot = errtot+(mfact(i)*xerr(i))**2 |
557 | -c |
558 | -c Combine error linearly if correlated, or in quadrature if not. |
559 | -c |
560 | - errtotc = errtotc+xerrc(i)*mfact(i) |
561 | - errtotu = errtotu + (mfact(i)*xerru(i))**2 |
562 | - write(*,*) i, sqrt(errtotu), errtotc |
563 | - |
564 | - if (xsec(i) .eq. 0d0) xsec(i)=1d-99 |
565 | - 95 close(25) |
566 | -c do k=1,minit |
567 | -c write(*,*) i,k,tsec_iter(k),sqrt(terr_iter(k)) |
568 | -c enddo |
569 | -c write(*,*) i,maxit,xsec(i), eff(i) |
570 | - endif |
571 | - enddo |
572 | - 99 close(15) |
573 | - errtot=sqrt(errtotu+errtotc**2) |
574 | -c if (sumproc) then |
575 | - open(unit=26,file=rfile,status='unknown') |
576 | - write(26,'(3e12.5,2i9,i5,i9,e10.3)') xtot,sqrt(errtotu), |
577 | - $ errtotc, ntw, minit,0,0,xlum_min |
578 | - if (xtot .gt. 0) then |
579 | - teff = sqrt(errtotc**2+errtotu**2)*sqrt(real(ntevents))/xtot |
580 | - else |
581 | - teff = 0d0 |
582 | - endif |
583 | -c write(26,*) minit, xtot,errtot, ntevents, teff |
584 | -c write(*,*) minit |
585 | - tmean = 0d0 |
586 | - tsig = 0d0 |
587 | - f(0) = 0d0 |
588 | - do j=1,minit |
589 | - f(j) = tsec_iter(j)**2/(terr_iter(j)+1d-99) |
590 | -c f(j)=1 |
591 | - tmean = tmean + tsec_iter(j)*f(j) |
592 | - tsig = tsig + terr_iter(j)*f(j) |
593 | - f(0)=f(0)+f(j) |
594 | -c write(*,*) 'Iteration',j,tmean/f(0),sqrt(tsig)/f(0) |
595 | - enddo |
596 | - if (f(0).gt.0d0) then |
597 | - tmean=tmean/f(0) |
598 | - tsig = sqrt(tsig/f(0)/minit) |
599 | - endif |
600 | - chi2 = 0d0 |
601 | - do j=1,minit |
602 | - chi2 = chi2+f(j)*minit* |
603 | - & (tsec_iter(j)-tmean)**2/(terr_iter(j)+1d-99)/(f(0)+1d-99) |
604 | - write(26,*)j,tsec_iter(j),sqrt(terr_iter(j)),chi2/max(1,j-1) |
605 | -c write(*,*) j,tsec_iter(j),sqrt(terr_iter(j)),chi2/max(1,j-1) |
606 | - enddo |
607 | - write(26,*) tmean,tsig,chi2/max((minit-1),1), |
608 | - & tsig*sqrt(real(ntevents))/(tmean+1d-99) |
609 | - write(*,*) 'Results', xtot,errtot, ntevents, teff |
610 | - close(26) |
611 | -c endif |
612 | - call write_html(xsec,xerr,eff,xmax,xtot,errtot,mfact,i,nevents, |
613 | - $ nunwgt,linkname,xlum) |
614 | - if(sumproc.and.xtot.eq.0d0)then |
615 | - open(unit=26,file='../error',status='unknown',err=999) |
616 | - write(*,'(a)') 'Cross section is 0, try loosening cuts' |
617 | - write(26,'(a)') 'Cross section is 0, try loosening cuts' |
618 | - close(26) |
619 | - stop |
620 | - else |
621 | - inquire(file="../error",exist=errex) |
622 | - if(errex) then |
623 | - call system ('rm -f ../error') |
624 | - endif |
625 | - endif |
626 | - stop |
627 | - 999 write(*,*) 'error' |
628 | - end |
629 | - |
630 | - |
631 | - subroutine write_html(xsec,xerr,eff,xmax,xtot,errtot,mfact,ng |
632 | - $ ,nevents,nw,linkname,xlum) |
633 | -c***************************************************************************** |
634 | -c Writes out HTML table of results for process |
635 | -c***************************************************************************** |
636 | - implicit none |
637 | -c |
638 | -c Constants |
639 | -c |
640 | - character*(*) eventfile |
641 | - parameter (eventfile='events.txt>') |
642 | - character*(*) logfile |
643 | - parameter (logfile='log.txt>') |
644 | - character*(*) htmfile |
645 | - parameter (htmfile='results.html') |
646 | - integer max_amps |
647 | - parameter (max_amps=9999) |
648 | -c |
649 | -c Arguments |
650 | -c |
651 | - double precision xsec(max_amps), xerr(max_amps) |
652 | - double precision xmax(max_amps), eff(max_amps),xlum(max_amps) |
653 | - integer ng, nevents(max_amps),nw(max_amps) |
654 | - double precision xtot,errtot |
655 | - integer mfact(max_amps) |
656 | - integer nsubproc !Number of specific processes requested |
657 | - logical found |
658 | - integer ig |
659 | - character*320 linkname(max_amps) |
660 | - integer sname(256) |
661 | - integer gname |
662 | -c |
663 | -c Local |
664 | -c |
665 | - integer i,j,k, io(max_amps), ik |
666 | - integer ntot, ip,jp |
667 | - character*300 procname |
668 | - character*4 cpref |
669 | - character*20 fnamel, fnamee |
670 | - double precision scale,xt(max_amps), teff |
671 | - double precision subtotal |
672 | - |
673 | - logical sumproc |
674 | - common/to_sumproc/sumproc |
675 | - |
676 | -c----- |
677 | -c Begin Code |
678 | -c----- |
679 | -c |
680 | -c Here we determine the appropriate units. Assuming the results |
681 | -c were written in picobarns |
682 | -c |
683 | - if (xtot .ge. 1e4) then !Use nano barns |
684 | - scale=1e-3 |
685 | - cpref='(nb)' |
686 | - elseif (xtot .ge. 1e1) then !Use pico barns |
687 | - scale=1e0 |
688 | - cpref='(pb)' |
689 | - elseif (xtot .ge. 1e-2) then !Use fempto |
690 | - scale=1e+3 |
691 | - cpref='(fb)' |
692 | - else !Use Attobarns |
693 | - scale=1e+6 |
694 | - cpref='(ab)' |
695 | - endif |
696 | - ntot = 0 |
697 | - do j=1,ng |
698 | - io(j) = j |
699 | - ntot = ntot+nevents(j) |
700 | - xt(j)=xsec(j)*mfact(j) !sort by xsec |
701 | -c xt(j)= xerr(j)*mfact(j) !sort by error |
702 | -c xt(j)=ng-j !sort by graph |
703 | -c write(*,*) j,xt(j),xsec(j) |
704 | - enddo |
705 | -c write(*,*) 'Number of channels',ng |
706 | - call sort2(xt,io,ng) |
707 | - |
708 | - do i=1,ng |
709 | - write(*,*) i,io(i),xsec(io(i)), nevents(j) |
710 | - enddo |
711 | - |
712 | - if (xtot .gt. 0d0) then |
713 | - teff = errtot*sqrt(real(ntot))/xtot |
714 | - else |
715 | - teff = 0d0 |
716 | - endif |
717 | -cfax 12.04.2006 |
718 | -c procname='Set caption in file input.dat' |
719 | - procname='Process results' |
720 | - ip = 1 |
721 | - jp = 30 |
722 | - open(unit=15, file='input.dat', status='old',err=11) |
723 | - read(15,'(a)',err=11,end=11) procname |
724 | - 11 close(15) |
725 | - open(unit=15, file='dname.mg', status='old',err=12) |
726 | - read(15,'(a)',err=12,end=12) procname |
727 | -cxx tjs 3-20-2006 |
728 | -c ip = index(procname,'P')+1 !Strip off first P |
729 | - ip = index(procname,'P')+1 !Strip off P |
730 | - ip = ip+index(procname(ip:),'_') !Strip off process number |
731 | - jp = ip+index(procname(ip:),' ') !Strip off blanks |
732 | - 12 close(15) |
733 | - open(unit=16,file=htmfile,status='unknown',err=999) |
734 | - write(16,50) '<head><title>'//procname(ip:jp)//'</title></head>' |
735 | - write(16,50) '<body>' |
736 | - if (.not. sumproc) then |
737 | -c write(16,50) '<h2>Results for <a href=diagrams.html>' |
738 | -c write(16,50) procname(ip:jp)//'</a></h2>' |
739 | - write(16,*) '<h2><a href=diagrams.html>'// |
740 | - & procname(ip:jp)// '</a> <BR>' |
741 | - write(16,*) '<font face=symbol>s</font>=' |
742 | - write(16,'(f8.3,a,f8.3,a)')xtot*scale, |
743 | - & '<font face=symbol>±</font> ', errtot*scale,cpref |
744 | - write(16,*) '</center></h2>' |
745 | - else |
746 | - write(16,*) '<h2>', procname(ip:jp)// " <BR>" |
747 | - write(16,*) '<font face=symbol>s</font>=' |
748 | - write(16,'(f8.3,a,f8.3,a)') xtot*scale, |
749 | - & '<font face=symbol>±</font> ', errtot*scale,cpref |
750 | - write(16,*) '</center></h2>' |
751 | - endif |
752 | -c |
753 | -c Now I want to write out information for each iteration |
754 | -c of the run |
755 | -c |
756 | -cfax 12-04-2006 |
757 | -c write(16,*) '<a href=results.dat> Iteration details </a>' |
758 | -c if (sumproc) write(16,*) '<p> <a href=../Events/plots.html> Plots </a>' |
759 | - |
760 | -c call gen_run_html(16) |
761 | -c |
762 | -c Next we'll get information on the cuts. This requires linking to |
763 | -c cuts.o and also coupsm.o |
764 | -c |
765 | -c call gen_cut_html(16) |
766 | - |
767 | - |
768 | - write(16,50) '<table border>' |
769 | -c write(16,50) '<Caption> Caption Results' |
770 | - write(16,49) '<tr><th>Graph</th>' |
771 | - write(16,48) '<th>Cross Sect',cpref,'</th><th>Error',cpref,'</th>' |
772 | - write(16,49) '<th>Events (K)</th><th>Eff</th>' |
773 | - write(16,50) '<th>Unwgt</th><th>Luminosity</th></tr>' |
774 | - |
775 | - write(16,60) '<tr><th>Sum</th><th>',xtot*scale |
776 | - $ ,'</th><th>',errtot*scale,'</th><th align=right>', |
777 | - $ ntot/1000,'</th><th align=right>',teff,'</th></tr>' |
778 | -c |
779 | -c Check number of requested processes |
780 | -c |
781 | - if (sumproc) then |
782 | - nsubproc=0 |
783 | - do i=1,ng |
784 | - procname = linkname(io(i))(:300) |
785 | - gname=0 |
786 | - read(procname(2:index(procname,'_')-1),*,err=20) gname |
787 | - 20 found = .false. |
788 | - j = 0 |
789 | - do while(j < nsubproc .and. .not. found) |
790 | - j=j+1 |
791 | - found = (gname .eq. sname(j)) |
792 | - enddo |
793 | - if (.not. found) then |
794 | - nsubproc=nsubproc+1 |
795 | - sname(nsubproc) = gname |
796 | -c write(*,*) i,nsubproc, " " , sname(nsubproc) |
797 | - endif |
798 | - enddo |
799 | -cfax 12.05.2006 |
800 | -c nsubproc=nsubproc-1 |
801 | - else |
802 | - nsubproc = 1 |
803 | - endif |
804 | -c |
805 | -c Now loop through all the subprocesses |
806 | -c |
807 | - subtotal=0d0 |
808 | - |
809 | - do ig = 1, nsubproc |
810 | - if (nsubproc .gt. 1) then |
811 | -cfax If added 12.05.2006 |
812 | -c if(sname(ig).ne.0) then |
813 | - write(16,*) '<tr> <td colspan="7" align="center"> Sub Group ',sname(ig), '</td></tr>' |
814 | -c endif |
815 | - endif |
816 | - do i=1,ng |
817 | -c write(*,*) i,io(i),xsec(io(i)) |
818 | - if(sumproc) |
819 | - $ read(linkname(io(i))(2:index(linkname(io(i)),'_')-1),*,err=30) gname |
820 | - 30 if ((.not. sumproc .and. xsec(io(i)) .ne. 0d0) .or. |
821 | - $ (sumproc .and. gname .eq. sname(ig))) then |
822 | -c write(*,*) ig," ",i," ",linkname(io(i))(:30)," ", sname(ig) |
823 | -c |
824 | -c Create directory names using the linkname |
825 | -c |
826 | -c |
827 | - ik = index(linkname(io(i)),'log.txt')-1 |
828 | - fnamel = linkname(io(i))(1:ik) // logfile |
829 | - fnamee = linkname(io(i))(1:ik) // eventfile |
830 | -c write(*,*) i,fnamel,fnamee |
831 | - if (.not. sumproc) then |
832 | - |
833 | -c write(16,65) '<tr><td align=right>',io(i), |
834 | - write(16,65) '<tr><td align=right>',linkname(io(i))(1:ik-1), |
835 | - $ ' </td><td align=right><a href='//linkname(io(i))//'>', |
836 | - $ xsec(io(i))*mfact(io(i))*scale |
837 | - $ ,'</a> </td><td align=right>', |
838 | - $ xerr(io(i))* |
839 | - $ mfact(io(i))*scale,'</td><td align=right>', |
840 | - $ nevents(io(i))/1000,'</td><td align=right>', |
841 | - $ eff(io(i)),'</td><td align=right>', |
842 | - $ nw(io(i)),'</td><td align=right>', |
843 | - $ xlum(io(i))/scale,'</td></tr>' |
844 | -c write(*,*) io(i),xmax(io(i)) |
845 | - else |
846 | - procname = linkname(io(i))(:300) |
847 | -cxx tjs 3-20-2006 + cfax 12.05.2006 |
848 | -c ip = index(procname,'P')+2 !Strip off first P_ |
849 | - ip = index(procname,'P')+1 !Strip off first P |
850 | - jp = ip+index(procname(ip:),'/')-2 !Strip off blanks |
851 | -c write(*,*) 'Writing out ',sname(ig)," ",procname(ip:jp) |
852 | - |
853 | - if (xsec(io(i)) .ne. 0) then |
854 | - subtotal = subtotal+xsec(io(i))*mfact(io(i))*scale |
855 | - write(16,66) '<tr><td align=right> <a href=P' |
856 | - $ //procname(ip:jp)//'/diagrams.html >' |
857 | - $ //'P'//procname(ip:jp), |
858 | - $ ' </a></td><td align=right><a href=' |
859 | - $ //linkname(io(i))//'>', |
860 | - $ xsec(io(i))*mfact(io(i))*scale |
861 | - $ ,'</a> </td><td align=right>', |
862 | - $ xerr(io(i))* |
863 | - $ mfact(io(i))*scale,'</td><td align=right>', |
864 | - $ nevents(io(i))/1000,'</td><td align=right>', |
865 | - $ eff(io(i)),'</td><td align=right>', |
866 | - $ nw(io(i)),'</td><td align=right>', |
867 | - $ xlum(io(i))/scale,'</td></tr>' |
868 | - |
869 | -c else |
870 | -c write(16,66) '<tr><td align=right> <a href=P_' |
871 | -c $ //procname(ip:jp)//'/diagrams.html >' |
872 | -c $ //procname(ip:jp), |
873 | -c $ ' </a></td><td align=right><a href=' |
874 | -c $ //linkname(io(i))//'> </td></tr>' |
875 | - endif |
876 | - endif |
877 | - else |
878 | -c write(*,*) 'Skipping process',i |
879 | - endif |
880 | - enddo !Loop over different groups |
881 | - |
882 | - if (nsubproc .gt. 1) then |
883 | -c if(sname(ig).ne.0) then |
884 | - if(subtotal .ne. 0e0) then |
885 | - write(16,*) '<tr> <td colspan="7" align="center"> Sub Group total = ',subtotal, '</td></tr>' |
886 | - subtotal=0d0 |
887 | - endif |
888 | -c endif |
889 | - endif |
890 | - |
891 | - enddo |
892 | - write(16,50) '</table></body>' |
893 | - 48 format(a,a,a,a) |
894 | - 49 format(a) |
895 | - 50 format( a) |
896 | - 60 format( a,f10.3,a,f10.3,a,i10,a,f8.1,a) |
897 | -c 65 format( a,i4,a,f10.3,a,f10.3,a,i10,a,f8.1,a,i10.0,a,f10.0,a) |
898 | - 65 format( a,a,a,f10.3,a,f10.3,a,i10,a,f8.1,a,i10.0,a,f10.2,a) |
899 | - 66 format( a,a,f10.3,a,f10.3,a,i10,a,f8.1,a,i10.0,a,f10.2,a) |
900 | - write(*,*) 'Updated results in file ',htmfile |
901 | - 999 close(16) |
902 | - end |
903 | - |
904 | - subroutine sort2(array,aux1,n) |
905 | - implicit none |
906 | -! Arguments |
907 | - integer n |
908 | - integer aux1(n) |
909 | - double precision array(n) |
910 | -! Local Variables |
911 | - integer i,k |
912 | - double precision temp |
913 | - logical done |
914 | - |
915 | -!----------- |
916 | -! Begin Code |
917 | -!----------- |
918 | - do i=n-1,1,-1 |
919 | - done = .true. |
920 | - do k=1,i |
921 | - if (array(k) .lt. array(k+1)) then |
922 | - temp = array(k) |
923 | - array(k) = array(k+1) |
924 | - array(k+1) = temp |
925 | - temp = aux1(k) |
926 | - aux1(k) = aux1(k+1) |
927 | - aux1(k+1) = temp |
928 | - done = .false. |
929 | - end if |
930 | - end do |
931 | - if (done) return |
932 | - end do |
933 | - end |
934 | - |
935 | - |
936 | - |
937 | - subroutine gen_run_html(lun) |
938 | -c*************************************************************************** |
939 | -c Writes out run information in html format |
940 | -c |
941 | -c*************************************************************************** |
942 | - implicit none |
943 | -c |
944 | -c Arguments |
945 | -c |
946 | - integer lun |
947 | -c |
948 | -c local |
949 | -c |
950 | -c |
951 | -c Global |
952 | -c |
953 | -c----- |
954 | -c Begin Code |
955 | -c----- |
956 | - write(lun,*) |
957 | - end |
958 | - |
959 | - subroutine gen_cut_html(lun) |
960 | -c*************************************************************************** |
961 | -c Writes out run information in html format |
962 | -c |
963 | -c*************************************************************************** |
964 | - implicit none |
965 | -c |
966 | -c Parameters |
967 | -c |
968 | -c include 'genps.inc' |
969 | -c |
970 | -c Arguments |
971 | -c |
972 | - integer lun |
973 | -c |
974 | -c Local |
975 | -c |
976 | - integer i,j |
977 | - real stot |
978 | -c |
979 | -c Global |
980 | -c |
981 | - |
982 | -c----- |
983 | -c Begin Code |
984 | -c----- |
985 | - |
986 | -c call read_cuts() |
987 | -c call write_cuts() !Writes cuts.dat in parent directory |
988 | - |
989 | -c |
990 | -c Write out collider information table |
991 | -c |
992 | -c stot = 2d0*sqrt(ebeam(1)*ebeam(2)) |
993 | -c write(lun,*) '<p> <TABLE> <table border=1>' |
994 | -c write(lun,*) '<TD> <B> sqrt(s) </B> </TD>' |
995 | -c write(lun,*) '<TD> <B> Beam 1 </B> </TD>' |
996 | -c write(lun,*) '<TD> <B> Beam 2 </B> </TD>' |
997 | - |
998 | -c write(lun,*) '</TR><TR><TD><B>',stot,' GeV </B></TD>' |
999 | -c write(lun,*) '<TD> <B>',Ebeam(1),' GeV </B></TD>' |
1000 | -c write(lun,*) '<TD> <B>',Ebeam(2),' GeV </B></TD>' |
1001 | -c write(lun,*) '</TR> <TR>' |
1002 | -c write(lun,*) '<TD> </TD>' |
1003 | -c do i=1,2 |
1004 | -c write(lun,*) '<TD> <center> <B>' |
1005 | -c if (lpp(i) .eq. 1) then |
1006 | -c write(lun,*) 'Proton' |
1007 | -c elseif(lpp(i) .eq. -1) then |
1008 | -c write(lun,*) 'Antiproton' |
1009 | -c else |
1010 | -c write(lun,*) 'No pdf' |
1011 | -c endif |
1012 | -c write(lun,*) '</B></center></TD>' |
1013 | -c enddo |
1014 | -c write(lun,*) '</TR></table>' |
1015 | - |
1016 | - |
1017 | - |
1018 | -c |
1019 | -c Now write out the cuts information table |
1020 | -c |
1021 | -c if (.false.) then |
1022 | -c write(lun,*) '<p> <TABLE> <table border=1>' |
1023 | -c |
1024 | -c Header |
1025 | -c |
1026 | -c write(lun,*) '<TR> <TD><B> Cuts </B> </TD>' |
1027 | -c do i=3,nexternal |
1028 | -c write(lun,*) '<TD> <B> <center>',i |
1029 | -c write(lun,*) '</center> </B> </TD>' |
1030 | -c enddo |
1031 | -c |
1032 | -c PT |
1033 | -c |
1034 | -c write(lun,*) '<TR> <TD><B> Et > </B> </TD>' |
1035 | -c do i=3,nexternal |
1036 | -c write(lun,'(a,f6.0)') '<TD> <B> <right>',etmin(i) |
1037 | -c write(lun,*) '</right> </B> </TD>' |
1038 | -c enddo |
1039 | -c |
1040 | -c Rapidity |
1041 | -c |
1042 | -c write(lun,*) '<TR> <TD><B> eta < </B> </TD>' |
1043 | -c do i=3,nexternal |
1044 | -c write(lun,'(a,f6.0)') '<TD> <B> <right>',etamax(i) |
1045 | -c write(lun,*) '</right> </B> </TD>' |
1046 | -c enddo |
1047 | -c |
1048 | -c Delta R |
1049 | -c |
1050 | -c do j=4,nexternal |
1051 | -c write(lun,*) '<TR> <TD><B> Delta R',j, ' </B> </TD>' |
1052 | -c do i=3,nexternal |
1053 | -c if ( i .lt. j) then |
1054 | -c write(lun,'(a,f6.1)') '<TD> <B> <right>',r2min(j,i) |
1055 | -c else |
1056 | -c write(lun,'(a)') '<TD> <B> <right>' |
1057 | -c endif |
1058 | -c write(lun,*) '</right> </B> </TD>' |
1059 | -c enddo |
1060 | -c write(lun,*) '</TR>' |
1061 | -c enddo |
1062 | -c write(lun,*) '</table>' |
1063 | -c write(lun,*) '<p>' |
1064 | -c endif |
1065 | - |
1066 | -c |
1067 | -c Now write out the cuts information table |
1068 | -c |
1069 | -c write(lun,*) '<p> <TABLE> <table border=1>' |
1070 | -c |
1071 | -c Header |
1072 | -c |
1073 | -c write(lun,*) '<TD><B> Particle </B> </TD>' |
1074 | -c write(lun,*) '<TD><B> Et > </B> </TD>' |
1075 | -c write(lun,*) '<TD><B> eta < </B> </TD>' |
1076 | -c do i=3,nexternal-1 |
1077 | -c write(lun,*) '<TD> <B> <center>Delta R',i |
1078 | -c write(lun,*) '</center> </B> </TD>' |
1079 | -c enddo |
1080 | -c write(lun,*) '</TR>' |
1081 | -c |
1082 | -c PT |
1083 | -c |
1084 | -c write(lun,*) '<TR> <TD><B> Et > </B> </TD>' |
1085 | -c do i=3,nexternal |
1086 | -c write(lun,'(a,i3)') '<TR><TD> <B> <center>',i |
1087 | -c write(lun,*) '</center> </B> </TD>' |
1088 | -c write(lun,'(a,f6.0)') '<TD> <B> <right>',etmin(i) |
1089 | -c write(lun,*) '</right> </B> </TD>' |
1090 | -c write(lun,'(a,f6.1)') '<TD> <B> <right>',etamax(i) |
1091 | -c write(lun,*) '</right> </B> </TD>' |
1092 | - |
1093 | -c do j=3,nexternal-1 |
1094 | -c if ( i .gt. j) then |
1095 | -c write(lun,'(a,f6.1)') '<TD> <B> <right>',r2min(i,j) |
1096 | -c else |
1097 | -c write(lun,'(a)') '<TD> <B> <right>' |
1098 | -c endif |
1099 | -c write(lun,*) '</right> </B> </TD>' |
1100 | -c enddo |
1101 | -c write(lun,*) '</TR>' |
1102 | - |
1103 | -c enddo |
1104 | -c |
1105 | -c Rapidity |
1106 | -c |
1107 | -c write(lun,*) '<TR> <TD><B> eta < </B> </TD>' |
1108 | -c do i=3,nexternal |
1109 | -c enddo |
1110 | -c |
1111 | -c Delta R |
1112 | -c |
1113 | - |
1114 | -c write(lun,*) '</table>' |
1115 | -c write(lun,*) '<p>' |
1116 | - end |
1117 | - |
1118 | - |
1119 | - |
1120 | - |
1121 | |
1122 | === modified file 'Template/SubProcesses/setcuts.f' |
1123 | --- Template/SubProcesses/setcuts.f 2011-10-02 12:06:10 +0000 |
1124 | +++ Template/SubProcesses/setcuts.f 2012-03-08 17:31:22 +0000 |
1125 | @@ -112,22 +112,28 @@ |
1126 | c set ptj and s_min if xqcut and ktscheme = 1, to improve |
1127 | c integration speed, and set drjj and drjl to 0. |
1128 | c |
1129 | - if(xqcut.gt.0.and.ktscheme.eq.1) then |
1130 | - if(auto_ptj_mjj.and.ptj.ge.0d0.and.ptj.lt.xqcut)then |
1131 | + if(xqcut.gt.0) then |
1132 | + if(auto_ptj_mjj.and.ptj.ge.0d0.and.ktscheme.eq.1)then |
1133 | ptj=xqcut |
1134 | write(*,*) 'Warning! ptj set to xqcut=',xqcut, |
1135 | $ ' to improve integration efficiency' |
1136 | write(*,*) 'Note that this might affect non-radiated jets,' |
1137 | write(*,*) 'e.g. from decays. Use cut_decays=F in run_card.' |
1138 | + else if(ptj.gt.xqcut)then |
1139 | + ptj=0d0 |
1140 | + write(*,*) 'Warning! ptj set to 0 since xqcut > 0 and' |
1141 | + write(*,*) ' auto_ptj_mjj = F or ktscheme > 1' |
1142 | endif |
1143 | - endif |
1144 | - if(xqcut.gt.0) then |
1145 | - if(auto_ptj_mjj.and.mmjj.ge.0d0.and.mmjj.lt.xqcut)then |
1146 | + if(auto_ptj_mjj.and.mmjj.ge.0d0)then |
1147 | mmjj=xqcut |
1148 | write(*,*) 'Warning! mmjj set to xqcut=',xqcut, |
1149 | $ ' to improve integration efficiency' |
1150 | write(*,*) 'Note that this might affect non-radiated jets,' |
1151 | write(*,*) 'e.g. from decays. Use cut_decays=F in run_card.' |
1152 | + else if(mmjj.gt.xqcut)then |
1153 | + mmjj=0d0 |
1154 | + write(*,*) 'Warning! mmjj set to 0 since xqcut > 0 and' |
1155 | + write(*,*) ' auto_ptj_mjj = F' |
1156 | endif |
1157 | if(drjj.gt.0d0) then |
1158 | write(*,*) 'Warning! drjj > 0 with xqcut > 0, set to 0' |
1159 | |
1160 | === modified file 'Template/bin/generate_events' |
1161 | --- Template/bin/generate_events 2011-12-14 21:52:20 +0000 |
1162 | +++ Template/bin/generate_events 2012-03-08 17:31:22 +0000 |
1163 | @@ -28,7 +28,7 @@ |
1164 | sys.path.append(pjoin(root_path,'bin','internal')) |
1165 | import madevent_interface as ME |
1166 | |
1167 | -if not (sys.version_info[0] == 2 or sys.version_info[1] > 5): |
1168 | +if not sys.version_info[0] == 2 or sys.version_info[1] < 6: |
1169 | sys.exit('MadEvent works with python 2.6 or higher (but not python 3.X).\n\ |
1170 | Please upgrade your version of python.') |
1171 | |
1172 | @@ -67,20 +67,17 @@ |
1173 | except: |
1174 | name = raw_input('enter run name\n') |
1175 | |
1176 | - launch = ME.MadEventCmd(me_dir=root_path) |
1177 | +# launch = ME.MadEventCmd(me_dir=root_path) |
1178 | |
1179 | |
1180 | if mode == 1: |
1181 | - launch.run_cmd('generate_events -f %s --cluster' |
1182 | - %(name)) |
1183 | - elif mode ==2: |
1184 | - launch.run_cmd('generate_events -f %s --multicore --nb_core=%s' |
1185 | - %(name, opt)) |
1186 | + argument = ['fake','-f', str(name), '--cluster'] |
1187 | + elif mode == 2: |
1188 | + argument = ['fake','-f', '--multicore', str(name), '--nb_core=%s' % opt] |
1189 | else: |
1190 | - launch.run_cmd('generate_events -f %s' % name) |
1191 | - |
1192 | - launch.run_cmd('quit') |
1193 | + argument = ['fake','-f', name] |
1194 | |
1195 | + return argument |
1196 | |
1197 | |
1198 | |
1199 | @@ -100,13 +97,18 @@ |
1200 | if '-h' in argument or '--help' in argument: |
1201 | launch = ME.MadEventCmd(me_dir=root_path) |
1202 | launch.exec_cmd('help generate_events') |
1203 | + sys.exit() |
1204 | elif len(argument) > 1 and argument[1] in ['0', '1', '2']: |
1205 | - treat_old_argument(argument) |
1206 | - else: |
1207 | - open('/tmp/mg5tmp.cmd','w').write('generate_events %s' % ' '.join(argument[1:])) |
1208 | - os.system('%s/madevent /tmp/mg5tmp.cmd' % pjoin(root_path, 'bin')) |
1209 | + argument = treat_old_argument(argument) |
1210 | + |
1211 | + launch = ME.MadEventCmd(me_dir=root_path) |
1212 | + launch.run_cmd('generate_events %s' % ' '.join(argument[1:])) |
1213 | + launch.run_cmd('quit') |
1214 | except KeyboardInterrupt: |
1215 | - pass |
1216 | + try: |
1217 | + launch.run_cmd('quit') |
1218 | + except: |
1219 | + pass |
1220 | except ME.MadEventAlreadyRunning, error: |
1221 | logging.error(str(error)) |
1222 | sys.exit() |
1223 | |
1224 | === modified file 'Template/bin/internal/compile_Source' |
1225 | --- Template/bin/internal/compile_Source 2011-07-19 11:03:51 +0000 |
1226 | +++ Template/bin/internal/compile_Source 2012-03-08 17:31:22 +0000 |
1227 | @@ -14,7 +14,7 @@ |
1228 | |
1229 | if [[ -d Source ]]; then |
1230 | cd Source |
1231 | - for i in ../bin/internal/sum_html ../bin/internal/gen_ximprove all ../bin/internal/combine_events ../bin/internal/combine_runs ../bin/internal/sumall; do |
1232 | + for i in ../bin/internal/gen_ximprove all ../bin/internal/combine_events ../bin/internal/combine_runs; do |
1233 | make $i > /dev/null |
1234 | if [[ $? -ne 0 ]];then |
1235 | # Make didn't exit successfully |
1236 | |
1237 | === removed file 'Template/bin/internal/sumall' |
1238 | --- Template/bin/internal/sumall 2011-07-12 16:33:50 +0000 |
1239 | +++ Template/bin/internal/sumall 1970-01-01 00:00:00 +0000 |
1240 | @@ -1,29 +0,0 @@ |
1241 | -#!/bin/bash |
1242 | -# |
1243 | -# First we need to get into the main directory |
1244 | -# |
1245 | -if [[ ! -d ./bin ]]; then |
1246 | - cd ../ |
1247 | - if [[ ! -d ./bin ]]; then |
1248 | - echo "Error: sumall must be executed from the main, or bin directory" |
1249 | - exit |
1250 | - fi |
1251 | -fi |
1252 | -if [[ ! -d Source ]]; then |
1253 | - echo "Error: Source directory not found" |
1254 | - exit |
1255 | -fi |
1256 | -cd ./Source |
1257 | -make ../bin/internal/sum_html >& /dev/null |
1258 | -cd .. |
1259 | -if [[ ! -d SubProcesses ]]; then |
1260 | - echo "Error: SubProcesses directory not found" |
1261 | - exit |
1262 | -fi |
1263 | -cd SubProcesses |
1264 | -for i in `cat subproc.mg` ; do |
1265 | -cd $i |
1266 | -../../bin/internal/sum_html >/dev/null |
1267 | -cd .. |
1268 | -done |
1269 | -../bin/internal/sum_html |
1270 | |
1271 | === modified file 'UpdateNotes.txt' |
1272 | --- UpdateNotes.txt 2012-02-16 19:13:36 +0000 |
1273 | +++ UpdateNotes.txt 2012-03-08 17:31:22 +0000 |
1274 | @@ -1,44 +1,81 @@ |
1275 | Update notes for MadGraph 5 (in reverse time order) |
1276 | |
1277 | -1.4.2 (16/02/12) JA: Ensure that matching works properly with > 9 final state |
1278 | +1.4.3 (08/03/12) JA: Reintroduced the possibility to completely forbid |
1279 | + s-channel diagrams, using the $$ notation. Note that |
1280 | + this should be used with great care, since the result |
1281 | + is in general not gauge-invariant. It is in general |
1282 | + better to use the $ notation, forbidding only onshell |
1283 | + s-channel particles (the inverse of decay chains). |
1284 | + JA: Automatically ensure that ptj and mmjj are below xqcut |
1285 | + when xqcut > 0, since ptj or mmjj > xqcut ruins matching. |
1286 | + OM: Add LSF to the list of supported cluster (thanks to Alexis). |
1287 | + OM: change the param_card reader for the restrict file. |
1288 | + This allow to restrict model with 3 lha id (or more) |
1289 | + (thanks to Eduardo Ponton). |
1290 | + OM: forbids to run 'generate events' with python 2.4. |
1291 | + OM: Include the configuration file in the .tar.gz created on |
1292 | + the web (thanks to Simon) . |
1293 | + OM: Fix a Mac specific problem for edition of Delphes card. |
1294 | + (thanks to Sho Iwamoto). |
1295 | + OM: ALOHA modifications: |
1296 | + - Change sign convention for Epsilon (matching FR choices) |
1297 | + - For Fermion vertex forces that _1 always returns the |
1298 | + incoming fermion and _2 returns the outcoming fermion. |
1299 | + (This modifies conjugate routine output) |
1300 | + - Change the order of argument for conjugate routine |
1301 | + to expect IO order of fermion in all cases. |
1302 | + Note that the two last modifications matches MG5 conventions |
1303 | + and that those modifications correct bugs for interactions |
1304 | + a) subject to conjugate routine (i.e. if the model has |
1305 | + majorana) |
1306 | + b) containing fermion momentum dependencies in the Lorentz |
1307 | + structure |
1308 | + All model included by default in MG5 (in particular sm/mssm) |
1309 | + were not affected by those mismatch of conventions. |
1310 | + (Thanks to Benjamin fuks) |
1311 | + OM: make acceptance test more silent. |
1312 | + OM: return the correct error message when a compilation occur. |
1313 | + OM: some code re-factoring. |
1314 | + |
1315 | +1.4.2 (16/02/12) JA: Ensure that matching works properly with > 9 final state |
1316 | particles (by increasing a buffer size in event output) |
1317 | - OM: add a command "import banner" in order to run a full run |
1318 | - from a given banner. |
1319 | - OM: Fix the Bug #921487, fixing a problem with home made model |
1320 | + OM: add a command "import banner" in order to run a full run |
1321 | + from a given banner. |
1322 | + OM: Fix the Bug #921487, fixing a problem with home made model |
1323 | In the definition of Particle/Anti-Particle. (Thanks Ben) |
1324 | - OM: Fix a formatting problem in me5_configuration.txt |
1325 | + OM: Fix a formatting problem in me5_configuration.txt |
1326 | (Bug #930101) Thanks to Arian |
1327 | - OM: allow to run ./bin/mg5 BANNER_PATH and |
1328 | + OM: allow to run ./bin/mg5 BANNER_PATH and |
1329 | ./bin/mg5 PROC_CARD_V4_PATH |
1330 | - OM: Various small fixes concerning the stability of the html |
1331 | - output. |
1332 | - OM: Changes the server to download td since cp3wks05 has an |
1333 | - harddisk failures. |
1334 | + OM: Various small fixes concerning the stability of the html |
1335 | + output. |
1336 | + OM: Changes the server to download td since cp3wks05 has an |
1337 | + harddisk failures. |
1338 | |
1339 | -1.4.1 (06/02/12) OM: Fix the fermion flow check which was wrongly failing on |
1340 | +1.4.1 (06/02/12) OM: Fix the fermion flow check which was wrongly failing on |
1341 | some model (Thanks to Benjamin) |
1342 | - OM: Improve run organization efficiency (which speeds up the |
1343 | - code on cluster) (Thanks to Johan) |
1344 | - OM: More secure html output (Thanks to Simon) |
1345 | + OM: Improve run organization efficiency (which speeds up the |
1346 | + code on cluster) (Thanks to Johan) |
1347 | + OM: More secure html output (Thanks to Simon) |
1348 | |
1349 | -1.4.0 (04/02/12): OM: New user interface for the madevent run. Type: |
1350 | +1.4.0 (04/02/12) OM: New user interface for the madevent run. Type: |
1351 | 1) (from madevent output) ./bin/madevent |
1352 | 2) (from MG5 command line) launch [MADEVENT_PATH] -i |
1353 | This interface replaces various script like refine, |
1354 | survey, combine, run_..., rm_run, ... |
1355 | The script generate_events still exists but now calls |
1356 | ./bin/madevent. |
1357 | - OM: For MSSM model, convert param_card to SLAH1. This card is |
1358 | + OM: For MSSM model, convert param_card to SLAH1. This card is |
1359 | converted to SLAH2 during the MadEvent run since the UFO |
1360 | model uses SLAH2. This allows to use Pythia 6, |
1361 | as well as having a coherent definition for the flavor. |
1362 | - JA+OM: For decay width computations, the launch command in |
1363 | + JA+OM: For decay width computations, the launch command in |
1364 | addition to compute the width, creates a new param_card |
1365 | with the width set to the associated values, and with the |
1366 | Branching ratio associated (usefull for pythia). |
1367 | - NOTE: This param_card makes sense for future run ONLY if all |
1368 | + NOTE: This param_card makes sense for future run ONLY if all |
1369 | relevant decay are generated. |
1370 | - EXAMPLE: (after launch bin/mg5): |
1371 | + EXAMPLE: (after launch bin/mg5): |
1372 | import model sm-full |
1373 | generate t > b w+ |
1374 | define all = p b b~ l+ l- ta+ ta- vl vl~ |
1375 | @@ -49,41 +86,42 @@ |
1376 | add process h > v v, v > all all |
1377 | output |
1378 | launch |
1379 | - OM: change output pythia8 syntax: If a path is specified this |
1380 | + OM: change output pythia8 syntax: If a path is specified this |
1381 | is considered as the output directory. |
1382 | - OM: Change the path of the madevent output files. This allows |
1383 | + OM: Change the path of the madevent output files. This allows |
1384 | to run pythia/pgs/delphes mulitple times for the same set |
1385 | of events (with different pythia/... parameters). |
1386 | - OM: Madevent output is now insensitive to the relative path |
1387 | + OM: Madevent output is now insensitive to the relative path |
1388 | to pythia-pgs, delphes, ... In consequence you don't need |
1389 | - anymore to have your directory at the same level as Template directory. |
1390 | - OM: MadEvent checks that the param_card is coherent with the |
1391 | + anymore to have your directory at the same level as |
1392 | + Template directory. |
1393 | + OM: MadEvent checks that the param_card is coherent with the |
1394 | restriction used during the model generation. |
1395 | - OM: Model restrictions will now also force opposite number to |
1396 | + OM: Model restrictions will now also force opposite number to |
1397 | match (helpfull for constraining to rotation matrix). |
1398 | - OM: Change the import command. It's now allowed to omit the |
1399 | + OM: Change the import command. It's now allowed to omit the |
1400 | type of import. The type is guessed automaticaly. |
1401 | This is NOT allowed on the web. |
1402 | - OM: Add a check that the fermion flow is coherent with the |
1403 | + OM: Add a check that the fermion flow is coherent with the |
1404 | Lorentz structure associates to the vertex. |
1405 | - OM: Add a check that the color representation is coherent. |
1406 | + OM: Add a check that the color representation is coherent. |
1407 | This allow to detect/fix various problem linked |
1408 | to some new models created by FR and SARAH. |
1409 | - OM: Change the default fortran compiler to gfortran. |
1410 | - OM: Add the possibility to force which fortran compiler will |
1411 | + OM: Change the default fortran compiler to gfortran. |
1412 | + OM: Add the possibility to force which fortran compiler will |
1413 | be used, either via the configuration file or via the set |
1414 | command. |
1415 | - OM: Add the possibility to bypass the automatic opening of |
1416 | + OM: Add the possibility to bypass the automatic opening of |
1417 | the web browser (via the configuration file: |
1418 | ./input/mg5_configuration.txt ) |
1419 | - OM: add 'save options' command to save the current configuration |
1420 | - in the configuration file. |
1421 | - OM: Change the scheme of questions when running madevent and |
1422 | + OM: add 'save options' command to save the current configuration |
1423 | + in the configuration file. |
1424 | + OM: Change the scheme of questions when running madevent and |
1425 | allow to specify in the command interface if you |
1426 | want to run pythia/pgs/... |
1427 | Allow to put the answers to the questions in the |
1428 | proc_card.dat. |
1429 | - OM: Add options for the display command: |
1430 | + OM: Add options for the display command: |
1431 | a) display options: return the current option value. |
1432 | i.e. those set via the set command and/or via the |
1433 | configuration file |
1434 | @@ -94,29 +132,29 @@ |
1435 | d) display couplings now returns the list of all couplings |
1436 | with the associated expression |
1437 | e) display interactions [PART1] [PART2] [PART3] ... |
1438 | - display all interactions containing the particles set |
1439 | + display all interactions containing the particles set |
1440 | in arguments |
1441 | - OM: New Python script for the creation of the various html pages. |
1442 | + OM: New Python script for the creation of the various html pages. |
1443 | This Requires less disk access for the generation of the files. |
1444 | - OM: Modify error treatment, especially for Invalid commands |
1445 | + OM: Modify error treatment, especially for Invalid commands |
1446 | and Configuration problems. |
1447 | - JA: Ensure that we get zero cross section if we have |
1448 | + JA: Ensure that we get zero cross section if we have |
1449 | non-parton initial states with proton/antiproton beams |
1450 | - OM: Improve cluster support. MadEvent now supports PBS/Condor/SGE |
1451 | + OM: Improve cluster support. MadEvent now supports PBS/Condor/SGE |
1452 | Thanks to Arian Abrahantes for the SGE implementation. |
1453 | - OM: Improve auto-completion (better output/dealing with multi line/...) |
1454 | - OM: Improve the parallel suite and change the release script to run |
1455 | + OM: Improve auto-completion (better output/dealing with multi line/...) |
1456 | + OM: Improve the parallel suite and change the release script to run |
1457 | some of the parallel tests. This ensures even higher stability |
1458 | of the code for the future releases. |
1459 | - JA: Changed the way gridpacks work: Set granularity to 1 |
1460 | + JA: Changed the way gridpacks work: Set granularity to 1 |
1461 | (so randomly select channels only if they should generate |
1462 | less than 1 event), but allowing channels to run down to a single |
1463 | iteration. This removes all old problems with increased |
1464 | variance for small channels in the gridpacks, while giving |
1465 | even faster event generation. |
1466 | |
1467 | - Thanks to Johan Alwall, Sho Iwamoto for all the important |
1468 | - testing/bug reports. |
1469 | + Thanks to Johan Alwall, Sho Iwamoto for all the important |
1470 | + testing/bug reports. |
1471 | |
1472 | |
1473 | 1.3.33 (01/01/12) JA: Revisited colors for propagators in addmothers.f |
1474 | |
1475 | === modified file 'aloha/aloha_object.py' |
1476 | --- aloha/aloha_object.py 2012-01-09 09:34:39 +0000 |
1477 | +++ aloha/aloha_object.py 2012-03-08 17:31:22 +0000 |
1478 | @@ -551,7 +551,7 @@ |
1479 | |
1480 | i1 , i2, i3, i4 = perm |
1481 | #formula found on wikipedia |
1482 | - return ((i2-i1) * (i3-i1) *(i4-i1) * (i3-i2) * (i4-i2) *(i4-i3))/12 |
1483 | + return -1 * ((i2-i1) * (i3-i1) *(i4-i1) * (i3-i2) * (i4-i2) *(i4-i3))/12 |
1484 | |
1485 | # DEFINE THE REPRESENTATION OF EPSILON |
1486 | |
1487 | |
1488 | === modified file 'aloha/aloha_writers.py' |
1489 | --- aloha/aloha_writers.py 2012-01-31 16:28:22 +0000 |
1490 | +++ aloha/aloha_writers.py 2012-03-08 17:31:22 +0000 |
1491 | @@ -17,6 +17,7 @@ |
1492 | type_to_variable = {2:'F',3:'V',5:'T',1:'S'} |
1493 | type_to_size = {'S':3, 'T':18, 'V':6, 'F':6} |
1494 | |
1495 | + |
1496 | def __init__(self, abstract_routine, dirpath): |
1497 | |
1498 | |
1499 | @@ -34,10 +35,20 @@ |
1500 | self.namestring = name |
1501 | self.abstractname = abstract_routine.name |
1502 | self.comment = abstract_routine.infostr |
1503 | - self.offshell = abstract_routine.outgoing |
1504 | + self.offshell = abstract_routine.outgoing |
1505 | + |
1506 | self.symmetries = abstract_routine.symmetries |
1507 | self.tag = abstract_routine.tag |
1508 | |
1509 | + self.outgoing = self.offshell |
1510 | + if 'C%s' %((self.outgoing + 1) // 2) in self.tag: |
1511 | + #flip the outgoing tag if in conjugate |
1512 | + self.outgoing = self.outgoing + self.outgoing % 2 - (self.outgoing +1) % 2 |
1513 | + |
1514 | + |
1515 | + |
1516 | + |
1517 | + |
1518 | #prepare the necessary object |
1519 | self.collect_variables() # Look for the different variables |
1520 | self.make_all_lists() # Compute the expression for the call ordering |
1521 | @@ -59,8 +70,8 @@ |
1522 | elif len(indices) == 2: |
1523 | return 4 * indices[0] + indices[1] + start |
1524 | else: |
1525 | - raise Exception, 'WRONG CONTRACTION OF LORENTZ OBJECT for routine %s' \ |
1526 | - % self.namestring |
1527 | + raise Exception, 'WRONG CONTRACTION OF LORENTZ OBJECT for routine %s: %s' \ |
1528 | + % (self.namestring, indices) |
1529 | |
1530 | def collect_variables(self): |
1531 | """Collects Momenta,Mass,Width into lists""" |
1532 | @@ -100,7 +111,7 @@ |
1533 | |
1534 | def write_obj(self, obj): |
1535 | """Calls the appropriate writing routine""" |
1536 | - |
1537 | + |
1538 | try: |
1539 | vartype = obj.vartype |
1540 | except: |
1541 | @@ -173,11 +184,22 @@ |
1542 | outgoing = self.offshell |
1543 | |
1544 | call_arg = [] #incoming argument of the routine |
1545 | + |
1546 | + conjugate = [2*(int(c[1:])-1) for c in self.tag if c[0] == 'C'] |
1547 | |
1548 | - |
1549 | - call_arg = ['%s%d' % (spin, index +1) |
1550 | - for index,spin in enumerate(self.particles) |
1551 | - if outgoing != index +1] |
1552 | + for index,spin in enumerate(self.particles): |
1553 | + if self.offshell == index + 1: |
1554 | + continue |
1555 | + |
1556 | + if index in conjugate: |
1557 | + index2, spin2 = index+1, self.particles[index+1] |
1558 | + call_arg.append('%s%d' % (spin2, index2 +1)) |
1559 | + #call_arg.append('%s%d' % (spin, index +1)) |
1560 | + elif index-1 in conjugate: |
1561 | + index2, spin2 = index-1, self.particles[index-1] |
1562 | + call_arg.append('%s%d' % (spin2, index2 +1)) |
1563 | + else: |
1564 | + call_arg.append('%s%d' % (spin, index +1)) |
1565 | |
1566 | return call_arg |
1567 | |
1568 | @@ -213,6 +235,15 @@ |
1569 | else: |
1570 | global_sign = -1 |
1571 | |
1572 | + flipped = [2*(int(c[1:])-1) for c in self.tag if c.startswith('C')] |
1573 | +# if self.offshell % 2: |
1574 | +# not_flip = self.offshell - 1 |
1575 | +# if not_flip in flipped: |
1576 | +# flipped.remove(not_flip) |
1577 | +# else: |
1578 | +# not_flip = self.offshell - 2 |
1579 | +# if not_flip in flipped: |
1580 | +# flipped.remove(not_flip) |
1581 | |
1582 | for index, spin in enumerate(self.particles): |
1583 | assert(spin in ['S','F','V','T']) |
1584 | @@ -223,12 +254,15 @@ |
1585 | elif nb_fermion % 2 == 0: |
1586 | sign = global_sign |
1587 | nb_fermion += 1 |
1588 | + if index in flipped: |
1589 | + sign *= -1 |
1590 | else: |
1591 | sign = -1 * global_sign |
1592 | nb_fermion += 1 |
1593 | - |
1594 | + if index-1 in flipped: |
1595 | + sign *= -1 |
1596 | # No need to include the outgoing particles in the definitions |
1597 | - if index == self.offshell -1: |
1598 | + if index == self.outgoing -1: |
1599 | continue |
1600 | |
1601 | # write the |
1602 | @@ -245,6 +279,8 @@ |
1603 | """ make the list of declaration nedded by the header """ |
1604 | |
1605 | declare_list = [] |
1606 | + |
1607 | + |
1608 | for index, spin in enumerate(self.particles): |
1609 | # First define the size of the associate Object |
1610 | declare_list.append(self.declare_dict[spin] % (index + 1) ) |
1611 | @@ -294,11 +330,11 @@ |
1612 | if not alredy_update: |
1613 | declare_list.append('double complex denom') |
1614 | declare_list.append('double precision M%(id)d, W%(id)d' % |
1615 | - {'id': self.offshell}) |
1616 | + {'id': self.outgoing}) |
1617 | call_arg = '%(args)s, COUP, M%(id)d, W%(id)d, %(spin)s%(id)d' % \ |
1618 | {'args': ', '.join(CallList), |
1619 | 'spin': self.particles[self.offshell -1], |
1620 | - 'id': self.offshell} |
1621 | + 'id': self.outgoing} |
1622 | str_out = ' subroutine %s(%s)\n' % (name, call_arg) |
1623 | |
1624 | # Forcing implicit None |
1625 | @@ -345,7 +381,7 @@ |
1626 | offshell_size = self.type_to_size[offshelltype] |
1627 | #Implement the conservation of Energy Impulsion |
1628 | for i in range(-1,1): |
1629 | - str_out += '%s%d(%d)= ' % (offshelltype, self.offshell, \ |
1630 | + str_out += '%s%d(%d)= ' % (offshelltype, self.outgoing, \ |
1631 | offshell_size + i) |
1632 | |
1633 | pat=re.compile(r'^[-+]?(?P<spin>\w)') |
1634 | @@ -360,9 +396,23 @@ |
1635 | index = int(mom[1:]) |
1636 | type = self.particles[index - 1] |
1637 | energy_pos = self.type_to_size[type] -1 |
1638 | - sign = '' |
1639 | + sign = 1 |
1640 | if self.offshell == index and type in ['V','S']: |
1641 | + sign = -1 |
1642 | + if 'C%s' % ((index +1) // 2) in self.tag: |
1643 | + if index == self.outgoing: |
1644 | + pass |
1645 | + elif index % 2 and index -1 != self.outgoing: |
1646 | + pass |
1647 | + elif index % 2 == 1 and index + 1 != self.outgoing: |
1648 | + pass |
1649 | + else: |
1650 | + sign *= -1 |
1651 | + |
1652 | + if sign == -1 : |
1653 | sign = '-' |
1654 | + else: |
1655 | + sign = '' |
1656 | |
1657 | str_out += '%s(0) = %s dble(%s%d(%d))\n' % (mom, sign, type, index, energy_pos) |
1658 | str_out += '%s(1) = %s dble(%s%d(%d))\n' % (mom, sign, type, index, energy_pos + 1) |
1659 | @@ -424,7 +474,7 @@ |
1660 | OutString = OutString + string + '\n' |
1661 | else: |
1662 | OffShellParticle = '%s%d' % (self.particles[self.offshell-1],\ |
1663 | - self.offshell) |
1664 | + self.outgoing) |
1665 | numerator = self.obj.numerator |
1666 | denominator = self.obj.denominator |
1667 | for ind in denominator.listindices(): |
1668 | @@ -537,11 +587,11 @@ |
1669 | else: |
1670 | main = '%(spin)s%(id)d' % \ |
1671 | {'spin': self.particles[offshell -1], |
1672 | - 'id': self.offshell} |
1673 | + 'id': self.outgoing} |
1674 | call_arg = '%(args)s, %(COUP)s, M%(id)d, W%(id)d, %(LAST)s' % \ |
1675 | {'args': ', '.join(self.calllist['CallList']), |
1676 | 'COUP':'COUP%d', |
1677 | - 'id': self.offshell, |
1678 | + 'id': self.outgoing, |
1679 | 'LAST': '%s'} |
1680 | |
1681 | # make the first call |
1682 | @@ -683,8 +733,8 @@ |
1683 | str_out = 'void %(name)s(%(args)s, double M%(number)d, double W%(number)d, complex<double>%(out)s%(number)d[])' % \ |
1684 | {'name': name, |
1685 | 'args': ','.join(CallList+ ['complex<double> COUP']), |
1686 | - 'out': self.particles[OffShellParticle], |
1687 | - 'number': OffShellParticle + 1 |
1688 | + 'out': self.particles[self.outgoing - 1], |
1689 | + 'number': self.outgoing |
1690 | } |
1691 | |
1692 | h_string = str_out + ";\n\n" |
1693 | @@ -715,7 +765,7 @@ |
1694 | offshell_size = self.type_to_size[offshelltype] |
1695 | #Implement the conservation of Energy Impulsion |
1696 | for i in range(-2,0): |
1697 | - str_out += '%s%d[%d]= ' % (offshelltype, self.offshell, |
1698 | + str_out += '%s%d[%d]= ' % (offshelltype, self.outgoing, |
1699 | offshell_size + i) |
1700 | |
1701 | pat=re.compile(r'^[-+]?(?P<spin>\w)') |
1702 | @@ -731,9 +781,23 @@ |
1703 | |
1704 | type = self.particles[index - 1] |
1705 | energy_pos = self.type_to_size[type] - 2 |
1706 | - sign = '' |
1707 | + sign = 1 |
1708 | if self.offshell == index and type in ['V', 'S']: |
1709 | + sign = -1 |
1710 | + if 'C%s' % ((index +1) // 2) in self.tag: |
1711 | + if index == self.outgoing: |
1712 | + pass |
1713 | + elif index % 2 and index -1 != self.outgoing: |
1714 | + pass |
1715 | + elif index %2 == 1 and index + 1 != self.outgoing: |
1716 | + pass |
1717 | + else: |
1718 | + sign *= -1 |
1719 | + |
1720 | + if sign == -1 : |
1721 | sign = '-' |
1722 | + else: |
1723 | + sign = '' |
1724 | |
1725 | str_out += '%s[0] = %s%s%d[%d].real();\n' % (mom, sign, type, index, energy_pos) |
1726 | str_out += '%s[1] = %s%s%d[%d].real();\n' % (mom, sign, type, index, energy_pos + 1) |
1727 | @@ -791,7 +855,7 @@ |
1728 | string = string.replace('+-', '-') |
1729 | OutString = OutString + string + ';\n' |
1730 | else: |
1731 | - OffShellParticle = self.particles[self.offshell-1]+'%s'%(self.offshell) |
1732 | + OffShellParticle = self.particles[self.offshell-1]+'%s'%(self.outgoing) |
1733 | numerator = self.obj.numerator |
1734 | denominator = self.obj.denominator |
1735 | for ind in denominator.listindices(): |
1736 | @@ -1061,9 +1125,19 @@ |
1737 | |
1738 | WriteALOHA.__init__(self, abstract_routine, dirpath) |
1739 | self.outname = '%s%s' % (self.particles[self.offshell -1], \ |
1740 | - self.offshell) |
1741 | - |
1742 | - |
1743 | + self.outgoing) |
1744 | + |
1745 | + @staticmethod |
1746 | + def change_number_format(obj): |
1747 | + if obj.real == 0 and obj.imag: |
1748 | + if int(obj.imag) == obj.imag: |
1749 | + return '%ij' % obj.imag |
1750 | + else: |
1751 | + return '%sj' % str(obj.imag) |
1752 | + else: |
1753 | + return str(obj) |
1754 | + |
1755 | + |
1756 | def change_var_format(self, name): |
1757 | """Formatting the variable name to Python format |
1758 | start to count at zero""" |
1759 | @@ -1138,7 +1212,7 @@ |
1760 | str_out += 'def %(name)s(%(args)s, COUP, M%(id)d, W%(id)d):\n' % \ |
1761 | {'name': name, |
1762 | 'args': ', '.join(CallList), |
1763 | - 'id': self.offshell} |
1764 | + 'id': self.outgoing} |
1765 | return str_out |
1766 | |
1767 | def make_declaration_list(self): |
1768 | @@ -1181,14 +1255,29 @@ |
1769 | index = int(mom[1:]) |
1770 | type = self.particles[index - 1] |
1771 | energy_pos = self.type_to_size[type] -2 |
1772 | - sign = '' |
1773 | + sign = 1 |
1774 | if self.offshell == index and type in ['V','S']: |
1775 | - sign = '-' |
1776 | + sign = -1 |
1777 | + |
1778 | + if 'C%s' % ((index +1) // 2) in self.tag: |
1779 | + if index == self.outgoing: |
1780 | + pass |
1781 | + elif index % 2 and index -1 != self.outgoing: |
1782 | + pass |
1783 | + elif index %2 == 1 and index + 1 != self.outgoing: |
1784 | + pass |
1785 | + else: |
1786 | + sign *= -1 |
1787 | + |
1788 | + if sign == -1 : |
1789 | + sign = '- ' |
1790 | + else: |
1791 | + sign = '' |
1792 | |
1793 | str_out += '%s = [%scomplex(%s%d[%d]).real, \\\n' % (mom, sign, type, index, energy_pos) |
1794 | - str_out += ' %s complex(%s%d[%d]).real, \\\n' % ( sign, type, index, energy_pos + 1) |
1795 | - str_out += ' %s complex(%s%d[%d]).imag, \\\n' % ( sign, type, index, energy_pos + 1) |
1796 | - str_out += ' %s complex(%s%d[%d]).imag]\n' % ( sign, type, index, energy_pos) |
1797 | + str_out += ' %scomplex(%s%d[%d]).real, \\\n' % ( sign, type, index, energy_pos + 1) |
1798 | + str_out += ' %scomplex(%s%d[%d]).imag, \\\n' % ( sign, type, index, energy_pos + 1) |
1799 | + str_out += ' %scomplex(%s%d[%d]).imag]\n' % ( sign, type, index, energy_pos) |
1800 | |
1801 | # Definition for the One Over Mass**2 terms |
1802 | for elem in overm: |
1803 | @@ -1260,17 +1349,7 @@ |
1804 | text += header |
1805 | |
1806 | # Define which part of the routine should be called |
1807 | - addon = '' |
1808 | - if 'C' in self.namestring: |
1809 | - short_name, addon = name.split('C',1) |
1810 | - if addon.split('_')[0].isdigit(): |
1811 | - addon = 'C' +self.namestring.split('C',1)[1] |
1812 | - elif all([n.isdigit() for n in addon.split('_')[0].split('C')]): |
1813 | - addon = 'C' +self.namestring.split('C',1)[1] |
1814 | - else: |
1815 | - addon = '_%s' % self.offshell |
1816 | - else: |
1817 | - addon = '_%s' % self.offshell |
1818 | + addon = ''.join(self.tag) + '_%s' % self.offshell |
1819 | |
1820 | # how to call the routine |
1821 | if not offshell: |
1822 | @@ -1282,11 +1361,11 @@ |
1823 | else: |
1824 | main = '%(spin)s%(id)d' % \ |
1825 | {'spin': self.particles[self.offshell -1], |
1826 | - 'id': self.offshell} |
1827 | + 'id': self.outgoing} |
1828 | call_arg = '%(args)s, %(COUP)s, M%(id)d, W%(id)d' % \ |
1829 | {'args': ', '.join(self.calllist['CallList']), |
1830 | 'COUP':'COUP%d', |
1831 | - 'id': self.offshell} |
1832 | + 'id': self.outgoing} |
1833 | |
1834 | # make the first call |
1835 | line = " %s = %s%s("+call_arg+")\n" |
1836 | |
1837 | === modified file 'aloha/create_aloha.py' |
1838 | --- aloha/create_aloha.py 2012-02-01 20:26:10 +0000 |
1839 | +++ aloha/create_aloha.py 2012-03-08 17:31:22 +0000 |
1840 | @@ -198,6 +198,11 @@ |
1841 | aloha_lib.USE_TAG=set() |
1842 | #multiply by the wave functions |
1843 | nb_spinor = 0 |
1844 | + outgoing = self.outgoing |
1845 | + if (outgoing + 1) // 2 in self.conjg: |
1846 | + #flip the outgoing tag if in conjugate |
1847 | + outgoing = outgoing + outgoing % 2 - (outgoing +1) % 2 |
1848 | + |
1849 | if not self.routine_kernel: |
1850 | AbstractRoutineBuilder.counter += 1 |
1851 | logger.info('aloha creates %s routines' % self.name) |
1852 | @@ -213,21 +218,25 @@ |
1853 | else: |
1854 | lorentz = self.routine_kernel |
1855 | aloha_lib.USE_TAG = set(self.kernel_tag) |
1856 | - for (i, spin ) in enumerate(self.spins): |
1857 | + |
1858 | + |
1859 | + for (i, spin ) in enumerate(self.spins): |
1860 | id = i + 1 |
1861 | + |
1862 | #Check if this is the outgoing particle |
1863 | - if id == self.outgoing: |
1864 | + if id == outgoing: |
1865 | if spin == 1: |
1866 | lorentz *= complex(0,1) |
1867 | elif spin == 2: |
1868 | - # shift the tag if we multiply by C matrices |
1869 | - if (id+1) // 2 in self.conjg: |
1870 | - id += _conjugate_gap |
1871 | - nb_spinor += 1 |
1872 | - if nb_spinor %2: |
1873 | - lorentz *= SpinorPropagator(id, 'I2', self.outgoing) |
1874 | + # shift and flip the tag if we multiply by C matrices |
1875 | + if (id + 1) // 2 in self.conjg: |
1876 | + id += _conjugate_gap + id % 2 - (id +1) % 2 |
1877 | + if id % 2: |
1878 | + #propagator outcoming |
1879 | + lorentz *= SpinorPropagator(id, 'I2', outgoing) |
1880 | else: |
1881 | - lorentz *= SpinorPropagator('I2', id, self.outgoing) |
1882 | + #propagator incoming |
1883 | + lorentz *= SpinorPropagator('I2', id, outgoing) |
1884 | elif spin == 3 : |
1885 | lorentz *= VectorPropagator(id, 'I2', id) |
1886 | elif spin == 5 : |
1887 | @@ -248,10 +257,9 @@ |
1888 | elif spin == 2: |
1889 | # shift the tag if we multiply by C matrices |
1890 | if (id+1) // 2 in self.conjg: |
1891 | - spin_id = id + _conjugate_gap |
1892 | + spin_id = id + _conjugate_gap + id % 2 - (id +1) % 2 |
1893 | else: |
1894 | spin_id = id |
1895 | - nb_spinor += 1 |
1896 | lorentz *= Spinor(spin_id, id) |
1897 | elif spin == 3: |
1898 | lorentz *= Vector(id, id) |
1899 | @@ -262,8 +270,8 @@ |
1900 | 'The spin value %s is not supported yet' % spin) |
1901 | |
1902 | # If no particle OffShell |
1903 | - if self.outgoing: |
1904 | - lorentz /= DenominatorPropagator(self.outgoing) |
1905 | + if outgoing: |
1906 | + lorentz /= DenominatorPropagator(outgoing) |
1907 | #lorentz.tag.add('OM%s' % self.outgoing ) |
1908 | #lorentz.tag.add('P%s' % self.outgoing) |
1909 | else: |
1910 | @@ -273,7 +281,7 @@ |
1911 | lorentz = lorentz.simplify() |
1912 | |
1913 | lorentz = lorentz.expand() |
1914 | - if self.outgoing and self.spins[self.outgoing-1] == 5: |
1915 | + if outgoing and self.spins[outgoing-1] == 5: |
1916 | if not self.aloha_lib: |
1917 | AbstractRoutineBuilder.load_library() |
1918 | if self.spin2_massless: |
1919 | |
1920 | === modified file 'aloha/template_files/aloha_functions.f' |
1921 | --- aloha/template_files/aloha_functions.f 2010-09-28 10:05:41 +0000 |
1922 | +++ aloha/template_files/aloha_functions.f 2012-03-08 17:31:22 +0000 |
1923 | @@ -219,8 +219,8 @@ |
1924 | |
1925 | sqm(0) = dsqrt(abs(fmass)) ! possibility of negative fermion masses |
1926 | sqm(1) = sign(sqm(0),fmass) ! possibility of negative fermion masses |
1927 | - ip = -((1+nh)/2) |
1928 | - im = (1-nh)/2 |
1929 | + ip = -((1-nh)/2) * nhel |
1930 | + im = (1+nh)/2* nhel |
1931 | |
1932 | fo(1) = im * sqm(im) |
1933 | fo(2) = ip*nsf * sqm(im) |
1934 | |
1935 | === modified file 'aloha/template_files/oxxxxx.cc' |
1936 | --- aloha/template_files/oxxxxx.cc 2010-07-26 04:28:51 +0000 |
1937 | +++ aloha/template_files/oxxxxx.cc 2012-03-08 17:31:22 +0000 |
1938 | @@ -14,8 +14,8 @@ |
1939 | if (pp == 0.000){ |
1940 | sqm[0] = pow(abs(fmass),0.5); |
1941 | sqm[1] = Sgn(sqm[0],fmass); |
1942 | - ip = -((1+nh)/2); |
1943 | - im = (1-nh)/2; |
1944 | + ip = -((1-nh)/2) * nhel ; |
1945 | + im = (1+nh)/2 * nhel; |
1946 | fo[0] = im *sqm[im]; |
1947 | fo[1] = ip*nsf*sqm[im]; |
1948 | fo[2] = im*nsf*sqm[-ip]; |
1949 | @@ -27,8 +27,8 @@ |
1950 | sf[1] = double(1+nsf-(1-nsf)*nh)*0.5; |
1951 | omega[0] = pow(p[0]+pp,0.5); |
1952 | omega[1] = fmass/omega[0]; |
1953 | - ip = (1+nh)/2; |
1954 | - im = (1-nh)/2; |
1955 | + ip = (1+nh)/2 ; |
1956 | + im = (1-nh)/2 ; |
1957 | sfomeg[0] = sf[0]*omega[ip]; |
1958 | sfomeg[1] = sf[1]*omega[im]; |
1959 | pp3 = max(pp+p[3],0.00); |
1960 | |
1961 | === modified file 'aloha/template_files/wavefunctions.py' |
1962 | --- aloha/template_files/wavefunctions.py 2011-01-07 23:13:28 +0000 |
1963 | +++ aloha/template_files/wavefunctions.py 2012-03-08 17:31:22 +0000 |
1964 | @@ -94,8 +94,8 @@ |
1965 | pp = min(p[0],sqrt(p[1]**2 + p[2]**2 + p[3]**2 )) |
1966 | if (pp == 0.): |
1967 | sqm = sqrt(abs(fmass)) |
1968 | - ip = -((1+nh)/2) |
1969 | - im = (1-nh)/2 |
1970 | + ip = -((1-nh)/2) * nhel |
1971 | + im = (1+nh)/2 * nhel |
1972 | |
1973 | fo[0] = im*sqm |
1974 | fo[1] = ip*nsf*sqm |
1975 | |
1976 | === modified file 'bin/create_aloha_release.py' |
1977 | --- bin/create_aloha_release.py 2011-10-12 18:54:53 +0000 |
1978 | +++ bin/create_aloha_release.py 2012-03-08 17:31:22 +0000 |
1979 | @@ -56,7 +56,7 @@ |
1980 | root_path = path.split(path.dirname(path.realpath( __file__ )))[0] |
1981 | sys.path.append(root_path) |
1982 | |
1983 | -import madgraph.iolibs.misc as misc |
1984 | +import madgraph.various.misc as misc |
1985 | import madgraph.iolibs.files as files_routines |
1986 | from madgraph import MG5DIR |
1987 | |
1988 | |
1989 | === modified file 'bin/create_release.py' |
1990 | --- bin/create_release.py 2011-11-10 18:36:25 +0000 |
1991 | +++ bin/create_release.py 2012-03-08 17:31:22 +0000 |
1992 | @@ -54,7 +54,7 @@ |
1993 | root_path = path.split(path.dirname(path.realpath( __file__ )))[0] |
1994 | sys.path.append(root_path) |
1995 | |
1996 | -import madgraph.iolibs.misc as misc |
1997 | +import madgraph.various.misc as misc |
1998 | from madgraph import MG5DIR |
1999 | |
2000 | # Write out nice usage message if called with -h or --help |
2001 | @@ -169,10 +169,10 @@ |
2002 | #mixes the path for the tests |
2003 | import madgraph |
2004 | reload(madgraph) |
2005 | -import madgraph.iolibs |
2006 | -reload(madgraph.iolibs) |
2007 | -import madgraph.iolibs.misc |
2008 | -reload(madgraph.iolibs.misc) |
2009 | +import madgraph.various |
2010 | +reload(madgraph.various) |
2011 | +import madgraph.various.misc |
2012 | +reload(madgraph.various.misc) |
2013 | |
2014 | |
2015 | test_results = test_manager.run(package=os.path.join('tests', |
2016 | |
2017 | === modified file 'bin/mg5' |
2018 | --- bin/mg5 2012-02-15 07:22:35 +0000 |
2019 | +++ bin/mg5 2012-03-08 17:31:22 +0000 |
2020 | @@ -112,7 +112,7 @@ |
2021 | logging.getLogger('madgraph').setLevel(eval('logging.' + options.logging)) |
2022 | except: |
2023 | pass |
2024 | -import madgraph.interface.cmd_interface as cmd_interface |
2025 | +import madgraph.interface.master_interface as interface |
2026 | |
2027 | # Call the cmd interface main loop |
2028 | try: |
2029 | @@ -123,22 +123,21 @@ |
2030 | else: |
2031 | input_file = os.path.realpath(options.file) |
2032 | if options.web: |
2033 | - cmd_line = cmd_interface.MadGraphCmdWeb() |
2034 | + cmd_line = interface.MasterCmdWeb() |
2035 | cmd_line.debug_output = os.path.join(os.path.dirname(input_file),'generation.log') |
2036 | cmd_line.use_rawinput = False |
2037 | cmd_line.run_cmd('import ' + input_file) |
2038 | else: |
2039 | - cmd_line = cmd_interface.MadGraphCmdShell(mgme_dir = options.mgme_dir) |
2040 | + cmd_line = interface.MasterCmd(mgme_dir = options.mgme_dir) |
2041 | cmd_line.use_rawinput = False |
2042 | cmd_line.run_cmd('import ' + input_file) |
2043 | - |
2044 | else: |
2045 | # Interactive mode |
2046 | if options.web: |
2047 | - cmd_line = cmd_interface.MadGraphCmdWeb() |
2048 | + cmd_line = interface.MasterCmdWeb() |
2049 | cmd_line.cmdloop() |
2050 | else: |
2051 | - cmd_line = cmd_interface.MadGraphCmdShell(mgme_dir = options.mgme_dir) |
2052 | + cmd_line = interface.MasterCmd(mgme_dir = options.mgme_dir) |
2053 | cmd_line.cmdloop() |
2054 | except KeyboardInterrupt: |
2055 | print 'writting history and quit on KeyboardInterrupt' |
2056 | |
2057 | === modified file 'madgraph/VERSION' |
2058 | --- madgraph/VERSION 2012-02-16 17:58:28 +0000 |
2059 | +++ madgraph/VERSION 2012-03-08 17:31:22 +0000 |
2060 | @@ -1,3 +1,3 @@ |
2061 | -version = 1.4.2 |
2062 | -date = 2012-02-16 |
2063 | +version = 1.4.3 |
2064 | +date = 2012-03-08 |
2065 | |
2066 | |
2067 | === modified file 'madgraph/core/base_objects.py' |
2068 | --- madgraph/core/base_objects.py 2011-12-10 01:52:27 +0000 |
2069 | +++ madgraph/core/base_objects.py 2012-03-08 17:31:22 +0000 |
2070 | @@ -1519,6 +1519,7 @@ |
2071 | # allowed. This enables generating e.g. Z/gamma as s-channel |
2072 | # propagators. |
2073 | self['required_s_channels'] = [] |
2074 | + self['forbidden_onsh_s_channels'] = [] |
2075 | self['forbidden_s_channels'] = [] |
2076 | self['forbidden_particles'] = [] |
2077 | self['is_decay_chain'] = False |
2078 | @@ -1562,7 +1563,7 @@ |
2079 | raise self.PhysicsObjectError, \ |
2080 | "Not valid PDG code %d for s-channel particle" % i |
2081 | |
2082 | - if name == 'forbidden_s_channels': |
2083 | + if name in ['forbidden_onsh_s_channels', 'forbidden_s_channels']: |
2084 | if not isinstance(value, list): |
2085 | raise self.PhysicsObjectError, \ |
2086 | "%s is not a valid list" % str(value) |
2087 | @@ -1619,7 +1620,8 @@ |
2088 | """Return process property names as a nicely sorted list.""" |
2089 | |
2090 | return ['legs', 'orders', 'overall_orders', 'model', 'id', |
2091 | - 'required_s_channels', 'forbidden_s_channels', |
2092 | + 'required_s_channels', 'forbidden_onsh_s_channels', |
2093 | + 'forbidden_s_channels', |
2094 | 'forbidden_particles', 'is_decay_chain', 'decay_chains'] |
2095 | |
2096 | def nice_string(self, indent=0): |
2097 | @@ -1648,8 +1650,15 @@ |
2098 | prevleg = leg |
2099 | |
2100 | # Add forbidden s-channels |
2101 | + if self['forbidden_onsh_s_channels']: |
2102 | + mystr = mystr + '$ ' |
2103 | + for forb_id in self['forbidden_onsh_s_channels']: |
2104 | + forbpart = self['model'].get('particle_dict')[forb_id] |
2105 | + mystr = mystr + forbpart.get_name() + ' ' |
2106 | + |
2107 | + # Add double forbidden s-channels |
2108 | if self['forbidden_s_channels']: |
2109 | - mystr = mystr + '$ ' |
2110 | + mystr = mystr + '$$ ' |
2111 | for forb_id in self['forbidden_s_channels']: |
2112 | forbpart = self['model'].get('particle_dict')[forb_id] |
2113 | mystr = mystr + forbpart.get_name() + ' ' |
2114 | @@ -1710,8 +1719,15 @@ |
2115 | prevleg = leg |
2116 | |
2117 | # Add forbidden s-channels |
2118 | + if self['forbidden_onsh_s_channels']: |
2119 | + mystr = mystr + '$ ' |
2120 | + for forb_id in self['forbidden_onsh_s_channels']: |
2121 | + forbpart = self['model'].get('particle_dict')[forb_id] |
2122 | + mystr = mystr + forbpart.get_name() + ' ' |
2123 | + |
2124 | + # Add double forbidden s-channels |
2125 | if self['forbidden_s_channels']: |
2126 | - mystr = mystr + '$ ' |
2127 | + mystr = mystr + '$$ ' |
2128 | for forb_id in self['forbidden_s_channels']: |
2129 | forbpart = self['model'].get('particle_dict')[forb_id] |
2130 | mystr = mystr + forbpart.get_name() + ' ' |
2131 | @@ -2134,8 +2150,15 @@ |
2132 | prevleg = leg |
2133 | |
2134 | # Add forbidden s-channels |
2135 | + if self['forbidden_onsh_s_channels']: |
2136 | + mystr = mystr + '$ ' |
2137 | + for forb_id in self['forbidden_onsh_s_channels']: |
2138 | + forbpart = self['model'].get('particle_dict')[forb_id] |
2139 | + mystr = mystr + forbpart.get_name() + ' ' |
2140 | + |
2141 | + # Add double forbidden s-channels |
2142 | if self['forbidden_s_channels']: |
2143 | - mystr = mystr + '$ ' |
2144 | + mystr = mystr + '$$ ' |
2145 | for forb_id in self['forbidden_s_channels']: |
2146 | forbpart = self['model'].get('particle_dict')[forb_id] |
2147 | mystr = mystr + forbpart.get_name() + ' ' |
2148 | |
2149 | === modified file 'madgraph/core/diagram_generation.py' |
2150 | --- madgraph/core/diagram_generation.py 2011-11-22 08:36:23 +0000 |
2151 | +++ madgraph/core/diagram_generation.py 2012-03-08 17:31:22 +0000 |
2152 | @@ -544,18 +544,31 @@ |
2153 | # Add diagrams only if not already in res |
2154 | res.extend([diag for diag in res_diags if diag not in res]) |
2155 | |
2156 | - # Select the diagrams where no forbidden s-channel propagators |
2157 | - # are present. |
2158 | + # Remove all diagrams with a "double" forbidden s-channel propagator |
2159 | + # is present. |
2160 | # Note that we shouldn't look at the last vertex in each |
2161 | # diagram, since that is the n->0 vertex |
2162 | if process.get('forbidden_s_channels'): |
2163 | ninitial = len(filter(lambda leg: leg.get('state') == False, |
2164 | + process.get('legs'))) |
2165 | + res = base_objects.DiagramList(\ |
2166 | + filter(lambda diagram: \ |
2167 | + not any([vertex.get_s_channel_id(\ |
2168 | + process.get('model'), ninitial) \ |
2169 | + in process.get('forbidden_s_channels') |
2170 | + for vertex in diagram.get('vertices')[:-1]]), |
2171 | + res)) |
2172 | + |
2173 | + # Mark forbidden (onshell) s-channel propagators, to forbid onshell |
2174 | + # generation. |
2175 | + if process.get('forbidden_onsh_s_channels'): |
2176 | + ninitial = len(filter(lambda leg: leg.get('state') == False, |
2177 | process.get('legs'))) |
2178 | verts = base_objects.VertexList(sum([[vertex for vertex \ |
2179 | in diagram.get('vertices')[:-1] |
2180 | if vertex.get_s_channel_id(\ |
2181 | process.get('model'), ninitial) \ |
2182 | - in process.get('forbidden_s_channels')] \ |
2183 | + in process.get('forbidden_onsh_s_channels')] \ |
2184 | for diagram in res], [])) |
2185 | for vert in verts: |
2186 | # Use onshell = False to indicate that this s-channel is forbidden |
2187 | @@ -1306,6 +1319,8 @@ |
2188 | 'orders': process_definition.get('orders'), |
2189 | 'required_s_channels': \ |
2190 | process_definition.get('required_s_channels'), |
2191 | + 'forbidden_onsh_s_channels': \ |
2192 | + process_definition.get('forbidden_onsh_s_channels'), |
2193 | 'forbidden_s_channels': \ |
2194 | process_definition.get('forbidden_s_channels'), |
2195 | 'forbidden_particles': \ |
2196 | @@ -1339,6 +1354,7 @@ |
2197 | # Check for successful crossings, unless we have specified |
2198 | # properties that break crossing symmetry |
2199 | if not process.get('required_s_channels') and \ |
2200 | + not process.get('forbidden_onsh_s_channels') and \ |
2201 | not process.get('forbidden_s_channels') and \ |
2202 | not process.get('is_decay_chain'): |
2203 | try: |
2204 | @@ -1517,6 +1533,8 @@ |
2205 | 'orders': coupling_orders_now, |
2206 | 'required_s_channels': \ |
2207 | process_definition.get('required_s_channels'), |
2208 | + 'forbidden_onsh_s_channels': \ |
2209 | + process_definition.get('forbidden_onsh_s_channels'), |
2210 | 'forbidden_s_channels': \ |
2211 | process_definition.get('forbidden_s_channels'), |
2212 | 'forbidden_particles': \ |
2213 | |
2214 | === modified file 'madgraph/interface/coloring_logging.py' |
2215 | --- madgraph/interface/coloring_logging.py 2011-12-14 22:12:33 +0000 |
2216 | +++ madgraph/interface/coloring_logging.py 2012-03-08 17:31:22 +0000 |
2217 | @@ -3,9 +3,9 @@ |
2218 | BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE = range(8) |
2219 | |
2220 | COLORS = { |
2221 | - 'WARNING' : RED, |
2222 | + 'WARNING' : BLUE, |
2223 | 'INFO' : BLACK, |
2224 | - 'DEBUG' : BLUE, |
2225 | + 'DEBUG' : GREEN, |
2226 | 'CRITICAL' : RED, |
2227 | 'ERROR' : RED, |
2228 | 'RED' : RED, |
2229 | |
2230 | === modified file 'madgraph/interface/extended_cmd.py' |
2231 | --- madgraph/interface/extended_cmd.py 2012-02-03 21:44:27 +0000 |
2232 | +++ madgraph/interface/extended_cmd.py 2012-03-08 17:31:22 +0000 |
2233 | @@ -35,10 +35,14 @@ |
2234 | logger_stderr = logging.getLogger('fatalerror') # for stderr |
2235 | |
2236 | try: |
2237 | - import madgraph.iolibs.misc as misc |
2238 | + import madgraph.various.misc as misc |
2239 | + from madgraph import MG5DIR |
2240 | + MADEVENT = False |
2241 | except: |
2242 | import internal.misc as misc |
2243 | + MADEVENT = True |
2244 | |
2245 | +pjoin = os.path.join |
2246 | |
2247 | class TimeOutError(Exception): |
2248 | """Class for run-time error""" |
2249 | @@ -829,7 +833,12 @@ |
2250 | continue |
2251 | prevname = name |
2252 | cmdname=name[3:] |
2253 | - doc = getattr(self, name).__doc__ |
2254 | + try: |
2255 | + doc = getattr(self.cmd, name).__doc__ |
2256 | + except: |
2257 | + doc = None |
2258 | + if not doc: |
2259 | + doc = getattr(self, name).__doc__ |
2260 | if not doc: |
2261 | tag = "Documented commands" |
2262 | elif ':' in doc: |
2263 | @@ -900,7 +909,7 @@ |
2264 | |
2265 | if args[0] == "options": |
2266 | outstr = "Value of current Options:\n" |
2267 | - for key, value in self.configuration.items() + self._options.items(): |
2268 | + for key, value in self.options.items(): |
2269 | outstr += '%25s \t:\t%s\n' %(key,value) |
2270 | output.write(outstr) |
2271 | |
2272 | @@ -923,6 +932,7 @@ |
2273 | outstr += misc.nice_representation(var, nb_space=4) |
2274 | |
2275 | pydoc.pager(outstr) |
2276 | + |
2277 | |
2278 | def help_display(self): |
2279 | """help for display command""" |
2280 | @@ -934,7 +944,123 @@ |
2281 | # Format |
2282 | if len(args) == 1: |
2283 | return self.list_completion(text, self._display_opts) |
2284 | - |
2285 | + |
2286 | + def do_save(self, line, check=True): |
2287 | + """Save the configuration file""" |
2288 | + |
2289 | + args = self.split_arg(line) |
2290 | + # Check argument validity |
2291 | + if check: |
2292 | + Cmd.check_save(self, args) |
2293 | + |
2294 | + # find base file for the configuration |
2295 | + if'HOME' in os.environ and os.environ['HOME'] and \ |
2296 | + os.path.exists(pjoin(os.environ['HOME'], '.mg5', 'mg5_configuration.txt')): |
2297 | + base = pjoin(os.environ['HOME'], '.mg5', 'mg5_configuration.txt') |
2298 | + if hasattr(self, 'me_dir'): |
2299 | + basedir = self.me_dir |
2300 | + elif not MADEVENT: |
2301 | + basedir = MG5DIR |
2302 | + else: |
2303 | + basedir = os.getcwd() |
2304 | + elif MADEVENT: |
2305 | + # launch via ./bin/madevent |
2306 | + base = pjoin(self.me_dir, 'Cards', 'me5_configuration.txt') |
2307 | + basedir = self.me_dir |
2308 | + else: |
2309 | + if hasattr(self, 'me_dir'): |
2310 | + base = pjoin(self.me_dir, 'Cards', 'me5_configuration.txt') |
2311 | + if len(args) == 0 and os.path.exists(base): |
2312 | + self.write_configuration(base, base, self.me_dir) |
2313 | + base = pjoin(MG5DIR, 'input', 'mg5_configuration.txt') |
2314 | + basedir = MG5DIR |
2315 | + |
2316 | + if len(args) == 0: |
2317 | + args.append(base) |
2318 | + self.write_configuration(args[0], base, basedir) |
2319 | + |
2320 | + def check_save(self, args): |
2321 | + """check that the line is compatible with save options""" |
2322 | + |
2323 | + if len(args) > 2: |
2324 | + self.help_save() |
2325 | + raise self.InvalidCmd, '\'%s\' is not recoginzed as first argument.' |
2326 | + |
2327 | + if len(args) == 2: |
2328 | + if args[0] != 'options': |
2329 | + self.help_save() |
2330 | + raise self.InvalidCmd, '\'%s\' is not recoginzed as first argument.' % \ |
2331 | + args[0] |
2332 | + else: |
2333 | + args.pop(0) |
2334 | + |
2335 | + def help_save(self): |
2336 | + """help text for save""" |
2337 | + logger.info("syntax: save [options] [FILEPATH]") |
2338 | + logger.info("-- save options configuration to filepath.") |
2339 | + |
2340 | + def complete_save(self, text, line, begidx, endidx): |
2341 | + "Complete the save command" |
2342 | + |
2343 | + args = self.split_arg(line[0:begidx]) |
2344 | + |
2345 | + # Format |
2346 | + if len(args) == 1: |
2347 | + return self.list_completion(text, ['options']) |
2348 | + |
2349 | + # Directory continuation |
2350 | + if args[-1].endswith(os.path.sep): |
2351 | + return self.path_completion(text, |
2352 | + pjoin('.',*[a for a in args if a.endswith(os.path.sep)]), |
2353 | + only_dirs = True) |
2354 | + |
2355 | + # Filename if directory is not given |
2356 | + if len(args) == 2: |
2357 | + return self.path_completion(text) |
2358 | + |
2359 | + def write_configuration(self, filepath, basefile, basedir): |
2360 | + """Write the configuration file""" |
2361 | + # We use the default configuration file as a template. |
2362 | + # to ensure that all configuration information are written we |
2363 | + # keep track of all key that we need to write. |
2364 | + |
2365 | + logger.info('save configuration file to %s' % filepath) |
2366 | + to_write = self.options.keys()[:] |
2367 | + text = "" |
2368 | + # Use local configuration => Need to update the path |
2369 | + for line in file(basefile): |
2370 | + if '#' in line: |
2371 | + data, comment = line.split('#',1) |
2372 | + else: |
2373 | + data, comment = line, '' |
2374 | + data = data.split('=') |
2375 | + if len(data) !=2: |
2376 | + text += line |
2377 | + continue |
2378 | + key = data[0].strip() |
2379 | + if key in self.options: |
2380 | + value = str(self.options[key]) |
2381 | + else: |
2382 | + value = data[1].strip() |
2383 | + try: |
2384 | + to_write.remove(key) |
2385 | + except: |
2386 | + pass |
2387 | + if '_path' in key: |
2388 | + # special case need to update path |
2389 | + # check if absolute path |
2390 | + if value.startswith('./'): |
2391 | + value = os.path.realpath(os.path.join(basedir, value)) |
2392 | + text += '%s = %s # %s \n' % (key, value, comment) |
2393 | + for key in to_write: |
2394 | + if key in self.options: |
2395 | + text += '%s = %s \n' % (key,self.options[key]) |
2396 | + else: |
2397 | + text += '%s = %s \n' % (key,self.options[key]) |
2398 | + writer = open(filepath,'w') |
2399 | + writer.write(text) |
2400 | + writer.close() |
2401 | + |
2402 | def help_help(self): |
2403 | logger.info("syntax: help") |
2404 | logger.info("-- access to the in-line help" ) |
2405 | |
2406 | === modified file 'madgraph/interface/launch_ext_program.py' |
2407 | --- madgraph/interface/launch_ext_program.py 2012-02-09 18:46:27 +0000 |
2408 | +++ madgraph/interface/launch_ext_program.py 2012-03-08 17:31:22 +0000 |
2409 | @@ -24,12 +24,15 @@ |
2410 | import time |
2411 | |
2412 | import madgraph.iolibs.files as files |
2413 | -import madgraph.iolibs.misc as misc |
2414 | import madgraph.interface.extended_cmd as cmd |
2415 | import madgraph.interface.madevent_interface as me_cmd |
2416 | +import madgraph.various.misc as misc |
2417 | + |
2418 | from madgraph import MG4DIR, MG5DIR, MadGraph5Error |
2419 | from madgraph.iolibs.files import cp |
2420 | |
2421 | + |
2422 | + |
2423 | logger = logging.getLogger('cmdprint.ext_program') |
2424 | |
2425 | class ExtLauncher(object): |
2426 | |
2427 | === modified file 'madgraph/interface/madevent_interface.py' |
2428 | --- madgraph/interface/madevent_interface.py 2012-02-17 21:52:21 +0000 |
2429 | +++ madgraph/interface/madevent_interface.py 2012-03-08 17:31:22 +0000 |
2430 | @@ -50,13 +50,14 @@ |
2431 | try: |
2432 | # import from madgraph directory |
2433 | import madgraph.interface.extended_cmd as cmd |
2434 | - import madgraph.iolibs.misc as misc |
2435 | import madgraph.iolibs.files as files |
2436 | import madgraph.iolibs.save_load_object as save_load_object |
2437 | + import madgraph.various.banner as banner_mod |
2438 | + import madgraph.various.cluster as cluster |
2439 | import madgraph.various.gen_crossxhtml as gen_crossxhtml |
2440 | - import madgraph.various.cluster as cluster |
2441 | import madgraph.various.sum_html as sum_html |
2442 | - import madgraph.various.banner as banner_mod |
2443 | + import madgraph.various.misc as misc |
2444 | + |
2445 | import models.check_param_card as check_param_card |
2446 | from madgraph import InvalidCmd, MadGraph5Error |
2447 | MADEVENT = False |
2448 | @@ -300,7 +301,7 @@ |
2449 | |
2450 | logger.info("-- session options:") |
2451 | logger.info(" Note that those options will be kept for the current session") |
2452 | - logger.info(" --cluster : Submit to the cluster. Current cluster: %s" % self.configuration['cluster_mode']) |
2453 | + logger.info(" --cluster : Submit to the cluster. Current cluster: %s" % self.options['cluster_mode']) |
2454 | logger.info(" --multicore : Run in multi-core configuration") |
2455 | logger.info(" --nb_core=X : limit the number of core to use to X.") |
2456 | |
2457 | @@ -429,7 +430,7 @@ |
2458 | tag = [a[6:] for a in args if a.startswith('--tag=')] |
2459 | |
2460 | |
2461 | - if os.path.exists(args[0]): |
2462 | + if os.path.isfile(args[0]): |
2463 | type ='banner' |
2464 | format = self.detect_card_type(args[0]) |
2465 | if format != 'banner': |
2466 | @@ -494,7 +495,7 @@ |
2467 | self.help_set() |
2468 | raise self.InvalidCmd('set needs an option and an argument') |
2469 | |
2470 | - if args[0] not in self._set_options + self.configuration.keys(): |
2471 | + if args[0] not in self._set_options + self.options.keys(): |
2472 | self.help_set() |
2473 | raise self.InvalidCmd('Possible options for set are %s' % \ |
2474 | self._set_options) |
2475 | @@ -587,10 +588,10 @@ |
2476 | if run not in ['auto','parton', 'pythia', 'pgs', 'delphes']: |
2477 | self.help_generate_events() |
2478 | raise self.InvalidCmd('invalid %s argument'% args[-1]) |
2479 | - if run != 'parton' and not self.configuration['pythia-pgs_path']: |
2480 | + if run != 'parton' and not self.options['pythia-pgs_path']: |
2481 | raise self.InvalidCmd('''pythia-pgs not install. Please install this package first. |
2482 | To do so type: \'install pythia-pgs\' in the mg5 interface''') |
2483 | - if run == 'delphes' and not self.configuration['delphes_path']: |
2484 | + if run == 'delphes' and not self.options['delphes_path']: |
2485 | raise self.InvalidCmd('''delphes not install. Please install this package first. |
2486 | To do so type: \'install Delphes\' in the mg5 interface''') |
2487 | del args[-1] |
2488 | @@ -645,10 +646,10 @@ |
2489 | if run not in ['parton', 'pythia', 'pgs', 'delphes']: |
2490 | self.help_multi_run() |
2491 | raise self.InvalidCmd('invalid %s argument'% args[-1]) |
2492 | - if run != 'parton' and not self.configuration['pythia-pgs_path']: |
2493 | + if run != 'parton' and not self.options['pythia-pgs_path']: |
2494 | raise self.InvalidCmd('''pythia-pgs not install. Please install this package first. |
2495 | To do so type: \'install pythia-pgs\' in the mg5 interface''') |
2496 | - if run == 'delphes' and not self.configuration['delphes_path']: |
2497 | + if run == 'delphes' and not self.options['delphes_path']: |
2498 | raise self.InvalidCmd('''delphes not install. Please install this package first. |
2499 | To do so type: \'install Delphes\' in the mg5 interface''') |
2500 | del args[-1] |
2501 | @@ -759,12 +760,12 @@ |
2502 | |
2503 | |
2504 | # If not pythia-pgs path |
2505 | - if not self.configuration['pythia-pgs_path']: |
2506 | + if not self.options['pythia-pgs_path']: |
2507 | logger.info('Retry to read configuration file to find pythia-pgs path') |
2508 | self.set_configuration() |
2509 | |
2510 | - if not self.configuration['pythia-pgs_path'] or not \ |
2511 | - os.path.exists(pjoin(self.configuration['pythia-pgs_path'],'src')): |
2512 | + if not self.options['pythia-pgs_path'] or not \ |
2513 | + os.path.exists(pjoin(self.options['pythia-pgs_path'],'src')): |
2514 | error_msg = 'No pythia-pgs path correctly set.' |
2515 | error_msg += 'Please use the set command to define the path and retry.' |
2516 | error_msg += 'You can also define it in the configuration file.' |
2517 | @@ -808,15 +809,15 @@ |
2518 | """Check the argument for the plot command |
2519 | plot run_name modes""" |
2520 | |
2521 | - madir = self.configuration['madanalysis_path'] |
2522 | - td = self.configuration['td_path'] |
2523 | + madir = self.options['madanalysis_path'] |
2524 | + td = self.options['td_path'] |
2525 | |
2526 | if not madir or not td: |
2527 | logger.info('Retry to read configuration file to find madanalysis/td') |
2528 | self.set_configuration() |
2529 | |
2530 | - madir = self.configuration['madanalysis_path'] |
2531 | - td = self.configuration['td_path'] |
2532 | + madir = self.options['madanalysis_path'] |
2533 | + td = self.options['td_path'] |
2534 | |
2535 | if not madir: |
2536 | error_msg = 'No Madanalysis path correctly set.' |
2537 | @@ -830,7 +831,7 @@ |
2538 | raise self.InvalidCmd(error_msg) |
2539 | |
2540 | if len(args) == 0: |
2541 | - if not hasattr(self, 'run_name'): |
2542 | + if not hasattr(self, 'run_name') or not self.run_name: |
2543 | self.help_plot() |
2544 | raise self.InvalidCmd('No run name currently define. Please add this information.') |
2545 | args.append('all') |
2546 | @@ -842,7 +843,7 @@ |
2547 | force = True |
2548 | |
2549 | if args[0] not in self._plot_mode: |
2550 | - self.set_run_name(args[0]) |
2551 | + self.set_run_name(args[0], level='plot') |
2552 | del args[0] |
2553 | if len(args) == 0: |
2554 | args.append('all') |
2555 | @@ -866,12 +867,12 @@ |
2556 | """ |
2557 | |
2558 | # If not pythia-pgs path |
2559 | - if not self.configuration['pythia-pgs_path']: |
2560 | + if not self.options['pythia-pgs_path']: |
2561 | logger.info('Retry to read configuration file to find pythia-pgs path') |
2562 | self.set_configuration() |
2563 | |
2564 | - if not self.configuration['pythia-pgs_path'] or not \ |
2565 | - os.path.exists(pjoin(self.configuration['pythia-pgs_path'],'src')): |
2566 | + if not self.options['pythia-pgs_path'] or not \ |
2567 | + os.path.exists(pjoin(self.options['pythia-pgs_path'],'src')): |
2568 | error_msg = 'No pythia-pgs path correctly set.' |
2569 | error_msg += 'Please use the set command to define the path and retry.' |
2570 | error_msg += 'You can also define it in the configuration file.' |
2571 | @@ -920,11 +921,11 @@ |
2572 | """ |
2573 | |
2574 | # If not pythia-pgs path |
2575 | - if not self.configuration['delphes_path']: |
2576 | + if not self.options['delphes_path']: |
2577 | logger.info('Retry to read configuration file to find delphes path') |
2578 | self.set_configuration() |
2579 | |
2580 | - if not self.configuration['delphes_path']: |
2581 | + if not self.options['delphes_path']: |
2582 | error_msg = 'No delphes path correctly set.' |
2583 | error_msg += 'Please use the set command to define the path and retry.' |
2584 | error_msg += 'You can also define it in the configuration file.' |
2585 | @@ -938,7 +939,7 @@ |
2586 | |
2587 | if len(arg) == 0 and not self.run_name: |
2588 | if self.results.lastrun: |
2589 | - args.insert(0, self.results.lastrun) |
2590 | + arg.insert(0, self.results.lastrun) |
2591 | else: |
2592 | raise self.InvalidCmd('No run name currently define. Please add this information.') |
2593 | |
2594 | @@ -1099,7 +1100,7 @@ |
2595 | |
2596 | # Format |
2597 | if len(args) == 1: |
2598 | - return self.list_completion(text, self._set_options + self.configuration.keys() ) |
2599 | + return self.list_completion(text, self._set_options + self.options.keys() ) |
2600 | |
2601 | if len(args) == 2: |
2602 | if args[1] == 'stdout_level': |
2603 | @@ -1331,7 +1332,7 @@ |
2604 | raise MadEventAlreadyRunning, message |
2605 | else: |
2606 | os.system('touch %s' % pjoin(me_dir,'RunWeb')) |
2607 | - subprocess.call(['%s/gen_cardhtml-pl' % self.dirbin], cwd=me_dir) |
2608 | + subprocess.Popen([pjoin(self.dirbin, 'gen_cardhtml-pl')], cwd=me_dir) |
2609 | |
2610 | self.to_store = [] |
2611 | self.run_name = None |
2612 | @@ -1339,10 +1340,15 @@ |
2613 | self.banner = None |
2614 | |
2615 | # Get number of initial states |
2616 | - nexternal = open(pjoin(me_dir,'Source','nexternal.inc')).read() |
2617 | - found = re.search("PARAMETER\s*\(NINCOMING=(\d)\)", nexternal) |
2618 | - self.ninitial = int(found.group(1)) |
2619 | - |
2620 | + try: |
2621 | + nexternal = open(pjoin(me_dir,'Source','nexternal.inc')).read() |
2622 | + found = re.search("PARAMETER\s*\(NINCOMING=(\d)\)", nexternal) |
2623 | + self.ninitial = int(found.group(1)) |
2624 | + except: |
2625 | + # in gridpack this file might be remove. In that case, let suppose |
2626 | + # that ninitial is 2 |
2627 | + self.ninitial = 2 |
2628 | + |
2629 | # Load the configuration file |
2630 | self.set_configuration() |
2631 | self.timeout = 20 |
2632 | @@ -1407,8 +1413,8 @@ |
2633 | self.nb_core = multiprocessing.cpu_count() |
2634 | |
2635 | if self.cluster_mode == 1 and not hasattr(self, 'cluster'): |
2636 | - cluster_name = self.configuration['cluster_type'] |
2637 | - self.cluster = cluster.from_name[cluster_name](self.configuration['cluster_queue']) |
2638 | + cluster_name = self.options['cluster_type'] |
2639 | + self.cluster = cluster.from_name[cluster_name](self.options['cluster_queue']) |
2640 | return args |
2641 | |
2642 | ############################################################################ |
2643 | @@ -1426,7 +1432,7 @@ |
2644 | """ assign all configuration variable from file |
2645 | ./Cards/mg5_configuration.txt. assign to default if not define """ |
2646 | |
2647 | - self.configuration = {'pythia8_path': './pythia8', |
2648 | + self.options = {'pythia8_path': './pythia8', |
2649 | 'pythia-pgs_path': '../pythia-pgs', |
2650 | 'delphes_path': '../Delphes', |
2651 | 'madanalysis_path': '../MadAnalysis', |
2652 | @@ -1476,43 +1482,43 @@ |
2653 | else: |
2654 | name = name.strip() |
2655 | value = value.strip() |
2656 | - self.configuration[name] = value |
2657 | + self.options[name] = value |
2658 | if value.lower() == "none": |
2659 | - self.configuration[name] = None |
2660 | + self.options[name] = None |
2661 | |
2662 | # Treat each expected input |
2663 | # delphes/pythia/... path |
2664 | - for key in self.configuration: |
2665 | + for key in self.options: |
2666 | if key.endswith('path'): |
2667 | - if self.configuration[key] in ['None', None]: |
2668 | - self.configuration[key] = '' |
2669 | + if self.options[key] in ['None', None]: |
2670 | + self.options[key] = '' |
2671 | continue |
2672 | - path = os.path.join(self.me_dir, self.configuration[key]) |
2673 | + path = os.path.join(self.me_dir, self.options[key]) |
2674 | if os.path.isdir(path): |
2675 | - self.configuration[key] = os.path.realpath(path) |
2676 | - continue |
2677 | - if os.path.isdir(self.configuration[key]): |
2678 | - self.configuration[key] = os.path.realpath(self.configuration[key]) |
2679 | - continue |
2680 | - elif not os.path.isdir(self.configuration[key]): |
2681 | - self.configuration[key] = '' |
2682 | + self.options[key] = os.path.realpath(path) |
2683 | + continue |
2684 | + if os.path.isdir(self.options[key]): |
2685 | + self.options[key] = os.path.realpath(self.options[key]) |
2686 | + continue |
2687 | + elif not os.path.isdir(self.options[key]): |
2688 | + self.options[key] = '' |
2689 | elif key.startswith('cluster'): |
2690 | pass |
2691 | elif key == 'automatic_html_opening': |
2692 | - if self.configuration[key] in ['False', 'True']: |
2693 | - self.configuration[key] =eval(self.configuration[key]) |
2694 | + if self.options[key] in ['False', 'True']: |
2695 | + self.options[key] =eval(self.options[key]) |
2696 | elif key not in ['text_editor','eps_viewer','web_browser']: |
2697 | # Default: try to set parameter |
2698 | try: |
2699 | - self.do_set("%s %s" % (key, self.configuration[key])) |
2700 | + self.do_set("%s %s" % (key, self.options[key])) |
2701 | except self.InvalidCmd: |
2702 | logger.warning("Option %s from config file not understood" \ |
2703 | % key) |
2704 | |
2705 | # Configure the way to open a file: |
2706 | - misc.open_file.configure(self.configuration) |
2707 | + misc.open_file.configure(self.options) |
2708 | |
2709 | - return self.configuration |
2710 | + return self.options |
2711 | |
2712 | ############################################################################ |
2713 | def do_banner_run(self, line): |
2714 | @@ -1619,37 +1625,37 @@ |
2715 | logging.getLogger('madgraph').setLevel(eval('logging.' + args[1])) |
2716 | logger.info('set output information to level: %s' % args[1]) |
2717 | elif args[0] == "fortran_compiler": |
2718 | - self.configuration['fortran_compiler'] = args[1] |
2719 | + self.options['fortran_compiler'] = args[1] |
2720 | elif args[0] == "run_mode": |
2721 | if not args[1] in [0,1,2,'0','1','2']: |
2722 | raise self.InvalidCmd, 'run_mode should be 0, 1 or 2.' |
2723 | self.cluster_mode = int(args[1]) |
2724 | - self.configuration['cluster_mode'] = self.cluster_mode |
2725 | + self.options['cluster_mode'] = self.cluster_mode |
2726 | elif args[0] == 'cluster_type': |
2727 | - self.configuration['cluster_mode'] = args[1] |
2728 | - self.cluster = cluster.from_name[args[1]](self.configuration['cluster_queue']) |
2729 | + self.options['cluster_mode'] = args[1] |
2730 | + self.cluster = cluster.from_name[args[1]](self.options['cluster_queue']) |
2731 | elif args[0] == 'nb_core': |
2732 | if args[1] == 'None': |
2733 | import multiprocessing |
2734 | self.nb_core = multiprocessing.cpu_count() |
2735 | - self.configuration['nb_core'] = self.nb_core |
2736 | + self.options['nb_core'] = self.nb_core |
2737 | return |
2738 | if not args[1].isdigit(): |
2739 | raise self.InvalidCmd('nb_core should be a positive number') |
2740 | self.nb_core = int(args[1]) |
2741 | - self.configuration['nb_core'] = self.nb_core |
2742 | - elif args[0] in self.configuration: |
2743 | + self.options['nb_core'] = self.nb_core |
2744 | + elif args[0] in self.options: |
2745 | if args[1] in ['None','True','False']: |
2746 | - self.configuration[args[0]] = eval(args[1]) |
2747 | + self.options[args[0]] = eval(args[1]) |
2748 | elif args[0].endswith('path'): |
2749 | if os.path.exists(args[1]): |
2750 | - self.configuration[args[0]] = args[1] |
2751 | + self.options[args[0]] = args[1] |
2752 | elif os.path.exists(pjoin(self.me_dir, args[1])): |
2753 | - self.configuration[args[0]] = pjoin(self.me_dir, args[1]) |
2754 | + self.options[args[0]] = pjoin(self.me_dir, args[1]) |
2755 | else: |
2756 | - raise self.InvalidCmd('Not a valid path: keep previous value: \'%s\'' % self.configuration[args[0]]) |
2757 | + raise self.InvalidCmd('Not a valid path: keep previous value: \'%s\'' % self.options[args[0]]) |
2758 | else: |
2759 | - self.configuration[args[0]] = args[1] |
2760 | + self.options[args[0]] = args[1] |
2761 | |
2762 | |
2763 | ############################################################################ |
2764 | @@ -1728,7 +1734,8 @@ |
2765 | self.exec_cmd('pythia --no_default', postcmd=False, printcmd=False) |
2766 | # pythia launches pgs/delphes if needed |
2767 | self.store_result() |
2768 | - self.print_results_in_shell(self.results.current) |
2769 | + |
2770 | + self.print_results_in_shell(self.results.current) |
2771 | |
2772 | |
2773 | def print_results_in_shell(self, data): |
2774 | @@ -1931,7 +1938,7 @@ |
2775 | % {'bin': self.dirbin, 'event': pjoin(self.me_dir,'Events'), |
2776 | 'name': self.run_name}) |
2777 | |
2778 | - eradir = self.configuration['exrootanalysis_path'] |
2779 | + eradir = self.options['exrootanalysis_path'] |
2780 | if eradir and misc.is_executable(pjoin(eradir,'ExRootLHEFConverter')): |
2781 | self.update_status("Create Root file", level='parton') |
2782 | os.system('gunzip %s/%s/unweighted_events.lhe.gz' % |
2783 | @@ -2042,6 +2049,7 @@ |
2784 | self.total_jobs = 0 |
2785 | subproc = [l.strip() for l in open(pjoin(self.me_dir,'SubProcesses', |
2786 | 'subproc.mg'))] |
2787 | + devnull = os.open(os.devnull, os.O_RDWR) |
2788 | for nb_proc,subdir in enumerate(subproc): |
2789 | subdir = subdir.strip() |
2790 | Pdir = pjoin(self.me_dir, 'SubProcesses',subdir) |
2791 | @@ -2053,7 +2061,6 @@ |
2792 | if os.path.basename(match)[:4] in ['ajob', 'wait', 'run.', 'done']: |
2793 | os.remove(pjoin(Pdir, match)) |
2794 | |
2795 | - devnull = os.open(os.devnull, os.O_RDWR) |
2796 | proc = subprocess.Popen([pjoin(bindir, 'gen_ximprove')], |
2797 | stdout=devnull, |
2798 | stdin=subprocess.PIPE, |
2799 | @@ -2118,6 +2125,7 @@ |
2800 | # Define The Banner |
2801 | tag = self.run_card['run_tag'] |
2802 | self.banner.load_basic(self.me_dir) |
2803 | + self.banner.change_seed(self.random) |
2804 | if not os.path.exists(pjoin(self.me_dir, 'Events', self.run_name)): |
2805 | os.mkdir(pjoin(self.me_dir, 'Events', self.run_name)) |
2806 | self.banner.write(pjoin(self.me_dir, 'Events', self.run_name, |
2807 | @@ -2136,9 +2144,9 @@ |
2808 | # 'unweighted_events.lhe', 'banner.txt'], |
2809 | # cwd=pjoin(self.me_dir, 'Events')) |
2810 | |
2811 | - eradir = self.configuration['exrootanalysis_path'] |
2812 | - madir = self.configuration['madanalysis_path'] |
2813 | - td = self.configuration['td_path'] |
2814 | + eradir = self.options['exrootanalysis_path'] |
2815 | + madir = self.options['madanalysis_path'] |
2816 | + td = self.options['td_path'] |
2817 | if eradir and misc.is_executable(pjoin(eradir,'ExRootLHEFConverter')) and\ |
2818 | os.path.exists(pjoin(self.me_dir, 'Events', 'unweighted_events.lhe')): |
2819 | if not os.path.exists(pjoin(self.me_dir, 'Events', self.run_name)): |
2820 | @@ -2191,6 +2199,16 @@ |
2821 | files.mv(input, output) |
2822 | subprocess.call(['gzip', output], stdout=devnull, |
2823 | stderr=devnull, cwd=G_path) |
2824 | + |
2825 | + # 2) restore links in local this is require due to chrome over-security |
2826 | + if not self.web: |
2827 | + results = pjoin(self.me_dir, 'HTML', run, 'results.html') |
2828 | + text = open(results).read() |
2829 | + text = text.replace('''if ( ! UrlExists(alt)){ |
2830 | + obj.href = alt;''','''if ( ! UrlExists(alt)){ |
2831 | + obj.href = url;''') |
2832 | + open(results, 'w').write(text) |
2833 | + |
2834 | # 3) Update the index.html |
2835 | subprocess.call(['%s/gen_cardhtml-pl' % self.dirbin], |
2836 | cwd=pjoin(self.me_dir)) |
2837 | @@ -2274,7 +2292,7 @@ |
2838 | |
2839 | #self.exec_cmd('remove %s pythia -f' % self.run_name) |
2840 | |
2841 | - pythia_src = pjoin(self.configuration['pythia-pgs_path'],'src') |
2842 | + pythia_src = pjoin(self.options['pythia-pgs_path'],'src') |
2843 | |
2844 | self.update_status('Running Pythia', 'pythia') |
2845 | try: |
2846 | @@ -2317,10 +2335,10 @@ |
2847 | cs_info = cs_info.split(':')[1] |
2848 | self.results.add_detail('cross_pythia', cs_info) |
2849 | |
2850 | - pydir = pjoin(self.configuration['pythia-pgs_path'], 'src') |
2851 | - eradir = self.configuration['exrootanalysis_path'] |
2852 | - madir = self.configuration['madanalysis_path'] |
2853 | - td = self.configuration['td_path'] |
2854 | + pydir = pjoin(self.options['pythia-pgs_path'], 'src') |
2855 | + eradir = self.options['exrootanalysis_path'] |
2856 | + madir = self.options['madanalysis_path'] |
2857 | + td = self.options['td_path'] |
2858 | |
2859 | |
2860 | self.banner.add(pjoin(self.me_dir, 'Cards','pythia_card.dat')) |
2861 | @@ -2387,7 +2405,7 @@ |
2862 | |
2863 | self.update_status('finish', level='pythia', makehtml=False) |
2864 | self.exec_cmd('pgs --no_default', postcmd=False, printcmd=False) |
2865 | - if self.configuration['delphes_path']: |
2866 | + if self.options['delphes_path']: |
2867 | self.exec_cmd('delphes --no_default', postcmd=False, printcmd=False) |
2868 | |
2869 | def get_available_tag(self): |
2870 | @@ -2557,16 +2575,16 @@ |
2871 | self.check_plot(args) |
2872 | logger.info('plot for run %s' % self.run_name) |
2873 | |
2874 | - self.edit_one_card('plot_card.dat', args) |
2875 | + self.ask_edit_cards([], args) |
2876 | |
2877 | if any([arg in ['all','parton'] for arg in args]): |
2878 | - filename = pjoin(self.me_dir, 'Events','%s_unweighted_events.lhe' % self.run_name) |
2879 | + filename = pjoin(self.me_dir, 'Events', self.run_name, 'unweighted_events.lhe') |
2880 | if os.path.exists(filename+'.gz'): |
2881 | os.system('gunzip -f %s' % (filename+'.gz') ) |
2882 | if os.path.exists(filename): |
2883 | - shutil.move(filename, pjoin(self.me_dir, 'Events','unweighted_events.lhe')) |
2884 | + shutil.move(filename, pjoin(self.me_dir, 'Events', 'unweighted_events.lhe')) |
2885 | self.create_plot('parton') |
2886 | - shutil.move(pjoin(self.me_dir, 'Events','unweighted_events.lhe'), filename) |
2887 | + shutil.move(pjoin(self.me_dir, 'Events', 'unweighted_events.lhe'), filename) |
2888 | os.system('gzip -f %s' % filename) |
2889 | else: |
2890 | logger.info('No valid files for partonic plot') |
2891 | @@ -2678,10 +2696,10 @@ |
2892 | if hasattr(self, 'control_thread') and self.control_thread[0]: |
2893 | self.monitor(mode=2,html=False) |
2894 | |
2895 | - pgsdir = pjoin(self.configuration['pythia-pgs_path'], 'src') |
2896 | - eradir = self.configuration['exrootanalysis_path'] |
2897 | - madir = self.configuration['madanalysis_path'] |
2898 | - td = self.configuration['td_path'] |
2899 | + pgsdir = pjoin(self.options['pythia-pgs_path'], 'src') |
2900 | + eradir = self.options['exrootanalysis_path'] |
2901 | + madir = self.options['madanalysis_path'] |
2902 | + td = self.options['td_path'] |
2903 | |
2904 | # Compile pgs if not there |
2905 | if not misc.is_executable(pjoin(pgsdir, 'pgs')): |
2906 | @@ -2801,7 +2819,7 @@ |
2907 | |
2908 | |
2909 | |
2910 | - delphes_dir = self.configuration['delphes_path'] |
2911 | + delphes_dir = self.options['delphes_path'] |
2912 | tag = self.run_tag |
2913 | self.banner.add(pjoin(self.me_dir, 'Cards','delphes_card.dat')) |
2914 | self.banner.add(pjoin(self.me_dir, 'Cards','delphes_trigger.dat')) |
2915 | @@ -2832,9 +2850,9 @@ |
2916 | target = pjoin(self.me_dir,'Events', self.run_name, "%s_delphes_events.root" % tag) |
2917 | files.mv(source, target) |
2918 | |
2919 | - #eradir = self.configuration['exrootanalysis_path'] |
2920 | - madir = self.configuration['madanalysis_path'] |
2921 | - td = self.configuration['td_path'] |
2922 | + #eradir = self.options['exrootanalysis_path'] |
2923 | + madir = self.options['madanalysis_path'] |
2924 | + td = self.options['td_path'] |
2925 | |
2926 | # Creating plots |
2927 | self.create_plot('Delphes') |
2928 | @@ -3010,9 +3028,9 @@ |
2929 | else: |
2930 | self.configured = time.time() |
2931 | self.update_status('compile directory', level=None) |
2932 | - if self.configuration['automatic_html_opening']: |
2933 | + if self.options['automatic_html_opening']: |
2934 | misc.open_file(os.path.join(self.me_dir, 'crossx.html')) |
2935 | - self.configuration['automatic_html_opening'] = False |
2936 | + self.options['automatic_html_opening'] = False |
2937 | #open only once the web page |
2938 | # Change current working directory |
2939 | self.launching_dir = os.getcwd() |
2940 | @@ -3041,16 +3059,18 @@ |
2941 | raise MadEventError, 'Impossible to compile' |
2942 | |
2943 | # set random number |
2944 | - if os.path.exists(pjoin(self.me_dir,'SubProcesses','randinit')): |
2945 | + if self.run_card['iseed'] != '0': |
2946 | + self.random = int(self.run_card['iseed']) |
2947 | + elif os.path.exists(pjoin(self.me_dir,'SubProcesses','randinit')): |
2948 | for line in open(pjoin(self.me_dir,'SubProcesses','randinit')): |
2949 | data = line.split('=') |
2950 | assert len(data) ==2 |
2951 | self.random = int(data[1]) |
2952 | break |
2953 | else: |
2954 | - self.random = random.randint(1, 30107) |
2955 | - |
2956 | - if self.run_card['ickkw'] == 2: |
2957 | + self.random = random.randint(1, 30107) |
2958 | + |
2959 | + if self.run_card['ickkw'] == '2': |
2960 | logger.info('Running with CKKW matching') |
2961 | self.treat_CKKW_matching() |
2962 | |
2963 | @@ -3088,7 +3108,8 @@ |
2964 | upgrade_tag = {'parton': ['parton','pythia','pgs','delphes'], |
2965 | 'pythia': ['pythia','pgs','delphes'], |
2966 | 'pgs': ['pgs'], |
2967 | - 'delphes':['delphes']} |
2968 | + 'delphes':['delphes'], |
2969 | + 'plot':[]} |
2970 | |
2971 | |
2972 | |
2973 | @@ -3186,7 +3207,7 @@ |
2974 | proc = [] |
2975 | for line in open(os.path.join(self.me_dir,'Cards','proc_card_mg5.dat')): |
2976 | line = line.split('#')[0] |
2977 | - line = line.split('=')[0] |
2978 | + #line = line.split('=')[0] |
2979 | if line.startswith('import') and 'model' in line: |
2980 | model = line.split()[2] |
2981 | proc = [] |
2982 | @@ -3321,7 +3342,7 @@ |
2983 | """create the LHE root file """ |
2984 | self.update_status('Creating root files', level='parton') |
2985 | |
2986 | - eradir = self.configuration['exrootanalysis_path'] |
2987 | + eradir = self.options['exrootanalysis_path'] |
2988 | subprocess.call(['%s/ExRootLHEFConverter' % eradir, |
2989 | input, output], |
2990 | cwd=pjoin(self.me_dir, 'Events')) |
2991 | @@ -3330,8 +3351,8 @@ |
2992 | def create_plot(self, mode='parton', event_path=None, output=None): |
2993 | """create the plot""" |
2994 | |
2995 | - madir = self.configuration['madanalysis_path'] |
2996 | - td = self.configuration['td_path'] |
2997 | + madir = self.options['madanalysis_path'] |
2998 | + td = self.options['td_path'] |
2999 | if not madir or not td or \ |
3000 | not os.path.exists(pjoin(self.me_dir, 'Cards', 'plot_card.dat')): |
3001 | return False |
3002 | @@ -3397,17 +3418,32 @@ |
3003 | |
3004 | return True |
3005 | |
3006 | + |
3007 | + def clean_pointless_card(self, mode): |
3008 | + """ Clean the pointless card """ |
3009 | + if mode == 'parton': |
3010 | + if os.path.exists(pjoin(self.me_dir,'Cards','pythia_card.dat')): |
3011 | + os.remove(pjoin(self.me_dir,'Cards','pythia_card.dat')) |
3012 | + elif mode in ['parton', 'pythia', 'delphes']: |
3013 | + if os.path.exists(pjoin(self.me_dir,'Cards','pgs_card.dat')): |
3014 | + os.remove(pjoin(self.me_dir,'Cards','pgs_card.dat')) |
3015 | + elif mode in ['pythia', 'pgs']: |
3016 | + if os.path.exists(pjoin(self.me_dir,'Cards','delphes_card.dat')): |
3017 | + os.remove(pjoin(self.me_dir,'Cards','delphes_card.dat')) |
3018 | + if os.path.exists(pjoin(self.me_dir,'Cards','delphes_trigger.dat')): |
3019 | + os.remove(pjoin(self.me_dir,'Cards','delphes_trigger.dat')) |
3020 | + |
3021 | |
3022 | ############################################################################ |
3023 | def ask_run_configuration(self, mode=None, force=False): |
3024 | """Ask the question when launching generate_events/multi_run""" |
3025 | |
3026 | available_mode = ['0', '1'] |
3027 | - if self.configuration['pythia-pgs_path']: |
3028 | + if self.options['pythia-pgs_path']: |
3029 | available_mode.append('2') |
3030 | available_mode.append('3') |
3031 | |
3032 | - if self.configuration['delphes_path']: |
3033 | + if self.options['delphes_path']: |
3034 | available_mode.append('4') |
3035 | |
3036 | if len(available_mode) == 2: |
3037 | @@ -3444,24 +3480,8 @@ |
3038 | else: |
3039 | mode = 'pythia' |
3040 | logger.info('Will run in mode %s' % mode) |
3041 | - |
3042 | - def clean_pointless_card(mode): |
3043 | - """ Clean the pointless card """ |
3044 | - if mode == 'parton': |
3045 | - if os.path.exists(pjoin(self.me_dir,'Cards','pythia_card.dat')): |
3046 | - os.remove(pjoin(self.me_dir,'Cards','pythia_card.dat')) |
3047 | - if os.path.exists(pjoin(self.me_dir,'Cards','pgs_card.dat')): |
3048 | - os.remove(pjoin(self.me_dir,'Cards','pgs_card.dat')) |
3049 | - if os.path.exists(pjoin(self.me_dir,'Cards','delphes_card.dat')): |
3050 | - os.remove(pjoin(self.me_dir,'Cards','delphes_card.dat')) |
3051 | - elif mode == 'pgs': |
3052 | - if os.path.exists(pjoin(self.me_dir,'Cards','delphes_card.dat')): |
3053 | - os.remove(pjoin(self.me_dir,'Cards','delphes_card.dat')) |
3054 | - elif mode == 'delphes': |
3055 | - if os.path.exists(pjoin(self.me_dir,'Cards','pgs_card.dat')): |
3056 | - os.remove(pjoin(self.me_dir,'Cards','pgs_card.dat')) |
3057 | - |
3058 | - clean_pointless_card(mode) |
3059 | + |
3060 | + self.clean_pointless_card(mode) |
3061 | # Now that we know in which mode we are check that all the card |
3062 | #exists (copy default if needed) |
3063 | |
3064 | @@ -3474,6 +3494,7 @@ |
3065 | cards.append('pgs_card.dat') |
3066 | elif mode == 'delphes': |
3067 | self.add_card_to_run('delphes') |
3068 | + self.add_card_to_run('trigger') |
3069 | cards.append('delphes_card.dat') |
3070 | |
3071 | if force: |
3072 | @@ -3501,7 +3522,7 @@ |
3073 | possible_answer.append('delphes') |
3074 | possible_answer.append(6) |
3075 | possible_answer.append('trigger') |
3076 | - if self.configuration['madanalysis_path']: |
3077 | + if self.options['madanalysis_path']: |
3078 | question += ' 9 / plot : plot_card.dat\n' |
3079 | possible_answer.append(9) |
3080 | possible_answer.append('plot') |
3081 | @@ -3520,11 +3541,12 @@ |
3082 | answer = card[int(answer)] |
3083 | if answer == 'done': |
3084 | return |
3085 | - if not os.path.exists(answer): |
3086 | + if not os.path.isfile(answer): |
3087 | if answer != 'trigger': |
3088 | path = pjoin(self.me_dir,'Cards','%s_card.dat' % answer) |
3089 | else: |
3090 | path = pjoin(self.me_dir,'Cards','delphes_trigger.dat') |
3091 | + print path |
3092 | self.exec_cmd('open %s' % path) |
3093 | else: |
3094 | # detect which card is provide |
3095 | @@ -3555,7 +3577,7 @@ |
3096 | """Ask the question when launching pythia""" |
3097 | |
3098 | available_mode = ['0', '1', '2'] |
3099 | - if self.configuration['delphes_path']: |
3100 | + if self.options['delphes_path']: |
3101 | available_mode.append('3') |
3102 | name = {'0': 'auto', '1': 'pythia', '2':'pgs', '3':'delphes'} |
3103 | options = available_mode + [name[val] for val in available_mode] |
3104 | @@ -3584,14 +3606,8 @@ |
3105 | mode = 'pythia' |
3106 | logger.info('Will run in mode %s' % mode) |
3107 | |
3108 | - # Clean the pointless card |
3109 | - if mode == 'pgs': |
3110 | - if os.path.exists(pjoin(self.me_dir,'Cards','delphes_card.dat')): |
3111 | - os.remove(pjoin(self.me_dir,'Cards','delphes_card.dat')) |
3112 | - if mode == 'delphes': |
3113 | - if os.path.exists(pjoin(self.me_dir,'Cards','pgs_card.dat')): |
3114 | - os.remove(pjoin(self.me_dir,'Cards','pgs_card.dat')) |
3115 | - |
3116 | + self.clean_pointless_card(mode) |
3117 | + |
3118 | # Now that we know in which mode we are check that all the card |
3119 | #exists (copy default if needed) |
3120 | |
3121 | @@ -3602,6 +3618,7 @@ |
3122 | cards.append('pgs_card.dat') |
3123 | if mode == 'delphes': |
3124 | self.add_card_to_run('delphes') |
3125 | + self.add_card_to_run('trigger') |
3126 | cards.append('delphes_card.dat') |
3127 | |
3128 | if force: |
3129 | @@ -3627,7 +3644,7 @@ |
3130 | possible_answer.append('trigger') |
3131 | card[2] = 'delphes' |
3132 | card[3] = 'trigger' |
3133 | - if self.configuration['madanalysis_path']: |
3134 | + if self.options['madanalysis_path']: |
3135 | question += ' 9 / plot : plot_card.dat\n' |
3136 | possible_answer.append(9) |
3137 | possible_answer.append('plot') |
3138 | @@ -3643,7 +3660,7 @@ |
3139 | answer = card[int(answer)] |
3140 | if answer == 'done': |
3141 | return |
3142 | - if os.path.exists(answer): |
3143 | + if os.path.isfile(answer): |
3144 | # detect which card is provide |
3145 | card_name = self.detect_card_type(answer) |
3146 | if card_name == 'unknown': |
3147 | @@ -3685,7 +3702,7 @@ |
3148 | question += ' %s / %-9s : %s\n' % (i+1, mode, card_name[mode]) |
3149 | card[i+1] = mode |
3150 | |
3151 | - if self.configuration['madanalysis_path']: |
3152 | + if self.options['madanalysis_path']: |
3153 | question += ' 9 / %-9s : plot_card.dat\n' % 'plot' |
3154 | possible_answer.append(9) |
3155 | possible_answer.append('plot') |
3156 | @@ -3702,7 +3719,7 @@ |
3157 | answer = card[int(answer)] |
3158 | if answer == 'done': |
3159 | return |
3160 | - if os.path.exists(answer): |
3161 | + if os.path.isfile(answer): |
3162 | # detect which card is provide |
3163 | card_name = self.detect_card_type(answer) |
3164 | if card_name == 'unknown': |
3165 | @@ -3739,9 +3756,14 @@ |
3166 | """ensure that card name is define. If not use the default one""" |
3167 | dico = {'dir': self.me_dir, 'name': name } |
3168 | |
3169 | - if not os.path.exists('%(dir)s/Cards/%(name)s_card.dat' % dico): |
3170 | - files.cp('%(dir)s/Cards/%(name)s_card_default.dat' % dico, |
3171 | - '%(dir)s/Cards/%(name)s_card.dat' % dico) |
3172 | + if name != 'trigger': |
3173 | + if not os.path.isfile('%(dir)s/Cards/%(name)s_card.dat' % dico): |
3174 | + files.cp('%(dir)s/Cards/%(name)s_card_default.dat' % dico, |
3175 | + '%(dir)s/Cards/%(name)s_card.dat' % dico) |
3176 | + else: |
3177 | + if not os.path.isfile('%(dir)s/Cards/delphes_trigger.dat' % dico): |
3178 | + files.cp('%(dir)s/Cards/delphes_trigger_default.dat' % dico, |
3179 | + '%(dir)s/Cards/delphes_trigger.dat' % dico) |
3180 | |
3181 | @staticmethod |
3182 | def detect_card_type(path): |
3183 | @@ -3890,7 +3912,7 @@ |
3184 | MadEventCmd.__init__(self, me_dir, *completekey, **stdin) |
3185 | self.run_mode = 0 |
3186 | self.random = seed |
3187 | - self.configuration['automatic_html_opening'] = False |
3188 | + self.options['automatic_html_opening'] = False |
3189 | # Now it's time to run! |
3190 | if me_dir and nb_event and seed: |
3191 | self.launch(nb_event, seed) |
3192 | @@ -3921,6 +3943,7 @@ |
3193 | self.exec_cmd('combine_events') |
3194 | self.exec_cmd('store_events') |
3195 | self.exec_cmd('pythia --no_default -f') |
3196 | + self.print_results_in_shell(self.results.current) |
3197 | |
3198 | def refine4grid(self, nb_event): |
3199 | """Special refine for gridpack run.""" |
3200 | |
3201 | === renamed file 'madgraph/interface/cmd_interface.py' => 'madgraph/interface/madgraph_interface.py' |
3202 | --- madgraph/interface/cmd_interface.py 2012-02-16 21:53:02 +0000 |
3203 | +++ madgraph/interface/madgraph_interface.py 2012-03-08 17:31:22 +0000 |
3204 | @@ -12,7 +12,7 @@ |
3205 | # For more information, please visit: http://madgraph.phys.ucl.ac.be |
3206 | # |
3207 | ################################################################################ |
3208 | -"""A user friendly command line interface to access MadGraph features. |
3209 | +"""A user friendly command line interface to access MadGraph features at LO. |
3210 | Uses the cmd package for command interpretation and tab completion. |
3211 | """ |
3212 | |
3213 | @@ -54,7 +54,6 @@ |
3214 | import madgraph.iolibs.files as files |
3215 | import madgraph.iolibs.group_subprocs as group_subprocs |
3216 | import madgraph.iolibs.import_v4 as import_v4 |
3217 | -import madgraph.iolibs.misc as misc |
3218 | import madgraph.iolibs.save_load_object as save_load_object |
3219 | |
3220 | import madgraph.interface.extended_cmd as cmd |
3221 | @@ -64,6 +63,8 @@ |
3222 | |
3223 | import madgraph.various.process_checks as process_checks |
3224 | import madgraph.various.banner as banner_module |
3225 | +import madgraph.various.misc as misc |
3226 | +import madgraph.various.cluster as cluster |
3227 | |
3228 | import models as ufomodels |
3229 | import models.import_ufo as import_ufo |
3230 | @@ -402,7 +403,6 @@ |
3231 | logger.info(" fortran_compiler NAME") |
3232 | logger.info(" (default None) Force a specific fortran compiler.") |
3233 | logger.info(" If None, it tries first g77 and if not present gfortran.") |
3234 | - |
3235 | |
3236 | |
3237 | #=============================================================================== |
3238 | @@ -664,14 +664,12 @@ |
3239 | return self.InvalidCmd, 'Invalid Syntax: Too many argument' |
3240 | |
3241 | # search for a valid path |
3242 | - if os.path.sep in args[0] and os.path.isdir(args[0]): |
3243 | - path = args[0] |
3244 | + if os.path.isdir(args[0]): |
3245 | + path = os.path.realpath(args[0]) |
3246 | elif os.path.isdir(pjoin(MG5DIR,args[0])): |
3247 | path = pjoin(MG5DIR,args[0]) |
3248 | elif MG4DIR and os.path.isdir(pjoin(MG4DIR,args[0])): |
3249 | path = pjoin(MG4DIR,args[0]) |
3250 | - elif os.path.isdir(args[0]): |
3251 | - path = os.path.realpath(args[0]) |
3252 | else: |
3253 | raise self.InvalidCmd, '%s is not a valid directory' % args[0] |
3254 | |
3255 | @@ -753,6 +751,9 @@ |
3256 | |
3257 | def check_save(self, args): |
3258 | """ check the validity of the line""" |
3259 | + if len(args) == 0: |
3260 | + args.append('options') |
3261 | + |
3262 | if args[0] not in self._save_opts: |
3263 | self.help_save() |
3264 | raise self.InvalidCmd('wrong \"save\" format') |
3265 | @@ -778,7 +779,7 @@ |
3266 | raise self.InvalidCmd('set needs an option and an argument') |
3267 | |
3268 | if args[0] not in self._set_options: |
3269 | - if not args[0] in self._options and not args[0] in self.configuration: |
3270 | + if not args[0] in self.options and not args[0] in self.options: |
3271 | self.help_set() |
3272 | raise self.InvalidCmd('Possible options for set are %s' % \ |
3273 | self._set_options) |
3274 | @@ -871,8 +872,8 @@ |
3275 | elif path != 'auto': |
3276 | self._export_dir = path |
3277 | elif path == 'auto': |
3278 | - if self.configuration['pythia8_path']: |
3279 | - self._export_dir = self.configuration['pythia8_path'] |
3280 | + if self.options['pythia8_path']: |
3281 | + self._export_dir = self.options['pythia8_path'] |
3282 | else: |
3283 | self._export_dir = '.' |
3284 | else: |
3285 | @@ -880,8 +881,8 @@ |
3286 | # No valid path |
3287 | self.get_default_path() |
3288 | else: |
3289 | - if self.configuration['pythia8_path']: |
3290 | - self._export_dir = self.configuration['pythia8_path'] |
3291 | + if self.options['pythia8_path']: |
3292 | + self._export_dir = self.options['pythia8_path'] |
3293 | else: |
3294 | self._export_dir = '.' |
3295 | |
3296 | @@ -926,8 +927,8 @@ |
3297 | auto_path = lambda i: pjoin(self.writing_dir, |
3298 | name_dir(i)) |
3299 | elif self._export_format == 'pythia8': |
3300 | - if self.configuration['pythia8_path']: |
3301 | - self._export_dir = self.configuration['pythia8_path'] |
3302 | + if self.options['pythia8_path']: |
3303 | + self._export_dir = self.options['pythia8_path'] |
3304 | else: |
3305 | self._export_dir = '.' |
3306 | return |
3307 | @@ -1043,7 +1044,7 @@ |
3308 | #=============================================================================== |
3309 | # CompleteForCmd |
3310 | #=============================================================================== |
3311 | -class CompleteForCmd(CheckValidForCmd): |
3312 | +class CompleteForCmd(object): |
3313 | """ The Series of help routine for the MadGraphCmd""" |
3314 | |
3315 | |
3316 | @@ -1336,7 +1337,7 @@ |
3317 | |
3318 | # Format |
3319 | if len(args) == 1: |
3320 | - opts = self._set_options + self._options.keys() + self.configuration.keys() |
3321 | + opts = self.options.keys() |
3322 | return self.list_completion(text, opts) |
3323 | |
3324 | if len(args) == 2: |
3325 | @@ -1356,7 +1357,7 @@ |
3326 | elif args[1] == 'run_mode': |
3327 | return self.list_completion(text, [str(i) for i in range(3)]) |
3328 | elif args[1] == 'cluster_type': |
3329 | - return self.list_completion(text, ['pbs', 'condor', 'sge']) |
3330 | + return self.list_completion(text, cluster.from_name.keys()) |
3331 | elif args[1] == 'cluster_queue': |
3332 | return [] |
3333 | elif args[1] == 'automatic_html_opening': |
3334 | @@ -1548,9 +1549,12 @@ |
3335 | #=============================================================================== |
3336 | # MadGraphCmd |
3337 | #=============================================================================== |
3338 | -class MadGraphCmd(CmdExtended, HelpToCmd): |
3339 | +class MadGraphCmd(HelpToCmd, CheckValidForCmd, CompleteForCmd, CmdExtended): |
3340 | """The command line processor of MadGraph""" |
3341 | |
3342 | + writing_dir = '.' |
3343 | + timeout = 0 # time authorize to answer question [0 is no time limit] |
3344 | + |
3345 | # Options and formats available |
3346 | _display_opts = ['particles', 'interactions', 'processes', 'diagrams', |
3347 | 'diagrams_text', 'multiparticles', 'couplings', 'lorentz', |
3348 | @@ -1576,6 +1580,19 @@ |
3349 | _curr_exporter = None |
3350 | _done_export = False |
3351 | |
3352 | + def preloop(self): |
3353 | + """Initializing before starting the main loop""" |
3354 | + |
3355 | + self.prompt = 'mg5>' |
3356 | + |
3357 | + # By default, load the UFO Standard Model |
3358 | + logger.info("Loading default model: sm") |
3359 | + self.do_import('model sm') |
3360 | + self.history.append('import model sm') |
3361 | + |
3362 | + # preloop mother |
3363 | + CmdExtended.preloop(self) |
3364 | + |
3365 | |
3366 | def __init__(self, mgme_dir = '', *completekey, **stdin): |
3367 | """ add a tracker of the history """ |
3368 | @@ -1594,7 +1611,7 @@ |
3369 | |
3370 | # Variables to store state information |
3371 | self._multiparticles = {} |
3372 | - self._options = {} |
3373 | + self.options = {} |
3374 | self._generate_info = "" # store the first generated process |
3375 | self._model_v4_path = None |
3376 | self._use_lower_part_names = False |
3377 | @@ -1602,11 +1619,7 @@ |
3378 | self._export_format = 'madevent' |
3379 | self._mgme_dir = MG4DIR |
3380 | self._comparisons = None |
3381 | - |
3382 | - # Set defaults for options |
3383 | - self._options['group_subprocesses'] = 'Auto' |
3384 | - self._options['ignore_six_quark_processes'] = False |
3385 | - |
3386 | + |
3387 | # Load the configuration file |
3388 | self.set_configuration() |
3389 | |
3390 | @@ -1662,13 +1675,13 @@ |
3391 | cpu_time1 = time.time() |
3392 | |
3393 | # Generate processes |
3394 | - if self._options['group_subprocesses'] == 'Auto': |
3395 | + if self.options['group_subprocesses'] == 'Auto': |
3396 | collect_mirror_procs = True |
3397 | else: |
3398 | - collect_mirror_procs = self._options['group_subprocesses'] |
3399 | + collect_mirror_procs = self.options['group_subprocesses'] |
3400 | ignore_six_quark_processes = \ |
3401 | - self._options['ignore_six_quark_processes'] if \ |
3402 | - "ignore_six_quark_processes" in self._options \ |
3403 | + self.options['ignore_six_quark_processes'] if \ |
3404 | + "ignore_six_quark_processes" in self.options \ |
3405 | else [] |
3406 | |
3407 | myproc = diagram_generation.MultiProcess(myprocdef, |
3408 | @@ -1885,15 +1898,31 @@ |
3409 | print 'No couplings information available in V4 model' |
3410 | return |
3411 | text = '' |
3412 | - try: |
3413 | - ufomodel = ufomodels.load_model(self._curr_model.get('name')) |
3414 | - except: |
3415 | - raise self.InvalidCmd, 'no couplings %s in current model' % args[1] |
3416 | - for coup in ufomodel.all_couplings: |
3417 | - order = ', '.join(['%s=%s' %val for val in coup.order.items()]) |
3418 | - text += '%s = %s\t( %s)\n' % (coup.name, coup.value, order) |
3419 | + text = "Current model contains %i couplings\n" % \ |
3420 | + sum([len(part) for part in |
3421 | + self._curr_model['couplings'].values()]) |
3422 | + keys = self._curr_model['couplings'].keys() |
3423 | + def key_sort(x, y): |
3424 | + if ('external',) == x: |
3425 | + return -1 |
3426 | + elif ('external',) == y: |
3427 | + return +1 |
3428 | + elif len(x) < len(y): |
3429 | + return -1 |
3430 | + else: |
3431 | + return 1 |
3432 | + keys.sort(key_sort) |
3433 | + for key in keys: |
3434 | + item = self._curr_model['couplings'][key] |
3435 | + text += '\ncouplings type: %s\n' % str(key) |
3436 | + for value in item: |
3437 | + if value.value is not None: |
3438 | + text+= ' %s = %s = %s\n' % (value.name, value.expr ,value.value) |
3439 | + else: |
3440 | + text+= ' %s = %s\n' % (value.name, value.expr) |
3441 | + |
3442 | pydoc.pager(text) |
3443 | - |
3444 | + |
3445 | elif args[0] == 'couplings': |
3446 | if self._model_v4_path: |
3447 | print 'No couplings information available in V4 model' |
3448 | @@ -2180,13 +2209,20 @@ |
3449 | if len(forbidden_particles_re.groups()) > 2: |
3450 | line = line + forbidden_particles_re.group(3) |
3451 | |
3452 | - # Now check for forbidden schannels, specified using "$" |
3453 | - forbidden_schannels_re = re.match("^(.+)\s*\$\s*(.+)\s*$", line) |
3454 | + # Now check for forbidden schannels, specified using "$$" |
3455 | + forbidden_schannels_re = re.match("^(.+)\s*\$\s*\$\s*(.+)\s*$", line) |
3456 | forbidden_schannels = "" |
3457 | if forbidden_schannels_re: |
3458 | forbidden_schannels = forbidden_schannels_re.group(2) |
3459 | line = forbidden_schannels_re.group(1) |
3460 | |
3461 | + # Now check for forbidden onshell schannels, specified using "$" |
3462 | + forbidden_onsh_schannels_re = re.match("^(.+)\s*\$\s*(.+)\s*$", line) |
3463 | + forbidden_onsh_schannels = "" |
3464 | + if forbidden_onsh_schannels_re: |
3465 | + forbidden_onsh_schannels = forbidden_onsh_schannels_re.group(2) |
3466 | + line = forbidden_onsh_schannels_re.group(1) |
3467 | + |
3468 | # Now check for required schannels, specified using "> >" |
3469 | required_schannels_re = re.match("^(.+?)>(.+?)>(.+)$", line) |
3470 | required_schannels = "" |
3471 | @@ -2238,8 +2274,15 @@ |
3472 | raise self.InvalidCmd,\ |
3473 | "Multiparticle %s is or-multiparticle" % part_name + \ |
3474 | " which can be used only for required s-channels" |
3475 | + forbidden_onsh_schannel_ids = \ |
3476 | + self.extract_particle_ids(forbidden_onsh_schannels) |
3477 | forbidden_schannel_ids = \ |
3478 | self.extract_particle_ids(forbidden_schannels) |
3479 | + if forbidden_onsh_schannel_ids and \ |
3480 | + isinstance(forbidden_onsh_schannel_ids[0], list): |
3481 | + raise self.InvalidCmd,\ |
3482 | + "Multiparticle %s is or-multiparticle" % part_name + \ |
3483 | + " which can be used only for required s-channels" |
3484 | if forbidden_schannel_ids and \ |
3485 | isinstance(forbidden_schannel_ids[0], list): |
3486 | raise self.InvalidCmd,\ |
3487 | @@ -2258,7 +2301,9 @@ |
3488 | 'id': proc_number, |
3489 | 'orders': orders, |
3490 | 'forbidden_particles': forbidden_particle_ids, |
3491 | - 'forbidden_s_channels': forbidden_schannel_ids, |
3492 | + 'forbidden_onsh_s_channels': forbidden_onsh_schannel_ids, |
3493 | + 'forbidden_s_channels': \ |
3494 | + forbidden_schannel_ids, |
3495 | 'required_s_channels': required_schannel_ids, |
3496 | 'overall_orders': overall_orders |
3497 | }) |
3498 | @@ -2668,7 +2713,8 @@ |
3499 | else: |
3500 | subprocess.call(['wget', path[args[0]], '--output-document=%s.tgz'% name], cwd=MG5DIR) |
3501 | # Untar the file |
3502 | - returncode = subprocess.call(['tar', '-xzpvf', '%s.tgz' % name], cwd=MG5DIR) |
3503 | + returncode = subprocess.call(['tar', '-xzpvf', '%s.tgz' % name], cwd=MG5DIR, |
3504 | + stdout=open(os.devnull, 'w')) |
3505 | if returncode: |
3506 | raise MadGraph5Error, 'Fail to download correctly the File. Stop' |
3507 | |
3508 | @@ -2705,8 +2751,12 @@ |
3509 | text = text.replace('FC=g77','FC=gfortran') |
3510 | open(path, 'w').writelines(text) |
3511 | |
3512 | - subprocess.call(['make', 'clean'], cwd = os.path.join(MG5DIR, name)) |
3513 | - status = subprocess.call(['make'], cwd = os.path.join(MG5DIR, name)) |
3514 | + if logger.level <= logging.INFO: |
3515 | + subprocess.call(['make', 'clean'], ) |
3516 | + status = subprocess.call(['make'], cwd = os.path.join(MG5DIR, name)) |
3517 | + else: |
3518 | + misc.compile(['clean'], mode='', cwd = os.path.join(MG5DIR, name)) |
3519 | + status = misc.compile(mode='', cwd = os.path.join(MG5DIR, name)) |
3520 | if not status: |
3521 | logger.info('compilation succeeded') |
3522 | |
3523 | @@ -2743,13 +2793,15 @@ |
3524 | """ assign all configuration variable from file |
3525 | ./input/mg5_configuration.txt. assign to default if not define """ |
3526 | |
3527 | - self.configuration = {'pythia8_path': './pythia8', |
3528 | + self.options = {'pythia8_path': './pythia8', |
3529 | 'web_browser':None, |
3530 | 'eps_viewer':None, |
3531 | 'text_editor':None, |
3532 | 'fortran_compiler':None, |
3533 | - 'automatic_html_opening':True} |
3534 | - |
3535 | + 'automatic_html_opening':True, |
3536 | + 'group_subprocesses': 'Auto', |
3537 | + 'ignore_six_quark_processes': False} |
3538 | + |
3539 | if not config_path: |
3540 | try: |
3541 | config_file = open(pjoin(os.environ['HOME'],'.mg5', 'mg5_configuration.txt')) |
3542 | @@ -2772,25 +2824,25 @@ |
3543 | else: |
3544 | name = name.strip() |
3545 | value = value.strip() |
3546 | - self.configuration[name] = value |
3547 | + self.options[name] = value |
3548 | if value.lower() == "none": |
3549 | - self.configuration[name] = None |
3550 | + self.options[name] = None |
3551 | |
3552 | if test: |
3553 | - return self.configuration |
3554 | + return self.options |
3555 | |
3556 | # Treat each expected input |
3557 | # 1: Pythia8_path |
3558 | # try relative path |
3559 | - for key in self.configuration: |
3560 | + for key in self.options: |
3561 | if key == 'pythia8_path': |
3562 | - if self.configuration['pythia8_path'] in ['None', None]: |
3563 | - self.configuration['pythia8_path'] = None |
3564 | + if self.options['pythia8_path'] in ['None', None]: |
3565 | + self.options['pythia8_path'] = None |
3566 | continue |
3567 | - pythia8_dir = pjoin(MG5DIR, self.configuration['pythia8_path']) |
3568 | + pythia8_dir = pjoin(MG5DIR, self.options['pythia8_path']) |
3569 | if not os.path.isfile(pjoin(pythia8_dir, 'include', 'Pythia.h')): |
3570 | - if not os.path.isfile(pjoin(self.configuration['pythia8_path'], 'include', 'Pythia.h')): |
3571 | - self.configuration['pythia8_path'] = None |
3572 | + if not os.path.isfile(pjoin(self.options['pythia8_path'], 'include', 'Pythia.h')): |
3573 | + self.options['pythia8_path'] = None |
3574 | else: |
3575 | continue |
3576 | |
3577 | @@ -2801,16 +2853,16 @@ |
3578 | elif key not in ['text_editor','eps_viewer','web_browser']: |
3579 | # Default: try to set parameter |
3580 | try: |
3581 | - self.do_set("%s %s" % (key, self.configuration[key]), log=False) |
3582 | + self.do_set("%s %s" % (key, self.options[key]), log=False) |
3583 | except MadGraph5Error, error: |
3584 | print error |
3585 | logger.warning("Option %s from config file not understood" \ |
3586 | % key) |
3587 | |
3588 | # Configure the way to open a file: |
3589 | - launch_ext.open_file.configure(self.configuration) |
3590 | + launch_ext.open_file.configure(self.options) |
3591 | |
3592 | - return self.configuration |
3593 | + return self.options |
3594 | |
3595 | def check_for_export_dir(self, filepath): |
3596 | """Check if the files is in a valid export directory and assign it to |
3597 | @@ -2870,16 +2922,16 @@ |
3598 | |
3599 | if len(generate_info.split('>')[0].strip().split())>1: |
3600 | ext_program = launch_ext.MELauncher(args[1], self.timeout, self, |
3601 | - pythia=self.configuration['pythia-pgs_path'], |
3602 | - delphes=self.configuration['delphes_path'], |
3603 | + pythia=self.options['pythia-pgs_path'], |
3604 | + delphes=self.options['delphes_path'], |
3605 | shell = hasattr(self, 'do_shell'), |
3606 | **options) |
3607 | else: |
3608 | # This is a width computation |
3609 | ext_program = launch_ext.MELauncher(args[1], self.timeout, self, |
3610 | unit='GeV', |
3611 | - pythia=self.configuration['pythia-pgs_path'], |
3612 | - delphes=self.configuration['delphes_path'], |
3613 | + pythia=self.options['pythia-pgs_path'], |
3614 | + delphes=self.options['delphes_path'], |
3615 | shell = hasattr(self, 'do_shell'), |
3616 | **options) |
3617 | |
3618 | @@ -2986,53 +3038,8 @@ |
3619 | raise self.InvalidCmd('No processes to save!') |
3620 | |
3621 | elif args[0] == 'options': |
3622 | - self.write_configuration(args[1]) |
3623 | - |
3624 | - |
3625 | - def write_configuration(self, path): |
3626 | - """Write the configuration file""" |
3627 | - # We use the default configuration file as a template. |
3628 | - # to ensure that all configuration information are written we |
3629 | - # keep track of all key that we need to write. |
3630 | + CmdExtended.do_save(self, line) |
3631 | |
3632 | - to_write = self._options.keys()[:] + self.configuration.keys()[:] |
3633 | - writer = open(path,'w') |
3634 | - # Use local configuration => Need to update the path |
3635 | - conf = os.path.join(MG5DIR, 'input', 'mg5_configuration.txt') |
3636 | - for line in file(conf): |
3637 | - if '#' in line: |
3638 | - data, comment = line.split('#',1) |
3639 | - else: |
3640 | - data, comment = line, '' |
3641 | - data = data.split('=') |
3642 | - if len(data) !=2: |
3643 | - writer.writelines(line) |
3644 | - continue |
3645 | - key = data[0].strip() |
3646 | - if key in self._options: |
3647 | - value = str(self._options[key]) |
3648 | - elif key in self.configuration: |
3649 | - value = str(self.configuration[key]) |
3650 | - else: |
3651 | - value = data[1].strip() |
3652 | - try: |
3653 | - to_write.remove(key) |
3654 | - except: |
3655 | - pass |
3656 | - if '_path' in key: |
3657 | - # special case need to update path |
3658 | - # check if absolute path |
3659 | - if value.startswith('./'): |
3660 | - value = os.path.realpath(os.path.join(MG5DIR, value)) |
3661 | - writer.writelines('%s = %s # %s \n' % (key, value, comment)) |
3662 | - for key in to_write: |
3663 | - if key in self._options: |
3664 | - writer.writelines('%s = %s \n' % (key,self._options[key])) |
3665 | - else: |
3666 | - writer.writelines('%s = %s \n' % (key,self.configuration[key])) |
3667 | - |
3668 | - writer.close() |
3669 | - |
3670 | |
3671 | # Set an option |
3672 | def do_set(self, line, log=True): |
3673 | @@ -3046,9 +3053,9 @@ |
3674 | |
3675 | if args[0] == 'ignore_six_quark_processes': |
3676 | if args[1] == 'False': |
3677 | - self._options[args[0]] = False |
3678 | + self.options[args[0]] = False |
3679 | return |
3680 | - self._options[args[0]] = list(set([abs(p) for p in \ |
3681 | + self.options[args[0]] = list(set([abs(p) for p in \ |
3682 | self._multiparticles[args[1]]\ |
3683 | if self._curr_model.get_particle(p).\ |
3684 | is_fermion() and \ |
3685 | @@ -3058,16 +3065,16 @@ |
3686 | logger.info('Ignore processes with >= 6 quarks (%s)' % \ |
3687 | ",".join([\ |
3688 | self._curr_model.get_particle(q).get('name') \ |
3689 | - for q in self._options[args[0]]])) |
3690 | + for q in self.options[args[0]]])) |
3691 | |
3692 | elif args[0] == 'group_subprocesses': |
3693 | if args[1] != 'Auto': |
3694 | - self._options[args[0]] = eval(args[1]) |
3695 | + self.options[args[0]] = eval(args[1]) |
3696 | else: |
3697 | - self._options[args[0]] = 'Auto' |
3698 | + self.options[args[0]] = 'Auto' |
3699 | if log: |
3700 | logger.info('Set group_subprocesses to %s' % \ |
3701 | - str(self._options[args[0]])) |
3702 | + str(self.options[args[0]])) |
3703 | logger.info('Note that you need to regenerate all processes') |
3704 | self._curr_amps = diagram_generation.AmplitudeList() |
3705 | self._curr_matrix_elements = helas_objects.HelasMultiProcess() |
3706 | @@ -3082,19 +3089,19 @@ |
3707 | if args[1] != 'None': |
3708 | if log: |
3709 | logger.info('set fortran compiler to %s' % args[1]) |
3710 | - self.configuration['fortran_compiler'] = args[1] |
3711 | + self.options['fortran_compiler'] = args[1] |
3712 | else: |
3713 | - self.configuration['fortran_compiler'] = None |
3714 | - elif args[0] in self._options: |
3715 | + self.options['fortran_compiler'] = None |
3716 | + elif args[0] in self.options: |
3717 | if args[1] in ['None','True', 'False']: |
3718 | - self._options[args[0]] = eval(args[1]) |
3719 | + self.options[args[0]] = eval(args[1]) |
3720 | else: |
3721 | - self._options[args[0]] = args[1] |
3722 | - elif args[0] in self.configuration: |
3723 | + self.options[args[0]] = args[1] |
3724 | + elif args[0] in self.options: |
3725 | if args[1] in ['None','True','False']: |
3726 | - self.configuration[args[0]] = eval(args[1]) |
3727 | + self.options[args[0]] = eval(args[1]) |
3728 | else: |
3729 | - self.configuration[args[0]] = args[1] |
3730 | + self.options[args[0]] = args[1] |
3731 | |
3732 | |
3733 | def do_open(self, line): |
3734 | @@ -3141,8 +3148,8 @@ |
3735 | #check if we need to group processes |
3736 | group_subprocesses = False |
3737 | if self._export_format == 'madevent' and \ |
3738 | - self._options['group_subprocesses']: |
3739 | - if self._options['group_subprocesses'] is True: |
3740 | + self.options['group_subprocesses']: |
3741 | + if self.options['group_subprocesses'] is True: |
3742 | group_subprocesses = True |
3743 | elif self._curr_amps[0].get_ninitial() == 2: |
3744 | group_subprocesses = True |
3745 | @@ -3200,9 +3207,9 @@ |
3746 | |
3747 | # Check if we need to group the SubProcesses or not |
3748 | group = True |
3749 | - if self._options['group_subprocesses'] is False: |
3750 | + if self.options['group_subprocesses'] is False: |
3751 | group = False |
3752 | - elif self._options['group_subprocesses'] == 'Auto' and \ |
3753 | + elif self.options['group_subprocesses'] == 'Auto' and \ |
3754 | self._curr_amps[0].get_ninitial() == 1: |
3755 | group = False |
3756 | |
3757 | @@ -3424,6 +3431,11 @@ |
3758 | wanted_couplings) |
3759 | export_cpp.make_model_cpp(self._export_dir) |
3760 | |
3761 | + elif self._export_format == 'madevent': |
3762 | + # Create configuration file [path to executable] for madevent |
3763 | + filename = os.path.join(self._export_dir, 'Cards', 'me5_configuration.txt') |
3764 | + self.do_save('options %s' % filename, check=False) |
3765 | + |
3766 | if self._export_format in ['madevent', 'standalone']: |
3767 | |
3768 | self._curr_exporter.finalize_v4_directory( \ |
3769 | @@ -3432,15 +3444,12 @@ |
3770 | self.history, |
3771 | not nojpeg, |
3772 | online, |
3773 | - self.configuration['fortran_compiler']) |
3774 | + self.options['fortran_compiler']) |
3775 | |
3776 | if self._export_format in ['madevent', 'standalone', 'standalone_cpp']: |
3777 | logger.info('Output to directory ' + self._export_dir + ' done.') |
3778 | - if self._export_format == 'madevent': |
3779 | - # Create configuration file [path to executable] for madevent |
3780 | - filename = os.path.join(self._export_dir, 'Cards', 'me5_configuration.txt') |
3781 | - self.do_save('options %s' % filename, check=False) |
3782 | - |
3783 | + |
3784 | + if self._export_format == 'madevent': |
3785 | logger.info('Type \"launch\" to generate events from this process, or see') |
3786 | logger.info(self._export_dir + '/README') |
3787 | logger.info('Run \"open index.html\" to see more information about this process.') |
3788 | @@ -3463,88 +3472,8 @@ |
3789 | last_action_2 = '%s %s' % (last_action, args[1]) |
3790 | else: |
3791 | last_action_2 = 'none' |
3792 | - |
3793 | - |
3794 | -#=============================================================================== |
3795 | -# MadGraphCmd |
3796 | -#=============================================================================== |
3797 | -class MadGraphCmdWeb(MadGraphCmd, CheckValidForCmdWeb): |
3798 | - """The command line processor of MadGraph""" |
3799 | - |
3800 | - timeout = 1 # time authorize to answer question [0 is no time limit] |
3801 | - |
3802 | - def __init__(self, *arg, **opt): |
3803 | - |
3804 | - if os.environ.has_key('_CONDOR_SCRATCH_DIR'): |
3805 | - self.writing_dir = pjoin(os.environ['_CONDOR_SCRATCH_DIR'], \ |
3806 | - os.path.pardir) |
3807 | - else: |
3808 | - self.writing_dir = pjoin(os.environ['MADGRAPH_DATA'], |
3809 | - os.environ['REMOTE_USER']) |
3810 | - |
3811 | - |
3812 | - #standard initialization |
3813 | - MadGraphCmd.__init__(self, mgme_dir = '', *arg, **opt) |
3814 | - |
3815 | - def finalize(self, nojpeg): |
3816 | - """Finalize web generation""" |
3817 | - |
3818 | - MadGraphCmd.finalize(self, nojpeg, online = True) |
3819 | - |
3820 | - # Generate a new amplitude |
3821 | - def do_generate(self, line): |
3822 | - """Generate an amplitude for a given process""" |
3823 | - |
3824 | - try: |
3825 | - MadGraphCmd.do_generate(self, line) |
3826 | - except: |
3827 | - # put the stop logo on the web |
3828 | - files.cp(self._export_dir+'/HTML/stop.jpg',self._export_dir+'/HTML/card.jpg') |
3829 | - raise |
3830 | - |
3831 | - # Add a process to the existing multiprocess definition |
3832 | - def do_add(self, line): |
3833 | - """Generate an amplitude for a given process and add to |
3834 | - existing amplitudes |
3835 | - syntax: |
3836 | - """ |
3837 | - try: |
3838 | - MadGraphCmd.do_add(self, line) |
3839 | - except: |
3840 | - # put the stop logo on the web |
3841 | - files.cp(self._export_dir+'/HTML/stop.jpg',self._export_dir+'/HTML/card.jpg') |
3842 | - raise |
3843 | - |
3844 | - # Use the cluster file for the configuration |
3845 | - def set_configuration(self, config_path=None): |
3846 | - |
3847 | - """Force to use the web configuration file only""" |
3848 | - config_path = pjoin(os.environ['MADGRAPH_BASE'], 'mg5_configuration.txt') |
3849 | - return MadGraphCmd.set_configuration(self, config_path=config_path) |
3850 | - |
3851 | -#=============================================================================== |
3852 | -# MadGraphCmd |
3853 | -#=============================================================================== |
3854 | -class MadGraphCmdShell(MadGraphCmd, CompleteForCmd, CheckValidForCmd, cmd.CmdShell): |
3855 | - """The command line processor of MadGraph""" |
3856 | - |
3857 | - writing_dir = '.' |
3858 | - timeout = 0 # time authorize to answer question [0 is no time limit] |
3859 | - |
3860 | - def preloop(self): |
3861 | - """Initializing before starting the main loop""" |
3862 | - |
3863 | - self.prompt = 'mg5>' |
3864 | - |
3865 | - # By default, load the UFO Standard Model |
3866 | - logger.info("Loading default model: sm") |
3867 | - self.do_import('model sm') |
3868 | - self.history.append('import model sm') |
3869 | - |
3870 | - # preloop mother |
3871 | - cmd.CmdShell.preloop(self) |
3872 | - |
3873 | - |
3874 | + |
3875 | + |
3876 | #=============================================================================== |
3877 | # Command Parser |
3878 | #=============================================================================== |
3879 | |
3880 | === added file 'madgraph/interface/master_interface.py' |
3881 | --- madgraph/interface/master_interface.py 1970-01-01 00:00:00 +0000 |
3882 | +++ madgraph/interface/master_interface.py 2012-03-08 17:31:22 +0000 |
3883 | @@ -0,0 +1,435 @@ |
3884 | +################################################################################ |
3885 | +# |
3886 | +# Copyright (c) 2009 The MadGraph Development team and Contributors |
3887 | +# |
3888 | +# This file is a part of the MadGraph 5 project, an application which |
3889 | +# automatically generates Feynman diagrams and matrix elements for arbitrary |
3890 | +# high-energy processes in the Standard Model and beyond. |
3891 | +# |
3892 | +# It is subject to the MadGraph license which should accompany this |
3893 | +# distribution. |
3894 | +# |
3895 | +# For more information, please visit: http://madgraph.phys.ucl.ac.be |
3896 | +# |
3897 | +################################################################################ |
3898 | +"""A user friendly command line interface to access all MadGraph features. |
3899 | + Uses the cmd package for command interpretation and tab completion. |
3900 | +""" |
3901 | + |
3902 | + |
3903 | +import atexit |
3904 | +import logging |
3905 | +import optparse |
3906 | +import os |
3907 | +import pydoc |
3908 | +import re |
3909 | +import subprocess |
3910 | +import sys |
3911 | +import traceback |
3912 | +import time |
3913 | + |
3914 | +root_path = os.path.split(os.path.dirname(os.path.realpath( __file__ )))[0] |
3915 | +root_path = os.path.split(root_path)[0] |
3916 | +sys.path.insert(0, root_path) |
3917 | + |
3918 | +#usefull shortcut |
3919 | +pjoin = os.path.join |
3920 | + |
3921 | +import madgraph |
3922 | +import madgraph.interface.extended_cmd as cmd |
3923 | +import madgraph.interface.madgraph_interface as MGcmd |
3924 | + |
3925 | +from madgraph import MG4DIR, MG5DIR, MadGraph5Error |
3926 | + |
3927 | +logger = logging.getLogger('cmdprint') # -> stdout |
3928 | + |
3929 | + |
3930 | +class Switcher(object): |
3931 | + """ Helping class containing all the switching routine """ |
3932 | + |
3933 | + def debug_link_to_command(self): |
3934 | + """redefine all the command to call directly the appropriate child""" |
3935 | + |
3936 | + correct = True |
3937 | + # function which should be self.cmd dependent but which doesn't start |
3938 | + # by do_xxxx, help_xxx, check_xxxx or complete_xxx |
3939 | + overwritable = [] |
3940 | + # list of item overwritten by the MasterClass |
3941 | + self.to_preserve = [key for key,method in Switcher.__dict__.items() if |
3942 | + hasattr(method, '__call__') ] |
3943 | + self.to_preserve += ['do_shell', 'help_shell', 'complete_shell'] |
3944 | + |
3945 | + ff = open(pjoin(MG5DIR, 'additional_command'), 'w') |
3946 | + |
3947 | + for key in dir(self): |
3948 | + # by pass all not over-writable command |
3949 | + if key in self.to_preserve: |
3950 | + continue |
3951 | + if not (key.startswith('do_') or key.startswith('complete_') or \ |
3952 | + key.startswith('help_') or key.startswith('check_') or \ |
3953 | + key in overwritable): |
3954 | + continue |
3955 | + text = """\ |
3956 | + def %(key)s(self, *args, **opts): |
3957 | + return self.cmd.%(key)s(self, *args, **opts) |
3958 | + |
3959 | +""" % {'key': key} |
3960 | + logger.warning("""Command %s not define in the Master. |
3961 | + The line to add to the master_interface.py are written in 'additional_command' file""" % key) |
3962 | + ff.write(text) |
3963 | + correct = False |
3964 | + |
3965 | + |
3966 | + # Check that all function define in more than one subclass is define |
3967 | + # in the Switcher or in one of the MasterClass |
3968 | + define = {} |
3969 | + for mother in MasterCmd.__mro__: |
3970 | + if mother.__name__ in ['Cmd', 'BasicCmd', 'ExtendedCmd']: |
3971 | + continue |
3972 | + |
3973 | + |
3974 | + for data in mother.__dict__: |
3975 | + #check if define in Switcher |
3976 | + if data in Switcher.__dict__ or data.startswith('__'): |
3977 | + continue |
3978 | + if data in MasterCmd.__dict__: |
3979 | + #always overwritten in the main class |
3980 | + continue |
3981 | + if data not in define: |
3982 | + define[data] = mother.__name__ |
3983 | + else: |
3984 | + logger.warning('%s define in %s and in %s but not in Switcher.' % (data, define[data], mother.__name__)) |
3985 | + correct = False |
3986 | + |
3987 | + # Do the same for the WEb MasterClass |
3988 | + define = {} |
3989 | + for mother in MasterCmdWeb.__mro__: |
3990 | + if mother.__name__ in ['Cmd', 'BasicCmd', 'ExtendedCmd']: |
3991 | + continue |
3992 | + |
3993 | + for data in mother.__dict__: |
3994 | + #check if define in Switcher |
3995 | + if data in Switcher.__dict__ or data.startswith('__'): |
3996 | + continue |
3997 | + if data in MasterCmdWeb.__dict__: |
3998 | + #always overwritten in the main class |
3999 | + continue |
4000 | + if data not in define: |
4001 | + define[data] = mother.__name__ |
4002 | + else: |
4003 | + logger.warning('%s define in %s and in %s but not in Switcher.' % (data, define[data], mother.__name__)) |
4004 | + correct = False |
4005 | + |
4006 | + if not correct: |
4007 | + raise Exception, 'The Cmd interface has dangerous features. Please see previous warnings and correct those.' |
4008 | + |
4009 | + |
4010 | + |
4011 | + |
4012 | + |
4013 | + def check_add(self, *args, **opts): |
4014 | + return self.cmd.check_add(self, *args, **opts) |
4015 | + |
4016 | + def check_answer_in_input_file(self, *args, **opts): |
4017 | + return self.cmd.check_answer_in_input_file(self, *args, **opts) |
4018 | + |
4019 | + def check_check(self, *args, **opts): |
4020 | + return self.cmd.check_check(self, *args, **opts) |
4021 | + |
4022 | + def check_define(self, *args, **opts): |
4023 | + return self.cmd.check_define(self, *args, **opts) |
4024 | + |
4025 | + def check_display(self, *args, **opts): |
4026 | + return self.cmd.check_display(self, *args, **opts) |
4027 | + |
4028 | + def check_draw(self, *args, **opts): |
4029 | + return self.cmd.check_draw(self, *args, **opts) |
4030 | + |
4031 | + def check_for_export_dir(self, *args, **opts): |
4032 | + return self.cmd.check_for_export_dir(self, *args, **opts) |
4033 | + |
4034 | + def check_generate(self, *args, **opts): |
4035 | + return self.cmd.check_generate(self, *args, **opts) |
4036 | + |
4037 | + def check_history(self, *args, **opts): |
4038 | + return self.cmd.check_history(self, *args, **opts) |
4039 | + |
4040 | + def check_import(self, *args, **opts): |
4041 | + return self.cmd.check_import(self, *args, **opts) |
4042 | + |
4043 | + def check_install(self, *args, **opts): |
4044 | + return self.cmd.check_install(self, *args, **opts) |
4045 | + |
4046 | + def check_launch(self, *args, **opts): |
4047 | + return self.cmd.check_launch(self, *args, **opts) |
4048 | + |
4049 | + def check_load(self, *args, **opts): |
4050 | + return self.cmd.check_load(self, *args, **opts) |
4051 | + |
4052 | + def check_open(self, *args, **opts): |
4053 | + return self.cmd.check_open(self, *args, **opts) |
4054 | + |
4055 | + def check_output(self, *args, **opts): |
4056 | + return self.cmd.check_output(self, *args, **opts) |
4057 | + |
4058 | + def check_process_format(self, *args, **opts): |
4059 | + return self.cmd.check_process_format(self, *args, **opts) |
4060 | + |
4061 | + def check_save(self, *args, **opts): |
4062 | + return self.cmd.check_save(self, *args, **opts) |
4063 | + |
4064 | + def check_set(self, *args, **opts): |
4065 | + return self.cmd.check_set(self, *args, **opts) |
4066 | + |
4067 | + def check_stored_line(self, *args, **opts): |
4068 | + return self.cmd.check_stored_line(self, *args, **opts) |
4069 | + |
4070 | + def complete_add(self, *args, **opts): |
4071 | + return self.cmd.complete_add(self, *args, **opts) |
4072 | + |
4073 | + def complete_check(self, *args, **opts): |
4074 | + return self.cmd.complete_check(self, *args, **opts) |
4075 | + |
4076 | + def complete_define(self, *args, **opts): |
4077 | + return self.cmd.complete_define(self, *args, **opts) |
4078 | + |
4079 | + def complete_display(self, *args, **opts): |
4080 | + return self.cmd.complete_display(self, *args, **opts) |
4081 | + |
4082 | + def complete_draw(self, *args, **opts): |
4083 | + return self.cmd.complete_draw(self, *args, **opts) |
4084 | + |
4085 | + def complete_generate(self, *args, **opts): |
4086 | + return self.cmd.complete_generate(self, *args, **opts) |
4087 | + |
4088 | + def complete_help(self, *args, **opts): |
4089 | + return self.cmd.complete_help(self, *args, **opts) |
4090 | + |
4091 | + def complete_history(self, *args, **opts): |
4092 | + return self.cmd.complete_history(self, *args, **opts) |
4093 | + |
4094 | + def complete_import(self, *args, **opts): |
4095 | + return self.cmd.complete_import(self, *args, **opts) |
4096 | + |
4097 | + def complete_install(self, *args, **opts): |
4098 | + return self.cmd.complete_install(self, *args, **opts) |
4099 | + |
4100 | + def complete_launch(self, *args, **opts): |
4101 | + return self.cmd.complete_launch(self, *args, **opts) |
4102 | + |
4103 | + def complete_load(self, *args, **opts): |
4104 | + return self.cmd.complete_load(self, *args, **opts) |
4105 | + |
4106 | + def complete_open(self, *args, **opts): |
4107 | + return self.cmd.complete_open(self, *args, **opts) |
4108 | + |
4109 | + def complete_output(self, *args, **opts): |
4110 | + return self.cmd.complete_output(self, *args, **opts) |
4111 | + |
4112 | + def complete_save(self, *args, **opts): |
4113 | + return self.cmd.complete_save(self, *args, **opts) |
4114 | + |
4115 | + def complete_set(self, *args, **opts): |
4116 | + return self.cmd.complete_set(self, *args, **opts) |
4117 | + |
4118 | + def complete_tutorial(self, *args, **opts): |
4119 | + return self.cmd.complete_tutorial(self, *args, **opts) |
4120 | + |
4121 | + def do_EOF(self, *args, **opts): |
4122 | + return self.cmd.do_EOF(self, *args, **opts) |
4123 | + |
4124 | + def do_add(self, *args, **opts): |
4125 | + return self.cmd.do_add(self, *args, **opts) |
4126 | + |
4127 | + def do_check(self, *args, **opts): |
4128 | + return self.cmd.do_check(self, *args, **opts) |
4129 | + |
4130 | + def do_define(self, *args, **opts): |
4131 | + return self.cmd.do_define(self, *args, **opts) |
4132 | + |
4133 | + def do_display(self, *args, **opts): |
4134 | + return self.cmd.do_display(self, *args, **opts) |
4135 | + |
4136 | + def do_exit(self, *args, **opts): |
4137 | + return self.cmd.do_exit(self, *args, **opts) |
4138 | + |
4139 | + def do_generate(self, *args, **opts): |
4140 | + return self.cmd.do_generate(self, *args, **opts) |
4141 | + |
4142 | + def do_help(self, *args, **opts): |
4143 | + return self.cmd.do_help(self, *args, **opts) |
4144 | + |
4145 | + def do_history(self, *args, **opts): |
4146 | + return self.cmd.do_history(self, *args, **opts) |
4147 | + |
4148 | + def do_import(self, *args, **opts): |
4149 | + return self.cmd.do_import(self, *args, **opts) |
4150 | + |
4151 | + def do_install(self, *args, **opts): |
4152 | + return self.cmd.do_install(self, *args, **opts) |
4153 | + |
4154 | + def do_launch(self, *args, **opts): |
4155 | + return self.cmd.do_launch(self, *args, **opts) |
4156 | + |
4157 | + def do_load(self, *args, **opts): |
4158 | + return self.cmd.do_load(self, *args, **opts) |
4159 | + |
4160 | + def do_open(self, *args, **opts): |
4161 | + return self.cmd.do_open(self, *args, **opts) |
4162 | + |
4163 | + def do_output(self, *args, **opts): |
4164 | + return self.cmd.do_output(self, *args, **opts) |
4165 | + |
4166 | + def do_quit(self, *args, **opts): |
4167 | + return self.cmd.do_quit(self, *args, **opts) |
4168 | + |
4169 | + def do_save(self, *args, **opts): |
4170 | + return self.cmd.do_save(self, *args, **opts) |
4171 | + |
4172 | + def do_set(self, *args, **opts): |
4173 | + return self.cmd.do_set(self, *args, **opts) |
4174 | + |
4175 | + def do_tutorial(self, *args, **opts): |
4176 | + return self.cmd.do_tutorial(self, *args, **opts) |
4177 | + |
4178 | + def help_EOF(self, *args, **opts): |
4179 | + return self.cmd.help_EOF(self, *args, **opts) |
4180 | + |
4181 | + def help_add(self, *args, **opts): |
4182 | + return self.cmd.help_add(self, *args, **opts) |
4183 | + |
4184 | + def help_check(self, *args, **opts): |
4185 | + return self.cmd.help_check(self, *args, **opts) |
4186 | + |
4187 | + def help_define(self, *args, **opts): |
4188 | + return self.cmd.help_define(self, *args, **opts) |
4189 | + |
4190 | + def help_display(self, *args, **opts): |
4191 | + return self.cmd.help_display(self, *args, **opts) |
4192 | + |
4193 | + def help_generate(self, *args, **opts): |
4194 | + return self.cmd.help_generate(self, *args, **opts) |
4195 | + |
4196 | + def help_help(self, *args, **opts): |
4197 | + return self.cmd.help_help(self, *args, **opts) |
4198 | + |
4199 | + def help_history(self, *args, **opts): |
4200 | + return self.cmd.help_history(self, *args, **opts) |
4201 | + |
4202 | + def help_import(self, *args, **opts): |
4203 | + return self.cmd.help_import(self, *args, **opts) |
4204 | + |
4205 | + def help_install(self, *args, **opts): |
4206 | + return self.cmd.help_install(self, *args, **opts) |
4207 | + |
4208 | + def help_launch(self, *args, **opts): |
4209 | + return self.cmd.help_launch(self, *args, **opts) |
4210 | + |
4211 | + def help_load(self, *args, **opts): |
4212 | + return self.cmd.help_load(self, *args, **opts) |
4213 | + |
4214 | + def help_open(self, *args, **opts): |
4215 | + return self.cmd.help_open(self, *args, **opts) |
4216 | + |
4217 | + def help_output(self, *args, **opts): |
4218 | + return self.cmd.help_output(self, *args, **opts) |
4219 | + |
4220 | + def help_quit(self, *args, **opts): |
4221 | + return self.cmd.help_quit(self, *args, **opts) |
4222 | + |
4223 | + def help_save(self, *args, **opts): |
4224 | + return self.cmd.help_save(self, *args, **opts) |
4225 | + |
4226 | + def help_set(self, *args, **opts): |
4227 | + return self.cmd.help_set(self, *args, **opts) |
4228 | + |
4229 | + def help_tutorial(self, *args, **opts): |
4230 | + return self.cmd.help_tutorial(self, *args, **opts) |
4231 | + |
4232 | + def test_interface(self, *args, **opts): |
4233 | + return self.cmd.test_interface(self, *args, **opts) |
4234 | + |
4235 | + |
4236 | + |
4237 | +class MasterCmd(Switcher, MGcmd.MadGraphCmd, cmd.CmdShell): |
4238 | + |
4239 | + def __init__(self, main='MadGraph', *args, **opt): |
4240 | + |
4241 | + # define the interface |
4242 | + self.change_principal_cmd(main) |
4243 | + self.cmd.__init__(self, *args, **opt) |
4244 | + |
4245 | + |
4246 | + def change_principal_cmd(self, name): |
4247 | + if name == 'MadGraph': |
4248 | + self.cmd = MGcmd.MadGraphCmd |
4249 | + else: |
4250 | + raise MadGraph5Error, 'Type of interface not valid' |
4251 | + |
4252 | + if __debug__: |
4253 | + self.debug_link_to_command() |
4254 | + |
4255 | +class MasterCmdWeb(Switcher, MGcmd.MadGraphCmd): |
4256 | + |
4257 | + timeout = 1 # time authorize to answer question [0 is no time limit] |
4258 | + |
4259 | + def __init__(self, *arg, **opt): |
4260 | + |
4261 | + if os.environ.has_key('_CONDOR_SCRATCH_DIR'): |
4262 | + self.writing_dir = pjoin(os.environ['_CONDOR_SCRATCH_DIR'], \ |
4263 | + os.path.pardir) |
4264 | + else: |
4265 | + self.writing_dir = pjoin(os.environ['MADGRAPH_DATA'], |
4266 | + os.environ['REMOTE_USER']) |
4267 | + |
4268 | + |
4269 | + #standard initialization |
4270 | + MasterCmd.__init__(self, mgme_dir = '', *arg, **opt) |
4271 | + |
4272 | + def change_principal_cmd(self, name): |
4273 | + if name == 'MadGraph': |
4274 | + self.cmd = MGcmd.MadGraphCmdWeb |
4275 | +# elif name == 'Loop': |
4276 | +# self.cmd = NLOcmd.LoopInterfaceWeb |
4277 | + else: |
4278 | + raise MadGraph5Error, 'Type of interface not valid' |
4279 | + |
4280 | + if __debug__: |
4281 | + self.debug_link_to_command() |
4282 | + |
4283 | + def finalize(self, nojpeg): |
4284 | + """Finalize web generation""" |
4285 | + |
4286 | + Switcher.finalize(self, nojpeg, online = True) |
4287 | + |
4288 | + # Generate a new amplitude |
4289 | + def do_generate(self, line): |
4290 | + """Generate an amplitude for a given process""" |
4291 | + |
4292 | + try: |
4293 | + Switcher.do_generate(self, line) |
4294 | + except: |
4295 | + # put the stop logo on the web |
4296 | + files.cp(self._export_dir+'/HTML/stop.jpg',self._export_dir+'/HTML/card.jpg') |
4297 | + raise |
4298 | + |
4299 | + # Add a process to the existing multiprocess definition |
4300 | + def do_add(self, line): |
4301 | + """Generate an amplitude for a given process and add to |
4302 | + existing amplitudes |
4303 | + syntax: |
4304 | + """ |
4305 | + try: |
4306 | + Switcher.do_add(self, line) |
4307 | + except: |
4308 | + # put the stop logo on the web |
4309 | + files.cp(self._export_dir+'/HTML/stop.jpg',self._export_dir+'/HTML/card.jpg') |
4310 | + raise |
4311 | + |
4312 | + # Use the cluster file for the configuration |
4313 | + def set_configuration(self, config_path=None): |
4314 | + |
4315 | + """Force to use the web configuration file only""" |
4316 | + config_path = pjoin(os.environ['MADGRAPH_BASE'], 'mg5_configuration.txt') |
4317 | + return Switcher.set_configuration(self, config_path=config_path) |
4318 | + |
4319 | |
4320 | === modified file 'madgraph/iolibs/export_cpp.py' |
4321 | --- madgraph/iolibs/export_cpp.py 2011-11-10 06:06:00 +0000 |
4322 | +++ madgraph/iolibs/export_cpp.py 2012-03-08 17:31:22 +0000 |
4323 | @@ -32,13 +32,14 @@ |
4324 | import madgraph.iolibs.drawing_eps as draw |
4325 | import madgraph.iolibs.files as files |
4326 | import madgraph.iolibs.helas_call_writers as helas_call_writers |
4327 | -import madgraph.iolibs.misc as misc |
4328 | import madgraph.iolibs.file_writers as writers |
4329 | import madgraph.iolibs.template_files as template_files |
4330 | import madgraph.iolibs.ufo_expression_parsers as parsers |
4331 | from madgraph import MadGraph5Error, InvalidCmd, MG5DIR |
4332 | from madgraph.iolibs.files import cp, ln, mv |
4333 | |
4334 | +import madgraph.various.misc as misc |
4335 | + |
4336 | import aloha.create_aloha as create_aloha |
4337 | import aloha.aloha_writers as aloha_writers |
4338 | |
4339 | |
4340 | === modified file 'madgraph/iolibs/export_python.py' |
4341 | --- madgraph/iolibs/export_python.py 2011-10-29 12:42:14 +0000 |
4342 | +++ madgraph/iolibs/export_python.py 2012-03-08 17:31:22 +0000 |
4343 | @@ -29,13 +29,14 @@ |
4344 | import madgraph.iolibs.drawing_eps as draw |
4345 | import madgraph.iolibs.files as files |
4346 | import madgraph.iolibs.helas_call_writers as helas_call_writers |
4347 | -import madgraph.iolibs.misc as misc |
4348 | import madgraph.iolibs.file_writers as writers |
4349 | import madgraph.iolibs.template_files as Template |
4350 | import madgraph.iolibs.ufo_expression_parsers as parsers |
4351 | import madgraph.iolibs.group_subprocs as group_subprocs |
4352 | from madgraph import MadGraph5Error, MG5DIR |
4353 | |
4354 | +import madgraph.various.misc as misc |
4355 | + |
4356 | import aloha.create_aloha as create_aloha |
4357 | import aloha.aloha_writers as aloha_writers |
4358 | |
4359 | |
4360 | === modified file 'madgraph/iolibs/export_v4.py' |
4361 | --- madgraph/iolibs/export_v4.py 2012-02-03 21:44:27 +0000 |
4362 | +++ madgraph/iolibs/export_v4.py 2012-03-08 17:31:22 +0000 |
4363 | @@ -18,6 +18,7 @@ |
4364 | import fractions |
4365 | import glob |
4366 | import logging |
4367 | +import math |
4368 | import os |
4369 | import re |
4370 | import shutil |
4371 | @@ -30,15 +31,16 @@ |
4372 | import madgraph.iolibs.drawing_eps as draw |
4373 | import madgraph.iolibs.files as files |
4374 | import madgraph.iolibs.group_subprocs as group_subprocs |
4375 | -import madgraph.iolibs.misc as misc |
4376 | import madgraph.iolibs.file_writers as writers |
4377 | import madgraph.iolibs.gen_infohtml as gen_infohtml |
4378 | import madgraph.iolibs.template_files as template_files |
4379 | import madgraph.iolibs.ufo_expression_parsers as parsers |
4380 | import madgraph.various.diagram_symmetry as diagram_symmetry |
4381 | +import madgraph.various.misc as misc |
4382 | import madgraph.various.process_checks as process_checks |
4383 | |
4384 | |
4385 | + |
4386 | import aloha.create_aloha as create_aloha |
4387 | import models.write_param_card as param_writer |
4388 | import models.check_param_card as check_param_card |
4389 | @@ -1068,9 +1070,6 @@ |
4390 | # Add the combine_events.f |
4391 | filename = os.path.join(self.dir_path,'Source','combine_events.f') |
4392 | self.write_combine_events(writers.FortranWriter(filename)) |
4393 | - # Add the write_banner.f |
4394 | - filename = os.path.join(self.dir_path,'Source','write_banner.f') |
4395 | - self.write_write_banner(writers.FortranWriter(filename)) |
4396 | # Add the symmetry.f |
4397 | filename = os.path.join(self.dir_path,'SubProcesses','symmetry.f') |
4398 | self.write_symmetry(writers.FortranWriter(filename)) |
4399 | @@ -1093,7 +1092,7 @@ |
4400 | self.dir_path+'/bin/internal/madevent_interface.py') |
4401 | cp(_file_path+'/interface/extended_cmd.py', |
4402 | self.dir_path+'/bin/internal/extended_cmd.py') |
4403 | - cp(_file_path+'/iolibs/misc.py', self.dir_path+'/bin/internal/misc.py') |
4404 | + cp(_file_path+'/various/misc.py', self.dir_path+'/bin/internal/misc.py') |
4405 | cp(_file_path+'/iolibs/files.py', self.dir_path+'/bin/internal/files.py') |
4406 | cp(_file_path+'/iolibs/save_load_object.py', |
4407 | self.dir_path+'/bin/internal/save_load_object.py') |
4408 | @@ -1316,7 +1315,7 @@ |
4409 | for file in linkfiles: |
4410 | ln('../' + file , '.') |
4411 | |
4412 | - #import nexternal/leshouch in Source |
4413 | + #import nexternal/leshouche in Source |
4414 | ln('nexternal.inc', '../../Source', log=False) |
4415 | ln('leshouche.inc', '../../Source', log=False) |
4416 | ln('maxamps.inc', '../../Source', log=False) |
4417 | @@ -1418,10 +1417,6 @@ |
4418 | os.remove('madevent.tar.gz') |
4419 | misc.compile(mode='None') |
4420 | |
4421 | - if online: |
4422 | - # Touch "Online" file |
4423 | - os.system('touch %s/Online' % self.dir_path) |
4424 | - |
4425 | subprocess.call([os.path.join(old_pos, self.dir_path, 'bin', 'internal', 'gen_cardhtml-pl')], |
4426 | stdout = devnull) |
4427 | |
4428 | @@ -1960,24 +1955,6 @@ |
4429 | return True |
4430 | |
4431 | #=========================================================================== |
4432 | - # write_write_banner |
4433 | - #=========================================================================== |
4434 | - def write_write_banner(self, writer): |
4435 | - """Write the SubProcess/driver.f file for MG4""" |
4436 | - |
4437 | - path = os.path.join(_file_path,'iolibs','template_files','madevent_write_banner.f') |
4438 | - |
4439 | - if self.model_name == 'mssm' or self.model_name.startswith('mssm-'): |
4440 | - card = 'Source/MODEL/MG5_param.dat' |
4441 | - else: |
4442 | - card = 'param_card.dat' |
4443 | - text = open(path).read() % {'param_card_name':card} |
4444 | - |
4445 | - writer.write(text) |
4446 | - |
4447 | - return True |
4448 | - |
4449 | - #=========================================================================== |
4450 | # write_combine_events |
4451 | #=========================================================================== |
4452 | def write_combine_events(self, writer): |
4453 | @@ -2290,10 +2267,11 @@ |
4454 | """Write the files symfact.dat for MG4 by comparing diagrams using |
4455 | the internal matrix element value functionality.""" |
4456 | |
4457 | - |
4458 | + pos = max(2, int(math.ceil(math.log10(len(symmetry))))) |
4459 | + form = "%"+str(pos)+"r %"+str(pos+1)+"r" |
4460 | # Write out lines for symswap.inc file (used to permute the |
4461 | # external leg momenta |
4462 | - lines = [ "%3r %3r" %(i+1, s) for i,s in enumerate(symmetry) if s != 0] |
4463 | + lines = [ form %(i+1, s) for i,s in enumerate(symmetry) if s != 0] |
4464 | |
4465 | # Write the file |
4466 | writer.writelines(lines) |
4467 | |
4468 | === modified file 'madgraph/iolibs/group_subprocs.py' |
4469 | --- madgraph/iolibs/group_subprocs.py 2011-10-29 03:50:27 +0000 |
4470 | +++ madgraph/iolibs/group_subprocs.py 2012-03-08 17:31:22 +0000 |
4471 | @@ -31,11 +31,12 @@ |
4472 | import madgraph.core.helas_objects as helas_objects |
4473 | import madgraph.iolibs.drawing_eps as draw |
4474 | import madgraph.iolibs.files as files |
4475 | -import madgraph.iolibs.misc as misc |
4476 | import madgraph.iolibs.file_writers as writers |
4477 | import madgraph.iolibs.template_files as template_files |
4478 | import madgraph.iolibs.ufo_expression_parsers as parsers |
4479 | |
4480 | +import madgraph.various.misc as misc |
4481 | + |
4482 | import aloha.create_aloha as create_aloha |
4483 | |
4484 | import models.sm.write_param_card as write_param_card |
4485 | |
4486 | === modified file 'madgraph/iolibs/import_v4.py' |
4487 | --- madgraph/iolibs/import_v4.py 2011-10-20 02:47:51 +0000 |
4488 | +++ madgraph/iolibs/import_v4.py 2012-03-08 17:31:22 +0000 |
4489 | @@ -25,14 +25,12 @@ |
4490 | import madgraph.core.color_algebra as color |
4491 | import madgraph.iolibs.files as files |
4492 | import madgraph.iolibs.save_load_object as save_load_object |
4493 | -import madgraph.iolibs.misc as misc |
4494 | + |
4495 | +import madgraph.various.misc as misc |
4496 | |
4497 | from madgraph.core.base_objects import Particle, ParticleList |
4498 | from madgraph.core.base_objects import Interaction, InteractionList |
4499 | |
4500 | - |
4501 | - |
4502 | - |
4503 | logger = logging.getLogger('madgraph.import_v4') |
4504 | |
4505 | #=============================================================================== |
4506 | |
4507 | === modified file 'madgraph/iolibs/template_files/madevent_combine_events.f' |
4508 | --- madgraph/iolibs/template_files/madevent_combine_events.f 2012-02-08 08:52:30 +0000 |
4509 | +++ madgraph/iolibs/template_files/madevent_combine_events.f 2012-03-08 17:31:22 +0000 |
4510 | @@ -651,12 +651,10 @@ |
4511 | c |
4512 | character*(*) plist |
4513 | parameter (plist='subproc.mg') |
4514 | - integer maxsubprocesses |
4515 | - parameter (maxsubprocesses=999) |
4516 | c |
4517 | c Arguments |
4518 | c |
4519 | - character*300 subname(maxsubprocesses) |
4520 | + character*300 subname(*) |
4521 | integer ns |
4522 | c----- |
4523 | c Begin Code |
4524 | |
4525 | === modified file 'madgraph/iolibs/template_files/madevent_makefile_source' |
4526 | --- madgraph/iolibs/template_files/madevent_makefile_source 2011-07-19 20:04:10 +0000 |
4527 | +++ madgraph/iolibs/template_files/madevent_makefile_source 2012-03-08 17:31:22 +0000 |
4528 | @@ -15,7 +15,6 @@ |
4529 | rw_events.o rw_routines.o kin_functions.o open_file.o basecode.o setrun.o \ |
4530 | run_printout.o dgauss.o readgrid.o getissud.o |
4531 | INCLUDEF= coupl.inc genps.inc hbook.inc DECAY/decay.inc psample.inc cluster.inc sudgrid.inc |
4532 | -BANNER = write_banner.o rw_events.o ranmar.o kin_functions.o open_file.o rw_routines.o alfas_functions.o |
4533 | COMBINE = combine_events.o rw_events.o ranmar.o kin_functions.o open_file.o rw_routines.o alfas_functions.o setrun.o |
4534 | GENSUDGRID = gensudgrid.o is-sud.o setrun_gen.o rw_routines.o open_file.o |
4535 | |
4536 | @@ -25,7 +24,7 @@ |
4537 | |
4538 | # Binaries |
4539 | |
4540 | -BINARIES = $(BINDIR)sum_html $(BINDIR)gen_ximprove $(BINDIR)combine_events \ |
4541 | +BINARIES = $(BINDIR)gen_ximprove $(BINDIR)combine_events \ |
4542 | $(BINDIR)gensudgrid $(BINDIR)combine_runs |
4543 | |
4544 | # Compile commands |
4545 | @@ -48,8 +47,6 @@ |
4546 | $(LIBDIR)libmodel.$(libext): MODEL |
4547 | cd MODEL; make |
4548 | |
4549 | -$(BINDIR)sum_html: sum_html.o |
4550 | - $(FC) $(FFLAGS) -o $@ $^ |
4551 | $(BINDIR)gen_ximprove: gen_ximprove.o ranmar.o rw_routines.o open_file.o |
4552 | $(FC) $(FFLAGS) -o $@ $^ |
4553 | $(BINDIR)combine_events: $(COMBINE) $(LIBDIR)libmodel.$(libext) $(LIBDIR)libpdf.$(libext) |
4554 | @@ -64,7 +61,6 @@ |
4555 | dsample.o: dsample.f genps.inc |
4556 | invarients.o: invarients.f genps.inc |
4557 | setrun.o: setrun.f nexternal.inc leshouche.inc genps.inc |
4558 | -sum_html.o: sum_html.f genps.inc |
4559 | gen_ximprove.o: gen_ximprove.f run_config.inc |
4560 | combine_events.o: combine_events.f run_config.inc |
4561 | select_events.o: select_events.f run_config.inc |
4562 | |
4563 | === modified file 'madgraph/iolibs/template_files/madevent_symmetry.f' |
4564 | --- madgraph/iolibs/template_files/madevent_symmetry.f 2012-01-30 03:26:48 +0000 |
4565 | +++ madgraph/iolibs/template_files/madevent_symmetry.f 2012-03-08 17:31:22 +0000 |
4566 | @@ -217,7 +217,7 @@ |
4567 | c local |
4568 | c |
4569 | integer i, j, nbw, ic, icode |
4570 | - integer ncode, nconf |
4571 | + integer ncode, nconf, nsym |
4572 | double precision dconfig |
4573 | character*10 formstr |
4574 | integer iarray(imax) |
4575 | @@ -294,6 +294,7 @@ |
4576 | c Now write out the symmetry factors for each graph |
4577 | c |
4578 | open (unit=26, file = 'symfact.dat', status='unknown') |
4579 | + nsym=int(dlog10(dble(mapconfig(0))))+3 |
4580 | do i=1,mapconfig(0) |
4581 | if (use_config(i) .gt. 0) then |
4582 | c |
4583 | @@ -326,17 +327,19 @@ |
4584 | call enCode(icode,iarray,ibase,imax) |
4585 | if (icode .gt. 0) then |
4586 | nconf=int(dlog10(dble(mapconfig(i))))+1 |
4587 | - write(formstr,'(a,i1,a,i1,a)') '(F',nconf+ncode+1, |
4588 | - $ '.',ncode,',i6)' |
4589 | + write(formstr,'(a,i1,a,i1,a,i1,a)') '(F',nconf+ncode+1, |
4590 | + $ '.',ncode,',i',nsym,')' |
4591 | dconfig=mapconfig(i)+icode*1d0/10**ncode |
4592 | write(26,formstr) dconfig,use_config(i) |
4593 | else |
4594 | - write(26,'(2i6)') mapconfig(i),use_config(i) |
4595 | + write(formstr,'(a,i1,a)') '(2i',nsym,')' |
4596 | + write(26,formstr) mapconfig(i),use_config(i) |
4597 | endif |
4598 | call bw_increment_array(iarray,imax,ibase,done) |
4599 | enddo |
4600 | else |
4601 | - write(26,'(2i6)') mapconfig(i), use_config(i) |
4602 | + write(formstr,'(a,i1,a)') '(2i',nsym,')' |
4603 | + write(26,formstr) mapconfig(i),use_config(i) |
4604 | endif |
4605 | enddo |
4606 | end |
4607 | |
4608 | === removed file 'madgraph/iolibs/template_files/madevent_write_banner.f' |
4609 | --- madgraph/iolibs/template_files/madevent_write_banner.f 2011-07-14 16:19:56 +0000 |
4610 | +++ madgraph/iolibs/template_files/madevent_write_banner.f 1970-01-01 00:00:00 +0000 |
4611 | @@ -1,116 +0,0 @@ |
4612 | - program write_banner |
4613 | - implicit none |
4614 | -c |
4615 | -c parameters |
4616 | -c |
4617 | - integer MaxParticles |
4618 | - parameter (MaxParticles=15) |
4619 | -c |
4620 | -c Local |
4621 | -c |
4622 | - integer lunr, lunw,luni |
4623 | - data luni,lunr,lunw/14,15,16/ ! unit numbers for reading and writing |
4624 | - integer ic(7,MaxParticles),next |
4625 | - double precision P(0:4,MaxParticles),wgt |
4626 | - real*8 sum,mxwgt |
4627 | - logical done |
4628 | - integer i,imax,j |
4629 | - integer nevent,nfound |
4630 | - character*25 infile,outfile |
4631 | - integer iseed |
4632 | - data iseed/9999/ |
4633 | - character*30 process,QED,QCD |
4634 | - double precision scale,aqcd,aqed |
4635 | - integer ievent |
4636 | -c--cuts |
4637 | -c double precision etmin(3:nexternal),etamax(3:nexternal) |
4638 | -c double precision r2min(3:nexternal,3:nexternal) |
4639 | -c double precision s_min(nexternal,nexternal) |
4640 | -c common/to_cuts/ etmin ,etamax , r2min, s_min |
4641 | -c |
4642 | -c open the event file |
4643 | -c |
4644 | - write(*,*) 'input the event file (e.g. Events/events.dat)' |
4645 | - read(*,'(a)') infile |
4646 | - open(unit=lunr,file=infile,status='old') |
4647 | -c |
4648 | -c open banner file |
4649 | -c |
4650 | - write(*,*) 'input the banner file name (e.g. banner-events.dat)' |
4651 | - read(*,'(a)') outfile |
4652 | - open(lunw,file=outfile,status='unknown') |
4653 | -c |
4654 | -c gather the info |
4655 | -c |
4656 | - call setpara('%(param_card_name)s') |
4657 | -c call setcuts |
4658 | -c call get_seed(iseed) |
4659 | -c |
4660 | -c All the info is gathered. Now start writing it out. |
4661 | -c |
4662 | - call write_para(lunw) |
4663 | - write(lunw,'(a70)') '## ' |
4664 | - write(lunw,'(a70)') '##------------------- ' |
4665 | - write(lunw,'(a70)') '## Run-time options ' |
4666 | - write(lunw,'(a70)') '##------------------- ' |
4667 | - write(lunw,'(a70)') '## ' |
4668 | -c write(lunw,'(a70)') '##********************************************************************' |
4669 | -c write(lunw,'(a70)') '## Standard Cuts *' |
4670 | -c write(lunw,'(a70)') '##********************************************************************' |
4671 | -c write(lunw,'(a13,8i8)') '## Particle ',(i,i=3,nexternal) |
4672 | -c write(lunw,'(a13,8f8.1)') '## Et >',(etmin(i),i=3,nexternal) |
4673 | -c write(lunw,'(a13,8f8.1)') '## Eta <',(etamax(i),i=3,nexternal) |
4674 | -c do j=3,nexternal-1 |
4675 | -c write(lunw,'(a,i2,a,8f8.1)') '## d R #',j,' >',(-0.0,i=3,j), |
4676 | -c & (r2min(i,j),i=j+1,nexternal) |
4677 | -c do i=j+1,nexternal |
4678 | -c r2min(i,j)=r2min(i,j)**2 !Since r2 returns distance squared |
4679 | -c enddo |
4680 | -c enddo |
4681 | -c do j=3,nexternal-1 |
4682 | -c write(lunw,'(a,i2,a,8f8.1)') '## s min #',j,'>', |
4683 | -c & (s_min(i,j),i=3,nexternal) |
4684 | -c enddo |
4685 | - write(lunw,'(a70)') '##********************************************************************' |
4686 | -c |
4687 | -c Now write out specific information on the event set |
4688 | -c |
4689 | - done=.false. |
4690 | - nevent=0 |
4691 | - nfound=0 |
4692 | - sum=0d0 |
4693 | - mxwgt=-1d0 |
4694 | - do while (.not. done) |
4695 | - call read_event(lunr,P,wgt,next,ic,ievent,scale,aqcd,aqed,done) |
4696 | - sum=sum+wgt |
4697 | - mxwgt = max(wgt,mxwgt) |
4698 | - nevent=nevent+1 |
4699 | - enddo |
4700 | - |
4701 | - write(lunw,'(a70)') '## ' |
4702 | - write(lunw,'(a70)') '##------------------- ' |
4703 | - write(lunw,'(a70)') '## Event information ' |
4704 | - write(lunw,'(a70)') '##------------------- ' |
4705 | - write(lunw,'(a70)') '## ' |
4706 | - write(lunw,'(a70)') '##********************************************************************' |
4707 | - write(lunw,'(a30,i10)') '## Number of Events : ',nevent |
4708 | - write(lunw,'(a30,e10.5)') '## Integrated weight (pb) : ',sum |
4709 | - write(lunw,'(a30,e10.5)') '## Max wgt : ',mxwgt |
4710 | - write(lunw,'(a30,e10.5)') '## Average wgt : ',sum/nevent |
4711 | - write(lunw,'(a70)') '##********************************************************************' |
4712 | - |
4713 | - rewind(lunr) |
4714 | - done = .false. |
4715 | - nevent=0 |
4716 | - do while (.not. done) |
4717 | - call read_event(lunr,P,wgt,next,ic,ievent,scale,aqcd,aqed,done) |
4718 | - nevent=nevent+1 |
4719 | - if (.not. done) then |
4720 | - call write_event(lunw,p,wgt,next,ic,nevent,scale,aqcd,aqed) |
4721 | - endif |
4722 | - enddo |
4723 | - |
4724 | - close(lunw) |
4725 | - close(lunr) |
4726 | - |
4727 | - end |
4728 | |
4729 | === modified file 'madgraph/various/banner.py' |
4730 | --- madgraph/various/banner.py 2012-02-15 08:20:08 +0000 |
4731 | +++ madgraph/various/banner.py 2012-03-08 17:31:22 +0000 |
4732 | @@ -21,7 +21,7 @@ |
4733 | pjoin = os.path.join |
4734 | |
4735 | try: |
4736 | - import madgraph.iolibs.misc as misc |
4737 | + import madgraph.various.misc as misc |
4738 | from madgraph import MG5DIR |
4739 | MADEVENT = False |
4740 | except: |
4741 | @@ -95,7 +95,16 @@ |
4742 | self.add(pjoin(medir,'Cards', 'proc_card_mg5.dat')) |
4743 | else: |
4744 | self.add(pjoin(medir,'Cards', 'proc_card.dat')) |
4745 | - |
4746 | + |
4747 | + |
4748 | + def change_seed(self, seed): |
4749 | + """Change the seed value in the banner""" |
4750 | + # 0 = iseed |
4751 | + p = re.compile(r'''^\s*\d+\s*=\s*iseed''', re.M) |
4752 | + new_seed_str = " %s = iseed" % seed |
4753 | + self['mgruncard'] = p.sub(new_seed_str, self['mgruncard']) |
4754 | + |
4755 | + |
4756 | ############################################################################ |
4757 | # SPLIT BANNER |
4758 | ############################################################################ |
4759 | |
4760 | === modified file 'madgraph/various/cluster.py' |
4761 | --- madgraph/various/cluster.py 2012-02-05 01:19:01 +0000 |
4762 | +++ madgraph/various/cluster.py 2012-03-08 17:31:22 +0000 |
4763 | @@ -29,6 +29,33 @@ |
4764 | pass |
4765 | |
4766 | |
4767 | +def multiple_try(nb_try=5, sleep=1): |
4768 | + |
4769 | + def deco_retry(f): |
4770 | + def deco_f_retry(*args, **opt): |
4771 | + for i in range(nb_try): |
4772 | + try: |
4773 | + return f(*args, **opt) |
4774 | + except KeyboardInterrupt: |
4775 | + raise |
4776 | + except: |
4777 | + time.sleep(sleep) |
4778 | + raise |
4779 | + return deco_f_retry |
4780 | + return deco_retry |
4781 | + |
4782 | +def check_interupt(error=KeyboardInterrupt): |
4783 | + |
4784 | + def deco_interupt(f): |
4785 | + def deco_f_interupt(self, *args, **opt): |
4786 | + try: |
4787 | + return f(self, *args, **opt) |
4788 | + except error: |
4789 | + self.remove(*args, **opt) |
4790 | + raise error |
4791 | + return deco_f_interupt |
4792 | + return deco_interupt |
4793 | + |
4794 | |
4795 | class Cluster(object): |
4796 | """Basic Class for all cluster type submission""" |
4797 | @@ -40,7 +67,8 @@ |
4798 | self.submitted_ids = [] |
4799 | self.finish = 0 |
4800 | self.cluster_queue = cluster_queue |
4801 | - |
4802 | + |
4803 | + |
4804 | def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None): |
4805 | """How to make one submission. Return status id on the cluster.""" |
4806 | raise NotImplemented, 'No implementation of how to submit a job to cluster \'%s\'' % self.name |
4807 | @@ -68,6 +96,7 @@ |
4808 | """ control the status of a single job with it's cluster id """ |
4809 | raise NotImplemented, 'No implementation of how to control the job status to cluster \'%s\'' % self.name |
4810 | |
4811 | + @check_interupt() |
4812 | def wait(self, me_dir, fct): |
4813 | """Wait that all job are finish""" |
4814 | |
4815 | @@ -83,6 +112,7 @@ |
4816 | self.submitted = 0 |
4817 | self.submitted_ids = [] |
4818 | |
4819 | + @check_interupt() |
4820 | def launch_and_wait(self, prog, argument=[], cwd=None, stdout=None, |
4821 | stderr=None, log=None): |
4822 | """launch one job on the cluster and wait for it""" |
4823 | @@ -92,12 +122,18 @@ |
4824 | if not status in ['R','I']: |
4825 | break |
4826 | time.sleep(30) |
4827 | + |
4828 | + def remove(self, *args): |
4829 | + """ """ |
4830 | + logger.warning("""This cluster didn't support job removal, |
4831 | + the jobs are still running on the cluster.""") |
4832 | |
4833 | class CondorCluster(Cluster): |
4834 | """Basic class for dealing with cluster submission""" |
4835 | |
4836 | name = 'condor' |
4837 | |
4838 | + @multiple_try() |
4839 | def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None): |
4840 | """Submit the """ |
4841 | |
4842 | @@ -110,6 +146,7 @@ |
4843 | notification = Error |
4844 | Initialdir = %(cwd)s |
4845 | %(requirement)s |
4846 | + getenv=True |
4847 | queue 1 |
4848 | """ |
4849 | |
4850 | @@ -153,13 +190,16 @@ |
4851 | self.submitted += 1 |
4852 | self.submitted_ids.append(id) |
4853 | return id |
4854 | - |
4855 | + |
4856 | + @multiple_try() |
4857 | def control_one_job(self, id): |
4858 | """ control the status of a single job with it's cluster id """ |
4859 | cmd = 'condor_q '+str(id)+" -format \'%-2s \\n\' \'ifThenElse(JobStatus==0,\"U\",ifThenElse(JobStatus==1,\"I\",ifThenElse(JobStatus==2,\"R\",ifThenElse(JobStatus==3,\"X\",ifThenElse(JobStatus==4,\"C\",ifThenElse(JobStatus==5,\"H\",ifThenElse(JobStatus==6,\"E\",string(JobStatus))))))))\'" |
4860 | status = subprocess.Popen([cmd], shell=True, stdout=subprocess.PIPE) |
4861 | return status.stdout.readline().strip() |
4862 | - |
4863 | + |
4864 | + @check_interupt() |
4865 | + @multiple_try() |
4866 | def control(self, me_dir): |
4867 | """ control the status of a single job with it's cluster id """ |
4868 | |
4869 | @@ -180,7 +220,17 @@ |
4870 | fail += 1 |
4871 | |
4872 | return idle, run, self.submitted - (idle+run+fail), fail |
4873 | - |
4874 | + |
4875 | + @multiple_try() |
4876 | + def remove(self, *args): |
4877 | + """Clean the jobson the cluster""" |
4878 | + |
4879 | + if not self.submitted_ids: |
4880 | + return |
4881 | + cmd = "condor_rm %s" % ' '.join(self.submitted_ids) |
4882 | + |
4883 | + status = subprocess.Popen([cmd], shell=True, stdout=open(os.devnull,'w')) |
4884 | + |
4885 | class PBSCluster(Cluster): |
4886 | """Basic class for dealing with cluster submission""" |
4887 | |
4888 | @@ -188,7 +238,7 @@ |
4889 | idle_tag = ['Q'] |
4890 | running_tag = ['T','E','R'] |
4891 | |
4892 | - |
4893 | + @multiple_try() |
4894 | def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None): |
4895 | """Submit the prog to the cluser""" |
4896 | |
4897 | @@ -229,8 +279,10 @@ |
4898 | raise ClusterManagmentError, 'fail to submit to the cluster: \n%s' \ |
4899 | % output |
4900 | self.submitted += 1 |
4901 | + self.submitted_ids.append(id) |
4902 | return id |
4903 | |
4904 | + @multiple_try() |
4905 | def control_one_job(self, id): |
4906 | """ control the status of a single job with it's cluster id """ |
4907 | cmd = 'qstat '+str(id) |
4908 | @@ -249,7 +301,7 @@ |
4909 | return 'F' |
4910 | |
4911 | |
4912 | - |
4913 | + @multiple_try() |
4914 | def control(self, me_dir): |
4915 | """ control the status of a single job with it's cluster id """ |
4916 | cmd = "qstat" |
4917 | @@ -275,6 +327,16 @@ |
4918 | |
4919 | return idle, run, self.submitted - (idle+run+fail), fail |
4920 | |
4921 | + @multiple_try() |
4922 | + def remove(self, *args): |
4923 | + """Clean the jobs on the cluster""" |
4924 | + |
4925 | + if not self.submitted_ids: |
4926 | + return |
4927 | + cmd = "qdel %s" % ' '.join(self.submitted_ids) |
4928 | + status = subprocess.Popen([cmd], shell=True, stdout=open(os.devnull,'w')) |
4929 | + |
4930 | + |
4931 | class SGECluster(Cluster): |
4932 | """Basic class for dealing with cluster submission""" |
4933 | # Class written by Arian Abrahantes. |
4934 | @@ -291,6 +353,7 @@ |
4935 | location = location.replace(homePath,'$HOME') |
4936 | return location |
4937 | |
4938 | + @multiple_try() |
4939 | def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None): |
4940 | """Submit the prog to the cluser""" |
4941 | |
4942 | @@ -350,10 +413,12 @@ |
4943 | raise ClusterManagmentError, 'fail to submit to the cluster: \n%s' \ |
4944 | % output |
4945 | self.submitted += 1 |
4946 | + self.submitted_ids.append(id) |
4947 | logger.debug(output) |
4948 | |
4949 | return id |
4950 | |
4951 | + @multiple_try() |
4952 | def control_one_job(self, id): |
4953 | """ control the status of a single job with it's cluster id """ |
4954 | #cmd = 'qstat '+str(id) |
4955 | @@ -375,6 +440,7 @@ |
4956 | return 'R' |
4957 | return 'F' |
4958 | |
4959 | + @multiple_try() |
4960 | def control(self, me_dir): |
4961 | """ control the status of a single job with it's cluster id """ |
4962 | cmd = "qstat " |
4963 | @@ -399,9 +465,138 @@ |
4964 | fail += 1 |
4965 | |
4966 | return idle, run, self.submitted - (idle+run+fail), fail |
4967 | - |
4968 | - |
4969 | -from_name = {'condor':CondorCluster, 'pbs': PBSCluster, 'sge': SGECluster} |
4970 | + |
4971 | + |
4972 | + @multiple_try() |
4973 | + def remove(self, *args): |
4974 | + """Clean the jobs on the cluster""" |
4975 | + |
4976 | + if not self.submitted_ids: |
4977 | + return |
4978 | + cmd = "qdel %s" % ' '.join(self.submitted_ids) |
4979 | + status = subprocess.Popen([cmd], shell=True, stdout=open(os.devnull,'w')) |
4980 | + |
4981 | +class LSFCluster(Cluster): |
4982 | + """Basic class for dealing with cluster submission""" |
4983 | + |
4984 | + name = 'lsf' |
4985 | + |
4986 | + @multiple_try() |
4987 | + def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None): |
4988 | + """Submit the """ |
4989 | + |
4990 | + me_dir = os.path.realpath(os.path.join(cwd,prog)).rsplit('/SubProcesses',1)[0] |
4991 | + me_dir = hashlib.md5(me_dir).hexdigest()[-14:] |
4992 | + if not me_dir[0].isalpha(): |
4993 | + me_dir = 'a' + me_dir[1:] |
4994 | + |
4995 | + text = "" |
4996 | + if cwd is None: |
4997 | + cwd = os.getcwd() |
4998 | + else: |
4999 | + text = " cd %s;" % cwd |
5000 | + if stdout is None: |
Hi Johan,
I'm looking at your modifications. And I have a couple of questions.
First, concerning the $$ syntax.
1) First the selection is done at the end of the generation.
Wouldn't be more efficient to do it on the flight?
2) looks like you have two times the line
dollar = line.find("$")
in cmd_interface
3) you remove the load from the test,
I aggree that this test is often annoying, but shouldn't be better to keep it in order to ensure that this function is working correctly. (Or we can also remove this functions)
4) You also ask me about, every configuration not set in an automaitc way: gen_ximprove. f: parameter (max_amps=9999) gen_ximprove. f: parameter (max_amps=9999) gen_ximprove. f: parameter (max_amps=9999) gen_ximprove. f: parameter (max_amps=9999) sum_html. f: parameter (max_amps=9999, max_iter=50) sum_html. f: parameter (max_amps=9999)
and you have this one (which might be cross in extreme cases):
./Source/
./Source/
./Source/
./Source/
./Source/
./Source/
I also found: template_ files/madevent_ combine_ events. f: parameter (maxsubprocesse s=999)
./iolibs/
But this one is less critical (even if I receive an email of someone with 2600 subprocesses...
but python failed to do the refine in that cases --I think that I solve the python problem, but maybe not...)
5) Do you plan to put the change for ALOHA in this version, or do you want to wait the next one.
(Except for spin 3/2 this is not urgent at all)
Cheers, and thanks for this very good work,
Olivier