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

Proposed by Olivier Mattelaer
Status: Merged
Merged at revision: 180
Proposed branch: lp:~maddevelopers/mg5amcnlo/New_cmd_structure
Merge into: lp:mg5amcnlo/lts
Diff against target: 677 lines (+507/-90)
4 files modified
bin/mg5 (+5/-6)
madgraph/interface/NLO_interface.py (+45/-0)
madgraph/interface/madgraph_interface.py (+19/-84)
madgraph/interface/master_interface.py (+438/-0)
To merge this branch: bzr merge lp:~maddevelopers/mg5amcnlo/New_cmd_structure
Reviewer Review Type Date Requested Status
marco zaro Approve
Olivier Mattelaer Approve
Valentin Hirschi Approve
Johan Alwall (community) Approve
Review via email: mp+93104@code.launchpad.net

Description of the change

Hi,

let's try to do this merge as soon as possible.

I just put below the content of the email that I just send to you.
(Only the pdf is missing here off course)

Cheers,

Olivier

Sended email:

Hi guys,

During the implementation,
I found useful to slightly change the class mapping for the class (nothing big off course)

So I attached the new class mapping:

The three first pages are the previous agreement.
The choice between 1 and 2, was supposed to be done at the extension class level.
the graph 3, was suppose to be activate if needed (so not at current stage).

The pages 4 and 5 corresponds to the pages 1/2 with the small modifications that I performed.
i.e.
1) I didn't display the Web part (that's done in pages 6)
2) MadGraphCmd inherits from Check, Help, ...
3) I add a class Switcher which contains all the
        def XXXX(self, *args, **opts)
      return self.cmd(self, *args, **opts°
    This allow
         - to easily move in the file (at least with Eclipse)
         - that the Web interface doesn't inherit from MasterCmd (which is forbidden since it can't have the shell inheritance)

The page 6 is the same but including the Web part.

The page 7 corresponds to page 3 (i.e. optional structure that we might be force to use at a point)

The page 8 is the same as 6. But with a multiple inheritance for MasterCmdWeb explicitely displayed.

Otherwise, I explicitly check -- in debug mode -- that all
do_xxx, check_xxx, ...
are present in the switcher, if this is not the case, an error is raised.
and the file containing the missing lines are written (so you just have to do a copy-paste).

In debug mode, I also check that each function/attribute is define only at a single place (but if they are present in the switcher or in one of the master).
If not an error is raised.
This should prevent a lot of problem in the future (at least I hope).

I will put the associated branch under review such that we can make the discussion on launchpad.

Cheers,

Olivier

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

Hi Olivier,
I am looking at it:

how do i scwitch from an interface to the other?

then
if i run tests/test_manager.py i get the following error...
does anybody get the same?

thanks for your efforts
Cheers
Marco

Traceback (most recent call last):
  File "./tests/test_manager.py", line 380, in <module>
    package=options.path)
  File "./tests/test_manager.py", line 70, in run
    re_opt=re_opt):
  File "./tests/test_manager.py", line 120, in __iter__
    self._check_if_obj_build()
  File "./tests/test_manager.py", line 116, in _check_if_obj_build
    self.collect_dir(self.package, checking=True)
  File "./tests/test_manager.py", line 152, in collect_dir
    self.collect_dir(directory + '/' + name, local_check)
  File "./tests/test_manager.py", line 150, in collect_dir
    self.collect_file(directory + '/' + name, local_check)
  File "./tests/test_manager.py", line 161, in collect_file
    __import__(pyname)
  File "/Users/marcozaro/PhD/mg5/new_cmd/New_cmd_structure/tests/unit_tests/interface/test_cmd.py", line 20, in <module>
    import madgraph.interface.cmd_interface as cmd
ImportError: No module named cmd_interface

On 15 Feb 2012, at 00:33, olivier mattelaer wrote:

> Olivier Mattelaer has proposed merging lp:~maddevelopers/madgraph5/New_cmd_structure into lp:madgraph5/2.0.
>
> Requested reviews:
> Rikkert Frederix (frederix)
> Johan Alwall (johan-alwall)
> Valentin Hirschi (valentin-hirschi)
> marco zaro (marco-zaro)
>
> For more details, see:
> https://code.launchpad.net/~maddevelopers/madgraph5/New_cmd_structure/+merge/93104
>
> Hi,
>
> let's try to do this merge as soon as possible.
>
> I just put below the content of the email that I just send to you.
> (Only the pdf is missing here off course)
>
> Cheers,
>
> Olivier
>
> Sended email:
>
>
> Hi guys,
>
> During the implementation,
> I found useful to slightly change the class mapping for the class (nothing big off course)
>
> So I attached the new class mapping:
>
>
>
> The three first pages are the previous agreement.
> The choice between 1 and 2, was supposed to be done at the extension class level.
> the graph 3, was suppose to be activate if needed (so not at current stage).
>
> The pages 4 and 5 corresponds to the pages 1/2 with the small modifications that I performed.
> i.e.
> 1) I didn't display the Web part (that's done in pages 6)
> 2) MadGraphCmd inherits from Check, Help, ...
> 3) I add a class Switcher which contains all the
> def XXXX(self, *args, **opts)
> return self.cmd(self, *args, **opts°
> This allow
> - to easily move in the file (at least with Eclipse)
> - that the Web interface doesn't inherit from MasterCmd (which is forbidden since it can't have the shell inheritance)
>
> The page 6 is the same but including the Web part.
>
> The page 7 corresponds to page 3 (i.e. optional structure that we might be force to use at a point)
>
> The page 8 is the same as 6. But with a multiple inheritance for MasterCmdWeb explicitely displayed.
>
> Otherwise, I explicitly check -- in debug mode -- that all
> do_xxx, check_xxx, ...
> are present in the switcher, if this is not the case, an error is raised.
> an...

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

Hi Marco,

For the moment, they are only one interface (I implement one Loop but
this is completely dummy and that's up to you and Valentin to create
it in practise.

In the file master_interface.py
you will see one command
change_principal_cmd(self, name)
where name defines which Interface will be the main one.

The Masterinterface takes also one argument in order to define it
directly.

> then
> if i run tests/test_manager.py i get the following error...
> does anybody get the same?

That's a quite critical error, just don't really understand why it was
working on my computer (maybe due to the remaining presence of
the .pyc?)

I'll fix that.

Cheers,

Olivier

On 15-févr.-12, at 03:07, marco zaro wrote:

> Hi Olivier,
> I am looking at it:
>
> how do i scwitch from an interface to the other?
>
> then
> if i run tests/test_manager.py i get the following error...
> does anybody get the same?
>
> thanks for your efforts
> Cheers
> Marco
>
>
> Traceback (most recent call last):
> File "./tests/test_manager.py", line 380, in <module>
> package=options.path)
> File "./tests/test_manager.py", line 70, in run
> re_opt=re_opt):
> File "./tests/test_manager.py", line 120, in __iter__
> self._check_if_obj_build()
> File "./tests/test_manager.py", line 116, in _check_if_obj_build
> self.collect_dir(self.package, checking=True)
> File "./tests/test_manager.py", line 152, in collect_dir
> self.collect_dir(directory + '/' + name, local_check)
> File "./tests/test_manager.py", line 150, in collect_dir
> self.collect_file(directory + '/' + name, local_check)
> File "./tests/test_manager.py", line 161, in collect_file
> __import__(pyname)
> File "/Users/marcozaro/PhD/mg5/new_cmd/New_cmd_structure/tests/
> unit_tests/interface/test_cmd.py", line 20, in <module>
> import madgraph.interface.cmd_interface as cmd
> ImportError: No module named cmd_interface
>
>
>
>
>
>
> On 15 Feb 2012, at 00:33, olivier mattelaer wrote:
>
>> Olivier Mattelaer has proposed merging lp:~maddevelopers/madgraph5/
>> New_cmd_structure into lp:madgraph5/2.0.
>>
>> Requested reviews:
>> Rikkert Frederix (frederix)
>> Johan Alwall (johan-alwall)
>> Valentin Hirschi (valentin-hirschi)
>> marco zaro (marco-zaro)
>>
>> For more details, see:
>> https://code.launchpad.net/~maddevelopers/madgraph5/
>> New_cmd_structure/+merge/93104
>>
>> Hi,
>>
>> let's try to do this merge as soon as possible.
>>
>> I just put below the content of the email that I just send to you.
>> (Only the pdf is missing here off course)
>>
>> Cheers,
>>
>> Olivier
>>
>> Sended email:
>>
>>
>> Hi guys,
>>
>> During the implementation,
>> I found useful to slightly change the class mapping for the class
>> (nothing big off course)
>>
>> So I attached the new class mapping:
>>
>>
>>
>> The three first pages are the previous agreement.
>> The choice between 1 and 2, was supposed to be done at the
>> extension class level.
>> the graph 3, was suppose to be activate if needed (so not at
>> current stage).
>>
>> The pages 4 and 5 corresponds to the pages 1/2 with the small
>> modifications that I performed.
>> i.e.
>> 1) I didn't display the Web part (that's done in pages ...

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

Hello Olivier,

I'm not sure I understand:

class MasterCmd(Switcher, NLOcmd.LoopInterface, cmd.CmdShell):
So when a command is called (using do_command), is it guaranteed that it will be the corresponding command in Switcher that is called? Also, I had expected that you simply create the referral command on-the-fly, in the same way that you now create the helping error text (but using "eval" or "exec"), rather than have a long list of defined commands in the Switcher?

Otherwise I think everything looks fine to me.

Johan

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

Oh, just one thing: Let's keep consistent between file names and command names, to avoid (a lot of) confusion: loop_interface.py is the appropriate module name since the class is called Loop...

Cheers,
Johan

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

Hi Marco, Olivier,

> For the moment, they are only one interface (I implement one Loop but
> this is completely dummy and that's up to you and Valentin to create
> it in practise.
>
> In the file master_interface.py
> you will see one command
> change_principal_cmd(self, name)
> where name defines which Interface will be the main one.
>
> The Masterinterface takes also one argument in order to define it
> directly.

At least my idea is that the implementor also defines how to switch between interfaces. In the case of the ColorOrdering, it's done when the color_ordered option is set > 0. For NLO, it might be by setting an option ("set Loop True"), when an NLO-prepared model is loaded ("import model sm-loop") or when a loop or real process is defined.

We had previously talked about defining a loop or real process by [QCD] and {QCD} respectively, but another possibility, which would be more friendly to this interface, would be to say, e.g.
set loop_order QCD
generate p p > ...
and
set real_order QCD QED
generate p p > ...
or something like that. This would make it very easy to switch between the interfaces appropriately. But I think it should be defined (in the MasterCmd class) by the person working on the interface that is being switched to.

Best,
Johan

Revision history for this message
Valentin Hirschi (valentin-hirschi) wrote :

> Hi Marco, Olivier,
>
> > For the moment, they are only one interface (I implement one Loop but
> > this is completely dummy and that's up to you and Valentin to create
> > it in practise.
> >
> > In the file master_interface.py
> > you will see one command
> > change_principal_cmd(self, name)
> > where name defines which Interface will be the main one.
> >
> > The Masterinterface takes also one argument in order to define it
> > directly.
>
> At least my idea is that the implementor also defines how to switch between
> interfaces. In the case of the ColorOrdering, it's done when the color_ordered
> option is set > 0. For NLO, it might be by setting an option ("set Loop
> True"), when an NLO-prepared model is loaded ("import model sm-loop") or when
> a loop or real process is defined.

I would say that it does so either by a 'set Loop True' as you suggest and/or whenever the user asks for a process while defining perturbation orders with the [].

> We had previously talked about defining a loop or real process by [QCD] and
> {QCD} respectively, but another possibility, which would be more friendly to
> this interface, would be to say, e.g.
> set loop_order QCD
> generate p p > ...
> and
> set real_order QCD QED
> generate p p > ...
> or something like that. This would make it very easy to switch between the
> interfaces appropriately. But I think it should be defined (in the MasterCmd
> class) by the person working on the interface that is being switched to.

I agree that the switching feature should by coded within each independent interface. However I am against defining an overall setting for the perturbation order to consider.
I believe that our philosophy is that the user specifies all the relevant information for the process along with the generate command, and I think it would be dangerous to have any perturbation order implicitly assumed because of an overall setting.
To me, this stands at the same level as 'forbidden particles' for example, that we specify for now at the time of the generating a process and not with an overall parameter setting.

Cheers,

> Best,
> Johan

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

Hi Johan,

> class MasterCmd(Switcher, NLOcmd.LoopInterface, cmd.CmdShell):
> So when a command is called (using do_command), is it guaranteed
> that it will be the corresponding command in Switcher that is called?

Let takes an example:
> class MasterCmd(Switcher, NLOcmd.LoopInterface,
> COLORcmd.ColorInterface, cmd.CmdShell):

The Rule is the following
1) it will search in MasterCmd if do_command is define
2) it will search in Switcher
3) in LoopInterface
4) in MadGraphInterface (the mother of Loop)
5) in ExtendedCmd
6) in all the mother of ExtendedCmd
7) in COLORcmd.ColorInterface
8) in CmdShell

So yes I'm sure.

> Also, I had expected that you simply create the referral command on-
> the-fly, in the same way that you now create the helping error text
> (but using "eval" or "exec"), rather than have a long list of
> defined commands in the Switcher?

I tried different things, and only one was mainly successful
(suggested by Valentin in fact).
But it looks like they are some sort of side effect which made me
nervous.
the hasattr function (as well as dir) is not working properly for
example.
So I'm worry to do something which is too border line, and therefore
which might be unstable depending of the python version/computer.

If you want, I can put this on a separate branch, such that you can
see yourself.

Cheers,

Olivier

On Feb 15, 2012, at 3:42 AM, Johan Alwall wrote:

> Hello Olivier,
>
> I'm not sure I understand:
>
> class MasterCmd(Switcher, NLOcmd.LoopInterface, cmd.CmdShell):
> So when a command is called (using do_command), is it guaranteed
> that it will be the corresponding command in Switcher that is
> called? Also, I had expected that you simply create the referral
> command on-the-fly, in the same way that you now create the helping
> error text (but using "eval" or "exec"), rather than have a long
> list of defined commands in the Switcher?
>
> Otherwise I think everything looks fine to me.
>
> Johan
> --
> https://code.launchpad.net/~maddevelopers/madgraph5/
> New_cmd_structure/+merge/93104
> Your team MadTeam is subscribed to branch lp:madgraph5/2.0.

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

In fact,

the definition on the flight loose the precedence, which is very very bad.
-> so I'm back to the point that we need to write those explicitely
(in good python: explicit is better than implicit ;-) )
Since I've some test to test if the definition are present this is not a too big problem.

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

Ok all the test are passing now (and I have remove the .pyc before ;-))
But let check it on another computer (always safer)

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

> the definition on the flight loose the precedence, which is very very bad.
> -> so I'm back to the point that we need to write those explicitely
> (in good python: explicit is better than implicit ;-) )
> Since I've some test to test if the definition are present this is not a too big problem.

Ok, sounds like good arguments to me.
Did you merge? (the status says "merged"). If not, I'm fine with this framework.

Cheers,
Johan

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

Hey Valentin,

> I agree that the switching feature should by coded within each independent interface. However I am against defining an overall setting for the perturbation order to consider.
> I believe that our philosophy is that the user specifies all the relevant information for the process along with the generate command, and I think it would be dangerous to have any perturbation order implicitly assumed because of an overall setting.
> To me, this stands at the same level as 'forbidden particles' for example, that we specify for now at the time of the generating a process and not with an overall parameter setting.

So probably the nicest is to always select an interface whenever do_generate is called rather than when a flag is set. So

- if color_ordering > 0 and no [] or {}, at do_generate the ColorOrdered interface selected
- if color_ordering == 0 and [] in the process def, select Loop interface
- if color_ordering == 0 and {} in the process def, select Real/FKS interface
- if color_ordering > 0 and [] in the process def, select ColorOrderedLoop interface
etc.

If the model doesn't support Loops, then the LoopInterface generate command returns an error, etc.
That way, the interface selection is always in the same place, and things are nice and clear.

Let me know what you think,
Johan

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

Hi Johan,

> Ok, sounds like good arguments to me.
> Did you merge? (the status says "merged"). If not, I'm fine with
> this framework.

It's not merged, but it was during ~30s due to a mistake that I
correct right away.

> I believe that our philosophy is that the user specifies all the
> relevant information for the process along with the generate
> command, and I think it would be dangerous to have any perturbation
> order implicitly assumed because of an overall setting.
> To me, this stands at the same level as 'forbidden particles' for
> example, that we specify for now at the time of the generating a
> process and not with an overall parameter setting.

To me this rather stands at the same level as 'regular' order. Where
if they are not define are assumed automaticaly.
So if the user launch the nlo_binary or explicitely launch the
LoopInterface (if this will be possible) then it will makes sense to
assume automatically [QCD]

Off course this require that the user should 'know' that he is in NLO
or standard interface and this should be reflected in the print
statement of the begin of the loop.
  (i.e. replace mg5> by mg5_nlo>)

> So probably the nicest is to always select an interface whenever
> do_generate is called rather than when a flag is set. So

I would say that we should switch as soon as we have the information.
Switching later force to re-do various command --mainly set and
import--,
which might be tricky (I don't like to have a function based on the
history).

Switching at the level of the generate command, is off course very
important.
But switching the interface before this command will help with
dedicated auto-suggestions, ...
And that this is very extension dependent. So I will simply not put a
rule on this.

> - if color_ordering > 0 and no [] or {}, at do_generate the
> ColorOrdered interface selected
> - if color_ordering == 0 and [] in the process def, select Loop
> interface
> - if color_ordering == 0 and {} in the process def, select Real/FKS
> interface
> - if color_ordering > 0 and [] in the process def, select
> ColorOrderedLoop interface
> etc.
>
> If the model doesn't support Loops, then the LoopInterface generate
> command returns an error, etc.

This should be present in any scenario, I think.

> That way, the interface selection is always in the same place, and
> things are nice and clear.

I see the points, but for MadWeight for example, I will probably need
to change the interface at the "set" level for sure.
So this nice features will be break at a point in the future for sure
to my point of view.

Cheers,

Olivier

On 15-févr.-12, at 20:58, Johan Alwall wrote:

> Review: Approve
>
>> the definition on the flight loose the precedence, which is very
>> very bad.
>> -> so I'm back to the point that we need to write those explicitely
>> (in good python: explicit is better than implicit ;-) )
>> Since I've some test to test if the definition are present this is
>> not a too big problem.
>
> Ok, sounds like good arguments to me.
> Did you merge? (the status says "merged"). If not, I'm fine with
> this framework.
>
> Cheers,
> Johan
> --
> https://...

Read more...

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

Hello Olivier,

> To me this rather stands at the same level as 'regular' order. Where
> if they are not define are assumed automaticaly.
> So if the user launch the nlo_binary or explicitely launch the
> LoopInterface (if this will be possible) then it will makes sense to
> assume automatically [QCD]

But we are planning to allow also QED and mixed orders. Furthermore, how does the user specify between FKS and Loop? These would be natural to both have access to in your "NLO" binary.

> Off course this require that the user should 'know' that he is in NLO
> or standard interface and this should be reflected in the print
> statement of the begin of the loop.
> (i.e. replace mg5> by mg5_nlo>)

This is true in either case.

> > So probably the nicest is to always select an interface whenever
> > do_generate is called rather than when a flag is set. So
>
> I would say that we should switch as soon as we have the information.
> Switching later force to re-do various command --mainly set and
> import--,
> which might be tricky (I don't like to have a function based on the
> history).

I don't see this - in fact, thanks to your excellent organization, these variables don't even need to be modified since we never change command object!

> Switching at the level of the generate command, is off course very
> important.
> But switching the interface before this command will help with
> dedicated auto-suggestions, ...
> And that this is very extension dependent. So I will simply not put a
> rule on this.

This is true, but can probably be dealt with.

> > - if color_ordering > 0 and no [] or {}, at do_generate the
> > ColorOrdered interface selected
> > - if color_ordering == 0 and [] in the process def, select Loop
> > interface
> > - if color_ordering == 0 and {} in the process def, select Real/FKS
> > interface
> > - if color_ordering > 0 and [] in the process def, select
> > ColorOrderedLoop interface
> > etc.
> >
> > If the model doesn't support Loops, then the LoopInterface generate
> > command returns an error, etc.
>
> This should be present in any scenario, I think.

Of course.

> > That way, the interface selection is always in the same place, and
> > things are nice and clear.
>
> I see the points, but for MadWeight for example, I will probably need
> to change the interface at the "set" level for sure.
> So this nice features will be break at a point in the future for sure
> to my point of view.

That is not a problem. The idea is that each developer can choose when is the most natural point to do the change. It also doesn't have to be unique - a change to a certain interface can be triggered by several different things, although I would recommend to keep it as simple and unique as possible to simplify the interface for the user).

If we don't agree, I'd suggest to simply have a vote between the four of us, and go from there, so we can quickly move on to merge the NLO branch (and modify our branches appropriately).

Cheers,
Johan

Revision history for this message
Valentin Hirschi (valentin-hirschi) wrote :

Grr I really hate this LaunchPad interface to comment on the merges request.

Anyway, I agree we should be able to switch from one interface to another simply with a 'set' command and not only dynamically depending on the type of process generated.

So then for example we could have:

set perturbation_order [QCD]

Which would trigger the switch to the loop interface and setup the default perturbation order to QCD. So that now, a process like this:

generate g g > d d~

would implicitely be at one loop in QCD. The only problem is that one loses the separation between born_orders and squared_orders if on forgets about the [QCD] part in the synthax. Any idea?

And finally, one could always switch back to the regular interface with set perturbation_order [].

To make the switching more uniform, it would be enough to have for each interface a function "Is_valid()" which checks depending on the MadGraphCmd options if the interface is appropriate or not. And then everytime an option is modified, the MasterCMD would automatically check which interface is appropriate.

Cheers

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

Hi Johan,

> But we are planning to allow also QED and mixed orders.

Sure but that makes sense to not activate those by default (like now
we takes (sort of) QED=0 at tree level)

> Furthermore, how does the user specify between FKS and Loop? These
> would be natural to both have access to in your "NLO" binary.

Sure, in fact, I have no idea of the status of FKS, never seen any
branch for a while, and the previous status is quite old to me.
The same in fact for the aMCatNLO interface, what are the exact plan
for that?

>> I would say that we should switch as soon as we have the information.
>> Switching later force to re-do various command --mainly set and
>> import--,
>> which might be tricky (I don't like to have a function based on the
>> history).
>
> I don't see this - in fact, thanks to your excellent organization,
> these variables don't even need to be modified since we never change
> command object!

Not sure that you don't need to re-import the model, but in any case,
this is fine.

> That is not a problem. The idea is that each developer can choose
> when is the most natural point to do the change. It also doesn't
> have to be unique - a change to a certain interface can be triggered
> by several different things, although I would recommend to keep it
> as simple and unique as possible to simplify the interface for the
> user).

Fully aggree with that.

Cheers,

Olivier

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

> Hello Olivier,
>
>> To me this rather stands at the same level as 'regular' order. Where
>> if they are not define are assumed automaticaly.
>> So if the user launch the nlo_binary or explicitely launch the
>> LoopInterface (if this will be possible) then it will makes sense to
>> assume automatically [QCD]
>
> But we are planning to allow also QED and mixed orders. Furthermore,
> how does the user specify between FKS and Loop? These would be
> natural to both have access to in your "NLO" binary.
>
>> Off course this require that the user should 'know' that he is in NLO
>> or standard interface and this should be reflected in the print
>> statement of the begin of the loop.
>> (i.e. replace mg5> by mg5_nlo>)
>
> This is true in either case.
>
>>> So probably the nicest is to always select an interface whenever
>>> do_generate is called rather than when a flag is set. So
>>
>> I would say that we should switch as soon as we have the information.
>> Switching later force to re-do various command --mainly set and
>> import--,
>> which might be tricky (I don't like to have a function based on the
>> history).
>
> I don't see this - in fact, thanks to your excellent organization,
> these variables don't even need to be modified since we never change
> command object!
>
>> Switching at the level of the generate command, is off course very
>> important.
>> But switching the interface before this command will help with
>> dedicated auto-suggestions, ...
>> And that this is very extension dependent. So I will simply not put a
>> rule on this.
>
> This is true, but can probably be dealt with.
>
>>> - if color_ordering > 0 and no [] or {}, at do_generate the
>>> ColorOrdered interface selecte...

Read more...

Revision history for this message
marco zaro (marco-zaro) wrote :
Download full text (5.5 KiB)

Hi,
for madfks, up to a (possible) bug in the fortran code, which we are searching, the python code + unit tests are ready, both from born and from real emission, and the two of them agree
i (still) need to think about possible parallel and acceptance tests, because the total cross-section computation are quite lenghty.
I will merge it with v 1.4 and pull on launchpad (beginning of next week), ok?
Cheers
Marco

On 16 Feb 2012, at 12:40, Olivier Mattelaer wrote:

> Hi Johan,
>
>> But we are planning to allow also QED and mixed orders.
>
> Sure but that makes sense to not activate those by default (like now
> we takes (sort of) QED=0 at tree level)
>
>> Furthermore, how does the user specify between FKS and Loop? These
>> would be natural to both have access to in your "NLO" binary.
>
> Sure, in fact, I have no idea of the status of FKS, never seen any
> branch for a while, and the previous status is quite old to me.
> The same in fact for the aMCatNLO interface, what are the exact plan
> for that?
>
>>> I would say that we should switch as soon as we have the information.
>>> Switching later force to re-do various command --mainly set and
>>> import--,
>>> which might be tricky (I don't like to have a function based on the
>>> history).
>>
>> I don't see this - in fact, thanks to your excellent organization,
>> these variables don't even need to be modified since we never change
>> command object!
>
>
> Not sure that you don't need to re-import the model, but in any case,
> this is fine.
>
>> That is not a problem. The idea is that each developer can choose
>> when is the most natural point to do the change. It also doesn't
>> have to be unique - a change to a certain interface can be triggered
>> by several different things, although I would recommend to keep it
>> as simple and unique as possible to simplify the interface for the
>> user).
>
> Fully aggree with that.
>
> Cheers,
>
> Olivier
>
>
> On 16-févr.-12, at 05:07, Johan Alwall wrote:
>
>> Hello Olivier,
>>
>>> To me this rather stands at the same level as 'regular' order. Where
>>> if they are not define are assumed automaticaly.
>>> So if the user launch the nlo_binary or explicitely launch the
>>> LoopInterface (if this will be possible) then it will makes sense to
>>> assume automatically [QCD]
>>
>> But we are planning to allow also QED and mixed orders. Furthermore,
>> how does the user specify between FKS and Loop? These would be
>> natural to both have access to in your "NLO" binary.
>>
>>> Off course this require that the user should 'know' that he is in NLO
>>> or standard interface and this should be reflected in the print
>>> statement of the begin of the loop.
>>> (i.e. replace mg5> by mg5_nlo>)
>>
>> This is true in either case.
>>
>>>> So probably the nicest is to always select an interface whenever
>>>> do_generate is called rather than when a flag is set. So
>>>
>>> I would say that we should switch as soon as we have the information.
>>> Switching later force to re-do various command --mainly set and
>>> import--,
>>> which might be tricky (I don't like to have a function based on the
>>> history).
>>
>> I don't see ...

Read more...

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

> Hi,
> for madfks, up to a (possible) bug in the fortran code, which we are
> searching, the python code + unit tests are ready, both from born and from
> real emission, and the two of them agree
> i (still) need to think about possible parallel and acceptance tests, because
> the total cross-section computation are quite lenghty.
> I will merge it with v 1.4 and pull on launchpad (beginning of next week), ok?
> Cheers
> Marco

Perfect.

Could you finalize this review first?
Should we wait for Rik?

Cheers,

Olivier

Revision history for this message
Olivier Mattelaer (olivier-mattelaer) :
review: Approve
Revision history for this message
marco zaro (marco-zaro) wrote :

ok, all tests passed now

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/mg5'
2--- bin/mg5 2011-12-14 21:52:20 +0000
3+++ bin/mg5 2012-02-14 23:32:18 +0000
4@@ -112,7 +112,7 @@
5 logging.getLogger('madgraph').setLevel(eval('logging.' + options.logging))
6 except:
7 pass
8-import madgraph.interface.cmd_interface as cmd_interface
9+import madgraph.interface.master_interface as interface
10
11 # Call the cmd interface main loop
12 try:
13@@ -123,22 +123,21 @@
14 else:
15 input_file = options.file
16 if options.web:
17- cmd_line = cmd_interface.MadGraphCmdWeb()
18+ cmd_line = interface.MasterCmdWeb()
19 cmd_line.debug_output = os.path.join(os.path.dirname(input_file),'generation.log')
20 cmd_line.use_rawinput = False
21 cmd_line.run_cmd('import command ' + input_file)
22 else:
23- cmd_line = cmd_interface.MadGraphCmdShell(mgme_dir = options.mgme_dir)
24+ cmd_line = interface.MasterCmd(mgme_dir = options.mgme_dir)
25 cmd_line.use_rawinput = False
26 cmd_line.run_cmd('import command ' + input_file)
27-
28 else:
29 # Interactive mode
30 if options.web:
31- cmd_line = cmd_interface.MadGraphCmdWeb()
32+ cmd_line = interface.MasterCmdWeb()
33 cmd_line.cmdloop()
34 else:
35- cmd_line = cmd_interface.MadGraphCmdShell(mgme_dir = options.mgme_dir)
36+ cmd_line = interface.MasterCmd(mgme_dir = options.mgme_dir)
37 cmd_line.cmdloop()
38 except KeyboardInterrupt:
39 print 'writting history and quit on KeyboardInterrupt'
40
41=== added file 'madgraph/interface/NLO_interface.py'
42--- madgraph/interface/NLO_interface.py 1970-01-01 00:00:00 +0000
43+++ madgraph/interface/NLO_interface.py 2012-02-14 23:32:18 +0000
44@@ -0,0 +1,45 @@
45+################################################################################
46+#
47+# Copyright (c) 2009 The MadGraph Development team and Contributors
48+#
49+# This file is a part of the MadGraph 5 project, an application which
50+# automatically generates Feynman diagrams and matrix elements for arbitrary
51+# high-energy processes in the Standard Model and beyond.
52+#
53+# It is subject to the MadGraph license which should accompany this
54+# distribution.
55+#
56+# For more information, please visit: http://madgraph.phys.ucl.ac.be
57+#
58+################################################################################
59+"""A user friendly command line interface to access all MadGraph features.
60+ Uses the cmd package for command interpretation and tab completion.
61+"""
62+
63+import os
64+
65+import madgraph
66+from madgraph import MG4DIR, MG5DIR, MadGraph5Error
67+import madgraph.interface.madgraph_interface as mg_interface
68+
69+#usefull shortcut
70+pjoin = os.path.join
71+
72+class CheckLoop(mg_interface.CheckValidForCmd):
73+ pass
74+
75+class CheckLoopWeb(mg_interface.CheckValidForCmdWeb, CheckLoop):
76+ pass
77+
78+class CompleteLoop(mg_interface.CompleteForCmd):
79+ pass
80+
81+class HelpLoop(mg_interface.HelpToCmd):
82+ pass
83+
84+class LoopInterface(CheckLoop, CompleteLoop, HelpLoop, mg_interface.MadGraphCmd):
85+ pass
86+
87+class LoopInterfaceWeb(mg_interface.CheckValidForCmdWeb, LoopInterface):
88+ pass
89+
90
91=== renamed file 'madgraph/interface/cmd_interface.py' => 'madgraph/interface/madgraph_interface.py'
92--- madgraph/interface/cmd_interface.py 2012-02-03 22:14:20 +0000
93+++ madgraph/interface/madgraph_interface.py 2012-02-14 23:32:18 +0000
94@@ -12,7 +12,7 @@
95 # For more information, please visit: http://madgraph.phys.ucl.ac.be
96 #
97 ################################################################################
98-"""A user friendly command line interface to access MadGraph features.
99+"""A user friendly command line interface to access MadGraph features at LO.
100 Uses the cmd package for command interpretation and tab completion.
101 """
102
103@@ -1035,7 +1035,7 @@
104 #===============================================================================
105 # CompleteForCmd
106 #===============================================================================
107-class CompleteForCmd(CheckValidForCmd):
108+class CompleteForCmd(object):
109 """ The Series of help routine for the MadGraphCmd"""
110
111
112@@ -1538,9 +1538,12 @@
113 #===============================================================================
114 # MadGraphCmd
115 #===============================================================================
116-class MadGraphCmd(CmdExtended, HelpToCmd):
117+class MadGraphCmd(CmdExtended, HelpToCmd, CheckValidForCmd, CompleteForCmd):
118 """The command line processor of MadGraph"""
119
120+ writing_dir = '.'
121+ timeout = 0 # time authorize to answer question [0 is no time limit]
122+
123 # Options and formats available
124 _display_opts = ['particles', 'interactions', 'processes', 'diagrams',
125 'diagrams_text', 'multiparticles', 'couplings', 'lorentz',
126@@ -1566,6 +1569,19 @@
127 _curr_exporter = None
128 _done_export = False
129
130+ def preloop(self):
131+ """Initializing before starting the main loop"""
132+
133+ self.prompt = 'mg5>'
134+
135+ # By default, load the UFO Standard Model
136+ logger.info("Loading default model: sm")
137+ self.do_import('model sm')
138+ self.history.append('import model sm')
139+
140+ # preloop mother
141+ CmdExtended.preloop(self)
142+
143
144 def __init__(self, mgme_dir = '', *completekey, **stdin):
145 """ add a tracker of the history """
146@@ -3430,87 +3446,6 @@
147 else:
148 last_action_2 = 'none'
149
150-
151-#===============================================================================
152-# MadGraphCmd
153-#===============================================================================
154-class MadGraphCmdWeb(MadGraphCmd, CheckValidForCmdWeb):
155- """The command line processor of MadGraph"""
156-
157- timeout = 1 # time authorize to answer question [0 is no time limit]
158-
159- def __init__(self, *arg, **opt):
160-
161- if os.environ.has_key('_CONDOR_SCRATCH_DIR'):
162- self.writing_dir = pjoin(os.environ['_CONDOR_SCRATCH_DIR'], \
163- os.path.pardir)
164- else:
165- self.writing_dir = pjoin(os.environ['MADGRAPH_DATA'],
166- os.environ['REMOTE_USER'])
167-
168-
169- #standard initialization
170- MadGraphCmd.__init__(self, mgme_dir = '', *arg, **opt)
171-
172- def finalize(self, nojpeg):
173- """Finalize web generation"""
174-
175- MadGraphCmd.finalize(self, nojpeg, online = True)
176-
177- # Generate a new amplitude
178- def do_generate(self, line):
179- """Generate an amplitude for a given process"""
180-
181- try:
182- MadGraphCmd.do_generate(self, line)
183- except:
184- # put the stop logo on the web
185- files.cp(self._export_dir+'/HTML/stop.jpg',self._export_dir+'/HTML/card.jpg')
186- raise
187-
188- # Add a process to the existing multiprocess definition
189- def do_add(self, line):
190- """Generate an amplitude for a given process and add to
191- existing amplitudes
192- syntax:
193- """
194- try:
195- MadGraphCmd.do_add(self, line)
196- except:
197- # put the stop logo on the web
198- files.cp(self._export_dir+'/HTML/stop.jpg',self._export_dir+'/HTML/card.jpg')
199- raise
200-
201- # Use the cluster file for the configuration
202- def set_configuration(self, config_path=None):
203-
204- """Force to use the web configuration file only"""
205- config_path = pjoin(os.environ['MADGRAPH_BASE'], 'mg5_configuration.txt')
206- return MadGraphCmd.set_configuration(self, config_path=config_path)
207-
208-#===============================================================================
209-# MadGraphCmd
210-#===============================================================================
211-class MadGraphCmdShell(MadGraphCmd, CompleteForCmd, CheckValidForCmd, cmd.CmdShell):
212- """The command line processor of MadGraph"""
213-
214- writing_dir = '.'
215- timeout = 0 # time authorize to answer question [0 is no time limit]
216-
217- def preloop(self):
218- """Initializing before starting the main loop"""
219-
220- self.prompt = 'mg5>'
221-
222- # By default, load the UFO Standard Model
223- logger.info("Loading default model: sm")
224- self.do_import('model sm')
225- self.history.append('import model sm')
226-
227- # preloop mother
228- cmd.CmdShell.preloop(self)
229-
230-
231 #===============================================================================
232 # Command Parser
233 #===============================================================================
234
235=== added file 'madgraph/interface/master_interface.py'
236--- madgraph/interface/master_interface.py 1970-01-01 00:00:00 +0000
237+++ madgraph/interface/master_interface.py 2012-02-14 23:32:18 +0000
238@@ -0,0 +1,438 @@
239+################################################################################
240+#
241+# Copyright (c) 2009 The MadGraph Development team and Contributors
242+#
243+# This file is a part of the MadGraph 5 project, an application which
244+# automatically generates Feynman diagrams and matrix elements for arbitrary
245+# high-energy processes in the Standard Model and beyond.
246+#
247+# It is subject to the MadGraph license which should accompany this
248+# distribution.
249+#
250+# For more information, please visit: http://madgraph.phys.ucl.ac.be
251+#
252+################################################################################
253+"""A user friendly command line interface to access all MadGraph features.
254+ Uses the cmd package for command interpretation and tab completion.
255+"""
256+
257+
258+import atexit
259+import logging
260+import optparse
261+import os
262+import pydoc
263+import re
264+import subprocess
265+import sys
266+import traceback
267+import time
268+
269+root_path = os.path.split(os.path.dirname(os.path.realpath( __file__ )))[0]
270+root_path = os.path.split(root_path)[0]
271+sys.path.insert(0, root_path)
272+
273+#usefull shortcut
274+pjoin = os.path.join
275+
276+import madgraph
277+import madgraph.interface.extended_cmd as cmd
278+import madgraph.interface.madgraph_interface as MGcmd
279+import madgraph.interface.NLO_interface as NLOcmd
280+
281+from madgraph import MG4DIR, MG5DIR, MadGraph5Error
282+
283+logger = logging.getLogger('cmdprint') # -> stdout
284+
285+
286+class Switcher(object):
287+ """ Helping class containing all the switching routine """
288+
289+ def debug_link_to_command(self):
290+ """redefine all the command to call directly the appropriate child"""
291+
292+ correct = True
293+ # function which should be self.cmd dependent but which doesn't start
294+ # by do_xxxx, help_xxx, check_xxxx or complete_xxx
295+ overwritable = []
296+ # list of item overwritten by the MasterClass
297+ self.to_preserve = [key for key,method in Switcher.__dict__.items() if
298+ hasattr(method, '__call__') ]
299+ self.to_preserve += ['do_shell', 'help_shell', 'complete_shell']
300+
301+ ff = open(pjoin(MG5DIR, 'additional_command'), 'w')
302+
303+ for key in dir(self):
304+ # by pass all not over-writable command
305+ if key in self.to_preserve:
306+ continue
307+ if not (key.startswith('do_') or key.startswith('complete_') or \
308+ key.startswith('help_') or key.startswith('check_') or \
309+ key in overwritable):
310+ continue
311+ text = """\
312+ def %(key)s(self, *args, **opts):
313+ return self.cmd.%(key)s(self, *args, **opts)
314+
315+""" % {'key': key}
316+ logger.warning("""Command %s not define in the Master.
317+ The line to add to the master_interface.py are written in 'additional_command' file""" % key)
318+ ff.write(text)
319+ correct = False
320+
321+
322+ # Check that all function define in more than one subclass is define
323+ # in the Switcher or in one of the MasterClass
324+ define = {}
325+ for mother in MasterCmd.__mro__:
326+ if mother.__name__ in ['Cmd', 'BasicCmd', 'ExtendedCmd']:
327+ continue
328+
329+
330+ for data in mother.__dict__:
331+ #check if define in Switcher
332+ if data in Switcher.__dict__ or data.startswith('__'):
333+ continue
334+ if data in MasterCmd.__dict__:
335+ #always overwritten in the main class
336+ continue
337+ if data not in define:
338+ define[data] = mother.__name__
339+ else:
340+ logger.warning('%s define in %s and in %s but not in Switcher.' % (data, define[data], mother.__name__))
341+ correct = False
342+
343+ # Do the same for the WEb MasterClass
344+ define = {}
345+ for mother in MasterCmdWeb.__mro__:
346+ if mother.__name__ in ['Cmd', 'BasicCmd', 'ExtendedCmd']:
347+ continue
348+
349+ for data in mother.__dict__:
350+ #check if define in Switcher
351+ if data in Switcher.__dict__ or data.startswith('__'):
352+ continue
353+ if data in MasterCmdWeb.__dict__:
354+ #always overwritten in the main class
355+ continue
356+ if data not in define:
357+ define[data] = mother.__name__
358+ else:
359+ logger.warning('%s define in %s and in %s but not in Switcher.' % (data, define[data], mother.__name__))
360+ correct = False
361+
362+ if not correct:
363+ raise Exception, 'The Cmd interface has dangerous features. Please see previous warnings and correct those.'
364+
365+
366+
367+
368+
369+ def check_add(self, *args, **opts):
370+ return self.cmd.check_add(self, *args, **opts)
371+
372+ def check_answer_in_input_file(self, *args, **opts):
373+ return self.cmd.check_answer_in_input_file(self, *args, **opts)
374+
375+ def check_check(self, *args, **opts):
376+ return self.cmd.check_check(self, *args, **opts)
377+
378+ def check_define(self, *args, **opts):
379+ return self.cmd.check_define(self, *args, **opts)
380+
381+ def check_display(self, *args, **opts):
382+ return self.cmd.check_display(self, *args, **opts)
383+
384+ def check_draw(self, *args, **opts):
385+ return self.cmd.check_draw(self, *args, **opts)
386+
387+ def check_for_export_dir(self, *args, **opts):
388+ return self.cmd.check_for_export_dir(self, *args, **opts)
389+
390+ def check_generate(self, *args, **opts):
391+ return self.cmd.check_generate(self, *args, **opts)
392+
393+ def check_history(self, *args, **opts):
394+ return self.cmd.check_history(self, *args, **opts)
395+
396+ def check_import(self, *args, **opts):
397+ return self.cmd.check_import(self, *args, **opts)
398+
399+ def check_install(self, *args, **opts):
400+ return self.cmd.check_install(self, *args, **opts)
401+
402+ def check_launch(self, *args, **opts):
403+ return self.cmd.check_launch(self, *args, **opts)
404+
405+ def check_load(self, *args, **opts):
406+ return self.cmd.check_load(self, *args, **opts)
407+
408+ def check_open(self, *args, **opts):
409+ return self.cmd.check_open(self, *args, **opts)
410+
411+ def check_output(self, *args, **opts):
412+ return self.cmd.check_output(self, *args, **opts)
413+
414+ def check_process_format(self, *args, **opts):
415+ return self.cmd.check_process_format(self, *args, **opts)
416+
417+ def check_save(self, *args, **opts):
418+ return self.cmd.check_save(self, *args, **opts)
419+
420+ def check_set(self, *args, **opts):
421+ return self.cmd.check_set(self, *args, **opts)
422+
423+ def check_stored_line(self, *args, **opts):
424+ return self.cmd.check_stored_line(self, *args, **opts)
425+
426+ def complete_add(self, *args, **opts):
427+ return self.cmd.complete_add(self, *args, **opts)
428+
429+ def complete_check(self, *args, **opts):
430+ return self.cmd.complete_check(self, *args, **opts)
431+
432+ def complete_define(self, *args, **opts):
433+ return self.cmd.complete_define(self, *args, **opts)
434+
435+ def complete_display(self, *args, **opts):
436+ return self.cmd.complete_display(self, *args, **opts)
437+
438+ def complete_draw(self, *args, **opts):
439+ return self.cmd.complete_draw(self, *args, **opts)
440+
441+ def complete_generate(self, *args, **opts):
442+ return self.cmd.complete_generate(self, *args, **opts)
443+
444+ def complete_help(self, *args, **opts):
445+ return self.cmd.complete_help(self, *args, **opts)
446+
447+ def complete_history(self, *args, **opts):
448+ return self.cmd.complete_history(self, *args, **opts)
449+
450+ def complete_import(self, *args, **opts):
451+ return self.cmd.complete_import(self, *args, **opts)
452+
453+ def complete_install(self, *args, **opts):
454+ return self.cmd.complete_install(self, *args, **opts)
455+
456+ def complete_launch(self, *args, **opts):
457+ return self.cmd.complete_launch(self, *args, **opts)
458+
459+ def complete_load(self, *args, **opts):
460+ return self.cmd.complete_load(self, *args, **opts)
461+
462+ def complete_open(self, *args, **opts):
463+ return self.cmd.complete_open(self, *args, **opts)
464+
465+ def complete_output(self, *args, **opts):
466+ return self.cmd.complete_output(self, *args, **opts)
467+
468+ def complete_save(self, *args, **opts):
469+ return self.cmd.complete_save(self, *args, **opts)
470+
471+ def complete_set(self, *args, **opts):
472+ return self.cmd.complete_set(self, *args, **opts)
473+
474+ def complete_tutorial(self, *args, **opts):
475+ return self.cmd.complete_tutorial(self, *args, **opts)
476+
477+ def do_EOF(self, *args, **opts):
478+ return self.cmd.do_EOF(self, *args, **opts)
479+
480+ def do_add(self, *args, **opts):
481+ return self.cmd.do_add(self, *args, **opts)
482+
483+ def do_check(self, *args, **opts):
484+ return self.cmd.do_check(self, *args, **opts)
485+
486+ def do_define(self, *args, **opts):
487+ return self.cmd.do_define(self, *args, **opts)
488+
489+ def do_display(self, *args, **opts):
490+ return self.cmd.do_display(self, *args, **opts)
491+
492+ def do_exit(self, *args, **opts):
493+ return self.cmd.do_exit(self, *args, **opts)
494+
495+ def do_generate(self, *args, **opts):
496+ return self.cmd.do_generate(self, *args, **opts)
497+
498+ def do_help(self, *args, **opts):
499+ return self.cmd.do_help(self, *args, **opts)
500+
501+ def do_history(self, *args, **opts):
502+ return self.cmd.do_history(self, *args, **opts)
503+
504+ def do_import(self, *args, **opts):
505+ return self.cmd.do_import(self, *args, **opts)
506+
507+ def do_install(self, *args, **opts):
508+ return self.cmd.do_install(self, *args, **opts)
509+
510+ def do_launch(self, *args, **opts):
511+ return self.cmd.do_launch(self, *args, **opts)
512+
513+ def do_load(self, *args, **opts):
514+ return self.cmd.do_load(self, *args, **opts)
515+
516+ def do_open(self, *args, **opts):
517+ return self.cmd.do_open(self, *args, **opts)
518+
519+ def do_output(self, *args, **opts):
520+ return self.cmd.do_output(self, *args, **opts)
521+
522+ def do_quit(self, *args, **opts):
523+ return self.cmd.do_quit(self, *args, **opts)
524+
525+ def do_save(self, *args, **opts):
526+ return self.cmd.do_save(self, *args, **opts)
527+
528+ def do_set(self, *args, **opts):
529+ return self.cmd.do_set(self, *args, **opts)
530+
531+ def do_tutorial(self, *args, **opts):
532+ return self.cmd.do_tutorial(self, *args, **opts)
533+
534+ def help_EOF(self, *args, **opts):
535+ return self.cmd.help_EOF(self, *args, **opts)
536+
537+ def help_add(self, *args, **opts):
538+ return self.cmd.help_add(self, *args, **opts)
539+
540+ def help_check(self, *args, **opts):
541+ return self.cmd.help_check(self, *args, **opts)
542+
543+ def help_define(self, *args, **opts):
544+ return self.cmd.help_define(self, *args, **opts)
545+
546+ def help_display(self, *args, **opts):
547+ return self.cmd.help_display(self, *args, **opts)
548+
549+ def help_generate(self, *args, **opts):
550+ return self.cmd.help_generate(self, *args, **opts)
551+
552+ def help_help(self, *args, **opts):
553+ return self.cmd.help_help(self, *args, **opts)
554+
555+ def help_history(self, *args, **opts):
556+ return self.cmd.help_history(self, *args, **opts)
557+
558+ def help_import(self, *args, **opts):
559+ return self.cmd.help_import(self, *args, **opts)
560+
561+ def help_install(self, *args, **opts):
562+ return self.cmd.help_install(self, *args, **opts)
563+
564+ def help_launch(self, *args, **opts):
565+ return self.cmd.help_launch(self, *args, **opts)
566+
567+ def help_load(self, *args, **opts):
568+ return self.cmd.help_load(self, *args, **opts)
569+
570+ def help_open(self, *args, **opts):
571+ return self.cmd.help_open(self, *args, **opts)
572+
573+ def help_output(self, *args, **opts):
574+ return self.cmd.help_output(self, *args, **opts)
575+
576+ def help_quit(self, *args, **opts):
577+ return self.cmd.help_quit(self, *args, **opts)
578+
579+ def help_save(self, *args, **opts):
580+ return self.cmd.help_save(self, *args, **opts)
581+
582+ def help_set(self, *args, **opts):
583+ return self.cmd.help_set(self, *args, **opts)
584+
585+ def help_tutorial(self, *args, **opts):
586+ return self.cmd.help_tutorial(self, *args, **opts)
587+
588+ def test_interface(self, *args, **opts):
589+ return self.cmd.test_interface(self, *args, **opts)
590+
591+
592+
593+class MasterCmd(Switcher, NLOcmd.LoopInterface, cmd.CmdShell):
594+
595+ def __init__(self, main='MadGraph', *args, **opt):
596+
597+ # define the interface
598+ self.change_principal_cmd(main)
599+ self.cmd.__init__(self, *args, **opt)
600+
601+
602+ def change_principal_cmd(self, name):
603+ if name == 'MadGraph':
604+ self.cmd = MGcmd.MadGraphCmd
605+ elif name == 'Loop':
606+ self.cmd = NLOcmd.LoopInterface
607+ else:
608+ raise MadGraph5Error, 'Type of interface not valid'
609+
610+ if __debug__:
611+ self.debug_link_to_command()
612+
613+class MasterCmdWeb(Switcher, NLOcmd.LoopInterfaceWeb):
614+
615+ timeout = 1 # time authorize to answer question [0 is no time limit]
616+
617+ def __init__(self, *arg, **opt):
618+
619+ if os.environ.has_key('_CONDOR_SCRATCH_DIR'):
620+ self.writing_dir = pjoin(os.environ['_CONDOR_SCRATCH_DIR'], \
621+ os.path.pardir)
622+ else:
623+ self.writing_dir = pjoin(os.environ['MADGRAPH_DATA'],
624+ os.environ['REMOTE_USER'])
625+
626+
627+ #standard initialization
628+ MasterCmd.__init__(self, mgme_dir = '', *arg, **opt)
629+
630+ def change_principal_cmd(self, name):
631+ if name == 'MadGraph':
632+ self.cmd = MGcmd.MadGraphCmdWeb
633+ elif name == 'Loop':
634+ self.cmd = NLOcmd.LoopInterfaceWeb
635+ else:
636+ raise MadGraph5Error, 'Type of interface not valid'
637+
638+ if __debug__:
639+ self.debug_link_to_command()
640+
641+ def finalize(self, nojpeg):
642+ """Finalize web generation"""
643+
644+ Switcher.finalize(self, nojpeg, online = True)
645+
646+ # Generate a new amplitude
647+ def do_generate(self, line):
648+ """Generate an amplitude for a given process"""
649+
650+ try:
651+ Switcher.do_generate(self, line)
652+ except:
653+ # put the stop logo on the web
654+ files.cp(self._export_dir+'/HTML/stop.jpg',self._export_dir+'/HTML/card.jpg')
655+ raise
656+
657+ # Add a process to the existing multiprocess definition
658+ def do_add(self, line):
659+ """Generate an amplitude for a given process and add to
660+ existing amplitudes
661+ syntax:
662+ """
663+ try:
664+ Switcher.do_add(self, line)
665+ except:
666+ # put the stop logo on the web
667+ files.cp(self._export_dir+'/HTML/stop.jpg',self._export_dir+'/HTML/card.jpg')
668+ raise
669+
670+ # Use the cluster file for the configuration
671+ def set_configuration(self, config_path=None):
672+
673+ """Force to use the web configuration file only"""
674+ config_path = pjoin(os.environ['MADGRAPH_BASE'], 'mg5_configuration.txt')
675+ return Switcher.set_configuration(self, config_path=config_path)
676+
677\ No newline at end of file

Subscribers

People subscribed via source and target branches

to all changes: