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

Proposed by Valentin Hirschi
Status: Superseded
Proposed branch: lp:~maddevelopers/mg5amcnlo/bias
Merge into: lp:mg5amcnlo/lts
Diff against target: 108920 lines (+88709/-5924)
290 files modified
Template/LO/Cards/pythia8_card_default.dat (+62/-0)
Template/LO/Cards/run_card.dat (+48/-47)
Template/LO/Source/BIAS/PY8_CKKW/PY8_CKKW.f (+180/-0)
Template/LO/Source/BIAS/PY8_CKKW/bias_dependencies (+5/-0)
Template/LO/Source/BIAS/PY8_CKKW/makefile (+59/-0)
Template/LO/Source/BIAS/PY8_CKKW/py8_mg5amc_bias_interface.cc (+121/-0)
Template/LO/Source/BIAS/dummy/dummy.f (+44/-0)
Template/LO/Source/BIAS/dummy/makefile (+21/-0)
Template/LO/Source/BIAS/ptj_bias/makefile (+27/-0)
Template/LO/Source/BIAS/ptj_bias/ptj_bias.f (+101/-0)
Template/LO/Source/cuts.inc (+7/-3)
Template/LO/Source/lhe_event_infos.inc (+16/-0)
Template/LO/Source/make_opts (+17/-6)
Template/LO/Source/run.inc (+8/-0)
Template/LO/Source/rw_events.f (+123/-2)
Template/LO/SubProcesses/cuts.f (+1750/-1319)
Template/LO/SubProcesses/makefile (+10/-3)
Template/LO/SubProcesses/reweight.f (+46/-0)
Template/LO/SubProcesses/setcuts.f (+15/-49)
Template/LO/SubProcesses/unwgt.f (+34/-21)
Template/LO/bin/internal/run_delphes3 (+30/-12)
Template/NLO/SubProcesses/BinothLHA.f (+8/-4)
Template/NLO/SubProcesses/check_poles.f (+2/-0)
Template/NLO/SubProcesses/makefile_loop.inc (+1/-0)
Template/loop_material/StandAlone/Cards/MadLoopParams.dat (+81/-12)
Template/loop_material/StandAlone/SubProcesses/MadLoopCommons.inc (+151/-6)
Template/loop_material/StandAlone/SubProcesses/MadLoopParamReader.f (+64/-7)
Template/loop_material/StandAlone/SubProcesses/MadLoopParams.inc (+12/-5)
Template/loop_material/StandAlone/SubProcesses/makefile (+2/-0)
UpdateNotes.txt (+20/-0)
VERSION (+2/-2)
aloha/aloha_writers.py (+15/-16)
aloha/template_files/ixxxxx.cc (+7/-7)
aloha/template_files/oxxxxx.cc (+12/-12)
aloha/template_files/txxxxx.cc (+5/-5)
aloha/template_files/vxxxxx.cc (+7/-7)
bin/mg5_aMC (+21/-4)
input/.mg5_configuration_default.txt (+21/-5)
madgraph/core/base_objects.py (+15/-13)
madgraph/core/diagram_generation.py (+47/-5)
madgraph/interface/amcatnlo_interface.py (+9/-4)
madgraph/interface/amcatnlo_run_interface.py (+72/-23)
madgraph/interface/common_run_interface.py (+1528/-188)
madgraph/interface/extended_cmd.py (+475/-37)
madgraph/interface/launch_ext_program.py (+2/-2)
madgraph/interface/loop_interface.py (+316/-16)
madgraph/interface/madevent_interface.py (+1184/-236)
madgraph/interface/madgraph_interface.py (+447/-341)
madgraph/interface/master_interface.py (+7/-4)
madgraph/interface/reweight_interface.py (+3/-1)
madgraph/iolibs/export_cpp.py (+463/-364)
madgraph/iolibs/export_fks.py (+88/-19)
madgraph/iolibs/export_v4.py (+441/-289)
madgraph/iolibs/file_writers.py (+3/-2)
madgraph/iolibs/group_subprocs.py (+2/-3)
madgraph/iolibs/template_files/addmothers.f (+5/-4)
madgraph/iolibs/template_files/auto_dsig_v4.inc (+10/-3)
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/loop_optimized/COLLIER_interface.inc (+646/-0)
madgraph/iolibs/template_files/loop_optimized/CT_interface.inc (+8/-8)
madgraph/iolibs/template_files/loop_optimized/GOLEM_interface.inc (+2/-2)
madgraph/iolibs/template_files/loop_optimized/TIR_interface.inc (+36/-13)
madgraph/iolibs/template_files/loop_optimized/loop_matrix_standalone.inc (+102/-16)
madgraph/iolibs/template_files/madevent_makefile_source (+2/-2)
madgraph/iolibs/template_files/madevent_run_config.inc (+4/-0)
madgraph/iolibs/template_files/matrix_loop_induced_madevent.inc (+4/-1)
madgraph/iolibs/template_files/matrix_loop_induced_madevent_group.inc (+4/-1)
madgraph/iolibs/template_files/pythia8/pythia8.2_main_makefile.inc (+1/-1)
madgraph/iolibs/template_files/read_slha.cc (+24/-26)
madgraph/iolibs/template_files/read_slha.h (+20/-18)
madgraph/iolibs/ufo_expression_parsers.py (+12/-1)
madgraph/loop/loop_diagram_generation.py (+4/-4)
madgraph/loop/loop_exporters.py (+188/-70)
madgraph/madevent/gen_crossxhtml.py (+218/-33)
madgraph/madevent/sum_html.py (+3/-0)
madgraph/various/banner.py (+1269/-112)
madgraph/various/diagram_symmetry.py (+1/-1)
madgraph/various/histograms.py (+208/-29)
madgraph/various/lhe_parser.py (+100/-73)
madgraph/various/misc.py (+212/-12)
madgraph/various/plot_djrs.py (+163/-0)
madgraph/various/process_checks.py (+78/-39)
madgraph/various/q_polynomial.py (+14/-0)
models/__init__.py (+2/-2)
models/check_param_card.py (+191/-29)
models/import_ufo.py (+2/-2)
models/model_reader.py (+19/-2)
models/usermod.py (+33/-8)
tests/IOTests.py (+3/-2)
tests/acceptance_tests/test_cmd.py (+5/-1)
tests/acceptance_tests/test_cmd_amcatnlo.py (+6/-1)
tests/acceptance_tests/test_cmd_madevent.py (+80/-3)
tests/acceptance_tests/test_cmd_madloop.py (+1/-0)
tests/acceptance_tests/test_export_fks.py (+23/-0)
tests/acceptance_tests/test_histograms.py (+0/-1)
tests/acceptance_tests/test_output_files.py (+2/-2)
tests/input_files/CKKWL_djrs.dat (+1304/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%COLLIER_interface.f (+732/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%CT_interface.f (+15/-269)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%GOLEM_interface.f (+4/-3)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%TIR_interface.f (+29/-56)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%born_matrix.f (+4/-4)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%check_sa.f (+2/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%loop_matrix.f (+120/-14)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%mp_compute_loop_coefs.f (+15/-5)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%unique_id.inc (+2/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%V0_udx_wp%COLLIER_interface.f (+732/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%V0_udx_wp%CT_interface.f (+15/-269)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%V0_udx_wp%GOLEM_interface.f (+4/-3)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%V0_udx_wp%TIR_interface.f (+29/-56)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%V0_udx_wp%born_matrix.f (+4/-4)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%V0_udx_wp%check_sa.f (+2/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%V0_udx_wp%loop_matrix.f (+120/-14)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%V0_udx_wp%mp_compute_loop_coefs.f (+15/-5)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%V0_udx_wp%unique_id.inc (+2/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_tdecay_fksreal/%SubProcesses%P0_t_budx%matrix_1.f (+4/-4)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_tdecay_fksreal/%SubProcesses%P0_t_budx%parton_lum_1.f (+2/-2)
tests/input_files/IOTestsComparison/IOHistogramTest/DJR_histograms/CKKWL_djrs_output.HwU (+1665/-0)
tests/input_files/IOTestsComparison/IOHistogramTest/DJR_histograms/CKKWL_djrs_output.gnuplot (+362/-0)
tests/input_files/IOTestsComparison/IOHistogramTest/DJR_histograms/MLM_djrs_output.HwU (+1665/-0)
tests/input_files/IOTestsComparison/IOHistogramTest/DJR_histograms/MLM_djrs_output.gnuplot (+362/-0)
tests/input_files/IOTestsComparison/LoopSquaredOrder_IOTest/Loop_sqso_uux_ddx/loop_matrix_QCDQEDpert_QCDsq_eq_4.f (+116/-10)
tests/input_files/IOTestsComparison/LoopSquaredOrder_IOTest/Loop_sqso_uux_ddx/loop_matrix_QCDQEDpert_QCDsq_gt_0_QEDAmpAndQEDsq_gt_2.f (+117/-11)
tests/input_files/IOTestsComparison/LoopSquaredOrder_IOTest/Loop_sqso_uux_ddx/loop_matrix_QCDQEDpert_QCDsq_gt_4.f (+116/-10)
tests/input_files/IOTestsComparison/LoopSquaredOrder_IOTest/Loop_sqso_uux_ddx/loop_matrix_QCDQEDpert_QEDsq_le_4.f (+116/-10)
tests/input_files/IOTestsComparison/LoopSquaredOrder_IOTest/Loop_sqso_uux_ddx/loop_matrix_QCDQEDpert_WGTsq_le_10_QEDAmpAndQEDsq_gt_2.f (+117/-11)
tests/input_files/IOTestsComparison/LoopSquaredOrder_IOTest/Loop_sqso_uux_ddx/loop_matrix_QCDQEDpert_default.f (+116/-10)
tests/input_files/IOTestsComparison/LoopSquaredOrder_IOTest/Loop_sqso_uux_ddx/loop_matrix_QCDpert_default.f (+116/-10)
tests/input_files/IOTestsComparison/LoopSquaredOrder_IOTest/Loop_sqso_uux_ddx/loop_matrix_QEDpert_default.f (+116/-10)
tests/input_files/IOTestsComparison/MECmdShell/check_html_long_process_strings/info.html (+2/-2)
tests/input_files/IOTestsComparison/MadLoop_output_from_the_interface/TIR_output/%ggttx_IOTest%SubProcesses%MadLoopCommons.f (+141/-9)
tests/input_files/IOTestsComparison/MadLoop_output_from_the_interface/TIR_output/%ggttx_IOTest%SubProcesses%MadLoopParamReader.f (+64/-7)
tests/input_files/IOTestsComparison/MadLoop_output_from_the_interface/TIR_output/%ggttx_IOTest%SubProcesses%P0_gg_ttx%COLLIER_interface.f (+740/-0)
tests/input_files/IOTestsComparison/MadLoop_output_from_the_interface/TIR_output/%ggttx_IOTest%SubProcesses%P0_gg_ttx%CT_interface.f (+27/-280)
tests/input_files/IOTestsComparison/MadLoop_output_from_the_interface/TIR_output/%ggttx_IOTest%SubProcesses%P0_gg_ttx%GOLEM_interface.f (+2/-1)
tests/input_files/IOTestsComparison/MadLoop_output_from_the_interface/TIR_output/%ggttx_IOTest%SubProcesses%P0_gg_ttx%TIR_interface.f (+25/-6)
tests/input_files/IOTestsComparison/MadLoop_output_from_the_interface/TIR_output/%ggttx_IOTest%SubProcesses%P0_gg_ttx%check_sa.f (+2/-0)
tests/input_files/IOTestsComparison/MadLoop_output_from_the_interface/TIR_output/%ggttx_IOTest%SubProcesses%P0_gg_ttx%loop_matrix.f (+117/-11)
tests/input_files/IOTestsComparison/MadLoop_output_from_the_interface/TIR_output/%ggttx_IOTest%SubProcesses%P0_gg_ttx%mp_compute_loop_coefs.f (+13/-3)
tests/input_files/IOTestsComparison/SquaredOrder_IOTest/sqso_uux_uuxuuxx/matrix_ampOrderQED2_eq_2_WGTsq_le_14_QCDsq_gt_4.f (+2/-2)
tests/input_files/IOTestsComparison/TestCmdMatchBox/MatchBoxOutput/%TEST%SubProcesses%P1_uux_uux%COLLIER_interface.f (+732/-0)
tests/input_files/IOTestsComparison/TestCmdMatchBox/MatchBoxOutput/%TEST%SubProcesses%P1_uux_uux%CT_interface.f (+19/-274)
tests/input_files/IOTestsComparison/TestCmdMatchBox/MatchBoxOutput/%TEST%SubProcesses%P1_uux_uux%GOLEM_interface.f (+2/-1)
tests/input_files/IOTestsComparison/TestCmdMatchBox/MatchBoxOutput/%TEST%SubProcesses%P1_uux_uux%TIR_interface.f (+25/-6)
tests/input_files/IOTestsComparison/TestCmdMatchBox/MatchBoxOutput/%TEST%SubProcesses%P1_uux_uux%check_sa.f (+2/-0)
tests/input_files/IOTestsComparison/TestCmdMatchBox/MatchBoxOutput/%TEST%SubProcesses%P1_uux_uux%loop_matrix.f (+117/-11)
tests/input_files/IOTestsComparison/TestCmdMatchBox/MatchBoxOutput/%TEST%SubProcesses%P1_uux_uux%mp_compute_loop_coefs.f (+13/-3)
tests/input_files/IOTestsComparison/TestCmdMatchBox/MatchBoxOutput/%TEST%SubProcesses%P1_uux_uux%unique_id.inc (+2/-0)
tests/input_files/IOTestsComparison/TestMadWeight/modification_to_cuts/cuts.f (+447/-26)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/dux_mumvmxg/%..%..%Source%MODEL%couplings.f (+3/-3)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/dux_mumvmxg/CT_interface.f (+1/-1)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/dux_mumvmxg/born_matrix.f (+2/-2)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/dux_mumvmxg/check_sa.f (+2/-0)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/dux_mumvmxg/loop_matrix.f (+1/-1)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/dux_mumvmxg/mp_born_amps_and_wfs.f (+1/-1)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/dux_mumvmxg/unique_id.inc (+2/-0)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/gg_wmtbx/%..%..%Source%MODEL%couplings.f (+3/-3)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/gg_wmtbx/CT_interface.f (+1/-1)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/gg_wmtbx/born_matrix.f (+2/-2)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/gg_wmtbx/check_sa.f (+2/-0)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/gg_wmtbx/loop_matrix.f (+1/-1)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/gg_wmtbx/mp_born_amps_and_wfs.f (+1/-1)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/gg_wmtbx/unique_id.inc (+2/-0)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/dux_mumvmxg/%..%..%Source%MODEL%couplings.f (+3/-3)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/dux_mumvmxg/CT_interface.f (+3/-2)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/dux_mumvmxg/TIR_interface.f (+14/-6)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/dux_mumvmxg/born_matrix.f (+2/-2)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/dux_mumvmxg/check_sa.f (+2/-0)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/dux_mumvmxg/loop_matrix.f (+112/-11)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/dux_mumvmxg/mp_compute_loop_coefs.f (+1/-1)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/dux_mumvmxg/unique_id.inc (+2/-0)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/gg_wmtbx/%..%..%Source%MODEL%couplings.f (+3/-3)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/gg_wmtbx/CT_interface.f (+3/-2)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/gg_wmtbx/TIR_interface.f (+14/-6)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/gg_wmtbx/born_matrix.f (+2/-2)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/gg_wmtbx/check_sa.f (+2/-0)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/gg_wmtbx/loop_matrix.f (+112/-11)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/gg_wmtbx/mp_compute_loop_coefs.f (+1/-1)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/gg_wmtbx/unique_id.inc (+2/-0)
tests/input_files/IOTestsComparison/short_ML_SMQCD_LoopInduced/gg_hh/%..%..%Source%MODEL%couplings.f (+3/-3)
tests/input_files/IOTestsComparison/short_ML_SMQCD_LoopInduced/gg_hh/CT_interface.f (+1/-1)
tests/input_files/IOTestsComparison/short_ML_SMQCD_LoopInduced/gg_hh/check_sa.f (+2/-0)
tests/input_files/IOTestsComparison/short_ML_SMQCD_LoopInduced/gg_hh/loop_matrix.f (+1/-1)
tests/input_files/IOTestsComparison/short_ML_SMQCD_LoopInduced/gg_hh/mp_born_amps_and_wfs.f (+1/-1)
tests/input_files/IOTestsComparison/short_ML_SMQCD_LoopInduced/gg_hh/unique_id.inc (+2/-0)
tests/input_files/IOTestsComparison/short_ML_SMQCD_default/ddx_ttx/CT_interface.f (+1/-1)
tests/input_files/IOTestsComparison/short_ML_SMQCD_default/ddx_ttx/born_matrix.f (+2/-2)
tests/input_files/IOTestsComparison/short_ML_SMQCD_default/ddx_ttx/check_sa.f (+2/-0)
tests/input_files/IOTestsComparison/short_ML_SMQCD_default/ddx_ttx/loop_matrix.f (+1/-1)
tests/input_files/IOTestsComparison/short_ML_SMQCD_default/ddx_ttx/mp_born_amps_and_wfs.f (+1/-1)
tests/input_files/IOTestsComparison/short_ML_SMQCD_default/ddx_ttx/unique_id.inc (+2/-0)
tests/input_files/IOTestsComparison/short_ML_SMQCD_default/gg_ttx/%..%..%Source%MODEL%couplings.f (+3/-3)
tests/input_files/IOTestsComparison/short_ML_SMQCD_default/gg_ttx/CT_interface.f (+1/-1)
tests/input_files/IOTestsComparison/short_ML_SMQCD_default/gg_ttx/born_matrix.f (+2/-2)
tests/input_files/IOTestsComparison/short_ML_SMQCD_default/gg_ttx/check_sa.f (+2/-0)
tests/input_files/IOTestsComparison/short_ML_SMQCD_default/gg_ttx/loop_matrix.f (+1/-1)
tests/input_files/IOTestsComparison/short_ML_SMQCD_default/gg_ttx/mp_born_amps_and_wfs.f (+1/-1)
tests/input_files/IOTestsComparison/short_ML_SMQCD_default/gg_ttx/unique_id.inc (+2/-0)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/ddx_ttx/CT_interface.f (+3/-2)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/ddx_ttx/TIR_interface.f (+14/-6)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/ddx_ttx/born_matrix.f (+2/-2)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/ddx_ttx/check_sa.f (+2/-0)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/ddx_ttx/loop_matrix.f (+112/-11)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/ddx_ttx/mp_compute_loop_coefs.f (+1/-1)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/ddx_ttx/unique_id.inc (+2/-0)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/gg_ttx/%..%..%Source%MODEL%couplings.f (+3/-3)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/gg_ttx/CT_interface.f (+3/-2)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/gg_ttx/TIR_interface.f (+14/-6)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/gg_ttx/born_matrix.f (+2/-2)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/gg_ttx/check_sa.f (+2/-0)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/gg_ttx/loop_matrix.f (+112/-11)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/gg_ttx/mp_compute_loop_coefs.f (+1/-1)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/gg_ttx/unique_id.inc (+2/-0)
tests/input_files/MLM_djrs.dat (+1665/-0)
tests/input_files/loop_MSSM/CT_couplings.py (+22863/-0)
tests/input_files/loop_MSSM/CT_vertices.py (+7619/-0)
tests/input_files/loop_MSSM/MSSM_NLO.log (+87/-0)
tests/input_files/loop_MSSM/README.txt (+7/-0)
tests/input_files/loop_MSSM/__init__.py (+48/-0)
tests/input_files/loop_MSSM/coupling_orders.py (+17/-0)
tests/input_files/loop_MSSM/couplings.py (+6439/-0)
tests/input_files/loop_MSSM/function_library.py (+71/-0)
tests/input_files/loop_MSSM/lorentz.py (+198/-0)
tests/input_files/loop_MSSM/object_library.py (+377/-0)
tests/input_files/loop_MSSM/parameters.py (+1756/-0)
tests/input_files/loop_MSSM/particles.py (+814/-0)
tests/input_files/loop_MSSM/propagators.py (+35/-0)
tests/input_files/loop_MSSM/restrict_default.dat (+526/-0)
tests/input_files/loop_MSSM/restrict_parallel_test.dat (+532/-0)
tests/input_files/loop_MSSM/restrict_parallel_test_gogo.dat (+532/-0)
tests/input_files/loop_MSSM/restrict_test.dat (+532/-0)
tests/input_files/loop_MSSM/vertices.py (+9119/-0)
tests/input_files/loop_MSSM/write_param_card.py (+207/-0)
tests/parallel_tests/test_ML5.py (+1/-2)
tests/parallel_tests/test_ML5MSSMQCD.py (+5/-10)
tests/time_db (+84/-82)
tests/unit_tests/core/test_base_objects.py (+1/-1)
tests/unit_tests/interface/test_madevent.py (+8/-2)
tests/unit_tests/iolibs/test_export_cpp.py (+22/-22)
tests/unit_tests/iolibs/test_export_v4.py (+0/-2)
tests/unit_tests/iolibs/test_histograms.py (+88/-0)
tests/unit_tests/iolibs/test_link_to_ufo.py (+1/-1)
tests/unit_tests/loop/test_loop_exporters.py (+3/-3)
tests/unit_tests/madweight/test_export_v4.py (+2/-2)
tests/unit_tests/various/test_banner.py (+184/-4)
vendor/CutTools/src/avh/avh_olo.f90 (+425/-425)
vendor/CutTools/src/cts/cts_cutroutines.f90 (+1/-1)
vendor/CutTools/src/cts/cts_cuttools.f90 (+2/-2)
vendor/CutTools/src/cts/cts_loopfunctions.f90 (+2/-2)
vendor/IREGI/src/makefile_ML5_lib (+11/-8)
vendor/IREGI/src/mis_warp.f90 (+1/-1)
vendor/IREGI/src/oneloop/ONI/example/example.f (+4/-4)
vendor/IREGI/src/oneloop/avh_olo_foriregi.f90 (+11045/-0)
vendor/IREGI/src/oneloop/example/example.f (+4/-4)
vendor/IREGI/src/oneloop/example_arprec/f_test.f (+4/-4)
vendor/IREGI/src/oneloop/example_ddfun90/example.f (+4/-4)
vendor/IREGI/src/oneloop/example_mpfun90/example.f (+4/-4)
vendor/IREGI/src/oneloop/example_qdcpp/f_test.f (+4/-4)
vendor/IREGI/src/oneloop/src/avh_olo_a0.h90 (+1/-1)
vendor/IREGI/src/oneloop/src/avh_olo_an.h90 (+1/-1)
vendor/IREGI/src/oneloop/src/avh_olo_arprec.f90 (+3/-3)
vendor/IREGI/src/oneloop/src/avh_olo_arrays.f90 (+3/-3)
vendor/IREGI/src/oneloop/src/avh_olo_auxfun.f90 (+3/-3)
vendor/IREGI/src/oneloop/src/avh_olo_b0.h90 (+1/-1)
vendor/IREGI/src/oneloop/src/avh_olo_b11.h90 (+1/-1)
vendor/IREGI/src/oneloop/src/avh_olo_bn.h90 (+1/-1)
vendor/IREGI/src/oneloop/src/avh_olo_bnlog.f90 (+7/-7)
vendor/IREGI/src/oneloop/src/avh_olo_box.f90 (+7/-7)
vendor/IREGI/src/oneloop/src/avh_olo_boxc.f90 (+6/-6)
vendor/IREGI/src/oneloop/src/avh_olo_bub.f90 (+6/-6)
vendor/IREGI/src/oneloop/src/avh_olo_c0.h90 (+2/-2)
vendor/IREGI/src/oneloop/src/avh_olo_comb.f90 (+25/-25)
vendor/IREGI/src/oneloop/src/avh_olo_d0.h90 (+2/-2)
vendor/IREGI/src/oneloop/src/avh_olo_ddfun90.f90 (+2/-2)
vendor/IREGI/src/oneloop/src/avh_olo_dilog.f90 (+8/-8)
vendor/IREGI/src/oneloop/src/avh_olo_intrinsic.f90 (+3/-3)
vendor/IREGI/src/oneloop/src/avh_olo_kinds.f90 (+1/-1)
vendor/IREGI/src/oneloop/src/avh_olo_main.f90 (+9/-9)
vendor/IREGI/src/oneloop/src/avh_olo_mpfun90.f90 (+3/-3)
vendor/IREGI/src/oneloop/src/avh_olo_olog.f90 (+6/-6)
vendor/IREGI/src/oneloop/src/avh_olo_print.f90 (+2/-2)
vendor/IREGI/src/oneloop/src/avh_olo_qdcpp.f90 (+2/-2)
vendor/IREGI/src/oneloop/src/avh_olo_qmplx.f90 (+6/-6)
vendor/IREGI/src/oneloop/src/avh_olo_tri.f90 (+6/-6)
vendor/IREGI/src/oneloop/src/avh_olo_units.f90 (+1/-1)
vendor/IREGI/src/oneloop/src/avh_olo_version.f90 (+1/-1)
vendor/IREGI/src/oneloop/src/avh_olo_wrp01.f90 (+14/-14)
vendor/SMWidth/makefile_MW5 (+15/-9)
vendor/SMWidth/mis_warp.f90 (+1/-1)
To merge this branch: bzr merge lp:~maddevelopers/mg5amcnlo/bias
Reviewer Review Type Date Requested Status
Olivier Mattelaer Pending
Review via email: mp+303636@code.launchpad.net

This proposal has been superseded by a proposal from 2016-08-23.

Description of the change

Dear reviewers,

This branch introduces the possibility of using custom modules that can apply a bias weight to MadEvent integrand so as to change the distribution of "unweighted" events to smoothen an observable (for example the leading jet p_t) or to really affect the physics described.

There are several applications to such a module, and the one we have in mind for now is to call Pythia8 directly from MadEvent to compute the CKKW-L merging weights.

I have written the exhaustive details on this implementation on this wiki page

https://cp3.irmp.ucl.ac.be/projects/madgraph/wiki/LOEventGenerationBias

I already worked with Olivier to decide on the better structure, so his review should be quick.
But I wanted to add you, Rik and Marco, as well as reviewers because I think there would be much greater applications if we had the same sort of module at NLO!
In particular, we could compute the Pythia8 MC counterterms by calling their trial shower directly from such a module, so that we would have guaranteed consistency with the subsequent showers and lift the current limitations on its parameters!
In the same spirit (i.e. dynamically calling PY8 from the event generator) we might open new approaches to NLO merging, Mixed QCD+EW matching, and even matching in the presence of different resonance structures (say tt~ doubly+singly+non-resonance).

This implementation at LO could provide a basis to start a similar implementation at NLO. Please let me know your opinion on the matter.

Cheers,

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

small code improvment

306. By Valentin Hirschi

1. Fixed two tests.

307. By Valentin Hirschi

1. Merged

308. By Valentin Hirschi

1. Merged with Olivier's change for __type__

309. By Valentin Hirschi

1. merged with latest version of plugin_plus_pythia8

310. By Valentin Hirschi

1. merged with latest version of plugin_plus_pythia8

311. By Valentin Hirschi

1. Added an acceptance test for the bias functionality

312. By Olivier Mattelaer

fix problem with bias normalisation

313. By Valentin Hirschi

1. merged with plugin_plus_pythia8 and fixed bias-related tests.

314. By Valentin Hirschi

1. Removed the PY8_CKKW bias module which should not be part of the release.

315. By Valentin Hirschi

1. Merged with latest version of plugin.

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'PLUGIN'
2=== added file 'PLUGIN/__init__.py'
3=== added file 'PythiaMadEventCrossTalk.tar.gz'
4Binary files PythiaMadEventCrossTalk.tar.gz 1970-01-01 00:00:00 +0000 and PythiaMadEventCrossTalk.tar.gz 2016-08-23 01:19:18 +0000 differ
5=== added file 'Template/LO/Cards/pythia8_card_default.dat'
6--- Template/LO/Cards/pythia8_card_default.dat 1970-01-01 00:00:00 +0000
7+++ Template/LO/Cards/pythia8_card_default.dat 2016-08-23 01:19:18 +0000
8@@ -0,0 +1,62 @@
9+!
10+! Pythia8 cmd card automatically generated by MadGraph5_aMC@NLO
11+!
12+! ==================
13+! General parameters
14+! ==================
15+!
16+Main:numberOfEvents = -1
17+!
18+! -------------------------------------------------------------------
19+! Specify the HEPMC output of the Pythia8 shower. You can set it to:
20+! auto : to let MG5aMC automatically assign it
21+! fifo : to have MG5aMC setup the piping of the PY8 output to analysis
22+! tools such as MadAnalysis5. You can also use the syntax
23+! fifo@<fifo_path> to select where the fifo file should be
24+! created (useful to select a mounted drive that supports fifo)
25+! /dev/null : to turn off the HEPMC output.
26+! <path> : to select where the HEPMC file must written. It will
27+! therefore *not* be available in the process output.
28+! -------------------------------------------------------------------
29+!
30+HEPMCoutput:file = auto
31+!
32+! --------------------------------------------------------------------
33+! Parameters relevant only when performing MLM merging
34+! For details, see section 'Jet Matching' on the left-hand menu of
35+! http://home.thep.lu.se/~torbjorn/pythia81html/Welcome.html
36+! --------------------------------------------------------------------
37+! If equal to -1.0, MadGraph5_aMC@NLO will set it automatically based
38+! on the parameter 'xqcut' of the run_card.dat
39+JetMatching:qCut = -1.0
40+! Use default kt-MLM to match parton level jets to those produced by the
41+! shower. But the other Shower-kt scheme is available too with this option.
42+JetMatching:doShowerKt = off
43+! A value of -1 means that it is automatically guessed by MadGraph.
44+! It is however always safer to explicitly set it.
45+JetMatching:nJetMax = -1
46+!
47+! --------------------------------------------------------------------
48+! Parameters relevant only when performing CKKWL merging
49+! For details, see section 'CKKW-L Merging' on the left-hand menu of
50+! http://home.thep.lu.se/~torbjorn/pythia81html/Welcome.html
51+! --------------------------------------------------------------------
52+! Central merging scale values you want to be used.
53+! If equal to -1.0, then MadGraph5_aMC@NLO will set this automatically
54+! based on the parameter 'ktdurham' of the run_card.dat
55+Merging:TMS = -1.0
56+! This must be set manually, according to Pythia8 directives.
57+! An example of possible value is 'pp>LEPTONS,NEUTRINOS'
58+Merging:Process = <set_by_user>
59+! A value of -1 means that it is automatically guessed by MadGraph.
60+! It is however always safer to explicitly set it.
61+Merging:nJetMax = -1
62+!
63+! For all merging schemes, decide wehter you want the merging scale
64+! variation computed for only the central weights or all other
65+! PDF and scale variation weights as well
66+SysCalc:fullCutVariation = off
67+!
68+! ==========================
69+! User customized parameters
70+! ==========================
71
72=== modified file 'Template/LO/Cards/run_card.dat'
73--- Template/LO/Cards/run_card.dat 2015-08-11 00:35:53 +0000
74+++ Template/LO/Cards/run_card.dat 2016-08-23 01:19:18 +0000
75@@ -21,10 +21,6 @@
76 #*********************************************************************
77 %(run_tag)s = run_tag ! name of the run
78 #*********************************************************************
79-# Run to generate the grid pack *
80-#*********************************************************************
81- %(gridpack)s = gridpack !True = setting up the grid pack
82-#*********************************************************************
83 # Number of events and rnd seed *
84 # Warning: Do not generate more than 1M events in a single run *
85 # If you want to run Pythia, avoid more than 50k events in a run. *
86@@ -61,51 +57,56 @@
87 %(dynamical_scale_choice)s = dynamical_scale_choice ! Choose one of the preselected dynamical choices
88 %(scalefact)s = scalefact ! scale factor for event-by-event scales
89 #*********************************************************************
90-# Time of flight information. (-1 means not run)
91-#*********************************************************************
92- %(time_of_flight)s = time_of_flight ! threshold below which info is not written
93-#*********************************************************************
94-# Matching - Warning! ickkw > 1 is still beta
95-#*********************************************************************
96- %(ickkw)s = ickkw ! 0 no matching, 1 MLM, 2 CKKW matching
97- %(highestmult)s = highestmult ! for ickkw=2, highest mult group
98- %(ktscheme)s = ktscheme ! for ickkw=1, 1 Durham kT, 2 Pythia pTE
99+# Type and output format
100+#*********************************************************************
101+ %(gridpack)s = gridpack !True = setting up the grid pack
102+ %(time_of_flight)s = time_of_flight ! threshold below which info is not written (-1 means not written)
103+ %(lhe_version)s = lhe_version ! Change the way clustering information pass to shower.
104+ %(clusinfo)s = clusinfo ! include clustering tag in output
105+ %(event_norm)s = event_norm ! average/sum. Normalization of the weight in the LHEF
106+
107+#*********************************************************************
108+# Matching parameter (MLM only)
109+#*********************************************************************
110+ %(ickkw)s = ickkw ! 0 no matching, 1 MLM
111 %(alpsfact)s = alpsfact ! scale factor for QCD emission vx
112 %(chcluster)s = chcluster ! cluster only according to channel diag
113- %(pdfwgt)s = pdfwgt ! for ickkw=1, perform pdf reweighting
114 %(asrwgtflavor)s = asrwgtflavor ! highest quark flavor for a_s reweight
115- %(clusinfo)s = clusinfo ! include clustering tag in output
116- %(lhe_version)s = lhe_version ! Change the way clustering information pass to shower.
117+ %(auto_ptj_mjj)s = auto_ptj_mjj ! Automatic setting of ptj and mjj if xqcut >0
118+ ! (turn off for VBF and single top processes)
119+ %(xqcut)s = xqcut ! minimum kt jet measure between partons
120 #*********************************************************************
121-#**********************************************************
122 #
123-#**********************************************************
124-# Automatic ptj and mjj cuts if xqcut > 0
125-# (turn off for VBF and single top processes)
126-#**********************************************************
127- %(auto_ptj_mjj)s = auto_ptj_mjj ! Automatic setting of ptj and mjj
128-#**********************************************************
129-#
130-#**********************************
131-# BW cutoff (M+/-bwcutoff*Gamma)
132-#**********************************
133- %(bwcutoff)s = bwcutoff ! (M+/-bwcutoff*Gamma)
134-#**********************************************************
135-# Apply pt/E/eta/dr/mij/kt_durham cuts on decay products or not
136-# (note that etmiss/ptll/ptheavy/ht/sorted cuts always apply)
137-#*************************************************************
138- %(cut_decays)s = cut_decays ! Cut decay products
139-#*************************************************************
140+#*********************************************************************
141 # Number of helicities to sum per event (0 = all helicities)
142 # 0 gives more stable result, but longer run time (needed for
143 # long decay chains e.g.).
144 # Use >=2 if most helicities contribute, e.g. pure QCD.
145-#*************************************************************
146+#*********************************************************************
147 %(nhel)s = nhel ! Number of helicities used per event
148-#*******************
149-# Standard Cuts
150-#*******************
151+#*********************************************************************
152+# Generation bias, check the wiki page below for more information: *
153+# 'cp3.irmp.ucl.ac.be/projects/madgraph/wiki/LOEventGenerationBias' *
154+#*********************************************************************
155+ %(bias_module)s = bias_module ! Bias type of bias, [None, ptj_bias, <custom_folder>]
156+ %(bias_parameters)s = bias_parameters ! Specifies the parameters of the module.
157+#
158+#*******************************
159+# Parton level cuts definition *
160+#*******************************
161 #
162+#
163+#*********************************************************************
164+# BW cutoff (M+/-bwcutoff*Gamma) ! Define on/off-shell for "$" and decay
165+#*********************************************************************
166+ %(bwcutoff)s = bwcutoff ! (M+/-bwcutoff*Gamma)
167+#*********************************************************************
168+# Apply pt/E/eta/dr/mij/kt_durham cuts on decay products or not
169+# (note that etmiss/ptll/ptheavy/ht/sorted cuts always apply)
170+#*********************************************************************
171+ %(cut_decays)s = cut_decays ! Cut decay products
172+#*********************************************************************
173+# Standard Cuts *
174 #*********************************************************************
175 # Minimum and maximum pt's (for max, -1 means no cut) *
176 #*********************************************************************
177@@ -246,21 +247,20 @@
178 #*********************************************************************
179 %(xetamin)s = xetamin ! minimum rapidity for two jets in the WBF case
180 %(deltaeta)s = deltaeta ! minimum rapidity for two jets in the WBF case
181-#*********************************************************************
182-# KT DURHAM CUT *
183-#*********************************************************************
184- %(ktdurham)s = ktdurham
185- %(dparameter)s = dparameter
186+#***********************************************************************
187+# Turn on either the ktdurham or ptlund cut to activate *
188+# CKKW(L) merging with Pythia8 [arXiv:1410.3012, arXiv:1109.4829] *
189+#***********************************************************************
190+ %(ktdurham)s = ktdurham
191+ %(dparameter)s = dparameter
192+ %(ptlund)s = ptlund
193+ %(pdgs_for_merging_cut)s = pdgs_for_merging_cut ! PDGs for two cuts above
194 #*********************************************************************
195 # maximal pdg code for quark to be considered as a light jet *
196 # (otherwise b cuts are applied) *
197 #*********************************************************************
198 %(maxjetflavor)s = maxjetflavor ! Maximum jet pdg code
199 #*********************************************************************
200-# Jet measure cuts *
201-#*********************************************************************
202- %(xqcut)s = xqcut ! minimum kt jet measure between partons
203-#*********************************************************************
204 #
205 #*********************************************************************
206 # Store info for systematics studies *
207@@ -281,3 +281,4 @@
208 # PDF sets and number of members (0 or none for all members).
209 %(sys_pdf)s = sys_pdf # matching scales
210 # MSTW2008nlo68cl.LHgrid 1 = sys_pdf
211+#
212
213=== added directory 'Template/LO/Source/BIAS'
214=== added directory 'Template/LO/Source/BIAS/PY8_CKKW'
215=== added file 'Template/LO/Source/BIAS/PY8_CKKW/PY8_CKKW.f'
216--- Template/LO/Source/BIAS/PY8_CKKW/PY8_CKKW.f 1970-01-01 00:00:00 +0000
217+++ Template/LO/Source/BIAS/PY8_CKKW/PY8_CKKW.f 2016-08-23 01:19:18 +0000
218@@ -0,0 +1,180 @@
219+C ************************************************************
220+C Source for the library implementing a bias function that
221+C implements the Sudakov weight in CKKW directly from Pythia8
222+C ************************************************************
223+C
224+C The following lines are read by MG5aMC to set what are the
225+C relevant parameters for this bias module.
226+C
227+C parameters = {'BeamA': 0.0,
228+C 'BeamB': 0.0}
229+C
230+
231+ subroutine bias_wgt(p, original_weight, bias_weight)
232+ implicit none
233+C
234+C Parameters
235+C
236+ include '../../maxparticles.inc'
237+ include '../../nexternal.inc'
238+C
239+C Accessingt the details of the event
240+C
241+ include '../../run_config.inc'
242+ include '../../lhe_event_infos.inc'
243+C
244+C Arguments
245+C
246+ double precision p(0:3,nexternal)
247+ double precision original_weight, bias_weight
248+C
249+C local variables
250+C
251+ integer lpp_to_beam(-3:3)
252+ data lpp_to_beam/-11,-2212,-2212,0,2212,2212,11/
253+c
254+c local variables defined in the run_card
255+c
256+c Bias module arguments
257+ double precision BeamA, BeamB
258+
259+c truly local variables
260+ integer i,j, n_initial
261+ double precision OutputBiasWeight
262+ double precision Pythia8eCM
263+ integer Pythia8nParticles
264+ double precision Pythia8p(5,npart)
265+ integer Pythia8BeamA
266+ double precision PythiaBeamEnergyA
267+ integer Pythia8BeamB
268+ double precision PythiaBeamEnergyB
269+ character*(maxEventLength) Pythia8EvtRecord
270+ integer Pythia8Helicities(npart)
271+ integer Pythia8ColorOne(npart)
272+ integer Pythia8ColorTwo(npart)
273+ integer Pythia8ID(npart)
274+ integer Pythia8Status(npart)
275+ integer Pythia8MotherOne(npart)
276+ integer Pythia8MotherTwo(npart)
277+ integer Pythia8SubprocessGroup
278+ integer Pythia8MurScale
279+ integer Pythia8AlphaQCD
280+ integer Pythia8AlphaQED
281+
282+C
283+C Global variables
284+C
285+C
286+C Mandatory common block to be defined in bias modules
287+C
288+ double precision stored_bias_weight
289+ data stored_bias_weight/1.0d0/
290+ logical impact_xsec, requires_full_event_info
291+C We only want to bias distributions, but not impact the xsec.
292+ data impact_xsec/.True./
293+C Pythia8 will need the full information for the event
294+C (color, resonances, helicities, etc..)
295+ data requires_full_event_info/.True./
296+ common/bias/stored_bias_weight,impact_xsec,
297+ & requires_full_event_info
298+C
299+C Access the value of the run parameters in run_card
300+C
301+ include '../../run.inc'
302+ include '../../cuts.inc'
303+C
304+C Read the definition of the bias parameter from the run_card
305+C
306+ include '../bias.inc'
307+
308+C --------------------
309+C BEGIN IMPLEMENTATION
310+C --------------------
311+
312+C Let's initialize the PY8 variables describing the event
313+ Pythia8eCM = sqrt(4d0*ebeam(1)*ebeam(2))
314+ Pythia8EvtRecord = event_record
315+ Pythia8SubprocessGroup = ngroup
316+ Pythia8MurScale = sscale
317+ Pythia8AlphaQCD = aaqcd
318+ Pythia8AlphaQED = aaqed
319+ Pythia8nParticles = npart
320+ PythiaBeamEnergyA = ebeam(1)
321+ PythiaBeamEnergyB = ebeam(2)
322+ do i=1,npart
323+ Pythia8ID(i) = jpart(1,i)
324+ Pythia8MotherOne(i) = jpart(2,i)
325+ Pythia8MotherTwo(i) = jpart(3,i)
326+ Pythia8ColorOne(i) = jpart(4,i)
327+ Pythia8ColorTwo(i) = jpart(5,i)
328+ Pythia8Status(i) = jpart(6,i)
329+ Pythia8Helicities(i) = jpart(7,i)
330+ do j=1,4
331+ Pythia8p(j,i)=pb(mod(j,4),i)
332+ enddo
333+ Pythia8p(5,npart)=pb(4,i)
334+ enddo
335+ Pythia8BeamA = lpp_to_beam(lpp(1))
336+ Pythia8BeamB = lpp_to_beam(lpp(2))
337+ n_initial = 0
338+ do i=1,npart
339+ if (Pythia8Status(i).eq.-1) then
340+ n_initial = n_initial + 1
341+ if (lpp(n_initial).eq.0) then
342+ if (n_initial.eq.1) then
343+ Pythia8BeamA = Pythia8ID(i)
344+ elseif (n_initial.eq.2) then
345+ Pythia8BeamB = Pythia8ID(i)
346+ exit
347+ endif
348+ endif
349+ if (n_initial.eq.2) then
350+ exit
351+ endif
352+ endif
353+ enddo
354+C If this is a 1 > N decay event, then enforce beamIDs to match
355+C those specified in the event record.
356+ if (n_initial.eq.1) then
357+ Pythia8BeamB = 0
358+ do i=1,npart
359+ if (Pythia8Status(i).eq.-1) then
360+ Pythia8BeamA = Pythia8ID(i)
361+ exit
362+ endif
363+ enddo
364+ endif
365+C Make sure to enforce the user-choice of beam if specified.
366+ if (idnint(BeamA).ne.0) then
367+ Pythia8BeamA = idnint(BeamA)
368+ endif
369+ if (idnint(BeamB).ne.0) then
370+ Pythia8BeamB = idnint(BeamB)
371+ endif
372+
373+C Call PY8 to derive the bias weight.
374+ call py8_bias_weight( Pythia8eCM,
375+ & Pythia8BeamA,
376+ & PythiaBeamEnergyA,
377+ & Pythia8BeamB,
378+ & PythiaBeamEnergyB,
379+ & Pythia8EvtRecord,
380+ & Pythia8p,
381+ & Pythia8nParticles,
382+ & Pythia8MurScale,
383+ & Pythia8AlphaQCD,
384+ & Pythia8AlphaQED,
385+ & Pythia8ID,
386+ & Pythia8MotherOne,
387+ & Pythia8MotherTwo,
388+ & Pythia8ColorOne,
389+ & Pythia8ColorTwo,
390+ & Pythia8Status,
391+ & Pythia8Helicities,
392+ & OutputBiasWeight )
393+
394+ bias_weight = OutputBiasWeight
395+
396+ return
397+
398+ end subroutine bias_wgt
399
400=== added file 'Template/LO/Source/BIAS/PY8_CKKW/bias_dependencies'
401--- Template/LO/Source/BIAS/PY8_CKKW/bias_dependencies 1970-01-01 00:00:00 +0000
402+++ Template/LO/Source/BIAS/PY8_CKKW/bias_dependencies 2016-08-23 01:19:18 +0000
403@@ -0,0 +1,5 @@
404+PY8LIBS = $(shell $(PYTHIA8_PATH)/bin/pythia8-config --libs)
405+PY8INCLUDES = $(shell $(PYTHIA8_PATH)/bin/pythia8-config --includedir)
406+PY8CXXFLAGS = $(shell $(PYTHIA8_PATH)/bin/pythia8-config --cxxflags)
407+
408+BIASDEPENDENCIES = $(PY8LIBS) $(PY8CXXFLAGS)
409
410=== added file 'Template/LO/Source/BIAS/PY8_CKKW/makefile'
411--- Template/LO/Source/BIAS/PY8_CKKW/makefile 1970-01-01 00:00:00 +0000
412+++ Template/LO/Source/BIAS/PY8_CKKW/makefile 2016-08-23 01:19:18 +0000
413@@ -0,0 +1,59 @@
414+BIASDIR = ../
415+SOURCEDIR = ../..
416+include $(SOURCEDIR)/make_opts
417+
418+include ./bias_dependencies
419+
420+all: PY8_CKKW
421+
422+clean:
423+ $(RM) *.o $(BIASLIBDIR)$(BIASLIBRARY)
424+
425+INCLUDES = $(BIASDIR)/bias.inc \
426+ $(SOURCEDIR)/maxparticles.inc \
427+ $(SOURCEDIR)/nexternal.inc \
428+ $(SOURCEDIR)/run_config.inc \
429+ $(SOURCEDIR)/lhe_event_infos.inc \
430+ $(SOURCEDIR)/run.inc \
431+ $(SOURCEDIR)/cuts.inc
432+
433+#
434+# Compilation of the module ptj_bias
435+#
436+PY8_CKKW.o: PY8_CKKW.f $(INCLUDES)
437+ $(FC) $(FFLAGS) $(LDFLAGS) -c -o PY8_CKKW.o PY8_CKKW.f
438+
439+#
440+# Generate the copy of the relevant cards in the module C++ headers so that they are compiled
441+# directly in the executable and do not have to be read at run time.
442+#
443+param_card.h: ../../../Cards/param_card.dat
444+ python -c "out=open('param_card.h','w'); out.write('const std::string ParamCard = \"%s\";'%'\\\n\"\n\"'.join([line for line in open('../../../Cards/param_card.dat').read().replace('\"',r'\"').split('\n')])); out.close();"
445+
446+run_card.h: ../../../Cards/run_card.dat
447+ python -c "out=open('run_card.h','w'); out.write('const std::string RunCard = \"%s\";'%'\\\n\"\n\"'.join([line for line in open('../../../Cards/run_card.dat').read().replace('\"',r'\"').split('\n')])); out.close();"
448+
449+proc_card.h: ../../../Cards/proc_card_mg5.dat
450+ python -c "out=open('proc_card.h','w'); out.write('const std::string ProcCard = \"%s\";'%'\\\n\"\n\"'.join([line for line in open('../../../Cards/proc_card_mg5.dat').read().replace('\"',r'\"').split('\n')])); out.close();"
451+
452+py8_mg5amc_bias_interface.o: py8_mg5amc_bias_interface.cc param_card.h run_card.h proc_card.h
453+ $(DEFAULT_CPP_COMPILER) $(CXXFLAGS) $(PY8CXXFLAGS) $(LDFLAGS) $(PY8LIBS) -c -o py8_mg5amc_bias_interface.o py8_mg5amc_bias_interface.cc
454+
455+PY8_CKKW: PY8_CKKW.o py8_mg5amc_bias_interface.o
456+ $(call CREATELIB, $(BIASLIBDIR)$(BIASLIBRARY), $^)
457+
458+#
459+# List of the requirements for this module.
460+# 'VALID' is the keyword that *must* be returned if everything is in order.
461+#
462+requirements:
463+ifeq ($(shell $(call CHECK_MG5AMC_VERSION,2.4.2)),True)
464+ifeq ($(PYTHIA8_PATH),NotInstalled)
465+ @echo "Error: This module requires Pythia8. Consider installing it with the command 'install pythia8'."
466+else
467+ @echo "VALID"
468+endif
469+else
470+ @echo "Error:: MG5aMC is not recent enough (found "$(MG5AMC_VERSION)")"
471+ @echo "FAIL"
472+endif
473
474=== added file 'Template/LO/Source/BIAS/PY8_CKKW/py8_mg5amc_bias_interface.cc'
475--- Template/LO/Source/BIAS/PY8_CKKW/py8_mg5amc_bias_interface.cc 1970-01-01 00:00:00 +0000
476+++ Template/LO/Source/BIAS/PY8_CKKW/py8_mg5amc_bias_interface.cc 2016-08-23 01:19:18 +0000
477@@ -0,0 +1,121 @@
478+#include "Pythia8/Pythia.h"
479+#include <stdlib.h>
480+#include <math.h>
481+#include <vector>
482+#include <sstream>
483+#include "param_card.h"
484+#include "run_card.h"
485+#include "proc_card.h"
486+
487+bool initialization_done = false;
488+
489+Pythia8::Pythia pythia;
490+// Stringstream of the events in which MG5aMC will write and PY8 read.
491+std::stringstream EvtSS;
492+
493+void generate_header_SS(std::stringstream & headerSS,
494+ const int & Pythia8BeamA,
495+ const int & Pythia8BeamB,
496+ const double & PythiaBeamEnergyA,
497+ const double & PythiaBeamEnergyB) {
498+ headerSS<<"<LesHouchesEvents version=\"3.0\">\n";
499+ headerSS<<"<header>\n";
500+ // Writing proc_card.dat in the banner
501+ headerSS<<"<MG5ProcCard>\n";
502+ headerSS<<ProcCard<<"\n";
503+ headerSS<<"</MG5ProcCard>\n";
504+ // Writing run_card.dat in the banner
505+ headerSS<<"<MGRunCard>\n";
506+ headerSS<<RunCard<<"\n";
507+ headerSS<<"</MGRunCard>\n";
508+ // Writing param_card.dat in the banner
509+ headerSS<<"<slha>\n";
510+ headerSS<<ParamCard<<"\n";
511+ headerSS<<"</slha>\n";
512+ headerSS<<"</header>\n";
513+ // Writing the init block (only beam related information is relevant here)
514+ headerSS<<"<init>\n";
515+ headerSS<<Pythia8BeamA<<" "<<Pythia8BeamB<<" ";
516+ headerSS<<std::scientific<<PythiaBeamEnergyA<<" "<<std::scientific<<PythiaBeamEnergyB<<" ";
517+ // We fill in the rest of the init information with blanks
518+ headerSS<<"0 0 -1 -1 -3 1\n";
519+ headerSS<<"-1.0 0.0 1.0 1\n";
520+ headerSS<<"<generator name='MadGraph5_aMC@NLO'>please cite 1405.0301</generator>\n";
521+ headerSS<<"</init>\n";
522+// headerSS<<"</LesHouchesEvents>\n";
523+ return;
524+}
525+
526+extern "C" {
527+//Fortran interface
528+ void py8_bias_weight_(const double & eCM,
529+ const int & Pythia8BeamA,
530+ const double & PythiaBeamEnergyA,
531+ const int & Pythia8BeamB,
532+ const double & PythiaBeamEnergyB,
533+ const char * Pythia8EvtRecord,
534+ const double * p,
535+ const int & nParticles,
536+ const double & MurScale,
537+ const double & AlphaQCD,
538+ const double & AlphaQED,
539+ const int * Pythia8ID,
540+ const int * Pythia8MotherOne,
541+ const int * Pythia8MotherTwo,
542+ const int * Pythia8ColorOne,
543+ const int * Pythia8ColorTwo,
544+ const int * Pythia8Status,
545+ const int * Pythia8Helicities,
546+ double & OutputBiasWeight )
547+ {
548+ if (!initialization_done) {
549+// /!\ WARNING this example is tailored for p p > z > e+ e- j for now.
550+
551+ pythia.readString("Merging:doKtMerging=on");
552+ pythia.readString("Merging:Process=pp>e+e-");
553+ pythia.readString("Merging:TMS=30.0");
554+ pythia.readString("Merging:nJetMax=2");
555+ pythia.readString("Merging:applyVeto=off");
556+ pythia.readString("Beams:readLHEFheaders=on");
557+ pythia.readString("Merging:includeWeightInXsection=off");
558+
559+ pythia.readString("hadronlevel:all=off");
560+ pythia.readString("partonlevel:all=off");
561+ pythia.readString("SpaceShower:QEDshowerByL=off");
562+ pythia.readString("SpaceShower:QEDshowerByQ=off");
563+ pythia.readString("ProcessLevel:resonanceDecays=off");
564+ pythia.readString("BeamRemnants:primordialKT=off");
565+ pythia.readString("TimeShower:QEDshowerByQ=off");
566+ pythia.readString("TimeShower:QEDshowerByL=off");
567+ pythia.readString("partonlevel:mpi=off");
568+ pythia.readString("PartonLevel:FSRinResonances=off");
569+ pythia.readString("PartonLevel:Remnants=off");
570+ pythia.readString("Check:event=off");
571+
572+ pythia.settings.mode("Beams:frameType",4);
573+ std::stringstream headerSS;
574+ generate_header_SS(headerSS, Pythia8BeamA,Pythia8BeamB,PythiaBeamEnergyA,PythiaBeamEnergyB);
575+ EvtSS.str(headerSS.str());
576+ pythia.init(&EvtSS, &headerSS);
577+ initialization_done = true;
578+ }
579+
580+ std::string EvtStr(Pythia8EvtRecord);
581+ EvtStr = EvtStr.substr(0,EvtStr.find("</event>")+8);
582+ // Restart the buffer, clearing EOF state
583+ EvtSS.clear();
584+ // Set the stringstream buffer to contain the event only
585+ EvtSS.str(EvtStr);
586+
587+// std::cout<<"---> Event transmitted to Pythiaa8 <---\n"<<EvtSS.str()<<std::endl;
588+
589+ // Compute the merging weight. All other shower processsing has been disabled in the initialisation above.
590+ pythia.next();
591+// pythia.event.list();
592+ // This is the CKKW Sudakov merging weight from the trial shower.
593+ std::cout<<pythia.info.mergingWeight()<<std::endl;
594+// exit(0);
595+
596+ OutputBiasWeight = pythia.info.mergingWeight();
597+ }
598+}
599
600=== added directory 'Template/LO/Source/BIAS/dummy'
601=== added file 'Template/LO/Source/BIAS/dummy/dummy.f'
602--- Template/LO/Source/BIAS/dummy/dummy.f 1970-01-01 00:00:00 +0000
603+++ Template/LO/Source/BIAS/dummy/dummy.f 2016-08-23 01:19:18 +0000
604@@ -0,0 +1,44 @@
605+C ************************************************************
606+C Source for the library implementing a dummt bias function
607+C always returns one
608+C ************************************************************
609+
610+ subroutine bias_wgt(p, original_weight, bias_weight)
611+ implicit none
612+C
613+C Parameters
614+C
615+ include '../../nexternal.inc'
616+C
617+C Arguments
618+C
619+ double precision p(0:3,nexternal)
620+ double precision original_weight, bias_weight
621+C
622+C local variables
623+C
624+C
625+C Global variables
626+C
627+C Mandatory common block to be defined in bias modules
628+C
629+ double precision stored_bias_weight
630+ data stored_bias_weight/1.0d0/
631+ logical impact_xsec, requires_full_event_info
632+C Not impacting the xsec since the bias is 1.0. Therefore
633+C bias_wgt will not be written in the lhe event file.
634+C Setting it to .True. makes sure that it will not be written.
635+ data impact_xsec/.True./
636+C Of course this module does not require the full event
637+C information (color, resonances, helicities, etc..)
638+ data requires_full_event_info/.False./
639+ common/bias/stored_bias_weight,impact_xsec,
640+ & requires_full_event_info
641+
642+C --------------------
643+C BEGIN IMPLEMENTATION
644+C --------------------
645+
646+ bias_weight = 1.0d0
647+
648+ end subroutine bias_wgt
649
650=== added file 'Template/LO/Source/BIAS/dummy/makefile'
651--- Template/LO/Source/BIAS/dummy/makefile 1970-01-01 00:00:00 +0000
652+++ Template/LO/Source/BIAS/dummy/makefile 2016-08-23 01:19:18 +0000
653@@ -0,0 +1,21 @@
654+
655+include ../../make_opts
656+
657+all: dummy
658+
659+clean:
660+ $(RM) *.o $(BIASLIBDIR)$(BIASLIBRARY)
661+
662+#
663+# Compilation of the module dummy
664+#
665+
666+dummy: dummy.o
667+ $(call CREATELIB, $(BIASLIBDIR)$(BIASLIBRARY), $^)
668+
669+#
670+# List of the requirements for this module.
671+# 'VALID' is the keyword that *must* be returned if everything is in order.
672+#
673+requirements:
674+ @echo "VALID"
675
676=== added directory 'Template/LO/Source/BIAS/ptj_bias'
677=== added file 'Template/LO/Source/BIAS/ptj_bias/makefile'
678--- Template/LO/Source/BIAS/ptj_bias/makefile 1970-01-01 00:00:00 +0000
679+++ Template/LO/Source/BIAS/ptj_bias/makefile 2016-08-23 01:19:18 +0000
680@@ -0,0 +1,27 @@
681+include ../../make_opts
682+
683+all: ptj_bias
684+
685+clean:
686+ $(RM) *.o $(BIASLIBDIR)$(BIASLIBRARY)
687+
688+#
689+# Compilation of the module ptj_bias
690+#
691+ptj_bias.o: ptj_bias.f ../bias.inc
692+ $(FC) $(FFLAGS) $(LDFLAGS) -c -o ptj_bias.o ptj_bias.f
693+
694+ptj_bias: ptj_bias.o
695+ $(call CREATELIB, $(BIASLIBDIR)$(BIASLIBRARY), $^)
696+
697+#
698+# List of the requirements for this module.
699+# 'VALID' is the keyword that *must* be returned if everything is in order.
700+#
701+requirements:
702+ifeq ($(shell $(call CHECK_MG5AMC_VERSION,2.4.2)),True)
703+ @echo "VALID"
704+else
705+ @echo "Error:: MG5aMC is not recent enough (found "$(MG5AMC_VERSION)")"
706+ @echo "FAIL"
707+endif
708
709=== added file 'Template/LO/Source/BIAS/ptj_bias/ptj_bias.f'
710--- Template/LO/Source/BIAS/ptj_bias/ptj_bias.f 1970-01-01 00:00:00 +0000
711+++ Template/LO/Source/BIAS/ptj_bias/ptj_bias.f 2016-08-23 01:19:18 +0000
712@@ -0,0 +1,101 @@
713+C ************************************************************
714+C Source for the library implementing a bias function that
715+C populates the large pt tale of the leading jet.
716+C
717+C The two options of this subroutine, that can be set in
718+C the run card are:
719+C > (double precision) ptj_bias_target_ptj : target ptj value
720+C > (double precision) ptj_bias_enhancement_power : exponent
721+C
722+C Schematically, the functional form of the enhancement is
723+C bias_wgt = [ptj(evt)/mean_ptj]^enhancement_power
724+C ************************************************************
725+C
726+C The following lines are read by MG5aMC to set what are the
727+C relevant parameters for this bias module.
728+C
729+C parameters = {'ptj_bias_target_ptj': 1000.0,
730+C 'ptj_bias_enhancement_power': 4.0}
731+C
732+
733+ subroutine bias_wgt(p, original_weight, bias_weight)
734+ implicit none
735+C
736+C Parameters
737+C
738+ include '../../maxparticles.inc'
739+ include '../../nexternal.inc'
740+
741+C
742+C Arguments
743+C
744+ double precision p(0:3,nexternal)
745+ double precision original_weight, bias_weight
746+C
747+C local variables
748+C
749+ integer i
750+ double precision ptj(nexternal)
751+ double precision max_ptj
752+c
753+c local variables defined in the run_card
754+c
755+ double precision ptj_bias_target_ptj
756+ double precision ptj_bias_enhancement_power
757+C
758+C Global variables
759+C
760+C
761+C Mandatory common block to be defined in bias modules
762+C
763+ double precision stored_bias_weight
764+ data stored_bias_weight/1.0d0/
765+ logical impact_xsec, requires_full_event_info
766+C We only want to bias distributions, but not impact the xsec.
767+ data impact_xsec/.False./
768+C Of course this module does not require the full event
769+C information (color, resonances, helicities, etc..)
770+ data requires_full_event_info/.False./
771+ common/bias/stored_bias_weight,impact_xsec,
772+ & requires_full_event_info
773+C
774+C Accessingt the details of the event
775+C
776+ logical is_a_j(nexternal),is_a_l(nexternal),
777+ & is_a_b(nexternal),is_a_a(nexternal),
778+ & is_a_onium(nexternal),is_a_nu(nexternal),
779+ & is_heavy(nexternal),do_cuts(nexternal)
780+ common/to_specisa/is_a_j,is_a_a,is_a_l,is_a_b,is_a_nu,
781+ & is_heavy,is_a_onium,do_cuts
782+
783+C
784+C Setup the value of the parameters from the run_card
785+C
786+ include '../bias.inc'
787+
788+C --------------------
789+C BEGIN IMPLEMENTATION
790+C --------------------
791+
792+ do i=1,nexternal
793+ ptj(i)=-1.0d0
794+ if (is_a_j(i)) then
795+ ptj(i)=sqrt(p(1,i)**2+p(2,i)**2)
796+ endif
797+ enddo
798+
799+ max_ptj=-1.0d0
800+ do i=1,nexternal
801+ max_ptj = max(max_ptj,ptj(i))
802+ enddo
803+ if (max_ptj.lt.0.0d0) then
804+ bias_weight = 1.0d0
805+ return
806+ endif
807+
808+ bias_weight = (max_ptj/ptj_bias_target_ptj)
809+ & **ptj_bias_enhancement_power
810+
811+ return
812+
813+ end subroutine bias_wgt
814
815=== modified file 'Template/LO/Source/cuts.inc'
816--- Template/LO/Source/cuts.inc 2015-04-09 01:31:09 +0000
817+++ Template/LO/Source/cuts.inc 2016-08-23 01:19:18 +0000
818@@ -88,6 +88,10 @@
819 REAL*8 KT_DURHAM, D_PARAMETER
820 LOGICAL DO_KT_DURHAM
821 COMMON /JET_MEASURE_CUTS/ KT_DURHAM, D_PARAMETER
822-
823-
824-
825\ No newline at end of file
826+
827+C COMMON BLOCK FOR PYTHIA JET MEASURE CUT
828+ REAL*8 PT_LUND
829+ COMMON /PYTHIA_MEASURE_CUTS/ PT_LUND
830+
831+
832+
833
834=== added file 'Template/LO/Source/lhe_event_infos.inc'
835--- Template/LO/Source/lhe_event_infos.inc 1970-01-01 00:00:00 +0000
836+++ Template/LO/Source/lhe_event_infos.inc 2016-08-23 01:19:18 +0000
837@@ -0,0 +1,16 @@
838+ integer jpart(7,-nexternal+3:2*nexternal-3)
839+ double precision pb(0:4,-nexternal+3:2*nexternal-3)
840+ integer isym(nexternal,99),jsym, npart
841+ double precision sscale,aaqcd,aaqed
842+ character*1000 buff
843+ character*(s_bufflen) s_buff(7)
844+ integer nclus
845+ character*(clus_bufflen) buffclus(nexternal)
846+ character*(maxEventLength) event_record
847+ logical AlreadySetInBiasModule
848+
849+ common/to_lhe_event_info/jpart,pb,s_buff,buff,nclus,buffclus,event_record,
850+ & sscale,aaqcd,aaqed,isym,jsym,npart,AlreadySetInBiasModule
851+
852+ integer ngroup
853+ common/to_group/ngroup
854
855=== modified file 'Template/LO/Source/make_opts'
856--- Template/LO/Source/make_opts 2016-07-01 22:45:47 +0000
857+++ Template/LO/Source/make_opts 2016-08-23 01:19:18 +0000
858@@ -1,12 +1,18 @@
859+# Defines the variable pertaining to MG5aMC environment
860+PYTHIA8_PATH=NotInstalled
861+MG5AMC_VERSION=SpecifiedByMG5aMCAtRunTime
862 DEFAULT_F2PY_COMPILER=f2py
863 DEFAULT_F_COMPILER=gfortran
864-MACFLAG=-mmacosx-version-min=10.7
865-DEFAULT_CPP_COMPILER=clang
866-STDLIB=-lc++
867-STDLIB_FLAG=-stdlib=libc++
868+MACFLAG=
869+DEFAULT_CPP_COMPILER=g++
870+STDLIB=-lstdc++
871+STDLIB_FLAG=
872 #end_of_make_opts_variables
873+
874+BIASLIBDIR=../../../lib/
875+BIASLIBRARY=libbias.$(libext)
876+
877 # Rest of the makefile
878-
879 ifeq ($(origin FFLAGS),undefined)
880 FFLAGS= -O -w -fbounds-check -fPIC
881 #FFLAGS+= -g -fbounds-check -ffpe-trap=invalid,zero,overflow,underflow,denormal -Wall
882@@ -90,4 +96,9 @@
883 else
884 alfas_functions=alfas_functions
885 llhapdf=
886-endif
887\ No newline at end of file
888+endif
889+
890+# Helper function to check MG5 version
891+define CHECK_MG5AMC_VERSION
892+python -c 'import re; from distutils.version import StrictVersion; print StrictVersion("$(MG5AMC_VERSION)") >= StrictVersion("$(1)") if re.match("^[\d\.]+$$","$(MG5AMC_VERSION)") else True;'
893+endef
894
895=== modified file 'Template/LO/Source/run.inc'
896--- Template/LO/Source/run.inc 2015-04-02 22:56:24 +0000
897+++ Template/LO/Source/run.inc 2016-08-23 01:19:18 +0000
898@@ -63,3 +63,11 @@
899 C
900 logical MC_grouped_subproc
901 common/to_MC_grouped_subproc/MC_grouped_subproc
902+
903+C
904+C Controls what are the PDGs included in the CKKWl merging procedure, i.e. what
905+C are the PDGs subject to the ktdurham cut
906+C
907+ integer pdgs_for_merging_cut(0:1000)
908+ common/TO_MERGE/pdgs_for_merging_cut
909+
910
911=== modified file 'Template/LO/Source/rw_events.f'
912--- Template/LO/Source/rw_events.f 2014-10-07 13:31:57 +0000
913+++ Template/LO/Source/rw_events.f 2016-08-23 01:19:18 +0000
914@@ -30,7 +30,6 @@
915 character*(s_bufflen) s_buff(*)
916 integer nclus
917 character*(clus_bufflen) buffclus(*)
918-
919 c
920 c Local
921 c
922@@ -46,6 +45,10 @@
923
924 data lun_ban/37/
925 data banner_open/.false./
926+
927+ double precision bias_weight
928+ logical impact_xsec
929+ common/bias/bias_weight,impact_xsec
930 c-----
931 c Begin Code
932 c-----
933@@ -80,6 +83,21 @@
934 buff=''
935 endif
936 endif
937+
938+c Reading the bias weight (if present)
939+ read(lun,'(a300)',end=99,err=99) buftmp
940+ if(buftmp(1:6).ne.'<rwgt>') then
941+ backspace(lun)
942+ bias_weight = 1.0d0
943+ else
944+ do while(buftmp(1:7).ne.'</rwgt>')
945+ read(lun,'(a300)',end=99,err=99) buftmp
946+ if (buftmp(1:16).eq."<wgt id='bias'> ") then
947+ read(buftmp(17:31),'(1e15.7)') bias_weight
948+ endif
949+ enddo
950+ endif
951+
952 c Systematics info
953 read(lun,'(a)',end=99,err=99) s_buff(1)
954 if(s_buff(1).ne.'<mgrwt>') then
955@@ -114,9 +132,103 @@
956 55 format(i3,5e19.11)
957 end
958
959+ subroutine write_event_to_stream(evt_record,P,wgt,nexternal,ic,
960+ & ievent,scale,aqcd, aqed,buff,u_syst,s_buff,nclus,buffclus)
961+c********************************************************************
962+C This an *exact* copy of write_event, except that it writes it
963+C to a character array argument as opposed to an I/O stream.
964+c********************************************************************
965+ implicit none
966+
967+ include 'maxparticles.inc'
968+ include 'run_config.inc'
969+c
970+c parameters
971+c
972+ double precision pi
973+ parameter (pi = 3.1415926d0)
974+c
975+c Arguments
976+c
977+ character*(maxEventLength) evt_record
978+ integer ievent
979+ integer nexternal, ic(7,*)
980+ double precision P(0:4,*),wgt
981+ double precision aqcd, aqed, scale
982+ character*1000 buff
983+ logical u_syst
984+ character*(s_bufflen) s_buff(*)
985+ integer nclus
986+ character*(clus_bufflen) buffclus(*)
987+c
988+c Local
989+c
990+ integer i,j,k
991+ character*(maxEventLength) largeBuff
992+c
993+c Global
994+c
995+ double precision bias_weight
996+ logical impact_xsec
997+ common/bias/bias_weight,impact_xsec
998+
999+c-----
1000+c Begin Code
1001+c-----
1002+c aqed= gal(1)*gal(1)/4d0/pi
1003+c aqcd = g*g/4d0/pi
1004+ write(largeBuff,'(a)') '<event>'
1005+ evt_record=trim(evt_record)//trim(largeBuff)
1006+ write(largeBuff,'(i2,i4,4e15.7)') nexternal,ievent,wgt,scale,
1007+ $ aqed,aqcd
1008+ evt_record=trim(evt_record)//CHAR(13)//CHAR(10)//trim(largeBuff)
1009+ do i=1,nexternal
1010+ write(largeBuff,51) ic(1,i),ic(6,i),(ic(j,i),j=2,5),
1011+ $ (p(j,i),j=1,3),p(0,i),p(4,i),0.,real(ic(7,i))
1012+ evt_record=trim(evt_record)//CHAR(13)//CHAR(10)//trim(largeBuff)
1013+ enddo
1014+ if(buff(1:7).eq.'<scales') then
1015+ write(largeBuff,'(a)') buff(1:len_trim(buff))
1016+ evt_record=trim(evt_record)//CHAR(13)//CHAR(10)//trim(largeBuff)
1017+ endif
1018+ if(buff(1:1).eq.'#') then
1019+ write(largeBuff,'(a)') buff(1:len_trim(buff))
1020+ evt_record=trim(evt_record)//CHAR(13)//CHAR(10)//trim(largeBuff)
1021+ endif
1022+ if(.not.impact_xsec) then
1023+ write(largeBuff,'(a)') '<rwgt>'
1024+ evt_record=trim(evt_record)//CHAR(13)//CHAR(10)//trim(largeBuff)
1025+ write(largeBuff,'(a16,1e15.7,a6)') "<wgt id='bias'> ",
1026+ $ bias_weight,"</wgt>"
1027+ evt_record=trim(evt_record)//CHAR(13)//CHAR(10)//trim(largeBuff)
1028+ write(largeBuff,'(a)') '</rwgt>'
1029+ evt_record=trim(evt_record)//CHAR(13)//CHAR(10)//trim(largeBuff)
1030+ endif
1031+ if(u_syst)then
1032+ do i=1,7
1033+ write(largeBuff,'(a)') s_buff(i)(1:len_trim(s_buff(i)))
1034+ evt_record=trim(evt_record)//CHAR(13)//CHAR(10)//trim(largeBuff)
1035+ enddo
1036+ endif
1037+ do i=1,nclus
1038+ write(largeBuff,'(a)') buffclus(i)(1:len_trim(buffclus(i)))
1039+ evt_record=trim(evt_record)//CHAR(13)//CHAR(10)//trim(largeBuff)
1040+ enddo
1041+ write(largeBuff,'(a)') '</event>'
1042+ evt_record=trim(evt_record)//CHAR(13)//CHAR(10)//trim(largeBuff)
1043+ return
1044+ 51 format(i9,5i5,5e19.11,f3.0,f4.0)
1045+ end
1046+
1047+
1048 subroutine write_event(lun,P,wgt,nexternal,ic,ievent,scale,aqcd,
1049 $ aqed,buff,u_syst,s_buff,nclus,buffclus)
1050 c********************************************************************
1051+c
1052+c /!\ When making changes to this subroutine, make sure to accordingly
1053+c update write_event_to_stream
1054+c
1055+c********************************************************************
1056 c Writes one event from data file #lun according to LesHouches
1057 c ic(1,*) = Particle ID
1058 c ic(2.*) = Mothup(1)
1059@@ -154,6 +266,9 @@
1060 c
1061 c Global
1062 c
1063+ double precision bias_weight
1064+ logical impact_xsec
1065+ common/bias/bias_weight,impact_xsec
1066
1067 c-----
1068 c Begin Code
1069@@ -168,7 +283,13 @@
1070 $ (p(j,i),j=1,3),p(0,i),p(4,i),0.,real(ic(7,i))
1071 enddo
1072 if(buff(1:7).eq.'<scales') write(lun,'(a)') buff(1:len_trim(buff))
1073- if(buff(1:1).eq.'#') write(lun,'(a)') buff(1:len_trim(buff))
1074+ if(buff(1:1).eq.'#') write(lun,'(a)') buff(1:len_trim(buff))
1075+ if(.not.impact_xsec) then
1076+ write(lun,'(a)') '<rwgt>'
1077+ write(lun,'(a16,1e15.7,a6)') "<wgt id='bias'> ",bias_weight,
1078+ $ "</wgt>"
1079+ write(lun,'(a)') '</rwgt>'
1080+ endif
1081 if(u_syst)then
1082 do i=1,7
1083 write(lun,'(a)') s_buff(i)(1:len_trim(s_buff(i)))
1084
1085=== modified file 'Template/LO/SubProcesses/cuts.f'
1086--- Template/LO/SubProcesses/cuts.f 2016-06-07 09:33:55 +0000
1087+++ Template/LO/SubProcesses/cuts.f 2016-08-23 01:19:18 +0000
1088@@ -1,1319 +1,1750 @@
1089- logical function pass_point(p)
1090-c************************************************************************
1091-c This function is called from sample to see if it needs to
1092-c bother calculating the weight from all the different conficurations
1093-c You can either just return true, or have it call passcuts
1094-c************************************************************************
1095- implicit none
1096-c
1097-c Arguments
1098-c
1099- double precision p
1100-c
1101-c External
1102-c
1103- logical passcuts
1104- external passcuts
1105-c-----
1106-c Begin Code
1107-c-----
1108- pass_point = .true.
1109-c pass_point = passcuts(p)
1110- end
1111-C
1112- LOGICAL FUNCTION PASSCUTS(P)
1113-C**************************************************************************
1114-C INPUT:
1115-C P(0:3,1) MOMENTUM OF INCOMING PARTON
1116-C P(0:3,2) MOMENTUM OF INCOMING PARTON
1117-C P(0:3,3) MOMENTUM OF ...
1118-C ALL MOMENTA ARE IN THE REST FRAME!!
1119-C COMMON/JETCUTS/ CUTS ON JETS
1120-C OUTPUT:
1121-C TRUE IF EVENTS PASSES ALL CUTS LISTED
1122-C**************************************************************************
1123- IMPLICIT NONE
1124-c
1125-c Constants
1126-c
1127- include 'genps.inc'
1128- include 'nexternal.inc'
1129-C
1130-C ARGUMENTS
1131-C
1132- REAL*8 P(0:3,nexternal)
1133-
1134-C
1135-C LOCAL
1136-C
1137- LOGICAL FIRSTTIME,FIRSTTIME2,pass_bw,notgood,good,foundheavy
1138- LOGICAL DEBUG
1139- integer i,j,njets,nheavyjets,nleptons,hardj1,hardj2
1140- REAL*8 XVAR,ptmax1,ptmax2,htj,tmp,inclht
1141- real*8 ptemp(0:3), ptemp2(0:3)
1142- character*20 formstr
1143-C
1144-C PARAMETERS
1145-C
1146- real*8 PI
1147- parameter( PI = 3.14159265358979323846d0 )
1148-C
1149-C EXTERNAL
1150-C
1151- REAL*8 R2,DOT,ET,RAP,DJ,SumDot,pt,ALPHAS,PtDot
1152- logical cut_bw,setclscales
1153- external R2,DOT,ET,RAP,DJ,SumDot,pt,ALPHAS,cut_bw,setclscales,PtDot
1154-C
1155-C GLOBAL
1156-C
1157- include 'run.inc'
1158- include 'cuts.inc'
1159-
1160- double precision ptjet(nexternal)
1161- double precision ptheavyjet(nexternal)
1162- double precision ptlepton(nexternal)
1163- double precision temp
1164-
1165-C VARIABLES TO SPECIFY JETS
1166- DOUBLE PRECISION PJET(NEXTERNAL,0:3)
1167- DOUBLE PRECISION PTMIN
1168- DOUBLE PRECISION PT1,PT2
1169- INTEGER K,J1,J2
1170-
1171-C VARIABLES FOR KT CUT
1172- DOUBLE PRECISION PTNOW,COSTH,PABS1,PABS2
1173- DOUBLE PRECISION ETA1,ETA2,COSH_DETA,COS_DPHI,KT1SQ,KT2SQ, DPHI
1174-
1175- double precision etmin(nincoming+1:nexternal),etamax(nincoming+1:nexternal)
1176- double precision emin(nincoming+1:nexternal)
1177- double precision r2min(nincoming+1:nexternal,nincoming+1:nexternal)
1178- double precision s_min(nexternal,nexternal)
1179- double precision etmax(nincoming+1:nexternal),etamin(nincoming+1:nexternal)
1180- double precision emax(nincoming+1:nexternal)
1181- double precision r2max(nincoming+1:nexternal,nincoming+1:nexternal)
1182- double precision s_max(nexternal,nexternal)
1183- double precision ptll_min(nexternal,nexternal),ptll_max(nexternal,nexternal)
1184- double precision inclHtmin,inclHtmax
1185- common/to_cuts/ etmin, emin, etamax, r2min, s_min,
1186- $ etmax, emax, etamin, r2max, s_max, ptll_min, ptll_max, inclHtmin,inclHtmax
1187-
1188- double precision ptjmin4(4),ptjmax4(4),htjmin4(2:4),htjmax4(2:4)
1189- logical jetor
1190- common/to_jet_cuts/ ptjmin4,ptjmax4,htjmin4,htjmax4,jetor
1191-
1192- double precision ptlmin4(4),ptlmax4(4)
1193- common/to_lepton_cuts/ ptlmin4,ptlmax4
1194-
1195-c
1196-c Special cuts
1197-c
1198-
1199- integer lbw(0:nexternal) !Use of B.W.
1200- common /to_BW/ lbw
1201-C
1202-C SPECIAL CUTS
1203-C
1204- LOGICAL IS_A_J(NEXTERNAL),IS_A_L(NEXTERNAL)
1205- LOGICAL IS_A_B(NEXTERNAL),IS_A_A(NEXTERNAL),IS_A_ONIUM(NEXTERNAL)
1206- LOGICAL IS_A_NU(NEXTERNAL),IS_HEAVY(NEXTERNAL)
1207- logical do_cuts(nexternal)
1208- COMMON /TO_SPECISA/IS_A_J,IS_A_A,IS_A_L,IS_A_B,IS_A_NU,IS_HEAVY,
1209- . IS_A_ONIUM, do_cuts
1210-C
1211-C Keep track of whether cuts already calculated for this event
1212-C
1213- LOGICAL CUTSDONE,CUTSPASSED
1214- COMMON/TO_CUTSDONE/CUTSDONE,CUTSPASSED
1215- DATA CUTSDONE,CUTSPASSED/.FALSE.,.FALSE./
1216-
1217-C $B$ MW_NEW_DEF $E$ !this is a tag for MadWeight
1218-
1219- double precision xqcutij(nexternal,nexternal),xqcuti(nexternal)
1220- common/to_xqcuts/xqcutij,xqcuti
1221-
1222-c jet cluster algorithm
1223- integer nQCD !,NJET,JET(nexternal)
1224-c double precision plab(0:3, nexternal)
1225- double precision pQCD(0:3,nexternal)!,PJET(0:3,nexternal)
1226-c double precision rfj,sycut,palg,fastjetdmerge
1227-c integer njet_eta
1228-c Photon isolation
1229- integer nph,nem,nin
1230- double precision ptg,chi_gamma_iso,iso_getdrv40
1231- double precision Etsum(0:nexternal)
1232- real drlist(nexternal)
1233- double precision pgamma(0:3,nexternal),pem(0:3,nexternal)
1234- logical alliso
1235-C Sort array of results: ismode>0 for real, isway=0 for ascending order
1236- integer ismode,isway,izero,isorted(nexternal)
1237- parameter (ismode=1)
1238- parameter (isway=0)
1239- parameter (izero=0)
1240-
1241- include 'coupl.inc'
1242-C
1243-C
1244-c
1245- DATA FIRSTTIME,FIRSTTIME2/.TRUE.,.TRUE./
1246-
1247-c put momenta in common block for couplings.f
1248- double precision pp(0:3,max_particles)
1249- common /momenta_pp/pp
1250-
1251- DATA DEBUG/.FALSE./
1252-
1253-C-----
1254-C BEGIN CODE
1255-C-----
1256-
1257-
1258-
1259- PASSCUTS=.TRUE. !EVENT IS OK UNLESS OTHERWISE CHANGED
1260- IF (FIRSTTIME) THEN
1261- FIRSTTIME=.FALSE.
1262-c Preparation for reweighting by setting up clustering by diagrams
1263- call initcluster()
1264-c
1265-c
1266- write(formstr,'(a,i2.2,a)')'(a10,',nexternal,'i8)'
1267- write(*,formstr) 'Particle',(i,i=nincoming+1,nexternal)
1268- write(formstr,'(a,i2.2,a)')'(a10,',nexternal,'f8.1)'
1269- write(*,formstr) 'Et >',(etmin(i),i=nincoming+1,nexternal)
1270- write(*,formstr) 'E >',(emin(i),i=nincoming+1,nexternal)
1271- write(*,formstr) 'Eta <',(etamax(i),i=nincoming+1,nexternal)
1272- write(*,formstr) 'xqcut: ',(xqcuti(i),i=nincoming+1,nexternal)
1273- write(formstr,'(a,i2.2,a)')'(a,i2,a,',nexternal,'f8.1)'
1274- do j=nincoming+1,nexternal-1
1275- write(*,formstr) 'd R #',j,' >',(-0.0,i=nincoming+1,j),
1276- & (r2min(i,j),i=j+1,nexternal)
1277- do i=j+1,nexternal
1278- r2min(i,j)=r2min(i,j)*dabs(r2min(i,j)) !Since r2 returns distance squared
1279- r2max(i,j)=r2max(i,j)*dabs(r2max(i,j))
1280- enddo
1281- enddo
1282- do j=nincoming+1,nexternal-1
1283- write(*,formstr) 's min #',j,'>',
1284- & (s_min(i,j),i=nincoming+1,nexternal)
1285- enddo
1286- do j=nincoming+1,nexternal-1
1287- write(*,formstr) 'xqcutij #',j,'>',
1288- & (xqcutij(i,j),i=nincoming+1,nexternal)
1289- enddo
1290-
1291-cc
1292-cc Set the strong coupling
1293-cc
1294-c call set_ren_scale(P,scale)
1295-c
1296-cc Check that the user funtions for setting the scales
1297-cc have been edited if the choice of an event-by-event
1298-cc scale choice has been made
1299-c
1300-c if(.not.fixed_ren_scale) then
1301-c if(scale.eq.0d0) then
1302-c write(6,*)
1303-c write(6,*) '* >>>>>>>>>ERROR<<<<<<<<<<<<<<<<<<<<<<<*'
1304-c write(6,*) ' Dynamical renormalization scale choice '
1305-c write(6,*) ' selected but user subroutine'
1306-c write(6,*) ' set_ren_scale not edited in file:setpara.f'
1307-c write(6,*) ' Switching to a fixed_ren_scale choice'
1308-c write(6,*) ' with scale=zmass'
1309-c scale=91.2d0
1310-c write(6,*) 'scale=',scale
1311-c fixed_ren_scale=.true.
1312-c call set_ren_scale(P,scale)
1313-c endif
1314-c endif
1315-
1316-c if(.not.fixed_fac_scale) then
1317-c call set_fac_scale(P,q2fact)
1318-c if(q2fact(1).eq.0d0.or.q2fact(2).eq.0d0) then
1319-c write(6,*)
1320-c write(6,*) '* >>>>>>>>>ERROR<<<<<<<<<<<<<<<<<<<<<<<*'
1321-c write(6,*) ' Dynamical renormalization scale choice '
1322-c write(6,*) ' selected but user subroutine'
1323-c write(6,*) ' set_fac_scale not edited in file:setpara.f'
1324-c write(6,*) ' Switching to a fixed_fac_scale choice'
1325-c write(6,*) ' with q2fact(i)=zmass**2'
1326-c fixed_fac_scale=.true.
1327-c q2fact(1)=91.2d0**2
1328-c q2fact(2)=91.2d0**2
1329-c write(6,*) 'scales=',q2fact(1),q2fact(2)
1330-c endif
1331-c endif
1332-
1333- if(fixed_ren_scale) then
1334- G = SQRT(4d0*PI*ALPHAS(scale))
1335- call update_as_param()
1336- endif
1337-
1338-c Put momenta in the common block to zero to start
1339- do i=0,3
1340- do j=1,max_particles
1341- pp(i,j) = 0d0
1342- enddo
1343- enddo
1344-
1345- ENDIF ! IF FIRSTTIME
1346-
1347- IF (CUTSDONE) THEN
1348- PASSCUTS=CUTSPASSED
1349- RETURN
1350- ENDIF
1351- CUTSDONE=.TRUE.
1352-c CUTSPASSED=.FALSE.
1353-
1354-c
1355-c Make sure have reasonable 4-momenta
1356-c
1357- if (p(0,1) .le. 0d0) then
1358- passcuts=.false.
1359- return
1360- endif
1361-
1362-c Also make sure there's no INF or NAN
1363- do i=1,nexternal
1364- do j=0,3
1365- if(p(j,i).gt.1d32.or.p(j,i).ne.p(j,i))then
1366- passcuts=.false.
1367- return
1368- endif
1369- enddo
1370- enddo
1371-
1372-c
1373-c Limit S_hat
1374-c
1375-c if (x1*x2*stot .gt. 500**2) then
1376-c passcuts=.false.
1377-c return
1378-c endif
1379-
1380-C $B$ DESACTIVATE_CUT $E$ !This is a tag for MadWeight
1381-
1382- if(debug) write (*,*) '============================='
1383- if(debug) write (*,*) ' EVENT STARTS TO BE CHECKED '
1384- if(debug) write (*,*) '============================='
1385-c
1386-c p_t min & max cuts
1387-c
1388- do i=nincoming+1,nexternal
1389- if(debug) write (*,*) 'pt(',i,')=',pt(p(0,i)),' ',etmin(i),
1390- $ ':',etmax(i)
1391- notgood=(pt(p(0,i)) .lt. etmin(i)).or.
1392- & (etmax(i).ge.0d0.and.pt(p(0,i)) .gt. etmax(i))
1393- if (notgood) then
1394- if(debug) write (*,*) i,' -> fails'
1395- passcuts=.false.
1396- return
1397- endif
1398- enddo
1399-c
1400-c missing ET min & max cut + Invariant mass of leptons and neutrino
1401-c nb: missing Et defined as the vector sum over the neutrino's pt
1402-c
1403-c-- reset ptemp(0:3)
1404- do j=0,3
1405- ptemp(j)=0 ! for the neutrino
1406- ptemp2(j)=0 ! for the leptons
1407- enddo
1408-c- sum over the momenta
1409- do i=nincoming+1,nexternal
1410- if(is_a_nu(i)) then
1411- if(debug) write (*,*) i,' -> neutrino '
1412- do j=0,3
1413- ptemp(j)=ptemp(j)+p(j,i)
1414- enddo
1415- elseif(is_a_l(i)) then
1416- if(debug) write (*,*) i,' -> lepton '
1417- do j=0,3
1418- ptemp2(j)=ptemp2(j)+p(j,i)
1419- enddo
1420- endif
1421-
1422- enddo
1423-c- check the et
1424- if(debug.and.ptemp(0).eq.0d0) write (*,*) 'No et miss in event'
1425- if(debug.and.ptemp(0).gt.0d0) write (*,*) 'Et miss =',pt(ptemp(0)),' ',misset,':',missetmax
1426- if(debug.and.ptemp2(0).eq.0d0) write (*,*) 'No leptons in event'
1427- if(debug.and.ptemp(0).gt.0d0) write (*,*) 'Energy of leptons =',pt(ptemp2(0))
1428- if(ptemp(0).gt.0d0) then
1429- notgood=(pt(ptemp(0)) .lt. misset).or.
1430- & (missetmax.ge.0d0.and.pt(ptemp(0)) .gt. missetmax)
1431- if (notgood) then
1432- if(debug) write (*,*) ' missing et cut -> fails'
1433- passcuts=.false.
1434- return
1435- endif
1436- endif
1437- if (mmnl.gt.0d0.or.mmnlmax.ge.0d0)then
1438- if(dsqrt(SumDot(ptemp,ptemp2,1d0)).lt.mmnl.or.mmnlmax.ge.0d0.and.dsqrt(SumDot(ptemp, ptemp2,1d0)).gt.mmnlmax) then
1439- if(debug) write (*,*) 'lepton invariant mass -> fails'
1440- passcuts=.false.
1441- return
1442- endif
1443- endif
1444-c
1445-c pt cut on heavy particles
1446-c gives min(pt) for (at least) one heavy particle
1447-c
1448- if(ptheavy.gt.0d0)then
1449- passcuts=.false.
1450- foundheavy=.false.
1451- do i=nincoming+1,nexternal
1452- if(is_heavy(i)) then
1453- if(debug) write (*,*) i,' -> heavy '
1454- foundheavy=.true.
1455- if(pt(p(0,i)).gt.ptheavy) passcuts=.true.
1456- endif
1457- enddo
1458-
1459- if(.not.passcuts.and.foundheavy)then
1460- if(debug) write (*,*) ' heavy particle cut -> fails'
1461- return
1462- else
1463- passcuts=.true.
1464- endif
1465- endif
1466-c
1467-c E min & max cuts
1468-c
1469- do i=nincoming+1,nexternal
1470- if(debug) write (*,*) 'p(0,',i,')=',p(0,i),' ',emin(i),':',emax(i)
1471- notgood=(p(0,i) .le. emin(i)).or.
1472- & (emax(i).ge.0d0 .and. p(0,i) .gt. emax(i))
1473- if (notgood) then
1474- if(debug) write (*,*) i,' -> fails'
1475- passcuts=.false.
1476- return
1477- endif
1478- enddo
1479-c
1480-c Rapidity min & max cuts
1481-c
1482- do i=nincoming+1,nexternal
1483- if(debug) write (*,*) 'abs(rap(',i,'))=',abs(rap(p(0,i))),' ',etamin(i),':',etamax(i)
1484- notgood=(etamax(i).ge.0.and.abs(rap(p(0,i))) .gt. etamax(i)).or.
1485- & (abs(rap(p(0,i))) .lt. etamin(i))
1486- if (notgood) then
1487- if(debug) write (*,*) i,' -> fails'
1488- passcuts=.false.
1489- return
1490- endif
1491- enddo
1492-c
1493-c DeltaR min & max cuts
1494-c
1495- do i=nincoming+1,nexternal-1
1496- do j=i+1,nexternal
1497- if(debug) write (*,*) 'r2(',i, ',' ,j,')=',dsqrt(r2(p(0,i),p(0,j)))
1498- if(debug) write (*,*) dsqrt(r2min(j,i)),dsqrt(r2max(j,i))
1499- if(r2min(j,i).gt.0.or.r2max(j,i).ge.0d0) then
1500- tmp=r2(p(0,i),p(0,j))
1501- notgood=(tmp .lt. r2min(j,i)).or.
1502- $ (r2max(j,i).ge.0d0 .and. tmp .gt. r2max(j,i))
1503- if (notgood) then
1504- if(debug) write (*,*) i,j,' -> fails'
1505- passcuts=.false.
1506- return
1507- endif
1508- endif
1509- enddo
1510- enddo
1511-
1512-
1513-c s-channel min & max pt of sum of 4-momenta
1514-c
1515- do i=nincoming+1,nexternal-1
1516- do j=i+1,nexternal
1517- if(debug)write (*,*) 'ptll(',i,',',j,')=',PtDot(p(0,i),p(0,j))
1518- if(debug)write (*,*) ptll_min(j,i),ptll_max(j,i)
1519- if(ptll_min(j,i).gt.0.or.ptll_max(j,i).ge.0d0) then
1520- tmp=PtDot(p(0,i),p(0,j))
1521- notgood=(tmp .lt. ptll_min(j,i).or.
1522- $ ptll_max(j,i).ge.0d0 .and. tmp.gt.ptll_max(j,i))
1523- if (notgood) then
1524- if(debug) write (*,*) i,j,' -> fails'
1525- passcuts=.false.
1526- return
1527- endif
1528- endif
1529- enddo
1530- enddo
1531-
1532-
1533-
1534-
1535-c
1536-c s-channel min & max invariant mass cuts
1537-c
1538- do i=nincoming+1,nexternal-1
1539- do j=i+1,nexternal
1540- if(debug) write (*,*) 's(',i,',',j,')=',Sumdot(p(0,i),p(0,j),+1d0)
1541- if(debug) write (*,*) s_min(j,i),s_max(j,i)
1542- if(s_min(j,i).gt.0.or.s_max(j,i).ge.0d0) then
1543- tmp=SumDot(p(0,i),p(0,j),+1d0)
1544- if(s_min(j,i).le.s_max(j,i) .or. s_max(j,i).lt.0d0)then
1545- notgood=(tmp .lt. s_min(j,i).or.
1546- $ s_max(j,i).ge.0d0 .and. tmp .gt. s_max(j,i))
1547- if (notgood) then
1548- if(debug) write (*,*) i,j,' -> fails'
1549- passcuts=.false.
1550- return
1551- endif
1552- else
1553- notgood=(tmp .lt. s_min(j,i).and.tmp .gt. s_max(j,i))
1554- if (notgood) then
1555- if(debug) write (*,*) i,j,' -> fails'
1556- passcuts=.false.
1557- return
1558- endif
1559- endif
1560- endif
1561- enddo
1562- enddo
1563-C $B$DESACTIVATE_BW_CUT$B$ This is a Tag for MadWeight
1564-c
1565-c B.W. phase space cuts
1566-c
1567- pass_bw=cut_bw(p)
1568-c JA 4/8/11 always check pass_bw
1569- if ( pass_bw.and..not.CUTSPASSED) then
1570- passcuts=.false.
1571- if(debug) write (*,*) ' pass_bw -> fails'
1572- return
1573- endif
1574-C $E$DESACTIVATE_BW_CUT$E$ This is a Tag for MadWeight
1575- CUTSPASSED=.FALSE.
1576-C
1577-C maximal and minimal pt of the jets sorted by pt
1578-c
1579- njets=0
1580- nheavyjets=0
1581-
1582-c- fill ptjet with the pt's of the jets.
1583- do i=nincoming+1,nexternal
1584- if(is_a_j(i)) then
1585- njets=njets+1
1586- ptjet(njets)=pt(p(0,i))
1587- endif
1588- if(is_a_b(i)) then
1589- nheavyjets=nheavyjets+1
1590- ptheavyjet(nheavyjets)=pt(p(0,i))
1591- endif
1592-
1593- enddo
1594- if(debug) write (*,*) 'not yet ordered ',njets,' ',ptjet
1595-
1596-C----------------------------------------------------------------------------
1597-C DURHAM_KT CUT
1598-C----------------------------------------------------------------------------
1599- IF(NJETS.GT.0 .AND.KT_DURHAM.GT.0D0) THEN
1600-C RESET JET MOMENTA
1601- njets=0
1602- DO I=1,NEXTERNAL
1603- DO J=0,3
1604- PJET(I,J) = 0E0
1605- ENDDO
1606- ENDDO
1607-
1608- do i=nincoming+1,nexternal
1609- if(is_a_j(i).and.do_cuts(i)) then
1610- njets=njets+1
1611- DO J=0,3
1612- PJET(NJETS,J) = P(J,I)
1613- ENDDO
1614- endif
1615- enddo
1616-
1617-C DURHAM KT SEPARATION CUT
1618-
1619-
1620- PTMIN = EBEAM(1) + EBEAM(2)
1621-
1622- DO I=1,NJETS
1623-
1624-C PT WITH RESPECT TO Z AXIS FOR HADRONIC COLLISIONS
1625- IF ( (LPP(1).NE.0) .OR. (LPP(2).NE.0)) THEN
1626- PT1 = DSQRT(PJET(I,1)**2 + PJET(I,2)**2)
1627- PTMIN = MIN( PTMIN, PT1 )
1628- ENDIF
1629-
1630- DO J=I+1,NJETS
1631-C GET ANGLE BETWEEN JETS
1632- PABS1 = DSQRT(PJET(I,1)**2 + PJET(I,2)**2 + PJET(I,3)**2)
1633- PABS2 = DSQRT(PJET(J,1)**2 + PJET(J,2)**2 + PJET(J,3)**2)
1634-C CHECK IF 3-MOMENTA DO NOT VANISH
1635- IF(PABS1*PABS2 .NE. 0D0) THEN
1636- COSTH = ( PJET(I,1)*PJET(J,1) + PJET(I,2)*PJET(J,2) + PJET(I,3)*PJET(J,3) )/(PABS1*PABS2)
1637- ELSE
1638-C IF 3-MOMENTA VANISH, MAKE JET COSTH = 1D0 SO THAT JET MEASURE VANISHES
1639- COSTH = 1D0
1640- ENDIF
1641-C GET PT AND ETA OF JETS
1642- PT2 = DSQRT(PJET(J,1)**2 + PJET(J,2)**2)
1643- ETA1 = 0.5D0*LOG( (PJET(I,0) + PJET(I,3)) / (PJET(I,0) - PJET(I,3)) )
1644- ETA2 = 0.5D0*LOG( (PJET(J,0) + PJET(J,3)) / (PJET(J,0) - PJET(J,3)) )
1645-C GET COSH OF DELTA ETA, COS OF DELTA PHI
1646- COSH_DETA = DCOSH( ETA1 - ETA2 )
1647- COS_DPHI = ( PJET(I,1)*PJET(J,1) + PJET(I,2)*PJET(J,2) ) / (PT1*PT2)
1648- DPHI = DACOS( COS_DPHI )
1649- IF ( (LPP(1).EQ.0) .AND. (LPP(2).EQ.0)) THEN
1650-C KT FOR E+E- COLLISION
1651- PTNOW = DSQRT( 2D0*MIN(PJET(I,0)**2,PJET(J,0)**2)*( 1D0-COSTH ) )
1652- ELSE
1653-C HADRONIC KT, FASTJET DEFINITION
1654- PTNOW = DSQRT( MIN(PT1**2,PT2**2)*( (ETA1 - ETA2 )**2 + DPHI**2 )/(D_PARAMETER**2) )
1655- ENDIF
1656-
1657- PTMIN = MIN( PTMIN, PTNOW )
1658-
1659- ENDDO ! LOOP OVER NJET
1660-
1661- ENDDO ! LOOP OVER NJET
1662-
1663-C CHECK COMPATIBILITY WITH CUT
1664- IF( (PTMIN .LT. KT_DURHAM)) THEN
1665- PASSCUTS = .FALSE.
1666- RETURN
1667- ENDIF
1668- ENDIF ! IF NJETS.GT. 0 .AND. DO_KT_DURHAM
1669-
1670-C----------------------------------------------------------------------------
1671-C----------------------------------------------------------------------------
1672-
1673-
1674-
1675-c- check existance of jets if jet cuts are on
1676- if(njets.lt.1.and.(htjmin.gt.0.or.ptj1min.gt.0).or.
1677- $ njets.lt.2.and.ptj2min.gt.0.or.
1678- $ njets.lt.3.and.ptj3min.gt.0.or.
1679- $ njets.lt.4.and.ptj4min.gt.0)then
1680- if(debug) write (*,*) i, ' too few jets -> fails'
1681- passcuts=.false.
1682- return
1683- endif
1684-
1685-c - sort jet pts
1686- do i=1,njets-1
1687- do j=i+1,njets
1688- if(ptjet(j).gt.ptjet(i)) then
1689- temp=ptjet(i)
1690- ptjet(i)=ptjet(j)
1691- ptjet(j)=temp
1692- endif
1693- enddo
1694- enddo
1695- if(debug) write (*,*) 'ordered ',njets,' ',ptjet
1696-c
1697-c Use "and" or "or" prescriptions
1698-c
1699- inclht=0
1700-
1701- if(njets.gt.0) then
1702-
1703- notgood=.not.jetor
1704- if(debug) write (*,*) 'jetor :',jetor
1705- if(debug) write (*,*) '0',notgood
1706-
1707- do i=1,min(njets,4)
1708- if(debug) write (*,*) i,ptjet(i), ' ',ptjmin4(i),
1709- $ ':',ptjmax4(i)
1710- if(jetor) then
1711-c--- if one of the jets does not pass, the event is rejected
1712- notgood=notgood.or.(ptjmax4(i).ge.0d0 .and.
1713- $ ptjet(i).gt.ptjmax4(i)) .or.
1714- $ (ptjet(i).lt.ptjmin4(i))
1715- if(debug) write (*,*) i,' notgood total:', notgood
1716- else
1717-c--- all cuts must fail to reject the event
1718- notgood=notgood.and.(ptjmax4(i).ge.0d0 .and.
1719- $ ptjet(i).gt.ptjmax4(i) .or.
1720- $ (ptjet(i).lt.ptjmin4(i)))
1721- if(debug) write (*,*) i,' notgood total:', notgood
1722- endif
1723- enddo
1724-
1725-
1726- if (notgood) then
1727- if(debug) write (*,*) i, ' multiple pt -> fails'
1728- passcuts=.false.
1729- return
1730- endif
1731-
1732-c---------------------------
1733-c Ht cuts
1734-C---------------------------
1735- htj=ptjet(1)
1736-
1737- do i=2,njets
1738- htj=htj+ptjet(i)
1739- if(debug) write (*,*) i, 'htj ',htj
1740- if(debug.and.i.le.4) write (*,*) 'htmin ',i,' ', htjmin4(i),':',htjmax4(i)
1741- if(i.le.4)then
1742- if(htj.lt.htjmin4(i) .or.
1743- $ htjmax4(i).ge.0d0.and.htj.gt.htjmax4(i)) then
1744- if(debug) write (*,*) i, ' ht -> fails'
1745- passcuts=.false.
1746- return
1747- endif
1748- endif
1749- enddo
1750-
1751- if(htj.lt.htjmin.or.htjmax.ge.0d0.and.htj.gt.htjmax)then
1752- if(debug) write (*,*) i, ' htj -> fails'
1753- passcuts=.false.
1754- return
1755- endif
1756-
1757- inclht=htj
1758-
1759- endif !if there are jets
1760-
1761- if(nheavyjets.gt.0) then
1762- do i=1,nheavyjets
1763- inclht=inclht+ptheavyjet(i)
1764- enddo
1765- endif !if there are heavyjets
1766-
1767- if(inclht.lt.inclHtmin.or.
1768- $ inclHtmax.ge.0d0.and.inclht.gt.inclHtmax)then
1769- if(debug) write (*,*) ' inclhtmin=',inclHtmin,' -> fails'
1770- passcuts=.false.
1771- return
1772- endif
1773-
1774-C
1775-C maximal and minimal pt of the leptons sorted by pt
1776-c
1777- nleptons=0
1778-
1779- if(ptl1min.gt.0.or.ptl2min.gt.0.or.ptl3min.gt.0.or.ptl4min.gt.0.or.
1780- $ ptl1max.ge.0d0.or.ptl2max.ge.0d0.or.
1781- $ ptl3max.ge.0d0.or.ptl4max.ge.0d0) then
1782-
1783-c - fill ptlepton with the pt's of the leptons.
1784- do i=nincoming+1,nexternal
1785- if(is_a_l(i)) then
1786- nleptons=nleptons+1
1787- ptlepton(nleptons)=pt(p(0,i))
1788- endif
1789- enddo
1790- if(debug) write (*,*) 'not yet ordered ',njets,' ',ptjet
1791-
1792-c - check existance of leptons if lepton cuts are on
1793- if(nleptons.lt.1.and.ptl1min.gt.0.or.
1794- $ nleptons.lt.2.and.ptl2min.gt.0.or.
1795- $ nleptons.lt.3.and.ptl3min.gt.0.or.
1796- $ nleptons.lt.4.and.ptl4min.gt.0)then
1797- if(debug) write (*,*) i, ' too few leptons -> fails'
1798- passcuts=.false.
1799- return
1800- endif
1801-
1802-c - sort lepton pts
1803- do i=1,nleptons-1
1804- do j=i+1,nleptons
1805- if(ptlepton(j).gt.ptlepton(i)) then
1806- temp=ptlepton(i)
1807- ptlepton(i)=ptlepton(j)
1808- ptlepton(j)=temp
1809- endif
1810- enddo
1811- enddo
1812- if(debug) write (*,*) 'ordered ',nleptons,' ',ptlepton
1813-
1814- if(nleptons.gt.0) then
1815-
1816- notgood = .false.
1817- do i=1,min(nleptons,4)
1818- if(debug) write (*,*) i,ptlepton(i), ' ',ptlmin4(i),':',ptlmax4(i)
1819-c--- if one of the leptons does not pass, the event is rejected
1820- notgood=notgood.or.
1821- $ (ptlmax4(i).ge.0d0.and.ptlepton(i).gt.ptlmax4(i)).or.
1822- $ (ptlepton(i).lt.ptlmin4(i))
1823- if(debug) write (*,*) i,' notgood total:', notgood
1824- enddo
1825-
1826-
1827- if (notgood) then
1828- if(debug) write (*,*) i, ' multiple pt -> fails'
1829- passcuts=.false.
1830- return
1831- endif
1832- endif
1833- endif
1834-C>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
1835-C SPECIAL CUTS
1836-C<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
1837-
1838-C REQUIRE AT LEAST ONE JET WITH PT>XPTJ
1839-
1840- IF(xptj.gt.0d0) THEN
1841- xvar=0
1842- do i=nincoming+1,nexternal
1843- if(is_a_j(i)) xvar=max(xvar,pt(p(0,i)))
1844- enddo
1845- if (xvar .lt. xptj) then
1846- passcuts=.false.
1847- return
1848- endif
1849- ENDIF
1850-
1851-C REQUIRE AT LEAST ONE PHOTON WITH PT>XPTA
1852-
1853- IF(xpta.gt.0d0) THEN
1854- xvar=0
1855- do i=nincoming+1,nexternal
1856- if(is_a_a(i)) xvar=max(xvar,pt(p(0,i)))
1857- enddo
1858- if (xvar .lt. xpta) then
1859- passcuts=.false.
1860- return
1861- endif
1862- ENDIF
1863-
1864-C REQUIRE AT LEAST ONE B WITH PT>XPTB
1865-
1866- IF(xptb.gt.0d0) THEN
1867- xvar=0
1868- do i=nincoming+1,nexternal
1869- if(is_a_b(i)) xvar=max(xvar,pt(p(0,i)))
1870- enddo
1871- if (xvar .lt. xptb) then
1872- passcuts=.false.
1873- return
1874- endif
1875- ENDIF
1876-
1877-C REQUIRE AT LEAST ONE LEPTON WITH PT>XPTL
1878-
1879- IF(xptl.gt.0d0) THEN
1880- xvar=0
1881- do i=nincoming+1,nexternal
1882- if(is_a_l(i)) xvar=max(xvar,pt(p(0,i)))
1883- enddo
1884- if (xvar .lt. xptl) then
1885- passcuts=.false.
1886- if(debug) write (*,*) ' xptl -> fails'
1887- return
1888- endif
1889- ENDIF
1890-C
1891-C WBF CUTS: TWO TYPES
1892-C
1893-C FIRST TYPE: implemented by FM
1894-C
1895-C 1. FIND THE 2 HARDEST JETS
1896-C 2. REQUIRE |RAP(J)|>XETAMIN
1897-C 3. REQUIRE RAP(J1)*ETA(J2)<0
1898-C
1899-C SECOND TYPE : added by Simon de Visscher 1-08-2007
1900-C
1901-C 1. FIND THE 2 HARDEST JETS
1902-C 2. REQUIRE |RAP(J1)-RAP(J2)|>DELTAETA
1903-C 3. REQUIRE RAP(J1)*RAP(J2)<0
1904-C
1905-C
1906- hardj1=0
1907- hardj2=0
1908- ptmax1=0d0
1909- ptmax2=0d0
1910-
1911-C-- START IF AT LEAST ONE OF THE CUTS IS ACTIVATED
1912-
1913- IF(XETAMIN.GT.0D0.OR.DELTAETA.GT.0D0) THEN
1914-
1915-C-- FIND THE HARDEST JETS
1916-
1917- do i=nincoming+1,nexternal
1918- if(is_a_j(i)) then
1919-c write (*,*) i,pt(p(0,i))
1920- if(pt(p(0,i)).gt.ptmax1) then
1921- hardj2=hardj1
1922- ptmax2=ptmax1
1923- hardj1=i
1924- ptmax1=pt(p(0,i))
1925- elseif(pt(p(0,i)).gt.ptmax2) then
1926- hardj2=i
1927- ptmax2=pt(p(0,i))
1928- endif
1929-c write (*,*) hardj1,hardj2,ptmax1,ptmax2
1930- endif
1931- enddo
1932-
1933- if (hardj2.eq.0) goto 21 ! bypass vbf cut since not enough jets
1934-
1935-C-- NOW APPLY THE CUT I
1936-
1937- if (abs(rap(p(0,hardj1))) .lt. xetamin
1938- & .or.abs(rap(p(0,hardj2))) .lt. xetamin
1939- & .or.rap(p(0,hardj1))*rap(p(0,hardj2)) .gt.0d0) then
1940- passcuts=.false.
1941- return
1942- endif
1943-
1944-
1945-C-- NOW APPLY THE CUT II
1946-
1947- if (abs(rap(p(0,hardj1))-rap(p(0,hardj2))) .lt. deltaeta) then
1948- passcuts=.false.
1949- return
1950- endif
1951-
1952-c write (*,*) hardj1,hardj2,rap(p(0,hardj1)),rap(p(0,hardj2))
1953-
1954- ENDIF
1955-
1956-c Begin photon isolation
1957-c NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE
1958-c Use is made of parton cm frame momenta. If this must be
1959-c changed, pQCD used below must be redefined
1960-c NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE
1961-c If we do not require a mimimum jet energy, there's no need to apply
1962-c jet clustering and all that.
1963- if (ptgmin.ne.0d0) then
1964-
1965-c Put all (light) QCD partons in momentum array for jet clustering.
1966-c From the run_card.dat, maxjetflavor defines if b quark should be
1967-c considered here (via the logical variable 'is_a_jet'). nQCD becomes
1968-c the number of (light) QCD partons at the real-emission level (i.e. one
1969-c more than the Born).
1970-
1971- nQCD=0
1972- do j=nincoming+1,nexternal
1973- if (is_a_j(j)) then
1974- nQCD=nQCD+1
1975- do i=0,3
1976- pQCD(i,nQCD)=p(i,j) ! Use C.o.M. frame momenta
1977- enddo
1978- endif
1979- enddo
1980-
1981- nph=0
1982- do j=nincoming+1,nexternal
1983- if (is_a_a(j)) then
1984- nph=nph+1
1985- do i=0,3
1986- pgamma(i,nph)=p(i,j) ! Use C.o.M. frame momenta
1987- enddo
1988- endif
1989- enddo
1990- if(nph.eq.0) goto 444
1991-
1992- if(isoEM)then
1993- nem=nph
1994- do k=1,nem
1995- do i=0,3
1996- pem(i,k)=pgamma(i,k)
1997- enddo
1998- enddo
1999- do j=nincoming+1,nexternal
2000- if (is_a_l(j)) then
2001- nem=nem+1
2002- do i=0,3
2003- pem(i,nem)=p(i,j) ! Use C.o.M. frame momenta
2004- enddo
2005- endif
2006- enddo
2007- endif
2008-
2009- alliso=.true.
2010-
2011- j=0
2012- dowhile(j.lt.nph.and.alliso)
2013-c Loop over all photons
2014- j=j+1
2015-
2016- ptg=pt(pgamma(0,j))
2017- if(ptg.lt.ptgmin)then
2018- passcuts=.false.
2019- return
2020- endif
2021-
2022-c Isolate from hadronic energy
2023- do i=1,nQCD
2024- drlist(i)=sngl(iso_getdrv40(pgamma(0,j),pQCD(0,i)))
2025- enddo
2026- call sortzv(drlist,isorted,nQCD,ismode,isway,izero)
2027- Etsum(0)=0.d0
2028- nin=0
2029- do i=1,nQCD
2030- if(dble(drlist(isorted(i))).le.R0gamma)then
2031- nin=nin+1
2032- Etsum(nin)=Etsum(nin-1)+pt(pQCD(0,isorted(i)))
2033- endif
2034- enddo
2035- do i=1,nin
2036- alliso=alliso .and.
2037- # Etsum(i).le.chi_gamma_iso(dble(drlist(isorted(i))),
2038- # R0gamma,xn,epsgamma,ptg)
2039- enddo
2040-
2041-c Isolate from EM energy
2042- if(isoEM.and.nem.gt.1)then
2043- do i=1,nem
2044- drlist(i)=sngl(iso_getdrv40(pgamma(0,j),pem(0,i)))
2045- enddo
2046- call sortzv(drlist,isorted,nem,ismode,isway,izero)
2047-c First of list must be the photon: check this, and drop it
2048- if(isorted(1).ne.j.or.drlist(isorted(1)).gt.1.e-4)then
2049- write(*,*)'Error #1 in photon isolation'
2050- write(*,*)j,isorted(1),drlist(isorted(1))
2051- stop
2052- endif
2053- Etsum(0)=0.d0
2054- nin=0
2055- do i=2,nem
2056- if(dble(drlist(isorted(i))).le.R0gamma)then
2057- nin=nin+1
2058- Etsum(nin)=Etsum(nin-1)+pt(pem(0,isorted(i)))
2059- endif
2060- enddo
2061- do i=1,nin
2062- alliso=alliso .and.
2063- # Etsum(i).le.chi_gamma_iso(dble(drlist(isorted(i))),
2064- # R0gamma,xn,epsgamma,ptg)
2065- enddo
2066-
2067- endif
2068-
2069-c End of loop over photons
2070- enddo
2071-
2072- if(.not.alliso)then
2073- passcuts=.false.
2074- return
2075- endif
2076- endif
2077-
2078- 444 continue
2079-c End photon isolation
2080-
2081-
2082-C...Set couplings if event passed cuts
2083-
2084- 21 if(.not.fixed_ren_scale) then
2085- call set_ren_scale(P,scale)
2086- if(scale.gt.0) G = SQRT(4d0*PI*ALPHAS(scale))
2087- endif
2088-
2089- if(.not.fixed_fac_scale) then
2090- call set_fac_scale(P,q2fact)
2091- endif
2092-
2093-c
2094-c Here we cluster event and reset factorization and renormalization
2095-c scales on an event-by-event basis, as well as check xqcut for jets
2096-c
2097-c Note the following condition is the first line of setclscales
2098-c if(xqcut.gt.0d0.or.ickkw.gt.0.or.scale.eq.0.or.q2fact(1).eq.0)then
2099-c Do not duplicate it since some variable are set for syscalc in the fct
2100- if(.not.setclscales(p))then
2101- cutsdone=.false.
2102- cutspassed=.false.
2103- passcuts = .false.
2104- if(debug) write (*,*) 'setclscales -> fails'
2105- return
2106- endif
2107-c endif
2108-
2109-c Set couplings in model files
2110- if(.not.fixed_ren_scale.or..not.fixed_couplings) then
2111- if (.not.fixed_couplings)then
2112- do i=0,3
2113- do j=1,nexternal
2114- pp(i,j)=p(i,j)
2115- enddo
2116- enddo
2117- endif
2118- call update_as_param()
2119- endif
2120-
2121- IF (FIRSTTIME2) THEN
2122- FIRSTTIME2=.FALSE.
2123- write(6,*) 'alpha_s for scale ',scale,' is ', G**2/(16d0*atan(1d0))
2124- ENDIF
2125-
2126- if(debug) write (*,*) '============================='
2127- if(debug) write (*,*) ' EVENT PASSED THE CUTS '
2128- if(debug) write (*,*) '============================='
2129-
2130- CUTSPASSED=.TRUE.
2131-
2132- RETURN
2133- END
2134-
2135-
2136-C
2137-C FUNCTION FOR ISOLATION
2138-C
2139-
2140- function iso_getdrv40(p1,p2)
2141- implicit none
2142- real*8 iso_getdrv40,p1(0:3),p2(0:3)
2143- real*8 iso_getdr
2144-c
2145- iso_getdrv40=iso_getdr(p1(0),p1(1),p1(2),p1(3),
2146- # p2(0),p2(1),p2(2),p2(3))
2147- return
2148- end
2149-
2150-
2151- function iso_getdr(en1,ptx1,pty1,pl1,en2,ptx2,pty2,pl2)
2152- implicit none
2153- real*8 iso_getdr,en1,ptx1,pty1,pl1,en2,ptx2,pty2,pl2,deta,dphi,
2154- # iso_getpseudorap,iso_getdelphi
2155-c
2156- deta=iso_getpseudorap(en1,ptx1,pty1,pl1)-
2157- # iso_getpseudorap(en2,ptx2,pty2,pl2)
2158- dphi=iso_getdelphi(ptx1,pty1,ptx2,pty2)
2159- iso_getdr=sqrt(dphi**2+deta**2)
2160- return
2161- end
2162-
2163-
2164- function iso_getpseudorap(en,ptx,pty,pl)
2165- implicit none
2166- real*8 iso_getpseudorap,en,ptx,pty,pl,tiny,pt,eta,th
2167- parameter (tiny=1.d-5)
2168-c
2169- pt=sqrt(ptx**2+pty**2)
2170- if(pt.lt.tiny.and.abs(pl).lt.tiny)then
2171- eta=sign(1.d0,pl)*1.d8
2172- else
2173- th=atan2(pt,pl)
2174- eta=-log(tan(th/2.d0))
2175- endif
2176- iso_getpseudorap=eta
2177- return
2178- end
2179-
2180-
2181- function iso_getdelphi(ptx1,pty1,ptx2,pty2)
2182- implicit none
2183- real*8 iso_getdelphi,ptx1,pty1,ptx2,pty2,tiny,pt1,pt2,tmp
2184- parameter (tiny=1.d-5)
2185-c
2186- pt1=sqrt(ptx1**2+pty1**2)
2187- pt2=sqrt(ptx2**2+pty2**2)
2188- if(pt1.ne.0.d0.and.pt2.ne.0.d0)then
2189- tmp=ptx1*ptx2+pty1*pty2
2190- tmp=tmp/(pt1*pt2)
2191- if(abs(tmp).gt.1.d0+tiny)then
2192- write(*,*)'Cosine larger than 1'
2193- stop
2194- elseif(abs(tmp).ge.1.d0)then
2195- tmp=sign(1.d0,tmp)
2196- endif
2197- tmp=acos(tmp)
2198- else
2199- tmp=1.d8
2200- endif
2201- iso_getdelphi=tmp
2202- return
2203- end
2204-
2205- function chi_gamma_iso(dr,R0,xn,epsgamma,pTgamma)
2206-c Eq.(3.4) of Phys.Lett. B429 (1998) 369-374 [hep-ph/9801442]
2207- implicit none
2208- real*8 chi_gamma_iso,dr,R0,xn,epsgamma,pTgamma
2209- real*8 tmp,axn
2210-c
2211- axn=abs(xn)
2212- tmp=epsgamma*pTgamma
2213- if(axn.ne.0.d0)then
2214- tmp=tmp*( (1-cos(dr))/(1-cos(R0)) )**axn
2215- endif
2216- chi_gamma_iso=tmp
2217- return
2218- end
2219-
2220-
2221-*
2222-* $Id: sortzv.F,v 1.1.1.1 1996/02/15 17:49:50 mclareni Exp $
2223-*
2224-* $Log: sortzv.F,v $
2225-* Revision 1.1.1.1 1996/02/15 17:49:50 mclareni
2226-* Kernlib
2227-*
2228-*
2229-c$$$#include "kerngen/pilot.h"
2230- SUBROUTINE SORTZV (A,INDEX,N1,MODE,NWAY,NSORT)
2231-C
2232-C CERN PROGLIB# M101 SORTZV .VERSION KERNFOR 3.15 820113
2233-C ORIG. 02/10/75
2234-C
2235- DIMENSION A(N1),INDEX(N1)
2236-C
2237-C
2238- N = N1
2239- IF (N.LE.0) RETURN
2240- IF (NSORT.NE.0) GO TO 2
2241- DO 1 I=1,N
2242- 1 INDEX(I)=I
2243-C
2244- 2 IF (N.EQ.1) RETURN
2245- IF (MODE) 10,20,30
2246- 10 CALL SORTTI (A,INDEX,N)
2247- GO TO 40
2248-C
2249- 20 CALL SORTTC(A,INDEX,N)
2250- GO TO 40
2251-C
2252- 30 CALL SORTTF (A,INDEX,N)
2253-C
2254- 40 IF (NWAY.EQ.0) GO TO 50
2255- N2 = N/2
2256- DO 41 I=1,N2
2257- ISWAP = INDEX(I)
2258- K = N+1-I
2259- INDEX(I) = INDEX(K)
2260- 41 INDEX(K) = ISWAP
2261- 50 RETURN
2262- END
2263-* ========================================
2264- SUBROUTINE SORTTF (A,INDEX,N1)
2265-C
2266- DIMENSION A(N1),INDEX(N1)
2267-C
2268- N = N1
2269- DO 3 I1=2,N
2270- I3 = I1
2271- I33 = INDEX(I3)
2272- AI = A(I33)
2273- 1 I2 = I3/2
2274- IF (I2) 3,3,2
2275- 2 I22 = INDEX(I2)
2276- IF (AI.LE.A (I22)) GO TO 3
2277- INDEX (I3) = I22
2278- I3 = I2
2279- GO TO 1
2280- 3 INDEX (I3) = I33
2281- 4 I3 = INDEX (N)
2282- INDEX (N) = INDEX (1)
2283- AI = A(I3)
2284- N = N-1
2285- IF (N-1) 12,12,5
2286- 5 I1 = 1
2287- 6 I2 = I1 + I1
2288- IF (I2.LE.N) I22= INDEX(I2)
2289- IF (I2-N) 7,9,11
2290- 7 I222 = INDEX (I2+1)
2291- IF (A(I22)-A(I222)) 8,9,9
2292- 8 I2 = I2+1
2293- I22 = I222
2294- 9 IF (AI-A(I22)) 10,11,11
2295- 10 INDEX(I1) = I22
2296- I1 = I2
2297- GO TO 6
2298- 11 INDEX (I1) = I3
2299- GO TO 4
2300- 12 INDEX (1) = I3
2301- RETURN
2302- END
2303-* ========================================
2304- SUBROUTINE SORTTI (A,INDEX,N1)
2305-C
2306- INTEGER A,AI
2307- DIMENSION A(N1),INDEX(N1)
2308-C
2309- N = N1
2310- DO 3 I1=2,N
2311- I3 = I1
2312- I33 = INDEX(I3)
2313- AI = A(I33)
2314- 1 I2 = I3/2
2315- IF (I2) 3,3,2
2316- 2 I22 = INDEX(I2)
2317- IF (AI.LE.A (I22)) GO TO 3
2318- INDEX (I3) = I22
2319- I3 = I2
2320- GO TO 1
2321- 3 INDEX (I3) = I33
2322- 4 I3 = INDEX (N)
2323- INDEX (N) = INDEX (1)
2324- AI = A(I3)
2325- N = N-1
2326- IF (N-1) 12,12,5
2327- 5 I1 = 1
2328- 6 I2 = I1 + I1
2329- IF (I2.LE.N) I22= INDEX(I2)
2330- IF (I2-N) 7,9,11
2331- 7 I222 = INDEX (I2+1)
2332- IF (A(I22)-A(I222)) 8,9,9
2333- 8 I2 = I2+1
2334- I22 = I222
2335- 9 IF (AI-A(I22)) 10,11,11
2336- 10 INDEX(I1) = I22
2337- I1 = I2
2338- GO TO 6
2339- 11 INDEX (I1) = I3
2340- GO TO 4
2341- 12 INDEX (1) = I3
2342- RETURN
2343- END
2344-* ========================================
2345- SUBROUTINE SORTTC (A,INDEX,N1)
2346-C
2347- INTEGER A,AI
2348- DIMENSION A(N1),INDEX(N1)
2349-C
2350- N = N1
2351- DO 3 I1=2,N
2352- I3 = I1
2353- I33 = INDEX(I3)
2354- AI = A(I33)
2355- 1 I2 = I3/2
2356- IF (I2) 3,3,2
2357- 2 I22 = INDEX(I2)
2358- IF(ICMPCH(AI,A(I22)))3,3,21
2359- 21 INDEX (I3) = I22
2360- I3 = I2
2361- GO TO 1
2362- 3 INDEX (I3) = I33
2363- 4 I3 = INDEX (N)
2364- INDEX (N) = INDEX (1)
2365- AI = A(I3)
2366- N = N-1
2367- IF (N-1) 12,12,5
2368- 5 I1 = 1
2369- 6 I2 = I1 + I1
2370- IF (I2.LE.N) I22= INDEX(I2)
2371- IF (I2-N) 7,9,11
2372- 7 I222 = INDEX (I2+1)
2373- IF (ICMPCH(A(I22),A(I222))) 8,9,9
2374- 8 I2 = I2+1
2375- I22 = I222
2376- 9 IF (ICMPCH(AI,A(I22))) 10,11,11
2377- 10 INDEX(I1) = I22
2378- I1 = I2
2379- GO TO 6
2380- 11 INDEX (I1) = I3
2381- GO TO 4
2382- 12 INDEX (1) = I3
2383- RETURN
2384- END
2385-* ========================================
2386- FUNCTION ICMPCH(IC1,IC2)
2387-C FUNCTION TO COMPARE TWO 4 CHARACTER EBCDIC STRINGS - IC1,IC2
2388-C ICMPCH=-1 IF HEX VALUE OF IC1 IS LESS THAN IC2
2389-C ICMPCH=0 IF HEX VALUES OF IC1 AND IC2 ARE THE SAME
2390-C ICMPCH=+1 IF HEX VALUES OF IC1 IS GREATER THAN IC2
2391- I1=IC1
2392- I2=IC2
2393- IF(I1.GE.0.AND.I2.GE.0)GOTO 40
2394- IF(I1.GE.0)GOTO 60
2395- IF(I2.GE.0)GOTO 80
2396- I1=-I1
2397- I2=-I2
2398- IF(I1-I2)80,70,60
2399- 40 IF(I1-I2)60,70,80
2400- 60 ICMPCH=-1
2401- RETURN
2402- 70 ICMPCH=0
2403- RETURN
2404- 80 ICMPCH=1
2405- RETURN
2406- END
2407-
2408+ logical function pass_point(p)
2409+c************************************************************************
2410+c This function is called from sample to see if it needs to
2411+c bother calculating the weight from all the different conficurations
2412+c You can either just return true, or have it call passcuts
2413+c************************************************************************
2414+ implicit none
2415+c
2416+c Arguments
2417+c
2418+ double precision p
2419+c
2420+c External
2421+c
2422+ logical passcuts
2423+ external passcuts
2424+c-----
2425+c Begin Code
2426+c-----
2427+ pass_point = .true.
2428+c pass_point = passcuts(p)
2429+ end
2430+C
2431+ LOGICAL FUNCTION PASSCUTS(P)
2432+C**************************************************************************
2433+C INPUT:
2434+C P(0:3,1) MOMENTUM OF INCOMING PARTON
2435+C P(0:3,2) MOMENTUM OF INCOMING PARTON
2436+C P(0:3,3) MOMENTUM OF ...
2437+C ALL MOMENTA ARE IN THE REST FRAME!!
2438+C COMMON/JETCUTS/ CUTS ON JETS
2439+C OUTPUT:
2440+C TRUE IF EVENTS PASSES ALL CUTS LISTED
2441+C**************************************************************************
2442+ IMPLICIT NONE
2443+c
2444+c Constants
2445+c
2446+ include 'genps.inc'
2447+ include 'nexternal.inc'
2448+C
2449+C ARGUMENTS
2450+C
2451+ REAL*8 P(0:3,nexternal)
2452+
2453+C
2454+C LOCAL
2455+C
2456+ LOGICAL FIRSTTIME,FIRSTTIME2,pass_bw,notgood,good,foundheavy
2457+ LOGICAL DEBUG
2458+ integer i,j,njets,nheavyjets,nleptons,hardj1,hardj2
2459+ REAL*8 XVAR,ptmax1,ptmax2,htj,tmp,inclht
2460+ real*8 ptemp(0:3), ptemp2(0:3)
2461+ character*20 formstr
2462+C
2463+C PARAMETERS
2464+C
2465+ real*8 PI
2466+ parameter( PI = 3.14159265358979323846d0 )
2467+C
2468+C EXTERNAL
2469+C
2470+ REAL*8 R2,DOT,ET,RAP,DJ,SumDot,pt,ALPHAS,PtDot
2471+ logical cut_bw,setclscales
2472+ external R2,DOT,ET,RAP,DJ,SumDot,pt,ALPHAS,cut_bw,setclscales,PtDot
2473+C
2474+C GLOBAL
2475+C
2476+ include 'run.inc'
2477+ include 'cuts.inc'
2478+
2479+ double precision ptjet(nexternal)
2480+ double precision ptheavyjet(nexternal)
2481+ double precision ptlepton(nexternal)
2482+ double precision temp
2483+
2484+C VARIABLES TO SPECIFY JETS
2485+ DOUBLE PRECISION PJET(NEXTERNAL,0:3)
2486+ DOUBLE PRECISION PTMIN
2487+ DOUBLE PRECISION PT1,PT2
2488+
2489+C INTEGERS FOR COUNTING.
2490+ INTEGER K,L,J1,J2
2491+
2492+C VARIABLES FOR KT CUT
2493+ DOUBLE PRECISION PTNOW,COSTH,PABS1,PABS2
2494+ DOUBLE PRECISION ETA1,ETA2,COSH_DETA,COS_DPHI,KT1SQ,KT2SQ, DPHI
2495+
2496+ double precision etmin(nincoming+1:nexternal),etamax(nincoming+1:nexternal)
2497+ double precision emin(nincoming+1:nexternal)
2498+ double precision r2min(nincoming+1:nexternal,nincoming+1:nexternal)
2499+ double precision s_min(nexternal,nexternal)
2500+ double precision etmax(nincoming+1:nexternal),etamin(nincoming+1:nexternal)
2501+ double precision emax(nincoming+1:nexternal)
2502+ double precision r2max(nincoming+1:nexternal,nincoming+1:nexternal)
2503+ double precision s_max(nexternal,nexternal)
2504+ double precision ptll_min(nexternal,nexternal),ptll_max(nexternal,nexternal)
2505+ double precision inclHtmin,inclHtmax
2506+ common/to_cuts/ etmin, emin, etamax, r2min, s_min,
2507+ $ etmax, emax, etamin, r2max, s_max, ptll_min, ptll_max, inclHtmin,inclHtmax
2508+
2509+ double precision ptjmin4(4),ptjmax4(4),htjmin4(2:4),htjmax4(2:4)
2510+ logical jetor
2511+ common/to_jet_cuts/ ptjmin4,ptjmax4,htjmin4,htjmax4,jetor
2512+
2513+ double precision ptlmin4(4),ptlmax4(4)
2514+ common/to_lepton_cuts/ ptlmin4,ptlmax4
2515+
2516+c
2517+c Special cuts
2518+c
2519+
2520+ integer lbw(0:nexternal) !Use of B.W.
2521+ common /to_BW/ lbw
2522+C
2523+C SPECIAL CUTS
2524+C
2525+ LOGICAL IS_A_J(NEXTERNAL),IS_A_L(NEXTERNAL)
2526+ LOGICAL IS_A_B(NEXTERNAL),IS_A_A(NEXTERNAL),IS_A_ONIUM(NEXTERNAL)
2527+ LOGICAL IS_A_NU(NEXTERNAL),IS_HEAVY(NEXTERNAL)
2528+ logical do_cuts(nexternal)
2529+ COMMON /TO_SPECISA/IS_A_J,IS_A_A,IS_A_L,IS_A_B,IS_A_NU,IS_HEAVY,
2530+ . IS_A_ONIUM, do_cuts
2531+
2532+C
2533+C MERGING SCALE CUT
2534+C
2535+C Retrieve which external particles undergo the ktdurham and ptlund cuts.
2536+ LOGICAL is_pdg_for_merging_cut(NEXTERNAL)
2537+ logical from_decay(-(nexternal+3):nexternal)
2538+ COMMON /TO_MERGE_CUTS/is_pdg_for_merging_cut, from_decay
2539+
2540+C
2541+C ADDITIONAL VARIABLES FOR PTLUND CUT
2542+C
2543+ INTEGER NMASSLESS
2544+ DOUBLE PRECISION PINC(NINCOMING,0:3)
2545+ DOUBLE PRECISION PRADTEMP(0:3), PRECTEMP(0:3), PEMTTEMP(0:3)
2546+ DOUBLE PRECISION PTMINSAVE, RHOPYTHIA
2547+ EXTERNAL RHOPYTHIA
2548+C
2549+C FLAVOUR INFORMATION NECESSARY TO RECONSTRUCT PTLUND
2550+C
2551+ INTEGER JETFLAVOUR(NEXTERNAL), INCFLAVOUR(NINCOMING)
2552+ include 'maxamps.inc'
2553+ integer idup(nexternal,maxproc,maxsproc)
2554+ integer mothup(2,nexternal)
2555+ integer icolup(2,nexternal,maxflow,maxsproc)
2556+ include 'leshouche.inc'
2557+
2558+C
2559+C Keep track of whether cuts already calculated for this event
2560+C
2561+ LOGICAL CUTSDONE,CUTSPASSED
2562+ COMMON/TO_CUTSDONE/CUTSDONE,CUTSPASSED
2563+ DATA CUTSDONE,CUTSPASSED/.FALSE.,.FALSE./
2564+
2565+C $B$ MW_NEW_DEF $E$ !this is a tag for MadWeight
2566+
2567+ double precision xqcutij(nexternal,nexternal),xqcuti(nexternal)
2568+ common/to_xqcuts/xqcutij,xqcuti
2569+
2570+c jet cluster algorithm
2571+ integer nQCD !,NJET,JET(nexternal)
2572+c double precision plab(0:3, nexternal)
2573+ double precision pQCD(0:3,nexternal)!,PJET(0:3,nexternal)
2574+c double precision rfj,sycut,palg,fastjetdmerge
2575+c integer njet_eta
2576+c Photon isolation
2577+ integer nph,nem,nin
2578+ double precision ptg,chi_gamma_iso,iso_getdrv40
2579+ double precision Etsum(0:nexternal)
2580+ real drlist(nexternal)
2581+ double precision pgamma(0:3,nexternal),pem(0:3,nexternal)
2582+ logical alliso
2583+C Sort array of results: ismode>0 for real, isway=0 for ascending order
2584+ integer ismode,isway,izero,isorted(nexternal)
2585+ parameter (ismode=1)
2586+ parameter (isway=0)
2587+ parameter (izero=0)
2588+
2589+ include 'coupl.inc'
2590+
2591+C
2592+C
2593+c
2594+ DATA FIRSTTIME,FIRSTTIME2/.TRUE.,.TRUE./
2595+
2596+c put momenta in common block for couplings.f
2597+ double precision pp(0:3,max_particles)
2598+ common /momenta_pp/pp
2599+
2600+ DATA DEBUG/.FALSE./
2601+
2602+C-----
2603+C BEGIN CODE
2604+C-----
2605+
2606+
2607+
2608+ PASSCUTS=.TRUE. !EVENT IS OK UNLESS OTHERWISE CHANGED
2609+ IF (FIRSTTIME) THEN
2610+ FIRSTTIME=.FALSE.
2611+c Preparation for reweighting by setting up clustering by diagrams
2612+ call initcluster()
2613+c
2614+c
2615+ write(formstr,'(a,i2.2,a)')'(a10,',nexternal,'i8)'
2616+ write(*,formstr) 'Particle',(i,i=nincoming+1,nexternal)
2617+ write(formstr,'(a,i2.2,a)')'(a10,',nexternal,'f8.1)'
2618+ write(*,formstr) 'Et >',(etmin(i),i=nincoming+1,nexternal)
2619+ write(*,formstr) 'E >',(emin(i),i=nincoming+1,nexternal)
2620+ write(*,formstr) 'Eta <',(etamax(i),i=nincoming+1,nexternal)
2621+ write(*,formstr) 'xqcut: ',(xqcuti(i),i=nincoming+1,nexternal)
2622+ write(formstr,'(a,i2.2,a)')'(a,i2,a,',nexternal,'f8.1)'
2623+ do j=nincoming+1,nexternal-1
2624+ write(*,formstr) 'd R #',j,' >',(-0.0,i=nincoming+1,j),
2625+ & (r2min(i,j),i=j+1,nexternal)
2626+ do i=j+1,nexternal
2627+ r2min(i,j)=r2min(i,j)*dabs(r2min(i,j)) !Since r2 returns distance squared
2628+ r2max(i,j)=r2max(i,j)*dabs(r2max(i,j))
2629+ enddo
2630+ enddo
2631+ do j=nincoming+1,nexternal-1
2632+ write(*,formstr) 's min #',j,'>',
2633+ & (s_min(i,j),i=nincoming+1,nexternal)
2634+ enddo
2635+ do j=nincoming+1,nexternal-1
2636+ write(*,formstr) 'xqcutij #',j,'>',
2637+ & (xqcutij(i,j),i=nincoming+1,nexternal)
2638+ enddo
2639+
2640+cc
2641+cc Set the strong coupling
2642+cc
2643+c call set_ren_scale(P,scale)
2644+c
2645+cc Check that the user funtions for setting the scales
2646+cc have been edited if the choice of an event-by-event
2647+cc scale choice has been made
2648+c
2649+c if(.not.fixed_ren_scale) then
2650+c if(scale.eq.0d0) then
2651+c write(6,*)
2652+c write(6,*) '* >>>>>>>>>ERROR<<<<<<<<<<<<<<<<<<<<<<<*'
2653+c write(6,*) ' Dynamical renormalization scale choice '
2654+c write(6,*) ' selected but user subroutine'
2655+c write(6,*) ' set_ren_scale not edited in file:setpara.f'
2656+c write(6,*) ' Switching to a fixed_ren_scale choice'
2657+c write(6,*) ' with scale=zmass'
2658+c scale=91.2d0
2659+c write(6,*) 'scale=',scale
2660+c fixed_ren_scale=.true.
2661+c call set_ren_scale(P,scale)
2662+c endif
2663+c endif
2664+
2665+c if(.not.fixed_fac_scale) then
2666+c call set_fac_scale(P,q2fact)
2667+c if(q2fact(1).eq.0d0.or.q2fact(2).eq.0d0) then
2668+c write(6,*)
2669+c write(6,*) '* >>>>>>>>>ERROR<<<<<<<<<<<<<<<<<<<<<<<*'
2670+c write(6,*) ' Dynamical renormalization scale choice '
2671+c write(6,*) ' selected but user subroutine'
2672+c write(6,*) ' set_fac_scale not edited in file:setpara.f'
2673+c write(6,*) ' Switching to a fixed_fac_scale choice'
2674+c write(6,*) ' with q2fact(i)=zmass**2'
2675+c fixed_fac_scale=.true.
2676+c q2fact(1)=91.2d0**2
2677+c q2fact(2)=91.2d0**2
2678+c write(6,*) 'scales=',q2fact(1),q2fact(2)
2679+c endif
2680+c endif
2681+
2682+ if(fixed_ren_scale) then
2683+ G = SQRT(4d0*PI*ALPHAS(scale))
2684+ call update_as_param()
2685+ endif
2686+
2687+c Put momenta in the common block to zero to start
2688+ do i=0,3
2689+ do j=1,max_particles
2690+ pp(i,j) = 0d0
2691+ enddo
2692+ enddo
2693+
2694+ ENDIF ! IF FIRSTTIME
2695+
2696+ IF (CUTSDONE) THEN
2697+ PASSCUTS=CUTSPASSED
2698+ RETURN
2699+ ENDIF
2700+ CUTSDONE=.TRUE.
2701+c CUTSPASSED=.FALSE.
2702+
2703+c
2704+c Make sure have reasonable 4-momenta
2705+c
2706+ if (p(0,1) .le. 0d0) then
2707+ passcuts=.false.
2708+ return
2709+ endif
2710+
2711+c Also make sure there's no INF or NAN
2712+ do i=1,nexternal
2713+ do j=0,3
2714+ if(p(j,i).gt.1d32.or.p(j,i).ne.p(j,i))then
2715+ passcuts=.false.
2716+ return
2717+ endif
2718+ enddo
2719+ enddo
2720+
2721+c
2722+c Limit S_hat
2723+c
2724+c if (x1*x2*stot .gt. 500**2) then
2725+c passcuts=.false.
2726+c return
2727+c endif
2728+
2729+C $B$ DESACTIVATE_CUT $E$ !This is a tag for MadWeight
2730+
2731+ if(debug) write (*,*) '============================='
2732+ if(debug) write (*,*) ' EVENT STARTS TO BE CHECKED '
2733+ if(debug) write (*,*) '============================='
2734+c
2735+c p_t min & max cuts
2736+c
2737+ do i=nincoming+1,nexternal
2738+ if(debug) write (*,*) 'pt(',i,')=',pt(p(0,i)),' ',etmin(i),
2739+ $ ':',etmax(i)
2740+ notgood=(pt(p(0,i)) .lt. etmin(i)).or.
2741+ & (etmax(i).ge.0d0.and.pt(p(0,i)) .gt. etmax(i))
2742+ if (notgood) then
2743+ if(debug) write (*,*) i,' -> fails'
2744+ passcuts=.false.
2745+ return
2746+ endif
2747+ enddo
2748+c
2749+c missing ET min & max cut + Invariant mass of leptons and neutrino
2750+c nb: missing Et defined as the vector sum over the neutrino's pt
2751+c
2752+c-- reset ptemp(0:3)
2753+ do j=0,3
2754+ ptemp(j)=0 ! for the neutrino
2755+ ptemp2(j)=0 ! for the leptons
2756+ enddo
2757+c- sum over the momenta
2758+ do i=nincoming+1,nexternal
2759+ if(is_a_nu(i)) then
2760+ if(debug) write (*,*) i,' -> neutrino '
2761+ do j=0,3
2762+ ptemp(j)=ptemp(j)+p(j,i)
2763+ enddo
2764+ elseif(is_a_l(i)) then
2765+ if(debug) write (*,*) i,' -> lepton '
2766+ do j=0,3
2767+ ptemp2(j)=ptemp2(j)+p(j,i)
2768+ enddo
2769+ endif
2770+
2771+ enddo
2772+c- check the et
2773+ if(debug.and.ptemp(0).eq.0d0) write (*,*) 'No et miss in event'
2774+ if(debug.and.ptemp(0).gt.0d0) write (*,*) 'Et miss =',pt(ptemp(0)),' ',misset,':',missetmax
2775+ if(debug.and.ptemp2(0).eq.0d0) write (*,*) 'No leptons in event'
2776+ if(debug.and.ptemp(0).gt.0d0) write (*,*) 'Energy of leptons =',pt(ptemp2(0))
2777+ if(ptemp(0).gt.0d0) then
2778+ notgood=(pt(ptemp(0)) .lt. misset).or.
2779+ & (missetmax.ge.0d0.and.pt(ptemp(0)) .gt. missetmax)
2780+ if (notgood) then
2781+ if(debug) write (*,*) ' missing et cut -> fails'
2782+ passcuts=.false.
2783+ return
2784+ endif
2785+ endif
2786+ if (mmnl.gt.0d0.or.mmnlmax.ge.0d0)then
2787+ if(dsqrt(SumDot(ptemp,ptemp2,1d0)).lt.mmnl.or.mmnlmax.ge.0d0.and.dsqrt(SumDot(ptemp, ptemp2,1d0)).gt.mmnlmax) then
2788+ if(debug) write (*,*) 'lepton invariant mass -> fails'
2789+ passcuts=.false.
2790+ return
2791+ endif
2792+ endif
2793+c
2794+c pt cut on heavy particles
2795+c gives min(pt) for (at least) one heavy particle
2796+c
2797+ if(ptheavy.gt.0d0)then
2798+ passcuts=.false.
2799+ foundheavy=.false.
2800+ do i=nincoming+1,nexternal
2801+ if(is_heavy(i)) then
2802+ if(debug) write (*,*) i,' -> heavy '
2803+ foundheavy=.true.
2804+ if(pt(p(0,i)).gt.ptheavy) passcuts=.true.
2805+ endif
2806+ enddo
2807+
2808+ if(.not.passcuts.and.foundheavy)then
2809+ if(debug) write (*,*) ' heavy particle cut -> fails'
2810+ return
2811+ else
2812+ passcuts=.true.
2813+ endif
2814+ endif
2815+c
2816+c E min & max cuts
2817+c
2818+ do i=nincoming+1,nexternal
2819+ if(debug) write (*,*) 'p(0,',i,')=',p(0,i),' ',emin(i),':',emax(i)
2820+ notgood=(p(0,i) .le. emin(i)).or.
2821+ & (emax(i).ge.0d0 .and. p(0,i) .gt. emax(i))
2822+ if (notgood) then
2823+ if(debug) write (*,*) i,' -> fails'
2824+ passcuts=.false.
2825+ return
2826+ endif
2827+ enddo
2828+c
2829+c Rapidity min & max cuts
2830+c
2831+ do i=nincoming+1,nexternal
2832+ if(debug) write (*,*) 'abs(rap(',i,'))=',abs(rap(p(0,i))),' ',etamin(i),':',etamax(i)
2833+ notgood=(etamax(i).ge.0.and.abs(rap(p(0,i))) .gt. etamax(i)).or.
2834+ & (abs(rap(p(0,i))) .lt. etamin(i))
2835+ if (notgood) then
2836+ if(debug) write (*,*) i,' -> fails'
2837+ passcuts=.false.
2838+ return
2839+ endif
2840+ enddo
2841+c
2842+c DeltaR min & max cuts
2843+c
2844+ do i=nincoming+1,nexternal-1
2845+ do j=i+1,nexternal
2846+ if(debug) write (*,*) 'r2(',i, ',' ,j,')=',dsqrt(r2(p(0,i),p(0,j)))
2847+ if(debug) write (*,*) dsqrt(r2min(j,i)),dsqrt(r2max(j,i))
2848+ if(r2min(j,i).gt.0.or.r2max(j,i).ge.0d0) then
2849+ tmp=r2(p(0,i),p(0,j))
2850+ notgood=(tmp .lt. r2min(j,i)).or.
2851+ $ (r2max(j,i).ge.0d0 .and. tmp .gt. r2max(j,i))
2852+ if (notgood) then
2853+ if(debug) write (*,*) i,j,' -> fails'
2854+ passcuts=.false.
2855+ return
2856+ endif
2857+ endif
2858+ enddo
2859+ enddo
2860+
2861+
2862+c s-channel min & max pt of sum of 4-momenta
2863+c
2864+ do i=nincoming+1,nexternal-1
2865+ do j=i+1,nexternal
2866+ if(debug)write (*,*) 'ptll(',i,',',j,')=',PtDot(p(0,i),p(0,j))
2867+ if(debug)write (*,*) ptll_min(j,i),ptll_max(j,i)
2868+ if(ptll_min(j,i).gt.0.or.ptll_max(j,i).ge.0d0) then
2869+ tmp=PtDot(p(0,i),p(0,j))
2870+ notgood=(tmp .lt. ptll_min(j,i).or.
2871+ $ ptll_max(j,i).ge.0d0 .and. tmp.gt.ptll_max(j,i))
2872+ if (notgood) then
2873+ if(debug) write (*,*) i,j,' -> fails'
2874+ passcuts=.false.
2875+ return
2876+ endif
2877+ endif
2878+ enddo
2879+ enddo
2880+
2881+
2882+
2883+
2884+c
2885+c s-channel min & max invariant mass cuts
2886+c
2887+ do i=nincoming+1,nexternal-1
2888+ do j=i+1,nexternal
2889+ if(debug) write (*,*) 's(',i,',',j,')=',Sumdot(p(0,i),p(0,j),+1d0)
2890+ if(debug) write (*,*) s_min(j,i),s_max(j,i)
2891+ if(s_min(j,i).gt.0.or.s_max(j,i).ge.0d0) then
2892+ tmp=SumDot(p(0,i),p(0,j),+1d0)
2893+ if(s_min(j,i).le.s_max(j,i) .or. s_max(j,i).lt.0d0)then
2894+ notgood=(tmp .lt. s_min(j,i).or.
2895+ $ s_max(j,i).ge.0d0 .and. tmp .gt. s_max(j,i))
2896+ if (notgood) then
2897+ if(debug) write (*,*) i,j,' -> fails'
2898+ passcuts=.false.
2899+ return
2900+ endif
2901+ else
2902+ notgood=(tmp .lt. s_min(j,i).and.tmp .gt. s_max(j,i))
2903+ if (notgood) then
2904+ if(debug) write (*,*) i,j,' -> fails'
2905+ passcuts=.false.
2906+ return
2907+ endif
2908+ endif
2909+ endif
2910+ enddo
2911+ enddo
2912+C $B$DESACTIVATE_BW_CUT$B$ This is a Tag for MadWeight
2913+c
2914+c B.W. phase space cuts
2915+c
2916+ pass_bw=cut_bw(p)
2917+c JA 4/8/11 always check pass_bw
2918+ if ( pass_bw.and..not.CUTSPASSED) then
2919+ passcuts=.false.
2920+ if(debug) write (*,*) ' pass_bw -> fails'
2921+ return
2922+ endif
2923+C $E$DESACTIVATE_BW_CUT$E$ This is a Tag for MadWeight
2924+ CUTSPASSED=.FALSE.
2925+C
2926+C maximal and minimal pt of the jets sorted by pt
2927+c
2928+ njets=0
2929+ nheavyjets=0
2930+
2931+c- fill ptjet with the pt's of the jets.
2932+ do i=nincoming+1,nexternal
2933+ if(is_a_j(i)) then
2934+ njets=njets+1
2935+ ptjet(njets)=pt(p(0,i))
2936+ endif
2937+ if(is_a_b(i)) then
2938+ nheavyjets=nheavyjets+1
2939+ ptheavyjet(nheavyjets)=pt(p(0,i))
2940+ endif
2941+
2942+ enddo
2943+ if(debug) write (*,*) 'not yet ordered ',njets,' ',ptjet
2944+
2945+C----------------------------------------------------------------------------
2946+C DURHAM_KT CUT
2947+C----------------------------------------------------------------------------
2948+
2949+ IF ( KT_DURHAM .GT. 0D0) THEN
2950+
2951+C RESET JET MOMENTA
2952+ njets=0
2953+ DO I=1,NEXTERNAL
2954+ DO J=0,3
2955+ PJET(I,J) = 0D0
2956+ ENDDO
2957+ ENDDO
2958+
2959+ do i=nincoming+1,nexternal
2960+ if(is_pdg_for_merging_cut(i) .and. .not. from_decay(I) ) then
2961+ njets=njets+1
2962+ DO J=0,3
2963+ PJET(NJETS,J) = P(J,I)
2964+ ENDDO
2965+ endif
2966+ enddo
2967+
2968+C COUNT NUMBER OF MASSLESS OUTGOING PARTICLES, SINCE WE DO NOT WANT
2969+C TO APPLY A CUT FOR JUST A SINGLE MASSIVE PARTICLE IN THE FINAL STATE.
2970+ NMASSLESS = 0
2971+ DO I=NINCOMING+1,NEXTERNAL
2972+ if(is_pdg_for_merging_cut(i) .and. .not. from_decay(I) .and.
2973+ & DSQRT(DOT( P(0,I), P(0,I))) .LT. 5D0) THEN
2974+ NMASSLESS = NMASSLESS + 1
2975+ ENDIF
2976+ ENDDO
2977+
2978+C DURHAM KT SEPARATION CUT
2979+ IF(NJETS.GT.0 .AND. NMASSLESS .GT. 0) THEN
2980+
2981+ PTMIN = EBEAM(1) + EBEAM(2)
2982+
2983+ DO I=1,NJETS
2984+
2985+C PT WITH RESPECT TO Z AXIS FOR HADRONIC COLLISIONS
2986+ IF ( (LPP(1).NE.0) .OR. (LPP(2).NE.0)) THEN
2987+ PT1 = DSQRT(PJET(I,1)**2 + PJET(I,2)**2)
2988+ PTMIN = MIN( PTMIN, PT1 )
2989+ ENDIF
2990+
2991+ DO J=I+1,NJETS
2992+C GET ANGLE BETWEEN JETS
2993+ PABS1 = DSQRT(PJET(I,1)**2 + PJET(I,2)**2 + PJET(I,3)**2)
2994+ PABS2 = DSQRT(PJET(J,1)**2 + PJET(J,2)**2 + PJET(J,3)**2)
2995+C CHECK IF 3-MOMENTA DO NOT VANISH
2996+ IF(PABS1*PABS2 .NE. 0D0) THEN
2997+ COSTH = ( PJET(I,1)*PJET(J,1) + PJET(I,2)*PJET(J,2) + PJET(I,3)*PJET(J,3) )/(PABS1*PABS2)
2998+ ELSE
2999+C IF 3-MOMENTA VANISH, MAKE JET COSTH = 1D0 SO THAT JET MEASURE VANISHES
3000+ COSTH = 1D0
3001+ ENDIF
3002+C GET PT AND ETA OF JETS
3003+ PT2 = DSQRT(PJET(J,1)**2 + PJET(J,2)**2)
3004+ ETA1 = 0.5D0*LOG( (PJET(I,0) + PJET(I,3)) / (PJET(I,0) - PJET(I,3)) )
3005+ ETA2 = 0.5D0*LOG( (PJET(J,0) + PJET(J,3)) / (PJET(J,0) - PJET(J,3)) )
3006+C GET COSH OF DELTA ETA, COS OF DELTA PHI
3007+ COSH_DETA = DCOSH( ETA1 - ETA2 )
3008+ COS_DPHI = ( PJET(I,1)*PJET(J,1) + PJET(I,2)*PJET(J,2) ) / (PT1*PT2)
3009+ DPHI = DACOS( COS_DPHI )
3010+ IF ( (LPP(1).EQ.0) .AND. (LPP(2).EQ.0)) THEN
3011+C KT FOR E+E- COLLISION
3012+ PTNOW = DSQRT( 2D0*MIN(PJET(I,0)**2,PJET(J,0)**2)*( 1D0-COSTH ) )
3013+ ELSE
3014+C HADRONIC KT, FASTJET DEFINITION
3015+ PTNOW = DSQRT( MIN(PT1**2,PT2**2)*( (ETA1 - ETA2 )**2 + DPHI**2 )/(D_PARAMETER**2) )
3016+ ENDIF
3017+
3018+ PTMIN = MIN( PTMIN, PTNOW )
3019+
3020+ ENDDO ! LOOP OVER NJET
3021+
3022+ ENDDO ! LOOP OVER NJET
3023+
3024+C CHECK COMPATIBILITY WITH CUT
3025+ IF( (PTMIN .LT. KT_DURHAM)) THEN
3026+ PASSCUTS = .FALSE.
3027+ RETURN
3028+ ENDIF
3029+
3030+ ENDIF ! IF NJETS.GT. 0
3031+
3032+ ENDIF ! KT_DURHAM .GT. 0D0
3033+
3034+C----------------------------------------------------------------------------
3035+C PTLUND CUT
3036+C----------------------------------------------------------------------------
3037+
3038+ IF(PT_LUND .GT. 0D0 ) THEN
3039+
3040+C Reset jet momenta
3041+ NJETS=0
3042+ DO I=1,NEXTERNAL
3043+ JETFLAVOUR(I) = 0
3044+ DO J=0,3
3045+ PJET(I,J) = 0D0
3046+ ENDDO
3047+ ENDDO
3048+
3049+C Fill incoming particle momenta
3050+ DO I=1,NINCOMING
3051+ INCFLAVOUR(I) = IDUP(I,1,1)
3052+ DO J=0,3
3053+ PINC(I,J) = P(J,I)
3054+ ENDDO
3055+ ENDDO
3056+
3057+C Fill final jet momenta
3058+ DO I=NINCOMING+1,NEXTERNAL
3059+ if(is_pdg_for_merging_cut(i) .and. .not. from_decay(I) ) then
3060+ NJETS=NJETS+1
3061+ JETFLAVOUR(NJETS) = IDUP(I,1,1)
3062+ DO J=0,3
3063+ PJET(NJETS,J) = P(J,I)
3064+ ENDDO
3065+ ENDIF
3066+ ENDDO
3067+
3068+C PROCESS WITH EXACTLY TWO MASSLESS OUTGOING PARTICLES IS SPECIAL
3069+C BECAUSE AN ENERGY-SHARING VARIABLE LIKE "Z" DOES NOT MAKE SENSE.
3070+C IN THIS CASE, ONLY APPLY MINIMAL pT W.R.T BEAM CUT.
3071+C THIS CUT WILL ONLY APPLY TO THE TWO-MASSLESS PARTICLE STATE.
3072+ NMASSLESS = 0
3073+ DO I=NINCOMING+1,NEXTERNAL
3074+ if(is_pdg_for_merging_cut(i) .and. .not. from_decay(I) .and.
3075+ & DSQRT(DOT( P(0,I), P(0,I))) .LT. 5D0) THEN
3076+ NMASSLESS = NMASSLESS + 1
3077+ ENDIF
3078+ ENDDO
3079+ IF (NMASSLESS .EQ. 2 .AND. NJETS .EQ. 2 .AND.
3080+ & NEXTERNAL-NINCOMING .EQ. 2) THEN
3081+ PTMINSAVE = EBEAM(1) + EBEAM(2)
3082+ DO I=NINCOMING+1,NEXTERNAL
3083+ if( .not. from_decay(I) ) then
3084+ PTMINSAVE = MIN(PTMINSAVE, PT(p(0,i)))
3085+ ENDIF
3086+ ENDDO
3087+C CHECK COMPATIBILITY WITH CUT
3088+ IF ( ((LPP(1).NE.0) .OR. (LPP(2).NE.0)) .AND.
3089+ & PTMINSAVE .LT. PT_LUND) THEN
3090+ PASSCUTS = .FALSE.
3091+ RETURN
3092+ ENDIF
3093+C RESET NJETS TO AVOID FURTHER MERGING SCALE CUT.
3094+ NJETS=0
3095+ ENDIF
3096+
3097+C PYTHIA PT SEPARATION CUT
3098+ IF(NJETS.GT.0 .AND. NMASSLESS .GT. 0) THEN
3099+
3100+ PTMINSAVE = EBEAM(1) + EBEAM(2)
3101+
3102+ DO I=1,NJETS
3103+
3104+ PTMIN = EBEAM(1) + EBEAM(2)
3105+ PTMINSAVE = MIN(PTMIN,PTMINSAVE)
3106+
3107+C Compute pythia ISR separation between i-jet and incoming.
3108+C Only SM-like emissions off the beam are possible.
3109+ IF ( ( (LPP(1).NE.0) .OR. (LPP(2).NE.0)) .AND.
3110+ & ABS(JETFLAVOUR(I)) .LT. 30 ) THEN
3111+C Check separation to first incoming particle
3112+ DO L=0,3
3113+ PRADTEMP(L) = PINC(1,L)
3114+ PEMTTEMP(L) = PJET(I,L)
3115+ PRECTEMP(L) = PINC(2,L)
3116+ ENDDO
3117+ PT1 = RHOPYTHIA(PRADTEMP, PEMTTEMP, PRECTEMP, INCFLAVOUR(1),
3118+ & JETFLAVOUR(I), -1, -1)
3119+ PTMIN = MIN( PTMIN, PT1 )
3120+C Check separation to second incoming particle
3121+ DO L=0,3
3122+ PRADTEMP(L) = PINC(2,L)
3123+ PEMTTEMP(L) = PJET(I,L)
3124+ PRECTEMP(L) = PINC(1,L)
3125+ ENDDO
3126+ PT2 = RHOPYTHIA(PRADTEMP, PEMTTEMP, PRECTEMP, INCFLAVOUR(2),
3127+ & JETFLAVOUR(I), -1, -1)
3128+ PTMIN = MIN( PTMIN, PT2 )
3129+ ENDIF
3130+
3131+C Compute pythia FSR separation between two jets,
3132+C without any knowledge of colour connections
3133+ DO J=1,NJETS
3134+ DO K=1,NJETS
3135+ IF ( I .NE. J .AND. I .NE. K .AND. J .NE. K ) THEN
3136+
3137+C Check separation between final partons i and j, with k as spectator
3138+ DO L=0,3
3139+ PRADTEMP(L) = PJET(J,L)
3140+ PEMTTEMP(L) = PJET(I,L)
3141+ PRECTEMP(L) = PJET(K,L)
3142+ ENDDO
3143+
3144+ TEMP = RHOPYTHIA( PRADTEMP, PEMTTEMP, PRECTEMP,
3145+ & JETFLAVOUR(J), JETFLAVOUR(I), 1, 1)
3146+C Only SM-like emissions off the beam are possible, no additional
3147+C BSM particles will be produced as as shower emissions.
3148+ IF ( ABS(JETFLAVOUR(I)) .LT. 30 ) THEN
3149+ PTMIN = MIN(PTMIN, TEMP);
3150+ ENDIF
3151+
3152+ TEMP = RHOPYTHIA( PEMTTEMP, PRADTEMP, PRECTEMP,
3153+ & JETFLAVOUR(I), JETFLAVOUR(J), 1, 1)
3154+C Only SM-like emissions off the beam are possible, no additional
3155+C BSM particles will be produced as as shower emissions.
3156+ IF ( ABS(JETFLAVOUR(J)) .LT. 30 ) THEN
3157+ PTMIN = MIN(PTMIN, TEMP);
3158+ ENDIF
3159+
3160+ ENDIF
3161+
3162+ ENDDO ! LOOP OVER NJET
3163+ ENDDO ! LOOP OVER NJET
3164+
3165+C Compute pythia FSR separation between two jets, with initial spectator
3166+ IF ( (LPP(1).NE.0) .OR. (LPP(2).NE.0)) THEN
3167+ DO J=1,NJETS
3168+
3169+C BSM particles can only be radiators, and will not be produced
3170+C as shower emissions.
3171+ IF ( ABS(JETFLAVOUR(I)) .GT. 1000000 ) THEN
3172+ EXIT
3173+ ENDIF
3174+
3175+C Allow both initial partons as recoiler
3176+ IF ( I .NE. J ) THEN
3177+
3178+C Check with first initial as recoiler
3179+ DO L=0,3
3180+ PRADTEMP(L) = PJET(J,L)
3181+ PEMTTEMP(L) = PJET(I,L)
3182+ PRECTEMP(L) = PINC(1,L)
3183+ ENDDO
3184+ TEMP = RHOPYTHIA( PRADTEMP, PEMTTEMP, PRECTEMP,
3185+ & JETFLAVOUR(J), JETFLAVOUR(I), 1, -1);
3186+ IF ( LPP(1) .NE. 0 ) THEN
3187+ PTMIN = MIN(PTMIN, TEMP);
3188+ ENDIF
3189+ DO L=0,3
3190+ PRADTEMP(L) = PJET(J,L)
3191+ PEMTTEMP(L) = PJET(I,L)
3192+ PRECTEMP(L) = PINC(2,L)
3193+ ENDDO
3194+ TEMP = RHOPYTHIA( PRADTEMP, PEMTTEMP, PRECTEMP,
3195+ & JETFLAVOUR(J), JETFLAVOUR(I), 1, -1);
3196+ IF ( LPP(2) .NE. 0 ) THEN
3197+ PTMIN = MIN(PTMIN, TEMP);
3198+ ENDIF
3199+ ENDIF
3200+ ENDDO ! LOOP OVER NJET
3201+ ENDIF
3202+
3203+ PTMINSAVE = MIN(PTMIN,PTMINSAVE)
3204+
3205+ ENDDO ! LOOP OVER NJET
3206+
3207+C CHECK COMPATIBILITY WITH CUT
3208+ IF (PTMINSAVE .LT. PT_LUND) THEN
3209+ PASSCUTS = .FALSE.
3210+ RETURN
3211+ ENDIF
3212+
3213+ ENDIF ! IF NJETS.GT. 0
3214+
3215+ ENDIF ! PT_LUND .GT. 0D0
3216+
3217+C----------------------------------------------------------------------------
3218+C----------------------------------------------------------------------------
3219+
3220+
3221+
3222+
3223+c- check existance of jets if jet cuts are on
3224+ if(njets.lt.1.and.(htjmin.gt.0.or.ptj1min.gt.0).or.
3225+ $ njets.lt.2.and.ptj2min.gt.0.or.
3226+ $ njets.lt.3.and.ptj3min.gt.0.or.
3227+ $ njets.lt.4.and.ptj4min.gt.0)then
3228+ if(debug) write (*,*) i, ' too few jets -> fails'
3229+ passcuts=.false.
3230+ return
3231+ endif
3232+
3233+c - sort jet pts
3234+ do i=1,njets-1
3235+ do j=i+1,njets
3236+ if(ptjet(j).gt.ptjet(i)) then
3237+ temp=ptjet(i)
3238+ ptjet(i)=ptjet(j)
3239+ ptjet(j)=temp
3240+ endif
3241+ enddo
3242+ enddo
3243+ if(debug) write (*,*) 'ordered ',njets,' ',ptjet
3244+c
3245+c Use "and" or "or" prescriptions
3246+c
3247+ inclht=0
3248+
3249+ if(njets.gt.0) then
3250+
3251+ notgood=.not.jetor
3252+ if(debug) write (*,*) 'jetor :',jetor
3253+ if(debug) write (*,*) '0',notgood
3254+
3255+ do i=1,min(njets,4)
3256+ if(debug) write (*,*) i,ptjet(i), ' ',ptjmin4(i),
3257+ $ ':',ptjmax4(i)
3258+ if(jetor) then
3259+c--- if one of the jets does not pass, the event is rejected
3260+ notgood=notgood.or.(ptjmax4(i).ge.0d0 .and.
3261+ $ ptjet(i).gt.ptjmax4(i)) .or.
3262+ $ (ptjet(i).lt.ptjmin4(i))
3263+ if(debug) write (*,*) i,' notgood total:', notgood
3264+ else
3265+c--- all cuts must fail to reject the event
3266+ notgood=notgood.and.(ptjmax4(i).ge.0d0 .and.
3267+ $ ptjet(i).gt.ptjmax4(i) .or.
3268+ $ (ptjet(i).lt.ptjmin4(i)))
3269+ if(debug) write (*,*) i,' notgood total:', notgood
3270+ endif
3271+ enddo
3272+
3273+
3274+ if (notgood) then
3275+ if(debug) write (*,*) i, ' multiple pt -> fails'
3276+ passcuts=.false.
3277+ return
3278+ endif
3279+
3280+c---------------------------
3281+c Ht cuts
3282+C---------------------------
3283+ htj=ptjet(1)
3284+
3285+ do i=2,njets
3286+ htj=htj+ptjet(i)
3287+ if(debug) write (*,*) i, 'htj ',htj
3288+ if(debug.and.i.le.4) write (*,*) 'htmin ',i,' ', htjmin4(i),':',htjmax4(i)
3289+ if(i.le.4)then
3290+ if(htj.lt.htjmin4(i) .or.
3291+ $ htjmax4(i).ge.0d0.and.htj.gt.htjmax4(i)) then
3292+ if(debug) write (*,*) i, ' ht -> fails'
3293+ passcuts=.false.
3294+ return
3295+ endif
3296+ endif
3297+ enddo
3298+
3299+ if(htj.lt.htjmin.or.htjmax.ge.0d0.and.htj.gt.htjmax)then
3300+ if(debug) write (*,*) i, ' htj -> fails'
3301+ passcuts=.false.
3302+ return
3303+ endif
3304+
3305+ inclht=htj
3306+
3307+ endif !if there are jets
3308+
3309+ if(nheavyjets.gt.0) then
3310+ do i=1,nheavyjets
3311+ inclht=inclht+ptheavyjet(i)
3312+ enddo
3313+ endif !if there are heavyjets
3314+
3315+ if(inclht.lt.inclHtmin.or.
3316+ $ inclHtmax.ge.0d0.and.inclht.gt.inclHtmax)then
3317+ if(debug) write (*,*) ' inclhtmin=',inclHtmin,' -> fails'
3318+ passcuts=.false.
3319+ return
3320+ endif
3321+
3322+C
3323+C maximal and minimal pt of the leptons sorted by pt
3324+c
3325+ nleptons=0
3326+
3327+ if(ptl1min.gt.0.or.ptl2min.gt.0.or.ptl3min.gt.0.or.ptl4min.gt.0.or.
3328+ $ ptl1max.ge.0d0.or.ptl2max.ge.0d0.or.
3329+ $ ptl3max.ge.0d0.or.ptl4max.ge.0d0) then
3330+
3331+c - fill ptlepton with the pt's of the leptons.
3332+ do i=nincoming+1,nexternal
3333+ if(is_a_l(i)) then
3334+ nleptons=nleptons+1
3335+ ptlepton(nleptons)=pt(p(0,i))
3336+ endif
3337+ enddo
3338+ if(debug) write (*,*) 'not yet ordered ',njets,' ',ptjet
3339+
3340+c - check existance of leptons if lepton cuts are on
3341+ if(nleptons.lt.1.and.ptl1min.gt.0.or.
3342+ $ nleptons.lt.2.and.ptl2min.gt.0.or.
3343+ $ nleptons.lt.3.and.ptl3min.gt.0.or.
3344+ $ nleptons.lt.4.and.ptl4min.gt.0)then
3345+ if(debug) write (*,*) i, ' too few leptons -> fails'
3346+ passcuts=.false.
3347+ return
3348+ endif
3349+
3350+c - sort lepton pts
3351+ do i=1,nleptons-1
3352+ do j=i+1,nleptons
3353+ if(ptlepton(j).gt.ptlepton(i)) then
3354+ temp=ptlepton(i)
3355+ ptlepton(i)=ptlepton(j)
3356+ ptlepton(j)=temp
3357+ endif
3358+ enddo
3359+ enddo
3360+ if(debug) write (*,*) 'ordered ',nleptons,' ',ptlepton
3361+
3362+ if(nleptons.gt.0) then
3363+
3364+ notgood = .false.
3365+ do i=1,min(nleptons,4)
3366+ if(debug) write (*,*) i,ptlepton(i), ' ',ptlmin4(i),':',ptlmax4(i)
3367+c--- if one of the leptons does not pass, the event is rejected
3368+ notgood=notgood.or.
3369+ $ (ptlmax4(i).ge.0d0.and.ptlepton(i).gt.ptlmax4(i)).or.
3370+ $ (ptlepton(i).lt.ptlmin4(i))
3371+ if(debug) write (*,*) i,' notgood total:', notgood
3372+ enddo
3373+
3374+
3375+ if (notgood) then
3376+ if(debug) write (*,*) i, ' multiple pt -> fails'
3377+ passcuts=.false.
3378+ return
3379+ endif
3380+ endif
3381+ endif
3382+C>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
3383+C SPECIAL CUTS
3384+C<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
3385+
3386+C REQUIRE AT LEAST ONE JET WITH PT>XPTJ
3387+
3388+ IF(xptj.gt.0d0) THEN
3389+ xvar=0
3390+ do i=nincoming+1,nexternal
3391+ if(is_a_j(i)) xvar=max(xvar,pt(p(0,i)))
3392+ enddo
3393+ if (xvar .lt. xptj) then
3394+ passcuts=.false.
3395+ return
3396+ endif
3397+ ENDIF
3398+
3399+C REQUIRE AT LEAST ONE PHOTON WITH PT>XPTA
3400+
3401+ IF(xpta.gt.0d0) THEN
3402+ xvar=0
3403+ do i=nincoming+1,nexternal
3404+ if(is_a_a(i)) xvar=max(xvar,pt(p(0,i)))
3405+ enddo
3406+ if (xvar .lt. xpta) then
3407+ passcuts=.false.
3408+ return
3409+ endif
3410+ ENDIF
3411+
3412+C REQUIRE AT LEAST ONE B WITH PT>XPTB
3413+
3414+ IF(xptb.gt.0d0) THEN
3415+ xvar=0
3416+ do i=nincoming+1,nexternal
3417+ if(is_a_b(i)) xvar=max(xvar,pt(p(0,i)))
3418+ enddo
3419+ if (xvar .lt. xptb) then
3420+ passcuts=.false.
3421+ return
3422+ endif
3423+ ENDIF
3424+
3425+C REQUIRE AT LEAST ONE LEPTON WITH PT>XPTL
3426+
3427+ IF(xptl.gt.0d0) THEN
3428+ xvar=0
3429+ do i=nincoming+1,nexternal
3430+ if(is_a_l(i)) xvar=max(xvar,pt(p(0,i)))
3431+ enddo
3432+ if (xvar .lt. xptl) then
3433+ passcuts=.false.
3434+ if(debug) write (*,*) ' xptl -> fails'
3435+ return
3436+ endif
3437+ ENDIF
3438+C
3439+C WBF CUTS: TWO TYPES
3440+C
3441+C FIRST TYPE: implemented by FM
3442+C
3443+C 1. FIND THE 2 HARDEST JETS
3444+C 2. REQUIRE |RAP(J)|>XETAMIN
3445+C 3. REQUIRE RAP(J1)*ETA(J2)<0
3446+C
3447+C SECOND TYPE : added by Simon de Visscher 1-08-2007
3448+C
3449+C 1. FIND THE 2 HARDEST JETS
3450+C 2. REQUIRE |RAP(J1)-RAP(J2)|>DELTAETA
3451+C 3. REQUIRE RAP(J1)*RAP(J2)<0
3452+C
3453+C
3454+ hardj1=0
3455+ hardj2=0
3456+ ptmax1=0d0
3457+ ptmax2=0d0
3458+
3459+C-- START IF AT LEAST ONE OF THE CUTS IS ACTIVATED
3460+
3461+ IF(XETAMIN.GT.0D0.OR.DELTAETA.GT.0D0) THEN
3462+
3463+C-- FIND THE HARDEST JETS
3464+
3465+ do i=nincoming+1,nexternal
3466+ if(is_a_j(i)) then
3467+c write (*,*) i,pt(p(0,i))
3468+ if(pt(p(0,i)).gt.ptmax1) then
3469+ hardj2=hardj1
3470+ ptmax2=ptmax1
3471+ hardj1=i
3472+ ptmax1=pt(p(0,i))
3473+ elseif(pt(p(0,i)).gt.ptmax2) then
3474+ hardj2=i
3475+ ptmax2=pt(p(0,i))
3476+ endif
3477+c write (*,*) hardj1,hardj2,ptmax1,ptmax2
3478+ endif
3479+ enddo
3480+
3481+ if (hardj2.eq.0) goto 21 ! bypass vbf cut since not enough jets
3482+
3483+C-- NOW APPLY THE CUT I
3484+
3485+ if (abs(rap(p(0,hardj1))) .lt. xetamin
3486+ & .or.abs(rap(p(0,hardj2))) .lt. xetamin
3487+ & .or.rap(p(0,hardj1))*rap(p(0,hardj2)) .gt.0d0) then
3488+ passcuts=.false.
3489+ return
3490+ endif
3491+
3492+
3493+C-- NOW APPLY THE CUT II
3494+
3495+ if (abs(rap(p(0,hardj1))-rap(p(0,hardj2))) .lt. deltaeta) then
3496+ passcuts=.false.
3497+ return
3498+ endif
3499+
3500+c write (*,*) hardj1,hardj2,rap(p(0,hardj1)),rap(p(0,hardj2))
3501+
3502+ ENDIF
3503+
3504+c Begin photon isolation
3505+c NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE
3506+c Use is made of parton cm frame momenta. If this must be
3507+c changed, pQCD used below must be redefined
3508+c NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE
3509+c If we do not require a mimimum jet energy, there's no need to apply
3510+c jet clustering and all that.
3511+ if (ptgmin.ne.0d0) then
3512+
3513+c Put all (light) QCD partons in momentum array for jet clustering.
3514+c From the run_card.dat, maxjetflavor defines if b quark should be
3515+c considered here (via the logical variable 'is_a_jet'). nQCD becomes
3516+c the number of (light) QCD partons at the real-emission level (i.e. one
3517+c more than the Born).
3518+
3519+ nQCD=0
3520+ do j=nincoming+1,nexternal
3521+ if (is_a_j(j)) then
3522+ nQCD=nQCD+1
3523+ do i=0,3
3524+ pQCD(i,nQCD)=p(i,j) ! Use C.o.M. frame momenta
3525+ enddo
3526+ endif
3527+ enddo
3528+
3529+ nph=0
3530+ do j=nincoming+1,nexternal
3531+ if (is_a_a(j)) then
3532+ nph=nph+1
3533+ do i=0,3
3534+ pgamma(i,nph)=p(i,j) ! Use C.o.M. frame momenta
3535+ enddo
3536+ endif
3537+ enddo
3538+ if(nph.eq.0) goto 444
3539+
3540+ if(isoEM)then
3541+ nem=nph
3542+ do k=1,nem
3543+ do i=0,3
3544+ pem(i,k)=pgamma(i,k)
3545+ enddo
3546+ enddo
3547+ do j=nincoming+1,nexternal
3548+ if (is_a_l(j)) then
3549+ nem=nem+1
3550+ do i=0,3
3551+ pem(i,nem)=p(i,j) ! Use C.o.M. frame momenta
3552+ enddo
3553+ endif
3554+ enddo
3555+ endif
3556+
3557+ alliso=.true.
3558+
3559+ j=0
3560+ dowhile(j.lt.nph.and.alliso)
3561+c Loop over all photons
3562+ j=j+1
3563+
3564+ ptg=pt(pgamma(0,j))
3565+ if(ptg.lt.ptgmin)then
3566+ passcuts=.false.
3567+ return
3568+ endif
3569+
3570+c Isolate from hadronic energy
3571+ do i=1,nQCD
3572+ drlist(i)=sngl(iso_getdrv40(pgamma(0,j),pQCD(0,i)))
3573+ enddo
3574+ call sortzv(drlist,isorted,nQCD,ismode,isway,izero)
3575+ Etsum(0)=0.d0
3576+ nin=0
3577+ do i=1,nQCD
3578+ if(dble(drlist(isorted(i))).le.R0gamma)then
3579+ nin=nin+1
3580+ Etsum(nin)=Etsum(nin-1)+pt(pQCD(0,isorted(i)))
3581+ endif
3582+ enddo
3583+ do i=1,nin
3584+ alliso=alliso .and.
3585+ # Etsum(i).le.chi_gamma_iso(dble(drlist(isorted(i))),
3586+ # R0gamma,xn,epsgamma,ptg)
3587+ enddo
3588+
3589+c Isolate from EM energy
3590+ if(isoEM.and.nem.gt.1)then
3591+ do i=1,nem
3592+ drlist(i)=sngl(iso_getdrv40(pgamma(0,j),pem(0,i)))
3593+ enddo
3594+ call sortzv(drlist,isorted,nem,ismode,isway,izero)
3595+c First of list must be the photon: check this, and drop it
3596+ if(isorted(1).ne.j.or.drlist(isorted(1)).gt.1.e-4)then
3597+ write(*,*)'Error #1 in photon isolation'
3598+ write(*,*)j,isorted(1),drlist(isorted(1))
3599+ stop
3600+ endif
3601+ Etsum(0)=0.d0
3602+ nin=0
3603+ do i=2,nem
3604+ if(dble(drlist(isorted(i))).le.R0gamma)then
3605+ nin=nin+1
3606+ Etsum(nin)=Etsum(nin-1)+pt(pem(0,isorted(i)))
3607+ endif
3608+ enddo
3609+ do i=1,nin
3610+ alliso=alliso .and.
3611+ # Etsum(i).le.chi_gamma_iso(dble(drlist(isorted(i))),
3612+ # R0gamma,xn,epsgamma,ptg)
3613+ enddo
3614+
3615+ endif
3616+
3617+c End of loop over photons
3618+ enddo
3619+
3620+ if(.not.alliso)then
3621+ passcuts=.false.
3622+ return
3623+ endif
3624+ endif
3625+
3626+ 444 continue
3627+c End photon isolation
3628+
3629+
3630+C...Set couplings if event passed cuts
3631+
3632+ 21 if(.not.fixed_ren_scale) then
3633+ call set_ren_scale(P,scale)
3634+ if(scale.gt.0) G = SQRT(4d0*PI*ALPHAS(scale))
3635+ endif
3636+
3637+ if(.not.fixed_fac_scale) then
3638+ call set_fac_scale(P,q2fact)
3639+ endif
3640+
3641+c
3642+c Here we cluster event and reset factorization and renormalization
3643+c scales on an event-by-event basis, as well as check xqcut for jets
3644+c
3645+c Note the following condition is the first line of setclscales
3646+c if(xqcut.gt.0d0.or.ickkw.gt.0.or.scale.eq.0.or.q2fact(1).eq.0)then
3647+c Do not duplicate it since some variable are set for syscalc in the fct
3648+ if(.not.setclscales(p))then
3649+ cutsdone=.false.
3650+ cutspassed=.false.
3651+ passcuts = .false.
3652+ if(debug) write (*,*) 'setclscales -> fails'
3653+ return
3654+ endif
3655+c endif
3656+
3657+c Set couplings in model files
3658+ if(.not.fixed_ren_scale.or..not.fixed_couplings) then
3659+ if (.not.fixed_couplings)then
3660+ do i=0,3
3661+ do j=1,nexternal
3662+ pp(i,j)=p(i,j)
3663+ enddo
3664+ enddo
3665+ endif
3666+ call update_as_param()
3667+ endif
3668+
3669+ IF (FIRSTTIME2) THEN
3670+ FIRSTTIME2=.FALSE.
3671+ write(6,*) 'alpha_s for scale ',scale,' is ', G**2/(16d0*atan(1d0))
3672+ ENDIF
3673+
3674+ if(debug) write (*,*) '============================='
3675+ if(debug) write (*,*) ' EVENT PASSED THE CUTS '
3676+ if(debug) write (*,*) '============================='
3677+
3678+ CUTSPASSED=.TRUE.
3679+
3680+ RETURN
3681+ END
3682+
3683+
3684+C
3685+C FUNCTION FOR ISOLATION
3686+C
3687+
3688+ function iso_getdrv40(p1,p2)
3689+ implicit none
3690+ real*8 iso_getdrv40,p1(0:3),p2(0:3)
3691+ real*8 iso_getdr
3692+c
3693+ iso_getdrv40=iso_getdr(p1(0),p1(1),p1(2),p1(3),
3694+ # p2(0),p2(1),p2(2),p2(3))
3695+ return
3696+ end
3697+
3698+
3699+ function iso_getdr(en1,ptx1,pty1,pl1,en2,ptx2,pty2,pl2)
3700+ implicit none
3701+ real*8 iso_getdr,en1,ptx1,pty1,pl1,en2,ptx2,pty2,pl2,deta,dphi,
3702+ # iso_getpseudorap,iso_getdelphi
3703+c
3704+ deta=iso_getpseudorap(en1,ptx1,pty1,pl1)-
3705+ # iso_getpseudorap(en2,ptx2,pty2,pl2)
3706+ dphi=iso_getdelphi(ptx1,pty1,ptx2,pty2)
3707+ iso_getdr=sqrt(dphi**2+deta**2)
3708+ return
3709+ end
3710+
3711+
3712+ function iso_getpseudorap(en,ptx,pty,pl)
3713+ implicit none
3714+ real*8 iso_getpseudorap,en,ptx,pty,pl,tiny,pt,eta,th
3715+ parameter (tiny=1.d-5)
3716+c
3717+ pt=sqrt(ptx**2+pty**2)
3718+ if(pt.lt.tiny.and.abs(pl).lt.tiny)then
3719+ eta=sign(1.d0,pl)*1.d8
3720+ else
3721+ th=atan2(pt,pl)
3722+ eta=-log(tan(th/2.d0))
3723+ endif
3724+ iso_getpseudorap=eta
3725+ return
3726+ end
3727+
3728+
3729+ function iso_getdelphi(ptx1,pty1,ptx2,pty2)
3730+ implicit none
3731+ real*8 iso_getdelphi,ptx1,pty1,ptx2,pty2,tiny,pt1,pt2,tmp
3732+ parameter (tiny=1.d-5)
3733+c
3734+ pt1=sqrt(ptx1**2+pty1**2)
3735+ pt2=sqrt(ptx2**2+pty2**2)
3736+ if(pt1.ne.0.d0.and.pt2.ne.0.d0)then
3737+ tmp=ptx1*ptx2+pty1*pty2
3738+ tmp=tmp/(pt1*pt2)
3739+ if(abs(tmp).gt.1.d0+tiny)then
3740+ write(*,*)'Cosine larger than 1'
3741+ stop
3742+ elseif(abs(tmp).ge.1.d0)then
3743+ tmp=sign(1.d0,tmp)
3744+ endif
3745+ tmp=acos(tmp)
3746+ else
3747+ tmp=1.d8
3748+ endif
3749+ iso_getdelphi=tmp
3750+ return
3751+ end
3752+
3753+ function chi_gamma_iso(dr,R0,xn,epsgamma,pTgamma)
3754+c Eq.(3.4) of Phys.Lett. B429 (1998) 369-374 [hep-ph/9801442]
3755+ implicit none
3756+ real*8 chi_gamma_iso,dr,R0,xn,epsgamma,pTgamma
3757+ real*8 tmp,axn
3758+c
3759+ axn=abs(xn)
3760+ tmp=epsgamma*pTgamma
3761+ if(axn.ne.0.d0)then
3762+ tmp=tmp*( (1-cos(dr))/(1-cos(R0)) )**axn
3763+ endif
3764+ chi_gamma_iso=tmp
3765+ return
3766+ end
3767+
3768+
3769+*
3770+* $Id: sortzv.F,v 1.1.1.1 1996/02/15 17:49:50 mclareni Exp $
3771+*
3772+* $Log: sortzv.F,v $
3773+* Revision 1.1.1.1 1996/02/15 17:49:50 mclareni
3774+* Kernlib
3775+*
3776+*
3777+c$$$#include "kerngen/pilot.h"
3778+ SUBROUTINE SORTZV (A,INDEX,N1,MODE,NWAY,NSORT)
3779+C
3780+C CERN PROGLIB# M101 SORTZV .VERSION KERNFOR 3.15 820113
3781+C ORIG. 02/10/75
3782+C
3783+ DIMENSION A(N1),INDEX(N1)
3784+C
3785+C
3786+ N = N1
3787+ IF (N.LE.0) RETURN
3788+ IF (NSORT.NE.0) GO TO 2
3789+ DO 1 I=1,N
3790+ 1 INDEX(I)=I
3791+C
3792+ 2 IF (N.EQ.1) RETURN
3793+ IF (MODE) 10,20,30
3794+ 10 CALL SORTTI (A,INDEX,N)
3795+ GO TO 40
3796+C
3797+ 20 CALL SORTTC(A,INDEX,N)
3798+ GO TO 40
3799+C
3800+ 30 CALL SORTTF (A,INDEX,N)
3801+C
3802+ 40 IF (NWAY.EQ.0) GO TO 50
3803+ N2 = N/2
3804+ DO 41 I=1,N2
3805+ ISWAP = INDEX(I)
3806+ K = N+1-I
3807+ INDEX(I) = INDEX(K)
3808+ 41 INDEX(K) = ISWAP
3809+ 50 RETURN
3810+ END
3811+* ========================================
3812+ SUBROUTINE SORTTF (A,INDEX,N1)
3813+C
3814+ DIMENSION A(N1),INDEX(N1)
3815+C
3816+ N = N1
3817+ DO 3 I1=2,N
3818+ I3 = I1
3819+ I33 = INDEX(I3)
3820+ AI = A(I33)
3821+ 1 I2 = I3/2
3822+ IF (I2) 3,3,2
3823+ 2 I22 = INDEX(I2)
3824+ IF (AI.LE.A (I22)) GO TO 3
3825+ INDEX (I3) = I22
3826+ I3 = I2
3827+ GO TO 1
3828+ 3 INDEX (I3) = I33
3829+ 4 I3 = INDEX (N)
3830+ INDEX (N) = INDEX (1)
3831+ AI = A(I3)
3832+ N = N-1
3833+ IF (N-1) 12,12,5
3834+ 5 I1 = 1
3835+ 6 I2 = I1 + I1
3836+ IF (I2.LE.N) I22= INDEX(I2)
3837+ IF (I2-N) 7,9,11
3838+ 7 I222 = INDEX (I2+1)
3839+ IF (A(I22)-A(I222)) 8,9,9
3840+ 8 I2 = I2+1
3841+ I22 = I222
3842+ 9 IF (AI-A(I22)) 10,11,11
3843+ 10 INDEX(I1) = I22
3844+ I1 = I2
3845+ GO TO 6
3846+ 11 INDEX (I1) = I3
3847+ GO TO 4
3848+ 12 INDEX (1) = I3
3849+ RETURN
3850+ END
3851+* ========================================
3852+ SUBROUTINE SORTTI (A,INDEX,N1)
3853+C
3854+ INTEGER A,AI
3855+ DIMENSION A(N1),INDEX(N1)
3856+C
3857+ N = N1
3858+ DO 3 I1=2,N
3859+ I3 = I1
3860+ I33 = INDEX(I3)
3861+ AI = A(I33)
3862+ 1 I2 = I3/2
3863+ IF (I2) 3,3,2
3864+ 2 I22 = INDEX(I2)
3865+ IF (AI.LE.A (I22)) GO TO 3
3866+ INDEX (I3) = I22
3867+ I3 = I2
3868+ GO TO 1
3869+ 3 INDEX (I3) = I33
3870+ 4 I3 = INDEX (N)
3871+ INDEX (N) = INDEX (1)
3872+ AI = A(I3)
3873+ N = N-1
3874+ IF (N-1) 12,12,5
3875+ 5 I1 = 1
3876+ 6 I2 = I1 + I1
3877+ IF (I2.LE.N) I22= INDEX(I2)
3878+ IF (I2-N) 7,9,11
3879+ 7 I222 = INDEX (I2+1)
3880+ IF (A(I22)-A(I222)) 8,9,9
3881+ 8 I2 = I2+1
3882+ I22 = I222
3883+ 9 IF (AI-A(I22)) 10,11,11
3884+ 10 INDEX(I1) = I22
3885+ I1 = I2
3886+ GO TO 6
3887+ 11 INDEX (I1) = I3
3888+ GO TO 4
3889+ 12 INDEX (1) = I3
3890+ RETURN
3891+ END
3892+* ========================================
3893+ SUBROUTINE SORTTC (A,INDEX,N1)
3894+C
3895+ INTEGER A,AI
3896+ DIMENSION A(N1),INDEX(N1)
3897+C
3898+ N = N1
3899+ DO 3 I1=2,N
3900+ I3 = I1
3901+ I33 = INDEX(I3)
3902+ AI = A(I33)
3903+ 1 I2 = I3/2
3904+ IF (I2) 3,3,2
3905+ 2 I22 = INDEX(I2)
3906+ IF(ICMPCH(AI,A(I22)))3,3,21
3907+ 21 INDEX (I3) = I22
3908+ I3 = I2
3909+ GO TO 1
3910+ 3 INDEX (I3) = I33
3911+ 4 I3 = INDEX (N)
3912+ INDEX (N) = INDEX (1)
3913+ AI = A(I3)
3914+ N = N-1
3915+ IF (N-1) 12,12,5
3916+ 5 I1 = 1
3917+ 6 I2 = I1 + I1
3918+ IF (I2.LE.N) I22= INDEX(I2)
3919+ IF (I2-N) 7,9,11
3920+ 7 I222 = INDEX (I2+1)
3921+ IF (ICMPCH(A(I22),A(I222))) 8,9,9
3922+ 8 I2 = I2+1
3923+ I22 = I222
3924+ 9 IF (ICMPCH(AI,A(I22))) 10,11,11
3925+ 10 INDEX(I1) = I22
3926+ I1 = I2
3927+ GO TO 6
3928+ 11 INDEX (I1) = I3
3929+ GO TO 4
3930+ 12 INDEX (1) = I3
3931+ RETURN
3932+ END
3933+* ========================================
3934+ FUNCTION ICMPCH(IC1,IC2)
3935+C FUNCTION TO COMPARE TWO 4 CHARACTER EBCDIC STRINGS - IC1,IC2
3936+C ICMPCH=-1 IF HEX VALUE OF IC1 IS LESS THAN IC2
3937+C ICMPCH=0 IF HEX VALUES OF IC1 AND IC2 ARE THE SAME
3938+C ICMPCH=+1 IF HEX VALUES OF IC1 IS GREATER THAN IC2
3939+ I1=IC1
3940+ I2=IC2
3941+ IF(I1.GE.0.AND.I2.GE.0)GOTO 40
3942+ IF(I1.GE.0)GOTO 60
3943+ IF(I2.GE.0)GOTO 80
3944+ I1=-I1
3945+ I2=-I2
3946+ IF(I1-I2)80,70,60
3947+ 40 IF(I1-I2)60,70,80
3948+ 60 ICMPCH=-1
3949+ RETURN
3950+ 70 ICMPCH=0
3951+ RETURN
3952+ 80 ICMPCH=1
3953+ RETURN
3954+ END
3955+
3956+c************************************************************************
3957+c Returns pTLund (i.e. the Pythia8 evolution variable) between two
3958+c particles with momenta prad and pemt with momentum prec as spectator
3959+c************************************************************************
3960+
3961+ DOUBLE PRECISION FUNCTION RHOPYTHIA(PRAD, PEMT, PREC, FLAVRAD,
3962+ & FLAVEMT, RADTYPE, RECTYPE)
3963+
3964+ IMPLICIT NONE
3965+c
3966+c Arguments
3967+c
3968+ DOUBLE PRECISION PRAD(0:3),PEMT(0:3), PREC(0:3)
3969+ INTEGER FLAVRAD, FLAVEMT, RADTYPE,RECTYPE
3970+c
3971+c Local
3972+c
3973+ DOUBLE PRECISION Q(0:3),SUM(0:3), qBR(0:3), qAR(0:3)
3974+ DOUBLE PRECISION Q2, m2Rad, m2Emt, m2Dip, qBR2, qAR2, x1, x2, z
3975+ DOUBLE PRECISION m2RadAft, m2EmtAft, m2Rec, m2RadBef, m2ar, rescale
3976+ DOUBLE PRECISION TEMP, lambda13, k1, k3, m2Final
3977+ DOUBLE PRECISION m0u, m0d, m0c, m0s, m0t, m0b, m0w, m0z, m0x
3978+ DOUBLE PRECISION PRECAFT(0:3)
3979+ INTEGER emtsign
3980+ INTEGER idRadBef
3981+ LOGICAL allowed
3982+
3983+c-----
3984+c Begin Code
3985+c-----
3986+
3987+C Set masses. Currently no way of getting those?
3988+ m0u = 0.0
3989+ m0d = 0.0
3990+ m0c = 1.5
3991+ m0s = 0.0
3992+ m0t = 172.5
3993+ m0w = 80.4
3994+ m0z = 91.188
3995+ m0x = 400.0
3996+
3997+C Store recoiler momentum (since FI splittings require recoiler
3998+C rescaling)
3999+ PRECAFT(0) = PREC(0)
4000+ PRECAFT(1) = PREC(1)
4001+ PRECAFT(2) = PREC(2)
4002+ PRECAFT(3) = PREC(3)
4003+C Get sign of emitted momentum
4004+ emtsign = 1
4005+ if(radtype .eq. -1) emtsign = -1
4006+
4007+C Get virtuality
4008+ Q(0) = pRad(0) + emtsign*pEmt(0)
4009+ Q(1) = pRad(1) + emtsign*pEmt(1)
4010+ Q(2) = pRad(2) + emtsign*pEmt(2)
4011+ Q(3) = pRad(3) + emtsign*pEmt(3)
4012+ Q2 = emtsign * ( Q(0)**2 - Q(1)**2 - Q(2)**2 - Q(3)**2 );
4013+
4014+C Reset allowed
4015+ allowed = .true.
4016+
4017+C Splitting not possible for negative virtuality.
4018+ if ( Q2 .lt. 0.0 ) allowed = .false.
4019+
4020+C Try to reconstruct flavour of radiator before emission.
4021+ idRadBef = 0
4022+C gluon radiation: idBef = idAft
4023+ if (abs(flavEmt) .eq. 21 .or. abs(flavEmt) .eq. 22 ) idRadBef=flavRad
4024+C final state gluon splitting: idBef = 21
4025+ if (radtype .eq. 1 .and. flavEmt .eq. -flavRad) idRadBef=21
4026+C final state quark -> gluon conversion
4027+ if (radtype .eq. 1 .and. abs(flavEmt) .lt. 10 .and. flavRad .eq. 21) idRadBef=flavEmt
4028+C initial state gluon splitting: idBef = -idEmt
4029+ if (radtype .eq. -1 .and. abs(flavEmt) .lt. 10 .and. flavRad .eq. 21) idRadBef=-flavEmt
4030+C initial state gluon -> quark conversion
4031+ if (radtype .eq. -1 .and. abs(flavEmt) .lt. 10 .and. flavRad .eq. flavEmt) idRadBef=21
4032+C W-boson radiation
4033+ if (flavEmt .eq. 24) idRadBef = flavRad+1
4034+ if (flavEmt .eq. -24) idRadBef = flavRad-1
4035+
4036+C Set particle masses.
4037+ m2RadAft = 0.0
4038+ m2EmtAft = 0.0
4039+ m2Rec = 0.0
4040+ m2RadBef = 0.0
4041+
4042+ m2RadAft = pRad(0)*pRad(0)-pRad(1)*pRad(1)-pRad(2)*pRad(2)-pRad(3)*pRad(3)
4043+ m2EmtAft = pEmt(0)*pEmt(0)-pEmt(1)*pEmt(1)-pEmt(2)*pEmt(2)-pEmt(3)*pEmt(3)
4044+ m2Rec = pRec(0)*pRec(0)-pRec(1)*pRec(1)-pRec(2)*pRec(2)-pRec(3)*pRec(3)
4045+
4046+ if (m2RadAft .lt. 1d-4) m2RadAft = 0.0
4047+ if (m2EmtAft .lt. 1d-4) m2EmtAft = 0.0
4048+ if (m2Rec .lt. 1d-4) m2Rec = 0.0
4049+
4050+ if (abs(flavRad) .ne. 21 .and. abs(flavRad) .ne. 22 .and.
4051+ & abs(flavEmt) .ne. 24 .and.
4052+ & abs(flavRad) .ne. abs(flavEmt)) then
4053+ m2RadBef = m2RadAft
4054+ else if (abs(flavEmt) .eq. 24) then
4055+ if (idRadBef .ne. 0) then
4056+ if( abs(idRadBef) .eq. 4 ) m2RadBef = m0c**2
4057+ if( abs(idRadBef) .eq. 5 ) m2RadBef = m0b**2
4058+ if( abs(idRadBef) .eq. 6 ) m2RadBef = m0t**2
4059+ if( abs(idRadBef) .eq. 9000001 ) m2RadBef = m0x**2
4060+ endif
4061+ else if (radtype .eq. -1) then
4062+ if (abs(flavRad) .eq. 21 .and. abs(flavEmt) .eq. 21) m2RadBef = m2EmtAft
4063+ endif
4064+
4065+C Calculate dipole mass for final-state radiation.
4066+ m2Final = 0.0
4067+ m2Final = m2Final + (pRad(0) + pRec(0) + pEmt(0))**2
4068+ m2Final = m2Final - (pRad(1) + pRec(1) + pEmt(1))**2
4069+ m2Final = m2Final - (pRad(2) + pRec(2) + pEmt(2))**2
4070+ m2Final = m2Final - (pRad(3) + pRec(3) + pEmt(3))**2
4071+
4072+C Final state splitting not possible for negative dipole mass.
4073+ if ( radtype .eq. 1 .and. m2Final .lt. 0.0 ) allowed = .false.
4074+
4075+C Rescale recoiler for final-intial splittings.
4076+ rescale = 1.0
4077+ if (radtype .eq. 1 .and. rectype .eq. -1) then
4078+ m2ar = m2Final - 2.0*Q2 + 2.0*m2RadBef
4079+ rescale = (1.0 - (Q2 - m2RadBef) / (m2ar-m2RadBef))
4080+ & /(1.0 + (Q2 - m2RadBef) / (m2ar-m2RadBef))
4081+ pRecAft(0) = pRecAft(0)*rescale
4082+ pRecAft(1) = pRecAft(1)*rescale
4083+ pRecAft(2) = pRecAft(2)*rescale
4084+ pRecAft(3) = pRecAft(3)*rescale
4085+ endif
4086+
4087+C Final-initial splitting not possible for negative rescaling.
4088+ if ( rescale .lt. 0.0 ) allowed = .false.
4089+
4090+C Construct dipole momentum for FSR.
4091+ sum(0) = pRad(0) + pRecAft(0) + pEmt(0)
4092+ sum(1) = pRad(1) + pRecAft(1) + pEmt(1)
4093+ sum(2) = pRad(2) + pRecAft(2) + pEmt(2)
4094+ sum(3) = pRad(3) + pRecAft(3) + pEmt(3)
4095+ m2Dip = sum(0)**2 - sum(1)**2 - sum(2)**2 - sum(3)**2
4096+
4097+C Construct 2->3 variables for FSR
4098+ x1 = 2. * ( sum(0)*pRad(0) - sum(1)*pRad(1)
4099+ & - sum(2)*pRad(2) - sum(3)*pRad(3) ) / m2Dip
4100+ x2 = 2. * ( sum(0)*pRecAft(0) - sum(1)*pRecAft(1)
4101+ & - sum(2)*pRecAft(2) - sum(3)*pRecAft(3) ) / m2Dip
4102+
4103+C Final state splitting not possible for ill-defined
4104+C 3-body-variables.
4105+ if ( radtype .eq. 1 .and. x1 .lt. 0.0 ) allowed = .false.
4106+ if ( radtype .eq. 1 .and. x1 .gt. 1.0 ) allowed = .false.
4107+ if ( radtype .eq. 1 .and. x2 .lt. 0.0 ) allowed = .false.
4108+ if ( radtype .eq. 1 .and. x2 .gt. 1.0 ) allowed = .false.
4109+
4110+C Auxiliary variables for massive FSR
4111+ lambda13 = DSQRT( (Q2 - m2RadAft - m2EmtAft )**2 - 4.0 * m2RadAft*m2EmtAft)
4112+ k1 = ( Q2 - lambda13 + (m2EmtAft - m2RadAft ) ) / ( 2.0 * Q2)
4113+ k3 = ( Q2 - lambda13 - (m2EmtAft - m2RadAft ) ) / ( 2.0 * Q2)
4114+
4115+C Construct momenta of dipole before/after splitting for ISR
4116+ qBR(0) = pRad(0) + pRec(0) - pEmt(0)
4117+ qBR(1) = pRad(1) + pRec(1) - pEmt(1)
4118+ qBR(2) = pRad(2) + pRec(2) - pEmt(2)
4119+ qBR(3) = pRad(3) + pRec(3) - pEmt(3)
4120+ qBR2 = qBR(0)**2 - qBR(1)**2 - qBR(2)**2 - qBR(3)**2
4121+
4122+ qAR(0) = pRad(0) + pRec(0)
4123+ qAR(1) = pRad(1) + pRec(1)
4124+ qAR(2) = pRad(2) + pRec(2)
4125+ qAR(3) = pRad(3) + pRec(3)
4126+ qAR2 = qAR(0)**2 - qAR(1)**2 - qAR(2)**2 - qAR(3)**2
4127+
4128+C Calculate z of splitting, different for FSR and ISR
4129+ z = 1.0 / (1.0 - k1 -k3) * ( x1 / (2.0-x2) - k3)
4130+ if(radtype .eq. -1 ) z = qBR2 / qAR2;
4131+
4132+C Splitting not possible for ill-defined energy sharing.
4133+ if ( z .lt. 0.0 .or. z .gt. 1.0 ) allowed = .false.
4134+
4135+C pT^2 = separation * virtuality (corrected with mass for FSR)
4136+ if (radtype .eq. 1) temp = z*(1-z)*(Q2 - m2RadBef)
4137+ if (radtype .eq. -1) temp = (1-z)*Q2
4138+
4139+C Check threshold in ISR
4140+ if (radtype .ne. 1) then
4141+ if ((abs(flavRad) .eq. 4 .or. abs(flavEmt) .eq. 4)
4142+ & .and. dsqrt(temp) .le. 2.0*m0c**2 ) temp = (1.-z)*(Q2+m0c**2)
4143+ if ((abs(flavRad) .eq. 5 .or. abs(flavEmt) .eq. 5)
4144+ & .and. dsqrt(temp) .le. 2.0*m0b**2 ) temp = (1.-z)*(Q2+m0b**2)
4145+ endif
4146+
4147+C Kinematically impossible splittings should not be included in the
4148+C pT definition!
4149+ if( .not. allowed) temp = 1d15
4150+
4151+ if(temp .lt. 0.0) temp = 0.0
4152+
4153+C Return pT
4154+ rhoPythia = dsqrt(temp);
4155+
4156+ RETURN
4157+ END
4158
4159=== modified file 'Template/LO/SubProcesses/makefile'
4160--- Template/LO/SubProcesses/makefile 2016-05-26 23:36:59 +0000
4161+++ Template/LO/SubProcesses/makefile 2016-08-23 01:19:18 +0000
4162@@ -1,6 +1,13 @@
4163 include ../../Source/make_opts
4164 FFLAGS+= -w
4165
4166+# Load additional dependencies of the bias module, if present
4167+ifeq (,$(wildcard ../bias_dependencies))
4168+BIASDEPENDENCIES =
4169+else
4170+include ../bias_dependencies
4171+endif
4172+
4173 # Definitions
4174
4175 LIBDIR = ../../lib/
4176@@ -17,9 +24,9 @@
4177 MADLOOP_LIB =
4178 endif
4179
4180-LINKLIBS = $(LINK_MADLOOP_LIB) $(LINK_LOOP_LIBS) -L../../lib/ -ldhelas -ldsample -lmodel -lgeneric -lpdf -lcernlib $(llhapdf)
4181+LINKLIBS = $(LINK_MADLOOP_LIB) $(LINK_LOOP_LIBS) -L../../lib/ -ldhelas -ldsample -lmodel -lgeneric -lpdf -lcernlib $(llhapdf) -lbias
4182
4183-LIBS = $(LIBDIR)libdhelas.$(libext) $(LIBDIR)libdsample.$(libext) $(LIBDIR)libgeneric.$(libext) $(LIBDIR)libpdf.$(libext) $(LIBDIR)libmodel.$(libext) $(LIBDIR)libcernlib.$(libext) $(MADLOOP_LIB) $(LOOP_LIBS)
4184+LIBS = $(LIBDIR)libbias.$(libext) $(LIBDIR)libdhelas.$(libext) $(LIBDIR)libdsample.$(libext) $(LIBDIR)libgeneric.$(libext) $(LIBDIR)libpdf.$(libext) $(LIBDIR)libmodel.$(libext) $(LIBDIR)libcernlib.$(libext) $(MADLOOP_LIB) $(LOOP_LIBS)
4185
4186 # Source files
4187
4188@@ -34,7 +41,7 @@
4189 # Binaries
4190
4191 $(PROG): $(PROCESS) auto_dsig.o $(LIBS)
4192- $(FC) -o $(PROG) $(PROCESS) $(LINKLIBS) $(LDFLAGS)
4193+ $(FC) -o $(PROG) $(PROCESS) $(LINKLIBS) $(LDFLAGS) $(BIASDEPENDENCIES)
4194
4195 gensym: $(SYMMETRY) configs.inc $(LIBDIR)libmodel.$(libext) $(LIBDIR)libgeneric.$(libext)
4196 $(FC) -o gensym $(SYMMETRY) -L../../lib/ -lmodel -lgeneric $(LDFLAGS)
4197
4198=== modified file 'Template/LO/SubProcesses/reweight.f'
4199--- Template/LO/SubProcesses/reweight.f 2016-06-07 09:33:55 +0000
4200+++ Template/LO/SubProcesses/reweight.f 2016-08-23 01:19:18 +0000
4201@@ -1087,7 +1087,53 @@
4202 endif
4203 return
4204 end
4205+
4206+ double precision function custom_bias(p, original_weight, numproc)
4207+c***********************************************************
4208+c Returns a bias weight as instructed by the bias module
4209+c***********************************************************
4210+ implicit none
4211+
4212+ include 'nexternal.inc'
4213+ include 'maxparticles.inc'
4214+ include 'run_config.inc'
4215+ include 'lhe_event_infos.inc'
4216+ include 'run.inc'
4217+
4218+ DOUBLE PRECISION P(0:3,NEXTERNAL)
4219+ integer numproc
4220+
4221+ double precision original_weight
4222+
4223+ double precision bias_weight
4224+ logical is_bias_dummy, requires_full_event_info
4225+ common/bias/bias_weight,is_bias_dummy,requires_full_event_info
4226+
4227
4228+C If the bias module necessitates the full event information
4229+C then we must call write_leshouches here already so as to set it.
4230+C The weight specified at this stage is irrelevant since we
4231+C use do_write_events set to .False.
4232+ AlreadySetInBiasModule = .False.
4233+ if (requires_full_event_info) then
4234+ call write_leshouche(p,-1.0d0,numproc,.False.)
4235+C Write the event in the string evt_record, part of the
4236+C lhe_event_info common block
4237+ event_record(:) = ''
4238+ call write_event_to_stream(event_record,pb(0,1),1.0d0,npart,
4239+ & jpart(1,1),ngroup,sscale,aaqcd,aaqed,buff,use_syst,
4240+ & s_buff, nclus, buffclus)
4241+ AlreadySetInBiasModule = .True.
4242+ else
4243+ AlreadySetInBiasModule = .False.
4244+ endif
4245+C Apply the bias weight. The default run_card entry 'None' for the
4246+c 'bias_weight' option will implement a constant bias_weight of 1.0 below.
4247+ call bias_wgt(p, original_weight, bias_weight)
4248+ custom_bias = bias_weight
4249+
4250+ end
4251+
4252 double precision function rewgt(p)
4253 c**************************************************
4254 c reweight the hard me according to ckkw
4255
4256=== modified file 'Template/LO/SubProcesses/setcuts.f'
4257--- Template/LO/SubProcesses/setcuts.f 2016-06-16 15:03:59 +0000
4258+++ Template/LO/SubProcesses/setcuts.f 2016-08-23 01:19:18 +0000
4259@@ -81,6 +81,11 @@
4260 logical do_cuts(nexternal)
4261 COMMON /TO_SPECISA/IS_A_J,IS_A_A,IS_A_L,IS_A_B,IS_A_NU,IS_HEAVY,
4262 . IS_A_ONIUM, do_cuts
4263+
4264+c Store which external particles undergo the ktdurham and ptlund cuts.
4265+ LOGICAL is_pdg_for_merging_cut(NEXTERNAL)
4266+ COMMON /TO_MERGE_CUTS/is_pdg_for_merging_cut, from_decay
4267+
4268 c
4269 c
4270 c reading parameters
4271@@ -228,55 +233,16 @@
4272 if (abs(idup(i,1,iproc)).eq.16) is_a_nu(i)=.true. ! no cuts on vt vt~
4273 if (pmass(i).gt.10d0) is_heavy(i)=.true. ! heavy fs particle
4274 c-onium
4275-c if (idup(i,1,iproc).eq.441) is_a_onium(i)=.true. ! charmonium
4276-c if (idup(i,1,iproc).eq.10441) is_a_onium(i)=.true. ! charmonium
4277-c if (idup(i,1,iproc).eq.100441) is_a_onium(i)=.true. ! charmonium
4278-c if (idup(i,1,iproc).eq.443) is_a_onium(i)=.true. ! charmonium
4279-c if (idup(i,1,iproc).eq.10443) is_a_onium(i)=.true. ! charmonium
4280-c if (idup(i,1,iproc).eq.20443) is_a_onium(i)=.true. ! charmonium
4281-c if (idup(i,1,iproc).eq.100443) is_a_onium(i)=.true. ! charmonium
4282-c if (idup(i,1,iproc).eq.30443) is_a_onium(i)=.true. ! charmonium
4283-c if (idup(i,1,iproc).eq.9000443) is_a_onium(i)=.true. ! charmonium
4284-c if (idup(i,1,iproc).eq.9010443) is_a_onium(i)=.true. ! charmonium
4285-c if (idup(i,1,iproc).eq.9020443) is_a_onium(i)=.true. ! charmonium
4286-c if (idup(i,1,iproc).eq.445) is_a_onium(i)=.true. ! charmonium
4287-c if (idup(i,1,iproc).eq.9000445) is_a_onium(i)=.true. ! charmonium
4288-
4289-c if (idup(i,1,iproc).eq.551) is_a_onium(i)=.true. ! bottomonium
4290-c if (idup(i,1,iproc).eq.10551) is_a_onium(i)=.true. ! bottomonium
4291-c if (idup(i,1,iproc).eq.100551) is_a_onium(i)=.true. ! bottomonium
4292-c if (idup(i,1,iproc).eq.110551) is_a_onium(i)=.true. ! bottomonium
4293-c if (idup(i,1,iproc).eq.200551) is_a_onium(i)=.true. ! bottomonium
4294-c if (idup(i,1,iproc).eq.210551) is_a_onium(i)=.true. ! bottomonium
4295-c if (idup(i,1,iproc).eq.553) is_a_onium(i)=.true. ! bottomonium
4296-c if (idup(i,1,iproc).eq.10553) is_a_onium(i)=.true. ! bottomonium
4297-c if (idup(i,1,iproc).eq.20553) is_a_onium(i)=.true. ! bottomonium
4298-c if (idup(i,1,iproc).eq.30553) is_a_onium(i)=.true. ! bottomonium
4299-c if (idup(i,1,iproc).eq.100553) is_a_onium(i)=.true. ! bottomonium
4300-c if (idup(i,1,iproc).eq.110553) is_a_onium(i)=.true. ! bottomonium
4301-c if (idup(i,1,iproc).eq.120553) is_a_onium(i)=.true. ! bottomonium
4302-c if (idup(i,1,iproc).eq.130553) is_a_onium(i)=.true. ! bottomonium
4303-c if (idup(i,1,iproc).eq.200553) is_a_onium(i)=.true. ! bottomonium
4304-c if (idup(i,1,iproc).eq.210553) is_a_onium(i)=.true. ! bottomonium
4305-c if (idup(i,1,iproc).eq.220553) is_a_onium(i)=.true. ! bottomonium
4306-c if (idup(i,1,iproc).eq.300553) is_a_onium(i)=.true. ! bottomonium
4307-c if (idup(i,1,iproc).eq.9000553) is_a_onium(i)=.true. ! bottomonium
4308-c if (idup(i,1,iproc).eq.9010553) is_a_onium(i)=.true. ! bottomonium
4309-c if (idup(i,1,iproc).eq.555) is_a_onium(i)=.true. ! bottomonium
4310-c if (idup(i,1,iproc).eq.10555) is_a_onium(i)=.true. ! bottomonium
4311-c if (idup(i,1,iproc).eq.20555) is_a_onium(i)=.true. ! bottomonium
4312-c if (idup(i,1,iproc).eq.100555) is_a_onium(i)=.true. ! bottomonium
4313-c if (idup(i,1,iproc).eq.110555) is_a_onium(i)=.true. ! bottomonium
4314-c if (idup(i,1,iproc).eq.200555) is_a_onium(i)=.true. ! bottomonium
4315-c if (idup(i,1,iproc).eq.557) is_a_onium(i)=.true. ! bottomonium
4316-c if (idup(i,1,iproc).eq.100557) is_a_onium(i)=.true. ! bottomonium
4317-
4318-c if (idup(i,1,iproc).eq.541) is_a_onium(i)=.true. ! Bc
4319-c if (idup(i,1,iproc).eq.10541) is_a_onium(i)=.true. ! Bc
4320-c if (idup(i,1,iproc).eq.543) is_a_onium(i)=.true. ! Bc
4321-c if (idup(i,1,iproc).eq.10543) is_a_onium(i)=.true. ! Bc
4322-c if (idup(i,1,iproc).eq.20543) is_a_onium(i)=.true. ! Bc
4323-c if (idup(i,1,iproc).eq.545) is_a_onium(i)=.true. ! Bc
4324+
4325+c Remember mergeable particles
4326+ do j=1,pdgs_for_merging_cut(0)
4327+ if ( pdgs_for_merging_cut(j) .ne. 0
4328+ $ .and. abs(idup(i,1,iproc)) .eq.pdgs_for_merging_cut(j) ) then
4329+ is_pdg_for_merging_cut(i)=.true.
4330+ exit
4331+ endif
4332+ enddo
4333+
4334 enddo
4335
4336
4337
4338=== modified file 'Template/LO/SubProcesses/unwgt.f'
4339--- Template/LO/SubProcesses/unwgt.f 2016-05-05 11:12:21 +0000
4340+++ Template/LO/SubProcesses/unwgt.f 2016-08-23 01:19:18 +0000
4341@@ -236,9 +236,9 @@
4342 c call write_event(p,uwgt)
4343 c write(29,'(2e15.5)') matrix,wgt
4344 c $B$ S-COMMENT_C $B$
4345- call write_leshouche(p,uwgt,numproc)
4346+ call write_leshouche(p,uwgt,numproc,.True.)
4347 elseif (xwgt .gt. 0d0 .and. nw .lt. 5) then
4348- call write_leshouche(p,wgt/twgt*1d-6,numproc)
4349+ call write_leshouche(p,wgt/twgt*1d-6,numproc,.True.)
4350 c $E$ S-COMMENT_C $E$
4351 endif
4352 maxwgt=max(maxwgt,xwgt)
4353@@ -437,7 +437,7 @@
4354 c close(lun)
4355 end
4356
4357- SUBROUTINE write_leshouche(p,wgt,numproc)
4358+ SUBROUTINE write_leshouche(p,wgt,numproc,do_write_events)
4359 C**************************************************************************
4360 C Writes out information for event
4361 C**************************************************************************
4362@@ -460,15 +460,16 @@
4363 c
4364 double precision p(0:3,nexternal),wgt
4365 integer numproc
4366+ logical do_write_events
4367 c
4368 c Local
4369 c
4370 integer i,j,k,iini,ifin
4371 double precision sum_wgt,sum_wgt2, xtarget,targetamp(maxflow)
4372- integer ip, np, ic, nc, jpart(7,-nexternal+3:2*nexternal-3)
4373+ integer ip, np, ic, nc
4374 integer ida(2),ito(-nexternal+3:nexternal),ns,nres,ires,icloop
4375 integer iseed
4376- double precision pboost(0:3),pb(0:4,-nexternal+3:2*nexternal-3)
4377+ double precision pboost(0:3)
4378 double precision beta, get_betaz
4379 double precision ebi(0:3), ebo(0:3)
4380 double precision ptcltmp(nexternal), pdum(0:3)
4381@@ -477,19 +478,14 @@
4382 integer mothup(2,nexternal)
4383 integer icolup(2,nexternal,maxflow,maxsproc)
4384
4385- integer isym(nexternal,99), nsym, jsym
4386+ integer nsym
4387
4388- double precision sscale,aaqcd,aaqed
4389- integer ievent,npart
4390+ integer ievent
4391 logical flip
4392
4393 real ran1
4394 external ran1
4395
4396- character*1000 buff
4397- character*(s_bufflen) s_buff(7)
4398- integer nclus
4399- character*(clus_bufflen) buffclus(nexternal)
4400 character*40 cfmt
4401 C
4402 C GLOBAL
4403@@ -510,9 +506,6 @@
4404 integer mincfig, maxcfig
4405 common/to_configs/mincfig, maxcfig
4406
4407- integer ngroup
4408- common/to_group/ngroup
4409-
4410 double precision stot,m1,m2
4411 common/to_stot/stot,m1,m2
4412 c
4413@@ -529,17 +522,24 @@
4414 c data ncolflow/maxamps*0/
4415 c data ncolalt/maxamps*0/
4416
4417+ include 'coupl.inc'
4418+
4419+ include 'lhe_event_infos.inc'
4420+ data AlreadySetInBiasModule/.False./
4421+
4422 include 'symswap.inc'
4423- include 'coupl.inc'
4424 C-----
4425 C BEGIN CODE
4426 C-----
4427
4428- if (nw .ge. maxevents) return
4429-
4430-c Store weight for event
4431- nw = nw+1
4432- swgt(nw)=wgt
4433+ if ((nw .ge. maxevents).and.do_write_events) return
4434+
4435+C if all the necessary inputs to write the events have already been
4436+C computed in the bias module, then directly jump to write_events
4437+ if (AlreadySetInBiasModule) then
4438+ goto 1123
4439+ endif
4440+
4441 c
4442 c In case of identical particles symmetry, choose assignment
4443 c
4444@@ -746,6 +746,19 @@
4445 write(buffclus(nexternal),'(a)')'</clustering>'
4446 endif
4447
4448+C If the arguments of write_event have already been set in the
4449+C bias module, then the beginning of the routine will directly
4450+C jump here.
4451+
4452+ 1123 continue
4453+ if (.not.do_write_events) then
4454+ return
4455+ endif
4456+
4457+c Store weight for event
4458+ nw = nw+1
4459+ swgt(nw)=wgt
4460+
4461 call write_event(lun,pb(0,1),wgt,npart,jpart(1,1),ngroup,
4462 & sscale,aaqcd,aaqed,buff,use_syst,s_buff,nclus,buffclus)
4463 if(btest(mlevel,1))
4464
4465=== modified file 'Template/LO/bin/internal/run_delphes3'
4466--- Template/LO/bin/internal/run_delphes3 2013-02-25 00:52:53 +0000
4467+++ Template/LO/bin/internal/run_delphes3 2016-08-23 01:19:18 +0000
4468@@ -9,6 +9,7 @@
4469 run=$2
4470 tag=$3
4471 cross=$4
4472+file=$5
4473
4474 main=`pwd`
4475
4476@@ -22,17 +23,34 @@
4477 exit
4478 fi
4479
4480+if [ ${file: -3} == ".gz" ]
4481+then
4482+ if [ ${file: -7} == ".hep.gz" ]
4483+ then
4484+ gunzip --stdout $file | $delphesdir/DelphesSTDHEP ../Cards/delphes_card.dat ${run}/${tag}_delphes_events.root
4485+ else
4486+ gunzip --stdout $file | $delphesdir/DelphesHepMC ../Cards/delphes_card.dat ${run}/${tag}_delphes_events.root
4487+ fi
4488+else
4489+ if [ ${file: -4} == ".hep" ]
4490+ then
4491+ $delphesdir/DelphesSTDHEP ../Cards/delphes_card.dat ${run}/${tag}_delphes_events.root $file
4492+ else
4493+ $delphesdir/DelphesHepMC ../Cards/delphes_card.dat ${run}/${tag}_delphes_events.root $file
4494+ fi
4495+fi
4496+
4497 echo $$ >> ../myprocid
4498
4499-# Set delphes path in delphes_card.dat
4500-
4501-$delphesdir/DelphesSTDHEP ../Cards/delphes_card.dat delphes.root pythia_events.hep
4502-$delphesdir/root2lhco delphes.root delphes_events.lhco
4503-
4504-if [ -e delphes_events.lhco ]; then
4505-# write the delphes banner
4506- sed -e "s/^/#/g" ${run}/${run}_${tag}_banner.txt > ${run}/${tag}_delphes_events.lhco
4507- echo "## Integrated weight (pb) : ${cross}" >> ${run}/${tag}_delphes_events.lhco
4508- cat delphes_events.lhco >> ${run}/${tag}_delphes_events.lhco
4509- rm -f delphes_events.lhco
4510-fi
4511+# Uncomment the following to have the LHCO file:
4512+#
4513+#
4514+#$delphesdir/root2lhco ${run}/${tag}_delphes.root delphes_events.lhco
4515+#
4516+#if [ -e delphes_events.lhco ]; then
4517+## write the delphes banner
4518+# sed -e "s/^/#/g" ${run}/${run}_${tag}_banner.txt > ${run}/${tag}_delphes_events.lhco
4519+# echo "## Integrated weight (pb) : ${cross}" >> ${run}/${tag}_delphes_events.lhco
4520+# cat delphes_events.lhco >> ${run}/${tag}_delphes_events.lhco
4521+# rm -f delphes_events.lhco
4522+#fi
4523
4524=== modified file 'Template/NLO/SubProcesses/BinothLHA.f'
4525--- Template/NLO/SubProcesses/BinothLHA.f 2016-03-02 09:31:23 +0000
4526+++ Template/NLO/SubProcesses/BinothLHA.f 2016-08-23 01:19:18 +0000
4527@@ -85,6 +85,8 @@
4528 c itself again to perform stability check to make sure no unstable EPS
4529 c splips unnoticed.
4530 CALL FORCE_STABILITY_CHECK(.TRUE.)
4531+ CALL COLLIER_COMPUTE_UV_POLES(.FALSE.)
4532+ CALL COLLIER_COMPUTE_IR_POLES(.FALSE.)
4533 firsttime_run = .false.
4534 endif
4535 if (firsttime) then
4536@@ -102,6 +104,7 @@
4537 c Just set the accuracy found to a positive value as it is not specified
4538 c once the initial pole check is performed.
4539 if (mc_hel.eq.0) then
4540+
4541 call sloopmatrix_thres(p,virt_wgts,tolerance,accuracies
4542 $ ,ret_code)
4543 prec_found = accuracies(0)
4544@@ -164,18 +167,19 @@
4545 c MadLoop initialization PS points.
4546 cpol=.false.
4547 if ((firsttime .or. mc_hel.eq.0) .and. mod(ret_code,100)/10.ne.3
4548- $ .and. mod(ret_code,100)/10.ne.4) then
4549+ $ .and. mod(ret_code,100)/10.ne.4) then
4550 call getpoles(p,QES2,madfks_double,madfks_single,fksprefact)
4551 avgPoleRes(1)=(single+madfks_single)/2.0d0
4552 avgPoleRes(2)=(double+madfks_double)/2.0d0
4553 PoleDiff(1)=dabs(single - madfks_single)
4554 PoleDiff(2)=dabs(double - madfks_double)
4555 if ((dabs(avgPoleRes(1))+dabs(avgPoleRes(2))).ne.0d0) then
4556- cpol = .not. (((PoleDiff(1)+PoleDiff(2))/
4557+ cpol = .not. ((((PoleDiff(1)+PoleDiff(2))/
4558 $ (dabs(avgPoleRes(1))+dabs(avgPoleRes(2)))) .lt.
4559- $ tolerance*10d0)
4560+ $ tolerance*10d0).or.(mod(ret_code,10).eq.7))
4561 else
4562- cpol = .not.(PoleDiff(1)+PoleDiff(2).lt.tolerance*10d0)
4563+ cpol = .not.((PoleDiff(1)+PoleDiff(2).lt.tolerance*10d0).or.
4564+ $ (mod(ret_code,10).eq.7))
4565 endif
4566 if (tolerance.lt.0.0d0) then
4567 cpol = .false.
4568
4569=== modified file 'Template/NLO/SubProcesses/check_poles.f'
4570--- Template/NLO/SubProcesses/check_poles.f 2016-03-02 09:31:23 +0000
4571+++ Template/NLO/SubProcesses/check_poles.f 2016-08-23 01:19:18 +0000
4572@@ -116,6 +116,8 @@
4573 c Make sure that stability checks are always used by MadLoop, even for
4574 c initialization
4575 CALL FORCE_STABILITY_CHECK(.TRUE.)
4576+ CALL COLLIER_COMPUTE_UV_POLES(.TRUE.)
4577+ CALL COLLIER_COMPUTE_IR_POLES(.TRUE.)
4578
4579 200 continue
4580 calculatedborn = .false.
4581
4582=== modified file 'Template/NLO/SubProcesses/makefile_loop.inc'
4583--- Template/NLO/SubProcesses/makefile_loop.inc 2016-03-02 03:03:20 +0000
4584+++ Template/NLO/SubProcesses/makefile_loop.inc 2016-08-23 01:19:18 +0000
4585@@ -24,6 +24,7 @@
4586 $(patsubst %(dotf)s,%(doto)s,$(wildcard mp_coef_construction_*.f)) \
4587 $(patsubst %(dotf)s,%(doto)s,$(wildcard TIR_interface.f)) \
4588 $(patsubst %(dotf)s,%(doto)s,$(wildcard GOLEM_interface.f)) \
4589+ $(patsubst %(dotf)s,%(doto)s,$(wildcard COLLIER_interface.f)) \
4590 $(patsubst %(dotf)s,%(doto)s,$(wildcard compute_color_flows.f))
4591
4592 # This is the core of madloop computationally wise, so make sure to turn optimizations on and bound checks off.
4593
4594=== modified file 'Template/loop_material/StandAlone/Cards/MadLoopParams.dat'
4595--- Template/loop_material/StandAlone/Cards/MadLoopParams.dat 2016-04-06 10:19:13 +0000
4596+++ Template/loop_material/StandAlone/Cards/MadLoopParams.dat 2016-08-23 01:19:18 +0000
4597@@ -4,8 +4,8 @@
4598
4599 !
4600 #MLReductionLib
4601-!6|1|2
4602-! Default :: 6|1|2
4603+!6|7|1
4604+! Default :: 6|7|1
4605 ! The tensor integral reduction library.The current choices are:
4606 ! 1 | CutTools
4607 ! 2 | PJFry++
4608@@ -13,6 +13,7 @@
4609 ! 4 | Golem95
4610 ! 5 | Samurai
4611 ! 6 | Ninja
4612+! 7 | COLLIER
4613 ! One can use the combinations to reduce integral,e.g.
4614 ! 1|2|3 means first use CutTools, if it is not stable, use PJFry++,
4615 ! if it is still unstable, use IREGI. If it failed, use QP of CutTools.
4616@@ -22,15 +23,15 @@
4617 ! When using quadruple precision with Ninja or CutTools, the reduction will
4618 ! always be done in quadruple precision, but the parameters below allow you to
4619 ! chose if you want to also recompute the *integrand* in quadruple precision.
4620-! Doing so is slow and typically does not improve the accuracy for Ninja, so it
4621-! is disabled by default in this case.
4622+! Doing so is slow but might improve the accuracy in some situation.
4623 #UseQPIntegrandForCutTools
4624 !.TRUE.
4625 ! Default :: .TRUE.
4626 #UseQPIntegrandForNinja
4627-!.FALSE.
4628-! Default :: .FALSE.
4629+!.TRUE.
4630+! Default :: .TRUE.
4631 !
4632+
4633 ! =================================================================================
4634 ! The parameters below set the parameters for IREGI
4635 ! =================================================================================
4636@@ -38,9 +39,9 @@
4637 #IREGIMODE
4638 !2
4639 ! Default :: 2
4640-! IMODE=0, IBP reduction
4641-! IMODE=1, PaVe reduction
4642-! IMODE=2, PaVe reduction with stablility improved by IBP reduction
4643+! IREGIMODE=0, IBP reduction
4644+! IREGIMODE=1, PaVe reduction
4645+! IREGIMODE=2, PaVe reduction with stablility improved by IBP reduction
4646
4647 #IREGIRECY
4648 !.TRUE.
4649@@ -59,7 +60,7 @@
4650 ! 2 | Double precision, loops reduced with propagator with reversed order
4651 ! 4 | Quadruple precision, loops reduced with propagator in original order
4652 ! 5 | Quadruple precision, loops reduced with propagator with reversed order
4653-! -1 |  Exhaustive automated numerical stability checks. See below for details.
4654+! -1 | Exhaustive automated numerical stability checks. See below for details.
4655 !
4656 ! Due to the architecture of the program, you are better off
4657 ! rerunning the full PS point in quadruple precision than just a single loop
4658@@ -84,8 +85,8 @@
4659 ! Below you can chose if you want to use zero, one or two rotations of the PS point
4660 ! in QP.
4661 #NRotations_DP
4662-!1
4663-! Default :: 1
4664+!0
4665+! Default :: 0
4666 #NRotations_QP
4667 !0
4668 ! Default :: 0
4669@@ -114,6 +115,7 @@
4670 #ImprovePSPoint
4671 !2
4672 ! Default :: 2
4673+
4674 ! =================================================================================
4675 ! The parameters below set two CutTools internal parameters accessible to the user.
4676 ! =================================================================================
4677@@ -226,4 +228,71 @@
4678 !.FALSE.
4679 ! Default :: .FALSE.
4680
4681+! =================================================================================
4682+! The parameters below set the main parameters for COLLIER
4683+! To edit more specific technical COLLIER parameters, modify directly the content
4684+! of the subroutine 'INITCOLLIER' in the file 'MadLoopCommons.f'
4685+! =================================================================================
4686+
4687+! Decide if COLLIER must be computed multiple times to evaluate the UV pole residues
4688+! (Withing a Monte-Carlo performed in MG5aMC, this is automatically disabled internally)
4689+#COLLIERComputeUVpoles
4690+!.TRUE.
4691+! Default :: .TRUE.
4692+
4693+! Decide if COLLIER must be computed multiple times to evaluate the IR pole residues
4694+! (Withing a Monte-Carlo performed in MG5aMC, this is automatically disabled internally)
4695+#COLLIERComputeIRpoles
4696+!.TRUE.
4697+! Default :: .TRUE.
4698+
4699+! Decide if COLLIER must be computed multiple times to evaluate the IR pole residues
4700+#COLLIERRequiredAccuracy
4701+!1.0d-8
4702+! Default :: 1.0d-8
4703+! A value of -1.0d0 means that it will be automatically set from MLStabThres.
4704+! The default value of 1.0d-8 corresponds to the value for which COLLIER's authors
4705+! have optimized the library.
4706+
4707+! Decide whether to use COLLIER's internal stability test or the loop-direction
4708+! switch test instead.
4709+#COLLIERUseInternalStabilityTest
4710+!.TRUE.
4711+! Default :: .TRUE.
4712+! COLLIER's internal stability test is at no extra cost but not as reliable
4713+! as the loop-direction switch test, which however doubles the reduction time.
4714+! This parameter is only relevant when running MadLoop with CTModeRun=-1.
4715+! If you find a large number of unstable points with COLLIER for complicated
4716+! processes, set this parameter to .FALSE. to make sure the PS points flagged
4717+! as unstable with COLLIER really are so.
4718+
4719+! Set up to which N-loop to use the COLLIER global caching system.
4720+#COLLIERGlobalCache
4721+!-1
4722+! Default :: -1
4723+! -1 : Enable the global cache for all loops
4724+! 0 : Disable the global cache alltogether
4725+! N : Enable the global cache but only for up to N-loops
4726+
4727+! Use the global cache when evaluating the poles as well (more memory consuming)
4728+! During a Monte-Carlo it is typically not useful anyway, because the pole
4729+! computation is automatically disabled for COLLIER, irrespectively of the value
4730+! of the parameters COLLIERCompute<UV/IR>poles specified above.
4731+#COLLIERUseCacheForPoles
4732+!.FALSE.
4733+! Default :: .FALSE.
4734+
4735+! Choose which branch(es) of COLLIER have to be used
4736+#COLLIERMode
4737+!1
4738+! Default :: 1
4739+! COLLIERMode=1 : COLI branch
4740+! COLLIERMode=2 : DD branch
4741+! COLLIERMode=3 : Both DD and COLI branch compared
4742+
4743+! Decide if COLLIER can output its information in a log directory.
4744+#COLLIERCanOutput
4745+!.FALSE.
4746+! Default :: .FALSE.
4747+
4748 /* End of param file */
4749
4750=== modified file 'Template/loop_material/StandAlone/SubProcesses/MadLoopCommons.inc'
4751--- Template/loop_material/StandAlone/SubProcesses/MadLoopCommons.inc 2016-02-08 23:58:00 +0000
4752+++ Template/loop_material/StandAlone/SubProcesses/MadLoopCommons.inc 2016-08-23 01:19:18 +0000
4753@@ -30,6 +30,86 @@
4754
4755 end
4756
4757+
4758+## if(collier_available){
4759+ SUBROUTINE INITCOLLIER()
4760+C
4761+C INITIALISATION OF COLLIER
4762+C
4763+C
4764+C MODULE
4765+C
4766+ USE COLLIER
4767+C
4768+C CONSTANTS
4769+C
4770+ character(len=*) no_folder
4771+ parameter (no_folder='')
4772+ character(len=*) folderOutput
4773+ parameter (folderOutput='COLLIER_output')
4774+
4775+C Force COLLIER to completely reset from scratch
4776+ logical noreset
4777+ parameter (noreset=.FALSE.)
4778+C
4779+C LOCAL VARIABLES
4780+C
4781+ INTEGER N_CACHES
4782+C
4783+C GLOBAL VARIABLES
4784+C
4785+ include 'MadLoopParams.inc'
4786+C Now obtain the overall maximum rank, maximum external lines
4787+C and maximal number of processes.
4788+ include 'global_specs.inc'
4789+
4790+C ----------
4791+C BEGIN CODE
4792+C ----------
4793+
4794+C Initialize Collier
4795+ IF (.NOT.COLLIERCanOutput) THEN
4796+ CALL Init_cll(MAXNEXTERNAL,OVERALLMAXRANK,no_folder,noreset)
4797+ ELSE
4798+ CALL Init_cll(MAXNEXTERNAL,OVERALLMAXRANK,folderOutput,noreset)
4799+ ENDIF
4800+
4801+C Set target accuracy, be conservative w.r.t user request
4802+C Keep in mind that COLLIER has been optimized for 1d-8.
4803+ IF (COLLIERRequiredAccuracy.eq.-1.0d0) THEN
4804+ CALL SetReqAcc_cll(MLStabThres*1.0d-3)
4805+ ELSE
4806+ CALL SetReqAcc_cll(COLLIERRequiredAccuracy)
4807+ ENDIF
4808+
4809+C Set COLLIER mode
4810+ CALL SetMode_cll(COLLIERMode)
4811+
4812+C Set the global cache strategy
4813+C If we use the caches for the poles as well, then it is a total of
4814+C 4 caches per process.
4815+ IF (COLLIERUseCacheForPoles) THEN
4816+ N_CACHES =4*NPROCS
4817+ ELSE
4818+ N_CACHES =NPROCS
4819+ ENDIF
4820+ IF (COLLIERGlobalCache.eq.-1) THEN
4821+ CALL InitCacheSystem_cll(N_CACHES,MAXNEXTERNAL)
4822+ ELSEIF(COLLIERGlobalCache.gt.0) THEN
4823+ CALL InitCacheSystem_cll(N_CACHES,COLLIERGlobalCache)
4824+ ENDIF
4825+
4826+C Make sure to start by first switching off all cache
4827+ IF (COLLIERGlobalCache.ne.0) THEN
4828+ call SwitchOffCacheSystem_cll()
4829+ ENDIF
4830+
4831+C Specify below your other custom COLLIER parameter settings
4832+C [user_specific_COLLIER_settings]
4833+
4834+ END
4835+## }
4836+
4837 SUBROUTINE SET_FORBID_HEL_DOUBLECHECK(ONOFF)
4838 C
4839 C Give the possibility to overwrite the value of MadLoopParams.dat
4840@@ -67,9 +147,10 @@
4841 DATA ML_INIT/.TRUE./
4842 common/ML_INIT/ML_INIT
4843
4844- LOGICAL CTINIT,TIRINIT,GOLEMINIT,SAMURAIINIT,NINJAINIT
4845- DATA CTINIT,TIRINIT,GOLEMINIT,SAMURAIINIT,NINJAINIT/.TRUE.,.TRUE.,.TRUE.,.TRUE.,.TRUE./
4846- COMMON/REDUCTIONCODEINIT/CTINIT, TIRINIT, GOLEMINIT, SAMURAIINIT, NINJAINIT
4847+ LOGICAL CTINIT,TIRINIT,GOLEMINIT,SAMURAIINIT,NINJAINIT,COLLIERINIT
4848+ DATA CTINIT,TIRINIT,GOLEMINIT,SAMURAIINIT,NINJAINIT,COLLIERINIT/.TRUE.,.TRUE.,.TRUE.,.TRUE.,.TRUE.,.TRUE./
4849+ COMMON/REDUCTIONCODEINIT/CTINIT, TIRINIT, GOLEMINIT, SAMURAIINIT, NINJAINIT, COLLIERINIT
4850+
4851
4852 character(512) MLPath
4853 data MLPath/'[[NA]]'/
4854@@ -163,6 +244,8 @@
4855 C Stable with Samurai.
4856 C U == 6
4857 C Stable with Ninja in double precision.
4858+C U == 7
4859+C Stable with COLLIER.
4860 C U == 8
4861 C Stable with Ninja in quadruple precision.
4862 C U == 9
4863@@ -201,10 +284,10 @@
4864 STOP 'Only CutTools and Ninja can use quardruple precision'
4865 ENDIF
4866 ENDIF
4867- IF(MLRed.GE.1.AND.MLRed.LE.6)THEN
4868+ IF(MLRed.GE.1.AND.MLRed.LE.7)THEN
4869 SET_RET_CODE_U=MLRed
4870 ELSE
4871- STOP 'Only CutTools, PJFry++, IREGI, Golem95, Samurai and Ninja are available'
4872+ STOP 'Only CutTools, PJFry++, IREGI, Golem95, Samurai, Ninja and COLLIER are available'
4873 ENDIF
4874 END
4875
4876@@ -249,8 +332,11 @@
4877 ELSEIF(LIBNUM.EQ.6)THEN
4878 C Ninja
4879 CALL DETECT_NINJA(NLOOPLINE,RANK,complex_mass,LPASS)
4880+ ELSEIF(LIBNUM.EQ.7)THEN
4881+C Collier
4882+ CALL DETECT_COLLIER(NLOOPLINE,RANK,complex_mass,LPASS)
4883 ELSE
4884- STOP 'ONLY CUTTOOLS,PJFry++,IREGI,Golem95 and Samurai are available'
4885+ STOP 'Only CutTools, PJFry++, IREGI, Golem95, Samurai, Ninja and COLLIER are available'
4886 ENDIF
4887 RETURN
4888 END
4889@@ -358,6 +444,65 @@
4890 RETURN
4891 END
4892
4893+## if(collier_available){
4894+ SUBROUTINE DETECT_COLLIER(NLOOPLINE,RANK,complex_mass,LPASS)
4895+C
4896+C Detect whether Collier can be used or not
4897+C
4898+ USE COLLIER
4899+ IMPLICIT NONE
4900+C
4901+C CONSTANTS
4902+C
4903+C
4904+C ARGUMENTS
4905+C
4906+ INTEGER NLOOPLINE,RANK
4907+ LOGICAL complex_mass,LPASS
4908+C
4909+C LOCAL VARIABLES
4910+C
4911+ INTEGER CURRENT_COLLIERMODE
4912+C
4913+C GLOBAL VARIABLES
4914+C
4915+ LOGICAL CTINIT,TIRINIT,GOLEMINIT,SAMURAIINIT,NINJAINIT,COLLIERINIT
4916+ COMMON/REDUCTIONCODEINIT/CTINIT, TIRINIT, GOLEMINIT, SAMURAIINIT, NINJAINIT, COLLIERINIT
4917+ include 'MadLoopParams.inc'
4918+C ----------
4919+C BEGIN CODE
4920+C ----------
4921+ if (.NOT.COLLIERINIT) THEN
4922+ CALL GETMODE_CLL(CURRENT_COLLIERMODE)
4923+ ELSE
4924+ CURRENT_COLLIERMODE = COLLIERMODE
4925+ ENDIF
4926+ LPASS=.TRUE.
4927+ IF (CURRENT_COLLIERMODE.NE.1) THEN
4928+C The DD branch is used and it has limitations
4929+ IF((NLOOPLINE.GT.6).OR.(RANK.GT.NLOOPLINE)) then
4930+ LPASS=.FALSE.
4931+ endif
4932+ ELSE
4933+C Limitations of the COLI branch are academic.
4934+ LPASS=.TRUE.
4935+ ENDIF
4936+ RETURN
4937+ END
4938+## }else{
4939+ SUBROUTINE DETECT_COLLIER(NLOOPLINE,RANK,complex_mass,LPASS)
4940+C
4941+C ARGUMENTS
4942+C
4943+ INTEGER NLOOPLINE,RANK
4944+ LOGICAL complex_mass,LPASS
4945+C
4946+C COLLIER is not available in this output. This subroutine is dummy.
4947+C
4948+ LPASS=.True.
4949+ END
4950+## }
4951+
4952 SUBROUTINE DETECT_PJFRY(NLOOPLINE,RANK,complex_mass,LPASS)
4953 C
4954 C DETECT whether PJFRY++ CAN BE USED OR NOT
4955
4956=== modified file 'Template/loop_material/StandAlone/SubProcesses/MadLoopParamReader.f'
4957--- Template/loop_material/StandAlone/SubProcesses/MadLoopParamReader.f 2016-02-18 11:42:56 +0000
4958+++ Template/loop_material/StandAlone/SubProcesses/MadLoopParamReader.f 2016-08-23 01:19:18 +0000
4959@@ -33,6 +33,12 @@
4960 stop 'CTModeRun must be >= -1 and <=6.'
4961 endif
4962
4963+ else if (buff .eq. '#COLLIERGlobalCache') then
4964+ read(666,*,end=999) COLLIERGlobalCache
4965+ if (COLLIERGlobalCache .lt. -1) then
4966+ stop 'COLLIERGlobalCache must be >= -1'
4967+ endif
4968+
4969 else if (buff .eq. '#NRotations_DP') then
4970 read(666,*,end=999) NRotations_DP
4971 if (NRotations_DP .lt. 0 .or.
4972@@ -52,7 +58,14 @@
4973 if (MLStabThres.lt.0.0d0) then
4974 stop 'MLStabThres must be >= 0'
4975 endif
4976-
4977+
4978+ else if (buff .eq. '#COLLIERRequiredAccuracy') then
4979+ read(666,*,end=999) COLLIERRequiredAccuracy
4980+ if (COLLIERRequiredAccuracy.le.0.0d0.and.
4981+ & COLLIERRequiredAccuracy.ne.-1.0d0) then
4982+ stop 'COLLIERRequiredAccuracy must be > 0 or = -1.0'
4983+ endif
4984+
4985 else if (buff .eq. '#CTLoopLibrary') then
4986 read(666,*,end=999) CTLoopLibrary
4987 if (CTLoopLibrary.lt.2 .or.
4988@@ -90,6 +103,21 @@
4989 stop 'MaxAttempts must be >= 1'
4990 endif
4991
4992+ else if (buff .eq. '#COLLIERComputeUVpoles') then
4993+ read(666,*,end=999) COLLIERComputeUVpoles
4994+
4995+ else if (buff .eq. '#COLLIERComputeIRpoles') then
4996+ read(666,*,end=999) COLLIERComputeIRpoles
4997+
4998+ else if (buff .eq. '#COLLIERUseInternalStabilityTest') then
4999+ read(666,*,end=999) COLLIERUseInternalStabilityTest
5000+
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches

to all changes: