Merge lp:~mg5core1/mg5amcnlo/2.5.6 into lp:mg5amcnlo/lts

Proposed by Olivier Mattelaer
Status: Merged
Merged at revision: 274
Proposed branch: lp:~mg5core1/mg5amcnlo/2.5.6
Merge into: lp:mg5amcnlo/lts
Diff against target: 30012 lines (+12931/-7078)
292 files modified
MadSpin/decay.py (+9/-4)
MadSpin/src/driver.f (+1/-0)
Template/LO/Cards/run_card.dat (+1/-1)
Template/LO/Source/.make_opts (+22/-8)
Template/LO/Source/PDF/pdf.f (+1/-1)
Template/LO/Source/PDF/pdg2pdf.f (+5/-0)
Template/LO/Source/PDF/pdg2pdf_lhapdf.f (+5/-0)
Template/LO/Source/dsample.f (+39/-8)
Template/LO/SubProcesses/dummy_fct.f (+47/-0)
Template/LO/SubProcesses/genps.f (+184/-94)
Template/LO/SubProcesses/makefile (+2/-1)
Template/LO/SubProcesses/refine.sh (+1/-1)
Template/LO/SubProcesses/unwgt.f (+1/-1)
Template/NLO/Cards/run_card.dat (+1/-1)
Template/NLO/Cards/shower_card.dat (+1/-1)
Template/NLO/FixedOrderAnalysis/HwU.f (+199/-59)
Template/NLO/FixedOrderAnalysis/HwU.inc (+0/-22)
Template/NLO/FixedOrderAnalysis/analysis_HwU_template.f (+2/-2)
Template/NLO/MCatNLO/include/reweight0.inc (+3/-0)
Template/NLO/MCatNLO/srcHerwig/madfks_hwdriver.f (+19/-1)
Template/NLO/MCatNLO/srcHerwig/madfks_hwlhin.f (+0/-1)
Template/NLO/MCatNLO/srcPythia/madfks_pydriver.f (+1/-1)
Template/NLO/MCatNLO/srcPythia/madfks_pylhin.f (+0/-1)
Template/NLO/MCatNLO/srcPythia8/Pythia8.cc (+2/-2)
Template/NLO/MCatNLO/srcPythia8/Pythia82.cc (+2/-2)
Template/NLO/MCatNLO/srcPythia8/Pythia82_hep.cc (+2/-2)
Template/NLO/MCatNLO/srcPythia8/Pythia8_hep.cc (+2/-2)
Template/NLO/Source/alfas_functions_lhapdf.f (+1/-1)
Template/NLO/Source/extra_weights.f (+43/-0)
Template/NLO/Source/getissud.f (+0/-201)
Template/NLO/Source/make_opts.inc (+12/-5)
Template/NLO/Source/makefile (+5/-9)
Template/NLO/Source/run.inc (+0/-5)
Template/NLO/Source/run_config.inc (+0/-54)
Template/NLO/Source/setrun.f (+60/-177)
Template/NLO/Source/sudgrid.inc (+0/-4)
Template/NLO/SubProcesses/add_write_info.f (+0/-1)
Template/NLO/SubProcesses/analysis_lhe.f (+6/-5)
Template/NLO/SubProcesses/c_weight.inc (+0/-24)
Template/NLO/SubProcesses/check_poles.f (+1/-0)
Template/NLO/SubProcesses/collect_events.f (+7/-14)
Template/NLO/SubProcesses/combine_root.C (+5/-4)
Template/NLO/SubProcesses/cuts.f (+39/-24)
Template/NLO/SubProcesses/driver_mintFO.f (+11/-10)
Template/NLO/SubProcesses/driver_mintMC.f (+30/-27)
Template/NLO/SubProcesses/fks_singular.f (+267/-933)
Template/NLO/SubProcesses/genps_fks.f (+22/-92)
Template/NLO/SubProcesses/handling_lhe_events.f (+52/-30)
Template/NLO/SubProcesses/madfks_plot.f (+20/-11)
Template/NLO/SubProcesses/makefile (+7/-6)
Template/NLO/SubProcesses/makefile_fks_dir (+18/-16)
Template/NLO/SubProcesses/mirror.f (+0/-27)
Template/NLO/SubProcesses/montecarlocounter.f (+50/-22)
Template/NLO/SubProcesses/reweight.f (+14/-14)
Template/NLO/SubProcesses/reweight.inc (+0/-39)
Template/NLO/SubProcesses/reweight0.inc (+0/-155)
Template/NLO/SubProcesses/reweight1.inc (+0/-13)
Template/NLO/SubProcesses/reweightNLO.inc (+0/-16)
Template/NLO/SubProcesses/reweight_all.inc (+0/-74)
Template/NLO/SubProcesses/reweight_xsec.f (+1/-1063)
Template/NLO/SubProcesses/reweight_xsec_events.f (+28/-32)
Template/NLO/SubProcesses/setcuts.f (+1/-39)
Template/NLO/SubProcesses/setscales.f (+1/-5)
Template/NLO/SubProcesses/symmetry_fks_test_MC.f (+0/-673)
Template/NLO/SubProcesses/symmetry_fks_test_ME.f (+0/-596)
Template/NLO/SubProcesses/symmetry_fks_v3.f (+76/-310)
Template/NLO/SubProcesses/test_soft_col_limits.f (+542/-0)
Template/NLO/SubProcesses/timing_variables.inc (+3/-4)
Template/NLO/SubProcesses/trapfpe_secure.c (+0/-86)
Template/NLO/SubProcesses/weight_lines.f (+251/-0)
Template/NLO/SubProcesses/write_event.f (+7/-53)
Template/NLO/Utilities/check_events.f (+164/-92)
Template/NLO/Utilities/makefile (+3/-2)
Template/RWGTNLO/makefile (+1/-1)
Template/loop_material/StandAlone/SubProcesses/makefile (+10/-1)
UpdateNotes.txt (+51/-0)
VERSION (+2/-1)
aloha/create_aloha.py (+10/-7)
madgraph/core/base_objects.py (+16/-2)
madgraph/core/diagram_generation.py (+3/-4)
madgraph/core/helas_objects.py (+2/-2)
madgraph/interface/amcatnlo_run_interface.py (+40/-24)
madgraph/interface/common_run_interface.py (+101/-56)
madgraph/interface/extended_cmd.py (+24/-9)
madgraph/interface/loop_interface.py (+26/-9)
madgraph/interface/madevent_interface.py (+94/-22)
madgraph/interface/madgraph_interface.py (+22/-16)
madgraph/interface/madweight_interface.py (+1/-1)
madgraph/interface/reweight_interface.py (+745/-638)
madgraph/iolibs/export_cpp.py (+3/-2)
madgraph/iolibs/export_fks.py (+15/-18)
madgraph/iolibs/export_v4.py (+219/-56)
madgraph/iolibs/file_writers.py (+52/-0)
madgraph/iolibs/files.py (+6/-2)
madgraph/iolibs/template_files/born_fks.inc (+33/-10)
madgraph/iolibs/template_files/loop/improve_ps.inc (+22/-3)
madgraph/iolibs/template_files/loop/loop_matrix_standalone.inc (+9/-0)
madgraph/iolibs/template_files/loop_optimized/check_py.f.inc (+40/-5)
madgraph/iolibs/template_files/loop_optimized/check_sa.py.inc (+2/-2)
madgraph/iolibs/template_files/loop_optimized/check_sa_all.py.inc (+139/-0)
madgraph/iolibs/template_files/loop_optimized/helas_calls_split.inc (+2/-2)
madgraph/iolibs/template_files/loop_optimized/loop_matrix_standalone.inc (+21/-2)
madgraph/iolibs/template_files/loop_optimized/mp_compute_loop_coefs.inc (+20/-4)
madgraph/iolibs/template_files/loop_optimized/mp_helas_calls_split.inc (+2/-2)
madgraph/iolibs/template_files/madevent_combine_events.f (+16/-5)
madgraph/iolibs/template_files/madevent_makefile_source (+5/-5)
madgraph/iolibs/template_files/makefile_sa_f2py (+23/-0)
madgraph/iolibs/template_files/makefile_sa_f_sp (+1/-1)
madgraph/iolibs/template_files/matrix_standalone_splitOrders_v4.inc (+5/-4)
madgraph/iolibs/template_files/matrix_standalone_v4.inc (+7/-4)
madgraph/iolibs/template_files/super_auto_dsig_group_v4.inc (+2/-0)
madgraph/loop/loop_diagram_generation.py (+9/-1)
madgraph/loop/loop_exporters.py (+144/-4)
madgraph/loop/loop_helas_objects.py (+8/-2)
madgraph/madevent/combine_runs.py (+7/-4)
madgraph/madevent/gen_crossxhtml.py (+12/-3)
madgraph/madevent/gen_ximprove.py (+61/-12)
madgraph/madevent/sum_html.py (+30/-7)
madgraph/various/banner.py (+31/-17)
madgraph/various/cluster.py (+20/-9)
madgraph/various/lhe_parser.py (+496/-99)
madgraph/various/misc.py (+37/-3)
madgraph/various/systematics.py (+149/-18)
mg5decay/decay_objects.py (+3/-0)
models/check_param_card.py (+5/-3)
models/import_ufo.py (+3/-4)
models/template_files/fortran/lha_read.f (+2/-2)
models/template_files/fortran/lha_read_mp.f (+2/-2)
models/usermod.py (+21/-0)
tests/acceptance_tests/test_cmd_reweight.py (+268/-5)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fks_loonly/%SubProcesses%P0_gg_ttx%born.f (+35/-11)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fks_loonly/%SubProcesses%P0_gg_ttx%genps.inc (+4/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fks_loonly/%SubProcesses%P0_gg_ttx%parton_lum_chooser.f (+0/-4)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fks_loonly/%SubProcesses%P0_uux_ttx%born.f (+35/-11)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fks_loonly/%SubProcesses%P0_uux_ttx%genps.inc (+4/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fks_loonly/%SubProcesses%P0_uux_ttx%parton_lum_chooser.f (+0/-4)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fks_loonly/%SubProcesses%P0_uxu_ttx%born.f (+35/-11)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fks_loonly/%SubProcesses%P0_uxu_ttx%genps.inc (+4/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fks_loonly/%SubProcesses%P0_uxu_ttx%parton_lum_chooser.f (+0/-4)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_gg_ttx%born.f (+37/-13)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_gg_ttx%parton_lum_chooser.f (+0/-4)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_uux_ttx%born.f (+37/-13)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_uux_ttx%parton_lum_chooser.f (+0/-4)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_uxu_ttx%born.f (+37/-13)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_uxu_ttx%parton_lum_chooser.f (+0/-4)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%born_matrix.f (+5/-4)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%coef_construction_1.f (+3/-3)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%f2py_wrapper.f (+37/-2)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%helas_calls_ampb_1.f (+3/-3)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%improve_ps.f (+24/-3)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%loop_CT_calls_1.f (+3/-3)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%loop_matrix.f (+25/-3)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%mp_coef_construction_1.f (+3/-3)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%mp_compute_loop_coefs.f (+23/-6)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%mp_helas_calls_ampb_1.f (+3/-3)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%born.f (+35/-11)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%genps.inc (+4/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%parton_lum_chooser.f (+0/-4)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%V0_udx_wp%born_matrix.f (+5/-4)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%V0_udx_wp%coef_construction_1.f (+3/-3)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%V0_udx_wp%f2py_wrapper.f (+37/-2)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%V0_udx_wp%helas_calls_ampb_1.f (+3/-3)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%V0_udx_wp%improve_ps.f (+24/-3)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%V0_udx_wp%loop_CT_calls_1.f (+3/-3)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%V0_udx_wp%loop_matrix.f (+25/-3)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%V0_udx_wp%mp_coef_construction_1.f (+3/-3)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%V0_udx_wp%mp_compute_loop_coefs.f (+23/-6)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%V0_udx_wp%mp_helas_calls_ampb_1.f (+3/-3)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%born.f (+35/-11)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%genps.inc (+4/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%parton_lum_chooser.f (+0/-4)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_tdecay_fksreal/%SubProcesses%P0_t_budx%born.f (+37/-13)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_tdecay_fksreal/%SubProcesses%P0_t_budx%genps.inc (+4/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_tdecay_fksreal/%SubProcesses%P0_t_budx%parton_lum_chooser.f (+0/-4)
tests/input_files/IOTestsComparison/IOExportV4IOTest/export_matrix_element_v4_madevent_group/super_auto_dsig.f (+11/-9)
tests/input_files/IOTestsComparison/IOExportV4IOTest/export_matrix_element_v4_standalone/matrix.f (+7/-4)
tests/input_files/IOTestsComparison/LoopSquaredOrder_IOTest/Loop_sqso_uux_ddx/loop_matrix_QCDQEDpert_QCDsq_eq_4.f (+25/-3)
tests/input_files/IOTestsComparison/LoopSquaredOrder_IOTest/Loop_sqso_uux_ddx/loop_matrix_QCDQEDpert_QCDsq_gt_0_QEDAmpAndQEDsq_gt_2.f (+25/-3)
tests/input_files/IOTestsComparison/LoopSquaredOrder_IOTest/Loop_sqso_uux_ddx/loop_matrix_QCDQEDpert_QCDsq_gt_4.f (+25/-3)
tests/input_files/IOTestsComparison/LoopSquaredOrder_IOTest/Loop_sqso_uux_ddx/loop_matrix_QCDQEDpert_QEDsq_le_4.f (+25/-3)
tests/input_files/IOTestsComparison/LoopSquaredOrder_IOTest/Loop_sqso_uux_ddx/loop_matrix_QCDQEDpert_WGTsq_le_10_QEDAmpAndQEDsq_gt_2.f (+25/-3)
tests/input_files/IOTestsComparison/LoopSquaredOrder_IOTest/Loop_sqso_uux_ddx/loop_matrix_QCDQEDpert_default.f (+25/-3)
tests/input_files/IOTestsComparison/LoopSquaredOrder_IOTest/Loop_sqso_uux_ddx/loop_matrix_QCDpert_default.f (+25/-3)
tests/input_files/IOTestsComparison/LoopSquaredOrder_IOTest/Loop_sqso_uux_ddx/loop_matrix_QEDpert_default.f (+25/-3)
tests/input_files/IOTestsComparison/MadLoop_output_from_the_interface/TIR_output/%ggttx_IOTest%SubProcesses%P0_gg_ttx%born_matrix.f (+5/-4)
tests/input_files/IOTestsComparison/MadLoop_output_from_the_interface/TIR_output/%ggttx_IOTest%SubProcesses%P0_gg_ttx%coef_construction_1.f (+3/-3)
tests/input_files/IOTestsComparison/MadLoop_output_from_the_interface/TIR_output/%ggttx_IOTest%SubProcesses%P0_gg_ttx%f2py_wrapper.f (+37/-2)
tests/input_files/IOTestsComparison/MadLoop_output_from_the_interface/TIR_output/%ggttx_IOTest%SubProcesses%P0_gg_ttx%helas_calls_ampb_1.f (+3/-3)
tests/input_files/IOTestsComparison/MadLoop_output_from_the_interface/TIR_output/%ggttx_IOTest%SubProcesses%P0_gg_ttx%helas_calls_uvct_1.f (+3/-3)
tests/input_files/IOTestsComparison/MadLoop_output_from_the_interface/TIR_output/%ggttx_IOTest%SubProcesses%P0_gg_ttx%improve_ps.f (+24/-3)
tests/input_files/IOTestsComparison/MadLoop_output_from_the_interface/TIR_output/%ggttx_IOTest%SubProcesses%P0_gg_ttx%loop_CT_calls_1.f (+3/-3)
tests/input_files/IOTestsComparison/MadLoop_output_from_the_interface/TIR_output/%ggttx_IOTest%SubProcesses%P0_gg_ttx%loop_matrix.f (+25/-3)
tests/input_files/IOTestsComparison/MadLoop_output_from_the_interface/TIR_output/%ggttx_IOTest%SubProcesses%P0_gg_ttx%mp_coef_construction_1.f (+3/-3)
tests/input_files/IOTestsComparison/MadLoop_output_from_the_interface/TIR_output/%ggttx_IOTest%SubProcesses%P0_gg_ttx%mp_compute_loop_coefs.f (+23/-6)
tests/input_files/IOTestsComparison/MadLoop_output_from_the_interface/TIR_output/%ggttx_IOTest%SubProcesses%P0_gg_ttx%mp_helas_calls_ampb_1.f (+3/-3)
tests/input_files/IOTestsComparison/MadLoop_output_from_the_interface/TIR_output/%ggttx_IOTest%SubProcesses%P0_gg_ttx%mp_helas_calls_uvct_1.f (+3/-3)
tests/input_files/IOTestsComparison/SquaredOrder_IOTest/sqso_uux_uuxuuxx/matrix_NoSQSO.f (+7/-4)
tests/input_files/IOTestsComparison/SquaredOrder_IOTest/sqso_uux_uuxuuxx/matrix_QCDsq_le_6.f (+5/-4)
tests/input_files/IOTestsComparison/SquaredOrder_IOTest/sqso_uux_uuxuuxx/matrix_ampOrderQED2_eq_2_WGTsq_le_14_QCDsq_gt_4.f (+5/-4)
tests/input_files/IOTestsComparison/TestCmdMatchBox/MatchBoxOutput/%TEST%SubProcesses%P1_uux_uux%coef_construction_1.f (+3/-3)
tests/input_files/IOTestsComparison/TestCmdMatchBox/MatchBoxOutput/%TEST%SubProcesses%P1_uux_uux%f2py_wrapper.f (+37/-2)
tests/input_files/IOTestsComparison/TestCmdMatchBox/MatchBoxOutput/%TEST%SubProcesses%P1_uux_uux%helas_calls_ampb_1.f (+3/-3)
tests/input_files/IOTestsComparison/TestCmdMatchBox/MatchBoxOutput/%TEST%SubProcesses%P1_uux_uux%improve_ps.f (+24/-3)
tests/input_files/IOTestsComparison/TestCmdMatchBox/MatchBoxOutput/%TEST%SubProcesses%P1_uux_uux%loop_CT_calls_1.f (+3/-3)
tests/input_files/IOTestsComparison/TestCmdMatchBox/MatchBoxOutput/%TEST%SubProcesses%P1_uux_uux%loop_matrix.f (+25/-3)
tests/input_files/IOTestsComparison/TestCmdMatchBox/MatchBoxOutput/%TEST%SubProcesses%P1_uux_uux%mp_coef_construction_1.f (+3/-3)
tests/input_files/IOTestsComparison/TestCmdMatchBox/MatchBoxOutput/%TEST%SubProcesses%P1_uux_uux%mp_compute_loop_coefs.f (+23/-6)
tests/input_files/IOTestsComparison/TestCmdMatchBox/MatchBoxOutput/%TEST%SubProcesses%P1_uux_uux%mp_helas_calls_ampb_1.f (+3/-3)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/dux_mumvmxg/born_matrix.f (+7/-4)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/dux_mumvmxg/improve_ps.f (+24/-3)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/dux_mumvmxg/loop_matrix.f (+10/-0)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/gg_wmtbx/born_matrix.f (+7/-4)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/gg_wmtbx/improve_ps.f (+24/-3)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/gg_wmtbx/loop_matrix.f (+10/-0)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/dux_mumvmxg/born_matrix.f (+7/-4)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/dux_mumvmxg/coef_construction_1.f (+3/-3)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/dux_mumvmxg/f2py_wrapper.f (+37/-2)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/dux_mumvmxg/helas_calls_ampb_1.f (+3/-3)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/dux_mumvmxg/helas_calls_uvct_1.f (+3/-3)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/dux_mumvmxg/improve_ps.f (+24/-3)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/dux_mumvmxg/loop_CT_calls_1.f (+3/-3)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/dux_mumvmxg/loop_matrix.f (+25/-3)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/dux_mumvmxg/mp_coef_construction_1.f (+3/-3)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/dux_mumvmxg/mp_compute_loop_coefs.f (+23/-6)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/dux_mumvmxg/mp_helas_calls_ampb_1.f (+3/-3)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/dux_mumvmxg/mp_helas_calls_uvct_1.f (+3/-3)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/gg_wmtbx/born_matrix.f (+7/-4)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/gg_wmtbx/coef_construction_1.f (+3/-3)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/gg_wmtbx/f2py_wrapper.f (+37/-2)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/gg_wmtbx/helas_calls_ampb_1.f (+3/-3)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/gg_wmtbx/helas_calls_uvct_1.f (+3/-3)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/gg_wmtbx/improve_ps.f (+24/-3)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/gg_wmtbx/loop_CT_calls_1.f (+3/-3)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/gg_wmtbx/loop_matrix.f (+25/-3)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/gg_wmtbx/mp_coef_construction_1.f (+3/-3)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/gg_wmtbx/mp_compute_loop_coefs.f (+23/-6)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/gg_wmtbx/mp_helas_calls_ampb_1.f (+3/-3)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/gg_wmtbx/mp_helas_calls_uvct_1.f (+3/-3)
tests/input_files/IOTestsComparison/short_ML_SMQCD_LoopInduced/gg_hh/improve_ps.f (+24/-3)
tests/input_files/IOTestsComparison/short_ML_SMQCD_LoopInduced/gg_hh/loop_matrix.f (+10/-0)
tests/input_files/IOTestsComparison/short_ML_SMQCD_default/ddx_ttx/born_matrix.f (+7/-4)
tests/input_files/IOTestsComparison/short_ML_SMQCD_default/ddx_ttx/improve_ps.f (+24/-3)
tests/input_files/IOTestsComparison/short_ML_SMQCD_default/ddx_ttx/loop_matrix.f (+10/-0)
tests/input_files/IOTestsComparison/short_ML_SMQCD_default/gg_ttx/born_matrix.f (+7/-4)
tests/input_files/IOTestsComparison/short_ML_SMQCD_default/gg_ttx/improve_ps.f (+24/-3)
tests/input_files/IOTestsComparison/short_ML_SMQCD_default/gg_ttx/loop_matrix.f (+10/-0)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/ddx_ttx/born_matrix.f (+7/-4)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/ddx_ttx/coef_construction_1.f (+3/-3)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/ddx_ttx/f2py_wrapper.f (+37/-2)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/ddx_ttx/helas_calls_ampb_1.f (+3/-3)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/ddx_ttx/helas_calls_uvct_1.f (+3/-3)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/ddx_ttx/improve_ps.f (+24/-3)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/ddx_ttx/loop_CT_calls_1.f (+3/-3)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/ddx_ttx/loop_matrix.f (+25/-3)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/ddx_ttx/mp_coef_construction_1.f (+3/-3)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/ddx_ttx/mp_compute_loop_coefs.f (+23/-6)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/ddx_ttx/mp_helas_calls_ampb_1.f (+3/-3)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/ddx_ttx/mp_helas_calls_uvct_1.f (+3/-3)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/gg_ttx/born_matrix.f (+7/-4)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/gg_ttx/coef_construction_1.f (+3/-3)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/gg_ttx/f2py_wrapper.f (+37/-2)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/gg_ttx/helas_calls_ampb_1.f (+3/-3)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/gg_ttx/helas_calls_uvct_1.f (+3/-3)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/gg_ttx/improve_ps.f (+24/-3)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/gg_ttx/loop_CT_calls_1.f (+3/-3)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/gg_ttx/loop_matrix.f (+25/-3)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/gg_ttx/mp_coef_construction_1.f (+3/-3)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/gg_ttx/mp_compute_loop_coefs.f (+23/-6)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/gg_ttx/mp_helas_calls_ampb_1.f (+3/-3)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/gg_ttx/mp_helas_calls_uvct_1.f (+3/-3)
tests/input_files/loop_smgrav/.restrict_parallel_test.dat (+59/-0)
tests/input_files/loop_smgrav/CT_couplings.py (+738/-0)
tests/input_files/loop_smgrav/CT_parameters.py (+167/-0)
tests/input_files/loop_smgrav/CT_vertices.py (+968/-0)
tests/input_files/loop_smgrav/__init__.py (+27/-0)
tests/input_files/loop_smgrav/coupling_orders.py (+16/-0)
tests/input_files/loop_smgrav/couplings.py (+449/-0)
tests/input_files/loop_smgrav/function_library.py (+64/-0)
tests/input_files/loop_smgrav/lorentz.py (+194/-0)
tests/input_files/loop_smgrav/object_library.py (+333/-0)
tests/input_files/loop_smgrav/parameters.py (+829/-0)
tests/input_files/loop_smgrav/particles.py (+357/-0)
tests/input_files/loop_smgrav/restrict_default.dat (+59/-0)
tests/input_files/loop_smgrav/restrict_parallel_test.dat (+59/-0)
tests/input_files/loop_smgrav/restrict_test.dat (+61/-0)
tests/input_files/loop_smgrav/vertices.py (+830/-0)
tests/input_files/loop_smgrav/write_param_card.py (+181/-0)
tests/parallel_tests/test_cmd_amcatnlo.py (+1/-1)
tests/time_db (+260/-257)
tests/unit_tests/interface/test_edit_card.py (+33/-2)
tests/unit_tests/iolibs/test_export_fks_EW.py (+1/-5)
vendor/DiscreteSampler/DiscreteSampler.f (+1/-1)
To merge this branch: bzr merge lp:~mg5core1/mg5amcnlo/2.5.6
Reviewer Review Type Date Requested Status
MadTeam Pending
Review via email: mp+328650@code.launchpad.net

Description of the change

Hi guys,

With Rikkert and Stefano, we agreed to release 2.5.6 this friday.
They are two branch that need to be merged before that:
1) bias_function ( which i need to finish the review --already started--)
2) reweight_mass ( Which both Valentin and Rikkert have started to review)

Two branch have actually already been approved for merging but (as far as I know where not merged already):
HwU_allocated -> Rikkert can you merge it (if you want)
mg5hpc -> That's for me.

I would like to see if it is possible to merge:
maddm_dev (would be review by Valentin)
but if that does not make it, it is not critical.

Anything else that you want to include in this version?
I would actually propose to call it 2.6.0 since this version includes a lot of new features.

Cheers,

Olivier

To post a comment you must log in.
Revision history for this message
Stefano Frixione (stefano-frixione) wrote :

Hi Olivier,

> I would actually propose to call it 2.6.0 since this version includes a
> lot of new features.
I think we have advertised a few times that 2.6.0 would contain
EW corrections, so I personally prefer 2.5.6 (not a vry strong
feeling; I'll be happy to go with the majority).

Concerning the review: after the MS bug, I've kept on testing the NLO
bias stuff with cases more involved than single V, and I didn't
find any issues.

Cheers, Stefano.

>
> Cheers,
>
> Olivier
> --
> The attached diff has been truncated due to its size.
> Your team MadTeam is requested to review the proposed merge of lp:~mg5core1/mg5amcnlo/2.5.6 into lp:mg5amcnlo.
>

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

Hi Olivier, Stefano,

I think EW should be 3.0.0.

I don't mind calling it 2.6.0, but 2.5.6 is also fine for me. No strong feelings either way.

HwU_allocated has already been merged a couple of versions ago.

I'm currently testing the reweight_mass with the complete H+2j FxFx. I've got ~500k events. It seems to be a bit faster as the old hand-written reweighting. I'll make some plots this afternoon and check with our previous results.

Cheers,
Rik

lp:~mg5core1/mg5amcnlo/2.5.6 updated
317. By Rikkert Frederix

removed the s-hat as dynamical-scale-choice option 4. This is not IR safe.

318. By Rikkert Frederix

merge with the bias_function branch

319. By Rikkert Frederix

Fixed a problem with the bias in split-event generation and the cross
section printed to the screen at the end of the run.

320. By olivier-mattelaer

merge reweight_mass

321. By olivier-mattelaer

allow syntax set nevents 100k and 1M (in general for all integer variable)

322. By marco zaro

fix in combine_root.C; variables were declared inside loops but
used also outside

323. By olivier-mattelaer

update iotest

324. By olivier-mattelaer

fix to put support for lhapdf6.2

325. By olivier-mattelaer

merge maddm_dev (v.298)

326. By olivier-mattelaer

merge 2.5.6_cflow_fix

327. By olivier-mattelaer

update Update note and documentation

328. By olivier-mattelaer

fixing tests

329. By olivier-mattelaer

do the reweigthing always in the center of mass frame to avoid loop stability issue

330. By olivier-mattelaer

fixing test issue + one bug in the re-weighting in output mode 2.0

331. By Valentin Hirschi

1. Fixed issue in the PY8 histogramming related to
         https://bugs.launchpad.net/mg5amcnlo/+bug/1706139
2. Updated ninja tarball.

332. By olivier-mattelaer

fixing one parralel test

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 2017-05-22 08:05:00 +0000
3+++ MadSpin/decay.py 2017-08-16 21:26:30 +0000
4@@ -207,6 +207,7 @@
5 line+="\n"
6 return line
7
8+
9 def reshuffle_resonances(self,mother):
10 """ reset the momentum of each resonance in the production event
11 to the sum of momenta of the daughters
12@@ -222,9 +223,9 @@
13 if self.resonance[index]["mothup1"]==mother:
14 daughters.append(index)
15
16- if len(daughters)!=2:
17- logger.info("Got more than 2 (%s) daughters for one particles" % len(daughters))
18- logger.info("in one production event (before decay)")
19+# if len(daughters)!=2:
20+# logger.info("Got more than 2 (%s) daughters for one particles" % len(daughters))
21+# logger.info("in one production event (before decay)")
22
23
24 if daughters[0]>0:
25@@ -1633,11 +1634,15 @@
26 self.ask_edit_cards(['param_card'],[], plot=False)
27
28
29+ commandline = 'import model %s' % model.get('modelpath+restriction')
30+ if not model.mg5_name:
31+ commandline += ' --modelname'
32+ cmd.exec_cmd(commandline)
33+
34 line = 'compute_widths %s %s' % \
35 (' '.join([str(i) for i in opts['particles']]),
36 ' '.join('--%s=%s' % (key,value) for (key,value) in opts.items()
37 if key not in ['model', 'force', 'particles'] and value))
38- cmd.exec_cmd('import model %s' % model.get('modelpath+restriction'))
39
40 #pattern for checking complex mass scheme.
41 has_cms = re.compile(r'''set\s+complex_mass_scheme\s*(True|T|1|true|$|;)''', re.M)
42
43=== modified file 'MadSpin/src/driver.f'
44--- MadSpin/src/driver.f 2017-03-13 14:10:42 +0000
45+++ MadSpin/src/driver.f 2017-08-16 21:26:30 +0000
46@@ -384,6 +384,7 @@
47 do k=1,nb_mc_masses
48 m(indices_mc_masses(k))=values_mc_masses(k)
49 enddo
50+ ivar=0
51 call generate_momenta_conf(jac,x,itree,qmass,qwidth,ptrial,pprod,map_external2res)
52
53 if (jac.lt.0d0) then
54
55=== modified file 'Template/LO/Cards/run_card.dat'
56--- Template/LO/Cards/run_card.dat 2016-11-21 14:12:27 +0000
57+++ Template/LO/Cards/run_card.dat 2017-08-16 21:26:30 +0000
58@@ -114,7 +114,6 @@
59 %(pta)s = pta ! minimum pt for the photons
60 %(ptl)s = ptl ! minimum pt for the charged leptons
61 %(misset)s = misset ! minimum missing Et (sum of neutrino's momenta)
62- %(ptheavy)s = ptheavy ! minimum pt for one heavy final state
63 %(ptjmax)s = ptjmax ! maximum pt for the jets
64 %(ptbmax)s = ptbmax ! maximum pt for the b
65 %(ptamax)s = ptamax ! maximum pt for the photons
66@@ -191,6 +190,7 @@
67 #*********************************************************************
68 # Inclusive cuts *
69 #*********************************************************************
70+ %(ptheavy)s = ptheavy ! minimum pt for at least one heavy final state
71 %(xptj)s = xptj ! minimum pt for at least one jet
72 %(xptb)s = xptb ! minimum pt for at least one b
73 %(xpta)s = xpta ! minimum pt for at least one photon
74
75=== modified file 'Template/LO/Source/.make_opts'
76--- Template/LO/Source/.make_opts 2016-12-02 21:56:34 +0000
77+++ Template/LO/Source/.make_opts 2017-08-16 21:26:30 +0000
78@@ -37,9 +37,6 @@
79 CFLAGS= -O $(STDLIB_FLAG) $(MACFLAG)
80 endif
81
82-# Increase the number of allowed charcters in a Fortran line
83-FFLAGS+= -ffixed-line-length-132
84-
85 # Set FC unless it's defined by an environment variable
86 ifeq ($(origin FC),default)
87 FC=$(DEFAULT_F_COMPILER)
88@@ -48,6 +45,15 @@
89 F2PY=$(DEFAULT_F2PY_COMPILER)
90 endif
91
92+# Increase the number of allowed charcters in a Fortran line
93+ifeq ($(FC), ftn)
94+FFLAGS+= -extend-source # for ifort type of compiler
95+else
96+FFLAGS+= -ffixed-line-length-132
97+endif
98+
99+
100+
101 UNAME := $(shell uname -s)
102 ifeq ($(origin LDFLAGS), undefined)
103 LDFLAGS=$(STDLIB) $(MACFLAG)
104@@ -89,12 +95,20 @@
105 # Option lhapdf
106
107 ifneq ($(lhapdf),)
108-CXXFLAGS += $(shell $(lhapdf) --cppflags)
109-alfas_functions=alfas_functions_lhapdf
110-llhapdf+= -lLHAPDF
111+ CXXFLAGS += $(shell $(lhapdf) --cppflags)
112+ alfas_functions=alfas_functions_lhapdf
113+ llhapdf+= $(shell $(lhapdf) --cflags --libs) -lLHAPDF
114+# check if we need to activate c++11 (for lhapdf6.2)
115+ ifeq ($(origin CXX),default)
116+ ifeq ($lhapdfversion$lhapdfsubversion,62)
117+ CXX=$(DEFAULT_CPP_COMPILER) -std=c++11
118+ else
119+ CXX=$(DEFAULT_CPP_COMPILER)
120+ endif
121+ endif
122 else
123-alfas_functions=alfas_functions
124-llhapdf=
125+ alfas_functions=alfas_functions
126+ llhapdf=
127 endif
128
129 # Helper function to check MG5 version
130
131=== modified file 'Template/LO/Source/PDF/pdf.f'
132--- Template/LO/Source/PDF/pdf.f 2014-10-20 07:53:19 +0000
133+++ Template/LO/Source/PDF/pdf.f 2017-08-16 21:26:30 +0000
134@@ -14,7 +14,7 @@
135 include 'pdf.inc'
136 C
137 call fdist(ih,x, q, pdf)
138-
139+
140 return
141 end
142
143
144=== modified file 'Template/LO/Source/PDF/pdg2pdf.f'
145--- Template/LO/Source/PDF/pdg2pdf.f 2014-01-07 10:50:42 +0000
146+++ Template/LO/Source/PDF/pdg2pdf.f 2017-08-16 21:26:30 +0000
147@@ -26,6 +26,11 @@
148 data pdlabellast/2*'abcdefg'/
149 data ihlast/2*-99/
150
151+ if (ih.eq.9) then
152+ pdg2pdf = 1d0
153+ return
154+ endif
155+
156 c Make sure we have a reasonable Bjorken x. Note that even though
157 c x=0 is not reasonable, we prefer to simply return pdg2pdf=0
158 c instead of stopping the code, as this might accidentally happen.
159
160=== modified file 'Template/LO/Source/PDF/pdg2pdf_lhapdf.f'
161--- Template/LO/Source/PDF/pdg2pdf_lhapdf.f 2013-12-09 11:12:33 +0000
162+++ Template/LO/Source/PDF/pdg2pdf_lhapdf.f 2017-08-16 21:26:30 +0000
163@@ -22,6 +22,11 @@
164 data pdflast/30*-99d9/
165 data imemlast/2*-99/
166
167+ if (ih.eq.9) then
168+ pdg2pdf =1d0
169+ return
170+ endif
171+
172 c Make sure we have a reasonable Bjorken x. Note that even though
173 c x=0 is not reasonable, we prefer to simply return pdg2pdf=0
174 c instead of stopping the code, as this might accidentally happen.
175
176=== modified file 'Template/LO/Source/dsample.f'
177--- Template/LO/Source/dsample.f 2015-10-01 10:08:45 +0000
178+++ Template/LO/Source/dsample.f 2017-08-16 21:26:30 +0000
179@@ -997,6 +997,43 @@
180
181 end subroutine write_discrete_grids
182
183+ subroutine write_grid(name)
184+c************************************************************************
185+c Write out the grid
186+c************************************************************************
187+ implicit none
188+
189+ character*(*) name
190+
191+ include 'genps.inc'
192+
193+ double precision tmean, trmean, tsigma
194+ integer dim, events, itm, kn, cur_it, invar, configs
195+ common /sample_common/
196+ . tmean, trmean, tsigma, dim, events, itm, kn, cur_it, invar, configs
197+
198+ double precision twgt, maxwgt,swgt(maxevents)
199+ integer lun, nw, itmin
200+ common/to_unwgt/twgt, maxwgt, swgt, lun, nw, itmin
201+
202+ double precision grid(2, ng, 0:maxinvar)
203+ common /data_grid/ grid
204+
205+ double precision force_max_wgt
206+ common/unwgt_secondary_max/force_max_wgt
207+
208+ integer i,j
209+
210+ open(26, file='ftn26',status='unknown')
211+ write(26,fmt='(4f21.17)') ((grid(2,i,j),i=1,ng),j=1,invar)
212+ write(26,*) twgt, force_max_wgt
213+c write(26,fmt='(4f21.16)') (alpha(i),i=1,maxconfigs)
214+ call write_discrete_grids(26,'ref')
215+ close(26)
216+ return
217+ end
218+
219+
220 subroutine read_discrete_grids(stream_id)
221 c************************************************************************
222 c Write out the grid using the DiscreteSampler module
223@@ -1714,7 +1751,7 @@
224 if (kn .ge. max_events .and. non_zero .le. 5) then
225 call none_pass(max_events)
226 endif
227- if (non_zero .eq. events .or. (kn .gt. 200*events .and.
228+ if (non_zero .ge. events .or. (kn .gt. 200*events .and.
229 $ non_zero .gt. 5)) then
230
231 c # special mode where we store information to combine them
232@@ -2179,13 +2216,7 @@
233 . /23X,11HCross sec =,e12.4/
234 . 13X,21HChi**2 per DoF. =,f12.4/1X,79(1H-))
235 if (use_cut .ne. 0) then
236- open(26, file='ftn26',status='unknown')
237- write(26,fmt='(4f21.17)')
238- $ ((grid(2,i,j),i=1,ng),j=1,invar)
239- write(26,*) twgt, force_max_wgt
240- call write_discrete_grids(26,'ref')
241-c write(26,fmt='(4f21.17)') (alpha(i),i=1,maxconfigs)
242- close(26)
243+ call write_grid('ftn26')
244 endif
245 call sample_writehtm()
246 c open(unit=22,file=result_file,status='old',
247
248=== added file 'Template/LO/SubProcesses/dummy_fct.f'
249--- Template/LO/SubProcesses/dummy_fct.f 1970-01-01 00:00:00 +0000
250+++ Template/LO/SubProcesses/dummy_fct.f 2017-08-16 21:26:30 +0000
251@@ -0,0 +1,47 @@
252+ subroutine get_dummy_x1(sjac, X1, R, pbeam1, pbeam2, stot, shat)
253+ implicit none
254+ include 'maxparticles.inc'
255+ include 'run.inc'
256+c include 'genps.inc'
257+ double precision sjac ! jacobian. should be updated not reinit
258+ double precision X1 ! bjorken X. output
259+ double precision R ! random value after grid transfrormation. between 0 and 1
260+ double precision pbeam1(0:3) ! momentum of the first beam (input and/or output)
261+ double precision pbeam2(0:3) ! momentum of the second beam (input and/or output)
262+ double precision stot ! total energy (input and /or output)
263+ double precision shat ! output
264+
265+c global variable to set (or not)
266+ double precision cm_rap
267+ logical set_cm_rap
268+ common/to_cm_rap/set_cm_rap,cm_rap
269+
270+ set_cm_rap=.false. ! then cm_rap will be set as .5d0*dlog(xbk(1)*ebeam(1)/(xbk(2)*ebeam(2)))
271+ ! ebeam(1) and ebeam(2) are defined here thanks to 'run.inc'
272+ shat = x1*ebeam(1)*ebeam(2)
273+ return
274+ end
275+
276+ subroutine get_dummy_x1_x2(sjac, X, R, pbeam1, pbeam2, stot,shat)
277+ implicit none
278+ include 'maxparticles.inc'
279+ include 'run.inc'
280+c include 'genps.inc'
281+ double precision sjac ! jacobian. should be updated not reinit
282+ double precision X(2) ! bjorken X. output
283+ double precision R(2) ! random value after grid transfrormation. between 0 and 1
284+ double precision pbeam1(0:3) ! momentum of the first beam
285+ double precision pbeam2(0:3) ! momentum of the second beam
286+ double precision stot ! total energy
287+ double precision shat ! output
288+
289+c global variable to set (or not)
290+ double precision cm_rap
291+ logical set_cm_rap
292+ common/to_cm_rap/set_cm_rap,cm_rap
293+
294+ set_cm_rap=.false. ! then cm_rap will be set as .5d0*dlog(xbk(1)*ebeam(1)/(xbk(2)*ebeam(2)))
295+ ! ebeam(1) and ebeam(2) are defined here thanks to 'run.inc'
296+ shat = x(1)*x(2)*ebeam(1)*ebeam(2)
297+ return
298+ end
299
300=== modified file 'Template/LO/SubProcesses/genps.f'
301--- Template/LO/SubProcesses/genps.f 2016-09-06 15:01:18 +0000
302+++ Template/LO/SubProcesses/genps.f 2017-08-16 21:26:30 +0000
303@@ -124,7 +124,6 @@
304 integer sprop(maxsproc,-max_branch:-1,lmaxconfigs)
305 integer tprid(-max_branch:-1,lmaxconfigs)
306 common/to_sprop/sprop,tprid
307- integer lwgt(0:maxconfigs,maxinvar)
308 logical firsttime
309
310 double precision xprop(3,nexternal),tprop(3,nexternal)
311@@ -132,7 +131,7 @@
312 integer imatch
313 save maxwgt
314
315- integer ninvar, nconfigs
316+ integer ninvar
317
318 c
319 c External
320@@ -142,6 +141,9 @@
321 c
322 c Global
323 c
324+ integer lwgt(0:maxconfigs,maxinvar)
325+ common/to_lwgt/lwgt
326+
327 double precision pmass(nexternal)
328 common/to_mass/ pmass
329
330@@ -172,7 +174,6 @@
331 double precision stot,m1,m2
332 common/to_stot/stot,m1,m2
333
334- save lwgt
335 save ndim,nfinal,nbranch,nparticles
336
337 integer jfig,k
338@@ -200,40 +201,7 @@
339 c write(*,*) 'using iconfig',iconfig
340 if (firsttime) then
341 firsttime=.false.
342- do i=1,nexternal
343- m(i)=pmass(i)
344- enddo
345-c Set stot
346- if (nincoming.eq.1) then
347- stot=m(1)**2
348- else
349- m1=m(1)
350- m2=m(2)
351- if (abs(lpp(1)) .eq. 1 .or. abs(lpp(1)) .eq. 2) m1 = 0.938d0
352- if (abs(lpp(2)) .eq. 1 .or. abs(lpp(2)) .eq. 2) m2 = 0.938d0
353- if (abs(lpp(1)) .eq. 3) m1 = 0.000511d0
354- if (abs(lpp(2)) .eq. 3) m2 = 0.000511d0
355- if(ebeam(1).lt.m1) ebeam(1)=m1
356- if(ebeam(2).lt.m2) ebeam(2)=m2
357- pi1(0)=ebeam(1)
358- pi1(3)=sqrt(max(ebeam(1)**2-m1**2, 0d0))
359- pi2(0)=ebeam(2)
360- pi2(3)=-sqrt(max(ebeam(2)**2-m2**2, 0d0))
361- stot=m1**2+m2**2+2*(pi1(0)*pi2(0)-pi1(3)*pi2(3))
362- endif
363- write(*,'(x,a,f13.2)') 'Set CM energy to ',sqrt(stot)
364-c Start graph mapping
365- do i=1,mapconfig(0)
366- if (mapconfig(i) .eq. iconfig) this_config=i
367- enddo
368- write(*,*) 'Mapping Graph',iconfig,' to config',this_config
369- iconfig = this_config
370- nconfigs = 1
371- mincfig=iconfig
372- maxcfig=iconfig
373- call map_invarients(minvar,nconfigs,ninvar,mincfig,maxcfig,nexternal,nincoming)
374- maxwgt=0d0
375-c write(*,'(a,12i4)') 'Summing configs',(isym(i),i=1,isym(0))
376+ call configure_integral(this_config,mincfig, maxcfig, invar,maxwgt)
377 nparticles = nexternal
378 nfinal = nparticles-nincoming
379 nbranch = nparticles-2
380@@ -241,51 +209,10 @@
381 if (ndim .lt. 0) ndim = 0 !For 2->1 processes tjs 5/24/2010
382 if (abs(lpp(1)) .ge. 1) ndim=ndim+1
383 if (abs(lpp(2)) .ge. 1) ndim=ndim+1
384- call set_peaks
385- if (.false. ) then
386- call find_matches(iconfig,isym(0))
387- write(*,'(a,12i4)') 'Summing configs',(isym(i),i=1,isym(0))
388- endif
389- if (.false.) then
390- i=1
391- do while (mapconfig(i) .ne. iconfig
392- $ .and. i .lt. mapconfig(0))
393- i=i+1
394- enddo
395- endif
396-
397+ do i=1,nexternal
398+ m(i)=pmass(i)
399+ enddo
400 write(*,'(a,12e10.3)') ' Masses:',(m(i),i=1,nparticles)
401- do j=1,invar
402- lwgt(0,j)=0
403- enddo
404-c
405-c Here we set up which diagrams contribute to each variable
406-c in principle more than 1 diagram can contribute to a variable
407-c if we believe they will have identical structure.
408-c
409-c do i=1,mapconfig(0)
410- do i=mincfig,maxcfig
411-c do k=1,isym(0)
412-c i = isym(k)
413- write(*,'(15i4)') i,(minvar(j,i),j=1,ndim)
414- do j=1,ndim
415- ipole = minvar(j,i)
416- if (ipole .ne. 0) then
417- n = lwgt(0,ipole)+1
418- lwgt(n,ipole)=mapconfig(i)
419- lwgt(0,ipole)=n
420- endif
421- enddo
422- enddo
423-
424-c Initialize dsig (needed for subprocess group running mode)
425- dum=dsig(0,0,1)
426-
427- else
428- do i=1,11
429-c swidth(i)=-5d0 !tells us to use the same point over again
430- enddo
431-c swidth(10)=0d0
432 endif !First_time
433
434 if (.false.) then
435@@ -301,24 +228,48 @@
436 xbk(2) = 1d0
437 sjac = 1d0
438 if (abs(lpp(1)) .ge. 1 .and. abs(lpp(2)) .ge. 1) then
439- call sample_get_x(sjac,x(ndim-1),ndim-1,mincfig,0d0,1d0)
440+ if (abs(lpp(1)).eq.9.or.abs(lpp(2)).eq.9)then
441+ call sample_get_x(sjac,x(ndim),ndim,mincfig,0d0,1d0)
442+ call sample_get_x(sjac,x(ndim-1),ndim-1,mincfig,0d0,1d0)
443+ call get_dummy_x1_x2(sjac, Xbk(1), x(ndim-1),pi1, pi2, stot, s(-nbranch))
444+ if (.not.set_cm_rap)then
445+ cm_rap=.5d0*dlog(xbk(1)*ebeam(1)/(xbk(2)*ebeam(2)))
446+ set_cm_rap=.true.
447+ endif
448+ else
449+ call sample_get_x(sjac,x(ndim-1),ndim-1,mincfig,0d0,1d0)
450 c-----
451 c tjs 5/24/2010 for 2->1 process
452 c-------
453- xtau = x(ndim-1)
454- if(nexternal .eq. 3) then
455- x(ndim-1) = pmass(3)*pmass(3)/stot
456- sjac=1 / stot !for delta function in d_tau
457+ xtau = x(ndim-1)
458+ if(nexternal .eq. 3) then
459+ x(ndim-1) = pmass(3)*pmass(3)/stot
460+ sjac=1 / stot !for delta function in d_tau
461+ endif
462+
463+ call sample_get_x(sjac,x(ndim),ndim,mincfig,0d0,1d0)
464+ CALL GENCMS(STOT,Xbk(1),Xbk(2),X(ndim-1), SMIN,SJAC)
465+ x(ndim-1) = xtau !Fix for 2->1 process
466+c Set CM rapidity for use in the rap() function
467+ cm_rap=.5d0*dlog(xbk(1)*ebeam(1)/(xbk(2)*ebeam(2)))
468+ set_cm_rap=.true.
469+c Set shat
470+ s(-nbranch) = xbk(1)*xbk(2)*stot
471 endif
472
473+ elseif (lpp(1).eq.9.or.lpp(2).eq.9) then
474 call sample_get_x(sjac,x(ndim),ndim,mincfig,0d0,1d0)
475- CALL GENCMS(STOT,Xbk(1),Xbk(2),X(ndim-1), SMIN,SJAC)
476- x(ndim-1) = xtau !Fix for 2->1 process
477-c Set CM rapidity for use in the rap() function
478- cm_rap=.5d0*dlog(xbk(1)*ebeam(1)/(xbk(2)*ebeam(2)))
479- set_cm_rap=.true.
480-c Set shat
481- s(-nbranch) = xbk(1)*xbk(2)*stot
482+ if (lpp(1).eq.9)then
483+ call get_dummy_x1(sjac, xbk(1), x(ndim), pi1, pi2, stot, s(-nbranch))
484+ xbk(2) = 1d0
485+ else
486+ call get_dummy_x1(sjac, xbk(2), x(ndim), pi1, pi2, stot, s(-nbranch))
487+ xbk(1) = 1d0
488+ endif
489+ if (.not.set_cm_rap)then
490+ cm_rap=.5d0*dlog(xbk(1)*ebeam(1)/(xbk(2)*ebeam(2)))
491+ set_cm_rap=.true.
492+ endif
493 elseif (abs(lpp(1)) .ge. 1) then
494 call sample_get_x(sjac,x(ndim),ndim,mincfig,0d0,1d0)
495 xbk(1) = x(ndim)
496@@ -360,7 +311,10 @@
497 c
498 c First Generate Momentum for initial state particles
499 c
500- if(nincoming.eq.2) then
501+ if (lpp(1).eq.9.or.lpp(2).eq.9)then
502+ p(:,1) = pi1(:)
503+ p(:,2) = pi2(:)
504+ else if(nincoming.eq.2) then
505 call mom2cx(m(-nbranch),m(1),m(2),1d0,0d0,p(0,1),p(0,2))
506 else
507 do i=0,3
508@@ -548,6 +502,138 @@
509 end
510
511
512+ subroutine configure_integral(iconfig,mincfig,maxcfig,invar,maxwgt)
513+c**************************************************************************
514+c inputs iconfig == Current configuration working on
515+c output m
516+c**************************************************************************
517+
518+ implicit none
519+
520+ include 'genps.inc'
521+ include 'maxconfigs.inc'
522+ include 'nexternal.inc'
523+ include 'maxamps.inc'
524+ include 'run.inc'
525+
526+c local
527+ double precision pi1(0:3),pi2(0:3),p0,p3
528+ double precision dum
529+ integer i,j,ipole,n
530+ integer nbranch,ndim,nconfigs
531+ integer ninvar
532+ integer nparticles,nfinal
533+
534+
535+c
536+c Arguments
537+c
538+ integer iconfig,mincfig,maxcfig,invar
539+ double precision maxwgt
540+c
541+c External
542+c
543+ double precision lambda,dot,dsig
544+ logical passcuts
545+
546+
547+ logical firsttime
548+ data firsttime/.true./
549+ save firsttime
550+c
551+c global
552+c
553+ double precision M(-max_branch:max_particles)
554+
555+ double precision pmass(nexternal)
556+ common/to_mass/ pmass
557+
558+ double precision stot,m1,m2
559+ common/to_stot/stot,m1,m2
560+
561+ integer mapconfig(0:lmaxconfigs), this_config
562+ common/to_mconfigs/mapconfig, this_config
563+
564+ integer Minvar(maxdim,lmaxconfigs)
565+ common /to_invar/ Minvar
566+
567+ integer lwgt(0:maxconfigs,maxinvar)
568+ common/to_lwgt/lwgt
569+
570+ if (firsttime)then
571+ firsttime=.false.
572+ do i=1,nexternal
573+ m(i)=pmass(i)
574+ enddo
575+c Set stot
576+ if (nincoming.eq.1) then
577+ stot=m(1)**2
578+ else
579+ m1=m(1)
580+ m2=m(2)
581+ if (abs(lpp(1)) .eq. 1 .or. abs(lpp(1)) .eq. 2) m1 = 0.938d0
582+ if (abs(lpp(2)) .eq. 1 .or. abs(lpp(2)) .eq. 2) m2 = 0.938d0
583+ if (abs(lpp(1)) .eq. 3) m1 = 0.000511d0
584+ if (abs(lpp(2)) .eq. 3) m2 = 0.000511d0
585+ if(ebeam(1).lt.m1.and.lpp(1).ne.9) ebeam(1)=m1
586+ if(ebeam(2).lt.m2.and.lpp(2).ne.9) ebeam(2)=m2
587+ pi1(0)=ebeam(1)
588+ pi1(3)=sqrt(max(ebeam(1)**2-m1**2, 0d0))
589+ pi2(0)=ebeam(2)
590+ pi2(3)=-sqrt(max(ebeam(2)**2-m2**2, 0d0))
591+ stot=m1**2+m2**2+2*(pi1(0)*pi2(0)-pi1(3)*pi2(3))
592+ endif
593+ write(*,'(x,a,f13.2)') 'Set CM energy to ',sqrt(stot)
594+ endif
595+c Start graph mapping
596+ do i=1,mapconfig(0)
597+ if (mapconfig(i) .eq. iconfig) this_config=i
598+ enddo
599+ write(*,*) 'Mapping Graph',iconfig,' to config',this_config
600+ iconfig = this_config
601+ nconfigs = 1
602+ mincfig=iconfig
603+ maxcfig=iconfig
604+ call map_invarients(minvar,nconfigs,ninvar,mincfig,maxcfig,nexternal,nincoming)
605+ maxwgt=0d0
606+c write(*,'(a,12i4)') 'Summing configs',(isym(i),i=1,isym(0))
607+ nparticles = nexternal
608+ nfinal = nparticles-nincoming
609+ nbranch = nparticles-2
610+ ndim = 3*nfinal-4
611+ if (ndim .lt. 0) ndim = 0 !For 2->1 processes tjs 5/24/2010
612+ if (abs(lpp(1)) .ge. 1) ndim=ndim+1
613+ if (abs(lpp(2)) .ge. 1) ndim=ndim+1
614+ call set_peaks
615+ do j=1,invar
616+ lwgt(0,j)=0
617+ enddo
618+c
619+c Here we set up which diagrams contribute to each variable
620+c in principle more than 1 diagram can contribute to a variable
621+c if we believe they will have identical structure.
622+c
623+c do i=1,mapconfig(0)
624+ do i=mincfig,maxcfig
625+c do k=1,isym(0)
626+c i = isym(k)
627+ write(*,'(15i4)') i,(minvar(j,i),j=1,ndim)
628+ do j=1,ndim
629+ ipole = minvar(j,i)
630+ if (ipole .ne. 0) then
631+ n = lwgt(0,ipole)+1
632+ lwgt(n,ipole)=mapconfig(i)
633+ lwgt(0,ipole)=n
634+ endif
635+ enddo
636+ enddo
637+
638+c Initialize dsig (needed for subprocess group running mode)
639+ dum=dsig(0,0,1)
640+
641+ return
642+ end
643+
644 subroutine one_tree(itree,iconfig,nbranch,P,M,S,X,jac,pswgt)
645 c************************************************************************
646 c Calculates the momentum for everything below in the tree until
647@@ -1180,3 +1266,7 @@
648 X2 = SQRT(TAU)*EXP(-ETA)
649
650 END
651+
652+
653+
654+
655
656=== modified file 'Template/LO/SubProcesses/makefile'
657--- Template/LO/SubProcesses/makefile 2017-03-13 20:27:08 +0000
658+++ Template/LO/SubProcesses/makefile 2017-08-16 21:26:30 +0000
659@@ -32,7 +32,7 @@
660
661 PROCESS= driver.o myamp.o genps.o unwgt.o setcuts.o get_color.o \
662 cuts.o cluster.o reweight.o initcluster.o addmothers.o setscales.o \
663- idenparts.o \
664+ idenparts.o dummy_fct.o \
665 $(patsubst %.f,%.o,$(wildcard auto_dsig*.f)) \
666 $(patsubst %.f,%.o,$(wildcard matrix*.f))
667
668@@ -64,6 +64,7 @@
669 driver.f: genps.inc
670 symmetry.o: genps.inc nexternal.inc configs.inc run_config.inc
671 genps.o: genps.inc nexternal.inc configs.inc
672+dummy_fct.0: run.inc genps.inc
673 cuts.o: genps.inc nexternal.inc pmass.inc
674 setcuts.o: genps.inc run_config.inc
675 invarients.o: genps.inc nexternal.inc
676
677=== modified file 'Template/LO/SubProcesses/refine.sh'
678--- Template/LO/SubProcesses/refine.sh 2016-06-12 00:01:23 +0000
679+++ Template/LO/SubProcesses/refine.sh 2017-08-16 21:26:30 +0000
680@@ -89,7 +89,7 @@
681 if [ "$keeplog" = true ] ; then
682 echo "" >> $k; echo "ls status:" >> $k; ls >> $k
683 else
684- rm ftn26 > /dev/null
685+ rm ftn26 &> /dev/null
686 fi
687
688
689
690=== modified file 'Template/LO/SubProcesses/unwgt.f'
691--- Template/LO/SubProcesses/unwgt.f 2016-09-03 13:26:00 +0000
692+++ Template/LO/SubProcesses/unwgt.f 2017-08-16 21:26:30 +0000
693@@ -603,7 +603,7 @@
694 if (nincoming.eq.2) then
695 if (xbk(1) .gt. 0d0 .and. xbk(1) .le. 1d0 .and.
696 $ xbk(2) .gt. 0d0 .and. xbk(2) .le. 1d0) then
697- if(xbk(1).eq.1d0.or.pmass(1).eq.0d0) then
698+ if(lpp(2).ne.0.and.(xbk(1).eq.1d0.or.pmass(1).eq.0d0)) then
699 ! construct the beam momenta in each frame and compute the related (z)boost
700 ebi(0) = p(0,1)/xbk(1) ! this assumes that particle 1 is massless or mass equal to beam
701 ebi(1) = 0
702
703=== modified file 'Template/NLO/Cards/run_card.dat'
704--- Template/NLO/Cards/run_card.dat 2016-09-08 23:15:34 +0000
705+++ Template/NLO/Cards/run_card.dat 2017-08-16 21:26:30 +0000
706@@ -36,7 +36,7 @@
707 # Normalize the weights of LHE events such that they sum or average to *
708 # the total cross section *
709 #***********************************************************************
710- %(event_norm)s = event_norm ! average or sum
711+ %(event_norm)s = event_norm ! valid settings: average, sum, bias
712 #***********************************************************************
713 # Number of points per itegration channel (ignored for aMC@NLO runs) *
714 #***********************************************************************
715
716=== modified file 'Template/NLO/Cards/shower_card.dat'
717--- Template/NLO/Cards/shower_card.dat 2016-02-19 13:21:36 +0000
718+++ Template/NLO/Cards/shower_card.dat 2017-08-16 21:26:30 +0000
719@@ -27,7 +27,7 @@
720 #***********************************************************************
721 # PDFs and non-perturbative modelling *
722 #***********************************************************************
723-pdfcode = 0 # 0 = internal, 1 = same as NLO, other = lhaglue
724+pdfcode = 1 # 0 = internal, 1 = same as NLO, other = lhaglue
725 ue_enabled = F # underlying event
726 hadronize = T # hadronisation on/off !IGNORED BY HERWIG6!
727 lambda_5 = -1 # Lambda_5 (< 0 = default) !IGNORED BY PYTHIA8!
728
729=== modified file 'Template/NLO/FixedOrderAnalysis/HwU.f'
730--- Template/NLO/FixedOrderAnalysis/HwU.f 2017-02-03 13:37:36 +0000
731+++ Template/NLO/FixedOrderAnalysis/HwU.f 2017-08-16 21:26:30 +0000
732@@ -1,7 +1,7 @@
733 CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
734 C C
735 C HwU: Histograms with Uncertainties C
736-C By Rikkert Frederix, Dec. 2014 C
737+C By Rikkert Frederix, 12-2014--05-2017 C
738 C C
739 C Book, fill and write out histograms. Particularly suited for NLO C
740 C computations with correlations between points (ie. event and C
741@@ -9,26 +9,41 @@
742 C and PDF uncertainties through reweighting). C
743 C C
744 CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
745+
746+c The module contains effectively the common block with allocatable
747+c variables (something not possible in old fortran version)
748+ module HwU_variables
749+ implicit none
750+ integer :: max_plots,max_points,max_bins,nwgts,np
751+ integer :: error_estimation=3
752+ logical, allocatable :: booked(:)
753+ integer, allocatable :: nbin(:),histi(:,:),p_bin(:),p_label(:)
754+ character(len=50), allocatable :: title(:)
755+ character(len=50), allocatable :: wgts_info(:)
756+ double precision, allocatable :: histy(:,:,:),histy_acc(:,:,:)
757+ $ ,histy2(:,:),histy_err(:,:),histxl(:,:),histxm(:,:)
758+ $ ,step(:),p_wgts(:,:)
759+ save
760+ end module HwU_variables
761+
762
763 c To be called once at the start of each run. Initialises the packages
764 c and sets the number of weights that need to be included for each point.
765 subroutine HwU_inithist(nweights,wgt_info)
766+ use HwU_variables
767 implicit none
768- include "HwU.inc"
769 integer i,nweights
770 character*(*) wgt_info(*)
771- do i=1,max_plots
772- booked(i)=.false.
773- enddo
774+ call HwU_deallocate_all
775+ max_plots=0
776+ max_points=0
777+ max_bins=0
778+ np=0
779 c Number of weights associated to each point. Note that the first
780 c weight should always be the 'central value' and it should not be
781 c zero if any of the other weights are non-zero.
782 nwgts=nweights
783- if (nwgts.gt.max_wgts) then
784- write (*,*) 'ERROR: increase max_wgts in HwU histogramming'
785- $ ,max_wgts,nwgts
786- stop 1
787- endif
788+ allocate(wgts_info(nwgts))
789 do i=1,nwgts
790 wgts_info(i)=wgt_info(i)
791 enddo
792@@ -48,10 +63,9 @@
793 c square root of the sum of the squares. Perform a weighted average
794 c iteration-by-iteration
795 c input 3: Same as input 2, but weighted average is same as from MINT
796+ use HwU_variables
797 implicit none
798 integer input
799- integer error_estimation
800- common /HwU_common2/ error_estimation
801 if (input.ge.0 .and. input.le.3) then
802 error_estimation=input
803 else
804@@ -60,39 +74,20 @@
805 endif
806 return
807 end
808-
809- block data HwU
810-c set the default for the error estimation method. To reduce the size of
811-c the executable, put the error_estimation variable in a separate common
812-c block. If we would have included the 'HwU.inc' file here, that
813-c complete common block seems to be included in the size executable
814-c (approx. 110 MB).
815- integer error_estimation
816- common /HwU_common2/ error_estimation
817- data error_estimation /3/
818- end
819-
820+
821 c Book the histograms at the start of the run. Give a 'label' (an
822 c integer) that identifies the plot when filling it and a title
823 c ('title_l') for each plot. Also the number of bins ('nbin_l') and the
824 c plot range (from 'xmin' to 'xmax') should be given.
825 subroutine HwU_book(label,title_l,nbin_l,xmin,xmax)
826+ use HwU_variables
827 implicit none
828- include "HwU.inc"
829 integer label,nbin_l,i,j
830 character*(*) title_l
831 double precision xmin,xmax
832-c Check that label and number of bins are reasonable
833- if (label.gt.max_plots) then
834- write (*,*) 'ERROR: increase max_plots in HwU histogramming'
835- $ ,max_plots, label
836- stop 1
837- endif
838- if (nbin_l.gt.max_bins) then
839- write (*,*) 'ERROR: increase max_bins in HwU histogramming'
840- $ ,max_bins,nbin_l
841- stop 1
842- endif
843+c Allocate space for new histograms if needed
844+ call HwU_allocate_histo(label,nbin_l)
845+c Setup the histogram
846 booked(label)=.true.
847 title(label)=title_l
848 nbin(label)=nbin_l
849@@ -111,7 +106,6 @@
850 histy2(label,i)=0d0
851 histy_err(label,i)=0d0
852 enddo
853- np=0
854 return
855 end
856
857@@ -121,8 +115,8 @@
858 c the 'HwU_inithist' subroutine. That means that each point should have
859 c the same number of weights.
860 subroutine HwU_fill(label,x,wgts)
861+ use HwU_variables
862 implicit none
863- include "HwU.inc"
864 integer label,i,j,bin
865 double precision x, wgts(*)
866 c If central weight is zero do not add this point.
867@@ -147,11 +141,7 @@
868 enddo
869 c If a new bin, add it to the list of points
870 np=np+1
871- if (np.gt.max_points) then
872- write (*,*) 'ERROR: increase max_points in HwU histogramming'
873- $ ,max_points
874- stop 1
875- endif
876+ call HwU_allocate_p
877 p_label(np)=label
878 p_bin(np)=bin
879 do j=1,nwgts
880@@ -159,7 +149,7 @@
881 enddo
882 return
883 end
884-
885+
886 c Call after all correlated contributions for a give phase-space
887 c point. I.e., every time you get a new set of random numbers from
888 c MINT/VEGAS. It adds the current list of points to the histograms. Add
889@@ -168,8 +158,8 @@
890 c this way, correlations between events and counter-events can be
891 c correctly taken into account.
892 subroutine HwU_add_points
893+ use HwU_variables
894 implicit none
895- include "HwU.inc"
896 integer i,j
897 do i=1,np
898 do j=1,nwgts
899@@ -192,12 +182,11 @@
900 c the current iteration so that they can be filled with the next
901 c iteration.
902 subroutine HwU_accum_iter(inclde,nPSpoints,values)
903+ use HwU_variables
904 implicit none
905- include "HwU.inc"
906 logical inclde
907 integer nPSpoints,label,i,j
908- double precision nPSinv,etot,vtot(max_wgts),niter,y_squared
909- $ ,values(2)
910+ double precision nPSinv,etot,niter,y_squared,values(2)
911 data niter /0d0/
912 nPSinv = 1d0/dble(nPSpoints)
913 if (inclde) niter = niter+1d0
914@@ -226,8 +215,8 @@
915 c intermediate stages this function can be called (together with
916 c HwU_output) to write intermediate plots to disk.
917 subroutine finalize_histograms(nPSpoints)
918+ use HwU_variables
919 implicit none
920- include "HwU.inc"
921 integer label,nPSpoints,i,j
922 double precision nPSinv,niter,dummy(2)
923 nPSinv=1d0/dble(nPSpoints)
924@@ -257,13 +246,13 @@
925 c histograms the central value should not be zero if any of the other
926 c weights are non-zero.
927 subroutine accumulate_results(label,nPSinv,niter,values)
928+ use HwU_variables
929 implicit none
930- include "HwU.inc"
931 integer label,i,j
932- double precision nPSinv,etot,vtot(max_wgts),niter,y_squared
933+ double precision nPSinv,etot,niter,y_squared
934 $ ,values(2),a1,a2
935- integer error_estimation
936- common /HwU_common2/ error_estimation
937+ double precision,allocatable :: vtot(:)
938+ if (.not. allocated(vtot)) allocate(vtot(nwgts))
939 if (error_estimation.eq.2) then
940 c Use the weighted average bin-by-bin. This is not really justified
941 c for fNLO computations, because for bins with low statistics, the
942@@ -395,14 +384,15 @@
943 c Write the histograms to disk at the end of the run, multiplying the
944 c output by 'xnorm'
945 subroutine HwU_output(unit,xnorm)
946+ use HwU_variables
947 implicit none
948- include "HwU.inc"
949 integer unit,i,j,label
950 integer max_length
951- parameter (max_length=(max_wgts+3)*17)
952- character*(max_length) buffer
953+ character(len=:), allocatable :: buffer
954 character*4 str_nbin
955 double precision xnorm
956+ if (.not. allocated(buffer))
957+ & allocate(character(len=(nwgts+3)*17) :: buffer)
958 c column info: x_min, x_max, y (central value), dy, {extra
959 c weights}.
960 write (unit,'(a$)') '##& xmin'
961@@ -440,9 +430,156 @@
962 write (unit,'(a)') ''
963 write (unit,'(a)') ''
964 enddo
965- return
966- end
967-
968+ deallocate(buffer)
969+ return
970+ end
971+
972+c Clean all the allocatable variables:
973+ subroutine HwU_deallocate_all
974+ use HwU_variables
975+ implicit none
976+ if (allocated(wgts_info)) deallocate(wgts_info)
977+ if (allocated(booked)) deallocate(booked)
978+ if (allocated(title)) deallocate(title)
979+ if (allocated(nbin)) deallocate(nbin)
980+ if (allocated(step)) deallocate(step)
981+ if (allocated(histxl)) deallocate(histxl)
982+ if (allocated(histxm)) deallocate(histxm)
983+ if (allocated(histy)) deallocate(histy)
984+ if (allocated(histy_acc)) deallocate(histy_acc)
985+ if (allocated(histi)) deallocate(histi)
986+ if (allocated(histy2)) deallocate(histy2)
987+ if (allocated(histy_err)) deallocate(histy_err)
988+ if (allocated(p_bin)) deallocate(p_bin)
989+ if (allocated(p_label)) deallocate(p_label)
990+ if (allocated(p_wgts)) deallocate(p_wgts)
991+ return
992+ end
993+
994+
995+ subroutine HwU_allocate_p
996+ use HwU_variables
997+ implicit none
998+ integer,allocatable :: itemp1(:)
999+ double precision, allocatable :: temp2(:,:)
1000+ if (.not. allocated(p_bin)) then
1001+ allocate(p_bin(max_plots))
1002+ allocate(p_label(max_plots))
1003+ allocate(p_wgts(nwgts,max_plots))
1004+ max_points=max_plots
1005+ else
1006+ if (np.gt.max_points) then
1007+c p_bin
1008+ allocate(itemp1(np+max_plots))
1009+ itemp1(1:max_points)=p_bin
1010+ call move_alloc(itemp1,p_bin)
1011+
1012+c p_label
1013+ allocate(itemp1(np+max_plots))
1014+ itemp1(1:max_points)=p_label
1015+ call move_alloc(itemp1,p_label)
1016+c p_wgts
1017+ allocate(temp2(nwgts,np+max_plots))
1018+ temp2(1:nwgts,1:max_points)=p_wgts
1019+ call move_alloc(temp2,p_wgts)
1020+ max_points=np+max_plots
1021+ endif
1022+ endif
1023+ return
1024+ end
1025+
1026+ subroutine HwU_allocate_histo(label,nbin_l)
1027+ use HwU_variables
1028+ implicit none
1029+ logical,allocatable :: ltemp(:)
1030+ integer,allocatable :: itemp1(:),itemp2(:,:)
1031+ character(len=50),allocatable :: ctemp(:)
1032+ double precision, allocatable :: temp1(:),temp2(:,:),temp3(:,:,:)
1033+ integer label,i,nbin_l,label_max,nbin_max
1034+ logical debug
1035+ parameter (debug=.true.)
1036+c Check if variables are already allocated. If not, simply allocate a
1037+c single histogram
1038+ if (.not. allocated(booked)) then
1039+ allocate(booked(1))
1040+ booked(1)=.false.
1041+ allocate(title(1))
1042+ allocate(nbin(1))
1043+ allocate(step(1))
1044+ allocate(histxl(1,nbin_l))
1045+ allocate(histxm(1,nbin_l))
1046+ allocate(histy(nwgts,1,nbin_l))
1047+ allocate(histy_acc(nwgts,1,nbin_l))
1048+ allocate(histi(1,nbin_l))
1049+ allocate(histy2(1,nbin_l))
1050+ allocate(histy_err(1,nbin_l))
1051+ max_plots=1
1052+ max_bins=nbin_l
1053+ endif
1054+c If current label is greater than the plots already allocated, increase
1055+c the size of the allocated arrays. This is kind of slow, but shouldn't
1056+c really matter since it's only done at the start of a run.
1057+ if (label.gt.max_plots .or. nbin_l.gt.max_bins) then
1058+ label_max=max(label,max_plots)
1059+ nbin_max=max(nbin_l,max_bins)
1060+c booked
1061+ allocate(ltemp(label_max))
1062+ ltemp(1:max_plots)=booked
1063+ call move_alloc(ltemp,booked)
1064+ do i=max_plots+1,label_max
1065+ booked(i)=.false. ! histos have not yet been setup
1066+ enddo
1067+c title
1068+ allocate(ctemp(label_max))
1069+ ctemp(1:max_plots)=title
1070+ call move_alloc(ctemp,title)
1071+c nbin
1072+ allocate(itemp1(label_max))
1073+ itemp1(1:max_plots)=nbin
1074+ call move_alloc(itemp1,nbin)
1075+c step
1076+ allocate(temp1(label_max))
1077+ temp1(1:max_plots)=step
1078+ call move_alloc(temp1,step)
1079+c histxl
1080+ allocate(temp2(label_max,nbin_max))
1081+ temp2(1:max_plots,1:max_bins)=histxl
1082+ call move_alloc(temp2,histxl)
1083+c histxm
1084+ allocate(temp2(label_max,nbin_max))
1085+ temp2(1:max_plots,1:max_bins)=histxm
1086+ call move_alloc(temp2,histxm)
1087+c histy
1088+ allocate(temp3(nwgts,label_max,nbin_max))
1089+ temp3(1:nwgts,1:max_plots,1:max_bins)=histy
1090+ call move_alloc(temp3,histy)
1091+c histy_acc
1092+ allocate(temp3(nwgts,label_max,nbin_max))
1093+ temp3(1:nwgts,1:max_plots,1:max_bins)=histy_acc
1094+ call move_alloc(temp3,histy_acc)
1095+c histi
1096+ allocate(itemp2(label_max,nbin_max))
1097+ itemp2(1:max_plots,1:max_bins)=histi
1098+ call move_alloc(itemp2,histi)
1099+c histy2
1100+ allocate(temp2(label_max,nbin_max))
1101+ temp2(1:max_plots,1:max_bins)=histy2
1102+ call move_alloc(temp2,histy2)
1103+c histy_err
1104+ allocate(temp2(label_max,nbin_max))
1105+ temp2(1:max_plots,1:max_bins)=histy_err
1106+ call move_alloc(temp2,histy_err)
1107+c Update maximums
1108+ max_plots=label_max
1109+ max_bins=nbin_max
1110+ elseif (booked(label)) then
1111+ write (*,*) 'ERROR in HwU.f: histogram already booked',label
1112+ stop
1113+ endif
1114+ return
1115+ end
1116+
1117+
1118 c dummy subroutine
1119 subroutine accum(idummy)
1120 integer idummy
1121@@ -451,3 +588,6 @@
1122 subroutine addfil(string)
1123 character*(*) string
1124 end
1125+
1126+
1127+
1128
1129=== removed file 'Template/NLO/FixedOrderAnalysis/HwU.inc'
1130--- Template/NLO/FixedOrderAnalysis/HwU.inc 2016-02-18 14:05:45 +0000
1131+++ Template/NLO/FixedOrderAnalysis/HwU.inc 1970-01-01 00:00:00 +0000
1132@@ -1,22 +0,0 @@
1133-* -*-fortran-*-
1134-
1135- integer max_plots,max_bins,max_wgts,max_points
1136- parameter (max_plots=200)
1137- parameter (max_bins=100)
1138- parameter (max_wgts=1024)
1139- parameter (max_points=max_plots*40)
1140-
1141- logical booked(max_plots)
1142- integer nbin(max_plots),nwgts,np,p_bin(max_points)
1143- & ,p_label(max_points),histi(max_plots,max_bins)
1144- character*50 title(max_plots)
1145- character*50 wgts_info(max_wgts)
1146- double precision histy(max_wgts,max_plots,max_bins)
1147- $ ,histy_acc(max_wgts,max_plots,max_bins),histy2(max_plots
1148- $ ,max_bins),histy_err(max_plots,max_bins),histxl(max_plots
1149- $ ,max_bins),histxm(max_plots,max_bins),step(max_plots)
1150- $ ,p_wgts(max_wgts,max_points)
1151-
1152- common/HwU_common/histy,histy_acc,histy2,histy_err,histxl,histxm
1153- & ,p_wgts,step,histi,nbin,p_bin,p_label,np,nwgts
1154- & ,booked,title,wgts_info
1155
1156=== modified file 'Template/NLO/FixedOrderAnalysis/analysis_HwU_template.f'
1157--- Template/NLO/FixedOrderAnalysis/analysis_HwU_template.f 2014-12-03 11:51:14 +0000
1158+++ Template/NLO/FixedOrderAnalysis/analysis_HwU_template.f 2017-08-16 21:26:30 +0000
1159@@ -17,12 +17,12 @@
1160 c o) The first argument is an integer that labels the histogram. In
1161 c the analysis_end and analysis_fill subroutines this label is used
1162 c to keep track of the histogram. The label should be a number
1163-c between 1 and max_plots=200 (can be increased in HwU.inc).
1164+c starting at 1 and be increased for each plot.
1165 c o) The second argument is a string that will apear above the
1166 c histogram. Do not use brackets "(" or ")" inside this string.
1167 c o) The third, forth and fifth arguments are the number of bis, the
1168 c lower edge of the first bin and the upper edge of the last
1169-c bin. There is a maximum of 100 bins per histogram.
1170+c bin.
1171 c o) When including scale and/or PDF uncertainties, declare a
1172 c histogram for each weight, and compute the uncertainties from the
1173 c final set of histograms
1174
1175=== removed symlink 'Template/NLO/MCatNLO/include/HwU.inc'
1176=== target was u'../../FixedOrderAnalysis/HwU.inc'
1177=== modified symlink 'Template/NLO/MCatNLO/include/reweight0.inc'
1178=== target was u'../../SubProcesses/reweight0.inc'
1179--- Template/NLO/MCatNLO/include/reweight0.inc 1970-01-01 00:00:00 +0000
1180+++ Template/NLO/MCatNLO/include/reweight0.inc 2017-08-16 21:26:30 +0000
1181@@ -0,0 +1,3 @@
1182+ integer max_weight_shower,maxscales,maxPDFs
1183+ parameter (max_weight_shower=1024,maxscales=9,maxPDFs=200)
1184+ integer iwgtnumpartn,jwgtinfo,mexternal
1185
1186=== modified file 'Template/NLO/MCatNLO/srcHerwig/madfks_hwdriver.f'
1187--- Template/NLO/MCatNLO/srcHerwig/madfks_hwdriver.f 2014-12-09 10:04:28 +0000
1188+++ Template/NLO/MCatNLO/srcHerwig/madfks_hwdriver.f 2017-08-16 21:26:30 +0000
1189@@ -323,7 +323,7 @@
1190 C---EVENTS ARE NORMALIZED TO SUM OR AVERAGE TO THE TOTAL CROSS SECTION
1191 WRITE(*,*)'How are the events normalized ("average" or "sum")?'
1192 READ(*,*)NORM_EVENT
1193- if (NORM_EVENT.eq.'average')MQQ=1
1194+ if (NORM_EVENT(1:3).ne.'sum')MQQ=1
1195
1196 MSFLAG=0
1197 IF (LHSOFT) THEN
1198@@ -397,3 +397,21 @@
1199 CALL RCLOS()
1200 999 STOP
1201 END
1202+
1203+
1204+c dummy routines for stdhep
1205+ SUBROUTINE PYERRM(MERR,CHMESS)
1206+ implicit none
1207+ integer MERR
1208+ CHARACTER CHMESS*(*)
1209+ write(*,*)'dummy PYERRM should never be called from HW6'
1210+ stop
1211+ end
1212+
1213+
1214+ FUNCTION PYCOMP(KF)
1215+ implicit none
1216+ integer KF,PYCOMP
1217+ write(*,*)'dummy PYCOMP should never be called from HW6'
1218+ stop
1219+ end
1220
1221=== modified file 'Template/NLO/MCatNLO/srcHerwig/madfks_hwlhin.f'
1222--- Template/NLO/MCatNLO/srcHerwig/madfks_hwlhin.f 2017-01-17 07:54:00 +0000
1223+++ Template/NLO/MCatNLO/srcHerwig/madfks_hwlhin.f 2017-08-16 21:26:30 +0000
1224@@ -80,7 +80,6 @@
1225 read(iunit,'(a)')string ! <rwgt>
1226 enddo
1227 if(index(string,'</event>').eq.0)then
1228- wgtref=XWGTUP/MQQ
1229 do iww=2,nwgt ! start at 2, because 'central value' is not part of the extra weights
1230 call read_rwgt_line_wgt(iunit,ww(iww))
1231 enddo
1232
1233=== modified file 'Template/NLO/MCatNLO/srcPythia/madfks_pydriver.f'
1234--- Template/NLO/MCatNLO/srcPythia/madfks_pydriver.f 2014-11-27 15:36:48 +0000
1235+++ Template/NLO/MCatNLO/srcPythia/madfks_pydriver.f 2017-08-16 21:26:30 +0000
1236@@ -318,7 +318,7 @@
1237 C---EVENTS ARE NORMALIZED TO SUM OR AVERAGE TO THE TOTAL CROSS SECTION
1238 WRITE(*,*)'How are the events normalized ("average" or "sum")?'
1239 READ(*,*)NORM_EVENT
1240- if (NORM_EVENT.eq.'average')MQQ=1
1241+ if (NORM_EVENT(1:3).ne.'sum')MQQ=1
1242
1243 C---USER'S INITIAL CALCULATIONS
1244 CALL PYABEG
1245
1246=== modified file 'Template/NLO/MCatNLO/srcPythia/madfks_pylhin.f'
1247--- Template/NLO/MCatNLO/srcPythia/madfks_pylhin.f 2016-03-21 08:45:42 +0000
1248+++ Template/NLO/MCatNLO/srcPythia/madfks_pylhin.f 2017-08-16 21:26:30 +0000
1249@@ -80,7 +80,6 @@
1250 if(jwgtinfo.eq.9)then
1251 if (nwgt.gt.1) then
1252 read(iunit,'(a)')string ! <rwgt>
1253- wgtref=XWGTUP/MQQ
1254 do iww=2,nwgt ! start at 2, because 'central value' is not part of the extra weights
1255 call read_rwgt_line_wgt(iunit,ww(iww))
1256 enddo
1257
1258=== modified file 'Template/NLO/MCatNLO/srcPythia8/Pythia8.cc'
1259--- Template/NLO/MCatNLO/srcPythia8/Pythia8.cc 2016-02-23 11:25:37 +0000
1260+++ Template/NLO/MCatNLO/srcPythia8/Pythia8.cc 2017-08-16 21:26:30 +0000
1261@@ -58,7 +58,7 @@
1262 int iEventshower=pythia.mode("Main:spareMode1");
1263 string evt_norm=pythia.word("Main:spareWord1");
1264 int iEventtot_norm=iEventtot;
1265- if (evt_norm == "average"){
1266+ if (evt_norm != "sum"){
1267 iEventtot_norm=1;
1268 }
1269
1270@@ -112,7 +112,7 @@
1271 double normhepmc;
1272 // Add the weight of the current event to the cross section.
1273 normhepmc = 1. / double(iEventshower);
1274- if (evt_norm == "average") {
1275+ if (evt_norm != "sum") {
1276 sigmaTotal += evtweight*normhepmc;
1277 } else {
1278 sigmaTotal += evtweight*normhepmc*iEventtot;
1279
1280=== modified file 'Template/NLO/MCatNLO/srcPythia8/Pythia82.cc'
1281--- Template/NLO/MCatNLO/srcPythia8/Pythia82.cc 2016-02-23 11:25:37 +0000
1282+++ Template/NLO/MCatNLO/srcPythia8/Pythia82.cc 2017-08-16 21:26:30 +0000
1283@@ -57,7 +57,7 @@
1284 int iEventshower=pythia.mode("Main:spareMode1");
1285 string evt_norm=pythia.word("Main:spareWord1");
1286 int iEventtot_norm=iEventtot;
1287- if (evt_norm == "average"){
1288+ if (evt_norm != "sum"){
1289 iEventtot_norm=1;
1290 }
1291
1292@@ -118,7 +118,7 @@
1293 double normhepmc;
1294 // Add the weight of the current event to the cross section.
1295 normhepmc = 1. / double(iEventshower);
1296- if (evt_norm == "average") {
1297+ if (evt_norm != "sum") {
1298 sigmaTotal += evtweight*normhepmc;
1299 } else {
1300 sigmaTotal += evtweight*normhepmc*iEventtot;
1301
1302=== modified file 'Template/NLO/MCatNLO/srcPythia8/Pythia82_hep.cc'
1303--- Template/NLO/MCatNLO/srcPythia8/Pythia82_hep.cc 2015-03-19 11:57:06 +0000
1304+++ Template/NLO/MCatNLO/srcPythia8/Pythia82_hep.cc 2017-08-16 21:26:30 +0000
1305@@ -70,7 +70,7 @@
1306 // the number of events read by Pythia so far
1307 int nSelected=pythia.info.nSelected();
1308
1309- if (nSelected >= iEventshower) break;
1310+ if (nSelected > iEventshower) break;
1311 if (pythia.info.isLHA() && iPrintLHA < nPrintLHA) {
1312 pythia.LHAeventList();
1313 pythia.info.list();
1314@@ -83,7 +83,7 @@
1315 double evtweight = pythia.info.weight();
1316 double normhepmc;
1317 // ALWAYS NORMALISE HEPMC WEIGHTS TO SUM TO THE CROSS SECTION
1318- if (evt_norm == "average") {
1319+ if (evt_norm != "sum") {
1320 normhepmc = 1. / double(iEventshower);
1321 } else {
1322 normhepmc = double(iEventtot) / double(iEventshower);
1323
1324=== modified file 'Template/NLO/MCatNLO/srcPythia8/Pythia8_hep.cc'
1325--- Template/NLO/MCatNLO/srcPythia8/Pythia8_hep.cc 2015-03-19 12:02:08 +0000
1326+++ Template/NLO/MCatNLO/srcPythia8/Pythia8_hep.cc 2017-08-16 21:26:30 +0000
1327@@ -64,7 +64,7 @@
1328 // the number of events read by Pythia so far
1329 int nSelected=pythia.info.nSelected();
1330
1331- if (nSelected >= iEventshower) break;
1332+ if (nSelected > iEventshower) break;
1333 if (pythia.info.isLHA() && iPrintLHA < nPrintLHA) {
1334 pythia.LHAeventList();
1335 pythia.info.list();
1336@@ -77,7 +77,7 @@
1337 double evtweight = pythia.info.weight();
1338 double normhepmc;
1339 // ALWAYS NORMALISE HEPMC WEIGHTS TO SUM TO THE CROSS SECTION
1340- if (evt_norm == "average") {
1341+ if (evt_norm != "sum") {
1342 normhepmc = 1. / double(iEventshower);
1343 } else {
1344 normhepmc = double(iEventtot) / double(iEventshower);
1345
1346=== modified file 'Template/NLO/Source/alfas_functions_lhapdf.f'
1347--- Template/NLO/Source/alfas_functions_lhapdf.f 2013-12-20 05:39:24 +0000
1348+++ Template/NLO/Source/alfas_functions_lhapdf.f 2017-08-16 21:26:30 +0000
1349@@ -89,7 +89,7 @@
1350 ALPHAS=alphasPDF(Q)
1351 call cpu_time(tAfter)
1352
1353- tPDF = tPDF + (tAfter-tBefore)
1354+c tPDF = tPDF + (tAfter-tBefore)
1355
1356 RETURN
1357 END
1358
1359=== added file 'Template/NLO/Source/extra_weights.f'
1360--- Template/NLO/Source/extra_weights.f 1970-01-01 00:00:00 +0000
1361+++ Template/NLO/Source/extra_weights.f 2017-08-16 21:26:30 +0000
1362@@ -0,0 +1,43 @@
1363+ module extra_weights
1364+
1365+ integer,parameter :: iwgtinfo=-5,maxscales=9,maxPDFs=200
1366+ $ ,maxPDFsets=25,maxdynscales=10
1367+ integer :: max_mom_str=1,max_mext=1,max_n_ctr=1
1368+ logical :: doreweight,lscalevar(maxdynscales)
1369+ $ ,lpdfvar(maxPDFsets)
1370+ integer :: iwgtnumpartn,jwgtinfo,mexternal
1371+ $ ,lhaPDFid(0:maxPDFsets),nmemPDF(maxPDFsets)
1372+ $ ,dyn_scale(0:maxdynscales),n_ctr_found,n_mom_conf
1373+ double precision :: wgtdegrem_xi,wgtdegrem_lxi,wgtdegrem_muF
1374+ $ ,wgtnstmp,wgtwnstmpmuf,wgtwnstmpmur,wgtnstmp_avgvirt
1375+ $ ,wgtref,scalevarR(0:maxscales),scalevarF(0:maxscales)
1376+ $ ,wgtxsecmu(maxscales,maxscales,maxdynscales)
1377+ $ ,wgtxsecPDF(0:maxPDFs,maxPDFsets),wgtbpower,wgtcpower
1378+ $ ,veto_multiplier,H1_factor_virt,veto_compensating_factor
1379+ $ ,born_wgt_veto
1380+ double precision,allocatable :: momenta_str(:,:,:)
1381+ character(len= 100) :: LHAPDFsetname(maxPDFsets)
1382+ character(len=1024),allocatable :: n_ctr_str(:)
1383+
1384+c input of cpower (checked against calculated value)
1385+ double precision,parameter :: cpowerinput=0d0
1386+c switch for running muR-dependent factor runfac=1(running)/0(fixed)
1387+ integer,parameter :: runfac=0
1388+c WARNING: If you set runfac=1 to include a muR-dependent factor
1389+c make sure you modified the function rwgt_muR_dep_fac in
1390+c reweight_xsec.f and compute_cpower in fks_singular.f
1391+c appropiately to include all muR dependent overall factors
1392+c (except for alpha_s) in the calculation. This procedure
1393+c will be incorrect, if you miss one of the muR dependent
1394+c factors or if there is a not factorizing muR dependent term.
1395+c You also have to set ren_group_coeff_in and cpowerinput
1396+c to the proper values.
1397+
1398+c first order coefficient of renormalization group equation of the
1399+c muR-dependent factor,
1400+c e.g. for masses: ren_group_coeff = gamma0 = 3/2*C_F,
1401+c i.e. also for Yukawa: ren_group_coeff = gamma0
1402+ integer,parameter :: ren_group_coeff_in=0d0
1403+
1404+ save
1405+ end module extra_weights
1406
1407=== removed file 'Template/NLO/Source/getissud.f'
1408--- Template/NLO/Source/getissud.f 2012-12-04 16:52:45 +0000
1409+++ Template/NLO/Source/getissud.f 1970-01-01 00:00:00 +0000
1410@@ -1,201 +0,0 @@
1411-C...GETISSUD performs an interpolation/extrapolation in 3 dimensions by
1412-C...fitting quadratic splines using 4 points in each dimension
1413- double precision function getissud(ibeam,kfl,x1,x2,pt2)
1414- implicit none
1415-
1416- include 'sudgrid.inc'
1417-
1418-c Arguments
1419- integer ibeam,kfl
1420- double precision x1,x2,pt2
1421-c Storing values for the interpolation
1422- double precision smallgrid(4,4),minigrid(4) ! pt2,x1
1423-c Local variables
1424- integer ipt2,ix1,ix2,ilo,ihi,i,j,k,kkfl,ipoints
1425- double precision pt2i,x2i,x1i,minpoint,maxpoint,x(3)
1426- integer nerr
1427- data nerr/0/
1428-
1429- getissud=0
1430-
1431- x(1)=log(x2)
1432- x(2)=x1
1433- x(3)=log(pt2)
1434-
1435- kkfl=kfl
1436- if(ibeam.lt.0) kkfl=-kkfl
1437- if(kkfl.lt.-2) kkfl=iabs(kfl)
1438- if(iabs(kkfl).eq.21) kkfl=0
1439- if(kkfl.eq.5) then
1440- ipoints=2
1441- else
1442- ipoints=1
1443- endif
1444- if(kkfl.gt.5) then
1445- if(nerr.lt.10)
1446- $ write(*,*)'GETISSUD Warning: flavor ',kfl,' not supported'
1447- nerr=nerr+1
1448- getissud=1
1449- return
1450- endif
1451-
1452- if(x(1).lt.points(1,ipoints).or.
1453- $ x(1).gt.points(nx2,ipoints).and.nerr.lt.10)
1454- $ then
1455- write(*,*) 'GETISSUD Warning: extrapolation in x2: ',x2
1456- nerr=nerr+1
1457- endif
1458-
1459- if(x(2).lt.points(nx2+1,ipoints).or.
1460- $ x(2).gt.points(nx2+nx1,ipoints)
1461- $ .and.nerr.lt.10) then
1462- write(*,*) 'GETISSUD Warning: extrapolation in x1: ',x1
1463- nerr=nerr+1
1464- endif
1465-
1466- if(kkfl.eq.5.and.pt2.lt.22.3109)then
1467- getissud=1d0
1468- return
1469- endif
1470-
1471- if(kkfl.eq.5.and.x1.gt.0.6)then
1472- getissud=0d0
1473- return
1474- endif
1475-
1476- if(x(3).lt.points(nx2+nx1+1,ipoints)) then
1477- write(*,*) 'GETISSUD Error! pt2 = ',exp(x(3)),' < ',
1478- $ exp(points(nx2+nx1+1,ipoints)),' = min(pt2). Not allowed!'
1479- write(*,*) 'You need to regenerate grid with new pt2min.'
1480- stop
1481- endif
1482-
1483- if(x(3).lt.points(nx2+nx1+1,ipoints).or.
1484- $ x(3).gt.points(nx2+nx1+npt2,ipoints)
1485- $ .and.nerr.lt.10) then
1486- write(*,*) 'GETISSUD Warning: extrapolation in pt2: ',pt2
1487- nerr=nerr+1
1488- endif
1489-
1490-
1491-c Find nearest points by binary method
1492-c x2
1493- ilo=1
1494- ihi=nx2
1495- do while(ihi.gt.ilo+1)
1496- ix2=ilo+(ihi-ilo)/2
1497- if(x(1).gt.points(ix2,ipoints))then
1498- ilo=ix2
1499- else
1500- ihi=ix2
1501- endif
1502- enddo
1503- if(x(1).lt.points(ix2,ipoints))
1504- $ ix2=ix2-1
1505- ix2=max(2,min(ix2,nx2-2))
1506-
1507-c print *,'x2: ',ix2,x(1),(points(i,ipoints),i=ix2-1,ix2+2)
1508-
1509-c x1
1510- ilo=1
1511- ihi=nx1
1512- do while(ihi.gt.ilo+1)
1513- ix1=ilo+(ihi-ilo)/2
1514- if(x(2).gt.points(nx2+ix1,ipoints))then
1515- ilo=ix1
1516- else
1517- ihi=ix1
1518- endif
1519- enddo
1520- if(x(2).lt.points(nx2+ix1,ipoints))
1521- $ ix1=ix1-1
1522- ix1=max(2,min(ix1,nx1-2))
1523-
1524- do while(kkfl.eq.5.and.
1525- $ points(nx2+ix1+2,ipoints).gt.0.6)
1526- ix1=ix1-1
1527- enddo
1528-
1529-c print *,'x1: ',ix1,x(2),(points(nx2+i,ipoints),i=ix1-1,ix1+2)
1530-
1531-c pt2
1532- ilo=1
1533- ihi=npt2
1534- do while(ihi.gt.ilo+1)
1535- ipt2=ilo+(ihi-ilo)/2
1536- if(x(3).gt.points(nx2+nx1+ipt2,ipoints))then
1537- ilo=ipt2
1538- else
1539- ihi=ipt2
1540- endif
1541- enddo
1542- if(x(3).lt.points(nx2+nx1+ipt2,ipoints))
1543- $ ipt2=ipt2-1
1544- ipt2=max(2,min(ipt2,npt2-2))
1545-
1546- do while(kkfl.eq.5.and.
1547- $ exp(points(nx2+nx1+ipt2-1,ipoints)).lt.22.3109)
1548- ipt2=ipt2+1
1549- enddo
1550-c print *,'pt2: ',ipt2,x(3),(points(nx2+nx1+i,ipoints),i=ipt2-1,ipt2+2)
1551-c print *,'pt: ',ipt2,exp(x(3)/2),
1552-c $ (exp(points(nx2+nx1+i,ipoints)/2),i=ipt2-1,ipt2+2)
1553-
1554-C Now perform inter-/extra-polation
1555-
1556-C Start with x2, which should have the flattest distribution
1557-C Calculate sud(x2,ax1,apt2) for the 4x4 apt2 and ax1
1558-C Then continue with pt2 and calculate sud(x2,ax1,pt2)
1559-C for the 4 ax1
1560-C Finally calculate sud(x2,x1,pt2)
1561-
1562- do i=1,4
1563- do j=1,4
1564-c print *,'x1,pt:',points(nx2+ix1-2+i,ipoints),
1565-c $ exp(points(nx2+nx1+ipt2-2+j,ipoints)/2)
1566- call splint2(sudgrid(ix2-1,ix1-2+i,ipt2-2+j,kkfl),
1567- $ points(ix2-1,ipoints),4,x(1),smallgrid(j,i))
1568- smallgrid(j,i)=max(0d0,min(1d0,smallgrid(j,i)))
1569- enddo
1570- enddo
1571-
1572- do i=1,4
1573- call splint2(smallgrid(1,i),
1574- $ points(nx2+nx1+ipt2-1,ipoints),4,x(3),minigrid(i))
1575- minigrid(i)=max(0d0,min(1d0,minigrid(i)))
1576- enddo
1577-
1578- call splint2(minigrid,
1579- $ points(nx2+ix1-1,ipoints),4,x(2),getissud)
1580- getissud=max(0d0,min(1d0,getissud))
1581-
1582-c print *,'Result: ',getissud
1583-
1584- return
1585- end
1586-
1587-
1588- subroutine splint2(ypoints,xpoints,npoints,x,ans)
1589- implicit none
1590-
1591-C arguments
1592- integer npoints
1593- double precision ypoints(npoints),xpoints(npoints)
1594- double precision x,ans
1595-C local variables
1596- double precision a0,a1,a2,sd
1597- integer ifail,i
1598-
1599- CALL DLSQP2(npoints,xpoints,ypoints,a0,a1,a2,sd,ifail)
1600-
1601-c print *,'Point, interpolation:'
1602-c do i=1,npoints
1603-c print *,exp(xpoints(i)),ypoints(i),
1604-c $ a0+a1*xpoints(i)+a2*xpoints(i)**2
1605-c enddo
1606-
1607- ans=a0+a1*x+a2*x**2
1608-c print *,x,ans
1609-
1610- return
1611- end
1612
1613=== modified file 'Template/NLO/Source/make_opts.inc'
1614--- Template/NLO/Source/make_opts.inc 2016-06-28 14:44:52 +0000
1615+++ Template/NLO/Source/make_opts.inc 2017-08-16 21:26:30 +0000
1616@@ -48,11 +48,6 @@
1617 F2PY=$(DEFAULT_F2PY_COMPILER)
1618 endif
1619
1620-# Set CXX unless it's defined by an environment variable
1621-ifeq ($(origin CXX),default)
1622- CXX=$(DEFAULT_CPP_COMPILER)
1623-endif
1624-
1625 UNAME := $(shell uname -s)
1626 ifeq ($(origin LDFLAGS), undefined)
1627 LDFLAGS=$(STDLIB) $(MACFLAG)
1628@@ -94,10 +89,22 @@
1629 alfas_functions=alfas_functions_lhapdf
1630 llhapdf = $(shell $(lhapdf) --libs)
1631 reweight_xsec_events_pdf_dummy=
1632+ # check if we need to activate c++11 (for lhapdf6.2)
1633+ ifeq ($(origin CXX),default)
1634+ ifeq ($lhapdfversion$lhapdfsubversion,62)
1635+ CXX=$(DEFAULT_CPP_COMPILER) -std=c++11
1636+ else
1637+ CXX=$(DEFAULT_CPP_COMPILER)
1638+ endif
1639+ endif
1640 else
1641 alfas_functions=alfas_functions
1642 llhapdf=
1643 reweight_xsec_events_pdf_dummy=reweight_xsec_events_pdf_dummy.o
1644+ # Set CXX unless it's defined by an environment variable
1645+ ifeq ($(origin CXX),default)
1646+ CXX=$(DEFAULT_CPP_COMPILER)
1647+ endif
1648 endif
1649
1650 # Option APPLGrid
1651
1652=== modified file 'Template/NLO/Source/makefile'
1653--- Template/NLO/Source/makefile 2017-05-09 13:28:25 +0000
1654+++ Template/NLO/Source/makefile 2017-08-16 21:26:30 +0000
1655@@ -8,12 +8,8 @@
1656 IREGIDIR= ./IREGI/src/
1657 STDHEPDIR= ./StdHEP/
1658
1659-PROCESS= matrix.o myamp.o
1660-
1661-GENERIC = $(alfas_functions).o rw_routines.o kin_functions.o setrun.o \
1662- run_printout.o dgauss.o ranmar.o getissud.o
1663-
1664-INCLUDEF = coupl.inc pmass.inc cluster.inc
1665+GENERIC = $(alfas_functions).o rw_routines.o kin_functions.o \
1666+ run_printout.o dgauss.o ranmar.o setrun.o
1667
1668 .f.o: ; $(FC) $(FFLAGS) -c $*.f
1669
1670@@ -21,19 +17,19 @@
1671 $(LIBDIR)libmodel.a $(LIBDIR)libcernlib.a param_card.inc
1672 rm -f PDF/*.o
1673
1674-
1675 $(LIBDIR)libdhelas.a: DHELAS
1676 rm -f $(LIBDIR)libdhelas.a
1677 cd DHELAS; make
1678
1679 $(LIBDIR)libgeneric.a: $(GENERIC)
1680 rm -f $(LIBDIR)libgeneric.a
1681- ar cru libgeneric.a $(GENERIC)
1682+ ar cru libgeneric.a $(GENERIC) extra_weights.o
1683 ranlib libgeneric.a
1684 mv libgeneric.a $(LIBDIR)
1685+ cp -f extra_weights.mod $(LIBDIR)
1686 rm -f $(alfas_functions).o
1687
1688-setrun.o: run_card.inc
1689+setrun.o: run_card.inc extra_weights.o
1690 $(FC) $(FFLAGS) -c -o setrun.o setrun.f
1691
1692 $(LIBDIR)libpdf.a: PDF
1693
1694=== modified file 'Template/NLO/Source/run.inc'
1695--- Template/NLO/Source/run.inc 2017-01-13 15:01:41 +0000
1696+++ Template/NLO/Source/run.inc 2017-08-16 21:26:30 +0000
1697@@ -54,11 +54,6 @@
1698 double precision bwcutoff
1699 common/to_bwcutoff/ bwcutoff
1700 c
1701-c Sudakov grid file name
1702-c
1703- character*130 issgridfile
1704- common/to_sgridfile/issgridfile
1705-c
1706 c kT/pT scheme for xqcut, clustering according to channel
1707 c
1708 integer ktscheme
1709
1710=== removed file 'Template/NLO/Source/run_config.inc'
1711--- Template/NLO/Source/run_config.inc 2015-09-24 16:36:04 +0000
1712+++ Template/NLO/Source/run_config.inc 1970-01-01 00:00:00 +0000
1713@@ -1,54 +0,0 @@
1714-c*********************************************************************
1715-c Parameters to configure running information for MadEvent
1716-c The default values of these parameters should not need to be
1717-c changed, unless there is a special need for optimization
1718-c*********************************************************************
1719-c
1720-c The following parameters are used by symmetry.f in setting up the survey
1721-c
1722- integer icomp
1723- parameter (icomp = 3) !BW + Symmetry compression 0 == none
1724- integer min_events_subprocess !Minimum number of events
1725- parameter (min_events_subprocess = 2000) !per iteration in each subprocess
1726- integer min_events_channel !Minimum number of events
1727- parameter (min_events_channel = 1000) !per iteration in each channel
1728- integer iter_survey !Number of iterations for survey
1729- parameter (iter_survey=4)
1730- integer nhel_survey !Number of helicities to sum for each
1731- parameter (nhel_survey=0) !phase space point. (0 = sum_all)
1732-c
1733-c The following parameters are used by gen_ximprove.f in running refine
1734-c
1735- integer min_events !Minimum number of events/iteration
1736- parameter (min_events = 2000) !to refine a channel
1737- integer max_events !Maximum number of events/iteration
1738- parameter (max_events = 2000) !to refine a channel
1739- integer max_iter !Maximum number of iterations
1740- parameter (max_iter = 9) !during refinement
1741- integer nhel_refine !Number of helicities to sum for each
1742- parameter (nhel_refine=0) !phase space point. (0 = sum_all)
1743-c
1744-c The following are used for parallel running
1745-c
1746- character*(20) PBS_QUE
1747- parameter (PBS_QUE = 'madgraph')
1748-
1749- integer ChanPerJob
1750- parameter (ChanPerJob=100000000) !Number of channels / job for survey
1751-
1752-c integer max_np
1753-c parameter (max_np=1) !Number of channels / job for refine
1754-c
1755-c
1756-c
1757- double precision trunc_max
1758- parameter (trunc_max=0.01)
1759-c
1760-c The following are used for grid type running
1761-c
1762- double precision acc_wu
1763- parameter (acc_wu = 0.01) !Desired accuracy from warmup run
1764- integer npoints_wu, itmax_wu !warmup # points/iterations
1765- parameter (npoints_wu = 4000, itmax_wu = 8)
1766- integer min_gevents_wu
1767- parameter (min_gevents_wu=1000) !Minumum # unweighted events to generate from channel
1768
1769=== modified file 'Template/NLO/Source/setrun.f'
1770--- Template/NLO/Source/setrun.f 2017-05-09 11:54:11 +0000
1771+++ Template/NLO/Source/setrun.f 2017-08-16 21:26:30 +0000
1772@@ -6,47 +6,16 @@
1773 c 2. Collider parameters
1774 c 3. cuts
1775 c----------------------------------------------------------------------
1776+ use extra_weights
1777 implicit none
1778-c
1779-c parameters
1780-c
1781- integer maxpara
1782- parameter (maxpara=1000)
1783-c
1784-c local
1785-c
1786- integer npara
1787- character*20 param(maxpara),value(maxpara)
1788-c
1789-c include
1790-c
1791 include 'PDF/pdf.inc'
1792 include 'run.inc'
1793 include 'alfas.inc'
1794 include 'MODEL/coupl.inc'
1795- include '../SubProcesses/reweight0.inc'
1796-
1797- double precision D
1798- common/to_dj/D
1799-c
1800-c local
1801-c
1802- character*20 ctemp
1803- integer k,i,l1,l2
1804+ integer k,i
1805 character*132 buff
1806-C
1807-C input cuts
1808-C
1809 include 'cuts.inc'
1810-C
1811-C BEAM POLARIZATION
1812-C
1813- REAL*8 POL(2)
1814- common/to_polarization/ POL
1815- data POL/1d0,1d0/
1816-c
1817-c Les Houches init block (for the <init> info)
1818-c
1819+c Les Houches init block (for the <init> info)
1820 integer maxpup
1821 parameter(maxpup=100)
1822 integer idbmup,pdfgup,pdfsup,idwtup,nprup,lprup
1823@@ -55,7 +24,6 @@
1824 & idwtup,nprup,xsecup(maxpup),xerrup(maxpup),
1825 & xmaxup(maxpup),lprup(maxpup)
1826 c
1827- logical gridrun,gridpack
1828 integer iseed
1829 common /to_seed/ iseed
1830 integer nevents
1831@@ -64,17 +32,13 @@
1832 integer iappl
1833 common /for_applgrid/ iappl
1834 integer idum
1835-C
1836-c
1837-c----------
1838-c start
1839-c----------
1840+c jet-rate distance. To be set to 1 for FxFx
1841+ double precision D
1842+ common/to_dj/D
1843+c Include all the parameters set in the run_card.dat
1844 include 'run_card.inc'
1845-
1846-c MZ add the possibility to have shower_MC input lowercase
1847+c Change shower_MC string to upper case
1848 call to_upper(shower_MC)
1849-C
1850-
1851 c Determine if there is a need to do scale and/or PDF reweighting
1852 do_rwgt_scale=.false.
1853 do i=1,dyn_scale(0)
1854@@ -90,69 +54,41 @@
1855 exit
1856 endif
1857 enddo
1858-
1859 c Default scale and PDF choice used for the actual run
1860 dynamical_scale_choice=dyn_scale(1)
1861 lhaid=lhaPDFid(1)
1862-
1863-c merging cuts
1864- xqcut=0d0
1865- xmtc=0d0
1866- d=1d0
1867-
1868-c*********************************************************************
1869-c Random Number Seed *
1870-c*********************************************************************
1871-
1872- gridrun=.false.
1873- gridpack=.false.
1874-
1875-c************************************************************************
1876-c Renormalization and factorization scales *
1877-c************************************************************************
1878-c
1879-
1880 c For backward compatibility
1881 scale = muR_ref_fixed
1882 q2fact(1) = muF1_ref_fixed**2 ! fact scale**2 for pdf1
1883 q2fact(2) = muF2_ref_fixed**2 ! fact scale**2 for pdf2
1884 scalefact=muR_over_ref
1885 ellissextonfact=QES_over_ref
1886-
1887 c check that the event normalization input is reasoble
1888 buff = event_norm
1889 call case_trap2(buff) ! requires a string of length 20 at least
1890 event_norm=buff
1891- if (event_norm(1:7).ne.'average' .and. event_norm(1:3).ne.'sum'
1892- $ .and. event_norm(1:5).ne.'unity')then
1893+ if ( event_norm(1:7).ne.'average' .and.
1894+ $ event_norm(1:3).ne.'sum' .and.
1895+ $ event_norm(1:5).ne.'unity'.and.
1896+ $ event_norm(1:4).ne.'bias')then
1897 write (*,*) 'Do not understand the event_norm parameter'/
1898 & /' in the run_card.dat. Possible options are'/
1899- & /' "average", "sum" or "unity". Current input is: ',
1900- & event_norm
1901- open(unit=26,file='../../error',status='unknown')
1902- write (26,*) 'Do not understand the event_norm parameter'/
1903- & /' in the run_card.dat. Possible options are'/
1904- & /' "average", "sum" or "unity". Current input is: ',
1905- & event_norm
1906-
1907+ & /' "average", "sum", "unity" or "bias". '/
1908+ & /'Current input is: ', event_norm
1909 stop 1
1910 endif
1911-
1912-c info for reweight
1913-
1914+c Check parameters for FxFx/UNLOPS/NNLL-veto
1915 if ( ickkw.ne.0 .and. ickkw.ne.4 .and. ickkw.ne.3 .and.
1916 & ickkw.ne.-1) then
1917 write (*,*) 'ickkw parameter not known. ickkw=',ickkw
1918 stop
1919 endif
1920-c$$$ ickkw=0
1921 chcluster=.false.
1922 ktscheme=1
1923-
1924-c !!! Default behavior changed (MH, Aug. 07) !!!
1925-c If no pdf, read the param_card and use the value from there and
1926-c order of alfas running = 2
1927-
1928+ xqcut=0d0
1929+ xmtc=0d0
1930+ D=1d0
1931+c Set alphaS(mZ)
1932 if(lpp(1).ne.0.or.lpp(2).ne.0) then
1933 write(*,*) 'A PDF is used, so alpha_s(MZ)'/
1934 & /' is going to be modified'
1935@@ -172,33 +108,29 @@
1936 write(*,*) 'The default order of alpha_s running is fixed to '
1937 & ,nloop
1938 endif
1939-c !!! end of modification !!!
1940-
1941-C Fill common block for Les Houches init info
1942+C Fill common block for Les Houches init info
1943 do i=1,2
1944- if(lpp(i).eq.1.or.lpp(i).eq.2) then
1945- idbmup(i)=2212
1946- elseif(lpp(i).eq.-1.or.lpp(i).eq.-2) then
1947- idbmup(i)=-2212
1948- elseif(lpp(i).eq.3) then
1949- idbmup(i)=11
1950- elseif(lpp(i).eq.-3) then
1951- idbmup(i)=-11
1952- elseif(lpp(i).eq.0) then
1953- open (unit=71,status='old',file='initial_states_map.dat')
1954- read (71,*,err=100)idum,idum,idbmup(1),idbmup(2)
1955- close (71)
1956-c idbmup(i)=idup(i,1)
1957- else
1958- idbmup(i)=lpp(i)
1959- endif
1960+ if(lpp(i).eq.1.or.lpp(i).eq.2) then
1961+ idbmup(i)=2212
1962+ elseif(lpp(i).eq.-1.or.lpp(i).eq.-2) then
1963+ idbmup(i)=-2212
1964+ elseif(lpp(i).eq.3) then
1965+ idbmup(i)=11
1966+ elseif(lpp(i).eq.-3) then
1967+ idbmup(i)=-11
1968+ elseif(lpp(i).eq.0) then
1969+ open (unit=71,status='old',file='initial_states_map.dat')
1970+ read (71,*,err=100)idum,idum,idbmup(1),idbmup(2)
1971+ close (71)
1972+ else
1973+ idbmup(i)=lpp(i)
1974+ endif
1975 ebmup(i)=ebeam(i)
1976 enddo
1977 call get_pdfup(pdlabel,pdfgup,pdfsup,lhaid)
1978-
1979+c Fill the nmemPDF(i) array with the number of PDF error set. This we
1980+c get from LHAPDF.
1981 if (lpdfvar(1) .and. (lpp(1).ne.0.or.lpp(2).ne.0) ) then
1982-c fill the nmemPDF(i) array with the number of PDF error set. This we
1983-c get from LHAPDF.
1984 call numberPDFm(1,nmemPDF(1))
1985 if (nmemPDF(1).eq.1) then
1986 nmemPDF(1)=0
1987@@ -207,100 +139,51 @@
1988 else
1989 nmemPDF(1)=0
1990 endif
1991-
1992- return
1993- 99 write(*,*) 'error in reading'
1994 return
1995 100 write(*,*) '"initial_states_map.dat" not found (or incorrect'/
1996 $ /' format) by "Source/setrun"'
1997 stop 1
1998 end
1999
2000-C-------------------------------------------------
2001-C GET_PDFUP
2002-C Convert MadEvent pdf name to LHAPDF number
2003-C-------------------------------------------------
2004-
2005 subroutine get_pdfup(pdfin,pdfgup,pdfsup,lhaid)
2006+C Convert internal pdf name to LHAPDF number
2007 implicit none
2008-
2009 character*(*) pdfin
2010 integer mpdf
2011 integer npdfs,i,pdfgup(2),pdfsup(2),lhaid
2012-
2013 parameter (npdfs=16)
2014 character*7 pdflabs(npdfs)
2015- data pdflabs/
2016- $ 'none',
2017- $ 'mrs02nl',
2018- $ 'mrs02nn',
2019- $ 'cteq4_m',
2020- $ 'cteq4_l',
2021- $ 'cteq4_d',
2022- $ 'cteq5_m',
2023- $ 'cteq5_d',
2024- $ 'cteq5_l',
2025- $ 'cteq5m1',
2026- $ 'cteq6_m',
2027- $ 'cteq6_l',
2028- $ 'cteq6l1',
2029- $ 'nn23lo',
2030- $ 'nn23lo1',
2031- $ 'nn23nlo'/
2032+ data pdflabs/ 'none', 'mrs02nl', 'mrs02nn', 'cteq4_m', 'cteq4_l',
2033+ $ 'cteq4_d', 'cteq5_m', 'cteq5_d', 'cteq5_l', 'cteq5m1',
2034+ $ 'cteq6_m', 'cteq6_l', 'cteq6l1', 'nn23lo', 'nn23lo1',
2035+ $ 'nn23nlo'/
2036 integer numspdf(npdfs)
2037- data numspdf/
2038- $ 00000,
2039- $ 20250,
2040- $ 20270,
2041- $ 19150,
2042- $ 19170,
2043- $ 19160,
2044- $ 19050,
2045- $ 19060,
2046- $ 19070,
2047- $ 19051,
2048- $ 10000,
2049- $ 10041,
2050- $ 10042,
2051- $ 246800,
2052- $ 247000,
2053- $ 244800/
2054-
2055-
2056+ data numspdf/ 00000, 20250, 20270, 19150, 19170, 19160, 19050,
2057+ $ 19060, 19070, 19051, 10000, 10041, 10042, 246800, 247000,
2058+ $ 244800/
2059 if(pdfin.eq."lhapdf") then
2060- write(*,*)'using LHAPDF'
2061- do i=1,2
2062- pdfgup(i)=-1
2063- pdfsup(i)=lhaid
2064- enddo
2065- return
2066+ write(*,*)'using LHAPDF'
2067+ do i=1,2
2068+ pdfgup(i)=-1
2069+ pdfsup(i)=lhaid
2070+ enddo
2071+ return
2072 endif
2073-
2074-
2075 mpdf=-1
2076 do i=1,npdfs
2077- if(pdfin(1:len_trim(pdfin)) .eq. pdflabs(i))then
2078- mpdf=numspdf(i)
2079- endif
2080+ if(pdfin(1:len_trim(pdfin)) .eq. pdflabs(i))then
2081+ mpdf=numspdf(i)
2082+ endif
2083 enddo
2084-
2085 if(mpdf.eq.-1) then
2086- write(*,*)'ERROR: pdf ',pdfin,' not implemented in get_pdfup.'
2087- write(*,*)'known pdfs are'
2088- write(*,*) pdflabs
2089- open(unit=26,file='../../error',status='unknown')
2090- write(26,*)'ERROR: pdf ',pdfin,' not implemented in get_pdfup.'
2091- write(26,*)'known pdfs are'
2092- write(26,*) pdflabs
2093- stop 1
2094-c$$$ write(*,*)'using ',pdflabs(12)
2095-c$$$ mpdf=numspdf(12)
2096+ write(*,*)'ERROR: pdf ',pdfin,' not implemented in get_pdfup.'
2097+ write(*,*)'known pdfs are'
2098+ write(*,*) pdflabs
2099+ stop 1
2100 endif
2101-
2102 do i=1,2
2103- pdfgup(i)=-1
2104- pdfsup(i)=mpdf
2105+ pdfgup(i)=-1
2106+ pdfsup(i)=mpdf
2107 enddo
2108-
2109 return
2110 end
2111
2112=== removed file 'Template/NLO/Source/sudgrid.inc'
2113--- Template/NLO/Source/sudgrid.inc 2012-08-28 21:06:34 +0000
2114+++ Template/NLO/Source/sudgrid.inc 1970-01-01 00:00:00 +0000
2115@@ -1,4 +0,0 @@
2116- integer npt2,nx1,nx2
2117- parameter(npt2=40,nx1=80,nx2=20)
2118- double precision points(nx2+nx1+npt2,2),sudgrid(nx2,nx1,npt2,-2:5)
2119- common/sudgrid/points,sudgrid
2120
2121=== modified file 'Template/NLO/SubProcesses/add_write_info.f'
2122--- Template/NLO/SubProcesses/add_write_info.f 2017-05-16 08:15:12 +0000
2123+++ Template/NLO/SubProcesses/add_write_info.f 2017-08-16 21:26:30 +0000
2124@@ -7,7 +7,6 @@
2125 include "nexternal.inc"
2126 include "born_nhel.inc"
2127 include "coloramps.inc"
2128- include "reweight0.inc"
2129 include "nFKSconfigs.inc"
2130 include "leshouche_decl.inc"
2131 include "run.inc"
2132
2133=== modified file 'Template/NLO/SubProcesses/analysis_lhe.f'
2134--- Template/NLO/SubProcesses/analysis_lhe.f 2017-02-14 15:57:59 +0000
2135+++ Template/NLO/SubProcesses/analysis_lhe.f 2017-08-16 21:26:30 +0000
2136@@ -30,29 +30,30 @@
2137 integer npoints
2138 double precision cross_section
2139 common /for_FixedOrder_lhe/ cross_section,npoints
2140+ character*10 MonteCarlo
2141 inquire(41,OPENED=lopen) ! safety
2142 if (lopen) then
2143 backspace(41) ! overwrite the final </eventgroup> tag
2144 write (41,*) nevents,sum_of_wgts,cross_section
2145 close(41)
2146 open(41, file='header.txt')
2147- call write_lhef_header(41, 0, 'FO')
2148+ MonteCarlo='FO'
2149+ call write_lhef_header(41, 0, MonteCarlo)
2150 close(41)
2151 endif
2152 end
2153
2154 subroutine analysis_fill(p,istatus,ipdg,wgts,ibody)
2155+ use extra_weights
2156 implicit none
2157 include 'nexternal.inc'
2158- include 'reweight.inc'
2159 include 'run.inc'
2160- integer nwgt,max_weight
2161- parameter (max_weight=maxscales*maxscales+maxpdfs+1)
2162+ integer nwgt
2163 c include 'genps.inc'
2164 integer istatus(nexternal)
2165 integer iPDG(nexternal)
2166 double precision p(0:4,nexternal)
2167- double precision wgts(max_weight)
2168+ double precision wgts(*)
2169 integer ibody
2170 integer nwgts,nevents
2171 double precision sum_of_wgts
2172
2173=== removed file 'Template/NLO/SubProcesses/c_weight.inc'
2174--- Template/NLO/SubProcesses/c_weight.inc 2016-03-21 08:45:42 +0000
2175+++ Template/NLO/SubProcesses/c_weight.inc 1970-01-01 00:00:00 +0000
2176@@ -1,24 +0,0 @@
2177-* -*-fortran-*-
2178-
2179- integer max_contr,max_wgt,max_iproc
2180- parameter (max_contr=128,max_wgt=1024,max_iproc=100)
2181- logical H_event(max_contr)
2182- integer nFKS(max_contr),itype(max_contr),QCDpower(max_contr)
2183- $ ,pdg(nexternal,0:max_contr),pdg_uborn(nexternal,0:max_contr)
2184- $ ,parton_pdg_uborn(nexternal,max_iproc,max_contr)
2185- $ ,parton_pdg(nexternal,max_iproc,max_contr),icontr,iwgt
2186- $ ,plot_id(max_contr),niproc(max_contr),parton_pdf(nexternal
2187- $ ,max_iproc,max_contr),icontr_sum(0:max_iproc,max_contr)
2188- $ ,icontr_picked,iproc_picked
2189- double precision momenta(0:3,nexternal,max_contr),momenta_m(0:3
2190- $ ,nexternal,2,max_contr),wgt(3,max_contr),wgt_ME_tree(2
2191- $ ,max_contr),bjx(2,max_contr),scales2(3,max_contr)
2192- $ ,g_strong(max_contr),wgts(max_wgt,max_contr)
2193- $ ,parton_iproc(max_iproc,max_contr),y_bst(max_contr)
2194- $ ,plot_wgts(max_wgt,max_contr),shower_scale(max_contr)
2195- $ ,unwgt(max_iproc,max_contr)
2196- common /c_weights/momenta,momenta_m,wgt,wgt_ME_tree,wgts,plot_wgts
2197- $ ,parton_iproc,bjx,scales2,g_strong,y_bst,shower_scale,unwgt
2198- $ ,parton_pdg,nFKS,itype,QCDpower,pdg,pdg_uborn
2199- $ ,parton_pdg_uborn,plot_id,niproc,icontr,iwgt,icontr_sum
2200- $ ,icontr_picked,iproc_picked,H_event
2201
2202=== modified file 'Template/NLO/SubProcesses/check_poles.f'
2203--- Template/NLO/SubProcesses/check_poles.f 2017-04-13 09:51:06 +0000
2204+++ Template/NLO/SubProcesses/check_poles.f 2017-08-16 21:26:30 +0000
2205@@ -183,6 +183,7 @@
2206 enddo
2207 enddo
2208
2209+ CALL UPDATE_AS_PARAM()
2210 call sborn(p_born, born)
2211 call sloopmatrix_thres(p_born,virt_wgts,tolerance,
2212 1 accuracies,return_code)
2213
2214=== modified file 'Template/NLO/SubProcesses/collect_events.f'
2215--- Template/NLO/SubProcesses/collect_events.f 2016-02-24 12:45:15 +0000
2216+++ Template/NLO/SubProcesses/collect_events.f 2017-08-16 21:26:30 +0000
2217@@ -1,6 +1,6 @@
2218 program collect_events
2219 implicit none
2220- character*120 string120,eventfile
2221+ character*512 string512,eventfile
2222 character*19 basicfile,nextbasicfile
2223 character*15 outputfile
2224 integer istep,i,numoffiles,nbunches,nevents,ievents,junit(80)
2225@@ -65,9 +65,9 @@
2226 nevents=0
2227 xtotal=0.d0
2228 do while (.true.)
2229- read(10,'(120a)',err=2,end=2) string120
2230- eventfile=string120(2:index(string120,' '))
2231- read(string120(index(string120,' '):120),*)
2232+ read(10,'(512a)',err=2,end=2) string512
2233+ eventfile=string512(2:index(string512,' '))
2234+ read(string512(index(string512,' '):512),*)
2235 $ ievents,absxsec,xsecfrac
2236 if (ievents.eq.0) cycle
2237 nevents=nevents+ievents
2238@@ -209,8 +209,9 @@
2239 end
2240
2241
2242- subroutine collect_all_evfiles(ioutput,numoffiles,junit,
2243- # imaxevt,evwgt)
2244+ subroutine collect_all_evfiles(ioutput,numoffiles,junit,imaxevt
2245+ $ ,evwgt)
2246+ use extra_weights
2247 implicit none
2248 integer i_orig
2249 common /c_i_orig/i_orig
2250@@ -237,8 +238,6 @@
2251 data iseed/1/
2252 double precision rnd,fk88random
2253 external fk88random
2254- logical debug
2255- parameter (debug=.false.)
2256 integer nevents_file(80),proc_id(80)
2257 common /to_nevents_file/nevents_file,proc_id
2258 double precision xsecfrac_all(80)
2259@@ -249,18 +248,12 @@
2260 double precision xsecup_l(100),xerrup_l(100)
2261 integer lprup_l(100),nproc_l
2262 logical found_proc
2263- include 'reweight_all.inc'
2264 include 'run.inc'
2265 integer proc_id_tot(0:100)
2266 double precision xsec(100),xsecABS,xerr(100)
2267 logical get_xsec_from_res1
2268 common/total_xsec/xsec,xerr,xsecABS,proc_id_tot,get_xsec_from_res1
2269 c
2270- if(debug) then
2271- write (*,*) ioutput,numoffiles,(junit(ii),ii=1,numoffiles)
2272- write(ioutput,*)'test test test'
2273- return
2274- endif
2275 maxevt=0
2276 if (.not. get_xsec_from_res1) then
2277 do i=1,100
2278
2279=== modified file 'Template/NLO/SubProcesses/combine_root.C'
2280--- Template/NLO/SubProcesses/combine_root.C 2013-12-02 16:53:51 +0000
2281+++ Template/NLO/SubProcesses/combine_root.C 2017-08-16 21:26:30 +0000
2282@@ -44,11 +44,13 @@
2283 //can be easily lifted
2284 int maxfiles=1000;
2285
2286+ int numoffiles;
2287+ string filenames[maxfiles];
2288+ string currentdir;
2289+
2290 if(fileoffiles.is_open())
2291 {
2292- string filenames[maxfiles];
2293
2294- int numoffiles;
2295 fileoffiles >> numoffiles;
2296
2297 if(numoffiles>maxfiles){
2298@@ -56,7 +58,6 @@
2299 return;
2300 }
2301
2302- string currentdir;
2303 fileoffiles >> currentdir;
2304
2305 for(int i = 0; i < numoffiles; ++i)
2306@@ -122,8 +123,8 @@
2307 int llength = HistoContents.size();
2308 if(myverbose)cout << "Total number of histograms: " << llength << endl;
2309
2310+ int llength0 = llength;
2311 if(i==0){
2312- int llength0 = llength;
2313 for(int j = 0; j < llength; j++){
2314 TString histname = HistoContents[j]->GetName();
2315 if(myverbose){
2316
2317=== modified file 'Template/NLO/SubProcesses/cuts.f'
2318--- Template/NLO/SubProcesses/cuts.f 2017-05-09 12:37:07 +0000
2319+++ Template/NLO/SubProcesses/cuts.f 2017-08-16 21:26:30 +0000
2320@@ -898,32 +898,47 @@
2321 end
2322
2323
2324- subroutine unweight_function(p_born,unwgtfun)
2325-c This is a user-defined function to which to unweight the events
2326-c A non-flat distribution will generate events with a certain
2327-c weight. This is particularly useful to generate more events
2328-c (with smaller weight) in tails of distributions.
2329-c It computes the unwgt factor from the momenta and multiplies
2330-c the weight that goes into MINT (or vegas) with this factor.
2331-c Before writing out the events (or making the plots), this factor
2332-c is again divided out.
2333-c This function should be called with the Born momenta to be sure
2334-c that it stays the same for the events, counter-events, etc.
2335-c A value different from 1 makes that MINT (or vegas) does not list
2336-c the correct cross section.
2337+ subroutine bias_weight_function(p,ipdg,bias_wgt)
2338+c This is a user-defined function to which to bias the event generation.
2339+c A non-flat distribution will generate events with a certain weight
2340+c inversely proportinal to the bias_wgt. This is particularly useful to
2341+c generate more events (with smaller weight) in tails of distributions.
2342+c It computes the bias_wgt factor from the momenta and multiplies the
2343+c weight that goes into MINT (or vegas) with this factor. Before
2344+c writing out the events (or making the plots), this factor is again
2345+c divided out. A value different from 1 makes that MINT (or vegas) does
2346+c not list the correct cross section, but the cross section can still be
2347+c computed from summing all the weights of the events (and dividing by
2348+c the number of events). Since the weights of the events are no longer
2349+c identical for all events, the statistical uncertainty on this total
2350+c cross section can be much larger than without including the bias.
2351+c
2352+c The 'bias_wgt' should be a IR-safe function of the momenta.
2353+c
2354+c For this to be used, the 'event_norm' option in the run_card should be
2355+c set to
2356+c 'bias' = event_norm
2357+c
2358 implicit none
2359 include 'nexternal.inc'
2360- double precision unwgtfun,p_born(0:3,nexternal-1),shat,sumdot
2361- external sumdot
2362-
2363- unwgtfun=1d0
2364-
2365-c How to enhance the tails is very process dependent. But, it is
2366-c probably easiest to enhance the tails using shat, e.g.:
2367-c shat=sumdot(p_born(0,1),p_born(0,2),1d0)
2368-c unwgtfun=max(100d0**2,shat)/100d0**2
2369-c unwgtfun=unwgtfun**2
2370-
2371+ double precision bias_wgt,p(0:3,nexternal),H_T
2372+ integer ipdg(nexternal),i
2373+
2374+ bias_wgt=1d0
2375+
2376+c How to enhance the tails is very process dependent. For example for
2377+c top quark production one could use:
2378+c do i=1,nexternal
2379+c if (ipdg(i).eq.6) then
2380+c bias_wgt=sqrt(p(1,i)**2+p(2,i)**2)**3
2381+c endif
2382+c enddo
2383+c Or to use H_T^2 one does
2384+c H_T=0d0
2385+c do i=3,nexternal
2386+c H_T=H_T+sqrt(max(0d0,(p(0,i)+p(3,i))*(p(0,i)-p(3,i))))
2387+c enddo
2388+c bias_wgt=H_T**2
2389 return
2390 end
2391
2392
2393=== modified file 'Template/NLO/SubProcesses/driver_mintFO.f'
2394--- Template/NLO/SubProcesses/driver_mintFO.f 2017-05-09 11:54:11 +0000
2395+++ Template/NLO/SubProcesses/driver_mintFO.f 2017-08-16 21:26:30 +0000
2396@@ -2,6 +2,7 @@
2397 c**************************************************************************
2398 c This is the driver for the whole calculation
2399 c**************************************************************************
2400+ use extra_weights
2401 implicit none
2402 C
2403 C CONSTANTS
2404@@ -10,14 +11,13 @@
2405 parameter (ZERO = 0d0)
2406 include 'nexternal.inc'
2407 include 'genps.inc'
2408- include 'reweight.inc'
2409 INTEGER ITMAX, NCALL
2410
2411 common/citmax/itmax,ncall
2412 C
2413 C LOCAL
2414 C
2415- integer i,j,l,l1,l2,ndim
2416+ integer i,j,l,l1,l2
2417 character*130 buf
2418 c
2419 c Global
2420@@ -26,7 +26,8 @@
2421 include 'run.inc'
2422 include 'coupl.inc'
2423
2424-c Vegas stuff
2425+c Vegas stuff
2426+ integer ndim
2427 common/tosigint/ndim
2428
2429 real*8 sigint
2430@@ -175,6 +176,8 @@
2431 if(imode.eq.0)then
2432 c Don't safe the reweight information when just setting up the grids.
2433 doreweight=.false.
2434+ do_rwgt_scale=.false.
2435+ do_rwgt_pdf=.false.
2436 do kchan=1,nchans
2437 do i=1,ndimmax
2438 do j=0,nintervals
2439@@ -210,10 +213,10 @@
2440 endif
2441 c
2442 c Setup for parton-level NLO reweighting
2443- if(do_rwgt_scale.or.do_rwgt_pdf) call setup_fill_rwgt_NLOplot()
2444 call mint(sigint,ndim,ncall,itmax,imode,xgrid,ymax
2445 $ ,ymax_virt,ans,unc,chi2,nhits_in_grids)
2446 call topout
2447+ call deallocate_weight_lines
2448 write(*,*)'Final result [ABS]:',ans(1,0),' +/-',unc(1,0)
2449 write(*,*)'Final result:',ans(2,0),' +/-',unc(2,0)
2450 write(*,*)'chi**2 per D.o.F.:',chi2(1,0)
2451@@ -320,10 +323,6 @@
2452 c timing statistics
2453 include "timing_variables.inc"
2454 data tOLP/0.0/
2455- data tFastJet/0.0/
2456- data tPDF/0.0/
2457- data tDSigI/0.0/
2458- data tDSigR/0.0/
2459 data tGenPS/0.0/
2460 data tBorn/0.0/
2461 data tIS/0.0/
2462@@ -345,12 +344,12 @@
2463
2464
2465 double precision function sigint(xx,vegas_wgt,ifl,f)
2466+ use weight_lines
2467+ use extra_weights
2468 implicit none
2469 include 'nexternal.inc'
2470 include 'mint.inc'
2471 include 'nFKSconfigs.inc'
2472- include 'c_weight.inc'
2473- include 'reweight.inc'
2474 include 'run.inc'
2475 double precision xx(ndimmax),vegas_wgt,f(nintegrals),jac,p(0:3
2476 $ ,nexternal),rwgt,vol,sig,x(99),MC_int_wgt
2477@@ -505,6 +504,7 @@
2478
2479 subroutine update_fks_dir(nFKS)
2480 implicit none
2481+ include 'run.inc'
2482 integer nFKS
2483 integer nFKSprocess
2484 common/c_nFKSprocess/nFKSprocess
2485@@ -513,6 +513,7 @@
2486 call leshouche_inc_chooser()
2487 call setcuts
2488 call setfksfactor(.false.)
2489+ if (ickkw.eq.3) call configs_and_props_inc_chooser()
2490 return
2491 end
2492
2493
2494=== modified file 'Template/NLO/SubProcesses/driver_mintMC.f'
2495--- Template/NLO/SubProcesses/driver_mintMC.f 2017-05-09 12:41:29 +0000
2496+++ Template/NLO/SubProcesses/driver_mintMC.f 2017-08-16 21:26:30 +0000
2497@@ -2,6 +2,7 @@
2498 c**************************************************************************
2499 c This is the driver for the whole calculation
2500 c**************************************************************************
2501+ use extra_weights
2502 implicit none
2503 C
2504 C CONSTANTS
2505@@ -10,7 +11,6 @@
2506 parameter (ZERO = 0d0)
2507 include 'nexternal.inc'
2508 include 'genps.inc'
2509- include 'reweight.inc'
2510 INTEGER ITMAX, NCALL
2511
2512 common/citmax/itmax,ncall
2513@@ -50,7 +50,9 @@
2514 double precision average_virtual(maxchannels),virtual_fraction(maxchannels)
2515 common/c_avg_virt/average_virtual,virtual_fraction
2516
2517- double precision weight
2518+ double precision weight,event_weight,inv_bias
2519+ character*7 event_norm
2520+ common /event_normalisation/event_norm
2521 c For MINT:
2522 real* 8 xgrid(0:nintervals,ndimmax,maxchannels),ymax(nintervals
2523 $ ,ndimmax,maxchannels),ymax_virt(maxchannels),ans(nintegrals
2524@@ -142,6 +144,8 @@
2525 doreweight=do_rwgt_scale.or.do_rwgt_pdf
2526 else
2527 doreweight=.false.
2528+ do_rwgt_scale=.false.
2529+ do_rwgt_pdf=.false.
2530 endif
2531 if (abrv(1:4).eq.'virt') then
2532 only_virt=.true.
2533@@ -201,6 +205,7 @@
2534 write (*,*) 'imode is ',imode
2535 call mint(sigintF,ndim,ncall,itmax,imode,xgrid,ymax,ymax_virt
2536 $ ,ans,unc,chi2,nhits_in_grids)
2537+ call deallocate_weight_lines
2538 open(unit=58,file='res_0',status='unknown')
2539 write(58,*)'Final result [ABS]:',ans(1,1),' +/-',unc(1,1)
2540 write(58,*)'Final result:',ans(2,1),' +/-',unc(2,1)
2541@@ -257,6 +262,7 @@
2542 write (*,*) 'imode is ',imode
2543 call mint(sigintF,ndim,ncall,itmax,imode,xgrid,ymax,ymax_virt
2544 $ ,ans,unc,chi2,nhits_in_grids)
2545+ call deallocate_weight_lines
2546
2547 c If integrating the virtuals alone, we include the virtuals in
2548 c ans(1). Therefore, no need to have them in ans(5) and we have to set
2549@@ -307,7 +313,11 @@
2550 if (ickkw.eq.-1) putonshell=.false.
2551 unwgt=.true.
2552 open (unit=99,file='nevts',status='old',err=999)
2553- read (99,*) nevts
2554+ if (event_norm(1:4).ne.'bias') then
2555+ read (99,*) nevts
2556+ else
2557+ read (99,*) nevts,event_weight
2558+ endif
2559 close(99)
2560 write(*,*) 'Generating ', nevts, ' events'
2561 if(nevts.eq.0) then
2562@@ -350,7 +360,11 @@
2563 absint=ans(1,1)+ans(5,1)
2564 uncer=unc(2,1)
2565
2566- weight=(ans(1,1)+ans(5,1))/ncall
2567+ if (event_norm(1:4).ne.'bias') then
2568+ weight=(ans(1,1)+ans(5,1))/ncall
2569+ else
2570+ weight=event_weight
2571+ endif
2572
2573 if (abrv(1:3).ne.'all' .and. abrv(1:4).ne.'born' .and.
2574 $ abrv(1:4).ne.'virt') then
2575@@ -385,8 +399,13 @@
2576 call pick_unweight_contr(iFKS_picked)
2577 call update_fks_dir(iFKS_picked)
2578 call fill_rwgt_lines
2579+ if (event_norm(1:4).eq.'bias') then
2580+ call include_inverse_bias_wgt(inv_bias)
2581+ weight=event_weight*inv_bias
2582+ endif
2583 call finalize_event(x,weight,lunlhe,putonshell)
2584 enddo
2585+ call deallocate_weight_lines
2586 vn=-1
2587 call gen(sigintF,ndim,xgrid,ymax,ymax_virt,3,x,vn)
2588 write (*,*) 'Generation efficiencies:',x(1),x(4)
2589@@ -482,10 +501,6 @@
2590 c timing statistics
2591 include "timing_variables.inc"
2592 data tOLP/0.0/
2593- data tFastJet/0.0/
2594- data tPDF/0.0/
2595- data tDSigI/0.0/
2596- data tDSigR/0.0/
2597 data tGenPS/0.0/
2598 data tBorn/0.0/
2599 data tIS/0.0/
2600@@ -719,14 +734,7 @@
2601 c
2602 c Here I want to set up with B.W. we map and which we don't
2603 c
2604- dconfig = dconfig-iconfig
2605- if (dconfig .eq. 0) then
2606- write(*,*) 'Not subdividing B.W.'
2607- lbw(0)=0
2608- else
2609- write(*,*) 'Error BW setting: not supported at NLO'
2610- stop 1
2611- endif
2612+ lbw(0)=0
2613 10 format( a)
2614 12 format( a,i4)
2615 end
2616@@ -739,12 +747,11 @@
2617
2618
2619 function sigintF(xx,vegas_wgt,ifl,f)
2620-c From dsample_fks
2621+ use weight_lines
2622 implicit none
2623 include 'mint.inc'
2624 include 'nexternal.inc'
2625 include 'nFKSconfigs.inc'
2626- include 'c_weight.inc'
2627 include 'run.inc'
2628 logical firsttime,passcuts,passcuts_nbody,passcuts_n1body
2629 integer i,ifl,proc_map(0:fks_configs,0:fks_configs)
2630@@ -952,9 +959,11 @@
2631 call include_shape_in_shower_scale(p,iFKS)
2632 enddo
2633 12 continue
2634-
2635+
2636 c Include PDFs and alpha_S and reweight to include the uncertainties
2637 call include_PDF_and_alphas
2638+c Include the weight from the bias_function
2639+ call include_bias_wgt
2640 c Sum the contributions that can be summed before taking the ABS value
2641 call sum_identical_contributions
2642 c Update the shower starting scale for the S-events after we have
2643@@ -979,7 +988,6 @@
2644 include 'nexternal.inc'
2645 include 'run.inc'
2646 include 'genps.inc'
2647- include 'reweight_all.inc'
2648 include 'nFKSconfigs.inc'
2649 double precision lum,dlum
2650 external dlum
2651@@ -1003,19 +1011,12 @@
2652 write (*,*)'Using ickkw=4, include only 1 FKS dir per'/
2653 $ /' Born PS point (sum=0)'
2654 endif
2655- maxproc_save=0
2656 do nFKSprocess=1,fks_configs
2657 call fks_inc_chooser()
2658 c Set Bjorken x's to some random value before calling the dlum() function
2659 xbk(1)=0.5d0
2660 xbk(2)=0.5d0
2661 lum=dlum() ! updates IPROC
2662- maxproc_save=max(maxproc_save,IPROC)
2663- if (doreweight) then
2664- call reweight_settozero()
2665- call reweight_settozero_all(nFKSprocess*2,.true.)
2666- call reweight_settozero_all(nFKSprocess*2-1,.true.)
2667- endif
2668 enddo
2669 write (*,*) 'Total number of FKS directories is', fks_configs
2670 c For sum over identical FKS pairs, need to find the identical structures
2671@@ -1207,6 +1208,7 @@
2672
2673 subroutine update_fks_dir(nFKS)
2674 implicit none
2675+ include 'run.inc'
2676 integer nFKS
2677 integer nFKSprocess
2678 common/c_nFKSprocess/nFKSprocess
2679@@ -1215,6 +1217,7 @@
2680 call leshouche_inc_chooser()
2681 call setcuts
2682 call setfksfactor(.true.)
2683+ if (ickkw.eq.3) call configs_and_props_inc_chooser()
2684 return
2685 end
2686
2687
2688=== modified file 'Template/NLO/SubProcesses/fks_singular.f'
2689--- Template/NLO/SubProcesses/fks_singular.f 2017-05-09 13:42:19 +0000
2690+++ Template/NLO/SubProcesses/fks_singular.f 2017-08-16 21:26:30 +0000
2691@@ -1,9 +1,9 @@
2692 subroutine compute_born
2693 c This subroutine computes the Born matrix elements and adds its value
2694 c to the list of weights using the add_wgt subroutine
2695+ use extra_weights
2696 implicit none
2697 include 'nexternal.inc'
2698- include 'reweight0.inc'
2699 include 'coupl.inc'
2700 include 'timing_variables.inc'
2701 double complex wgt_c(2)
2702@@ -31,9 +31,9 @@
2703 subroutine compute_nbody_noborn
2704 c This subroutine computes the soft-virtual matrix elements and adds its
2705 c value to the list of weights using the add_wgt subroutine
2706+ use extra_weights
2707 implicit none
2708 include 'nexternal.inc'
2709- include 'reweight.inc'
2710 include 'coupl.inc'
2711 include 'run.inc'
2712 include 'timing_variables.inc'
2713@@ -94,10 +94,10 @@
2714 subroutine compute_real_emission(p,sudakov_damp)
2715 c This subroutine computes the real-emission matrix elements and adds
2716 c its value to the list of weights using the add_wgt subroutine
2717+ use extra_weights
2718 implicit none
2719 include 'nexternal.inc'
2720 include 'coupl.inc'
2721- include 'reweight0.inc'
2722 include 'timing_variables.inc'
2723 double precision x,dot,f_damp,ffact,s_ev,fks_Sij,p(0:3,nexternal)
2724 $ ,wgt1,fx_ev,sudakov_damp
2725@@ -134,10 +134,10 @@
2726 subroutine compute_soft_counter_term(replace_MC_subt)
2727 c This subroutine computes the soft counter term and adds its value to
2728 c the list of weights using the add_wgt subroutine
2729+ use extra_weights
2730 implicit none
2731 include 'nexternal.inc'
2732 include 'coupl.inc'
2733- include 'reweight0.inc'
2734 include 'timing_variables.inc'
2735 double precision wgt1,s_s,fks_Sij,fx_s,zero,replace_MC_subt,g22
2736 parameter (zero=0d0)
2737@@ -185,11 +185,11 @@
2738 subroutine compute_collinear_counter_term(replace_MC_subt)
2739 c This subroutine computes the collinear counter term and adds its value
2740 c to the list of weights using the add_wgt subroutine
2741+ use extra_weights
2742 implicit none
2743 include 'nexternal.inc'
2744 include 'coupl.inc'
2745 include 'fks_powers.inc'
2746- include 'reweight.inc'
2747 include 'timing_variables.inc'
2748 double precision zero,one,s_c,fks_Sij,fx_c,deg_xi_c,deg_lxi_c,wgt1
2749 & ,wgt3,g22,replace_MC_subt
2750@@ -248,10 +248,10 @@
2751 subroutine compute_soft_collinear_counter_term(replace_MC_subt)
2752 c This subroutine computes the soft-collinear counter term and adds its
2753 c value to the list of weights using the add_wgt subroutine
2754+ use extra_weights
2755 implicit none
2756 include 'nexternal.inc'
2757 include 'coupl.inc'
2758- include 'reweight.inc'
2759 include 'fks_powers.inc'
2760 include 'timing_variables.inc'
2761 double precision zero,one,s_sc,fks_Sij,fx_sc,wgt1,wgt3,deg_xi_sc
2762@@ -314,6 +314,7 @@
2763 end
2764
2765 subroutine compute_MC_subt_term(p,gfactsf,gfactcl,probne)
2766+ use extra_weights
2767 implicit none
2768 c This subroutine computes the MonteCarlo subtraction terms and adds
2769 c their values to the list of weights using the add_wgt subroutine. It
2770@@ -324,7 +325,6 @@
2771 include 'nexternal.inc'
2772 include 'madfks_mcatnlo.inc'
2773 include 'timing_variables.inc'
2774- include 'reweight.inc'
2775 include 'coupl.inc'
2776 integer nofpartners,i
2777 double precision p(0:3,nexternal),gfactsf,gfactcl,probne,x,dot
2778@@ -613,13 +613,13 @@
2779 c Compute all the relevant prefactors for the Born and the soft-virtual,
2780 c i.e. all the nbody contributions. Also initialises the plots and
2781 c bpower.
2782+ use extra_weights
2783 implicit none
2784 include 'nexternal.inc'
2785 include 'run.inc'
2786 include 'genps.inc'
2787- include 'reweight0.inc'
2788 include 'timing_variables.inc'
2789- double precision pi,unwgtfun,vegas_wgt,enhance,xnoborn_cnt,xtot
2790+ double precision pi,vegas_wgt,enhance,xnoborn_cnt,xtot
2791 $ ,bpower,cpower,tiny
2792 data xnoborn_cnt /0d0/
2793 integer inoborn_cnt,i
2794@@ -694,7 +694,7 @@
2795 if(wgtcpower.ne.cpowerinput.and.dabs(cpower+1d0).gt.tiny)then
2796 write(*,*)'Inconsistency in the computation of cpower',
2797 # wgtcpower,cpowerinput
2798- write(*,*)'Check value in reweight0.inc'
2799+ write(*,*)'Check value in extra_weights.f'
2800 stop
2801 endif
2802 firsttime=.false.
2803@@ -732,11 +732,10 @@
2804 enhance=0d0
2805 endif
2806 endif
2807- call unweight_function(p_born,unwgtfun)
2808 call set_cms_stuff(0)
2809 c f_* multiplication factors for Born and nbody
2810 f_b=jac_cnt(0)*xinorm_ev/(min(xiimax_ev,xiBSVcut_used)*shat/(16
2811- $ *pi**2))*enhance*unwgtfun *fkssymmetryfactorBorn*vegas_wgt
2812+ $ *pi**2))*enhance*fkssymmetryfactorBorn*vegas_wgt
2813 f_nb=f_b
2814 call cpu_time(tAfter)
2815 tf_nb=tf_nb+(tAfter-tBefore)
2816@@ -753,7 +752,7 @@
2817 include 'fks_powers.inc'
2818 include 'coupl.inc'
2819 include 'timing_variables.inc'
2820- double precision unwgtfun,vegas_wgt,enhance,xnoborn_cnt,xtot
2821+ double precision vegas_wgt,enhance,xnoborn_cnt,xtot
2822 & ,prefact,prefact_cnt_ssc,prefact_deg,prefact_c,prefact_coll
2823 & ,jac_ev,pi,prefact_cnt_ssc_c,prefact_coll_c,prefact_deg_slxi
2824 & ,prefact_deg_sxi,zero
2825@@ -845,11 +844,10 @@
2826 enhance=0d0
2827 endif
2828 endif
2829- call unweight_function(p_born,unwgtfun)
2830 prefact=xinorm_ev/xi_i_fks_ev/(1-y_ij_fks_ev)
2831
2832 c f_* multiplication factors for real-emission, soft counter, ... etc.
2833- f_r=prefact*jac_ev*enhance*unwgtfun*fkssymmetryfactor*vegas_wgt
2834+ f_r=prefact*jac_ev*enhance*fkssymmetryfactor*vegas_wgt
2835 f_MC_S=f_r
2836 f_MC_H=f_r
2837 if (.not.nocntevents) then
2838@@ -857,9 +855,9 @@
2839 & log(xicut_used/min(xiimax_ev,xiScut_used))/(1
2840 & -y_ij_fks_ev)
2841 f_s=(prefact+prefact_cnt_ssc)*jac_cnt(0)*enhance
2842- $ *unwgtfun*fkssymmetryfactor*vegas_wgt
2843+ $ *fkssymmetryfactor*vegas_wgt
2844 f_s_MC_S=prefact*jac_cnt(0)*enhance
2845- $ *unwgtfun*fkssymmetryfactor*vegas_wgt
2846+ $ *fkssymmetryfactor*vegas_wgt
2847 f_s_MC_H=f_s_MC_S
2848
2849 if (pmass(j_fks).eq.0d0) then
2850@@ -867,9 +865,9 @@
2851 prefact_coll=xinorm_cnt(1)/xi_i_fks_cnt(1)*log(delta_used
2852 $ /deltaS)/deltaS
2853 f_c=(prefact_c+prefact_coll)*jac_cnt(1)
2854- $ *enhance*unwgtfun*fkssymmetryfactor*vegas_wgt
2855+ $ *enhance*fkssymmetryfactor*vegas_wgt
2856 f_c_MC_S=prefact_c*jac_cnt(1)
2857- $ *enhance*unwgtfun*fkssymmetryfactor*vegas_wgt
2858+ $ *enhance*fkssymmetryfactor*vegas_wgt
2859 f_c_MC_H=f_c_MC_S
2860
2861 call set_cms_stuff(1)
2862@@ -881,12 +879,12 @@
2863 $ *log(xicut_used/min(xiimax_cnt(1),xiScut_used))
2864 $ *log(delta_used/deltaS)/deltaS
2865 f_dc=jac_cnt(1)*prefact_deg/(shat/(32*pi**2))*enhance
2866- $ *unwgtfun*fkssymmetryfactorDeg*vegas_wgt
2867+ $ *fkssymmetryfactorDeg*vegas_wgt
2868 f_sc=(prefact_c+prefact_coll+prefact_cnt_ssc_c
2869- & +prefact_coll_c)*jac_cnt(2)*enhance*unwgtfun
2870+ & +prefact_coll_c)*jac_cnt(2)*enhance
2871 & *fkssymmetryfactorDeg*vegas_wgt
2872 f_sc_MC_S=prefact_c*jac_cnt(2)
2873- $ *enhance*unwgtfun*fkssymmetryfactor*vegas_wgt
2874+ $ *enhance*fkssymmetryfactor*vegas_wgt
2875 f_sc_MC_H=f_sc_MC_S
2876
2877 call set_cms_stuff(2)
2878@@ -898,13 +896,13 @@
2879 & -log(min(xiimax_cnt(1),xiScut_used))**2 )*1/(2.d0
2880 & *deltaS)
2881 f_dsc(1)=prefact_deg*jac_cnt(2)/(shat/(32*pi**2))*enhance
2882- & *unwgtfun*fkssymmetryfactorDeg*vegas_wgt
2883+ & *fkssymmetryfactorDeg*vegas_wgt
2884 f_dsc(2)=prefact_deg_sxi*jac_cnt(2)/(shat/(32*pi**2))
2885- & *enhance*unwgtfun*fkssymmetryfactorDeg*vegas_wgt
2886+ & *enhance*fkssymmetryfactorDeg*vegas_wgt
2887 f_dsc(3)=prefact_deg_slxi*jac_cnt(2)/(shat/(32*pi**2))
2888- & *enhance*unwgtfun*fkssymmetryfactorDeg*vegas_wgt
2889+ & *enhance*fkssymmetryfactorDeg*vegas_wgt
2890 f_dsc(4)=( prefact_deg+prefact_deg_sxi )*jac_cnt(2)/(shat
2891- & /(32*pi**2))*enhance*unwgtfun*fkssymmetryfactorDeg
2892+ & /(32*pi**2))*enhance*fkssymmetryfactorDeg
2893 & *vegas_wgt
2894 else
2895 f_c=0d0
2896@@ -940,7 +938,7 @@
2897
2898
2899 subroutine add_wgt(type,wgt1,wgt2,wgt3)
2900-c Adds a contribution to the list in c_weight.inc. 'type' sets the type
2901+c Adds a contribution to the list in weight_lines. 'type' sets the type
2902 c of the contribution and wgt1..wgt3 are the coefficients multiplying
2903 c the logs. The arguments are:
2904 c type=1 : real-emission
2905@@ -997,7 +995,7 @@
2906 c corresponding to this contribution: wgt_ME_tree. This weight does
2907 c include the 'ngluon' correction factor for the Born.
2908 c
2909-c Not set in this subroutine, but included in the c_weights common block
2910+c Not set in this subroutine, but included in the weight_lines module
2911 c are the
2912 c wgts(iwgt,icontr) : weights including scale/PDFs/logs. These are
2913 c normalised so that they can be used directly to compute cross
2914@@ -1016,16 +1014,16 @@
2915 c parton_iproc(iproc,icontr) : value of the PDF for the iproc
2916 c contribution
2917 c parton_pdg(nexternal,iproc,icontr) : value of the PDG codes for
2918-c the iproc contribution
2919+c the iproc contribution
2920+ use weight_lines
2921+ use extra_weights
2922 implicit none
2923 include 'nexternal.inc'
2924 include 'run.inc'
2925 include 'genps.inc'
2926 include 'coupl.inc'
2927 include 'fks_info.inc'
2928- include 'c_weight.inc'
2929 include 'q_es.inc'
2930- include 'reweight0.inc'
2931 integer type,i,j
2932 double precision wgt1,wgt2,wgt3
2933 integer nFKSprocess
2934@@ -1054,11 +1052,7 @@
2935 if (wgt2.ne.wgt2) return
2936 if (wgt3.ne.wgt3) return
2937 icontr=icontr+1
2938- if (icontr.gt.max_contr) then
2939- write (*,*) 'ERROR in add_wgt: too many contributions'
2940- & ,max_contr
2941- stop 1
2942- endif
2943+ call weight_lines_allocated(nexternal,icontr,max_wgt,max_iproc)
2944 itype(icontr)=type
2945 wgt(1,icontr)=wgt1
2946 wgt(2,icontr)=wgt2
2947@@ -1133,12 +1127,12 @@
2948 end
2949
2950 subroutine include_veto_multiplier
2951+ use weight_lines
2952+ use extra_weights
2953 implicit none
2954 c Multiply all the weights by the NNLL-NLO jet veto Sudakov factors,
2955 c i.e., the term on the 2nd line of Eq.(20) of arXiv:1412.8408.
2956 include 'nexternal.inc'
2957- include 'c_weight.inc'
2958- include 'reweight.inc'
2959 integer i,j
2960 if (H1_factor_virt.ne.0d0) then
2961 call compute_veto_multiplier(H1_factor_virt,1d0,1d0
2962@@ -1158,10 +1152,10 @@
2963 c dependence and saves the weights in the wgts() array. The weights in
2964 c this array are now correctly normalised to compute the cross section
2965 c or to fill histograms.
2966+ use weight_lines
2967 implicit none
2968 include 'nexternal.inc'
2969 include 'run.inc'
2970- include 'c_weight.inc'
2971 include 'coupl.inc'
2972 include 'timing_variables.inc'
2973 include 'genps.inc'
2974@@ -1191,14 +1185,11 @@
2975 q2fact(2)=mu2_f
2976 c call the PDFs
2977 xlum = dlum()
2978- if (iproc.gt.max_iproc) then
2979- write (*,*) 'ERROR iproc too large',iproc,max_iproc
2980- stop 1
2981- endif
2982+ iwgt=1
2983+ call weight_lines_allocated(nexternal,max_contr,iwgt,iproc)
2984 c set_pdg_codes fills the niproc, parton_iproc, parton_pdg and parton_pdg_uborn
2985 call set_pdg_codes(iproc,pd,nFKSprocess,i)
2986 c iwgt=1 is the central value (i.e. no scale/PDF reweighting).
2987- iwgt=1
2988 wgt_wo_pdf=(wgt(1,i) + wgt(2,i)*log(mu2_r/mu2_q) + wgt(3,i)
2989 & *log(mu2_f/mu2_q))*g_strong(i)**QCDpower(i)
2990 & *rwgt_muR_dep_fac(sqrt(mu2_r),sqrt(mu2_r))
2991@@ -1221,12 +1212,123 @@
2992 return
2993 end
2994
2995+ subroutine include_bias_wgt
2996+c Include the weight from the bias_wgt_function to all the contributions
2997+c in icontr. This only changes the weight of the central value (after
2998+c inclusion of alphaS and parton luminosity). Both for 'wgts(1,icontr)'
2999+c as well as the the 'parton_iproc(1:niproc(icontr),icontr)', since
3000+c these are the ones used in MINT as well as for unweighting. Also the
3001+c 'virt_wgt_mint' and 'born_wgt_mint' are updated. Furthermore, to
3002+c include the weight also in the 'wgt' array that contain the
3003+c coefficients for PDF and scale computations.
3004+ use weight_lines
3005+ implicit none
3006+ integer i,j
3007+ double precision bias
3008+ character*7 event_norm
3009+ common /event_normalisation/event_norm
3010+ double precision virt_wgt_mint,born_wgt_mint
3011+ common /virt_born_wgt_mint/virt_wgt_mint,born_wgt_mint
3012+c Set the bias_wgt to 1 in case we do not have to do any biassing
3013+ if (event_norm(1:4).ne.'bias') then
3014+ do i=1,icontr
3015+ bias_wgt(i)=1d0
3016+ enddo
3017+ return
3018+ endif
3019+c loop over all contributions
3020+ do i=1,icontr
3021+ if (itype(i).eq.1) then
3022+ ! use (n+1)-body momenta for the real emission. Pick the
3023+ ! first IPROC for parton PDGs.
3024+ call bias_weight_function(momenta_m(0,1,2,i),parton_pdg(1,1
3025+ $ ,i),bias)
3026+ else
3027+ ! use n-body momenta for all the other contributions. Pick
3028+ ! the first IPROC for parton PDGs.
3029+ call bias_weight_function(momenta_m(0,1,1,i),parton_pdg(1,1
3030+ $ ,i),bias)
3031+ endif
3032+ bias_wgt(i)=bias
3033+c Update the weights:
3034+ wgts(1,i)=wgts(1,i)*bias_wgt(i)
3035+ do j=1,niproc(i)
3036+ parton_iproc(j,i)=parton_iproc(j,i)*bias_wgt(i)
3037+ enddo
3038+ do j=1,3
3039+ wgt(j,i)=wgt(j,i)*bias_wgt(i)
3040+ enddo
3041+ if (itype(i).eq.14) then
3042+ virt_wgt_mint=virt_wgt_mint*bias_wgt(i)
3043+ born_wgt_mint=born_wgt_mint*bias_wgt(i)
3044+ endif
3045+ enddo
3046+ return
3047+ end
3048+
3049+ subroutine include_inverse_bias_wgt(inv_bias)
3050+c Update the inverse of the bias in the event weight. All information in
3051+c the rwgt_lines is NOT updated.
3052+ use weight_lines
3053+ use extra_weights
3054+ implicit none
3055+ include 'genps.inc'
3056+ include 'nFKSconfigs.inc'
3057+ integer i,ict,ipr,ii
3058+ double precision wgt_num,wgt_denom,inv_bias
3059+ character*7 event_norm
3060+ common /event_normalisation/event_norm
3061+ integer iproc_save(fks_configs),eto(maxproc,fks_configs)
3062+ $ ,etoi(maxproc,fks_configs),maxproc_found
3063+ common/cproc_combination/iproc_save,eto,etoi,maxproc_found
3064+ logical Hevents
3065+ common/SHevents/Hevents
3066+ if (event_norm(1:4).ne.'bias') then
3067+ inv_bias=1d0
3068+ return
3069+ endif
3070+ wgt_num=0d0
3071+ wgt_denom=0d0
3072+ do i=1,icontr_sum(0,icontr_picked)
3073+ ict=icontr_sum(i,icontr_picked)
3074+ if (bias_wgt(ict).eq.0d0) then
3075+ write (*,*) "ERROR in include_inverse_bias_wgt: "/
3076+ $ /"bias_wgt is equal to zero",ict,bias_wgt
3077+ stop 1
3078+ endif
3079+c for all the rwgt_lines, remove the bias-wgt contribution from the
3080+c weights there. Note that the wgtref (also written in the event file)
3081+c keeps its contribution from the bias_wgt.
3082+ if (.not. Hevents) then
3083+ ipr=eto(etoi(iproc_picked,nFKS(ict)),nFKS(ict))
3084+ do ii=1,iproc_save(nFKS(ict))
3085+ if (eto(ii,nFKS(ict)).ne.ipr) cycle
3086+ wgt_denom=wgt_denom+parton_iproc(ii,ict)
3087+ wgt_num=wgt_num+parton_iproc(ii,ict)/bias_wgt(ict)
3088+ enddo
3089+ else
3090+ ipr=iproc_picked
3091+ wgt_denom=wgt_denom+parton_iproc(ipr,ict)
3092+ wgt_num=wgt_num+parton_iproc(ipr,ict)/bias_wgt(ict)
3093+ endif
3094+ enddo
3095+ if (abs((wgtref-wgt_denom)/(wgtref+wgt_denom)).gt.1d-10) then
3096+ write (*,*) "ERROR in include_inverse_bias_wgt: "/
3097+ $ /"reference weight not equal to recomputed weight",wgtref
3098+ $ ,wgt_denom
3099+ stop 1
3100+ endif
3101+c update the event weight to be written in the file
3102+ inv_bias=wgt_num/wgt_denom
3103+ return
3104+ end
3105+
3106
3107 subroutine set_pdg_codes(iproc,pd,iFKS,ict)
3108+ use weight_lines
3109 implicit none
3110 include 'nexternal.inc'
3111 include 'genps.inc'
3112- include 'c_weight.inc'
3113 include 'fks_info.inc'
3114 integer j,k,iproc,ict,iFKS
3115 double precision pd(0:maxproc),conv
3116@@ -1274,14 +1376,13 @@
3117
3118
3119 subroutine reweight_scale
3120-c Use the saved c_weight info to perform scale reweighting. Extends the
3121+c Use the saved weight_lines info to perform scale reweighting. Extends the
3122 c wgts() array to include the weights.
3123+ use weight_lines
3124+ use extra_weights
3125 implicit none
3126 include 'nexternal.inc'
3127 include 'run.inc'
3128- include 'c_weight.inc'
3129- include 'reweight.inc'
3130- include 'reweightNLO.inc'
3131 include 'timing_variables.inc'
3132 integer i,kr,kf,iwgt_save,dd
3133 double precision xlum(maxscales),dlum,pi,mu2_r(maxscales),c_mu2_r
3134@@ -1298,7 +1399,7 @@
3135 if (icontr.eq.0) return
3136 c currently we have 'iwgt' weights in the wgts() array.
3137 iwgt_save=iwgt
3138-c loop over all the contributions in the c_weights common block
3139+c loop over all the contributions in the weight lines module
3140 do i=1,icontr
3141 iwgt=iwgt_save
3142 nFKSprocess=nFKS(i)
3143@@ -1328,11 +1429,8 @@
3144 do kr=1,nint(scalevarR(0))
3145 if ((.not. lscalevar(dd)) .and. kr.ne.1) exit
3146 iwgt=iwgt+1 ! increment the iwgt for the wgts() array
3147- if (iwgt.gt.max_wgt) then
3148- write (*,*) 'ERROR too many weights in '/
3149- $ /'reweight_scale',iwgt,max_wgt
3150- stop 1
3151- endif
3152+ call weight_lines_allocated(nexternal,max_contr,iwgt
3153+ $ ,max_iproc)
3154 c add the weights to the array
3155 wgts(iwgt,i)=xlum(kf) * (wgt(1,i)+wgt(2,i)
3156 $ *log(mu2_r(kr)/mu2_q)+wgt(3,i)*log(mu2_f(kf)
3157@@ -1349,15 +1447,14 @@
3158 end
3159
3160 subroutine reweight_scale_NNLL
3161-c Use the saved c_weight info to perform scale reweighting. Extends the
3162+c Use the saved weight lines info to perform scale reweighting. Extends the
3163 c wgts() array to include the weights. Special for the NNLL+NLO jet-veto
3164 c computations (ickkw.eq.-1).
3165+ use weight_lines
3166+ use extra_weights
3167 implicit none
3168 include 'nexternal.inc'
3169 include 'run.inc'
3170- include 'c_weight.inc'
3171- include 'reweight.inc'
3172- include 'reweightNLO.inc'
3173 include 'timing_variables.inc'
3174 integer i,ks,kh,iwgt_save
3175 double precision xlum(maxscales),dlum,pi,mu2_r(maxscales)
3176@@ -1394,7 +1491,7 @@
3177 endif
3178 enddo
3179 enddo
3180-c loop over all the contributions in the c_weights common block
3181+c loop over all the contributions in the weight lines module
3182 do i=1,icontr
3183 iwgt=iwgt_save
3184 nFKSprocess=nFKS(i)
3185@@ -1414,11 +1511,8 @@
3186 q2fact(2)=mu2_f(ks)
3187 xlum(ks) = dlum()
3188 iwgt=iwgt+1 ! increment the iwgt for the wgts() array
3189- if (iwgt.gt.max_wgt) then
3190- write (*,*) 'ERROR too many weights in reweight_scale'
3191- & ,iwgt,max_wgt
3192- stop 1
3193- endif
3194+ call weight_lines_allocated(nexternal,max_contr,iwgt
3195+ $ ,max_iproc)
3196 c add the weights to the array
3197 if (itype(i).ne.7) then
3198 wgts(iwgt,i)=xlum(ks) * (wgt(1,i)+wgt(2,i)
3199@@ -1445,14 +1539,13 @@
3200 end
3201
3202 subroutine reweight_pdf
3203-c Use the saved c_weight info to perform PDF reweighting. Extends the
3204+c Use the saved weight_lines info to perform PDF reweighting. Extends the
3205 c wgts() array to include the weights.
3206+ use weight_lines
3207+ use extra_weights
3208 implicit none
3209 include 'nexternal.inc'
3210 include 'run.inc'
3211- include 'c_weight.inc'
3212- include 'reweight.inc'
3213- include 'reweightNLO.inc'
3214 include 'timing_variables.inc'
3215 integer n,i,nn
3216 double precision xlum,dlum,pi,mu2_r,mu2_f,mu2_q,rwgt_muR_dep_fac,g
3217@@ -1470,11 +1563,8 @@
3218 c allows for better caching of the PDFs
3219 do n=0,nmemPDF(nn)
3220 iwgt=iwgt+1
3221- if (iwgt.gt.max_wgt) then
3222- write (*,*) 'ERROR too many weights in reweight_pdf',iwgt
3223- & ,max_wgt
3224- stop 1
3225- endif
3226+ call weight_lines_allocated(nexternal,max_contr,iwgt
3227+ $ ,max_iproc)
3228 call InitPDFm(nn,n)
3229 do i=1,icontr
3230 nFKSprocess=nFKS(i)
3231@@ -1508,9 +1598,9 @@
3232 c that there is an unique PS configuration: at most one Born, one real
3233 c and one set of counter terms. Among other things, this means that one
3234 c must do MC over FKS directories.
3235+ use weight_lines
3236 implicit none
3237 include 'nexternal.inc'
3238- include 'c_weight.inc'
3239 include 'appl_common.inc'
3240 include 'nFKSconfigs.inc'
3241 include 'genps.inc'
3242@@ -1606,9 +1696,9 @@
3243 c the pdg_uborn (the PDG codes for the underlying Born process) the PDG
3244 c codes of i_fks and j_fks are combined to give the PDG code of the
3245 c mother and the extra (n+1) parton is given the PDG code of the gluon.
3246+ use weight_lines
3247 implicit none
3248 include 'nexternal.inc'
3249- include 'c_weight.inc'
3250 include 'fks_info.inc'
3251 include 'genps.inc'
3252 integer k,ict,iFKS
3253@@ -1651,9 +1741,9 @@
3254 subroutine get_wgt_nbody(sig)
3255 c Sums all the central weights that contribution to the nbody cross
3256 c section
3257+ use weight_lines
3258 implicit none
3259 include 'nexternal.inc'
3260- include 'c_weight.inc'
3261 double precision sig
3262 integer i
3263 sig=0d0
3264@@ -1670,9 +1760,9 @@
3265 subroutine get_wgt_no_nbody(sig)
3266 c Sums all the central weights that contribution to the cross section
3267 c excluding the nbody contributions.
3268+ use weight_lines
3269 implicit none
3270 include 'nexternal.inc'
3271- include 'c_weight.inc'
3272 double precision sig
3273 integer i
3274 sig=0d0
3275@@ -1688,20 +1778,20 @@
3276
3277 subroutine fill_plots
3278 c Calls the analysis routine (which fill plots) for all the
3279-c contributions in the c_weight common block. Instead of really calling
3280+c contributions in the weight_lines module. Instead of really calling
3281 c it for all, it first checks if weights can be summed (i.e. they have
3282 c the same PDG codes and the same momenta) before calling the analysis
3283 c to greatly reduce the calls to the analysis routines.
3284+ use weight_lines
3285+ use extra_weights
3286 implicit none
3287 include 'nexternal.inc'
3288- include 'c_weight.inc'
3289- include 'reweight0.inc'
3290 include 'timing_variables.inc'
3291 integer i,ii,j,max_weight
3292 logical momenta_equal,pdg_equal
3293 external momenta_equal,pdg_equal
3294- parameter (max_weight=maxscales*maxscales+maxpdfs+1)
3295- double precision www(max_weight)
3296+ double precision,allocatable :: www(:)
3297+ save max_weight
3298 call cpu_time(tBefore)
3299 if (icontr.eq.0) return
3300 c fill the plots_wgts. Check if we can sum weights together before
3301@@ -1739,10 +1829,14 @@
3302 enddo
3303 do i=1,icontr
3304 if (plot_wgts(1,i).ne.0d0) then
3305- if (iwgt.gt.max_weight) then
3306- write (*,*) 'ERROR too many weights in fill_plots',iwgt
3307- & ,max_weight
3308- stop 1
3309+ if (.not.allocated(www)) then
3310+ allocate(www(iwgt))
3311+ max_weight=iwgt
3312+ elseif(iwgt.ne.max_weight) then
3313+ write (*,*) 'Error in fill_plots (fks_singular.f): '/
3314+ $ /'number of weights should not vary between PS '/
3315+ $ /'points',iwgt,max_weight
3316+ stop
3317 endif
3318 do j=1,iwgt
3319 www(j)=plot_wgts(j,i)
3320@@ -1758,19 +1852,32 @@
3321
3322 subroutine fill_mint_function(f)
3323 c Fills the function that is returned to the MINT integrator
3324+ use weight_lines
3325 implicit none
3326 include 'nexternal.inc'
3327- include 'c_weight.inc'
3328 include 'mint.inc'
3329 integer i
3330- double precision f(nintegrals),sigint
3331+ double precision f(nintegrals),sigint,bias
3332 double precision virt_wgt_mint,born_wgt_mint
3333 common /virt_born_wgt_mint/virt_wgt_mint,born_wgt_mint
3334 double precision virtual_over_born
3335 common /c_vob/ virtual_over_born
3336+ character*7 event_norm
3337+ common /event_normalisation/event_norm
3338 sigint=0d0
3339 do i=1,icontr
3340- sigint=sigint+wgts(1,i)
3341+ if (event_norm(1:4).ne.'bias') then
3342+ sigint=sigint+wgts(1,i)
3343+ else
3344+ if (itype(i).eq.1) then
3345+ call bias_weight_function(momenta_m(0,1,2,i),parton_pdg(1
3346+ $ ,1,i),bias)
3347+ else
3348+ call bias_weight_function(momenta_m(0,1,1,i),parton_pdg(1
3349+ $ ,1,i),bias)
3350+ endif
3351+ sigint=sigint+wgts(1,i)*bias
3352+ endif
3353 enddo
3354 f(1)=abs(sigint)
3355 f(2)=sigint
3356@@ -1786,10 +1893,10 @@
3357 c Includes the shape function from the MC counter terms in the shower
3358 c starting scale. This function needs to be called (at least) once per
3359 c FKS configuration that is included in the current PS point.
3360+ use weight_lines
3361 implicit none
3362 include 'nexternal.inc'
3363 include 'run.inc'
3364- include 'c_weight.inc'
3365 include 'nFKSconfigs.inc'
3366 integer i,iFKS,Hevents,izero,mohdr
3367 double precision ddum(6),p(0:3,nexternal)
3368@@ -1847,9 +1954,9 @@
3369 c the MC counter terms for the H-events FKS configuration by FKS
3370 c configuration, while for the S-events also contributions from the
3371 c various FKS configurations can be summed together.
3372+ use weight_lines
3373 implicit none
3374 include 'nexternal.inc'
3375- include 'c_weight.inc'
3376 include 'genps.inc'
3377 include 'nFKSconfigs.inc'
3378 include 'fks_info.inc'
3379@@ -1953,9 +2060,9 @@
3380 c necessarily the same for all of these summed FKS configurations). Take
3381 c the weighted average over the FKS configurations as the shower scale
3382 c for the summed contribution.
3383+ use weight_lines
3384 implicit none
3385 include 'nexternal.inc'
3386- include 'c_weight.inc'
3387 include 'nFKSconfigs.inc'
3388 integer i,j,ict
3389 double precision tmp_wgt(fks_configs),showerscale(fks_configs)
3390@@ -2009,9 +2116,9 @@
3391 subroutine fill_mint_function_NLOPS(f,n1body_wgt)
3392 c Fills the function that is returned to the MINT integrator. Depending
3393 c on the imode we should or should not include the virtual corrections.
3394+ use weight_lines
3395 implicit none
3396 include 'nexternal.inc'
3397- include 'c_weight.inc'
3398 include 'mint.inc'
3399 integer i,j,ict
3400 double precision f(nintegrals),sigint,sigint1,sigint_ABS
3401@@ -2099,9 +2206,9 @@
3402 subroutine pick_unweight_contr(iFKS_picked)
3403 c Randomly pick (weighted by the ABS values) the contribution to a given
3404 c PS point that should be written in the event file.
3405+ use weight_lines
3406 implicit none
3407 include 'nexternal.inc'
3408- include 'c_weight.inc'
3409 include 'genps.inc'
3410 include 'nFKSconfigs.inc'
3411 include 'fks_info.inc'
3412@@ -2179,19 +2286,21 @@
3413 c Fills the lines, n_ctr_str, to be written in an event file with the
3414 c (internal) information to perform scale and/or PDF reweighting. All
3415 c information is available in each line to do the reweighting, apart
3416-c from the momenta: these are put in the momenta_str_l() array, and a
3417+c from the momenta: these are put in the momenta_str() array, and a
3418 c label in each of the n_ctr_str refers to a corresponding set of
3419-c momenta in the momenta_str_l() array.
3420+c momenta in the momenta_str() array.
3421+ use weight_lines
3422+ use extra_weights
3423 implicit none
3424 include 'nexternal.inc'
3425- include 'c_weight.inc'
3426- include 'reweight0.inc'
3427 include 'genps.inc'
3428 include 'nFKSconfigs.inc'
3429 include 'fks_info.inc'
3430 integer k,i,ii,j,jj,ict,ipr,momenta_conf(2)
3431 logical momenta_equal,found
3432- double precision conv,momenta_str_l(0:3,nexternal,max_n_ctr)
3433+ double precision conv
3434+ double precision,allocatable :: temp3(:,:,:)
3435+ character(len=1024),allocatable :: ctemp(:)
3436 external momenta_equal
3437 character*512 procid,str_temp
3438 parameter (conv=389379660d0) ! conversion to picobarns
3439@@ -2200,15 +2309,17 @@
3440 common/cproc_combination/iproc_save,eto,etoi,maxproc_found
3441 logical Hevents
3442 common/SHevents/Hevents
3443+ if (.not.allocated(momenta_str)) allocate(momenta_str(0:3
3444+ $ ,max_mext,max_mom_str))
3445 wgtref=unwgt(iproc_picked,icontr_picked)
3446 n_ctr_found=0
3447 n_mom_conf=0
3448 c Loop over all the contributions in the picked contribution (the latter
3449-c is chosen in the pick_unweight_cont() subroutine)
3450+c is chosen in the pick_unweight_contr() subroutine)
3451 do i=1,icontr_sum(0,icontr_picked)
3452 ict=icontr_sum(i,icontr_picked)
3453 c Check if the current set of momenta are already available in the
3454-c momenta_str_l array. If not, add it.
3455+c momenta_str array. If not, add it.
3456 found=.false.
3457 do k=1,2
3458 do j=1,n_mom_conf
3459@@ -2216,7 +2327,7 @@
3460 momenta_conf(k)=0
3461 cycle
3462 endif
3463- if (momenta_equal(momenta_str_l(0,1,j),
3464+ if (momenta_equal(momenta_str(0,1,j),
3465 & momenta_m(0,1,k,ict))) then
3466 momenta_conf(k)=j
3467 found=.true.
3468@@ -2225,12 +2336,20 @@
3469 enddo
3470 if (.not. found) then
3471 n_mom_conf=n_mom_conf+1
3472+ if (n_mom_conf.gt.max_mom_str .or. nexternal.gt.max_mext)
3473+ $ then
3474+ allocate(temp3(0:3,max(nexternal,max_mext)
3475+ $ ,max(n_mom_conf,max_mom_str)))
3476+ temp3(0:3,1:min(nexternal,max_mext)
3477+ $ ,1:min(max_mom_str,n_mom_conf))=momenta_str
3478+ call move_alloc(temp3,momenta_str)
3479+ max_mom_str=max(n_mom_conf,max_mom_str)
3480+ max_mext=max(nexternal,max_mext)
3481+ endif
3482 do ii=1,nexternal
3483 do jj=0,3
3484 momenta_str(jj,ii,n_mom_conf)=
3485 & momenta_m(jj,ii,k,ict)
3486- momenta_str_l(jj,ii,n_mom_conf)=
3487- & momenta_m(jj,ii,k,ict)
3488 enddo
3489 enddo
3490 momenta_conf(k)=n_mom_conf
3491@@ -2244,6 +2363,15 @@
3492 if (eto(ii,nFKS(ict)).ne.ipr) cycle
3493 n_ctr_found=n_ctr_found+1
3494
3495+ if (.not.allocated(n_ctr_str))
3496+ $ allocate(n_ctr_str(max_n_ctr))
3497+ if (n_ctr_found.gt.max_n_ctr) then
3498+ allocate(ctemp(n_ctr_found))
3499+ ctemp(1:max_n_ctr)=n_ctr_str
3500+ call move_alloc(ctemp,n_ctr_str)
3501+ max_n_ctr=n_ctr_found
3502+ endif
3503+
3504 if (nincoming.eq.2) then
3505 write (n_ctr_str(n_ctr_found),'(5(1x,d18.12),1x,i2)')
3506 & (wgt(j,ict)*conv,j=1,3),(wgt_me_tree(j,ict),j=1,2),
3507@@ -2264,8 +2392,7 @@
3508 & trim(adjustl(n_ctr_str(n_ctr_found)))//' '
3509 & //trim(adjustl(procid))
3510
3511- write (str_temp,
3512- & '(i2,6(1x,d14.8),6(1x,i2),1x,i8,1x,d18.12)')
3513+ write (str_temp,30)
3514 & QCDpower(ict),
3515 & (bjx(j,ict),j=1,2),
3516 & (scales2(j,ict),j=1,3),
3517@@ -2276,7 +2403,8 @@
3518 & fks_i_d(nFKS(ict)),
3519 & fks_j_d(nFKS(ict)),
3520 & parton_pdg_uborn(fks_j_d(nFKS(ict)),ii,ict),
3521- & parton_iproc(ii,ict)
3522+ & parton_iproc(ii,ict),
3523+ & bias_wgt(ict)
3524 n_ctr_str(n_ctr_found) =
3525 & trim(adjustl(n_ctr_str(n_ctr_found)))//' '
3526 & //trim(adjustl(str_temp))
3527@@ -2286,6 +2414,15 @@
3528 ipr=iproc_picked
3529 n_ctr_found=n_ctr_found+1
3530
3531+ if (.not.allocated(n_ctr_str))
3532+ $ allocate(n_ctr_str(max_n_ctr))
3533+ if (n_ctr_found.gt.max_n_ctr) then
3534+ allocate(ctemp(n_ctr_found))
3535+ ctemp(1:max_n_ctr)=n_ctr_str
3536+ call move_alloc(ctemp,n_ctr_str)
3537+ max_n_ctr=n_ctr_found
3538+ endif
3539+
3540 if (nincoming.eq.2) then
3541 write (n_ctr_str(n_ctr_found),'(5(1x,d18.12),1x,i2)')
3542 & (wgt(j,ict)*conv,j=1,3),(wgt_me_tree(j,ict),j=1,2),
3543@@ -2306,7 +2443,7 @@
3544 & trim(adjustl(n_ctr_str(n_ctr_found)))//' '
3545 & //trim(adjustl(procid))
3546
3547- write (str_temp,'(i2,6(1x,d14.8),6(1x,i2),1x,i8,1x,d18.12)')
3548+ write (str_temp,30)
3549 & QCDpower(ict),
3550 & (bjx(j,ict),j=1,2),
3551 & (scales2(j,ict),j=1,3),
3552@@ -2317,18 +2454,17 @@
3553 & fks_i_d(nFKS(ict)),
3554 & fks_j_d(nFKS(ict)),
3555 & parton_pdg_uborn(fks_j_d(nFKS(ict)),ipr,ict),
3556- & parton_iproc(ipr,ict)
3557+ & parton_iproc(ipr,ict),
3558+ & bias_wgt(ict)
3559 n_ctr_str(n_ctr_found) =
3560 & trim(adjustl(n_ctr_str(n_ctr_found)))//' '
3561 & //trim(adjustl(str_temp))
3562
3563
3564 endif
3565- if (n_ctr_found.ge.max_n_ctr) then
3566- write (*,*) 'ERROR: too many contributions in <rwgt>'
3567- stop1
3568- endif
3569 enddo
3570+ return
3571+ 30 format(i2,6(1x,d14.8),6(1x,i2),1x,i8,1x,d18.12,1x,d18.12)
3572 end
3573
3574
3575@@ -2878,9 +3014,6 @@
3576 double complex xij_aor
3577 common/cxij_aor/xij_aor
3578
3579- logical rotategranny
3580- common/crotategranny/rotategranny
3581-
3582 double precision cthbe,sthbe,cphibe,sphibe
3583 common/cbeangles/cthbe,sthbe,cphibe,sphibe
3584
3585@@ -2918,20 +3051,7 @@
3586 E_i_fks = p(0,i_fks)
3587 z = 1d0 - E_i_fks/(E_i_fks+E_j_fks)
3588 t = z * shat/4d0
3589- if(rotategranny .and. nexternal-1.ne.3 .and. nincoming.eq.2)then
3590-c Exclude 2->1 (at the Born level) processes: matrix elements are
3591-c independent of the PS point, but non-zero helicity configurations
3592-c might flip when rotating the momenta.
3593- do i=1,nexternal-1
3594- call trp_rotate_invar(p_born(0,i),p_born_rot(0,i),
3595- # cthbe,sthbe,cphibe,sphibe)
3596- enddo
3597- CalculatedBorn=.false.
3598- call sborn(p_born_rot,wgt1)
3599- CalculatedBorn=.false.
3600- else
3601- call sborn(p_born,wgt1)
3602- endif
3603+ call sborn(p_born,wgt1)
3604 call AP_reduced(j_type,i_type,t,z,ap)
3605 if (abs(j_type).eq.3 .and. i_type.eq.8) then
3606 Q=0d0
3607@@ -2945,10 +3065,6 @@
3608 pi(i)=p_i_fks_ev(i)
3609 pj(i)=p(i,j_fks)
3610 enddo
3611- if(rotategranny)then
3612- call trp_rotate_invar(pi,pi,cthbe,sthbe,cphibe,sphibe)
3613- call trp_rotate_invar(pj,pj,cthbe,sthbe,cphibe,sphibe)
3614- endif
3615 CALL IXXXSO(pi ,ZERO ,+1,+1,W1)
3616 CALL OXXXSO(pj ,ZERO ,-1,+1,W2)
3617 CALL IXXXSO(pi ,ZERO ,-1,+1,W3)
3618@@ -2963,13 +3079,8 @@
3619 endif
3620 c Insert the extra factor due to Madgraph convention for polarization vectors
3621 imother_fks=min(i_fks,j_fks)
3622- if(rotategranny)then
3623- call getaziangles(p_born_rot(0,imother_fks),
3624- # cphi_mother,sphi_mother)
3625- else
3626- call getaziangles(p_born(0,imother_fks),
3627- # cphi_mother,sphi_mother)
3628- endif
3629+ call getaziangles(p_born(0,imother_fks),
3630+ # cphi_mother,sphi_mother)
3631 wgt1(2) = -(cphi_mother-ximag*sphi_mother)**2 *
3632 # wgt1(2) * azifact
3633 call Qterms_reduced_timelike(j_type, i_type, t, z, Q)
3634@@ -3040,24 +3151,7 @@
3635 c Thus, an extra factor z (implicit in the flux of the reduced Born
3636 c in FKS) has to be inserted here
3637 t = z*shat/4d0
3638- if(j_fks.eq.2 .and. nexternal-1.ne.3 .and. nincoming.eq.2)then
3639-c Rotation according to innerpin.m. Use rotate_invar() if a more
3640-c general rotation is needed.
3641-c Exclude 2->1 (at the Born level) processes: matrix elements are
3642-c independent of the PS point, but non-zero helicity configurations
3643-c might flip when rotating the momenta.
3644- do i=1,nexternal-1
3645- p_born_rot(0,i)=p_born(0,i)
3646- p_born_rot(1,i)=-p_born(1,i)
3647- p_born_rot(2,i)=p_born(2,i)
3648- p_born_rot(3,i)=-p_born(3,i)
3649- enddo
3650- CalculatedBorn=.false.
3651- call sborn(p_born_rot,wgt1)
3652- CalculatedBorn=.false.
3653- else
3654- call sborn(p_born,wgt1)
3655- endif
3656+ call sborn(p_born,wgt1)
3657 call AP_reduced(m_type,i_type,t,z,ap)
3658 if (abs(m_type).eq.3) then
3659 Q=0d0
3660@@ -3071,14 +3165,6 @@
3661 pi(i)=p_i_fks_ev(i)
3662 pj(i)=p(i,j_fks)
3663 enddo
3664- if(j_fks.eq.2 .and. nincoming.eq.2)then
3665-c Rotation according to innerpin.m. Use rotate_invar() if a more
3666-c general rotation is needed
3667- pi(1)=-pi(1)
3668- pi(3)=-pi(3)
3669- pj(1)=-pj(1)
3670- pj(3)=-pj(3)
3671- endif
3672 CALL IXXXSO(pi ,ZERO ,+1,+1,W1)
3673 CALL OXXXSO(pj ,ZERO ,-1,+1,W2)
3674 CALL IXXXSO(pi ,ZERO ,-1,+1,W3)
3675@@ -3092,13 +3178,8 @@
3676 azifact=Wij_angle/Wij_recta
3677 endif
3678 c Insert the extra factor due to Madgraph convention for polarization vectors
3679- if(j_fks.eq.2 .and. nincoming.eq.2)then
3680- cphi_mother=-1.d0
3681- sphi_mother=0.d0
3682- else
3683- cphi_mother=1.d0
3684- sphi_mother=0.d0
3685- endif
3686+ cphi_mother=1.d0
3687+ sphi_mother=0.d0
3688 wgt1(2) = -(cphi_mother+ximag*sphi_mother)**2 *
3689 # wgt1(2) * dconjg(azifact)
3690 call Qterms_reduced_spacelike(m_type, i_type, t, z, Q)
3691@@ -3508,13 +3589,13 @@
3692
3693 subroutine sreal_deg(p,xi_i_fks,y_ij_fks,
3694 # collrem_xi,collrem_lxi)
3695+ use extra_weights
3696 implicit none
3697 include "genps.inc"
3698 include 'nexternal.inc'
3699 include "coupl.inc"
3700 include 'q_es.inc'
3701 include "run.inc"
3702- include 'reweight.inc'
3703
3704 double precision p(0:3,nexternal),collrem_xi,collrem_lxi
3705 double precision xi_i_fks,y_ij_fks
3706@@ -3679,8 +3760,6 @@
3707 include "run.inc"
3708 include "nexternal.inc"
3709 integer j_fks
3710- double precision dlum
3711- external dlum
3712 double precision zhw_used,xi_i_fks,xlum_mc_fact
3713 double precision xbjrk_ev(2),xbjrk_cnt(2,-2:2)
3714 common/cbjorkenx/xbjrk_ev,xbjrk_cnt
3715@@ -3808,15 +3887,6 @@
3716 endif
3717 if(.not.pass)i_momcmp_count=i_momcmp_count +1
3718 c
3719- if(jac_cnt(0).gt.0.d0.and.jac.gt.0.d0)
3720- # call p_ev_vs_cnt(izero,i_fks,j_fks,p,p1_cnt,
3721- # p_i_fks_ev,p_i_fks_cnt,
3722- # xi_i_fks_ev,y_ij_fks_ev)
3723- if(jac_cnt(1).gt.0.d0.and.jac.gt.0.d0)
3724- # call p_ev_vs_cnt(ione,i_fks,j_fks,p,p1_cnt,
3725- # p_i_fks_ev,p_i_fks_cnt,
3726- # xi_i_fks_ev,y_ij_fks_ev)
3727-c
3728 return
3729 end
3730
3731@@ -3915,72 +3985,6 @@
3732 end
3733
3734
3735- subroutine xmcompare_fsr(verbose,inum,iden,i_fks,j_fks,p,p1_cnt)
3736- implicit none
3737- include 'genps.inc'
3738- include 'nexternal.inc'
3739- logical verbose
3740- integer inum,iden,i_fks,j_fks,iunit,ipart,i
3741- double precision tiny,xnum,xden,xrat
3742- double precision p(0:3,-max_branch:max_particles)
3743- double precision p1_cnt(0:3,nexternal,-2:2)
3744- parameter (iunit=6)
3745- parameter (tiny=1.d-4)
3746-c
3747- do ipart=1,nexternal
3748- do i=0,3
3749- xnum=p1_cnt(i,ipart,inum)
3750- xden=p1_cnt(i,ipart,iden)
3751- if(verbose)then
3752- if(i.eq.0)then
3753- write(iunit,*)' '
3754- write(iunit,*)'part=',ipart
3755- endif
3756- call xprintout(iunit,xnum,xden)
3757- else
3758- if(ipart.ne.i_fks.and.ipart.ne.j_fks)then
3759- if(xden.ne.0.d0)then
3760- xrat=abs(1-xnum/xden)
3761- else
3762- xrat=abs(xnum)
3763- endif
3764- if(xrat.gt.tiny)then
3765- write(*,*)'Kinematics of counterevents'
3766- write(*,*)inum,iden
3767- write(*,*)'is different. Particle:',ipart
3768- stop
3769- endif
3770- endif
3771- endif
3772- enddo
3773- enddo
3774- do i=0,3
3775- xnum=p1_cnt(i,i_fks,inum)+p1_cnt(i,j_fks,inum)
3776- xden=p1_cnt(i,i_fks,iden)+p1_cnt(i,j_fks,iden)
3777- if(verbose)then
3778- if(i.eq.0)then
3779- write(iunit,*)' '
3780- write(iunit,*)'part=i+j'
3781- endif
3782- call xprintout(iunit,xnum,xden)
3783- else
3784- if(xden.ne.0.d0)then
3785- xrat=abs(1-xnum/xden)
3786- else
3787- xrat=abs(xnum)
3788- endif
3789- if(xrat.gt.tiny)then
3790- write(*,*)'Kinematics of counterevents'
3791- write(*,*)inum,iden
3792- write(*,*)'is different. Particle i+j'
3793- stop
3794- endif
3795- endif
3796- enddo
3797- return
3798- end
3799-
3800-
3801 subroutine xprintout(iunit,xv,xlim)
3802 implicit real*8(a-h,o-z)
3803 c
3804@@ -3993,70 +3997,6 @@
3805 end
3806
3807
3808- subroutine p_ev_vs_cnt(icnt,i_fks,j_fks,p,p1_cnt,
3809- # p_i_fks_ev,p_i_fks_cnt,
3810- # xi_i_fks_ev,y_ij_fks_ev)
3811- implicit none
3812- include 'genps.inc'
3813- include 'nexternal.inc'
3814- integer icnt,i_fks,j_fks,ipart,i
3815- double precision p(0:3,-max_branch:max_particles)
3816- double precision p1_cnt(0:3,nexternal,-2:2)
3817- double precision p_i_fks_ev(0:3),p_i_fks_cnt(0:3,-2:2)
3818- double precision xi_i_fks_ev,y_ij_fks_ev,tiny
3819- double precision rat(0:3,nexternal+3),den(0:3,nexternal+3)
3820- integer maxrat
3821-c
3822-c This routine is obsolete; the convergence checks are done elsewhere
3823- return
3824-
3825- do ipart=1,nexternal
3826- do i=0,3
3827- den(i,ipart)=p1_cnt(i,ipart,icnt)
3828- if(den(i,ipart).ne.0.d0)then
3829- rat(i,ipart)=p(i,ipart)/den(i,ipart)
3830- else
3831- rat(i,ipart)=p(i,ipart)
3832- endif
3833- enddo
3834- enddo
3835-c
3836- do i=0,3
3837- den(i,nexternal+1)=p1_cnt(i,i_fks,icnt)+p1_cnt(i,j_fks,icnt)
3838- if(den(i,nexternal+1).ne.0.d0)then
3839- rat(i,nexternal+1)=(p(i,i_fks)+p(i,j_fks))/den(i,nexternal+1)
3840- else
3841- rat(i,nexternal+1)=p(i,i_fks)+p(i,j_fks)
3842- endif
3843- enddo
3844-c
3845- if(icnt.eq.0)then
3846- tiny=4*xi_i_fks_ev
3847- maxrat=nexternal+3
3848- do i=0,3
3849- den(i,nexternal+2)=p_i_fks_cnt(i,0)
3850- if(den(i,nexternal+2).ne.0.d0)then
3851- rat(i,nexternal+2)=p_i_fks_ev(i)/den(i,nexternal+2)
3852- else
3853- rat(i,nexternal+2)=p_i_fks_ev(i)
3854- endif
3855- enddo
3856- do i=0,3
3857- den(i,nexternal+3)=p_i_fks_cnt(i,0)
3858- if(den(i,nexternal+3).ne.0.d0)then
3859- rat(i,nexternal+3)=p(i,i_fks)/den(i,nexternal+3)
3860- else
3861- rat(i,nexternal+3)=p(i,i_fks)
3862- endif
3863- enddo
3864- else
3865- tiny=2*sqrt(1-y_ij_fks_ev)
3866- maxrat=nexternal+1
3867- endif
3868-c
3869- return
3870- end
3871-
3872
3873 c The following has been derived with minor modifications from the
3874 c analogous routine written for VBF
3875@@ -4213,183 +4153,8 @@
3876
3877
3878
3879-
3880- subroutine checksij(xsijvc,xsijlvc,xsijlim,
3881- # xsumvc,xsumlvc,xsumlim,
3882- # check,checkl,tolerance,
3883- # iflag,imax,iev,ki,kk,ll,
3884- # i_fks,j_fks,ilim,iret)
3885-c Analogous to checkres. Relevant to S functions
3886- implicit none
3887- real*8 xsijvc(15),xsijlvc,xsumvc(15),xsumlvc,check(15),checkl
3888- real*8 xsijlim,xsumlim,tolerance
3889- real*8 xsecvc(15),xseclvc
3890- real*8 ckc(15),rckc(15),rat
3891- logical found
3892- integer iflag,imax,iev,ki,kk,ll,i_fks,j_fks,ilim,iret,ithrs,
3893- # istop,iwrite,i,imin,icount,itype
3894- parameter (ithrs=3)
3895- parameter (istop=0)
3896- parameter (iwrite=1)
3897-c
3898- if(imax.gt.15)then
3899- write(6,*)'Error in checksij: imax is too large',imax
3900- stop
3901- endif
3902- itype=1
3903- iret=0
3904- 100 continue
3905- if(itype.eq.1)then
3906- do i=1,imax
3907- xsecvc(i)=xsijvc(i)
3908- enddo
3909- xseclvc=xsijlvc
3910- elseif(itype.eq.2)then
3911- do i=1,imax
3912- xsecvc(i)=xsumvc(i)
3913- enddo
3914- xseclvc=xsumlvc
3915- else
3916- write(6,*)'Error in checksij: itype=',itype
3917- stop
3918- endif
3919- do i=1,imax
3920- if(xseclvc.eq.0.d0)then
3921- ckc(i)=abs(xsecvc(i))
3922- else
3923- ckc(i)=abs(xsecvc(i)/xseclvc-1.d0)
3924- endif
3925- enddo
3926- if(iflag.eq.0)then
3927- rat=8.d0
3928- elseif(iflag.eq.1)then
3929- rat=2.d0
3930- else
3931- write(6,*)'Error in checksij: iflag=',iflag
3932- write(6,*)' Must be 0 for soft, 1 for collinear'
3933- stop
3934- endif
3935-c
3936- i=1
3937- dowhile(ckc(i).gt.0.1d0)
3938- i=i+1
3939- enddo
3940- imin=i
3941- do i=imin,imax-1
3942- if(ckc(i+1).gt.1.d-8)then
3943-c If this condition is replaced by .eq.0, the test will fail if the series
3944-c is made of elements all equal to the limit
3945- rckc(i)=ckc(i)/ckc(i+1)
3946- else
3947-c Element #i+1 of series equal to the limit, so it must pass the test
3948- rckc(i)=rat*1.1d0
3949- endif
3950- enddo
3951- icount=0
3952- i=imin
3953- dowhile(icount.lt.ithrs.and.i.lt.imax)
3954- if(rckc(i).gt.rat)then
3955- icount=icount+1
3956- else
3957- icount=0
3958- endif
3959- i=i+1
3960- enddo
3961-c
3962- if(icount.ne.ithrs)then
3963- iret=iret+itype
3964- if(istop.eq.1)then
3965- write(6,*)'Test failed',iflag
3966- write(6,*)'Event #',iev
3967- stop
3968- endif
3969- endif
3970- if(itype.eq.1.and.ki.eq.1.and.iflag.eq.0)then
3971- itype=2
3972- goto 100
3973- endif
3974-c
3975- if(ki.eq.1.and.ilim.eq.1)then
3976- found=.false.
3977- i=0
3978- do while ((.not.found).and.i.lt.imax)
3979- i=i+1
3980- if(abs(check(i)-1.d0).gt.tolerance)then
3981- found=.true.
3982- itype=4
3983- endif
3984- enddo
3985- if(.not.found)then
3986- if(abs(checkl-1.d0).gt.tolerance)itype=4
3987- endif
3988- if(itype.eq.4)iret=iret+itype
3989- endif
3990-c
3991- if( iwrite.eq.1 .and.
3992- # iret.eq.1 .or.(iret.gt.1.and.ki.eq.1) )then
3993- if(iret.gt.7)then
3994- write(6,*)'Error in checksij: iret=',iret
3995- stop
3996- endif
3997- write(77,*)' '
3998- if(iflag.eq.0)then
3999- write(77,*)'Soft #',iev
4000- elseif(iflag.eq.1)then
4001- write(77,*)'Collinear #',iev
4002- endif
4003- write(77,*)'iret:',iret
4004- write(77,*)'i_fks,j_fks:',i_fks,j_fks
4005- if(iret.eq.1.or.iret.eq.3.or.iret.eq.5.or.iret.eq.7)then
4006- write(77,*)'S_kl'
4007- write(77,*)'k,kk,ll',ki,kk,ll
4008- do i=1,imax
4009- call xprintout(77,xsijvc(i),xsijlvc)
4010- enddo
4011- endif
4012- if(iret.eq.2.or.iret.eq.3.or.iret.eq.6.or.iret.eq.7)then
4013- write(77,*)'sum of S'
4014- do i=1,imax
4015- call xprintout(77,xsumvc(i),xsumlvc)
4016- enddo
4017- endif
4018- if(iret.eq.4.or.iret.eq.5.or.iret.eq.6.or.iret.eq.7)then
4019- write(77,*)'check to one'
4020- do i=1,imax
4021- call xprintout(77,check(i),checkl)
4022- enddo
4023- endif
4024- endif
4025-c
4026- if(ilim.eq.1)then
4027- if( abs(xsijlvc-xsijlim).gt.1.d-6 .and.
4028- # xsijlim.ne.-1.d0 )iret=iret+10
4029- if( abs(xsumlvc-xsumlim).gt.1.d-6 .and.
4030- # xsumlim.ne.-1.d0 .and. iflag.eq.0)iret=iret+20
4031- if(iwrite.eq.1.and.iret.ge.10)then
4032- write(77,*)' '
4033- if(iflag.eq.0)then
4034- write(77,*)'Soft #',iev
4035- elseif(iflag.eq.1)then
4036- write(77,*)'Collinear #',iev
4037- endif
4038- write(77,*)'iret:',iret
4039- write(77,*)'i_fks,j_fks:',i_fks,j_fks
4040- if((iret.ge.10.and.iret.lt.20).or.iret.ge.30)then
4041- write(77,*)'limit of S_kl'
4042- write(77,*)'k,kk,ll',ki,kk,ll
4043- write(77,*)xsijlvc,xsijlim
4044- endif
4045- if(iret.ge.20)then
4046- write(77,*)'limit of sum_j S_ij'
4047- write(77,*)xsumlvc,xsumlim
4048- endif
4049- endif
4050- endif
4051- return
4052- end
4053-
4054-
4055 subroutine bornsoftvirtual(p,bsv_wgt,virt_wgt,born_wgt)
4056+ use extra_weights
4057 implicit none
4058 include "genps.inc"
4059 include 'nexternal.inc'
4060@@ -4401,7 +4166,6 @@
4061 common /c_fks_inc/fks_j_from_i,particle_type,pdg_type
4062 include "run.inc"
4063 include "fks_powers.inc"
4064- include 'reweight.inc'
4065 include "mint.inc"
4066 double precision p(0:3,nexternal),bsv_wgt,born_wgt,avv_wgt
4067 double precision pp(0:3,nexternal)
4068@@ -4755,10 +4519,6 @@
4069 double precision bpower,born_wgt
4070 double complex wgt1(2)
4071
4072- integer isum_hel
4073- logical multi_channel
4074- common/to_matrix/isum_hel, multi_channel
4075- integer isum_hel_orig
4076 integer i_fks,j_fks
4077 common/fks_indices/i_fks,j_fks
4078
4079@@ -4767,13 +4527,6 @@
4080
4081 double precision tiny
4082 parameter (tiny=1d-6)
4083-
4084-c Make sure that we sum over helicities (such that we do get a
4085-c non-zero Born)
4086- isum_hel_orig = isum_hel
4087- isum_hel=0
4088- call get_helicity(i_fks,j_fks)
4089-
4090 calculatedBorn=.false.
4091 call sborn(p_born,wgt1)
4092 c Born contribution:
4093@@ -4815,7 +4568,6 @@
4094 c nothing funny happens later on
4095 g=g/10d0
4096 call update_as_param()
4097- isum_hel=isum_hel_orig
4098 calculatedBorn=.false.
4099 call sborn(p_born,wgt1)
4100
4101@@ -4825,25 +4577,21 @@
4102 c This function computes the power of a muR-dependent factor which
4103 c is stored in cpower. You need to modify it when you try to
4104 c reweight your cross section with a muR-dependent factor
4105-c (runfac=1 in reweight0.inc)
4106+c (runfac=1 in extra_weights.f)
4107 c Note: The implementation below only works for the Bottom Yukawa in
4108 c the SM where "GC_33" contains the Yukawa, for other models
4109 c or general muR-dependent factors you need to change GC_33
4110 c to the corresponding coupling.
4111 subroutine compute_cpower(p_born,cpower)
4112+ use extra_weights
4113 implicit none
4114 include "nexternal.inc"
4115 include "coupl.inc"
4116- include 'reweight.inc'
4117
4118 double precision p_born(0:3,nexternal-1)
4119 double precision cpower,born_wgt
4120 double complex wgt1(2)
4121
4122- integer isum_hel
4123- logical multi_channel
4124- common/to_matrix/isum_hel, multi_channel
4125- integer isum_hel_orig
4126 integer i_fks,j_fks
4127 common/fks_indices/i_fks,j_fks
4128
4129@@ -4859,12 +4607,6 @@
4130
4131 c The following is relevant for a muR-dependent bottom-mass in Yukawa.
4132 c$$$
4133-c$$$c Make sure that we sum over helicities (such that we do get a
4134-c$$$c non-zero Born)
4135-c$$$ isum_hel_orig = isum_hel
4136-c$$$ isum_hel=0
4137-c$$$ call get_helicity(i_fks,j_fks)
4138-c$$$
4139 c$$$ calculatedBorn=.false.
4140 c$$$ call sborn(p_born,wgt1)
4141 c$$$c Born contribution:
4142@@ -4900,7 +4642,7 @@
4143 c$$$ cpower=dble(nint(cpower))
4144 c$$$ write(*,*)'cpower is', cpower
4145 c$$$c Check consistency with value used in reweighting
4146-c$$$c$$$ if( (doreweight.or.doNLOreweight) .and.
4147+c$$$c$$$ if( doreweight .and.
4148 c$$$c$$$ & abs(cpower-wgtcpower).gt.tiny )then
4149 c$$$c$$$ write(*,*)'Error in compute_cpower'
4150 c$$$c$$$ write(*,*)'cpower(s) are:',cpower,wgtcpower
4151@@ -4911,7 +4653,6 @@
4152 c$$$c Change couplings back and recompute the Born to make sure that
4153 c$$$c nothing funny happens later on
4154 c$$$ GC_33 = GC_33 / 10d0
4155-c$$$ isum_hel=isum_hel_orig
4156 c$$$ calculatedBorn=.false.
4157 c$$$ call sborn(p_born,wgt1)
4158 c$$$
4159@@ -5348,73 +5089,9 @@
4160 end
4161
4162
4163- function m1l_finite_CDR(p,born)
4164-c Returns the finite part of virtual contribution, according to the
4165-c definitions given in (B.1) and (B.2). This function must include
4166-c the factor as/(2*pi)
4167- implicit none
4168- include "genps.inc"
4169- include 'nexternal.inc'
4170-c include "fks.inc"
4171- integer fks_j_from_i(nexternal,0:nexternal)
4172- & ,particle_type(nexternal),pdg_type(nexternal)
4173- common /c_fks_inc/fks_j_from_i,particle_type,pdg_type
4174- include 'coupl.inc'
4175- include 'q_es.inc'
4176- double precision p(0:3,nexternal-1),m1l_finite_CDR,born
4177- double precision CF,pi,aso2pi,shat,dot,xlgq2os
4178- parameter (CF=4d0/3d0)
4179- parameter (pi=3.1415926535897932385d0)
4180-c
4181- aso2pi=g**2/(8*pi**2)
4182-c This is relevant to e+e- --> qqbar
4183- shat=2d0*dot(p(0,1),p(0,2))
4184- xlgq2os=log(QES2/shat)
4185- m1l_finite_CDR=-aso2pi*CF*(xlgq2os**2+3*xlgq2os-pi**2+8.d0)*born
4186- return
4187- end
4188-
4189-
4190- function m1l_W_finite_CDR(p,born)
4191-c Returns the finite part of virtual contribution, according to the
4192-c definitions given in (B.1) and (B.2). This function must include
4193-c the factor as/(2*pi)
4194- implicit none
4195- include "genps.inc"
4196- include 'nexternal.inc'
4197-c include "fks.inc"
4198- integer fks_j_from_i(nexternal,0:nexternal)
4199- & ,particle_type(nexternal),pdg_type(nexternal)
4200- common /c_fks_inc/fks_j_from_i,particle_type,pdg_type
4201- include 'coupl.inc'
4202- include 'q_es.inc'
4203- double precision p(0:3,nexternal-1),m1l_W_finite_CDR,born
4204- double precision CF,pi,aso2pi,shat,dot,xlgq2os
4205- parameter (CF=4d0/3d0)
4206- parameter (pi=3.1415926535897932385d0)
4207-c
4208- aso2pi=g**2/(8*pi**2)
4209- shat=2d0*dot(p(0,1),p(0,2))
4210- xlgq2os=log(QES2/shat)
4211-
4212-c This is relevant to qqbar -> W
4213- m1l_W_finite_CDR=aso2pi*CF*(-xlgq2os**2-3d0*xlgq2os+pi**2-8d0)
4214- m1l_W_finite_CDR=m1l_W_finite_CDR*born
4215-
4216-c This is relevant to gg -> H
4217-c$$$ m1l_W_finite_CDR=aso2pi*(-3d0*xlgq2os**2+11d0+3d0*pi**2)
4218-c$$$ m1l_W_finite_CDR=m1l_W_finite_CDR*born
4219-
4220-c This is relevant to bbbar -> H
4221-c$$$ m1l_W_finite_CDR=aso2pi
4222-c$$$ f * (-4d0/3d0*xlgq2os**2
4223-c$$$ f -8d0/3d0+(16d0/3d0+8d0/3d0)*pi**2/6d0)
4224-c$$$ m1l_W_finite_CDR=m1l_W_finite_CDR*born
4225- return
4226- end
4227-
4228-
4229 subroutine setfksfactor(match_to_shower)
4230+ use weight_lines
4231+ use extra_weights
4232 implicit none
4233
4234 include 'mint.inc'
4235@@ -5449,11 +5126,9 @@
4236 include 'nexternal.inc'
4237 include 'fks_powers.inc'
4238 include 'nFKSconfigs.inc'
4239- include 'c_weight.inc'
4240 integer fks_j_from_i(nexternal,0:nexternal)
4241 & ,particle_type(nexternal),pdg_type(nexternal)
4242 common /c_fks_inc/fks_j_from_i,particle_type,pdg_type
4243- include 'reweight0.inc'
4244 include 'run.inc'
4245 INTEGER NFKSPROCESS
4246 COMMON/C_NFKSPROCESS/NFKSPROCESS
4247@@ -5473,8 +5148,6 @@
4248 common /cdelta_used/delta_used
4249 double precision xiScut_used,xiBSVcut_used
4250 common /cxiScut_used/xiScut_used,xiBSVcut_used
4251- logical rotategranny
4252- common/crotategranny/rotategranny
4253 double precision diagramsymmetryfactor_save(maxchannels)
4254 save diagramsymmetryfactor_save
4255 double precision diagramsymmetryfactor
4256@@ -5511,10 +5184,6 @@
4257 integer i_type,j_type,m_type
4258 common/cparticle_types/i_type,j_type,m_type
4259
4260-c The value of rotategranny may be superseded later if phase space
4261-c parametrization allows it
4262- rotategranny=.false.
4263-
4264 softtest=.false.
4265 colltest=.false.
4266 fold=0
4267@@ -5691,6 +5360,8 @@
4268 c Compute the identical particle symmetry factor that is in the
4269 c Born matrix elements.
4270 iden_born_FKS(nFKSprocess)=1
4271+ call weight_lines_allocated(nexternal,max_contr,max_wgt
4272+ $ ,max_iproc)
4273 call set_pdg(0,nFKSprocess)
4274 do i=1,nexternal
4275 iden(i)=1
4276@@ -5800,349 +5471,12 @@
4277 end
4278
4279
4280- subroutine get_helicity(i_fks,j_fks)
4281- implicit none
4282- include "nexternal.inc"
4283- include "born_nhel.inc"
4284- include "madfks_mcatnlo.inc"
4285- integer NHEL(nexternal,max_bhel*2),IHEL
4286-chel include "helicities.inc"
4287- include 'nFKSconfigs.inc'
4288- double precision hel_fac
4289- integer get_hel,skip(fks_configs)
4290- common/cBorn/hel_fac,get_hel,skip
4291- logical calculatedBorn
4292- common/ccalculatedBorn/calculatedBorn
4293- integer hel_wgt,hel_wgt_born,hel_wgt_real
4294- integer nhelreal(nexternal,4),goodhelreal(4)
4295- integer nhelrealall(nexternal,max_bhel*2)
4296- common /c_nhelreal/ nhelreal,nhelrealall,goodhelreal,hel_wgt_real
4297- integer nhelborn(nexternal-1,2),goodhelborn(2)
4298- integer nhelbornall(nexternal-1,max_bhel)
4299- common /c_nhelborn/ nhelborn,nhelbornall,goodhelborn,hel_wgt_born
4300-
4301- integer isum_hel
4302- logical multi_channel
4303- common/to_matrix/isum_hel, multi_channel
4304-
4305- integer i,nexthel,j,i_fks,j_fks,ngood,k
4306- data nexthel /0/
4307- data ngood /0/
4308- logical done,firsttime,all_set,chckr
4309- data firsttime/.true./
4310- integer goodhelr(0:4,max_bhel/2),goodhelb(0:2,max_bhel/2)
4311- save goodhelr,goodhelb,all_set,chckr
4312- double precision rnd,ran2
4313- external ran2
4314-
4315- character*4 abrv
4316- common /to_abrv/ abrv
4317- logical Hevents
4318- common/SHevents/Hevents
4319- logical usexinteg,mint
4320- common/cusexinteg/usexinteg,mint
4321-
4322-c Do not change these two lines, because ./bin/compile_madfks.sh might
4323-c need to change them automatically
4324- logical HelSum
4325- parameter (HelSum=.true.)
4326-
4327-c************
4328-c goodhelr=2, real emission matrix element not yet calculated
4329-c for this helicity
4330-c goodhelr=1, real emission matrix element calculated and non-zero
4331-c goodhelr=0, real emission matrix element calculated and zero,
4332-c so can be skipped next time.
4333-c************
4334- if (HelSum) return
4335-
4336- if (isum_hel.ne.0) then ! MC over helicities
4337-c First, set the goodhelr and goodhelb to their starting values
4338- if (firsttime) then
4339- if ((mint .and. (.not.Hevents) .and. (abrv(1:2).eq.'vi' .or.
4340- & abrv.eq.'born' .or. abrv.eq.'grid' .or.
4341- & (.not.UseSudakov))) .or. (.not.mint .and. (abrv.eq.'born'
4342- & .or. abrv.eq.'grid' .or. abrv(1:2).eq.'vi'))) then
4343-c if computing only the Born diagrams, should not
4344-c consider real emission helicities
4345- chckr=.false.
4346- else
4347- chckr=.true.
4348- endif
4349- do i=1,fks_configs
4350- skip(i)=1
4351- enddo
4352-c read from file if possible
4353- open(unit=65,file='goodhel.dat',status='old',err=532)
4354- all_set=.true.
4355- do j=0,4
4356- read (65,*,err=532) (goodhelr(j,i),i=1,max_bhel/2)
4357- enddo
4358- do j=0,2
4359- read (65,*,err=532) (goodhelb(j,i),i=1,max_bhel/2)
4360- enddo
4361- read(65,*,err=532) hel_wgt
4362- hel_wgt_born=hel_wgt
4363- hel_wgt_real=hel_wgt
4364- do i=1,max_bhel/2
4365- if ((chckr .and.
4366- & (goodhelb(0,i).eq.2 .or. goodhelr(0,i).eq.2)) .or.
4367- & (.not.chckr.and.goodhelb(0,i).eq.2)) all_set=.false.
4368- enddo
4369- close(65)
4370- goto 533
4371-c if file does not exist or has wrong format, set all to 2
4372- 532 close(65)
4373- write (*,*) 'Good helicities not found in file'
4374- all_set=.false.
4375- do j=0,4
4376- do i=1,max_bhel/2
4377- goodhelr(j,i)=2
4378- enddo
4379- enddo
4380- do j=0,2
4381- do i=1,max_bhel/2
4382- goodhelb(j,i)=2
4383- enddo
4384- enddo
4385- hel_wgt=max_bhel/2
4386- hel_wgt_born=hel_wgt
4387- hel_wgt_real=hel_wgt
4388- 533 continue
4389- firsttime=.false.
4390- goto 534 ! no previous event, so skip to the next helicity
4391- endif
4392-
4393-c From previous event, check if there is an update
4394- if (.not.all_set) then
4395-c real emission
4396- if(goodhelr(0,ngood).eq.2) then
4397- if ( goodhelreal(1).eq.0 .and.
4398- & goodhelreal(2).eq.0 .and.
4399- & goodhelreal(3).eq.0 .and.
4400- & goodhelreal(4).eq.0 ) then
4401- do j=0,4
4402- goodhelr(j,ngood)=0
4403- enddo
4404- elseif( goodhelreal(1).le.1 .and.
4405- & goodhelreal(2).le.1 .and.
4406- & goodhelreal(3).le.1 .and.
4407- & goodhelreal(4).le.1 ) then
4408- goodhelr(0,ngood)=1
4409- do j=1,4
4410- goodhelr(j,ngood)=goodhelreal(j)
4411- enddo
4412- elseif (.not.(goodhelreal(1).eq.2 .and.
4413- & goodhelreal(2).eq.2 .and.
4414- & goodhelreal(2).eq.2 .and.
4415- & goodhelreal(2).eq.2) ) then
4416- write (*,*) 'Error #2 in get_helicities',
4417- & ngood,(goodhelr(j,ngood),j=0,4)
4418- stop
4419- endif
4420- endif
4421-c Born and counter events
4422- if(goodhelb(0,ngood).eq.2) then
4423- if ( goodhelborn(1).eq.0 .and.
4424- & goodhelborn(2).eq.0 ) then
4425- do j=0,2
4426- goodhelb(j,ngood)=0
4427- enddo
4428- elseif( goodhelborn(1).le.1 .and.
4429- & goodhelborn(2).le.1 ) then
4430- goodhelb(0,ngood)=1
4431- do j=1,2
4432- goodhelb(j,ngood)=goodhelborn(j)
4433- enddo
4434- elseif (.not.(goodhelborn(1).eq.2 .and.
4435- & goodhelborn(2).eq.2) ) then
4436- write (*,*) 'Error #3 in get_helicities',
4437- & nexthel,(goodhelb(j,ngood),j=0,2)
4438- stop
4439- endif
4440- endif
4441-
4442-c Calculate new hel_wgt
4443- hel_wgt=0
4444- do i=1,max_bhel/2
4445- if((chckr .and.
4446- & (goodhelb(0,i).ge.1.or.goodhelr(0,i).ge.1)) .or.
4447- & (.not.chckr .and. goodhelb(0,i).ge.1)) then
4448- hel_wgt=hel_wgt+1
4449- endif
4450- enddo
4451- hel_wgt_born=hel_wgt
4452- hel_wgt_real=hel_wgt
4453-
4454-c check if all have been set, if so -> write to file
4455- all_set=.true.
4456- do i=1,max_bhel/2
4457- if ((chckr .and.
4458- & (goodhelb(0,i).eq.2 .or. goodhelr(0,i).eq.2)) .or.
4459- & (.not.chckr.and.goodhelb(0,i).eq.2)) all_set=.false.
4460- enddo
4461- if (all_set) then
4462- write (*,*) 'All good helicities have been found.',hel_wgt
4463- open(unit=65,file='goodhel.dat',status='unknown')
4464- do j=0,4
4465- write (65,*) (goodhelr(j,i),i=1,max_bhel/2)
4466- enddo
4467- do j=0,2
4468- write (65,*) (goodhelb(j,i),i=1,max_bhel/2)
4469- enddo
4470- write(65,*) hel_wgt
4471- close(65)
4472- endif
4473- else
4474- do i=1,4
4475- if (goodhelr(i,ngood).ne.goodhelreal(i)) then
4476- write (*,*)'Error #4 in get_helicities',i,ngood
4477- stop
4478- endif
4479- enddo
4480- do i=1,2
4481- if (goodhelb(i,ngood).ne.goodhelborn(i)) then
4482- write (*,*)'Error #5 in get_helicities',i,ngood
4483- stop
4484- endif
4485- enddo
4486- endif
4487-
4488-c Get the next helicity
4489- 534 continue
4490- done=.false.
4491- do while (.not.done)
4492- if (nexthel.eq.max_bhel*2) nexthel=0
4493- nexthel=nexthel+1
4494- if(nhel(i_fks,nexthel).eq.1.and.nhel(j_fks,nexthel).eq.1) then
4495- if (ngood.eq.max_bhel/2) ngood=0
4496- ngood=ngood+1
4497- if((chckr .and.
4498- & (goodhelr(0,ngood).ge.1.or.goodhelb(0,ngood).ge.1)).or.
4499- & (.not.chckr .and. goodhelb(0,ngood).ge.1)) then
4500-c Using random number to see if we have to go to the next.
4501-c Probably this is an overkill, but have to make sure that there is
4502-c no bias considering the *semi*-random numbers from VEGAS.
4503- rnd=ran2()
4504- if (rnd.le.1d0/dble(hel_wgt)) then
4505- done=.true.
4506- endif
4507- endif
4508- endif
4509- enddo
4510-
4511- do i=1,nexternal
4512- if (i.eq.i_fks) then
4513- nhelreal(i,1)=1
4514- nhelreal(i,2)=1
4515- nhelreal(i,3)=-1
4516- nhelreal(i,4)=-1
4517- elseif (i.eq.j_fks) then
4518- nhelreal(i,1)=1
4519- nhelreal(i,2)=-1
4520- nhelreal(i,3)=1
4521- nhelreal(i,4)=-1
4522- else
4523- nhelreal(i,1)=nhel(i,nexthel)
4524- nhelreal(i,2)=nhel(i,nexthel)
4525- nhelreal(i,3)=nhel(i,nexthel)
4526- nhelreal(i,4)=nhel(i,nexthel)
4527- endif
4528- enddo
4529- do j=1,4
4530- goodhelreal(j)=goodhelr(j,ngood)
4531- enddo
4532-
4533- do i=1,nexternal-1
4534- if (i.eq.min(i_fks,j_fks)) then
4535- nhelborn(i,1)=1
4536- nhelborn(i,2)=-1
4537- elseif(i.lt.max(i_fks,j_fks)) then
4538- nhelborn(i,1)=nhel(i,nexthel)
4539- nhelborn(i,2)=nhel(i,nexthel)
4540- else
4541- nhelborn(i,1)=nhel(i+1,nexthel)
4542- nhelborn(i,2)=nhel(i+1,nexthel)
4543- endif
4544- enddo
4545- do j=1,2
4546- goodhelborn(j)=goodhelb(j,ngood)
4547- enddo
4548-
4549- else !isum_hel is zero, sum explicitly over helicities
4550-
4551- do i=1,nexternal
4552- do j=1,max_bhel*2
4553- nhelrealall(i,j)=nhel(i,j)
4554- enddo
4555- enddo
4556- do i=1,nexternal-1
4557- k=0
4558- do j=1,max_bhel*2
4559- if (nhel(i_fks,j).eq.-1) then
4560- k=k+1
4561- if (i.lt.i_fks) then
4562- nhelbornall(i,k)=nhel(i,j)
4563- elseif(i.ge.i_fks) then
4564- nhelbornall(i,k)=nhel(i+1,j)
4565- endif
4566- endif
4567- enddo
4568- enddo
4569-
4570- endif
4571- return
4572- end
4573-
4574- function get_ptrel(pp,i_fks,j_fks)
4575- implicit none
4576- include 'nexternal.inc'
4577- double precision get_ptrel,pp(0:3,nexternal)
4578- integer i_fks,j_fks
4579- double precision tmp,psum(3)
4580- integer i
4581-c
4582- if(j_fks.le.2)then
4583- tmp=sqrt(pp(1,i_fks)**2+pp(2,i_fks)**2)
4584- else
4585- do i=1,3
4586- psum(i)=pp(i,i_fks)+pp(i,j_fks)
4587- enddo
4588- tmp=( pp(2,i_fks)*psum(1)-pp(1,i_fks)*psum(2) )**2+
4589- # ( pp(3,i_fks)*psum(1)-pp(1,i_fks)*psum(3) )**2+
4590- # ( pp(3,i_fks)*psum(2)-pp(2,i_fks)*psum(3) )**2
4591- if(tmp.ne.0.d0)tmp=sqrt( tmp/
4592- # (psum(1)**2+psum(2)**2+psum(3)**2) )
4593- endif
4594- get_ptrel=tmp
4595- return
4596- end
4597-
4598-
4599-
4600- FUNCTION FK88RANDOM(SEED)
4601-* -----------------
4602-* Ref.: K. Park and K.W. Miller, Comm. of the ACM 31 (1988) p.1192
4603-* Use seed = 1 as first value.
4604-*
4605- IMPLICIT INTEGER(A-Z)
4606- REAL*8 MINV,FK88RANDOM
4607- SAVE
4608- PARAMETER(M=2147483647,A=16807,Q=127773,R=2836)
4609- PARAMETER(MINV=0.46566128752458d-09)
4610- HI = SEED/Q
4611- LO = MOD(SEED,Q)
4612- SEED = A*LO - R*HI
4613- IF(SEED.LE.0) SEED = SEED + M
4614- FK88RANDOM = SEED*MINV
4615- END
4616-
4617
4618 subroutine set_mu_central(ic,dd,c_mu2_r,c_mu2_f)
4619+ use weight_lines
4620+ use extra_weights
4621 implicit none
4622 include 'nexternal.inc'
4623- include 'c_weight.inc'
4624- include 'reweight0.inc'
4625 include 'run.inc'
4626 integer ic,dd,i,j
4627 double precision c_mu2_r,c_mu2_f,muR,muF,pp(0:3,nexternal)
4628
4629=== modified file 'Template/NLO/SubProcesses/genps_fks.f'
4630--- Template/NLO/SubProcesses/genps_fks.f 2017-05-16 14:24:36 +0000
4631+++ Template/NLO/SubProcesses/genps_fks.f 2017-08-16 21:26:30 +0000
4632@@ -2,8 +2,6 @@
4633 implicit none
4634 include 'genps.inc'
4635 include 'nexternal.inc'
4636-c Timing profile statistics
4637- include 'timing_variables.inc'
4638 integer ndim,iconfig
4639 double precision wgt,x(99),p(0:3,nexternal)
4640 integer iforest(2,-max_branch:-1,lmaxconfigs)
4641@@ -32,8 +30,6 @@
4642 include 'coupl.inc'
4643 include 'born_props.inc'
4644 c
4645- call cpu_time(tBefore)
4646-c
4647 this_config=iconfig
4648 iconf=iconfig
4649 iconfig0=iconfig
4650@@ -56,8 +52,6 @@
4651 enddo
4652 wgt=wgt*jac
4653 c
4654- call cpu_time(tAfter)
4655- tGenPS = tGenPS + (tAfter-tBefore)
4656 return
4657 end
4658
4659@@ -313,8 +307,7 @@
4660 c
4661 c Start by generating all the invariant masses of the s-channels
4662 call generate_inv_mass_sch(ns_channel,itree,m,sqrtshat_born
4663- $ ,totmass,qwidth,qmass,cBW,cBW_level,cBW_mass,cBW_width,s,x
4664- $ ,xjac0,pass)
4665+ $ ,totmass,qwidth,qmass,cBW,cBW_mass,cBW_width,s,x,xjac0,pass)
4666 if (.not.pass) goto 222
4667 c If only s-channels, also set the p1+p2 s-channel
4668 if (nt_channel .eq. 0 .and. nincoming .eq. 2) then
4669@@ -1215,7 +1208,7 @@
4670 integer icountevts,i_fks,j_fks
4671 double precision xbjrk_born(2),tau_born,ycm_born,ycmhat,shat_born
4672 & ,phi_i_fks,xpswgt,xjac,xiimax,xinorm,xp(0:3,nexternal),stot
4673- & ,x(2) ,y_ij_fks
4674+ & ,x(2),y_ij_fks
4675 double precision shat,sqrtshat,tau,ycm,xbjrk(2),p_i_fks(0:3)
4676 logical pass
4677 c common blocks
4678@@ -1575,40 +1568,6 @@
4679 return
4680 end
4681
4682-
4683- function bwfunc(s,xm02,gah)
4684-c Returns the Breit Wigner function, normalized in such a way that
4685-c its integral in the range (-inf,inf) is one
4686- implicit none
4687- real*8 bwfunc,s,xm02,gah
4688- real*8 pi,xm0
4689- parameter (pi=3.1415926535897932d0)
4690-c
4691- xm0=sqrt(xm02)
4692- bwfunc=xm0*gah/(pi*((s-xm02)**2+xm02*gah**2))
4693- return
4694- end
4695-
4696-
4697- function xbwmass3(t,xm02,ga,bwdelf,bwfmmn)
4698-c Returns the boson mass squared, given 0<t<1, the nominal mass (xm0),
4699-c and the mass range (implicit in bwdelf and bwfmmn). This function
4700-c is the inverse of F(M^2), where
4701-c F(M^2)=\int_{xmlow2}^{M^2} ds BW(sqrt(s),M0,Ga)
4702-c BW(M,M0,Ga)=M0 Ga/pi 1/((M^2-M0^2)^2+M0^2 Ga^2
4703-c and therefore eats up the Breit-Wigner when changing integration
4704-c variable M^2 --> t
4705- implicit none
4706- real*8 xbwmass3,t,xm02,ga,bwdelf,bwfmmn
4707- real*8 pi,xm0
4708- parameter (pi=3.1415926535897932d0)
4709-c
4710- xm0=sqrt(xm02)
4711- xbwmass3=xm02+xm0*ga*tan(pi*bwdelf*t-bwfmmn)
4712- return
4713- end
4714-
4715-
4716 subroutine gentcms(pa,pb,t,phi,m1,m2,p1,pr,jac)
4717 c*************************************************************************
4718 c Generates 4 momentum for particle 1, and remainder pr
4719@@ -1774,21 +1733,10 @@
4720 subroutine generate_tau_BW(stot,idim,x,mass,width,cBW,BWmass
4721 $ ,BWwidth,tau,jac)
4722 implicit none
4723- real*8 pi
4724- parameter (pi=3.1415926535897932d0)
4725- integer nsamp
4726- parameter (nsamp=1)
4727- include 'run.inc'
4728- include 'genps.inc'
4729- integer cBW,icount,idim
4730- data icount /0/
4731- double precision stot,x,tau,jac,mass,width,m,w,a,b,BWmass(-1:1)
4732- $ ,BWwidth(-1:1),s,s_mass
4733- double precision smax,smin,xm02,stemp,bwmdpl,bwmdmn,bwfmpl,bwfmmn
4734- double precision bwdelf,xbwmass3,bwfunc,x0
4735- external xmwmass3,bwfunc
4736- double precision tau_Born_lower_bound_save
4737- $ ,tau_lower_bound_resonance_save,tau_lower_bound_save
4738+ integer cBW,idim
4739+ double precision stot,x,tau,jac,mass,width,BWmass(-1:1),BWwidth(
4740+ $ -1:1),s_mass,s
4741+ double precision smax,smin
4742 double precision tau_Born_lower_bound,tau_lower_bound_resonance
4743 & ,tau_lower_bound
4744 common/ctau_lower_bound/tau_Born_lower_bound
4745@@ -1815,18 +1763,15 @@
4746
4747
4748 subroutine generate_tau(stot,idim,x,tau,jac)
4749- double precision x,tau,jac
4750- double precision roH,roHs,fract,ximax0,ximin0,tmp,fract1,fract2
4751- & ,roHj,stot,s,dum,dum3(-1:1),smin,smax,s_mass
4752- integer nsamp,idim
4753- parameter (nsamp=1)
4754+ implicit none
4755+ integer idim
4756+ double precision x,tau,jac,smin,smax,s_mass,s,tiny,dum,dum3(-1:1)
4757+ $ ,stot
4758+ parameter (tiny=1d-8)
4759 double precision tau_Born_lower_bound,tau_lower_bound_resonance
4760- & ,tau_lower_bound,tiny
4761- parameter (tiny=1d-8)
4762+ $ ,tau_lower_bound
4763 common/ctau_lower_bound/tau_Born_lower_bound
4764- & ,tau_lower_bound_resonance,tau_lower_bound
4765- character*4 abrv
4766- common /to_abrv/ abrv
4767+ $ ,tau_lower_bound_resonance,tau_lower_bound
4768 smin=tau_born_lower_bound*stot
4769 smax=stot
4770 s_mass=tau_lower_bound_resonance*stot
4771@@ -1887,11 +1832,8 @@
4772
4773
4774 subroutine generate_inv_mass_sch(ns_channel,itree,m,sqrtshat_born
4775- $ ,totmass,qwidth,qmass,cBW,cBW_level,cBW_mass,cBW_width,s,x
4776- $ ,xjac0,pass)
4777+ $ ,totmass,qwidth,qmass,cBW,cBW_mass,cBW_width,s,x,xjac0,pass)
4778 implicit none
4779- real*8 pi
4780- parameter (pi=3.1415926535897932d0)
4781 include 'genps.inc'
4782 include 'nexternal.inc'
4783 integer ns_channel
4784@@ -1901,18 +1843,12 @@
4785 double precision sqrtshat_born,totmass,xjac0
4786 integer itree(2,-max_branch:-1)
4787 integer i,j,ii,order(-nexternal:0)
4788- double precision smin,smax,xm02,bwmdpl,bwmdmn,bwfmpl,bwfmmn,bwdelf
4789- & ,totalmass,tmp,ximin0,ximax0
4790- double precision xbwmass3,bwfunc
4791- external xbwmass3,bwfunc
4792+ double precision smin,smax,totalmass
4793 logical pass
4794- integer cBW_level_max,cBW(-nexternal:-1),cBW_level(-nexternal:-1)
4795- double precision cBW_mass(-1:1,-nexternal:-1),
4796- & cBW_width(-1:1,-nexternal:-1)
4797- double precision b(-1:1),x0
4798- double precision s_mass(-nexternal:nexternal),xi,fract,vol_new
4799- $ ,shat,x_new
4800- parameter (fract=0.1d0)
4801+ integer cBW(-nexternal:-1)
4802+ double precision cBW_mass(-1:1,-nexternal:-1),cBW_width(-1:1,
4803+ $ -nexternal:-1)
4804+ double precision s_mass(-nexternal:nexternal)
4805 common/to_phase_space_s_channel/s_mass
4806 pass=.true.
4807 totalmass=totmass
4808@@ -2233,9 +2169,8 @@
4809 include 'nexternal.inc'
4810 double precision p_born(0:3,nexternal-1),xmrec2,shat_born
4811 logical pass
4812- integer imother
4813- integer i
4814- double precision recoilbar(0:3),dot,tmp
4815+ integer imother,i
4816+ double precision recoilbar(0:3),dot
4817 external dot
4818 pass=.true.
4819 do i=0,3
4820@@ -2280,15 +2215,10 @@
4821 c itype=6: Conflicting BW on both sides
4822 c
4823 implicit none
4824- include 'nexternal.inc'
4825- include 'run.inc' ! ebeam
4826-c ARGUMENTS
4827 integer itype,idim
4828 double precision x,smin,smax,s_mass,qmass,qwidth,cBW_mass(-1:1)
4829 $ ,cBW_width(-1:1),jac,s
4830-c LOCAL
4831- double precision tmp,vol_new,x_min,x_max,x_new,fract,x_mass,xg,A
4832- $ ,B,C,D,E,F,G,bs(-1:1),maxi,mini
4833+ double precision fract,A,B,C,D,E,F,G,bs(-1:1),maxi,mini
4834 integer j
4835 c
4836 if (itype.eq.1) then
4837
4838=== modified file 'Template/NLO/SubProcesses/handling_lhe_events.f'
4839--- Template/NLO/SubProcesses/handling_lhe_events.f 2016-11-03 15:21:05 +0000
4840+++ Template/NLO/SubProcesses/handling_lhe_events.f 2017-08-16 21:26:30 +0000
4841@@ -1,14 +1,4 @@
4842 c Utility routines for LHEF. Originally taken from collect_events.f
4843-c
4844-c Note: the routines read_lhef_event and write_lhef_event use the common
4845-c blocks in reweight0.inc, relevant to reweight information. This is
4846-c independent of the process, and in particular of process-related
4847-c parameters such as nexternal, which is replaced here by (its supposed)
4848-c upper bound maxparticles. The arrays which have one dimension defined
4849-c by maxparticles may have a correspondence with process-specific ones,
4850-c and the dimensions of the latter are typically defined by nexternal.
4851-c Hence, one may need an explicit copy of one onto the other
4852-c
4853
4854 block data
4855 integer event_id
4856@@ -20,9 +10,9 @@
4857 end
4858
4859 subroutine write_lhef_header(ifile,nevents,MonteCarlo)
4860+ use extra_weights
4861 implicit none
4862 include 'run.inc'
4863- include 'reweight0.inc'
4864 integer idwgt,kk,ii,jj,nn,n
4865 integer ifile,nevents
4866 character*10 MonteCarlo
4867@@ -114,6 +104,7 @@
4868
4869
4870 subroutine write_lhef_header_banner(ifile,nevents,MonteCarlo,path)
4871+ use extra_weights
4872 implicit none
4873 integer ifile, i, idwgt, nevents,iseed,ii,jj,kk,nn,n
4874 double precision mcmass(-16:21)
4875@@ -135,7 +126,6 @@
4876 character*150 buffer,buffer_lc,buffer2
4877 integer event_id
4878 common /c_event_id/ event_id
4879- include 'reweight_all.inc'
4880
4881 c Set the event_id to 0. If 0 or positive, this value will be update
4882 c in write_lhe_event. It is set to -99 through a block data
4883@@ -297,8 +287,8 @@
4884
4885
4886 subroutine read_lhef_header(ifile,nevents,MonteCarlo)
4887+ use extra_weights
4888 implicit none
4889- include 'reweight0.inc'
4890 include './run.inc'
4891 logical already_found
4892 integer ifile,nevents,i,ii,ii2,iistr,itemp
4893@@ -435,8 +425,8 @@
4894 c Avoid overloading read_lhef_header, meant to be used in utilities
4895 subroutine read_lhef_header_full(ifile,nevents,itempsc,itempPDF,
4896 # MonteCarlo)
4897+ use extra_weights
4898 implicit none
4899- include 'reweight0.inc'
4900 include 'run.inc'
4901 logical already_found
4902 integer ifile,nevents,i,ii,ii2,iistr,ipart,itempsc,itempPDF
4903@@ -652,6 +642,7 @@
4904 subroutine write_lhef_event(ifile,
4905 # NUP,IDPRUP,XWGTUP,SCALUP,AQEDUP,AQCDUP,
4906 # IDUP,ISTUP,MOTHUP,ICOLUP,PUP,VTIMUP,SPINUP,buff)
4907+ use extra_weights
4908 implicit none
4909 INTEGER NUP,IDPRUP,IDUP(*),ISTUP(*),MOTHUP(2,*),ICOLUP(2,*)
4910 DOUBLE PRECISION XWGTUP,SCALUP,AQEDUP,AQCDUP,
4911@@ -669,7 +660,6 @@
4912 common/c_i_process/i_process
4913 integer nattr,npNLO,npLO
4914 common/event_attributes/nattr,npNLO,npLO
4915- include 'reweight_all.inc'
4916 include './run.inc'
4917 include 'unlops.inc'
4918 c if event_id is zero or positive (that means that there was a call
4919@@ -824,6 +814,7 @@
4920 subroutine read_lhef_event(ifile,
4921 # NUP,IDPRUP,XWGTUP,SCALUP,AQEDUP,AQCDUP,
4922 # IDUP,ISTUP,MOTHUP,ICOLUP,PUP,VTIMUP,SPINUP,buff)
4923+ use extra_weights
4924 implicit none
4925 INTEGER NUP,IDPRUP,IDUP(*),ISTUP(*),MOTHUP(2,*),ICOLUP(2,*)
4926 DOUBLE PRECISION XWGTUP,SCALUP,AQEDUP,AQCDUP,
4927@@ -842,7 +833,6 @@
4928 common/c_i_process/i_process
4929 integer nattr,npNLO,npLO
4930 common/event_attributes/nattr,npNLO,npLO
4931- include 'reweight_all.inc'
4932 include 'unlops.inc'
4933 include 'run.inc'
4934 c
4935@@ -876,11 +866,27 @@
4936 if(jwgtinfo.eq.-5 .or. jwgtinfo.eq.-9) then
4937 read(ifile,'(a)')string
4938 read(ifile,*) wgtref,n_ctr_found,n_mom_conf,wgtcpower
4939+ if (.not.allocated(momenta_str)) allocate(momenta_str(0:3
4940+ $ ,max_mext,max_mom_str))
4941+ if (n_mom_conf.gt.max_mom_str .or. mexternal.gt.max_mext)
4942+ $ then
4943+ deallocate(momenta_str)
4944+ max_mom_str=max(n_mom_conf,max_mom_str)
4945+ max_mext=max(mexternal,max_mext)
4946+ allocate(momenta_str(0:3,max_mext,max_mom_str))
4947+ endif
4948 do i=1,n_mom_conf
4949 do j=1,mexternal
4950 read (ifile,*) (momenta_str(ii,j,i),ii=0,3)
4951 enddo
4952 enddo
4953+ if (.not.allocated(n_ctr_str))
4954+ $ allocate(n_ctr_str(max_n_ctr))
4955+ if (n_ctr_found.gt.max_n_ctr) then
4956+ deallocate(n_ctr_str)
4957+ max_n_ctr=n_ctr_found
4958+ allocate(n_ctr_str(max_n_ctr))
4959+ endif
4960 do i=1,n_ctr_found
4961 read (ifile,'(a)') n_ctr_str(i)
4962 enddo
4963@@ -955,6 +961,7 @@
4964 subroutine read_lhef_event_catch(ifile,
4965 # NUP,IDPRUP,XWGTUP,SCALUP,AQEDUP,AQCDUP,
4966 # IDUP,ISTUP,MOTHUP,ICOLUP,PUP,VTIMUP,SPINUP,buff)
4967+ use extra_weights
4968 implicit none
4969 INTEGER NUP,IDPRUP,IDUP(*),ISTUP(*),MOTHUP(2,*),ICOLUP(2,*)
4970 DOUBLE PRECISION XWGTUP,SCALUP,AQEDUP,AQCDUP,
4971@@ -973,7 +980,6 @@
4972 common/c_i_process/i_process
4973 integer nattr,npNLO,npLO
4974 common/event_attributes/nattr,npNLO,npLO
4975- include 'reweight_all.inc'
4976 include 'unlops.inc'
4977 include 'run.inc'
4978 c
4979@@ -1008,23 +1014,39 @@
4980 enddo
4981 read(ifile,'(a)')buff
4982 if(buff(1:1).eq.'#')then
4983- read(buff,*)ch1,iSorH_lhe,ifks_lhe,jfks_lhe,
4984+ read(buff,*)ch1,iSorH_lhe,ifks_lhe,jfks_lhe,
4985 # fksfather_lhe,ipartner_lhe,
4986 # scale1_lhe,scale2_lhe,
4987 # jwgtinfo,mexternal,iwgtnumpartn,
4988 # wgtcentral,wgtmumin,wgtmumax,wgtpdfmin,wgtpdfmax
4989- if(jwgtinfo.eq.-5 .or. jwgtinfo.eq.-9) then
4990- read(ifile,'(a)')string
4991- read(ifile,*) wgtref,n_ctr_found,n_mom_conf,wgtcpower
4992- do i=1,n_mom_conf
4993- do j=1,mexternal
4994- read (ifile,*) (momenta_str(ii,j,i),ii=0,3)
4995- enddo
4996- enddo
4997- do i=1,n_ctr_found
4998- read (ifile,'(a)') n_ctr_str(i)
4999- enddo
5000- read(ifile,'(a)')string
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches

to all changes: