Merge lp:~maddevelopers/mg5amcnlo/2.1.3_fix_question_251407 into lp:~maddevelopers/mg5amcnlo/2.1.3

Proposed by Olivier Mattelaer
Status: Merged
Merged at revision: 284
Proposed branch: lp:~maddevelopers/mg5amcnlo/2.1.3_fix_question_251407
Merge into: lp:~maddevelopers/mg5amcnlo/2.1.3
Diff against target: 66 lines (+23/-10)
2 files modified
madgraph/interface/reweight_interface.py (+1/-1)
madgraph/iolibs/export_v4.py (+22/-9)
To merge this branch: bzr merge lp:~maddevelopers/mg5amcnlo/2.1.3_fix_question_251407
Reviewer Review Type Date Requested Status
Rikkert Frederix Approve
Pierre Artoisenet Pending
Review via email: mp+226475@code.launchpad.net

Description of the change

This fix the Question #251407.
This has some potential impact to both all standalone output in particular to MadSpin (and obviously the reweighting). So this is why I pass trough a merging request.

Obviously I have run some test for MadSpin (i.e.)
tt~
tt~+j
tt~[QCD]
w+zjj QED=0
and all seems fine. (The latest one return a weird log, so I have sent an email to Pierre concerning it but this is nothing to be worried about it and not related to this fix anyway).

I have also run some test on the reweighting.

MadWeight is actually currently crashing in this branch. But this is not related to this branch but to the http://bazaar.launchpad.net/~maddevelopers/mg5amcnlo/2.1.3/revision/258.
Will send another email concerning this point.

Cheers,

Olivier

To post a comment you must log in.
Revision history for this message
Rikkert Frederix (frederix) wrote :

Hi Olivier,

I'm not sure that I know enough of the code to understand the changes that you made.
It looks like previously the code only checked if the processes already existed by interchanging the two initial state particles (if there were 2). With the fix you also take all the possible permutations of all the final state legs to see if the directory already exists or not. That seems reasonable to me. However, I'm not sure one should really take all permutations in the case of many independent decay chains attached to a main process. Shouldn't the decay chains stay intact somehow? I.e., not taking permutations between particles from independent decay chains?
Again, I'm not really familiar with this part of the code (and what the 'sa_symmetry' options is supposed to do), so I might very well be mistaken.

Cheers,
Rik

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

Hi Rik,

Thanks for the review.

> I'm not sure that I know enough of the code to understand the changes that you made.
> It looks like previously the code only checked if the processes already existed by interchanging the two initial state particles (if there were 2). With the fix you also take all the possible permutations of all the final state legs to see if the directory already exists or not.

Yes for the idea but as I will explain below, the is not the final state legs.

> That seems reasonable to me. However, I'm not sure one should really take all permutations in the case of many independent decay chains attached to a main process. Shouldn't the decay chains stay intact somehow? I.e., not taking permutations between particles from independent decay chains?

That’s an interesting question.
Actually, the permutation are done only on the core process and not on the identity of the decay. So it should not lead to any problem since the core process should always be symmetric under the exchange of identical particle.
so indeed I do not take permutations between different decays.

To be 100% sure, I have add a print of the len of the flegs for the tt~ case (using MadSpin)
This is the first print for the process with and without decay:
INFO: generate p p > t t~ ;
CRITICAL: 2
raised at /Users/omatt/Documents/eclipse/2.1.3_fix_question_251407/madgraph/iolibs/export_v4.py at line 1555
INFO: generate p p > t t~, (t~ > b~ w- , w- > all all ), (t > b w+ , w+ > all all ) ;
CRITICAL: 2

> Again, I'm not really familiar with this part of the code (and what the 'sa_symmetry' options is supposed to do), so I might very well be mistaken.

The idea of this option is to reduce the number of matrix_element returned by the standalone output such that we can reduce the number of executable linked
to the MadSpin/Reweighting interface.

Cheers,

Olivier

On Jul 14, 2014, at 12:25 PM, Rikkert Frederix <email address hidden> wrote:

> Review: Needs Information
>
> Hi Olivier,
>
> I'm not sure that I know enough of the code to understand the changes that you made.
> It looks like previously the code only checked if the processes already existed by interchanging the two initial state particles (if there were 2). With the fix you also take all the possible permutations of all the final state legs to see if the directory already exists or not. That seems reasonable to me. However, I'm not sure one should really take all permutations in the case of many independent decay chains attached to a main process. Shouldn't the decay chains stay intact somehow? I.e., not taking permutations between particles from independent decay chains?
> Again, I'm not really familiar with this part of the code (and what the 'sa_symmetry' options is supposed to do), so I might very well be mistaken.
>
> Cheers,
> Rik
>
> --
> https://code.launchpad.net/~maddevelopers/mg5amcnlo/2.1.3_fix_question_251407/+merge/226475
> Your team MadDevelopers is subscribed to branch lp:~maddevelopers/mg5amcnlo/2.1.3.

Revision history for this message
Rikkert Frederix (frederix) wrote :

Hi Olivier,

Ahh. I understand. In the mean time I tried a few processes and they all seem to be working fine. Thanks.

Rikkert

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'madgraph/interface/reweight_interface.py'
2--- madgraph/interface/reweight_interface.py 2014-07-07 12:59:46 +0000
3+++ madgraph/interface/reweight_interface.py 2014-07-11 14:51:19 +0000
4@@ -619,7 +619,7 @@
5 tag = (tag[0], tuple(decay_finals))
6 Pdir = pjoin(path_me, 'rw_me', 'SubProcesses',
7 'P%s' % me.get('processes')[0].shell_string())
8- assert os.path.exists(Pdir)
9+ assert os.path.exists(Pdir), "Pdir %s do not exists" % Pdir
10 if tag in self.id_to_path:
11 if not Pdir == self.id_to_path[tag][1]:
12 misc.sprint(tag, Pdir, self.id_to_path[tag][1])
13
14=== modified file 'madgraph/iolibs/export_v4.py'
15--- madgraph/iolibs/export_v4.py 2014-07-01 12:47:53 +0000
16+++ madgraph/iolibs/export_v4.py 2014-07-11 14:51:19 +0000
17@@ -17,6 +17,7 @@
18 import copy
19 from cStringIO import StringIO
20 from distutils import dir_util
21+import itertools
22 import fractions
23 import glob
24 import logging
25@@ -1536,20 +1537,32 @@
26
27 if self.opt['sa_symmetry']:
28 # avoid symmetric output
29- for proc in matrix_element.get('processes'):
30+ for i,proc in enumerate(matrix_element.get('processes')):
31+
32+ initial = [] #filled in the next line
33+ final = [l.get('id') for l in proc.get('legs')\
34+ if l.get('state') or initial.append(l.get('id'))]
35+ decay_finals = proc.get_final_ids_after_decay()
36+ decay_finals.sort()
37+ tag = (tuple(initial), tuple(decay_finals))
38+ legs = proc.get('legs')[:]
39 leg0 = proc.get('legs')[0]
40 leg1 = proc.get('legs')[1]
41 if not leg1.get('state'):
42 proc.get('legs')[0] = leg1
43 proc.get('legs')[1] = leg0
44- dirpath2 = pjoin(self.dir_path, 'SubProcesses', \
45- "P%s" % proc.shell_string())
46- #restore original order
47- proc.get('legs')[1] = leg1
48- proc.get('legs')[0] = leg0
49- if os.path.exists(dirpath2):
50- logger.info('Symmetric directory exists')
51- return 0
52+ flegs = proc.get('legs')[2:]
53+ for perm in itertools.permutations(flegs):
54+ for i,p in enumerate(perm):
55+ proc.get('legs')[i+2] = p
56+ dirpath2 = pjoin(self.dir_path, 'SubProcesses', \
57+ "P%s" % proc.shell_string())
58+ #restore original order
59+ proc.get('legs')[2:] = legs[2:]
60+ if os.path.exists(dirpath2):
61+ proc.get('legs')[:] = legs
62+ return 0
63+ proc.get('legs')[:] = legs
64
65 try:
66 os.mkdir(dirpath)

Subscribers

People subscribed via source and target branches

to all changes: