Merge lp:~maddevelopers/mg5amcnlo/1.4.6 into lp:mg5amcnlo/lts

Proposed by Olivier Mattelaer
Status: Merged
Merge reported by: Olivier Mattelaer
Merged at revision: not available
Proposed branch: lp:~maddevelopers/mg5amcnlo/1.4.6
Merge into: lp:mg5amcnlo/lts
Diff against target: 11630 lines (+6724/-1292)
76 files modified
Template/Cards/run_card.dat (+13/-1)
Template/README (+94/-11)
Template/Source/PDF/pdfwrap.f (+7/-7)
Template/Source/PDF/pdfwrap_lhapdf.f (+1/-1)
Template/Source/cuts.inc (+6/-0)
Template/Source/genps.inc (+1/-1)
Template/Source/setrun.f (+13/-0)
Template/SubProcesses/addmothers.f (+162/-100)
Template/SubProcesses/cuts.f (+65/-2)
Template/SubProcesses/myamp.f (+4/-0)
Template/SubProcesses/setcuts.f (+17/-0)
Template/bin/internal/addmasses.py (+16/-37)
Template/bin/internal/run_pythia (+2/-1)
Template/bin/madevent (+47/-11)
UpdateNotes.txt (+58/-0)
aloha/aloha_fct.py (+38/-1)
aloha/aloha_writers.py (+3/-3)
aloha/create_aloha.py (+7/-3)
input/mg5_configuration.txt (+11/-8)
madgraph/VERSION (+2/-2)
madgraph/core/base_objects.py (+18/-1)
madgraph/core/helas_objects.py (+10/-4)
madgraph/interface/extended_cmd.py (+61/-19)
madgraph/interface/launch_ext_program.py (+11/-12)
madgraph/interface/madevent_interface.py (+255/-248)
madgraph/interface/madgraph_interface.py (+170/-62)
madgraph/interface/master_interface.py (+22/-0)
madgraph/iolibs/export_cpp.py (+2/-3)
madgraph/iolibs/export_v4.py (+17/-8)
madgraph/iolibs/group_subprocs.py (+23/-13)
madgraph/iolibs/helas_call_writers.py (+3/-11)
madgraph/iolibs/template_files/madevent_combine_events.f (+1/-1)
madgraph/iolibs/template_files/matrix_madevent_group_v4.inc (+1/-1)
madgraph/various/banner.py (+8/-0)
madgraph/various/cluster.py (+174/-13)
madgraph/various/gen_crossxhtml.py (+36/-32)
madgraph/various/misc.py (+100/-1)
madgraph/various/sum_html.py (+5/-1)
models/EWdim6/EWdim6.log (+75/-0)
models/EWdim6/__init__.py (+22/-0)
models/EWdim6/coupling_orders.py (+20/-0)
models/EWdim6/couplings.py (+655/-0)
models/EWdim6/function_library.py (+54/-0)
models/EWdim6/lorentz.py (+335/-0)
models/EWdim6/object_library.py (+245/-0)
models/EWdim6/parameters.py (+503/-0)
models/EWdim6/particles.py (+361/-0)
models/EWdim6/vertices.py (+839/-0)
models/EWdim6/write_param_card.py (+181/-0)
models/check_param_card.py (+5/-4)
models/import_ufo.py (+11/-6)
models/mssm/parameters.py (+2/-2)
models/mssm/restrict_default.dat (+10/-10)
models/mssm/restrict_no_b_mass.dat (+10/-11)
models/mssm/restrict_no_masses.dat (+10/-11)
models/mssm/restrict_no_tau_mass.dat (+10/-11)
models/nmssm/parameters.py (+2/-2)
models/nmssm/restrict_default.dat (+2/-2)
models/sm/coupling_orders.py (+5/-4)
models/sm/couplings.py (+48/-44)
models/sm/lorentz.py (+6/-2)
models/sm/parameters.py (+55/-55)
models/sm/particles.py (+72/-72)
models/sm/restrict_lepton_masses.dat (+53/-0)
models/sm/vertices.py (+218/-212)
models/sm/write_param_card.py (+2/-2)
tests/acceptance_tests/test_cmd.py (+6/-4)
tests/acceptance_tests/test_cmd_madevent.py (+5/-3)
tests/acceptance_tests/test_model_equivalence.py (+6/-5)
tests/parallel_tests/compare_with_old_mg5_version.py (+1/-1)
tests/unit_tests/iolibs/test_export_cpp.py (+700/-152)
tests/unit_tests/iolibs/test_export_v4.py (+290/-9)
tests/unit_tests/iolibs/test_group_subprocs.py (+368/-0)
tests/unit_tests/various/test_aloha.py (+2/-1)
tests/unit_tests/various/test_import_ufo.py (+49/-47)
tests/unit_tests/various/test_process_checks.py (+2/-1)
To merge this branch: bzr merge lp:~maddevelopers/mg5amcnlo/1.4.6
Reviewer Review Type Date Requested Status
marco zaro Pending
Valentin Hirschi Pending
Review via email: mp+105999@code.launchpad.net

Description of the change

See Updates Notes for the modifs.

In principle this doesn't modify anything deep in 2.0, so a fast overview of the changes should be enough in your case.

Cheers,

Olivier

To post a comment you must log in.
Revision history for this message
marco zaro (marco-zaro) wrote :
Download full text (495.0 KiB)

Hi Olivier,
if i try to merge it with our FKS5 branch i get a bunch of conflicts:
they are mainly related to the non-inclusion of the fks/loop funtionalities..
Shall we fix them?
cheers
Marco

Text conflict in aloha/create_aloha.py
Text conflict in madgraph/core/helas_objects.py
Text conflict in madgraph/interface/launch_ext_program.py
Text conflict in madgraph/interface/madgraph_interface.py
Text conflict in madgraph/interface/master_interface.py
Text conflict in madgraph/iolibs/export_v4.py
Text conflict in madgraph/iolibs/helas_call_writers.py
Text conflict in models/import_ufo.py
Text conflict in models/sm/coupling_orders.py
Text conflict in models/sm/couplings.py
Text conflict in models/sm/lorentz.py
Text conflict in models/sm/parameters.py
Text conflict in models/sm/particles.py
Text conflict in models/sm/vertices.py
Text conflict in tests/acceptance_tests/test_cmd.py
Text conflict in tests/acceptance_tests/test_model_equivalence.py
Text conflict in tests/unit_tests/iolibs/test_export_cpp.py
Text conflict in tests/unit_tests/iolibs/test_export_v4.py
Text conflict in tests/unit_tests/iolibs/test_group_subprocs.py
Text conflict in tests/unit_tests/various/test_aloha.py
Text conflict in tests/unit_tests/various/test_import_ufo.py

On 16 May 2012, at 17:24, Olivier Mattelaer wrote:

> You have been requested to review the proposed merge of lp:~maddevelopers/madgraph5/1.4.6 into lp:madgraph5/2.0.
>
> For more details, see:
> https://code.launchpad.net/~maddevelopers/madgraph5/1.4.6/+merge/105999
>
> See Updates Notes for the modifs.
>
> In principle this doesn't modify anything deep in 2.0, so a fast overview of the changes should be enough in your case.
>
> Cheers,
>
> Olivier
>
> --
> https://code.launchpad.net/~maddevelopers/madgraph5/1.4.6/+merge/105999
> You are requested to review the proposed merge of lp:~maddevelopers/madgraph5/1.4.6 into lp:madgraph5/2.0.
> === modified file 'Template/Cards/run_card.dat'
> --- Template/Cards/run_card.dat 2011-12-10 06:11:03 +0000
> +++ Template/Cards/run_card.dat 2012-05-16 15:22:19 +0000
> @@ -27,7 +27,8 @@
> .false. = gridpack !True = setting up the grid pack
> #*********************************************************************
> # Number of events and rnd seed *
> -# Warning: Do not generate more than 100K event in a single run *
> +# Warning: Do not generate more than 1M events in a single run *
> +# If you want to run Pythia, avoid more than 50k events in a run. *
> #*********************************************************************
> 10000 = nevents ! Number of unweighted events requested
> 0 = iseed ! rnd seed (0=assigned automatically=default))
> @@ -194,6 +195,17 @@
> 1d5 = ptj4max ! maximum pt for the fourth jet in pt
> 0 = cutuse ! reject event if fails any (0) / all (1) jet pt cuts
> #*********************************************************************
> +# Control the pt's of leptons sorted by pt *
> +#*********************************************************************
> + 0 = ptl1min ! minimum pt for the leading lepton in pt
> + 0 = ptl2min ! minimum pt for the...

Revision history for this message
Olivier Mattelaer (olivier-mattelaer) wrote :
Download full text (511.9 KiB)

> Shall we fix them?

yes we need to do that. They are a lot of those :-(

Do you want that we do that togheter via Skype?

Cheers,

Olivier

On May 16, 2012, at 10:46 AM, marco zaro wrote:

> Hi Olivier,
> if i try to merge it with our FKS5 branch i get a bunch of conflicts:
> they are mainly related to the non-inclusion of the fks/loop
> funtionalities..
> Shall we fix them?
> cheers
> Marco
>
> Text conflict in aloha/create_aloha.py
> Text conflict in madgraph/core/helas_objects.py
> Text conflict in madgraph/interface/launch_ext_program.py
> Text conflict in madgraph/interface/madgraph_interface.py
> Text conflict in madgraph/interface/master_interface.py
> Text conflict in madgraph/iolibs/export_v4.py
> Text conflict in madgraph/iolibs/helas_call_writers.py
> Text conflict in models/import_ufo.py
> Text conflict in models/sm/coupling_orders.py
> Text conflict in models/sm/couplings.py
> Text conflict in models/sm/lorentz.py
> Text conflict in models/sm/parameters.py
> Text conflict in models/sm/particles.py
> Text conflict in models/sm/vertices.py
> Text conflict in tests/acceptance_tests/test_cmd.py
> Text conflict in tests/acceptance_tests/test_model_equivalence.py
> Text conflict in tests/unit_tests/iolibs/test_export_cpp.py
> Text conflict in tests/unit_tests/iolibs/test_export_v4.py
> Text conflict in tests/unit_tests/iolibs/test_group_subprocs.py
> Text conflict in tests/unit_tests/various/test_aloha.py
> Text conflict in tests/unit_tests/various/test_import_ufo.py
>
>
> On 16 May 2012, at 17:24, Olivier Mattelaer wrote:
>
>> You have been requested to review the proposed merge of
>> lp:~maddevelopers/madgraph5/1.4.6 into lp:madgraph5/2.0.
>>
>> For more details, see:
>> https://code.launchpad.net/~maddevelopers/madgraph5/1.4.6/+merge/
>> 105999
>>
>> See Updates Notes for the modifs.
>>
>> In principle this doesn't modify anything deep in 2.0, so a fast
>> overview of the changes should be enough in your case.
>>
>> Cheers,
>>
>> Olivier
>>
>> --
>> https://code.launchpad.net/~maddevelopers/madgraph5/1.4.6/+merge/
>> 105999
>> You are requested to review the proposed merge of lp:~maddevelopers/
>> madgraph5/1.4.6 into lp:madgraph5/2.0.
>> === modified file 'Template/Cards/run_card.dat'
>> --- Template/Cards/run_card.dat 2011-12-10 06:11:03 +0000
>> +++ Template/Cards/run_card.dat 2012-05-16 15:22:19 +0000
>> @@ -27,7 +27,8 @@
>> .false. = gridpack !True = setting up the grid pack
>> #*********************************************************************
>> # Number of events and rnd
>> seed *
>> -# Warning: Do not generate more than 100K event in a single
>> run *
>> +# Warning: Do not generate more than 1M events in a single
>> run *
>> +# If you want to run Pythia, avoid more than 50k events in a
>> run. *
>> #*********************************************************************
>> 10000 = nevents ! Number of unweighted events requested
>> 0 = iseed ! rnd seed (0=assigned automatically=default))
>> @@ -194,6 +195,17 @@
>> 1d5 = ptj4max ! maximum pt for the fourth jet in pt
>> 0 = cutuse ! reject event if fails any (0) / all (1) jet pt cut...

Revision history for this message
Valentin Hirschi (valentin-hirschi) wrote :
Download full text (518.8 KiB)

Hi Marco,

Of course we shall wait for the complete review of our work before merging
it with madgraph 2.0 but �we still must make sure to stay up to date with
the latest versions of the trunk pushed in madgraph 2.0 so we should fix
the conflicts occurring when merging madgraph 2.0 into FKS5.

Cheers,

On Wed, May 16, 2012 at 5:46 PM, marco zaro <email address hidden> wrote:

> Hi Olivier,
> if i try to merge it with our FKS5 branch i get a bunch of conflicts:
> they are mainly related to the non-inclusion of the fks/loop
> funtionalities..
> Shall we fix them?
> cheers
> Marco
>
> Text conflict in aloha/create_aloha.py
> Text conflict in madgraph/core/helas_objects.py
> Text conflict in madgraph/interface/launch_ext_program.py
> Text conflict in madgraph/interface/madgraph_interface.py
> Text conflict in madgraph/interface/master_interface.py
> Text conflict in madgraph/iolibs/export_v4.py
> Text conflict in madgraph/iolibs/helas_call_writers.py
> Text conflict in models/import_ufo.py
> Text conflict in models/sm/coupling_orders.py
> Text conflict in models/sm/couplings.py
> Text conflict in models/sm/lorentz.py
> Text conflict in models/sm/parameters.py
> Text conflict in models/sm/particles.py
> Text conflict in models/sm/vertices.py
> Text conflict in tests/acceptance_tests/test_cmd.py
> Text conflict in tests/acceptance_tests/test_model_equivalence.py
> Text conflict in tests/unit_tests/iolibs/test_export_cpp.py
> Text conflict in tests/unit_tests/iolibs/test_export_v4.py
> Text conflict in tests/unit_tests/iolibs/test_group_subprocs.py
> Text conflict in tests/unit_tests/various/test_aloha.py
> Text conflict in tests/unit_tests/various/test_import_ufo.py
>
>
> On 16 May 2012, at 17:24, Olivier Mattelaer wrote:
>
> > You have been requested to review the proposed merge of
> lp:~maddevelopers/madgraph5/1.4.6 into lp:madgraph5/2.0.
> >
> > For more details, see:
> > https://code.launchpad.net/~maddevelopers/madgraph5/1.4.6/+merge/105999
> >
> > See Updates Notes for the modifs.
> >
> > In principle this doesn't modify anything deep in 2.0, so a fast
> overview of the changes should be enough in your case.
> >
> > Cheers,
> >
> > Olivier
> >
> > --
> > https://code.launchpad.net/~maddevelopers/madgraph5/1.4.6/+merge/105999
> > You are requested to review the proposed merge of
> lp:~maddevelopers/madgraph5/1.4.6 into lp:madgraph5/2.0.
> > === modified file 'Template/Cards/run_card.dat'
> > --- Template/Cards/run_card.dat � � � 2011-12-10 06:11:03 +0000
> > +++ Template/Cards/run_card.dat � � � 2012-05-16 15:22:19 +0000
> > @@ -27,7 +27,8 @@
> > � .false. � � = gridpack �!True = setting up the grid pack
> > #*********************************************************************
> > # Number of events and rnd seed � � � � � � � � � � � � � � � � � � �*
> > -# Warning: Do not generate more than 100K event in a single run � � �*
> > +# Warning: Do not generate more than 1M events in a single run � � � *
> > +# If you want to run Pythia, avoid more than 50k events in a run. � �*
> > #*********************************************************************
> > � 10000 = nevents ! Number of unweighted events requested
> > � � � 0 � � � = iseed � ! rnd ...

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Template/Cards/run_card.dat'
2--- Template/Cards/run_card.dat 2011-12-10 06:11:03 +0000
3+++ Template/Cards/run_card.dat 2012-05-16 15:22:19 +0000
4@@ -27,7 +27,8 @@
5 .false. = gridpack !True = setting up the grid pack
6 #*********************************************************************
7 # Number of events and rnd seed *
8-# Warning: Do not generate more than 100K event in a single run *
9+# Warning: Do not generate more than 1M events in a single run *
10+# If you want to run Pythia, avoid more than 50k events in a run. *
11 #*********************************************************************
12 10000 = nevents ! Number of unweighted events requested
13 0 = iseed ! rnd seed (0=assigned automatically=default))
14@@ -194,6 +195,17 @@
15 1d5 = ptj4max ! maximum pt for the fourth jet in pt
16 0 = cutuse ! reject event if fails any (0) / all (1) jet pt cuts
17 #*********************************************************************
18+# Control the pt's of leptons sorted by pt *
19+#*********************************************************************
20+ 0 = ptl1min ! minimum pt for the leading lepton in pt
21+ 0 = ptl2min ! minimum pt for the second lepton in pt
22+ 0 = ptl3min ! minimum pt for the third lepton in pt
23+ 0 = ptl4min ! minimum pt for the fourth lepton in pt
24+ 1d5 = ptl1max ! maximum pt for the leading lepton in pt
25+ 1d5 = ptl2max ! maximum pt for the second lepton in pt
26+ 1d5 = ptl3max ! maximum pt for the third lepton in pt
27+ 1d5 = ptl4max ! maximum pt for the fourth lepton in pt
28+#*********************************************************************
29 # Control the Ht(k)=Sum of k leading jets *
30 #*********************************************************************
31 0 = htjmin ! minimum jet HT=Sum(jet pt)
32
33=== modified file 'Template/README'
34--- Template/README 2011-07-06 23:13:41 +0000
35+++ Template/README 2012-05-16 15:22:19 +0000
36@@ -1,9 +1,8 @@
37 MadGraph/MadEvent 5
38-By Fabio Maltoni, Tim Stelzer and the CP3 development team
39+By Johan Alwall, Michel Herquet, Fabio Maltoni, Olivier Mattelaer and Tim Stelzer
40
41 http://madgraph.phys.ucl.ac.be/
42 http://madgraph.hep.uiuc.edu/
43-http://madgraph.roma2.infn.it/
44
45 Information on the process to be generated is found in the file
46 index.html in this directory, which should be viewed using your web
47@@ -11,8 +10,14 @@
48 process. Please refer to the README file one directory above this
49 (MadGraph5_vx_x_x/) for instructions on how to generate a process.
50
51+This README includes information on how
52+A) generate events
53+B) how to run in cluster/multi-core mode
54+C) how to launch sequential run (called multi-run)
55+D) How to launch Pythia/PGS/Delphes
56+E) How to prevent automatic opening of html pages
57
58-To generate events:
59+A) To generate events:
60 -------------------
61
62 1) Specify the model parameters. The model parameters include masses
63@@ -32,7 +37,7 @@
64 example file.
65 **Warning!** For several reasons, avoid running more than 100,000
66 events per run. Instead perform several runs to reach the luminosity
67-you need, e.g. using the bin/multi_run script. Subsequent runs
68+you need, e.g. using the multi_run describe below. Subsequent runs
69 automatically update the random seed, so the results from different
70 runs are statistically independent.
71
72@@ -42,10 +47,88 @@
73 4) Follow the generation and look at the results in the file
74 HTML/crossx.html, using your web browser.
75
76-5) If you want to run Pythia and/or PGS/Delphes on the events,
77-download the Pythia/PGS package (and Delphes) and untar one directory
78-above this (the MadGraph5 directory) and run make. Make sure the cards
79-pythia_card.dat and pgs_card.dat are present in the Cards/ directory.
80-If this is the case, Pythia and PGS will automatically be run by
81-generate_events, or, for an existing run, use bin/run_pythia and
82-bin/run_pgs.
83+5) If you want to run Pythia and/or PGS/Delphes on the events.
84+You first need to install it. For this launch MG5 ($MG5PATH/bin/mg5)
85+and type `install pythia-pgs`/ `install Delphes`.
86+If they are detected, the first question asked when launching ./bin/generate_events
87+should be something like:
88+Which programs do you want to run?
89+ 0 / auto : running existing card
90+ 1 / parton : Madevent
91+ 2 / pythia : MadEvent + Pythia.
92+ 3 / pgs : MadEvent + Pythia + PGS.
93+ [0, 1, 2, 3, auto, parton, pythia, pgs][20s to answer]
94+if this is not that means that you need to specify the path of the new program
95+in the file Cards/me5_configuration.txt . By default they are
96+installed in the MG5 directory.
97+
98+If you need to run one of those programs on some events which are already generated
99+please see instructions below.
100+
101+
102+B) Running in cluster or multicore mode:
103+----------------------------------------
104+
105+In order to automatically run in cluster or multicore mode, please set
106+the flag run_mode in the Cards/me5_configuration.txt file (or in the
107+input/mg5_configuration.txt file before you generate your process):
108+
109+# Default Running mode
110+# 0: single machine/ 1: cluster / 2: multicore
111+run_mode = 0
112+
113+You can also specify the cluster type (for cluster mode) or your
114+preferred number of CPUs (for multicore mode - note that by default,
115+the maximum number of cores is used) by setting cluster_type and
116+nb_core.
117+
118+
119+C) Launch sequential runs for generation of large number of events:
120+-------------------------------------------------------------------
121+
122+For various reason, we recommend not to generate more than 100k events
123+per run. In order to simplify generating large numbers of events,
124+we have created a special command 'multi_run', which is equivalent to
125+running generate_events multiple times (ensuring that the random seed is
126+different for each run), and also automatically combines the resulting
127+lhe files into a single file.
128+This command can be launched via the madevent user interface
129+./bin/madevent using the following command:
130+multi_run NBRUN [RUN_NAME] [options]
131+For more information about this command (valid options), you can type
132+`help multi_run` inside the interface.
133+
134+Note that you can also launch a command whithout entering the interactive mode:
135+./bin/madevent multi_run NBRUN
136+
137+
138+D) Launching pythia/pgs/delphes on a (previously) generated sample:
139+-------------------------------------------------------------------
140+
141+In this section, I will presupose that the corresponding package is
142+already installed and configured properly. (See section how to generate
143+events if this is not the case)
144+
145+In order to launch pythia/pgs/delphes on a sample, you need first to
146+launch the interactive session of madevent `./bin/madevent`
147+and then you can enter of the following command
148+pythia RUN [--run_options]
149+pgs RUN [--run_options]
150+delphes RUN [--run_options]
151+where RUN is the run_name of the run. One of the convenient options is
152+--tag=XXXX
153+which allow to specify the tag name in case of multiple runs with
154+the same program. Note that by default, a unique run tag is generated
155+for each time you run.
156+
157+E) How to prevent automatic opening of the crossx.html page:
158+------------------------------------------------------------
159+
160+Edit the file ./Cards/me5_configuration.txt and set
161+the option automatic_html_opening to `False`.
162+You can also edit the MG5 configuration card
163+input/mg5_configuration.txt
164+in order to have this value on False by default for all subsequently
165+generated processes.
166+
167+
168
169=== modified file 'Template/Source/PDF/pdfwrap.f'
170--- Template/Source/PDF/pdfwrap.f 2010-10-30 03:26:37 +0000
171+++ Template/Source/PDF/pdfwrap.f 2012-05-16 15:22:19 +0000
172@@ -250,13 +250,13 @@
173 .'cteq5f3,','cteq5f4,','cteq5m1,','ctq5hq1,','cteq5l1,',
174 .'cteq6_m,','cteq6_d,','cteq6_l,','cteq6l1,'
175 c
176-c
177- write(6,*) 'Setting it to default cteq6l1'
178- pdlabel='cteq6l1'
179- asmz=0.130d0
180- nloop=1
181- Call SetCtq6(4)
182-
183+c make madgraph to stop evaluating
184+ stop 1
185+c write(6,*) 'Setting it to default cteq6l1'
186+c pdlabel='cteq6l1'
187+c asmz=0.130d0
188+c nloop=1
189+c Call SetCtq6(4)
190 endif
191 return
192 end
193
194=== modified file 'Template/Source/PDF/pdfwrap_lhapdf.f'
195--- Template/Source/PDF/pdfwrap_lhapdf.f 2010-10-30 03:26:37 +0000
196+++ Template/Source/PDF/pdfwrap_lhapdf.f 2012-05-16 15:22:19 +0000
197@@ -54,7 +54,7 @@
198 if(exists)return
199 enddo
200 print*,'Could not find PDFsets directory, quitting'
201- stop
202+ stop 1
203
204 return
205 end
206
207=== modified file 'Template/Source/cuts.inc'
208--- Template/Source/cuts.inc 2011-06-02 20:40:32 +0000
209+++ Template/Source/cuts.inc 2012-05-16 15:22:19 +0000
210@@ -29,6 +29,8 @@
211 REAL*8 cutuse
212 REAL*8 ptj1min,ptj2min,ptj3min,ptj4min
213 REAL*8 ptj1max,ptj2max,ptj3max,ptj4max
214+ REAL*8 ptl1min,ptl2min,ptl3min,ptl4min
215+ REAL*8 ptl1max,ptl2max,ptl3max,ptl4max
216 REAL*8 ht2min,ht3min,ht4min
217 REAL*8 ht2max,ht3max,ht4max
218 REAL*8 htjmin,htjmax,ihtmin,ihtmax
219@@ -48,6 +50,10 @@
220 & ptj2min,ptj2max,
221 & ptj3min,ptj3max,
222 & ptj4min,ptj4max,
223+ & ptl1min,ptl1max,
224+ & ptl2min,ptl2max,
225+ & ptl3min,ptl3max,
226+ & ptl4min,ptl4max,
227 & cutuse,
228 & ht2min,ht3min,ht4min,
229 & ht2max,ht3max,ht4max,
230
231=== modified file 'Template/Source/genps.inc'
232--- Template/Source/genps.inc 2011-05-29 07:23:58 +0000
233+++ Template/Source/genps.inc 2012-05-16 15:22:19 +0000
234@@ -32,4 +32,4 @@
235 REAL*8 LIMHEL
236 PARAMETER(LIMHEL=1e-6)
237 INTEGER MAXTRIES
238- PARAMETER(MAXTRIES=10)
239+ PARAMETER(MAXTRIES=100)
240
241=== modified file 'Template/Source/setrun.f'
242--- Template/Source/setrun.f 2011-10-05 16:27:00 +0000
243+++ Template/Source/setrun.f 2012-05-16 15:22:19 +0000
244@@ -264,6 +264,19 @@
245 call get_real (npara,param,value,"cutuse",cutuse,0d0)
246
247 c*********************************************************************
248+c Check the pt's of leptons sorted by pt *
249+c*********************************************************************
250+
251+ call get_real (npara,param,value,"ptl1min",ptl1min,0d0)
252+ call get_real (npara,param,value,"ptl1max",ptl1max,1d5)
253+ call get_real (npara,param,value,"ptl2min",ptl2min,0d0)
254+ call get_real (npara,param,value,"ptl2max",ptl2max,1d5)
255+ call get_real (npara,param,value,"ptl3min",ptl3min,0d0)
256+ call get_real (npara,param,value,"ptl3max",ptl3max,1d5)
257+ call get_real (npara,param,value,"ptl4min",ptl4min,0d0)
258+ call get_real (npara,param,value,"ptl4max",ptl4max,1d5)
259+
260+c*********************************************************************
261 c Check Ht *
262 c*********************************************************************
263
264
265=== modified file 'Template/SubProcesses/addmothers.f'
266--- Template/SubProcesses/addmothers.f 2012-02-08 08:52:30 +0000
267+++ Template/SubProcesses/addmothers.f 2012-05-16 15:22:19 +0000
268@@ -29,7 +29,7 @@
269 c Variables for combination of color indices (including multipart. vert)
270 integer maxcolmp
271 parameter(maxcolmp=20)
272- integer ncolmp,icolmp(2,maxcolmp)
273+ integer ncolmp,icolmp(2,maxcolmp),is_colors(2,nincoming)
274
275 double precision ZERO
276 parameter (ZERO=0d0)
277@@ -145,7 +145,19 @@
278
279 c Store original maxcolor to know if we have epsilon vertices
280 maxorg=maxcolor
281-
282+c Keep track of IS colors that go through to final state
283+c (since we shouldn't replace pop-up indices with those)
284+ do i=1,nincoming
285+ do j=1,2
286+ is_colors(j,i)=0
287+ do k=3,nexternal
288+ if (iabs(icolalt(j,i)).eq.iabs(icolalt(j,k))) then
289+c This color is going through to FS
290+ is_colors(j,i)=iabs(icolalt(j,i))
291+ endif
292+ enddo
293+ enddo
294+ enddo
295 c
296 c Get mother information from chosen graph
297 c
298@@ -212,7 +224,7 @@
299 c print *,'t-channel: ',i,ida(1),ida(2),mo_color
300 c print *,'colors: ',((icolmp(j,k),j=1,2),k=1,ncolmp)
301 maxcolor=fix_tchannel_color(mo_color,maxcolor,
302- $ ncolmp,icolmp,i,icolalt)
303+ $ ncolmp,icolmp,i,icolalt,is_colors)
304 tchannel=.true.
305 cycle
306 else
307@@ -264,17 +276,23 @@
308 c print *,'s-channel: ',i,mo_color,ida(1),ida(2)
309 c print *,'colors: ',((icolmp(j,k),j=1,2),k=1,ncolmp)
310 if(mo_color.eq.1) then ! color singlet
311- maxcolor=elim_indices(0,0,ncolmp,icolmp,i,icolalt,maxcolor)
312+ maxcolor=elim_indices(0,0,ncolmp,icolmp,i,icolalt,
313+ $ is_colors,maxcolor)
314 elseif(mo_color.eq.-3) then ! color anti-triplet
315- maxcolor=elim_indices(0,1,ncolmp,icolmp,i,icolalt,maxcolor)
316+ maxcolor=elim_indices(0,1,ncolmp,icolmp,i,icolalt,
317+ $ is_colors,maxcolor)
318 elseif(mo_color.eq.3) then ! color triplet
319- maxcolor=elim_indices(1,0,ncolmp,icolmp,i,icolalt,maxcolor)
320+ maxcolor=elim_indices(1,0,ncolmp,icolmp,i,icolalt,
321+ $ is_colors,maxcolor)
322 elseif(mo_color.eq.-6) then ! color anti-sextet
323- maxcolor=elim_indices(0,2,ncolmp,icolmp,i,icolalt,maxcolor)
324+ maxcolor=elim_indices(0,2,ncolmp,icolmp,i,icolalt,
325+ $ is_colors,maxcolor)
326 elseif(mo_color.eq.6) then ! color sextet
327- maxcolor=elim_indices(2,0,ncolmp,icolmp,i,icolalt,maxcolor)
328+ maxcolor=elim_indices(2,0,ncolmp,icolmp,i,icolalt,
329+ $ is_colors,maxcolor)
330 elseif(mo_color.eq.8) then ! color octet
331- maxcolor=elim_indices(1,1,ncolmp,icolmp,i,icolalt,maxcolor)
332+ maxcolor=elim_indices(1,1,ncolmp,icolmp,i,icolalt,
333+ $ is_colors,maxcolor)
334 else ! 2 indicates multipart. vertex
335 da_color(1) = get_color(jpart(1,ida(1)))
336 da_color(2) = get_color(jpart(1,ida(2)))
337@@ -450,7 +468,7 @@
338
339 c********************************************************************
340 function fix_tchannel_color(mo_color,maxcolor,ncolmp,icolmp,ires,
341- $ icol)
342+ $ icol,is_colors)
343 c********************************************************************
344 c Successively eliminate identical pairwise color indices from the
345 c icolmp list, until only (max) one triplet and one antitriplet remains
346@@ -461,6 +479,7 @@
347 integer fix_tchannel_color
348 integer mo_color,maxcolor,ncolmp,icolmp(2,*)
349 integer ires,icol(2,-nexternal+2:2*nexternal-3)
350+ integer is_colors(2,nincoming)
351 integer i,j,i3,i3bar,max3,max3bar,min3,min3bar,maxcol,mincol
352
353 c Successively eliminate color indices in pairs until only the wanted
354@@ -478,26 +497,18 @@
355 i3bar=0
356 icol(1,ires)=0
357 icol(2,ires)=0
358- min3=1000
359- max3=0
360- min3bar=1000
361- max3bar=0
362 do i=1,ncolmp
363 if(icolmp(1,i).gt.0)then
364 i3=i3+1
365 c color for t-channels needs to be reversed
366 if(i3.eq.1) icol(2,ires)=icolmp(1,i)
367 if(i3.eq.2) icol(1,ires)=-icolmp(1,i)
368- if(icolmp(1,i).gt.max3) max3=icolmp(1,i)
369- if(icolmp(1,i).lt.min3) min3=icolmp(1,i)
370 endif
371 if(icolmp(2,i).gt.0)then
372 i3bar=i3bar+1
373 c color for t-channels needs to be reversed
374 if(i3bar.eq.1) icol(1,ires)=icolmp(2,i)
375 if(i3bar.eq.2) icol(2,ires)=-icolmp(2,i)
376- if(icolmp(2,i).gt.max3bar) max3bar=icolmp(2,i)
377- if(icolmp(2,i).lt.min3bar) min3bar=icolmp(2,i)
378 endif
379 enddo
380
381@@ -513,7 +524,10 @@
382 if(mo_color.eq.8.and.i3.eq.1.and.i3bar.eq.1) return
383
384 c Make sure that max and min don't come from the same octet
385- call clean_max_min(icolmp,ncolmp,max3,min3,max3bar,min3bar,i3,i3bar)
386+ call find_max_min(icolmp,ncolmp,max3,min3,max3bar,min3bar,
387+ $ i3,i3bar,is_colors)
388+c print *,'After finding: ',ncolmp,((icolmp(j,i),j=1,2),i=1,ncolmp)
389+c print *,'mo_color = ',mo_color
390
391 if(mo_color.le.1.and.i3-i3bar.eq.2.or.
392 $ mo_color.le.1.and.i3bar-i3.eq.2.or.
393@@ -533,6 +547,17 @@
394 enddo
395 c print *,'Replaced ',maxcol,' by ',mincol
396 elseif(mo_color.le.1.and.i3.eq.2.and.i3bar.eq.2) then
397+c Ensure that max > min
398+ if(max3bar.lt.min3)then
399+ i=min3
400+ min3=max3bar
401+ max3bar=i
402+ endif
403+ if(max3.lt.min3bar)then
404+ i=min3bar
405+ min3bar=max3
406+ max3=i
407+ endif
408 c Replace the maximum indices with the minimum ones everywhere
409 do i=ires+1,-1
410 do j=1,2
411@@ -597,7 +622,8 @@
412 end
413
414 c*******************************************************************
415- function elim_indices(n3,n3bar,ncolmp,icolmp,ires,icol,maxcolor)
416+ function elim_indices(n3,n3bar,ncolmp,icolmp,ires,icol,
417+ $ is_colors,maxcolor)
418 c*******************************************************************
419 c Successively eliminate identical pairwise color indices from the
420 c icolmp list, until only the wanted indices remain
421@@ -614,6 +640,7 @@
422 integer elim_indices
423 integer n3,n3bar,ncolmp,icolmp(2,*),maxcolor
424 integer ires,icol(2,-nexternal+2:2*nexternal-3)
425+ integer is_colors(2,nincoming)
426 integer i,j,i3,i3bar
427
428 c Successively eliminate color indices in pairs until only the wanted
429@@ -669,7 +696,8 @@
430 $ n3.eq.1.and.n3bar.eq.1.and.i3-i3bar.eq.0.or.
431 $ n3.eq.0.and.n3bar.eq.0.and.i3-i3bar.eq.0)then
432 c We have a previous epsilon which gives the wrong pop-up index
433- call fix_s_color_indices(n3,n3bar,i3,i3bar,ncolmp,icolmp,ires,icol)
434+ call fix_s_color_indices(n3,n3bar,i3,i3bar,ncolmp,icolmp,
435+ $ ires,icol,is_colors)
436 else
437 c Don't know how to deal with this
438 call write_error(1001,n3,n3bar)
439@@ -683,7 +711,7 @@
440
441 c*******************************************************************
442 subroutine fix_s_color_indices(n3,n3bar,i3,i3bar,ncolmp,icolmp,
443- $ ires,icol)
444+ $ ires,icol,is_colors)
445 c*******************************************************************
446 c
447 c Fix color flow if some particle has got the wrong pop-up color
448@@ -694,37 +722,27 @@
449 include 'nexternal.inc'
450 integer n3,n3bar,ncolmp,icolmp(2,*),maxcolor
451 integer ires,icol(2,-nexternal+2:2*nexternal-3)
452+ integer is_colors(2,nincoming)
453 integer i,j,i3,i3bar
454 integer max_n3,max_n3bar,min_n3,min_n3bar,maxcol,mincol
455
456- max_n3=0
457- max_n3bar=0
458- min_n3=1000
459- min_n3bar=1000
460- do i=1,ncolmp
461- if(icolmp(1,i).gt.max_n3)
462- $ max_n3=icolmp(1,i)
463- if(icolmp(2,i).gt.max_n3bar)
464- $ max_n3bar=icolmp(2,i)
465- if(icolmp(1,i).gt.0.and.icolmp(1,i).lt.min_n3)
466- $ min_n3=icolmp(1,i)
467- if(icolmp(2,i).gt.0.and.icolmp(2,i).lt.min_n3bar)
468- $ min_n3bar=icolmp(2,i)
469- enddo
470-
471 icol(1,ires)=0
472 icol(2,ires)=0
473
474+c print *,'Colors: ',ncolmp,((icolmp(j,i),j=1,2),i=1,ncolmp)
475+c print *,'n3,n3bar,i3,i3bar: ',n3,n3bar,i3,i3bar
476+
477 c Make sure that max and min don't come from the same octet
478- call clean_max_min(icolmp,ncolmp,max_n3,min_n3,
479- $ max_n3bar,min_n3bar,i3,i3bar)
480+ call find_max_min(icolmp,ncolmp,max_n3,min_n3,
481+ $ max_n3bar,min_n3bar,i3,i3bar,is_colors)
482+c print *,'max3,min3bar,min3,max3bar: ',max_n3,min_n3bar,min_n3,max_n3bar
483
484 if(n3.eq.1.and.n3bar.eq.0.and.i3-i3bar.eq.n3.or.
485 $ n3bar.eq.1.and.n3.eq.0.and.i3bar-i3.eq.n3bar.or.
486 $ n3bar.eq.1.and.n3.eq.1.and.i3bar-i3.eq.0.or.
487 $ n3bar.eq.0.and.n3.eq.0.and.i3bar-i3.eq.0)then
488 c Replace the highest 3bar-index with the lowest 3-index,
489-c and vice versa
490+c or vice versa
491 maxcol=max(max_n3,max_n3bar)
492 if(maxcol.eq.max_n3) then
493 mincol=min_n3bar
494@@ -754,73 +772,117 @@
495 end
496
497 c*******************************************************************************
498- subroutine clean_max_min(icolmp,ncolmp,max3,min3,max3bar,min3bar,i3,i3bar)
499+ subroutine find_max_min(icolmp,ncolmp,max3,min3,max3bar,min3bar,
500+ $ i3,i3bar,is_colors)
501 c*******************************************************************************
502 implicit none
503+ include 'nexternal.inc'
504 integer ncolmp,icolmp(2,*)
505- integer i,j,max3,max3bar,min3,min3bar,i3,i3bar
506-
507-c Make sure that max and min don't come from the same octet
508+ integer is_colors(2,nincoming)
509+ integer i,j,k,max3,max3bar,min3,min3bar,i3,i3bar,i3now,i3barnow
510+ integer allpairs(2,nexternal),npairs,maxcol,mincol
511+
512+ i3now=i3
513+ i3barnow=i3bar
514+
515+c Create all possible pairs (3,3bar) that
516+c 1. come from different octets, 2. are different,
517+c 3. don't contain any color lines passing through the event
518+ npairs = 0
519+ do 20 i=1,ncolmp
520+ if(icolmp(1,i).eq.0) goto 20
521+ do k=1,nincoming
522+ if(icolmp(1,i).eq.is_colors(1,k)) goto 20
523+ enddo
524+ do 10 j=1,ncolmp
525+ if(i.eq.j.or.icolmp(2,j).eq.0.or.
526+ $ icolmp(1,i).eq.icolmp(2,j)) goto 10
527+ do k=1,nincoming
528+ if(icolmp(2,j).eq.is_colors(2,k)) goto 10
529+ enddo
530+ npairs=npairs+1
531+ allpairs(1,npairs)=icolmp(1,i)
532+ allpairs(2,npairs)=icolmp(2,j)
533+ 10 enddo
534+ 20 enddo
535+
536+c print *,'is_colors: ',((is_colors(i,j),i=1,2),j=1,nincoming)
537+c print *,'pairs: ',((allpairs(i,j),i=1,2),j=1,npairs)
538+
539+c Find the pairs with maximum 3 and 3bar
540+ min3=1000
541+ min3bar=1000
542+ max3=0
543+ max3bar=0
544+ do i=1,npairs
545+ if(allpairs(1,i).gt.max3.and.
546+ $ (allpairs(2,i).lt.max3bar.or.
547+ $ allpairs(1,i).gt.allpairs(2,i)))then
548+ max3=allpairs(1,i)
549+ min3bar=allpairs(2,i)
550+ else if(allpairs(2,i).gt.max3bar.and.
551+ $ (allpairs(1,i).lt.max3.or.
552+ $ allpairs(2,i).gt.allpairs(1,i)))then
553+ max3bar=allpairs(2,i)
554+ min3=allpairs(1,i)
555+ endif
556+ enddo
557+
558+c Find "maximum" pairs with minimum 3 and 3bar
559+ do i=1,npairs
560+ if(allpairs(1,i).eq.max3.and.
561+ $ allpairs(2,i).lt.min3bar.and.
562+ $ allpairs(2,i).ne.max3bar)
563+ $ min3bar=allpairs(2,i)
564+ if(allpairs(2,i).eq.max3bar.and.
565+ $ allpairs(1,i).lt.min3.and.
566+ $ allpairs(1,i).ne.max3)
567+ $ min3=allpairs(1,i)
568+ enddo
569+
570+ if (max3.gt.0.and.max3bar.gt.0) then
571+c We have found our two pairs, so we're done
572+ return
573+ endif
574+
575+ if(max3.gt.0.or.max3bar.gt.0)then
576+ i3now=i3now-1
577+ i3barnow=i3barnow-1
578+ endif
579+
580+c Find pair for non-maximum (where we allow all colors)
581+ maxcol=max(max3,max3bar)
582+ if(maxcol.eq.max3) then
583+ mincol=min3bar
584+ else
585+ mincol=min3
586+ endif
587+
588+ npairs=0
589 do i=1,ncolmp
590- if(icolmp(1,i).eq.max3.and.icolmp(2,i).eq.min3bar)then
591- min3bar=1000
592- do j=1,ncolmp
593- if(j.eq.i) cycle
594- if(icolmp(2,j).lt.min3bar) min3bar=icolmp(2,j)
595- enddo
596- endif
597- if(icolmp(2,i).eq.max3bar.and.icolmp(1,i).eq.min3)then
598- min3=1000
599- do j=1,ncolmp
600- if(j.eq.i) cycle
601- if(icolmp(1,j).lt.min3) min3=icolmp(1,j)
602- enddo
603- endif
604+ if(icolmp(1,i).eq.0.and.i3now.gt.0) cycle
605+ if(icolmp(1,i).eq.maxcol.or.icolmp(1,i).eq.mincol)
606+ $ cycle
607+ do j=1,ncolmp
608+ if(icolmp(2,j).eq.0.and.i3barnow.gt.0) cycle
609+ if(i.eq.j.or.icolmp(1,i).eq.icolmp(2,j)) cycle
610+ if(icolmp(2,j).eq.maxcol.or.icolmp(2,j).eq.mincol)
611+ $ cycle
612+ npairs=npairs+1
613+ allpairs(1,npairs)=icolmp(1,i)
614+ allpairs(2,npairs)=icolmp(2,j)
615+ enddo
616 enddo
617-
618-c ...and that max and min are different
619- if(i3.gt.1.and.max3.eq.min3.or.i3bar.gt.1.and.max3bar.eq.min3bar)then
620- if(max3.gt.max3bar)then
621-c Need to change min3, while still ensuring that max3bar is ok
622- max3bar=0
623- min3=1000
624- do i=1,ncolmp
625- if(icolmp(2,i).gt.max3bar.and.icolmp(2,i).ne.min3bar)
626- $ max3bar=icolmp(2,i)
627- if(icolmp(1,i).lt.min3.and.icolmp(1,i).ne.max3)
628- $ min3=icolmp(1,i)
629- enddo
630-c Make sure that max3bar and min3 don't come from the same octet
631- do i=1,ncolmp
632- if(icolmp(2,i).eq.max3bar.and.icolmp(1,i).eq.min3)then
633- min3=1000
634- do j=1,ncolmp
635- if(j.eq.i.or.icolmp(1,j).eq.max3) cycle
636- if(icolmp(1,j).lt.min3) min3=icolmp(1,j)
637- enddo
638- endif
639- enddo
640+ if(npairs.ge.1)then
641+ if(maxcol.eq.max3)then
642+ min3=allpairs(1,1)
643+ max3bar=allpairs(2,1)
644 else
645-c Need to change min3bar, while still ensuring that max3 is ok
646- max3=0
647- min3bar=1000
648- do i=1,ncolmp
649- if(icolmp(1,i).gt.max3.and.icolmp(1,i).ne.min3)
650- $ max3=icolmp(1,i)
651- if(icolmp(2,i).lt.min3bar.and.icolmp(2,i).ne.max3bar)
652- $ min3bar=icolmp(2,i)
653- enddo
654-c Make sure that max3 and min3bar don't come from the same octet
655- do i=1,ncolmp
656- if(icolmp(1,i).eq.max3.and.icolmp(2,i).eq.min3bar)then
657- min3bar=1000
658- do j=1,ncolmp
659- if(j.eq.i.or.icolmp(2,j).eq.max3bar) cycle
660- if(icolmp(2,j).lt.min3bar) min3bar=icolmp(2,j)
661- enddo
662- endif
663- enddo
664+ max3=allpairs(1,1)
665+ min3bar=allpairs(2,1)
666 endif
667 endif
668+
669+c print *,'allpairs: ',((allpairs(i,j),i=1,2),j=1,npairs)
670
671 end
672
673=== modified file 'Template/SubProcesses/cuts.f'
674--- Template/SubProcesses/cuts.f 2011-12-13 16:49:59 +0000
675+++ Template/SubProcesses/cuts.f 2012-05-16 15:22:19 +0000
676@@ -51,7 +51,7 @@
677 C
678 LOGICAL FIRSTTIME,FIRSTTIME2,pass_bw,notgood,good,foundheavy
679 LOGICAL DEBUG
680- integer i,j,njets,nheavyjets,hardj1,hardj2
681+ integer i,j,njets,nheavyjets,nleptons,hardj1,hardj2
682 REAL*8 XVAR,ptmax1,ptmax2,htj,tmp,inclht
683 real*8 ptemp(0:3), ptemp2(0:3)
684 character*20 formstr
685@@ -74,6 +74,7 @@
686
687 double precision ptjet(nexternal)
688 double precision ptheavyjet(nexternal)
689+ double precision ptlepton(nexternal)
690 double precision temp
691
692 double precision etmin(nincoming+1:nexternal),etamax(nincoming+1:nexternal)
693@@ -93,6 +94,9 @@
694 logical jetor
695 common/to_jet_cuts/ ptjmin4,ptjmax4,htjmin4,htjmax4,jetor
696
697+ double precision ptlmin4(4),ptlmax4(4)
698+ common/to_lepton_cuts/ ptlmin4,ptlmax4
699+
700 c
701 c Special cuts
702 c
703@@ -545,7 +549,66 @@
704 passcuts=.false.
705 return
706 endif
707-
708+
709+C
710+C maximal and minimal pt of the leptons sorted by pt
711+c
712+ nleptons=0
713+
714+ if(ptl1min.gt.0.or.ptl2min.gt.0.or.ptl3min.gt.0.or.ptl4min.gt.0.or.
715+ $ ptl1max.lt.1d5.or.ptl2max.lt.1d5.or.
716+ $ ptl3max.lt.1d5.or.ptl4max.lt.1d5) then
717+
718+c - fill ptlepton with the pt's of the leptons.
719+ do i=nincoming+1,nexternal
720+ if(is_a_l(i)) then
721+ nleptons=nleptons+1
722+ ptlepton(nleptons)=pt(p(0,i))
723+ endif
724+ enddo
725+ if(debug) write (*,*) 'not yet ordered ',njets,' ',ptjet
726+
727+c - check existance of leptons if lepton cuts are on
728+ if(nleptons.lt.1.and.ptl1min.gt.0.or.
729+ $ nleptons.lt.2.and.ptl2min.gt.0.or.
730+ $ nleptons.lt.3.and.ptl3min.gt.0.or.
731+ $ nleptons.lt.4.and.ptl4min.gt.0)then
732+ if(debug) write (*,*) i, ' too few leptons -> fails'
733+ passcuts=.false.
734+ return
735+ endif
736+
737+c - sort lepton pts
738+ do i=1,nleptons-1
739+ do j=i+1,nleptons
740+ if(ptlepton(j).gt.ptlepton(i)) then
741+ temp=ptlepton(i)
742+ ptlepton(i)=ptlepton(j)
743+ ptlepton(j)=temp
744+ endif
745+ enddo
746+ enddo
747+ if(debug) write (*,*) 'ordered ',nleptons,' ',ptlepton
748+
749+ if(nleptons.gt.0) then
750+
751+ notgood = .false.
752+ do i=1,nleptons
753+ if(debug) write (*,*) i,ptlepton(i), ' ',ptlmin4(min(i,4)),':',ptlmax4(min(i,4))
754+c--- if one of the leptons does not pass, the event is rejected
755+ notgood=notgood.or.(ptlepton(i).gt.ptlmax4(min(i,4))).or.
756+ $ (ptlepton(i).lt.ptlmin4(min(i,4)))
757+ if(debug) write (*,*) i,' notgood total:', notgood
758+ enddo
759+
760+
761+ if (notgood) then
762+ if(debug) write (*,*) i, ' multiple pt -> fails'
763+ passcuts=.false.
764+ return
765+ endif
766+ endif
767+ endif
768 C>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
769 C SPECIAL CUTS
770 C<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
771
772=== modified file 'Template/SubProcesses/myamp.f'
773--- Template/SubProcesses/myamp.f 2011-10-10 07:34:37 +0000
774+++ Template/SubProcesses/myamp.f 2012-05-16 15:22:19 +0000
775@@ -566,6 +566,10 @@
776 xo = max(xo, ht4min**2/stot)
777 xo = max(xo, misset**2/stot)
778 xo = max(xo, ptllmin**2/stot)
779+ xo = max(xo, ptl1min**2/stot)
780+ xo = max(xo, ptl2min**2/stot)
781+ xo = max(xo, ptl3min**2/stot)
782+ xo = max(xo, ptl4min**2/stot)
783 if (swidth(i).eq.0.and.xo.eq.1d0/stot) then
784 write(*,*) 'Warning: No minimum found for integration'
785 write(*,*) ' Setting minimum to ',1d0/stot
786
787=== modified file 'Template/SubProcesses/setcuts.f'
788--- Template/SubProcesses/setcuts.f 2012-02-24 08:51:01 +0000
789+++ Template/SubProcesses/setcuts.f 2012-05-16 15:22:19 +0000
790@@ -59,6 +59,9 @@
791 logical jetor
792 common/to_jet_cuts/ ptjmin4,ptjmax4,htjmin4,htjmax4,jetor
793
794+ double precision ptlmin4(4),ptlmax4(4)
795+ common/to_lepton_cuts/ ptlmin4,ptlmax4
796+
797 double precision xqcutij(nexternal,nexternal),xqcuti(nexternal)
798 common/to_xqcuts/xqcutij,xqcuti
799 c
800@@ -413,6 +416,20 @@
801 inclHtmax=ihtmax
802
803 jetor = cutuse.eq.0d0
804+
805+c
806+c EXTRA LEPTON CUTS
807+c
808+ ptlmin4(1)=ptl1min
809+ ptlmin4(2)=ptl2min
810+ ptlmin4(3)=ptl3min
811+ ptlmin4(4)=ptl4min
812+
813+ ptlmax4(1)=ptl1max
814+ ptlmax4(2)=ptl2max
815+ ptlmax4(3)=ptl3max
816+ ptlmax4(4)=ptl4max
817+
818 c
819 c ERROR TRAPS
820 c
821
822=== modified file 'Template/bin/internal/addmasses.py'
823--- Template/bin/internal/addmasses.py 2011-07-26 16:15:01 +0000
824+++ Template/bin/internal/addmasses.py 2012-05-16 15:22:19 +0000
825@@ -174,7 +174,6 @@
826 event.append(Particle(nup,t))
827 counter=counter+1
828
829-
830 #default is to skip this
831 if motherFlag:
832
833@@ -223,41 +222,20 @@
834 mySub = re.compile(s1)
835 event_description = mySub.sub(str(nup),event_description)
836
837-
838 if nAdded>0:
839- totalLength = len(event)+1
840- newPosition = []
841- iPos=0
842- while iPos<totalLength:
843- for p in event:
844- if p.mo1==iPos:
845- newPosition.append(p.no)
846- iPos=iPos+1
847-
848- iUp=1
849- event0=[]
850- for ip in newPosition:
851- event0.append(event[ip-1])
852-
853- iUp=0
854- for p in event0:
855- iUp=iUp+1
856- if p.no != iUp:
857- ip=iUp
858- while ip<totalLength-1:
859- pp=event0[ip]
860- if pp.mo1==p.no and pp.mo1>pp.no:
861- pp.mo1=pp.mo2=iUp
862- ip=ip+1
863- p.no=iUp
864-
865- iUp=0
866- for p in event0:
867- event[iUp]=event0[iUp]
868- iUp=iUp+1
869-
870-
871-
872+ for ip in range(len(event)):
873+ l=event[ip]
874+ if l.mo1 > ip + 1:
875+ nmo=l.mo1
876+ event.insert(ip, event.pop(l.mo1-1))
877+ event[ip].no = ip + 1
878+ for l2 in event[ip + 1:]:
879+ if l2.no > ip and l2.no < nmo + 1:
880+ l2.no += 1
881+ if l2.mo1 == nmo:
882+ l2.mo1 = l2.mo2 = ip + 1
883+ elif l2.mo1 > ip and l2.mo1 < nmo:
884+ l2.mo1 = l2.mo2 = l2.mo1 + 1
885
886 # identify mothers
887 particleDict={}
888@@ -268,14 +246,15 @@
889 pass
890 else:
891 if p.mo1 in particleDict:
892- l=[particleDict[p.mo1]]
893+ l=particleDict[p.mo1]
894 l.append(p.no)
895 else:
896- l=p.no
897+ l=[p.no]
898 particleDict[p.mo1]=l
899
900 # repair kinematics
901 for k in particleDict:
902+ if len(particleDict[k]) != 2: continue
903 t=particleDict[k]
904 p1=event[t[0]-1]
905 p1.mom.boost(event[k-1].mom,-1)
906
907=== modified file 'Template/bin/internal/run_pythia'
908--- Template/bin/internal/run_pythia 2011-10-18 03:42:31 +0000
909+++ Template/bin/internal/run_pythia 2012-05-16 15:22:19 +0000
910@@ -19,4 +19,5 @@
911 echo " LHAPATH=$pydir/PDFsets" >> ../Cards/pythia_card.dat
912 export PDG_MASS_TBL=$pydir/mass_width_2004.mc
913
914-$pydir/pythia && touch pythia.done
915\ No newline at end of file
916+$pydir/pythia && touch pythia.done
917+
918
919=== modified file 'Template/bin/madevent'
920--- Template/bin/madevent 2012-02-08 05:31:40 +0000
921+++ Template/bin/madevent 2012-05-16 15:22:19 +0000
922@@ -33,18 +33,44 @@
923 sys.path.insert(0, root_path)
924
925
926+
927+class MyOptParser(optparse.OptionParser):
928+
929+ class InvalidOption(Exception): pass
930+
931+ def error(self, msg=''):
932+ raise MyOptParser.InvalidOption(msg)
933+
934+
935+
936+
937 # Write out nice usage message if called with -h or --help
938 usage = "usage: %prog [options] [FILE] "
939-parser = optparse.OptionParser(usage=usage)
940+parser = MyOptParser(usage=usage)
941 parser.add_option("-l", "--logging", default='INFO',
942 help="logging level (DEBUG|INFO|WARNING|ERROR|CRITICAL) [%default]")
943-parser.add_option("-f", "--file", default='',
944- help="Use script file FILE")
945 parser.add_option("","--web", action="store_true", default=False, dest='web', \
946 help='force to be in secure mode')
947 parser.add_option("","--debug", action="store_true", default=False, dest='debug', \
948 help='force to launch debug mode')
949-(options, args) = parser.parse_args()
950+parser_error = ''
951+done = False
952+for i in range(len(sys.argv)-1):
953+ try:
954+ (options, args) = parser.parse_args(sys.argv[1:len(sys.argv)-i])
955+ done = True
956+ except MyOptParser.InvalidOption, error:
957+ pass
958+ else:
959+ args += sys.argv[len(sys.argv)-i:]
960+if not done:
961+ # raise correct error:
962+ try:
963+ (options, args) = parser.parse_args()
964+ except MyOptParser.InvalidOption, error:
965+ print error
966+ sys.exit(2)
967+
968 if len(args) == 0:
969 args = ''
970
971@@ -115,23 +141,33 @@
972
973 # Call the cmd interface main loop
974 try:
975- if options.file or args:
976+ if (args and os.path.exists(args[0])):
977 # They are an input file
978- if args:
979- input_file = args[0]
980- else:
981- input_file = options.file
982+ input_file = args[0]
983 if options.web:
984 cmd_line = cmd_interface.MadEventCmd()
985 cmd_line.debug_output = os.path.join(os.path.dirname(input_file),'generation.log')
986 cmd_line.use_rawinput = False
987 cmd_line.run_cmd('import command ' + input_file)
988- sys.exit()
989+ cmd_line.run_cmd('quit')
990 else:
991 cmd_line = cmd_interface.MadEventCmdShell()
992 cmd_line.use_rawinput = False
993 cmd_line.run_cmd('import command ' + input_file)
994- sys.exit()
995+ cmd_line.run_cmd('quit')
996+ elif args:
997+ # a single command is provided
998+ cmd_line = cmd_interface.MadEventCmd()
999+ if not hasattr(cmd_line, 'do_%s' % args[0]):
1000+ if parser_error:
1001+ print parser_error
1002+ print 'and %s can not be interpreted as a valid command.' % args[0]
1003+ else:
1004+ print 'ERROR: %s not a valid command. Please retry' % args[0]
1005+ else:
1006+ cmd_line.use_rawinput = False
1007+ cmd_line.run_cmd(' '.join(args))
1008+ cmd_line.run_cmd('quit')
1009 else:
1010 # Interactive mode
1011 if options.web:
1012
1013=== modified file 'UpdateNotes.txt'
1014--- UpdateNotes.txt 2012-03-08 17:26:21 +0000
1015+++ UpdateNotes.txt 2012-05-16 15:22:19 +0000
1016@@ -1,5 +1,63 @@
1017 Update notes for MadGraph 5 (in reverse time order)
1018
1019+1.4.6 (XX/04/12) JA: Added cuts on lepton pt for each of the 4 hardest leptons
1020+ OM: allow bin/madevent script to be feeded by a single line command:
1021+ example ./bin/madevent multi_run 10
1022+ OM: Adding the 4 higgs interactions in the standard model UFO model
1023+ JA: Added new restriction card for the sm model with massive
1024+ muon and electron, and non-zero tau decay width
1025+ JA: Ensure assignment of colors to intermediate propagators
1026+ works also in fermion flow- and color flow-violating
1027+ RPV processes (thanks Brock Tweedie for finding this).
1028+ JA: Fix crash for certain fermion flow violating decay chains
1029+ (introduced in v. 1.3.27) (again thanks to Brock Tweedie).
1030+ JA: Fix crash for decay chains with multiple decays involving
1031+ the same particles (thanks Steve Blanchet for reporting)
1032+ JA+OM: Fix crash for Pythia8 output with multiparticle vertices
1033+ (thanks to Moritz Huck for reporting this.)
1034+ OM: Fixing ALOHA output for C++/python.
1035+ OM: Fix a crash occuring when trying to create an output on
1036+ an existing directory (thanks Celine)
1037+
1038+1.4.5 (11/04/12) OM: Change the seed automatically in multi_run. (Even if the seed
1039+ was set to a non automatic value in the card.)
1040+ OM: correct a minor bug #975647 (SLAH convention problem)
1041+ Thanks to Sho Iwamoto
1042+ OM: Improve cluster support (more secure and complete version)
1043+ JA: Increased the number of events tested for non-zero helicity
1044+ configurations (needed for goldstino processes).
1045+ OM: Add a command to remove the file RunWeb which were not always
1046+ deleted correctly
1047+ OM+JA: Correct the display of number of events and error for Pythia
1048+ in the html files.
1049+ OM: Changed the way the stdout/stderr are treated on the cluster
1050+ since some cluster cann't support to have the same output file
1051+ for both. (thanks abhishek)
1052+
1053+1.4.4 (29/03/12) OM: Added a command: "output aloha" which allows to creates a
1054+ subset (or all) of the aloha routines linked to the
1055+ current model
1056+ OM: allow to choose the duration of the timer for the questions.
1057+ (via ./input/mg5_configuration.txt)
1058+ OM: Allow UFO model where G is not defined.
1059+ OM: allow to use ~,~user, ${var} in the path. Improve support
1060+ for path containing spaces.
1061+ JA: Fixed LHAPDF functionality which was broken in v. 1.4.0
1062+ JA: Allow non-equal mixing angles in mssm restrict cards
1063+ (as needed for cards from some spectrum generators)
1064+ JA: Fixed script addmasses.py for complicated events such as
1065+ p p > t t~ + jets with decays of t and t~.
1066+ JA: Added GE cluster to the list in cluster.py.
1067+ JA: Allow up to 1M events in a single run. Note that the
1068+ unweighting (combine events) step gets quite slow with
1069+ so many events. Also note that if Pythia is run, still
1070+ maximum 50k events is recommended in a single run.
1071+ OM: Fix problem linked to filesystem which makes new files
1072+ non executables by default. (bug #958616)
1073+ JA: Fixed buffer overflow in gen_ximprove when number of
1074+ configs > number of diagrams due to competing resonances
1075+ (introduced in v. 1.4.3).
1076+
1077 1.4.3 (08/03/12) JA: Reintroduced the possibility to completely forbid
1078 s-channel diagrams, using the $$ notation. Note that
1079 this should be used with great care, since the result
1080
1081=== modified file 'aloha/aloha_fct.py'
1082--- aloha/aloha_fct.py 2012-02-06 19:57:04 +0000
1083+++ aloha/aloha_fct.py 2012-05-16 15:22:19 +0000
1084@@ -73,4 +73,41 @@
1085 raise WrongFermionFlow, 'Not coherent Incoming/outcoming fermion flow'
1086 elif pos == i+1:
1087 break
1088-
1089+
1090+def guess_routine_from_name(names):
1091+ """ return (UFO name, tag , offshell) from a given name """
1092+
1093+ output =[]
1094+ for name in names:
1095+ data = name.split('_')
1096+ if len(data) == 2:
1097+ main, offshell = data
1098+ multiple = []
1099+ else:
1100+ main, multiple, offshell = data[0], data[1:-1],data[-1]
1101+
1102+ # search for tag allow tag [L, C$]
1103+ allow_tag = ['C1','C2','C3','C4','C5','C6','C7']
1104+ tags = []
1105+ len_tag = -1
1106+ while len(tags) != len_tag:
1107+ len_tag = len(tags)
1108+ for tag in allow_tag:
1109+ if main.endswith(tag):
1110+ main = main[:-len(tag)]
1111+ tags.append(int(tag[1:]))
1112+ break
1113+
1114+ # create the correct lorentz
1115+ lorentz = [main]
1116+ if multiple:
1117+ base = main
1118+ while base[-1].isdigit():
1119+ base = base[:-1]
1120+ for nb in multiple:
1121+ lorentz.append('%s%s' % (base, nb))
1122+
1123+ # add in the results
1124+ output.append((tuple(lorentz), tuple(tags), int(offshell)))
1125+ return output
1126+
1127
1128=== modified file 'aloha/aloha_writers.py'
1129--- aloha/aloha_writers.py 2012-03-07 17:49:58 +0000
1130+++ aloha/aloha_writers.py 2012-05-16 15:22:19 +0000
1131@@ -1013,11 +1013,11 @@
1132 else:
1133 main = '%(spin)s%(id)d' % \
1134 {'spin': self.particles[self.offshell -1],
1135- 'id': self.offshell}
1136+ 'id': self.outgoing}
1137 call_arg = '%(args)s, %(COUP)s, M%(id)d, W%(id)d, %(LAST)s' % \
1138 {'args': ', '.join(self.calllist['CallList']),
1139 'COUP':'COUP%d',
1140- 'id': self.offshell,
1141+ 'id': self.outgoing,
1142 'LAST': '%s'}
1143
1144 # make the first call
1145@@ -1087,7 +1087,7 @@
1146
1147 def write_combined(self, lor_names, mode='self', offshell=None, **opt):
1148 """Write the .h and .cc files associated to the combined file"""
1149-
1150+
1151 # Set some usefull command
1152 if offshell is None:
1153 offshell = self.offshell
1154
1155=== modified file 'aloha/create_aloha.py'
1156--- aloha/create_aloha.py 2012-03-01 21:47:03 +0000
1157+++ aloha/create_aloha.py 2012-05-16 15:22:19 +0000
1158@@ -236,7 +236,7 @@
1159 lorentz *= SpinorPropagator(id, 'I2', outgoing)
1160 else:
1161 #propagator incoming
1162- lorentz *= SpinorPropagator('I2', id, outgoing)
1163+ lorentz *= SpinorPropagator('I2', id, outgoing)
1164 elif spin == 3 :
1165 lorentz *= VectorPropagator(id, 'I2', id)
1166 elif spin == 5 :
1167@@ -499,8 +499,11 @@
1168 if lorentz.name in self.multiple_lor:
1169 for m in self.multiple_lor[lorentz.name]:
1170 for outgoing in range(len(lorentz.spins)+1):
1171- self[(conjg_builder.name, outgoing)].add_combine(m)
1172-
1173+ realname = conjg_builder.name + ''.join(['C%s' % pair for pair in conjg_builder.conjg])
1174+ try:
1175+ self[(realname, outgoing)].add_combine(m)
1176+ except Exception,error:
1177+ self[(realname, self.symmetries[lorentz.name][outgoing])].add_combine(m)
1178
1179
1180 if save:
1181@@ -585,6 +588,7 @@
1182 #Store the information
1183 realname = name + ''.join(wavefunction.tag)
1184 self.set(realname, outgoing, wavefunction)
1185+
1186
1187 def compute_aloha_without_kernel(self, builder, symmetry=None, routines=None):
1188 """define all the AbstractRoutine linked to a given lorentz structure
1189
1190=== modified file 'input/mg5_configuration.txt'
1191--- input/mg5_configuration.txt 2012-02-03 23:38:43 +0000
1192+++ input/mg5_configuration.txt 2012-05-16 15:22:19 +0000
1193@@ -20,10 +20,9 @@
1194 #
1195 ################################################################################
1196
1197-# Pythia8 Path.
1198-# Define the path to the pythia8 directory.
1199-# relative path start from mg5 directory
1200-pythia8_path = ./pythia8
1201+# Prefered Fortran Compiler
1202+# If None: try to find g77 or gfortran on the system
1203+fortran_compiler = None
1204
1205 # Prefered Text Editor
1206 # Default: use the shell default Editor
1207@@ -39,10 +38,14 @@
1208 # If None: try to find one available on the system
1209 eps_viewer = None
1210
1211-# Prefered Fortran Compiler
1212-# If None: try to find g77 or gfortran on the system
1213-fortran_compiler = None
1214+# Time allowed to answer question (if no answer takes default value)
1215+# 0: No time limit
1216+timeout = 20
1217
1218+# Pythia8 Path.
1219+# Define the path to the pythia8 directory.
1220+# relative path start from mg5 directory
1221+pythia8_path = ./pythia8
1222
1223 ################################################################################
1224 # INFO FOR MADEVENT
1225@@ -59,7 +62,7 @@
1226 # 0: single machine/ 1: cluster / 2: multicore
1227 run_mode = 0
1228
1229-# Cluster Type [pbs|sge|condor] Use for cluster run only
1230+# Cluster Type [pbs|sge|condor|lsf|ge] Use for cluster run only
1231 # And cluster queue
1232 cluster_type = condor
1233 cluster_queue = madgraph
1234
1235=== modified file 'madgraph/VERSION'
1236--- madgraph/VERSION 2012-03-08 17:26:21 +0000
1237+++ madgraph/VERSION 2012-05-16 15:22:19 +0000
1238@@ -1,3 +1,3 @@
1239-version = 1.4.3
1240-date = 2012-03-08
1241+version = 1.4.6
1242+date = 2012-05-16
1243
1244
1245=== modified file 'madgraph/core/base_objects.py'
1246--- madgraph/core/base_objects.py 2012-02-24 06:55:34 +0000
1247+++ madgraph/core/base_objects.py 2012-05-16 15:22:19 +0000
1248@@ -1473,7 +1473,20 @@
1249 this diagram"""
1250
1251 return [len(v.get('legs')) for v in self.get('vertices')]
1252+
1253+ def get_num_configs(self, model, ninitial):
1254+ """Return the maximum number of configs from this diagram,
1255+ given by 2^(number of non-zero width s-channel propagators)"""
1256+
1257+ s_channels = [v.get_s_channel_id(model,ninitial) for v in \
1258+ self.get('vertices')[:-1]]
1259+ num_props = len([i for i in s_channels if i != 0 and \
1260+ model.get_particle(i).get('width').lower() != 'zero'])
1261
1262+ if num_props <= 1:
1263+ return 1
1264+ else:
1265+ return 2**num_props
1266 #===============================================================================
1267 # DiagramList
1268 #===============================================================================
1269@@ -1976,7 +1989,11 @@
1270 tmp = [(k,v) for (k,v) in expansion_orders.items() if 0 < v < 99]
1271 for (k,v) in tmp:
1272 if k in orders:
1273- orders[k] = min(orders[k], v)
1274+ if v < orders[k]:
1275+ logger.warning('''The coupling order (%s=%s) specified is larger than the one allowed
1276+ by the model builder. The maximal value allowed is %s.
1277+ We set the %s order to this value''' % (k,orders[k],v,k))
1278+ orders[k] = v
1279 else:
1280 orders[k] = v
1281
1282
1283=== modified file 'madgraph/core/helas_objects.py'
1284--- madgraph/core/helas_objects.py 2011-11-22 09:18:50 +0000
1285+++ madgraph/core/helas_objects.py 2012-05-16 15:22:19 +0000
1286@@ -2955,6 +2955,7 @@
1287 for i, wf in enumerate(final_decay_wfs):
1288 final_decay_wfs[i] = \
1289 decay_diag_wfs[decay_diag_wfs.index(wf)]
1290+
1291 # Remove final wavefunctions from decay_diag_wfs,
1292 # since these will be replaced separately by
1293 # replace_wavefunctions
1294@@ -3075,7 +3076,6 @@
1295 final_decay_wfs,
1296 diagrams,
1297 numbers)
1298-
1299 # Now that we are done with this set of diagrams, we need
1300 # to clean out duplicate wavefunctions (i.e., remove
1301 # identical wavefunctions which are already present in
1302@@ -3261,7 +3261,7 @@
1303 is possible only if there is only one diagram in the decay."""
1304
1305 for key in old_wf.keys():
1306- old_wf.set(key, new_wf.get(key))
1307+ old_wf.set(key, new_wf[key])
1308
1309 def identical_decay_chain_factor(self, decay_chains):
1310 """Calculate the denominator factor from identical decay chains"""
1311@@ -3387,7 +3387,13 @@
1312 """Get number of diagrams, which is always more than number of
1313 configs"""
1314
1315- return len(self.get('diagrams'))
1316+ model = self.get('processes')[0].\
1317+ get('model')
1318+
1319+ next, nini = self.get_nexternal_ninitial()
1320+
1321+ return sum([d.get_num_configs(model, nini) for d in \
1322+ self.get('base_amplitude').get('diagrams')])
1323
1324 def get_number_of_wavefunctions(self):
1325 """Gives the total number of wavefunctions for this ME"""
1326@@ -3546,7 +3552,7 @@
1327 """Return a list of (lorentz_name, conjugate, outgoing) with
1328 all lorentz structures used by this HelasMatrixElement."""
1329
1330- return [(tuple(wa.get('lorentz')), tuple(wa.get_conjugate_index()),
1331+ return [(tuple(wa.get('lorentz')), tuple(wa.get('conjugate_indices')),
1332 wa.find_outgoing_number()) for wa in \
1333 self.get_all_wavefunctions() + self.get_all_amplitudes() \
1334 if wa.get('interaction_id') != 0]
1335
1336=== modified file 'madgraph/interface/extended_cmd.py'
1337--- madgraph/interface/extended_cmd.py 2012-03-08 20:38:22 +0000
1338+++ madgraph/interface/extended_cmd.py 2012-05-16 15:22:19 +0000
1339@@ -38,7 +38,9 @@
1340 import madgraph.various.misc as misc
1341 from madgraph import MG5DIR
1342 MADEVENT = False
1343-except:
1344+except Exception, error:
1345+ if __debug__:
1346+ print error
1347 import internal.misc as misc
1348 MADEVENT = True
1349
1350@@ -47,6 +49,24 @@
1351 class TimeOutError(Exception):
1352 """Class for run-time error"""
1353
1354+def debug(debug_only=True):
1355+
1356+ def deco_debug(f):
1357+
1358+ if debug_only and not __debug__:
1359+ return f
1360+
1361+ def deco_f(*args, **opt):
1362+ try:
1363+ return f(*args, **opt)
1364+ except Exception, error:
1365+ print error
1366+ print traceback.print_exc(file=sys.stdout)
1367+ return
1368+ return deco_f
1369+ return deco_debug
1370+
1371+
1372 #===============================================================================
1373 # CmdExtended
1374 #===============================================================================
1375@@ -90,7 +110,8 @@
1376 if valid == 1:
1377 out = out[1:]
1378 return out
1379-
1380+
1381+ @debug()
1382 def print_suggestions(self, substitution, matches, longest_match_length) :
1383 """print auto-completions by category"""
1384 longest_match_length += len(self.completion_prefix)
1385@@ -162,6 +183,7 @@
1386 If a command has not been entered, then complete against command list.
1387 Otherwise try to call complete_<command> to get list of completions.
1388 """
1389+
1390 if state == 0:
1391 import readline
1392 origline = readline.get_line_buffer()
1393@@ -188,8 +210,18 @@
1394 compfunc = self.completedefault
1395 else:
1396 compfunc = self.completenames
1397+
1398+ # correct wrong splittion with '\ '
1399+ if line and begidx > 2 and line[begidx-2:begidx] == '\ ':
1400+ Ntext = line.split(os.path.sep)[-1]
1401+ self.completion_prefix = Ntext.rsplit('\ ', 1)[0] + '\ '
1402+ to_rm = len(self.completion_prefix) - 1
1403+ Nbegidx = len(line.rsplit(os.path.sep, 1)[0]) + 1
1404+ data = compfunc(Ntext.replace('\ ', ' '), line, Nbegidx, endidx)
1405+ self.completion_matches = [p[to_rm:] for p in data
1406+ if len(p)>to_rm]
1407 # correct wrong splitting with '-'
1408- if line and line[begidx-1] == '-':
1409+ elif line and line[begidx-1] == '-':
1410 try:
1411 Ntext = line.split()[-1]
1412 self.completion_prefix = Ntext.rsplit('-',1)[0] +'-'
1413@@ -244,12 +276,12 @@
1414
1415 if len(args) > 2:
1416 self.help_save()
1417- raise self.InvalidCmd, '\'%s\' is not recoginzed as first argument.'
1418+ raise self.InvalidCmd, 'too many arguments for save command.'
1419
1420 if len(args) == 2:
1421 if args[0] != 'options':
1422 self.help_save()
1423- raise self.InvalidCmd, '\'%s\' is not recoginzed as first argument.' % \
1424+ raise self.InvalidCmd, '\'%s\' is not recognized as first argument.' % \
1425 args[0]
1426 else:
1427 args.pop(0)
1428@@ -336,7 +368,6 @@
1429 next_possibility = {} # command : [list of suggested command]
1430 history_header = ""
1431
1432- timeout = 1 # time authorize to answer question [0 is no time limit]
1433 _display_opts = ['options','variable']
1434
1435 class InvalidCmd(Exception):
1436@@ -428,7 +459,7 @@
1437 if os.path.exists(self.debug_output):
1438 os.remove(self.debug_output)
1439 try:
1440- cmd.Cmd.onecmd(self, 'history %s' % self.debug_output)
1441+ cmd.Cmd.onecmd(self, 'history %s' % self.debug_output.replace(' ', '\ '))
1442 except Exception, error:
1443 print error
1444
1445@@ -587,7 +618,9 @@
1446 if data[-1] == '\\':
1447 tmp += data[:-1]+' '
1448 elif tmp:
1449- out.append(tmp+data)
1450+ tmp += data
1451+ tmp = os.path.expanduser(os.path.expandvars(tmp))
1452+ out.append(tmp)
1453 else:
1454 out.append(data)
1455 return out
1456@@ -674,7 +707,6 @@
1457 # remove this call from history
1458 if self.history:
1459 self.history.pop()
1460- self.timeout, old_time_out = 20, self.timeout
1461
1462 # Read the lines of the file and execute them
1463 self.inputfile = open(filepath)
1464@@ -691,7 +723,6 @@
1465 if self.child:
1466 self.child.exec_cmd('quit')
1467
1468- self.timeout = old_time_out
1469 return
1470
1471 def get_history_header(self):
1472@@ -771,7 +802,7 @@
1473 # Ask a question with nice options handling
1474 #===============================================================================
1475 def ask(self, question, default, choices=[], path_msg=None,
1476- timeout = None, fct_timeout=None):
1477+ timeout = True, fct_timeout=None):
1478 """ ask a question with some pre-define possibility
1479 path info is
1480 """
1481@@ -780,6 +811,12 @@
1482 path_msg = [path_msg]
1483 else:
1484 path_msg = []
1485+
1486+ if timeout:
1487+ try:
1488+ timeout = self.options['timeout']
1489+ except:
1490+ pass
1491
1492 # add choice info to the question
1493 if choices + path_msg:
1494@@ -796,16 +833,18 @@
1495 question = question[:-2]+']'
1496
1497 if path_msg:
1498- fct = lambda q: raw_path_input(q, allow_arg=choices, default=default)
1499+ f = lambda q: raw_path_input(q, allow_arg=choices, default=default)
1500 else:
1501- fct = lambda q: smart_input(q, allow_arg=choices, default=default)
1502+ f = lambda q: smart_input(q, allow_arg=choices, default=default)
1503
1504 answer = self.check_answer_in_input_file(choices, path_msg)
1505 if answer is not None:
1506 return answer
1507
1508- return Cmd.timed_input(question, default, timeout=timeout,
1509- fct=fct, fct_timeout=fct_timeout)
1510+ value = Cmd.timed_input(question, default, timeout=timeout,
1511+ fct=f, fct_timeout=fct_timeout)
1512+
1513+ return value
1514
1515 def check_answer_in_input_file(self, options, path=False):
1516 """Questions can have answer in output file (or not)"""
1517@@ -1093,10 +1132,12 @@
1518 def path_completion(text, base_dir = None, only_dirs = False,
1519 relative=True):
1520 """Propose completions of text to compose a valid path"""
1521-
1522+
1523 if base_dir is None:
1524 base_dir = os.getcwd()
1525-
1526+
1527+ base_dir = os.path.expanduser(os.path.expandvars(base_dir))
1528+
1529 prefix, text = os.path.split(text)
1530 base_dir = os.path.join(base_dir, prefix)
1531 if prefix:
1532@@ -1128,7 +1169,8 @@
1533 if relative:
1534 completion += [prefix + f for f in ['.'+os.path.sep, '..'+os.path.sep] if \
1535 f.startswith(text) and not prefix.startswith('.')]
1536-
1537+
1538+ completion = [a.replace(' ','\ ') for a in completion]
1539 return completion
1540
1541
1542@@ -1252,7 +1294,7 @@
1543 #===============================================================================
1544 class OneLinePathCompletion(SmartQuestion):
1545 """ a class for answering a question with the path autocompletion"""
1546-
1547+
1548
1549 def completenames(self, text, line, begidx, endidx):
1550 prev_timer = signal.alarm(0) # avoid timer if any
1551
1552=== modified file 'madgraph/interface/launch_ext_program.py'
1553--- madgraph/interface/launch_ext_program.py 2012-02-17 06:01:41 +0000
1554+++ madgraph/interface/launch_ext_program.py 2012-05-16 15:22:19 +0000
1555@@ -43,13 +43,12 @@
1556
1557 force = False
1558
1559- def __init__(self, cmd, running_dir, card_dir='', timeout=None,
1560+ def __init__(self, cmd, running_dir, card_dir='',
1561 **options):
1562 """ initialize an object """
1563
1564 self.running_dir = running_dir
1565 self.card_dir = os.path.join(self.running_dir, card_dir)
1566- self.timeout = timeout
1567 self.cmd_int = cmd
1568 #include/overwrite options
1569 for key,value in options.items():
1570@@ -87,15 +86,13 @@
1571 if timeout:
1572 # avoid to always wait a given time for the next answer
1573 self.force = True
1574- else:
1575- self.timeout = None # answer at least one question so wait...
1576
1577 def ask(self, question, default, choices=[], path_msg=None):
1578 """nice handling of question"""
1579
1580 if not self.force:
1581- return self.cmd_int.ask(question, default, choices=choices, path_msg=path_msg,
1582- timeout=self.timeout, fct_timeout=self.timeout_fct)
1583+ return self.cmd_int.ask(question, default, choices=choices,
1584+ path_msg=path_msg, fct_timeout=self.timeout_fct)
1585 else:
1586 return str(default)
1587
1588@@ -135,10 +132,10 @@
1589 class SALauncher(ExtLauncher):
1590 """ A class to launch a simple Standalone test """
1591
1592- def __init__(self, cmd_int, running_dir, timeout, **options):
1593+ def __init__(self, cmd_int, running_dir, **options):
1594 """ initialize the StandAlone Version"""
1595
1596- ExtLauncher.__init__(self, cmd_int, running_dir, './Cards', timeout, **options)
1597+ ExtLauncher.__init__(self, cmd_int, running_dir, './Cards', **options)
1598 self.cards = ['param_card.dat']
1599
1600
1601@@ -158,11 +155,13 @@
1602 class MELauncher(ExtLauncher):
1603 """A class to launch MadEvent run"""
1604
1605- def __init__(self, running_dir, timeout, cmd_int , unit='pb', **option):
1606+ def __init__(self, running_dir, cmd_int , unit='pb', **option):
1607 """ initialize the StandAlone Version"""
1608
1609- ExtLauncher.__init__(self, cmd_int, running_dir, './Cards', timeout, **option)
1610+ ExtLauncher.__init__(self, cmd_int, running_dir, './Cards', **option)
1611 #self.executable = os.path.join('.', 'bin','generate_events')
1612+ self.pythia = cmd_int.options['pythia-pgs_path']
1613+ self.delphes = cmd_int.options['delphes_path'],
1614
1615 assert hasattr(self, 'cluster')
1616 assert hasattr(self, 'multicore')
1617@@ -267,11 +266,11 @@
1618 class Pythia8Launcher(ExtLauncher):
1619 """A class to launch Pythia8 run"""
1620
1621- def __init__(self, running_dir, timeout, cmd_int, **option):
1622+ def __init__(self, running_dir, cmd_int, **option):
1623 """ initialize launching Pythia 8"""
1624
1625 running_dir = os.path.join(running_dir, 'examples')
1626- ExtLauncher.__init__(self, cmd_int, running_dir, '.', timeout, **option)
1627+ ExtLauncher.__init__(self, cmd_int, running_dir, '.', **option)
1628 self.cards = []
1629
1630 def prepare_run(self):
1631
1632=== modified file 'madgraph/interface/madevent_interface.py'
1633--- madgraph/interface/madevent_interface.py 2012-03-05 14:54:21 +0000
1634+++ madgraph/interface/madevent_interface.py 2012-05-16 15:22:19 +0000
1635@@ -24,6 +24,7 @@
1636 import optparse
1637 import os
1638 import pydoc
1639+import random
1640 import re
1641 import shutil
1642 import subprocess
1643@@ -108,10 +109,12 @@
1644 InvalidCmd = InvalidCmd
1645 ConfigurationError = MadGraph5Error
1646
1647-
1648 def __init__(self, *arg, **opt):
1649 """Init history and line continuation"""
1650
1651+ # Tag allowing/forbiding question
1652+ self.force = False
1653+
1654 # If possible, build an info line with current version number
1655 # and date, from the VERSION text file
1656 info = misc.get_pkg_info()
1657@@ -196,7 +199,10 @@
1658
1659 def postcmd(self, stop, line):
1660 """ Update the status of the run for finishing interactive command """
1661-
1662+
1663+ # relaxing the tag forbidding question
1664+ self.force = False
1665+
1666 if not self.use_rawinput:
1667 return stop
1668
1669@@ -206,9 +212,9 @@
1670 arg = line.split()
1671 if len(arg) == 0:
1672 return stop
1673- if self.results.status.startswith('Error'):
1674+ if isinstance(self.results.status, str) and self.results.status.startswith('Error'):
1675 return stop
1676- if self.results.status == 'Stop by the user':
1677+ if isinstance(self.results.status, str) and self.results.status == 'Stop by the user':
1678 self.update_status('%s Stop by the user' % arg[0], level=None, error=True)
1679 return stop
1680 elif not self.results.status:
1681@@ -247,7 +253,7 @@
1682 """If a ME run is currently running add a link in the html output"""
1683
1684 self.add_error_log_in_html()
1685- cmd.Cmd.nice_user_error(self, error, line)
1686+ cmd.Cmd.nice_user_error(self, error, line)
1687
1688 def nice_config_error(self, error, line):
1689 """If a ME run is currently running add a link in the html output"""
1690@@ -291,7 +297,9 @@
1691 logger.info("-- set options")
1692 logger.info(" stdout_level DEBUG|INFO|WARNING|ERROR|CRITICAL")
1693 logger.info(" change the default level for printed information")
1694-
1695+ logger.info(" timeout VALUE")
1696+ logger.info(" (default 20) Seconds allowed to answer questions.")
1697+ logger.info(" Note that pressing tab always stops the timer.")
1698
1699 def run_options_help(self, data):
1700 if data:
1701@@ -349,9 +357,9 @@
1702
1703 def help_combine_events(self):
1704 """ """
1705- logger.info("syntax: combine_events [--run_options]")
1706+ logger.info("syntax: combine_events [run_name] [--tag=tag_name] [--run_options]")
1707 logger.info("-- Combine the last run in order to write the number of events")
1708- logger.info(" require in the run_card.")
1709+ logger.info(" asked in the run_card.")
1710 self.run_options_help([])
1711
1712 def help_store_events(self):
1713@@ -504,6 +512,11 @@
1714 if args[1] not in ['DEBUG','INFO','WARNING','ERROR','CRITICAL']:
1715 raise self.InvalidCmd('output_level needs ' + \
1716 'a valid level')
1717+
1718+ if args[0] in ['timeout']:
1719+ if not args[1].isdigit():
1720+ raise self.InvalidCmd('timeout values should be a integer')
1721+
1722 def check_open(self, args):
1723 """ check the validity of the line """
1724
1725@@ -520,7 +533,7 @@
1726 if not self.me_dir:
1727 if not os.path.isfile(args[0]):
1728 self.help_open()
1729- raise self.InvalidCmd('No MadEvent path defined. Impossible to associate this name to a file')
1730+ raise self.InvalidCmd('No MadEvent path defined. Unable to associate this name to a file')
1731 else:
1732 return True
1733
1734@@ -578,11 +591,7 @@
1735 def check_generate_events(self, args):
1736 """check that the argument for generate_events are valid"""
1737
1738- force = False
1739 run = None
1740- if '-f' in args:
1741- force = True
1742- args.remove('-f')
1743 if args and args[-1].startswith('--laststep='):
1744 run = args[-1].split('=')[-1]
1745 if run not in ['auto','parton', 'pythia', 'pgs', 'delphes']:
1746@@ -600,19 +609,16 @@
1747 self.help_generate_events()
1748 raise self.InvalidCmd('Too many argument for generate_events command: %s' % cmd)
1749
1750- return force, run
1751+ return run
1752
1753 def check_calculate_decay_widths(self, args):
1754 """check that the argument for calculate_decay_widths are valid"""
1755
1756 if self.ninitial != 1:
1757 raise self.InvalidCmd('Can only calculate decay widths for decay processes A > B C ...')
1758- force = False
1759+
1760 accuracy = 0.01
1761 run = None
1762- if '-f' in args:
1763- force = True
1764- args.remove('-f')
1765 if args and args[-1].startswith('--accuracy='):
1766 try:
1767 accuracy = float(args[-1].split('=')[-1])
1768@@ -623,18 +629,14 @@
1769 self.help_calculate_decay_widths()
1770 raise self.InvalidCmd('Too many argument for calculate_decay_widths command: %s' % cmd)
1771
1772- return force, accuracy
1773+ return accuracy
1774
1775
1776
1777 def check_multi_run(self, args):
1778 """check that the argument for survey are valid"""
1779
1780- force = False
1781 run = None
1782- if '-f' in args:
1783- force = True
1784- args.remove('-f')
1785
1786 if not len(args):
1787 self.help_multi_run()
1788@@ -662,7 +664,7 @@
1789 self.check_survey(args, cmd='multi_run')
1790 args.insert(0, int(nb_run))
1791
1792- return force, run
1793+ return run
1794
1795 def check_refine(self, args):
1796 """check that the argument for survey are valid"""
1797@@ -682,7 +684,7 @@
1798 if self.results.lastrun:
1799 self.set_run_name(self.results.lastrun)
1800 else:
1801- raise self.InvalidCmd('No run_name currently define. Impossible to run refine')
1802+ raise self.InvalidCmd('No run_name currently define. Unable to run refine')
1803
1804 if len(args) > 2:
1805 self.help_refine()
1806@@ -699,16 +701,28 @@
1807 def check_combine_events(self, arg):
1808 """ Check the argument for the combine events command """
1809
1810- if len(arg):
1811+ tag = [a for a in arg if a.startswith('--tag=')]
1812+ if tag:
1813+ args.remove(tag[0])
1814+ tag = tag[0][6:]
1815+ elif not self.run_tag:
1816+ tag = 'tag_1'
1817+ else:
1818+ tag = self.run_tag
1819+ self.run_tag = tag
1820+
1821+ if len(arg) > 1:
1822 self.help_combine_events()
1823 raise self.InvalidCmd('Too many argument for combine_events command')
1824
1825+ if len(arg) == 1:
1826+ self.set_run_name(arg[0], self.run_tag, 'parton', True)
1827+
1828 if not self.run_name:
1829 if not self.results.lastrun:
1830- raise self.InvalidCmd('No run_name currently define. Impossible to run combine')
1831+ raise self.InvalidCmd('No run_name currently define. Unable to run combine')
1832 else:
1833 self.set_run_name(self.results.lastrun)
1834- self.set_run_name(arg[0])
1835
1836 return True
1837
1838@@ -728,18 +742,32 @@
1839 elif laststep:
1840 raise self.InvalidCmd('only one laststep argument is allowed')
1841
1842+ # If not pythia-pgs path
1843+ if not self.options['pythia-pgs_path']:
1844+ logger.info('Retry to read configuration file to find pythia-pgs path')
1845+ self.set_configuration()
1846+
1847+ if not self.options['pythia-pgs_path'] or not \
1848+ os.path.exists(pjoin(self.options['pythia-pgs_path'],'src')):
1849+ error_msg = 'No pythia-pgs path correctly set.'
1850+ error_msg += 'Please use the set command to define the path and retry.'
1851+ error_msg += 'You can also define it in the configuration file.'
1852+ raise self.InvalidCmd(error_msg)
1853+
1854+
1855+
1856 tag = [a for a in args if a.startswith('--tag=')]
1857 if tag:
1858 args.remove(tag[0])
1859 tag = tag[0][6:]
1860-
1861+
1862 if len(args) == 0 and not self.run_name:
1863 if self.results.lastrun:
1864 args.insert(0, self.results.lastrun)
1865 else:
1866 raise self.InvalidCmd('No run name currently define. Please add this information.')
1867
1868- if len(args) == 1:
1869+ if len(args) >= 1:
1870 if args[0] != self.run_name and\
1871 not os.path.exists(pjoin(self.me_dir,'Events',args[0], 'unweighted_events.lhe.gz')):
1872 raise self.InvalidCmd('No events file corresponding to %s run. '% args[0])
1873@@ -748,7 +776,6 @@
1874 if tag:
1875 self.run_card['run_tag'] = tag
1876 self.set_run_name(self.run_name, tag, 'pythia')
1877-
1878
1879 if not os.path.exists(pjoin(self.me_dir,'Events',self.run_name,'unweighted_events.lhe.gz')):
1880 raise self.InvalidCmd('No events file corresponding to %s run. '% self.run_name)
1881@@ -757,19 +784,6 @@
1882 input_file = pjoin(self.me_dir,'Events',self.run_name, 'unweighted_events.lhe')
1883 output_file = pjoin(self.me_dir, 'Events', 'unweighted_events.lhe')
1884 os.system('gunzip -c %s > %s' % (input_file, output_file))
1885-
1886-
1887- # If not pythia-pgs path
1888- if not self.options['pythia-pgs_path']:
1889- logger.info('Retry to read configuration file to find pythia-pgs path')
1890- self.set_configuration()
1891-
1892- if not self.options['pythia-pgs_path'] or not \
1893- os.path.exists(pjoin(self.options['pythia-pgs_path'],'src')):
1894- error_msg = 'No pythia-pgs path correctly set.'
1895- error_msg += 'Please use the set command to define the path and retry.'
1896- error_msg += 'You can also define it in the configuration file.'
1897- raise self.InvalidCmd(error_msg)
1898
1899 args.append(mode)
1900
1901@@ -783,14 +797,6 @@
1902 tag = tag[0]
1903 tmp_args.remove('--tag=%s' % tag)
1904
1905- try:
1906- tmp_args.remove('-f')
1907- except:
1908- pass
1909- else:
1910- if args[0] == '-f':
1911- args.pop(0)
1912- args.append('-f')
1913
1914 if len(tmp_args) == 0:
1915 self.help_remove()
1916@@ -799,7 +805,7 @@
1917 return tmp_args[0], tag, ['all']
1918 else:
1919 for arg in tmp_args[1:]:
1920- if arg not in self._clean_mode and arg != '-f':
1921+ if arg not in self._clean_mode:
1922 self.help_clean()
1923 raise self.InvalidCmd('%s is not a valid options for clean command'\
1924 % arg)
1925@@ -837,10 +843,6 @@
1926 args.append('all')
1927 return
1928
1929- force = False
1930- if '-f' in args:
1931- args.remove('-f')
1932- force = True
1933
1934 if args[0] not in self._plot_mode:
1935 self.set_run_name(args[0], level='plot')
1936@@ -856,9 +858,6 @@
1937 self.help_plot()
1938 raise self.InvalidCmd('unknown options %s' % arg)
1939
1940- if force:
1941- args.append('-f')
1942-
1943
1944 def check_pgs(self, arg):
1945 """Check the argument for pythia command
1946@@ -886,7 +885,7 @@
1947
1948 if len(arg) == 0 and not self.run_name:
1949 if self.results.lastrun:
1950- args.insert(0, self.results.lastrun)
1951+ arg.insert(0, self.results.lastrun)
1952 else:
1953 raise self.InvalidCmd('No run name currently define. Please add this information.')
1954
1955@@ -1270,7 +1269,7 @@
1956 _run_options = ['--cluster','--multicore','--nb_core=','--nb_core=2', '-c', '-m']
1957 _generate_options = ['-f', '--laststep=parton', '--laststep=pythia', '--laststep=pgs', '--laststep=delphes']
1958 _calculate_decay_options = ['-f', '--accuracy=0.']
1959- _set_options = ['stdout_level','fortran_compiler']
1960+ _set_options = ['stdout_level','fortran_compiler','timeout']
1961 _plot_mode = ['all', 'parton','pythia','pgs','delphes','channel', 'banner']
1962 _clean_mode = _plot_mode
1963 _display_opts = ['run_name', 'options', 'variable']
1964@@ -1326,13 +1325,13 @@
1965 # Check that the directory is not currently running
1966 if os.path.exists(pjoin(me_dir,'RunWeb')):
1967 message = '''Another instance of madevent is currently running.
1968- Please wait that all instance of madevent are closed. If this message
1969- is an error in itself, you can suppress the files:
1970- %s.''' % pjoin(me_dir,'RunWeb')
1971+ Please wait that all instance of madevent are closed. If no
1972+ instance is running, you can delete the file
1973+ %s and try again.''' % pjoin(me_dir,'RunWeb')
1974 raise MadEventAlreadyRunning, message
1975 else:
1976 os.system('touch %s' % pjoin(me_dir,'RunWeb'))
1977- subprocess.Popen([pjoin(self.dirbin, 'gen_cardhtml-pl')], cwd=me_dir)
1978+ misc.Popen([pjoin(self.dirbin, 'gen_cardhtml-pl')], cwd=me_dir)
1979
1980 self.to_store = []
1981 self.run_name = None
1982@@ -1351,7 +1350,6 @@
1983
1984 # Load the configuration file
1985 self.set_configuration()
1986- self.timeout = 20
1987 self.nb_refine=0
1988 if self.web:
1989 os.system('touch %s' % pjoin(self.me_dir,'Online'))
1990@@ -1360,13 +1358,12 @@
1991 # load the current status of the directory
1992 if os.path.exists(pjoin(self.me_dir,'HTML','results.pkl')):
1993 self.results = save_load_object.load_from_file(pjoin(self.me_dir,'HTML','results.pkl'))
1994- self.results.resetall()
1995+ self.results.resetall(self.me_dir)
1996 else:
1997 model = self.find_model_name()
1998 process = self.process # define in find_model_name
1999 self.results = gen_crossxhtml.AllResults(model, process, self.me_dir)
2000 self.results.def_web_mode(self.web)
2001-
2002
2003 self.configured = 0 # time for reading the card
2004 self._options = {} # for compatibility with extended_cmd
2005@@ -1385,7 +1382,7 @@
2006 elif arg == '-m':
2007 self.cluster_mode = 2
2008 elif arg == '-f':
2009- continue
2010+ self.force = True
2011 elif not arg.startswith('--'):
2012 if error:
2013 raise self.InvalidCmd('%s argument cannot start with - symbol' % arg)
2014@@ -1402,8 +1399,7 @@
2015 self.web = True
2016 self.cluster_mode = 1
2017 self.results.def_web_mode(True)
2018- if not '-f' in args:
2019- args.append('-f')
2020+ self.force = True
2021 else:
2022 continue
2023 args.remove(arg)
2024@@ -1446,7 +1442,8 @@
2025 'automatic_html_opening':True,
2026 'run_mode':0,
2027 'cluster_queue':'madgraph',
2028- 'nb_core':None}
2029+ 'nb_core':None,
2030+ 'timeout':20}
2031
2032 if os.environ.has_key('MADGRAPH_BASE'):
2033 config_file = open(os.path.join(os.environ['MADGRAPH_BASE'],'mg5_configuration.txt'))
2034@@ -1526,11 +1523,7 @@
2035
2036 args = self.split_arg(line)
2037 #check the validity of the arguments
2038- self.check_banner_run(args)
2039- if '-f' in args:
2040- force = True
2041- else:
2042- force = False
2043+ self.check_banner_run(args)
2044
2045 banner_mod.split_banner(args[0], self.me_dir, proc_card=False)
2046
2047@@ -1544,14 +1537,13 @@
2048
2049
2050 # Check if we want to modify the run
2051- if not force:
2052- ans = self.ask('Do you want to modify the Cards?', 'n', ['y','n'],
2053- timeout=self.timeout)
2054+ if not self.force:
2055+ ans = self.ask('Do you want to modify the Cards?', 'n', ['y','n'])
2056 if ans == 'n':
2057- force = True
2058+ self.force = True
2059
2060 # Call Generate events
2061- self.exec_cmd('generate_events %s %s' % (self.run_name, force and '-f' or ''))
2062+ self.exec_cmd('generate_events %s %s' % (self.run_name, self.force and '-f' or ''))
2063
2064
2065
2066@@ -1644,6 +1636,8 @@
2067 raise self.InvalidCmd('nb_core should be a positive number')
2068 self.nb_core = int(args[1])
2069 self.options['nb_core'] = self.nb_core
2070+ elif args[0] == 'timeout':
2071+ self.options[args[0]] = int(args[1])
2072 elif args[0] in self.options:
2073 if args[1] in ['None','True','False']:
2074 self.options[args[0]] = eval(args[1])
2075@@ -1685,8 +1679,8 @@
2076
2077 args = self.split_arg(line)
2078 # Check argument's validity
2079- force, mode = self.check_generate_events(args)
2080- self.ask_run_configuration(mode, force)
2081+ mode = self.check_generate_events(args)
2082+ self.ask_run_configuration(mode)
2083 if not args:
2084 # No run name assigned -> assigned one automaticaly
2085 self.set_run_name(self.find_available_run_name(self.me_dir), None, 'parton')
2086@@ -1729,13 +1723,13 @@
2087 self.exec_cmd('refine %s' % nb_event, postcmd=False)
2088 self.exec_cmd('refine %s' % nb_event, postcmd=False)
2089 self.exec_cmd('combine_events', postcmd=False)
2090+ self.print_results_in_shell(self.results.current)
2091 self.create_plot('parton')
2092 self.exec_cmd('store_events', postcmd=False)
2093 self.exec_cmd('pythia --no_default', postcmd=False, printcmd=False)
2094 # pythia launches pgs/delphes if needed
2095 self.store_result()
2096-
2097- self.print_results_in_shell(self.results.current)
2098+
2099
2100
2101 def print_results_in_shell(self, data):
2102@@ -1748,21 +1742,13 @@
2103 else:
2104 logger.info(" Cross-section : %.4g +- %.4g pb" % (data['cross'], data['error']))
2105 logger.info(" Nb of events : %s" % data['nb_event'] )
2106- if data['cross_pythia']:
2107- error = data.get_pythia_error(data['cross'], data['error'],
2108- data['cross_pythia'], data['nb_event'])
2109- nb_event = 0
2110- if data['cross']:
2111- nb_event = int(0.5+(data['nb_event'] * data['cross_pythia'] /data['cross']))
2112-
2113+ if data['cross_pythia'] and data['nb_event_pythia']:
2114 if self.ninitial == 1:
2115- logger.info(" Matched Width : %.4g +- %.4g GeV" % (data['cross_pythia'], error))
2116+ logger.info(" Matched Width : %.4g +- %.4g GeV" % (data['cross_pythia'], data['error_pythia']))
2117 else:
2118- logger.info(" Matched Cross-section : %.4g +- %.4g pb" % (data['cross'], error))
2119- logger.info(" Nb of events after Matching : %s" % nb_event)
2120+ logger.info(" Matched Cross-section : %.4g +- %.4g pb" % (data['cross_pythia'], data['error_pythia']))
2121+ logger.info(" Nb of events after Matching : %s" % data['nb_event_pythia'])
2122 logger.info(" " )
2123-
2124-
2125
2126 ############################################################################
2127 def do_calculate_decay_widths(self, line):
2128@@ -1771,8 +1757,8 @@
2129
2130 args = self.split_arg(line)
2131 # Check argument's validity
2132- force, accuracy = self.check_calculate_decay_widths(args)
2133- self.ask_run_configuration('parton', force)
2134+ accuracy = self.check_calculate_decay_widths(args)
2135+ self.ask_run_configuration('parton')
2136 if not args:
2137 # No run name assigned -> assigned one automaticaly
2138 self.set_run_name(self.find_available_run_name(self.me_dir))
2139@@ -1907,8 +1893,8 @@
2140
2141 args = self.split_arg(line)
2142 # Check argument's validity
2143- force, mode = self.check_multi_run(args)
2144- self.ask_run_configuration(mode, force)
2145+ mode = self.check_multi_run(args)
2146+ self.ask_run_configuration(mode)
2147 main_name = self.run_name
2148 nb_run = args.pop(0)
2149 crossoversig = 0
2150@@ -1924,8 +1910,12 @@
2151 crossoversig+=cross/error**2
2152 inv_sq_err+=1.0/error**2
2153 self.results[main_name][-1]['cross'] = crossoversig/inv_sq_err
2154- self.results[main_name][-1]['error'] = math.sqrt(1.0/inv_sq_err)
2155-
2156+ self.results[main_name][-1]['error'] = math.sqrt(1.0/inv_sq_err)
2157+ if self.run_card['iseed'] != 0:
2158+ seed = self.random + 1
2159+ text = open(pjoin(self.me_dir, 'Cards','run_card.dat')).read()
2160+ (t,n) = re.subn(r'\s\d+\s*= iseed',' %s = iseed' % seed,text)
2161+ open(pjoin(self.me_dir, 'Cards','run_card.dat'),'w').write(t)
2162
2163 self.run_name = main_name
2164 self.results.def_current(main_name)
2165@@ -1998,7 +1988,7 @@
2166 raise MadEventError, 'Error make gensym not successful'
2167
2168 # Launch gensym
2169- p = subprocess.Popen(['./gensym'], stdin=subprocess.PIPE,
2170+ p = misc.Popen(['./gensym'], stdin=subprocess.PIPE,
2171 stdout=subprocess.PIPE,
2172 stderr=subprocess.STDOUT, cwd=Pdir)
2173 sym_input = "%(points)d %(iterations)d %(accuracy)f %(gridpack)s\n" % self.opts
2174@@ -2061,7 +2051,7 @@
2175 if os.path.basename(match)[:4] in ['ajob', 'wait', 'run.', 'done']:
2176 os.remove(pjoin(Pdir, match))
2177
2178- proc = subprocess.Popen([pjoin(bindir, 'gen_ximprove')],
2179+ proc = misc.Popen([pjoin(bindir, 'gen_ximprove')],
2180 stdout=devnull,
2181 stdin=subprocess.PIPE,
2182 cwd=Pdir)
2183@@ -2087,7 +2077,7 @@
2184 pass
2185
2186 bindir = pjoin(os.path.relpath(self.dirbin, pjoin(self.me_dir,'SubProcesses')))
2187- subprocess.call([pjoin(bindir, 'combine_runs')],
2188+ misc.call([pjoin(bindir, 'combine_runs')],
2189 cwd=pjoin(self.me_dir,'SubProcesses'),
2190 stdout=devnull)
2191
2192@@ -2111,7 +2101,7 @@
2193 cwd=pjoin(self.me_dir,'SubProcesses'),
2194 stdout=pjoin(self.me_dir,'SubProcesses', 'combine.log'))
2195 else:
2196- out = subprocess.call(['../bin/internal/run_combine'],
2197+ out = misc.call(['../bin/internal/run_combine'],
2198 cwd=pjoin(self.me_dir,'SubProcesses'),
2199 stdout=open(pjoin(self.me_dir,'SubProcesses','combine.log'),'w'))
2200
2201@@ -2124,7 +2114,13 @@
2202
2203 # Define The Banner
2204 tag = self.run_card['run_tag']
2205+ # Update the banner with the pythia card
2206+ if not self.banner:
2207+ self.banner = banner_mod.recover_banner(self.results, 'parton')
2208 self.banner.load_basic(self.me_dir)
2209+ # Add cross-section/event information
2210+ self.banner.add_generation_info(self.results.current['cross'], nb_event)
2211+ if not hasattr(self, 'random'): self.random = 0
2212 self.banner.change_seed(self.random)
2213 if not os.path.exists(pjoin(self.me_dir, 'Events', self.run_name)):
2214 os.mkdir(pjoin(self.me_dir, 'Events', self.run_name))
2215@@ -2134,15 +2130,10 @@
2216 self.banner.add(pjoin(self.me_dir, 'Cards', 'run_card.dat'))
2217
2218
2219- subprocess.call(['%s/put_banner' % self.dirbin, 'events.lhe'],
2220- cwd=pjoin(self.me_dir, 'Events'))
2221- subprocess.call(['%s/put_banner'% self.dirbin, 'unweighted_events.lhe'],
2222- cwd=pjoin(self.me_dir, 'Events'))
2223-
2224- #if os.path.exists(pjoin(self.me_dir, 'Events', 'unweighted_events.lhe')):
2225- # subprocess.call(['%s/extract_banner-pl' % self.dirbin,
2226- # 'unweighted_events.lhe', 'banner.txt'],
2227- # cwd=pjoin(self.me_dir, 'Events'))
2228+ misc.call(['%s/put_banner' % self.dirbin, 'events.lhe'],
2229+ cwd=pjoin(self.me_dir, 'Events'))
2230+ misc.call(['%s/put_banner'% self.dirbin, 'unweighted_events.lhe'],
2231+ cwd=pjoin(self.me_dir, 'Events'))
2232
2233 eradir = self.options['exrootanalysis_path']
2234 madir = self.options['madanalysis_path']
2235@@ -2197,7 +2188,7 @@
2236 input = pjoin(G_path, name)
2237 output = pjoin(G_path, '%s_%s' % (run,name))
2238 files.mv(input, output)
2239- subprocess.call(['gzip', output], stdout=devnull,
2240+ misc.call(['gzip', output], stdout=devnull,
2241 stderr=devnull, cwd=G_path)
2242
2243 # 2) restore links in local this is require due to chrome over-security
2244@@ -2210,7 +2201,7 @@
2245 open(results, 'w').write(text)
2246
2247 # 3) Update the index.html
2248- subprocess.call(['%s/gen_cardhtml-pl' % self.dirbin],
2249+ misc.call(['%s/gen_cardhtml-pl' % self.dirbin],
2250 cwd=pjoin(self.me_dir))
2251
2252 # 4) Move the Files present in Events directory
2253@@ -2224,9 +2215,8 @@
2254 input = pjoin(E_path, name)
2255 output = pjoin(O_path, name)
2256 files.mv(input, output)
2257- subprocess.call(['gzip', output], stdout=devnull, stderr=devnull,
2258- cwd=O_path)
2259-
2260+ misc.call(['gzip', output], stdout=devnull, stderr=devnull,
2261+ cwd=O_path)
2262 self.update_status('End Parton', level='parton', makehtml=False)
2263
2264 ############################################################################
2265@@ -2236,14 +2226,15 @@
2266 self.update_status('Creating gridpack', level='parton')
2267 args = self.split_arg(line)
2268 self.check_combine_events(args)
2269+ if not self.run_tag: self.run_tag = 'tag_1'
2270 os.system("sed -i.bak \"s/ *.false.*=.*GridRun/ .true. = GridRun/g\" %s/Cards/grid_card.dat" \
2271 % self.me_dir)
2272- subprocess.call(['./bin/internal/restore_data', self.run_name],
2273+ misc.call(['./bin/internal/restore_data', self.run_name],
2274 cwd=self.me_dir)
2275- subprocess.call(['./bin/internal/store4grid',
2276+ misc.call(['./bin/internal/store4grid',
2277 self.run_name, self.run_tag],
2278 cwd=self.me_dir)
2279- subprocess.call(['./bin/internal/clean'], cwd=self.me_dir)
2280+ misc.call(['./bin/internal/clean'], cwd=self.me_dir)
2281 misc.compile(['gridpack.tar.gz'], cwd=self.me_dir)
2282 files.mv(pjoin(self.me_dir, 'gridpack.tar.gz'),
2283 pjoin(self.me_dir, '%s_gridpack.tar.gz' % self.run_name))
2284@@ -2257,24 +2248,18 @@
2285
2286 # Check argument's validity
2287 args = self.split_arg(line)
2288- if '-f' in args:
2289- force = True
2290- args.remove('-f')
2291- else:
2292- force = False
2293 if '--no_default' in args:
2294 if not os.path.exists(pjoin(self.me_dir, 'Cards', 'pythia_card.dat')):
2295 return
2296- force = True
2297 no_default = True
2298 args.remove('--no_default')
2299 else:
2300 no_default = False
2301
2302 self.check_pythia(args)
2303- # the args are modify and the last arg is always the mode
2304-
2305- self.ask_pythia_run_configuration(args[-1], force)
2306+ # the args are modify and the last arg is always the mode
2307+ if not no_default:
2308+ self.ask_pythia_run_configuration(args[-1])
2309
2310 # Update the banner with the pythia card
2311 if not self.banner:
2312@@ -2283,15 +2268,6 @@
2313 # initialize / remove lhapdf mode
2314 self.configure_directory()
2315
2316- #if not force:
2317- # if os.path.exists(pjoin(self.me_dir, 'Events', self.run_name, '%s_pythia.log' % tag)):
2318- # question = 'Previous run of pythia detected. Do you want to remove it?'
2319- # ans = self.ask(question, 'y', choices=['y','n'], timeout = 20)
2320- # if ans == 'n':
2321- # return
2322-
2323- #self.exec_cmd('remove %s pythia -f' % self.run_name)
2324-
2325 pythia_src = pjoin(self.options['pythia-pgs_path'],'src')
2326
2327 self.update_status('Running Pythia', 'pythia')
2328@@ -2311,7 +2287,7 @@
2329 cwd=pjoin(self.me_dir,'Events'))
2330 else:
2331 pythia_log = open(pjoin(self.me_dir, 'Events', self.run_name , '%s_pythia.log' % tag), 'w')
2332- subprocess.call(['../bin/internal/run_pythia', pythia_src],
2333+ misc.call(['../bin/internal/run_pythia', pythia_src],
2334 stdout=pythia_log,
2335 stderr=subprocess.STDOUT,
2336 cwd=pjoin(self.me_dir,'Events'))
2337@@ -2328,12 +2304,36 @@
2338 self.to_store.append('pythia')
2339
2340 # Find the matched cross-section
2341- if int(self.run_card['ickkw']):
2342- pythia_log = open(pjoin(self.me_dir,'Events', self.run_name, '%s_pythia.log' % tag))
2343- cs_info = misc.get_last_line(pythia_log)
2344- # line should be of type: Cross section (pb): 1840.20000000006
2345- cs_info = cs_info.split(':')[1]
2346- self.results.add_detail('cross_pythia', cs_info)
2347+ if int(self.run_card['ickkw']):
2348+ # read the line from the bottom of the file
2349+ pythia_log = misc.BackRead(pjoin(self.me_dir,'Events', self.run_name,
2350+ '%s_pythia.log' % tag))
2351+ pythiare = re.compile("\s*I\s+0 All included subprocesses\s+I\s+(?P<generated>\d+)\s+(?P<tried>\d+)\s+I\s+(?P<xsec>[\d\.D\-+]+)\s+I")
2352+ for line in pythia_log:
2353+ info = pythiare.search(line)
2354+ if not info:
2355+ continue
2356+ try:
2357+ # Pythia cross section in mb, we want pb
2358+ sigma_m = float(info.group('xsec').replace('D','E')) *1e9
2359+ Nacc = int(info.group('generated'))
2360+ Ntry = int(info.group('tried'))
2361+ except ValueError:
2362+ # xsec is not float - this should not happen
2363+ self.results.add_detail('cross_pythia', 0)
2364+ self.results.add_detail('nb_event_pythia', 0)
2365+ self.results.add_detail('error_pythia', 0)
2366+ else:
2367+ self.results.add_detail('cross_pythia', sigma_m)
2368+ self.results.add_detail('nb_event_pythia', Nacc)
2369+ #compute pythia error
2370+ error = self.results[self.run_name].return_tag(self.run_tag)['error']
2371+ error_m = math.sqrt((error * Nacc/Ntry)**2 + sigma_m**2 *(1-Nacc/Ntry)/Nacc)
2372+ # works both for fixed number of generated events and fixed accepted events
2373+ self.results.add_detail('error_pythia', error_m)
2374+ break
2375+
2376+ pythia_log.close()
2377
2378 pydir = pjoin(self.options['pythia-pgs_path'], 'src')
2379 eradir = self.options['exrootanalysis_path']
2380@@ -2363,13 +2363,13 @@
2381 argument= [pydir],
2382 cwd=pjoin(self.me_dir,'Events'))
2383 else:
2384- subprocess.call([self.dirbin+'/run_hep2lhe', pydir],
2385+ misc.call([self.dirbin+'/run_hep2lhe', pydir],
2386 cwd=pjoin(self.me_dir,'Events'))
2387
2388 # Creating ROOT file
2389 if eradir and misc.is_executable(pjoin(eradir, 'ExRootLHEFConverter')):
2390 self.update_status('Creating Pythia LHE Root File', level='pythia')
2391- subprocess.call([eradir+'/ExRootLHEFConverter',
2392+ misc.call([eradir+'/ExRootLHEFConverter',
2393 'pythia_events.lhe',
2394 pjoin(self.run_name, '%s_pythia_lhe_events.root' % tag)],
2395 cwd=pjoin(self.me_dir,'Events'))
2396@@ -2377,15 +2377,15 @@
2397
2398 if int(self.run_card['ickkw']):
2399 self.update_status('Create matching plots for Pythia', level='pythia')
2400- subprocess.call([self.dirbin+'/create_matching_plots.sh', self.run_name, tag],
2401+ misc.call([self.dirbin+'/create_matching_plots.sh', self.run_name, tag],
2402 stdout = os.open(os.devnull, os.O_RDWR),
2403 cwd=pjoin(self.me_dir,'Events'))
2404 #Clean output
2405- subprocess.call(['gzip','-f','events.tree'],
2406+ misc.call(['gzip','-f','events.tree'],
2407 cwd=pjoin(self.me_dir,'Events'))
2408 files.mv(pjoin(self.me_dir,'Events','events.tree.gz'),
2409 pjoin(self.me_dir,'Events',self.run_name, tag + '_pythia_events.tree.gz'))
2410- subprocess.call(['gzip','-f','beforeveto.tree'],
2411+ misc.call(['gzip','-f','beforeveto.tree'],
2412 cwd=pjoin(self.me_dir,'Events'))
2413 files.mv(pjoin(self.me_dir,'Events','beforeveto.tree.gz'),
2414 pjoin(self.me_dir,'Events',self.run_name, tag+'_pythia_beforeveto.tree.gz'))
2415@@ -2407,6 +2407,8 @@
2416 self.exec_cmd('pgs --no_default', postcmd=False, printcmd=False)
2417 if self.options['delphes_path']:
2418 self.exec_cmd('delphes --no_default', postcmd=False, printcmd=False)
2419+
2420+ self.print_results_in_shell(self.results.current)
2421
2422 def get_available_tag(self):
2423 """create automatically a tag"""
2424@@ -2451,14 +2453,14 @@
2425 pass # Just ensure that html never makes crash this function
2426
2427
2428- # Found the file to suppress
2429+ # Found the file to delete
2430
2431- to_suppress = glob.glob(pjoin(self.me_dir, 'Events', run, '*'))
2432- to_suppress += glob.glob(pjoin(self.me_dir, 'HTML', run, '*'))
2433+ to_delete = glob.glob(pjoin(self.me_dir, 'Events', run, '*'))
2434+ to_delete += glob.glob(pjoin(self.me_dir, 'HTML', run, '*'))
2435 # forbid the banner to be removed
2436- to_suppress = [os.path.basename(f) for f in to_suppress if 'banner' not in f]
2437+ to_delete = [os.path.basename(f) for f in to_delete if 'banner' not in f]
2438 if tag:
2439- to_suppress = [f for f in to_suppress if tag in f]
2440+ to_delete = [f for f in to_delete if tag in f]
2441 if 'parton' in mode or 'all' in mode:
2442 try:
2443 if self.results[run][0]['tag'] != tag:
2444@@ -2466,35 +2468,35 @@
2445 except:
2446 pass
2447 else:
2448- nb_rm = len(to_suppress)
2449+ nb_rm = len(to_delete)
2450 if os.path.exists(pjoin(self.me_dir, 'Events', run, 'events.lhe.gz')):
2451- to_suppress.append('events.lhe.gz')
2452+ to_delete.append('events.lhe.gz')
2453 if os.path.exists(pjoin(self.me_dir, 'Events', run, 'unweighted_events.lhe.gz')):
2454- to_suppress.append('unweighted_events.lhe.gz')
2455- if nb_rm != len(to_suppress):
2456+ to_delete.append('unweighted_events.lhe.gz')
2457+ if nb_rm != len(to_delete):
2458 logger.warning('Be carefull that partonic information are on the point to be removed.')
2459 if 'all' in mode:
2460- pass # suppress everything
2461+ pass # delete everything
2462 else:
2463 if 'pythia' not in mode:
2464- to_suppress = [f for f in to_suppress if 'pythia' not in f]
2465+ to_delete = [f for f in to_delete if 'pythia' not in f]
2466 if 'pgs' not in mode:
2467- to_suppress = [f for f in to_suppress if 'pgs' not in f]
2468+ to_delete = [f for f in to_delete if 'pgs' not in f]
2469 if 'delphes' not in mode:
2470- to_suppress = [f for f in to_suppress if 'delphes' not in f]
2471+ to_delete = [f for f in to_delete if 'delphes' not in f]
2472 if 'parton' not in mode:
2473- to_suppress = [f for f in to_suppress if 'delphes' in f
2474+ to_delete = [f for f in to_delete if 'delphes' in f
2475 or 'pgs' in f
2476 or 'pythia' in f]
2477- if '-f' not in args and len(to_suppress):
2478- question = 'Do you want to suppress the following files?\n %s' % \
2479- '\n '.join(to_suppress)
2480- ans = self.ask(question, 'y', choices=['y','n'], timeout = self.timeout)
2481+ if not self.force and len(to_delete):
2482+ question = 'Do you want to delete the following files?\n %s' % \
2483+ '\n '.join(to_delete)
2484+ ans = self.ask(question, 'y', choices=['y','n'])
2485 else:
2486 ans = 'y'
2487
2488 if ans == 'y':
2489- for file2rm in to_suppress:
2490+ for file2rm in to_delete:
2491 if os.path.exists(pjoin(self.me_dir, 'Events', run, file2rm)):
2492 try:
2493 os.remove(pjoin(self.me_dir, 'Events', run, file2rm))
2494@@ -2516,23 +2518,23 @@
2495 except:
2496 pass
2497 else:
2498- to_suppress = glob.glob(pjoin(self.me_dir, 'SubProcesses', '%s*' % run))
2499- to_suppress += glob.glob(pjoin(self.me_dir, 'SubProcesses', '*','%s*' % run))
2500- to_suppress += glob.glob(pjoin(self.me_dir, 'SubProcesses', '*','*','%s*' % run))
2501+ to_delete = glob.glob(pjoin(self.me_dir, 'SubProcesses', '%s*' % run))
2502+ to_delete += glob.glob(pjoin(self.me_dir, 'SubProcesses', '*','%s*' % run))
2503+ to_delete += glob.glob(pjoin(self.me_dir, 'SubProcesses', '*','*','%s*' % run))
2504
2505- if '-f' in args or len(to_suppress) == 0:
2506+ if self.force or len(to_delete) == 0:
2507 ans = 'y'
2508 else:
2509- question = 'Do you want to suppress the following files?\n %s' % \
2510- '\n '.join(to_suppress)
2511- ans = self.ask(question, 'y', choices=['y','n'], timeout = self.timeout)
2512+ question = 'Do you want to delete the following files?\n %s' % \
2513+ '\n '.join(to_delete)
2514+ ans = self.ask(question, 'y', choices=['y','n'])
2515
2516 if ans == 'y':
2517- for file2rm in to_suppress:
2518+ for file2rm in to_delete:
2519 os.remove(file2rm)
2520
2521 if 'banner' in mode:
2522- to_suppress = glob.glob(pjoin(self.me_dir, 'Events', run, '*'))
2523+ to_delete = glob.glob(pjoin(self.me_dir, 'Events', run, '*'))
2524 if tag:
2525 # remove banner
2526 try:
2527@@ -2543,8 +2545,8 @@
2528 if run in self.results:
2529 self.results.delete_run(run, tag)
2530 return
2531- elif any(['banner' not in os.path.basename(p) for p in to_suppress]):
2532- if to_suppress:
2533+ elif any(['banner' not in os.path.basename(p) for p in to_delete]):
2534+ if to_delete:
2535 raise MadGraph5Error, '''Some output still exists for this run.
2536 Please remove those output first. Do for example:
2537 remove %s all banner
2538@@ -2661,11 +2663,6 @@
2539
2540 args = self.split_arg(line)
2541 # Check argument's validity
2542- if '-f' in args:
2543- force = True
2544- args.remove('-f')
2545- else:
2546- force = False
2547 if '--no_default' in args:
2548 no_default = True
2549 args.remove('--no_default')
2550@@ -2688,7 +2685,7 @@
2551 pjoin(self.me_dir, 'Cards', 'pgs_card.dat'))
2552 logger.info('No pgs card found. Take the default one.')
2553
2554- if not (no_default or force):
2555+ if not (no_default or self.force):
2556 self.ask_edit_cards(['pgs'], args)
2557
2558 self.update_status('prepare PGS run', level=None)
2559@@ -2743,7 +2740,7 @@
2560 stdout=pgs_log, stderr=subprocess.STDOUT)
2561 else:
2562 pgs_log = open(pjoin(self.me_dir, 'Events', self.run_name,"%s_pgs.log" % tag),'w')
2563- subprocess.call([self.dirbin+'/run_pgs', pgsdir], stdout= pgs_log,
2564+ misc.call([self.dirbin+'/run_pgs', pgsdir], stdout= pgs_log,
2565 stderr=subprocess.STDOUT,
2566 cwd=pjoin(self.me_dir, 'Events'))
2567
2568@@ -2754,14 +2751,14 @@
2569 os.remove(pjoin(self.me_dir, 'Events', 'pgs.done'))
2570
2571 if os.path.getsize(banner_path) == os.path.getsize(pjoin(self.me_dir, 'Events','pgs_events.lhco')):
2572- subprocess.call(['cat pgs_uncleaned_events.lhco >> pgs_events.lhco'],
2573+ misc.call(['cat pgs_uncleaned_events.lhco >> pgs_events.lhco'],
2574 cwd=pjoin(self.me_dir, 'Events'))
2575 os.remove(pjoin(self.me_dir, 'Events', 'pgs_uncleaned_events.lhco '))
2576
2577 # Creating Root file
2578 if eradir and misc.is_executable(pjoin(eradir, 'ExRootLHCOlympicsConverter')):
2579 self.update_status('Creating PGS Root File', level='pgs')
2580- subprocess.call([eradir+'/ExRootLHCOlympicsConverter',
2581+ misc.call([eradir+'/ExRootLHCOlympicsConverter',
2582 'pgs_events.lhco',pjoin('%s/%s_pgs_events.root' % (self.run_name, tag))],
2583 cwd=pjoin(self.me_dir, 'Events'))
2584
2585@@ -2770,7 +2767,7 @@
2586 self.create_plot('PGS')
2587 files.mv(pjoin(self.me_dir, 'Events', 'pgs_events.lhco'),
2588 pjoin(self.me_dir, 'Events', self.run_name, '%s_pgs_events.lhco' % tag))
2589- subprocess.call(['gzip','-f', pjoin(self.me_dir, 'Events',
2590+ misc.call(['gzip','-f', pjoin(self.me_dir, 'Events',
2591 self.run_name, '%s_pgs_events.lhco' % tag)])
2592
2593
2594@@ -2783,11 +2780,6 @@
2595
2596 args = self.split_arg(line)
2597 # Check argument's validity
2598- if '-f' in args:
2599- force = True
2600- args.remove('-f')
2601- else:
2602- force = False
2603 if '--no_default' in args:
2604 no_default = True
2605 args.remove('--no_default')
2606@@ -2809,7 +2801,7 @@
2607 if not os.path.exists(pjoin(self.me_dir, 'Cards', 'delphes_trigger.dat')):
2608 files.cp(pjoin(self.me_dir, 'Cards', 'delphes_trigger_default.dat'),
2609 pjoin(self.me_dir, 'Cards', 'delphes_trigger.dat'))
2610- if not (no_default or force):
2611+ if not (no_default or self.force):
2612 self.ask_edit_cards(['delphes', 'trigger'], args)
2613
2614 self.update_status('Running Delphes', level=None)
2615@@ -2835,7 +2827,7 @@
2616 cwd=pjoin(self.me_dir,'Events'))
2617 else:
2618 delphes_log = open(pjoin(self.me_dir, 'Events', self.run_name, "%s_delphes.log" % tag),'w')
2619- subprocess.call(['../bin/internal/run_delphes', delphes_dir,
2620+ misc.call(['../bin/internal/run_delphes', delphes_dir,
2621 self.run_name, tag, str(cross)],
2622 stdout= delphes_log, stderr=subprocess.STDOUT,
2623 cwd=pjoin(self.me_dir,'Events'))
2624@@ -2858,7 +2850,7 @@
2625 self.create_plot('Delphes')
2626
2627 if os.path.exists(pjoin(self.me_dir, 'Events', self.run_name, '%s_delphes_events.lhco' % tag)):
2628- subprocess.call(['gzip','-f', pjoin(self.me_dir, 'Events', self.run_name, '%s_delphes_events.lhco' % tag)])
2629+ misc.call(['gzip','-f', pjoin(self.me_dir, 'Events', self.run_name, '%s_delphes_events.lhco' % tag)])
2630
2631
2632
2633@@ -2877,7 +2869,7 @@
2634 start = time.time()
2635 if (cwd and os.path.exists(pjoin(cwd, exe))) or os.path.exists(exe):
2636 exe = './' + exe
2637- subprocess.call([exe] + argument, cwd=cwd, stdout=stdout,
2638+ misc.call([exe] + argument, cwd=cwd, stdout=stdout,
2639 stderr=subprocess.STDOUT, **opt)
2640 #logger.info('%s run in %f s' % (exe, time.time() -start))
2641
2642@@ -2899,7 +2891,7 @@
2643 self.total_jobs - remaining -1, run_type), level=None, force=False)
2644 start = time.time()
2645 #os.system('cd %s; ./%s' % (cwd,exe))
2646- status = subprocess.call(['./'+exe] + argument, cwd=cwd,
2647+ status = misc.call(['./'+exe] + argument, cwd=cwd,
2648 stdout=stdout, **opt)
2649 logger.info('%s run in %f s' % (exe, time.time() -start))
2650 if status:
2651@@ -2960,8 +2952,19 @@
2652 self.update_status((idle, run, finish, run_type), level=None)
2653 else:
2654 update_status = lambda idle, run, finish: None
2655- self.cluster.wait(self.me_dir, update_status)
2656-
2657+ try:
2658+ self.cluster.wait(self.me_dir, update_status)
2659+ except Exception, error:
2660+ logger.info(error)
2661+ if not self.force:
2662+ ans = self.ask('Cluster Error detected. Do you want to clean the queue?',
2663+ default = 'y', answers=['y','n'])
2664+ else:
2665+ ans = 'y'
2666+ if ans:
2667+ self.cluster.remove()
2668+ raise
2669+
2670 if mode == 2:
2671 # Wait that all thread finish
2672 if not self.control_thread[2]:
2673@@ -3047,16 +3050,16 @@
2674 self.check_nb_events()
2675
2676 # set environment variable for lhapdf.
2677- if self.run_card['pdlabel'] == "'lhapdf'":
2678+ if self.run_card['pdlabel'] == "lhapdf":
2679 os.environ['lhapdf'] = 'True'
2680 elif 'lhapdf' in os.environ.keys():
2681 del os.environ['lhapdf']
2682
2683 # Compile
2684- out = subprocess.call([pjoin(self.dirbin, 'compile_Source')],
2685+ out = misc.call([pjoin(self.dirbin, 'compile_Source')],
2686 cwd = self.me_dir)
2687 if out:
2688- raise MadEventError, 'Impossible to compile'
2689+ raise MadEventError, 'Unable to compile'
2690
2691 # set random number
2692 if self.run_card['iseed'] != '0':
2693@@ -3228,13 +3231,13 @@
2694
2695
2696 nb_event = int(self.run_card['nevents'])
2697- if nb_event > 100000:
2698- logger.warning("Attempting to generate more than 100K events")
2699- logger.warning("Limiting number to 100K. Use multi_run for larger statistics.")
2700+ if nb_event > 1000000:
2701+ logger.warning("Attempting to generate more than 1M events")
2702+ logger.warning("Limiting number to 1M. Use multi_run for larger statistics.")
2703 path = pjoin(self.me_dir, 'Cards', 'run_card.dat')
2704- os.system(r"""perl -p -i.bak -e "s/\d+\s*=\s*nevents/100000 = nevents/" %s""" \
2705+ os.system(r"""perl -p -i.bak -e "s/\d+\s*=\s*nevents/1000000 = nevents/" %s""" \
2706 % path)
2707- self.run_card['nevents'] = 100000
2708+ self.run_card['nevents'] = 1000000
2709
2710 return
2711
2712@@ -3270,7 +3273,7 @@
2713 except Exception, error:
2714 pass
2715 try:
2716- subprocess.call(['./bin/internal/gen_cardhtml-pl'], cwd=self.me_dir,
2717+ misc.call(['./bin/internal/gen_cardhtml-pl'], cwd=self.me_dir,
2718 stdout=devnull, stderr=devnull)
2719 except:
2720 pass
2721@@ -3343,7 +3346,7 @@
2722 self.update_status('Creating root files', level='parton')
2723
2724 eradir = self.options['exrootanalysis_path']
2725- subprocess.call(['%s/ExRootLHEFConverter' % eradir,
2726+ misc.call(['%s/ExRootLHEFConverter' % eradir,
2727 input, output],
2728 cwd=pjoin(self.me_dir, 'Events'))
2729
2730@@ -3380,7 +3383,10 @@
2731
2732
2733 if not os.path.exists(event_path):
2734- raise self.InvalidCmd, 'Events file %s does not exits' % event_path
2735+ if os.path.exists(event_path+'.gz'):
2736+ os.system('gzip -f %s.gz ' % event_path)
2737+ else:
2738+ raise self.InvalidCmd, 'Events file %s does not exits' % event_path
2739
2740 self.update_status('Creating Plots for %s level' % mode, level = mode.lower())
2741
2742@@ -3390,28 +3396,31 @@
2743 os.makedirs(plot_dir)
2744
2745 files.ln(pjoin(self.me_dir, 'Cards','plot_card.dat'), plot_dir, 'ma_card.dat')
2746- proc = subprocess.Popen([os.path.join(madir, 'plot_events')],
2747+ try:
2748+ proc = misc.Popen([os.path.join(madir, 'plot_events')],
2749 stdout = open(pjoin(plot_dir, 'plot.log'),'w'),
2750 stderr = subprocess.STDOUT,
2751 stdin=subprocess.PIPE,
2752 cwd=plot_dir)
2753- proc.communicate('%s\n' % event_path)
2754- del proc
2755- #proc.wait()
2756- subprocess.call(['%s/plot' % self.dirbin, madir, td],
2757+ proc.communicate('%s\n' % event_path)
2758+ del proc
2759+ #proc.wait()
2760+ misc.call(['%s/plot' % self.dirbin, madir, td],
2761 stdout = open(pjoin(plot_dir, 'plot.log'),'a'),
2762 stderr = subprocess.STDOUT,
2763 cwd=plot_dir)
2764
2765- subprocess.call(['%s/plot_page-pl' % self.dirbin,
2766+ misc.call(['%s/plot_page-pl' % self.dirbin,
2767 os.path.basename(plot_dir),
2768 mode],
2769 stdout = open(pjoin(plot_dir, 'plot.log'),'a'),
2770 stderr = subprocess.STDOUT,
2771 cwd=pjoin(self.me_dir, 'HTML', self.run_name))
2772-
2773- shutil.move(pjoin(self.me_dir, 'HTML',self.run_name ,'plots.html'),
2774+ shutil.move(pjoin(self.me_dir, 'HTML',self.run_name ,'plots.html'),
2775 output)
2776+
2777+ except OSError, error:
2778+ logger.error('fail to create plot: %s. Please check that MadAnalysis is correctly installed.' % error)
2779
2780 self.update_status('End Plots for %s level' % mode, level = mode.lower(),
2781 makehtml=False)
2782@@ -3435,7 +3444,7 @@
2783
2784
2785 ############################################################################
2786- def ask_run_configuration(self, mode=None, force=False):
2787+ def ask_run_configuration(self, mode=None):
2788 """Ask the question when launching generate_events/multi_run"""
2789
2790 available_mode = ['0', '1']
2791@@ -3460,9 +3469,9 @@
2792 if '4' in available_mode:
2793 question += """ 4 / delphes : MadEvent + Pythia + Delphes.\n"""
2794
2795- if not force:
2796+ if not self.force:
2797 if not mode:
2798- mode = self.ask(question, '0', options, timeout=self.timeout)
2799+ mode = self.ask(question, '0', options)
2800 elif not mode:
2801 mode = 'auto'
2802
2803@@ -3497,7 +3506,7 @@
2804 self.add_card_to_run('trigger')
2805 cards.append('delphes_card.dat')
2806
2807- if force:
2808+ if self.force:
2809 return
2810
2811 def get_question(mode):
2812@@ -3536,7 +3545,7 @@
2813 answer = 'no'
2814 while answer != 'done':
2815 question, possible_answer, card = get_question(mode)
2816- answer = self.ask(question, '0', possible_answer, timeout=int(1.5*self.timeout), path_msg='enter path')
2817+ answer = self.ask(question, '0', possible_answer, timeout=int(1.5*self.options['timeout']), path_msg='enter path')
2818 if answer.isdigit():
2819 answer = card[int(answer)]
2820 if answer == 'done':
2821@@ -3546,7 +3555,6 @@
2822 path = pjoin(self.me_dir,'Cards','%s_card.dat' % answer)
2823 else:
2824 path = pjoin(self.me_dir,'Cards','delphes_trigger.dat')
2825- print path
2826 self.exec_cmd('open %s' % path)
2827 else:
2828 # detect which card is provide
2829@@ -3573,7 +3581,7 @@
2830
2831
2832 ############################################################################
2833- def ask_pythia_run_configuration(self, mode=None, force=False):
2834+ def ask_pythia_run_configuration(self, mode=None):
2835 """Ask the question when launching pythia"""
2836
2837 available_mode = ['0', '1', '2']
2838@@ -3588,9 +3596,9 @@
2839 if '3' in available_mode:
2840 question += """ 3 / delphes : Pythia + Delphes.\n"""
2841
2842- if not force:
2843+ if not self.force:
2844 if not mode:
2845- mode = self.ask(question, '0', options, timeout=self.timeout)
2846+ mode = self.ask(question, '0', options)
2847 elif not mode:
2848 mode = 'auto'
2849
2850@@ -3621,7 +3629,7 @@
2851 self.add_card_to_run('trigger')
2852 cards.append('delphes_card.dat')
2853
2854- if force:
2855+ if self.force:
2856 return mode
2857
2858 # Ask the user if he wants to edit any of the files
2859@@ -3655,7 +3663,7 @@
2860 # Loop as long as the user is not done.
2861 answer = 'no'
2862 while answer != 'done':
2863- answer = self.ask(question, '0', possible_answer, timeout=int(1.5*self.timeout), path_msg='enter path')
2864+ answer = self.ask(question, '0', possible_answer, timeout=int(1.5*self.options['timeout']), path_msg='enter path')
2865 if answer.isdigit():
2866 answer = card[int(answer)]
2867 if answer == 'done':
2868@@ -3682,7 +3690,7 @@
2869 def ask_edit_cards(self, cards, fct_args):
2870 """Question for cards editions (used for pgs/delphes)"""
2871
2872- if '-f' in fct_args or '--no_default' in fct_args:
2873+ if self.force or '--no_default' in fct_args:
2874 return
2875
2876 card_name = {'pgs': 'pgs_card.dat',
2877@@ -3714,7 +3722,7 @@
2878 # Loop as long as the user is not done.
2879 answer = 'no'
2880 while answer != 'done':
2881- answer = self.ask(question, '0', possible_answer, timeout=int(1.5*self.timeout), path_msg='enter path')
2882+ answer = self.ask(question, '0', possible_answer, timeout=int(1.5*self.options['timeout']), path_msg='enter path')
2883 if answer.isdigit():
2884 answer = card[int(answer)]
2885 if answer == 'done':
2886@@ -3739,7 +3747,7 @@
2887
2888
2889 question = """Do you want to edit the %s?""" % card
2890- answer = self.ask(question, 'n', ['y','n'], timeout=self.timeout,path_msg='enter path')
2891+ answer = self.ask(question, 'n', ['y','n'],path_msg='enter path')
2892 if answer == 'y':
2893 path = pjoin(self.me_dir,'Cards', card)
2894 self.exec_cmd('open %s' % path)
2895@@ -3928,13 +3936,13 @@
2896 logger.info('generate %s events' % nb_event)
2897 self.set_run_name('GridRun_%s' % seed)
2898 self.update_status('restoring default data', level=None)
2899- subprocess.call([pjoin(self.me_dir,'bin','internal','restore_data'),
2900+ misc.call([pjoin(self.me_dir,'bin','internal','restore_data'),
2901 'default'],
2902 cwd=self.me_dir)
2903
2904 # 2) Run the refine for the grid
2905 self.update_status('Generating Events', level=None)
2906- #subprocess.call([pjoin(self.me_dir,'bin','refine4grid'),
2907+ #misc.call([pjoin(self.me_dir,'bin','refine4grid'),
2908 # str(nb_event), '0', 'Madevent','1','GridRun_%s' % seed],
2909 # cwd=self.me_dir)
2910 self.refine4grid(nb_event)
2911@@ -3942,7 +3950,6 @@
2912 # 3) Combine the events/pythia/...
2913 self.exec_cmd('combine_events')
2914 self.exec_cmd('store_events')
2915- self.exec_cmd('pythia --no_default -f')
2916 self.print_results_in_shell(self.results.current)
2917
2918 def refine4grid(self, nb_event):
2919@@ -3974,7 +3981,7 @@
2920
2921 devnull = os.open(os.devnull, os.O_RDWR)
2922 logfile = pjoin(Pdir, 'gen_ximprove.log')
2923- proc = subprocess.Popen([pjoin(bindir, 'gen_ximprove')],
2924+ proc = misc.Popen([pjoin(bindir, 'gen_ximprove')],
2925 stdin=subprocess.PIPE,
2926 stdout=open(logfile,'w'),
2927 cwd=Pdir)
2928@@ -3990,7 +3997,7 @@
2929 for i, job in enumerate(alljobs):
2930 job = os.path.basename(job)
2931 self.launch_job('./%s' % job, cwd=Pdir, remaining=(nb_tot-i-1),
2932- run_type='Refine number %s on %s (%s/%s)' % (self.nb_refine, subdir, nb_proc+1, len(subproc)))
2933+ run_type='Refine number %s on %s (%s/%s)' % (self.nb_refine, subdir, nb_proc+1, len(subproc)))
2934 self.monitor(run_type='All job submitted for refine number %s' % self.nb_refine,
2935 html=True)
2936
2937@@ -4001,11 +4008,11 @@
2938 pass
2939
2940 bindir = pjoin(os.path.relpath(self.dirbin, pjoin(self.me_dir,'SubProcesses')))
2941- subprocess.call([pjoin(bindir, 'combine_runs')],
2942+ misc.call([pjoin(bindir, 'combine_runs')],
2943 cwd=pjoin(self.me_dir,'SubProcesses'),
2944 stdout=devnull)
2945
2946- #subprocess.call([pjoin(self.dirbin, 'sumall')],
2947+ #misc.call([pjoin(self.dirbin, 'sumall')],
2948 # cwd=pjoin(self.me_dir,'SubProcesses'),
2949 # stdout=devnull)
2950
2951
2952=== modified file 'madgraph/interface/madgraph_interface.py'
2953--- madgraph/interface/madgraph_interface.py 2012-03-08 23:53:29 +0000
2954+++ madgraph/interface/madgraph_interface.py 2012-05-16 15:22:19 +0000
2955@@ -24,6 +24,7 @@
2956 import re
2957 import subprocess
2958 import sys
2959+import shutil
2960 import traceback
2961 import time
2962
2963@@ -69,6 +70,9 @@
2964 import models as ufomodels
2965 import models.import_ufo as import_ufo
2966
2967+import aloha.aloha_fct as aloha_fct
2968+import aloha.create_aloha as create_aloha
2969+
2970 # Special logger for the Cmd Interface
2971 logger = logging.getLogger('cmdprint') # -> stdout
2972 logger_stderr = logging.getLogger('fatalerror') # ->stderr
2973@@ -313,6 +317,11 @@
2974 logger.info(" the processes using Pythia 8. The files are written in")
2975 logger.info(" the Pythia 8 directory (default).")
2976 logger.info(" NOTE: The Pythia 8 directory is set in the ./input/mg5_configuration.txt")
2977+ logger.info(" - If mode is aloha: Special syntax output:")
2978+ logger.info(" syntax: aloha [ROUTINE] [--options]" )
2979+ logger.info(" valid options for aloha output are:")
2980+ logger.info(" --format=Fortran|Python|Cpp : defining the output language")
2981+ logger.info(" --output= : defining output directory")
2982 logger.info(" path: The path of the process directory.")
2983 logger.info(" If you put '.' as path, your pwd will be used.")
2984 logger.info(" If you put 'auto', an automatic directory PROC_XX_n will be created.")
2985@@ -403,7 +412,9 @@
2986 logger.info(" fortran_compiler NAME")
2987 logger.info(" (default None) Force a specific fortran compiler.")
2988 logger.info(" If None, it tries first g77 and if not present gfortran.")
2989-
2990+ logger.info(" timeout VALUE")
2991+ logger.info(" (default 20) Seconds allowed to answer questions.")
2992+ logger.info(" Note that pressing tab always stops the timer.")
2993
2994 #===============================================================================
2995 # CheckValidForCmd
2996@@ -797,6 +808,11 @@
2997 if args[1] not in ['DEBUG','INFO','WARNING','ERROR','CRITICAL']:
2998 raise self.InvalidCmd('output_level needs ' + \
2999 'a valid level')
3000+
3001+ if args[0] in ['timeout']:
3002+ if not args[1].isdigit():
3003+ raise self.InvalidCmd('timeout values should be a integer')
3004+
3005
3006 def check_open(self, args):
3007 """ check the validity of the line """
3008@@ -845,10 +861,6 @@
3009 else:
3010 self._export_format = 'madevent'
3011
3012- if not self._curr_amps:
3013- text = 'No processes generated. Please generate a process first.'
3014- raise self.InvalidCmd(text)
3015-
3016 if not self._curr_model:
3017 text = 'No model found. Please import a model first and then retry.'
3018 raise self.InvalidCmd(text)
3019@@ -862,9 +874,25 @@
3020 logger.warning(text)
3021 raise self.InvalidCmd('')
3022
3023+ if self._export_format == 'aloha':
3024+ return
3025+
3026+
3027+ if not self._curr_amps:
3028+ text = 'No processes generated. Please generate a process first.'
3029+ raise self.InvalidCmd(text)
3030+
3031+
3032+
3033+
3034+
3035 if args and args[0][0] != '-':
3036 # This is a path
3037 path = args.pop(0)
3038+ forbiden_chars = ['>','<',';','&']
3039+ for char in forbiden_chars:
3040+ if char in path:
3041+ raise self.invalidCmd('%s is not allowed in the output path' % char)
3042 # Check for special directory treatment
3043 if path == 'auto' and self._export_format in \
3044 ['madevent', 'standalone', 'standalone_cpp']:
3045@@ -1126,8 +1154,7 @@
3046
3047 # Directory continuation
3048 if args[-1].endswith(os.path.sep):
3049- return self.path_completion(text,
3050- pjoin('.',*[a for a in args \
3051+ return self.path_completion(text, pjoin(*[a for a in args \
3052 if a.endswith(os.path.sep)]))
3053 # autocompletion for particles/couplings
3054 model_comp = self.model_completion(text, ' '.join(args[2:]))
3055@@ -1159,7 +1186,7 @@
3056 return self.list_completion(text, self._display_opts)
3057
3058 if len(args) == 2 and args[1] == 'checks':
3059- return self.list_completion(text, 'failed')
3060+ return self.list_completion(text, ['failed'])
3061
3062 if len(args) == 2 and args[1] == 'particles':
3063 return self.model_completion(text, line[begidx:])
3064@@ -1172,7 +1199,7 @@
3065 # Directory continuation
3066 if args[-1].endswith(os.path.sep):
3067 return self.path_completion(text,
3068- pjoin('.',*[a for a in args if a.endswith(os.path.sep)]),
3069+ pjoin(*[a for a in args if a.endswith(os.path.sep)]),
3070 only_dirs = True)
3071 # Format
3072 if len(args) == 1:
3073@@ -1192,7 +1219,7 @@
3074 # Directory continuation
3075 if args[-1].endswith(os.path.sep):
3076 return self.path_completion(text,
3077- pjoin('.',*[a for a in args if a.endswith(os.path.sep)]),
3078+ pjoin(*[a for a in args if a.endswith(os.path.sep)]),
3079 only_dirs = True)
3080 # Format
3081 if len(args) == 1:
3082@@ -1233,7 +1260,7 @@
3083 # Directory continuation
3084 if args[-1].endswith(os.path.sep):
3085 return self.path_completion(text,
3086- pjoin('.',*[a for a in args if \
3087+ pjoin(*[a for a in args if \
3088 a.endswith(os.path.sep)]))
3089
3090 # Filename if directory is not given
3091@@ -1252,22 +1279,23 @@
3092 # Directory continuation
3093 if args[-1].endswith(os.path.sep):
3094 return self.path_completion(text,
3095- pjoin('.',*[a for a in args if a.endswith(os.path.sep)]),
3096+ pjoin(*[a for a in args if a.endswith(os.path.sep)]),
3097 only_dirs = True)
3098
3099 # Filename if directory is not given
3100 if len(args) == 2:
3101 return self.path_completion(text)
3102-
3103+
3104+ @cmd.debug()
3105 def complete_open(self, text, line, begidx, endidx):
3106 """ complete the open command """
3107-
3108+
3109 args = self.split_arg(line[0:begidx])
3110
3111 # Directory continuation
3112 if os.path.sep in args[-1] + text:
3113 return self.path_completion(text,
3114- pjoin('.',*[a for a in args if \
3115+ pjoin(*[a for a in args if \
3116 a.endswith(os.path.sep)]))
3117
3118 possibility = []
3119@@ -1290,7 +1318,8 @@
3120 possibility.append('ME5_debug')
3121
3122 return self.list_completion(text, possibility)
3123-
3124+
3125+ @cmd.debug()
3126 def complete_output(self, text, line, begidx, endidx,
3127 possible_options = ['f', 'noclean', 'nojpeg'],
3128 possible_options_full = ['-f', '-noclean', '-nojpeg']):
3129@@ -1301,15 +1330,20 @@
3130 forbidden_names = ['MadGraphII', 'Template', 'pythia-pgs', 'CVS',
3131 'Calculators', 'MadAnalysis', 'SimpleAnalysis',
3132 'mg5', 'DECAY', 'EventConverter', 'Models',
3133- 'ExRootAnalysis', 'HELAS', 'Transfer_Fct']
3134+ 'ExRootAnalysis', 'HELAS', 'Transfer_Fct', 'aloha']
3135
3136 #name of the run =>proposes old run name
3137 args = self.split_arg(line[0:begidx])
3138 if len(args) >= 1:
3139+ if len(args) > 1 and args[1] == 'aloha':
3140+ try:
3141+ return self.aloha_complete_output(text, line, begidx, endidx)
3142+ except Exception, error:
3143+ print error
3144 # Directory continuation
3145 if args[-1].endswith(os.path.sep):
3146 return [name for name in self.path_completion(text,
3147- pjoin('.',*[a for a in args if a.endswith(os.path.sep)]),
3148+ pjoin(*[a for a in args if a.endswith(os.path.sep)]),
3149 only_dirs = True) if name not in forbidden_names]
3150 # options
3151 if args[-1][0] == '-' or len(args) > 1 and args[-2] == '-':
3152@@ -1318,11 +1352,8 @@
3153 return self.list_completion(text, possible_options_full)
3154 # Formats
3155 if len(args) == 1:
3156- if any([p.startswith(text) for p in possible_format]):
3157- return [name for name in \
3158- self.list_completion(text, possible_format) + \
3159- ['.' + os.path.sep, '..' + os.path.sep, 'auto'] \
3160- if name.startswith(text)]
3161+ format = possible_format + ['.' + os.path.sep, '..' + os.path.sep, 'auto']
3162+ return self.list_completion(text, format)
3163
3164 # directory names
3165 content = [name for name in self.path_completion(text, '.', only_dirs = True) \
3166@@ -1330,6 +1361,46 @@
3167 content += ['auto']
3168 return self.list_completion(text, content)
3169
3170+ def aloha_complete_output(self, text, line, begidx, endidx):
3171+ "Complete the output aloha command"
3172+ args = self.split_arg(line[0:begidx])
3173+ completion_categories = {}
3174+
3175+ forbidden_names = ['MadGraphII', 'Template', 'pythia-pgs', 'CVS',
3176+ 'Calculators', 'MadAnalysis', 'SimpleAnalysis',
3177+ 'mg5', 'DECAY', 'EventConverter', 'Models',
3178+ 'ExRootAnalysis', 'Transfer_Fct', 'aloha',
3179+ 'apidoc','vendor']
3180+
3181+
3182+ # options
3183+ options = ['--format=Fortran', '--format=Python','--format=CPP','--output=']
3184+ options = self.list_completion(text, options)
3185+ if options:
3186+ completion_categories['options'] = options
3187+
3188+ if args[-1] == '--output=' or args[-1].endswith(os.path.sep):
3189+ # Directory continuation
3190+ completion_categories['path'] = [name for name in self.path_completion(text,
3191+ pjoin(*[a for a in args if a.endswith(os.path.sep)]),
3192+ only_dirs = True) if name not in forbidden_names]
3193+
3194+ else:
3195+ ufomodel = ufomodels.load_model(self._curr_model.get('name'))
3196+ wf_opt = []
3197+ amp_opt = []
3198+ opt_conjg = []
3199+ for lor in ufomodel.all_lorentz:
3200+ amp_opt.append('%s_0' % lor.name)
3201+ for i in range(len(lor.spins)):
3202+ wf_opt.append('%s_%i' % (lor.name,i+1))
3203+ if i % 2 == 0 and lor.spins[i] == 2:
3204+ opt_conjg.append('%sC%i_%i' % (lor.name,i //2 +1,i+1))
3205+ completion_categories['amplitude routines'] = self.list_completion(text, amp_opt)
3206+ completion_categories['Wavefunctions routines'] = self.list_completion(text, wf_opt)
3207+ completion_categories['conjugate_routines'] = self.list_completion(text, opt_conjg)
3208+
3209+ return self.deal_multiple_categories(completion_categories)
3210
3211 def complete_set(self, text, line, begidx, endidx):
3212 "Complete the set command"
3213@@ -1368,7 +1439,7 @@
3214 return self.list_completion(text, first_set + second_set)
3215 elif len(args) >2 and args[-1].endswith(os.path.sep):
3216 return self.path_completion(text,
3217- pjoin('.',*[a for a in args if a.endswith(os.path.sep)]),
3218+ pjoin(*[a for a in args if a.endswith(os.path.sep)]),
3219 only_dirs = True)
3220
3221 def complete_import(self, text, line, begidx, endidx):
3222@@ -1460,7 +1531,7 @@
3223 or os.path.exists(pjoin(MG5DIR,'models',p,'particles.dat')) \
3224 or os.path.exists(pjoin(self._mgme_dir,'Models',p,'particles.dat'))
3225 else:
3226- cur_path = pjoin('.',*[a for a in args \
3227+ cur_path = pjoin(*[a for a in args \
3228 if a.endswith(os.path.sep)])
3229 all_path = self.path_completion(text, cur_path)
3230 completion_categories['model name'] = all_path
3231@@ -1482,7 +1553,7 @@
3232 all_name += self.find_restrict_card(model_name,
3233 base_dir=pjoin(MG5DIR,'models'))
3234 if mode == 'all':
3235- cur_path = pjoin('.',*[a for a in args \
3236+ cur_path = pjoin(*[a for a in args \
3237 if a.endswith(os.path.sep)])
3238 all_path = self.path_completion(text, cur_path)
3239 completion_categories['model name'] = all_path + all_name
3240@@ -1553,7 +1624,6 @@
3241 """The command line processor of MadGraph"""
3242
3243 writing_dir = '.'
3244- timeout = 0 # time authorize to answer question [0 is no time limit]
3245
3246 # Options and formats available
3247 _display_opts = ['particles', 'interactions', 'processes', 'diagrams',
3248@@ -1566,7 +1636,7 @@
3249 _import_formats = ['model_v4', 'model', 'proc_v4', 'command', 'banner']
3250 _install_opts = ['pythia-pgs', 'Delphes', 'MadAnalysis', 'ExRootAnalysis']
3251 _v4_export_formats = ['madevent', 'standalone', 'matrix']
3252- _export_formats = _v4_export_formats + ['standalone_cpp', 'pythia8']
3253+ _export_formats = _v4_export_formats + ['standalone_cpp', 'pythia8', 'aloha']
3254 _set_options = ['group_subprocesses',
3255 'ignore_six_quark_processes',
3256 'stdout_level',
3257@@ -1827,7 +1897,6 @@
3258 # check if a particle is asked more than once
3259 if len(request_part) > len(set(request_part)):
3260 for p in request_part:
3261- print p, request_part.count(p),present_part.count(p)
3262 if request_part.count(p) > present_part.count(p):
3263 continue
3264
3265@@ -2709,11 +2778,11 @@
3266 # Load that path
3267 logger.info('Downloading %s' % path[args[0]])
3268 if sys.platform == "darwin":
3269- subprocess.call(['curl', path[args[0]], '-o%s.tgz' % name], cwd=MG5DIR)
3270+ misc.call(['curl', path[args[0]], '-o%s.tgz' % name], cwd=MG5DIR)
3271 else:
3272- subprocess.call(['wget', path[args[0]], '--output-document=%s.tgz'% name], cwd=MG5DIR)
3273+ misc.call(['wget', path[args[0]], '--output-document=%s.tgz'% name], cwd=MG5DIR)
3274 # Untar the file
3275- returncode = subprocess.call(['tar', '-xzpvf', '%s.tgz' % name], cwd=MG5DIR,
3276+ returncode = misc.call(['tar', '-xzpvf', '%s.tgz' % name], cwd=MG5DIR,
3277 stdout=open(os.devnull, 'w'))
3278 if returncode:
3279 raise MadGraph5Error, 'Fail to download correctly the File. Stop'
3280@@ -2739,7 +2808,9 @@
3281 # Compile the file
3282 # Check for F77 compiler
3283 if 'FC' not in os.environ or not os.environ['FC']:
3284- if misc.which('gfortran'):
3285+ if self.options['fortran_compiler']:
3286+ compiler = self.options['fortran_compiler']
3287+ elif misc.which('gfortran'):
3288 compiler = 'gfortran'
3289 elif misc.which('g77'):
3290 compiler = 'g77'
3291@@ -2749,16 +2820,24 @@
3292 path = os.path.join(MG5DIR, 'pythia-pgs', 'src', 'make_opts')
3293 text = open(path).read()
3294 text = text.replace('FC=g77','FC=gfortran')
3295- open(path, 'w').writelines(text)
3296-
3297- if logger.level <= logging.INFO:
3298- subprocess.call(['make', 'clean'], )
3299- status = subprocess.call(['make'], cwd = os.path.join(MG5DIR, name))
3300+ open(path, 'w').writelines(text)
3301+ elif compiler == 'gfortran' and args[0] == 'MadAnalysis':
3302+ path = os.path.join(MG5DIR, 'MadAnalysis', 'makefile')
3303+ text = open(path).read()
3304+ text = text.replace('FC=g77','FC=gfortran')
3305+ open(path, 'w').writelines(text)
3306+
3307+ if logger.level <= logging.INFO:
3308+ devnull = open(os.devnull,'w')
3309+ misc.call(['make', 'clean'], stdout=devnull, stderr=-2)
3310+ status = misc.call(['make'], cwd = os.path.join(MG5DIR, name))
3311 else:
3312 misc.compile(['clean'], mode='', cwd = os.path.join(MG5DIR, name))
3313 status = misc.compile(mode='', cwd = os.path.join(MG5DIR, name))
3314 if not status:
3315 logger.info('compilation succeeded')
3316+ else:
3317+ logger.warning('Error detected during the compilation. Please check the compilation error and run make manually.')
3318
3319
3320 # Special treatment for TD program (require by MadAnalysis)
3321@@ -2773,15 +2852,15 @@
3322 if sys.platform == "darwin":
3323 logger.info('Downloading TD for Mac')
3324 target = 'http://theory.fnal.gov/people/parke/TD/td_mac_intel.tar.gz'
3325- subprocess.call(['curl', target, '-otd.tgz'],
3326+ misc.call(['curl', target, '-otd.tgz'],
3327 cwd=pjoin(MG5DIR,'td'))
3328- subprocess.call(['tar', '-xzpvf', 'td.tgz'],
3329+ misc.call(['tar', '-xzpvf', 'td.tgz'],
3330 cwd=pjoin(MG5DIR,'td'))
3331 files.mv(MG5DIR + '/td/td_mac_intel',MG5DIR+'/td/td')
3332 else:
3333 logger.info('Downloading TD for Linux 32 bit')
3334 target = 'http://madgraph.phys.ucl.ac.be/Downloads/td'
3335- subprocess.call(['wget', target], cwd=pjoin(MG5DIR,'td'))
3336+ misc.call(['wget', target], cwd=pjoin(MG5DIR,'td'))
3337 os.chmod(pjoin(MG5DIR,'td','td'), 0775)
3338 if sys.maxsize > 2**32:
3339 logger.warning('''td program (needed by MadAnalysis) is not compile for 64 bit computer
3340@@ -2794,6 +2873,7 @@
3341 ./input/mg5_configuration.txt. assign to default if not define """
3342
3343 self.options = {'pythia8_path': './pythia8',
3344+ 'timeout': 20,
3345 'web_browser':None,
3346 'eps_viewer':None,
3347 'text_editor':None,
3348@@ -2895,8 +2975,7 @@
3349 # args is now MODE PATH
3350
3351 if args[0].startswith('standalone'):
3352- ext_program = launch_ext.SALauncher(self, args[1], self.timeout,
3353- **options)
3354+ ext_program = launch_ext.SALauncher(self, args[1], **options)
3355 elif args[0] == 'madevent':
3356 if options['interactive']:
3357 if hasattr(self, 'do_shell'):
3358@@ -2921,23 +3000,17 @@
3359 generate_info = self._generate_info
3360
3361 if len(generate_info.split('>')[0].strip().split())>1:
3362- ext_program = launch_ext.MELauncher(args[1], self.timeout, self,
3363- pythia=self.options['pythia-pgs_path'],
3364- delphes=self.options['delphes_path'],
3365+ ext_program = launch_ext.MELauncher(args[1], self,
3366 shell = hasattr(self, 'do_shell'),
3367 **options)
3368 else:
3369 # This is a width computation
3370- ext_program = launch_ext.MELauncher(args[1], self.timeout, self,
3371- unit='GeV',
3372- pythia=self.options['pythia-pgs_path'],
3373- delphes=self.options['delphes_path'],
3374+ ext_program = launch_ext.MELauncher(args[1], self, unit='GeV',
3375 shell = hasattr(self, 'do_shell'),
3376 **options)
3377
3378 elif args[0] == 'pythia8':
3379- ext_program = launch_ext.Pythia8Launcher( args[1], self.timeout, self,
3380- **options)
3381+ ext_program = launch_ext.Pythia8Launcher( args[1], self, **options)
3382 else:
3383 os.chdir(start_cwd) #ensure to go to the initial path
3384 raise self.InvalidCmd , '%s cannot be run from MG5 interface' % args[0]
3385@@ -3092,11 +3165,8 @@
3386 self.options['fortran_compiler'] = args[1]
3387 else:
3388 self.options['fortran_compiler'] = None
3389- elif args[0] in self.options:
3390- if args[1] in ['None','True', 'False']:
3391- self.options[args[0]] = eval(args[1])
3392- else:
3393- self.options[args[0]] = args[1]
3394+ elif args[0] == 'timeout':
3395+ self.options[args[0]] = int(args[1])
3396 elif args[0] in self.options:
3397 if args[1] in ['None','True','False']:
3398 self.options[args[0]] = eval(args[1])
3399@@ -3134,16 +3204,54 @@
3400 main_file_name = args[args.index('-name') + 1]
3401 except:
3402 pass
3403-
3404+
3405+ ################
3406+ # ALOHA OUTPUT #
3407+ ################
3408+ if self._export_format == 'aloha':
3409+ # catch format
3410+ format = [d[9:] for d in args if d.startswith('--format=')]
3411+ if not format:
3412+ format = 'Fortran'
3413+ else:
3414+ format = format[-1]
3415+ # catch output dir
3416+ output = [d for d in args if d.startswith('--output=')]
3417+ if not output:
3418+ output = import_ufo.find_ufo_path(self._curr_model['name'])
3419+ output = pjoin(output, format)
3420+ if not os.path.isdir(output):
3421+ os.mkdir(output)
3422+ else:
3423+ output = output[-1]
3424+ if not os.path.isdir(output):
3425+ raise self.InvalidCmd('%s is not a valid directory' % output)
3426+ logger.info('creating routines in directory %s ' % output)
3427+ # build the calling list for aloha
3428+ names = [d for d in args if not d.startswith('-')]
3429+ wanted_lorentz = aloha_fct.guess_routine_from_name(names)
3430+ # Create and write ALOHA Routine
3431+ aloha_model = create_aloha.AbstractALOHAModel(self._curr_model.get('name'))
3432+ if wanted_lorentz:
3433+ aloha_model.compute_subset(wanted_lorentz)
3434+ else:
3435+ aloha_model.compute_all(save=False)
3436+ aloha_model.write(output, format)
3437+ return
3438+
3439+ #################
3440+ ## Other Output #
3441+ #################
3442 if not force and not noclean and os.path.isdir(self._export_dir)\
3443 and self._export_format in ['madevent', 'standalone']:
3444 # Don't ask if user already specified force or noclean
3445 logger.info('INFO: directory %s already exists.' % self._export_dir)
3446- logger.info('If you continue this directory will be cleaned')
3447- answer = self.ask('Do you want to continue?', 'y', ['y','n'],
3448- timeout=self.timeout)
3449+ logger.info('If you continue this directory will be deleted and replaced.')
3450+ answer = self.ask('Do you want to continue?', 'y', ['y','n'])
3451 if answer != 'y':
3452 raise self.InvalidCmd('Stopped by user request')
3453+ else:
3454+ shutil.rmtree(self._export_dir)
3455
3456 #check if we need to group processes
3457 group_subprocesses = False
3458@@ -3434,7 +3542,7 @@
3459 elif self._export_format == 'madevent':
3460 # Create configuration file [path to executable] for madevent
3461 filename = os.path.join(self._export_dir, 'Cards', 'me5_configuration.txt')
3462- self.do_save('options %s' % filename, check=False)
3463+ self.do_save('options %s' % filename.replace(' ', '\ '), check=False)
3464
3465 if self._export_format in ['madevent', 'standalone']:
3466
3467
3468=== modified file 'madgraph/interface/master_interface.py'
3469--- madgraph/interface/master_interface.py 2012-03-08 23:53:29 +0000
3470+++ madgraph/interface/master_interface.py 2012-05-16 15:22:19 +0000
3471@@ -38,6 +38,7 @@
3472 import madgraph
3473 import madgraph.interface.extended_cmd as cmd
3474 import madgraph.interface.madgraph_interface as MGcmd
3475+import madgraph.iolibs.files as files
3476 import madgraph.interface.Loop_interface as LoopCmd
3477
3478 from madgraph import MG4DIR, MG5DIR, MadGraph5Error
3479@@ -393,6 +394,8 @@
3480 #standard initialization
3481 Switcher.__init__(self, mgme_dir = '', *arg, **opt)
3482
3483+ self.options['timeout'] = 1 # time authorize to answer question [0 is no time limit]
3484+
3485 def change_principal_cmd(self, name):
3486 if name == 'MadGraph':
3487 self.cmd = MGcmd.MadGraphCmdWeb
3488@@ -440,3 +443,22 @@
3489 config_path = pjoin(os.environ['MADGRAPH_BASE'], 'mg5_configuration.txt')
3490 return Switcher.set_configuration(self, config_path=config_path)
3491
3492+
3493+ def do_save(self, line, check=True):
3494+ """Save information to file"""
3495+
3496+ if check:
3497+ self.check_save([])
3498+ raise #useless but full security
3499+
3500+ args = self.split_arg(line)
3501+ if args[0] != 'options':
3502+ Switcher.do_save(self, line,check)
3503+ else:
3504+ # put default options since
3505+ # in the web the local file is not used
3506+ # in download the default file is more usefull
3507+ files.cp(pjoin(MG5DIR,'input','mg5_configuration.txt'), args[1])
3508+
3509+
3510+
3511
3512=== modified file 'madgraph/iolibs/export_cpp.py'
3513--- madgraph/iolibs/export_cpp.py 2012-02-17 06:01:41 +0000
3514+++ madgraph/iolibs/export_cpp.py 2012-05-16 15:22:19 +0000
3515@@ -1195,12 +1195,11 @@
3516
3517 for schannel in schannels:
3518 sid = schannel.get('legs')[-1].get('id')
3519- try:
3520+ part = self.model.get_particle(sid)
3521+ if part:
3522 width = self.model.get_particle(sid).get('width')
3523 if width.lower() != 'zero':
3524 resonances.append(sid)
3525- except KeyError:
3526- pass
3527 resonance_set = set(resonances)
3528
3529 singleres = 0
3530
3531=== modified file 'madgraph/iolibs/export_v4.py'
3532--- madgraph/iolibs/export_v4.py 2012-03-06 03:20:37 +0000
3533+++ madgraph/iolibs/export_v4.py 2012-05-16 15:22:19 +0000
3534@@ -1380,7 +1380,12 @@
3535 logger.info("Generate jpeg diagrams")
3536 for Pdir in P_dir_list:
3537 os.chdir(Pdir)
3538- subprocess.call([os.path.join(old_pos, self.dir_path, 'bin', 'internal', 'gen_jpeg-pl')],
3539+ try:
3540+ subprocess.call([os.path.join(old_pos, self.dir_path, 'bin', 'internal', 'gen_jpeg-pl')],
3541+ stdout = devnull)
3542+ except:
3543+ os.system('chmod +x %s ' % os.path.join(old_pos, self.dir_path, 'bin', 'internal', '*'))
3544+ subprocess.call([os.path.join(old_pos, self.dir_path, 'bin', 'internal', 'gen_jpeg-pl')],
3545 stdout = devnull)
3546 os.chdir(os.path.pardir)
3547
3548@@ -2843,11 +2848,14 @@
3549
3550 # MG4 use G and not aS as it basic object for alphas related computation
3551 #Pass G in the independant list
3552- index = self.params_dep.index('G')
3553- self.params_indep.insert(0, self.params_dep.pop(index))
3554- index = self.params_dep.index('sqrt__aS')
3555- self.params_indep.insert(0, self.params_dep.pop(index))
3556-
3557+ if 'G' in self.params_dep:
3558+ index = self.params_dep.index('G')
3559+ G = self.params_dep.pop(index)
3560+ # G.expr = '2*cmath.sqrt(as*pi)'
3561+ # self.params_indep.insert(0, self.params_dep.pop(index))
3562+ # No need to add it if not defined
3563+
3564+
3565 def build(self, wanted_couplings = [], full=True):
3566 """modify the couplings to fit with MG4 convention and creates all the
3567 different files"""
3568@@ -2987,7 +2995,7 @@
3569 already_def.add(particle.get('mass').lower())
3570 already_def.add(particle.get('width').lower())
3571
3572- is_valid = lambda name: name!='G' and name.lower() not in already_def
3573+ is_valid = lambda name: name !='G' and name.lower() not in already_def
3574
3575 real_parameters = [param.name for param in self.params_dep +
3576 self.params_indep if param.type == 'real'
3577@@ -3017,7 +3025,7 @@
3578 fsock.write_comments(\
3579 "Parameters that should not be recomputed event by event.\n")
3580 fsock.writelines("if(readlha) then\n")
3581-
3582+ fsock.writelines("G = 2 * DSQRT(AS*PI) ! for the first init\n")
3583 for param in self.params_indep:
3584 if param.name == 'ZERO':
3585 continue
3586@@ -3027,6 +3035,7 @@
3587 fsock.writelines('endif')
3588
3589 fsock.write_comments('\nParameters that should be recomputed at an event by even basis.\n')
3590+ fsock.writelines("aS = G**2/4/pi\n")
3591 for param in self.params_dep:
3592 fsock.writelines("%s = %s\n" % (param.name,
3593 self.p_to_f.parse(param.expr)))
3594
3595=== modified file 'madgraph/iolibs/group_subprocs.py'
3596--- madgraph/iolibs/group_subprocs.py 2012-02-17 06:01:41 +0000
3597+++ madgraph/iolibs/group_subprocs.py 2012-05-16 15:22:19 +0000
3598@@ -258,7 +258,13 @@
3599 def get_num_configs(self):
3600 """Get number of configs for this group"""
3601
3602- return len(self.get('mapping_diagrams'))
3603+ model = self.get('matrix_elements')[0].get('processes')[0].\
3604+ get('model')
3605+
3606+ next, nini = self.get_nexternal_ninitial()
3607+
3608+ return sum([md.get_num_configs(model, nini) for md in
3609+ self.get('mapping_diagrams')])
3610
3611 def find_mapping_diagrams(self):
3612 """Find all unique diagrams for all processes in this
3613@@ -514,6 +520,7 @@
3614 for me in matrix_elements:
3615 group_assignment = self.assign_group_to_decay_process(\
3616 me.get('processes')[0])
3617+ assert group_assignment
3618 try:
3619 me_assignments[group_assignment].append(me)
3620 except KeyError:
3621@@ -550,24 +557,23 @@
3622 for decay in process.get('decay_chains'):
3623 # Find decay group that has this decay in it
3624 ids = [l.get('id') for l in decay.get('legs')]
3625- decay_group = [(i, group) for (i, group) in \
3626+ decay_groups = [(i, group) for (i, group) in \
3627 enumerate(self.get('decay_groups')) \
3628 if any([ids in [[l.get('id') for l in \
3629 a.get('process').get('legs')] \
3630 for a in g.get('amplitudes')] \
3631 for g in group.get('core_groups')])]
3632
3633- assert len(decay_group) > 0
3634-
3635- for i in range(1,len(decay_group)):
3636- assert decay_group[i-1][1] == decay_group[i][1]
3637-
3638- decay_group = decay_group[0]
3639-
3640- group_assignment = \
3641- decay_group[1].assign_group_to_decay_process(decay)
3642-
3643- group_assignments.append((decay_group[0], group_assignment))
3644+ for decay_group in decay_groups:
3645+
3646+ group_assignment = \
3647+ decay_group[1].assign_group_to_decay_process(decay)
3648+
3649+ if group_assignment:
3650+ group_assignments.append((decay_group[0], group_assignment))
3651+
3652+ if process.get('decay_chains') and not group_assignments:
3653+ return None
3654
3655 # Now calculate the corresponding properties for process
3656
3657@@ -578,6 +584,10 @@
3658 if ids in [[l.get('id') for l in \
3659 a.get('process').get('legs')] \
3660 for a in group.get('amplitudes')]]
3661+
3662+ if not core_group:
3663+ return None
3664+
3665 assert len(core_group) == 1
3666
3667 core_group = core_group[0]
3668
3669=== modified file 'madgraph/iolibs/helas_call_writers.py'
3670--- madgraph/iolibs/helas_call_writers.py 2012-01-31 16:28:22 +0000
3671+++ madgraph/iolibs/helas_call_writers.py 2012-05-16 15:22:19 +0000
3672@@ -925,10 +925,7 @@
3673
3674 # Check if we need to append a charge conjugation flag
3675 l = [str(l) for l in argument.get('lorentz')]
3676- flag = []
3677- if argument.needs_hermitian_conjugate():
3678- flag = ['C%d' % i for i in \
3679- argument.get_conjugate_index()]
3680+ flag = ['C%d' % i for i in argument.get('conjugate_indices')]
3681 routine_name = aloha_writers.combine_name(
3682 '%s' % l[0], l[1:], outgoing, flag)
3683 call = 'CALL %s' % (routine_name)
3684@@ -1062,10 +1059,7 @@
3685
3686 # Check if we need to append a charge conjugation flag
3687 l = [str(l) for l in argument.get('lorentz')]
3688- flag = []
3689- if argument.needs_hermitian_conjugate():
3690- flag = ['C%d' % i for i in \
3691- argument.get_conjugate_index()]
3692+ flag = ['C%d' % i for i in argument.get('conjugate_indices')]
3693 routine_name = aloha_writers.combine_name(
3694 '%s' % l[0], l[1:], outgoing, flag)
3695 call = '%s' % (routine_name)
3696@@ -1237,9 +1231,7 @@
3697
3698 # Check if we need to append a charge conjugation flag
3699 l = [str(l) for l in argument.get('lorentz')]
3700- flag = []
3701- if argument.needs_hermitian_conjugate():
3702- flag = ['C%d' % i for i in argument.get_conjugate_index()]
3703+ flag = ['C%d' % i for i in argument.get('conjugate_indices')]
3704 routine_name = aloha_writers.combine_name(
3705 '%s' % l[0], l[1:], outgoing, flag)
3706
3707
3708=== modified file 'madgraph/iolibs/template_files/madevent_combine_events.f'
3709--- madgraph/iolibs/template_files/madevent_combine_events.f 2012-03-06 03:20:37 +0000
3710+++ madgraph/iolibs/template_files/madevent_combine_events.f 2012-05-16 15:22:19 +0000
3711@@ -10,7 +10,7 @@
3712 integer maxsubprocesses
3713 parameter (maxsubprocesses=9999)
3714 integer cmax_events
3715- parameter (cmax_events=500000)
3716+ parameter (cmax_events=5000000)
3717 integer sfnum
3718 parameter (sfnum=17) !Unit number for scratch file
3719 include 'maxparticles.inc'
3720
3721=== modified file 'madgraph/iolibs/template_files/matrix_madevent_group_v4.inc'
3722--- madgraph/iolibs/template_files/matrix_madevent_group_v4.inc 2011-05-30 17:37:49 +0000
3723+++ madgraph/iolibs/template_files/matrix_madevent_group_v4.inc 2012-05-16 15:22:19 +0000
3724@@ -117,7 +117,7 @@
3725 GOODHEL(I,IMIRROR)=.TRUE.
3726 NGOOD(IMIRROR) = NGOOD(IMIRROR) +1
3727 IGOOD(NGOOD(IMIRROR),IMIRROR) = I
3728- PRINT *,'Added good helicity ',I,TS(I)*NCOMB/ANS
3729+ PRINT *,'Added good helicity ',I,TS(I)*NCOMB/ANS,' in event ',NTRY(IMIRROR)
3730 ENDIF
3731 ENDDO
3732 ENDIF
3733
3734=== modified file 'madgraph/various/banner.py'
3735--- madgraph/various/banner.py 2012-02-24 16:52:39 +0000
3736+++ madgraph/various/banner.py 2012-05-16 15:22:19 +0000
3737@@ -104,6 +104,14 @@
3738 new_seed_str = " %s = iseed" % seed
3739 self['mgruncard'] = p.sub(new_seed_str, self['mgruncard'])
3740
3741+ def add_generation_info(self, cross, nb_event):
3742+ """add info on MGGeneration"""
3743+
3744+ text = """
3745+# Number of Events : %s
3746+# Integrated weight (pb) : %s
3747+""" % (nb_event, cross)
3748+ self['MGGenerationInfo'] = text
3749
3750 ############################################################################
3751 # SPLIT BANNER
3752
3753=== modified file 'madgraph/various/cluster.py'
3754--- madgraph/various/cluster.py 2012-03-06 20:10:09 +0000
3755+++ madgraph/various/cluster.py 2012-05-16 15:22:19 +0000
3756@@ -28,8 +28,10 @@
3757 class ClusterManagmentError(MadGraph5Error):
3758 pass
3759
3760+class NotImplemented(MadGraph5Error):
3761+ pass
3762
3763-def multiple_try(nb_try=5, sleep=1):
3764+def multiple_try(nb_try=5, sleep=20):
3765
3766 def deco_retry(f):
3767 def deco_f_retry(*args, **opt):
3768@@ -39,7 +41,7 @@
3769 except KeyboardInterrupt:
3770 raise
3771 except:
3772- time.sleep(sleep)
3773+ time.sleep(sleep * (i+1))
3774 raise
3775 return deco_f_retry
3776 return deco_retry
3777@@ -56,7 +58,6 @@
3778 return deco_f_interupt
3779 return deco_interupt
3780
3781-
3782 class Cluster(object):
3783 """Basic Class for all cluster type submission"""
3784 name = 'mother class'
3785@@ -105,6 +106,7 @@
3786 if fail:
3787 raise ClusterManagmentError('Some Jobs are in a Hold/... state. Please try to investigate or contact the IT team')
3788 if idle + run == 0:
3789+ time.sleep(20) #security to ensure that the file are really written on the disk
3790 logger.info('All jobs finished')
3791 break
3792 fct(idle, run, finish)
3793@@ -116,13 +118,38 @@
3794 def launch_and_wait(self, prog, argument=[], cwd=None, stdout=None,
3795 stderr=None, log=None):
3796 """launch one job on the cluster and wait for it"""
3797+
3798+ special_output = False # tag for concatanate the error with the output.
3799+ if stderr == -2 and stdout:
3800+ #We are suppose to send the output to stdout
3801+ special_output = True
3802+ stderr = stdout + '.err'
3803 id = self.submit(prog, argument, cwd, stdout, stderr, log)
3804 while 1:
3805 status = self.control_one_job(id)
3806 if not status in ['R','I']:
3807+ time.sleep(20) #security to ensure that the file are really written on the disk
3808 break
3809 time.sleep(30)
3810-
3811+
3812+ if special_output:
3813+ # combine the stdout and the stderr
3814+ #wait up to 50 s to see if those files exists
3815+ for i in range(5):
3816+ if os.path.exists(stdout):
3817+ if not os.path.exists(stderr):
3818+ time.sleep(5)
3819+ if os.path.exists(stderr):
3820+ err_text = open(stderr).read()
3821+ if not err_text:
3822+ return
3823+ logger.warning(err_text)
3824+ text = open(stdout).read()
3825+ open(stdout,'w').write(text + err_text)
3826+ else:
3827+ return
3828+ time.sleep(10)
3829+
3830 def remove(self, *args):
3831 """ """
3832 logger.warning("""This cluster didn't support job removal,
3833@@ -195,7 +222,12 @@
3834 def control_one_job(self, id):
3835 """ control the status of a single job with it's cluster id """
3836 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))))))))\'"
3837- status = subprocess.Popen([cmd], shell=True, stdout=subprocess.PIPE)
3838+ status = subprocess.Popen([cmd], shell=True, stdout=subprocess.PIPE,
3839+ stderr=subprocess.PIPE)
3840+ if status.returncode:
3841+ raise ClusterManagmentError, 'condor_q returns error: %s' % \
3842+ status.stderr.read()
3843+
3844 return status.stdout.readline().strip()
3845
3846 @check_interupt()
3847@@ -207,16 +239,22 @@
3848 return 0, 0, 0, 0
3849
3850 cmd = "condor_q " + ' '.join(self.submitted_ids) + " -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))))))))\'"
3851- status = subprocess.Popen([cmd], shell=True, stdout=subprocess.PIPE)
3852+ status = subprocess.Popen([cmd], shell=True, stdout=subprocess.PIPE,
3853+ stderr=subprocess.PIPE)
3854
3855+ if status.returncode:
3856+ raise ClusterManagmentError, 'condor_q returns error: %s' % \
3857+ status.stderr.read()
3858+
3859+
3860 idle, run, fail = 0, 0, 0
3861 for line in status.stdout:
3862 status = line.strip()
3863- if status == 'I':
3864+ if status in ['I','U']:
3865 idle += 1
3866 elif status == 'R':
3867 run += 1
3868- else:
3869+ elif status != 'C':
3870 fail += 1
3871
3872 return idle, run, self.submitted - (idle+run+fail), fail
3873@@ -237,6 +275,7 @@
3874 name = 'pbs'
3875 idle_tag = ['Q']
3876 running_tag = ['T','E','R']
3877+ complete_tag = ['C']
3878
3879 @multiple_try()
3880 def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None):
3881@@ -321,8 +360,9 @@
3882 idle += 1
3883 elif status in self.running_tag:
3884 run += 1
3885+ elif status in self.complete_tag:
3886+ continue
3887 else:
3888- print line
3889 fail += 1
3890
3891 return idle, run, self.submitted - (idle+run+fail), fail
3892@@ -465,6 +505,7 @@
3893 fail += 1
3894
3895 return idle, run, self.submitted - (idle+run+fail), fail
3896+
3897
3898
3899 @multiple_try()
3900@@ -476,6 +517,7 @@
3901 cmd = "qdel %s" % ' '.join(self.submitted_ids)
3902 status = subprocess.Popen([cmd], shell=True, stdout=open(os.devnull,'w'))
3903
3904+
3905 class LSFCluster(Cluster):
3906 """Basic class for dealing with cluster submission"""
3907
3908@@ -595,8 +637,127 @@
3909 cmd = "bdel %s" % ' '.join(self.submitted_ids)
3910 status = subprocess.Popen([cmd], shell=True, stdout=open(os.devnull,'w'))
3911
3912+class GECluster(Cluster):
3913+ """Class for dealing with cluster submission on a GE cluster"""
3914+
3915+ name = 'ge'
3916+ idle_tag = ['qw']
3917+ running_tag = ['r']
3918+
3919+ @multiple_try()
3920+ def submit(self, prog, argument=[], cwd=None, stdout=None, stderr=None, log=None):
3921+ """Submit the prog to the cluser"""
3922+
3923+ text = ""
3924+ if cwd is None:
3925+ cwd = os.getcwd()
3926+ else:
3927+ text = " cd %s; bash " % cwd
3928+ if stdout is None:
3929+ stdout = os.path.join(cwd, "log.%s" % prog.split('/')[-1])
3930+ if stderr is None:
3931+ stderr = os.path.join(cwd, "err.%s" % prog.split('/')[-1])
3932+ elif stderr == -2: # -2 is subprocess.STDOUT
3933+ stderr = stdout
3934+ if log is None:
3935+ log = '/dev/null'
3936+
3937+ text += prog
3938+ if argument:
3939+ text += ' ' + ' '.join(argument)
3940+ text += '\n'
3941+ tmp_submit = os.path.join(cwd, 'tmp_submit')
3942+ open(tmp_submit,'w').write(text)
3943+
3944+ a = subprocess.Popen(['qsub','-o', stdout,
3945+ '-e', stderr,
3946+ tmp_submit],
3947+ stdout=subprocess.PIPE,
3948+ stderr=subprocess.STDOUT,
3949+ stdin=subprocess.PIPE, cwd=cwd)
3950+
3951+ output = a.communicate()[0]
3952+ #Your job 874511 ("test.sh") has been submitted
3953+ pat = re.compile("Your job (\d*) \(",re.MULTILINE)
3954+ try:
3955+ id = pat.search(output).groups()[0]
3956+ except:
3957+ raise ClusterManagmentError, 'fail to submit to the cluster: \n%s' \
3958+ % output
3959+ self.submitted += 1
3960+ self.submitted_ids.append(id)
3961+ return id
3962+
3963+ @multiple_try()
3964+ def control_one_job(self, id):
3965+ """ control the status of a single job with it's cluster id """
3966+ cmd = 'qstat | grep '+str(id)
3967+ status = subprocess.Popen([cmd], shell=True, stdout=subprocess.PIPE)
3968+ if not status:
3969+ return 'F'
3970+ #874516 0.00000 test.sh alwall qw 03/04/2012 22:30:35 1
3971+ pat = re.compile("^(\d+)\s+[\d\.]+\s+[\w\d\.]+\s+[\w\d\.]+\s+(\w+)\s")
3972+ stat = ''
3973+ for line in status.stdout.read().split('\n'):
3974+ if not line:
3975+ continue
3976+ line = line.strip()
3977+ try:
3978+ groups = pat.search(line).groups()
3979+ except:
3980+ raise ClusterManagmentError, 'bad syntax for stat: \n\"%s\"' % line
3981+ if groups[0] != id: continue
3982+ stat = groups[1]
3983+ if not stat:
3984+ return 'F'
3985+ if stat in self.idle_tag:
3986+ return 'I'
3987+ if stat in self.running_tag:
3988+ return 'R'
3989+
3990+ @multiple_try()
3991+ def control(self, me_dir=None):
3992+ """Check the status of job associated to directory me_dir. return (idle, run, finish, fail)"""
3993+ if not self.submitted_ids:
3994+ return 0, 0, 0, 0
3995+ idle, run, fail = 0, 0, 0
3996+ ongoing = []
3997+ for statusflag in ['p', 'r', 'sh']:
3998+ cmd = 'qstat -s %s' % statusflag
3999+ status = subprocess.Popen([cmd], shell=True, stdout=subprocess.PIPE)
4000+ #874516 0.00000 test.sh alwall qw 03/04/2012 22:30:35 1
4001+ pat = re.compile("^(\d+)")
4002+ for line in status.stdout.read().split('\n'):
4003+ line = line.strip()
4004+ try:
4005+ id = pat.search(line).groups()[0]
4006+ except:
4007+ pass
4008+ else:
4009+ if id not in self.submitted_ids:
4010+ continue
4011+ ongoing.append(id)
4012+ if statusflag == 'p':
4013+ idle += 1
4014+ if statusflag == 'r':
4015+ run += 1
4016+ if statusflag == 'sh':
4017+ fail += 1
4018+
4019+ self.submitted_ids = ongoing
4020+
4021+ return idle, run, self.submitted - idle - run - fail, fail
4022+
4023+ @multiple_try()
4024+ def remove(self, *args):
4025+ """Clean the jobs on the cluster"""
4026+
4027+ if not self.submitted_ids:
4028+ return
4029+ cmd = "qdel %s" % ' '.join(self.submitted_ids)
4030+ status = subprocess.Popen([cmd], shell=True, stdout=open(os.devnull,'w'))
4031+
4032 from_name = {'condor':CondorCluster, 'pbs': PBSCluster, 'sge': SGECluster,
4033- 'lsf': LSFCluster}
4034-
4035-
4036-
4037+ 'lsf': LSFCluster, 'ge':GECluster}
4038+
4039+
4040
4041=== modified file 'madgraph/various/gen_crossxhtml.py'
4042--- madgraph/various/gen_crossxhtml.py 2012-03-06 03:20:37 +0000
4043+++ madgraph/various/gen_crossxhtml.py 2012-05-16 15:22:19 +0000
4044@@ -227,8 +227,13 @@
4045 if makehtml:
4046 self.output()
4047
4048- def resetall(self):
4049- """check the output status of all run"""
4050+ def resetall(self, main_path=None):
4051+ """check the output status of all run
4052+ main_path redefines the path associated to the run (allowing to move
4053+ the directory)
4054+ """
4055+
4056+ self.path = main_path
4057
4058 for key,run in self.items():
4059 if key == 'web':
4060@@ -236,6 +241,7 @@
4061 for i,subrun in enumerate(run):
4062 self.def_current(subrun)
4063 self.clean()
4064+ self.current.event_path = pjoin(main_path,'Events')
4065 if i==0:
4066 self.current.update_status()
4067 else:
4068@@ -278,7 +284,12 @@
4069
4070 def add_detail(self, name, value, run=None, tag=None):
4071 """ add information to current run (cross/error/event)"""
4072- assert name in ['cross', 'error', 'nb_event', 'cross_pythia']
4073+ assert name in ['cross', 'error', 'nb_event', 'cross_pythia',
4074+ 'nb_event_pythia','error_pythia']
4075+
4076+ if not run and not self.current:
4077+ return
4078+
4079 if not run:
4080 run = self.current
4081 else:
4082@@ -288,6 +299,8 @@
4083 run['cross_pythia'] = float(value)
4084 elif name == 'nb_event':
4085 run[name] = int(value)
4086+ elif name == 'nb_event_pythia':
4087+ run[name] = int(value)
4088 else:
4089 run[name] = float(value)
4090
4091@@ -407,6 +420,13 @@
4092 except:
4093 self.web = False
4094
4095+ # check if more than one parton output
4096+ parton = [r for r in self if r.parton]
4097+ # clean wrong previous run link
4098+ if len(parton)>1:
4099+ for p in parton[:-1]:
4100+ p.parton = []
4101+
4102 dico = self.info
4103 dico['run_span'] = sum([tag.get_nb_line() for tag in self], 1) -1
4104 dico['tag_data'] = '\n'.join([tag.get_html(self) for tag in self])
4105@@ -461,11 +481,10 @@
4106 output['cross'] = self[-2]['cross']
4107 output['error'] = self[-2]['error']
4108 elif (current.pgs or current.delphes) and not current['nb_event'] and len(self) > 1:
4109- if self[-2]['cross_pythia']:
4110+ if self[-2]['cross_pythia'] and self[-2]['nb_event_pythia']:
4111 output['cross'] = self[-2]['cross_pythia']
4112- output['nb_event'] = int(0.5+(self[-2]['nb_event'] * current['cross'] /self[-2]['cross']))
4113- output['error'] = current.get_pythia_error(self[-2]['cross'],
4114- self[-2]['error'], current['cross'], current['nb_event'])
4115+ output['nb_event'] = self[-2]['nb_event_pythia']
4116+ output['error'] = self[-2]['error_pythia']
4117 else:
4118 output['nb_event'] = self[-2]['nb_event']
4119 output['cross'] = self[-2]['cross']
4120@@ -510,6 +529,7 @@
4121 self['nb_event'] = 0
4122 self['cross'] = 0
4123 self['cross_pythia'] = ''
4124+ self['nb_event_pythia'] = 0
4125 self['error'] = 0
4126 self.parton = []
4127 self.pythia = []
4128@@ -634,20 +654,7 @@
4129
4130 return " <a id='%(id)s' href='%(link1)s' onClick=\"check_link('%(link1)s','%(link2)s','%(id)s')\">%(name)s</a>" \
4131 % {'link1': link1, 'link2':link2, 'id': id, 'name':name}
4132-
4133- def get_pythia_error(self, cross, error, pythia_cross, nb_event):
4134- """compute the error associate to pythie"""
4135- # pythia_cross = cross * n_acc / n_gen
4136- # error_pythia = error * n_acc /n_gen + cross * sqrt(n_acc) / n_gen
4137
4138- if cross and nb_event:
4139- n_acc = int(0.5 + pythia_cross / cross * nb_event)
4140- error_pythia = error * n_acc / nb_event
4141- error_pythia += cross * math.sqrt(n_acc) / nb_event
4142- else:
4143- error_pythia = 0
4144- return error_pythia
4145-
4146 def get_links(self, level):
4147 """ Get the links for a given level"""
4148
4149@@ -770,11 +777,10 @@
4150 pass
4151
4152 elif (self.pgs or self.delphes) and not self['nb_event']:
4153- if runresults[-2]['cross_pythia']:
4154+ if runresults[-2]['cross_pythia'] and runresults[-2]['cross']:
4155 self['cross'] = runresults[-2]['cross_pythia']
4156- self['nb_event'] = int(0.5+(runresults[-2]['nb_event'] * self['cross'] /runresults[-2]['cross']))
4157- self['error'] = self.get_pythia_error(runresults[-2]['cross'],
4158- runresults[-2]['error'], self['cross'], self['nb_event'])
4159+ self['error'] = runresults[-2]['error_pythia']
4160+ self['nb_event'] = runresults[-2]['nb_event_pythia']
4161 else:
4162 self['nb_event'] = runresults[-2]['nb_event']
4163 self['cross'] = runresults[-2]['cross']
4164@@ -803,13 +809,12 @@
4165 local_dico['cross_span'] = nb_line -1
4166 else:
4167 local_dico['cross_span'] = nb_line
4168- if self['cross']:
4169- local_dico['nb_event'] = int(0.5+(self['nb_event'] * self['cross_pythia'] /self['cross']))
4170+ if self['nb_event_pythia']:
4171+ local_dico['nb_event'] = self['nb_event_pythia']
4172 else:
4173 local_dico['nb_event'] = 0
4174 local_dico['cross'] = self['cross_pythia']
4175- local_dico['err'] = self.get_pythia_error(self['cross'],
4176- self['error'],self['cross_pythia'], self['nb_event'])
4177+ local_dico['err'] = self['error_pythia']
4178 else:
4179 local_dico['cross_span'] = nb_line
4180 local_dico['cross'] = self['cross']
4181@@ -820,16 +825,15 @@
4182 template = sub_part_template_parton
4183 if self.parton:
4184 local_dico['cross_span'] = nb_line - 1
4185- if self['cross']:
4186- local_dico['nb_event'] = int(0.5+(self['nb_event'] * self['cross_pythia'] /self['cross']))
4187+ if self['nb_event_pythia']:
4188+ local_dico['nb_event'] = self['nb_event_pythia']
4189 else:
4190 local_dico['nb_event'] = 0
4191 else:
4192 local_dico['cross_span'] = nb_line
4193 local_dico['nb_event'] = self['nb_event']
4194 local_dico['cross'] = self['cross_pythia']
4195- local_dico['err'] = self.get_pythia_error(self['cross'],
4196- self['error'],self['cross_pythia'], self['nb_event'])
4197+ local_dico['err'] = self['error_pythia']
4198 else:
4199 template = sub_part_template_pgs
4200
4201
4202=== modified file 'madgraph/various/misc.py'
4203--- madgraph/various/misc.py 2012-03-02 17:16:45 +0000
4204+++ madgraph/various/misc.py 2012-05-16 15:22:19 +0000
4205@@ -37,7 +37,7 @@
4206 import internal.files as files
4207
4208 logger = logging.getLogger('cmdprint.ext_program')
4209-
4210+pjoin = os.path.join
4211
4212 #===============================================================================
4213 # parse_info_str
4214@@ -194,6 +194,50 @@
4215 raise MadGraph5Error, error_text
4216 return p.returncode
4217
4218+# Control
4219+def check_system_error(value=1):
4220+ def deco_check(f):
4221+ def deco_f(arg, *args, **opt):
4222+ try:
4223+ return f(arg, *args, **opt)
4224+ except OSError, error:
4225+ if isinstance(arg, list):
4226+ prog = arg[0]
4227+ else:
4228+ prog = arg[0]
4229+
4230+ # Permission denied
4231+ if error.errno == 13:
4232+ if os.path.exists(prog):
4233+ os.system('chmod +x %s' % prog)
4234+ elif 'cwd' in opt and opt['cwd'] and \
4235+ os.path.isfile(pjoin(opt['cwd'],arg[0])):
4236+ os.system('chmod +x %s' % pjoin(opt['cwd'],arg[0]))
4237+ return f(arg, *args, **opt)
4238+ # NO such file or directory
4239+ elif error.errno == 2:
4240+ # raise a more meaningfull error message
4241+ raise Exception, '%s fails with no such file or directory' \
4242+ % arg
4243+ else:
4244+ raise
4245+ return deco_f
4246+ return deco_check
4247+
4248+
4249+@check_system_error()
4250+def call(arg, *args, **opt):
4251+ """nice way to call an external program with nice error treatment"""
4252+ return subprocess.call(arg, *args, **opt)
4253+
4254+@check_system_error()
4255+def Popen(arg, *args, **opt):
4256+ """nice way to call an external program with nice error treatment"""
4257+ return subprocess.Popen(arg, *args, **opt)
4258+
4259+
4260+
4261+
4262
4263 ################################################################################
4264 # TAIL FUNCTION
4265@@ -217,6 +261,7 @@
4266 if len(lines) >= to_read or pos == 0:
4267 return lines[-to_read:offset and -offset or None]
4268 avg_line_length *= 1.3
4269+ avg_line_length = int(avg_line_length)
4270
4271 ################################################################################
4272 # LAST LINE FUNCTION
4273@@ -226,6 +271,60 @@
4274
4275 return tail(fsock, 1)[0]
4276
4277+class BackRead(file):
4278+ """read a file returning the lines in reverse order for each call of readline()
4279+This actually just reads blocks (4096 bytes by default) of data from the end of
4280+the file and returns last line in an internal buffer."""
4281+
4282+
4283+ def readline(self):
4284+ """ readline in a backward way """
4285+
4286+ while len(self.data) == 1 and ((self.blkcount * self.blksize) < self.size):
4287+ self.blkcount = self.blkcount + 1
4288+ line = self.data[0]
4289+ try:
4290+ self.seek(-self.blksize * self.blkcount, 2) # read from end of file
4291+ self.data = (self.read(self.blksize) + line).split('\n')
4292+ except IOError: # can't seek before the beginning of the file
4293+ self.seek(0)
4294+ data = self.read(self.size - (self.blksize * (self.blkcount-1))) + line
4295+ self.data = data.split('\n')
4296+
4297+ if len(self.data) == 0:
4298+ return ""
4299+
4300+ line = self.data.pop()
4301+ return line + '\n'
4302+
4303+ def __init__(self, filepos, blksize=4096):
4304+ """initialize the internal structures"""
4305+
4306+ # get the file size
4307+ self.size = os.stat(filepos)[6]
4308+ # how big of a block to read from the file...
4309+ self.blksize = blksize
4310+ # how many blocks we've read
4311+ self.blkcount = 1
4312+ file.__init__(self, filepos, 'rb')
4313+ # if the file is smaller than the blocksize, read a block,
4314+ # otherwise, read the whole thing...
4315+ if self.size > self.blksize:
4316+ self.seek(-self.blksize * self.blkcount, 2) # read from end of file
4317+ self.data = self.read(self.blksize).split('\n')
4318+ # strip the last item if it's empty... a byproduct of the last line having
4319+ # a newline at the end of it
4320+ if not self.data[-1]:
4321+ self.data.pop()
4322+
4323+ def next(self):
4324+ line = self.readline()
4325+ if line:
4326+ return line
4327+ else:
4328+ raise StopIteration
4329+
4330+
4331
4332
4333 #
4334
4335=== modified file 'madgraph/various/sum_html.py'
4336--- madgraph/various/sum_html.py 2012-02-27 22:22:51 +0000
4337+++ madgraph/various/sum_html.py 2012-05-16 15:22:19 +0000
4338@@ -20,7 +20,10 @@
4339 logger = logging.getLogger('madevent.stdout') # -> stdout
4340
4341 pjoin = os.path.join
4342-
4343+try:
4344+ import madgraph.various.cluster as cluster
4345+except:
4346+ import internal.cluster as cluster
4347
4348 class OneResult(object):
4349
4350@@ -41,6 +44,7 @@
4351 self.yerr_iter = []
4352 return
4353
4354+ @cluster.multiple_try(nb_try=4,sleep=5)
4355 def read_results(self, filepath):
4356 """read results.dat and fullfill information"""
4357
4358
4359=== added directory 'models/EWdim6'
4360=== added file 'models/EWdim6/EWdim6.log'
4361--- models/EWdim6/EWdim6.log 1970-01-01 00:00:00 +0000
4362+++ models/EWdim6/EWdim6.log 2012-05-16 15:22:19 +0000
4363@@ -0,0 +1,75 @@
4364+# This file was automatically created by FeynRules $Revision: 1167 $
4365+# Mathematica version: 8.0 for Linux x86 (64-bit) (February 23, 2011)
4366+# Date: Fri 4 May 2012 16:18:13
4367+
4368+
4369+#
4370+# This is the logfile for the model EWdim6
4371+
4372+# Authors: C. Degrande
4373+# Model version: 1.0
4374+# Checking the Quantum numbers
4375+ * Electric charge defined.
4376+# Checking the Lagrangians
4377+ * All Lagrangians are ok.
4378+#
4379+# Particle definitions
4380+#
4381+
4382+ * No particles removed. All particles correspond to GenInt setup.
4383+
4384+# Automatically assigned PDG numbers
4385+ * Assigned PDG number 9000001 to particle ghA
4386+ * Assigned PDG number 9000002 to particle ghZ
4387+ * Assigned PDG number 9000003 to particle ghWp
4388+ * Assigned PDG number 9000004 to particle ghWm
4389+ * Assigned PDG number 9000005 to particle ghG
4390+
4391+
4392+# Compulsory PDG codes:
4393+ * Class SM leptons complete.
4394+ * Class SM neutrinos complete.
4395+ * Class SM quarks complete.
4396+ * Class SM gauge bosons complete.
4397+#
4398+# Parameter definitions
4399+#
4400+
4401+ * All parameters are ok.
4402+
4403+
4404+# Vertices
4405+ * Calling FeynmanRules for 1 Lagrangians.
4406+ * Number of classes vertices: 70
4407+ * Number of flavored vertices: 138
4408+ * Saved vertices in InterfaceRun[ 1 ].
4409+ * Checked QNumber conservation.
4410+ - Quantum number GhostNumber conserved in all vertices.
4411+ - Quantum number LeptonNumber conserved in all vertices.
4412+ - Quantum number Q conserved in all vertices.
4413+ * particles.py written.
4414+ * parameters.py written.
4415+#
4416+# Vertex definitions
4417+#
4418+
4419+ * 138 vertices written.
4420+ * vertices.py written.
4421+#
4422+# Lorentz structure definitions
4423+#
4424+
4425+ * 81 lorentz structures written.
4426+ * lorentz.py written.
4427+#
4428+# Coupling definitions
4429+#
4430+
4431+ * 161 couplings written.
4432+ * couplings.py written.
4433+#
4434+# Coupling order definitions
4435+#
4436+
4437+ * 0 couplings orders written.
4438+ * coupling_orders.py written.
4439
4440=== added file 'models/EWdim6/__init__.py'
4441--- models/EWdim6/__init__.py 1970-01-01 00:00:00 +0000
4442+++ models/EWdim6/__init__.py 2012-05-16 15:22:19 +0000
4443@@ -0,0 +1,22 @@
4444+
4445+import particles
4446+import couplings
4447+import lorentz
4448+import parameters
4449+import vertices
4450+import coupling_orders
4451+import write_param_card
4452+
4453+
4454+all_particles = particles.all_particles
4455+all_vertices = vertices.all_vertices
4456+all_couplings = couplings.all_couplings
4457+all_lorentz = lorentz.all_lorentz
4458+all_parameters = parameters.all_parameters
4459+all_orders = coupling_orders.all_orders
4460+all_functions = function_library.all_functions
4461+
4462+
4463+__author__ = "C. Degrande"
4464+__version__ = "1.0"
4465+__email__ = "celine.degrande@uclouvain.be"
4466
4467=== added file 'models/EWdim6/coupling_orders.py'
4468--- models/EWdim6/coupling_orders.py 1970-01-01 00:00:00 +0000
4469+++ models/EWdim6/coupling_orders.py 2012-05-16 15:22:19 +0000
4470@@ -0,0 +1,20 @@
4471+# This file was automatically created by FeynRules $Revision: 1167 $
4472+# Mathematica version: 8.0 for Linux x86 (64-bit) (February 23, 2011)
4473+# Date: Fri 4 May 2012 16:30:01
4474+
4475+
4476+from object_library import all_orders, CouplingOrder
4477+
4478+
4479+NP = CouplingOrder(name = 'NP',
4480+ expansion_order = 2,
4481+ hierarchy = 1)
4482+
4483+QCD = CouplingOrder(name = 'QCD',
4484+ expansion_order = 99,
4485+ hierarchy = 1)
4486+
4487+QED = CouplingOrder(name = 'QED',
4488+ expansion_order = 99,
4489+ hierarchy = 2)
4490+
4491
4492=== added file 'models/EWdim6/couplings.py'
4493--- models/EWdim6/couplings.py 1970-01-01 00:00:00 +0000
4494+++ models/EWdim6/couplings.py 2012-05-16 15:22:19 +0000
4495@@ -0,0 +1,655 @@
4496+# This file was automatically created by FeynRules $Revision: 1167 $
4497+# Mathematica version: 8.0 for Linux x86 (64-bit) (February 23, 2011)
4498+# Date: Fri 4 May 2012 16:30:01
4499+
4500+
4501+from object_library import all_couplings, Coupling
4502+
4503+from function_library import complexconjugate, re, im, csc, sec, acsc, asec
4504+
4505+
4506+
4507+GC_1 = Coupling(name = 'GC_1',
4508+ value = '-(ee*complex(0,1))/3.',
4509+ order = {'QED':1})
4510+
4511+GC_2 = Coupling(name = 'GC_2',
4512+ value = '(2*ee*complex(0,1))/3.',
4513+ order = {'QED':1})
4514+
4515+GC_3 = Coupling(name = 'GC_3',
4516+ value = '-(ee*complex(0,1))',
4517+ order = {'QED':1})
4518+
4519+GC_4 = Coupling(name = 'GC_4',
4520+ value = '-G',
4521+ order = {'QCD':1})
4522+
4523+GC_5 = Coupling(name = 'GC_5',
4524+ value = 'complex(0,1)*G',
4525+ order = {'QCD':1})
4526+
4527+GC_6 = Coupling(name = 'GC_6',
4528+ value = 'complex(0,1)*G**2',
4529+ order = {'QCD':2})
4530+
4531+GC_7 = Coupling(name = 'GC_7',
4532+ value = 'cw*complex(0,1)*gw',
4533+ order = {'QED':1})
4534+
4535+GC_8 = Coupling(name = 'GC_8',
4536+ value = '-(complex(0,1)*gw**2)',
4537+ order = {'QED':2})
4538+
4539+GC_9 = Coupling(name = 'GC_9',
4540+ value = 'cw**2*complex(0,1)*gw**2',
4541+ order = {'QED':2})
4542+
4543+GC_10 = Coupling(name = 'GC_10',
4544+ value = '-6*complex(0,1)*lam',
4545+ order = {'QED':2})
4546+
4547+GC_11 = Coupling(name = 'GC_11',
4548+ value = '(C3phiq*complex(0,1)*gw*cmath.sqrt(2))/Lambda**2',
4549+ order = {'NP':2,'QED':2})
4550+
4551+GC_12 = Coupling(name = 'GC_12',
4552+ value = '(CPW*cw*complex(0,1)*gw)/(2.*Lambda**2)',
4553+ order = {'NP':2})
4554+
4555+GC_13 = Coupling(name = 'GC_13',
4556+ value = '-(CPW*cw**2*complex(0,1)*g1*gw)/(2.*Lambda**2)',
4557+ order = {'NP':2,'QED':1})
4558+
4559+GC_14 = Coupling(name = 'GC_14',
4560+ value = '-(CPW*complex(0,1)*gw**2)/(2.*Lambda**2)',
4561+ order = {'NP':2,'QED':1})
4562+
4563+GC_15 = Coupling(name = 'GC_15',
4564+ value = '(CPW*cw*complex(0,1)*g1*gw**2)/(2.*Lambda**2)',
4565+ order = {'NP':2,'QED':2})
4566+
4567+GC_16 = Coupling(name = 'GC_16',
4568+ value = '-(CPW*cw*complex(0,1)*gw**3)/(2.*Lambda**2)',
4569+ order = {'NP':2,'QED':2})
4570+
4571+GC_17 = Coupling(name = 'GC_17',
4572+ value = '(CPW*cw*complex(0,1)*gw**3)/(2.*Lambda**2)',
4573+ order = {'NP':2,'QED':2})
4574+
4575+GC_18 = Coupling(name = 'GC_18',
4576+ value = '(3*cw*CWWW*complex(0,1)*gw**3)/(2.*Lambda**2)',
4577+ order = {'NP':2})
4578+
4579+GC_19 = Coupling(name = 'GC_19',
4580+ value = '-((CPW*complex(0,1)*gw**4)/Lambda**2)',
4581+ order = {'NP':2,'QED':3})
4582+
4583+GC_20 = Coupling(name = 'GC_20',
4584+ value = '(CPW*cw**2*complex(0,1)*gw**4)/Lambda**2',
4585+ order = {'NP':2,'QED':3})
4586+
4587+GC_21 = Coupling(name = 'GC_21',
4588+ value = '(-3*CWWW*complex(0,1)*gw**4)/(2.*Lambda**2)',
4589+ order = {'NP':2,'QED':1})
4590+
4591+GC_22 = Coupling(name = 'GC_22',
4592+ value = '(3*cw**2*CWWW*complex(0,1)*gw**4)/(2.*Lambda**2)',
4593+ order = {'NP':2,'QED':1})
4594+
4595+GC_23 = Coupling(name = 'GC_23',
4596+ value = '(-2*CPW*cw*complex(0,1)*gw**5)/Lambda**2',
4597+ order = {'NP':2,'QED':4})
4598+
4599+GC_24 = Coupling(name = 'GC_24',
4600+ value = '(-2*CPW*cw**3*complex(0,1)*gw**5)/Lambda**2',
4601+ order = {'NP':2,'QED':4})
4602+
4603+GC_25 = Coupling(name = 'GC_25',
4604+ value = '(-3*cw*CWWW*complex(0,1)*gw**5)/(2.*Lambda**2)',
4605+ order = {'NP':2,'QED':2})
4606+
4607+GC_26 = Coupling(name = 'GC_26',
4608+ value = '(-3*cw**3*CWWW*complex(0,1)*gw**5)/(2.*Lambda**2)',
4609+ order = {'NP':2,'QED':2})
4610+
4611+GC_27 = Coupling(name = 'GC_27',
4612+ value = '(6*cw**2*CWWW*complex(0,1)*gw**6)/Lambda**2',
4613+ order = {'NP':2,'QED':3})
4614+
4615+GC_28 = Coupling(name = 'GC_28',
4616+ value = '-(cw*complex(0,1)*g1*gw**2*HB)/(4.*Lambda**2)',
4617+ order = {'NP':2,'QED':2})
4618+
4619+GC_29 = Coupling(name = 'GC_29',
4620+ value = '(complex(0,1)*gw**2*HW)/(4.*Lambda**2)',
4621+ order = {'NP':2,'QED':1})
4622+
4623+GC_30 = Coupling(name = 'GC_30',
4624+ value = '-(cw*complex(0,1)*g1*gw**2*HW)/(4.*Lambda**2)',
4625+ order = {'NP':2,'QED':2})
4626+
4627+GC_31 = Coupling(name = 'GC_31',
4628+ value = '-(cw*complex(0,1)*gw**3*HW)/(4.*Lambda**2)',
4629+ order = {'NP':2,'QED':2})
4630+
4631+GC_32 = Coupling(name = 'GC_32',
4632+ value = '(complex(0,1)*gw**4*HW)/(2.*Lambda**2)',
4633+ order = {'NP':2,'QED':3})
4634+
4635+GC_33 = Coupling(name = 'GC_33',
4636+ value = '(ee**2*complex(0,1))/(2.*sw**2)',
4637+ order = {'QED':2})
4638+
4639+GC_34 = Coupling(name = 'GC_34',
4640+ value = '(ee*complex(0,1))/(sw*cmath.sqrt(2))',
4641+ order = {'QED':1})
4642+
4643+GC_35 = Coupling(name = 'GC_35',
4644+ value = '(CKM1x1*ee*complex(0,1))/(sw*cmath.sqrt(2))',
4645+ order = {'QED':1})
4646+
4647+GC_36 = Coupling(name = 'GC_36',
4648+ value = '(CKM1x2*ee*complex(0,1))/(sw*cmath.sqrt(2))',
4649+ order = {'QED':1})
4650+
4651+GC_37 = Coupling(name = 'GC_37',
4652+ value = '(CKM1x3*ee*complex(0,1))/(sw*cmath.sqrt(2))',
4653+ order = {'QED':1})
4654+
4655+GC_38 = Coupling(name = 'GC_38',
4656+ value = '(CKM2x1*ee*complex(0,1))/(sw*cmath.sqrt(2))',
4657+ order = {'QED':1})
4658+
4659+GC_39 = Coupling(name = 'GC_39',
4660+ value = '(CKM2x2*ee*complex(0,1))/(sw*cmath.sqrt(2))',
4661+ order = {'QED':1})
4662+
4663+GC_40 = Coupling(name = 'GC_40',
4664+ value = '(CKM2x3*ee*complex(0,1))/(sw*cmath.sqrt(2))',
4665+ order = {'QED':1})
4666+
4667+GC_41 = Coupling(name = 'GC_41',
4668+ value = '(CKM3x1*ee*complex(0,1))/(sw*cmath.sqrt(2))',
4669+ order = {'QED':1})
4670+
4671+GC_42 = Coupling(name = 'GC_42',
4672+ value = '(CKM3x2*ee*complex(0,1))/(sw*cmath.sqrt(2))',
4673+ order = {'QED':1})
4674+
4675+GC_43 = Coupling(name = 'GC_43',
4676+ value = '(CKM3x3*ee*complex(0,1))/(sw*cmath.sqrt(2))',
4677+ order = {'QED':1})
4678+
4679+GC_44 = Coupling(name = 'GC_44',
4680+ value = '-(cw*ee*complex(0,1))/(2.*sw)',
4681+ order = {'QED':1})
4682+
4683+GC_45 = Coupling(name = 'GC_45',
4684+ value = '(cw*ee*complex(0,1))/(2.*sw)',
4685+ order = {'QED':1})
4686+
4687+GC_46 = Coupling(name = 'GC_46',
4688+ value = '-(ee*complex(0,1)*sw)/(6.*cw)',
4689+ order = {'QED':1})
4690+
4691+GC_47 = Coupling(name = 'GC_47',
4692+ value = '(ee*complex(0,1)*sw)/(2.*cw)',
4693+ order = {'QED':1})
4694+
4695+GC_48 = Coupling(name = 'GC_48',
4696+ value = 'complex(0,1)*gw*sw',
4697+ order = {'QED':1})
4698+
4699+GC_49 = Coupling(name = 'GC_49',
4700+ value = '-2*cw*complex(0,1)*gw**2*sw',
4701+ order = {'QED':2})
4702+
4703+GC_50 = Coupling(name = 'GC_50',
4704+ value = '(CPW*complex(0,1)*gw*sw)/(2.*Lambda**2)',
4705+ order = {'NP':2})
4706+
4707+GC_51 = Coupling(name = 'GC_51',
4708+ value = '-(CPW*cw*complex(0,1)*gw**2*sw)/(2.*Lambda**2)',
4709+ order = {'NP':2,'QED':1})
4710+
4711+GC_52 = Coupling(name = 'GC_52',
4712+ value = '-(CPW*complex(0,1)*g1*gw**2*sw)/(2.*Lambda**2)',
4713+ order = {'NP':2,'QED':2})
4714+
4715+GC_53 = Coupling(name = 'GC_53',
4716+ value = '-(CPW*complex(0,1)*gw**3*sw)/(2.*Lambda**2)',
4717+ order = {'NP':2,'QED':2})
4718+
4719+GC_54 = Coupling(name = 'GC_54',
4720+ value = '(CPW*complex(0,1)*gw**3*sw)/(2.*Lambda**2)',
4721+ order = {'NP':2,'QED':2})
4722+
4723+GC_55 = Coupling(name = 'GC_55',
4724+ value = '(3*CWWW*complex(0,1)*gw**3*sw)/(2.*Lambda**2)',
4725+ order = {'NP':2})
4726+
4727+GC_56 = Coupling(name = 'GC_56',
4728+ value = '(CPW*cw*complex(0,1)*gw**4*sw)/Lambda**2',
4729+ order = {'NP':2,'QED':3})
4730+
4731+GC_57 = Coupling(name = 'GC_57',
4732+ value = '(-3*cw*CWWW*complex(0,1)*gw**4*sw)/(2.*Lambda**2)',
4733+ order = {'NP':2,'QED':1})
4734+
4735+GC_58 = Coupling(name = 'GC_58',
4736+ value = '(2*CPW*complex(0,1)*gw**5*sw)/Lambda**2',
4737+ order = {'NP':2,'QED':4})
4738+
4739+GC_59 = Coupling(name = 'GC_59',
4740+ value = '(-2*CPW*cw**2*complex(0,1)*gw**5*sw)/Lambda**2',
4741+ order = {'NP':2,'QED':4})
4742+
4743+GC_60 = Coupling(name = 'GC_60',
4744+ value = '(-3*CWWW*complex(0,1)*gw**5*sw)/(2.*Lambda**2)',
4745+ order = {'NP':2,'QED':2})
4746+
4747+GC_61 = Coupling(name = 'GC_61',
4748+ value = '(-3*cw**2*CWWW*complex(0,1)*gw**5*sw)/(2.*Lambda**2)',
4749+ order = {'NP':2,'QED':2})
4750+
4751+GC_62 = Coupling(name = 'GC_62',
4752+ value = '(6*cw*CWWW*complex(0,1)*gw**6*sw)/Lambda**2',
4753+ order = {'NP':2,'QED':3})
4754+
4755+GC_63 = Coupling(name = 'GC_63',
4756+ value = '(complex(0,1)*g1*gw**2*HB*sw)/(4.*Lambda**2)',
4757+ order = {'NP':2,'QED':2})
4758+
4759+GC_64 = Coupling(name = 'GC_64',
4760+ value = '-(complex(0,1)*g1*gw**2*HW*sw)/(4.*Lambda**2)',
4761+ order = {'NP':2,'QED':2})
4762+
4763+GC_65 = Coupling(name = 'GC_65',
4764+ value = '-(complex(0,1)*gw**3*HW*sw)/(4.*Lambda**2)',
4765+ order = {'NP':2,'QED':2})
4766+
4767+GC_66 = Coupling(name = 'GC_66',
4768+ value = 'complex(0,1)*gw**2*sw**2',
4769+ order = {'QED':2})
4770+
4771+GC_67 = Coupling(name = 'GC_67',
4772+ value = '-(CPW*complex(0,1)*g1*gw*sw**2)/(2.*Lambda**2)',
4773+ order = {'NP':2,'QED':1})
4774+
4775+GC_68 = Coupling(name = 'GC_68',
4776+ value = '(CPW*complex(0,1)*gw**4*sw**2)/Lambda**2',
4777+ order = {'NP':2,'QED':3})
4778+
4779+GC_69 = Coupling(name = 'GC_69',
4780+ value = '(3*CWWW*complex(0,1)*gw**4*sw**2)/(2.*Lambda**2)',
4781+ order = {'NP':2,'QED':1})
4782+
4783+GC_70 = Coupling(name = 'GC_70',
4784+ value = '(-2*CPW*cw*complex(0,1)*gw**5*sw**2)/Lambda**2',
4785+ order = {'NP':2,'QED':4})
4786+
4787+GC_71 = Coupling(name = 'GC_71',
4788+ value = '(-3*cw*CWWW*complex(0,1)*gw**5*sw**2)/(2.*Lambda**2)',
4789+ order = {'NP':2,'QED':2})
4790+
4791+GC_72 = Coupling(name = 'GC_72',
4792+ value = '(6*CWWW*complex(0,1)*gw**6*sw**2)/Lambda**2',
4793+ order = {'NP':2,'QED':3})
4794+
4795+GC_73 = Coupling(name = 'GC_73',
4796+ value = '(-2*CPW*complex(0,1)*gw**5*sw**3)/Lambda**2',
4797+ order = {'NP':2,'QED':4})
4798+
4799+GC_74 = Coupling(name = 'GC_74',
4800+ value = '(-3*CWWW*complex(0,1)*gw**5*sw**3)/Lambda**2',
4801+ order = {'NP':2,'QED':2})
4802+
4803+GC_75 = Coupling(name = 'GC_75',
4804+ value = '(cw*ee*complex(0,1))/(2.*sw) + (ee*complex(0,1)*sw)/(2.*cw)',
4805+ order = {'QED':1})
4806+
4807+GC_76 = Coupling(name = 'GC_76',
4808+ value = '-((C3phiq*cw*complex(0,1)*gw)/Lambda**2) - (Cphid*cw*complex(0,1)*gw)/Lambda**2 - (Cphiq*cw*complex(0,1)*gw)/Lambda**2 - (C3phiq*complex(0,1)*g1*sw)/Lambda**2 - (Cphid*complex(0,1)*g1*sw)/Lambda**2 - (Cphiq*complex(0,1)*g1*sw)/Lambda**2',
4809+ order = {'NP':2,'QED':2})
4810+
4811+GC_77 = Coupling(name = 'GC_77',
4812+ value = '(C3phiq*cw*complex(0,1)*gw)/Lambda**2 - (Cphiq*cw*complex(0,1)*gw)/Lambda**2 - (Cphiu*cw*complex(0,1)*gw)/Lambda**2 + (C3phiq*complex(0,1)*g1*sw)/Lambda**2 - (Cphiq*complex(0,1)*g1*sw)/Lambda**2 - (Cphiu*complex(0,1)*g1*sw)/Lambda**2',
4813+ order = {'NP':2,'QED':2})
4814+
4815+GC_78 = Coupling(name = 'GC_78',
4816+ value = '(C3phiq*cw*complex(0,1)*g1)/Lambda**2 + (Cphid*cw*complex(0,1)*g1)/Lambda**2 + (Cphiq*cw*complex(0,1)*g1)/Lambda**2 - (C3phiq*complex(0,1)*gw*sw)/Lambda**2 - (Cphid*complex(0,1)*gw*sw)/Lambda**2 - (Cphiq*complex(0,1)*gw*sw)/Lambda**2',
4817+ order = {'NP':2,'QED':2})
4818+
4819+GC_79 = Coupling(name = 'GC_79',
4820+ value = '-((C3phiq*cw*complex(0,1)*g1)/Lambda**2) + (Cphiq*cw*complex(0,1)*g1)/Lambda**2 + (Cphiu*cw*complex(0,1)*g1)/Lambda**2 + (C3phiq*complex(0,1)*gw*sw)/Lambda**2 - (Cphiq*complex(0,1)*gw*sw)/Lambda**2 - (Cphiu*complex(0,1)*gw*sw)/Lambda**2',
4821+ order = {'NP':2,'QED':2})
4822+
4823+GC_80 = Coupling(name = 'GC_80',
4824+ value = '-(CPW*cw**2*complex(0,1)*gw**2)/(2.*Lambda**2) - (CPW*cw*complex(0,1)*g1*gw*sw)/(2.*Lambda**2)',
4825+ order = {'NP':2,'QED':1})
4826+
4827+GC_81 = Coupling(name = 'GC_81',
4828+ value = '-(cw*complex(0,1)*g1**2*HB*sw)/(4.*Lambda**2) + (cw*complex(0,1)*gw**2*HW*sw)/(4.*Lambda**2)',
4829+ order = {'NP':2,'QED':1})
4830+
4831+GC_82 = Coupling(name = 'GC_82',
4832+ value = '-(cw**2*complex(0,1)*gw**4*HW)/(2.*Lambda**2) - (cw*complex(0,1)*g1*gw**3*HW*sw)/(2.*Lambda**2)',
4833+ order = {'NP':2,'QED':3})
4834+
4835+GC_83 = Coupling(name = 'GC_83',
4836+ value = 'ee**2*complex(0,1) + (cw**2*ee**2*complex(0,1))/(2.*sw**2) + (ee**2*complex(0,1)*sw**2)/(2.*cw**2)',
4837+ order = {'QED':2})
4838+
4839+GC_84 = Coupling(name = 'GC_84',
4840+ value = '(CPW*cw*complex(0,1)*g1*gw*sw)/(2.*Lambda**2) - (CPW*complex(0,1)*gw**2*sw**2)/(2.*Lambda**2)',
4841+ order = {'NP':2,'QED':1})
4842+
4843+GC_85 = Coupling(name = 'GC_85',
4844+ value = '(cw**2*complex(0,1)*gw**2*HW)/(4.*Lambda**2) + (cw*complex(0,1)*g1*gw*HB*sw)/(4.*Lambda**2) + (cw*complex(0,1)*g1*gw*HW*sw)/(4.*Lambda**2) + (complex(0,1)*g1**2*HB*sw**2)/(4.*Lambda**2)',
4845+ order = {'NP':2,'QED':1})
4846+
4847+GC_86 = Coupling(name = 'GC_86',
4848+ value = '-(cw**2*complex(0,1)*g1*gw*HW)/(4.*Lambda**2) + (complex(0,1)*g1*gw*HB*sw**2)/(4.*Lambda**2)',
4849+ order = {'NP':2,'QED':1})
4850+
4851+GC_87 = Coupling(name = 'GC_87',
4852+ value = '-(cw**2*complex(0,1)*g1*gw*HB)/(4.*Lambda**2) + (complex(0,1)*g1*gw*HW*sw**2)/(4.*Lambda**2)',
4853+ order = {'NP':2,'QED':1})
4854+
4855+GC_88 = Coupling(name = 'GC_88',
4856+ value = '(cw**2*complex(0,1)*g1**2*HB)/(4.*Lambda**2) - (cw*complex(0,1)*g1*gw*HB*sw)/(4.*Lambda**2) - (cw*complex(0,1)*g1*gw*HW*sw)/(4.*Lambda**2) + (complex(0,1)*gw**2*HW*sw**2)/(4.*Lambda**2)',
4857+ order = {'NP':2,'QED':1})
4858+
4859+GC_89 = Coupling(name = 'GC_89',
4860+ value = '-(cw**2*complex(0,1)*g1*gw**3*HW)/(2.*Lambda**2) + (cw*complex(0,1)*gw**4*HW*sw)/Lambda**2 + (complex(0,1)*g1*gw**3*HW*sw**2)/(2.*Lambda**2)',
4861+ order = {'NP':2,'QED':3})
4862+
4863+GC_90 = Coupling(name = 'GC_90',
4864+ value = '(cw*complex(0,1)*g1*gw**3*HW*sw)/(2.*Lambda**2) - (complex(0,1)*gw**4*HW*sw**2)/(2.*Lambda**2)',
4865+ order = {'NP':2,'QED':3})
4866+
4867+GC_91 = Coupling(name = 'GC_91',
4868+ value = '-6*complex(0,1)*lam*v',
4869+ order = {'QED':1})
4870+
4871+GC_92 = Coupling(name = 'GC_92',
4872+ value = '(C3phiq*complex(0,1)*gw*v*cmath.sqrt(2))/Lambda**2',
4873+ order = {'NP':2,'QED':1})
4874+
4875+GC_93 = Coupling(name = 'GC_93',
4876+ value = '-(CPW*cw**2*complex(0,1)*g1*gw*v)/(2.*Lambda**2)',
4877+ order = {'NP':2})
4878+
4879+GC_94 = Coupling(name = 'GC_94',
4880+ value = '-(CPW*complex(0,1)*gw**2*v)/(2.*Lambda**2)',
4881+ order = {'NP':2})
4882+
4883+GC_95 = Coupling(name = 'GC_95',
4884+ value = '(CPW*cw*complex(0,1)*g1*gw**2*v)/(2.*Lambda**2)',
4885+ order = {'NP':2,'QED':1})
4886+
4887+GC_96 = Coupling(name = 'GC_96',
4888+ value = '-(CPW*cw*complex(0,1)*gw**3*v)/(2.*Lambda**2)',
4889+ order = {'NP':2,'QED':1})
4890+
4891+GC_97 = Coupling(name = 'GC_97',
4892+ value = '-(cw*complex(0,1)*g1*gw**2*HB*v)/(4.*Lambda**2)',
4893+ order = {'NP':2,'QED':1})
4894+
4895+GC_98 = Coupling(name = 'GC_98',
4896+ value = '(complex(0,1)*gw**2*HW*v)/(4.*Lambda**2)',
4897+ order = {'NP':2})
4898+
4899+GC_99 = Coupling(name = 'GC_99',
4900+ value = '-(cw*complex(0,1)*g1*gw**2*HW*v)/(4.*Lambda**2)',
4901+ order = {'NP':2,'QED':1})
4902+
4903+GC_100 = Coupling(name = 'GC_100',
4904+ value = '-(cw*complex(0,1)*gw**3*HW*v)/(4.*Lambda**2)',
4905+ order = {'NP':2,'QED':1})
4906+
4907+GC_101 = Coupling(name = 'GC_101',
4908+ value = '(complex(0,1)*gw**4*HW*v)/(2.*Lambda**2)',
4909+ order = {'NP':2,'QED':2})
4910+
4911+GC_102 = Coupling(name = 'GC_102',
4912+ value = '(ee**2*complex(0,1)*v)/(2.*sw**2)',
4913+ order = {'QED':1})
4914+
4915+GC_103 = Coupling(name = 'GC_103',
4916+ value = '-(CPW*cw*complex(0,1)*gw**2*sw*v)/(2.*Lambda**2)',
4917+ order = {'NP':2})
4918+
4919+GC_104 = Coupling(name = 'GC_104',
4920+ value = '-(CPW*complex(0,1)*g1*gw**2*sw*v)/(2.*Lambda**2)',
4921+ order = {'NP':2,'QED':1})
4922+
4923+GC_105 = Coupling(name = 'GC_105',
4924+ value = '-(CPW*complex(0,1)*gw**3*sw*v)/(2.*Lambda**2)',
4925+ order = {'NP':2,'QED':1})
4926+
4927+GC_106 = Coupling(name = 'GC_106',
4928+ value = '(complex(0,1)*g1*gw**2*HB*sw*v)/(4.*Lambda**2)',
4929+ order = {'NP':2,'QED':1})
4930+
4931+GC_107 = Coupling(name = 'GC_107',
4932+ value = '-(complex(0,1)*g1*gw**2*HW*sw*v)/(4.*Lambda**2)',
4933+ order = {'NP':2,'QED':1})
4934+
4935+GC_108 = Coupling(name = 'GC_108',
4936+ value = '-(complex(0,1)*gw**3*HW*sw*v)/(4.*Lambda**2)',
4937+ order = {'NP':2,'QED':1})
4938+
4939+GC_109 = Coupling(name = 'GC_109',
4940+ value = '-(CPW*complex(0,1)*g1*gw*sw**2*v)/(2.*Lambda**2)',
4941+ order = {'NP':2})
4942+
4943+GC_110 = Coupling(name = 'GC_110',
4944+ value = '(C3phiq*complex(0,1)*gw*v**2)/(Lambda**2*cmath.sqrt(2))',
4945+ order = {'NP':2})
4946+
4947+GC_111 = Coupling(name = 'GC_111',
4948+ value = '(CPW*cw*complex(0,1)*g1*gw**2*v**2)/(4.*Lambda**2)',
4949+ order = {'NP':2})
4950+
4951+GC_112 = Coupling(name = 'GC_112',
4952+ value = '-(CPW*cw*complex(0,1)*gw**3*v**2)/(4.*Lambda**2)',
4953+ order = {'NP':2})
4954+
4955+GC_113 = Coupling(name = 'GC_113',
4956+ value = '-(cw*complex(0,1)*g1*gw**2*HB*v**2)/(8.*Lambda**2)',
4957+ order = {'NP':2})
4958+
4959+GC_114 = Coupling(name = 'GC_114',
4960+ value = '-(cw*complex(0,1)*g1*gw**2*HW*v**2)/(8.*Lambda**2)',
4961+ order = {'NP':2})
4962+
4963+GC_115 = Coupling(name = 'GC_115',
4964+ value = '-(cw*complex(0,1)*gw**3*HW*v**2)/(8.*Lambda**2)',
4965+ order = {'NP':2})
4966+
4967+GC_116 = Coupling(name = 'GC_116',
4968+ value = '(complex(0,1)*gw**4*HW*v**2)/(4.*Lambda**2)',
4969+ order = {'NP':2,'QED':1})
4970+
4971+GC_117 = Coupling(name = 'GC_117',
4972+ value = '-(CPW*complex(0,1)*g1*gw**2*sw*v**2)/(4.*Lambda**2)',
4973+ order = {'NP':2})
4974+
4975+GC_118 = Coupling(name = 'GC_118',
4976+ value = '-(CPW*complex(0,1)*gw**3*sw*v**2)/(4.*Lambda**2)',
4977+ order = {'NP':2})
4978+
4979+GC_119 = Coupling(name = 'GC_119',
4980+ value = '(complex(0,1)*g1*gw**2*HB*sw*v**2)/(8.*Lambda**2)',
4981+ order = {'NP':2})
4982+
4983+GC_120 = Coupling(name = 'GC_120',
4984+ value = '-(complex(0,1)*g1*gw**2*HW*sw*v**2)/(8.*Lambda**2)',
4985+ order = {'NP':2})
4986+
4987+GC_121 = Coupling(name = 'GC_121',
4988+ value = '-(complex(0,1)*gw**3*HW*sw*v**2)/(8.*Lambda**2)',
4989+ order = {'NP':2})
4990+
4991+GC_122 = Coupling(name = 'GC_122',
4992+ value = '-((C3phiq*cw*complex(0,1)*gw*v)/Lambda**2) - (Cphid*cw*complex(0,1)*gw*v)/Lambda**2 - (Cphiq*cw*complex(0,1)*gw*v)/Lambda**2 - (C3phiq*complex(0,1)*g1*sw*v)/Lambda**2 - (Cphid*complex(0,1)*g1*sw*v)/Lambda**2 - (Cphiq*complex(0,1)*g1*sw*v)/Lambda**2',
4993+ order = {'NP':2,'QED':1})
4994+
4995+GC_123 = Coupling(name = 'GC_123',
4996+ value = '(C3phiq*cw*complex(0,1)*gw*v)/Lambda**2 - (Cphiq*cw*complex(0,1)*gw*v)/Lambda**2 - (Cphiu*cw*complex(0,1)*gw*v)/Lambda**2 + (C3phiq*complex(0,1)*g1*sw*v)/Lambda**2 - (Cphiq*complex(0,1)*g1*sw*v)/Lambda**2 - (Cphiu*complex(0,1)*g1*sw*v)/Lambda**2',
4997+ order = {'NP':2,'QED':1})
4998+
4999+GC_124 = Coupling(name = 'GC_124',
5000+ value = '(C3phiq*cw*complex(0,1)*g1*v)/Lambda**2 + (Cphid*cw*complex(0,1)*g1*v)/Lambda**2 + (Cphiq*cw*complex(0,1)*g1*v)/Lambda**2 - (C3phiq*complex(0,1)*gw*sw*v)/Lambda**2 - (Cphid*complex(0,1)*gw*sw*v)/Lambda**2 - (Cphiq*complex(0,1)*gw*sw*v)/Lambda**2',
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches