Merge lp:~maddevelopers/mg5amcnlo/fix_fermion_order_interaction into lp:~madteam/mg5amcnlo/trunk
- fix_fermion_order_interaction
- Merge into trunk
Status: | Rejected |
---|---|
Rejected by: | Olivier Mattelaer |
Proposed branch: | lp:~maddevelopers/mg5amcnlo/fix_fermion_order_interaction |
Merge into: | lp:~madteam/mg5amcnlo/trunk |
Diff against target: |
629 lines (+254/-84) 7 files modified
UpdateNotes.txt (+6/-1) madgraph/VERSION (+2/-2) madgraph/core/helas_objects.py (+16/-15) tests/parallel_tests/compare_with_old_mg5_version.py (+2/-2) tests/unit_tests/core/test_helas_objects.py (+2/-2) tests/unit_tests/iolibs/test_export_v4.py (+204/-40) tests/unit_tests/iolibs/test_helas_call_writers.py (+22/-22) |
To merge this branch: | bzr merge lp:~maddevelopers/mg5amcnlo/fix_fermion_order_interaction |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Olivier Mattelaer | Disapprove | ||
Review via email: mp+90246@code.launchpad.net |
Commit message
Description of the change
Ensure that the order of particles/
- 201. By Johan Alwall
-
Removed some commented lines and stupid additions to parallel tests, fixed VERSION and UpdateNotes.
Olivier Mattelaer (olivier-mattelaer) wrote : | # |
Johan Alwall (johan-alwall) wrote : | # |
Hello Olivier,
Sure, this would be a nice additional measure. But I'm not sure it would help in all cases, e.g. when you have two particles or two anti-particles in an interaction.
What is the reason to avoid the C routine as much as possible? Does it slow down the code?
Olivier Mattelaer (olivier-mattelaer) wrote : | # |
> Hello Olivier,
>
> Sure, this would be a nice additional measure. But I'm not sure it would help
> in all cases, e.g. when you have two particles or two anti-particles in an
> interaction.
>
> What is the reason to avoid the C routine as much as possible? Does it slow
> down the code?
The code is more optimal if we don't have both C and regular routine. But this is not critical at all. But since I did it...
Otherwise the parralel test has some failure:
first:
ERROR: test_mg5_heft_23 (tests.
Test a heft 2->3 processes
-------
Traceback (most recent call last):
File "/Users/
self.
AttributeError: 'OLDMG5Comparator' object has no attribute 'compare_MG4_MG5'
which looks like a problem of the test in itself
Then
=======
ERROR: test_short_mssm (tests.
Test a minimal list of mssm 2->2 processes, mainly to test the test
-------
Traceback (most recent call last):
File "/Users/
stored_
File "/Users/
self.
File "/Users/
value = self.get_
File "/Users/
stdout=devnull, stderr=devnull)
File "/Library/
File "/Library/
File "/Library/
OSError: [Errno 24] Too many open files
and the same type of error for test_short_sm (but here it fails to copy the template)...
and finally the most problematic one:
=======
FAIL: test_mg5_sm_23 (tests.
Test a semi-complete list of sm 2->3 processes
-------
Traceback (most recent call last):
File "/Users/
filename = "sm_23.log")
File "/Users/
my_
File "/Users/
Johan Alwall (johan-alwall) wrote : | # |
Hello Olivier,
> > Sure, this would be a nice additional measure. But I'm not sure it would
> help
> > in all cases, e.g. when you have two particles or two anti-particles in an
> > interaction.
> >
> > What is the reason to avoid the C routine as much as possible? Does it slow
> > down the code?
>
> The code is more optimal if we don't have both C and regular routine. But this
> is not critical at all. But since I did it...
We should definitely include your fix too. Just need to do serious parallel tests for both modifications independently, and then together, to be safe. For the last test, I tried running g g > a b b~ standalone, and it runs without problem. So it seems that all the failures below are due to the tests, not the code. Since you wrote these tests, perhaps you could try to fix them? It should be much faster for you than for me.
Thanks!
Johan
> Otherwise the parralel test has some failure:
>
> first:
>
> ERROR: test_mg5_heft_23
> (tests.
> Test a heft 2->3 processes
> -------
> Traceback (most recent call last):
> File "/Users/
> e_with_
> self.compare_
> AttributeError: 'OLDMG5Comparator' object has no attribute 'compare_MG4_MG5'
>
> which looks like a problem of the test in itself
Indeed. Did I touch this? If I did, please feel free to revert it. Same thing with the errors below.
>
> Then
> =======
> ERROR: test_short_mssm
> (tests.
> Test a minimal list of mssm 2->2 processes, mainly to test the test
> -------
> Traceback (most recent call last):
> File "/Users/
> e_with_
> stored_
> File "/Users/
> parator.py", line 682, in run_comparison
> self.results.
> File "/Users/
> parator.py", line 394, in run
> value = self.get_
> File "/Users/
> parator.py", line 265, in get_me_value
> stdout=devnull, stderr=devnull)
> File "/Library/
> cess.py", line 493, in call
> File "/Library/
> cess.py", line 679, in __init__
> File "/Library/
> cess.py", line 1120, in _execute_child
> OSError: [Errno 24] Too many open files
>
> and the same type of error for test_short_sm (but here it fails to copy the
> template)...
>
>
> and finally the most problematic one:
>
> =======
Olivier Mattelaer (olivier-mattelaer) wrote : | # |
I've made the merge in the last version, and it looks better:
but they are some fails (but maybe those one are expected in fact (since I compare to a old MG5))
Cheers,
Olivier
ERROR: test_paralel_
Test a short list of sm processes
-------
Traceback (most recent call last):
File "/Users/
filename = "short_cs_sm.log")
File "/Users/
['paralel_
File "/Users/
self.
File "/Users/
values = self.get_values()
File "/Users/
SubProc=[name for name in os.listdir(dir_name + '/SubProcesses')
OSError: [Errno 2] No such file or directory: '/Users/
=======
FAIL: test_mg5_mssm_22 (tests.
Test a semi-complete list of mssm 2->2 processes
-------
Traceback (most recent call last):
File "/Users/
filename = "mssm_22.log")
File "/Users/
my_
File "/Users/
test_
AssertionError: 'Failed for processes:\na a > x1- x2+ 1.9918958496e-34 4.7490497800e-41 9.9999952316e-01 \na a > x1+ x2- 1.9918958496e-34 4.7490497800e-41 9.9999952316e-01 ' != 'Failed for processes:'
=======
FAIL: test_mg5_mssm_23_p2 (tests.
Test a semi-complete list of mssm 2->3 processes
-------
Traceback (most recent call last):
File "/Users/
filename = "mssm_23_p2.log")
File "/Users/
my_
File "/Use...
Johan Alwall (johan-alwall) wrote : | # |
Hello Olivier,
> ERROR: test_paralel_
> Test a short list of sm processes
> -------
> File "/Users/
> SubProc=[name for name in os.listdir(dir_name + '/SubProcesses')
> OSError: [Errno 2] No such file or directory: '/Users/
This definitely looks like a problem with the test, which needs to be fixed.
> =======
> FAIL: test_mg5_mssm_22 (tests.
> Test a semi-complete list of mssm 2->2 processes
> -------
> AssertionError: 'Failed for processes:\na a > x1- x2+ 1.9918958496e-34 4.7490497800e-41 9.9999952316e-01 \na a > x1+ x2- 1.9918958496e-34 4.7490497800e-41 9.9999952316e-01 ' != 'Failed for processes:'
Ah - this looks like a real failure though, and in fact the only process where we do expect failure if there is a problem. So the question is which version is correct.
> =======
> FAIL: test_mg5_mssm_23_p2 (tests.
> Test a semi-complete list of mssm 2->3 processes
> -------
> AssertionError: 'Failed for processes:\na a > a x1- x2+ 1.8410268017e-40 4.3893499400e-47 9.9999952316e-01 \na a > a x1+ x2- 1.8401745086e-40 4.3873179200e-47 9.9999952316e-01 \na a > a x2- x1+ 1.9670095850e-40 4.6897163000e-47 9.9999952316e-01 \na a > a x2+ x1- 1.9662593729e-40 4.6879276600e-47 9.9999952316e-01 ' != 'Failed for processes:'
Same thing here. I'll take a look.
Johan Alwall (johan-alwall) wrote : | # |
Hello again,
This is strange - when I compare these processes between the trunk and this branch, I get no difference at all. So it must be a difference between the older and newer versions. Which version are you comparing with?
Johan Alwall (johan-alwall) wrote : | # |
Hello Olivier,
Aha, you are comparing with the modified mssm (where the PDG code for x1+ is changed)? For regular MSSM I don't get any difference for any version (I've tested down to v. 1.2.3, with identical result for the a a > x1x2 processes).
Cheers,
Johan
Johan Alwall (johan-alwall) wrote : | # |
Hello again Olivier,
I have looked closer into this. For x1- and x2+ being particles (i.e., flip of sign for x1), the calls for a a > x1- x2+ are:
CALL VXXXXX(
CALL VXXXXX(
CALL IXXXXX(
CALL OXXXXX(
CALL FFV2C1_
C Amplitude(s) for diagram number 1
CALL FFV3C1_
CALL FFV3C1_
C Amplitude(s) for diagram number 2
CALL FFV2_3_
CALL FFV3C1_
C Amplitude(s) for diagram number 3
CALL FFV2C1_
CALL FFV2_3_
C Amplitude(s) for diagram number 4
CALL FFV3C1_
This looks completely reasonable to me - all calls involving the x1 are C'ed, but not the calls involving only x2, since x2 is not flipped. However, it seems that in order to get the same answer as the non-flipped mssm, I need to C *all* calls - also the ones involving only x2. So I clearly don't understand how this works. Do you understand it?
Johan
Olivier Mattelaer (olivier-mattelaer) wrote : | # |
Hi Johan,
I've looked to a a > x1+ x2- (so quite the same up to the sign)
and in that case the matrix.f sounds weird to me:
CALL VXXXXX(
CALL VXXXXX(
CALL IXXXXX(
CALL OXXXXX(
CALL FFV2_3_
C Amplitude(s) for diagram number 1
CALL FFV3C1_
CALL FFV3C1_
C Amplitude(s) for diagram number 2
CALL FFV2C1_
CALL FFV3C1_
C Amplitude(s) for diagram number 3
CALL FFV2C1_
CALL FFV2C1_
C Amplitude(s) for diagram number 4
CALL FFV3C1_
What is weird is that the routine without any C, is a x1+ x1- a ...
even the routine with the x2+ x2- are with C routine in this case...
So here I don't understand the output at all.
Cheers,
Olivier
On 07-févr.-12, at 01:21, Johan Alwall wrote:
> Hello again Olivier,
>
> I have looked closer into this. For x1- and x2+ being particles
> (i.e., flip of sign for x1), the calls for a a > x1- x2+ are:
>
> CALL VXXXXX(
> CALL VXXXXX(
> CALL IXXXXX(
> CALL OXXXXX(
> CALL FFV2C1_
> C Amplitude(s) for diagram number 1
> CALL FFV3C1_
> CALL FFV3C1_
> C Amplitude(s) for diagram number 2
> CALL FFV2_3_
> CALL FFV3C1_
> C Amplitude(s) for diagram number 3
> CALL FFV2C1_
> CALL FFV2_3_
> C Amplitude(s) for diagram number 4
> CALL FFV3C1_
>
> This looks completely reasonable to me - all calls involving the x1
> are C'ed, but not the calls involving only x2, since x2 is not
> flipped. However, it seems that in order to get the same answer as
> the non-flipped mssm, I need to C *all* calls - also the ones
> involving only x2. So I clearly don't understand how this works. Do
> you understand it?
>
> Johan
> --
> https:/
> fix_fermion_
> You are requested to review the proposed merge of lp:~maddevelopers/
> madgraph5/
Johan Alwall (johan-alwall) wrote : | # |
> I've looked to a a > x1+ x2- (so quite the same up to the sign)
Oh, but this is completely different.
> and in that case the matrix.f sounds weird to me:
> CALL VXXXXX(
> CALL VXXXXX(
> CALL IXXXXX(
> CALL OXXXXX(
The x1+ is antifermion, so is correctly incoming, while x2-, also an antifermion, is CCed and has fermionflow flag -1 in this process (since it should be incoming but is instead outgoing).
> CALL FFV2_3_
This should be correct - the x1+ is incoming and is in the right place.
> C Amplitude(s) for diagram number 1
> CALL FFV3C1_
> CALL FFV3C1_
This is charged conjugated because of mismatch of order of fermions.
> C Amplitude(s) for diagram number 2
> CALL FFV2C1_
> CALL FFV3C1_
This is charged conjugated because the x2- is CCed (fermionflow -1).
> C Amplitude(s) for diagram number 3
> CALL FFV2C1_
> CALL FFV2C1_
> C Amplitude(s) for diagram number 4
> CALL FFV3C1_
>
> What is weird is that the routine without any C, is a x1+ x1- a ...
> even the routine with the x2+ x2- are with C routine in this case...
So everything looks right according to how I understand it. But I am obviously missing something. Perhaps we should ask Tim for help here...
Cheers,
Johan
> On 07-févr.-12, at 01:21, Johan Alwall wrote:
>
> > Hello again Olivier,
> >
> > I have looked closer into this. For x1- and x2+ being particles
> > (i.e., flip of sign for x1), the calls for a a > x1- x2+ are:
> >
> > CALL VXXXXX(
> > CALL VXXXXX(
> > CALL IXXXXX(
> > CALL OXXXXX(
> > CALL FFV2C1_
> > C Amplitude(s) for diagram number 1
> > CALL FFV3C1_
> > CALL FFV3C1_
> > C Amplitude(s) for diagram number 2
> > CALL FFV2_3_
> > CALL FFV3C1_
> > C Amplitude(s) for diagram number 3
> > CALL FFV2C1_
> > CALL FFV2_3_
> > C Amplitude(s) for diagram number 4
> > CALL FFV3C1_
> >
> > This looks completely reasonable to me - all calls involving the x1
> > are C'ed, but not the calls involving only x2, since x2 is not
> > flipped. However, it seems that in order to get the same answer as
> > the non-flipped mssm, I need to C *all* ...
Johan Alwall (johan-alwall) wrote : | # |
Olivier,
Does your fix give the correct result for these processes (without including my fix)? Can you please push it in a separate branch so I can make some comparisons?
Thanks,
Johan
Olivier Mattelaer (olivier-mattelaer) wrote : | # |
Ok Done,
lp:~maddevelopers/madgraph5/flip_particle_antiparticle
(I was force to re-implement it but ok this is very fast)
I've made the check for
a a > x1+ x2-
a a > x2+ x1-
a a > x1+ x1-
and full agreement the next good point is that this is not intrusive,
since this doesn't change anything to existing model.
So maybe we can push this version in 1.4.2, such that we cover this bug for the moment.
Cheers,
Olivier
Olivier Mattelaer (olivier-mattelaer) wrote : | # |
Hi Johan,
should I put my branch under review?
Cheers,
Olivier
Johan Alwall (johan-alwall) wrote : | # |
> Hi Johan,
>
> should I put my branch under review?
Yes please do :-)
Cheers,
Johan
>
> Cheers,
>
> Olivier
Olivier Mattelaer (olivier-mattelaer) wrote : | # |
Ok, now that the other branch is going to be merged. I'm closing this review and the associated branch.
Unmerged revisions
- 201. By Johan Alwall
-
Removed some commented lines and stupid additions to parallel tests, fixed VERSION and UpdateNotes.
- 200. By Johan Alwall
-
Ensure that we get the same result independently of the order of fermion/antifermion in interaction (see bug 921487)
Preview Diff
1 | === modified file 'UpdateNotes.txt' |
2 | --- UpdateNotes.txt 2012-01-25 04:09:03 +0000 |
3 | +++ UpdateNotes.txt 2012-01-26 10:43:23 +0000 |
4 | @@ -1,6 +1,11 @@ |
5 | Update notes for MadGraph 5 (in reverse time order) |
6 | |
7 | -1.3.33 (01/01/25) JA: Revisited colors for propagators in addmothers.f |
8 | +1.3.34 (27/01/12) JA: Ensure that conjugated wavefunctions are applied |
9 | + appropriately if the order of fermions and |
10 | + antifermions is non-standard (in UFO models from |
11 | + FeynRules, the order is always antifermion,fermion). |
12 | + |
13 | +1.3.33 (25/01/12) JA: Revisited colors for propagators in addmothers.f |
14 | to ensure that propagators in color flow |
15 | violating processes get the correct color |
16 | from initial state particles (thanks to |
17 | |
18 | === modified file 'madgraph/VERSION' |
19 | --- madgraph/VERSION 2012-01-25 03:54:07 +0000 |
20 | +++ madgraph/VERSION 2012-01-26 10:43:23 +0000 |
21 | @@ -1,2 +1,2 @@ |
22 | -version = 1.3.33 |
23 | -date = 2012-01-25 |
24 | +version = 1.3.34 |
25 | +date = 2012-01-27 |
26 | |
27 | === modified file 'madgraph/core/helas_objects.py' |
28 | --- madgraph/core/helas_objects.py 2011-11-12 06:29:47 +0000 |
29 | +++ madgraph/core/helas_objects.py 2012-01-26 10:43:23 +0000 |
30 | @@ -1167,12 +1167,9 @@ |
31 | def get_conjugate_index(self): |
32 | """Return the index of the particle that should be conjugated.""" |
33 | |
34 | - if not any([(wf.get('fermionflow') < 0 or wf.is_majorana()) for wf in \ |
35 | - self.get('mothers')]) and \ |
36 | - (not self.get('interaction_id') or \ |
37 | - self.get('fermionflow') >= 0): |
38 | + if not self.get('mothers'): |
39 | return () |
40 | - |
41 | + |
42 | # Pick out first sorted mothers, then fermions |
43 | mothers, self_index = \ |
44 | self.get('mothers').sort_by_pdg_codes(self.get('pdg_codes'), |
45 | @@ -1188,13 +1185,17 @@ |
46 | if state != me.get('state')][0]) |
47 | fermions.insert(self_index, me) |
48 | |
49 | - # Initialize indices with indices due to Majoranas with wrong order |
50 | - indices = fermions.majorana_conjugates() |
51 | + indices = [] |
52 | |
53 | # Check for fermions with negative fermion flow |
54 | + # and for fermions in the wrong order relative to the interaction |
55 | for i in range(0,len(fermions), 2): |
56 | if fermions[i].get('fermionflow') < 0 or \ |
57 | - fermions[i+1].get('fermionflow') < 0: |
58 | + fermions[i+1].get('fermionflow') < 0 or \ |
59 | + fermions[i].get_spin_state_number() > 0 and \ |
60 | + fermions[i+1].get_spin_state_number() < 0 and \ |
61 | + fermions[i].get_pdg_code() != \ |
62 | + fermions[i+1].get_pdg_code(): |
63 | indices.append(i/2 + 1) |
64 | |
65 | return tuple(sorted(indices)) |
66 | @@ -2044,22 +2045,22 @@ |
67 | def get_conjugate_index(self): |
68 | """Return the index of the particle that should be conjugated.""" |
69 | |
70 | - if not any([(wf.get('fermionflow') < 0 or wf.is_majorana()) for wf in \ |
71 | - self.get('mothers')]): |
72 | - return () |
73 | - |
74 | # Pick out first sorted mothers, then fermions |
75 | mothers, self_index = \ |
76 | self.get('mothers').sort_by_pdg_codes(self.get('pdg_codes')) |
77 | fermions = HelasWavefunctionList([wf for wf in mothers if wf.is_fermion()]) |
78 | |
79 | - # Initialize indices with indices due to Majoranas with wrong order |
80 | - indices = fermions.majorana_conjugates() |
81 | + indices = [] |
82 | |
83 | # Check for fermions with negative fermion flow |
84 | + # and for fermions in the wrong order relative to the interaction |
85 | for i in range(0,len(fermions), 2): |
86 | if fermions[i].get('fermionflow') < 0 or \ |
87 | - fermions[i+1].get('fermionflow') < 0: |
88 | + fermions[i+1].get('fermionflow') < 0 or \ |
89 | + fermions[i].get_spin_state_number() > 0 and \ |
90 | + fermions[i+1].get_spin_state_number() < 0 and \ |
91 | + fermions[i].get_pdg_code() != \ |
92 | + fermions[i+1].get_pdg_code(): |
93 | indices.append(i/2 + 1) |
94 | |
95 | return tuple(sorted(indices)) |
96 | |
97 | === modified file 'tests/parallel_tests/compare_with_old_mg5_version.py' |
98 | --- tests/parallel_tests/compare_with_old_mg5_version.py 2011-11-11 22:11:52 +0000 |
99 | +++ tests/parallel_tests/compare_with_old_mg5_version.py 2012-01-26 10:43:23 +0000 |
100 | @@ -225,7 +225,7 @@ |
101 | my_comp.cleanup() |
102 | |
103 | def test_short_mssm(self): |
104 | - """Test a minimal list of sm 2->2 processes, mainly to test the test""" |
105 | + """Test a minimal list of mssm 2->2 processes, mainly to test the test""" |
106 | # Create a list of processes to check automatically |
107 | comparisons = me_comparator.PickleRunner.find_comparisons(\ |
108 | os.path.join(_pickle_path, "mg5_short_parraleltest_mssm.pkl")) |
109 | @@ -448,4 +448,4 @@ |
110 | |
111 | |
112 | |
113 | - |
114 | \ No newline at end of file |
115 | + |
116 | |
117 | === modified file 'tests/unit_tests/core/test_helas_objects.py' |
118 | --- tests/unit_tests/core/test_helas_objects.py 2011-11-09 06:54:38 +0000 |
119 | +++ tests/unit_tests/core/test_helas_objects.py 2012-01-26 10:43:23 +0000 |
120 | @@ -2271,8 +2271,8 @@ |
121 | |
122 | wfxm.set('state', 'outgoing') |
123 | wfn1.set('state', 'outgoing') |
124 | - # only one Majorana |
125 | - self.assertEqual(wfxm.get_conjugate_index(), ()) |
126 | + # only one Majorana, but wrong order compared to interaction |
127 | + self.assertEqual(wfxm.get_conjugate_index(), (1,)) |
128 | |
129 | wfxm.set('fermionflow', -1) |
130 | # neg. fermion flow |
131 | |
132 | === modified file 'tests/unit_tests/iolibs/test_export_v4.py' |
133 | --- tests/unit_tests/iolibs/test_export_v4.py 2011-11-12 06:29:47 +0000 |
134 | +++ tests/unit_tests/iolibs/test_export_v4.py 2012-01-26 10:43:23 +0000 |
135 | @@ -109,8 +109,8 @@ |
136 | myinterlist.append(base_objects.Interaction({ |
137 | 'id': 7, |
138 | 'particles': base_objects.ParticleList(\ |
139 | - [eminus, \ |
140 | - eplus, \ |
141 | + [eplus, \ |
142 | + eminus, \ |
143 | a]), |
144 | 'color': [], |
145 | 'lorentz':[''], |
146 | @@ -2110,8 +2110,8 @@ |
147 | myinterlist.append(base_objects.Interaction({ |
148 | 'id': 12, |
149 | 'particles': base_objects.ParticleList(\ |
150 | - [go, \ |
151 | - antiu, \ |
152 | + [antiu, \ |
153 | + go, \ |
154 | ul]), |
155 | 'color': [], |
156 | 'lorentz':['L1'], |
157 | @@ -2132,8 +2132,8 @@ |
158 | myinterlist.append(base_objects.Interaction({ |
159 | 'id': 14, |
160 | 'particles': base_objects.ParticleList(\ |
161 | - [go, \ |
162 | - antid, \ |
163 | + [antid, \ |
164 | + go, \ |
165 | dl]), |
166 | 'color': [], |
167 | 'lorentz':['L1'], |
168 | @@ -2155,8 +2155,8 @@ |
169 | myinterlist.append(base_objects.Interaction({ |
170 | 'id': 16, |
171 | 'particles': base_objects.ParticleList(\ |
172 | - [n1, \ |
173 | - antiu, \ |
174 | + [antiu, \ |
175 | + n1, \ |
176 | ul]), |
177 | 'color': [], |
178 | 'lorentz':['L1'], |
179 | @@ -2177,8 +2177,8 @@ |
180 | myinterlist.append(base_objects.Interaction({ |
181 | 'id': 18, |
182 | 'particles': base_objects.ParticleList(\ |
183 | - [n1, \ |
184 | - antid, \ |
185 | + [antid, \ |
186 | + n1, \ |
187 | dl]), |
188 | 'color': [], |
189 | 'lorentz':['L1'], |
190 | @@ -5546,7 +5546,7 @@ |
191 | |
192 | myinterlist.append(base_objects.Interaction({ |
193 | 'id': 1, |
194 | - 'particles': base_objects.ParticleList([t, antib, wpbar]), |
195 | + 'particles': base_objects.ParticleList([antib, t, wpbar]), |
196 | 'color': [color.ColorString([color.T(1,0)])], |
197 | 'lorentz': ['FFS3', 'FFS4'], |
198 | 'couplings': {(0, 0): 'GC_108', (0, 1): 'GC_111'}, |
199 | @@ -5554,7 +5554,7 @@ |
200 | })) |
201 | myinterlist.append(base_objects.Interaction({ |
202 | 'id': 2, |
203 | - 'particles': base_objects.ParticleList([b, antit, wp]), |
204 | + 'particles': base_objects.ParticleList([antit, b, wp]), |
205 | 'color': [color.ColorString([color.T(1,0)])], |
206 | 'lorentz': ['FFS3', 'FFS4'], |
207 | 'couplings': {(0, 0): 'GC_108', (0, 1): 'GC_111'}, |
208 | @@ -5842,8 +5842,8 @@ |
209 | myinterlist.append(base_objects.Interaction({ |
210 | 'id': 7, |
211 | 'particles': base_objects.ParticleList(\ |
212 | - [eminus, \ |
213 | - eplus, \ |
214 | + [eplus, \ |
215 | + eminus, \ |
216 | a]), |
217 | 'color': [], |
218 | 'lorentz':[''], |
219 | @@ -5854,8 +5854,8 @@ |
220 | myinterlist.append(base_objects.Interaction({ |
221 | 'id': 16, |
222 | 'particles': base_objects.ParticleList(\ |
223 | - [muminus, \ |
224 | - muplus, \ |
225 | + [muplus, \ |
226 | + muminus, \ |
227 | a]), |
228 | 'color': [], |
229 | 'lorentz':[''], |
230 | @@ -6495,7 +6495,7 @@ |
231 | PMASS(8)=ZERO\n""") |
232 | |
233 | def test_vector_clash_majorana_process(self): |
234 | - """Test majorana process w+ w- > n2 n2 |
235 | + """Test majorana process w+ w- > n1 n1 |
236 | """ |
237 | |
238 | mypartlist = base_objects.ParticleList() |
239 | @@ -6503,7 +6503,7 @@ |
240 | |
241 | # Neutralino |
242 | mypartlist.append(base_objects.Particle({'name':'n1', |
243 | - 'antiname':'n2', |
244 | + 'antiname':'n1', |
245 | 'spin':2, |
246 | 'color':1, |
247 | 'mass':'MN1', |
248 | @@ -6519,8 +6519,8 @@ |
249 | n1 = mypartlist[len(mypartlist) - 1] |
250 | |
251 | # W+/- |
252 | - mypartlist.append(base_objects.Particle({'name':'w-', |
253 | - 'antiname':'w+', |
254 | + mypartlist.append(base_objects.Particle({'name':'w+', |
255 | + 'antiname':'w-', |
256 | 'spin':3, |
257 | 'color':1, |
258 | 'mass':'WMASS', |
259 | @@ -6529,7 +6529,7 @@ |
260 | 'antitexname':'w+', |
261 | 'line':'wavy', |
262 | 'charge':1., |
263 | - 'pdg_code':-24, |
264 | + 'pdg_code':24, |
265 | 'propagating':True, |
266 | 'is_part':True, |
267 | 'self_antipart':False})) |
268 | @@ -6538,17 +6538,17 @@ |
269 | wminus.set('is_part', False) |
270 | |
271 | # chargino+/- |
272 | - mypartlist.append(base_objects.Particle({'name':'x1-', |
273 | - 'antiname':'x1+', |
274 | + mypartlist.append(base_objects.Particle({'name':'x1+', |
275 | + 'antiname':'x1-', |
276 | 'spin':2, |
277 | 'color':1, |
278 | 'mass':'MX1', |
279 | 'width':'WX1', |
280 | - 'texname':'x1-', |
281 | - 'antitexname':'x1+', |
282 | + 'texname':'x1+', |
283 | + 'antitexname':'x1-', |
284 | 'line':'straight', |
285 | 'charge':1., |
286 | - 'pdg_code':-1000024, |
287 | + 'pdg_code':1000024, |
288 | 'propagating':True, |
289 | 'is_part':True, |
290 | 'self_antipart':False})) |
291 | @@ -6560,8 +6560,8 @@ |
292 | myinterlist.append(base_objects.Interaction({ |
293 | 'id': 1, |
294 | 'particles': base_objects.ParticleList(\ |
295 | - [n1, \ |
296 | - x1minus, \ |
297 | + [x1minus, \ |
298 | + n1, \ |
299 | wplus]), |
300 | 'color': [], |
301 | 'lorentz':[''], |
302 | @@ -6571,8 +6571,8 @@ |
303 | myinterlist.append(base_objects.Interaction({ |
304 | 'id': 2, |
305 | 'particles': base_objects.ParticleList(\ |
306 | - [x1plus, \ |
307 | - n1, \ |
308 | + [n1, \ |
309 | + x1plus, \ |
310 | wminus]), |
311 | 'color': [], |
312 | 'lorentz':[''], |
313 | @@ -6610,12 +6610,178 @@ |
314 | CALL VXXXXX(P(0,2),WMASS,NHEL(2),-1*IC(2),W(1,2)) |
315 | CALL IXXXXX(P(0,3),MN1,NHEL(3),-1*IC(3),W(1,3)) |
316 | CALL OXXXXX(P(0,4),MN1,NHEL(4),+1*IC(4),W(1,4)) |
317 | -CALL FVICXX(W(1,3),W(1,1),GWN1X1,MX1,WX1,W(1,5)) |
318 | -# Amplitude(s) for diagram number 1 |
319 | -CALL IOVCXX(W(1,5),W(1,4),W(1,2),GWX1N1,AMP(1)) |
320 | -CALL FVOXXX(W(1,4),W(1,1),GWN1X1,MX1,WX1,W(1,6)) |
321 | -# Amplitude(s) for diagram number 2 |
322 | -CALL IOVXXX(W(1,3),W(1,6),W(1,2),GWX1N1,AMP(2))""") |
323 | +CALL FVIXXX(W(1,3),W(1,1),GWX1N1,MX1,WX1,W(1,5)) |
324 | +# Amplitude(s) for diagram number 1 |
325 | +CALL IOVXXX(W(1,5),W(1,4),W(1,2),GWN1X1,AMP(1)) |
326 | +CALL FVOCXX(W(1,4),W(1,1),GWX1N1,MX1,WX1,W(1,6)) |
327 | +# Amplitude(s) for diagram number 2 |
328 | +CALL IOVCXX(W(1,3),W(1,6),W(1,2),GWN1X1,AMP(2))""") |
329 | + |
330 | + def test_switched_chargino_process(self): |
331 | + """Test process e+ e- > x1+ x1- with inverted x1+/- |
332 | + """ |
333 | + |
334 | + mypartlist = base_objects.ParticleList() |
335 | + myinterlist = base_objects.InteractionList() |
336 | + |
337 | + # A electron and positron |
338 | + mypartlist.append(base_objects.Particle({'name':'e-', |
339 | + 'antiname':'e+', |
340 | + 'spin':2, |
341 | + 'color':1, |
342 | + 'mass':'zero', |
343 | + 'width':'zero', |
344 | + 'texname':'e^-', |
345 | + 'antitexname':'e^+', |
346 | + 'line':'straight', |
347 | + 'charge':-1., |
348 | + 'pdg_code':11, |
349 | + 'propagating':True, |
350 | + 'is_part':True, |
351 | + 'self_antipart':False})) |
352 | + eminus = mypartlist[len(mypartlist) - 1] |
353 | + eplus = copy.copy(eminus) |
354 | + eplus.set('is_part', False) |
355 | + |
356 | + # A photon |
357 | + mypartlist.append(base_objects.Particle({'name':'a', |
358 | + 'antiname':'a', |
359 | + 'spin':3, |
360 | + 'color':1, |
361 | + 'mass':'zero', |
362 | + 'width':'zero', |
363 | + 'texname':'\gamma', |
364 | + 'antitexname':'\gamma', |
365 | + 'line':'wavy', |
366 | + 'charge':0., |
367 | + 'pdg_code':22, |
368 | + 'propagating':True, |
369 | + 'is_part':True, |
370 | + 'self_antipart':True})) |
371 | + a = mypartlist[len(mypartlist) - 1] |
372 | + |
373 | + # A sneutrino and its antiparticle |
374 | + mypartlist.append(base_objects.Particle({'name':'sve', |
375 | + 'antiname':'sve~', |
376 | + 'spin':1, |
377 | + 'color':1, |
378 | + 'mass':'Msve', |
379 | + 'width':'Wsve', |
380 | + 'texname':'ve', |
381 | + 'antitexname':'\tilde ve', |
382 | + 'line':'dashed', |
383 | + 'charge':0., |
384 | + 'pdg_code':1000012, |
385 | + 'propagating':True, |
386 | + 'is_part':True, |
387 | + 'self_antipart':False})) |
388 | + sve = mypartlist[len(mypartlist) - 1] |
389 | + svebar = copy.copy(sve) |
390 | + svebar.set('is_part', False) |
391 | + |
392 | + # chargino+/- |
393 | + mypartlist.append(base_objects.Particle({'name':'x1-', |
394 | + 'antiname':'x1+', |
395 | + 'spin':2, |
396 | + 'color':1, |
397 | + 'mass':'MX1', |
398 | + 'width':'WX1', |
399 | + 'texname':'x1-', |
400 | + 'antitexname':'x1+', |
401 | + 'line':'straight', |
402 | + 'charge':-1., |
403 | + 'pdg_code':1000024, |
404 | + 'propagating':True, |
405 | + 'is_part':True, |
406 | + 'self_antipart':False})) |
407 | + x1minus = mypartlist[len(mypartlist) - 1] |
408 | + x1plus = copy.copy(x1minus) |
409 | + x1plus.set('is_part', False) |
410 | + |
411 | + # Coupling of e to gamma |
412 | + myinterlist.append(base_objects.Interaction({ |
413 | + 'id': 1, |
414 | + 'particles': base_objects.ParticleList(\ |
415 | + [eplus, \ |
416 | + eminus, \ |
417 | + a]), |
418 | + 'color': [], |
419 | + 'lorentz':['FFV1'], |
420 | + 'couplings':{(0, 0):'GAEE'}, |
421 | + 'orders':{'QED':1}})) |
422 | + |
423 | + # Coupling of x1+/- to gamma |
424 | + myinterlist.append(base_objects.Interaction({ |
425 | + 'id': 2, |
426 | + 'particles': base_objects.ParticleList(\ |
427 | + [x1minus, \ |
428 | + x1plus, \ |
429 | + a]), |
430 | + 'color': [], |
431 | + 'lorentz':['FFV2'], |
432 | + 'couplings':{(0, 0):'GAXX'}, |
433 | + 'orders':{'QED':1}})) |
434 | + |
435 | + # Coupling of x1 to e and sve |
436 | + myinterlist.append(base_objects.Interaction({ |
437 | + 'id': 3, |
438 | + 'particles': base_objects.ParticleList(\ |
439 | + [eplus, \ |
440 | + x1minus, \ |
441 | + sve]), |
442 | + 'color': [], |
443 | + 'lorentz':['FFS1'], |
444 | + 'couplings':{(0, 0):'GEXV'}, |
445 | + 'orders':{'QED':1}})) |
446 | + |
447 | + myinterlist.append(base_objects.Interaction({ |
448 | + 'id': 4, |
449 | + 'particles': base_objects.ParticleList(\ |
450 | + [eminus, \ |
451 | + x1plus, \ |
452 | + svebar]), |
453 | + 'color': [], |
454 | + 'lorentz':['FFS1'], |
455 | + 'couplings':{(0, 0):'GEXV'}, |
456 | + 'orders':{'QED':1}})) |
457 | + |
458 | + mymodel = base_objects.Model() |
459 | + mymodel.set('particles', mypartlist) |
460 | + mymodel.set('interactions', myinterlist) |
461 | + |
462 | + myleglist = base_objects.LegList() |
463 | + |
464 | + myleglist.append(base_objects.Leg({'id':-11, |
465 | + 'state':False})) |
466 | + myleglist.append(base_objects.Leg({'id':11, |
467 | + 'state':False})) |
468 | + myleglist.append(base_objects.Leg({'id':-1000024, |
469 | + 'state':True})) |
470 | + myleglist.append(base_objects.Leg({'id':1000024, |
471 | + 'state':True})) |
472 | + |
473 | + myproc = base_objects.Process({'legs':myleglist, |
474 | + 'model':mymodel}) |
475 | + myamplitude = diagram_generation.Amplitude({'process': myproc}) |
476 | + |
477 | + self.assertEqual(len(myamplitude.get('diagrams')), 2) |
478 | + |
479 | + me = helas_objects.HelasMatrixElement(myamplitude, |
480 | + gen_color=False) |
481 | + |
482 | + myfortranmodel = helas_call_writers.FortranUFOHelasCallWriter(mymodel) |
483 | + |
484 | + self.assertEqual("\n".join(myfortranmodel.get_matrix_element_calls(me)), |
485 | + """CALL OXXXXX(P(0,1),zero,NHEL(1),-1*IC(1),W(1,1)) |
486 | +CALL IXXXXX(P(0,2),zero,NHEL(2),+1*IC(2),W(1,2)) |
487 | +CALL IXXXXX(P(0,3),MX1,NHEL(3),-1*IC(3),W(1,3)) |
488 | +CALL OXXXXX(P(0,4),MX1,NHEL(4),+1*IC(4),W(1,4)) |
489 | +CALL FFV1_3(W(1,2),W(1,1),GAEE,zero, zero, W(1,5)) |
490 | +# Amplitude(s) for diagram number 1 |
491 | +CALL FFV2C1_0(W(1,3),W(1,4),W(1,5),GAXX,AMP(1)) |
492 | +CALL FFS1C1_3(W(1,3),W(1,1),GEXV,Msve, Wsve, W(1,6)) |
493 | +# Amplitude(s) for diagram number 2 |
494 | +CALL FFS1_0(W(1,2),W(1,4),W(1,6),GEXV,AMP(2))""") |
495 | |
496 | |
497 | def test_export_majorana_decay_chain(self): |
498 | @@ -6724,8 +6890,8 @@ |
499 | myinterlist.append(base_objects.Interaction({ |
500 | 'id': 7, |
501 | 'particles': base_objects.ParticleList(\ |
502 | - [eminus, \ |
503 | - eplus, \ |
504 | + [eplus, \ |
505 | + eminus, \ |
506 | a]), |
507 | 'color': [], |
508 | 'lorentz':[''], |
509 | @@ -8198,8 +8364,6 @@ |
510 | |
511 | result = myfortranmodel.get_matrix_element_calls(matrix_element) |
512 | |
513 | - #print "\n".join(result) |
514 | - |
515 | goal = """CALL IXXXXX(P(0,1),zero,NHEL(1),+1*IC(1),W(1,1)) |
516 | CALL IXXXXX(P(0,2),zero,NHEL(2),+1*IC(2),W(1,2)) |
517 | CALL OXXXXX(P(0,3),mn2,NHEL(3),+1*IC(3),W(1,3)) |
518 | |
519 | === modified file 'tests/unit_tests/iolibs/test_helas_call_writers.py' |
520 | --- tests/unit_tests/iolibs/test_helas_call_writers.py 2011-05-16 19:41:08 +0000 |
521 | +++ tests/unit_tests/iolibs/test_helas_call_writers.py 2012-01-26 10:43:23 +0000 |
522 | @@ -104,14 +104,14 @@ |
523 | antid.set('is_part', False) |
524 | |
525 | # A electron and positron |
526 | - mypartlist.append(base_objects.Particle({'name':'e+', |
527 | - 'antiname':'e-', |
528 | + mypartlist.append(base_objects.Particle({'name':'e-', |
529 | + 'antiname':'e+', |
530 | 'spin':2, |
531 | 'color':1, |
532 | 'mass':'me', |
533 | 'width':'zero', |
534 | - 'texname':'e^+', |
535 | - 'antitexname':'e^-', |
536 | + 'texname':'e^-', |
537 | + 'antitexname':'e^+', |
538 | 'line':'straight', |
539 | 'charge':-1., |
540 | 'pdg_code':11, |
541 | @@ -251,8 +251,8 @@ |
542 | myinterlist.append(base_objects.Interaction({ |
543 | 'id': 3, |
544 | 'particles': base_objects.ParticleList(\ |
545 | - [u, \ |
546 | - antiu, \ |
547 | + [antiu, \ |
548 | + u, \ |
549 | g]), |
550 | 'color': [], |
551 | 'lorentz':[''], |
552 | @@ -262,8 +262,8 @@ |
553 | myinterlist.append(base_objects.Interaction({ |
554 | 'id': 4, |
555 | 'particles': base_objects.ParticleList(\ |
556 | - [d, \ |
557 | - antid, \ |
558 | + [antid, \ |
559 | + d, \ |
560 | a]), |
561 | 'color': [], |
562 | 'lorentz':[''], |
563 | @@ -273,8 +273,8 @@ |
564 | myinterlist.append(base_objects.Interaction({ |
565 | 'id': 10, |
566 | 'particles': base_objects.ParticleList(\ |
567 | - [d, \ |
568 | - antid, \ |
569 | + [antid, \ |
570 | + d, \ |
571 | g]), |
572 | 'color': [], |
573 | 'lorentz':[''], |
574 | @@ -284,8 +284,8 @@ |
575 | myinterlist.append(base_objects.Interaction({ |
576 | 'id': 11, |
577 | 'particles': base_objects.ParticleList(\ |
578 | - [u, \ |
579 | - antiu, \ |
580 | + [antiu, \ |
581 | + u, \ |
582 | a]), |
583 | 'color': [], |
584 | 'lorentz':[''], |
585 | @@ -321,8 +321,8 @@ |
586 | myinterlist.append(base_objects.Interaction({ |
587 | 'id': 7, |
588 | 'particles': base_objects.ParticleList(\ |
589 | - [eminus, \ |
590 | - eplus, \ |
591 | + [eplus, \ |
592 | + eminus, \ |
593 | a]), |
594 | 'color': [], |
595 | 'lorentz':[''], |
596 | @@ -543,9 +543,9 @@ |
597 | """Test automatic generation of wavefunction and amplitude calls""" |
598 | |
599 | goal = [ \ |
600 | - 'CALL IXXXXX(P(0,1),me,NHEL(1),+1*IC(1),W(1,1))', |
601 | - 'CALL OXXXXX(P(0,2),me,NHEL(2),-1*IC(2),W(1,2))', |
602 | - 'CALL VXXXXX(P(0,3),zero,NHEL(3),-1*IC(3),W(1,3))', |
603 | + 'CALL IXXXXX(P(0,1),me,NHEL(1),-1*IC(1),W(1,1))', |
604 | + 'CALL OXXXXX(P(0,2),me,NHEL(2),+1*IC(2),W(1,2))', |
605 | + 'CALL VXXXXX(P(0,3),zero,NHEL(3),+1*IC(3),W(1,3))', |
606 | 'CALL FVOXXX(W(1,2),W(1,3),MGVX12,me,zero,W(1,1))', |
607 | 'CALL FVIXXX(W(1,1),W(1,3),MGVX12,me,zero,W(1,2))', |
608 | 'CALL JIOXXX(W(1,1),W(1,2),MGVX12,zero,zero,W(1,3))', |
609 | @@ -569,15 +569,15 @@ |
610 | |
611 | myleglist = base_objects.LegList() |
612 | |
613 | + myleglist.append(base_objects.Leg({'id':-11, |
614 | + 'number': 1, |
615 | + 'state':True})) |
616 | myleglist.append(base_objects.Leg({'id':11, |
617 | - 'number': 1, |
618 | - 'state':False})) |
619 | - myleglist.append(base_objects.Leg({'id':-11, |
620 | 'number': 2, |
621 | - 'state':False})) |
622 | + 'state':True})) |
623 | myleglist.append(base_objects.Leg({'id':22, |
624 | 'number': 3, |
625 | - 'state':False})) |
626 | + 'state':True})) |
627 | |
628 | wfs = helas_objects.HelasWavefunctionList(\ |
629 | [ helas_objects.HelasWavefunction(leg, 7, |
I would suggest to add an automatic flipping between particle/ anti-particle to avoid the need of the C routine as much as possible. (I have one implemented, so I can put it here if you aggree.
The point is that this slows down (marginally) the creation of the pickle file (so only once)
and this prevents the C routine to be used in 99% of the case.