~madteam/mg5amcnlo/series2.0

« back to all changes in this revision

Viewing changes to Template/MadWeight/Python/madweight.py

  • Committer: olivier-mattelaer
  • Date: 2020-08-21 09:16:56 UTC
  • mfrom: (284.2.24 python3)
  • Revision ID: olivier-mattelaer-20200821091656-iizux2mj94tkssuo
pass to 2.8.0 (and move to python3 branch)

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
 
7
7
 
8
8
#Extension
 
9
from __future__ import absolute_import
 
10
from __future__ import print_function
9
11
import string
10
12
import sys
11
13
import os
12
14
import re
13
15
import time
14
16
import stat
 
17
from six.moves import input
15
18
# patch if symbolic directory replace by real file
16
19
sys.path.append('./Source/MadWeight/Python')
17
20
sys.path.append('../Source/MadWeight/Python')
37
40
def Launch_all_SubProcess(MWparam):
38
41
 
39
42
    name=MWparam.name
40
 
    print 'name :',name
 
43
    print('name :',name)
41
44
    P_proclist,MW_proclist=MWparam.P_listdir,MWparam.MW_listdir
42
45
    #create banner
43
46
    if MWparam.run_opt['launch']:
46
49
        banner.write()
47
50
 
48
51
    if MWparam.run_opt['compilation']:
49
 
        print 'starting program compilation'
 
52
        print('starting program compilation')
50
53
        compile_SubProcesses(MW_proclist)
51
54
            
52
55
    if MWparam.run_opt['event']:
53
56
        verif_event(MWparam)
54
57
 
55
58
    if MWparam.run_opt['refine']:
56
 
        print "collecting data to find data with a precision less than",MWparam.run_opt['refine']
 
59
        print("collecting data to find data with a precision less than",MWparam.run_opt['refine'])
57
60
        collect_schedular(MWparam)          
58
61
 
59
62
 
62
65
    cluster.driver()
63
66
 
64
67
    if MWparam.run_opt['collect']:
65
 
        print "collecting data"
 
68
        print("collecting data")
66
69
        collect_schedular(MWparam)          
67
70
 
68
71
 
90
93
        if  os.path.isfile("./comp_madweight") and exit_status==0 :
91
94
            os.chdir("..")
92
95
        else:
93
 
            print "fortran compilation error"
 
96
            print("fortran compilation error")
94
97
            sys.exit()
95
98
    os.chdir("..")   
96
99
    return
109
112
        if  os.path.isfile("./madevent") and exit_status==0:
110
113
            os.chdir("..")
111
114
        else:
112
 
            print "fortran compilation error"
 
115
            print("fortran compilation error")
113
116
            sys.exit()
114
117
    os.chdir("..")   
115
118
    return  
142
145
 
143
146
    for dir in MWparam.MW_listdir:
144
147
      if not os.path.exists("SubProcesses/"+dir+"/call_TF.f"): 
145
 
        print "Currently no transfer function loaded ..."
 
148
        print("Currently no transfer function loaded ...")
146
149
        listdir=os.listdir('./Source/MadWeight/transfer_function/data')
147
 
        print 'Available transfer functions:\n   ',
148
 
        print '\n    '.join([content[3:-4] for content in listdir if (content.startswith('TF') and content.endswith('dat'))])
149
 
        name=raw_input('Choose your transfer Function\n')
 
150
        print('Available transfer functions:\n   ', end=' ')
 
151
        print('\n    '.join([content[3:-4] for content in listdir if (content.startswith('TF') and content.endswith('dat'))]))
 
152
        name=input('Choose your transfer Function\n')
150
153
        P_dir,MW_dir=detect_SubProcess(P_mode=1)
151
154
        os.chdir('./Source/MadWeight/transfer_function')
152
155
        change_tf.create_TF_main(name,0,MW_dir)
153
 
        print os.getcwd()
 
156
        print(os.getcwd())
154
157
        os.chdir('../../..')
155
158
        break
156
159
 
173
176
            plot.Differential_Graph(MWparam,auto=1)        
174
177
 
175
178
    if MWparam.run_opt['clean']:
176
 
        print 'cleaning in progress ....'
 
179
        print('cleaning in progress ....')
177
180
        from clean import Clean_run
178
181
        if MWparam.run_opt['clean']==1:
179
182
            Clean_run(MWparam.name)