Merge lp:~maddevelopers/mg5amcnlo/nlo_reweighting into lp:~maddevelopers/mg5amcnlo/2.3.4

Proposed by Olivier Mattelaer
Status: Merged
Merged at revision: 362
Proposed branch: lp:~maddevelopers/mg5amcnlo/nlo_reweighting
Merge into: lp:~maddevelopers/mg5amcnlo/2.3.4
Diff against target: 45986 lines (+12640/-10826)
370 files modified
Template/Common/Cards/reweight_card_default.dat (+36/-18)
Template/LO/Source/make_opts (+57/-40)
Template/LO/bin/madevent (+4/-1)
Template/NLO/Cards/run_card.dat (+1/-0)
Template/NLO/MCatNLO/HWAnalyzer/hw6an_HwU_pp_V.f (+1/-1)
Template/NLO/MCatNLO/srcHerwig/madfks_hwlhin.f (+6/-3)
Template/NLO/MCatNLO/srcPythia/madfks_pylhin.f (+6/-3)
Template/NLO/Source/make_opts.inc (+27/-8)
Template/NLO/Source/run.inc (+3/-2)
Template/NLO/SubProcesses/BinothLHA.f (+11/-30)
Template/NLO/SubProcesses/BinothLHA_OLP.f (+5/-23)
Template/NLO/SubProcesses/BinothLHA_user.f (+3/-22)
Template/NLO/SubProcesses/c_weight.inc (+12/-11)
Template/NLO/SubProcesses/check_poles.f (+3/-3)
Template/NLO/SubProcesses/driver_mintFO.f (+6/-0)
Template/NLO/SubProcesses/driver_mintMC.f (+6/-0)
Template/NLO/SubProcesses/fks_singular.f (+180/-88)
Template/NLO/SubProcesses/handling_lhe_events.f (+19/-16)
Template/NLO/SubProcesses/montecarlocounter.f (+5/-3)
Template/NLO/SubProcesses/reweight.inc (+2/-2)
Template/NLO/SubProcesses/reweight_xsec_events.f (+23/-11)
Template/NLO/bin/aMCatNLO (+4/-1)
Template/RWGTNLO/alfas.inc (+11/-0)
Template/RWGTNLO/alfas_functions_lhapdf.f (+167/-0)
Template/RWGTNLO/makefile (+19/-0)
Template/RWGTNLO/rwgt.f (+114/-0)
Template/RWGTNLO/setrun.f (+88/-0)
Template/RWGTNLO/timing_variables.inc (+9/-0)
Template/loop_material/StandAlone/SubProcesses/makefile (+17/-13)
UpdateNotes.txt (+5/-2)
VERSION (+2/-2)
madgraph/core/base_objects.py (+38/-4)
madgraph/core/diagram_generation.py (+0/-3)
madgraph/interface/amcatnlo_interface.py (+1/-1)
madgraph/interface/amcatnlo_run_interface.py (+119/-17)
madgraph/interface/coloring_logging.py (+3/-0)
madgraph/interface/common_run_interface.py (+293/-91)
madgraph/interface/extended_cmd.py (+9/-6)
madgraph/interface/loop_interface.py (+22/-13)
madgraph/interface/madevent_interface.py (+127/-23)
madgraph/interface/reweight_interface.py (+709/-279)
madgraph/iolibs/export_fks.py (+12/-6)
madgraph/iolibs/export_v4.py (+34/-71)
madgraph/iolibs/file_writers.py (+35/-9)
madgraph/iolibs/files.py (+10/-1)
madgraph/iolibs/template_files/born_fks.inc (+3/-0)
madgraph/iolibs/template_files/loop_optimized/CT_interface.inc (+85/-56)
madgraph/iolibs/template_files/loop_optimized/GOLEM_interface.inc (+13/-6)
madgraph/iolibs/template_files/loop_optimized/TIR_interface.inc (+22/-14)
madgraph/iolibs/template_files/loop_optimized/check_py.f.inc (+7/-5)
madgraph/iolibs/template_files/loop_optimized/check_sa.py.inc (+106/-0)
madgraph/iolibs/template_files/realmatrix_fks.inc (+3/-0)
madgraph/loop/loop_exporters.py (+30/-3)
madgraph/various/banner.py (+28/-12)
madgraph/various/lhe_parser.py (+386/-5)
madgraph/various/misc.py (+11/-2)
models/check_param_card.py (+2/-2)
tests/acceptance_tests/test_cmd.py (+10/-10)
tests/acceptance_tests/test_cmd_reweight.py (+164/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fks_loonly/%SubProcesses%P0_gg_ttx%b_sf_001.f (+8/-8)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fks_loonly/%SubProcesses%P0_gg_ttx%b_sf_002.f (+8/-8)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fks_loonly/%SubProcesses%P0_gg_ttx%b_sf_003.f (+8/-8)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fks_loonly/%SubProcesses%P0_gg_ttx%b_sf_004.f (+8/-8)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fks_loonly/%SubProcesses%P0_gg_ttx%b_sf_005.f (+8/-8)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fks_loonly/%SubProcesses%P0_gg_ttx%b_sf_006.f (+12/-12)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fks_loonly/%SubProcesses%P0_gg_ttx%b_sf_007.f (+8/-8)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fks_loonly/%SubProcesses%P0_gg_ttx%b_sf_008.f (+12/-12)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fks_loonly/%SubProcesses%P0_gg_ttx%born.f (+14/-10)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fks_loonly/%SubProcesses%P0_gg_ttx%born_hel.f (+6/-6)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fks_loonly/%SubProcesses%P0_gg_ttx%configs_and_props_decl.inc (+4/-4)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fks_loonly/%SubProcesses%P0_gg_ttx%fks_info.inc (+5/-4)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fks_loonly/%SubProcesses%P0_uux_ttx%b_sf_001.f (+8/-8)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fks_loonly/%SubProcesses%P0_uux_ttx%b_sf_002.f (+8/-8)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fks_loonly/%SubProcesses%P0_uux_ttx%b_sf_003.f (+8/-8)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fks_loonly/%SubProcesses%P0_uux_ttx%b_sf_004.f (+8/-8)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fks_loonly/%SubProcesses%P0_uux_ttx%b_sf_005.f (+8/-8)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fks_loonly/%SubProcesses%P0_uux_ttx%b_sf_006.f (+8/-8)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fks_loonly/%SubProcesses%P0_uux_ttx%b_sf_007.f (+8/-8)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fks_loonly/%SubProcesses%P0_uux_ttx%b_sf_008.f (+8/-8)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fks_loonly/%SubProcesses%P0_uux_ttx%born.f (+14/-10)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fks_loonly/%SubProcesses%P0_uux_ttx%born_hel.f (+6/-6)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fks_loonly/%SubProcesses%P0_uux_ttx%configs_and_props_decl.inc (+4/-4)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fks_loonly/%SubProcesses%P0_uux_ttx%fks_info.inc (+3/-2)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fks_loonly/%SubProcesses%P0_uxu_ttx%b_sf_001.f (+8/-8)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fks_loonly/%SubProcesses%P0_uxu_ttx%b_sf_002.f (+8/-8)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fks_loonly/%SubProcesses%P0_uxu_ttx%b_sf_003.f (+8/-8)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fks_loonly/%SubProcesses%P0_uxu_ttx%b_sf_004.f (+8/-8)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fks_loonly/%SubProcesses%P0_uxu_ttx%b_sf_005.f (+8/-8)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fks_loonly/%SubProcesses%P0_uxu_ttx%b_sf_006.f (+8/-8)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fks_loonly/%SubProcesses%P0_uxu_ttx%b_sf_007.f (+8/-8)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fks_loonly/%SubProcesses%P0_uxu_ttx%b_sf_008.f (+8/-8)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fks_loonly/%SubProcesses%P0_uxu_ttx%born.f (+14/-10)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fks_loonly/%SubProcesses%P0_uxu_ttx%born_hel.f (+6/-6)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fks_loonly/%SubProcesses%P0_uxu_ttx%configs_and_props_decl.inc (+4/-4)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fks_loonly/%SubProcesses%P0_uxu_ttx%fks_info.inc (+3/-2)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_gg_ttx%b_sf_001.f (+8/-8)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_gg_ttx%b_sf_002.f (+8/-8)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_gg_ttx%b_sf_003.f (+8/-8)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_gg_ttx%b_sf_004.f (+8/-8)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_gg_ttx%b_sf_005.f (+8/-8)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_gg_ttx%b_sf_006.f (+12/-12)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_gg_ttx%b_sf_007.f (+8/-8)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_gg_ttx%b_sf_008.f (+12/-12)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_gg_ttx%born.f (+14/-10)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_gg_ttx%born_hel.f (+6/-6)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_gg_ttx%configs_and_props_decl.inc (+4/-4)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_gg_ttx%fks_info.inc (+44/-36)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_gg_ttx%matrix_1.f (+3/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_gg_ttx%matrix_2.f (+3/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_gg_ttx%matrix_3.f (+3/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_gg_ttx%matrix_4.f (+3/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_gg_ttx%matrix_5.f (+3/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_uux_ttx%b_sf_001.f (+8/-8)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_uux_ttx%b_sf_002.f (+8/-8)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_uux_ttx%b_sf_003.f (+8/-8)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_uux_ttx%b_sf_004.f (+8/-8)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_uux_ttx%b_sf_005.f (+8/-8)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_uux_ttx%b_sf_006.f (+8/-8)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_uux_ttx%b_sf_007.f (+8/-8)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_uux_ttx%b_sf_008.f (+8/-8)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_uux_ttx%born.f (+14/-10)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_uux_ttx%born_hel.f (+6/-6)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_uux_ttx%configs_and_props_decl.inc (+4/-4)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_uux_ttx%fks_info.inc (+28/-22)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_uux_ttx%matrix_1.f (+3/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_uux_ttx%matrix_2.f (+3/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_uux_ttx%matrix_3.f (+3/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_uxu_ttx%b_sf_001.f (+8/-8)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_uxu_ttx%b_sf_002.f (+8/-8)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_uxu_ttx%b_sf_003.f (+8/-8)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_uxu_ttx%b_sf_004.f (+8/-8)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_uxu_ttx%b_sf_005.f (+8/-8)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_uxu_ttx%b_sf_006.f (+8/-8)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_uxu_ttx%b_sf_007.f (+8/-8)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_uxu_ttx%b_sf_008.f (+8/-8)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_uxu_ttx%born.f (+14/-10)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_uxu_ttx%born_hel.f (+6/-6)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_uxu_ttx%configs_and_props_decl.inc (+4/-4)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_uxu_ttx%fks_info.inc (+28/-22)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_uxu_ttx%matrix_1.f (+3/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_uxu_ttx%matrix_2.f (+3/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_uxu_ttx%matrix_3.f (+3/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_tdecay_fksreal/%SubProcesses%P0_t_budx%b_sf_001.f (+8/-8)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_tdecay_fksreal/%SubProcesses%P0_t_budx%b_sf_002.f (+8/-8)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_tdecay_fksreal/%SubProcesses%P0_t_budx%b_sf_003.f (+8/-8)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_tdecay_fksreal/%SubProcesses%P0_t_budx%b_sf_004.f (+8/-8)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_tdecay_fksreal/%SubProcesses%P0_t_budx%b_sf_005.f (+8/-8)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_tdecay_fksreal/%SubProcesses%P0_t_budx%b_sf_006.f (+8/-8)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_tdecay_fksreal/%SubProcesses%P0_t_budx%b_sf_007.f (+8/-8)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_tdecay_fksreal/%SubProcesses%P0_t_budx%b_sf_008.f (+8/-8)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_tdecay_fksreal/%SubProcesses%P0_t_budx%born.f (+14/-10)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_tdecay_fksreal/%SubProcesses%P0_t_budx%born_hel.f (+6/-6)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_tdecay_fksreal/%SubProcesses%P0_t_budx%configs_and_props_decl.inc (+4/-4)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_tdecay_fksreal/%SubProcesses%P0_t_budx%fks_info.inc (+15/-12)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_tdecay_fksreal/%SubProcesses%P0_t_budx%matrix_1.f (+3/-0)
tests/input_files/IOTestsComparison/IOExportV4IOTest/export_matrix_element_v4_madevent_group/matrix1.f (+18/-18)
tests/input_files/IOTestsComparison/IOExportV4IOTest/export_matrix_element_v4_madevent_group/super_auto_dsig.f (+10/-10)
tests/input_files/IOTestsComparison/IOExportV4IOTest/export_matrix_element_v4_madevent_nogroup/matrix.f (+15/-15)
tests/input_files/IOTestsComparison/IOTest_Histogram/gnuplot_histo_output/HistoOut.gnuplot (+35/-35)
tests/input_files/IOTestsComparison/LoopSquaredOrder_IOTest/Loop_sqso_uux_ddx/loop_matrix_QCDQEDpert_QCDsq_eq_4.f (+190/-191)
tests/input_files/IOTestsComparison/LoopSquaredOrder_IOTest/Loop_sqso_uux_ddx/loop_matrix_QCDQEDpert_QCDsq_gt_0_QEDAmpAndQEDsq_gt_2.f (+190/-191)
tests/input_files/IOTestsComparison/LoopSquaredOrder_IOTest/Loop_sqso_uux_ddx/loop_matrix_QCDQEDpert_QCDsq_gt_4.f (+180/-181)
tests/input_files/IOTestsComparison/LoopSquaredOrder_IOTest/Loop_sqso_uux_ddx/loop_matrix_QCDQEDpert_QEDsq_le_4.f (+198/-199)
tests/input_files/IOTestsComparison/LoopSquaredOrder_IOTest/Loop_sqso_uux_ddx/loop_matrix_QCDQEDpert_WGTsq_le_10_QEDAmpAndQEDsq_gt_2.f (+190/-191)
tests/input_files/IOTestsComparison/LoopSquaredOrder_IOTest/Loop_sqso_uux_ddx/loop_matrix_QCDQEDpert_default.f (+190/-191)
tests/input_files/IOTestsComparison/LoopSquaredOrder_IOTest/Loop_sqso_uux_ddx/loop_matrix_QCDpert_default.f (+180/-181)
tests/input_files/IOTestsComparison/LoopSquaredOrder_IOTest/Loop_sqso_uux_ddx/loop_matrix_QEDpert_default.f (+180/-181)
tests/input_files/IOTestsComparison/MadLoop_output_from_the_interface/TIR_output/%ggttx_IOTest%SubProcesses%MadLoopCommons.f (+60/-62)
tests/input_files/IOTestsComparison/MadLoop_output_from_the_interface/TIR_output/%ggttx_IOTest%SubProcesses%P0_gg_ttx%CT_interface.f (+76/-320)
tests/input_files/IOTestsComparison/MadLoop_output_from_the_interface/TIR_output/%ggttx_IOTest%SubProcesses%P0_gg_ttx%GOLEM_interface.f (+26/-26)
tests/input_files/IOTestsComparison/MadLoop_output_from_the_interface/TIR_output/%ggttx_IOTest%SubProcesses%P0_gg_ttx%TIR_interface.f (+4/-4)
tests/input_files/IOTestsComparison/MadLoop_output_from_the_interface/TIR_output/%ggttx_IOTest%SubProcesses%P0_gg_ttx%born_matrix.f (+13/-13)
tests/input_files/IOTestsComparison/MadLoop_output_from_the_interface/TIR_output/%ggttx_IOTest%SubProcesses%P0_gg_ttx%check_sa.f (+42/-43)
tests/input_files/IOTestsComparison/MadLoop_output_from_the_interface/TIR_output/%ggttx_IOTest%SubProcesses%P0_gg_ttx%check_sa_born_splitOrders.f (+13/-13)
tests/input_files/IOTestsComparison/MadLoop_output_from_the_interface/TIR_output/%ggttx_IOTest%SubProcesses%P0_gg_ttx%coef_construction_1.f (+4/-4)
tests/input_files/IOTestsComparison/MadLoop_output_from_the_interface/TIR_output/%ggttx_IOTest%SubProcesses%P0_gg_ttx%helas_calls_ampb_1.f (+6/-6)
tests/input_files/IOTestsComparison/MadLoop_output_from_the_interface/TIR_output/%ggttx_IOTest%SubProcesses%P0_gg_ttx%helas_calls_uvct_1.f (+16/-16)
tests/input_files/IOTestsComparison/MadLoop_output_from_the_interface/TIR_output/%ggttx_IOTest%SubProcesses%P0_gg_ttx%improve_ps.f (+38/-38)
tests/input_files/IOTestsComparison/MadLoop_output_from_the_interface/TIR_output/%ggttx_IOTest%SubProcesses%P0_gg_ttx%loop_CT_calls_1.f (+28/-28)
tests/input_files/IOTestsComparison/MadLoop_output_from_the_interface/TIR_output/%ggttx_IOTest%SubProcesses%P0_gg_ttx%loop_matrix.f (+182/-183)
tests/input_files/IOTestsComparison/MadLoop_output_from_the_interface/TIR_output/%ggttx_IOTest%SubProcesses%P0_gg_ttx%mp_coef_construction_1.f (+136/-136)
tests/input_files/IOTestsComparison/MadLoop_output_from_the_interface/TIR_output/%ggttx_IOTest%SubProcesses%P0_gg_ttx%mp_compute_loop_coefs.f (+14/-14)
tests/input_files/IOTestsComparison/MadLoop_output_from_the_interface/TIR_output/%ggttx_IOTest%SubProcesses%P0_gg_ttx%mp_helas_calls_ampb_1.f (+6/-6)
tests/input_files/IOTestsComparison/MadLoop_output_from_the_interface/TIR_output/%ggttx_IOTest%SubProcesses%P0_gg_ttx%mp_helas_calls_uvct_1.f (+16/-16)
tests/input_files/IOTestsComparison/MadLoop_output_from_the_interface/TIR_output/%ggttx_IOTest%SubProcesses%P0_gg_ttx%polynomial.f (+96/-96)
tests/input_files/IOTestsComparison/SquaredOrder_IOTest/sqso_uux_uuxuuxx/matrix_NoSQSO.f (+27/-33)
tests/input_files/IOTestsComparison/SquaredOrder_IOTest/sqso_uux_uuxuuxx/matrix_QCDsq_le_6.f (+39/-45)
tests/input_files/IOTestsComparison/SquaredOrder_IOTest/sqso_uux_uuxuuxx/matrix_ampOrderQED2_eq_2_WGTsq_le_14_QCDsq_gt_4.f (+39/-45)
tests/input_files/IOTestsComparison/TestCmdMatchBox/MatchBoxOutput/%TEST%SubProcesses%P1_uux_uux%CT_interface.f (+56/-302)
tests/input_files/IOTestsComparison/TestCmdMatchBox/MatchBoxOutput/%TEST%SubProcesses%P1_uux_uux%GOLEM_interface.f (+26/-26)
tests/input_files/IOTestsComparison/TestCmdMatchBox/MatchBoxOutput/%TEST%SubProcesses%P1_uux_uux%TIR_interface.f (+4/-4)
tests/input_files/IOTestsComparison/TestCmdMatchBox/MatchBoxOutput/%TEST%SubProcesses%P1_uux_uux%born_matrix.f (+13/-13)
tests/input_files/IOTestsComparison/TestCmdMatchBox/MatchBoxOutput/%TEST%SubProcesses%P1_uux_uux%check_sa.f (+42/-43)
tests/input_files/IOTestsComparison/TestCmdMatchBox/MatchBoxOutput/%TEST%SubProcesses%P1_uux_uux%check_sa_born_splitOrders.f (+13/-13)
tests/input_files/IOTestsComparison/TestCmdMatchBox/MatchBoxOutput/%TEST%SubProcesses%P1_uux_uux%coef_construction_1.f (+4/-4)
tests/input_files/IOTestsComparison/TestCmdMatchBox/MatchBoxOutput/%TEST%SubProcesses%P1_uux_uux%helas_calls_ampb_1.f (+8/-8)
tests/input_files/IOTestsComparison/TestCmdMatchBox/MatchBoxOutput/%TEST%SubProcesses%P1_uux_uux%improve_ps.f (+38/-38)
tests/input_files/IOTestsComparison/TestCmdMatchBox/MatchBoxOutput/%TEST%SubProcesses%P1_uux_uux%loop_CT_calls_1.f (+4/-4)
tests/input_files/IOTestsComparison/TestCmdMatchBox/MatchBoxOutput/%TEST%SubProcesses%P1_uux_uux%loop_matrix.f (+182/-183)
tests/input_files/IOTestsComparison/TestCmdMatchBox/MatchBoxOutput/%TEST%SubProcesses%P1_uux_uux%mp_coef_construction_1.f (+60/-60)
tests/input_files/IOTestsComparison/TestCmdMatchBox/MatchBoxOutput/%TEST%SubProcesses%P1_uux_uux%mp_compute_loop_coefs.f (+15/-15)
tests/input_files/IOTestsComparison/TestCmdMatchBox/MatchBoxOutput/%TEST%SubProcesses%P1_uux_uux%mp_helas_calls_ampb_1.f (+4/-4)
tests/input_files/IOTestsComparison/TestCmdMatchBox/MatchBoxOutput/%TEST%SubProcesses%P1_uux_uux%polynomial.f (+14/-14)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/dux_mumvmxg/%..%..%Source%MODEL%coupl.inc (+5/-5)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/dux_mumvmxg/%..%..%Source%MODEL%couplings.f (+1/-1)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/dux_mumvmxg/%..%..%Source%MODEL%couplings1.f (+2/-2)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/dux_mumvmxg/%..%..%Source%MODEL%couplings2.f (+8/-6)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/dux_mumvmxg/%..%..%Source%MODEL%input.inc (+30/-28)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/dux_mumvmxg/%..%..%Source%MODEL%intparam_definition.inc (+56/-56)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/dux_mumvmxg/%..%..%Source%MODEL%model_functions.f (+7/-7)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/dux_mumvmxg/%..%..%Source%MODEL%mp_coupl.inc (+4/-4)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/dux_mumvmxg/%..%..%Source%MODEL%mp_couplings2.f (+12/-12)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/dux_mumvmxg/%..%..%Source%MODEL%mp_input.inc (+38/-34)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/dux_mumvmxg/%..%..%Source%MODEL%mp_intparam_definition.inc (+36/-36)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/dux_mumvmxg/CT_interface.f (+5/-5)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/dux_mumvmxg/check_sa.f (+38/-39)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/dux_mumvmxg/improve_ps.f (+38/-38)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/dux_mumvmxg/loop_matrix.f (+107/-107)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/dux_mumvmxg/loop_num.f (+46/-46)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/dux_mumvmxg/mp_born_amps_and_wfs.f (+7/-7)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/gg_wmtbx/%..%..%Source%MODEL%coupl.inc (+12/-12)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/gg_wmtbx/%..%..%Source%MODEL%couplings.f (+1/-1)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/gg_wmtbx/%..%..%Source%MODEL%couplings1.f (+2/-2)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/gg_wmtbx/%..%..%Source%MODEL%couplings2.f (+10/-8)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/gg_wmtbx/%..%..%Source%MODEL%input.inc (+41/-39)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/gg_wmtbx/%..%..%Source%MODEL%intparam_definition.inc (+69/-69)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/gg_wmtbx/%..%..%Source%MODEL%model_functions.f (+7/-7)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/gg_wmtbx/%..%..%Source%MODEL%mp_coupl.inc (+15/-13)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/gg_wmtbx/%..%..%Source%MODEL%mp_couplings2.f (+36/-35)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/gg_wmtbx/%..%..%Source%MODEL%mp_couplings3.f (+4/-4)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/gg_wmtbx/%..%..%Source%MODEL%mp_input.inc (+45/-42)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/gg_wmtbx/%..%..%Source%MODEL%mp_intparam_definition.inc (+38/-38)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/gg_wmtbx/CT_interface.f (+8/-8)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/gg_wmtbx/check_sa.f (+38/-39)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/gg_wmtbx/improve_ps.f (+38/-38)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/gg_wmtbx/loop_matrix.f (+225/-225)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/gg_wmtbx/loop_num.f (+260/-260)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/gg_wmtbx/mp_born_amps_and_wfs.f (+81/-81)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/dux_mumvmxg/%..%..%Source%MODEL%coupl.inc (+5/-5)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/dux_mumvmxg/%..%..%Source%MODEL%couplings.f (+1/-1)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/dux_mumvmxg/%..%..%Source%MODEL%couplings1.f (+2/-2)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/dux_mumvmxg/%..%..%Source%MODEL%couplings2.f (+8/-6)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/dux_mumvmxg/%..%..%Source%MODEL%input.inc (+30/-28)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/dux_mumvmxg/%..%..%Source%MODEL%intparam_definition.inc (+56/-56)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/dux_mumvmxg/%..%..%Source%MODEL%model_functions.f (+7/-7)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/dux_mumvmxg/%..%..%Source%MODEL%mp_coupl.inc (+4/-4)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/dux_mumvmxg/%..%..%Source%MODEL%mp_couplings2.f (+12/-12)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/dux_mumvmxg/%..%..%Source%MODEL%mp_input.inc (+38/-34)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/dux_mumvmxg/%..%..%Source%MODEL%mp_intparam_definition.inc (+36/-36)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/dux_mumvmxg/CT_interface.f (+29/-29)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/dux_mumvmxg/TIR_interface.f (+3/-3)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/dux_mumvmxg/check_sa.f (+38/-39)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/dux_mumvmxg/coef_construction_1.f (+4/-4)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/dux_mumvmxg/helas_calls_ampb_1.f (+4/-4)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/dux_mumvmxg/helas_calls_uvct_1.f (+4/-4)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/dux_mumvmxg/improve_ps.f (+38/-38)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/dux_mumvmxg/loop_CT_calls_1.f (+4/-4)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/dux_mumvmxg/loop_matrix.f (+180/-181)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/dux_mumvmxg/mp_coef_construction_1.f (+28/-28)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/dux_mumvmxg/mp_compute_loop_coefs.f (+14/-14)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/dux_mumvmxg/mp_helas_calls_ampb_1.f (+4/-4)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/dux_mumvmxg/mp_helas_calls_uvct_1.f (+4/-4)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/dux_mumvmxg/polynomial.f (+96/-96)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/gg_wmtbx/%..%..%Source%MODEL%coupl.inc (+12/-12)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/gg_wmtbx/%..%..%Source%MODEL%couplings.f (+1/-1)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/gg_wmtbx/%..%..%Source%MODEL%couplings1.f (+2/-2)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/gg_wmtbx/%..%..%Source%MODEL%couplings2.f (+10/-8)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/gg_wmtbx/%..%..%Source%MODEL%input.inc (+41/-39)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/gg_wmtbx/%..%..%Source%MODEL%intparam_definition.inc (+69/-69)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/gg_wmtbx/%..%..%Source%MODEL%model_functions.f (+7/-7)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/gg_wmtbx/%..%..%Source%MODEL%mp_coupl.inc (+15/-13)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/gg_wmtbx/%..%..%Source%MODEL%mp_couplings2.f (+36/-35)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/gg_wmtbx/%..%..%Source%MODEL%mp_couplings3.f (+4/-4)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/gg_wmtbx/%..%..%Source%MODEL%mp_input.inc (+45/-42)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/gg_wmtbx/%..%..%Source%MODEL%mp_intparam_definition.inc (+38/-38)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/gg_wmtbx/CT_interface.f (+53/-53)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/gg_wmtbx/TIR_interface.f (+3/-3)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/gg_wmtbx/check_sa.f (+38/-39)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/gg_wmtbx/coef_construction_1.f (+22/-22)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/gg_wmtbx/helas_calls_ampb_1.f (+4/-4)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/gg_wmtbx/helas_calls_uvct_1.f (+36/-36)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/gg_wmtbx/improve_ps.f (+38/-38)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/gg_wmtbx/loop_CT_calls_1.f (+84/-84)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/gg_wmtbx/loop_matrix.f (+180/-181)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/gg_wmtbx/mp_coef_construction_1.f (+186/-186)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/gg_wmtbx/mp_compute_loop_coefs.f (+14/-14)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/gg_wmtbx/mp_helas_calls_ampb_1.f (+12/-12)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/gg_wmtbx/mp_helas_calls_uvct_1.f (+36/-36)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/gg_wmtbx/polynomial.f (+348/-352)
tests/input_files/IOTestsComparison/short_ML_SMQCD_LoopInduced/gg_hh/%..%..%Source%MODEL%coupl.inc (+2/-2)
tests/input_files/IOTestsComparison/short_ML_SMQCD_LoopInduced/gg_hh/%..%..%Source%MODEL%couplings.f (+1/-1)
tests/input_files/IOTestsComparison/short_ML_SMQCD_LoopInduced/gg_hh/%..%..%Source%MODEL%couplings2.f (+10/-10)
tests/input_files/IOTestsComparison/short_ML_SMQCD_LoopInduced/gg_hh/%..%..%Source%MODEL%input.inc (+28/-26)
tests/input_files/IOTestsComparison/short_ML_SMQCD_LoopInduced/gg_hh/%..%..%Source%MODEL%intparam_definition.inc (+45/-45)
tests/input_files/IOTestsComparison/short_ML_SMQCD_LoopInduced/gg_hh/%..%..%Source%MODEL%model_functions.f (+7/-7)
tests/input_files/IOTestsComparison/short_ML_SMQCD_LoopInduced/gg_hh/%..%..%Source%MODEL%mp_couplings2.f (+4/-4)
tests/input_files/IOTestsComparison/short_ML_SMQCD_LoopInduced/gg_hh/%..%..%Source%MODEL%mp_input.inc (+44/-42)
tests/input_files/IOTestsComparison/short_ML_SMQCD_LoopInduced/gg_hh/%..%..%Source%MODEL%mp_intparam_definition.inc (+26/-26)
tests/input_files/IOTestsComparison/short_ML_SMQCD_LoopInduced/gg_hh/CT_interface.f (+3/-3)
tests/input_files/IOTestsComparison/short_ML_SMQCD_LoopInduced/gg_hh/check_sa.f (+30/-31)
tests/input_files/IOTestsComparison/short_ML_SMQCD_LoopInduced/gg_hh/improve_ps.f (+38/-38)
tests/input_files/IOTestsComparison/short_ML_SMQCD_LoopInduced/gg_hh/loop_matrix.f (+161/-149)
tests/input_files/IOTestsComparison/short_ML_SMQCD_LoopInduced/gg_hh/loop_num.f (+4/-4)
tests/input_files/IOTestsComparison/short_ML_SMQCD_LoopInduced/gg_hh/mp_born_amps_and_wfs.f (+1/-1)
tests/input_files/IOTestsComparison/short_ML_SMQCD_default/ddx_ttx/CT_interface.f (+5/-5)
tests/input_files/IOTestsComparison/short_ML_SMQCD_default/ddx_ttx/check_sa.f (+38/-39)
tests/input_files/IOTestsComparison/short_ML_SMQCD_default/ddx_ttx/improve_ps.f (+38/-38)
tests/input_files/IOTestsComparison/short_ML_SMQCD_default/ddx_ttx/loop_matrix.f (+99/-99)
tests/input_files/IOTestsComparison/short_ML_SMQCD_default/ddx_ttx/loop_num.f (+30/-30)
tests/input_files/IOTestsComparison/short_ML_SMQCD_default/ddx_ttx/mp_born_amps_and_wfs.f (+1/-1)
tests/input_files/IOTestsComparison/short_ML_SMQCD_default/gg_ttx/%..%..%Source%MODEL%coupl.inc (+10/-10)
tests/input_files/IOTestsComparison/short_ML_SMQCD_default/gg_ttx/%..%..%Source%MODEL%couplings.f (+1/-1)
tests/input_files/IOTestsComparison/short_ML_SMQCD_default/gg_ttx/%..%..%Source%MODEL%couplings2.f (+10/-8)
tests/input_files/IOTestsComparison/short_ML_SMQCD_default/gg_ttx/%..%..%Source%MODEL%input.inc (+19/-17)
tests/input_files/IOTestsComparison/short_ML_SMQCD_default/gg_ttx/%..%..%Source%MODEL%intparam_definition.inc (+65/-65)
tests/input_files/IOTestsComparison/short_ML_SMQCD_default/gg_ttx/%..%..%Source%MODEL%model_functions.f (+7/-7)
tests/input_files/IOTestsComparison/short_ML_SMQCD_default/gg_ttx/%..%..%Source%MODEL%mp_coupl.inc (+10/-9)
tests/input_files/IOTestsComparison/short_ML_SMQCD_default/gg_ttx/%..%..%Source%MODEL%mp_coupl_same_name.inc (+5/-5)
tests/input_files/IOTestsComparison/short_ML_SMQCD_default/gg_ttx/%..%..%Source%MODEL%mp_couplings2.f (+31/-30)
tests/input_files/IOTestsComparison/short_ML_SMQCD_default/gg_ttx/%..%..%Source%MODEL%mp_couplings3.f (+4/-4)
tests/input_files/IOTestsComparison/short_ML_SMQCD_default/gg_ttx/%..%..%Source%MODEL%mp_input.inc (+38/-34)
tests/input_files/IOTestsComparison/short_ML_SMQCD_default/gg_ttx/%..%..%Source%MODEL%mp_intparam_definition.inc (+37/-37)
tests/input_files/IOTestsComparison/short_ML_SMQCD_default/gg_ttx/CT_interface.f (+8/-8)
tests/input_files/IOTestsComparison/short_ML_SMQCD_default/gg_ttx/check_sa.f (+38/-39)
tests/input_files/IOTestsComparison/short_ML_SMQCD_default/gg_ttx/improve_ps.f (+38/-38)
tests/input_files/IOTestsComparison/short_ML_SMQCD_default/gg_ttx/loop_matrix.f (+143/-143)
tests/input_files/IOTestsComparison/short_ML_SMQCD_default/gg_ttx/loop_num.f (+90/-90)
tests/input_files/IOTestsComparison/short_ML_SMQCD_default/gg_ttx/mp_born_amps_and_wfs.f (+15/-15)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/ddx_ttx/CT_interface.f (+29/-29)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/ddx_ttx/TIR_interface.f (+3/-3)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/ddx_ttx/check_sa.f (+38/-39)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/ddx_ttx/coef_construction_1.f (+4/-4)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/ddx_ttx/helas_calls_ampb_1.f (+6/-6)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/ddx_ttx/helas_calls_uvct_1.f (+4/-4)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/ddx_ttx/improve_ps.f (+38/-38)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/ddx_ttx/loop_CT_calls_1.f (+10/-10)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/ddx_ttx/loop_matrix.f (+180/-181)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/ddx_ttx/mp_coef_construction_1.f (+24/-24)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/ddx_ttx/mp_compute_loop_coefs.f (+14/-14)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/ddx_ttx/mp_helas_calls_ampb_1.f (+4/-4)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/ddx_ttx/mp_helas_calls_uvct_1.f (+4/-4)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/ddx_ttx/polynomial.f (+14/-14)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/gg_ttx/%..%..%Source%MODEL%coupl.inc (+10/-10)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/gg_ttx/%..%..%Source%MODEL%couplings.f (+1/-1)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/gg_ttx/%..%..%Source%MODEL%couplings2.f (+10/-8)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/gg_ttx/%..%..%Source%MODEL%input.inc (+19/-17)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/gg_ttx/%..%..%Source%MODEL%intparam_definition.inc (+65/-65)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/gg_ttx/%..%..%Source%MODEL%model_functions.f (+7/-7)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/gg_ttx/%..%..%Source%MODEL%mp_coupl.inc (+10/-9)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/gg_ttx/%..%..%Source%MODEL%mp_coupl_same_name.inc (+5/-5)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/gg_ttx/%..%..%Source%MODEL%mp_couplings2.f (+31/-30)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/gg_ttx/%..%..%Source%MODEL%mp_couplings3.f (+4/-4)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/gg_ttx/%..%..%Source%MODEL%mp_input.inc (+38/-34)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/gg_ttx/%..%..%Source%MODEL%mp_intparam_definition.inc (+37/-37)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/gg_ttx/CT_interface.f (+41/-41)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/gg_ttx/TIR_interface.f (+3/-3)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/gg_ttx/check_sa.f (+38/-39)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/gg_ttx/coef_construction_1.f (+4/-4)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/gg_ttx/helas_calls_ampb_1.f (+6/-6)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/gg_ttx/helas_calls_uvct_1.f (+16/-16)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/gg_ttx/improve_ps.f (+38/-38)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/gg_ttx/loop_CT_calls_1.f (+28/-28)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/gg_ttx/loop_matrix.f (+180/-181)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/gg_ttx/mp_coef_construction_1.f (+136/-136)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/gg_ttx/mp_compute_loop_coefs.f (+14/-14)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/gg_ttx/mp_helas_calls_ampb_1.f (+6/-6)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/gg_ttx/mp_helas_calls_uvct_1.f (+16/-16)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/gg_ttx/polynomial.f (+96/-96)
tests/unit_tests/iolibs/test_export_v4.py (+2/-2)
tests/unit_tests/iolibs/test_file_writers.py (+2/-3)
To merge this branch: bzr merge lp:~maddevelopers/mg5amcnlo/nlo_reweighting
Reviewer Review Type Date Requested Status
Rikkert Frederix Approve
Valentin Hirschi Approve
Review via email: mp+283769@code.launchpad.net

Description of the change

Hi,

This branch

1) includes change from Rikkert corresponding to the new format of the reweight information
2) include a new flag in the NLO run_card allowing to keep/discard the reweight information
3) include the possibility to perform a proper NLO reweighting

This implementation follows closely the one done in the unleashed_reweighting (accepted) branch for the strategy/interface. The details on how to use the branch is on this page:
https://cp3.irmp.ucl.ac.be/projects/madgraph/wiki/Reweight

Basic validations are presented in this talk:
https://cp3.irmp.ucl.ac.be/projects/madgraph/raw-attachment/wiki/Reweight/15_12_11_ReWeighting_EFT.pdf

I would propose that Rikkert focus on the change in
fks_singular/ handling_lhe_events as well as lhe_parser.py
While Valentin can focus on the computation of the loop with f2py.

Cheers and Thanks,

Olivier

PS: A couple of unittest/acceptance tests are failing but they are all already failing in 2.3.4.
I'm going to track the responsible(s) of those failing tests in 2.3.4 and will re-merge 2.3.4 when those will be fixed in that branch.

To post a comment you must log in.
347. By Olivier Mattelaer

adding missing file

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

Hi Olivier,

It doesn't work. f2py tries to link LHAPDF, even though I didn't specify the code to use LHAPDF and I get a crash that it doesn't fine the -lLHAPDF library.

cheers,
Rik

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

Hi Rik,

Yes this mode need lhapdf.
I do not want to play with internal pdf.

I will add this in the documentation and add the code to check if lhapdf is present or not before proposing to the user
to use the module.

Cheers and thanks,

Olivier

> On Feb 3, 2016, at 13:49, Rikkert Frederix <email address hidden> wrote:
>
> Review: Needs Fixing
>
> Hi Olivier,
>
> It doesn't work. f2py tries to link LHAPDF, even though I didn't specify the code to use LHAPDF and I get a crash that it doesn't fine the -lLHAPDF library.
>
> cheers,
> Rik
>
> --
> https://code.launchpad.net/~maddevelopers/mg5amcnlo/nlo_reweighting/+merge/283769
> Your team MadDevelopers is subscribed to branch lp:~maddevelopers/mg5amcnlo/2.3.4.

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

Hi Olivier,

I double checked. I don't know if your solution helps. In fact, I do have LHAPDF installed, it's in the PATH (as well as that I specified the path to lhapdf-config in the mg5_configuration.txt file), and I can even generate the events with LHAPDF. Still, it doesn't work for the reweight module.

Cheers,
Rik

348. By Olivier Mattelaer

add details for NLO reweighting in the reweight_card

349. By Olivier Mattelaer

merge with 2.3.4 (code not working anymore)

350. By Olivier Mattelaer

fixing linking problem with lhapdf6

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

Hi Rik,

Could you retry now?
I have merged with the latest 2.3.4 and fix the way to link to lhapdf.
I'm still trying to understand better how to correctly link to lhapdf but I hope that you should have something working now.

Thanks,

Olivier

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

Hi Olivier,

It still isn't working. Although it doesn't seem to be related to LHAPDF. I get the following compilation error:

Command "launch auto " interrupted with error:
MadGraph5Error : A compilation Error occurs when trying to compile /tuph/t30/space/frederix/MG5_aMC/nlo_reweighting/PROCNLO_loop_sm_0/rw_mevirt/SubProcesses/P1_csx_epve.
 The compilation fails with the following output message:
     cd ..; make OLP_static; cd -
     make[1]: Entering directory `/tuph/t30/space/frederix/MG5_aMC/nlo_reweighting/PROCNLO_loop_sm_0/rw_mevirt/SubProcesses'
     ar rcs libMadLoop.a MadLoopParamReader.o MadLoopCommons.o P0_udx_epve/loop_matrix.o P1_csx_epve/loop_matrix.o P0_udx_epve/improve_ps.o P1_csx_epve/improve_ps.o P0_udx_epve/born_matrix.o P1_csx_epve/born_matrix.o P0_udx_epve/CT_interface.o P1_csx_epve/CT_interface.o P0_udx_epve/loop_num.o P1_csx_epve/loop_num.o P0_udx_epve/polynomial.o P1_csx_epve/polynomial.o P0_udx_epve/mp_compute_loop_coefs.o P1_csx_epve/mp_compute_loop_coefs.o P0_udx_epve/TIR_interface.o P1_csx_epve/TIR_interface.o
     mv libMadLoop.a ../lib/libMadLoop.a
     make[1]: Leaving directory `/tuph/t30/space/frederix/MG5_aMC/nlo_reweighting/PROCNLO_loop_sm_0/rw_mevirt/SubProcesses'
     /tuph/t30/space/frederix/MG5_aMC/nlo_reweighting/PROCNLO_loop_sm_0/rw_mevirt/SubProcesses/P1_csx_epve
     ln -s ../../lib/libMadLoop.a
     ln: failed to create symbolic link ‘./libMadLoop.a’: File exists
     make: *** [../OLP_static] Error 1

 Please try to fix this compilations issue and retry.
 Help might be found at https://answers.launchpad.net/madgraph5.
 If you think that this is a bug, you can report this at https://bugs.launchpad.net/madgraph5
Please report this bug on https://bugs.launchpad.net/madgraph5
More information is found in '/tuph/t30/space/frederix/MG5_aMC/nlo_reweighting/PROCNLO_loop_sm_0/run_01_tag_1_debug.log'.
Please attach this file to your report.

Cheers,
Rik

review: Needs Fixing
351. By Olivier Mattelaer

make possible mulitple linking to the library even when ln -s crashes

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

Hi Rik,

Thanks a lot for this beta testing, this is really useful to have.
I guess that this should be fixed now.

Cheers,

Olivier

> On Feb 9, 2016, at 09:56, Rikkert Frederix <email address hidden> wrote:
>
> Review: Needs Fixing
>
> Hi Olivier,
>
> It still isn't working. Although it doesn't seem to be related to LHAPDF. I get the following compilation error:
>
> Command "launch auto " interrupted with error:
> MadGraph5Error : A compilation Error occurs when trying to compile /tuph/t30/space/frederix/MG5_aMC/nlo_reweighting/PROCNLO_loop_sm_0/rw_mevirt/SubProcesses/P1_csx_epve.
> The compilation fails with the following output message:
> cd ..; make OLP_static; cd -
> make[1]: Entering directory `/tuph/t30/space/frederix/MG5_aMC/nlo_reweighting/PROCNLO_loop_sm_0/rw_mevirt/SubProcesses'
> ar rcs libMadLoop.a MadLoopParamReader.o MadLoopCommons.o P0_udx_epve/loop_matrix.o P1_csx_epve/loop_matrix.o P0_udx_epve/improve_ps.o P1_csx_epve/improve_ps.o P0_udx_epve/born_matrix.o P1_csx_epve/born_matrix.o P0_udx_epve/CT_interface.o P1_csx_epve/CT_interface.o P0_udx_epve/loop_num.o P1_csx_epve/loop_num.o P0_udx_epve/polynomial.o P1_csx_epve/polynomial.o P0_udx_epve/mp_compute_loop_coefs.o P1_csx_epve/mp_compute_loop_coefs.o P0_udx_epve/TIR_interface.o P1_csx_epve/TIR_interface.o
> mv libMadLoop.a ../lib/libMadLoop.a
> make[1]: Leaving directory `/tuph/t30/space/frederix/MG5_aMC/nlo_reweighting/PROCNLO_loop_sm_0/rw_mevirt/SubProcesses'
> /tuph/t30/space/frederix/MG5_aMC/nlo_reweighting/PROCNLO_loop_sm_0/rw_mevirt/SubProcesses/P1_csx_epve
> ln -s ../../lib/libMadLoop.a
> ln: failed to create symbolic link ‘./libMadLoop.a’: File exists
> make: *** [../OLP_static] Error 1
>
> Please try to fix this compilations issue and retry.
> Help might be found at https://answers.launchpad.net/madgraph5.
> If you think that this is a bug, you can report this at https://bugs.launchpad.net/madgraph5
> Please report this bug on https://bugs.launchpad.net/madgraph5
> More information is found in '/tuph/t30/space/frederix/MG5_aMC/nlo_reweighting/PROCNLO_loop_sm_0/run_01_tag_1_debug.log'.
> Please attach this file to your report.
>
>
> Cheers,
> Rik
>
>
> --
> https://code.launchpad.net/~maddevelopers/mg5amcnlo/nlo_reweighting/+merge/283769
> Your team MadDevelopers is subscribed to branch lp:~maddevelopers/mg5amcnlo/2.3.4.

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

Hi Olivier,

I really think you should do some more testing before asking for a review. Now the code runs, but the reweighted cross sections is orders of magnitude away from the correct value.

generate p p > e+ ve [QCD] ; output
launch --> "reweight ON' and 'keep_rwgt_info --> True'

(It gives the warning that the cards are identical, but it runs anyway due to DEBUG mode).

gives that the reweighted cross section is ~4.3 pb, while the original is ~1.0*10^4 pb.

Cheers,
Rik

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

Hi Rik,

Actually, such tests was working when I proposed the merging.
This bug was introduced with the latest merge of 2.3.4.
Funny that it did not show up for the EFT test that I did after this merging.
Since the only big change in 2.3.4 is linked to the lhapdf, I guess that's the problem are related to that.

I will fix that, will add a couple of acceptance tests on this functionality to prevent similar future problem and will rerun a battery of tests.

I will let you know when this is ready.

Cheers,

Olivier

352. By Olivier Mattelaer

reintroducing PDF factor and improve the combination of the weights

Revision history for this message
Valentin Hirschi (valentin-hirschi) wrote :
Download full text (8.4 KiB)

Hi Olivier,

So we already did some testing together on skype about this branch and identified an issue arising when using PDF reweighting together with your reweighting. I guess you fixed it by now.

So here are my comments on the functionalities:

a) If I understood correctly, the run_card option

False = keep_rwgt_info ! keep the information for reweighting (huge impact on size file)

does more than just changing what is stored in the intermediate lhe, but also dictates what type of reweighting will be performed. I think that this should be emphasized more, maybe with a comment above this parameter in the card.
Also, my understanding is that keeping these additional weights in the .lhe will increase its filesize by more or less a constant factor independent of the process (actually this factor would become smaller for more complicated processes since one must store more momenta).
I tried the comparison on 10k events for p p > e+ ve and I got a factor a bit less than 3 (both zipped and unzipped). So I think the parenthesis after this factor should read

(leads to an .lhe event file about ~3 times larger)

This would scare people much less than 'a huge factor'.

b) When using GoSam as an OLP, the true reweighting crashes (expectedly so) [but now for the kamikaze reweighting, which is good]. It would be nice if you could handle this earlier an in a nicer way, because it made python crash (!) not even an exception thrown! I guess it is ok an nice to keep the kamikaze reweighting working in this case.

c) With lhapdf I still have the issue of having '-lc++' in make_opts. Did you push your fix? It works fine in 2.3.4

d) generating the square matrix element for reweighting
   ->
   generating the squared matrix element for reweighting

e) It would be nice that when it says 'Running Reweight' it reads instead

   'INFO: Running reweighting (exactly NLO accurate)' for the true reweighting

   and for the kamikaze one, it reminds (once again):

   "INFO: Running reweighting (approximate)"
   "WARNING: To perform exact NLO accurate reweighting, please turn on the run_card parameter 'keep_rwgt_info'"

   Also I would rephrase your existing warning :

Warning: To have NLO accurate reweighting, you need to specify in the
+# run_card (at the time of the NLO sample generation)
+# keep_rwgt_info on "True". If it is on False a LO type of
+# reweighting will be performed (not assuring NLO accuracy)

->

Warning: To insure NLO accuracy in the reweighting procedure, you must set the
+# run_card parameter 'keep_rwgt_info' to '.true.'(when doing event generation).
+# If it is set to '.false.', then and approximate reweighting based on
+# LO matrix element only will be performed (hence losing formal NLO accuracy)

f) I tried to reweight p p > e+ ve [QCD] by setting the WWidth to 10.0 (kamikaze reweighting) I got:

INFO: new cross-section is : 2180.81 pb (indicative error: 14.8007 pb)
INFO: Original cross-section: 10825.316 +- 40.826559 pb
INFO: Computed cross-section:
INFO: 1 : 2180.80629797 +- 14.8006705613 pb

And when doing it the other way around (generating with a width of 10 Gev and reweighting to...

Read more...

review: Needs Fixing
353. By Olivier Mattelaer

merge with latest 2.3.4

354. By Olivier Mattelaer

- allow the possibility to reweight wihout the virt-trick handling
- allow to run more than one reweighting (VT/standard/LO) at the same time
- adding better support for LHAPDF (automatic downloading of the sample)
- fixing a couple of glitch in the reading of the weight in the shower analysis

355. By Olivier Mattelaer

merge with 2.3.4 (336)

Revision history for this message
Olivier Mattelaer (olivier-mattelaer) wrote :
Download full text (6.3 KiB)

@Rik,

So the identity tests was failing due to the lhapdf problem that I face with the merge with Marco branch. For the test, I remove some call to lhapdf and forget to put those back. I have add an acceptance test to check that part of the code.

So you can go back to testing.

@Valentin,

What an extensive review. Thanks so much for this.

> a) (leads to an .lhe event file about ~3 times larger)

Done ( I have put 5)

> I think that this should be emphasized more, maybe with a comment above this parameter in the card.

Don't think this is necessary in the card, if reweighting is on, a warning is set automatically anyway.
Actually, I have modified the behavior such that the default when setting reweighitng on ON is to set that parameter on True automatically.

> b) When using GoSam as an OLP.

Ok Done.

> c) With lhapdf I still have the issue of having '-lc++' in make_opts. Did you
> push your fix? It works fine in 2.3.4

Should be fixed now actually. I did not made the push so far indeed

> d) generating the square matrix element for reweighting
> ->
> generating the squared matrix element for reweighting
>
done

> e) It would be nice that when it says 'Running Reweight' it reads

Well this is a bit tricky. I never know for sure if an exact NLO reweighitng is going to be used since the user has always the possibility to put it on LO mode.
So I have put "INFO: Running reweighting (approximate)" when I'm sure that the kamikaze method is used.

> Also I would rephrase your existing warning :

DONE

> f) Anyway, I think that it might be nice to have a warning message if your
> reweighted relative error becomes say 100 times larger than the one of the
> original cross-section, do you have one?

Well the reweighting can be 100% correct and the error be 100 times larger than the original one.
(if the cross-section is also multiplied by exactly 100) so such simple warning does not work in general.

> g) ==== POWHEG (OR POSSIBLY HERWIG) WILL USE LHAPDFv6 ====

This one is funny, this is probably a misspell from Rik or Marco.
This come from one fortran file.

> terminate called after throwing an instance of 'LHAPDF::ReadError'
> what(): Empty PDF file name given to Info::load
> Abort trap: 6
>
> What is this about :) ??

Crash in the f2py are like that. they make python to crash in a quite bad way...
If we decide to push this f2py idea, we will need a way to recover from those kind of crash but this is ok for the moment.

>If lhapdf is indeed needed for true reweighting, then it must be handled upstream, in the same way
>as when the user tries to turn on PDF reweighting and built-in PDFs are selected.

I have put a switch to automatically do LO reweighitng in that case, with the appropriate warning.

> h)
> Should it already follow the strategy we discussed so as to easily derive the
> HEPMC weight name afterwards? Anyway, this branch also update the shower
> driver so as to keep these weights in the

Ok I have change type= to name= like in the susmentioned banch.
I will not put the diff in the attribute.

> (Detail: also maybe pick a shorter name than 'mg_reweight_1' given that it is
> bound to appear fo each event.)

Done...

Read more...

356. By Olivier Mattelaer

apply Valentin modification

Revision history for this message
Valentin Hirschi (valentin-hirschi) wrote :
Download full text (12.4 KiB)

Hi Olivier,

On Fri, Feb 19, 2016 at 9:12 AM, Olivier Mattelaer <
<email address hidden>> wrote:

> @Rik,
>
> So the identity tests was failing due to the lhapdf problem that I face
> with the merge with Marco branch. For the test, I remove some call to
> lhapdf and forget to put those back. I have add an acceptance test to check
> that part of the code.
>
> So you can go back to testing.
>
>
> @Valentin,
>
> What an extensive review. Thanks so much for this.
>
> > a) (leads to an .lhe event file about ~3 times larger)
>
> Done ( I have put 5)
>

Well ok, but 3 was already rounding up aove the factor I had found :).

>
> > I think that this should be emphasized more, maybe with a comment above
> this parameter in the card.
>
> Don't think this is necessary in the card, if reweighting is on, a warning
> is set automatically anyway.
> Actually, I have modified the behavior such that the default when setting
> reweighitng on ON is to set that parameter on True automatically.
>

Ok then. Also because when doing kamikaze the subsequent warning makes it
clear how to do the exact reweighting.

But the problem is that if I set it to false then it will still be
automatically be reassigned to True if I try to launch again. The user will
certainly don't expect his run_card.dat to be changed on his behalf when it
does a new run.
So I'm not sure I like this behavior....

> > b) When using GoSam as an OLP.
>
> Ok Done.
>
>
> > c) With lhapdf I still have the issue of having '-lc++' in make_opts.
> Did you
> > push your fix? It works fine in 2.3.4
>
> Should be fixed now actually. I did not made the push so far indeed

Ok it works now for the kamikaze reweighting with lhapdf reweighting.
However, I tried a kamikaze reweighting *with the default reweighting card*
(so launch only) on p p > e+ ve with lhapdf and pdf reweighting (with lhaid
= 11000) and I got

INFO: new cross-section is : 10827.4 pb (indicative error: 42.5828 pb)
INFO: Original cross-section: 11125.181 +- 42.582827 pb
INFO: Computed cross-section:
INFO: 1 : 10827.4488 +- 42.582827 pb

The cross-sections aren't identical, so this is purely an effect of the
kamikaze reweighting right? I guess I'm missing something because I'd
expect that even in this case you divide and multiply by the same thing, so
you should leave the original weight untouched. Since kamikaze reweighting
is so fast, I would consider to *always* use this "central reweighting" so
as to be able to automatically provide the user with an assessment of how
reliable he can expect the kamikaze reweighting to be for this case.

Unfortunately, it still crashes at compilation time when doing the exact
reweighting with lhapdf reweighting. The error being:

[...]
ld: library not found for -lLHAPDF
collect2: error: ld returned 1 exit status
error: Command "/usr/local/bin/master/gfortran -Wall -g -Wall -g -undefined
dynamic_lookup -bundle
/var/folders/4c/cbnnj8zs0l728myp8kt89j500000gn/T/tmpW9KIcx/var/folders/4c/cbnnj8zs0l728myp8kt89j500000gn/T/tmpW9KIcx/src.macosx-10.8-x86_64-2.7/rwgt2pymodule.o
/var/folders/4c/cbnnj8zs0l728myp8kt89j500000gn/T/tmpW9KIcx/var/folders/4c/cbnnj8zs0l728myp8kt89j500000gn/T/tmpW9KIcx/src.macosx-10.8-x86_64...

357. By Olivier Mattelaer

try to fix Valentin problem

358. By Olivier Mattelaer

remove golem + other fix related to Valentin review

359. By Olivier Mattelaer

remove pjfry as well

Revision history for this message
Olivier Mattelaer (olivier-mattelaer) wrote :
Download full text (4.8 KiB)

Hi Valentin,

Thanks a lot for those very useful comments.
And for the time on Skype. I'm so happy that it is working on your computer now.

 > But the problem is that if I set it to false then it will still be
> automatically be reassigned to True if I try to launch again. The user will
> certainly don't expect his run_card.dat to be changed on his behalf when it
> does a new run.
> So I'm not sure I like this behavior....

Ok you have a point, I will not do that then.

I have then apply the following.
When the user quit the edition of the card interface.
I check the consistency between the run_card and the reweight_card. and if the user request explicitly the NLO reweighting type, then I force the keep_rwgt_info to True.

I have modified the default reweight_card to always request explicitly the NLO accurate reweighting.
Such that by default, I have the same behavior.

> The cross-sections aren't identical, so this is purely an effect of the
> kamikaze reweighting right?

No you also have an statistical effect. Even if you set all the reweighting factor to be 1
(which is the case of your kamikaze in this case) you will face that the sum of the weights is not equal to the cross-section. This is an effect partly due to the of the negative weights.

Since kamikaze reweighting
> is so fast, I would consider to *always* use this "central reweighting" so
> as to be able to automatically provide the user with an assessment of how
> reliable he can expect the kamikaze reweighting to be for this case.

This is equivalent to simply compute the sum of the weights (up to normalisation) which is ... so much faster than running such kamikaze reweighting. Printing the sum of the weights for the sample is actually an interesting idea.

> Unfortunately, it still crashes at compilation time when doing the exact
> reweighting with lhapdf reweighting. The error being:

Ok we will need to settle that via Skype.

> Ok, that would do I guess. So how would a user do a reweight in LO mode
> with an event that *includes the extra weight*?

You have to put in your reweight_card the line
change mode LO
The fact that the line
"change mode NLO" is now present by default in the reweight_card should clear your confusion on this.

> Also, speaking of this command, its help is a bit minimal, i.e.:
>
> PROCNLO_loop_sm_3>help reweight
> Allow to reweight the events generated with a new choices of model
> parameter.

OK DONE

> And its auto-completion is broken (with a debug statement left in by the
> way).

OK DONE

> Sure this is why I stressed *relative* error. All my comments above
> referred to a *relative* error, so please reconsider my comments with that
> in mind.
> I think this goes along the way of giving more info to the user on the
> reliability of the reweighting

I think that this is too much. They have the information printed it should be the user task to check if it looks correct or not. Actually I do not trust that much the error quoted but this is the best estimator that I have found.

> Did you check this out?
> http://stackoverflow.com/questions/10929162/how-can-i-catch-a-seg-fault-while-
> importing-an-f2py-module

Just did and th...

Read more...

360. By Olivier Mattelaer

reduce the logger to have nicer screen info

361. By Olivier Mattelaer

use the mur value associate to the couter-events for the loop computation

362. By Olivier Mattelaer

merge with latest 2.3.4

363. By Olivier Mattelaer

small fix

Revision history for this message
Valentin Hirschi (valentin-hirschi) wrote :
Download full text (10.0 KiB)

Hi Olivier

> Hi Valentin,
>
> Thanks a lot for those very useful comments.
> And for the time on Skype. I'm so happy that it is working on your computer
> now.
>
>
> > But the problem is that if I set it to false then it will still be
> > automatically be reassigned to True if I try to launch again. The user will
> > certainly don't expect his run_card.dat to be changed on his behalf when it
> > does a new run.
> > So I'm not sure I like this behavior....
>
> Ok you have a point, I will not do that then.
>
> I have then apply the following.
> When the user quit the edition of the card interface.
> I check the consistency between the run_card and the reweight_card. and if the
> user request explicitly the NLO reweighting type, then I force the
> keep_rwgt_info to True.
>
> I have modified the default reweight_card to always request explicitly the NLO
> accurate reweighting.
> Such that by default, I have the same behavior.

I like the default reweight card much better this way.
However, I would change this:

        - For LO sample only LO mode is allowed.
        - NLO runs both NLO_basic and NLO_VT reweighting methods.
        - Read the online manual to check the difference between those modes.

to

        - When reweighting an .lhe event file with LO accuracy, only the LO mode is allowed.
        - When the .lhe file reweighted is at NLO accuracy, then all other modes are allowed;
          read about their definition @ https://cp3.irmp.ucl.ac.be/projects/madgraph/wiki/Reweight

and also:

change mode NLO # Do nothing on LO sample.

->

change mode NLO # No reweighting will be performed if the reweighted .lhe file is at LO accuracy.

Anyway, now I correctly have this happening:

INFO: NLO reweighting is on ON. Automatically set keep_rwgt_info to True
INFO: modify parameter keep_rwgt_info of the run_card.dat to .true.

which is nice but there is still a problem with your dependence on lhapdf with the exact NLO reweighting. You must really check for this at the beginning and take action correspondingly.

I don't know what strategy you want to adopt here, but I would suggest to automatically switch to kamikaze reweighting if lhapdf is not used, but with a big warning. Or 'crash' the run and tell the user to either turn on the kamikaze reweighting or to turn on lhapdf.

>
> > The cross-sections aren't identical, so this is purely an effect of the
> > kamikaze reweighting right?
>
> No you also have an statistical effect. Even if you set all the reweighting
> factor to be 1
> (which is the case of your kamikaze in this case) you will face that the sum
> of the weights is not equal to the cross-section. This is an effect partly due
> to the of the negative weights.

Ok, I understand now.

> Since kamikaze reweighting
> > is so fast, I would consider to *always* use this "central reweighting" so
> > as to be able to automatically provide the user with an assessment of how
> > reliable he can expect the kamikaze reweighting to be for this case.
>
> This is equivalent to simply compute the sum of the weights (up to
> normalisation) which is ... so much faster than running such kamikaze
> reweighting. Printing the sum of t...

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

Hi Valentin,

> I like the default reweight card much better this way.
> However, I would change this:

Not really happy for those proposal.
So I have made another version which should be clearer (and stress that both NLO_VT and NLO_basic are both NLO accurate).

> which is nice but there is still a problem with your dependence on lhapdf with
> the exact NLO reweighting. You must really check for this at the beginning and
> take action correspondingly.

Ok this is handle in a nicer way and the pdf set are automatically downloaded now.

> What about doing a trial import with this:
>
> subprocess.call("python -c 'import module_or_modules_in_question'")
>
> allowing you to nicely handle a crash there? I know this seems clunky but I
> think it is ok and really much better than a python crash. I mean MG5aMC
> crashing with no message whatsoever is really scary for the user and looks
> bad; we should really avoid it at all cost if possible!

I can do that, but this is obviously very limited since all C++/fortran error at run time will not be catched (like Lhapdf do not find the pdfset/... even if python finds it/...)
So I think that the nicer method would be to run the full reweighting in a separate subprocess.
I will do that.

> You have to call this function:
>
> MadLoopInitialize.init_MadLoop in madevent_interface.py
>
> yourself. But it really is a one-liner, so it should really be easy.
> It is best to initialize it first so that you have a trustworthy accuracy
> estimate for the first couple of events you reweight.
>

I tried but it seems ... not working:
root: Error while executing make in /Users/omatt/Documents/eclipse/nlo_reweighting/PROCNLO_loop_sm_85/rw_mevirt/SubProcesses/P1_csx_epve
root: Failed at running the process in /Users/omatt/Documents/eclipse/nlo_reweighting/PROCNLO_loop_sm_85/rw_mevirt/SubProcesses/P1_csx_epve.

> I don't think so (or I don't understand what you meant). The ratio of loop ME
> for the original and new hypothesis can for sure depend on the renormalization
> scale, so it is not enough that the numerator and denominator have the same
> scale, it must *also* be the same scale as used in the original event I think

DONE

Thanks a lot,

Olivier

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

Hi Valentin,

> I like the default reweight card much better this way.
> However, I would change this:

Not really happy for those proposal.
So I have made another version which should be clearer (and stress that both NLO_VT and NLO_basic are both NLO accurate).

> which is nice but there is still a problem with your dependence on lhapdf with
> the exact NLO reweighting. You must really check for this at the beginning and
> take action correspondingly.

Ok this is handle in a nicer way and the pdf set are automatically downloaded now.

> What about doing a trial import with this:
>
> subprocess.call("python -c 'import module_or_modules_in_question'")
>
> allowing you to nicely handle a crash there? I know this seems clunky but I
> think it is ok and really much better than a python crash. I mean MG5aMC
> crashing with no message whatsoever is really scary for the user and looks
> bad; we should really avoid it at all cost if possible!

I can do that, but this is obviously very limited since all C++/fortran error at run time will not be catched (like Lhapdf do not find the pdfset/... even if python finds it/...)
So I think that the nicer method would be to run the full reweighting in a separate subprocess.
I will do that.

> You have to call this function:
>
> MadLoopInitialize.init_MadLoop in madevent_interface.py
>
> yourself. But it really is a one-liner, so it should really be easy.
> It is best to initialize it first so that you have a trustworthy accuracy
> estimate for the first couple of events you reweight.
>

I tried but it seems ... not working:
root: Error while executing make in /Users/omatt/Documents/eclipse/nlo_reweighting/PROCNLO_loop_sm_85/rw_mevirt/SubProcesses/P1_csx_epve
root: Failed at running the process in /Users/omatt/Documents/eclipse/nlo_reweighting/PROCNLO_loop_sm_85/rw_mevirt/SubProcesses/P1_csx_epve.

> I don't think so (or I don't understand what you meant). The ratio of loop ME
> for the original and new hypothesis can for sure depend on the renormalization
> scale, so it is not enough that the numerator and denominator have the same
> scale, it must *also* be the same scale as used in the original event I think

DONE

Thanks a lot,

Olivier

364. By Olivier Mattelaer

fixing automatic download of pdf sets + update reweight card

365. By Olivier Mattelaer

allow to run MadEvent/aMC@NLO in bypassing RunWeb if run from the interface

366. By Olivier Mattelaer

ensure that scan can be use with './bin/madevent launch -f'

367. By Olivier Mattelaer

run reweighting in a separate process + print the sum of event weight for NLO run

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

Hi Valentin,

Just to say that
1) I run now the reweight in a separate process. Such that the main code do not crash.
2) I print the sum of the weights in the final report.
3) The initialisation is still failing (but the code still works nicely) I left the associated error message in the log such that you can look at it if you want.

Cheers,

Olivier

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

Hi Olivier,

I wanted to go back to testing this branch, but still I can't get it working at NLO. Even with the default setup (only turning the REWEIGHT=ON), the code crashes when starting the reweighting with a IndexError: list index out of range (line 1120 in common_run_interface.py).

B.t.w., what's the difference between NLO_basic and NLO_VT ? The wiki-page is not very enlightening on this subject.

Cheers,
Rik

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

Hi,

> IndexError: list index out of range (line 1120 in common_run_interface.py).

Did you have the latest version of the code?
In my computer this lines are:

                if any(t in line for t in ['INFO:', 'WARNING:', 'CRITICAL:', 'ERROR:', 'root:']) and \
                   not ‘***********’ in line: #<<<<<<<<<<<<<line 1120
                        print line[:-1].replace(‘INFO’, 'REWEIGTH')
                elif __debug__ and line:
                    logger.debug(line[:-1])

This is just impossible that line 1120 (or 1119) raise an IndexError.
Line 1121: can not raise an index error (potentially a TypeError but not an IndexError.

So my best guess is that we do not have the same version. I’m at version 367

> B.t.w., what's the difference between NLO_basic and NLO_VT ? The wiki-page is not very enlightening on this subject.

They differ on how they reweight some of the contribution
- the born
- the approximate virtual
- the virtual
They have the same treatment for the various counter-term.

NLO_basic reweighs
- the born by the ratio of the borns
- the approximate virtual by the ratio of the borns
- the virtual by the ratio of the virtual

NLO_VT reweighs those three contributions by the ratio of the sum of the Born and the virtual (B+V).

The interest of those two is that this can enlighten the sensitivity to the virt-trick if they differ from each other.

Cheers,

Olivier

> On Feb 25, 2016, at 08:56, Rikkert Frederix <email address hidden> wrote:
>
> Hi Olivier,
>
> I wanted to go back to testing this branch, but still I can't get it working at NLO. Even with the default setup (only turning the REWEIGHT=ON), the code crashes when starting the reweighting with a IndexError: list index out of range (line 1120 in common_run_interface.py).
>
> B.t.w., what's the difference between NLO_basic and NLO_VT ? The wiki-page is not very enlightening on this subject.
>
> Cheers,
> Rik
>
>
>
> --
> https://code.launchpad.net/~maddevelopers/mg5amcnlo/nlo_reweighting/+merge/283769
> Your team MadDevelopers is subscribed to branch lp:~maddevelopers/mg5amcnlo/2.3.4.

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

Hi Olivier,

Sorry. I had a typo. It's line 1130. I'm using revision 367.

I don't think there is any freedom in doing the reweighting. There can only be one correct way, I think. I believe it is:

1. use the ratio of the Borns for the Born and the counter terms.
2. use the ratio of the virtuals for the virtual and the approximated virtual.

Cheers,
Rik

Revision history for this message
Olivier Mattelaer (olivier-mattelaer) wrote :
Download full text (3.4 KiB)

Hi Rik,

> Sorry. I had a typo. It's line 1130. I’m using revision 367.

Ok, thanks, I will secure that part (This is just to have a nice html output and removing some fake entry).

> I don't think there is any freedom in doing the reweighting. There can only be one correct way, I think.

That’s just not True. Let’s take a simple example (no physics in mind here)

\int(b+v) and you want to reweight to get \int(B+V)
you can easily check that (at least) two reweighting procedure are valid
1)
b term reweighted by B/b
v term reweighted by V/v

2)
b term reweighted by (B+V)/(b+v)
v term reweighted by (B+V)/(b+v)

Both are theoritically correct (in infinite statistic limit).
Only a detail study on how fast they converge (which is likely to be function dependent) can determine which of those two method is the most appropriate.
My feeling is that the second method is more efficient but I actually do not know for sure.

> 1. use the ratio of the Borns for the Born and the counter terms.
> 2. use the ratio of the virtual for the virtual and the approximated virtual.

To take the kind of example above you are trying to reweight:
\int{b+a}+ \int{v-a} = \int(b+v-a+a) and we want to get \int(B+V)
so you can reweight “a” by any factor that you like since the integral does not depend on it at the end.
(So you actually have an infinite number of possible reweighting method)

if we take “a” proportional to “b” then for me the two most natural method are the one I have implemented.
b term reweighted by B/b
v term reweighted by V/v
a term reweighted by A/a=B/b
and
b term reweighted by (B+V)/(b+v)
v term reweighted by (B+V)/(b+v)
a term reweighted by (B+V)/(b+v)

The one that you propose is
b term reweighted by B/b
v term reweighted by V/v
a term reweighted by V/v

The advantage of the first method (which is actually NLO_basic) is that you have \int{b+a} which is re-weighted to \int{B+A} and \int{v+a} which is re-weighted to \int{V+A}.
The second advantage of that method is that this is the most natural one (to my point of view).

The advantage of the two other methods (which can be called NLO_VT and NLO_Rik) is to have “v” and “a” are reweighted by the same factor. Which is arguably an interesting property to avoid the contribution of \int{v-a} to blow up after the reweighting procedure.
I do not think this is that interesting to have both of them implemented in the code (so three NLO accurate one). I would argue that having NLO_VT is slightly more interesting since it applies a global factor to all of them.
Which correspond to the second reweighting method of my first example. Since I have a feeling that it can have some nice mathematical property, I think it is legitimate to prefer that one over the other one.

Cheers,

Olivier

> On Feb 25, 2016, at 12:18, Rikkert Frederix <email address hidden> wrote:
>
> Hi Olivier,
>
> Sorry. I had a typo. It's line 1130. I'm using revision 367.
>
> I don't think there is any freedom in doing the reweighting. There can only be one correct way, I think. I believe it is:
>
> 1. use the ratio of the Borns for the Born and the counter terms....

Read more...

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

Hi Olivier,

Ok. Now I understand. The problem is that this is not what's in the code... In the code the weight that correspond to the virtual is actually 'v-a'. In other words, 'v' and 'a' can currently not be reweighted independently. Which let me (incorrectly) to think that there is only a single method.

This means that NLO_VT and NLO_Rik are correct, but NLO_Basic does currently not give the correct cross section.

I'm pretty sure that the statistical difference between NLO_VT and NLO_Rik would be pretty small, so I suggest to simply use NLO_VT.

Cheers,
Rik

368. By Olivier Mattelaer

secure the html treatment

369. By Olivier Mattelaer

fixing a problem forbiding to run with scan parameter

370. By Olivier Mattelaer

merge with 2.3.4 (including spin2/ninja branch)

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

Hi Olivier,

So I tried again the very default run, that is

generate p p > e+ ve [NLO]
output
launch

Then I turned off the shower and turned on the reweighting (without turning on LHAPDF).
As expected the code turned keep_rwgt_info to True automatically, which is nice, i.e.

NLO reweighting is on ON. Automatically set keep_rwgt_info to True

but then it crashed, probably because it needs lhadpf?
This time around and thanks to the sandboxing I suggested and that you worked hard to implement, the crash is nice:

[...]
DEBUG: Traceback (most recent call last):
DEBUG: File "/Users/valentin/Documents/Work/MG5/nlo_reweighting/PROCNLO_loop_sm_18/bin/internal/amcatnlo_run_interface.py", line 4816, in <module>
DEBUG: except MadEventAlreadyRunning, error:
DEBUG: NameError: name 'MadEventAlreadyRunning' is not defined
ERROR: Reweighting failed
decay_events -from_cards

Then I went on and turned LHAPDF but got the same error as above. So it looks like you have an issue with the fact that you now run the reweight separately but there is of course still the 'RunWeb' tagger file present, so it crashes. How come you didn't run into the same issue?

Even with the kamikaze reweighting (mode LO), the issue above occurs.
So I need it to be fixed in order to continue the review.

Cheers

371. By Olivier Mattelaer

remove the wrong raise of Error, forbid the orig weight to be written in the file

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

Hi Valentin,

This has nothing to do with RunWeb. I implemented a hidden method to run one single command bypassing all interactions with RunWeb.

Looks like the error catching was using a undefined error in amcatnlo_runinterface (while it was define in the madevent one).
and that make the code to fail to crash correctly.

I fix it but you will still face the real crash… (that I have no idea what it is in your case)
I doubt that this is linked to lhapdf since you also have it for kamikaze…

Cheers,

Olivier

> On Feb 28, 2016, at 03:29, Valentin Hirschi <email address hidden> wrote:
>
> Hi Olivier,
>
> So I tried again the very default run, that is
>
> generate p p > e+ ve [NLO]
> output
> launch
>
> Then I turned off the shower and turned on the reweighting (without turning on LHAPDF).
> As expected the code turned keep_rwgt_info to True automatically, which is nice, i.e.
>
> NLO reweighting is on ON. Automatically set keep_rwgt_info to True
>
> but then it crashed, probably because it needs lhadpf?
> This time around and thanks to the sandboxing I suggested and that you worked hard to implement, the crash is nice:
>
> [...]
> DEBUG: Traceback (most recent call last):
> DEBUG: File "/Users/valentin/Documents/Work/MG5/nlo_reweighting/PROCNLO_loop_sm_18/bin/internal/amcatnlo_run_interface.py", line 4816, in <module>
> DEBUG: except MadEventAlreadyRunning, error:
> DEBUG: NameError: name 'MadEventAlreadyRunning' is not defined
> ERROR: Reweighting failed
> decay_events -from_cards
>
> Then I went on and turned LHAPDF but got the same error as above. So it looks like you have an issue with the fact that you now run the reweight separately but there is of course still the 'RunWeb' tagger file present, so it crashes. How come you didn't run into the same issue?
>
> Even with the kamikaze reweighting (mode LO), the issue above occurs.
> So I need it to be fixed in order to continue the review.
>
> Cheers
> --
> https://code.launchpad.net/~maddevelopers/mg5amcnlo/nlo_reweighting/+merge/283769
> Your team MadDevelopers is subscribed to branch lp:~maddevelopers/mg5amcnlo/2.3.4.

372. By Olivier Mattelaer

ensure that the order of the weights is always the same

373. By Olivier Mattelaer

try to fix Valentin problem

374. By Olivier Mattelaer

remove a print statement

375. By Olivier Mattelaer

refactorise directory creation (allow for 2 model @NLO) + remove NLO_Basic + add NLO_tree (for loop-improved mode)

376. By Olivier Mattelaer

fix a parsing error in presence of second process definition

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

Hi Rik,

>I'm pretty sure that the statistical difference between NLO_VT and NLO_Rik would be pretty small, > so I suggest to simply use NLO_VT.

I tried to fix the code to have the correct NLO_basic but I failed.
Therefore I implemented your suggestion (and renamed it to NLO).

Cheers,

Olivier

377. By Olivier Mattelaer

fix a problem for Loop Induced Reweighting

378. By Olivier Mattelaer

secure last fix

379. By Rikkert Frederix

fixed the problem with ngluon

380. By Olivier Mattelaer

Automatic download of lhapdf set for SysCalc

Revision history for this message
Valentin Hirschi (valentin-hirschi) wrote :
Download full text (6.2 KiB)

Hi Olivier,

Let me continue this review

a) My OCD at work again, sorry:
    >> NLO reweighting is on ON. Automatically set keep_rwgt_info to True --> detail: you could remove the 'on' ON.
    >> remove leading space in ' When doing NLO reweighting, MG5aMC canno'
    >> generating the square matrix element for reweighting -> generating squared matrix element for reweighting
    >> REWEIGHT: starts to compute weight for events with the following modification to the param_card:
REWEIGHT: change model loop_qcd_qed_sm
DEBUG: change process p p > e+ ve
DEBUG: change process p p > e+ ve j

why only showing the first line in 'INFO' and the rest in 'DEBUG' ? imho, the whole set of lines should be in INFO.

b) Debug left at:
CRITICAL: w_orig, w_new, w_new/w_orig = 0.393281380656 0.393281380656 1.0 [reweight_interface.py at line 813]

c) I tried to run the default PY8 analysis for p p > e+ ve [QCD] with your kamikaze reweighting 'ON', i.e.
by setting 'py8an_HwU_pp_lvl.o HwU.o' in the analysis parameter of the shower card, and it fails with:

terminate called after throwing an instance of 'std::runtime_error'
  what(): Tried to read a file which does not start with the LesHouchesEvents tag.
Abort trap: 6

This seems to come from the fact that the events are gzipped again before the shower step.
If I unzip them by hand and try again, it runs further but the shower+analysis stops again with the error message:

 WW(1) = 0. Stopping

So maybe the shower analysis must be updated so as to work with your reweighting (check with the improved_scale_pdf_variation branch, maybe this is already done there).
In any case, please make sure that you can run a default shower analysis on top of your reweighting.

d) In the card, I think it would be better to use another example than:

# SPECIFY A PATH OR USE THE SET COMMAND LIKE THIS:
 25 # set sminputs 1 130 # modify 1/alpha_EW

because with the above, you will change the W mass with the default EW input scheme and this is typically a dangerous thing to do.

e) I tried to reweight p p > e+ ve [QCD] in less conventional ways, with:

change mode NLO # Define type of Reweighting. For LO sample this command
                     # has no effect since only "LO" mode is allowed.
change model loop_qcd_qed_sm
change process u d~ > e+ ve QCD=99 QED=99 [virt=QCD QED]
change process c s~ > e+ ve QCD=99 QED=99 [virt=QCD QED] --add
launch

But it crashed with:

DEBUG: Command "reweight run_03 -from_cards" interrupted with error:
DEBUG: InvalidCmd : No particle qcd=99 in model

I think it is important that any valid process syntax gets correctly parsed by the reweighting module.
Then I tried with

change model loop_qcd_qed_sm
change process u d~ > e+ ve
change process c s~ > e+ ve --add
launch

DEBUG: Command "reweight run_03 -from_cards" interrupted with error:
DEBUG: KeyError : ((2, 21), (-11, 1, 12))

I guess I am missing some processes, but it would be nice if the error was more explicit!
So I tried again with something like :

change model loop_qcd_qed_sm
change process p p > e+ ve
change process p p > e+ ve j --add
launch

But this time crashed with:

CRITICAL: w_orig, w_new, w_new/w_orig = 4.3346035354e-05 4.3346...

Read more...

review: Needs Fixing
Revision history for this message
Olivier Mattelaer (olivier-mattelaer) wrote :
Download full text (9.0 KiB)

Hi,

a) why only showing the first line in 'INFO' and the rest in 'DEBUG' ? imho, the whole set of lines should be in INFO.
The sandboxing, allow very low control on what is printed, so if a line do not start by INFO, it pass in DEBUG.

> b) Debug left at:
> CRITICAL: w_orig, w_new, w_new/w_orig = 0.393281380656 0.393281380656 1.0 [reweight_interface.py at line 813]

Sorry, I was studying a weird behavior today and forget to remove that print statement.

> c) I tried to run the default PY8 analysis for p p > e+ ve [QCD] with your kamikaze reweighting 'ON', i.e.
> by setting 'py8an_HwU_pp_lvl.o HwU.o' in the analysis parameter of the shower card, and it fails with:

It runs fine with HW6. Never succeed to run PY8 analysis… so I will keep it like that.
Paolo told me that the parsing should have be fine….

> d) In the card, I think it would be better to use another example than:

This is fine like that

> e) I think it is important that any valid process syntax gets correctly parsed by the reweighting module.

The problem is that a lower case is applied… The parser is the one of madgraph.
Will check why.
But the first fix is to allow such syntax. (why the coupling order should be case sensitive)

> I guess I am missing some processes, but it would be nice if the error was more explicit!

That is fine like that

> f) The following syntax instruction in the reweight card is wrong:

Thanks. fixed

> g) Can I ask you a favor? Could you add your fortran wrapper that includes all relevant MadLoop functions as well as the f2py meta-codes in the standalone MadLoop output as well? (and make sure there is a target in the makefile to f2py it). I find it very cool and it would be nice to have it available in the standalone output (doesn’t cost anything).

I guess you know the answer.

> h) Related to the point above, the reason why the intialization failed is because you have substituted check_sa.f !!!! So of course now it has not ‘main' program statement and when you try to compile it, you get :

Do not see what you are talking about.

Cheers,

Olivier

> On Mar 3, 2016, at 00:15, Valentin Hirschi <email address hidden> wrote:
>
> Review: Needs Fixing
>
> Hi Olivier,
>
> Let me continue this review
>
> a) My OCD at work again, sorry:
>>> NLO reweighting is on ON. Automatically set keep_rwgt_info to True --> detail: you could remove the 'on' ON.
>>> remove leading space in ' When doing NLO reweighting, MG5aMC canno'
>>> generating the square matrix element for reweighting -> generating squared matrix element for reweighting
>>> REWEIGHT: starts to compute weight for events with the following modification to the param_card:
> REWEIGHT: change model loop_qcd_qed_sm
> DEBUG: change process p p > e+ ve
> DEBUG: change process p p > e+ ve j
>
> why only showing the first line in 'INFO' and the rest in 'DEBUG' ? imho, the whole set of lines should be in INFO.
>
> b) Debug left at:
> CRITICAL: w_orig, w_new, w_new/w_orig = 0.393281380656 0.393281380656 1.0 [reweight_interface.py at line 813]
>
> c) I tried to run the default PY8 analysis for p p > e+ ve [QCD] with you...

Read more...

Revision history for this message
Valentin Hirschi (valentin-hirschi) wrote :
Download full text (10.2 KiB)

Him
> Hi,
>
> a) why only showing the first line in 'INFO' and the rest in 'DEBUG' ? imho,
> the whole set of lines should be in INFO.
> The sandboxing, allow very low control on what is printed, so if a line do not
> start by INFO, it pass in DEBUG.

Ok, then maybe just print these lines all one by one so that they are prefixed by INFO and therefore correctly handled by the sandboxing? Anyway, up to you.

>
> > b) Debug left at:
> > CRITICAL: w_orig, w_new, w_new/w_orig = 0.393281380656 0.393281380656 1.0
> [reweight_interface.py at line 813]
>
> Sorry, I was studying a weird behavior today and forget to remove that print
> statement.
>
> > c) I tried to run the default PY8 analysis for p p > e+ ve [QCD] with your
> kamikaze reweighting 'ON', i.e.
> > by setting 'py8an_HwU_pp_lvl.o HwU.o' in the analysis parameter of the
> shower card, and it fails with:
>
>
> It runs fine with HW6. Never succeed to run PY8 analysis… so I will keep it
> like that.
> Paolo told me that the parsing should have be fine….

I confirm that an HW6 run or PYTHIA6PT run goes through fine, so this issue is really a problem of the parsing in the py8 driver/analysis which is not really part of this branch, so it will have to be fixed somewhere else I agree. But I think that it is important that it will; hopefully this will come for free when merging with the improved_scale/pdf branch.

>
> > d) In the card, I think it would be better to use another example than:
>
> This is fine like that
>
> > e) I think it is important that any valid process syntax gets correctly
> parsed by the reweighting module.
>
> The problem is that a lower case is applied… The parser is the one of
> madgraph.
> Will check why.
> But the first fix is to allow such syntax. (why the coupling order should be
> case sensitive)

I don't see why they shouldn't be case sensitive. Anyway, there should be no need for a lower_case() here no?

>
> > I guess I am missing some processes, but it would be nice if the error was
> more explicit!
>
> That is fine like that

Ok.
You didn't reply to the other issues I found when changing the model, processes and directory to reuse. So when doing exact NLO reweighting how are these process definition used? How do you reweight differently the Born and virtual in this case?

>
> > f) The following syntax instruction in the reweight card is wrong:
>
> Thanks. fixed
>
>
> > g) Can I ask you a favor? Could you add your fortran wrapper that includes
> all relevant MadLoop functions as well as the f2py meta-codes in the
> standalone MadLoop output as well? (and make sure there is a target in the
> makefile to f2py it). I find it very cool and it would be nice to have it
> available in the standalone output (doesn’t cost anything).
>
> I guess you know the answer.

The answer is yes because it's just a simple 'cp command' to add to the standalone output? Great, thanks.

>
> > h) Related to the point above, the reason why the intialization failed is
> because you have substituted check_sa.f !!!! So of course now it has not
> ‘main' program statement and when you try to compile it, you get :
>
> Do not see what you are talking about.

We sorted that out o...

381. By Olivier Mattelaer

implement some of the comment of Valentin

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

Here is just a summary of the status of my review since it is likely to go idle for a couple of weeks.

a) As far as the use of 'change process' for NLO reweighting is concerned, it seems both powerful but also quite tricky and not fully explained on the wiki when used in the NLO context.
If this is intended to remain a 'hidden' functionality for now, I suggest that whenever a 'change process' is issued for NLO reweighting, a message warns the user that this is an alpha functionality that requires expertise.
Anyway, many of the issues reported in my previous mail have been fixed over our skype session, so as far as 'change process' at NLO goes, things are fine like this, with maybe the message above if you like it too.

b) The 'change_rwgt_dir' option didn't seem to work.

c) The loop initialization is maybe not ideal so if you skip it is fine, but then make sure to call the subroutine
 CALL ML5_0_FORCE_STABILITY_CHECK(.True.)
to make sure that you get a stability estimate even during the first calls which will be during initialization for which there is no stability test by default. The above would enforce it.

d) It is important not to use check_sa.f as being both the fortran driver *and* the f2py wrapper. This should be a separate file, say 'f2py_wrapper.f' that you use to make the matrix<n>.so.

e) Also, it would be nice to add the file 'f2py_wrapper.f' mentioned above to the default MadLoop standalone output. If you don't want to do it, then let me know when you'll have this file and I'll do it myself, no problem.

f) In the MadLoop makefile there is a new rule which seems to be designed to make a static library for just one Pxxx process, i.e.

$(MADLOOP_LIB): $(OLP_PROCESS)
ifeq ($(ROOT), ../..)
 cd ..;make ../lib/libMadLoop.$(libext);cd -
else
 ar rcs libMadLoop.$(libext) $(OLP_PROCESS)
 mv libMadLoop.$(libext) $(MADLOOP_LIB)
endif

I don't think that it makes much sense, also because it conflicts with the rule of the same name in MadLoop_makefile_definitions. There is no real reason not to generate the library for all SubProcesses at once by doing 'make OLP_static' in the Subprocesses directory.
So I think that f2py should be linked directly to the static MadLoop library that includes all the processes and can be compiled in the usual way with the existing rule in MadLoop_makefile_definitions or at least this rule for a MadLoop library of only one subprocess must be renamed so as not to create a conflict with the existing one.

That's all, sorry for being such a picky reviewer; I promise to accept the branch right away once the above points are discussed/addressed ;) !

Cheers

382. By Olivier Mattelaer

Fix the rwgt_dir option for NLO reweighting

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

Hi,

> a) As far as the use of 'change process' for NLO reweighting is concerned, it
> seems both powerful but also quite tricky and not fully explained on the wiki
> when used in the NLO context.
> If this is intended to remain a 'hidden' functionality for now, I suggest that
> whenever a 'change process' is issued for NLO reweighting, a message warns the
> user that this is an alpha functionality that requires expertise.
> Anyway, many of the issues reported in my previous mail have been fixed over
> our skype session, so as far as 'change process' at NLO goes, things are fine
> like this, with maybe the message above if you like it too.

Will keep it like that, simple redefinition works. And this options is fully fonctional for LO type of reweighting.

> b) The 'change_rwgt_dir' option didn't seem to work.

Actually, I left that unchecked on purpose, In the idea to do it if someone (=CMS) want to have such mode. But since you point it here. I have taken the time to make it work.
Pretty sure no one will use it but ok.

> c) The loop initialization is maybe not ideal so if you skip it is fine, but
> then make sure to call the subroutine
> CALL ML5_0_FORCE_STABILITY_CHECK(.True.)
> to make sure that you get a stability estimate even during the first calls
> which will be during initialization for which there is no stability test by
> default. The above would enforce it.

Done.
Not fully sure where I have to put such line.
So please check (and if this is not correct please indicate me where you want such line)

> d) It is important not to use check_sa.f as being both the fortran driver
> *and* the f2py wrapper. This should be a separate file, say 'f2py_wrapper.f'
> that you use to make the matrix<n>.so.

Well I do not see the point here. check_sa is suppose to be a working template to present one way to call the loop computation nothing more right? So what is the point.

> e) Also, it would be nice to add the file 'f2py_wrapper.f' mentioned above to
> the default MadLoop standalone output. If you don't want to do it, then let me
> know when you'll have this file and I'll do it myself, no problem.

ok I put the file, but then you will need to modify the makefile since now it is pointless to have a file that you can not compile...

> f) In the MadLoop makefile there is a new rule which seems to be designed to
> make a static library for just one Pxxx process, i.e.

Here the best is that you perform the modification that you want directly.
It will be more efficient and less error prone. Especially since you have to change it anyway because of the above file.

> That's all, sorry for being such a picky reviewer; I promise to accept the
> branch right away once the above points are discussed/addressed ;) !

Thanks to you.

Cheers,

Olivier

383. By Olivier Mattelaer

last modif request by Valentin

384. By Valentin Hirschi

1. Fixed the makefile targets for generating the MadLoop library. It is still not very elegant, but at least now there
   is some logic and no conflict of rules with the one $(MADLOOPLIB) used in aMC@NLO runs.
2. No longer modifying check_sa.f in the reweighting but doing all with f2py_wrapper.py
3. Added a f2py driver for MadLoop standalone output which compiles itself when simply doing '.\check_sa.py', so neat!!

385. By Valentin Hirschi

1. Fixed a type in 'check_sa.py.inc' template file

Revision history for this message
Valentin Hirschi (valentin-hirschi) wrote :
Download full text (5.8 KiB)

Hi Olivier,
> Hi,
>
>
> > a) As far as the use of 'change process' for NLO reweighting is concerned,
> it
> > seems both powerful but also quite tricky and not fully explained on the
> wiki
> > when used in the NLO context.
> > If this is intended to remain a 'hidden' functionality for now, I suggest
> that
> > whenever a 'change process' is issued for NLO reweighting, a message warns
> the
> > user that this is an alpha functionality that requires expertise.
> > Anyway, many of the issues reported in my previous mail have been fixed over
> > our skype session, so as far as 'change process' at NLO goes, things are
> fine
> > like this, with maybe the message above if you like it too.
>
> Will keep it like that, simple redefinition works. And this options is fully
> fonctional for LO type of reweighting.

I think that if 'change process' is only partially working at NLO, there must be warning of some sort, or ideally MG5aMC should detect and crash on the cases which are not supported (see my comments for point b. below).
But ok, I agree that this is quite of a marginal use, so it is up to you.

>
> > b) The 'change_rwgt_dir' option didn't seem to work.
>
> Actually, I left that unchecked on purpose, In the idea to do it if someone
> (=CMS) want to have such mode. But since you point it here. I have taken the
> time to make it work.
> Pretty sure no one will use it but ok.

I am strongly against having (advertised, i.e. non-hidden) features of the code which are partially functional. This is dangerous on a longer term, and even for options rarely used like 'change_rwgt_dir'.
My philosophy is that MG5aMC should always either support an option/functionality correctly or stop immediately saying that this option is not supported.
Any in-between behavior is dangerous and should be prohibited. So I am happy that you settled for fixing it (rather than forbidding it).
And I don't agree that nobody will use it, one can save a lot of time this way and I am really happy that there is a way to control what, when and where stuff should be reused. Thanks.

> > c) The loop initialization is maybe not ideal so if you skip it is fine, but
> > then make sure to call the subroutine
> > CALL ML5_0_FORCE_STABILITY_CHECK(.True.)
> > to make sure that you get a stability estimate even during the first calls
> > which will be during initialization for which there is no stability test by
> > default. The above would enforce it.
>
> Done.
> Not fully sure where I have to put such line.
> So please check (and if this is not correct please indicate me where you want
> such line)

With my fix of the points below, the initialization does go through now. But I understand why you might still want not to use it.
Anyway, I checked that where you placed this call is indeed correct, so it is ok.

>
> > d) It is important not to use check_sa.f as being both the fortran driver
> > *and* the f2py wrapper. This should be a separate file, say 'f2py_wrapper.f'
> > that you use to make the matrix<n>.so.
>
> Well I do not see the point here. check_sa is suppose to be a working template
> to present one way to call the loop computation nothing more right? So what is
> the point...

Read more...

review: Approve
386. By Valentin Hirschi

1. Fixed estheatics in check_sa.py

387. By Olivier Mattelaer

better comparison of energy-momentum conservation in ML. Fix NLO_tree (loop_improved)

388. By Olivier Mattelaer

merge with latest 2.3.4

389. By Olivier Mattelaer

fix a problem with alpha_s and with the merging of two fks particle+ add security if particle are too soft/colinear (then use born ratio)

390. By Olivier Mattelaer

allow to specify the tag of the reweighting label

391. By Olivier Mattelaer

improve check to 0 momenta in MadLoop (re-introduce some absolute lower band)

392. By Olivier Mattelaer

1) Change the handling of make_opts to fix the -lstdc++ problem related to f2py
2) fix various problem with the possibility to choose the name of the weight_tag in the reweithing
3) Change some lhapdf interface to be compatible with lhapdf5

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

Hi Olivier,

I approve this branch. Just, quickly fix the order for the linking in the makefile as we found out by e-mail.

Cheers,
Rik

review: Approve
393. By Valentin Hirschi

1. Fixed the issue in testIO_ProcOutputIOTests. Didn't update the IOTest because you have to review your changes in the ref files.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Template/Common/Cards/reweight_card_default.dat'
2--- Template/Common/Cards/reweight_card_default.dat 2015-08-11 12:18:25 +0000
3+++ Template/Common/Cards/reweight_card_default.dat 2016-03-16 17:59:03 +0000
4@@ -1,13 +1,9 @@
5 #*************************************************************************
6-# Reweight Module *
7+# Reweight Module *
8+# Matrix-Element reweighting at LO/NLO *
9+# Mattelaer Olivier arxiv:xxxx.xxxx *
10 #*************************************************************************
11-#
12-# Reweighting by Leading Order (tree-level / loop-induced) matrix
13-# elements
14-#
15-# Caution: this is not (in general) NLO accurate, even when starting
16-# with NLO accurate events.
17-#
18+#
19 # Note:
20 # 1) the value of alpha_s will be used from the event so the value in
21 # the param_card is not taken into account.
22@@ -17,15 +13,32 @@
23 # width leads to very inaccurate result). In such a case, separate
24 # event generation runs are needed.
25 #
26+#************************************************************************
27+# ENTER YOUR COMMANDS BELOW.
28+#************************************************************************
29+
30+change mode NLO # Define type of Reweighting. For LO sample this command
31+ # has no effect since only "LO" mode is allowed.
32+
33+launch
34+# SPECIFY A PATH OR USE THE SET COMMAND LIKE THIS:
35+# set sminputs 1 130 # modify 1/alpha_EW
36+
37+
38+
39+#************************************************************************
40+# Manual: https://cp3.irmp.ucl.ac.be/projects/madgraph/wiki/Reweight
41+#************************************************************************
42 #
43 # Example of (standard) code for the computation of two weights:
44 #
45-# launch ! tag to start the computat'n of the first weight
46+# launch ! tag to start the computation of the first weight
47 # set BLOCKNAME ID VALUE ! rule to modify the current param_card
48 # set BLOCKNAME ID VALUE ! rule to modify the current param_card
49 # launch ! start to compute a second weight
50 # /home/Cards/param_card_2.dat ! you can also enter a path to a valid card
51 #
52+# Note: The command to specify the parameter are AFTER the associated "launch"
53 #
54 # Possible options:
55 # You can enter one of the following lines to customize the reweighting
56@@ -35,17 +48,22 @@
57 # with. In this case you need to provide the path to a correct
58 # param_card for the new model; you cannot modify the original one
59 # with the 'set' command.
60-# change process DEF [-add]: change the process by which you reweight.
61+# change process DEF [--add]: change the process by which you reweight.
62 # The initial and final state particles of the new process should
63 # be exactly identical to the ones in the original process.
64 # change helicity False: perform the reweighting by helicity summed
65 # matrix-elements even if the events have been written with a
66-# single helicity state.
67-#
68-#*************************************************************************
69-# ENTER YOUR COMMANDS BELOW.
70-#*************************************************************************
71+# single helicity state.
72+# change mode XXX: change the type of reweighting performed.
73+# allowed values: LO, NLO, LO+NLO
74+# - This command has no effect for reweighting an .lhe event file with LO accuracy.
75+# In that case LO mode is always used (whatever entry is set).
76+# - When the .lhe file reweighted is at NLO accuracy, then all modes are allowed.
77+# * "LO" is an approximate leading order method
78+# * "NLO" is the NLO accurate method
79+# * "LO+NLO" runs both
80+# - "NLO" and "LO+NLO" modes requires 'keep_rwgt_info' equals True (run_card.dat)
81+# If the reweighting is done at generation level this parameter will
82+# automatically be set on True.
83+#************************************************************************
84
85-launch
86-# SPECIFY A PATH OR USE THE SET COMMAND LIKE THIS:
87-# set sminputs 1 130 # modify 1/alpha_EW
88
89=== modified file 'Template/LO/Source/make_opts'
90--- Template/LO/Source/make_opts 2016-03-04 16:16:23 +0000
91+++ Template/LO/Source/make_opts 2016-03-16 17:59:03 +0000
92@@ -1,18 +1,35 @@
93-# Environment variables
94+DEFAULT_F2PY_COMPILER=f2py
95+DEFAULT_F_COMPILER=gfortran
96+MACFLAG=-mmacosx-version-min=10.7
97+DEFAULT_CPP_COMPILER=clang
98+STDLIB=-lc++
99+STDLIB_FLAG=-stdlib=libc++
100+#end_of_make_opts_variables
101+# Rest of the makefile
102
103 ifeq ($(origin FFLAGS),undefined)
104- FFLAGS= -O -w -fbounds-check -fPIC
105- #FFLAGS+= -g -fbounds-check -ffpe-trap=invalid,zero,overflow,underflow,denormal -Wall
106-endif
107+FFLAGS= -O -w -fbounds-check -fPIC
108+#FFLAGS+= -g -fbounds-check -ffpe-trap=invalid,zero,overflow,underflow,denormal -Wall
109+endif
110+
111+
112+# REMOVE MACFLAG IF NOT ON MAC OR FOR F2PY
113+UNAME := $(shell uname -s)
114+ifdef f2pymode
115+MACFLAG=
116+else
117+ifneq ($(UNAME), Darwin)
118+MACFLAG=
119+endif
120+endif
121+
122
123 ifeq ($(origin CXXFLAGS),undefined)
124- #CXXFLAGS= -g
125- CXXFLAGS= -O -stdlib=libc++ -mmacosx-version-min=10.7
126+CXXFLAGS= -O -stdlib=libc++ $(MACFLAG)
127 endif
128
129 ifeq ($(origin CFLAGS),undefined)
130- #CFLAGS= -g
131- CFLAGS= -O -stdlib=libc++ -mmacosx-version-min=10.7
132+CFLAGS= -O -stdlib=libc++ $(MACFLAG)
133 endif
134
135 # Increase the number of allowed charcters in a Fortran line
136@@ -20,57 +37,57 @@
137
138 # Set FC unless it's defined by an environment variable
139 ifeq ($(origin FC),default)
140- FC=gfortran
141+FC=gfortran
142 endif
143 ifeq ($(origin F2PY), undefined)
144- F2PY=f2py
145+F2PY=f2py
146 endif
147
148 UNAME := $(shell uname -s)
149 ifeq ($(origin LDFLAGS), undefined)
150-LDFLAGS=-lc++ -mmacosx-version-min=10.7
151+LDFLAGS=$(STDLIB) $(MACFLAG)
152 endif
153
154 # Options: dynamic, lhapdf
155 # Option dynamic
156
157 ifeq ($(UNAME), Darwin)
158- dylibext=dylib
159+dylibext=dylib
160 else
161- dylibext=so
162+dylibext=so
163 endif
164
165 ifdef dynamic
166- ifeq ($(UNAME), Darwin)
167- libext=dylib
168- FFLAGS+= -fno-common
169- LDFLAGS += -bundle
170- define CREATELIB
171- $(FC) -dynamiclib -undefined dynamic_lookup -o $(1) $(2)
172- endef
173- else
174- libext=so
175- FFLAGS+= -fPIC
176- LDFLAGS += -shared
177- define CREATELIB
178- $(FC) $(FFLAGS) $(LDFLAGS) -o $(1) $(2)
179- endef
180- endif
181-else
182- libext=a
183- define CREATELIB
184- $(AR) cru $(1) $(2)
185- ranlib $(1)
186- endef
187+ifeq ($(UNAME), Darwin)
188+libext=dylib
189+FFLAGS+= -fno-common
190+LDFLAGS += -bundle
191+define CREATELIB
192+$(FC) -dynamiclib -undefined dynamic_lookup -o $(1) $(2)
193+endef
194+else
195+libext=so
196+FFLAGS+= -fPIC
197+LDFLAGS += -shared
198+define CREATELIB
199+$(FC) $(FFLAGS) $(LDFLAGS) -o $(1) $(2)
200+endef
201+endif
202+else
203+libext=a
204+define CREATELIB
205+$(AR) cru $(1) $(2)
206+ranlib $(1)
207+endef
208 endif
209
210 # Option lhapdf
211
212 ifdef lhapdf
213- CXXFLAGS += $(shell $(lhapdf) --cppflags)
214- alfas_functions=alfas_functions_lhapdf
215- llhapdf=-lLHAPDF
216+CXXFLAGS += $(shell $(lhapdf) --cppflags)
217+alfas_functions=alfas_functions_lhapdf
218+llhapdf+= -lLHAPDF
219 else
220- alfas_functions=alfas_functions
221- llhapdf=
222-endif
223+alfas_functions=alfas_functions
224+llhapdf=
225+endif
226\ No newline at end of file
227
228=== modified file 'Template/LO/bin/madevent'
229--- Template/LO/bin/madevent 2015-03-14 02:21:38 +0000
230+++ Template/LO/bin/madevent 2016-03-16 17:59:03 +0000
231@@ -164,7 +164,10 @@
232 cmd_line.run_cmd('quit')
233 elif args:
234 # a single command is provided
235- cmd_line = cmd_interface.MadEventCmd()
236+ if options.web:
237+ cmd_line = cmd_interface.MadEventCmd()
238+ else:
239+ cmd_line = cmd_interface.MadEventCmdShell()
240 if not hasattr(cmd_line, 'do_%s' % args[0]):
241 if parser_error:
242 print parser_error
243
244=== modified file 'Template/NLO/Cards/run_card.dat'
245--- Template/NLO/Cards/run_card.dat 2015-11-02 16:43:45 +0000
246+++ Template/NLO/Cards/run_card.dat 2016-03-16 17:59:03 +0000
247@@ -81,6 +81,7 @@
248 %(muf1_ref_fixed)s = muF1_ref_fixed ! fixed fact reference scale for pdf1
249 %(muf2_ref_fixed)s = muF2_ref_fixed ! fixed fact reference scale for pdf2
250 %(dynamical_scale_choice)s = dynamical_scale_choice ! Choose one of the preselected dynamical choices
251+ %(keep_rwgt_info)s = keep_rwgt_info ! keep the information for reweighting (leads to an .lhe event file about ~5 times larger)
252 #***********************************************************************
253 # Renormalization and factorization scales (advanced and NLO options) *
254 #***********************************************************************
255
256=== modified file 'Template/NLO/MCatNLO/HWAnalyzer/hw6an_HwU_pp_V.f'
257--- Template/NLO/MCatNLO/HWAnalyzer/hw6an_HwU_pp_V.f 2015-12-04 15:47:32 +0000
258+++ Template/NLO/MCatNLO/HWAnalyzer/hw6an_HwU_pp_V.f 2016-03-16 17:59:03 +0000
259@@ -129,7 +129,7 @@
260 ENDIF
261 c
262 c CHOOSE IDENT=24 FOR W+, IDENT=-24 FOR W-, IDENT=23 FOR Z0
263- IDENT=24
264+ IDENT=23
265 C INCOMING PARTONS MAY TRAVEL IN THE SAME DIRECTION: IT''S A POWER-SUPPRESSED
266 C EFFECT, SO THROW THE EVENT AWAY
267 IF(SIGN(1.D0,PHEP(3,4)).EQ.SIGN(1.D0,PHEP(3,5)))THEN
268
269=== modified file 'Template/NLO/MCatNLO/srcHerwig/madfks_hwlhin.f'
270--- Template/NLO/MCatNLO/srcHerwig/madfks_hwlhin.f 2015-06-12 07:34:40 +0000
271+++ Template/NLO/MCatNLO/srcHerwig/madfks_hwlhin.f 2016-03-16 17:59:03 +0000
272@@ -127,13 +127,16 @@
273 read(iunit,404)wgtxsecPDF(nps),wgtxsecPDF(nng)
274 enddo
275 read(iunit,'(a)')string
276- elseif(jwgtinfo.eq.9)then
277+ elseif(abs(jwgtinfo).eq.9)then
278 if (numscales.eq.0 .and. numPDFpairs.eq.0) then
279 write (*,*) 'event file not correct format'
280 write(*,*)'FATAL ERROR #3 IN UPEVNT'
281 stop
282 endif
283- read(iunit,'(a)')string
284+ string = ''
285+ do while(index(string,'</event>').eq.0.and.index(string,'<rwgt>').eq.0)
286+ read(iunit,'(a)')string
287+ enddo
288 wgtref=XWGTUP/MQQ
289 do i=1,numscales
290 do j=1,numscales
291@@ -293,7 +296,7 @@
292 ENDDO
293 nwgt=nwgt+numPDFpairs
294 numPDFpairs=numPDFpairs/2
295- ELSEIF( INDEX(STRING,"<weightgroup type='mg_reweighting'").ne.0
296+ ELSEIF( INDEX(STRING,"<weightgroup name='mg_reweighting'").ne.0
297 $ .and.STRING(1:1).ne.'#') then
298 DO WHILE (.TRUE.)
299 READ(61,'(a)') STRING
300
301=== modified file 'Template/NLO/MCatNLO/srcPythia/madfks_pylhin.f'
302--- Template/NLO/MCatNLO/srcPythia/madfks_pylhin.f 2015-06-12 07:34:40 +0000
303+++ Template/NLO/MCatNLO/srcPythia/madfks_pylhin.f 2016-03-16 17:59:03 +0000
304@@ -130,13 +130,16 @@
305 read(iunit,404)wgtxsecPDF(nps),wgtxsecPDF(nng)
306 enddo
307 read(iunit,'(a)')string
308- elseif(jwgtinfo.eq.9)then
309+ elseif(abs(jwgtinfo).eq.9)then
310 if (numscales.eq.0 .and. numPDFpairs.eq.0) then
311 write (*,*) 'event file not correct format'
312 write(*,*)'FATAL ERROR #3 IN UPEVNT'
313 stop
314 endif
315- read(iunit,'(a)')string
316+ string = ''
317+ do while(index(string,'</event>').eq.0.and.index(string,'<rwgt>').eq.0)
318+ read(iunit,'(a)')string
319+ enddo
320 wgtref=XWGTUP/MQQ
321 do i=1,numscales
322 do j=1,numscales
323@@ -295,7 +298,7 @@
324 ENDDO
325 nwgt=nwgt+numPDFpairs
326 numPDFpairs=numPDFpairs/2
327- ELSEIF( INDEX(STRING,"<weightgroup type='mg_reweighting'").ne.0
328+ ELSEIF( INDEX(STRING,"<weightgroup name='mg_reweighting'").ne.0
329 $ .and.STRING(1:1).ne.'#') then
330 DO WHILE (.TRUE.)
331 READ(61,'(a)') STRING
332
333=== modified file 'Template/NLO/Source/make_opts.inc'
334--- Template/NLO/Source/make_opts.inc 2016-02-12 00:05:24 +0000
335+++ Template/NLO/Source/make_opts.inc 2016-03-16 17:59:03 +0000
336@@ -1,19 +1,38 @@
337-# Environment variables
338+STDLIB = -lc++
339+STDLIB_FLAG = -stdlib=libc++
340+MACFLAG = -mmacosx-version-min=10.7
341+DEFAULT_F_COMPILER = gfortran
342+DEFAULT_F2PY_COMPILER = f2py
343+DEFAULT_CPP_COMPILER = g++
344+#end_of_make_opts_variables
345
346+# Rest of the makefile
347 ifeq ($(origin FFLAGS),undefined)
348 #FFLAGS= -O -w
349 FFLAGS = -O -fno-automatic
350 #FFLAGS+= -g -fbounds-check -ffpe-trap=invalid,zero,overflow,underflow,denormal -Wall
351 endif
352
353+# REMOVE MACFLAG IF NOT ON MAC
354+UNAME := $(shell uname -s)
355+ifneq ($(UNAME), Darwin)
356+ MACFLAG=
357+endif
358+
359+
360 ifeq ($(origin CXXFLAGS),undefined)
361 #CXXFLAGS= -g
362- CXXFLAGS = -O
363+ CXXFLAGS = -O $(STDLIB_FLAG) $(MACFLAG)
364 endif
365
366 ifeq ($(origin CFLAGS),undefined)
367 #CFLAGS= -g
368- CFLAGS = -O
369+ CFLAGS = -O $(STDLIB_FLAG) $(MACFLAG)
370+endif
371+
372+# REMOVE MACFLAG IF IN F2PY mode
373+ifdef f2pymode
374+ MACFLAG=
375 endif
376
377 # Increase the number of allowed charcters in a Fortran line
378@@ -22,21 +41,21 @@
379 # Set FC unless it's defined by an environment variable
380 ifeq ($(origin FC),default)
381 # FC=g77
382- FC=gfortran
383+ FC=$(DEFAULT_F_COMPILER)
384 endif
385 # Set F2PY unless it's defined by an environment variable
386 ifeq ($(origin F2PY),undefined)
387- F2PY=f2py
388+ F2PY=$(DEFAULT_F2PY_COMPILER)
389 endif
390
391 # Set CXX unless it's defined by an environment variable
392 ifeq ($(origin CXX),default)
393- CXX=g++
394+ CXX=$(DEFAULT_CPP_COMPILER)
395 endif
396
397 UNAME := $(shell uname -s)
398 ifeq ($(origin LDFLAGS), undefined)
399- LDFLAGS=-lc++
400+ LDFLAGS=$(STDLIB)
401 endif
402 # Options: dynamic, lhapdf
403
404@@ -73,7 +92,7 @@
405 ifdef lhapdf
406 CXXFLAGS += $(shell $(lhapdf) --cppflags)
407 alfas_functions=alfas_functions_lhapdf
408- llhapdf=-lLHAPDF
409+ llhapdf+=-lLHAPDF
410 reweight_xsec_events_pdf_dummy=
411 else
412 alfas_functions=alfas_functions
413
414=== modified file 'Template/NLO/Source/run.inc'
415--- Template/NLO/Source/run.inc 2015-09-14 18:56:28 +0000
416+++ Template/NLO/Source/run.inc 2016-03-16 17:59:03 +0000
417@@ -73,9 +73,10 @@
418 c
419 c Reweight info
420 c
421- logical do_rwgt_scale, do_rwgt_pdf
422+ logical do_rwgt_scale, do_rwgt_pdf, keep_rwgt_info
423 integer pdf_set_min, pdf_set_max
424 double precision rw_Fscale_down, rw_Fscale_up, rw_Rscale_down, rw_Rscale_up
425 common/to_rwgt/ do_rwgt_scale, rw_Fscale_down, rw_Fscale_up, rw_Rscale_down, rw_Rscale_up,
426- # do_rwgt_pdf, pdf_set_min, pdf_set_max
427+ # do_rwgt_pdf, pdf_set_min, pdf_set_max,
428+ # keep_rwgt_info
429
430
431=== modified file 'Template/NLO/SubProcesses/BinothLHA.f'
432--- Template/NLO/SubProcesses/BinothLHA.f 2015-08-18 08:10:27 +0000
433+++ Template/NLO/SubProcesses/BinothLHA.f 2016-03-16 17:59:03 +0000
434@@ -3,20 +3,7 @@
435 c Given the Born momenta, this is the Binoth-Les Houches interface file
436 c that calls the OLP and returns the virtual weights. For convenience
437 c also the born_wgt is passed to this subroutine.
438-c
439-C************************************************************************
440-c WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
441-C************************************************************************
442-c The Born in MadFKS -- and therefore also the virtual!-- should have a
443-c slightly adapted identical particle symmetry factor. The normal
444-c virtual weight as coming from the OLP should be divided by the number
445-c of gluons in the corresponding real-emission process (i.e. the number
446-c of gluons in the Born plus one). This factor is passed to this
447-c subroutine in /numberofparticles/ common block, as "ngluons". So,
448-c divided virt_wgt by dble(ngluons) to get the correct virtual to be
449-c used in MadFKS. The born_wgt that is passed to this subroutine has
450-c already been divided by this factor.
451-C************************************************************************
452+cC************************************************************************
453 c
454 implicit none
455 include "nexternal.inc"
456@@ -34,11 +21,6 @@
457 double precision, allocatable :: virt_wgts_hel(:,:)
458 double precision mu,ao2pi,conversion,alpha_S
459 save conversion
460- double precision fkssymmetryfactor,fkssymmetryfactorBorn,
461- & fkssymmetryfactorDeg
462- integer ngluons,nquarks(-6:6)
463- common/numberofparticles/fkssymmetryfactor,fkssymmetryfactorBorn,
464- & fkssymmetryfactorDeg,ngluons,nquarks
465 logical firsttime,firsttime_conversion
466 data firsttime,firsttime_conversion /.true.,.true./
467 logical firsttime_run
468@@ -112,9 +94,9 @@
469 call sloopmatrix_thres(p, virt_wgts, tolerance, accuracies,
470 $ ret_code)
471 prec_found = accuracies(0)
472- virt_wgt= virt_wgts(1,0)/dble(ngluons)
473- single = virt_wgts(2,0)/dble(ngluons)
474- double = virt_wgts(3,0)/dble(ngluons)
475+ virt_wgt= virt_wgts(1,0)
476+ single = virt_wgts(2,0)
477+ double = virt_wgts(3,0)
478 else
479 tolerance=PrecisionVirtualAtRunTime
480 c Just set the accuracy found to a positive value as it is not specified
481@@ -123,9 +105,9 @@
482 call sloopmatrix_thres(p,virt_wgts,tolerance,accuracies
483 $ ,ret_code)
484 prec_found = accuracies(0)
485- virt_wgt= virt_wgts(1,0)/dble(ngluons)
486- single = virt_wgts(2,0)/dble(ngluons)
487- double = virt_wgts(3,0)/dble(ngluons)
488+ virt_wgt= virt_wgts(1,0)
489+ single = virt_wgts(2,0)
490+ double = virt_wgts(3,0)
491 elseif (mc_hel.eq.1) then
492 c Use the Born helicity amplitudes to sample the helicities of the
493 c virtual as flat as possible
494@@ -148,14 +130,13 @@
495 call sloopmatrixhel_thres(p,hel(ihel),virt_wgts_hel
496 $ ,tolerance,accuracies,ret_code)
497 prec_found = accuracies(0)
498+c Average over initial state helicities
499 virt_wgt = virt_wgt + virt_wgts_hel(1,0)*dble(goodhel(ihel))
500- $ /volh/4d0/dble(ngluons)
501+ $ /volh/4d0
502 single = single + virt_wgts_hel(2,0)*dble(goodhel(ihel))
503- $ /volh/4d0/dble(ngluons)
504+ $ /volh/4d0
505 double = double + virt_wgts_hel(3,0)*dble(goodhel(ihel))
506- $ /volh/4d0/dble(ngluons)
507-c Average over initial state helicities (and take the ngluon factor into
508-c account)
509+ $ /volh/4d0
510 if (nincoming.ne.2) then
511 write (*,*)
512 & 'Cannot do MC over helicities for 1->N processes'
513
514=== modified file 'Template/NLO/SubProcesses/BinothLHA_OLP.f'
515--- Template/NLO/SubProcesses/BinothLHA_OLP.f 2015-02-19 07:39:52 +0000
516+++ Template/NLO/SubProcesses/BinothLHA_OLP.f 2016-03-16 17:59:03 +0000
517@@ -5,18 +5,6 @@
518 c also the born_wgt is passed to this subroutine.
519 c
520 C************************************************************************
521-c WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
522-C************************************************************************
523-c The Born in MadFKS -- and therefore also the virtual!-- should have a
524-c slightly adapted identical particle symmetry factor. The normal
525-c virtual weight as coming from the OLP should be divided by the number
526-c of gluons in the corresponding real-emission process (i.e. the number
527-c of gluons in the Born plus one). This factor is passed to this
528-c subroutine in /numberofparticles/ common block, as "ngluons". So,
529-c divided virt_wgt by dble(ngluons) to get the correct virtual to be
530-c used in MadFKS. The born_wgt that is passed to this subroutine has
531-c already been divided by this factor.
532-C************************************************************************
533 c
534 implicit none
535 include "nexternal.inc"
536@@ -29,11 +17,6 @@
537 double precision virt_wgt,born_wgt,double,single,born,virt_wgts(4)
538 double precision mu,ao2pi,conversion,alpha_S
539 save conversion
540- double precision fkssymmetryfactor,fkssymmetryfactorBorn,
541- & fkssymmetryfactorDeg
542- integer ngluons,nquarks(-6:6)
543- common/numberofparticles/fkssymmetryfactor,fkssymmetryfactorBorn,
544- & fkssymmetryfactorDeg,ngluons,nquarks
545 logical firsttime_pole,firsttime_conversion,firsttime_init
546 data firsttime_pole,firsttime_conversion,firsttime_init
547 & /.true.,.true.,.true./
548@@ -75,18 +58,17 @@
549 c======================================================================
550 c Replace the following line with the call to the one-loop code you wish
551 c to use. virt_wgts contains finite part, single and double pole and the
552-c Born. To understand why we need to divide them by ngluons, read the
553-c warning message at the beginning of this subroutine
554+c Born.
555 c
556 if (firsttime_init) then
557 call BinothLHAInit()
558 firsttime_init=.false.
559 endif
560 call OLP_EvalSubProcess(proc_label,p,mu_r,alpha_S,virt_wgts)
561- double = virt_wgts(1)/dble(ngluons)
562- single = virt_wgts(2)/dble(ngluons)
563- virt_wgt= virt_wgts(3)/dble(ngluons)
564- born = virt_wgts(4)/dble(ngluons)
565+ double = virt_wgts(1)
566+ single = virt_wgts(2)
567+ virt_wgt= virt_wgts(3)
568+ born = virt_wgts(4)
569 c======================================================================
570
571 c======================================================================
572
573=== modified file 'Template/NLO/SubProcesses/BinothLHA_user.f'
574--- Template/NLO/SubProcesses/BinothLHA_user.f 2015-02-19 07:39:52 +0000
575+++ Template/NLO/SubProcesses/BinothLHA_user.f 2016-03-16 17:59:03 +0000
576@@ -5,18 +5,6 @@
577 c also the born_wgt is passed to this subroutine.
578 c
579 C************************************************************************
580-c WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
581-C************************************************************************
582-c The Born in MadFKS -- and therefore also the virtual!-- should have a
583-c slightly adapted identical particle symmetry factor. The normal
584-c virtual weight as coming from the OLP should be divided by the number
585-c of gluons in the corresponding real-emission process (i.e. the number
586-c of gluons in the Born plus one). This factor is passed to this
587-c subroutine in /numberofparticles/ common block, as "ngluons". So,
588-c divided virt_wgt by dble(ngluons) to get the correct virtual to be
589-c used in MadFKS. The born_wgt that is passed to this subroutine has
590-c already been divided by this factor.
591-C************************************************************************
592 c
593 implicit none
594 include "nexternal.inc"
595@@ -27,11 +15,6 @@
596 double precision virt_wgt,born_wgt,double,single,virt_wgts(3)
597 double precision mu,ao2pi,conversion,alpha_S
598 save conversion
599- double precision fkssymmetryfactor,fkssymmetryfactorBorn,
600- & fkssymmetryfactorDeg
601- integer ngluons,nquarks(-6:6)
602- common/numberofparticles/fkssymmetryfactor,fkssymmetryfactorBorn,
603- & fkssymmetryfactorDeg,ngluons,nquarks
604 logical firsttime,firsttime_conversion
605 data firsttime,firsttime_conversion /.true.,.true./
606 integer isum_hel
607@@ -62,13 +45,11 @@
608 c======================================================================
609 c Replace the following line with the call to the one-loop code you
610 c wish to use. virt_wgts contains finite part, single and double pole
611-c To understand why we need to divide them by ngluons, read the warning
612-c message at the beginning of this subroutine
613 c
614 c call sloopmatrix(p, virt_wgts)
615-c virt_wgt= virt_wgts(1)/dble(ngluons)
616-c single = virt_wgts(2)/dble(ngluons)
617-c double = virt_wgts(3)/dble(ngluons)
618+c virt_wgt= virt_wgts(1)
619+c single = virt_wgts(2)
620+c double = virt_wgts(3)
621 c
622 c======================================================================
623
624
625=== modified file 'Template/NLO/SubProcesses/c_weight.inc'
626--- Template/NLO/SubProcesses/c_weight.inc 2015-02-13 20:03:34 +0000
627+++ Template/NLO/SubProcesses/c_weight.inc 2016-03-16 17:59:03 +0000
628@@ -4,20 +4,21 @@
629 parameter (max_contr=128,max_wgt=256,max_iproc=100)
630 logical H_event(max_contr)
631 integer nFKS(max_contr),itype(max_contr),QCDpower(max_contr)
632- $ ,pdg(nexternal,max_contr),pdg_uborn(nexternal,max_contr)
633+ $ ,pdg(nexternal,0:max_contr),pdg_uborn(nexternal,0:max_contr)
634 $ ,parton_pdg_uborn(nexternal,max_iproc,max_contr)
635 $ ,parton_pdg(nexternal,max_iproc,max_contr),icontr,iwgt
636 $ ,plot_id(max_contr),niproc(max_contr),parton_pdf(nexternal
637 $ ,max_iproc,max_contr),icontr_sum(0:max_iproc,max_contr)
638 $ ,icontr_picked,iproc_picked
639 double precision momenta(0:3,nexternal,max_contr),momenta_m(0:3
640- & ,nexternal,max_contr),wgt(3,max_contr),bjx(2,max_contr)
641- & ,scales2(3,max_contr),g_strong(max_contr),wgts(max_wgt
642- & ,max_contr),parton_iproc(max_iproc,max_contr)
643- & ,y_bst(max_contr),plot_wgts(max_wgt,max_contr)
644- & ,shower_scale(max_contr),unwgt(max_iproc,max_contr)
645- common /c_weights/momenta,momenta_m,wgt,wgts,plot_wgts
646- & ,parton_iproc,bjx,scales2,g_strong,y_bst,shower_scale,unwgt
647- & ,parton_pdg,nFKS,itype,QCDpower,pdg,pdg_uborn
648- & ,parton_pdg_uborn,plot_id,niproc,icontr,iwgt,icontr_sum
649- & ,icontr_picked,iproc_picked,H_event
650+ $ ,nexternal,2,max_contr),wgt(3,max_contr),wgt_ME_tree(2
651+ $ ,max_contr),bjx(2,max_contr),scales2(3,max_contr)
652+ $ ,g_strong(max_contr),wgts(max_wgt,max_contr)
653+ $ ,parton_iproc(max_iproc,max_contr),y_bst(max_contr)
654+ $ ,plot_wgts(max_wgt,max_contr),shower_scale(max_contr)
655+ $ ,unwgt(max_iproc,max_contr)
656+ common /c_weights/momenta,momenta_m,wgt,wgt_ME_tree,wgts,plot_wgts
657+ $ ,parton_iproc,bjx,scales2,g_strong,y_bst,shower_scale,unwgt
658+ $ ,parton_pdg,nFKS,itype,QCDpower,pdg,pdg_uborn
659+ $ ,parton_pdg_uborn,plot_id,niproc,icontr,iwgt,icontr_sum
660+ $ ,icontr_picked,iproc_picked,H_event
661
662=== modified file 'Template/NLO/SubProcesses/check_poles.f'
663--- Template/NLO/SubProcesses/check_poles.f 2015-10-20 13:26:25 +0000
664+++ Template/NLO/SubProcesses/check_poles.f 2016-03-16 17:59:03 +0000
665@@ -182,9 +182,9 @@
666 1 accuracies,return_code)
667 accuracy=accuracies(0)
668
669- finite = virt_wgts(1,0)/dble(ngluons)
670- single = virt_wgts(2,0)/dble(ngluons)
671- double = virt_wgts(3,0)/dble(ngluons)
672+ finite = virt_wgts(1,0)
673+ single = virt_wgts(2,0)
674+ double = virt_wgts(3,0)
675
676 C If MadLoop was still in initialization mode, then skip this
677 C point for the checks
678
679=== modified file 'Template/NLO/SubProcesses/driver_mintFO.f'
680--- Template/NLO/SubProcesses/driver_mintFO.f 2015-10-20 13:26:25 +0000
681+++ Template/NLO/SubProcesses/driver_mintFO.f 2016-03-16 17:59:03 +0000
682@@ -395,6 +395,8 @@
683 common /to_abrv/ abrv
684 integer iappl
685 common /for_applgrid/ iappl
686+ double precision wgt_ME_born,wgt_ME_real
687+ common /c_wgt_ME_tree/ wgt_ME_born,wgt_ME_real
688 if (ifl.ne.0) then
689 write (*,*) 'ERROR ifl not equal to zero in sigint',ifl
690 stop 1
691@@ -410,6 +412,8 @@
692 virt_wgt_mint=0d0
693 born_wgt_mint=0d0
694 virtual_over_born=0d0
695+ wgt_me_born=0d0
696+ wgt_me_real=0d0
697 if (ickkw.eq.-1) H1_factor_virt=0d0
698 if (ickkw.eq.3) call set_FxFx_scale(0,p)
699 call update_vegas_x(xx,x)
700@@ -452,6 +456,8 @@
701 MC_int_wgt=1d0/vol
702 endif
703 do iFKS=nFKS_min,nFKS_max
704+ wgt_me_born=0d0
705+ wgt_me_real=0d0
706 jac=MC_int_wgt
707 call update_fks_dir(iFKS,iconfig)
708 call generate_momenta(ndim,iconfig,jac,x,p)
709
710=== modified file 'Template/NLO/SubProcesses/driver_mintMC.f'
711--- Template/NLO/SubProcesses/driver_mintMC.f 2015-12-16 16:13:10 +0000
712+++ Template/NLO/SubProcesses/driver_mintMC.f 2016-03-16 17:59:03 +0000
713@@ -792,6 +792,8 @@
714 logical only_virt
715 integer imode
716 common /c_imode/imode,only_virt
717+ double precision wgt_ME_born,wgt_ME_real
718+ common /c_wgt_ME_tree/ wgt_ME_born,wgt_ME_real
719 sigintF=0d0
720 c Find the nFKSprocess for which we compute the Born-like contributions
721 if (firsttime) then
722@@ -818,6 +820,8 @@
723 born_wgt_mint=0d0
724 virtual_over_born=0d0
725 MCcntcalled=.false.
726+ wgt_me_real=0d0
727+ wgt_me_born=0d0
728 if (ickkw.eq.3) call set_FxFx_scale(0,p)
729 call update_vegas_x(xx,x)
730 call get_MC_integer(1,proc_map(0,0),proc_map(0,1),vol1)
731@@ -866,6 +870,8 @@
732 if(sum.eq.0) calculatedBorn=.false.
733 nbody=.false.
734 do i=1,proc_map(proc_map(0,1),0)
735+ wgt_me_real=0d0
736+ wgt_me_born=0d0
737 iFKS=proc_map(proc_map(0,1),i)
738 call update_fks_dir(iFKS,iconfig)
739 jac=1d0/vol1
740
741=== modified file 'Template/NLO/SubProcesses/fks_singular.f'
742--- Template/NLO/SubProcesses/fks_singular.f 2015-12-16 16:13:10 +0000
743+++ Template/NLO/SubProcesses/fks_singular.f 2016-03-16 17:59:03 +0000
744@@ -38,7 +38,7 @@
745 include 'run.inc'
746 include 'timing_variables.inc'
747 double precision wgt1,wgt2,wgt3,bsv_wgt,virt_wgt,born_wgt,pi,g2
748- & ,g22
749+ & ,g22,wgt4
750 parameter (pi=3.1415926535897932385d0)
751 double precision p1_cnt(0:3,nexternal,-2:2),wgt_cnt(-2:2)
752 $ ,pswgt_cnt(-2:2),jac_cnt(-2:2)
753@@ -61,6 +61,7 @@
754 g2=g**(nint(2*wgtbpower))
755 g22=g**(nint(2*wgtbpower+2))
756 wgt1=wgtnstmp*f_nb/g22
757+ wgt4=wgtnstmp_avgvirt*f_nb/g22
758 if (ickkw.eq.3 .and. fxfx_exp_rewgt.ne.0d0) then
759 wgt1=wgt1 - fxfx_exp_rewgt*born_wgt*f_nb/g2/(4d0*pi)
760 elseif (ickkw.eq.-1) then
761@@ -78,6 +79,7 @@
762 wgt2=wgtwnstmpmur*f_nb/g22
763 wgt3=wgtwnstmpmuf*f_nb/g22
764 call add_wgt(3,wgt1,wgt2,wgt3)
765+ call add_wgt(15,wgt4,0d0,0d0)
766 c Special for the soft-virtual needed for the virt-tricks. The
767 c *_wgt_mint variable should be directly passed to the mint-integrator
768 c and not be part of the plots nor computation of the cross section.
769@@ -955,6 +957,7 @@
770 c type=12: MC subtraction with n-body kin.
771 c type=13: MC subtraction with n+1-body kin.
772 c type=14: virtual corrections
773+c type=15: virt-trick: average born contribution
774 c wgt1 : weight of the contribution not multiplying a scale log
775 c wgt2 : coefficient of the weight multiplying the log[mu_R^2/Q^2]
776 c wgt3 : coefficient of the weight multiplying the log[mu_F^2/Q^2]
777@@ -990,6 +993,9 @@
778 c PDG=21 (gluon) code.
779 c If the contribution belongs to an H-event or S-event:
780 c H_event(icontr)
781+c The weight of the born or real-emission matrix element
782+c corresponding to this contribution: wgt_ME_tree. This weight does
783+c include the 'ngluon' correction factor for the Born.
784 c
785 c Not set in this subroutine, but included in the c_weights common block
786 c are the
787@@ -1033,6 +1039,15 @@
788 double precision p1_cnt(0:3,nexternal,-2:2),wgt_cnt(-2:2)
789 $ ,pswgt_cnt(-2:2),jac_cnt(-2:2)
790 common/counterevnts/p1_cnt,wgt_cnt,pswgt_cnt,jac_cnt
791+ double precision fkssymmetryfactor,fkssymmetryfactorBorn,
792+ & fkssymmetryfactorDeg
793+ integer ngluons,nquarks(-6:6)
794+ common/numberofparticles/fkssymmetryfactor,fkssymmetryfactorBorn,
795+ & fkssymmetryfactorDeg,ngluons,nquarks
796+ double precision wgt_ME_born,wgt_ME_real
797+ common /c_wgt_ME_tree/ wgt_ME_born,wgt_ME_real
798+ double precision iden_comp
799+ common /c_iden_comp/ iden_comp
800 if (wgt1.eq.0d0 .and. wgt2.eq.0d0 .and. wgt3.eq.0d0) return
801 c Check for NaN's and INF's. Simply skip the contribution
802 if (wgt1.ne.wgt1) return
803@@ -1064,57 +1079,49 @@
804 c Anything else
805 QCDpower(icontr)=nint(2*wgtbpower+2)
806 endif
807+c Compensate for the fact that in the Born matrix elements, we use the
808+c identical particle symmetry factor of the corresponding real emission
809+c matrix elements
810+c IDEN_COMP STUFF NEEDS TO BE UPDATED WHEN MERGING WITH 'FKS_EW' STUFF
811+ wgt_ME_tree(1,icontr)=wgt_me_born
812+ wgt_ME_tree(2,icontr)=wgt_me_real
813+ do i=1,nexternal
814+ do j=0,3
815+ if (p1_cnt(0,1,0).gt.0d0) then
816+ momenta_m(j,i,1,icontr)=p1_cnt(j,i,0)
817+ elseif (p1_cnt(0,1,1).gt.0d0) then
818+ momenta_m(j,i,1,icontr)=p1_cnt(j,i,1)
819+ elseif (p1_cnt(0,1,2).gt.0d0) then
820+ momenta_m(j,i,1,icontr)=p1_cnt(j,i,2)
821+ else
822+ if (i.lt.fks_i_d(nFKSprocess)) then
823+ momenta_m(j,i,1,icontr)=p_born(j,i)
824+ elseif(i.eq.fks_i_d(nFKSprocess)) then
825+ momenta_m(j,i,1,icontr)=0d0
826+ else
827+ momenta_m(j,i,1,icontr)=p_born(j,i-1)
828+ endif
829+ endif
830+ momenta_m(j,i,2,icontr)=p_ev(j,i)
831+ enddo
832+ enddo
833 if(type.eq.1 .or. type.eq. 8 .or. type.eq.9 .or. type.eq.10 .or.
834 & type.eq.13) then
835 c real emission and n+1-body kin. contributions to counter terms and MC
836 c subtr term
837 do i=1,nexternal
838 do j=0,3
839-c 'momenta' is the momentum configuration for this contribution;
840-c 'momenta_m' is the momentum configuration that was used in the
841-c matrix elements of this contribution.
842- momenta(j,i,icontr)=p_ev(j,i)
843- if (type.eq.1) then
844- momenta_m(j,i,icontr)=momenta(j,i,icontr)
845- else
846- if (p1_cnt(0,1,0).gt.0d0) then
847- momenta_m(j,i,icontr)=p1_cnt(j,i,0)
848- elseif (p1_cnt(0,1,1).gt.0d0) then
849- momenta_m(j,i,icontr)=p1_cnt(j,i,1)
850- elseif (p1_cnt(0,1,2).gt.0d0) then
851- momenta_m(j,i,icontr)=p1_cnt(j,i,2)
852- else
853- write (*,*) 'ERROR in add_wgt: no valid momenta'
854- stop 1
855- endif
856- endif
857+ momenta(j,i,icontr)=momenta_m(j,i,2,icontr)
858 enddo
859 enddo
860 H_event(icontr)=.true.
861 elseif(type.ge.2 .and. type.le.7 .or. type.eq.11 .or. type.eq.12
862- $ .or. type.eq.14)then
863+ $ .or. type.eq.14 .or. type.eq.15)then
864 c Born, counter term, soft-virtual, or n-body kin. contributions to real
865 c and MC subtraction terms.
866 do i=1,nexternal
867 do j=0,3
868-c 'momenta' is the momentum configuration for this contribution;
869-c 'momenta_m' is the momentum configuration that was used in the
870-c matrix elements of this contribution.
871- if (p1_cnt(0,1,0).gt.0d0) then
872- momenta(j,i,icontr)=p1_cnt(j,i,0)
873- elseif (p1_cnt(0,1,1).gt.0d0) then
874- momenta(j,i,icontr)=p1_cnt(j,i,1)
875- elseif (p1_cnt(0,1,2).gt.0d0) then
876- momenta(j,i,icontr)=p1_cnt(j,i,2)
877- else
878- write (*,*) 'ERROR in add_wgt: no valid momenta'
879- stop 1
880- endif
881- if (type.eq.11) then
882- momenta_m(j,i,icontr)=p_ev(j,i)
883- else
884- momenta_m(j,i,icontr)=momenta(j,i,icontr)
885- endif
886+ momenta(j,i,icontr)=momenta_m(j,i,1,icontr)
887 enddo
888 enddo
889 H_event(icontr)=.false.
890@@ -1494,7 +1501,7 @@
891 integer iproc_save(fks_configs),eto(maxproc,fks_configs),
892 & etoi(maxproc,fks_configs),maxproc_found
893 common/cproc_combination/iproc_save,eto,etoi,maxproc_found
894- if (icontr.gt.7) then
895+ if (icontr.gt.8) then
896 write (*,*) 'ERROR: too many applgrid weights. '/
897 & /'Should have at most one of each itype.',icontr
898 stop 1
899@@ -1536,8 +1543,8 @@
900 appl_QES2(2)=scales2(1,i)
901 appl_muR2(2)=scales2(2,i)
902 appl_muF2(2)=scales2(3,i)
903- elseif (itype(i).eq.3 .or. itype(i).eq.4 .or. itype(i).eq.14)
904- $ then
905+ elseif (itype(i).eq.3 .or. itype(i).eq.4 .or. itype(i).eq.14
906+ & .or. itype(i).eq.15)then
907 c virtual, soft-virtual or soft-counter
908 appl_w0(2)=appl_w0(2)+wgt(1,i)*final_state_rescaling
909 appl_wR(2)=appl_wR(2)+wgt(2,i)*final_state_rescaling
910@@ -1635,7 +1642,7 @@
911 if (icontr.eq.0) return
912 do i=1,icontr
913 if (itype(i).eq.2 .or. itype(i).eq.3 .or. itype(i).eq.14 .or.
914- & itype(i).eq.7) then
915+ & itype(i).eq.7 .or. itype(i).eq.15) then
916 sig=sig+wgts(1,i)
917 endif
918 enddo
919@@ -1654,7 +1661,7 @@
920 if (icontr.eq.0) return
921 do i=1,icontr
922 if (itype(i).ne.2 .and. itype(i).ne.3 .and. itype(i).ne.14
923- & .and. itype(i).ne.7) then
924+ & .and. itype(i).ne.7 .and. itype(i).ne.15) then
925 sig=sig+wgts(1,i)
926 endif
927 enddo
928@@ -2054,8 +2061,9 @@
929 tmp_wgt=0d0
930 do j=1,icontr_sum(0,i)
931 ict=icontr_sum(j,i)
932- if (itype(ict).ne.2 .and. itype(ict).ne.3 .and.
933- $ itype(ict).ne.14) tmp_wgt=tmp_wgt+wgts(1,ict)
934+ if ( itype(ict).ne.2 .and. itype(ict).ne.3 .and.
935+ $ itype(ict).ne.14 .and. itype(ict).ne.15)
936+ $ tmp_wgt=tmp_wgt+wgts(1,ict)
937 enddo
938 n1body_wgt=n1body_wgt+abs(tmp_wgt)
939 enddo
940@@ -2162,7 +2170,8 @@
941 include 'reweight0.inc'
942 include 'genps.inc'
943 include 'nFKSconfigs.inc'
944- integer i,ii,j,jj,ict,ipr,momenta_conf
945+ include 'fks_info.inc'
946+ integer k,i,ii,j,jj,ict,ipr,momenta_conf(2)
947 logical momenta_equal,found
948 double precision conv,momenta_str_l(0:3,nexternal,max_n_ctr)
949 external momenta_equal
950@@ -2183,24 +2192,32 @@
951 c Check if the current set of momenta are already available in the
952 c momenta_str_l array. If not, add it.
953 found=.false.
954- do j=1,n_mom_conf
955- if (momenta_equal(momenta_str_l(0,1,j),momenta_m(0,1,ict)))
956- & then
957- momenta_conf=j
958- found=.true.
959- exit
960+ do k=1,2
961+ do j=1,n_mom_conf
962+ if (momenta_m(0,1,k,ict).le.0d0) then
963+ momenta_conf(k)=0
964+ cycle
965+ endif
966+ if (momenta_equal(momenta_str_l(0,1,j),
967+ & momenta_m(0,1,k,ict))) then
968+ momenta_conf(k)=j
969+ found=.true.
970+ exit
971+ endif
972+ enddo
973+ if (.not. found) then
974+ n_mom_conf=n_mom_conf+1
975+ do ii=1,nexternal
976+ do jj=0,3
977+ momenta_str(jj,ii,n_mom_conf)=
978+ & momenta_m(jj,ii,k,ict)
979+ momenta_str_l(jj,ii,n_mom_conf)=
980+ & momenta_m(jj,ii,k,ict)
981+ enddo
982+ enddo
983+ momenta_conf(k)=n_mom_conf
984 endif
985 enddo
986- if (.not. found) then
987- n_mom_conf=n_mom_conf+1
988- do ii=1,nexternal
989- do jj=0,3
990- momenta_str(jj,ii,n_mom_conf)=momenta_m(jj,ii,ict)
991- momenta_str_l(jj,ii,n_mom_conf)=momenta_m(jj,ii,ict)
992- enddo
993- enddo
994- momenta_conf=n_mom_conf
995- endif
996 if (.not. Hevents) then
997 c For S-events, be careful to take all the IPROC that contribute to the
998 c iproc_picked:
999@@ -2208,15 +2225,17 @@
1000 do ii=1,iproc_save(nFKS(ict))
1001 if (eto(ii,nFKS(ict)).ne.ipr) cycle
1002 n_ctr_found=n_ctr_found+1
1003+
1004 if (nincoming.eq.2) then
1005- write (n_ctr_str(n_ctr_found),'(3(1x,d18.12),1x,i2)')
1006- & (wgt(j,ict)*conv,j=1,3),
1007+ write (n_ctr_str(n_ctr_found),'(5(1x,d18.12),1x,i2)')
1008+ & (wgt(j,ict)*conv,j=1,3),(wgt_me_tree(j,ict),j=1,2),
1009 & nexternal
1010 else
1011- write (n_ctr_str(n_ctr_found),'(3(1x,d18.12),1x,i2)')
1012- & (wgt(j,ict),j=1,3),
1013+ write (n_ctr_str(n_ctr_found),'(5(1x,d18.12),1x,i2)')
1014+ & (wgt(j,ict),j=1,3),(wgt_me_tree(j,ict),j=1,2),
1015 & nexternal
1016 endif
1017+
1018 procid=''
1019 do j=1,nexternal
1020 write (str_temp,*) parton_pdg(j,ii,ict)
1021@@ -2226,13 +2245,18 @@
1022 n_ctr_str(n_ctr_found) =
1023 & trim(adjustl(n_ctr_str(n_ctr_found)))//' '
1024 & //trim(adjustl(procid))
1025- write (str_temp,'(i2,5(1x,d14.8),3(1x,i2),1x,d18.12)')
1026+
1027+ write (str_temp,'(i2,6(1x,d14.8),6(1x,i2),1x,i8,1x,d18.12)')
1028 & QCDpower(ict),
1029 & (bjx(j,ict),j=1,2),
1030 & (scales2(j,ict),j=1,3),
1031- & momenta_conf,
1032+ & g_strong(ict),
1033+ & (momenta_conf(j),j=1,2),
1034 & itype(ict),
1035 & nFKS(ict),
1036+ & fks_i_d(nFKS(ict)),
1037+ & fks_j_d(nFKS(ict)),
1038+ & parton_pdg_uborn(fks_j_d(nFKS(ict)),ii,ict),
1039 & parton_iproc(ii,ict)
1040 n_ctr_str(n_ctr_found) =
1041 & trim(adjustl(n_ctr_str(n_ctr_found)))//' '
1042@@ -2242,15 +2266,17 @@
1043 c H-event
1044 ipr=iproc_picked
1045 n_ctr_found=n_ctr_found+1
1046+
1047 if (nincoming.eq.2) then
1048- write (n_ctr_str(n_ctr_found),'(3(1x,d18.12),1x,i2)')
1049- & (wgt(j,ict)*conv,j=1,3),
1050+ write (n_ctr_str(n_ctr_found),'(5(1x,d18.12),1x,i2)')
1051+ & (wgt(j,ict)*conv,j=1,3),(wgt_me_tree(j,ict),j=1,2),
1052 & nexternal
1053 else
1054- write (n_ctr_str(n_ctr_found),'(3(1x,d18.12),1x,i2)')
1055- & (wgt(j,ict),j=1,3),
1056+ write (n_ctr_str(n_ctr_found),'(5(1x,d18.12),1x,i2)')
1057+ & (wgt(j,ict),j=1,3),(wgt_me_tree(j,ict),j=1,2),
1058 & nexternal
1059 endif
1060+
1061 procid=''
1062 do j=1,nexternal
1063 write (str_temp,*) parton_pdg(j,ipr,ict)
1064@@ -2260,17 +2286,24 @@
1065 n_ctr_str(n_ctr_found) =
1066 & trim(adjustl(n_ctr_str(n_ctr_found)))//' '
1067 & //trim(adjustl(procid))
1068- write (str_temp,'(i2,5(1x,d14.8),3(1x,i2),1x,d18.12)')
1069+
1070+ write (str_temp,'(i2,6(1x,d14.8),6(1x,i2),1x,i8,1x,d18.12)')
1071 & QCDpower(ict),
1072 & (bjx(j,ict),j=1,2),
1073 & (scales2(j,ict),j=1,3),
1074- & momenta_conf,
1075- & itype(ict),
1076- & nFKS(ict),
1077+ & g_strong(ict),
1078+ & (momenta_conf(j),j=1,2),
1079+ & itype(ict),
1080+ & nFKS(ict),
1081+ & fks_i_d(nFKS(ict)),
1082+ & fks_j_d(nFKS(ict)),
1083+ & parton_pdg_uborn(fks_j_d(nFKS(ict)),ipr,ict),
1084 & parton_iproc(ipr,ict)
1085 n_ctr_str(n_ctr_found) =
1086 & trim(adjustl(n_ctr_str(n_ctr_found)))//' '
1087 & //trim(adjustl(str_temp))
1088+
1089+
1090 endif
1091 if (n_ctr_found.ge.max_n_ctr) then
1092 write (*,*) 'ERROR: too many contributions in <rwgt>'
1093@@ -2852,6 +2885,8 @@
1094 parameter (vtiny=1d-8)
1095 double complex ximag
1096 parameter (ximag=(0.d0,1.d0))
1097+ double precision iden_comp
1098+ common /c_iden_comp/iden_comp
1099 C
1100 if(p_born(0,1).le.0.d0)then
1101 c Unphysical kinematics: set matrix elements equal to zero
1102@@ -2923,7 +2958,7 @@
1103 write(*,*) 'FATAL ERROR in sborncol_fsr',i_type,j_type,i_fks,j_fks
1104 stop
1105 endif
1106- wgt=dble(wgt1(1)*ap+wgt1(2)*Q)
1107+ wgt=dble(wgt1(1)*ap+wgt1(2)*Q)*iden_comp
1108 return
1109 end
1110
1111@@ -2971,6 +3006,8 @@
1112 parameter (vtiny=1d-8)
1113 double complex ximag
1114 parameter (ximag=(0.d0,1.d0))
1115+ double precision iden_comp
1116+ common /c_iden_comp/iden_comp
1117 C
1118 if(p_born(0,1).le.0.d0)then
1119 c Unphysical kinematics: set matrix elements equal to zero
1120@@ -3047,7 +3084,7 @@
1121 # wgt1(2) * dconjg(azifact)
1122 call Qterms_reduced_spacelike(m_type, i_type, t, z, Q)
1123 endif
1124- wgt=dble(wgt1(1)*ap+wgt1(2)*Q)
1125+ wgt=dble(wgt1(1)*ap+wgt1(2)*Q)*iden_comp
1126 return
1127 end
1128
1129@@ -3329,6 +3366,8 @@
1130
1131 double precision zero,pmass(nexternal)
1132 parameter(zero=0d0)
1133+ double precision iden_comp
1134+ common /c_iden_comp/iden_comp
1135 include "pmass.inc"
1136 c
1137 c Call the Born to be sure that 'CalculatedBorn' is done correctly. This
1138@@ -3353,8 +3392,7 @@
1139 endif
1140 enddo
1141 enddo
1142-
1143- wgt=softcontr
1144+ wgt=softcontr*iden_comp
1145 c Add minus sign to compensate the minus in the color factor
1146 c of the color-linked Borns (b_sf_0??.f)
1147 c Factor two to fix the limits.
1148@@ -3487,6 +3525,8 @@
1149 double precision one,pi
1150 parameter (one=1.d0)
1151 parameter (pi=3.1415926535897932385d0)
1152+ double precision iden_comp
1153+ common /c_iden_comp/iden_comp
1154
1155 if(j_fks.gt.nincoming)then
1156 c Do not include this contribution for final-state branchings
1157@@ -3544,7 +3584,7 @@
1158 c The partonic flux 1/(2*s) is inserted in genps. Thus, an extra
1159 c factor z (implicit in the flux of the reduced Born in FKS)
1160 c has to be inserted here
1161- xnorm=1.d0/z
1162+ xnorm=1.d0/z *iden_comp
1163
1164 collrem_xi=oo2pi * born_wgt * collrem_xi * xnorm
1165 collrem_lxi=oo2pi * born_wgt * collrem_lxi * xnorm
1166@@ -4343,7 +4383,7 @@
1167 include "run.inc"
1168 include "fks_powers.inc"
1169 include 'reweight.inc'
1170- double precision p(0:3,nexternal),bsv_wgt,born_wgt
1171+ double precision p(0:3,nexternal),bsv_wgt,born_wgt,avv_wgt
1172 double precision pp(0:3,nexternal)
1173
1174 double complex wgt1(2)
1175@@ -4441,6 +4481,7 @@
1176 bsv_wgt=dble(wgt1(1))
1177 born_wgt=dble(wgt1(1))
1178 virt_wgt=0d0
1179+ avv_wgt=0d0
1180
1181 if (abrv.eq.'born' .or. abrv.eq.'grid') goto 549
1182 if (abrv.eq.'virt' .or. abrv.eq.'viSC' .or.
1183@@ -4594,7 +4635,7 @@
1184 c$$$ bsv_wgt=bsv_wgt+virt_wgt_save
1185 endif
1186 if (abrv(1:4).ne.'virt' .and. ickkw.ne.-1)
1187- & bsv_wgt=bsv_wgt+average_virtual*born_wgt*ao2pi
1188+ & avv_wgt=average_virtual*born_wgt*ao2pi
1189
1190 c eq.(MadFKS.C.13)
1191 if(abrv.eq.'viSA'.or.abrv.eq.'viSB')then
1192@@ -4642,9 +4683,11 @@
1193 wgtnstmp=bsv_wgt-born_wgt-
1194 # wgtwnstmpmuf*log(q2fact(1)/QES2)-
1195 # wgtwnstmpmur*log(scale**2/QES2)
1196+ wgtnstmp_avgvirt = avv_wgt
1197 else
1198 wgtnstmp=0d0
1199 wgtwnstmpmur=0.d0
1200+ wgtnstmp_avgvirt = 0d0
1201 endif
1202
1203 if (abrv(1:2).eq.'vi') then
1204@@ -5376,11 +5419,15 @@
1205 common/numberofparticles/fkssymmetryfactor,fkssymmetryfactorBorn,
1206 & fkssymmetryfactorDeg,ngluons,nquarks
1207
1208+ double precision iden_comp
1209+ common /c_iden_comp/iden_comp
1210+
1211 include 'coupl.inc'
1212 include 'genps.inc'
1213 include 'nexternal.inc'
1214 include 'fks_powers.inc'
1215 include 'nFKSconfigs.inc'
1216+ include 'c_weight.inc'
1217 integer fks_j_from_i(nexternal,0:nexternal)
1218 & ,particle_type(nexternal),pdg_type(nexternal)
1219 common /c_fks_inc/fks_j_from_i,particle_type,pdg_type
1220@@ -5416,13 +5463,14 @@
1221 character*1 integrate
1222 integer i_fks,j_fks
1223 common/fks_indices/i_fks,j_fks
1224- integer fac_i,fac_j,i_fks_pdg,j_fks_pdg
1225+ integer fac_i,fac_j,i_fks_pdg,j_fks_pdg,iden(nexternal)
1226
1227 integer fac_i_FKS(fks_configs),fac_j_FKS(fks_configs)
1228- $ ,i_type_FKS(fks_configs),j_type_FKS(fks_configs)
1229- $ ,m_type_FKS(fks_configs),ngluons_FKS(fks_configs)
1230+ & ,i_type_FKS(fks_configs),j_type_FKS(fks_configs)
1231+ & ,m_type_FKS(fks_configs),ngluons_FKS(fks_configs)
1232+ & ,iden_real_FKS(fks_configs),iden_born_FKS(fks_configs)
1233 save fac_i_FKS,fac_j_FKS,i_type_FKS,j_type_FKS,m_type_FKS
1234- $ ,ngluons_FKS
1235+ $ ,ngluons_FKS,iden_real_FKS,iden_born_FKS
1236
1237 character*13 filename
1238
1239@@ -5598,12 +5646,56 @@
1240 i_type_FKS(nFKSprocess)=i_type
1241 j_type_FKS(nFKSprocess)=j_type
1242 m_type_FKS(nFKSprocess)=m_type
1243+
1244+
1245+c Compute the identical particle symmetry factor that is in the
1246+c real-emission matrix elements.
1247+ iden_real_FKS(nFKSprocess)=1
1248+ do i=1,nexternal
1249+ iden(i)=1
1250+ enddo
1251+ do i=nincoming+2,nexternal
1252+ do j=nincoming+1,i-1
1253+ if (pdg_type(j).eq.pdg_type(i)) then
1254+ iden(j)=iden(j)+1
1255+ iden_real_FKS(nFKSprocess)=
1256+ & iden_real_FKS(nFKSprocess)*iden(j)
1257+ exit
1258+ endif
1259+ enddo
1260+ enddo
1261+c Compute the identical particle symmetry factor that is in the
1262+c Born matrix elements.
1263+ iden_born_FKS(nFKSprocess)=1
1264+ call set_pdg(0,nFKSprocess)
1265+ do i=1,nexternal
1266+ iden(i)=1
1267+ enddo
1268+ do i=nincoming+2,nexternal-1
1269+ do j=nincoming+1,i-1
1270+ if (pdg_uborn(j,0).eq.pdg_uborn(i,0)) then
1271+ iden(j)=iden(j)+1
1272+ iden_born_FKS(nFKSprocess)=
1273+ & iden_born_FKS(nFKSprocess)*iden(j)
1274+ exit
1275+ endif
1276+ enddo
1277+ enddo
1278 endif
1279
1280 i_type=i_type_FKS(nFKSprocess)
1281 j_type=j_type_FKS(nFKSprocess)
1282 m_type=m_type_FKS(nFKSprocess)
1283
1284+c Difference in identical particle factor in the Born and real emission
1285+c matrix elements. To define wgt_ME_tree for the Born, we need to
1286+c include this factor, because in the current Born the symmetry factor
1287+c for the real is used. THIS NEEDS TO BE CHANGED WHEN MERGING WITH THE
1288+c 'FKS_EW' STUFF
1289+ iden_comp=dble(iden_born_FKS(nFKSprocess))/
1290+ & dble(iden_real_FKS(nFKSprocess))
1291+
1292+
1293 c Set matrices used by MC counterterms
1294 if (match_to_shower) call set_mc_matrices
1295
1296@@ -5614,7 +5706,7 @@
1297 if (nbody.and.pdg_type(i_fks).eq.21) then
1298 fkssymmetryfactor=dble(ngluons)
1299 fkssymmetryfactorDeg=dble(ngluons)
1300- fkssymmetryfactorBorn=dble(ngluons)
1301+ fkssymmetryfactorBorn=1d0
1302 elseif(pdg_type(i_fks).eq.-21) then
1303 fkssymmetryfactor=1d0
1304 fkssymmetryfactorDeg=1d0
1305
1306=== modified file 'Template/NLO/SubProcesses/handling_lhe_events.f'
1307--- Template/NLO/SubProcesses/handling_lhe_events.f 2015-03-03 10:11:02 +0000
1308+++ Template/NLO/SubProcesses/handling_lhe_events.f 2016-03-16 17:59:03 +0000
1309@@ -661,20 +661,21 @@
1310 stop
1311 endif
1312 write(ifile,'(a)')' </rwgt>'
1313- elseif(jwgtinfo.eq.-5) then
1314- write(ifile,'(a)')' <rwgt>'
1315+ endif
1316+ if(jwgtinfo.eq.-5.or.jwgtinfo.eq.-9.or.jwgtinfo.eq.-8) then
1317+ write(ifile,'(a)')' <mgrwgt>'
1318 write (ifile,'(1x,d16.10,3(1x,i4))') wgtref,n_ctr_found
1319- & ,n_mom_conf,nint(wgtcpower)
1320+ & ,n_mom_conf, nint(wgtcpower)
1321 do i=1,n_mom_conf
1322 do j=1,mexternal
1323- write (ifile,'(4(1x,d16.10))')
1324+ write (ifile,'(4(1x,d21.15))')
1325 & (momenta_str(ii,j,i),ii=0,3)
1326 enddo
1327 enddo
1328 do i=1,n_ctr_found
1329 write (ifile,'(a)') trim(adjustl(n_ctr_str(i)))
1330 enddo
1331- write(ifile,'(a)')' </rwgt>'
1332+ write(ifile,'(a)')' </mgrwgt>'
1333 elseif(jwgtinfo.eq.15) then
1334 write(ifile,'(a)')' <unlops>'
1335 write(ifile,*)NUP_H
1336@@ -685,7 +686,8 @@
1337 $ VTIMUP_H(I),SPINUP_H(I)
1338 enddo
1339 write(ifile,'(a)')' </unlops>'
1340- elseif(jwgtinfo.eq.8)then
1341+ endif
1342+ if(jwgtinfo.eq.8.or.jwgtinfo.eq.-8)then
1343 write(ifile,'(a)') ' <rwgt>'
1344 write(ifile,406)wgtref,wgtxsecmu(1,1),numscales,numPDFpairs
1345 do i=1,numscales
1346@@ -697,8 +699,7 @@
1347 write(ifile,404)wgtxsecPDF(nps),wgtxsecPDF(nng)
1348 enddo
1349 write(ifile,'(a)') ' </rwgt>'
1350-
1351- elseif(jwgtinfo.eq.9)then
1352+ elseif(jwgtinfo.eq.9.or.jwgtinfo.eq.-9)then
1353 write(ifile,'(a)') ' <rwgt>'
1354 do i=1,numscales
1355 do j=1,numscales
1356@@ -904,7 +905,7 @@
1357 stop
1358 endif
1359 read(ifile,'(a)')string
1360- elseif(jwgtinfo.eq.-5) then
1361+ elseif(jwgtinfo.eq.-5.or.jwgtinfo.eq.-8.or.jwgtinfo.eq.-9) then
1362 read(ifile,'(a)')string
1363 read(ifile,*) wgtref,n_ctr_found,n_mom_conf,wgtcpower
1364 do i=1,n_mom_conf
1365@@ -916,7 +917,8 @@
1366 read (ifile,'(a)') n_ctr_str(i)
1367 enddo
1368 read(ifile,'(a)')string
1369- elseif(jwgtinfo.eq.15) then
1370+ endif
1371+ if(jwgtinfo.eq.15) then
1372 read(ifile,'(a)') string
1373 read(ifile,*)NUP_H
1374 do i=1,NUP_H
1375@@ -926,7 +928,7 @@
1376 $ VTIMUP_H(I),SPINUP_H(I)
1377 enddo
1378 read(ifile,'(a)') string
1379- elseif(jwgtinfo.eq.8)then
1380+ elseif(jwgtinfo.eq.8.or.jwgtinfo.eq.-8)then
1381 read(ifile,'(a)')string
1382 read(ifile,406)wgtref,wgtxsecmu(1,1),numscales,numPDFpairs
1383 do i=1,numscales
1384@@ -938,7 +940,7 @@
1385 read(ifile,404)wgtxsecPDF(nps),wgtxsecPDF(nng)
1386 enddo
1387 read(ifile,'(a)')string
1388- elseif(jwgtinfo.eq.9)then
1389+ elseif(jwgtinfo.eq.9.or.jwgtinfo.eq.-9)then
1390 read(ifile,'(a)')string
1391 wgtref=XWGTUP
1392 do i=1,numscales
1393@@ -1156,7 +1158,7 @@
1394 stop
1395 endif
1396 read(ifile,'(a)')string
1397- elseif(jwgtinfo.eq.-5) then
1398+ elseif(jwgtinfo.eq.-5.or.jwgtinfo.eq.-8.or.jwgtinfo.eq.-9) then
1399 read(ifile,'(a)')string
1400 read(ifile,*) wgtref,n_ctr_found,n_mom_conf,wgtcpower
1401 do i=1,n_mom_conf
1402@@ -1168,7 +1170,8 @@
1403 read (ifile,'(a)') n_ctr_str(i)
1404 enddo
1405 read(ifile,'(a)')string
1406- elseif(jwgtinfo.eq.15) then
1407+ endif
1408+ if(jwgtinfo.eq.15) then
1409 read(ifile,'(a)') string
1410 read(ifile,*)NUP_H
1411 do i=1,NUP_H
1412@@ -1178,7 +1181,7 @@
1413 $ VTIMUP_H(I),SPINUP_H(I)
1414 enddo
1415 read(ifile,'(a)') string
1416- elseif(jwgtinfo.eq.8)then
1417+ elseif(jwgtinfo.eq.8.or.jwgtinfo.eq.-8)then
1418 read(ifile,'(a)')string
1419 read(ifile,406)wgtref,wgtxsecmu(1,1),numscales,numPDFpairs
1420 do i=1,numscales
1421@@ -1190,7 +1193,7 @@
1422 read(ifile,404)wgtxsecPDF(nps),wgtxsecPDF(nng)
1423 enddo
1424 read(ifile,'(a)')string
1425- elseif(jwgtinfo.eq.9)then
1426+ elseif(jwgtinfo.eq.9.or.jwgtinfo.eq.-9)then
1427 read(ifile,'(a)')string
1428 wgtref=XWGTUP
1429 do i=1,numscales
1430
1431=== modified file 'Template/NLO/SubProcesses/montecarlocounter.f'
1432--- Template/NLO/SubProcesses/montecarlocounter.f 2015-09-14 18:56:28 +0000
1433+++ Template/NLO/SubProcesses/montecarlocounter.f 2016-03-16 17:59:03 +0000
1434@@ -1014,11 +1014,13 @@
1435
1436 logical calculatedBorn
1437 common/ccalculatedBorn/calculatedBorn
1438+ double precision iden_comp
1439+ common /c_iden_comp/iden_comp
1440
1441 c Particle types (=color) of i_fks, j_fks and fks_mother
1442 integer i_type,j_type,m_type
1443 common/cparticle_types/i_type,j_type,m_type
1444-
1445+
1446 c
1447 c BORN
1448 call sborn(p_born,wgt1)
1449@@ -1149,7 +1151,7 @@
1450 c BARRED AMPLITUDES
1451 do i=1,max_bcol
1452 if (sumborn.ne.0d0) then
1453- bornbars(i)=jamp2(i)/sumborn * born
1454+ bornbars(i)=jamp2(i)/sumborn * born *iden_comp
1455 elseif (born.eq.0d0 .or. jamp2(i).eq.0d0) then
1456 bornbars(i)=0d0
1457 else
1458@@ -1157,7 +1159,7 @@
1459 stop
1460 endif
1461 if (sumborn.ne.0d0) then
1462- bornbarstilde(i)=jamp2(i)/sumborn * borntilde
1463+ bornbarstilde(i)=jamp2(i)/sumborn * borntilde *iden_comp
1464 elseif (borntilde.eq.0d0 .or. jamp2(i).eq.0d0) then
1465 bornbarstilde(i)=0d0
1466 else
1467
1468=== modified file 'Template/NLO/SubProcesses/reweight.inc'
1469--- Template/NLO/SubProcesses/reweight.inc 2015-02-13 14:49:55 +0000
1470+++ Template/NLO/SubProcesses/reweight.inc 2016-03-16 17:59:03 +0000
1471@@ -30,8 +30,8 @@
1472 common/cwgtaux1/wgtdegrem_xi,wgtdegrem_lxi,wgtdegrem_muF
1473
1474 c Temporary quantities relevant to n-body terms
1475- double precision wgtnstmp,wgtwnstmpmuf,wgtwnstmpmur,wgtref_nbody,wgtvirttmp
1476- common/cwgtaux2/wgtnstmp,wgtwnstmpmuf,wgtwnstmpmur,wgtref_nbody,wgtvirttmp
1477+ double precision wgtnstmp,wgtwnstmpmuf,wgtwnstmpmur,wgtref_nbody,wgtvirttmp,wgtnstmp_avgvirt
1478+ common/cwgtaux2/wgtnstmp,wgtwnstmpmuf,wgtwnstmpmur,wgtref_nbody,wgtvirttmp,wgtnstmp_avgvirt
1479
1480 c Temporary weights for pure-NLO computations: event, counterevents+Born,
1481 c and Born, with the same conventions as in fks_singular
1482
1483=== modified file 'Template/NLO/SubProcesses/reweight_xsec_events.f'
1484--- Template/NLO/SubProcesses/reweight_xsec_events.f 2015-08-19 12:50:52 +0000
1485+++ Template/NLO/SubProcesses/reweight_xsec_events.f 2016-03-16 17:59:03 +0000
1486@@ -61,7 +61,11 @@
1487 write(*,*)' 0 otherwise'
1488 read(*,*)isave
1489 if(isave.eq.1)then
1490- isave=9
1491+ if (keep_rwgt_info)then
1492+ isave = -9
1493+ else
1494+ isave=9
1495+ endif
1496 else
1497 isave=0
1498 endif
1499@@ -431,10 +435,9 @@
1500
1501 write(buff,201)'#aMCatNLO',iSorH_lhe,ifks_lhe,jfks_lhe,
1502 $ fksfather_lhe,ipartner_lhe, scale1_lhe,scale2_lhe, isave
1503- $ ,izero,izero, wgtcentral,wgtmumin,wgtmumax,wgtpdfmin
1504+ $ ,mexternal,iwgtnumpartn, wgtcentral,wgtmumin,wgtmumax,wgtpdfmin
1505 $ ,wgtpdfmax
1506
1507-
1508 c renormalize all the scale & PDF weights to have the same normalization
1509 c as XWGTUP
1510 if(do_rwgt_scale)then
1511@@ -494,7 +497,7 @@
1512 endif
1513 close(34)
1514
1515- 201 format(a9,1x,i1,4(1x,i2),2(1x,e14.8),1x,i1,2(1x,i2),5(1x,e14.8))
1516+ 201 format(a9,1x,i1,4(1x,i2),2(1x,e14.8),1x,i2,2(1x,i2),5(1x,e14.8))
1517
1518 end
1519
1520@@ -574,16 +577,25 @@
1521 include 'nexternal.inc'
1522 include 'c_weight.inc'
1523 include 'reweight0.inc'
1524- integer i,idum,j,k,momenta_conf
1525+ integer i,idum,j,k,momenta_conf(2),ii
1526 icontr=n_ctr_found
1527 iwgt=1
1528 do i=1,icontr
1529- read(n_ctr_str(i),*)(wgt(j,i),j=1,3),idum,(pdg(j,i),j=1
1530- & ,nexternal),QCDpower(i),(bjx(j,i),j=1,2),(scales2(j,i),j=1
1531- & ,3),momenta_conf,itype(i),nFKS(i),wgts(1,i)
1532- do j=1,nexternal
1533- do k=0,3
1534- momenta(k,j,i)=momenta_str(k,j,momenta_conf)
1535+ read(n_ctr_str(i),*)(wgt(j,i),j=1,3),(wgt_ME_tree(j,i),j=1,2)
1536+ & ,idum,(pdg(j,i),j=1,nexternal),QCDpower(i),(bjx(j,i),j=1
1537+ & ,2),(scales2(j,i),j=1,3),g_strong(i),(momenta_conf(j),j=1
1538+ & ,2),itype(i),nFKS(i),idum,idum,idum,wgts(1,i)
1539+ do ii=1,2
1540+ do j=1,nexternal
1541+ do k=0,3
1542+ if (momenta_conf(ii).gt.0) then
1543+ momenta_m(k,j,ii,i)=momenta_str(k,j
1544+ $ ,momenta_conf(ii))
1545+ else
1546+ momenta_m(k,j,ii,i)=-99d0
1547+ exit
1548+ endif
1549+ enddo
1550 enddo
1551 enddo
1552 enddo
1553
1554=== modified file 'Template/NLO/bin/aMCatNLO'
1555--- Template/NLO/bin/aMCatNLO 2015-03-14 02:21:38 +0000
1556+++ Template/NLO/bin/aMCatNLO 2016-03-16 17:59:03 +0000
1557@@ -164,7 +164,10 @@
1558 cmd_line.run_cmd('quit')
1559 elif args:
1560 # a single command is provided
1561- cmd_line = cmd_interface.aMCatNLOCmd()
1562+ if options.web:
1563+ cmd_line = cmd_interface.aMCatNLOCmd()
1564+ else:
1565+ cmd_line = cmd_interface.aMCatNLOCmdShell()
1566 if not hasattr(cmd_line, 'do_%s' % args[0]):
1567 if parser_error:
1568 print parser_error
1569
1570=== added directory 'Template/RWGTNLO'
1571=== added file 'Template/RWGTNLO/__init__.py'
1572=== added file 'Template/RWGTNLO/alfas.inc'
1573--- Template/RWGTNLO/alfas.inc 1970-01-01 00:00:00 +0000
1574+++ Template/RWGTNLO/alfas.inc 2016-03-16 17:59:03 +0000
1575@@ -0,0 +1,11 @@
1576+c***********************************************************************
1577+c this files contains the common blocks for the
1578+c the alpha_s settings
1579+c
1580+c asmz = alpha_s(Mz) is set based on the pdf chosen in setcuts.f
1581+c nloop = order of the running of alpha_s based on the pdf chosen
1582+c***********************************************************************
1583+ integer nloop
1584+ double precision asmz
1585+ common/a_block/asmz,nloop
1586+
1587
1588=== added file 'Template/RWGTNLO/alfas_functions_lhapdf.f'
1589--- Template/RWGTNLO/alfas_functions_lhapdf.f 1970-01-01 00:00:00 +0000
1590+++ Template/RWGTNLO/alfas_functions_lhapdf.f 2016-03-16 17:59:03 +0000
1591@@ -0,0 +1,167 @@
1592+C
1593+C-----------------------------------------------------------------------------
1594+C
1595+ double precision function alfa(alfa0,qsq )
1596+C
1597+C-----------------------------------------------------------------------------
1598+C
1599+C This function returns the 1-loop value of alpha.
1600+C
1601+C INPUT:
1602+C qsq = Q^2
1603+C
1604+C-----------------------------------------------------------------------------
1605+C
1606+ implicit none
1607+ double precision qsq,alfa0
1608+c
1609+c constants
1610+c
1611+ double precision One, Three, Pi,zmass
1612+ parameter( One = 1.0d0, Three = 3.0d0 )
1613+ parameter( Pi = 3.14159265358979323846d0 )
1614+ parameter( zmass = 91.188d0 )
1615+cc
1616+ alfa = alfa0 / ( 1.0d0 - alfa0*dlog( qsq/zmass**2 ) /Three /Pi )
1617+ccc
1618+ return
1619+ end
1620+
1621+C
1622+C-----------------------------------------------------------------------------
1623+C
1624+ double precision function alfaw(alfaw0,qsq,nh )
1625+C
1626+C-----------------------------------------------------------------------------
1627+C
1628+C This function returns the 1-loop value of alpha_w.
1629+C
1630+C INPUT:
1631+C qsq = Q^2
1632+C nh = # of Higgs doublets
1633+C
1634+C-----------------------------------------------------------------------------
1635+C
1636+ implicit none
1637+ double precision qsq, alphaw, dum,alfaw0
1638+ integer nh, nq
1639+c
1640+c include
1641+c
1642+
1643+c
1644+c constants
1645+c
1646+ double precision Two, Four, Pi, Twpi, zmass,tmass
1647+ parameter( Two = 2.0d0, Four = 4.0d0 )
1648+ parameter( Pi = 3.14159265358979323846d0 )
1649+ parameter( Twpi = 3.0d0*Four*Pi )
1650+ parameter( zmass = 91.188d0,tmass=174d0 )
1651+cc
1652+ if ( qsq.ge.tmass**2 ) then
1653+ nq = 6
1654+ else
1655+ nq = 5
1656+ end if
1657+ dum = ( 22.0d0 - Four*nq - nh/Two ) / Twpi
1658+ alfaw = alfaw0 / ( 1.0d0 + dum*alfaw0*dlog( qsq/zmass**2 ) )
1659+ccc
1660+ return
1661+ end
1662+
1663+C-----------------------------------------------------------------------------
1664+C
1665+ DOUBLE PRECISION FUNCTION ALPHAS(Q)
1666+C wrapper to the lhapdf alphaS
1667+C-----------------------------------------------------------------------------
1668+ IMPLICIT NONE
1669+c
1670+ include 'alfas.inc'
1671+ REAL*8 Q,alphasPDF
1672+ external alphasPDF
1673+
1674+c timing statistics
1675+c include "timing_variables.inc"
1676+
1677+c This function takes 20 micro seconds to run, so it is ok to profile
1678+c it with the 0.3 ms function cpu_time.
1679+c call cpu_time(tbefore)
1680+ ALPHAS=alphasPDF(Q)
1681+c call cpu_time(tAfter)
1682+
1683+c tPDF = tPDF + (tAfter-tBefore)
1684+
1685+ RETURN
1686+ END
1687+
1688+C-----------------------------------------------------------------------------
1689+C
1690+ double precision function mfrun(mf,scale,asmz,nloop)
1691+C
1692+C-----------------------------------------------------------------------------
1693+C
1694+C This function returns the 2-loop value of a MSbar fermion mass
1695+C at a given scale.
1696+C
1697+C INPUT: mf = MSbar mass of fermion at MSbar fermion mass scale
1698+C scale = scale at which the running mass is evaluated
1699+C asmz = AS(MZ) : this is passed to alphas(scale,asmz,nloop)
1700+C nloop = # of loops in the evolution
1701+C
1702+C
1703+C
1704+C EXTERNAL: double precision alphas(scale,asmz,nloop)
1705+C
1706+C-----------------------------------------------------------------------------
1707+C
1708+ implicit none
1709+C
1710+C ARGUMENTS
1711+C
1712+ double precision mf,scale,asmz
1713+ integer nloop
1714+C
1715+C LOCAL
1716+C
1717+ double precision beta0, beta1,gamma0,gamma1
1718+ double precision A1,as,asmf,l2
1719+ integer nf
1720+C
1721+C EXTERNAL
1722+C
1723+ double precision alphas
1724+ external alphas
1725+c
1726+c CONSTANTS
1727+c
1728+ double precision One, Two, Three, Pi
1729+ parameter( One = 1.0d0, Two = 2.0d0, Three = 3.0d0 )
1730+ parameter( Pi = 3.14159265358979323846d0)
1731+ double precision tmass
1732+ parameter(tmass=174d0)
1733+cc
1734+C
1735+C
1736+ if ( mf.gt.tmass ) then
1737+ nf = 6
1738+ else
1739+ nf = 5
1740+ end if
1741+
1742+ beta0 = ( 11.0d0 - Two/Three *nf )/4d0
1743+ beta1 = ( 102d0 - 38d0/Three*nf )/16d0
1744+ gamma0= 1d0
1745+ gamma1= ( 202d0/3d0 - 20d0/9d0*nf )/16d0
1746+ A1 = -beta1*gamma0/beta0**2+gamma1/beta0
1747+ as = alphas(scale)
1748+ asmf = alphas(mf)
1749+ l2 = (1+ A1*as/Pi)/(1+ A1*asmf/Pi)
1750+
1751+
1752+ mfrun = mf * (as/asmf)**(gamma0/beta0)
1753+
1754+ if(nloop.eq.2) mfrun =mfrun*l2
1755+ccc
1756+ return
1757+ end
1758+
1759
1760=== added file 'Template/RWGTNLO/makefile'
1761--- Template/RWGTNLO/makefile 1970-01-01 00:00:00 +0000
1762+++ Template/RWGTNLO/makefile 2016-03-16 17:59:03 +0000
1763@@ -0,0 +1,19 @@
1764+include ../Source/make_opts
1765+
1766+LIBDIR = ../lib/
1767+LINKLIBS = -L../lib/ -lpdf $(llhapdf)
1768+LIBS = $(LIBDIR)libpdf.$(libext)
1769+
1770+#note only support lhapdf=True
1771+RWGT=rwgt.f $(alphas_functions)
1772+
1773+rwgt2py.so: rwgt.f makefile $(LIBS)
1774+ touch __init__.py
1775+ touch ../__init__.py
1776+ $(F2PY) $(LDFLAGS) $(LINKLIBS) -c $(RWGT) -m rwgt2py --fcompiler=$(FC)
1777+
1778+$(LIBS):
1779+ cd PDF; make
1780+
1781+
1782+
1783
1784=== added file 'Template/RWGTNLO/rwgt.f'
1785--- Template/RWGTNLO/rwgt.f 1970-01-01 00:00:00 +0000
1786+++ Template/RWGTNLO/rwgt.f 2016-03-16 17:59:03 +0000
1787@@ -0,0 +1,114 @@
1788+ subroutine initialise(lpp, pdfid)
1789+ implicit none
1790+ integer lpp(2)
1791+ integer pdfid
1792+CF2PY INTENT(IN) :: LPP(2)
1793+CF2PY INTENT(IN) :: PDF
1794+
1795+ integer save_lpp(2)
1796+ common/beam_type/save_lpp
1797+ double precision value(20)
1798+ character*20 parm(20)
1799+c Save the beam type information
1800+ save_lpp(1) = lpp(1)
1801+ save_lpp(2) = lpp(2)
1802+
1803+c Initialise the pdf
1804+ if (abs(lpp(1)).eq.1.or.abs(lpp(2)).eq.1)then
1805+ value(1)=pdfid
1806+ parm(1)='DEFAULT'
1807+ call pdfset(parm,value)
1808+ endif
1809+ return
1810+ end
1811+
1812+ subroutine test_pdf()
1813+ implicit none
1814+ integer lpp(2)
1815+ double precision pdf, PDG2PDF
1816+ lpp(1)=1
1817+ lpp(2) =1
1818+ call initialise(lpp, 230000)
1819+ pdf = PDG2PDF(1,1,0.1,100)
1820+ write(*,*) pdf
1821+ end
1822+
1823+
1824+
1825+ subroutine get_wgt(scales2, pdg, bjx, wgt, g, qcdpower, ymur,
1826+ & ymuf, n_ctr, new_wgt, all_wgt)
1827+ implicit none
1828+ double precision scales2(3,n_ctr)
1829+ integer pdg(2, n_ctr)
1830+ double precision bjx(2,n_ctr)
1831+ double precision g(n_ctr)
1832+ integer qcdpower(n_ctr)
1833+ double precision wgt(3, n_ctr)
1834+ double precision ymur, ymuf
1835+ integer n_ctr
1836+ double precision new_wgt
1837+ double precision all_wgt(n_ctr)
1838+
1839+CF2PY INTENT(IN) :: scales2(3, n_ctr)
1840+CF2PY INTENT(IN) :: pdg(2, n_ctr)
1841+CF2PY INTENT(IN) :: bjx(2, n_ctr)
1842+CF2PY INTENT(IN) :: wgt(3, n_ctr)
1843+CF2PY INTENT(IN) :: g(n_ctr)
1844+CF2PY INTENT(IN) :: qcdpower(n_ctr)
1845+CF2PY INTENT(IN) :: ymur
1846+CF2PY INTENT(IN) :: ymuf
1847+CF2PY depend(n_ctr) :: scales2, pdg, bjx, qcdpower
1848+CF2PY INTENT(OUT) :: new_wgt
1849+CF2PY INTENT(OUT) :: all_wgt(n_ctr)
1850+
1851+
1852+ integer save_lpp(2)
1853+ common/beam_type/save_lpp
1854+
1855+c LOCAL
1856+ integer i,kr
1857+ double precision mu2_q
1858+ double precision mu2_r, mu2_f
1859+ double precision xlum
1860+ integer lp, pd
1861+ double precision pi
1862+ parameter (pi=3.14159265358979323846d0)
1863+c debug
1864+ double precision gs,add_wgt
1865+c external
1866+ double precision alphas, pdg2pdf
1867+ external alphas, pdg2pdf
1868+ new_wgt = 0d0
1869+
1870+ do i=1, n_ctr
1871+ mu2_q=scales2(1,i)
1872+ mu2_r=scales2(2,i)*ymuR**2
1873+c Update the strong coupling
1874+ mu2_f=scales2(3,i)*ymuF**2
1875+c gs = sqrt(4d0*pi*alphas(sqrt(mu2_r)))
1876+c call the PDFs
1877+ xlum=1d0
1878+ LP=SIGN(1,save_LPP(1))
1879+ pd=pdg(1,i)
1880+ if (pd.eq.21) pd=0
1881+ xlum=xlum*PDG2PDF(ABS(save_LPP(1)),pd*LP,bjx(1,i)
1882+ & ,DSQRT(mu2_f))
1883+ LP=SIGN(1,save_LPP(2))
1884+ pd=pdg(2,i)
1885+ if (pd.eq.21) pd=0
1886+ xlum=xlum*PDG2PDF(ABS(save_LPP(2)),pd*LP,bjx(2,i)
1887+ & ,DSQRT(mu2_f))
1888+c write(*,*) "xlum", xlum
1889+c add the weights to the array
1890+ add_wgt = xlum * (wgt(1,i)+wgt(2,i)*log(mu2_r
1891+ & /mu2_q)+wgt(3,i)*log(mu2_f/mu2_q))*g(i)
1892+ & **QCDpower(i)
1893+c write(*,*) i, add_wgt
1894+ all_wgt(i) = add_wgt
1895+ new_wgt = new_wgt + add_wgt
1896+c wgts(iwgt,i)=wgts(iwgt,i)
1897+c & *rwgt_muR_dep_fac(sqrt(mu2_r(kr)))
1898+ enddo
1899+ return
1900+ end
1901+
1902
1903=== added file 'Template/RWGTNLO/setrun.f'
1904--- Template/RWGTNLO/setrun.f 1970-01-01 00:00:00 +0000
1905+++ Template/RWGTNLO/setrun.f 2016-03-16 17:59:03 +0000
1906@@ -0,0 +1,88 @@
1907+C-------------------------------------------------
1908+C GET_PDFUP
1909+C Convert MadEvent pdf name to LHAPDF number
1910+C-------------------------------------------------
1911+
1912+ subroutine get_pdfup(pdfin,pdfgup,pdfsup,lhaid)
1913+ implicit none
1914+
1915+ character*(*) pdfin
1916+ integer mpdf
1917+ integer npdfs,i,pdfgup(2),pdfsup(2),lhaid
1918+
1919+ parameter (npdfs=16)
1920+ character*7 pdflabs(npdfs)
1921+ data pdflabs/
1922+ $ 'none',
1923+ $ 'mrs02nl',
1924+ $ 'mrs02nn',
1925+ $ 'cteq4_m',
1926+ $ 'cteq4_l',
1927+ $ 'cteq4_d',
1928+ $ 'cteq5_m',
1929+ $ 'cteq5_d',
1930+ $ 'cteq5_l',
1931+ $ 'cteq5m1',
1932+ $ 'cteq6_m',
1933+ $ 'cteq6_l',
1934+ $ 'cteq6l1',
1935+ $ 'nn23lo',
1936+ $ 'nn23lo1',
1937+ $ 'nn23nlo'/
1938+ integer numspdf(npdfs)
1939+ data numspdf/
1940+ $ 00000,
1941+ $ 20250,
1942+ $ 20270,
1943+ $ 19150,
1944+ $ 19170,
1945+ $ 19160,
1946+ $ 19050,
1947+ $ 19060,
1948+ $ 19070,
1949+ $ 19051,
1950+ $ 10000,
1951+ $ 10041,
1952+ $ 10042,
1953+ $ 246800,
1954+ $ 247000,
1955+ $ 244600/
1956+
1957+
1958+ if(pdfin.eq."lhapdf") then
1959+ write(*,*)'using LHAPDF'
1960+ do i=1,2
1961+ pdfgup(i)=-1
1962+ pdfsup(i)=lhaid
1963+ enddo
1964+ return
1965+ endif
1966+
1967+
1968+ mpdf=-1
1969+ do i=1,npdfs
1970+ if(pdfin(1:len_trim(pdfin)) .eq. pdflabs(i))then
1971+ mpdf=numspdf(i)
1972+ endif
1973+ enddo
1974+
1975+ if(mpdf.eq.-1) then
1976+ write(*,*)'ERROR: pdf ',pdfin,' not implemented in get_pdfup.'
1977+ write(*,*)'known pdfs are'
1978+ write(*,*) pdflabs
1979+ open(unit=26,file='../../error',status='unknown')
1980+ write(26,*)'ERROR: pdf ',pdfin,' not implemented in get_pdfup.'
1981+ write(26,*)'known pdfs are'
1982+ write(26,*) pdflabs
1983+ stop 1
1984+c$$$ write(*,*)'using ',pdflabs(12)
1985+c$$$ mpdf=numspdf(12)
1986+ endif
1987+
1988+ do i=1,2
1989+ pdfgup(i)=-1
1990+ pdfsup(i)=mpdf
1991+ enddo
1992+
1993+ return
1994+ end
1995
1996=== added file 'Template/RWGTNLO/timing_variables.inc'
1997--- Template/RWGTNLO/timing_variables.inc 1970-01-01 00:00:00 +0000
1998+++ Template/RWGTNLO/timing_variables.inc 2016-03-16 17:59:03 +0000
1999@@ -0,0 +1,9 @@
2000+* -*-fortran-*-
2001+
2002+ real tBefore, tAfter
2003+ real tBorn,tIS,tReal,tCount,tFxFx,tf_nb,tf_all,t_as,tr_s,tr_pdf
2004+ & ,t_plot,t_cuts,t_MC_subt,t_isum,t_p_unw,t_write
2005+ common/timings/tBorn,tIS,tReal,tCount,tFxFx,tf_nb,tf_all,t_as
2006+ & ,tr_s,tr_pdf,t_plot,t_cuts,t_MC_subt,t_isum,t_p_unw,t_write
2007+ real tOLP, tFastJet, tPDF, tGenPS, tDSigI, tDSigR
2008+ common/timings_old/tOLP, tFastJet, tPDF, tGenPS, tDSigI, tDSigR
2009
2010=== modified file 'Template/loop_material/StandAlone/SubProcesses/makefile'
2011--- Template/loop_material/StandAlone/SubProcesses/makefile 2016-02-12 01:48:16 +0000
2012+++ Template/loop_material/StandAlone/SubProcesses/makefile 2016-03-16 17:59:03 +0000
2013@@ -8,14 +8,15 @@
2014 else
2015 ROOT = ..
2016 endif
2017+LIBDIR = $(ROOT)/lib/
2018+
2019+PROG = check
2020+all : $(PROG)
2021
2022 include $(ROOT)/Source/make_opts
2023 include $(ROOT)/SubProcesses/MadLoop_makefile_definitions
2024 SHELL = /bin/bash
2025
2026-LIBDIR = $(ROOT)/lib/
2027-PROG = check
2028-all : $(PROG)
2029 OLP = OLP
2030 STABCHECKDRIVER = StabilityCheckDriver
2031 CHECK_SA_BORN_SPLITORDERS = check_sa_born_splitOrders
2032@@ -80,19 +81,22 @@
2033 ar rcs libMadLoop.$(libext) $(OLP_PROCESS)
2034 mv libMadLoop.$(libext) $(MADLOOP_LIB)
2035
2036-clean:
2037- @rm -f *.o *.so
2038-
2039 ../$(OLP):
2040- cd ..; make $(OLP); cd -
2041- rm -f libMadLoop.dylib
2042- ln -s ../libMadLoop.dylib
2043-
2044-libMadLoop.dylib: ../$(OLP)
2045+ rm -f libMadLoop.$(dylibext)
2046+ ln -s ../libMadLoop.$(dylibext)
2047+ cd $(ROOT)/SubProcesses; make $(OLP)
2048+
2049+../$(OLP)_static:
2050+ cd $(ROOT)/SubProcesses; make $(OLP)_static
2051+
2052+libMadLoop.$(dylibext): ../$(OLP)
2053
2054 ifeq ($(origin MENUM),undefined)
2055 MENUM=2
2056 endif
2057-matrix$(MENUM)py.so: ../$(OLP)
2058+matrix$(MENUM)py.so: ../$(OLP)_static f2py_wrapper.f
2059 touch __init__.py
2060- $(F2PY) -L. -lMadLoop -m matrix$(MENUM)py -c check_sa.f --fcompiler=$(FC)
2061+ $(F2PY) $(STDLIB) $(MADLOOP_LIB) -m matrix$(MENUM)py -c f2py_wrapper.f --fcompiler=$(FC) -L../../lib/ -ldhelas -lmodel $(LINK_LOOP_LIBS)
2062+
2063+clean:
2064+ @rm -f *.o *.so *.$(libext) *.$(dylibext)
2065
2066=== modified file 'UpdateNotes.txt'
2067--- UpdateNotes.txt 2016-03-03 10:41:29 +0000
2068+++ UpdateNotes.txt 2016-03-16 17:59:03 +0000
2069@@ -1,7 +1,8 @@
2070 Update notes for MadGraph5_aMC@NLO (in reverse time order)
2071
2072-2.4.0(XX/XX/XX)
2073- MZ: updated FJcore to version 3.1.3 (was 3.0.5)
2074+
2075+2.4.0 (XX/XX/XX)
2076+ OM: Allowing the proper NLO reweighting for NLO sample
2077 MZ: new NLO generation mode. It is more efficient from the memory and CPU point of
2078 view, in particular for high-multiplicity processes.
2079 Many thanks to Josh Bendavid for his fundamental contribution for this.
2080@@ -24,6 +25,8 @@
2081 MZ: Fix problem with slurm cluster
2082 OM: Improve scan functionalities
2083 PT: New way of handling Pythia8 decays
2084+ OM: Allow to keep the reweight information in the final lhe file for future computation
2085+ MZ: updated FJcore to version 3.1.3 (was 3.0.5)
2086
2087 2.3.3 (15/10/15)
2088 OM: Having two mode for "output pythia8" one (default) for pythia8.2 and one for pythia8.1 (with --version=8.1)
2089
2090=== modified file 'VERSION'
2091--- VERSION 2015-10-25 15:53:09 +0000
2092+++ VERSION 2016-03-16 17:59:03 +0000
2093@@ -1,5 +1,5 @@
2094-version = 2.3.3
2095-date = 2015-10-25
2096+version = 2.4.0.beta
2097+date = 2016-01-25
2098
2099
2100
2101
2102=== modified file 'madgraph/core/base_objects.py'
2103--- madgraph/core/base_objects.py 2016-02-18 20:27:51 +0000
2104+++ madgraph/core/base_objects.py 2016-03-16 17:59:03 +0000
2105@@ -2949,13 +2949,16 @@
2106 'legs_with_decays', 'perturbation_couplings', 'has_born',
2107 'NLO_mode','split_orders']
2108
2109- def nice_string(self, indent=0, print_weighted = True):
2110+ def nice_string(self, indent=0, print_weighted = True, prefix=True):
2111 """Returns a nicely formated string about current process
2112 content. Since the WEIGHTED order is automatically set and added to
2113 the user-defined list of orders, it can be ommitted for some info
2114 displays."""
2115
2116- mystr = " " * indent + "Process: "
2117+ if prefix:
2118+ mystr = " " * indent + "Process: "
2119+ else:
2120+ mystr = ""
2121 prevleg = None
2122 for leg in self['legs']:
2123 mypart = self['model'].get('particle_dict')[leg['id']]
2124@@ -3651,11 +3654,42 @@
2125
2126 return max_order_now, particles, hierarchy
2127
2128- def nice_string(self, indent=0, print_weighted=False):
2129+ def __iter__(self):
2130+ """basic way to loop over all the process definition.
2131+ not used by MG which used some smarter version (use by ML)"""
2132+
2133+ isids = [leg['ids'] for leg in self['legs'] \
2134+ if leg['state'] == False]
2135+ fsids = [leg['ids'] for leg in self['legs'] \
2136+ if leg['state'] == True]
2137+
2138+ red_isidlist = []
2139+ # Generate all combinations for the initial state
2140+ for prod in itertools.product(*isids):
2141+ islegs = [Leg({'id':id, 'state': False}) for id in prod]
2142+ if tuple(sorted(prod)) in red_isidlist:
2143+ continue
2144+ red_isidlist.append(tuple(sorted(prod)))
2145+ red_fsidlist = []
2146+ for prod in itertools.product(*fsids):
2147+ # Remove double counting between final states
2148+ if tuple(sorted(prod)) in red_fsidlist:
2149+ continue
2150+ red_fsidlist.append(tuple(sorted(prod)))
2151+ leg_list = [copy.copy(leg) for leg in islegs]
2152+ leg_list.extend([Leg({'id':id, 'state': True}) for id in prod])
2153+ legs = LegList(leg_list)
2154+ process = self.get_process_with_legs(legs)
2155+ yield process
2156+
2157+ def nice_string(self, indent=0, print_weighted=False, prefix=True):
2158 """Returns a nicely formated string about current process
2159 content"""
2160
2161- mystr = " " * indent + "Process: "
2162+ if prefix:
2163+ mystr = " " * indent + "Process: "
2164+ else:
2165+ mystr=""
2166 prevleg = None
2167 for leg in self['legs']:
2168 myparts = \
2169
2170=== modified file 'madgraph/core/diagram_generation.py'
2171--- madgraph/core/diagram_generation.py 2016-02-23 22:55:27 +0000
2172+++ madgraph/core/diagram_generation.py 2016-03-16 17:59:03 +0000
2173@@ -847,9 +847,6 @@
2174 for name, (value, operator) in self['process'].get('constrained_orders').items():
2175 res.filter_constrained_orders(name, value, operator)
2176
2177-
2178-
2179-
2180 # Iterate the filtering since the applying the constraint on one
2181 # type of coupling order can impact what the filtering on a previous
2182 # one (relevant for the '==' type of constraint).
2183
2184=== modified file 'madgraph/interface/amcatnlo_interface.py'
2185--- madgraph/interface/amcatnlo_interface.py 2016-02-24 13:44:29 +0000
2186+++ madgraph/interface/amcatnlo_interface.py 2016-03-16 17:59:03 +0000
2187@@ -737,7 +737,7 @@
2188 subproc_path = os.path.join(path, os.path.pardir, 'SubProcesses', \
2189 'initial_states_map.dat')
2190 self._curr_exporter.write_init_map(subproc_path,
2191- self._curr_matrix_elements.get('initial_states'))
2192+ self._curr_matrix_elements.get('initial_states'))
2193
2194 cpu_time1 = time.time()
2195
2196
2197=== modified file 'madgraph/interface/amcatnlo_run_interface.py'
2198--- madgraph/interface/amcatnlo_run_interface.py 2016-03-14 10:17:10 +0000
2199+++ madgraph/interface/amcatnlo_run_interface.py 2016-03-16 17:59:03 +0000
2200@@ -938,16 +938,8 @@
2201 self.nb_core = 0
2202 self.prompt = "%s>"%os.path.basename(pjoin(self.me_dir))
2203
2204- # load the current status of the directory
2205- if os.path.exists(pjoin(self.me_dir,'HTML','results.pkl')):
2206- self.results = save_load_object.load_from_file(pjoin(self.me_dir,'HTML','results.pkl'))
2207- self.results.resetall(self.me_dir)
2208- self.last_mode = self.results[self.results.lastrun][-1]['run_mode']
2209- else:
2210- model = self.find_model_name()
2211- process = self.process # define in find_model_name
2212- self.results = gen_crossxhtml.AllResultsNLO(model, process, self.me_dir)
2213- self.last_mode = ''
2214+
2215+ self.load_results_db()
2216 self.results.def_web_mode(self.web)
2217 # check that compiler is gfortran 4.6 or later if virtuals have been exported
2218 proc_card = open(pjoin(self.me_dir, 'Cards', 'proc_card_mg5.dat')).read()
2219@@ -1236,7 +1228,7 @@
2220 you have to remove some events after showering 'by hand'.
2221 Please read http://amcatnlo.cern.ch/FxFx_merging.htm for more details.""")
2222
2223-
2224+ self.store_result()
2225 #check if the param_card defines a scan.
2226 if self.param_card_iterator:
2227 param_card_iterator = self.param_card_iterator
2228@@ -3324,6 +3316,17 @@
2229
2230 if not self.to_store:
2231 return
2232+
2233+ if 'event' in self.to_store:
2234+ if os.path.exists(pjoin(self.me_dir,'Events', self.run_name, 'events.lhe')):
2235+ if not os.path.exists(pjoin(self.me_dir,'Events', self.run_name, 'events.lhe.gz')):
2236+ self.update_status('gzipping output file: events.lhe', level='parton', error=True)
2237+ misc.gzip(pjoin(self.me_dir,'Events', self.run_name, 'events.lhe'))
2238+ else:
2239+ os.remove(pjoin(self.me_dir,'Events', self.run_name, 'events.lhe'))
2240+ if os.path.exists(pjoin(self.me_dir,'Events','reweight.lhe')):
2241+ os.remove(pjoin(self.me_dir,'Events', 'reweight.lhe'))
2242+
2243
2244 tag = self.run_card['run_tag']
2245
2246@@ -4333,10 +4336,6 @@
2247 'madspin': default_switch,
2248 'reweight': default_switch}
2249
2250-
2251-
2252-
2253-
2254 description = {'order': 'Perturbative order of the calculation:',
2255 'fixed_order': 'Fixed order (no event generation and no MC@[N]LO matching):',
2256 'shower': 'Shower the generated events:',
2257@@ -4539,9 +4538,17 @@
2258 if mode =='onlyshower':
2259 cards = ['shower_card.dat']
2260
2261+
2262+ # automatically switch to keep_wgt option
2263+ first_cmd = [] # force to change some switch
2264+ #if switch['reweight'] == 'ON':
2265+ # logger.info("Automatically switch \"keep_rwgt_info\" in the run_card to allow NLO reweighting", '$MG:color:BLACK')
2266+ # first_cmd.append('set keep_rwgt_info T')
2267+
2268 if not options['force'] and not self.force:
2269- self.ask_edit_cards(cards, plot=False)
2270+ self.ask_edit_cards(cards, plot=False, first_cmd=first_cmd)
2271
2272+
2273 self.banner = banner_mod.Banner()
2274
2275 # store the cards in the banner
2276@@ -4590,7 +4597,6 @@
2277 analyse_card_path = pjoin(self.me_dir, 'Cards','FO_analyse_card.dat')
2278 self.analyse_card = self.banner.charge_card('FO_analyse_card')
2279
2280-
2281 return mode
2282
2283
2284@@ -4710,4 +4716,100 @@
2285 _shower_parser.add_option("-f", "--force", default=False, action='store_true',
2286 help="Use the shower_card present in the directory for the launch, without editing")
2287
2288+if '__main__' == __name__:
2289+ # Launch the interface without any check if one code is already running.
2290+ # This can ONLY run a single command !!
2291+ import sys
2292+ if not sys.version_info[0] == 2 or sys.version_info[1] < 6:
2293+ sys.exit('MadGraph/MadEvent 5 works only with python 2.6 or later (but not python 3.X).\n'+\
2294+ 'Please upgrate your version of python.')
2295+
2296+ import os
2297+ import optparse
2298+ # Get the directory of the script real path (bin)
2299+ # and add it to the current PYTHONPATH
2300+ root_path = os.path.dirname(os.path.dirname(os.path.realpath( __file__ )))
2301+ sys.path.insert(0, root_path)
2302+
2303+ class MyOptParser(optparse.OptionParser):
2304+ class InvalidOption(Exception): pass
2305+ def error(self, msg=''):
2306+ raise MyOptParser.InvalidOption(msg)
2307+ # Write out nice usage message if called with -h or --help
2308+ usage = "usage: %prog [options] [FILE] "
2309+ parser = MyOptParser(usage=usage)
2310+ parser.add_option("-l", "--logging", default='INFO',
2311+ help="logging level (DEBUG|INFO|WARNING|ERROR|CRITICAL) [%default]")
2312+ parser.add_option("","--web", action="store_true", default=False, dest='web', \
2313+ help='force toce to be in secure mode')
2314+ parser.add_option("","--debug", action="store_true", default=False, dest='debug', \
2315+ help='force to launch debug mode')
2316+ parser_error = ''
2317+ done = False
2318+
2319+ for i in range(len(sys.argv)-1):
2320+ try:
2321+ (options, args) = parser.parse_args(sys.argv[1:len(sys.argv)-i])
2322+ done = True
2323+ except MyOptParser.InvalidOption, error:
2324+ pass
2325+ else:
2326+ args += sys.argv[len(sys.argv)-i:]
2327+ if not done:
2328+ # raise correct error:
2329+ try:
2330+ (options, args) = parser.parse_args()
2331+ except MyOptParser.InvalidOption, error:
2332+ print error
2333+ sys.exit(2)
2334+
2335+ if len(args) == 0:
2336+ args = ''
2337+
2338+ import subprocess
2339+ import logging
2340+ import logging.config
2341+ # Set logging level according to the logging level given by options
2342+ #logging.basicConfig(level=vars(logging)[options.logging])
2343+ import internal.coloring_logging
2344+ try:
2345+ if __debug__ and options.logging == 'INFO':
2346+ options.logging = 'DEBUG'
2347+ if options.logging.isdigit():
2348+ level = int(options.logging)
2349+ else:
2350+ level = eval('logging.' + options.logging)
2351+ print os.path.join(root_path, 'internal', 'me5_logging.conf')
2352+ logging.config.fileConfig(os.path.join(root_path, 'internal', 'me5_logging.conf'))
2353+ logging.root.setLevel(level)
2354+ logging.getLogger('madgraph').setLevel(level)
2355+ except:
2356+ raise
2357+ pass
2358+
2359+ # Call the cmd interface main loop
2360+ try:
2361+ if args:
2362+ # a single command is provided
2363+ if '--web' in args:
2364+ i = args.index('--web')
2365+ args.pop(i)
2366+ cmd_line = aMCatNLOCmd(force_run=True)
2367+ else:
2368+ cmd_line = aMCatNLOCmdShell(force_run=True)
2369+
2370+ if not hasattr(cmd_line, 'do_%s' % args[0]):
2371+ if parser_error:
2372+ print parser_error
2373+ print 'and %s can not be interpreted as a valid command.' % args[0]
2374+ else:
2375+ print 'ERROR: %s not a valid command. Please retry' % args[0]
2376+ else:
2377+ cmd_line.use_rawinput = False
2378+ cmd_line.run_cmd(' '.join(args))
2379+ cmd_line.run_cmd('quit')
2380+
2381+ except KeyboardInterrupt:
2382+ print 'quit on KeyboardInterrupt'
2383+ pass
2384
2385
2386=== modified file 'madgraph/interface/coloring_logging.py'
2387--- madgraph/interface/coloring_logging.py 2015-10-01 16:00:08 +0000
2388+++ madgraph/interface/coloring_logging.py 2016-03-16 17:59:03 +0000
2389@@ -1,4 +1,7 @@
2390 import logging
2391+# method to add color to a logging.info add a second argument:
2392+# '$MG:color:BLACK'
2393+
2394
2395 BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE = range(8)
2396
2397
2398=== modified file 'madgraph/interface/common_run_interface.py'
2399--- madgraph/interface/common_run_interface.py 2016-02-21 00:08:42 +0000
2400+++ madgraph/interface/common_run_interface.py 2016-03-16 17:59:03 +0000
2401@@ -65,6 +65,8 @@
2402 import internal.cluster as cluster
2403 import internal.check_param_card as check_param_card
2404 import internal.files as files
2405+ import internal.save_load_object as save_load_object
2406+ import internal.gen_crossxhtml as gen_crossxhtml
2407 from internal import InvalidCmd, MadGraph5Error
2408 MADEVENT=True
2409 else:
2410@@ -75,7 +77,10 @@
2411 import madgraph.various.misc as misc
2412 import madgraph.iolibs.files as files
2413 import madgraph.various.cluster as cluster
2414+ import madgraph.iolibs.save_load_object as save_load_object
2415+ import madgraph.madevent.gen_crossxhtml as gen_crossxhtml
2416 import models.check_param_card as check_param_card
2417+
2418 from madgraph import InvalidCmd, MadGraph5Error, MG5DIR
2419 MADEVENT=False
2420
2421@@ -391,7 +396,7 @@
2422
2423 def check_decay_events(self,args):
2424 """Check the argument for decay_events command
2425- syntax: decay_events [NAME]
2426+ syntax is "decay_events [NAME]"
2427 Note that other option are already remove at this point
2428 """
2429
2430@@ -418,7 +423,7 @@
2431
2432 def check_check_events(self,args):
2433 """Check the argument for decay_events command
2434- syntax: decay_events [NAME]
2435+ syntax is "decay_events [NAME]"
2436 Note that other option are already remove at this point
2437 """
2438
2439@@ -441,9 +446,7 @@
2440
2441
2442 def get_events_path(self, run_name):
2443- """Check the argument for decay_events command
2444- syntax: decay_events [NAME]
2445- Note that other option are already remove at this point
2446+ """return the path to the output events
2447 """
2448
2449
2450@@ -523,6 +526,11 @@
2451 def __init__(self, me_dir, options, *args, **opts):
2452 """common"""
2453
2454+ self.force_run = False # this flag force the run even if RunWeb is present
2455+ if 'force_run' in opts and opts['force_run']:
2456+ self.force_run = True
2457+ del opts['force_run']
2458+
2459 cmd.Cmd.__init__(self, *args, **opts)
2460 # Define current MadEvent directory
2461 if me_dir is None and MADEVENT:
2462@@ -538,21 +546,22 @@
2463 self.error = pjoin(self.me_dir, 'error')
2464 self.dirbin = pjoin(self.me_dir, 'bin', 'internal')
2465
2466- # Check that the directory is not currently running
2467- if os.path.exists(pjoin(me_dir,'RunWeb')):
2468- message = '''Another instance of the program is currently running.
2469- (for this exact same directory) Please wait that this is instance is
2470- closed. If no instance is running, you can delete the file
2471- %s and try again.''' % pjoin(me_dir,'RunWeb')
2472- raise AlreadyRunning, message
2473- else:
2474- pid = os.getpid()
2475- fsock = open(pjoin(me_dir,'RunWeb'),'w')
2476- fsock.write(`pid`)
2477- fsock.close()
2478-
2479- misc.Popen([os.path.relpath(pjoin(self.dirbin, 'gen_cardhtml-pl'), me_dir)],
2480- cwd=me_dir)
2481+ # Check that the directory is not currently running_in_idle
2482+ if not self.force_run:
2483+ if os.path.exists(pjoin(me_dir,'RunWeb')):
2484+ message = '''Another instance of the program is currently running.
2485+ (for this exact same directory) Please wait that this is instance is
2486+ closed. If no instance is running, you can delete the file
2487+ %s and try again.''' % pjoin(me_dir,'RunWeb')
2488+ raise AlreadyRunning, message
2489+ else:
2490+ pid = os.getpid()
2491+ fsock = open(pjoin(me_dir,'RunWeb'),'w')
2492+ fsock.write(`pid`)
2493+ fsock.close()
2494+
2495+ misc.Popen([os.path.relpath(pjoin(self.dirbin, 'gen_cardhtml-pl'), me_dir)],
2496+ cwd=me_dir)
2497
2498 self.to_store = []
2499 self.run_name = None
2500@@ -609,6 +618,35 @@
2501
2502 return args
2503
2504+ @misc.multiple_try(nb_try=5, sleep=2)
2505+ def load_results_db(self):
2506+ """load the current results status"""
2507+
2508+ # load the current status of the directory
2509+ if os.path.exists(pjoin(self.me_dir,'HTML','results.pkl')):
2510+ try:
2511+ self.results = save_load_object.load_from_file(pjoin(self.me_dir,'HTML','results.pkl'))
2512+ except Exception:
2513+ #the pickle fail -> need to recreate the library
2514+ model = self.find_model_name()
2515+ process = self.process # define in find_model_name
2516+ self.results = gen_crossxhtml.AllResults(model, process, self.me_dir)
2517+ self.results.resetall(self.me_dir)
2518+ else:
2519+ self.results.resetall(self.me_dir)
2520+ try:
2521+ self.last_mode = self.results[self.results.lastrun][-1]['run_mode']
2522+ except:
2523+ self.results.resetall(self.me_dir)
2524+ self.last_mode = ''
2525+ else:
2526+ model = self.find_model_name()
2527+ process = self.process # define in find_model_name
2528+ self.results = gen_crossxhtml.AllResults(model, process, self.me_dir)
2529+ self.results.resetall(self.me_dir)
2530+ self.last_mode=''
2531+ return self.results
2532+
2533 ############################################################################
2534 def do_treatcards(self, line, amcatnlo=False):
2535 """Advanced commands: create .inc files from param_card.dat/run_card.dat"""
2536@@ -696,13 +734,13 @@
2537 param_card.write_inc_file(outfile, ident_card, default)
2538
2539
2540- def ask_edit_cards(self, cards, mode='fixed', plot=True):
2541+ def ask_edit_cards(self, cards, mode='fixed', plot=True, first_cmd=None):
2542 """ """
2543 if not self.options['madanalysis_path']:
2544 plot = False
2545
2546 self.ask_edit_card_static(cards, mode, plot, self.options['timeout'],
2547- self.ask)
2548+ self.ask, first_cmd=first_cmd)
2549
2550 @staticmethod
2551 def ask_edit_card_static(cards, mode='fixed', plot=True,
2552@@ -1024,10 +1062,13 @@
2553 """Dummy routine, to be overwritten by daughter classes"""
2554
2555 pass
2556+
2557 ############################################################################
2558 def do_reweight(self, line):
2559- """ Allow to reweight the events generated with a new choices of model
2560- parameter.
2561+ """ syntax is "reweight RUN_NAME"
2562+ Allow to reweight the events generated with a new choices of model
2563+ parameter. Description of the methods are available here
2564+ cp3.irmp.ucl.ac.be/projects/madgraph/wiki/Reweight
2565 """
2566
2567 if '-from_cards' in line and not os.path.exists(pjoin(self.me_dir, 'Cards', 'reweight_card.dat')):
2568@@ -1045,28 +1086,91 @@
2569 raise self.ConfigurationError, '''Can\'t load Reweight module.
2570 The variable mg5_path might not be correctly configured.'''
2571
2572- self.to_store.append('event')
2573+
2574+
2575 if not '-from_cards' in line:
2576 self.keep_cards(['reweight_card.dat'])
2577 self.ask_edit_cards(['reweight_card.dat'], 'fixed', plot=False)
2578
2579+ # load the name of the event file
2580+ args = self.split_arg(line)
2581+
2582+ if not self.force_run:
2583+ # forbid this function to create an empty item in results.
2584+ if self.run_name and self.results.current and self.results.current['cross'] == 0:
2585+ self.results.delete_run(self.run_name, self.run_tag)
2586+ self.results.save()
2587+ # we want to run this in a separate shell to avoid hard f2py crash
2588+ command = [sys.executable]
2589+ if os.path.exists(pjoin(self.me_dir, 'bin', 'madevent')):
2590+ command.append(pjoin(self.me_dir, 'bin', 'internal','madevent_interface.py'))
2591+ else:
2592+ command.append(pjoin(self.me_dir, 'bin', 'internal', 'amcatnlo_run_interface.py'))
2593+ if not isinstance(self, cmd.CmdShell):
2594+ command.append('--web')
2595+ command.append('reweight')
2596+ if self.run_name:
2597+ command.append(self.run_name)
2598+ else:
2599+ command += args
2600+ if '-from_cards' not in command:
2601+ command.append('-from_cards')
2602+ p = misc.Popen(command, stdout = subprocess.PIPE, stderr = subprocess.STDOUT, cwd=self.me_dir)
2603+ while p.poll() is None:
2604+ line = p.stdout.readline()
2605+ if any(t in line for t in ['INFO:', 'WARNING:', 'CRITICAL:', 'ERROR:', 'root:','KEEP:']) and \
2606+ not '***********' in line:
2607+ print line[:-1].replace('INFO', 'REWEIGHT').replace('KEEP:','')
2608+ elif __debug__ and line:
2609+ logger.debug(line[:-1])
2610+ if p.returncode !=0:
2611+ logger.error("Reweighting failed")
2612+ return
2613+ self.results = self.load_results_db()
2614+ # forbid this function to create an empty item in results.
2615+ try:
2616+ if self.results[self.run_name][-2]['cross']==0:
2617+ self.results.delete_run(self.run_name,self.results[self.run_name][-2]['tag'])
2618+ except:
2619+ pass
2620+ try:
2621+ if self.results.current['cross'] == 0 and self.run_name:
2622+ self.results.delete_run(self.run_name, self.run_tag)
2623+ except:
2624+ pass
2625+ # re-define current run
2626+ try:
2627+ self.results.def_current(self.run_name, self.run_tag)
2628+ except Exception:
2629+ pass
2630+ return
2631+
2632+ self.to_store.append('event')
2633 # forbid this function to create an empty item in results.
2634 if self.results.current['cross'] == 0 and self.run_name:
2635 self.results.delete_run(self.run_name, self.run_tag)
2636
2637- # load the name of the event file
2638- args = self.split_arg(line)
2639 self.check_decay_events(args)
2640 # args now alway content the path to the valid files
2641- reweight_cmd = reweight_interface.ReweightInterface(args[0])
2642- reweight_cmd.mother = self
2643- self.update_status('Running Reweight', level='madspin')
2644-
2645+ reweight_cmd = reweight_interface.ReweightInterface(args[0], mother=self)
2646+ #reweight_cmd.use_rawinput = False
2647+ #reweight_cmd.mother = self
2648+ wgt_names = reweight_cmd.get_weight_names()
2649+ if wgt_names == [''] and reweight_cmd.has_nlo:
2650+ self.update_status('Running Reweighting (LO approximate)', level='madspin')
2651+ else:
2652+ self.update_status('Running Reweighting', level='madspin')
2653
2654 path = pjoin(self.me_dir, 'Cards', 'reweight_card.dat')
2655+ reweight_cmd.raw_input=False
2656 reweight_cmd.me_dir = self.me_dir
2657 reweight_cmd.import_command_file(path)
2658 reweight_cmd.do_quit('')
2659+
2660+ logger.info("quit rwgt")
2661+
2662+
2663+
2664 # re-define current run
2665 try:
2666 self.results.def_current(self.run_name, self.run_tag)
2667@@ -1422,44 +1526,7 @@
2668 else:
2669 self.pdffile = " "
2670 return self.pdffile
2671-
2672- def do_quit(self, line):
2673- """Not in help: exit """
2674-
2675-
2676- try:
2677- os.remove(pjoin(self.me_dir,'RunWeb'))
2678- except Exception, error:
2679- pass
2680-
2681- try:
2682- self.store_result()
2683- except Exception:
2684- # If nothing runs they they are no result to update
2685- pass
2686-
2687- try:
2688- self.update_status('', level=None)
2689- except Exception, error:
2690- pass
2691- try:
2692- devnull = open(os.devnull, 'w')
2693- misc.call(['./bin/internal/gen_cardhtml-pl'], cwd=self.me_dir,
2694- stdout=devnull, stderr=devnull)
2695- except Exception:
2696- pass
2697- try:
2698- devnull.close()
2699- except Exception:
2700- pass
2701-
2702- return super(CommonRunCmd, self).do_quit(line)
2703-
2704-
2705- # Aliases
2706- do_EOF = do_quit
2707- do_exit = do_quit
2708-
2709+
2710 ############################################################################
2711 def do_open(self, line):
2712 """Open a text file/ eps file / html file"""
2713@@ -1677,10 +1744,11 @@
2714 def do_quit(self, line):
2715 """Not in help: exit """
2716
2717- try:
2718- os.remove(pjoin(self.me_dir,'RunWeb'))
2719- except Exception:
2720- pass
2721+ if not self.force_run:
2722+ try:
2723+ os.remove(pjoin(self.me_dir,'RunWeb'))
2724+ except Exception:
2725+ pass
2726 try:
2727 self.store_result()
2728 except Exception:
2729@@ -2039,6 +2107,20 @@
2730 os.path.join('.',*[a for a in args \
2731 if a.endswith(os.path.sep)]))
2732
2733+ def complete_reweight(self,text, line, begidx, endidx):
2734+ "Complete the pythia command"
2735+ args = self.split_arg(line[0:begidx], error=False)
2736+
2737+ #return valid run_name
2738+ data = glob.glob(pjoin(self.me_dir, 'Events', '*','*events.lhe*'))
2739+ data = [n.rsplit('/',2)[1] for n in data]
2740+ if not '-f' in args:
2741+ data.append('-f')
2742+ tmp1 = self.list_completion(text, data)
2743+ return tmp1
2744+
2745+
2746+
2747 def complete_compute_widths(self, text, line, begidx, endidx):
2748 "Complete the compute_widths command"
2749
2750@@ -2066,20 +2148,57 @@
2751 """update the make_opts file writing the environmental variables
2752 stored in make_opts_var"""
2753 make_opts = os.path.join(self.me_dir, 'Source', 'make_opts')
2754+
2755+ return self.update_make_opts_full(make_opts, self.make_opts_var)
2756+
2757+
2758+ @staticmethod
2759+ def update_make_opts_full(path, def_variables, keep_old=True):
2760+ """update the make_opts file writing the environmental variables
2761+ of def_variables.
2762+ if a value of the dictionary is None then it is not written.
2763+ """
2764+ make_opts = path
2765+ pattern = re.compile(r'^(\w+)\s*=\s*(.*)$',re.DOTALL)
2766+ diff = False # set to True if one varible need to be updated
2767+ #if on False the file is not modify
2768+
2769 tag = '#end_of_make_opts_variables\n'
2770- content = open(make_opts).read()
2771-
2772- # if this is not the first time that the file is updated, there
2773- # should be a line #end_of_make_opts_variables
2774- if tag in content:
2775- content = content.split(tag)[1]
2776-
2777- variables = '\n'.join('%s=%s' % (k,v) for k, v in self.make_opts_var.items())
2778- variables += '\n%s' % tag
2779-
2780- open(make_opts, 'w').write(variables + content)
2781- return
2782-
2783+ make_opts_variable = True # flag to say if we are in edition area or not
2784+ content = []
2785+ variables = dict(def_variables)
2786+ need_keys = variables.keys()
2787+ for line in open(make_opts):
2788+ line = line.strip()
2789+ if make_opts_variable:
2790+ if line.startswith('#') or not line:
2791+ if line.startswith('#end_of_make_opts_variables'):
2792+ make_opts_variable = False
2793+ continue
2794+ elif pattern.search(line):
2795+ key, value = pattern.search(line).groups()
2796+ if key not in variables:
2797+ variables[key] = value
2798+ elif value != variables[key]:
2799+ diff=True
2800+ else:
2801+ need_keys.remove(key)
2802+ else:
2803+ misc.sprint("end on line", line)
2804+ make_opts_variable = False
2805+ content.append(line)
2806+ else:
2807+ content.append(line)
2808+
2809+ if need_keys:
2810+ diff=True #This means that new definition are added to the file.
2811+
2812+ content_variables = '\n'.join('%s=%s' % (k,v) for k, v in variables.items() if v is not None)
2813+ content_variables += '\n%s' % tag
2814+
2815+ if diff:
2816+ open(make_opts, 'w').write(content_variables + '\n'.join(content))
2817+ return
2818
2819
2820 # lhapdf-related functions
2821@@ -2128,12 +2247,18 @@
2822 """copy (if needed) the lhapdf set corresponding to the lhaid in lhaid_list
2823 into lib/PDFsets"""
2824
2825+ if not hasattr(self, 'lhapdf_pdfsets'):
2826+ self.lhapdf_pdfsets = self.get_lhapdf_pdfsets_list(pdfsets_dir)
2827+
2828+
2829 pdfsetname = ''
2830 for lhaid in lhaid_list:
2831 try:
2832 if not pdfsetname:
2833 if lhaid in self.lhapdf_pdfsets:
2834 pdfsetname = self.lhapdf_pdfsets[lhaid]['filename']
2835+ elif isinstance(lhaid, str):
2836+ pdfsetname = lhaid
2837 else:
2838 raise MadGraph5Error('lhaid %s not valid input number for the current lhapdf' % lhaid )
2839 # just check the other ids refer to the same pdfsetname
2840@@ -2159,7 +2284,7 @@
2841 os.mkdir(pdfsets_dir)
2842 except OSError:
2843 pdfsets_dir = pjoin(self.me_dir, 'lib', 'PDFsets')
2844- else:
2845+ elif os.path.exists(pjoin(self.me_dir, 'lib', 'PDFsets')):
2846 #clean previous set of pdf used
2847 for name in os.listdir(pjoin(self.me_dir, 'lib', 'PDFsets')):
2848 if name != pdfsetname:
2849@@ -2213,18 +2338,49 @@
2850 def install_lhapdf_pdfset(self, pdfsets_dir, filename):
2851 """idownloads and install the pdfset filename in the pdfsets_dir"""
2852 lhapdf_version = self.get_lhapdf_version()
2853+ local_path = pjoin(self.me_dir, 'lib', 'PDFsets')
2854+ return self.install_lhapdf_pdfset_static(self.options['lhapdf'],
2855+ pdfsets_dir, filename,
2856+ lhapdf_version=lhapdf_version,
2857+ alternate_path=local_path)
2858+
2859+
2860+ @staticmethod
2861+ def install_lhapdf_pdfset_static(lhapdf_config, pdfsets_dir, filename,
2862+ lhapdf_version=None, alternate_path=None):
2863+ """idownloads and install the pdfset filename in the pdfsets_dir.
2864+ Version which can be used independently of the class.
2865+ local path is used if the global installation fails.
2866+ """
2867+
2868+ if not lhapdf_version:
2869+ lhapdf_version = subprocess.Popen([lhapdf_config, '--version'],
2870+ stdout = subprocess.PIPE).stdout.read().strip()
2871+ if not pdfsets_dir:
2872+ pdfsets_dir = subprocess.Popen([lhapdf_config, '--datadir'],
2873+ stdout = subprocess.PIPE).stdout.read().strip()
2874+
2875+ if isinstance(filename, int):
2876+ pdf_info = CommonRunCmd.get_lhapdf_pdfsets_list_static(pdfsets_dir, lhapdf_version)
2877+ filename = pdf_info[filename]['filename']
2878+
2879+ if os.path.exists(pjoin(pdfsets_dir, filename)):
2880+ logger.debug('%s is already present in %s', (filename, pdfsets_dir))
2881+ return
2882+
2883 logger.info('Trying to download %s' % filename)
2884
2885 if lhapdf_version.startswith('5.'):
2886+
2887 # use the lhapdf-getdata command, which is in the same path as
2888 # lhapdf-config
2889- getdata = self.options['lhapdf'].replace('lhapdf-config', ('lhapdf-getdata'))
2890+ getdata = lhapdf_config.replace('lhapdf-config', ('lhapdf-getdata'))
2891 misc.call([getdata, filename], cwd = pdfsets_dir)
2892
2893 elif lhapdf_version.startswith('6.'):
2894 # use the "lhapdf install xxx" command, which is in the same path as
2895 # lhapdf-config
2896- getdata = self.options['lhapdf'].replace('lhapdf-config', ('lhapdf'))
2897+ getdata = lhapdf_config.replace('lhapdf-config', ('lhapdf'))
2898
2899 misc.call([getdata, 'install', filename], cwd = pdfsets_dir)
2900
2901@@ -2240,18 +2396,24 @@
2902 elif lhapdf_version.startswith('5.'):
2903 logger.warning('Could not download %s into %s. Trying to save it locally' \
2904 % (filename, pdfsets_dir))
2905- self.install_lhapdf_pdfset(pjoin(self.me_dir, 'lib', 'PDFsets'), filename)
2906+ CommonRunCmd.install_lhapdf_pdfset_static(lhapdf_config, alternate_path, filename,
2907+ lhapdf_version=lhapdf_version)
2908 else:
2909 raise MadGraph5Error, \
2910 'Could not download %s into %s. Please try to install it manually.' \
2911 % (filename, pdfsets_dir)
2912
2913
2914+
2915 def get_lhapdf_pdfsets_list(self, pdfsets_dir):
2916 """read the PDFsets.index file, which should be located in the same
2917 place as pdfsets_dir, and return a list of dictionaries with the information
2918 about each pdf set"""
2919 lhapdf_version = self.get_lhapdf_version()
2920+ return self.get_lhapdf_pdfsets_list_static(pdfsets_dir, lhapdf_version)
2921+
2922+ @staticmethod
2923+ def get_lhapdf_pdfsets_list_static(pdfsets_dir, lhapdf_version):
2924
2925 if lhapdf_version.startswith('5.'):
2926 if os.path.exists('%s.index' % pdfsets_dir):
2927@@ -2319,6 +2481,19 @@
2928
2929 return datadir
2930
2931+ def get_lhapdf_libdir(self):
2932+ lhapdf_version = self.get_lhapdf_version()
2933+
2934+ if lhapdf_version.startswith('5.'):
2935+ libdir = subprocess.Popen([self.options['lhapdf-config'], '--libdir'],
2936+ stdout = subprocess.PIPE).stdout.read().strip()
2937+
2938+ elif lhapdf_version.startswith('6.'):
2939+ libdir = subprocess.Popen([self.options['lhapdf'], '--libs'],
2940+ stdout = subprocess.PIPE).stdout.read().strip()
2941+
2942+ return libdir
2943+
2944 class AskforEditCard(cmd.OneLinePathCompletion):
2945 """A class for asking a question where in addition you can have the
2946 set command define and modifying the param_card/run_card correctly"""
2947@@ -3082,12 +3257,39 @@
2948 (block, lhaid, value), '$MG:color:BLACK')
2949 self.param_card[block].param_dict[lhaid].value = value
2950
2951+ def check_card_consistency(self):
2952+ """This is run on quitting the class. Apply here all the self-consistency
2953+ rule that you want. Do the modification via the set command."""
2954+
2955+ # if NLO reweighting is ON: ensure that we keep the rwgt information
2956+ if 'reweight' in self.allow_arg and 'run' in self.allow_arg and \
2957+ isinstance(self.run_card,banner_mod.RunCardNLO) and \
2958+ not self.run_card['keep_rwgt_info']:
2959+ #check if a NLO reweighting is required
2960+ re_pattern = re.compile(r'''^\s*change\s*mode\s* (LO\+NLO|LO|NLO)\s*(?:#|$)''', re.M+re.I)
2961+ text = open(pjoin(self.me_dir,'Cards','reweight_card.dat')).read()
2962+ options = re_pattern.findall(text)
2963+ if any(o in ['NLO', 'LO+NLO'] for o in options):
2964+ logger.info('NLO reweighting is on ON. Automatically set keep_rwgt_info to True', '$MG:color:BLACK' )
2965+ self.do_set('run_card keep_rwgt_info True')
2966+
2967+
2968 def reask(self, *args, **opt):
2969
2970 cmd.OneLinePathCompletion.reask(self,*args, **opt)
2971 if self.has_mw and not os.path.exists(pjoin(self.me_dir,'Cards','transfer_card.dat')):
2972 logger.warning('No transfer function currently define. Please use the change_tf command to define one.')
2973-
2974+
2975+ def postcmd(self, stop, line):
2976+
2977+ ending_question = cmd.OneLinePathCompletion.postcmd(self,stop,line)
2978+ if ending_question:
2979+ self.check_card_consistency()
2980+ return ending_question
2981+
2982+ def check_answer_consistency(self):
2983+ """function called if the code reads a file"""
2984+ self.check_card_consistency()
2985
2986 def help_set(self):
2987 '''help message for set'''
2988
2989=== modified file 'madgraph/interface/extended_cmd.py'
2990--- madgraph/interface/extended_cmd.py 2016-03-02 12:15:58 +0000
2991+++ madgraph/interface/extended_cmd.py 2016-03-16 17:59:03 +0000
2992@@ -692,8 +692,11 @@
2993 mother_interface=self, **opt)
2994
2995 if first_cmd:
2996- question_instance.onecmd(first_cmd)
2997-
2998+ if isinstance(first_cmd, str):
2999+ question_instance.onecmd(first_cmd)
3000+ else:
3001+ for line in first_cmd:
3002+ question_instance.onecmd(line)
3003 if not self.haspiping:
3004 if hasattr(obj, "haspiping"):
3005 obj.haspiping = self.haspiping
3006@@ -707,13 +710,13 @@
3007 answer = alias[answer]
3008 if ask_class:
3009 answer = question_instance.default(answer)
3010+ if hasattr(question_instance, 'check_answer_consistency'):
3011+ question_instance.check_answer_consistency()
3012 return answer
3013
3014 question = question_instance.question
3015 value = Cmd.timed_input(question, default, timeout=timeout,
3016 fct=question_instance, fct_timeout=fct_timeout)
3017-
3018-
3019
3020 try:
3021 if value in alias:
3022@@ -765,8 +768,8 @@
3023 self.store_line(line)
3024 return None # print the question and use the pipe
3025 logger.info(question_instance.question)
3026- logger.warning('The answer to the previous question is not set in your input file')
3027- logger.warning('Use %s value' % default)
3028+ logger.info('The answer to the previous question is not set in your input file', '$MG:color:BLACK')
3029+ logger.info('Use %s value' % default, '$MG:color:BLACK')
3030 return str(default)
3031
3032 line = line.replace('\n','').strip()
3033
3034=== modified file 'madgraph/interface/loop_interface.py'
3035--- madgraph/interface/loop_interface.py 2016-03-04 16:16:23 +0000
3036+++ madgraph/interface/loop_interface.py 2016-03-16 17:59:03 +0000
3037@@ -539,24 +539,16 @@
3038 me, self._curr_fortran_model)
3039 # If all ME's do not share the same maximum loop vertex rank and the
3040 # same loop maximum wavefunction size, we need to set the maximum
3041- # in coef_specs.inc of the HELAS Source and warn the user that this
3042- # might be a problem
3043+ # in coef_specs.inc of the HELAS Source. The SubProcesses/P* directory
3044+ # all link this file, so it should be properly propagated
3045 if self.options['loop_optimized_output'] and len(matrix_elements)>1:
3046 max_lwfspins = [m.get_max_loop_particle_spin() for m in \
3047 matrix_elements]
3048- try:
3049- max_loop_vert_ranks = [me.get_max_loop_vertex_rank() for me in \
3050+ max_loop_vert_ranks = [me.get_max_loop_vertex_rank() for me in \
3051 matrix_elements]
3052- except MadGraph5Error:
3053- pass
3054- else:
3055- if len(set(max_lwfspins))>1 or len(set(max_loop_vert_ranks))>1:
3056- self._curr_exporter.fix_coef_specs(max(max_lwfspins),\
3057+ if len(set(max_lwfspins))>1 or len(set(max_loop_vert_ranks))>1:
3058+ self._curr_exporter.fix_coef_specs(max(max_lwfspins),\
3059 max(max_loop_vert_ranks))
3060- logger.warning('ML5 has just output processes which do not'+\
3061- ' share the same maximum loop wavefunction size or the '+\
3062- ' same maximum loop vertex rank. This is potentially '+\
3063- ' dangerous. Please prefer to output them separately.')
3064
3065 # Just the matrix.f files
3066 if self._export_format == 'matrix':
3067@@ -719,6 +711,7 @@
3068 if not isinstance(self, extended_cmd.CmdShell):
3069 raise InvalidCmd, "loop_filter is not allowed in web mode"
3070 args = [a for a in args if not a.startswith('--loop_filter=')]
3071+
3072 # Rejoin line
3073 line = ' '.join(args[1:])
3074
3075@@ -731,6 +724,22 @@
3076
3077 # Extract process from process definition
3078 myprocdef = self.extract_process(line)
3079+ # hack for multiprocess:
3080+ if myprocdef.has_multiparticle_label():
3081+ # split it in a loop
3082+ succes, failed = 0, 0
3083+ for base_proc in myprocdef:
3084+ try:
3085+ self.exec_cmd("add process %s" % base_proc.nice_string(prefix=False, print_weighted=True))
3086+ succes += 1
3087+ except Exception:
3088+ failed +=1
3089+ logger.info("%s/%s processes succeeded" % (succes, failed+succes))
3090+ if succes == 0:
3091+ raise
3092+ else:
3093+ return
3094+
3095
3096 # If it is a process for MadLoop standalone, make sure it has a
3097 # unique ID. It is important for building a BLHA library which
3098
3099=== modified file 'madgraph/interface/madevent_interface.py'
3100--- madgraph/interface/madevent_interface.py 2016-03-02 17:48:27 +0000
3101+++ madgraph/interface/madevent_interface.py 2016-03-16 17:59:03 +0000
3102@@ -938,7 +938,7 @@
3103
3104 def check_pythia(self, args):
3105 """Check the argument for pythia command
3106- syntax: pythia [NAME]
3107+ syntax is "pythia [NAME]"
3108 Note that other option are already remove at this point
3109 """
3110
3111@@ -1124,7 +1124,7 @@
3112
3113 def check_pgs(self, arg, no_default=False):
3114 """Check the argument for pythia command
3115- syntax: pgs [NAME]
3116+ syntax is "pgs [NAME]"
3117 Note that other option are already remove at this point
3118 """
3119
3120@@ -1182,7 +1182,7 @@
3121
3122 def check_delphes(self, arg):
3123 """Check the argument for pythia command
3124- syntax: delphes [NAME]
3125+ syntax is "delphes [NAME]"
3126 Note that other option are already remove at this point
3127 """
3128
3129@@ -1239,7 +1239,7 @@
3130
3131 def check_display(self, args):
3132 """check the validity of line
3133- syntax: display XXXXX
3134+ syntax is "display XXXXX"
3135 """
3136
3137 if len(args) < 1 or args[0] not in self._display_opts:
3138@@ -1656,24 +1656,7 @@
3139 if self.web:
3140 os.system('touch %s' % pjoin(self.me_dir,'Online'))
3141
3142-
3143- # load the current status of the directory
3144- if os.path.exists(pjoin(self.me_dir,'HTML','results.pkl')):
3145- try:
3146- self.results = save_load_object.load_from_file(pjoin(self.me_dir,'HTML','results.pkl'))
3147- except Exception:
3148- #the pickle fail -> need to recreate the library
3149- model = self.find_model_name()
3150- process = self.process # define in find_model_name
3151- self.results = gen_crossxhtml.AllResults(model, process, self.me_dir)
3152- self.results.resetall(self.me_dir)
3153- else:
3154- self.results.resetall(self.me_dir)
3155- else:
3156- model = self.find_model_name()
3157- process = self.process # define in find_model_name
3158- self.results = gen_crossxhtml.AllResults(model, process, self.me_dir)
3159- self.results.resetall(self.me_dir)
3160+ self.load_results_db()
3161 self.results.def_web_mode(self.web)
3162
3163 self.prompt = "%s>"%os.path.basename(pjoin(self.me_dir))
3164@@ -3540,7 +3523,17 @@
3165
3166 self.ask_edit_cards(['run_card'], args)
3167 self.run_card = banner_mod.RunCard(pjoin(self.me_dir, 'Cards', 'run_card.dat'))
3168-
3169+
3170+ # Check that all pdfset are correctly installed
3171+ lhaid = [self.run_card.get_lhapdf_id()]
3172+ sys_pdf = self.run_card['sys_pdf'].split('&&')
3173+ lhaid += [l.split()[0] for l in sys_pdf]
3174+ pdfsets_dir = self.get_lhapdf_pdfsetsdir()
3175+ # Copy all the relevant PDF sets
3176+ [self.copy_lhapdf_set([onelha], pdfsets_dir) for onelha in lhaid]
3177+
3178+
3179+
3180 if any([arg in ['all','parton'] for arg in args]):
3181 filename = pjoin(self.me_dir, 'Events', self.run_name, 'unweighted_events.lhe')
3182 if os.path.exists(filename+'.gz'):
3183@@ -3593,7 +3586,10 @@
3184 if 'event' in self.to_store:
3185 if not os.path.exists(pjoin(self.me_dir, 'Events',self.run_name, 'unweighted_events.lhe.gz')) and\
3186 os.path.exists(pjoin(self.me_dir, 'Events',self.run_name, 'unweighted_events.lhe')):
3187+ logger.info("gzipping output file: unweighted_events.lhe")
3188 misc.gzip(pjoin(self.me_dir,'Events',self.run_name,"unweighted_events.lhe"))
3189+ if os.path.exists(pjoin(self.me_dir,'Events','reweight.lhe')):
3190+ os.remove(pjoin(self.me_dir,'Events', 'reweight.lhe'))
3191
3192 if 'pythia' in self.to_store:
3193 self.update_status('Storing Pythia files of previous run', level='pythia', error=True)
3194@@ -5098,3 +5094,111 @@
3195
3196 AskforEditCard = common_run.AskforEditCard
3197
3198+
3199+if '__main__' == __name__:
3200+ # Launch the interface without any check if one code is already running.
3201+ # This can ONLY run a single command !!
3202+ import sys
3203+ if not sys.version_info[0] == 2 or sys.version_info[1] < 6:
3204+ sys.exit('MadGraph/MadEvent 5 works only with python 2.6 or later (but not python 3.X).\n'+\
3205+ 'Please upgrate your version of python.')
3206+
3207+ import os
3208+ import optparse
3209+ # Get the directory of the script real path (bin)
3210+ # and add it to the current PYTHONPATH
3211+ root_path = os.path.dirname(os.path.dirname(os.path.realpath( __file__ )))
3212+ sys.path.insert(0, root_path)
3213+
3214+ class MyOptParser(optparse.OptionParser):
3215+ class InvalidOption(Exception): pass
3216+ def error(self, msg=''):
3217+ raise MyOptParser.InvalidOption(msg)
3218+ # Write out nice usage message if called with -h or --help
3219+ usage = "usage: %prog [options] [FILE] "
3220+ parser = MyOptParser(usage=usage)
3221+ parser.add_option("-l", "--logging", default='INFO',
3222+ help="logging level (DEBUG|INFO|WARNING|ERROR|CRITICAL) [%default]")
3223+ parser.add_option("","--web", action="store_true", default=False, dest='web', \
3224+ help='force toce to be in secure mode')
3225+ parser.add_option("","--debug", action="store_true", default=False, dest='debug', \
3226+ help='force to launch debug mode')
3227+ parser_error = ''
3228+ done = False
3229+
3230+ for i in range(len(sys.argv)-1):
3231+ try:
3232+ (options, args) = parser.parse_args(sys.argv[1:len(sys.argv)-i])
3233+ done = True
3234+ except MyOptParser.InvalidOption, error:
3235+ pass
3236+ else:
3237+ args += sys.argv[len(sys.argv)-i:]
3238+ if not done:
3239+ # raise correct error:
3240+ try:
3241+ (options, args) = parser.parse_args()
3242+ except MyOptParser.InvalidOption, error:
3243+ print error
3244+ sys.exit(2)
3245+
3246+ if len(args) == 0:
3247+ args = ''
3248+
3249+ import subprocess
3250+ import logging
3251+ import logging.config
3252+ # Set logging level according to the logging level given by options
3253+ #logging.basicConfig(level=vars(logging)[options.logging])
3254+ import internal.coloring_logging
3255+ try:
3256+ if __debug__ and options.logging == 'INFO':
3257+ options.logging = 'DEBUG'
3258+ if options.logging.isdigit():
3259+ level = int(options.logging)
3260+ else:
3261+ level = eval('logging.' + options.logging)
3262+ print os.path.join(root_path, 'internal', 'me5_logging.conf')
3263+ logging.config.fileConfig(os.path.join(root_path, 'internal', 'me5_logging.conf'))
3264+ logging.root.setLevel(level)
3265+ logging.getLogger('madgraph').setLevel(level)
3266+ except:
3267+ raise
3268+ pass
3269+
3270+ # Call the cmd interface main loop
3271+ try:
3272+ if args:
3273+ # a single command is provided
3274+ if '--web' in args:
3275+ i = args.index('--web')
3276+ args.pop(i)
3277+ cmd_line = MadEventCmd(force_run=True)
3278+ else:
3279+ cmd_line = MadEventCmdShell(force_run=True)
3280+ if not hasattr(cmd_line, 'do_%s' % args[0]):
3281+ if parser_error:
3282+ print parser_error
3283+ print 'and %s can not be interpreted as a valid command.' % args[0]
3284+ else:
3285+ print 'ERROR: %s not a valid command. Please retry' % args[0]
3286+ else:
3287+ cmd_line.use_rawinput = False
3288+ cmd_line.run_cmd(' '.join(args))
3289+ cmd_line.run_cmd('quit')
3290+
3291+ except KeyboardInterrupt:
3292+ print 'quit on KeyboardInterrupt'
3293+ pass
3294+
3295+
3296+
3297+
3298+
3299+
3300+
3301+
3302+
3303+
3304+
3305+
3306
3307=== modified file 'madgraph/interface/reweight_interface.py'
3308--- madgraph/interface/reweight_interface.py 2016-01-12 14:46:58 +0000
3309+++ madgraph/interface/reweight_interface.py 2016-03-16 17:59:03 +0000
3310@@ -33,6 +33,7 @@
3311 import madgraph.interface.madgraph_interface as mg_interface
3312 import madgraph.interface.master_interface as master_interface
3313 import madgraph.interface.common_run_interface as common_run_interface
3314+import madgraph.interface.madevent_interface as madevent_interface
3315 import madgraph.iolibs.files as files
3316 import MadSpin.interface_madspin as madspin_interface
3317 import madgraph.various.misc as misc
3318@@ -67,7 +68,7 @@
3319 debug_output = 'Reweight_debug'
3320
3321 @misc.mute_logger()
3322- def __init__(self, event_path=None, allow_madspin=False, *completekey, **stdin):
3323+ def __init__(self, event_path=None, allow_madspin=False, mother=None, *completekey, **stdin):
3324 """initialize the interface with potentially an event_path"""
3325
3326 if not event_path:
3327@@ -80,8 +81,11 @@
3328
3329 self.model = None
3330 self.has_standalone_dir = False
3331+ self.mother= mother # calling interface
3332+
3333
3334- self.options = {'curr_dir': os.path.realpath(os.getcwd())}
3335+ self.options = {'curr_dir': os.path.realpath(os.getcwd()),
3336+ 'rwgt_name':None}
3337
3338 self.events_file = None
3339 self.processes = {}
3340@@ -91,8 +95,14 @@
3341 self.seed = None
3342 self.output_type = "default"
3343 self.helicity_reweighting = True
3344+ self.rwgt_mode = None # can be LO or NLO, None is default
3345+ self.has_nlo = False
3346 self.rwgt_dir = None
3347 self.exitted = False # Flag to know if do_quit was already called.
3348+
3349+ if 'lhapdf' in self.mother.options and not mother.options['lhapdf']:
3350+ logger.warning('NLO accurate reweighting requires lhapdf to be installed. Pass in approximate LO mode.')
3351+ self.rwgt_mode = 'LO'
3352 if event_path:
3353 logger.info("Extracting the banner ...")
3354 self.do_import(event_path, allow_madspin=allow_madspin)
3355@@ -155,7 +165,6 @@
3356
3357 # Check the validity of the banner:
3358 if 'slha' not in self.banner:
3359- misc.sprint(self.banner)
3360 self.events_file = None
3361 raise self.InvalidCmd('Event file does not contain model information')
3362 elif 'mg5proccard' not in self.banner:
3363@@ -169,8 +178,16 @@
3364 # load information
3365 process = self.banner.get_detail('proc_card', 'generate')
3366 if '[' in process:
3367- logger.warning("Remember that the reweighting is performed at Leading Order. NLO precision is not guarantee.")
3368-
3369+ if not self.banner.get_detail('run_card', 'keep_rwgt_info'):
3370+ logger.warning("The information to perform a proper NLO reweighting is not present in the event file.")
3371+ logger.warning(" We will perform a LO reweighting instead. This does not guarantee NLO precision.")
3372+ self.rwgt_mode = 'LO'
3373+
3374+ if 'OLP' in self.mother.options:
3375+ if self.mother.options['OLP'].lower() != 'madloop':
3376+ logger.warning("Accurate NLO mode only works for OLP=MadLoop not for OLP=%s. An approximate (LO) reweighting will be performed instead")
3377+ self.rwgt_mode = 'LO'
3378+
3379 if not process:
3380 msg = 'Invalid proc_card information in the file (no generate line):\n %s' % self.banner['mg5proccard']
3381 raise Exception, msg
3382@@ -191,7 +208,7 @@
3383 if not order:
3384 #NO NLO tag => nothing to do actually return input
3385 return proc
3386- elif not order.startswith(('virt=','loonly=','noborn=')):
3387+ elif not order.startswith(('virt','loonly','noborn')):
3388 # OK this a standard NLO process
3389 if '=' in order:
3390 # get the type NLO QCD/QED/...
3391@@ -212,7 +229,7 @@
3392 r='QCD=%i' % (int(ior[1])+1)
3393 process=process+r+' '
3394 #handle special tag $ | / @
3395- result = re.split('([/$@]|\w+=\w+)', process, 1)
3396+ result = re.split('([/$@]|\w+(?:^2)?(?:=|<=|>)?\w+)', process, 1)
3397 if len(result) ==3:
3398 process, split, rest = result
3399 commandline+="add process %s pert_%s %s%s %s --no_warning=duplicate;" % (process, order.replace(' ','') ,split, rest, final)
3400@@ -220,11 +237,11 @@
3401 commandline +='add process %s pert_%s %s --no_warning=duplicate;' % (process,order.replace(' ',''), final)
3402 elif order.startswith(('noborn=')):
3403 # pass in sqrvirt=
3404- return "add process %s " % proc.replace('noborn=', 'sqrvirt=')
3405+ return "add process %s ;" % proc.replace('noborn=', 'sqrvirt=')
3406
3407 else:
3408 #just return the input. since this Madloop.
3409- return "add process %s " % proc
3410+ return "add process %s ;" % proc
3411 return commandline
3412
3413
3414@@ -319,6 +336,21 @@
3415 self.output_type = args[1]
3416 elif args[0] == "helicity":
3417 self.helicity_reweighting = banner.ConfigFile.format_variable(args[1], bool, "helicity")
3418+ elif args[0] == "mode":
3419+ if args[1] != 'LO':
3420+ if 'OLP' in self.mother.options and self.mother.options['OLP'].lower() != 'madloop':
3421+ logger.warning("Only LO reweighting is allowed for OLP!=MadLoop. Keeping the mode to LO.")
3422+ self.rwgt_mode = 'LO'
3423+ elif not self.banner.get_detail('run_card','keep_rwgt_info', default=False):
3424+ logger.warning("Missing information for NLO type of reweighting. Keeping the mode to LO.")
3425+ self.rwgt_mode = 'LO'
3426+ elif 'lhapdf' in self.mother.options and not self.mother.options['lhapdf']:
3427+ logger.warning('NLO accurate reweighting requires lhapdf to be installed. Pass in approximate LO mode.')
3428+ self.rwgt_mode = 'LO'
3429+ else:
3430+ self.rwgt_mode = args[1]
3431+ else:
3432+ self.rwgt_mode = args[1]
3433 elif args[0] == "rwgt_dir":
3434 self.rwgt_dir = args[1]
3435 if not os.path.exists(self.rwgt_dir):
3436@@ -335,6 +367,14 @@
3437 self.lhe_input = lhe_parser.EventFile(self.lhe_input.name)
3438 else:
3439 raise self.InvalidCmd("No events files defined.")
3440+
3441+ opts = {'rwgt_name':None}
3442+ if any(a.startswith('--') for a in args):
3443+ for a in args[:]:
3444+ if a.startswith('--') and '=' in a:
3445+ key,value = a[2:].split('=')
3446+ opts[key] = value .replace("'","") .replace('"','')
3447+ return opts
3448
3449 def help_launch(self):
3450 """help for the launch command"""
3451@@ -345,12 +385,30 @@
3452 All scale are kept fix for this re-weighting.''')
3453
3454
3455- #@misc.mute_logger()
3456+ def get_weight_names(self):
3457+ """ return the various name for the computed weights """
3458+
3459+ if self.rwgt_mode == 'LO':
3460+ return ['']
3461+ elif self.rwgt_mode == 'NLO':
3462+ return ['_nlo']
3463+ elif self.rwgt_mode == 'LO+NLO':
3464+ return ['_lo', '_nlo']
3465+ elif self.rwgt_mode == 'NLO_tree':
3466+ return ['_tree']
3467+ elif not self.rwgt_mode and self.has_nlo :
3468+ return ['_nlo']
3469+ else:
3470+ return ['']
3471+
3472+ @misc.mute_logger()
3473 def do_launch(self, line):
3474 """end of the configuration launched the code"""
3475
3476 args = self.split_arg(line)
3477- self.check_launch(args)
3478+ opts = self.check_launch(args)
3479+ if opts['rwgt_name']:
3480+ self.options['rwgt_name'] = opts['rwgt_name']
3481
3482 model_line = self.banner.get('proc_card', 'full_model_line')
3483
3484@@ -370,28 +428,43 @@
3485 rw_dir = pjoin(path_me, 'rw_me_second')
3486 else:
3487 rw_dir = pjoin(path_me, 'rw_me')
3488-
3489+
3490 if not '--keep_card' in args:
3491 ff = open(pjoin(rw_dir,'Cards', 'param_card.dat'), 'w')
3492 ff.write(self.banner['slha'])
3493 ff.close()
3494+ if self.has_nlo and self.rwgt_mode != "LO":
3495+ rwdir_virt = rw_dir.replace('rw_me', 'rw_mevirt')
3496+ files.ln(ff.name, starting_dir=pjoin(rwdir_virt, 'Cards'))
3497 ff = open(pjoin(path_me, 'rw_me','Cards', 'param_card_orig.dat'), 'w')
3498 ff.write(self.banner['slha'])
3499 ff.close()
3500+ if self.has_nlo and self.rwgt_mode != "LO":
3501+ files.ln(ff.name, starting_dir=pjoin(path_me, 'rw_mevirt', 'Cards'))
3502 cmd = common_run_interface.CommonRunCmd.ask_edit_card_static(cards=['param_card.dat'],
3503 ask=self.ask, pwd=rw_dir, first_cmd=self.stored_line)
3504 self.stored_line = None
3505
3506+ # get the names of type of reweighting requested
3507+ type_rwgt = self.get_weight_names()
3508+
3509 # check for potential scan in the new card
3510 new_card = open(pjoin(rw_dir, 'Cards', 'param_card.dat')).read()
3511 pattern_scan = re.compile(r'''^[\s\d]*scan''', re.I+re.M)
3512 param_card_iterator = []
3513 if pattern_scan.search(new_card):
3514+ try:
3515+ import internal.extended_cmd as extended_internal
3516+ Shell_internal = extended_internal.CmdShell
3517+ except:
3518+ Shell_internal = None
3519 import madgraph.interface.extended_cmd as extended_cmd
3520- if not isinstance(self.mother, extended_cmd.CmdShell):
3521+ if not isinstance(self.mother, (extended_cmd.CmdShell, Shell_internal)):
3522 raise Exception, "scan are not allowed on the Web"
3523 # at least one scan parameter found. create an iterator to go trough the cards
3524 main_card = check_param_card.ParamCardIterator(new_card)
3525+ if self.options['rwgt_name']:
3526+ self.options['rwgt_name'] = '%s_0' % self.options['rwgt_name']
3527
3528 param_card_iterator = main_card
3529 first_card = param_card_iterator.next(autostart=True)
3530@@ -402,20 +475,37 @@
3531 self.mother.check_param_card(pjoin(rw_dir, 'Cards', 'param_card.dat'))
3532 new_card = open(pjoin(rw_dir, 'Cards', 'param_card.dat')).read()
3533
3534+
3535 # Find new tag in the banner and add information if needed
3536 if 'initrwgt' in self.banner:
3537- if 'type=\'mg_reweighting\'' in self.banner['initrwgt']:
3538- blockpat = re.compile(r'''<weightgroup type=\'mg_reweighting\'\s*>(?P<text>.*?)</weightgroup>''', re.I+re.M+re.S)
3539+ if 'name=\'mg_reweighting\'' in self.banner['initrwgt']:
3540+ blockpat = re.compile(r'''<weightgroup name=\'mg_reweighting\'\s*>(?P<text>.*?)</weightgroup>''', re.I+re.M+re.S)
3541 before, content, after = blockpat.split(self.banner['initrwgt'])
3542 header_rwgt_other = before + after
3543- pattern = re.compile('<weight id=\'mg_reweight_(?P<id>\d+)\'>(?P<info>[^<]*)</weight>', re.S+re.I+re.M)
3544+ pattern = re.compile('<weight id=\'(?:rwgt_(?P<id>\d+)|(?P<id2>[_\w]+))(?P<rwgttype>\s*|_\w+)\'>(?P<info>.*?)</weight>', re.S+re.I+re.M)
3545 mg_rwgt_info = pattern.findall(content)
3546+
3547 maxid = 0
3548- for i, diff in mg_rwgt_info:
3549- if int(i) > maxid:
3550- maxid = int(i)
3551+ for k,(i, fulltag, nlotype, diff) in enumerate(mg_rwgt_info):
3552+ if i:
3553+ if int(i) > maxid:
3554+ maxid = int(i)
3555+ mg_rwgt_info[k] = (i, nlotype, diff) # remove the pointless fulltag tag
3556+ else:
3557+ mg_rwgt_info[k] = (fulltag, nlotype, diff) # remove the pointless id tag
3558+
3559 maxid += 1
3560 rewgtid = maxid
3561+ if self.options['rwgt_name']:
3562+ #ensure that the entry is not already define if so overwrites it
3563+ misc.sprint(mg_rwgt_info)
3564+ for (i, nlotype, diff) in mg_rwgt_info[:]:
3565+ for flag in type_rwgt:
3566+ if 'rwgt_%s' % i == '%s%s' %(self.options['rwgt_name'],flag) or \
3567+ i == '%s%s' % (self.options['rwgt_name'], flag):
3568+ logger.warning("tag %s%s already defines, will replace it", self.options['rwgt_name'],flag)
3569+ mg_rwgt_info.remove((i, nlotype, diff))
3570+
3571 else:
3572 header_rwgt_other = self.banner['initrwgt']
3573 mg_rwgt_info = []
3574@@ -425,18 +515,28 @@
3575 header_rwgt_other = ''
3576 mg_rwgt_info = []
3577 rewgtid = 1
3578-
3579+
3580 # add the reweighting in the banner information:
3581 #starts by computing the difference in the cards.
3582 s_orig = self.banner['slha']
3583 s_new = new_card
3584+
3585+ #define tag for the run
3586+ if self.options['rwgt_name']:
3587+ tag = self.options['rwgt_name']
3588+ else:
3589+ tag = str(rewgtid)
3590+
3591 if not self.second_model:
3592 old_param = check_param_card.ParamCard(s_orig.splitlines())
3593 new_param = check_param_card.ParamCard(s_new.splitlines())
3594 card_diff = old_param.create_diff(new_param)
3595 if card_diff == '' and not self.second_process:
3596- logger.warning(' REWEIGHTING: original card and new card are identical. Bypass this run')
3597- return
3598+ if not __debug__:
3599+ logger.warning(' REWEIGHTING: original card and new card are identical. Bypass this run')
3600+ return
3601+ else:
3602+ logger.warning(' REWEIGHTING: original card and new card are identical. Run it due to debug mode')
3603 #raise self.InvalidCmd, 'original card and new card are identical'
3604 try:
3605 if old_param['sminputs'].get(3)- new_param['sminputs'].get(3) > 1e-3 * new_param['sminputs'].get(3):
3606@@ -445,35 +545,53 @@
3607 logger.debug("error in check of alphas: %s" % str(error))
3608 pass #this is a security
3609 if not self.second_process:
3610- mg_rwgt_info.append((str(rewgtid), card_diff))
3611+ for name in type_rwgt:
3612+ mg_rwgt_info.append((tag, name, card_diff))
3613 else:
3614 str_proc = "\n change process ".join([""]+self.second_process)
3615- mg_rwgt_info.append((str(rewgtid), str_proc + '\n'+ card_diff))
3616+ for name in type_rwgt:
3617+ mg_rwgt_info.append((tag, name, str_proc + '\n'+ card_diff))
3618 else:
3619 str_info = "change model %s" % self.second_model
3620 if self.second_process:
3621 str_info += "\n change process ".join([""]+self.second_process)
3622 card_diff = str_info
3623 str_info += '\n' + s_new
3624- mg_rwgt_info.append((str(rewgtid), str_info))
3625-
3626+ for name in type_rwgt:
3627+ mg_rwgt_info.append((tag, name, str_info))
3628 # re-create the banner.
3629 self.banner['initrwgt'] = header_rwgt_other
3630- self.banner['initrwgt'] += '\n<weightgroup type=\'mg_reweighting\'>\n'
3631- for tag, diff in mg_rwgt_info:
3632- self.banner['initrwgt'] += '<weight id=\'mg_reweight_%s\'>%s</weight>\n' % \
3633- (tag, diff)
3634+ self.banner['initrwgt'] += '\n<weightgroup name=\'mg_reweighting\'>\n'
3635+ for tag, rwgttype, diff in mg_rwgt_info:
3636+ if tag.isdigit():
3637+ self.banner['initrwgt'] += '<weight id=\'rwgt_%s%s\'>%s</weight>\n' % \
3638+ (tag, rwgttype, diff)
3639+ else:
3640+ self.banner['initrwgt'] += '<weight id=\'%s%s\'>%s</weight>\n' % \
3641+ (tag, rwgttype, diff)
3642 self.banner['initrwgt'] += '\n</weightgroup>\n'
3643 self.banner['initrwgt'] = self.banner['initrwgt'].replace('\n\n', '\n')
3644-
3645- output = open( self.lhe_input.name +'rw', 'w')
3646-
3647+
3648+
3649+ start = time.time()
3650+ cross, ratio, ratio_square,error = {},{},{}, {}
3651+ for name in type_rwgt + ['orig']:
3652+ cross[name], error[name] = 0.,0.
3653+ ratio[name],ratio_square[name] = 0., 0.# to compute the variance and associate error
3654+
3655+ if self.output_type == "default":
3656+ output = open( self.lhe_input.name +'rw', 'w')
3657+ #write the banner to the output file
3658+ self.banner.write(output, close_tag=False)
3659+ else:
3660+ output = {}
3661+ for name in type_rwgt:
3662+ output[name] = open( self.lhe_input.name +'rw'+name, 'w')
3663+ #write the banner to the output file
3664+ self.banner.write(output[name], close_tag=False)
3665
3666 logger.info('starts to compute weight for events with the following modification to the param_card:')
3667- logger.info(card_diff)
3668-
3669- #write the banner to the output file
3670- self.banner.write(output, close_tag=False)
3671+ logger.info(card_diff.replace('\n','\nKEEP:'))
3672 # prepare the output file for the weight plot
3673 if self.mother:
3674 out_path = pjoin(self.mother.me_dir, 'Events', 'reweight.lhe')
3675@@ -495,14 +613,13 @@
3676 ff.close()
3677
3678 # Loop over all events
3679- tag_name = 'mg_reweight_%s' % rewgtid
3680- start = time.time()
3681- cross = 0
3682- ratio, ratio_square = 0, 0 # to compute the variance and associate error
3683-
3684+ if self.options['rwgt_name']:
3685+ tag_name = self.options['rwgt_name']
3686+ else:
3687+ tag_name = 'rwgt_%s' % rewgtid
3688+
3689 os.environ['GFORTRAN_UNBUFFERED_ALL'] = 'y'
3690 if self.lhe_input.closed:
3691- misc.sprint("using", self.lhe_input.name)
3692 self.lhe_input = lhe_parser.EventFile(self.lhe_input.name)
3693
3694 # Multicore option not really stable -> not use it
3695@@ -529,38 +646,67 @@
3696 continue
3697 else:
3698 weight = self.calculate_weight(event)
3699- cross += weight
3700- ratio += weight/event.wgt
3701- ratio_square += (weight/event.wgt)**2
3702+ if not isinstance(weight, dict):
3703+ weight = {'':weight}
3704+
3705+ for name in weight:
3706+ cross[name] += weight[name]
3707+ ratio[name] += weight[name]/event.wgt
3708+ ratio_square[name] += (weight[name]/event.wgt)**2
3709+
3710+ # ensure to have a consistent order of the weights. new one are put
3711+ # at the back, remove old position if already defines
3712+ for tag in type_rwgt:
3713+ try:
3714+ event.reweight_order.remove('%s%s' % (tag_name,tag))
3715+ except ValueError:
3716+ continue
3717+
3718+ event.reweight_order += ['%s%s' % (tag_name,name) for name in type_rwgt]
3719 if self.output_type == "default":
3720- event.reweight_data[tag_name] = weight
3721- #write this event with weight
3722+ for name in weight:
3723+ if 'orig' in name:
3724+ continue
3725+ event.reweight_data['%s%s' % (tag_name,name)] = weight[name]
3726+ #write this event with weight
3727 output.write(str(event))
3728 if self.mother:
3729- event.wgt = weight
3730+ event.wgt = weight[type_rwgt[0]]
3731 event.reweight_data = {}
3732 output2.write(str(event))
3733-
3734 else:
3735- event.wgt = weight
3736- event.reweight_data = {}
3737- if self.mother:
3738- output2.write(str(event))
3739- else:
3740- output.write(str(event))
3741+ for i,name in enumerate(weight):
3742+ event.wgt = weight[name]
3743+ event.reweight_data = {}
3744+ if self.mother and len(weight)==1:
3745+ output2.write(str(event))
3746+ elif self.mother and i == 0:
3747+ output[name].write(str(event))
3748+ output2.write(str(event))
3749+ else:
3750+ output[name].write(str(event))
3751
3752 # check normalisation of the events:
3753 if 'event_norm' in self.run_card:
3754 if self.run_card['event_norm'] == 'average':
3755- cross /= event_nb+1
3756+ for key, value in cross.items():
3757+ cross[key] = value / (event_nb+1)
3758
3759
3760 running_time = misc.format_timer(time.time()-start)
3761 logger.info('All event done (nb_event: %s) %s' % (event_nb+1, running_time))
3762
3763- output.write('</LesHouchesEvents>\n')
3764- output.close()
3765+
3766+ if self.output_type == "default":
3767+ output.write('</LesHouchesEvents>\n')
3768+ output.close()
3769+ else:
3770+ for key in output:
3771+ output[key].write('</LesHouchesEvents>\n')
3772+ output.close()
3773+
3774 os.environ['GFORTRAN_UNBUFFERED_ALL'] = 'n'
3775+
3776 if self.mother:
3777 output2.write('</LesHouchesEvents>\n')
3778 output2.close()
3779@@ -570,14 +716,17 @@
3780 results = self.mother.results
3781 results.add_run(run_name, self.run_card, current=True)
3782 results.add_detail('nb_event', event_nb+1)
3783- results.add_detail('cross', cross)
3784+ name = type_rwgt[0]
3785+ results.add_detail('cross', cross[name])
3786 event_nb +=1
3787- variance = ratio_square/event_nb - (ratio/event_nb)**2
3788- orig_cross, orig_error = self.orig_cross
3789- error = variance/math.sqrt(event_nb) * orig_cross + ratio/event_nb * orig_error
3790-
3791- results.add_detail('error', error)
3792- self.mother.create_plot(mode='reweight', event_path=output2.name,
3793+ for name in type_rwgt:
3794+ variance = ratio_square[name]/event_nb - (ratio[name]/event_nb)**2
3795+ orig_cross, orig_error = self.orig_cross
3796+ error[name] = variance/math.sqrt(event_nb) * orig_cross + ratio[name]/event_nb * orig_error
3797+ results.add_detail('error', error[type_rwgt[0]])
3798+ import madgraph.interface.madevent_interface as ME_interface
3799+ if isinstance(self.mother, ME_interface.MadEventCmd):
3800+ self.mother.create_plot(mode='reweight', event_path=output2.name,
3801 tag=self.run_card['run_tag'])
3802 #modify the html output to add the original run
3803 if 'plot' in results.current.reweight:
3804@@ -610,6 +759,7 @@
3805
3806 if self.output_type == "default":
3807 files.mv(output.name, target)
3808+ logger.info('Event %s have now the additional weight' % self.lhe_input.name)
3809 elif self.output_type == "unweight":
3810 output2.close()
3811 lhe = lhe_parser.EventFile(output2.name)
3812@@ -618,25 +768,38 @@
3813 results = self.mother.results
3814 results.add_detail('nb_event', nb_event)
3815 results.current.parton.append('lhe')
3816-
3817+ logger.info('Event %s is now unweighted under the new theory' % output2.name)
3818 else:
3819 files.mv(output2.name, self.lhe_input.name)
3820 if self.mother and hasattr(self.mother, 'results'):
3821 results = self.mother.results
3822- results.current.parton.append('lhe')
3823-
3824- logger.info('Event %s have now the additional weight' % self.lhe_input.name)
3825- logger.info('new cross-section is : %g pb (indicative error: %g pb)' % (cross,error))
3826+ results.current.parton.append('lhe')
3827+ logger.info('Event %s is now created with new central weight' % output2.name)
3828+
3829+ for name in cross:
3830+ if name == 'orig':
3831+ continue
3832+ logger.info('new cross-section is %s: %g pb (indicative error: %g pb)' %\
3833+ ('(%s)' %name if name else '',cross[name], error[name]))
3834+
3835 self.terminate_fortran_executables(new_card_only=True)
3836 #store result
3837- self.all_cross_section[rewgtid] = (cross, error)
3838+ for name in cross:
3839+ if name == 'orig':
3840+ self.all_cross_section[name] = (cross[name], error[name])
3841+ else:
3842+ self.all_cross_section[(tag_name,name)] = (cross[name], error[name])
3843
3844+
3845 # perform the scanning
3846 if param_card_iterator:
3847- for card in param_card_iterator:
3848+ for i,card in enumerate(param_card_iterator):
3849+ if self.options['rwgt_name']:
3850+ self.options['rwgt_name'] = '%s_%s' % (self.options['rwgt_name'].rsplit('_',1)[0], i+1)
3851 card.write(pjoin(rw_dir, 'Cards', 'param_card.dat'))
3852 self.exec_cmd("launch --keep_card", printcmd=False, precmd=True)
3853
3854+ self.options['rwgt_name'] = None
3855
3856 def do_set(self, line):
3857 "Not in help"
3858@@ -691,20 +854,137 @@
3859 def calculate_weight(self, event, space=None):
3860 """space defines where to find the calculator (in multicore)"""
3861
3862+ if self.has_nlo and self.rwgt_mode != "LO":
3863+ return self.calculate_nlo_weight(event, space)
3864+
3865 if not space:
3866 space = self
3867-
3868- event.parse_reweight()
3869-
3870+ event.parse_reweight()
3871+
3872+ # LO reweighting
3873 w_orig = self.calculate_matrix_element(event, 0, space)
3874 w_new = self.calculate_matrix_element(event, 1, space)
3875+
3876 if w_orig == 0:
3877 tag, order = event.get_tag_and_order()
3878 orig_order, Pdir, hel_dict = self.id_to_path[tag]
3879 misc.sprint(w_orig, w_new)
3880 misc.sprint(event)
3881 raise Exception, "Invalid matrix element for original computation (weight=0)"
3882- return w_new/w_orig*event.wgt
3883+
3884+ return {'orig': event.wgt, '': w_new/w_orig*event.wgt}
3885+
3886+ def calculate_nlo_weight(self, event, space=None):
3887+
3888+
3889+ type_nlo = self.get_weight_names()
3890+ final_weight = {'orig': event.wgt}
3891+
3892+ if not space:
3893+ space = self #for multicore: not use so far
3894+
3895+ event.parse_reweight()
3896+ event.parse_nlo_weight()
3897+
3898+ #initialise the input to the function which recompute the weight
3899+ scales2 = []
3900+ pdg = []
3901+ bjx = []
3902+ wgt_tree = [] # reweight for loop-improved type
3903+ wgt_virt = [] #reweight b+v together
3904+ base_wgt = []
3905+ gs=[]
3906+ qcdpower = []
3907+ ref_wgts = [] #for debugging
3908+
3909+ orig_wgt = 0
3910+ for cevent in event.nloweight.cevents:
3911+ #check if we need to compute the virtual for that cevent
3912+ need_V = False # the real is nothing else than the born for a N+1 config
3913+ all_ctype = [w.type for w in cevent.wgts]
3914+ if '_nlo' in type_nlo and any(c in all_ctype for c in [2,14,15]):
3915+ need_V =True
3916+
3917+ w_orig = self.calculate_matrix_element(cevent, 0, space)
3918+ w_new = self.calculate_matrix_element(cevent, 1, space)
3919+ ratio_T = w_new/w_orig
3920+ if need_V:
3921+ scale2 = cevent.wgts[0].scales2[0]
3922+ #for scale2 in set(c.scales2[1] for c in cevent.wgts):
3923+ w_origV = self.calculate_matrix_element(cevent, 'V0', space, scale2=scale2)
3924+ w_newV = self.calculate_matrix_element(cevent, 'V1', space, scale2=scale2)
3925+ ratio_BV = (w_newV + w_new) / (w_origV + w_orig)
3926+ ratio_V = w_newV/w_origV
3927+ else:
3928+ ratio_V = "should not be used"
3929+ ratio_BV = "should not be used"
3930+
3931+ for c_wgt in cevent.wgts:
3932+ orig_wgt += c_wgt.ref_wgt
3933+ #add the information to the input
3934+ scales2.append(c_wgt.scales2)
3935+ pdg.append(c_wgt.pdgs[:2])
3936+
3937+ bjx.append(c_wgt.bjks)
3938+ qcdpower.append(c_wgt.qcdpower)
3939+ gs.append(c_wgt.gs)
3940+ ref_wgts.append(c_wgt.ref_wgt)
3941+
3942+ if '_nlo' in type_nlo:
3943+ if c_wgt.type in [2,14,15]:
3944+ R = ratio_BV
3945+ else:
3946+ R = ratio_T
3947+
3948+ new_wgt = [c_wgt.pwgt[0] * R,
3949+ c_wgt.pwgt[1] * ratio_T,
3950+ c_wgt.pwgt[2] * ratio_T]
3951+ wgt_virt.append(new_wgt)
3952+
3953+ if '_tree' in type_nlo:
3954+ new_wgt = [c_wgt.pwgt[0] * ratio_T,
3955+ c_wgt.pwgt[1] * ratio_T,
3956+ c_wgt.pwgt[2] * ratio_T]
3957+ wgt_tree.append(new_wgt)
3958+ base_wgt.append(c_wgt.pwgt[:3])
3959+
3960+ #change the ordering to the fortran one:
3961+ scales2 = self.invert_momenta(scales2)
3962+ pdg = self.invert_momenta(pdg)
3963+ bjx = self.invert_momenta(bjx)
3964+ # re-compute original weight to reduce numerical inacurracy
3965+ base_wgt = self.invert_momenta(base_wgt)
3966+
3967+ orig_wgt_check, partial_check = self.combine_wgt(scales2, pdg, bjx, base_wgt, gs, qcdpower, 1., 1.)
3968+
3969+ if '_nlo' in type_nlo:
3970+ wgt = self.invert_momenta(wgt_virt)
3971+ with misc.stdchannel_redirected(sys.stdout, os.devnull):
3972+ new_out, partial = self.combine_wgt(scales2, pdg, bjx, wgt, gs, qcdpower, 1., 1.)
3973+ # try to correct for precision issue
3974+ avg = [partial_check[i]/ref_wgts[i] for i in range(len(ref_wgts))]
3975+ out = sum(partial[i]/avg[i] if 0.85<avg[i]<1.15 else 0 \
3976+ for i in range(len(avg)))
3977+ final_weight['_nlo'] = out/orig_wgt*event.wgt
3978+
3979+
3980+ if '_tree' in type_nlo:
3981+ wgt = self.invert_momenta(wgt_tree)
3982+ with misc.stdchannel_redirected(sys.stdout, os.devnull):
3983+ out, partial = self.combine_wgt(scales2, pdg, bjx, wgt, gs, qcdpower, 1., 1.)
3984+ # try to correct for precision issue
3985+ avg = [partial_check[i]/ref_wgts[i] for i in range(len(ref_wgts))]
3986+ new_out = sum(partial[i]/avg[i] if 0.85<avg[i]<1.15 else partial[i] \
3987+ for i in range(len(avg)))
3988+ final_weight['_tree'] = new_out/orig_wgt*event.wgt
3989+
3990+ if '_lo' in type_nlo:
3991+ w_orig = self.calculate_matrix_element(event, 0, space)
3992+ w_new = self.calculate_matrix_element(event, 1, space)
3993+ final_weight['_lo'] = w_new/w_orig*event.wgt
3994+
3995+ return final_weight
3996+
3997
3998 @staticmethod
3999 def invert_momenta(p):
4000@@ -726,26 +1006,38 @@
4001 open(pjoin(Pdir, 'matrix%spy.so' % tag),'w').write(open(pjoin(Pdir, 'matrix2py.so')
4002 ).read().replace('matrix2py', 'matrix%spy' % tag))
4003
4004- def calculate_matrix_element(self, event, hypp_id, space):
4005+ def calculate_matrix_element(self, event, hypp_id, space, scale2=0):
4006 """routine to return the matrix element"""
4007-
4008+
4009 tag, order = event.get_tag_and_order()
4010+ if isinstance(hypp_id, str) and hypp_id.startswith('V'):
4011+ tag = (tag,'V')
4012+ hypp_id = int(hypp_id[1:])
4013+ base = "rw_mevirt"
4014+ else:
4015+ base = "rw_me"
4016
4017 if (not self.second_model and not self.second_process) or hypp_id==0:
4018 orig_order, Pdir, hel_dict = self.id_to_path[tag]
4019 else:
4020- orig_order, Pdir, hel_dict = self.id_to_path_second[tag]
4021+ orig_order, Pdir, hel_dict = self.id_to_path_second[tag]
4022+
4023
4024 run_id = (tag, hypp_id)
4025
4026-
4027 assert space == self
4028 start = False
4029 if run_id in space.calculator:
4030 external = space.calculator[run_id]
4031+ # mod = space.calculator[(run_id,'module')]
4032+ # #with misc.chdir(Pdir):
4033+ # # if hypp_id==0:
4034+ # # mod.initialise('param_card_orig.dat')
4035+ # # else:
4036+ # # mod.initialise('param_card.dat')
4037 elif (not self.second_model and not self.second_process) or hypp_id==0:
4038 # create the executable for this param_card
4039- subdir = pjoin(self.me_dir,'rw_me ', 'SubProcesses')
4040+ subdir = pjoin(self.me_dir, base, 'SubProcesses')
4041 if self.me_dir not in sys.path:
4042 sys.path.insert(0,self.me_dir)
4043 if self.rwgt_dir and self.rwgt_dir not in sys.path:
4044@@ -760,45 +1052,57 @@
4045 if old_module != nb_f2py_module:
4046 metag += 1
4047 dir_to_f2py_free_mod[(Pdir,0)] = (metag, nb_f2py_module)
4048-
4049 os.environ['MENUM'] = '2'
4050 if not self.rwgt_dir or not os.path.exists(pjoin(Pdir, 'matrix2py.so')):
4051- misc.compile(['matrix2py.so'], cwd=Pdir)
4052- self.rename_f2py_lib(Pdir, 2*metag)
4053-
4054- mymod = __import__('rw_me.SubProcesses.%s.matrix%spy' % (Pname, 2*metag), globals(), locals(), [],-1)
4055+ misc.compile(['matrix2py.so'], cwd=Pdir)
4056+ self.rename_f2py_lib(Pdir, 2*metag)
4057+ try:
4058+ mymod = __import__('%s.SubProcesses.%s.matrix%spy' % (base, Pname, 2*metag), globals(), locals(), [],-1)
4059+ except:
4060+ import platform
4061+ if platform.system() == 'Darwin':
4062+ os.system('install_name_tool -change libMadLoop.dylib %s/libMadLoop.dylib matrix%spy.so' % (Pdir,2*metag))
4063+ mymod = __import__('%s.SubProcesses.%s.matrix%spy' % (base, Pname, 2*metag), globals(), locals(), [],-1)
4064+ else:
4065+ misc.sprint("fail compilation")
4066+ raise
4067 S = mymod.SubProcesses
4068 P = getattr(S, Pname)
4069 mymod = getattr(P, 'matrix%spy' % (2*metag))
4070 with misc.chdir(Pdir):
4071- mymod.initialise('param_card_orig.dat')
4072-
4073+ with misc.stdchannel_redirected(sys.stdout, os.devnull):
4074+ mymod.initialise('param_card_orig.dat')
4075+
4076+
4077 if hypp_id == 1:
4078 #incorrect line
4079 metag = dir_to_f2py_free_mod[(Pdir,0)][0]
4080 newtag = 2*metag+1
4081 self.rename_f2py_lib(Pdir, newtag)
4082 try:
4083- mymod = __import__('rw_me.SubProcesses.%s.matrix%spy' % (Pname, newtag), globals(), locals(), [],-1)
4084+ mymod = __import__('%s.SubProcesses.%s.matrix%spy' % (base, Pname, newtag), globals(), locals(), [],-1)
4085 except Exception, error:
4086 os.remove(pjoin(Pdir, 'matrix%spy.so' % newtag))
4087 newtag = "L%s" % newtag
4088 os.environ['MENUM'] = newtag
4089 misc.compile(['matrix%spy.so' % newtag], cwd=Pdir)
4090- mymod = __import__('rw_me.SubProcesses.%s.matrix%spy' % (Pname, newtag), globals(), locals(), [],-1)
4091-
4092+ mymod = __import__('%s.SubProcesses.%s.matrix%spy' % (base, Pname, newtag), globals(), locals(), [],-1)
4093+
4094 S = mymod.SubProcesses
4095 P = getattr(S, Pname)
4096 mymod = getattr(P, 'matrix%spy' % newtag)
4097 with misc.chdir(Pdir):
4098- mymod.initialise('param_card.dat')
4099+ with misc.stdchannel_redirected(sys.stdout, os.devnull):
4100+ mymod.initialise('param_card.dat')
4101+
4102 space.calculator[run_id] = mymod.get_me
4103+ space.calculator[(run_id,'module')] = mymod
4104 external = space.calculator[run_id]
4105 else:
4106- subdir = pjoin(self.me_dir,'rw_me_second', 'SubProcesses')
4107+ subdir = pjoin(self.me_dir,'%s_second' % base, 'SubProcesses')
4108 if self.me_dir not in sys.path:
4109 sys.path.append(self.me_dir)
4110-
4111+
4112 assert hypp_id == 1
4113 Pname = os.path.basename(Pdir)
4114 os.environ['MENUM'] = '2'
4115@@ -813,26 +1117,29 @@
4116 metag += 1
4117 dir_to_f2py_free_mod[(Pdir,1)] = (metag, nb_f2py_module)
4118 self.rename_f2py_lib(Pdir, metag)
4119-
4120 try:
4121- mymod = __import__("rw_me_second.SubProcesses.%s.matrix%spy" % (Pname, metag))
4122+ mymod = __import__("%s_second.SubProcesses.%s.matrix%spy" % (base, Pname, metag))
4123 except ImportError:
4124 os.remove(pjoin(Pdir, 'matrix%spy.so' % metag ))
4125- metag = "L%s" % metag
4126+ metag = "L" % metag
4127 os.environ['MENUM'] = str(metag)
4128 misc.compile(['matrix%spy.so' % metag], cwd=pjoin(subdir, Pdir))
4129- mymod = __import__("rw_me_second.SubProcesses.%s.matrix%spy" % (Pname, metag))
4130+ mymod = __import__("%s_second.SubProcesses.%s.matrix%spy" % (base, Pname, metag))
4131+
4132 reload(mymod)
4133 S = mymod.SubProcesses
4134 P = getattr(S, Pname)
4135- mymod = getattr(P, 'matrix%spy' % metag)
4136- with misc.chdir(Pdir):
4137- mymod.initialise('param_card.dat')
4138+ mymod = getattr(P, 'matrix%spy' % metag)
4139+ with misc.chdir(Pdir):
4140+ with misc.stdchannel_redirected(sys.stdout, os.devnull):
4141+ mymod.initialise('param_card.dat')
4142 space.calculator[run_id] = mymod.get_me
4143+ space.calculator[(run_id,'module')] = mymod
4144 external = space.calculator[run_id]
4145
4146-
4147 p = self.invert_momenta(event.get_momenta(orig_order))
4148+
4149+
4150 # add helicity information
4151
4152 hel_order = event.get_helicity(orig_order)
4153@@ -843,7 +1150,15 @@
4154
4155 with misc.chdir(Pdir):
4156 with misc.stdchannel_redirected(sys.stdout, os.devnull):
4157- me_value = external(p,event.aqcd, nhel)
4158+ if 'V' in tag or \
4159+ (hypp_id ==1 and self.second_process and any('sqrvirt' in l for l in self.second_process)):
4160+ me_value = external(p,event.aqcd, math.sqrt(scale2), nhel)
4161+ else:
4162+ try:
4163+ me_value = external(p,event.aqcd, nhel)
4164+ except TypeError:
4165+ me_value = external(p,event.aqcd, math.sqrt(scale2), nhel)
4166+
4167 # for NLO we have also the stability status code
4168 if isinstance(me_value, tuple):
4169 me_value, code = me_value
4170@@ -875,17 +1190,28 @@
4171 split = line.split()
4172 if len(split) == 4:
4173 cross, error = float(split[0]), float(split[1])
4174+ if 'orig' not in self.all_cross_section:
4175 logger.info('Original cross-section: %s +- %s pb' % (cross, error))
4176-
4177+ else:
4178+ logger.info('Original cross-section: %s +- %s pb (cross-section from sum of weights: %s)' % (cross, error, self.all_cross_section['orig'][0]))
4179 logger.info('Computed cross-section:')
4180 keys = self.all_cross_section.keys()
4181 keys.sort()
4182 for key in keys:
4183- logger.info('%s : %s +- %s pb' % (key,self.all_cross_section[key][0],self.all_cross_section[key][1] ))
4184+ if key == 'orig':
4185+ continue
4186+ logger.info('%s : %s +- %s pb' % (key[0] if not key[1] else '%s%s' % key,
4187+ self.all_cross_section[key][0],self.all_cross_section[key][1] ))
4188 self.terminate_fortran_executables()
4189
4190 if self.rwgt_dir:
4191 self.save_to_pickle()
4192+
4193+ with misc.stdchannel_redirected(sys.stdout, os.devnull):
4194+ for run_id in self.calculator:
4195+ del self.calculator[run_id]
4196+ del self.calculator
4197+
4198
4199 def __del__(self):
4200 self.do_quit('')
4201@@ -895,165 +1221,89 @@
4202 """Adding one element to the list based on the matrix element"""
4203
4204
4205-
4206-
4207-
4208-
4209 @misc.mute_logger()
4210 def create_standalone_directory(self, second=False):
4211 """generate the various directory for the weight evaluation"""
4212
4213+ data={}
4214+ if not second:
4215+ data['paths'] = ['rw_me', 'rw_mevirt']
4216+ # model
4217+ info = self.banner.get('proc_card', 'full_model_line')
4218+ if '-modelname' in info:
4219+ data['mg_names'] = False
4220+ else:
4221+ data['mg_names'] = True
4222+ data['model_name'] = self.banner.get('proc_card', 'model')
4223+ #processes
4224+ data['processes'] = [line[9:].strip() for line in self.banner.proc_card
4225+ if line.startswith('generate')]
4226+ data['processes'] += [' '.join(line.split()[2:]) for line in self.banner.proc_card
4227+ if re.search('^\s*add\s+process', line)]
4228+ #object_collector
4229+ self.id_to_path = {}
4230+ data['id2path'] = self.id_to_path
4231+ else:
4232+ data['paths'] = ['rw_me_second', 'rw_mevirt_second']
4233+ # model
4234+ if self.second_model:
4235+ data['mg_names'] = True
4236+ if ' ' in self.second_model:
4237+ args = self.second_model.split()
4238+ if '--modelname' in args:
4239+ data['mg_names'] = False
4240+ data['model_name'] = args[0]
4241+ else:
4242+ data['model_name'] = self.second_model
4243+ else:
4244+ data['model_name'] = None
4245+ #processes
4246+ if self.second_process:
4247+ data['processes'] = self.second_process
4248+ else:
4249+ data['processes'] = [line[9:].strip() for line in self.banner.proc_card
4250+ if line.startswith('generate')]
4251+ data['processes'] += [' '.join(line.split()[2:])
4252+ for line in self.banner.proc_card
4253+ if re.search('^\s*add\s+process', line)]
4254+ #object_collector
4255+ self.id_to_path_second = {}
4256+ data['id2path'] = self.id_to_path_second
4257+
4258 # 0. clean previous run ------------------------------------------------
4259 if not self.rwgt_dir:
4260 path_me = self.me_dir
4261 else:
4262 path_me = self.rwgt_dir
4263 try:
4264- shutil.rmtree(pjoin(path_me,'rw_me'))
4265+ shutil.rmtree(pjoin(path_me,data['paths'][0]))
4266+ except Exception:
4267+ pass
4268+ try:
4269+ shutil.rmtree(pjoin(path_me, data['paths'][1]))
4270 except Exception:
4271 pass
4272
4273- # 1. Load model---------------------------------------------------------
4274+ # 1. prepare the interface----------------------------------------------
4275+ mgcmd = self.mg5cmd
4276 complex_mass = False
4277 has_cms = re.compile(r'''set\s+complex_mass_scheme\s*(True|T|1|true|$|;)''')
4278 for line in self.banner.proc_card:
4279 if line.startswith('set'):
4280- self.mg5cmd.exec_cmd(line, printcmd=False, precmd=False, postcmd=False)
4281+ mgcmd.exec_cmd(line, printcmd=False, precmd=False, postcmd=False)
4282 if has_cms.search(line):
4283 complex_mass = True
4284 elif line.startswith('define'):
4285 try:
4286- self.mg5cmd.exec_cmd(line, printcmd=False, precmd=False, postcmd=False)
4287+ mgcmd.exec_cmd(line, printcmd=False, precmd=False, postcmd=False)
4288 except Exception:
4289 pass
4290
4291- info = self.banner.get('proc_card', 'full_model_line')
4292- if '-modelname' in info:
4293- mg_names = False
4294- else:
4295- mg_names = True
4296- model_name = self.banner.get('proc_card', 'model')
4297- if model_name:
4298- self.load_model(model_name, mg_names, complex_mass)
4299- else:
4300+ # 1. Load model---------------------------------------------------------
4301+ if not data['model_name'] and not second:
4302 raise self.InvalidCmd('Only UFO model can be loaded in this module.')
4303-
4304- mgcmd = self.mg5cmd
4305- modelpath = self.model.get('modelpath')
4306- if os.path.basename(modelpath) != mgcmd._curr_model['name']:
4307- name, restrict = mgcmd._curr_model['name'].rsplit('-',1)
4308- if os.path.exists(pjoin(os.path.dirname(modelpath),name, 'restrict_%s.dat' % restrict)):
4309- modelpath = pjoin(os.path.dirname(modelpath), mgcmd._curr_model['name'])
4310-
4311- commandline="import model %s " % modelpath
4312- mgcmd.exec_cmd(commandline)
4313-
4314- #multiparticles
4315- for name, content in self.banner.get('proc_card', 'multiparticles'):
4316- mgcmd.exec_cmd("define %s = %s" % (name, content))
4317-
4318- # 2. compute the production matrix element -----------------------------
4319- processes = [line[9:].strip() for line in self.banner.proc_card
4320- if line.startswith('generate')]
4321- processes += [' '.join(line.split()[2:]) for line in self.banner.proc_card
4322- if re.search('^\s*add\s+process', line)]
4323- mgcmd.exec_cmd("set group_subprocesses False")
4324-
4325- logger.info('generating the square matrix element for reweighting')
4326- start = time.time()
4327- commandline=''
4328- for proc in processes:
4329- if '[' not in proc:
4330- commandline += "add process %s ;" % proc
4331- else:
4332- commandline += self.get_LO_definition_from_NLO(proc)
4333-
4334- commandline = commandline.replace('add process', 'generate',1)
4335- logger.info(commandline)
4336- try:
4337- mgcmd.exec_cmd(commandline, precmd=True, errorhandling=False)
4338- except diagram_generation.NoDiagramException:
4339- commandline=''
4340- for proc in processes:
4341- if '[' not in proc:
4342- raise
4343- commandline += "add process %s ;" % proc
4344- commandline = commandline.replace('add process', 'generate',1)
4345- logger.info("RETRY with %s", commandline)
4346- mgcmd.exec_cmd(commandline, precmd=True)
4347- except Exception, error:
4348- raise
4349-
4350- commandline = 'output standalone_rw %s' % pjoin(path_me,'rw_me')
4351- mgcmd.exec_cmd(commandline, precmd=True)
4352- logger.info('Done %.4g' % (time.time()-start))
4353- self.has_standalone_dir = True
4354-
4355-
4356- # 3. Store id to directory information ---------------------------------
4357- matrix_elements = mgcmd._curr_matrix_elements.get_matrix_elements()
4358-
4359- self.id_to_path = {}
4360- for me in matrix_elements:
4361- for proc in me.get('processes'):
4362- initial = [] #filled in the next line
4363- final = [l.get('id') for l in proc.get('legs')\
4364- if l.get('state') or initial.append(l.get('id'))]
4365- order = (initial, final)
4366- tag = proc.get_initial_final_ids()
4367- decay_finals = proc.get_final_ids_after_decay()
4368-
4369- if tag[1] != decay_finals:
4370- order = (initial, list(decay_finals))
4371- decay_finals.sort()
4372- tag = (tag[0], tuple(decay_finals))
4373- Pdir = pjoin(path_me, 'rw_me', 'SubProcesses',
4374- 'P%s' % me.get('processes')[0].shell_string())
4375- assert os.path.exists(Pdir), "Pdir %s do not exists" % Pdir
4376- if tag in self.id_to_path:
4377- if not Pdir == self.id_to_path[tag][1]:
4378- misc.sprint(tag, Pdir, self.id_to_path[tag][1])
4379- raise self.InvalidCmd, '2 different process have the same final states. This module can not handle such situation'
4380- else:
4381- continue
4382- # build the helicity dictionary
4383- hel_nb = 0
4384- hel_dict = {9:0} # unknown helicity -> use full ME
4385- for helicities in me.get_helicity_matrix():
4386- hel_nb +=1 #fortran starts at 1
4387- hel_dict[tuple(helicities)] = hel_nb
4388-
4389- self.id_to_path[tag] = [order, Pdir, hel_dict]
4390-
4391- # 3. If we need a new model/process-------------------------------------
4392- if self.second_model or self.second_process:
4393- self.create_second_standalone_directory()
4394-
4395- @misc.mute_logger()
4396- def create_second_standalone_directory(self, second=False):
4397- """generate the various directory for the weight evaluation"""
4398-
4399- # 0. clean previous run ------------------------------------------------
4400- path_me = self.me_dir
4401- try:
4402- shutil.rmtree(pjoin(path_me,'rw_me_second'))
4403- except Exception:
4404- pass
4405-
4406- mgcmd = self.mg5cmd
4407- # 1. Load model---------------------------------------------------------
4408- if self.second_model:
4409- use_mgdefault= True
4410- complex_mass = False
4411- if ' ' in self.second_model:
4412- args = self.second_model.split()
4413- if '--modelname' in args:
4414- use_mgdefault = False
4415- model_name = args[0]
4416- else:
4417- model_name = self.second_model
4418- self.load_model(model_name, use_mgdefault, complex_mass)
4419-
4420+ elif data['model_name']:
4421+ self.load_model(data['model_name'], data['mg_names'], complex_mass)
4422 modelpath = self.model.get('modelpath')
4423 if os.path.basename(modelpath) != mgcmd._curr_model['name']:
4424 name, restrict = mgcmd._curr_model['name'].rsplit('-',1)
4425@@ -1061,46 +1311,58 @@
4426 modelpath = pjoin(os.path.dirname(modelpath), mgcmd._curr_model['name'])
4427
4428 commandline="import model %s " % modelpath
4429- if not use_mgdefault:
4430+ if not data['mg_names']:
4431 commandline += ' -modelname '
4432 mgcmd.exec_cmd(commandline)
4433
4434+ #multiparticles
4435+ for name, content in self.banner.get('proc_card', 'multiparticles'):
4436+ mgcmd.exec_cmd("define %s = %s" % (name, content))
4437+
4438 # 2. compute the production matrix element -----------------------------
4439- if self.second_process:
4440- processes = self.second_process
4441+ has_nlo = False
4442+ mgcmd.exec_cmd("set group_subprocesses False")
4443+
4444+ if not second:
4445+ logger.info('generating the square matrix element for reweighting')
4446 else:
4447- processes = [line[9:].strip() for line in self.banner.proc_card
4448- if line.startswith('generate')]
4449- processes += [' '.join(line.split()[2:]) for line in self.banner.proc_card
4450- if re.search('^\s*add\s+process', line)]
4451- mgcmd.exec_cmd("set group_subprocesses False")
4452-
4453- logger.info('generating the square matrix element for reweighting')
4454+ logger.info('generating the square matrix element for reweighting (second model and/or processes)')
4455 start = time.time()
4456 commandline=''
4457- for proc in processes:
4458+ for proc in data['processes']:
4459 if '[' not in proc:
4460- commandline+="add process %s ;" % proc
4461- elif 'sqrvirt' in proc:
4462- commandline+="add process %s ;" % proc
4463+ commandline += "add process %s ;" % proc
4464 else:
4465- raise self.InvalidCmd('NLO processes can\'t be reweight (for Loop induced reweighting use [sqrvirt =])')
4466+ has_nlo = True
4467+ commandline += self.get_LO_definition_from_NLO(proc)
4468
4469 commandline = commandline.replace('add process', 'generate',1)
4470 logger.info(commandline)
4471- mgcmd.exec_cmd(commandline, precmd=True)
4472-
4473- matrix_elements = mgcmd._curr_matrix_elements.get_matrix_elements()
4474-
4475- commandline = 'output standalone_rw %s' % pjoin(path_me,'rw_me_second')
4476+ try:
4477+ mgcmd.exec_cmd(commandline, precmd=True, errorhandling=False)
4478+ except diagram_generation.NoDiagramException:
4479+ commandline=''
4480+ for proc in data['processes']:
4481+ if '[' not in proc:
4482+ raise
4483+ commandline += "add process %s ;" % proc
4484+ commandline = commandline.replace('add process', 'generate',1)
4485+ logger.info("RETRY with %s", commandline)
4486+ mgcmd.exec_cmd(commandline, precmd=True)
4487+ has_nlo = False
4488+ except Exception, error:
4489+ raise
4490+
4491+ commandline = 'output standalone_rw %s' % pjoin(path_me,data['paths'][0])
4492 mgcmd.exec_cmd(commandline, precmd=True)
4493 logger.info('Done %.4g' % (time.time()-start))
4494+ self.has_standalone_dir = True
4495
4496+
4497 # 3. Store id to directory information ---------------------------------
4498 matrix_elements = mgcmd._curr_matrix_elements.get_matrix_elements()
4499
4500- self.id_to_path_second = {}
4501- to_check = [] # list of tag that do not have a Pdir at creation time.
4502+ to_check = [] # list of tag that do not have a Pdir at creation time.
4503 for me in matrix_elements:
4504 for proc in me.get('processes'):
4505 initial = [] #filled in the next line
4506@@ -1114,43 +1376,196 @@
4507 order = (initial, list(decay_finals))
4508 decay_finals.sort()
4509 tag = (tag[0], tuple(decay_finals))
4510- Pdir = pjoin(path_me, 'rw_me_second', 'SubProcesses',
4511+ Pdir = pjoin(path_me, data['paths'][0], 'SubProcesses',
4512 'P%s' % me.get('processes')[0].shell_string())
4513+
4514 if not os.path.exists(Pdir):
4515 to_check.append(tag)
4516- continue
4517- if tag in self.id_to_path_second:
4518- if not Pdir == self.id_to_path_second[tag][1]:
4519- misc.sprint(tag, Pdir, self.id_to_path_second[tag][1])
4520+ continue
4521+ if tag in data['id2path']:
4522+ if not Pdir == data['id2path'][tag][1]:
4523+ misc.sprint(tag, Pdir, data['id2path'][tag][1])
4524 raise self.InvalidCmd, '2 different process have the same final states. This module can not handle such situation'
4525 else:
4526 continue
4527-
4528 # build the helicity dictionary
4529 hel_nb = 0
4530 hel_dict = {9:0} # unknown helicity -> use full ME
4531 for helicities in me.get_helicity_matrix():
4532 hel_nb +=1 #fortran starts at 1
4533- hel_dict[tuple(helicities)] = hel_nb
4534- self.id_to_path_second[tag] = [order, Pdir, hel_dict]
4535+ hel_dict[tuple(helicities)] = hel_nb
4536
4537+ data['id2path'][tag] = [order, Pdir, hel_dict]
4538+
4539 for tag in to_check:
4540 if tag not in self.id_to_path:
4541 logger.warning("no valid path for %s" % (tag,))
4542 #raise self.InvalidCmd, "no valid path for %s" % (tag,)
4543
4544- # 4. Check MadLoopParam
4545- if os.path.exists(pjoin(path_me, 'rw_me_second', 'Cards', 'MadLoopParams.dat')):
4546- MLCard = banner.MadLoopParam(pjoin(path_me, 'rw_me_second', 'Cards', 'MadLoopParams.dat'))
4547+ # 4. Check MadLoopParam for Loop induced
4548+ if os.path.exists(pjoin(path_me, data['paths'][0], 'Cards', 'MadLoopParams.dat')):
4549+ MLCard = banner.MadLoopParam(pjoin(path_me, data['paths'][0], 'Cards', 'MadLoopParams.dat'))
4550 MLCard.set('WriteOutFilters', False)
4551 MLCard.set('UseLoopFilter', False)
4552 MLCard.set("DoubleCheckHelicityFilter", False)
4553 MLCard.set("HelicityFilterLevel", 0)
4554- MLCard.write(pjoin(path_me, 'rw_me_second', 'SubProcesses', 'MadLoopParams.dat'),
4555- pjoin(path_me, 'rw_me_second', 'Cards', 'MadLoopParams.dat'),
4556+ MLCard.write(pjoin(path_me, data['paths'][0], 'SubProcesses', 'MadLoopParams.dat'),
4557+ pjoin(path_me, data['paths'][0], 'Cards', 'MadLoopParams.dat'),
4558 commentdefault=False)
4559
4560-
4561+ # 5. create the virtual for NLO reweighting ---------------------------
4562+ if has_nlo and 'NLO' in self.rwgt_mode:
4563+ # Do not pass here for LO/NLO_tree
4564+ start = time.time()
4565+ commandline=''
4566+ for proc in data['processes']:
4567+ if '[' not in proc:
4568+ pass
4569+ else:
4570+ proc = proc.replace('[', '[ virt=')
4571+ commandline += "add process %s ;" % proc
4572+ # deactivate golem since it creates troubles
4573+ old_options = dict(mgcmd.options)
4574+ if mgcmd.options['golem'] or mgcmd.options['pjfry']:
4575+ logger.info(" When doing NLO reweighting, MG5aMC cannot use the loop reduction algorithms Golem and/or PJFry++")
4576+ mgcmd.options['golem'] = None
4577+ mgcmd.options['pjfry'] = None
4578+ commandline = commandline.replace('add process', 'generate',1)
4579+ logger.info(commandline)
4580+ mgcmd.exec_cmd(commandline, precmd=True)
4581+ commandline = 'output standalone_rw %s -f' % pjoin(path_me, data['paths'][1])
4582+ mgcmd.exec_cmd(commandline, precmd=True)
4583+
4584+ #put back golem to original value
4585+ mgcmd.options['golem'] = old_options['golem']
4586+ mgcmd.options['pjfry'] = old_options['pjfry']
4587+ # update make_opts
4588+ m_opts = {}
4589+ if mgcmd.options['lhapdf']:
4590+ #lhapdfversion = subprocess.Popen([mgcmd.options['lhapdf'], '--version'],
4591+ # stdout = subprocess.PIPE).stdout.read().strip()[0]
4592+ m_opts['lhapdf'] = True
4593+ m_opts['f2pymode'] = True
4594+ m_opts['lhapdfversion'] = 5 # 6 always fail on my computer since 5 is compatible but slower always use 5
4595+ m_opts['llhapdf'] = self.mother.get_lhapdf_libdir()
4596+ else:
4597+ raise Exception, "NLO reweighting requires LHAPDF to work correctly"
4598+
4599+ path = pjoin(path_me,data['paths'][1], 'Source', 'make_opts')
4600+ common_run_interface.CommonRunCmd.update_make_opts_full(path, m_opts)
4601+ logger.info('Done %.4g' % (time.time()-start))
4602+
4603+
4604+ # Download LHAPDF SET
4605+ common_run_interface.CommonRunCmd.install_lhapdf_pdfset_static(\
4606+ mgcmd.options['lhapdf'], None, self.banner.run_card.get_lhapdf_id())
4607+
4608+ # now store the id information
4609+ matrix_elements = mgcmd._curr_matrix_elements.get_matrix_elements()
4610+ for me in matrix_elements:
4611+ for proc in me.get('processes'):
4612+ initial = [] #filled in the next line
4613+ final = [l.get('id') for l in proc.get('legs')\
4614+ if l.get('state') or initial.append(l.get('id'))]
4615+ order = (initial, final)
4616+ tag = proc.get_initial_final_ids()
4617+ decay_finals = proc.get_final_ids_after_decay()
4618+
4619+ if tag[1] != decay_finals:
4620+ order = (initial, list(decay_finals))
4621+ decay_finals.sort()
4622+ tag = (tag[0], tuple(decay_finals))
4623+ Pdir = pjoin(path_me, data['paths'][1], 'SubProcesses',
4624+ 'P%s' % me.get('processes')[0].shell_string())
4625+ assert os.path.exists(Pdir), "Pdir %s do not exists" % Pdir
4626+ if (tag,'V') in data['id2path']:
4627+ if not Pdir == data['id2path'][(tag,'V')][1]:
4628+ misc.sprint(tag, Pdir, self.id_to_path[(tag,'V')][1])
4629+ raise self.InvalidCmd, '2 different process have the same final states. This module can not handle such situation'
4630+ else:
4631+ continue
4632+ # build the helicity dictionary
4633+ hel_nb = 0
4634+ hel_dict = {9:0} # unknown helicity -> use full ME
4635+ for helicities in me.get_helicity_matrix():
4636+ hel_nb +=1 #fortran starts at 1
4637+ hel_dict[tuple(helicities)] = hel_nb
4638+
4639+ data['id2path'][(tag,'V')] = [order, Pdir, hel_dict]
4640+
4641+ #compile the module to combine the weight
4642+ misc.compile(cwd=pjoin(path_me, data['paths'][1], 'Source'))
4643+ #link it
4644+ with misc.chdir(pjoin(path_me)):
4645+ if path_me not in sys.path:
4646+ sys.path.insert(0, path_me)
4647+ mymod = __import__('%s.Source.rwgt2py' % data['paths'][1], globals(), locals(), [],-1)
4648+ mymod = mymod.Source.rwgt2py
4649+ with misc.stdchannel_redirected(sys.stdout, os.devnull):
4650+ mymod.initialise([self.banner.run_card['lpp1'],
4651+ self.banner.run_card['lpp2']],
4652+ self.banner.run_card.get_lhapdf_id())
4653+ self.combine_wgt = mymod.get_wgt
4654+
4655+ elif has_nlo and not second and self.rwgt_mode == ['NLO_tree']:
4656+ # We do not have any virtual reweighting to do but we still have to
4657+ #combine the weights.
4658+ #Idea:create a fake directory.
4659+ start = time.time()
4660+ commandline='import model loop_sm;generate g g > e+ ve [virt=QCD]'
4661+ # deactivate golem since it creates troubles
4662+ old_options = dict(mgcmd.options)
4663+ mgcmd.options['golem'] = None
4664+ mgcmd.options['pjfry'] = None
4665+ commandline = commandline.replace('add process', 'generate',1)
4666+ logger.info(commandline)
4667+ mgcmd.exec_cmd(commandline, precmd=True)
4668+ commandline = 'output standalone_rw %s -f' % pjoin(path_me, data['paths'][1])
4669+ mgcmd.exec_cmd(commandline, precmd=True)
4670+ #put back golem to original value
4671+ mgcmd.options['golem'] = old_options['golem']
4672+ mgcmd.options['pjfry'] = old_options['pjfry']
4673+ # update make_opts
4674+ m_opts = {}
4675+ if mgcmd.options['lhapdf']:
4676+ #lhapdfversion = subprocess.Popen([mgcmd.options['lhapdf'], '--version'],
4677+ # stdout = subprocess.PIPE).stdout.read().strip()[0]
4678+ m_opts['lhapdf'] = True
4679+ m_opts['f2pymode'] = True
4680+ m_opts['lhapdfversion'] = 5 # 6 always fail on my computer since 5 is compatible but slower always use 5
4681+ m_opts['llhapdf'] = self.mother.get_lhapdf_libdir()
4682+ else:
4683+ raise Exception, "NLO_tree reweighting requires LHAPDF to work correctly"
4684+
4685+ path = pjoin(path_me,data['paths'][1], 'Source', 'make_opts')
4686+ common_run_interface.CommonRunCmd.update_make_opts_full(path, m_opts)
4687+ logger.info('Done %.4g' % (time.time()-start))
4688+
4689+ # Download LHAPDF SET
4690+ common_run_interface.CommonRunCmd.install_lhapdf_pdfset_static(\
4691+ mgcmd.options['lhapdf'], None, self.banner.run_card.get_lhapdf_id())
4692+
4693+ #compile the module to combine the weight
4694+ misc.compile(cwd=pjoin(path_me, data['paths'][1], 'Source'))
4695+ #link it
4696+ with misc.chdir(pjoin(path_me)):
4697+ if path_me not in sys.path:
4698+ sys.path.insert(0, path_me)
4699+ mymod = __import__('%s.Source.rwgt2py' % data['paths'][1], globals(), locals(), [],-1)
4700+ mymod = mymod.Source.rwgt2py
4701+ with misc.stdchannel_redirected(sys.stdout, os.devnull):
4702+ mymod.initialise([self.banner.run_card['lpp1'],
4703+ self.banner.run_card['lpp2']],
4704+ self.banner.run_card.get_lhapdf_id())
4705+ self.combine_wgt = mymod.get_wgt
4706+
4707+
4708+ # 6. If we need a new model/process-------------------------------------
4709+ if (self.second_model or self.second_process) and not second:
4710+ self.create_standalone_directory(second=True)
4711+
4712+ if not second:
4713+ self.has_nlo = has_nlo
4714
4715
4716
4717@@ -1192,6 +1607,8 @@
4718 else:
4719 to_save['second_model'] = None
4720 to_save['rwgt_dir'] = self.rwgt_dir
4721+ to_save['has_nlo'] = self.has_nlo
4722+ to_save['rwgt_mode'] = self.rwgt_mode
4723
4724 name = pjoin(self.rwgt_dir, 'rw_me', 'rwgt.pkl')
4725 save_load_object.save_to_file(name, to_save)
4726@@ -1202,7 +1619,8 @@
4727 obj = save_load_object.load_from_file( pjoin(self.rwgt_dir, 'rw_me', 'rwgt.pkl'))
4728
4729 self.has_standalone_dir = True
4730- self.options = {'curr_dir': os.path.realpath(os.getcwd())}
4731+ self.options = {'curr_dir': os.path.realpath(os.getcwd()),
4732+ 'rewgt_name': None}
4733
4734 old_rwgt = obj['rwgt_dir']
4735
4736@@ -1222,8 +1640,20 @@
4737 self.processes = obj['processes']
4738 self.second_process = obj['second_process']
4739 self.second_model = obj['second_model']
4740-
4741-
4742+ self.has_nlo = obj['has_nlo']
4743+ if not self.rwgt_mode:
4744+ self.rwgt_mode = obj['rwgt_mode']
4745+ logger.info("mode set to %s" % self.rwgt_mode)
4746+ if self.has_nlo:
4747+ path = pjoin(obj['rwgt_dir'], 'rw_mevirt','Source')
4748+ sys.path.insert(0, path)
4749+ mymod = __import__('rwgt2py', globals(), locals())
4750+ with misc.stdchannel_redirected(sys.stdout, os.devnull):
4751+ mymod.initialise([self.banner.run_card['lpp1'],
4752+ self.banner.run_card['lpp2']],
4753+ self.banner.run_card.get_lhapdf_id())
4754+ self.combine_wgt = mymod.get_wgt
4755+
4756
4757
4758
4759
4760=== modified file 'madgraph/iolibs/export_fks.py'
4761--- madgraph/iolibs/export_fks.py 2016-02-24 13:54:17 +0000
4762+++ madgraph/iolibs/export_fks.py 2016-03-16 17:59:03 +0000
4763@@ -1588,6 +1588,11 @@
4764 for file in linkfiles:
4765 ln('../../../lib/%s' % file)
4766
4767+ linkfiles = ['coef_specs.inc']
4768+
4769+ for file in linkfiles:
4770+ ln('../../../Source/DHELAS/%s' % file)
4771+
4772 # Return to original PWD
4773 os.chdir(cwd)
4774
4775@@ -2632,9 +2637,7 @@
4776 lines.append('INTEGER IDEN_VALUES(%d)' % len(info_list))
4777 lines.append('DATA IDEN_VALUES /' + \
4778 ', '.join(['%d' % (
4779- fks_born.born_matrix_element.get_denominator_factor() / \
4780- fks_born.born_matrix_element['identical_particle_factor'] * \
4781- fks_born.real_processes[info['n_me'] - 1].matrix_element['identical_particle_factor'] ) \
4782+ fks_born.born_matrix_element.get_denominator_factor() ) \
4783 for info in info_list]) + '/')
4784 else:
4785 # otherwise use the born
4786@@ -3286,6 +3289,11 @@
4787 for file in linkfiles:
4788 ln('../../../lib/%s' % file)
4789
4790+ linkfiles = ['coef_specs.inc']
4791+
4792+ for file in linkfiles:
4793+ ln('../../../Source/DHELAS/%s' % file)
4794+
4795 # Return to original PWD
4796 os.chdir(cwd)
4797
4798@@ -3303,12 +3311,10 @@
4799 filename = os.path.join(self.dir_path, 'Source', 'DHELAS', 'coef_specs.inc')
4800
4801 replace_dict = {}
4802- replace_dict['max_lwf_size'] = 4
4803-
4804+ replace_dict['max_lwf_size'] = 4
4805 replace_dict['vertex_max_coefs'] = max(\
4806 [q_polynomial.get_number_of_coefs_for_rank(n)
4807 for n in max_loop_vertex_ranks])
4808-
4809 IncWriter=writers.FortranWriter(filename,'w')
4810 IncWriter.writelines("""INTEGER MAXLWFSIZE
4811 PARAMETER (MAXLWFSIZE=%(max_lwf_size)d)
4812
4813=== modified file 'madgraph/iolibs/export_v4.py'
4814--- madgraph/iolibs/export_v4.py 2016-03-04 16:16:23 +0000
4815+++ madgraph/iolibs/export_v4.py 2016-03-16 17:59:03 +0000
4816@@ -42,6 +42,7 @@
4817 import madgraph.iolibs.template_files as template_files
4818 import madgraph.iolibs.ufo_expression_parsers as parsers
4819 import madgraph.iolibs.helas_call_writers as helas_call_writers
4820+import madgraph.interface.common_run_interface as common_run_interface
4821 import madgraph.various.diagram_symmetry as diagram_symmetry
4822 import madgraph.various.misc as misc
4823 import madgraph.various.banner as banner_mod
4824@@ -1687,35 +1688,16 @@
4825 f2py_compiler = compilers['f2py']
4826 if not f2py_compiler:
4827 f2py_compiler = 'f2py'
4828-
4829-
4830+ for_update= {'DEFAULT_F_COMPILER':compiler,
4831+ 'DEFAULT_F2PY_COMPILER':f2py_compiler}
4832 make_opts = pjoin(root_dir, 'Source', 'make_opts')
4833- lines = open(make_opts).read().split('\n')
4834- FC_re = re.compile('^(\s*)(FC|F2PY)\s*=\s*(.+)\s*$')
4835- for iline, line in enumerate(lines):
4836
4837- FC_result = FC_re.match(line)
4838- if FC_result:
4839- if 'FC' == FC_result.group(2):
4840- if compiler != FC_result.group(3):
4841- mod = True
4842- lines[iline] = FC_result.group(1) + "FC=" + compiler
4843- elif 'F2PY' == FC_result.group(2):
4844- if f2py_compiler != FC_result.group(3):
4845- mod = True
4846- lines[iline] = FC_result.group(1) + "F2PY=" + f2py_compiler
4847-
4848- if not mod:
4849- return
4850-
4851 try:
4852- outfile = open(make_opts, 'w')
4853+ common_run_interface.CommonRunCmd.update_make_opts_full(
4854+ make_opts, for_update)
4855 except IOError:
4856 if root_dir == self.dir_path:
4857- logger.info('Fail to set compiler. Trying to continue anyway.')
4858- return
4859- outfile.write('\n'.join(lines))
4860-
4861+ logger.info('Fail to set compiler. Trying to continue anyway.')
4862
4863 def replace_make_opt_c_compiler(self, compiler, root_dir = ""):
4864 """Set CXX=compiler in Source/make_opts.
4865@@ -1738,56 +1720,26 @@
4866 is_lc = True
4867 else:
4868 is_lc = False
4869-
4870- mod = False #avoid to rewrite the file if not needed
4871+
4872+ # list of the variable to set in the make_opts file
4873+ for_update= {'DEFAULT_CPP_COMPILER':compiler,
4874+ 'MACFLAG':'-mmacosx-version-min=10.7' if is_clang and is_lc else '',
4875+ 'STDLIB': '-lc++' if is_lc else '-lstdc++',
4876+ 'STDLIB_FLAG': '-stdlib=libc++' if is_lc and is_clang else ''
4877+ }
4878+
4879 if not root_dir:
4880 root_dir = self.dir_path
4881 make_opts = pjoin(root_dir, 'Source', 'make_opts')
4882- lines = open(make_opts).read().split('\n')
4883- CC_re = re.compile('^(\s*)CXX\s*=\s*(.+)\s*$')
4884- for iline, line in enumerate(lines):
4885- CC_result = CC_re.match(line)
4886- if CC_result:
4887- if compiler != CC_result.group(2):
4888- mod = True
4889- lines[iline] = CC_result.group(1) + "CXX=" + compiler
4890- if 'LDFLAGS=-lc++' in line:
4891- if not is_lc:
4892- lines[iline] = 'LDFLAGS=-lstdc++'
4893- mod = True
4894- elif is_clang and not 'mmacosx-version' in line:
4895- lines[iline] += " -mmacosx-version-min=10.7"
4896- mod=True
4897- elif not is_clang and 'mmacosx-version' in line:
4898- lines[iline] = lines[iline].replace('-mmacosx-version-min=10.7', '')
4899- mod = True
4900- elif 'LDFLAGS=-lstdc++' in line:
4901- if is_lc and is_clang:
4902- lines[iline] = 'LDFLAGS=-lc++ -mmacosx-version-min=10.7'
4903- mod = True
4904
4905- if is_clang and is_lc:
4906- CFLAGS_re=re.compile('^(\s*)CFLAGS\s*=\s*(.+)\s*$')
4907- CXXFLAGS_re=re.compile('^(\s*)CXXFLAGS\s*=\s*(.+)\s*$')
4908- flags= '-O -stdlib=libc++ -mmacosx-version-min=10.7'
4909- for iline, line in enumerate(lines):
4910- CF_result = CFLAGS_re.match(line)
4911- CXXF_result = CXXFLAGS_re.match(line)
4912- if CF_result and CF_result.group(2) != flags:
4913- lines[iline] = CF_result.group(1) + "CFLAGS= " + flags
4914- mod=True
4915- if CXXF_result and CXXF_result.group(1)!= flags:
4916- lines[iline] = CXXF_result.group(1) + "CXXFLAGS= " + flags
4917- mod=True
4918- if not mod:
4919- return
4920 try:
4921- outfile = open(make_opts, 'w')
4922+ common_run_interface.CommonRunCmd.update_make_opts_full(
4923+ make_opts, for_update)
4924 except IOError:
4925 if root_dir == self.dir_path:
4926- logger.info('Fail to set compiler. Trying to continue anyway.')
4927- return
4928- outfile.write('\n'.join(lines))
4929+ logger.info('Fail to set compiler. Trying to continue anyway.')
4930+
4931+ return
4932
4933 #===============================================================================
4934 # ProcessExporterFortranSA
4935@@ -1918,6 +1870,15 @@
4936 open(pjoin(self.dir_path,'__init__.py'),'w')
4937 open(pjoin(self.dir_path,'SubProcesses','__init__.py'),'w')
4938
4939+ if 'mode' in self.opt and self.opt['mode'] == "reweight":
4940+ #add the module to hande the NLO weight
4941+ files.copytree(pjoin(MG5DIR, 'Template', 'RWGTNLO'),
4942+ pjoin(self.dir_path, 'Source'))
4943+ files.copytree(pjoin(MG5DIR, 'Template', 'NLO', 'Source', 'PDF'),
4944+ pjoin(self.dir_path, 'Source', 'PDF'))
4945+ self.write_pdf_opendata()
4946+
4947+
4948
4949 def compiler_choice(self, compiler):
4950 """ Different daughter classes might want different compilers.
4951@@ -5751,7 +5712,7 @@
4952 fsock.writelines("""include \'input.inc\'
4953 include \'coupl.inc\'""")
4954 fsock.writelines("""
4955- MU_R = mu_r2
4956+ if (mu_r2.gt.0d0) MU_R = mu_r2
4957 G = SQRT(4.0d0*PI*AS2)
4958 AS = as2
4959
4960@@ -6342,8 +6303,9 @@
4961 own and set the path to its library in the MG5aMC option 'ninja'.""")
4962 cmd.exec_cmd('set ninja None')
4963 cmd.exec_cmd('save options')
4964+
4965+
4966 # ==========================================================================
4967-
4968 # First treat the MadLoop5 standalone case
4969 MadLoop_SA_options = {'clean': not noclean,
4970 'complex_mass':cmd.options['complex_mass_scheme'],
4971@@ -6361,10 +6323,11 @@
4972 'output_dependencies':cmd.options['output_dependencies'],
4973 'SubProc_prefix':'P',
4974 'compute_color_flows':cmd.options['loop_color_flows'],
4975- 'mode': 'reweight' if cmd._export_format == "standalone_rw" else ''
4976+ 'mode': 'reweight' if cmd._export_format == "standalone_rw" else '',
4977+ 'cluster_local_path': cmd.options['cluster_local_path']
4978 }
4979
4980- if output_type.startswith('madloop'):
4981+ if output_type.startswith('madloop'):
4982 import madgraph.loop.loop_exporters as loop_exporters
4983 if os.path.isdir(os.path.join(cmd._mgme_dir, 'Template/loop_material')):
4984 ExporterClass=None
4985
4986=== modified file 'madgraph/iolibs/file_writers.py'
4987--- madgraph/iolibs/file_writers.py 2015-10-01 16:00:08 +0000
4988+++ madgraph/iolibs/file_writers.py 2016-03-16 17:59:03 +0000
4989@@ -185,7 +185,7 @@
4990 comment_char = 'c'
4991 downcase = False
4992 line_length = 71
4993- max_split = 10
4994+ max_split = 20
4995 split_characters = "+-*/,) "
4996 comment_split_characters = " "
4997
4998@@ -332,20 +332,46 @@
4999 res_lines = [line]
5000
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches

to all changes: