Merge lp:~maddevelopers/mg5amcnlo/3.0.1 into lp:~maddevelopers/mg5amcnlo/FKS_EW_granny

Proposed by Rikkert Frederix on 2018-10-04
Status: Merged
Merge reported by: Olivier Mattelaer
Merged at revision: not available
Proposed branch: lp:~maddevelopers/mg5amcnlo/3.0.1
Merge into: lp:~maddevelopers/mg5amcnlo/FKS_EW_granny
Diff against target: 48081 lines (+15230/-26000)
241 files modified
MadSpin/decay.py (+12/-3)
MadSpin/interface_madspin.py (+342/-174)
MadSpin/madspin (+19/-21)
MadSpin/src/driver.f (+5/-5)
Template/LO/Cards/run_card.dat (+1/-1)
Template/LO/SubProcesses/genps.f (+7/-18)
Template/LO/SubProcesses/reweight.f (+102/-10)
Template/LO/SubProcesses/unwgt.f (+11/-0)
Template/NLO/FixedOrderAnalysis/analysis_HwU_general.f (+880/-0)
Template/NLO/MCatNLO/Makefile_MadFKS (+1/-1)
Template/NLO/SubProcesses/MC_integer.f (+3/-6)
Template/NLO/SubProcesses/analysis_lhe.f (+31/-15)
Template/NLO/SubProcesses/check_poles.f (+2/-2)
Template/NLO/SubProcesses/combine_plots_FO.sh (+56/-110)
Template/NLO/SubProcesses/driver_mintFO.f (+53/-23)
Template/NLO/SubProcesses/driver_mintMC.f (+8/-14)
Template/NLO/SubProcesses/fks_singular.f (+19/-9)
Template/NLO/SubProcesses/genps_fks.f (+1/-1)
Template/NLO/SubProcesses/makefile (+0/-6)
Template/NLO/SubProcesses/mint-integrator2.f (+4/-4)
Template/NLO/SubProcesses/montecarlocounter.f (+3259/-3231)
Template/NLO/SubProcesses/read40.for (+1/-1)
Template/NLO/SubProcesses/split40.f (+0/-51)
Template/NLO/SubProcesses/symmetry_fks_v3.f (+52/-9)
UpdateNotes.txt (+55/-3)
VERSION (+2/-3)
aloha/aloha_writers.py (+24/-7)
aloha/create_aloha.py (+3/-4)
madgraph/core/base_objects.py (+8/-2)
madgraph/fks/fks_base.py (+7/-2)
madgraph/fks/fks_helas_objects.py (+1/-1)
madgraph/interface/amcatnlo_interface.py (+23/-10)
madgraph/interface/amcatnlo_run_interface.py (+91/-106)
madgraph/interface/common_run_interface.py (+106/-26)
madgraph/interface/extended_cmd.py (+40/-11)
madgraph/interface/launch_ext_program.py (+15/-10)
madgraph/interface/loop_interface.py (+13/-5)
madgraph/interface/madevent_interface.py (+32/-11)
madgraph/interface/madgraph_interface.py (+57/-16)
madgraph/interface/reweight_interface.py (+13/-5)
madgraph/iolibs/export_fks.py (+16/-6)
madgraph/iolibs/export_v4.py (+43/-34)
madgraph/iolibs/file_writers.py (+3/-3)
madgraph/iolibs/files.py (+3/-0)
madgraph/iolibs/template_files/matrix_standalone_splitOrders_v4.inc (+2/-2)
madgraph/iolibs/template_files/matrix_standalone_v4.inc (+1/-1)
madgraph/iolibs/ufo_expression_parsers.py (+240/-12)
madgraph/loop/loop_exporters.py (+15/-1)
madgraph/loop/loop_helas_objects.py (+3/-3)
madgraph/madevent/gen_crossxhtml.py (+18/-2)
madgraph/madevent/sum_html.py (+7/-1)
madgraph/various/banner.py (+44/-18)
madgraph/various/hepmc_parser.py (+362/-0)
madgraph/various/lhe_parser.py (+61/-7)
madgraph/various/misc.py (+4/-3)
madgraph/various/systematics.py (+1/-0)
mg5decay/decay_objects.py (+1/-1)
models/check_param_card.py (+9/-5)
models/import_ufo.py (+380/-37)
models/model_reader.py (+7/-1)
models/write_param_card.py (+2/-2)
tests/IOTests.py (+11/-5)
tests/acceptance_tests/test_cmd_amcatnlo.py (+13/-6)
tests/acceptance_tests/test_cmd_madevent.py (+36/-9)
tests/acceptance_tests/test_cmd_madloop.py (+2/-2)
tests/acceptance_tests/test_cmd_reweight.py (+2/-2)
tests/acceptance_tests/test_madspin.py (+166/-0)
tests/acceptance_tests/test_madweight.py (+6/-6)
tests/acceptance_tests/test_model_equivalence.py (+8/-6)
tests/input_files/DM_pion/CT_couplings.py (+1731/-0)
tests/input_files/DM_pion/CT_vertices.py (+1291/-0)
tests/input_files/DM_pion/__init__.py (+48/-0)
tests/input_files/DM_pion/coupling_orders.py (+25/-0)
tests/input_files/DM_pion/couplings.py (+563/-0)
tests/input_files/DM_pion/decays.py (+113/-0)
tests/input_files/DM_pion/function_library.py (+71/-0)
tests/input_files/DM_pion/lorentz.py (+182/-0)
tests/input_files/DM_pion/object_library.py (+377/-0)
tests/input_files/DM_pion/param_pion.dat (+183/-0)
tests/input_files/DM_pion/parameters.py (+858/-0)
tests/input_files/DM_pion/particles.py (+489/-0)
tests/input_files/DM_pion/propagators.py (+35/-0)
tests/input_files/DM_pion/py.py (+67/-0)
tests/input_files/DM_pion/vertices.py (+1007/-0)
tests/input_files/DM_pion/write_param_card.py (+207/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_gg_ttx%configs_and_props_info.dat (+0/-1358)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_gg_ttx%iproc.dat (+0/-1)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_gg_ttx%leshouche_info.dat (+0/-143)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_uux_ttx%configs_and_props_info.dat (+0/-504)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_uux_ttx%iproc.dat (+0/-1)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_uux_ttx%leshouche_info.dat (+0/-123)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_uxu_ttx%configs_and_props_info.dat (+0/-504)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_uxu_ttx%iproc.dat (+0/-1)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_uxu_ttx%leshouche_info.dat (+0/-123)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksrealew/%SubProcesses%P0_ag_ttx%configs_and_props_info.dat (+0/-709)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksrealew/%SubProcesses%P0_ag_ttx%iproc.dat (+0/-1)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksrealew/%SubProcesses%P0_ag_ttx%leshouche_info.dat (+0/-64)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksrealew/%SubProcesses%P0_ddx_ttx%born.f (+1/-1)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksrealew/%SubProcesses%P0_ddx_ttx%configs_and_props_info.dat (+0/-1668)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksrealew/%SubProcesses%P0_ddx_ttx%iproc.dat (+0/-1)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksrealew/%SubProcesses%P0_ddx_ttx%leshouche_info.dat (+0/-147)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksrealew/%SubProcesses%P0_ddx_ttx%matrix_3.f (+3/-3)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksrealew/%SubProcesses%P0_ddx_ttx%matrix_4.f (+3/-3)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksrealew/%SubProcesses%P0_ddx_ttx%matrix_6.f (+3/-3)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksrealew/%SubProcesses%P0_dxd_ttx%born.f (+1/-1)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksrealew/%SubProcesses%P0_dxd_ttx%configs_and_props_info.dat (+0/-1668)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksrealew/%SubProcesses%P0_dxd_ttx%iproc.dat (+0/-1)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksrealew/%SubProcesses%P0_dxd_ttx%leshouche_info.dat (+0/-147)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksrealew/%SubProcesses%P0_dxd_ttx%matrix_3.f (+3/-3)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksrealew/%SubProcesses%P0_dxd_ttx%matrix_4.f (+3/-3)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksrealew/%SubProcesses%P0_dxd_ttx%matrix_6.f (+3/-3)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksrealew/%SubProcesses%P0_ga_ttx%configs_and_props_info.dat (+0/-709)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksrealew/%SubProcesses%P0_ga_ttx%iproc.dat (+0/-1)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksrealew/%SubProcesses%P0_ga_ttx%leshouche_info.dat (+0/-64)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksrealew/%SubProcesses%P0_gg_ttx%configs_and_props_info.dat (+0/-2012)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksrealew/%SubProcesses%P0_gg_ttx%iproc.dat (+0/-1)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksrealew/%SubProcesses%P0_gg_ttx%leshouche_info.dat (+0/-129)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksrealew/%SubProcesses%P0_gg_ttx%matrix_1.f (+3/-3)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksrealew/%SubProcesses%P0_gg_ttx%matrix_2.f (+3/-3)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksrealew/%SubProcesses%P0_gg_ttx%matrix_5.f (+3/-3)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksrealew/%SubProcesses%P0_gg_ttx%matrix_6.f (+3/-3)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksrealew/%SubProcesses%P0_uux_ttx%configs_and_props_info.dat (+0/-1668)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksrealew/%SubProcesses%P0_uux_ttx%iproc.dat (+0/-1)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksrealew/%SubProcesses%P0_uux_ttx%leshouche_info.dat (+0/-147)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksrealew/%SubProcesses%P0_uxu_ttx%configs_and_props_info.dat (+0/-1668)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksrealew/%SubProcesses%P0_uxu_ttx%iproc.dat (+0/-1)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksrealew/%SubProcesses%P0_uxu_ttx%leshouche_info.dat (+0/-147)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%CT_interface.f (+7/-264)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%GOLEM_interface.f (+0/-748)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%TIR_interface.f (+4/-12)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%born_matrix.f (+2/-2)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%loop_matrix.f (+3/-3)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%V0_udx_wp%CT_interface.f (+7/-264)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%V0_udx_wp%GOLEM_interface.f (+0/-748)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%V0_udx_wp%TIR_interface.f (+4/-12)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%V0_udx_wp%born_matrix.f (+2/-2)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%V0_udx_wp%loop_matrix.f (+3/-3)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_tdecay_fksreal/%SubProcesses%P0_t_budx%configs_and_props_info.dat (+0/-261)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_tdecay_fksreal/%SubProcesses%P0_t_budx%iproc.dat (+0/-1)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_tdecay_fksreal/%SubProcesses%P0_t_budx%leshouche_info.dat (+0/-33)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_wprod_fksew/%SubProcesses%P0_dxu_veep%MadLoop5_resources%ColorDenomFactors.dat (+0/-50)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_wprod_fksew/%SubProcesses%P0_dxu_veep%MadLoop5_resources%ColorNumFactors.dat (+0/-50)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_wprod_fksew/%SubProcesses%P0_dxu_veep%MadLoop5_resources%HelConfigs.dat (+0/-16)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_wprod_fksew/%SubProcesses%P0_dxu_veep%V0_dxu_veep%CT_interface.f (+19/-270)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_wprod_fksew/%SubProcesses%P0_dxu_veep%V0_dxu_veep%GOLEM_interface.f (+0/-748)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_wprod_fksew/%SubProcesses%P0_dxu_veep%V0_dxu_veep%TIR_interface.f (+4/-12)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_wprod_fksew/%SubProcesses%P0_dxu_veep%V0_dxu_veep%born_matrix.f (+5/-5)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_wprod_fksew/%SubProcesses%P0_dxu_veep%V0_dxu_veep%coef_construction_1.f (+16/-14)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_wprod_fksew/%SubProcesses%P0_dxu_veep%V0_dxu_veep%f2py_wrapper.f (+37/-2)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_wprod_fksew/%SubProcesses%P0_dxu_veep%V0_dxu_veep%helas_calls_ampb_1.f (+7/-8)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_wprod_fksew/%SubProcesses%P0_dxu_veep%V0_dxu_veep%improve_ps.f (+24/-3)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_wprod_fksew/%SubProcesses%P0_dxu_veep%V0_dxu_veep%loop_matrix.f (+21/-3)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_wprod_fksew/%SubProcesses%P0_dxu_veep%V0_dxu_veep%mp_coef_construction_1.f (+16/-16)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_wprod_fksew/%SubProcesses%P0_dxu_veep%V0_dxu_veep%mp_helas_calls_ampb_1.f (+6/-7)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_wprod_fksew/%SubProcesses%P0_dxu_veep%configs_and_props_info.dat (+0/-347)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_wprod_fksew/%SubProcesses%P0_dxu_veep%iproc.dat (+0/-1)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_wprod_fksew/%SubProcesses%P0_dxu_veep%leshouche_info.dat (+0/-43)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_wprod_fksew/%SubProcesses%P0_dxu_veep%matrix_1.f (+1/-1)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_wprod_fksew/%SubProcesses%P0_dxu_veep%matrix_2.f (+1/-1)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_wprod_fksew/%SubProcesses%P0_dxu_veep%matrix_3.f (+1/-1)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_wprod_fksew/%SubProcesses%P0_udx_veep%MadLoop5_resources%ColorDenomFactors.dat (+0/-50)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_wprod_fksew/%SubProcesses%P0_udx_veep%MadLoop5_resources%ColorNumFactors.dat (+0/-50)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_wprod_fksew/%SubProcesses%P0_udx_veep%MadLoop5_resources%HelConfigs.dat (+0/-16)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_wprod_fksew/%SubProcesses%P0_udx_veep%V0_udx_veep%CT_interface.f (+19/-270)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_wprod_fksew/%SubProcesses%P0_udx_veep%V0_udx_veep%GOLEM_interface.f (+0/-748)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_wprod_fksew/%SubProcesses%P0_udx_veep%V0_udx_veep%TIR_interface.f (+4/-12)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_wprod_fksew/%SubProcesses%P0_udx_veep%V0_udx_veep%born_matrix.f (+5/-5)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_wprod_fksew/%SubProcesses%P0_udx_veep%V0_udx_veep%coef_construction_1.f (+16/-14)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_wprod_fksew/%SubProcesses%P0_udx_veep%V0_udx_veep%f2py_wrapper.f (+37/-2)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_wprod_fksew/%SubProcesses%P0_udx_veep%V0_udx_veep%helas_calls_ampb_1.f (+7/-8)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_wprod_fksew/%SubProcesses%P0_udx_veep%V0_udx_veep%improve_ps.f (+24/-3)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_wprod_fksew/%SubProcesses%P0_udx_veep%V0_udx_veep%loop_matrix.f (+21/-3)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_wprod_fksew/%SubProcesses%P0_udx_veep%V0_udx_veep%mp_coef_construction_1.f (+17/-17)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_wprod_fksew/%SubProcesses%P0_udx_veep%V0_udx_veep%mp_helas_calls_ampb_1.f (+6/-7)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_wprod_fksew/%SubProcesses%P0_udx_veep%configs_and_props_info.dat (+0/-347)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_wprod_fksew/%SubProcesses%P0_udx_veep%iproc.dat (+0/-1)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_wprod_fksew/%SubProcesses%P0_udx_veep%leshouche_info.dat (+0/-43)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_wprod_fksew/%SubProcesses%P0_udx_veep%matrix_1.f (+1/-1)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_wprod_fksew/%SubProcesses%P0_udx_veep%matrix_2.f (+1/-1)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_wprod_fksew/%SubProcesses%P0_udx_veep%matrix_3.f (+1/-1)
tests/input_files/IOTestsComparison/IOExportV4IOTest/export_matrix_element_v4_standalone/matrix.f (+1/-1)
tests/input_files/IOTestsComparison/MECmdShell/check_html_long_process_strings/info.html (+80/-80)
tests/input_files/IOTestsComparison/MadLoop_output_from_the_interface/TIR_output/%ggttx_IOTest%SubProcesses%P0_gg_ttx%CT_interface.f (+23/-279)
tests/input_files/IOTestsComparison/MadLoop_output_from_the_interface/TIR_output/%ggttx_IOTest%SubProcesses%P0_gg_ttx%GOLEM_interface.f (+0/-823)
tests/input_files/IOTestsComparison/MadLoop_output_from_the_interface/TIR_output/%ggttx_IOTest%SubProcesses%P0_gg_ttx%TIR_interface.f (+4/-12)
tests/input_files/IOTestsComparison/MadLoop_output_from_the_interface/TIR_output/%ggttx_IOTest%SubProcesses%P0_gg_ttx%born_matrix.f (+2/-2)
tests/input_files/IOTestsComparison/MadLoop_output_from_the_interface/TIR_output/%ggttx_IOTest%SubProcesses%P0_gg_ttx%loop_matrix.f (+3/-3)
tests/input_files/IOTestsComparison/SquaredOrder_IOTest/sqso_uux_uuxuuxx/matrix_NoSQSO.f (+1/-1)
tests/input_files/IOTestsComparison/SquaredOrder_IOTest/sqso_uux_uuxuuxx/matrix_QCDsq_le_6.f (+2/-2)
tests/input_files/IOTestsComparison/SquaredOrder_IOTest/sqso_uux_uuxuuxx/matrix_ampOrderQED2_eq_2_WGTsq_le_14_QCDsq_gt_4.f (+2/-2)
tests/input_files/IOTestsComparison/TestCmdMatchBox/MatchBoxOutput/%TEST%SubProcesses%P0_wpwm_wpwm%matrix.f (+8/-8)
tests/input_files/IOTestsComparison/TestCmdMatchBox/MatchBoxOutput/%TEST%SubProcesses%P1_uux_uux%CT_interface.f (+15/-273)
tests/input_files/IOTestsComparison/TestCmdMatchBox/MatchBoxOutput/%TEST%SubProcesses%P1_uux_uux%GOLEM_interface.f (+0/-755)
tests/input_files/IOTestsComparison/TestCmdMatchBox/MatchBoxOutput/%TEST%SubProcesses%P1_uux_uux%TIR_interface.f (+4/-12)
tests/input_files/IOTestsComparison/TestCmdMatchBox/MatchBoxOutput/%TEST%SubProcesses%P1_uux_uux%loop_matrix.f (+3/-3)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/dux_mumvmxg/%..%..%Source%MODEL%model_functions.f (+0/-21)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/dux_mumvmxg/%..%..%Source%MODEL%model_functions.inc (+0/-2)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/dux_mumvmxg/born_matrix.f (+1/-1)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/gg_wmtbx/%..%..%Source%MODEL%model_functions.f (+0/-21)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/gg_wmtbx/%..%..%Source%MODEL%model_functions.inc (+0/-2)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/gg_wmtbx/born_matrix.f (+1/-1)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/dux_mumvmxg/%..%..%Source%MODEL%model_functions.f (+0/-21)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/dux_mumvmxg/%..%..%Source%MODEL%model_functions.inc (+0/-2)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/dux_mumvmxg/born_matrix.f (+1/-1)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/gg_wmtbx/%..%..%Source%MODEL%model_functions.f (+0/-21)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/gg_wmtbx/%..%..%Source%MODEL%model_functions.inc (+0/-2)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/gg_wmtbx/born_matrix.f (+1/-1)
tests/input_files/IOTestsComparison/short_ML_SMQCD_LoopInduced/gg_hh/%..%..%Source%MODEL%model_functions.f (+0/-21)
tests/input_files/IOTestsComparison/short_ML_SMQCD_LoopInduced/gg_hh/%..%..%Source%MODEL%model_functions.inc (+0/-2)
tests/input_files/IOTestsComparison/short_ML_SMQCD_default/ddx_ttx/born_matrix.f (+1/-1)
tests/input_files/IOTestsComparison/short_ML_SMQCD_default/gg_ttx/%..%..%Source%MODEL%model_functions.f (+0/-21)
tests/input_files/IOTestsComparison/short_ML_SMQCD_default/gg_ttx/%..%..%Source%MODEL%model_functions.inc (+0/-2)
tests/input_files/IOTestsComparison/short_ML_SMQCD_default/gg_ttx/born_matrix.f (+1/-1)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/ddx_ttx/born_matrix.f (+1/-1)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/gg_ttx/%..%..%Source%MODEL%model_functions.f (+0/-21)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/gg_ttx/%..%..%Source%MODEL%model_functions.inc (+0/-2)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/gg_ttx/born_matrix.f (+1/-1)
tests/parallel_tests/madevent_comparator.py (+2/-2)
tests/parallel_tests/me_comparator.py (+3/-5)
tests/parallel_tests/test_ML5.py (+1/-1)
tests/parallel_tests/test_ML5MSSMQCD.py (+1/-1)
tests/parallel_tests/test_aloha.py (+168/-2)
tests/parallel_tests/test_cmd_amcatnlo.py (+5/-3)
tests/parallel_tests/test_madweight.py (+3/-3)
tests/test_manager.py (+1/-1)
tests/time_db (+80/-78)
tests/unit_tests/fks/test_extra_ew.py (+26/-3)
tests/unit_tests/fks/test_fks_base.py (+10/-10)
tests/unit_tests/iolibs/test_export_v4.py (+1/-1)
tests/unit_tests/iolibs/test_helas_call_writers.py (+30/-30)
tests/unit_tests/iolibs/test_link_to_ufo.py (+7/-2)
tests/unit_tests/iolibs/test_ufo_parsers.py (+56/-3)
tests/unit_tests/madspin/test_madspin.py (+7/-0)
tests/unit_tests/various/test_banner.py (+19/-0)
tests/unit_tests/various/test_decay.py (+2/-2)
tests/unit_tests/various/test_import_ufo.py (+138/-8)
tests/unit_tests/various/test_misc.py (+48/-7)
vendor/CutTools/src/makefile (+10/-4)
vendor/CutTools/src/qcdloop/aaxex.f (+1/-1)
vendor/IREGI/src/qcdloop/ff/aaxex.f (+1/-1)
vendor/IREGI/src/qcdloop/ff/makefile (+1/-1)
To merge this branch: bzr merge lp:~maddevelopers/mg5amcnlo/3.0.1
Reviewer Review Type Date Requested Status
Olivier Mattelaer 2018-10-04 Approve on 2018-12-19
marco zaro 2018-10-04 Needs Fixing on 2018-11-21
Hua-Sheng Shao 2018-10-04 Pending
Valentin Hirschi 2018-10-04 Pending
davide.pagani.85 2018-10-04 Pending
Review via email: mp+356133@code.launchpad.net

Commit message

Hi guys,

Before getting super excited and doing lots of test for the 4FS, we should release this code first...

Note: I proposed for merging with the FKS_EW_granny branch -- I don't know if this is exactly the branch relevant to the 3.0.0 release.

Cheers,
Rik

To post a comment you must log in.
marco zaro (marco-zaro) wrote :

have we enabled the NLO+PS for QCD only?

Rikkert Frederix (frederix) wrote :

It's not enabled. We should. Could you please do this?

lp:~maddevelopers/mg5amcnlo/3.0.1 updated on 2018-10-04
942. By marco zaro on 2018-10-04

fixes in amcatnlo_run_interface.py to enable NLOPS for QCD-only
not fully working yet

marco zaro (marco-zaro) wrote :

I have pushed a fix, however, it is not complete yet (and the behaviour is quite strange)
for example, I cannot set fixed_order=OFF via the switches.
However, ./bin/generate_events aMC@NLO works as expected (and herwig is compiled and run too), however on the screen the printout one gets is
launch aMC@NLO
The following switches determine which programs are run:
/================== Description ===================|================= values =================|======== other options =========\
| 1. Type of perturbative computation | order = NLO | LO |
| 2. No MC@[N]LO matching / event generation | fixed_order = ON ⇐ ̶O̶F̶F̶ ̶ | ON |
| 3. Shower the generated events | shower = OFF ⇐ ̶H̶E̶R̶W̶I̶G̶6̶ ̶ | OFF|PYTHIA6Q|PYTHIA6PT |
| 4. Decay onshell particles | madspin = OFF | ON|onshell |
| 5. Add weights to events for new hypp. | reweight = OFF | ON|NLO|NLO_TREE|LO |
| 6. Run MadAnalysis5 on the events generated | madanalysis = Not Avail. | Please install module |
\==============================================================================================================================/
Either type the switch number (1 to 6) to change its setting,

which looks weird…
can anyone who knows better the business of these switches have a look?

thanks!
cheers,

Marco

> On 4 Oct 2018, at 15:07, Rikkert Frederix <email address hidden> wrote:
>
> It's not enabled. We should. Could you please do this?
> --
> https://code.launchpad.net/~maddevelopers/mg5amcnlo/3.0.1/+merge/356133
> You are requested to review the proposed merge of lp:~maddevelopers/mg5amcnlo/3.0.1 into lp:~maddevelopers/mg5amcnlo/FKS_EW_granny.

lp:~maddevelopers/mg5amcnlo/3.0.1 updated on 2018-10-04
943. By Rikkert Frederix on 2018-10-04

fixed the switches

Rikkert Frederix (frederix) wrote :

Hi,

A small change means that the switches are okay now for the QCD stuff. However, for QED, the formatting looks off. I'm not sure we should be too worried about this, since it works correctly. If there is a simple fix, we might apply it.

Cheers,
Rikkert

lp:~maddevelopers/mg5amcnlo/3.0.1 updated on 2018-10-04
944. By marco zaro on 2018-10-04

small fix

Hi Rikkert,

The display is actually perfect for QED (see below):

The following switches determine which programs are run:
/================== Description ==================|=========== values ===========|================ other options ================\
| 1. Type of perturbative computation | order = NLO | LO |
| 2. No MC@[N]LO matching / event generation | fixed_order = ON | No NLO+PS available for EW correction |
\================================================================================================================================/
Either type the switch number (1 to 6) to change its setting,
Set any switch explicitly (e.g. type 'madspin=onshell' at the prompt)
Type 'help' for the list of all valid option
Type '0', 'auto', 'done' or just press enter when you are done.[60s to answer]

Maybe are you referring to the display in debug mode, which include the hidden line (madspin/...)
which are important to see (but only in debug mode). [Also for the hidden option of MadSpin]
In that case, formatting is indeed weird.
I have (slightly) improve it
1) passing the color to green (more consistent with debug coloring in general)
2) fixing the change of length due to the presence of the coloring
This is still not perfect since the length of each column does not take into account those hidden line.
and therefore they can go to overflow.

Cheers,

Olivier

> On 4 Oct 2018, at 17:16, Rikkert Frederix <email address hidden> wrote:
>
> Hi,
>
> A small change means that the switches are okay now for the QCD stuff. However, for QED, the formatting looks off. I'm not sure we should be too worried about this, since it works correctly. If there is a simple fix, we might apply it.
>
> Cheers,
> Rikkert
>
> --
> https://code.launchpad.net/~maddevelopers/mg5amcnlo/3.0.1/+merge/356133
> You are requested to review the proposed merge of lp:~maddevelopers/mg5amcnlo/3.0.1 into lp:~maddevelopers/mg5amcnlo/FKS_EW_granny.

lp:~maddevelopers/mg5amcnlo/3.0.1 updated on 2018-10-04
945. By olivier-mattelaer on 2018-10-04

fix some question formatting for hidden line [debgug mode only]

Download full text (4.6 KiB)

Hi,

I run (some of) the test this morning (actually 630 of thoses)
and this one sounds quite bad:

ERROR: test_generate_fks_ew (tests.unit_tests.fks.test_extra_ew.TestAMCatNLOEW)
check that the generate command works as expected.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/omattelaer/Documents/workspace/3.0.1/tests/unit_tests/fks/test_extra_ew.py", line 112, in test_generate_fks_ew
    self.assertEqual(set(split), self.interface._fks_multi_proc['splitting_types'])
  File "/Users/omattelaer/Documents/workspace/3.0.1/madgraph/core/base_objects.py", line 69, in __getitem__
    self.is_valid_prop(name) #raise the correct error
  File "/Users/omattelaer/Documents/workspace/3.0.1/madgraph/core/base_objects.py", line 86, in is_valid_prop
    Valid property are %s""" % (name,self.__class__.__name__, self.keys())
PhysicsObjectError: splitting_types is not a valid property for this object: FKSMultiProcess

    Valid property are ['has_isr', 'use_numerical', 'amplitudes', 'born_processes', 'pdgs', 'ignore_six_quark_processes', 'collect_mirror_procs', 'process_definitions', 'OLP', 'real_amplitudes', 'init_lep_split', 'diagram_filter', 'ncores_for_proc_gen', 'has_fsr', 'loop_filter']

some other crashes like this one:

======================================================================
FAIL: testIO_test_wprod_fksew (tests.unit_tests.iolibs.test_export_fks.IOExportFKSTest)
target: SubProcesses/[P0.*\/.+\.(inc|f)]
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/omattelaer/Documents/workspace/3.0.1/tests/IOTests.py", line 257, in __wrapper
    testKeys=[(testGroup, newTestName)])
  File "/Users/omattelaer/Documents/workspace/3.0.1/tests/IOTests.py", line 700, in runIOTests
    self.assertFileContains(open(file_path), goal)
  File "/Users/omattelaer/Documents/workspace/3.0.1/tests/IOTests.py", line 389, in assertFileContains
    self.assertEqual(a,b)
AssertionError: ' CALL FFV1_2(W(1,4),W(1,2),GC_3,DCMPLX(ZERO),W(1,8))' != ' CALL FFV1_2(W(1,4),W(1,2),-GC_4,DCMPLX(ZERO),W(1,8))'

Which should be related to model optimization include in 2.6.3. I believe that this is fine (amy does not agree?)

Cheers,

Olivier

On 4 Oct 2018, at 23:24, Olivier Mattelaer <<email address hidden><mailto:<email address hidden>>> wrote:

Hi Rikkert,

The display is actually perfect for QED (see below):

The following switches determine which programs are run:
/================== Description ==================|=========== values ===========|================ other options ================\
| 1. Type of perturbative computation | order = NLO | LO |
| 2. No MC@[N]LO matching / event generation | fixed_order = ON | No NLO+PS available for EW correction |
\================================================================================================================================/
Either type the switch number (1 to 6) to change its setting,
Set any switch explicitly (e.g. type 'madspin=onshell' at the prompt)
T...

Read more...

lp:~maddevelopers/mg5amcnlo/3.0.1 updated on 2018-10-05
946. By marco zaro on 2018-10-05

fixed one test

marco zaro (marco-zaro) wrote :
Download full text (5.4 KiB)

Hi Olivier,
the test you mentioned below was simply not updated after a change I did.
Now it is passing.

Cheers,

Marco

> On 5 Oct 2018, at 09:48, Olivier Mattelaer <email address hidden> wrote:
>
> Hi,
>
> I run (some of) the test this morning (actually 630 of thoses)
> and this one sounds quite bad:
>
> ERROR: test_generate_fks_ew (tests.unit_tests.fks.test_extra_ew.TestAMCatNLOEW)
> check that the generate command works as expected.
> ----------------------------------------------------------------------
> Traceback (most recent call last):
> File "/Users/omattelaer/Documents/workspace/3.0.1/tests/unit_tests/fks/test_extra_ew.py", line 112, in test_generate_fks_ew
> self.assertEqual(set(split), self.interface._fks_multi_proc['splitting_types'])
> File "/Users/omattelaer/Documents/workspace/3.0.1/madgraph/core/base_objects.py", line 69, in __getitem__
> self.is_valid_prop(name) #raise the correct error
> File "/Users/omattelaer/Documents/workspace/3.0.1/madgraph/core/base_objects.py", line 86, in is_valid_prop
> Valid property are %s""" % (name,self.__class__.__name__, self.keys())
> PhysicsObjectError: splitting_types is not a valid property for this object: FKSMultiProcess
>
> Valid property are ['has_isr', 'use_numerical', 'amplitudes', 'born_processes', 'pdgs', 'ignore_six_quark_processes', 'collect_mirror_procs', 'process_definitions', 'OLP', 'real_amplitudes', 'init_lep_split', 'diagram_filter', 'ncores_for_proc_gen', 'has_fsr', 'loop_filter']
>
> some other crashes like this one:
>
> ======================================================================
> FAIL: testIO_test_wprod_fksew (tests.unit_tests.iolibs.test_export_fks.IOExportFKSTest)
> target: SubProcesses/[P0.*\/.+\.(inc|f)]
> ----------------------------------------------------------------------
> Traceback (most recent call last):
> File "/Users/omattelaer/Documents/workspace/3.0.1/tests/IOTests.py", line 257, in __wrapper
> testKeys=[(testGroup, newTestName)])
> File "/Users/omattelaer/Documents/workspace/3.0.1/tests/IOTests.py", line 700, in runIOTests
> self.assertFileContains(open(file_path), goal)
> File "/Users/omattelaer/Documents/workspace/3.0.1/tests/IOTests.py", line 389, in assertFileContains
> self.assertEqual(a,b)
> AssertionError: ' CALL FFV1_2(W(1,4),W(1,2),GC_3,DCMPLX(ZERO),W(1,8))' != ' CALL FFV1_2(W(1,4),W(1,2),-GC_4,DCMPLX(ZERO),W(1,8))'
>
>
> Which should be related to model optimization include in 2.6.3. I believe that this is fine (amy does not agree?)
>
> Cheers,
>
> Olivier
>
> On 4 Oct 2018, at 23:24, Olivier Mattelaer <<email address hidden> <mailto:<email address hidden>><mailto:<email address hidden> <mailto:<email address hidden>>>> wrote:
>
> Hi Rikkert,
>
> The display is actually perfect for QED (see below):
>
>
> The following switches determine which programs are run:
> /================== Description ==================|=========== values ===========|================ other options ================\
> | 1. Type of perturbative computation | order = NLO | LO |
> | 2. No MC@[N]LO matching / e...

Read more...

Rikkert Frederix (frederix) wrote :

Hi,

There is another issue that should be fixed. In particular, when requiring e.g.,

p p > j j QED=0 QCD=4 [QED]

the code also includes QCD corrections (i.e., NLO_1), since at the squared order level, they are allowed. To remove them, one needs to set QCD=2.

In my opinion, the QED=0 and QCD=4 should be used to define which LO contributions should be included, and the ones between the square brackets to determine if one should include QCD and/or QED corrections on top of the Born contributions. Hence,

p p > j j QED=0 QCD=4 [QED]
and
p p > j j QED=0 QCD=2 [QED]

should lead to exactly the same results.

Who knows how to fix this?

Cheers,
Rikkert

On that topic,

Would not be a good idea to put somewhere the plot corresponding to NLO_X LO_Y?
This could be very usefull to know what is computed and what is included by the code.
(what about for 3.0.2?)

Cheers,

Olivier

> On 5 Oct 2018, at 10:48, Rikkert Frederix <email address hidden> wrote:
>
> Hi,
>
> There is another issue that should be fixed. In particular, when requiring e.g.,
>
> p p > j j QED=0 QCD=4 [QED]
>
> the code also includes QCD corrections (i.e., NLO_1), since at the squared order level, they are allowed. To remove them, one needs to set QCD=2.
>
> In my opinion, the QED=0 and QCD=4 should be used to define which LO contributions should be included, and the ones between the square brackets to determine if one should include QCD and/or QED corrections on top of the Born contributions. Hence,
>
> p p > j j QED=0 QCD=4 [QED]
> and
> p p > j j QED=0 QCD=2 [QED]
>
> should lead to exactly the same results.
>
> Who knows how to fix this?
>
> Cheers,
> Rikkert
>
> --
> https://code.launchpad.net/~maddevelopers/mg5amcnlo/3.0.1/+merge/356133
> You are requested to review the proposed merge of lp:~maddevelopers/mg5amcnlo/3.0.1 into lp:~maddevelopers/mg5amcnlo/FKS_EW_granny.

marco zaro (marco-zaro) wrote :

ciao Rikkert,
I would prefer not to touch the order business now, as I fear to screw up other things with a quick patch.
I agree that it is not optimal, but we may want to upgrade it for the next release with more calm, possibly allowing the user to specify orders at the diagram or amplitude level in a more flexible way.
What is everybody’s idea here?

Cheers,

Marco

> On 5 Oct 2018, at 10:48, Rikkert Frederix <email address hidden> wrote:
>
> Hi,
>
> There is another issue that should be fixed. In particular, when requiring e.g.,
>
> p p > j j QED=0 QCD=4 [QED]
>
> the code also includes QCD corrections (i.e., NLO_1), since at the squared order level, they are allowed. To remove them, one needs to set QCD=2.
>
> In my opinion, the QED=0 and QCD=4 should be used to define which LO contributions should be included, and the ones between the square brackets to determine if one should include QCD and/or QED corrections on top of the Born contributions. Hence,
>
> p p > j j QED=0 QCD=4 [QED]
> and
> p p > j j QED=0 QCD=2 [QED]
>
> should lead to exactly the same results.
>
> Who knows how to fix this?
>
> Cheers,
> Rikkert
>
> --
> https://code.launchpad.net/~maddevelopers/mg5amcnlo/3.0.1/+merge/356133
> You are requested to review the proposed merge of lp:~maddevelopers/mg5amcnlo/3.0.1 into lp:~maddevelopers/mg5amcnlo/FKS_EW_granny.

Rikkert Frederix (frederix) wrote :

Hi,

Marco: I think you are right. Maybe it's better to wait with this for the next version.

Olivier: I agree with you that for 3.0.2 we should write a better default analysis, which knows about the separate orders, and has a few more plots than just the total cross section.

Cheers,
Rikkert

I was actually not thinking at the analysis level but more at the time of the generation of the diagram
to have the famous bullet plot such that it is simple to see which order are include.

Olivier

> On 5 Oct 2018, at 11:22, Rikkert Frederix <email address hidden> wrote:
>
> Hi,
>
> Marco: I think you are right. Maybe it's better to wait with this for the next version.
>
> Olivier: I agree with you that for 3.0.2 we should write a better default analysis, which knows about the separate orders, and has a few more plots than just the total cross section.
>
> Cheers,
> Rikkert
>
> --
> https://code.launchpad.net/~maddevelopers/mg5amcnlo/3.0.1/+merge/356133
> You are requested to review the proposed merge of lp:~maddevelopers/mg5amcnlo/3.0.1 into lp:~maddevelopers/mg5amcnlo/FKS_EW_granny.

davide.pagani.85 (davide-pagani) wrote :

Hi,

What Rik suggested is important, the example he is quoting is actually
an error that I did and and made loose quite some time to get what was
going on.

On the other hand, I think is more important to release as soon as
possible this new version and this error is actually due to a wrong
usage of the syntax.

So if it takes long, I would do it for next-to-next release.

-------------------------------------------------------

I think it would be very helpful to add the HwU analysis that Rik wrote
for the results in the paper.

Many times I start from that one or I use it to get fast results.

Do you agree?

Ciao

Davide

On 05/10/18 11:00, marco zaro wrote:
> ciao Rikkert,
> I would prefer not to touch the order business now, as I fear to screw up other things with a quick patch.
> I agree that it is not optimal, but we may want to upgrade it for the next release with more calm, possibly allowing the user to specify orders at the diagram or amplitude level in a more flexible way.
> What is everybody’s idea here?
>
> Cheers,
>
> Marco
>
>
>> On 5 Oct 2018, at 10:48, Rikkert Frederix <email address hidden> wrote:
>>
>> Hi,
>>
>> There is another issue that should be fixed. In particular, when requiring e.g.,
>>
>> p p > j j QED=0 QCD=4 [QED]
>>
>> the code also includes QCD corrections (i.e., NLO_1), since at the squared order level, they are allowed. To remove them, one needs to set QCD=2.
>>
>> In my opinion, the QED=0 and QCD=4 should be used to define which LO contributions should be included, and the ones between the square brackets to determine if one should include QCD and/or QED corrections on top of the Born contributions. Hence,
>>
>> p p > j j QED=0 QCD=4 [QED]
>> and
>> p p > j j QED=0 QCD=2 [QED]
>>
>> should lead to exactly the same results.
>>
>> Who knows how to fix this?
>>
>> Cheers,
>> Rikkert
>>
>> --
>> https://code.launchpad.net/~maddevelopers/mg5amcnlo/3.0.1/+merge/356133
>> You are requested to review the proposed merge of lp:~maddevelopers/mg5amcnlo/3.0.1 into lp:~maddevelopers/mg5amcnlo/FKS_EW_granny.
>

Rikkert Frederix (frederix) wrote :

Hi guys,

Any updates?

Best,
Rikkert

lp:~maddevelopers/mg5amcnlo/3.0.1 updated on 2018-10-26
947. By Pagani <email address hidden> on 2018-10-26

General analysis with options of tagging spefic orders explained

davide.pagani.85 (davide-pagani) wrote :

Hi guys,

sorry for the naive question.
What does it mean merging 3.0.1 into FKS_EW_granny?

Isn't the latter an old version?

Ciao
Davide

On 23/10/18 21:51, Rikkert Frederix wrote:
> Hi guys,
>
> Any updates?
>
> Best,
> Rikkert
>

Rikkert Frederix (frederix) wrote :

FKS_EW_granny is the current public version ---there is no 3.0.0 branch. Hence, this request is to replace the current public version with the 3.0.1 branch.

Best,
Rikkert

davide.pagani.85 (davide-pagani) wrote :

Hi Marco,

I see

942. By marco zaro on 2018-10-04
fixes in amcatnlo_run_interface.py to enable NLOPS for QCD-only
not fully working yet

in which sense is not fully working?

Concerning the Fixed-Order part, the code is ok for me to be replaced.

Cheers
Davide

On 26/10/18 19:57, Rikkert Frederix wrote:
> FKS_EW_granny is the current public version ---there is no 3.0.0 branch. Hence, this request is to replace the current public version with the 3.0.1 branch.
>
> Best,
> Rikkert

lp:~maddevelopers/mg5amcnlo/3.0.1 updated on 2018-10-28
948. By olivier-mattelaer on 2018-10-28

merge with 2.6.4

949. By olivier-mattelaer on 2018-10-28

merge with 2.6.4

marco zaro (marco-zaro) wrote :

Ciao Davide,
this was fixed in rev 943 by rikkert
cheers,

Marco

> On 28 Oct 2018, at 09:15, davide.pagani.85 <email address hidden> wrote:
>
> Hi Marco,
>
> I see
>
> 942. By marco zaro on 2018-10-04
> fixes in amcatnlo_run_interface.py to enable NLOPS for QCD-only
> not fully working yet
>
> in which sense is not fully working?
>
> Concerning the Fixed-Order part, the code is ok for me to be replaced.
>
>
> Cheers
> Davide
>
> On 26/10/18 19:57, Rikkert Frederix wrote:
>> FKS_EW_granny is the current public version ---there is no 3.0.0 branch. Hence, this request is to replace the current public version with the 3.0.1 branch.
>>
>> Best,
>> Rikkert
>
>
> --
> https://code.launchpad.net/~maddevelopers/mg5amcnlo/3.0.1/+merge/356133
> You are requested to review the proposed merge of lp:~maddevelopers/mg5amcnlo/3.0.1 into lp:~maddevelopers/mg5amcnlo/FKS_EW_granny.

davide.pagani.85 (davide-pagani) wrote :

Then I am ok for the merging.

Let me know how I can help you.

Ciao
Davide

On 29/10/18 09:21, marco zaro wrote:
> Ciao Davide,
> this was fixed in rev 943 by rikkert
> cheers,
>
> Marco
>
>> On 28 Oct 2018, at 09:15, davide.pagani.85 <email address hidden> wrote:
>>
>> Hi Marco,
>>
>> I see
>>
>> 942. By marco zaro on 2018-10-04
>> fixes in amcatnlo_run_interface.py to enable NLOPS for QCD-only
>> not fully working yet
>>
>> in which sense is not fully working?
>>
>> Concerning the Fixed-Order part, the code is ok for me to be replaced.
>>
>>
>> Cheers
>> Davide
>>
>> On 26/10/18 19:57, Rikkert Frederix wrote:
>>> FKS_EW_granny is the current public version ---there is no 3.0.0 branch. Hence, this request is to replace the current public version with the 3.0.1 branch.
>>>
>>> Best,
>>> Rikkert
>>
>> --
>> https://code.launchpad.net/~maddevelopers/mg5amcnlo/3.0.1/+merge/356133
>> You are requested to review the proposed merge of lp:~maddevelopers/mg5amcnlo/3.0.1 into lp:~maddevelopers/mg5amcnlo/FKS_EW_granny.
>

lp:~maddevelopers/mg5amcnlo/3.0.1 updated on 2018-11-09
950. By olivier-mattelaer on 2018-11-09

UPdate IOtest

951. By olivier-mattelaer on 2018-11-09

last merge with 2.6.4

Hi Marco,

I realised that you removed that file:
tests/acceptance_tests/test_export_fks.py

Is this expected?

Olivier

Also it seems to have a bunch of (scary) print statement in
test_fks_base.py at line 246
Related to some bypass of tests...

Would be better to clean that right?

Olivier

marco zaro (marco-zaro) wrote :

Hi Olviier,
all IOtests for the NLO output are in
tests/unit_tests/iolibs/test_export_fks.py
feel free to move it to the acceptance tests if it takes too much

cheers,

Marco

> On 9 Nov 2018, at 11:31, Olivier Mattelaer <email address hidden> wrote:
>
> Hi Marco,
>
> I realised that you removed that file:
> tests/acceptance_tests/test_export_fks.py
>
> Is this expected?
>
> Olivier
> --
> https://code.launchpad.net/~maddevelopers/mg5amcnlo/3.0.1/+merge/356133
> You are requested to review the proposed merge of lp:~maddevelopers/mg5amcnlo/3.0.1 into lp:~maddevelopers/mg5amcnlo/FKS_EW_granny.

OK good and concerning the test_fks_base.py?
(print statement that some test are bypassed?)

Cheers,

Olivier

PS: I have found workaround for the lhapdf issue and Mojave issue that I pushed in 2.6.4 (and include those here obviously)

> On 9 Nov 2018, at 12:15, marco zaro <email address hidden> wrote:
>
> Hi Olviier,
> all IOtests for the NLO output are in
> tests/unit_tests/iolibs/test_export_fks.py
> feel free to move it to the acceptance tests if it takes too much
>
> cheers,
>
> Marco
>
>> On 9 Nov 2018, at 11:31, Olivier Mattelaer <email address hidden> wrote:
>>
>> Hi Marco,
>>
>> I realised that you removed that file:
>> tests/acceptance_tests/test_export_fks.py
>>
>> Is this expected?
>>
>> Olivier
>> --
>> https://code.launchpad.net/~maddevelopers/mg5amcnlo/3.0.1/+merge/356133
>> You are requested to review the proposed merge of lp:~maddevelopers/mg5amcnlo/3.0.1 into lp:~maddevelopers/mg5amcnlo/FKS_EW_granny.
>
>
> --
> https://code.launchpad.net/~maddevelopers/mg5amcnlo/3.0.1/+merge/356133
> You are requested to review the proposed merge of lp:~maddevelopers/mg5amcnlo/3.0.1 into lp:~maddevelopers/mg5amcnlo/FKS_EW_granny.

lp:~maddevelopers/mg5amcnlo/3.0.1 updated on 2018-11-09
952. By marco zaro on 2018-11-09

commented sprint statament in test_fks_base

marco zaro (marco-zaro) wrote :

these are commented now (r952)
which LHAPDF issue?
cheers,

Marco

> On 9 Nov 2018, at 12:30, Olivier Mattelaer <email address hidden> wrote:
>
> OK good and concerning the test_fks_base.py?
> (print statement that some test are bypassed?)
>
>
> Cheers,
>
> Olivier
>
>
> PS: I have found workaround for the lhapdf issue and Mojave issue that I pushed in 2.6.4 (and include those here obviously)
>
>> On 9 Nov 2018, at 12:15, marco zaro <email address hidden> wrote:
>>
>> Hi Olviier,
>> all IOtests for the NLO output are in
>> tests/unit_tests/iolibs/test_export_fks.py
>> feel free to move it to the acceptance tests if it takes too much
>>
>> cheers,
>>
>> Marco
>>
>>> On 9 Nov 2018, at 11:31, Olivier Mattelaer <email address hidden> wrote:
>>>
>>> Hi Marco,
>>>
>>> I realised that you removed that file:
>>> tests/acceptance_tests/test_export_fks.py
>>>
>>> Is this expected?
>>>
>>> Olivier
>>> --
>>> https://code.launchpad.net/~maddevelopers/mg5amcnlo/3.0.1/+merge/356133
>>> You are requested to review the proposed merge of lp:~maddevelopers/mg5amcnlo/3.0.1 into lp:~maddevelopers/mg5amcnlo/FKS_EW_granny.
>>
>>
>> --
>> https://code.launchpad.net/~maddevelopers/mg5amcnlo/3.0.1/+merge/356133
>> You are requested to review the proposed merge of lp:~maddevelopers/mg5amcnlo/3.0.1 into lp:~maddevelopers/mg5amcnlo/FKS_EW_granny.
>
>
> --
> https://code.launchpad.net/~maddevelopers/mg5amcnlo/3.0.1/+merge/356133
> You are requested to review the proposed merge of lp:~maddevelopers/mg5amcnlo/3.0.1 into lp:~maddevelopers/mg5amcnlo/FKS_EW_granny.

They were two lhapdf issues:

- it was not compiling on Mojave (the same problem will likely re-appear in a year with NO easy solution this time). The problem is that the yaml parser shipped with lhapdf seems to have issue on mac.

- the download of (any) PDF was crashing. This was due to the change of hepforge.
We were using the ofiicial command (lhapdf install) but that one does not work anymore and after discussing with them they do not seem interested to fix it.
I'm still trying to use that command, but if it fails then I guess the path of the set and do a "simple" wget on that one.

Cheers,

Olivier

PS: The status on the tests are now:
- one unnitest failing
- around 10 acceptance test failing (so far, this is still running)

> On 9 Nov 2018, at 12:42, marco zaro <email address hidden> wrote:
>
> these are commented now (r952)
> which LHAPDF issue?
> cheers,
>
> Marco
>
>> On 9 Nov 2018, at 12:30, Olivier Mattelaer <email address hidden> wrote:
>>
>> OK good and concerning the test_fks_base.py?
>> (print statement that some test are bypassed?)
>>
>>
>> Cheers,
>>
>> Olivier
>>
>>
>> PS: I have found workaround for the lhapdf issue and Mojave issue that I pushed in 2.6.4 (and include those here obviously)
>>
>>> On 9 Nov 2018, at 12:15, marco zaro <email address hidden> wrote:
>>>
>>> Hi Olviier,
>>> all IOtests for the NLO output are in
>>> tests/unit_tests/iolibs/test_export_fks.py
>>> feel free to move it to the acceptance tests if it takes too much
>>>
>>> cheers,
>>>
>>> Marco
>>>
>>>> On 9 Nov 2018, at 11:31, Olivier Mattelaer <email address hidden> wrote:
>>>>
>>>> Hi Marco,
>>>>
>>>> I realised that you removed that file:
>>>> tests/acceptance_tests/test_export_fks.py
>>>>
>>>> Is this expected?
>>>>
>>>> Olivier
>>>> --
>>>> https://code.launchpad.net/~maddevelopers/mg5amcnlo/3.0.1/+merge/356133
>>>> You are requested to review the proposed merge of lp:~maddevelopers/mg5amcnlo/3.0.1 into lp:~maddevelopers/mg5amcnlo/FKS_EW_granny.
>>>
>>>
>>> --
>>> https://code.launchpad.net/~maddevelopers/mg5amcnlo/3.0.1/+merge/356133
>>> You are requested to review the proposed merge of lp:~maddevelopers/mg5amcnlo/3.0.1 into lp:~maddevelopers/mg5amcnlo/FKS_EW_granny.
>>
>>
>> --
>> https://code.launchpad.net/~maddevelopers/mg5amcnlo/3.0.1/+merge/356133
>> You are requested to review the proposed merge of lp:~maddevelopers/mg5amcnlo/3.0.1 into lp:~maddevelopers/mg5amcnlo/FKS_EW_granny.
>
>
> --
> https://code.launchpad.net/~maddevelopers/mg5amcnlo/3.0.1/+merge/356133
> You are requested to review the proposed merge of lp:~maddevelopers/mg5amcnlo/3.0.1 into lp:~maddevelopers/mg5amcnlo/FKS_EW_granny.

Hi Marco,

The following test is also not passing (going trough ok with 2.6.4):
test_madspin_LOonly

Even though this is a madspin designed tests, it actually crash within the LOonly module.
If you just do
geneate p p > w+ [LOonly]
It will lead to a crash.

I have fixed all the other tests (but a couple of IOtests and i still have to run the short paralel test).

Since this is a beta version, we can also decide to not fix this in this version.

marco zaro (marco-zaro) wrote :

Hi Olivier,
it is strange, it seems that the LOonly mode is broken (it always returns zero)
I will have a look on monday, and let you know.

cheers,

Marco

> On 9 Nov 2018, at 21:10, Olivier Mattelaer <email address hidden> wrote:
>
> Hi Marco,
>
> The following test is also not passing (going trough ok with 2.6.4):
> test_madspin_LOonly
>
> Even though this is a madspin designed tests, it actually crash within the LOonly module.
> If you just do
> geneate p p > w+ [LOonly]
> It will lead to a crash.
>
> I have fixed all the other tests (but a couple of IOtests and i still have to run the short paralel test).
>
> Since this is a beta version, we can also decide to not fix this in this version.
> --
> https://code.launchpad.net/~maddevelopers/mg5amcnlo/3.0.1/+merge/356133
> You are requested to review the proposed merge of lp:~maddevelopers/mg5amcnlo/3.0.1 into lp:~maddevelopers/mg5amcnlo/FKS_EW_granny.

marco zaro (marco-zaro) wrote :

Hi Again,
actually, doing p p > e+ ve [LOonly] works ok, at LO, NLO, aMC@LO, aMC@NLO
So it may be something relate to the phase-space of 2->1?
the reason why p p > w+ [LOonly] returns zero is because the function passcuts always returns False, exiting here
c Make sure have reasonable 4-momenta
      if (p(0,1) .le. 0d0) then
         passcuts=.false.
         return
      endif

with P(0,1) = -99

So clearly something goes wrong in the phase space generation. Rikkert, anything that could be related to the granny stuff?

also note that
p p > w+ [QED] has one test failing (soft test for photon emission off the W), where a lot of NaN’s appear
p p > e+ ve [QCD] seems ok though

Cheers,

Marco

> On 9 Nov 2018, at 21:42, marco zaro <email address hidden> wrote:
>
> Hi Olivier,
> it is strange, it seems that the LOonly mode is broken (it always returns zero)
> I will have a look on monday, and let you know.
>
> cheers,
>
> Marco
>
>> On 9 Nov 2018, at 21:10, Olivier Mattelaer <email address hidden> wrote:
>>
>> Hi Marco,
>>
>> The following test is also not passing (going trough ok with 2.6.4):
>> test_madspin_LOonly
>>
>> Even though this is a madspin designed tests, it actually crash within the LOonly module.
>> If you just do
>> geneate p p > w+ [LOonly]
>> It will lead to a crash.
>>
>> I have fixed all the other tests (but a couple of IOtests and i still have to run the short paralel test).
>>
>> Since this is a beta version, we can also decide to not fix this in this version.
>> --
>> https://code.launchpad.net/~maddevelopers/mg5amcnlo/3.0.1/+merge/356133
>> You are requested to review the proposed merge of lp:~maddevelopers/mg5amcnlo/3.0.1 into lp:~maddevelopers/mg5amcnlo/FKS_EW_granny.
>
>
> --
> https://code.launchpad.net/~maddevelopers/mg5amcnlo/3.0.1/+merge/356133
> You are requested to review the proposed merge of lp:~maddevelopers/mg5amcnlo/3.0.1 into lp:~maddevelopers/mg5amcnlo/FKS_EW_granny.

Thanks,

Update on my side:
1) the IOTest suite are bugged (not critical for a release) I have ask Valentin to look at it
2) the (fast) parrelel test leads to their own discovery of bug:

2.1) e+ e- > t t~ [real=QCD]
crashes with
FKSProcessError: This process does not have any correction up to NLO in QED,QCD
[ test: test_short_check_generate_events_nlo_py6pt_fsr]
same for e+ e- > p p p [real=QCD] in test: test_short_check_eejjj_lo_lhapdf]

2.2) A division by zero occurs in the jet veto of rik [test_short_jet_veto_xsec]

p p > e+ ve [QCD]
generate_events NLO
                 set ickkw -1
                 set ptj 10

2.3) The value of some squared order amplitude does not match anymore [test_short_sqso ]
Will look at this one (maybe with Valentin).

Cheers,

Olivier

On 9 Nov 2018, at 22:00, marco zaro <<email address hidden><mailto:<email address hidden>>> wrote:

Hi Again,
actually, doing p p > e+ ve [LOonly] works ok, at LO, NLO, aMC@LO, aMC@NLO
So it may be something relate to the phase-space of 2->1?
the reason why p p > w+ [LOonly] returns zero is because the function passcuts always returns False, exiting here
c Make sure have reasonable 4-momenta
     if (p(0,1) .le. 0d0) then
        passcuts=.false.
        return
     endif

with P(0,1) = -99

So clearly something goes wrong in the phase space generation. Rikkert, anything that could be related to the granny stuff?

also note that
p p > w+ [QED] has one test failing (soft test for photon emission off the W), where a lot of NaN’s appear
p p > e+ ve [QCD] seems ok though

Cheers,

Marco

On 9 Nov 2018, at 21:42, marco zaro <<email address hidden><mailto:<email address hidden>>> wrote:

Hi Olivier,
it is strange, it seems that the LOonly mode is broken (it always returns zero)
I will have a look on monday, and let you know.

cheers,

Marco

On 9 Nov 2018, at 21:10, Olivier Mattelaer <<email address hidden><mailto:<email address hidden>>> wrote:

Hi Marco,

The following test is also not passing (going trough ok with 2.6.4):
test_madspin_LOonly

Even though this is a madspin designed tests, it actually crash within the LOonly module.
If you just do
geneate p p > w+ [LOonly]
It will lead to a crash.

I have fixed all the other tests (but a couple of IOtests and i still have to run the short paralel test).

Since this is a beta version, we can also decide to not fix this in this version.
--
https://code.launchpad.net/~maddevelopers/mg5amcnlo/3.0.1/+merge/356133
You are requested to review the proposed merge of lp:~maddevelopers/mg5amcnlo/3.0.1 into lp:~maddevelopers/mg5amcnlo/FKS_EW_granny.

--
https://code.launchpad.net/~maddevelopers/mg5amcnlo/3.0.1/+merge/356133
You are requested to review the proposed merge of lp:~maddevelopers/mg5amcnlo/3.0.1 into lp:~maddevelopers/mg5amcnlo/FKS_EW_granny.

--
https://code.launchpad.net/~maddevelopers/mg5amcnlo/3.0.1/+merge/356133
You are requested to review the proposed merge of lp:~maddevelopers/mg5amcnlo/3.0.1 into lp:~maddevelopers/mg5amcnlo/FKS_EW_granny.

marco zaro (marco-zaro) wrote :
Download full text (4.1 KiB)

Ciao Olivier,
thanks for looking at this.
Let me answer inline

On Fri, Nov 9, 2018 at 10:30 PM Olivier Mattelaer <
<email address hidden>> wrote:

> Thanks,
>
> Update on my side:
> 1) the IOTest suite are bugged (not critical for a release) I have ask
> Valentin to look at it
> 2) the (fast) parrelel test leads to their own discovery of bug:
>
> 2.1) e+ e- > t t~ [real=QCD]
> crashes with
> FKSProcessError: This process does not have any correction up to NLO in
> QED,QCD
> [ test: test_short_check_generate_events_nlo_py6pt_fsr]
> same for e+ e- > p p p [real=QCD] in test:
> test_short_check_eejjj_lo_lhapdf]
>
> for ee collisions, one has to tell the code
set include_lepton_initiated_processes True (there is a message printed on
screen).
The py6isr test should be skipped, as the has_isr flag is not updated
anymore in this branch (there were some print statement about this you
asked me to remove)

  If you want to include it, set the

  'include_lepton_initiated_processes' option to True

> 2.2) A division by zero occurs in the jet veto of rik
> [test_short_jet_veto_xsec]
>
> p p > e+ ve [QCD]
> generate_events NLO
> set ickkw -1
> set ptj 10
>
>
> the jet_veto is likely to be broken in this branch. There are some message
errors in the logs of the fortran executables about this.

> 2.3) The value of some squared order amplitude does not match anymore
> [test_short_sqso ]
> Will look at this one (maybe with Valentin).
>

I will check this right away

Thanks again!

cheers,

Marco

>
> Cheers,
>
> Olivier
>
> On 9 Nov 2018, at 22:00, marco zaro <<email address hidden><mailto:
> <email address hidden>>> wrote:
>
> Hi Again,
> actually, doing p p > e+ ve [LOonly] works ok, at LO, NLO, aMC@LO, aMC@NLO
> So it may be something relate to the phase-space of 2->1?
> the reason why p p > w+ [LOonly] returns zero is because the function
> passcuts always returns False, exiting here
> c Make sure have reasonable 4-momenta
> if (p(0,1) .le. 0d0) then
> passcuts=.false.
> return
> endif
>
> with P(0,1) = -99
>
> So clearly something goes wrong in the phase space generation. Rikkert,
> anything that could be related to the granny stuff?
>
> also note that
> p p > w+ [QED] has one test failing (soft test for photon emission off the
> W), where a lot of NaN’s appear
> p p > e+ ve [QCD] seems ok though
>
> Cheers,
>
> Marco
>
>
>
> On 9 Nov 2018, at 21:42, marco zaro <<email address hidden><mailto:
> <email address hidden>>> wrote:
>
> Hi Olivier,
> it is strange, it seems that the LOonly mode is broken (it always returns
> zero)
> I will have a look on monday, and let you know.
>
> cheers,
>
> Marco
>
> On 9 Nov 2018, at 21:10, Olivier Mattelaer <<email address hidden>
> <mailto:<email address hidden>>> wrote:
>
> Hi Marco,
>
> The following test is also not passing (going trough ok with 2.6.4):
> test_madspin_LOonly
>
> Even though this is a madspin designed tests, it actually crash within the
> LOonly module.
> If you just do
> geneate p p > w+ [LOonly]
> It will lead to a crash.
>
> I have fixed all the other tests (but a couple of IOtests and i still have
> to run the short ...

Read more...

Rikkert Frederix (frederix) wrote :

Hi Olivier, Marco,

I looked into the following two issues:

1. The error in the phase-space for the process 'p p > w+ [LOonly=QCD]'.
This is related to the fact that in the 3.0.1 branch the final state W boson is the fks_j particle, while in the 2.6.4 branch it's one of the initial state quarks. However, the phase-space for 2->1 processes with j-fks the massive final state particle does not work. There are divisions by zero everywhere... I'm not sure if there is an easy fix here, apart from telling the code to use an initial state particle as fake j_fks. This will work for the LOonly 2->1 processes. On the other hand, we need to fix this phase-space at some point, since the same is used (and needed!) for the process 'p p > w+ [QED]'.

2. The error for the VETO X-SEC (ickkw=-1).
The whole split-amplitude business has not been implemented for the veto-xsec stuff. I suggest that we do not try to rush this through now, but leave the 3.0.1 code as beta and fix this at a later stage.

Cheers,
Rik

lp:~maddevelopers/mg5amcnlo/3.0.1 updated on 2018-11-16
953. By marco zaro on 2018-11-12

fix for 2->1 processes

954. By marco zaro on 2018-11-12

unit test for previous push and fix for p p > w+ [LOonly=QCD]

955. By marco zaro on 2018-11-16

reverted change from revision 613 (related to split orders and WEIGHTED)
added a debug message

marco zaro (marco-zaro) wrote :

Hi all,
I have just noticed this (fks_singular, line 3818)
      call Qterms_reduced_timelike(j_type,i_type,ch_i,ch_j,t,z,Q)
it should be instead
      call Qterms_reduced_timelike(j_type,i_type,ch_j,ch_i,t,z,Q)
(switch ch_i <--> ch_j), shouldn't it?

It may be that in the end there is no effect, since, for the relevant cases when either ch_i or ch_j ==0 and the other is not one has always Q=0

c g/a ->qqbar splitting
         Qterms(1) = 4d0 * TR * z*(1d0-z)**2
         Qterms(2) = 4d0 * dble(abs(col1)) * ch1**2 * z*(1d0-z)**2

      elseif ((abs(col1).eq.3 .and. col2.eq.8) .or.
     & (dabs(ch1).gt.0d0 .and. dabs(ch2).eq.0d0)) then
c q->q g/a splitting
         Qterms(1) = 0d0
         Qterms(2) = 0d0

Let me know

Cheers,

Marco

review: Needs Fixing
marco zaro (marco-zaro) wrote :

sorry, the piece of code i wanted to post is

      elseif ((abs(col1).eq.3 .and. col2.eq.8) .or.
     & (dabs(ch1).gt.0d0 .and. dabs(ch2).eq.0d0)) then
c q->q g/a splitting
         Qterms(1) = 0d0
         Qterms(2) = 0d0

      elseif ((col1.eq.8 .and. abs(col2).eq.3) .or.
     & (dabs(ch1).eq.0d0 .and. dabs(ch2).gt.0d0)) then
c q->g/a q splitting
         Qterms(1) = 0d0
         Qterms(2) = 0d0
      else

> On 21 Nov 2018, at 16:16, marco zaro <email address hidden> wrote:
>
> Review: Needs Fixing
>
> Hi all,
> I have just noticed this (fks_singular, line 3818)
> call Qterms_reduced_timelike(j_type,i_type,ch_i,ch_j,t,z,Q)
> it should be instead
> call Qterms_reduced_timelike(j_type,i_type,ch_j,ch_i,t,z,Q)
> (switch ch_i <--> ch_j), shouldn't it?
>
> It may be that in the end there is no effect, since, for the relevant cases when either ch_i or ch_j ==0 and the other is not one has always Q=0
>
>
> c g/a ->qqbar splitting
> Qterms(1) = 4d0 * TR * z*(1d0-z)**2
> Qterms(2) = 4d0 * dble(abs(col1)) * ch1**2 * z*(1d0-z)**2
>
> elseif ((abs(col1).eq.3 .and. col2.eq.8) .or.
> & (dabs(ch1).gt.0d0 .and. dabs(ch2).eq.0d0)) then
> c q->q g/a splitting
> Qterms(1) = 0d0
> Qterms(2) = 0d0
>
> Let me know
>
> Cheers,
>
> Marco
>
> --
> https://code.launchpad.net/~maddevelopers/mg5amcnlo/3.0.1/+merge/356133
> You are reviewing the proposed merge of lp:~maddevelopers/mg5amcnlo/3.0.1 into lp:~maddevelopers/mg5amcnlo/FKS_EW_granny.

Rikkert Frederix (frederix) wrote :

Hi Marco,

I agree that the current way is wrong, but has no effect on the running of the code whatsoever. Even though, we should replace ch_i and ch_j in the call to the Qterms.
Note that, if there was 'true' bug here, the soft and/or collinear checks and the beginning of any run would not have passed.

Cheers,
Rik

lp:~maddevelopers/mg5amcnlo/3.0.1 updated on 2018-11-21
956. By marco zaro on 2018-11-21

fix in a call to
Qterms_reduced_timelike
luckiliy harmless

marco zaro (marco-zaro) wrote :

Hi Rik,
thanks for the cross-check
I have pushed the fix into 3.0.1, rev 956
cheers,

Marco

> On 21 Nov 2018, at 16:24, Rikkert Frederix <email address hidden> wrote:
>
> Hi Marco,
>
> I agree that the current way is wrong, but has no effect on the running of the code whatsoever. Even though, we should replace ch_i and ch_j in the call to the Qterms.
> Note that, if there was 'true' bug here, the soft and/or collinear checks and the beginning of any run would not have passed.
>
> Cheers,
> Rik
>
> --
> https://code.launchpad.net/~maddevelopers/mg5amcnlo/3.0.1/+merge/356133
> You are reviewing the proposed merge of lp:~maddevelopers/mg5amcnlo/3.0.1 into lp:~maddevelopers/mg5amcnlo/FKS_EW_granny.

Hi,

I would like to put this quite high priority for this week (i.e. for me Wednesday-friday).

I have rerun the tests and found that some tests are crashing when run via the full script but are working if run alone. So I have run (the very slow script to determine which of the tests had such side effects and the culprint is:
tests.unit_tests.fks.test_extra_ew.TestAMCatNLOEW.test_generate_fks_2to1_no_finalstate_confs
which has a side effect that lead to the following crash:

FAIL: test_generate_fks_ew_dijet_qed2qcd2_qcd (tests.unit_tests.fks.test_extra_ew.TestAMCatNLOEW)
check that the generate command works as expected.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/omattelaer/Documents/workspace/3.0.1/tests/unit_tests/fks/test_extra_ew.py", line 869, in test_generate_fks_ew_dijet_qed2qcd2_qcd
    self.assertEqual(real.fks_infos[0]['extra_cnt_index'], -1)
AssertionError: 0 != -1

Might be interesting that you take a look. But I think that we should release this version this week independently.

Any objection? comment?

Olivier

lp:~maddevelopers/mg5amcnlo/3.0.1 updated on 2018-12-17
957. By marco zaro on 2018-12-17

tests/unit_tests/fks/test_extra_ew.py has been modified to avoid
side effects

958. By marco zaro on 2018-12-17

fix in amcatnlo_interface to prevent unphysical coupling orders

marco zaro (marco-zaro) wrote :

Hello Olivier,
I agree we should release 3.0.1 before the Christmas break.
concerning the side effect, i reproduced it, and it goes away if I do the following change
 class TestAMCatNLOEW(unittest.TestCase):
     """ a suite of extra tests for the ew stuff """

- interface = mgcmd.MasterCmd()
+ def setUp(self):
+ self.interface = mgcmd.MasterCmd()

I have pushed the fix into rev 957.

The other bogus behavious was related to the order settings in t-channel single top, which we discussed in a separate email.
I have added an error message that should warn the user to specify the coupling orders in that case (rev 958)

Cheers,

Marco

> On 17 Dec 2018, at 09:23, Olivier Mattelaer <email address hidden> wrote:
>
> Hi,
>
> I would like to put this quite high priority for this week (i.e. for me Wednesday-friday).
>
> I have rerun the tests and found that some tests are crashing when run via the full script but are working if run alone. So I have run (the very slow script to determine which of the tests had such side effects and the culprint is:
> tests.unit_tests.fks.test_extra_ew.TestAMCatNLOEW.test_generate_fks_2to1_no_finalstate_confs
> which has a side effect that lead to the following crash:
>
> FAIL: test_generate_fks_ew_dijet_qed2qcd2_qcd (tests.unit_tests.fks.test_extra_ew.TestAMCatNLOEW)
> check that the generate command works as expected.
> ----------------------------------------------------------------------
> Traceback (most recent call last):
> File "/Users/omattelaer/Documents/workspace/3.0.1/tests/unit_tests/fks/test_extra_ew.py", line 869, in test_generate_fks_ew_dijet_qed2qcd2_qcd
> self.assertEqual(real.fks_infos[0]['extra_cnt_index'], -1)
> AssertionError: 0 != -1
>
> Might be interesting that you take a look. But I think that we should release this version this week independently.
>
> Any objection? comment?
>
> Olivier
>
>
> --
> https://code.launchpad.net/~maddevelopers/mg5amcnlo/3.0.1/+merge/356133
> You are reviewing the proposed merge of lp:~maddevelopers/mg5amcnlo/3.0.1 into lp:~maddevelopers/mg5amcnlo/FKS_EW_granny.

Rikkert Frederix (frederix) wrote :

Hi Olivier,

Thanks! We should really release it before the break. It will remain a beta version and exist along side the main branch, right? I think that would still be better and removing the beta tag.

best,
Rikkert

Hi,

> Thanks! We should really release it before the break. It will remain a beta version and exist along side the main branch, right?

Correct.

> I think that would still be better and removing the beta tag.

It would not make sense to remove the "beta" tag and keep two official version.
And I do not think that we are ready to keep only this version.

Cheers,

Olivier

> On 18 Dec 2018, at 10:33, Rikkert Frederix <email address hidden> wrote:
>
> Hi Olivier,
>
> Thanks! We should really release it before the break. It will remain a beta version and exist along side the main branch, right? I think that would still be better and removing the beta tag.
>
> best,
> Rikkert
>
> --
> https://code.launchpad.net/~maddevelopers/mg5amcnlo/3.0.1/+merge/356133
> You are requested to review the proposed merge of lp:~maddevelopers/mg5amcnlo/3.0.1 into lp:~maddevelopers/mg5amcnlo/FKS_EW_granny.

Rikkert Frederix (frederix) wrote :

Sorry, I forgot a "NOT" in my suggestion :-D
Hence I agree with not removing the beta tag.

Cheers,
Rik

lp:~maddevelopers/mg5amcnlo/3.0.1 updated on 2018-12-19
959. By olivier-mattelaer on 2018-12-19

fixing some additional issue with some test --in particular a real bug for the reweighting--

I have re-run all the tests today (and fix a couple of small stuffs). Except a couple that we have decide to ignore above they all go trough now. So I will make the release tomorrow.

Cheers,

Olivier

review: Approve
Rikkert Frederix (frederix) wrote :

Thanks a lot, Olivier.

Cheers,
Rik

marco zaro (marco-zaro) wrote :

Thanks a lot Olivier!
great that we finally made it!

cheers,

Marco

> On 19 Dec 2018, at 23:42, Rikkert Frederix <email address hidden> wrote:
>
> Thanks a lot, Olivier.
>
> Cheers,
> Rik
>
> --
> https://code.launchpad.net/~maddevelopers/mg5amcnlo/3.0.1/+merge/356133
> You are reviewing the proposed merge of lp:~maddevelopers/mg5amcnlo/3.0.1 into lp:~maddevelopers/mg5amcnlo/FKS_EW_granny.

lp:~maddevelopers/mg5amcnlo/3.0.1 updated on 2018-12-20
960. By olivier-mattelaer on 2018-12-20

UpdateNotes/Version update

Done!

davide.pagani.85 (davide-pagani) wrote :

Thanks a lot!

Cheers
Davide

On 20/12/18 09:47, Olivier Mattelaer wrote:
> Done!

By the way,

Do you know if we can close the following bug report:
https://bugs.launchpad.net/mg5amcnlo/+bug/1779831

If not we should at least comment on it (this is one was forbidding ATLAS to use the code)

Cheers,

Olivier

Stefano Frixione (stefano-frixione) wrote :

I have no idea.
Perhaps one should double check with the ATLAS people;
I've never understood how genser works, and their relationship
with experiments.
Cheers, Stefano.

On Fri, 21 Dec 2018, Olivier Mattelaer wrote:

> By the way,
>
> Do you know if we can close the following bug report:
> https://bugs.launchpad.net/mg5amcnlo/+bug/1779831
>
> If not we should at least comment on it (this is one was forbidding
> ATLAS to use the code)
>
>
> Cheers,
>
> Olivier
> --
> https://code.launchpad.net/~maddevelopers/mg5amcnlo/3.0.1/+merge/356133
> Your team MadDevelopers is subscribed to branch lp:~maddevelopers/mg5amcnlo/FKS_EW_granny.
>

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 2018-04-25 06:47:06 +0000
3+++ MadSpin/decay.py 2018-12-20 08:18:55 +0000
4@@ -3963,14 +3963,23 @@
5 elif mode=='full':
6 stdin_text="5 0 0 0 \n" # before closing, write down the seed
7 external = self.calculator[('full',path)]
8- external.stdin.write(stdin_text)
9+ try:
10+ external.stdin.write(stdin_text)
11+ except Exception:
12+ continue
13 ranmar_state=external.stdout.readline()
14 ranmar_file=pjoin(path,'ranmar_state.dat')
15 ranmar=open(ranmar_file, 'w')
16 ranmar.write(ranmar_state)
17 ranmar.close()
18- external.stdin.close()
19- external.stdout.close()
20+ try:
21+ external.stdin.close()
22+ except Exception:
23+ continue
24+ try:
25+ external.stdout.close()
26+ except Exception:
27+ continue
28 external.terminate()
29 del external
30 else:
31
32=== modified file 'MadSpin/interface_madspin.py'
33--- MadSpin/interface_madspin.py 2018-03-11 12:10:19 +0000
34+++ MadSpin/interface_madspin.py 2018-12-20 08:18:55 +0000
35@@ -35,6 +35,7 @@
36 import madgraph.interface.madgraph_interface as mg_interface
37 import madgraph.interface.master_interface as master_interface
38 import madgraph.interface.madevent_interface as madevent_interface
39+import madgraph.interface.common_run_interface as common_run_interface
40 import madgraph.interface.reweight_interface as rwgt_interface
41 import madgraph.various.misc as misc
42 import madgraph.iolibs.files as files
43@@ -53,6 +54,68 @@
44 cmd_logger = logging.getLogger('cmdprint2') # -> print
45
46
47+class MadSpinOptions(banner.ConfigFile):
48+
49+ def default_setup(self):
50+
51+ self.add_param("max_weight", -1)
52+ self.add_param('curr_dir', os.path.realpath(os.getcwd()))
53+ self.add_param('Nevents_for_max_weigth', 0)
54+ self.add_param("max_weight_ps_point", 400)
55+ self.add_param('BW_cut', -1)
56+ self.add_param('nb_sigma', 0.)
57+ self.add_param('ms_dir', '')
58+ self.add_param('max_running_process', 100)
59+ self.add_param('onlyhelicity', False)
60+ self.add_param('spinmode', "madspin", allowed=['madspin','none','onshell'])
61+ self.add_param('use_old_dir', False, comment='should be use only for faster debugging')
62+ self.add_param('run_card', '' , comment='define cut for spinmode==none. Path to run_card to use')
63+ self.add_param('fixed_order', False, comment='to activate fixed order handling of counter-event')
64+ self.add_param('seed', 0, comment='control the seed of madspin')
65+ self.add_param('cross_section', {'__type__':0.}, comment="forcing normalization of cross-section after MS (for none/onshell)" )
66+ self.add_param('new_wgt', 'cross-section' ,allowed=['cross-section', 'BR'], comment="if not consistent number of particles, choose what to do for the weight. (BR: means local according to number of part, cross use the force cross-section")
67+ self.add_param('input_format', 'auto', allowed=['auto','lhe', 'hepmc', 'lhe_no_banner'])
68+
69+
70+ ############################################################################
71+ ## Special post-processing of the options ##
72+ ############################################################################
73+ def post_set_ms_dir(self, value, change_userdefine, raiseerror):
74+ """ special handling for set ms_dir """
75+
76+ self.__setitem__('curr_dir', value, change_userdefine=change_userdefine)
77+
78+ ############################################################################
79+ def post_set_seed(self, value, change_userdefine, raiseerror):
80+ """ special handling for set seed """
81+
82+ random.seed(value)
83+
84+ ############################################################################
85+ def post_set_run_card(self, value, change_userdefine, raiseerror):
86+ """ special handling for set run_card """
87+
88+ if value == 'default':
89+ self.run_card = None
90+ elif os.path.isfile(value):
91+ self.run_card = banner.RunCard(value)
92+
93+ args = value.split()
94+ if len(args) >2:
95+ if not self.options['run_card']:
96+ self.run_card = banner.RunCardLO()
97+ self.run_card.remove_all_cut()
98+ self.run_card[args[0]] = ' '.join(args[1:])
99+
100+
101+ ############################################################################
102+ def post_fixed_order(self, value, change_userdefine, raiseerror):
103+ """ special handling for set fixed_order """
104+
105+ if value:
106+ logger.warning('Fix order madspin fails to have the correct scale information. This can bias the results!')
107+ logger.warning('Not all functionalities of MadSpin handle this mode correctly (only onshell mode so far).')
108+
109
110 class MadSpinInterface(extended_cmd.Cmd):
111 """Basic interface for madspin"""
112@@ -77,22 +140,7 @@
113 self.mode = "madspin" # can be flat/bridge change the way the decay is done.
114 # note amc@nlo does not support bridge.
115
116- self.options = {'max_weight': -1,
117- 'curr_dir': os.path.realpath(os.getcwd()),
118- 'Nevents_for_max_weigth': 0,
119- 'max_weight_ps_point': 400,
120- 'BW_cut':-1,
121- 'nb_sigma':0,
122- 'ms_dir':None,
123- 'max_running_process':100,
124- 'onlyhelicity': False,
125- 'spinmode': "madspin",
126- 'use_old_dir': False, #should be use only for faster debugging
127- 'run_card': None, # define cut for spinmode==none.
128- 'fixed_order': False # to activate fixed order handling of counter-event
129- }
130-
131-
132+ self.options = MadSpinOptions()
133
134 self.events_file = None
135 self.decay_processes = {}
136@@ -107,7 +155,21 @@
137 logger.info("Extracting the banner ...")
138 self.do_import(event_path)
139
140-
141+
142+ def setup_for_pure_decay(self):
143+ """this is for spinmode=None -> simple decay
144+ We go here if they are no banner.
145+ -> this requires that a command import model appears in the card!
146+ """
147+
148+ logger.info("Setup the code for pure decay mode")
149+ self.proc_option = []
150+ self.final_state_full = ''
151+ self.final_state_compact = ''
152+ self.prod_branches = ''
153+ self.final_state = set()
154+
155+
156 def do_import(self, inputfile):
157 """import the event file"""
158
159@@ -126,6 +188,7 @@
160 if not os.path.exists(inputfile):
161 if inputfile.endswith('.gz'):
162 if not os.path.exists(inputfile[:-3]):
163+ misc.sprint(os.getcwd(), os.listdir('.'), inputfile, os.path.exists(inputfile), os.path.exists(inputfile[:-3]))
164 raise self.InvalidCmd('No such file or directory : %s' % inputfile)
165 else:
166 inputfile = inputfile[:-3]
167@@ -134,14 +197,22 @@
168 else:
169 raise self.InvalidCmd('No such file or directory : %s' % inputfile)
170
171+ self.inputfile = inputfile
172+ if self.options['spinmode'] == 'none' and \
173+ (self.options['input_format'] not in ['lhe','auto'] or
174+ (self.options['input_format'] == 'auto' and '.lhe' not in inputfile[-7:])):
175+ self.banner = banner.Banner()
176+ self.setup_for_pure_decay()
177+ return
178+
179 if inputfile.endswith('.gz'):
180 misc.gunzip(inputfile)
181 inputfile = inputfile[:-3]
182-
183 # Read the banner of the inputfile
184 self.events_file = open(os.path.realpath(inputfile))
185 self.banner = banner.Banner(self.events_file)
186
187+
188 # Check the validity of the banner:
189 if 'slha' not in self.banner:
190 self.events_file = None
191@@ -163,7 +234,6 @@
192 self.options['nb_sigma'] = N_sigma
193 if self.options['BW_cut'] == -1:
194 self.options['BW_cut'] = float(self.banner.get_detail('run_card', 'bwcutoff'))
195-
196 else:
197 if not self.options['Nevents_for_max_weigth']:
198 self.options['Nevents_for_max_weigth'] = 75
199@@ -273,7 +343,7 @@
200
201
202 #Check the param_card
203- if not bypass_check:
204+ if not (bypass_check or self.options['input_format'] in ['hepmc', 'lhe_no_banner']):
205 if not hasattr(self.banner, 'param_card'):
206 self.banner.charge_card('slha')
207 param_card = check_param_card.ParamCard(card)
208@@ -395,42 +465,10 @@
209
210 args = self.split_arg(line)
211 self.check_set(args)
212-
213- if args[0] not in ['ms_dir', 'run_card']:
214- args[1] = args[1].lower()
215-
216- if args[0] in ['max_weight', 'BW_effect','ms_dir', 'spinmode']:
217- self.options[args[0]] = args[1]
218- if args[0] == 'ms_dir':
219- self.options['curr_dir'] = self.options['ms_dir']
220- elif args[0] == 'seed':
221- random.seed(int(args[1]))
222- self.seed = int(args[1])
223- elif args[0] == 'BW_cut':
224- self.options[args[0]] = float(args[1])
225- elif args[0] in ['onlyhelicity', 'use_old_dir']:
226- self.options[args[0]] = banner.ConfigFile.format_variable(args[1], bool, args[0])
227- elif args[0] in ['run_card']:
228- if args[1] == 'default':
229- self.options['run_card'] = None
230- elif os.path.isfile(args[1]):
231- self.options['run_card'] = banner.RunCard(args[1])
232- elif len(args) >2:
233- if not self.options['run_card']:
234- self.options['run_card'] = banner.RunCardLO()
235- self.options['run_card'].remove_all_cut()
236- self.options['run_card'][args[1]] = args[2]
237- elif args[0] in 'fixed_order':
238- if args[1].lower() in ['t', 'true']:
239- self.options['fixed_order'] = True
240- logger.warning('Fix order madspin fails to have the correct scale information. This can bias the results!')
241- logger.warning('Not all functionality of MadSpin handle this mode correctly (only onshell mode so far).')
242- else:
243- self.options['fixed_order'] = False
244- logger.info('fixed_order options set to %s', self.options['fixed_order'])
245- else:
246- self.options[args[0]] = int(args[1])
247-
248+
249+ self.options[args[0]] = ' '.join(args[1:])
250+
251+
252 def complete_set(self, text, line, begidx, endidx):
253
254
255@@ -559,17 +597,17 @@
256
257 model_line = self.banner.get('proc_card', 'full_model_line')
258
259- if not self.seed:
260- self.seed = random.randint(0, int(30081*30081))
261- self.do_set('seed %s' % self.seed)
262- logger.info('Will use seed %s' % self.seed)
263- self.history.insert(0, 'set seed %s' % self.seed)
264+ if not self.options['seed']:
265+ self.options['seed'] = random.randint(0, int(30081*30081))
266+ #self.do_set('seed %s' % self.seed)
267+ logger.info('Will use seed %s' % self.options['seed'])
268+ self.history.insert(0, 'set seed %s' % self.options['seed'])
269
270- if self.seed > 30081*30081: # can't use too big random number
271- msg = 'Random seed too large ' + str(self.seed) + ' > 30081*30081'
272+ if self.options['seed'] > 30081*30081: # can't use too big random number
273+ msg = 'Random seed too large ' + str(self.options['seed']) + ' > 30081*30081'
274 raise Exception, msg
275
276- self.options['seed'] = self.seed
277+ #self.options['seed'] = self.seed
278 text = '%s\n' % '\n'.join([ line for line in self.history if line])
279 self.banner.add_text('madspin' , text)
280
281@@ -678,9 +716,9 @@
282
283 # NOW we have all the information available for RUNNING
284
285- if self.seed:
286+ if self.options['seed']:
287 #seed is specified need to use that one:
288- open(pjoin(self.options['ms_dir'],'seeds.dat'),'w').write('%s\n'%self.seed)
289+ open(pjoin(self.options['ms_dir'],'seeds.dat'),'w').write('%s\n'%self.options['seed'])
290 #remove all ranmar_state
291 for name in misc.glob(pjoin('*', 'SubProcesses','*','ranmar_state.dat'),
292 self.options['ms_dir']):
293@@ -741,30 +779,61 @@
294 for name in misc.glob("decay_*_*", self.path_me):
295 shutil.rmtree(name)
296
297- self.events_file.close()
298- orig_lhe = lhe_parser.EventFile(self.events_file.name)
299-
300+ if self.events_file:
301+ self.events_file.close()
302+ filename = self.events_file.name
303+ else:
304+ filename = self.inputfile
305+
306+ if self.options['input_format'] == 'auto':
307+ if '.lhe' in filename :
308+ self.options['input_format'] = 'lhe'
309+ elif '.hepmc' in filename:
310+ self.options['input_format'] = 'hepmc'
311+ else:
312+ raise Exception, "fail to recognized input format automatically"
313+
314+ if self.options['input_format'] in ['lhe', 'lhe_no_banner']:
315+ orig_lhe = lhe_parser.EventFile(filename)
316+ if self.options['input_format'] == 'lhe_no_banner':
317+ orig_lhe.allow_empty_event = True
318+
319+ elif self.options['input_format'] in ['hepmc']:
320+ import madgraph.various.hepmc_parser as hepmc_parser
321+ orig_lhe = hepmc_parser.HEPMC_EventFile(filename)
322+ logger.info("Parsing input event to know how many decay to generate. This can takes few minuts.")
323+ else:
324+ raise Exception
325+
326 to_decay = collections.defaultdict(int)
327 nb_event = 0
328+
329 for event in orig_lhe:
330 nb_event +=1
331 for particle in event:
332 if particle.status == 1 and particle.pdg in asked_to_decay:
333 # final state and tag as to decay
334 to_decay[particle.pdg] += 1
335+ if self.options['input_format'] == 'hepmc' and nb_event == 250:
336+ currpos = orig_lhe.tell()
337+ filesize = orig_lhe.getfilesize()
338+ for key in to_decay:
339+ to_decay[key] *= 1.05 * filesize/ currpos
340+ # 1.05 to avoid accidental coincidence with nevents
341+ break
342
343 # Handle the banner of the output file
344- if not self.seed:
345- self.seed = random.randint(0, int(30081*30081))
346- self.do_set('seed %s' % self.seed)
347- logger.info('Will use seed %s' % self.seed)
348- self.history.insert(0, 'set seed %s' % self.seed)
349+ if not self.options['seed']:
350+ self.options['seed'] = random.randint(0, int(30081*30081))
351+ #self.do_set('seed %s' % self.seed)
352+ logger.info('Will use seed %s' % self.options['seed'])
353+ self.history.insert(0, 'set seed %s' % self.options['seed'])
354
355- if self.seed > 30081*30081: # can't use too big random number
356- msg = 'Random seed too large ' + str(self.seed) + ' > 30081*30081'
357+ if self.options['seed'] > 30081*30081: # can't use too big random number
358+ msg = 'Random seed too large ' + str(self.options['seed']) + ' > 30081*30081'
359 raise Exception, msg
360
361- self.options['seed'] = self.seed
362+ #self.options['seed'] = self.options['seed']
363
364 text = '%s\n' % '\n'.join([ line for line in self.history if line])
365 self.banner.add_text('madspin' , text)
366@@ -780,7 +849,7 @@
367 for pdg, nb_needed in to_decay.items():
368 #check if a splitting is needed
369 if nb_needed == nb_event:
370- evt_decayfile[pdg] = self.generate_events(pdg, nb_needed, mg5)
371+ evt_decayfile[pdg] = self.generate_events(pdg, min(nb_needed,100000), mg5)
372 elif nb_needed % nb_event == 0:
373 nb_mult = nb_needed // nb_event
374 part = self.model.get_particle(pdg)
375@@ -788,64 +857,107 @@
376 if name not in self.list_branches:
377 continue
378 elif len(self.list_branches[name]) == nb_mult:
379- evt_decayfile[pdg] = self.generate_events(pdg, nb_event, mg5)
380- else:
381- evt_decayfile[pdg] = self.generate_events(pdg, nb_needed, mg5, cumul=True)
382+ evt_decayfile[pdg] = self.generate_events(pdg, min(nb_event,100000), mg5)
383+ else:
384+ evt_decayfile[pdg] = self.generate_events(pdg, min(nb_needed,100000), mg5, cumul=True)
385+ elif self.options['cross_section']:
386+ #cross-section hard-coded -> allow
387+ part = self.model.get_particle(pdg)
388+ name = part.get_name()
389+
390+ if name not in self.list_branches:
391+ continue
392+ else:
393+ try:
394+ evt_decayfile[pdg] = self.generate_events(pdg, min(nb_needed,100000), mg5, cumul=True)
395+ except common_run_interface.ZeroResult:
396+ logger.warning("Branching ratio is zero for this particle. Not decaying it")
397+ del to_decay[pdg]
398 else:
399 part = self.model.get_particle(pdg)
400 name = part.get_name()
401 if name not in self.list_branches or len(self.list_branches[name]) == 0:
402 continue
403- raise self.InvalidCmd("The bridge mode of MadSpin does not support event files where events do not *all* share the same set of final state particles to be decayed.")
404+ raise self.InvalidCmd("The bridge mode of MadSpin does not support event files where events do not *all* share the same set of final state particles to be decayed. One workaround is to force the final cross-section manually.")
405
406
407-
408-
409 # Compute the branching ratio.
410- br = 1
411- for (pdg, event_files) in evt_decayfile.items():
412- if not event_files:
413- continue
414- totwidth = float(self.banner.get('param', 'decay', abs(pdg)).value)
415- if to_decay[pdg] == nb_event:
416- # Exactly one particle of this type to decay by event
417- pwidth = sum([event_files[k].cross for k in event_files])
418- if pwidth > 1.01 * totwidth:
419- logger.critical("Branching ratio larger than one for %s " % pdg)
420- br *= pwidth / totwidth
421- elif to_decay[pdg] % nb_event == 0:
422- # More than one particle of this type to decay by event
423- # Need to check the number of event file to check if we have to
424- # make separate type of decay or not.
425- nb_mult = to_decay[pdg] // nb_event
426- if nb_mult == len(event_files):
427- for k in event_files:
428- pwidth = event_files[k].cross
429- if pwidth > 1.01 * totwidth:
430- logger.critical("Branching ratio larger than one for %s " % pdg)
431- br *= pwidth / totwidth
432- br *= math.factorial(nb_mult)
433- else:
434- pwidth = sum(event_files[k].cross for k in event_files)
435+ if not self.options['cross_section']:
436+ br = 1
437+ for (pdg, event_files) in evt_decayfile.items():
438+ if not event_files:
439+ continue
440+ totwidth = float(self.banner.get('param', 'decay', abs(pdg)).value)
441+ if to_decay[pdg] == nb_event:
442+ # Exactly one particle of this type to decay by event
443+ pwidth = sum([event_files[k].cross for k in event_files])
444 if pwidth > 1.01 * totwidth:
445 logger.critical("Branching ratio larger than one for %s " % pdg)
446- br *= (pwidth / totwidth)**nb_mult
447- else:
448- raise self.InvalidCmd("The bridge mode of MadSpin does not support event files where events do not *all* share the same set of final state particles to be decayed.")
449+ br *= pwidth / totwidth
450+ elif to_decay[pdg] % nb_event == 0:
451+ # More than one particle of this type to decay by event
452+ # Need to check the number of event file to check if we have to
453+ # make separate type of decay or not.
454+ nb_mult = to_decay[pdg] // nb_event
455+ if nb_mult == len(event_files):
456+ for k in event_files:
457+ pwidth = event_files[k].cross
458+ if pwidth > 1.01 * totwidth:
459+ logger.critical("Branching ratio larger than one for %s " % pdg)
460+ br *= pwidth / totwidth
461+ br *= math.factorial(nb_mult)
462+ else:
463+ pwidth = sum(event_files[k].cross for k in event_files)
464+ if pwidth > 1.01 * totwidth:
465+ logger.critical("Branching ratio larger than one for %s " % pdg)
466+ br *= (pwidth / totwidth)**nb_mult
467+ else:
468+ raise self.InvalidCmd("The bridge mode of MadSpin does not support event files where events do not *all* share the same set of final state particles to be decayed.")
469+ else:
470+ br = 1
471 self.branching_ratio = br
472 self.efficiency = 1
473- self.cross, self.error = self.banner.get_cross(witherror=True)
474+ try:
475+ self.cross, self.error = self.banner.get_cross(witherror=True)
476+ except:
477+ if self.options['input_format'] != 'lhe':
478+ self.cross, self.error = 0, 0
479 self.cross *= br
480 self.error *= br
481
482-
483 # modify the cross-section in the init block of the banner
484- self.banner.scale_init_cross(self.branching_ratio)
485-
486-
487+ if not self.options['cross_section']:
488+ self.banner.scale_init_cross(self.branching_ratio)
489+ else:
490+
491+ if self.options['input_format'] in ['lhe_no_banner','hepmc'] and 'init' not in self.banner:
492+ self.cross = sum(self.options['cross_section'].values())
493+ self.error = 0
494+ self.branching_ratio = 1
495+ else:
496+ self.banner.modify_init_cross(self.options['cross_section'])
497+ new_cross, new_error = self.banner.get_cross(witherror=True)
498+ self.branching_ratio = new_cross / self.cross
499+ self.cross = new_cross
500+ self.error = new_error
501+
502 # 3. Merge the various file together.
503- output_lhe = lhe_parser.EventFile(orig_lhe.name.replace('.lhe', '_decayed.lhe.gz'), 'w')
504- self.banner.write(output_lhe, close_tag=False)
505+ if self.options['input_format'] == 'hepmc':
506+ name = orig_lhe.name.replace('.hepmc', '_decayed.lhe')
507+ if not name.endswith('.gz'):
508+ name = '%s.gz' % name
509+
510+ output_lhe = lhe_parser.EventFile(name, 'w')
511+ else:
512+ name = orig_lhe.name.replace('.lhe', '_decayed.lhe')
513+ if not name.endswith('.gz'):
514+ name = '%s.gz' % name
515+ output_lhe = lhe_parser.EventFile(name, 'w')
516+ try:
517+ self.banner.write(output_lhe, close_tag=False)
518+ except Exception:
519+ if self.options['input_format'] == 'lhe':
520+ raise
521
522 # initialise object which store not use event due to wrong helicity
523 bufferedEvents_decay = {}
524@@ -856,8 +968,9 @@
525 start = time.time()
526 counter = 0
527 orig_lhe.seek(0)
528+
529 for event in orig_lhe:
530- if counter and counter % 1000 == 0 and float(str(counter)[1:]) ==0:
531+ if counter and counter % 100 == 0 and float(str(counter)[1:]) ==0:
532 print "decaying event number %s [%s s]" % (counter, time.time()-start)
533 counter +=1
534
535@@ -866,10 +979,17 @@
536 particles = [p for p in event if int(p.status) == 1.0]
537 random.shuffle(particles)
538 ids = [particle.pid for particle in particles]
539+ br = 1 #br for that particular events (for special/weighted case)
540+ hepmc_output = lhe_parser.Event() #for hepmc case: collect the decay particle
541 for i,particle in enumerate(particles):
542+ #misc.sprint(i, particle.pdg, particle.pid)
543+ #misc.sprint(self.final_state, evt_decayfile)
544 # check if we need to decay the particle
545- if particle.pdg not in self.final_state or particle.pdg not in evt_decayfile:
546- continue # nothing to do for this particle
547+ if self.final_state and particle.pdg not in self.final_state:
548+ continue # nothing to do for this particle
549+ if particle.pdg not in evt_decayfile:
550+ continue # nothing to do for this particle
551+
552 # check how the decay need to be done
553 nb_decay = len(evt_decayfile[particle.pdg])
554 if nb_decay == 0:
555@@ -888,14 +1008,28 @@
556 cumul = 0
557 for j,events in evt_decayfile[particle.pdg].items():
558 cumul += events.cross
559- if r < cumul:
560+ if r <= cumul:
561 decay_file = events
562 decay_file_nb = j
563- else:
564 break
565-
566+ else:
567+ # security for numerical accuracy issue... (unlikely but better safe)
568+ if (cumul-tot)/tot < 1e-5:
569+ decay_file = events
570+ decay_file_nb = j
571+ else:
572+ misc.sprint(j,cumul, events.cross, tot, (tot-cumul)/tot)
573+ raise Exception
574+
575+ if self.options['new_wgt'] == 'BR':
576+ tot_width = float(self.banner.get('param', 'decay', abs(pdg)).value)
577+ if tot_width:
578+ br = decay_file.cross / tot_width
579 # ok start the procedure
580- helicity = particle.helicity
581+ if hasattr(particle,'helicity'):
582+ helicity = particle.helicity
583+ else:
584+ helicity = 9
585 bufferedEvents = bufferedEvents_decay[particle.pdg][decay_file_nb]
586
587 # now that we have the file to read. find the associate event
588@@ -910,8 +1044,8 @@
589 except StopIteration:
590 # check how far we are
591 ratio = counter / nb_event
592- needed = 1.05 * to_decay[particle.pdg]/ratio - counter
593- needed = min(1000, max(needed, 1000))
594+ needed = 1.05 * to_decay[particle.pdg] - counter
595+ needed = min(100000, max(needed, 6000))
596 with misc.MuteLogger(["madgraph", "madevent", "ALOHA", "cmdprint"], [50,50,50,50]):
597 new_file = self.generate_events(particle.pdg, needed, mg5, [decay_file_nb])
598 evt_decayfile[particle.pdg].update(new_file)
599@@ -927,14 +1061,36 @@
600 # only add to the buffering if the buffer is not too large
601 bufferedEvents[helicity].append(decay)
602 # now that we have the event make the merge
603- particle.add_decay(decay)
604+ if self.options['input_format'] != 'hepmc':
605+ particle.add_decay(decay)
606+ else:
607+ if len(hepmc_output) == 0:
608+ hepmc_output.append(lhe_parser.Particle(event=hepmc_output))
609+ hepmc_output[0].color2 = 0
610+ decayed_particle = lhe_parser.Particle(particle, hepmc_output)
611+ hepmc_output.append(decayed_particle)
612+ decayed_particle.add_decay(decay)
613 # change the weight associate to the event
614- event.wgt *= self.branching_ratio
615- wgts = event.parse_reweight()
616- for key in wgts:
617- wgts[key] *= self.branching_ratio
618- # all particle have been decay if needed
619- output_lhe.write(str(event))
620+ if self.options['new_wgt'] == 'cross-section':
621+ event.wgt *= self.branching_ratio
622+ br = self.branching_ratio
623+ else:
624+ event.wgt *= br
625+
626+ if self.options['input_format'] != 'hepmc':
627+ wgts = event.parse_reweight()
628+ for key in wgts:
629+ wgts[key] *= br
630+ # all particle have been decay if needed
631+ output_lhe.write(str(event))
632+ else:
633+ hepmc_output.wgt = event.wgt
634+ hepmc_output.nexternal = len(hepmc_output) # the append does not update nexternal
635+ hepmc_output.assign_mother()
636+ output_lhe.write(str(hepmc_output))
637+ else:
638+ if counter==0:
639+ raise Exception
640 output_lhe.write('</LesHouchesEvents>\n')
641
642
643@@ -971,7 +1127,12 @@
644 cumul allow to merge all the definition in one run (add process)
645 to generate events according to cross-section
646 """
647-
648+ if not hasattr(self, 'me_int'):
649+ self.me_int = {}
650+
651+
652+
653+ nb_event = int(nb_event) # in case of hepmc request the nb_event is not an integer
654 if cumul:
655 width = 0.
656 else:
657@@ -1003,31 +1164,36 @@
658 options = dict(mg5.options)
659 if self.options['ms_dir']:
660 # we are in gridpack mode -> create it
661- me5_cmd = madevent_interface.MadEventCmdShell(me_dir=os.path.realpath(\
662- decay_dir), options=options)
663- me5_cmd.options["automatic_html_opening"] = False
664- me5_cmd.options["madanalysis5_path"] = None
665- me5_cmd.options["madanalysis_path"] = None
666- me5_cmd.allow_notification_center = False
667- try:
668- os.remove(pjoin(decay_dir, 'Cards', 'madanalysis5_parton_card_default.dat'))
669- os.remove(pjoin(decay_dir, 'Cards', 'madanalysis5_parton_card.dat'))
670- except Exception,error:
671- logger.debug(error)
672- pass
673+ if decay_dir in self.me_int:
674+ me5_cmd = self.me_int[decay_dir]
675+ else:
676+ me5_cmd = madevent_interface.MadEventCmdShell(me_dir=os.path.realpath(\
677+ decay_dir), options=options)
678+ me5_cmd.options["automatic_html_opening"] = False
679+ me5_cmd.options["madanalysis5_path"] = None
680+ me5_cmd.options["madanalysis_path"] = None
681+ me5_cmd.allow_notification_center = False
682+ try:
683+ os.remove(pjoin(decay_dir, 'Cards', 'madanalysis5_parton_card_default.dat'))
684+ os.remove(pjoin(decay_dir, 'Cards', 'madanalysis5_parton_card.dat'))
685+ except Exception,error:
686+ logger.debug(error)
687+ pass
688+ self.me_int[decay_dir] = me5_cmd
689+
690 if self.options["run_card"]:
691- run_card = self.options["run_card"]
692+ run_card = self.run_card
693 else:
694 run_card = banner.RunCard(pjoin(decay_dir, "Cards", "run_card.dat"))
695
696- run_card["iseed"] = self.seed
697+ run_card["iseed"] = self.options['seed']
698 run_card['gridpack'] = True
699 run_card['systematics_program'] = 'False'
700 run_card['use_syst'] = False
701 run_card.write(pjoin(decay_dir, "Cards", "run_card.dat"))
702 param_card = self.banner['slha']
703 open(pjoin(decay_dir, "Cards", "param_card.dat"),"w").write(param_card)
704- self.seed += 1
705+ self.options['seed'] += 1
706 # actually creation
707 me5_cmd.exec_cmd("generate_events run_01 -f")
708 if output_width:
709@@ -1041,26 +1207,35 @@
710 misc.call(['tar', '-xzpvf', 'run_01_gridpack.tar.gz'], cwd=decay_dir)
711
712 # Now generate the events
713-
714 if not self.options['ms_dir']:
715- me5_cmd = madevent_interface.MadEventCmdShell(me_dir=os.path.realpath(\
716- decay_dir), options=mg5.options)
717- me5_cmd.options["automatic_html_opening"] = False
718- me5_cmd.options["automatic_html_opening"] = False
719- me5_cmd.options["madanalysis5_path"] = None
720- me5_cmd.options["madanalysis_path"] = None
721- me5_cmd.allow_notification_center = False
722- try:
723- os.remove(pjoin(decay_dir, 'Cards', 'madanalysis5_parton_card_default.dat'))
724- os.remove(pjoin(decay_dir, 'Cards', 'madanalysis5_parton_card.dat'))
725- except Exception,error:
726- logger.debug(error)
727- pass
728+ if decay_dir in self.me_int:
729+ me5_cmd = self.me_int[decay_dir]
730+ else:
731+ me5_cmd = madevent_interface.MadEventCmdShell(me_dir=os.path.realpath(\
732+ decay_dir), options=mg5.options)
733+ me5_cmd.options["automatic_html_opening"] = False
734+ me5_cmd.options["automatic_html_opening"] = False
735+ me5_cmd.options["madanalysis5_path"] = None
736+ me5_cmd.options["madanalysis_path"] = None
737+ me5_cmd.allow_notification_center = False
738+ try:
739+ os.remove(pjoin(decay_dir, 'Cards', 'madanalysis5_parton_card_default.dat'))
740+ os.remove(pjoin(decay_dir, 'Cards', 'madanalysis5_parton_card.dat'))
741+ except Exception,error:
742+ logger.debug(error)
743+ pass
744+ self.me_int[decay_dir] = me5_cmd
745 if self.options["run_card"]:
746- run_card = self.options["run_card"]
747+ run_card = self.run_card
748 else:
749 run_card = banner.RunCard(pjoin(decay_dir, "Cards", "run_card.dat"))
750 run_card["nevents"] = int(1.2*nb_event)
751+ # Handle the banner of the output file
752+ if not self.seed:
753+ self.seed = random.randint(0, int(30081*30081))
754+ self.do_set('seed %s' % self.seed)
755+ logger.info('Will use seed %s' % self.seed)
756+ self.history.insert(0, 'set seed %s' % self.seed)
757 run_card["iseed"] = self.seed
758 run_card["systematics_program"] = 'None'
759 run_card.write(pjoin(decay_dir, "Cards", "run_card.dat"))
760@@ -1140,8 +1315,7 @@
761 if particle.status == 1 and particle.pdg in asked_to_decay:
762 # final state and tag as to decay
763 to_decay[particle.pdg] += 1
764- #misc.sprint(to_decay)
765- #misc.sprint("import the mode -> temporary with logging")
766+
767 with misc.MuteLogger(["madgraph", "madevent", "ALOHA", "cmdprint"], [50,50,50,50]):
768 mg5 = self.mg5cmd
769 if not self.model:
770@@ -1436,10 +1610,6 @@
771 full_event = lhe_parser.Event(str(production))
772 full_event = full_event.add_decays(decays)
773 full_me = self.calculate_matrix_element(full_event)
774- #misc.sprint(full_event)
775- #misc.sprint([p.pdg for p in production])
776- #misc.sprint([p.pdg for p in full_event])
777- #misc.sprint(full_me, production_me, decay_me)
778 return full_event, full_me/(production_me*decay_me)
779
780
781@@ -1457,7 +1627,6 @@
782 init = (-init[0],)
783 final = tuple(-i for i in final)
784 tag = (init, final)
785- misc.sprint([k for k in self.all_me.keys() if len(k[0])==1])
786 orig_order = self.all_me[tag]['order']
787
788 pdir = self.all_me[tag]['pdir']
789@@ -1520,7 +1689,6 @@
790
791 rwgt_interface.ReweightInterface.get_LO_definition_from_NLO()
792
793-
794
795
796 if __name__ == '__main__':
797
798=== modified file 'MadSpin/madspin'
799--- MadSpin/madspin 2013-11-12 23:52:05 +0000
800+++ MadSpin/madspin 2018-12-20 08:18:55 +0000
801@@ -49,6 +49,7 @@
802 if len(args) == 0:
803 args = ''
804
805+
806 import subprocess
807
808 # Check if optimize mode is (and should be) activated
809@@ -114,23 +115,6 @@
810 pass
811 import MadSpin.interface_madspin as interface
812
813-try:
814- cmd_line = interface.MadSpinInterface()
815- cmd_line.use_rawinput = True
816- cmd_line.cmdloop()
817-except:
818- pass
819-try:
820- cmd_line.exec_cmd('quit all', printcmd=False)
821- readline.set_history_length(100)
822- if not os.path.exists(os.path.join(os.environ['HOME'], '.mg5')):
823- os.mkdir(os.path.join(os.environ['HOME'], '.mg5'))
824- readline.write_history_file(history_file)
825-except Exception, error:
826- pass
827-
828-sys.exit(0)
829-
830 # Call the cmd interface main loop
831 try:
832 if options.file or args:
833@@ -143,12 +127,14 @@
834 cmd_line = interface.MasterCmdWeb()
835 cmd_line.debug_output = os.path.join(os.path.dirname(input_file),'generation.log')
836 cmd_line.use_rawinput = False
837- cmd_line.run_cmd('import ' + input_file)
838+ cmd_line.import_command_file(input_file)
839 cmd_line.run_cmd('quit')
840 else:
841+ print "using input+file", input_file
842 cmd_line = interface.MadSpinInterface()
843 cmd_line.use_rawinput = False
844- cmd_line.run_cmd('import ' + input_file)
845+ cmd_line.haspiping = False
846+ cmd_line.import_command_file(input_file)
847 cmd_line.run_cmd('quit')
848 else:
849 # Interactive mode
850@@ -160,8 +146,20 @@
851 cmd_line = interface.MasterCmdWeb()
852 cmd_line.cmdloop()
853 else:
854- cmd_line = interface.MasterCmd(mgme_dir = options.mgme_dir)
855- cmd_line.cmdloop()
856+ try:
857+ cmd_line = interface.MadSpinInterface()
858+ cmd_line.use_rawinput = True
859+ cmd_line.cmdloop()
860+ except:
861+ pass
862+ try:
863+ cmd_line.exec_cmd('quit all', printcmd=False)
864+ readline.set_history_length(100)
865+ if not os.path.exists(os.path.join(os.environ['HOME'], '.mg5')):
866+ os.mkdir(os.path.join(os.environ['HOME'], '.mg5'))
867+ readline.write_history_file(history_file)
868+ except Exception, error:
869+ pass
870 except KeyboardInterrupt:
871 print 'writting history and quit on KeyboardInterrupt'
872 pass
873
874=== modified file 'MadSpin/src/driver.f'
875--- MadSpin/src/driver.f 2017-08-03 18:49:25 +0000
876+++ MadSpin/src/driver.f 2018-12-20 08:18:55 +0000
877@@ -340,10 +340,10 @@
878 if (jac.lt.0d0) then
879 counter2=counter2+1
880 counter3=counter3+1
881-c if (counter3.gt.500) then
882-c write(*,*) "500_pts_failed_stop_executation"
883-c stop
884-c endif
885+ if (counter3.gt.500*8*100) then
886+ write(*,*) "500_pts_failed_stop_executation"
887+ stop
888+ endif
889 if (counter2.ge.8) then ! use another topology to generate PS points
890 do k=1,n_max_cg
891 amp2(k)=0d0
892@@ -960,7 +960,7 @@
893 include 'nexternal_prod.inc'
894 !include 'run.inc'
895 c arguments
896- double precision jac,x(36),p(0:3,nexternal), p_prod(0:3,nexternal)
897+ double precision jac,x(36),p(0:3,nexternal), p_prod(0:3,nexternal_prod)
898 integer itree(2,-nexternal:-1)
899 double precision qmass(-nexternal:0),qwidth(-nexternal:0)
900 c common
901
902=== modified file 'Template/LO/Cards/run_card.dat'
903--- Template/LO/Cards/run_card.dat 2018-04-25 21:20:23 +0000
904+++ Template/LO/Cards/run_card.dat 2018-12-20 08:18:55 +0000
905@@ -12,7 +12,7 @@
906 # mind the format: value = variable ! comment *
907 # *
908 # To display more options, you can type the command: *
909-* update full_run_card *
910+# update full_run_card *
911 #*********************************************************************
912 #
913 #*******************
914
915=== modified file 'Template/LO/SubProcesses/genps.f'
916--- Template/LO/SubProcesses/genps.f 2018-04-20 08:38:20 +0000
917+++ Template/LO/SubProcesses/genps.f 2018-12-20 08:18:55 +0000
918@@ -41,7 +41,7 @@
919 integer mincfig,maxcfig !Range of configurations
920 integer invar
921 double precision wgt !(input and output)
922- double precision x(maxdim),p(maxdim) !x,p (output) [p(0:3,nexternal)]
923+ double precision x(*),p(*) !x,p (output) [p(0:3,nexternal)]
924 c
925 c Local
926 c
927@@ -104,7 +104,7 @@
928 c
929 integer iconfig,mincfig,maxcfig,invar
930 double precision p1(0:3,nexternal+1)
931- double precision x(maxinvar)
932+ double precision x(*)
933 double precision wgt
934 c
935 c Local
936@@ -191,8 +191,6 @@
937 c
938 include 'configs.inc'
939 data firsttime/.true./
940- integer isym(0:100)
941-c data isym /2,1,5,27,42,47,0,0,0,0,0/
942 data jfig/1/
943 c-----
944 c Begin Code
945@@ -215,11 +213,6 @@
946 write(*,'(a,12e10.3)') ' Masses:',(m(i),i=1,nparticles)
947 endif !First_time
948
949- if (.false.) then
950- iconfig = isym(jfig)
951- jfig = jfig+1
952- if (jfig .gt. isym(0)) jfig=1
953- endif
954 this_config = iconfig !Pass iconfig to amplitude routine
955 C
956 C Get fraction of beam energy if pdf's are used
957@@ -279,19 +272,18 @@
958 cm_rap=.5d0*dlog((p0+p3)/(p0-p3))
959 set_cm_rap=.true.
960 c Set shat
961- s(-nbranch) = m2**2+2*xbk(1)*ebeam(1) *
962- $ (ebeam(2)+sqrt(ebeam(2)**2-m2**2))
963+ s(-nbranch) = x(ndim)*stot
964 elseif (abs(lpp(2)) .ge. 1) then
965 call sample_get_x(sjac,x(ndim),ndim,mincfig,0d0,1d0)
966 xbk(2) = x(ndim)
967+
968 c Set CM rapidity for use in the rap() function
969 p0=ebeam(1)+xbk(2)*ebeam(2)
970 p3=sqrt(ebeam(1)**2-m1**2)-xbk(2)*ebeam(2)
971 cm_rap=.5d0*dlog((p0+p3)/(p0-p3))
972 set_cm_rap=.true.
973 c Set shat
974- s(-nbranch) = m1**2+2*(ebeam(1)+sqrt(ebeam(1)**2-m1**2))
975- $ * xbk(2)*ebeam(2)
976+ s(-nbranch) = x(ndim)*stot
977 else
978 c Set CM rapidity for use in the rap() function
979 p0=ebeam(1) + ebeam(2)
980@@ -576,7 +568,7 @@
981 if (abs(lpp(1)) .eq. 3) m1 = 0.000511d0
982 if (abs(lpp(2)) .eq. 3) m2 = 0.000511d0
983 if (mass_ion(1).ge.0d0) m1 = mass_ion(1)
984- if (mass_ion(2).ge.0d0) m1 = mass_ion(2)
985+ if (mass_ion(2).ge.0d0) m2 = mass_ion(2)
986 if(ebeam(1).lt.m1.and.lpp(1).ne.9) ebeam(1)=m1
987 if(ebeam(2).lt.m2.and.lpp(2).ne.9) ebeam(2)=m2
988 pi1(0)=ebeam(1)
989@@ -598,7 +590,6 @@
990 maxcfig=iconfig
991 call map_invarients(minvar,nconfigs,ninvar,mincfig,maxcfig,nexternal,nincoming)
992 maxwgt=0d0
993-c write(*,'(a,12i4)') 'Summing configs',(isym(i),i=1,isym(0))
994 nparticles = nexternal
995 nfinal = nparticles-nincoming
996 nbranch = nparticles-2
997@@ -617,8 +608,6 @@
998 c
999 c do i=1,mapconfig(0)
1000 do i=mincfig,maxcfig
1001-c do k=1,isym(0)
1002-c i = isym(k)
1003 write(*,'(15i4)') i,(minvar(j,i),j=1,ndim)
1004 do j=1,ndim
1005 ipole = minvar(j,i)
1006@@ -663,7 +652,7 @@
1007 c double precision spole(-max_branch:0),swidth(-max_branch:0)
1008 double precision jac,pswgt
1009 integer nbranch
1010- double precision x(40) ! ja 3/2/11 21->40 after strange segfault
1011+ double precision x(*) ! ja 3/2/11 21->40 after strange segfault
1012 c
1013 c Local
1014 c
1015
1016=== modified file 'Template/LO/SubProcesses/reweight.f'
1017--- Template/LO/SubProcesses/reweight.f 2018-03-11 12:29:51 +0000
1018+++ Template/LO/SubProcesses/reweight.f 2018-12-20 08:18:55 +0000
1019@@ -1,3 +1,21 @@
1020+c for cross-checking change in this file.
1021+c here is a minimal list of process that we have to
1022+c test
1023+c
1024+c SM
1025+c ----
1026+c p p > t t~ (up to 2jet)
1027+c p p > w+ (up to 3 jet)
1028+c p p > j j w+ (ordering seems important)
1029+c p p > z t t~ j j (no MLM needed)
1030+c
1031+c
1032+c HEFT
1033+c ----
1034+c p p > h j b b~
1035+c q q > a a g q q
1036+c g g > h g q q
1037+
1038 double precision function gamma(q0)
1039 c**************************************************
1040 c calculates the branching probability
1041@@ -226,13 +244,15 @@
1042 integer iddgluon, iddother, idgluon, idother
1043 logical isqcd
1044 external isqcd
1045+ integer get_color
1046+ external get_color
1047
1048 idmo=ipdg(imo)
1049 idda1=ipdg(ida1)
1050 idda2=ipdg(ida2)
1051
1052 if (btest(mlevel,4)) then
1053- write(*,*) ' updating ipart for: ',ida1,ida2,' -> ',imo
1054+ write(*,*) 'updating ipart for: ',ida1,ida2,' -> ',imo
1055 endif
1056
1057 if (btest(mlevel,4)) then
1058@@ -274,7 +294,6 @@
1059 $ ' (',ipdg(imo),')'
1060 return
1061 endif
1062-
1063 c FS clustering
1064 c Transmit parton PDG code for parton vertex
1065 if(isjet(idmo)) then
1066@@ -353,14 +372,26 @@
1067 c quark -> gluon-quark or Z-quark or h-quark or W-quark
1068 ipart(1,imo)=ipart(1,ida2)
1069 ipart(2,imo)=0
1070- else
1071+ else if(iabs(get_color(idmo)).eq.3.and.iabs(get_color(idda1)).eq.3.and.get_color(idda2).eq.1) then
1072+c exotic q > q' Scalar
1073+ ipart(1,imo)=ipart(1,ida1)
1074+ ipart(2,imo)=0
1075+ else if(iabs(get_color(idmo)).eq.3.and.iabs(get_color(idda2)).eq.3.and.get_color(idda1).eq.1) then
1076+c exotic q > Scalar q'
1077+ ipart(1,imo)=ipart(1,ida2)
1078+ ipart(2,imo)=0
1079+ else if (get_color(idmo).eq.1) then
1080 c Color singlet
1081 ipart(1,imo)=ipart(1,ida1)
1082 ipart(2,imo)=ipart(1,ida2)
1083+ else
1084+ write(*,*) idmo,'>', idda1, idda2, 'color', get_color(idmo),'>', get_color(idda1), get_color(idda2)
1085+ write(*,*) "failed for ipartupdate. Please retry without MLM/default dynamical scale"
1086+ stop 3
1087 endif
1088
1089 if (btest(mlevel,4)) then
1090- write(*,*) ' -> ',(ipart(i,imo),i=1,2),' (',ipdg(imo),')'
1091+ write(*,*) 'XY -> ',(ipart(i,imo),i=1,2),' (',ipdg(imo),')'
1092 endif
1093
1094 return
1095@@ -522,7 +553,8 @@
1096 common/to_stot/stot,m1,m2
1097
1098 C local variables
1099- integer i, j, idi, idj, k
1100+ integer i, j, idi, idj, k,m
1101+ integer get_color
1102 real*8 PI
1103 parameter( PI = 3.14159265358979323846d0 )
1104 integer iforest(2,-max_branch:-1,lmaxconfigs)
1105@@ -545,6 +577,7 @@
1106 logical chclusold,fail,increasecode
1107 save chclusold
1108 integer tmpindex
1109+ integer pdgm, pdgid1, pdgid2
1110
1111 logical isqcd,isjet,isparton,cluster,isjetvx,is_octet
1112 integer ifsno
1113@@ -676,6 +709,7 @@
1114 c increasecode gives whether we should increase jcode at next vertex
1115 increasecode=.false.
1116 do n=1,nexternal-2
1117+c write(*,*) 'QCD jet status (before n= ',n,'):',(iqjets(i),i=3,nexternal)
1118 do i=1,2 ! index of the child in the interaction
1119 do j=1,2 ! j index of the beam
1120 if(idacl(n,i).eq.ibeam(j))then
1121@@ -746,8 +780,16 @@
1122 c The ishft gives the FS particle corresponding to imocl
1123 if(.not.is_octet(ipdgcl(ishft(1,ipart(1,imocl(n))-1),igraphs(1),iproc)))then
1124 ! split case for q a > q and for g > g h (with the gluon splitting into quark)
1125- if (ipart(2,imocl(n)).eq.0) then ! q a > q case
1126- iqjets(ipart(1,imocl(n)))=0
1127+ ! also check for case of three scalar interaction (then do nothing)
1128+ pdgm = ipdgcl(imocl(n),igraphs(1),iproc)
1129+ pdgid1 = ipdgcl(idacl(n,1),igraphs(1),iproc)
1130+ pdgid2 = ipdgcl(idacl(n,2),igraphs(1),iproc)
1131+ if (.not.isqcd(pdgm).and..not.isqcd(pdgid1).and..not.isqcd(pdgid2)) then
1132+ ! this is to avoid to do weird stuff for w+ w- z (or h h h)
1133+ ! this fix an issue for qq_zttxqq G1594.08
1134+ continue
1135+ elseif (ipart(2,imocl(n)).eq.0) then ! q a > q case
1136+ iqjets(ipart(1,imocl(n)))=0
1137 else ! octet. want to be sure that both are tagged as jet before removing one
1138 ! this prevent that both are removed in case of g > g h , g > q1 q2, q1 > a q1.
1139 ! at least one of the two should be kept as jet
1140@@ -791,7 +833,57 @@
1141 goodjet(imocl(n))=
1142 $ (isjet(ipdgcl(imocl(n),igraphs(1),iproc)).and.
1143 $ goodjet(idacl(n,1)).and.goodjet(idacl(n,2)))
1144- endif
1145+
1146+c check case with g > g g
1147+c where the hardest gluon is not goodjet but the other is.
1148+c in that case change ipart(1,) of the mother gluon
1149+c pure QCD jet
1150+c need to take care of the following case:
1151+c tttttttttt
1152+c gggggggggggggggg
1153+c ggggggggg tttttttttt
1154+c gggggggg
1155+c
1156+c in that case the up gluon can be tag as the hardest one
1157+c but this one is also lead to no QCD one.
1158+c so in that case we have to change ipart(1) to the sofest gluon
1159+ pdgm = ipdgcl(imocl(n),igraphs(1),iproc)
1160+ pdgid1 = ipdgcl(idacl(n,1),igraphs(1),iproc)
1161+ pdgid2 = ipdgcl(idacl(n,2),igraphs(1),iproc)
1162+ if (is_octet(pdgm).and.is_octet(pdgid1).and.is_octet(pdgid2))then
1163+c write(*,*) 'pure QCD vertex (2)'
1164+c write(*,*) pdgm , '>', pdgid1,' ', pdgid2
1165+c write(*,*) 'ipart', ipart(1,imocl(n)), ipart(2,imocl(n))
1166+c write(*,*) 'id', imocl(n), idacl(n,1),idacl(n,2)
1167+c write(*,*) 'ipart',ipart(1,imocl(n)),'/', ipart(2,imocl(n)), ipart(1,idacl(n,1)),'/', ipart(2,idacl(n,1)),
1168+c $ ipart(1,idacl(n,2)),'/', ipart(2,idacl(n,2))
1169+c write(*,*) 'googjet', goodjet(idacl(n,1)),goodjet(idacl(n,2))
1170+ if (ipart(1,imocl(n)).eq.ipart(1, idacl(n,1))) then
1171+ if (.not.goodjet(idacl(n,1)).and.goodjet(idacl(n,2))) then
1172+c write(*,*) 'ggg with hard jet set a QED the second jet lead to', ipart(1,idacl(n,2)), ipart(2,idacl(n,2))
1173+ do m =n_max_cl,n,-1
1174+ if(ipart(1,m).eq.ipart(1,imocl(n)).and.ipart(2,m).eq.ipart(2,imocl(n)))then
1175+ ipart(1,m) = ipart(1,idacl(n,2))
1176+ ipart(2,m) = ipart(2,idacl(n,2))
1177+ endif
1178+ enddo
1179+ endif
1180+ else
1181+ if (.not.goodjet(idacl(n,2)).and.goodjet(idacl(n,1))) then
1182+c write(*,*) 'ggg with hard jet set a QED the second jet lead to', ipart(1,idacl(n,1)), ipart(2,idacl(n,1))
1183+ do m =n_max_cl,n,-1
1184+ if(ipart(1,m).eq.ipart(1,imocl(n)).and.ipart(2,m).eq.ipart(2,imocl(n)))then
1185+ ipart(1,m) = ipart(1,idacl(n,1))
1186+ ipart(2,m) = ipart(2,idacl(n,1))
1187+ endif
1188+ enddo
1189+ endif
1190+ endif
1191+ endif
1192+
1193+
1194+
1195+ endif
1196 enddo
1197
1198 if (btest(mlevel,4))then
1199@@ -836,8 +928,8 @@
1200 endif
1201 enddo
1202 njetstore(iconfig)=njets
1203- if (btest(mlevel,4))
1204- $ write(*,*) 'Storing jets: ',(iqjetstore(i,iconfig),i=1,njets)
1205+ if (btest(mlevel,4))
1206+ $ write(*,*) 'Storing jets: ',(iqjetstore(i,iconfig),i=1,njets)
1207 c Recluster without requiring chcluster
1208 goto 100
1209 else
1210
1211=== modified file 'Template/LO/SubProcesses/unwgt.f'
1212--- Template/LO/SubProcesses/unwgt.f 2017-06-22 08:03:29 +0000
1213+++ Template/LO/SubProcesses/unwgt.f 2018-12-20 08:18:55 +0000
1214@@ -513,6 +513,10 @@
1215
1216 double precision stot,m1,m2
1217 common/to_stot/stot,m1,m2
1218+
1219+ INTEGER IMIRROR
1220+ INTEGER IPROC
1221+ COMMON/TO_MIRROR/IMIRROR, IPROC
1222 c
1223 c Data
1224 c
1225@@ -641,6 +645,13 @@
1226 pb(4,isym(j,jsym))=pmass(j)
1227 enddo
1228 endif
1229+
1230+ if (IMIRROR.eq.2.and.pmass(1).ne.pmass(2)) then
1231+c Note that in this context isym(1,jsym) should never be "2" since the mass differ
1232+ pb(4,isym(1,jsym))=pmass(2)
1233+ pb(4,isym(2,jsym))=pmass(1)
1234+ endif
1235+
1236 c
1237 c Add info on resonant mothers
1238 c
1239
1240=== added file 'Template/NLO/FixedOrderAnalysis/analysis_HwU_general.f'
1241--- Template/NLO/FixedOrderAnalysis/analysis_HwU_general.f 1970-01-01 00:00:00 +0000
1242+++ Template/NLO/FixedOrderAnalysis/analysis_HwU_general.f 2018-12-20 08:18:55 +0000
1243@@ -0,0 +1,880 @@
1244+cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
1245+ subroutine analysis_begin(nwgt,weights_info)
1246+cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
1247+ implicit none
1248+ integer nwgt
1249+ character*(*) weights_info(*)
1250+ integer i,l
1251+ character*6 cc(2)
1252+ data cc/'|T@NLO','|T@LO '/
1253+
1254+c Also specific perturbative orders can be directly plotted, adding for examples
1255+c the following further entries in the variable data
1256+c $ ' |T@QCD4QED0 ',
1257+c $ ,' |T@QCD2QED2 ',' |T@QCD0QED4 ',' |T@QCD6QED0 '
1258+c $ ,' |T@QCD4QED2 ',' |T@QCD2QED4 ',' |T@QCD0QED6 '
1259+c $ ,' |T@QCD8QED0 ',' |T@QCD6QED2 ',' |T@QCD4QED4 '
1260+c $ ,' |T@QCD2QED6 ',' |T@QCD0QED8 '
1261+c
1262+c See also line 376 in this file
1263+ call HwU_inithist(nwgt,weights_info)
1264+ do i=1,2
1265+ l=(i-1)*55
1266+c transverse momenta
1267+ call HwU_book(l+ 1,'total rate '//cc(i),1,0.5d0,1.5d0)
1268+ call HwU_book(l+ 2,'1st charged lepton log pT '//cc(i),25,-0.2d0,3.8d0)
1269+ call HwU_book(l+ 3,'2nd charged lepton log pT '//cc(i),25,-0.2d0,3.8d0)
1270+ call HwU_book(l+ 4,'3rd charged lepton log pT '//cc(i),25,-0.2d0,3.8d0)
1271+ call HwU_book(l+ 5,'4th charged lepton log pT '//cc(i),25,-0.2d0,3.8d0)
1272+ call HwU_book(l+ 6,'electron log pT '//cc(i),25,-0.2d0,3.8d0)
1273+ call HwU_book(l+ 7,'positron log pT '//cc(i),25,-0.2d0,3.8d0)
1274+ call HwU_book(l+ 8,'mu-plus log pT '//cc(i),25,-0.2d0,3.8d0)
1275+ call HwU_book(l+ 9,'mu-minus log pT '//cc(i),25,-0.2d0,3.8d0)
1276+ call HwU_book(l+14,'epem log pT '//cc(i),25,-0.2d0,3.8d0)
1277+ call HwU_book(l+15,'mupmum log pT '//cc(i),25,-0.2d0,3.8d0)
1278+ call HwU_book(l+16,'1st OSSF lep pair log pT '//cc(i),25,-0.2d0,3.8d0)
1279+ call HwU_book(l+17,'2nd OSSF lep pair log pT '//cc(i),25,-0.2d0,3.8d0)
1280+ call HwU_book(l+18,'epve log pT '//cc(i),25,-0.2d0,3.8d0)
1281+ call HwU_book(l+19,'mumvm log pT '//cc(i),25,-0.2d0,3.8d0)
1282+ call HwU_book(l+20,'1st SF lep-neu pair log pT '//cc(i),25,-0.2d0,3.8d0)
1283+ call HwU_book(l+21,'2nd SF lep-neu pair log pT '//cc(i),25,-0.2d0,3.8d0)
1284+ call HwU_book(l+22,'epemmupmum log pT '//cc(i),25,-0.2d0,3.8d0)
1285+ call HwU_book(l+23,'epvemumvm log pT '//cc(i),25,-0.2d0,3.8d0)
1286+ call HwU_book(l+24,'top quark log pT '//cc(i),25,-0.2d0,3.8d0)
1287+ call HwU_book(l+25,'anti-top quark log pT '//cc(i),25,-0.2d0,3.8d0)
1288+ call HwU_book(l+26,'ttbar log pT '//cc(i),25,-0.2d0,3.8d0)
1289+ call HwU_book(l+27,'log missing Et (neutrinos) '//cc(i),25,-0.2d0,3.8d0)
1290+ call HwU_book(l+28,'1st higgs log pT '//cc(i),25,-0.2d0,3.8d0)
1291+ call HwU_book(l+29,'2nd higgs log pT '//cc(i),25,-0.2d0,3.8d0)
1292+ call HwU_book(l+30,'higgs-pair log pT '//cc(i),25,-0.2d0,3.8d0)
1293+ call HwU_book(l+31,'1st V-boson log pT '//cc(i),25,-0.2d0,3.8d0)
1294+ call HwU_book(l+32,'2nd V-boson log pT '//cc(i),25,-0.2d0,3.8d0)
1295+ call HwU_book(l+33,'3rd V-boson log pT '//cc(i),25,-0.2d0,3.8d0)
1296+ call HwU_book(l+34,'1st jet log pT '//cc(i),25,-0.2d0,3.8d0)
1297+ call HwU_book(l+35,'2nd jet log pT '//cc(i),25,-0.2d0,3.8d0)
1298+ call HwU_book(l+36,'3rd jet log pT '//cc(i),25,-0.2d0,3.8d0)
1299+c
1300+c invariant masses
1301+ call HwU_book(l+37,'epem log M '//cc(i),25,-0.2d0,3.8d0)
1302+ call HwU_book(l+38,'mupmum log M '//cc(i),25,-0.2d0,3.8d0)
1303+ call HwU_book(l+39,'1st OSSF lep pair log M '//cc(i),25,-0.2d0,3.8d0)
1304+ call HwU_book(l+40,'2nd OSSF lep pair log M '//cc(i),25,-0.2d0,3.8d0)
1305+ call HwU_book(l+41,'epve log M '//cc(i),25,-0.2d0,3.8d0)
1306+ call HwU_book(l+42,'mumvm log M '//cc(i),25,-0.2d0,3.8d0)
1307+ call HwU_book(l+43,'1st SF lep-neu pair log M '//cc(i),25,-0.2d0,3.8d0)
1308+ call HwU_book(l+44,'2nd SF lep-neu pair log M '//cc(i),25,-0.2d0,3.8d0)
1309+ call HwU_book(l+45,'epemmupmum log M '//cc(i),25,-0.2d0,3.8d0)
1310+ call HwU_book(l+46,'epvemumvm log M '//cc(i),25,-0.2d0,3.8d0)
1311+ call HwU_book(l+47,'ttbar log M '//cc(i),25,-0.2d0,3.8d0)
1312+ call HwU_book(l+48,'higgs-pair log M '//cc(i),25,-0.2d0,3.8d0)
1313+ call HwU_book(l+49,'j1j2 log M '//cc(i),25,-0.2d0,3.8d0)
1314+ call HwU_book(l+50,'j2j3 log M '//cc(i),25,-0.2d0,3.8d0)
1315+ call HwU_book(l+51,'j1j3 log M '//cc(i),25,-0.2d0,3.8d0)
1316+ call HwU_book(l+52,'j1j2j3 log M '//cc(i),25,-0.2d0,3.8d0)
1317+ call HwU_book(l+53,'3w log M '//cc(i),25,-0.2d0,3.8d0)
1318+c
1319+c HT
1320+ call HwU_book(l+54,'log HT (partons) '//cc(i),25,-0.2d0,3.8d0)
1321+ call HwU_book(l+55,'log HT (reconstructed) '//cc(i),25,-0.2d0,3.8d0)
1322+ enddo
1323+ return
1324+ end
1325+
1326+
1327+
1328+
1329+cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
1330+ subroutine analysis_end(dummy)
1331+cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
1332+ implicit none
1333+ double precision dummy
1334+ call HwU_write_file
1335+ return
1336+ end
1337+
1338+
1339+cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
1340+ subroutine analysis_fill(p,istatus,ipdg,wgts,ibody)
1341+cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
1342+ implicit none
1343+ include 'nexternal.inc'
1344+ include 'cuts.inc'
1345+ integer istatus(nexternal)
1346+ integer iPDG(nexternal)
1347+ double precision p(0:4,nexternal)
1348+ double precision wgts(*)
1349+ integer ibody
1350+ integer i,j,k,kk,l
1351+ double precision www,pQCD(0:3,nexternal),palg,rfj,sycut,yjmax
1352+ $ ,pjet(0:3,nexternal),tmp,ptlep(4),ptem,ptep,ptmm,ptmp,ptepem
1353+ $ ,ptmpmm,ptepve,ptmmvm,ptepemmpmm,ptepvemmvm,ptt,ptat,pttt
1354+ $ ,etmiss,pth(2),pthh,ptv(3),ptjet(3),Mepem,Mmpmm,Mepve,Mmmvm
1355+ $ ,Mepemmpmm,Mepvemmvm,Mtt,Mhh,Mj1j2,Mj1j3,Mj2j3,Mj1j2j3,Mvvv
1356+ $ ,HTparton,HTreco,p_reco(0:4,nexternal)
1357+ integer nQCD,jet(nexternal),njet,itop,iatop,iem,iep,imp,imm,ive
1358+ $ ,ivm,iv1,iv2,iv3,ih1,ih2,il,ipdg_reco(nexternal)
1359+ double precision getptv4,getptv4_2,getptv4_4,getinvm4_2
1360+ $ ,getinvm4_3,getinvm4_4,l10
1361+ external getptv4,getptv4_2,getptv4_4,getinvm4_2,getinvm4_3
1362+ $ ,getinvm4_4,l10
1363+ integer orders_tag_plot
1364+ common /corderstagplot/ orders_tag_plot
1365+c First, try to recombine photons with leptons
1366+ if (.not.quarkphreco) then
1367+ write (*,*) 'quark-photon recombination is turned off. '/
1368+ $ /'Do need it'
1369+ stop
1370+ endif
1371+ if (.not. lepphreco) then
1372+ write (*,*) 'lepton-photon recombination is turned off. '
1373+ $ //'Do need it.'
1374+ stop
1375+ endif
1376+ call recombine_momenta(rphreco, etaphreco, lepphreco, quarkphreco,
1377+ $ p, iPDG, p_reco, iPDG_reco)
1378+
1379+c Put all (light) QCD partons(+photon) in momentum array for jet clustering.
1380+ nQCD=0
1381+ do j=nincoming+1,nexternal
1382+ if (abs(ipdg_reco(j)).le.5 .or. ipdg_reco(j).eq.21 .or.
1383+ $ ipdg_reco(j).eq.22)then
1384+ nQCD=nQCD+1
1385+ do i=0,3
1386+ pQCD(i,nQCD)=p_reco(i,j)
1387+ enddo
1388+ endif
1389+ enddo
1390+
1391+C---CLUSTER THE EVENT
1392+ palg = jetalgo
1393+ rfj = jetradius
1394+ sycut = ptj
1395+ yjmax = etaj
1396+
1397+c******************************************************************************
1398+c call FASTJET to get all the jets
1399+c
1400+c INPUT:
1401+c input momenta: pQCD(0:3,nexternal), energy is 0th component
1402+c number of input momenta: nQCD
1403+c radius parameter: rfj
1404+c minumum jet pt: sycut
1405+c jet algorithm: palg, 1.0=kt, 0.0=C/A, -1.0 = anti-kt
1406+c
1407+c OUTPUT:
1408+c jet momenta: pjet(0:3,nexternal), E is 0th cmpnt
1409+c the number of jets (with pt > SYCUT): njet
1410+c the jet for a given particle 'i': jet(i), note that this is
1411+c the particle in pQCD, which doesn't necessarily correspond to the particle
1412+c label in the process
1413+c
1414+ call amcatnlo_fastjetppgenkt_etamax(pQCD,nQCD,rfj,sycut,yjmax,palg
1415+ $ ,pjet,njet,jet)
1416+c
1417+c******************************************************************************
1418+
1419+c Look for the other physics objects
1420+ itop=0
1421+ iatop=0
1422+ iem=0
1423+ iep=0
1424+ iem=0
1425+ iep=0
1426+ imp=0
1427+ imm=0
1428+ ive=0
1429+ ivm=0
1430+ iv1=0
1431+ iv2=0
1432+ iv3=0
1433+ ih1=0
1434+ ih2=0
1435+ do i=1,nexternal
1436+ if (ipdg_reco(i).eq.6) then
1437+ itop=i
1438+ elseif(ipdg_reco(i).eq.-6) then
1439+ iatop=i
1440+ elseif(ipdg_reco(i).eq.11) then
1441+ iem=i
1442+ elseif(ipdg_reco(i).eq.13) then
1443+ imm=i
1444+ elseif(ipdg_reco(i).eq.-11) then
1445+ iep=i
1446+ elseif(ipdg_reco(i).eq.-13) then
1447+ imp=i
1448+ elseif(abs(ipdg_reco(i)).eq.12) then
1449+ ive=i
1450+ elseif(abs(ipdg_reco(i)).eq.14) then
1451+ ivm=i
1452+ elseif(abs(ipdg_reco(i)).eq.24 .or. ipdg_reco(i).eq.23) then
1453+ if (iv1.eq.0) then
1454+ iv1=i
1455+ else
1456+ if (iv2.eq.0) then
1457+ iv2=i
1458+ else
1459+ if(iv3.eq.0) then
1460+ iv3=i
1461+ else
1462+ write (*,*) 'too many vector bosons'
1463+ stop
1464+ endif
1465+ endif
1466+ endif
1467+ elseif(abs(ipdg_reco(i)).eq.25) then
1468+ if (ih1.eq.0) then
1469+ ih1=i
1470+ else
1471+ if (ih2.eq.0) then
1472+ ih2=i
1473+ else
1474+ write (*,*) 'too many higgs bosons'
1475+ stop
1476+ endif
1477+ endif
1478+ endif
1479+ enddo
1480+ if (itop.ne.0) ptt=getptv4(p_reco(0,itop))
1481+ if (iatop.ne.0) ptat=getptv4(p_reco(0,iatop))
1482+ if (itop.ne.0 .and. iatop.ne.0) then
1483+ pttt=getptv4_2(p_reco(0,itop),p_reco(0,iatop))
1484+ Mtt=getinvm4_2(p_reco(0,itop),p_reco(0,iatop))
1485+ endif
1486+ if (iem.ne.0) ptem=getptv4(p_reco(0,iem))
1487+ if (iep.ne.0) ptep=getptv4(p_reco(0,iep))
1488+ if (imm.ne.0) ptmm=getptv4(p_reco(0,imm))
1489+ if (imp.ne.0) ptmp=getptv4(p_reco(0,imp))
1490+ if (iem.ne.0 .and. iep.ne.0) then
1491+ ptepem=getptv4_2(p_reco(0,iem),p_reco(0,iep))
1492+ Mepem=getinvm4_2(p_reco(0,iem),p_reco(0,iep))
1493+ endif
1494+ if (imm.ne.0 .and. imp.ne.0) then
1495+ ptmpmm=getptv4_2(p_reco(0,imm),p_reco(0,imp))
1496+ Mmpmm=getinvm4_2(p_reco(0,imm),p_reco(0,imp))
1497+ endif
1498+ if (iep.ne.0 .and. ive.ne.0) then
1499+ ptepve=getptv4_2(p_reco(0,iep),p_reco(0,ive))
1500+ Mepve=getinvm4_2(p_reco(0,iep),p_reco(0,ive))
1501+ endif
1502+ if (imm.ne.0 .and. ivm.ne.0) then
1503+ ptmmvm=getptv4_2(p_reco(0,imm),p_reco(0,ivm))
1504+ Mmmvm=getinvm4_2(p_reco(0,imm),p_reco(0,ivm))
1505+ endif
1506+ if (iem.ne.0 .and. iep.ne.0 .and. imm.ne.0 .and. imp.ne.0) then
1507+ ptepemmpmm=getptv4_4(p_reco(0,iem),p_reco(0,iep),p_reco(0,imm),p_reco(0,imp))
1508+ Mepemmpmm=getinvm4_4(p_reco(0,iem),p_reco(0,iep),p_reco(0,imm),p_reco(0,imp))
1509+ endif
1510+ if (ive.ne.0 .and. iep.ne.0 .and. imm.ne.0 .and. ivm.ne.0) then
1511+ ptepvemmvm=getptv4_4(p_reco(0,iep),p_reco(0,ive),p_reco(0,imm),p_reco(0,ivm))
1512+ Mepvemmvm=getinvm4_4(p_reco(0,iep),p_reco(0,ive),p_reco(0,imm),p_reco(0,ivm))
1513+ endif
1514+
1515+ il=0
1516+ if (iem.ne.0) then
1517+ il=il+1
1518+ ptlep(il)=ptem
1519+ endif
1520+ if (iep.ne.0) then
1521+ il=il+1
1522+ ptlep(il)=ptep
1523+ endif
1524+ if (imm.ne.0) then
1525+ il=il+1
1526+ ptlep(il)=ptmm
1527+ endif
1528+ if (imp.ne.0) then
1529+ il=il+1
1530+ ptlep(il)=ptmp
1531+ endif
1532+ if (il.gt.1) then
1533+ do i=1,il-1
1534+ do j=1,il-i
1535+ if (ptlep(j).lt.ptlep(j+1)) then
1536+ tmp=ptlep(j)
1537+ ptlep(j)=ptlep(j+1)
1538+ ptlep(j+1)=tmp
1539+ endif
1540+ enddo
1541+ enddo
1542+ endif
1543+
1544+
1545+c missing Et
1546+ if (ive.ne.0 .and. ivm.ne.0) then
1547+ etmiss=getptv4_2(p_reco(0,ivm),p_reco(0,ive))
1548+ elseif (ive.ne.0 .or. ivm.ne.0) then
1549+ etmiss=getptv4(p_reco(0,ive+ivm))
1550+ endif
1551+
1552+ if (ih1.ne.0)pth(1)=getptv4(p_reco(0,ih1))
1553+ if (ih2.ne.0)pth(2)=getptv4(p_reco(0,ih2))
1554+ if (ih1.ne.0 .and. ih2.ne.0) then
1555+ pthh=getptv4_2(p_reco(0,ih1),p_reco(0,ih2))
1556+ Mhh=getinvm4_2(p_reco(0,ih1),p_reco(0,ih2))
1557+c order the higgs bosons (if there are 2)
1558+ if (pth(1).lt.pth(2)) then
1559+ tmp=pth(1)
1560+ pth(1)=pth(2)
1561+ pth(2)=tmp
1562+ endif
1563+ endif
1564+ if (iv1.ne.0) ptv(1)=getptv4(p_reco(0,iv1))
1565+ if (iv2.ne.0) ptv(2)=getptv4(p_reco(0,iv2))
1566+ if (iv3.ne.0) ptv(3)=getptv4(p_reco(0,iv3))
1567+ if (iv1.ne.0 .and. iv2.ne.0 .and. iv3.ne.0) then
1568+ Mvvv=getinvm4_3(p_reco(0,iv1),p_reco(0,iv2),p_reco(0,iv3))
1569+c order the vector bosons (if there are 3)
1570+ do i=1,2
1571+ do j=1,3-i
1572+ if (ptv(j).lt.ptv(j+1)) then
1573+ tmp=ptv(j)
1574+ ptv(j)=ptv(j+1)
1575+ ptv(j+1)=tmp
1576+ endif
1577+ enddo
1578+ enddo
1579+ elseif (iv1.ne.0 .and. iv2.ne.0) then
1580+c order the vector bosons (if there are 2)
1581+ if (ptv(1).lt.ptv(2)) then
1582+ tmp=ptv(1)
1583+ ptv(1)=ptv(2)
1584+ ptv(2)=tmp
1585+ endif
1586+ endif
1587+ do i=1,njet
1588+ ptjet(i)=getptv4(pjet(0,i))
1589+ enddo
1590+ if (njet.ge.2) then
1591+ Mj1j2=getinvm4_2(pjet(0,1),pjet(0,2))
1592+ endif
1593+ if (njet.ge.3) then
1594+ Mj2j3=getinvm4_2(pjet(0,2),pjet(0,3))
1595+ Mj1j3=getinvm4_2(pjet(0,1),pjet(0,3))
1596+ Mj1j2j3=getinvm4_3(pjet(0,1),pjet(0,2),pjet(0,3))
1597+ endif
1598+c
1599+ HTparton=0d0
1600+ HTreco=0d0
1601+ do i=1,nexternal
1602+ HTparton=HTparton+getptv4(p(0,i))
1603+ if (abs(ipdg_reco(i)).gt.5 .and. ipdg_reco(i).ne.21 .and.
1604+ $ ipdg_reco(i).ne.22 .and. abs(ipdg_reco(i)).ne.12 .and.
1605+ $ abs(ipdg_reco(i)).ne.14 .and. abs(ipdg_reco(i)).ne.16)
1606+ $ then
1607+ HTreco=HTreco+getptv4(p_reco(0,i))
1608+ endif
1609+ enddo
1610+ do i=1,njet
1611+ HTreco=HTreco+getptv4(pjet(0,i))
1612+ enddo
1613+ if (ive.ne.0 .or. ivm.ne.0) HTreco=HTreco+etmiss
1614+
1615+ do i=1,2
1616+ l=(i-1)*55
1617+ if (ibody.ne.3 .and.i.eq.2) cycle
1618+
1619+c How to tag orders (QCD+QED*100)
1620+c
1621+c if (i.eq. 3.and.orders_tag_plot.ne.4) cycle
1622+c if (i.eq. 4.and.orders_tag_plot.ne.202) cycle
1623+c if (i.eq. 5.and.orders_tag_plot.ne.400) cycle
1624+c if (i.eq. 6.and.orders_tag_plot.ne.6) cycle
1625+c if (i.eq. 7.and.orders_tag_plot.ne.204) cycle
1626+c if (i.eq. 8.and.orders_tag_plot.ne.402) cycle
1627+c if (i.eq. 9.and.orders_tag_plot.ne.600) cycle
1628+c if (i.eq.10.and.orders_tag_plot.ne.8) cycle
1629+c if (i.eq.11.and.orders_tag_plot.ne.206) cycle
1630+c if (i.eq.12.and.orders_tag_plot.ne.404) cycle
1631+c if (i.eq.13.and.orders_tag_plot.ne.602) cycle
1632+c if (i.eq.14.and.orders_tag_plot.ne.800) cycle
1633+
1634+
1635+
1636+c total rate
1637+ call HwU_fill(l+ 1,1d0,wgts)
1638+c transverse momenta
1639+ if (il .ge.1) call HwU_fill(l+ 2,l10(ptlep(1)),wgts)
1640+ if (il .ge.2) call HwU_fill(l+ 3,l10(ptlep(2)),wgts)
1641+ if (il .ge.3) call HwU_fill(l+ 4,l10(ptlep(3)),wgts)
1642+ if (il .ge.4) call HwU_fill(l+ 5,l10(ptlep(4)),wgts)
1643+ if (iem.ne.0) call HwU_fill(l+ 6,l10(ptem),wgts)
1644+ if (iep.ne.0) call HwU_fill(l+ 7,l10(ptep),wgts)
1645+ if (imp.ne.0) call HwU_fill(l+ 8,l10(ptmp),wgts)
1646+ if (imm.ne.0) call HwU_fill(l+ 9,l10(ptmm),wgts)
1647+ if (iep.ne.0 .and. iem.ne.0) call HwU_fill(l+14,l10(ptepem),wgts)
1648+ if (imp.ne.0 .and. imm.ne.0) call HwU_fill(l+15,l10(ptmpmm),wgts)
1649+ if (iep.ne.0 .and. iem.ne.0 .and. imp.ne.0 .and. imm.ne.0) then
1650+ if (ptepem.gt.ptmpmm) then
1651+ call HwU_fill(l+16,l10(ptepem),wgts)
1652+ call HwU_fill(l+17,l10(ptmpmm),wgts)
1653+ else
1654+ call HwU_fill(l+17,l10(ptepem),wgts)
1655+ call HwU_fill(l+16,l10(ptmpmm),wgts)
1656+ endif
1657+ elseif (iep.ne.0 .and. iem.ne.0) then
1658+ call HwU_fill(l+17,l10(ptepem),wgts)
1659+ elseif (imp.ne.0 .and. imm.ne.0) then
1660+ call HwU_fill(l+17,l10(ptmpmm),wgts)
1661+ endif
1662+ if (iep.ne.0 .and. ive.ne.0) call HwU_fill(l+18,l10(ptepve),wgts)
1663+ if (imm.ne.0 .and. ivm.ne.0) call HwU_fill(l+19,l10(ptmmvm),wgts)
1664+ if (iep.ne.0 .and. ive.ne.0 .and. imm.ne.0 .and. ivm.ne.0) then
1665+ if (ptepve.gt.ptmmvm) then
1666+ call HwU_fill(l+20,l10(ptepve),wgts)
1667+ call HwU_fill(l+21,l10(ptmmvm),wgts)
1668+ else
1669+ call HwU_fill(l+21,l10(ptepve),wgts)
1670+ call HwU_fill(l+20,l10(ptmmvm),wgts)
1671+ endif
1672+ elseif (iep.ne.0 .and. ive.ne.0) then
1673+ call HwU_fill(l+20,l10(ptepve),wgts)
1674+ elseif (imm.ne.0 .and. ivm.ne.0) then
1675+ call HwU_fill(l+20,l10(ptmmvm),wgts)
1676+ endif
1677+ if (iep.ne.0 .and. iem.ne.0 .and. imp.ne.0 .and. imm.ne.0)
1678+ $ call HwU_fill(l+22,l10(ptepemmpmm),wgts)
1679+ if (iep.ne.0 .and. ive.ne.0 .and. imm.ne.0 .and. ivm.ne.0)
1680+ $ call HwU_fill(l+23,l10(ptepvemmvm),wgts)
1681+ if (itop.ne.0) call HwU_fill(l+24,l10(ptt),wgts)
1682+ if (iatop.ne.0) call HwU_fill(l+25,l10(ptat),wgts)
1683+ if (itop.ne.0 .and. iatop.ne.0) call HwU_fill(l+26,l10(pttt),wgts)
1684+ if (ive.ne.0 .or. ivm .ne.0) call HwU_fill(l+27,l10(etmiss),wgts)
1685+ if (ih1.ne.0) call HwU_fill(l+28,l10(pth(1)),wgts)
1686+ if (ih2.ne.0) call HwU_fill(l+29,l10(pth(2)),wgts)
1687+ if (ih1.ne.0 .and. ih2.ne.0) call HwU_fill(l+30,l10(pthh),wgts)
1688+ if (iv1.ne.0) call HwU_fill(l+31,l10(ptv(1)),wgts)
1689+ if (iv2.ne.0) call HwU_fill(l+32,l10(ptv(2)),wgts)
1690+ if (iv3.ne.0) call HwU_fill(l+33,l10(ptv(3)),wgts)
1691+ if (njet.ge.1) call HwU_fill(l+34,l10(ptjet(1)),wgts)
1692+ if (njet.ge.2) call HwU_fill(l+35,l10(ptjet(2)),wgts)
1693+ if (njet.ge.3) call HwU_fill(l+36,l10(ptjet(3)),wgts)
1694+c invariant masses
1695+ if (iep.ne.0 .and. iem.ne.0) call HwU_fill(l+37,l10(Mepem),wgts)
1696+ if (imp.ne.0 .and. imm.ne.0) call HwU_fill(l+38,l10(Mmpmm),wgts)
1697+ if (iep.ne.0 .and. iem.ne.0 .and. imp.ne.0 .and. imm.ne.0) then
1698+ if (Mepem.gt.Mmpmm) then
1699+ call HwU_fill(l+39,l10(Mepem),wgts)
1700+ call HwU_fill(l+40,l10(Mmpmm),wgts)
1701+ else
1702+ call HwU_fill(l+40,l10(Mepem),wgts)
1703+ call HwU_fill(l+39,l10(Mmpmm),wgts)
1704+ endif
1705+ elseif (iep.ne.0 .and. iem.ne.0) then
1706+ call HwU_fill(l+39,l10(Mepem),wgts)
1707+ elseif (imp.ne.0 .and. imm.ne.0) then
1708+ call HwU_fill(l+39,l10(Mmpmm),wgts)
1709+ endif
1710+ if (iep.ne.0 .and. ive.ne.0) call HwU_fill(l+41,l10(Mepve),wgts)
1711+ if (imm.ne.0 .and. ivm.ne.0) call HwU_fill(l+42,l10(Mmmvm),wgts)
1712+ if (iep.ne.0 .and. ive.ne.0 .and. imm.ne.0 .and. ivm.ne.0) then
1713+ if (Mepve.gt.Mmmvm) then
1714+ call HwU_fill(l+43,l10(Mepve),wgts)
1715+ call HwU_fill(l+44,l10(Mmmvm),wgts)
1716+ else
1717+ call HwU_fill(l+44,l10(Mepve),wgts)
1718+ call HwU_fill(l+43,l10(Mmmvm),wgts)
1719+ endif
1720+ elseif (iep.ne.0 .and. ive.ne.0) then
1721+ call HwU_fill(l+43,l10(Mepve),wgts)
1722+ elseif (imm.ne.0 .and. ivm.ne.0) then
1723+ call HwU_fill(l+43,l10(Mmmvm),wgts)
1724+ endif
1725+ if (iep.ne.0 .and. iem.ne.0 .and. imp.ne.0 .and. imm.ne.0)
1726+ $ call HwU_fill(l+45,l10(Mepemmpmm),wgts)
1727+ if (iep.ne.0 .and. ive.ne.0 .and. imm.ne.0 .and. ivm.ne.0)
1728+ $ call HwU_fill(l+46,l10(Mepvemmvm),wgts)
1729+ if (itop.ne.0 .and. iatop.ne.0) call HwU_fill(l+47,l10(Mtt),wgts)
1730+ if (ih1.ne.0 .and. ih2.ne.0) call HwU_fill(l+48,l10(Mhh),wgts)
1731+ if (njet.ge.2) call HwU_fill(l+49,l10(Mj1j2),wgts)
1732+ if (njet.ge.3) call HwU_fill(l+50,l10(Mj2j3),wgts)
1733+ if (njet.ge.3) call HwU_fill(l+51,l10(Mj1j3),wgts)
1734+ if (njet.ge.3) call HwU_fill(l+52,l10(Mj1j2j3),wgts)
1735+ if (iv1.ne.0 .and. iv2.ne.0 .and. iv3.ne.0) call HwU_fill(l+53,l10(Mvvv),wgts)
1736+c HT
1737+ call HwU_fill(l+54,l10(HTparton),wgts)
1738+ call HwU_fill(l+55,l10(HTreco),wgts)
1739+ enddo
1740+
1741+ 999 return
1742+ end
1743+
1744+
1745+ double precision function l10(var)
1746+ implicit none
1747+ double precision var
1748+ if (var.gt.0) then
1749+ l10=log10(var)
1750+ else
1751+ l10=-99d99
1752+ endif
1753+ return
1754+ end
1755+
1756+ function getrapidity(en,pl)
1757+ implicit none
1758+ real*8 getrapidity,en,pl,tiny,xplus,xminus,y
1759+ parameter (tiny=1.d-8)
1760+c
1761+ xplus=en+pl
1762+ xminus=en-pl
1763+ if(xplus.gt.tiny.and.xminus.gt.tiny)then
1764+ if( (xplus/xminus).gt.tiny.and.(xminus/xplus).gt.tiny )then
1765+ y=0.5d0*log( xplus/xminus )
1766+ else
1767+ y=sign(1.d0,pl)*1.d8
1768+ endif
1769+ else
1770+ y=sign(1.d0,pl)*1.d8
1771+ endif
1772+ getrapidity=y
1773+ return
1774+ end
1775+
1776+
1777+ function getpseudorap(en,ptx,pty,pl)
1778+ implicit none
1779+ real*8 getpseudorap,en,ptx,pty,pl,tiny,pt,eta,th
1780+ parameter (tiny=1.d-5)
1781+c
1782+ pt=sqrt(ptx**2+pty**2)
1783+ if(pt.lt.tiny.and.abs(pl).lt.tiny)then
1784+ eta=sign(1.d0,pl)*1.d8
1785+ else
1786+ th=atan2(pt,pl)
1787+ eta=-log(tan(th/2.d0))
1788+ endif
1789+ getpseudorap=eta
1790+ return
1791+ end
1792+
1793+
1794+ function getinvm(en,ptx,pty,pl)
1795+ implicit none
1796+ real*8 getinvm,en,ptx,pty,pl,tiny,tmp
1797+ parameter (tiny=1.d-5)
1798+c
1799+ tmp=en**2-ptx**2-pty**2-pl**2
1800+ if(tmp.gt.0.d0)then
1801+ tmp=sqrt(tmp)
1802+ elseif(tmp.gt.-tiny)then
1803+ tmp=0.d0
1804+ else
1805+ write(*,*)'Attempt to compute a negative mass'
1806+ stop
1807+ endif
1808+ getinvm=tmp
1809+ return
1810+ end
1811+
1812+
1813+ function getdelphi(ptx1,pty1,ptx2,pty2)
1814+ implicit none
1815+ real*8 getdelphi,ptx1,pty1,ptx2,pty2,tiny,pt1,pt2,tmp
1816+ parameter (tiny=1.d-5)
1817+c
1818+ pt1=sqrt(ptx1**2+pty1**2)
1819+ pt2=sqrt(ptx2**2+pty2**2)
1820+ if(pt1.ne.0.d0.and.pt2.ne.0.d0)then
1821+ tmp=ptx1*ptx2+pty1*pty2
1822+ tmp=tmp/(pt1*pt2)
1823+ if(abs(tmp).gt.1.d0+tiny)then
1824+ write(*,*)'Cosine larger than 1'
1825+ stop
1826+ elseif(abs(tmp).ge.1.d0)then
1827+ tmp=sign(1.d0,tmp)
1828+ endif
1829+ tmp=acos(tmp)
1830+ else
1831+ tmp=1.d8
1832+ endif
1833+ getdelphi=tmp
1834+ return
1835+ end
1836+
1837+
1838+ function getdr(en1,ptx1,pty1,pl1,en2,ptx2,pty2,pl2)
1839+ implicit none
1840+ real*8 getdr,en1,ptx1,pty1,pl1,en2,ptx2,pty2,pl2,deta,dphi,
1841+ # getpseudorap,getdelphi
1842+c
1843+ deta=getpseudorap(en1,ptx1,pty1,pl1)-
1844+ # getpseudorap(en2,ptx2,pty2,pl2)
1845+ dphi=getdelphi(ptx1,pty1,ptx2,pty2)
1846+ getdr=sqrt(dphi**2+deta**2)
1847+ return
1848+ end
1849+
1850+
1851+ function getdry(en1,ptx1,pty1,pl1,en2,ptx2,pty2,pl2)
1852+ implicit none
1853+ real*8 getdry,en1,ptx1,pty1,pl1,en2,ptx2,pty2,pl2,deta,dphi,
1854+ # getrapidity,getdelphi
1855+c
1856+ deta=getrapidity(en1,pl1)-
1857+ # getrapidity(en2,pl2)
1858+ dphi=getdelphi(ptx1,pty1,ptx2,pty2)
1859+ getdry=sqrt(dphi**2+deta**2)
1860+ return
1861+ end
1862+
1863+
1864+ function getptv(p)
1865+ implicit none
1866+ real*8 getptv,p(5)
1867+c
1868+ getptv=sqrt(p(1)**2+p(2)**2)
1869+ return
1870+ end
1871+
1872+
1873+ function getpseudorapv(p)
1874+ implicit none
1875+ real*8 getpseudorapv,p(5)
1876+ real*8 getpseudorap
1877+c
1878+ getpseudorapv=getpseudorap(p(4),p(1),p(2),p(3))
1879+ return
1880+ end
1881+
1882+
1883+ function getrapidityv(p)
1884+ implicit none
1885+ real*8 getrapidityv,p(5)
1886+ real*8 getrapidity
1887+c
1888+ getrapidityv=getrapidity(p(4),p(3))
1889+ return
1890+ end
1891+
1892+
1893+ function getdrv(p1,p2)
1894+ implicit none
1895+ real*8 getdrv,p1(5),p2(5)
1896+ real*8 getdr
1897+c
1898+ getdrv=getdr(p1(4),p1(1),p1(2),p1(3),
1899+ # p2(4),p2(1),p2(2),p2(3))
1900+ return
1901+ end
1902+
1903+
1904+ function getinvmv(p)
1905+ implicit none
1906+ real*8 getinvmv,p(5)
1907+ real*8 getinvm
1908+c
1909+ getinvmv=getinvm(p(4),p(1),p(2),p(3))
1910+ return
1911+ end
1912+
1913+
1914+ function getdelphiv(p1,p2)
1915+ implicit none
1916+ real*8 getdelphiv,p1(5),p2(5)
1917+ real*8 getdelphi
1918+c
1919+ getdelphiv=getdelphi(p1(1),p1(2),
1920+ # p2(1),p2(2))
1921+ return
1922+ end
1923+
1924+
1925+ function getptv4(p)
1926+ implicit none
1927+ real*8 getptv4,p(0:3)
1928+c
1929+ getptv4=sqrt(max(p(1)**2+p(2)**2,0d0))
1930+ return
1931+ end
1932+
1933+ function getptv4_2(p1,p2)
1934+ implicit none
1935+ real*8 getptv4_2,p1(0:3),p2(0:3),psum(0:3)
1936+ integer i
1937+ do i=0,3
1938+ psum(i)=p1(i)+p2(i)
1939+ enddo
1940+ getptv4_2=sqrt(max(psum(1)**2+psum(2)**2,0d0))
1941+ return
1942+ end
1943+
1944+ function getptv4_4(p1,p2,p3,p4)
1945+ implicit none
1946+ real*8 getptv4_4,p1(0:3),p2(0:3),p3(0:3),p4(0:3),psum(0:3)
1947+ integer i
1948+ do i=0,3
1949+ psum(i)=p1(i)+p2(i)+p3(i)+p4(i)
1950+ enddo
1951+ getptv4_4=sqrt(max(psum(1)**2+psum(2)**2,0d0))
1952+ return
1953+ end
1954+
1955+
1956+ function getpseudorapv4(p)
1957+ implicit none
1958+ real*8 getpseudorapv4,p(0:3)
1959+ real*8 getpseudorap
1960+c
1961+ getpseudorapv4=getpseudorap(p(0),p(1),p(2),p(3))
1962+ return
1963+ end
1964+
1965+
1966+ function getrapidityv4(p)
1967+ implicit none
1968+ real*8 getrapidityv4,p(0:3)
1969+ real*8 getrapidity
1970+c
1971+ getrapidityv4=getrapidity(p(0),p(3))
1972+ return
1973+ end
1974+
1975+
1976+ function getdrv4(p1,p2)
1977+ implicit none
1978+ real*8 getdrv4,p1(0:3),p2(0:3)
1979+ real*8 getdr
1980+c
1981+ getdrv4=getdr(p1(0),p1(1),p1(2),p1(3),
1982+ # p2(0),p2(1),p2(2),p2(3))
1983+ return
1984+ end
1985+
1986+
1987+ function getinvm4(p)
1988+ implicit none
1989+ real*8 getinvm4,p(0:3)
1990+ real*8 getinvm
1991+c
1992+ getinvm4=getinvm(p(0),p(1),p(2),p(3))
1993+ return
1994+ end
1995+
1996+ function getinvm4_2(p1,p2)
1997+ implicit none
1998+ real*8 getinvm4_2,p1(0:3),p2(0:3),p(0:3)
1999+ real*8 getinvm
2000+ integer i
2001+ do i=0,3
2002+ p(i)=p1(i)+p2(i)
2003+ enddo
2004+ getinvm4_2=getinvm(p(0),p(1),p(2),p(3))
2005+ return
2006+ end
2007+
2008+ function getinvm4_3(p1,p2,p3)
2009+ implicit none
2010+ real*8 getinvm4_3,p1(0:3),p2(0:3),p3(0:3),p(0:3)
2011+ real*8 getinvm
2012+ integer i
2013+ do i=0,3
2014+ p(i)=p1(i)+p2(i)+p3(i)
2015+ enddo
2016+ getinvm4_3=getinvm(p(0),p(1),p(2),p(3))
2017+ return
2018+ end
2019+
2020+ function getinvm4_4(p1,p2,p3,p4)
2021+ implicit none
2022+ real*8 getinvm4_4,p1(0:3),p2(0:3),p3(0:3),p4(0:3),p(0:3)
2023+ real*8 getinvm
2024+ integer i
2025+ do i=0,3
2026+ p(i)=p1(i)+p2(i)+p3(i)+p4(i)
2027+ enddo
2028+ getinvm4_4=getinvm(p(0),p(1),p(2),p(3))
2029+ return
2030+ end
2031+
2032+
2033+ function getdelphiv4(p1,p2)
2034+ implicit none
2035+ real*8 getdelphiv4,p1(0:3),p2(0:3)
2036+ real*8 getdelphi
2037+c
2038+ getdelphiv4=getdelphi(p1(1),p1(2),
2039+ # p2(1),p2(2))
2040+ return
2041+ end
2042+
2043+
2044+ function getcosv4(q1,q2)
2045+ implicit none
2046+ real*8 getcosv4,q1(0:3),q2(0:3)
2047+ real*8 xnorm1,xnorm2,tmp
2048+c
2049+ if(q1(0).lt.0.d0.or.q2(0).lt.0.d0)then
2050+ getcosv4=-1.d10
2051+ return
2052+ endif
2053+ xnorm1=sqrt(q1(1)**2+q1(2)**2+q1(3)**2)
2054+ xnorm2=sqrt(q2(1)**2+q2(2)**2+q2(3)**2)
2055+ if(xnorm1.lt.1.d-6.or.xnorm2.lt.1.d-6)then
2056+ tmp=-1.d10
2057+ else
2058+ tmp=q1(1)*q2(1)+q1(2)*q2(2)+q1(3)*q2(3)
2059+ tmp=tmp/(xnorm1*xnorm2)
2060+ if(abs(tmp).gt.1.d0.and.abs(tmp).le.1.001d0)then
2061+ tmp=sign(1.d0,tmp)
2062+ elseif(abs(tmp).gt.1.001d0)then
2063+ write(*,*)'Error in getcosv4',tmp
2064+ stop
2065+ endif
2066+ endif
2067+ getcosv4=tmp
2068+ return
2069+ end
2070+
2071+
2072+
2073+ function getmod(p)
2074+ implicit none
2075+ double precision p(0:3),getmod
2076+
2077+ getmod=sqrt(p(1)**2+p(2)**2+p(3)**2)
2078+
2079+ return
2080+ end
2081+
2082+
2083+
2084+ subroutine getperpenv4(q1,q2,qperp)
2085+c Normal to the plane defined by \vec{q1},\vec{q2}
2086+ implicit none
2087+ real*8 q1(0:3),q2(0:3),qperp(0:3)
2088+ real*8 xnorm1,xnorm2
2089+ integer i
2090+c
2091+ xnorm1=sqrt(q1(1)**2+q1(2)**2+q1(3)**2)
2092+ xnorm2=sqrt(q2(1)**2+q2(2)**2+q2(3)**2)
2093+ if(xnorm1.lt.1.d-6.or.xnorm2.lt.1.d-6)then
2094+ do i=1,4
2095+ qperp(i)=-1.d10
2096+ enddo
2097+ else
2098+ qperp(1)=q1(2)*q2(3)-q1(3)*q2(2)
2099+ qperp(2)=q1(3)*q2(1)-q1(1)*q2(3)
2100+ qperp(3)=q1(1)*q2(2)-q1(2)*q2(1)
2101+ do i=1,3
2102+ qperp(i)=qperp(i)/(xnorm1*xnorm2)
2103+ enddo
2104+ qperp(0)=1.d0
2105+ endif
2106+ return
2107+ end
2108+
2109+
2110+
2111+
2112+ subroutine getwedge(p1,p2,pout)
2113+ implicit none
2114+ real*8 p1(0:3),p2(0:3),pout(0:3)
2115+
2116+ pout(1)=p1(2)*p2(3)-p1(3)*p2(2)
2117+ pout(2)=p1(3)*p2(1)-p1(1)*p2(3)
2118+ pout(3)=p1(1)*p2(2)-p1(2)*p2(1)
2119+ pout(0)=0d0
2120+
2121+ return
2122+ end
2123+
2124
2125=== modified file 'Template/NLO/MCatNLO/Makefile_MadFKS'
2126--- Template/NLO/MCatNLO/Makefile_MadFKS 2016-02-24 00:19:50 +0000
2127+++ Template/NLO/MCatNLO/Makefile_MadFKS 2018-12-20 08:18:55 +0000
2128@@ -1,7 +1,7 @@
2129 -include ../../Source/make_opts
2130
2131 DEBUG=
2132-FF=$(FC) $(FFLAGS) $(DEBUG)
2133+FF=$(FC) $(FFLAGS) $(DEBUG) -std=legacy
2134 CPP=$(CXX) $(CXXFLAGS) $(DEBUG) $(INCLOPTION)
2135 CC=$(CXX) $(CFLAGS) $(DEBUG) $(INCLOPTION)
2136
2137
2138=== modified file 'Template/NLO/SubProcesses/MC_integer.f'
2139--- Template/NLO/SubProcesses/MC_integer.f 2015-02-09 18:56:09 +0000
2140+++ Template/NLO/SubProcesses/MC_integer.f 2018-12-20 08:18:55 +0000
2141@@ -68,6 +68,7 @@
2142 common/to_readgrid/flat_grid !Tells if grid read from file
2143 if (this_dim.lt.1.or.this_dim.gt.maxdim) then
2144 write (*,*) 'Increase maxdim in MC_integer.f',maxdim,this_dim
2145+ stop 1
2146 endif
2147 c Set the number of intervales for all the dimensions to zero the very
2148 c first time this subroutine is called
2149@@ -283,12 +284,8 @@
2150 enddo
2151 c
2152 c Reset the accumulated results because we start new iteration.
2153- do this_dim=1,maxdim
2154- do i=0,nintervals(this_dim)
2155- acc(i,this_dim)=0d0
2156- ncall(i,this_dim)=0
2157- enddo
2158- enddo
2159+ call empty_MC_integer
2160+c
2161 return
2162 999 write (*,*) 'Cannot open "grid.MC_integer" file'
2163 stop
2164
2165=== modified file 'Template/NLO/SubProcesses/analysis_lhe.f'
2166--- Template/NLO/SubProcesses/analysis_lhe.f 2017-06-19 16:05:33 +0000
2167+++ Template/NLO/SubProcesses/analysis_lhe.f 2018-12-20 08:18:55 +0000
2168@@ -7,9 +7,10 @@
2169 implicit none
2170 integer nwgt
2171 character*(*) weights_info(*)
2172+ logical passed_unwgt
2173 integer nwgts,nevents
2174 double precision sum_of_wgts
2175- common/to_lhe_analysis/sum_of_wgts,nwgts,nevents
2176+ common/to_lhe_analysis/sum_of_wgts,nwgts,nevents,passed_unwgt
2177 logical lopen
2178 nwgts=nwgt
2179 sum_of_wgts=0d0
2180@@ -23,9 +24,10 @@
2181 subroutine analysis_end(xnorm)
2182 implicit none
2183 double precision xnorm
2184+ logical passed_unwgt
2185 integer nwgts,nevents
2186 double precision sum_of_wgts
2187- common/to_lhe_analysis/sum_of_wgts,nwgts,nevents
2188+ common/to_lhe_analysis/sum_of_wgts,nwgts,nevents,passed_unwgt
2189 logical lopen
2190 integer npoints
2191 double precision cross_section
2192@@ -55,9 +57,10 @@
2193 double precision p(0:4,nexternal)
2194 double precision wgts(*)
2195 integer ibody
2196+ logical passed_unwgt
2197 integer nwgts,nevents
2198 double precision sum_of_wgts
2199- common/to_lhe_analysis/sum_of_wgts,nwgts,nevents
2200+ common/to_lhe_analysis/sum_of_wgts,nwgts,nevents,passed_unwgt
2201 c
2202 integer i,j,npart
2203 double precision ran2
2204@@ -95,23 +98,33 @@
2205 integer npoints
2206 double precision cross_section
2207 common /for_FixedOrder_lhe/ cross_section,npoints
2208+ double precision,allocatable :: wwgts(:)
2209 c --- do the partial unweighting (don't do it when to close to singular
2210 c --- region)
2211+ if (.not. allocated(wwgts)) then
2212+ allocate(wwgts(nwgts))
2213+ endif
2214+ passed_unwgt=.true.
2215 twgt=abs(cross_section)*FO_LHE_weight_ratio !/npoints
2216 if(abs(wgts(1)).lt.abs(twgt) .and. xi_i_fks_ev.gt.1d-3 .and.
2217 $ 1d0-y_ij_fks_ev.gt.1d-2)then
2218 R = ran2()*abs(twgt)
2219 if (R.gt.abs(wgts(1)))then
2220+ passed_unwgt=.false.
2221 return
2222 else
2223 do i=2,nwgts
2224- wgts(i) = wgts(i)*abs(twgt/wgts(1))
2225+ wwgts(i) = wgts(i)*abs(twgt/wgts(1))
2226 enddo
2227- wgts(1) = sign(twgt,wgts(1))
2228+ wwgts(1) = sign(twgt,wgts(1))
2229 endif
2230+ else
2231+ do i=1,nwgts
2232+ wwgts(i)=wgts(i)
2233+ enddo
2234 endif
2235 c --- accumulate the total weights of all the events in the event file
2236- sum_of_wgts=sum_of_wgts+wgts(1)
2237+ sum_of_wgts=sum_of_wgts+wwgts(1)
2238
2239 c --- fill the multi-weight common blocks with the scale and PDF
2240 c --- variation weights
2241@@ -122,12 +135,12 @@
2242 do ii=1,nint(scalevarF(0))
2243 do jj=1,nint(scalevarR(0))
2244 i_wgt=i_wgt+1
2245- wgtxsecmu(jj,ii,kk)= wgts(i_wgt)
2246+ wgtxsecmu(jj,ii,kk)= wwgts(i_wgt)
2247 enddo
2248 enddo
2249 else
2250 i_wgt=i_wgt+1
2251- wgtxsecmu(1,1,kk)= wgts(i_wgt)
2252+ wgtxsecmu(1,1,kk)= wwgts(i_wgt)
2253 endif
2254 enddo
2255 endif
2256@@ -136,11 +149,11 @@
2257 if (lpdfvar(nn)) then
2258 do n=0,nmemPDF(nn)
2259 i_wgt=i_wgt+1
2260- wgtxsecPDF(n,nn) = wgts(i_wgt)
2261+ wgtxsecPDF(n,nn) = wwgts(i_wgt)
2262 enddo
2263 else
2264 i_wgt=i_wgt+1
2265- wgtxsecPDF(0,nn) = wgts(i_wgt)
2266+ wgtxsecPDF(0,nn) = wwgts(i_wgt)
2267 endif
2268 enddo
2269 endif
2270@@ -187,7 +200,7 @@
2271
2272 c --- write the event
2273 call write_lhef_event(41,
2274- & npart,IDPRUP,wgts(1),0d0,0d0,0d0,
2275+ & npart,IDPRUP,wwgts(1),0d0,0d0,0d0,
2276 & IDUP,ISTUP,MOTHUP,ICOLUP,PUP,VTIMUP,SPINUP,buff)
2277
2278 201 format(a9,1x,i1,4(1x,i2),2(1x,d14.8),2x,i2,2(1x,i2),5(1x,d14.8))
2279@@ -196,12 +209,15 @@
2280 c This we can use for the event grouping!
2281 subroutine HwU_add_points
2282 implicit none
2283+ logical passed_unwgt
2284 integer nwgts,nevents
2285 double precision sum_of_wgts
2286- common/to_lhe_analysis/sum_of_wgts,nwgts,nevents
2287- nevents=nevents+1
2288- write (41,'(a)') '</eventgroup>'
2289- write (41,'(a)') '<eventgroup>'
2290+ common/to_lhe_analysis/sum_of_wgts,nwgts,nevents,passed_unwgt
2291+ if (passed_unwgt) then
2292+ nevents=nevents+1
2293+ write (41,'(a)') '</eventgroup>'
2294+ write (41,'(a)') '<eventgroup>'
2295+ endif
2296 end
2297
2298 c Dummy routines
2299
2300=== modified file 'Template/NLO/SubProcesses/check_poles.f'
2301--- Template/NLO/SubProcesses/check_poles.f 2017-07-31 08:48:20 +0000
2302+++ Template/NLO/SubProcesses/check_poles.f 2018-12-20 08:18:55 +0000
2303@@ -18,7 +18,7 @@
2304 include 'genps.inc'
2305 include 'nexternal.inc'
2306 include 'nFKSconfigs.inc'
2307- double precision p(0:3, nexternal), prambo(0:3, nexternal)
2308+ double precision p(0:3, nexternal), prambo(0:3,100)
2309 double precision p_born(0:3,nexternal-1)
2310 common/pborn/p_born
2311 double precision pswgt
2312@@ -48,7 +48,7 @@
2313 include 'coupl.inc'
2314 include 'q_es.inc'
2315 integer nsqso,MLResArrayDim
2316- double precision pmass(nexternal), pmass_rambo(nexternal)
2317+ double precision pmass(nexternal), pmass_rambo(100)
2318 integer nfail
2319 logical first_time
2320 data first_time/.TRUE./
2321
2322=== modified file 'Template/NLO/SubProcesses/combine_plots_FO.sh'
2323--- Template/NLO/SubProcesses/combine_plots_FO.sh 2013-05-25 12:52:41 +0000
2324+++ Template/NLO/SubProcesses/combine_plots_FO.sh 2018-12-20 08:18:55 +0000
2325@@ -1,6 +1,4 @@
2326 #!/bin/bash
2327-TD=td_mac_intel
2328-PSOPEN=open
2329
2330 # $? is the value of last executed command. A call to this function
2331 # after a failure will cause the program to quit the script
2332@@ -15,126 +13,74 @@
2333 fi
2334 }
2335
2336-thisdir=`pwd`
2337-if [ -f $thisdir/MADatNLO.top ]
2338-then
2339-rm -f $thisdir/MADatNLO*.top
2340-fi
2341-make read40
2342-EXENAME=$thisdir/read40
2343+function combine {
2344+counter=0
2345+i=1
2346 echo -n "" > dir
2347-counterp=0
2348-for p in P* ; do
2349- cd $thisdir
2350- cd $p
2351- rm -f MADatNLO*
2352- rm -f *read40*.out
2353- echo -n "" > dir
2354- counter=0
2355- i=1
2356- for g in $* ; do
2357- if [ ! -f $g/MADatNLO*.top ]
2358- then
2359- echo "No topdrawer file in $p/$g"
2360- else
2361- counter=$(($counter + 1))
2362- echo $g"/MADatNLO.top" >> dir
2363- if [[ $(($counter % 40)) == 0 ]]; then
2364- echo -n "" > dir2
2365- echo "40" > dir2
2366- cat dir >> dir2
2367- $EXENAME < dir2
2368- teststatus Failure in step 1
2369- rm -f dir
2370- rm -f dir2
2371- mv fort.88 MADatNLO$i\.top
2372- mv read40.out "S1read40_"$i\.out
2373- i=$(($i + 1))
2374- echo -n "" > dir
2375- fi
2376- fi
2377- done
2378- if [[ $(($counter % 40)) != 0 ]] ; then
2379- echo $(($counter % 40)) > dir2
2380+for plot_file in "${@:2}" ; do
2381+ counter=$(($counter + 1))
2382+ echo $plot_file >> dir
2383+ if [[ $(($counter % 40)) == 0 ]]; then
2384+ echo -n "" > dir2
2385+ echo "40" > dir2
2386 cat dir >> dir2
2387- while [[ $(($counter % 40)) -ne 0 ]]; do
2388- counter=$[$counter-1]
2389- done
2390- $EXENAME < dir2
2391- teststatus Failure in step 2
2392+ ./read40 < dir2
2393+ teststatus Failure in step 1
2394 rm -f dir
2395 rm -f dir2
2396- mv fort.88 MADatNLO$i\.top
2397- mv read40.out "S2read40_"$i\.out
2398- fi
2399-
2400- counter=0
2401- for m in MADatNLO*.top ; do
2402- counter=$[$counter+1]
2403- echo $m >> dir
2404- done
2405- if [[ $counter -gt 1 ]] ; then
2406- echo $counter > dir2
2407- cat dir >> dir2
2408- $EXENAME < dir2
2409- teststatus Failure in step 3
2410- rm -f dir2
2411- mv fort.88 MADatNLO.top
2412- mv read40.out S3read40.out
2413- else
2414- mv MADatNLO1.top MADatNLO.top
2415- fi
2416- rm -f dir
2417- cd $thisdir
2418- counterp=$(($counterp + 1))
2419- echo $p"/MADatNLO.top" >> dir
2420- echo $counterp $p "done"
2421-done
2422-
2423-cd $thisdir
2424-make split40
2425-./split40
2426-
2427-i=0
2428-#pdir* are created by split
2429-for p in pdir* ; do
2430- i=$(($i+1))
2431- $EXENAME < $p
2432- teststatus Failure in step 4
2433- mv fort.88 MADatNLO$i\.top
2434- mv read40.out "S4read40_"$i\.out
2435- rm $p
2436- echo $i $p "done"
2437-done
2438-
2439-if [[ $i -gt 1 ]] ; then
2440- echo $i > dir2
2441- for p in MADatNLO*.top ; do
2442- echo $p >>dir2
2443- done
2444- $EXENAME < dir2
2445- teststatus Failure in step 5
2446+ mv fort.88 $1_$i\.top
2447+ mv read40.out "S1read40_"$1_$i\.out
2448+ i=$(($i + 1))
2449+ echo -n "" > dir
2450+ fi
2451+done
2452+if [[ $(($counter % 40)) != 0 ]] ; then
2453+ echo $(($counter % 40)) > dir2
2454+ cat dir >> dir2
2455+ ./read40 < dir2
2456+ teststatus Failure in step 2
2457 rm -f dir
2458 rm -f dir2
2459- mv fort.88 MADatNLO.top
2460- mv read40.out S5read40.out
2461+ mv fort.88 $1_$i\.top
2462+ mv read40.out "S2read40_"$1_$i\.out
2463+fi
2464+}
2465+
2466+make read40
2467+rm -f MADatNLO*.top
2468+
2469+if [ "$#" -gt 64000 ]; then
2470+ combine "MADatNLO_A" "$@"
2471+ combine "MADatNLO_B" MADatNLO_A*.top
2472+ combine "MADatNLO_C" MADatNLO_B*.top
2473+ combine "MADatNLO_D" MADatNLO_C*.top
2474+ mv MADatNLO_D_1.top MADatNLO.top
2475+elif [ "$#" -gt 1600 ]; then
2476+ combine "MADatNLO_A" "$@"
2477+ combine "MADatNLO_B" MADatNLO_A*.top
2478+ combine "MADatNLO_C" MADatNLO_B*.top
2479+ mv MADatNLO_C_1.top MADatNLO.top
2480+elif [ "$#" -gt 40 ]; then
2481+ combine "MADatNLO_A" "$@"
2482+ combine "MADatNLO_B" MADatNLO_A*.top
2483+ mv MADatNLO_B_1.top MADatNLO.top
2484+elif [ "$#" -gt 1 ]; then
2485+ combine "MADatNLO_A" "$@"
2486+ mv MADatNLO_A_1.top MADatNLO.top
2487 else
2488- mv MADatNLO1.top MADatNLO.top
2489+ cp $1 MADatNLO.top
2490 fi
2491
2492-if [ -f $thisdir/read40.errors ]
2493+
2494+if [ -f read40.errors ]
2495 then
2496-rm -f $thisdir/read40.errors
2497+rm -f read40.errors
2498 fi
2499-find . -name S"*"read40"*".out -exec fgrep -il "READ40 ERROR READ40 ERROR" {} \; > $thisdir/read40.errors
2500-
2501-if [ ! -s $thisdir/read40.errors ] ; then
2502+
2503+find . -name S"*"read40"*".out -exec fgrep -il "READ40 ERROR READ40 ERROR" {} \; > read40.errors
2504+
2505+if [ ! -s read40.errors ] ; then
2506 echo 'no errors found'
2507 else
2508 echo 'ERRORS! see read40.errors for details'
2509 fi
2510-
2511-#./NLO_Born3.py
2512-#$TD MADatNLO_combined.top "POSTSCR,ORIENT=3"
2513-#$PSOPEN MADatNLO_combined.ps
2514-##td2pdf MADatNLO_con
2515
2516=== modified file 'Template/NLO/SubProcesses/driver_mintFO.f'
2517--- Template/NLO/SubProcesses/driver_mintFO.f 2018-04-16 14:08:47 +0000
2518+++ Template/NLO/SubProcesses/driver_mintFO.f 2018-12-20 08:18:55 +0000
2519@@ -48,7 +48,7 @@
2520 include "mint.inc"
2521 integer nhits_in_grids(maxchannels)
2522 real* 8 xgrid(0:nintervals,ndimmax,maxchannels),ymax(nintervals
2523- $ ,ndimmax,maxchannels),ymax_virt(maxchannels),ans(nintegrals
2524+ $ ,ndimmax,maxchannels),ymax_virt(0:maxchannels),ans(nintegrals
2525 $ ,0:maxchannels),unc(nintegrals,0:maxchannels),chi2(nintegrals
2526 $ ,0:maxchannels),x(ndimmax),itmax_fl
2527 integer ixi_i,iphi_i,iy_ij,vn
2528@@ -402,9 +402,10 @@
2529 double precision xx(ndimmax),vegas_wgt,f(nintegrals),jac,p(0:3
2530 $ ,nexternal),rwgt,vol,sig,x(99),MC_int_wgt
2531 integer ifl,nFKS_born,nFKS_picked,iFKS,nFKS_min,iamp
2532- $ ,nFKS_max,izero,ione,itwo,mohdr
2533+ $ ,nFKS_max,izero,ione,itwo,mohdr,i,iran_picked
2534 parameter (izero=0,ione=1,itwo=2,mohdr=-100)
2535- logical passcuts,passcuts_nbody,passcuts_n1body,sum
2536+ logical passcuts,passcuts_nbody,passcuts_n1body,sum,firsttime
2537+ data firsttime/.true./
2538 external passcuts
2539 integer ini_fin_fks(maxchannels)
2540 common/fks_channels/ini_fin_fks
2541@@ -431,6 +432,16 @@
2542 common /for_applgrid/ iappl
2543 double precision wgt_ME_born,wgt_ME_real
2544 common /c_wgt_ME_tree/ wgt_ME_born,wgt_ME_real
2545+ integer ini_fin_fks_map(0:2,0:fks_configs)
2546+ save ini_fin_fks_map
2547+ if (firsttime) then
2548+ firsttime=.false.
2549+ call setup_ini_fin_fks_map(ini_fin_fks_map)
2550+ write (*,*) 'initial-final FKS maps:'
2551+ write (*,*) 0 ,':',ini_fin_fks_map(0,:)
2552+ write (*,*) 1 ,':',ini_fin_fks_map(1,:)
2553+ write (*,*) 2 ,':',ini_fin_fks_map(2,:)
2554+ endif
2555 if (ifl.ne.0) then
2556 write (*,*) 'ERROR ifl not equal to zero in sigint',ifl
2557 stop 1
2558@@ -453,20 +464,9 @@
2559 if (ickkw.eq.-1) H1_factor_virt=0d0
2560 if (ickkw.eq.3) call set_FxFx_scale(0,p)
2561 call update_vegas_x(xx,x)
2562- call get_MC_integer(max(ini_fin_fks(ichan),1),fks_configs
2563- $ ,nFKS_picked,vol)
2564- if (ini_fin_fks(ichan).eq.1) then
2565- do while (fks_j_d(nFKS_picked).le.nincoming)
2566- call get_MC_integer(ini_fin_fks(ichan),fks_configs
2567- $ ,nFKS_picked,vol)
2568- enddo
2569- elseif (ini_fin_fks(ichan).eq.2) then
2570- do while (fks_j_d(nFKS_picked).gt.nincoming)
2571- call get_MC_integer(ini_fin_fks(ichan),fks_configs
2572- $ ,nFKS_picked,vol)
2573- enddo
2574- endif
2575-
2576+ call get_MC_integer(max(ini_fin_fks(ichan),1)
2577+ $ ,ini_fin_fks_map(ini_fin_fks(ichan),0),iran_picked,vol)
2578+ nFKS_picked=ini_fin_fks_map(ini_fin_fks(ichan),iran_picked)
2579
2580 c The nbody contributions
2581 if (abrv.eq.'real') goto 11
2582@@ -503,14 +503,15 @@
2583 nbody=.false.
2584 if (sum) then
2585 nFKS_min=1
2586- nFKS_max=fks_configs
2587+ nFKS_max=ini_fin_fks_map(ini_fin_fks(ichan),0)
2588 MC_int_wgt=1d0
2589 else
2590- nFKS_min=nFKS_picked
2591- nFKS_max=nFKS_picked
2592+ nFKS_min=iran_picked
2593+ nFKS_max=iran_picked
2594 MC_int_wgt=1d0/vol
2595 endif
2596- do iFKS=nFKS_min,nFKS_max
2597+ do i=nFKS_min,nFKS_max
2598+ iFKS=ini_fin_fks_map(ini_fin_fks(ichan),i)
2599 calculatedBorn=.false.
2600 ! MZ this is a temporary fix for processes without
2601 ! soft singularities associated to the initial state
2602@@ -566,11 +567,11 @@
2603 c Importance sampling for FKS configurations
2604 if (sum) then
2605 call get_wgt_nbody(sig)
2606- call fill_MC_integer(max(ini_fin_fks(ichan),1),nFKS_picked
2607+ call fill_MC_integer(max(ini_fin_fks(ichan),1),iran_picked
2608 $ ,abs(sig))
2609 else
2610 call get_wgt_no_nbody(sig)
2611- call fill_MC_integer(max(ini_fin_fks(ichan),1),nFKS_picked
2612+ call fill_MC_integer(max(ini_fin_fks(ichan),1),iran_picked
2613 $ ,abs(sig)*vol)
2614 endif
2615
2616@@ -595,6 +596,35 @@
2617 return
2618 end
2619
2620+ subroutine setup_ini_fin_FKS_map(ini_fin_FKS_map)
2621+ implicit none
2622+ include 'nexternal.inc'
2623+ include 'nFKSconfigs.inc'
2624+ include 'fks_info.inc'
2625+ integer ini_fin_FKS_map(0:2,0:fks_configs),iFKS
2626+ ini_fin_FKS_map(0,0)=0
2627+ ini_fin_FKS_map(1,0)=0
2628+ ini_fin_FKS_map(2,0)=0
2629+ do iFKS=1,fks_configs
2630+ ini_fin_FKS_map(0,0)=ini_fin_FKS_map(0,0)+1
2631+ ini_fin_FKS_map(0,ini_fin_FKS_map(0,0))=iFKS
2632+ if (fks_j_d(iFKS).le.nincoming .and.
2633+ $ fks_j_d(iFKS).gt.0) then
2634+ ini_fin_FKS_map(2,0)=ini_fin_FKS_map(2,0)+1
2635+ ini_fin_FKS_map(2,ini_fin_FKS_map(2,0))=iFKS
2636+ elseif (fks_j_d(iFKS).gt.nincoming .and.
2637+ $ fks_j_d(iFKS).le.nexternal) then
2638+ ini_fin_FKS_map(1,0)=ini_fin_FKS_map(1,0)+1
2639+ ini_fin_FKS_map(1,ini_fin_FKS_map(1,0))=iFKS
2640+ else
2641+ write (*,*) 'ERROR in setup_ini_fin_FKS_map',fks_j_d(iFKS)
2642+ $ ,nincoming,iFKS
2643+ stop 1
2644+ endif
2645+ enddo
2646+ return
2647+ end
2648+
2649 subroutine get_born_nFKSprocess(nFKS_in,nFKS_out)
2650 implicit none
2651 include 'nexternal.inc'
2652
2653=== modified file 'Template/NLO/SubProcesses/driver_mintMC.f'
2654--- Template/NLO/SubProcesses/driver_mintMC.f 2018-04-16 14:08:47 +0000
2655+++ Template/NLO/SubProcesses/driver_mintMC.f 2018-12-20 08:18:55 +0000
2656@@ -59,7 +59,7 @@
2657 common /event_normalisation/event_norm
2658 c For MINT:
2659 real* 8 xgrid(0:nintervals,ndimmax,maxchannels),ymax(nintervals
2660- $ ,ndimmax,maxchannels),ymax_virt(maxchannels),ans(nintegrals
2661+ $ ,ndimmax,maxchannels),ymax_virt(0:maxchannels),ans(nintegrals
2662 $ ,0:maxchannels),unc(nintegrals,0:maxchannels),chi2(nintegrals
2663 $ ,0:maxchannels),x(ndimmax)
2664 integer ixi_i,iphi_i,iy_ij,vn,nhits_in_grids(maxchannels)
2665@@ -842,7 +842,7 @@
2666 firsttime=.false.
2667 c Determines the proc_map that sets which FKS configuration can be
2668 c summed explicitly and which by MC-ing.
2669- call setup_proc_map(sum,proc_map)
2670+ call setup_proc_map(sum,proc_map,ini_fin_fks)
2671 c For the S-events, we can combine processes when they give identical
2672 c processes at the Born. Make sure we check that we get indeed identical
2673 c IRPOC's
2674@@ -869,16 +869,6 @@
2675 if (ickkw.eq.3) call set_FxFx_scale(0,p)
2676 call update_vegas_x(xx,x)
2677 call get_MC_integer(1,proc_map(0,0),proc_map(0,1),vol1)
2678- if (ini_fin_fks.eq.1) then
2679- do while (fks_j_d(proc_map(proc_map(0,1),1)).le.nincoming)
2680- call get_MC_integer(1,proc_map(0,0),proc_map(0,1),vol1)
2681- enddo
2682- elseif (ini_fin_fks.eq.2) then
2683- do while (fks_j_d(proc_map(proc_map(0,1),1)).gt.nincoming)
2684- call get_MC_integer(1,proc_map(0,0),proc_map(0,1),vol1)
2685- enddo
2686- endif
2687-
2688 c The nbody contributions
2689 if (abrv.eq.'real') goto 11
2690 nbody=.true.
2691@@ -1043,7 +1033,7 @@
2692 end
2693
2694
2695- subroutine setup_proc_map(sum,proc_map)
2696+ subroutine setup_proc_map(sum,proc_map,ini_fin_fks)
2697 c Determines the proc_map that sets which FKS configuration can be
2698 c summed explicitly and which by MC-ing.
2699 implicit none
2700@@ -1056,7 +1046,7 @@
2701 logical found_ini1,found_ini2,found_fnl
2702 integer proc_map(0:fks_configs,0:fks_configs)
2703 $ ,j_fks_proc(fks_configs),i_fks_pdg_proc(fks_configs)
2704- $ ,j_fks_pdg_proc(fks_configs),i,sum,j
2705+ $ ,j_fks_pdg_proc(fks_configs),i,sum,j,ini_fin_fks
2706 integer nFKSprocess
2707 common/c_nFKSprocess/nFKSprocess
2708 INTEGER IPROC
2709@@ -1097,6 +1087,8 @@
2710 c them in the process map
2711 do nFKSprocess=1,fks_configs
2712 call fks_inc_chooser()
2713+ if (ini_fin_fks.eq.1 .and. j_fks.le.nincoming) cycle
2714+ if (ini_fin_fks.eq.2 .and. j_fks.gt.nincoming) cycle
2715 if (need_color_links.or.need_charge_links) then
2716 proc_map(0,0)=proc_map(0,0)+1
2717 proc_map(proc_map(0,0),0)=proc_map(proc_map(0,0),0)+1
2718@@ -1156,6 +1148,8 @@
2719 c gluons splitting
2720 do nFKSprocess=1,fks_configs
2721 call fks_inc_chooser()
2722+ if (ini_fin_fks.eq.1 .and. j_fks.le.nincoming) cycle
2723+ if (ini_fin_fks.eq.2 .and. j_fks.gt.nincoming) cycle
2724 if (.not.(need_color_links.or.need_charge_links)) then
2725 if (j_fks.eq.1 .and. found_ini1) then
2726 do i=1,proc_map(0,0)
2727
2728=== modified file 'Template/NLO/SubProcesses/fks_singular.f'
2729--- Template/NLO/SubProcesses/fks_singular.f 2018-04-16 14:08:47 +0000
2730+++ Template/NLO/SubProcesses/fks_singular.f 2018-12-20 08:18:55 +0000
2731@@ -1115,8 +1115,6 @@
2732 double precision xi_i_fks_ev,y_ij_fks_ev
2733 double precision p_i_fks_ev(0:3),p_i_fks_cnt(0:3,-2:2)
2734 common/fksvariables/xi_i_fks_ev,y_ij_fks_ev,p_i_fks_ev,p_i_fks_cnt
2735- double precision xi_i_hat_ev,xi_i_hat_cnt(-2:2)
2736- common /cxi_i_hat/xi_i_hat_ev,xi_i_hat_cnt
2737 integer i_fks,j_fks
2738 common/fks_indices/i_fks,j_fks
2739 double precision xi_i_fks_cnt(-2:2)
2740@@ -1249,7 +1247,7 @@
2741 endif
2742
2743 c f_* multiplication factors for real-emission, soft counter, ... etc.
2744- prefact=1d0/xi_i_hat_ev/(1-y_ij_fks_ev)
2745+ prefact=xinorm_ev/xi_i_fks_ev/(1-y_ij_fks_ev)
2746 f_r=prefact*jac_ev*enhance_real*fkssymmetryfactor*vegas_wgt
2747 f_MC_S=f_r
2748 f_MC_H=f_r
2749@@ -1736,11 +1734,16 @@
2750 c coefficients for PDF and scale computations.
2751 use weight_lines
2752 implicit none
2753- integer i,j
2754+ include 'orders.inc'
2755+ include 'mint.inc'
2756+ integer orders(nsplitorders)
2757+ integer i,j,iamp
2758+ logical virt_found
2759 double precision bias
2760 character*7 event_norm
2761 common /event_normalisation/event_norm
2762- double precision virt_wgt_mint,born_wgt_mint
2763+ double precision virt_wgt_mint(0:n_ave_virt),
2764+ & born_wgt_mint(0:n_ave_virt)
2765 common /virt_born_wgt_mint/virt_wgt_mint,born_wgt_mint
2766 c Set the bias_wgt to 1 in case we do not have to do any biassing
2767 if (event_norm(1:4).ne.'bias') then
2768@@ -1749,6 +1752,7 @@
2769 enddo
2770 return
2771 endif
2772+ virt_found=.false.
2773 c loop over all contributions
2774 do i=1,icontr
2775 if (itype(i).eq.1) then
2776@@ -1771,9 +1775,15 @@
2777 do j=1,3
2778 wgt(j,i)=wgt(j,i)*bias_wgt(i)
2779 enddo
2780- if (itype(i).eq.14) then
2781- virt_wgt_mint=virt_wgt_mint*bias_wgt(i)
2782- born_wgt_mint=born_wgt_mint*bias_wgt(i)
2783+ if (itype(i).eq.14 .and. .not.virt_found) then
2784+ virt_found=.true.
2785+ virt_wgt_mint(0)=virt_wgt_mint(0)*bias_wgt(i)
2786+ born_wgt_mint(0)=born_wgt_mint(0)*bias_wgt(i)
2787+ do iamp=1,amp_split_size
2788+ call amp_split_pos_to_orders(iamp, orders)
2789+ virt_wgt_mint(iamp)=virt_wgt_mint(iamp)*bias_wgt(i)
2790+ born_wgt_mint(iamp)=born_wgt_mint(iamp)*bias_wgt(i)
2791+ enddo
2792 endif
2793 enddo
2794 return
2795@@ -3805,7 +3815,7 @@
2796 if (iextra_cnt.gt.0)
2797 1 call extra_cnt(p_born, iextra_cnt, ans_extra_cnt)
2798 call AP_reduced(j_type,i_type,ch_j,ch_i,t,z,ap)
2799- call Qterms_reduced_timelike(j_type,i_type,ch_i,ch_j,t,z,Q)
2800+ call Qterms_reduced_timelike(j_type,i_type,ch_j,ch_i,t,z,Q)
2801 wgt=0d0
2802 do iord = 1, nsplitorders
2803 if (.not.split_type(iord) .or. (iord.ne.qed_pos .and.
2804
2805=== modified file 'Template/NLO/SubProcesses/genps_fks.f'
2806--- Template/NLO/SubProcesses/genps_fks.f 2018-01-29 05:41:33 +0000
2807+++ Template/NLO/SubProcesses/genps_fks.f 2018-12-20 08:18:55 +0000
2808@@ -2557,7 +2557,7 @@
2809 integer cBW_level_max,cBW(-nexternal:-1),cBW_level(-nexternal:-1)
2810 double precision cBW_mass(-1:1,-nexternal:-1),
2811 & cBW_width(-1:1,-nexternal:-1)
2812- double precision s_mass(-nexternal:-1)
2813+ double precision s_mass(-nexternal:nexternal)
2814 common/to_phase_space_s_channel/s_mass
2815 c Common block with granny information
2816 logical granny_is_res
2817
2818=== modified file 'Template/NLO/SubProcesses/makefile'
2819--- Template/NLO/SubProcesses/makefile 2017-06-15 16:22:23 +0000
2820+++ Template/NLO/SubProcesses/makefile 2018-12-20 08:18:55 +0000
2821@@ -7,9 +7,6 @@
2822 # Files for the read40 combiner of top drawer files
2823 READ40=read40.o
2824
2825-# Files for the split40 splitter of top drawer files
2826-SPLIT40=split40.o
2827-
2828 # Files to collect all the events in the separate integration channels into a single file
2829 COLLECT_EVENTS=collect_events.o handling_lhe_events.o fill_MC_mshell.o
2830
2831@@ -21,9 +18,6 @@
2832 read40: $(READ40)
2833 $(FC) $(LDFLAGS) -o read40 $(READ40)
2834
2835-split40: $(SPLIT40)
2836- $(FC) $(LDFLAGS) -o split40 $(SPLIT40)
2837-
2838 collect_events: $(COLLECT_EVENTS) $(LIBS)
2839 $(FC) -o collect_events $(COLLECT_EVENTS) $(LINKLIBS) $(LDFLAGS)
2840 rm handling_lhe_events.o
2841
2842=== modified file 'Template/NLO/SubProcesses/mint-integrator2.f'
2843--- Template/NLO/SubProcesses/mint-integrator2.f 2017-07-31 08:48:20 +0000
2844+++ Template/NLO/SubProcesses/mint-integrator2.f 2018-12-20 08:18:55 +0000
2845@@ -77,7 +77,7 @@
2846 $ ,ans(nintegrals,0:maxchannels),unc(nintegrals,0:maxchannels)
2847 $ ,ans3(nintegrals,3),unc3(nintegrals,3),ans_l3(nintegrals)
2848 $ ,unc_l3(nintegrals),chi2_l3(nintegrals),vol_chan,error_virt
2849- real * 8 xint_virt(maxchannels),ymax_virt(maxchannels)
2850+ real * 8 xint_virt(maxchannels),ymax_virt(0:maxchannels)
2851 $ ,ans_chan(0:maxchannels)
2852 real * 8 x(ndimmax),vol
2853 real * 8 xacc(0:nintervals,ndimmax,maxchannels)
2854@@ -216,7 +216,7 @@
2855 ans_chan(0)=ans_chan(0)+ans(1,kchan)
2856 enddo
2857 endif
2858- cross_section=ans_chan(0)
2859+ cross_section=ans_chan(0) * wgt_mult
2860 nit=0
2861 nit_included=0
2862 do i=1,nintegrals
2863@@ -1031,8 +1031,8 @@
2864 integer ndim,imode
2865 include "mint.inc"
2866 real * 8 fun,xgrid(0:nintervals,ndimmax,maxchannels)
2867- $ ,ymax(nintervals,ndimmax,maxchannels),ymax_virt(maxchannels)
2868- $ ,x(ndimmax)
2869+ $ ,ymax(nintervals,ndimmax,maxchannels)
2870+ $ ,ymax_virt(0:maxchannels),x(ndimmax)
2871 real * 8 dx(ndimmax),xx(ndimmax),vol_chan,dummy
2872 integer icell(ndimmax),ncell(ndimmax),ncell_virt
2873 integer ifold(ndimmax),kfold(ndimmax)
2874
2875=== modified file 'Template/NLO/SubProcesses/montecarlocounter.f'
2876--- Template/NLO/SubProcesses/montecarlocounter.f 2018-04-16 14:08:47 +0000
2877+++ Template/NLO/SubProcesses/montecarlocounter.f 2018-12-20 08:18:55 +0000
2878@@ -1,3231 +1,3259 @@
2879- subroutine set_mc_matrices
2880- implicit none
2881- include "genps.inc"
2882- include 'nexternal.inc'
2883- include "born_nhel.inc"
2884-c Nexternal is the number of legs (initial and final) al NLO, while max_bcol
2885-c is the number of color flows at Born level
2886- integer i,j,k,l,k0,mothercol(2),i1(2)
2887- integer idup(nexternal-1,maxproc)
2888- integer mothup(2,nexternal-1,maxproc)
2889- integer icolup(2,nexternal-1,max_bcol)
2890- include 'born_leshouche.inc'
2891- integer ipartners(0:nexternal-1),colorflow(nexternal-1,0:max_bcol)
2892- common /MC_info/ ipartners,colorflow
2893- integer i_fks,j_fks
2894- common/fks_indices/i_fks,j_fks
2895- integer fksfather
2896- common/cfksfather/fksfather
2897- logical notagluon,found
2898- common/cnotagluon/notagluon
2899- integer nglu,nsngl
2900- logical isspecial,isspecial0
2901- common/cisspecial/isspecial
2902- logical spec_case
2903-
2904- include 'orders.inc'
2905- logical split_type(nsplitorders)
2906- common /c_split_type/split_type
2907- double precision particle_charge(nexternal)
2908- common /c_charges/particle_charge
2909-
2910-c
2911- logical is_leading_cflow(max_bcol)
2912- integer num_leading_cflows
2913- common/c_leading_cflows/is_leading_cflow,num_leading_cflows
2914- include 'born_conf.inc'
2915- include 'born_coloramps.inc'
2916-c
2917- ipartners(0)=0
2918- do i=1,nexternal-1
2919- colorflow(i,0)=0
2920- enddo
2921-
2922-C What follows is true for QCD-type splittings.
2923-C For QED-type splittings, ipartner is simply all the charged particles
2924-C in the event except for FKSfather. In this case, all the born color
2925-C flows are allowed
2926-
2927-c ipartners(0): number of particles that can be colour or anticolour partner
2928-c of the father, the Born-level particle to which i_fks and j_fks are
2929-c attached. If one given particle is the colour/anticolour partner of
2930-c the father in more than one colour flow, it is counted only once
2931-c in ipartners(0)
2932-c ipartners(i), 1<=i<=nexternal-1: the label (according to Born-level
2933-c labelling) of the i^th colour partner of the father
2934-c
2935-c colorflow(i,0), 1<=i<=nexternal-1: number of colour flows in which
2936-c the particle ipartners(i) is a colour partner of the father
2937-c colorflow(i,j): the actual label (according to born_leshouche.inc)
2938-c of the j^th colour flow in which the father and ipartners(i) are
2939-c colour partners
2940-c
2941-c Example: in the process q(1) qbar(2) -> g(3) g(4), the two color flows are
2942-c
2943-c j=1 i icolup(1) icolup(2) j=2 i icolup(1) icolup(2)
2944-c 1 500 0 1 500 0
2945-c 2 0 501 2 0 501
2946-c 3 500 502 3 502 501
2947-c 4 502 501 4 500 502
2948-c
2949-c and if one fixes for example fksfather=3, then ipartners = 3
2950-c while colorflow = 0 0 0 1
2951-c 1 1 0 4
2952-c 2 1 2 2
2953-c 1 2 0
2954-c
2955-
2956- fksfather=min(i_fks,j_fks)
2957-
2958-c isspecial will be set equal to .true. only if the father is a gluon,
2959-c and another gluon will be found which is connected to it by both
2960-c colour and anticolour
2961- isspecial=.false.
2962-c
2963- if (split_type(qcd_pos)) then
2964- ! identify the color partners
2965-c consider only leading colour flows
2966- num_leading_cflows=0
2967- do i=1,max_bcol
2968- is_leading_cflow(i)=.false.
2969- do j=1,mapconfig(0)
2970- if(icolamp(i,j,1))then
2971- is_leading_cflow(i)=.true.
2972- num_leading_cflows=num_leading_cflows+1
2973- exit
2974- endif
2975- enddo
2976- enddo
2977-c
2978- do i=1,max_bcol
2979- if(.not.is_leading_cflow(i))cycle
2980-c Loop over Born-level colour flows
2981- isspecial0=.false.
2982-c nglu and nsngl are the number of gluons (except for the father) and of
2983-c colour singlets in the Born process, according to the information
2984-c stored in ICOLUP
2985- nglu=0
2986- nsngl=0
2987- mothercol(1)=ICOLUP(1,fksfather,i)
2988- mothercol(2)=ICOLUP(2,fksfather,i)
2989- notagluon=(mothercol(1).eq.0 .or. mothercol(2).eq.0)
2990-c
2991- do j=1,nexternal-1
2992-c Loop over Born-level particles; j is the possible colour partner of father,
2993-c and whether this is the case is determined inside this loop
2994- if (j.ne.fksfather) then
2995-c Skip father (it cannot be its own colour partner)
2996- if(ICOLUP(1,j,i).eq.0.and.ICOLUP(2,j,i).eq.0)
2997- # nsngl=nsngl+1
2998- if(ICOLUP(1,j,i).ne.0.and.ICOLUP(2,j,i).ne.0)
2999- # nglu=nglu+1
3000- if ( (j.le.nincoming.and.fksfather.gt.nincoming) .or.
3001- # (j.gt.nincoming.and.fksfather.le.nincoming) ) then
3002-c father and j not both in the initial or in the final state -- connect
3003-c colour (1) with colour (i1(1)), and anticolour (2) with anticolour (i1(2))
3004- i1(1)=1
3005- i1(2)=2
3006- else
3007-c father and j both in the initial or in the final state -- connect
3008-c colour (1) with anticolour (i1(2)), and anticolour (2) with colour (i1(1))
3009- i1(1)=2
3010- i1(2)=1
3011- endif
3012- do l=1,2
3013-c Loop over colour and anticolour of father
3014- found=.false.
3015- if( ICOLUP(i1(l),j,i).eq.mothercol(l) .and.
3016- & ICOLUP(i1(l),j,i).ne.0 ) then
3017-c When ICOLUP(i1(l),j,i) = mothercol(l), the colour (if i1(l)=1) or
3018-c the anticolour (if i1(l)=2) of particle j is connected to the
3019-c colour (if l=1) or the anticolour (if l=2) of the father
3020- k0=-1
3021- do k=1,ipartners(0)
3022-c Loop over previously-found colour/anticolour partners of father
3023- if(ipartners(k).eq.j)then
3024- if(found)then
3025-c Safety measure: if this condition is met, it means that there exist
3026-c k1 and k2 such that ipartners(k1)=ipartners(k2). This is thus a bug,
3027-c since ipartners() is the list of possible partners of father, where each
3028-c Born-level particle must appears at most once
3029- write(*,*)'Error #1 in set_matrices'
3030- write(*,*)i,j,l,k
3031- stop
3032- endif
3033- found=.true.
3034- k0=k
3035- endif
3036- enddo
3037- if (.not.found) then
3038- ipartners(0)=ipartners(0)+1
3039- ipartners(ipartners(0))=j
3040- k0=ipartners(0)
3041- endif
3042-c At this point, k0 is the k0^th colour/anticolour partner of father.
3043-c Therefore, ipartners(k0)=j
3044- if(k0.le.0.or.ipartners(k0).ne.j)then
3045- write(*,*)'Error #2 in set_matrices'
3046- write(*,*)i,j,l,k0,ipartners(k0)
3047- stop
3048- endif
3049- spec_case=l.eq.2 .and. colorflow(k0,0).ge.1 .and.
3050- & colorflow(k0,colorflow(k0,0)).eq.i
3051- if (.not.spec_case)then
3052-c Increase by one the number of colour flows in which the father is
3053-c (anti)colour-connected with its k0^th partner (according to the
3054-c list defined by ipartners)
3055- colorflow(k0,0)=colorflow(k0,0)+1
3056-c Store the label of the colour flow thus found
3057- colorflow(k0,colorflow(k0,0))=i
3058- elseif (spec_case)then
3059-c Special case: father and ipartners(k0) are both gluons, connected
3060-c by colour AND anticolour: the number of colour flows was overcounted
3061-c by one unit, so decrease it
3062- if( notagluon .or.
3063- & ICOLUP(i1(1),j,i).eq.0 .or.
3064- & ICOLUP(i1(2),j,i).eq.0 )then
3065- write(*,*)'Error #3 in set_matrices'
3066- write(*,*)i,j,l,k0,i1(1),i1(2)
3067- stop
3068- endif
3069- colorflow(k0,colorflow(k0,0))=i
3070- isspecial0=.true.
3071- endif
3072- endif
3073- enddo
3074- endif
3075- enddo
3076- if( ((nglu+nsngl).gt.(nexternal-2)) .or.
3077- # (isspecial0.and.(nglu+nsngl).ne.(nexternal-2)) )then
3078- write(*,*)'Error #4 in set_matrices'
3079- write(*,*)isspecial0,nglu,nsngl
3080- stop
3081- endif
3082- isspecial=isspecial.or.isspecial0
3083- enddo
3084-
3085- else if (split_type(qed_pos)) then
3086- ! do nothing, the partner will be assigned at run-time
3087- ! (it is kinematics-dependent)
3088- continue
3089- endif
3090- call check_mc_matrices
3091- return
3092- end
3093-
3094-
3095-
3096- subroutine check_mc_matrices
3097- implicit none
3098- include "nexternal.inc"
3099- include "born_nhel.inc"
3100-c include "fks.inc"
3101- integer fks_j_from_i(nexternal,0:nexternal)
3102- & ,particle_type(nexternal),pdg_type(nexternal)
3103- common /c_fks_inc/fks_j_from_i,particle_type,pdg_type
3104- integer ipartners(0:nexternal-1),colorflow(nexternal-1,0:max_bcol)
3105- common /MC_info/ ipartners,colorflow
3106- integer i,j,ipart,iflow,ntot,ithere(1000)
3107- integer fksfather
3108- common/cfksfather/fksfather
3109- logical notagluon
3110- common/cnotagluon/notagluon
3111- logical isspecial
3112- common/cisspecial/isspecial
3113-
3114- include 'orders.inc'
3115- logical split_type(nsplitorders)
3116- common /c_split_type/split_type
3117-
3118- logical is_leading_cflow(max_bcol)
3119- integer num_leading_cflows
3120- common/c_leading_cflows/is_leading_cflow,num_leading_cflows
3121-c
3122- if(ipartners(0).gt.nexternal-1)then
3123- write(*,*)'Error #1 in check_mc_matrices',ipartners(0)
3124- stop
3125- endif
3126-c
3127-
3128- if (split_type(QCD_pos)) then
3129- ! these tests only apply for QCD-type splittings
3130- do i=1,ipartners(0)
3131- ipart=ipartners(i)
3132- if( ipart.eq.fksfather .or.
3133- # ipart.le.0 .or. ipart.gt.nexternal-1 .or.
3134- # ( abs(particle_type(ipart)).ne.3 .and.
3135- # particle_type(ipart).ne.8 ) )then
3136- write(*,*)'Error #2 in check_mc_matrices',i,ipart,
3137- # particle_type(ipart)
3138- stop
3139- endif
3140- enddo
3141-c
3142- do i=1,nexternal-1
3143- ithere(i)=1
3144- enddo
3145- do i=1,ipartners(0)
3146- ipart=ipartners(i)
3147- ithere(ipart)=ithere(ipart)-1
3148- if(ithere(ipart).lt.0)then
3149- write(*,*)'Error #3 in check_mc_matrices',i,ipart
3150- stop
3151- endif
3152- enddo
3153-c
3154-c ntot is the total number of colour plus anticolour partners of father
3155- ntot=0
3156- do i=1,ipartners(0)
3157- ntot=ntot+colorflow(i,0)
3158-c
3159- if( colorflow(i,0).le.0 .or.
3160- # colorflow(i,0).gt.max_bcol )then
3161- write(*,*)'Error #4 in check_mc_matrices',i,colorflow(i,0)
3162- stop
3163- endif
3164-c
3165- do j=1,max_bcol
3166- ithere(j)=1
3167- enddo
3168- do j=1,colorflow(i,0)
3169- iflow=colorflow(i,j)
3170- ithere(iflow)=ithere(iflow)-1
3171- if(ithere(iflow).lt.0)then
3172- write(*,*)'Error #5 in check_mc_matrices',i,j,iflow
3173- stop
3174- endif
3175- enddo
3176-c
3177- enddo
3178-c
3179- if( (notagluon.and.ntot.ne.num_leading_cflows) .or.
3180- # ( (.not.notagluon).and.
3181- # ( (.not.isspecial).and.ntot.ne.(2*num_leading_cflows) .or.
3182- # (isspecial.and.ntot.ne.num_leading_cflows) ) ) )then
3183- write(*,*)'Error #6 in check_mc_matrices',
3184- # notagluon,ntot,num_leading_cflows,max_bcol
3185- stop
3186- endif
3187-c
3188- if(num_leading_cflows.gt.max_bcol)then
3189- write(*,*)'Error #7 in check_mc_matrices',
3190- # num_leading_cflows,max_bcol
3191- stop
3192- endif
3193-
3194- else if (split_type(QED_pos)) then
3195- ! write here possible checks for QED-type splittings
3196- continue
3197- endif
3198- return
3199- end
3200-
3201-
3202- subroutine find_ipartner_QED(pp, nofpartners)
3203- implicit none
3204- include 'nexternal.inc'
3205- double precision pp(0:3, nexternal)
3206- integer nofpartners
3207-
3208- integer fks_j_from_i(nexternal,0:nexternal)
3209- & ,particle_type(nexternal),pdg_type(nexternal)
3210- common /c_fks_inc/fks_j_from_i,particle_type,pdg_type
3211- double precision particle_charge(nexternal)
3212- common /c_charges/particle_charge
3213-
3214- integer i_fks,j_fks,fksfather
3215- common/fks_indices/i_fks,j_fks
3216- double precision pmass(nexternal)
3217- double precision zero
3218- parameter (zero=0d0)
3219-
3220- include 'genps.inc'
3221- include "born_nhel.inc"
3222- integer idup(nexternal-1,maxproc)
3223- integer mothup(2,nexternal-1,maxproc)
3224- integer icolup(2,nexternal-1,max_bcol)
3225- include 'born_leshouche.inc'
3226- include 'coupl.inc'
3227- integer ipartners(0:nexternal-1),colorflow(nexternal-1,0:max_bcol)
3228- common /MC_info/ ipartners,colorflow
3229-c
3230-c Shower MonteCarlo
3231-c
3232- character*10 shower_mc
3233- common /cMonteCarloType/shower_mc
3234-
3235- logical found
3236- logical same_state
3237- double precision ppmin, ppnow
3238- integer partner
3239- integer i,j
3240- double precision chargeprod
3241- double precision dot
3242-
3243- include 'pmass.inc'
3244-
3245- found=.false.
3246- ppmin=1d99
3247- fksfather=min(i_fks,j_fks)
3248-
3249- if (shower_mc.eq.'PYTHIA8') then
3250- ! this should follow what is done in TimeShower::setupQEDdip
3251- ! first, look for the lowest-mass same- (opposite-)flavour pair of
3252- ! particles in the opposite (same) state of the system
3253- do j=1,nexternal
3254- if (j.ne.fksfather.and.j.ne.i_fks) then
3255- same_state = (j.gt.nincoming.and.fksfather.gt.nincoming).or.
3256- $ (j.le.nincoming.and.fksfather.le.nincoming)
3257-
3258- if ((pdg_type(j).eq.pdg_type(fksfather).and..not.same_state).or.
3259- $ (pdg_type(j).eq.-pdg_type(fksfather).and.same_state)) then
3260-
3261- ppnow=dot(pp(0,fksfather),pp(0,j)) - pmass(fksfather)*pmass(j)
3262- if (ppnow.lt.ppmin) then
3263- found=.true.
3264- partner=j
3265- endif
3266- endif
3267- endif
3268- enddo
3269-
3270- ! if no partner has been found, then look for the
3271- ! lowest-mass/chargeprod pair
3272- if (.not.found) then
3273- do j=1,nexternal
3274- if (j.ne.fksfather.and.j.ne.i_fks) then
3275- if (particle_charge(fksfather).ne.0d0.and.particle_charge(j).ne.0d0) then
3276- ppnow=dot(pp(0,fksfather),pp(0,j)) - pmass(fksfather)*pmass(j) /
3277- $ (particle_charge(fksfather) * particle_charge(j))
3278- if (ppnow.lt.ppmin) then
3279- found=.true.
3280- partner=j
3281- endif
3282- endif
3283- endif
3284- enddo
3285- endif
3286-
3287- ! if no partner has been found, then look for the
3288- ! lowest-mass pair
3289- if (.not.found) then
3290- do j=1,nexternal
3291- if (j.ne.fksfather.and.j.ne.i_fks) then
3292- ppnow=dot(pp(0,fksfather),pp(0,j)) - pmass(fksfather)*pmass(j)
3293- if (ppnow.lt.ppmin) then
3294- found=.true.
3295- partner=j
3296- endif
3297- endif
3298- enddo
3299- endif
3300-
3301- else
3302- ! other showers need to be implemented
3303- write(*,*) 'ERROR in find_ipartner_QED, not implemented', shower_mc
3304- stop 1
3305- endif
3306-
3307- if (.not.found) then
3308- write(*,*) 'ERROR in find_ipartner_QED, no parthern found'
3309- stop 1
3310- endif
3311-
3312- ! now, set ipartners
3313- ipartners(0) = 1
3314- nofpartners = ipartners(0)
3315- ipartners(ipartners(0)) = partner
3316- ! all color flows have to be included here
3317- colorflow(ipartners(0),0)= max_bcol
3318- do i = 1, max_bcol
3319- colorflow(ipartners(0),i)=i
3320- enddo
3321- return
3322- end
3323-
3324-
3325- subroutine xmcsubt_wrap(pp,xi_i_fks,y_ij_fks,wgt)
3326- implicit none
3327- include "nexternal.inc"
3328- double precision pp(0:3,nexternal),wgt
3329- double precision xi_i_fks,y_ij_fks
3330- double precision xmc,xrealme,gfactsf,gfactcl,probne
3331- double precision xmcxsec(nexternal),z(nexternal)
3332- integer nofpartners
3333- logical lzone(nexternal),flagmc
3334-
3335- ! amp split stuff
3336- include 'orders.inc'
3337- integer iamp
3338- double precision amp_split_mc(amp_split_size)
3339- common /to_amp_split_mc/amp_split_mc
3340- double precision amp_split_gfunc(amp_split_size)
3341- common /to_amp_split_gfunc/amp_split_gfunc
3342-
3343-
3344-c True MC subtraction term
3345- ! this fills the amp_split_mc
3346- ! no need to set them to zero before the call, they are
3347- ! reset inside xmcsubt
3348- call xmcsubt(pp,xi_i_fks,y_ij_fks,gfactsf,gfactcl,probne,
3349- # xmc,nofpartners,lzone,flagmc,z,xmcxsec)
3350-c G-function matrix element, to recover the real soft limit
3351- call xmcsubtME(pp,xi_i_fks,y_ij_fks,gfactsf,gfactcl,xrealme)
3352-
3353- wgt=xmc+xrealme
3354- do iamp=1, amp_split_size
3355- amp_split_mc(iamp) = amp_split_mc(iamp) + amp_split_gfunc(iamp)
3356- enddo
3357-
3358- return
3359- end
3360-
3361-
3362-
3363- subroutine xmcsubtME(pp,xi_i_fks,y_ij_fks,gfactsf,gfactcl,wgt)
3364- implicit none
3365- include "nexternal.inc"
3366- include "coupl.inc"
3367- double precision pp(0:3,nexternal),gfactsf,gfactcl,wgt,wgts,wgtc,wgtsc
3368- double precision xi_i_fks,y_ij_fks
3369-
3370- double precision zero,one
3371- parameter (zero=0d0)
3372- parameter (one=1d0)
3373-
3374- integer izero,ione,itwo
3375- parameter (izero=0)
3376- parameter (ione=1)
3377- parameter (itwo=2)
3378-
3379- double precision p1_cnt(0:3,nexternal,-2:2)
3380- double precision wgt_cnt(-2:2)
3381- double precision pswgt_cnt(-2:2)
3382- double precision jac_cnt(-2:2)
3383- common/counterevnts/p1_cnt,wgt_cnt,pswgt_cnt,jac_cnt
3384-
3385- double precision xi_i_fks_cnt(-2:2)
3386- common /cxiifkscnt/xi_i_fks_cnt
3387-
3388- integer i_fks,j_fks
3389- common/fks_indices/i_fks,j_fks
3390-
3391-c Particle types (=colour) of i_fks, j_fks and fks_mother
3392- integer i_type,j_type,m_type
3393- double precision ch_i,ch_j,ch_m
3394- common/cparticle_types/i_type,j_type,m_type,ch_i,ch_j,ch_m
3395-
3396- double precision pmass(nexternal)
3397- logical is_aorg(nexternal)
3398- common /c_is_aorg/is_aorg
3399-
3400- ! amp split stuff
3401- include 'orders.inc'
3402- integer iamp
3403- double precision amp_split_gfunc(amp_split_size)
3404- common /to_amp_split_gfunc/amp_split_gfunc
3405- double precision amp_split_s(amp_split_size),
3406- $ amp_split_c(amp_split_size),
3407- $ amp_split_sc(amp_split_size)
3408-
3409- include "pmass.inc"
3410-c
3411- wgt=0d0
3412- do iamp=1, amp_split_size
3413- amp_split_gfunc(iamp) = 0d0
3414- enddo
3415- ! this contribution is needed only for i_fks being a gluon/photon
3416- ! (soft limit)
3417- if (is_aorg(i_fks))then
3418-c i_fks is gluon/photon
3419- call set_cms_stuff(izero)
3420- call sreal(p1_cnt(0,1,0),zero,y_ij_fks,wgts)
3421- do iamp=1, amp_split_size
3422- amp_split_s(iamp) = amp_split(iamp)
3423- enddo
3424- call set_cms_stuff(ione)
3425- call sreal(p1_cnt(0,1,1),xi_i_fks,one,wgtc)
3426- do iamp=1, amp_split_size
3427- amp_split_c(iamp) = amp_split(iamp)
3428- enddo
3429- call set_cms_stuff(itwo)
3430- call sreal(p1_cnt(0,1,2),zero,one,wgtsc)
3431- do iamp=1, amp_split_size
3432- amp_split_sc(iamp) = amp_split(iamp)
3433- enddo
3434- wgt=wgts+(1-gfactcl)*(wgtc-wgtsc)
3435- wgt=wgt*(1-gfactsf)
3436- do iamp = 1, amp_split_size
3437- amp_split_gfunc(iamp) = amp_split_s(iamp)+(1-gfactcl)*(amp_split_c(iamp)-amp_split_sc(iamp))
3438- amp_split_gfunc(iamp) = amp_split_gfunc(iamp)*(1-gfactsf)
3439- enddo
3440- elseif (abs(i_type).ne.3.and.ch_i.eq.0d0)then
3441- ! we should never get here
3442- write(*,*) 'FATAL ERROR #1 in xmcsubtME',i_type,i_fks
3443- stop
3444- endif
3445-c
3446- return
3447- end
3448-
3449-
3450-
3451-c Main routine for MC counterterms
3452-
3453- subroutine xmcsubt(pp,xi_i_fks,y_ij_fks,gfactsf,gfactcl,probne,
3454- & wgt,nofpartners,lzone,flagmc,z,xmcxsec)
3455- implicit none
3456- include "nexternal.inc"
3457- include "coupl.inc"
3458- include "born_nhel.inc"
3459- include "fks_powers.inc"
3460- include "madfks_mcatnlo.inc"
3461- include "run.inc"
3462- include "../../Source/MODEL/input.inc"
3463- include 'nFKSconfigs.inc'
3464- include 'orders.inc'
3465- logical split_type(nsplitorders)
3466- common /c_split_type/split_type
3467- integer fks_j_from_i(nexternal,0:nexternal)
3468- & ,particle_type(nexternal),pdg_type(nexternal)
3469- common /c_fks_inc/fks_j_from_i,particle_type,pdg_type
3470- double precision particle_charge(nexternal)
3471- common /c_charges/particle_charge
3472-
3473- double precision pp(0:3,nexternal),gfactsf,gfactcl,probne,wgt
3474- double precision xi_i_fks,y_ij_fks,xm12,xm22
3475- double precision xmcxsec(nexternal)
3476- integer nofpartners
3477- logical lzone(nexternal),flagmc,limit,non_limit
3478-
3479- double precision emsca_bare,ptresc,rrnd,ref_scale,
3480- & scalemin,scalemax,wgt1,qMC,emscainv,emscafun
3481- double precision emscwgt(nexternal),emscav(nexternal)
3482- integer jpartner,mpartner
3483- logical emscasharp
3484-
3485- double precision shattmp,dot,xkern(2),xkernazi(2),
3486- & born_red(nsplitorders), born_red_tilde(nsplitorders)
3487- double precision bornbars(max_bcol,nsplitorders),
3488- & bornbarstilde(max_bcol,nsplitorders)
3489-
3490- integer i,j,npartner,cflows,ileg,N_p,iord
3491- double precision tk,uk,q1q,q2q,E0sq(nexternal),x,yi,yj,xij,ap(2),Q(2),
3492- & s,w1,w2,beta,xfact,prefact,kn,knbar,kn0,betae0,betad,betas,gfactazi,
3493- & gfunction,bogus_probne_fun,
3494- & z(nexternal),xi(nexternal),xjac(nexternal),ztmp,xitmp,xjactmp,
3495- & zHW6,xiHW6,xjacHW6_xiztoxy,zHWPP,xiHWPP,xjacHWPP_xiztoxy,zPY6Q,
3496- & xiPY6Q,xjacPY6Q_xiztoxy,zPY6PT,xiPY6PT,xjacPY6PT_xiztoxy,zPY8,
3497- & xiPY8,xjacPY8_xiztoxy,wcc
3498-
3499- common/cscaleminmax/xm12,ileg
3500- double precision veckn_ev,veckbarn_ev,xp0jfks
3501- common/cgenps_fks/veckn_ev,veckbarn_ev,xp0jfks
3502- double precision p_born(0:3,nexternal-1)
3503- common/pborn/p_born
3504- integer i_fks,j_fks
3505- common/fks_indices/i_fks,j_fks
3506- double precision ybst_til_tolab,ybst_til_tocm,sqrtshat,shat
3507- common/parton_cms_stuff/ybst_til_tolab,ybst_til_tocm,
3508- # sqrtshat,shat
3509-
3510- integer ipartners(0:nexternal-1),colorflow(nexternal-1,0:max_bcol)
3511- common /MC_info/ ipartners,colorflow
3512- logical isspecial
3513- common/cisspecial/isspecial
3514-
3515- integer fksfather
3516- common/cfksfather/fksfather
3517-
3518- logical softtest,colltest
3519- common/sctests/softtest,colltest
3520-
3521- double precision emsca
3522- common/cemsca/emsca,emsca_bare,emscasharp,scalemin,scalemax
3523-
3524- double precision ran2,iseed
3525- external ran2
3526- logical extra
3527-
3528-c Stuff to be written (depending on AddInfoLHE) onto the LHE file
3529- INTEGER NFKSPROCESS
3530- COMMON/C_NFKSPROCESS/NFKSPROCESS
3531- integer iSorH_lhe,ifks_lhe(fks_configs) ,jfks_lhe(fks_configs)
3532- & ,fksfather_lhe(fks_configs) ,ipartner_lhe(fks_configs)
3533- double precision scale1_lhe(fks_configs),scale2_lhe(fks_configs)
3534- common/cto_LHE1/iSorH_lhe,ifks_lhe,jfks_lhe,
3535- # fksfather_lhe,ipartner_lhe
3536- common/cto_LHE2/scale1_lhe,scale2_lhe
3537-
3538-c Radiation hardness needed (pt_hardness) for the theta function
3539-c Should be zero if there are no jets at the Born
3540- double precision shower_S_scale(fks_configs*2)
3541- & ,shower_H_scale(fks_configs*2),ref_H_scale(fks_configs*2)
3542- & ,pt_hardness
3543- common /cshowerscale2/shower_S_scale,shower_H_scale,ref_H_scale
3544- & ,pt_hardness
3545-
3546- double precision becl,delta
3547-c alsf and besf are the parameters that control gfunsoft
3548- double precision alsf,besf
3549- common/cgfunsfp/alsf,besf
3550-c alazi and beazi are the parameters that control gfunazi
3551- double precision alazi,beazi
3552- common/cgfunazi/alazi,beazi
3553-
3554-c Particle types (=color) of i_fks, j_fks and fks_mother
3555- integer i_type,j_type,m_type
3556- double precision ch_i,ch_j,ch_m
3557- common/cparticle_types/i_type,j_type,m_type,ch_i,ch_j,ch_m
3558-
3559-C stuff to keep track of the individual orders
3560- double precision amp_split_bornbars(amp_split_size,max_bcol,nsplitorders),
3561- $ amp_split_bornbarstilde(amp_split_size,max_bcol,nsplitorders)
3562- common /to_amp_split_bornbars/amp_split_bornbars,
3563- $ amp_split_bornbarstilde
3564- double precision amp_split_bornred(amp_split_size,nsplitorders),
3565- $ amp_split_bornredtilde(amp_split_size,nsplitorders),
3566- & amp_split_xmcxsec(amp_split_size,nexternal)
3567- common /to_amp_split_xmcxsec/amp_split_xmcxsec
3568- integer iamp
3569- double precision amp_split_mc(amp_split_size)
3570- common /to_amp_split_mc/amp_split_mc
3571-
3572- double precision zero,one,tiny,vtiny,ymin
3573- parameter (zero=0d0)
3574- parameter (one=1d0)
3575- parameter (vtiny=1d-10)
3576- parameter (ymin=0.9d0)
3577-
3578- double precision pi
3579- parameter(pi=3.1415926535897932384626433d0)
3580-
3581- double precision vcf,vtf,vca
3582- parameter (vcf=4d0/3d0)
3583- parameter (vtf=1d0/2d0)
3584- parameter (vca=3d0)
3585-
3586- double precision pmass(nexternal)
3587- include "pmass.inc"
3588-
3589-c Initialise
3590-
3591- if (split_type(QED_pos)) then
3592- ! QED partners are dynamically found
3593- call find_ipartner_QED(pp,nofpartners)
3594- endif
3595-
3596- do i = 1,nexternal
3597- xmcxsec(i) = 0d0
3598- do iamp = 1, amp_split_size
3599- amp_split_xmcxsec(iamp,i) = 0d0
3600- enddo
3601- enddo
3602- flagmc = .false.
3603- wgt = 0d0
3604- ztmp = 0d0
3605- xitmp = 0d0
3606- xjactmp = 0d0
3607- gfactazi = 0d0
3608- do i = 1,2
3609- xkern(i) = 0d0
3610- xkernazi(i) = 0d0
3611- enddo
3612- do i = 1, nsplitorders
3613- born_red(i) = 0d0
3614- born_red_tilde(i) = 0d0
3615- enddo
3616- do iamp = 1, amp_split_size
3617- amp_split_mc(iamp)=0d0
3618- enddo
3619- kn = veckn_ev
3620- knbar = veckbarn_ev
3621- kn0 = xp0jfks
3622- nofpartners = ipartners(0)
3623- tiny = 1d-6
3624- if (softtest.or.colltest)tiny = 1d-12
3625-c Logical variables to control the IR limits:
3626-c one can remove any reference to xi_i_fks
3627- limit = 1-y_ij_fks.lt.tiny .and. xi_i_fks.ge.tiny
3628- non_limit = xi_i_fks.ge.tiny
3629-
3630-c Discard if unphysical kinematics
3631- if(pp(0,1).le.0d0)return
3632-
3633-c Determine invariants, ileg, and MC hardness qMC
3634- extra=dampMCsubt.or.AddInfoLHE.or.UseSudakov
3635- call kinematics_driver(xi_i_fks,y_ij_fks,shat,pp,ileg,
3636- & xm12,xm22,tk,uk,q1q,q2q,qMC,extra)
3637- w1=-q1q+q2q-tk
3638- w2=-q2q+q1q-uk
3639- if(extra.and.qMC.lt.0d0)then
3640- write(*,*)'Error in xmcsubt: qMC=',qMC
3641- stop
3642- endif
3643-
3644-c Check ileg, and special case for PYTHIA6PT
3645- if(ileg.lt.0.or.ileg.gt.4)then
3646- write(*,*)'Error in xmcsubt: ileg=',ileg
3647- stop
3648- endif
3649- if(ileg.gt.2.and.shower_mc.eq.'PYTHIA6PT')then
3650- write(*,*)'FSR not allowed when matching PY6PT'
3651- stop
3652- endif
3653-
3654-c New or standard MC@NLO formulation
3655- probne=bogus_probne_fun(qMC)
3656- if(.not.UseSudakov)probne=1.d0
3657-
3658-c Call barred Born and assign shower scale
3659- call get_mbar(pp,y_ij_fks,ileg,bornbars,bornbarstilde)
3660- call assign_emsca(pp,xi_i_fks,y_ij_fks)
3661-
3662-c Distinguish ISR and FSR
3663- if(ileg.le.2)then
3664- delta=min(1d0,deltaI)
3665- yj=0d0
3666- yi=y_ij_fks
3667- elseif(ileg.ge.3)then
3668- delta=min(1d0,deltaO)
3669- yj=y_ij_fks
3670- yi=0d0
3671- endif
3672- x=1-xi_i_fks
3673- s=shat
3674- xij=2*(1-xm12/s-(1-x))/(2-(1-x)*(1-yj))
3675-
3676-c G-function parameters
3677- gfactsf=gfunction(x,alsf,besf,2d0)
3678- if(abs(i_type).eq.3)gfactsf=1d0
3679- becl=-(1d0-ymin)
3680- gfactcl=gfunction(y_ij_fks,alsf,becl,1d0)
3681- if(alazi.lt.0d0)gfactazi=1-gfunction(y_ij_fks,-alazi,beazi,delta)
3682-
3683-c For processes that have jets at the Born level, we need to include a
3684-c theta-function: The radiation from the shower should always be softer
3685-c than the jets at the Born, hence no need to include the MC counter
3686-c terms when the radiation is hard.
3687- if(pt_hardness.gt.shower_S_scale(nFKSprocess*2-1))then
3688- emsca=2d0*sqrt(ebeam(1)*ebeam(2))
3689- return
3690- endif
3691-
3692-c Shower variables
3693- if(shower_mc.eq.'HERWIGPP')then
3694- ztmp=zHWPP(ileg,xm12,xm22,shat,x,yi,yj,tk,uk,q1q,q2q)
3695- xitmp=xiHWPP(ileg,xm12,xm22,shat,x,yi,yj,tk,uk,q1q,q2q)
3696- xjactmp=xjacHWPP_xiztoxy(ileg,xm12,xm22,shat,x,yi,yj,tk,uk,q1q,q2q)
3697- elseif(shower_mc.eq.'PYTHIA6Q')then
3698- ztmp=zPY6Q(ileg,xm12,xm22,shat,x,yi,yj,tk,uk,q1q,q2q)
3699- xitmp=xiPY6Q(ileg,xm12,xm22,shat,x,yi,yj,tk,uk,q1q,q2q)
3700- xjactmp=xjacPY6Q_xiztoxy(ileg,xm12,xm22,shat,x,yi,yj,tk,uk,q1q,q2q)
3701- elseif(shower_mc.eq.'PYTHIA6PT')then
3702- ztmp=zPY6PT(ileg,xm12,xm22,shat,x,yi,yj,tk,uk,q1q,q2q)
3703- xitmp=xiPY6PT(ileg,xm12,xm22,shat,x,yi,yj,tk,uk,q1q,q2q)
3704- xjactmp=xjacPY6PT_xiztoxy(ileg,xm12,xm22,shat,x,yi,yj,tk,uk,q1q,q2q)
3705- elseif(shower_mc.eq.'PYTHIA8')then
3706- ztmp=zPY8(ileg,xm12,xm22,shat,x,yi,yj,tk,uk,q1q,q2q)
3707- xitmp=xiPY8(ileg,xm12,xm22,shat,x,yi,yj,tk,uk,q1q,q2q)
3708- xjactmp=xjacPY8_xiztoxy(ileg,xm12,xm22,shat,x,yi,yj,tk,uk,q1q,q2q)
3709- endif
3710-
3711-c Main loop over colour partners
3712- do npartner=1,ipartners(0)
3713-
3714- E0sq(npartner)=dot(p_born(0,fksfather),p_born(0,ipartners(npartner)))
3715- if(E0sq(npartner).lt.0d0)then
3716- write(*,*)'Error in xmcsubt: negative E0sq'
3717- write(*,*)E0sq(npartner),ileg,npartner
3718- stop
3719- endif
3720-
3721- z(npartner)=ztmp
3722- xi(npartner)=xitmp
3723- xjac(npartner)=xjactmp
3724- if(shower_mc.eq.'HERWIG6')then
3725- z(npartner)=zHW6(ileg,E0sq(npartner),xm12,xm22,shat,x,yi,yj,tk,uk,q1q,q2q)
3726- xi(npartner)=xiHW6(ileg,E0sq(npartner),xm12,xm22,shat,x,yi,yj,tk,uk,q1q,q2q)
3727- xjac(npartner)=xjacHW6_xiztoxy(ileg,E0sq(npartner),xm12,xm22,shat,x,yi,yj,
3728- & tk,uk,q1q,q2q)
3729- endif
3730-
3731-c Compute dead zones
3732- call get_dead_zone(ileg,z(npartner),xi(npartner),s,x,yi,xm12,xm22,w1,w2,qMC,
3733- & scalemax,ipartners(npartner),fksfather,lzone(npartner),wcc)
3734-
3735-c Compute MC subtraction terms
3736- if(lzone(npartner))then
3737- if(.not.flagmc)flagmc=.true.
3738- if( (ileg.ge.3 .and. (m_type.eq.8.or.(m_type.eq.1.and.dabs(ch_m).lt.tiny))) .or.
3739- & (ileg.le.2 .and. (j_type.eq.8.or.(j_type.eq.1.and.dabs(ch_j).lt.tiny))) )then
3740- if(i_type.eq.8)then
3741-c g->gg, go->gog (icode=1)
3742- if(ileg.le.2)then
3743- N_p=2
3744- if(isspecial)N_p=1
3745- if(limit)then
3746- xkern(1)=(g**2/N_p)*8*vca*(1-x*(1-x))**2/(s*x**2)
3747- xkernazi(1)=-(g**2/N_p)*16*vca*(1-x)**2/(s*x**2)
3748- xkern(2)=0d0
3749- xkernazi(2)=0d0
3750- elseif(non_limit)then
3751- xfact=(1-yi)*(1-x)/x
3752- prefact=4/(s*N_p)
3753- call AP_reduced(m_type,i_type,ch_m,ch_i,one,z(npartner),ap)
3754- do i=1,2
3755- ap(i)=ap(i)/(1-z(npartner))
3756- xkern(i)=prefact*xfact*xjac(npartner)*ap(i)/xi(npartner)
3757- enddo
3758- call Qterms_reduced_spacelike(m_type,i_type,ch_m,ch_i,one,z(npartner),Q)
3759- do i=1,2
3760- Q(i)=Q(i)/(1-z(npartner))
3761- xkernazi(i)=prefact*xfact*xjac(npartner)*Q(i)/xi(npartner)
3762- enddo
3763- if (xkern(2).ne.0d0 .or.xkernazi(2).ne.0d0) then
3764- write(*,*) 'ERROR#1, g->gg splitting QED'
3765- % //'contributions should be 0', xkern, xkernazi
3766- stop
3767- endif
3768- endif
3769-c
3770- elseif(ileg.eq.3)then
3771- N_p=2
3772- if(isspecial)N_p=1
3773- if(non_limit)then
3774- xfact=(2-(1-x)*(1-(kn0/kn)*yj))/kn*knbar*(1-x)*(1-yj)
3775- prefact=2/(s*N_p)
3776- call AP_reduced_SUSY(j_type,i_type,ch_j,ch_i,one,z(npartner),ap)
3777- do i=1,2
3778- ap(i)=ap(i)/(1-z(npartner))
3779- xkern(i)=prefact*xfact*xjac(npartner)*ap(i)/xi(npartner)
3780- enddo
3781- endif
3782-c
3783- elseif(ileg.eq.4)then
3784- N_p=2
3785- if(isspecial)N_p=1
3786- if(limit)then
3787- xkern(1)=(g**2/N_p)*( 8*vca*
3788- & (s**2*(1-(1-x)*x)-s*(1+x)*xm12+xm12**2)**2 )/
3789- & ( s*(s-xm12)**2*(s*x-xm12)**2 )
3790- xkernazi(1)=-(g**2/N_p)*(16*vca*s*(1-x)**2)/((s-xm12)**2)
3791- xkern(2)=0d0
3792- xkernazi(2)=0d0
3793- elseif(non_limit)then
3794- xfact=(2-(1-x)*(1-yj))/xij*(1-xm12/s)*(1-x)*(1-yj)
3795- prefact=2/(s*N_p)
3796- call AP_reduced(j_type,i_type,ch_j,ch_i,one,z(npartner),ap)
3797- do i=1,2
3798- ap(i)=ap(i)/(1-z(npartner))
3799- xkern(i)=prefact*xfact*xjac(npartner)*ap(i)/xi(npartner)
3800- enddo
3801- call Qterms_reduced_timelike(j_type,i_type,ch_j,ch_i,one,z(npartner),Q)
3802- do i=1,2
3803- Q(i)=Q(i)/(1-z(npartner))
3804- xkernazi(i)=prefact*xfact*xjac(npartner)*Q(i)/xi(npartner)
3805- enddo
3806- if (xkern(2).ne.0d0 .or.xkernazi(2).ne.0d0) then
3807- write(*,*) 'ERROR#1, g->gg splitting QED'
3808- % //'contributions should be 0', xkern, xkernazi
3809- stop
3810- endif
3811- endif
3812- endif
3813- elseif(abs(i_type).eq.3.or.(i_type.eq.1.and.dabs(ch_i).gt.tiny))then
3814-c g->qq, a->qq, a->ee (icode=2)
3815- if(ileg.le.2)then
3816- N_p=1
3817- if(limit)then
3818- xkern(1)=(g**2/N_p)*4*vtf*(1-x)*((1-x)**2+x**2)/(s*x)
3819- xkern(2)=xkern(1) * dble(gal(1))**2 / g**2 *
3820- & ch_i**2 * abs(i_type) / vtf
3821- elseif(non_limit)then
3822- xfact=(1-yi)*(1-x)/x
3823- prefact=4/(s*N_p)
3824- call AP_reduced(m_type,i_type,ch_m,ch_i,one,z(npartner),ap)
3825- do i=1,2
3826- ap(i)=ap(i)/(1-z(npartner))
3827- xkern(i)=prefact*xfact*xjac(npartner)*ap(i)/xi(npartner)
3828- enddo
3829- endif
3830-c
3831- elseif(ileg.eq.4)then
3832- N_p=2
3833- if(isspecial)N_p=1
3834- if(limit)then
3835- xkern(1)=(g**2/N_p)*( 4*vtf*(1-x)*
3836- & (s**2*(1-2*(1-x)*x)-2*s*x*xm12+xm12**2) )/
3837- & ( (s-xm12)**2*(s*x-xm12) )
3838- xkern(2)=xkern(1) * dble(gal(1))**2 / g**2 *
3839- & ch_i**2 * abs(i_type) / vtf
3840- xkernazi(1)=(g**2/N_p)*(16*vtf*s*(1-x)**2)/((s-xm12)**2)
3841- xkernazi(2)=xkernazi(1) * dble(gal(1))**2 / g**2 *
3842- & ch_i**2 * abs(i_type) / vtf
3843- elseif(non_limit)then
3844- xfact=(2-(1-x)*(1-yj))/xij*(1-xm12/s)*(1-x)*(1-yj)
3845- prefact=2/(s*N_p)
3846- call AP_reduced(j_type,i_type,ch_j,ch_i,one,z(npartner),ap)
3847- do i=1,2
3848- ap(i)=ap(i)/(1-z(npartner))
3849- xkern(i)=prefact*xfact*xjac(npartner)*ap(i)/xi(npartner)
3850- enddo
3851- call Qterms_reduced_timelike(j_type,i_type,ch_j,ch_i,one,z(npartner),Q)
3852- do i=1,2
3853- Q(i)=Q(i)/(1-z(npartner))
3854- xkernazi(i)=prefact*xfact*xjac(npartner)*Q(i)/xi(npartner)
3855- enddo
3856- endif
3857- endif
3858- else
3859- write(*,*)'Error 1 in xmcsubt: unknown particle type'
3860- write(*,*)i_type
3861- stop
3862- endif
3863- elseif( (ileg.ge.3 .and. (abs(m_type).eq.3.or.(m_type.eq.1.and.dabs(ch_m).gt.tiny))) .or.
3864- & (ileg.le.2 .and. (abs(j_type).eq.3.or.(j_type.eq.1.and.dabs(ch_j).gt.tiny))) )then
3865- if(abs(i_type).eq.3.or.(i_type.eq.1.and.dabs(ch_i).gt.tiny))then
3866-c q->gq, q->aq, e->ae (icode=3)
3867- if(ileg.le.2)then
3868- N_p=2
3869- if(isspecial)N_p=1
3870- if(limit)then
3871- xkern(1)=(g**2/N_p)*4*vcf*(1-x)*((1-x)**2+1)/(s*x**2)
3872- xkern(2)=xkern(1) * (dble(gal(1))**2 / g**2) *
3873- & (ch_i**2 / vcf)
3874- xkernazi(1)=-(g**2/N_p)*16*vcf*(1-x)**2/(s*x**2)
3875- xkernazi(2)=xkernazi(1) * (dble(gal(1))**2 / g**2) *
3876- & (ch_i**2 / vcf)
3877- elseif(non_limit)then
3878- xfact=(1-yi)*(1-x)/x
3879- prefact=4/(s*N_p)
3880- call AP_reduced(m_type,i_type,ch_m,ch_i,one,z(npartner),ap)
3881- do i=1,2
3882- ap(i)=ap(i)/(1-z(npartner))
3883- xkern(i)=prefact*xfact*xjac(npartner)*ap(i)/xi(npartner)
3884- enddo
3885- call Qterms_reduced_spacelike(m_type,i_type,ch_m,ch_i,one,z(npartner),Q)
3886- do i=1,2
3887- Q(i)=Q(i)/(1-z(npartner))
3888- xkernazi(i)=prefact*xfact*xjac(npartner)*Q(i)/xi(npartner)
3889- enddo
3890- endif
3891-c
3892- elseif(ileg.eq.3)then
3893- N_p=1
3894- if(non_limit)then
3895- xfact=(2-(1-x)*(1-(kn0/kn)*yj))/kn*knbar*(1-x)*(1-yj)
3896- prefact=2/(s*N_p)
3897- call AP_reduced(j_type,i_type,ch_j,ch_i,one,z(npartner),ap)
3898- do i=1,2
3899- ap(i)=ap(i)/(1-z(npartner))
3900- xkern(i)=prefact*xfact*xjac(npartner)*ap(i)/xi(npartner)
3901- enddo
3902- endif
3903-c
3904- elseif(ileg.eq.4)then
3905- N_p=1
3906- if(limit)then
3907- xkern(1)=(g**2/N_p)*
3908- & ( 4*vcf*(1-x)*(s**2*(1-x)**2+(s-xm12)**2) )/
3909- & ( (s-xm12)*(s*x-xm12)**2 )
3910- xkern(2)=xkern(1) * (dble(gal(1))**2 / g**2) *
3911- & (ch_i**2 / vcf)
3912- elseif(non_limit)then
3913- xfact=(2-(1-x)*(1-yj))/xij*(1-xm12/s)*(1-x)*(1-yj)
3914- prefact=2/(s*N_p)
3915- call AP_reduced(j_type,i_type,ch_j,ch_i,one,z(npartner),ap)
3916- do i=1,2
3917- ap(i)=ap(i)/(1-z(npartner))
3918- xkern(i)=prefact*xfact*xjac(npartner)*ap(i)/xi(npartner)
3919- enddo
3920- endif
3921- endif
3922- elseif(i_type.eq.8.or.(i_type.eq.1.and.dabs(ch_i).lt.tiny))then
3923-c q->qg, q->qa, sq->sqg, sq->sqa, e->ea (icode=4)
3924- if(ileg.le.2)then
3925- N_p=1
3926- if(limit)then
3927- xkern(1)=(g**2/N_p)*4*vcf*(1+x**2)/(s*x)
3928- xkern(2)=xkern(1) * (dble(gal(1))**2 / g**2) *
3929- & (ch_m**2 / vcf)
3930- elseif(non_limit)then
3931- xfact=(1-yi)*(1-x)/x
3932- prefact=4/(s*N_p)
3933- call AP_reduced(m_type,i_type,ch_m,ch_i,one,z(npartner),ap)
3934- do i=1,2
3935- ap(i)=ap(i)/(1-z(npartner))
3936- xkern(i)=prefact*xfact*xjac(npartner)*ap(i)/xi(npartner)
3937- enddo
3938- endif
3939-c
3940- elseif(ileg.eq.3)then
3941- N_p=1
3942- if(non_limit)then
3943- xfact=(2-(1-x)*(1-(kn0/kn)*yj))/kn*knbar*(1-x)*(1-yj)
3944- prefact=2/(s*N_p)
3945- if(abs(PDG_type(j_fks)).le.6)then
3946- if(shower_mc.ne.'HERWIGPP')
3947- & call AP_reduced(j_type,i_type,ch_j,ch_i,one,z(npartner),ap)
3948- if(shower_mc.eq.'HERWIGPP')
3949- & call AP_reduced_massive(j_type,i_type,ch_j,ch_i,one,z(npartner),
3950- & xi(npartner),xm12,ap)
3951- else
3952- call AP_reduced_SUSY(j_type,i_type,ch_j,ch_i,one,z(npartner),ap)
3953- endif
3954- do i=1,2
3955- ap(i)=ap(i)/(1-z(npartner))
3956- xkern(i)=prefact*xfact*xjac(npartner)*ap(i)/xi(npartner)
3957- enddo
3958- endif
3959-c
3960- elseif(ileg.eq.4)then
3961- N_p=1
3962- if(limit)then
3963- xkern(1)=(g**2/N_p)*4*vcf*
3964- & ( s**2*(1+x**2)-2*xm12*(s*(1+x)-xm12) )/
3965- & ( s*(s-xm12)*(s*x-xm12) )
3966- xkern(2)=xkern(1) * (dble(gal(1))**2 / g**2) *
3967- & (ch_j**2 / vcf)
3968- elseif(non_limit)then
3969- xfact=(2-(1-x)*(1-yj))/xij*(1-xm12/s)*(1-x)*(1-yj)
3970- prefact=2/(s*N_p)
3971- call AP_reduced(j_type,i_type,ch_j,ch_i,one,z(npartner),ap)
3972- do i=1,2
3973- ap(i)=ap(i)/(1-z(npartner))
3974- xkern(i)=prefact*xfact*xjac(npartner)*ap(i)/xi(npartner)
3975- enddo
3976- endif
3977- endif
3978- else
3979- write(*,*)'Error 2 in xmcsubt: unknown particle type'
3980- write(*,*)i_type
3981- stop
3982- endif
3983- else
3984- write(*,*)'Error 3 in xmcsubt: unknown particle type'
3985- write(*,*)j_type,i_type
3986- stop
3987- endif
3988-
3989- if(dampMCsubt)then
3990- if(emscasharp)then
3991- if(qMC.le.scalemax)then
3992- emscwgt(npartner)=1d0
3993- emscav(npartner)=emsca_bare
3994- else
3995- emscwgt(npartner)=0d0
3996- emscav(npartner)=scalemax
3997- endif
3998- else
3999- ptresc=(qMC-scalemin)/(scalemax-scalemin)
4000- if(ptresc.le.0d0)then
4001- emscwgt(npartner)=1d0
4002- emscav(npartner)=emsca_bare
4003- elseif(ptresc.lt.1d0)then
4004- emscwgt(npartner)=1-emscafun(ptresc,one)
4005- emscav(npartner)=emsca_bare
4006- else
4007- emscwgt(npartner)=0d0
4008- emscav(npartner)=scalemax
4009- endif
4010- endif
4011- endif
4012-
4013- else
4014-c Dead zone
4015- do i = 1,2
4016- xkern(i)=0d0
4017- xkernazi(i)=0d0
4018- enddo
4019- if(dampMCsubt)then
4020- emscav(npartner)=2d0*sqrt(ebeam(1)*ebeam(2))
4021- emscwgt(npartner)=0d0
4022- endif
4023- endif
4024-
4025- !
4026- ! remember, we are still in the npartner = 1, ipartners(0) loop
4027- !
4028- do iamp = 1, amp_split_size
4029- do i = 1,nsplitorders
4030- amp_split_bornred(iamp,i)=0d0
4031- amp_split_bornredtilde(iamp,i)=0d0
4032- enddo
4033- enddo
4034- do i = 1,nsplitorders
4035- born_red(i)=0d0
4036- born_red_tilde(i)=0d0
4037- enddo
4038-
4039- do i=1,2
4040- xkern(i)=xkern(i)*gfactsf*wcc
4041- xkernazi(i)=xkernazi(i)*gfactazi*gfactsf*wcc
4042- enddo
4043- do cflows=1,colorflow(npartner,0)
4044- do iord = 1, nsplitorders
4045- born_red(iord)=born_red(iord)+bornbars(colorflow(npartner,cflows),iord)
4046- born_red_tilde(iord)=born_red_tilde(iord)+bornbarstilde(colorflow(npartner,cflows),iord)
4047- do iamp=1,amp_split_size
4048- amp_split_bornred(iamp,iord)=amp_split_bornred(iamp,iord)+
4049- & amp_split_bornbars(iamp,colorflow(npartner,cflows),iord)
4050- amp_split_bornredtilde(iamp,iord)=amp_split_bornredtilde(iamp,iord)+
4051- & amp_split_bornbarstilde(iamp,colorflow(npartner,cflows),iord)
4052- enddo
4053- enddo
4054- enddo
4055-
4056-c check the lines below
4057- do iord = 1, nsplitorders
4058- if (.not.split_type(iord).or.(iord.ne.qed_pos.and.iord.ne.qcd_pos)) cycle
4059- if (iord.eq.qcd_pos) then
4060- xmcxsec(npartner) =
4061- & xkern(1)*born_red(iord)+xkernazi(1)*born_red_tilde(iord)
4062- do iamp=1,amp_split_size
4063- amp_split_xmcxsec(iamp,npartner) =
4064- & xkern(1)*amp_split_bornred(iamp,iord) +
4065- & xkernazi(1)*amp_split_bornredtilde(iamp,iord)
4066- enddo
4067- else if(iord.eq.qed_pos) then
4068- xmcxsec(npartner) =
4069- & xkern(2)*born_red(iord)+xkernazi(2)*born_red_tilde(iord)
4070- do iamp=1,amp_split_size
4071- amp_split_xmcxsec(iamp,npartner) =
4072- & xkern(2)*amp_split_bornred(iamp,iord) +
4073- & xkernazi(2)*amp_split_bornredtilde(iamp,iord)
4074- enddo
4075- endif
4076- enddo
4077- if (dampMCsubt) then
4078- xmcxsec(npartner)=xmcxsec(npartner)*emscwgt(npartner)
4079- do iamp=1,amp_split_size
4080- amp_split_xmcxsec(iamp,npartner) = amp_split_xmcxsec(iamp,npartner)*emscwgt(npartner)
4081- enddo
4082- endif
4083-
4084- wgt=wgt+xmcxsec(npartner)
4085- do iamp=1,amp_split_size
4086- amp_split_mc(iamp)=amp_split_mc(iamp)+amp_split_xmcxsec(iamp,npartner)
4087- enddo
4088-
4089- if(xmcxsec(npartner).lt.0d0)then
4090- write(*,*)'Fatal error in xmcsubt'
4091- write(*,*)npartner,xmcxsec(npartner)
4092- stop
4093- endif
4094-c End of loop over colour partners
4095- enddo
4096-
4097-c Assign emsca on statistical basis
4098- if(dampMCsubt.and.wgt.gt.1d-30)then
4099- rrnd=ran2()
4100- wgt1=0d0
4101- jpartner=0
4102- do npartner=1,ipartners(0)
4103- if(lzone(npartner).and.jpartner.eq.0)then
4104- wgt1=wgt1+xmcxsec(npartner)
4105- if(wgt1.ge.rrnd*wgt)then
4106- jpartner=ipartners(npartner)
4107- mpartner=npartner
4108- endif
4109- endif
4110- enddo
4111- if(jpartner.eq.0)then
4112- write(*,*)'Error in xmcsubt: emsca unweighting failed'
4113- stop
4114- else
4115- emsca=emscav(mpartner)
4116- endif
4117- endif
4118- if(dampMCsubt.and.wgt.lt.1d-30)emsca=scalemax
4119-
4120-c Additional information for LHE
4121- if(AddInfoLHE)then
4122- fksfather_lhe(nFKSprocess)=fksfather
4123- if(jpartner.ne.0)then
4124- ipartner_lhe(nFKSprocess)=jpartner
4125- else
4126-c min() avoids troubles if ran2()=1
4127- ipartner_lhe(nFKSprocess)=min( int(ran2()*ipartners(0))+1,ipartners(0) )
4128- ipartner_lhe(nFKSprocess)=ipartners(ipartner_lhe(nFKSprocess))
4129- endif
4130- scale1_lhe(nFKSprocess)=qMC
4131- endif
4132-
4133- if(dampMCsubt)then
4134- if(emsca.lt.scalemin)then
4135- write(*,*)'Error in xmcsubt: emsca too small'
4136- write(*,*)emsca,jpartner,lzone(jpartner)
4137- stop
4138- endif
4139- endif
4140-
4141- do i=1,nexternal
4142- if (i.le.ipartners(0)) then
4143- xmcxsec(i)=xmcxsec(i)*probne
4144- do iamp = 1, amp_split_size
4145- amp_split_xmcxsec(iamp,i)=amp_split_xmcxsec(iamp,i)*probne
4146- enddo
4147- else
4148- xmcxsec(i)=0d0
4149- do iamp = 1, amp_split_size
4150- amp_split_xmcxsec(iamp,i)=0d0
4151- enddo
4152- endif
4153- enddo
4154-
4155- return
4156- end
4157-
4158-
4159-
4160- subroutine get_mbar(p,y_ij_fks,ileg,bornbars,bornbarstilde)
4161-c Computes barred amplitudes (bornbars) squared according
4162-c to Odagiri's prescription (hep-ph/9806531).
4163-c Computes barred azimuthal amplitudes (bornbarstilde) with
4164-c the same method
4165- implicit none
4166-
4167- include "genps.inc"
4168- include "nexternal.inc"
4169- include "born_nhel.inc"
4170- include "orders.inc"
4171-
4172- double precision p(0:3,nexternal)
4173- double precision y_ij_fks,bornbars(max_bcol,nsplitorders),
4174- & bornbarstilde(max_bcol,nsplitorders)
4175-
4176- double precision zero
4177- parameter (zero=0.d0)
4178- double complex czero
4179- parameter (czero=dcmplx(0d0,0d0))
4180- double precision p_born_rot(0:3,nexternal-1)
4181-
4182- integer imother_fks,ileg
4183-
4184- double precision p_born(0:3,nexternal-1)
4185- common/pborn/p_born
4186-
4187- double Precision amp2(ngraphs), jamp2(0:ncolor)
4188- common/to_amps/ amp2, jamp2
4189-
4190- integer i_fks,j_fks
4191- common/fks_indices/i_fks,j_fks
4192-
4193- double precision wgt_born
4194- double complex W1(6),W2(6),W3(6),W4(6),Wij_angle,Wij_recta
4195- double complex azifact
4196-
4197- double complex xij_aor
4198- common/cxij_aor/xij_aor
4199-
4200- double precision sumborn
4201- integer i
4202-
4203- double precision vtiny,pi(0:3),pj(0:3),cphi_mother,sphi_mother
4204- parameter (vtiny=1d-12)
4205- double complex ximag
4206- parameter (ximag=(0.d0,1.d0))
4207-
4208- double precision xi_i_fks_ev,y_ij_fks_ev,t
4209- double precision p_i_fks_ev(0:3),p_i_fks_cnt(0:3,-2:2)
4210- common/fksvariables/xi_i_fks_ev,y_ij_fks_ev,p_i_fks_ev,p_i_fks_cnt
4211-
4212- double precision cthbe,sthbe,cphibe,sphibe
4213- common/cbeangles/cthbe,sthbe,cphibe,sphibe
4214-
4215- logical calculatedBorn
4216- common/ccalculatedBorn/calculatedBorn
4217- double precision iden_comp
4218- common /c_iden_comp/iden_comp
4219-
4220-c Particle types (=color) of i_fks, j_fks and fks_mother
4221- integer i_type,j_type,m_type
4222- double precision ch_i,ch_j,ch_m
4223- common/cparticle_types/i_type,j_type,m_type,ch_i,ch_j,ch_m
4224-
4225- double precision born(nsplitorders)
4226- double complex borntilde(nsplitorders)
4227- logical split_type(nsplitorders)
4228- common /c_split_type/split_type
4229- complex*16 ans_cnt(2, nsplitorders), wgt1(2)
4230- common /c_born_cnt/ ans_cnt
4231- double complex ans_extra_cnt(2,nsplitorders)
4232- integer iord, iextra_cnt, isplitorder_born, isplitorder_cnt
4233- common /c_extra_cnt/iextra_cnt, isplitorder_born, isplitorder_cnt
4234-
4235- integer iamp
4236- double precision amp_split_born(amp_split_size,nsplitorders)
4237- double complex amp_split_borntilde(amp_split_size,nsplitorders)
4238- double precision amp_split_bornbars(amp_split_size,max_bcol,nsplitorders),
4239- $ amp_split_bornbarstilde(amp_split_size,max_bcol,nsplitorders)
4240- common /to_amp_split_bornbars/amp_split_bornbars,
4241- $ amp_split_bornbarstilde
4242-
4243-
4244-c
4245- logical is_leading_cflow(max_bcol)
4246- integer num_leading_cflows
4247- common/c_leading_cflows/is_leading_cflow,num_leading_cflows
4248-
4249-c
4250-C BORN/BORNTILDE
4251-
4252-C check if momenta have to be rotated
4253-
4254- if ((ileg.eq.1.or.ileg.eq.2).and.(j_fks.eq.2 .and. nexternal-1.ne.3)) then
4255-c Rotation according to innerpin.m. Use rotate_invar() if a more
4256-c general rotation is needed.
4257-c Exclude 2->1 (at the Born level) processes: matrix elements are
4258-c independent of the PS point, but non-zero helicity configurations
4259-c might flip when rotating the momenta.
4260- do i=1,nexternal-1
4261- p_born_rot(0,i)=p_born(0,i)
4262- p_born_rot(1,i)=-p_born(1,i)
4263- p_born_rot(2,i)=p_born(2,i)
4264- p_born_rot(3,i)=-p_born(3,i)
4265- enddo
4266- calculatedBorn=.false.
4267- call sborn(p_born_rot,wgt_born)
4268- if (iextra_cnt.gt.0) call extra_cnt(p_born_rot, iextra_cnt, ans_extra_cnt)
4269- calculatedBorn=.false.
4270- else
4271- call sborn(p_born,wgt_born)
4272- if (iextra_cnt.gt.0) call extra_cnt(p_born, iextra_cnt, ans_extra_cnt)
4273- endif
4274-
4275- do iord = 1, nsplitorders
4276- if (.not.split_type(iord).or.(iord.ne.qed_pos.and.iord.ne.qcd_pos)) cycle
4277-C check if any extra_cnt is needed
4278- if (iextra_cnt.gt.0) then
4279- write(*,*) 'FIXEXTRACNTMC'
4280- stop
4281- if (iord.eq.isplitorder_born) then
4282- ! this is the contribution from the born ME
4283- wgt1(1) = ans_cnt(1,iord)
4284- wgt1(2) = ans_cnt(2,iord)
4285- else if (iord.eq.isplitorder_cnt) then
4286- ! this is the contribution from the extra cnt
4287- wgt1(1) = ans_extra_cnt(1,iord)
4288- wgt1(2) = ans_extra_cnt(2,iord)
4289- else
4290- write(*,*) 'ERROR in sborncol_isr', iord
4291- stop
4292- endif
4293- else
4294- wgt1(1) = ans_cnt(1,iord)
4295- wgt1(2) = ans_cnt(2,iord)
4296- endif
4297- if (abs(m_type).eq.3.or.dabs(ch_m).gt.0d0) wgt1(2) = czero
4298- born(iord) = dble(wgt1(1))
4299- borntilde(iord) = wgt1(2)
4300- do iamp=1, amp_split_size
4301- amp_split_born(iamp,iord) = dble(amp_split_cnt(iamp,1,iord))
4302- if (abs(m_type).eq.3.or.dabs(ch_m).gt.0d0) then
4303- amp_split_borntilde(iamp,iord) = czero
4304- else
4305- amp_split_borntilde(iamp,iord) = amp_split_cnt(iamp,2,iord)
4306- endif
4307- enddo
4308- enddo
4309-
4310-c BORN TILDE
4311- if(ileg.eq.1.or.ileg.eq.2)then
4312-c Insert <ij>/[ij] which is not included by sborn()
4313- if (1d0-y_ij_fks.lt.vtiny)then
4314- azifact=xij_aor
4315- else
4316- do i=0,3
4317- pi(i)=p_i_fks_ev(i)
4318- pj(i)=p(i,j_fks)
4319- enddo
4320- if(j_fks.eq.2)then
4321-c Rotation according to innerpin.m. Use rotate_invar() if a more
4322-c general rotation is needed
4323- pi(1)=-pi(1)
4324- pi(3)=-pi(3)
4325- pj(1)=-pj(1)
4326- pj(3)=-pj(3)
4327- endif
4328- CALL IXXXSO(pi ,ZERO ,+1,+1,W1)
4329- CALL OXXXSO(pj ,ZERO ,-1,+1,W2)
4330- CALL IXXXSO(pi ,ZERO ,-1,+1,W3)
4331- CALL OXXXSO(pj ,ZERO ,+1,+1,W4)
4332- Wij_angle=(0d0,0d0)
4333- Wij_recta=(0d0,0d0)
4334- do i=1,4
4335- Wij_angle = Wij_angle + W1(i)*W2(i)
4336- Wij_recta = Wij_recta + W3(i)*W4(i)
4337- enddo
4338- azifact=Wij_angle/Wij_recta
4339- endif
4340-c Insert the extra factor due to Madgraph convention for polarization vectors
4341- if(j_fks.eq.2)then
4342- cphi_mother=-1.d0
4343- sphi_mother=0.d0
4344- else
4345- cphi_mother=1.d0
4346- sphi_mother=0.d0
4347- endif
4348- do iord=1, nsplitorders
4349- borntilde(iord) = -(cphi_mother+ximag*sphi_mother)**2 *
4350- # borntilde(iord) * dconjg(azifact)
4351- do iamp=1, amp_split_size
4352- amp_split_borntilde(iamp,iord) = -(cphi_mother+ximag*sphi_mother)**2 *
4353- # amp_split_borntilde(iamp,iord) * dconjg(azifact)
4354- enddo
4355- enddo
4356- elseif(ileg.eq.3.or.ileg.eq.4)then
4357- if((abs(j_type).eq.3.or.ch_j.ne.0d0).and.
4358- & (i_type.eq.8.or.i_type.eq.1).and.
4359- & ch_i.eq.0d0)then
4360- do iord=1, nsplitorders
4361- borntilde(iord)=czero
4362- do iamp=1, amp_split_size
4363- amp_split_borntilde(iamp,iord) = czero
4364- enddo
4365- enddo
4366- elseif((m_type.eq.8.or.m_type.eq.1).and.ch_m.eq.0d0)then
4367-c Insert <ij>/[ij] which is not included by sborn()
4368- if(1.d0-y_ij_fks.lt.vtiny)then
4369- azifact=xij_aor
4370- else
4371- do i=0,3
4372- pi(i)=p_i_fks_ev(i)
4373- pj(i)=p(i,j_fks)
4374- enddo
4375- CALL IXXXSO(pi ,ZERO ,+1,+1,W1)
4376- CALL OXXXSO(pj ,ZERO ,-1,+1,W2)
4377- CALL IXXXSO(pi ,ZERO ,-1,+1,W3)
4378- CALL OXXXSO(pj ,ZERO ,+1,+1,W4)
4379- Wij_angle=(0d0,0d0)
4380- Wij_recta=(0d0,0d0)
4381- do i=1,4
4382- Wij_angle = Wij_angle + W1(i)*W2(i)
4383- Wij_recta = Wij_recta + W3(i)*W4(i)
4384- enddo
4385- azifact=Wij_angle/Wij_recta
4386- endif
4387-c Insert the extra factor due to Madgraph convention for polarization vectors
4388- imother_fks=min(i_fks,j_fks)
4389- call getaziangles(p_born(0,imother_fks),
4390- # cphi_mother,sphi_mother)
4391- do iord=1, nsplitorders
4392- borntilde(iord) = -(cphi_mother-ximag*sphi_mother)**2 *
4393- # borntilde(iord) * azifact
4394- do iamp=1, amp_split_size
4395- amp_split_borntilde(iamp,iord) = -(cphi_mother-ximag*sphi_mother)**2 *
4396- # amp_split_borntilde(iamp,iord) * azifact
4397- enddo
4398- enddo
4399- else
4400- write(*,*)'FATAL ERROR in get_mbar',
4401- # i_type,j_type,i_fks,j_fks
4402- stop
4403- endif
4404- else
4405- write(*,*)'unknown ileg in get_mbar'
4406- stop
4407- endif
4408-
4409-CMZ! this has to be all changed according to the correct jamps
4410-
4411-c born is the total born amplitude squared
4412- sumborn=0.d0
4413- do i=1,max_bcol
4414- if(is_leading_cflow(i))sumborn=sumborn+jamp2(i)
4415-c sumborn is the sum of the leading-color amplitudes squared
4416- enddo
4417-
4418-
4419-c BARRED AMPLITUDES
4420- do i=1,max_bcol
4421- do iord=1,nsplitorders
4422- if (sumborn.ne.0d0.and.is_leading_cflow(i)) then
4423- bornbars(i,iord)=jamp2(i)/sumborn * born(iord) *iden_comp
4424- do iamp=1,amp_split_size
4425- amp_split_bornbars(iamp,i,iord)=jamp2(i)/sumborn *
4426- & amp_split_born(iamp,iord) *iden_comp
4427- enddo
4428- elseif (born(iord).eq.0d0 .or. jamp2(i).eq.0d0
4429- & .or..not.is_leading_cflow(i)) then
4430- bornbars(i,iord)=0d0
4431- do iamp=1,amp_split_size
4432- amp_split_bornbars(iamp,i,iord)=0d0
4433- enddo
4434- else
4435- write (*,*) 'ERROR #1, dividing by zero'
4436- stop
4437- endif
4438- if (sumborn.ne.0d0.and.is_leading_cflow(i)) then
4439- bornbarstilde(i,iord)=jamp2(i)/sumborn * dble(borntilde(iord)) *iden_comp
4440- do iamp=1,amp_split_size
4441- amp_split_bornbarstilde(iamp,i,iord)=jamp2(i)/sumborn *
4442- & dble(amp_split_borntilde(iamp,iord)) *iden_comp
4443- enddo
4444- elseif (borntilde(iord).eq.0d0 .or. jamp2(i).eq.0d0
4445- & .or..not.is_leading_cflow(i)) then
4446- bornbarstilde(i,iord)=0d0
4447- do iamp=1,amp_split_size
4448- amp_split_bornbarstilde(iamp,i,iord)=0d0
4449- enddo
4450- else
4451- write (*,*) 'ERROR #2, dividing by zero'
4452- stop
4453- endif
4454-c bornbars(i) is the i-th leading-color amplitude squared re-weighted
4455-c in such a way that the sum of bornbars(i) is born rather than sumborn.
4456-c the same holds for bornbarstilde(i).
4457- enddo
4458- enddo
4459-
4460- return
4461- end
4462-
4463-
4464-
4465- function gfunction(w,alpha,beta,delta)
4466-c Gets smoothly to 0 as w goes to 1
4467- implicit none
4468- double precision gfunction,alpha,beta,delta,w,wmin,wg,tt,tmp
4469-
4470- if(beta.lt.0d0)then
4471- wmin=0d0
4472- else
4473- wmin=max(0d0,1d0-delta)
4474- endif
4475- wg=min(1d0-(1-wmin)*abs(beta),0.99d0)
4476- tt=(abs(w)-wg)/(1d0-wg)
4477- if(tt.gt.1d0)then
4478- write(*,*)'Fatal error in gfunction',tt
4479- stop
4480- endif
4481- tmp=1d0
4482- if(alpha.gt.0d0)then
4483- if(tt.gt.0d0.and.abs(w).lt.0.99d0)
4484- & tmp=(1-tt)**(2*alpha)/(tt**(2*alpha)+(1-tt)**(2*alpha))
4485- if(abs(w).ge.0.99d0)tmp=0d0
4486- endif
4487- gfunction=tmp
4488- return
4489- end
4490-
4491-
4492-
4493- subroutine kinematics_driver(xi_i_fks,y_ij_fks,sh,pp,ileg,
4494- & xm12,xm22,xtk,xuk,xq1q,xq2q,qMC,extra)
4495-c Determines Mandelstam invariants and assigns ileg and shower-damping
4496-c variable qMC
4497- implicit none
4498- include "nexternal.inc"
4499- include "coupl.inc"
4500- include "run.inc"
4501- double precision pp(0:3,nexternal),pp_rec(0:3)
4502- double precision xi_i_fks,y_ij_fks,xij
4503-
4504- integer ileg,j,i,nfinal
4505- double precision xp1(0:3),xp2(0:3),xk1(0:3),xk2(0:3),xk3(0:3)
4506- common/cpkmomenta/xp1,xp2,xk1,xk2,xk3
4507- double precision sh,xtk,xuk,w1,w2,xq1q,xq2q,xm12,xm22
4508- double precision qMC,zPY8,zeta1,zeta2,get_zeta,z,qMCarg,dot
4509- logical extra
4510- double precision p_born(0:3,nexternal-1)
4511- common/pborn/p_born
4512- integer fksfather
4513- common/cfksfather/fksfather
4514- integer i_fks,j_fks
4515- common/fks_indices/i_fks,j_fks
4516- double precision tiny
4517- parameter(tiny=1d-5)
4518- double precision zero
4519- parameter(zero=0d0)
4520-
4521- integer isqrtneg
4522- save isqrtneg
4523-
4524- double precision pmass(nexternal)
4525- include "pmass.inc"
4526-
4527-c Initialise
4528- do i=0,3
4529- pp_rec(i)=0d0
4530- xp1(i)=0d0
4531- xp2(i)=0d0
4532- xk1(i)=0d0
4533- xk2(i)=0d0
4534- xk3(i)=0d0
4535- enddo
4536- nfinal=nexternal-2
4537- xm12=0d0
4538- xm22=0d0
4539- xq1q=0d0
4540- xq2q=0d0
4541- qMC=-1d0
4542-
4543-c Discard if unphysical FKS variables
4544- if(xi_i_fks.lt.0d0.or.xi_i_fks.gt.1d0.or.
4545- & abs(y_ij_fks).gt.1d0)then
4546- write(*,*)'Error 0 in kinematics_driver: fks variables'
4547- write(*,*)xi_i_fks,y_ij_fks
4548- stop
4549- endif
4550-
4551-c Determine ileg
4552-c ileg = 1 ==> emission from left incoming parton
4553-c ileg = 2 ==> emission from right incoming parton
4554-c ileg = 3 ==> emission from massive outgoing parton
4555-c ileg = 4 ==> emission from massless outgoing parton
4556-c Instead of pmass(j_fks), one should use pmass(fksfather), but the
4557-c kernels where pmass(fksfather) != pmass(j_fks) are non-singular
4558- if(fksfather.le.2)then
4559- ileg=fksfather
4560- elseif(pmass(j_fks).ne.0d0)then
4561- ileg=3
4562- elseif(pmass(j_fks).eq.0d0)then
4563- ileg=4
4564- else
4565- write(*,*)'Error 1 in kinematics_driver: unknown ileg'
4566- write(*,*)ileg,fksfather,pmass(j_fks)
4567- stop
4568- endif
4569-
4570-c Determine and assign momenta:
4571-c xp1 = incoming left parton (emitter (recoiler) if ileg = 1 (2))
4572-c xp2 = incoming right parton (emitter (recoiler) if ileg = 2 (1))
4573-c xk1 = outgoing parton (emitter (recoiler) if ileg = 3 (4))
4574-c xk2 = outgoing parton (emitter (recoiler) if ileg = 4 (3))
4575-c xk3 = extra parton (FKS parton)
4576- do j=0,3
4577-c xk1 and xk2 are never used for ISR
4578- xp1(j)=pp(j,1)
4579- xp2(j)=pp(j,2)
4580- xk3(j)=pp(j,i_fks)
4581- if(ileg.gt.2)pp_rec(j)=pp(j,1)+pp(j,2)-pp(j,i_fks)-pp(j,j_fks)
4582- if(ileg.eq.3)then
4583- xk1(j)=pp(j,j_fks)
4584- xk2(j)=pp_rec(j)
4585- elseif(ileg.eq.4)then
4586- xk1(j)=pp_rec(j)
4587- xk2(j)=pp(j,j_fks)
4588- endif
4589- enddo
4590-
4591-c Determine the Mandelstam invariants needed in the MC functions in terms
4592-c of FKS variables: the argument of MC functions are (p+k)^2, NOT 2 p.k
4593-c
4594-c Definitions of invariants in terms of momenta
4595-c
4596-c xm12 = xk1 . xk1
4597-c xm22 = xk2 . xk2
4598-c xtk = - 2 xp1 . xk3
4599-c xuk = - 2 xp2 . xk3
4600-c xq1q = - 2 xp1 . xk1 + xm12
4601-c xq2q = - 2 xp2 . xk2 + xm22
4602-c w1 = + 2 xk1 . xk3 = - xq1q + xq2q - xtk
4603-c w2 = + 2 xk2 . xk3 = - xq2q + xq1q - xuk
4604-c xq1c = - 2 xp1 . xk2 = - s - xtk - xq1q + xm12
4605-c xq2c = - 2 xp2 . xk1 = - s - xuk - xq2q + xm22
4606-c
4607-c Parametrisation of invariants in terms of FKS variables
4608-c
4609-c ileg = 1
4610-c xp1 = sqrt(s)/2 * ( 1 , 0 , 0 , 1 )
4611-c xp2 = sqrt(s)/2 * ( 1 , 0 , 0 , -1 )
4612-c xk3 = B * ( 1 , 0 , sqrt(1-yi**2) , yi )
4613-c xk1 = irrelevant
4614-c xk2 = irrelevant
4615-c yi = y_ij_fks
4616-c x = 1 - xi_i_fks
4617-c B = sqrt(s)/2*(1-x)
4618-c
4619-c ileg = 2
4620-c xp1 = sqrt(s)/2 * ( 1 , 0 , 0 , 1 )
4621-c xp2 = sqrt(s)/2 * ( 1 , 0 , 0 , -1 )
4622-c xk3 = B * ( 1 , 0 , sqrt(1-yi**2) , -yi )
4623-c xk1 = irrelevant
4624-c xk2 = irrelevant
4625-c yi = y_ij_fks
4626-c x = 1 - xi_i_fks
4627-c B = sqrt(s)/2*(1-x)
4628-c
4629-c ileg = 3
4630-c xp1 = sqrt(s)/2 * ( 1 , 0 , sqrt(1-yi**2) , yi )
4631-c xp2 = sqrt(s)/2 * ( 1 , 0 , -sqrt(1-yi**2) , -yi )
4632-c xk1 = ( sqrt(veckn_ev**2+xm12) , 0 , 0 , veckn_ev )
4633-c xk2 = xp1 + xp2 - xk1 - xk3
4634-c xk3 = B * ( 1 , 0 , sqrt(1-yj**2) , yj )
4635-c yj = y_ij_fks
4636-c yi = irrelevant
4637-c x = 1 - xi_i_fks
4638-c veckn_ev is such that xk2**2 = xm22
4639-c B = sqrt(s)/2*(1-x)
4640-c azimuth = irrelevant (hence set = 0)
4641-c
4642-c ileg = 4
4643-c xp1 = sqrt(s)/2 * ( 1 , 0 , sqrt(1-yi**2) , yi )
4644-c xp2 = sqrt(s)/2 * ( 1 , 0 , -sqrt(1-yi**2) , -yi )
4645-c xk1 = xp1 + xp2 - xk2 - xk3
4646-c xk2 = A * ( 1 , 0 , 0 , 1 )
4647-c xk3 = B * ( 1 , 0 , sqrt(1-yj**2) , yj )
4648-c yj = y_ij_fks
4649-c yi = irrelevant
4650-c x = 1 - xi_i_fks
4651-c A = (s*x-xm12)/(sqrt(s)*(2-(1-x)*(1-yj)))
4652-c B = sqrt(s)/2*(1-x)
4653-c azimuth = irrelevant (hence set = 0)
4654-
4655- if(ileg.eq.1)then
4656- xtk=-sh*xi_i_fks*(1-y_ij_fks)/2
4657- xuk=-sh*xi_i_fks*(1+y_ij_fks)/2
4658- if(extra)then
4659- if(shower_mc.eq.'HERWIG6' .or.
4660- & shower_mc.eq.'HERWIGPP' )qMC=xi_i_fks/2*sqrt(sh*(1-y_ij_fks**2))
4661- if(shower_mc.eq.'PYTHIA6Q' )qMC=sqrt(-xtk)
4662- if(shower_mc.eq.'PYTHIA6PT'.or.
4663- & shower_mc.eq.'PYTHIA8' )qMC=sqrt(-xtk*xi_i_fks)
4664- endif
4665- elseif(ileg.eq.2)then
4666- xtk=-sh*xi_i_fks*(1+y_ij_fks)/2
4667- xuk=-sh*xi_i_fks*(1-y_ij_fks)/2
4668- if(extra)then
4669- if(shower_mc.eq.'HERWIG6' .or.
4670- & shower_mc.eq.'HERWIGPP' )qMC=xi_i_fks/2*sqrt(sh*(1-y_ij_fks**2))
4671- if(shower_mc.eq.'PYTHIA6Q' )qMC=sqrt(-xuk)
4672- if(shower_mc.eq.'PYTHIA6PT'.or.
4673- & shower_mc.eq.'PYTHIA8' )qMC=sqrt(-xuk*xi_i_fks)
4674- endif
4675- elseif(ileg.eq.3)then
4676- xm12=pmass(j_fks)**2
4677- xm22=dot(pp_rec,pp_rec)
4678- xtk=-2*dot(xp1,xk3)
4679- xuk=-2*dot(xp2,xk3)
4680- xq1q=-2*dot(xp1,xk1)+xm12
4681- xq2q=-2*dot(xp2,xk2)+xm22
4682- w1=-xq1q+xq2q-xtk
4683- w2=-xq2q+xq1q-xuk
4684- if(extra)then
4685- if(shower_mc.eq.'HERWIG6'.or.
4686- & shower_mc.eq.'HERWIGPP')then
4687- zeta1=get_zeta(sh,w1,w2,xm12,xm22)
4688- qMCarg=zeta1*((1-zeta1)*w1-zeta1*xm12)
4689- if(qMCarg.lt.0d0.and.qMCarg.ge.-tiny)qMCarg=0d0
4690- if(qMCarg.lt.-tiny) then
4691- isqrtneg=isqrtneg+1
4692- write(*,*)'Error 2 in kinematics_driver: negtive sqrt'
4693- write(*,*)qMCarg,isqrtneg
4694- if(isqrtneg.ge.100)stop
4695- endif
4696- qMC=sqrt(qMCarg)
4697- elseif(shower_mc.eq.'PYTHIA6Q')then
4698- qMC=sqrt(w1+xm12)
4699- elseif(shower_mc.eq.'PYTHIA6PT')then
4700- write(*,*)'PYTHIA6PT not available for FSR'
4701- stop
4702- elseif(shower_mc.eq.'PYTHIA8')then
4703- z=zPY8(ileg,xm12,xm22,sh,1d0-xi_i_fks,0d0,y_ij_fks,xtk,xuk,xq1q,xq2q)
4704- qMC=sqrt(z*(1-z)*w1)
4705- endif
4706- endif
4707- elseif(ileg.eq.4)then
4708- xm12=dot(pp_rec,pp_rec)
4709- xm22=0d0
4710- xtk=-2*dot(xp1,xk3)
4711- xuk=-2*dot(xp2,xk3)
4712- xij=2*(1-xm12/sh-xi_i_fks)/(2-xi_i_fks*(1-y_ij_fks))
4713- w2=sh*xi_i_fks*xij*(1-y_ij_fks)/2d0
4714- xq2q=-sh*xij*(2-dot(xp1,xk2)*4d0/(sh*xij))/2d0
4715- xq1q=xuk+xq2q+w2
4716- w1=-xq1q+xq2q-xtk
4717- if(extra)then
4718- if(shower_mc.eq.'HERWIG6'.or.
4719- & shower_mc.eq.'HERWIGPP')then
4720- zeta2=get_zeta(sh,w2,w1,xm22,xm12)
4721- qMCarg=zeta2*(1-zeta2)*w2
4722- if(qMCarg.lt.0d0.and.qMCarg.ge.-tiny)qMCarg=0d0
4723- if(qMCarg.lt.-tiny)then
4724- isqrtneg=isqrtneg+1
4725- write(*,*)'Error 3 in kinematics_driver: negtive sqrt'
4726- write(*,*)qMCarg,isqrtneg
4727- if(isqrtneg.ge.100)stop
4728- endif
4729- qMC=sqrt(qMCarg)
4730- elseif(shower_mc.eq.'PYTHIA6Q')then
4731- qMC=sqrt(w2)
4732- elseif(shower_mc.eq.'PYTHIA6PT')then
4733- write(*,*)'PYTHIA6PT not available for FSR'
4734- stop
4735- elseif(shower_mc.eq.'PYTHIA8')then
4736- z=zPY8(ileg,xm12,xm22,sh,1d0-xi_i_fks,0d0,y_ij_fks,xtk,xuk,xq1q,xq2q)
4737- qMC=sqrt(z*(1-z)*w2)
4738- endif
4739- endif
4740- else
4741- write(*,*)'Error 4 in kinematics_driver: assigned wrong ileg',ileg
4742- stop
4743- endif
4744-
4745-c Checks on invariants
4746- call check_invariants(ileg,sh,xtk,xuk,w1,w2,xq1q,xq2q,xm12,xm22)
4747-
4748- return
4749- end
4750-
4751-
4752-
4753- subroutine check_invariants(ileg,sh,xtk,xuk,w1,w2,xq1q,xq2q,xm12,xm22)
4754- implicit none
4755- integer ileg
4756-
4757- double precision xp1(0:3),xp2(0:3),xk1(0:3),xk2(0:3),xk3(0:3)
4758- common/cpkmomenta/xp1,xp2,xk1,xk2,xk3
4759- double precision sh,xtk,xuk,w1,w2,xq1q,xq2q,xm12,xm22
4760-
4761- double precision tiny,dot
4762- parameter(tiny=1d-5)
4763-
4764- if(ileg.le.2)then
4765- if((abs(xtk+2*dot(xp1,xk3))/sh.ge.tiny).or.
4766- & (abs(xuk+2*dot(xp2,xk3))/sh.ge.tiny))then
4767- write(*,*)'Imprecision 1 in check_invariants'
4768- write(*,*)abs(xtk+2*dot(xp1,xk3))/sh,
4769- & abs(xuk+2*dot(xp2,xk3))/sh
4770- stop
4771- endif
4772-c
4773- elseif(ileg.eq.3)then
4774- if(sqrt(w1+xm12).ge.sqrt(sh)-sqrt(xm22))then
4775- write(*,*)'Imprecision 2a in check_invariants'
4776- write(*,*)sqrt(w1),sqrt(sh),xm22
4777- stop
4778- endif
4779- if(((abs(w1-2*dot(xk1,xk3))/sh.ge.tiny)).or.
4780- & ((abs(w2-2*dot(xk2,xk3))/sh.ge.tiny)))then
4781- write(*,*)'Imprecision 2b in check_invariants'
4782- write(*,*)abs(w1-2*dot(xk1,xk3))/sh,
4783- & abs(w2-2*dot(xk2,xk3))/sh
4784- stop
4785- endif
4786- if(xm12.eq.0d0)then
4787- write(*,*)'Error 2c in check_invariants'
4788- stop
4789- endif
4790-c
4791- elseif(ileg.eq.4)then
4792- if(sqrt(w2).ge.sqrt(sh)-sqrt(xm12))then
4793- write(*,*)'Imprecision 3a in check_invariants'
4794- write(*,*)sqrt(w2),sqrt(sh),xm12
4795- stop
4796- endif
4797- if(((abs(w2-2*dot(xk2,xk3))/sh.ge.tiny)).or.
4798- & ((abs(xq2q+2*dot(xp2,xk2))/sh.ge.tiny)).or.
4799- & ((abs(xq1q+2*dot(xp1,xk1)-xm12)/sh.ge.tiny)))then
4800- write(*,*)'Imprecision 3b in check_invariants'
4801- write(*,*)abs(w2-2*dot(xk2,xk3))/sh,
4802- & abs(xq2q+2*dot(xp2,xk2))/sh,
4803- & abs(xq1q+2*dot(xp1,xk1)-xm12)/sh
4804- stop
4805- endif
4806- if(xm22.ne.0d0)then
4807- write(*,*)'Error 3c in check_invariants'
4808- stop
4809- endif
4810-
4811- endif
4812-
4813- return
4814- end
4815-
4816-
4817-
4818-c Monte Carlo functions
4819-c
4820-c The invariants given in input to these routines follow FNR conventions
4821-c (i.e., are defined as (p+k)^2, NOT 2 p.k).
4822-c The invariants used inside these routines follow MNR conventions
4823-c (i.e., are defined as -2p.k, NOT (p+k)^2)
4824-
4825-c Herwig6
4826-
4827- function zHW6(ileg,e0sq,xm12,xm22,s,x,yi,yj,xtk,xuk,xq1q,xq2q)
4828-c Shower energy variable
4829- implicit none
4830- integer ileg
4831- double precision zHW6,e0sq,xm12,xm22,s,x,yi,yj,xtk,xuk,xq1q,xq2q,tiny,
4832- &ss,w1,w2,tbeta1,zeta1,tbeta2,zeta2,get_zeta,beta,betae0,betad,betas
4833- parameter (tiny=1d-5)
4834-
4835- w1=-xq1q+xq2q-xtk
4836- w2=-xq2q+xq1q-xuk
4837-c
4838- if(ileg.eq.1)then
4839- if(1-x.lt.tiny)then
4840- zHW6=1-(1-x)*(s*(1-yi)+4*e0sq*(1+yi))/(8*e0sq)
4841- elseif(1-yi.lt.tiny)then
4842- zHW6=x-(1-yi)*(1-x)*(s*x**2-4*e0sq)/(8*e0sq)
4843- else
4844- ss=1-(1+xuk/s)/(e0sq/xtk)
4845- if(ss.lt.0d0)goto 999
4846- zHW6=2*(e0sq/xtk)*(1-sqrt(ss))
4847- endif
4848-c
4849- elseif(ileg.eq.2)then
4850- if(1-x.lt.tiny)then
4851- zHW6=1-(1-x)*(s*(1-yi)+4*e0sq*(1+yi))/(8*e0sq)
4852- elseif(1-yi.lt.tiny)then
4853- zHW6=x-(1-yi)*(1-x)*(s*x**2-4*e0sq)/(8*e0sq)
4854- else
4855- ss=1-(1+xtk/s)/(e0sq/xuk)
4856- if(ss.lt.0d0)goto 999
4857- zHW6=2*(e0sq/xuk)*(1-sqrt(ss))
4858- endif
4859-c
4860- elseif(ileg.eq.3)then
4861- if(e0sq.le.(w1+xm12))goto 999
4862- if(1-x.lt.tiny)then
4863- beta=1-xm12/s
4864- betae0=sqrt(1-xm12/e0sq)
4865- betad=sqrt((1-(xm12-xm22)/s)**2-(4*xm22/s))
4866- betas=1+(xm12-xm22)/s
4867- zHW6=1+(1-x)*( s*(yj*betad-betas)/(4*e0sq*(1+betae0))-
4868- & betae0*(xm12-xm22+s*(1+(1+yj)*betad-betas))/
4869- & (betad*(xm12-xm22+s*(1+betad))) )
4870- else
4871- tbeta1=sqrt(1-(w1+xm12)/e0sq)
4872- zeta1=get_zeta(s,w1,w2,xm12,xm22)
4873- zHW6=1-tbeta1*zeta1-w1/(2*(1+tbeta1)*e0sq)
4874- endif
4875-c
4876- elseif(ileg.eq.4)then
4877- if(e0sq.le.w2)goto 999
4878- if(1-x.lt.tiny)then
4879- zHW6=1-(1-x)*( (s-xm12)*(1-yj)/(8*e0sq)+
4880- & s*(1+yj)/(2*(s-xm12)) )
4881- elseif(1-yj.lt.tiny)then
4882- zHW6=(s*x-xm12)/(s-xm12)+(1-yj)*(1-x)*(s*x-xm12)*
4883- & ( (s-xm12)**2*(s*(1-2*x)+xm12)+
4884- & 4*e0sq*s*(s*x-xm12*(2-x)) )/
4885- & ( 8*e0sq*(s-xm12)**3 )
4886- else
4887- tbeta2=sqrt(1-w2/e0sq)
4888- zeta2=get_zeta(s,w2,w1,xm22,xm12)
4889- zHW6=1-tbeta2*zeta2-w2/(2*(1+tbeta2)*e0sq)
4890- endif
4891-c
4892- else
4893- write(*,*)'zHW6: unknown ileg'
4894- stop
4895- endif
4896-
4897- if(zHW6.lt.0d0.or.zHW6.gt.1d0)goto 999
4898-
4899- return
4900- 999 continue
4901- zHW6=-1d0
4902- return
4903- end
4904-
4905-
4906-
4907- function xiHW6(ileg,e0sq,xm12,xm22,s,x,yi,yj,xtk,xuk,xq1q,xq2q)
4908-c Shower evolution variable
4909- implicit none
4910- integer ileg
4911- double precision xiHW6,e0sq,xm12,xm22,s,x,yi,yj,xtk,xuk,xq1q,xq2q,tiny,z,
4912- &zHW6,w1,w2,beta,betae0,betad,betas
4913- parameter (tiny=1d-5)
4914-
4915- z=zHW6(ileg,e0sq,xm12,xm22,s,x,yi,yj,xtk,xuk,xq1q,xq2q)
4916- if(z.lt.0d0)goto 999
4917- w1=-xq1q+xq2q-xtk
4918- w2=-xq2q+xq1q-xuk
4919-c
4920- if(ileg.eq.1)then
4921- if(1-x.lt.tiny)then
4922- xiHW6=2*s*(1-yi)/(s*(1-yi)+4*e0sq*(1+yi))
4923- elseif(1-yi.lt.tiny)then
4924- xiHW6=(1-yi)*s*x**2/(4*e0sq)
4925- else
4926- xiHW6=2*(1+xuk/(s*(1-z)))
4927- endif
4928-c
4929- elseif(ileg.eq.2)then
4930- if(1-x.lt.tiny)then
4931- xiHW6=2*s*(1-yi)/(s*(1-yi)+4*e0sq*(1+yi))
4932- elseif(1-yi.lt.tiny)then
4933- xiHW6=(1-yi)*s*x**2/(4*e0sq)
4934- else
4935- xiHW6=2*(1+xtk/(s*(1-z)))
4936- endif
4937-c
4938- elseif(ileg.eq.3)then
4939- if(e0sq.le.(w1+xm12))goto 999
4940- if(1-x.lt.tiny)then
4941- beta=1-xm12/s
4942- betae0=sqrt(1-xm12/e0sq)
4943- betad=sqrt((1-(xm12-xm22)/s)**2-(4*xm22/s))
4944- betas=1+(xm12-xm22)/s
4945- xiHW6=( s*(1+betae0)*betad*(xm12-xm22+s*(1+betad))*(yj*betad-betas) )/
4946- & ( -4*e0sq*betae0*(1+betae0)*(xm12-xm22+s*(1+(1+yj)*betad-betas))+
4947- & (s*betad*(xm12-xm22+s*(1+betad))*(yj*betad-betas)) )
4948- else
4949- xiHW6=w1/(2*z*(1-z)*e0sq)
4950- endif
4951-c
4952- elseif(ileg.eq.4)then
4953- if(e0sq.le.w2)goto 999
4954- if(1-x.lt.tiny)then
4955- xiHW6=2*(s-xm12)**2*(1-yj)/( (s-xm12)**2*(1-yj)+4*e0sq*s*(1+yj) )
4956- elseif(1-yj.lt.tiny)then
4957- xiHW6=(s-xm12)**2*(1-yj)/(4*e0sq*s)
4958- else
4959- xiHW6=w2/(2*z*(1-z)*e0sq)
4960- endif
4961-c
4962- else
4963- write(*,*)'xiHW6: unknown ileg'
4964- stop
4965- endif
4966-
4967- if(xiHW6.lt.0d0)goto 999
4968-
4969- return
4970- 999 continue
4971- xiHW6=-1d0
4972- return
4973- end
4974-
4975-
4976-
4977- function xjacHW6_xiztoxy(ileg,e0sq,xm12,xm22,s,x,yi,yj,xtk,xuk,xq1q,xq2q)
4978-c Returns the jacobian d(z,xi)/d(x,y), where z and xi are the shower
4979-c variables, and x and y are FKS variables
4980- implicit none
4981- integer ileg
4982- double precision xjacHW6_xiztoxy,e0sq,xm12,xm22,s,x,yi,yj,xtk,xuk,xq1q,
4983- &xq2q,tiny,tmp,z,zHW6,xi,xiHW6,w1,w2,tbeta1,zeta1,dw1dx,dw2dx,dw1dy,dw2dy,
4984- &tbeta2,get_zeta,beta,betae0,betad,betas,eps1,eps2,beta1,beta2,zmo
4985- parameter (tiny=1d-5)
4986-
4987- tmp=0d0
4988- z=zHW6(ileg,e0sq,xm12,xm22,s,x,yi,yj,xtk,xuk,xq1q,xq2q)
4989- xi=xiHW6(ileg,e0sq,xm12,xm22,s,x,yi,yj,xtk,xuk,xq1q,xq2q)
4990- if(z.lt.0d0.or.xi.lt.0d0)goto 999
4991- w1=-xq1q+xq2q-xtk
4992- w2=-xq2q+xq1q-xuk
4993-c
4994- if(ileg.eq.1)then
4995- if(1-x.lt.tiny)then
4996- tmp=-2*s/(s*(1-yi)+4*(1+yi)*e0sq)
4997- elseif(1-yi.lt.tiny)then
4998- tmp=-s*x**2/(4*e0sq)
4999- else
5000- tmp=-s*(1-x)*z**3/(4*e0sq*(1-z)*(xi*(1-z)+z))
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches

to all changes: