Merge lp:~maddevelopers/mg5amcnlo/3.3.1_new_merge into lp:mg5amcnlo

Proposed by Olivier Mattelaer
Status: Merged
Merged at revision: 970
Proposed branch: lp:~maddevelopers/mg5amcnlo/3.3.1_new_merge
Merge into: lp:mg5amcnlo
Diff against target: 1942 lines (+481/-227)
30 files modified
MadSpin/decay.py (+5/-5)
MadSpin/interface_madspin.py (+18/-8)
Template/NLO/Source/extra_weights.f (+1/-1)
Template/NLO/SubProcesses/add_write_info.f (+38/-30)
Template/NLO/SubProcesses/cluster.f (+19/-7)
Template/NLO/SubProcesses/driver_mintFO.f (+4/-0)
Template/NLO/SubProcesses/driver_mintMC.f (+4/-0)
Template/NLO/SubProcesses/fks_singular.f (+148/-29)
UpdateNotes.txt (+24/-2)
VERSION (+2/-2)
madgraph/interface/amcatnlo_interface.py (+10/-4)
madgraph/interface/amcatnlo_run_interface.py (+12/-14)
madgraph/interface/common_run_interface.py (+12/-12)
madgraph/interface/madevent_interface.py (+17/-7)
madgraph/interface/madgraph_interface.py (+16/-13)
madgraph/interface/reweight_interface.py (+3/-3)
madgraph/iolibs/export_fks.py (+33/-1)
madgraph/iolibs/export_v4.py (+1/-1)
madgraph/madevent/gen_ximprove.py (+2/-2)
madgraph/various/cluster.py (+27/-27)
madgraph/various/hepmc_parser.py (+7/-6)
madgraph/various/histograms.py (+5/-7)
madgraph/various/lhe_parser.py (+9/-8)
madgraph/various/misc.py (+30/-15)
madgraph/various/process_checks.py (+8/-8)
madgraph/various/systematics.py (+13/-6)
models/import_ufo.py (+1/-1)
tests/acceptance_tests/test_cmd_madevent.py (+8/-5)
tests/parallel_tests/test_cmd_amcatnlo.py (+2/-1)
tests/unit_tests/iolibs/test_export_fks.py (+2/-2)
To merge this branch: bzr merge lp:~maddevelopers/mg5amcnlo/3.3.1_new_merge
Reviewer Review Type Date Requested Status
Olivier Mattelaer Approve
Review via email: mp+412757@code.launchpad.net

Description of the change

Same as previous merge request, but should have less conflict (let see the diff)
plus it include the nice patch of marco for the coupling order issue.

To post a comment you must log in.
982. By olivier-mattelaer

bypass parralel test for jet veto cross-section

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

All good for me

review: Approve

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 2021-09-09 15:51:40 +0000
3+++ MadSpin/decay.py 2021-12-04 08:46:24 +0000
4@@ -3465,7 +3465,7 @@
5 path=key[1]
6 end_signal="5 0 0 0 0\n" # before closing, write down the seed
7 external.stdin.write(end_signal.encode())
8- ranmar_state=external.stdout.readline().decode()
9+ ranmar_state=external.stdout.readline().decode(errors='ignore')
10 ranmar_file=pjoin(path,'ranmar_state.dat')
11 ranmar=open(ranmar_file, 'w')
12 ranmar.write(ranmar_state)
13@@ -3512,7 +3512,7 @@
14
15 external.stdin.write(stdin_text.encode())
16 if mode == 'prod':
17- info = int(external.stdout.readline().decode())
18+ info = int(external.stdout.readline().decode(errors='ignore'))
19 nb_output = abs(info)+1
20 else:
21 info = 1
22@@ -3520,10 +3520,10 @@
23 std = []
24 for i in range(nb_output):
25 external.stdout.flush()
26- line = external.stdout.readline().decode()
27+ line = external.stdout.readline().decode(errors='ignore')
28 std.append(line)
29 prod_values = ' '.join(std)
30- #prod_values = ' '.join([external.stdout.readline().decode() for i in range(nb_output)])
31+ #prod_values = ' '.join([external.stdout.readline().decode(errors='ignore') for i in range(nb_output)])
32 if info < 0:
33 print('ZERO DETECTED')
34 print(prod_values)
35@@ -4106,7 +4106,7 @@
36 misc.sprint(error)
37 raise
38 continue
39- ranmar_state=external.stdout.readline().decode()
40+ ranmar_state=external.stdout.readline().decode(errors='ignore')
41 ranmar_file=pjoin(path,'ranmar_state.dat')
42 ranmar=open(ranmar_file, 'w')
43 ranmar.write(ranmar_state)
44
45=== modified file 'MadSpin/interface_madspin.py'
46--- MadSpin/interface_madspin.py 2021-08-12 21:08:18 +0000
47+++ MadSpin/interface_madspin.py 2021-12-04 08:46:24 +0000
48@@ -94,7 +94,9 @@
49 def post_set_seed(self, value, change_userdefine, raiseerror):
50 """ special handling for set seed """
51
52- random.seed(value)
53+ if not hasattr(random, 'mg_seedset'):
54+ random.seed(self['seed'])
55+ random.mg_seedset = self['seed']
56
57 ############################################################################
58 def post_set_run_card(self, value, change_userdefine, raiseerror, *opts):
59@@ -102,15 +104,21 @@
60
61 if value == 'default':
62 self.run_card = None
63+ elif not value:
64+ self.run_card = None
65 elif os.path.isfile(value):
66 self.run_card = banner.RunCard(value)
67-
68- args = value.split()
69- if len(args) >2:
70- if not self.options['run_card']:
71- self.run_card = banner.RunCardLO()
72- self.run_card.remove_all_cut()
73- self.run_card[args[0]] = ' '.join(args[1:])
74+ else:
75+ misc.sprint(value)
76+ args = value.split()
77+ if len(args) >1:
78+ if not hasattr(self, 'run_card'):
79+ misc.sprint("init run_card")
80+ self.run_card = banner.RunCardLO()
81+ self.run_card.remove_all_cut()
82+ self.run_card[args[0]] = ' '.join(args[1:])
83+ else:
84+ raise Exception("wrong syntax for \"set run_card %s\"" % value)
85
86
87 ############################################################################
88@@ -1278,6 +1286,8 @@
89 if self.options["run_card"]:
90 if hasattr(self, 'run_card'):
91 run_card = self.run_card
92+ elif hasattr(self.options, 'run_card'):
93+ run_card = self.options.run_card
94 else:
95 self.run_card = banner.RunCard(self.options["run_card"])
96 run_card = self.run_card
97
98=== modified file 'Template/NLO/Source/extra_weights.f'
99--- Template/NLO/Source/extra_weights.f 2020-11-27 13:41:46 +0000
100+++ Template/NLO/Source/extra_weights.f 2021-12-04 08:46:24 +0000
101@@ -12,7 +12,7 @@
102 double precision :: wgtdegrem_xi,wgtdegrem_lxi,wgtdegrem_muF
103 $ ,wgtnstmp,wgtwnstmpmuf,wgtwnstmpmur,wgtnstmp_avgvirt
104 $ ,wgtref,scalevarR(0:maxscales),scalevarF(0:maxscales)
105- $ ,wgtxsecmu(maxorders,maxscales,maxscales,maxdynscales)
106+ $ ,wgtxsecmu(0:maxorders,maxscales,maxscales,maxdynscales)
107 $ ,wgtxsecPDF(0:maxPDFs,maxPDFsets),wgtbpower,wgtcpower
108 $ ,veto_multiplier,H1_factor_virt,veto_compensating_factor
109 $ ,born_wgt_veto
110
111=== modified file 'Template/NLO/SubProcesses/add_write_info.f'
112--- Template/NLO/SubProcesses/add_write_info.f 2021-09-09 15:51:40 +0000
113+++ Template/NLO/SubProcesses/add_write_info.f 2021-12-04 08:46:24 +0000
114@@ -159,31 +159,44 @@
115 c set_itree subroutine does not properly set the t-channel info.
116 c
117 if (firsttime) then
118- save_nFKSprocess=nFKSprocess
119- do nFKSprocess=1,FKS_configs
120- call fks_inc_chooser()
121-c For the S-events
122- call set_itree(iconfig,.false.,itree_S_t,sprop_tree_S_t
123- $ ,pmass_tree_S_t,pwidth_tree_S_t)
124-c For the H-events
125- call set_itree(iconfig,.true.,itree_H_t,sprop_tree_H_t
126- $ ,pmass_tree_H_t,pwidth_tree_H_t)
127- do j=-max_branch,-1
128- itree_H(1,j,nFKSprocess)=itree_H_t(1,j)
129- itree_H(2,j,nFKSprocess)=itree_H_t(2,j)
130- sprop_tree_H(j,nFKSprocess)=sprop_tree_H_t(j)
131- pmass_tree_H(j,nFKSprocess)=pmass_tree_H_t(j)
132- pwidth_tree_H(j,nFKSprocess)=pwidth_tree_H_t(j)
133- itree_S(1,j,nFKSprocess)=itree_S_T(1,j)
134- itree_S(2,j,nFKSprocess)=itree_S_t(2,j)
135- sprop_tree_S(j,nFKSprocess)=sprop_tree_S_t(j)
136- pmass_tree_S(j,nFKSprocess)=pmass_tree_S_t(j)
137- pwidth_tree_S(j,nFKSprocess)=pwidth_tree_S_t(j)
138- enddo
139- enddo
140- firsttime=.false.
141- nFKSprocess=save_nFKSprocess
142- call fks_inc_chooser()
143+ if (firsttime2) then
144+c For the S-events
145+ save_nFKSprocess=nFKSprocess
146+ do nFKSprocess=1,FKS_configs
147+ call fks_inc_chooser()
148+ call set_itree(iconfig,.false.,itree_S_t,sprop_tree_S_t
149+ $ ,pmass_tree_S_t,pwidth_tree_S_t)
150+ do j=-max_branch,-1
151+ itree_S(1,j,nFKSprocess)=itree_S_T(1,j)
152+ itree_S(2,j,nFKSprocess)=itree_S_t(2,j)
153+ sprop_tree_S(j,nFKSprocess)=sprop_tree_S_t(j)
154+ pmass_tree_S(j,nFKSprocess)=pmass_tree_S_t(j)
155+ pwidth_tree_S(j,nFKSprocess)=pwidth_tree_S_t(j)
156+ enddo
157+ enddo
158+ firsttime2=.false.
159+ nFKSprocess=save_nFKSprocess
160+ call fks_inc_chooser()
161+ endif
162+ if (Hevents) then
163+c For the H-events
164+ save_nFKSprocess=nFKSprocess
165+ do nFKSprocess=1,FKS_configs
166+ call fks_inc_chooser()
167+ call set_itree(iconfig,.true.,itree_H_t,sprop_tree_H_t
168+ $ ,pmass_tree_H_t,pwidth_tree_H_t)
169+ do j=-max_branch,-1
170+ itree_H(1,j,nFKSprocess)=itree_H_t(1,j)
171+ itree_H(2,j,nFKSprocess)=itree_H_t(2,j)
172+ sprop_tree_H(j,nFKSprocess)=sprop_tree_H_t(j)
173+ pmass_tree_H(j,nFKSprocess)=pmass_tree_H_t(j)
174+ pwidth_tree_H(j,nFKSprocess)=pwidth_tree_H_t(j)
175+ enddo
176+ enddo
177+ firsttime=.false.
178+ nFKSprocess=save_nFKSprocess
179+ call fks_inc_chooser()
180+ endif
181 endif
182 c Copy the saved information to the arrays actually used
183 if (Hevents) then
184@@ -240,11 +253,6 @@
185 do i=1,nexternal
186 jpart(7,i)=9
187 enddo
188- if (firsttime2 .and. isum_hel.ne.0) then
189- write (*,*) 'WARNING: for writing the events, no helicity '//
190- & 'info is used even though some info could be available.'
191- firsttime2=.false.
192- endif
193 c Can be filled when doing MC over helicities...
194 c$$$ read(hel_buf,'(15i5)') (jpart(7,i),i=1,nexternal)
195
196
197=== modified file 'Template/NLO/SubProcesses/cluster.f'
198--- Template/NLO/SubProcesses/cluster.f 2021-10-08 06:49:39 +0000
199+++ Template/NLO/SubProcesses/cluster.f 2021-12-04 08:46:24 +0000
200@@ -269,17 +269,19 @@
201 imo=cluster_pdg(0,ibr)
202 ico=get_color(imo)
203 mass=get_mass_from_id(imo)
204- call set_particle_type(cluster_type(iclus),ico,mass)
205+ call set_particle_type(cluster_type(iclus),ico,mass,.false.)
206 enddo
207 return
208 end
209
210- subroutine set_particle_type(itype,ico,mass)
211+ subroutine set_particle_type(itype,ico,mass,ext)
212 c Based on the colour (ico) and mass of the particle, use a binary
213-c labeling for the particle-type.
214+c labeling for the particle-type. Colour singlets are always treated as
215+c massive, except when they are external particles (ie., ext=.true.).
216 implicit none
217 integer ico,itype
218 double precision mass
219+ logical ext
220 if (ico.eq.8 .and. mass.eq.0d0) then
221 if (.not.btest(itype,0))
222 $ itype = itype+1
223@@ -289,10 +291,14 @@
224 elseif (abs(ico).eq.3 .and. mass.ne.0d0 ) then
225 if (.not.btest(itype,2))
226 $ itype = itype+4
227- elseif (abs(ico).eq.1 .and. mass.eq.0d0) then
228+ elseif (abs(ico).eq.1 .and. mass.eq.0d0 .and. ext) then
229 if (.not.btest(itype,3))
230 $ itype = itype+8
231- elseif (abs(ico).eq.1 .and. mass.ne.0d0) then
232+ elseif (abs(ico).eq.1) then
233+! for intermediate colour singlets, we do not care if it is
234+! massive or not (they should always be far enough
235+! off-shell). Treat them always as massive to avoid issues with
236+! Z/gamma^* interference.
237 if (.not.btest(itype,4))
238 $ itype = itype+16
239 else
240@@ -340,7 +346,7 @@
241 particle_type(i)=0
242 ico=get_color(ipdg(i))
243 mass=get_mass_from_id(ipdg(i))
244- call set_particle_type(particle_type(i),ico,mass)
245+ call set_particle_type(particle_type(i),ico,mass,.true.)
246 enddo
247 c Set all diagrams (according to which we cluster) as valid
248 call reset_valid_confs(nconf,nvalid,valid_conf)
249@@ -1183,7 +1189,7 @@
250 do i=0,2
251 if (popcnt(cl(i)).gt.1) then
252 write (*,*) 'more than one possibility for clustering'
253- $ ,cl(i)
254+ $ ,i,cl(i)
255 stop 1
256 endif
257 enddo
258@@ -1204,6 +1210,12 @@
259 end
260
261 subroutine get_clustering_type(cl,itype)
262+ ! This sets the type of clustering based on the masses of the
263+ ! particles involved. If need be, this can be extended to include
264+ ! colour information: the latter is already available in the cl()
265+ ! array. Note that internal colour singlets are always treated as
266+ ! massive particles in the cl() array (set by the
267+ ! set_particle_type() subroutine).
268 implicit none
269 integer cl(0:2),itype
270 if ( (btest(cl(0),0).or.btest(cl(0),1).or.btest(cl(0),3)) .and.
271
272=== modified file 'Template/NLO/SubProcesses/driver_mintFO.f'
273--- Template/NLO/SubProcesses/driver_mintFO.f 2021-11-02 08:58:23 +0000
274+++ Template/NLO/SubProcesses/driver_mintFO.f 2021-12-04 08:46:24 +0000
275@@ -498,6 +498,10 @@
276 c Include PDFs and alpha_S and reweight to include the uncertainties
277 if (ickkw.eq.-1) call include_veto_multiplier
278 call include_PDF_and_alphas
279+
280+c Include the bias weight specified in the bias_weight_function
281+ call include_bias_wgt
282+
283 if (doreweight) then
284 if (do_rwgt_scale .and. ickkw.ne.-1) call reweight_scale
285 if (do_rwgt_scale .and. ickkw.eq.-1) call reweight_scale_NNLL
286
287=== modified file 'Template/NLO/SubProcesses/driver_mintMC.f'
288--- Template/NLO/SubProcesses/driver_mintMC.f 2021-11-02 08:58:23 +0000
289+++ Template/NLO/SubProcesses/driver_mintMC.f 2021-12-04 08:46:24 +0000
290@@ -748,6 +748,10 @@
291 else
292 jac=0.5d0
293 endif
294+c Also the Born needs to be included in the Importance Sampling over the
295+c FKS configurations (for the shower scale) (multiply by
296+c 1/proc_map(0,0)*vol1)
297+ jac=jac/(proc_map(0,0)*vol1)
298 call generate_momenta(nndim,iconfig,jac,x,p)
299 if (p_born(0,1).lt.0d0) goto 12
300 call compute_prefactors_nbody(vegas_wgt)
301
302=== modified file 'Template/NLO/SubProcesses/fks_singular.f'
303--- Template/NLO/SubProcesses/fks_singular.f 2021-11-02 08:58:23 +0000
304+++ Template/NLO/SubProcesses/fks_singular.f 2021-12-04 08:46:24 +0000
305@@ -2604,7 +2604,7 @@
306 stop
307 endif
308 do j=1,iwgt
309- www(j)=plot_wgts(j,i)
310+ www(j)=plot_wgts(j,i)/bias_wgt(i)
311 enddo
312 c call the analysis/histogramming routines
313 orders_tag_plot=orderstag(i)
314@@ -2817,40 +2817,69 @@
315 return
316 end
317
318+
319 subroutine update_shower_scale_Sevents
320 c When contributions from various FKS configrations are summed together
321 c for the S-events (see the sum_identical_contributions subroutine), we
322 c need to update the shower starting scale (because it is not
323-c necessarily the same for all of these summed FKS configurations). Take
324-c the weighted average over the FKS configurations as the shower scale
325-c for the summed contribution.
326+c necessarily the same for all of these summed FKS configurations and/or
327+c folds).
328+ use weight_lines
329+ implicit none
330+ integer i
331+ double precision showerscale
332+ logical improved_scale_choice
333+ parameter (improved_scale_choice=.true.)
334+ if (icontr.eq.0) return
335+ if (.not. improved_scale_choice) then
336+ call update_shower_scale_Sevents_v1(showerscale)
337+ else
338+ call update_shower_scale_Sevents_v2(showerscale)
339+ endif
340+c Overwrite the shower scale for the S-events
341+ do i=1,icontr
342+ if (H_event(i)) cycle
343+ if (icontr_sum(0,i).ne.0) shower_scale(i)= showerscale
344+ enddo
345+ return
346+ end
347+
348+ subroutine update_shower_scale_Sevents_v1(showerscale)
349+c Original way of assigning shower starting scales. This is for backward
350+c compatibility. It picks a fold randomly, based on the weight of the
351+c fold to the sum over all folds. Within a fold, take the weighted
352+c average of shower scales for the FKS configurations.
353 use weight_lines
354 implicit none
355 include 'nexternal.inc'
356 include 'nFKSconfigs.inc'
357- integer i,j,ict
358- double precision tmp_wgt(fks_configs),showerscale(fks_configs)
359- $ ,temp_wgt,shsctemp
360- do i=1,fks_configs
361- tmp_wgt(i)=0d0
362- showerscale(i)=-1d0
363+ integer i,j,ict,iFKS
364+ double precision tmp_wgt(fks_configs),ran2,target
365+ $ ,tmp_scale(fks_configs),showerscale,temp_wgt,shsctemp
366+ $ ,temp_wgt_sum
367+ external ran2
368+ do iFKS=1,fks_configs
369+ tmp_wgt(iFKS)=0d0
370+ tmp_scale(iFKS)=-1d0
371 enddo
372-c sum the weights that contribute to a single FKS configuration.
373+c sum the weights that contribute to a single FKS configuration for each
374+c fold.
375 do i=1,icontr
376 if (H_event(i)) cycle
377 if (icontr_sum(0,i).eq.0) cycle
378 do j=1,icontr_sum(0,i)
379 ict=icontr_sum(j,i)
380- tmp_wgt(nFKS(ict))=tmp_wgt(nFKS(ict))+wgts(1,i)
381- if (showerscale(nFKS(ict)).eq.-1d0) then
382- showerscale(nFKS(ict))=shower_scale(ict)
383+ tmp_wgt(nFKS(ict))=tmp_wgt(nFKS(ict))+
384+ $ wgts(1,i)
385+ if (tmp_scale(nFKS(ict)).eq.-1d0) then
386+ tmp_scale(nFKS(ict))=shower_scale(ict)
387 c check that all the shower starting scales are identical for all the
388-c contribution to a given FKS configuration.
389- elseif ( abs((showerscale(nFKS(ict))-shower_scale(ict))
390- $ /(showerscale(nFKS(ict))+shower_scale(ict)))
391- $ .gt. 1d-6 ) then
392- write (*,*) 'ERROR in update_shower_scale_Sevents'
393- $ ,showerscale(nFKS(ict)),shower_scale(ict)
394+c contribution to a given FKS configuration and fold.
395+ elseif(abs((tmp_scale(nFKS(ict))-shower_scale(ict))
396+ $ /(tmp_scale(nFKS(ict))+shower_scale(ict)))
397+ $ .gt. 1d-6 ) then
398+ write (*,*) 'ERROR in update_shower_scale_Sevents #1'
399+ $ ,tmp_scale(nFKS(ict)),shower_scale(ict)
400 stop 1
401 endif
402 enddo
403@@ -2859,24 +2888,114 @@
404 c the ABS cross section to given FKS configuration.
405 temp_wgt=0d0
406 shsctemp=0d0
407- do i=1,fks_configs
408- temp_wgt=temp_wgt+abs(tmp_wgt(i))
409- shsctemp=shsctemp+abs(tmp_wgt(i))*showerscale(i)
410+ do iFKS=1,fks_configs
411+ temp_wgt=temp_wgt+abs(tmp_wgt(iFKS))
412+ shsctemp=shsctemp+abs(tmp_wgt(iFKS))
413+ $ *tmp_scale(iFKS)
414 enddo
415- if (temp_wgt.ne.0d0) then
416- shsctemp=shsctemp/temp_wgt
417+ if (temp_wgt.eq.0d0) then
418+ showerscale=0d0
419 else
420- shsctemp=0d0
421+ showerscale=shsctemp/temp_wgt
422 endif
423-c Overwrite the shower scale for the S-events
424+ return
425+ end
426+
427+
428+ subroutine update_shower_scale_Sevents_v2(showerscale)
429+c Improved way of assigning shower starting scales. Pick an FKS
430+c configuration randomly, weighted by its contribution without including
431+c the born (and nbody_noborn) contributions. (If there are only born
432+c (and nbody_noborn) contributions, use the weights of those instead).
433+ use weight_lines
434+ implicit none
435+ include 'nexternal.inc'
436+ include 'nFKSconfigs.inc'
437+ integer i,j,ict,iFKS
438+ double precision wgt_fks(fks_configs),wgt_fks_born(fks_configs)
439+ $ ,ran2,target,tmp_scale(fks_configs),showerscale,wgt_sum
440+ $ ,wgt_accum
441+ external ran2
442+ do iFKS=1,fks_configs
443+ wgt_fks(iFKS)=0d0
444+ wgt_fks_born(iFKS)=0d0
445+ tmp_scale(iFKS)=-1d0
446+ enddo
447+c Collect the weights that contribute to a given FKS configuration.
448 do i=1,icontr
449 if (H_event(i)) cycle
450- if (icontr_sum(0,i).ne.0) shower_scale(i)=shsctemp
451- enddo
452+ if (icontr_sum(0,i).eq.0) cycle
453+ do j=1,icontr_sum(0,i)
454+ ict=icontr_sum(j,i)
455+ if ( itype(ict).ne.2 .and. itype(ict).ne.3 .and.
456+ $ itype(ict).ne.7 .and. itype(ict).ne.14 .and.
457+ $ itype(ict).ne.15) then
458+ wgt_fks(nFKS(ict)) = wgt_fks(nFKS(ict))+wgts(1,ict)
459+ else
460+ wgt_fks_born(nFKS(ict)) =
461+ $ wgt_fks_born(nFKS(ict))+wgts(1,ict)
462+ endif
463+ if (tmp_scale(nFKS(ict)).eq.-1d0) then
464+ tmp_scale(nFKS(ict))=shower_scale(ict)
465+c check that all the shower starting scales are identical for all the
466+c contribution to a given FKS configuration.
467+ elseif(abs((tmp_scale(nFKS(ict))-shower_scale(ict))
468+ $ /(tmp_scale(nFKS(ict))+shower_scale(ict)))
469+ $ .gt. 1d-6 ) then
470+ write (*,*) 'ERROR in update_shower_scale_Sevents #2'
471+ $ ,tmp_scale(nFKS(ict)),shower_scale(ict)
472+ stop 1
473+ endif
474+ enddo
475+ enddo
476+c Check to find the FKS configurations and the corresponding shower
477+c starting scale. Pick one randomly based on the weight for that FKS
478+c configuration (in the weight, the born and nbody_noborn should not be
479+c included since those are always assigned to the FKS configuration
480+c corresponding to a soft singularity. Therefore, including them would
481+c bias the chosen scale to that configuration.)
482+ wgt_sum=0d0
483+ do iFKS=1,fks_configs
484+ wgt_sum=wgt_sum+abs(wgt_fks(iFKS))
485+ enddo
486+ if (wgt_sum.ne.0d0) then
487+ target=wgt_sum*ran2()
488+ wgt_accum=0d0
489+ do iFKS=1,fks_configs
490+ wgt_accum=wgt_accum+abs(wgt_fks(iFKS))
491+ if (wgt_accum.gt.target) exit
492+ enddo
493+ if (iFKS.lt.1 .or. iFKS.gt.fks_configs) then
494+ write (*,*) 'ERROR in update_shower_starting scale #3',iFKS
495+ $ ,fks_configs,target,wgt_accum,wgt_sum
496+ stop 1
497+ endif
498+ else
499+c this fold has only born or nbody no-born contributions. Use those
500+c instead.
501+ wgt_sum=0d0
502+ do iFKS=1,fks_configs
503+ wgt_sum=wgt_sum+abs(wgt_fks_born(iFKS))
504+ enddo
505+ if (wgt_sum.eq.0d0) return
506+ target=wgt_sum*ran2()
507+ wgt_accum=0d0
508+ do iFKS=1,fks_configs
509+ wgt_accum=wgt_accum+abs(wgt_fks_born(iFKS))
510+ if (wgt_accum.gt.target) exit
511+ enddo
512+ if (iFKS.lt.1 .or. iFKS.gt.fks_configs) then
513+ write (*,*) 'ERROR in update_shower_starting scale #4',iFKS
514+ $ ,fks_configs,target,wgt_accum,wgt_sum
515+ stop 1
516+ endif
517+ endif
518+ showerscale=tmp_scale(iFKS)
519 return
520 end
521
522
523+
524 subroutine fill_mint_function_NLOPS(f,n1body_wgt)
525 c Fills the function that is returned to the MINT integrator. Depending
526 c on the imode we should or should not include the virtual corrections.
527
528=== modified file 'UpdateNotes.txt'
529--- UpdateNotes.txt 2021-11-12 09:29:31 +0000
530+++ UpdateNotes.txt 2021-12-04 08:46:24 +0000
531@@ -1,5 +1,14 @@
532 Update notes for MadGraph5_aMC@NLO (in reverse time order)
533
534+
535+3.3.1 (XX/XX/XX)
536+ RF: Fix for bug #1928364 related to the new FxFx clustering routines.
537+ OM: Fix for bug #1952050 systematics/reweighting run at NLO that was broken
538+ introduced in 3.3.0
539+ OM: Fix bug related to python 3.10
540+ OM: Fix bug when running from the process directory
541+ all: include all bug fix from the LTS version (2.9.7)
542+
543 3.3.0 (12/11/21)
544 DP+HS+IT+MZ: EW corrections can be computed for tagged photons
545 OM+RR+AC: Implementation of EWA within MG5aMC (PDF for W/Z boson out of lepton beam)
546@@ -63,6 +72,20 @@
547
548 ** Long Term Stable Update **
549
550+2.9.7 (29/11/21)
551+ OM: Fix the behavior of python seed for madevent/madwidth/mcatnlo/madspin
552+ Now the first of those to setup a python seed will forbid any future reset of the seed
553+ Frequent reset of the seed when moving to one package to the next was creating
554+ a bias in the effective branching ratio out of madspin (observed only of NLO sample)
555+ see: https://bugs.launchpad.net/mg5amcnlo/+bug/1951120
556+ Thanks Hannes for the information.
557+ RF+PT+SF: Fixed a 10-year-old bug that was there in the importance sampling over the FKS configurations.
558+ - Fix to pick one shower scale for the S event at random among the FKS configurations,
559+ instead of taking the weighted average.
560+ - removed the n-body contributions from the random picking of the showerscale among FKS configurations.
561+ Those bugs were leading at an incorect pick of the shower scale. The observed impact is relatively small
562+ and occur in the matching region.
563+
564 2.9.6 (02/11/21)
565 OM: Forbid the possibity to ask for massless boson to be longitudinally polarised.
566 Asking for those with large multi-particle label could have hide the fact that the code
567@@ -83,7 +106,6 @@
568
569 2.9.5 (22/08/21)
570 OM+LM: [LO only] Fix the factorization scale dependence for lpp=2/3/4.
571-
572 This was claimed to be using fixed scale computation while
573 in some case the scale was dynamical
574 To have full flexibility we introduced two additional
575@@ -95,7 +117,7 @@
576 OM: fixing auto-width computation for 3 body decay and identical particle which was sometimes leading to crash
577 OM: Fix some potential infinite loop when running with python3
578
579-2.9.4(28/05/21)
580+2.9.4(30/05/21)
581 OM: Fix a python3 issue for madSpin when using in a gridpack mode (set ms_dir)
582 OM: Fix an issue for non positive definite matrix-element when using the
583 "set group_subprocesses False" mode of MG5aMc
584
585=== modified file 'VERSION'
586--- VERSION 2021-11-12 09:29:31 +0000
587+++ VERSION 2021-12-04 08:46:24 +0000
588@@ -1,5 +1,5 @@
589-version = 3.3.0
590-date = 2021-11-12
591+version = 3.3.1
592+date = 2021-12-06
593
594
595
596
597=== modified file 'madgraph/interface/amcatnlo_interface.py'
598--- madgraph/interface/amcatnlo_interface.py 2021-08-20 21:13:30 +0000
599+++ madgraph/interface/amcatnlo_interface.py 2021-12-04 08:46:24 +0000
600@@ -84,7 +84,7 @@
601 me = six.moves.cPickle.load(infile)
602 infile.close()
603
604- calls = curr_exporter.generate_directories_fks(me, curr_fortran_model, ime, nme, path, olpopts)
605+ calls, splitorders = curr_exporter.generate_directories_fks(me, curr_fortran_model, ime, nme, path, olpopts)
606
607 nexternal = curr_exporter.proc_characteristic['nexternal']
608 ninitial = curr_exporter.proc_characteristic['ninitial']
609@@ -98,9 +98,9 @@
610 if me.virt_matrix_element:
611 max_loop_vertex_rank = me.virt_matrix_element.get_max_loop_vertex_rank()
612 if six.PY2:
613- return [calls, curr_exporter.fksdirs, max_loop_vertex_rank, ninitial, nexternal, processes, max_n_matched_jets, splitting_types]
614+ return [calls, curr_exporter.fksdirs, max_loop_vertex_rank, ninitial, nexternal, processes, max_n_matched_jets, splitting_types, splitorders]
615 else:
616- return [calls, curr_exporter.fksdirs, max_loop_vertex_rank, ninitial, nexternal, None,max_n_matched_jets, splitting_types]
617+ return [calls, curr_exporter.fksdirs, max_loop_vertex_rank, ninitial, nexternal, None,max_n_matched_jets, splitting_types, splitorders]
618
619 class CheckFKS(mg_interface.CheckValidForCmd):
620
621@@ -830,6 +830,7 @@
622
623 ndiags, cpu_time = generate_matrix_elements(self, group=group_processes)
624 calls = 0
625+ splitorders = []
626
627 path = self._export_dir
628
629@@ -854,11 +855,13 @@
630 enumerate(self._curr_matrix_elements.get('matrix_elements')):
631 if not self.options['low_mem_multicore_nlo_generation']:
632 #me is a FKSHelasProcessFromReals
633- calls = calls + \
634+ calls_dir, splitorders_dir = \
635 self._curr_exporter.generate_directories_fks(me,
636 self._curr_helas_model,
637 ime, len(self._curr_matrix_elements.get('matrix_elements')),
638 path,self.options['OLP'])
639+ calls += calls_dir
640+ splitorders += [so for so in splitorders_dir if so not in splitorders]
641 self._fks_directories.extend(self._curr_exporter.fksdirs)
642 self.born_processes_for_olp.append(me.born_me.get('processes')[0])
643 self.born_processes.append(me.born_me.get('processes'))
644@@ -921,6 +924,7 @@
645 for diroutput in diroutputmap:
646 splitting_types = splitting_types.union(set(diroutput[7]))
647 calls = calls + diroutput[0]
648+ splitorders += [so for so in diroutput[8] if so not in splitorders]
649 self._fks_directories.extend(diroutput[1])
650 max_loop_vertex_ranks.append(diroutput[2])
651 if six.PY2:
652@@ -956,6 +960,8 @@
653 self._curr_exporter.write_maxproc_files(nmaxpdf,
654 os.path.join(path, os.path.pardir, 'SubProcesses'))
655
656+ self._curr_exporter.write_orderstag_file(splitorders, self._export_dir)
657+
658 cpu_time1 = time.time()
659
660
661
662=== modified file 'madgraph/interface/amcatnlo_run_interface.py'
663--- madgraph/interface/amcatnlo_run_interface.py 2021-11-10 09:25:45 +0000
664+++ madgraph/interface/amcatnlo_run_interface.py 2021-12-04 08:46:24 +0000
665@@ -2023,6 +2023,7 @@
666 event_norm=self.run_card['event_norm']
667 # gather the various orders tag and write include files (only needed once)
668 if not os.path.exists(pjoin(self.me_dir, 'SubProcesses', 'orderstags_glob.dat')):
669+ raise aMCatNLOError('Error, cannot find orderstag_glob.dat')
670 self.write_orders_tag_info()
671
672 return self.reweight_and_collect_events(options, mode, nevents, event_norm)
673@@ -2681,7 +2682,9 @@
674 # Randomly (based on the relative ABS Xsec of the job) determine the
675 # number of events each job needs to generate for MINT-step = 2.
676 r=self.get_randinit_seed()
677- random.seed(r)
678+ if not hasattr(random, 'mg_seedset'):
679+ random.seed(r)
680+ random.mg_seedset = r
681 totevts=nevents
682 for job in jobs:
683 job['nevents'] = 0
684@@ -3003,7 +3006,7 @@
685 p = misc.Popen(command, stdout = subprocess.PIPE, stderr = subprocess.STDOUT, cwd=self.me_dir)
686
687 while p.poll() is None:
688- line = p.stdout.readline().decode()
689+ line = p.stdout.readline().decode(errors='ignore')
690 #misc.sprint(type(line))
691 if any(t in line for t in ['INFO:','WARNING:','CRITICAL:','ERROR:','KEEP:']):
692 print(line[:-1])
693@@ -3773,7 +3776,7 @@
694 else:
695 out, err = p.communicate(input = '2\n'.encode())
696
697- out = out.decode()
698+ out = out.decode(errors='ignore')
699 data = str(out)
700 #get filename from collect events
701 filename = data.split()[-1].strip().replace('\\n','').replace('"','').replace("'",'')
702@@ -3843,7 +3846,7 @@
703 stdout=subprocess.PIPE, stderr=subprocess.PIPE)
704 output, error = p.communicate()
705 #remove the line break from output (last character)
706- output = output.decode()[:-1]
707+ output = output.decode(errors='ignore')[:-1]
708 # add lib/include paths
709 if not pjoin(output, 'lib') in self.shower_card['extrapaths']:
710 logger.warning('Linking FastJet: updating EXTRAPATHS')
711@@ -3893,7 +3896,7 @@
712 # add the HEPMC path of the pythia8 installation
713 if shower == 'PYTHIA8':
714 hepmc = subprocess.Popen([pjoin(self.options['pythia8_path'], 'bin', 'pythia8-config'), '--hepmc2'],
715- stdout = subprocess.PIPE).stdout.read().decode().strip()
716+ stdout = subprocess.PIPE).stdout.read().decode(errors='ignore').strip()
717 #this gives all the flags, i.e.
718 #-I/Path/to/HepMC/include -L/Path/to/HepMC/lib -lHepMC
719 # we just need the path to the HepMC libraries
720@@ -4611,7 +4614,7 @@
721 # shower_card).
722 self.link_lhapdf(pjoin(self.me_dir, 'lib'))
723 lhapdfpath = subprocess.Popen([self.options['lhapdf'], '--prefix'],
724- stdout = subprocess.PIPE).stdout.read().decode().strip()
725+ stdout = subprocess.PIPE).stdout.read().decode(errors='ignore').strip()
726 content += 'LHAPDFPATH=%s\n' % lhapdfpath
727 pdfsetsdir = self.get_lhapdf_pdfsetsdir()
728 if self.shower_card['pdfcode']==0:
729@@ -4634,7 +4637,7 @@
730 # set instead.
731 try:
732 lhapdfpath = subprocess.Popen([self.options['lhapdf'], '--prefix'],
733- stdout = subprocess.PIPE).stdout.read().decode().strip()
734+ stdout = subprocess.PIPE).stdout.read().decode(errors='ignore').strip()
735 self.link_lhapdf(pjoin(self.me_dir, 'lib'))
736 content += 'LHAPDFPATH=%s\n' % lhapdfpath
737 pdfsetsdir = self.get_lhapdf_pdfsetsdir()
738@@ -4711,7 +4714,7 @@
739 for evt_file in evt_files:
740 last_line = subprocess.Popen(['tail', '-n1', '%s.rwgt' % \
741 pjoin(self.me_dir, 'SubProcesses', evt_file)], \
742- stdout = subprocess.PIPE).stdout.read().decode().strip()
743+ stdout = subprocess.PIPE).stdout.read().decode(errors='ignore').strip()
744 if last_line != "</LesHouchesEvents>":
745 raise aMCatNLOError('An error occurred during reweighting. Check the' + \
746 '\'reweight_xsec_events.output\' files inside the ' + \
747@@ -4893,7 +4896,7 @@
748 try:
749 last_line = subprocess.Popen(
750 ['tail', '-n1', pjoin(job['dirname'], 'events.lhe')], \
751- stdout = subprocess.PIPE).stdout.read().decode().strip()
752+ stdout = subprocess.PIPE).stdout.read().decode(errors='ignore').strip()
753 except IOError:
754 pass
755 if last_line != "</LesHouchesEvents>":
756@@ -5240,11 +5243,6 @@
757 raise aMCatNLOError(('No valid %s installation found. \n' + \
758 'Please set the path to %s-config by using \n' + \
759 'MG5_aMC> set <absolute-path-to-%s>/bin/%s-config \n') % (code,code,code,code))
760- ##else:
761- ## output, _ = p.communicate()
762- ## if code is 'applgrid' and output < '1.4.63':
763- ## raise aMCatNLOError('Version of APPLgrid is too old. Use 1.4.69 or later.'\
764- ## +' You are using %s',output)
765 else:
766 self.make_opts_var['pineappl'] = ""
767
768
769=== modified file 'madgraph/interface/common_run_interface.py'
770--- madgraph/interface/common_run_interface.py 2021-11-08 08:25:41 +0000
771+++ madgraph/interface/common_run_interface.py 2021-12-04 08:46:24 +0000
772@@ -2092,7 +2092,7 @@
773 command.append('-from_cards')
774 p = misc.Popen(command, stdout = subprocess.PIPE, stderr = subprocess.STDOUT, cwd=os.getcwd())
775 while p.poll() is None:
776- line = p.stdout.readline().decode()
777+ line = p.stdout.readline().decode(errors='ignore')
778 if any(t in line for t in ['INFO:', 'WARNING:', 'CRITICAL:', 'ERROR:', 'root:','KEEP:']) and \
779 not '***********' in line:
780 print(line[:-1].replace('INFO', 'REWEIGHT').replace('KEEP:',''))
781@@ -4204,14 +4204,14 @@
782 lhapdf_version = self.get_lhapdf_version()
783 logger.info('Using LHAPDF v%s interface for PDFs' % lhapdf_version)
784 lhalibdir = subprocess.Popen([self.options['lhapdf'], '--libdir'],
785- stdout = subprocess.PIPE).stdout.read().decode().strip()
786+ stdout = subprocess.PIPE).stdout.read().decode(errors='ignore').strip()
787
788 if lhapdf_version.startswith('5.'):
789 pdfsetsdir = subprocess.Popen([self.options['lhapdf'], '--pdfsets-path'],
790- stdout = subprocess.PIPE).stdout.read().decode().strip()
791+ stdout = subprocess.PIPE).stdout.read().decode(errors='ignore').strip()
792 else:
793 pdfsetsdir = subprocess.Popen([self.options['lhapdf'], '--datadir'],
794- stdout = subprocess.PIPE).stdout.read().decode().strip()
795+ stdout = subprocess.PIPE).stdout.read().decode(errors='ignore').strip()
796
797 self.lhapdf_pdfsets = self.get_lhapdf_pdfsets_list(pdfsetsdir)
798 # link the static library in lib
799@@ -4536,7 +4536,7 @@
800 try:
801 lhapdf_version = \
802 subprocess.Popen([lhapdf_config, '--version'],
803- stdout = subprocess.PIPE).stdout.read().decode().strip()
804+ stdout = subprocess.PIPE).stdout.read().decode(errors='ignore').strip()
805 except OSError as error:
806 if error.errno == 2:
807 raise Exception( 'lhapdf executable (%s) is not found on your system. Please install it and/or indicate the path to the correct executable in input/mg5_configuration.txt' % lhapdf_config)
808@@ -4566,11 +4566,11 @@
809 datadir = os.environ['LHAPDF_DATA_PATH']
810 elif lhapdf_version.startswith('5.'):
811 datadir = subprocess.Popen([lhapdf_config, '--pdfsets-path'],
812- stdout = subprocess.PIPE).stdout.read().decode().strip()
813+ stdout = subprocess.PIPE).stdout.read().decode(errors='ignore').strip()
814
815 elif lhapdf_version.startswith('6.'):
816 datadir = subprocess.Popen([lhapdf_config, '--datadir'],
817- stdout = subprocess.PIPE).stdout.read().decode().strip()
818+ stdout = subprocess.PIPE).stdout.read().decode(errors='ignore').strip()
819
820 if ':' in datadir:
821 for totry in datadir.split(':'):
822@@ -4609,11 +4609,11 @@
823
824 if lhapdf_version.startswith('5.'):
825 libdir = subprocess.Popen([self.options['lhapdf-config'], '--libdir'],
826- stdout = subprocess.PIPE).stdout.read().decode().strip()
827+ stdout = subprocess.PIPE).stdout.read().decode(errors='ignore').strip()
828
829 elif lhapdf_version.startswith('6.'):
830 libdir = subprocess.Popen([self.options['lhapdf'], '--libs'],
831- stdout = subprocess.PIPE).stdout.read().decode().strip()
832+ stdout = subprocess.PIPE).stdout.read().decode(errors='ignore').strip()
833
834 return libdir
835
836@@ -6226,18 +6226,18 @@
837 libs , paths = [], []
838 p = misc.subprocess.Popen([executable, '--libs'], stdout=subprocess.PIPE)
839 stdout, _ = p. communicate()
840- libs = [x[2:] for x in stdout.decode().split() if x.startswith('-l') or paths.append(x[2:])]
841+ libs = [x[2:] for x in stdout.decode(errors='ignore').split() if x.startswith('-l') or paths.append(x[2:])]
842
843 # Add additional user-defined compilation flags
844 p = misc.subprocess.Popen([executable, '--config'], stdout=subprocess.PIPE)
845 stdout, _ = p. communicate()
846 for lib in ['-ldl','-lstdc++','-lc++']:
847- if lib in stdout.decode():
848+ if lib in stdout.decode(errors='ignore'):
849 libs.append(lib[2:])
850
851 # This precompiler flag is in principle useful for the analysis if it writes HEPMC
852 # events, but there is unfortunately no way for now to specify it in the shower_card.
853- supports_HEPMCHACK = '-DHEPMC2HACK' in stdout.decode()
854+ supports_HEPMCHACK = '-DHEPMC2HACK' in stdout.decode(errors='ignore')
855
856 #3. ensure that those flag are in the shower card
857 for L in paths:
858
859=== modified file 'madgraph/interface/madevent_interface.py'
860--- madgraph/interface/madevent_interface.py 2021-11-02 14:19:01 +0000
861+++ madgraph/interface/madevent_interface.py 2021-12-04 08:46:24 +0000
862@@ -3857,7 +3857,7 @@
863 stdout=subprocess.PIPE, stderr=subprocess.PIPE,
864 cwd=mg5amc_py8_interface_path)
865 (out, err) = p.communicate()
866- out = out.decode().replace('\n','')
867+ out = out.decode(errors='ignore').replace('\n','')
868 PY8_curr_version = out
869 # In order to test that the version is correctly formed, we try to cast
870 # it to a float
871@@ -5613,10 +5613,14 @@
872 #set random seed for python part of the code
873 if self.run_card['python_seed'] == -2: #-2 means same as run_card
874 import random
875- random.seed(self.random)
876+ if not hasattr(random, 'mg_seedset'):
877+ random.seed(self.run_card['python_seed'])
878+ random.mg_seedset = self.run_card['python_seed']
879 elif self.run_card['python_seed'] >= 0:
880 import random
881- random.seed(self.run_card['python_seed'])
882+ if not hasattr(random, 'mg_seedset'):
883+ random.seed(self.run_card['python_seed'])
884+ random.mg_seedset = self.run_card['python_seed']
885 if self.run_card['ickkw'] == 2:
886 logger.info('Running with CKKW matching')
887 self.treat_ckkw_matching()
888@@ -5656,7 +5660,7 @@
889 # Verify the compatibility of the specified module
890 bias_module_valid = misc.Popen(['make','requirements'],
891 cwd=os.path.join(self.me_dir, 'Source','BIAS',bias_name),
892- stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()[0].decode()
893+ stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()[0].decode(errors='ignore')
894 if 'VALID' not in str(bias_module_valid).upper() or \
895 'INVALID' in str(bias_module_valid).upper():
896 raise InvalidCmd("The bias module '%s' cannot be used because of:\n%s"%
897@@ -5856,7 +5860,9 @@
898 raise MadGraph5Error('Random seed too large ' + str(self.random) + ' > 30081*30081')
899 if self.run_card['python_seed'] == -2:
900 import random
901- random.seed(self.random)
902+ if not hasattr(random, 'mg_seedset'):
903+ random.seed(self.random)
904+ random.mg_seedset = self.random
905
906 ############################################################################
907 def save_random(self):
908@@ -6450,10 +6456,14 @@
909
910 if self.run_card['python_seed'] == -2:
911 import random
912- random.seed(seed)
913+ if not hasattr(random, 'mg_seedset'):
914+ random.seed(seed)
915+ random.mg_seedset = seed
916 elif self.run_card['python_seed'] > 0:
917 import random
918- random.seed(self.run_card['python_seed'])
919+ if not hasattr(random, 'mg_seedset'):
920+ random.seed(self.run_card['python_seed'])
921+ random.mg_seedset = self.run_card['python_seed']
922 # 2) Run the refine for the grid
923 self.update_status('Generating Events', level=None)
924 #misc.call([pjoin(self.me_dir,'bin','refine4grid'),
925
926=== modified file 'madgraph/interface/madgraph_interface.py'
927--- madgraph/interface/madgraph_interface.py 2021-11-08 08:25:41 +0000
928+++ madgraph/interface/madgraph_interface.py 2021-12-04 08:46:24 +0000
929@@ -211,7 +211,7 @@
930 bzrname,_ = proc.communicate()
931 proc = subprocess.Popen(['bzr', 'revno'], stdout=subprocess.PIPE,cwd=MG5DIR)
932 bzrversion,_ = proc.communicate()
933- bzrname, bzrversion = bzrname.decode().strip(), bzrversion.decode().strip()
934+ bzrname, bzrversion = bzrname.decode(errors='ignore').strip(), bzrversion.decode(errors='ignore').strip()
935 len_name = len(bzrname)
936 len_version = len(bzrversion)
937 info_line += "#* BZR %s %s %s *\n" % \
938@@ -3819,7 +3819,7 @@
939 data = import_ufo.get_model_db()
940 self._online_model2 = []
941 for line in data:
942- model_name, path = line.decode().split()
943+ model_name, path = line.decode(errors='ignore').split()
944 if model_name in already_done:
945 continue
946 if model_name.endswith('_v4'):
947@@ -4278,8 +4278,11 @@
948 # Not necessarily optimal as there could be additional call to
949 # random() as the code develops, but at least it will encompass
950 # everything in this way.
951- logger_check.info('Setting random seed to %d.'%options['seed'])
952- random.seed(options['seed'])
953+
954+ if not hasattr(random, 'mg_seedset'):
955+ logger_check.info('Setting random seed to %d.'%options['seed'])
956+ random.seed(options['seed'])
957+ random.mg_seedset = options['seed']
958
959 proc_line = " ".join(args[1:])
960 # Don't try to extract the process if just re-analyzing a saved run
961@@ -6049,7 +6052,7 @@
962 try:
963 version = misc.Popen(
964 [lhapdf_config,'--version'], stdout=subprocess.PIPE)
965- lhapdf_version = int(version.stdout.read().decode()[0])
966+ lhapdf_version = int(version.stdout.read().decode(errors='ignore')[0])
967 if lhapdf_version not in [5,6]:
968 raise
969 except:
970@@ -6372,7 +6375,7 @@
971 raise MadGraph5Error('''Impossible to connect any of us servers.
972 Please check your internet connection or retry later''')
973 for wwwline in data:
974- split = wwwline.decode().split()
975+ split = wwwline.decode(errors='ignore').split()
976 if len(split)!=2:
977 if '--source' not in line:
978 source = {0:'uiuc',1:'ucl'}[index]
979@@ -6521,7 +6524,7 @@
980 # Run the configure script
981 ld_path = misc.Popen(['./configure',
982 '--prefix=%s'%str(pjoin(MG5DIR, name)),'FC=%s'%os.environ['FC']],
983- cwd=pjoin(MG5DIR,'golem95'),stdout=subprocess.PIPE).communicate()[0].decode()
984+ cwd=pjoin(MG5DIR,'golem95'),stdout=subprocess.PIPE).communicate()[0].decode(errors='ignore')
985
986
987 # For QCDLoop, use autotools.
988@@ -6530,7 +6533,7 @@
989 ld_path = misc.Popen(['./configure',
990 '--prefix=%s'%str(pjoin(MG5DIR, name)),'FC=%s'%os.environ['FC'],
991 'F77=%s'%os.environ['FC']], cwd=pjoin(MG5DIR,name),
992- stdout=subprocess.PIPE).communicate()[0].decode()
993+ stdout=subprocess.PIPE).communicate()[0].decode(errors='ignore')
994
995 # For Delphes edit the makefile to add the proper link to correct library
996 if args[0] == 'Delphes3':
997@@ -6548,7 +6551,7 @@
998 if name == 'SysCalc':
999 if self.options['lhapdf']:
1000 ld_path = misc.Popen([self.options['lhapdf'], '--libdir'],
1001- stdout=subprocess.PIPE).communicate()[0].decode()
1002+ stdout=subprocess.PIPE).communicate()[0].decode(errors='ignore')
1003 ld_path = ld_path.replace('\n','')
1004 if 'LD_LIBRARY_PATH' not in os.environ:
1005 os.environ['LD_LIBRARY_PATH'] = ld_path
1006@@ -6763,7 +6766,7 @@
1007
1008 def apply_patch(filetext):
1009 """function to apply the patch"""
1010- text = filetext.read().decode()
1011+ text = filetext.read().decode(errors='ignore')
1012
1013 pattern = re.compile(r'''^=== renamed directory \'(?P<orig>[^\']*)\' => \'(?P<new>[^\']*)\'''')
1014 #= = = renamed directory 'Template' => 'Template/LO'
1015@@ -6998,7 +7001,7 @@
1016 try:
1017 filetext = six.moves.urllib.request.urlopen('http://madgraph.phys.ucl.ac.be/mg5amc3_build_nb')
1018 signal.alarm(0)
1019- text = filetext.read().decode().split('\n')
1020+ text = filetext.read().decode(errors='ignore').split('\n')
1021 web_version = int(text[0].strip())
1022 try:
1023 msg_version = int(text[1].strip())
1024@@ -7844,7 +7847,7 @@
1025 p = subprocess.Popen([args[1], '--version'], stdout=subprocess.PIPE,
1026 stderr=subprocess.PIPE)
1027 output, error = p.communicate()
1028- output = output.decode()
1029+ output = output.decode(errors='ignore')
1030 res = 0
1031 except Exception:
1032 res = 1
1033@@ -8849,7 +8852,7 @@
1034 stdin=subprocess.PIPE,
1035 cwd=pjoin(model_path, 'SMWidth')).communicate()
1036 pattern = re.compile(r''' decay\s+(\+?\-?\d+)\s+(\+?\-?\d+\.\d+E\+?\-?\d+)''',re.I)
1037- width_list = pattern.findall(output.decode())
1038+ width_list = pattern.findall(output.decode(errors='ignore'))
1039 width_dict = {}
1040 for pid,width in width_list:
1041 width_dict[int(pid)] = float(width)
1042
1043=== modified file 'madgraph/interface/reweight_interface.py'
1044--- madgraph/interface/reweight_interface.py 2021-11-02 14:19:01 +0000
1045+++ madgraph/interface/reweight_interface.py 2021-12-04 08:46:24 +0000
1046@@ -777,9 +777,8 @@
1047 blockpat = re.compile(r'''<weightgroup name=\'mg_reweighting\'\s*weight_name_strategy=\'includeIdInWeightName\'>(?P<text>.*?)</weightgroup>''', re.I+re.M+re.S)
1048 before, content, after = blockpat.split(self.banner['initrwgt'])
1049 header_rwgt_other = before + after
1050- pattern = re.compile('<weight id=\'(?:rwgt_(?P<id>\d+)|(?P<id2>[_\w\-]+))(?P<rwgttype>\s*|_\w+)\'>(?P<info>.*?)</weight>', re.S+re.I+re.M)
1051+ pattern = re.compile('<weight id=\'(?:rwgt_(?P<id>\d+)|(?P<id2>[_\w\-\.]+))(?P<rwgttype>\s*|_\w+)\'>(?P<info>.*?)</weight>', re.S+re.I+re.M)
1052 mg_rwgt_info = pattern.findall(content)
1053-
1054 maxid = 0
1055 for k,(i, fulltag, nlotype, diff) in enumerate(mg_rwgt_info):
1056 if i:
1057@@ -876,6 +875,7 @@
1058 self.banner['initrwgt'] += '\n</weightgroup>\n'
1059 self.banner['initrwgt'] = self.banner['initrwgt'].replace('\n\n', '\n')
1060
1061+
1062 logger.info('starts to compute weight for events with the following modification to the param_card:')
1063 logger.info(card_diff.replace('\n','\nKEEP:'))
1064 try:
1065@@ -1857,7 +1857,7 @@
1066 # get all the information
1067 allids, all_pids = mymod.get_pdg_order()
1068 all_pdgs = [[pdg for pdg in pdgs if pdg!=0] for pdgs in allids]
1069- all_prefix = [''.join([i.decode() for i in j]).strip().lower() for j in mymod.get_prefix()]
1070+ all_prefix = [''.join([i.decode(errors='ignore') for i in j]).strip().lower() for j in mymod.get_prefix()]
1071 prefix_set = set(all_prefix)
1072
1073 hel_dict={}
1074
1075=== modified file 'madgraph/iolibs/export_fks.py'
1076--- madgraph/iolibs/export_fks.py 2021-11-10 09:25:45 +0000
1077+++ madgraph/iolibs/export_fks.py 2021-12-04 08:46:24 +0000
1078@@ -62,6 +62,18 @@
1079 if madgraph.ordering:
1080 set = misc.OrderedSet
1081
1082+# the base to compute the orders_tag
1083+orderstag_base = 100
1084+
1085+def get_orderstag(ords):
1086+ step = 1
1087+ tag = 0
1088+ for o in ords:
1089+ tag += step*o
1090+ step *= orderstag_base
1091+ return tag
1092+
1093+
1094 def make_jpeg_async(args):
1095 Pdir = args[0]
1096 old_pos = args[1]
1097@@ -709,6 +721,8 @@
1098 'pineappl_maxproc.inc',
1099 'pineappl_maxproc.h',
1100 'timing_variables.inc',
1101+ 'orderstag_base.inc',
1102+ 'orderstags_glob.dat',
1103 'polfit.f']
1104
1105 for file in linkfiles:
1106@@ -737,7 +751,7 @@
1107 gen_infohtml.make_info_html_nlo(self.dir_path)
1108
1109
1110- return calls
1111+ return calls, amp_split_orders
1112
1113 #===========================================================================
1114 # create the run_card
1115@@ -811,6 +825,9 @@
1116
1117 self.create_proc_charac()
1118
1119+ filename = os.path.join(self.dir_path,'SubProcesses','orderstag_base.inc')
1120+ self.write_orderstag_base_file(writers.FortranWriter(filename))
1121+
1122 self.create_run_card(matrix_elements.get_processes(), history)
1123 # modelname = self.model.get('name')
1124 # if modelname == 'mssm' or modelname.startswith('mssm-'):
1125@@ -1061,6 +1078,21 @@
1126
1127 writer.writelines(text)
1128
1129+ def write_orderstag_file(self, splitorders, outdir):
1130+ outfile = open(os.path.join(outdir, 'SubProcesses', 'orderstags_glob.dat'), 'w')
1131+ outfile.write('%d\n' % len(splitorders))
1132+ tags = ['%d' % get_orderstag(ords) for ords in splitorders]
1133+ outfile.write(' '.join(tags) + '\n')
1134+ outfile.close()
1135+
1136+ def write_orderstag_base_file(self, writer):
1137+ """write a small include file containing the 'base'
1138+ to compute the orders_tag"""
1139+
1140+ text = "integer orders_tag_base\n"
1141+ text+= "parameter (orders_tag_base=%d)\n" % orderstag_base
1142+ writer.writelines(text)
1143+
1144
1145 def write_a0gmuconv_file(self, writer, matrix_element):
1146 """writes an include file with the informations about the
1147
1148=== modified file 'madgraph/iolibs/export_v4.py'
1149--- madgraph/iolibs/export_v4.py 2021-11-10 09:25:45 +0000
1150+++ madgraph/iolibs/export_v4.py 2021-12-04 08:46:24 +0000
1151@@ -2058,7 +2058,7 @@
1152 p = misc.Popen(['g++', '--version'], stdout=subprocess.PIPE,
1153 stderr=subprocess.PIPE)
1154 out, _ = p.communicate()
1155- out = out.decode()
1156+ out = out.decode(errors='ignore')
1157 if 'clang' in str(out) and misc.which('clang'):
1158 compiler = 'clang'
1159 else:
1160
1161=== modified file 'madgraph/madevent/gen_ximprove.py'
1162--- madgraph/madevent/gen_ximprove.py 2021-05-31 14:39:58 +0000
1163+++ madgraph/madevent/gen_ximprove.py 2021-12-04 08:46:24 +0000
1164@@ -164,7 +164,7 @@
1165 stderr=subprocess.STDOUT, cwd=pjoin(Pdir,'Hel'), shell=True)
1166 #sym_input = "%(points)d %(iterations)d %(accuracy)f \n" % self.opts
1167 (stdout, _) = p.communicate(" ".encode())
1168- stdout = stdout.decode('ascii')
1169+ stdout = stdout.decode('ascii',errors='ignore')
1170 if os.path.exists(pjoin(self.me_dir,'error')):
1171 raise Exception(pjoin(self.me_dir,'error'))
1172 # note a continue is not enough here, we have in top to link
1173@@ -337,7 +337,7 @@
1174 stderr=subprocess.STDOUT, cwd=Pdir)
1175 #sym_input = "%(points)d %(iterations)d %(accuracy)f \n" % self.opts
1176 (stdout, _) = p.communicate(''.encode())
1177- stdout = stdout.decode('ascii')
1178+ stdout = stdout.decode('ascii',errors='ignore')
1179 if os.path.exists(pjoin(self.me_dir,'error')):
1180 files.mv(pjoin(self.me_dir,'error'), pjoin(Pdir,'ajob.no_ps.log'))
1181 P_zero_result.append(subdir)
1182
1183=== modified file 'madgraph/various/cluster.py'
1184--- madgraph/various/cluster.py 2021-10-13 21:03:53 +0000
1185+++ madgraph/various/cluster.py 2021-12-04 08:46:24 +0000
1186@@ -916,7 +916,7 @@
1187 #Logging submit event(s).
1188 #1 job(s) submitted to cluster 2253622.
1189 pat = re.compile("submitted to cluster (\d*)",re.MULTILINE)
1190- output = output.decode()
1191+ output = output.decode(errors='ignore')
1192 try:
1193 id = pat.search(output).groups()[0]
1194 except:
1195@@ -1003,7 +1003,7 @@
1196 #Submitting job(s).
1197 #Logging submit event(s).
1198 #1 job(s) submitted to cluster 2253622.
1199- output = output.decode()
1200+ output = output.decode(errors='ignore')
1201 pat = re.compile("submitted to cluster (\d*)",re.MULTILINE)
1202 try:
1203 id = pat.search(output).groups()[0]
1204@@ -1025,11 +1025,11 @@
1205 status = misc.Popen([cmd], shell=True, stdout=subprocess.PIPE,
1206 stderr=subprocess.PIPE)
1207
1208- error = status.stderr.read().decode()
1209+ error = status.stderr.read().decode(errors='ignore')
1210 if status.returncode or error:
1211 raise ClusterManagmentError('condor_q returns error: %s' % error)
1212
1213- return status.stdout.readline().decode().strip()
1214+ return status.stdout.readline().decode(errors='ignore').strip()
1215
1216 jobstatus = {'0':'U', '1':'I','2':'R','3':'X','4':'C','5':'H','6':'E'}
1217 @check_interupt()
1218@@ -1052,12 +1052,12 @@
1219
1220 status = misc.Popen([cmd], shell=True, stdout=subprocess.PIPE,
1221 stderr=subprocess.PIPE)
1222- error = status.stderr.read().decode()
1223+ error = status.stderr.read().decode(errors='ignore')
1224 if status.returncode or error:
1225 raise ClusterManagmentError('condor_q returns error: %s' % error)
1226
1227 for line in status.stdout:
1228- id, status = line.decode().strip().split()
1229+ id, status = line.decode(errors='ignore').strip().split()
1230 status = self.jobstatus[status]
1231 ongoing.append(id)
1232 if status in ['I','U']:
1233@@ -1145,7 +1145,7 @@
1234 stderr=subprocess.STDOUT,
1235 stdin=subprocess.PIPE, cwd=cwd)
1236
1237- output = a.communicate(text.encode())[0].decode()
1238+ output = a.communicate(text.encode())[0].decode(errors='ignore')
1239 id = output.split('.')[0]
1240 if not id.isdigit() or a.returncode !=0:
1241 raise ClusterManagmentError('fail to submit to the cluster: \n%s' \
1242@@ -1163,7 +1163,7 @@
1243 stderr=subprocess.STDOUT)
1244
1245 for line in status.stdout:
1246- line = line.decode().strip()
1247+ line = line.decode(errors='ignore').strip()
1248 if 'cannot connect to server' in line or 'cannot read reply' in line:
1249 raise ClusterManagmentError('server disconnected')
1250 if 'Unknown' in line:
1251@@ -1194,7 +1194,7 @@
1252
1253 idle, run, fail = 0, 0, 0
1254 for line in status.stdout:
1255- line = line.decode()
1256+ line = line.decode(errors='ignore')
1257 if 'cannot connect to server' in line or 'cannot read reply' in line:
1258 raise ClusterManagmentError('server disconnected')
1259 if me_dir in line:
1260@@ -1309,7 +1309,7 @@
1261 stderr=subprocess.STDOUT,
1262 stdin=subprocess.PIPE, cwd=cwd)
1263
1264- output = a.communicate(text.encode())[0].decode()
1265+ output = a.communicate(text.encode())[0].decode(errors='ignore')
1266 id = output.split(' ')[2]
1267 if not id.isdigit():
1268 raise ClusterManagmentError('fail to submit to the cluster: \n%s' \
1269@@ -1327,7 +1327,7 @@
1270 cmd = 'qstat '
1271 status = misc.Popen([cmd], shell=True, stdout=subprocess.PIPE)
1272 for line in status.stdout:
1273- line = line.decode()
1274+ line = line.decode(errors='ignore')
1275 #print "!==",line
1276 #line = line.strip()
1277 #if 'Unknown' in line:
1278@@ -1355,7 +1355,7 @@
1279
1280 idle, run, fail = 0, 0, 0
1281 for line in status.stdout:
1282- line = line.decode()
1283+ line = line.decode(errors='ignore')
1284 if me_dir in line:
1285 id,_,_,_,status = line.split()[:5]
1286 if status in self.idle_tag:
1287@@ -1427,7 +1427,7 @@
1288 stderr=subprocess.STDOUT,
1289 stdin=subprocess.PIPE, cwd=cwd)
1290
1291- output = a.communicate(text.encode())[0].decode()
1292+ output = a.communicate(text.encode())[0].decode(errors='ignore')
1293 #Job <nnnn> is submitted to default queue <normal>.
1294 try:
1295 id = output.split('>',1)[0].split('<')[1]
1296@@ -1450,7 +1450,7 @@
1297 status = misc.Popen([cmd], shell=True, stdout=subprocess.PIPE)
1298
1299 for line in status.stdout:
1300- line = line.decode().strip().upper()
1301+ line = line.decode(errors='ignore').strip().upper()
1302 if 'JOBID' in line:
1303 continue
1304 elif str(id) not in line:
1305@@ -1478,7 +1478,7 @@
1306
1307 jobstatus = {}
1308 for line in status.stdout:
1309- line = line.decode().strip()
1310+ line = line.decode(errors='ignore').strip()
1311 if 'JOBID' in line:
1312 continue
1313 splitline = line.split()
1314@@ -1557,7 +1557,7 @@
1315 stderr=subprocess.STDOUT,
1316 stdin=subprocess.PIPE, cwd=cwd)
1317
1318- output = a.communicate()[0].decode()
1319+ output = a.communicate()[0].decode(errors='ignore')
1320 #Your job 874511 ("test.sh") has been submitted
1321 pat = re.compile("Your job (\d*) \(",re.MULTILINE)
1322 try:
1323@@ -1579,7 +1579,7 @@
1324 #874516 0.00000 test.sh alwall qw 03/04/2012 22:30:35 1
1325 pat = re.compile("^(\d+)\s+[\d\.]+\s+[\w\d\.]+\s+[\w\d\.]+\s+(\w+)\s")
1326 stat = ''
1327- for line in status.stdout.read().decode().split('\n'):
1328+ for line in status.stdout.read().decode(errors='ignore').split('\n'):
1329 if not line:
1330 continue
1331 line = line.strip()
1332@@ -1608,7 +1608,7 @@
1333 status = misc.Popen([cmd], shell=True, stdout=subprocess.PIPE)
1334 #874516 0.00000 test.sh alwall qw 03/04/2012 22:30:35 1
1335 pat = re.compile("^(\d+)")
1336- for line in status.stdout.read().decode().split('\n'):
1337+ for line in status.stdout.read().decode(errors='ignore').split('\n'):
1338 line = line.strip()
1339 try:
1340 id = pat.search(line).groups()[0]
1341@@ -1694,7 +1694,7 @@
1342 stdin=subprocess.PIPE, cwd=cwd)
1343
1344 output = a.communicate()
1345- output_arr = output[0].decode().split(' ')
1346+ output_arr = output[0].decode(errors='ignore').split(' ')
1347 id = output_arr[3].rstrip()
1348
1349 if not id.isdigit():
1350@@ -1718,7 +1718,7 @@
1351 stderr=open(os.devnull,'w'))
1352
1353 for line in status.stdout:
1354- line = line.decode().strip()
1355+ line = line.decode(errors='ignore').strip()
1356 if 'Invalid' in line:
1357 return 'F'
1358 elif line.startswith(str(id)):
1359@@ -1740,7 +1740,7 @@
1360 idle, run, fail = 0, 0, 0
1361 ongoing=[]
1362 for line in pstatus.stdout:
1363- line = line.decode()
1364+ line = line.decode(errors='ignore')
1365 if me_dir in line:
1366 id, _, _,_ , status,_ = line.split(None,5)
1367 ongoing.append(id)
1368@@ -1880,10 +1880,10 @@
1369 cmd = 'htcaas-job-status -m '+str(id)+ " -s | grep Status "
1370 status = misc.Popen([cmd], shell=True,stdout=subprocess.PIPE,
1371 stderr=subprocess.PIPE)
1372- error = status.stderr.read().decode()
1373+ error = status.stderr.read().decode(errors='ignore')
1374 if status.returncode or error:
1375 raise ClusterManagmentError('htcaas-job-submit returns error: %s' % error)
1376- status_out= status.stdout.read().decode().strip()
1377+ status_out= status.stdout.read().decode(errors='ignore').strip()
1378 status_out= status_out.split(":",1)[1]
1379 if status_out == 'waiting':
1380 status_out='I'
1381@@ -1914,7 +1914,7 @@
1382
1383 for line in status.stdout:
1384 #ongoing.append(line.split()[0].strip())
1385- status2 = line.decode().split()[-1]
1386+ status2 = line.decode(errors='ignore').split()[-1]
1387 if status2 != 'null' or line.split()[0].strip() != '0':
1388 ongoing.append(line.split()[0].strip())
1389 logger.debug("["+line.split()[0].strip()+"]"+status2)
1390@@ -2079,10 +2079,10 @@
1391 cmd = 'htcaas-job-status -m '+ str(id) + " -s | grep Status "
1392 status = misc.Popen([cmd],shell=True,stdout=subprocess.PIPE,
1393 stderr=subprocess.PIPE)
1394- error = status.stderr.read().decode()
1395+ error = status.stderr.read().decode(errors='ignore')
1396 if status.returncode or error:
1397 raise ClusterManagmentError('htcaas-job-status returns error: %s' % error)
1398- status_out= status.stdout.read().decode().strip()
1399+ status_out= status.stdout.read().decode(errors='ignore').strip()
1400 status_out= status_out.split(":",1)[1]
1401 logger.debug("[["+str(id)+"]]"+status_out)
1402 if status_out == 'waiting':
1403@@ -2128,7 +2128,7 @@
1404 status = misc.Popen([cmd], shell=True, stdout=subprocess.PIPE)
1405
1406 for line in status.stdout:
1407- line = line.decode()
1408+ line = line.decode(errors='ignore')
1409 status2 = line.split()[-1]
1410 if status2 != 'null' or line.split()[0].strip() != '0':
1411 ongoing.append(str(line.split()[0].strip())+"-"+str(line.split()[1].strip()))
1412
1413=== modified file 'madgraph/various/hepmc_parser.py'
1414--- madgraph/various/hepmc_parser.py 2020-02-11 10:57:44 +0000
1415+++ madgraph/various/hepmc_parser.py 2021-12-04 08:46:24 +0000
1416@@ -269,6 +269,7 @@
1417 mode ='r'
1418 self.mode = mode
1419
1420+ self.zip_mode = False
1421 if not path.endswith(".gz"):
1422 self.file = open(path, mode, *args, **opt)
1423 elif mode == 'r' and not os.path.exists(path) and os.path.exists(path[:-3]):
1424@@ -302,7 +303,7 @@
1425 self.banner = ''
1426 break
1427 if 'b' in mode or self.zip_mode:
1428- line = str(line.decode())
1429+ line = str(line.decode(errors='ignore'))
1430 self.header += line
1431 self.start_event = ''
1432
1433@@ -311,13 +312,13 @@
1434 return self.file.seek(*args, **opts)
1435
1436 def tell(self):
1437- if self.zipmode:
1438+ if self.zip_mode:
1439 currpos = self.file.tell()
1440 if not currpos:
1441 currpos = self.size
1442 return currpos
1443 else:
1444- self.file.tell()
1445+ return self.file.tell()
1446
1447 def __iter__(self):
1448 return self
1449@@ -369,7 +370,7 @@
1450 if not line:
1451 raise StopIteration
1452 if 'b' in self.mode or self.zip_mode:
1453- line = str(line.decode())
1454+ line = str(line.decode(errors='ignore'))
1455 if line.startswith('E'):
1456 self.start_event = line
1457 if text:
1458@@ -389,13 +390,13 @@
1459 if self.zip_mode:
1460 self.file.seek(-4, 2)
1461 r = self.file.read()
1462- self.file.seek()
1463+ self.file.seek(0)
1464 import struct
1465 return struct.unpack('<I', r)[0]
1466 else:
1467 self.file.seek(0,2)
1468 pos = self.file.tell()
1469- self.file.seek()
1470+ self.file.seek(0)
1471 return pos
1472
1473 def write(self, text):
1474
1475=== modified file 'madgraph/various/histograms.py'
1476--- madgraph/various/histograms.py 2021-02-09 14:18:31 +0000
1477+++ madgraph/various/histograms.py 2021-12-04 08:46:24 +0000
1478@@ -1308,7 +1308,7 @@
1479 use_lhapdf=False
1480 try:
1481 lhapdf_libdir=subprocess.Popen([lhapdfconfig,'--libdir'],\
1482- stdout=subprocess.PIPE).stdout.read().decode().strip()
1483+ stdout=subprocess.PIPE).stdout.read().decode(errors='ignore').strip()
1484 except:
1485 use_lhapdf=False
1486 else:
1487@@ -2404,12 +2404,10 @@
1488 gnuplot_output_list=gnuplot_output_list_v5
1489 else:
1490 output, _ = p.communicate()
1491- output.decode()
1492- try:
1493- version = float(output.split()[1])
1494- except:
1495- version = 5
1496- if version < 5. :
1497+ output.decode(errors='ignore')
1498+ if not output:
1499+ gnuplot_output_list=gnuplot_output_list_v5
1500+ elif float(output.split()[1]) < 5. :
1501 gnuplot_output_list=gnuplot_output_list_v4
1502 else:
1503 gnuplot_output_list=gnuplot_output_list_v5
1504
1505=== modified file 'madgraph/various/lhe_parser.py'
1506--- madgraph/various/lhe_parser.py 2021-05-23 07:47:20 +0000
1507+++ madgraph/various/lhe_parser.py 2021-12-04 08:46:24 +0000
1508@@ -255,7 +255,7 @@
1509 self.banner = ''
1510 break
1511 if 'b' in mode or self.zip_mode:
1512- line = str(line.decode(self.encoding))
1513+ line = str(line.decode(self.encoding,errors='ignore'))
1514 if '<event' in line.lower():
1515 self.seek(0)
1516 self.banner = ''
1517@@ -331,7 +331,7 @@
1518 if not line:
1519 raise StopIteration
1520 if 'b' in self.mode or self.zip_mode:
1521- line = line.decode(self.encoding)
1522+ line = line.decode(self.encoding,errors='ignore')
1523
1524 if '<event' in line:
1525 mode = 1
1526@@ -361,7 +361,7 @@
1527 if not line:
1528 raise StopIteration
1529 if 'b' in self.mode:
1530- line = line.decode(self.encoding)
1531+ line = line.decode(self.encoding,errors='ignore')
1532
1533 if '<eventgroup' in line:
1534 events=[]
1535@@ -2670,7 +2670,7 @@
1536 bjks : %(bjks)s
1537 scales**2, gs: %(scales2)s %(gs)s
1538 born/real related : %(born_related)s %(real_related)s
1539- type / nfks : %(type)s %(nfks)s
1540+ type / nfks : %(orderflag)s %(type)s %(nfks)s
1541 to merge : %(to_merge_pdg)s in %(merge_new_pdg)s
1542 ref_wgt : %(ref_wgt)s""" % self.__dict__
1543 return out
1544@@ -2693,6 +2693,7 @@
1545 to_add('%.10e', self.real)
1546 to_add('%i', self.nexternal)
1547 to_add('%i', self.pdgs)
1548+ to_add('%i', self.orderflag)
1549 to_add('%i', self.qcdpower)
1550 to_add('%.10e', self.bjks)
1551 to_add('%.10e', self.scales2)
1552@@ -2744,12 +2745,12 @@
1553 # from example: 21 2 -11 12 1 2
1554 self.pdgs = [int(i) for i in data[6:6+self.nexternal]]
1555 flag = 6+self.nexternal # new starting point for the position
1556+ # 5[pre] next integer is the expansion order defined at NLO (from example 404)
1557+ # New since 3.1.0.
1558+ self.orderflag = int(data[flag])
1559 # 5. next integer is the power of g_strong in the matrix elements (as before)
1560 # from example: 2
1561- self.qcdpower = int(data[flag])
1562- # 5[bis] next integer is the expansion order defined at NLO (from example 404)
1563- # New since 3.1.0.
1564- self.orderflag = int(data[flag+1])
1565+ self.qcdpower = int(data[flag+1])
1566 flag= flag+1
1567 # 6. 2 doubles: The bjorken x's used for this contribution (as before)
1568 # from example: 0.52500539D-02 0.30205908D+00
1569
1570=== modified file 'madgraph/various/misc.py'
1571--- madgraph/various/misc.py 2021-11-12 09:03:20 +0000
1572+++ madgraph/various/misc.py 2021-12-04 08:46:24 +0000
1573@@ -248,7 +248,7 @@
1574 p = Popen([ninja_config, '-quadsupport'], stdout=subprocess.PIPE,
1575 stderr=subprocess.PIPE)
1576 output, error = p.communicate()
1577- return 'TRUE' in output.decode().upper()
1578+ return 'TRUE' in output.decode(errors='ignore').upper()
1579 except Exception:
1580 pass
1581
1582@@ -525,7 +525,7 @@
1583 raise MadGraph5Error(error_msg)
1584
1585 try:
1586- out = out.decode('utf-8')
1587+ out = out.decode('utf-8', errors='ignore')
1588 except Exception:
1589 out = str(out)
1590
1591@@ -560,7 +560,7 @@
1592 p = Popen([compiler, '-dumpversion'], stdout=subprocess.PIPE,
1593 stderr=subprocess.PIPE)
1594 output, error = p.communicate()
1595- output = output.decode("utf-8")
1596+ output = output.decode("utf-8",errors='ignore')
1597 version_finder=re.compile(r"(?P<version>\d[\d.]*)")
1598 version = version_finder.search(output).group('version')
1599 return version
1600@@ -788,8 +788,8 @@
1601 except Exception as error:
1602 # Cannot probe the compiler, assume not clang then
1603 return False
1604-
1605- output = output.decode()
1606+ output = output.decode(errors='ignore')
1607+
1608 return 'LLVM' in str(output) or "clang" in str(output)
1609
1610
1611@@ -954,7 +954,7 @@
1612 arg[0] = './%s' % arg[0]
1613 out = subprocess.call(arg, *args, stdout=subprocess.PIPE, **opt)
1614
1615- str_out = out.stdout.read().decode().strip()
1616+ str_out = out.stdout.read().decode(errors='ignore').strip()
1617 return str_out
1618
1619
1620@@ -1199,7 +1199,7 @@
1621 raise
1622 else:
1623 try:
1624- open(stdout,'w').write(gfile.read().decode())
1625+ open(stdout,'w').write(gfile.read().decode(errors='ignore'))
1626 except IOError as error:
1627 sprint(error)
1628 # this means that the file is actually not gzip
1629@@ -1658,7 +1658,7 @@
1630 # dyld: DYLD_ environment variables being ignored because main executable (/bin/ps) is setuid or setgid
1631 flash = subprocess.Popen("ps -p %i -o rss"%self.p.pid,
1632 shell=True,stdout=subprocess.PIPE,stderr=open(os.devnull,"w"))
1633- stdout_list = flash.communicate()[0].decode().split('\n')
1634+ stdout_list = flash.communicate()[0].decode(errors='ignore').split('\n')
1635 rss_memory = int(stdout_list[1])
1636 # for now we ignore vms
1637 vms_memory = 0
1638@@ -1891,7 +1891,7 @@
1639 #1. control if the volume is on or not
1640 p = subprocess.Popen("osascript -e 'get volume settings'", stdout=subprocess.PIPE, shell=True)
1641 output, _ = p.communicate()
1642- output = output.decode()
1643+ output = output.decode(errors='ignore')
1644 #output volume:25, input volume:71, alert volume:100, output muted:true
1645 info = dict([[a.strip() for a in l.split(':',1)] for l in output.strip().split(',')])
1646 muted = False
1647@@ -2107,7 +2107,7 @@
1648 try:
1649
1650 lhapdf_libdir=subprocess.Popen([lhapdfconfig,'--libdir'],\
1651- stdout=subprocess.PIPE).stdout.read().decode().strip()
1652+ stdout=subprocess.PIPE).stdout.read().decode(errors='ignore').strip()
1653 except:
1654 use_lhapdf=False
1655 return False
1656@@ -2189,14 +2189,22 @@
1657 "remove duplicate in a list "
1658
1659 if keepordering is None:
1660- keepordering = madgraph.ordering
1661+ if MADEVENT:
1662+ keepordering = False
1663+ else:
1664+ keepordering = madgraph.ordering
1665 if not keepordering:
1666 return list(set(input))
1667 else:
1668 return list(dict.fromkeys(input))
1669
1670 if six.PY3:
1671- class OrderedSet(collections.OrderedDict, collections.MutableSet):
1672+ try:
1673+ from collections import MutableSet
1674+ except ImportError: # this is for python3.10
1675+ from collections.abc import MutableSet
1676+
1677+ class OrderedSet(collections.OrderedDict, MutableSet):
1678
1679 def __init__(self, arg=None):
1680 super( OrderedSet, self).__init__()
1681@@ -2217,6 +2225,13 @@
1682 def discard(self, elem):
1683 self.pop(elem, None)
1684
1685+ def pop(self, *args):
1686+ if args:
1687+ return super().pop(*args)
1688+ else:
1689+ key = next(iter(self))
1690+ return super().pop(key, None)
1691+
1692 def __le__(self, other):
1693 return all(e in other for e in self)
1694
1695@@ -2317,10 +2332,10 @@
1696 line = self.data[0]
1697 try:
1698 self.seek(-self.blksize * self.blkcount, 2) # read from end of file
1699- self.data = (self.read(self.blksize).decode() + line).split('\n')
1700+ self.data = (self.read(self.blksize).decode(errors='ignore') + line).split('\n')
1701 except IOError: # can't seek before the beginning of the file
1702 self.seek(0)
1703- data = self.read(self.size - (self.blksize * (self.blkcount-1))).decode() + line
1704+ data = self.read(self.size - (self.blksize * (self.blkcount-1))).decode(errors='ignore') + line
1705 self.data = data.split('\n')
1706
1707 if len(self.data) == 0:
1708@@ -2343,7 +2358,7 @@
1709 # otherwise, read the whole thing...
1710 if self.size > self.blksize:
1711 self.seek(-self.blksize * self.blkcount, 2) # read from end of file
1712- self.data = self.read(self.blksize).decode().split('\n')
1713+ self.data = self.read(self.blksize).decode(errors='ignore').split('\n')
1714 # strip the last item if it's empty... a byproduct of the last line having
1715 # a newline at the end of it
1716 if not self.data[-1]:
1717
1718=== modified file 'madgraph/various/process_checks.py'
1719--- madgraph/various/process_checks.py 2021-11-08 08:25:41 +0000
1720+++ madgraph/various/process_checks.py 2021-12-04 08:46:24 +0000
1721@@ -832,7 +832,7 @@
1722 elif isinstance(output,(str)) or (six.PY2 and isinstance(output, six.text_type)):
1723 text=output.split('\n')
1724 elif isinstance(output, bytes):
1725- text=output.decode().split('\n')
1726+ text=output.decode(errors='ignore').split('\n')
1727 else:
1728 raise MadGraph5Error('Type for argument output not supported in'+\
1729 ' parse_check_output: %s' % type(output))
1730@@ -1268,7 +1268,7 @@
1731
1732 def check_disk_usage(path):
1733 return subprocess.Popen("du -shc -L "+str(path), \
1734- stdout=subprocess.PIPE, shell=True).communicate()[0].decode().split()[-2]
1735+ stdout=subprocess.PIPE, shell=True).communicate()[0].decode(errors='ignore').split()[-2]
1736 # The above is compatible with python 2.6, not the neater version below
1737 # -> need to check if need .decode for python3.7
1738 #return subprocess.check_output(["du -shc %s"%path],shell=True).\
1739@@ -1852,7 +1852,7 @@
1740 try:
1741 #fsock = open('/tmp/log', 'w')
1742 while True:
1743- output = StabChecker.stdout.readline().decode()
1744+ output = StabChecker.stdout.readline().decode(errors='ignore')
1745 #fsock.write(output)
1746 if output != '':
1747 last_non_empty = output
1748@@ -1861,16 +1861,16 @@
1749 # Break if the checker has crashed for some reason.
1750 ret_code = StabChecker.poll()
1751 if not ret_code is None:
1752- output = StabChecker.stdout.readline().decode()
1753+ output = StabChecker.stdout.readline().decode(errors='ignore')
1754 if output != '':
1755 last_non_empty = output
1756- error = StabChecker.stderr.readline().decode()
1757+ error = StabChecker.stderr.readline().decode(errors='ignore')
1758 raise MadGraph5Error("The MadLoop stability checker crashed with return code = %d, and last output:\n\nstdout: %s\nstderr: %s\n"%\
1759 (ret_code, last_non_empty, error))
1760
1761 res = ""
1762 while True:
1763- output = StabChecker.stdout.readline().decode()
1764+ output = StabChecker.stdout.readline().decode(errors='ignore')
1765 if output != '':
1766 last_non_empty = output
1767 if str(output)==' ##TAG#RESULT_STOP#TAG##\n':
1768@@ -1879,10 +1879,10 @@
1769 res += output
1770 ret_code = StabChecker.poll()
1771 if not ret_code is None:
1772- output = StabChecker.stdout.readline().decode()
1773+ output = StabChecker.stdout.readline().decode(errors='ignore')
1774 if output != '':
1775 last_non_empty = output
1776- error = StabChecker.stderr.readline().decode()
1777+ error = StabChecker.stderr.readline().decode(errors='ignore')
1778 raise MadGraph5Error("The MadLoop stability checker crashed with return code = %d, and last output:\n\nstdout: %s\nstderr: %s\n"%\
1779 (ret_code, last_non_empty, error))
1780
1781
1782=== modified file 'madgraph/various/systematics.py'
1783--- madgraph/various/systematics.py 2021-11-03 22:54:16 +0000
1784+++ madgraph/various/systematics.py 2021-12-04 08:46:24 +0000
1785@@ -96,9 +96,16 @@
1786 self.banner = banner_mod.Banner(self.input.banner)
1787 self.force_write_banner = bool(write_banner)
1788 self.orig_dyn = self.banner.get('run_card', 'dynamical_scale_choice')
1789- scalefact = self.banner.get('run_card', 'scalefact')
1790- if scalefact != 1:
1791- self.orig_dyn = -1
1792+ if self.banner.run_card.LO:
1793+ scalefact = self.banner.get('run_card', 'scalefact')
1794+ if scalefact != 1:
1795+ self.orig_dyn = -1
1796+ else:
1797+ over1 = self.banner.get('run_card', 'mur_over_ref')
1798+ over2 = self.banner.get('run_card', 'muf_over_ref')
1799+ if over1 != 1 or over2 !=1:
1800+ self.orig_dyn = -1
1801+
1802 self.orig_pdf = self.banner.run_card.get_lhapdf_id()
1803 matching_mode = self.banner.get('run_card', 'ickkw')
1804
1805@@ -141,7 +148,7 @@
1806 isEVA=True
1807 pdf='0'
1808 # eva-on-DIS(lhapdf)
1809- elif self.banner.run_card['pdlabel1']=='eva' and self.banner.run_card['pdlabel2']=='lhapdf':
1810+ elif self.banner.run_card.LO and (self.banner.run_card['pdlabel1']=='eva' and self.banner.run_card['pdlabel2']=='lhapdf'):
1811 if abs(beam1) == 11 or abs(beam1) == 13:
1812 self.b1 = beam1
1813 else:
1814@@ -149,7 +156,7 @@
1815 #self.b2 = beam2//2212
1816 isEVAxDIS=True
1817 # DIS(lhapdf)-on-eva
1818- elif self.banner.run_card['pdlabel1']=='lhapdf' and self.banner.run_card['pdlabel2']=='eva':
1819+ elif self.banner.run_card.LO and (self.banner.run_card['pdlabel1']=='lhapdf' and self.banner.run_card['pdlabel2']=='eva'):
1820 if abs(beam2) == 11 or abs(beam2) == 13:
1821 self.b2 = beam2
1822 else:
1823@@ -1083,7 +1090,7 @@
1824
1825
1826 if __debug__ and dyn== -1 and Dmur==1 and Dmuf==1 and pdf==self.orig_pdf:
1827- if not misc.equal(tmp, onewgt.ref_wgt, sig_fig=2):
1828+ if not misc.equal(tmp, onewgt.ref_wgt, sig_fig=1):
1829 misc.sprint(tmp, onewgt.ref_wgt, (tmp-onewgt.ref_wgt)/tmp)
1830 misc.sprint(onewgt)
1831 misc.sprint(cevent)
1832
1833=== modified file 'models/import_ufo.py'
1834--- models/import_ufo.py 2021-11-08 08:25:41 +0000
1835+++ models/import_ufo.py 2021-12-04 08:46:24 +0000
1836@@ -142,7 +142,7 @@
1837 data =get_model_db()
1838 link = None
1839 for line in data:
1840- split = line.decode().split()
1841+ split = line.decode(errors='ignore').split()
1842 if model_name == split[0]:
1843 link = split[1]
1844 break
1845
1846=== modified file 'tests/acceptance_tests/test_cmd_madevent.py'
1847--- tests/acceptance_tests/test_cmd_madevent.py 2021-11-02 14:47:17 +0000
1848+++ tests/acceptance_tests/test_cmd_madevent.py 2021-12-04 08:46:24 +0000
1849@@ -786,10 +786,12 @@
1850 generate_events
1851 parton
1852 set nevents 100
1853- set event_norm sum
1854+ set event_norm average
1855 set systematics_program none
1856 add_time_of_flight --threshold=4e-14
1857+ pythia8
1858 """ %self.run_dir
1859+
1860 open(pjoin(self.path, 'mg5_cmd'),'w').write(cmd)
1861
1862 if logging.getLogger('madgraph').level <= 20:
1863@@ -805,7 +807,7 @@
1864 stdout=stdout, stderr=stderr)
1865
1866 self.check_parton_output(cross=15.62, error=0.19)
1867- #self.check_pythia_output()
1868+ self.check_pythia_output()
1869 event = '%s/Events/run_01/unweighted_events.lhe' % self.run_dir
1870 if not os.path.exists(event):
1871 misc.gunzip(event)
1872@@ -856,6 +858,7 @@
1873 output %(path)s
1874 launch
1875 madspin=ON
1876+ shower=pythia8
1877 %(path)s/../madspin_card.dat
1878 set nevents 1000
1879 set lhaid 10042
1880@@ -889,7 +892,7 @@
1881 self.check_parton_output('run_01_decayed_1', cross=66344.2066122, error=1.5e+03,target_event=666, delta_event=40)
1882 #logger.info('\nMS info: the number of events in the html file is not (always) correct after MS\n')
1883 self.check_parton_output('run_01_decayed_2', cross=100521.52517, error=8e+02,target_event=1000)
1884- #self.check_pythia_output(run_name='run_01_decayed_1')
1885+ self.check_pythia_output(run_name='run_01_decayed_1')
1886
1887 #check the first decayed events for energy-momentum conservation.
1888
1889@@ -993,8 +996,8 @@
1890 """ """
1891 # check that the number of event is fine:
1892 data = self.load_result(run_name)
1893- self.assertTrue('hep' in data[0].pythia)
1894- self.assertTrue('log' in data[0].pythia)
1895+ self.assertTrue('hep' in data[0].pythia or 'hepmc' in data[0].pythia8)
1896+ self.assertTrue('log' in data[0].pythia or 'log' in data[0].pythia8)
1897
1898
1899 def test_decay_width_nlo_model(self):
1900
1901=== modified file 'tests/parallel_tests/test_cmd_amcatnlo.py'
1902--- tests/parallel_tests/test_cmd_amcatnlo.py 2020-03-27 19:40:16 +0000
1903+++ tests/parallel_tests/test_cmd_amcatnlo.py 2021-12-04 08:46:24 +0000
1904@@ -40,6 +40,7 @@
1905 import madgraph.various.misc as misc
1906 import madgraph.various.banner as banner
1907
1908+from tests import test_manager
1909
1910 _file_path = os.path.split(os.path.dirname(os.path.realpath(__file__)))[0]
1911 _pickle_path =os.path.join(_file_path, 'input_files')
1912@@ -562,7 +563,7 @@
1913 self.assertTrue(os.path.exists('%s/Events/run_01/events_PYTHIA6Q_0.hep.gz' % self.path))
1914
1915
1916-
1917+ @test_manager.bypass_for_py3
1918 def test_short_jet_veto_xsec(self):
1919 """tests the jet-veto cross section at NNLL+NLO"""
1920
1921
1922=== modified file 'tests/unit_tests/iolibs/test_export_fks.py'
1923--- tests/unit_tests/iolibs/test_export_fks.py 2020-11-27 13:41:46 +0000
1924+++ tests/unit_tests/iolibs/test_export_fks.py 2021-12-04 08:46:24 +0000
1925@@ -230,7 +230,7 @@
1926
1927 interface = MGCmd.MasterCmd()
1928
1929- run_cmd('define p3 = d s b d~ s~ b~')
1930+ run_cmd('define p3 = d s b d~ s~ b~ a')
1931 run_cmd('set low_mem_multicore_nlo_generation True')
1932 run_cmd('generate p3 p3 > e+ e- QED^2=4 QCD^2=0 [QED]')
1933 run_cmd('output %s' % os.path.join(path, 'Z-newway'))
1934@@ -279,7 +279,7 @@
1935
1936 interface = MGCmd.MasterCmd()
1937
1938- run_cmd('define p3 = d s b d~ s~ b~ a')
1939+ run_cmd('define p3 = d s b d~ s~ b~')
1940 run_cmd('set low_mem_multicore_nlo_generation True')
1941 run_cmd('generate p3 p3 > e+ e- QED^2=4 QCD^2=0 [QCD]')
1942 run_cmd('output %s' % os.path.join(path, 'Z-newway'))

Subscribers

People subscribed via source and target branches

to all changes: