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

Proposed by Olivier Mattelaer
Status: Merged
Merged at revision: 259
Proposed branch: lp:~maddevelopers/mg5amcnlo/2.3
Merge into: lp:mg5amcnlo/lts
Diff against target: 183023 lines
To merge this branch: bzr merge lp:~maddevelopers/mg5amcnlo/2.3
Reviewer Review Type Date Requested Status
Valentin Hirschi for beta release Pending
Review via email: mp+252090@code.launchpad.net

Description of the change

Hi guys,

As you know, I plan to release this version as beta (then only accessible via launchpad) next week.

They are still a couple of merge in progress. It would be great to have them include.
The most important (which are not yet approve) are:

lp:~maddevelopers/mg5amcnlo/sm_width
lp:~maddevelopers/mg5amcnlo/2.3.0_nopdftransfer (extremelly important for our LLN cluster. Marco any news on the review?)
lp:~maddevelopers/mg5amcnlo/LoopInduced_splitted_refine

And obviously we (i.e. Hua-Sheng) need to fix the huge crash linked to IREGI. Since without that we can not run anything in practise.

Do you see any point missing? Do you want to have additional stuff in that beta version?

On my side, I might try to implement a "bridge" version of MadSpin (Since MS can not handle loop induce) but we will see if I can do it in time.

Cheers,

Olivier

To post a comment you must log in.
lp:~maddevelopers/mg5amcnlo/2.3 updated
279. By Olivier Mattelaer

Fix a bug in presence of large number of resonances/conflict of BW

280. By Paolo Torrielli

merged with 2.2.0_shower_set

281. By Rikkert Frederix

merge with veto_xsec

282. By Rikkert Frederix

converted some parameters in the run_card from integer to float.

283. By Olivier Mattelaer

better fix of the acceptance test (all file are in temporary directory

284. By Olivier Mattelaer

Fix an error in the if statement

285. By Olivier Mattelaer

fix a stupid bug

286. By Olivier Mattelaer

Fixing a problem in the formatting of string (not preserving case) when using the set command

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

Hi Olivier,

I don't think it makes sense to rush this too much and release a beta version. We can wait 2-3 weeks more to have a slightly more stable version out, I think. In any case, I would like to have the HwU_shower branch to be part of it as well (it's currently under review).

Best,
Rikkert

lp:~maddevelopers/mg5amcnlo/2.3 updated
287. By Olivier Mattelaer

fix a bug in the addmodel function introduces in 2.2.3

288. By Valentin Hirschi

1. Merge the fix for the I/O crash in local multicore when reading MadLoop5_resources/HelFilter.dat

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

Hi Rik,

My feeling is that the version is stable enough for a beta.
I have two reason to rush a bit this version
1) We have a lot of pressure to release the loop-induced code
2) This version is going to include the no_pdf_transfer utilities which is needed to reduce the pressure of our code on the LLN cluster. I promise the LLN IT team to have that
option available as soon as possible. They (=Jerome) have work a lot to have that functionality available on the ingrid cluster in the hope that our tool will stop (or at least decrease)
to slow down the full filesystem.

Now I’m fine to postpone it if this can help.

> In any case, I would like to have the HwU_shower branch to be part of it as well (it's currently under review).

looks like well in progress, I will also review that branch later today (china time).

Cheers,

Olivier

On 09 Mar 2015, at 21:35, Rikkert Frederix <email address hidden> wrote:

> Hi Olivier,
>
> I don't think it makes sense to rush this too much and release a beta version. We can wait 2-3 weeks more to have a slightly more stable version out, I think. In any case, I would like to have the HwU_shower branch to be part of it as well (it's currently under review).
>
> Best,
> Rikkert
>
> --
> https://code.launchpad.net/~maddevelopers/mg5amcnlo/2.3/+merge/252090
> Your team MadDevelopers is subscribed to branch lp:~maddevelopers/mg5amcnlo/2.3.

lp:~maddevelopers/mg5amcnlo/2.3 updated
289. By marco zaro

two small fixes in export_fks relevant to BSM cases when only diagrams with
>=4 particle-vertices exist

290. By Valentin Hirschi

1. Removed the double-checking of the vanishing helicity configurations for the actual runs. This solves the issue of the multiple write access from different jobs of a given channel when running in local multicore mode without cluster_tmp_path.

291. By Valentin Hirschi

1. Small fix that prevented 'check stability' to work properly.

292. By Rikkert Frederix

merge with the HwU_shower branch

293. By Rikkert Frederix

Updated the UpdateNotes

294. By Rikkert Frederix

some trivial fixes in NLO/Source/setrun

295. By Olivier Mattelaer

allow faster identification of jobs which are pointless to compute during survey time. Improve error message with MultiCore class

296. By Olivier Mattelaer

allow survey.sh/refine_splitted.sh to remove log output to reduce the charge on the cluster.

297. By marco zaro

merged with 2.2.3-LOfromNLO

298. By Olivier Mattelaer

improve logging information in LoopInduced

299. By Valentin Hirschi

1. Fix in template a bug introduced in the merge of LOfromNLO.

300. By Olivier Mattelaer

fix bug in LoopInduced if some channel are in 0result

301. By Olivier Mattelaer

Fix problem with the re-weighting method

302. By Paolo Torrielli

Bug fix for Pythia8 in conjunction with LHAPDF6.
Thanks to Federico Demartin for spotting this bug.

303. By Paolo Torrielli

Bug fix for Herwig++ in conjunction with LHAPDF6

304. By Olivier Mattelaer

allow -l option to take digit input for more refine level of print

305. By Valentin Hirschi

1. merged HwUNewFunction

306. By Rikkert Frederix

Added support for gnuplot v5 in the HwU histograms.py.
Also, added a string to the gnuplot output that contains the command
that was executed to get this output (standalone mode only). Useful to
keep track which curve is which when many are combined.

307. By Valentin Hirschi

1. Removed unnecessary print statements in histograms.py

308. By Valentin Hirschi

1. Small modification of the plotting of multiple .HwU file so that the
   '#i' prefixes given to the histogram types do not stack when re-plotting
   an output HwU.

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

Ok I will release this in a beta during the weekend.
This version was lating since too long.

Likely that the bridge review will not be ontime, but it can wait.
On the otherhand the 2.3.0_nopdftransfer is very important and should be merge in any case.

Cheers,

Olivier

lp:~maddevelopers/mg5amcnlo/2.3 updated
309. By Valentin Hirschi

1. Merged with branch for the new Madloop monitoring for loop-induced simulation.

310. By Rikkert Frederix

Fixed a bug in the Pythia8 driver files: the call to pythia.init()
should be AFTER the UserHooks (in particular the JetMatching for FxFx)
has been setup. This bug was introduced in v.2.2.3 and gave the wrong
results without any error message.

311. By Rikkert Frederix

also updated the pythia8.1 driver files (see previous commit)

312. By Olivier Mattelaer

improve the print_result command for easy parsing option

313. By Olivier Mattelaer

merge the no pdf transfer branch

314. By Olivier Mattelaer

nicer implementation of the check of unweight event in LoopInduce mode and nicer printout

315. By Olivier Mattelaer

Fix a bug in the reweighting interface

316. By Valentin Hirschi

1. Small esthetical change in histograms.py

317. By Paolo Torrielli

added some HwU shower analyses

318. By Olivier Mattelaer

merge with the bridge branch --with bridge mode deactivate-- but with none mode + fix a cluster problem

319. By Olivier Mattelaer

remove a debug statement

320. By Olivier Mattelaer

Fix a problem in the matching/merging leading to wrong QCD/QED assignment (leading to crash)

321. By Olivier Mattelaer

Fix a problem of MadSpin in gridpack mode for the mssm model

322. By Paolo Torrielli

other HwU shower analyses

323. By marco zaro

 fix in born_fks.inc: bug introduced with the LI branch related to scalar octets

324. By Olivier Mattelaer

allow Auto in the reweight interface/fix small bug in recreating html db/ add new function for the FourMomenta class

325. By Olivier Mattelaer

correct a problem on condor for submitting a second run in the same directory

326. By marco zaro

the logs are collected in a more memory-efficient way

327. By Rikkert Frederix

small improvements for the NNLL+NLO veto cross section runs.

328. By Marco Zaro <mzaro@ingrid-ui1>

crucial fix in copy_lhapdf_set

329. By Paolo Torrielli

Rik's fix to the bug in the MG5_aMC + PY8 interface, concerning
the theoretical-uncertainty bands at (N)LO+PS, as plotted by
topdrawer analyses.

330. By Olivier Mattelaer

Fix a tricky bug in the cmd interface when multiple file where simultaneously used as script for various part of the code (i.e. typical use of MadSpin/reweight)

331. By Olivier Mattelaer

fix the problem of missing initialisation of the text_editor

332. By Olivier Mattelaer

Fix problem in single core mode

333. By Paolo Torrielli

changed the default PDF set for PY8, from CTEQ6L to NNPDF 2.3 QCD+QED LO

334. By Olivier Mattelaer

merge the fix of MadSpin done by Pierre

335. By Olivier Mattelaer

fix a problem with the <init> block

336. By Valentin Hirschi

1. Merged the branch implementing loop-induced simulation features in MadGraph5_aMCatNLO using the syntax [noborn=<pert_orders>] in the process definition.

Revision history for this message
Valentin Hirschi (valentin-hirschi) wrote :

Hi all,

We have finalized our changes in the loop-induced branch, merged it and fixed the tests.
This revision 2.3 is now to be considered frozen and we will release the code tomorrow.
If you have any opinion against this, please let us know now.

Olivier & Valentin

lp:~maddevelopers/mg5amcnlo/2.3 updated
337. By Valentin Hirschi

1. Fixed a diagram_generation test which has incorrectly fixed before.

338. By Valentin Hirschi

1. Fixed MadLoop compilation command in the parallel tests.
2. Reverted two personal modification for testing purposes which were left in the code.

339. By Valentin Hirschi

1. Fixed a minor bug in the helicity filter double-checking procedure of MadLoop.
2. Fixed the way the loop parallel test adjust MadLoopParams.dat by now using the new python banner handling system.

340. By Valentin Hirschi

1. Improved the debug printouts on the MadLoop Initialization stage.

341. By Valentin Hirschi

1. Updated IOTest with the minor fix on MadLoop helicity doublecheck procedure.

342. By Valentin Hirschi

1. Small fix brought to the ML5EW steering file as well.

343. By marco zaro

typos fixed in .mg5_configuration_default.txt

344. By Olivier Mattelaer

Update Version/UpdateNotes

345. By Olivier Mattelaer

Fixing two of the parralel tests. One is still failing

346. By Olivier Mattelaer

Fix the parralel test which was crashing for interference computation

347. By Valentin Hirschi

1. Improved the loop instability security to also apply on the survey, but not its first iteration, and to automatically not apply for channels which seem to be analytically zero (i.e. with a very small relative across contribution).
2. Fixed an issue with the sqrts definition in check_sa.f for loop induced processes.

348. By Valentin Hirschi

1. Synchronized some IOTests.

349. By Olivier Mattelaer

Fix a problem of multiple run with pythia on for loop-induced where all samples were identical

350. By Valentin Hirschi

1. Fixed a comment.
2. Removed another hardcoded path in the MODEL makefile.

351. By Valentin Hirschi

1. Updated the parrallel test as a result of having doubled the center of mass energy in certain cases.

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

Ok Version released as Golden Master.

So please do not push any modication to this branch.

Cheers,

Olivier

lp:~maddevelopers/mg5amcnlo/2.3 updated
352. By Valentin Hirschi

1. Fixed a bug in histograms.py pointed out by Rik.
2. Vetoed from the multichanneling loop-induced diagram above boxes.

353. By Valentin Hirschi

1. Updated version and notes date.

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 2015-02-03 15:18:06 +0000
3+++ MadSpin/decay.py 2015-04-10 09:55:25 +0000
4@@ -63,7 +63,7 @@
5 from madgraph import MG5DIR, MadGraph5Error
6 import madgraph.various.misc as misc
7 #import time
8-import tests.unit_tests.various.test_aloha as test_aloha
9+import tests.parallel_tests.test_aloha as test_aloha
10
11 class MadSpinError(MadGraph5Error):
12 pass
13@@ -441,6 +441,7 @@
14 self['tree'][propa_id] = {'nbody': len(proc.get('legs'))-1,\
15 'label':proc.get('legs')[0].get('id')}
16 # loop over the child
17+ child_propa_id = propa_id
18 for c_nb,leg in enumerate(proc.get('legs')):
19 if c_nb == 0:
20 continue
21@@ -449,12 +450,14 @@
22 self["tree"][propa_id]["d%s" % c_nb]["label"] = c_pid
23 self["tree"][propa_id]["d%s" % c_nb]["labels"] = [c_pid]
24 if c_pid in to_decay:
25- self["tree"][propa_id]["d%s" % c_nb]["index"] = propa_id-1
26+ child_propa_id -= 1
27+ self["tree"][propa_id]["d%s" % c_nb]["index"] = child_propa_id
28 self.nb_decays += 1
29- add_decay(to_decay[c_pid].pop(), propa_id-1)
30+ child_propa_id = add_decay(to_decay[c_pid].pop(), child_propa_id)
31 else:
32 self.nexternal += 1
33 self["tree"][propa_id]["d%s" % c_nb]["index"] = self.nexternal
34+ return child_propa_id
35
36 # launch the recursive loop
37 add_decay(process)
38@@ -1063,9 +1066,11 @@
39
40 s_and_t_channels = []
41
42- minvert = min([max([d for d in config if d][0].get_vertex_leg_numbers()) \
43- for config in configs])
44-
45+ vert_list = [max([d for d in config if d][0].get_vertex_leg_numbers()) \
46+ for config in configs if [d for d in config if d][0].\
47+ get_vertex_leg_numbers()!=[]]
48+ minvert = min(vert_list) if vert_list!=[] else 0
49+
50 # Number of subprocesses
51 # nsubprocs = len(configs[0])
52
53@@ -1075,7 +1080,7 @@
54
55 for iconfig, helas_diags in enumerate(configs):
56 if any([vert > minvert for vert in
57- [d for d in helas_diags if d][0].get_vertex_leg_numbers()]):
58+ [d for d in helas_diags if d][0].get_vertex_leg_numbers()]):
59 # Only 3-vertices allowed in configs.inc
60 continue
61 nconfigs += 1
62@@ -1315,12 +1320,12 @@
63
64 # Maybe the branching fractions are already given in the banner:
65 self.extract_br_from_banner(self.banner)
66- to_decay = [p for p in to_decay if not p in self.br]
67+ to_decay = list(to_decay)
68 for part in to_decay[:]:
69 if part in mgcmd._multiparticles:
70 to_decay += [self.pid2label[id] for id in mgcmd._multiparticles[part]]
71 to_decay.remove(part)
72- to_decay = list(set(to_decay))
73+ to_decay = list(set([p for p in to_decay if not p in self.br]))
74
75 if to_decay:
76 logger.info('We need to recalculate the branching fractions for %s' % ','.join(to_decay))
77@@ -2855,6 +2860,7 @@
78 #to remove potential pointless decay in the diagram generation.
79 resonances = decay_misc.get_all_resonances(self.banner,
80 self.mgcmd, self.mscmd.list_branches.keys())
81+
82 logger.debug('List of resonances:%s' % resonances)
83 path_me = os.path.realpath(self.path_me)
84 width = width_estimate(resonances, path_me, self.banner, self.model,
85@@ -3526,7 +3532,8 @@
86 else:
87 # now we need to write the decay products in the event
88 # follow the decay chain order, so that we can easily keep track of the mother index
89-
90+
91+ map_to_part_number={}
92 for res in range(-1,-len(decay_struct[part]["tree"].keys())-1,-1):
93 index_res_for_mom=decay_struct[part]['mg_tree'][-res-1][0]
94 if (res==-1):
95@@ -3548,8 +3555,8 @@
96 "mass":mass,"helicity":helicity}
97 decayed_event.event2mg[part_number]=part_number
98
99- mothup1=part_number
100- mothup2=part_number
101+ map_to_part_number[res]=part_number
102+
103 #
104 # Extract color information so that we can write the color flow
105 #
106@@ -3654,7 +3661,10 @@
107 decay_struct[part]["tree"][indexd1]["colup2"]=d1colup2
108 istup=2
109 mass=mom.m
110-
111+ map_to_part_number[indexd1]=part_number
112+
113+ mothup1=map_to_part_number[res]
114+ mothup2=map_to_part_number[res]
115 decayed_event.particle[part_number]={"pid":pid,\
116 "istup":istup,"mothup1":mothup1,"mothup2":mothup2,\
117 "colup1":d1colup1,"colup2":d1colup2,"momentum":mom,\
118@@ -3685,10 +3695,10 @@
119 decay_struct[part]["tree"][indexd2]["colup1"]=d2colup1
120 decay_struct[part]["tree"][indexd2]["colup2"]=d2colup2
121 mass=mom.m
122-
123-
124- mothup1=part_number-2
125- mothup2=part_number-2
126+ map_to_part_number[indexd2]=part_number
127+
128+ mothup1=map_to_part_number[res]
129+ mothup2=map_to_part_number[res]
130 decayed_event.particle[part_number]={"pid":pid,"istup":istup,\
131 "mothup1":mothup1,"mothup2":mothup2,"colup1":d2colup1,\
132 "colup2":d2colup2,\
133@@ -3776,8 +3786,7 @@
134 assert production['total_br'] - min(total_br) < 1e-4
135
136 self.branching_ratio = max(total_br) * eff
137-
138-
139+
140 #self.banner['madspin'] += ms_banner
141 # Update cross-section in the banner
142 if 'mggenerationinfo' in self.banner:
143@@ -3785,9 +3794,15 @@
144 for i,line in enumerate(mg_info):
145 if 'Events' in line:
146 if eff == 1:
147+ self.err_branching_ratio = 0
148 continue
149- nb_event = int(int(mg_info[i].split()[-1]) * eff)
150+ initial_event = int(mg_info[i].split()[-1])
151+ nb_event = int(initial_event * eff)
152 mg_info[i] = '# Number of Events : %i' % nb_event
153+ if eff >0.5:
154+ self.err_branching_ratio = max(total_br) * math.sqrt(initial_event - eff * initial_event)/initial_event
155+ else:
156+ self.err_branching_ratio = max(total_br) * math.sqrt(eff * initial_event)/initial_event
157 continue
158 if ':' not in line:
159 continue
160@@ -3801,6 +3816,9 @@
161 else:
162 mg_info[i] = '%s : %s' % (info, value * self.branching_ratio)
163 self.banner['mggenerationinfo'] = '\n'.join(mg_info)
164+
165+
166+
167 if 'init' in self.banner:
168 new_init =''
169 for line in self.banner['init'].split('\n'):
170
171=== modified file 'MadSpin/interface_madspin.py'
172--- MadSpin/interface_madspin.py 2015-02-10 02:53:57 +0000
173+++ MadSpin/interface_madspin.py 2015-04-10 09:55:25 +0000
174@@ -14,9 +14,11 @@
175 ################################################################################
176 """ Command interface for MadSpin """
177 from __future__ import division
178+import collections
179 import logging
180 import math
181 import os
182+import random
183 import re
184 import shutil
185 import glob
186@@ -33,11 +35,13 @@
187 import madgraph.various.misc as misc
188 import madgraph.iolibs.files as files
189 import madgraph.various.banner as banner
190+import madgraph.various.lhe_parser as lhe_parser
191
192 import models.import_ufo as import_ufo
193 import models.check_param_card as check_param_card
194 import MadSpin.decay as madspin
195
196+
197 logger = logging.getLogger('decay.stdout') # -> stdout
198 logger_stderr = logging.getLogger('decay.stderr') # ->stderr
199 cmd_logger = logging.getLogger('cmdprint2') # -> print
200@@ -64,6 +68,8 @@
201
202 self.decay = madspin.decay_misc()
203 self.model = None
204+ self.mode = "madspin" # can be flat/bridge change the way the decay is done.
205+ # note amc@nlo does not support bridge.
206
207 self.options = {'max_weight': -1,
208 'curr_dir': os.path.realpath(os.getcwd()),
209@@ -73,7 +79,8 @@
210 'nb_sigma':0,
211 'ms_dir':None,
212 'max_running_process':100,
213- 'onlyhelicity': False}
214+ 'onlyhelicity': False,
215+ 'spinmode': "madspin"}
216
217
218
219@@ -83,6 +90,7 @@
220 self.to_decay={}
221 self.mg5cmd = master_interface.MasterCmd()
222 self.seed = None
223+ self.err_branching_ratio = 0
224
225
226 if event_path:
227@@ -293,9 +301,17 @@
228 """checking the validity of the set command"""
229
230 if len(args) < 2:
231- raise self.InvalidCmd('set command requires at least two argument.')
232-
233- valid = ['max_weight','seed','curr_dir']
234+ if args and '=' in args[0]:
235+ name, value = args[0].split('=')
236+ args[0]= name
237+ args.append(value)
238+ else:
239+ raise self.InvalidCmd('set command requires at least two argument.')
240+
241+ if args[1].strip() == '=':
242+ args.pop(1)
243+
244+ valid = ['max_weight','seed','curr_dir', 'spinmode']
245 if args[0] not in self.options and args[0] not in valid:
246 raise self.InvalidCmd('Unknown options %s' % args[0])
247
248@@ -316,6 +332,11 @@
249 elif args[0] == 'curr_dir':
250 if not os.path.isdir(args[1]):
251 raise self.InvalidCmd('second argument should be a path to a existing directory')
252+
253+ elif args[0] == "spinmode":
254+ if args[1].lower() not in ["full", "bridge", "none"]:
255+ raise self.InvalidCmd("spinmode can only take one of those 3 value: full/bridge/none")
256+
257
258
259 def do_set(self, line):
260@@ -324,7 +345,7 @@
261 args = self.split_arg(line)
262 self.check_set(args)
263
264- if args[0] in ['max_weight', 'BW_effect','ms_dir']:
265+ if args[0] in ['max_weight', 'BW_effect','ms_dir', 'spinmode']:
266 self.options[args[0]] = args[1]
267 if args[0] == 'ms_dir':
268 self.options['curr_dir'] = self.options['ms_dir']
269@@ -346,7 +367,7 @@
270
271 # Format
272 if len(args) == 1:
273- opts = self.options.keys() + ['seed']
274+ opts = self.options.keys() + ['seed', "spinmode"]
275 return self.list_completion(text, opts)
276 elif len(args) == 2:
277 if args[1] == 'BW_effect':
278@@ -357,7 +378,9 @@
279 curr_path = pjoin(*[a for a in args \
280 if a.endswith(os.path.sep)])
281 return self.path_completion(text, curr_path, only_dirs = True)
282-
283+ elif args[1] == "spinmode":
284+ return self.list_completion(text, ["full", "none"], line)
285+
286 def help_set(self):
287 """help the set command"""
288
289@@ -373,6 +396,8 @@
290 print ' It has a period of 2**19937-1.'
291 print ' - set max_running_process VALUE: allow to limit the number of open file used by the code'
292 print ' The number of running is raising like 2*VALUE'
293+ print ' - set spinmode=none: mode with simple file merging. No spin correlation attempt.'
294+ print ' This mode allows 3 (and more) body decay.'
295
296 def do_define(self, line):
297 """ """
298@@ -419,6 +444,11 @@
299 def do_launch(self, line):
300 """end of the configuration launched the code"""
301
302+ if self.options["spinmode"] in ["none"]:
303+ return self.run_bridge(line)
304+ elif self.options["spinmode"] == "bridge":
305+ raise Exception, "Bridge mode not yet available due to lack of validation."
306+
307 if self.options['ms_dir'] and os.path.exists(pjoin(self.options['ms_dir'], 'madspin.pkl')):
308 return self.run_from_pickle()
309
310@@ -463,6 +493,11 @@
311 generate_all.run()
312
313 self.branching_ratio = generate_all.branching_ratio
314+ try:
315+ self.err_branching_ratio = generate_all.err_branching_ratio
316+ except Exception:
317+ self.err_branching_ratio = 0
318+
319 evt_path = self.events_file.name
320 try:
321 self.events_file.close()
322@@ -489,7 +524,7 @@
323 ms_card_to_copy = pjoin(base_path,'madspin_card_for_%s.dat'%evt_name)
324 count = 0
325 while os.path.exists(ms_card_to_copy):
326- count +=1
327+ count += 1
328 ms_card_to_copy = pjoin(base_path,'madspin_card_for_%s_%d.dat'%\
329 (evt_name,count))
330 files.cp(str(ms_card_path),str(ms_card_to_copy))
331@@ -520,11 +555,19 @@
332
333 if not hasattr(self.banner, 'param_card'):
334 self.banner.charge_card('slha')
335+
336+ # Special treatment for the mssm. Convert the param_card to the correct
337+ # format
338+ if self.banner.get('model').startswith('mssm-') or self.banner.get('model')=='mssm':
339+ self.banner.param_card = check_param_card.convert_to_mg5card(\
340+ self.banner.param_card, writting=False)
341+
342 for name, block in self.banner.param_card.items():
343 if name.startswith('decay'):
344 continue
345+
346 orig_block = generate_all.banner.param_card[name]
347- if block != orig_block:
348+ if block != orig_block:
349 raise Exception, """The directory %s is specific to a mass spectrum.
350 Your event file is not compatible with this one. (Different param_card: %s different)
351 orig block:
352@@ -547,6 +590,7 @@
353
354 generate_all.ending_run()
355 self.branching_ratio = generate_all.branching_ratio
356+ self.err_branching_ratio = generate_all.err_branching_ratio
357 evt_path = self.events_file.name
358 try:
359 self.events_file.close()
360@@ -559,6 +603,266 @@
361 if not self.mother:
362 logger.info("Decayed events have been written in %s.gz" % decayed_evt_file)
363
364+ def run_bridge(self, line):
365+ """Run the Bridge Algorithm"""
366+
367+ # 1. Read the event file to check which decay to perform and the number
368+ # of event to generate for each type of particle.
369+ # 2. Generate the events requested
370+ # 3. perform the merge of the events.
371+ # if not enough events. re-generate the missing one.
372+
373+ # First define an utility function for generating events when needed
374+ def generate_events(pdg, nb_event, mg5, restrict_file=None, cumul=False):
375+ """generate new events for this particle
376+ restrict_file allow to only generate a subset of the definition
377+ cumul allow to merge all the definition in one run (add process)
378+ to generate events according to cross-section
379+ """
380+
381+ part = self.model.get_particle(pdg)
382+ name = part.get_name()
383+ out = {}
384+ logger.info("generate %s decay event for particle %s" % (nb_event, name))
385+ if name not in self.list_branches:
386+ return out
387+ for i,proc in enumerate(self.list_branches[name]):
388+ if restrict_file and i not in restrict_file:
389+ continue
390+ decay_dir = pjoin(self.path_me, "decay_%s_%s" %(str(pdg).replace("-","x"),i))
391+ if not os.path.exists(decay_dir):
392+ if cumul:
393+ mg5.exec_cmd("generate %s" % proc)
394+ for j,proc2 in enumerate(self.list_branches[name][1:]):
395+ if restrict_file and j not in restrict_file:
396+ raise Exception # Do not see how this can happen
397+ mg5.exec_cmd("add process %s" % proc2)
398+ mg5.exec_cmd("output %s -f" % decay_dir)
399+ else:
400+ mg5.exec_cmd("generate %s" % proc)
401+ mg5.exec_cmd("output %s -f" % decay_dir)
402+ options = dict(mg5.options)
403+ import madgraph.interface.madevent_interface as madevent_interface
404+ me5_cmd = madevent_interface.MadEventCmdShell(me_dir=os.path.realpath(\
405+ decay_dir), options=options)
406+ me5_cmd.options["automatic_html_opening"] = False
407+ run_card = banner.RunCard(pjoin(decay_dir, "Cards", "run_card.dat"))
408+ run_card["nevents"] = int(1.2*nb_event)
409+ run_card["iseed"] = self.seed
410+ run_card.write(pjoin(decay_dir, "Cards", "run_card.dat"))
411+ self.seed += 1
412+ me5_cmd.exec_cmd("generate_events run_01 -f")
413+ me5_cmd.exec_cmd("exit")
414+ out[i] = lhe_parser.EventFile(pjoin(decay_dir, "Events", 'run_01', 'unweighted_events.lhe.gz'))
415+ if cumul:
416+ break
417+
418+ return out
419+
420+
421+ args = self.split_arg(line)
422+
423+ #0. Define the path where to write the file
424+ self.path_me = os.path.realpath(self.options['curr_dir'])
425+ if self.options['ms_dir']:
426+ self.path_me = os.path.realpath(self.options['ms_dir'])
427+ if not os.path.exists(self.path_me):
428+ os.mkdir(self.path_me)
429+ else:
430+ # cleaning
431+ for name in glob.glob(pjoin(self.path_me, "decay_*_*")):
432+ shutil.rmtree(name)
433+
434+ self.events_file.close()
435+ orig_lhe = lhe_parser.EventFile(self.events_file.name)
436+
437+ to_decay = collections.defaultdict(int)
438+ nb_event = 0
439+ for event in orig_lhe:
440+ nb_event +=1
441+ for particle in event:
442+ if particle.status == 1 and particle.pdg in self.final_state:
443+ # final state and tag as to decay
444+ to_decay[particle.pdg] += 1
445+
446+ # Handle the banner of the output file
447+ if not self.seed:
448+ import random
449+ self.seed = random.randint(0, int(30081*30081))
450+ self.do_set('seed %s' % self.seed)
451+ logger.info('Will use seed %s' % self.seed)
452+ self.history.insert(0, 'set seed %s' % self.seed)
453+
454+ if self.seed > 30081*30081: # can't use too big random number
455+ msg = 'Random seed too large ' + str(self.seed) + ' > 30081*30081'
456+ raise Exception, msg
457+
458+ self.options['seed'] = self.seed
459+
460+ text = '%s\n' % '\n'.join([ line for line in self.history if line])
461+ self.banner.add_text('madspin' , text)
462+
463+
464+ # 2. Generate the events requested
465+ with misc.MuteLogger(["madgraph", "madevent", "ALOHA", "cmdprint"], [50,50,50,50]):
466+ mg5 = self.mg5cmd
467+ modelpath = self.model.get('modelpath')
468+ mg5.exec_cmd("import model %s" % modelpath)
469+ to_event = {}
470+ for pdg, nb_needed in to_decay.items():
471+ #check if a splitting is needed
472+ if nb_needed == nb_event:
473+ to_event[pdg] = generate_events(pdg, nb_needed, mg5)
474+ elif nb_needed % nb_event == 0:
475+ nb_mult = nb_needed // nb_event
476+ part = self.model.get_particle(pdg)
477+ name = part.get_name()
478+ if name not in self.list_branches:
479+ continue
480+ elif len(self.list_branches[name]) == nb_mult:
481+ to_event[pdg] = generate_events(pdg, nb_event, mg5)
482+ else:
483+ to_event[pdg] = generate_events(pdg, nb_needed, mg5, cumul=True)
484+ else:
485+ part = self.model.get_particle(pdg)
486+ name = part.get_name()
487+ if name not in self.list_branches or len(self.list_branches[name]) == 0:
488+ continue
489+ raise self.InvalidCmd("The bridge mode of MadSpin does not support event files where events do not *all* share the same set of final state particles to be decayed.")
490+
491+
492+
493+
494+ # Compute the branching ratio.
495+ br = 1
496+ for (pdg, event_files) in to_event.items():
497+ if not event_files:
498+ continue
499+ totwidth = float(self.banner.get('param', 'decay', abs(pdg)).value)
500+ if to_decay[pdg] == nb_event:
501+ # Exactly one particle of this type to decay by event
502+ pwidth = sum([event_files[k].cross for k in event_files])
503+ if pwidth > 1.01 * totwidth:
504+ logger.critical("Branching ratio larger than one for %s " % pdg)
505+ br *= pwidth / totwidth
506+ elif to_decay[pdg] % nb_event == 0:
507+ # More than one particle of this type to decay by event
508+ # Need to check the number of event file to check if we have to
509+ # make separate type of decay or not.
510+ nb_mult = to_decay[pdg] // nb_event
511+ if nb_mult == len(event_files):
512+ for k in event_files:
513+ pwidth = event_files[k].cross
514+ if pwidth > 1.01 * totwidth:
515+ logger.critical("Branching ratio larger than one for %s " % pdg)
516+ br *= pwidth / totwidth
517+ br *= math.factorial(nb_mult)
518+ else:
519+ pwidth = sum(event_files[k].cross for k in event_files)
520+ if pwidth > 1.01 * totwidth:
521+ logger.critical("Branching ratio larger than one for %s " % pdg)
522+ br *= (pwidth / totwidth)**nb_mult
523+ else:
524+ raise self.InvalidCmd("The bridge mode of MadSpin does not support event files where events do not *all* share the same set of final state particles to be decayed.")
525+ self.branching_ratio = br
526+ # modify the cross-section in the init block of the banner
527+ self.banner.scale_init_cross(self.branching_ratio)
528+
529+
530+ # 3. Merge the various file together.
531+ output_lhe = lhe_parser.EventFile(orig_lhe.name.replace('.lhe', '_decayed.lhe.gz'), 'w')
532+ self.banner.write(output_lhe, close_tag=False)
533+
534+ # initialise object which store not use event due to wrong helicity
535+ bufferedEvents_decay = {}
536+ for pdg in to_event:
537+ bufferedEvents_decay[pdg] = [{}] * len(to_event[pdg])
538+
539+ import time
540+ start = time.time()
541+ counter = 0
542+ orig_lhe.seek(0)
543+ for event in orig_lhe:
544+ if counter and counter % 1000 == 0 and float(str(counter)[1:]) ==0:
545+ print "decaying event number %s [%s s]" % (counter, time.time()-start)
546+ counter +=1
547+
548+ # use random order for particles to avoid systematics when more than
549+ # one type of decay is asked.
550+ particles = [p for p in event if int(p.status) == 1.0]
551+ random.shuffle(particles)
552+ ids = [particle.pid for particle in particles]
553+ for i,particle in enumerate(particles):
554+ # check if we need to decay the particle
555+ if particle.pdg not in self.final_state or particle.pdg not in to_event:
556+ continue # nothing to do for this particle
557+ # check how the decay need to be done
558+ nb_decay = len(to_event[particle.pdg])
559+ if nb_decay == 0:
560+ continue #nothing to do for this particle
561+ if nb_decay == 1:
562+ decay_file = to_event[particle.pdg][0]
563+ decay_file_nb = 0
564+ elif ids.count(particle.pdg) == nb_decay:
565+ decay_file = to_event[particle.pdg][ids[:i].count(particle.pdg)]
566+ decay_file_nb = ids[:i].count(particle.pdg)
567+ else:
568+ #need to select the file according to the associate cross-section
569+ r = random.random()
570+ tot = sum(events.cross for events in to_event[particle.pdg])
571+ r = r * tot
572+ cumul = 0
573+ for j,events in enumerate(to_event[particle.pdg]):
574+ cumul += events.cross
575+ if r < cumul:
576+ decay_file = events
577+ decay_file_nb = j
578+ else:
579+ break
580+
581+ # ok start the procedure
582+ helicity = particle.helicity
583+ bufferedEvents = bufferedEvents_decay[particle.pdg][decay_file_nb]
584+
585+ # now that we have the file to read. find the associate event
586+ # checks if we have one event in memory
587+ if helicity in bufferedEvents and bufferedEvents[helicity]:
588+ decay = bufferedEvents[helicity].pop()
589+ else:
590+ # read the event file up to completion
591+ while 1:
592+ try:
593+ decay = decay_file.next()
594+ except StopIteration:
595+ # check how far we are
596+ ratio = counter / nb_event
597+ needed = 1.05 * to_decay[particle.pdg]/ratio - counter
598+ needed = min(1000, max(needed, 1000))
599+ with misc.MuteLogger(["madgraph", "madevent", "ALOHA", "cmdprint"], [50,50,50,50]):
600+ new_file = generate_events(particle.pdg, needed, mg5, [decay_file_nb])
601+ to_event[particle.pdg].update(new_file)
602+ decay_file = to_event[particle.pdg][decay_file_nb]
603+ continue
604+ if helicity == decay[0].helicity or helicity==9 or \
605+ self.options["spinmode"] == "none":
606+ break # use that event
607+ # not valid event store it for later
608+ if helicity not in bufferedEvents:
609+ bufferedEvents[helicity] = [decay]
610+ elif len(bufferedEvents[helicity]) < 200:
611+ # only add to the buffering if the buffer is not too large
612+ bufferedEvents[helicity].append(decay)
613+ # now that we have the event make the merge
614+ particle.add_decay(decay)
615+ # change the weight associate to the event
616+ event.wgt *= self.branching_ratio
617+ wgts = event.parse_reweight()
618+ for key in wgts:
619+ wgts[key] *= self.branching_ratio
620+ # all particle have been decay if needed
621+ output_lhe.write(str(event))
622+ output_lhe.write('</LesHouchesEvent>\n')
623+
624
625 def load_model(self, name, use_mg_default, complex_mass=False):
626 """load the model"""
627
628=== modified file 'Template/LO/Cards/run_card.dat'
629--- Template/LO/Cards/run_card.dat 2014-07-17 13:34:15 +0000
630+++ Template/LO/Cards/run_card.dat 2015-04-10 09:55:25 +0000
631@@ -19,58 +19,59 @@
632 #*********************************************************************
633 # Tag name for the run (one word) *
634 #*********************************************************************
635- tag_1 = run_tag ! name of the run
636+ %(run_tag)s = run_tag ! name of the run
637 #*********************************************************************
638 # Run to generate the grid pack *
639 #*********************************************************************
640- .false. = gridpack !True = setting up the grid pack
641+ %(gridpack)s = gridpack !True = setting up the grid pack
642 #*********************************************************************
643 # Number of events and rnd seed *
644 # Warning: Do not generate more than 1M events in a single run *
645 # If you want to run Pythia, avoid more than 50k events in a run. *
646 #*********************************************************************
647- 10000 = nevents ! Number of unweighted events requested
648- 0 = iseed ! rnd seed (0=assigned automatically=default))
649+ %(nevents)s = nevents ! Number of unweighted events requested
650+ %(iseed)s = iseed ! rnd seed (0=assigned automatically=default))
651 #*********************************************************************
652 # Collider type and energy *
653 # lpp: 0=No PDF, 1=proton, -1=antiproton, 2=photon from proton, *
654 # 3=photon from electron *
655 #*********************************************************************
656- 1 = lpp1 ! beam 1 type
657- 1 = lpp2 ! beam 2 type
658- 6500 = ebeam1 ! beam 1 total energy in GeV
659- 6500 = ebeam2 ! beam 2 total energy in GeV
660+ %(lpp1)s = lpp1 ! beam 1 type
661+ %(lpp2)s = lpp2 ! beam 2 type
662+ %(ebeam1)s = ebeam1 ! beam 1 total energy in GeV
663+ %(ebeam2)s = ebeam2 ! beam 2 total energy in GeV
664 #*********************************************************************
665 # Beam polarization from -100 (left-handed) to 100 (right-handed) *
666 #*********************************************************************
667- 0 = polbeam1 ! beam polarization for beam 1
668- 0 = polbeam2 ! beam polarization for beam 2
669+ %(polbeam1)s = polbeam1 ! beam polarization for beam 1
670+ %(polbeam2)s = polbeam2 ! beam polarization for beam 2
671 #*********************************************************************
672 # PDF CHOICE: this automatically fixes also alpha_s and its evol. *
673 #*********************************************************************
674- 'nn23lo1' = pdlabel ! PDF set
675- 230000 = lhaid ! if pdlabel=lhapdf, this is the lhapdf number
676+ %(pdlabel)s = pdlabel ! PDF set
677+ %(lhaid)s = lhaid ! if pdlabel=lhapdf, this is the lhapdf number
678 #*********************************************************************
679 # Renormalization and factorization scales *
680 #*********************************************************************
681- F = fixed_ren_scale ! if .true. use fixed ren scale
682- F = fixed_fac_scale ! if .true. use fixed fac scale
683- 91.1880 = scale ! fixed ren scale
684- 91.1880 = dsqrt_q2fact1 ! fixed fact scale for pdf1
685- 91.1880 = dsqrt_q2fact2 ! fixed fact scale for pdf2
686- 1 = scalefact ! scale factor for event-by-event scales
687+ %(fixed_ren_scale)s = fixed_ren_scale ! if .true. use fixed ren scale
688+ %(fixed_fac_scale)s = fixed_fac_scale ! if .true. use fixed fac scale
689+ %(scale)s = scale ! fixed ren scale
690+ %(dsqrt_q2fact1)s = dsqrt_q2fact1 ! fixed fact scale for pdf1
691+ %(dsqrt_q2fact2)s = dsqrt_q2fact2 ! fixed fact scale for pdf2
692+ %(dynamical_scale_choice)s = dynamical_scale_choice ! Select one of the preselect dynamical choice
693+ %(scalefact)s = scalefact ! scale factor for event-by-event scales
694 #*********************************************************************
695 # Matching - Warning! ickkw > 1 is still beta
696 #*********************************************************************
697- 0 = ickkw ! 0 no matching, 1 MLM, 2 CKKW matching
698- 1 = highestmult ! for ickkw=2, highest mult group
699- 1 = ktscheme ! for ickkw=1, 1 Durham kT, 2 Pythia pTE
700- 1 = alpsfact ! scale factor for QCD emission vx
701- F = chcluster ! cluster only according to channel diag
702- T = pdfwgt ! for ickkw=1, perform pdf reweighting
703- 5 = asrwgtflavor ! highest quark flavor for a_s reweight
704- T = clusinfo ! include clustering tag in output
705- 3.0 = lhe_version ! Change the way clustering information pass to shower.
706+ %(ickkw)s = ickkw ! 0 no matching, 1 MLM, 2 CKKW matching
707+ %(highestmult)s = highestmult ! for ickkw=2, highest mult group
708+ %(ktscheme)s = ktscheme ! for ickkw=1, 1 Durham kT, 2 Pythia pTE
709+ %(alpsfact)s = alpsfact ! scale factor for QCD emission vx
710+ %(chcluster)s = chcluster ! cluster only according to channel diag
711+ %(pdfwgt)s = pdfwgt ! for ickkw=1, perform pdf reweighting
712+ %(asrwgtflavor)s = asrwgtflavor ! highest quark flavor for a_s reweight
713+ %(clusinfo)s = clusinfo ! include clustering tag in output
714+ %(lhe_version)s = lhe_version ! Change the way clustering information pass to shower.
715 #*********************************************************************
716 #**********************************************************
717 #
718@@ -78,25 +79,25 @@
719 # Automatic ptj and mjj cuts if xqcut > 0
720 # (turn off for VBF and single top processes)
721 #**********************************************************
722- T = auto_ptj_mjj ! Automatic setting of ptj and mjj
723+ %(auto_ptj_mjj)s = auto_ptj_mjj ! Automatic setting of ptj and mjj
724 #**********************************************************
725 #
726 #**********************************
727 # BW cutoff (M+/-bwcutoff*Gamma)
728 #**********************************
729- 15 = bwcutoff ! (M+/-bwcutoff*Gamma)
730+ %(bwcutoff)s = bwcutoff ! (M+/-bwcutoff*Gamma)
731 #**********************************************************
732 # Apply pt/E/eta/dr/mij cuts on decay products or not
733 # (note that etmiss/ptll/ptheavy/ht/sorted cuts always apply)
734 #**********************************************************
735- T = cut_decays ! Cut decay products
736+ %(cut_decays)s = cut_decays ! Cut decay products
737 #*************************************************************
738 # Number of helicities to sum per event (0 = all helicities)
739 # 0 gives more stable result, but longer run time (needed for
740 # long decay chains e.g.).
741 # Use >=2 if most helicities contribute, e.g. pure QCD.
742 #*************************************************************
743- 0 = nhel ! Number of helicities used per event
744+ %(nhel)s = nhel ! Number of helicities used per event
745 #*******************
746 # Standard Cuts
747 #*******************
748@@ -104,159 +105,157 @@
749 #*********************************************************************
750 # Minimum and maximum pt's (for max, -1 means no cut) *
751 #*********************************************************************
752- 20 = ptj ! minimum pt for the jets
753- 0 = ptb ! minimum pt for the b
754- 10 = pta ! minimum pt for the photons
755- 10 = ptl ! minimum pt for the charged leptons
756- 0 = misset ! minimum missing Et (sum of neutrino's momenta)
757- 0 = ptheavy ! minimum pt for one heavy final state
758- 1.0 = ptonium ! minimum pt for the quarkonium states
759- -1 = ptjmax ! maximum pt for the jets
760- -1 = ptbmax ! maximum pt for the b
761- -1 = ptamax ! maximum pt for the photons
762- -1 = ptlmax ! maximum pt for the charged leptons
763- -1 = missetmax ! maximum missing Et (sum of neutrino's momenta)
764+ %(ptj)s = ptj ! minimum pt for the jets
765+ %(ptb)s = ptb ! minimum pt for the b
766+ %(pta)s = pta ! minimum pt for the photons
767+ %(ptl)s = ptl ! minimum pt for the charged leptons
768+ %(misset)s = misset ! minimum missing Et (sum of neutrino's momenta)
769+ %(ptheavy)s = ptheavy ! minimum pt for one heavy final state
770+ %(ptjmax)s = ptjmax ! maximum pt for the jets
771+ %(ptbmax)s = ptbmax ! maximum pt for the b
772+ %(ptamax)s = ptamax ! maximum pt for the photons
773+ %(ptlmax)s = ptlmax ! maximum pt for the charged leptons
774+ %(missetmax)s = missetmax ! maximum missing Et (sum of neutrino's momenta)
775 #*********************************************************************
776 # Minimum and maximum E's (in the center of mass frame) *
777 #*********************************************************************
778- 0 = ej ! minimum E for the jets
779- 0 = eb ! minimum E for the b
780- 0 = ea ! minimum E for the photons
781- 0 = el ! minimum E for the charged leptons
782- -1 = ejmax ! maximum E for the jets
783- -1 = ebmax ! maximum E for the b
784- -1 = eamax ! maximum E for the photons
785- -1 = elmax ! maximum E for the charged leptons
786+ %(ej)s = ej ! minimum E for the jets
787+ %(eb)s = eb ! minimum E for the b
788+ %(ea)s = ea ! minimum E for the photons
789+ %(el)s = el ! minimum E for the charged leptons
790+ %(ejmax)s = ejmax ! maximum E for the jets
791+ %(ebmax)s = ebmax ! maximum E for the b
792+ %(eamax)s = eamax ! maximum E for the photons
793+ %(elmax)s = elmax ! maximum E for the charged leptons
794 #*********************************************************************
795 # Maximum and minimum absolute rapidity (for max, -1 means no cut) *
796 #*********************************************************************
797- 5 = etaj ! max rap for the jets
798- -1 = etab ! max rap for the b
799- 2.5 = etaa ! max rap for the photons
800- 2.5 = etal ! max rap for the charged leptons
801- 0.6 = etaonium ! max rap for the quarkonium states
802- 0 = etajmin ! min rap for the jets
803- 0 = etabmin ! min rap for the b
804- 0 = etaamin ! min rap for the photons
805- 0 = etalmin ! main rap for the charged leptons
806+ %(etaj)s = etaj ! max rap for the jets
807+ %(etab)s = etab ! max rap for the b
808+ %(etaa)s = etaa ! max rap for the photons
809+ %(etal)s = etal ! max rap for the charged leptons
810+ %(etajmin)s = etajmin ! min rap for the jets
811+ %(etabmin)s = etabmin ! min rap for the b
812+ %(etaamin)s = etaamin ! min rap for the photons
813+ %(etalmin)s = etalmin ! main rap for the charged leptons
814 #*********************************************************************
815 # Minimum and maximum DeltaR distance *
816 #*********************************************************************
817- 0.4 = drjj ! min distance between jets
818- 0 = drbb ! min distance between b's
819- 0.4 = drll ! min distance between leptons
820- 0.4 = draa ! min distance between gammas
821- 0 = drbj ! min distance between b and jet
822- 0.4 = draj ! min distance between gamma and jet
823- 0.4 = drjl ! min distance between jet and lepton
824- 0 = drab ! min distance between gamma and b
825- 0 = drbl ! min distance between b and lepton
826- 0.4 = dral ! min distance between gamma and lepton
827- -1 = drjjmax ! max distance between jets
828- -1 = drbbmax ! max distance between b's
829- -1 = drllmax ! max distance between leptons
830- -1 = draamax ! max distance between gammas
831- -1 = drbjmax ! max distance between b and jet
832- -1 = drajmax ! max distance between gamma and jet
833- -1 = drjlmax ! max distance between jet and lepton
834- -1 = drabmax ! max distance between gamma and b
835- -1 = drblmax ! max distance between b and lepton
836- -1 = dralmax ! maxdistance between gamma and lepton
837+ %(drjj)s = drjj ! min distance between jets
838+ %(drbb)s = drbb ! min distance between b's
839+ %(drll)s = drll ! min distance between leptons
840+ %(draa)s = draa ! min distance between gammas
841+ %(drbj)s = drbj ! min distance between b and jet
842+ %(draj)s = draj ! min distance between gamma and jet
843+ %(drjl)s = drjl ! min distance between jet and lepton
844+ %(drab)s = drab ! min distance between gamma and b
845+ %(drbl)s = drbl ! min distance between b and lepton
846+ %(dral)s = dral ! min distance between gamma and lepton
847+ %(drjjmax)s = drjjmax ! max distance between jets
848+ %(drbbmax)s = drbbmax ! max distance between b's
849+ %(drllmax)s = drllmax ! max distance between leptons
850+ %(draamax)s = draamax ! max distance between gammas
851+ %(drbjmax)s = drbjmax ! max distance between b and jet
852+ %(drajmax)s = drajmax ! max distance between gamma and jet
853+ %(drjlmax)s = drjlmax ! max distance between jet and lepton
854+ %(drabmax)s = drabmax ! max distance between gamma and b
855+ %(drblmax)s = drblmax ! max distance between b and lepton
856+ %(dralmax)s = dralmax ! maxdistance between gamma and lepton
857 #*********************************************************************
858 # Minimum and maximum invariant mass for pairs *
859 # WARNING: for four lepton final state mmll cut require to have *
860 # different lepton masses for each flavor! *
861 #*********************************************************************
862- 0 = mmjj ! min invariant mass of a jet pair
863- 0 = mmbb ! min invariant mass of a b pair
864- 0 = mmaa ! min invariant mass of gamma gamma pair
865- 0 = mmll ! min invariant mass of l+l- (same flavour) lepton pair
866- -1 = mmjjmax ! max invariant mass of a jet pair
867- -1 = mmbbmax ! max invariant mass of a b pair
868- -1 = mmaamax ! max invariant mass of gamma gamma pair
869- -1 = mmllmax ! max invariant mass of l+l- (same flavour) lepton pair
870+ %(mmjj)s = mmjj ! min invariant mass of a jet pair
871+ %(mmbb)s = mmbb ! min invariant mass of a b pair
872+ %(mmaa)s = mmaa ! min invariant mass of gamma gamma pair
873+ %(mmll)s = mmll ! min invariant mass of l+l- (same flavour) lepton pair
874+ %(mmjjmax)s = mmjjmax ! max invariant mass of a jet pair
875+ %(mmbbmax)s = mmbbmax ! max invariant mass of a b pair
876+ %(mmaamax)s = mmaamax ! max invariant mass of gamma gamma pair
877+ %(mmllmax)s = mmllmax ! max invariant mass of l+l- (same flavour) lepton pair
878 #*********************************************************************
879 # Minimum and maximum invariant mass for all letpons *
880 #*********************************************************************
881- 0 = mmnl ! min invariant mass for all letpons (l+- and vl)
882- -1 = mmnlmax ! max invariant mass for all letpons (l+- and vl)
883+ %(mmnl)s = mmnl ! min invariant mass for all letpons (l+- and vl)
884+ %(mmnlmax)s = mmnlmax ! max invariant mass for all letpons (l+- and vl)
885 #*********************************************************************
886 # Minimum and maximum pt for 4-momenta sum of leptons *
887 #*********************************************************************
888- 0 = ptllmin ! Minimum pt for 4-momenta sum of leptons(l and vl)
889- -1 = ptllmax ! Maximum pt for 4-momenta sum of leptons(l and vl)
890+ %(ptllmin)s = ptllmin ! Minimum pt for 4-momenta sum of leptons(l and vl)
891+ %(ptllmax)s = ptllmax ! Maximum pt for 4-momenta sum of leptons(l and vl)
892 #*********************************************************************
893 # Inclusive cuts *
894 #*********************************************************************
895- 0 = xptj ! minimum pt for at least one jet
896- 0 = xptb ! minimum pt for at least one b
897- 0 = xpta ! minimum pt for at least one photon
898- 0 = xptl ! minimum pt for at least one charged lepton
899+ %(xptj)s = xptj ! minimum pt for at least one jet
900+ %(xptb)s = xptb ! minimum pt for at least one b
901+ %(xpta)s = xpta ! minimum pt for at least one photon
902+ %(xptl)s = xptl ! minimum pt for at least one charged lepton
903 #*********************************************************************
904 # Control the pt's of the jets sorted by pt *
905 #*********************************************************************
906- 0 = ptj1min ! minimum pt for the leading jet in pt
907- 0 = ptj2min ! minimum pt for the second jet in pt
908- 0 = ptj3min ! minimum pt for the third jet in pt
909- 0 = ptj4min ! minimum pt for the fourth jet in pt
910- -1 = ptj1max ! maximum pt for the leading jet in pt
911- -1 = ptj2max ! maximum pt for the second jet in pt
912- -1 = ptj3max ! maximum pt for the third jet in pt
913- -1 = ptj4max ! maximum pt for the fourth jet in pt
914- 0 = cutuse ! reject event if fails any (0) / all (1) jet pt cuts
915+ %(ptj1min)s = ptj1min ! minimum pt for the leading jet in pt
916+ %(ptj2min)s = ptj2min ! minimum pt for the second jet in pt
917+ %(ptj3min)s = ptj3min ! minimum pt for the third jet in pt
918+ %(ptj4min)s = ptj4min ! minimum pt for the fourth jet in pt
919+ %(ptj1max)s = ptj1max ! maximum pt for the leading jet in pt
920+ %(ptj2max)s = ptj2max ! maximum pt for the second jet in pt
921+ %(ptj3max)s = ptj3max ! maximum pt for the third jet in pt
922+ %(ptj4max)s = ptj4max ! maximum pt for the fourth jet in pt
923+ %(cutuse)s = cutuse ! reject event if fails any (0) / all (1) jet pt cuts
924 #*********************************************************************
925 # Control the pt's of leptons sorted by pt *
926 #*********************************************************************
927- 0 = ptl1min ! minimum pt for the leading lepton in pt
928- 0 = ptl2min ! minimum pt for the second lepton in pt
929- 0 = ptl3min ! minimum pt for the third lepton in pt
930- 0 = ptl4min ! minimum pt for the fourth lepton in pt
931- -1 = ptl1max ! maximum pt for the leading lepton in pt
932- -1 = ptl2max ! maximum pt for the second lepton in pt
933- -1 = ptl3max ! maximum pt for the third lepton in pt
934- -1 = ptl4max ! maximum pt for the fourth lepton in pt
935+ %(ptl1min)s = ptl1min ! minimum pt for the leading lepton in pt
936+ %(ptl2min)s = ptl2min ! minimum pt for the second lepton in pt
937+ %(ptl3min)s = ptl3min ! minimum pt for the third lepton in pt
938+ %(ptl4min)s = ptl4min ! minimum pt for the fourth lepton in pt
939+ %(ptl1max)s = ptl1max ! maximum pt for the leading lepton in pt
940+ %(ptl2max)s = ptl2max ! maximum pt for the second lepton in pt
941+ %(ptl3max)s = ptl3max ! maximum pt for the third lepton in pt
942+ %(ptl4max)s = ptl4max ! maximum pt for the fourth lepton in pt
943 #*********************************************************************
944 # Control the Ht(k)=Sum of k leading jets *
945 #*********************************************************************
946- 0 = htjmin ! minimum jet HT=Sum(jet pt)
947- -1 = htjmax ! maximum jet HT=Sum(jet pt)
948- 0 = ihtmin !inclusive Ht for all partons (including b)
949- -1 = ihtmax !inclusive Ht for all partons (including b)
950- 0 = ht2min ! minimum Ht for the two leading jets
951- 0 = ht3min ! minimum Ht for the three leading jets
952- 0 = ht4min ! minimum Ht for the four leading jets
953- -1 = ht2max ! maximum Ht for the two leading jets
954- -1 = ht3max ! maximum Ht for the three leading jets
955- -1 = ht4max ! maximum Ht for the four leading jets
956+ %(htjmin)s = htjmin ! minimum jet HT=Sum(jet pt)
957+ %(htjmax)s = htjmax ! maximum jet HT=Sum(jet pt)
958+ %(ihtmin)s = ihtmin !inclusive Ht for all partons (including b)
959+ %(ihtmax)s = ihtmax !inclusive Ht for all partons (including b)
960+ %(ht2min)s = ht2min ! minimum Ht for the two leading jets
961+ %(ht3min)s = ht3min ! minimum Ht for the three leading jets
962+ %(ht4min)s = ht4min ! minimum Ht for the four leading jets
963+ %(ht2max)s = ht2max ! maximum Ht for the two leading jets
964+ %(ht3max)s = ht3max ! maximum Ht for the three leading jets
965+ %(ht4max)s = ht4max ! maximum Ht for the four leading jets
966 #***********************************************************************
967 # Photon-isolation cuts, according to hep-ph/9801442 *
968 # When ptgmin=0, all the other parameters are ignored *
969 # When ptgmin>0, pta and draj are not going to be used *
970 #***********************************************************************
971- 0 = ptgmin ! Min photon transverse momentum
972- 0.4 = R0gamma ! Radius of isolation code
973- 1.0 = xn ! n parameter of eq.(3.4) in hep-ph/9801442
974- 1.0 = epsgamma ! epsilon_gamma parameter of eq.(3.4) in hep-ph/9801442
975- .true. = isoEM ! isolate photons from EM energy (photons and leptons)
976+ %(ptgmin)s = ptgmin ! Min photon transverse momentum
977+ %(r0gamma)s = R0gamma ! Radius of isolation code
978+ %(xn)s = xn ! n parameter of eq.(3.4) in hep-ph/9801442
979+ %(epsgamma)s = epsgamma ! epsilon_gamma parameter of eq.(3.4) in hep-ph/9801442
980+ %(isoem)s = isoEM ! isolate photons from EM energy (photons and leptons)
981 #*********************************************************************
982 # WBF cuts *
983 #*********************************************************************
984- 0 = xetamin ! minimum rapidity for two jets in the WBF case
985- 0 = deltaeta ! minimum rapidity for two jets in the WBF case
986+ %(xetamin)s = xetamin ! minimum rapidity for two jets in the WBF case
987+ %(deltaeta)s = deltaeta ! minimum rapidity for two jets in the WBF case
988 #*********************************************************************
989 # KT DURHAM CUT *
990 #*********************************************************************
991- -1 = ktdurham
992- 0.4 = dparameter
993+ %(ktdurham)s = ktdurham
994+ %(dparameter)s = dparameter
995 #*********************************************************************
996 # maximal pdg code for quark to be considered as a light jet *
997 # (otherwise b cuts are applied) *
998 #*********************************************************************
999- 4 = maxjetflavor ! Maximum jet pdg code
1000+ %(maxjetflavor)s = maxjetflavor ! Maximum jet pdg code
1001 #*********************************************************************
1002 # Jet measure cuts *
1003 #*********************************************************************
1004- 0 = xqcut ! minimum kt jet measure between partons
1005+ %(xqcut)s = xqcut ! minimum kt jet measure between partons
1006 #*********************************************************************
1007 #
1008 #*********************************************************************
1009@@ -265,16 +264,16 @@
1010 # meaningful ONLY if plotted taking matchscale *
1011 # reweighting into account! *
1012 #*********************************************************************
1013- F = use_syst ! Enable systematics studies
1014+ %(use_syst)s = use_syst ! Enable systematics studies
1015 #
1016 #**************************************
1017 # Parameter of the systematics study
1018 # will be used by SysCalc (if installed)
1019 #**************************************
1020 #
1021-0.5 1 2 = sys_scalefact # factorization/renormalization scale factor
1022-0.5 1 2 = sys_alpsfact # \alpha_s emission scale factors
1023-30 50 = sys_matchscale # variation of merging scale
1024+%(sys_scalefact)s = sys_scalefact # factorization/renormalization scale factor
1025+%(sys_alpsfact)s = sys_alpsfact # \alpha_s emission scale factors
1026+%(sys_matchscale)s = sys_matchscale # variation of merging scale
1027 # PDF sets and number of members (0 or none for all members).
1028-CT10nlo.LHgrid = sys_pdf # matching scales
1029+%(sys_pdf)s = sys_pdf # matching scales
1030 # MSTW2008nlo68cl.LHgrid 1 = sys_pdf
1031
1032=== removed file 'Template/LO/Source/PDF/pdfwrap_lhapdf.f'
1033--- Template/LO/Source/PDF/pdfwrap_lhapdf.f 2012-11-07 05:57:53 +0000
1034+++ Template/LO/Source/PDF/pdfwrap_lhapdf.f 1970-01-01 00:00:00 +0000
1035@@ -1,68 +0,0 @@
1036- subroutine pdfwrap
1037- implicit none
1038-C
1039-C INCLUDE
1040-C
1041- include 'pdf.inc'
1042- include '../alfas.inc'
1043- real*8 zmass
1044- data zmass/91.188d0/
1045- Character*150 LHAPath
1046- character*20 parm(20)
1047- double precision value(20)
1048- real*8 alphasPDF
1049- external alphasPDF
1050-
1051-
1052-c-------------------
1053-c START THE CODE
1054-c-------------------
1055-
1056-c initialize the pdf set
1057- call FindPDFPath(LHAPath)
1058- CALL SetPDFPath(LHAPath)
1059- value(1)=lhaid
1060- parm(1)='DEFAULT'
1061- call pdfset(parm,value)
1062- call GetOrderAs(nloop)
1063- nloop=nloop+1
1064- asmz=alphasPDF(zmass)
1065-
1066- return
1067- end
1068-
1069-
1070- subroutine FindPDFPath(LHAPath)
1071-c********************************************************************
1072-c generic subroutine to open the table files in the right directories
1073-c********************************************************************
1074- implicit none
1075-c
1076- Character LHAPath*150,up*3
1077- data up/'../'/
1078- logical exists
1079- integer i
1080-
1081-c first try in the current directory
1082- LHAPath='PDFsets'
1083- Inquire(File=LHAPath, exist=exists)
1084- if(exists)return
1085-c then try one directory up
1086- LHAPath=up//LHAPath
1087- Inquire(File=LHAPath, exist=exists)
1088- if(exists)return
1089-c finally try in the lib directory
1090- LHAPath='lib/PDFsets'
1091- Inquire(File=LHAPath, exist=exists)
1092- if(exists)return
1093- do i=1,6
1094- LHAPath=up//LHAPath
1095- Inquire(File=LHAPath, exist=exists)
1096- if(exists)return
1097- enddo
1098- print*,'Could not find PDFsets directory, quitting'
1099- stop 1
1100-
1101- return
1102- end
1103-
1104
1105=== modified file 'Template/LO/Source/cuts.inc'
1106--- Template/LO/Source/cuts.inc 2014-11-22 14:28:19 +0000
1107+++ Template/LO/Source/cuts.inc 2015-04-10 09:55:25 +0000
1108@@ -26,7 +26,7 @@
1109 REAL*8 DRBJmax,DRAJmax,DRJLmax,DRABmax,DRBLmax,DRALmax
1110 REAL*8 MMJJmax,MMLLmax,MMAAmax,MMBBmax !max inv mass
1111 REAL*8 MMNL,MMNLMAX ! invariant mass of all leptons
1112- REAL*8 cutuse
1113+ integer cutuse
1114 REAL*8 ptj1min,ptj2min,ptj3min,ptj4min
1115 REAL*8 ptj1max,ptj2max,ptj3max,ptj4max
1116 REAL*8 ptl1min,ptl2min,ptl3min,ptl4min
1117
1118=== modified file 'Template/LO/Source/dsample.f'
1119--- Template/LO/Source/dsample.f 2014-11-05 17:34:19 +0000
1120+++ Template/LO/Source/dsample.f 2015-04-10 09:55:25 +0000
1121@@ -76,6 +76,10 @@
1122 integer neventswritten
1123 common /to_eventswritten/ neventswritten
1124
1125+ integer th_nunwgt
1126+ double precision th_maxwgt
1127+ common/theoretical_unwgt_max/th_maxwgt, th_nunwgt
1128+
1129 c
1130 c External
1131 c
1132@@ -105,6 +109,9 @@
1133 if (nsteps .lt. 1) nsteps=1
1134 nwrite = itmax*ncall/nsteps
1135
1136+C Fix for 2>1 process where ndim is 2 and not 1
1137+ ninvar = max(2,ninvar)
1138+
1139 call sample_init(ndim,ncall,itmax,ninvar,nconfigs)
1140 call graph_init
1141 do i=1,itmax
1142@@ -200,24 +207,32 @@
1143 if (chi2 .gt. 1) tsigma=tsigma*sqrt(chi2)
1144 c JA 02/2011 Added twgt to results.dat to allow event generation in
1145 c first iteration for gridpack runs
1146+C OM 02/2015 Added maxwgt (target of the secondary unweight) to allow splitted
1147+C generation of event.
1148 if (icor .eq. 0) then
1149- write(66,'(3e12.5,2i9,i5,i9,e10.3,e12.5,e13.5)')tmean,tsigma,0.0,
1150- & kevent, nw, cur_it-1, nun, nun/max(tmean,1d-99), twgt, trmean
1151+ write(66,'(3e12.5,2i9,i5,i9,e10.3,e12.5,3e13.5,i9)')tmean,tsigma, 0.0,
1152+ & kevent, nw, cur_it-1, nun, nun/max(tmean,1d-99), twgt, trmean,
1153+ & maxwgt, th_maxwgt, th_nunwgt
1154 else
1155- write(66,'(3e12.5,2i9,i5,i9,e10.3,e12.5,e13.5)')tmean,0.0,tsigma,
1156- & kevent, nw, cur_it-1, nun, nun/max(tmean,1d-99), twgt, trmean
1157+ write(66,'(3e12.5,2i9,i5,i9,e10.3,e12.5,3e13.5,i9)')tmean,0.0,tsigma,
1158+ & kevent, nw, cur_it-1, nun, nun/max(tmean,1d-99), twgt, trmean,
1159+ & maxwgt, th_maxwgt, th_nunwgt
1160 endif
1161 c do i=1,cur_it-1
1162 do i=cur_it-itsum,cur_it-1
1163 write(66,'(i4,5e15.5)') i,xmean(i),xsigma(i),xeff(i),xwmax(i),xrmean(i)
1164 enddo
1165+c Write out MadLoop statistics, if any
1166+ call output_run_statistics(66)
1167 flush(66)
1168 close(66, status='KEEP')
1169 else
1170 open(unit=66,file='results.dat',status='unknown')
1171- write(66,'(3e12.5,2i9,i5,i9,3e10.3)')0.,0.,0.,kevent,nw,
1172- & 1,0,0.,0.,0.
1173+ write(66,'(3e12.5,2i9,i5,i9,5e10.3,i9)')0.,0.,0.,kevent,nw,
1174+ & 1,0,0.,0.,0.,0.,0.,0
1175 write(66,'(i4,5e15.5)') 1,0.,0.,0.,0.,0.
1176+c Write out MadLoop statistics, if any
1177+ call output_run_statistics(66)
1178 flush(66)
1179 close(66, status='KEEP')
1180
1181@@ -361,25 +376,31 @@
1182 if (nun .lt. 0) nun=-nun !Case when wrote maximun number allowed
1183 if (chi2 .gt. 1) tsigma=tsigma*sqrt(chi2)
1184 c JA 02/2011 Added twgt to results.dat to allow event generation in
1185-c first iteration for gridpack runs
1186+c first iteration for gridpack runs +02/2015 maxwgt
1187 if (icor .eq. 0) then
1188- write(66,'(3e12.5,2i9,i5,i9,e10.3,e12.5,e13.5)')tmean,tsigma,0.0,
1189- & kevent, nw, cur_it-1, nun, nun/max(tmean,1d-99), twgt,trmean
1190+ write(66,'(3e12.5,2i9,i5,i9,e10.3,e12.5,3e13.5, i9)')tmean,tsigma,0.0,
1191+ & kevent, nw, cur_it-1, nun, nun/max(tmean,1d-99), twgt,trmean,
1192+ & maxwgt, th_maxwgt, th_nunwgt
1193 else
1194- write(66,'(3e12.5,2i9,i5,i9,e10.3,e12.5,e13.5)')tmean,0.0,tsigma,
1195- & kevent, nw, cur_it-1, nun, nun/max(tmean,1d-99), twgt,trmean
1196+ write(66,'(3e12.5,2i9,i5,i9,e10.3,e12.5,3e13.5,i9)')tmean,0.0,tsigma,
1197+ & kevent, nw, cur_it-1, nun, nun/max(tmean,1d-99), twgt,trmean,
1198+ & maxwgt, th_maxwgt, th_nunwgt
1199 endif
1200 c do i=1,cur_it-1
1201 do i=cur_it-itsum,cur_it-1
1202 write(66,'(i4,5e15.5)') i,xmean(i),xsigma(i),xeff(i),xwmax(i),xrmean(i)
1203 enddo
1204+c Write out MadLoop statistics, if any
1205+ call output_run_statistics(66)
1206 flush(66)
1207 close(66, status='KEEP')
1208 else
1209 open(unit=66,file='results.dat',status='unknown')
1210- write(66,'(3e12.5,2i9,i5,i9,3e10.3)')0.,0.,0.,kevent,nw,
1211- & 1,0,0.,0.,0.
1212+ write(66,'(3e12.5,2i9,i5,i9,5e10.3,i9)')0.,0.,0.,kevent,nw,
1213+ & 1,0,0.,0.,0.,0.,0.,0
1214 write(66,'(i4,5e15.5)') 1,0.,0.,0.,0.,0.
1215+c Write out MadLoop statistics, if any
1216+ call output_run_statistics(66)
1217 flush(66)
1218 close(66, status='KEEP')
1219
1220@@ -387,6 +408,71 @@
1221
1222 end
1223
1224+ subroutine output_run_statistics(outUnit)
1225+c***********************************************************************
1226+c Writes out the madloop runtime statistics to the unit in argument
1227+c***********************************************************************
1228+ use StringCast
1229+ implicit none
1230+c
1231+c Arguments
1232+c
1233+ integer outUnit
1234+C
1235+C Local
1236+C
1237+ double precision t_after
1238+c
1239+c Global
1240+c
1241+ INTEGER U_RETURN_CODES(0:9)
1242+ INTEGER T_RETURN_CODES(0:9)
1243+ INTEGER H_RETURN_CODES(0:9)
1244+ DOUBLE PRECISION AVG_TIMING
1245+ DOUBLE PRECISION MAX_PREC, MIN_PREC
1246+ INTEGER N_EVALS
1247+ DATA U_RETURN_CODES/10*0/
1248+ DATA T_RETURN_CODES/10*0/
1249+ DATA H_RETURN_CODES/10*0/
1250+ DATA MAX_PREC /-1.0d0/
1251+ DATA MIN_PREC /1.0d99/
1252+ DATA AVG_TIMING/0.0d0/
1253+ DATA N_EVALS/0/
1254+ COMMON/MADLOOPSTATS/AVG_TIMING,MAX_PREC,MIN_PREC,N_EVALS,
1255+ & U_RETURN_CODES,T_RETURN_CODES,H_RETURN_CODES
1256+
1257+ DOUBLE PRECISION CUMULATED_TIMING
1258+ DATA CUMULATED_TIMING/0.0d0/
1259+ COMMON/GENERAL_STATS/CUMULATED_TIMING
1260+
1261+c-----
1262+c Begin Code
1263+c-----
1264+ call cpu_time(t_after)
1265+ CUMULATED_TIMING = t_after - CUMULATED_TIMING
1266+
1267+ if (N_EVALS.eq.0) then
1268+ return
1269+ endif
1270+
1271+ write(outUnit,*) '<run_statistics> '
1272+ write(outUnit,33) '<u_return_code>',U_RETURN_CODES,'</u_return_code>'
1273+ write(outUnit,33) '<t_return_code>',T_RETURN_CODES,'</t_return_code>'
1274+ write(outUnit,33) '<h_return_code>',H_RETURN_CODES,'</h_return_code>'
1275+ write(outUnit,*) '<average_time>'//trim(toStr_real(AVG_TIMING))
1276+ & //'</average_time>'
1277+ write(outUnit,*) '<cumulated_time>'//trim(toStr_real(CUMULATED_TIMING))
1278+ & //'</cumulated_time>'
1279+ write(outUnit,*) '<max_prec>'//trim(toStr_real(MAX_PREC))//'</max_prec>'
1280+ write(outUnit,*) '<min_prec>'//trim(toStr_real(MIN_PREC))//'</min_prec>'
1281+ write(outUnit,*) '<n_evals>'//trim(toStr_int(N_EVALS))//'</n_evals>'
1282+ write(outUnit,*) '</run_statistics>'
1283+
1284+33 FORMAT( a15,i12,',',i12',',i12',',i12',',i12',
1285+ & ',i12',',i12',',i12',',i12',',i12,a16)
1286+
1287+ end subroutine
1288+
1289 subroutine sample_writehtm()
1290 c***********************************************************************
1291 c Writes out results of run in html format
1292@@ -473,6 +559,7 @@
1293 c
1294 include 'genps.inc'
1295 include 'maxconfigs.inc'
1296+ include 'run.inc'
1297 c
1298 c Arguments
1299 c
1300@@ -482,9 +569,13 @@
1301 c Local
1302 c
1303 integer i, j
1304+ integer get_maxsproc
1305 c
1306 c Global
1307 c
1308+ double precision force_max_wgt
1309+ common/unwgt_secondary_max/force_max_wgt
1310+
1311 integer nsteps
1312 character*40 result_file,where_file
1313 common /sample_status/result_file,where_file,nsteps
1314@@ -510,12 +601,20 @@
1315 logical flat_grid
1316 common/to_readgrid/flat_grid !Tells if grid read from file
1317
1318+ double precision twgt, maxwgt,swgt(maxevents)
1319+ integer lun, nw, itminx
1320+ common/to_unwgt/twgt, maxwgt, swgt, lun, nw, itminx
1321+
1322 integer icor
1323 common/to_correlated/icor
1324
1325 logical zooming
1326 common /to_zoomchoice/zooming
1327
1328+ logical read_grid_file
1329+ data read_grid_file/.False./
1330+ common/read_grid_file/read_grid_file
1331+
1332 data use_cut/2/ !Grid: 0=fixed , 1=standard, 2=non-zero
1333 data ituple/1/ !1=htuple, 2=sobel
1334 data Minvar(1,1)/-1/ !No special variable mapping
1335@@ -615,11 +714,12 @@
1336 c
1337 flat_grid=.true.
1338 open(unit=25,file='ftn25',status='unknown',err=102)
1339- read(25,fmt='(4f20.17)', err=101, end=101)
1340- . ((grid(2,i,j),i=1,ng),j=1,maxinvar)
1341-c write(*,*) 'Got the grid OK, now getting alpha'
1342-c read(25,fmt='(4f20.17)',err=101,end=101)(alpha(i),i=1,maxconfigs)
1343+ read(25,*, err=1011, end=1012)
1344+ . ((grid(2,i,j),i=1,ng),j=1,invar)
1345+ read(25,*) twgt, force_max_wgt
1346+ call read_discrete_grids(25)
1347 write(*,*) 'Grid read from file'
1348+ read_grid_file=.true.
1349 flat_grid=.false.
1350 close(25)
1351 c
1352@@ -650,14 +750,21 @@
1353 enddo
1354 endif
1355 goto 103
1356+ 1011 write(*,*) 'fail to open file'
1357+ goto 101
1358+ 1012 write(*,*) 'fail to read data'
1359+ goto 101
1360 101 close(25)
1361 c write(*,*) 'Tried reading it',i,j
1362 102 write(*,*) 'Error opening grid'
1363+
1364 c
1365 c Unable to read grid, using uniform grid and equal points in
1366 c each configuration
1367 c
1368- write(*,*) 'Using Uniform Grid!'
1369+ read_grid_file=.false.
1370+ write(*,*) 'Using Uniform Grid!', maxinvar
1371+ force_max_wgt = -1d0
1372 do j = 1, maxinvar
1373 do i = 1, ng
1374 grid(2, i, j) = xgmin+ (xgmax-xgmin)*(i / dble(ng))**1
1375@@ -674,6 +781,14 @@
1376 c write(*,*) 'Forwarding random number generator'
1377
1378 103 write(*,*) 'Grid defined OK'
1379+
1380+C sanity check that we have a minimal number of event
1381+ if ( MC_GROUPED_SUBPROC )then
1382+ events = max(events, maxtries)
1383+ else
1384+ events = max(events, 2*maxtries*get_maxsproc())
1385+ endif
1386+
1387 end
1388
1389 subroutine setgrid(j,xo,a,itype)
1390@@ -848,6 +963,97 @@
1391 endif
1392 end
1393
1394+ subroutine write_discrete_grids(stream_id, grid_type)
1395+c************************************************************************
1396+c Write out the grid using the DiscreteSampler module
1397+c************************************************************************
1398+ use DiscreteSampler
1399+ implicit none
1400+ integer, intent(in) :: stream_id
1401+ character(len=*) :: grid_type
1402+ logical MC_grouped_subproc
1403+ common/to_MC_grouped_subproc/MC_grouped_subproc
1404+ INTEGER ISUM_HEL
1405+ LOGICAL MULTI_CHANNEL
1406+ COMMON/TO_MATRIX/ISUM_HEL, MULTI_CHANNEL
1407+c
1408+c Begin code
1409+c
1410+
1411+ if (ISUM_HEL.ne.0.and.DS_get_dim_status('Helicity').ge.1) then
1412+ call DS_write_grid(stream_id, dim_name='Helicity',
1413+ & grid_type=grid_type)
1414+ elseif(ISUM_HEL.eq.0)then
1415+ call write_good_hel(stream_id)
1416+ endif
1417+
1418+
1419+
1420+ if(MC_grouped_subproc.and.
1421+ & DS_get_dim_status('grouped_processes').ge.1) then
1422+ call DS_write_grid(stream_id, dim_name='grouped_processes',
1423+ & grid_type=grid_type)
1424+ endif
1425+
1426+ end subroutine write_discrete_grids
1427+
1428+ subroutine read_discrete_grids(stream_id)
1429+c************************************************************************
1430+c Write out the grid using the DiscreteSampler module
1431+c************************************************************************
1432+ use DiscreteSampler
1433+ implicit none
1434+ integer, intent(in) :: stream_id
1435+ INTEGER ISUM_HEL
1436+ LOGICAL MULTI_CHANNEL
1437+ COMMON/TO_MATRIX/ISUM_HEL, MULTI_CHANNEL
1438+
1439+ if (ISUM_HEL.eq.0)then
1440+ call read_good_hel(stream_id)
1441+ endif
1442+ call DS_load_grid(stream_id)
1443+
1444+ end subroutine read_discrete_grids
1445+
1446+ subroutine sample_get_discrete_x(wgt,picked_bin,iconfig,dim_name)
1447+c************************************************************************
1448+c Returns maxdim random numbers between 0 and 1, and the wgt
1449+c associated with this set of points, and the iteration number
1450+c This routine chooses the point within the range specified by
1451+c xmin and xmax for dimension j in configuration ipole
1452+c************************************************************************
1453+ use DiscreteSampler
1454+
1455+ implicit none
1456+ include 'genps.inc'
1457+C Subroutine arguments
1458+ integer picked_bin
1459+ character(len=*) dim_name
1460+ real*8 wgt
1461+C This variable iconfig is what corresponds to ipole in sample_get_x
1462+C and is used for random number generation
1463+ integer iconfig
1464+C Local variables
1465+ real*8 jacobian
1466+ real*8 rdm
1467+ integer dummy
1468+c
1469+c Begin code
1470+c
1471+C Fetch a random number bewteen 0.0 and 1.0
1472+c The fourth argument is not used and therefore a dummy
1473+ dummy = 0
1474+ call ntuple(rdm,0.0d0,1.0d0,dummy,iconfig)
1475+C Pick a point using the DiscreteSampler module
1476+ CALL DS_get_point(dim_name, rdm, picked_bin, jacobian, 'norm')
1477+C Store the helicity sampling jacobian so that it can be divided out
1478+c of wgt later when adding an entry to the DiscreteSampler helicity
1479+c grid. Also we don't want to multiply wgt by it yet since this is
1480+c taken care of at the level of matrix<i> already.
1481+ hel_jacobian = jacobian
1482+
1483+ end subroutine sample_get_discrete_x
1484+
1485 subroutine sample_get_x(wgt, x, j, ipole, xmin, xmax)
1486 c************************************************************************
1487 c Returns maxdim random numbers between 0 and 1, and the wgt
1488@@ -1168,6 +1374,93 @@
1489
1490 end
1491
1492+C
1493+C Subroutine to take care of the update of the discrete grids
1494+C (used for helicity and the matrix<i> choice in the grouped case
1495+C as implented in the DiscreteSampler module.
1496+C
1497+ subroutine add_entry_to_discrete_dimensions(wgt)
1498+ use DiscreteSampler
1499+ implicit none
1500+c
1501+c Constants
1502+c
1503+ include 'genps.inc'
1504+c
1505+c Arguments
1506+c
1507+ double precision wgt
1508+c
1509+c Local
1510+c
1511+c
1512+c Global
1513+c
1514+ INTEGER ISUM_HEL
1515+ LOGICAL MULTI_CHANNEL
1516+ COMMON/TO_MATRIX/ISUM_HEL, MULTI_CHANNEL
1517+ logical cutsdone, cutspassed
1518+ COMMON/TO_CUTSDONE/CUTSDONE,CUTSPASSED
1519+c
1520+c Begin code
1521+c
1522+c It is important to divide the wgt stored in the grid by the
1523+c corresponding jacobian otherwise it flattens the sampled
1524+c distribution.
1525+C Also, if HEL_PICKED is equal to -1, it means that MadEvent
1526+C is in the initialization stage where all helicity were probed
1527+c and added individually to the grid directly by matrix<i>.f so
1528+c that they shouldn't be added here.
1529+ if(ISUM_HEL.ne.0.and.HEL_PICKED.ne.-1.and.
1530+ & (.NOT.CUTSDONE.or.CUTSPASSED)) then
1531+ call DS_add_entry('Helicity',HEL_PICKED,(wgt/hel_jacobian))
1532+ endif
1533+
1534+ end subroutine add_entry_to_discrete_dimensions
1535+
1536+C
1537+C Subroutine to take care of the update of the discrete grids
1538+C (used for helicity and the matrix<i> choice in the grouped case
1539+C as implented in the DiscreteSampler module.
1540+C
1541+ subroutine update_discrete_dimensions()
1542+ use DiscreteSampler
1543+ implicit none
1544+c
1545+c Constants
1546+c
1547+ include 'genps.inc'
1548+c
1549+c Arguments
1550+c
1551+c
1552+c Local
1553+c
1554+ type(SampledDimension) tmp_dim
1555+c
1556+c Global
1557+c
1558+ INTEGER ISUM_HEL
1559+ LOGICAL MULTI_CHANNEL
1560+ COMMON/TO_MATRIX/ISUM_HEL, MULTI_CHANNEL
1561+ logical MC_grouped_subproc
1562+ common/to_MC_grouped_subproc/MC_grouped_subproc
1563+c
1564+c Begin code
1565+c
1566+ if(ISUM_HEL.ne.0) then
1567+ call DS_update_grid('Helicity', filterZeros=.True.)
1568+ tmp_dim = DS_get_dimension(ref_grid,'Helicity')
1569+C Security in case of all helicity vanishing (G1 of gg > qq )
1570+ if (size(tmp_dim%bins).eq.0) then
1571+ call none_pass(-1)
1572+ endif
1573+ endif
1574+ if(MC_grouped_subproc.and.DS_get_dim_status('grouped_processes').ne.-1) then
1575+ call DS_update_grid('grouped_processes', filterZeros=.True.)
1576+ endif
1577+
1578+ end subroutine update_discrete_dimensions
1579
1580 subroutine sample_put_point(wgt, point, iteration,ipole)
1581 c**************************************************************************
1582@@ -1190,12 +1483,12 @@
1583 c
1584 c Local
1585 c
1586- integer i, j, k, knt, non_zero, nun,itsum
1587+ integer i, j, k, knt, nun,itsum
1588 double precision vol,xnmin,xnmax,tot,xdum,tmp1,chi2tmp
1589 double precision rc, dr, xo, xn, x(maxinvar), dum(ng-1)
1590 save vol,knt
1591 double precision chi2
1592- save chi2, non_zero
1593+ save chi2
1594 double precision wmax1,ddumb
1595 save wmax1
1596 double precision twgt1,xchi2,xxmean,tmeant,tsigmat
1597@@ -1211,6 +1504,13 @@
1598 c
1599 c Global
1600 c
1601+ integer th_nunwgt
1602+ double precision th_maxwgt
1603+ common/theoretical_unwgt_max/th_maxwgt, th_nunwgt
1604+
1605+ double precision force_max_wgt
1606+ common/unwgt_secondary_max/force_max_wgt
1607+
1608 double precision accur
1609 common /to_accuracy/accur
1610
1611@@ -1221,8 +1521,8 @@
1612 common/to_result/mean,rmean,sigma
1613
1614 double precision grid2(0:ng,maxinvar)
1615- integer inon_zero(ng,maxinvar)
1616- common/to_grid2/grid2,inon_zero
1617+ integer inon_zero(ng,maxinvar), non_zero
1618+ common/to_grid2/grid2,inon_zero,non_zero
1619
1620 double precision tmean, trmean, tsigma
1621 integer dim, events, itm, kn, cur_it, invar, configs
1622@@ -1275,6 +1575,7 @@
1623 c-----
1624 c Begin Code
1625 c-----
1626+
1627 if (first_time) then
1628 first_time = .false.
1629 twgt1 = 0d0 !
1630@@ -1305,6 +1606,27 @@
1631 endif
1632
1633 if (iteration .eq. cur_it) then
1634+c Add the current point to the DiscreteSamplerGrid
1635+ call add_entry_to_discrete_dimensions(wgt)
1636+ if (kn.eq.0) then
1637+ ! ensure that all cumulative variable are at zero (usefull for reset)
1638+ twgt1 = 0d0 !
1639+ iavg = 0 !Vars for averging to increase err estimate
1640+ navg = 1 !
1641+ wmax1= 99d99
1642+ wmax = -1d0
1643+ mean = 0d0
1644+ rmean = 0d0
1645+ sigma = 0d0
1646+ chi2 = 0d0
1647+ non_zero = 0
1648+ vol = 1d0 / dble(events * itm)
1649+ knt = events
1650+ do i=1,maxconfigs
1651+ psect(i)=0d0
1652+ enddo
1653+ endif
1654+
1655 kn = kn + 1
1656 if (.true.) then !Average points to increase error estimate
1657 twgt1=twgt1+dabs(wgt) !This doesn't change anything should remove
1658@@ -1389,11 +1711,37 @@
1659 c Now if done with an iteration, print out stats, rebin, reset
1660 c
1661 c if (kn .eq. events) then
1662- if (kn .ge. max_events .and. non_zero .lt. 5) then
1663+ if (kn .ge. max_events .and. non_zero .le. 5) then
1664 call none_pass(max_events)
1665 endif
1666 if (non_zero .eq. events .or. (kn .gt. 200*events .and.
1667 $ non_zero .gt. 5)) then
1668+
1669+c # special mode where we store information to combine them
1670+ if(use_cut.eq.-2)then
1671+ open(unit=22, file="grid_information")
1672+ write(22,*) non_zero, ng, invar
1673+ write(22,*) ((grid(1,i,j),i=1,ng),j=1,invar)
1674+ write(22,*) ((grid(2,i,j),i=1,ng),j=1,invar)
1675+ write(22,*) ((inon_zero(i,j),i=1,ng),j=1,invar)
1676+ write(22,*) (xmin(j), j=1,invar)
1677+ write(22,*) (xmax(j), j=1,invar)
1678+ write(22,*) mean, rmean, sigma, wmax, kn,events, force_max_wgt
1679+c In order not to write out the reference grid but just
1680+c the points which were added for this last iteration,
1681+c we write out the discrete 'running' grids before the
1682+c update of the reference grid.
1683+ call write_discrete_grids(22,'all')
1684+ close(22)
1685+ endif
1686+
1687+C
1688+C Now updated the discrete dimensions of the DiscreteSampler module
1689+C used for sampling helicity configurations and matrix<i> config
1690+C choice in the grouped case.
1691+C
1692+ call update_discrete_dimensions()
1693+
1694 mean=mean*dble(events)/dble(non_zero)
1695 rmean=rmean*dble(events)/dble(non_zero)
1696 twgt1=twgt1*dble(events)/dble(non_zero)
1697@@ -1420,6 +1768,7 @@
1698 sigma = (sigma/vol/vol-non_zero*mean*mean*navg) !knt replaced by non_zero
1699 . / dble(knt-1) / dble(knt)
1700 else
1701+
1702 sigma = (sigma/vol/vol - knt*mean*mean)
1703 . / dble(knt-1) / dble(knt)
1704 endif
1705@@ -1511,13 +1860,16 @@
1706 c & wmax*(dble(non_zero)/dble(kn)),
1707 c & dble(non_zero)/dble(kn)*100.,'%'
1708 c close(22)
1709+
1710 c------
1711 c Here we will double the number of events requested for the next run
1712 c-----
1713 23 events = 2 * events
1714 vol = 1d0/dble(events*itm)
1715 knt = events
1716- twgt = mean / (dble(itm)*dble(events))
1717+ if (use_cut.ne.-2) then
1718+ twgt = mean / (dble(itm)*dble(events))
1719+ endif
1720 c write(*,*) 'New number of events',events,twgt
1721
1722 mean = 0d0
1723@@ -1526,12 +1878,13 @@
1724 cur_it = cur_it + 1
1725 kn = 0
1726 wmax = -1d0
1727+
1728 c
1729 c do so adjusting of weights according to number of events in bin
1730 c
1731 do j=1,invar
1732 do i = 1, ng
1733- if (use_cut .ne. 2 .and.
1734+ if (abs(use_cut) .ne. 2 .and.
1735 & use_cut .ne. 3 .and. use_cut .ne. 5)
1736 $ inon_zero(i,j) = 0
1737 if (use_cut .eq. 3) grid(1,i,j)=grid2(i,j)
1738@@ -1698,7 +2051,11 @@
1739 if (tsigma .gt. 0d0 .and. cur_it .gt. itmin .and. accur .gt. 0d0) then
1740
1741 xxmean = tmean/tsigma
1742- xchi2 = (chi2/xxmean/xxmean-tsigma)/dble(cur_it-2)
1743+ if (cur_it.ne.2)then
1744+ xchi2 = (chi2/xxmean/xxmean-tsigma)/dble(cur_it-2)
1745+ else
1746+ xchi2 = 0d0
1747+ endif
1748 write(*,'(a,4f8.3)') ' Accuracy: ',sqrt(xchi2/tsigma),
1749 & accur,1/sqrt(tsigma),xchi2
1750 c write(*,*) 'We got it',1d0/sqrt(tsigma), accur
1751@@ -1716,10 +2073,12 @@
1752 write(*, 80) real(tmean), real(tsigma), real(trmean), real(chi2)
1753 if (use_cut .ne. 0) then
1754 open(26, file='ftn26',status='unknown')
1755- write(26,fmt='(4f20.17)')
1756- $ ((grid(2,i,j),i=1,ng),j=1,maxinvar)
1757- write(26,fmt='(4f20.17)') (alpha(i),i=1,maxconfigs)
1758- close(26)
1759+ write(26,fmt='(4f21.17)')
1760+ $ ((grid(2,i,j),i=1,ng),j=1,invar)
1761+ write(26,*) twgt, force_max_wgt
1762+c write(26,fmt='(4f21.16)') (alpha(i),i=1,maxconfigs)
1763+ call write_discrete_grids(26,'ref')
1764+ close(26)
1765 endif
1766 call sample_writehtm()
1767 c open(unit=22,file=result_file,status='old',
1768@@ -1727,7 +2086,11 @@
1769 c write(22, 80) real(tmean), real(tsigma), real(chi2)
1770 c 122 close(22)
1771 tsigma = tsigma*sqrt(chi2) !This gives the 68% confidence cross section
1772- call store_events
1773+ if (use_cut.eq.-2)then
1774+ call store_events(force_max_wgt, .False.)
1775+ else
1776+ call store_events(-1d0, .True.)
1777+ endif
1778 cur_it = itm+2
1779 return
1780 endif
1781@@ -1742,7 +2105,12 @@
1782 c
1783 c nun = n_unwgted()
1784 c write(*,*) 'Estimated events',nun, accur
1785- call store_events
1786+ if (use_cut.eq.-2) then
1787+ call store_events(force_max_wgt, .False.)
1788+ else
1789+ call store_events(-1d0, .True.)
1790+ endif
1791+
1792 nun = neventswritten
1793 c tmp1 = tmean / tsigma
1794 c chi2tmp = (chi2/tmp1/tmp1-tsigma)/dble(cur_it-2)
1795@@ -1775,9 +2143,11 @@
1796 write(*, 80) real(tmean), real(tsigma), real(chi2)
1797 if (use_cut .ne. 0) then
1798 open(26, file='ftn26',status='unknown')
1799- write(26,fmt='(4f20.17)')
1800- $ ((grid(2,i,j),i=1,ng),j=1,maxinvar)
1801- write(26,fmt='(4f20.17)') (alpha(i),i=1,maxconfigs)
1802+ write(26,fmt='(4f21.17)')
1803+ $ ((grid(2,i,j),i=1,ng),j=1,invar)
1804+ write(26,*) twgt, force_max_wgt
1805+c write(26,fmt='(4f21.17)') (alpha(i),i=1,maxconfigs)
1806+ call write_discrete_grids(26,'ref')
1807 close(26)
1808 endif
1809 call sample_writehtm()
1810@@ -1794,7 +2164,11 @@
1811
1812
1813 if (cur_it .gt. itm) then
1814- call store_events
1815+ if (use_cut.eq.-2)then
1816+ call store_events(force_max_wgt, .False.)
1817+ else
1818+ call store_events(-1d0, .True.)
1819+ endif
1820 tmean = tmean / tsigma
1821 trmean = trmean / tsigma
1822 chi2 = (chi2 / tmean / tmean - tsigma) / dble(itm - 1)
1823@@ -1806,9 +2180,11 @@
1824 . 13X,21HChi**2 per DoF. =,f12.4/1X,79(1H-))
1825 if (use_cut .ne. 0) then
1826 open(26, file='ftn26',status='unknown')
1827- write(26,fmt='(4f20.17)')
1828- $ ((grid(2,i,j),i=1,ng),j=1,maxinvar)
1829- write(26,fmt='(4f20.17)') (alpha(i),i=1,maxconfigs)
1830+ write(26,fmt='(4f21.17)')
1831+ $ ((grid(2,i,j),i=1,ng),j=1,invar)
1832+ write(26,*) twgt, force_max_wgt
1833+ call write_discrete_grids(26,'ref')
1834+c write(26,fmt='(4f21.17)') (alpha(i),i=1,maxconfigs)
1835 close(26)
1836 endif
1837 call sample_writehtm()
1838@@ -1867,9 +2243,11 @@
1839 222 format(a10,I3,3x,a6,e10.4,a16,e10.3,e12.3,3x,f5.1,a1)
1840
1841 open(unit=66,file='results.dat',status='unknown')
1842- write(66,'(3e12.5,2i9,i5,i9,3e10.3)')0.,0.,0.,0,0,
1843- & 0,1,0.,0.,0.
1844+ write(66,'(3e12.5,2i9,i5,i9,5e10.3,i9)')0.,0.,0.,0,0,
1845+ & 0,1,0.,0.,0.,0.,0.,0
1846 write(66,'(i4,5e15.5)') 1,0.,0.,0.,0.,0.
1847+c Write out MadLoop statistics, if any
1848+ call output_run_statistics(66)
1849 flush(66)
1850 close(66, status='KEEP')
1851
1852@@ -1879,6 +2257,10 @@
1853 write(67,*)
1854 close(67)
1855
1856+ open(unit=67, file='grid_information')
1857+ write(67,*) ''
1858+ close(67)
1859+
1860 stop
1861 end
1862
1863@@ -1912,7 +2294,7 @@
1864 c Begin Code
1865 c-----
1866 kmax=k
1867- do i=k+1,ng-1
1868+ do i=k+1,ng
1869 if (grid(1,i,j) .gt. 0d0) kmax=i
1870 enddo
1871 xo = grid(1,k,j)
1872@@ -1929,7 +2311,7 @@
1873 end do
1874 c grid(1, ng, j) = (xn + xo) / 2d0 !Original without kmax stuff
1875 grid(1, kmax, j) = (xn + xo) / 2d0
1876- x(j) = x(j) + grid(1, ng, j)
1877+ x(j) = x(j) + grid(1, kmax, j)
1878 end
1879
1880 double precision function xbin(y,j)
1881@@ -2097,5 +2479,44 @@
1882 return
1883 end
1884
1885+ subroutine reset_cumulative_variable()
1886+C Reset to zero all the variable which evaluates the cross-section.
1887+C grid information for the current-grid/non-zero entry/...
1888+C This is used to avoid the (small) bias introduce in the first iteration
1889+C Due to the initialization of the helicity sum.
1890+ implicit none
1891+ include 'genps.inc'
1892+
1893+ double precision grid2(0:ng,maxinvar)
1894+ integer inon_zero(ng,maxinvar), non_zero
1895+ common/to_grid2/grid2,inon_zero, non_zero
1896+ double precision grid(2, ng, 0:maxinvar)
1897+ common /data_grid/ grid
1898+
1899+ double precision tmean, trmean, tsigma
1900+ integer dim, events, itm, kn, cur_it, invar, configs
1901+ common /sample_common/
1902+ . tmean, trmean, tsigma, dim, events, itm, kn, cur_it, invar, configs
1903+
1904+
1905+C LOCAL
1906+ integer i,j
1907+
1908+ write(*,*) "RESET CUMULATIVE VARIABLE"
1909+ non_zero = 0
1910+ do j=1,maxinvar
1911+ do i=1,ng -1
1912+ inon_zero = 0
1913+ grid2(i,j) = 0
1914+ grid(1,i,j) = 0
1915+ enddo
1916+ enddo
1917+ tmean = 0.0
1918+ trmean = 0.0
1919+ tsigma = 0.0
1920+ kn = 0
1921+ return
1922+ end
1923+
1924
1925
1926
1927=== modified file 'Template/LO/Source/gen_ximprove.f'
1928--- Template/LO/Source/gen_ximprove.f 2013-12-09 02:09:49 +0000
1929+++ Template/LO/Source/gen_ximprove.f 2015-04-10 09:55:25 +0000
1930@@ -262,6 +262,7 @@
1931 double precision xt(lmaxconfigs),elimit
1932 double precision yerr,ysec,rerr
1933 logical fopened
1934+
1935 c-----
1936 c Begin Code
1937 c-----
1938@@ -424,6 +425,10 @@
1939 c write(26,15) 'if [[ "$PBS_O_WORKDIR" != "" ]]; then'
1940 c write(26,15) ' cd $PBS_O_WORKDIR'
1941 c write(26,15) 'fi'
1942+ write(26,15) 'if [[ -e MadLoop5_resources.tar.gz && ! -e MadLoop5_resources ]]; then'
1943+ write(26,15) 'tar -xzf MadLoop5_resources.tar.gz'
1944+ write(26,15) 'fi'
1945+
1946 write(26,15) 'k=run1_app.log'
1947 write(lun,15) 'script=' // fname
1948 c write(lun,15) 'rm -f wait.$script >& /dev/null'
1949@@ -613,9 +618,9 @@
1950 c
1951 mjobs = (goal_lum*xsec(io(np))*1000 / MaxEventsPerJob + 0.9)
1952 c write(*,*) "Working on Channel ",i,io(np),xt(np), goal_lum*xsec(io(np))*1000 /maxeventsperjob
1953- if (mjobs .gt. 26) then
1954+ if (mjobs .gt. 130) then
1955 write(*,*) 'Error in gen_ximprove.f, too many events requested ',mjobs*maxeventsperjob
1956- mjobs=26
1957+ mjobs=130
1958 endif
1959 if (mjobs .lt. 1 .or. .not. split_channels) mjobs=1
1960 c
1961@@ -651,9 +656,24 @@
1962
1963 ip = index(gn(io(np)),'/')
1964 if (mjobs .gt. 1) then
1965- write(26,'(3a)') 'j=',gn(io(np))(1:ip-1),cjobs(ijob:ijob)
1966+
1967+ if (ip.eq.3) then
1968+ write(26,'(a2,a2,a,i1)') 'j=',gn(io(np))(1:ip-1),cjobs(MODULO(ijob-1,26)+1:MODULO(ijob-1,26)+1),
1969+ & ijob/26
1970+ else if(ip.eq.4) then
1971+ write(26,'(a2,a3,a,i1)') 'j=',gn(io(np))(1:ip-1),cjobs(MODULO(ijob-1,26)+1:MODULO(ijob-1,26)+1),
1972+ & ijob/26
1973+ else if(ip.eq.5) then
1974+ write(26,'(a2,a4,a,i1)') 'j=',gn(io(np))(1:ip-1),cjobs(MODULO(ijob-1,26)+1:MODULO(ijob-1,26)+1),
1975+ & ijob/26
1976+ else if(ip.eq.6) then
1977+ write(26,'(a2,a5,a,i1)') 'j=',gn(io(np))(1:ip-1),cjobs(MODULO(ijob-1,26)+1:MODULO(ijob-1,26)+1),
1978+ & ijob/26
1979+ else
1980+ stop 1
1981+ endif
1982 else
1983- write(26,'(3a)') 'j=',gn(io(np))(1:ip-1)
1984+ write(26,'(3a)') 'j=',gn(io(np))(1:ip-1)
1985 endif
1986 c
1987 c Now write the commands
1988
1989=== modified file 'Template/LO/Source/genps.inc'
1990--- Template/LO/Source/genps.inc 2012-04-16 08:48:53 +0000
1991+++ Template/LO/Source/genps.inc 2015-04-10 09:55:25 +0000
1992@@ -32,4 +32,9 @@
1993 REAL*8 LIMHEL
1994 PARAMETER(LIMHEL=1e-6)
1995 INTEGER MAXTRIES
1996- PARAMETER(MAXTRIES=100)
1997+ PARAMETER(MAXTRIES=10)
1998+C To pass the helicity configuration chosen by the DiscreteSampler to
1999+C matrix<i>.f
2000+ double precision hel_jacobian
2001+ INTEGER HEL_PICKED
2002+ COMMON/HEL_PICKED/HEL_PICKED,hel_jacobian
2003
2004=== modified file 'Template/LO/Source/run.inc'
2005--- Template/LO/Source/run.inc 2014-06-27 13:04:42 +0000
2006+++ Template/LO/Source/run.inc 2015-04-10 09:55:25 +0000
2007@@ -6,9 +6,10 @@
2008 c
2009 real*8 scale,scalefact,alpsfact
2010 logical fixed_ren_scale,fixed_fac_scale,fixed_couplings,hmult
2011- integer ickkw,nhmult,asrwgtflavor
2012+ integer ickkw,nhmult,asrwgtflavor, dynamical_scale_choice
2013 common/to_scale/scale,scalefact,alpsfact,fixed_ren_scale,fixed_fac_scale,
2014- $ fixed_couplings,ickkw,nhmult,hmult,asrwgtflavor
2015+ $ fixed_couplings,ickkw,nhmult,hmult,asrwgtflavor,
2016+ $ dynamical_scale_choice
2017 c
2018 c Collider
2019 c
2020@@ -56,3 +57,9 @@
2021 logical clusinfo
2022 double precision lhe_version
2023 COMMON/TO_LHEFORMAT/lhe_version,clusinfo
2024+
2025+c
2026+C Controls wheter to perform Monte-Carlo sampling over grouped subprocesses
2027+C
2028+ logical MC_grouped_subproc
2029+ common/to_MC_grouped_subproc/MC_grouped_subproc
2030
2031=== modified file 'Template/LO/Source/setrun.f'
2032--- Template/LO/Source/setrun.f 2015-01-29 12:27:51 +0000
2033+++ Template/LO/Source/setrun.f 2015-04-10 09:55:25 +0000
2034@@ -77,6 +77,9 @@
2035 c
2036 include 'run_card.inc'
2037
2038+c if no matching ensure that no pdfreweight are done
2039+ if (ickkw.eq.0) pdfwgt = .false.
2040+
2041 q2fact(1) = sf1**2 ! fact scale**2 for pdf1
2042 q2fact(2) = sf2**2 ! fact scale**2 for pdf2
2043
2044
2045=== modified file 'Template/LO/SubProcesses/cuts.f'
2046--- Template/LO/SubProcesses/cuts.f 2014-03-10 17:54:39 +0000
2047+++ Template/LO/SubProcesses/cuts.f 2015-04-10 09:55:25 +0000
2048@@ -1005,13 +1005,15 @@
2049 c Here we cluster event and reset factorization and renormalization
2050 c scales on an event-by-event basis, as well as check xqcut for jets
2051 c
2052- if(xqcut.gt.0d0.or.ickkw.gt.0.or.scale.eq.0.or.q2fact(1).eq.0)then
2053+c Note the following condition is the first line of setclscales
2054+c if(xqcut.gt.0d0.or.ickkw.gt.0.or.scale.eq.0.or.q2fact(1).eq.0)then
2055+c Do not duplicate it since some variable are set for syscalc in the fct
2056 if(.not.setclscales(p))then
2057 if(debug) write (*,*) ' setclscales -> fails'
2058 passcuts=.false.
2059 return
2060 endif
2061- endif
2062+c endif
2063
2064 c Set couplings in model files
2065 if(.not.fixed_ren_scale.or..not.fixed_couplings) then
2066
2067=== modified file 'Template/LO/SubProcesses/genps.f'
2068--- Template/LO/SubProcesses/genps.f 2013-11-05 18:08:13 +0000
2069+++ Template/LO/SubProcesses/genps.f 2015-04-10 09:55:25 +0000
2070@@ -23,6 +23,9 @@
2071 c OUTPUTS: wgt == updated weight after choosing points
2072 c x == points choosen from sample grid
2073 c p == transformed points call is f(p(x))
2074+c COMMON:
2075+c hel_picked == Modified integer in gen_ps.inc to pass the
2076+c chosen helicity configuration to matrix<i>.f
2077 c
2078 c**************************************************************************
2079 implicit none
2080@@ -48,10 +51,18 @@
2081 c
2082 c Global
2083 c
2084+ INTEGER ISUM_HEL
2085+ LOGICAL MULTI_CHANNEL
2086+ COMMON/TO_MATRIX/ISUM_HEL, MULTI_CHANNEL
2087 c-----
2088 c Begin Code
2089 c-----
2090 call gen_mom(iconfig,mincfig,maxcfig,invar,wgt,x,p)
2091+C Pick the helicity configuration from the DiscreteSampler if user
2092+C decided to perform MC over helicity configurations.
2093+ if(ISUM_HEL.ne.0) then
2094+ call sample_get_discrete_x(wgt,hel_picked,iconfig,'Helicity')
2095+ endif
2096 end
2097
2098 subroutine gen_mom(iconfig,mincfig,maxcfig,invar,wgt,x,p1)
2099
2100=== modified file 'Template/LO/SubProcesses/makefile'
2101--- Template/LO/SubProcesses/makefile 2013-11-19 14:23:47 +0000
2102+++ Template/LO/SubProcesses/makefile 2015-04-10 09:55:25 +0000
2103@@ -7,9 +7,19 @@
2104 BINDIR = ../../bin/
2105 PROG = madevent
2106
2107-LINKLIBS = -L../../lib/ -ldhelas -ldsample -lmodel -lgeneric -lpdf -lcernlib $(lhapdf)
2108-
2109-LIBS = $(LIBDIR)libdhelas.$(libext) $(LIBDIR)libdsample.$(libext) $(LIBDIR)libgeneric.$(libext) $(LIBDIR)libpdf.$(libext) $(LIBDIR)libmodel.$(libext) $(LIBDIR)libcernlib.$(libext)
2110+ifneq ("$(wildcard ../MadLoop_makefile_definitions)","")
2111+ include ../MadLoop_makefile_definitions
2112+else
2113+ LINK_LOOP_LIBS =
2114+ LOOP_LIBS =
2115+ LOOP_INCLUDE =
2116+ LINK_MADLOOP_LIB =
2117+ MADLOOP_LIB =
2118+endif
2119+
2120+LINKLIBS = -L../../lib/ -ldsample -lmodel -lgeneric -lpdf -lcernlib $(lhapdf) $(LINK_MADLOOP_LIB) $(LINK_LOOP_LIBS) -L../../lib/ -ldhelas
2121+
2122+LIBS = $(LIBDIR)libdhelas.$(libext) $(LIBDIR)libdsample.$(libext) $(LIBDIR)libgeneric.$(libext) $(LIBDIR)libpdf.$(libext) $(LIBDIR)libmodel.$(libext) $(LIBDIR)libcernlib.$(libext) $(MADLOOP_LIB) $(LOOP_LIBS)
2123
2124 # Source files
2125
2126@@ -18,17 +28,16 @@
2127 idenparts.o \
2128 $(patsubst %.f,%.o,$(wildcard auto_dsig*.f)) \
2129 $(patsubst %.f,%.o,$(wildcard matrix*.f))
2130-SYMMETRY = symmetry.o setcuts.o cuts.o cluster.o myamp.o genps.o \
2131- initcluster.o setscales.o reweight.o get_color.o idenparts.o \
2132- $(patsubst %.f,%.o,$(wildcard matrix*.f))
2133+
2134+SYMMETRY = symmetry.o idenparts.o
2135
2136 # Binaries
2137
2138 $(PROG): $(PROCESS) auto_dsig.o $(LIBS)
2139 $(FC) $(FFLAGS) -o $(PROG) $(PROCESS) $(LINKLIBS)
2140
2141-gensym: $(SYMMETRY) configs.inc $(LIBS)
2142- $(FC) $(FFLAGS) -o gensym $(SYMMETRY) $(LINKLIBS)
2143+gensym: $(SYMMETRY) configs.inc $(LIBDIR)libmodel.$(libext) $(LIBDIR)libgeneric.$(libext)
2144+ $(FC) $(FFLAGS) -o gensym $(SYMMETRY) -L../../lib/ -lmodel -lgeneric
2145
2146 $(LIBDIR)libmodel.$(libext): ../../Cards/param_card.dat
2147 cd ../../Source/MODEL; make
2148@@ -39,12 +48,13 @@
2149 $(LIBDIR)libpdf.$(libext):
2150 cd ../../Source/PDF; make
2151
2152+# Add source so that the compiler finds the DiscreteSampler module.
2153+%.o: %.f
2154+ $(FC) $(FFLAGS) -c $< -I../../Source/
2155+
2156 # Dependencies
2157
2158-driver.f: genps.inc qmass.inc
2159-setcuts.f: qmass.inc
2160-qmass.inc: nexternal.inc
2161- touch qmass.inc
2162+driver.f: genps.inc
2163 symmetry.o: genps.inc nexternal.inc configs.inc run_config.inc
2164 genps.o: genps.inc nexternal.inc configs.inc
2165 cuts.o: genps.inc nexternal.inc pmass.inc
2166
2167=== modified file 'Template/LO/SubProcesses/myamp.f'
2168--- Template/LO/SubProcesses/myamp.f 2015-01-05 14:10:20 +0000
2169+++ Template/LO/SubProcesses/myamp.f 2015-04-10 09:55:25 +0000
2170@@ -651,7 +651,7 @@
2171
2172 write(*,*),'Impossible BW configuration'
2173 open(unit=66,file='results.dat',status='unknown')
2174- write(66,'(3e12.5,2i9,i5,i9,3e10.3)')0.,0.,0.,0,0,1,0,0.,0.,0.
2175+ write(66,'(3e12.5,2i9,i5,i9,4e10.3)')0.,0.,0.,0,0,1,0,0.,0.,0.,0.
2176 write(66,'(i4,5e15.5)') 1,0.,0.,0.,0.,0.
2177 close(66)
2178 end
2179
2180=== added file 'Template/LO/SubProcesses/refine.sh'
2181--- Template/LO/SubProcesses/refine.sh 1970-01-01 00:00:00 +0000
2182+++ Template/LO/SubProcesses/refine.sh 2015-04-10 09:55:25 +0000
2183@@ -0,0 +1,68 @@
2184+#!/bin/bash
2185+
2186+# For support of LHAPATH in cluster mode
2187+if [ $CLUSTER_LHAPATH ]; then
2188+ export LHAPATH=$CLUSTER_LHAPATH;
2189+fi
2190+
2191+if [[ -e MadLoop5_resources.tar.gz && ! -e MadLoop5_resources ]]; then
2192+tar -xzf MadLoop5_resources.tar.gz
2193+fi
2194+k=%(name)s_app.log
2195+script=%(script_name)s
2196+
2197+grid_directory=%(base_directory)s
2198+j=%(directory)s
2199+ if [[ ! -e $j ]]; then
2200+ mkdir $j
2201+ if [[ -e $grid_directory/ftn26 ]];then
2202+ cp $grid_directory/ftn26 $j/ftn25
2203+ fi
2204+ if [[ ! -e ../../SubProcesses ]];then
2205+ if [[ -e ftn26 ]]; then
2206+ cp ./ftn26 $j/ftn25
2207+ fi
2208+ fi
2209+ fi
2210+
2211+ cd $j
2212+ rm -f $k
2213+ rm -f moffset.dat >& /dev/null
2214+ echo %(offset)s > moffset.dat
2215+ if [[ -e ftn26 ]]; then
2216+ cp ftn26 ftn25
2217+ fi
2218+ # create the input file
2219+ echo " %(nevents)s %(maxiter)s %(miniter)s" >& input_sg.txt
2220+ echo " %(precision)s" >> input_sg.txt
2221+ if [[ ! -e ftn25 ]]; then
2222+ echo "2" >> input_sg.txt # grid refinement
2223+ echo "1" >> input_sg.txt # suppress amplitude
2224+
2225+ else
2226+ echo "%(grid_refinment)s" >> input_sg.txt
2227+ echo "1" >> input_sg.txt
2228+ fi
2229+ echo "%(nhel)s" >> input_sg.txt
2230+ echo "%(channel)s" >> input_sg.txt
2231+
2232+ # run the executable. The loop is design to avoid
2233+ # filesystem problem (executable not found)
2234+ for((try=1;try<=16;try+=1));
2235+ do
2236+ ../madevent 2>&1 >> $k <input_sg.txt | tee -a $k;
2237+ if [ -s $k ]
2238+ then
2239+ break
2240+ else
2241+ echo $try > fail.log
2242+ fi
2243+ done
2244+ echo "" >> $k; echo "ls status:" >> $k; ls >> $k
2245+ cat $k >> log.txt
2246+
2247+ if [[ -e ftn26 ]]; then
2248+ cp ftn26 ftn25
2249+ fi
2250+ cd ../
2251+
2252
2253=== added file 'Template/LO/SubProcesses/refine_splitted.sh'
2254--- Template/LO/SubProcesses/refine_splitted.sh 1970-01-01 00:00:00 +0000
2255+++ Template/LO/SubProcesses/refine_splitted.sh 2015-04-10 09:55:25 +0000
2256@@ -0,0 +1,72 @@
2257+#!/bin/bash
2258+
2259+# For support of LHAPATH in cluster mode
2260+if [ $CLUSTER_LHAPATH ]; then
2261+ export LHAPATH=$CLUSTER_LHAPATH;
2262+fi
2263+if [[ -e MadLoop5_resources.tar.gz && ! -e MadLoop5_resources ]]; then
2264+tar -xzf MadLoop5_resources.tar.gz
2265+fi
2266+k=run1_app.log
2267+script=refine_splitted.sh
2268+# Argument
2269+# 1st argument the Directory name
2270+grid_directory=$1;
2271+# 2st argument Directory where to find the grid input
2272+base_directory=$2;
2273+# 3st argument the offset
2274+offset=$3;
2275+
2276+
2277+# prepare the directory where to run
2278+if [[ ! -e $grid_directory ]]; then
2279+ # Do not exists
2280+ mkdir $grid_directory;
2281+else
2282+ rm -rf $grid_directory/$k;
2283+ rm -rf $grid_directory/input_app.txt;
2284+ rm -rf $grid_directory/ftn25;
2285+ rm -rf $grid_directory/ftn26;
2286+fi
2287+# handle input file
2288+if [[ -e $base_directory ]]; then
2289+ cp $base_directory/ftn26 $grid_directory/ftn25;
2290+ cp $base_directory/input_app.txt $grid_directory/input_app.txt;
2291+elif [[ -e ./ftn26 ]]; then
2292+ cp ./ftn26 $grid_directory/ftn25;
2293+ cp ./input_app.txt $grid_directory/input_app.txt;
2294+else
2295+ exit 1;
2296+fi
2297+
2298+# Move to the running directory
2299+cd $grid_directory;
2300+
2301+# Put the correct offset
2302+rm -f moffset.dat >& /dev/null;
2303+echo $offset > moffset.dat;
2304+
2305+# run the executable. The loop is design to avoid
2306+# filesystem problem (executable not found)
2307+for((try=1;try<=16;try+=1));
2308+do
2309+ ../madevent 2>&1 >> $k <input_app.txt | tee -a $k;
2310+ if [ -s $k ]
2311+ then
2312+ break
2313+ else
2314+ echo $try > fail.log
2315+ fi
2316+done
2317+echo "" >> $k; echo "ls status:" >> $k; ls >> $k
2318+# Perform some cleaning to keep less file on disk/transfer less file.
2319+subdir=${grid_directory##*_}
2320+if [[ $subdir -ne 1 && -s results.dat && $MG5DEBUG != true ]]; then
2321+ rm -f ftn25 &> /dev/null
2322+ rm -f ftn26 &> /dev/null
2323+ rm -f log.txt &> /dev/null
2324+ rm -f *.log &> /dev/null
2325+ rm -f moffset.dat &> /dev/null
2326+ rm -f fail.log &> /dev/null
2327+fi
2328+cd ../
2329\ No newline at end of file
2330
2331=== modified file 'Template/LO/SubProcesses/reweight.f'
2332--- Template/LO/SubProcesses/reweight.f 2014-09-09 10:27:43 +0000
2333+++ Template/LO/SubProcesses/reweight.f 2015-04-10 09:55:25 +0000
2334@@ -538,9 +538,18 @@
2335 external isqcd, isjet, isparton, cluster, isjetvx, alphas, ifsno
2336 setclscales=.true.
2337
2338- if(ickkw.le.0.and.xqcut.le.0d0.and.q2fact(1).gt.0.and.scale.gt.0)
2339- $ return
2340-
2341+ if(ickkw.le.0.and.xqcut.le.0d0.and.q2fact(1).gt.0.and.scale.gt.0) then
2342+ if(use_syst)then
2343+ s_scale=scale
2344+ n_qcd=nqcd(iconfig)
2345+ n_alpsem=0
2346+ do i=1,2
2347+ n_pdfrw(i)=0
2348+ enddo
2349+ s_rwfact=1d0
2350+ endif
2351+ return
2352+ endif
2353 c
2354 c Cluster the configuration
2355 c
2356@@ -729,7 +738,7 @@
2357 endif
2358 if(ipart(2,imocl(n)).gt.2)then ! ipart(1) set and not IS line
2359 c The ishft gives the FS particle corresponding to imocl
2360- if(ipdgcl(ishft(1,ipart(2,imocl(n))-1),igraphs(1),iproc).ne.21.and.
2361+ if(ipdgcl(ishft(1,ipart(2,imocl(n))-1),igraphs(1),iproc).ne.21.or.
2362 $ ipdgcl(imocl(n),igraphs(1),iproc).ne.21) then
2363 c The second condition is to prevent the case of ggh where the gluon split in quark later.
2364 c The first quark is already remove so we shouldn't remove this one.
2365@@ -993,7 +1002,7 @@
2366 q2fact(1) = pt2ijcl(jfirst(1))
2367 elseif(jcentral(2).eq.0)then
2368 q2fact(2) = pt2ijcl(jfirst(2))
2369- elseif(ickkw.eq.2.or.pdfwgt)then
2370+ elseif(ickkw.eq.2.or.(pdfwgt.and.ickkw.gt.0))then
2371 c Total pdf weight is f1(x1,pt2E)*fj(x1*z,Q)/fj(x1*z,pt2E)
2372 c f1(x1,pt2E) is given by DSIG, just need to set scale.
2373 c Use the minimum scale found for fact scale in ME
2374@@ -1175,7 +1184,7 @@
2375 write(*,*) 'Set process number ',ipsel
2376 endif
2377
2378- if (use_syst.and.igraphs(1).eq.0) igraphs(1) = 1 ! happens if use_syst=T BUT fix scale
2379+ if (use_syst.and.igraphs(1).eq.0) igraphs(1) = iconfig ! happens if use_syst=T BUT fix scale
2380 c Set incoming particle identities
2381 ipdgcl(1,igraphs(1),iproc)=idup(1,ipsel,iproc)
2382 ipdgcl(2,igraphs(1),iproc)=idup(2,ipsel,iproc)
2383@@ -1197,8 +1206,10 @@
2384 enddo
2385 endif
2386
2387- if(ickkw.le.0) goto 100
2388-
2389+ if(ickkw.le.0)then
2390+ asref=0 ! usefull for syscalc
2391+ goto 100
2392+ endif
2393 c Preparing graph particle information (ipart, needed to keep track of
2394 c external particle clustering scales)
2395 do i=1,nexternal
2396@@ -1210,7 +1221,7 @@
2397 $ max(pt2min,p(0,i)**2-p(1,i)**2-p(2,i)**2-p(3,i)**2)
2398 endif
2399 pt2pdf(ishft(1,i-1))=pt2prev(ishft(1,i-1))
2400- else if(pdfwgt) then
2401+ else if(pdfwgt.and.ickkw.gt.0) then
2402 pt2pdf(ishft(1,i-1))=0d0
2403 endif
2404 ipart(1,ishft(1,i-1))=i
2405@@ -1323,7 +1334,7 @@
2406 endif
2407 endif
2408 endif
2409- if(ickkw.eq.2.or.pdfwgt) then
2410+ if(ickkw.eq.2.or.(pdfwgt.and.ickkw.gt.0)) then
2411 c Perform PDF and, if ickkw=2, Sudakov reweighting
2412 isvx=.false.
2413 do i=1,2
2414@@ -1495,7 +1506,7 @@
2415 if(ickkw.eq.2.and.lpp(1).eq.0.and.lpp(2).eq.0)then
2416 q2fact(1)=pt2min
2417 q2fact(2)=q2fact(1)
2418- else if (ickkw.eq.1.and.pdfwgt) then
2419+ else if (ickkw.gt.0.and.pdfwgt) then
2420 q2fact(1)=q2bck(1)
2421 q2fact(2)=q2bck(2)
2422 if (btest(mlevel,3))
2423@@ -1512,14 +1523,21 @@
2424 c Set reweight factor for systematics studies
2425 if(use_syst)then
2426 s_rwfact = rewgt
2427+
2428 c Need to multiply by: initial PDF, alpha_s^n_qcd to get
2429 c factor in front of matrix element
2430 do i=1,2
2431- s_rwfact=s_rwfact*pdg2pdf(abs(lpp(IB(i))),
2432+ if (lpp(IB(i)).ne.0) then
2433+ s_rwfact=s_rwfact*pdg2pdf(abs(lpp(IB(i))),
2434 $ i_pdgpdf(1,i)*sign(1,lpp(IB(i))),
2435 $ s_xpdf(1,i),s_qpdf(1,i))
2436+ endif
2437 enddo
2438- s_rwfact=s_rwfact*asref**n_qcd
2439+ if (asref.gt.0d0.and.n_qcd.le.nexternal)then
2440+ s_rwfact=s_rwfact*asref**n_qcd
2441+ else
2442+ s_rwfact=0d0
2443+ endif
2444 endif
2445
2446 return
2447
2448=== modified file 'Template/LO/SubProcesses/setcuts.f'
2449--- Template/LO/SubProcesses/setcuts.f 2014-10-07 13:31:57 +0000
2450+++ Template/LO/SubProcesses/setcuts.f 2015-04-10 09:55:25 +0000
2451@@ -110,7 +110,6 @@
2452 c setup masses for the final-state particles
2453 c
2454 include 'pmass.inc'
2455- include 'qmass.inc'
2456
2457 C-----
2458 C BEGIN CODE
2459@@ -185,7 +184,6 @@
2460 c
2461 do i=nincoming+1,nexternal
2462 do_cuts(i)=.true.
2463- if(nincoming.eq.1) do_cuts(i)=.false.
2464 if(.not.cut_decays.and.from_decay(i)) do_cuts(i)=.false.
2465 is_a_j(i)=.false.
2466 is_a_l(i)=.false.
2467@@ -322,7 +320,7 @@
2468 endif
2469 c PHOTON
2470 if(is_a_a(i))then
2471- etmin(i) = max(pta, ptgmin, eamax)
2472+ etmin(i) = max(pta, ptgmin, ea)
2473 SMIN = SMIN + etmin(i)
2474 etmax(i)=ptamax
2475 emin(i)=ea
2476@@ -458,7 +456,7 @@
2477 inclHtmin=ihtmin
2478 inclHtmax=ihtmax
2479
2480- jetor = cutuse.eq.0d0
2481+ jetor = cutuse.eq.0
2482
2483 c
2484 c EXTRA LEPTON CUTS
2485
2486=== modified file 'Template/LO/SubProcesses/setscales.f'
2487--- Template/LO/SubProcesses/setscales.f 2014-05-26 01:30:36 +0000
2488+++ Template/LO/SubProcesses/setscales.f 2015-04-10 09:55:25 +0000
2489@@ -42,8 +42,43 @@
2490 c start
2491 c----------
2492
2493- rscale=0d0
2494-
2495+ if (dynamical_scale_choice.eq.-1) then
2496+c Cluster external states until reducing the system to a 2->2 topology whose transverse mass is used for setting the scale.
2497+c This is not done in this file due to the clustering.
2498+ rscale=0d0
2499+ elseif(dynamical_scale_choice.eq.1) then
2500+c Total transverse energy of the event.
2501+ rscale=0d0
2502+ do i=3,nexternal
2503+ rscale=rscale+et(P(0,i))
2504+ enddo
2505+ elseif(dynamical_scale_choice.eq.2) then
2506+c sum of the transverse mass
2507+c m^2+pt^2=p(0)^2-p(3)^2=(p(0)+p(3))*(p(0)-p(3))
2508+ rscale=0d0
2509+ do i=3,nexternal
2510+ rscale=rscale+dsqrt(max(0d0,(P(0,i)+P(3,i))*(P(0,i)-P(3,i))))
2511+ enddo
2512+ rscale=rscale
2513+ elseif(dynamical_scale_choice.eq.3) then
2514+c sum of the transverse mass divide by 2
2515+c m^2+pt^2=p(0)^2-p(3)^2=(p(0)+p(3))*(p(0)-p(3))
2516+ rscale=0d0
2517+ do i=3,nexternal
2518+ rscale=rscale+dsqrt(max(0d0,(P(0,i)+P(3,i))*(P(0,i)-P(3,i))))
2519+ enddo
2520+ rscale=rscale/2d0
2521+ elseif(dynamical_scale_choice.eq.4) then
2522+c \sqrt(s), partonic energy
2523+ rscale=dsqrt(max(0d0,2d0*dot(P(0,1),P(0,2))))
2524+ elseif(dynamical_scale_choice.eq.0) then
2525+ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
2526+cc USER DEFINE SCALE: ENTER YOUR CODE HERE cc
2527+cc to use this code you need to set cc
2528+cc dymamical_scale_choice to 0 in the run_card cc
2529+ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
2530+ write(*,*) "scale not define by the user"
2531+ stop 21
2532 c
2533 c-some examples of dynamical scales
2534 c
2535@@ -64,36 +99,17 @@
2536
2537 c rscale=sqrt(rscale)
2538
2539-c rscale=rscale*scalefact
2540-
2541-
2542-c---------------------------------------
2543-c-- total transverse energy of the event
2544-c---------------------------------------
2545-c rscale=0d0
2546-c do i=3,nexternal
2547-c rscale=rscale+et(P(0,i))
2548-c enddo
2549-
2550-c--------------------------------------
2551-c-- scale^2 = \sum_i (pt_i^2+m_i^2)
2552-c--------------------------------------
2553-c rscale=0d0
2554-c do i=3,nexternal
2555-c rscale=rscale+pt(P(0,i))**2+dot(p(0,i),p(0,i))
2556-c enddo
2557-c rscale=dsqrt(rscale)
2558-
2559-c--------------------------------------
2560-c-- \sqrt(s): partonic energy
2561-c--------------------------------------
2562-c rscale=dsqrt(2d0*dot(P(0,1),P(0,2)))
2563+
2564+ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
2565+cc USER DEFINE SCALE: END of USER CODE cc
2566+ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
2567+ endif
2568
2569 return
2570 end
2571
2572
2573- subroutine set_fac_scale(P,q2fact)
2574+ subroutine set_fac_scale(P,q2factorization)
2575 c----------------------------------------------------------------------
2576 c This is the USER-FUNCTION to calculate the factorization
2577 c scales^2 on event-by-event basis.
2578@@ -102,15 +118,16 @@
2579
2580 c INCLUDE and COMMON
2581 c
2582-c include 'genps.inc'
2583+ include 'genps.inc'
2584 include 'nexternal.inc'
2585 include 'coupl.inc'
2586+ include 'run.inc'
2587 c--masses and poles
2588 c
2589 c ARGUMENTS
2590 c
2591 REAL*8 P(0:3,nexternal)
2592- real*8 q2fact(2)
2593+ real*8 q2factorization(2)
2594 c
2595 c EXTERNAL
2596 c
2597@@ -126,16 +143,21 @@
2598 c start
2599 c----------
2600
2601-
2602- q2fact(1)=0d0 !factorization scale**2 for pdf1
2603- q2fact(2)=0d0 !factorization scale**2 for pdf2
2604-
2605-c call set_ren_scale(P,q2fact(1))
2606-c
2607-c q2fact(1)=q2fact(1)**2
2608-c
2609-c q2fact(2)=q2fact(1) !factorization scale**2 for pdf2
2610-
2611+ if (dynamical_scale_choice.eq.-1) then
2612+c Cluster external states until reducing the system to a 2->2 topology whose transverse mass is used for setting the scale.
2613+c This is not done in this file due to the clustering.
2614+ q2factorization(1)=0d0 !factorization scale**2 for pdf1
2615+ q2factorization(2)=0d0 !factorization scale**2 for pdf2
2616+ elseif(dynamical_scale_choice.eq.0) then
2617+ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
2618+cc USER DEFINE SCALE: ENTER YOUR CODE HERE cc
2619+cc to use this code you need to set cc
2620+cc dymamical_scale_choice to 0 in the run_card cc
2621+ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
2622+c default: use the renormalization scale
2623+ call set_ren_scale(P,q2factorization(1))
2624+ q2factorization(1)=q2factorization(1)**2
2625+ q2factorization(2)=q2factorization(1) !factorization scale**2 for pdf2
2626
2627 c
2628 c-some examples of dynamical scales
2629@@ -144,26 +166,40 @@
2630 c---------------------------------------
2631 c-- total transverse energy of the event
2632 c---------------------------------------
2633-c q2fact(1)=0d0
2634+c q2factorization(1)=0d0
2635 c do i=3,nexternal
2636-c q2fact(1)= q2fact(1)+et(P(0,i))**2
2637+c q2factorization(1)= q2factorization(1)+et(P(0,i))**2
2638 c enddo
2639-c q2fact(2)=q2fact(1)
2640+c q2factorization(2)=q2factorization(1)
2641
2642 c--------------------------------------
2643 c-- scale^2 = \sum_i (pt_i^2+m_i^2)
2644 c--------------------------------------
2645-c q2fact(1)=0d0
2646+c q2factorization(1)=0d0
2647 c do i=3,nexternal
2648-c q2fact(1)=q2fact(1)+pt(P(0,i))**2+dot(p(0,i),p(0,i))
2649+c q2factorization(1)=q2factorization(1)+pt(P(0,i))**2+dot(p(0,i),p(0,i))
2650 c enddo
2651-c q2fact(2)=q2fact(1)
2652+c q2factorization(2)=q2factorization(1)
2653
2654 c--------------------------------------
2655 c-- \sqrt(s): partonic energy
2656 c--------------------------------------
2657-c q2fact(1)=2d0*dot(P(0,1),P(0,2))
2658-c q2fact(2)=q2fact(1)
2659+c q2factorization(1)=2d0*dot(P(0,1),P(0,2))
2660+c q2factorization(2)=q2factorization(1)
2661+
2662+
2663+
2664+ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
2665+cc USER DEFINE SCALE: END of USER CODE cc
2666+ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
2667+ else
2668+ call set_ren_scale(P,q2factorization(1))
2669+ q2factorization(1)=q2factorization(1)**2
2670+ q2factorization(2)=q2factorization(1) !factorization scale**2 for pdf2
2671+ endif
2672+
2673+
2674+
2675
2676
2677 return
2678
2679=== added file 'Template/LO/SubProcesses/survey.sh'
2680--- Template/LO/SubProcesses/survey.sh 1970-01-01 00:00:00 +0000
2681+++ Template/LO/SubProcesses/survey.sh 2015-04-10 09:55:25 +0000
2682@@ -0,0 +1,78 @@
2683+#!/bin/bash
2684+
2685+# For support of LHAPATH in cluster mode
2686+if [ $CLUSTER_LHAPATH ]; then
2687+ export LHAPATH=$CLUSTER_LHAPATH;
2688+fi
2689+
2690+if [[ -e MadLoop5_resources.tar.gz && ! -e MadLoop5_resources ]]; then
2691+tar -xzf MadLoop5_resources.tar.gz;
2692+fi
2693+
2694+k=run1_app.log;
2695+script=ajob1;
2696+offset=$1;
2697+shift;
2698+subdir=$offset;
2699+for i in $@ ; do
2700+ j=G$i;
2701+ if [[ $offset == *.* ]];then
2702+ subdir=${offset%.*};
2703+ offset=${offset##*.};
2704+ j=G${i}_${subdir};
2705+ elif [[ $offset -gt 0 ]]; then
2706+ j=G${i}_${subdir};
2707+ fi
2708+ if [[ ! -e $j ]]; then
2709+ mkdir $j;
2710+ fi
2711+ cd $j;
2712+ if [[ $offset -eq 0 ]]; then
2713+ rm -f ftn25 ftn26 ftn99;
2714+ rm -f $k;
2715+ else
2716+ echo "$offset" > moffset.dat;
2717+ fi
2718+ if [[ $offset -eq $subdir ]]; then
2719+ rm -f ftn25 ftn26 ftn99;
2720+ rm -f $k;
2721+ else
2722+ if [[ -e ../ftn25 ]]; then
2723+ cp ../ftn25 .;
2724+ fi
2725+ fi
2726+ if [[ ! -e input_app.txt ]]; then
2727+ cat ../input_app.txt >& input_app.txt;
2728+ fi
2729+ echo $i >> input_app.txt;
2730+
2731+ for((try=1;try<=10;try+=1));
2732+ do
2733+ ../madevent 2>&1 >> $k <input_app.txt | tee -a $k;
2734+ if [ -s $k ]
2735+ then
2736+ break;
2737+ else
2738+ sleep 1;
2739+ fi
2740+ done
2741+# rm -f ftn25 ftn99
2742+# rm -f ftn26
2743+ echo "" >> $k; echo "ls status:" >> $k; ls >> $k;
2744+ cp $k log.txt;
2745+# Perform some cleaning to keep less file on disk/transfer less file.
2746+ if [[ $subdir -ne 1 && -s results.dat && $MG5DEBUG -ne true ]]; then
2747+ rm -f ftn25 &> /dev/null
2748+ rm -f ftn26 &> /dev/null
2749+ rm -f log.txt &> /dev/null
2750+ rm -f *.log &> /dev/null
2751+ rm -f moffset.dat &> /dev/null
2752+ fi
2753+ cd ../;
2754+
2755+done;
2756+
2757+# Cleaning
2758+
2759+
2760+
2761
2762=== modified file 'Template/LO/SubProcesses/unwgt.f'
2763--- Template/LO/SubProcesses/unwgt.f 2014-10-07 13:31:57 +0000
2764+++ Template/LO/SubProcesses/unwgt.f 2015-04-10 09:55:25 +0000
2765@@ -133,7 +133,7 @@
2766 c Begin Code
2767 c-----
2768 c write(*,*) 'storing Events'
2769- call store_events
2770+ call store_events(-1d0, .True.)
2771 rewind(lun)
2772 nw = 0
2773 maxwgt = 0d0
2774@@ -213,10 +213,14 @@
2775 endif
2776 end
2777
2778- subroutine store_events()
2779+ subroutine store_events(force_max_wgt, scale_to_xsec)
2780 C**************************************************************************
2781 C Takes events from scratch file (lun) and writes them to a permanent
2782 c file events.dat
2783+c if force_max_weight =-1, then get it automatically (for a given truncation)
2784+c if xscale=0 then the sum of the weight will be reweighted to the cross-section.
2785+c computed from the last 3 iteration. otherwise the weight of each event
2786+c will be multiply by that value.
2787 C**************************************************************************
2788 IMPLICIT NONE
2789 c
2790@@ -228,18 +232,22 @@
2791 c
2792 c Arguments
2793 c
2794+ double precision force_max_wgt
2795+ logical scale_to_xsec
2796 c
2797 c Local
2798 c
2799 integer i, lunw, ic(7,2*nexternal-3), n, j
2800 logical done
2801 double precision wgt,p(0:4,2*nexternal-3)
2802- double precision xsec,xsecabs,xerr,xscale,xtot
2803- double precision xsum, xover
2804- double precision target_wgt,orig_Wgt(maxevents)
2805+ double precision xsec,xsecabs,xerr,xtot
2806+ double precision xsum, xover, target_wgt
2807+ double precision orig_Wgt(maxevents)
2808+ double precision xscale
2809 logical store_event(maxevents)
2810 integer iseed, nover, nstore
2811 double precision scale,aqcd,aqed
2812+ double precision random
2813 integer ievent
2814 character*1000 buff
2815 logical u_syst
2816@@ -255,6 +263,11 @@
2817
2818 integer neventswritten
2819 common /to_eventswritten/ neventswritten
2820+
2821+ integer th_nunwgt
2822+ double precision th_maxwgt
2823+ common/theoretical_unwgt_max/th_maxwgt, th_nunwgt
2824+
2825 c save neventswritten
2826
2827 integer ngroup
2828@@ -273,9 +286,14 @@
2829 c
2830 c First scale all of the events to the total cross section
2831 c
2832+
2833 if (nw .le. 0) return
2834- call sample_result(xsecabs,xsec,xerr,itmin)
2835- if (xsecabs .le. 0) return !Fix by TS 12/3/2010
2836+ if (scale_to_xsec) then
2837+ call sample_result(xsecabs,xsec,xerr,itmin)
2838+ if (xsecabs .le. 0) return !Fix by TS 12/3/2010
2839+ else
2840+ xscale = nw*twgt
2841+ endif
2842 xtot=0
2843 call dsort(nw, swgt)
2844 do i=1,nw
2845@@ -291,12 +309,20 @@
2846 i = i-1
2847 enddo
2848 if (i .lt. nw) i=i+1
2849- target_wgt = dabs(swgt(i))
2850+ th_maxwgt = dabs(swgt(i))
2851+ if ( force_max_wgt.lt.0)then
2852+ target_wgt = dabs(swgt(i))
2853+ else if (.not.scale_to_xsec) then
2854+ target_wgt = force_max_wgt / xscale
2855+ else
2856+ stop 1
2857+ endif
2858 c
2859 c Select events which will be written
2860 c
2861 xsum = 0d0
2862 nstore = 0
2863+ th_nunwgt = 0
2864 rewind(lun)
2865 done = .false.
2866 do i=1,nw
2867@@ -306,16 +332,25 @@
2868 else
2869 wgt = 0d0
2870 endif
2871- if (dabs(wgt) .gt. target_wgt*xran1(iseed)) then
2872+ random = xran1(iseed)
2873+ if (dabs(wgt) .gt. target_wgt*random) then
2874 xsum=xsum+max(dabs(wgt),target_Wgt)
2875 store_event(i)=.true.
2876 nstore=nstore+1
2877 else
2878 store_event(i) = .false.
2879 endif
2880+c we use the same seed for the two evaluation of the unweighting efficiency
2881+ if (dabs(wgt) .gt. th_maxwgt*random) then
2882+ th_nunwgt = th_nunwgt +1
2883+ endif
2884 enddo
2885- xscale = xsecabs/xsum
2886+ if (scale_to_xsec)then
2887+ xscale = xsecabs/xsum
2888+ endif
2889 target_wgt = target_wgt*xscale
2890+ th_maxwgt = th_maxwgt*xscale
2891+
2892 rewind(lun)
2893 c JA 8/17/2011 Don't check for previously stored events
2894 c if (nstore .le. neventswritten) then
2895@@ -351,13 +386,22 @@
2896 enddo
2897 write(*,*) 'Found ',nw,' events.'
2898 write(*,*) 'Wrote ',i ,' events.'
2899- write(*,*) 'Actual xsec ',xsec
2900- write(*,*) 'Correct abs xsec ',xsecabs
2901- write(*,*) 'Event xsec ', xtot
2902+ if (scale_to_xsec)then
2903+ write(*,*) 'Actual xsec ',xsec
2904+ write(*,*) 'Correct abs xsec ',xsecabs
2905+ write(*,*) 'Event xsec ', xtot
2906+ endif
2907 write(*,*) 'Events wgts > 1: ', nover
2908 write(*,*) '% Cross section > 1: ',xover, xover/xtot*100.
2909 neventswritten = i
2910+ maxwgt = target_wgt
2911+ if (force_max_wgt.lt.0)then
2912+ th_maxwgt = target_wgt
2913+ th_nunwgt = neventswritten
2914+ endif
2915+
2916 99 close(lunw)
2917+
2918 c close(lun)
2919 end
2920
2921
2922=== modified file 'Template/LO/bin/madevent'
2923--- Template/LO/bin/madevent 2014-06-29 23:09:00 +0000
2924+++ Template/LO/bin/madevent 2015-04-10 09:55:25 +0000
2925@@ -132,9 +132,14 @@
2926 try:
2927 if __debug__ and options.logging == 'INFO':
2928 options.logging = 'DEBUG'
2929+ if options.logging.isdigit():
2930+ level = int(options.logging)
2931+ else:
2932+ level = eval('logging.' + options.logging)
2933+
2934 logging.config.fileConfig(os.path.join(root_path, 'internal', 'me5_logging.conf'))
2935- logging.root.setLevel(eval('logging.' + options.logging))
2936- logging.getLogger('madgraph').setLevel(eval('logging.' + options.logging))
2937+ logging.root.setLevel(level)
2938+ logging.getLogger('madgraph').setLevel(level)
2939 except:
2940 pass
2941 import internal.madevent_interface as cmd_interface
2942
2943=== modified file 'Template/MadWeight/Cards/run_card.dat'
2944--- Template/MadWeight/Cards/run_card.dat 2012-03-09 09:18:24 +0000
2945+++ Template/MadWeight/Cards/run_card.dat 2015-04-10 09:55:25 +0000
2946@@ -1,8 +1,7 @@
2947 #*********************************************************************
2948-# MadGraph/MadEvent *
2949-# http://madgraph.hep.uiuc.edu *
2950+# MadGraph5_aMC@NLO *
2951 # *
2952-# run_card.dat *
2953+# run_card.dat MadEvent *
2954 # *
2955 # This file is used to set the parameters of the run. *
2956 # *
2957@@ -15,183 +14,273 @@
2958 #
2959 #*******************
2960 # Running parameters
2961-#*******************
2962-#
2963-#*********************************************************************
2964-# Tag name for the run (one word) *
2965-#*********************************************************************
2966- '' = run_tag ! name of the run. overwritten by the MW card
2967-#*********************************************************************
2968-# Run to generate the grid pack *
2969-#*********************************************************************
2970- .false. = gridpack !True = setting up the grid pack
2971-#*********************************************************************
2972-# Number of events and rnd seed *
2973-#*********************************************************************
2974- 0 = iseed ! rnd seed
2975+#*******************
2976+#*********************************************************************
2977+# rnd seed *
2978+# Warning: Do not generate more than 1M events in a single run *
2979+# If you want to run Pythia, avoid more than 50k events in a run. *
2980+#*********************************************************************
2981+ %(iseed)s = iseed ! rnd seed (0=assigned automatically=default))
2982 #*********************************************************************
2983 # Collider type and energy *
2984+# lpp: 0=No PDF, 1=proton, -1=antiproton, 2=photon from proton, *
2985+# 3=photon from electron *
2986 #*********************************************************************
2987- 1 = lpp1 ! beam 1 type (0=NO PDF)
2988- 1 = lpp2 ! beam 2 type (0=NO PDF)
2989- 7000 = ebeam1 ! beam 1 energy in GeV
2990- 7000 = ebeam2 ! beam 2 energy in GeV
2991+ %(lpp1)s = lpp1 ! beam 1 type
2992+ %(lpp2)s = lpp2 ! beam 2 type
2993+ %(ebeam1)s = ebeam1 ! beam 1 total energy in GeV
2994+ %(ebeam2)s = ebeam2 ! beam 2 total energy in GeV
2995 #*********************************************************************
2996 # Beam polarization from -100 (left-handed) to 100 (right-handed) *
2997 #*********************************************************************
2998- 0 = polbeam1 ! beam polarization for beam 1
2999- 0 = polbeam2 ! beam polarization for beam 2
3000+ %(polbeam1)s = polbeam1 ! beam polarization for beam 1
3001+ %(polbeam2)s = polbeam2 ! beam polarization for beam 2
3002 #*********************************************************************
3003 # PDF CHOICE: this automatically fixes also alpha_s and its evol. *
3004 #*********************************************************************
3005- 'cteq6l1' = pdlabel ! PDF set
3006+ %(pdlabel)s = pdlabel ! PDF set
3007+ %(lhaid)s = lhaid ! if pdlabel=lhapdf, this is the lhapdf number
3008 #*********************************************************************
3009 # Renormalization and factorization scales *
3010 #*********************************************************************
3011- T = fixed_ren_scale ! if .true. use fixed ren scale (false is beta)
3012- T = fixed_fac_scale ! if .true. use fixed fac scale (false is beta)
3013- 91.1880 = scale ! fixed ren scale
3014- 91.1880 = dsqrt_q2fact1 ! fixed fact scale for pdf1
3015- 91.1880 = dsqrt_q2fact2 ! fixed fact scale for pdf2
3016- 1 = scalefact ! scale factor for event-by-event scales
3017+ %(fixed_ren_scale)s = fixed_ren_scale ! if .true. use fixed ren scale
3018+ %(fixed_fac_scale)s = fixed_fac_scale ! if .true. use fixed fac scale
3019+ %(scale)s = scale ! fixed ren scale
3020+ %(dsqrt_q2fact1)s = dsqrt_q2fact1 ! fixed fact scale for pdf1
3021+ %(dsqrt_q2fact2)s = dsqrt_q2fact2 ! fixed fact scale for pdf2
3022+ %(dynamical_scale_choice)s = dynamical_scale_choice ! Select one of the preselect dynamical choice
3023+ %(scalefact)s = scalefact ! scale factor for event-by-event scales
3024+
3025+
3026+
3027+##################################################################################
3028+##################################################################################
3029+## INFORMATION USEFULL FOR MADWEIGHT STOPS HERE ##
3030+##################################################################################
3031+##################################################################################
3032+#**********************************
3033+# BW cutoff (M+/-bwcutoff*Gamma)
3034+#**********************************
3035+ %(bwcutoff)s = bwcutoff ! (M+/-bwcutoff*Gamma)
3036+#*********************************************************************
3037+# Tag name for the run (one word) *
3038+#*********************************************************************
3039+ ' ' = run_tag ! name of the run
3040+ %(nevents)s = nevents ! Number of unweighted events requested
3041+#*********************************************************************
3042+# Run to generate the grid pack *
3043+#*********************************************************************
3044+ %(gridpack)s = gridpack !True = setting up the grid pack
3045 #*********************************************************************
3046 # Matching - Warning! ickkw > 1 is still beta
3047 #*********************************************************************
3048- 0 = ickkw ! 0 no matching, 1 MLM, 2 CKKW matching
3049- 1 = highestmult ! for ickkw=2, highest mult group
3050- 1 = ktscheme ! for ickkw=1, 1 Durham kT, 2 Pythia pTE
3051- 1 = alpsfact ! scale factor for QCD emission vx
3052- F = chcluster ! cluster only according to channel diag
3053- F = pdfwgt ! for ickkw=1, perform pdf reweighting
3054-#*********************************************************************
3055-#
3056-#**********************************
3057-# BW cutoff (M+/-bwcutoff*Gamma)
3058-#**********************************
3059- 40 = bwcutoff ! desactivate by default in the MadWeight_card
3060-#*******************
3061-# Standard Cuts ! desactivate by default in the MadWeight_card
3062-#*******************
3063-#
3064-#*********************************************************************
3065-# Minimum and maximum pt's *
3066-#*********************************************************************
3067- 0 = ptj ! minimum pt for the jets
3068- 0 = ptb ! minimum pt for the b
3069- 0 = pta ! minimum pt for the photons
3070- 0 = ptl ! minimum pt for the charged leptons
3071- 0 = misset ! minimum missing Et (sum of neutrino's momenta)
3072- 0 = ptheavy ! minimum pt for one heavy final state
3073- 1.0 = ptonium ! minimum pt for the quarkonium states
3074- 1d5 = ptjmax ! maximum pt for the jets
3075- 1d5 = ptbmax ! maximum pt for the b
3076- 1d5 = ptamax ! maximum pt for the photons
3077- 1d5 = ptlmax ! maximum pt for the charged leptons
3078- 1d5 = missetmax ! maximum missing Et (sum of neutrino's momenta)
3079-#*********************************************************************
3080-# Minimum and maximum E's (in the lab frame) *
3081-#*********************************************************************
3082- 0 = ej ! minimum E for the jets
3083- 0 = eb ! minimum E for the b
3084- 0 = ea ! minimum E for the photons
3085- 0 = el ! minimum E for the charged leptons
3086- 1d5 = ejmax ! maximum E for the jets
3087- 1d5 = ebmax ! maximum E for the b
3088- 1d5 = eamax ! maximum E for the photons
3089- 1d5 = elmax ! maximum E for the charged leptons
3090-#*********************************************************************
3091-# Maximum and minimum rapidity *
3092-#*********************************************************************
3093- 1d2 = etaj ! max rap for the jets
3094- 1d2 = etab ! max rap for the b
3095- 1d2 = etaa ! max rap for the photons
3096- 1d2 = etal ! max rap for the charged leptons
3097- 1d2 = etaonium ! max rap for the quarkonium states
3098- 0d0 = etajmin ! min rap for the jets
3099- 0d0 = etabmin ! min rap for the b
3100- 0d0 = etaamin ! min rap for the photons
3101- 0d0 = etalmin ! main rap for the charged leptons
3102+ %(ickkw)s = ickkw ! 0 no matching, 1 MLM, 2 CKKW matching
3103+ %(highestmult)s = highestmult ! for ickkw=2, highest mult group
3104+ %(ktscheme)s = ktscheme ! for ickkw=1, 1 Durham kT, 2 Pythia pTE
3105+ %(alpsfact)s = alpsfact ! scale factor for QCD emission vx
3106+ %(chcluster)s = chcluster ! cluster only according to channel diag
3107+ %(pdfwgt)s = pdfwgt ! for ickkw=1, perform pdf reweighting
3108+ %(asrwgtflavor)s = asrwgtflavor ! highest quark flavor for a_s reweight
3109+ %(clusinfo)s = clusinfo ! include clustering tag in output
3110+ %(lhe_version)s = lhe_version ! Change the way clustering information pass to shower.
3111+#*********************************************************************
3112+#**********************************************************
3113+#
3114+#**********************************************************
3115+# Automatic ptj and mjj cuts if xqcut > 0
3116+# (turn off for VBF and single top processes)
3117+#**********************************************************
3118+ %(auto_ptj_mjj)s = auto_ptj_mjj ! Automatic setting of ptj and mjj
3119+#**********************************************************
3120+#
3121+#**********************************************************
3122+# Apply pt/E/eta/dr/mij cuts on decay products or not
3123+# (note that etmiss/ptll/ptheavy/ht/sorted cuts always apply)
3124+#**********************************************************
3125+ %(cut_decays)s = cut_decays ! Cut decay products
3126+#*************************************************************
3127+# Number of helicities to sum per event (0 = all helicities)
3128+# 0 gives more stable result, but longer run time (needed for
3129+# long decay chains e.g.).
3130+# Use >=2 if most helicities contribute, e.g. pure QCD.
3131+#*************************************************************
3132+ %(nhel)s = nhel ! Number of helicities used per event
3133+#*******************
3134+# Standard Cuts
3135+#*******************
3136+#
3137+#*********************************************************************
3138+# Minimum and maximum pt's (for max, -1 means no cut) *
3139+#*********************************************************************
3140+ %(ptj)s = ptj ! minimum pt for the jets
3141+ %(ptb)s = ptb ! minimum pt for the b
3142+ %(pta)s = pta ! minimum pt for the photons
3143+ %(ptl)s = ptl ! minimum pt for the charged leptons
3144+ %(misset)s = misset ! minimum missing Et (sum of neutrino's momenta)
3145+ %(ptheavy)s = ptheavy ! minimum pt for one heavy final state
3146+ %(ptjmax)s = ptjmax ! maximum pt for the jets
3147+ %(ptbmax)s = ptbmax ! maximum pt for the b
3148+ %(ptamax)s = ptamax ! maximum pt for the photons
3149+ %(ptlmax)s = ptlmax ! maximum pt for the charged leptons
3150+ %(missetmax)s = missetmax ! maximum missing Et (sum of neutrino's momenta)
3151+#*********************************************************************
3152+# Minimum and maximum E's (in the center of mass frame) *
3153+#*********************************************************************
3154+ %(ej)s = ej ! minimum E for the jets
3155+ %(eb)s = eb ! minimum E for the b
3156+ %(ea)s = ea ! minimum E for the photons
3157+ %(el)s = el ! minimum E for the charged leptons
3158+ %(ejmax)s = ejmax ! maximum E for the jets
3159+ %(ebmax)s = ebmax ! maximum E for the b
3160+ %(eamax)s = eamax ! maximum E for the photons
3161+ %(elmax)s = elmax ! maximum E for the charged leptons
3162+#*********************************************************************
3163+# Maximum and minimum absolute rapidity (for max, -1 means no cut) *
3164+#*********************************************************************
3165+ %(etaj)s = etaj ! max rap for the jets
3166+ %(etab)s = etab ! max rap for the b
3167+ %(etaa)s = etaa ! max rap for the photons
3168+ %(etal)s = etal ! max rap for the charged leptons
3169+ %(etajmin)s = etajmin ! min rap for the jets
3170+ %(etabmin)s = etabmin ! min rap for the b
3171+ %(etaamin)s = etaamin ! min rap for the photons
3172+ %(etalmin)s = etalmin ! main rap for the charged leptons
3173 #*********************************************************************
3174 # Minimum and maximum DeltaR distance *
3175 #*********************************************************************
3176- 0. = drjj ! min distance between jets
3177- 0 = drbb ! min distance between b's
3178- 0. = drll ! min distance between leptons
3179- 0. = draa ! min distance between gammas
3180- 0 = drbj ! min distance between b and jet
3181- 0. = draj ! min distance between gamma and jet
3182- 0. = drjl ! min distance between jet and lepton
3183- 0 = drab ! min distance between gamma and b
3184- 0 = drbl ! min distance between b and lepton
3185- 0. = dral ! min distance between gamma and lepton
3186- 1d2 = drjjmax ! max distance between jets
3187- 1d2 = drbbmax ! max distance between b's
3188- 1d2 = drllmax ! max distance between leptons
3189- 1d2 = draamax ! max distance between gammas
3190- 1d2 = drbjmax ! max distance between b and jet
3191- 1d2 = drajmax ! max distance between gamma and jet
3192- 1d2 = drjlmax ! max distance between jet and lepton
3193- 1d2 = drabmax ! max distance between gamma and b
3194- 1d2 = drblmax ! max distance between b and lepton
3195- 1d2 = dralmax ! maxdistance between gamma and lepton
3196+ %(drjj)s = drjj ! min distance between jets
3197+ %(drbb)s = drbb ! min distance between b's
3198+ %(drll)s = drll ! min distance between leptons
3199+ %(draa)s = draa ! min distance between gammas
3200+ %(drbj)s = drbj ! min distance between b and jet
3201+ %(draj)s = draj ! min distance between gamma and jet
3202+ %(drjl)s = drjl ! min distance between jet and lepton
3203+ %(drab)s = drab ! min distance between gamma and b
3204+ %(drbl)s = drbl ! min distance between b and lepton
3205+ %(dral)s = dral ! min distance between gamma and lepton
3206+ %(drjjmax)s = drjjmax ! max distance between jets
3207+ %(drbbmax)s = drbbmax ! max distance between b's
3208+ %(drllmax)s = drllmax ! max distance between leptons
3209+ %(draamax)s = draamax ! max distance between gammas
3210+ %(drbjmax)s = drbjmax ! max distance between b and jet
3211+ %(drajmax)s = drajmax ! max distance between gamma and jet
3212+ %(drjlmax)s = drjlmax ! max distance between jet and lepton
3213+ %(drabmax)s = drabmax ! max distance between gamma and b
3214+ %(drblmax)s = drblmax ! max distance between b and lepton
3215+ %(dralmax)s = dralmax ! maxdistance between gamma and lepton
3216 #*********************************************************************
3217 # Minimum and maximum invariant mass for pairs *
3218+# WARNING: for four lepton final state mmll cut require to have *
3219+# different lepton masses for each flavor! *
3220 #*********************************************************************
3221- 0 = mmjj ! min invariant mass of a jet pair
3222- 0 = mmbb ! min invariant mass of a b pair
3223- 0 = mmaa ! min invariant mass of gamma gamma pair
3224- 0 = mmll ! min invariant mass of l+l- (same flavour) lepton pair
3225- 1d5 = mmjjmax ! max invariant mass of a jet pair
3226- 1d5 = mmbbmax ! max invariant mass of a b pair
3227- 1d5 = mmaamax ! max invariant mass of gamma gamma pair
3228- 1d5 = mmllmax ! max invariant mass of l+l- (same flavour) lepton pair
3229+ %(mmjj)s = mmjj ! min invariant mass of a jet pair
3230+ %(mmbb)s = mmbb ! min invariant mass of a b pair
3231+ %(mmaa)s = mmaa ! min invariant mass of gamma gamma pair
3232+ %(mmll)s = mmll ! min invariant mass of l+l- (same flavour) lepton pair
3233+ %(mmjjmax)s = mmjjmax ! max invariant mass of a jet pair
3234+ %(mmbbmax)s = mmbbmax ! max invariant mass of a b pair
3235+ %(mmaamax)s = mmaamax ! max invariant mass of gamma gamma pair
3236+ %(mmllmax)s = mmllmax ! max invariant mass of l+l- (same flavour) lepton pair
3237 #*********************************************************************
3238 # Minimum and maximum invariant mass for all letpons *
3239 #*********************************************************************
3240- 0 = mmnl ! min invariant mass for all letpons (l+- and vl)
3241- 1d5 = mmnlmax ! max invariant mass for all letpons (l+- and vl)
3242+ %(mmnl)s = mmnl ! min invariant mass for all letpons (l+- and vl)
3243+ %(mmnlmax)s = mmnlmax ! max invariant mass for all letpons (l+- and vl)
3244+#*********************************************************************
3245+# Minimum and maximum pt for 4-momenta sum of leptons *
3246+#*********************************************************************
3247+ %(ptllmin)s = ptllmin ! Minimum pt for 4-momenta sum of leptons(l and vl)
3248+ %(ptllmax)s = ptllmax ! Maximum pt for 4-momenta sum of leptons(l and vl)
3249 #*********************************************************************
3250 # Inclusive cuts *
3251 #*********************************************************************
3252- 0 = xptj ! minimum pt for at least one jet
3253- 0 = xptb ! minimum pt for at least one b
3254- 0 = xpta ! minimum pt for at least one photon
3255- 0 = xptl ! minimum pt for at least one charged lepton
3256+ %(xptj)s = xptj ! minimum pt for at least one jet
3257+ %(xptb)s = xptb ! minimum pt for at least one b
3258+ %(xpta)s = xpta ! minimum pt for at least one photon
3259+ %(xptl)s = xptl ! minimum pt for at least one charged lepton
3260 #*********************************************************************
3261 # Control the pt's of the jets sorted by pt *
3262 #*********************************************************************
3263- 0 = ptj1min ! minimum pt for the leading jet in pt
3264- 0 = ptj2min ! minimum pt for the second jet in pt
3265- 0 = ptj3min ! minimum pt for the third jet in pt
3266- 0 = ptj4min ! minimum pt for the fourth jet in pt
3267- 1d5 = ptj1max ! maximum pt for the leading jet in pt
3268- 1d5 = ptj2max ! maximum pt for the second jet in pt
3269- 1d5 = ptj3max ! maximum pt for the third jet in pt
3270- 1d5 = ptj4max ! maximum pt for the fourth jet in pt
3271- 0 = cutuse ! reject event if fails any (0) / all (1) jet pt cuts
3272+ %(ptj1min)s = ptj1min ! minimum pt for the leading jet in pt
3273+ %(ptj2min)s = ptj2min ! minimum pt for the second jet in pt
3274+ %(ptj3min)s = ptj3min ! minimum pt for the third jet in pt
3275+ %(ptj4min)s = ptj4min ! minimum pt for the fourth jet in pt
3276+ %(ptj1max)s = ptj1max ! maximum pt for the leading jet in pt
3277+ %(ptj2max)s = ptj2max ! maximum pt for the second jet in pt
3278+ %(ptj3max)s = ptj3max ! maximum pt for the third jet in pt
3279+ %(ptj4max)s = ptj4max ! maximum pt for the fourth jet in pt
3280+ %(cutuse)s = cutuse ! reject event if fails any (0) / all (1) jet pt cuts
3281+#*********************************************************************
3282+# Control the pt's of leptons sorted by pt *
3283+#*********************************************************************
3284+ %(ptl1min)s = ptl1min ! minimum pt for the leading lepton in pt
3285+ %(ptl2min)s = ptl2min ! minimum pt for the second lepton in pt
3286+ %(ptl3min)s = ptl3min ! minimum pt for the third lepton in pt
3287+ %(ptl4min)s = ptl4min ! minimum pt for the fourth lepton in pt
3288+ %(ptl1max)s = ptl1max ! maximum pt for the leading lepton in pt
3289+ %(ptl2max)s = ptl2max ! maximum pt for the second lepton in pt
3290+ %(ptl3max)s = ptl3max ! maximum pt for the third lepton in pt
3291+ %(ptl4max)s = ptl4max ! maximum pt for the fourth lepton in pt
3292 #*********************************************************************
3293 # Control the Ht(k)=Sum of k leading jets *
3294 #*********************************************************************
3295- 0 = htjmin ! minimum jet HT=Sum(jet pt)
3296- 1d5 = htjmax ! maximum jet HT=Sum(jet pt)
3297- 0 = ht2min ! minimum Ht for the two leading jets
3298- 0 = ht3min ! minimum Ht for the three leading jets
3299- 0 = ht4min ! minimum Ht for the four leading jets
3300- 1d5 = ht2max ! maximum Ht for the two leading jets
3301- 1d5 = ht3max ! maximum Ht for the three leading jets
3302- 1d5 = ht4max ! maximum Ht for the four leading jets
3303+ %(htjmin)s = htjmin ! minimum jet HT=Sum(jet pt)
3304+ %(htjmax)s = htjmax ! maximum jet HT=Sum(jet pt)
3305+ %(ihtmin)s = ihtmin !inclusive Ht for all partons (including b)
3306+ %(ihtmax)s = ihtmax !inclusive Ht for all partons (including b)
3307+ %(ht2min)s = ht2min ! minimum Ht for the two leading jets
3308+ %(ht3min)s = ht3min ! minimum Ht for the three leading jets
3309+ %(ht4min)s = ht4min ! minimum Ht for the four leading jets
3310+ %(ht2max)s = ht2max ! maximum Ht for the two leading jets
3311+ %(ht3max)s = ht3max ! maximum Ht for the three leading jets
3312+ %(ht4max)s = ht4max ! maximum Ht for the four leading jets
3313+#***********************************************************************
3314+# Photon-isolation cuts, according to hep-ph/9801442 *
3315+# When ptgmin=0, all the other parameters are ignored *
3316+# When ptgmin>0, pta and draj are not going to be used *
3317+#***********************************************************************
3318+ %(ptgmin)s = ptgmin ! Min photon transverse momentum
3319+ %(r0gamma)s = R0gamma ! Radius of isolation code
3320+ %(xn)s = xn ! n parameter of eq.(3.4) in hep-ph/9801442
3321+ %(epsgamma)s = epsgamma ! epsilon_gamma parameter of eq.(3.4) in hep-ph/9801442
3322+ %(isoem)s = isoEM ! isolate photons from EM energy (photons and leptons)
3323 #*********************************************************************
3324 # WBF cuts *
3325 #*********************************************************************
3326- 0 = xetamin ! minimum rapidity for two jets in the WBF case
3327- 0 = deltaeta ! minimum rapidity for two jets in the WBF case
3328-#*********************************************************************
3329-# maximal pdg code for quark to be considered as a jet *
3330-# otherwise b cuts are applied *
3331-#*********************************************************************
3332- 4 = maxjetflavor
3333+ %(xetamin)s = xetamin ! minimum rapidity for two jets in the WBF case
3334+ %(deltaeta)s = deltaeta ! minimum rapidity for two jets in the WBF case
3335+#*********************************************************************
3336+# KT DURHAM CUT *
3337+#*********************************************************************
3338+ %(ktdurham)s = ktdurham
3339+ %(dparameter)s = dparameter
3340+#*********************************************************************
3341+# maximal pdg code for quark to be considered as a light jet *
3342+# (otherwise b cuts are applied) *
3343+#*********************************************************************
3344+ %(maxjetflavor)s = maxjetflavor ! Maximum jet pdg code
3345 #*********************************************************************
3346 # Jet measure cuts *
3347 #*********************************************************************
3348- 0 = xqcut ! minimum kt jet measure between partons
3349-#*********************************************************************
3350+ %(xqcut)s = xqcut ! minimum kt jet measure between partons
3351+#*********************************************************************
3352+#
3353+#*********************************************************************
3354+# Store info for systematics studies *
3355+# WARNING: If use_syst is T, matched Pythia output is *
3356+# meaningful ONLY if plotted taking matchscale *
3357+# reweighting into account! *
3358+#*********************************************************************
3359+ F = use_syst ! Enable systematics studies
3360+#
3361+#**************************************
3362+# Parameter of the systematics study
3363+# will be used by SysCalc (if installed)
3364+#**************************************
3365+#
3366+%(sys_scalefact)s = sys_scalefact # factorization/renormalization scale factor
3367+%(sys_alpsfact)s = sys_alpsfact # \alpha_s emission scale factors
3368+%(sys_matchscale)s = sys_matchscale # variation of merging scale
3369+# PDF sets and number of members (0 or none for all members).
3370+%(sys_pdf)s = sys_pdf # matching scales
3371+# MSTW2008nlo68cl.LHgrid 1 = sys_pdf
3372
3373=== modified file 'Template/MadWeight/src/gen_ps.f'
3374--- Template/MadWeight/src/gen_ps.f 2014-01-06 16:54:40 +0000
3375+++ Template/MadWeight/src/gen_ps.f 2015-04-10 09:55:25 +0000
3376@@ -254,17 +254,22 @@
3377 c var_num=1 means that we generate a theta
3378 if (var_num.eq.1) then
3379
3380+ if (gam.gt.0) then
3381 point_max=c_point +5d0*gam
3382 if (point_max.gt.pi) point_max=pi
3383 point_min=c_point -5d0*gam
3384 if (point_min.lt.0d0) point_min=0d0
3385+ else
3386+ point_max=pi
3387+ point_min=0d0
3388+ endif
3389
3390 gen_point=(point_max-point_min)*x+point_min
3391
3392 c var_num=2 means that we generate a phi (note that phi is a cyclic variable)
3393 elseif(var_num.eq.2) then
3394
3395- if(gam.lt.(2d0*pi/10)) then
3396+ if(gam.lt.(2d0*pi/10).and.gam.gt.0d0) then
3397 point_max=c_point +5d0*gam
3398 point_min=c_point -5d0*gam
3399 else
3400
3401=== modified file 'Template/MadWeight/src/run.inc'
3402--- Template/MadWeight/src/run.inc 2014-01-07 10:50:42 +0000
3403+++ Template/MadWeight/src/run.inc 2015-04-10 09:55:25 +0000
3404@@ -6,9 +6,9 @@
3405 c
3406 real*8 scale,scalefact,alpsfact
3407 logical fixed_ren_scale,fixed_fac_scale,fixed_couplings,hmult
3408- integer ickkw,nhmult,asrwgtflavor
3409+ integer ickkw,nhmult,asrwgtflavor,dynamical_scale_choice
3410 common/to_scale/scale,scalefact,alpsfact,fixed_ren_scale,fixed_fac_scale,
3411- $ fixed_couplings,ickkw,nhmult,hmult,asrwgtflavor
3412+ $ fixed_couplings,ickkw,nhmult,hmult,asrwgtflavor,dynamical_scale_choice
3413 c
3414 c Collider
3415 c
3416
3417=== modified file 'Template/MadWeight/src/setrun.f'
3418--- Template/MadWeight/src/setrun.f 2014-01-07 10:50:42 +0000
3419+++ Template/MadWeight/src/setrun.f 2015-04-10 09:55:25 +0000
3420@@ -262,7 +262,7 @@
3421 call get_real (npara,param,value,"ptj3max",ptj3max,1d5)
3422 call get_real (npara,param,value,"ptj4min",ptj4min,0d0)
3423 call get_real (npara,param,value,"ptj4max",ptj4max,1d5)
3424- call get_real (npara,param,value,"cutuse",cutuse,0d0)
3425+ call get_integer (npara,param,value,"cutuse",cutuse,0)
3426
3427 c*********************************************************************
3428 c Check Ht *
3429
3430=== modified file 'Template/NLO/Cards/FO_analyse_card.dat'
3431--- Template/NLO/Cards/FO_analyse_card.dat 2013-12-02 16:53:51 +0000
3432+++ Template/NLO/Cards/FO_analyse_card.dat 2015-04-10 09:55:25 +0000
3433@@ -1,21 +1,21 @@
3434 #######################################################################
3435 #
3436-# This file contains the settings for analyses to be linked to aMC@NLO
3437-# fixed order runs. Analyse files are meant to be put (or linked)
3438-# inside <PROCDIR>/FixedOrderAnalysis/ (<PROCDIR> is the name of the
3439-# exported process directory). See the
3440-# <PROCDIR>/FixedOrderAnalysis/analysis_template.f file for details on
3441-# how to write your own analysis.
3442+# This file contains the settings for analyses to be linked to fixed
3443+# order runs. Analysis files are meant to be put (or linked) inside
3444+# <PROCDIR>/FixedOrderAnalysis/ (<PROCDIR> is the name of the exported
3445+# process directory). See the
3446+# <PROCDIR>/FixedOrderAnalysis/analysis_*_template.f file for details
3447+# on how to write your own analysis.
3448 #
3449 #######################################################################
3450 #
3451-# Analysis format. Can either be 'topdrawer', 'root', or 'none'.
3452-# Topdrawer is human-readable text format, which allows for easy
3453-# conversion to other formats. When choosing topdrawer, the
3454-# histogramming package 'dbook.f' is included in the code, while when
3455-# choosing root the 'rbook_fe8.f' and 'rbook_be8.cc' are included. If
3456-# 'none' is chosen, all the other entries below have to be set empty.
3457-FO_ANALYSIS_FORMAT = topdrawer
3458+# Analysis format. Can either be 'topdrawer', 'root', 'HwU' or 'none'.
3459+# When choosing HwU, it comes with a GnuPlot wrapper. When choosing
3460+# topdrawer, the histogramming package 'dbook.f' is included in the
3461+# code, while when choosing root the 'rbook_fe8.f' and 'rbook_be8.cc'
3462+# are included. If 'none' is chosen, all the other entries below have
3463+# to be set empty.
3464+FO_ANALYSIS_FORMAT = HwU
3465 #
3466 # Needed extra-libraries (FastJet is already linked):
3467 FO_EXTRALIBS =
3468@@ -31,12 +31,13 @@
3469 # User's analysis (to be put in the <PROCDIR>/FixedOrderAnalysis/
3470 # directory). Please use .o as extension and white spaces to separate
3471 # files.
3472-FO_ANALYSE = analysis_td_template.o
3473+FO_ANALYSE = analysis_HwU_template.o
3474 #
3475 #
3476 ## When linking with root, the following settings are a working
3477-## example on lxplus (CERN). When using this, comment out the lines
3478-## above and replace <PATH_TO_ROOT> with the physical path to root,
3479+## example on lxplus (CERN) as of July 2014. When using this, comment
3480+## out the lines above and replace <PATH_TO_ROOT> with the physical
3481+## path to root,
3482 ## e.g. /afs/cern.ch/sw/lcg/app/releases/ROOT/5.34.11/x86_64-slc6-gcc46-dbg/root/
3483 #FO_ANALYSIS_FORMAT = root
3484 #FO_EXTRALIBS = Core Cint Hist Matrix MathCore RIO dl Thread
3485
3486=== modified file 'Template/NLO/Cards/run_card.dat'
3487--- Template/NLO/Cards/run_card.dat 2014-09-11 05:33:30 +0000
3488+++ Template/NLO/Cards/run_card.dat 2015-04-10 09:55:25 +0000
3489@@ -19,98 +19,104 @@
3490 #***********************************************************************
3491 # Tag name for the run (one word) *
3492 #***********************************************************************
3493- tag_1 = run_tag ! name of the run
3494+ %(run_tag)s = run_tag ! name of the run
3495 #***********************************************************************
3496 # Number of LHE events (and their normalization) and the required *
3497 # (relative) accuracy on the Xsec. *
3498 # These values are ignored for fixed order runs *
3499 #***********************************************************************
3500- 10000 = nevents ! Number of unweighted events requested
3501- -1 = req_acc ! Required accuracy (-1=auto determined from nevents)
3502- -1 = nevt_job! Max number of events per job in event generation.
3503+ %(nevents)s = nevents ! Number of unweighted events requested
3504+ %(req_acc)s = req_acc ! Required accuracy (-1=auto determined from nevents)
3505+ %(nevt_job)s = nevt_job! Max number of events per job in event generation.
3506 ! (-1= no split).
3507 #***********************************************************************
3508 # Normalize the weights of LHE events such that they sum or average to *
3509 # the total cross section *
3510 #***********************************************************************
3511- average = event_norm ! average or sum
3512+ %(event_norm)s = event_norm ! average or sum
3513 #***********************************************************************
3514 # Number of points per itegration channel (ignored for aMC@NLO runs) *
3515 #***********************************************************************
3516- 0.01 = req_acc_FO ! Required accuracy (-1=ignored, and use the
3517+ %(req_acc_fo)s = req_acc_FO ! Required accuracy (-1=ignored, and use the
3518 ! number of points and iter. below)
3519 # These numbers are ignored except if req_acc_FO is equal to -1
3520- 5000 = npoints_FO_grid ! number of points to setup grids
3521- 4 = niters_FO_grid ! number of iter. to setup grids
3522- 10000 = npoints_FO ! number of points to compute Xsec
3523- 6 = niters_FO ! number of iter. to compute Xsec
3524+ %(npoints_fo_grid)s = npoints_FO_grid ! number of points to setup grids
3525+ %(niters_fo_grid)s = niters_FO_grid ! number of iter. to setup grids
3526+ %(npoints_fo)s = npoints_FO ! number of points to compute Xsec
3527+ %(niters_fo)s = niters_FO ! number of iter. to compute Xsec
3528 #***********************************************************************
3529 # Random number seed *
3530 #***********************************************************************
3531- 0 = iseed ! rnd seed (0=assigned automatically=default))
3532+ %(iseed)s = iseed ! rnd seed (0=assigned automatically=default))
3533 #***********************************************************************
3534 # Collider type and energy *
3535 #***********************************************************************
3536- 1 = lpp1 ! beam 1 type (0 = no PDF)
3537- 1 = lpp2 ! beam 2 type (0 = no PDF)
3538- 6500 = ebeam1 ! beam 1 energy in GeV
3539- 6500 = ebeam2 ! beam 2 energy in GeV
3540+ %(lpp1)s = lpp1 ! beam 1 type (0 = no PDF)
3541+ %(lpp2)s = lpp2 ! beam 2 type (0 = no PDF)
3542+ %(ebeam1)s = ebeam1 ! beam 1 energy in GeV
3543+ %(ebeam2)s = ebeam2 ! beam 2 energy in GeV
3544 #***********************************************************************
3545 # PDF choice: this automatically fixes also alpha_s(MZ) and its evol. *
3546 #***********************************************************************
3547- nn23nlo = pdlabel ! PDF set
3548- 244600 = lhaid ! if pdlabel=lhapdf, this is the lhapdf number
3549+ %(pdlabel)s = pdlabel ! PDF set
3550+ %(lhaid)s = lhaid ! if pdlabel=lhapdf, this is the lhapdf number
3551 #***********************************************************************
3552 # Include the NLO Monte Carlo subtr. terms for the following parton *
3553 # shower (HERWIG6 | HERWIGPP | PYTHIA6Q | PYTHIA6PT | PYTHIA8) *
3554 # WARNING: PYTHIA6PT works only for processes without FSR!!!! *
3555 #***********************************************************************
3556- HERWIG6 = parton_shower
3557+ %(parton_shower)s = parton_shower
3558 #***********************************************************************
3559 # Renormalization and factorization scales *
3560 # (Default functional form for the non-fixed scales is the sum of *
3561 # the transverse masses of all final state particles and partons. This *
3562 # can be changed in SubProcesses/set_scales.f) *
3563 #***********************************************************************
3564- F = fixed_ren_scale ! if .true. use fixed ren scale
3565- F = fixed_fac_scale ! if .true. use fixed fac scale
3566- 91.188 = muR_ref_fixed ! fixed ren reference scale
3567- 91.188 = muF1_ref_fixed ! fixed fact reference scale for pdf1
3568- 91.188 = muF2_ref_fixed ! fixed fact reference scale for pdf2
3569+ %(fixed_ren_scale)s = fixed_ren_scale ! if .true. use fixed ren scale
3570+ %(fixed_fac_scale)s = fixed_fac_scale ! if .true. use fixed fac scale
3571+ %(mur_ref_fixed)s = muR_ref_fixed ! fixed ren reference scale
3572+ %(muf1_ref_fixed)s = muF1_ref_fixed ! fixed fact reference scale for pdf1
3573+ %(muf2_ref_fixed)s = muF2_ref_fixed ! fixed fact reference scale for pdf2
3574+ %(dynamical_scale_choice)s = dynamical_scale_choice ! Select one of the preselect dynamical choice
3575 #***********************************************************************
3576 # Renormalization and factorization scales (advanced and NLO options) *
3577 #***********************************************************************
3578- F = fixed_QES_scale ! if .true. use fixed Ellis-Sexton scale
3579- 91.188 = QES_ref_fixed ! fixed Ellis-Sexton reference scale
3580- 1 = muR_over_ref ! ratio of current muR over reference muR
3581- 1 = muF1_over_ref ! ratio of current muF1 over reference muF1
3582- 1 = muF2_over_ref ! ratio of current muF2 over reference muF2
3583- 1 = QES_over_ref ! ratio of current QES over reference QES
3584+ %(fixed_qes_scale)s = fixed_QES_scale ! if .true. use fixed Ellis-Sexton scale
3585+ %(qes_ref_fixed)s = QES_ref_fixed ! fixed Ellis-Sexton reference scale
3586+ %(mur_over_ref)s = muR_over_ref ! ratio of current muR over reference muR
3587+ %(muf1_over_ref)s = muF1_over_ref ! ratio of current muF1 over reference muF1
3588+ %(muf2_over_ref)s = muF2_over_ref ! ratio of current muF2 over reference muF2
3589+ %(qes_over_ref)s = QES_over_ref ! ratio of current QES over reference QES
3590 #***********************************************************************
3591 # Reweight flags to get scale dependence and PDF uncertainty *
3592 # For scale dependence: factor rw_scale_up/down around central scale *
3593 # For PDF uncertainty: use LHAPDF with supported set *
3594 #***********************************************************************
3595- .true. = reweight_scale ! reweight to get scale dependence
3596- 0.5 = rw_Rscale_down ! lower bound for ren scale variations
3597- 2.0 = rw_Rscale_up ! upper bound for ren scale variations
3598- 0.5 = rw_Fscale_down ! lower bound for fact scale variations
3599- 2.0 = rw_Fscale_up ! upper bound for fact scale variations
3600- .false. = reweight_PDF ! reweight to get PDF uncertainty
3601- 244601 = PDF_set_min ! First of the error PDF sets
3602- 244700 = PDF_set_max ! Last of the error PDF sets
3603-#***********************************************************************
3604-# Merging - WARNING! Applies merging only at the hard-event level. *
3605-# After showering an MLM-type merging should be applied as well. *
3606-# See http://amcatnlo.cern.ch/FxFx_merging.htm for more details. *
3607-#***********************************************************************
3608- 0 = ickkw ! 0 no merging, 3 FxFx merging, 4 UNLOPS
3609+ %(reweight_scale)s = reweight_scale ! reweight to get scale dependence
3610+ %(rw_rscale_down)s = rw_Rscale_down ! lower bound for ren scale variations
3611+ %(rw_rscale_up)s = rw_Rscale_up ! upper bound for ren scale variations
3612+ %(rw_fscale_down)s = rw_Fscale_down ! lower bound for fact scale variations
3613+ %(rw_fscale_up)s = rw_Fscale_up ! upper bound for fact scale variations
3614+ %(reweight_pdf)s = reweight_PDF ! reweight to get PDF uncertainty
3615+ %(pdf_set_min)s = PDF_set_min ! First of the error PDF sets
3616+ %(pdf_set_max)s = PDF_set_max ! Last of the error PDF sets
3617+#***********************************************************************
3618+# ickkw parameter: *
3619+# 0: No merging *
3620+# 3: FxFx Merging - WARNING! Applies merging only at the hard-event *
3621+# level. After showering an MLM-type merging should be applied as *
3622+# well. See http://amcatnlo.cern.ch/FxFx_merging.htm for details. *
3623+# 4: UNLOPS merging (with pythia8 only). No interface from within *
3624+# MG5_aMC available, but available in Pythia8. *
3625+# -1: NNLL+NLO jet-veto computation. See arxiv:1412.8408 [hep-ph]. *
3626+#***********************************************************************
3627+ %(ickkw)s = ickkw
3628 #***********************************************************************
3629 #
3630 #***********************************************************************
3631 # BW cutoff (M+/-bwcutoff*Gamma) *
3632 #***********************************************************************
3633- 15 = bwcutoff
3634+ %(bwcutoff)s = bwcutoff
3635 #***********************************************************************
3636 # Cuts on the jets *
3637 # Jet clustering is performed by FastJet.
3638@@ -118,37 +124,37 @@
3639 # considerably softer than the analysis cuts. *
3640 # (more specific cuts can be specified in SubProcesses/cuts.f) *
3641 #***********************************************************************
3642- 1 = jetalgo ! FastJet jet algorithm (1=kT, 0=C/A, -1=anti-kT)
3643- 0.7 = jetradius ! The radius parameter for the jet algorithm
3644- 10 = ptj ! Min jet transverse momentum
3645- -1 = etaj ! Max jet abs(pseudo-rap) (a value .lt.0 means no cut)
3646+ %(jetalgo)s = jetalgo ! FastJet jet algorithm (1=kT, 0=C/A, -1=anti-kT)
3647+ %(jetradius)s = jetradius ! The radius parameter for the jet algorithm
3648+ %(ptj)s = ptj ! Min jet transverse momentum
3649+ %(etaj)s = etaj ! Max jet abs(pseudo-rap) (a value .lt.0 means no cut)
3650 #***********************************************************************
3651 # Cuts on the charged leptons (e+, e-, mu+, mu-, tau+ and tau-) *
3652 # (more specific gen cuts can be specified in SubProcesses/cuts.f) *
3653 #***********************************************************************
3654- 0 = ptl ! Min lepton transverse momentum
3655- -1 = etal ! Max lepton abs(pseudo-rap) (a value .lt.0 means no cut)
3656- 0 = drll ! Min distance between opposite sign lepton pairs
3657- 0 = drll_sf ! Min distance between opp. sign same-flavor lepton pairs
3658- 0 = mll ! Min inv. mass of all opposite sign lepton pairs
3659- 30 = mll_sf ! Min inv. mass of all opp. sign same-flavor lepton pairs
3660+ %(ptl)s = ptl ! Min lepton transverse momentum
3661+ %(etal)s = etal ! Max lepton abs(pseudo-rap) (a value .lt.0 means no cut)
3662+ %(drll)s = drll ! Min distance between opposite sign lepton pairs
3663+ %(drll_sf)s = drll_sf ! Min distance between opp. sign same-flavor lepton pairs
3664+ %(mll)s = mll ! Min inv. mass of all opposite sign lepton pairs
3665+ %(mll_sf)s = mll_sf ! Min inv. mass of all opp. sign same-flavor lepton pairs
3666 #***********************************************************************
3667 # Photon-isolation cuts, according to hep-ph/9801442 *
3668 # When ptgmin=0, all the other parameters are ignored *
3669 #***********************************************************************
3670- 20 = ptgmin ! Min photon transverse momentum
3671- -1 = etagamma ! Max photon abs(pseudo-rap)
3672- 0.4 = R0gamma ! Radius of isolation code
3673- 1.0 = xn ! n parameter of eq.(3.4) in hep-ph/9801442
3674- 1.0 = epsgamma ! epsilon_gamma parameter of eq.(3.4) in hep-ph/9801442
3675- .true. = isoEM ! isolate photons from EM energy (photons and leptons)
3676+ %(ptgmin)s = ptgmin ! Min photon transverse momentum
3677+ %(etagamma)s = etagamma ! Max photon abs(pseudo-rap)
3678+ %(r0gamma)s = R0gamma ! Radius of isolation code
3679+ %(xn)s = xn ! n parameter of eq.(3.4) in hep-ph/9801442
3680+ %(epsgamma)s = epsgamma ! epsilon_gamma parameter of eq.(3.4) in hep-ph/9801442
3681+ %(isoem)s = isoEM ! isolate photons from EM energy (photons and leptons)
3682 #***********************************************************************
3683 # Maximal PDG code for quark to be considered a jet when applying cuts.*
3684 # At least all massless quarks of the model should be included here. *
3685 #***********************************************************************
3686- 4 = maxjetflavor
3687+ %(maxjetflavor)s = maxjetflavor
3688 #***********************************************************************
3689 # For aMCfast+APPLGRID use in PDF fitting (http://amcfast.hepforge.org)*
3690 #***********************************************************************
3691- 0 = iappl ! aMCfast switch (0=OFF, 1=prepare APPLgrids, 2=fill grids)
3692+ %(iappl)s = iappl ! aMCfast switch (0=OFF, 1=prepare APPLgrids, 2=fill grids)
3693 #***********************************************************************
3694
3695=== modified file 'Template/NLO/Cards/shower_card.dat'
3696--- Template/NLO/Cards/shower_card.dat 2015-01-13 15:36:47 +0000
3697+++ Template/NLO/Cards/shower_card.dat 2015-04-10 09:55:25 +0000
3698@@ -21,7 +21,7 @@
3699 #***********************************************************************
3700 nevents = -1 # N evts to shower (< 0 = all)
3701 nsplit_jobs = 1 # N jobs to run in parallel (< 100!!)
3702-combine_td = T # combine the topdrawer files if nsplit_jobs > 1
3703+combine_td = T # combine the topdrawer/HwU files if nsplit_jobs>1
3704 maxprint = 2 # N evts to print in the log
3705 maxerrs = 0.1 # max fraction of errors
3706 rnd_seed = 0 # 1st random seed (0 = default)
3707@@ -100,6 +100,8 @@
3708 # create a StdHEP/HepMC file, but to directly run an own analysis (to *
3709 # be placed in HWAnalyzer or analogous MCatNLO subfolders). *
3710 # Please use files in those folders as examples. *
3711+# Remember that if your analysis uses hbook or is in the HwU format, *
3712+# you must also add to hbook.o or HwU.o to the ANALYSE list as well. *
3713 #***********************************************************************
3714 EXTRALIBS = stdhep Fmcfio # Extra-libraries (not LHAPDF)
3715 # Default: "stdhep Fmcfio"
3716
3717=== added file 'Template/NLO/FixedOrderAnalysis/HwU.f'
3718--- Template/NLO/FixedOrderAnalysis/HwU.f 1970-01-01 00:00:00 +0000
3719+++ Template/NLO/FixedOrderAnalysis/HwU.f 2015-04-10 09:55:25 +0000
3720@@ -0,0 +1,410 @@
3721+CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
3722+C C
3723+C HwU: Histograms with Uncertainties C
3724+C By Rikkert Frederix, Dec. 2014 C
3725+C C
3726+C Book, fill and write out histograms. Particularly suited for NLO C
3727+C computations with correlations between points (ie. event and C
3728+C counter-event) and multiple weights for given points (e.g. scale C
3729+C and PDF uncertainties through reweighting). C
3730+C C
3731+CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
3732+
3733+c To be called once at the start of each run. Initialises the packages
3734+c and sets the number of weights that need to be included for each point.
3735+ subroutine HwU_inithist(nweights,wgt_info)
3736+ implicit none
3737+ include "HwU.inc"
3738+ integer i,nweights
3739+ character*(*) wgt_info(*)
3740+ do i=1,max_plots
3741+ booked(i)=.false.
3742+ enddo
3743+c Number of weights associated to each point. Note that the first
3744+c weight should always be the 'central value' and it should not be
3745+c zero if any of the other weights are non-zero.
3746+ nwgts=nweights
3747+ if (nwgts.gt.max_wgts) then
3748+ write (*,*) 'ERROR: increase max_wgts in HwU histogramming'
3749+ $ ,max_wgts,nwgts
3750+ stop 1
3751+ endif
3752+ do i=1,nwgts
3753+ wgts_info(i)=wgt_info(i)
3754+ enddo
3755+ return
3756+ end
3757+
3758+ subroutine set_error_estimation(input)
3759+c Error estimation
3760+c input 0: Simply sum all PS points; error is estimated by assuming
3761+c Binomial statistics: use for unweighted events. (Assumes that
3762+c all events have equal weight (up to a sign)).
3763+c input 1: Simply sum all PS points; error is estimated by the
3764+c variance between the separate iterations. This assumes that
3765+c each iteration has the same number of PS points (This is the
3766+c topdrawer default in MG5_aMC).
3767+c input 2: Sum PS points for a given iteration and error estimate by
3768+c square root of the sum of the squares. Perform a weighted average
3769+c iteration-by-iteration
3770+ implicit none
3771+ integer input
3772+ integer error_estimation
3773+ common /HwU_common2/ error_estimation
3774+ if (input.ge.0 .and. input.le.2) then
3775+ error_estimation=input
3776+ else
3777+ write (*,*) 'unknown error estimation',input
3778+ stop 1
3779+ endif
3780+ return
3781+ end
3782+
3783+ block data HwU
3784+c set the default for the error estimation method. To reduce the size of
3785+c the executable, put the error_estimation variable in a separate common
3786+c block. If we would have included the 'HwU.inc' file here, that
3787+c complete common block seems to be included in the size executable
3788+c (approx. 110 MB).
3789+ integer error_estimation
3790+ common /HwU_common2/ error_estimation
3791+ data error_estimation /1/
3792+ end
3793+
3794+c Book the histograms at the start of the run. Give a 'label' (an
3795+c integer) that identifies the plot when filling it and a title
3796+c ('title_l') for each plot. Also the number of bins ('nbin_l') and the
3797+c plot range (from 'xmin' to 'xmax') should be given.
3798+ subroutine HwU_book(label,title_l,nbin_l,xmin,xmax)
3799+ implicit none
3800+ include "HwU.inc"
3801+ integer label,nbin_l,i,j
3802+ character*(*) title_l
3803+ double precision xmin,xmax
3804+c Check that label and number of bins are reasonable
3805+ if (label.gt.max_plots) then
3806+ write (*,*) 'ERROR: increase max_plots in HwU histogramming'
3807+ $ ,max_plots, label
3808+ stop 1
3809+ endif
3810+ if (nbin_l.gt.max_bins) then
3811+ write (*,*) 'ERROR: increase max_bins in HwU histogramming'
3812+ $ ,max_bins,nbin_l
3813+ stop 1
3814+ endif
3815+ booked(label)=.true.
3816+ title(label)=title_l
3817+ nbin(label)=nbin_l
3818+c Compute the bin width
3819+ step(label)=(xmax-xmin)/dble(nbin(label))
3820+ do i=1,nbin(label)
3821+c Compute the lower and upper bin edges
3822+ histxl(label,i)=xmin+step(label)*dble(i-1)
3823+ histxm(label,i)=xmin+step(label)*dble(i)
3824+c Set all the bins to zero.
3825+ do j=1,nwgts
3826+ histy(j,label,i)=0d0
3827+ histy_acc(j,label,i)=0d0
3828+ enddo
3829+ histi(label,i)=0
3830+ histy2(label,i)=0d0
3831+ histy_err(label,i)=0d0
3832+ enddo
3833+ np=0
3834+ return
3835+ end
3836+
3837+c Fill the histograms identified with 'label' with a point at x with
3838+c weights giving by 'wgts'. The dimension of the 'wgts' array should
3839+c always be as large as the number of weights ('nweights') specified in
3840+c the 'HwU_inithist' subroutine. That means that each point should have
3841+c the same number of weights.
3842+ subroutine HwU_fill(label,x,wgts)
3843+ implicit none
3844+ include "HwU.inc"
3845+ integer label,i,j,bin
3846+ double precision x, wgts(*)
3847+c If central weight is zero do not add this point.
3848+ if (wgts(1).eq.0d0) return
3849+c Check if point is within plotting range
3850+ if (x.lt.histxl(label,1) .or.
3851+ $ x.gt.histxm(label,nbin(label))) return
3852+c Compute the bin to fill
3853+ bin=int((x-histxl(label,1))/step(label)) +1
3854+c To prevent numerical inaccuracy, double check that bin is
3855+c reasonable
3856+ if (bin.lt.1 .or. bin.gt.nbin(label)) return
3857+c Check if we already had another (correlated) point in this bin. If
3858+c so, add the current weight to that point.
3859+ do i=1,np
3860+ if ( p_label(i).eq.label .and. p_bin(i).eq.bin) then
3861+ do j=1,nwgts
3862+ p_wgts(j,i)=p_wgts(j,i)+wgts(j)
3863+ enddo
3864+ return
3865+ endif
3866+ enddo
3867+c If a new bin, add it to the list of points
3868+ np=np+1
3869+ if (np.gt.max_points) then
3870+ write (*,*) 'ERROR: increase max_points in HwU histogramming'
3871+ $ ,max_points
3872+ stop 1
3873+ endif
3874+ p_label(np)=label
3875+ p_bin(np)=bin
3876+ do j=1,nwgts
3877+ p_wgts(j,np)=wgts(j)
3878+ enddo
3879+ return
3880+ end
3881+
3882+c Call after all correlated contributions for a give phase-space
3883+c point. I.e., every time you get a new set of random numbers from
3884+c MINT/VEGAS. It adds the current list of points to the histograms. Add
3885+c the squares to compute the statistical uncertainty on the bin. Do the
3886+c second only for the weight corresponding to the 'central value'. In
3887+c this way, correlations between events and counter-events can be
3888+c correctly taken into account.
3889+ subroutine HwU_add_points
3890+ implicit none
3891+ include "HwU.inc"
3892+ integer i,j
3893+ do i=1,np
3894+ do j=1,nwgts
3895+ histy(j,p_label(i),p_bin(i))=
3896+ $ histy(j,p_label(i),p_bin(i))+p_wgts(j,i)
3897+ enddo
3898+ histi(p_label(i),p_bin(i))=histi(p_label(i),p_bin(i))+1
3899+ histy2(p_label(i),p_bin(i))=
3900+ $ histy2(p_label(i),p_bin(i))+p_wgts(1,i)**2
3901+ enddo
3902+ np=0
3903+ return
3904+ end
3905+
3906+
3907+c *****For plotting during fixed order f(N)LO runs*****
3908+c Call after every iteration. This adds the histograms of the current
3909+c iteration ('histy') to the accumulated results ('histy_acc'), with the
3910+c uncertainty estimate given in 'histy_err' and empties the arrays for
3911+c the current iteration so that they can be filled with the next
3912+c iteration.
3913+ subroutine HwU_accum_iter(inclde,nPSpoints)
3914+ implicit none
3915+ include "HwU.inc"
3916+ logical inclde
3917+ integer nPSpoints,label,i,j
3918+ double precision nPSinv,etot,vtot(max_wgts),niter,y_squared
3919+ data niter /0d0/
3920+ nPSinv = 1d0/dble(nPSpoints)
3921+ if (inclde) niter = niter+1d0
3922+ do label=1,max_plots
3923+ if (.not. booked(label)) cycle
3924+ if (inclde) then
3925+ call accumulate_results(label,nPSinv,niter)
3926+ endif
3927+c Reset the histo of the current iteration to zero so that they are
3928+c ready for the next iteration.
3929+ do i=1,nbin(label)
3930+ do j=1,nwgts
3931+ histy(j,label,i)=0d0
3932+ enddo
3933+ histy2(label,i)=0d0
3934+ histi(label,i)=0
3935+ enddo
3936+ enddo
3937+ return
3938+ end
3939+
3940+c *****For plotting unweighted events****
3941+c Overwrites the accumulated results ('histy_acc') with the current
3942+c results ('histy') and provides an uncertainty estimate in
3943+c 'histy_err'. This means that during the plotting of events, at
3944+c intermediate stages this function can be called (together with
3945+c HwU_output) to write intermediate plots to disk.
3946+ subroutine finalize_histograms(nPSpoints)
3947+ implicit none
3948+ include "HwU.inc"
3949+ integer label,nPSpoints,i,j
3950+ double precision nPSinv,niter
3951+ nPSinv=1d0/dble(nPSpoints)
3952+ niter=1d0
3953+ do label=1,max_plots
3954+ if (.not. booked(label)) cycle
3955+ do i=1,nbin(label)
3956+c Set all the bins to zero.
3957+ do j=1,nwgts
3958+ histy_acc(j,label,i)=0d0
3959+ enddo
3960+ histy_err(label,i)=0d0
3961+ enddo
3962+ call accumulate_results(label,nPSinv,niter)
3963+ enddo
3964+ return
3965+ end
3966+
3967+c This adds the histograms of the current iteration ('histy') to the
3968+c accumulated results ('histy_acc'), with the uncertainty estimate given
3969+c in 'histy_err'. When error_estimation==2 it adds using a weight
3970+c corresponding to the statistical uncertainties on the 'central value'
3971+c weights ('etot' (from 'histy2') and 'histy_err', respectively), if
3972+c error_estimation==1 it simply averages over the iterations, if
3973+c error_estimation==0 it uses Poisson statistics to compute the
3974+c uncertainty. Note that this means that during the filling of the
3975+c histograms the central value should not be zero if any of the other
3976+c weights are non-zero.
3977+ subroutine accumulate_results(label,nPSinv,niter)
3978+ implicit none
3979+ include "HwU.inc"
3980+ integer label,i,j
3981+ double precision nPSinv,etot,vtot(max_wgts),niter,y_squared
3982+ integer error_estimation
3983+ common /HwU_common2/ error_estimation
3984+ if (error_estimation.eq.2) then
3985+c Use the weighted average bin-by-bin. This is not really justified
3986+c for fNLO computations, because for bins with low statistics, the
3987+c variance computation cannot be trusted.
3988+ do i=1,nbin(label)
3989+c Skip bin if no entries
3990+ if (histi(label,i).eq.0) cycle
3991+c Divide weights by the number of PS points. This means that this is
3992+c now normalised to the total cross section in that bin
3993+ do j=1,nwgts
3994+ vtot(j)=histy(j,label,i)*nPSinv
3995+ enddo
3996+c Error estimation of the current bin
3997+ etot=sqrt(abs(histy2(label,i)*nPSinv-vtot(1)**2)*nPSinv)
3998+c Include "Bessel's correction" to have a corrected (even though
3999+c still biased) estimator of the standard deviation.
4000+ if (histi(label,i).gt.1) then
4001+ etot=etot* sqrt(dble(histi(label,i))
4002+ & /(dble(histi(label,i))-1.5d0))
4003+ else
4004+ etot=0.999d49
4005+ endif
4006+c If the error estimation of the accumulated results is still zero
4007+c (i.e. no points were added yet, e.g. because it is the first
4008+c iteration) simply copy the results of this iteration over the
4009+c accumulated results.
4010+ if (histy_err(label,i).eq.0d0) then
4011+ do j=1,nwgts
4012+ histy_acc(j,label,i)=vtot(j)
4013+ enddo
4014+ histy_err(label,i)=etot
4015+ else
4016+c Add the results of the current iteration to the accumulated results
4017+ do j=1,nwgts
4018+ histy_acc(j,label,i)=(histy_acc(j,label,i)
4019+ & /histy_err(label,i)+vtot(j)/etot)/(1d0
4020+ & /histy_err(label,i) + 1d0/etot)
4021+ enddo
4022+ histy_err(label,i)=
4023+ $ 1d0/sqrt(1d0/histy_err(label,i)**2+1d0/etot**2)
4024+ endif
4025+ enddo
4026+ elseif(error_estimation.eq.1) then
4027+c simply sum the weights in the bins
4028+ do i=1,nbin(label)
4029+ if (histi(label,i).eq.0 .and.
4030+ & histy_acc(1,label,i).eq.0d0) cycle
4031+ if (niter.ne.1d0) y_squared=((niter-1)*histy_err(label,i))
4032+ & **2+(niter-1)*histy_acc(1,label,i)**2
4033+ do j=1,nwgts
4034+ vtot(j)=histy(j,label,i)*nPSinv
4035+ histy_acc(j,label,i)=(histy_acc(j,label,i)*(niter-1d0)
4036+ & +vtot(j))/niter
4037+ enddo
4038+c base the error on the variance in the results per iteration. For a
4039+c small number of iterations, this underestimates the actual
4040+c uncertainty.
4041+ if (niter.eq.1d0) then
4042+ histy_err(label,i)=0d0
4043+ else
4044+ histy_err(label,i)= sqrt(((y_squared+vtot(1)**2)/niter
4045+ & -histy_acc(1,label,i)**2)/niter)
4046+ endif
4047+ enddo
4048+ elseif(error_estimation.eq.0) then
4049+c simply sum the weights in the bins
4050+ do i=1,nbin(label)
4051+ if (histi(label,i).eq.0 .and.
4052+ & histy_acc(1,label,i).eq.0d0) cycle
4053+ do j=1,nwgts
4054+ vtot(j)=histy(j,label,i)*nPSinv
4055+ histy_acc(j,label,i)=(histy_acc(j,label,i)*(niter-1d0)
4056+ & +vtot(j))/niter
4057+ enddo
4058+c Error estimation of the current bin using Poisson statistics,
4059+c making sure we normalise with the number of iterations.
4060+ if (histi(label,i).ne.0) then
4061+ etot=sqrt(histy2(label,i))*nPSinv
4062+ histy_err(label,i)= sqrt(((niter-1d0)*histy_err(label,i))
4063+ & **2+etot**2)/niter
4064+ else
4065+ histy_err(label,i)=(niter-1d0)/niter*histy_err(label,i)
4066+ endif
4067+ enddo
4068+ endif
4069+ end
4070+
4071+c Write the histograms to disk at the end of the run, multiplying the
4072+c output by 'xnorm'
4073+ subroutine HwU_output(unit,xnorm)
4074+ implicit none
4075+ include "HwU.inc"
4076+ integer unit,i,j,label
4077+ integer max_length
4078+ parameter (max_length=(max_wgts+3)*17)
4079+ character*(max_length) buffer
4080+ character*4 str_nbin
4081+ double precision xnorm
4082+c column info: x_min, x_max, y (central value), dy, {extra
4083+c weights}. Use columns with a width of 17 characters.
4084+ write (buffer( 1:17),'(a)')'##& xmin &'
4085+ write (buffer(18:34),'(a)')' xmax '
4086+ write (buffer(35:51),'(a2,a15)') ' &',wgts_info(1)(1:15)
4087+ write (buffer(52:68),'(a)')' & dy '
4088+ do j=2,nwgts
4089+ write (buffer((j+2)*17+1:(j+3)*17),'(a2,a15)')
4090+ $ ' &',wgts_info(j)(1:15)
4091+ enddo
4092+ write (unit,'(a)') buffer(1:(nwgts+3)*17)
4093+ write (unit,'(a)') ''
4094+ do label=1,max_plots
4095+ if (.not. booked(label)) cycle
4096+c title
4097+c For some weird reason, it is no possible to include directly
4098+c the integer in two line below with the format '(12a,i4.4,3a,a,2a)'
4099+c this is why I have to do it in two steps instead.
4100+ write (str_nbin,'(i4.4)') nbin(label)
4101+ write (unit,'(12a,4a,3a,a,2a)') '<histogram> ',str_nbin,
4102+ & ' " ',title(label),' "'
4103+c data
4104+ do i=1,nbin(label)
4105+ write (buffer( 1:16),'(2x,e14.7)') histxl(label,i)
4106+ write (buffer(17:32),'(2x,e14.7)') histxm(label,i)
4107+ write (buffer(33:48),'(2x,e14.7)') histy_acc(1,label,i)*xnorm
4108+ write (buffer(49:64),'(2x,e14.7)') histy_err(label,i)*xnorm
4109+ do j=2,nwgts
4110+ write (buffer((j+2)*16+1:(j+3)*16),'(2x,e14.7)')
4111+ $ histy_acc(j,label,i)*xnorm
4112+ enddo
4113+ write (unit,'(a)') buffer(1:(nwgts+3)*16)
4114+ enddo
4115+c 2 empty lines after each plot
4116+ write (unit,'(12a)') '<\histogram>'
4117+ write (unit,'(a)') ''
4118+ write (unit,'(a)') ''
4119+ enddo
4120+ return
4121+ end
4122+
4123+c dummy subroutine
4124+ subroutine accum(idummy)
4125+ integer idummy
4126+ end
4127+c dummy subroutine
4128+ subroutine addfil(string)
4129+ character*(*) string
4130+ end
4131
4132=== added file 'Template/NLO/FixedOrderAnalysis/HwU.inc'
4133--- Template/NLO/FixedOrderAnalysis/HwU.inc 1970-01-01 00:00:00 +0000
4134+++ Template/NLO/FixedOrderAnalysis/HwU.inc 2015-04-10 09:55:25 +0000
4135@@ -0,0 +1,22 @@
4136+* -*-fortran-*-
4137+
4138+ integer max_plots,max_bins,max_wgts,max_points
4139+ parameter (max_plots=200)
4140+ parameter (max_bins=100)
4141+ parameter (max_wgts=300)
4142+ parameter (max_points=max_plots*40)
4143+
4144+ logical booked(max_plots)
4145+ integer nbin(max_plots),nwgts,np,p_bin(max_points)
4146+ & ,p_label(max_points),histi(max_plots,max_bins)
4147+ character*50 title(max_plots)
4148+ character*15 wgts_info(max_wgts)
4149+ double precision histy(max_wgts,max_plots,max_bins)
4150+ $ ,histy_acc(max_wgts,max_plots,max_bins),histy2(max_plots
4151+ $ ,max_bins),histy_err(max_plots,max_bins),histxl(max_plots
4152+ $ ,max_bins),histxm(max_plots,max_bins),step(max_plots)
4153+ $ ,p_wgts(max_wgts,max_points)
4154+
4155+ common/HwU_common/histy,histy_acc,histy2,histy_err,histxl,histxm
4156+ & ,p_wgts,step,histi,nbin,p_bin,p_label,np,nwgts
4157+ & ,booked,title,wgts_info
4158
4159=== added file 'Template/NLO/FixedOrderAnalysis/analysis_HwU_pp_V.f'
4160--- Template/NLO/FixedOrderAnalysis/analysis_HwU_pp_V.f 1970-01-01 00:00:00 +0000
4161+++ Template/NLO/FixedOrderAnalysis/analysis_HwU_pp_V.f 2015-04-10 09:55:25 +0000
4162@@ -0,0 +1,139 @@
4163+c
4164+c Example analysis for "p p > w+ [QCD]" process.
4165+c Example analysis for "p p > w- [QCD]" process.
4166+c Example analysis for "p p > z [QCD]" process.
4167+c
4168+cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
4169+ subroutine analysis_begin(nwgt,weights_info)
4170+cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
4171+ implicit none
4172+ integer nwgt
4173+ character*(*) weights_info(*)
4174+ integer j,kk,l
4175+ character*6 cc(2)
4176+ data cc/'|T@NLO','|T@LO '/
4177+ real * 8 xmi,xms
4178+ call HwU_inithist(nwgt,weights_info)
4179+ xmi=40.d0
4180+ xms=120.d0
4181+ do j=1,2
4182+ l=(j-1)*5
4183+ call HwU_book(l+ 1,'V pt '//cc(j),100,0.d0,200.d0)
4184+ call HwU_book(l+ 2,'V log pt '//cc(j),100,0.d0,5.d0)
4185+ call HwU_book(l+ 3,'V y '//cc(j), 78,-9.d0,9.d0)
4186+ call HwU_book(l+ 4,'V eta '//cc(j), 78,-9.d0,9.d0)
4187+ call HwU_book(l+ 5,'mV '//cc(j), 80,xmi,xms)
4188+ enddo
4189+ return
4190+ end
4191+
4192+
4193+cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
4194+ subroutine analysis_end(dummy)
4195+cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
4196+ implicit none
4197+ double precision dummy
4198+ call HwU_write_file
4199+ return
4200+ end
4201+
4202+
4203+cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
4204+ subroutine analysis_fill(p,istatus,ipdg,wgts,ibody)
4205+cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
4206+ implicit none
4207+ include 'nexternal.inc'
4208+ integer istatus(nexternal)
4209+ integer iPDG(nexternal)
4210+ double precision p(0:4,nexternal)
4211+ double precision wgts(*)
4212+ integer ibody
4213+ double precision wgt,var
4214+ integer i,kk,l
4215+ double precision www,pv(0:3),xmv,ptv,yv,etav
4216+ double precision getrapidity,getpseudorap,dot
4217+ external getrapidity,getpseudorap,dot
4218+ if (nexternal.ne.4) then
4219+ write (*,*) 'error #1 in analysis_fill: '/
4220+ & /'only for process "p p > V [QCD]"'
4221+ stop 1
4222+ endif
4223+ if (.not. (abs(ipdg(1)).le.5 .or. ipdg(1).eq.21)) then
4224+ write (*,*) 'error #2 in analysis_fill: '/
4225+ & /'only for process "p p > V [QCD]"'
4226+ stop 1
4227+ endif
4228+ if (.not. (abs(ipdg(2)).le.5 .or. ipdg(2).eq.21)) then
4229+ write (*,*) 'error #3 in analysis_fill: '/
4230+ & /'only for process "p p > V [QCD]"'
4231+ stop 1
4232+ endif
4233+ if (.not. (abs(ipdg(4)).le.5 .or. ipdg(4).eq.21)) then
4234+ write (*,*) 'error #4 in analysis_fill: '/
4235+ & /'only for process "p p > V [QCD]"'
4236+ stop 1
4237+ endif
4238+ if (abs(ipdg(3)).ne.24.and.ipdg(3).ne.23) then
4239+ write (*,*) 'error #5 in analysis_fill: '/
4240+ & /'only for process "p p > V [QCD]"'
4241+ stop 1
4242+ endif
4243+C
4244+ do i=0,3
4245+ pv(i)=p(i,3)
4246+ enddo
4247+ xmv=sqrt(max(dot(pv,pv),0d0))
4248+ ptv=sqrt(max(pv(1)**2+pv(2)**2,0d0))
4249+ yv=getrapidity(pv(0),pv(3))
4250+ etav=getpseudorap(pv(0),pv(1),pv(2),pv(3))
4251+C
4252+ do i=1,2
4253+ l=(i-1)*5
4254+ if (ibody.ne.3 .and.i.eq.2) cycle
4255+ call HwU_fill(l+1,ptv,WGTS)
4256+ if(ptv.gt.0) call HwU_fill(l+2,log10(ptv),WGTS)
4257+ call HwU_fill(l+3,yv,WGTS)
4258+ call HwU_fill(l+4,etav,WGTS)
4259+ call HwU_fill(l+5,xmv,WGTS)
4260+ enddo
4261+C
4262+ 999 return
4263+ end
4264+
4265+
4266+
4267+ function getrapidity(en,pl)
4268+ implicit none
4269+ real*8 getrapidity,en,pl,tiny,xplus,xminus,y
4270+ parameter (tiny=1.d-8)
4271+ xplus=en+pl
4272+ xminus=en-pl
4273+ if(xplus.gt.tiny.and.xminus.gt.tiny)then
4274+ if( (xplus/xminus).gt.tiny.and.(xminus/xplus).gt.tiny)then
4275+ y=0.5d0*log( xplus/xminus )
4276+ else
4277+ y=sign(1.d0,pl)*1.d8
4278+ endif
4279+ else
4280+ y=sign(1.d0,pl)*1.d8
4281+ endif
4282+ getrapidity=y
4283+ return
4284+ end
4285+
4286+
4287+ function getpseudorap(en,ptx,pty,pl)
4288+ implicit none
4289+ real*8 getpseudorap,en,ptx,pty,pl,tiny,pt,eta,th
4290+ parameter (tiny=1.d-5)
4291+c
4292+ pt=sqrt(ptx**2+pty**2)
4293+ if(pt.lt.tiny.and.abs(pl).lt.tiny)then
4294+ eta=sign(1.d0,pl)*1.d8
4295+ else
4296+ th=atan2(pt,pl)
4297+ eta=-log(tan(th/2.d0))
4298+ endif
4299+ getpseudorap=eta
4300+ return
4301+ end
4302
4303=== added file 'Template/NLO/FixedOrderAnalysis/analysis_HwU_pp_h.f'
4304--- Template/NLO/FixedOrderAnalysis/analysis_HwU_pp_h.f 1970-01-01 00:00:00 +0000
4305+++ Template/NLO/FixedOrderAnalysis/analysis_HwU_pp_h.f 2015-04-10 09:55:25 +0000
4306@@ -0,0 +1,234 @@
4307+c
4308+c Example analysis for "p p > h [QCD]" process.
4309+c
4310+cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
4311+ subroutine analysis_begin(nwgt,weights_info)
4312+cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
4313+ implicit none
4314+ integer nwgt
4315+ character*(*) weights_info(*)
4316+ integer kk,l
4317+ call HwU_inithist(nwgt,weights_info)
4318+ call HwU_book(l+1,'Higgs pT ' ,100,0.d0,200.d0)
4319+ call HwU_book(l+2,'Higgs pT ' ,100,0.d0,500.d0)
4320+ call HwU_book(l+3,'Higgs log[pT] ' ,98,0.1d0,5.d0)
4321+ call HwU_book(l+4,'Higgs pT,|y_H|<2 ' ,100,0.d0,200.d0)
4322+ call HwU_book(l+5,'Higgs pT,|y_H|<2 ' ,100,0.d0,500.d0)
4323+ call HwU_book(l+6,'Higgs log[pT],|y_H|<2 ' ,98,0.1d0,5.d0)
4324+
4325+ call HwU_book(l+7,'j1 pT ' ,100,0.d0,200.d0)
4326+ call HwU_book(l+8,'j1 pT ' ,100,0.d0,500.d0)
4327+ call HwU_book(l+9,'j1 log[pT] ' ,98,0.1d0,5.d0)
4328+ call HwU_book(l+10,'j1 pT,|y_j1|<2 ' ,100,0.d0,200.d0)
4329+ call HwU_book(l+11,'j1 pT,|y_j1|<2 ' ,100,0.d0,500.d0)
4330+ call HwU_book(l+12,'j1 log[pT],|y_j1|<2 ' ,98,0.1d0,5.d0)
4331+
4332+ call HwU_book(l+13,'Inc j pT ' ,100,0.d0,200.d0)
4333+ call HwU_book(l+14,'Inc j pT ' ,100,0.d0,500.d0)
4334+ call HwU_book(l+15,'Inc j log[pT] ' ,98,0.1d0,5.d0)
4335+ call HwU_book(l+16,'Inc j pT,|y_Ij|<2 ' ,100,0.d0,2.d2)
4336+ call HwU_book(l+17,'Inc j pT,|y_Ij|<2 ' ,100,0.d0,5.d2)
4337+ call HwU_book(l+18,'Inc j log[pT],|y_Ij|<2' ,98,0.1d0,5.d0)
4338+
4339+ call HwU_book(l+19,'Higgs y ' ,60,-6.d0,6.d0)
4340+ call HwU_book(l+20,'Higgs y,pT_H>10GeV ' ,100,-6.d0,6.d0)
4341+ call HwU_book(l+21,'Higgs y,pT_H>30GeV ' ,100,-6.d0,6.d0)
4342+ call HwU_book(l+22,'Higgs y,pT_H>50GeV ' ,100,-6.d0,6.d0)
4343+ call HwU_book(l+23,'Higgs y,pT_H>70GeV ' ,100,-6.d0,6.d0)
4344+ call HwU_book(l+24,'Higgs y,pt_H>90GeV ' ,100,-6.d0,6.d0)
4345+
4346+ call HwU_book(l+25,'j1 y ' ,60,-6.d0,6.d0)
4347+ call HwU_book(l+26,'j1 y,pT_j1>10GeV ' ,100,-6.d0,6.d0)
4348+ call HwU_book(l+27,'j1 y,pT_j1>30GeV ' ,100,-6.d0,6.d0)
4349+ call HwU_book(l+28,'j1 y,pT_j1>50GeV ' ,100,-6.d0,6.d0)
4350+ call HwU_book(l+29,'j1 y,pT_j1>70GeV ' ,100,-6.d0,6.d0)
4351+ call HwU_book(l+30,'j1 y,pT_j1>90GeV ' ,100,-6.d0,6.d0)
4352+
4353+ call HwU_book(l+31,'H-j1 y ' ,60,-6.d0,6.d0)
4354+ call HwU_book(l+32,'H-j1 y,pT_j1>10GeV ' ,100,-6.d0,6.d0)
4355+ call HwU_book(l+33,'H-j1 y,pT_j1>30GeV ' ,100,-6.d0,6.d0)
4356+ call HwU_book(l+34,'H-j1 y,pT_j1>50GeV ' ,100,-6.d0,6.d0)
4357+ call HwU_book(l+35,'H-j1 y,pT_j1>70GeV ' ,100,-6.d0,6.d0)
4358+ call HwU_book(l+36,'H-j1 y,pT_j1>90GeV ' ,100,-6.d0,6.d0)
4359+
4360+ call HwU_book(l+37,'njets ' ,11,-0.5d0,10.5d0)
4361+ call HwU_book(l+38,'njets,|y_j|<2.5 ' ,11,-0.5d0,10.5d0)
4362+ call HwU_book(l+39,'xsec ' ,3,-0.5d0,2.5d0)
4363+ return
4364+ end
4365+
4366+
4367+
4368+cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
4369+ subroutine analysis_end(dummy)
4370+cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
4371+ implicit none
4372+ double precision dummy
4373+ call HwU_write_file
4374+ return
4375+ end
4376+
4377+
4378+
4379+cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
4380+ subroutine analysis_fill(p,istatus,ipdg,wgts,ibody)
4381+cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
4382+ implicit none
4383+ include 'nexternal.inc'
4384+ integer istatus(nexternal)
4385+ integer iPDG(nexternal)
4386+ double precision p(0:4,nexternal)
4387+ double precision wgts(*)
4388+ integer ibody
4389+ double precision wgt,var
4390+ integer i,kk,l
4391+ double precision www,pph(0:3),ppj1(0:3),pth,yh,ptj1,yj1,y_central
4392+ $ ,ptcut,njdble,njcdble
4393+ integer njet,njet_central,nj
4394+ double precision getrapidity
4395+ external getrapidity
4396+ if (nexternal.ne.4) then
4397+ write (*,*) 'error #1 in analysis_fill: '/
4398+ & /'only for process "p p > h [QCD]"'
4399+ stop 1
4400+ endif
4401+ if (.not. (abs(ipdg(1)).le.5 .or. ipdg(1).eq.21)) then
4402+ write (*,*) 'error #2 in analysis_fill: '/
4403+ & /'only for process "p p > h [QCD]"'
4404+ stop 1
4405+ endif
4406+ if (.not. (abs(ipdg(2)).le.5 .or. ipdg(2).eq.21)) then
4407+ write (*,*) 'error #3 in analysis_fill: '/
4408+ & /'only for process "p p > h [QCD]"'
4409+ stop 1
4410+ endif
4411+ if (.not. (abs(ipdg(4)).le.5 .or. ipdg(4).eq.21)) then
4412+ write (*,*) 'error #4 in analysis_fill: '/
4413+ & /'only for process "p p > h [QCD]"'
4414+ stop 1
4415+ endif
4416+ if (ipdg(3).ne.25) then
4417+ write (*,*) 'error #5 in analysis_fill: '/
4418+ & /'only for process "p p > h [QCD]"'
4419+ stop 1
4420+ endif
4421+c
4422+ do i=0,3
4423+ pph(i)=p(i,3)
4424+ ppj1(i)=p(i,4)
4425+ enddo
4426+c Higgs variables
4427+ pth=sqrt(pph(1)**2+pph(2)**2)
4428+ yh=getrapidity(pph(0),pph(3))
4429+c hardest jet variables
4430+ ptj1=sqrt(ppj1(1)**2+ppj1(2)**2)
4431+ yj1=getrapidity(ppj1(0),ppj1(3))
4432+ njet=0
4433+ njet_central=0
4434+ 8 y_central=2.5d0
4435+ ptcut=1d1
4436+ if(ptj1.gt.ptcut)njet=1
4437+ if(ptj1.gt.ptcut.and.abs(yj1).le.y_central)njet_central=1
4438+ njdble=dble(njet)
4439+ njcdble=dble(njet_central)
4440+C
4441+ l=0
4442+ call HwU_fill(l+1,pth,WGTS)
4443+ call HwU_fill(l+2,pth,WGTS)
4444+ if(pth.gt.0.d0)call HwU_fill(l+3,log10(pth),WGTS)
4445+ if(abs(yh).le.2.d0)then
4446+ call HwU_fill(l+4,pth,WGTS)
4447+ call HwU_fill(l+5,pth,WGTS)
4448+ if(pth.gt.0.d0)call HwU_fill(l+6,log10(pth),WGTS)
4449+ endif
4450+c
4451+ if(njet.ge.1)then
4452+ call HwU_fill(l+7,ptj1,WGTS)
4453+ call HwU_fill(l+8,ptj1,WGTS)
4454+ if(ptj1.gt.0.d0)call HwU_fill(l+9,log10(ptj1),WGTS)
4455+ if(abs(yj1).le.2.d0)then
4456+ call HwU_fill(l+10,ptj1,WGTS)
4457+ call HwU_fill(l+11,ptj1,WGTS)
4458+ if(ptj1.gt.0.d0)call HwU_fill(l+12,log10(ptj1),WGTS)
4459+ endif
4460+c
4461+ do nj=1,njet
4462+ call HwU_fill(l+13,ptj1,WGTS)
4463+ call HwU_fill(l+14,ptj1,WGTS)
4464+ if(ptj1.gt.0.d0)call HwU_fill(l+15,log10(ptj1),WGTS)
4465+ if(abs(yj1).le.2.d0)then
4466+ call HwU_fill(l+16,ptj1,WGTS)
4467+ call HwU_fill(l+17,ptj1,WGTS)
4468+ if(ptj1.gt.0d0)call HwU_fill(l+18,log10(ptj1),WGTS)
4469+ endif
4470+ enddo
4471+ endif
4472+c
4473+ call HwU_fill(l+19,yh,WGTS)
4474+ if(pth.ge.10.d0) call HwU_fill(l+20,yh,WGTS)
4475+ if(pth.ge.30.d0) call HwU_fill(l+21,yh,WGTS)
4476+ if(pth.ge.50.d0) call HwU_fill(l+22,yh,WGTS)
4477+ if(pth.ge.70.d0) call HwU_fill(l+23,yh,WGTS)
4478+ if(pth.ge.90.d0) call HwU_fill(l+24,yh,WGTS)
4479+c
4480+ if(njet.ge.1)then
4481+ call HwU_fill(l+25,yj1,WGTS)
4482+ if(ptj1.ge.10.d0) call HwU_fill(l+26,yj1,WGTS)
4483+ if(ptj1.ge.30.d0) call HwU_fill(l+27,yj1,WGTS)
4484+ if(ptj1.ge.50.d0) call HwU_fill(l+28,yj1,WGTS)
4485+ if(ptj1.ge.70.d0) call HwU_fill(l+29,yj1,WGTS)
4486+ if(ptj1.ge.90.d0) call HwU_fill(l+30,yj1,WGTS)
4487+c
4488+ call HwU_fill(l+31,yh-yj1,WGTS)
4489+ if(ptj1.ge.10.d0) call HwU_fill(l+32,yh-yj1,WGTS)
4490+ if(ptj1.ge.30.d0) call HwU_fill(l+33,yh-yj1,WGTS)
4491+ if(ptj1.ge.50.d0) call HwU_fill(l+34,yh-yj1,WGTS)
4492+ if(ptj1.ge.70.d0) call HwU_fill(l+35,yh-yj1,WGTS)
4493+ if(ptj1.ge.90.d0) call HwU_fill(l+36,yh-yj1,WGTS)
4494+ endif
4495+c
4496+ call HwU_fill(l+37,njdble,WGTS)
4497+ call HwU_fill(l+38,njcdble,WGTS)
4498+ call HwU_fill(l+39,1d0,WGTS)
4499+c
4500+C
4501+ 999 return
4502+ end
4503+
4504+
4505+
4506+ function getrapidity(en,pl)
4507+ implicit none
4508+ real*8 getrapidity,en,pl,tiny,xplus,xminus,y
4509+ parameter (tiny=1.d-8)
4510+ xplus=en+pl
4511+ xminus=en-pl
4512+ if(xplus.gt.tiny.and.xminus.gt.tiny)then
4513+ if( (xplus/xminus).gt.tiny.and.(xminus/xplus).gt.tiny)then
4514+ y=0.5d0*log( xplus/xminus )
4515+ else
4516+ y=sign(1.d0,pl)*1.d8
4517+ endif
4518+ else
4519+ y=sign(1.d0,pl)*1.d8
4520+ endif
4521+ getrapidity=y
4522+ return
4523+ end
4524+
4525+
4526+ function getpseudorap(en,ptx,pty,pl)
4527+ implicit none
4528+ real*8 getpseudorap,en,ptx,pty,pl,tiny,pt,eta,th
4529+ parameter (tiny=1.d-5)
4530+c
4531+ pt=sqrt(ptx**2+pty**2)
4532+ if(pt.lt.tiny.and.abs(pl).lt.tiny)then
4533+ eta=sign(1.d0,pl)*1.d8
4534+ else
4535+ th=atan2(pt,pl)
4536+ eta=-log(tan(th/2.d0))
4537+ endif
4538+ getpseudorap=eta
4539+ return
4540+ end
4541
4542=== added file 'Template/NLO/FixedOrderAnalysis/analysis_HwU_pp_hjj.f'
4543--- Template/NLO/FixedOrderAnalysis/analysis_HwU_pp_hjj.f 1970-01-01 00:00:00 +0000
4544+++ Template/NLO/FixedOrderAnalysis/analysis_HwU_pp_hjj.f 2015-04-10 09:55:25 +0000
4545@@ -0,0 +1,777 @@
4546+c
4547+c Example analysis for "p p > h j j [QCD]" process.
4548+c
4549+cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
4550+ subroutine analysis_begin(nwgt,weights_info)
4551+cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
4552+ implicit none
4553+ integer nwgt
4554+ character*(*) weights_info(*)
4555+ integer i,kk,l
4556+ character*8 cc(2)
4557+ data cc/' ','vbfcuts '/
4558+ double precision pi
4559+ PARAMETER (PI=3.14159265358979312D0)
4560+ include 'dbook.inc'
4561+ real*8 vetomin, vetomax
4562+ integer nbinveto
4563+ common /to_veto_hist/vetomin,vetomax,nbinveto
4564+c
4565+ call HwU_inithist(nwgt,weights_info)
4566+ vetomin = 0d0
4567+ vetomax = 100d0
4568+ nbinveto = 50
4569+ do i=1,2
4570+ l=(i-1)*54
4571+ call HwU_book(l+ 1,'total ' //cc(i),5,0.5d0,5.5d0)
4572+
4573+ call HwU_book(l+ 2,'Higgs pT ' //cc(i),50,0.d0,400.d0)
4574+ call HwU_book(l+ 3,'Higgs pT ' //cc(i),50,0.d0,800.d0)
4575+ call HwU_book(l+ 4,'Higgs logpT ' //cc(i),50,0.d0,4.d0)
4576+ call HwU_book(l+ 5,'Higgs eta ' //cc(i),50,-6.d0,6.d0)
4577+ call HwU_book(l+ 6,'Higgs y ' //cc(i),50,-6.d0,6.d0)
4578+
4579+ call HwU_book(l+ 7,'j1 pT ' //cc(i),50,0.d0,400.d0)
4580+ call HwU_book(l+ 8,'j1 pT ' //cc(i),50,0.d0,800.d0)
4581+ call HwU_book(l+ 9,'j1 logpT ' //cc(i),50,0.d0,4.d0)
4582+ call HwU_book(l+ 10,'j1 eta ' //cc(i),50,-6.d0,6.d0)
4583+ call HwU_book(l+ 11,'j1 y ' //cc(i),50,-6.d0,6.d0)
4584+
4585+ call HwU_book(l+ 12,'j2 pT ' //cc(i),50,0.d0,400.d0)
4586+ call HwU_book(l+ 13,'j2 pT ' //cc(i),50,0.d0,800.d0)
4587+ call HwU_book(l+ 14,'j2 logpT ' //cc(i),50,0.d0,4.d0)
4588+ call HwU_book(l+ 15,'j2 eta ' //cc(i),50,-6.d0,6.d0)
4589+ call HwU_book(l+ 16,'j2 y ' //cc(i),50,-6.d0,6.d0)
4590+
4591+ call HwU_book(l+ 17,'j3 pT ' //cc(i),50,0.d0,400.d0)
4592+ call HwU_book(l+ 18,'j3 pT ' //cc(i),50,0.d0,800.d0)
4593+ call HwU_book(l+ 19,'j3 logpT ' //cc(i),50,0.d0,4.d0)
4594+ call HwU_book(l+ 20,'j3 eta ' //cc(i),50,-6.d0,6.d0)
4595+ call HwU_book(l+ 21,'j3 y ' //cc(i),50,-6.d0,6.d0)
4596+
4597+ call HwU_book(l+ 22,'H+j1 pT ' //cc(i),50,0.d0,400.d0)
4598+ call HwU_book(l+ 23,'H+j1 pT ' //cc(i),50,0.d0,800.d0)
4599+ call HwU_book(l+ 24,'H+j1 logpT ' //cc(i),50,0.d0,4.d0)
4600+ call HwU_book(l+ 25,'H+j1 eta ' //cc(i),50,-6.d0,6.d0)
4601+ call HwU_book(l+ 26,'H+j1 y ' //cc(i),50,-6.d0,6.d0)
4602+
4603+ call HwU_book(l+ 27,'j1+j2 pT ' //cc(i),50,0.d0,400.d0)
4604+ call HwU_book(l+ 28,'j1+j2 pT ' //cc(i),50,0.d0,800.d0)
4605+ call HwU_book(l+ 29,'j1+j2 logpT ' //cc(i),50,0.d0,4.d0)
4606+ call HwU_book(l+ 30,'j1+j2 eta ' //cc(i),50,-6.d0,6.d0)
4607+ call HwU_book(l+ 31,'j1+j2 y ' //cc(i),50,-6.d0,6.d0)
4608+
4609+ call HwU_book(l+ 32,'syst pT ' //cc(i),50,0.d0,400.d0)
4610+ call HwU_book(l+ 33,'syst pT ' //cc(i),50,0.d0,800.d0)
4611+ call HwU_book(l+ 34,'syst logpT ' //cc(i),50,0.d0,4.d0)
4612+ call HwU_book(l+ 35,'syst eta ' //cc(i),50,-10.d0,10.d0)
4613+ call HwU_book(l+ 36,'syst y ' //cc(i),50,-6.d0,6.d0)
4614+
4615+ call HwU_book(l+ 37,'Dphi H-j1 ' //cc(i),50,0d0,pi)
4616+ call HwU_book(l+ 38,'Dphi H-j2 ' //cc(i),50,0d0,pi)
4617+ call HwU_book(l+ 39,'Dphi j1-j2 ' //cc(i),50,0d0,pi)
4618+
4619+ call HwU_book(l+ 40,'DR H-j1 ' //cc(i),50,0d0,10.d0)
4620+ call HwU_book(l+ 41,'DR H-j2 ' //cc(i),50,0d0,10.d0)
4621+ call HwU_book(l+ 42,'DR j1-j2 ' //cc(i),50,0d0,10.d0)
4622+
4623+ call HwU_book(l+ 43,'mj1j2 ' //cc(i),50,0d0,3000.d0)
4624+
4625+c Nason-Oleari plots (hep-ph/0911.5299)
4626+ call HwU_book(l+ 44,'|yj1-yj2| ' //cc(i),25,0.d0,10.d0)
4627+ call HwU_book(l+ 45,'yj3_rel ' //cc(i),50,-6.d0,6.d0)
4628+ call HwU_book(l+ 46,'njets ' //cc(i),100,-0.5d0,9.5d0)
4629+ call HwU_book(l+ 47,'ptrel_j1 ' //cc(i),50,0.d0,200.d0)
4630+ call HwU_book(l+ 48,'ptrel_j2 ' //cc(i),50,0.d0,200.d0)
4631+ call HwU_book(l+ 49,'P-veto ' //cc(i), dble(nbinveto),vetomin
4632+ & ,vetomax)
4633+ call HwU_book(l+ 50,'jveto pT ' //cc(i), dble(nbinveto),vetomin
4634+ & ,vetomax)
4635+ call HwU_book(l+ 51,'jveto pT ' //cc(i), dble(nbinveto),
4636+ & vetomin,2d0*vetomax)
4637+ call HwU_book(l+ 52,'jveto logpT ' //cc(i),50,0.d0,4.d0)
4638+ call HwU_book(l+ 53,'jveto eta ' //cc(i),50,-6.d0,6.d0)
4639+ call HwU_book(l+ 54,'jveto y ' //cc(i),50,-6.d0,6.d0)
4640+
4641+ enddo
4642+ return
4643+ end
4644+
4645+
4646+
4647+
4648+cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
4649+ subroutine analysis_end(dummy)
4650+cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
4651+ implicit none
4652+ double precision dummy
4653+ call HwU_write_file
4654+ return
4655+ end
4656+
4657+
4658+cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
4659+ subroutine analysis_fill(p,istatus,ipdg,wgts,ibody)
4660+cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
4661+ implicit none
4662+ include 'nexternal.inc'
4663+ integer istatus(nexternal)
4664+ integer iPDG(nexternal)
4665+ double precision p(0:4,nexternal)
4666+ double precision wgts(*)
4667+ integer ibody
4668+ double precision wgt,var
4669+ integer i,j,k,kk,l
4670+ double precision www,pQCD(0:3,nexternal),palg,rfj,sycut,yjmax
4671+ $ ,pjet(0:3,nexternal),ptjet(nexternal),yjet(nexternal)
4672+ $ ,etajet(nexternal),ptj_tag,deltay12,mj1j2min,ph(0:3),pj1(0:3)
4673+ $ ,pj2(0:3),pj3(0:3),pjj(0:3),pHj(0:3),psyst(0:3),pjveto(0:3)
4674+ $ ,ptH,etaH,yH,njdble,ptj1,etaj1,yj1,ptHj,etaHj,yHj,DphiHj1
4675+ $ ,DRHj1,ptj2,etaj2,yj2,ptjj,etajj,yjj,ptsyst,etasyst,ysyst
4676+ $ ,DphiHj2,Dphij1j2,DRHj2,DRj1j2,mj1j2,Dyj1j2,ptj3,etaj3,yj3
4677+ $ ,yj3rel,chy1,shy1,chy1mo,chy2,shy2,chy2mo,ptrel_j1,ptrel_j2
4678+ $ ,ppboost(0:3,nexternal),prel_j1(0:3),prel_j2(0:3)
4679+ $ ,pj1boost(0:3),pj2boost(0:3),pt_veto,xsecup2
4680+ logical pass_tag_cuts,flag
4681+ integer nQCD,jet(nexternal),ij1y,ij2y,ij3y,njet,njety,ijveto
4682+ $ ,ijvetoy,ij1,ij2,ij3
4683+ double precision getptv4,getrapidityv4,getpseudorapv4,getdelphiv4
4684+ $ ,getdrv4,getinvmv4,getmod
4685+ external getptv4,getrapidityv4,getpseudorapv4,getdelphiv4,getdrv4
4686+ $ ,getinvmv4,getmod
4687+ real*8 vetomin, vetomax
4688+ integer nbinveto
4689+ common /to_veto_hist/vetomin,vetomax,nbinveto
4690+ real*8 xd(1:3)
4691+ data (xd(i),i=1,3)/0d0,0d0,1d0/
4692+ if (nexternal.ne.6) then
4693+ write (*,*) 'error #1 in analysis_fill: '/
4694+ & /'only for process "p p > h j j [QCD]"'
4695+ stop 1
4696+ endif
4697+ if (.not. (abs(ipdg(1)).le.5 .or. ipdg(1).eq.21)) then
4698+ write (*,*) 'error #2 in analysis_fill: '/
4699+ & /'only for process "p p > h j j [QCD]"'
4700+ stop 1
4701+ endif
4702+ if (.not. (abs(ipdg(2)).le.5 .or. ipdg(2).eq.21)) then
4703+ write (*,*) 'error #3 in analysis_fill: '/
4704+ & /'only for process "p p > h j j [QCD]"'
4705+ stop 1
4706+ endif
4707+ if (.not. (abs(ipdg(4)).le.5 .or. ipdg(4).eq.21)) then
4708+ write (*,*) 'error #4 in analysis_fill: '/
4709+ & /'only for process "p p > h j j [QCD]"'
4710+ stop 1
4711+ endif
4712+ if (.not. (abs(ipdg(5)).le.5 .or. ipdg(5).eq.21)) then
4713+ write (*,*) 'error #5 in analysis_fill: '/
4714+ & /'only for process "p p > h j j [QCD]"'
4715+ stop 1
4716+ endif
4717+ if (.not. (abs(ipdg(6)).le.5 .or. ipdg(6).eq.21)) then
4718+ write (*,*) 'error #6 in analysis_fill: '/
4719+ & /'only for process "p p > h j j [QCD]"'
4720+ stop 1
4721+ endif
4722+ if (ipdg(3).ne.25) then
4723+ write (*,*) 'error #7 in analysis_fill: '/
4724+ & /'only for process "p p > h j j [QCD]"'
4725+ stop 1
4726+ endif
4727+c
4728+
4729+c Put all (light) QCD partons in momentum array for jet clustering.
4730+ nQCD=0
4731+ do j=nincoming+1,nexternal
4732+ if (abs(ipdg(j)).le.5 .or. ipdg(j).eq.21) then
4733+ nQCD=nQCD+1
4734+ do i=0,3
4735+ pQCD(i,nQCD)=p(i,j)
4736+ enddo
4737+ endif
4738+ enddo
4739+
4740+C---CLUSTER THE EVENT
4741+ palg = -1.d0
4742+ rfj = 0.4d0
4743+ sycut = 20d0
4744+ yjmax = 4.5d0
4745+ do i=1,nexternal
4746+ do j=0,3
4747+ pjet(j,i)=0d0
4748+ enddo
4749+ ptjet(i)=0d0
4750+ yjet(i)=0d0
4751+ etajet(i)=0d0
4752+ jet(i)=0
4753+ enddo
4754+ ij1y=0
4755+ ij2y=0
4756+ ij3y=0
4757+ njet=0
4758+ njety=0
4759+ ijveto = 0
4760+ ijvetoy = 0
4761+
4762+
4763+c******************************************************************************
4764+c call FASTJET to get all the jets
4765+c
4766+c INPUT:
4767+c input momenta: pQCD(0:3,nexternal), energy is 0th component
4768+c number of input momenta: nQCD
4769+c radius parameter: rfj
4770+c minumum jet pt: sycut
4771+c jet algorithm: palg, 1.0=kt, 0.0=C/A, -1.0 = anti-kt
4772+c
4773+c OUTPUT:
4774+c jet momenta: pjet(0:3,nexternal), E is 0th cmpnt
4775+c the number of jets (with pt > SYCUT): njet
4776+c the jet for a given particle 'i': jet(i), note that this is
4777+c the particle in pQCD, which doesn't necessarily correspond to the particle
4778+c label in the process
4779+c
4780+ call amcatnlo_fastjetppgenkt(pQCD,nQCD,rfj,sycut,palg,pjet,njet
4781+ $ ,jet)
4782+c
4783+c******************************************************************************
4784+ do i=1,njet
4785+ ptjet(i)=getptv4(pjet(0,i))
4786+ if(i.gt.1)then
4787+ if (ptjet(i).gt.ptjet(i-1)) then
4788+ write (*,*) "Error 1: jets should be ordered in pt"
4789+ stop
4790+ endif
4791+ endif
4792+ yjet(i)=getrapidityv4(pjet(0,i))
4793+ etajet(i)=getpseudorapv4(pjet(0,i))
4794+c look for veto jet without y cuts
4795+ if (i.gt.2.and.yjet(i).gt.min(yjet(1),yjet(2)).and.
4796+ & yjet(i).lt.max(yjet(1),yjet(2)).and.ijveto.eq.0) ijveto=i
4797+
4798+C now look for jets within the rapidity cuts
4799+ if (dabs(yjet(i)).lt.yjmax) then
4800+ njety=njety+1
4801+ if (ij1y.eq.0) then
4802+ ij1y = i
4803+ else if (ij2y.eq.0) then
4804+ ij2y = i
4805+ else if (ij3y.eq.0) then
4806+ ij3y = i
4807+ endif
4808+c look for veto jet with y cuts
4809+ if (ij3y.gt.0.and.
4810+ & yjet(i).gt.min(yjet(ij1y),yjet(ij2y)).and.
4811+ & yjet(i).lt.max(yjet(ij1y),yjet(ij2y)).and.ijvetoy.eq.0)
4812+ & ijvetoy = i
4813+ endif
4814+ enddo
4815+
4816+c Nason-Oleari cuts (hep-ph/0911.5299)
4817+ ptj_tag = 20d0
4818+ deltay12 = 4.d0
4819+ mj1j2min = 600d0
4820+
4821+c this is the loop for w-o / w vbf cuts
4822+ do i=1,2
4823+ if(i.eq.1) then
4824+ ij1 = 1
4825+ ij2 = 2
4826+ ij3 = 3
4827+ endif
4828+ if(i.eq.2) then
4829+ njet = njety
4830+ ijveto = ijvetoy
4831+ ij1 = ij1y
4832+ ij2 = ij2y
4833+ ij3 = ij3y
4834+ endif
4835+
4836+c Load momenta
4837+ xsecup2=1d0
4838+ do k=0,3
4839+ pH(k) =p(k,3)
4840+ pj1(k) =pjet(k,ij1)
4841+ pj2(k) =pjet(k,ij2)
4842+ pj3(k) =pjet(k,ij3)
4843+ pjj(k) =pjet(k,ij1)+pjet(k,ij2)
4844+ pHj(k) =pjet(k,ij1)+pH(k)
4845+ psyst(k)=pjet(k,ij1)+pjet(k,ij2)+pH(k)
4846+ pjveto(k)=pjet(k,ijveto)
4847+ enddo
4848+
4849+c Define observables
4850+c Higgs
4851+ ptH = getptv4(pH)
4852+ etaH = getpseudorapv4(pH)
4853+ yH = getrapidityv4(pH)
4854+ njdble = dble(njet)
4855+c At least one jet
4856+ if(njet.ge.1)then
4857+ ptj1 = getptv4(pj1)
4858+ etaj1 = getpseudorapv4(pj1)
4859+ yj1 = getrapidityv4(pj1)
4860+ ptHj = getptv4(pHj)
4861+ etaHj = getpseudorapv4(pHj)
4862+ yHj = getrapidityv4(pHj)
4863+ DphiHj1 = getdelphiv4(pH,pj1)
4864+ DRHj1 = getdrv4(pH,pj1)
4865+ endif
4866+c At least two jets
4867+ if(njet.ge.2)then
4868+ ptj2 = getptv4(pj2)
4869+ etaj2 = getpseudorapv4(pj2)
4870+ yj2 = getrapidityv4(pj2)
4871+ ptjj = getptv4(pjj)
4872+ etajj = getpseudorapv4(pjj)
4873+ yjj = getrapidityv4(pjj)
4874+ ptsyst = getptv4(psyst)
4875+ etasyst = getpseudorapv4(psyst)
4876+ ysyst = getrapidityv4(psyst)
4877+ DphiHj2 = getdelphiv4(pH,pj2)
4878+ Dphij1j2= getdelphiv4(pj1,pj2)
4879+ DRHj2 = getdrv4(pH,pj2)
4880+ DRj1j2 = getdrv4(pj1,pj2)
4881+ mj1j2 = getinvmv4(pjj)
4882+ Dyj1j2 = abs(yj1-yj2)
4883+ endif
4884+c At least three jets
4885+ if(njet.ge.3)then
4886+ ptj3 = getptv4(pj3)
4887+ etaj3 = getpseudorapv4(pj3)
4888+ yj3 = getrapidityv4(pj3)
4889+ yj3rel = yj3-(yj1+yj2)/2d0
4890+ endif
4891+c
4892+ chy1=cosh(yj1)
4893+ shy1=sinh(yj1)
4894+ chy1mo=chy1-1.d0
4895+ chy2=cosh(yj2)
4896+ shy2=sinh(yj2)
4897+ chy2mo=chy2-1.d0
4898+
4899+ call boostwdir2(chy1,shy1,chy1mo,xd,pj1,pj1boost)
4900+ call boostwdir2(chy2,shy2,chy2mo,xd,pj2,pj2boost)
4901+ ptrel_j1=0d0
4902+ ptrel_j2=0d0
4903+
4904+ pass_tag_cuts = njety.ge.2 .and.
4905+ & ptj1.ge.ptj_tag .and.
4906+ & ptj2.ge.ptj_tag .and.
4907+ & abs(yj1-yj2).ge.deltay12 .and.
4908+ & yj1*yj2.le.0d0 .and.
4909+ & mj1j2.ge.mj1j2min
4910+
4911+ if(i.eq.1) then
4912+ flag=.true.
4913+ endif
4914+
4915+ if(i.eq.2) then
4916+ flag=pass_tag_cuts
4917+ endif
4918+
4919+
4920+ do j=1,nQCD
4921+ if(njet.ge.1.and.jet(j).eq.1)then
4922+ call boostwdir2(chy1,shy1,chy1mo,xd,pQCD(0,j),ppboost(0,j))
4923+ call getwedge(ppboost(0,j),pj1boost,prel_j1)
4924+ ptrel_j1=ptrel_j1+getmod(prel_j1)/getmod(pj1boost)
4925+ elseif(njet.ge.2.and.jet(j).eq.2)then
4926+ call boostwdir2(chy2,shy2,chy2mo,xd,pQCD(0,j),ppboost(0,j))
4927+ call getwedge(ppboost(0,j),pj2boost,prel_j2)
4928+ ptrel_j2=ptrel_j2+getmod(prel_j2)/getmod(pj2boost)
4929+ endif
4930+ enddo
4931+
4932+ l=(i-1)*54
4933+ if(flag)then
4934+ call HwU_fill(l+ 1,1d0,wgts)
4935+ call HwU_fill(l+ 2,ptH,wgts)
4936+ call HwU_fill(l+ 3,ptH,wgts)
4937+ if(ptH.gt.0d0) call HwU_fill(l+ 4,log10(ptH),wgts)
4938+ call HwU_fill(l+ 5,etaH,wgts)
4939+ call HwU_fill(l+ 6,yH,wgts)
4940+ call HwU_fill(l+ 46,njdble,wgts)
4941+
4942+ if(njet.ge.1)then
4943+ call HwU_fill(l+ 7,ptj1,wgts)
4944+ call HwU_fill(l+ 8,ptj1,wgts)
4945+ if (ptj1.gt.0d0) call HwU_fill(l+ 9,log10(ptj1),wgts)
4946+ call HwU_fill(l+ 10,etaj1,wgts)
4947+ call HwU_fill(l+ 11,yj1,wgts)
4948+ call HwU_fill(l+ 22,ptHj,wgts)
4949+ call HwU_fill(l+ 23,ptHj,wgts)
4950+ if(ptHj.gt.0d0) call HwU_fill(l+ 24,log10(ptHj),wgts)
4951+ call HwU_fill(l+ 25,etaHj,wgts)
4952+ call HwU_fill(l+ 26,yHj,wgts)
4953+ call HwU_fill(l+ 37,DphiHj1,wgts)
4954+ call HwU_fill(l+ 40,DRHj1,wgts)
4955+ call HwU_fill(l+ 47,ptrel_j1,wgts)
4956+ endif
4957+
4958+ if(njet.ge.2)then
4959+ call HwU_fill(l+ 12,ptj2,wgts)
4960+ call HwU_fill(l+ 13,ptj2,wgts)
4961+ if (ptj2.gt.0d0) call HwU_fill(l+ 14,log10(ptj2),wgts)
4962+ call HwU_fill(l+ 15,etaj2,wgts)
4963+ call HwU_fill(l+ 16,yj2,wgts)
4964+ call HwU_fill(l+ 27,ptjj,wgts)
4965+ call HwU_fill(l+ 28,ptjj,wgts)
4966+ if(ptjj.gt.0d0) call HwU_fill(l+ 29,log10(ptjj),wgts)
4967+ call HwU_fill(l+ 30,etajj,wgts)
4968+ call HwU_fill(l+ 31,yjj,wgts)
4969+ call HwU_fill(l+ 32,ptsyst,wgts)
4970+ call HwU_fill(l+ 33,ptsyst,wgts)
4971+ if(ptsyst.gt.0d0) call HwU_fill(l+ 34,log10(ptsyst),wgts)
4972+ call HwU_fill(l+ 35,etasyst,wgts)
4973+ call HwU_fill(l+ 36,ysyst,wgts)
4974+ call HwU_fill(l+ 38,DphiHj2,wgts)
4975+ call HwU_fill(l+ 39,Dphij1j2,wgts)
4976+ call HwU_fill(l+ 41,DRHj2,wgts)
4977+ call HwU_fill(l+ 42,DRj1j2,wgts)
4978+ call HwU_fill(l+ 43,mj1j2,wgts)
4979+ call HwU_fill(l+ 44,Dyj1j2,wgts)
4980+ call HwU_fill(l+ 48,ptrel_j2,wgts)
4981+ endif
4982+
4983+ if(njet.ge.3)then
4984+ call HwU_fill(l+ 17,ptj3,wgts)
4985+ call HwU_fill(l+ 18,ptj3,wgts)
4986+ if(ptj3.gt.0d0) call HwU_fill(l+ 19,log10(ptj3),wgts)
4987+ call HwU_fill(l+ 20,etaj3,wgts)
4988+ call HwU_fill(l+ 21,yj3,wgts)
4989+ call HwU_fill(l+ 45,yj3rel,wgts)
4990+ endif
4991+ if (ijveto.gt.0) then
4992+ pt_veto = getptv4(pjveto)
4993+ do k=1,nbinveto
4994+ if (pt_veto.gt. (vetomin+(vetomax-vetomin)*dble(k-1)
4995+ $ /dble(nbinveto))) then
4996+ call HwU_fill(l+49, (vetomax-vetomin)* dble(k)
4997+ $ /dble(nbinveto)*0.99, wgts/xsecup2)
4998+ endif
4999+ enddo
5000+ call HwU_fill(l+50,pt_veto,wgts)
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches

to all changes: