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

Proposed by Olivier Mattelaer
Status: Merged
Merge reported by: Olivier Mattelaer
Merged at revision: not available
Proposed branch: lp:~maddevelopers/mg5amcnlo/2.5.0
Merge into: lp:mg5amcnlo/lts
Diff against target: 154242 lines (+111313/-26147)
355 files modified
MadSpin/decay.py (+2/-2)
Template/Common/Cards/delphes_card_ATLAS.dat (+49/-21)
Template/Common/Cards/delphes_card_CMS.dat (+32/-15)
Template/Common/Cards/delphes_card_default.dat (+32/-15)
Template/Common/bin/internal/run_pythia (+0/-23)
Template/LO/Cards/madanalysis5_hadron_card_default.dat (+3/-0)
Template/LO/Cards/madanalysis5_parton_card_default.dat (+3/-0)
Template/LO/Cards/pythia8_card_default.dat (+77/-0)
Template/LO/Cards/run_card.dat (+51/-51)
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 (+12/-2)
Template/LO/Source/run.inc (+8/-0)
Template/LO/Source/rw_events.f (+125/-3)
Template/LO/SubProcesses/cuts.f (+1750/-1319)
Template/LO/SubProcesses/genps.f (+2/-2)
Template/LO/SubProcesses/makefile (+10/-3)
Template/LO/SubProcesses/reweight.f (+52/-6)
Template/LO/SubProcesses/setcuts.f (+16/-49)
Template/LO/SubProcesses/unwgt.f (+70/-60)
Template/LO/bin/internal/run_delphes3 (+31/-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 (+64/-23)
VERSION (+3/-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/create_release.py (+32/-85)
bin/mg5_aMC (+21/-4)
input/.mg5_configuration_default.txt (+22/-6)
madgraph/core/base_objects.py (+16/-13)
madgraph/core/diagram_generation.py (+47/-5)
madgraph/core/drawing.py (+10/-3)
madgraph/fks/fks_common.py (+28/-11)
madgraph/interface/amcatnlo_interface.py (+17/-6)
madgraph/interface/amcatnlo_run_interface.py (+77/-31)
madgraph/interface/common_run_interface.py (+2253/-277)
madgraph/interface/extended_cmd.py (+498/-40)
madgraph/interface/launch_ext_program.py (+2/-3)
madgraph/interface/loop_interface.py (+332/-16)
madgraph/interface/madevent_interface.py (+1319/-262)
madgraph/interface/madgraph_interface.py (+562/-386)
madgraph/interface/master_interface.py (+7/-4)
madgraph/interface/reweight_interface.py (+103/-39)
madgraph/iolibs/drawing_eps.py (+2/-2)
madgraph/iolibs/export_cpp.py (+462/-364)
madgraph/iolibs/export_fks.py (+132/-23)
madgraph/iolibs/export_v4.py (+489/-306)
madgraph/iolibs/file_writers.py (+2/-1)
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 (+6/-2)
madgraph/iolibs/template_files/madevent_run_config.inc (+4/-0)
madgraph/iolibs/template_files/madevent_symmetry.f (+2/-2)
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/MadLoopBannerStyles.py (+0/-1)
madgraph/loop/loop_diagram_generation.py (+10/-6)
madgraph/loop/loop_exporters.py (+212/-72)
madgraph/madevent/combine_runs.py (+11/-9)
madgraph/madevent/gen_crossxhtml.py (+358/-158)
madgraph/madevent/sum_html.py (+3/-0)
madgraph/various/banner.py (+1397/-142)
madgraph/various/cluster.py (+3/-1)
madgraph/various/diagram_symmetry.py (+1/-1)
madgraph/various/histograms.py (+210/-30)
madgraph/various/lhe_parser.py (+327/-86)
madgraph/various/misc.py (+226/-83)
madgraph/various/plot_djrs.py (+163/-0)
madgraph/various/process_checks.py (+78/-39)
madgraph/various/q_polynomial.py (+14/-0)
madgraph/various/systematics.py (+772/-0)
models/MSSM_SLHA2/MSSM_UFO.log (+81/-0)
models/MSSM_SLHA2/__init__.py (+37/-0)
models/MSSM_SLHA2/build_restrict.py (+66/-0)
models/MSSM_SLHA2/coupling_orders.py (+16/-0)
models/MSSM_SLHA2/couplings.py (+3815/-0)
models/MSSM_SLHA2/decays.py (+942/-0)
models/MSSM_SLHA2/function_library.py (+54/-0)
models/MSSM_SLHA2/lorentz.py (+79/-0)
models/MSSM_SLHA2/object_library.py (+259/-0)
models/MSSM_SLHA2/parameters.py (+4059/-0)
models/MSSM_SLHA2/particles.py (+812/-0)
models/MSSM_SLHA2/restrict_default.dat (+524/-0)
models/MSSM_SLHA2/restrict_no_b_mass.dat (+524/-0)
models/MSSM_SLHA2/restrict_no_masses.dat (+524/-0)
models/MSSM_SLHA2/restrict_no_tau_mass.dat (+524/-0)
models/MSSM_SLHA2/vertices.py (+4943/-0)
models/MSSM_SLHA2/write_param_card.py (+181/-0)
models/__init__.py (+2/-2)
models/check_param_card.py (+193/-29)
models/import_ufo.py (+18/-4)
models/model_reader.py (+32/-8)
models/mssm/MSSM_UFO.log (+0/-81)
models/mssm/__init__.py (+0/-37)
models/mssm/build_restrict.py (+0/-66)
models/mssm/coupling_orders.py (+0/-16)
models/mssm/couplings.py (+0/-3815)
models/mssm/decays.py (+0/-942)
models/mssm/function_library.py (+0/-54)
models/mssm/lorentz.py (+0/-79)
models/mssm/object_library.py (+0/-259)
models/mssm/parameters.py (+0/-4059)
models/mssm/particles.py (+0/-812)
models/mssm/restrict_default.dat (+0/-524)
models/mssm/restrict_no_b_mass.dat (+0/-524)
models/mssm/restrict_no_masses.dat (+0/-524)
models/mssm/restrict_no_tau_mass.dat (+0/-524)
models/mssm/vertices.py (+0/-4943)
models/mssm/write_param_card.py (+0/-181)
models/usermod.py (+33/-8)
models/write_param_card.py (+1/-1)
tests/IOTests.py (+35/-3)
tests/acceptance_tests/test_cmd.py (+15/-7)
tests/acceptance_tests/test_cmd_amcatnlo.py (+4/-434)
tests/acceptance_tests/test_cmd_madevent.py (+159/-21)
tests/acceptance_tests/test_cmd_madloop.py (+12/-0)
tests/acceptance_tests/test_export_fks.py (+23/-0)
tests/acceptance_tests/test_histograms.py (+0/-1)
tests/acceptance_tests/test_model_equivalence.py (+3/-2)
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/IOExportV4IOTest/export_matrix_element_v4_madevent_group/auto_dsig.f (+10/-2)
tests/input_files/IOTestsComparison/IOExportV4IOTest/export_matrix_element_v4_madevent_nogroup/auto_dsig.f (+11/-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 (+392/-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 (+392/-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 (+140/-70)
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 (+1728/-1297)
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/input_files/run_card_matching.dat (+3/-3)
tests/parallel_tests/compare_with_old_mg5_version.py (+18/-14)
tests/parallel_tests/decay_comparator.py (+24/-12)
tests/parallel_tests/input_files/run_card_decay.dat (+1/-1)
tests/parallel_tests/madevent_comparator.py (+23/-2)
tests/parallel_tests/test_MG5aMC_distribution.py (+112/-0)
tests/parallel_tests/test_ML5.py (+1/-2)
tests/parallel_tests/test_ML5MSSMQCD.py (+5/-10)
tests/parallel_tests/test_aloha.py (+55/-89)
tests/parallel_tests/test_cmd_amcatnlo.py (+600/-0)
tests/test_manager.py (+4/-3)
tests/time_db (+113/-85)
tests/unit_tests/core/test_base_objects.py (+1/-1)
tests/unit_tests/fks/test_fks_common.py (+2/-2)
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_fks.py (+16/-11)
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/madevent/test_combine_runs.py (+39/-0)
tests/unit_tests/madweight/test_export_v4.py (+2/-2)
tests/unit_tests/various/test_banner.py (+285/-51)
tests/unit_tests/various/test_decay.py (+124/-52)
tests/unit_tests/various/test_process_checks.py (+1/-1)
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/2.5.0
Reviewer Review Type Date Requested Status
MadTeam Pending
Review via email: mp+304723@code.launchpad.net

Description of the change

Hi guys,

As announced, I freeze now this version.
Please do not apply any change to this version now.
All modification should be done in 2.5.1 (not yet created).
In case of critical bug, please contact me first.

I will put this version available as beta, as soon as I have run all the parallel tests
(as usual count at least a week).

Cheers,

Olivier

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

small fix/new tests

298. By Olivier Mattelaer

fix an mg5py8interface installation problem + fix tests

299. By Olivier Mattelaer

fix html for py8 with merging + fix decay_comparator parralel tests

300. By Olivier Mattelaer

add default card for ma5 to avoid crash if those card are not created by ma5

301. By Olivier Mattelaer

fix a series of small bug

302. By Olivier Mattelaer

change mssm model to slha2 convention all the way

303. By Olivier Mattelaer

update tests
 - fix some linked to mssm
 - pass some acceptance test to parralel tests
 - improve speed of some tests
include some of Val fix of 2.5.1

304. By Olivier Mattelaer

fixing short parralel test related to the mssm modification

305. By Olivier Mattelaer

fixing the automatic installation of MA4 for the acceptance tests + make mg5 to handle correctly crash of MA5 at the time of creation of the cards

306. By Olivier Mattelaer

1) allow to filter function for the IOTest
2) remove the ML print_banner fct for the IOTest
3) fix a bug in the tests/test_manager related to IOTest
4) secure the interface to MA5

307. By Olivier Mattelaer

fix create_release

308. By Valentin Hirschi

1. Added the shortcut 'simplepy8' to turnoff advanced slow features of PY8.

309. By Valentin Hirschi

1. Added a comment in PY8 card concerning the possibility of turning off mpi.

310. By Olivier Mattelaer

edit interface modification
- add a new shortcut mpi
- improve shortcut treatment (possibility to define type of argument/number of arguement)
- add suggestions of parameter if the set command is unknow

311. By Valentin Hirschi

1. Fixed typo in mpi comment in PY8 card.

312. By Valentin Hirschi

1. modified compeltion for PY8 so as to show all parameters, not only visible ones.

313. By Olivier Mattelaer

remove a useless import triggering depreciationWarning

314. By Olivier Mattelaer

secure combine_events and systematics if problem with the zipping. + fixing combine events in presence of partials unweight

Preview Diff

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

Subscribers

People subscribed via source and target branches

to all changes: