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

Proposed by Olivier Mattelaer
Status: Merged
Merged at revision: 262
Proposed branch: lp:~maddevelopers/mg5amcnlo/2.3.3
Merge into: lp:mg5amcnlo/lts
Diff against target: 57859 lines (+10511/-38335) (has conflicts)
287 files modified
MadSpin/decay.py (+10/-3)
MadSpin/interface_madspin.py (+24/-11)
Template/LO/Source/dsample.f (+2/-2)
Template/LO/Source/kin_functions.f (+5/-1)
Template/LO/bin/generate_events (+2/-2)
Template/LO/bin/internal/Gridpack/compile (+2/-2)
Template/LO/bin/internal/create_matching_plots.C (+10/-0)
Template/LO/bin/internal/create_matching_plots.sh (+1/-3)
Template/LO/bin/internal/plot_tree.C (+5/-1)
Template/LO/bin/internal/read_tree_files.C (+0/-12)
Template/MadWeight/Python/Info.py (+5/-5)
Template/MadWeight/Python/clean.py (+2/-2)
Template/NLO/Cards/run_card.dat (+2/-0)
Template/NLO/Cards/shower_card.dat (+6/-6)
Template/NLO/MCatNLO/Scripts/MCatNLO_MadFKS_PYTHIA8.Script (+1/-0)
Template/NLO/Source/PDF/pdg2pdf.f (+5/-1)
Template/NLO/Source/PDF/pdg2pdf_lhapdf.f (+6/-0)
Template/NLO/Source/run.inc (+3/-0)
Template/NLO/Source/run_config.inc (+1/-1)
Template/NLO/SubProcesses/ajob_template (+38/-99)
Template/NLO/SubProcesses/check_poles.f (+1/-1)
Template/NLO/SubProcesses/combine_results.sh (+0/-55)
Template/NLO/SubProcesses/combine_results_FO.sh (+0/-52)
Template/NLO/SubProcesses/combine_root.sh (+1/-1)
Template/NLO/SubProcesses/driver_mintFO.f (+92/-116)
Template/NLO/SubProcesses/driver_mintMC.f (+29/-11)
Template/NLO/SubProcesses/fks_Sij.f (+13/-3)
Template/NLO/SubProcesses/fks_inc_chooser.f (+3/-1)
Template/NLO/SubProcesses/fks_singular.f (+103/-36)
Template/NLO/SubProcesses/genps_fks.f (+32/-15)
Template/NLO/SubProcesses/iproc_map.f (+25/-32)
Template/NLO/SubProcesses/leshouche_inc_chooser.f (+1/-1)
Template/NLO/SubProcesses/montecarlocounter.f (+3/-2)
Template/NLO/SubProcesses/setcuts.f (+0/-2)
Template/NLO/SubProcesses/setscales.f (+9/-3)
Template/NLO/SubProcesses/sumres.py (+0/-241)
Template/NLO/SubProcesses/symmetry_fks_test_ME.f (+1/-1)
Template/NLO/SubProcesses/symmetry_fks_v3.f (+4/-11)
Template/NLO/SubProcesses/write_ajob.f (+1/-1)
Template/loop_material/StandAlone/Cards/MadLoopParams.dat (+2/-2)
UpdateNotes.txt (+23/-1)
VERSION (+5/-0)
aloha/aloha_lib.py (+2/-2)
aloha/aloha_object.py (+2/-2)
aloha/aloha_writers.py (+1/-1)
aloha/create_aloha.py (+1/-1)
aloha/template_files/aloha_functions_loop.f (+7/-6)
aloha/template_files/wavefunctions.py (+3/-3)
bin/mg5 (+1/-1)
input/.mg5_configuration_default.txt (+3/-0)
madgraph/core/base_objects.py (+164/-88)
madgraph/core/diagram_generation.py (+3/-2)
madgraph/core/drawing.py (+3/-3)
madgraph/core/helas_objects.py (+1/-1)
madgraph/fks/fks_base.py (+13/-1)
madgraph/interface/amcatnlo_interface.py (+21/-6)
madgraph/interface/amcatnlo_run_interface.py (+894/-620)
madgraph/interface/common_run_interface.py (+71/-57)
madgraph/interface/extended_cmd.py (+34/-5)
madgraph/interface/launch_ext_program.py (+4/-3)
madgraph/interface/loop_interface.py (+13/-9)
madgraph/interface/madevent_interface.py (+58/-7)
madgraph/interface/madgraph_interface.py (+749/-133)
madgraph/interface/master_interface.py (+3/-2)
madgraph/interface/reweight_interface.py (+78/-48)
madgraph/iolibs/drawing_eps.py (+13/-13)
madgraph/iolibs/export_cpp.py (+92/-45)
madgraph/iolibs/export_fks.py (+14/-3)
madgraph/iolibs/export_v4.py (+130/-60)
madgraph/iolibs/import_v4.py (+2/-2)
madgraph/iolibs/template_files/check_sa.cpp (+1/-1)
madgraph/iolibs/template_files/loop/check_sa.inc (+1/-0)
madgraph/iolibs/template_files/loop/check_sa_loop_induced.inc (+1/-0)
madgraph/iolibs/template_files/matrix_standalone_splitOrders_v4.inc (+1/-1)
madgraph/iolibs/template_files/matrix_standalone_v4.inc (+1/-1)
madgraph/iolibs/template_files/parton_lum_n_fks.inc (+5/-1)
madgraph/iolibs/template_files/pythia8/pythia8.2_main_example_cc.inc (+63/-0)
madgraph/iolibs/template_files/pythia8/pythia8.2_main_makefile.inc (+36/-0)
madgraph/iolibs/template_files/pythia8/pythia8.2_makefile.inc (+104/-0)
madgraph/iolibs/template_files/pythia8/pythia8_main_example_cc.inc (+2/-2)
madgraph/iolibs/template_files/pythia8/pythia8_model_parameters_cc.inc (+1/-1)
madgraph/iolibs/template_files/pythia8/pythia8_model_parameters_h.inc (+3/-3)
madgraph/iolibs/template_files/pythia8/pythia8_process_h.inc (+1/-1)
madgraph/iolibs/template_files/pythia8/pythia8_process_hel_amp_h.inc (+1/-1)
madgraph/iolibs/template_files/super_auto_dsig_group_v4.inc (+7/-4)
madgraph/iolibs/ufo_expression_parsers.py (+55/-10)
madgraph/loop/loop_base_objects.py (+1/-1)
madgraph/loop/loop_diagram_generation.py (+58/-13)
madgraph/loop/loop_exporters.py (+2/-2)
madgraph/madevent/gen_crossxhtml.py (+3/-4)
madgraph/madevent/gen_ximprove.py (+16/-1)
madgraph/madevent/sum_html.py (+21/-18)
madgraph/madweight/create_param.py (+3/-3)
madgraph/madweight/diagram_class.py (+3/-3)
madgraph/madweight/verif_event.py (+122/-122)
madgraph/various/banner.py (+55/-35)
madgraph/various/cluster.py (+154/-155)
madgraph/various/histograms.py (+2/-2)
madgraph/various/lhe_parser.py (+149/-22)
madgraph/various/misc.py (+128/-11)
madgraph/various/process_checks.py (+2240/-98)
mg5decay/decay_objects.py (+22/-6)
models/check_param_card.py (+236/-14)
models/import_ufo.py (+64/-11)
models/loop_qcd_qed_sm/.restrict_parallel_test_MB.dat (+65/-0)
models/loop_qcd_qed_sm/CT_couplings.py (+2/-2)
models/loop_qcd_qed_sm/CT_parameters.py (+113/-106)
models/loop_qcd_qed_sm/function_library.py (+19/-5)
models/loop_qcd_qed_sm/object_library.py (+2/-41)
models/loop_qcd_qed_sm/parameters.py (+7/-0)
models/loop_qcd_qed_sm/particles.py (+3/-3)
models/loop_qcd_qed_sm/restrict_with_b_mass.dat (+65/-0)
models/loop_qcd_qed_sm/restrict_with_b_mass_no_widths.dat (+65/-0)
models/loop_qcd_qed_sm_Gmu/CT_couplings.py (+13/-13)
models/loop_qcd_qed_sm_Gmu/CT_parameters.py (+222/-76)
models/loop_qcd_qed_sm_Gmu/function_library.py (+19/-4)
models/loop_qcd_qed_sm_Gmu/object_library.py (+5/-5)
models/loop_qcd_qed_sm_Gmu/parameters.py (+8/-1)
models/loop_qcd_qed_sm_Gmu/particles.py (+3/-3)
models/loop_qcd_qed_sm_Gmu/restrict_ckm.dat (+2/-2)
models/loop_qcd_qed_sm_Gmu/restrict_default.dat (+4/-4)
models/loop_qcd_qed_sm_Gmu/restrict_no_widths.dat (+1/-1)
models/loop_qcd_qed_sm_Gmu__CMS__/.restrict_parallel_test.dat (+0/-65)
models/loop_qcd_qed_sm_Gmu__CMS__/.restrict_parallel_test_WW.dat (+0/-66)
models/loop_qcd_qed_sm_Gmu__CMS__/.restrict_parallel_test_WZ.dat (+0/-66)
models/loop_qcd_qed_sm_Gmu__CMS__/.restrict_parallel_test_ZZ.dat (+0/-66)
models/loop_qcd_qed_sm_Gmu__CMS__/CT_couplings.py (+0/-7213)
models/loop_qcd_qed_sm_Gmu__CMS__/CT_parameters.py (+0/-600)
models/loop_qcd_qed_sm_Gmu__CMS__/CT_vertices.py (+0/-4849)
models/loop_qcd_qed_sm_Gmu__CMS__/__init__.py (+0/-27)
models/loop_qcd_qed_sm_Gmu__CMS__/coupling_orders.py (+0/-16)
models/loop_qcd_qed_sm_Gmu__CMS__/couplings.py (+0/-539)
models/loop_qcd_qed_sm_Gmu__CMS__/function_library.py (+0/-81)
models/loop_qcd_qed_sm_Gmu__CMS__/lorentz.py (+0/-361)
models/loop_qcd_qed_sm_Gmu__CMS__/object_library.py (+0/-313)
models/loop_qcd_qed_sm_Gmu__CMS__/parameters.py (+0/-1211)
models/loop_qcd_qed_sm_Gmu__CMS__/particles.py (+0/-381)
models/loop_qcd_qed_sm_Gmu__CMS__/restrict_ckm.dat (+0/-65)
models/loop_qcd_qed_sm_Gmu__CMS__/restrict_default.dat (+0/-65)
models/loop_qcd_qed_sm_Gmu__CMS__/restrict_no_widths.dat (+0/-65)
models/loop_qcd_qed_sm_Gmu__CMS__/restrict_parallel_test.dat (+0/-65)
models/loop_qcd_qed_sm_Gmu__CMS__/restrict_parallel_test_WW.dat (+0/-66)
models/loop_qcd_qed_sm_Gmu__CMS__/restrict_parallel_test_WZ.dat (+0/-66)
models/loop_qcd_qed_sm_Gmu__CMS__/restrict_parallel_test_ZZ.dat (+0/-66)
models/loop_qcd_qed_sm_Gmu__CMS__/restrict_with_b_mass.dat (+0/-65)
models/loop_qcd_qed_sm_Gmu__CMS__/restrict_with_b_mass_no_width.dat (+0/-65)
models/loop_qcd_qed_sm_Gmu__CMS__/vertices.py (+0/-1037)
models/loop_qcd_qed_sm_Gmu__CMS__/write_param_card.py (+0/-181)
models/loop_qcd_qed_sm__CMS__/.restrict_parallel_test.dat (+0/-65)
models/loop_qcd_qed_sm__CMS__/.restrict_parallel_test_MB.dat (+0/-65)
models/loop_qcd_qed_sm__CMS__/CT_couplings.py (+0/-7213)
models/loop_qcd_qed_sm__CMS__/CT_parameters.py (+0/-600)
models/loop_qcd_qed_sm__CMS__/CT_vertices.py (+0/-4849)
models/loop_qcd_qed_sm__CMS__/__init__.py (+0/-27)
models/loop_qcd_qed_sm__CMS__/coupling_orders.py (+0/-16)
models/loop_qcd_qed_sm__CMS__/couplings.py (+0/-539)
models/loop_qcd_qed_sm__CMS__/function_library.py (+0/-81)
models/loop_qcd_qed_sm__CMS__/lorentz.py (+0/-361)
models/loop_qcd_qed_sm__CMS__/object_library.py (+0/-366)
models/loop_qcd_qed_sm__CMS__/parameters.py (+0/-1225)
models/loop_qcd_qed_sm__CMS__/particles.py (+0/-381)
models/loop_qcd_qed_sm__CMS__/restrict_ckm.dat (+0/-65)
models/loop_qcd_qed_sm__CMS__/restrict_default.dat (+0/-65)
models/loop_qcd_qed_sm__CMS__/restrict_no_widths.dat (+0/-65)
models/loop_qcd_qed_sm__CMS__/restrict_parallel_test.dat (+0/-65)
models/loop_qcd_qed_sm__CMS__/restrict_with_b_mass.dat (+0/-65)
models/loop_qcd_qed_sm__CMS__/restrict_with_b_mass_no_widths.dat (+0/-65)
models/loop_qcd_qed_sm__CMS__/vertices.py (+0/-1037)
models/loop_qcd_qed_sm__CMS__/write_param_card.py (+0/-181)
models/model_reader.py (+11/-5)
models/write_param_card.py (+2/-2)
tests/acceptance_tests/test_cmd.py (+2/-1)
tests/acceptance_tests/test_cmd_amcatnlo.py (+22/-12)
tests/acceptance_tests/test_cmd_madevent.py (+21/-5)
tests/acceptance_tests/test_cmd_madloop.py (+228/-24)
tests/acceptance_tests/test_madweight.py (+1/-0)
tests/input_files/IOTestsComparison/ExportV4IOTest/export_matrix_element_v4_standalone/matrix.f (+1/-1)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fks_loonly/%SubProcesses%P0_gg_ttx%parton_lum_0.f (+5/-1)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fks_loonly/%SubProcesses%P0_uux_ttx%parton_lum_0.f (+5/-1)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fks_loonly/%SubProcesses%P0_uxu_ttx%parton_lum_0.f (+5/-1)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_gg_ttx%parton_lum_1.f (+5/-1)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_gg_ttx%parton_lum_2.f (+5/-1)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_gg_ttx%parton_lum_3.f (+5/-1)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_gg_ttx%parton_lum_4.f (+5/-1)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_gg_ttx%parton_lum_5.f (+5/-1)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_uux_ttx%parton_lum_1.f (+5/-1)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_uux_ttx%parton_lum_2.f (+5/-1)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_uux_ttx%parton_lum_3.f (+5/-1)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_uxu_ttx%parton_lum_1.f (+5/-1)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_uxu_ttx%parton_lum_2.f (+5/-1)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_pptt_fksreal/%SubProcesses%P0_uxu_ttx%parton_lum_3.f (+5/-1)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_tdecay_fksreal/%SubProcesses%P0_t_budx%b_sf_001.f (+153/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_tdecay_fksreal/%SubProcesses%P0_t_budx%b_sf_002.f (+153/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_tdecay_fksreal/%SubProcesses%P0_t_budx%b_sf_003.f (+154/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_tdecay_fksreal/%SubProcesses%P0_t_budx%b_sf_004.f (+154/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_tdecay_fksreal/%SubProcesses%P0_t_budx%b_sf_005.f (+153/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_tdecay_fksreal/%SubProcesses%P0_t_budx%b_sf_006.f (+154/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_tdecay_fksreal/%SubProcesses%P0_t_budx%b_sf_007.f (+154/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_tdecay_fksreal/%SubProcesses%P0_t_budx%b_sf_008.f (+153/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_tdecay_fksreal/%SubProcesses%P0_t_budx%born.f (+298/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_tdecay_fksreal/%SubProcesses%P0_t_budx%born_conf.inc (+8/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_tdecay_fksreal/%SubProcesses%P0_t_budx%born_decayBW.inc (+2/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_tdecay_fksreal/%SubProcesses%P0_t_budx%born_hel.f (+151/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_tdecay_fksreal/%SubProcesses%P0_t_budx%born_leshouche.inc (+8/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_tdecay_fksreal/%SubProcesses%P0_t_budx%born_maxamps.inc (+3/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_tdecay_fksreal/%SubProcesses%P0_t_budx%born_ngraphs.inc (+2/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_tdecay_fksreal/%SubProcesses%P0_t_budx%born_nhel.inc (+3/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_tdecay_fksreal/%SubProcesses%P0_t_budx%born_props.inc (+6/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_tdecay_fksreal/%SubProcesses%P0_t_budx%coloramps.inc (+2/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_tdecay_fksreal/%SubProcesses%P0_t_budx%config_subproc_map.inc (+1/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_tdecay_fksreal/%SubProcesses%P0_t_budx%configs_and_props_decl.inc (+12/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_tdecay_fksreal/%SubProcesses%P0_t_budx%fks_info.inc (+46/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_tdecay_fksreal/%SubProcesses%P0_t_budx%get_color.f (+54/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_tdecay_fksreal/%SubProcesses%P0_t_budx%leshouche_decl.inc (+6/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_tdecay_fksreal/%SubProcesses%P0_t_budx%matrix_1.f (+194/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_tdecay_fksreal/%SubProcesses%P0_t_budx%nFKSconfigs.inc (+4/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_tdecay_fksreal/%SubProcesses%P0_t_budx%ncombs.inc (+2/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_tdecay_fksreal/%SubProcesses%P0_t_budx%nexternal.inc (+4/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_tdecay_fksreal/%SubProcesses%P0_t_budx%ngraphs.inc (+2/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_tdecay_fksreal/%SubProcesses%P0_t_budx%parton_lum_1.f (+98/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_tdecay_fksreal/%SubProcesses%P0_t_budx%parton_lum_chooser.f (+21/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_tdecay_fksreal/%SubProcesses%P0_t_budx%pmass.inc (+5/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_tdecay_fksreal/%SubProcesses%P0_t_budx%real_from_born_configs.inc (+5/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_tdecay_fksreal/%SubProcesses%P0_t_budx%real_me_chooser.f (+20/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_tdecay_fksreal/%SubProcesses%P0_t_budx%sborn_sf.f (+45/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_tdecay_fksreal/%SubProcesses%P0_t_budx%sborn_sf_dum.f (+13/-0)
tests/input_files/IOTestsComparison/IOExportV4IOTest/export_matrix_element_v4_madevent_group/super_auto_dsig.f (+11/-5)
tests/input_files/IOTestsComparison/IOExportV4IOTest/export_matrix_element_v4_standalone/matrix.f (+1/-1)
tests/input_files/IOTestsComparison/MadLoop_output_from_the_interface/TIR_output/%ggttx_IOTest%SubProcesses%MadLoopCommons.f (+3/-3)
tests/input_files/IOTestsComparison/MadLoop_output_from_the_interface/TIR_output/%ggttx_IOTest%SubProcesses%P0_gg_ttx%check_sa.f (+1/-0)
tests/input_files/IOTestsComparison/SquaredOrder_IOTest/sqso_uux_uuxuuxx/matrix_NoSQSO.f (+1/-1)
tests/input_files/IOTestsComparison/SquaredOrder_IOTest/sqso_uux_uuxuuxx/matrix_QCDsq_le_6.f (+1/-1)
tests/input_files/IOTestsComparison/SquaredOrder_IOTest/sqso_uux_uuxuuxx/matrix_ampOrderQED2_eq_2_WGTsq_le_14_QCDsq_gt_4.f (+1/-1)
tests/input_files/IOTestsComparison/TestCmdMatchBox/MatchBoxOutput/%TEST%SubProcesses%P1_uux_uux%check_sa.f (+1/-0)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/dux_mumvmxg/%..%..%Source%MODEL%model_functions.f (+41/-6)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/dux_mumvmxg/%..%..%Source%MODEL%model_functions.inc (+10/-0)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/dux_mumvmxg/born_matrix.f (+1/-1)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/dux_mumvmxg/check_sa.f (+1/-0)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/gg_wmtbx/%..%..%Source%MODEL%model_functions.f (+41/-6)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/gg_wmtbx/%..%..%Source%MODEL%model_functions.inc (+10/-0)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/gg_wmtbx/born_matrix.f (+1/-1)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/gg_wmtbx/check_sa.f (+1/-0)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/dux_mumvmxg/%..%..%Source%MODEL%model_functions.f (+41/-6)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/dux_mumvmxg/%..%..%Source%MODEL%model_functions.inc (+10/-0)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/dux_mumvmxg/born_matrix.f (+1/-1)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/dux_mumvmxg/check_sa.f (+1/-0)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/gg_wmtbx/%..%..%Source%MODEL%model_functions.f (+41/-6)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/gg_wmtbx/%..%..%Source%MODEL%model_functions.inc (+10/-0)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/gg_wmtbx/born_matrix.f (+1/-1)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/gg_wmtbx/check_sa.f (+1/-0)
tests/input_files/IOTestsComparison/short_ML_SMQCD_LoopInduced/gg_hh/%..%..%Source%MODEL%model_functions.f (+41/-6)
tests/input_files/IOTestsComparison/short_ML_SMQCD_LoopInduced/gg_hh/%..%..%Source%MODEL%model_functions.inc (+10/-0)
tests/input_files/IOTestsComparison/short_ML_SMQCD_LoopInduced/gg_hh/check_sa.f (+1/-0)
tests/input_files/IOTestsComparison/short_ML_SMQCD_default/ddx_ttx/born_matrix.f (+1/-1)
tests/input_files/IOTestsComparison/short_ML_SMQCD_default/ddx_ttx/check_sa.f (+1/-0)
tests/input_files/IOTestsComparison/short_ML_SMQCD_default/gg_ttx/%..%..%Source%MODEL%model_functions.f (+41/-6)
tests/input_files/IOTestsComparison/short_ML_SMQCD_default/gg_ttx/%..%..%Source%MODEL%model_functions.inc (+10/-0)
tests/input_files/IOTestsComparison/short_ML_SMQCD_default/gg_ttx/born_matrix.f (+1/-1)
tests/input_files/IOTestsComparison/short_ML_SMQCD_default/gg_ttx/check_sa.f (+1/-0)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/ddx_ttx/born_matrix.f (+1/-1)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/ddx_ttx/check_sa.f (+1/-0)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/gg_ttx/%..%..%Source%MODEL%model_functions.f (+41/-6)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/gg_ttx/%..%..%Source%MODEL%model_functions.inc (+10/-0)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/gg_ttx/born_matrix.f (+1/-1)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/gg_ttx/check_sa.f (+1/-0)
tests/input_files/LoopSMEWTest/CT_parameters.py (+3/-3)
tests/input_files/LoopSMEWTest/function_library.py (+2/-2)
tests/input_files/LoopSMEWTest/object_library.py (+27/-27)
tests/input_files/test_mssm_generation (+1/-0)
tests/parallel_tests/madevent_comparator.py (+1/-0)
tests/parallel_tests/me_comparator.py (+1/-0)
tests/parallel_tests/test_ML5EW.py (+112/-2)
tests/test_manager.py (+18/-4)
tests/time_db (+214/-211)
tests/unit_tests/core/test_base_objects.py (+13/-11)
tests/unit_tests/core/test_drawing.py (+5/-3)
tests/unit_tests/interface/test_cmd.py (+3/-0)
tests/unit_tests/interface/test_edit_card.py (+8/-2)
tests/unit_tests/iolibs/test_export_cpp.py (+2/-1)
tests/unit_tests/iolibs/test_export_fks.py (+4/-0)
tests/unit_tests/loop/test_import_LoopUFOModel.py (+10/-9)
tests/unit_tests/various/test_check_param_card.py (+47/-0)
tests/unit_tests/various/test_decay.py (+6/-6)
vendor/CutTools/src/avh/avh_olo.f90 (+1/-1)
vendor/SMWidth/param_card.dat (+0/-65)
vendor/SMWidth/param_card_Gmu.dat (+0/-65)
vendor/SMWidth/param_card_MZ.dat (+0/-65)
Text conflict in UpdateNotes.txt
Text conflict in VERSION
To merge this branch: bzr merge lp:~maddevelopers/mg5amcnlo/2.3.3
Reviewer Review Type Date Requested Status
Rikkert Frederix Approve
Review via email: mp+275027@code.launchpad.net

Description of the change

I think this is time to merge.
Any objection?

Olivier

To post a comment you must log in.
Revision history for this message
Rikkert Frederix (frederix) wrote :

Hi Olivier,

yeah, it's definitely time.
There seems to be many text conflicts, though. Strange...

Cheers,
Rik

lp:~maddevelopers/mg5amcnlo/2.3.3 updated
326. By Rikkert Frederix

only call the "set_mc_matrices" when actually including the
shower-subtraction terms.

327. By Hua-Sheng Shao

update the standalone files for IO test

328. By Olivier Mattelaer

merge with 2.3.2.2

329. By Rikkert Frederix

small fix for the applgrid stuff when running with [LOonly=QCD]

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

Hi Rik,

Indeed that was weird, looks like it was related to the 2.3.2.2 release.

I merged that branch inside this branch and everything seems fine now.
(will run all the test to be sure)

Cheers,

Olivier

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

Hi Olivier,

I'm okay with releasing this version.

Cheers,
Rik

review: Approve
lp:~maddevelopers/mg5amcnlo/2.3.3 updated
330. By marco zaro

fix for having LOonly running also with processes without colored particles

Revision history for this message
marco zaro (marco-zaro) wrote :

guys
sorry, i did a last minute push, which enables people to do LOonly also for processes without
any QCD colored particle (e.g. a a > e+ e-).
I hope this could be included in the releaseā€¦
Thanks!

Marco

On 21 Oct 2015, at 10:54, Rikkert Frederix <email address hidden> wrote:

> Review: Approve
>
> Hi Olivier,
>
> I'm okay with releasing this version.
>
> Cheers,
> Rik
>
> --
> https://code.launchpad.net/~maddevelopers/mg5amcnlo/2.3.3/+merge/275027
> Your team MadDevelopers is subscribed to branch lp:~maddevelopers/mg5amcnlo/2.3.3.

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

Hi Marco,

I just checked your last push and I think it is all okay.

Cheers,
Rik

lp:~maddevelopers/mg5amcnlo/2.3.3 updated
331. By Olivier Mattelaer

allow some basic notification in the apple notification center

332. By Rikkert Frederix

fix for event reweighting in the case of lepton-lepton collisions (NLO processes)

333. By Olivier Mattelaer

improve compatibility with SysCalc/Delphes

334. By Rikkert Frederix

small trivial fix for the ApplGrid stuff

335. By Olivier Mattelaer

forbid test to use notification center + put notification at the end of the test + fix the scan from ./bin/generate_events

336. By Olivier Mattelaer

provent notification in parralel test+ fix a bug with some mac compiler

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'MadSpin/__init__.py' (properties changed: -x to +x)
2=== modified file 'MadSpin/decay.py'
3--- MadSpin/decay.py 2015-08-20 10:00:00 +0000
4+++ MadSpin/decay.py 2015-10-25 15:32:18 +0000
5@@ -906,7 +906,7 @@
6 if init[0] in self.banner.param_card['decay'].decay_table:
7 br *= self.banner.param_card['decay'].decay_table[init[0]].get(lhaid).value
8 br *= self.get_br(decay)
9- else:
10+ elif -init[0] in self.banner.param_card['decay'].decay_table:
11 init = -init[0]
12 lhaid=[x if self.model.get_particle(x)['self_antipart'] else -x
13 for x in final]
14@@ -914,6 +914,13 @@
15 lhaid = tuple([len(final)] + lhaid)
16 br *= self.banner.param_card['decay'].decay_table[init].get(lhaid).value
17 br *= self.get_br(decay)
18+ elif init[0] not in self.decay_ids and -init[0] not in self.decay_ids:
19+ logger.warning("No Branching ratio applied for %s. Please check if this is expected" % init[0])
20+ br *= self.get_br(decay)
21+ else:
22+ raise MadGraph5Error,"No valid decay for %s. No 2 body decay for that particle. (three body are not supported by MadSpin)" % init[0]
23+
24+
25
26 for decays in ids.values():
27 if len(decays) == 1:
28@@ -929,7 +936,7 @@
29 except ValueError:
30 break
31 br /= math.factorial(nb)
32-
33+
34 return br
35
36
37@@ -1013,7 +1020,7 @@
38 self[tag]['decaying'] = tuple(decaying)
39
40 # sanity check
41- assert self[tag]['total_br'] <= 1.01, self[tag]['total_br']
42+ assert self[tag]['total_br'] <= 1.01, "wrong BR for %s: %s " % (tag,self[tag]['total_br'])
43
44
45
46
47=== modified file 'MadSpin/interface_madspin.py' (properties changed: -x to +x)
48--- MadSpin/interface_madspin.py 2015-08-04 14:28:22 +0000
49+++ MadSpin/interface_madspin.py 2015-10-25 15:32:18 +0000
50@@ -34,6 +34,7 @@
51 import madgraph.interface.master_interface as master_interface
52 import madgraph.various.misc as misc
53 import madgraph.iolibs.files as files
54+import madgraph.iolibs.export_v4 as export_v4
55 import madgraph.various.banner as banner
56 import madgraph.various.lhe_parser as lhe_parser
57
58@@ -229,15 +230,24 @@
59 args.remove('--bypass_check')
60 bypass_check = True
61
62- if len(args) != 2:
63+ if len(args) == 1:
64+ logger.warning("""No param_card defined for the new model. We will use the default one but this might completely wrong.""")
65+ elif len(args) != 2:
66 return self.InvalidCmd, 'import model requires two arguments'
67
68 model_name = args[0]
69- card = args[1]
70- if not os.path.exists(card):
71- raise self.InvalidCmd('%s: no such file' % card)
72-
73 self.load_model(model_name, False, False)
74+
75+ if len(args) == 2:
76+ card = args[1]
77+ if not os.path.exists(card):
78+ raise self.InvalidCmd('%s: no such file' % card)
79+ else:
80+ card = "madspin_param_card.dat"
81+ export_v4.UFO_model_to_mg4.create_param_card_static(self.model,
82+ card, rule_card_path=None)
83+
84+
85
86 #Check the param_card
87 if not bypass_check:
88@@ -255,11 +265,15 @@
89 if diff:
90 raise self.InvalidCmd('''Original param_card differs on some parameters:
91 %s
92- Due to those preferences, we prefer not to proceed. If you are sure about what you are doing,
93+ Due to those differences, we prefer not to proceed. If you are sure about what you are doing,
94 you can use the command \'import model MODELNAME PARAM_CARD_PATH --bypass_check\''''
95 % diff.replace('\n','\n '))
96+
97+
98
99- #OK load the new param_card
100+ #OK load the new param_card (but back up the old one)
101+ if 'slha' in self.banner:
102+ self.banner['slha_original'] = self.banner['slha']
103 self.banner['slha'] = open(card).read()
104 if hasattr(self.banner, 'param_card'):
105 del self.banner.param_card
106@@ -749,7 +763,7 @@
107 # 2. Generate the events requested
108 with misc.MuteLogger(["madgraph", "madevent", "ALOHA", "cmdprint"], [50,50,50,50]):
109 mg5 = self.mg5cmd
110- modelpath = self.model.get('modelpath')
111+ modelpath = self.model.get('modelpath+restriction')
112 mg5.exec_cmd("import model %s" % modelpath)
113 to_event = {}
114 for pdg, nb_needed in to_decay.items():
115@@ -923,12 +937,11 @@
116 #base_model = import_ufo.import_model(model_path)
117
118 # Import model
119- base_model = import_ufo.import_model(name, decay=True)
120+ base_model = import_ufo.import_model(name, decay=True,
121+ complex_mass_scheme=complex_mass)
122
123 if use_mg_default:
124 base_model.pass_particles_name_in_mg_default()
125- if complex_mass:
126- base_model.change_mass_to_complex_scheme()
127
128 self.model = base_model
129 self.mg5cmd._curr_model = self.model
130
131=== modified file 'Template/LO/Source/dsample.f'
132--- Template/LO/Source/dsample.f 2015-06-08 16:01:11 +0000
133+++ Template/LO/Source/dsample.f 2015-10-25 15:32:18 +0000
134@@ -1608,7 +1608,7 @@
135 if (iteration .eq. cur_it) then
136 c Add the current point to the DiscreteSamplerGrid
137 call add_entry_to_discrete_dimensions(wgt)
138- if (kn.eq.0) then
139+ if (kn.eq.0.and.(iteration.eq.1.or.use_cut.eq.-2)) then
140 ! ensure that all cumulative variable are at zero (usefull for reset)
141 twgt1 = 0d0 !
142 iavg = 0 !Vars for averging to increase err estimate
143@@ -2156,7 +2156,7 @@
144 c $ access='append',err=129)
145 c write(22, 80) real(tmean), real(tsigma), real(chi2)
146 c 129 close(22)
147- tsigma = tsigma*sqrt(chi2) !This gives the 68% confidence cross section
148+ tsigma = tsigma*sqrt(max(0d0,chi2)) !This gives the 68% confidence cross section
149 cur_it = itm+20
150 return
151 endif
152
153=== modified file 'Template/LO/Source/kin_functions.f'
154--- Template/LO/Source/kin_functions.f 2014-09-11 15:22:26 +0000
155+++ Template/LO/Source/kin_functions.f 2015-10-25 15:32:18 +0000
156@@ -127,7 +127,11 @@
157 c pm=dsqrt(p(1)**2+p(2)**2+p(3)**2)
158
159 pm = p(0)
160- rap = .5d0*dlog((pm+p(3))/(pm-p(3)))+cm_rap
161+ if (pm.gt.p(3)) then
162+ rap = .5d0*dlog((pm+p(3))/(pm-p(3)))+cm_rap
163+ else
164+ rap = -1d99
165+ endif
166 end
167 DOUBLE PRECISION FUNCTION rap2(p)
168 c************************************************************************
169
170=== modified file 'Template/LO/bin/generate_events'
171--- Template/LO/bin/generate_events 2013-11-14 21:10:30 +0000
172+++ Template/LO/bin/generate_events 2015-10-25 15:32:18 +0000
173@@ -149,13 +149,13 @@
174 argument = sys.argv
175 try:
176 if '-h' in argument or '--help' in argument:
177- launch = ME.MadEventCmd(me_dir=root_path)
178+ launch = ME.MadEventCmdShell(me_dir=root_path)
179 launch.exec_cmd('help generate_events')
180 sys.exit()
181 elif len(argument) > 1 and argument[1] in ['0', '1', '2']:
182 argument = treat_old_argument(argument)
183
184- launch = ME.MadEventCmd(me_dir=root_path)
185+ launch = ME.MadEventCmdShell(me_dir=root_path)
186 launch.run_cmd('generate_events %s' % ' '.join(argument[1:]))
187 launch.run_cmd('quit')
188 except KeyboardInterrupt:
189
190=== modified file 'Template/LO/bin/internal/Gridpack/compile'
191--- Template/LO/bin/internal/Gridpack/compile 2013-11-13 02:21:10 +0000
192+++ Template/LO/bin/internal/Gridpack/compile 2015-10-25 15:32:18 +0000
193@@ -37,8 +37,8 @@
194 fi
195
196 # Check for LHAPDF
197-c=`awk '/^[^#].*=.*pdlabel/{print $1}' Cards/run_card.dat`
198-if [[ $c == "'lhapdf'" ]]; then
199+c=`awk '/^[^#].*=[^#!]*pdlabel/{print $1}' Cards/run_card.dat`
200+if [[ $c == "'lhapdf'" || $c == "lhapdf" ]]; then
201 echo Using LHAPDF interface!
202 export lhapdf=true
203 else
204
205=== renamed file 'Template/LO/bin/internal/addmasses.py' => 'Template/LO/bin/internal/addmasses_optional.py'
206=== modified file 'Template/LO/bin/internal/create_matching_plots.C'
207--- Template/LO/bin/internal/create_matching_plots.C 2011-06-29 14:15:21 +0000
208+++ Template/LO/bin/internal/create_matching_plots.C 2015-10-25 15:32:18 +0000
209@@ -1,4 +1,14 @@
210 {
211+ const char* file="pythia.root";
212+ TFile *f = new TFile(file,"RECREATE");
213+ TTree *events = new TTree("events","Events");
214+ Long64_t nlines1 = events->ReadFile("events.tree","Npart:DJR1:DJR2:DJR3:DJR4:PTISR:PTFSR:PT2MX:NCJET:IFILE");
215+ cout << "Found "<< nlines1 << " events"<<endl;
216+ TTree *xsecs = new TTree("xsecs","Xsecs");
217+ Long64_t nlines2 = xsecs->ReadFile("xsecs.tree","Xsecfact");
218+ cout << "Found "<< nlines2 << " files"<<endl;
219+ f->Write();
220+
221 gROOT->ProcessLine(".x ../bin/internal/plot_tree.C(\"DJR1\")");
222 gROOT->ProcessLine(".x ../bin/internal/plot_tree.C(\"DJR2\")");
223 gROOT->ProcessLine(".x ../bin/internal/plot_tree.C(\"DJR3\")");
224
225=== modified file 'Template/LO/bin/internal/create_matching_plots.sh'
226--- Template/LO/bin/internal/create_matching_plots.sh 2012-07-20 06:20:21 +0000
227+++ Template/LO/bin/internal/create_matching_plots.sh 2015-10-25 15:32:18 +0000
228@@ -24,9 +24,7 @@
229 exit
230 fi
231
232-echo Running root
233-root -q -b -l ../bin/internal/read_tree_files.C &> /dev/null
234-echo Creating plots
235+echo Creating matching plots
236 root -q -b -l ../bin/internal/create_matching_plots.C &> /dev/null
237 mv pythia.root $1/$2_pythia.root
238
239
240=== modified file 'Template/LO/bin/internal/plot_tree.C'
241--- Template/LO/bin/internal/plot_tree.C 2014-09-24 19:41:18 +0000
242+++ Template/LO/bin/internal/plot_tree.C 2015-10-25 15:32:18 +0000
243@@ -1,7 +1,11 @@
244 #include <string>
245
246-bool plot_tree(char* quantity,char* plotdim="(100,0.,3.)",bool log=true)
247+bool plot_tree(const char* quantity, const char* plotdim = 0, bool log = true)
248 {
249+ const char* plotdim_default = "(100,0.,3.)";
250+ if(plotdim == 0){
251+ plotdim = plotdim_default;
252+ }
253 char tmp1[250];
254 char tmp2[300];
255 char tmp3[100];
256
257=== removed file 'Template/LO/bin/internal/read_tree_files.C'
258--- Template/LO/bin/internal/read_tree_files.C 2011-06-29 14:15:21 +0000
259+++ Template/LO/bin/internal/read_tree_files.C 1970-01-01 00:00:00 +0000
260@@ -1,12 +0,0 @@
261-{
262- char* file="pythia.root";
263- TFile *f = new TFile(file,"RECREATE");
264- TTree *events = new TTree("events","Events");
265- Long64_t nlines1 = events->ReadFile("events.tree","Npart:DJR1:DJR2:DJR3:DJR4:PTISR:PTFSR:PT2MX:NCJET:IFILE");
266- cout << "Found "<< nlines1 << " events"<<endl;
267- TTree *xsecs = new TTree("xsecs","Xsecs");
268- Long64_t nlines2 = xsecs->ReadFile("xsecs.tree","Xsecfact");
269- cout << "Found "<< nlines2 << " files"<<endl;
270-
271- f->Write();
272-}
273
274=== modified file 'Template/MadWeight/Python/Info.py'
275--- Template/MadWeight/Python/Info.py 2011-10-25 14:42:02 +0000
276+++ Template/MadWeight/Python/Info.py 2015-10-25 15:32:18 +0000
277@@ -1,11 +1,11 @@
278 #!/usr/bin/env python
279
280 def giveInfo(class_):
281- if type(class_)!=str:
282- class_=class_.__class__.__name__
283- for info in dir(eval(class_)):
284-
285- print class_+'.'+info+' : ',eval(class_+'.'+info+'.__doc__')
286+ if type(class_)!=str:
287+ class_=class_.__class__.__name__
288+ for info in dir(eval(class_)):
289+
290+ print class_+'.'+info+' : ',eval(class_+'.'+info+'.__doc__')
291
292
293
294
295=== modified file 'Template/MadWeight/Python/clean.py'
296--- Template/MadWeight/Python/clean.py 2011-10-25 14:42:02 +0000
297+++ Template/MadWeight/Python/clean.py 2015-10-25 15:32:18 +0000
298@@ -70,7 +70,7 @@
299 ls=os.listdir('.')
300 for element in ls:
301 if os.path.isdir(element) and element[0]=='P':
302- status,mess=clean.suppress_dir(os.path.join(element,run_name))
303+ status,mess=clean.suppress_dir(os.path.join(element,run_name))
304 #if not status:
305 # print 'supress ',element,' failed:'
306 # print mess
307@@ -93,7 +93,7 @@
308 ls=os.listdir('.')
309 for element in ls:
310 if os.path.isdir(element) and len(element)>4 and element[:4]=='MW_P':
311- status,mess=clean.suppress_dir(os.path.join(element,run_name))
312+ status,mess=clean.suppress_dir(os.path.join(element,run_name))
313 #if not status:
314 # print 'supress ',element,' failed:'
315 # print mess
316
317=== modified file 'Template/NLO/Cards/run_card.dat'
318--- Template/NLO/Cards/run_card.dat 2015-07-30 15:57:44 +0000
319+++ Template/NLO/Cards/run_card.dat 2015-10-25 15:32:18 +0000
320@@ -66,6 +66,8 @@
321 # WARNING: PYTHIA6PT works only for processes without FSR!!!! *
322 #***********************************************************************
323 %(parton_shower)s = parton_shower
324+ %(shower_scale_factor)s = shower_scale_factor ! multiply default shower starting
325+ ! scale by this factor
326 #***********************************************************************
327 # Renormalization and factorization scales *
328 # (Default functional form for the non-fixed scales is the sum of *
329
330=== modified file 'Template/NLO/Cards/shower_card.dat'
331--- Template/NLO/Cards/shower_card.dat 2015-03-09 17:19:46 +0000
332+++ Template/NLO/Cards/shower_card.dat 2015-10-25 15:32:18 +0000
333@@ -85,15 +85,15 @@
334 # *
335 # Examples of syntax: *
336 # Z -> e+ e- or mu+ mu- with BR = 0.5 each *
337-# DM_1 = 23 > -11 11 @ 0.5d0 @ 100 *
338-# DM_2 = 23 > -13 13 @ 0.5d0 @ 100 *
339+# DM_1 = 23 > -11 11 @ 0.5d0 @ 100
340+# DM_2 = 23 > -13 13 @ 0.5d0 @ 100
341 # H -> tau+ tau- with BR = 1 *
342-# DM_3 = 25 > -15 15 @ 1.0d0 @ 0 *
343+# DM_3 = 25 > -15 15 @ 1.0d0 @ 0
344 # t -> nu_e e+ b with BR = 1 (HERWIG) *
345-# DM_4 = 6 > 12 -11 5 @ 1d0 @ 100 *
346+# DM_4 = 6 > 12 -11 5 @ 1d0 @ 100
347 # t -> nu_e e+ b with BR = 1 (PYTHIA) *
348-# DM_5 = 6 > 24 5 @ 1d0 @ 100 *
349-# DM_6 = 24 > 12 -11 @ 1d0 @ 100 *
350+# DM_5 = 6 > 24 5 @ 1d0 @ 100
351+# DM_6 = 24 > 12 -11 @ 1d0 @ 100
352 #***********************************************************************
353 # Extra Libraries/analyses *
354 # The following lines need to be changed if the user does not want to *
355
356=== modified file 'Template/NLO/MCatNLO/Scripts/MCatNLO_MadFKS_PYTHIA8.Script'
357--- Template/NLO/MCatNLO/Scripts/MCatNLO_MadFKS_PYTHIA8.Script 2015-04-24 09:57:53 +0000
358+++ Template/NLO/MCatNLO/Scripts/MCatNLO_MadFKS_PYTHIA8.Script 2015-10-25 15:32:18 +0000
359@@ -517,6 +517,7 @@
360 TimeShower:MEafterFirst = off ! No Matrix-element corrections after first emission
361 TimeShower:phiPolAsym = on ! Azimuthal asymmetry induced by gluon polarization
362 TimeShower:alphaSuseCMW = false ! Use the CMW prescription in FSR
363+TimeShower:weightGluonToQuark = 1 ! Use normal Altarelli-Parisi kernels for g -> q qbar
364
365 ! 6) Initial-state shower.
366 SpaceShower:pTmaxMatch = 1 ! Use scalup (re-check)
367
368=== modified file 'Template/NLO/Source/PDF/pdg2pdf.f'
369--- Template/NLO/Source/PDF/pdg2pdf.f 2015-08-07 08:57:55 +0000
370+++ Template/NLO/Source/PDF/pdg2pdf.f 2015-10-25 15:32:18 +0000
371@@ -47,7 +47,11 @@
372 data pdlabellast/20*'abcdefg'/
373 data ihlast/20*-99/
374 data i_replace/20/
375-
376+ if (ih.eq.0) then
377+c Lepton collisions (no PDF).
378+ pdg2pdf=1d0
379+ return
380+ endif
381 c Make sure we have a reasonable Bjorken x. Note that even though
382 c x=0 is not reasonable, we prefer to simply return pdg2pdf=0
383 c instead of stopping the code, as this might accidentally happen.
384
385=== modified file 'Template/NLO/Source/PDF/pdg2pdf_lhapdf.f'
386--- Template/NLO/Source/PDF/pdg2pdf_lhapdf.f 2014-12-19 08:08:03 +0000
387+++ Template/NLO/Source/PDF/pdg2pdf_lhapdf.f 2015-10-25 15:32:18 +0000
388@@ -45,6 +45,12 @@
389 data imemlast/20*-99/
390 data i_replace/20/
391
392+ if (ih.eq.0) then
393+c Lepton collisions (no PDF).
394+ pdg2pdf=1d0
395+ return
396+ endif
397+
398 c Make sure we have a reasonable Bjorken x. Note that even though
399 c x=0 is not reasonable, we prefer to simply return pdg2pdf=0
400 c instead of stopping the code, as this might accidentally happen.
401
402=== modified file 'Template/NLO/Source/run.inc'
403--- Template/NLO/Source/run.inc 2015-04-02 22:56:24 +0000
404+++ Template/NLO/Source/run.inc 2015-10-25 15:32:18 +0000
405@@ -39,6 +39,9 @@
406 common/cscales_current_values/muR2_current,muF12_current,
407 # muF22_current,QES2_current
408
409+c Re-scale of the shower starting scale
410+ double precision shower_scale_factor
411+ common/cshower_scale_factor/shower_scale_factor
412 c
413 c Collider
414 c
415
416=== modified file 'Template/NLO/Source/run_config.inc'
417--- Template/NLO/Source/run_config.inc 2012-08-28 21:06:34 +0000
418+++ Template/NLO/Source/run_config.inc 2015-10-25 15:32:18 +0000
419@@ -34,7 +34,7 @@
420 parameter (PBS_QUE = 'madgraph')
421
422 integer ChanPerJob
423- parameter (ChanPerJob=1) !Number of channels / job for survey
424+ parameter (ChanPerJob=100000000) !Number of channels / job for survey
425
426 c integer max_np
427 c parameter (max_np=1) !Number of channels / job for refine
428
429=== modified file 'Template/NLO/SubProcesses/ajob_template'
430--- Template/NLO/SubProcesses/ajob_template 2015-03-18 14:50:37 +0000
431+++ Template/NLO/SubProcesses/ajob_template 2015-10-25 15:32:18 +0000
432@@ -26,57 +26,38 @@
433 exit
434 fi
435
436+channel=$1
437+run_mode=$2
438+runnumber=$3
439+integration_step=$4
440+
441 TAGTAGTAGTAGTAGTAGTAG for i in 1 ; do
442
443- runnumber=0
444- if [[ $1 == '0' ]]; then
445- j=$2\_G$i
446- if [[ ! -e $j ]]; then
447- mkdir $j
448- fi
449- cd $j
450- if [[ "$4" != "" ]]; then
451- if [[ -e ../$4\_G$i ]]; then
452- if [[ $1 == '0' ]]; then
453- cp -f ../$4\_G$i/mint_grids . >/dev/null 2>&1
454- cp -f ../$4\_G$i/grid.MC_integer . >/dev/null 2>&1
455- elif [[ $1 == '1' ]]; then
456- cp -f ../$4\_G$i/mint_grids . >/dev/null 2>&1
457- cp -f ../$4\_G$i/grid.MC_integer . >/dev/null 2>&1
458- fi
459- else
460- echo "Cannot find directory ../$4\_G$i/" > log.txt
461- exit
462- fi
463- fi
464- elif [[ $1 == '2' ]]; then
465- j=G$2$i
466- if [[ ! -e $j ]]; then
467- mkdir $j
468- fi
469-
470- cd $j
471- if [[ "$4" != "" ]]; then
472- if [[ "$4" == "H" ||"$4" == "S" || "$4" == "V" || "$4" == "B" || "$4" == "F" ]]; then
473- if [[ -e ../G$4$i ]]; then
474- cp -f ../G$4$i/mint_grids ./preset_mint_grids >/dev/null 2>&1
475- cp -f ../G$4$i/grid.MC_integer . >/dev/null 2>&1
476- else
477- echo "Cannot find direcotry ../G$4$i/" > log.txt
478- exit
479- fi
480- else
481- runnumber=$4
482- if [[ ! -e ../${j}_$4 ]]; then
483- mkdir ../${j}_$4
484- fi
485- cd ../${j}_$4
486- ln -sf ../${j}/mint_grids
487- ln -sf ../${j}/mint_grids_NLO
488- ln -sf ../${j}/grid.MC_integer
489- ln -sf ../${j}/res_1
490- fi
491- fi
492+ if [[ $run_mode == 'all' || $run_mode == 'born' ]] ; then
493+ j=$run_mode\_G$i
494+ else
495+ if [[ $runnumber == '0' ]] ; then
496+ j=G$run_mode$i
497+ else
498+ j=G$run_mode$i\_$runnumber
499+ fi
500+ fi
501+ cd $j
502+
503+ if [[ -e res.dat ]] ; then
504+ rm -f res.dat
505+ fi
506+ if [[ -e log.txt ]] ; then
507+ rm -f log.txt
508+ fi
509+ if [[ -e MADatNLO.top ]] ; then
510+ rm -f MADatNLO.top
511+ fi
512+ if [[ -e MADatNLO.HwU ]] ; then
513+ rm -f MADatNLO.HwU
514+ fi
515+ if [[ -e MADatNLO.root ]] ; then
516+ rm -f MADatNLO.root
517 fi
518 if [[ -e randinit ]] ; then
519 rm -f randinit
520@@ -97,67 +78,25 @@
521 link1up FKS_params.dat
522 link1up configs_and_props_info.dat
523 link1up leshouche_info.dat
524-# Not necessary anymore
525-# link1up MadLoop5_resources
526 link1up OLE_order.olc
527 link1up param_card.dat
528 link1up initial_states_map.dat
529
530-# check where is the basic file for the creation of input_app.txt
531-#
532- if [[ $1 == '0' ]]; then
533- if [[ $3 == '-1' && -e ./madinM1 ]] ; then
534- input_template=./madinM1
535- else
536- if [[ -e ../madin.$2 ]] ; then
537- input_template=../madin.$2
538- else
539- input_template=../../madin.$2
540- fi
541- fi
542- elif [[ $1 == '2' ]]; then
543- if [[ $3 == '0' || $3 == '2' ]]; then
544- if [[ -e ../madinMMC_$2.2 ]] ; then
545- input_template=../madinMMC_$2.2
546- else
547- input_template=../../madinMMC_$2.2
548- fi
549- else
550- input_template=./madinM1
551- fi
552- fi
553
554- if [[ $1 == '0' ]]; then
555- head -n 5 $input_template >& input_app.txt
556- echo $i >> input_app.txt
557- tail -n 4 $input_template >> input_app.txt
558- T="$(date +%s)"
559+ T="$(date +%s)"
560+ if [[ $run_mode == 'all' || $run_mode == 'born' ]]; then
561 ../madevent_mintFO > log.txt <input_app.txt 2>&1
562- status=$?
563- T="$(($(date +%s)-T))"
564- echo "Time in seconds: ${T}" >>log.txt
565- elif [[ $1 == '2' ]]; then
566+ else
567 if [[ $runnumber != 0 ]]; then
568- tar --extract --file=../nevents.tar nevts_${j}_$runnumber
569- mv nevts_${j}_$runnumber nevts
570 echo "$runnumber" >& moffset.dat
571 fi
572- if [[ $3 == '0' || $3 == '2' ]]; then
573- head -n 6 $input_template > input_app.txt
574- echo $i >> input_app.txt
575- tail -n 3 $input_template >> input_app.txt
576- elif [[ $3 == '1' ]]; then
577- head -n 6 $input_template > input_app.txt
578- echo $i >> input_app.txt
579- tail -n 3 $input_template >> input_app.txt
580- fi
581- T="$(date +%s)"
582 ../madevent_mintMC > log.txt <input_app.txt 2>&1
583- status=$?
584- T="$(($(date +%s)-T))"
585- echo "Time in seconds: ${T}" >>log.txt
586- cp -f log.txt log_MINT$3.txt >/dev/null 2>&1
587 fi
588+ status=$?
589+ T="$(($(date +%s)-T))"
590+ echo "Time in seconds: ${T}" >>log.txt
591+ cp -f log.txt log_MINT$integration_step.txt >/dev/null 2>&1
592+ cp -f res.dat res_$integration_step.dat >/dev/null 2>&1
593 exit $status
594 done
595
596
597=== modified file 'Template/NLO/SubProcesses/check_poles.f'
598--- Template/NLO/SubProcesses/check_poles.f 2014-11-03 10:50:20 +0000
599+++ Template/NLO/SubProcesses/check_poles.f 2015-10-25 15:32:18 +0000
600@@ -108,7 +108,7 @@
601 enddo
602 call fks_inc_chooser()
603 call leshouche_inc_chooser()
604- call setfksfactor(1)
605+ call setfksfactor(1,.false.)
606
607 nfail = 0
608 npointsChecked = 0
609
610=== removed file 'Template/NLO/SubProcesses/combine_results.sh'
611--- Template/NLO/SubProcesses/combine_results.sh 2013-06-28 13:57:17 +0000
612+++ Template/NLO/SubProcesses/combine_results.sh 1970-01-01 00:00:00 +0000
613@@ -1,55 +0,0 @@
614-#!/bin/bash
615-
616-# find the correct directory
617-if [[ ! -d ./SubProcesses ]]; then
618- cd ../
619-fi
620-if [[ -d ./SubProcesses ]]; then
621- cd SubProcesses
622-fi
623-
624-if [[ -e res.txt ]]; then
625- rm -f res.txt
626-fi
627-if [[ -e dirs.txt ]]; then
628- rm -f dirs.txt
629-fi
630-if [[ -e nevents_unweighted ]]; then
631- rm -f nevents_unweighted
632-fi
633-
634-arg1=$1
635-arg2=$2
636-arg3=$3
637-# shift the list of arguments by 3
638-shift
639-shift
640-shift
641-if [[ "$@" == "" ]]; then
642- echo "Please give the G directories that should be combined,"
643- echo "e.g. 'GF* GV*', as final arguments of this script"
644- exit
645-fi
646-
647-touch res.txt
648-touch dirs.txt
649-NTOT=0
650-for dir in "$@" ; do
651- N=`ls -d P*/$dir | wc -l`
652- NTOT=`expr $NTOT + $N`
653- ls -d P*/$dir >> dirs.txt
654- grep -H 'Final result' P*/$dir/res_$arg1 >> res.txt
655-done
656-echo N of directories: $NTOT
657-if [[ $arg1 == '0' ]] ; then
658- echo 'Determining the number of unweighted events per channel'
659-elif [[ $arg1 == '1' ]] ; then
660- echo 'Updating the number of unweighted events per channel'
661-fi
662-./sumres.py $NTOT $arg2 $arg3
663-
664-echo 'Integrated abs(cross-section)'
665-tail -n2 res.txt | head -n1
666-echo 'Integrated cross-section'
667-tail -n1 res.txt
668-mv res.txt res_$arg1.txt
669
670=== removed file 'Template/NLO/SubProcesses/combine_results_FO.sh'
671--- Template/NLO/SubProcesses/combine_results_FO.sh 2013-06-28 13:57:17 +0000
672+++ Template/NLO/SubProcesses/combine_results_FO.sh 1970-01-01 00:00:00 +0000
673@@ -1,52 +0,0 @@
674-#!/bin/bash
675-
676-# find the correct directory
677-if [[ ! -d ./SubProcesses ]]; then
678- cd ../
679-fi
680-if [[ -d ./SubProcesses ]]; then
681- cd SubProcesses
682-fi
683-
684-if [[ $1 == "0" ]] ; then
685- mint_mode=0
686- shift
687-elif [[ $1 == "1" ]] ; then
688- mint_mode=1
689- shift
690-elif [[ $1 == "2" ]] ; then
691- echo "Cannot combine results for mint_mode 2"
692- exit
693-else
694- mint_mode=0
695-fi
696-
697-if [[ -e res.txt ]]; then
698- rm -f res.txt
699-fi
700-if [[ -e dirs.txt ]]; then
701- rm -f dirs.txt
702-fi
703-
704-req_acc=$1
705-shift
706-
707-touch res.txt
708-touch dirs.txt
709-NTOT=0
710-for dir in "$@" ; do
711- N=`ls -d P*/$dir | wc -l`
712- NTOT=`expr $NTOT + $N`
713- ls -d P*/$dir >> dirs.txt
714- grep -H 'Final result' P*/$dir/res_$mint_mode >> res.txt
715-done
716-
717-sed -i.bak s/"\+\/\-"/" \+\/\-"/ res.txt
718-
719-echo N of directories: $NTOT
720-
721-./sumres.py $NTOT -1 $req_acc
722-
723-rm -r res.txt.bak
724-
725-tail -n1 res.txt
726
727=== modified file 'Template/NLO/SubProcesses/combine_root.sh'
728--- Template/NLO/SubProcesses/combine_root.sh 2013-12-09 10:15:28 +0000
729+++ Template/NLO/SubProcesses/combine_root.sh 2015-10-25 15:32:18 +0000
730@@ -65,7 +65,7 @@
731 echo ".x combine_root.C" >> rootinput.txt
732 echo ".q" >> rootinput.txt
733
734-root < rootinput.txt
735+root -b < rootinput.txt
736
737 rm -f rootinput.txt
738 }
739
740=== modified file 'Template/NLO/SubProcesses/driver_mintFO.f'
741--- Template/NLO/SubProcesses/driver_mintFO.f 2015-03-09 18:27:17 +0000
742+++ Template/NLO/SubProcesses/driver_mintFO.f 2015-10-25 15:32:18 +0000
743@@ -18,7 +18,6 @@
744 C LOCAL
745 C
746 integer i,j,l,l1,l2,ndim
747- integer npoints
748 character*130 buf
749 c
750 c Global
751@@ -171,7 +170,7 @@
752 else
753 flat_grid=.false.
754 endif
755- ndim = 3*(nexternal-2)-4
756+ ndim = 3*(nexternal-nincoming)-4
757 if (abs(lpp(1)) .ge. 1) ndim=ndim+1
758 if (abs(lpp(2)) .ge. 1) ndim=ndim+1
759 c Don't proceed if muF1#muF2 (we need to work out the relevant formulae
760@@ -219,23 +218,7 @@
761 do j=1,nintervals_virt
762 read (12,*) (ave_virt(j,i),i=1,ndim)
763 enddo
764- if (ncall.gt.0 .and. accuracy.ne.0d0) then
765- read (12,*) ans(1),unc(1),ncall,itmax
766-c Update the number of PS points based on unc(1), ncall and accuracy
767- itmax_fl=itmax*(unc(1)/accuracy)**2
768- if (itmax_fl.le.4d0) then
769- itmax=max(nint(itmax_fl),2)
770- elseif (itmax_fl.gt.4d0 .and. itmax_fl.le.16d0) then
771- ncall=nint(ncall*itmax_fl/4d0)
772- itmax=4
773- else
774- itmax=nint(sqrt(itmax_fl))
775- ncall=nint(ncall*itmax_fl/nint(sqrt(itmax_fl)))
776- endif
777- accuracy=accuracy/ans(1) ! relative accuracy on the ABS X-section
778- else
779- read (12,*) ans(1),unc(1),dummy,dummy
780- endif
781+ read (12,*) ans(1),unc(1),dummy,dummy
782 read (12,*) virtual_fraction,average_virtual
783 close (12)
784 write (*,*) "Update iterations and points to",itmax,ncall
785@@ -253,10 +236,6 @@
786 call mint(sigint,ndim,ncall,itmax,imode,xgrid,ymax,ymax_virt
787 $ ,ans,unc,chi2)
788 call topout
789- open(unit=58,file='res_0',status='unknown')
790- write(58,*)'Final result [ABS]:',ans(1),' +/-',unc(1)
791- write(58,*)'Final result:',ans(2),' +/-',unc(2)
792- close(58)
793 write(*,*)'Final result [ABS]:',ans(1),' +/-',unc(1)
794 write(*,*)'Final result:',ans(2),' +/-',unc(2)
795 write(*,*)'chi**2 per D.o.F.:',chi2(1)
796@@ -337,6 +316,11 @@
797 write(*,*) 'Time spent in Other_tasks : ',tOther
798 write(*,*) 'Time spent in Total : ',tTot
799
800+ open (unit=12, file='res.dat',status='unknown')
801+ write (12,*)ans(1),unc(1),ans(2),unc(2),itmax,ncall,tTot
802+ close(12)
803+
804+
805 if(i_momcmp_count.ne.0)then
806 write(*,*)' '
807 write(*,*)'WARNING: genps_fks code 555555'
808@@ -538,7 +522,7 @@
809 call fks_inc_chooser()
810 call leshouche_inc_chooser()
811 call setcuts
812- call setfksfactor(iconfig)
813+ call setfksfactor(iconfig,.false.)
814 return
815 end
816
817@@ -680,8 +664,6 @@
818 character * 70 idstring
819 logical savegrid
820
821- character * 80 runstr
822- common/runstr/runstr
823 logical usexinteg,mint
824 common/cusexinteg/usexinteg,mint
825 logical unwgt
826@@ -692,84 +674,98 @@
827 double precision volh
828 common/mc_int2/volh,mc_hel,ihel,fillh
829
830-
831+ logical done
832+ character*100 buffer
833 c-----
834 c Begin Code
835 c-----
836 mint=.true.
837 unwgt=.false.
838- write(*,'(a)') 'Enter number of events and iterations: '
839- read(*,*) ncall,itmax
840- write(*,*) 'Number of events and iterations ',ncall,itmax
841- write(*,'(a)') 'Enter desired accuracy: '
842- read(*,*) accuracy
843- write(*,*) 'Desired absolute accuracy: ',accuracy
844-
845- write(*,'(a)') 'Enter 0 for fixed, 2 for adjustable grid: '
846- read(*,*) use_cut
847- if (use_cut .lt. 0 .or. use_cut .gt. 2) then
848- write(*,*) 'Bad choice, using 2',use_cut
849- use_cut = 2
850- endif
851-
852- write(*,10) 'Suppress amplitude (0 no, 1 yes)? '
853- read(*,*) i
854- if (i .eq. 1) then
855- multi_channel = .true.
856- write(*,*) 'Using suppressed amplitude.'
857- else
858- multi_channel = .false.
859- write(*,*) 'Using full amplitude.'
860- endif
861-
862- write(*,10) 'Exact helicity sum (0 yes, n = number/event)? '
863- read(*,*) i
864- if (i .eq. 0) then
865- mc_hel = 0
866- write(*,*) 'Explicitly summing over helicities for virt'
867- else
868- mc_hel= i
869- write(*,*) 'Summing over',i,' helicities/event for virt'
870- endif
871- isum_hel=0
872-
873- write(*,10) 'Enter Configuration Number: '
874- read(*,*) dconfig
875- iconfig = int(dconfig)
876- do i=1,mapconfig(0)
877- if (iconfig.eq.mapconfig(i)) then
878- iconfig=i
879- exit
880+ open (unit=83,file='input_app.txt',status='old')
881+ done=.false.
882+ do while (.not. done)
883+ read(83,'(a)',err=222,end=222) buffer
884+ if (buffer(1:7).eq.'NPOINTS') then
885+ buffer=buffer(10:100)
886+ read(buffer,*) ncall
887+ write (*,*) 'Number of phase-space points per iteration:',ncall
888+ elseif(buffer(1:11).eq.'NITERATIONS') then
889+ read(buffer(14:),*) itmax
890+ write (*,*) 'Maximum number of iterations is:',itmax
891+ elseif(buffer(1:8).eq.'ACCURACY') then
892+ read(buffer(11:),*) accuracy
893+ write (*,*) 'Desired accuracy is:',accuracy
894+ elseif(buffer(1:10).eq.'ADAPT_GRID') then
895+ read(buffer(13:),*) use_cut
896+ write (*,*) 'Using adaptive grids:',use_cut
897+ elseif(buffer(1:12).eq.'MULTICHANNEL') then
898+ read(buffer(15:),*) i
899+ if (i.eq.1) then
900+ multi_channel=.true.
901+ write (*,*) 'Using Multi-channel integration'
902+ else
903+ multi_channel=.false.
904+ write (*,*) 'Not using Multi-channel integration'
905+ endif
906+ elseif(buffer(1:12).eq.'SUM_HELICITY') then
907+ read(buffer(15:),*) i
908+ if (nincoming.eq.1) then
909+ write (*,*) 'Sum over helicities in the virtuals'/
910+ $ /' for decay process'
911+ mc_hel=0
912+ elseif (i.eq.0) then
913+ mc_hel=0
914+ write (*,*) 'Explicitly summing over helicities'/
915+ $ /' for the virtuals'
916+ else
917+ mc_hel=1
918+ write(*,*) 'Do MC over helicities for the virtuals'
919+ endif
920+ isum_hel=0
921+ elseif(buffer(1:7).eq.'CHANNEL') then
922+ read(buffer(10:),*) dconfig
923+ iconfig = int(dconfig)
924+ do i=1,mapconfig(0)
925+ if (iconfig.eq.mapconfig(i)) then
926+ iconfig=i
927+ exit
928+ endif
929+ enddo
930+ write(*,12) 'Running Configuration Number: ',iconfig
931+ elseif(buffer(1:5).eq.'SPLIT') then
932+ read(buffer(8:),*) i
933+ write (*,*) 'Splitting channel:',i
934+ elseif(buffer(1:8).eq.'RUN_MODE') then
935+ read(buffer(11:),*) abrvinput
936+ if(abrvinput(5:5).eq.'0')then
937+ nbody=.true.
938+ else
939+ nbody=.false.
940+ endif
941+ abrv=abrvinput(1:4)
942+ write (*,*) "doing the ",abrv," of this channel"
943+ if(nbody)then
944+ write (*,*) "integration Born/virtual with Sfunction=1"
945+ else
946+ write (*,*) "Normal integration (Sfunction != 1)"
947+ endif
948+ elseif(buffer(1:7).eq.'RESTART') then
949+ read(buffer(10:),*) irestart
950+ if (irestart.eq.0) then
951+ write (*,*) 'RESTART: Fresh run'
952+ elseif(irestart.eq.-1) then
953+ write (*,*) 'RESTART: Use old grids, but refil plots'
954+ elseif(irestart.eq.1) then
955+ write (*,*) 'RESTART: continue with existing run'
956+ else
957+ write (*,*) 'RESTART:',irestart
958+ endif
959 endif
960+ cycle
961+ 222 done=.true.
962 enddo
963- write(*,12) 'Running Configuration Number: ',iconfig
964-c
965-c Enter parameters that control Vegas grids
966-c
967- write(*,*)'enter id string for this run'
968- read(*,*) idstring
969- runstr=idstring
970- write(*,*)'enter 1 if you want restart files'
971- read (*,*) itmp
972- if(itmp.eq.1) then
973- savegrid = .true.
974- else
975- savegrid = .false.
976- endif
977- write(*,*)'enter 0 to exclude, 1 for new run, 2 to restart'
978- read(5,*)irestart
979+ close(83)
980
981- abrvinput=' '
982- write (*,*) "'all ', 'born', 'real', 'virt', 'novi' or 'grid'?"
983- write (*,*) "Enter 'born0' or 'virt0' to perform"
984- write (*,*) " a pure n-body integration (no S functions)"
985- read(5,*) abrvinput
986- if(abrvinput(5:5).eq.'0')then
987- nbody=.true.
988- else
989- nbody=.false.
990- endif
991- abrv=abrvinput(1:4)
992 if (fks_configs.eq.1) then
993 if (pdg_type_d(1,fks_i_d(1)).eq.-21) then
994 write (*,*) 'Process generated with [LOonly=QCD]. '/
995@@ -782,26 +778,6 @@
996 endif
997 endif
998 endif
999-c Options are way too many: make sure we understand all of them
1000- if ( abrv.ne.'all '.and.abrv.ne.'born'.and.abrv.ne.'real'.and.
1001- & abrv.ne.'virt'.and.
1002- & abrv.ne.'viSC'.and.abrv.ne.'viLC'.and.abrv.ne.'novA'.and.
1003- & abrv.ne.'novB'.and.abrv.ne.'viSA'.and.abrv.ne.'viSB') then
1004- write(*,*)'Error in input: abrv is:',abrv
1005- stop
1006- endif
1007- if(nbody.and.abrv.ne.'born'.and.abrv(1:2).ne.'vi'
1008- & .and. abrv.ne.'grid')then
1009- write(*,*)'Error in driver: inconsistent input',abrvinput
1010- stop
1011- endif
1012-
1013- write (*,*) "doing the ",abrv," of this channel"
1014- if(nbody)then
1015- write (*,*) "integration Born/virtual with Sfunction=1"
1016- else
1017- write (*,*) "Normal integration (Sfunction != 1)"
1018- endif
1019 c
1020 c
1021 c Here I want to set up with B.W. we map and which we don't
1022
1023=== modified file 'Template/NLO/SubProcesses/driver_mintMC.f'
1024--- Template/NLO/SubProcesses/driver_mintMC.f 2015-08-13 12:43:02 +0000
1025+++ Template/NLO/SubProcesses/driver_mintMC.f 2015-10-25 15:32:18 +0000
1026@@ -108,6 +108,11 @@
1027 call cpu_time(tBefore)
1028 fixed_order=.false.
1029 nlo_ps=.true.
1030+ if (nincoming.ne.2) then
1031+ write (*,*) 'Decay processes not supported for'/
1032+ & /' event generation'
1033+ stop 1
1034+ endif
1035
1036 c Read general MadFKS parameters
1037 c
1038@@ -158,7 +163,7 @@
1039 else
1040 flat_grid=.false.
1041 endif
1042- ndim = 3*(nexternal-2)-4
1043+ ndim = 3*(nexternal-nincoming)-4
1044 if (abs(lpp(1)) .ge. 1) ndim=ndim+1
1045 if (abs(lpp(2)) .ge. 1) ndim=ndim+1
1046 c Don''t proceed if muF1#muF2 (we need to work out the relevant formulae
1047@@ -189,7 +194,7 @@
1048 enddo
1049 else
1050 c to restore grids:
1051- open (unit=12, file='preset_mint_grids',status='old')
1052+ open (unit=12, file='mint_grids',status='old')
1053 do j=0,nintervals
1054 read (12,*) (xgrid(j,i),i=1,ndim)
1055 enddo
1056@@ -285,7 +290,7 @@
1057 close(58)
1058
1059 c to save grids:
1060- open (unit=12, file='mint_grids_NLO',status='unknown')
1061+ open (unit=12, file='mint_grids',status='unknown')
1062 write (12,*) (xgrid(0,i),i=1,ndim)
1063 do j=1,nintervals
1064 write (12,*) (xgrid(j,i),i=1,ndim)
1065@@ -301,7 +306,6 @@
1066 write (12,*) virtual_fraction,average_virtual
1067 close (12)
1068
1069-
1070 c*************************************************************
1071 c event generation
1072 c*************************************************************
1073@@ -323,7 +327,7 @@
1074 ncall=nevts ! Update ncall with the number found in 'nevts'
1075
1076 c to restore grids:
1077- open (unit=12, file='mint_grids_NLO',status='unknown')
1078+ open (unit=12, file='mint_grids',status='unknown')
1079 read (12,*) (xgrid(0,i),i=1,ndim)
1080 do j=1,nintervals
1081 read (12,*) (xgrid(j,i),i=1,ndim)
1082@@ -468,6 +472,15 @@
1083 write(*,*) 'Time spent in Other_tasks : ',tOther
1084 write(*,*) 'Time spent in Total : ',tTot
1085
1086+ open (unit=12, file='res.dat',status='unknown')
1087+ if (imode.eq.0) then
1088+ write (12,*)ans(1),unc(1),ans(2),unc(2),itmax,ncall,tTot
1089+ else
1090+ write (12,*)ans(1)+ans(5),sqrt(unc(1)**2+unc(5)**2),ans(2)
1091+ $ ,unc(2),itmax,ncall,tTot
1092+ endif
1093+ close(12)
1094+
1095 return
1096 999 write (*,*) 'nevts file not found'
1097 stop
1098@@ -630,12 +643,17 @@
1099
1100 write(*,10) 'Exact helicity sum (0 yes, n = number/event)? '
1101 read(*,*) i
1102- if (i .eq. 0) then
1103- mc_hel= 0
1104- write(*,*) 'Explicitly summing over helicities for virt'
1105+ if (nincoming.eq.1) then
1106+ write (*,*) 'Sum over helicities in the virtuals'/
1107+ $ /' for decay process'
1108+ mc_hel=0
1109+ elseif (i.eq.0) then
1110+ mc_hel=0
1111+ write (*,*) 'Explicitly summing over helicities'/
1112+ $ /' for the virtuals'
1113 else
1114- mc_hel= i
1115- write(*,*) 'Summing over',i,' helicities/event for virt'
1116+ mc_hel=1
1117+ write(*,*) 'Do MC over helicities for the virtuals'
1118 endif
1119 isum_hel = 0
1120
1121@@ -1204,7 +1222,7 @@
1122 call fks_inc_chooser()
1123 call leshouche_inc_chooser()
1124 call setcuts
1125- call setfksfactor(iconfig)
1126+ call setfksfactor(iconfig,.true.)
1127 return
1128 end
1129
1130
1131=== modified file 'Template/NLO/SubProcesses/fks_Sij.f'
1132--- Template/NLO/SubProcesses/fks_Sij.f 2012-08-28 21:06:34 +0000
1133+++ Template/NLO/SubProcesses/fks_Sij.f 2015-10-25 15:32:18 +0000
1134@@ -90,9 +90,13 @@
1135
1136 c Consistency check -- call to set_cms_stuff() must be done prior to
1137 c entering this function
1138- shattmp=2d0*dot(p(0,1),p(0,2))
1139+ if (nincoming.eq.2) then
1140+ shattmp=2d0*dot(p(0,1),p(0,2))
1141+ else
1142+ shattmp=p(0,1)**2
1143+ endif
1144 if(abs(shattmp/shat-1.d0).gt.1.d-5)then
1145- write(*,*)'Error in fks_Sij: inconsistent shat'
1146+ write(*,*)'Error in fks_Sij: inconsistent shat #1'
1147 write(*,*)shattmp,shat
1148 stop
1149 endif
1150@@ -148,6 +152,7 @@
1151 do j=1,fks_j_from_i(i,0)
1152 kk = i
1153 ll = fks_j_from_i(i,j)
1154+ if (nincoming.ne.2 .and. ll.le.nincoming) cycle
1155 if ( ijskip(kk,ll).eq.0 .and. ijskip(ll,kk).eq.0 ) then
1156 ijskip(kk,ll) = 1
1157 elseif ( ijskip(kk,ll).eq.0 .and. ijskip(ll,kk).eq.1 ) then
1158@@ -178,6 +183,7 @@
1159 do j=1,fks_j_from_i(i,0)
1160 kk = i
1161 ll = fks_j_from_i(i,j)
1162+ if (nincoming.ne.2 .and. ll.le.nincoming) cycle
1163 if(ijskip(kk,ll).ne.1)goto 222
1164 if(particle_type(ll).eq.8.and.particle_type(kk).ne.8.and.
1165 # ll.gt.nincoming)then
1166@@ -567,7 +573,11 @@
1167
1168 c Consistency check -- call to set_cms_stuff() must be done prior to
1169 c entering this function
1170- shattmp=2d0*dot(p(0,1),p(0,2))
1171+ if (nincoming.eq.2) then
1172+ shattmp=2d0*dot(p(0,1),p(0,2))
1173+ else
1174+ shattmp=p(0,1)**2
1175+ endif
1176 if(abs(shattmp/shat-1.d0).gt.1.d-5)then
1177 write(*,*)'Error in fks_Hij: inconsistent shat'
1178 write(*,*)shattmp,shat
1179
1180=== modified file 'Template/NLO/SubProcesses/fks_inc_chooser.f'
1181--- Template/NLO/SubProcesses/fks_inc_chooser.f 2012-08-28 21:06:34 +0000
1182+++ Template/NLO/SubProcesses/fks_inc_chooser.f 2015-10-25 15:32:18 +0000
1183@@ -32,7 +32,6 @@
1184 pdg_type(i)=pdg_type_D(nFKSprocess,i)
1185 enddo
1186 do i=1,nexternal
1187-
1188 if (i.lt.min(i_fks,j_fks)) then
1189 particle_type_born(i)=particle_type(i)
1190 elseif (i.gt.max(i_fks,j_fks)) then
1191@@ -63,6 +62,9 @@
1192 else
1193 m_type=j_type
1194 endif
1195+ elseif(i_type.eq.8.and.j_type.eq.1.and.pdg_type(i_fks).eq.-21)then
1196+ ! dirty trick for LOonly processes without colored legs
1197+ m_type=j_type
1198 else
1199 write(*,*)'Flavour mismatch #2 in fks_inc_chooser',
1200 & i_type,j_type,m_type
1201
1202=== modified file 'Template/NLO/SubProcesses/fks_singular.f'
1203--- Template/NLO/SubProcesses/fks_singular.f 2015-08-19 12:50:52 +0000
1204+++ Template/NLO/SubProcesses/fks_singular.f 2015-10-25 15:32:18 +0000
1205@@ -1034,6 +1034,10 @@
1206 $ ,pswgt_cnt(-2:2),jac_cnt(-2:2)
1207 common/counterevnts/p1_cnt,wgt_cnt,pswgt_cnt,jac_cnt
1208 if (wgt1.eq.0d0 .and. wgt2.eq.0d0 .and. wgt3.eq.0d0) return
1209+c Check for NaN's and INF's. Simply skip the contribution
1210+ if (wgt1.ne.wgt1) return
1211+ if (wgt2.ne.wgt2) return
1212+ if (wgt3.ne.wgt3) return
1213 icontr=icontr+1
1214 if (icontr.gt.max_contr) then
1215 write (*,*) 'ERROR in add_wgt: too many contributions'
1216@@ -1226,7 +1230,12 @@
1217 c PDG codes
1218 niproc(ict)=iproc
1219 do j=1,iproc
1220- parton_iproc(j,ict)=pd(j)*conv
1221+ if (nincoming.eq.2) then
1222+ parton_iproc(j,ict)=pd(j)*conv
1223+ else
1224+c Keep GeV's for decay processes (no conv. factor needed)
1225+ parton_iproc(j,ict)=pd(j)
1226+ endif
1227 do k=1,nexternal
1228 parton_pdg(k,j,ict)=idup_d(iFKS,k,j)
1229 if (k.lt.fks_j_d(iFKS)) then
1230@@ -2195,9 +2204,15 @@
1231 do ii=1,iproc_save(nFKS(ict))
1232 if (eto(ii,nFKS(ict)).ne.ipr) cycle
1233 n_ctr_found=n_ctr_found+1
1234- write (n_ctr_str(n_ctr_found),'(3(1x,d18.12),1x,i2)')
1235- & (wgt(j,ict)*conv,j=1,3),
1236- & nexternal
1237+ if (nincoming.eq.2) then
1238+ write (n_ctr_str(n_ctr_found),'(3(1x,d18.12),1x,i2)')
1239+ & (wgt(j,ict)*conv,j=1,3),
1240+ & nexternal
1241+ else
1242+ write (n_ctr_str(n_ctr_found),'(3(1x,d18.12),1x,i2)')
1243+ & (wgt(j,ict),j=1,3),
1244+ & nexternal
1245+ endif
1246 procid=''
1247 do j=1,nexternal
1248 write (str_temp,*) parton_pdg(j,ii,ict)
1249@@ -2223,9 +2238,15 @@
1250 c H-event
1251 ipr=iproc_picked
1252 n_ctr_found=n_ctr_found+1
1253- write (n_ctr_str(n_ctr_found),'(3(1x,d18.12),1x,i2)')
1254- & (wgt(j,ict)*conv,j=1,3),
1255- & nexternal
1256+ if (nincoming.eq.2) then
1257+ write (n_ctr_str(n_ctr_found),'(3(1x,d18.12),1x,i2)')
1258+ & (wgt(j,ict)*conv,j=1,3),
1259+ & nexternal
1260+ else
1261+ write (n_ctr_str(n_ctr_found),'(3(1x,d18.12),1x,i2)')
1262+ & (wgt(j,ict),j=1,3),
1263+ & nexternal
1264+ endif
1265 procid=''
1266 do j=1,nexternal
1267 write (str_temp,*) parton_pdg(j,ipr,ict)
1268@@ -2338,7 +2359,7 @@
1269 do i=0,3
1270 xsum(i)=0.d0
1271 xsuma(i)=0.d0
1272- do j=3,npart
1273+ do j=nincoming+1,npart
1274 xsum(i)=xsum(i)+xmom(i,j)
1275 xsuma(i)=xsuma(i)+abs(xmom(i,j))
1276 enddo
1277@@ -2405,9 +2426,14 @@
1278 pass=.true.
1279 jflag=0
1280 do i=0,3
1281- xsum(i)=-xmom(i,1)-xmom(i,2)
1282- xsuma(i)=abs(xmom(i,1))+abs(xmom(i,2))
1283- do j=3,npart
1284+ if (nincoming.eq.2) then
1285+ xsum(i)=-xmom(i,1)-xmom(i,2)
1286+ xsuma(i)=abs(xmom(i,1))+abs(xmom(i,2))
1287+ elseif(nincoming.eq.1) then
1288+ xsum(i)=-xmom(i,1)
1289+ xsuma(i)=abs(xmom(i,1))
1290+ endif
1291+ do j=nincoming+1,npart
1292 xsum(i)=xsum(i)+xmom(i,j)
1293 xsuma(i)=xsuma(i)+abs(xmom(i,j))
1294 enddo
1295@@ -2420,14 +2446,14 @@
1296 write(*,*)'Momentum is not conserved [nocms]'
1297 write(*,*)'i=',i
1298 do j=1,npart
1299- write(*,'(4(d14.8,1x))') (xmom(jj,j),jj=0,3)
1300+ write(*,'(i2,1x,4(d14.8,1x))') j,(xmom(jj,j),jj=0,3)
1301 enddo
1302 jflag=1
1303 endif
1304 enddo
1305 if(jflag.eq.1)then
1306- write(*,'(4(d14.8,1x))') (xsum(jj),jj=0,3)
1307- write(*,'(4(d14.8,1x))') (xrat(jj),jj=0,3)
1308+ write(*,'(a3,1x,4(d14.8,1x))') 'sum',(xsum(jj),jj=0,3)
1309+ write(*,'(a3,1x,4(d14.8,1x))') 'rat',(xrat(jj),jj=0,3)
1310 pass=.false.
1311 return
1312 endif
1313@@ -2454,7 +2480,11 @@
1314 endif
1315 enddo
1316 c
1317- ecmtmp=sqrt(2d0*dot(xmom(0,1),xmom(0,2)))
1318+ if (nincoming.eq.2) then
1319+ ecmtmp=sqrt(2d0*dot(xmom(0,1),xmom(0,2)))
1320+ elseif (nincoming.eq.1) then
1321+ ecmtmp=xmom(0,1)
1322+ endif
1323 if(abs(ecm-ecmtmp).gt.vtiny)then
1324 write(*,*)'Inconsistent shat [nocms]'
1325 write(*,*)'ecm given= ',ecm
1326@@ -2687,6 +2717,9 @@
1327
1328 double precision zero,tiny
1329 parameter (zero=0d0)
1330+
1331+ integer icount
1332+ data icount /0/
1333
1334 c Particle types (=color) of i_fks, j_fks and fks_mother
1335 integer i_type,j_type,m_type
1336@@ -2709,7 +2742,11 @@
1337
1338 c Consistency check -- call to set_cms_stuff() must be done prior to
1339 c entering this function
1340- shattmp=2d0*dot(pp(0,1),pp(0,2))
1341+ if (nincoming.eq.2) then
1342+ shattmp=2d0*dot(pp(0,1),pp(0,2))
1343+ else
1344+ shattmp=pp(0,1)**2
1345+ endif
1346 if(abs(shattmp/shat-1.d0).gt.1.d-5)then
1347 write(*,*)'Error in sreal: inconsistent shat'
1348 write(*,*)shattmp,shat
1349@@ -2717,9 +2754,9 @@
1350 endif
1351
1352 if (1d0-y_ij_fks.lt.tiny)then
1353- if (pmass(j_fks).eq.zero.and.j_fks.le.2)then
1354+ if (pmass(j_fks).eq.zero.and.j_fks.le.nincoming)then
1355 call sborncol_isr(pp,xi_i_fks,y_ij_fks,wgt)
1356- elseif (pmass(j_fks).eq.zero.and.j_fks.ge.3)then
1357+ elseif (pmass(j_fks).eq.zero.and.j_fks.ge.nincoming+1)then
1358 call sborncol_fsr(pp,xi_i_fks,y_ij_fks,wgt)
1359 else
1360 wgt=0d0
1361@@ -2741,11 +2778,20 @@
1362 endif
1363
1364 if(wgt.lt.0.d0)then
1365- write(*,*) 'Fatal error #2 in sreal',wgt,xi_i_fks,y_ij_fks
1366- do i=1,nexternal
1367- write(*,*) 'particle ',i,', ',(pp(j,i),j=0,3)
1368- enddo
1369- stop
1370+ icount=icount+1
1371+ if (icount.le.10) then
1372+ write(*,*) 'Warning, numerical problem found in sreal. '/
1373+ $ /'Setting weight to zero',wgt,xi_i_fks,y_ij_fks
1374+ do i=1,nexternal
1375+ write(*,*) 'particle ',i,', ',(pp(j,i),j=0,3)
1376+ enddo
1377+ if (icount.eq.25) then
1378+ write (*,*) 'ERROR 25 problems found... '/
1379+ $ /'stopping the code'
1380+ stop
1381+ endif
1382+ endif
1383+ wgt=0d0
1384 endif
1385
1386 return
1387@@ -2814,7 +2860,7 @@
1388 E_i_fks = p(0,i_fks)
1389 z = 1d0 - E_i_fks/(E_i_fks+E_j_fks)
1390 t = z * shat/4d0
1391- if(rotategranny .and. nexternal-1.ne.3)then
1392+ if(rotategranny .and. nexternal-1.ne.3 .and. nincoming.eq.2)then
1393 c Exclude 2->1 (at the Born level) processes: matrix elements are
1394 c independent of the PS point, but non-zero helicity configurations
1395 c might flip when rotating the momenta.
1396@@ -2934,7 +2980,7 @@
1397 c Thus, an extra factor z (implicit in the flux of the reduced Born
1398 c in FKS) has to be inserted here
1399 t = z*shat/4d0
1400- if(j_fks.eq.2 .and. nexternal-1.ne.3)then
1401+ if(j_fks.eq.2 .and. nexternal-1.ne.3 .and. nincoming.eq.2)then
1402 c Rotation according to innerpin.m. Use rotate_invar() if a more
1403 c general rotation is needed.
1404 c Exclude 2->1 (at the Born level) processes: matrix elements are
1405@@ -2965,7 +3011,7 @@
1406 pi(i)=p_i_fks_ev(i)
1407 pj(i)=p(i,j_fks)
1408 enddo
1409- if(j_fks.eq.2)then
1410+ if(j_fks.eq.2 .and. nincoming.eq.2)then
1411 c Rotation according to innerpin.m. Use rotate_invar() if a more
1412 c general rotation is needed
1413 pi(1)=-pi(1)
1414@@ -2986,7 +3032,7 @@
1415 azifact=Wij_angle/Wij_recta
1416 endif
1417 c Insert the extra factor due to Madgraph convention for polarization vectors
1418- if(j_fks.eq.2)then
1419+ if(j_fks.eq.2 .and. nincoming.eq.2)then
1420 cphi_mother=-1.d0
1421 sphi_mother=0.d0
1422 else
1423@@ -3461,7 +3507,11 @@
1424
1425 c Consistency check -- call to set_cms_stuff() must be done prior to
1426 c entering this function
1427- shattmp=2d0*dot(p(0,1),p(0,2))
1428+ if (nincoming.eq.2) then
1429+ shattmp=2d0*dot(p(0,1),p(0,2))
1430+ else
1431+ shattmp=p(0,1)**2
1432+ endif
1433 if(abs(shattmp/shat-1.d0).gt.1.d-5)then
1434 write(*,*)'Error in sreal: inconsistent shat'
1435 write(*,*)shattmp,shat
1436@@ -3770,7 +3820,7 @@
1437 enddo
1438 enddo
1439 do i=0,3
1440- if(j_fks.gt.2)then
1441+ if(j_fks.gt.nincoming)then
1442 xnum=p1_cnt(i,i_fks,inum)+p1_cnt(i,j_fks,inum)
1443 xden=p1_cnt(i,i_fks,iden)+p1_cnt(i,j_fks,iden)
1444 else
1445@@ -4370,7 +4420,11 @@
1446
1447 c Consistency check -- call to set_cms_stuff() must be done prior to
1448 c entering this function
1449- shattmp=2d0*dot(p(0,1),p(0,2))
1450+ if (nincoming.eq.2) then
1451+ shattmp=2d0*dot(p(0,1),p(0,2))
1452+ else
1453+ shattmp=p(0,1)**2
1454+ endif
1455 if(abs(shattmp/shat-1.d0).gt.1.d-5)then
1456 write(*,*)'Error in sreal: inconsistent shat'
1457 write(*,*)shattmp,shat
1458@@ -4447,7 +4501,7 @@
1459 enddo
1460 c
1461 do i=1,nincoming
1462- if (particle_type(i).ne.1)then
1463+ if (particle_type(i).ne.1 .and. pmass(i).eq.ZERO) then
1464 if (particle_type(i).eq.8) then
1465 aj=0
1466 elseif(abs(particle_type(i)).eq.3) then
1467@@ -4972,8 +5026,13 @@
1468 elseif(abrv.ne.'virt' .and. abrv.ne.'viSC' .and.
1469 # abrv.ne.'viLC')then
1470 c 1+2+3+4
1471- tmp=dlog(xicut_used**2*shat/QES2)-
1472- # 1/betai*dlog((1+betai)/(1-betai))
1473+ if (betai.gt.1d-6) then
1474+ tmp=dlog(xicut_used**2*shat/QES2)-
1475+ & 1/betai*dlog((1+betai)/(1-betai))
1476+ else
1477+ tmp=dlog(xicut_used**2*shat/QES2)-
1478+ & 2d0*(1d0+betai**2/3d0+betai**4/5d0)
1479+ endif
1480 else
1481 write(*,*)'Error #14 in eikonal_Ireg',abrv
1482 stop
1483@@ -5200,7 +5259,11 @@
1484 elseif(pmass(m).ne.zero.and.pmass(n).ne.zero)then
1485 kikj=dot(p(0,n),p(0,m))
1486 vij=sqrt(1-(pmass(n)*pmass(m)/kikj)**2)
1487- single=single+0.5d0*1/vij*log((1+vij)/(1-vij))*wgt
1488+ if (vij .gt. 1d-6) then
1489+ single=single+0.5d0*1/vij*log((1+vij)/(1-vij))*wgt
1490+ else
1491+ single=single+(1d0+vij**2/3d0+vij**4/5d0)*wgt
1492+ endif
1493 else
1494 write(*,*)'Error in getpoles',i,j,n,m,pmass(n),pmass(m)
1495 stop
1496@@ -5284,7 +5347,7 @@
1497 end
1498
1499
1500- subroutine setfksfactor(iconfig)
1501+ subroutine setfksfactor(iconfig,match_to_shower)
1502 implicit none
1503
1504 double precision CA,CF, PI
1505@@ -5301,6 +5364,7 @@
1506 common/sctests/softtest,colltest
1507
1508 integer config_fks,i,j,iconfig,fac1,fac2
1509+ logical match_to_shower
1510
1511 double precision fkssymmetryfactor,fkssymmetryfactorBorn,
1512 & fkssymmetryfactorDeg
1513@@ -5519,6 +5583,9 @@
1514 else
1515 m_type=j_type
1516 endif
1517+ elseif(i_type.eq.8.and.j_type.eq.1.and.pdg_type(i_fks).eq.-21)then
1518+ ! dirty trick for LOonly processes without colored legs
1519+ m_type=j_type
1520 else
1521 write(*,*)'Flavour mismatch #2 in setfksfactor',
1522 & i_type,j_type,m_type
1523@@ -5534,7 +5601,7 @@
1524 m_type=m_type_FKS(nFKSprocess)
1525
1526 c Set matrices used by MC counterterms
1527- call set_mc_matrices
1528+ if (match_to_shower) call set_mc_matrices
1529
1530 fac_i=fac_i_FKS(nFKSprocess)
1531 fac_j=fac_j_FKS(nFKSprocess)
1532
1533=== modified file 'Template/NLO/SubProcesses/genps_fks.f'
1534--- Template/NLO/SubProcesses/genps_fks.f 2015-02-04 13:26:19 +0000
1535+++ Template/NLO/SubProcesses/genps_fks.f 2015-10-25 15:32:18 +0000
1536@@ -182,15 +182,19 @@
1537 endif
1538 enddo
1539 if( firsttime .or. iconfig0.ne.iconfigsave ) then
1540- stot = 4d0*ebeam(1)*ebeam(2)
1541+ if (nincoming.eq.2) then
1542+ stot = 4d0*ebeam(1)*ebeam(2)
1543+ else
1544+ stot=pmass(1)**2
1545+ endif
1546 c Make sure have enough mass for external particles
1547 totmassin=0d0
1548- do i=3-nincoming,2
1549+ do i=1,nincoming
1550 totmassin=totmassin+m(i)
1551 enddo
1552 totmass=0d0
1553 nbranch = nexternal-3 ! nexternal is for n+1-body, while itree uses n-body
1554- do i=3,nbranch+2
1555+ do i=nincoming+1,nexternal-1
1556 totmass=totmass+m(i)
1557 enddo
1558 fksmass=totmass
1559@@ -294,7 +298,7 @@
1560 else
1561 pb(0,1)=sqrtshat_born
1562 do i=1,2
1563- pb(0,1)=0d0
1564+ pb(i,1)=0d0
1565 enddo
1566 p(3,1)=1e-14 ! For HELAS routine ixxxxx for neg. mass
1567 endif
1568@@ -453,22 +457,22 @@
1569 isolsign=1
1570 call generate_momenta_massless_final(icountevts,i_fks,j_fks
1571 & ,p_born(0,imother),shat,sqrtshat ,x(ixEi),xmrec2,xp
1572- & ,phi_i_fks, xiimax,xinorm,xi_i_fks,y_ij_fks,p_i_fks
1573+ & ,phi_i_fks,xiimax,xinorm,xi_i_fks,y_ij_fks,p_i_fks
1574 & ,xjac,xpswgt,pass)
1575 if (.not.pass) goto 112
1576 elseif(m_j_fks.gt.0d0) then
1577 call generate_momenta_massive_final(icountevts,isolsign
1578- & ,i_fks,j_fks,p_born(0,imother),shat,sqrtshat ,m_j_fks
1579- & ,x(ixEi),xmrec2,xp,phi_i_fks, xiimax,xinorm
1580+ & ,i_fks,j_fks,p_born(0,imother),shat,sqrtshat,m_j_fks
1581+ & ,x(ixEi),xmrec2,xp,phi_i_fks,xiimax,xinorm
1582 & ,xi_i_fks,y_ij_fks,p_i_fks,xjac,xpswgt,pass)
1583 if (.not.pass) goto 112
1584 endif
1585 elseif(j_fks.le.nincoming) then
1586 isolsign=1
1587 call generate_momenta_initial(icountevts,i_fks,j_fks,xbjrk_born
1588- & ,tau_born,ycm_born,ycmhat,shat_born,phi_i_fks ,xp ,x(ixEi)
1589- & ,shat,stot ,sqrtshat,tau,ycm,xbjrk ,p_i_fks,xiimax,xinorm
1590- & ,xi_i_fks,y_ij_fks ,xpswgt,xjac ,pass)
1591+ & ,tau_born,ycm_born,ycmhat,shat_born,phi_i_fks,xp ,x(ixEi)
1592+ & ,shat,stot,sqrtshat,tau,ycm,xbjrk,p_i_fks,xiimax,xinorm
1593+ & ,xi_i_fks,y_ij_fks ,xpswgt,xjac,pass)
1594 if (.not.pass) goto 112
1595 else
1596 write (*,*) 'Error #2 in genps_fks.f',j_fks
1597@@ -750,6 +754,7 @@
1598 c remove the following if no importance sampling towards soft
1599 c singularity is performed when integrating over xi_i_hat
1600 xjac=xjac*2d0*x(1)
1601+
1602 c Check that xii is in the allowed range
1603 if( icountevts.eq.-100 .or. abs(icountevts).eq.1 )then
1604 if(xi_i_fks.gt.(1-xmrec2/shat))then
1605@@ -829,7 +834,11 @@
1606 c mother four momenta
1607 do i=0,3
1608 xp_mother(i)=xp(i,i_fks)+xp(i,j_fks)
1609- recoil(i)=xp(i,1)+xp(i,2)-xp_mother(i)
1610+ if (nincoming.eq.2) then
1611+ recoil(i)=xp(i,1)+xp(i,2)-xp_mother(i)
1612+ else
1613+ recoil(i)=xp(i,1)-xp_mother(i)
1614+ endif
1615 enddo
1616 sumrec=recoil(0)+rho(recoil)
1617 sumrec2=sumrec**2
1618@@ -843,7 +852,7 @@
1619 xdir(j)=xp_mother(j)/x3len_fks_mother
1620 enddo
1621 c Perform the boost here
1622- do i=3,nexternal
1623+ do i=nincoming+1,nexternal
1624 if(i.ne.i_fks.and.i.ne.j_fks.and.shybst.ne.0.d0)
1625 & call boostwdir2(chybst,shybst,chybstmo,xdir,xp(0,i),xp(0,i))
1626 enddo
1627@@ -1145,7 +1154,11 @@
1628 c mother four momenta
1629 do i=0,3
1630 xp_mother(i)=xp(i,i_fks)+xp(i,j_fks)
1631- recoil(i)=xp(i,1)+xp(i,2)-xp_mother(i)
1632+ if (nincoming.eq.2) then
1633+ recoil(i)=xp(i,1)+xp(i,2)-xp_mother(i)
1634+ else
1635+ recoil(i)=xp(i,1)-xp_mother(i)
1636+ endif
1637 enddo
1638 c
1639 sumrec=recoil(0)+rho(recoil)
1640@@ -1168,7 +1181,7 @@
1641 xdir(j)=xp_mother(j)/x3len_fks_mother
1642 enddo
1643 c Boost the momenta
1644- do i=3,nexternal
1645+ do i=nincoming+1,nexternal
1646 if(i.ne.i_fks.and.i.ne.j_fks.and.shybst.ne.0.d0)
1647 & call boostwdir2(chybst,shybst,chybstmo,xdir,xp(0,i),xp(0,i))
1648 enddo
1649@@ -2357,7 +2370,11 @@
1650 external dot
1651 pass=.true.
1652 do i=0,3
1653- recoilbar(i)=p_born(i,1)+p_born(i,2)-p_born(i,imother)
1654+ if (nincoming.eq.2) then
1655+ recoilbar(i)=p_born(i,1)+p_born(i,2)-p_born(i,imother)
1656+ else
1657+ recoilbar(i)=p_born(i,1)-p_born(i,imother)
1658+ endif
1659 enddo
1660 xmrec2=dot(recoilbar,recoilbar)
1661 if(xmrec2.lt.0.d0)then
1662
1663=== modified file 'Template/NLO/SubProcesses/iproc_map.f'
1664--- Template/NLO/SubProcesses/iproc_map.f 2015-03-09 18:27:17 +0000
1665+++ Template/NLO/SubProcesses/iproc_map.f 2015-10-25 15:32:18 +0000
1666@@ -211,7 +211,8 @@
1667 include "appl_common.inc"
1668 *
1669 character*200 buffer
1670- integer procnum,found,i,l,j,ll
1671+ integer procnum,i,l,j,ll,found_a,found_m
1672+ logical found_appl(mxpdflumi),found_mg(maxproc)
1673 integer nmatch_total
1674
1675 * npdflumi is the number of pdf luminosities in this particular process
1676@@ -296,7 +297,7 @@
1677 1 ((pdgs(i,j,kpdflumi),i=1,2),j=1,nproc(kpdflumi))
1678 *
1679 if(kpdflumi.le.0.or.kpdflumi.gt.mxpdflumi) then
1680- write(6,*) "In fks_singular.f"
1681+ write(6,*) "In iproc_map.f"
1682 write(6,*) "Invalid value of kpdflumi = ",kpdflumi
1683 stop
1684 endif
1685@@ -341,33 +342,29 @@
1686 * Be careful with all possible permutations in initial_parton_map!
1687 * Check all possible npdflumi conbinations until a match is found
1688 do kpdflumi=1,npdflumi
1689-* First, check that the same number of
1690-* parton subprocesses is used
1691- if(maxproc_used.ne.nproc(kpdflumi)) continue
1692- if(flav_map_debug) then
1693- write(6,*) " "
1694- write(6,*) " kpdflumi = ",kpdflumi
1695- write(6,*) " nproc(kpdflumi) = ",nproc(kpdflumi)
1696- do l=1,nproc(kpdflumi)
1697- write(6,*) l,pdgs(1,l,kpdflumi),pdgs(2,l,kpdflumi)
1698- enddo
1699- write(6,*) " "
1700- endif
1701-
1702+
1703 * Initialization
1704- found = 0
1705+ do l=1,nproc(kpdflumi)
1706+ found_appl(l) = .false.
1707+ enddo
1708+ do ll=1,maxproc_used
1709+ found_mg(ll) = .false.
1710+ enddo
1711+ found_a=0
1712+ found_m=0
1713
1714 * Look for all possible pairs of
1715 * a) pdgs(1,l,kpdflumi),pdgs(2,l,kpdflumi) and
1716 * b) IDUP(1,ll), IDUP(2,ll)
1717 * with kpdflumi fixed
1718 do l=1,nproc(kpdflumi)
1719- do ll=1,nproc(kpdflumi)
1720+ do ll=1,maxproc_used
1721 if ( ( pdgs(1,l,kpdflumi).eq.
1722 1 IDUP(1,ll).and.pdgs(2,l,kpdflumi).
1723 2 eq.IDUP(2,ll) ) )
1724 4 then
1725- found = found + 1
1726+ found_appl(l)=.true.
1727+ found_mg(ll)=.true.
1728 if(flav_map_debug) then
1729 write(6,*) "match found!"
1730 write(6,*) "pdgs = ",pdgs(1,l,kpdflumi),
1731@@ -377,8 +374,15 @@
1732 endif
1733 enddo
1734 enddo
1735+ do l=1,nproc(kpdflumi)
1736+ if (found_appl(l)) found_a=found_a+1
1737+ enddo
1738+ do ll=1,maxproc_used
1739+ if (found_mg(ll)) found_m=found_m+1
1740+ enddo
1741 *
1742- if (found.eq.nproc(kpdflumi)) then
1743+ if ( found_a.eq.nproc(kpdflumi) .and.
1744+ & found_m.eq.maxproc_used ) then
1745 if(flav_map_debug) then
1746 write(6,*) " ------------------------------- "
1747 write(6,*) " Match found!"
1748@@ -389,9 +393,9 @@
1749 nmatch_total = nmatch_total+1
1750 endif
1751 enddo
1752- if(flavour_map(nFKSprocess).eq.0) then
1753+ if (nmatch_total.ne.nFKSprocess) then
1754 write(6,*)
1755- 1 "Problem with setup_flavourmap in fks_singular.f"
1756+ 1 "Problem with setup_flavourmap in iproc_map.f"
1757 write(6,*) "nFKSprocess = ",nFKSprocess
1758 write(6,*)" flavour_map(nFKSprocess)= ",
1759 1 flavour_map(nFKSprocess)
1760@@ -399,17 +403,6 @@
1761 endif
1762 enddo
1763
1764-* write(6,*) " "
1765-* write(6,*) " nmatch_total = ", nmatch_total
1766-* write(6,*) " "
1767- if( nmatch_total.ne.fks_configs) then
1768- write(6,*)
1769- 1 "Problem with setup_flavourmap in fks_singular.f"
1770- write(6,*) "nmatch_total, fks_configs"
1771- write(6,*) nmatch_total, fks_configs
1772- stop
1773- endif
1774-
1775 * Check flavor map properly initialized
1776 * All the entries of flavour_map(1:nFKSprocess) must be from
1777 * 1 to npdflumi
1778
1779=== modified file 'Template/NLO/SubProcesses/leshouche_inc_chooser.f'
1780--- Template/NLO/SubProcesses/leshouche_inc_chooser.f 2015-03-09 18:27:17 +0000
1781+++ Template/NLO/SubProcesses/leshouche_inc_chooser.f 2015-10-25 15:32:18 +0000
1782@@ -91,8 +91,8 @@
1783 icolup_d(1,1,nexternal,j)=-99999 ! should not be used
1784 icolup_d(1,2,nexternal,j)=-99999
1785 enddo
1786+ return
1787 endif
1788- return
1789 endif
1790
1791 open(unit=78, file='leshouche_info.dat', status='old')
1792
1793=== modified file 'Template/NLO/SubProcesses/montecarlocounter.f'
1794--- Template/NLO/SubProcesses/montecarlocounter.f 2014-10-06 16:45:08 +0000
1795+++ Template/NLO/SubProcesses/montecarlocounter.f 2015-10-25 15:32:18 +0000
1796@@ -2549,8 +2549,9 @@
1797 common/to_abrv/abrv
1798
1799 ref_scale=sqrt((1-xi)*shat)
1800- xscalemin=max(frac_low*ref_scale,scaleMClow)
1801- xscalemax=max(frac_upp*ref_scale,xscalemin+scaleMCdelta)
1802+ xscalemin=max(shower_scale_factor*frac_low*ref_scale,scaleMClow)
1803+ xscalemax=max(shower_scale_factor*frac_upp*ref_scale,
1804+ & xscalemin+scaleMCdelta)
1805 xscalemax=min(xscalemax,2d0*sqrt(ebeam(1)*ebeam(2)))
1806 xscalemin=min(xscalemin,xscalemax)
1807 c
1808
1809=== modified file 'Template/NLO/SubProcesses/setcuts.f'
1810--- Template/NLO/SubProcesses/setcuts.f 2015-07-24 18:59:18 +0000
1811+++ Template/NLO/SubProcesses/setcuts.f 2015-10-25 15:32:18 +0000
1812@@ -91,8 +91,6 @@
1813 lpp(2)=0
1814 ebeam(1)=pmass(1)/2d0
1815 ebeam(2)=pmass(1)/2d0
1816- scale=pmass(1)
1817- fixed_ren_scale=.true.
1818 endif
1819 c-check consistency of maxjetflavor in the run_card and with Nf
1820 c specified in coupl.inc
1821
1822=== modified file 'Template/NLO/SubProcesses/setscales.f'
1823--- Template/NLO/SubProcesses/setscales.f 2015-07-30 15:57:44 +0000
1824+++ Template/NLO/SubProcesses/setscales.f 2015-10-25 15:32:18 +0000
1825@@ -237,7 +237,10 @@
1826 $ ,FxFx_fac_scale
1827 c
1828 tmp=0
1829- if(ickkw.eq.3)then
1830+ if (nincoming.eq.1) then
1831+ tmp=pp(0,1) ! mass of the decaying particle
1832+ temp_scale_id='Mass of decaying particle'
1833+ elseif(ickkw.eq.3)then
1834 c FxFx merging scale:
1835 c Note that nFxFx_ren_scales includes the one scale that corresponds
1836 c to the real-emission one (and is zero for the n-body conf.). Skip
1837@@ -411,7 +414,7 @@
1838 tmp=0
1839 if(ickkw.eq.3)then
1840 c FxFx merging scale:
1841- tmp=min(FxFx_fac_scale(1),FxFx_fac_scale(2))
1842+ tmp=(FxFx_fac_scale(1)+FxFx_fac_scale(2))/2d0
1843 temp_scale_id='FxFx merging scale'
1844 elseif(imuftype.eq.1)then
1845 tmp=scale_global_reference(pp)
1846@@ -490,7 +493,10 @@
1847 parameter (iQEStype=1)
1848 c
1849 tmp=0
1850- if(iQEStype.eq.1)then
1851+ if (nincoming.eq.1) then
1852+ tmp=pp(0,1) ! mass of the decaying particle
1853+ temp_scale_id='Mass of decaying particle'
1854+ elseif(iQEStype.eq.1)then
1855 tmp=scale_global_reference(pp)
1856 elseif(iQEStype.eq.2)then
1857 do i=nincoming+1,nexternal
1858
1859=== removed file 'Template/NLO/SubProcesses/sumres.py'
1860--- Template/NLO/SubProcesses/sumres.py 2014-07-23 10:33:38 +0000
1861+++ Template/NLO/SubProcesses/sumres.py 1970-01-01 00:00:00 +0000
1862@@ -1,241 +0,0 @@
1863-#!/usr/bin/env python
1864-
1865-#script to combine reults and tell the number of events that need
1866-# to be generated in each channel.
1867-# Replaces the sumres.f and sumres2.f files
1868-# MZ, 2011-10-22
1869-
1870-from __future__ import division
1871-import math
1872-import sys
1873-import random
1874-import os
1875-
1876-nexpected=int(sys.argv[1])
1877-nevents=int(sys.argv[2])
1878-req_acc=float(sys.argv[3])
1879-# if nevents is >=0 the script will also determine the
1880-# number of events required for each process
1881-
1882-
1883-def Mirrorprocs(p1, p2):
1884- """determine if the folder names p1, p2 (with the _N already taken out)
1885- correspond to the same process with
1886- mirrror initial state. Returns true/false"""
1887- return False
1888-
1889-file=open("res.txt")
1890-content = file.read()
1891-file.close()
1892-lines = content.split("\n")
1893-processes=[]
1894-tot=0
1895-err=0
1896-totABS=0
1897-errABS=0
1898-
1899-# open the file containing the list of directories
1900-file=open("dirs.txt")
1901-dirs = file.read().split("\n")
1902-file.close()
1903-dirs.remove('')
1904-
1905-# The syntax of lines should be first the ABS cross section for the
1906-# channel and the line after that the cross section for the same
1907-# channel.
1908-for line in range(0,len(lines),2):
1909- list = lines[line].split()
1910- if list:
1911- proc={}
1912- proc['folder'] = list[0].split('/')[0]
1913- proc['subproc'] = proc['folder'][0:proc['folder'].rfind('_')]
1914- proc['channel'] = list[0].split('/')[1]
1915- dirs.remove(os.path.join(proc['folder'], proc['channel']))
1916- proc['resultABS'] = float(list[4])
1917- proc['errorABS'] = float(list[6])
1918- proc['err_percABS'] = proc['errorABS']/proc['resultABS']*100.
1919- processes.append(proc)
1920- totABS+= proc['resultABS']
1921- errABS+= math.pow(proc['errorABS'],2)
1922- list = lines[line+1].split()
1923- if list:
1924- proc['result'] = float(list[3])
1925- proc['error'] = float(list[5])
1926- proc['err_perc'] = proc['error']/proc['result']*100.
1927- tot+= proc['result']
1928- err+= math.pow(proc['error'],2)
1929-if dirs:
1930- print "%d jobs did not terminate correctly: " % len(dirs)
1931- print '\n'.join(dirs)
1932- print "The results are probably not correct. Please check the relevant log files corresponding to the above jobs for more information."
1933-
1934-processes.sort(key = lambda proc: -proc['errorABS'])
1935-
1936-correct = len(processes) == nexpected
1937-print "Found %d correctly terminated jobs " %len(processes)
1938-if not len(processes)==nexpected:
1939- print len(processes), nexpected
1940-
1941-subprocs_string=[]
1942-for proc in processes:
1943- subprocs_string.append(proc['subproc'])
1944-subprocs_string=set(subprocs_string)
1945-
1946-content+='\n\nCross-section per integration channel:\n'
1947-for proc in processes:
1948- content+='%(folder)20s %(channel)15s %(result)10.8e %(error)6.4e %(err_perc)6.4f%% \n' % proc
1949-
1950-content+='\n\nABS cross-section per integration channel:\n'
1951-for proc in processes:
1952- content+='%(folder)20s %(channel)15s %(resultABS)10.8e %(errorABS)6.4e %(err_percABS)6.4f%% \n' % proc
1953-
1954-content+='\n\nCross-section per subprocess:\n'
1955-#for subpr in sorted(set(subprocs)):
1956-subprocesses=[]
1957-for sub in subprocs_string:
1958- subpr={}
1959- subpr['subproc']=sub
1960- subpr['xsect']=0.
1961- subpr['err']=0.
1962- for proc in processes:
1963- if proc['subproc'] == sub:
1964- subpr['xsect'] += proc['result']
1965- subpr['err'] += math.pow(proc['error'],2)
1966- subpr['err']=math.sqrt(subpr['err'])
1967- subprocesses.append(subpr)
1968-
1969-
1970-#find and combine mirror configurations (if in v4)
1971-for i1, s1 in enumerate(subprocesses):
1972- for i2, s2 in enumerate(subprocesses):
1973- if Mirrorprocs(s1['subproc'], s2['subproc']) and i1 >= i2:
1974- s1['xsect'] += s2['xsect']
1975- s1['err'] = math.sqrt(math.pow(s1['err'],2)+ math.pow(s2['err'],2))
1976- s2['toremove'] = True
1977-
1978-new = []
1979-for s in subprocesses:
1980- try:
1981- a= s['toremove']
1982- except KeyError:
1983- new.append(s)
1984-subprocesses= new
1985-
1986-
1987-subprocesses.sort(key = lambda proc: -proc['xsect'])
1988-for subpr in subprocesses:
1989- content+= '%(subproc)20s %(xsect)10.8e %(err)6.4e\n' % subpr
1990-
1991-
1992-content+='\nTotal ABS and \nTotal: \n %10.8e +- %6.4e (%6.4e%%)\n %10.8e +- %6.4e (%6.4e%%)\n' %\
1993- (totABS, math.sqrt(errABS), math.sqrt(errABS)/totABS *100.,tot, math.sqrt(err), math.sqrt(err)/tot *100.)
1994-
1995-if not correct:
1996- sys.exit('ERROR: not all jobs terminated correctly\n')
1997-
1998-file=open("res.txt", 'w')
1999-
2000-file.write(content)
2001-file.close()
2002-
2003-#determine the events for each process:
2004-if nevents>=0:
2005- if req_acc<0:
2006- req_acc2_inv=nevents
2007- else:
2008- req_acc2_inv=1/(req_acc*req_acc)
2009- #get the random number seed from the randinit file
2010- file=open("randinit")
2011- exec file
2012- file.close
2013- print "random seed found in 'randinit' is", r
2014- random.seed(r)
2015- totevts=nevents
2016- for proc in processes:
2017- proc['lhefile'] = os.path.join(proc['folder'], proc['channel'], 'events.lhe')
2018- proc['nevents'] = 0
2019- while totevts :
2020- target = random.random() * totABS
2021- crosssum = 0.
2022- i = 0
2023- while i<len(processes) and crosssum < target:
2024- proc = processes[i]
2025- crosssum += proc['resultABS']
2026- i += 1
2027- totevts -= 1
2028- i -= 1
2029- processes[i]['nevents'] += 1
2030-
2031-#check that we now have all the events in the channels
2032- totevents = sum(proc['nevents'] for proc in processes)
2033- if totevents != nevents:
2034- sys.exit('failed to obtain the correct number of events. Required: %d, Obtained: %d' \
2035- % (nevents, totevents))
2036-
2037- content_evts = ''
2038- for proc in processes:
2039- content_evts+= ' '+proc['lhefile']+' %(nevents)10d %(resultABS)10.8e 1.0 \n' % proc
2040- nevts_file = open(os.path.join(proc['folder'], proc['channel'], 'nevts'),'w')
2041- nevts_file.write('%10d\n' % proc['nevents'])
2042- nevts_file.close()
2043- if proc['channel'][1] == 'B':
2044- fileinputs = open("madinMMC_B.2")
2045- elif proc['channel'][1] == 'F':
2046- fileinputs = open("madinMMC_F.2")
2047- elif proc['channel'][1] == 'V':
2048- fileinputs = open("madinMMC_V.2")
2049- else:
2050- sys.exit("ERROR, DONT KNOW WHICH INPUTS TO USE")
2051- fileinputschannel = open(os.path.join(proc['folder'], proc['channel'], 'madinM1'),'w')
2052- i=0
2053- for line in fileinputs:
2054- i += 1
2055- if i == 2:
2056- accuracy=min(math.sqrt(totABS/(req_acc2_inv*proc['resultABS'])),0.2)
2057- fileinputschannel.write('%10.8e\n' % accuracy)
2058- elif i == 8:
2059- fileinputschannel.write('1 ! MINT mode\n')
2060- else:
2061- fileinputschannel.write(line)
2062- fileinputschannel.close()
2063- fileinputs.close()
2064-
2065- evts_file = open('nevents_unweighted', 'w')
2066- evts_file.write(content_evts)
2067- evts_file.close()
2068-
2069-# if nevents = -1 and req_acc >= 0, we need to determine the required
2070-# accuracy in each of the channels: this is for fixed order running!
2071-elif req_acc>=0 and nevents==-1:
2072- req_accABS=req_acc*abs(tot)/totABS
2073- content_evts = ''
2074- for proc in processes:
2075- if proc['channel'][0:3] == 'all':
2076- fileinputs = open("madin.all")
2077- elif proc['channel'][0:4] == 'novB':
2078- fileinputs = open("madin.novB")
2079- elif proc['channel'][0:4] == 'born':
2080- fileinputs = open("madin.born")
2081- elif proc['channel'][0:4] == 'grid':
2082- fileinputs = open("madin.grid")
2083- elif proc['channel'][0:4] == 'viSB':
2084- fileinputs = open("madin.viSB")
2085- elif proc['channel'][0:4] == 'virt':
2086- fileinputs = open("madin.virt")
2087- elif proc['channel'][0:4] == 'novi':
2088- fileinputs = open("madin.novi")
2089- else:
2090- sys.exit("ERROR, DONT KNOW WHICH INPUTS TO USE")
2091- fileinputschannel = open(os.path.join(proc['folder'], proc['channel'], 'madinM1'),'w')
2092- i=0
2093- for line in fileinputs:
2094- i += 1
2095- if i == 2:
2096- accuracy=req_accABS*math.sqrt(totABS*proc['resultABS'])
2097- fileinputschannel.write('%10.8e\n' % accuracy)
2098- elif i == 9:
2099- fileinputschannel.write('-1 ! restart from existing grids\n')
2100- else:
2101- fileinputschannel.write(line)
2102- fileinputschannel.close()
2103- fileinputs.close()
2104
2105=== modified file 'Template/NLO/SubProcesses/symmetry_fks_test_ME.f'
2106--- Template/NLO/SubProcesses/symmetry_fks_test_ME.f 2015-06-30 14:50:39 +0000
2107+++ Template/NLO/SubProcesses/symmetry_fks_test_ME.f 2015-10-25 15:32:18 +0000
2108@@ -268,7 +268,7 @@
2109
2110 do iconfig=bs_min,bs_max ! Born configurations
2111 call setcuts
2112- call setfksfactor(iconfig)
2113+ call setfksfactor(iconfig,.false.)
2114 wgt=1d0
2115 ntry=1
2116
2117
2118=== modified file 'Template/NLO/SubProcesses/symmetry_fks_v3.f'
2119--- Template/NLO/SubProcesses/symmetry_fks_v3.f 2014-06-26 08:45:41 +0000
2120+++ Template/NLO/SubProcesses/symmetry_fks_v3.f 2015-10-25 15:32:18 +0000
2121@@ -177,7 +177,7 @@
2122 call printout
2123 call run_printout
2124 iconfig=1
2125- call setfksfactor(iconfig)
2126+ call setfksfactor(iconfig,.false.)
2127 c
2128 ndim = 55
2129 ncall = 10000
2130@@ -541,6 +541,8 @@
2131 lname=4
2132 mname='mg'
2133 call open_bash_file(26,fname,lname,mname)
2134+ call close_bash_file(26)
2135+ open(unit=26,file='channels.txt',status='unknown')
2136 ic = 0
2137 do i=1,mapconfig(0)
2138 if (use_config(i) .gt. 0) then
2139@@ -567,15 +569,6 @@
2140 done = .false.
2141 do while (.not. done)
2142 call enCode(icode,iarray,ibase,imax)
2143- ic=ic+1
2144- if (ic .gt. ChanPerJob) then
2145- call close_bash_file(26)
2146- fname='ajob'
2147- lname=4
2148- mname='mg'
2149- call open_bash_file(26,fname,lname,mname)
2150- ic = 1
2151- endif
2152 c write(*,*) 'mapping',ic,mapconfig(i)
2153 c$$$ if (r_from_b(mapconfig(i)) .lt. 10) then
2154 c$$$ write(26,'(i1$)') r_from_b(mapconfig(i))
2155@@ -611,7 +604,7 @@
2156 enddo
2157 endif
2158 enddo
2159- call close_bash_file(26)
2160+ close(26)
2161 if (mapconfig(0) .gt. 9999) then
2162 write(*,*) 'Only writing first 9999 jobs',mapconfig(0)
2163 endif
2164
2165=== modified file 'Template/NLO/SubProcesses/write_ajob.f'
2166--- Template/NLO/SubProcesses/write_ajob.f 2012-10-18 06:17:30 +0000
2167+++ Template/NLO/SubProcesses/write_ajob.f 2015-10-25 15:32:18 +0000
2168@@ -53,7 +53,7 @@
2169 if (index(buff,'TAGTAGTAGTAGTAG').ne.0) exit
2170 write(lun,15) buff
2171 enddo
2172- write(lun,'(a$)') 'for i in '
2173+ write(lun,'(a$)') 'for i in $channel '
2174 return
2175 99 write (*,*) 'ajob_template or ajob_template_cluster '/
2176 & /'does not have the correct format'
2177
2178=== modified file 'Template/loop_material/StandAlone/Cards/MadLoopParams.dat'
2179--- Template/loop_material/StandAlone/Cards/MadLoopParams.dat 2014-10-27 08:40:30 +0000
2180+++ Template/loop_material/StandAlone/Cards/MadLoopParams.dat 2015-10-25 15:32:18 +0000
2181@@ -4,8 +4,8 @@
2182
2183 !
2184 #MLReductionLib
2185-!1|4|3|2
2186-! Default :: 1|4|3|2
2187+!1|3|2
2188+! Default :: 1|3|2
2189 ! The tensor integral reduction library.The current choices are:
2190 ! 1 | CutTools
2191 ! 2 | PJFry++
2192
2193=== modified file 'UpdateNotes.txt'
2194--- UpdateNotes.txt 2015-09-07 18:05:30 +0000
2195+++ UpdateNotes.txt 2015-10-25 15:32:18 +0000
2196@@ -1,6 +1,28 @@
2197 Update notes for MadGraph5_aMC@NLO (in reverse time order)
2198
2199-2.3.2.2 (06/09/15)
2200+<<<<<<< TREE
2201+2.3.2.2 (06/09/15)
2202+=======
2203+2.3.3(XX/XX/XX)
2204+ OM: Allow new syntax for the param_card: instead of an entry you can enter scan:[val1, val2,...]
2205+ To perform a scan on this parameter.
2206+ OM: Having two mode for "output pythia8" one (default) for pythia8.2 and one for pythia8.1 (with --version=8.1)
2207+ RF: Rewriting of job-control for NLO processes. Better accuracy estimates for FO processes
2208+ RF: Fix for factorisation scale setting in FxFx merging when very large difference in scale in the
2209+ non-QCD part of a process.
2210+ RF: Better discarding of numerical instabilities in the real-emission matrix elements. Only of interested for
2211+ processes which have jets at Born level, but do not require generation cut (like t-channel single-top).
2212+ RF: Added an option to the run_card to allow for easier variation of the shower starting scale (NLO only).
2213+ RF: Fixed a problem in the setting of the flavour map used for runs with iAPPL >= 1.
2214+ RF: Allow for decay processes to compute (partial) decay widths at NLO accuracy (fixed order only).
2215+ OM: (SysCalc interface) Allow to bypass the pdf reweighting/alpsfact reweighting
2216+ MZ: fixed bug related to slurm clusters
2217+ OM: remove the addmasses.py script of running by default on gridpack mode.
2218+ if you want to have it running, you just have to rename the file madevent/bin/internal/addmasses_optional.py to
2219+ madevent/bin/internal/addmasses_optional.py and it will work as before. (Do not work with SysCalc tag)
2220+
2221+2.3.2.2 (06/09/15)
2222+>>>>>>> MERGE-SOURCE
2223 VH: Finalized the MG5aMC-GoSam interface
2224
2225 2.3.2(20/08/15)
2226
2227=== modified file 'VERSION'
2228--- VERSION 2015-09-07 18:04:08 +0000
2229+++ VERSION 2015-10-25 15:32:18 +0000
2230@@ -1,5 +1,10 @@
2231+<<<<<<< TREE
2232 version = 2.3.2.2
2233 date = 2015-09-06
2234+=======
2235+version = 2.3.3
2236+date = 2015-10-20
2237+>>>>>>> MERGE-SOURCE
2238
2239
2240
2241
2242=== modified file 'aloha/__init__.py' (properties changed: -x to +x)
2243=== modified file 'aloha/aloha_fct.py' (properties changed: -x to +x)
2244=== modified file 'aloha/aloha_lib.py' (properties changed: -x to +x)
2245--- aloha/aloha_lib.py 2015-07-30 15:43:54 +0000
2246+++ aloha/aloha_lib.py 2015-10-25 15:32:18 +0000
2247@@ -1073,9 +1073,9 @@
2248 self[(0,)] = representation[(0,)]
2249 except Exception:
2250 if representation:
2251- raise LorentzObjectRepresentation.LorentzObjectRepresentationError("There is no key of (0,) in representation.")
2252+ raise LorentzObjectRepresentation.LorentzObjectRepresentationError("There is no key of (0,) in representation.")
2253 else:
2254- self[(0,)] = 0
2255+ self[(0,)] = 0
2256 else:
2257 self[(0,)] = representation
2258
2259
2260=== modified file 'aloha/aloha_object.py' (properties changed: -x to +x)
2261--- aloha/aloha_object.py 2014-02-18 21:45:48 +0000
2262+++ aloha/aloha_object.py 2015-10-25 15:32:18 +0000
2263@@ -434,12 +434,12 @@
2264 self.sub11 = aloha_lib.Variable('T%s_6' % self.particle)
2265 self.sub12 = aloha_lib.Variable('T%s_7' % self.particle)
2266 self.sub13 = aloha_lib.Variable('T%s_8' % self.particle)
2267-
2268+
2269 self.sub20 = aloha_lib.Variable('T%s_9' % self.particle)
2270 self.sub21 = aloha_lib.Variable('T%s_10' % self.particle)
2271 self.sub22 = aloha_lib.Variable('T%s_11' % self.particle)
2272 self.sub23 = aloha_lib.Variable('T%s_12' % self.particle)
2273-
2274+
2275 self.sub30 = aloha_lib.Variable('T%s_13' % self.particle)
2276 self.sub31 = aloha_lib.Variable('T%s_14' % self.particle)
2277 self.sub32 = aloha_lib.Variable('T%s_15' % self.particle)
2278
2279=== modified file 'aloha/aloha_parsers.py' (properties changed: -x to +x)
2280=== modified file 'aloha/aloha_writers.py' (properties changed: -x to +x)
2281--- aloha/aloha_writers.py 2014-12-11 15:23:43 +0000
2282+++ aloha/aloha_writers.py 2015-10-25 15:32:18 +0000
2283@@ -689,7 +689,7 @@
2284 if number.imag == 1:
2285 out = 'CI'
2286 elif number.imag == -1:
2287- out = '-CI'
2288+ out = '-CI'
2289 else:
2290 out = '%s * CI' % self.change_number_format(number.imag)
2291 else:
2292
2293=== modified file 'aloha/create_aloha.py' (properties changed: -x to +x)
2294--- aloha/create_aloha.py 2015-06-28 14:44:22 +0000
2295+++ aloha/create_aloha.py 2015-10-25 15:32:18 +0000
2296@@ -854,7 +854,7 @@
2297 # reorganize the data (in order to use optimization for a given lorentz
2298 #structure
2299 aloha.loop_mode = False
2300- # self.explicit_combine = False
2301+ # self.explicit_combine = False
2302 request = {}
2303
2304 for list_l_name, tag, outgoing in data:
2305
2306=== modified file 'aloha/template_files/__init__.py' (properties changed: -x to +x)
2307=== modified file 'aloha/template_files/aloha_functions_loop.f'
2308--- aloha/template_files/aloha_functions_loop.f 2013-11-29 07:28:53 +0000
2309+++ aloha/template_files/aloha_functions_loop.f 2015-10-25 15:32:18 +0000
2310@@ -86,6 +86,7 @@
2311
2312 pp = min(p(0),dsqrt(p(1)**2+p(2)**2+p(3)**2))
2313
2314+
2315 if ( pp.eq.rZero ) then
2316
2317 sqm(0) = dsqrt(abs(fmass)) ! possibility of negative fermion masses
2318@@ -477,13 +478,13 @@
2319
2320 sqm(0) = dsqrt(abs(fmass)) ! possibility of negative fermion masses
2321 sqm(1) = sign(sqm(0),fmass) ! possibility of negative fermion masses
2322- ip = -((1+nh)/2)
2323- im = (1-nh)/2
2324
2325- fo(5) = im * sqm(im)
2326- fo(6) = ip*nsf * sqm(im)
2327- fo(7) = im*nsf * sqm(-ip)
2328- fo(8) = ip * sqm(-ip)
2329+ im = nhel * (1+nh)/2
2330+ ip = nhel * -1 * ((1-nh)/2)
2331+ fo(5) = im * sqm(abs(ip))
2332+ fo(6) = ip*nsf * sqm(abs(ip))
2333+ fo(7) = im*nsf * sqm(abs(im))
2334+ fo(8) = ip * sqm(abs(im))
2335
2336 else
2337
2338
2339=== modified file 'aloha/template_files/wavefunctions.py' (properties changed: -x to +x)
2340--- aloha/template_files/wavefunctions.py 2013-07-23 16:48:52 +0000
2341+++ aloha/template_files/wavefunctions.py 2015-10-25 15:32:18 +0000
2342@@ -316,7 +316,7 @@
2343 elif nhel == 1:
2344 for j in range(4):
2345 for i in range(4):
2346- ft[(i,j)] = sqh*( ep[i]*e0[j] + e0[i]*ep[j] )
2347+ ft[(i,j)] = sqh*( ep[i]*e0[j] + e0[i]*ep[j] )
2348 elif nhel == 0:
2349 for j in range(4):
2350 for i in range(4):
2351@@ -324,10 +324,10 @@
2352 elif nhel == -1:
2353 for j in range(4):
2354 for i in range(4):
2355- ft[(i,j)] = sqh*( em[i]*e0[j] + e0[i]*em[j] )
2356+ ft[(i,j)] = sqh*( em[i]*e0[j] + e0[i]*em[j] )
2357
2358 else:
2359- raise Exception, 'invalid helicity TXXXXXX'
2360+ raise Exception, 'invalid helicity TXXXXXX'
2361
2362
2363
2364
2365=== modified file 'bin/mg5'
2366--- bin/mg5 2014-07-17 13:34:15 +0000
2367+++ bin/mg5 2015-10-25 15:32:18 +0000
2368@@ -28,6 +28,6 @@
2369
2370 sys.argv.pop(0)
2371 if __debug__:
2372- os.system('%s %s %s' %(sys.executable, str(exe_path) , ' '.join(sys.argv) ))
2373+ os.system('%s -tt %s %s' %(sys.executable, str(exe_path) , ' '.join(sys.argv) ))
2374 else:
2375 os.system('%s -O %s %s' %(sys.executable, str(exe_path) , ' '.join(sys.argv) ))
2376
2377=== modified file 'input/.mg5_configuration_default.txt'
2378--- input/.mg5_configuration_default.txt 2015-08-14 13:56:58 +0000
2379+++ input/.mg5_configuration_default.txt 2015-10-25 15:32:18 +0000
2380@@ -84,6 +84,9 @@
2381 #! Allow/Forbid the automatic opening of the web browser (on the status page)
2382 #! when launching MadEvent [True/False]
2383 # automatic_html_opening = True
2384+#! allow notification of finished job in the notification center (Mac Only)
2385+# notification_center = True
2386+
2387
2388 #! Default Running mode
2389 #! 0: single machine/ 1: cluster / 2: multicore
2390
2391=== modified file 'madgraph/__init__.py' (properties changed: -x to +x)
2392=== modified file 'madgraph/core/__init__.py' (properties changed: -x to +x)
2393=== modified file 'madgraph/core/base_objects.py' (properties changed: -x to +x)
2394--- madgraph/core/base_objects.py 2015-08-16 22:19:30 +0000
2395+++ madgraph/core/base_objects.py 2015-10-25 15:32:18 +0000
2396@@ -202,8 +202,8 @@
2397
2398 sorted_keys = ['name', 'antiname', 'spin', 'color',
2399 'charge', 'mass', 'width', 'pdg_code',
2400- 'texname', 'antitexname', 'line', 'propagating', 'propagator',
2401- 'is_part', 'self_antipart', 'ghost', 'counterterm']
2402+ 'line', 'propagator',
2403+ 'is_part', 'self_antipart', 'type', 'counterterm']
2404
2405 def default_setup(self):
2406 """Default values for all properties"""
2407@@ -216,19 +216,55 @@
2408 self['mass'] = 'ZERO'
2409 self['width'] = 'ZERO'
2410 self['pdg_code'] = 0
2411- self['texname'] = 'none'
2412- self['antitexname'] = 'none'
2413+ #self['texname'] = 'none'
2414+ #self['antitexname'] = 'none'
2415 self['line'] = 'dashed'
2416- self['propagating'] = True
2417+ #self['propagating'] = True -> removed in favor or 'line' = None
2418 self['propagator'] = ''
2419 self['is_part'] = True
2420 self['self_antipart'] = False
2421 # True if ghost, False otherwise
2422- self['ghost'] = False
2423+ #self['ghost'] = False
2424+ self['type'] = '' # empty means normal can also be ghost or goldstone
2425 # Counterterm defined as a dictionary with format:
2426 # ('ORDER_OF_COUNTERTERM',((Particle_list_PDG))):{laurent_order:CTCouplingName}
2427 self['counterterm'] = {}
2428
2429+ def get(self, name):
2430+
2431+ if name == 'ghost':
2432+ return self['type'] == 'ghost'
2433+ elif name == 'goldstone':
2434+ return self['type'] == 'goldstone'
2435+ elif name == 'propagating':
2436+ return self['line'] is not None
2437+ else:
2438+ return super(Particle, self).get(name)
2439+
2440+ def set(self, name, value, force=False):
2441+
2442+ if name in ['texname', 'antitexname']:
2443+ return True
2444+ elif name == 'propagating':
2445+ if not value:
2446+ return self.set('line', None, force=force)
2447+ elif not self.get('line'):
2448+ return self.set('line', 'dashed',force=force)
2449+ return True
2450+ elif name in ['ghost', 'goldstone']:
2451+ if self.get('type') == name:
2452+ if value:
2453+ return True
2454+ else:
2455+ return self.set('type', '', force=force)
2456+ else:
2457+ if value:
2458+ return self.set('type', name, force=force)
2459+ else:
2460+ return True
2461+ return super(Particle, self).set(name, value,force=force)
2462+
2463+
2464 def filter(self, name, value):
2465 """Filter for valid particle property values."""
2466
2467@@ -1213,7 +1249,7 @@
2468 if isinstance(id, int):
2469 try:
2470 return self.get("particle_dict")[id]
2471- except Exception:
2472+ except Exception,error:
2473 return None
2474 else:
2475 if not hasattr(self, 'name2part'):
2476@@ -1547,9 +1583,9 @@
2477 def write_param_card(self):
2478 """Write out the param_card, and return as string."""
2479
2480- import models.write_param_card as writter
2481+ import models.write_param_card as writer
2482 out = StringIO.StringIO() # it's suppose to be written in a file
2483- param = writter.ParamCardWriter(self)
2484+ param = writer.ParamCardWriter(self)
2485 param.define_output_file(out)
2486 param.write_card()
2487 return out.getvalue()
2488@@ -1577,55 +1613,118 @@
2489 def change_electroweak_mode(self, mode):
2490 """Change the electroweak mode. The only valid mode now is external.
2491 Where in top of the default MW and sw2 are external parameters."""
2492-
2493- assert mode == "external"
2494+
2495+ assert mode in ["external",set(['mz','mw','alpha'])]
2496
2497 try:
2498 W = self.get('particle_dict')[24]
2499 except KeyError:
2500- raise InvalidCmd('No W particle in the model impossible to change the EW scheme!')
2501+ raise InvalidCmd('No W particle in the model impossible to '+
2502+ 'change the EW scheme!')
2503
2504- MW = self.get_parameter(W.get('mass'))
2505- if not isinstance(MW, ParamCardVariable):
2506- newMW = ParamCardVariable(MW.name, MW.value, 'MASS', [24])
2507- if not newMW.value:
2508- newMW.value = 80.385
2509- #remove the old definition
2510- self.get('parameters')[MW.depend].remove(MW)
2511- # add the new one
2512- self.add_param(newMW, ['external'])
2513-
2514- # Now check for sw2. if not define bypass this
2515- try:
2516- sw2 = self.get_parameter('sw2')
2517- except KeyError:
2518+ if mode=='external':
2519+ MW = self.get_parameter(W.get('mass'))
2520+ if not isinstance(MW, ParamCardVariable):
2521+ newMW = ParamCardVariable(MW.name, MW.value, 'MASS', [24])
2522+ if not newMW.value:
2523+ newMW.value = 80.385
2524+ #remove the old definition
2525+ self.get('parameters')[MW.depend].remove(MW)
2526+ # add the new one
2527+ self.add_param(newMW, ['external'])
2528+
2529+ # Now check for sw2. if not define bypass this
2530 try:
2531- sw2 = self.get_parameter('mdl_sw2')
2532+ sw2 = self.get_parameter('sw2')
2533 except KeyError:
2534- sw2=None
2535-
2536- if sw2:
2537- newsw2 = ParamCardVariable(sw2.name,sw2.value, 'SMINPUTS', [4])
2538- if not newsw2.value:
2539- newsw2.value = 0.222246485786
2540- #remove the old definition
2541- self.get('parameters')[sw2.depend].remove(sw2)
2542- # add the new one
2543- self.add_param(newsw2, ['external'])
2544-
2545- def change_mass_to_complex_scheme(self):
2546+ try:
2547+ sw2 = self.get_parameter('mdl_sw2')
2548+ except KeyError:
2549+ sw2=None
2550+
2551+ if sw2:
2552+ newsw2 = ParamCardVariable(sw2.name,sw2.value, 'SMINPUTS', [4])
2553+ if not newsw2.value:
2554+ newsw2.value = 0.222246485786
2555+ #remove the old definition
2556+ self.get('parameters')[sw2.depend].remove(sw2)
2557+ # add the new one
2558+ self.add_param(newsw2, ['external'])
2559+ # Force a refresh of the parameter dictionary
2560+ self.parameters_dict = None
2561+ return true
2562+
2563+ elif mode==set(['mz','mw','alpha']):
2564+ # For now, all we support is to go from mz, Gf, alpha to mz, mw, alpha
2565+ W = self.get('particle_dict')[24]
2566+ mass = self.get_parameter(W.get('mass'))
2567+ mass_expr = 'cmath.sqrt(%(prefix)sMZ__exp__2/2. + cmath.sqrt('+\
2568+ '%(prefix)sMZ__exp__4/4. - (%(prefix)saEW*cmath.pi*%(prefix)s'+\
2569+ 'MZ__exp__2)/(%(prefix)sGf*%(prefix)ssqrt__2)))'
2570+ if 'external' in mass.depend:
2571+ # Nothing to be done
2572+ return True
2573+ match = False
2574+ if mass.expr == mass_expr%{'prefix':''}:
2575+ prefix = ''
2576+ match = True
2577+ elif mass.expr == mass_expr%{'prefix':'mdl_'}:
2578+ prefix = 'mdl_'
2579+ match = True
2580+ if match:
2581+ MW = ParamCardVariable(mass.name, mass.value, 'MASS', [24])
2582+ if not MW.value:
2583+ MW.value = 80.385
2584+ self.get('parameters')[('external',)].append(MW)
2585+ self.get('parameters')[mass.depend].remove(mass)
2586+ # Make Gf an internal parameter
2587+ new_param = ModelVariable('Gf',
2588+ '-%(prefix)saEW*%(prefix)sMZ**2*cmath.pi/(cmath.sqrt(2)*%(MW)s**2*(%(MW)s**2 - %(prefix)sMZ**2))' %\
2589+ {'MW': mass.name,'prefix':prefix}, 'complex', mass.depend)
2590+ Gf = self.get_parameter('%sGf'%prefix)
2591+ self.get('parameters')[('external',)].remove(Gf)
2592+ self.add_param(new_param, ['%saEW'%prefix])
2593+ # Force a refresh of the parameter dictionary
2594+ self.parameters_dict = None
2595+ return True
2596+ else:
2597+ return False
2598+
2599+ def change_mass_to_complex_scheme(self, toCMS=True):
2600 """modify the expression changing the mass to complex mass scheme"""
2601
2602- # 1) Find All input parameter mass and width associated
2603+ # 1) Change the 'CMSParam' of loop_qcd_qed model to 1.0 so as to remove
2604+ # the 'real' prefix fromall UVCT wf renormalization expressions.
2605+ # If toCMS is False, then it makes sure CMSParam is 0.0 and returns
2606+ # immediatly.
2607+ # 2) Find All input parameter mass and width associated
2608 # Add a internal parameter and replace mass with that param
2609- # 2) Find All mass fixed by the model and width associated
2610+ # 3) Find All mass fixed by the model and width associated
2611 # -> Both need to be fixed with a real() /Imag()
2612- # 3) Find All width fixed by the model
2613- # -> Need to be fixed with a real()
2614- # 4) Fix the Yukawa mass to the value of the complex mass/ real mass
2615- # 5) Loop through all expression and modify those accordingly
2616+ # 4) Find All width set by the model
2617+ # -> Need to be set with a real()
2618+ # 5) Fix the Yukawa mass to the value of the complex mass/ real mass
2619+ # 6) Loop through all expression and modify those accordingly
2620 # Including all parameter expression as complex
2621-
2622+
2623+ try:
2624+ CMSParam = self.get_parameter('CMSParam')
2625+ except KeyError:
2626+ try:
2627+ CMSParam = self.get_parameter('mdl_CMSParam')
2628+ except KeyError:
2629+ CMSParam = None
2630+
2631+ # Handle the case where we want to make sure the CMS is turned off
2632+ if not toCMS:
2633+ if CMSParam:
2634+ CMSParam.expr = '0.0'
2635+ return
2636+
2637+ # Now handle the case where we want to turn to CMS.
2638+ if CMSParam:
2639+ CMSParam.expr = '1.0'
2640+
2641 to_change = {}
2642 mass_widths = [] # parameter which should stay real
2643 for particle in self.get('particles'):
2644@@ -1634,52 +1733,29 @@
2645 continue
2646 mass_widths.append(particle.get('width'))
2647 mass_widths.append(particle.get('mass'))
2648- if particle.get('width') == 'ZERO':
2649+ width = self.get_parameter(particle.get('width'))
2650+ if (isinstance(width.value, (complex,float)) and abs(width.value)==0.0) or \
2651+ width.name.lower() =='zero':
2652 #everything is fine since the width is zero
2653 continue
2654- width = self.get_parameter(particle.get('width'))
2655 if not isinstance(width, ParamCardVariable):
2656 width.expr = 're(%s)' % width.expr
2657- if particle.get('mass') != 'ZERO':
2658- mass = self.get_parameter(particle.get('mass'))
2659+ mass = self.get_parameter(particle.get('mass'))
2660+ if (isinstance(width.value, (complex,float)) and abs(width.value)!=0.0) or \
2661+ mass.name.lower() != 'zero':
2662 # special SM treatment to change the gauge scheme automatically.
2663- if particle.get('pdg_code') == 24:
2664- if hasattr(mass, 'expr') and mass.expr == 'cmath.sqrt(MZ__exp__2/2. + cmath.sqrt(MZ__exp__4/4. - (aEW*cmath.pi*MZ__exp__2)/(Gf*sqrt__2)))':
2665- # Make MW an external parameter
2666- MW = ParamCardVariable(mass.name, mass.value, 'MASS', [24])
2667- if not MW.value:
2668- MW.value = 80.385
2669- self.get('parameters')[('external',)].append(MW)
2670- self.get('parameters')[mass.depend].remove(mass)
2671- # Make Gf an internal parameter
2672- new_param = ModelVariable('Gf',
2673- '-aEW*MZ**2*cmath.pi/(cmath.sqrt(2)*%(MW)s**2*(%(MW)s**2 - MZ**2))' %\
2674- {'MW': mass.name}, 'complex', mass.depend)
2675- Gf = self.get_parameter('Gf')
2676- self.get('parameters')[('external',)].remove(Gf)
2677- self.add_param(new_param, ['aEW'])
2678- # Use the new mass for the future modification
2679- mass = MW
2680- #option with prefixing
2681- elif hasattr(mass, 'expr') and mass.expr == 'cmath.sqrt(mdl_MZ__exp__2/2. + cmath.sqrt(mdl_MZ__exp__4/4. - (mdl_aEW*cmath.pi*mdl_MZ__exp__2)/(mdl_Gf*mdl_sqrt__2)))':
2682- # Make MW an external parameter
2683- MW = ParamCardVariable(mass.name, mass.value, 'MASS', [24])
2684- if not MW.value:
2685- MW.value = 80.385
2686- self.get('parameters')[('external',)].append(MW)
2687- self.get('parameters')[mass.depend].remove(mass)
2688- # Make Gf an internal parameter
2689- new_param = ModelVariable('mdl_Gf',
2690- '-mdl_aEW*mdl_MZ**2*cmath.pi/(cmath.sqrt(2)*%(MW)s**2*(%(MW)s**2 - mdl_MZ**2))' %\
2691- {'MW': mass.name}, 'complex', mass.depend)
2692- Gf = self.get_parameter('mdl_Gf')
2693- self.get('parameters')[('external',)].remove(Gf)
2694- self.add_param(new_param, ['mdl_aEW'])
2695- # Use the new mass for the future modification
2696- mass = MW
2697- elif isinstance(mass, ModelVariable):
2698- logger.warning('W mass is not an external parameter. This is not adviced for the complex mass scheme.')
2699-
2700+ if particle.get('pdg_code') == 24 and isinstance(mass,
2701+ ModelVariable):
2702+ status = self.change_electroweak_mode(
2703+ set(['mz','mw','alpha']))
2704+ # Use the newly defined parameter for the W mass
2705+ mass = self.get_parameter(particle.get('mass'))
2706+ if not status:
2707+ logger.warning('The W mass is not an external '+
2708+ 'parameter in this model and the automatic change of'+
2709+ ' electroweak scheme changed. This is not advised for '+
2710+ 'applying the complex mass scheme.')
2711+
2712 # Add A new parameter CMASS
2713 #first compute the dependencies (as,...)
2714 depend = list(set(mass.depend + width.depend))
2715@@ -3638,7 +3714,7 @@
2716 my_isids = [leg.get('ids') for leg in self.get('legs') \
2717 if not leg.get('state')]
2718 my_fsids = [leg.get('ids') for leg in self.get('legs') \
2719- if leg.get('state')]
2720+ if leg.get('state')]
2721 for i, is_id in enumerate(initial_state_ids):
2722 assert is_id in my_isids[i]
2723 for i, fs_id in enumerate(final_state_ids):
2724
2725=== modified file 'madgraph/core/color_algebra.py' (properties changed: -x to +x)
2726=== modified file 'madgraph/core/color_amp.py' (properties changed: -x to +x)
2727=== modified file 'madgraph/core/diagram_generation.py' (properties changed: -x to +x)
2728--- madgraph/core/diagram_generation.py 2015-06-28 14:44:22 +0000
2729+++ madgraph/core/diagram_generation.py 2015-10-25 15:32:18 +0000
2730@@ -26,7 +26,8 @@
2731
2732 import madgraph.core.base_objects as base_objects
2733 import madgraph.various.misc as misc
2734-from madgraph import InvalidCmd
2735+from madgraph import InvalidCmd, MadGraph5Error
2736+
2737 logger = logging.getLogger('madgraph.diagram_generation')
2738
2739
2740@@ -1552,7 +1553,7 @@
2741 "%s is not a valid ProcessDefinitionList object" % str(value)
2742
2743 if name == 'amplitudes':
2744- if not isinstance(value, diagram_generation.AmplitudeList):
2745+ if not isinstance(value, AmplitudeList):
2746 raise self.PhysicsObjectError, \
2747 "%s is not a valid AmplitudeList object" % str(value)
2748
2749
2750=== modified file 'madgraph/core/drawing.py' (properties changed: -x to +x)
2751--- madgraph/core/drawing.py 2014-10-07 05:52:01 +0000
2752+++ madgraph/core/drawing.py 2015-10-25 15:32:18 +0000
2753@@ -1131,8 +1131,8 @@
2754 return []
2755
2756 assert self.min_level <= level <= self.max_level , \
2757- 'Incorrect value of min/max level: %s <= %s <= %s' % \
2758- (self.min_level, level, self.max_level)
2759+ 'Incorrect value of min/max level: %s <= %s <= %s' % \
2760+ (self.min_level, level, self.max_level)
2761
2762
2763 # At final level we should authorize min=0 and max=1 position
2764@@ -1188,7 +1188,7 @@
2765 # Assign position to each vertex
2766 for i, vertex in enumerate(vertex_at_level):
2767 vertex.def_position((level - self.min_level) / self.nb_level,
2768- min + dist * (begin_gap + i))
2769+ min + dist * (begin_gap + i))
2770
2771 return vertex_at_level
2772
2773
2774=== modified file 'madgraph/core/helas_objects.py' (properties changed: -x to +x)
2775--- madgraph/core/helas_objects.py 2015-07-02 02:29:22 +0000
2776+++ madgraph/core/helas_objects.py 2015-10-25 15:32:18 +0000
2777@@ -3164,7 +3164,7 @@
2778 """Calculate the actual coupling orders of this diagram"""
2779
2780 wavefunctions = HelasWavefunctionList.extract_wavefunctions(\
2781- self.get('amplitudes')[0].get('mothers'))
2782+ self.get('amplitudes')[0].get('mothers'))
2783
2784 coupling_orders = {}
2785 for wf in wavefunctions + [self.get('amplitudes')[0]]:
2786
2787=== modified file 'madgraph/fks/__init__.py' (properties changed: -x to +x)
2788=== modified file 'madgraph/fks/fks_base.py' (properties changed: -x to +x)
2789--- madgraph/fks/fks_base.py 2015-05-25 20:43:18 +0000
2790+++ madgraph/fks/fks_base.py 2015-10-25 15:32:18 +0000
2791@@ -132,6 +132,9 @@
2792 perturbation = []
2793 for procdef in self['process_definitions']:
2794 soft_particles = []
2795+ # do not warn for decay processes
2796+ if [ i['state'] for i in procdef['legs']].count(False) == 1:
2797+ continue
2798 for pert in procdef['perturbation_couplings']:
2799 if pert not in perturbation:
2800 perturbation.append(pert)
2801@@ -550,10 +553,19 @@
2802 """finds the FKS real configurations for a given process"""
2803 if range(len(self.leglist)) != [l['number']-1 for l in self.leglist]:
2804 raise fks_common.FKSProcessError('Disordered numbers of leglist')
2805+
2806+ if [ i['state'] for i in self.leglist].count(False) == 1:
2807+ decay_process=True
2808+ else:
2809+ decay_process=False
2810+
2811 for i in self.leglist:
2812 i_i = i['number'] - 1
2813 self.reals.append([])
2814- self.splittings[i_i] = fks_common.find_splittings(i, self.born_proc['model'], {}, pert_order)
2815+ if decay_process and not i['state']:
2816+ self.splittings[i_i]=[]
2817+ else:
2818+ self.splittings[i_i] = fks_common.find_splittings(i, self.born_proc['model'], {}, pert_order)
2819 for split in self.splittings[i_i]:
2820 self.reals[i_i].append(
2821 fks_common.insert_legs(self.leglist, i, split,pert=pert_order))
2822
2823=== modified file 'madgraph/fks/fks_common.py' (properties changed: -x to +x)
2824=== modified file 'madgraph/fks/fks_helas_objects.py' (properties changed: -x to +x)
2825=== modified file 'madgraph/interface/__init__.py' (properties changed: -x to +x)
2826=== modified file 'madgraph/interface/amcatnlo_interface.py' (properties changed: -x to +x)
2827--- madgraph/interface/amcatnlo_interface.py 2015-08-12 20:50:38 +0000
2828+++ madgraph/interface/amcatnlo_interface.py 2015-10-25 15:32:18 +0000
2829@@ -30,6 +30,7 @@
2830 import madgraph.interface.extended_cmd as cmd
2831 import madgraph.interface.madgraph_interface as mg_interface
2832 import madgraph.interface.madevent_interface as me_interface
2833+import madgraph.interface.extended_cmd as extended_cmd
2834 import madgraph.interface.amcatnlo_run_interface as run_interface
2835 import madgraph.interface.launch_ext_program as launch_ext
2836 import madgraph.interface.loop_interface as Loop_interface
2837@@ -540,10 +541,22 @@
2838 for me in self._curr_matrix_elements.get_matrix_elements():
2839 uid += 1 # update the identification number
2840 me.get('processes')[0].set('uid', uid)
2841+ try:
2842+ initial_states.append(sorted(list(set((p.get_initial_pdg(1),p.get_initial_pdg(2)) for \
2843+ p in me.born_matrix_element.get('processes')))))
2844+ except IndexError:
2845+ initial_states.append(sorted(list(set((p.get_initial_pdg(1)) for \
2846+ p in me.born_matrix_element.get('processes')))))
2847+
2848 for fksreal in me.real_processes:
2849 # Pick out all initial state particles for the two beams
2850- initial_states.append(sorted(list(set((p.get_initial_pdg(1),p.get_initial_pdg(2)) for \
2851- p in fksreal.matrix_element.get('processes')))))
2852+ try:
2853+ initial_states.append(sorted(list(set((p.get_initial_pdg(1),p.get_initial_pdg(2)) for \
2854+ p in fksreal.matrix_element.get('processes')))))
2855+ except IndexError:
2856+ initial_states.append(sorted(list(set((p.get_initial_pdg(1)) for \
2857+ p in fksreal.matrix_element.get('processes')))))
2858+
2859
2860 # remove doubles from the list
2861 checked = []
2862@@ -569,10 +582,10 @@
2863
2864 #_curr_matrix_element is a FKSHelasMultiProcess Object
2865 self._fks_directories = []
2866- proc_charac = banner_mod.ProcCharacteristic()
2867+ proc_charac = self._curr_exporter.proc_characteristic
2868 for charac in ['has_isr', 'has_fsr', 'has_loops']:
2869 proc_charac[charac] = self._curr_matrix_elements[charac]
2870- proc_charac.write(pjoin(path, 'proc_characteristics'))
2871+
2872
2873 for ime, me in \
2874 enumerate(self._curr_matrix_elements.get('matrix_elements')):
2875@@ -624,7 +637,7 @@
2876 # self.options['automatic_html_opening'] = False
2877
2878 if options['interactive']:
2879- if hasattr(self, 'do_shell'):
2880+ if isinstance(self, extended_cmd.CmdShell):
2881 ME = run_interface.aMCatNLOCmdShell(me_dir=argss[0], options=self.options)
2882 else:
2883 ME = run_interface.aMCatNLOCmd(me_dir=argss[0],options=self.options)
2884@@ -636,7 +649,9 @@
2885 stop = self.define_child_cmd_interface(ME)
2886 return stop
2887
2888- ext_program = launch_ext.aMCatNLOLauncher(argss[0], self, run_mode=argss[1], **options)
2889+ ext_program = launch_ext.aMCatNLOLauncher(argss[0], self, run_mode=argss[1],
2890+ shell = isinstance(self, extended_cmd.CmdShell),
2891+ **options)
2892 ext_program.run()
2893
2894
2895
2896=== modified file 'madgraph/interface/amcatnlo_run_interface.py' (properties changed: -x to +x)
2897--- madgraph/interface/amcatnlo_run_interface.py 2015-09-05 17:49:40 +0000
2898+++ madgraph/interface/amcatnlo_run_interface.py 2015-10-25 15:32:18 +0000
2899@@ -119,6 +119,11 @@
2900 #this can be improved/better written to handle the output
2901 misc.call(['./%s' % (test)], cwd=this_dir,
2902 stdin = open(input), stdout=open(pjoin(this_dir, '%s.log' % test), 'w'))
2903+ if test == 'check_poles' and os.path.exists(pjoin(this_dir,'MadLoop5_resources')) :
2904+ tf=tarfile.open(pjoin(this_dir,'MadLoop5_resources.tar.gz'),'w:gz',
2905+ dereference=True)
2906+ tf.add(pjoin(this_dir,'MadLoop5_resources'),arcname='MadLoop5_resources')
2907+ tf.close()
2908
2909 if not options['reweightonly']:
2910 misc.compile(['gensym'], cwd=this_dir, job_specs = False)
2911@@ -1155,7 +1160,7 @@
2912 functions, such as generate_events or calculate_xsect
2913 mode gives the list of switch needed for the computation (usefull for banner_run)
2914 """
2915-
2916+
2917 if not argss and not options:
2918 self.start_time = time.time()
2919 argss = self.split_arg(line)
2920@@ -1164,6 +1169,7 @@
2921 options = options.__dict__
2922 self.check_launch(argss, options)
2923
2924+
2925 if 'run_name' in options.keys() and options['run_name']:
2926 self.run_name = options['run_name']
2927 # if a dir with the given run_name already exists
2928@@ -1183,6 +1189,7 @@
2929
2930 if not switch:
2931 mode = argss[0]
2932+
2933 if mode in ['LO', 'NLO']:
2934 options['parton'] = True
2935 mode = self.ask_run_configuration(mode, options)
2936@@ -1202,7 +1209,7 @@
2937 self.compile(mode, options)
2938 evt_file = self.run(mode, options)
2939
2940- if int(self.run_card['nevents']) == 0 and not mode in ['LO', 'NLO']:
2941+ if self.run_card['nevents'] == 0 and not mode in ['LO', 'NLO']:
2942 logger.info('No event file generated: grids have been set-up with a '\
2943 'relative precision of %s' % self.run_card['req_acc'])
2944 return
2945@@ -1222,14 +1229,48 @@
2946
2947
2948 self.update_status('', level='all', update_results=True)
2949- if int(self.run_card['ickkw']) == 3 and mode in ['noshower', 'aMC@NLO']:
2950+ if self.run_card['ickkw'] == 3 and mode in ['noshower', 'aMC@NLO']:
2951 logger.warning("""You are running with FxFx merging enabled.
2952 To be able to merge samples of various multiplicities without double counting,
2953 you have to remove some events after showering 'by hand'.
2954 Please read http://amcatnlo.cern.ch/FxFx_merging.htm for more details.""")
2955
2956
2957-
2958+ #check if the param_card defines a scan.
2959+ if self.param_card_iterator:
2960+ param_card_iterator = self.param_card_iterator
2961+ self.param_card_iterator = [] #avoid to next generate go trough here
2962+ param_card_iterator.store_entry(self.run_name, self.results.current['cross'])
2963+ orig_name = self.run_name
2964+ #go trough the scal
2965+ with misc.TMP_variable(self, 'allow_notification_center', False):
2966+ for i,card in enumerate(param_card_iterator):
2967+ card.write(pjoin(self.me_dir,'Cards','param_card.dat'))
2968+ if not options['force']:
2969+ options['force'] = True
2970+ if options['run_name']:
2971+ options['run_name'] = '%s_%s' % (orig_name, i+1)
2972+ if not argss:
2973+ argss = [mode, "-f"]
2974+ elif argss[0] == "auto":
2975+ argss[0] = mode
2976+ self.do_launch("", options=options, argss=argss, switch=switch)
2977+ #self.exec_cmd("launch -f ",precmd=True, postcmd=True,errorhandling=False)
2978+ param_card_iterator.store_entry(self.run_name, self.results.current['cross'])
2979+ #restore original param_card
2980+ param_card_iterator.write(pjoin(self.me_dir,'Cards','param_card.dat'))
2981+ name = misc.get_scan_name(orig_name, self.run_name)
2982+ path = pjoin(self.me_dir, 'Events','scan_%s.txt' % name)
2983+ logger.info("write all cross-section results in %s" % path, '$MG:color:BLACK')
2984+ param_card_iterator.write_summary(path)
2985+
2986+ if self.allow_notification_center:
2987+ misc.apple_notify('Run %s finished' % os.path.basename(self.me_dir),
2988+ '%s: %s +- %s ' % (self.results.current['run_name'],
2989+ self.results.current['cross'],
2990+ self.results.current['error']))
2991+
2992+
2993 ############################################################################
2994 def do_compile(self, line):
2995 """Advanced commands: just compile the executables """
2996@@ -1248,59 +1289,11 @@
2997
2998 self.update_status('', level='all', update_results=True)
2999
3000- def print_results_in_shell(self, data):
3001- """Have a nice results prints in the shell,
3002- data should be of type: gen_crossxhtml.OneTagResults"""
3003- if not data:
3004- return
3005- logger.info(" === Results Summary for run: %s tag: %s ===\n" % (data['run_name'],data['tag']))
3006- if self.ninitial == 1:
3007- logger.info(" Width : %.4g +- %.4g GeV" % (data['cross'], data['error']))
3008- else:
3009- logger.info(" Cross-section : %.4g +- %.4g pb" % (data['cross'], data['error']))
3010- logger.info(" Nb of events : %s" % data['nb_event'] )
3011- #if data['cross_pythia'] and data['nb_event_pythia']:
3012- # if self.ninitial == 1:
3013- # logger.info(" Matched Width : %.4g +- %.4g GeV" % (data['cross_pythia'], data['error_pythia']))
3014- # else:
3015- # logger.info(" Matched Cross-section : %.4g +- %.4g pb" % (data['cross_pythia'], data['error_pythia']))
3016- # logger.info(" Nb of events after Matching : %s" % data['nb_event_pythia'])
3017- # if self.run_card['use_syst'] in self.true:
3018- # logger.info(" Be carefull that matched information are here NOT for the central value. Refer to SysCalc output for it")
3019- logger.info(" " )
3020-
3021- def print_results_in_file(self, data, path, mode='w'):
3022- """Have a nice results prints in the shell,
3023- data should be of type: gen_crossxhtml.OneTagResults"""
3024- if not data:
3025- return
3026-
3027- fsock = open(path, mode)
3028-
3029- fsock.write(" === Results Summary for run: %s tag: %s process: %s ===\n" % \
3030- (data['run_name'],data['tag'], os.path.basename(self.me_dir)))
3031-
3032- if self.ninitial == 1:
3033- fsock.write(" Width : %.4g +- %.4g GeV\n" % (data['cross'], data['error']))
3034- else:
3035- fsock.write(" Cross-section : %.4g +- %.4g pb\n" % (data['cross'], data['error']))
3036- fsock.write(" Nb of events : %s\n" % data['nb_event'] )
3037- #if data['cross_pythia'] and data['nb_event_pythia']:
3038- # if self.ninitial == 1:
3039- # fsock.write(" Matched Width : %.4g +- %.4g GeV\n" % (data['cross_pythia'], data['error_pythia']))
3040- # else:
3041- # fsock.write(" Matched Cross-section : %.4g +- %.4g pb\n" % (data['cross_pythia'], data['error_pythia']))
3042- # fsock.write(" Nb of events after Matching : %s\n" % data['nb_event_pythia'])
3043- fsock.write(" \n" )
3044-
3045-
3046-
3047-
3048
3049 def update_random_seed(self):
3050 """Update random number seed with the value from the run_card.
3051 If this is 0, update the number according to a fresh one"""
3052- iseed = int(self.run_card['iseed'])
3053+ iseed = self.run_card['iseed']
3054 if iseed == 0:
3055 randinit = open(pjoin(self.me_dir, 'SubProcesses', 'randinit'))
3056 iseed = int(randinit.read()[2:]) + 1
3057@@ -1317,206 +1310,95 @@
3058 if not 'only_generation' in options.keys():
3059 options['only_generation'] = False
3060
3061+ # for second step in applgrid mode, do only the event generation step
3062 if mode in ['LO', 'NLO'] and self.run_card['iappl'] == 2 and not options['only_generation']:
3063 options['only_generation'] = True
3064 self.get_characteristics(pjoin(self.me_dir, 'SubProcesses', 'proc_characteristics'))
3065-
3066- if self.cluster_mode == 1:
3067- cluster_name = self.options['cluster_type']
3068- self.cluster = cluster.from_name[cluster_name](**self.options)
3069- if self.cluster_mode == 2:
3070- try:
3071- import multiprocessing
3072- if not self.nb_core:
3073- try:
3074- self.nb_core = int(self.options['nb_core'])
3075- except TypeError:
3076- self.nb_core = multiprocessing.cpu_count()
3077- logger.info('Using %d cores' % self.nb_core)
3078- except ImportError:
3079- self.nb_core = 1
3080- logger.warning('Impossible to detect the number of cores => Using One.\n'+
3081- 'Use set nb_core X in order to set this number and be able to'+
3082- 'run in multicore.')
3083-
3084- self.cluster = cluster.MultiCore(**self.options)
3085+ self.setup_cluster_or_multicore()
3086 self.update_random_seed()
3087 #find and keep track of all the jobs
3088 folder_names = {'LO': ['born_G*'], 'NLO': ['all_G*'],
3089 'aMC@LO': ['GB*'], 'aMC@NLO': ['GF*']}
3090 folder_names['noshower'] = folder_names['aMC@NLO']
3091 folder_names['noshowerLO'] = folder_names['aMC@LO']
3092- job_dict = {}
3093 p_dirs = [d for d in \
3094 open(pjoin(self.me_dir, 'SubProcesses', 'subproc.mg')).read().split('\n') if d]
3095- #find jobs and clean previous results
3096- if not options['only_generation'] and not options['reweightonly']:
3097- self.update_status('Cleaning previous results', level=None)
3098- for dir in p_dirs:
3099- job_dict[dir] = [file for file in \
3100- os.listdir(pjoin(self.me_dir, 'SubProcesses', dir)) \
3101- if file.startswith('ajob')]
3102- #find old folders to be removed
3103- for obj in folder_names[mode]:
3104- to_rm = [file for file in \
3105- os.listdir(pjoin(self.me_dir, 'SubProcesses', dir)) \
3106- if file.startswith(obj[:-1]) and \
3107- (os.path.isdir(pjoin(self.me_dir, 'SubProcesses', dir, file)) or \
3108- os.path.exists(pjoin(self.me_dir, 'SubProcesses', dir, file)))]
3109- #always clean dirs for the splitted event generation
3110- # do not include the born_G/ grid_G which should be kept when
3111- # doing a f.o. run keeping old grids
3112- to_always_rm = [file for file in \
3113- os.listdir(pjoin(self.me_dir, 'SubProcesses', dir)) \
3114- if file.startswith(obj[:-1]) and
3115- '_' in file and not '_G' in file and \
3116- (os.path.isdir(pjoin(self.me_dir, 'SubProcesses', dir, file)) or \
3117- os.path.exists(pjoin(self.me_dir, 'SubProcesses', dir, file)))]
3118-
3119- if not options['only_generation'] and not options['reweightonly']:
3120- to_always_rm.extend(to_rm)
3121- if os.path.exists(pjoin(self.me_dir, 'SubProcesses', dir,'MadLoop5_resources.tar.gz')):
3122- to_always_rm.append(pjoin(self.me_dir, 'SubProcesses', dir,'MadLoop5_resources.tar.gz'))
3123- files.rm([pjoin(self.me_dir, 'SubProcesses', dir, d) for d in to_always_rm])
3124-
3125- mcatnlo_status = ['Setting up grid', 'Computing upper envelope', 'Generating events']
3126-
3127- if self.run_card['iappl'] == 2:
3128- self.applgrid_distribute(options,mode,p_dirs)
3129+ #Clean previous results
3130+ self.clean_previous_results(options,p_dirs,folder_names[mode])
3131+
3132+ mcatnlo_status = ['Setting up grids', 'Computing upper envelope', 'Generating events']
3133+
3134
3135 if options['reweightonly']:
3136 event_norm=self.run_card['event_norm']
3137- nevents=int(self.run_card['nevents'])
3138+ nevents=self.run_card['nevents']
3139 return self.reweight_and_collect_events(options, mode, nevents, event_norm)
3140
3141 devnull = os.open(os.devnull, os.O_RDWR)
3142+
3143 if mode in ['LO', 'NLO']:
3144 # this is for fixed order runs
3145 mode_dict = {'NLO': 'all', 'LO': 'born'}
3146 logger.info('Doing fixed order %s' % mode)
3147 req_acc = self.run_card['req_acc_FO']
3148- if not options['only_generation'] and req_acc != -1:
3149- self.write_madin_file(pjoin(self.me_dir, 'SubProcesses'), mode_dict[mode], 0, '-1', '6','0.10')
3150- self.update_status('Setting up grids', level=None)
3151- self.run_all(job_dict, [['0', mode_dict[mode], '0']], 'Setting up grids')
3152- elif not options['only_generation']:
3153- npoints = self.run_card['npoints_FO_grid']
3154- niters = self.run_card['niters_FO_grid']
3155- self.write_madin_file(pjoin(self.me_dir, 'SubProcesses'), mode_dict[mode], 0, npoints, niters)
3156- self.update_status('Setting up grids', level=None)
3157- self.run_all(job_dict, [['0', mode_dict[mode], '0']], 'Setting up grids')
3158-
3159- npoints = self.run_card['npoints_FO']
3160- niters = self.run_card['niters_FO']
3161- self.write_madin_file(pjoin(self.me_dir, 'SubProcesses'), mode_dict[mode], -1, npoints, niters)
3162- # collect the results and logs
3163- self.collect_log_files(folder_names[mode], 0)
3164- p = misc.Popen(['./combine_results_FO.sh', str(req_acc), '%s_G*' % mode_dict[mode]], \
3165- stdout=subprocess.PIPE, \
3166- cwd=pjoin(self.me_dir, 'SubProcesses'))
3167- output = p.communicate()
3168-
3169- self.cross_sect_dict = self.read_results(output, mode)
3170- self.print_summary(options, 0, mode)
3171- cross, error = sum_html.make_all_html_results(self, ['%s*' % mode_dict[mode]])
3172- self.results.add_detail('cross', cross)
3173- self.results.add_detail('error', error)
3174-
3175- self.update_status('Computing cross-section', level=None)
3176- self.run_all(job_dict, [['0', mode_dict[mode], '0', mode_dict[mode]]], 'Computing cross-section')
3177-
3178- # collect the results and logs
3179- self.collect_log_files(folder_names[mode], 1)
3180- p = misc.Popen(['./combine_results_FO.sh', '-1'] + folder_names[mode], \
3181- stdout=subprocess.PIPE,
3182- cwd=pjoin(self.me_dir, 'SubProcesses'))
3183- output = p.communicate()
3184- self.cross_sect_dict = self.read_results(output, mode)
3185-
3186- # collect the scale and PDF uncertainties
3187- scale_pdf_info={}
3188- if self.run_card['reweight_scale'] or self.run_card['reweight_PDF']:
3189- data_files=[]
3190- for dir in p_dirs:
3191- for obj in folder_names[mode]:
3192- for file in os.listdir(pjoin(self.me_dir, 'SubProcesses', dir)):
3193- if file.startswith(obj[:-1]) and \
3194- (os.path.exists(pjoin(self.me_dir, 'SubProcesses', dir, file,'scale_pdf_dependence.dat'))):
3195- data_files.append(pjoin(dir,file,'scale_pdf_dependence.dat'))
3196- scale_pdf_info = self.pdf_scale_from_reweighting(data_files)
3197- # print the results:
3198- self.print_summary(options, 1, mode, scale_pdf_info)
3199-
3200- files.cp(pjoin(self.me_dir, 'SubProcesses', 'res.txt'),
3201- pjoin(self.me_dir, 'Events', self.run_name))
3202-
3203- if self.analyse_card['fo_analysis_format'].lower() == 'topdrawer':
3204- misc.call(['./combine_plots_FO.sh'] + folder_names[mode], \
3205- stdout=devnull,
3206- cwd=pjoin(self.me_dir, 'SubProcesses'))
3207- files.cp(pjoin(self.me_dir, 'SubProcesses', 'MADatNLO.top'),
3208- pjoin(self.me_dir, 'Events', self.run_name))
3209- logger.info('The results of this run and the TopDrawer file with the plots' + \
3210- ' have been saved in %s' % pjoin(self.me_dir, 'Events', self.run_name))
3211- elif self.analyse_card['fo_analysis_format'].lower() == 'hwu':
3212- self.combine_plots_HwU(folder_names[mode])
3213- files.cp(pjoin(self.me_dir, 'SubProcesses', 'MADatNLO.HwU'),
3214- pjoin(self.me_dir, 'Events', self.run_name))
3215- files.cp(pjoin(self.me_dir, 'SubProcesses', 'MADatNLO.gnuplot'),
3216- pjoin(self.me_dir, 'Events', self.run_name))
3217- try:
3218- misc.call(['gnuplot','MADatNLO.gnuplot'],\
3219- stdout=os.open(os.devnull, os.O_RDWR),\
3220- stderr=os.open(os.devnull, os.O_RDWR),\
3221- cwd=pjoin(self.me_dir, 'Events', self.run_name))
3222- except Exception:
3223- pass
3224-
3225-
3226- logger.info('The results of this run and the HwU and GnuPlot files with the plots' + \
3227- ' have been saved in %s' % pjoin(self.me_dir, 'Events', self.run_name))
3228- elif self.analyse_card['fo_analysis_format'].lower() == 'root':
3229- misc.call(['./combine_root.sh'] + folder_names[mode], \
3230- stdout=devnull,
3231- cwd=pjoin(self.me_dir, 'SubProcesses'))
3232- files.cp(pjoin(self.me_dir, 'SubProcesses', 'MADatNLO.root'),
3233- pjoin(self.me_dir, 'Events', self.run_name))
3234- logger.info('The results of this run and the ROOT file with the plots' + \
3235- ' have been saved in %s' % pjoin(self.me_dir, 'Events', self.run_name))
3236- else:
3237- logger.info('The results of this run' + \
3238- ' have been saved in %s' % pjoin(self.me_dir, 'Events', self.run_name))
3239-
3240- cross, error = sum_html.make_all_html_results(self, folder_names[mode])
3241- self.results.add_detail('cross', cross)
3242- self.results.add_detail('error', error)
3243- if self.run_card['iappl'] != 0:
3244- self.applgrid_combine(cross,error)
3245+
3246+ # Re-distribute the grids for the 2nd step of the applgrid
3247+ # running
3248+ if self.run_card['iappl'] == 2:
3249+ self.applgrid_distribute(options,mode_dict[mode],p_dirs)
3250+
3251+ # create a list of dictionaries "jobs_to_run" with all the
3252+ # jobs that need to be run
3253+ integration_step=-1
3254+ jobs_to_run,jobs_to_collect,integration_step = self.create_jobs_to_run(options,p_dirs, \
3255+ req_acc,mode_dict[mode],integration_step,mode,fixed_order=True)
3256+ self.prepare_directories(jobs_to_run,mode)
3257+
3258+ # loop over the integration steps. After every step, check
3259+ # if we have the required accuracy. If this is the case,
3260+ # stop running, else do another step.
3261+ while True:
3262+ integration_step=integration_step+1
3263+ self.run_all_jobs(jobs_to_run,integration_step)
3264+ self.collect_log_files(jobs_to_run,integration_step)
3265+ jobs_to_run,jobs_to_collect=self.collect_the_results(options,req_acc,jobs_to_run, \
3266+ jobs_to_collect,integration_step,mode,mode_dict[mode])
3267+ if not jobs_to_run:
3268+ # there are no more jobs to run (jobs_to_run is empty)
3269+ break
3270+ # We are done.
3271+ self.finalise_run_FO(folder_names[mode],jobs_to_collect)
3272 self.update_status('Run complete', level='parton', update_results=True)
3273-
3274 return
3275
3276 elif mode in ['aMC@NLO','aMC@LO','noshower','noshowerLO']:
3277+ if self.ninitial == 1:
3278+ raise aMCatNLOError('Decay processes can only be run at fixed order.')
3279+ mode_dict = {'aMC@NLO': 'all', 'aMC@LO': 'born',\
3280+ 'noshower': 'all', 'noshowerLO': 'born'}
3281 shower = self.run_card['parton_shower'].upper()
3282- nevents = int(self.run_card['nevents'])
3283+ nevents = self.run_card['nevents']
3284 req_acc = self.run_card['req_acc']
3285- if nevents == 0 and float(req_acc) < 0 :
3286+ if nevents == 0 and req_acc < 0 :
3287 raise aMCatNLOError('Cannot determine the required accuracy from the number '\
3288 'of events, because 0 events requested. Please set '\
3289- 'the "req_acc" parameter in the run_card to a value between 0 and 1')
3290- elif float(req_acc) >1 or float(req_acc) == 0 :
3291+ 'the "req_acc" parameter in the run_card to a value '\
3292+ 'between 0 and 1')
3293+ elif req_acc >1 or req_acc == 0 :
3294 raise aMCatNLOError('Required accuracy ("req_acc" in the run_card) should '\
3295 'be between larger than 0 and smaller than 1, '\
3296- 'or set to -1 for automatic determination. Current value is %s' % req_acc)
3297+ 'or set to -1 for automatic determination. Current '\
3298+ 'value is %f' % req_acc)
3299 # For more than 1M events, set req_acc to 0.001 (except when it was explicitly set in the run_card)
3300- elif float(req_acc) < 0 and nevents > 1000000 :
3301- req_acc='0.001'
3302+ elif req_acc < 0 and nevents > 1000000 :
3303+ req_acc=0.001
3304
3305 shower_list = ['HERWIG6', 'HERWIGPP', 'PYTHIA6Q', 'PYTHIA6PT', 'PYTHIA8']
3306
3307 if not shower in shower_list:
3308- raise aMCatNLOError('%s is not a valid parton shower. Please use one of the following: %s' \
3309- % (shower, ', '.join(shower_list)))
3310+ raise aMCatNLOError('%s is not a valid parton shower. '\
3311+ 'Please use one of the following: %s' \
3312+ % (shower, ', '.join(shower_list)))
3313
3314 # check that PYTHIA6PT is not used for processes with FSR
3315 if shower == 'PYTHIA6PT' and self.proc_characteristics['has_fsr']:
3316@@ -1529,98 +1411,556 @@
3317 elif options['only_generation']:
3318 logger.info('Generating events starting from existing results')
3319
3320-
3321- for i, status in enumerate(mcatnlo_status):
3322- #check if need to split jobs
3323- # at least one channel must have enough events
3324- try:
3325- nevents_unweighted = open(pjoin(self.me_dir,
3326- 'SubProcesses',
3327- 'nevents_unweighted')).read().split('\n')
3328- except IOError:
3329- nevents_unweighted = []
3330-
3331- split = i == 2 and \
3332- int(self.run_card['nevt_job']) > 0
3333-
3334- if i == 2 or not options['only_generation']:
3335- # if the number of events requested is zero,
3336- # skip mint step 2
3337- if i==2 and nevents==0:
3338- self.print_summary(options, 2,mode)
3339- return
3340-
3341- if split:
3342- # split the event generation
3343- misc.call([pjoin(self.me_dir, 'bin', 'internal', 'split_jobs.py')] + \
3344- [str(self.run_card['nevt_job'])],
3345- stdout = devnull,
3346- cwd = pjoin(self.me_dir, 'SubProcesses'))
3347- assert os.path.exists(pjoin(self.me_dir, 'SubProcesses',
3348- 'nevents_unweighted_splitted'))
3349-
3350- self.update_status(status, level='parton')
3351- if mode in ['aMC@NLO', 'noshower']:
3352- self.write_madinMMC_file(pjoin(self.me_dir, 'SubProcesses'), 'all', i)
3353- self.run_all(job_dict, [['2', 'F', '%d' % i]], status, split_jobs = split)
3354-
3355- elif mode in ['aMC@LO', 'noshowerLO']:
3356- self.write_madinMMC_file(
3357- pjoin(self.me_dir, 'SubProcesses'), 'born', i)
3358- self.run_all(job_dict,
3359- [['2', 'B', '%d' % i]],
3360- '%s at LO' % status, split_jobs = split)
3361-
3362- if (i < 2 and not options['only_generation']) or i == 1 :
3363- # collect the results and logs
3364- self.collect_log_files(folder_names[mode], i)
3365- p = misc.Popen(['./combine_results.sh'] + \
3366- ['%d' % i,'%d' % nevents, '%s' % req_acc ] + \
3367- folder_names[mode],
3368- stdout=subprocess.PIPE,
3369- cwd = pjoin(self.me_dir, 'SubProcesses'))
3370- output = p.communicate()
3371- files.cp(pjoin(self.me_dir, 'SubProcesses', 'res_%d.txt' % i), \
3372- pjoin(self.me_dir, 'Events', self.run_name))
3373-
3374- self.cross_sect_dict = self.read_results(output, mode)
3375- self.print_summary(options, i, mode)
3376-
3377- cross, error = sum_html.make_all_html_results(self, folder_names[mode])
3378- self.results.add_detail('cross', cross)
3379- self.results.add_detail('error', error)
3380-
3381- #check that split jobs are all correctly terminated
3382- if split:
3383- self.check_event_files()
3384-
3385- if self.cluster_mode == 1:
3386- #if cluster run, wait 15 sec so that event files are transferred back
3387- self.update_status(
3388+ jobs_to_run,jobs_to_collect,integration_step = self.create_jobs_to_run(options,p_dirs, \
3389+ req_acc,mode_dict[mode],1,mode,fixed_order=False)
3390+
3391+ # Make sure to update all the jobs to be ready for the event generation step
3392+ if options['only_generation']:
3393+ jobs_to_run,jobs_to_collect=self.collect_the_results(options,req_acc,jobs_to_run, \
3394+ jobs_to_collect,1,mode,mode_dict[mode],fixed_order=False)
3395+ else:
3396+ self.prepare_directories(jobs_to_run,mode,fixed_order=False)
3397+
3398+
3399+ # Main loop over the three MINT generation steps:
3400+ for mint_step, status in enumerate(mcatnlo_status):
3401+ if options['only_generation'] and mint_step < 2:
3402+ continue
3403+ self.update_status(status, level='parton')
3404+ self.run_all_jobs(jobs_to_run,mint_step,fixed_order=False)
3405+ self.collect_log_files(jobs_to_run,mint_step)
3406+ if mint_step+1==2 and nevents==0:
3407+ self.print_summary(options,2,mode)
3408+ return
3409+ jobs_to_run,jobs_to_collect=self.collect_the_results(options,req_acc,jobs_to_run, \
3410+ jobs_to_collect,mint_step,mode,mode_dict[mode],fixed_order=False)
3411+ # Sanity check on the event files. If error the jobs are resubmitted
3412+ self.check_event_files(jobs_to_collect)
3413+
3414+ if self.cluster_mode == 1:
3415+ #if cluster run, wait 10 sec so that event files are transferred back
3416+ self.update_status(
3417 'Waiting while files are transferred back from the cluster nodes',
3418 level='parton')
3419- time.sleep(10)
3420- if split:
3421- files.cp(pjoin(self.me_dir, 'SubProcesses', 'nevents_unweighted_splitted'), \
3422- pjoin(self.me_dir, 'SubProcesses', 'nevents_unweighted'))
3423-
3424-
3425- event_norm=self.run_card['event_norm']
3426- self.collect_log_files(folder_names[mode], 2)
3427- return self.reweight_and_collect_events(options, mode, nevents, event_norm)
3428-
3429- def combine_plots_HwU(self,folder_names):
3430+ time.sleep(10)
3431+
3432+ event_norm=self.run_card['event_norm']
3433+ return self.reweight_and_collect_events(options, mode, nevents, event_norm)
3434+
3435+ def create_jobs_to_run(self,options,p_dirs,req_acc,run_mode,\
3436+ integration_step,mode,fixed_order=True):
3437+ """Creates a list of dictionaries with all the jobs to be run"""
3438+ jobs_to_run=[]
3439+ if not options['only_generation']:
3440+ # Fresh, new run. Check all the P*/channels.txt files
3441+ # (created by the 'gensym' executable) to set-up all the
3442+ # jobs using the default inputs.
3443+ npoints = self.run_card['npoints_FO_grid']
3444+ niters = self.run_card['niters_FO_grid']
3445+ for p_dir in p_dirs:
3446+ try:
3447+ with open(pjoin(self.me_dir,'SubProcesses',p_dir,'channels.txt')) as chan_file:
3448+ channels=chan_file.readline().split()
3449+ except IOError:
3450+ logger.warning('No integration channels found for contribution %s' % p_dir)
3451+ continue
3452+ for channel in channels:
3453+ job={}
3454+ job['p_dir']=p_dir
3455+ job['channel']=channel
3456+ job['split']=0
3457+ if fixed_order and req_acc == -1:
3458+ job['accuracy']=0
3459+ job['niters']=niters
3460+ job['npoints']=npoints
3461+ elif fixed_order and req_acc > 0:
3462+ job['accuracy']=0.10
3463+ job['niters']=6
3464+ job['npoints']=-1
3465+ elif not fixed_order:
3466+ job['accuracy']=0.03
3467+ job['niters']=12
3468+ job['npoints']=-1
3469+ else:
3470+ raise aMCatNLOError('No consistent "req_acc_FO" set. Use a value '+
3471+ 'between 0 and 1 or set it equal to -1.')
3472+ job['mint_mode']=0
3473+ job['run_mode']=run_mode
3474+ job['wgt_frac']=1.0
3475+ jobs_to_run.append(job)
3476+ jobs_to_collect=copy.copy(jobs_to_run) # These are all jobs
3477+ else:
3478+ # if options['only_generation'] is true, we need to loop
3479+ # over all the existing G* directories and create the jobs
3480+ # from there.
3481+ name_suffix={'born' :'B', 'all':'F'}
3482+ for p_dir in p_dirs:
3483+ for chan_dir in os.listdir(pjoin(self.me_dir,'SubProcesses',p_dir)):
3484+ if ((chan_dir.startswith(run_mode+'_G') and fixed_order) or\
3485+ (chan_dir.startswith('G'+name_suffix[run_mode]) and (not fixed_order))) and \
3486+ (os.path.isdir(pjoin(self.me_dir, 'SubProcesses', p_dir, chan_dir)) or \
3487+ os.path.exists(pjoin(self.me_dir, 'SubProcesses', p_dir, chan_dir))):
3488+ job={}
3489+ job['p_dir']=p_dir
3490+ if fixed_order:
3491+ channel=chan_dir.split('_')[1]
3492+ job['channel']=channel[1:] # remove the 'G'
3493+ if len(chan_dir.split('_')) == 3:
3494+ split=int(chan_dir.split('_')[2])
3495+ else:
3496+ split=0
3497+ else:
3498+ if len(chan_dir.split('_')) == 2:
3499+ split=int(chan_dir.split('_')[1])
3500+ channel=chan_dir.split('_')[0]
3501+ job['channel']=channel[2:] # remove the 'G'
3502+ else:
3503+ job['channel']=chan_dir[2:] # remove the 'G'
3504+ split=0
3505+ job['split']=split
3506+ job['run_mode']=run_mode
3507+ job['dirname']=pjoin(self.me_dir, 'SubProcesses', p_dir, chan_dir)
3508+ job['wgt_frac']=1.0
3509+ if not fixed_order: job['mint_mode']=1
3510+ jobs_to_run.append(job)
3511+ jobs_to_collect=copy.copy(jobs_to_run) # These are all jobs
3512+ if fixed_order:
3513+ jobs_to_run,jobs_to_collect=self.collect_the_results(options,req_acc,jobs_to_run,
3514+ jobs_to_collect,integration_step,mode,run_mode)
3515+ # Update the integration_step to make sure that nothing will be overwritten
3516+ integration_step=1
3517+ for job in jobs_to_run:
3518+ while os.path.exists(pjoin(job['dirname'],'res_%s.dat' % integration_step)):
3519+ integration_step=integration_step+1
3520+ integration_step=integration_step-1
3521+ else:
3522+ self.append_the_results(jobs_to_collect,integration_step)
3523+ return jobs_to_run,jobs_to_collect,integration_step
3524+
3525+ def prepare_directories(self,jobs_to_run,mode,fixed_order=True):
3526+ """Set-up the G* directories for running"""
3527+ name_suffix={'born' :'B' , 'all':'F'}
3528+ for job in jobs_to_run:
3529+ if job['split'] == 0:
3530+ if fixed_order :
3531+ dirname=pjoin(self.me_dir,'SubProcesses',job['p_dir'],
3532+ job['run_mode']+'_G'+job['channel'])
3533+ else:
3534+ dirname=pjoin(self.me_dir,'SubProcesses',job['p_dir'],
3535+ 'G'+name_suffix[job['run_mode']]+job['channel'])
3536+ else:
3537+ if fixed_order :
3538+ dirname=pjoin(self.me_dir,'SubProcesses',job['p_dir'],
3539+ job['run_mode']+'_G'+job['channel']+'_'+str(job['split']))
3540+ else:
3541+ dirname=pjoin(self.me_dir,'SubProcesses',job['p_dir'],
3542+ 'G'+name_suffix[job['run_mode']]+job['channel']+'_'+str(job['split']))
3543+ job['dirname']=dirname
3544+ if not os.path.isdir(dirname):
3545+ os.makedirs(dirname)
3546+ self.write_input_file(job,fixed_order)
3547+ if not fixed_order:
3548+ # copy the grids from the base directory to the split directory:
3549+ if job['split'] != 0:
3550+ for f in ['grid.MC_integer','mint_grids','res_1']:
3551+ if not os.path.isfile(pjoin(job['dirname'],f)):
3552+ files.ln(pjoin(job['dirname'].rsplit("_",1)[0],f),job['dirname'])
3553+
3554+
3555+ def write_input_file(self,job,fixed_order):
3556+ """write the input file for the madevent_mint* executable in the appropriate directory"""
3557+ if fixed_order:
3558+ content= \
3559+"""NPOINTS = %(npoints)s
3560+NITERATIONS = %(niters)s
3561+ACCURACY = %(accuracy)s
3562+ADAPT_GRID = 2
3563+MULTICHANNEL = 1
3564+SUM_HELICITY = 1
3565+CHANNEL = %(channel)s
3566+SPLIT = %(split)s
3567+RUN_MODE = %(run_mode)s
3568+RESTART = %(mint_mode)s
3569+""" \
3570+ % job
3571+ else:
3572+ content = \
3573+"""-1 12 ! points, iterations
3574+%(accuracy)s ! desired fractional accuracy
3575+1 -0.1 ! alpha, beta for Gsoft
3576+-1 -0.1 ! alpha, beta for Gazi
3577+1 ! Suppress amplitude (0 no, 1 yes)?
3578+1 ! Exact helicity sum (0 yes, n = number/event)?
3579+%(channel)s ! Enter Configuration Number:
3580+%(mint_mode)s ! MINT imode: 0 to set-up grids, 1 to perform integral, 2 generate events
3581+1 1 1 ! if imode is 1: Folding parameters for xi_i, phi_i and y_ij
3582+%(run_mode)s ! all, born, real, virt
3583+""" \
3584+ % job
3585+ with open(pjoin(job['dirname'], 'input_app.txt'), 'w') as input_file:
3586+ input_file.write(content)
3587+
3588+
3589+ def run_all_jobs(self,jobs_to_run,integration_step,fixed_order=True):
3590+ """Loops over the jobs_to_run and executes them using the function 'run_exe'"""
3591+ if fixed_order:
3592+ if integration_step == 0:
3593+ self.update_status('Setting up grids', level=None)
3594+ else:
3595+ self.update_status('Refining results, step %i' % integration_step, level=None)
3596+ self.ijob = 0
3597+ name_suffix={'born' :'B', 'all':'F'}
3598+ if fixed_order:
3599+ run_type="Fixed order integration step %s" % integration_step
3600+ else:
3601+ run_type="MINT step %s" % integration_step
3602+ for job in jobs_to_run:
3603+ executable='ajob1'
3604+ if fixed_order:
3605+ arguments=[job['channel'],job['run_mode'], \
3606+ str(job['split']),str(integration_step)]
3607+ else:
3608+ arguments=[job['channel'],name_suffix[job['run_mode']], \
3609+ str(job['split']),str(integration_step)]
3610+ self.run_exe(executable,arguments,run_type,
3611+ cwd=pjoin(self.me_dir,'SubProcesses',job['p_dir']))
3612+
3613+ if self.cluster_mode == 2:
3614+ time.sleep(1) # security to allow all jobs to be launched
3615+ self.njobs=len(jobs_to_run)
3616+ self.wait_for_complete(run_type)
3617+
3618+
3619+ def collect_the_results(self,options,req_acc,jobs_to_run,jobs_to_collect,\
3620+ integration_step,mode,run_mode,fixed_order=True):
3621+ """Collect the results, make HTML pages, print the summary and
3622+ determine if there are more jobs to run. Returns the list
3623+ of the jobs that still need to be run, as well as the
3624+ complete list of jobs that need to be collected to get the
3625+ final answer.
3626+ """
3627+# Get the results of the current integration/MINT step
3628+ self.append_the_results(jobs_to_run,integration_step)
3629+ self.cross_sect_dict = self.write_res_txt_file(jobs_to_collect,integration_step)
3630+# Update HTML pages
3631+ if fixed_order:
3632+ cross, error = sum_html.make_all_html_results(self, ['%s*' % run_mode])
3633+ else:
3634+ name_suffix={'born' :'B' , 'all':'F'}
3635+ cross, error = sum_html.make_all_html_results(self, ['G%s*' % name_suffix[run_mode]])
3636+ self.results.add_detail('cross', cross)
3637+ self.results.add_detail('error', error)
3638+# Set-up jobs for the next iteration/MINT step
3639+ jobs_to_run_new=self.update_jobs_to_run(req_acc,integration_step,jobs_to_run,fixed_order)
3640+ # if there are no more jobs, we are done!
3641+# Print summary
3642+ if (not jobs_to_run_new) and fixed_order:
3643+ # print final summary of results (for fixed order)
3644+ scale_pdf_info=self.collect_scale_pdf_info(options,jobs_to_collect)
3645+ self.print_summary(options,integration_step,mode,scale_pdf_info,done=True)
3646+ return jobs_to_run_new,jobs_to_collect
3647+ elif jobs_to_run_new:
3648+ # print intermediate summary of results
3649+ scale_pdf_info={}
3650+ self.print_summary(options,integration_step,mode,scale_pdf_info,done=False)
3651+ else:
3652+ # When we are done for (N)LO+PS runs, do not print
3653+ # anything yet. This will be done after the reweighting
3654+ # and collection of the events
3655+ scale_pdf_info={}
3656+# Prepare for the next integration/MINT step
3657+ if (not fixed_order) and integration_step+1 == 2 :
3658+ # next step is event generation (mint_step 2)
3659+ jobs_to_run_new,jobs_to_collect_new= \
3660+ self.check_the_need_to_split(jobs_to_run_new,jobs_to_collect)
3661+ self.prepare_directories(jobs_to_run_new,mode,fixed_order)
3662+ self.write_nevents_unweighted_file(jobs_to_collect_new)
3663+ self.write_nevts_files(jobs_to_run_new)
3664+ else:
3665+ self.prepare_directories(jobs_to_run_new,mode,fixed_order)
3666+ jobs_to_collect_new=jobs_to_collect
3667+ return jobs_to_run_new,jobs_to_collect_new
3668+
3669+
3670+ def write_nevents_unweighted_file(self,jobs):
3671+ """writes the nevents_unweighted file in the SubProcesses directory"""
3672+ content=[]
3673+ for job in jobs:
3674+ path=pjoin(job['dirname'].split('/')[-2],job['dirname'].split('/')[-1])
3675+ lhefile=pjoin(path,'events.lhe')
3676+ content.append(' %s %d %9e %9e' % \
3677+ (lhefile.ljust(40),job['nevents'],job['resultABS']*job['wgt_frac'],job['wgt_frac']))
3678+ with open(pjoin(self.me_dir,'SubProcesses',"nevents_unweighted"),'w') as f:
3679+ f.write('\n'.join(content)+'\n')
3680+
3681+ def write_nevts_files(self,jobs):
3682+ """write the nevts files in the SubProcesses/P*/G*/ directories"""
3683+ for job in jobs:
3684+ with open(pjoin(job['dirname'],'nevts'),'w') as f:
3685+ f.write('%i\n' % job['nevents'])
3686+
3687+ def check_the_need_to_split(self,jobs_to_run,jobs_to_collect):
3688+ """Looks in the jobs_to_run to see if there is the need to split the
3689+ event generation step. Updates jobs_to_run and
3690+ jobs_to_collect to replace the split-job by its
3691+ splits. Also removes jobs that do not need any events.
3692+ """
3693+ nevt_job=self.run_card['nevt_job']
3694+ if nevt_job > 0:
3695+ jobs_to_collect_new=copy.copy(jobs_to_collect)
3696+ for job in jobs_to_run:
3697+ nevents=job['nevents']
3698+ if nevents == 0:
3699+ jobs_to_collect_new.remove(job)
3700+ elif nevents > nevt_job:
3701+ jobs_to_collect_new.remove(job)
3702+ if nevents % nevt_job != 0 :
3703+ nsplit=int(nevents/nevt_job)+1
3704+ else:
3705+ nsplit=int(nevents/nevt_job)
3706+ for i in range(1,nsplit+1):
3707+ job_new=copy.copy(job)
3708+ left_over=nevents % nsplit
3709+ if i <= left_over:
3710+ job_new['nevents']=int(nevents/nsplit)+1
3711+ job_new['wgt_frac']=float(job_new['nevents'])/float(nevents)
3712+ else:
3713+ job_new['nevents']=int(nevents/nsplit)
3714+ job_new['wgt_frac']=float(job_new['nevents'])/float(nevents)
3715+ job_new['split']=i
3716+ job_new['dirname']=job['dirname']+'_%i' % job_new['split']
3717+ jobs_to_collect_new.append(job_new)
3718+ jobs_to_run_new=copy.copy(jobs_to_collect_new)
3719+ else:
3720+ jobs_to_run_new=copy.copy(jobs_to_collect)
3721+ for job in jobs_to_collect:
3722+ if job['nevents'] == 0:
3723+ jobs_to_run_new.remove(job)
3724+ jobs_to_collect_new=copy.copy(jobs_to_run_new)
3725+
3726+ return jobs_to_run_new,jobs_to_collect_new
3727+
3728+
3729+ def update_jobs_to_run(self,req_acc,step,jobs,fixed_order=True):
3730+ """
3731+ For (N)LO+PS: determines the number of events and/or the required
3732+ accuracy per job.
3733+ For fixed order: determines which jobs need higher precision and
3734+ returns those with the newly requested precision.
3735+ """
3736+ err=self.cross_sect_dict['errt']
3737+ tot=self.cross_sect_dict['xsect']
3738+ errABS=self.cross_sect_dict['erra']
3739+ totABS=self.cross_sect_dict['xseca']
3740+ jobs_new=[]
3741+ if fixed_order:
3742+ if req_acc == -1:
3743+ if step+1 == 1:
3744+ npoints = self.run_card['npoints_FO']
3745+ niters = self.run_card['niters_FO']
3746+ for job in jobs:
3747+ job['mint_mode']=-1
3748+ job['niters']=niters
3749+ job['npoints']=npoints
3750+ jobs_new.append(job)
3751+ elif step+1 == 2:
3752+ pass
3753+ elif step+1 > 2:
3754+ raise aMCatNLOError('Cannot determine number of iterations and PS points '+
3755+ 'for integration step %i' % step )
3756+ elif ( req_acc > 0 and err/tot > req_acc*1.2 ) or step == 0:
3757+ req_accABS=req_acc*abs(tot)/totABS # overal relative required accuracy on ABS Xsec.
3758+ for job in jobs:
3759+ job['mint_mode']=-1
3760+ # Determine relative required accuracy on the ABS for this job
3761+ job['accuracy']=req_accABS*math.sqrt(totABS/job['resultABS'])
3762+ # If already accurate enough, skip running
3763+ if job['accuracy'] > job['errorABS']/job['resultABS'] and step != 0:
3764+ continue
3765+ # Update the number of PS points based on errorABS, ncall and accuracy
3766+ itmax_fl=job['niters_done']*math.pow(job['errorABS']/
3767+ (job['accuracy']*job['resultABS']),2)
3768+ if itmax_fl <= 4.0 :
3769+ job['niters']=max(int(round(itmax_fl)),2)
3770+ job['npoints']=job['npoints_done']*2
3771+ elif itmax_fl > 4.0 and itmax_fl <= 16.0 :
3772+ job['niters']=4
3773+ job['npoints']=int(round(job['npoints_done']*itmax_fl/4.0))*2
3774+ else:
3775+ if itmax_fl > 100.0 : itmax_fl=50.0
3776+ job['niters']=int(round(math.sqrt(itmax_fl)))
3777+ job['npoints']=int(round(job['npoints_done']*itmax_fl/
3778+ round(math.sqrt(itmax_fl))))*2
3779+ # Add the job to the list of jobs that need to be run
3780+ jobs_new.append(job)
3781+ return jobs_new
3782+ elif step+1 <= 2:
3783+ nevents=self.run_card['nevents']
3784+ # Total required accuracy for the upper bounding envelope
3785+ if req_acc<0:
3786+ req_acc2_inv=nevents
3787+ else:
3788+ req_acc2_inv=1/(req_acc*req_acc)
3789+ if step+1 == 1 or step+1 == 2 :
3790+ # determine the req. accuracy for each of the jobs for Mint-step = 1
3791+ for job in jobs:
3792+ accuracy=min(math.sqrt(totABS/(req_acc2_inv*job['resultABS'])),0.2)
3793+ job['accuracy']=accuracy
3794+ if step+1 == 2:
3795+ # Randomly (based on the relative ABS Xsec of the job) determine the
3796+ # number of events each job needs to generate for MINT-step = 2.
3797+ r=self.get_randinit_seed()
3798+ random.seed(r)
3799+ totevts=nevents
3800+ for job in jobs:
3801+ job['nevents'] = 0
3802+ while totevts :
3803+ target = random.random() * totABS
3804+ crosssum = 0.
3805+ i = 0
3806+ while i<len(jobs) and crosssum < target:
3807+ job = jobs[i]
3808+ crosssum += job['resultABS']
3809+ i += 1
3810+ totevts -= 1
3811+ i -= 1
3812+ jobs[i]['nevents'] += 1
3813+ for job in jobs:
3814+ job['mint_mode']=step+1 # next step
3815+ return jobs
3816+ else:
3817+ return []
3818+
3819+
3820+ def get_randinit_seed(self):
3821+ """ Get the random number seed from the randinit file """
3822+ with open(pjoin(self.me_dir,"SubProcesses","randinit")) as randinit:
3823+ # format of the file is "r=%d".
3824+ iseed = int(randinit.read()[2:])
3825+ return iseed
3826+
3827+
3828+ def append_the_results(self,jobs,integration_step):
3829+ """Appends the results for each of the jobs in the job list"""
3830+ error_found=False
3831+ for job in jobs:
3832+ try:
3833+ if integration_step >= 0 :
3834+ with open(pjoin(job['dirname'],'res_%s.dat' % integration_step)) as res_file:
3835+ results=res_file.readline().split()
3836+ else:
3837+ # should only be here when doing fixed order with the 'only_generation'
3838+ # option equal to True. Take the results from the final run done.
3839+ with open(pjoin(job['dirname'],'res.dat')) as res_file:
3840+ results=res_file.readline().split()
3841+ except IOError:
3842+ if not error_found:
3843+ error_found=True
3844+ error_log=[]
3845+ error_log.append(pjoin(job['dirname'],'log.txt'))
3846+ continue
3847+ job['resultABS']=float(results[0])
3848+ job['errorABS']=float(results[1])
3849+ job['result']=float(results[2])
3850+ job['error']=float(results[3])
3851+ job['niters_done']=int(results[4])
3852+ job['npoints_done']=int(results[5])
3853+ job['time_spend']=float(results[6])
3854+ job['err_percABS'] = job['errorABS']/job['resultABS']*100.
3855+ job['err_perc'] = job['error']/job['result']*100.
3856+ if error_found:
3857+ raise aMCatNLOError('An error occurred during the collection of results.\n' +
3858+ 'Please check the .log files inside the directories which failed:\n' +
3859+ '\n'.join(error_log)+'\n')
3860+
3861+
3862+
3863+ def write_res_txt_file(self,jobs,integration_step):
3864+ """writes the res.txt files in the SubProcess dir"""
3865+ jobs.sort(key = lambda job: -job['errorABS'])
3866+ content=[]
3867+ content.append('\n\nCross-section per integration channel:')
3868+ for job in jobs:
3869+ content.append('%(p_dir)20s %(channel)15s %(result)10.8e %(error)6.4e %(err_perc)6.4f%% ' % job)
3870+ content.append('\n\nABS cross-section per integration channel:')
3871+ for job in jobs:
3872+ content.append('%(p_dir)20s %(channel)15s %(resultABS)10.8e %(errorABS)6.4e %(err_percABS)6.4f%% ' % job)
3873+ totABS=0
3874+ errABS=0
3875+ tot=0
3876+ err=0
3877+ for job in jobs:
3878+ totABS+= job['resultABS']
3879+ errABS+= math.pow(job['errorABS'],2)
3880+ tot+= job['result']
3881+ err+= math.pow(job['error'],2)
3882+ if jobs:
3883+ content.append('\nTotal ABS and \nTotal: \n %10.8e +- %6.4e (%6.4e%%)\n %10.8e +- %6.4e (%6.4e%%) \n' %\
3884+ (totABS, math.sqrt(errABS), math.sqrt(errABS)/totABS *100.,\
3885+ tot, math.sqrt(err), math.sqrt(err)/tot *100.))
3886+ with open(pjoin(self.me_dir,'SubProcesses','res_%s.txt' % integration_step),'w') as res_file:
3887+ res_file.write('\n'.join(content))
3888+ randinit=self.get_randinit_seed()
3889+ return {'xsect':tot,'xseca':totABS,'errt':math.sqrt(err),\
3890+ 'erra':math.sqrt(errABS),'randinit':randinit}
3891+
3892+
3893+ def collect_scale_pdf_info(self,options,jobs):
3894+ """read the scale_pdf_dependence.dat files and collects there results"""
3895+ scale_pdf_info={}
3896+ if self.run_card['reweight_scale'] or self.run_card['reweight_PDF']:
3897+ data_files=[]
3898+ for job in jobs:
3899+ data_files.append(pjoin(job['dirname'],'scale_pdf_dependence.dat'))
3900+ scale_pdf_info = self.pdf_scale_from_reweighting(data_files)
3901+ return scale_pdf_info
3902+
3903+
3904+ def combine_plots_FO(self,folder_name,jobs):
3905+ """combines the plots and puts then in the Events/run* directory"""
3906+ devnull = os.open(os.devnull, os.O_RDWR)
3907+ if self.analyse_card['fo_analysis_format'].lower() == 'topdrawer':
3908+ misc.call(['./combine_plots_FO.sh'] + folder_name, \
3909+ stdout=devnull,
3910+ cwd=pjoin(self.me_dir, 'SubProcesses'))
3911+ files.cp(pjoin(self.me_dir, 'SubProcesses', 'MADatNLO.top'),
3912+ pjoin(self.me_dir, 'Events', self.run_name))
3913+ logger.info('The results of this run and the TopDrawer file with the plots' + \
3914+ ' have been saved in %s' % pjoin(self.me_dir, 'Events', self.run_name))
3915+ elif self.analyse_card['fo_analysis_format'].lower() == 'hwu':
3916+ self.combine_plots_HwU(jobs)
3917+ files.cp(pjoin(self.me_dir, 'SubProcesses', 'MADatNLO.HwU'),
3918+ pjoin(self.me_dir, 'Events', self.run_name))
3919+ files.cp(pjoin(self.me_dir, 'SubProcesses', 'MADatNLO.gnuplot'),
3920+ pjoin(self.me_dir, 'Events', self.run_name))
3921+ try:
3922+ misc.call(['gnuplot','MADatNLO.gnuplot'],\
3923+ stdout=devnull,stderr=devnull,\
3924+ cwd=pjoin(self.me_dir, 'Events', self.run_name))
3925+ except Exception:
3926+ pass
3927+ logger.info('The results of this run and the HwU and GnuPlot files with the plots' + \
3928+ ' have been saved in %s' % pjoin(self.me_dir, 'Events', self.run_name))
3929+ elif self.analyse_card['fo_analysis_format'].lower() == 'root':
3930+ misc.call(['./combine_root.sh'] + folder_name, \
3931+ stdout=devnull,
3932+ cwd=pjoin(self.me_dir, 'SubProcesses'))
3933+ files.cp(pjoin(self.me_dir, 'SubProcesses', 'MADatNLO.root'),
3934+ pjoin(self.me_dir, 'Events', self.run_name))
3935+ logger.info('The results of this run and the ROOT file with the plots' + \
3936+ ' have been saved in %s' % pjoin(self.me_dir, 'Events', self.run_name))
3937+ else:
3938+ logger.info('The results of this run' + \
3939+ ' have been saved in %s' % pjoin(self.me_dir, 'Events', self.run_name))
3940+
3941+
3942+ def combine_plots_HwU(self,jobs):
3943 """Sums all the plots in the HwU format."""
3944-
3945 logger.debug('Combining HwU plots.')
3946-
3947- with open(pjoin(self.me_dir,'SubProcesses','dirs.txt')) as dirf:
3948- all_histo_paths = dirf.readlines()
3949- all_histo_paths = [pjoin(self.me_dir,'SubProcesses',
3950- path.rstrip(),"MADatNLO.HwU") for path in all_histo_paths]
3951-
3952+ all_histo_paths=[]
3953+ for job in jobs:
3954+ all_histo_paths.append(pjoin(job['dirname'],"MADatNLO.HwU"))
3955 histogram_list = histograms.HwUList(all_histo_paths[0])
3956-
3957 for histo_path in all_histo_paths[1:]:
3958 for i, histo in enumerate(histograms.HwUList(histo_path)):
3959 # First make sure the plots have the same weight labels and such
3960@@ -1632,19 +1972,18 @@
3961 histogram_list.output(pjoin(self.me_dir,'SubProcesses',"MADatNLO"),
3962 format = 'gnuplot')
3963
3964- def applgrid_combine(self,cross,error):
3965+ def applgrid_combine(self,cross,error,jobs):
3966 """Combines the APPLgrids in all the SubProcess/P*/all_G*/ directories"""
3967 logger.debug('Combining APPLgrids \n')
3968 applcomb=pjoin(self.options['applgrid'].rstrip('applgrid-config'),
3969 'applgrid-combine')
3970- with open(pjoin(self.me_dir,'SubProcesses','dirs.txt')) as dirf:
3971- all_jobs=dirf.readlines()
3972+ all_jobs=[]
3973+ for job in jobs:
3974+ all_jobs.append(job['dirname'])
3975 ngrids=len(all_jobs)
3976- nobs =len([name for name in os.listdir(pjoin(self.me_dir,'SubProcesses',
3977- all_jobs[0].rstrip())) if name.endswith("_out.root")])
3978+ nobs =len([name for name in os.listdir(all_jobs[0]) if name.endswith("_out.root")])
3979 for obs in range(0,nobs):
3980- gdir = [pjoin(self.me_dir,'SubProcesses',job.rstrip(),"grid_obs_"+
3981- str(obs)+"_out.root") for job in all_jobs]
3982+ gdir = [pjoin(job,"grid_obs_"+str(obs)+"_out.root") for job in all_jobs]
3983 # combine APPLgrids from different channels for observable 'obs'
3984 if self.run_card["iappl"] == 1:
3985 misc.call([applcomb,'-o', pjoin(self.me_dir,"Events",self.run_name,
3986@@ -1656,8 +1995,7 @@
3987 self.run_name,"aMCfast_obs_"+str(obs)+".root"),'-s',
3988 str(unc2_inv),'--weight',str(unc2_inv)]+ gdir)
3989 for job in all_jobs:
3990- os.remove(pjoin(self.me_dir,'SubProcesses',job.rstrip(),
3991- "grid_obs_"+str(obs)+"_in.root"))
3992+ os.remove(pjoin(job,"grid_obs_"+str(obs)+"_in.root"))
3993 else:
3994 raise aMCatNLOError('iappl parameter can only be 0, 1 or 2')
3995 # after combining, delete the original grids
3996@@ -1698,14 +2036,10 @@
3997 if not hasattr(self, 'appl_start_grid') or not self.appl_start_grid:
3998 raise self.InvalidCmd('No APPLgrid name currently defined.'+
3999 'Please provide this information.')
4000- if mode == 'NLO':
4001- gdir='all_G'
4002- elif mode == 'LO':
4003- gdir='born_G'
4004 #copy the grid to all relevant directories
4005 for pdir in p_dirs:
4006 g_dirs = [file for file in os.listdir(pjoin(self.me_dir,
4007- "SubProcesses",pdir)) if file.startswith(gdir) and
4008+ "SubProcesses",pdir)) if file.startswith(mode+'_G') and
4009 os.path.isdir(pjoin(self.me_dir,"SubProcesses",pdir, file))]
4010 for g_dir in g_dirs:
4011 for grid in all_grids:
4012@@ -1714,28 +2048,20 @@
4013 'grid_obs_'+obs+'_in.root'))
4014
4015
4016- def collect_log_files(self, folders, istep):
4017+
4018+
4019+ def collect_log_files(self, jobs, integration_step):
4020 """collect the log files and put them in a single, html-friendly file
4021- inside the run_... directory"""
4022- step_list = ['Grid setting', 'Cross-section computation',
4023- 'Event generation']
4024+ inside the Events/run_.../ directory"""
4025 log_file = pjoin(self.me_dir, 'Events', self.run_name,
4026- 'alllogs_%d.html' % istep)
4027- # this keeps track of which step has been computed for which channel
4028- channel_dict = {}
4029- log_files = []
4030- for folder in folders:
4031- log_files += glob.glob(pjoin(self.me_dir, 'SubProcesses', 'P*',
4032- folder, 'log.txt'))
4033+ 'alllogs_%d.html' % integration_step)
4034+ outfile = open(log_file, 'w')
4035
4036 content = ''
4037-
4038- outfile = open(log_file, 'w')
4039-
4040 content += '<HTML><BODY>\n<font face="courier" size=2>'
4041- for log in log_files:
4042- channel_dict[os.path.dirname(log)] = [istep]
4043+ for job in jobs:
4044 # put an anchor
4045+ log=pjoin(job['dirname'],'log_MINT%s.txt' % integration_step)
4046 content += '<a name=%s></a>\n' % (os.path.dirname(log).replace(
4047 pjoin(self.me_dir,'SubProcesses'),''))
4048 # and put some nice header
4049@@ -1743,7 +2069,7 @@
4050 content += '<br>LOG file for integration channel %s, %s <br>' % \
4051 (os.path.dirname(log).replace(pjoin(self.me_dir,
4052 'SubProcesses'), ''),
4053- step_list[istep])
4054+ integration_step)
4055 content += '</font>\n'
4056 #then just flush the content of the small log inside the big log
4057 #the PRE tag prints everything verbatim
4058@@ -1756,53 +2082,80 @@
4059 outfile.close()
4060
4061
4062- def read_results(self, output, mode):
4063- """extract results (cross-section, absolute cross-section and errors)
4064- from output, which should be formatted as
4065- Found 4 correctly terminated jobs
4066- random seed found in 'randinit' is 33
4067- Integrated abs(cross-section)
4068- 7.94473937e+03 +- 2.9953e+01 (3.7702e-01%)
4069- Integrated cross-section
4070- 6.63392298e+03 +- 3.7669e+01 (5.6782e-01%)
4071- for aMC@NLO/aMC@LO, and as
4072-
4073- for NLO/LO
4074- The cross_sect_dict is returned"""
4075- res = {}
4076- if mode in ['aMC@LO', 'aMC@NLO', 'noshower', 'noshowerLO']:
4077- pat = re.compile(\
4078-'''Found (\d+) correctly terminated jobs
4079-random seed found in 'randinit' is (\d+)
4080-Integrated abs\(cross-section\)
4081-\s*(\d+\.\d+e[+-]\d+) \+\- (\d+\.\d+e[+-]\d+) \((\d+\.\d+e[+-]\d+)\%\)
4082-Integrated cross-section
4083-\s*(\-?\d+\.\d+e[+-]\d+) \+\- (\d+\.\d+e[+-]\d+) \((\-?\d+\.\d+e[+-]\d+)\%\)''')
4084- else:
4085- pat = re.compile(\
4086-'''Found (\d+) correctly terminated jobs
4087-\s*(\-?\d+\.\d+e[+-]\d+) \+\- (\d+\.\d+e[+-]\d+) \((\-?\d+\.\d+e[+-]\d+)\%\)''')
4088- pass
4089-
4090- match = re.search(pat, output[0])
4091- if not match or output[1]:
4092- logger.info('Return code of the event collection: '+str(output[1]))
4093- logger.info('Output of the event collection:\n'+output[0])
4094- raise aMCatNLOError('An error occurred during the collection of results.\n' +
4095- 'Please check the .log files inside the directories which failed.')
4096-# if int(match.groups()[0]) != self.njobs:
4097-# raise aMCatNLOError('Not all jobs terminated successfully')
4098- if mode in ['aMC@LO', 'aMC@NLO', 'noshower', 'noshowerLO']:
4099- return {'randinit' : int(match.groups()[1]),
4100- 'xseca' : float(match.groups()[2]),
4101- 'erra' : float(match.groups()[3]),
4102- 'xsect' : float(match.groups()[5]),
4103- 'errt' : float(match.groups()[6])}
4104- else:
4105- return {'xsect' : float(match.groups()[1]),
4106- 'errt' : float(match.groups()[2])}
4107-
4108- def print_summary(self, options, step, mode, scale_pdf_info={}):
4109+ def finalise_run_FO(self,folder_name,jobs):
4110+ """Combine the plots and put the res*.txt files in the Events/run.../ folder."""
4111+ # Copy the res_*.txt files to the Events/run* folder
4112+ res_files=glob.glob(pjoin(self.me_dir, 'SubProcesses', 'res_*.txt'))
4113+ for res_file in res_files:
4114+ files.mv(res_file,pjoin(self.me_dir, 'Events', self.run_name))
4115+ # Collect the plots and put them in the Events/run* folder
4116+ self.combine_plots_FO(folder_name,jobs)
4117+ # If doing the applgrid-stuff, also combine those grids
4118+ # and put those in the Events/run* folder
4119+ if self.run_card['iappl'] != 0:
4120+ cross=self.cross_sect_dict['xsect']
4121+ error=self.cross_sect_dict['errt']
4122+ self.applgrid_combine(cross,error,jobs)
4123+
4124+
4125+ def setup_cluster_or_multicore(self):
4126+ """setup the number of cores for multicore, and the cluster-type for cluster runs"""
4127+ if self.cluster_mode == 1:
4128+ cluster_name = self.options['cluster_type']
4129+ self.cluster = cluster.from_name[cluster_name](**self.options)
4130+ if self.cluster_mode == 2:
4131+ try:
4132+ import multiprocessing
4133+ if not self.nb_core:
4134+ try:
4135+ self.nb_core = int(self.options['nb_core'])
4136+ except TypeError:
4137+ self.nb_core = multiprocessing.cpu_count()
4138+ logger.info('Using %d cores' % self.nb_core)
4139+ except ImportError:
4140+ self.nb_core = 1
4141+ logger.warning('Impossible to detect the number of cores => Using One.\n'+
4142+ 'Use set nb_core X in order to set this number and be able to'+
4143+ 'run in multicore.')
4144+
4145+ self.cluster = cluster.MultiCore(**self.options)
4146+
4147+
4148+ def clean_previous_results(self,options,p_dirs,folder_name):
4149+ """Clean previous results.
4150+ o. If doing only the reweighting step, do not delete anything and return directlty.
4151+ o. Always remove all the G*_* files (from split event generation).
4152+ o. Remove the G* (or born_G* or all_G*) only when NOT doing only_generation or reweight_only."""
4153+ if options['reweightonly']:
4154+ return
4155+ if not options['only_generation']:
4156+ self.update_status('Cleaning previous results', level=None)
4157+ for dir in p_dirs:
4158+ #find old folders to be removed
4159+ for obj in folder_name:
4160+ # list all the G* (or all_G* or born_G*) directories
4161+ to_rm = [file for file in \
4162+ os.listdir(pjoin(self.me_dir, 'SubProcesses', dir)) \
4163+ if file.startswith(obj[:-1]) and \
4164+ (os.path.isdir(pjoin(self.me_dir, 'SubProcesses', dir, file)) or \
4165+ os.path.exists(pjoin(self.me_dir, 'SubProcesses', dir, file)))]
4166+ # list all the G*_* directories (from split event generation)
4167+ to_always_rm = [file for file in \
4168+ os.listdir(pjoin(self.me_dir, 'SubProcesses', dir)) \
4169+ if file.startswith(obj[:-1]) and
4170+ '_' in file and not '_G' in file and \
4171+ (os.path.isdir(pjoin(self.me_dir, 'SubProcesses', dir, file)) or \
4172+ os.path.exists(pjoin(self.me_dir, 'SubProcesses', dir, file)))]
4173+
4174+ if not options['only_generation']:
4175+ to_always_rm.extend(to_rm)
4176+ if os.path.exists(pjoin(self.me_dir, 'SubProcesses', dir,'MadLoop5_resources.tar.gz')):
4177+ to_always_rm.append(pjoin(self.me_dir, 'SubProcesses', dir,'MadLoop5_resources.tar.gz'))
4178+ files.rm([pjoin(self.me_dir, 'SubProcesses', dir, d) for d in to_always_rm])
4179+ return
4180+
4181+
4182+ def print_summary(self, options, step, mode, scale_pdf_info={}, done=True):
4183 """print a summary of the results contained in self.cross_sect_dict.
4184 step corresponds to the mintMC step, if =2 (i.e. after event generation)
4185 some additional infos are printed"""
4186@@ -1813,25 +2166,35 @@
4187 if line.startswith('generate') or line.startswith('add process'):
4188 process = process+(line.replace('generate ', '')).replace('add process ','')+' ; '
4189 lpp = {0:'l', 1:'p', -1:'pbar'}
4190- proc_info = '\n Process %s\n Run at %s-%s collider (%s + %s GeV)' % \
4191- (process[:-3], lpp[self.run_card['lpp1']], lpp[self.run_card['lpp2']],
4192- self.run_card['ebeam1'], self.run_card['ebeam2'])
4193-
4194+ if self.ninitial == 1:
4195+ proc_info = '\n Process %s' % process[:-3]
4196+ else:
4197+ proc_info = '\n Process %s\n Run at %s-%s collider (%s + %s GeV)' % \
4198+ (process[:-3], lpp[self.run_card['lpp1']], lpp[self.run_card['lpp2']],
4199+ self.run_card['ebeam1'], self.run_card['ebeam2'])
4200+
4201+ if self.ninitial == 1:
4202+ self.cross_sect_dict['unit']='GeV'
4203+ self.cross_sect_dict['xsec_string']='(Partial) decay width'
4204+ self.cross_sect_dict['axsec_string']='(Partial) abs(decay width)'
4205+ else:
4206+ self.cross_sect_dict['unit']='pb'
4207+ self.cross_sect_dict['xsec_string']='Total cross-section'
4208+ self.cross_sect_dict['axsec_string']='Total abs(cross-section)'
4209 # Gather some basic statistics for the run and extracted from the log files.
4210 if mode in ['aMC@NLO', 'aMC@LO', 'noshower', 'noshowerLO']:
4211 log_GV_files = glob.glob(pjoin(self.me_dir, \
4212 'SubProcesses', 'P*','G*','log_MINT*.txt'))
4213- all_log_files = glob.glob(pjoin(self.me_dir, \
4214- 'SubProcesses', 'P*','G*','log*.txt'))
4215+ all_log_files = log_GV_files
4216 elif mode == 'NLO':
4217 log_GV_files = glob.glob(pjoin(self.me_dir, \
4218- 'SubProcesses', 'P*','all_G*','log*.txt'))
4219- all_log_files = sum([glob.glob(pjoin(self.me_dir,'SubProcesses', 'P*',
4220- '%sG*'%foldName,'log*.txt')) for foldName in ['all_']],[])
4221+ 'SubProcesses', 'P*','all_G*','log_MINT*.txt'))
4222+ all_log_files = log_GV_files
4223+
4224 elif mode == 'LO':
4225 log_GV_files = ''
4226- all_log_files = sum([glob.glob(pjoin(self.me_dir,'SubProcesses', 'P*',
4227- '%sG*'%foldName,'log*.txt')) for foldName in ['born_']],[])
4228+ all_log_files = glob.glob(pjoin(self.me_dir, \
4229+ 'SubProcesses', 'P*','born_G*','log_MINT*.txt'))
4230 else:
4231 raise aMCatNLOError, 'Running mode %s not supported.'%mode
4232
4233@@ -1843,13 +2206,13 @@
4234 if step != 2:
4235 message = status[step] + '\n\n Intermediate results:' + \
4236 ('\n Random seed: %(randinit)d' + \
4237- '\n Total cross-section: %(xsect)8.3e +- %(errt)6.1e pb' + \
4238- '\n Total abs(cross-section): %(xseca)8.3e +- %(erra)6.1e pb \n') \
4239+ '\n %(xsec_string)s: %(xsect)8.3e +- %(errt)6.1e %(unit)s' + \
4240+ '\n %(axsec_string)s: %(xseca)8.3e +- %(erra)6.1e %(unit)s \n') \
4241 % self.cross_sect_dict
4242 else:
4243
4244 message = '\n ' + status[step] + proc_info + \
4245- '\n Total cross-section: %(xsect)8.3e +- %(errt)6.1e pb' % \
4246+ '\n %(xsec_string)s: %(xsect)8.3e +- %(errt)6.1e %(unit)s' % \
4247 self.cross_sect_dict
4248
4249 if self.run_card['nevents']>=10000 and self.run_card['reweight_scale']:
4250@@ -1874,18 +2237,22 @@
4251 misc.format_timer(time.time()-self.start_time))
4252
4253 elif mode in ['NLO', 'LO']:
4254- status = ['Results after grid setup (cross-section is non-physical):',
4255+ status = ['Results after grid setup:','Current results:',
4256 'Final results and run summary:']
4257- if step == 0:
4258- message = '\n ' + status[step] + \
4259- '\n Total cross-section: %(xsect)8.3e +- %(errt)6.1e pb' % \
4260- self.cross_sect_dict
4261- elif step == 1:
4262- message = '\n ' + status[step] + proc_info + \
4263- '\n Total cross-section: %(xsect)8.3e +- %(errt)6.1e pb' % \
4264+ if (not done) and (step == 0):
4265+ message = '\n ' + status[0] + \
4266+ '\n %(xsec_string)s: %(xsect)8.3e +- %(errt)6.1e %(unit)s' % \
4267+ self.cross_sect_dict
4268+ elif not done:
4269+ message = '\n ' + status[1] + \
4270+ '\n %(xsec_string)s: %(xsect)8.3e +- %(errt)6.1e %(unit)s' % \
4271+ self.cross_sect_dict
4272+ elif done:
4273+ message = '\n ' + status[2] + proc_info + \
4274+ '\n %(xsec_string)s: %(xsect)8.3e +- %(errt)6.1e %(unit)s' % \
4275 self.cross_sect_dict
4276 if self.run_card['reweight_scale']:
4277- if int(self.run_card['ickkw'])!=-1:
4278+ if self.run_card['ickkw'] != -1:
4279 message = message + \
4280 ('\n Ren. and fac. scale uncertainty: +%0.1f%% -%0.1f%%') % \
4281 (scale_pdf_info['scale_upp'], scale_pdf_info['scale_low'])
4282@@ -1898,7 +2265,7 @@
4283 ('\n PDF uncertainty: +%0.1f%% -%0.1f%%') % \
4284 (scale_pdf_info['pdf_upp'], scale_pdf_info['pdf_low'])
4285
4286- if (mode in ['NLO', 'LO'] and step!=1) or \
4287+ if (mode in ['NLO', 'LO'] and not done) or \
4288 (mode in ['aMC@NLO', 'aMC@LO', 'noshower', 'noshowerLO'] and step!=2):
4289 logger.info(message+'\n')
4290 return
4291@@ -2359,7 +2726,6 @@
4292 scale_pdf_info={}
4293 if self.run_card['reweight_scale'] or self.run_card['reweight_PDF'] :
4294 scale_pdf_info = self.run_reweight(options['reweightonly'])
4295-
4296 self.update_status('Collecting events', level='parton', update_results=True)
4297 misc.compile(['collect_events'],
4298 cwd=pjoin(self.me_dir, 'SubProcesses'))
4299@@ -2383,6 +2749,10 @@
4300 misc.gzip(pjoin(self.me_dir, 'SubProcesses', filename), stdout=evt_file)
4301 if not options['reweightonly']:
4302 self.print_summary(options, 2, mode, scale_pdf_info)
4303+ res_files=glob.glob(pjoin(self.me_dir, 'SubProcesses', 'res*.txt'))
4304+ for res_file in res_files:
4305+ files.mv(res_file,pjoin(self.me_dir, 'Events', self.run_name))
4306+
4307 logger.info('The %s file has been generated.\n' % (evt_file))
4308 self.results.add_detail('nb_event', nevents)
4309 self.update_status('Events generated', level='parton', update_results=True)
4310@@ -2403,9 +2773,9 @@
4311
4312 #check that the number of split event files divides the number of
4313 # events, otherwise set it to 1
4314- if int(int(self.banner.get_detail('run_card', 'nevents')) / \
4315+ if int(self.banner.get_detail('run_card', 'nevents') / \
4316 self.shower_card['nsplit_jobs']) * self.shower_card['nsplit_jobs'] \
4317- != int(self.banner.get_detail('run_card', 'nevents')):
4318+ != self.banner.get_detail('run_card', 'nevents'):
4319 logger.warning(\
4320 'nsplit_jobs in the shower card is not a divisor of the number of events.\n' + \
4321 'Setting it to 1.')
4322@@ -2413,7 +2783,7 @@
4323
4324 # don't split jobs if the user asks to shower only a part of the events
4325 if self.shower_card['nevents'] > 0 and \
4326- self.shower_card['nevents'] < int(self.banner.get_detail('run_card', 'nevents')) and \
4327+ self.shower_card['nevents'] < self.banner.get_detail('run_card', 'nevents') and \
4328 self.shower_card['nsplit_jobs'] != 1:
4329 logger.warning(\
4330 'Only a part of the events will be showered.\n' + \
4331@@ -2503,6 +2873,18 @@
4332
4333 mcatnlo_log = pjoin(self.me_dir, 'mcatnlo.log')
4334 self.update_status('Compiling MCatNLO for %s...' % shower, level='shower')
4335+
4336+
4337+ # libdl may be needded for pythia 82xx
4338+ if shower == 'PYTHIA8' and not \
4339+ os.path.exists(pjoin(self.options['pythia8_path'], 'xmldoc')) and \
4340+ 'dl' not in self.shower_card['extralibs'].split():
4341+ # 'dl' has to be linked with the extralibs
4342+ self.shower_card['extralibs'] += ' dl'
4343+ logger.warning("'dl' was added to extralibs from the shower_card.dat.\n" + \
4344+ "It is needed for the correct running of PY8.2xx.\n" + \
4345+ "If this library cannot be found on your system, a crash will occur.")
4346+
4347 misc.call(['./MCatNLO_MadFKS.inputs'], stdout=open(mcatnlo_log, 'w'),
4348 stderr=open(mcatnlo_log, 'w'),
4349 cwd=pjoin(self.me_dir, 'MCatNLO'))
4350@@ -2554,10 +2936,10 @@
4351 # special treatment for pythia8
4352 files.mv(pjoin(self.me_dir, 'MCatNLO', 'Pythia8.cmd'), rundir)
4353 files.mv(pjoin(self.me_dir, 'MCatNLO', 'Pythia8.exe'), rundir)
4354- if os.path.exists(pjoin(self.options['pythia8_path'], 'xmldoc')):
4355+ if os.path.exists(pjoin(self.options['pythia8_path'], 'xmldoc')): # this is PY8.1xxx
4356 files.ln(pjoin(self.options['pythia8_path'], 'examples', 'config.sh'), rundir)
4357 files.ln(pjoin(self.options['pythia8_path'], 'xmldoc'), rundir)
4358- else:
4359+ else: # this is PY8.2xxx
4360 files.ln(pjoin(self.options['pythia8_path'], 'share/Pythia8/xmldoc'), rundir)
4361 #link the hwpp exe in the rundir
4362 if shower == 'HERWIGPP':
4363@@ -2987,8 +3369,8 @@
4364 init_dict = self.get_init_dict(evt_file)
4365
4366 if nevents < 0 or \
4367- nevents > int(self.banner.get_detail('run_card', 'nevents')):
4368- nevents = int(self.banner.get_detail('run_card', 'nevents'))
4369+ nevents > self.banner.get_detail('run_card', 'nevents'):
4370+ nevents = self.banner.get_detail('run_card', 'nevents')
4371
4372 nevents = nevents / self.shower_card['nsplit_jobs']
4373
4374@@ -3000,7 +3382,7 @@
4375
4376 content = 'EVPREFIX=%s\n' % pjoin(os.path.split(evt_file)[1])
4377 content += 'NEVENTS=%d\n' % nevents
4378- content += 'NEVENTS_TOT=%d\n' % (int(self.banner.get_detail('run_card', 'nevents')) /\
4379+ content += 'NEVENTS_TOT=%d\n' % (self.banner.get_detail('run_card', 'nevents') /\
4380 self.shower_card['nsplit_jobs'])
4381 content += 'MCMODE=%s\n' % shower
4382 content += 'PDLABEL=%s\n' % pdlabel
4383@@ -3113,7 +3495,7 @@
4384
4385
4386 def run_reweight(self, only):
4387- """runs the reweight_xsec_events eecutables on each sub-event file generated
4388+ """runs the reweight_xsec_events executables on each sub-event file generated
4389 to compute on the fly scale and/or PDF uncertainities"""
4390 logger.info(' Doing reweight')
4391
4392@@ -3231,7 +3613,7 @@
4393 scale_pdf_info['scale_low'] = 0.0
4394
4395 # get the pdf uncertainty in percent (according to the Hessian method)
4396- lhaid=int(self.run_card['lhaid'])
4397+ lhaid=self.run_card['lhaid']
4398 pdf_upp=0.0
4399 pdf_low=0.0
4400 if lhaid <= 90000:
4401@@ -3246,7 +3628,6 @@
4402 else:
4403 scale_pdf_info['pdf_upp'] = 0.0
4404 scale_pdf_info['pdf_low'] = 0.0
4405-
4406 else:
4407 # use Gaussian method (NNPDF)
4408 pdf_stdev=0.0
4409@@ -3263,7 +3644,6 @@
4410
4411 def wait_for_complete(self, run_type):
4412 """this function waits for jobs on cluster to complete their run."""
4413-
4414 starttime = time.time()
4415 #logger.info(' Waiting for submitted jobs to complete')
4416 update_status = lambda i, r, f: self.update_status((i, r, f, run_type),
4417@@ -3276,29 +3656,15 @@
4418
4419 def run_all(self, job_dict, arg_list, run_type='monitor', split_jobs = False):
4420 """runs the jobs in job_dict (organized as folder: [job_list]), with arguments args"""
4421- njob_split = 0
4422 self.ijob = 0
4423-
4424- # this is to keep track, if splitting evt generation, of the various
4425- # folders/args in order to resubmit the jobs if some of them fail
4426- self.split_folders = {}
4427-
4428 if run_type != 'shower':
4429 self.njobs = sum(len(jobs) for jobs in job_dict.values()) * len(arg_list)
4430 for args in arg_list:
4431 for Pdir, jobs in job_dict.items():
4432 for job in jobs:
4433- if not split_jobs:
4434- self.run_exe(job, args, run_type, cwd=pjoin(self.me_dir, 'SubProcesses', Pdir) )
4435- else:
4436- for n in self.find_jobs_to_split(Pdir, job, args[1]):
4437- self.run_exe(job, args + [n], run_type, cwd=pjoin(self.me_dir, 'SubProcesses', Pdir) )
4438- njob_split += 1
4439- # print some statistics if running serially
4440+ self.run_exe(job, args, run_type, cwd=pjoin(self.me_dir, 'SubProcesses', Pdir) )
4441 if self.cluster_mode == 2:
4442 time.sleep(1) # security to allow all jobs to be launched
4443- if njob_split > 0:
4444- self.njobs = njob_split
4445 else:
4446 self.njobs = len(arg_list)
4447 for args in arg_list:
4448@@ -3309,37 +3675,27 @@
4449
4450
4451
4452- def check_event_files(self):
4453+ def check_event_files(self,jobs):
4454 """check the integrity of the event files after splitting, and resubmit
4455 those which are not nicely terminated"""
4456- to_resubmit = []
4457- for dir in self.split_folders.keys():
4458+ jobs_to_resubmit = []
4459+ for job in jobs:
4460 last_line = ''
4461 try:
4462 last_line = subprocess.Popen(
4463- ['tail', '-n1', pjoin(dir, 'events.lhe')], \
4464+ ['tail', '-n1', pjoin(job['dirname'], 'events.lhe')], \
4465 stdout = subprocess.PIPE).stdout.read().strip()
4466 except IOError:
4467 pass
4468-
4469 if last_line != "</LesHouchesEvents>":
4470- to_resubmit.append(dir)
4471-
4472+ jobs_to_resubmit.append(job)
4473 self.njobs = 0
4474- if to_resubmit:
4475+ if jobs_to_resubmit:
4476 run_type = 'Resubmitting broken jobs'
4477 logger.info('Some event files are broken, corresponding jobs will be resubmitted.')
4478- logger.debug('Resubmitting\n' + '\n'.join(to_resubmit) + '\n')
4479- for dir in to_resubmit:
4480- files.rm([dir])
4481- job = self.split_folders[dir][0]
4482- args = self.split_folders[dir][1:]
4483- run_type = 'monitor'
4484- cwd = os.path.split(dir)[0]
4485- self.run_exe(job, args, run_type, cwd=cwd )
4486- self.njobs +=1
4487-
4488- self.wait_for_complete(run_type)
4489+ for job in jobs_to_resubmit:
4490+ logger.debug('Resubmitting ' + job['dirname'] + '\n')
4491+ self.run_all_jobs(jobs_to_resubmit,2,fixed_order=False)
4492
4493
4494 def find_jobs_to_split(self, pdir, job, arg):
4495@@ -3412,16 +3768,16 @@
4496 # the 'standard' amcatnlo job
4497 # check if args is a list of string
4498 if type(args[0]) == str:
4499- input_files, output_files, required_output, args = self.getIO_ajob(exe,cwd, args)
4500+ input_files, output_files, required_output, args = self.getIO_ajob(exe,cwd,args)
4501 #submitting
4502 self.cluster.submit2(exe, args, cwd=cwd,
4503 input_files=input_files, output_files=output_files,
4504 required_output=required_output)
4505
4506- # keep track of folders and arguments for splitted evt gen
4507- subfolder=output_files[-1].split('/')[0]
4508- if len(args) == 4 and '_' in subfolder:
4509- self.split_folders[pjoin(cwd,subfolder)] = [exe] + args
4510+# # keep track of folders and arguments for splitted evt gen
4511+# subfolder=output_files[-1].split('/')[0]
4512+# if len(args) == 4 and '_' in subfolder:
4513+# self.split_folders[pjoin(cwd,subfolder)] = [exe] + args
4514
4515 elif 'shower' in exe:
4516 # a shower job
4517@@ -3487,7 +3843,6 @@
4518 # use local disk if possible => need to stands what are the
4519 # input/output files
4520
4521- keep_fourth_arg = False
4522 output_files = []
4523 required_output = []
4524 input_files = [pjoin(self.me_dir, 'SubProcesses', 'randinit'),
4525@@ -3509,91 +3864,58 @@
4526 input_files.append(pjoin(cwd, 'OLE_order.olc'))
4527
4528 # File for the loop (might not be present if MadLoop is not used)
4529- if os.path.exists(pjoin(cwd,'MadLoop5_resources')) and \
4530+ if os.path.exists(pjoin(cwd,'MadLoop5_resources.tar.gz')) and \
4531 cluster.need_transfer(self.options):
4532 input_files.append(pjoin(cwd, 'MadLoop5_resources.tar.gz'))
4533+ elif os.path.exists(pjoin(cwd,'MadLoop5_resources')) and \
4534+ cluster.need_transfer(self.options):
4535 tf=tarfile.open(pjoin(cwd,'MadLoop5_resources.tar.gz'),'w:gz',
4536 dereference=True)
4537 tf.add(pjoin(cwd,'MadLoop5_resources'),arcname='MadLoop5_resources')
4538 tf.close()
4539-
4540- Ire = re.compile("for i in ([\d\s]*) ; do")
4541- try :
4542- fsock = open(exe)
4543- except IOError:
4544- fsock = open(pjoin(cwd,exe))
4545- text = fsock.read()
4546- data = Ire.findall(text)
4547- subdir = ' '.join(data).split()
4548+ input_files.append(pjoin(cwd, 'MadLoop5_resources.tar.gz'))
4549
4550- if args[0] == '0':
4551+ if args[1] == 'born' or args[1] == 'all':
4552 # MADEVENT MINT FO MODE
4553 input_files.append(pjoin(cwd, 'madevent_mintFO'))
4554- input_files.append(pjoin(self.me_dir, 'SubProcesses','madin.%s' % args[1]))
4555- #j=$2\_G$i
4556- for i in subdir:
4557- current = '%s_G%s' % (args[1],i)
4558- if os.path.exists(pjoin(cwd,current)):
4559- input_files.append(pjoin(cwd, current))
4560- output_files.append(current)
4561+ if args[2] == '0':
4562+ current = '%s_G%s' % (args[1],args[0])
4563+ else:
4564+ current = '%s_G%s_%s' % (args[1],args[0],args[2])
4565+ if os.path.exists(pjoin(cwd,current)):
4566+ input_files.append(pjoin(cwd, current))
4567+ output_files.append(current)
4568
4569- required_output.append('%s/results.dat' % current)
4570- required_output.append('%s/log.txt' % current)
4571- required_output.append('%s/mint_grids' % current)
4572- required_output.append('%s/grid.MC_integer' % current)
4573- if len(args) == 4:
4574- required_output.append('%s/scale_pdf_dependence.dat' % current)
4575- args[2] = '-1'
4576- # use a grid train on another part
4577- base = '%s_G%s' % (args[3],i)
4578- if args[0] == '0':
4579- to_move = ['grid.MC_integer','mint_grids']
4580- elif args[0] == '1':
4581- to_move = ['mint_grids', 'grid.MC_integer']
4582- else:
4583- to_move = []
4584- if self.run_card['iappl'] == 2:
4585- for grid in glob.glob(pjoin(cwd,base,'grid_obs_*_in.root')):
4586- to_move.append(grid)
4587- if not os.path.exists(pjoin(cwd,current)):
4588- os.mkdir(pjoin(cwd,current))
4589- input_files.append(pjoin(cwd, current))
4590- for name in to_move:
4591- files.cp(pjoin(cwd,base, name),
4592- pjoin(cwd,current))
4593- files.cp(pjoin(cwd,base, 'grid.MC_integer'),
4594- pjoin(cwd,current))
4595+ required_output.append('%s/results.dat' % current)
4596+ required_output.append('%s/res_%s.dat' % (current,args[3]))
4597+ required_output.append('%s/log_MINT%s.txt' % (current,args[3]))
4598+ required_output.append('%s/mint_grids' % current)
4599+ required_output.append('%s/grid.MC_integer' % current)
4600+ if args[3] != '0':
4601+ required_output.append('%s/scale_pdf_dependence.dat' % current)
4602
4603- elif args[0] == '2':
4604+ elif args[1] == 'F' or args[1] == 'B':
4605 # MINTMC MODE
4606 input_files.append(pjoin(cwd, 'madevent_mintMC'))
4607- if args[2] in ['0','2']:
4608- input_files.append(pjoin(self.me_dir, 'SubProcesses','madinMMC_%s.2' % args[1]))
4609-
4610- for i in subdir:
4611- current = 'G%s%s' % (args[1], i)
4612- if os.path.exists(pjoin(cwd,current)):
4613- input_files.append(pjoin(cwd, current))
4614- output_files.append(current)
4615- if len(args) == 4 and args[3] in ['H','S','V','B','F']:
4616- # use a grid train on another part
4617- base = '%s_%s' % (args[3],i)
4618- files.ln(pjoin(cwd,base,'mint_grids'), name = 'preset_mint_grids',
4619- starting_dir=pjoin(cwd,current))
4620- files.ln(pjoin(cwd,base,'grid.MC_integer'),
4621- starting_dir=pjoin(cwd,current))
4622- elif len(args) ==4:
4623- keep_fourth_arg = True
4624- # this is for the split event generation
4625- output_files.append('G%s%s_%s' % (args[1], i, args[3]))
4626- required_output.append('G%s%s_%s/log_MINT%s.txt' % (args[1], i, args[3],args[2]))
4627-
4628- else:
4629- required_output.append('%s/log_MINT%s.txt' % (current,args[2]))
4630- if args[2] in ['0','1']:
4631- required_output.append('%s/results.dat' % current)
4632- if args[2] == '1':
4633- output_files.append('%s/results.dat' % current)
4634+
4635+ if args[2] == '0':
4636+ current = 'G%s%s' % (args[1],args[0])
4637+ else:
4638+ current = 'G%s%s_%s' % (args[1],args[0],args[2])
4639+ if os.path.exists(pjoin(cwd,current)):
4640+ input_files.append(pjoin(cwd, current))
4641+ output_files.append(current)
4642+ if args[2] > '0':
4643+ # this is for the split event generation
4644+ output_files.append('G%s%s_%s' % (args[1], args[0], args[2]))
4645+ required_output.append('G%s%s_%s/log_MINT%s.txt' % (args[1],args[0],args[2],args[3]))
4646+
4647+ else:
4648+ required_output.append('%s/log_MINT%s.txt' % (current,args[3]))
4649+ if args[3] in ['0','1']:
4650+ required_output.append('%s/results.dat' % current)
4651+ if args[3] == '1':
4652+ output_files.append('%s/results.dat' % current)
4653
4654 else:
4655 raise aMCatNLOError, 'not valid arguments: %s' %(', '.join(args))
4656@@ -3601,73 +3923,9 @@
4657 #Find the correct PDF input file
4658 pdfinput = self.get_pdf_input_filename()
4659 if os.path.exists(pdfinput):
4660- input_files.append(pdfinput)
4661-
4662- if len(args) == 4 and not keep_fourth_arg:
4663- args = args[:3]
4664-
4665+ input_files.append(pdfinput)
4666 return input_files, output_files, required_output, args
4667-
4668- def write_madinMMC_file(self, path, run_mode, mint_mode):
4669- """writes the madinMMC_?.2 file"""
4670- #check the validity of the arguments
4671- run_modes = ['born', 'virt', 'novi', 'all', 'viSB', 'novB']
4672- if run_mode not in run_modes:
4673- raise aMCatNLOError('%s is not a valid mode for run. Please use one of the following: %s' \
4674- % (run_mode, ', '.join(run_modes)))
4675- mint_modes = [0, 1, 2]
4676- if mint_mode not in mint_modes:
4677- raise aMCatNLOError('%s is not a valid mode for mintMC. Please use one of the following: %s' \
4678- % (mint_mode, ', '.join(mint_modes)))
4679- if run_mode in ['born']:
4680- name_suffix = 'B'
4681- elif run_mode in ['virt', 'viSB']:
4682- name_suffix = 'V'
4683- else:
4684- name_suffix = 'F'
4685-
4686- content = \
4687-"""-1 12 ! points, iterations
4688-0.03 ! desired fractional accuracy
4689-1 -0.1 ! alpha, beta for Gsoft
4690--1 -0.1 ! alpha, beta for Gazi
4691-1 ! Suppress amplitude (0 no, 1 yes)?
4692-1 ! Exact helicity sum (0 yes, n = number/event)?
4693-1 ! Enter Configuration Number:
4694-%1d ! MINT imode: 0 to set-up grids, 1 to perform integral, 2 generate events
4695-1 1 1 ! if imode is 1: Folding parameters for xi_i, phi_i and y_ij
4696-%s ! all, born, real, virt
4697-""" \
4698- % (mint_mode, run_mode)
4699- file = open(pjoin(path, 'madinMMC_%s.2' % name_suffix), 'w')
4700- file.write(content)
4701- file.close()
4702-
4703- def write_madin_file(self, path, run_mode, vegas_mode, npoints, niters, accuracy='0'):
4704- """writes the madin.run_mode file"""
4705- #check the validity of the arguments
4706- run_modes = ['born', 'virt', 'novi', 'all', 'viSB', 'novB', 'grid']
4707- if run_mode not in run_modes:
4708- raise aMCatNLOError('%s is not a valid mode for run. Please use one of the following: %s' \
4709- % (run_mode, ', '.join(run_modes)))
4710- name_suffix = run_mode
4711-
4712- content = \
4713-"""%s %s ! points, iterations
4714-%s ! accuracy
4715-2 ! 0 fixed grid 2 adjust
4716-1 ! 1 suppress amp, 0 doesnt
4717-1 ! 0 for exact hel sum
4718-1 ! hel configuration numb
4719-'test'
4720-1 ! 1 to save grids
4721-%s ! 0 to exclude, 1 for new run, 2 to restart, 3 to reset w/ keeping grid
4722-%s ! all, born, real, virt
4723-""" \
4724- % (npoints,niters,accuracy,vegas_mode,run_mode)
4725- file = open(pjoin(path, 'madin.%s' % name_suffix), 'w')
4726- file.write(content)
4727- file.close()
4728+
4729
4730 def compile(self, mode, options):
4731 """compiles aMC@NLO to compute either NLO or NLO matched to shower, as
4732@@ -3730,10 +3988,10 @@
4733
4734 self.link_lhapdf(libdir, [pjoin('SubProcesses', p) for p in p_dirs])
4735 pdfsetsdir = self.get_lhapdf_pdfsetsdir()
4736- lhaid_list = [int(self.run_card['lhaid'])]
4737+ lhaid_list = [self.run_card['lhaid']]
4738 if self.run_card['reweight_PDF']:
4739- lhaid_list.append(int(self.run_card['PDF_set_min']))
4740- lhaid_list.append(int(self.run_card['PDF_set_max']))
4741+ lhaid_list.append(self.run_card['PDF_set_min'])
4742+ lhaid_list.append(self.run_card['PDF_set_max'])
4743 self.copy_lhapdf_set(lhaid_list, pdfsetsdir)
4744
4745 else:
4746@@ -4045,18 +4303,23 @@
4747 void = 'NOT INSTALLED'
4748 switch_order = ['order', 'fixed_order', 'shower','madspin', 'reweight']
4749 switch_default = {'order': 'NLO', 'fixed_order': 'OFF', 'shower': void,
4750- 'madspin': void}
4751+ 'madspin': void,'reweight':'OFF'}
4752 if not switch:
4753 switch = switch_default
4754 else:
4755 switch.update(dict((k,value) for k,v in switch_default.items() if k not in switch))
4756-
4757 default_switch = ['ON', 'OFF']
4758+
4759+
4760 allowed_switch_value = {'order': ['LO', 'NLO'],
4761 'fixed_order': default_switch,
4762 'shower': default_switch,
4763 'madspin': default_switch,
4764 'reweight': default_switch}
4765+
4766+
4767+
4768+
4769
4770 description = {'order': 'Perturbative order of the calculation:',
4771 'fixed_order': 'Fixed order (no event generation and no MC@[N]LO matching):',
4772@@ -4072,22 +4335,35 @@
4773 special_values = ['LO', 'NLO', 'aMC@NLO', 'aMC@LO', 'noshower', 'noshowerLO']
4774
4775 assign_switch = lambda key, value: switch.__setitem__(key, value if switch[key] != void else void )
4776-
4777+
4778+ if self.proc_characteristics['ninitial'] == 1:
4779+ switch['fixed_order'] = 'ON'
4780+ switch['shower'] = 'Not available for decay'
4781+ switch['madspin'] = 'Not available for decay'
4782+ switch['reweight'] = 'Not available for decay'
4783+ allowed_switch_value['fixed_order'] = ['ON']
4784+ allowed_switch_value['shower'] = ['OFF']
4785+ allowed_switch_value['madspin'] = ['OFF']
4786+ allowed_switch_value['reweight'] = ['OFF']
4787+ available_mode = ['0','1']
4788+ special_values = ['LO', 'NLO']
4789+ else:
4790+ # Init the switch value according to the current status
4791+ available_mode = ['0', '1', '2','3']
4792
4793 if mode == 'auto':
4794 mode = None
4795 if not mode and (options['parton'] or options['reweightonly']):
4796 mode = 'noshower'
4797
4798- # Init the switch value according to the current status
4799- available_mode = ['0', '1', '2']
4800- available_mode.append('3')
4801- if os.path.exists(pjoin(self.me_dir, 'Cards', 'shower_card.dat')):
4802- switch['shower'] = 'ON'
4803- else:
4804- switch['shower'] = 'OFF'
4805+
4806+ if '3' in available_mode:
4807+ if os.path.exists(pjoin(self.me_dir, 'Cards', 'shower_card.dat')):
4808+ switch['shower'] = 'ON'
4809+ else:
4810+ switch['shower'] = 'OFF'
4811
4812- if not aMCatNLO or self.options['mg5_path']:
4813+ if (not aMCatNLO or self.options['mg5_path']) and '3' in available_mode:
4814 available_mode.append('4')
4815 if os.path.exists(pjoin(self.me_dir,'Cards','madspin_card.dat')):
4816 switch['madspin'] = 'ON'
4817@@ -4102,8 +4378,7 @@
4818 else:
4819 switch['reweight'] = 'Not available (requires NumPy)'
4820
4821-
4822- if 'do_reweight' in options and options['do_reweight']:
4823+ if 'do_reweight' in options and options['do_reweight'] and '3' in available_mode:
4824 if switch['reweight'] == "OFF":
4825 switch['reweight'] = "ON"
4826 elif switch['reweight'] != "ON":
4827@@ -4113,12 +4388,12 @@
4828 switch['madspin'] = 'ON'
4829 elif switch['madspin'] != "ON":
4830 logger.critical("Cannot run MadSpin module: %s" % switch['reweight'])
4831-
4832-
4833+
4834 answers = list(available_mode) + ['auto', 'done']
4835 alias = {}
4836 for id, key in enumerate(switch_order):
4837- if switch[key] != void and switch[key] in allowed_switch_value[key]:
4838+ if switch[key] != void and switch[key] in allowed_switch_value[key] and \
4839+ len(allowed_switch_value[key]) >1:
4840 answers += ['%s=%s' % (key, s) for s in allowed_switch_value[key]]
4841 #allow lower case for on/off
4842 alias.update(dict(('%s=%s' % (key, s.lower()), '%s=%s' % (key, s))
4843@@ -4149,7 +4424,7 @@
4844 elif answer in ['0', 'auto', 'done']:
4845 return
4846 elif answer in special_values:
4847- logger.info('Enter mode value: Go to the related mode', '$MG:color:BLACK')
4848+ logger.info('Enter mode value: %s. Go to the related mode' % answer, '$MG:color:BLACK')
4849 #assign_switch('reweight', 'OFF')
4850 #assign_switch('madspin', 'OFF')
4851 if answer == 'LO':
4852@@ -4180,7 +4455,6 @@
4853 return
4854 return switch
4855
4856-
4857 modify_switch(mode, self.last_mode, switch)
4858 if switch['madspin'] == 'OFF' and os.path.exists(pjoin(self.me_dir,'Cards','madspin_card.dat')):
4859 assign_switch('madspin', 'ON')
4860@@ -4272,9 +4546,9 @@
4861 if mode in ['LO','aMC@LO','noshowerLO']:
4862 self.run_name += '_LO'
4863 self.set_run_name(self.run_name, self.run_tag, 'parton')
4864- if int(self.run_card['ickkw']) == 3 and mode in ['LO', 'aMC@LO', 'noshowerLO']:
4865+ if self.run_card['ickkw'] == 3 and mode in ['LO', 'aMC@LO', 'noshowerLO']:
4866 raise self.InvalidCmd("""FxFx merging (ickkw=3) not allowed at LO""")
4867- elif int(self.run_card['ickkw']) == 3 and mode in ['aMC@NLO', 'noshower']:
4868+ elif self.run_card['ickkw'] == 3 and mode in ['aMC@NLO', 'noshower']:
4869 logger.warning("""You are running with FxFx merging enabled. To be able to merge
4870 samples of various multiplicities without double counting, you
4871 have to remove some events after showering 'by hand'. Please
4872@@ -4290,7 +4564,7 @@
4873 error = '''Stop opertation'''
4874 self.ask_run_configuration(mode, options)
4875 # raise aMCatNLOError(error)
4876- elif int(self.run_card['ickkw']) == -1 and mode in ['aMC@NLO', 'noshower']:
4877+ elif self.run_card['ickkw'] == -1 and mode in ['aMC@NLO', 'noshower']:
4878 # NNLL+NLO jet-veto only possible for LO event generation or fNLO runs.
4879 raise self.InvalidCmd("""NNLL+NLO jet veto runs (ickkw=-1) only possible for fNLO or LO.""")
4880 if 'aMC@' in mode or mode == 'onlyshower':
4881
4882=== modified file 'madgraph/interface/coloring_logging.py' (properties changed: -x to +x)
4883=== modified file 'madgraph/interface/common_run_interface.py' (properties changed: -x to +x)
4884--- madgraph/interface/common_run_interface.py 2015-08-27 19:32:34 +0000
4885+++ madgraph/interface/common_run_interface.py 2015-10-25 15:32:18 +0000
4886@@ -221,19 +221,17 @@
4887 #restrict_file = None
4888 #if os.path.exists(pjoin(ufo_path, 'restrict_default.dat')):
4889 # restrict_file = pjoin(ufo_path, 'restrict_default.dat')
4890+
4891+ force_CMS = self.mother and self.mother.options['complex_mass_scheme']
4892 model = import_ufo.import_model(modelname, decay=True,
4893- restrict=True)
4894- if self.mother and self.mother.options['complex_mass_scheme']:
4895- model.change_mass_to_complex_scheme()
4896+ restrict=True, complex_mass_scheme=force_CMS)
4897 else:
4898- model = import_ufo.import_model(pjoin(
4899- self.me_dir,'bin','internal', 'ufomodel'),decay=True)
4900 #pattern for checking complex mass scheme.
4901 has_cms = re.compile(r'''set\s+complex_mass_scheme\s*(True|T|1|true|$|;)''')
4902- if has_cms.search(open(pjoin(self.me_dir,'Cards','proc_card_mg5.dat')\
4903- ).read()):
4904- model.change_mass_to_complex_scheme()
4905-
4906+ force_CMS = has_cms.search(open(pjoin(self.me_dir,'Cards',
4907+ 'proc_card_mg5.dat')).read())
4908+ model = import_ufo.import_model(pjoin(self.me_dir,'bin','internal',
4909+ 'ufomodel'), decay=True, complex_mass_scheme=force_CMS)
4910
4911 # if not hasattr(model.get('particles')[0], 'partial_widths'):
4912 # raise self.InvalidCmd, 'The UFO model does not include partial widths information. Impossible to compute widths automatically'
4913@@ -508,6 +506,7 @@
4914 options_madgraph= {'stdout_level':None}
4915
4916 options_madevent = {'automatic_html_opening':True,
4917+ 'notification_center':True,
4918 'run_mode':2,
4919 'cluster_queue':'madgraph',
4920 'cluster_time':None,
4921@@ -527,6 +526,8 @@
4922
4923 self.me_dir = me_dir
4924 self.options = options
4925+
4926+ self.param_card_iterator = [] #an placeholder containing a generator of paramcard for scanning
4927
4928 # usefull shortcut
4929 self.status = pjoin(self.me_dir, 'status')
4930@@ -658,7 +659,7 @@
4931
4932 if amcatnlo and not keepwidth:
4933 # force particle in final states to have zero width
4934- pids = self.get_pid_final_states()
4935+ pids = self.get_pid_final_initial_states()
4936 # check those which are charged under qcd
4937 if not MADEVENT and pjoin(self.me_dir,'bin','internal') not in sys.path:
4938 sys.path.insert(0,pjoin(self.me_dir,'bin','internal'))
4939@@ -780,11 +781,11 @@
4940 if fulltext == '':
4941 logger.warning('File %s is empty' % path)
4942 return 'unknown'
4943- text = re.findall('(<MGVersion>|ParticlePropagator|<mg5proccard>|CEN_max_tracker|#TRIGGER CARD|parameter set name|muon eta coverage|QES_over_ref|MSTP|b_stable|FO_ANALYSIS_FORMAT|MSTU|Begin Minpts|gridpack|ebeam1|block\s+mw_run|BLOCK|DECAY|launch|madspin|transfer_card\.dat|set)', fulltext, re.I)
4944+ text = re.findall('(<MGVersion>|ParticlePropagator|ExecutionPath|Treewriter|<mg5proccard>|CEN_max_tracker|#TRIGGER CARD|parameter set name|muon eta coverage|QES_over_ref|MSTP|b_stable|FO_ANALYSIS_FORMAT|MSTU|Begin Minpts|gridpack|ebeam1|block\s+mw_run|BLOCK|DECAY|launch|madspin|transfer_card\.dat|set)', fulltext, re.I)
4945 text = [t.lower() for t in text]
4946 if '<mgversion>' in text or '<mg5proccard>' in text:
4947 return 'banner'
4948- elif 'particlepropagator' in text:
4949+ elif 'particlepropagator' in text or 'executionpath' in text or 'treewriter' in text:
4950 return 'delphes_card.dat'
4951 elif 'cen_max_tracker' in text:
4952 return 'delphes_card.dat'
4953@@ -1351,8 +1352,8 @@
4954 self.update_status('delphes done', level='delphes', makehtml=False)
4955
4956 ############################################################################
4957- def get_pid_final_states(self):
4958- """Find the pid of all particles in the final states"""
4959+ def get_pid_final_initial_states(self):
4960+ """Find the pid of all particles in the final and initial states"""
4961 pids = set()
4962 subproc = [l.strip() for l in open(pjoin(self.me_dir,'SubProcesses',
4963 'subproc.mg'))]
4964@@ -1363,7 +1364,7 @@
4965 group = pat.findall(text)
4966 for particles in group:
4967 particles = particles.split(',')
4968- pids.update(set(particles[nb_init:]))
4969+ pids.update(set(particles))
4970
4971 return pids
4972
4973@@ -1532,6 +1533,12 @@
4974 first, second = args[1:3]
4975
4976 self.options[args[0]] = (int(first), int(second))
4977+ elif args[0] == 'notification_center':
4978+ if args[1] in ['None','True','False']:
4979+ self.allow_notification_center = eval(args[1])
4980+ self.options[args[0]] = eval(args[1])
4981+ else:
4982+ raise self.InvalidCmd('Not a valid value for notification_center')
4983 elif args[0] in self.options:
4984 if args[1] in ['None','True','False']:
4985 self.options[args[0]] = eval(args[1])
4986@@ -1594,12 +1601,29 @@
4987
4988
4989 def check_param_card(self, path, run=True):
4990- """Check that all the width are define in the param_card.
4991- If some width are set on 'Auto', call the computation tools."""
4992+ """
4993+ 1) Check that no scan parameter are present
4994+ 2) Check that all the width are define in the param_card.
4995+ - If a scan parameter is define. create the iterator and recall this fonction
4996+ on the first element.
4997+ - If some width are set on 'Auto', call the computation tools."""
4998
4999- pattern = re.compile(r'''decay\s+(\+?\-?\d+)\s+auto(@NLO|)''',re.I)
5000+ pattern_scan = re.compile(r'''^(decay)?[\s\d]*scan''', re.I+re.M)
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches

to all changes: