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

Proposed by Olivier Mattelaer
Status: Merged
Merged at revision: 258
Proposed branch: lp:~maddevelopers/mg5amcnlo/2.2.3
Merge into: lp:mg5amcnlo/lts
Diff against target: 5846 lines (+2400/-1569) (has conflicts)
62 files modified
MadSpin/decay.py (+199/-134)
MadSpin/src/driver.f (+4/-4)
Template/LO/Source/cuts.inc (+4/-1)
Template/LO/Source/setrun.f (+2/-2)
Template/LO/SubProcesses/myamp.f (+21/-12)
Template/MadWeight/Python/MW_param_default.inc (+2/-2)
Template/MadWeight/src/driver.f (+3/-0)
Template/NLO/Cards/shower_card.dat (+1/-0)
Template/NLO/MCatNLO/Scripts/MCatNLO_MadFKS_HERWIGPP.Script (+2/-0)
Template/NLO/MCatNLO/Scripts/MCatNLO_MadFKS_PYTHIA8.Script (+1/-0)
Template/NLO/MCatNLO/shower_template.sh (+2/-1)
Template/NLO/MCatNLO/srcCommon/mcatnlo_hbook.f (+2/-0)
Template/NLO/MCatNLO/srcCommon/mcatnlo_hbook_gfortran4.f (+2/-0)
Template/NLO/MCatNLO/srcCommon/mcatnlo_hbook_gfortran8.f (+2/-0)
Template/NLO/MCatNLO/srcHerwig/madfks_hwdriver.f (+2/-1)
Template/NLO/MCatNLO/srcPythia/madfks_pydriver.f (+1/-0)
Template/NLO/MCatNLO/srcPythia8/Pythia82.cc (+9/-5)
Template/NLO/MCatNLO/srcPythia8/Pythia82_hep.cc (+10/-6)
Template/NLO/MCatNLO/srcPythia8/Pythia8_hep.cc (+1/-0)
Template/NLO/Source/PDF/pdg2pdf.f (+36/-51)
Template/NLO/Source/PDF/pdg2pdf_lhapdf.f (+32/-46)
Template/NLO/Source/rw_routines.f (+1/-1)
Template/NLO/Source/setrun.f (+10/-5)
Template/NLO/SubProcesses/add_write_info.f (+3/-3)
Template/NLO/SubProcesses/c_weight.inc (+12/-0)
Template/NLO/SubProcesses/cuts.f (+4/-0)
Template/NLO/SubProcesses/driver_mintFO.f (+232/-163)
Template/NLO/SubProcesses/driver_mintMC.f (+9/-5)
Template/NLO/SubProcesses/fks_singular.f (+1273/-874)
Template/NLO/SubProcesses/genps_fks.f (+9/-1)
Template/NLO/SubProcesses/handling_lhe_events.f (+3/-6)
Template/NLO/SubProcesses/madfks_plot.f (+13/-47)
Template/NLO/SubProcesses/reweight_xsec.f (+3/-3)
Template/NLO/SubProcesses/reweight_xsec_events.f (+1/-1)
Template/NLO/SubProcesses/setcuts.f (+2/-0)
Template/NLO/SubProcesses/timing_variables.inc (+9/-4)
Template/NLO/SubProcesses/write_event.f (+1/-10)
UpdateNotes.txt (+24/-1)
aloha/aloha_writers.py (+56/-4)
madgraph/core/base_objects.py (+2/-1)
madgraph/interface/amcatnlo_run_interface.py (+56/-23)
madgraph/interface/common_run_interface.py (+7/-3)
madgraph/interface/madevent_interface.py (+60/-31)
madgraph/interface/madgraph_interface.py (+14/-10)
madgraph/iolibs/export_fks.py (+21/-5)
madgraph/iolibs/template_files/madevent_symmetry.f (+14/-8)
madgraph/various/banner.py (+3/-3)
madgraph/various/cluster.py (+49/-36)
madgraph/various/gen_crossxhtml.py (+6/-3)
madgraph/various/lhe_parser.py (+22/-20)
madgraph/various/misc.py (+7/-6)
models/heft/restrict_ckm.dat (+1/-1)
models/heft/restrict_default.dat (+1/-1)
models/heft/restrict_no_b_mass.dat (+1/-1)
models/heft/restrict_no_masses.dat (+1/-1)
models/heft/restrict_no_tau_mass.dat (+1/-1)
models/heft/restrict_zeromass_ckm.dat (+1/-1)
models/usermod.py (+38/-7)
tests/acceptance_tests/test_cmd_amcatnlo.py (+52/-0)
tests/unit_tests/interface/test_madevent.py (+2/-0)
tests/unit_tests/various/test_aloha.py (+36/-14)
tests/unit_tests/various/test_shower_card.py (+2/-0)
Text conflict in UpdateNotes.txt
To merge this branch: bzr merge lp:~maddevelopers/mg5amcnlo/2.2.3
Reviewer Review Type Date Requested Status
MadTeam Pending
Review via email: mp+248136@code.launchpad.net
To post a comment you must log in.
lp:~maddevelopers/mg5amcnlo/2.2.3 updated
341. By Olivier Mattelaer

fix a problem in add model with particle/anti-particle identification

342. By Olivier Mattelaer

Improve MadSpin in helicity only mode

343. By Olivier Mattelaer

fix misc.gunzip

344. By marco zaro

 small fix/change (suggested by J. Bendavid) about when jobs are split

345. By Rikkert Frederix

Fix in the definition of the total cross section when generating a HepMC file with pythia8.

346. By Rikkert Frederix

The NLO code now stops if trying to compute cross section at fixed
s-hat (i.e. without PDFs) but with initial state j_fks.

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

Hi guys, I'm starting the merge.

All the following revision in this branch will not be part of the official release.

Cheers,

Olivier

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

Hi Rik,

Could you be more specific for the following two input in the UpdateNotes:
 RF: If a NAN is found, the code now skips that PS point and continues.
 RF: For fNLO runs the virtuals were included twice in the setting of the integration grids.

Especially how critical is the second. (i.e. can previous computation can be trusted)

Cheers,

Olivier

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

Hi Olivier,

> RF: If a NAN is found, the code now skips that PS point and continues.

Due to numerical inaccuracies, very rarely you might get a NAN from the phase-space generation or somewhere else for a single PS point. Before the code added this NAN phase-space points to the result, which meant that all became NANs. Now it simply skips this very rare PS point and continues correctly.

> RF: For fNLO runs the virtuals were included twice in the setting of the
> integration grids.

This is nothing serious: it was only in the setting of the grids, not in the actual results. Moreover, due to the virt-tricks the actual contribution from the virtuals is nearly always negligible anyway.

Cheers,
Rik

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-10-22 13:41:57 +0000
3+++ MadSpin/decay.py 2015-02-04 13:27:21 +0000
4@@ -2003,9 +2003,10 @@
5 # generate BR and all the square matrix element based on the banner.
6 self.generate_all_matrix_element()
7
8- resonances = self.width_estimator.resonances
9- logger.debug('List of resonances: %s' % resonances)
10- self.extract_resonances_mass_width(resonances)
11+ if not self.options["onlyhelicity"]:
12+ resonances = self.width_estimator.resonances
13+ logger.debug('List of resonances: %s' % resonances)
14+ self.extract_resonances_mass_width(resonances)
15
16 self.compile()
17
18@@ -2056,6 +2057,8 @@
19 for key in self.all_ME:
20 for mode in self.all_ME['decays']:
21 mode['max_weight'] = max_weight_arg
22+ elif self.options["onlyhelicity"]:
23+ logger.info("not needed in helicity mode")
24 else:
25 #self.get_max_weight_from_1toN()
26 self.get_max_weight_from_event(decay_mapping)
27@@ -2093,7 +2096,8 @@
28 if not self.options['ms_dir']:
29 shutil.rmtree(pjoin(self.path_me,'production_me'))
30 shutil.rmtree(pjoin(self.path_me,'full_me'))
31- shutil.rmtree(pjoin(self.path_me,'decay_me'))
32+ if not self.options["onlyhelicity"]:
33+ shutil.rmtree(pjoin(self.path_me,'decay_me'))
34 # set the environment variable GFORTRAN_UNBUFFERED_ALL
35 # to its original value
36 #os.environ['GFORTRAN_UNBUFFERED_ALL']='n'
37@@ -2137,7 +2141,7 @@
38 self.write_banner_information()
39
40
41- event_nb = 0
42+ event_nb, fail_nb = 0, 0
43 nb_skip = 0
44 trial_nb_all_events=0
45 starttime = time.time()
46@@ -2146,34 +2150,23 @@
47 production_tag, event_map = self.load_event()
48 if production_tag == 0 == event_map: #end of file
49 break
50-
51- numdecays=0
52- for decay in self.all_ME[production_tag]['decays']:
53- if decay['decay_tag']:
54- numdecays = numdecays + 1
55-
56- if not numdecays:
57- #no decays for this production mode, run in passthrough mode, only adding the helicities to the events
58- nb_mc_masses=0
59- p, p_str=self.curr_event.give_momenta(event_map)
60- stdin_text=' %s %s %s %s \n' % ('2', self.options['BW_cut'], self.Ecollider, 1.0)
61- stdin_text+=p_str
62- # here I also need to specify the Monte Carlo Masses
63- stdin_text+=" %s \n" % nb_mc_masses
64-
65- mepath = self.all_ME[production_tag]['path']
66- mepath = mepath.replace('production_me','full_me');
67-
68- trial_nb, BWvalue, weight, momenta, failed, use_mc_masses, helicities = self.loadfortran( 'unweighting', mepath, stdin_text)
69-
70- self.reset_helicityonly_in_prod_event(event_map, helicities)
71- event_nb+=1
72- decayed_event = self.curr_event
73- self.outputfile.write(decayed_event.string_event())
74- #print "number of trials: "+str(trial_nb)
75+
76+ if event_nb and \
77+ (event_nb % max(int(10**int(math.log10(float(event_nb)))),1000)==0):
78+ running_time = misc.format_timer(time.time()-starttime)
79+ logger.info('Event nb %s %s' % (event_nb, running_time))
80+ self.mscmd.update_status(('$events',1,event_nb, 'decaying events'),
81+ force=False, print_log=False)
82+ if (event_nb==10001): logger.info('reducing number of print status. Next status update in 10000 events')
83+
84+
85+ if self.options["onlyhelicity"]:
86+ trial_nb, fail = self.adding_only_helicity(event_map, production_tag)
87 trial_nb_all_events+=trial_nb
88+ fail_nb += fail
89+ event_nb += 1
90 continue
91-
92+
93 # Here we need to select a decay configuration on a random basis:
94 decay = self.all_ME.get_random_decay(production_tag)
95 if not decay['decay_tag']:
96@@ -2191,12 +2184,6 @@
97
98 event_nb+=1
99 report[decay['decay_tag']] += 1
100- if (event_nb % max(int(10**int(math.log10(float(event_nb)))),1000)==0):
101- running_time = misc.format_timer(time.time()-starttime)
102- logger.info('Event nb %s %s' % (event_nb, running_time))
103- self.mscmd.update_status(('$events',1,event_nb, 'decaying events'),
104- force=False, print_log=False)
105- if (event_nb==10001): logger.info('reducing number of print status. Next status update in 10000 events')
106
107 indices_for_mc_masses, values_for_mc_masses=self.get_montecarlo_masses_from_event(decay['decay_struct'], event_map, decay['prod2full'])
108 nb_mc_masses=len(indices_for_mc_masses)
109@@ -2211,7 +2198,12 @@
110 stdin_text+='%s \n' % str(values_for_mc_masses).strip('[]').replace(',', ' ')
111
112 # here apply the reweighting procedure in fortran
113- trial_nb, BWvalue, weight, momenta, failed, use_mc_masses, helicities = self.loadfortran( 'unweighting', decay_me['path'], stdin_text)
114+ output = self.loadfortran( 'unweighting', decay_me['path'], stdin_text)
115+ if not output:
116+ fail_nb +=1
117+ continue
118+ trial_nb, BWvalue, weight, momenta, failed, use_mc_masses, helicities = output
119+
120 # next: need to fill all intermediate momenta
121 if nb_mc_masses>0 and use_mc_masses==0:nb_fail_mc_mass+=1
122
123@@ -2312,9 +2304,43 @@
124 logger.info('Number of events with weights larger than max_weight: %s' % report['over_weight'])
125 logger.info('Number of subprocesses '+str(len(self.calculator)))
126 logger.info('Number of failures when restoring the Monte Carlo masses: %s ' % nb_fail_mc_mass)
127+ if fail_nb:
128+ logger.info('Number of failures in reshuffling (event skipped): %s ' % fail_nb)
129
130 return event_nb/(event_nb+nb_skip)
131
132+
133+ def adding_only_helicity(self, event_map, production_tag):
134+ """no decays for this production mode, run in passthrough mode,
135+ only adding the helicities to the events """
136+
137+ #no decays for this production mode, run in passthrough mode, only adding the helicities to the events
138+ nb_mc_masses=0
139+ p, p_str=self.curr_event.give_momenta(event_map)
140+ stdin_text=' %s %s %s %s \n' % ('2', self.options['BW_cut'], self.Ecollider, 1.0)
141+ stdin_text+=p_str
142+ # here I also need to specify the Monte Carlo Masses
143+ stdin_text+=" %s \n" % nb_mc_masses
144+
145+ mepath = self.all_ME[production_tag]['path']
146+ decay = self.all_ME[production_tag]['decays'][0]
147+ decay_me=self.all_ME.get_decay_from_tag(production_tag, decay['decay_tag'])
148+ mepath = decay_me['path']
149+
150+ output = self.loadfortran( 'unweighting', mepath, stdin_text)
151+ if not output:
152+ # Event fail
153+ return 0, 1
154+ trial_nb, BWvalue, weight, momenta, failed, use_mc_masses, helicities = output
155+ self.reset_helicityonly_in_prod_event(event_map, helicities)
156+
157+ decayed_event = self.curr_event
158+ self.outputfile.write(decayed_event.string_event())
159+ #print "number of trials: "+str(trial_nb)
160+
161+ return trial_nb, 0
162+
163+
164 def get_int_mom_in_decay(self,decay_struct,ext_mom):
165 """ fill """
166 momenta_in_decay={}
167@@ -2569,7 +2595,8 @@
168 path_me = self.path_me
169
170 # 1. compute the partial width------------------------------------------
171- self.get_branching_ratio()
172+ if not self.options["onlyhelicity"]:
173+ self.get_branching_ratio()
174
175 # 2. compute the production matrix element -----------------------------
176 processes = [line[9:].strip() for line in self.banner.proc_card
177@@ -2592,11 +2619,22 @@
178 start = time.time()
179 commandline=''
180 for proc in processes:
181+ # deal with @ syntax need to move it after the decay specification
182+ if '@' in proc:
183+ proc, proc_nb = proc.split('@')
184+ try:
185+ proc_nb = int(proc_nb)
186+ except ValueError:
187+ raise MadSpinError, 'MadSpin didn\'t allow order restriction after the @ comment: \"%s\" not valid' % proc_nb
188+ proc_nb = '@ %i' % proc_nb
189+ else:
190+ proc_nb = ''
191+
192 if '[' not in proc:
193 commandline+="add process %s --no_warning=duplicate;" % proc
194 else:
195 process, order, final = re.split('\[\s*(.*)\s*\]', proc)
196- commandline+="add process %s --no_warning=duplicate;" % (process)
197+ commandline+="add process %s %s --no_warning=duplicate;" % (process, proc_nb)
198 if not order:
199 continue
200 elif not order.startswith('virt='):
201@@ -2620,14 +2658,14 @@
202 result = re.split('([/$@]|\w+=\w+)', process, 1)
203 if len(result) ==3:
204 process, split, rest = result
205- commandline+="add process %s pert_%s %s%s --no_warning=duplicate;" % (process, order ,split, rest)
206+ commandline+="add process %s pert_%s %s%s %s --no_warning=duplicate;" % (process, order ,split, rest, proc_nb)
207 else:
208- commandline +='add process %s pert_%s --no_warning=duplicate;' % (process,order)
209+ commandline +='add process %s pert_%s %s --no_warning=duplicate;' % (process,order, proc_nb)
210 commandline = commandline.replace('add process', 'generate',1)
211 logger.info(commandline)
212 mgcmd.exec_cmd(commandline, precmd=True)
213 commandline = 'output standalone_msP %s %s' % \
214- (pjoin(path_me,'production_me'), ' '.join(self.list_branches.keys()))
215+ (pjoin(path_me,'production_me'), ' '.join(self.list_branches.keys()))
216 mgcmd.exec_cmd(commandline, precmd=True)
217 logger.info('Done %.4g' % (time.time()-start))
218
219@@ -2651,90 +2689,97 @@
220 for key in self.list_branches.keys():
221 if key not in final_states and key not in self.mgcmd._multiparticles:
222 if (len(self.list_branches)>1):
223- del self.list_branches[key]
224- else:
225- logger.info('keeping dummy decay for passthrough mode')
226+ del self.list_branches[key]
227+ elif not self.options["onlyhelicity"]:
228+ raise Exception, " No decay define for process."
229+ logger.info('keeping dummy decay for passthrough mode')
230
231 # 4. compute the full matrix element -----------------------------------
232- logger.info('generating the full square matrix element (with decay)')
233- start = time.time()
234- to_decay = self.mscmd.list_branches.keys()
235- decay_text = []
236- for decays in self.mscmd.list_branches.values():
237- for decay in decays:
238- if '=' not in decay:
239- decay += ' QCD=99'
240- if ',' in decay:
241- decay_text.append('(%s)' % decay)
242- else:
243- decay_text.append(decay)
244- decay_text = ', '.join(decay_text)
245- commandline = ''
246-
247-
248- for proc in processes:
249- # deal with @ syntax need to move it after the decay specification
250- if '@' in proc:
251- proc, proc_nb = proc.split('@')
252- try:
253- proc_nb = int(proc_nb)
254- except ValueError:
255- raise MadSpinError, 'MadSpin didn\'t allow order restriction after the @ comment: \"%s\" not valid' % proc_nb
256- proc_nb = '@ %i' % proc_nb
257- else:
258- proc_nb = ''
259-
260- if '[' not in proc:
261- nb_comma = proc.count(',')
262- if nb_comma == 0:
263- commandline+="add process %s, %s %s --no_warning=duplicate;" % (proc, decay_text, proc_nb)
264- elif nb_comma == 1:
265- before, after = proc.split(',')
266- commandline+="add process %s, %s, (%s, %s) %s --no_warning=duplicate;" % (before, decay_text, after, decay_text, proc_nb)
267- else:
268- raise Exception, 'too much decay at MG level. this can not be done for the moment)'
269- else:
270- process, order, final = re.split('\[\s*(.*)\s*\]', proc)
271- commandline+="add process %s, %s %s --no_warning=duplicate;" % (process, decay_text, proc_nb)
272- if not order:
273- continue
274- elif not order.startswith('virt='):
275- if '=' in order:
276- order = order.split('=',1)[1]
277- # define the list of particles that are needed for the radiateion
278- pert = fks_common.find_pert_particles_interactions(
279- mgcmd._curr_model,pert_order = order)['soft_particles']
280- commandline += "define pert_%s = %s;" % (order, ' '.join(map(str,pert)) )
281-
282- # check if we have to increase by one the born order
283- if '%s=' % order in process:
284- result=re.split(' ',process)
285- process=''
286- for r in result:
287- if '%s=' % order in r:
288- ior=re.split('=',r)
289- r='QCD=%i' % (int(ior[1])+1)
290- process=process+r+' '
291- #handle special tag $ | / @
292- result = re.split('([/$@]|\w+=\w+)', process, 1)
293- if len(result) ==3:
294- process, split, rest = result
295- commandline+="add process %s pert_%s %s%s , %s %s --no_warning=duplicate;" % \
296- (process, order, split, rest, decay_text, proc_nb)
297- else:
298- commandline +='add process %s pert_%s, %s %s --no_warning=duplicate;' % \
299- (process, order, decay_text, proc_nb)
300-
301+ if not self.options["onlyhelicity"]:
302+ logger.info('generating the full square matrix element (with decay)')
303+ start = time.time()
304+ to_decay = self.mscmd.list_branches.keys()
305+ decay_text = []
306+ for decays in self.mscmd.list_branches.values():
307+ for decay in decays:
308+ if '=' not in decay:
309+ decay += ' QCD=99'
310+ if ',' in decay:
311+ decay_text.append('(%s)' % decay)
312+ else:
313+ decay_text.append(decay)
314+ decay_text = ', '.join(decay_text)
315+ commandline = ''
316+
317+
318+ for proc in processes:
319+ # deal with @ syntax need to move it after the decay specification
320+ if '@' in proc:
321+ proc, proc_nb = proc.split('@')
322+ try:
323+ proc_nb = int(proc_nb)
324+ except ValueError:
325+ raise MadSpinError, 'MadSpin didn\'t allow order restriction after the @ comment: \"%s\" not valid' % proc_nb
326+ proc_nb = '@ %i' % proc_nb
327+ else:
328+ proc_nb = ''
329+
330+ if '[' not in proc:
331+ nb_comma = proc.count(',')
332+ if nb_comma == 0:
333+ commandline+="add process %s, %s %s --no_warning=duplicate;" % (proc, decay_text, proc_nb)
334+ elif nb_comma == 1:
335+ before, after = proc.split(',')
336+ commandline+="add process %s, %s, (%s, %s) %s --no_warning=duplicate;" % (before, decay_text, after, decay_text, proc_nb)
337+ else:
338+ raise Exception, 'too much decay at MG level. this can not be done for the moment)'
339+ else:
340+ process, order, final = re.split('\[\s*(.*)\s*\]', proc)
341+ commandline+="add process %s, %s %s --no_warning=duplicate;" % (process, decay_text, proc_nb)
342+ if not order:
343+ continue
344+ elif not order.startswith('virt='):
345+ if '=' in order:
346+ order = order.split('=',1)[1]
347+ # define the list of particles that are needed for the radiateion
348+ pert = fks_common.find_pert_particles_interactions(
349+ mgcmd._curr_model,pert_order = order)['soft_particles']
350+ commandline += "define pert_%s = %s;" % (order, ' '.join(map(str,pert)) )
351
352- commandline = commandline.replace('add process', 'generate',1)
353- logger.info(commandline)
354- mgcmd.exec_cmd(commandline, precmd=True)
355- # remove decay with 0 branching ratio.
356- mgcmd.remove_pointless_decay(self.banner.param_card)
357- commandline = 'output standalone_msF %s %s' % (pjoin(path_me,'full_me'),
358- ' '.join(self.list_branches.keys()))
359- mgcmd.exec_cmd(commandline, precmd=True)
360- logger.info('Done %.4g' % (time.time()-start))
361+ # check if we have to increase by one the born order
362+ if '%s=' % order in process:
363+ result=re.split(' ',process)
364+ process=''
365+ for r in result:
366+ if '%s=' % order in r:
367+ ior=re.split('=',r)
368+ r='QCD=%i' % (int(ior[1])+1)
369+ process=process+r+' '
370+ #handle special tag $ | / @
371+ result = re.split('([/$@]|\w+=\w+)', process, 1)
372+ if len(result) ==3:
373+ process, split, rest = result
374+ commandline+="add process %s pert_%s %s%s , %s %s --no_warning=duplicate;" % \
375+ (process, order, split, rest, decay_text, proc_nb)
376+ else:
377+ commandline +='add process %s pert_%s, %s %s --no_warning=duplicate;' % \
378+ (process, order, decay_text, proc_nb)
379+ commandline = commandline.replace('add process', 'generate',1)
380+ logger.info(commandline)
381+ mgcmd.exec_cmd(commandline, precmd=True)
382+ # remove decay with 0 branching ratio.
383+ mgcmd.remove_pointless_decay(self.banner.param_card)
384+ commandline = 'output standalone_msF %s %s' % (pjoin(path_me,'full_me'),
385+ ' '.join(self.list_branches.keys()))
386+ mgcmd.exec_cmd(commandline, precmd=True)
387+ logger.info('Done %.4g' % (time.time()-start))
388+ elif self.options["onlyhelicity"]:
389+ logger.info("Helicity Matrix-Element")
390+ commandline = 'output standalone_msF %s %s' % \
391+ (pjoin(path_me,'full_me'), ' '.join(self.list_branches.keys()))
392+ mgcmd.exec_cmd(commandline, precmd=True)
393+ logger.info('Done %.4g' % (time.time()-start))
394+
395
396
397 # 5. add the decay information to the all_topology object --------------
398@@ -2762,6 +2807,9 @@
399 self.generate_configs_file(nfinal,dico,full_path)
400
401
402+ if self.options["onlyhelicity"]:
403+ return
404+
405 # 6. generate decay only part ------------------------------------------
406 logger.info('generate matrix element for decay only (1 - > N).')
407 start = time.time()
408@@ -2822,9 +2870,10 @@
409
410 def compile(self):
411 logger.info('Compiling code')
412- self.compile_fortran(self.path_me, mode="production_me")
413 self.compile_fortran(self.path_me, mode="full_me")
414- self.compile_fortran(self.path_me, mode="decay_me")
415+ if not self.options["onlyhelicity"]:
416+ self.compile_fortran(self.path_me, mode="production_me")
417+ self.compile_fortran(self.path_me, mode="decay_me")
418
419 def compile_fortran(self, path_me, mode='production_me'):
420 """ Compile the fortran executables associated with the evalutation of the
421@@ -3212,25 +3261,38 @@
422 output = me_value
423 elif mode == 'unweighting':
424 firstline=external.stdout.readline().split()
425- nexternal=int(firstline[0])
426- trials= int(firstline[1])
427- BWvalue= float(firstline[2])
428- weight= float(firstline[3])
429- failed= float(firstline[4])
430- use_mc_masses=int(firstline[5])
431+ try:
432+ nexternal=int(firstline[0])
433+ trials= int(firstline[1])
434+ BWvalue= float(firstline[2])
435+ weight= float(firstline[3])
436+ failed= float(firstline[4])
437+ use_mc_masses=int(firstline[5])
438+ except ValueError:
439+ logger.debug(firstline)
440+ return
441 momenta=[external.stdout.readline() for i in range(nexternal)]
442 lastline=external.stdout.readline().split()
443 helicities=[lastline[i] for i in range(len(lastline))]
444 output = trials, BWvalue, weight, momenta, failed, use_mc_masses, helicities
445
446- if len(self.calculator) > 100:
447- logger.debug('more than 100 calculator. Perform cleaning')
448+ if len(self.calculator) > self.options['max_running_process']:
449+ logger.debug('more than %s calculators. Perform cleaning' % self.options['max_running_process'])
450 nb_calls = self.calculator_nbcall.values()
451 nb_calls.sort()
452 cut = max([nb_calls[len(nb_calls)//2], 0.001 * nb_calls[-1]])
453 for key, external in list(self.calculator.items()):
454 nb = self.calculator_nbcall[key]
455 if nb < cut:
456+ if key[0]=='full':
457+ path=key[1]
458+ end_signal="5 0 0 0 \n" # before closing, write down the seed
459+ external.stdin.write(end_signal)
460+ ranmar_state=external.stdout.readline()
461+ ranmar_file=pjoin(path,'ranmar_state.dat')
462+ ranmar=open(ranmar_file, 'w')
463+ ranmar.write(ranmar_state)
464+ ranmar.close()
465 external.stdin.close()
466 external.stdout.close()
467 external.terminate()
468@@ -3244,6 +3306,9 @@
469 def calculate_matrix_element(self, mode, production, stdin_text):
470 """routine to return the matrix element"""
471
472+ if mode != "decay":
473+ raise Exception, "This function is only secure in mode decay."
474+
475 tmpdir = ''
476 if (mode, production) in self.calculator:
477 external = self.calculator[(mode, production)]
478
479=== modified file 'MadSpin/src/driver.f'
480--- MadSpin/src/driver.f 2014-08-20 09:50:23 +0000
481+++ MadSpin/src/driver.f 2015-02-04 13:27:21 +0000
482@@ -229,10 +229,10 @@
483 if (jac.lt.0d0) then
484 counter2=counter2+1
485 counter3=counter3+1
486-c if (counter3.gt.500) then
487-c write(*,*) "500_pts_failed_stop_executation"
488-c stop
489-c endif
490+ if (counter3.gt.500) then
491+ write(*,*) "500_pts_failed_stop_executation"
492+ goto 1
493+ endif
494 if (counter2.ge.8) then ! use another topology to generate PS points
495 do k=1,n_max_cg
496 amp2(k)=0d0
497
498=== modified file 'Template/LO/Source/cuts.inc'
499--- Template/LO/Source/cuts.inc 2013-11-23 21:12:58 +0000
500+++ Template/LO/Source/cuts.inc 2015-02-04 13:27:21 +0000
501@@ -87,4 +87,7 @@
502 C COMMON BLOCK FOR JET MEASURE CUTS: DURHAM KT
503 REAL*8 KT_DURHAM, D_PARAMETER
504 LOGICAL DO_KT_DURHAM
505- COMMON /JET_MEASURE_CUTS/ KT_DURHAM, D_PARAMETER
506\ No newline at end of file
507+ COMMON /JET_MEASURE_CUTS/ KT_DURHAM, D_PARAMETER
508+
509+
510+
511\ No newline at end of file
512
513=== modified file 'Template/LO/Source/setrun.f'
514--- Template/LO/Source/setrun.f 2014-02-23 03:15:09 +0000
515+++ Template/LO/Source/setrun.f 2015-02-04 13:27:21 +0000
516@@ -194,8 +194,8 @@
517 $ 10000,
518 $ 10041,
519 $ 10042,
520- $ 200200,
521- $ 200400,
522+ $ 246800,
523+ $ 247000,
524 $ 244600/
525
526
527
528=== modified file 'Template/LO/SubProcesses/myamp.f'
529--- Template/LO/SubProcesses/myamp.f 2014-02-20 11:27:50 +0000
530+++ Template/LO/SubProcesses/myamp.f 2015-02-04 13:27:21 +0000
531@@ -259,9 +259,14 @@
532 endif
533 c
534 c Here we set onshell for phase space integration (JA 4/8/11)
535-c
536- onshell = (abs(xmass - prmass(i,iconfig)) .lt.
537+c For decay-chain syntax use BWcutoff here too (22/12/14)
538+ if (gForceBW(i, iconfig).eq.1) then
539+ onshell = (abs(xmass - prmass(i,iconfig)) .lt.
540+ $ bwcutoff*prwidth(i,iconfig))
541+ else
542+ onshell = (abs(xmass - prmass(i,iconfig)) .lt.
543 $ 5d0*prwidth(i,iconfig))
544+ endif
545
546 if (onshell .and. (lbw(nbw).eq. 2) .or.
547 $ .not. onshell .and. (lbw(nbw).eq. 1)) then
548@@ -297,6 +302,7 @@
549 c
550 double precision xm(-nexternal:nexternal)
551 double precision xe(-nexternal:nexternal)
552+ double precision bwcut_for_PS(-nexternal:0)
553 double precision tsgn, xo, a
554 double precision x1,x2,xk(nexternal)
555 double precision dr,mtot,etot,xqfact
556@@ -440,25 +446,28 @@
557 if (prwidth(i,iconfig) .gt. 0 ) then
558 nbw=nbw+1
559 c JA 6/8/2011 Set xe(i) for resonances
560- if (lbw(nbw).eq.1) then
561+ if (gforcebw(i,iconfig).eq.1) then
562+ xm(i) = max(xm(i), prmass(i,iconfig)-bwcutoff*prwidth(i,iconfig))
563+ bwcut_for_PS(i) = bwcutoff
564+ else if (lbw(nbw).eq.1) then
565 xm(i) = max(xm(i), prmass(i,iconfig)-5d0*prwidth(i,iconfig))
566- else if (gforcebw(i,iconfig).eq.1) then
567- xm(i) = max(xm(i), prmass(i,iconfig)-bwcutoff*prwidth(i,iconfig))
568+ bwcut_for_PS(i) = 5d0
569+ else
570+ bwcut_for_PS(i) = 5d0
571 endif
572 endif
573 xe(i)=max(xe(i),xm(i))
574 c Check for impossible onshell configurations
575 c Either: required onshell and daughter masses too large
576 c Or: forced and daughter masses too large
577-c Or: required offshell and forced, with bwcutoff.le.5
578+c Or: required offshell and forced
579 if(prwidth(i,iconfig) .gt. 0.and.
580 $ (lbw(nbw).eq.1.and.
581- $ (prmass(i,iconfig)+5d0*prwidth(i,iconfig).lt.xm(i)
582- $ .or.prmass(i,iconfig)-5d0*prwidth(i,iconfig).gt.dsqrt(stot))
583+ $ (prmass(i,iconfig)+bwcut_for_PS(i)*prwidth(i,iconfig).lt.xm(i)
584+ $ .or.prmass(i,iconfig)-bwcut_for_PS(i)*prwidth(i,iconfig).gt.dsqrt(stot))
585 $ .or.gforcebw(i,iconfig).eq.1.and.
586 $ prmass(i,iconfig)+bwcutoff*prwidth(i,iconfig).lt.xm(i)
587- $ .or.lbw(nbw).eq.2.and.gforcebw(i,iconfig).eq.1 .and.
588- $ bwcutoff.le.5d0))
589+ $ .or.lbw(nbw).eq.2.and.gforcebw(i,iconfig).eq.1))
590 $ then
591 c Write results.dat and quit
592 call write_null_results()
593@@ -478,7 +487,7 @@
594 spole(j)=prmass(i,iconfig)*prmass(i,iconfig)/stot
595 swidth(j) = prwidth(i,iconfig)*prmass(i,iconfig)/stot
596 endif
597- else if((prmass(i,iconfig)+5d0*prwidth(i,iconfig)).ge.xm(i)
598+ else if((prmass(i,iconfig)+bwcut_for_PS(i)*prwidth(i,iconfig)).ge.xm(i)
599 $ .and. iden_part(i).eq.0 .or. lbw(nbw).eq.1) then
600 c JA 02/13 Only allow BW if xm below M+5*Gamma
601 write(*,*) 'Setting BW',i,nbw,prmass(i,iconfig)
602@@ -496,7 +505,7 @@
603 c Set spmass for BWs
604 if (swidth(-i) .ne. 0d0)
605 $ spmass=spmass-xm(i) +
606- $ max(xm(i),prmass(i,iconfig)-5d0*prwidth(i,iconfig))
607+ $ max(xm(i),prmass(i,iconfig)-bwcut_for_PS(i)*prwidth(i,iconfig))
608 else !1/x^pow
609 a=prmass(i,iconfig)**2/stot
610 c JA 4/1/2011 always set grid
611
612=== modified file 'Template/MadWeight/Python/MW_param_default.inc'
613--- Template/MadWeight/Python/MW_param_default.inc 2014-01-26 14:08:26 +0000
614+++ Template/MadWeight/Python/MW_param_default.inc 2015-02-04 13:27:21 +0000
615@@ -14,8 +14,8 @@
616 mw_run use_sobol logical F # don t use sobol generator by default
617 mw_run inputfile string './Events/input.lhco' # path to the inputfile
618
619-mw_parameter mode logical 1
620-mw_parameter 1 logical mw_parameter@@mode # choose the mode for the generation of the param_card.dat
621+mw_parameter mode integer 1
622+mw_parameter 1 integer mw_parameter@@mode # choose the mode for the generation of the param_card.dat
623 mw_parameter 2 logical 0 # put on 1 to add new param_card.dat (for step 1) creates the corresponding new events dir if step 5 already performs
624
625 mw_perm permutation logical T # make the permutation between identical particles/jets
626
627=== modified file 'Template/MadWeight/src/driver.f'
628--- Template/MadWeight/src/driver.f 2014-01-26 14:08:26 +0000
629+++ Template/MadWeight/src/driver.f 2015-02-04 13:27:21 +0000
630@@ -36,6 +36,7 @@
631 double precision order_value(nb_channel)
632 double precision order_error(nb_channel)
633 double precision xi_by_channel(100, 20, nb_channel)
634+ integer ndo_by_channel(nb_channel)
635
636 double precision normalize_perm
637 c
638@@ -226,6 +227,7 @@
639 enddo
640
641 else
642+ ndo = ndo_by_channel(integral_index)
643 do i = 1, ndo
644 do j = 1, NDIM
645 xi(i,j) = xi_by_channel(i, j, integral_index)
646@@ -330,6 +332,7 @@
647 xi_by_channel(i, j, integral_index) = xi(i,j)
648 enddo
649 enddo
650+ ndo_by_channel(integral_index) = ndo
651 else
652 order_value(integral_index)=0d0
653 endif
654
655=== modified file 'Template/NLO/Cards/shower_card.dat'
656--- Template/NLO/Cards/shower_card.dat 2014-08-08 09:58:08 +0000
657+++ Template/NLO/Cards/shower_card.dat 2015-02-04 13:27:21 +0000
658@@ -103,6 +103,7 @@
659 #***********************************************************************
660 EXTRALIBS = stdhep Fmcfio # Extra-libraries (not LHAPDF)
661 # Default: "stdhep Fmcfio"
662+ # PYTHIA > 8.200 may require library dl
663 EXTRAPATHS = ../lib # Path to the extra-libraries
664 # Default: "../lib"
665 INCLUDEPATHS = # Path to header files needed by c++
666
667=== added symlink 'Template/NLO/MCatNLO/HWPPAnalyzer/fjcore.cc'
668=== target is u'../../SubProcesses/fjcore.cc'
669=== modified file 'Template/NLO/MCatNLO/Scripts/MCatNLO_MadFKS_HERWIGPP.Script'
670--- Template/NLO/MCatNLO/Scripts/MCatNLO_MadFKS_HERWIGPP.Script 2014-10-29 14:44:37 +0000
671+++ Template/NLO/MCatNLO/Scripts/MCatNLO_MadFKS_HERWIGPP.Script 2015-02-04 13:27:21 +0000
672@@ -611,6 +611,8 @@
673 #
674 #553
675 set /Herwig/Particles/Upsilon:Stable Stable
676+#551
677+set /Herwig/Particles/eta_b:Stable Stable
678
679 EOF
680 fi
681
682=== modified file 'Template/NLO/MCatNLO/Scripts/MCatNLO_MadFKS_PYTHIA8.Script'
683--- Template/NLO/MCatNLO/Scripts/MCatNLO_MadFKS_PYTHIA8.Script 2014-10-30 15:11:46 +0000
684+++ Template/NLO/MCatNLO/Scripts/MCatNLO_MadFKS_PYTHIA8.Script 2015-02-04 13:27:21 +0000
685@@ -581,6 +581,7 @@
686 521:maydecay = false ! stable B hadrons
687 531:maydecay = false ! stable B hadrons
688 541:maydecay = false ! stable B hadrons
689+551:maydecay = false ! stable B hadrons
690 553:maydecay = false ! stable B hadrons
691 5112:maydecay = false ! stable B hadrons
692 5122:maydecay = false ! stable B hadrons
693
694=== added symlink 'Template/NLO/MCatNLO/include/fjcore.hh'
695=== target is u'../../SubProcesses/fjcore.hh'
696=== modified file 'Template/NLO/MCatNLO/shower_template.sh'
697--- Template/NLO/MCatNLO/shower_template.sh 2014-10-30 15:48:03 +0000
698+++ Template/NLO/MCatNLO/shower_template.sh 2015-02-04 13:27:21 +0000
699@@ -18,7 +18,8 @@
700 cd run_$NFILE
701 cp -H ../events_$NFILE.lhe events.lhe
702 if [ $SHOWER == "PYTHIA8" ] ; then
703- cp ../Pythia8.exe ../Pythia8.cmd ../config.sh .
704+ cp ../Pythia8.exe ../Pythia8.cmd .
705+ if [ -f ../config.sh ] ; then cp ../config.sh . ; fi
706 else
707 if [ $SHOWER == "HERWIGPP" ] ; then
708 cp ../Herwig++ ../HepMCFortran.so .
709
710=== modified file 'Template/NLO/MCatNLO/srcCommon/mcatnlo_hbook.f'
711--- Template/NLO/MCatNLO/srcCommon/mcatnlo_hbook.f 2013-11-20 10:02:06 +0000
712+++ Template/NLO/MCatNLO/srcCommon/mcatnlo_hbook.f 2015-02-04 13:27:21 +0000
713@@ -1396,6 +1396,8 @@
714 YTIT=YU+YTIT0
715 WRITE(99,101) XL,YTIT,TITLE(NH)(1:40)
716 101 FORMAT(' TITLE ',2(F8.4,1X),'"',A,'"')
717+ WRITE(99,151) TITLE(NH)
718+151 FORMAT(' ( TITLE TOP "',A,'"')
719 YTIT=YTIT-2.*YTIT0
720 WRITE(99,102) XTIT,YTIT,HINT(NH)
721 102 FORMAT(' TITLE ',2(F8.4,1X),'" INT=',1PE10.3,'"')
722
723=== modified file 'Template/NLO/MCatNLO/srcCommon/mcatnlo_hbook_gfortran4.f'
724--- Template/NLO/MCatNLO/srcCommon/mcatnlo_hbook_gfortran4.f 2013-11-20 10:02:06 +0000
725+++ Template/NLO/MCatNLO/srcCommon/mcatnlo_hbook_gfortran4.f 2015-02-04 13:27:21 +0000
726@@ -1390,6 +1390,8 @@
727 YTIT=YU+YTIT0
728 WRITE(99,101) XL,YTIT,TITLE(NH)(1:40)
729 101 FORMAT(' TITLE ',2(F8.4,1X),'"',A,'"')
730+ WRITE(99,151) TITLE(NH)
731+151 FORMAT(' ( TITLE TOP "',A,'"')
732 YTIT=YTIT-2.*YTIT0
733 WRITE(99,102) XTIT,YTIT,HINT(NH)
734 102 FORMAT(' TITLE ',2(F8.4,1X),'" INT=',1PE10.3,'"')
735
736=== modified file 'Template/NLO/MCatNLO/srcCommon/mcatnlo_hbook_gfortran8.f'
737--- Template/NLO/MCatNLO/srcCommon/mcatnlo_hbook_gfortran8.f 2013-11-20 10:02:06 +0000
738+++ Template/NLO/MCatNLO/srcCommon/mcatnlo_hbook_gfortran8.f 2015-02-04 13:27:21 +0000
739@@ -1327,6 +1327,8 @@
740 YTIT=YU+YTIT0
741 WRITE(99,101) XL,YTIT,TITLE(NH)(1:40)
742 101 FORMAT(' TITLE ',2(F8.4,1X),'"',A,'"')
743+ WRITE(99,151) TITLE(NH)
744+151 FORMAT(' ( TITLE TOP "',A,'"')
745 YTIT=YTIT-2.*YTIT0
746 WRITE(99,102) XTIT,YTIT,HINT(NH)
747 102 FORMAT(' TITLE ',2(F8.4,1X),'" INT=',1PE10.3,'"')
748
749=== modified file 'Template/NLO/MCatNLO/srcHerwig/madfks_hwdriver.f'
750--- Template/NLO/MCatNLO/srcHerwig/madfks_hwdriver.f 2014-08-25 15:05:30 +0000
751+++ Template/NLO/MCatNLO/srcHerwig/madfks_hwdriver.f 2015-02-04 13:27:21 +0000
752@@ -236,6 +236,7 @@
753 CALL HWUSTA('XI_B- ')
754 CALL HWUSTA('OMEGA_B-')
755 CALL HWUSTA('B_C- ')
756+ CALL HWUSTA('ETA_B ')
757 CALL HWUSTA('UPSLON1S')
758 CALL HWUSTA('SGM_BBR-')
759 CALL HWUSTA('LMD_BBR0')
760@@ -350,7 +351,6 @@
761 CALL HWABEG
762 C---LOOP OVER EVENTS
763 DO 100 N=1,MAXEV
764- 50 CONTINUE
765 C---INITIALISE EVENT
766 CALL HWUINE
767 C---GENERATE HARD SUBPROCESS
768@@ -383,6 +383,7 @@
769 WRITE(*,*)'# of events processed=',NEVHEP
770 c CALL HWAEND
771 ENDIF
772+ 50 CONTINUE
773 100 CONTINUE
774 C---TERMINATE ELEMENTARY PROCESS
775 CALL HWEFIN
776
777=== modified file 'Template/NLO/MCatNLO/srcPythia/madfks_pydriver.f'
778--- Template/NLO/MCatNLO/srcPythia/madfks_pydriver.f 2014-06-03 08:44:17 +0000
779+++ Template/NLO/MCatNLO/srcPythia/madfks_pydriver.f 2015-02-04 13:27:21 +0000
780@@ -155,6 +155,7 @@
781 MDCY(PYCOMP(ISIGN*521),1)=0
782 MDCY(PYCOMP(ISIGN*531),1)=0
783 MDCY(PYCOMP(ISIGN*541),1)=0
784+ MDCY(PYCOMP(551),1)=0
785 MDCY(PYCOMP(553),1)=0
786 MDCY(PYCOMP(ISIGN*5112),1)=0
787 MDCY(PYCOMP(ISIGN*5122),1)=0
788
789=== modified file 'Template/NLO/MCatNLO/srcPythia8/Pythia82.cc'
790--- Template/NLO/MCatNLO/srcPythia8/Pythia82.cc 2014-10-28 13:16:07 +0000
791+++ Template/NLO/MCatNLO/srcPythia8/Pythia82.cc 2015-02-04 13:27:21 +0000
792@@ -39,10 +39,8 @@
793 pythia.readFile(inputname.c_str());
794
795 //Create UserHooks pointer for the FxFX matching. Stop if it failed. Pass pointer to Pythia.
796- CombineMatchingInput combined;
797- UserHooks* matching = combined.getHook(pythia);
798- if (!matching) return 1;
799- pythia.setUserHooksPtr(matching);
800+ CombineMatchingInput* combined = NULL;
801+ UserHooks* matching = NULL;
802
803 pythia.init();
804 string filename = pythia.word("Beams:LHEF");
805@@ -67,6 +65,13 @@
806 //FxFx merging
807 bool isFxFx=pythia.flag("JetMatching:doFxFx");
808 if (isFxFx) {
809+ matching = combined->getHook(pythia);
810+ if (!matching) {
811+ std::cout << " Failed to initialise jet matching structures.\n"
812+ << " Program stopped.";
813+ return 1;
814+ }
815+ pythia.setUserHooksPtr(matching);
816 int nJmax=pythia.mode("JetMatching:nJetMax");
817 double Qcut=pythia.parm("JetMatching:qCut");
818 double PTcut=pythia.parm("JetMatching:qCutME");
819@@ -147,7 +152,6 @@
820 std::cout << "*********************************************************************** \n";
821 std::cout << "*********************************************************************** \n";
822 }
823- delete matching;
824
825 return 0;
826 }
827
828=== modified file 'Template/NLO/MCatNLO/srcPythia8/Pythia82_hep.cc'
829--- Template/NLO/MCatNLO/srcPythia8/Pythia82_hep.cc 2014-10-28 13:16:07 +0000
830+++ Template/NLO/MCatNLO/srcPythia8/Pythia82_hep.cc 2015-02-04 13:27:21 +0000
831@@ -17,10 +17,8 @@
832 pythia.readFile(inputname.c_str());
833
834 //Create UserHooks pointer for the FxFX matching. Stop if it failed. Pass pointer to Pythia.
835- CombineMatchingInput combined;
836- UserHooks* matching = combined.getHook(pythia);
837- if (!matching) return 1;
838- pythia.setUserHooksPtr(matching);
839+ CombineMatchingInput* combined = NULL;
840+ UserHooks* matching = NULL;
841
842 pythia.init();
843
844@@ -35,6 +33,13 @@
845 //FxFx merging
846 bool isFxFx=pythia.flag("JetMatching:doFxFx");
847 if (isFxFx) {
848+ matching = combined->getHook(pythia);
849+ if (!matching) {
850+ std::cout << " Failed to initialise jet matching structures.\n"
851+ << " Program stopped.";
852+ return 1;
853+ }
854+ pythia.setUserHooksPtr(matching);
855 int nJmax=pythia.mode("JetMatching:nJetMax");
856 double Qcut=pythia.parm("JetMatching:qCut");
857 double PTcut=pythia.parm("JetMatching:qCutME");
858@@ -83,6 +88,7 @@
859 } else {
860 normhepmc = double(iEventtot) / double(iEventshower);
861 }
862+ sigmaTotal += evtweight*normhepmc;
863 hepmcevt->weights().push_back(evtweight*normhepmc);
864 ToHepMC.fill_next_event( pythia, hepmcevt );
865 // Add the weight of the current event to the cross section.
866@@ -106,7 +112,5 @@
867 std::cout << "*********************************************************************** \n";
868 }
869
870- delete matching;
871-
872 return 0;
873 }
874
875=== modified file 'Template/NLO/MCatNLO/srcPythia8/Pythia8_hep.cc'
876--- Template/NLO/MCatNLO/srcPythia8/Pythia8_hep.cc 2014-10-28 14:04:42 +0000
877+++ Template/NLO/MCatNLO/srcPythia8/Pythia8_hep.cc 2015-02-04 13:27:21 +0000
878@@ -82,6 +82,7 @@
879 } else {
880 normhepmc = double(iEventtot) / double(iEventshower);
881 }
882+ sigmaTotal += evtweight*normhepmc;
883 hepmcevt->weights().push_back(evtweight*normhepmc);
884 ToHepMC.fill_next_event( pythia, hepmcevt );
885 // Add the weight of the current event to the cross section.
886
887=== modified file 'Template/NLO/Source/PDF/pdg2pdf.f'
888--- Template/NLO/Source/PDF/pdg2pdf.f 2013-12-20 05:39:24 +0000
889+++ Template/NLO/Source/PDF/pdg2pdf.f 2015-02-04 13:27:21 +0000
890@@ -35,17 +35,18 @@
891 include 'pdf.inc'
892 C
893 double precision Ctq3df,Ctq4Fn,Ctq5Pdf,Ctq6Pdf,Ctq5L
894- integer mode,Irt,i,j
895- double precision xlast(2),xmulast(2),pdflast(-7:7,2),q2max
896- character*7 pdlabellast(2)
897+ integer mode,Irt,i,j,i_replace,ii
898+ double precision xlast(20),xmulast(20),pdflast(-7:7,20),q2max
899+ character*7 pdlabellast(20)
900 double precision epa_electron,epa_proton
901- integer ipart,ireuse,iporg,ihlast(2)
902+ integer ipart,ireuse,iporg,ihlast(20)
903 save xlast,xmulast,pdflast,pdlabellast,ihlast
904- data xlast/2*-99d9/
905- data xmulast/2*-99d9/
906- data pdflast/30*-99d9/
907- data pdlabellast/2*'abcdefg'/
908- data ihlast/2*-99/
909+ data xlast/20*-99d9/
910+ data xmulast/20*-99d9/
911+ data pdflast/300*-99d9/
912+ data pdlabellast/20*'abcdefg'/
913+ data ihlast/20*-99/
914+ data i_replace/20/
915
916 c Make sure we have a reasonable Bjorken x. Note that even though
917 c x=0 is not reasonable, we prefer to simply return pdg2pdf=0
918@@ -76,12 +77,22 @@
919 endif
920
921 ireuse = 0
922- do i=1,2
923-c Check if result can be reused since any of last two calls
924- if (x.eq.xlast(i) .and. xmu.eq.xmulast(i) .and.
925- $ pdlabel.eq.pdlabellast(i) .and. ih.eq.ihlast(i)) then
926- ireuse = i
927+ ii=i_replace
928+ do i=1,20
929+c Check if result can be reused since any of last twenty
930+c calls. Start checking with the last call and move back in time
931+ if (ih.eq.ihlast(ii)) then
932+ if (x.eq.xlast(ii)) then
933+ if (xmu.eq.xmulast(ii)) then
934+ if (pdlabel.eq.pdlabellast(ii)) then
935+ ireuse = ii
936+ exit
937+ endif
938+ endif
939+ endif
940 endif
941+ ii=ii-1
942+ if (ii.eq.0) ii=ii+20
943 enddo
944
945 c Reuse previous result, if possible
946@@ -92,41 +103,15 @@
947 endif
948 endif
949
950-c Bjorken x and/or facrorization scale and/or PDF set are not
951-c identical to the saved values: this means a new event and we
952-c should reset everything to compute new PDF values. Also, determine
953-c if we should fill ireuse=1 or ireuse=2.
954- if (ireuse.eq.0.and.xlast(1).ne.-99d9.and.xlast(2).ne.-99d9)then
955- do i=1,2
956- xlast(i)=-99d9
957- xmulast(i)=-99d9
958- do j=-7,7
959- pdflast(j,i)=-99d9
960- enddo
961- pdlabellast(i)='abcdefg'
962- ihlast(i)=-99
963- enddo
964-c everything has been reset. Now set ireuse=1 to fill the first
965-c arrays of saved values below
966- ireuse=1
967- else if(ireuse.eq.0.and.xlast(1).ne.-99d9)then
968-c This is first call after everything has been reset, so the first
969-c arrays are already filled with the saved values (hence
970-c xlast(1).ne.-99d9). Fill the second arrays of saved values (done
971-c below) by setting ireuse=2
972- ireuse=2
973- else if(ireuse.eq.0)then
974-c Special: only used for the very first call to this function:
975-c xlast(i) are initialized as data statements to be equal to -99d9
976- ireuse=1
977- endif
978-
979+c Calculated a new value: replace the value computed longest ago.
980+ i_replace=mod(i_replace,20)+1
981+
982 c Give the current values to the arrays that should be
983 c saved. 'pdflast' is filled below.
984- xlast(ireuse)=x
985- xmulast(ireuse)=xmu
986- pdlabellast(ireuse)=pdlabel
987- ihlast(ireuse)=ih
988+ xlast(i_replace)=x
989+ xmulast(i_replace)=xmu
990+ pdlabellast(i_replace)=pdlabel
991+ ihlast(i_replace)=ih
992
993 if(iabs(ipart).eq.7.and.ih.gt.1) then
994 q2max=xmu*xmu
995@@ -135,7 +120,7 @@
996 elseif(ih .eq. 2) then !from a proton without breaking
997 pdg2pdf=epa_proton(x,q2max)
998 endif
999- pdflast(iporg,ireuse)=pdg2pdf
1000+ pdflast(iporg,i_replace)=pdg2pdf
1001 return
1002 endif
1003
1004@@ -210,11 +195,11 @@
1005
1006 pdg2pdf=Ctq6Pdf(ipart,x,xmu)
1007 else
1008- call pftopdg(ih,x,xmu,pdflast(-7,ireuse))
1009- pdg2pdf=pdflast(iporg,ireuse)
1010+ call pftopdg(ih,x,xmu,pdflast(-7,i_replace))
1011+ pdg2pdf=pdflast(iporg,i_replace)
1012 endif
1013
1014- pdflast(iporg,ireuse)=pdg2pdf
1015+ pdflast(iporg,i_replace)=pdg2pdf
1016 return
1017 end
1018
1019
1020=== modified file 'Template/NLO/Source/PDF/pdg2pdf_lhapdf.f'
1021--- Template/NLO/Source/PDF/pdg2pdf_lhapdf.f 2013-12-20 05:39:24 +0000
1022+++ Template/NLO/Source/PDF/pdg2pdf_lhapdf.f 2015-02-04 13:27:21 +0000
1023@@ -34,14 +34,16 @@
1024 C
1025 include 'pdf.inc'
1026 C
1027- integer i,j,ihlast(2),ipart,iporg,ireuse,imemlast(2),iset,imem
1028- double precision xlast(2),xmulast(2),pdflast(-7:7,2)
1029+ integer i,j,ihlast(20),ipart,iporg,ireuse,imemlast(20),iset,imem
1030+ & ,i_replace,ii
1031+ double precision xlast(20),xmulast(20),pdflast(-7:7,20)
1032 save ihlast,xlast,xmulast,pdflast,imemlast
1033- data ihlast/2*-99/
1034- data xlast/2*-99d9/
1035- data xmulast/2*-99d9/
1036- data pdflast/30*-99d9/
1037- data imemlast/2*-99/
1038+ data ihlast/20*-99/
1039+ data xlast/20*-99d9/
1040+ data xmulast/20*-99d9/
1041+ data pdflast/300*-99d9/
1042+ data imemlast/20*-99/
1043+ data i_replace/20/
1044
1045 c Make sure we have a reasonable Bjorken x. Note that even though
1046 c x=0 is not reasonable, we prefer to simply return pdg2pdf=0
1047@@ -84,12 +86,22 @@
1048 call getnmem(iset,imem)
1049
1050 ireuse = 0
1051- do i=1,2
1052-c Check if result can be reused since any of last two calls
1053- if (x.eq.xlast(i) .and. xmu.eq.xmulast(i) .and.
1054- $ imem.eq.imemlast(i) .and. ih.eq.ihlast(i)) then
1055- ireuse = i
1056+ ii=i_replace
1057+ do i=1,20
1058+c Check if result can be reused since any of last twenty
1059+c calls. Start checking with the last call and move back in time
1060+ if (ih.eq.ihlast(ii)) then
1061+ if (x.eq.xlast(ii)) then
1062+ if (xmu.eq.xmulast(ii)) then
1063+ if (imem.eq.imemlast(ii)) then
1064+ ireuse = ii
1065+ exit
1066+ endif
1067+ endif
1068+ endif
1069 endif
1070+ ii=ii-1
1071+ if (ii.eq.0) ii=ii+20
1072 enddo
1073
1074 c Reuse previous result, if possible
1075@@ -100,44 +112,18 @@
1076 endif
1077 endif
1078
1079-c Bjorken x and/or facrorization scale and/or PDF set are not
1080-c identical to the saved values: this means a new event and we
1081-c should reset everything to compute new PDF values. Also, determine
1082-c if we should fill ireuse=1 or ireuse=2.
1083- if (ireuse.eq.0.and.xlast(1).ne.-99d9.and.xlast(2).ne.-99d9)then
1084- do i=1,2
1085- xlast(i)=-99d9
1086- xmulast(i)=-99d9
1087- do j=-7,7
1088- pdflast(j,i)=-99d9
1089- enddo
1090- imemlast(i)=-99
1091- ihlast(i)=-99
1092- enddo
1093-c everything has been reset. Now set ireuse=1 to fill the first
1094-c arrays of saved values below
1095- ireuse=1
1096- else if(ireuse.eq.0.and.xlast(1).ne.-99d9)then
1097-c This is first call after everything has been reset, so the first
1098-c arrays are already filled with the saved values (hence
1099-c xlast(1).ne.-99d9). Fill the second arrays of saved values (done
1100-c below) by setting ireuse=2
1101- ireuse=2
1102- else if(ireuse.eq.0)then
1103-c Special: only used for the very first call to this function:
1104-c xlast(i) are initialized as data statements to be equal to -99d9
1105- ireuse=1
1106- endif
1107+c Calculated a new value: replace the value computed longest ago
1108+ i_replace=mod(i_replace,20)+1
1109
1110 c Call lhapdf and give the current values to the arrays that should
1111 c be saved
1112- call pftopdglha(ih,x,xmu,pdflast(-7,ireuse))
1113- xlast(ireuse)=x
1114- xmulast(ireuse)=xmu
1115- ihlast(ireuse)=ih
1116- imemlast(ireuse)=imem
1117+ call pftopdglha(ih,x,xmu,pdflast(-7,i_replace))
1118+ xlast(i_replace)=x
1119+ xmulast(i_replace)=xmu
1120+ ihlast(i_replace)=ih
1121+ imemlast(i_replace)=imem
1122 c
1123- pdg2pdf=pdflast(ipart,ireuse);
1124+ pdg2pdf=pdflast(ipart,i_replace)
1125 return
1126 end
1127
1128
1129=== modified file 'Template/NLO/Source/rw_routines.f'
1130--- Template/NLO/Source/rw_routines.f 2013-08-13 11:57:15 +0000
1131+++ Template/NLO/Source/rw_routines.f 2015-02-04 13:27:21 +0000
1132@@ -400,7 +400,7 @@
1133 c
1134 integer i,k
1135
1136- do i=1,20
1137+ do i=1,len(name)
1138 k=ichar(name(i:i))
1139 if(k.ge.65.and.k.le.90) then !upper case A-Z
1140 k=ichar(name(i:i))+32
1141
1142=== modified file 'Template/NLO/Source/setrun.f'
1143--- Template/NLO/Source/setrun.f 2014-10-30 11:17:06 +0000
1144+++ Template/NLO/Source/setrun.f 2015-02-04 13:27:21 +0000
1145@@ -56,7 +56,6 @@
1146 & xmaxup(maxpup),lprup(maxpup)
1147 c
1148 include 'nexternal.inc'
1149- include 'leshouche_decl.inc'
1150 logical gridrun,gridpack
1151 integer iseed
1152 common /to_seed/ iseed
1153@@ -65,6 +64,13 @@
1154 common /event_normalisation/event_norm
1155 integer iappl
1156 common /for_applgrid/ iappl
1157+C
1158+ integer maxflow
1159+ parameter (maxflow=999)
1160+ integer idup(nexternal,maxproc)
1161+ integer mothup(2,nexternal,maxproc)
1162+ integer icolup(2,nexternal,maxflow)
1163+ include 'born_leshouche.inc'
1164 c
1165 c----------
1166 c start
1167@@ -74,7 +80,6 @@
1168 c MZ add the possibility to have shower_MC input lowercase
1169 call to_upper(shower_MC)
1170 C
1171- call read_leshouche_info(idup_d,mothup_d,icolup_d)
1172
1173 c merging cuts
1174 xqcut=0d0
1175@@ -160,7 +165,7 @@
1176 elseif(lpp(i).eq.-3) then
1177 idbmup(i)=-11
1178 elseif(lpp(i).eq.0) then
1179- idbmup(i)=idup_d(1,i,1)
1180+ idbmup(i)=idup(i,1)
1181 else
1182 idbmup(i)=lpp(i)
1183 endif
1184@@ -219,8 +224,8 @@
1185 $ 10000,
1186 $ 10041,
1187 $ 10042,
1188- $ 200200,
1189- $ 200400,
1190+ $ 246800,
1191+ $ 247000,
1192 $ 244600/
1193
1194
1195
1196=== modified file 'Template/NLO/SubProcesses/add_write_info.f'
1197--- Template/NLO/SubProcesses/add_write_info.f 2014-10-30 11:17:06 +0000
1198+++ Template/NLO/SubProcesses/add_write_info.f 2015-02-04 13:27:21 +0000
1199@@ -31,8 +31,8 @@
1200 data firsttime2/.true./
1201
1202 c The process chosen to write
1203- integer i_process
1204- common/c_addwrite/i_process
1205+ integer i_process_addwrite
1206+ common/c_addwrite/i_process_addwrite
1207
1208 c Random numbers
1209 double precision ran2
1210@@ -205,7 +205,7 @@
1211 c This is an (n+1)-body process (see update_unwgt_table in
1212 c driver_mintMC.f). For S events it corresponds to the underlying Born
1213 c process chosen
1214- ip=i_process
1215+ ip=i_process_addwrite
1216 if (ip.lt.1 .or. ip.gt.maxproc_used) then
1217 write (*,*)'ERROR #12 in add_write_info,'/
1218 & /' not a well-defined process',ip,Hevents
1219
1220=== added file 'Template/NLO/SubProcesses/c_weight.inc'
1221--- Template/NLO/SubProcesses/c_weight.inc 1970-01-01 00:00:00 +0000
1222+++ Template/NLO/SubProcesses/c_weight.inc 2015-02-04 13:27:21 +0000
1223@@ -0,0 +1,12 @@
1224+* -*-fortran-*-
1225+
1226+ integer max_contr,max_wgt
1227+ parameter (max_contr=128,max_wgt=256)
1228+ integer nFKS(max_contr),itype(max_contr),QCDpower(max_contr)
1229+ & ,pdg(nexternal,max_contr),icontr,iwgt,plot_id(max_contr)
1230+ double precision momenta(0:3,nexternal,max_contr),wgt(3,max_contr)
1231+ & ,bjx(2,max_contr),scales2(3,max_contr),g_strong(max_contr)
1232+ & ,wgts(max_wgt,max_contr),y_bst(max_contr),plot_wgts(max_wgt
1233+ & ,max_contr)
1234+ common /c_weights/momenta,wgt,wgts,plot_wgts,bjx,scales2,g_strong
1235+ & ,y_bst,nFKS,itype,QCDpower,pdg,plot_id,icontr,iwgt
1236
1237=== modified file 'Template/NLO/SubProcesses/cuts.f'
1238--- Template/NLO/SubProcesses/cuts.f 2014-10-17 19:39:20 +0000
1239+++ Template/NLO/SubProcesses/cuts.f 2015-02-04 13:27:21 +0000
1240@@ -399,6 +399,7 @@
1241 include "nexternal.inc"
1242 include 'run.inc'
1243 include 'genps.inc'
1244+ include 'timing_variables.inc'
1245 REAL*8 P(0:3,nexternal),rwgt
1246 integer i,j,istatus(nexternal),iPDG(nexternal)
1247 c For boosts
1248@@ -421,6 +422,7 @@
1249 common /c_leshouche_inc/idup,mothup,icolup
1250 logical passcuts_user
1251 external passcuts_user
1252+ call cpu_time(tBefore)
1253 c Make sure have reasonable 4-momenta
1254 if (p(0,1) .le. 0d0) then
1255 passcuts=.false.
1256@@ -459,6 +461,8 @@
1257 enddo
1258 c Call the actual cuts function
1259 passcuts = passcuts_user(pp,istatus,ipdg)
1260+ call cpu_time(tAfter)
1261+ t_cuts=t_cuts+(tAfter-tBefore)
1262 RETURN
1263 END
1264
1265
1266=== modified file 'Template/NLO/SubProcesses/driver_mintFO.f'
1267--- Template/NLO/SubProcesses/driver_mintFO.f 2014-09-02 12:20:56 +0000
1268+++ Template/NLO/SubProcesses/driver_mintFO.f 2015-02-04 13:27:21 +0000
1269@@ -347,14 +347,23 @@
1270
1271 call cpu_time(tAfter)
1272 tTot = tAfter-tBefore
1273- tOther = tTot - tOLP - tPDF - tFastJet - tGenPS - tDSigI - tDSigR
1274- write(*,*) 'Time spent in clustering : ',tFastJet
1275- write(*,*) 'Time spent in PDF_Engine : ',tPDF
1276+ tOther = tTot - (tBorn+tGenPS+tReal+tCount+tIS+tFxFx+tf_nb+tf_all
1277+ & +t_as+tr_s+tr_pdf+t_plot+t_cuts)
1278+ write(*,*) 'Time spent in Born : ',tBorn
1279 write(*,*) 'Time spent in PS_Generation : ',tGenPS
1280- write(*,*) 'Time spent in Reals_evaluation: ',tDSigR
1281- write(*,*) 'Time spent in IS_evaluation : ',tDSigI
1282- write(*,*) 'Time spent in OneLoop_Engine : ',tOLP
1283- write(*,*) 'Time spent in other_tasks : ',tOther
1284+ write(*,*) 'Time spent in Reals_evaluation: ',tReal
1285+ write(*,*) 'Time spent in Counter_terms : ',tCount
1286+ write(*,*) 'Time spent in Integrated_CT : ',tIS-tOLP
1287+ write(*,*) 'Time spent in Virtuals : ',tOLP
1288+ write(*,*) 'Time spent in FxFx_cluster : ',tFxFx
1289+ write(*,*) 'Time spent in Nbody_prefactor : ',tf_nb
1290+ write(*,*) 'Time spent in N1body_prefactor : ',tf_all
1291+ write(*,*) 'Time spent in Adding_alphas_pdf : ',t_as
1292+ write(*,*) 'Time spent in Reweight_scale : ',tr_s
1293+ write(*,*) 'Time spent in Reweight_pdf : ',tr_pdf
1294+ write(*,*) 'Time spent in Filling_plots : ',t_plot
1295+ write(*,*) 'Time spent in Applying_cuts : ',t_cuts
1296+ write(*,*) 'Time spent in Other_tasks : ',tOther
1297 write(*,*) 'Time spent in Total : ',tTot
1298
1299 if(i_momcmp_count.ne.0)then
1300@@ -375,195 +384,255 @@
1301 data tDSigI/0.0/
1302 data tDSigR/0.0/
1303 data tGenPS/0.0/
1304+ data tBorn/0.0/
1305+ data tIS/0.0/
1306+ data tReal/0.0/
1307+ data tCount/0.0/
1308+ data tFxFx/0.0/
1309+ data tf_nb/0.0/
1310+ data tf_all/0.0/
1311+ data t_as/0.0/
1312+ data tr_s/0.0/
1313+ data tr_pdf/0.0/
1314+ data t_plot/0.0/
1315 end
1316
1317
1318- function sigint(xx,peso,ifl,f)
1319-c From dsample_fks
1320+ double precision function sigint(xx,vegas_wgt,ifl,f)
1321 implicit none
1322 include 'nexternal.inc'
1323 include 'mint.inc'
1324- real*8 sigint,peso,xx(ndimmax),f(nintegrals)
1325- integer ione
1326- parameter (ione=1)
1327- integer ifl
1328- integer ndim
1329- common/tosigint/ndim
1330- integer iconfig
1331- common/to_configs/iconfig
1332- integer i
1333- double precision wgt,dsig,ran2,rnd
1334- external ran2
1335- double precision x(99),p(0:3,nexternal)
1336 include 'nFKSconfigs.inc'
1337- include 'reweight_all.inc'
1338- integer nfksprocess_all
1339- INTEGER NFKSPROCESS
1340- COMMON/C_NFKSPROCESS/NFKSPROCESS
1341- character*4 abrv
1342- common /to_abrv/ abrv
1343- logical nbody
1344- common/cnbody/nbody
1345- integer fks_j_from_i(nexternal,0:nexternal)
1346- & ,particle_type(nexternal),pdg_type(nexternal)
1347- common /c_fks_inc/fks_j_from_i,particle_type,pdg_type
1348- integer i_fks,j_fks
1349- common/fks_indices/i_fks,j_fks
1350- logical sum,firsttime
1351+ include 'c_weight.inc'
1352+ include 'reweight.inc'
1353+ include 'run.inc'
1354+ double precision xx(ndimmax),vegas_wgt,f(nintegrals),jac,p(0:3
1355+ $ ,nexternal),rwgt,vol,sig,x(99),MC_int_wgt
1356+ integer ifl,nFKS_born,nFKS_picked,iFKS,nFKS_min
1357+ $ ,nFKS_max,izero,ione,itwo,mohdr
1358+ parameter (izero=0,ione=1,itwo=2,mohdr=-100)
1359+ logical passcuts,passcuts_nbody,passcuts_n1body,sum
1360+ external passcuts
1361 parameter (sum=.false.)
1362+ integer ndim,ipole
1363+ common/tosigint/ndim,ipole
1364+ logical nbody
1365+ common/cnbody/nbody
1366+ integer iconfig
1367+ common/to_configs/iconfig
1368+ double precision p1_cnt(0:3,nexternal,-2:2),wgt_cnt(-2:2)
1369+ $ ,pswgt_cnt(-2:2),jac_cnt(-2:2)
1370+ common/counterevnts/p1_cnt,wgt_cnt,pswgt_cnt,jac_cnt
1371+ double precision p_born(0:3,nexternal-1)
1372+ common /pborn/ p_born
1373+ double precision virt_wgt_mint,born_wgt_mint
1374+ common /virt_born_wgt_mint/virt_wgt_mint,born_wgt_mint
1375+ double precision virtual_over_born
1376+ common/c_vob/virtual_over_born
1377+ logical calculatedBorn
1378+ common/ccalculatedBorn/calculatedBorn
1379+ character*4 abrv
1380+ common /to_abrv/ abrv
1381+ integer iappl
1382+ common /for_applgrid/ iappl
1383+ if (ifl.ne.0) then
1384+ write (*,*) 'ERROR ifl not equal to zero in sigint',ifl
1385+ stop 1
1386+ endif
1387+ sigint=0d0
1388+ icontr=0
1389+ virt_wgt_mint=0d0
1390+ born_wgt_mint=0d0
1391+ virtual_over_born=0d0
1392+ if (ickkw.eq.3) call set_FxFx_scale(-1,p)
1393+ call update_vegas_x(xx,x)
1394+ call get_MC_integer(1,fks_configs,nFKS_picked,vol)
1395+
1396+c The nbody contributions
1397+ if (abrv.eq.'real') goto 11
1398+ nbody=.true.
1399+ calculatedBorn=.false.
1400+ call get_born_nFKSprocess(nFKS_picked,nFKS_born)
1401+ call update_fks_dir(nFKS_born,iconfig)
1402+ jac=1d0
1403+ call generate_momenta(ndim,iconfig,jac,x,p)
1404+ if (p_born(0,1).lt.0d0) goto 12
1405+ call compute_prefactors_nbody(vegas_wgt)
1406+ call set_cms_stuff(izero)
1407+ passcuts_nbody=passcuts(p1_cnt(0,1,0),rwgt)
1408+ if (passcuts_nbody) then
1409+ if (ickkw.eq.3) call set_FxFx_scale(izero,p1_cnt(0,1,0))
1410+ call set_alphaS(p1_cnt(0,1,0))
1411+ if (abrv(1:2).ne.'vi') then
1412+ call compute_born
1413+ endif
1414+ if (abrv.ne.'born') then
1415+ call compute_nbody_noborn
1416+ endif
1417+ endif
1418+
1419+ 11 continue
1420+c The n+1-body contributions (including counter terms)
1421+ if (abrv.eq.'born'.or.abrv(1:2).eq.'vi') goto 12
1422+ nbody=.false.
1423+ if (sum) then
1424+ nFKS_min=1
1425+ nFKS_max=fks_configs
1426+ MC_int_wgt=1d0
1427+ else
1428+ nFKS_min=nFKS_picked
1429+ nFKS_max=nFKS_picked
1430+ MC_int_wgt=1d0/vol
1431+ endif
1432+ do iFKS=nFKS_min,nFKS_max
1433+ jac=MC_int_wgt
1434+ call update_fks_dir(iFKS,iconfig)
1435+ call generate_momenta(ndim,iconfig,jac,x,p)
1436+ if (p_born(0,1).lt.0d0) cycle
1437+ call compute_prefactors_n1body(vegas_wgt,jac)
1438+ call set_cms_stuff(izero)
1439+ passcuts_nbody =passcuts(p1_cnt(0,1,0),rwgt)
1440+ call set_cms_stuff(mohdr)
1441+ passcuts_n1body=passcuts(p,rwgt)
1442+ if (passcuts_nbody .and. abrv.ne.'real') then
1443+ call set_cms_stuff(izero)
1444+ if (ickkw.eq.3) call set_FxFx_scale(izero,p1_cnt(0,1,0))
1445+ call set_alphaS(p1_cnt(0,1,0))
1446+ call compute_soft_counter_term
1447+ call set_cms_stuff(ione)
1448+ call compute_collinear_counter_term
1449+ call set_cms_stuff(itwo)
1450+ call compute_soft_collinear_counter_term
1451+ endif
1452+ if (passcuts_n1body) then
1453+ call set_cms_stuff(mohdr)
1454+ if (ickkw.eq.3) call set_FxFx_scale(mohdr,p)
1455+ call set_alphaS(p)
1456+ call compute_real_emission(p)
1457+ endif
1458+ enddo
1459+
1460+ 12 continue
1461+c Include PDFs and alpha_S and reweight to include the uncertainties
1462+ call include_PDF_and_alphas
1463+ if (doreweight) then
1464+ if (do_rwgt_scale) call reweight_scale
1465+ if (do_rwgt_pdf) call reweight_pdf
1466+ endif
1467+
1468+ if (iappl.ne.0) then
1469+ if (sum) then
1470+ write (*,*) 'ERROR: applgrid only possible '/
1471+ & /'with MC over FKS directories',iappl,sum
1472+ stop 1
1473+ endif
1474+ call fill_applgrid_weights(vegas_wgt)
1475+ endif
1476+
1477+c Importance sampling for FKS configurations
1478+ if (sum) then
1479+ call get_wgt_nbody(sig)
1480+ call fill_MC_integer(1,nFKS_picked,abs(sig))
1481+ else
1482+ call get_wgt_no_nbody(sig)
1483+ call fill_MC_integer(1,nFKS_picked,abs(sig)*vol)
1484+ endif
1485+
1486+c Finalize PS point
1487+ call fill_plots
1488+ call fill_mint_function(f)
1489+ return
1490+ end
1491+
1492+ subroutine update_fks_dir(nFKS,iconfig)
1493+ implicit none
1494+ integer nFKS,iconfig
1495+ integer nFKSprocess
1496+ common/c_nFKSprocess/nFKSprocess
1497+ nFKSprocess=nFKS
1498+ call fks_inc_chooser()
1499+ call leshouche_inc_chooser()
1500+ call setcuts
1501+ call setfksfactor(iconfig)
1502+ return
1503+ end
1504+
1505+ subroutine get_born_nFKSprocess(nFKS_in,nFKS_out)
1506+ implicit none
1507+ include 'nexternal.inc'
1508+ include 'nFKSconfigs.inc'
1509+ include 'fks_info.inc'
1510+ integer nFKS_in,nFKS_out,iFKS,nFKSprocessBorn(2)
1511+ logical firsttime,foundB(2)
1512 data firsttime /.true./
1513- logical foundB(2)
1514- integer nFKSprocessBorn(2)
1515 save nFKSprocessBorn,foundB
1516- double precision vol,sigintR
1517- integer itotalpoints
1518- common/ctotalpoints/itotalpoints
1519- double precision virtual_over_born
1520- common/c_vob/virtual_over_born
1521- double precision virt_wgt_current,born_wgt_ao2pi_current
1522- double precision virt_wgt,born_wgt_ao2pi
1523- common/c_fks_singular/virt_wgt,born_wgt_ao2pi
1524- logical fillh
1525- integer mc_hel,ihel
1526- double precision volh
1527- common/mc_int2/volh,mc_hel,ihel,fillh
1528-c
1529- if (ifl.ne.0) then
1530- write (*,*) 'ifl not equal to zero in sigint()',ifl
1531- stop
1532- endif
1533- virtual_over_born=0d0
1534-
1535- do i=1,99
1536- if (abrv.eq.'grid'.or.abrv.eq.'born'.or.abrv(1:2).eq.'vi')
1537- & then
1538- if(i.le.ndim-3)then
1539- x(i)=xx(i)
1540- elseif(i.le.ndim) then
1541- x(i)=ran2() ! Choose them flat when not including real-emision
1542- else
1543- x(i)=0.d0
1544- endif
1545- else
1546- if(i.le.ndim)then
1547- x(i)=xx(i)
1548- else
1549- x(i)=0.d0
1550- endif
1551- endif
1552- enddo
1553-
1554 if (firsttime) then
1555 firsttime=.false.
1556 foundB(1)=.false.
1557 foundB(2)=.false.
1558- do nFKSprocess=1,fks_configs
1559- call fks_inc_chooser()
1560- if (particle_type(i_fks).eq.8) then
1561- if (j_fks.le.nincoming) then
1562+ do iFKS=1,fks_configs
1563+ if (particle_type_D(iFKS,fks_i_D(iFKS)).eq.8) then
1564+ if (fks_j_D(iFKS).le.nincoming) then
1565 foundB(1)=.true.
1566- nFKSprocessBorn(1)=nFKSprocess
1567+ nFKSprocessBorn(1)=iFKS
1568 else
1569 foundB(2)=.true.
1570- nFKSprocessBorn(2)=nFKSprocess
1571+ nFKSprocessBorn(2)=iFKS
1572 endif
1573 endif
1574 enddo
1575 write (*,*) 'Total number of FKS directories is', fks_configs
1576 write (*,*) 'For the Born we use nFKSprocesses #',
1577- & nFKSprocessBorn
1578+ $ nFKSprocessBorn
1579 endif
1580-
1581- sigint=0d0
1582-c
1583-c Compute the Born-like contributions with nbody=.true.
1584-c THIS CAN BE OPTIMIZED
1585-c
1586- call get_MC_integer(1,fks_configs,nFKSprocess,vol)
1587- nFKSprocess_all=nFKSprocess
1588- call fks_inc_chooser()
1589- if (j_fks.le.nincoming) then
1590+ if (fks_j_D(nFKS_in).le.nincoming) then
1591 if (.not.foundB(1)) then
1592 write(*,*) 'Trying to generate Born momenta with '/
1593 & /'initial state j_fks, but there is no '/
1594 & /'configuration with i_fks a gluon and j_fks '/
1595 & /'initial state'
1596- stop
1597+ stop 1
1598 endif
1599- nFKSprocess=nFKSprocessBorn(1)
1600+ nFKS_out=nFKSprocessBorn(1)
1601 else
1602 if (.not.foundB(2)) then
1603 write(*,*) 'Trying to generate Born momenta with '/
1604 & /'final state j_fks, but there is no configuration'/
1605 & /' with i_fks a gluon and j_fks final state'
1606- stop
1607- endif
1608- nFKSprocess=nFKSprocessBorn(2)
1609- endif
1610- nbody=.true.
1611- fillh=.false. ! this is set to true in BinothLHA if doing MC over helicities
1612- nFKSprocess_used=nFKSprocess
1613- nFKSprocess_used_Born=nFKSprocess
1614- call fks_inc_chooser()
1615- call leshouche_inc_chooser()
1616- call setcuts
1617- call setfksfactor(iconfig)
1618- wgt=1d0
1619- call generate_momenta(ndim,iconfig,wgt,x,p)
1620- sigint = sigint+dsig(p,wgt,peso)*peso
1621- if (mc_hel.ne.0 .and. fillh) then
1622-c Fill the importance sampling array
1623- call fill_MC_integer(2,ihel,abs(sigint*volh))
1624- endif
1625-
1626- virt_wgt_current=virt_wgt
1627- born_wgt_ao2pi_current=born_wgt_ao2pi
1628-c
1629-c Compute the subtracted real-emission corrections either as an explicit
1630-c sum or a Monte Carlo sum.
1631-c
1632- if (abrv.ne.'born' .and. abrv.ne.'grid' .and.
1633- & abrv(1:2).ne.'vi') then
1634- nbody=.false.
1635- if (sum) then
1636-c THIS CAN BE OPTIMIZED
1637- do nFKSprocess=1,fks_configs
1638- nFKSprocess_used=nFKSprocess
1639- call fks_inc_chooser()
1640- call leshouche_inc_chooser()
1641- call setcuts
1642- call setfksfactor(iconfig)
1643- wgt=1d0
1644- call generate_momenta(ndim,iconfig,wgt,x,p)
1645- sigint = sigint+dsig(p,wgt,peso)*peso
1646- enddo
1647- else ! Monte Carlo over nFKSprocess
1648- nFKSprocess=nFKSprocess_all
1649- nFKSprocess_used=nFKSprocess
1650-c THIS CAN BE OPTIMIZED
1651- call fks_inc_chooser()
1652- call leshouche_inc_chooser()
1653- call setcuts
1654- call setfksfactor(iconfig)
1655-c The variable 'vol' is the size of the cell for the MC over
1656-c nFKSprocess. Need to divide by it here to correctly take into
1657-c account this Jacobian
1658- wgt=1d0/vol
1659- call generate_momenta(ndim,iconfig,wgt,x,p)
1660- sigintR = dsig(p,wgt,peso)*peso
1661- call fill_MC_integer(1,nFKSprocess,abs(sigintR)*vol)
1662- sigint = sigint+ sigintR
1663- endif
1664- endif
1665-
1666- f(1)=abs(sigint+virt_wgt_current)
1667- f(2)=sigint+virt_wgt_current
1668- f(3)=virt_wgt_current
1669- f(4)=virtual_over_born
1670- f(5)=abs(virt_wgt_current)
1671- f(6)=born_wgt_ao2pi_current
1672-
1673- if (sigint.ne.0d0)itotalpoints=itotalpoints+1
1674+ stop 1
1675+ endif
1676+ nFKS_out=nFKSprocessBorn(2)
1677+ endif
1678+ return
1679+ end
1680+
1681+ subroutine update_vegas_x(xx,x)
1682+ implicit none
1683+ include 'mint.inc'
1684+ integer i
1685+ double precision xx(ndimmax),x(99),ran2
1686+ external ran2
1687+ integer ndim,ipole
1688+ common/tosigint/ndim,ipole
1689+ character*4 abrv
1690+ common /to_abrv/ abrv
1691+ do i=1,99
1692+ if (abrv.eq.'born'.or.abrv(1:2).eq.'vi') then
1693+ if(i.le.ndim-3)then
1694+ x(i)=xx(i)
1695+ elseif(i.le.ndim) then
1696+ x(i)=ran2() ! Choose them flat when not including real-emision
1697+ else
1698+ x(i)=0.d0
1699+ endif
1700+ else
1701+ if(i.le.ndim)then
1702+ x(i)=xx(i)
1703+ else
1704+ x(i)=0.d0
1705+ endif
1706+ endif
1707+ enddo
1708 return
1709 end
1710
1711@@ -719,7 +788,7 @@
1712 abrv=abrvinput(1:4)
1713 c Options are way too many: make sure we understand all of them
1714 if ( abrv.ne.'all '.and.abrv.ne.'born'.and.abrv.ne.'real'.and.
1715- & abrv.ne.'virt'.and.abrv.ne.'novi'.and.abrv.ne.'grid'.and.
1716+ & abrv.ne.'virt'.and.
1717 & abrv.ne.'viSC'.and.abrv.ne.'viLC'.and.abrv.ne.'novA'.and.
1718 & abrv.ne.'novB'.and.abrv.ne.'viSA'.and.abrv.ne.'viSB') then
1719 write(*,*)'Error in input: abrv is:',abrv
1720
1721=== modified file 'Template/NLO/SubProcesses/driver_mintMC.f'
1722--- Template/NLO/SubProcesses/driver_mintMC.f 2014-08-05 13:04:11 +0000
1723+++ Template/NLO/SubProcesses/driver_mintMC.f 2015-02-04 13:27:21 +0000
1724@@ -1304,7 +1304,9 @@
1725 logical Hevents
1726 common/SHevents/Hevents
1727 integer i_process
1728- common/c_addwrite/i_process
1729+ common/c_i_process/i_process
1730+ integer i_process_addwrite
1731+ common/c_addwrite/i_process_addwrite
1732 logical unwgt
1733 double precision evtsgn_save,evtsgn_target
1734 double precision evtsgn
1735@@ -1327,6 +1329,7 @@
1736 logical only_virt
1737 integer imode
1738 common /c_imode/imode,only_virt
1739+
1740 c Trivial check on the Born contribution
1741 do i=1,iproc_save(nFKSprocess_used_born)
1742 if (unwgt_table(0,2,i).ne.0d0) then
1743@@ -1568,6 +1571,7 @@
1744 evtsgn=sign(1d0,unwgt_table(nFKSprocess,2
1745 $ ,i_process))
1746 evtsgn_save=evtsgn_save+evtsgn
1747+ i_process_addwrite=i_process
1748 if (doreweight) then
1749 nFKSprocess_reweight(1)=nFKSprocess
1750 endif
1751@@ -1593,9 +1597,9 @@
1752 endif
1753 evtsgn=sign(1d0,f_unwgt(nFKSprocess,i_process))
1754 evtsgn_save=evtsgn_save+evtsgn
1755-c Set the i_process to one of the (n+1)-body configurations that leads
1756+c Set the i_process_addwrite to one of the (n+1)-body configurations that leads
1757 c to this Born configuration. Needed for add_write_info to work properly
1758- i_process=etoi(i_process,nFKSprocess)
1759+ i_process_addwrite=etoi(i_process,nFKSprocess)
1760 if (doreweight) then
1761 c for the reweight info, do not write the ones that gave a zero
1762 c contribution
1763@@ -1715,9 +1719,9 @@
1764 evtsgn=sign(1d0,f_unwgt(nFKSprocess_used_born
1765 $ ,i_process))
1766 evtsgn_save=evtsgn_save + evtsgn
1767-c Set the i_process to one of the (n+1)-body configurations that leads
1768+c Set the i_process_addwrite to one of the (n+1)-body configurations that leads
1769 c to this Born configuration. Needed for add_write_info to work properly
1770- i_process=etoi(i_process,nFKSprocess_used_born)
1771+ i_process_addwrite=etoi(i_process,nFKSprocess_used_born)
1772 if (evtsgn.eq.evtsgn_target) return
1773 enddo
1774 c Pick the sign randomly according to all the signs accumulated.
1775
1776=== modified file 'Template/NLO/SubProcesses/fks_singular.f'
1777--- Template/NLO/SubProcesses/fks_singular.f 2014-10-17 19:39:20 +0000
1778+++ Template/NLO/SubProcesses/fks_singular.f 2015-02-04 13:27:21 +0000
1779@@ -1,3 +1,1230 @@
1780+ subroutine compute_born
1781+c This subroutine computes the Born matrix elements and adds its value
1782+c to the list of weights using the add_wgt subroutine
1783+ implicit none
1784+ include 'nexternal.inc'
1785+ include 'reweight0.inc'
1786+ include 'coupl.inc'
1787+ include 'timing_variables.inc'
1788+ double complex wgt_c(2)
1789+ double precision wgt1
1790+ double precision p_born(0:3,nexternal-1)
1791+ common /pborn/ p_born
1792+ double precision f_b,f_nb
1793+ common /factor_nbody/ f_b,f_nb
1794+ double precision xi_i_fks_ev,y_ij_fks_ev,p_i_fks_ev(0:3)
1795+ $ ,p_i_fks_cnt(0:3,-2:2)
1796+ common/fksvariables/xi_i_fks_ev,y_ij_fks_ev,p_i_fks_ev,p_i_fks_cnt
1797+ double precision xiScut_used,xiBSVcut_used
1798+ common /cxiScut_used/xiScut_used,xiBSVcut_used
1799+ call cpu_time(tBefore)
1800+ if (f_b.eq.0d0) return
1801+ if (xi_i_fks_ev .gt. xiBSVcut_used) return
1802+ call sborn(p_born,wgt_c)
1803+ wgt1=dble(wgt_c(1))*f_b/g**(nint(2*wgtbpower))
1804+ call add_wgt(2,wgt1,0d0,0d0)
1805+ call cpu_time(tAfter)
1806+ tBorn=tBorn+(tAfter-tBefore)
1807+ return
1808+ end
1809+
1810+ subroutine compute_nbody_noborn
1811+c This subroutine computes the soft-virtual matrix elements and adds its
1812+c value to the list of weights using the add_wgt subroutine
1813+ implicit none
1814+ include 'nexternal.inc'
1815+ include 'reweight.inc'
1816+ include 'coupl.inc'
1817+ include 'run.inc'
1818+ include 'timing_variables.inc'
1819+ double precision wgt1,wgt2,wgt3,bsv_wgt,virt_wgt,born_wgt,pi,g2,g22
1820+ parameter (pi=3.1415926535897932385d0)
1821+ double precision p1_cnt(0:3,nexternal,-2:2),wgt_cnt(-2:2)
1822+ $ ,pswgt_cnt(-2:2),jac_cnt(-2:2)
1823+ common/counterevnts/p1_cnt,wgt_cnt,pswgt_cnt,jac_cnt
1824+ double precision virt_wgt_mint,born_wgt_mint
1825+ common /virt_born_wgt_mint/virt_wgt_mint,born_wgt_mint
1826+ double precision f_b,f_nb
1827+ common /factor_nbody/ f_b,f_nb
1828+ double precision xi_i_fks_ev,y_ij_fks_ev,p_i_fks_ev(0:3)
1829+ $ ,p_i_fks_cnt(0:3,-2:2)
1830+ common/fksvariables/xi_i_fks_ev,y_ij_fks_ev,p_i_fks_ev,p_i_fks_cnt
1831+ double precision xiScut_used,xiBSVcut_used
1832+ common /cxiScut_used/xiScut_used,xiBSVcut_used
1833+ double precision fxfx_exp_rewgt
1834+ common /c_fxfx_exp_regt/ fxfx_exp_rewgt
1835+ call cpu_time(tBefore)
1836+ if (f_nb.eq.0d0) return
1837+ if (xi_i_fks_ev .gt. xiBSVcut_used) return
1838+ call bornsoftvirtual(p1_cnt(0,1,0),bsv_wgt,virt_wgt,born_wgt)
1839+ g2=g**(nint(2*wgtbpower))
1840+ g22=g**(nint(2*wgtbpower+2))
1841+ wgt1=wgtnstmp*f_nb/g22
1842+ if (ickkw.eq.3 .and. fxfx_exp_rewgt.ne.0d0) then
1843+ wgt1=wgt1 - fxfx_exp_rewgt*born_wgt*f_nb/g2/(4d0*pi)
1844+ endif
1845+ wgt2=wgtwnstmpmur*f_nb/g22
1846+ wgt3=wgtwnstmpmuf*f_nb/g22
1847+ call add_wgt(3,wgt1,wgt2,wgt3)
1848+c Special for the soft-virtual needed for the virt-tricks. The
1849+c *_wgt_mint variable should be directly passed to the mint-integrator
1850+c and not be part of the plots nor computation of the cross section.
1851+ virt_wgt_mint=virt_wgt*f_nb/g22
1852+ born_wgt_mint=born_wgt*f_b/g2
1853+ call cpu_time(tAfter)
1854+ tIS=tIS+(tAfter-tBefore)
1855+ return
1856+ end
1857+
1858+ subroutine compute_real_emission(p)
1859+c This subroutine computes the real-emission matrix elements and adds
1860+c its value to the list of weights using the add_wgt subroutine
1861+ implicit none
1862+ include 'nexternal.inc'
1863+ include 'coupl.inc'
1864+ include 'reweight0.inc'
1865+ include 'timing_variables.inc'
1866+ double precision x,dot,f_damp,ffact,s_ev,fks_Sij,p(0:3,nexternal)
1867+ $ ,wgt1,fx_ev
1868+ external dot,f_damp,fks_Sij
1869+ double precision ybst_til_tolab,ybst_til_tocm,sqrtshat,shat
1870+ common/parton_cms_stuff/ybst_til_tolab,ybst_til_tocm,sqrtshat,shat
1871+ integer i_fks,j_fks
1872+ common/fks_indices/i_fks,j_fks
1873+ double precision xi_i_fks_ev,y_ij_fks_ev,p_i_fks_ev(0:3)
1874+ $ ,p_i_fks_cnt(0:3,-2:2)
1875+ common/fksvariables/xi_i_fks_ev,y_ij_fks_ev,p_i_fks_ev,p_i_fks_cnt
1876+ double precision f_r,f_s,f_c,f_dc,f_sc,f_dsc(4)
1877+ common/factor_n1body/f_r,f_s,f_c,f_dc,f_sc,f_dsc
1878+ call cpu_time(tBefore)
1879+ if (f_r.eq.0d0) return
1880+ x = abs(2d0*dot(p(0,i_fks),p(0,j_fks))/shat)
1881+ ffact = f_damp(x)
1882+ if (ffact.le.0d0) return
1883+ s_ev = fks_Sij(p,i_fks,j_fks,xi_i_fks_ev,y_ij_fks_ev)
1884+ if (s_ev.le.0.d0) return
1885+ call sreal(p,xi_i_fks_ev,y_ij_fks_ev,fx_ev)
1886+ wgt1=fx_ev*s_ev*f_r/g**(nint(2*wgtbpower+2))
1887+ call add_wgt(1,wgt1,0d0,0d0)
1888+ call cpu_time(tAfter)
1889+ tReal=tReal+(tAfter-tBefore)
1890+ return
1891+ end
1892+
1893+ subroutine compute_soft_counter_term
1894+c This subroutine computes the soft counter term and adds its value to
1895+c the list of weights using the add_wgt subroutine
1896+ implicit none
1897+ include 'nexternal.inc'
1898+ include 'coupl.inc'
1899+ include 'reweight0.inc'
1900+ include 'timing_variables.inc'
1901+ double precision wgt1,s_s,fks_Sij,fx_s,zero
1902+ parameter (zero=0d0)
1903+ external fks_Sij
1904+ double precision p1_cnt(0:3,nexternal,-2:2),wgt_cnt(-2:2)
1905+ $ ,pswgt_cnt(-2:2),jac_cnt(-2:2)
1906+ common/counterevnts/ p1_cnt,wgt_cnt,pswgt_cnt,jac_cnt
1907+ double precision xiScut_used,xiBSVcut_used
1908+ common /cxiScut_used/xiScut_used,xiBSVcut_used
1909+ integer i_fks,j_fks
1910+ common/fks_indices/i_fks,j_fks
1911+ double precision xi_i_fks_ev,y_ij_fks_ev
1912+ double precision p_i_fks_ev(0:3),p_i_fks_cnt(0:3,-2:2)
1913+ common/fksvariables/xi_i_fks_ev,y_ij_fks_ev,p_i_fks_ev,p_i_fks_cnt
1914+ double precision f_r,f_s,f_c,f_dc,f_sc,f_dsc(4)
1915+ common/factor_n1body/f_r,f_s,f_c,f_dc,f_sc,f_dsc
1916+ call cpu_time(tBefore)
1917+ if (f_s.eq.0d0) return
1918+ if (xi_i_fks_ev .gt. xiScut_used) return
1919+ s_s = fks_Sij(p1_cnt(0,1,0),i_fks,j_fks,zero,y_ij_fks_ev)
1920+ if (s_s.le.0d0) return
1921+ call sreal(p1_cnt(0,1,0),0d0,y_ij_fks_ev,fx_s)
1922+ wgt1=-fx_s*s_s*f_s/g**(nint(2*wgtbpower+2))
1923+ call add_wgt(4,wgt1,0d0,0d0)
1924+ call cpu_time(tAfter)
1925+ tCount=tCount+(tAfter-tBefore)
1926+ return
1927+ end
1928+
1929+ subroutine compute_collinear_counter_term
1930+c This subroutine computes the collinear counter term and adds its value
1931+c to the list of weights using the add_wgt subroutine
1932+ implicit none
1933+ include 'nexternal.inc'
1934+ include 'coupl.inc'
1935+ include 'fks_powers.inc'
1936+ include 'reweight.inc'
1937+ include 'timing_variables.inc'
1938+ double precision zero,one,s_c,fks_Sij,fx_c,deg_xi_c,deg_lxi_c,wgt1
1939+ & ,wgt3,g22
1940+ external fks_Sij
1941+ parameter (zero=0d0,one=1d0)
1942+ double precision p1_cnt(0:3,nexternal,-2:2),wgt_cnt(-2:2)
1943+ $ ,pswgt_cnt(-2:2),jac_cnt(-2:2)
1944+ common/counterevnts/p1_cnt,wgt_cnt,pswgt_cnt,jac_cnt
1945+ integer i_fks,j_fks
1946+ common/fks_indices/i_fks,j_fks
1947+ double precision xi_i_fks_ev,y_ij_fks_ev,p_i_fks_ev(0:3)
1948+ $ ,p_i_fks_cnt(0:3,-2:2)
1949+ common/fksvariables/xi_i_fks_ev,y_ij_fks_ev,p_i_fks_ev,p_i_fks_cnt
1950+ double precision xi_i_fks_cnt(-2:2)
1951+ common /cxiifkscnt/xi_i_fks_cnt
1952+ double precision f_r,f_s,f_c,f_dc,f_sc,f_dsc(4)
1953+ common/factor_n1body/f_r,f_s,f_c,f_dc,f_sc,f_dsc
1954+ double precision pmass(nexternal)
1955+ call cpu_time(tBefore)
1956+ include 'pmass.inc'
1957+ if (f_c.eq.0d0 .and. f_dc.eq.0d0)return
1958+ if (y_ij_fks_ev.le.1d0-deltaS .or. pmass(j_fks).ne.0.d0) return
1959+ s_c = fks_Sij(p1_cnt(0,1,1),i_fks,j_fks,xi_i_fks_cnt(1),one)
1960+ if (s_c.le.0d0) return
1961+ g22=g**(nint(2*wgtbpower+2))
1962+ call sreal(p1_cnt(0,1,1),xi_i_fks_cnt(1),one,fx_c)
1963+ wgt1=-fx_c*s_c*f_c/g22
1964+ call sreal_deg(p1_cnt(0,1,1),xi_i_fks_cnt(1),one,deg_xi_c
1965+ $ ,deg_lxi_c)
1966+ wgt1=wgt1+ ( wgtdegrem_xi+wgtdegrem_lxi*log(xi_i_fks_cnt(1)) )*
1967+ $ f_dc/g22
1968+ wgt3=wgtdegrem_muF*f_dc/g22
1969+ call add_wgt(5,wgt1,0d0,wgt3)
1970+ call cpu_time(tAfter)
1971+ tCount=tCount+(tAfter-tBefore)
1972+ return
1973+ end
1974+
1975+ subroutine compute_soft_collinear_counter_term
1976+c This subroutine computes the soft-collinear counter term and adds its
1977+c value to the list of weights using the add_wgt subroutine
1978+ implicit none
1979+ include 'nexternal.inc'
1980+ include 'coupl.inc'
1981+ include 'reweight.inc'
1982+ include 'fks_powers.inc'
1983+ include 'timing_variables.inc'
1984+ double precision zero,one,s_sc,fks_Sij,fx_sc,wgt1,wgt3,deg_xi_sc
1985+ $ ,deg_lxi_sc,g22
1986+ external fks_Sij
1987+ parameter (zero=0d0,one=1d0)
1988+ double precision p1_cnt(0:3,nexternal,-2:2),wgt_cnt(-2:2)
1989+ $ ,pswgt_cnt(-2:2),jac_cnt(-2:2)
1990+ common/counterevnts/p1_cnt,wgt_cnt,pswgt_cnt,jac_cnt
1991+ double precision xi_i_fks_ev,y_ij_fks_ev,p_i_fks_ev(0:3)
1992+ $ ,p_i_fks_cnt(0:3,-2:2)
1993+ common/fksvariables/xi_i_fks_ev,y_ij_fks_ev,p_i_fks_ev,p_i_fks_cnt
1994+ integer i_fks,j_fks
1995+ common/fks_indices/i_fks,j_fks
1996+ double precision xiScut_used,xiBSVcut_used
1997+ common /cxiScut_used/xiScut_used,xiBSVcut_used
1998+ double precision xi_i_fks_cnt(-2:2)
1999+ common /cxiifkscnt/xi_i_fks_cnt
2000+ double precision f_r,f_s,f_c,f_dc,f_sc,f_dsc(4)
2001+ common/factor_n1body/f_r,f_s,f_c,f_dc,f_sc,f_dsc
2002+ double precision pmass(nexternal)
2003+ include 'pmass.inc'
2004+ call cpu_time(tBefore)
2005+ if (f_sc.eq.0d0 .and. f_dsc(1).eq.0d0 .and. f_dsc(2).eq.0d0 .and.
2006+ $ f_dsc(3).eq.0d0 .and. f_dsc(4).eq.0d0) return
2007+ if (xi_i_fks_cnt(1).ge.xiScut_used .or. y_ij_fks_ev.le.1d0-deltaS
2008+ $ .or. pmass(j_fks).ne.0.d0 ) return
2009+ s_sc = fks_Sij(p1_cnt(0,1,2),i_fks,j_fks,zero,one)
2010+ if (s_sc.le.0d0) return
2011+ g22=g**(nint(2*wgtbpower+2))
2012+ call sreal(p1_cnt(0,1,2),zero,one,fx_sc)
2013+ wgt1=fx_sc*s_sc*f_sc/g22
2014+ call sreal_deg(p1_cnt(0,1,2),zero,one, deg_xi_sc,deg_lxi_sc)
2015+ wgt1=wgt1+(-(wgtdegrem_xi+wgtdegrem_lxi*log(xi_i_fks_cnt(1)))
2016+ & *f_dsc(1)-(wgtdegrem_xi*f_dsc(2)+wgtdegrem_lxi*f_dsc(3)))/g22
2017+ wgt3=-wgtdegrem_muF*f_dsc(4)/g22
2018+ call add_wgt(6,wgt1,0d0,wgt3)
2019+ call cpu_time(tAfter)
2020+ tCount=tCount+(tAfter-tBefore)
2021+ return
2022+ end
2023+
2024+ logical function pdg_equal(pdg1,pdg2)
2025+c Returns .true. if the lists of PDG codes --'pdg1' and 'pdg2'-- are
2026+c equal.
2027+ implicit none
2028+ include 'nexternal.inc'
2029+ integer i,pdg1(nexternal),pdg2(nexternal)
2030+ pdg_equal=.true.
2031+ do i=1,nexternal
2032+ if (pdg1(i).ne.pdg2(i)) then
2033+ pdg_equal=.false.
2034+ return
2035+ endif
2036+ enddo
2037+ end
2038+
2039+ logical function momenta_equal(p1,p2)
2040+c Returns .true. only if the momenta p1 and p2 are equal. To save time,
2041+c it only checks the 0th and 3rd components (energy and z-direction).
2042+ implicit none
2043+ include 'nexternal.inc'
2044+ integer i,j
2045+ double precision p1(0:3,nexternal),p2(0:3,nexternal),vtiny
2046+ parameter (vtiny=1d-8)
2047+ momenta_equal=.true.
2048+ do i=1,nexternal
2049+ do j=0,3,3
2050+ if (p1(j,i).eq.0d0 .or. p2(j,i).eq.0d0) then
2051+ if (abs(p1(j,i)-p2(j,i)).gt.vtiny) then
2052+ momenta_equal=.false.
2053+ return
2054+ endif
2055+ else
2056+ if (abs((p1(j,i)-p2(j,i))/max(p1(j,i),p2(j,i))).gt.vtiny)
2057+ & then
2058+ momenta_equal=.false.
2059+ return
2060+ endif
2061+ endif
2062+ enddo
2063+ enddo
2064+ end
2065+
2066+ subroutine set_FxFx_scale(iterm,p)
2067+c Sets the FxFx cluster scale and multiplies the f_* factors (computed
2068+c by 'compute_prefactors_nbody' and 'compute_prefactors_n1body') by the
2069+c Sudakov suppression. If called more than once with the same momenta
2070+c and iterm, skip setting of the scales, and multiply the f_* factors by
2071+c the cached Sudakovs.
2072+c iterm= -1: reset the computation of the Sudakovs
2073+c iterm= 0: Sudakov for n-body kinematics
2074+c iterm=100: Sudakov for n+1-body kinematics
2075+ implicit none
2076+ include 'nexternal.inc'
2077+ include 'run.inc'
2078+ include 'timing_variables.inc'
2079+ integer iterm,iterm_last,i,j
2080+ double precision p(0:3,nexternal),p_last(0:3,nexternal),rewgt
2081+ & ,rewgt_izero,rewgt_mohdr,rewgt_exp_izero,rewgt_exp_mohdr
2082+ logical setclscales,rewgt_izero_calculated,rewgt_mohdr_calculated
2083+ & ,momenta_equal,already_set
2084+ external setclscales,rewgt,momenta_equal
2085+ double precision p1_cnt(0:3,nexternal,-2:2),wgt_cnt(-2:2)
2086+ $ ,pswgt_cnt(-2:2),jac_cnt(-2:2)
2087+ common/counterevnts/p1_cnt,wgt_cnt,pswgt_cnt,jac_cnt
2088+ double precision f_r,f_s,f_c,f_dc,f_sc,f_dsc(4)
2089+ common/factor_n1body/f_r,f_s,f_c,f_dc,f_sc,f_dsc
2090+ double precision f_b,f_nb
2091+ common /factor_nbody/ f_b,f_nb
2092+ double precision fxfx_exp_rewgt
2093+ common /c_fxfx_exp_regt/ fxfx_exp_rewgt
2094+ call cpu_time(tBefore)
2095+ ktscheme=1
2096+ if (iterm.eq.-1) then
2097+ rewgt_mohdr_calculated=.false.
2098+ rewgt_izero_calculated=.false.
2099+ fxfx_exp_rewgt=0d0
2100+ return
2101+ endif
2102+ already_set=.false.
2103+ if (iterm.eq.0) then
2104+ if (rewgt_izero_calculated) then
2105+ if (iterm.eq.iterm_last) then
2106+ if (momenta_equal(p1_cnt(0,1,0),p_last)) then
2107+ already_set=.true.
2108+ endif
2109+ endif
2110+ endif
2111+ if (.not.already_set) then
2112+ if (.not. setclscales(p1_cnt(0,1,0))) then
2113+ write (*,*) 'ERROR in setclscales izero'
2114+ stop 1
2115+ endif
2116+ rewgt_izero=rewgt(p1_cnt(0,1,0),rewgt_exp_izero)
2117+ fxfx_exp_rewgt=rewgt_exp_izero
2118+ endif
2119+ rewgt_izero_calculated=.true.
2120+ iterm_last=iterm
2121+ do i=1,nexternal
2122+ do j=0,3
2123+ p_last(j,i)=p1_cnt(j,i,0)
2124+ enddo
2125+ enddo
2126+ f_b =f_b *rewgt_izero
2127+ f_nb=f_nb*rewgt_izero
2128+ f_s =f_s *rewgt_izero
2129+ f_c =f_c *rewgt_izero
2130+ f_dc=f_dc*rewgt_izero
2131+ f_sc=f_sc*rewgt_izero
2132+ do i=1,4
2133+ f_dsc(i)=f_dsc(i)*rewgt_izero
2134+ enddo
2135+ call cpu_time(tAfter)
2136+ tFxFx=tFxFx+(tAfter-tBefore)
2137+ return
2138+ endif
2139+ if (iterm.eq.-100) then
2140+ if (rewgt_mohdr_calculated) then
2141+ if (iterm.eq.iterm_last) then
2142+ if (momenta_equal(p,p_last)) then
2143+ already_set=.true.
2144+ endif
2145+ endif
2146+ endif
2147+ if (.not. already_set) then
2148+ if (.not. setclscales(p)) then
2149+ write (*,*) 'ERROR in setclscales mohdr'
2150+ stop 1
2151+ endif
2152+ rewgt_mohdr=rewgt(p,rewgt_exp_mohdr)
2153+ endif
2154+ rewgt_mohdr_calculated=.true.
2155+ iterm_last=iterm
2156+ do i=1,nexternal
2157+ do j=0,3
2158+ p_last(j,i)=p(j,i)
2159+ enddo
2160+ enddo
2161+ f_r=f_r*rewgt_mohdr
2162+ call cpu_time(tAfter)
2163+ tFxFx=tFxFx+(tAfter-tBefore)
2164+ return
2165+ endif
2166+ end
2167+
2168+
2169+ subroutine compute_prefactors_nbody(vegas_wgt)
2170+c Compute all the relevant prefactors for the Born and the soft-virtual,
2171+c i.e. all the nbody contributions. Also initialises the plots and
2172+c bpower.
2173+ implicit none
2174+ include 'nexternal.inc'
2175+ include 'run.inc'
2176+ include 'genps.inc'
2177+ include 'reweight0.inc'
2178+ include 'timing_variables.inc'
2179+ double precision pi,unwgtfun,vegas_wgt,enhance,xnoborn_cnt,xtot
2180+ $ ,bpower,cpower,tiny
2181+ data xnoborn_cnt /0d0/
2182+ integer inoborn_cnt,i
2183+ data inoborn_cnt /0/
2184+ double complex wgt_c(2)
2185+ logical firsttime
2186+ data firsttime /.true./
2187+ parameter (pi=3.1415926535897932385d0)
2188+ parameter (tiny=1d-6)
2189+ double precision p_born(0:3,nexternal-1)
2190+ common/pborn/ p_born
2191+ double precision p1_cnt(0:3,nexternal,-2:2),wgt_cnt(-2:2)
2192+ $ ,pswgt_cnt(-2:2),jac_cnt(-2:2)
2193+ common/counterevnts/p1_cnt,wgt_cnt,pswgt_cnt,jac_cnt
2194+ double precision xinorm_ev
2195+ common /cxinormev/xinorm_ev
2196+ double precision xiimax_ev
2197+ common /cxiimaxev/xiimax_ev
2198+ double precision xiScut_used,xiBSVcut_used
2199+ common /cxiScut_used/xiScut_used,xiBSVcut_used
2200+ double precision ybst_til_tolab,ybst_til_tocm,sqrtshat,shat
2201+ common/parton_cms_stuff/ybst_til_tolab,ybst_til_tocm,sqrtshat,shat
2202+ double precision fkssymmetryfactor,fkssymmetryfactorBorn,
2203+ $ fkssymmetryfactorDeg
2204+ integer ngluons,nquarks(-6:6)
2205+ common/numberofparticles/fkssymmetryfactor,fkssymmetryfactorBorn,
2206+ & fkssymmetryfactorDeg,ngluons,nquarks
2207+ integer mapconfig(0:lmaxconfigs), iconfig
2208+ common/to_mconfigs/mapconfig, iconfig
2209+ Double Precision amp2(maxamps), jamp2(0:maxamps)
2210+ common/to_amps/ amp2, jamp2
2211+ double precision diagramsymmetryfactor
2212+ common /dsymfactor/diagramsymmetryfactor
2213+ double precision f_b,f_nb
2214+ common /factor_nbody/ f_b,f_nb
2215+ integer iappl
2216+ common /for_applgrid/ iappl
2217+ logical needrndec
2218+ parameter (needrndec=.true.)
2219+ real*8 ran2
2220+ external ran2
2221+ real*8 rndec(10)
2222+ common/crndec/rndec
2223+ include "appl_common.inc"
2224+ call cpu_time(tBefore)
2225+c Random numbers to be used in the plotting routine
2226+ if(needrndec)then
2227+ do i=1,10
2228+ rndec(i)=ran2()
2229+ enddo
2230+ endif
2231+ if (firsttime) then
2232+c Put here call to compute bpower
2233+ call compute_bpower(p_born,bpower)
2234+ wgtbpower=bpower
2235+c Store the power of alphas of the Born events in the appl common block.
2236+ if(iappl.ne.0) appl_bpower = wgtbpower
2237+c Initialize hiostograms
2238+ call initplot
2239+c Compute cpower done for bottom Yukawa, routine needs to be adopted
2240+c for other muR-dependendent factors
2241+ call compute_cpower(p_born,cpower)
2242+ if(dabs(cpower+1d0).lt.tiny) then
2243+ wgtcpower=0d0
2244+ else
2245+ wgtcpower=cpower
2246+ endif
2247+c Check that things are done consistently
2248+ if(wgtcpower.ne.cpowerinput.and.dabs(cpower+1d0).gt.tiny)then
2249+ write(*,*)'Inconsistency in the computation of cpower',
2250+ # wgtcpower,cpowerinput
2251+ write(*,*)'Check value in reweight0.inc'
2252+ stop
2253+ endif
2254+ firsttime=.false.
2255+ endif
2256+c Compute the multi-channel enhancement factor 'enhance'.
2257+ enhance=1.d0
2258+ if (p_born(0,1).gt.0d0) then
2259+ call sborn(p_born,wgt_c)
2260+ elseif(p_born(0,1).lt.0d0)then
2261+ enhance=0d0
2262+ endif
2263+ if (enhance.eq.0d0)then
2264+ xnoborn_cnt=xnoborn_cnt+1.d0
2265+ if(log10(xnoborn_cnt).gt.inoborn_cnt)then
2266+ write (*,*) 'WARNING: no Born momenta more than 10**',
2267+ $ inoborn_cnt,'times'
2268+ inoborn_cnt=inoborn_cnt+1
2269+ endif
2270+ else
2271+ xtot=0d0
2272+ if (mapconfig(0).eq.0) then
2273+ write (*,*) 'Fatal error in compute_prefactor_nbody:'/
2274+ & /' no Born diagrams ',mapconfig,
2275+ & '. Check bornfromreal.inc'
2276+ write (*,*) 'Is fks_singular compiled correctly?'
2277+ stop 1
2278+ endif
2279+ do i=1, mapconfig(0)
2280+ xtot=xtot+amp2(mapconfig(i))
2281+ enddo
2282+ if (xtot.ne.0d0) then
2283+ enhance=amp2(mapconfig(iconfig))/xtot
2284+ enhance=enhance*diagramsymmetryfactor
2285+ else
2286+ enhance=0d0
2287+ endif
2288+ endif
2289+ call unweight_function(p_born,unwgtfun)
2290+ call set_cms_stuff(0)
2291+c f_* multiplication factors for Born and nbody
2292+ f_b=jac_cnt(0)*xinorm_ev/(min(xiimax_ev,xiBSVcut_used)*shat/(16
2293+ $ *pi**2))*enhance*unwgtfun *fkssymmetryfactorBorn*vegas_wgt
2294+ f_nb=f_b
2295+ call cpu_time(tAfter)
2296+ tf_nb=tf_nb+(tAfter-tBefore)
2297+ return
2298+ end
2299+
2300+ subroutine compute_prefactors_n1body(vegas_wgt,jac_ev)
2301+c Compute all relevant prefactors for the real emission and counter
2302+c terms.
2303+ implicit none
2304+ include 'nexternal.inc'
2305+ include 'run.inc'
2306+ include 'genps.inc'
2307+ include 'fks_powers.inc'
2308+ include 'coupl.inc'
2309+ include 'timing_variables.inc'
2310+ double precision unwgtfun,vegas_wgt,enhance,xnoborn_cnt,xtot
2311+ & ,prefact,prefact_cnt_ssc,prefact_deg,prefact_c,prefact_coll
2312+ & ,jac_ev,pi,prefact_cnt_ssc_c,prefact_coll_c,prefact_deg_slxi
2313+ & ,prefact_deg_sxi,zero
2314+ parameter (pi=3.1415926535897932385d0, zero=0d0)
2315+ data xnoborn_cnt /0d0/
2316+ integer inoborn_cnt,i
2317+ data inoborn_cnt /0/
2318+ double complex wgt_c(2)
2319+ double precision p_born(0:3,nexternal-1)
2320+ common/pborn/ p_born
2321+ double precision p1_cnt(0:3,nexternal,-2:2),wgt_cnt(-2:2)
2322+ $ ,pswgt_cnt(-2:2),jac_cnt(-2:2)
2323+ common/counterevnts/p1_cnt,wgt_cnt,pswgt_cnt,jac_cnt
2324+ double precision xi_i_fks_ev,y_ij_fks_ev
2325+ double precision p_i_fks_ev(0:3),p_i_fks_cnt(0:3,-2:2)
2326+ common/fksvariables/xi_i_fks_ev,y_ij_fks_ev,p_i_fks_ev,p_i_fks_cnt
2327+ integer i_fks,j_fks
2328+ common/fks_indices/i_fks,j_fks
2329+ double precision xi_i_fks_cnt(-2:2)
2330+ common /cxiifkscnt/xi_i_fks_cnt
2331+ double precision xinorm_ev
2332+ common /cxinormev/xinorm_ev
2333+ double precision xiimax_ev
2334+ common /cxiimaxev/xiimax_ev
2335+ double precision xiimax_cnt(-2:2)
2336+ common /cxiimaxcnt/xiimax_cnt
2337+ double precision xinorm_cnt(-2:2)
2338+ common /cxinormcnt/xinorm_cnt
2339+ double precision delta_used
2340+ common /cdelta_used/delta_used
2341+ double precision xicut_used
2342+ common /cxicut_used/xicut_used
2343+ double precision xiScut_used,xiBSVcut_used
2344+ common /cxiScut_used/xiScut_used,xiBSVcut_used
2345+ double precision ybst_til_tolab,ybst_til_tocm,sqrtshat,shat
2346+ common/parton_cms_stuff/ybst_til_tolab,ybst_til_tocm,sqrtshat,shat
2347+ double precision fkssymmetryfactor,fkssymmetryfactorBorn,
2348+ & fkssymmetryfactorDeg
2349+ integer ngluons,nquarks(-6:6)
2350+ common/numberofparticles/fkssymmetryfactor,fkssymmetryfactorBorn,
2351+ & fkssymmetryfactorDeg,ngluons,nquarks
2352+ integer mapconfig(0:lmaxconfigs), iconfig
2353+ common/to_mconfigs/mapconfig, iconfig
2354+ Double Precision amp2(maxamps), jamp2(0:maxamps)
2355+ common/to_amps/ amp2, jamp2
2356+ double precision diagramsymmetryfactor
2357+ common /dsymfactor/diagramsymmetryfactor
2358+ logical nocntevents
2359+ common/cnocntevents/nocntevents
2360+ double precision f_r,f_s,f_c,f_dc,f_sc,f_dsc(4)
2361+ common/factor_n1body/f_r,f_s,f_c,f_dc,f_sc,f_dsc
2362+ double precision pmass(nexternal)
2363+ include 'pmass.inc'
2364+ call cpu_time(tBefore)
2365+ enhance=1.d0
2366+ if (p_born(0,1).gt.0d0) then
2367+ call sborn(p_born,wgt_c)
2368+ elseif(p_born(0,1).lt.0d0)then
2369+ enhance=0d0
2370+ endif
2371+c Compute the multi-channel enhancement factor 'enhance'.
2372+ if (enhance.eq.0d0)then
2373+ xnoborn_cnt=xnoborn_cnt+1.d0
2374+ if(log10(xnoborn_cnt).gt.inoborn_cnt)then
2375+ write (*,*) 'WARNING: no Born momenta more than 10**',
2376+ $ inoborn_cnt,'times'
2377+ inoborn_cnt=inoborn_cnt+1
2378+ endif
2379+ else
2380+ xtot=0d0
2381+ if (mapconfig(0).eq.0) then
2382+ write (*,*) 'Fatal error in compute_prefactor_n1body,'/
2383+ & /' no Born diagrams ',mapconfig
2384+ & ,'. Check bornfromreal.inc'
2385+ write (*,*) 'Is fks_singular compiled correctly?'
2386+ stop 1
2387+ endif
2388+ do i=1, mapconfig(0)
2389+ xtot=xtot+amp2(mapconfig(i))
2390+ enddo
2391+ if (xtot.ne.0d0) then
2392+ enhance=amp2(mapconfig(iconfig))/xtot
2393+ enhance=enhance*diagramsymmetryfactor
2394+ else
2395+ enhance=0d0
2396+ endif
2397+ endif
2398+ call unweight_function(p_born,unwgtfun)
2399+ prefact=xinorm_ev/xi_i_fks_ev/(1-y_ij_fks_ev)
2400+
2401+c f_* multiplication factors for real-emission, soft counter, ... etc.
2402+ f_r=prefact*jac_ev*enhance*unwgtfun*fkssymmetryfactor*vegas_wgt
2403+ if (.not.nocntevents) then
2404+ prefact_cnt_ssc=xinorm_ev/min(xiimax_ev,xiScut_used)*
2405+ & log(xicut_used/min(xiimax_ev,xiScut_used))/(1
2406+ & -y_ij_fks_ev)
2407+ f_s=(prefact+prefact_cnt_ssc)*jac_cnt(0)*enhance
2408+ $ *unwgtfun*fkssymmetryfactor*vegas_wgt
2409+
2410+ if (pmass(j_fks).eq.0d0) then
2411+ prefact_c=xinorm_cnt(1)/xi_i_fks_cnt(1)/(1-y_ij_fks_ev)
2412+ prefact_coll=xinorm_cnt(1)/xi_i_fks_cnt(1)*log(delta_used
2413+ $ /deltaS)/deltaS
2414+ f_c=(prefact_c+prefact_coll)*jac_cnt(1)
2415+ $ *enhance*unwgtfun*fkssymmetryfactor*vegas_wgt
2416+
2417+ call set_cms_stuff(1)
2418+ prefact_deg=xinorm_cnt(1)/xi_i_fks_cnt(1)/deltaS
2419+ prefact_cnt_ssc_c=xinorm_cnt(1)/min(xiimax_cnt(1)
2420+ & ,xiScut_used)*log(xicut_used/min(xiimax_cnt(1)
2421+ & ,xiScut_used))*1/(1-y_ij_fks_ev)
2422+ prefact_coll_c=xinorm_cnt(1)/min(xiimax_cnt(1),xiScut_used)
2423+ $ *log(xicut_used/min(xiimax_cnt(1),xiScut_used))
2424+ $ *log(delta_used/deltaS)/deltaS
2425+ f_dc=jac_cnt(1)*prefact_deg/(shat/(32*pi**2))*enhance
2426+ $ *unwgtfun*fkssymmetryfactorDeg*vegas_wgt
2427+ f_sc=(prefact_c+prefact_coll+prefact_cnt_ssc_c
2428+ & +prefact_coll_c)*jac_cnt(2)*enhance*unwgtfun
2429+ & *fkssymmetryfactorDeg*vegas_wgt
2430+
2431+ call set_cms_stuff(2)
2432+ prefact_deg_sxi=xinorm_cnt(1)/min(xiimax_cnt(1),xiScut_used)
2433+ & *log(xicut_used/min(xiimax_cnt(1),xiScut_used))*1
2434+ & /deltaS
2435+ prefact_deg_slxi=xinorm_cnt(1)/min(xiimax_cnt(1)
2436+ & ,xiScut_used)*( log(xicut_used)**2
2437+ & -log(min(xiimax_cnt(1),xiScut_used))**2 )*1/(2.d0
2438+ & *deltaS)
2439+ f_dsc(1)=prefact_deg*jac_cnt(2)/(shat/(32*pi**2))*enhance
2440+ & *unwgtfun*fkssymmetryfactorDeg*vegas_wgt
2441+ f_dsc(2)=prefact_deg_sxi*jac_cnt(2)/(shat/(32*pi**2))
2442+ & *enhance*unwgtfun*fkssymmetryfactorDeg*vegas_wgt
2443+ f_dsc(3)=prefact_deg_slxi*jac_cnt(2)/(shat/(32*pi**2))
2444+ & *enhance*unwgtfun*fkssymmetryfactorDeg*vegas_wgt
2445+ f_dsc(4)=( prefact_deg+prefact_deg_sxi )*jac_cnt(2)/(shat
2446+ & /(32*pi**2))*enhance*unwgtfun*fkssymmetryfactorDeg
2447+ & *vegas_wgt
2448+ else
2449+ f_c=0d0
2450+ f_dc=0d0
2451+ f_sc=0d0
2452+ do i=1,4
2453+ f_dsc(i)=0d0
2454+ enddo
2455+ endif
2456+ else
2457+ f_s=0d0
2458+ f_c=0d0
2459+ f_dc=0d0
2460+ f_sc=0d0
2461+ do i=1,4
2462+ f_dsc(i)=0d0
2463+ enddo
2464+ endif
2465+ call cpu_time(tAfter)
2466+ tf_all=tf_all+(tAfter-tBefore)
2467+ return
2468+ end
2469+
2470+
2471+ subroutine add_wgt(type,wgt1,wgt2,wgt3)
2472+c Adds a contribution to the list in c_weight.inc. 'type' sets the type
2473+c of the contribution and wgt1..wgt3 are the coefficients multiplying
2474+c the logs. The arguments are:
2475+c type=1 : real-emission
2476+c type=2 : Born
2477+c type=3 : soft-virtual
2478+c type=4 : soft counter-term
2479+c type=5 : collinear counter-term
2480+c type=6 : soft-collinear counter-term
2481+c wgt1 : weight of the contribution not multiplying a scale log
2482+c wgt2 : coefficient of the weight multiplying the log[mu_R^2/Q^2]
2483+c wgt3 : coefficient of the weight multiplying the log[mu_F^2/Q^2]
2484+c
2485+c This subroutine increments the 'icontr' counter: each new call to this
2486+c function makes sure that it's considered a new contribution. For each
2487+c contribution, we save the
2488+c The type: itype(icontr)
2489+c The weights: wgt(1,icontr),wgt(2,icontr) and wgt(3,icontr) for
2490+c wgt1, wgt2 and wgt3, respectively.
2491+c The Bjorken x's: bjx(1,icontr), bjx(2,icontr)
2492+c The Ellis-Sexton scale squared used to compute the weight:
2493+c scales2(1,icontr)
2494+c The renormalisation scale squared used to compute the weight:
2495+c scales2(2,icontr)
2496+c The factorisation scale squared used to compute the weight:
2497+c scales2(3,icontr)
2498+c The value of the strong coupling: g_strong(icontr)
2499+c The FKS configuration: nFKS(icontr)
2500+c The boost to go from the momenta in the C.o.M. frame to the
2501+c laboratory frame: y_bst(icontr)
2502+c The power of the strong coupling (g_strong) for the current
2503+c weight: QCDpower(icontr)
2504+c The momenta: momenta(j,i,icontr). For the Born contribution, the
2505+c counter-term momenta are used. This is okay for any IR-safe
2506+c observables.
2507+c The PDG codes: pdg(i,icontr). Always the ones with length
2508+c 'nexternal' are used, because the momenta are also the
2509+c 'nexternal' ones. This is okay for IR-safe observables.
2510+c
2511+c Not set in this subroutine, but included in the c_weights common block
2512+c are the
2513+c wgts(iwgt,icontr) : weights including scale/PDFs/logs. These are
2514+c normalised so that they can be used directly to compute cross
2515+c sections and fill plots. 'iwgt' goes from 1 to the maximum
2516+c number of weights obtained from scale and PDF reweighting, with
2517+c the iwgt=1 element being the central value.
2518+c plot_id(icontr) : =20 for Born, 11 for real-emission and 12 for
2519+c anything else.
2520+c plot_wgts(iwgt,icontr) : same as wgts(), but only non-zero for
2521+c unique contributions and non-unique are added to the unique
2522+c ones. 'Unique' here is defined that they would be identical in
2523+c an analysis routine (i.e. same momenta and PDG codes)
2524+ implicit none
2525+ include 'nexternal.inc'
2526+ include 'run.inc'
2527+ include 'genps.inc'
2528+ include 'coupl.inc'
2529+ include 'fks_info.inc'
2530+ include 'c_weight.inc'
2531+ include 'q_es.inc'
2532+ include 'reweight0.inc'
2533+ integer type,i,j
2534+ double precision wgt1,wgt2,wgt3
2535+ integer nFKSprocess
2536+ common/c_nFKSprocess/nFKSprocess
2537+ double precision p_born(0:3,nexternal-1)
2538+ common/pborn/ p_born
2539+ double precision p_ev(0:3,nexternal)
2540+ common/pev/ p_ev
2541+ integer maxflow
2542+ parameter (maxflow=999)
2543+ integer idup(nexternal,maxproc),mothup(2,nexternal,maxproc),
2544+ $ icolup(2,nexternal,maxflow)
2545+ common /c_leshouche_inc/idup,mothup,icolup
2546+ double precision ybst_til_tolab,ybst_til_tocm,sqrtshat,shat
2547+ common/parton_cms_stuff/ybst_til_tolab,ybst_til_tocm,sqrtshat,shat
2548+ double precision p1_cnt(0:3,nexternal,-2:2),wgt_cnt(-2:2)
2549+ $ ,pswgt_cnt(-2:2),jac_cnt(-2:2)
2550+ common/counterevnts/p1_cnt,wgt_cnt,pswgt_cnt,jac_cnt
2551+ if (wgt1.eq.0d0 .and. wgt2.eq.0d0 .and. wgt3.eq.0d0) return
2552+ icontr=icontr+1
2553+ if (icontr.gt.max_contr) then
2554+ write (*,*) 'ERROR in add_wgt: too many contributions'
2555+ & ,max_contr
2556+ stop 1
2557+ endif
2558+ itype(icontr)=type
2559+ wgt(1,icontr)=wgt1
2560+ wgt(2,icontr)=wgt2
2561+ wgt(3,icontr)=wgt3
2562+ bjx(1,icontr)=xbk(1)
2563+ bjx(2,icontr)=xbk(2)
2564+ scales2(1,icontr)=QES2
2565+ scales2(2,icontr)=scale**2
2566+ scales2(3,icontr)=q2fact(1)
2567+ g_strong(icontr)=g
2568+ nFKS(icontr)=nFKSprocess
2569+ y_bst(icontr)=ybst_til_tolab
2570+ if(type.eq.1) then
2571+c real emission
2572+ QCDpower(icontr)=nint(2*wgtbpower+2)
2573+ do i=1,nexternal
2574+ do j=0,3
2575+ momenta(j,i,icontr)=p_ev(j,i)
2576+ enddo
2577+ pdg(i,icontr)=idup(i,1)
2578+ enddo
2579+ elseif(type.ge.2 .and. type.le.6) then
2580+c Born, counter term, or soft-virtual
2581+ if (type.eq.2) then
2582+ QCDpower(icontr)=nint(2*wgtbpower)
2583+ else
2584+ QCDpower(icontr)=nint(2*wgtbpower+2)
2585+ endif
2586+ do i=1,nexternal
2587+ do j=0,3
2588+ if (p1_cnt(0,1,0).gt.0d0) then
2589+ momenta(j,i,icontr)=p1_cnt(j,i,0)
2590+ elseif (p1_cnt(0,1,1).gt.0d0) then
2591+ momenta(j,i,icontr)=p1_cnt(j,i,1)
2592+ elseif (p1_cnt(0,1,2).gt.0d0) then
2593+ momenta(j,i,icontr)=p1_cnt(j,i,2)
2594+ else
2595+ write (*,*) 'ERROR in add_wgt: no valid momenta'
2596+ stop 1
2597+ endif
2598+ enddo
2599+ pdg(i,icontr)=idup(i,1)
2600+ enddo
2601+ else
2602+ write (*,*) 'ERROR: unknown type in add_wgt',type
2603+ stop 1
2604+ endif
2605+ return
2606+ end
2607+
2608+ subroutine include_PDF_and_alphas
2609+c Multiply the saved wgt() info by the PDFs, alpha_S and the scale
2610+c dependence and saves the weights in the wgts() array. The weights in
2611+c this array are now correctly normalised to compute the cross section
2612+c or to fill histograms.
2613+ implicit none
2614+ include 'nexternal.inc'
2615+ include 'run.inc'
2616+ include 'c_weight.inc'
2617+ include 'coupl.inc'
2618+ include 'timing_variables.inc'
2619+ integer i
2620+ double precision xlum,dlum,pi,mu2_r,mu2_f,mu2_q,rwgt_muR_dep_fac
2621+ external rwgt_muR_dep_fac
2622+ parameter (pi=3.1415926535897932385d0)
2623+ external dlum
2624+ integer nFKSprocess
2625+ common/c_nFKSprocess/nFKSprocess
2626+ double precision virt_wgt_mint,born_wgt_mint
2627+ common /virt_born_wgt_mint/virt_wgt_mint,born_wgt_mint
2628+ call cpu_time(tBefore)
2629+ if (icontr.eq.0) return
2630+ do i=1,icontr
2631+ nFKSprocess=nFKS(i)
2632+ xbk(1) = bjx(1,i)
2633+ xbk(2) = bjx(2,i)
2634+ mu2_q=scales2(1,i)
2635+ mu2_r=scales2(2,i)
2636+ mu2_f=scales2(3,i)
2637+ q2fact(1)=mu2_f
2638+ q2fact(2)=mu2_f
2639+c call the PDFs
2640+ xlum = dlum()
2641+c iwgt=1 is the central value (i.e. no scale/PDF reweighting).
2642+ iwgt=1
2643+ wgts(iwgt,i)=xlum * (wgt(1,i) + wgt(2,i)*log(mu2_r/mu2_q) +
2644+ & wgt(3,i)*log(mu2_f/mu2_q))*g_strong(i)**QCDpower(i)
2645+ wgts(iwgt,i)=wgts(iwgt,i)*rwgt_muR_dep_fac(sqrt(mu2_r))
2646+ if (itype(i).eq.3) then
2647+c Special for the soft-virtual needed for the virt-tricks. The
2648+c *_wgt_mint variable should be directly passed to the mint-integrator
2649+c and not be part of the plots nor computation of the cross section.
2650+ virt_wgt_mint=virt_wgt_mint*xlum*g_strong(i)**QCDpower(i)
2651+ & *rwgt_muR_dep_fac(sqrt(scales2(2,i)))
2652+ born_wgt_mint=born_wgt_mint*xlum*g_strong(i)**QCDpower(i)
2653+ & /(8d0*Pi**2)*rwgt_muR_dep_fac(sqrt(mu2_r))
2654+ endif
2655+ enddo
2656+ call cpu_time(tAfter)
2657+ t_as=t_as+(tAfter-tBefore)
2658+ return
2659+ end
2660+
2661+ subroutine reweight_scale
2662+c Use the saved c_weight info to perform scale reweighting. Extends the
2663+c wgts() array to include the weights.
2664+ implicit none
2665+ include 'nexternal.inc'
2666+ include 'run.inc'
2667+ include 'c_weight.inc'
2668+ include 'reweight.inc'
2669+ include 'reweightNLO.inc'
2670+ include 'timing_variables.inc'
2671+ integer i,kr,kf,iwgt_save
2672+ double precision xlum(maxscales),dlum,pi,mu2_r(maxscales)
2673+ & ,mu2_f(maxscales),mu2_q,alphas,g(maxscales),rwgt_muR_dep_fac
2674+ external rwgt_muR_dep_fac
2675+ parameter (pi=3.1415926535897932385d0)
2676+ external dlum,alphas
2677+ integer nFKSprocess
2678+ common/c_nFKSprocess/nFKSprocess
2679+ double precision virt_wgt_mint,born_wgt_mint
2680+ common /virt_born_wgt_mint/virt_wgt_mint,born_wgt_mint
2681+ call cpu_time(tBefore)
2682+ if (icontr.eq.0) return
2683+c currently we have 'iwgt' weights in the wgts() array.
2684+ iwgt_save=iwgt
2685+c loop over all the contributions in the c_weights common block
2686+ do i=1,icontr
2687+ iwgt=iwgt_save
2688+ nFKSprocess=nFKS(i)
2689+ xbk(1) = bjx(1,i)
2690+ xbk(2) = bjx(2,i)
2691+ mu2_q=scales2(1,i)
2692+c renormalisation scale variation (requires recomputation of the strong
2693+c coupling)
2694+ do kr=1,numscales
2695+ mu2_r(kr)=scales2(2,i)*yfactR(kr)**2
2696+ g(kr)=sqrt(4d0*pi*alphas(sqrt(mu2_r(kr))))
2697+ enddo
2698+c factorisation scale variation (require recomputation of the PDFs)
2699+ do kf=1,numscales
2700+ mu2_f(kf)=scales2(3,i)*yfactF(kf)**2
2701+ q2fact(1)=mu2_f(kf)
2702+ q2fact(2)=mu2_f(kf)
2703+ xlum(kf) = dlum()
2704+ enddo
2705+ do kr=1,numscales
2706+ do kf=1,numscales
2707+ iwgt=iwgt+1 ! increment the iwgt for the wgts() array
2708+ if (iwgt.gt.max_wgt) then
2709+ write (*,*) 'ERROR too many weights in reweight_scale'
2710+ & ,iwgt,max_wgt
2711+ stop 1
2712+ endif
2713+c add the weights to the array
2714+ wgts(iwgt,i)=xlum(kf) * (wgt(1,i)+wgt(2,i)*log(mu2_r(kr)
2715+ & /mu2_q)+wgt(3,i)*log(mu2_f(kf)/mu2_q))*g(kr)
2716+ & **QCDpower(i)
2717+ wgts(iwgt,i)=wgts(iwgt,i)
2718+ & *rwgt_muR_dep_fac(sqrt(mu2_r(kr)))
2719+ enddo
2720+ enddo
2721+ enddo
2722+ call cpu_time(tAfter)
2723+ tr_s=tr_s+(tAfter-tBefore)
2724+ return
2725+ end
2726+
2727+ subroutine reweight_pdf
2728+c Use the saved c_weight info to perform PDF reweighting. Extends the
2729+c wgts() array to include the weights.
2730+ implicit none
2731+ include 'nexternal.inc'
2732+ include 'run.inc'
2733+ include 'c_weight.inc'
2734+ include 'reweight.inc'
2735+ include 'reweightNLO.inc'
2736+ include 'timing_variables.inc'
2737+ integer n,izero,i
2738+ parameter (izero=0)
2739+ double precision xlum,dlum,pi,mu2_r,mu2_f,mu2_q,rwgt_muR_dep_fac
2740+ external rwgt_muR_dep_fac
2741+ parameter (pi=3.1415926535897932385d0)
2742+ external dlum,alphas
2743+ integer nFKSprocess
2744+ common/c_nFKSprocess/nFKSprocess
2745+ call cpu_time(tBefore)
2746+ if (icontr.eq.0) return
2747+c Use as external loop the one over the PDF sets and as internal the one
2748+c over the icontr. This reduces the number of calls to InitPDF and
2749+c allows for better caching of the PDFs
2750+ do n=1,numPDFs-1
2751+ iwgt=iwgt+1
2752+ if (iwgt.gt.max_wgt) then
2753+ write (*,*) 'ERROR too many weights in reweight_pdf',iwgt
2754+ & ,max_wgt
2755+ stop 1
2756+ endif
2757+ call InitPDF(n)
2758+ do i=1,icontr
2759+ nFKSprocess=nFKS(i)
2760+ xbk(1) = bjx(1,i)
2761+ xbk(2) = bjx(2,i)
2762+ mu2_q=scales2(1,i)
2763+ mu2_r=scales2(2,i)
2764+ mu2_f=scales2(3,i)
2765+ q2fact(1)=mu2_f
2766+ q2fact(2)=mu2_f
2767+ xlum = dlum()
2768+c add the weights to the array
2769+ wgts(iwgt,i)=xlum * (wgt(1,i) + wgt(2,i)*log(mu2_r/mu2_q) +
2770+ & wgt(3,i)*log(mu2_f/mu2_q))*g_strong(i)**QCDpower(i)
2771+ wgts(iwgt,i)=wgts(iwgt,i)*rwgt_muR_dep_fac(sqrt(mu2_r))
2772+ enddo
2773+ call InitPDF(izero)
2774+ enddo
2775+ call cpu_time(tAfter)
2776+ tr_pdf=tr_pdf+(tAfter-tBefore)
2777+ return
2778+ end
2779+
2780+ subroutine fill_applgrid_weights(vegas_wgt)
2781+c Fills the ApplGrid weights of appl_common.inc. This subroutine assumes
2782+c that there is an unique PS configuration: at most one Born, one real
2783+c and one set of counter terms. Among other things, this means that one
2784+c must do MC over FKS directories.
2785+ implicit none
2786+ include 'nexternal.inc'
2787+ include 'c_weight.inc'
2788+ include 'appl_common.inc'
2789+ include 'nFKSconfigs.inc'
2790+ include 'genps.inc'
2791+ integer i
2792+ double precision final_state_rescaling,vegas_wgt
2793+ integer flavour_map(fks_configs)
2794+ common/c_flavour_map/flavour_map
2795+ integer iproc_save(fks_configs),eto(maxproc,fks_configs),
2796+ & etoi(maxproc,fks_configs),maxproc_found
2797+ common/cproc_combination/iproc_save,eto,etoi,maxproc_found
2798+ if (icontr.gt.6) then
2799+ write (*,*) 'ERROR: too many applgrid weights. '/
2800+ & /'Should have at most one of each itype.',icontr
2801+ stop 1
2802+ endif
2803+ do i=1,4
2804+ appl_w0(i)=0d0
2805+ appl_wR(i)=0d0
2806+ appl_wF(i)=0d0
2807+ appl_wB(i)=0d0
2808+ appl_x1(i)=0d0
2809+ appl_x2(i)=0d0
2810+ appl_QES2(i)=0d0
2811+ appl_muR2(i)=0d0
2812+ appl_muF2(i)=0d0
2813+ enddo
2814+ appl_event_weight = 0d0
2815+ appl_vegaswgt = vegas_wgt
2816+ if (icontr.eq.0) return
2817+ do i=1,icontr
2818+ appl_event_weight=appl_event_weight+wgts(1,i)
2819+ final_state_rescaling = dble(iproc_save(nFKS(i))) /
2820+ & dble(appl_nproc(flavour_map(nFKS(i))))
2821+ if (itype(i).eq.1) then
2822+c real
2823+ appl_w0(1)=appl_w0(1)+wgt(1,i)*final_state_rescaling
2824+ appl_x1(1)=bjx(1,i)
2825+ appl_x2(1)=bjx(2,i)
2826+ appl_flavmap(1) = flavour_map(nFKS(i))
2827+ appl_QES2(1)=scales2(1,i)
2828+ appl_muR2(1)=scales2(2,i)
2829+ appl_muF2(1)=scales2(3,i)
2830+ elseif (itype(i).eq.2) then
2831+c born
2832+ appl_wB(2)=appl_wB(2)+wgt(1,i)*final_state_rescaling
2833+ appl_x1(2)=bjx(1,i)
2834+ appl_x2(2)=bjx(2,i)
2835+ appl_flavmap(2) = flavour_map(nFKS(i))
2836+ appl_QES2(2)=scales2(1,i)
2837+ appl_muR2(2)=scales2(2,i)
2838+ appl_muF2(2)=scales2(3,i)
2839+ elseif (itype(i).eq.3 .or. itype(i).eq.4) then
2840+c soft-virtual or soft-counter
2841+ appl_w0(2)=appl_w0(2)+wgt(1,i)*final_state_rescaling
2842+ appl_wR(2)=appl_wR(2)+wgt(2,i)*final_state_rescaling
2843+ appl_wF(2)=appl_wF(2)+wgt(3,i)*final_state_rescaling
2844+ appl_x1(2)=bjx(1,i)
2845+ appl_x2(2)=bjx(2,i)
2846+ appl_flavmap(2) = flavour_map(nFKS(i))
2847+ appl_QES2(2)=scales2(1,i)
2848+ appl_muR2(2)=scales2(2,i)
2849+ appl_muF2(2)=scales2(3,i)
2850+ elseif (itype(i).eq.5) then
2851+c collinear counter
2852+ appl_w0(3)=appl_w0(3)+wgt(1,i)*final_state_rescaling
2853+ appl_wF(3)=appl_wF(3)+wgt(3,i)*final_state_rescaling
2854+ appl_x1(3)=bjx(1,i)
2855+ appl_x2(3)=bjx(2,i)
2856+ appl_flavmap(3) = flavour_map(nFKS(i))
2857+ appl_QES2(3)=scales2(1,i)
2858+ appl_muR2(3)=scales2(2,i)
2859+ appl_muF2(3)=scales2(3,i)
2860+ elseif (itype(i).eq.6) then
2861+c soft-collinear counter
2862+ appl_w0(4)=appl_w0(4)+wgt(1,i)*final_state_rescaling
2863+ appl_wF(4)=appl_wF(4)+wgt(3,i)*final_state_rescaling
2864+ appl_x1(4)=bjx(1,i)
2865+ appl_x2(4)=bjx(2,i)
2866+ appl_flavmap(4) = flavour_map(nFKS(i))
2867+ appl_QES2(4)=scales2(1,i)
2868+ appl_muR2(4)=scales2(2,i)
2869+ appl_muF2(4)=scales2(3,i)
2870+ endif
2871+ enddo
2872+ return
2873+ end
2874+
2875+
2876+ subroutine get_wgt_nbody(sig)
2877+c Sums all the central weights that contribution to the nbody cross
2878+c section
2879+ implicit none
2880+ include 'nexternal.inc'
2881+ include 'c_weight.inc'
2882+ double precision sig
2883+ integer i
2884+ sig=0d0
2885+ if (icontr.eq.0) return
2886+ do i=1,icontr
2887+ if (itype(i).eq.2 .or. itype(i).eq.3) then
2888+ sig=sig+wgts(1,i)
2889+ endif
2890+ enddo
2891+ return
2892+ end
2893+
2894+ subroutine get_wgt_no_nbody(sig)
2895+c Sums all the central weights that contribution to the cross section
2896+c excluding the nbody contributions.
2897+ implicit none
2898+ include 'nexternal.inc'
2899+ include 'c_weight.inc'
2900+ double precision sig
2901+ integer i
2902+ sig=0d0
2903+ if (icontr.eq.0) return
2904+ do i=1,icontr
2905+ if (itype(i).eq.1 .or. itype(i).eq.4 .or. itype(i).eq.5 .or.
2906+ & itype(i).eq.6) then
2907+ sig=sig+wgts(1,i)
2908+ endif
2909+ enddo
2910+ return
2911+ end
2912+
2913+ subroutine fill_plots
2914+c Calls the analysis routine (which fill plots) for all the
2915+c contributions in the c_weight common block. Instead of really calling
2916+c it for all, it first checks if weights can be summed (i.e. they have
2917+c the same PDG codes and the same momenta) before calling the analysis
2918+c to greatly reduce the calls to the analysis routines.
2919+ implicit none
2920+ include 'nexternal.inc'
2921+ include 'c_weight.inc'
2922+ include 'reweight0.inc'
2923+ include 'timing_variables.inc'
2924+ integer i,ii,j,max_weight
2925+ logical momenta_equal,pdg_equal
2926+ external momenta_equal,pdg_equal
2927+ parameter (max_weight=maxscales*maxscales+maxpdfs+1)
2928+ double precision www(max_weight)
2929+ call cpu_time(tBefore)
2930+ if (icontr.eq.0) return
2931+c fill the plots_wgts. Check if we can sum weights together before
2932+c calling the analysis routines. This is the case if the PDG codes and
2933+c the momenta are identical.
2934+ do i=1,icontr
2935+ do j=1,iwgt
2936+ plot_wgts(j,i)=0d0
2937+ enddo
2938+ if (itype(i).eq.2) then
2939+ plot_id(i)=20 ! Born
2940+ elseif(itype(1).eq.1) then
2941+ plot_id(i)=11 ! real-emission
2942+ else
2943+ plot_id(i)=12 ! soft-virtual and counter terms
2944+ endif
2945+c Loop over all previous icontr. If the plot_id, PDGs and momenta are
2946+c equal to a previous icountr, add the current weight to the plot_wgts
2947+c of that contribution and exit the do-loop. This loop extends to 'i',
2948+c so if the current weight cannot be summed to a previous one, the ii=i
2949+c contribution makes sure that it is added as a new element.
2950+ do ii=1,i
2951+ if (plot_id(ii).eq.plot_id(i)) then
2952+ if (pdg_equal(pdg(1,ii),pdg(1,i))) then
2953+ if (momenta_equal(momenta(0,1,ii),momenta(0,1,i)))then
2954+ do j=1,iwgt
2955+ plot_wgts(j,ii)=plot_wgts(j,ii)+wgts(j,i)
2956+ enddo
2957+ exit
2958+ endif
2959+ endif
2960+ endif
2961+ enddo
2962+ enddo
2963+ do i=1,icontr
2964+ if (plot_wgts(1,i).ne.0d0) then
2965+ if (iwgt.gt.max_weight) then
2966+ write (*,*) 'ERROR too many weights in fill_plots',iwgt
2967+ & ,max_weight
2968+ stop 1
2969+ endif
2970+ do j=1,iwgt
2971+ www(j)=plot_wgts(j,i)
2972+ enddo
2973+c call the analysis/histogramming routines
2974+ call outfun(momenta(0,1,i),y_bst(i),www,pdg(1,i),plot_id(i))
2975+ endif
2976+ enddo
2977+ call cpu_time(tAfter)
2978+ t_plot=t_plot+(tAfter-tBefore)
2979+ return
2980+ end
2981+
2982+ subroutine fill_mint_function(f)
2983+ implicit none
2984+ include 'nexternal.inc'
2985+ include 'c_weight.inc'
2986+ include 'mint.inc'
2987+ integer i
2988+ double precision f(nintegrals),sigint
2989+ double precision virt_wgt_mint,born_wgt_mint
2990+ common /virt_born_wgt_mint/virt_wgt_mint,born_wgt_mint
2991+ double precision virtual_over_born
2992+ common /c_vob/ virtual_over_born
2993+ sigint=0d0
2994+ do i=1,icontr
2995+ sigint=sigint+wgts(1,i)
2996+ enddo
2997+ f(1)=abs(sigint)
2998+ f(2)=sigint
2999+ f(3)=virt_wgt_mint
3000+ f(4)=virtual_over_born
3001+ f(5)=abs(virt_wgt_mint)
3002+ f(6)=born_wgt_mint
3003+ return
3004+ end
3005+
3006+
3007 subroutine rotate_invar(pin,pout,cth,sth,cphi,sphi)
3008 c Given the four momentum pin, returns the four momentum pout (in the same
3009 c Lorentz frame) by performing a three-rotation of an angle theta
3010@@ -222,796 +1449,6 @@
3011 end
3012
3013
3014- double precision function dsig(pp,wgt,vegaswgt)
3015-c Here are the subtraction terms, the Sij function,
3016-c the f-damping function, and the single diagram
3017-c enhanced multi-channel factor included
3018- implicit none
3019- include "genps.inc"
3020- include 'nexternal.inc'
3021-c include "fks.inc"
3022- integer fks_j_from_i(nexternal,0:nexternal)
3023- & ,particle_type(nexternal),pdg_type(nexternal)
3024- common /c_fks_inc/fks_j_from_i,particle_type,pdg_type
3025- include "fks_powers.inc"
3026- include 'coupl.inc'
3027- include 'q_es.inc'
3028- include 'run.inc'
3029- include 'reweight.inc'
3030- include 'reweightNLO.inc'
3031-
3032-c timing statistics
3033- include 'timing_variables.inc'
3034- real deltaTOLP,deltaTPDF,deltaTFJ
3035-
3036- double precision pp(0:3,nexternal),wgt,vegaswgt
3037-
3038- double precision fks_Sij,f_damp,dot,dlum
3039- external fks_Sij,f_damp,dot,dlum
3040-
3041- double precision x,xtot,s_ev,s_c,s_s,s_sc,ffact,fx_ev,fx_c,
3042- # fx_s,fx_sc,ev_wgt,cnt_wgt_c,cnt_wgt_s,cnt_wgt_sc,
3043- # bsv_wgt,plot_wgt,cnt_swgt_s,cnt_swgt_sc,cnt_sc,cnt_s,
3044- # prefact_cnt_ssc,prefact_cnt_ssc_c,prefact_coll,
3045- # prefact_coll_c,born_wgt,prefact_deg,prefact,prefact_c,
3046- # prefact_deg_sxi,prefact_deg_slxi,deg_wgt,deg_swgt,
3047- # deg_xi_c,deg_lxi_c,deg_xi_sc,deg_lxi_sc,
3048- # cnt_swgt,cnt_wgt,xlum_ev,xlum_c,xlum_s,xlum_sc,xsec,
3049- # bpower,cpower
3050- integer i,j,iplot
3051-
3052- integer izero,ione,itwo,mohdr,iplot_ev,iplot_cnt,iplot_born
3053- integer ithree,ifour,ifill2,ifill3,ifill4
3054- parameter (izero=0)
3055- parameter (ione=1)
3056- parameter (itwo=2)
3057- parameter (ithree=3)
3058- parameter (ifour=4)
3059- parameter (mohdr=-100)
3060- parameter (iplot_ev=11)
3061- parameter (iplot_cnt=12)
3062- parameter (iplot_born=20)
3063-
3064- double precision ybst_til_tolab,ybst_til_tocm,sqrtshat,shat
3065- common/parton_cms_stuff/ybst_til_tolab,ybst_til_tocm,
3066- # sqrtshat,shat
3067-
3068- double precision shattmp
3069- double precision pi
3070- parameter (pi=3.1415926535897932385d0)
3071-
3072- logical nocntevents
3073- common/cnocntevents/nocntevents
3074-
3075- double precision xnormsv
3076- common/cxnormsv/xnormsv
3077-
3078-c Multi channel stuff:
3079- Double Precision amp2(maxamps), jamp2(0:maxamps)
3080- common/to_amps/ amp2, jamp2
3081-
3082- integer isum_hel
3083- logical multi_channel
3084- common/to_matrix/isum_hel, multi_channel
3085- INTEGER MAPCONFIG(0:LMAXCONFIGS), ICONFIG
3086- common/to_mconfigs/mapconfig, iconfig
3087-
3088- double complex wgt1(2)
3089- double precision p_born(0:3,nexternal-1)
3090- common/pborn/p_born
3091-
3092- logical calculatedBorn
3093- common/ccalculatedBorn/calculatedBorn
3094-
3095- double precision ev_enh,enhance,rwgt,unwgtfun
3096- logical firsttime,passcuts
3097- data firsttime /.true./
3098- integer inoborn_ev,inoborn_cnt
3099- double precision xnoborn_ev,xnoborn_cnt
3100-
3101-c FKS stuff:
3102- integer i_fks,j_fks
3103- common/fks_indices/i_fks,j_fks
3104-
3105- double precision xi_i_fks_ev,y_ij_fks_ev
3106- double precision p_i_fks_ev(0:3),p_i_fks_cnt(0:3,-2:2)
3107- common/fksvariables/xi_i_fks_ev,y_ij_fks_ev,p_i_fks_ev,p_i_fks_cnt
3108-
3109- double precision xi_i_fks_cnt(-2:2)
3110- common /cxiifkscnt/xi_i_fks_cnt
3111-
3112- double precision xiimax_ev
3113- common /cxiimaxev/xiimax_ev
3114- double precision xiimax_cnt(-2:2)
3115- common /cxiimaxcnt/xiimax_cnt
3116-
3117- double precision xinorm_ev
3118- common /cxinormev/xinorm_ev
3119- double precision xinorm_cnt(-2:2)
3120- common /cxinormcnt/xinorm_cnt
3121-
3122- double precision p1_cnt(0:3,nexternal,-2:2)
3123- double precision wgt_cnt(-2:2)
3124- double precision pswgt_cnt(-2:2)
3125- double precision jac_cnt(-2:2)
3126- common/counterevnts/p1_cnt,wgt_cnt,pswgt_cnt,jac_cnt
3127-
3128- double precision zero,one
3129- parameter (zero=0d0,one=1d0)
3130- double precision tiny
3131- parameter (tiny=1d-6)
3132-
3133- double precision xicut_used
3134- common /cxicut_used/xicut_used
3135- double precision delta_used
3136- common /cdelta_used/delta_used
3137- double precision xiScut_used,xiBSVcut_used
3138- common /cxiScut_used/xiScut_used,xiBSVcut_used
3139- double precision fkssymmetryfactor,fkssymmetryfactorBorn,
3140- & fkssymmetryfactorDeg
3141- integer ngluons,nquarks(-6:6)
3142- common/numberofparticles/fkssymmetryfactor,fkssymmetryfactorBorn,
3143- & fkssymmetryfactorDeg,ngluons,nquarks
3144- double precision diagramsymmetryfactor
3145- common /dsymfactor/diagramsymmetryfactor
3146-
3147- character*4 abrv
3148- common /to_abrv/ abrv
3149-
3150- logical nbody
3151- common/cnbody/nbody
3152-
3153- double precision vegas_weight
3154- common/cvegas_weight/vegas_weight
3155-
3156-c For the MINT folding
3157- integer fold
3158- common /cfl/fold
3159-
3160-c Random numbers to be used in the plotting routine
3161- logical needrndec
3162- parameter (needrndec=.true.)
3163-
3164- real*8 ran2
3165- external ran2
3166-
3167- real*8 rndec(10)
3168- common/crndec/rndec
3169-
3170-c For tests
3171- real*8 fksmaxwgt,xisave,ysave
3172- common/cfksmaxwgt/fksmaxwgt,xisave,ysave
3173-
3174- logical ExceptPSpoint
3175- integer iminmax
3176- common/cExceptPSpoint/iminmax,ExceptPSpoint
3177-
3178- double precision central_wgt_saved
3179- save central_wgt_saved
3180-
3181- double precision dsig_max,dsig_min
3182- double precision total_wgt_sum,total_wgt_sum_max,
3183- & total_wgt_sum_min
3184- common/csum_of_wgts/total_wgt_sum,total_wgt_sum_max,
3185- & total_wgt_sum_min
3186- double precision virt_wgt,born_wgt_ao2pi
3187- common/c_fks_singular/virt_wgt,born_wgt_ao2pi
3188-
3189-c APPLgrid stuff
3190- integer iappl
3191- common /for_applgrid/ iappl
3192- include "appl_common.inc"
3193-
3194-c FxFx merging
3195- logical rewgt_mohdr_calculated,rewgt_izero_calculated
3196- double precision rewgt_mohdr,rewgt_izero,rewgt_exp_mohdr
3197- $ ,rewgt_exp_izero,enhanceS,enhanceH
3198- logical setclscales
3199- double precision rewgt
3200- external setclscales,rewgt
3201-
3202- double precision pmass(nexternal)
3203- double precision rwgt_muR_dep_fac
3204- include "pmass.inc"
3205-
3206- vegas_weight=vegaswgt
3207-
3208-c FxFx merging
3209- ktscheme=1
3210- rewgt_mohdr_calculated=.false.
3211- rewgt_izero_calculated=.false.
3212-
3213-
3214- if (fold.eq.0) then
3215- calculatedBorn=.false.
3216- call get_helicity(i_fks,j_fks)
3217- endif
3218-
3219-c Make sure that the result can be non-zero. If the jacobian from the
3220-c PS-setup or vegas are zero, we can skip this PS point and 'return'.
3221-c Note that all the wgts and jacs should be positive.
3222- dsig=0d0
3223- if ( (wgt.le.0d0 .and. jac_cnt(0).le.0d0 .and. jac_cnt(1).le.0d0
3224- & .and. jac_cnt(2).le.0d0) .or. vegaswgt.le.0d0) return
3225-
3226- if (firsttime)then
3227- inoborn_ev=0
3228- xnoborn_ev=0.d0
3229- inoborn_cnt=0
3230- xnoborn_cnt=0.d0
3231- fksmaxwgt=0.d0
3232-c Put here call to compute bpower
3233- call compute_bpower(p_born,bpower)
3234- wgtbpower=bpower
3235-c Store the power of alphas of the Born events in the appl common block.
3236- if(iappl.ne.0) appl_bpower = wgtbpower
3237-c Initialize histograms
3238- call initplot
3239-c Compute cpower done for bottom Yukawa, routine needs to be adopted
3240-c for other muR-dependendent factors
3241- call compute_cpower(p_born,cpower)
3242- if(dabs(cpower+1d0).lt.tiny) then
3243- wgtcpower=0d0
3244- else
3245- wgtcpower=cpower
3246- endif
3247-c Check that things are done consistently
3248- if(wgtcpower.ne.cpowerinput.and.dabs(cpower+1d0).gt.tiny)then
3249- write(*,*)'Inconsistency in the computation of cpower',
3250- # wgtcpower,cpowerinput
3251- write(*,*)'Check value in reweight0.inc'
3252- stop
3253- endif
3254-
3255- firsttime=.false.
3256- endif
3257-
3258- prefact=xinorm_ev/xi_i_fks_ev*
3259- # 1/(1-y_ij_fks_ev)
3260- if( (.not.nocntevents) .and. (.not.(abrv.eq.'born' .or. abrv.eq
3261- & .'grid' .or. abrv(1:2).eq.'vi' .or. nbody))
3262- & )then
3263- prefact_cnt_ssc=xinorm_ev/min(xiimax_ev,xiScut_used)*
3264- # log(xicut_used/min(xiimax_ev,xiScut_used))*
3265- # 1/(1-y_ij_fks_ev)
3266- if(pmass(j_fks).eq.0.d0)then
3267- prefact_c=xinorm_cnt(ione)/xi_i_fks_cnt(ione)*
3268- # 1/(1-y_ij_fks_ev)
3269- prefact_cnt_ssc_c=xinorm_cnt(ione)/min(xiimax_cnt(ione),xiScut_used)*
3270- # log(xicut_used/min(xiimax_cnt(ione),xiScut_used))*
3271- # 1/(1-y_ij_fks_ev)
3272- prefact_coll=xinorm_cnt(ione)/xi_i_fks_cnt(ione)*
3273- # log(delta_used/deltaS)/deltaS
3274- prefact_coll_c=xinorm_cnt(ione)/min(xiimax_cnt(ione),xiScut_used)*
3275- # log(xicut_used/min(xiimax_cnt(ione),xiScut_used))*
3276- # log(delta_used/deltaS)/deltaS
3277- prefact_deg=xinorm_cnt(ione)/xi_i_fks_cnt(ione)*
3278- # 1/deltaS
3279- prefact_deg_sxi=xinorm_cnt(ione)/min(xiimax_cnt(ione),xiScut_used)*
3280- # log(xicut_used/min(xiimax_cnt(ione),xiScut_used))*
3281- # 1/deltaS
3282- prefact_deg_slxi=xinorm_cnt(ione)/min(xiimax_cnt(ione),xiScut_used)*
3283- # ( log(xicut_used)**2 -
3284- # log(min(xiimax_cnt(ione),xiScut_used))**2 )*
3285- # 1/(2.d0*deltaS)
3286- endif
3287- endif
3288-
3289- if(needrndec)then
3290- do i=1,10
3291- rndec(i)=ran2()
3292- enddo
3293- endif
3294-
3295-c If there was an exceptional phase-space point found for the
3296-c virtual corrections, at the end of this subroutine, goto 44
3297-c and compute also the "possible" minimal and maximal weight
3298-c these points could have gotton (based upon previous PS
3299-c points)
3300- ExceptPSpoint=.false.
3301- iminmax=-1
3302- 44 continue
3303- iminmax=iminmax+1
3304-
3305- ev_wgt=0.d0
3306- cnt_wgt=0.d0
3307- cnt_wgt_s=0.d0
3308- cnt_wgt_c=0.d0
3309- cnt_wgt_sc=0.d0
3310- bsv_wgt=0.d0
3311- virt_wgt=0d0
3312- born_wgt=0.d0
3313- born_wgt_ao2pi=0.d0
3314- cnt_swgt=0.d0
3315- cnt_swgt_s=0.d0
3316- cnt_swgt_sc=0.d0
3317- deg_wgt=0.d0
3318- deg_swgt=0.d0
3319- plot_wgt=0.d0
3320- iplot=-3
3321-
3322- if(doreweight)then
3323- call reweight_settozero()
3324- ifill2=0
3325- ifill3=0
3326- ifill4=0
3327- endif
3328- if (abrv.eq.'born' .or. abrv.eq.'grid' .or. abrv(1:2).eq.'vi' .or.
3329- & nbody)goto 540
3330-
3331- call cpu_time(tBefore)
3332- deltaTPDF = tPDF
3333- deltaTFJ = tFastJet
3334-c Real contribution:
3335-c Set the ybst_til_tolab before applying the cuts.
3336- call set_cms_stuff(mohdr)
3337- if(doreweight)then
3338- wgtxbj(1,1)=xbk(1)
3339- wgtxbj(2,1)=xbk(2)
3340- endif
3341- if (passcuts(pp,rwgt)) then
3342-c Compute the scales and sudakov-reweighting for the FxFx merging
3343- if (ickkw.eq.3) then
3344- if (.not. setclscales(pp)) then
3345- write (*,*) 'ERROR in setclscales mohdr'
3346- stop
3347- endif
3348- rewgt_mohdr=rewgt(pp,rewgt_exp_mohdr)
3349- rewgt_mohdr_calculated=.true.
3350- endif
3351- call set_alphaS(pp)
3352- x = abs(2d0*dot(pp(0,i_fks),pp(0,j_fks))/shat)
3353- ffact = f_damp(x)
3354- s_ev = fks_Sij(pp,i_fks,j_fks,xi_i_fks_ev,y_ij_fks_ev)
3355- if(s_ev.gt.0.d0)then
3356- call sreal(pp,xi_i_fks_ev,y_ij_fks_ev,fx_ev)
3357- xlum_ev = dlum()
3358- xsec = fx_ev*s_ev*ffact*wgt*prefact*rwgt
3359- ev_wgt = xlum_ev*xsec * rwgt_muR_dep_fac(scale)
3360-com-- muR-dependent fac is reweighted here
3361- if(doreweight)then
3362- wgtmuR2(1)=muR2_current/muR_over_ref**2
3363- wgtmuF12(1)=muF12_current/muF1_over_ref**2
3364- wgtmuF22(1)=muF22_current/muF2_over_ref**2
3365- call reweight_fillkin(pp,ione)
3366- wgtwreal(1)=xsec/g**(nint(2*wgtbpower+2.d0))
3367- endif
3368- endif
3369- endif
3370- call cpu_time(tAfter)
3371- tDSigR=tDSigR + (tAfter-tBefore) - (tPDF-deltaTPDF) -
3372- & (tFastJet-deltaTFJ)
3373-c
3374-c All counterevent have the same final-state kinematics. Check that
3375-c one of them passes the hard cuts, and they exist at all
3376- 540 continue
3377- call cpu_time(tBefore)
3378- deltaTPDF = tPDF
3379- deltaTFJ = tFastJet
3380- deltaTOLP = tOLP
3381-c Set the ybst_til_tolab before applying the cuts. Update below
3382-c for the collinear, soft and/or soft-collinear subtraction terms
3383- call set_cms_stuff(izero)
3384- if ( (.not.passcuts(p1_cnt(0,1,0),rwgt)) .or.
3385- # nocntevents ) goto 547
3386-
3387-c Compute the scales and sudakov-reweighting for the FxFx merging
3388- if (ickkw.eq.3) then
3389- if (.not. setclscales(p1_cnt(0,1,0))) then
3390- write (*,*) 'ERROR in setclscales izero'
3391- stop
3392- endif
3393- rewgt_izero=rewgt(p1_cnt(0,1,0),rewgt_exp_izero)
3394- rewgt_izero_calculated=.true.
3395- endif
3396- call set_alphaS(p1_cnt(0,1,0))
3397- if(doreweight)then
3398- wgtqes2(2)=QES2
3399- wgtqes2(3)=QES2
3400- wgtqes2(4)=QES2
3401- wgtmuR2(2)=muR2_current/muR_over_ref**2
3402- wgtmuF12(2)=muF12_current/muF1_over_ref**2
3403- wgtmuF22(2)=muF22_current/muF2_over_ref**2
3404- call reweight_fillkin(pp,itwo)
3405- ifill2=1
3406- endif
3407-
3408- if (abrv.eq.'born' .or. abrv.eq.'grid' .or. abrv(1:2).eq.'vi' .or.
3409- & nbody)goto 545
3410-c
3411-c Collinear subtraction term:
3412- if( y_ij_fks_ev.gt.1d0-deltaS .and.
3413- # pmass(j_fks).eq.0.d0 )then
3414- call set_cms_stuff(ione)
3415- if(doreweight)then
3416- wgtxbj(1,3)=xbk(1)
3417- wgtxbj(2,3)=xbk(2)
3418- endif
3419- s_c = fks_Sij(p1_cnt(0,1,1),i_fks,j_fks,xi_i_fks_cnt(ione),one)
3420- if(s_c.gt.0.d0)then
3421- if(abs(s_c-1.d0).gt.1.d-6.and.j_fks.le.nincoming)then
3422- write(*,*)'Wrong S function in dsig[c]',s_c
3423- stop
3424- endif
3425- call sreal(p1_cnt(0,1,1),xi_i_fks_cnt(ione),one,fx_c)
3426- xlum_c = dlum()
3427- xsec = fx_c*s_c*jac_cnt(1)*(prefact_c+prefact_coll)*rwgt
3428- cnt_wgt_c=cnt_wgt_c-xlum_c*xsec * rwgt_muR_dep_fac(scale)
3429-com-- muR-dependent fac is reweighted here
3430- call sreal_deg(p1_cnt(0,1,1),xi_i_fks_cnt(ione),one,
3431- # deg_xi_c,deg_lxi_c)
3432- deg_wgt=deg_wgt+( deg_xi_c+deg_lxi_c*log(xi_i_fks_cnt(ione)) )*
3433- # jac_cnt(1)*prefact_deg*rwgt/(shat/(32*pi**2))*
3434- # xlum_c * rwgt_muR_dep_fac(scale)
3435-com-- muR-dependent fac is reweighted here
3436- iplot=1
3437- if(doreweight)then
3438- call reweight_fillkin(pp,ithree)
3439- ifill3=1
3440- wgtwreal(3)=-xsec/g**(nint(2*wgtbpower+2.d0))
3441- wgtwdeg(3)=
3442- # ( wgtdegrem_xi+wgtdegrem_lxi*log(xi_i_fks_cnt(ione)) )*
3443- # jac_cnt(1)*prefact_deg*rwgt/(shat/(32*pi**2))/
3444- # g**(nint(2*wgtbpower+2.d0))
3445- wgtwdegmuf(3)=wgtdegrem_muF *
3446- # jac_cnt(1)*prefact_deg*rwgt/(shat/(32*pi**2))/
3447- # g**(nint(2*wgtbpower+2.d0))
3448- endif
3449- endif
3450- endif
3451-c Soft subtraction term:
3452- 545 continue
3453- if (xi_i_fks_ev .lt. max(xiScut_used,xiBSVcut_used)) then
3454- call set_cms_stuff(izero)
3455- if(doreweight)then
3456- wgtxbj(1,2)=xbk(1)
3457- wgtxbj(2,2)=xbk(2)
3458- if(ifill2.ne.1)then
3459- write(*,*)'Error #1[wg] in dsig',ifill2
3460- stop
3461- endif
3462- endif
3463- s_s = fks_Sij(p1_cnt(0,1,0),i_fks,j_fks,zero,y_ij_fks_ev)
3464- if(nbody)s_s=1.d0
3465- if(s_s.gt.0.d0)then
3466- xlum_s = dlum()
3467- if (abrv.eq.'born' .or. abrv.eq.'grid' .or.
3468- & abrv(1:2).eq.'vi' .or. nbody) goto 546
3469- if (xi_i_fks_ev .lt. xiScut_used) then
3470- call sreal(p1_cnt(0,1,0),zero,y_ij_fks_ev,fx_s)
3471- xsec=fx_s*s_s*jac_cnt(0)
3472- cnt_s=xlum_s*xsec
3473- cnt_wgt_s=cnt_wgt_s-cnt_s*prefact*rwgt
3474- f * rwgt_muR_dep_fac(scale)
3475-com-- muR-dependent fac is reweighted here
3476- cnt_swgt_s=cnt_swgt_s-cnt_s*prefact_cnt_ssc*rwgt
3477- f * rwgt_muR_dep_fac(scale)
3478-com-- muR-dependent fac is reweighted here
3479- if(doreweight)
3480- # wgtwreal(2)=-xsec*(prefact+prefact_cnt_ssc)*rwgt/
3481- # g**(nint(2*wgtbpower+2.d0))
3482- endif
3483- 546 continue
3484- if (abrv.eq.'real' .or. .not.nbody) goto 548
3485- if (xi_i_fks_ev .lt. xiBSVcut_used) then
3486- xsec=s_s*jac_cnt(0)*xinorm_ev/
3487- # (min(xiimax_ev,xiBSVcut_used)*shat/(16*pi**2))*
3488- # rwgt
3489- xnormsv=xlum_s*xsec
3490- call bornsoftvirtual(p1_cnt(0,1,0),bsv_wgt,virt_wgt
3491- $ ,born_wgt)
3492- born_wgt_ao2pi=born_wgt*g**2/(8d0*Pi**2)
3493-c For FxFx merging, include the compensation term
3494- if (rewgt_izero_calculated.and.rewgt_izero.lt.1d0) then
3495- bsv_wgt=bsv_wgt-g**2/(4d0*Pi)*rewgt_exp_izero*born_wgt
3496- endif
3497- if(doreweight)then
3498- if(wgtbpower.gt.0)then
3499- wgtwborn(2)=born_wgt*xsec/g**(nint(2*wgtbpower))
3500- else
3501- wgtwborn(2)=born_wgt*xsec
3502- endif
3503- wgtwns(2)=wgtnstmp*xsec/g**(nint(2*wgtbpower+2.d0))
3504- if (rewgt_izero_calculated.and.rewgt_izero.lt.1d0) then
3505- wgtwns(2)=wgtwns(2)-rewgt_exp_izero*wgtwborn(2)
3506- $ /(4d0*pi)
3507- endif
3508- wgtwnsmuf(2)=wgtwnstmpmuf*xsec/g**(nint(2*wgtbpower
3509- & +2.d0))
3510- wgtwnsmur(2)=wgtwnstmpmur*xsec/g**(nint(2*wgtbpower
3511- & +2.d0))
3512- endif
3513- bsv_wgt=bsv_wgt*xnormsv * rwgt_muR_dep_fac(scale)
3514-com-- muR-dependent fac is reweighted here
3515- virt_wgt=virt_wgt*xnormsv * rwgt_muR_dep_fac(scale)
3516-com-- muR-dependent fac is reweighted here
3517- born_wgt=born_wgt*xnormsv * rwgt_muR_dep_fac(scale)
3518-com-- muR-dependent fac is reweighted here
3519- born_wgt_ao2pi=born_wgt_ao2pi*xnormsv
3520- f * rwgt_muR_dep_fac(scale)
3521-com-- muR-dependent fac is reweighted here
3522- endif
3523- 548 continue
3524- iplot=0
3525- endif
3526- endif
3527-c Soft-Collinear subtraction term:
3528- if (abrv.eq.'born' .or. abrv.eq.'grid' .or. abrv(1:2).eq.'vi' .or.
3529- & nbody)goto 547
3530- if (xi_i_fks_cnt(ione) .lt. xiScut_used .and.
3531- # y_ij_fks_ev .gt. 1d0-deltaS .and.
3532- # pmass(j_fks).eq.0.d0 )then
3533- call set_cms_stuff(itwo)
3534- if(doreweight)then
3535- wgtxbj(1,4)=xbk(1)
3536- wgtxbj(2,4)=xbk(2)
3537- endif
3538- s_sc = fks_Sij(p1_cnt(0,1,2),i_fks,j_fks,zero,one)
3539- if(s_sc.gt.0.d0)then
3540- if(abs(s_sc-1.d0).gt.1.d-6.and.j_fks.le.nincoming)then
3541- write(*,*)'Wrong S function in dsig[sc]',s_sc
3542- stop
3543- endif
3544- xlum_sc = dlum()
3545- call sreal(p1_cnt(0,1,2),zero,one,fx_sc)
3546- xsec=fx_sc*s_sc*jac_cnt(2)
3547- cnt_sc=xlum_sc*xsec
3548- cnt_wgt_sc=cnt_wgt_sc+cnt_sc*(prefact_c+prefact_coll)*rwgt
3549- f * rwgt_muR_dep_fac(scale)
3550-com-- muR-dependent fac is reweighted here
3551- cnt_swgt_sc=cnt_swgt_sc+
3552- & cnt_sc*(prefact_cnt_ssc_c+prefact_coll_c)*rwgt
3553- f * rwgt_muR_dep_fac(scale)
3554-com-- muR-dependent fac is reweighted here
3555- call sreal_deg(p1_cnt(0,1,2),zero,one,
3556- # deg_xi_sc,deg_lxi_sc)
3557- deg_wgt=deg_wgt-( deg_xi_sc+deg_lxi_sc*log(xi_i_fks_cnt(ione)) )*
3558- # jac_cnt(2)*prefact_deg*rwgt/(shat/(32*pi**2))*
3559- # xlum_sc * rwgt_muR_dep_fac(scale)
3560-com-- muR-dependent fac is reweighted here
3561- deg_swgt=deg_swgt-( deg_xi_sc*prefact_deg_sxi +
3562- # deg_lxi_sc*prefact_deg_slxi )*
3563- # jac_cnt(2)*rwgt/(shat/(32*pi**2))*
3564- # xlum_sc * rwgt_muR_dep_fac(scale)
3565-com-- muR-dependent fac is reweighted here
3566- if(iplot.ne.0)iplot=2
3567- if(doreweight)then
3568- call reweight_fillkin(pp,ifour)
3569- ifill4=1
3570- wgtwreal(4)=xsec*(prefact_c+prefact_coll+
3571- # prefact_cnt_ssc_c+prefact_coll_c)*rwgt/
3572- # g**(nint(2*wgtbpower+2.d0))
3573- wgtwdeg(4)=(
3574- # -( wgtdegrem_xi+wgtdegrem_lxi*log(xi_i_fks_cnt(ione)) )*prefact_deg
3575- # -( wgtdegrem_xi*prefact_deg_sxi+wgtdegrem_lxi*prefact_deg_slxi ) )*
3576- # jac_cnt(2)*rwgt/(shat/(32*pi**2))/
3577- # g**(nint(2*wgtbpower+2.d0))
3578- wgtwdegmuf(4)=
3579- # -wgtdegrem_muF*( prefact_deg+prefact_deg_sxi )*
3580- # jac_cnt(2)*rwgt/(shat/(32*pi**2))/
3581- # g**(nint(2*wgtbpower+2.d0))
3582- endif
3583- endif
3584- endif
3585- 547 continue
3586-c
3587- call cpu_time(tAfter)
3588- tDSigI=tDSigI + (tAfter-tBefore) - (tPDF-deltaTPDF) -
3589- & (tFastJet-deltaTFJ) - (tOLP-deltaTOLP)
3590-c
3591-c Enhance the one channel for multi-channel integration
3592-c
3593- enhance=1.d0
3594- if ((ev_wgt.ne.0d0 .or. cnt_wgt_c.ne.0d0 .or. cnt_wgt_s.ne.0d0
3595- $ .or.cnt_wgt_sc.ne.0d0 .or. bsv_wgt.ne.0d0 .or.
3596- $ virt_wgt.ne.0d0 .or. deg_wgt.ne.0d0 .or.deg_swgt.ne.0d0 .or.
3597- $ cnt_swgt_s.ne.0d0 .or. cnt_swgt_sc.ne.0d0).and.
3598- $ multi_channel) then
3599- if (bsv_wgt.eq.0d0 .and. virt_wgt.eq.0d0 .and. deg_wgt.eq.0d0
3600- $ .and. deg_swgt.eq.0d0 .and. cnt_wgt_c.eq.0d0 )
3601- $ CalculatedBorn=.false.
3602- if (.not.calculatedBorn .and. p_born(0,1).gt.0d0)then
3603- call sborn(p_born,wgt1)
3604- elseif(p_born(0,1).lt.0d0)then
3605- enhance=0d0
3606- endif
3607-
3608- if (enhance.eq.0d0)then
3609- xnoborn_cnt=xnoborn_cnt+1.d0
3610- if(log10(xnoborn_cnt).gt.inoborn_cnt)then
3611- write (*,*)
3612- # 'Function dsig: no Born momenta more than 10**',
3613- # inoborn_cnt,'times'
3614- inoborn_cnt=inoborn_cnt+1
3615- endif
3616- else
3617- xtot=0d0
3618- if (mapconfig(0).eq.0) then
3619- write (*,*) 'Fatal error in dsig, no Born diagrams '
3620- & ,mapconfig,'. Check bornfromreal.inc'
3621- write (*,*) 'Is fks_singular compiled correctly?'
3622- stop
3623- endif
3624- do i=1, mapconfig(0)
3625- xtot=xtot+amp2(mapconfig(i))
3626- enddo
3627- if (xtot.ne.0d0) then
3628- enhance=amp2(mapconfig(iconfig))/xtot
3629- enhance=enhance*diagramsymmetryfactor
3630- else
3631- enhance=0d0
3632- endif
3633- endif
3634- endif
3635-
3636- cnt_wgt = cnt_wgt_c + cnt_wgt_s + cnt_wgt_sc
3637- cnt_swgt = cnt_swgt_s + cnt_swgt_sc
3638-
3639-c Apply the FxFx Sudakov damping on the H events
3640- if (ev_wgt.ne.0d0 .and. ickkw.eq.3..and.
3641- $ .not.rewgt_mohdr_calculated) then
3642- write (*,*) 'Error rewgt_mohdr_calculated'
3643- stop
3644- elseif(rewgt_mohdr_calculated) then
3645- if (rewgt_mohdr.gt.1d0) rewgt_mohdr=1d0
3646- enhanceH=enhance*rewgt_mohdr
3647- else
3648- enhanceH=enhance
3649- endif
3650-
3651- ev_wgt = ev_wgt * enhanceH
3652-
3653-c Apply the FxFx Sudakov damping on the S events
3654- if(.not.(cnt_wgt.eq.0d0 .and. cnt_swgt.eq.0d0 .and. bsv_wgt.eq.0d0
3655- $ .and. born_wgt.eq.0d0 .and. deg_wgt.eq.0d0 .and.
3656- $ deg_swgt.eq.0d0 )
3657- $ .and. ickkw.eq.3 .and. .not.rewgt_izero_calculated) then
3658- write (*,*) 'Error rewgt_izero_calculated'
3659- stop
3660- elseif(rewgt_izero_calculated) then
3661- if (rewgt_izero.gt.1d0) rewgt_izero=1d0
3662- enhanceS=enhance*rewgt_izero
3663- else
3664- enhanceS=enhance
3665- endif
3666-
3667- cnt_wgt = cnt_wgt * enhanceS
3668- cnt_swgt = cnt_swgt * enhanceS
3669- bsv_wgt = bsv_wgt * enhanceS
3670- virt_wgt = virt_wgt * enhanceS
3671- born_wgt = born_wgt * enhanceS
3672- born_wgt_ao2pi = born_wgt_ao2pi * enhanceS
3673- deg_wgt = deg_wgt * enhanceS
3674- deg_swgt = deg_swgt * enhanceS
3675-
3676- if(iminmax.eq.0) then
3677- dsig = (ev_wgt+cnt_wgt)*fkssymmetryfactor +
3678- & cnt_swgt*fkssymmetryfactor +
3679- & bsv_wgt*fkssymmetryfactorBorn +
3680- & virt_wgt*fkssymmetryfactorBorn +
3681- & deg_wgt*fkssymmetryfactorDeg +
3682- & deg_swgt*fkssymmetryfactorDeg
3683-
3684- if (dsig.ne.dsig) then
3685- write (*,*) 'ERROR #51 in dsig:',dsig,'skipping event'
3686- dsig=0d0
3687- return
3688- endif
3689-
3690- total_wgt_sum=total_wgt_sum+dsig*vegaswgt
3691- central_wgt_saved=dsig
3692-
3693- call unweight_function(p_born,unwgtfun)
3694- dsig=dsig*unwgtfun
3695- virt_wgt=virt_wgt*unwgtfun*fkssymmetryfactorBorn*vegaswgt
3696- born_wgt_ao2pi=born_wgt_ao2pi*unwgtfun*fkssymmetryfactorBorn
3697- $ *vegaswgt
3698- if(doreweight)then
3699- if(ifill2.eq.0.and.(ifill3.ne.0.or.ifill4.ne.0))then
3700- write(*,*)'Error #2[wg] in dsig',ifill2,ifill3,ifill4
3701- stop
3702- endif
3703- wgtref = dsig
3704- xsec = enhanceS*unwgtfun
3705- do i=1,4
3706- if (i.eq.1) then
3707- wgtwreal(i)=wgtwreal(i) * xsec*fkssymmetryfactor
3708- $ *enhanceH/enhanceS
3709- else
3710- wgtwreal(i)=wgtwreal(i) * xsec*fkssymmetryfactor
3711- endif
3712- wgtwdeg(i)=wgtwdeg(i) * xsec*fkssymmetryfactorDeg
3713- wgtwdegmuf(i)=wgtwdegmuf(i) * xsec*fkssymmetryfactorDeg
3714- if(i.eq.2)then
3715- wgtwborn(i)=wgtwborn(i) * xsec*fkssymmetryfactorBorn
3716- wgtwns(i)=wgtwns(i) * xsec*fkssymmetryfactorBorn
3717- wgtwnsmuf(i)=wgtwnsmuf(i) * xsec*fkssymmetryfactorBorn
3718- wgtwnsmur(i)=wgtwnsmur(i) * xsec*fkssymmetryfactorBorn
3719- endif
3720- enddo
3721- call reweight_fill_extra()
3722- if(check_reweight.and.doreweight)
3723- # call check_rwgt_wgt("NLO")
3724- if(do_rwgt_scale.or.do_rwgt_pdf)call fill_rwgt_NLOplot()
3725-c Example of reweighted cross section (scale changed)
3726-c dsig_new=compute_rwgt_wgt_NLO(new_muR_fact,new_muF1_fact,
3727-c # new_muF2_fact,new_QES_fact,
3728-c # iwgtinfo)
3729- endif
3730-
3731-c For tests
3732- if(abs(dsig).gt.fksmaxwgt)then
3733- fksmaxwgt=abs(dsig)
3734- xisave=xi_i_fks_ev
3735- ysave=y_ij_fks_ev
3736- endif
3737-
3738-c Plot observables for event
3739- plot_wgt=ev_wgt*fkssymmetryfactor*vegaswgt
3740- if(abs(plot_wgt).gt.1.d-20.and.pp(0,1).ne.-99d0)
3741- & call outfun(pp,ybst_til_tolab,plot_wgt,iplot_ev)
3742-c Plot observables for counterevents and Born
3743- plot_wgt=( cnt_wgt*fkssymmetryfactor +
3744- & cnt_swgt*fkssymmetryfactor +
3745- & (bsv_wgt-born_wgt)*fkssymmetryfactorBorn +
3746- & deg_wgt*fkssymmetryfactorDeg +
3747- & deg_swgt*fkssymmetryfactorDeg )*vegaswgt +
3748- & virt_wgt/unwgtfun
3749- if(abs(plot_wgt).gt.1.d-20) then
3750- if(iplot.eq.-3)then
3751- write(*,*)'Error #1 in dsig'
3752- stop
3753- elseif (p1_cnt(0,1,iplot).ne.-99d0)then
3754- call outfun(p1_cnt(0,1,iplot),ybst_til_tolab,plot_wgt,
3755- & iplot_cnt)
3756- endif
3757- endif
3758-c Plot observables for Born; pass cnt momenta assuming they are
3759-c identical to Born ones
3760- plot_wgt=born_wgt*fkssymmetryfactorBorn*vegaswgt
3761- if(abs(plot_wgt).gt.1.d-20) then
3762- if(iplot.eq.-3)then
3763- write(*,*)'Error #1 in dsig'
3764- stop
3765- elseif (p1_cnt(0,1,iplot).ne.-99d0)then
3766- call outfun(p1_cnt(0,1,iplot),ybst_til_tolab,plot_wgt,
3767- & iplot_born)
3768- endif
3769- endif
3770- elseif (iminmax.eq.1 .and. ExceptPSpoint) then
3771-c for except PS points, this is the maximal approx for the virtual
3772- call unweight_function(p_born,unwgtfun)
3773- dsig_max = ((ev_wgt+cnt_wgt)*fkssymmetryfactor +
3774- & cnt_swgt*fkssymmetryfactor +
3775- & bsv_wgt*fkssymmetryfactorBorn +
3776- & deg_wgt*fkssymmetryfactorDeg +
3777- & deg_swgt*fkssymmetryfactorDeg)*unwgtfun+virt_wgt
3778- total_wgt_sum_max=total_wgt_sum_max+
3779- & ((dsig_max - central_wgt_saved)*vegaswgt)**2
3780-
3781- elseif (iminmax.eq.2 .and. ExceptPSpoint) then
3782-c for except PS points, this is the minimal approx for the virtual
3783- call unweight_function(p_born,unwgtfun)
3784- dsig_min = ((ev_wgt+cnt_wgt)*fkssymmetryfactor +
3785- & cnt_swgt*fkssymmetryfactor +
3786- & bsv_wgt*fkssymmetryfactorBorn +
3787- & deg_wgt*fkssymmetryfactorDeg +
3788- & deg_swgt*fkssymmetryfactorDeg)*unwgtfun+virt_wgt
3789- total_wgt_sum_min=total_wgt_sum_min+
3790- & ((central_wgt_saved - dsig_min)*vegaswgt)**2
3791- else
3792- write (*,*) 'Error #12 in dsig',iminmax
3793- stop
3794- endif
3795-
3796-c If exceptional PS point found, go back to beginning recompute
3797-c the weight for this PS point using an approximation
3798-c based on previous PS points (done in BinothLHA.f)
3799- if (ExceptPSpoint .and. iminmax.le.1) goto 44
3800-
3801- return
3802- end
3803-
3804
3805 subroutine dsigF(pp,wgt,vegaswgt,dsigS,dsigH)
3806 c Here are the subtraction terms, the Sij function,
3807@@ -1220,6 +1657,8 @@
3808 double precision ximin
3809 parameter(ximin=0.05d0)
3810
3811+ double precision virtual_over_born
3812+ common/c_vob/virtual_over_born
3813 c
3814 c This is the table that will be used to unweight. (It contains for
3815 c arguments, 1st argument: nFKSproces; 2nd argument: S or H events; 3rd
3816@@ -1233,7 +1672,7 @@
3817 DOUBLE PRECISION CONV
3818 PARAMETER (CONV=389379660d0) !CONV TO PICOBARNS
3819 integer i_process
3820- common/c_addwrite/i_process
3821+ common/c_i_process/i_process
3822 integer iproc_save(fks_configs),eto(maxproc,fks_configs)
3823 $ ,etoi(maxproc,fks_configs),maxproc_found
3824 common/cproc_combination/iproc_save,eto,etoi,maxproc_found
3825@@ -1401,8 +1840,16 @@
3826 # 1/(2.d0*deltaS)
3827 endif
3828 endif
3829-c
3830- probne=1.d0
3831+
3832+c For UNLOPS all real-emission contributions need to be added to the
3833+c S-events. Do this by setting probne to 0. For UNLOPS, no MC counter
3834+c events are called, so this will remain 0.
3835+ if (ickkw.eq.4) then
3836+ probne=0d0
3837+ else
3838+ probne=1.d0
3839+ endif
3840+
3841 c All counterevent have the same final-state kinematics. Check that
3842 c one of them passes the hard cuts, and they exist at all
3843 c
3844@@ -1995,15 +2442,8 @@
3845 unwgt_table(nFKSprocess,1,j)=unwgt_table(nFKSprocess,1,j)
3846 & +PD(j)*xsec*(1-probne)*CONV * rwgt_muR_dep_fac(scale)
3847 com-- muR-dependent fac is reweighted here
3848- if (ickkw.ne.4) then
3849- unwgt_table(nFKSprocess,2,j)=unwgt_table(nFKSprocess,2,j)
3850- & +PD(j)*xsec*probne*CONV * rwgt_muR_dep_fac(scale)
3851-com-- muR-dependent fac is reweighted here
3852- else ! for UNLOPS, add the H-events to the S-events
3853- unwgt_table(nFKSprocess,1,j)=unwgt_table(nFKSprocess,1,j)
3854- & +PD(j)*xsec*probne*CONV * rwgt_muR_dep_fac(scale)
3855-com-- muR-dependent fac is reweighted here
3856- endif
3857+ unwgt_table(nFKSprocess,2,j)=unwgt_table(nFKSprocess,2,j)
3858+ & +PD(j)*xsec*probne*CONV * rwgt_muR_dep_fac(scale)
3859 enddo
3860 if(doreweight)then
3861 if(ifill1H.eq.0)then
3862@@ -2164,11 +2604,6 @@
3863 & deg_wgt*fkssymmetryfactorDeg +
3864 & deg_swgt*fkssymmetryfactorDeg
3865
3866-c Add the H-events to the S-events for UNLOPS
3867- if (ickkw.eq.4) then
3868- dsigS=dsigS+totH_wgt*fkssymmetryfactor
3869- endif
3870-
3871 call unweight_function(p_born,unwgtfun)
3872 dsigS=dsigS*unwgtfun
3873
3874@@ -2183,6 +2618,7 @@
3875 unwgt_table(0,1,j)=0d0
3876 unwgt_table(0,3,j)=0d0
3877 unwgt_table(1,3,j)=0d0
3878+ virtual_over_born=0d0
3879 endif
3880 enddo
3881 endif
3882@@ -2283,7 +2719,7 @@
3883 & ,nFKSprocess*2-1) * xsec*fkssymmetryfactor
3884 enddo
3885 endif
3886- if(check_reweight.and.doreweight .and. ickkw.ne.4) then
3887+ if(check_reweight.and.doreweight) then
3888 do i_process=1,iproc_save(nFKSprocess)
3889 if (nbody) then
3890 call fill_reweight0inc_nbody(i_process)
3891@@ -2309,25 +2745,6 @@
3892 xisave=xi_i_fks_ev
3893 ysave=y_ij_fks_ev
3894 endif
3895-c Plot observables for counterevents and Born
3896- if (.not.unwgt) then
3897- plot_wgt=( (Sev_wgt+Sxmc_wgt+cnt_wgt)*fkssymmetryfactor +
3898- & cnt_swgt*fkssymmetryfactor +
3899- & (bsv_wgt-born_wgt)*fkssymmetryfactorBorn +
3900- & virt_wgt*fkssymmetryfactorBorn +
3901- & deg_wgt*fkssymmetryfactorDeg +
3902- & deg_swgt*fkssymmetryfactorDeg )*vegaswgt
3903- if( abs(plot_wgt).gt.1.d-20.and.p1_cnt(0,1,0).ne.-99d0 .and.
3904- & (plotEv.or.plotKin) )
3905- & call outfun(p1_cnt(0,1,0),ybst_til_tolab,plot_wgt,iplot_cnt)
3906- plot_wgt=(born_wgt*fkssymmetryfactorBorn)*vegaswgt
3907- if( abs(plot_wgt).gt.1.d-20.and.p1_cnt(0,1,0).ne.-99d0 .and.
3908- & (plotEv.or.plotKin) )
3909- & call outfun(p1_cnt(0,1,0),ybst_til_tolab,plot_wgt,iplot_born)
3910- endif
3911-
3912-c For UNLOPS, the H-events are already added to the S-events
3913- if (ickkw.eq.4) return
3914
3915 dsigH = totH_wgt*fkssymmetryfactor
3916 call unweight_function(p_born,unwgtfun)
3917@@ -2341,7 +2758,7 @@
3918 do j=1,iproc_save(nFKSprocess)
3919 unwgt_table(nFKSprocess,2,j)=0d0
3920 enddo
3921- endif
3922+ endif
3923 endif
3924
3925 if (nbody.and.dsigH.ne.0d0) then
3926@@ -2419,15 +2836,6 @@
3927 ysave=y_ij_fks_ev
3928 endif
3929
3930-c Plot observables for event
3931- if (.not.unwgt) then
3932- plot_wgt=totH_wgt*fkssymmetryfactor*vegaswgt
3933- if( abs(plot_wgt).gt.1.d-20.and.pp(0,1).ne.-99d0. and.
3934- & (plotEv.or.plotKin) )
3935- & call outfun(pp,ybst_til_tolab,plot_wgt,iplot_ev)
3936- endif
3937-
3938-
3939 elseif (iminmax.eq.1 .and. ExceptPSpoint) then
3940 c for except PS points, this is the maximal approx for the virtual
3941 call unweight_function(p_born,unwgtfun)
3942@@ -3426,11 +3834,9 @@
3943 c Do not include this contribution for final-state branchings
3944 collrem_xi=0.d0
3945 collrem_lxi=0.d0
3946- if(doreweight)then
3947- wgtdegrem_xi=0.d0
3948- wgtdegrem_lxi=0.d0
3949- wgtdegrem_muF=0.d0
3950- endif
3951+ wgtdegrem_xi=0.d0
3952+ wgtdegrem_lxi=0.d0
3953+ wgtdegrem_muF=0.d0
3954 return
3955 endif
3956
3957@@ -3439,11 +3845,9 @@
3958 write (*,*) "No born momenta in sreal_deg"
3959 collrem_xi=0.d0
3960 collrem_lxi=0.d0
3961- if(doreweight)then
3962- wgtdegrem_xi=0.d0
3963- wgtdegrem_lxi=0.d0
3964- wgtdegrem_muF=0.d0
3965- endif
3966+ wgtdegrem_xi=0.d0
3967+ wgtdegrem_lxi=0.d0
3968+ wgtdegrem_muF=0.d0
3969 return
3970 endif
3971
3972@@ -3483,13 +3887,11 @@
3973 collrem_xi=oo2pi * born_wgt * collrem_xi * xnorm
3974 collrem_lxi=oo2pi * born_wgt * collrem_lxi * xnorm
3975
3976- if(doreweight)then
3977- wgtdegrem_xi=ap*log(shat*delta_used/(2*QES2)) -
3978+ wgtdegrem_xi=ap*log(shat*delta_used/(2*QES2)) -
3979 # apprime - xkkern
3980- wgtdegrem_xi=oo2pi * born_wgt * wgtdegrem_xi * xnorm
3981- wgtdegrem_lxi=collrem_lxi
3982- wgtdegrem_muF= - oo2pi * born_wgt * ap * xnorm
3983- endif
3984+ wgtdegrem_xi=oo2pi * born_wgt * wgtdegrem_xi * xnorm
3985+ wgtdegrem_lxi=collrem_lxi
3986+ wgtdegrem_muF= - oo2pi * born_wgt * ap * xnorm
3987
3988 return
3989 end
3990@@ -4572,39 +4974,36 @@
3991
3992 549 continue
3993
3994- if(doreweight)then
3995- wgtwnstmpmuf=0.d0
3996- if(abrv.ne.'born' .and. abrv.ne.'grid')then
3997- if(abrv(1:2).eq.'vi')then
3998+ wgtwnstmpmuf=0.d0
3999+ if(abrv.ne.'born' .and. abrv.ne.'grid')then
4000+ if(abrv(1:2).eq.'vi')then
4001 wgtwnstmpmur=0.d0
4002- else
4003+ else
4004 do i=1,nincoming
4005- if (particle_type(i).ne.1)then
4006- if (particle_type(i).eq.8) then
4007- aj=0
4008- elseif(abs(particle_type(i)).eq.3) then
4009- aj=1
4010- endif
4011- wgtwnstmpmuf=wgtwnstmpmuf-
4012+ if (particle_type(i).ne.1)then
4013+ if (particle_type(i).eq.8) then
4014+ aj=0
4015+ elseif(abs(particle_type(i)).eq.3) then
4016+ aj=1
4017+ endif
4018+ wgtwnstmpmuf=wgtwnstmpmuf-
4019 # ( gamma(aj)+2d0*c(aj)*dlog(xicut_used) )
4020- endif
4021+ endif
4022 enddo
4023 wgtwnstmpmuf=ao2pi*wgtwnstmpmuf*dble(wgt1(1))
4024 wgtwnstmpmur=2*pi*(beta0*wgtbpower
4025- # +ren_group_coeff*wgtcpower)*ao2pi*dble(wgt1(1))
4026- endif
4027+ # +ren_group_coeff*wgtcpower)*ao2pi*dble(wgt1(1))
4028+ endif
4029 c bsv_wgt here always contains the Born; must subtract it, since
4030 c we need the pure NLO terms only
4031- wgtnstmp=bsv_wgt+virt_wgt-born_wgt-
4032+ wgtnstmp=bsv_wgt+virt_wgt-born_wgt-
4033 # wgtwnstmpmuf*log(q2fact(1)/QES2)-
4034 # wgtwnstmpmur*log(scale**2/QES2)
4035- else
4036- wgtnstmp=0d0
4037- wgtwnstmpmur=0.d0
4038- endif
4039+ else
4040+ wgtnstmp=0d0
4041+ wgtwnstmpmur=0.d0
4042 endif
4043
4044-
4045 if (abrv(1:2).eq.'vi') then
4046 bsv_wgt=bsv_wgt-born_wgt
4047
4048
4049=== modified file 'Template/NLO/SubProcesses/genps_fks.f'
4050--- Template/NLO/SubProcesses/genps_fks.f 2014-03-17 09:43:37 +0000
4051+++ Template/NLO/SubProcesses/genps_fks.f 2015-02-04 13:27:21 +0000
4052@@ -93,6 +93,8 @@
4053 common/counterevnts/p1_cnt,wgt_cnt,pswgt_cnt,jac_cnt
4054 double precision p_born(0:3,nexternal-1)
4055 common/pborn/p_born
4056+ double precision p_ev(0:3,nexternal)
4057+ common/pev/p_ev
4058 double precision xi_i_fks_ev,y_ij_fks_ev
4059 double precision p_i_fks_ev(0:3),p_i_fks_cnt(0:3,-2:2)
4060 common/fksvariables/xi_i_fks_ev,y_ij_fks_ev,p_i_fks_ev,p_i_fks_cnt
4061@@ -267,7 +269,12 @@
4062 else
4063 c No PDFs (also use fixed energy when performing tests)
4064 call compute_tau_y_epem(j_fks,one_body,fksmass,stot,
4065- & tau_born,ycm_born,ycmhat)
4066+ & tau_born,ycm_born,ycmhat)
4067+ if (j_fks.le.nincoming .and. .not.(softtest.or.colltest)) then
4068+ write (*,*) 'Process has incoming j_fks, but fixed shat: '/
4069+ & /'not allowed for processes generated at NLO.'
4070+ stop 1
4071+ endif
4072 endif
4073 c Compute Bjorken x's from tau and y
4074 xbjrk_born(1)=sqrt(tau_born)*exp(ycm_born)
4075@@ -523,6 +530,7 @@
4076 do i=1,nexternal
4077 do j=0,3
4078 p(j,i)=xp(j,i)
4079+ p_ev(j,i)=xp(j,i)
4080 enddo
4081 enddo
4082 jac=xjac
4083
4084=== modified file 'Template/NLO/SubProcesses/handling_lhe_events.f'
4085--- Template/NLO/SubProcesses/handling_lhe_events.f 2014-10-31 07:52:06 +0000
4086+++ Template/NLO/SubProcesses/handling_lhe_events.f 2015-02-04 13:27:21 +0000
4087@@ -483,7 +483,7 @@
4088 integer event_id
4089 common /c_event_id/ event_id
4090 integer i_process
4091- common/c_addwrite/i_process
4092+ common/c_i_process/i_process
4093 integer nattr,npNLO,npLO
4094 common/event_attributes/nattr,npNLO,npLO
4095 include 'reweight_all.inc'
4096@@ -616,9 +616,6 @@
4097 do i=1,mexternal
4098 write(ifile,405)(wgtkin_all(j,i,1,iFKS),j=0,3)
4099 enddo
4100-c$$$ do i=1,mexternal
4101-c$$$ write(ifile,405)(wgtkin_all(j,i,2,iFKS),j=0,3)
4102-c$$$ enddo
4103 write(ifile,402)
4104 & wgtxbj_all(1,1,iFKS),wgtxbj_all(2,1,iFKS),
4105 & wgtxbj_all(1,2,iFKS),wgtxbj_all(2,2,iFKS),
4106@@ -746,7 +743,7 @@
4107 integer ii,j,nps,nng,iFKS,idwgt
4108 double precision wgtcentral,wgtmumin,wgtmumax,wgtpdfmin,wgtpdfmax
4109 integer i_process
4110- common/c_addwrite/i_process
4111+ common/c_i_process/i_process
4112 integer nattr,npNLO,npLO
4113 common/event_attributes/nattr,npNLO,npLO
4114 include 'reweight_all.inc'
4115@@ -976,7 +973,7 @@
4116 integer ii,j,nps,nng,iFKS,idwgt
4117 double precision wgtcentral,wgtmumin,wgtmumax,wgtpdfmin,wgtpdfmax
4118 integer i_process
4119- common/c_addwrite/i_process
4120+ common/c_i_process/i_process
4121 integer nattr,npNLO,npLO
4122 common/event_attributes/nattr,npNLO,npLO
4123 include 'reweight_all.inc'
4124
4125=== modified file 'Template/NLO/SubProcesses/madfks_plot.f'
4126--- Template/NLO/SubProcesses/madfks_plot.f 2014-06-27 12:41:14 +0000
4127+++ Template/NLO/SubProcesses/madfks_plot.f 2015-02-04 13:27:21 +0000
4128@@ -131,7 +131,7 @@
4129 end
4130
4131
4132- subroutine outfun(pp,ybst_til_tolab,www,itype)
4133+ subroutine outfun(pp,ybst_til_tolab,www,iPDG,itype)
4134 C
4135 C *WARNING**WARNING**WARNING**WARNING**WARNING**WARNING**WARNING**WARNING*
4136 C
4137@@ -156,11 +156,11 @@
4138 include 'genps.inc'
4139 include 'reweight.inc'
4140 include 'reweightNLO.inc'
4141- double precision pp(0:3,nexternal),ybst_til_tolab,www
4142+ double precision pp(0:3,nexternal),ybst_til_tolab
4143 integer itype
4144 double precision p(0:4,nexternal),pplab(0:3,nexternal),chybst
4145 $ ,shybst,chybstmo
4146- integer i,j,ibody
4147+ integer i,j,ibody,i_wgt
4148 double precision xd(3)
4149 data (xd(i),i=1,3) /0d0,0d0,1d0/
4150 integer istatus(nexternal),iPDG(nexternal)
4151@@ -173,7 +173,7 @@
4152 common /c_leshouche_inc/idup,mothup,icolup
4153 integer nwgt,max_weight
4154 parameter (max_weight=maxscales*maxscales+maxpdfs+1)
4155- double precision wgts(max_weight),wgtden,ratio
4156+ double precision www(max_weight),wgtden,ratio
4157 double precision xsecScale_acc(maxscales,maxscales)
4158 $ ,xsecPDFr_acc(0:maxPDFs)
4159 common /scale_pdf_print/xsecScale_acc,xsecPDFr_acc
4160@@ -183,13 +183,10 @@
4161 c Born, n-body or (n+1)-body contribution:
4162 if(itype.eq.11) then
4163 ibody=1 ! (n+1)-body
4164- wgtden=wgtrefNLO11
4165 elseif(itype.eq.12)then
4166 ibody=2 ! n-body
4167- wgtden=wgtrefNLO12
4168 elseif(itype.eq.20)then
4169 ibody=3 ! Born
4170- wgtden=wgtrefNLO20
4171 else
4172 write(*,*)'Error in outfun: unknown itype',itype
4173 stop
4174@@ -199,8 +196,7 @@
4175 shybst=sinh(ybst_til_tolab)
4176 chybstmo=chybst-1.d0
4177 do i=3,nexternal
4178- call boostwdir2(chybst,shybst,chybstmo,xd,
4179- # pp(0,i),pplab(0,i))
4180+ call boostwdir2(chybst,shybst,chybstmo,xd,pp(0,i),pplab(0,i))
4181 enddo
4182 c Fill the arrays (momenta, status and PDG):
4183 do i=1,nexternal
4184@@ -213,57 +209,27 @@
4185 p(j,i)=pplab(j,i)
4186 enddo
4187 p(4,i)=pmass(i)
4188- ipdg(i)=idup(i,1)
4189 enddo
4190-c The weights comming from reweighting:
4191- nwgt=1
4192- wgts(1)=www
4193- if (wgtden.eq.0d0) then
4194- if (www.eq.0d0) then
4195- ratio=0d0
4196- else
4197- if (doreweight) then
4198- write (*,*) 'ERROR in madfks_plot.f', wgtden,www
4199- else
4200- ratio=1d0
4201- endif
4202- endif
4203- else
4204-c this ratio should essentially be the weight from vegas
4205- ratio=www/wgtden
4206- endif
4207- if (do_rwgt_scale) then
4208- do i=1,numscales
4209- do j=1,numscales
4210- nwgt=nwgt+1
4211- wgts(nwgt)=wgtNLOxsecmu(ibody,i,j)*ratio
4212- enddo
4213- enddo
4214- endif
4215- if (do_rwgt_pdf) then
4216- do i=1,numPDFs-1 ! exclude the central set, so 'numPDFs-1'
4217- nwgt=nwgt+1
4218- wgts(nwgt)=wgtNLOxsecPDF(ibody,i)*ratio
4219- enddo
4220- endif
4221 if(iappl.ne.0)then
4222 appl_itype = ibody
4223- appl_www_histo = wgts(1)
4224+ appl_www_histo = www(1)
4225 endif
4226- call analysis_fill(p,istatus,ipdg,wgts,ibody)
4227+ call analysis_fill(p,istatus,ipdg,www,ibody)
4228 c Fill the accumulated results
4229+ i_wgt=1
4230 if (do_rwgt_scale) then
4231 do i=1,numscales
4232 do j=1,numscales
4233- xsecScale_acc(i,j)=xsecScale_acc(i,j)+
4234- & wgtNLOxsecmu(ibody,i,j)*ratio
4235+ i_wgt=i_wgt+1
4236+ xsecScale_acc(i,j)=xsecScale_acc(i,j)+www(i_wgt)
4237 enddo
4238 enddo
4239 endif
4240 if (do_rwgt_pdf) then
4241- xsecPDFr_acc(0)=xsecPDFr_acc(0)+www
4242+ xsecPDFr_acc(0)=xsecPDFr_acc(0)+www(1)
4243 do i=1,numPDFs-1
4244- xsecPDFr_acc(i)=xsecPDFr_acc(i)+wgtNLOxsecPDF(ibody,i)*ratio
4245+ i_wgt=i_wgt+1
4246+ xsecPDFr_acc(i)=xsecPDFr_acc(i)+www(i_wgt)
4247 enddo
4248 endif
4249 999 return
4250
4251=== modified file 'Template/NLO/SubProcesses/reweight_xsec.f'
4252--- Template/NLO/SubProcesses/reweight_xsec.f 2014-09-24 17:48:39 +0000
4253+++ Template/NLO/SubProcesses/reweight_xsec.f 2015-02-04 13:27:21 +0000
4254@@ -975,7 +975,7 @@
4255 DOUBLE PRECISION CONV
4256 PARAMETER (CONV=389379660D0) !CONV TO PICOBARNS
4257 integer i_process
4258- common/c_addwrite/i_process
4259+ common/c_i_process/i_process
4260
4261 INTEGER NFKSPROCESS
4262 COMMON/C_NFKSPROCESS/NFKSPROCESS
4263@@ -1206,7 +1206,7 @@
4264 DOUBLE PRECISION CONV
4265 PARAMETER (CONV=389379660D0) !CONV TO PICOBARNS
4266 integer i_process
4267- common/c_addwrite/i_process
4268+ common/c_i_process/i_process
4269
4270 INTEGER NFKSPROCESS
4271 COMMON/C_NFKSPROCESS/NFKSPROCESS
4272@@ -1511,7 +1511,7 @@
4273 DOUBLE PRECISION CONV
4274 PARAMETER (CONV=389379660D0) !CONV TO PICOBARNS
4275 integer i_process
4276- common/c_addwrite/i_process
4277+ common/c_i_process/i_process
4278
4279 INTEGER NFKSPROCESS
4280 COMMON/C_NFKSPROCESS/NFKSPROCESS
4281
4282=== modified file 'Template/NLO/SubProcesses/reweight_xsec_events.f'
4283--- Template/NLO/SubProcesses/reweight_xsec_events.f 2014-05-13 07:36:22 +0000
4284+++ Template/NLO/SubProcesses/reweight_xsec_events.f 2015-02-04 13:27:21 +0000
4285@@ -49,7 +49,7 @@
4286 external compute_rwgt_wgt_Sev,compute_rwgt_wgt_Sev_nbody
4287 & ,compute_rwgt_wgt_Hev
4288 integer i_process
4289- common/c_addwrite/i_process
4290+ common/c_i_process/i_process
4291 c
4292 call setrun !Sets up run parameters
4293
4294
4295=== modified file 'Template/NLO/SubProcesses/setcuts.f'
4296--- Template/NLO/SubProcesses/setcuts.f 2014-09-02 12:20:56 +0000
4297+++ Template/NLO/SubProcesses/setcuts.f 2015-02-04 13:27:21 +0000
4298@@ -489,6 +489,7 @@
4299 sum_all_s=0d0
4300 do i=t_channel,-(nexternal-3),-1
4301 c Breit-wigner can never go on-shell:
4302+ if (itree(2,i).gt.0) cycle
4303 if ( pmass(itree(2,i),iconfig).gt.sqrt(stot) .and.
4304 $ pwidth(itree(2,i),iconfig).gt.0d0) then
4305 cBW_FKS(iFKS,itree(2,i))=2
4306@@ -499,6 +500,7 @@
4307 if (sum_all_s.gt.sqrt(stot)) then
4308 c conflicting BWs: set all s-channels as conflicting
4309 do i=t_channel,-(nexternal-3),-1
4310+ if (itree(2,i).gt.0) cycle
4311 if (cBW_FKS(iFKS,itree(2,i)).ne.2) then
4312 cBW_FKS(iFKS,itree(2,i))=1
4313 cBW_FKS_mass(iFKS,itree(2,i),-1)=sqrt(stot)/2d0
4314
4315=== modified file 'Template/NLO/SubProcesses/timing_variables.inc'
4316--- Template/NLO/SubProcesses/timing_variables.inc 2013-12-20 07:28:29 +0000
4317+++ Template/NLO/SubProcesses/timing_variables.inc 2015-02-04 13:27:21 +0000
4318@@ -1,5 +1,10 @@
4319+* -*-fortran-*-
4320+
4321 real tBefore, tAfter
4322- real tOLP, tFastJet, tPDF,
4323- & tGenPS, tDSigI, tDSigR
4324- common/timings/tOLP, tFastJet, tPDF,
4325- & tGenPS, tDSigI, tDSigR
4326+ real tOLP, tFastJet, tPDF, tGenPS, tDSigI, tDSigR
4327+ common/timings/tOLP, tFastJet, tPDF, tGenPS, tDSigI, tDSigR
4328+
4329+ real tBorn,tIS,tReal,tCount,tFxFx,tf_nb,tf_all,t_as,tr_s,tr_pdf
4330+ & ,t_plot,t_cuts
4331+ common/timings_fNLO/tBorn,tIS,tReal,tCount,tFxFx,tf_nb,tf_all,t_as
4332+ & ,tr_s,tr_pdf,t_plot,t_cuts
4333
4334=== modified file 'Template/NLO/SubProcesses/write_event.f'
4335--- Template/NLO/SubProcesses/write_event.f 2014-10-31 07:52:06 +0000
4336+++ Template/NLO/SubProcesses/write_event.f 2015-02-04 13:27:21 +0000
4337@@ -268,16 +268,7 @@
4338 write(*,*)doreweight,iwgtinfo
4339 stop
4340 endif
4341- if (ickkw.eq.4) then
4342- if (iwgtinfo.ne.5) then
4343- write (*,*)'if using ickkw=4, iwgtinfo should be 5'
4344- stop
4345- else
4346- kwgtinfo=15
4347- endif
4348- else
4349- kwgtinfo=iwgtinfo
4350- endif
4351+ kwgtinfo=iwgtinfo
4352 write(buff,201)'#aMCatNLO',iSorH_lhe,ifks_lhe(nFKSprocess)
4353 & ,jfks_lhe(nFKSprocess),fksfather_lhe(nFKSprocess)
4354 & ,ipartner_lhe(nFKSprocess),scale1_lhe(nFKSprocess)
4355
4356=== modified file 'UpdateNotes.txt'
4357--- UpdateNotes.txt 2014-11-06 16:26:15 +0000
4358+++ UpdateNotes.txt 2015-02-04 13:27:21 +0000
4359@@ -1,6 +1,29 @@
4360 Update notes for MadGraph5_aMC@NLO (in reverse time order)
4361
4362-2.2.2(06/11/14) OM: Correct a bug in the integration grid (introduces in 2.1.2). This was biasing the cross-section of
4363+<<<<<<< TREE
4364+2.2.2(06/11/14) OM: Correct a bug in the integration grid (introduces in 2.1.2). This was biasing the cross-section of
4365+=======
4366+2.2.3(XX/XX/XX) RF: If a NAN is found, the code now skips that PS point and continues.
4367+ OM: Fix a bug in MadWeight (correlated param_card was not creating the correct input file)
4368+ RF: For fNLO runs the virtuals were included twice in the setting of the integration grids.
4369+ RF: When requiring more than 1M events for (N)LO+PS runs, do not go to higher precision than 0.001
4370+ for the grids and cross section (can be overwritten with the req_acc run_card parameter).
4371+ RF: Make sure that reweight info (for PDF and scale uncertainties) also works for UNLOPS events.
4372+ RF: When setting the B's stable in the shower_card, also set the eta_b (PDG=551) stable.
4373+ OM: Change the Breit-Wigner splitting for the multi-channel integration, use the bwcutoff instead of
4374+ the hardcoded value 5.
4375+ RF: Re-factoring of the structure of the code for fNLO computations.
4376+ MZ: Fix to bug 1406000 (segfault appearing when doing FxFx merging). Thanks to Josh Bendavid for
4377+ having reported it
4378+ MZ: Fix to a bug occurring when generating event in the "split" mode: the required output was
4379+ not correctly specified
4380+ MZ: Fixes to different small bugs / improvement in the error and warning messages
4381+ OM: The built-in pdf "nn23lo" and "nn23lo1" where associate to the wrong lhapdfid in the lhe file
4382+ This was creating bias in using SysCalc. (Thanks Alexis)
4383+ OM: Fix a bug in the re-weighing which was removing the SysCalc weight from the lhe file (thanks Shin-Shan)
4384+
4385+2.2.2(06/11/14) OM: Correct a bug in the integration grid (introduces in 2.1.2). This was biasing the cross-section of
4386+>>>>>>> MERGE-SOURCE
4387 processes like a a > mu+ mu- in the Effective Photon Approximation by three order of magnitude.
4388 For LHC processes no sizeable effect have been observe so far.
4389 MZ: some informations for aMC@NLO runs which were before passed via include files are
4390
4391=== modified file 'aloha/aloha_writers.py'
4392--- aloha/aloha_writers.py 2014-09-08 11:03:40 +0000
4393+++ aloha/aloha_writers.py 2015-02-04 13:27:21 +0000
4394@@ -654,8 +654,10 @@
4395 """Formatting the variable name to Fortran format"""
4396
4397 if isinstance(name, aloha_lib.ExtVariable):
4398- # external parameter nothing to do
4399+ # external parameter nothing to do but handling model prefix
4400 self.has_model_parameter = True
4401+ if name.lower() in ['pi', 'as', 'mu_r', 'aewm1','g']:
4402+ return name
4403 return '%s%s' % (aloha.aloha_prefix, name)
4404
4405 if '_' in name:
4406@@ -727,8 +729,8 @@
4407 for name in keys:
4408 fct, objs = self.routine.fct[name]
4409
4410- format = ' %s = %s\n' % (name, self.get_fct_format(fct))
4411- try:
4412+ format = ' %s = %s\n' % (name, self.get_fct_format(fct))
4413+ try:
4414 text = format % ','.join([self.write_obj(obj) for obj in objs])
4415 except TypeError:
4416 text = format % tuple([self.write_obj(obj) for obj in objs])
4417@@ -1827,6 +1829,32 @@
4418 name = re.sub('(?P<var>\w*)_(?P<num>\d+)$', self.shift_indices , name)
4419
4420 return name
4421+
4422+ def get_fct_format(self, fct):
4423+ """Put the function in the correct format"""
4424+ if not hasattr(self, 'fct_format'):
4425+ one = self.change_number_format(1)
4426+ self.fct_format = {'csc' : '{0}/cmath.cos(%s)'.format(one),
4427+ 'sec': '{0}/cmath.sin(%s)'.format(one),
4428+ 'acsc': 'cmath.asin({0}/(%s))'.format(one),
4429+ 'asec': 'cmath.acos({0}/(%s))'.format(one),
4430+ 're': ' complex(%s).real',
4431+ 'im': 'complex(%s).imag',
4432+ 'cmath.sqrt': 'cmath.sqrt(%s)',
4433+ 'sqrt': 'cmath.sqrt(%s)',
4434+ 'pow': 'pow(%s, %s)',
4435+ 'complexconjugate': 'complex(%s).conjugate()',
4436+ '/' : '{0}/%s'.format(one),
4437+ 'abs': 'cmath.fabs(%s)'
4438+ }
4439+
4440+ if fct in self.fct_format:
4441+ return self.fct_format[fct]
4442+ elif hasattr(cmath, fct):
4443+ self.declaration.add(('fct', fct))
4444+ return 'cmath.{0}(%s)'.format(fct)
4445+ else:
4446+ raise Exception, "Unable to handle function name %s (no special rule defined and not in cmath)" % fct
4447
4448 def define_expression(self):
4449 """Define the functions in a 100% way """
4450@@ -1837,6 +1865,30 @@
4451 for name,obj in self.routine.contracted.items():
4452 out.write(' %s = %s\n' % (name, self.write_obj(obj)))
4453
4454+ def sort_fct(a, b):
4455+ if len(a) < len(b):
4456+ return -1
4457+ elif len(a) > len(b):
4458+ return 1
4459+ elif a < b:
4460+ return -1
4461+ else:
4462+ return +1
4463+
4464+ keys = self.routine.fct.keys()
4465+ keys.sort(sort_fct)
4466+ for name in keys:
4467+ fct, objs = self.routine.fct[name]
4468+ format = ' %s = %s\n' % (name, self.get_fct_format(fct))
4469+ try:
4470+ text = format % ','.join([self.write_obj(obj) for obj in objs])
4471+ except TypeError:
4472+ text = format % tuple([self.write_obj(obj) for obj in objs])
4473+ finally:
4474+ out.write(text)
4475+
4476+
4477+
4478 numerator = self.routine.expr
4479 if not 'Coup(1)' in self.routine.infostr:
4480 coup_name = 'COUP'
4481@@ -1892,7 +1944,7 @@
4482 name = self.name
4483
4484 out = StringIO()
4485-
4486+ out.write("import cmath\n")
4487 if self.mode == 'mg5':
4488 out.write('import aloha.template_files.wavefunctions as wavefunctions\n')
4489 else:
4490
4491=== modified file 'madgraph/core/base_objects.py'
4492--- madgraph/core/base_objects.py 2014-08-07 21:10:49 +0000
4493+++ madgraph/core/base_objects.py 2015-02-04 13:27:21 +0000
4494@@ -1513,7 +1513,8 @@
4495 if str(part.get('width')) in one_change:
4496 part.set('width', rep_pattern.sub(replace, str(part.get('width'))))
4497 if hasattr(part, 'partial_widths'):
4498- for key, value in part.partial_widths.items(): part.partial_widths[key] = rep_pattern.sub(replace, value)
4499+ for key, value in part.partial_widths.items():
4500+ part.partial_widths[key] = rep_pattern.sub(replace, value)
4501
4502 #ensure that the particle_dict is up-to-date
4503 self['particle_dict'] =''
4504
4505=== modified file 'madgraph/interface/amcatnlo_run_interface.py'
4506--- madgraph/interface/amcatnlo_run_interface.py 2014-11-05 17:34:19 +0000
4507+++ madgraph/interface/amcatnlo_run_interface.py 2015-02-04 13:27:21 +0000
4508@@ -140,6 +140,8 @@
4509 compiler = options['fortran_compiler']
4510 elif misc.which('gfortran'):
4511 compiler = 'gfortran'
4512+ else:
4513+ compiler = ''
4514
4515 if 'gfortran' not in compiler:
4516 if block:
4517@@ -1487,6 +1489,9 @@
4518 raise aMCatNLOError('Required accuracy ("req_acc" in the run_card) should '\
4519 'be between larger than 0 and smaller than 1, '\
4520 'or set to -1 for automatic determination. Current value is %s' % req_acc)
4521+# For more than 1M events, set req_acc to 0.001 (except when it was explicitly set in the run_card)
4522+ elif float(req_acc) < 0 and nevents > 1000000 :
4523+ req_acc='0.001'
4524
4525 shower_list = ['HERWIG6', 'HERWIGPP', 'PYTHIA6Q', 'PYTHIA6PT', 'PYTHIA8']
4526
4527@@ -1518,9 +1523,7 @@
4528 nevents_unweighted = []
4529
4530 split = i == 2 and \
4531- int(self.run_card['nevt_job']) > 0 and \
4532- any([int(l.split()[1]) > int(self.run_card['nevt_job']) \
4533- for l in nevents_unweighted if l])
4534+ int(self.run_card['nevt_job']) > 0
4535
4536 if i == 2 or not options['only_generation']:
4537 # if the number of events requested is zero,
4538@@ -1787,11 +1790,11 @@
4539 '\n Total cross-section: %(xsect)8.3e +- %(errt)6.1e pb' % \
4540 self.cross_sect_dict
4541
4542- if int(self.run_card['nevents'])>=10000 and self.run_card['reweight_scale']=='.true.' and int(self.run_card['ickkw']) != 4:
4543+ if int(self.run_card['nevents'])>=10000 and self.run_card['reweight_scale']=='.true.':
4544 message = message + \
4545 ('\n Ren. and fac. scale uncertainty: +%0.1f%% -%0.1f%%') % \
4546 (scale_pdf_info['scale_upp'], scale_pdf_info['scale_low'])
4547- if int(self.run_card['nevents'])>=10000 and self.run_card['reweight_PDF']=='.true.' and int(self.run_card['ickkw']) != 4:
4548+ if int(self.run_card['nevents'])>=10000 and self.run_card['reweight_PDF']=='.true.':
4549 message = message + \
4550 ('\n PDF uncertainty: +%0.1f%% -%0.1f%%') % \
4551 (scale_pdf_info['pdf_upp'], scale_pdf_info['pdf_low'])
4552@@ -2287,7 +2290,7 @@
4553 Event dir. Return the name of the event file created
4554 """
4555 scale_pdf_info={}
4556- if (self.run_card['reweight_scale'] == '.true.' or self.run_card['reweight_PDF'] == '.true.') and int(self.run_card['ickkw']) != 4 :
4557+ if (self.run_card['reweight_scale'] == '.true.' or self.run_card['reweight_PDF'] == '.true.') :
4558 scale_pdf_info = self.run_reweight(options['reweightonly'])
4559
4560 self.update_status('Collecting events', level='parton', update_results=True)
4561@@ -2398,6 +2401,18 @@
4562 '\n'.join(fjwrapper_lines) + '\n')
4563
4564 extrapaths = self.shower_card['extrapaths'].split()
4565+
4566+ # check that the path needed by HW++ and PY8 are set if one uses these shower
4567+ if shower in ['HERWIGPP', 'PYTHIA8']:
4568+ path_dict = {'HERWIGPP': ['hepmc_path',
4569+ 'thepeg_path',
4570+ 'hwpp_path'],
4571+ 'PYTHIA8': ['pythia8_path']}
4572+
4573+ if not all([self.options[ppath] for ppath in path_dict[shower]]):
4574+ raise aMCatNLOError('Some paths are missing in the configuration file.\n' + \
4575+ ('Please make sure you have set these variables: %s' % ', '.join(path_dict[shower])))
4576+
4577 if shower == 'HERWIGPP':
4578 extrapaths.append(pjoin(self.options['hepmc_path'], 'lib'))
4579
4580@@ -3088,8 +3103,13 @@
4581 scale_upp=0.0
4582 scale_low=0.0
4583 if numofscales>0:
4584- scale_pdf_info['scale_upp'] = (max(scales)/cntrl_val-1)*100
4585- scale_pdf_info['scale_low'] = (1-min(scales)/cntrl_val)*100
4586+ if cntrl_val != 0.0:
4587+ scale_pdf_info['scale_upp'] = (max(scales)/cntrl_val-1)*100
4588+ scale_pdf_info['scale_low'] = (1-min(scales)/cntrl_val)*100
4589+ else:
4590+ scale_pdf_info['scale_upp'] = 0.0
4591+ scale_pdf_info['scale_low'] = 0.0
4592+
4593
4594 # get the pdf uncertainty in percent (according to the Hessian method)
4595 lhaid=int(self.run_card['lhaid'])
4596@@ -3101,15 +3121,23 @@
4597 for i in range(int(numofpdf/2)):
4598 pdf_upp=pdf_upp+math.pow(max(0.0,pdfs[2*i+1]-cntrl_val,pdfs[2*i+2]-cntrl_val),2)
4599 pdf_low=pdf_low+math.pow(max(0.0,cntrl_val-pdfs[2*i+1],cntrl_val-pdfs[2*i+2]),2)
4600- scale_pdf_info['pdf_upp'] = math.sqrt(pdf_upp)/cntrl_val*100
4601- scale_pdf_info['pdf_low'] = math.sqrt(pdf_low)/cntrl_val*100
4602+ if cntrl_val != 0.0:
4603+ scale_pdf_info['pdf_upp'] = math.sqrt(pdf_upp)/cntrl_val*100
4604+ scale_pdf_info['pdf_low'] = math.sqrt(pdf_low)/cntrl_val*100
4605+ else:
4606+ scale_pdf_info['pdf_upp'] = 0.0
4607+ scale_pdf_info['pdf_low'] = 0.0
4608+
4609 else:
4610 # use Gaussian method (NNPDF)
4611 pdf_stdev=0.0
4612 for i in range(int(numofpdf-1)):
4613 pdf_stdev = pdf_stdev + pow(pdfs[i+1] - cntrl_val,2)
4614 pdf_stdev = math.sqrt(pdf_stdev/int(numofpdf-2))
4615- scale_pdf_info['pdf_upp'] = pdf_stdev/cntrl_val*100
4616+ if cntrl_val != 0.0:
4617+ scale_pdf_info['pdf_upp'] = pdf_stdev/cntrl_val*100
4618+ else:
4619+ scale_pdf_info['pdf_upp'] = 0.0
4620 scale_pdf_info['pdf_low'] = scale_pdf_info['pdf_upp']
4621 return scale_pdf_info
4622
4623@@ -3286,8 +3314,8 @@
4624 if shower == 'PYTHIA8':
4625 input_files.append(pjoin(cwd, 'Pythia8.exe'))
4626 input_files.append(pjoin(cwd, 'Pythia8.cmd'))
4627- input_files.append(pjoin(cwd, 'config.sh'))
4628 if os.path.exists(pjoin(self.options['pythia8_path'], 'xmldoc')):
4629+ input_files.append(pjoin(cwd, 'config.sh'))
4630 input_files.append(pjoin(self.options['pythia8_path'], 'xmldoc'))
4631 else:
4632 input_files.append(pjoin(self.options['pythia8_path'], 'share/Pythia8/xmldoc'))
4633@@ -3437,7 +3465,10 @@
4634 keep_fourth_arg = True
4635 # this is for the split event generation
4636 output_files.append('G%s%s_%s' % (args[1], i, args[3]))
4637- required_output.append('%s/log_MINT%s.txt' % (current,args[2]))
4638+ required_output.append('G%s%s_%s/log_MINT%s.txt' % (args[1], i, args[3],args[2]))
4639+
4640+ else:
4641+ required_output.append('%s/log_MINT%s.txt' % (current,args[2]))
4642 if args[2] in ['0','1']:
4643 required_output.append('%s/results.dat' % current)
4644 if args[2] == '1':
4645@@ -3601,21 +3632,23 @@
4646 for code in ['applgrid','amcfast']:
4647 try:
4648 p = subprocess.Popen([self.options[code], '--version'], \
4649- stdout=subprocess.PIPE, stderr=subprocess.PIPE)
4650- output, error = p.communicate()
4651+ stdout=subprocess.PIPE, stderr=subprocess.PIPE)
4652+ except OSError:
4653+ raise aMCatNLOError(('No valid %s installation found. \n' + \
4654+ 'Please set the path to %s-config by using \n' + \
4655+ 'MG5_aMC> set <absolute-path-to-%s>/bin/%s-config \n') % (code,code,code,code))
4656+ else:
4657+ output, _ = p.communicate()
4658 if code is 'applgrid' and output < '1.4.63':
4659 raise aMCatNLOError('Version of APPLgrid is too old. Use 1.4.69 or later.'\
4660- +' You are using %s',output)
4661+ +' You are using %s',output)
4662 if code is 'amcfast' and output < '1.1.1':
4663 raise aMCatNLOError('Version of aMCfast is too old. Use 1.1.1 or later.'\
4664- +' You are using %s',output)
4665- except Exception:
4666- raise aMCatNLOError(('No valid %s installation found. \n' + \
4667- 'Please set the path to %s-config by using \n' + \
4668- 'MG5_aMC> set <absolute-path-to-%s>/bin/%s-config \n') % (code,code,code,code))
4669+ +' You are using %s',output)
4670+
4671 # set-up the Source/make_opts with the correct applgrid-config file
4672- appllibs=" APPLLIBS=$(shell %s --ldcflags) $(shell %s --ldflags) \n" \
4673- % (self.options['applgrid'],self.options['amcfast'])
4674+ appllibs=" APPLLIBS=$(shell %s --ldflags) $(shell %s --ldcflags) \n" \
4675+ % (self.options['amcfast'],self.options['applgrid'])
4676 text=open(pjoin(self.me_dir,'Source','make_opts'),'r').readlines()
4677 text_out=[]
4678 for line in text:
4679
4680=== modified file 'madgraph/interface/common_run_interface.py'
4681--- madgraph/interface/common_run_interface.py 2014-11-05 17:34:19 +0000
4682+++ madgraph/interface/common_run_interface.py 2015-02-04 13:27:21 +0000
4683@@ -731,6 +731,7 @@
4684 delphes_card.dat
4685 delphes_trigger.dat
4686 shower_card.dat [aMCatNLO]
4687+ FO_analyse_card.dat [aMCatNLO]
4688 madspin_card.dat [MS]
4689 transfer_card.dat [MW]
4690 madweight_card.dat [MW]
4691@@ -740,7 +741,7 @@
4692 if text == '':
4693 logger.warning('File %s is empty' % path)
4694 return 'unknown'
4695- text = re.findall('(<MGVersion>|ParticlePropagator|<mg5proccard>|CEN_max_tracker|#TRIGGER CARD|parameter set name|muon eta coverage|QES_over_ref|MSTP|b_stable|MSTU|Begin Minpts|gridpack|ebeam1|block\s+mw_run|BLOCK|DECAY|launch|madspin|transfer_card\.dat|set)', text, re.I)
4696+ text = re.findall('(<MGVersion>|ParticlePropagator|<mg5proccard>|CEN_max_tracker|#TRIGGER CARD|parameter set name|muon eta coverage|QES_over_ref|MSTP|b_stable|FO_ANALYSIS_FORMAT|MSTU|Begin Minpts|gridpack|ebeam1|block\s+mw_run|BLOCK|DECAY|launch|madspin|transfer_card\.dat|set)', text, re.I)
4697 text = [t.lower() for t in text]
4698 if '<mgversion>' in text or '<mg5proccard>' in text:
4699 return 'banner'
4700@@ -769,6 +770,8 @@
4701 return 'param_card.dat'
4702 elif 'b_stable' in text:
4703 return 'shower_card.dat'
4704+ elif 'fo_analysis_format' in text:
4705+ return 'FO_analyse_card.dat'
4706 elif 'decay' in text and 'launch' in text and 'madspin' in text:
4707 return 'madspin_card.dat'
4708 elif 'launch' in text and 'set' in text:
4709@@ -1701,8 +1704,9 @@
4710 """ find a valid run_name for the current job """
4711
4712 name = 'run_%02d'
4713- data = [int(s[4:]) for s in os.listdir(pjoin(me_dir,'Events')) if
4714- s.startswith('run_') and len(s)>5 and s[4:].isdigit()]
4715+ data = [int(s[4:j]) for s in os.listdir(pjoin(me_dir,'Events')) for
4716+ j in range(4,len(s)+1) if \
4717+ s.startswith('run_') and s[4:j].isdigit()]
4718 return name % (max(data+[0])+1)
4719
4720
4721
4722=== modified file 'madgraph/interface/madevent_interface.py'
4723--- madgraph/interface/madevent_interface.py 2014-10-20 14:26:15 +0000
4724+++ madgraph/interface/madevent_interface.py 2015-02-04 13:27:21 +0000
4725@@ -1610,6 +1610,7 @@
4726 model = self.find_model_name()
4727 process = self.process # define in find_model_name
4728 self.results = gen_crossxhtml.AllResults(model, process, self.me_dir)
4729+ self.results.resetall(self.me_dir)
4730 self.results.def_web_mode(self.web)
4731
4732 self.prompt = "%s>"%os.path.basename(pjoin(self.me_dir))
4733@@ -2508,7 +2509,15 @@
4734 os.remove(pjoin(self.me_dir,'SubProcesses', 'combine.log'))
4735 except Exception:
4736 pass
4737- self.cluster.launch_and_wait('../bin/internal/run_combine',
4738+
4739+ if self.options['run_mode'] ==1 and self.options['cluster_tmp_path']:
4740+ tmpcluster = cluster.MultiCore(nb_core=1)
4741+ tmpcluster.launch_and_wait('../bin/internal/run_combine',
4742+ cwd=pjoin(self.me_dir,'SubProcesses'),
4743+ stdout=pjoin(self.me_dir,'SubProcesses', 'combine.log'),
4744+ required_output=[pjoin(self.me_dir,'SubProcesses', 'combine.log')])
4745+ else:
4746+ self.cluster.launch_and_wait('../bin/internal/run_combine',
4747 cwd=pjoin(self.me_dir,'SubProcesses'),
4748 stdout=pjoin(self.me_dir,'SubProcesses', 'combine.log'),
4749 required_output=[pjoin(self.me_dir,'SubProcesses', 'combine.log')])
4750@@ -2573,6 +2582,8 @@
4751 self.check_combine_events(args)
4752 self.update_status('Storing parton level results', level='parton')
4753
4754+
4755+
4756 run = self.run_name
4757 tag = self.run_card['run_tag']
4758 devnull = open(os.devnull, 'w')
4759@@ -2588,36 +2599,54 @@
4760 files.cp(input, output)
4761
4762 # 2) Treat the files present in the P directory
4763- for P_path in SubProcesses.get_subP(self.me_dir):
4764- G_dir = [G for G in os.listdir(P_path) if G.startswith('G') and
4765- os.path.isdir(pjoin(P_path,G))]
4766- for G in G_dir:
4767- G_path = pjoin(P_path,G)
4768- # Remove events file (if present)
4769- if os.path.exists(pjoin(G_path, 'events.lhe')):
4770- os.remove(pjoin(G_path, 'events.lhe'))
4771- # Store results.dat
4772- if os.path.exists(pjoin(G_path, 'results.dat')):
4773- input = pjoin(G_path, 'results.dat')
4774- output = pjoin(G_path, '%s_results.dat' % run)
4775- files.cp(input, output)
4776- # Store log
4777- if os.path.exists(pjoin(G_path, 'log.txt')):
4778- input = pjoin(G_path, 'log.txt')
4779- output = pjoin(G_path, '%s_log.txt' % run)
4780- files.mv(input, output)
4781- # Grid
4782- for name in ['ftn26']:
4783- if os.path.exists(pjoin(G_path, name)):
4784- if os.path.exists(pjoin(G_path, '%s_%s.gz'%(run,name))):
4785- os.remove(pjoin(G_path, '%s_%s.gz'%(run,name)))
4786- input = pjoin(G_path, name)
4787- output = pjoin(G_path, '%s_%s' % (run,name))
4788- files.mv(input, output)
4789- misc.gzip(pjoin(G_path, output), error=None)
4790- # Delete ftn25 to ensure reproducible runs
4791- if os.path.exists(pjoin(G_path, 'ftn25')):
4792- os.remove(pjoin(G_path, 'ftn25'))
4793+ # Ensure that the number of events is different of 0
4794+ if self.results.current['nb_event'] == 0:
4795+ logger.warning("No event detected. No cleaning performed! This should allow to run:\n" +
4796+ " cd Subprocesses; ../bin/internal/combine_events\n"+
4797+ " to have your events if those one are missing.")
4798+ else:
4799+ for P_path in SubProcesses.get_subP(self.me_dir):
4800+ G_dir = [G for G in os.listdir(P_path) if G.startswith('G') and
4801+ os.path.isdir(pjoin(P_path,G))]
4802+ for G in G_dir:
4803+ G_path = pjoin(P_path,G)
4804+ try:
4805+ # Remove events file (if present)
4806+ if os.path.exists(pjoin(G_path, 'events.lhe')):
4807+ os.remove(pjoin(G_path, 'events.lhe'))
4808+ except Exception:
4809+ continue
4810+ try:
4811+ # Store results.dat
4812+ if os.path.exists(pjoin(G_path, 'results.dat')):
4813+ input = pjoin(G_path, 'results.dat')
4814+ output = pjoin(G_path, '%s_results.dat' % run)
4815+ files.cp(input, output)
4816+ except Exception:
4817+ continue
4818+ # Store log
4819+ try:
4820+ if os.path.exists(pjoin(G_path, 'log.txt')):
4821+ input = pjoin(G_path, 'log.txt')
4822+ output = pjoin(G_path, '%s_log.txt' % run)
4823+ files.mv(input, output)
4824+ except Exception:
4825+ continue
4826+ try:
4827+ # Grid
4828+ for name in ['ftn26']:
4829+ if os.path.exists(pjoin(G_path, name)):
4830+ if os.path.exists(pjoin(G_path, '%s_%s.gz'%(run,name))):
4831+ os.remove(pjoin(G_path, '%s_%s.gz'%(run,name)))
4832+ input = pjoin(G_path, name)
4833+ output = pjoin(G_path, '%s_%s' % (run,name))
4834+ files.mv(input, output)
4835+ misc.gzip(pjoin(G_path, output), error=None)
4836+ except Exception:
4837+ continue
4838+ # Delete ftn25 to ensure reproducible runs
4839+ if os.path.exists(pjoin(G_path, 'ftn25')):
4840+ os.remove(pjoin(G_path, 'ftn25'))
4841
4842 # 3) Update the index.html
4843 misc.call(['%s/gen_cardhtml-pl' % self.dirbin],
4844
4845=== modified file 'madgraph/interface/madgraph_interface.py'
4846--- madgraph/interface/madgraph_interface.py 2014-11-05 17:34:19 +0000
4847+++ madgraph/interface/madgraph_interface.py 2015-02-04 13:27:21 +0000
4848@@ -899,13 +899,14 @@
4849 return
4850
4851 # request that we have one or two > in the process
4852- if process.count('>') not in [1,2]:
4853+ nbsep = len(re.findall('>\D', process)) # not use process.count because of QCD^2>2
4854+ if nbsep not in [1,2]:
4855 raise self.InvalidCmd(
4856 'wrong format for \"%s\" this part requires one or two symbols \'>\', %s found'
4857- % (process, process.count('>')))
4858+ % (process, nbsep))
4859
4860 # we need at least one particles in each pieces
4861- particles_parts = process.split('>')
4862+ particles_parts = re.split('>\D', process)
4863 for particles in particles_parts:
4864 if re.match(r'^\s*$', particles):
4865 raise self.InvalidCmd(
4866@@ -3494,7 +3495,7 @@
4867 a ProcessDefinition."""
4868
4869 # Check basic validity of the line
4870- if not line.count('>') in [1,2]:
4871+ if not len(re.findall('>\D', line)) in [1,2]:
4872 self.do_help('generate')
4873 raise self.InvalidCmd('Wrong use of \">\" special character.')
4874
4875@@ -5018,8 +5019,8 @@
4876 continue
4877 path = self.options[key]
4878 #this is for pythia8
4879- if key == 'pythia8_path' and not os.path.isfile(pjoin(MG5DIR, path, 'include', 'Pythia.h')):
4880- if not os.path.isfile(pjoin(path, 'include', 'Pythia.h')):
4881+ if key == 'pythia8_path' and not os.path.isfile(pjoin(MG5DIR, path, 'include', 'Pythia8', 'Pythia.h')):
4882+ if not os.path.isfile(pjoin(path, 'include', 'Pythia8', 'Pythia.h')):
4883 self.options['pythia8_path'] = None
4884 else:
4885 continue
4886@@ -6062,8 +6063,8 @@
4887 logger.info('The value for lhapdf in the current configuration does not ' + \
4888 'correspond to a valid executable.\nPlease set it correctly either in ' + \
4889 'input/mg5_configuration or with "set lhapdf /path/to/lhapdf-config" ' + \
4890- 'and regenrate the process. \nTo avoid regeneration, manually edit the ' + \
4891- ('%s/Source/fj_lhapdf_opts file.\n' % self._export_dir ) + \
4892+ 'and regenrate the process. \nTo avoid regeneration, edit the ' + \
4893+ ('%s/Cards/amcatnlo_configuration.txt file.\n' % self._export_dir ) + \
4894 'Note that you can still compile and run aMC@NLO with the built-in PDFs\n')
4895
4896 compiler_dict = {'fortran': self.options['fortran_compiler'],
4897@@ -6213,9 +6214,12 @@
4898 tmp_mass = mass
4899 for p in mode:
4900 try:
4901- tmp_mass -= abs(eval(str(p.mass), data))
4902+ value_mass = eval(str(p.mass), data)
4903 except Exception:
4904- tmp_mass -= abs(eval("mdl_"+str(p.mass), data))
4905+ # the p object can still be UFO reference. since the
4906+ # mass name might hve change load back the MG5 one.
4907+ value_mass = eval(str(model.get_particle(p.pdg_code).get('mass')), data)
4908+ tmp_mass -= abs(value_mass)
4909 if tmp_mass <=0:
4910 continue
4911
4912
4913=== modified file 'madgraph/iolibs/export_fks.py'
4914--- madgraph/iolibs/export_fks.py 2014-11-04 11:30:53 +0000
4915+++ madgraph/iolibs/export_fks.py 2015-02-04 13:27:21 +0000
4916@@ -562,6 +562,7 @@
4917 'fks_Sij.f',
4918 'fks_powers.inc',
4919 'fks_singular.f',
4920+ 'c_weight.inc',
4921 'fks_inc_chooser.f',
4922 'leshouche_inc_chooser.f',
4923 'configs_and_props_inc_chooser.f',
4924@@ -630,7 +631,7 @@
4925
4926 #import nexternal/leshouches in Source
4927 ln('nexternal.inc', '../../Source', log=False)
4928- ln('leshouche_decl.inc', '../../Source', log=False)
4929+ ln('born_leshouche.inc', '../../Source', log=False)
4930
4931
4932 # Return to SubProcesses dir
4933@@ -2599,19 +2600,34 @@
4934 for initial_state in init_states:
4935 if initial_state in pdf_codes.keys():
4936 if subproc_group:
4937- pdf_lines = pdf_lines + \
4938- ("%s%d=PDG2PDF(ABS(LPP(IB(%d))),%d*LP," + \
4939+ if abs(pdgtopdf[initial_state]) <= 7:
4940+ pdf_lines = pdf_lines + \
4941+ ("%s%d=PDG2PDF(ABS(LPP(IB(%d))),%d*LP," + \
4942 "XBK(IB(%d)),DSQRT(Q2FACT(%d)))\n") % \
4943 (pdf_codes[initial_state],
4944 i + 1, ibeam, pdgtopdf[initial_state],
4945 ibeam, ibeam)
4946+ else:
4947+ # setting other partons flavours outside quark, gluon, photon to be 0d0
4948+ pdf_lines = pdf_lines + \
4949+ ("c settings other partons flavours outside quark, gluon, photon to 0d0\n" + \
4950+ "%s%d=0d0\n") % \
4951+ (pdf_codes[initial_state],i + 1)
4952 else:
4953- pdf_lines = pdf_lines + \
4954- ("%s%d=PDG2PDF(ABS(LPP(%d)),%d*LP," + \
4955+ if abs(pdgtopdf[initial_state]) <= 7:
4956+ pdf_lines = pdf_lines + \
4957+ ("%s%d=PDG2PDF(ABS(LPP(%d)),%d*LP," + \
4958 "XBK(%d),DSQRT(Q2FACT(%d)))\n") % \
4959 (pdf_codes[initial_state],
4960 i + 1, ibeam, pdgtopdf[initial_state],
4961 ibeam, ibeam)
4962+ else:
4963+ # setting other partons flavours outside quark, gluon, photon to be 0d0
4964+ pdf_lines = pdf_lines + \
4965+ ("c settings other partons flavours outside quark, gluon, photon to 0d0\n" + \
4966+ "%s%d=0d0\n") % \
4967+ (pdf_codes[initial_state],i + 1)
4968+
4969 pdf_lines = pdf_lines + "ENDIF\n"
4970
4971 # Add up PDFs for the different initial state particles
4972
4973=== modified file 'madgraph/iolibs/template_files/madevent_symmetry.f'
4974--- madgraph/iolibs/template_files/madevent_symmetry.f 2013-12-09 02:09:49 +0000
4975+++ madgraph/iolibs/template_files/madevent_symmetry.f 2015-02-04 13:27:21 +0000
4976@@ -588,14 +588,12 @@
4977 xwidth(-i)=prwidth(-i,iconfig)
4978 if (xwidth(-i) .gt. 0d0) then
4979 nbw=nbw+1
4980- if (iarray(nbw) .eq. 1) then
4981- if(xmass(-i).gt.prmass(-i,iconfig)+5d0*xwidth(-i)) then
4982- failConfig=.true.
4983- return
4984- else
4985- xmass(-i)=max(xmass(-i),prmass(-i,iconfig)-5d0*xwidth(-i))
4986- endif
4987- else if(forcebw(-i) .eq. 1) then
4988+ if(forcebw(-i) .eq. 1) then
4989+c if (iarray(nbw) .ne. 1) then
4990+c write(*,*) "fail due to iarray", iarray(nbw)
4991+c failConfig=.true.
4992+c return
4993+c endif
4994 if(xmass(-i).gt.prmass(-i,iconfig)+bwcutoff*xwidth(-i)) then
4995 failConfig=.true.
4996 return
4997@@ -603,6 +601,14 @@
4998 xmass(-i)=max(xmass(-i),prmass(-i,iconfig)-
4999 $ bwcutoff*xwidth(-i))
5000 endif
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches

to all changes: