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

Proposed by Pierre Artoisenet
Status: Merged
Merged at revision: 258
Proposed branch: lp:~maddevelopers/mg5amcnlo/MadSpin_correctbug
Merge into: lp:mg5amcnlo/lts
Diff against target: 29 lines (+11/-2)
1 file modified
MadSpin/decay.py (+11/-2)
To merge this branch: bzr merge lp:~maddevelopers/mg5amcnlo/MadSpin_correctbug
Reviewer Review Type Date Requested Status
Olivier Mattelaer Needs Fixing
Review via email: mp+238311@code.launchpad.net

Description of the change

Hi Olivier,

This is the correction to the bug

https://bugs.launchpad.net/bugs/1378925

For some reason the status of the random generator was not properly
written down before each termination of the fortran code in the unweighting mode.

I have checked that the ranmar state is properly written down in this version.
Following Markus suggestion, I also set the max number of calculators to a low number
and check the absence of spikes in the distributions (for pp > tt~ j, all decay channels)

Cheers,
Pierre

To post a comment you must log in.
258. By <email address hidden>

small correction

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

Hi Pierre,

I agree that your fix is working, but I think that we need to slightly secure it for the random seed problem in the future.

So here is my suggestions:
1) add an check that the routine "calculate_matrix_element"
is only use in mode "decay"
i.e.
replace the lines:
        if mode == 'prod':
            info = int(external.stdout.readline())
            nb_output = abs(info)+1
        else:
            info = 1
            nb_output = 1
by
        if mode != 'prod':
            raise Exception, "Mode not supported anymore in this function (not save for seed)"
        info = 1
        nb_output = 1
2) having a nice treatment of that part as well.

This is of course very small but will make me sleep better ;-)

Cheers,

Olivier

review: Needs Fixing

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'MadSpin/decay.py'
2--- MadSpin/decay.py 2014-09-17 09:53:23 +0000
3+++ MadSpin/decay.py 2014-10-16 13:08:38 +0000
4@@ -3221,14 +3221,23 @@
5 helicities=[lastline[i] for i in range(len(lastline))]
6 output = trials, BWvalue, weight, momenta, failed, use_mc_masses, helicities
7
8- if len(self.calculator) > 100:
9- logger.debug('more than 100 calculator. Perform cleaning')
10+ if len(self.calculator) > self.options['max_running_process']:
11+ logger.debug('more than %s calculators. Perform cleaning' % self.options['max_running_process'])
12 nb_calls = self.calculator_nbcall.values()
13 nb_calls.sort()
14 cut = max([nb_calls[len(nb_calls)//2], 0.001 * nb_calls[-1]])
15 for key, external in list(self.calculator.items()):
16 nb = self.calculator_nbcall[key]
17 if nb < cut:
18+ if key[0]=='full':
19+ path=key[1]
20+ end_signal="5 0 0 0 \n" # before closing, write down the seed
21+ external.stdin.write(end_signal)
22+ ranmar_state=external.stdout.readline()
23+ ranmar_file=pjoin(path,'ranmar_state.dat')
24+ ranmar=open(ranmar_file, 'w')
25+ ranmar.write(ranmar_state)
26+ ranmar.close()
27 external.stdin.close()
28 external.stdout.close()
29 external.terminate()

Subscribers

People subscribed via source and target branches

to all changes: